@kodax-ai/kodax 0.7.97-alpha.6 → 0.7.97-alpha.8
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 +46 -1
- package/README.md +40 -9
- package/README_CN.md +25 -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-Z2YSHTJ5.js → agent-Q3KETYAO.js} +1 -1
- package/dist/chunks/argument-completer-YBLONGXK.js +2 -0
- package/dist/chunks/{chunk-PRQEFTX5.js → chunk-76OPYNVX.js} +1 -1
- package/dist/chunks/{chunk-R7YXI7AB.js → chunk-D73IHTHH.js} +3 -3
- package/dist/chunks/{chunk-DTG3ZF5R.js → chunk-EKMVGLHV.js} +2 -2
- package/dist/chunks/{chunk-A3YY6JUN.js → chunk-FK7AP3FS.js} +1 -1
- package/dist/chunks/{chunk-MRZ223W7.js → chunk-FL5KAFQZ.js} +1 -1
- package/dist/chunks/{chunk-UGNSAKIT.js → chunk-FX4R5PB3.js} +1 -1
- package/dist/chunks/{chunk-XPEKJKPG.js → chunk-HCLUUEDQ.js} +1 -1
- package/dist/chunks/{chunk-VT6MCIE5.js → chunk-HD5BDOPC.js} +1 -1
- package/dist/chunks/{chunk-RRCIJ234.js → chunk-HTLRQB72.js} +2 -2
- package/dist/chunks/{chunk-WJL25O6B.js → chunk-JNB2FL6P.js} +1 -1
- package/dist/chunks/{chunk-XEBZJLCW.js → chunk-JOPSY4GI.js} +1 -1
- package/dist/chunks/{chunk-XL2N3RDM.js → chunk-KH7BRH2Q.js} +1 -1
- package/dist/chunks/{chunk-QFIMF7II.js → chunk-MIS2WZPP.js} +2 -2
- package/dist/chunks/{chunk-WILX5FJH.js → chunk-NFGFHUO6.js} +4 -4
- package/dist/chunks/{chunk-WNSCGMP4.js → chunk-ORH7UGCN.js} +1 -1
- package/dist/chunks/{chunk-NOJ3W5PC.js → chunk-PRJR2WBC.js} +1 -1
- package/dist/chunks/{chunk-RLINWRJJ.js → chunk-RSUAZDLC.js} +196 -196
- package/dist/chunks/chunk-UE3J7V5F.js +497 -0
- package/dist/chunks/{chunk-MWIDZ2GQ.js → chunk-VNPYCHJA.js} +2 -2
- package/dist/chunks/{chunk-SR67IEBP.js → chunk-W7ZFQTOK.js} +1 -1
- package/dist/chunks/{chunk-UHC66D7T.js → chunk-XMWTEVFZ.js} +143 -140
- package/dist/chunks/{chunk-SQONUELA.js → chunk-XXU6HP6N.js} +1 -1
- package/dist/chunks/{client-76JHO3LB.js → client-XFASU74S.js} +1 -1
- package/dist/chunks/{compaction-config-HTYGVGD7.js → compaction-config-JZNGDKWW.js} +1 -1
- package/dist/chunks/{construction-bootstrap-SW7V7RX6.js → construction-bootstrap-P4QKIZV5.js} +1 -1
- package/dist/chunks/{dist-C627SSXJ.js → dist-2B3JWYFP.js} +1 -1
- package/dist/chunks/host-PMDL4OM2.js +2 -0
- package/dist/chunks/readline-helpers-5JGWEVMK.js +2 -0
- package/dist/chunks/{run-manager-5O53IGLW.js → run-manager-KW252NVZ.js} +1 -1
- package/dist/chunks/{tool-dispatch-FH6TSX64.js → tool-dispatch-G2E7DV5U.js} +1 -1
- package/dist/chunks/{utils-RNKK4N7M.js → utils-VHSKUOLF.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/kodax_bootstrap.js +1 -1
- package/dist/kodax_cli.js +1274 -1271
- 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/sandbox-network-broker.js +9 -9
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +6 -1
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-client.js +1 -1
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-runtime.d.ts +14 -3
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +2 -2
- 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 +29 -3
- package/public_docs/README.md +7 -3
- package/public_docs/sdk/embedder-guide.md +36 -12
- package/dist/chunks/argument-completer-MHCQY5C7.js +0 -2
- package/dist/chunks/chunk-YXRXHHFQ.js +0 -497
- package/dist/chunks/host-LIWMO7QQ.js +0 -2
- package/dist/chunks/readline-helpers-WQAT4CAF.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,51 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
+
## [0.7.97-alpha.8] - 2026-10-18
|
|
12
|
+
|
|
13
|
+
Eighth alpha of the v0.7.97 line: the Artifact SDK ships inside the single
|
|
14
|
+
main package — `@kodax-ai/kodax` gains `/artifacts`, `/artifacts/client`,
|
|
15
|
+
`/artifacts/runtime` and `/artifacts/kodax` subpath exports while the
|
|
16
|
+
workspace module turns private, its pinned dependencies declare in the root
|
|
17
|
+
package, and the declared Node floor advances to 20.16. Every v0.7.96
|
|
18
|
+
stable and v0.7.97-alpha.1 through alpha.7 contract is retained. npm
|
|
19
|
+
publication remains a manual maintainer action.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- 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.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## [0.7.97-alpha.7] - 2026-10-16
|
|
28
|
+
|
|
29
|
+
Seventh alpha of the v0.7.97 line: shared-Session Host ownership resolves
|
|
30
|
+
across daemon profiles — launchers wait for a starting owner's verified
|
|
31
|
+
descriptor within the original startup deadline, reuse compatible Hosts
|
|
32
|
+
without restarting work, and permit only a guarded same-build orphan-exit
|
|
33
|
+
policy refresh — daemon startup and connection timeouts surface as
|
|
34
|
+
structured, retryable failures, idle interactive Hosts retire after a
|
|
35
|
+
bounded 30-second lifetime while explicit daemon/A2A service owners are
|
|
36
|
+
retained, and Windows SDK attachment reads targeted exact identities within
|
|
37
|
+
the original startup controls (Space #222). Every v0.7.96 stable and
|
|
38
|
+
v0.7.97-alpha.1 through alpha.6 contract is retained. npm publication
|
|
39
|
+
remains a manual maintainer action.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- Space Issue 222 CI regression: use one conservative process-liveness check for shared storage discovery, daemon health and verified exit, recognizing unreaped Linux zombies while retaining PID generation checks. Release temporary attachments and rediscover current ownership on bounded startup-only retries within the original deadline and cancellation signal; never replay accepted input or tool work. Gate the original crash cases and deterministic zombie/owner-handoff regressions on Linux Node 20/22 before release.
|
|
44
|
+
- Bound Windows startup cleanup of unverifiable historical child records: the automatic historical sweep keeps incomplete Run trees `unknown` instead of launching a PowerShell termination helper per unverified record — a helper storm that invalidated the shared process snapshot and made startup cost grow with history (24-record fixture: 11,069ms and 48 helpers before, 10ms and none after). Exact-handle Run recovery and verified live-descendant cleanup are preserved.
|
|
45
|
+
- Bound Windows SDK attachment work: fresh PID identity checks read targeted exact FILETIME identities instead of repeatedly scanning the full process table, initial Job ownership evidence is collected together, and the original startup deadline passes through readiness and attachment — expired startup stays an expired failure instead of misclassifying the launcher's own new Host as a competitor (nine isolated same-CPU callers reproduced the timeout and now pass without budget increases). Readiness keeps verified-owner status fresh after authenticated OS inspection, checks deadline/cancellation after final owner/build validation, and aborts pending socket/supervisor readiness through existing cleanup paths; discovery that has crossed its boundary no longer opens attachment leases, and the idle inspection cancels when clients attach.
|
|
46
|
+
- Recognize a starting daemon as an existing owner: a concurrent CLI start while initial A2A reconciliation holds the fence before `daemon.json` exists now reports `already_running` against the actual PID/runtimeId instead of claiming a second `started: true` Host.
|
|
47
|
+
- Retire idle interactive Hosts after the accepted 30-second CLI idle lifetime while retaining explicit services: daemon `start` and A2A-serving owners stay in place, explicit/service retention is authenticated separately from default SDK persistence, conflicting orphan-exit requirements are rejected before shutdown, persistent intent survives rebuild refresh, and configured services are re-evaluated in the replacement Host. Idle exit is fenced on pending memory/managed-task maintenance and unknown legacy startup intent; tracked background work blocks automatic idle exit (including the final draining check) without breaking cancellable explicit shutdown, review or compaction contracts; startup admission uses authenticated read-only checks off idle preflight scans without scanning Session history before any real client.
|
|
48
|
+
- Drain a Run queued after its predecessor finishes: admission can retain its queued decision across asynchronous journal binding while the active predecessor completes and drains an empty queue; the existing guarded drain now wakes after queue publication so the queued Run starts exactly once instead of stranding.
|
|
49
|
+
- Keep the preceding turn visible when submitting a new query in a restored Session with legacy display checkpoints. The Host retains its bounded 150-item tail instead of advancing to the next query and collapsing the entire view to the new input; canonical history, full-item reads and input/tool identities are preserved.
|
|
50
|
+
- Keep saved history readable when its final tool call has no result yet: reaching the end of a valid cached revision no longer reports a history-change conflict. Preserve canonical tool timestamps across observed and paged history, and show the session banner only at the beginning of saved history while browsing ordinary chat, avoiding banner flashes at intermediate page boundaries.
|
|
51
|
+
- Space Issue 222: resolve the daemon that owns the canonical Session directory across profiles before startup, and recheck ownership if a peer wins during bootstrap. Wait for a starting owner's descriptor within the original startup deadline and cancellation signal. Reuse compatible Hosts without restarting work. Permit guarded same-build orphan-exit policy refresh, retaining active-work preflight, exact owner identity and process-exit verification. Publish structured owner/profile and upgrade blocker diagnostics; mark transient blockers retryable.
|
|
52
|
+
- Add bundled real-process shared-Host recovery to the continuous `test:bundle` gate.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
11
56
|
## [0.7.97-alpha.6] - 2026-10-15
|
|
12
57
|
|
|
13
58
|
Sixth alpha of the v0.7.97 line: shared-Host startup runs historical child
|
|
@@ -74,7 +119,7 @@ Validation: 16,589 tests passed, with package/bundle/native/type checks recorded
|
|
|
74
119
|
in the [regression guide](docs/test-guides/FEATURE_301_v0.7.97_TEST_GUIDE.md).
|
|
75
120
|
Natural-task GLM/DeepSeek smoke observed automatic image review, but full
|
|
76
121
|
repair/re-review/delivery has not passed all checks. Native DOCX fidelity and
|
|
77
|
-
model-facing schema gaps remain open; see [E2E evidence](docs/
|
|
122
|
+
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).
|
|
78
123
|
|
|
79
124
|
---
|
|
80
125
|
|
package/README.md
CHANGED
|
@@ -494,6 +494,11 @@ kodax -p "Review this repository"
|
|
|
494
494
|
kodax daemon stop --profile default
|
|
495
495
|
```
|
|
496
496
|
|
|
497
|
+
An ordinary CLI-started Host exits after its last client disconnects and governed
|
|
498
|
+
work has remained idle for 30 seconds. Reconnecting cancels that idle exit.
|
|
499
|
+
`kodax daemon start` retains the current Host (including an existing temporary
|
|
500
|
+
Host); a Host serving configured A2A also stays available without CLI clients.
|
|
501
|
+
|
|
497
502
|
Tests that start an isolated Host must close that exact Host after its work has
|
|
498
503
|
settled, before removing its temporary home. Never stop arbitrary Node processes.
|
|
499
504
|
With no explicit home, CLI and SDK use the resolved `KODAX_HOME`; explicit
|
|
@@ -773,8 +778,8 @@ provider's model, REPL `/compact` clears the UI only after a durable save, and
|
|
|
773
778
|
successful reports carry bounded `summaryRequests` plus `commitMs` per
|
|
774
779
|
physical summary call.
|
|
775
780
|
|
|
776
|
-
**v0.7.97-alpha.4 release:** Adds the
|
|
777
|
-
|
|
781
|
+
**v0.7.97-alpha.4 source release:** Adds the optional Artifact SDK workspace
|
|
782
|
+
— PPTX authoring, bounded editing, and current-file visual
|
|
778
783
|
evidence through lightweight rendering (optional LibreOffice/PDF conversion) — with an optional managed
|
|
779
784
|
KodaX adapter (FEATURE_301), and retires the out-of-band Sidecar
|
|
780
785
|
Verifier: the main agent now verifies requested requirements with actual
|
|
@@ -789,6 +794,32 @@ starts, upgrades, or waits. See
|
|
|
789
794
|
Every v0.7.96 stable and v0.7.97-alpha.1/alpha.2/alpha.3 contract is
|
|
790
795
|
retained.
|
|
791
796
|
|
|
797
|
+
**v0.7.97-alpha.8 release:** Ships the Artifact SDK inside the single main
|
|
798
|
+
package — `@kodax-ai/kodax` gains `/artifacts`, `/artifacts/client`,
|
|
799
|
+
`/artifacts/runtime` and `/artifacts/kodax` subpath exports; the workspace
|
|
800
|
+
module turns private (no separate artifacts npm package), its pinned
|
|
801
|
+
dependencies declare in the root package, and the declared Node floor
|
|
802
|
+
advances to 20.16, with tarball-audit and installed-package Release gates.
|
|
803
|
+
See the
|
|
804
|
+
[v0.7.97-alpha.8 release notes](docs/release.md#v0797-alpha8-release-preparation).
|
|
805
|
+
Every v0.7.96 stable and v0.7.97-alpha.1 through alpha.7 contract is
|
|
806
|
+
retained.
|
|
807
|
+
|
|
808
|
+
**v0.7.97-alpha.7 release:** Resolves shared-Session Host ownership across
|
|
809
|
+
daemon profiles (Space #222) — launchers wait for a starting owner's verified
|
|
810
|
+
descriptor within the original startup deadline, reuse compatible Hosts
|
|
811
|
+
without restarting work, and permit only a guarded same-build orphan-exit
|
|
812
|
+
policy refresh. Structured owner/profile and upgrade-blocker diagnostics
|
|
813
|
+
publish, and daemon startup and connection timeouts surface as retryable
|
|
814
|
+
`daemon_startup_failed` and `ETIMEDOUT` failures. Idle interactive Hosts
|
|
815
|
+
retire after a bounded 30-second lifetime while explicit daemon/A2A service
|
|
816
|
+
owners are retained, concurrent CLI starts recognize a starting daemon as
|
|
817
|
+
the existing owner, and Windows SDK attachment reads targeted exact process
|
|
818
|
+
identities within the original startup controls. See the
|
|
819
|
+
[v0.7.97-alpha.7 release notes](docs/release.md#v0797-alpha7-release-preparation).
|
|
820
|
+
Every v0.7.96 stable and v0.7.97-alpha.1 through alpha.6 contract is
|
|
821
|
+
retained.
|
|
822
|
+
|
|
792
823
|
**v0.7.97-alpha.6 release:** Streamlines shared-Host startup — historical
|
|
793
824
|
child recovery runs once under the owner fences and preflight projects
|
|
794
825
|
canonical Actor metadata without loading transcripts — and orders `kodax -r`,
|
|
@@ -1385,12 +1416,12 @@ kodax --repo-intelligence full --repo-intelligence-trace
|
|
|
1385
1416
|
|
|
1386
1417
|
## Architecture
|
|
1387
1418
|
|
|
1388
|
-
KodaX uses a **monorepo architecture** with npm workspaces. Four core packages ship in `@kodax-ai/kodax` with
|
|
1419
|
+
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).
|
|
1389
1420
|
|
|
1390
1421
|
```
|
|
1391
1422
|
KodaX/
|
|
1392
1423
|
├── packages/ # 4 core packages + optional artifacts
|
|
1393
|
-
│ ├── artifacts/ #
|
|
1424
|
+
│ ├── artifacts/ # Private Artifact SDK workspace; main-package subpaths
|
|
1394
1425
|
│ ├── llm/ # @kodax-ai/llm - LLM abstraction (16 built-in provider aliases)
|
|
1395
1426
|
│ │ └── providers/ # Anthropic, OpenAI, DeepSeek, Kimi, MiMo, MiniMax, Zhipu, Ark, …
|
|
1396
1427
|
│ │
|
|
@@ -1460,10 +1491,10 @@ Source-side workspace package names (`@kodax-ai/*`). npm consumers install the s
|
|
|
1460
1491
|
|
|
1461
1492
|
KodaX has two layers that consumers should understand separately:
|
|
1462
1493
|
|
|
1463
|
-
- **Source-side**: 4 workspace packages
|
|
1464
|
-
- **Current packaged exports** (not a claim of npm availability): a single bundled package `@kodax-ai/kodax` with
|
|
1494
|
+
- **Source-side**: 4 core workspace packages plus the private Artifact workspace (what developers see when reading the repo).
|
|
1495
|
+
- **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:
|
|
1465
1496
|
- **Full-package subpaths** (`/agent`, `/llm`, `/coding`, `/repl`) — each one maps 1:1 to a source workspace and exposes its complete public API.
|
|
1466
|
-
- **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`.
|
|
1497
|
+
- **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`.
|
|
1467
1498
|
|
|
1468
1499
|
| Source package | npm subpath | Type | What you get | Example consumer |
|
|
1469
1500
|
|---|---|---|---|---|
|
|
@@ -2070,11 +2101,11 @@ await runKodaX({
|
|
|
2070
2101
|
|
|
2071
2102
|
## SDK Usage
|
|
2072
2103
|
|
|
2073
|
-
This development tree exposes
|
|
2104
|
+
This development tree exposes 17 SDK subpaths plus the root. Shared product
|
|
2074
2105
|
applications use `@kodax-ai/kodax/client`; independent libraries and trusted Host
|
|
2075
2106
|
APIs remain available through the other subpaths. See the [Client contract](docs/CLIENT_CONTRACT.md)
|
|
2076
2107
|
and [SDK migration guide](docs/SDK_MIGRATION.md). This documentation was checked
|
|
2077
|
-
against package version `0.7.97-alpha.
|
|
2108
|
+
against package version `0.7.97-alpha.8`; npm publication is separate from
|
|
2078
2109
|
the current development-tree contract.
|
|
2079
2110
|
|
|
2080
2111
|
```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,23 @@ 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.8 发布**:Artifact SDK 并入单一主包发布——`@kodax-ai/kodax` 新增
|
|
318
|
+
`/artifacts`、`/artifacts/client`、`/artifacts/runtime`、`/artifacts/kodax` 四个
|
|
319
|
+
子路径导出;工作区模块转为私有(不再独立发布 npm),固定依赖上移到根包声明,
|
|
320
|
+
Node 最低版本提升到 20.16,tarball 审计与已安装包 Release 门同步就位。
|
|
321
|
+
详见 [v0.7.97-alpha.8 发布清单](docs/release.md#v0797-alpha8-release-preparation)。
|
|
322
|
+
所有 v0.7.96 稳定与 v0.7.97-alpha.1 至 alpha.7 契约全部保留。
|
|
323
|
+
|
|
324
|
+
**v0.7.97-alpha.7 发布**:跨 daemon profile 解析共享 Session 存储的 Host
|
|
325
|
+
归属(Space #222)——启动器在原启动期限内等待启动中 owner 的已验证描述符,
|
|
326
|
+
兼容 Host 直接复用而不重启工作,仅允许受控的同构建 orphan-exit 策略刷新。
|
|
327
|
+
结构化 owner/profile 与升级阻塞诊断对外发布,daemon 启动与连接超时以可重试的
|
|
328
|
+
`daemon_startup_failed` 与 `ETIMEDOUT` 呈现。空闲的交互式 Host 在 30 秒生命周期后
|
|
329
|
+
退隐而显式 daemon/A2A 服务 owner 保留;并发 CLI 启动识别启动中的 daemon 为既有
|
|
330
|
+
owner;Windows SDK attach 在原启动控制内读取精确进程身份。
|
|
331
|
+
详见 [v0.7.97-alpha.7 发布清单](docs/release.md#v0797-alpha7-release-preparation)。
|
|
332
|
+
所有 v0.7.96 稳定与 v0.7.97-alpha.1 至 alpha.6 契约全部保留。
|
|
333
|
+
|
|
317
334
|
**v0.7.97-alpha.6 发布**:精简共享 Host 启动——历史子进程恢复在 owner fence
|
|
318
335
|
下只运行一次,预检投影规范 Actor 元数据而不加载 transcript;`kodax -r`、Host
|
|
319
336
|
与 SDK 的 Session 列表按真实最近消息活动排序并暴露可选 `lastMessageAt`。
|
|
@@ -1125,6 +1142,8 @@ daemon 可承载多个 Session;不同 Session 可以并发,同一 Session
|
|
|
1125
1142
|
|
|
1126
1143
|
显式独立库嵌入仍可使用 `/runtime` 的 `createKodaXRuntime({mode:'embedded'})`,其 owner 和退出责任属于调用者。这不是 CLI 的可选运行模式,也不是产品客户端的连接失败回退。当前包版本与发布状态见[SDK 迁移指南](docs/SDK_MIGRATION.md)。
|
|
1127
1144
|
|
|
1145
|
+
普通 CLI 自动拉起的 Host 在最后一个客户端断开、后台工作持续空闲 30 秒后退出;重新连接会取消空闲退出。显式 `kodax daemon start` 会保留当前 Host,即使它原先是临时 Host;承载已配置 A2A 服务的 Host 也会在没有 CLI 客户端时继续常驻。
|
|
1146
|
+
|
|
1128
1147
|
### 7. 打包成单文件二进制(无需 Node)
|
|
1129
1148
|
|
|
1130
1149
|
KodaX 可以用 `bun --compile` 打包成单可执行文件 + 一个 `builtin/` sidecar 目录,目标机器**不需要安装 Node.js 或任何运行时**。
|
|
@@ -1260,7 +1279,7 @@ kodax --repo-intelligence full --repo-intelligence-trace
|
|
|
1260
1279
|
|
|
1261
1280
|
## 仓库结构
|
|
1262
1281
|
|
|
1263
|
-
KodaX 是基于 npm workspaces 的 TypeScript monorepo,**4 个核心 workspace
|
|
1282
|
+
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)。核心包:
|
|
1264
1283
|
|
|
1265
1284
|
| Workspace 包 | 作用 | 主要依赖 |
|
|
1266
1285
|
|----|------|---------|
|
|
@@ -1275,10 +1294,10 @@ KodaX 是基于 npm workspaces 的 TypeScript monorepo,**4 个核心 workspace
|
|
|
1275
1294
|
|
|
1276
1295
|
KodaX 有两层结构,SDK 用户需要分开理解:
|
|
1277
1296
|
|
|
1278
|
-
- **源码层**:4 个核心 workspace
|
|
1279
|
-
- **当前源码打包导出**(不表示已发布到 npm):单个 bundled 包 `@kodax-ai/kodax`,对外暴露
|
|
1297
|
+
- **源码层**:4 个核心 workspace 包,另有私有可选 Artifact 源码 workspace,经同一主包 `/artifacts` 子路径交付:PPTX 创作/限定编辑,PDF/图片/SVG 取证、DOCX 轻量预览、本地网页与 SMIL 捕获,公共准备和真实图片读取。核心启动不加载渲染依赖;桥接沿用受管权限、沙箱和取消。[SDK 支持与限制](docs/ARTIFACT_SDK.md)。
|
|
1298
|
+
- **当前源码打包导出**(不表示已发布到 npm):单个 bundled 包 `@kodax-ai/kodax`,对外暴露 17 个 SDK subpath(SDK 消费者 `import` 时看到的接口)。subpath 分两种角色:
|
|
1280
1299
|
- **完整包 subpath**(`/agent`、`/llm`、`/coding`、`/repl`)—— 每个 1:1 对应一个源码包,暴露完整公开 API。
|
|
1281
|
-
- **集成与窄子集 subpath**(`/media`、`/skills`、`/mcp`、`/session`、`/client`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`)—— 聚焦能力或宿主集成边界;`/experimental-memory` 明确为 opt-in 不稳定接口。
|
|
1300
|
+
- **集成与窄子集 subpath**(`/media`、`/skills`、`/mcp`、`/session`、`/client`、`/runtime`、`/sandbox`、`/a2a`、`/experimental-memory`、`/artifacts`、`/artifacts/client`、`/artifacts/runtime`、`/artifacts/kodax`)—— 聚焦能力或宿主集成边界;`/experimental-memory` 明确为 opt-in 不稳定接口。
|
|
1282
1301
|
|
|
1283
1302
|
| 源码包 | npm subpath | 类型 | 内容 | 典型消费者 |
|
|
1284
1303
|
|---|---|---|---|---|
|
|
@@ -1450,7 +1469,7 @@ KodaX/ # 4 workspace packages(FEATURE_194 v0.7.43)
|
|
|
1450
1469
|
│ ├── kodax_cli.ts # CLI 主入口(bin: `kodax`)
|
|
1451
1470
|
│ └── sdk-*.ts # SDK subpath 入口 → @kodax-ai/kodax/{agent,llm,coding,media,repl,skills,mcp,session,runtime,sandbox,a2a,experimental-memory}
|
|
1452
1471
|
├── scripts/
|
|
1453
|
-
│ ├── build-bundle.mjs # esbuild 单 bundle 多 entry 打包(CLI + root + 13 SDK subpath + chunks)
|
|
1472
|
+
│ ├── build-bundle.mjs # esbuild 单 bundle 多 entry 打包(CLI + root + 13 核心 SDK subpath + Artifact 资源 + chunks)
|
|
1454
1473
|
│ ├── build-binary.mjs # Bun --compile 单文件二进制打包
|
|
1455
1474
|
│ └── release.mjs # 发布 CI 构建的通用 tarball;本地 --pack-only 保持 private:true
|
|
1456
1475
|
└── .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,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAI,OAA+B,EAAE,GAA+B;IACzG,OAAO,CAAC,MAAM,EA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,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,EAAE,cAAc,EAAE,CAAC;YACrE,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACjD,MAAM,OAAO,GAAG,MAAM,MAAM,CA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AC;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 {};
|