@arnilo/prism 0.4.0 → 0.5.1

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 (181) hide show
  1. package/CHANGELOG.md +41 -1
  2. package/README.md +23 -20
  3. package/dist/agent-run-state.d.ts +1 -2
  4. package/dist/agent-run-state.js +0 -3
  5. package/dist/agent-session/session/assemble.d.ts +6 -0
  6. package/dist/agent-session/session/assemble.js +391 -0
  7. package/dist/agent-session/session/persist.d.ts +28 -0
  8. package/dist/agent-session/session/persist.js +166 -0
  9. package/dist/agent-session/session/provider-round.d.ts +6 -0
  10. package/dist/agent-session/session/provider-round.js +231 -0
  11. package/dist/agent-session/session/tool-round.d.ts +31 -0
  12. package/dist/agent-session/session/tool-round.js +473 -0
  13. package/dist/agent-session/session/types.d.ts +115 -0
  14. package/dist/agent-session/session/types.js +5 -0
  15. package/dist/agent-session/session.d.ts +49 -43
  16. package/dist/agent-session/session.js +24 -1180
  17. package/dist/capture.d.ts +63 -0
  18. package/dist/capture.js +67 -0
  19. package/dist/cli-init.d.ts +18 -2
  20. package/dist/cli-init.js +2 -7
  21. package/dist/cli-runner.d.ts +2 -2
  22. package/dist/cli-runner.js +45 -9
  23. package/dist/content.d.ts +3 -3
  24. package/dist/content.js +3 -1
  25. package/dist/contracts-core/agent.d.ts +4 -0
  26. package/dist/contracts-core/batch.d.ts +97 -0
  27. package/dist/contracts-core/batch.js +65 -0
  28. package/dist/contracts-core/content.d.ts +72 -1
  29. package/dist/contracts-core/embeddings.d.ts +30 -0
  30. package/dist/contracts-core/embeddings.js +17 -0
  31. package/dist/contracts-core/images.d.ts +60 -0
  32. package/dist/contracts-core/images.js +17 -0
  33. package/dist/contracts-core/moderation.d.ts +46 -0
  34. package/dist/contracts-core/moderation.js +34 -0
  35. package/dist/contracts-core/speech.d.ts +39 -0
  36. package/dist/contracts-core/speech.js +17 -0
  37. package/dist/contracts-core/transcription.d.ts +48 -0
  38. package/dist/contracts-core/transcription.js +17 -0
  39. package/dist/contracts-core/video.d.ts +61 -0
  40. package/dist/contracts-core/video.js +17 -0
  41. package/dist/contracts-core.d.ts +7 -0
  42. package/dist/contracts-core.js +7 -0
  43. package/dist/contracts-protocol.d.ts +2 -0
  44. package/dist/index.d.ts +7 -5
  45. package/dist/index.js +5 -4
  46. package/dist/input.js +3 -2
  47. package/dist/node/agent-definitions.d.ts +1 -8
  48. package/dist/node/agent-definitions.js +0 -34
  49. package/dist/node/settings.d.ts +0 -1
  50. package/dist/node/settings.js +0 -5
  51. package/dist/pinned-fetch.js +29 -3
  52. package/dist/provider-events.js +3 -4
  53. package/dist/provider-request-policy.d.ts +15 -0
  54. package/dist/provider-request-policy.js +52 -0
  55. package/dist/providers/media.d.ts +1 -2
  56. package/dist/providers/media.js +1 -4
  57. package/dist/rpc.d.ts +1 -1
  58. package/dist/rpc.js +4 -4
  59. package/dist/testing/provider-conformance.d.ts +114 -5
  60. package/dist/testing/provider-conformance.js +342 -0
  61. package/dist/testing/tool-effect-store-conformance.d.ts +0 -1
  62. package/dist/testing/tool-effect-store-conformance.js +0 -3
  63. package/dist/thinking.d.ts +48 -9
  64. package/dist/thinking.js +134 -8
  65. package/docs/0.1.0-readiness.md +3 -3
  66. package/docs/a2a.md +2 -2
  67. package/docs/acp.md +3 -3
  68. package/docs/ag-ui-adoption.md +1 -1
  69. package/docs/ag-ui.md +1 -2
  70. package/docs/agent-definitions.md +1 -1
  71. package/docs/agent-events.md +5 -5
  72. package/docs/agent-identity.md +13 -2
  73. package/docs/agent-session-runtime.md +2 -1
  74. package/docs/audit-export.md +3 -3
  75. package/docs/batch-jobs.md +120 -0
  76. package/docs/cli-rpc.md +20 -9
  77. package/docs/coding-agent-tools.md +19 -19
  78. package/docs/coding-review-and-diagnostics.md +2 -2
  79. package/docs/coding-security.md +4 -4
  80. package/docs/coding-workspaces.md +2 -2
  81. package/docs/compaction-llm.md +2 -0
  82. package/docs/compaction-observational-memory.md +3 -0
  83. package/docs/computer-use-linux.md +13 -2
  84. package/docs/context-and-skills.md +1 -1
  85. package/docs/conversations.md +4 -4
  86. package/docs/credential-storage.md +11 -7
  87. package/docs/credentials-and-redaction.md +1 -1
  88. package/docs/data-classification.md +1 -1
  89. package/docs/database-persistence.md +4 -4
  90. package/docs/dev-inspector.md +6 -6
  91. package/docs/device-adapters.md +2 -2
  92. package/docs/diagrams.md +1 -1
  93. package/docs/document-reader.md +6 -6
  94. package/docs/documents.md +5 -4
  95. package/docs/embeddings.md +112 -0
  96. package/docs/enterprise-postgres-state.md +7 -7
  97. package/docs/evaluations.md +8 -8
  98. package/docs/extensions.md +3 -3
  99. package/docs/forge-integration.md +3 -3
  100. package/docs/graft.md +2 -2
  101. package/docs/guardrails.md +1 -1
  102. package/docs/host-security.md +15 -15
  103. package/docs/image-generation.md +129 -0
  104. package/docs/impeccable.md +5 -3
  105. package/docs/index.md +64 -36
  106. package/docs/indexed-code-search.md +2 -2
  107. package/docs/input-and-prompt-assembly.md +1 -1
  108. package/docs/language-intelligence.md +4 -4
  109. package/docs/live-testing.md +126 -0
  110. package/docs/mcp-tools.md +43 -12
  111. package/docs/middleware-hooks.md +1 -1
  112. package/docs/migrate-to-0.4.md +3 -3
  113. package/docs/migrate-to-0.5.md +144 -0
  114. package/docs/migration.md +33 -1
  115. package/docs/model-registry.md +38 -0
  116. package/docs/model-routing.md +5 -5
  117. package/docs/moderation.md +117 -0
  118. package/docs/multi-agent-patterns.md +4 -4
  119. package/docs/multimodal-content.md +26 -2
  120. package/docs/obscura.md +2 -2
  121. package/docs/observability.md +32 -7
  122. package/docs/openapi-tools.md +13 -3
  123. package/docs/operations.md +11 -0
  124. package/docs/performance.md +7 -7
  125. package/docs/persistence-credentials-multimodality-primitives.md +6 -6
  126. package/docs/policy-and-audit.md +17 -7
  127. package/docs/ponytail.md +1 -1
  128. package/docs/postgres-persistence.md +5 -5
  129. package/docs/process-sessions.md +2 -2
  130. package/docs/prompt-registry.md +7 -7
  131. package/docs/provider-caching.md +8 -2
  132. package/docs/provider-conformance.md +23 -1
  133. package/docs/provider-packages.md +49 -17
  134. package/docs/provider-primitives.md +1 -1
  135. package/docs/provider-request-policies.md +19 -6
  136. package/docs/providers/ai-sdk.md +27 -3
  137. package/docs/providers/alibaba.md +17 -1
  138. package/docs/providers/anthropic.md +16 -0
  139. package/docs/providers/azure.md +29 -1
  140. package/docs/providers/bedrock.md +27 -0
  141. package/docs/providers/clinepass.md +16 -0
  142. package/docs/providers/commandcode.md +265 -0
  143. package/docs/providers/deepseek.md +16 -0
  144. package/docs/providers/google.md +16 -0
  145. package/docs/providers/hyper.md +296 -0
  146. package/docs/providers/kimi.md +16 -0
  147. package/docs/providers/neuralwatt.md +16 -0
  148. package/docs/providers/ollama.md +27 -0
  149. package/docs/providers/openai-compatible.md +16 -0
  150. package/docs/providers/openai.md +16 -0
  151. package/docs/providers/opencode-go.md +16 -0
  152. package/docs/providers/openrouter.md +17 -1
  153. package/docs/providers/vertex.md +28 -0
  154. package/docs/providers/xai.md +16 -0
  155. package/docs/providers/zai.md +16 -0
  156. package/docs/public-contracts.md +1 -1
  157. package/docs/rag.md +26 -4
  158. package/docs/release-and-install.md +103 -46
  159. package/docs/resource-loading.md +1 -1
  160. package/docs/runs-and-usage.md +14 -2
  161. package/docs/server.md +5 -5
  162. package/docs/settings-auth-trust-security.md +7 -5
  163. package/docs/sheets.md +2 -2
  164. package/docs/speech.md +126 -0
  165. package/docs/sqlite-persistence.md +4 -4
  166. package/docs/supervisors.md +3 -3
  167. package/docs/thinking-and-reasoning.md +99 -61
  168. package/docs/tool-conformance.md +1 -1
  169. package/docs/tool-execution-primitives.md +8 -8
  170. package/docs/tools.md +4 -4
  171. package/docs/use-case-model-selection.md +1 -1
  172. package/docs/web-tools.md +1 -1
  173. package/docs/wiki.md +1 -1
  174. package/docs/work-artifacts-and-review.md +17 -6
  175. package/docs/work-connectors.md +4 -4
  176. package/docs/work-tools.md +5 -5
  177. package/docs/workflow-orchestration-primitives.md +11 -11
  178. package/docs/workflows.md +5 -5
  179. package/package.json +11 -8
  180. package/templates/init/providers.json +24 -8
  181. package/docs/antigravity-agent.md +0 -207
package/docs/acp.md CHANGED
@@ -112,7 +112,7 @@ const agent = createPrismAcpAgent({
112
112
 
113
113
  - **Seam = capability.** Wiring `sessions.load` advertises `loadSession`; removing it withdraws the method. There is no separate capability flag to keep in sync — the freeze manifest's advertise-when matrix is enforced by construction and asserted by `scripts/phase10-conformance.test.mjs`.
114
114
  - **Transcript replay (F2).** When `sessions.transcript` is wired, `session/load` and `session/resume` replay `user_message_chunk`/`agent_message_chunk` text chunks (from `SessionEntry`s with `kind: "message"` and a user/assistant role, text blocks only) before returning `sessionState`. Each chunk passes the shared redactor and is truncated at `maxTextBytes`; replay stops at `maxReplayEvents` chunks and counts against the stream event/byte caps (an oversized transcript fails the load/resume request closed). Absent seam = no replay, behavior unchanged.
115
- - **Client fs/terminal are adapters, not a second implementation.** `AcpClientFilesystem` / `AcpClientTerminals` wrap the client's `fs/*` and `terminal/*` methods behind the Phase 9 `ProcessSession`-flavored interfaces; the agent pre-generates the session id so terminal requests can carry it. `createAcpFilesystemOperations` from `@arnilo/prism-coding-agent` maps that filesystem seam onto the coding tools' `read`/`write`/`edit` operations. This editor-buffer mode is intentionally hybrid: `repo_list`, `repo_search`, `glob`, `delete`, and `move` remain disk-backed unless the host supplies separate operations; binary/image/document handling never falls back to local disk. Host repo operations remain default when the client fs is absent.
115
+ - **Client fs/terminal are adapters, not a second implementation.** `AcpClientFilesystem` / `AcpClientTerminals` wrap the client's `fs/*` and `terminal/*` methods behind the Phase 9 `ProcessSession`-flavored interfaces; the agent pre-generates the session id so terminal requests can carry it. `createAcpFilesystemOperations` from `@arnilo/prism-coding-tools/agent` maps that filesystem seam onto the coding tools' `read`/`write`/`edit` operations. This editor-buffer mode is intentionally hybrid: `repo_list`, `repo_search`, `glob`, `delete`, and `move` remain disk-backed unless the host supplies separate operations; binary/image/document handling never falls back to local disk. Host repo operations remain default when the client fs is absent.
116
116
  - **Spawnable ACP coding registry (Task 6).** `@arnilo/prism-acp-agent` wires `createAcpClientFilesystem` and creates a separate coding tool registry per ACP session when the client advertises `fs/read_text_file` or `fs/write_text_file`. That session's `read`/`write`/`edit` operations use editor buffers; without fs advertisement, the existing disk registry is used. `shell`, repository search/list/glob, `delete`, and `move` remain disk-backed in this hybrid mode. Durable approvals resolve the same per-session agent, so one session cannot resume through another session's buffer adapter.
117
117
  - **Modes and config options are a pure host overlay.** The agent stores only a thin per-session registry; `apply`/`onChange` hooks narrow the host's own behavior. Mode switches can narrow or host-authorized widen — never a parallel policy evaluator, never a client-enabled tool.
118
118
  - **Lifecycle wiring.** Pass your `createCodingLifecycleEmitter()` as `coding.lifecycle`; `file_changed` etc. then flow to streaming sessions. `configuration_changed` broadcasts `config_option_update` (agent-message fallback if the SDK rejects the kind).
@@ -152,14 +152,14 @@ const agent = createPrismAcpAgent({
152
152
  - **Deny-closed by default.** Unknown mode ids, unadvertised methods, unprojected lifecycle events, oversize diffs/locations/media, thrown projection hooks, and failed elicitation all fail closed. Raw tool arguments/results are never sent unless a projection allow-list says otherwise.
153
153
  - **Slash commands (F9).** `commands.list` is a host-owned slash-command list (not derived from the tool registry). The agent emits `available_commands_update` on session start (`session/new`, `session/load`, `session/resume`). Mid-session refresh is not in this release — re-list by starting a session. Names, descriptions, and input hints pass the shared redactor; the list is sliced at `acpCommandsPerUpdate`. Absent seam or a thrown list ⇒ no update.
154
154
  - **Projected images (F8).** `AgUiProjection.toolResult` may return `{ type: "image", data, mimeType }` (return-type widening — existing string returns stay valid). The mapper emits `{ type: "content", content: { type: "image", data, mimeType } }` (SDK v1 `ToolCallContent` has no top-level image variant). `data` is the host-supplied base64; it is not redacted and not truncated — payloads over `acpImageBytes` are dropped. Default (no hook / non-image return) emits no image.
155
- - **Coding-tool projection (F7).** `createCodingToolProjection({ maxDiffBytes? })` is an opt-in `AgUiProjection` for first-party `@arnilo/prism-coding-agent` results: `edit` → `toolDiff` (`path` + unified `patch` as `newText`) and `toolLocations` (`path` + `firstChangedLine`); `write` and `delete` → `toolLocations` (`path` only); `move` → destination `toolLocations` (`metadata.to`, with `from` fallback). No delete/move diff is fabricated. Pass as `projection: createCodingToolProjection()` on the agent/mapper. Mapper still redacts and enforces `acpDiffBytes` / `acpLocationsPerUpdate`; optional `maxDiffBytes` pre-truncates the patch so a slightly-oversize edit is shortened instead of dropped. Without the factory, behavior is unchanged (deny-by-default).
155
+ - **Coding-tool projection (F7).** `createCodingToolProjection({ maxDiffBytes? })` is an opt-in `AgUiProjection` for first-party `@arnilo/prism-coding-tools/agent` results: `edit` → `toolDiff` (`path` + unified `patch` as `newText`) and `toolLocations` (`path` + `firstChangedLine`); `write` and `delete` → `toolLocations` (`path` only); `move` → destination `toolLocations` (`metadata.to`, with `from` fallback). No delete/move diff is fabricated. Pass as `projection: createCodingToolProjection()` on the agent/mapper. Mapper still redacts and enforces `acpDiffBytes` / `acpLocationsPerUpdate`; optional `maxDiffBytes` pre-truncates the patch so a slightly-oversize edit is shortened instead of dropped. Without the factory, behavior is unchanged (deny-by-default).
156
156
  - **No secrets.** Updates carry no raw file bodies, terminal output is capped by the Phase 9 chunk budget, and the shared redactor is applied before anything leaves the host. `permission_denied` never includes raw args.
157
157
  - **Performance.** The adapter is O(1) per update with no unbounded buffering; p95 targets (fs round trip 250 ms, mode switch 250 ms, terminal chunk ack 1000 ms, prompt first update 2000 ms, prompt end 30 s) are recorded by `scripts/benchmark-0.0.27.mjs` and gated in `scripts/budgets.json` `phase10`.
158
158
 
159
159
  ## Related APIs
160
160
 
161
161
  - [AG-UI](ag-ui.md): sibling frontend protocol; shared projection/redaction/caps and the same pending-decision model. This page is the full ACP reference.
162
- - [Coding agent tools](coding-agent-tools.md): the `CodingLifecycleEvent` source mapped here; `@arnilo/prism-coding-agent` `process.outputChunkBytes` caps terminal chunks.
162
+ - [Coding agent tools](coding-agent-tools.md): the `CodingLifecycleEvent` source mapped here; `@arnilo/prism-coding-tools/agent` `process.outputChunkBytes` caps terminal chunks.
163
163
  - [Agent events](agent-events.md): the durable `AgentEventSource`/replay story behind `session/load` and `session/resume`.
164
164
  - [Host security guide](host-security.md): fail-closed checklist rows for ACP boundaries (authorize, ownership, redaction, untrusted MCP).
165
165
  - [Migration guide](migration.md): 0.0.26 → 0.0.27 advertise/surface changes for hosts that parsed the old `initialize`.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## What it does
4
4
 
5
- This page records Prism's compatibility review against official AG-UI `@ag-ui/core` **0.0.57** and the official repository at commit [`a40b5c0`](https://github.com/ag-ui-protocol/ag-ui/commit/a40b5c0824564eb2f9ab9edf2be43f355f42a3b8). It separates shipped transport/replay support from remaining work needed to claim full AG-UI support, including AG-UI fronting MCP and A2A agents.
5
+ This page records Prism's compatibility review against official AG-UI `@ag-ui/core` **0.0.59** and the official repository at commit [`a40b5c0`](https://github.com/ag-ui-protocol/ag-ui/commit/a40b5c0824564eb2f9ab9edf2be43f355f42a3b8). It separates shipped transport/replay support from remaining work needed to claim full AG-UI support, including AG-UI fronting MCP and A2A agents.
6
6
 
7
7
  Official material reviewed:
8
8
 
package/docs/ag-ui.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  `@arnilo/prism-ag-ui` is an optional, framework-free protocol adapter over Prism's existing redacted `AgentEvent`, session, durable-run, and persistence seams.
6
6
 
7
- - Root export maps Prism events to AG-UI `@ag-ui/core` **0.0.57** events and offers `createAgUiHandler()` (`Request` → SSE `Response`), compatible `createPersistenceAgUiReplay()` pages, distributed `createAgentEventSourceAgUiReplay()` follow, and explicit `createAgUiMcpAdapter()` / `createAgUiMcpAppHandler()` / `createAgUiA2AAdapter()` protocol handshakes.
7
+ - Root export maps Prism events to AG-UI `@ag-ui/core` **0.0.59** events and offers `createAgUiHandler()` (`Request` → SSE `Response`), compatible `createPersistenceAgUiReplay()` pages, distributed `createAgentEventSourceAgUiReplay()` follow, and explicit `createAgUiMcpAdapter()` / `createAgUiMcpAppHandler()` / `createAgUiA2AAdapter()` protocol handshakes.
8
8
  - `@arnilo/prism-ag-ui/acp` is the stable ACP **v1** sibling: `createAcpEventMapper()` and `createPrismAcpAgent()` over `@agentclientprotocol/sdk` **1.3.0** root exports. ACP is a protocol adapter — sessions, modes, MCP, fs/terminal, lifecycle mapping, and caps live on the host seams. See [ACP coding-host interop](acp.md) for the full reference; this page covers AG-UI only.
9
9
  - Core remains protocol-free. `resumeAgentRunStream()` / `AgentRunLifecycle.resumeStream()` are generic durable-resume streams shared by adapters.
10
10
 
@@ -225,5 +225,4 @@ Defaults / hard caps: request 64 KiB / 1 MiB; input 128 / 1024 messages, 32 / 25
225
225
  - [MCP bridge/server](mcp-tools.md): `mcpApps` negotiation, bounded resources, and remote tool trust.
226
226
  - [A2A interoperability](a2a.md): verified rich task client and remote task lifecycle.
227
227
  - [Host security guide](host-security.md): authorization, ownership, redaction, and credential boundaries.
228
- - [Antigravity delegated agent](antigravity-agent.md): delegated Antigravity CLI execution with timeline step projection.
229
228
  - [Work artifacts and review](work-artifacts-and-review.md): durable artifact service that produces the co-work approval/progress/download-link events projected here.
@@ -224,7 +224,7 @@ Use `activateAllCapabilities: true` only while migrating old configs. It intenti
224
224
  - `ExtensionAPI.registerAgent(agent)` contributes an inert `AgentDefinition` programmatically; its `create()` (if present) is only invoked when the host runs it through `resolveAgentDefinition`. See [Extensions](extensions.md).
225
225
  - Bundle resolution is config over code: every seam lives on `AgentDefinition`, `AgentDefinitionResolutionContext`, or `ResolveAgentBundleOptions`. `systemPrompt` and `loop` are passed via `context.overrides` / `create()` rather than frontmatter.
226
226
  - Migration note: before Phase 38, a definition that omitted `tools` but had a tool scope could receive every scoped tool. Now omitted `tools`/`skills` activates none. Add explicit names to `tools` / `skills`; use `activateAllCapabilities: true` only while migrating old configs.
227
- - `parseAgentFile(text, path)` (re-exported from `@arnilo/prism`) is the stdlib-only frontmatter parser for `AGENT.md`. `parseContextFile` and `parseToolFile` parse colocated `CONTEXT.md` / tool descriptors inside the Node subpath.
227
+ - `parseAgentFile(text, path)` (re-exported from `@arnilo/prism`) is the stdlib-only frontmatter parser for `AGENT.md`. Colocated `CONTEXT.md` / tool-descriptor parsing is host-owned (the thin `parseContextFile`/`parseToolFile` helpers were removed in 0.5.0 — see `docs/migrate-to-0.5.md`).
228
228
  - Repo contributions (`<workspaceRoot>/.agents/{skills,tools}/`) are scanned by `discoverContributions` and passed via `repoContributions`. Repo `.agents/` is preserved as a shared contribution surface across every agent that operates on the same repository; multiple agents from different apps can work the same repo, and all share its repo-level skills.
229
229
 
230
230
  ## Security and performance notes
@@ -24,10 +24,10 @@ Event records preserve emission order within a run because the runtime drains pe
24
24
 
25
25
  ### Placement (FR-7 answer, 0.0.26)
26
26
 
27
- The durable `AgentEventSource` **stays in `@arnilo/prism-session-store-postgres`** for the 0.0.26 line and is importable from the package root (FR-6):
27
+ The durable `AgentEventSource` **stays in `@arnilo/prism-core/sessions/postgres`** for the 0.0.26 line and is importable from the package root (FR-6):
28
28
 
29
29
  ```ts
30
- import { createPostgresAgentEventSource } from "@arnilo/prism-session-store-postgres";
30
+ import { createPostgresAgentEventSource } from "@arnilo/prism-core/sessions/postgres";
31
31
  const source = createPostgresAgentEventSource({ pool, schema: "prism", cursorSecret });
32
32
  ```
33
33
 
@@ -35,11 +35,11 @@ PostgreSQL `LISTEN`/`NOTIFY` remains the **reference durable implementation**; `
35
35
 
36
36
  ### NATS JetStream adapter (FR-5)
37
37
 
38
- `@arnilo/prism-session-store-nats` ships a sibling durable `AgentEventSource` over NATS JetStream for JetStream backbones (Postgres remains the reference implementation):
38
+ `@arnilo/prism-core/sessions/nats` ships a sibling durable `AgentEventSource` over NATS JetStream for JetStream backbones (Postgres remains the reference implementation):
39
39
 
40
40
  ```ts
41
41
  import { connect } from "@nats-io/transport-node";
42
- import { createNatsAgentEventSource, createNatsJetStream } from "@arnilo/prism-session-store-nats";
42
+ import { createNatsAgentEventSource, createNatsJetStream } from "@arnilo/prism-core/sessions/nats";
43
43
 
44
44
  const nc = await connect({ servers: process.env.NATS_URL });
45
45
  const source = createNatsAgentEventSource({ connection: await createNatsJetStream(nc), stream: "prism_agent_events" });
@@ -249,4 +249,4 @@ for await (const event of session.stream("draft", { loop: { strategy: "generate-
249
249
  - [Observability](observability.md): `ProviderTurnMetadata`; optional adapter builds one parented GenAI span tree from metadata-only lifecycle events and ignores message/progress deltas.
250
250
  - [Tools](tools.md): `tool_execution_*` variants.
251
251
  - [Compaction and retry policies](compaction-and-retry.md): `compaction_*` and `retry_scheduled` variants.
252
- - [Frontend interoperability (AG-UI and ACP)](ag-ui.md): optional redacted mapping of this stream; durable replay is ledger-backed and at-least-once, never a live-subscriber substitute. [ACP coding-host interop](acp.md) additionally maps `CodingLifecycleEvent`s from `@arnilo/prism-coding-agent` (`file_changed`, `worktree_changed`, `permission_denied`, `configuration_changed`, `plan_changed`, `plan_removed`; process events reuse `CodingProcessEvent`) into ACP session updates — locations/diff blocks only through projection allow-lists, terminal chunks under `process.outputChunkBytes`, plan updates only to clients that advertised the UNSTABLE `plan` capability.
252
+ - [Frontend interoperability (AG-UI and ACP)](ag-ui.md): optional redacted mapping of this stream; durable replay is ledger-backed and at-least-once, never a live-subscriber substitute. [ACP coding-host interop](acp.md) additionally maps `CodingLifecycleEvent`s from `@arnilo/prism-coding-tools/agent` (`file_changed`, `worktree_changed`, `permission_denied`, `configuration_changed`, `plan_changed`, `plan_removed`; process events reuse `CodingProcessEvent`) into ACP session updates — locations/diff blocks only through projection allow-lists, terminal chunks under `process.outputChunkBytes`, plan updates only to clients that advertised the UNSTABLE `plan` capability.
@@ -87,7 +87,7 @@ await agent.createSession().run("Summarize inbox", {
87
87
 
88
88
  Server / MCP / A2A authorize callbacks may include the same `identity` beside `ownership`. Handlers assert activity and ownership match before admitting work.
89
89
 
90
- ## OIDC/JWKS verifier adapter (`@arnilo/prism-credentials-node/oidc`)
90
+ ## OIDC/JWKS verifier adapter (`@arnilo/prism-core/credentials/node/oidc`)
91
91
 
92
92
  Optional `createOidcIdentityVerifier` turns a pinned issuer/audience and pinned JWKS URL into a core `IdentityVerifier` — one bounded reference adapter for hosts that already authenticate callers with OIDC JWTs (Entra, Keycloak, Auth0, …). Native `fetch` + WebCrypto only; no JOSE dependency.
93
93
 
@@ -102,7 +102,7 @@ Optional `createOidcIdentityVerifier` turns a pinned issuer/audience and pinned
102
102
  | `limits` | Bounded JWKS/claims knobs; `identity` reuses core identity caps |
103
103
 
104
104
  ```ts
105
- import { createOidcIdentityVerifier } from "@arnilo/prism-credentials-node/oidc";
105
+ import { createOidcIdentityVerifier } from "@arnilo/prism-core/credentials/node/oidc";
106
106
 
107
107
  const verifier = createOidcIdentityVerifier({
108
108
  issuer: "https://id.example.com/tenant",
@@ -132,6 +132,17 @@ Identity is optional. Hosts that only set `ownership` keep prior behavior. When
132
132
  - Checks are O(fields) and network-free in core; remote auth stays in the host verifier.
133
133
  - Raising hard caps requires updating `docs/_evidence/review-coverage-2026-07-23-phase-8.md`, tests, and docs.
134
134
 
135
+ ## Live probe (plans/064 Task 9)
136
+
137
+ The OIDC/JWKS identity verifier has an operator-gated live probe against a real issuer:
138
+
139
+ ```bash
140
+ PRISM_TEST_OIDC_ISSUER=https://id.example.com/tenant PRISM_TEST_OIDC_AUDIENCE=prism-api \
141
+ PRISM_TEST_OIDC_TOKEN=<real bearer token> npm test -w @arnilo/prism-core -- oidc-live
142
+ ```
143
+
144
+ Set `PRISM_TEST_OIDC_JWKS_URL` to pin a non-default JWKS URL (default `<issuer>/.well-known/jwks.json`). Probes: a valid token verifies against the live JWKS (1 fetch), a tampered token fails closed with `ERR_PRISM_OIDC_SIGNATURE` (error text never echoes the token), and a garbage token fails closed without JWKS traffic. Bounded to 1 real request. Registered in `scripts/live-matrix.json` as `core/oidc-live`.
145
+
135
146
  ## Related APIs
136
147
 
137
148
  - [Policy and audit](policy-and-audit.md)
@@ -49,7 +49,7 @@ string | Message | readonly Message[]
49
49
 
50
50
  `AgentConfig.limits` sets run ceilings; `RunOptions.limits` may only narrow configured agent values. Limits cover turns, provider attempts, tool rounds/calls, wall time, request/response bytes, tokens, and optional single-currency cost. A breach emits one `run_limit_exceeded` event and throws `AgentRunError` with `result.limit`; see [Runs and usage ledger](runs-and-usage.md#run-limits).
51
51
 
52
- `RunOptions.model` can override the request model for a run. Model overrides append a `model_change` entry. `AgentConfig.inputLayout` selects the default input assembly layout (`"cache_aware"` by default, or opt-in `"legacy"`); `RunOptions.inputLayout` wins for one run. `AgentConfig.providerOptions`/`RunOptions.providerOptions` supply generic provider request options (session/cache/header/compat/extra hints only — provider-level timeout/retry hints were removed in 0.1.5). Use `RunOptions.signal`/host abort controllers for timeouts and `AgentConfig.retry`/`RunOptions.retry` for retry. `AgentConfig.providerRequestPolicies`/`RunOptions.providerRequestPolicies` run before `AIProvider.generate()` and before `provider_request` middleware. `AgentConfig.systemPrompt` and `RunOptions.systemPrompt` add explicit layered system prompt contributions; `RunOptions.systemPrompt: false` disables configured prompt layers for that run while keeping `AgentConfig.instructions` as the base path. `RunOptions.compaction` can enable auto-compaction for that run or use `false` to disable configured auto-compaction. `RunOptions.retry` can enable provider-turn retry for that run or use `false` to disable configured retry. `RunOptions.metadata` is merged with agent/session metadata for assembly, provider requests, and tool contexts. Run tool-round limits via `RunOptions.limits.maxToolRounds`. `RunOptions.signal` is bridged into the per-run abort signal passed to assembly, providers, tools, auto-compaction, and retry backoff.
52
+ `RunOptions.model` can override the request model for a run. Model overrides append a `model_change` entry. `AgentConfig.inputLayout` selects the default input assembly layout (`"cache_aware"` by default, or opt-in `"legacy"`); `RunOptions.inputLayout` wins for one run. `AgentConfig.thinkingLevel` / `RunOptions.thinkingLevel` (run wins) is the session thinking intent — Prism snaps it onto the request after host `providerOptions`. `AgentConfig.providerOptions`/`RunOptions.providerOptions` supply generic provider request options (session/cache/header/compat/extra hints only — provider-level timeout/retry hints were removed in 0.1.5). Kernel construction always stamps `options.sessionId`/`cacheKey` from `session.id` when missing; `createSessionCachePolicy` is an overlay, not required. Use `RunOptions.signal`/host abort controllers for timeouts and `AgentConfig.retry`/`RunOptions.retry` for retry. `AgentConfig.providerRequestPolicies`/`RunOptions.providerRequestPolicies` run before `AIProvider.generate()` and before `provider_request` middleware. `AgentConfig.systemPrompt` and `RunOptions.systemPrompt` add explicit layered system prompt contributions; `RunOptions.systemPrompt: false` disables configured prompt layers for that run while keeping `AgentConfig.instructions` as the base path. `RunOptions.compaction` can enable auto-compaction for that run or use `false` to disable configured auto-compaction. `RunOptions.retry` can enable provider-turn retry for that run or use `false` to disable configured retry. `RunOptions.metadata` is merged with agent/session metadata for assembly, provider requests, and tool contexts. Run tool-round limits via `RunOptions.limits.maxToolRounds`. `RunOptions.signal` is bridged into the per-run abort signal passed to assembly, providers, tools, auto-compaction, and retry backoff.
53
53
 
54
54
  `RunOptions.activeSkills` selects named skills from a configured `SkillRegistry`; `RunOptions.skills` replaces a plain `Skill[]` config for one run. When `AgentConfig.skills` is a registry and neither is set, **no skills activate** unless `activateAllSkills: true` (run or agent). `skillsDisclosure` (`"progressive"` default, `"eager"` opt-in; run wins) controls catalog vs full instruction bodies; the session-owned `LoadedSkillSet` is populated by `load_skill` when the host registers `createLoadSkillTool`. `toolResultFold` (off unless the host supplies `summarize`) optionally folds aged large tool results in provider input only. See [Context and skills](context-and-skills.md).
55
55
 
@@ -117,6 +117,7 @@ const agent = createAgent({
117
117
  provider: createMockProvider([providerTextDelta("Hello"), providerDone()]),
118
118
  tools: [echo],
119
119
  store,
120
+ thinkingLevel: "low",
120
121
  });
121
122
 
122
123
  const session = agent.createSession({ id: "s1" });
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## What it does
4
4
 
5
- `@arnilo/prism-policy` exports tenant-scoped audit records as signed, hash-chained
5
+ `@arnilo/prism-core/governance/policy` exports tenant-scoped audit records as signed, hash-chained
6
6
  batches: each record envelope is canonicalized (RFC 8785 semantics), hashed with
7
7
  SHA-256 including the prior digest, so records form a tamper-evident chain. A
8
8
  batch of chained records is wrapped in a manifest that a host-provided
@@ -69,7 +69,7 @@ canonical `record` payload. `verifyAuditBatch` returns `{ ok, errors, batch }`.
69
69
  ## Request/response example
70
70
 
71
71
  ```ts
72
- import { createAuditExporter, createMemoryAuditCursorStore } from "@arnilo/prism-policy";
72
+ import { createAuditExporter, createMemoryAuditCursorStore } from "@arnilo/prism-core/governance/policy";
73
73
 
74
74
  const exporter = createAuditExporter({
75
75
  source, // host: tenant-scoped record pages
@@ -87,7 +87,7 @@ const result = await exporter.exportNext({ tenantId: "acme", maxRecords: 1000 })
87
87
 
88
88
  ```ts
89
89
  import { readFileSync } from "node:fs";
90
- import { verifyAuditBatch } from "@arnilo/prism-policy";
90
+ import { verifyAuditBatch } from "@arnilo/prism-core/governance/policy";
91
91
 
92
92
  const artifactBytes = new Uint8Array(readFileSync("./acme-000001.json"));
93
93
  const verified = verifyAuditBatch({
@@ -0,0 +1,120 @@
1
+ # Batch jobs
2
+
3
+ ## What it does
4
+
5
+ `BatchJobsProvider` is the provider-neutral async batch contract (plan 061
6
+ Task 7): `submit` (requests + metadata → opaque job id), `status`, `cancel`, and
7
+ paged `results`, with a typed job-state union and a `pollBatch` backoff utility
8
+ exported standalone — core never loops or awaits completion for you. The
9
+ first-party adapter is [`createOpenAIBatchJobsProvider`](providers/openai.md)
10
+ (Files API JSONL upload + `/v1/batches` lifecycle). Offline conformance runs via
11
+ `runBatchJobsConformance` from `@arnilo/prism/testing/provider-conformance`.
12
+
13
+ ## When to use it
14
+
15
+ Use it for large asynchronous workloads that tolerate 24-hour completion
16
+ windows — offline scoring, backfills, bulk classification. Do not use it as a
17
+ scheduler or an orchestration saga: the contract is standalone by decision
18
+ (integration with the workflows saga is deferred — see plan 061 Further
19
+ Actions). Interactive low-latency requests belong on the normal provider path.
20
+
21
+ ## Inputs / request
22
+
23
+ | Call | Inputs | Meaning |
24
+ | --- | --- | --- |
25
+ | `submit` | `{ model, requests, metadata? }` | `requests` are provider-native `{ customId?, body: JsonObject }` items; bodies are opaque to the contract and inherit provider caps. |
26
+ | `status` | opaque job id | Current `BatchJob` snapshot (state union + provider counts + `raw`). |
27
+ | `cancel` | opaque job id | Best-effort cancellation; returns the transitioning job (`cancelling`). |
28
+ | `results` | job id + `{ cursor?, pageSize? }` | Page of per-request outcomes; cursor is an opaque continuation token. |
29
+ | `pollBatch` | provider + job id + `{ intervalMs?, backoffMultiplier?, maxIntervalMs?, maxAttempts? }` | Utility only — resolves on `completed`, throws typed on `failed`/`cancelled`/`expired`. |
30
+
31
+ Adapter options: `apiKey` (`CredentialValueSource` — resolved per call,
32
+ redacted from errors), `baseUrl`, `fetch` (fake transport for offline tests),
33
+ `headers`, `endpoint` (defaults to `/v1/chat/completions`),
34
+ `completionWindow` (defaults `24h`).
35
+
36
+ ## Outputs / response / events
37
+
38
+ | Field | Type | Meaning |
39
+ | --- | --- | --- |
40
+ | `job.state` | `"queued" \| "running" \| "cancelling" \| "completed" \| "failed" \| "cancelled" \| "expired"` | Neutral union; adapters map provider states (OpenAI `validating`→`queued`, `in_progress`/`finalizing`→`running`, …). `isBatchJobTerminal` classifies. |
41
+ | `job.id` | `string` | Opaque provider id — the contract never parses or scopes it. |
42
+ | `job.requestCounts` | `{ total, completed, failed }?` | Provider progress counts. |
43
+ | `job.raw` | `JsonObject?` | Provider-native job fields, unmodified, for audits. |
44
+ | `result.items[n]` | `{ customId, response?, error?, raw? }` | Per-request outcome; per-item failures ride alongside a `completed` job. |
45
+
46
+ Failures throw `BatchJobsError` with a stable `code`: `empty_requests`,
47
+ `too_many_requests` (adapter cap `OPENAI_BATCH_MAX_REQUESTS` = 50,000, OpenAI's
48
+ documented limit), `unsupported_model` (via `assertBatchJobsSupported` when the
49
+ host checks `ModelCapabilities.batchJobs`), `job_not_found`, `invalid_cursor`,
50
+ `request_failed` (non-2xx, secret-redacted), `response_malformed`, and — from
51
+ `pollBatch` on terminal states — `job_failed`, `job_cancelled`, `job_expired`.
52
+
53
+ ## Request/response example
54
+
55
+ ```json
56
+ { "input_file_id": "file-X123", "endpoint": "/v1/chat/completions", "completion_window": "24h" }
57
+ ```
58
+
59
+ ## Implementation example
60
+
61
+ ```ts
62
+ import { createOpenAIBatchJobsProvider } from "@arnilo/prism-providers/openai";
63
+ import { pollBatch, runBatchJobsConformance } from "@arnilo/prism";
64
+ import { runBatchJobsConformance } from "@arnilo/prism/testing/provider-conformance";
65
+
66
+ const batch = createOpenAIBatchJobsProvider({ apiKey: process.env.OPENAI_API_KEY });
67
+ const job = await batch.submit({
68
+ model: "gpt-4o-mini",
69
+ requests: [{ customId: "doc-1", body: { messages: [{ role: "user", content: "summarize" }] } }],
70
+ });
71
+ // pollBatch is a plain utility — host owns scheduling and persistence:
72
+ const done = await pollBatch(batch, job.id, { intervalMs: 30_000, backoffMultiplier: 1.5, maxIntervalMs: 300_000 });
73
+ let cursor: string | null | undefined = null;
74
+ do {
75
+ const page = await batch.results(done.id, { cursor });
76
+ for (const item of page.items) { /* host owns per-item handling */ }
77
+ cursor = page.nextCursor ?? null;
78
+ } while (cursor !== null);
79
+
80
+ // Offline conformance (fake transport, no network):
81
+ await runBatchJobsConformance({
82
+ provider: createOpenAIBatchJobsProvider({ apiKey: "sk-test", fetch: fakeFetch }),
83
+ maxRequests: 50_000,
84
+ sample: { model: "gpt-4o-mini", requests: [{ body: { messages: [] } }] },
85
+ });
86
+ ```
87
+
88
+ ## Extension and configuration notes
89
+
90
+ - Implement `BatchJobsProvider` for other vendors; the contract is structural —
91
+ no base class, no registry. Map your provider's states onto the neutral union
92
+ and surface your raw job payload on `job.raw`.
93
+ - Models declare support with `capabilities.batchJobs`; hosts gate with
94
+ `modelSupportsBatchJobs` / `assertBatchJobsSupported`, mirroring the
95
+ embeddings/speech/image/video/moderation guard pattern.
96
+ - Workflow-saga integration (auto-submission from run failure recovery) is
97
+ intentionally out of scope for v1 — see plan 061 Further Actions.
98
+
99
+ ## Security and performance notes
100
+
101
+ - Job ids are opaque strings; results cursors are opaque continuation tokens
102
+ (adapter: line offsets — never parsed as authorization).
103
+ - API keys resolve through the existing `CredentialValueSource` seam and are
104
+ redacted from every thrown error; no new secret paths.
105
+ - All responses read through the bounded readers
106
+ (`OPENAI_BATCH_MAX_RESPONSE_BYTES`, 256 MiB for JSONL downloads — batches are
107
+ large by design); oversized payloads reject instead of buffering.
108
+ - One provider request per call; paging is client-side over the downloaded
109
+ output/error file — no network per page boundary.
110
+ - Inputs, payloads, and raw files are never logged by core; error messages
111
+ carry status and a redacted body only.
112
+
113
+ ## Related APIs
114
+
115
+ - [Provider conformance](provider-conformance.md): `runBatchJobsConformance`
116
+ and the offline conformance matrix.
117
+ - [Provider packages](provider-packages.md): subpath import rules for
118
+ `@arnilo/prism-providers/openai`.
119
+ - [Multimodal content](multimodal-content.md): sibling one-shot modality
120
+ contracts sharing the same capability-flag and guard pattern.
package/docs/cli-rpc.md CHANGED
@@ -4,14 +4,25 @@
4
4
 
5
5
  The `prism` bin is a thin adapter over `AgentSession` plus a tiny project scaffold:
6
6
 
7
- - `prism -p "prompt"`: print assistant text deltas.
8
- - `prism --mode json -p "prompt"`: write one normalized event envelope per line.
9
- - `prism --mode rpc`: read LF-delimited JSON requests from stdin and write correlated JSON responses/events to stdout.
7
+ - `prism --provider <id> -p "prompt"`: print assistant text deltas. Provider ids come from the init provider catalog (`templates/init/providers.json`); `mock` is built in, real providers are dynamically imported from their `@arnilo/prism-providers/*` package (must be installed) and read their credential from the catalog's env var. Without `--provider` the CLI fails with a usage error.
8
+ - `prism --mode json --provider <id> -p "prompt"`: write one normalized event envelope per line.
9
+ - `prism --mode rpc --provider <id>`: read LF-delimited JSON requests from stdin and write correlated JSON responses/events to stdout.
10
10
  - `prism init <dir>`: create a minimal TypeScript project with one selected provider, `.env.example`, and one offline mock test.
11
- - `prism dev`: boot the loopback dev inspector over the scaffolded agent (delegates into `@arnilo/prism-dev` when resolvable; plan 040 Task 4).
11
+ - `prism dev`: boot the loopback dev inspector over the scaffolded agent (delegates into `@arnilo/prism-coding-tools/dev` when resolvable; plan 040 Task 4).
12
12
 
13
13
  It does not add a TUI, app tools, provider globals, extension discovery, resource discovery, or credential storage. `init` uses Node standard-library filesystem APIs and checked-in templates only — no interactive prompts or template-engine dependency.
14
14
 
15
+ ## Live CLI journey (plans/064 Task 5)
16
+
17
+ An env-gated e2e journey drives the packed `prism` bin end to end — `init` scaffold (generated offline test passes), `providers add` scaffold, and print/json/rpc modes over a real provider wire with a full-transcript secret scan:
18
+
19
+ ```bash
20
+ PRISM_LIVE_PROVIDER_TESTS=1 OPENAI_API_KEY=sk-... \
21
+ node --test scripts/e2e-cli-live.test.mjs
22
+ ```
23
+
24
+ The provider is the first init-catalog entry whose credential env var is present; override with `PRISM_LIVE_CLI_PROVIDER=<id>`. Wire legs skip (never fail) when the provider rejects the credential (401/403) — refresh the key and rerun. Registered in `scripts/live-matrix.json` as `cli/journey`.
25
+
15
26
  ## When to use it
16
27
 
17
28
  Use the CLI for terminal smoke tests, scriptable JSON event streams, simple non-Node clients that can speak newline-delimited JSON, and bootstrapping a tiny host project with `prism init`.
@@ -32,12 +43,12 @@ prism init <dir> [--template <name>] [--list-templates] [--provider <name>] [--w
32
43
  | `--template <name>` | Template starter name (`init` [default], `deep-research`). |
33
44
  | `--list-templates` | List available starter templates from the templates gallery. |
34
45
  | `--provider <name>` | `mock` (default), `openai`, `openrouter`, `kimi`, `zai`, `opencode-go`, or `neuralwatt`. |
35
- | `--with-workflows` | Add `@arnilo/prism-workflows` and `src/workflows-example.ts`. |
36
- | `--with-evals` | Add `@arnilo/prism-evals` and `src/evals-example.ts`. |
46
+ | `--with-workflows` | Add `@arnilo/prism-core/runtime/workflows` and `src/workflows-example.ts`. |
47
+ | `--with-evals` | Add `@arnilo/prism-core/governance/evals` and `src/evals-example.ts`. |
37
48
  | `--force` | Overwrite generated files when the destination already exists. |
38
49
  | `-h`, `--help` | Print init usage. |
39
50
 
40
- Default generation (`init` template) installs only `@arnilo/prism` (mock provider). Selecting a real provider adds exactly one dependency: the `@arnilo/prism-providers` family package (the selected adapter imports from `@arnilo/prism-providers/<id>`). Specifying `--template deep-research` scaffolds a flagship deep research agent pipeline (`@arnilo/prism`, `@arnilo/prism-web-tools`, `@arnilo/prism-rag`, `@arnilo/prism-workflows`) with planning, attributable citations, bounded refine loops, and HITL decision clarification. Rerunning without `--force` refuses non-empty destinations and existing generated files. `.env.example` contains placeholders only; `.gitignore` excludes `.env` and local stores.
51
+ Default generation (`init` template) installs only `@arnilo/prism` (mock provider). Selecting a real provider adds exactly one dependency: the `@arnilo/prism-providers` family package (the selected adapter imports from `@arnilo/prism-providers/<id>`). Specifying `--template deep-research` scaffolds a flagship deep research agent pipeline (`@arnilo/prism`, `@arnilo/prism-web-tools`, `@arnilo/prism-memory/rag`, `@arnilo/prism-core/runtime/workflows`) with planning, attributable citations, bounded refine loops, and HITL decision clarification. Rerunning without `--force` refuses non-empty destinations and existing generated files. `.env.example` contains placeholders only; `.gitignore` excludes `.env` and local stores.
41
52
 
42
53
 
43
54
  ### `prism providers add` (0.1.7)
@@ -78,7 +89,7 @@ stub with docs-verified values before publishing.
78
89
  prism dev [--port <n>] [--host <addr>]
79
90
  ```
80
91
 
81
- Runs the local dev inspector over the current `prism init` scaffold's agent. Delegation, not duplication: the subcommand resolves `@arnilo/prism-dev` from the project's own `node_modules` (falling back to the CLI's own installation) and hands over to its `runDevCli` entry; unresolvable → install hint, exit `2`.
92
+ Runs the local dev inspector over the current `prism init` scaffold's agent. Delegation, not duplication: the subcommand resolves `@arnilo/prism-coding-tools/dev` from the project's own `node_modules` (falling back to the CLI's own installation) and hands over to its `runDevCli` entry; unresolvable → install hint, exit `2`.
82
93
 
83
94
  | Flag / arg | Purpose |
84
95
  | --- | --- |
@@ -222,7 +233,7 @@ CLI/RPC are adapters over `AgentSession`. They do not scan packages, import exte
222
233
 
223
234
  RPC `command` executes only explicitly registered `CommandDefinition` values. `setModel` stores a model override for later prompt/follow-up calls. `compact`, `switchSession`, `forkSession`, `cloneSession`, and `checkout` call the existing session APIs.
224
235
 
225
- Optional workflow control (from `@arnilo/prism-workflows`) registers `workflow.start`, `workflow.enqueue`, `workflow.replay`, `workflow.status`, `workflow.list`, `workflow.cancel`, and `workflow.resume` via `createWorkflowCommands({ workflows, checkpoints, runOptions? })`. Supplying an ownership-scoped `schedules` service additionally registers `schedule.create`, `schedule.list`, `schedule.pause`, `schedule.resume`, `schedule.trigger`, and `schedule.delete`. Pass the returned `CommandDefinition[]` into `runRpcServer({ commands })` the same way as observational-memory commands. Cancel aborts in-process runs through the package active-run registry; orphaned durable checkpoints still marked `running` are fail-closed to `aborted`.
236
+ Optional workflow control (from `@arnilo/prism-core/runtime/workflows`) registers `workflow.start`, `workflow.enqueue`, `workflow.replay`, `workflow.status`, `workflow.list`, `workflow.cancel`, and `workflow.resume` via `createWorkflowCommands({ workflows, checkpoints, runOptions? })`. Supplying an ownership-scoped `schedules` service additionally registers `schedule.create`, `schedule.list`, `schedule.pause`, `schedule.resume`, `schedule.trigger`, and `schedule.delete`. Pass the returned `CommandDefinition[]` into `runRpcServer({ commands })` the same way as observational-memory commands. Cancel aborts in-process runs through the package active-run registry; orphaned durable checkpoints still marked `running` are fail-closed to `aborted`.
226
237
 
227
238
  Suspended workflow resume parameters are `{ workflowId, runId, decision: "approve" | "deny", input?, expectedVersion, ownership? }`. Read `expectedVersion` from `workflow.status`/`workflow.list`; stale or duplicate decisions fail checkpoint CAS before node execution. Ordinary recovery resume for failed/aborted runs remains backward-compatible without decision fields.
228
239
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## What it does
4
4
 
5
- `@arnilo/prism-coding-agent` is an optional first-party package that provides host shell/filesystem/repository tools as Prism `ToolDefinition` objects. It ships nine default coding tools — `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`, `glob`, `delete`, `move` — plus opt-in structured Git/check set (`createGitTools`), opt-in `createAskUserDecisionTool({ ask })`, and bounded coding-plan/checkpoint helpers. The tools are **inert** until a host imports them and registers them into a `ToolRegistry`. Hosts may register any subset, omit aggregators entirely, or mix first-party tools with host-owned `ToolDefinition`s. Behavior for shell/read/write/edit is a behavioral port of the pi coding agent's tools, adapted to Prism's `ToolDefinition` / `ToolResult` contracts (no `@earendil-works/*` or `typebox` dependencies; only `diff` plus the Node standard library). List/search/glob/Git are native Prism tools with no picomatch/ripgrep/Git-library dependency (hand-rolled `*`/`?`/`**` glob matcher).
5
+ `@arnilo/prism-coding-tools/agent` is an optional first-party package that provides host shell/filesystem/repository tools as Prism `ToolDefinition` objects. It ships nine default coding tools — `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`, `glob`, `delete`, `move` — plus opt-in structured Git/check set (`createGitTools`), opt-in `createAskUserDecisionTool({ ask })`, and bounded coding-plan/checkpoint helpers. The tools are **inert** until a host imports them and registers them into a `ToolRegistry`. Hosts may register any subset, omit aggregators entirely, or mix first-party tools with host-owned `ToolDefinition`s. Behavior for shell/read/write/edit is a behavioral port of the pi coding agent's tools, adapted to Prism's `ToolDefinition` / `ToolResult` contracts (no `@earendil-works/*` or `typebox` dependencies; only `diff` plus the Node standard library). List/search/glob/Git are native Prism tools with no picomatch/ripgrep/Git-library dependency (hand-rolled `*`/`?`/`**` glob matcher).
6
6
 
7
7
  | Export | Purpose |
8
8
  | --- | --- |
@@ -44,7 +44,7 @@ Each factory returns a plain `ToolDefinition` (no auto-registration). Register w
44
44
 
45
45
  ```ts
46
46
  import { createToolRegistry } from "@arnilo/prism";
47
- import { createCodingTools } from "@arnilo/prism-coding-agent";
47
+ import { createCodingTools } from "@arnilo/prism-coding-tools/agent";
48
48
 
49
49
  const tools = createToolRegistry(createCodingTools(process.cwd()));
50
50
  ```
@@ -56,7 +56,7 @@ Every tool carries an explicit `kind` (`shell`→`execute`, `read`/`repo_list`
56
56
  `createAcpFilesystemOperations` adapts any client with `readTextFile({ path, line?, limit? })` and `writeTextFile({ path, content })` methods to the `ReadOperations`, `WriteOperations`, and `EditOperations` seams. All reads and writes stay client-backed; `mkdir` is a no-op, `statFile` measures a bounded UTF-8 text read, and image MIME detection is always `null`.
57
57
 
58
58
  ```ts
59
- import { createAcpFilesystemOperations, createCodingTools } from "@arnilo/prism-coding-agent";
59
+ import { createAcpFilesystemOperations, createCodingTools } from "@arnilo/prism-coding-tools/agent";
60
60
 
61
61
  const operations = createAcpFilesystemOperations(clientFilesystem);
62
62
  const tools = createCodingTools(cwd, {
@@ -72,11 +72,11 @@ This is an editor-buffer adapter, not a repository backend: `repo_list`, `repo_s
72
72
 
73
73
  Use this package when a host wants ready-made coding tools for an agent, session, or run, registered explicitly into a `ToolRegistry` and dispatched through the normal Prism tool harness. The tools perform **real** shell and filesystem operations on the host — they are not mocked or sandboxed. Use the individual factories when you need per-tool options or custom operation backends; use the aggregators when you want the default set.
74
74
 
75
- Do not use this package as a sandbox, permission policy, secret store, or provider loop. Prism gates tool dispatch with `PermissionPolicy` / `ToolValidator` / trust policies; pass an optional `ExecutionPolicy` (for example from `@arnilo/prism-coding-security`) for path/command approval before side effects. Do not register these tools for an untrusted provider.
75
+ Do not use this package as a sandbox, permission policy, secret store, or provider loop. Prism gates tool dispatch with `PermissionPolicy` / `ToolValidator` / trust policies; pass an optional `ExecutionPolicy` (for example from `@arnilo/prism-coding-tools/security`) for path/command approval before side effects. Do not register these tools for an untrusted provider.
76
76
 
77
77
  ```ts
78
- import { createCodingTools } from "@arnilo/prism-coding-agent";
79
- import { createCodingApprovalPolicy } from "@arnilo/prism-coding-security";
78
+ import { createCodingTools } from "@arnilo/prism-coding-tools/agent";
79
+ import { createCodingApprovalPolicy } from "@arnilo/prism-coding-tools/security";
80
80
 
81
81
  const tools = createCodingTools(workspaceRoot, {
82
82
  executionPolicy: createCodingApprovalPolicy({
@@ -88,7 +88,7 @@ const tools = createCodingTools(workspaceRoot, {
88
88
 
89
89
  ### pi name mapping
90
90
 
91
- | Prism (`@arnilo/prism-coding-agent`) | pi coding agent |
91
+ | Prism (`@arnilo/prism-coding-tools/agent`) | pi coding agent |
92
92
  | --- | --- |
93
93
  | `shell` | `bash` |
94
94
  | `read` | `read` |
@@ -180,7 +180,7 @@ Read a text or image file.
180
180
  | `executionPolicy` | — | Structured pre-execution policy (see [Coding security](coding-security.md)). |
181
181
 
182
182
  ```ts
183
- import { createReadTool, DEFAULT_MAX_IMAGE_BYTES } from "@arnilo/prism-coding-agent";
183
+ import { createReadTool, DEFAULT_MAX_IMAGE_BYTES } from "@arnilo/prism-coding-tools/agent";
184
184
 
185
185
  const read = createReadTool(cwd, {
186
186
  maxImageBytes: DEFAULT_MAX_IMAGE_BYTES,
@@ -229,7 +229,7 @@ Default local `writeFile` uses same-directory temp + `rename` so a crash mid-wri
229
229
  Hosts may opt in to a session-scoped soft guard: share one `createReadPathSet()` across `read` / `write` / `edit` and set `requireReadBeforeWrite: true` on write/edit options. Successful `read` marks the path; unread existing-file writes/edits fail with a clear error unless `force: true`. Default is **off** (no behavior change for hosts that ignore it).
230
230
 
231
231
  ```ts
232
- import { createReadPathSet, createReadTool, createWriteTool, createEditTool } from "@arnilo/prism-coding-agent";
232
+ import { createReadPathSet, createReadTool, createWriteTool, createEditTool } from "@arnilo/prism-coding-tools/agent";
233
233
 
234
234
  const readPaths = createReadPathSet();
235
235
  const read = createReadTool(cwd, { readPathSet: readPaths });
@@ -240,7 +240,7 @@ const edit = createEditTool(cwd, { requireReadBeforeWrite: true, readPathSet: re
240
240
  Since 0.1.3 (plan 015 Task 4) hosts may opt in to persisting the set across restarts via the host-owned `CheckpointStore`:
241
241
 
242
242
  ```ts
243
- import { createReadPathSet, createReadPathSetPersistence } from "@arnilo/prism-coding-agent";
243
+ import { createReadPathSet, createReadPathSetPersistence } from "@arnilo/prism-coding-tools/agent";
244
244
 
245
245
  const readPaths = createReadPathSet();
246
246
  const persistence = createReadPathSetPersistence({ checkpoints, key: sessionId, ownership });
@@ -287,7 +287,7 @@ List repository entries with deterministic relative paths. Uses Node `opendir`/`
287
287
  - **Security:** `.git` internals never listed; paths re-checked against the workspace root; symlink escapes match native fail-closed behavior.
288
288
 
289
289
  ```ts
290
- import { createCodingTools, createGitAwareRepositoryOperations } from "@arnilo/prism-coding-agent";
290
+ import { createCodingTools, createGitAwareRepositoryOperations } from "@arnilo/prism-coding-tools/agent";
291
291
 
292
292
  const operations = createGitAwareRepositoryOperations(cwd); // native fallback outside Git
293
293
  const tools = createCodingTools(cwd, { repository: { operations } });
@@ -392,7 +392,7 @@ Opt-in tools over a host-pinned Git executable (`gitPath`, default `/usr/bin/git
392
392
  | `coding_check` | Included when `checks` are declared: model selects only a name; executable/args/env are host-fixed. |
393
393
 
394
394
  ```ts
395
- import { createGitTools } from "@arnilo/prism-coding-agent";
395
+ import { createGitTools } from "@arnilo/prism-coding-tools/agent";
396
396
 
397
397
  const gitTools = createGitTools(workspaceRoot, {
398
398
  gitPath: "/usr/bin/git",
@@ -431,7 +431,7 @@ import {
431
431
  createCodingTools,
432
432
  suspendAskUserDecision,
433
433
  createAskUserDecisionResumeValidator,
434
- } from "@arnilo/prism-coding-agent";
434
+ } from "@arnilo/prism-coding-tools/agent";
435
435
 
436
436
  const tools = createToolRegistry([
437
437
  ...createCodingTools(workspaceRoot),
@@ -453,10 +453,10 @@ return suspendAskUserDecision({
453
453
 
454
454
  ### Goal → verify helper (`runCodingGoalVerify`)
455
455
 
456
- Thin composition over existing plan Markdown, named checks, workflow `suspend`/`resumeWorkflow`, and bounded PR handoff. **No Goal table / second runtime.** Peer `@arnilo/prism-workflows`. Example: `examples/coding-goal-verify.ts`.
456
+ Thin composition over existing plan Markdown, named checks, workflow `suspend`/`resumeWorkflow`, and bounded PR handoff. **No Goal table / second runtime.** Peer `@arnilo/prism-core/runtime/workflows`. Example: `examples/coding-goal-verify.ts`.
457
457
 
458
458
  ```ts
459
- import { runCodingGoalVerify } from "@arnilo/prism-coding-agent";
459
+ import { runCodingGoalVerify } from "@arnilo/prism-coding-tools/agent";
460
460
 
461
461
  const result = await runCodingGoalVerify({
462
462
  goal: "Fix the flake",
@@ -524,7 +524,7 @@ Minimal drop-in for any Prism app:
524
524
 
525
525
  ```ts
526
526
  import { createToolRegistry } from "@arnilo/prism";
527
- import { createCodingTools, createReadOnlyTools } from "@arnilo/prism-coding-agent";
527
+ import { createCodingTools, createReadOnlyTools } from "@arnilo/prism-coding-tools/agent";
528
528
 
529
529
  // Full coding set (shell + read + write + edit + repo_list + repo_search + glob + delete + move):
530
530
  const tools = createToolRegistry(createCodingTools(process.cwd()));
@@ -536,7 +536,7 @@ const ro = createToolRegistry(createReadOnlyTools(process.cwd()));
536
536
  Customizing a single tool (force bash, cap output, delegate writes to a remote backend):
537
537
 
538
538
  ```ts
539
- import { createShellTool, createWriteTool } from "@arnilo/prism-coding-agent";
539
+ import { createShellTool, createWriteTool } from "@arnilo/prism-coding-tools/agent";
540
540
 
541
541
  const shell = createShellTool("/repo", {
542
542
  shellPath: "/bin/bash",
@@ -560,11 +560,11 @@ Packed capability demo: `examples/coding-tools-capability-gaps.ts` (search modes
560
560
 
561
561
  ## Extension and configuration notes
562
562
 
563
- - **Long coding sessions.** Use `createCodingCompactionStrategy()` from optional `@arnilo/prism-compaction-llm` when history needs a bounded coding handoff. It is selected explicitly through normal `session.compact()` / agent compaction configuration, preserves raw session entries, and prioritizes file paths, patch intent, checks, plan/todo state, blockers, and verification steps. It does not read files, retain full diffs, or create a second coding runtime.
563
+ - **Long coding sessions.** Use `createCodingCompactionStrategy()` from optional `@arnilo/prism-memory/compaction/llm` when history needs a bounded coding handoff. It is selected explicitly through normal `session.compact()` / agent compaction configuration, preserves raw session entries, and prioritizes file paths, patch intent, checks, plan/todo state, blockers, and verification steps. It does not read files, retain full diffs, or create a second coding runtime.
564
564
  - **Pluggable operation backends.** Every tool accepts an `operations` seam. Custom `ReadOperations` must implement bounded `readText` plus `statFile`; custom `EditOperations` must implement `statFile`; read/write methods receive caps/signals. `BashOperations` must stream through `onData` and honor `signal`/`timeout`. Custom `RepositoryOperations` must honor depth/entry/file/match/scan/time caps and abort (including `glob`). Custom `DeleteOperations` / `MoveOperations` must honor containment and abort. A hostile custom backend can still violate its host-owned contract, so isolate it separately.
565
565
  - **Per-tool options.** `ShellToolOptions` adds `timeout` and `maxTotalOutputBytes`; `ReadToolOptions` adds `maxScanBytes` and optional `readPathSet`; `WriteToolOptions` / `EditToolOptions` add input caps plus optional `requireReadBeforeWrite` / `readPathSet` / `force`; list/search/glob accept `repository` limits and shared aggregator `ToolsOptions.repository`.
566
566
  - **Aggregator options.** `ToolsOptions` (`{ executionPolicy?, shell?, read?, write?, edit?, delete?, move?, list?, search?, glob?, repository? }`) threads each sub-object to the matching tool. `createCodingTools()`, `createAllTools()`, and `createReadOnlyTools()` apply the shared policy unless that tool has an explicit per-tool override. Full membership is nine tools; read-only is `read` + `repo_list` + `repo_search` + `glob`.
567
- - **Sandbox composition.** Prefer `@arnilo/prism-coding-security` `createSandboxCodingComposition(cwd, { workspaceMode, sandbox, ... })` (or tools-only wrappers). `workspaceMode` is required: `"sandbox"` keeps shell/read/write/edit/list/search/glob/delete/move on one disposable tree; `"host"` runs against host cwd and never claims containment. Mixed sandbox-shell + host-FS wiring throws unless `allowMixedWorkspaceWiring: true`. Same-tree Git: `createGitTools(composition.workspaceRoot, { execFile: sandbox.execFile, commitIdentity })`.
567
+ - **Sandbox composition.** Prefer `@arnilo/prism-coding-tools/security` `createSandboxCodingComposition(cwd, { workspaceMode, sandbox, ... })` (or tools-only wrappers). `workspaceMode` is required: `"sandbox"` keeps shell/read/write/edit/list/search/glob/delete/move on one disposable tree; `"host"` runs against host cwd and never claims containment. Mixed sandbox-shell + host-FS wiring throws unless `allowMixedWorkspaceWiring: true`. Same-tree Git: `createGitTools(composition.workspaceRoot, { execFile: sandbox.execFile, commitIdentity })`.
568
568
  - **`ToolsOptions`** and the per-tool option types are exported from the package barrel for host configuration.
569
569
  - No auto-discovery or manifest registration: import and register explicitly. This package registers no extensions and owns no globals (the mutation queue is a process-wide per-path map — see `ponytail:` note in the source).
570
570
 
@@ -19,8 +19,8 @@ Bounded patch-review manifests plus normalized LSP/check diagnostics for the cod
19
19
  A review is created per patch handoff. The manifest binds: repository identity (credential-free remote fingerprint + default branch + optional worktree path), `base`/`head`, the patch artifact reference (`kind`, `uri`, `sha256`, `bytes`), changed paths, diffstat, named-check summaries, and diagnostic summaries. The `digest` is SHA-256 over the canonical manifest JSON; the structural artifact input carries the manifest in `preview.review` and the patch SHA-256 as the artifact hash.
20
20
 
21
21
  ```ts
22
- import { createCodingPatchReviewManifest, assertCodingPatchAccepted } from "@arnilo/prism-coding-agent";
23
- import { createArtifactService } from "@arnilo/prism-server";
22
+ import { createCodingPatchReviewManifest, assertCodingPatchAccepted } from "@arnilo/prism-coding-tools/agent";
23
+ import { createArtifactService } from "@arnilo/prism-core/runtime/server";
24
24
 
25
25
  const { review, artifactInput } = createCodingPatchReviewManifest({
26
26
  threadId: "thread-1",
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## What it does
4
4
 
5
- `@arnilo/prism-coding-security` is an optional package that supplies structured execution policy for `@arnilo/prism-coding-agent` tools and one disposable Docker/OCI sandbox reference. It complements name-based `PermissionPolicy` at dispatch time with path/command context checked **inside** each tool before side effects, and optionally contains untrusted coding work in a host-invoked container.
5
+ `@arnilo/prism-coding-tools/security` is an optional package that supplies structured execution policy for `@arnilo/prism-coding-tools/agent` tools and one disposable Docker/OCI sandbox reference. It complements name-based `PermissionPolicy` at dispatch time with path/command context checked **inside** each tool before side effects, and optionally contains untrusted coding work in a host-invoked container.
6
6
 
7
7
  | Export | Purpose |
8
8
  | --- | --- |
@@ -43,7 +43,7 @@ Use `createEgressPolicy()` + `createAllowListEgressProxy()` when a coding agent
43
43
  `createEgressPolicy({ allow, presets })` builds a deny-all policy. Rules are exact `{ host, port, protocol }` triples — no wildcards, no CIDR, no regex. Presets (`npm-registry`, `github`) expand to explicit rule lists at construction. The policy exposes a stable SHA-256 `fingerprint` over the canonical rule set.
44
44
 
45
45
  ```ts
46
- import { createEgressPolicy, createAllowListEgressProxy } from "@arnilo/prism-coding-security";
46
+ import { createEgressPolicy, createAllowListEgressProxy } from "@arnilo/prism-coding-tools/security";
47
47
 
48
48
  const policy = createEgressPolicy({
49
49
  allow: [{ host: "api.github.com", port: 443, protocol: "https" }],
@@ -144,8 +144,8 @@ import {
144
144
  createCodingApprovalPolicy,
145
145
  createDockerSandbox,
146
146
  createSandboxCodingComposition,
147
- } from "@arnilo/prism-coding-security";
148
- import { createGitTools } from "@arnilo/prism-coding-agent";
147
+ } from "@arnilo/prism-coding-tools/security";
148
+ import { createGitTools } from "@arnilo/prism-coding-tools/agent";
149
149
 
150
150
  const policy = createCodingApprovalPolicy({
151
151
  roots: [workspaceRoot],
@@ -1,13 +1,13 @@
1
1
  # Coding workspaces
2
2
 
3
- Ownership-scoped multi-repository and worktree lifecycle (plan 026 Task 3, `@arnilo/prism-coding-agent`). A durable coding workspace correlates task/session/run identity with host repositories and linked worktrees so that resume, cleanup, artifacts, and recovery stay bounded and reconcilable.
3
+ Ownership-scoped multi-repository and worktree lifecycle (plan 026 Task 3, `@arnilo/prism-coding-tools/agent`). A durable coding workspace correlates task/session/run identity with host repositories and linked worktrees so that resume, cleanup, artifacts, and recovery stay bounded and reconcilable.
4
4
 
5
5
  The lifecycle composes existing bounded primitives only: `CheckpointStore` CAS records in a separate versioned namespace (`prism.coding-agent.workspace.v1`), `LeaseStore` fencing, and cwd-bound `GitOperations` runners. There is no clone manager, Git library, watcher, new database schema, or second task runtime.
6
6
 
7
7
  ## Activation
8
8
 
9
9
  ```ts
10
- import { createCodingWorkspaceLifecycle } from "@arnilo/prism-coding-agent";
10
+ import { createCodingWorkspaceLifecycle } from "@arnilo/prism-coding-tools/agent";
11
11
 
12
12
  const workspaces = createCodingWorkspaceLifecycle({
13
13
  checkpoints, // CheckpointStore (ownership-scoped)