@elaraai/e3-api-client

中文文档
1.0.107发布于 2026/11/13BUSL-1.1TypeScriptES Module构建来源已验证近 30 天下载 5446

东执行引擎 API 客户端 - TypeScript 客户端库用于 e3 API 服务器

中文使用文档
文档目录17 节
  1. 安装
  2. 概览
  3. API 密码
  4. 仓库
  5. 软件包
  6. 工作空间
  7. 数据集
  8. 任务
  9. 执行
  10. 函数调用
  11. 一发电话
  12. 分头通话
  13. Claude 代码插件
  14. 许可证
  15. 生态系统
  16. 链接
  17. 关于埃拉拉

@elaraai/e3-api-客户端

E3 API服务器的TypeScript客户端库.

安装

npm install @elaraai/e3-api-client

概览

与 e3 API 服务器交互的无国籍函数 。 使用BEAST2二进制序列化来高效地进行请求/响应编码.

API 密码

仓库

import { repoStatus, repoGc } from '@elaraai/e3-api-client';

const status = await repoStatus('http://localhost:3000');
// { path: '/path/to/repo', objectCount: 42n, packageCount: 3n, workspaceCount: 2n }

// Keep each workspace's last 5 runs and 30 days of history; the server's
// defaults when `none`
const gcResult = await repoGc(url, { dryRun: true, minAge: none, keepRuns: some(5n), keepDays: some(30n) });
// { deletedRuns: 2n, deletedExecutions: 14n, deletedObjects: 0n, retainedObjects: 42n, bytesFreed: 0n, ... }

软件包

import { packageList, packageImport, packageGet, packageExport, packageRemove } from '@elaraai/e3-api-client';

// List all packages
const packages = await packageList(url);
// [{ name: 'my-pkg', version: '1.0.0' }, ...]

// Import a package from zip bytes
const result = await packageImport(url, zipBytes);
// { name: 'my-pkg', version: '1.0.0', packageHash: 'abc123...', objectCount: 5n }

// Get package object
const pkg = await packageGet(url, 'my-pkg', '1.0.0');

// Export package as zip
const zip = await packageExport(url, 'my-pkg', '1.0.0');

// Remove package
await packageRemove(url, 'my-pkg', '1.0.0');

工作空间

import { workspaceList, workspaceCreate, workspaceGet, workspaceStatus, workspaceDeploy, workspaceRemove } from '@elaraai/e3-api-client';

// Create workspace
const info = await workspaceCreate(url, 'production');
// { name: 'production', deployed: false, packageName: null, packageVersion: null }

// Deploy package to workspace: the server runs the deploy as a job, which
// this polls, and answers what it decided for each record and index
const deployed = await workspaceDeploy(url, 'production', '[email protected]');
// { records: [{ record: 'records/plans', action: <mint | keep | migrate | reset | drop | refused> }], indexes: [...], warnings: [] }

// Get workspace status
const status = await workspaceStatus(url, 'production');
// { workspace: 'production', datasets: [...], tasks: [...], summary: { ... } }

// List workspaces
const workspaces = await workspaceList(url);

以下几个数据集的视图只要求这些: workspaceStatus(url, repo, ws, options, { paths }) 解答数据集 命名工作空间,以及产生这些空间的任务,每个空间作为一个整体 状态给它。 它花费了服务器什么 视图绑定,而不是工作空间.

民意调查要求: workspaceStatusSince(url, repo, ws, etag, options, query) 解答状态 ETag,以及 null 状态时 在它给定的标签下被解答的是当前, 这需要服务器读取 工作空间的修改,没有别的。 标记不命名为 跑者对行刑的观察记录了运行, 所以民意调查必须注意到 跑者去问无条件(etag null偶尔 民意调查成果 因为下次民意测验是重试: pollRequestOptions(options) 尝试一次NO_RETRY除非 电话员制定了自己的政策.

数据集

import { datasetList, datasetListAt, datasetGet, datasetSet } from '@elaraai/e3-api-client';
import { encodeBeast2For, decodeBeast2For, StringType, variant } from '@elaraai/east';

// List root fields
const fields = await datasetList(url, 'production');
// ['inputs', 'tasks']

// List nested fields
const inputFields = await datasetListAt(url, 'production', [variant('field', 'inputs')]);
// ['config', 'data']

// Get dataset value (raw BEAST2 bytes)
const path = [variant('field', 'inputs'), variant('field', 'config')];
const bytes = await datasetGet(url, 'production', path);
const value = decodeBeast2For(StringType)(bytes);

// Set dataset value
const encoded = encodeBeast2For(StringType)('new value');
await datasetSet(url, 'production', path, encoded);

datasetGet 下载一个收藏,作为片段对象显示其显示的名称, 一次几个,检查每个 与它的散列, 并把它们在数值 字节,所以没有响应包含一个以上的段和一个主机服务器 封顶其回复仍然为任何大小的集合服务.

读取时移动的数据集(运行时会写出新值,旧值) 对象无法再取取)再次被读取. datasetGet 重新开始 从新内容,最多3次,返回其散列. datasetGetStream 只在它回来前开始。 一旦它回来了 散列,其块端入 DatasetHashMismatchError 命名内容 数据集现在持有( n)currentHash)),打电话者从头开始. 以上显示 0级,只有更新的 e3 写法被拒绝,命名要制作的更新.

由散列而不是数据集命名的值,例如记录状态: 过去的承诺,通过对象路径读取的方式相同: collectionGetStream 以散发的散发的散发者发誓, collectionOpen 打开一个可以一次读取窗口(以下),以及 objectGet 读取其他任何值,这是一个对象。 打电话的人选的 值的类型。 一个主机的客户端读取一个页面 parsePage,作为 datasetGetPage jSON的拒绝 parseErrorBody,所以它抛出 ApiError 其它客户的密码.

任务

import { taskList, taskGet } from '@elaraai/e3-api-client';

// List tasks
const tasks = await taskList(url, 'production');
// [{ name: 'compute', hash: 'abc123...', role: <data | ui> }, ...]

// Get task details
const task = await taskGet(url, 'production', 'compute');
// { name: 'compute', hash: '...', body: <east program | command>, runner: <runtime>,
//   inputs: [{ path, partition }], output: { path, kind }, role: <data | ui> }

执行

import { dataflowExecuteLaunch, dataflowExecute, dataflowGraph, taskLogs } from '@elaraai/e3-api-client';

// Start execution (non-blocking), re-running every task even where cached
await dataflowExecuteLaunch(url, 'production', { force: true });

// Execute and wait for result (blocking), re-running only the tasks named;
// a filter is one task's exact name, run with the tasks it depends on
const result = await dataflowExecute(url, 'production', { force: ['import_sales'] });
// { success: true, executed: 1n, cached: 0n, failed: 0n, tasks: [...], duration: 1.234 }

// Get dependency graph
const graph = await dataflowGraph(url, 'production');
// { tasks: [{ name: 'compute', inputs: [...], output: '...', dependsOn: [...] }] }

// Read task logs
const logs = await taskLogs(url, 'production', 'compute', { stream: 'stdout' });
// { data: '...', offset: 0n, size: 1024n, totalSize: 2048n, complete: false }

函数调用

import {
  workspaceFunctionCall, workspaceFunctionStart, workspaceFunctionCallStatus, workspaceFunctionCallCancel,
  workspaceCallList, workspaceCallGet,
} from '@elaraai/e3-api-client';
import { encodeBeast2For, IntegerType, none, variant } from '@elaraai/east';

// Call a function of the workspace's package and wait for its result,
// however long it runs
const stop = new AbortController();
const result = await workspaceFunctionCall(url, repo, 'production', 'forecast', {
  args: [variant('value', encodeBeast2For(IntegerType)(12n))], runner: none, limits: none,
}, options, { signal: stop.signal, onStarted: (id) => console.log(`call ${id} runs on`) });
// { outcome: <success | failed | invalid | too_large | timed_out>, stdout, stderr, inputs, ... }

// The calls the workspace keeps, the latest first, and one whole
const page = await workspaceCallList(url, repo, 'production', options, { state: 'failed' });
// { calls: [{ id, function: <some(name) | none for a one-shot>, caller, startedAt, endedAt, state }, ...], next: <none | some(cursor)> }
const call = await workspaceCallGet(url, repo, 'production', page.calls[0].id, options);
// { function, package: <some({ name, version }) | none>, args, inputs, limits, state: <succeeded { value: hash } | …>, stdout, stderr, expiresAt, ... }

一个通过工作空间的呼叫是服务器的, 超过请求 启动它. workspaceFunctionCall 启动它,它等待服务器的 和民意调查,每个民意调查都由 服务器,直到呼叫结束或一段时间过后, 起初相隔250 ms 退到 2 s : 一个调用运行, 只要它的超时, 服务器的 上限,除非其 limits 求取少许. 客户端给它取名 发送它,它自己的UUIDv7,所以中止 signal 立刻停止等待.. 不管怎么样 fetch 中止时执行 由该id调用, 它的开始的答案与否; 请求是发送的 keepalive这样 一个关闭页面仍然可以到达服务器. onStarted 被告诉的id 一个从开始到现在的电话 startWaitMs 早点告诉我 A 类 已保留电话的服务器 通过同步路线, workspaceFunctionCallSync,也可以是打电话者 名称以在一个请求中回答.

碎块分开: workspaceFunctionStart(…, { waitMs, id }) 接电话 身份和状况?wait=0 答题 running 一次; 一次 id 来电者,a UUIDv7 of now, name the call, 服务器在离它很远的地方预留一个 时钟, workspaceFunctionCallStatus(…, id, options, { waitMs, signal }) 其地位—— running, (中文(简体) ), completed 联合国 结果, cancelled 命名谁问,或 lost - 和 workspaceFunctionCallCancel 请求运行中的呼叫停止。 服务器保存 每一次征召时间为一生,成功或取消一小时,取消一周 任何其他目的:谁做了它,它的论点,它读到的输入版本, 其价值及其日志,以散列表示 objectGet 读取.

一发电话

import { oneShotCall, oneShotExecute } from '@elaraai/e3-api-client';

// Run a program of the caller's over the workspace's datasets, kept among the
// workspace's calls, and wait for its result however long it runs
const result = await oneShotCall(url, repo, 'production', request, options, { signal: stop.signal });
// { outcome: <success | failed | invalid | too_large | timed_out>, stdout, stderr, inputs, ... }

// Or within one request, its timeout clamped under the server's sync
// deadline, keeping nothing
const quick = await oneShotExecute(url, repo, 'production', request, options);

一发一发给打电话者的补助金:读取工作空间运行情况的人 一个没有平台的程序,一个没有平台的股票跑者 和一个打电话的机构 没有,只有高额赠款任何其他. oneShotCall 启动它作为一个呼叫 (单位:千美元)oneShotStart并沿用如下: workspaceFunctionCall 随行 函数的: 它超时服务器的天花板, 除非它 limits 要求少一点, 被调查到最后,被阻止 signal 通过客户端的id, 财务报告和审定财务报表 onStarted 告诉他的身份 工作空间保留它,不命名函数或 软件包,所以 workspaceCallList 列出它和 workspaceCallGet 读它,和 其状态和取消是一个函数调用( q)workspaceFunctionCallStatus, (中文(简体) ), workspaceFunctionCallCancel) (中文(简体) ). 一个服务器,在日期之前,保持一个镜头运行它 在一项请求中 oneShotExecute 已经.

分头通话

import { collectionOpen, splitCall, splitCallCancel, splitCallLaunch, splitCallStatus } from '@elaraai/e3-api-client';
import { decodeBeast2For, variant } from '@elaraai/east';

// Run a program over a dataset's pieces as a job, polled to its end. Aborting
// the signal stops polling and cancels the job, so the server stops its units;
// the call rejects with the signal's reason.
const controller = new AbortController();
const { result, output, report } = await splitCall(url, 'my-repo', 'production', request, { token }, {
  onProgress: (progress) => console.log(progress.phase.type, progress.done, progress.units),
  signal: controller.signal,
});
// report: { pieces, ran, cached, peakBytes } — the pieces its input was cut
// into, the units this call ran and the cache served it, and the highest peak
// a unit reached. A call the cache served whole ran 0 and was served 0, and
// still names its pieces and peak.

// An array's first `limit` elements, in input order: the body emits as an
// array call's does, and the pieces run in order, a few at a time, stopping
// once they hold that many. The pieces are shared with an array call's.
const firstMatch = await splitCall(url, 'my-repo', 'production', { ...request, output: variant('first', { limit: 1n }) }, { token });

// A value over the call's result limit is answered too_large, naming the
// stored output instead: open it, and read it a window at a time. Each window
// fetches only the segments it overlaps, each checked against its hash.
if (result.outcome.type === 'too_large' && output !== null) {
  const remote = await collectionOpen(url, 'my-repo', output, { token });
  // remote.type: the collection's type; remote.totalElements: how many it holds
  const page = await remote.page({ offset: 1_000, limit: 100 });
  const rows = decodeBeast2For(remote.type)(page.data);
  // page.count: fewer than asked at the end, and none past it
}

// Or launch, poll and cancel it yourself
const { id } = await splitCallLaunch(url, 'my-repo', 'production', request, { token });
const status = await splitCallStatus(url, 'my-repo', 'production', id, { token });
// processing | completed { result, output, report } | planned | failed | cancelled
const after = await splitCallCancel(url, 'my-repo', 'production', id, { token });
// cancelled, or the status the job had already ended with

Claude 代码插件

东方生态系统也运载a 克劳德代码 插件 — East 语言技能, 实例搜索, 以及 East 代码的先发制人诊断 elaraai 市场:

# Inside Claude Code
/plugin marketplace add elaraai/east-workspace
/plugin install east@elaraai
# From a terminal
claude plugin marketplace add elaraai/east-workspace
claude plugin install east@elaraai

许可证

BSL 1.1. 见 利比里亚。 。 。 .

生态系统

  • 东: statical地打出,以表达为主的语言有可序列的IR. 运行跨 TypeScript, Python, C 等运行时间的可移植逻辑.

    • @elaraai/东边: 有类型系统、表达式和参考JS编译器的核心语言SDK
  • 东节点: Node.js 平台用于I/O,数据库和系统操作的功能.

  • 东 C: C11本土运行时间用于执行东IR. 通过npm(发射器+每个平面的可选依赖)进行分配,并在每个GitHub放出上作为tarball.

    • @elaraai/东-克-克利: npm 发射器 – 安装匹配的本地二进制作为可选依赖
    • east-c: Core 运行时间 – 类型系统,IR 解释器,内置,序列化(Beast2, JSON, CSV, East text)
    • east-c-std: 控制台、 文件系统、 获取、 加密、 时间、 路径、 随机
    • east-c-cli: 用于在本地运行 East IR 程序的 CLI
  • 东 Py: Python 运行时间,标准平台,I/O,以及数据科学平台功能. 发布至PyPI.

    • 东平: Core Python 运行时间——类型系统,IR编译器,212+内建,Cython加速热路
    • 东平-上: 控制台、 文件系统、 获取、 加密、 时间、 路径、 随机
    • 东比欧: SQLite, PostgreSQL, MySQL, MongoDB, Redis, S3, FTP, SFTP, XLSX, XML, 压缩
    • 东-平-克利: 用于在 Python 运行 East IR 程序的 CLI
    • 东平数据科学 (平价)+ @elaraai/东平数据科学 (npm):优化(MADS, Optuna, ALNS, GoogleOR),ML(XGBoost, LightGBM, NGBoost, PyTorch, Lightning, GP), 贝叶斯推论(PyMC),可解释性(SHAP),相通性预测(MAPIE)
  • 东方大学:已打入UI组件定义和React渲染器,外加VS代码预览.

  • e3——东行发动机: 大规模运行东方管线的持久执行引擎。 类似Git的内容可处理存储,自动记忆,反应数据流,实时监测.

关于埃拉拉

东方由 Elara AI Pty有限公司一个由AI驱动的平台 创造经济数字双胞胎 企业优化业绩。 Elara将业务目标、决定和数据结合起来,以帮助各组织在业务、采购、销售和客户参与以及项目和投资规划方面作出由数据驱动的决定。 东能给以埃拉拉解决方案的计算层,使得复杂的商业逻辑和数据能够以简单,类型安全和可移植的语言来表达.


开发者 Elara AI Pty有限公司。 。 。 .


开发者 Elara AI Pty有限公司

版本与发布记录

@elaraai/e3-api-client 共发布 165 个版本,首次发布于 2025/12/13;过去 12 个月发布了 165 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.107latest2026/11/13今天
1.0.1062026/11/094 天前
1.0.1052026/11/085 天前
1.0.1042026/11/067 天前
1.0.1032026/11/049 天前
1.0.1022026/11/0310 天前

其他发布通道:alpha → 0.0.1-alpha.3,beta → 0.0.2-beta.54。

关于 @elaraai/e3-api-client 的常见问题

@elaraai/e3-api-client 是什么?

东执行引擎 API 客户端 - TypeScript 客户端库用于 e3 API 服务器

如何安装 @elaraai/e3-api-client?

在项目目录运行 npm install @elaraai/e3-api-client,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@elaraai/east(1.0.107)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@elaraai/e3-api-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@elaraai/e3-api-client 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@elaraai/e3-api-client 可以商用吗?

@elaraai/e3-api-client 使用 BUSL-1.1 许可。声明的许可为 BUSL-1.1,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@elaraai/e3-api-client 的下载量有多少?

根据 npm 官方下载统计,@elaraai/e3-api-client 在 2026/10/13 – 2026/11/11 这 30 天内被下载 5,446 次,日均约 182 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@elaraai/e3-api-client 还在维护吗?

最新版本 1.0.107 发布于 2026/11/13(今天);至今共发布 165 个版本,其中过去 12 个月发布了 165 个;首次发布于 2025/12/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。