@arnilo/prism 0.5.6 → 0.7.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.
- package/CHANGELOG.md +81 -5
- package/README.md +10 -10
- package/dist/agent-approval.js +7 -6
- package/dist/agent-definitions.js +1 -0
- package/dist/agent-loops.js +51 -12
- package/dist/agent-run-lifecycle.js +11 -0
- package/dist/agent-run-state.d.ts +6 -0
- package/dist/agent-run-state.js +29 -9
- package/dist/agent-session/session/assemble.js +33 -2
- package/dist/agent-session/session/persist.js +6 -2
- package/dist/agent-session/session/tool-round.js +1 -0
- package/dist/agent-session/session/types.d.ts +10 -0
- package/dist/agent-session/session.d.ts +15 -0
- package/dist/agent-session/session.js +59 -4
- package/dist/agent-tool-dispatch.js +5 -4
- package/dist/artifacts.d.ts +39 -1
- package/dist/artifacts.js +73 -0
- package/dist/attention-compiler.d.ts +121 -0
- package/dist/attention-compiler.js +479 -0
- package/dist/cli-init.js +20 -6
- package/dist/content.d.ts +3 -16
- package/dist/content.js +9 -99
- package/dist/context-budget.d.ts +32 -2
- package/dist/context-budget.js +51 -19
- package/dist/contracts-core/agent.d.ts +18 -0
- package/dist/contracts-core/agent.js +4 -1
- package/dist/contracts-core/attention.d.ts +66 -0
- package/dist/contracts-core/attention.js +2 -0
- package/dist/contracts-core/compaction.d.ts +59 -0
- package/dist/contracts-core/compaction.js +77 -1
- package/dist/contracts-core/provider.d.ts +4 -0
- package/dist/contracts-core.d.ts +1 -0
- package/dist/contracts-core.js +1 -0
- package/dist/contracts-protocol.d.ts +29 -0
- package/dist/contracts-run-state.d.ts +6 -0
- package/dist/host-composition.d.ts +78 -0
- package/dist/host-composition.js +248 -0
- package/dist/index.d.ts +11 -8
- package/dist/index.js +6 -5
- package/dist/input.d.ts +19 -1
- package/dist/input.js +52 -2
- package/dist/media-types.d.ts +34 -0
- package/dist/media-types.js +158 -0
- package/dist/pinned-fetch.d.ts +2 -2
- package/dist/pinned-fetch.js +11 -12
- package/dist/redaction.js +74 -1
- package/dist/secure-agent.d.ts +2 -0
- package/dist/secure-agent.js +6 -1
- package/dist/session-stores.d.ts +11 -0
- package/dist/session-stores.js +23 -8
- package/dist/tool-result-fold.d.ts +12 -0
- package/dist/tool-result-fold.js +13 -6
- package/dist/tools.d.ts +10 -0
- package/dist/tools.js +41 -0
- package/docs/acp-agent.md +42 -11
- package/docs/acp.md +3 -2
- package/docs/ag-ui.md +9 -5
- package/docs/agent-definitions.md +9 -1
- package/docs/agent-events.md +6 -1
- package/docs/agent-loops.md +1 -1
- package/docs/agent-session-runtime.md +9 -7
- package/docs/attention-compiler.md +272 -0
- package/docs/browser-automation.md +5 -2
- package/docs/cli-rpc.md +4 -2
- package/docs/coding-agent-tools.md +1 -1
- package/docs/coding-security.md +5 -3
- package/docs/coding-tools.md +1 -1
- package/docs/coding-workspaces.md +22 -0
- package/docs/compaction-and-retry.md +36 -4
- package/docs/compaction-observational-memory.md +62 -9
- package/docs/context-and-skills.md +4 -2
- package/docs/contributing.md +37 -0
- package/docs/conversations.md +1 -1
- package/docs/core.md +2 -0
- package/docs/dev-inspector.md +4 -0
- package/docs/device-adapters.md +1 -0
- package/docs/document-reader.md +12 -2
- package/docs/documents.md +11 -3
- package/docs/enterprise-postgres-state.md +2 -2
- package/docs/evaluations.md +168 -4
- package/docs/execution-timeline.md +180 -0
- package/docs/graft.md +3 -1
- package/docs/history/0.7.0-primitive-review.md +254 -0
- package/docs/history/migration-0.0.md +2 -2
- package/docs/history/release-handoffs.md +70 -1
- package/docs/host-compositions.md +147 -0
- package/docs/host-security.md +2 -2
- package/docs/hosted-sandboxes.md +94 -0
- package/docs/index.md +73 -41
- package/docs/input-and-prompt-assembly.md +5 -4
- package/docs/knowledge-sync.md +84 -0
- package/docs/language-intelligence.md +2 -2
- package/docs/live-testing.md +4 -1
- package/docs/mcp-tools.md +2 -1
- package/docs/memory-fabric.md +416 -0
- package/docs/migrate-to-0.5.md +8 -3
- package/docs/migrate-to-0.6.md +90 -0
- package/docs/migrate-to-0.7.md +345 -0
- package/docs/migration.md +43 -1
- package/docs/model-registry.md +1 -1
- package/docs/model-routing.md +79 -4
- package/docs/multi-agent-patterns.md +20 -6
- package/docs/multimodal-content.md +1 -1
- package/docs/obscura.md +3 -1
- package/docs/observability.md +52 -1
- package/docs/operations.md +13 -1
- package/docs/options-index.md +298 -0
- package/docs/peer-dependencies.md +96 -0
- package/docs/performance.md +34 -2
- package/docs/ponytail.md +2 -0
- package/docs/postgres-persistence.md +3 -1
- package/docs/process-sessions.md +3 -1
- package/docs/prompt-registry.md +1 -1
- package/docs/provider-caching.md +4 -2
- package/docs/provider-conformance.md +2 -2
- package/docs/provider-packages.md +23 -23
- package/docs/provider-primitives.md +2 -1
- package/docs/providers/ai-sdk.md +5 -2
- package/docs/providers/bedrock.md +71 -7
- package/docs/providers/openai.md +1 -1
- package/docs/public-contracts.md +2 -2
- package/docs/rag.md +24 -8
- package/docs/realtime-voice.md +87 -0
- package/docs/release-and-install.md +78 -56
- package/docs/runs-and-usage.md +3 -2
- package/docs/server.md +6 -4
- package/docs/session-stores.md +3 -1
- package/docs/speech.md +2 -0
- package/docs/sqlite-persistence.md +2 -0
- package/docs/supervisors.md +33 -5
- package/docs/testing.md +38 -0
- package/docs/thinking-and-reasoning.md +3 -1
- package/docs/tools.md +7 -6
- package/docs/web-tools.md +2 -1
- package/docs/wiki.md +1 -1
- package/docs/work-artifacts-and-review.md +14 -4
- package/docs/work-connectors.md +3 -1
- package/docs/work-tools.md +14 -4
- package/docs/workflows.md +69 -1
- package/docs/working-and-semantic-memory.md +25 -14
- package/package.json +5 -5
- package/templates/README.md +2 -0
- package/templates/business-worker/README.md.tmpl +19 -0
- package/templates/business-worker/env.example.tmpl +1 -0
- package/templates/business-worker/gitignore.tmpl +11 -0
- package/templates/business-worker/manifest.json +11 -0
- package/templates/business-worker/package.json.tmpl +23 -0
- package/templates/business-worker/src/agent.ts.tmpl +92 -0
- package/templates/business-worker/src/index.ts.tmpl +13 -0
- package/templates/business-worker/src/tests/agent.test.ts.tmpl +77 -0
- package/templates/business-worker/tsconfig.json.tmpl +15 -0
- package/templates/personal-assistant/README.md.tmpl +18 -0
- package/templates/personal-assistant/env.example.tmpl +1 -0
- package/templates/personal-assistant/gitignore.tmpl +11 -0
- package/templates/personal-assistant/manifest.json +11 -0
- package/templates/personal-assistant/package.json.tmpl +23 -0
- package/templates/personal-assistant/src/agent.ts.tmpl +65 -0
- package/templates/personal-assistant/src/index.ts.tmpl +13 -0
- package/templates/personal-assistant/src/tests/agent.test.ts.tmpl +28 -0
- package/templates/personal-assistant/tsconfig.json.tmpl +15 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
# Multi-agent patterns: handoff,
|
|
1
|
+
# Multi-agent patterns: handoff, crew, supervisor, spawn tool, A2A
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
Maps
|
|
5
|
+
Maps five Prism answers for "more than one agent" onto one decision table. All five compose existing seams — none introduces a new runtime:
|
|
6
6
|
|
|
7
7
|
- **In-session handoff (swarm)** — agent A transfers control of the ongoing conversation to agent B by calling a host-built `handoff` tool; the host resolves the target `AgentDefinition` with `resolveAgentDefinition` and opens the specialist against the same session (same store + session id, previous run's `leafId`). One transcript, no new session. No helper primitive ships; the tool factory lives in [`examples/handoff-swarm.ts`](../examples/handoff-swarm.ts).
|
|
8
8
|
- **Hierarchical crew** — a manager agent decomposes a goal into typed tasks (`{ tasks: [{ role, instruction }] }`) via structured output ([`Artifact*`](structured-output.md)), fans out to parallel role specialists with bounded `maxFanOut` ([`fanOutNode`](workflows.md)), aggregates deliverables with host reduce ([`joinNode`](workflows.md)), and validates outputs with conditional routing to completion or revision ([`conditionalNode`](workflows.md)). The entire process is a deterministic DAG workflow with zero new runtime primitives. Live demo in [`examples/crew-hierarchy.ts`](../examples/crew-hierarchy.ts).
|
|
9
9
|
- **Supervisor delegation** — `@arnilo/prism-core/runtime/supervisor` `delegate()` invokes allow-listed child agents as bounded runs and returns their result to the parent. Separate child transcripts, hooks, budgets, narrowing.
|
|
10
|
+
- **In-process spawn tool** — `createSpawnAgentTool({ supervisor })` gives a parent model non-exclusive sync or bounded async `spawn_agent` calls over that same host-owned supervisor catalog; `wait_agent` / `cancel_agent` join or abort local handles. It is an API adapter, not a runtime.
|
|
10
11
|
- **A2A 1.0** — cross-service interop over the JSON-RPC/HTTPS binding; the remote peer's lifecycle is host-owned behind `A2ATaskLifecycle`.
|
|
11
12
|
|
|
12
13
|
## When to use it
|
|
@@ -15,10 +16,11 @@ Maps the four Prism answers for "more than one agent" onto one decision table. A
|
|
|
15
16
|
| --- | --- | --- | --- | --- |
|
|
16
17
|
| In-session handoff | One host, one ongoing conversation; the model decides **when** to transfer; specialists are alternate definitions of the same app | One continuous transcript chain (same store, session id, `leafId`) | Same session scope; give the specialist its own identity via its definition (`AgentConfig.identity` / `RunOptions.identity`) | Attribution is per-run: each `session.run()`'s events/result belong to the active definition — record the swap in host bookkeeping; no `delegated_agent_step` event exists for in-process swaps |
|
|
17
18
|
| Hierarchical crew | A goal requires dynamic decomposition by a manager LLM, parallel execution by role specialists, host aggregation, and conditional validation/revision loop | Workflow DAG execution — each specialist executes a bounded child task session; final deliverable returns to host | Workflow tenant/ownership scopes propagate; specialists activate only their own narrowed `tools` | Workflow node events (`node_started`/`node_finished`/`agent_event`); task attribution per role in the aggregated deliverable |
|
|
18
|
-
| Supervisor delegation |
|
|
19
|
+
| Supervisor delegation | Host code dynamically selects a bounded child run | Separate runs; child result returns to the host | Parent identity/effectStore propagate; child factories receive derived resource/thread ids and AND-composed permission | Dedicated `delegation_started/finished/rejected/error` events, projectable through observability `handleDelegation()`; opt-in `delegation_child_event` passthrough |
|
|
20
|
+
| In-process spawn tool | Parent model needs an allow-listed child as a non-exclusive tool call | Separate runs; sync result returns through `spawn_agent`, async handle joins through `wait_agent` | Host owns catalog, tools, scopes, limits, and local handles; schema accepts only child ID/input/thread ID/mode | Same supervisor `delegation_*` events |
|
|
19
21
|
| A2A 1.0 | The other agent is owned by a **different service/deployment**; cross-org or cross-cluster; needs durable task lifecycle, push configs, streaming | Protocol boundary (JSON-RPC/HTTPS agent card); replay/reconnect via host-owned task adapter | Exact-origin verified client, `A2AAuthorization` per operation, principal-scoped push configs | Host-owned task adapter records the remote lifecycle; Prism creates no worker/store |
|
|
20
22
|
|
|
21
|
-
Rule of thumb: same conversation → handoff; dynamic task decomposition + parallel execution → hierarchical crew; same
|
|
23
|
+
Rule of thumb: same conversation → handoff; dynamic task decomposition + parallel execution → hierarchical crew; host-selected same-process subtask → supervisor delegation; model-requested allow-listed subtask → in-process spawn tool; different deployment/trust boundary → A2A.
|
|
22
24
|
|
|
23
25
|
## How in-session handoff works
|
|
24
26
|
|
|
@@ -138,6 +140,17 @@ Live demo: [`examples/crew-hierarchy.ts`](../examples/crew-hierarchy.ts) — man
|
|
|
138
140
|
| **Validation & Quality Review** | Conditional Node ([`conditionalNode`](workflows.md)) | Deterministic branch routing to `complete` or `revise` based on validation criteria. |
|
|
139
141
|
| **Process Revision Loop** | Node Retries / DAG Branching / Loop Node ([`loopNode`](workflows.md)) | Bounded retry/revision path or bounded in-graph loop iteration. |
|
|
140
142
|
|
|
143
|
+
## How the in-process spawn tool works
|
|
144
|
+
|
|
145
|
+
`createSpawnAgentTool({ supervisor })` exposes the host's child catalog as one non-exclusive `spawn_agent` tool, so a parent model can request children the host already allows. It is a thin adapter over [`supervisor.delegate()`](supervisors.md) — no new runtime, no discovery:
|
|
146
|
+
|
|
147
|
+
- The schema carries only `childId` (an enum of `Supervisor.childIds`), `input`, optional `threadId`, and `mode`. Unknown child IDs fail closed as standard tool errors before any delegation, and model arguments can never supply child tools, identity, scopes, or limits.
|
|
148
|
+
- Named tool calls in one tool turn run in parallel under the parent session's `toolConcurrency`, while the supervisor's reservation keeps concurrent children within `maxActiveChildren` — over-cap sync calls fail closed, async calls return handles.
|
|
149
|
+
- `mode: "async"` returns a local `{ delegationId, status: "running" }` handle; `createWaitAgentTool` joins it, `createCancelAgentTool` aborts it, and the parent run's abort propagates to running children. Handles are in-process, ownership-scoped, and do not survive host restart.
|
|
150
|
+
- Children needing repository isolation wrap their factory with `createWorktreeChildFactory` ([Coding workspaces](coding-workspaces.md#spawn-isolation-supervisor-children)); timeline visibility comes from the supervisor `delegation_*` events, optionally bridged to coding `subagent_started` / `subagent_stopped` ([Coding agent tools](coding-agent-tools.md)).
|
|
151
|
+
|
|
152
|
+
Live demo: [`examples/spawn-agent-tool.ts`](../examples/spawn-agent-tool.ts) — a narrowed read-only explore child spawned twice in parallel, an uncatalogued child refused, and both handles joined.
|
|
153
|
+
|
|
141
154
|
## Where Prism is stronger
|
|
142
155
|
|
|
143
156
|
- **Durable Human-in-the-Loop (HITL)**: Prism workflows support durable pause and resume via [`suspend()`](workflows.md#durable-suspension-and-resumption) and [`resumeWorkflow()`](workflows.md) across worker restarts or approval gates ([Agent durable approval](agent-session-runtime.md)).
|
|
@@ -149,7 +162,7 @@ Live demo: [`examples/crew-hierarchy.ts`](../examples/crew-hierarchy.ts) — man
|
|
|
149
162
|
## Security and performance notes
|
|
150
163
|
|
|
151
164
|
- **Transfers are explicit model-initiated, host-authorized.** The `handoff` tool exists on the triage agent's allow-list only; the target name is validated against the host-authored targets map before any definition resolves. Unknown names fail closed as a standard tool error (`Unknown handoff target: <name>`).
|
|
152
|
-
- **No permission escalation through handoff or
|
|
165
|
+
- **No permission escalation through handoff, delegation, or spawn.** The specialist's capabilities come solely from its own `AgentDefinition` or host-owned supervisor child factory (fail-closed for omitted capabilities). Handoff, fan-out, and spawn grant nothing: tools/identity are what the host put on that definition. The specialist cannot invoke manager tools unless its definition explicitly includes them — the standard `unknown_tool` block applies otherwise.
|
|
153
166
|
- **Narrowing on transfer, never widening.** If the specialist needs the caller's verified identity, project it through `narrowIdentity` / `assertIdentityPropagation` ([Agent identity](agent-identity.md)) so scopes and tenant cannot widen across the swap. For delegation the same discipline is built in (`narrowIdentity`, AND-composed policies); for A2A the exact-origin client plus per-operation authorization is the boundary.
|
|
154
167
|
- **Manager-generated task plans are untrusted model output.** Manager plan outputs are validated against the typed schema via `ArtifactValidator` before being persisted to workflow state or dispatched to `fan_out`. Malformed or invalid plans trigger the artifact repair loop or fail closed before any specialist is invoked.
|
|
155
168
|
- **Redaction of carried context.** Handoff carries the raw transcript by design — same rows a human replay would read. Apply the session egress seams on the way out: `redactSessionEntry` / `redactMessage` with a host field policy (see [Data classification](data-classification.md)) and `AgentConfig.redactor`; for durable replay across tenants reuse the redacted transcript seam discipline used by ACP `sessions.transcript` ([ACP interop](acp.md)).
|
|
@@ -168,7 +181,8 @@ Live demo: [`examples/crew-hierarchy.ts`](../examples/crew-hierarchy.ts) — man
|
|
|
168
181
|
- [Workflows](workflows.md): `defineWorkflow`, `fanOutNode`, `joinNode`, `conditionalNode`, `runWorkflow`.
|
|
169
182
|
- [Structured output](structured-output.md): `ArtifactParser`, `ArtifactValidator`, `generateValidateReviseLoop`.
|
|
170
183
|
- [Agent definitions](agent-definitions.md): `resolveAgentDefinition` and fail-closed capability activation — the swap seam itself.
|
|
171
|
-
- [Supervisor delegation](supervisors.md): same-process subtasks
|
|
184
|
+
- [Supervisor delegation](supervisors.md): same-process subtasks, model-facing spawn tool, budgets, hooks, and durable nested approvals.
|
|
185
|
+
- [Coding workspaces](coding-workspaces.md): per-child worktree isolation for parallel spawns.
|
|
172
186
|
- [A2A interoperability](a2a.md): the cross-service protocol boundary.
|
|
173
187
|
- [Agent identity](agent-identity.md): verified identity propagation and narrowing (`narrowIdentity`, `assertIdentityPropagation`).
|
|
174
188
|
- [Agent events](agent-events.md): `delegated_agent_step` and delegation event surfaces for timelines.
|
|
@@ -167,7 +167,7 @@ from `@arnilo/prism/testing/provider-conformance`.
|
|
|
167
167
|
## Security and performance notes
|
|
168
168
|
|
|
169
169
|
- SSRF deny-by-default blocks IPv4/IPv6 loopback, private/unique-local, link-local, unspecified, multicast, IPv4-mapped private, and cloud metadata targets. DNS answers are all classified before one public address is pinned; mixed public/private answers fail closed.
|
|
170
|
-
- `allowedHostnames` is an explicit trust override and may permit a private destination. `denyPrivateHosts: false` is broader and should be reserved for hosts that intentionally own private-network access.
|
|
170
|
+
- `allowedHostnames` is an explicit trust override and may permit a private destination. `allowedCidrs` is the range equivalent (`"10.0.0.0/8"`, `"fd00::/8"`; IPv4 + IPv6): it is checked after the hostname allow-list and the denied-name list, applies to both URL literals and resolved DNS answers, and bypasses **only** the private-IP block — `metadata.google.internal`/localhost-class names, credentials, and every literal outside the listed ranges stay denied, and a malformed entry fails the policy closed. `denyPrivateHosts: false` is broader and should be reserved for hosts that intentionally own private-network access.
|
|
171
171
|
- DNS lookup, connection, and body streaming share `fetchTimeoutMs` and caller abort; more than 32 resolved addresses, redirects, and oversized response bodies are rejected.
|
|
172
172
|
- Media URL fetches (0.2.1) route through the core `pinnedFetch` primitive — DNS-pinned resolution with per-answer SSRF checks (rebinding defense) and outright 3xx rejection — while keeping the `fetch`/`resolveHostname`/`requestUrl` host seams and the existing byte budgets.
|
|
173
173
|
- MIME validation rejects common magic-byte spoofing; extensions alone are never trusted.
|
package/docs/obscura.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Obscura browser engine
|
|
2
2
|
|
|
3
|
+
> **Optional peer install:** `playwright-core@1.63.0` (exact pin) for the CDP leg — see [Optional peer dependencies](peer-dependencies.md).
|
|
4
|
+
|
|
3
5
|
Optional `@arnilo/prism-web-tools/obscura` support for a host-installed
|
|
4
6
|
[Obscura](https://github.com/h4ckf0r0day/obscura) headless browser. Obscura is never
|
|
5
7
|
bundled — install the binary (or use the `h4ckf0r0day/obscura` Docker image) and point
|
|
@@ -99,7 +101,7 @@ await session.close(); // browser first, then the owned process
|
|
|
99
101
|
- Endpoints are loopback-only unless `allowRemoteEndpoint` is set; credentials in the
|
|
100
102
|
URL are always rejected; remote plain `ws:`/`http:` is refused (no authentication —
|
|
101
103
|
require an authenticated `wss:`/`https:` tunnel).
|
|
102
|
-
- The Playwright import is an optional exact `playwright-core@1.
|
|
104
|
+
- The Playwright import is an optional exact `playwright-core@1.63.0` peer; supply
|
|
103
105
|
`connectObscuraCdp({ playwright })` to inject a host-selected build.
|
|
104
106
|
- The returned browser composes with `createBrowserManager`/`createBrowserTools`:
|
|
105
107
|
snapshots, actions, policy, checkpoints, and artifacts are Prism-owned. Raw CDP
|
package/docs/observability.md
CHANGED
|
@@ -13,6 +13,9 @@ APIs:
|
|
|
13
13
|
- `createOpenTelemetryInstrumentation()`, `wrapOpenTelemetryApi()`, `createInMemoryTelemetry()` in `@arnilo/prism-core/governance/observability`
|
|
14
14
|
- `createRagTelemetry()` in `@arnilo/prism-core/governance/observability` (RAG spans/events; see span tree below)
|
|
15
15
|
- `handleRunFeedback()` / `handleEvaluation()` for explicit safe post-run projection
|
|
16
|
+
- `projectAgentTimeline()`, `projectTraceTimeline()`, `projectWorkflowTimeline()`, `createTimelineFolder()` — [execution timeline projection](execution-timeline.md) for host cockpits and trajectory evals
|
|
17
|
+
- `summarizeTimeline()`, `summarizeSession()` — [cockpit aggregations](#cockpit-aggregations-and-session-summaries) (bounded tool counts, token and cost rollups without double counting)
|
|
18
|
+
- `attachWorkflow()`, `handleWorkflowEvent()` on `OpenTelemetryInstrumentation` for workflow DAG spans and metrics
|
|
16
19
|
|
|
17
20
|
## When to use it
|
|
18
21
|
|
|
@@ -67,6 +70,10 @@ const telemetry = createOpenTelemetryInstrumentation({
|
|
|
67
70
|
|
|
68
71
|
const detach = telemetry.attachSession(session);
|
|
69
72
|
// or: for await (const event of session.subscribe()) telemetry.handleAgentEvent(event);
|
|
73
|
+
|
|
74
|
+
// Workflows:
|
|
75
|
+
const detachWorkflow = telemetry.attachWorkflow(eventBus);
|
|
76
|
+
// or: eventBus.subscribe((event) => telemetry.handleWorkflowEvent(event));
|
|
70
77
|
```
|
|
71
78
|
|
|
72
79
|
Set `enabled: false` or omit `tracer`/`meter` for a no-op adapter. Feedback handlers accept only `runId`, rating/score, booleans, bounded counts, and fixed status — never comment, tag values, scorer/evaluation IDs, or arbitrary metadata.
|
|
@@ -97,6 +104,14 @@ OpenTelemetry mapping (when enabled):
|
|
|
97
104
|
| `handleRunFeedback` | active-run `prism.run.feedback` event or ended-run span | `prism.run.feedback` |
|
|
98
105
|
| `handleEvaluation` | active-run `gen_ai.evaluation.result` event or ended-run span | `prism.run.evaluation` (`status`) |
|
|
99
106
|
|
|
107
|
+
Workflow mapping (when enabled via `attachWorkflow` or `handleWorkflowEvent`):
|
|
108
|
+
|
|
109
|
+
| Workflow event | Span | Metric labels |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| `workflow_started` / `workflow_finished` | `invoke_workflow {workflowId}` (`INTERNAL`) | `prism.workflow.duration` (`prism.workflow.id`, `prism.workflow.status`) |
|
|
112
|
+
| `node_started` / `node_finished` / `node_failed` / `node_skipped` | `prism.workflow.node {nodeId}` child (`INTERNAL`) | none (span attributes: `prism.node.kind`, `prism.node.status`) |
|
|
113
|
+
| `node_iteration_started` / `finished` | `prism.workflow.iteration` events on node span | none |
|
|
114
|
+
|
|
100
115
|
RAG span tree (`@arnilo/prism-memory/rag` + `createRagTelemetry()`):
|
|
101
116
|
|
|
102
117
|
| Span | Parent | Notes |
|
|
@@ -171,6 +186,41 @@ const ragTelemetry = createRagTelemetry({ tracer: memory.tracer, meter: memory.m
|
|
|
171
186
|
const found = await retrieveContext("policy", { embedder, store, scope, telemetry: ragTelemetry }); // rag_request tree
|
|
172
187
|
```
|
|
173
188
|
|
|
189
|
+
## Cockpit aggregations and session summaries
|
|
190
|
+
|
|
191
|
+
Host cockpits and dashboard cards need fast aggregate summaries of an execution without re-walking every raw event or risking prompt/secret leaks:
|
|
192
|
+
|
|
193
|
+
- `summarizeTimeline(timeline)`: rolls up an `ExecutionTimeline` into a `TimelineSummary` containing duration, turn count, tool call counts, provider attempts, total tokens, cost, error counts, and suspension state.
|
|
194
|
+
- `summarizeSession(timelines)`: rolls up an array of `ExecutionTimeline`s for a session/conversation into a `SessionSummary` with aggregated tokens, costs, run counts, and duration.
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { summarizeTimeline, summarizeSession } from "@arnilo/prism-core/governance/observability";
|
|
198
|
+
|
|
199
|
+
const summary = summarizeTimeline(timeline);
|
|
200
|
+
// summary: TimelineSummary
|
|
201
|
+
// {
|
|
202
|
+
// durationMs: 1250,
|
|
203
|
+
// turnCount: 2,
|
|
204
|
+
// toolCallCount: 3,
|
|
205
|
+
// toolCounts: { search: 2, lookup: 1 },
|
|
206
|
+
// providerAttempts: 2,
|
|
207
|
+
// usage: { totalTokens: 450, promptTokens: 300, completionTokens: 150 },
|
|
208
|
+
// cost: { amount: 0.0012, currency: "USD" },
|
|
209
|
+
// errorCount: 0,
|
|
210
|
+
// blockedToolCount: 0,
|
|
211
|
+
// suspended: false,
|
|
212
|
+
// status: "succeeded",
|
|
213
|
+
// }
|
|
214
|
+
|
|
215
|
+
const sessionSummary = summarizeSession([run1Timeline, run2Timeline]);
|
|
216
|
+
// sessionSummary: SessionSummary
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Cardinality and correctness guarantees:
|
|
220
|
+
- **Bounded cardinality**: `toolCounts` is capped to `MAX_SUMMARY_DISTINCT_TOOLS = 64` distinct tool names. If more tools are invoked, lowest-frequency tool names overflow into an `"other"` bucket.
|
|
221
|
+
- **No double counting**: Token usage is derived from the root run's `run_total` (or aggregated across `turn` / `provider` steps if no run-level total exists), avoiding double counting between provider turn steps and run totals. Costs are rounded to 6 decimal places to prevent floating-point drift.
|
|
222
|
+
- **Payload-free**: Summaries contain counts, durations, status codes, and usage metrics only — zero prompt text, tool arguments, or credentials.
|
|
223
|
+
|
|
174
224
|
## Extension and configuration notes
|
|
175
225
|
|
|
176
226
|
- Events flow through `redactAgentEvent` before subscribers and ledger writes — configure `createSecretRedactor` on the agent/run.
|
|
@@ -214,11 +264,12 @@ const entries = capture.events(); // oldest-first snapshot; capture.clear() rese
|
|
|
214
264
|
- Capture middleware follows the same default: `redact: "secrets"` drops message content; buffers are capped and secrets are redacted unconditionally, so a captured buffer can be persisted or replayed without leaking credentials.
|
|
215
265
|
- Use `identityTelemetryAttributes(identity)` when attaching enterprise identity to run metadata or OTel attributes; it emits `prism.identity.*` refs only (tenant/principal/scope counts), never credential secrets or raw tokens.
|
|
216
266
|
- Opt-in content in other event types (`message_delta`, tool `result`) is still subject to `redactAgentEvent`.
|
|
217
|
-
- Metric labels stay low-cardinality (`gen_ai.operation.name`, `gen_ai.provider.name`, token type, controlled outcome/status, feedback rating bucket/link presence); never use session/run/request/call IDs, model output, comments, tag values, scorer/evaluation IDs, or arbitrary metadata as labels. Token usage is recorded once at provider operation scope.
|
|
267
|
+
- Metric labels stay low-cardinality (`gen_ai.operation.name`, `gen_ai.provider.name`, token type, controlled outcome/status, feedback rating bucket/link presence, controlled `prism.workflow.id` names); never use session/run/request/call IDs, dynamic run IDs, model output, comments, tag values, scorer/evaluation IDs, or arbitrary metadata as labels. Token usage is recorded once at provider operation scope.
|
|
218
268
|
- Target overhead when enabled is under 5% excluding exporter I/O; disabled hooks allocate no spans.
|
|
219
269
|
- Provider transport limits and redaction order are documented in [Provider primitives](provider-primitives.md).
|
|
220
270
|
|
|
221
271
|
## Related APIs
|
|
272
|
+
- [Execution timeline](execution-timeline.md): cockpit projection — fold `AgentEvent` or `WorkflowEvent` into `ExecutionTimeline`.
|
|
222
273
|
- [Agent identity](agent-identity.md): redacted identity attribute helper for telemetry.
|
|
223
274
|
- [Evaluations](evaluations.md): optional scorers can link scores to run/session/trace IDs from agent events.
|
|
224
275
|
|
package/docs/operations.md
CHANGED
|
@@ -8,6 +8,7 @@ This page is the operator runbook for the high-availability story proven by plan
|
|
|
8
8
|
|
|
9
9
|
- Before running any multi-replica deployment of the server, workflow coordinator, saga runner, ACP host, or enterprise dispatcher — read the local-registry limitations and the lease/fence model.
|
|
10
10
|
- When an operator or on-call engineer sees a hung lease, an uncertain commit, or a split-brain suspicion: follow "Failover procedure" and "Uncertain commits" below before touching anything.
|
|
11
|
+
- When background workers share a checkpoint queue across tenants: use `admission` on `createWorkflowCoordinator` and `createPrismOperatorHandler` for inspect/cancel/reconcile. Do not add a second job broker.
|
|
11
12
|
- When sizing leases: the failover ceiling is lease TTL plus the peer's acquisition poll interval; the drill asserts `failoverMs <= ttlMs + 5000`.
|
|
12
13
|
|
|
13
14
|
## Inputs / request
|
|
@@ -94,6 +95,16 @@ tenant's reads, writes, and lease takeover all fail closed.
|
|
|
94
95
|
with bounded, jittered acquisition polls (no hot loops) and reports the
|
|
95
96
|
measured numbers in the evidence JSON.
|
|
96
97
|
|
|
98
|
+
## Fair worker admission and operator intervention
|
|
99
|
+
|
|
100
|
+
`createWorkflowCoordinator({ admission })` is still checkpoint+lease polling — not a job DSL. Each `pollOnce` walks at most `maxPagesPerPoll` list pages from a wrap cursor so a saturated first page cannot hide later tenants. `perTenant` / `perClass` cap **this worker's** concurrent claims. `deadlineMs` skips (does not auto-fail) stale `createdAt`. While `drain.isDraining`, no new claims; after `snapshot().expired`, in-flight work is aborted if the node honors the run signal. Leases are released only via the holder token — never deleted by hand.
|
|
101
|
+
|
|
102
|
+
`createPrismOperatorHandler({ authorize, checkpoints, workflows, unknownEffects? })` mounts `/ops/queue|suspended|failed|unknown` and `POST /ops/cancel|reconcile`. `authorize` is required and fail-closed; lists are ownership-scoped; bodies omit workflow input/state. Reconcile accepts only `completed` or `failed_terminal` plus optional evidence. Unknown effects are never retried from this route.
|
|
103
|
+
|
|
104
|
+
Metric hook labels: `outcome` and allowlisted `class` only.
|
|
105
|
+
|
|
106
|
+
Network-free composition: [`examples/server-deployment-seams.ts`](../examples/server-deployment-seams.ts).
|
|
107
|
+
|
|
97
108
|
## Live probe (plans/064 Task 9)
|
|
98
109
|
|
|
99
110
|
The outbound webhook notifier has an operator-gated live probe against a receiver you own:
|
|
@@ -110,6 +121,7 @@ Probes: one signed delivery to your receiver (verify `x-prism-signature: sha256=
|
|
|
110
121
|
- `LeaseStore` / `CheckpointStore` — the durable contracts this runbook relies on.
|
|
111
122
|
- `createPostgresPersistence` — the PostgreSQL adapter used by the drill.
|
|
112
123
|
- `ErpOutboxStore` — the idempotent side-effect carrier used to make replay safe.
|
|
113
|
-
- `createWorkflowCoordinator` and `
|
|
124
|
+
- `createWorkflowCoordinator` (`admission`) and `createPrismOperatorHandler` — fair claim policy and ownership-scoped cancel/reconcile.
|
|
125
|
+
- `defineSaga`/`runSaga`/`resumeSaga` — higher-level consumers with the same fencing/cursor semantics.
|
|
114
126
|
- `scripts/phase27-ha-worker.mjs` / `scripts/phase27-ha.test.mjs` — the reproducible drill; `docs/_evidence/phase27-ha-evidence.json` — the recorded run.
|
|
115
127
|
- [Signed, hash-chained audit export](audit-export.md) — the cursor/CAS pattern applied to audit exports.
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Configuration options index
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Maps every public configuration surface — the `*Options`, `*Limits`, and `*Config` types a host passes into Prism — to the doc page that owns its fields. Prism has one options object per seam rather than a global config tree, so "where do I set this?" is the recurring onboarding question; this page answers it in one hop.
|
|
6
|
+
|
|
7
|
+
## When to use it
|
|
8
|
+
|
|
9
|
+
- Wiring a host for the first time and looking for the right seam (`AgentConfig`, `RunOptions`, `ModelConfig`, …).
|
|
10
|
+
- Reviewing which surfaces a run, session, or adapter can override before writing an override.
|
|
11
|
+
- Checking whether a knob is host-tunable at all before assuming a limit is hardcoded.
|
|
12
|
+
|
|
13
|
+
Field-level detail (defaults, bounds, failure modes) lives on the owning page — this index only routes you there.
|
|
14
|
+
|
|
15
|
+
## Start here: the surfaces most hosts set
|
|
16
|
+
|
|
17
|
+
| Surface | Configures | Owning page |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| `AgentConfig` | The reusable agent: provider, model, tools, skills, stores, retry, compaction, prompts, limits | [Agent/session runtime](agent-session-runtime.md) |
|
|
20
|
+
| `RunOptions` | One run's overrides: model, limits, thinking level, skills, middleware, metadata, signal | [Agent/session runtime](agent-session-runtime.md) |
|
|
21
|
+
| `AgentSessionConfig` | Session creation: id, agent, store, branch leaf, snapshot cache TTL | [Agent/session runtime](agent-session-runtime.md) |
|
|
22
|
+
| `ModelConfig` | A registered model record: capabilities, limits, cost, cache and thinking metadata | [Model registry](model-registry.md) |
|
|
23
|
+
| `ProviderRequestOptions` | Per-request provider hints: session/cache/header/compat/extra, applied after host policies | [Provider layer](provider-layer.md) |
|
|
24
|
+
|
|
25
|
+
## How options behave
|
|
26
|
+
|
|
27
|
+
- **Fixed defaults, host overrides.** Every option is optional; the value it replaces is the documented default, and an omitted option is exactly equivalent to passing the default explicitly.
|
|
28
|
+
- **Two-tier caps.** Tunable limits follow the repo convention `DEFAULT_*` (used when the host sets nothing) and `HARD_*` (the ceiling a host value is validated against), exported next to the option that accepts them. A value outside `1..HARD` (or `0..HARD` where zero means "disabled") fails closed with a `TypeError` at construction or assembly — never a silent clamp.
|
|
29
|
+
- **Request-time overrides narrow, never widen.** `RunOptions.limits` can only tighten `AgentConfig.limits`; a configured finite ceiling wins over `null`.
|
|
30
|
+
- **Byte caps are not estimator-dependent.** Token-budget options that accept a host estimator (`tokenEstimator`) affect eviction accounting only; byte caps and redaction stay authoritative.
|
|
31
|
+
|
|
32
|
+
## Agent/session runtime
|
|
33
|
+
|
|
34
|
+
**Agent definitions** — [`agent-definitions.md`](agent-definitions.md)
|
|
35
|
+
`DiscoverAgentBundlesOptions`, `ResolveAgentBundleOptions`
|
|
36
|
+
|
|
37
|
+
**Agent events** — [`agent-events.md`](agent-events.md)
|
|
38
|
+
`SubscribeOptions`
|
|
39
|
+
|
|
40
|
+
**Agent loops** — [`agent-loops.md`](agent-loops.md)
|
|
41
|
+
`AgentLoopOptions`
|
|
42
|
+
|
|
43
|
+
**Agent/session runtime** — [`agent-session-runtime.md`](agent-session-runtime.md)
|
|
44
|
+
`AgentConfig`, `AgentRunResumeOptions`, `AgentRunResumeStreamOptions`, `AgentSessionCloneOptions`, `AgentSessionConfig`, `AgentSessionForkOptions`, `RunOptions`, `SteerOptions`
|
|
45
|
+
|
|
46
|
+
**Evaluations** — [`evaluations.md`](evaluations.md)
|
|
47
|
+
`ScoreRunOptions`
|
|
48
|
+
|
|
49
|
+
**Runs and usage ledger** — [`runs-and-usage.md`](runs-and-usage.md)
|
|
50
|
+
`RunLimits`
|
|
51
|
+
|
|
52
|
+
**Structured output** — [`structured-output.md`](structured-output.md)
|
|
53
|
+
`StructuredOutputOptions`
|
|
54
|
+
|
|
55
|
+
## Compaction and session memory
|
|
56
|
+
|
|
57
|
+
**Compaction and retry policies** — [`compaction-and-retry.md`](compaction-and-retry.md)
|
|
58
|
+
`CompactionOptions`, `DefaultCompactionStrategyOptions`, `DefaultRetryPolicyOptions`, `RetryOptions`
|
|
59
|
+
|
|
60
|
+
**LLM compaction package** — [`compaction-llm.md`](compaction-llm.md)
|
|
61
|
+
`LlmCompactionStrategyOptions`
|
|
62
|
+
|
|
63
|
+
**Conversations** — [`conversations.md`](conversations.md)
|
|
64
|
+
`ConversationLimits`
|
|
65
|
+
|
|
66
|
+
**Node JSONL session store** — [`node-jsonl-session-store.md`](node-jsonl-session-store.md)
|
|
67
|
+
`JsonlSessionStoreOptions`
|
|
68
|
+
|
|
69
|
+
**PostgreSQL persistence** — [`postgres-persistence.md`](postgres-persistence.md)
|
|
70
|
+
`AgentEventSourceOptions`, `PostgresPersistenceOptions`
|
|
71
|
+
|
|
72
|
+
**Session stores** — [`session-stores.md`](session-stores.md)
|
|
73
|
+
`CreateMemorySessionStoreOptions`, `SessionAppendOptions`
|
|
74
|
+
|
|
75
|
+
**SQLite persistence** — [`sqlite-persistence.md`](sqlite-persistence.md)
|
|
76
|
+
`SqlitePersistenceOptions`
|
|
77
|
+
|
|
78
|
+
**Working and semantic memory** — [`working-and-semantic-memory.md`](working-and-semantic-memory.md)
|
|
79
|
+
`PostgresVectorStoreOptions`, `RecallScoringOptions`
|
|
80
|
+
|
|
81
|
+
**Memory fabric** — [`memory-fabric.md`](memory-fabric.md)
|
|
82
|
+
`CreateMemoryFabricOptions`, `MemoryFabricAttachOptions`, `MemoryFabricToolsOptions`, `MemoryFabricWriteOptions`, `MemoryFabricRecallOptions`, `MemoryFabricConsolidationOptions`, `MemoryFabricLinkerOptions`, `MemoryFabricEvolutionOptions`, `MemoryFabricConversationSearchOptions`, `CreateFabricFileJailOptions`
|
|
83
|
+
|
|
84
|
+
**Observational memory** — [`compaction-observational-memory.md`](compaction-observational-memory.md)
|
|
85
|
+
`ObservationalMemoryAppendOptions`, `WorkScopeControllerOptions`
|
|
86
|
+
|
|
87
|
+
## Provider and model connection
|
|
88
|
+
|
|
89
|
+
**Model registry** — [`model-registry.md`](model-registry.md)
|
|
90
|
+
`ModelConfig`, `ModelLimits`
|
|
91
|
+
|
|
92
|
+
**Provider layer** — [`provider-layer.md`](provider-layer.md)
|
|
93
|
+
`MockProviderOptions`, `ProviderRequestOptions`
|
|
94
|
+
|
|
95
|
+
**Provider primitives** — [`provider-primitives.md`](provider-primitives.md)
|
|
96
|
+
`BoundedStreamLimits`
|
|
97
|
+
|
|
98
|
+
**Alibaba Cloud provider package** — [`providers/alibaba.md`](providers/alibaba.md)
|
|
99
|
+
`AlibabaEmbedderOptions`, `AlibabaModelConfig`, `AlibabaProviderOptions`, `AlibabaProviderPackageOptions`, `ListAlibabaModelsOptions`
|
|
100
|
+
|
|
101
|
+
**Anthropic provider package** — [`providers/anthropic.md`](providers/anthropic.md)
|
|
102
|
+
`AnthropicProviderPackageOptions`, `ListAnthropicModelsOptions`
|
|
103
|
+
|
|
104
|
+
**ClinePass provider package** — [`providers/clinepass.md`](providers/clinepass.md)
|
|
105
|
+
`ClinePassProviderPackageOptions`
|
|
106
|
+
|
|
107
|
+
**Command Code provider package** — [`providers/commandcode.md`](providers/commandcode.md)
|
|
108
|
+
`CommandCodeProviderPackageOptions`
|
|
109
|
+
|
|
110
|
+
**DeepSeek provider package** — [`providers/deepseek.md`](providers/deepseek.md)
|
|
111
|
+
`DeepSeekModelConfig`, `DeepSeekProviderPackageOptions`, `ListDeepSeekModelsOptions`
|
|
112
|
+
|
|
113
|
+
**Google provider package** — [`providers/google.md`](providers/google.md)
|
|
114
|
+
`GoogleProviderPackageOptions`, `ListGoogleModelsOptions`
|
|
115
|
+
|
|
116
|
+
**Hyper provider package** — [`providers/hyper.md`](providers/hyper.md)
|
|
117
|
+
`HyperProviderPackageOptions`
|
|
118
|
+
|
|
119
|
+
**Kimi provider package** — [`providers/kimi.md`](providers/kimi.md)
|
|
120
|
+
`KimiModelConfig`, `KimiProviderPackageOptions`, `ListKimiModelsOptions`
|
|
121
|
+
|
|
122
|
+
**NeuralWatt provider package** — [`providers/neuralwatt.md`](providers/neuralwatt.md)
|
|
123
|
+
`GetNeuralWattQuotaOptions`, `ListNeuralWattModelsOptions`, `NeuralWattModelConfig`, `NeuralWattProviderPackageOptions`
|
|
124
|
+
|
|
125
|
+
**Ollama Cloud provider package** — [`providers/ollama.md`](providers/ollama.md)
|
|
126
|
+
`ListOllamaModelsOptions`, `OllamaModelConfig`, `OllamaProviderOptions`, `OllamaProviderPackageOptions`
|
|
127
|
+
|
|
128
|
+
**OpenAI-compatible provider** — [`providers/openai-compatible.md`](providers/openai-compatible.md)
|
|
129
|
+
`OpenAICompatibleProviderOptions`
|
|
130
|
+
|
|
131
|
+
**OpenAI provider package** — [`providers/openai.md`](providers/openai.md)
|
|
132
|
+
`OpenAICodexOAuthOptions`, `OpenAIProviderPackageOptions`
|
|
133
|
+
|
|
134
|
+
**OpenCode Go provider package** — [`providers/opencode-go.md`](providers/opencode-go.md)
|
|
135
|
+
`OpenCodeGoProviderPackageOptions`
|
|
136
|
+
|
|
137
|
+
**OpenRouter provider package** — [`providers/openrouter.md`](providers/openrouter.md)
|
|
138
|
+
`ListOpenRouterModelsOptions`, `OpenRouterModelConfig`, `OpenRouterProviderPackageOptions`
|
|
139
|
+
|
|
140
|
+
**xAI provider package** — [`providers/xai.md`](providers/xai.md)
|
|
141
|
+
`ListXaiModelsOptions`, `XaiOAuthOptions`, `XaiProviderPackageOptions`
|
|
142
|
+
|
|
143
|
+
**Z.AI provider package** — [`providers/zai.md`](providers/zai.md)
|
|
144
|
+
`ListZaiModelsOptions`, `ZaiModelConfig`, `ZaiProviderPackageOptions`
|
|
145
|
+
|
|
146
|
+
## Input, prompt, and context assembly
|
|
147
|
+
|
|
148
|
+
**Context and skills** — [`context-and-skills.md`](context-and-skills.md)
|
|
149
|
+
`ResolveActiveSkillsOptions`, `ResolveContextOptions`
|
|
150
|
+
|
|
151
|
+
**Attention compiler** — [`attention-compiler.md`](attention-compiler.md)
|
|
152
|
+
`AttentionCompilerOptions`, `AttentionInputCapOptions`, `AttentionCompileOptions`, `AttentionTruncationTriggerOptions`
|
|
153
|
+
|
|
154
|
+
**Input and prompt assembly** — [`input-and-prompt-assembly.md`](input-and-prompt-assembly.md)
|
|
155
|
+
`AssembleProviderInputOptions`, `PromptTemplateOptions`
|
|
156
|
+
|
|
157
|
+
**Multimodal content** — [`multimodal-content.md`](multimodal-content.md)
|
|
158
|
+
`ResolveMediaContentOptions`
|
|
159
|
+
|
|
160
|
+
**Retrieval-augmented generation (RAG)** — [`rag.md`](rag.md)
|
|
161
|
+
`CreateTeiRerankerOptions`
|
|
162
|
+
|
|
163
|
+
**System prompts** — [`system-prompts.md`](system-prompts.md)
|
|
164
|
+
`SystemPromptConfig`
|
|
165
|
+
|
|
166
|
+
## Tools
|
|
167
|
+
|
|
168
|
+
**Browser automation** — [`browser-automation.md`](browser-automation.md)
|
|
169
|
+
`BrowserCdpOptions`
|
|
170
|
+
|
|
171
|
+
**Coding agent tools (first-party package)** — [`coding-agent-tools.md`](coding-agent-tools.md)
|
|
172
|
+
`EditToolOptions`, `ReadTextOptions`, `ReadToolOptions`, `RepositoryLimitOptions`, `ShellToolOptions`, `ToolsOptions`, `WriteToolOptions`
|
|
173
|
+
|
|
174
|
+
**Coding execution approval and sandboxing** — [`coding-security.md`](coding-security.md)
|
|
175
|
+
`DockerNetworkConfig`
|
|
176
|
+
|
|
177
|
+
**Device adapters** — [`device-adapters.md`](device-adapters.md)
|
|
178
|
+
`DevicePolicyOptions`
|
|
179
|
+
|
|
180
|
+
**GitHub forge integration** — [`forge-integration.md`](forge-integration.md)
|
|
181
|
+
`CreateGitRunnerOptions`, `ForgeLimits`
|
|
182
|
+
|
|
183
|
+
**Language intelligence** — [`language-intelligence.md`](language-intelligence.md)
|
|
184
|
+
`LanguageIntelligenceLimits`
|
|
185
|
+
|
|
186
|
+
**MCP client bridge and server exposure** — [`mcp-tools.md`](mcp-tools.md)
|
|
187
|
+
`CreatePrismMcpServerOptions`
|
|
188
|
+
|
|
189
|
+
**Process sessions** — [`process-sessions.md`](process-sessions.md)
|
|
190
|
+
`ProcessSessionLimits`
|
|
191
|
+
|
|
192
|
+
**Tools** — [`tools.md`](tools.md)
|
|
193
|
+
`DispatchToolCallOptions`
|
|
194
|
+
|
|
195
|
+
## Documents, sheets, and diagrams
|
|
196
|
+
|
|
197
|
+
**Diagramming, draw.io embed client, and mxGraph XML validation** — [`diagrams.md`](diagrams.md)
|
|
198
|
+
`DrawioCanonicalizeOptions`, `DrawioEmbedOptions`, `DrawioExportOptions`, `DrawioLoadOptions`, `DrawioXmlOptions`
|
|
199
|
+
|
|
200
|
+
**Documents, spreadsheets, and presentations** — [`documents.md`](documents.md)
|
|
201
|
+
`GenerateDocumentOptions`, `ParseDocumentOptions`, `PatchDocumentOptions`, `PreviewBlocksOptions`, `PreviewHtmlOptions`
|
|
202
|
+
|
|
203
|
+
**Spreadsheets, CSV parsing, and typed schema inference** — [`sheets.md`](sheets.md)
|
|
204
|
+
`ParseCsvOptions`, `ParseWorkbookOptions`
|
|
205
|
+
|
|
206
|
+
## Extensions and plugins
|
|
207
|
+
|
|
208
|
+
**Contribution discovery (workspace)** — [`contribution-discovery.md`](contribution-discovery.md)
|
|
209
|
+
`DiscoveryOptions`
|
|
210
|
+
|
|
211
|
+
**Extension kernel and event bus** — [`extensions.md`](extensions.md)
|
|
212
|
+
`ExtensionKernelOptions`
|
|
213
|
+
|
|
214
|
+
**Middleware hooks** — [`middleware-hooks.md`](middleware-hooks.md)
|
|
215
|
+
`MiddlewareRegistryOptions`
|
|
216
|
+
|
|
217
|
+
## Configuration and manifests
|
|
218
|
+
|
|
219
|
+
**Resource loading** — [`resource-loading.md`](resource-loading.md)
|
|
220
|
+
`LoadBinaryResourceOptions`
|
|
221
|
+
|
|
222
|
+
## Server/API
|
|
223
|
+
|
|
224
|
+
**Web-standard server handler** — [`server.md`](server.md)
|
|
225
|
+
`PrismServerLimits`
|
|
226
|
+
|
|
227
|
+
## Multi-agent and interoperability
|
|
228
|
+
|
|
229
|
+
**Agent Client Protocol (ACP) coding-host interop** — [`acp.md`](acp.md)
|
|
230
|
+
`AcpCapabilitiesOptions`, `CreatePrismAcpAgentOptions`
|
|
231
|
+
|
|
232
|
+
**Frontend interoperability (AG-UI and ACP)** — [`ag-ui.md`](ag-ui.md)
|
|
233
|
+
`AgUiLimitOptions`
|
|
234
|
+
|
|
235
|
+
**Supervisors and subagents** — [`supervisors.md`](supervisors.md)
|
|
236
|
+
`CreateSupervisorOptions`, `SupervisorLimits`, `ResolvedSupervisorLimits`, `DelegationWaitOptions`, `CreateSpawnAgentToolOptions`, `CreateDelegationControlToolOptions`, `WorktreeChildFactoryOptions`, `ObserveSupervisorLifecycleOptions`
|
|
237
|
+
|
|
238
|
+
## CLI/RPC
|
|
239
|
+
|
|
240
|
+
**Workflows** — [`workflows.md`](workflows.md)
|
|
241
|
+
`RunWorkflowOptions`
|
|
242
|
+
|
|
243
|
+
## Conformance harnesses
|
|
244
|
+
|
|
245
|
+
These option objects configure the shipped test doubles a host runs against its own adapters (provider, store, run ledger, compaction, tool, extension). They are host-facing, but only in test code.
|
|
246
|
+
|
|
247
|
+
**Compaction conformance** — [`compaction-conformance.md`](compaction-conformance.md)
|
|
248
|
+
`CompactionConformanceOptions`
|
|
249
|
+
|
|
250
|
+
**Extension conformance** — [`extension-conformance.md`](extension-conformance.md)
|
|
251
|
+
`ExtensionConformanceOptions`
|
|
252
|
+
|
|
253
|
+
**Run ledger conformance** — [`run-ledger-conformance.md`](run-ledger-conformance.md)
|
|
254
|
+
`RunLedgerConformanceOptions`
|
|
255
|
+
|
|
256
|
+
**Session store conformance** — [`session-store-conformance.md`](session-store-conformance.md)
|
|
257
|
+
`SessionStoreConformanceOptions`
|
|
258
|
+
|
|
259
|
+
**Tool conformance** — [`tool-conformance.md`](tool-conformance.md)
|
|
260
|
+
`ToolConformanceOptions`, `ToolDisclosureConformanceOptions`, `ToolDispatchProbeOptions`
|
|
261
|
+
|
|
262
|
+
## Implementation example
|
|
263
|
+
|
|
264
|
+
```ts
|
|
265
|
+
import { createAgent, createMemorySessionStore } from "@arnilo/prism";
|
|
266
|
+
|
|
267
|
+
// Agent-level: the long-lived defaults.
|
|
268
|
+
const agent = createAgent({
|
|
269
|
+
provider,
|
|
270
|
+
model: { id: "gpt-4o", provider: "openai" },
|
|
271
|
+
limits: { maxTurns: 12, maxToolRounds: 8 }, // AgentConfig.limits
|
|
272
|
+
store: createMemorySessionStore([], { search: { maxLinearSessions: 5_000 } }),
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// Session-level: identity, branch, and snapshot cache.
|
|
276
|
+
const session = agent.createSession({ leafId: "leaf-1", snapshotCacheTtlMs: 0 });
|
|
277
|
+
|
|
278
|
+
// Run-level: only narrows what the agent configured.
|
|
279
|
+
await session.run("hi", { limits: { maxToolRounds: 2 }, thinkingLevel: "low" });
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Extension and configuration notes
|
|
283
|
+
|
|
284
|
+
- Options are plain data. A host overrides behavior by passing a *different implementation* to the seam (`store`, `providerSource`, `loop`, policies), not by mutating a shared config object.
|
|
285
|
+
- Layered JSON configuration (`mergeConfigLayers`) resolves to the same option shapes; see [Configuration and manifests](configuration-and-manifests.md).
|
|
286
|
+
- This index is checked against the source tree: every surface named here must exist as a declared `*Options`/`*Limits`/`*Config` type, and every link must resolve. See `scripts/live-doc-check.test.mjs`.
|
|
287
|
+
|
|
288
|
+
## Security and performance notes
|
|
289
|
+
|
|
290
|
+
- Credentials never appear in these option objects; secrets resolve through credential providers and are redacted before they reach requests, logs, or events. See [Credentials and redaction](credentials-and-redaction.md).
|
|
291
|
+
- Trust boundaries are options too (`trust`, permission policies, sandbox and egress config). Tightening them is always allowed; loosening one requires the host to pass it explicitly. See [Host security guide](host-security.md).
|
|
292
|
+
- Raising a cap raises resource use. Caps exist to bound memory, sockets, subprocesses, and provider spend; prefer narrowing per run over raising an agent-wide ceiling.
|
|
293
|
+
|
|
294
|
+
## Related APIs
|
|
295
|
+
|
|
296
|
+
- [Public contracts](public-contracts.md): the shapes these options produce and the store/tool/provider interfaces they configure.
|
|
297
|
+
- [Optional peer dependencies](peer-dependencies.md): which surfaces need an extra install before their options are reachable.
|
|
298
|
+
- [SDK customization guide](customization.md): a seam-by-seam walkthrough of replacing Prism primitives.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Optional peer dependencies
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
Lists every third-party peer a Prism package declares, what importing that peer unlocks, and the exact install line for it. Prism keeps optional integrations behind peer dependencies so a host installs a browser, a database driver, or a vendor SDK only when it actually uses that surface — and so the host, not Prism, owns the version, the binary, and the supply chain.
|
|
6
|
+
|
|
7
|
+
## When to use it
|
|
8
|
+
|
|
9
|
+
- Before installing a subpath: check whether it needs an extra package.
|
|
10
|
+
- Reviewing supply chain: which peers open a network connection, and which are pinned.
|
|
11
|
+
- Debugging a "peer not installed" error from a gated subpath.
|
|
12
|
+
- Auditing which of your already-installed packages a Prism surface will reuse.
|
|
13
|
+
|
|
14
|
+
Internal `@arnilo/*` peers are not listed here: every first-party package declares a required `@arnilo/prism` peer, and the release gate keeps all internal ranges locked to the cut version. This page covers the **12 third-party declarations across 6 packages**.
|
|
15
|
+
|
|
16
|
+
## Matrix
|
|
17
|
+
|
|
18
|
+
One row per declaration. `Unlocks` names the subpath whose import reaches the peer; `Install` is the exact command for a host that has already installed the Prism package.
|
|
19
|
+
|
|
20
|
+
| Peer | Declared range | Optional | Declared by | Unlocks | Install | Network |
|
|
21
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
22
|
+
| `zod` | `^3.25.0 \|\| ^4.0.0` | no | `@arnilo/prism-ag-ui` | `./acp` | `npm i zod` | no |
|
|
23
|
+
| `@nanonets/graft` | `^0.16.0 \|\| ^0.18.0` | yes | `@arnilo/prism-memory` | `./graft` | `npm i @nanonets/graft` | no |
|
|
24
|
+
| `@dietrichgebert/ponytail` | `^4.9.0` | yes | `@arnilo/prism-coding-tools` | `./ponytail` | `npm i @dietrichgebert/ponytail` | no |
|
|
25
|
+
| `mammoth` | `^1.8.0` | yes | `@arnilo/prism-coding-tools` | `./document-reader` | `npm i mammoth` | no |
|
|
26
|
+
| `pdf-parse` | `^2.4.5` | yes | `@arnilo/prism-coding-tools` | `./document-reader` | `npm i pdf-parse` | no |
|
|
27
|
+
| `e2b` | `2.49.1` | yes | `@arnilo/prism-coding-tools` | `./security` | `npm i e2b@2.49.1` | yes |
|
|
28
|
+
| `better-sqlite3` | `^13.0.3` | yes | `@arnilo/prism-core` | `./sessions/sqlite`, `./governance/prompts` | `npm i better-sqlite3` | no |
|
|
29
|
+
| `pg` | `^8.23.0` | yes | `@arnilo/prism-core` | `./sessions/postgres`, `./enterprise/postgres`, `./governance/prompts` | `npm i pg` | yes |
|
|
30
|
+
| `@nats-io/jetstream` | `^3.4.0` | yes | `@arnilo/prism-core` | `./sessions/nats` | `npm i @nats-io/jetstream @nats-io/transport-node` | yes |
|
|
31
|
+
| `@nats-io/transport-node` | `^3.4.0` | yes | `@arnilo/prism-core` | `./sessions/nats` | `npm i @nats-io/transport-node` | yes |
|
|
32
|
+
| `@ai-sdk/provider` | `4.0.13` | yes | `@arnilo/prism-providers` | `./ai-sdk` | `npm i @ai-sdk/provider@4.0.13` | no |
|
|
33
|
+
| `playwright-core` | `1.63.0` | yes | `@arnilo/prism-web-tools` | `./browser`, `./obscura` | `npm i playwright-core@1.63.0` | yes |
|
|
34
|
+
|
|
35
|
+
## Exact pins and why
|
|
36
|
+
|
|
37
|
+
Two peers are pinned to an exact version instead of a range, because the pin is a contract rather than a convenience:
|
|
38
|
+
|
|
39
|
+
- **`playwright-core@1.63.0`** (`@arnilo/prism-web-tools/browser`, `/obscura`). Browser automation rides Playwright's CDP transport and accessibility snapshot shapes, which move between minors. Prism never launches, downloads, or bundles a browser: the host supplies the binary, the image, and the cache, and must match the pinned client. See [Browser automation](browser-automation.md).
|
|
40
|
+
- **`@ai-sdk/provider@4.0.13`** (`@arnilo/prism-providers/ai-sdk`). The adapter consumes deterministic specification-versioned types (`LanguageModelV4`) and gates on an exact supported-version matrix at construction, so an unlisted version fails closed instead of silently mis-mapping. See [AI SDK provider](providers/ai-sdk.md).
|
|
41
|
+
- **`e2b@2.49.1`** (`@arnilo/prism-coding-tools/security`). Pause `keepMemory`, `Sandbox.connect` auto-resume, and `ServiceBusyError` 503 semantics are version-specific. Hosts may inject `{ client }` instead of installing the peer. See [Hosted sandboxes](hosted-sandboxes.md).
|
|
42
|
+
|
|
43
|
+
`zod` is the only **required** third-party peer. `@agentclientprotocol/sdk` — a hard dependency of `@arnilo/prism-ag-ui` — declares `zod: ^3.25.0 || ^4.0.0` as its own peer, so `@arnilo/prism-ag-ui` re-declares the same range to keep the install tree satisfiable; the range is deliberately identical to the SDK's. Nothing in Prism imports zod directly.
|
|
44
|
+
|
|
45
|
+
## Peers that touch the network
|
|
46
|
+
|
|
47
|
+
`pg`, `@nats-io/jetstream`, `@nats-io/transport-node`, `playwright-core`, and `e2b` open sockets. For a supply-chain review of those five:
|
|
48
|
+
|
|
49
|
+
- **Connection targets are host-owned.** Every one of them is passed a host-supplied connection string, endpoint list, browser instance, API key, or service URL. Prism holds no default endpoint, and no peer is reachable from the root import.
|
|
50
|
+
- **Bytes stay local otherwise.** `better-sqlite3`, `mammoth`, `pdf-parse`, `@nanonets/graft`, and `@dietrichgebert/ponytail` are filesystem/process peers; the remaining two (`zod`, `@ai-sdk/provider`) are pure types/schemas.
|
|
51
|
+
- **No secrets are read by the peers.** Prism resolves credentials through host providers and redacts them at the boundary; peers only ever receive a resolved connection string or model object. See [Credentials and redaction](credentials-and-redaction.md) and [Host security guide](host-security.md).
|
|
52
|
+
- **Nothing is installed implicitly.** Optional peers are never auto-installed by npm; a missing one fails closed at the call site with a typed error naming the peer and the subpath. Required peers (today only `zod`) are installed by npm with the package.
|
|
53
|
+
|
|
54
|
+
Test-only dependencies are *not* peers. `playwright-core` appears in `@arnilo/prism-office` as a devDependency only, because the office diagrams embed takes a host-supplied iframe and the sole consumer is the gated live draw.io conformance test.
|
|
55
|
+
|
|
56
|
+
## Implementation example
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Browser automation: pinned client, host-owned browser binary
|
|
60
|
+
npm i @arnilo/prism-web-tools playwright-core@1.63.0
|
|
61
|
+
|
|
62
|
+
# PostgreSQL session store: pool driver only
|
|
63
|
+
npm i @arnilo/prism-core pg
|
|
64
|
+
|
|
65
|
+
# NATS JetStream event source: transport + jetstream together
|
|
66
|
+
npm i @arnilo/prism-core @nats-io/transport-node @nats-io/jetstream
|
|
67
|
+
|
|
68
|
+
# Document reader: pick the parser you need (both are independent)
|
|
69
|
+
npm i @arnilo/prism-coding-tools pdf-parse mammoth
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { chromium } from "playwright-core"; // host supplies the binary/image
|
|
74
|
+
import { createBrowserTools } from "@arnilo/prism-web-tools/browser";
|
|
75
|
+
|
|
76
|
+
const browser = await chromium.launch({ headless: true }); // host-owned, never Prism's
|
|
77
|
+
const tools = await createBrowserTools({ browser });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Extension and configuration notes
|
|
81
|
+
|
|
82
|
+
- A peer is an *implementation the host owns*. When a peer's default wiring is not what you want, pass your own implementation instead of installing theirs: the document reader accepts host parsers (`createReadTool({ documentReader })`), the memory `/graft` resolver accepts an explicit package root, and the browser surfaces accept a host `Browser`.
|
|
83
|
+
- Subpaths that need a peer isolate that import, so importing another subpath of the same package never evaluates it. The office family is the extreme case: zero peers, because it takes structural inputs.
|
|
84
|
+
- Adding a peer to a Prism package is a release-gated change: the declaration must be optional unless a hard dependency's own peer forces it (the `zod` case), and exact pins must come with a version-gate or compatibility rationale.
|
|
85
|
+
|
|
86
|
+
## Security and performance notes
|
|
87
|
+
|
|
88
|
+
- Pinned peers must be updated through the release process, not by a host override: an unpinned browser client or AI SDK type surface is a silent behavior change.
|
|
89
|
+
- Peer installs are host-visible supply-chain additions. Prefer one peer per capability, keep them out of the root import, and audit transitive dependencies of the five network-touching peers in your own policy.
|
|
90
|
+
- Prism adds no runtime cost for an uninstalled peer; the failure is a typed error at first use.
|
|
91
|
+
|
|
92
|
+
## Related APIs
|
|
93
|
+
|
|
94
|
+
- [Release and install](release-and-install.md): install profiles that pair with each peer.
|
|
95
|
+
- [Configuration options index](options-index.md): the option surfaces each peer unlocks.
|
|
96
|
+
- Package-level detail: [Coding tools](coding-tools.md), [Core runtime](core.md), [Session stores](session-stores.md), [Browser automation](browser-automation.md), [Document reader](document-reader.md), [Graft](graft.md), [Ponytail](ponytail.md), [Provider packages](provider-packages.md).
|