@kodax-ai/kodax 0.7.59 → 0.7.61

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +1234 -1228
  3. package/README_CN.md +653 -647
  4. package/dist/chunks/{agent-QQCRBU4C.js → agent-E74WVAFR.js} +1 -1
  5. package/dist/chunks/argument-completer-BBFYCVTM.js +2 -0
  6. package/dist/chunks/{chunk-TBXP7FEG.js → chunk-2OEKUAV4.js} +1 -1
  7. package/dist/chunks/chunk-4NSOBQCU.js +322 -0
  8. package/dist/chunks/{chunk-YADBB5GN.js → chunk-6OZ5KWG3.js} +1 -1
  9. package/dist/chunks/{chunk-SVEJFERZ.js → chunk-7COB3EKF.js} +176 -161
  10. package/dist/chunks/chunk-CGGX3FXE.js +19 -0
  11. package/dist/chunks/{chunk-UXQILGRX.js → chunk-D7CC6YZC.js} +198 -198
  12. package/dist/chunks/{chunk-2UUOFT3Z.js → chunk-KIVYMSRH.js} +1 -1
  13. package/dist/chunks/chunk-NJW2LQOP.js +722 -0
  14. package/dist/chunks/chunk-PJXKBM3Y.js +310 -0
  15. package/dist/chunks/chunk-QCBKLNN5.js +18 -0
  16. package/dist/chunks/{chunk-5GPJ6MB5.js → chunk-XHOPSZVL.js} +120 -120
  17. package/dist/chunks/{chunk-BEXLPFFB.js → chunk-ZL5CEANW.js} +3 -3
  18. package/dist/chunks/compaction-config-GESEZQVA.js +2 -0
  19. package/dist/chunks/{construction-bootstrap-YON4ZEMO.js → construction-bootstrap-OSXHEIBB.js} +1 -1
  20. package/dist/chunks/{dist-EZXBR6NW.js → dist-W3OOJP66.js} +1 -1
  21. package/dist/chunks/host-FRQXOEHH.js +2 -0
  22. package/dist/chunks/{paste-4THGP5XW.js → paste-FDYM7SZX.js} +1 -1
  23. package/dist/chunks/run-manager-FGCG7DFF.js +2 -0
  24. package/dist/chunks/{utils-5XVW33SY.js → utils-47QI5MSP.js} +1 -1
  25. package/dist/index.d.ts +11 -11
  26. package/dist/index.js +1 -1
  27. package/dist/kodax_cli.js +1028 -972
  28. package/dist/sdk-agent.d.ts +24 -13
  29. package/dist/sdk-agent.js +1 -1
  30. package/dist/sdk-coding.d.ts +17 -13
  31. package/dist/sdk-coding.js +1 -1
  32. package/dist/sdk-llm.d.ts +6 -6
  33. package/dist/sdk-mcp.js +1 -1
  34. package/dist/sdk-media.d.ts +1 -1
  35. package/dist/sdk-media.js +1 -1
  36. package/dist/sdk-repl.d.ts +12 -11
  37. package/dist/sdk-repl.js +2 -2
  38. package/dist/sdk-session.d.ts +6 -6
  39. package/dist/sdk-session.js +1 -1
  40. package/dist/sdk-skills.js +1 -1
  41. package/dist/types-chunks/{base.d-BA9Doaj_.d.ts → base.d-DalIRhbb.d.ts} +1 -1
  42. package/dist/types-chunks/{bash-prefix-extractor.d-BNdpV4Cf.d.ts → bash-prefix-extractor.d-e1LD2IRl.d.ts} +70 -27
  43. package/dist/types-chunks/{capability-learning.d-DRV80ISB.d.ts → capability-learning.d-BQB0M70w.d.ts} +1 -1
  44. package/dist/types-chunks/{guardrail.d-CNdKuSD_.d.ts → guardrail.d-CdqJwwN7.d.ts} +3 -3
  45. package/dist/types-chunks/{process.d-BOrAxjvM.d.ts → process.d-C93UMgPK.d.ts} +20 -5
  46. package/dist/types-chunks/{resolver.d-DFAKKUvt.d.ts → resolver.d-CGkfRULj.d.ts} +2 -2
  47. package/dist/types-chunks/{run-manager.d-CsJC9zYf.d.ts → run-manager.d-DHPlNYkK.d.ts} +20 -6
  48. package/dist/types-chunks/{sdk-session-ByZlwgdM.d.ts → sdk-session-DINrM1pF.d.ts} +47 -10
  49. package/dist/types-chunks/{storage.d-DHL3XpAL.d.ts → storage.d-xiw7Vgx0.d.ts} +2 -2
  50. package/dist/types-chunks/{types.d-Ci5YPFEh.d.ts → types.d-Bp4Lm1jv.d.ts} +37 -3
  51. package/dist/types-chunks/{types.d-CE_Ter29.d.ts → types.d-CSZAMmU-.d.ts} +4 -1
  52. package/dist/types-chunks/{utils.d-D9FHU4wB.d.ts → utils.d-Dy19-1XR.d.ts} +5 -5
  53. package/package.json +1 -1
  54. package/dist/chunks/argument-completer-7Q2T4YWA.js +0 -2
  55. package/dist/chunks/chunk-D7RENPQQ.js +0 -322
  56. package/dist/chunks/chunk-PRIBJN5E.js +0 -683
  57. package/dist/chunks/chunk-SDSLWDAZ.js +0 -17
  58. package/dist/chunks/chunk-Z23LK3IV.js +0 -310
  59. package/dist/chunks/chunk-Z3ZXV3DZ.js +0 -18
  60. package/dist/chunks/compaction-config-GQIPCVFD.js +0 -2
  61. package/dist/chunks/host-LO6ZNTMV.js +0 -2
  62. package/dist/chunks/run-manager-HTLXKU66.js +0 -2
package/CHANGELOG.md CHANGED
@@ -6,6 +6,64 @@ All notable changes to this project will be documented in this file.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.61] - 2026-07-06
10
+
11
+ > Scope note: a token-efficiency + workflow-reliability release. **FEATURE_251** adds command-aware
12
+ > in-tool output compression (an rtk-style Token Killer port) inside KodaX's own `bash` tool layer,
13
+ > so a noisy `git diff` / test run / package-install / docker-build no longer spends thousands of
14
+ > context tokens — the compressed body is what context accounting actually counts, and every lossy
15
+ > summary keeps a raw-recovery path. **FEATURE_252** lands the deterministic half of workflow-quality
16
+ > preflight: a pre-start AST/dataflow lint that hard-fails weak-model authoring contract bugs before
17
+ > a workflow can run. Both are deterministic (no prompt change, no LLM eval). The release also fixes a
18
+ > workflow-start crash: `typescript` is now a runtime dependency of `@kodax-ai/agent` because the
19
+ > quality lint uses the TypeScript compiler API on the workflow hot path. No public runtime type is removed.
20
+
21
+ ### Added
22
+
23
+ - **Tool-output semantic compression — command-aware in-tool Token Killer (FEATURE_251, ADR-050).** A new `packages/coding/src/tools/output-filters/` module compresses bash `stdout`/`stderr` **body** after decode, before the `Command:` / `Exit:` header is assembled, at the single `bash.ts` close-handler integration point (so both the SA and AMA dispatch paths are covered by one change). It ships a lossless generic layer (ANSI strip), compiled stateful filters (`git-diff`, `git-log`, `git-status`, `test-runner` failure-focus, `lint` diagnostic grouping, `json-output` / NDJSON structural summary), and a built-in declarative long-tail table (package-manager / docker / infra CLI progress). Hard constraints: the `Command:` / `Exit:` header is preserved verbatim (FEATURE_185 hits-ledger depends on it); the generic layer is lossless-by-construction with `never_worse` as a size-only backstop; content-signature detection is preferred over command-name matching (robust to compound commands and pipes); and every lossy filter (`lossiness: tail | whole`) first persists the raw decoded body via `persistToolOutput` and appends a recovery hint, falling back to the raw body + existing tail-truncation if the persist fails. `background` / `timeout` / `abort` paths do not reach the completion assembly and are naturally excluded. Isolated Layer-1 measurements (`context-savings.test.ts`) show ~66–99% body-token reduction on high-noise commands (e.g. a 120-file `git diff` 9,960 → 1,344 tokens; a `terraform apply` progress stream 10,617 → 59). Deterministic code — no prompt change, no FEATURE_104 eval. Human test guide: `docs/test-guides/FEATURE_251_v0.7.61_TEST_GUIDE.md`.
24
+ - **Deterministic workflow-quality preflight lint (FEATURE_252).** A new `packages/agent/src/workflow/quality-lint.ts` (`lintRestrictedWorkflowSource` / `assertRestrictedWorkflowQuality`, exported from the workflow package) runs inside restricted workflow module materialization (`script-runner.ts` `createRestrictedWorkflowModule`) and in the coding workflow host with host-policy `maxAgents`, so structural contract violations fail before a run can start — matching the existing inline-smoke hard-fail feedback loop. It hard-fails three deterministic contract classes only: (1) an unawaited workflow-command variable (`wf.runAgent` / `wf.spawnAgent` / `wf.wait` / `wf.synthesize` / `wf.workflow` / `wf.artifact`) used in a boolean position (`if (x)`, `!x`, ternary test, `x && …`, `x || …`, loop test) — a case a runtime Proxy cannot catch because object truthiness has no Proxy trap; (2) top-level structured-output field access (`result.findings`, `result.summary`, …) when the fields belong under `result.structured`; and (3) a literal `[...]`/`[...].map(...)` agent fanout whose static upper bound exceeds `manifest.maxAgents` or a known host cap. Review/verifier/generic quality heuristics are intentionally **not** emitted as model-visible warnings (a lightweight AST pass cannot distinguish a weak workflow from a valid optimized one, and surfacing them causes needless rewrite churn). Human test guide: `docs/test-guides/FEATURE_252_v0.7.61_TEST_GUIDE.md`.
25
+
26
+ ### Changed
27
+
28
+ - **Review/audit workflow templates make adversarial verification explicit (FEATURE_252 Layer 2).** The default generator/authoring fixtures for `adversarial-verification` shapes now use explicit verifier stages and `task_id:` evidence refs, so the desired shape — finders → adversarial verifiers → synthesis of confirmed findings — is stated in the template rather than left to a weak authoring model to infer. This reduces reliance on lint and is robust to capability-limited authors.
29
+
30
+ ### Fixed
31
+
32
+ - **Workflow-start crash: `typescript` promoted to a runtime dependency of `@kodax-ai/agent`.** The FEATURE_252 quality lint imports the TypeScript compiler API (`ts.createSourceFile`, …) and runs on every workflow start via `assertRestrictedWorkflowQuality`. With `typescript` only in `devDependencies`, a bundled/published build resolved no `typescript` module at that call site, throwing an uncaught error that crashed the process before the workflow ran (leaving the terminal in a corrupted mouse/alt-screen state). Moving `typescript` to `dependencies` fixes the workflow-front crash.
33
+
34
+ ## [0.7.60] - 2026-07-05
35
+
36
+ > Scope note: an F250 refactor + Space SDK rollup. **FEATURE_250** brings the deferred-tool
37
+ > progressive-disclosure mechanism — previously SA-path-only — to the AMA/AMAW **managed** tool
38
+ > path, so cache-cold managed turns carry one-line search hints instead of full descriptions for
39
+ > the repo-intelligence + web/code/goal tools. Tool `input_schema` is unchanged, so every deferred
40
+ > tool stays directly callable; the full description is fetched on demand via `tool_search`.
41
+ > Transparent (no user-facing behavior change) and prompt-additive only (a two-line
42
+ > `code_search`/`semantic_lookup` teaching block). The release also lands **CAP-099 (Space SDK):
43
+ > live turn attribution + structured transcript** — streamed activity events carry session/turn
44
+ > identity, explicit turn-boundary events share one per-session sequence, and client-only
45
+ > transcript notices are persisted without ever entering the model context. All additive and
46
+ > profile/host-gated; the default path stays unchanged when a host does not read the new metadata.
47
+ > No public runtime type is removed.
48
+
49
+ ### Added
50
+
51
+ - **`code_search` / `semantic_lookup` teaching in the Worker REPO INTELLIGENCE prompt (FEATURE_250).** A two-line, eval-justified teaching block: the floor-tier alias under-adopted the hint-only tools on ambiguous tasks (75%), and the teaching recovered adoption to 100% while being strictly non-negative on every other alias.
52
+ - **CAP-099 live turn attribution — session/turn identity on streamed events (Space SDK).** A shared live-turn scope (`createLiveTurnScope` / `withLiveTurnAttribution`, `event-emitter.ts`) stamps `KodaXActivityEventMeta` (`sessionId` / `seq` / `turnId` / `deliveryId` / `timestamp`) onto every streamed activity callback, and explicit turn-boundary events (`emitTurnStarted` / `emitTurnCompleted` / `emitTurnFailed`) share one monotonic per-session sequence — so an SDK host can route streamed assistant events to the owning turn's UI bubble by turn ownership instead of fragile ordering-by-observation. Threaded through messaging (queue/drain), orchestration (idle-yield), run-substrate, runner-driven, run-workflow, and dispatch-child-tasks; a host that ignores the metadata sees unchanged behavior. New `cap-099-live-turn-attribution` contract test; existing `cap-005/006/007/041/046/054/086` event-contract tests updated for the added meta parameter.
53
+ - **Client-only transcript notices + structured transcript entries (CAP-099, Space SDK).** The persisted transcript gains structured entry types (`message` / `compaction` / `branch_summary` / `client_notice` / `task_result`) with `source` + `turnId`. A `client_notice` is persisted as a lineage entry, NOT a model message: `loadSession()` (active model context) omits it while `loadFullTranscript()` returns it with `type: 'client_notice'`, `source: 'client'`, and `payload.entersModelContext === false` — so a host can render client-side scrollback notices without polluting the model's context. SDK embedder guide updated (`docs/SDK_EMBEDDER_GUIDE.md`).
54
+ - **Transcript clone provenance for SDK hosts (CAP-099, Space SDK).** Lineage entries now carry optional `logicalId` / `sourceEntryId`, and `loadFullTranscript().transcriptEntries[]` always exposes a stable `logicalId` (falling back to `entryId` for old sessions). Forked/cloned entries keep the source `logicalId` and point `sourceEntryId` at the root physical source entry, so hosts can fold cloned history precisely without guessing from role/content/timestamp or `[compacted]` placeholders. `loadFullTranscript()` remains raw append-order scrollback; it does not silently merge branches or hide compaction notices.
55
+
56
+ ### Changed
57
+
58
+ - **Progressive disclosure on the AMA/AMAW managed tool path (FEATURE_250).** `buildAgentToolsFromRegistry` (`agent-chain.ts`) now hint-swaps the 13 non-mcp deferred tools — repo-intel (`repo_overview`, `changed_scope`, `module_context`, `symbol_context`, `process_context`, `impact_estimate`), web/code (`web_search`, `web_fetch`, `code_search`, `semantic_lookup`), and goal (`get_goal`, `create_goal`, `update_goal`) — to their `DEFERRED_TOOL_HINTS` one-liner. The swap is a one-time build-time change (the managed `Agent.tools` is a static array), so the tools[] prefix is cache-stable turn-to-turn. `mcp_*` (5) stay resident (remote-mutation risk + not covered by the reachability eval; conservative hold gated on a future MCP-runtime eval); `run_workflow` is untouched (host-conditional per FEATURE_246/249). Two eval panels (5-alias coding-plan) confirm no reachability harm: DEFER_SAFE 5/5, 0% read/grep fallback, and V_teach 100% adoption on ambiguous tasks. KodaX's hint-swap keeps the tool in `tools[]` with `input_schema` intact — safer than the reference agents (Claude Code / Codex) which remove deferred tools from the wire and therefore gate deferral off for weak models.
59
+ - **Inline workflow preflight hardening (FEATURE_246).** The inline `run_workflow` restricted-smoke preflight now rejects two more classes of weak-model authoring bug before a workflow starts: (1) an unawaited `wf.runAgent` / `wf.synthesize` result that leaks into a property read, JSON serialization, or assignment — a Proxy trap throws `wf.<method> result must be awaited before …` instead of silently coercing a pending command; and (2) a `manifest.readOnly=true` workflow that spawns a write-capable child (`readOnly:false`) — it now throws at preflight instead of running. This is the deterministic-structural groundwork for the planned FEATURE_252 workflow-quality lints (v0.7.61).
60
+
61
+ ### Fixed
62
+
63
+ - **`tool_search` result protected from microcompaction pruning (FEATURE_250).** `tool_search` is added to `PRUNE_PROTECTED_TOOLS` (`compaction.ts`). On the managed path a deferred tool's full description lives only in the `tool_search` result message (the static `Agent.tools` array cannot make a description resident mid-session), so the unconditional 20-turn prune would otherwise silently stub the only teaching surface for any non-prompt-taught deferral.
64
+ - **Headless SDK resume recovers `<task-completed>` results + per-message timestamps (Space SDK).** Two resume/persistence fixes for headless SDK embedders; the KodaX TUI is byte-unchanged. (1) `dispatch_child_task` / `run_workflow` `<task-completed>` result banners are spliced into the transcript as synthetic user messages that the reconstruction helper drops, so a headless host with no `uiHistory` lost them on resume — they are now tagged `_source: 'task-completed'` (only when a task-notification actually drained) and restored as a distinct `task_completed` event seed at their transcript position; when `uiHistory` is present the derived seed is discarded, so the CLI does not double-render. (2) `KodaXMessage` carried no time, so `createSessionLineage` stamped a whole managed task's messages with one accounting-millisecond and per-message "N ago" footers collapsed — an additive `KodaXMessage.timestamp?` is now stamped at each message-finalization site and preferred by `createSessionLineage`. The dedup fingerprint ignores timestamp (resume dedup unaffected); old sessions fall back to accounting-time.
65
+ - **Goal-state tool results protected from microcompaction pruning.** `get_goal` / `create_goal` / `update_goal` are added to `PRUNE_PROTECTED_TOOLS` (`compaction.ts`) alongside `tool_search`. The canonical goal state persists as session-lineage entries, but these tool results are the model-visible status snapshots and lifecycle-transition receipts (short, low-frequency, control-plane-like), so microcompaction's 20-turn prune no longer stubs the model's view of `/goal` state. (v0.7.60 review follow-up.)
66
+
9
67
  ## [0.7.59] - 2026-07-03
10
68
 
11
69
  > Scope note: a rollup release on top of v0.7.58. **FEATURE_248** and **FEATURE_249** extend