@claxedo/agent-runtime-contract 0.8.0 → 0.10.0

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 (65) hide show
  1. package/README.md +27 -9
  2. package/dist/agent-runtime-event.d.ts +975 -0
  3. package/dist/availability.d.ts +3 -4
  4. package/dist/background-work.d.ts +10 -0
  5. package/dist/claims.d.ts +2 -0
  6. package/dist/connections.d.ts +66 -1
  7. package/dist/content.d.ts +72 -15
  8. package/dist/credential-broker-errors.d.ts +4 -0
  9. package/dist/custom-provider-headers.d.ts +12 -0
  10. package/dist/d1-bookmarks.d.ts +39 -0
  11. package/dist/daemon-ownership-snapshot.d.ts +40 -0
  12. package/dist/diagnostics.d.ts +24 -0
  13. package/dist/elicitation-pattern-worker.d.ts +6 -0
  14. package/dist/elicitation-pattern-worker.mjs +17 -0
  15. package/dist/elicitation-validation.d.ts +23 -0
  16. package/dist/elicitation.d.ts +51 -0
  17. package/dist/errors.d.ts +8 -1
  18. package/dist/event-cursor.d.ts +19 -0
  19. package/dist/events.d.ts +146 -216
  20. package/dist/files.d.ts +2 -0
  21. package/dist/first-turn-error.d.ts +12 -0
  22. package/dist/goals.d.ts +28 -0
  23. package/dist/harness-permission-modes.d.ts +76 -0
  24. package/dist/harness-table.d.ts +66 -4
  25. package/dist/harnesses.d.ts +19 -1
  26. package/dist/ids.d.ts +4 -0
  27. package/dist/index.d.ts +46 -1
  28. package/dist/index.mjs +2814 -95
  29. package/dist/mcp-app.d.ts +24 -0
  30. package/dist/message-page.d.ts +101 -0
  31. package/dist/permissions.d.ts +47 -0
  32. package/dist/pi-providers.d.ts +36 -0
  33. package/dist/prompt-title.d.ts +2 -0
  34. package/dist/provider-projection.d.ts +166 -0
  35. package/dist/raw-harness-event.d.ts +7 -0
  36. package/dist/recovery/actions.d.ts +20 -0
  37. package/dist/recovery/budgets.d.ts +16 -0
  38. package/dist/recovery/facts.d.ts +37 -0
  39. package/dist/recovery/operations.d.ts +66 -0
  40. package/dist/recovery/outcomes.d.ts +48 -0
  41. package/dist/recovery/payload-line.d.ts +19 -0
  42. package/dist/recovery/postconditions.d.ts +18 -0
  43. package/dist/recovery/requests.d.ts +44 -0
  44. package/dist/recovery/targets.d.ts +55 -0
  45. package/dist/recovery/validation.d.ts +9 -0
  46. package/dist/runtime-content.d.ts +34 -0
  47. package/dist/session-handoff.d.ts +4 -0
  48. package/dist/session-titles.d.ts +14 -0
  49. package/dist/sessions.d.ts +183 -5
  50. package/dist/stream-heartbeat.d.ts +11 -0
  51. package/dist/subagents.d.ts +92 -0
  52. package/dist/tool-header.d.ts +13 -0
  53. package/dist/tool-names.d.ts +5 -0
  54. package/dist/transcript-notice.d.ts +28 -0
  55. package/dist/turn-account.d.ts +26 -0
  56. package/dist/turn-error-classes.d.ts +10 -0
  57. package/dist/turn-fold.d.ts +111 -0
  58. package/dist/turn-fold.mjs +414 -0
  59. package/dist/turn-message-ids.d.ts +16 -0
  60. package/dist/turn-outline.d.ts +37 -0
  61. package/dist/turn-page.d.ts +58 -0
  62. package/dist/usage-streams.d.ts +19 -0
  63. package/dist/vendor-body.d.ts +31 -0
  64. package/dist/vendor-providers.d.ts +11 -0
  65. package/package.json +17 -3
package/README.md CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  Dependency-free canonical contracts for Claxedo agent sessions: execution
4
4
  bindings, content and message shapes, capabilities, connection descriptors,
5
- errors, file references, and the runtime event model. Every Claxedo runtime
6
- package (`@claxedo/agent-event-runtime`, `@claxedo/agent-sdk-runtime`,
7
- `@claxedo/workspace-runtime`) and every client that speaks to them imports
8
- these types from here, so the wire contract has exactly one owner.
5
+ errors, file references, the runtime event model, the presentation events a
6
+ client reads, and the turn pages and outlines every session producer serves.
7
+ Every Claxedo runtime package (`@claxedo/harness`, `@claxedo/workspace-runtime`)
8
+ and every client that speaks to them imports these types from here, so the
9
+ wire contract has exactly one owner.
9
10
 
10
11
  ## Install
11
12
 
@@ -16,12 +17,12 @@ npm install @claxedo/agent-runtime-contract
16
17
  ## Usage
17
18
 
18
19
  ```ts
19
- import { assertAgentExecutionBinding, AGENT_RUNTIME_CONTRACT_VERSION } from "@claxedo/agent-runtime-contract"
20
+ import { requireAgentExecutionBinding, AGENT_RUNTIME_CONTRACT_VERSION } from "@claxedo/agent-runtime-contract"
20
21
 
21
- const binding = assertAgentExecutionBinding({
22
- scope: "central",
23
- directory: "",
24
- sessionId: "central-1",
22
+ const binding = requireAgentExecutionBinding({
23
+ sessionId: "session-1",
24
+ workspaceId: "workspace-1",
25
+ directory: "/work/one",
25
26
  connectionId: "native:pi",
26
27
  upstreamSessionId: "pi-1",
27
28
  })
@@ -30,6 +31,23 @@ const binding = assertAgentExecutionBinding({
30
31
  The package ships plain ESM plus type declarations and has no runtime
31
32
  dependencies, so it loads under Node without a TypeScript loader.
32
33
 
34
+ ## The turn fold (`@claxedo/agent-runtime-contract/turn-fold`)
35
+
36
+ How a turn's parts group, and which groups a finished turn folds behind its
37
+ "Worked for" row. It lives here so every reader of a turn's parts groups and
38
+ folds them the same way.
39
+
40
+ - Group identity uses canonical tool spellings; harness variants (`command`, `read_file`, `ls`) fold in through the contract's `canonicalToolName`, so a new spelling is added once.
41
+ - Consecutive context tools (read, list, glob, grep) fold into an "Explored" group at any length, consecutive subagent spawns into an agents group at any length (a lone spawn too: the chip row is the only shape that draws one), and a run of work tools only at two or more members. Any other part flushes all three runs. Work is named by exclusion (not context, subagent, hidden or addressed to the reader), because a list names only the tools it knows, and a missing tool breaks a run into its own row.
42
+ - A read that returned an image stays its own row: a group summarizes reads as a count, and a count cannot stand in for a thumbnail.
43
+ - A failed spawn stays renderable so it can show the tool error when no child was admitted; its outcome does not say whether a child exists. A subagent spawn is recognized by name (the contract owns the spellings), or by an MCP tool declaring task work on its input.
44
+ - A notice part (`TranscriptNotice`: a harness's sentence, a compaction) is never folded: it is the harness telling the reader something, not machinery.
45
+ - A single tool is not folded: it is already one compact row, and folding hides the only actionable content behind a click. A grouped run counts as one row because it has its own disclosure.
46
+ - The turn's answer is every text group after its last tool, or all of its text when it ran no tool: no harness marks which text part answers (`finish` is never set natively, `AgentStepFinishPart` never emitted), so position stands in for it. A reply the vendor streams as text, thought, text is two text parts and one answer; folding only the last would hide the reply behind a one-character tail. Narration before the last tool call folds with the work, and so do thoughts, wherever they sit. "Copy response" copies the same answer (`answerPartRefs`), its parts joined by a blank line, so the fold and the copy never disagree.
47
+ - A reply surface (a first-party `ui_show` part, `ANSWER_TOOLS`) is answer content wherever it sits: its part group carries `answer`, it never folds, and it does not count as the last tool that ends the work, so the text after it stays the answer. Copy still reads only text.
48
+ - A finished turn folds its machinery (tool runs, answered questions, spawns, reasoning, narration between tools) behind "Worked for Xs", leaving the answer; an explicit toggle beats the auto-fold. A working turn gets no fold and no control: settled alone cannot tell a finished turn from one between steps. Settled is per message, so a multi-step turn reads settled from its first step. A settled turn whose parts are still pending folds on the count it will have. An interrupted or failed turn keeps the control but does not fold on its own: its rows explain what happened, and a turn opened by hand and then interrupted must still be collapsible.
49
+ - A reader's own fold hides all of the turn, open rows included; an automatic fold never takes a row the reader opened.
50
+
33
51
  ## Versioning
34
52
 
35
53
  `agent-runtime-contract` rides the runtime version track with the other