@kodax-ai/kodax 0.7.97-alpha.7 → 0.7.97-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -1
- package/README.md +30 -9
- package/README_CN.md +20 -6
- package/dist/artifacts/LICENSE +158 -0
- package/dist/artifacts/dist/browser.d.ts +3 -0
- package/dist/artifacts/dist/browser.js +33 -0
- package/dist/artifacts/dist/browser.js.map +1 -0
- package/dist/artifacts/dist/client.d.ts +4 -0
- package/dist/artifacts/dist/client.js +87 -0
- package/dist/artifacts/dist/client.js.map +1 -0
- package/dist/artifacts/dist/contract.d.ts +14 -0
- package/dist/artifacts/dist/contract.js +289 -0
- package/dist/artifacts/dist/contract.js.map +1 -0
- package/dist/artifacts/dist/document-render.d.ts +12 -0
- package/dist/artifacts/dist/document-render.js +109 -0
- package/dist/artifacts/dist/document-render.js.map +1 -0
- package/dist/artifacts/dist/docx.browser.js +77 -0
- package/dist/artifacts/dist/evidence-files.d.ts +5 -0
- package/dist/artifacts/dist/evidence-files.js +54 -0
- package/dist/artifacts/dist/evidence-files.js.map +1 -0
- package/dist/artifacts/dist/evidence.d.ts +6 -0
- package/dist/artifacts/dist/evidence.js +84 -0
- package/dist/artifacts/dist/evidence.js.map +1 -0
- package/dist/artifacts/dist/files.d.ts +9 -0
- package/dist/artifacts/dist/files.js +115 -0
- package/dist/artifacts/dist/files.js.map +1 -0
- package/dist/artifacts/dist/formats.d.ts +2 -0
- package/dist/artifacts/dist/formats.js +29 -0
- package/dist/artifacts/dist/formats.js.map +1 -0
- package/dist/artifacts/dist/identity.d.ts +4 -0
- package/dist/artifacts/dist/identity.js +18 -0
- package/dist/artifacts/dist/identity.js.map +1 -0
- package/dist/artifacts/dist/image-data.d.ts +3 -0
- package/dist/artifacts/dist/image-data.js +18 -0
- package/dist/artifacts/dist/image-data.js.map +1 -0
- package/dist/artifacts/dist/index.d.ts +4 -0
- package/dist/artifacts/dist/index.js +4 -0
- package/dist/artifacts/dist/index.js.map +1 -0
- package/dist/artifacts/dist/kodax.d.ts +9 -0
- package/dist/artifacts/dist/kodax.js +88 -0
- package/dist/artifacts/dist/kodax.js.map +1 -0
- package/dist/artifacts/dist/libreoffice.d.ts +6 -0
- package/dist/artifacts/dist/libreoffice.js +25 -0
- package/dist/artifacts/dist/libreoffice.js.map +1 -0
- package/dist/artifacts/dist/pixels.d.ts +4 -0
- package/dist/artifacts/dist/pixels.js +13 -0
- package/dist/artifacts/dist/pixels.js.map +1 -0
- package/dist/artifacts/dist/prepare.d.ts +4 -0
- package/dist/artifacts/dist/prepare.js +30 -0
- package/dist/artifacts/dist/prepare.js.map +1 -0
- package/dist/artifacts/dist/presentation.d.ts +11 -0
- package/dist/artifacts/dist/presentation.js +222 -0
- package/dist/artifacts/dist/presentation.js.map +1 -0
- package/dist/artifacts/dist/render.d.ts +22 -0
- package/dist/artifacts/dist/render.js +186 -0
- package/dist/artifacts/dist/render.js.map +1 -0
- package/dist/artifacts/dist/runtime-entry.d.ts +1 -0
- package/dist/artifacts/dist/runtime-entry.js +37 -0
- package/dist/artifacts/dist/runtime-entry.js.map +1 -0
- package/dist/artifacts/dist/runtime.d.ts +11 -0
- package/dist/artifacts/dist/runtime.js +143 -0
- package/dist/artifacts/dist/runtime.js.map +1 -0
- package/dist/artifacts/dist/sdk.d.ts +114 -0
- package/dist/artifacts/dist/sdk.js +26 -0
- package/dist/artifacts/dist/sdk.js.map +1 -0
- package/dist/artifacts/dist/types.d.ts +285 -0
- package/dist/artifacts/dist/types.js +2 -0
- package/dist/artifacts/dist/types.js.map +1 -0
- package/dist/artifacts/dist/web-render.d.ts +3 -0
- package/dist/artifacts/dist/web-render.js +143 -0
- package/dist/artifacts/dist/web-render.js.map +1 -0
- package/dist/artifacts/skills/artifact-review/SKILL.md +16 -0
- package/dist/chunks/{agent-EIT4WRTJ.js → agent-C7MMIRIH.js} +1 -1
- package/dist/chunks/argument-completer-WIQAV5GP.js +2 -0
- package/dist/chunks/{chunk-BYRPTXH4.js → chunk-2TBKGO2Q.js} +4 -4
- package/dist/chunks/{chunk-J5XBQRJU.js → chunk-5DQTOU2E.js} +3 -3
- package/dist/chunks/{chunk-YHIHYPGQ.js → chunk-7NH5BGE4.js} +2 -2
- package/dist/chunks/{chunk-X6BSM54P.js → chunk-AWYO4MH3.js} +2 -2
- package/dist/chunks/{chunk-5DF2ZZDA.js → chunk-CIPS75XZ.js} +2 -2
- package/dist/chunks/{chunk-5HEBQ4ZF.js → chunk-CRQWSDHV.js} +1 -1
- package/dist/chunks/{chunk-AJ3VSHGK.js → chunk-HXCY52Z2.js} +1 -1
- package/dist/chunks/{chunk-VHUCG5YI.js → chunk-JXZMES45.js} +1 -1
- package/dist/chunks/{chunk-VSOFCKQV.js → chunk-KJSZTP5N.js} +1 -1
- package/dist/chunks/{chunk-TXCU25XM.js → chunk-KYHMB6XR.js} +2 -2
- package/dist/chunks/{chunk-2EAGDPF4.js → chunk-L22BDZGE.js} +1 -1
- package/dist/chunks/{chunk-PRMGOFYX.js → chunk-P42PHZWC.js} +5 -5
- package/dist/chunks/{chunk-2IRDPHVI.js → chunk-SHG3EIH5.js} +1 -1
- package/dist/chunks/{chunk-PGT2VSOD.js → chunk-UH6VOCVP.js} +1 -1
- package/dist/chunks/{chunk-LEON6EFI.js → chunk-WOHHMGEF.js} +1 -1
- package/dist/chunks/{chunk-L4HSHRFD.js → chunk-WONYJBAA.js} +1 -1
- package/dist/chunks/{chunk-PV6DILEK.js → chunk-XJWNIFC2.js} +1 -1
- package/dist/chunks/{chunk-DTJNXVL6.js → chunk-YJTIPSNW.js} +2 -2
- package/dist/chunks/{construction-bootstrap-AWOLGJJV.js → construction-bootstrap-XBHM6NON.js} +1 -1
- package/dist/chunks/{dist-UG67JCUH.js → dist-M4HLQAX7.js} +1 -1
- package/dist/chunks/{host-76O7ZRNA.js → host-EHVJWNGS.js} +1 -1
- package/dist/chunks/readline-helpers-KIDMSK76.js +2 -0
- package/dist/chunks/{run-manager-MPQPULSV.js → run-manager-HNGIYMG7.js} +1 -1
- package/dist/chunks/{tool-dispatch-K2FJZ5WP.js → tool-dispatch-ON33NJR5.js} +1 -1
- package/dist/chunks/{utils-KLOVODMA.js → utils-RHR6YHB2.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/kodax_bootstrap.js +1 -1
- package/dist/kodax_cli.js +467 -467
- package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
- package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
- package/dist/native/win32-x64/manifest.json +2 -2
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-client.js +1 -1
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.js +1 -1
- package/docs/ARTIFACT_SDK.md +253 -0
- package/docs/SDK_MIGRATION.md +4 -4
- package/docs/SPACE_SDK_SEAMS.md +75 -5
- package/package.json +28 -2
- package/public_docs/README.md +7 -3
- package/public_docs/sdk/embedder-guide.md +13 -10
- package/dist/chunks/argument-completer-N54LWSHY.js +0 -2
- package/dist/chunks/readline-helpers-LPPOL5FD.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,42 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## [0.7.97-alpha.9] - 2026-10-19
|
|
12
|
+
|
|
13
|
+
Ninth alpha of the v0.7.97 line: shared Host Run inspection checks Session
|
|
14
|
+
admission through canonical identity metadata instead of loading complete
|
|
15
|
+
historical transcripts, so a readable metadata header with an unreadable
|
|
16
|
+
body (for example a Windows ERROR_CRC surfacing as EIO) no longer blocks
|
|
17
|
+
unrelated Run listing, daemon inspection, or idle-exit inspection; admission
|
|
18
|
+
reuse is fenced to initialized Actor controllers so live persistence,
|
|
19
|
+
trailing saves, and `protected` exit receipts for other clients' work are
|
|
20
|
+
preserved. Every
|
|
21
|
+
v0.7.96 stable and v0.7.97-alpha.1 through alpha.8 contract is retained.
|
|
22
|
+
npm publication remains a manual maintainer action.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Shared Host Run inspection now checks Session admission through canonical identity metadata instead of loading complete historical transcripts. A readable metadata header with an unreadable body no longer blocks unrelated Run listing, daemon inspection, or idle-exit inspection. Unreadable metadata still fails closed, active/unknown Runs and Actor turns still block exit, and explicitly opening the affected Session still reports its read error.
|
|
27
|
+
- Shared Host Run listing and inspection reuse Session admission only for initialized Actor controllers that still hold their owner fence, matching Actor preflight. This avoids racing live persistence, including trailing saves after Run completion, preserves `protected` exit receipts for other clients' work, and retains strict canonical metadata checks for unclaimed Sessions and after controller ownership is released.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## [0.7.97-alpha.8] - 2026-10-18
|
|
32
|
+
|
|
33
|
+
Eighth alpha of the v0.7.97 line: the Artifact SDK ships inside the single
|
|
34
|
+
main package — `@kodax-ai/kodax` gains `/artifacts`, `/artifacts/client`,
|
|
35
|
+
`/artifacts/runtime` and `/artifacts/kodax` subpath exports while the
|
|
36
|
+
workspace module turns private, its pinned dependencies declare in the root
|
|
37
|
+
package, and the declared Node floor advances to 20.16. Every v0.7.96
|
|
38
|
+
stable and v0.7.97-alpha.1 through alpha.7 contract is retained. npm
|
|
39
|
+
publication remains a manual maintainer action.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- Single-package Artifact distribution: the main tarball stages the existing module/worker/resource layout under `dist/artifacts/`, the tarball audit validates every export/entry/dependency, the Release workflow runs an installed-package Artifact gate, and `release.mjs` rejects a separate `--artifacts` publication. There is no separate `@kodax-ai/artifacts` npm package. Core startup stays free of renderer loading and probes.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
11
47
|
## [0.7.97-alpha.7] - 2026-10-16
|
|
12
48
|
|
|
13
49
|
Seventh alpha of the v0.7.97 line: shared-Session Host ownership resolves
|
|
@@ -103,7 +139,7 @@ Validation: 16,589 tests passed, with package/bundle/native/type checks recorded
|
|
|
103
139
|
in the [regression guide](docs/test-guides/FEATURE_301_v0.7.97_TEST_GUIDE.md).
|
|
104
140
|
Natural-task GLM/DeepSeek smoke observed automatic image review, but full
|
|
105
141
|
repair/re-review/delivery has not passed all checks. Native DOCX fidelity and
|
|
106
|
-
model-facing schema gaps remain open; see [E2E evidence](docs/
|
|
142
|
+
model-facing schema gaps remain open; see [E2E evidence](docs/test-guides/FEATURE_301_v0.7.97_TEST_GUIDE.md#natural-task-observations-2026-10-13).
|
|
107
143
|
|
|
108
144
|
---
|
|
109
145
|
|
package/README.md
CHANGED
|
@@ -778,8 +778,8 @@ provider's model, REPL `/compact` clears the UI only after a durable save, and
|
|
|
778
778
|
successful reports carry bounded `summaryRequests` plus `commitMs` per
|
|
779
779
|
physical summary call.
|
|
780
780
|
|
|
781
|
-
**v0.7.97-alpha.4 release:** Adds the
|
|
782
|
-
|
|
781
|
+
**v0.7.97-alpha.4 source release:** Adds the optional Artifact SDK workspace
|
|
782
|
+
— PPTX authoring, bounded editing, and current-file visual
|
|
783
783
|
evidence through lightweight rendering (optional LibreOffice/PDF conversion) — with an optional managed
|
|
784
784
|
KodaX adapter (FEATURE_301), and retires the out-of-band Sidecar
|
|
785
785
|
Verifier: the main agent now verifies requested requirements with actual
|
|
@@ -794,6 +794,27 @@ starts, upgrades, or waits. See
|
|
|
794
794
|
Every v0.7.96 stable and v0.7.97-alpha.1/alpha.2/alpha.3 contract is
|
|
795
795
|
retained.
|
|
796
796
|
|
|
797
|
+
**v0.7.97-alpha.9 release:** Checks Session admission through canonical
|
|
798
|
+
identity metadata instead of loading complete historical transcripts, so a
|
|
799
|
+
readable metadata header with an unreadable body (for example a Windows
|
|
800
|
+
ERROR_CRC surfacing as EIO) no longer blocks unrelated Run listing, daemon
|
|
801
|
+
inspection, or idle-exit inspection, with admission reuse fenced to initialized Actor controllers so
|
|
802
|
+
`protected` exit receipts for other clients' work are preserved. See the
|
|
803
|
+
[v0.7.97-alpha.9 release notes](docs/release.md#v0797-alpha9-release-preparation).
|
|
804
|
+
Every v0.7.96 stable and v0.7.97-alpha.1 through alpha.8 contract is
|
|
805
|
+
retained.
|
|
806
|
+
|
|
807
|
+
**v0.7.97-alpha.8 release:** Ships the Artifact SDK inside the single main
|
|
808
|
+
package — `@kodax-ai/kodax` gains `/artifacts`, `/artifacts/client`,
|
|
809
|
+
`/artifacts/runtime` and `/artifacts/kodax` subpath exports; the workspace
|
|
810
|
+
module turns private (no separate artifacts npm package), its pinned
|
|
811
|
+
dependencies declare in the root package, and the declared Node floor
|
|
812
|
+
advances to 20.16, with tarball-audit and installed-package Release gates.
|
|
813
|
+
See the
|
|
814
|
+
[v0.7.97-alpha.8 release notes](docs/release.md#v0797-alpha8-release-preparation).
|
|
815
|
+
Every v0.7.96 stable and v0.7.97-alpha.1 through alpha.7 contract is
|
|
816
|
+
retained.
|
|
817
|
+
|
|
797
818
|
**v0.7.97-alpha.7 release:** Resolves shared-Session Host ownership across
|
|
798
819
|
daemon profiles (Space #222) — launchers wait for a starting owner's verified
|
|
799
820
|
descriptor within the original startup deadline, reuse compatible Hosts
|
|
@@ -1405,12 +1426,12 @@ kodax --repo-intelligence full --repo-intelligence-trace
|
|
|
1405
1426
|
|
|
1406
1427
|
## Architecture
|
|
1407
1428
|
|
|
1408
|
-
KodaX uses a **monorepo architecture** with npm workspaces. Four core packages ship in `@kodax-ai/kodax` with
|
|
1429
|
+
KodaX uses a **monorepo architecture** with npm workspaces. Four core packages ship in `@kodax-ai/kodax` with 17 SDK subpath exports (`/agent`, `/llm`, `/coding`, `/media`, `/repl`, `/skills`, `/mcp`, `/session`, `/client`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`, `/artifacts`, `/artifacts/client`, `/artifacts/runtime`, `/artifacts/kodax`; ADR-024 + ADR-032 + ADR-038, with ADR-036 consolidation). The private `artifacts` source workspace adds optional APIs through the same main npm package: PPTX authoring/limited edits, PDF/image/SVG evidence, candidate DOCX preview, local HTML/SMIL capture, preparation and binary evidence reading. Core startup does not load renderers; the KodaX bridge uses managed permissions, sandbox and cancellation. [SDK support and limits](docs/ARTIFACT_SDK.md).
|
|
1409
1430
|
|
|
1410
1431
|
```
|
|
1411
1432
|
KodaX/
|
|
1412
1433
|
├── packages/ # 4 core packages + optional artifacts
|
|
1413
|
-
│ ├── artifacts/ #
|
|
1434
|
+
│ ├── artifacts/ # Private Artifact SDK workspace; main-package subpaths
|
|
1414
1435
|
│ ├── llm/ # @kodax-ai/llm - LLM abstraction (16 built-in provider aliases)
|
|
1415
1436
|
│ │ └── providers/ # Anthropic, OpenAI, DeepSeek, Kimi, MiMo, MiniMax, Zhipu, Ark, …
|
|
1416
1437
|
│ │
|
|
@@ -1480,10 +1501,10 @@ Source-side workspace package names (`@kodax-ai/*`). npm consumers install the s
|
|
|
1480
1501
|
|
|
1481
1502
|
KodaX has two layers that consumers should understand separately:
|
|
1482
1503
|
|
|
1483
|
-
- **Source-side**: 4 workspace packages
|
|
1484
|
-
- **Current packaged exports** (not a claim of npm availability): a single bundled package `@kodax-ai/kodax` with
|
|
1504
|
+
- **Source-side**: 4 core workspace packages plus the private Artifact workspace (what developers see when reading the repo).
|
|
1505
|
+
- **Current packaged exports** (not a claim of npm availability): a single bundled package `@kodax-ai/kodax` with 17 SDK subpaths (what SDK consumers `import` from). The subpaths are split into two roles:
|
|
1485
1506
|
- **Full-package subpaths** (`/agent`, `/llm`, `/coding`, `/repl`) — each one maps 1:1 to a source workspace and exposes its complete public API.
|
|
1486
|
-
- **Integration and narrow subpaths** (`/media`, `/skills`, `/mcp`, `/session`, `/client`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`) — focused host surfaces. `/a2a` composes the neutral F258 plane with the Runtime facade; it does not add A2A wire types to `/agent`.
|
|
1507
|
+
- **Integration and narrow subpaths** (`/media`, `/skills`, `/mcp`, `/session`, `/client`, `/runtime`, `/sandbox`, `/a2a`, `/experimental-memory`, `/artifacts`, `/artifacts/client`, `/artifacts/runtime`, `/artifacts/kodax`) — focused host surfaces. `/a2a` composes the neutral F258 plane with the Runtime facade; it does not add A2A wire types to `/agent`.
|
|
1487
1508
|
|
|
1488
1509
|
| Source package | npm subpath | Type | What you get | Example consumer |
|
|
1489
1510
|
|---|---|---|---|---|
|
|
@@ -2090,11 +2111,11 @@ await runKodaX({
|
|
|
2090
2111
|
|
|
2091
2112
|
## SDK Usage
|
|
2092
2113
|
|
|
2093
|
-
This development tree exposes
|
|
2114
|
+
This development tree exposes 17 SDK subpaths plus the root. Shared product
|
|
2094
2115
|
applications use `@kodax-ai/kodax/client`; independent libraries and trusted Host
|
|
2095
2116
|
APIs remain available through the other subpaths. See the [Client contract](docs/CLIENT_CONTRACT.md)
|
|
2096
2117
|
and [SDK migration guide](docs/SDK_MIGRATION.md). This documentation was checked
|
|
2097
|
-
against package version `0.7.97-alpha.
|
|
2118
|
+
against package version `0.7.97-alpha.9`; npm publication is separate from
|
|
2098
2119
|
the current development-tree contract.
|
|
2099
2120
|
|
|
2100
2121
|
```bash
|
package/README_CN.md
CHANGED
|
@@ -303,7 +303,7 @@ SDK 系统代码契约更新,但没有放宽 shell/sandbox 的 fail-closed 边
|
|
|
303
303
|
`handleRuntimePermissionRequest()` 管理 SDK 权限 UI,并在 prepared Session 尾部遇到
|
|
304
304
|
`data_changed` 时通过权威 delta 合并恢复;后台持久化失败会显示为诊断,不再静默丢失。
|
|
305
305
|
|
|
306
|
-
**v0.7.97-alpha.4
|
|
306
|
+
**v0.7.97-alpha.4 发布**:新增可独立使用的 Artifact SDK 源码模块——PPTX 创作、
|
|
307
307
|
有界编辑与当前文件视觉证据(轻量渲染,可选 LibreOffice/PDF 转换),并带可选的受管 KodaX
|
|
308
308
|
适配器(FEATURE_301);同时退役旁路 Sidecar Verifier:主 Agent 在交付前用
|
|
309
309
|
真实工具与渲染证据核验每条需求,由内置 `visual-review` 技能覆盖静态、分页、
|
|
@@ -314,6 +314,20 @@ SDK 系统代码契约更新,但没有放宽 shell/sandbox 的 fail-closed 边
|
|
|
314
314
|
[v0.7.97-alpha.4 发布清单](docs/release.md#v0797-alpha4-release-preparation)。
|
|
315
315
|
所有 v0.7.96 稳定与 v0.7.97-alpha.1/alpha.2/alpha.3 契约全部保留。
|
|
316
316
|
|
|
317
|
+
**v0.7.97-alpha.9 发布**:Session 准入检查改用规范身份元数据而非加载完整
|
|
318
|
+
历史 transcript——元数据头可读而正文不可读(例如损坏存储上的 Windows
|
|
319
|
+
ERROR_CRC 以 EIO 呈现)不再阻塞无关的 Run 列表、daemon 检查或空闲退出检查。
|
|
320
|
+
准入复用围栏到仍持有 owner fence 的已初始化 Actor 控制器,其他客户端工作的
|
|
321
|
+
`protected` 退出回执保持不变。详见 [v0.7.97-alpha.9 发布清单](docs/release.md#v0797-alpha9-release-preparation)。
|
|
322
|
+
所有 v0.7.96 稳定与 v0.7.97-alpha.1 至 alpha.8 契约全部保留。
|
|
323
|
+
|
|
324
|
+
**v0.7.97-alpha.8 发布**:Artifact SDK 并入单一主包发布——`@kodax-ai/kodax` 新增
|
|
325
|
+
`/artifacts`、`/artifacts/client`、`/artifacts/runtime`、`/artifacts/kodax` 四个
|
|
326
|
+
子路径导出;工作区模块转为私有(不再独立发布 npm),固定依赖上移到根包声明,
|
|
327
|
+
Node 最低版本提升到 20.16,tarball 审计与已安装包 Release 门同步就位。
|
|
328
|
+
详见 [v0.7.97-alpha.8 发布清单](docs/release.md#v0797-alpha8-release-preparation)。
|
|
329
|
+
所有 v0.7.96 稳定与 v0.7.97-alpha.1 至 alpha.7 契约全部保留。
|
|
330
|
+
|
|
317
331
|
**v0.7.97-alpha.7 发布**:跨 daemon profile 解析共享 Session 存储的 Host
|
|
318
332
|
归属(Space #222)——启动器在原启动期限内等待启动中 owner 的已验证描述符,
|
|
319
333
|
兼容 Host 直接复用而不重启工作,仅允许受控的同构建 orphan-exit 策略刷新。
|
|
@@ -1272,7 +1286,7 @@ kodax --repo-intelligence full --repo-intelligence-trace
|
|
|
1272
1286
|
|
|
1273
1287
|
## 仓库结构
|
|
1274
1288
|
|
|
1275
|
-
KodaX 是基于 npm workspaces 的 TypeScript monorepo,**4 个核心 workspace
|
|
1289
|
+
KodaX 是基于 npm workspaces 的 TypeScript monorepo,**4 个核心 workspace 包与私有 Artifact 源码模块**(FEATURE_194 v0.7.43 包合并 — 9 → 4,ADR-036),npm 上以单 bundle 包 `@kodax-ai/kodax` 发布 + 17 个 SDK subpath exports(`/agent`、`/llm`、`/coding`、`/media`、`/repl`、`/skills`、`/mcp`、`/session`、`/client`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`、`/artifacts`、`/artifacts/client`、`/artifacts/runtime`、`/artifacts/kodax`;ADR-024 + ADR-032 + ADR-038)。核心包:
|
|
1276
1290
|
|
|
1277
1291
|
| Workspace 包 | 作用 | 主要依赖 |
|
|
1278
1292
|
|----|------|---------|
|
|
@@ -1287,10 +1301,10 @@ KodaX 是基于 npm workspaces 的 TypeScript monorepo,**4 个核心 workspace
|
|
|
1287
1301
|
|
|
1288
1302
|
KodaX 有两层结构,SDK 用户需要分开理解:
|
|
1289
1303
|
|
|
1290
|
-
- **源码层**:4 个核心 workspace
|
|
1291
|
-
- **当前源码打包导出**(不表示已发布到 npm):单个 bundled 包 `@kodax-ai/kodax`,对外暴露
|
|
1304
|
+
- **源码层**:4 个核心 workspace 包,另有私有可选 Artifact 源码 workspace,经同一主包 `/artifacts` 子路径交付:PPTX 创作/限定编辑,PDF/图片/SVG 取证、DOCX 轻量预览、本地网页与 SMIL 捕获,公共准备和真实图片读取。核心启动不加载渲染依赖;桥接沿用受管权限、沙箱和取消。[SDK 支持与限制](docs/ARTIFACT_SDK.md)。
|
|
1305
|
+
- **当前源码打包导出**(不表示已发布到 npm):单个 bundled 包 `@kodax-ai/kodax`,对外暴露 17 个 SDK subpath(SDK 消费者 `import` 时看到的接口)。subpath 分两种角色:
|
|
1292
1306
|
- **完整包 subpath**(`/agent`、`/llm`、`/coding`、`/repl`)—— 每个 1:1 对应一个源码包,暴露完整公开 API。
|
|
1293
|
-
- **集成与窄子集 subpath**(`/media`、`/skills`、`/mcp`、`/session`、`/client`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`)—— 聚焦能力或宿主集成边界;`/experimental-memory` 明确为 opt-in 不稳定接口。
|
|
1307
|
+
- **集成与窄子集 subpath**(`/media`、`/skills`、`/mcp`、`/session`、`/client`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`、`/artifacts`、`/artifacts/client`、`/artifacts/runtime`、`/artifacts/kodax`)—— 聚焦能力或宿主集成边界;`/experimental-memory` 明确为 opt-in 不稳定接口。
|
|
1294
1308
|
|
|
1295
1309
|
| 源码包 | npm subpath | 类型 | 内容 | 典型消费者 |
|
|
1296
1310
|
|---|---|---|---|---|
|
|
@@ -1462,7 +1476,7 @@ KodaX/ # 4 workspace packages(FEATURE_194 v0.7.43)
|
|
|
1462
1476
|
│ ├── kodax_cli.ts # CLI 主入口(bin: `kodax`)
|
|
1463
1477
|
│ └── sdk-*.ts # SDK subpath 入口 → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime,sandbox,a2a,experimental-memory}
|
|
1464
1478
|
├── scripts/
|
|
1465
|
-
│ ├── build-bundle.mjs # esbuild 单 bundle 多 entry 打包(CLI + root + 13 SDK subpath + chunks)
|
|
1479
|
+
│ ├── build-bundle.mjs # esbuild 单 bundle 多 entry 打包(CLI + root + 13 核心 SDK subpath + Artifact 资源 + chunks)
|
|
1466
1480
|
│ ├── build-binary.mjs # Bun --compile 单文件二进制打包
|
|
1467
1481
|
│ └── release.mjs # 发布 CI 构建的通用 tarball;本地 --pack-only 保持 private:true
|
|
1468
1482
|
└── .github/workflows/
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
KodaX-AI Fair Core License (KAI-FCL) 1.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 icetomoyo <icetomoyo@gmail.com> <icetomoyo@163.com>
|
|
4
|
+
|
|
5
|
+
All rights reserved except as expressly granted in this License.
|
|
6
|
+
|
|
7
|
+
This License applies to KodaX releases and files that include this LICENSE file
|
|
8
|
+
or otherwise identify KAI-FCL as their governing license. Earlier KodaX
|
|
9
|
+
releases or files that were distributed under the Apache License, Version 2.0
|
|
10
|
+
remain licensed under Apache-2.0 for those released copies. Third-party
|
|
11
|
+
components remain governed by their own license terms.
|
|
12
|
+
|
|
13
|
+
Effective Version Notice
|
|
14
|
+
|
|
15
|
+
KodaX-AI intends KAI-FCL to govern official KodaX distributions for version
|
|
16
|
+
0.7.70 and later when those distributions are provided by KodaX-AI with this
|
|
17
|
+
LICENSE file, a KAI-FCL notice, or accompanying customer terms.
|
|
18
|
+
|
|
19
|
+
Historical Git tags, source archives, binaries, npm packages, or other copies
|
|
20
|
+
of KodaX that were already distributed with Apache-2.0 license text remain
|
|
21
|
+
licensed under Apache-2.0 for those specific copies. This notice does not
|
|
22
|
+
retroactively revoke rights that were already granted under Apache-2.0.
|
|
23
|
+
|
|
24
|
+
For avoidance of doubt, current and future official enterprise/customer
|
|
25
|
+
packages for KodaX 0.7.70 and later should be delivered with KAI-FCL or
|
|
26
|
+
separate KodaX-AI customer terms.
|
|
27
|
+
|
|
28
|
+
1. Definitions
|
|
29
|
+
|
|
30
|
+
"Software" means KodaX, including its source code, object code, documentation,
|
|
31
|
+
configuration, examples, official npm packages, binaries, and other materials
|
|
32
|
+
distributed by KodaX-AI under this License.
|
|
33
|
+
|
|
34
|
+
"KodaX-AI" means the copyright owner, licensor, or license steward for the
|
|
35
|
+
Software.
|
|
36
|
+
|
|
37
|
+
"You" means the individual or legal entity exercising permissions under this
|
|
38
|
+
License.
|
|
39
|
+
|
|
40
|
+
"Community Use" means use by an individual for personal learning, individual
|
|
41
|
+
non-commercial work, classroom instruction, non-production research, or
|
|
42
|
+
developing and testing changes for contribution to public open-source
|
|
43
|
+
projects.
|
|
44
|
+
|
|
45
|
+
"Commercial or Managed Use" means any use by or for a company, school, lab,
|
|
46
|
+
institution, government agency, or other organization for administration, IT
|
|
47
|
+
operations, team research and development, production work, intranet hosting,
|
|
48
|
+
managed-device deployment, paid service delivery, customer redistribution,
|
|
49
|
+
hosted or managed services, or other business purposes.
|
|
50
|
+
|
|
51
|
+
"Customer Agreement" means a written agreement with KodaX-AI, including
|
|
52
|
+
evaluation terms, an order form, an enterprise agreement, partner terms, or
|
|
53
|
+
another commercial authorization document.
|
|
54
|
+
|
|
55
|
+
"License Entitlement" means a signed offline entitlement file, commonly using
|
|
56
|
+
the `.kodax-license` extension, that identifies product, edition, license
|
|
57
|
+
kind, customer, expiry, enabled features, binding claims, and signature. A
|
|
58
|
+
License Entitlement proves technical authorization; it is not by itself the
|
|
59
|
+
complete legal contract.
|
|
60
|
+
|
|
61
|
+
2. Community Grant
|
|
62
|
+
|
|
63
|
+
Subject to this License, KodaX-AI grants You a limited, non-exclusive,
|
|
64
|
+
non-transferable, no-charge license to download, install, run, inspect, and
|
|
65
|
+
modify the Software solely for Community Use.
|
|
66
|
+
|
|
67
|
+
You may make copies of the Software as reasonably necessary for Your own
|
|
68
|
+
Community Use, backup, testing, and contribution preparation. You may submit
|
|
69
|
+
changes, patches, issues, and documentation improvements to KodaX-AI. Unless a
|
|
70
|
+
separate written contribution agreement says otherwise, You grant KodaX-AI a
|
|
71
|
+
perpetual, worldwide, irrevocable, royalty-free license to use, reproduce,
|
|
72
|
+
modify, distribute, sublicense, and otherwise exploit contributions You submit
|
|
73
|
+
for inclusion in the Software.
|
|
74
|
+
|
|
75
|
+
3. Commercial and Managed Use
|
|
76
|
+
|
|
77
|
+
Commercial or Managed Use is not permitted under the Community Grant.
|
|
78
|
+
|
|
79
|
+
Enterprise evaluation, enterprise production, intranet deployment,
|
|
80
|
+
managed-device deployment, commercial redistribution, partner distribution,
|
|
81
|
+
paid service delivery, or any other Commercial or Managed Use requires a
|
|
82
|
+
Customer Agreement with KodaX-AI and, where the Software requires it, a valid
|
|
83
|
+
License Entitlement.
|
|
84
|
+
|
|
85
|
+
All production customer License Entitlements must include an expiry date unless
|
|
86
|
+
a Customer Agreement expressly says otherwise. Longer commercial terms are
|
|
87
|
+
renewals or replacements, not perpetual local secrets.
|
|
88
|
+
|
|
89
|
+
4. Restrictions
|
|
90
|
+
|
|
91
|
+
Except as expressly allowed by this License or a Customer Agreement, You must
|
|
92
|
+
not:
|
|
93
|
+
|
|
94
|
+
- use the Software for Commercial or Managed Use;
|
|
95
|
+
- sell, rent, lease, sublicense, host, provide, or redistribute the Software to
|
|
96
|
+
third parties;
|
|
97
|
+
- remove, disable, bypass, tamper with, or misrepresent license enforcement,
|
|
98
|
+
entitlement checks, signatures, expiry checks, binding checks, or related
|
|
99
|
+
technical controls;
|
|
100
|
+
- remove or alter copyright, license, attribution, trademark, or third-party
|
|
101
|
+
notices;
|
|
102
|
+
- use KodaX-AI names, logos, product names, or trademarks except to describe
|
|
103
|
+
the origin of the Software accurately;
|
|
104
|
+
- violate applicable law or use the Software to infringe third-party rights.
|
|
105
|
+
|
|
106
|
+
5. Separate Agreements
|
|
107
|
+
|
|
108
|
+
If You have a Customer Agreement with KodaX-AI, that Customer Agreement
|
|
109
|
+
controls for the Software, edition, term, users, sites, features, and use cases
|
|
110
|
+
it covers. This License controls only where the Customer Agreement does not
|
|
111
|
+
grant additional rights or impose different obligations.
|
|
112
|
+
|
|
113
|
+
6. Ownership
|
|
114
|
+
|
|
115
|
+
KodaX-AI and its licensors retain all right, title, and interest in and to the
|
|
116
|
+
Software. No rights are granted except those expressly stated in this License
|
|
117
|
+
or a Customer Agreement.
|
|
118
|
+
|
|
119
|
+
7. Third-Party Software
|
|
120
|
+
|
|
121
|
+
The Software may include or depend on third-party software, packages, models,
|
|
122
|
+
fonts, assets, or tools. Those materials are licensed by their respective
|
|
123
|
+
owners under their own terms. This License does not change third-party license
|
|
124
|
+
obligations.
|
|
125
|
+
|
|
126
|
+
8. Termination
|
|
127
|
+
|
|
128
|
+
Your rights under this License terminate automatically if You violate this
|
|
129
|
+
License and do not cure the violation within 30 days after receiving notice
|
|
130
|
+
from KodaX-AI. Rights also terminate immediately for intentional license
|
|
131
|
+
enforcement bypass, unauthorized Commercial or Managed Use, or unauthorized
|
|
132
|
+
redistribution. After termination, You must stop using and distributing the
|
|
133
|
+
Software, and You must delete copies not otherwise authorized by a Customer
|
|
134
|
+
Agreement or by another license that independently applies to a specific
|
|
135
|
+
released copy.
|
|
136
|
+
|
|
137
|
+
9. Disclaimer of Warranty
|
|
138
|
+
|
|
139
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTIES OR
|
|
140
|
+
CONDITIONS OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF
|
|
141
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT,
|
|
142
|
+
SECURITY, ACCURACY, OR AVAILABILITY.
|
|
143
|
+
|
|
144
|
+
10. Limitation of Liability
|
|
145
|
+
|
|
146
|
+
TO THE MAXIMUM EXTENT PERMITTED BY LAW, KODAX-AI AND ITS CONTRIBUTORS WILL NOT
|
|
147
|
+
BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR
|
|
148
|
+
PUNITIVE DAMAGES, OR FOR LOST PROFITS, LOST REVENUE, LOST DATA, BUSINESS
|
|
149
|
+
INTERRUPTION, GOODWILL LOSS, OR PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
|
150
|
+
ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS LICENSE, EVEN IF ADVISED OF
|
|
151
|
+
THE POSSIBILITY OF SUCH DAMAGES.
|
|
152
|
+
|
|
153
|
+
11. Contact
|
|
154
|
+
|
|
155
|
+
For enterprise evaluation, production licensing, redistribution permission, or
|
|
156
|
+
questions about this License, contact:
|
|
157
|
+
|
|
158
|
+
icetomoyo <icetomoyo@gmail.com> <icetomoyo@163.com>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { chromium } from 'playwright-core';
|
|
2
|
+
import { defaultBrowserExecutable } from './render.js';
|
|
3
|
+
export async function withArtifactPage(options, use) {
|
|
4
|
+
options.signal?.throwIfAborted();
|
|
5
|
+
const browser = await chromium.launch({ executablePath: options.browserExecutable ?? defaultBrowserExecutable(), headless: true });
|
|
6
|
+
let closing, closeError, timedOut = false;
|
|
7
|
+
const close = () => { closing ??= browser.close(); void closing.catch(error => { closeError = error; }); };
|
|
8
|
+
const timeout = setTimeout(() => { timedOut = true; close(); }, 90_000);
|
|
9
|
+
options.signal?.addEventListener('abort', close, { once: true });
|
|
10
|
+
try {
|
|
11
|
+
options.signal?.throwIfAborted();
|
|
12
|
+
const context = await browser.newContext({ deviceScaleFactor: 1, serviceWorkers: 'block', acceptDownloads: false });
|
|
13
|
+
await context.routeWebSocket('**/*', socket => socket.close());
|
|
14
|
+
const page = await context.newPage();
|
|
15
|
+
page.setDefaultTimeout(20_000);
|
|
16
|
+
page.setDefaultNavigationTimeout(20_000);
|
|
17
|
+
return await use(page);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
options.signal?.throwIfAborted();
|
|
21
|
+
if (timedOut)
|
|
22
|
+
throw new Error('Artifact browser operation timed out.', { cause: error });
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
clearTimeout(timeout);
|
|
27
|
+
options.signal?.removeEventListener('abort', close);
|
|
28
|
+
await (closing ?? browser.close());
|
|
29
|
+
if (closeError)
|
|
30
|
+
throw closeError;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EA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AC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC;QAC/G,OAAO,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAAC,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;QAAC,IAAI,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAAC,MAAM,KAAK,CAAC;IAAC,CAAC;YACpJ,CAAC;QAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAAC,OAAO,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAAC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAAC,IAAI,UAAU;YAAE,MAAM,UAAU,CAAC;IAAC,CAAC;AAC9J,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { KodaXProductClient } from '@kodax-ai/kodax/client';
|
|
2
|
+
import type { ArtifactExecutionPort } from './types.js';
|
|
3
|
+
/** Uses the connected Host's explicit tool Run. No local execution or automatic replay. */
|
|
4
|
+
export declare function createKodaXArtifactPort(client: Pick<KodaXProductClient, 'runs' | 'sessions'>, sessionId: string): ArtifactExecutionPort;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { artifactToolName, decodeArtifactRequest, decodeArtifactResult, decodeArtifactWireResult, record } from './contract.js';
|
|
2
|
+
import { encodeBase64, verifyImageData } from './image-data.js';
|
|
3
|
+
import { sameJson } from './identity.js';
|
|
4
|
+
/** Uses the connected Host's explicit tool Run. No local execution or automatic replay. */
|
|
5
|
+
export function createKodaXArtifactPort(client, sessionId) {
|
|
6
|
+
return { execute: async (raw, signal) => {
|
|
7
|
+
const request = decodeArtifactRequest(raw);
|
|
8
|
+
signal?.throwIfAborted();
|
|
9
|
+
const name = artifactToolName(request.operation);
|
|
10
|
+
const started = await client.runs.startTool({ sessionId, inputId: crypto.randomUUID(), name,
|
|
11
|
+
input: { ...request.input }, rawInput: JSON.stringify(request.input) });
|
|
12
|
+
let stop;
|
|
13
|
+
let operationError;
|
|
14
|
+
const cancel = () => { stop ??= client.runs.stop(started.runId).then(receipt => ({ receipt }), error => ({ error })); };
|
|
15
|
+
signal?.addEventListener('abort', cancel, { once: true });
|
|
16
|
+
if (signal?.aborted)
|
|
17
|
+
cancel();
|
|
18
|
+
try {
|
|
19
|
+
const terminal = await client.runs.await(started.runId);
|
|
20
|
+
if (terminal.runId !== started.runId || terminal.sessionId !== sessionId || terminal.phase !== 'completed' || !terminal.result?.success)
|
|
21
|
+
throw new Error('Artifact Host Run did not complete: ' + terminal.phase + ': ' + (terminal.error ?? terminal.result?.lastText ?? '').slice(0, 2000));
|
|
22
|
+
signal?.throwIfAborted();
|
|
23
|
+
const messages = terminal.result.messages, callMessage = messages.at(-2), resultMessage = messages.at(-1);
|
|
24
|
+
const call = Array.isArray(callMessage?.content) ? callMessage.content.find(block => block.type === 'tool_use' && block.name === name && sameJson(block.input, request.input)) : undefined;
|
|
25
|
+
if (call?.type !== 'tool_use' || !Array.isArray(resultMessage?.content))
|
|
26
|
+
throw new Error('Artifact Host invocation identity is missing.');
|
|
27
|
+
const block = resultMessage.content.find(block => block.type === 'tool_result' && block.tool_use_id === call.id);
|
|
28
|
+
if (block?.type !== 'tool_result' || block.is_error)
|
|
29
|
+
throw new Error('Artifact Host tool result is unavailable.');
|
|
30
|
+
const first = typeof block.content === 'string' ? block.content : block.content.find(item => item.type === 'text')?.text;
|
|
31
|
+
if (!first || first.length > 2 * 1024 * 1024)
|
|
32
|
+
throw new Error('Artifact metadata is missing or exceeds its bound.');
|
|
33
|
+
const payload = record(JSON.parse(first));
|
|
34
|
+
if (payload.protocol !== 'kodax-artifact/1' || payload.operation !== request.operation)
|
|
35
|
+
throw new Error('Artifact tool payload does not match the invocation.');
|
|
36
|
+
const result = decodeArtifactWireResult(request, payload);
|
|
37
|
+
if (!result.imageRef)
|
|
38
|
+
return decodeArtifactResult(raw.operation, result);
|
|
39
|
+
let items = [];
|
|
40
|
+
const observation = await client.sessions.observe(sessionId, view => { items = view.items; });
|
|
41
|
+
try {
|
|
42
|
+
const item = items.find(item => item.tool?.callId === call.id && item.tool.name === name && (!item.sourceRunId || item.sourceRunId === started.runId));
|
|
43
|
+
const attachmentIndex = item?.attachments?.findIndex(image => image.path === result.imageRef.path);
|
|
44
|
+
if (!item || attachmentIndex === undefined || attachmentIndex < 0)
|
|
45
|
+
throw new Error('Artifact PNG is not attached to its Host invocation.');
|
|
46
|
+
let offset = 0, bytes;
|
|
47
|
+
do {
|
|
48
|
+
signal?.throwIfAborted();
|
|
49
|
+
const chunk = (await client.sessions.readItem(sessionId, item.id, { part: 'attachment', attachmentIndex, attachmentOffset: offset, expectedImageSha256: result.imageRef.sha256 }))?.image;
|
|
50
|
+
if (!chunk || chunk.sha256 !== result.imageRef.sha256 || chunk.width !== result.imageRef.width || chunk.height !== result.imageRef.height || chunk.mediaType !== 'image/png' || chunk.offset !== offset || !Number.isSafeInteger(chunk.totalLength) || chunk.totalLength < 33 || chunk.totalLength > 10 * 1024 * 1024)
|
|
51
|
+
throw new Error('Artifact attachment metadata is missing or inconsistent.');
|
|
52
|
+
bytes ??= new Uint8Array(chunk.totalLength);
|
|
53
|
+
const data = Uint8Array.from(atob(chunk.dataBase64), c => c.charCodeAt(0));
|
|
54
|
+
if (!data.length || bytes.length !== chunk.totalLength || offset + data.length > bytes.length || (chunk.nextOffset !== undefined && chunk.nextOffset !== offset + data.length))
|
|
55
|
+
throw new Error('Artifact attachment chunk is inconsistent.');
|
|
56
|
+
bytes.set(data, offset);
|
|
57
|
+
offset += data.length;
|
|
58
|
+
if (chunk.nextOffset === undefined && offset !== bytes.length)
|
|
59
|
+
throw new Error('Artifact attachment ended early.');
|
|
60
|
+
} while (offset < bytes.length);
|
|
61
|
+
const image = { mediaType: 'image/png', sha256: result.imageRef.sha256, width: result.imageRef.width, height: result.imageRef.height, dataBase64: encodeBase64(bytes) };
|
|
62
|
+
await verifyImageData(image);
|
|
63
|
+
signal?.throwIfAborted();
|
|
64
|
+
return decodeArtifactResult(raw.operation, { status: result.status, diagnostics: result.diagnostics, image });
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
observation.close();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
operationError = error;
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
signal?.removeEventListener('abort', cancel);
|
|
76
|
+
if (stop) {
|
|
77
|
+
const outcome = await stop;
|
|
78
|
+
if ('error' in outcome) {
|
|
79
|
+
if (operationError !== undefined)
|
|
80
|
+
throw new AggregateError([operationError, outcome.error], 'Artifact operation and Stop settlement failed.');
|
|
81
|
+
throw outcome.error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChI,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,2FAA2F;AAC3F,MAAM,UAAU,uBAAuB,CAAC,MAAqD,EAAE,SAAiB;IAC/G,OAAO,EAAE,OAAO,EAAE,KAAK,EAA+B,GAAuB,EAAE,MAAoB,EAA+B,EAAE;YACnI,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;YAAC,MAAM,EA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E,CAAC;gBAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAAC,cAAc,GAAG,KAAK,CAAC;gBAAC,MAAM,KAAK,CAAC;YAAC,CAAC;oBAChD,CAAC;gBACR,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBAC7C,IAAI,IAAI,EAAE,CAAC;oBAAC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC;oBAAC,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;wBAChE,IAAI,cAAc,KAAK,SAAS;4BAAE,MAAM,IAAI,cAAc,CAAC,CAAC,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,gDAAgD,CAAC,CAAC;wBAC9I,MAAM,OAAO,CAAC,KAAK,CAAC;oBACrB,CAAC;gBAAC,CAAC;YACJ,CAAC;QACF,CAAC,EAAE,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ArtifactOperation, ArtifactRequest, ArtifactResults, ArtifactResult, EvidenceLocator, VisualSource, RasterEvidence } from './types.js';
|
|
2
|
+
export declare const artifactToolName: (operation: ArtifactOperation) => string;
|
|
3
|
+
export declare function record(value: unknown): Record<string, unknown>;
|
|
4
|
+
export declare function validateSource(value: unknown): asserts value is VisualSource;
|
|
5
|
+
export declare function validateLocator(value: unknown): asserts value is EvidenceLocator;
|
|
6
|
+
export declare function validateRaster(value: unknown): asserts value is RasterEvidence;
|
|
7
|
+
export declare function decodeArtifactRequest(value: unknown): ArtifactRequest;
|
|
8
|
+
export declare function decodeArtifactResult<O extends ArtifactOperation>(operation: O, value: unknown): ArtifactResults[O];
|
|
9
|
+
/** Managed worker metadata. PNG bytes travel through the existing attachment channel. */
|
|
10
|
+
type ArtifactWireResult = Pick<ArtifactResult, 'status' | 'diagnostics' | 'artifact' | 'evidence'> & {
|
|
11
|
+
readonly imageRef?: RasterEvidence;
|
|
12
|
+
};
|
|
13
|
+
export declare function decodeArtifactWireResult(request: ArtifactRequest, value: unknown): ArtifactWireResult;
|
|
14
|
+
export {};
|