@arnilo/prism 0.0.6 → 0.0.7
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 +11 -0
- package/dist/agent-loops.js +1 -0
- package/dist/agent-run-lifecycle.d.ts +28 -0
- package/dist/agent-run-lifecycle.js +33 -0
- package/dist/agent-run-state.d.ts +53 -0
- package/dist/agent-run-state.js +127 -0
- package/dist/agents.d.ts +3 -1
- package/dist/agents.js +335 -43
- package/dist/contracts.d.ts +203 -3
- package/dist/contracts.js +4 -0
- package/dist/guardrails.d.ts +25 -0
- package/dist/guardrails.js +133 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.js +8 -3
- package/dist/input.js +2 -0
- package/dist/resources.js +2 -1
- package/dist/run-limits.d.ts +34 -0
- package/dist/run-limits.js +163 -0
- package/dist/secure-agent.d.ts +3 -0
- package/dist/secure-agent.js +63 -0
- package/dist/tools.d.ts +10 -2
- package/dist/tools.js +54 -4
- package/docs/agent-events.md +13 -1
- package/docs/agent-loops.md +11 -3
- package/docs/agent-session-runtime.md +33 -1
- package/docs/guardrails.md +75 -0
- package/docs/host-security.md +6 -2
- package/docs/index.md +5 -4
- package/docs/mcp-tools.md +7 -3
- package/docs/migration.md +18 -0
- package/docs/release-and-install.md +40 -40
- package/docs/runs-and-usage.md +29 -2
- package/docs/server.md +5 -2
- package/docs/tools.md +6 -1
- package/docs/workflows.md +1 -0
- package/package.json +1 -1
package/docs/index.md
CHANGED
|
@@ -6,9 +6,10 @@ Prism is a TypeScript/Node.js agent harness. Host apps and extension packages ow
|
|
|
6
6
|
- [Public contracts](public-contracts.md): type shapes for messages, agents, tools, stores, generic `CheckpointStore`, atomic `LeaseStore`, bounded `EventMultiplexer`, resources, credentials, and events.
|
|
7
7
|
|
|
8
8
|
## Agent/session runtime
|
|
9
|
-
- [Agent/session runtime](agent-session-runtime.md): create
|
|
9
|
+
- [Agent/session runtime](agent-session-runtime.md): create explicit or opt-in secure agents/sessions, get direct `AgentRunResult` values from `run`/`prompt`, use integrated `stream()`, subscribe to normalized events, and expose opted-in durable lifecycle capabilities.
|
|
10
10
|
- [Agent definitions](agent-definitions.md): resolve declarative `AgentDefinition` values via `resolveAgentDefinition`, and turn app-config `<configRoot>/agents/<name>/AGENT.md` bundles into runnable agents via `discoverAgentBundles` / `resolveAgentBundle` (explicit tool/skill activation by name, fail-closed omitted capabilities, migration-only `activateAllCapabilities`, strict duplicate scope checks, configurable prompt layers, no auto-discovery).
|
|
11
11
|
- [Agent loops](agent-loops.md): replaceable per-run control loops — `singleShotLoop` default and opt-in bounded artifact-loop tool rounds with host-supplied `validator`/`parser`/`repairer` callbacks.
|
|
12
|
+
- [Guardrails](guardrails.md): typed fail-closed input/output/tool checks with buffered provider output and redacted decision records.
|
|
12
13
|
- [Agent events](agent-events.md): the `AgentEvent` stream — agent/turn/message (including live `tool_call_delta` fragments), provider turn timing, tool execution, queue/subscriber overflow, compaction/retry, artifact validation/refinement, and error variants, redacted via `redactAgentEvent`.
|
|
13
14
|
- [Observability](observability.md): metadata-only provider/tool and run-feedback/evaluation projection, terminal span cleanup, low-cardinality metrics, and optional `@arnilo/prism-observability-opentelemetry` adapter.
|
|
14
15
|
- [Evaluations](evaluations.md): optional deterministic scorers/datasets/experiments plus ID-only linkage from evaluation records to immutable owned run feedback.
|
|
@@ -26,7 +27,7 @@ Prism is a TypeScript/Node.js agent harness. Host apps and extension packages ow
|
|
|
26
27
|
- [Database persistence](database-persistence.md): production persistence contracts, shared checksummed migration/full-shape catalog primitives (`@arnilo/prism/testing/persistence-schema`), conditional append, indexes, `readBranchPath`, reference relational schema, retention, and NoSQL mapping.
|
|
27
28
|
- [SQLite persistence](sqlite-persistence.md): optional `better-sqlite3` adapter with session/run storage, checkpoints/leases, feedback, and transactionally verified/backfilled migration-v3 metadata.
|
|
28
29
|
- [PostgreSQL persistence](postgres-persistence.md): optional pooled `pg` adapter with session/run/checkpoint/lease/feedback storage, advisory-locked checksummed/full-shape migrations, and opt-in live conformance.
|
|
29
|
-
- [Migration guide](migration.md): 0.0.3 compatibility
|
|
30
|
+
- [Migration guide](migration.md): 0.0.3 compatibility, 0.0.6 hardening, and 0.0.7 guardrails, RunLimits, durable approval/resume, and secure composition.
|
|
30
31
|
- [Node JSONL session store](node-jsonl-session-store.md): development-only JSONL file adapter for single-process Node hosts; no cross-process safety.
|
|
31
32
|
- [Persistence, credentials, and multimodality primitives](persistence-credentials-multimodality-primitives.md): Plan 056 inventory — session/run-ledger/persistence contracts, credential/OAuth seams, content/resource/model capabilities, package dependency matrix, conformance matrix, and threat model for production adapters.
|
|
32
33
|
|
|
@@ -56,7 +57,7 @@ Prism is a TypeScript/Node.js agent harness. Host apps and extension packages ow
|
|
|
56
57
|
- [Tools](tools.md): register host-owned active tools with replace-or-error duplicate policy, apply exact allow/deny filtering, dispatch normal or opt-in bounded artifact-loop calls, and optionally bound untrusted JSON Schema compilation.
|
|
57
58
|
- [Tool execution primitives](tool-execution-primitives.md): finite JSON Schema LRU validation, exclusive-aware bounded parallel dispatch, MCP bridge mapping, coding execution policy, and image-read bounds.
|
|
58
59
|
- [Tool validator JSON Schema package](../packages/tool-validator-json-schema/README.md): optional `@arnilo/prism-tool-validator-json-schema` adapter for `tool.parameters`.
|
|
59
|
-
- [MCP client bridge and server exposure](mcp-tools.md): optional bounded atomic tool discovery/results, exact-origin DNS-pinned HTTPS/loopback-only HTTP client transport, and explicitly authorized Prism tools/commands on SDK `McpServer`.
|
|
60
|
+
- [MCP client bridge and server exposure](mcp-tools.md): optional bounded atomic tool discovery/results, exact-origin DNS-pinned HTTPS/loopback-only HTTP client transport, and explicitly authorized Prism tools/commands/durable agent lifecycle on SDK `McpServer`.
|
|
60
61
|
- [Coding agent tools](coding-agent-tools.md): optional `shell`, `read`, `write`, and `edit` definitions with streamed text pages, bounded image/edit reads and write/edit payloads, finite shell wall/total-output limits, secure host-owned spill cleanup, pluggable bounded operation contracts, per-path mutation serialization, and optional `ExecutionPolicy`. Limits do not sandbox host access—gate with permission/trust policy and `@arnilo/prism-coding-security`.
|
|
61
62
|
- [Coding execution approval and sandboxing](coding-security.md): path/command approval, identity-scoped caching, shell-turn exclusivity, and abort-aware streaming sandbox adapters for coding tools.
|
|
62
63
|
|
|
@@ -73,7 +74,7 @@ Prism is a TypeScript/Node.js agent harness. Host apps and extension packages ow
|
|
|
73
74
|
- [Resource loading](resource-loading.md): decode text, JSON, binary, and manifest resources through caller-provided loaders with bounded byte limits.
|
|
74
75
|
|
|
75
76
|
## Server/API
|
|
76
|
-
- [Web-standard server handler](server.md): optional framework-free authorized direct/SSE agent and durable workflow
|
|
77
|
+
- [Web-standard server handler](server.md): optional framework-free authorized direct/SSE agent, explicitly selected durable agent lifecycle, and durable workflow routes with explicit bounds and zero default exposure.
|
|
77
78
|
|
|
78
79
|
## Multi-agent and interoperability
|
|
79
80
|
- [Supervisor delegation](supervisors.md): optional explicit child allow-list, derived memory scopes, narrowing-only permissions, lifecycle hooks, nested delegation, cancellation, and finite budgets.
|
package/docs/mcp-tools.md
CHANGED
|
@@ -63,7 +63,7 @@ Do **not** use this package as a sandbox, permission engine, or auto-discovery l
|
|
|
63
63
|
|
|
64
64
|
The resolved `McpToolBridge` exposes `tools`, `refresh()`, and `close()`. Each discovered MCP tool becomes a normal Prism `ToolDefinition`; calls return `ToolResult`, with remote `isError` mapped to `ToolResult.error`. List-change notifications invalidate the cache but register nothing automatically.
|
|
65
65
|
|
|
66
|
-
`createPrismMcpServer()` returns the SDK `McpServer`. It lists only passed tools/commands; JSON Schema parameters are converted through installed Zod v4 for SDK validation, then Prism tool calls still pass through `dispatchToolCall` permission/validator/redactor gates. Command definitions support explicitly selected direct/background/replay workflow operations and optional ownership-scoped schedule operations from `createWorkflowCommands()`; none are registered unless the host passes those command definitions. Calls return bounded MCP text content and `isError` on denial/failure. `createPrismMcpWebHandler()` returns `(Request) => Promise<Response>`.
|
|
66
|
+
`createPrismMcpServer()` returns the SDK `McpServer`. It lists only passed tools/commands and explicitly selected `agentRuns` lifecycle tools; JSON Schema parameters are converted through installed Zod v4 for SDK validation, then Prism tool calls still pass through `dispatchToolCall` permission/validator/redactor gates. Command definitions support explicitly selected direct/background/replay workflow operations and optional ownership-scoped schedule operations from `createWorkflowCommands()`; none are registered unless the host passes those command definitions. Calls return bounded MCP text content and `isError` on denial/failure. `createPrismMcpWebHandler()` returns `(Request) => Promise<Response>`.
|
|
67
67
|
|
|
68
68
|
## Request/response example
|
|
69
69
|
|
|
@@ -160,6 +160,7 @@ Plaintext is accepted only when `allowLoopbackHttp: true`, the URL hostname is l
|
|
|
160
160
|
| Option | Default | Purpose |
|
|
161
161
|
| --- | --- | --- |
|
|
162
162
|
| `tools` / `commands` | empty | Explicit allow-list; zero default exposure |
|
|
163
|
+
| `agentRuns` | empty | Explicit `{ [agentId]: { lifecycle } }` map; registers `agent.<id>.status` and `agent.<id>.resume` only |
|
|
163
164
|
| `authorize` | required | Per-call host authz using SDK auth/session metadata |
|
|
164
165
|
| `permission` / `validate` / `redactor` | none | Core tool-dispatch gates and known-secret redaction |
|
|
165
166
|
| `maxResultBytes` | 1 MiB (8 MiB hard) | Bound mapped MCP call output |
|
|
@@ -179,11 +180,14 @@ Web handler defaults: 1 MiB request (8 MiB hard), 2 MiB response (16 MiB hard),
|
|
|
179
180
|
| Oversized/deep/wide server output | One aggregate byte/depth/property walk covers content, structured content, compatibility `toolResult`, and bounded remote errors before `ToolResult` |
|
|
180
181
|
| Unvalidated arguments | Register tools with `createJsonSchemaToolArgumentValidator()` at dispatch |
|
|
181
182
|
| Missing permission gate | Client direction: `PermissionPolicy` on `tool:mcp:<serverId>:<name>:execute`; server direction: required MCP `authorize` plus optional core `PermissionPolicy` |
|
|
182
|
-
| Accidental server exposure | Empty default arrays, duplicate-name rejection, explicit tools/commands only |
|
|
183
|
+
| Accidental server exposure | Empty default arrays/maps, duplicate-name rejection, explicit tools/commands/lifecycle only |
|
|
184
|
+
| Agent lifecycle data leak or cross-tenant resume | `agentRuns` requires exact tenant plus account/user ownership; core lifecycle returns public redacted state only and CAS-resumes with current agent/revision |
|
|
183
185
|
| Unbounded MCP HTTP | Bounded pre-parsed JSON, response bytes, concurrent requests, call timeout, SDK web-standard transport |
|
|
184
186
|
| Cross-tenant operation | Authorizer derives ownership from validated auth and passes it to tool dispatch/selected workflow commands; never trust arguments as identity |
|
|
185
187
|
|
|
186
|
-
|
|
188
|
+
For durable lifecycle exposure, construct `createAgentRunLifecycle({ checkpoints, resolveAgent })` in core, then pass selected entries as `agentRuns: { support: { lifecycle } }`. MCP registers two tools: `agent.support.status` accepts `{ runId, sessionId? }`; `agent.support.resume` accepts `{ runId, sessionId?, decision, expectedVersion }`. Do not expose an agent without durable checkpoints and a restart-safe `SessionStore`; no lifecycle tool appears by default.
|
|
189
|
+
|
|
190
|
+
MCP output is untrusted. Register bridge tools through core dispatch with a `SecretRedactor` so bounded remote content/errors are redacted before persistence or display. `CreatePrismMcpServerOptions.guardrails` applies shared tool-input/output stages to registered Prism tools; commands remain host callbacks. See [Guardrails](guardrails.md). Prism does not infer unknown secrets. MCP server authorization does not replace tool `PermissionPolicy`, argument validation, coding `ExecutionPolicy`, workflow ownership checks, TLS, rate limiting, or sandboxing. A timed-out tool must cooperate with `AbortSignal` to stop side effects; protocol retention and HTTP responses remain bounded when remote work ignores abort.
|
|
187
191
|
|
|
188
192
|
Discovery validation is atomic: cursor/page/tool/name/description/schema failures reject `refresh()` and preserve the previous immutable tool-array reference. The bridge intentionally uses raw SDK `request()` for `tools/list` and `tools/call`; this avoids eager Ajv compilation/validation of untrusted remote output schemas. Host `ToolValidator` remains the argument-validation owner.
|
|
189
193
|
|
package/docs/migration.md
CHANGED
|
@@ -7,6 +7,24 @@ Prism 0.0.6 preserves documented 0.0.3 agent construction except for two intenti
|
|
|
7
7
|
1. **`session.run()` / `session.prompt()` return `AgentRunResult`** and `session.stream()` starts one owned run after subscribing. Callers that ignored the previous `Promise<void>` keep working; failed/aborted runs reject with `AgentRunError` (`.result` attached).
|
|
8
8
|
2. **`AgentConfig.extensions` / `settings` / `credentials` are removed.** Wire extensions through `createExtensionKernel()`, read settings in the host, and pass credential resolvers to the provider edge.
|
|
9
9
|
|
|
10
|
+
## 0.0.6 → 0.0.7 secure run lifecycle
|
|
11
|
+
|
|
12
|
+
`createAgent()` remains backward-compatible. Version 0.0.7 adds opt-in typed `Guardrails` (`input`, provider `output`, `toolInput`, `toolOutput`) and narrowing-only `RunLimits`. Output guardrails and configured output-token/total-token/cost limits buffer provider output before exposure; blocked content is neither emitted nor persisted. A breach emits one redacted `run_limit_exceeded` event and rejects with `AgentRunError.result.limit`.
|
|
13
|
+
|
|
14
|
+
Built-in agent loops can opt into durable `runState` with a checkpoint store and stable `definitionRevision`. `interruptBeforeTool: true` suspends before any tool side effect. Resume requires exact ownership, current fingerprint/revision, and checkpoint `expectedVersion`; a crash after dispatch is ambiguous and requires operator resolution rather than replaying the tool. Custom `AgentLoopStrategy` objects are not durable. Persisted state is bounded/redacted and excludes credentials, raw input, callbacks, providers, and pending tool arguments.
|
|
15
|
+
|
|
16
|
+
`createSecureAgent()` is new and opt-in. Adopt it when every active tool must have a host validator/schema, trust and permission policies, secret redaction, finite limits, exact ownership, and durable pre-tool approval. Run options may narrow its limits and append guardrails, but cannot replace its redactor, validator, ownership, or checkpoint policy. To expose durable agent status/resume remotely, explicitly create `createAgentRunLifecycle({ checkpoints, resolveAgent })` and pass it to selected server `agentRuns` or MCP `agentRuns`; no route/tool is added otherwise.
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
const suspended = await agent.createSession().run("send", {
|
|
20
|
+
runState: { checkpoints, definitionRevision: "1", interruptBeforeTool: true },
|
|
21
|
+
limits: { maxToolCalls: 1, maxTotalTokens: 50_000 },
|
|
22
|
+
});
|
|
23
|
+
const result = await resumeAgentRun(agent, { runId: suspended.runId }, {
|
|
24
|
+
decision: "approve", expectedVersion: suspended.runState!.version!,
|
|
25
|
+
}, { checkpoints, definitionRevision: "1" });
|
|
26
|
+
```
|
|
27
|
+
|
|
10
28
|
Phase 4 adds optional `@arnilo/prism-evals` for deterministic scorers/datasets/experiments. It is not a core dependency; install it directly or through `@arnilo/prism-all`.
|
|
11
29
|
|
|
12
30
|
Phase 5 adds `prism init <dir>` to the existing CLI. It scaffolds a tiny TypeScript project with one selected provider and an offline mock test. Optional `--with-workflows` / `--with-evals` flags add only those packages; storage and telemetry stay opt-in elsewhere.
|
|
@@ -8,7 +8,7 @@ Core package:
|
|
|
8
8
|
|
|
9
9
|
- `@arnilo/prism` — the runtime, contracts, registries, streaming events, CLI (including `prism init`), and the `/docs` hub. `files`: `dist` (with `!dist/__tests__` and `!dist/**/*.map` negations), `docs`, `templates`, `CHANGELOG.md`. `bin`: `prism` -> `dist/cli.js`. `sideEffects`: `["dist/cli.js"]`.
|
|
10
10
|
|
|
11
|
-
First-party workspace packages (each has non-optional `@arnilo/prism@0.0.
|
|
11
|
+
First-party workspace packages (each has non-optional `@arnilo/prism@0.0.7` peer and `sideEffects: false`; RAG also peers on memory, and server also peers on workflows):
|
|
12
12
|
|
|
13
13
|
- `@arnilo/prism-provider-openai`, `@arnilo/prism-provider-openrouter`, `@arnilo/prism-provider-kimi`, `@arnilo/prism-provider-zai`, `@arnilo/prism-provider-opencode-go`, `@arnilo/prism-provider-neuralwatt` — provider adapters.
|
|
14
14
|
- `@arnilo/prism-provider-ai-sdk` — optional AI SDK `LanguageModelV4` adapter; included by the provider and all umbrellas.
|
|
@@ -62,9 +62,9 @@ Consumers install the core package for the runtime and add first-party packages
|
|
|
62
62
|
| Run the default (network-free) test suite | `npm test` |
|
|
63
63
|
| Dry-run pack core + every package | `npm run pack:dry-run` |
|
|
64
64
|
| Local mirror of the release verify gate | `npm run release:dry-run` |
|
|
65
|
-
| Validate clean tag/version/ranges and reject registry collisions | `npm run release:check -- --version 0.0.
|
|
66
|
-
| Preview deterministic publish order | `npm run release:publish -- --version 0.0.
|
|
67
|
-
| Resume interrupted tagged publication | `npm run release:publish -- --version 0.0.
|
|
65
|
+
| Validate clean tag/version/ranges and reject registry collisions | `npm run release:check -- --version 0.0.7` |
|
|
66
|
+
| Preview deterministic publish order | `npm run release:publish -- --version 0.0.7 --dry-run --allow-dirty --allow-untagged` |
|
|
67
|
+
| Resume interrupted tagged publication | `npm run release:publish -- --version 0.0.7 --resume --report release-artifacts/publish-report.json` |
|
|
68
68
|
| Full SDK readiness gate (typecheck + offline tests + pack) | `npm run sdk:ready` |
|
|
69
69
|
|
|
70
70
|
Public core import specifiers (from the root `exports` map):
|
|
@@ -101,7 +101,7 @@ A packed tarball contains only public compiled output and release files:
|
|
|
101
101
|
- Code packages ship `README.md`, `LICENSE`, and `CHANGELOG.md`; family/profile packages ship `README.md` and `CHANGELOG.md`.
|
|
102
102
|
- The core tarball additionally ships the full `docs/` directory (the docs hub) and `templates/init/` used by `prism init`.
|
|
103
103
|
- `dist/cli.js` and the `bin` link in core.
|
|
104
|
-
- **Tarball filenames.** npm strips the `@scope/` prefix, so the core package `@arnilo/prism` produces a tarball named `arnilo-prism-0.0.
|
|
104
|
+
- **Tarball filenames.** npm strips the `@scope/` prefix, so the core package `@arnilo/prism` produces a tarball named `arnilo-prism-0.0.7.tgz`; first-party packages produce `arnilo-prism-provider-<name>-0.0.7.tgz` / `arnilo-prism-compaction-<name>-0.0.7.tgz` / `arnilo-prism-coding-agent-0.0.7.tgz`; family/profile packages produce `arnilo-prism-{providers,compaction,base,code,sdk,all}-0.0.7.tgz`. The CLI bin name `prism` is unaffected by the package name (`npx prism` still works; npm allows the bin field to differ from the package name).
|
|
105
105
|
|
|
106
106
|
Excluded from every tarball by `files` negation:
|
|
107
107
|
|
|
@@ -120,9 +120,9 @@ Excluded from every tarball by `files` negation:
|
|
|
120
120
|
"name": "host-app",
|
|
121
121
|
"type": "module",
|
|
122
122
|
"dependencies": {
|
|
123
|
-
"@arnilo/prism": "0.0.
|
|
124
|
-
"@arnilo/prism-provider-openai": "0.0.
|
|
125
|
-
"@arnilo/prism-compaction-observational-memory": "0.0.
|
|
123
|
+
"@arnilo/prism": "0.0.7",
|
|
124
|
+
"@arnilo/prism-provider-openai": "0.0.7",
|
|
125
|
+
"@arnilo/prism-compaction-observational-memory": "0.0.7"
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
```
|
|
@@ -132,7 +132,7 @@ Installing the provider/compaction packages without `@arnilo/prism` present prod
|
|
|
132
132
|
```text
|
|
133
133
|
npm error code ERESOLVE
|
|
134
134
|
npm error Could not resolve dependency:
|
|
135
|
-
npm error peer @arnilo/prism@"0.0.
|
|
135
|
+
npm error peer @arnilo/prism@"0.0.7" from @arnilo/prism-provider-openai@0.0.7
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
## Implementation example
|
|
@@ -165,11 +165,11 @@ For SDK readiness, run the same one-command gate directly. It composes existing
|
|
|
165
165
|
npm run sdk:ready
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
-
Release publication derives all 30 packages from the workspace once, validates exact `0.0.
|
|
168
|
+
Release publication derives all 30 packages from the workspace once, validates exact `0.0.7` manifest/lockfile/internal ranges, then uses deterministic dependency order. `release:check` requires a clean commit tagged `v0.0.7` and rejects any existing registry version. `release:publish --resume` skips only registry versions whose internal dependency fingerprint matches the local manifest; conflicting versions fail closed. Each attempted package is written immediately to the JSON report, so a failed job can rerun safely. `--dry-run` still performs registry availability checks and invokes `npm publish --dry-run` with explicit public access, provenance, and `latest` tag.
|
|
169
169
|
|
|
170
170
|
```bash
|
|
171
|
-
npm run release:check -- --version 0.0.
|
|
172
|
-
npm run release:publish -- --version 0.0.
|
|
171
|
+
npm run release:check -- --version 0.0.7
|
|
172
|
+
npm run release:publish -- --version 0.0.7 --dry-run --allow-dirty --allow-untagged
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
`--allow-dirty` and `--allow-untagged` exist only for local preview; real publication and CI never pass them. npm registry calls occur only in these release preflight/publication commands, never build/test/package discovery.
|
|
@@ -180,7 +180,7 @@ Optional live smoke tests stay separate from SDK readiness because they require
|
|
|
180
180
|
PRISM_LIVE_PROVIDER_TESTS=1 npm run test --workspaces --if-present
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
### 0.0.
|
|
183
|
+
### 0.0.7 publish handoff
|
|
184
184
|
|
|
185
185
|
**Decision: GO after operator prerequisites below.** Code, tests, package graph, live PostgreSQL, registry availability, packed artifacts, and dependency-ordered publication dry-run passed from the Phase 14 working tree. Clean protected-branch CI, signed commit/tag, npm authentication, OIDC attestation, and actual publication remain operator/workflow prerequisites. No package was published during readiness work.
|
|
186
186
|
|
|
@@ -190,7 +190,7 @@ The existing GitHub Actions secret `NPM_TOKEN` is used only by the publish step
|
|
|
190
190
|
|
|
191
191
|
#### Release commit and tag
|
|
192
192
|
|
|
193
|
-
Merge through the protected release branch, then run these commands from a clean checkout of the protected merge commit. `git push origin v0.0.
|
|
193
|
+
Merge through the protected release branch, then run these commands from a clean checkout of the protected merge commit. `git push origin v0.0.7` is the workflow dispatch; there is no manual publish command.
|
|
194
194
|
|
|
195
195
|
```bash
|
|
196
196
|
# Prepare and push the release commit.
|
|
@@ -199,22 +199,22 @@ npm ci
|
|
|
199
199
|
npm run sdk:ready
|
|
200
200
|
git add -A
|
|
201
201
|
git diff --cached --check
|
|
202
|
-
git commit -S -m "Release 0.0.
|
|
202
|
+
git commit -S -m "Release 0.0.7"
|
|
203
203
|
git push origin HEAD
|
|
204
204
|
|
|
205
205
|
# Merge/confirm protected branch CI, then check out that exact clean merge commit.
|
|
206
206
|
test -z "$(git status --porcelain)"
|
|
207
207
|
npm ci
|
|
208
|
-
npm run release:check -- --version 0.0.
|
|
208
|
+
npm run release:check -- --version 0.0.7 --allow-untagged --report /tmp/prism-0.0.7-preflight.json
|
|
209
209
|
|
|
210
|
-
git tag -s v0.0.
|
|
211
|
-
git verify-tag v0.0.
|
|
212
|
-
test "$(git rev-parse HEAD)" = "$(git rev-list -n 1 v0.0.
|
|
213
|
-
npm run release:check -- --version 0.0.
|
|
214
|
-
git push origin v0.0.
|
|
210
|
+
git tag -s v0.0.7 -m "Prism 0.0.7"
|
|
211
|
+
git verify-tag v0.0.7
|
|
212
|
+
test "$(git rev-parse HEAD)" = "$(git rev-list -n 1 v0.0.7)"
|
|
213
|
+
npm run release:check -- --version 0.0.7 --report /tmp/prism-0.0.7-tagged-preflight.json
|
|
214
|
+
git push origin v0.0.7
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
The tag workflow's only publication command is `npm run release:publish -- --version "${GITHUB_REF_NAME#v}" --resume --report release-artifacts/publish-report.json`. Latest registry preflight returned `available` for all 30 `0.0.
|
|
217
|
+
The tag workflow's only publication command is `npm run release:publish -- --version "${GITHUB_REF_NAME#v}" --resume --report release-artifacts/publish-report.json`. Latest registry preflight returned `available` for all 30 `0.0.7` versions. Publisher order is stable and dependency-safe:
|
|
218
218
|
|
|
219
219
|
```text
|
|
220
220
|
1 @arnilo/prism
|
|
@@ -251,7 +251,7 @@ The tag workflow's only publication command is `npm run release:publish -- --ver
|
|
|
251
251
|
|
|
252
252
|
#### Interruption and resume
|
|
253
253
|
|
|
254
|
-
Do not create another tag or rerun packages manually. Re-run failed jobs for the same tag in GitHub Actions. The workflow invokes `release:publish --resume`: registry versions with matching names, versions, and internal dependency fingerprints are skipped; any mismatch stops the job. Retain `release-artifacts-v0.0.
|
|
254
|
+
Do not create another tag or rerun packages manually. Re-run failed jobs for the same tag in GitHub Actions. The workflow invokes `release:publish --resume`: registry versions with matching names, versions, and internal dependency fingerprints are skipped; any mismatch stops the job. Retain `release-artifacts-v0.0.7` and `publish-report-v0.0.7` for audit.
|
|
255
255
|
|
|
256
256
|
#### Bounded post-publish smoke
|
|
257
257
|
|
|
@@ -259,9 +259,9 @@ Download the workflow artifact and run `sha256sum -c SHA256SUMS`. Then verify al
|
|
|
259
259
|
|
|
260
260
|
```bash
|
|
261
261
|
while read -r package; do
|
|
262
|
-
test "$(npm view "$package@0.0.
|
|
263
|
-
test "$(npm view "$package" dist-tags.latest)" = "0.0.
|
|
264
|
-
npm view "$package@0.0.
|
|
262
|
+
test "$(npm view "$package@0.0.7" version)" = "0.0.7"
|
|
263
|
+
test "$(npm view "$package" dist-tags.latest)" = "0.0.7"
|
|
264
|
+
npm view "$package@0.0.7" dist.integrity >/dev/null
|
|
265
265
|
done <<'PACKAGES'
|
|
266
266
|
@arnilo/prism
|
|
267
267
|
@arnilo/prism-coding-agent
|
|
@@ -297,7 +297,7 @@ PACKAGES
|
|
|
297
297
|
consumer="$(mktemp -d)"
|
|
298
298
|
cd "$consumer"
|
|
299
299
|
npm init -y >/dev/null
|
|
300
|
-
npm install --no-audit --no-fund @arnilo/prism-all@0.0.
|
|
300
|
+
npm install --no-audit --no-fund @arnilo/prism-all@0.0.7
|
|
301
301
|
node --input-type=module <<'NODE'
|
|
302
302
|
for (const name of [
|
|
303
303
|
"@arnilo/prism", "@arnilo/prism-coding-agent", "@arnilo/prism-coding-security",
|
|
@@ -319,14 +319,14 @@ This smoke is bounded to registry metadata, imports, CLI startup, checksums, sig
|
|
|
319
319
|
|
|
320
320
|
#### Rollback limitations
|
|
321
321
|
|
|
322
|
-
npm publication is not transactional and published versions are immutable. Partial publication is a resume case, not rollback. For a confirmed systemic defect after completion, deprecate every affected `@0.0.
|
|
322
|
+
npm publication is not transactional and published versions are immutable. Partial publication is a resume case, not rollback. For a confirmed systemic defect after completion, deprecate every affected `@0.0.7`; restore `latest` to `0.0.3` only for the 13 previously published packages, and remove `latest` from the 11 first-publication packages. Exact `0.0.7` installs remain possible, so publish a fixed version promptly. Do not unpublish except for a security/legal emergency under npm policy.
|
|
323
323
|
|
|
324
324
|
## Extension and configuration notes
|
|
325
325
|
|
|
326
|
-
- **Required `@arnilo/prism` peer.** Every first-party package declares `peerDependencies: { "@arnilo/prism": "0.0.
|
|
326
|
+
- **Required `@arnilo/prism` peer.** Every first-party package declares `peerDependencies: { "@arnilo/prism": "0.0.7" }` with no `peerDependenciesMeta` (non-optional). The range stays pinned to `0.0.7` for the 0.x series and will widen to `^1.0.0` at the 1.x stable release. Inside the workspace each package also declares `"@arnilo/prism": "file:../.."` in `devDependencies` so `npm install` resolves the peer locally; that devDependency is stripped from consumer installs and is not a runtime dependency.
|
|
327
327
|
- **Public access.** All 30 manifests (24 code packages + 6 family/profile packages) declare `"publishConfig": { "access": "public" }`; the publisher also passes `--access public` explicitly because scoped packages otherwise default to restricted on first publish.
|
|
328
328
|
- **Map retention knob.** Source maps are emitted locally but stripped from tarballs by `!dist/**/*.map`. Removing that `files` negation ships maps in releases (larger tarballs, better consumer stack traces).
|
|
329
|
-
- **Release workflow.** `.github/workflows/release.yml` has four jobs. `verify` runs the full SDK readiness gate on Node 24: `npm ci`, then `npm run sdk:ready` (`npm run typecheck`, network-free `npm test`, and `npm run pack:dry-run`). `node20-compat` runs on Node 20: `npm ci`, `npm run build`, then imports every public root `exports` default target from `dist/`. This proves published-package basics under declared `engines.node >=20` without docs examples, which require Node >=22.6 native TypeScript stripping. `postgres-integration` runs the PostgreSQL suite against `pgvector/pgvector:pg16`. `publish` runs only for exact `v*` tags after all three gates, checks clean/tagged state and the complete 0.0.
|
|
329
|
+
- **Release workflow.** `.github/workflows/release.yml` has four jobs. `verify` runs the full SDK readiness gate on Node 24: `npm ci`, then `npm run sdk:ready` (`npm run typecheck`, network-free `npm test`, and `npm run pack:dry-run`). `node20-compat` runs on Node 20: `npm ci`, `npm run build`, then imports every public root `exports` default target from `dist/`. This proves published-package basics under declared `engines.node >=20` without docs examples, which require Node >=22.6 native TypeScript stripping. `postgres-integration` runs the PostgreSQL suite against `pgvector/pgvector:pg16`. `publish` runs only for exact `v*` tags after all three gates, checks clean/tagged state and the complete 0.0.7 graph, then publishes in topological order through `scripts/release.mjs`. The existing `NPM_TOKEN` GitHub secret is exposed only to the publish step; `id-token: write` also enables OIDC where configured. npm receives `--provenance --access public --tag latest`; no credential value is placed in source or output. Before publishing, CI packs all 30 tarballs, generates `SHA256SUMS`, and retains both pack manifests and artifacts for 30 days. Registry state is the resume journal: matching published packages are skipped, mismatches stop publication, and an incremental package-status report is also retained for 30 days. Local `npm run release:dry-run` delegates to `npm run sdk:ready`; local PostgreSQL coverage is `PRISM_TEST_POSTGRES_URL=... npm run test:postgres`.
|
|
330
330
|
- **Adding a package.** New workspace packages are picked up automatically by `npm run build --workspaces`, `npm test --workspaces`, `npm run pack:dry-run`, the packaging guard (`src/__tests__/packaging.test.ts`), and the install-smoke test (`src/__tests__/install-smoke.test.ts`) via the workspace glob; add the package to both tests' config arrays for explicit per-package assertions.
|
|
331
331
|
|
|
332
332
|
## Security and performance notes
|
|
@@ -349,25 +349,25 @@ npm publication is not transactional and published versions are immutable. Parti
|
|
|
349
349
|
- **Install smoke is offline.** The install-smoke test packs core + every package into a temp dir and installs tarballs with `--offline --no-audit --no-fund` into a fresh project. External dependencies are satisfied from the lockfile-backed npm cache prepared by `npm ci`; any attempted uncached registry fetch fails the gate.
|
|
350
350
|
- **Offline test budget.** The default `npm test` (no `PRISM_LIVE_PROVIDER_TESTS`) is pinned at **< 60s on Node 20** with a measured local baseline of ~45s (build ~18s + network-free tests/workspace tests/packaging smoke ~27s). The full CI `sdk:ready` gate runs on Node 24 because docs tests execute `examples/*.ts` via native TypeScript stripping. `npm run sdk:ready` also runs typecheck and pack dry-run, so it is allowed to exceed the `npm test` budget while remaining network-free. The CI `sdk:ready` step has `timeout-minutes: 5` as a hang backstop; the separate Node 20 compatibility step has `timeout-minutes: 3`. The budget was raised from 30s after the default suite grew to include every first-party package, offline install smoke, packaging guards, docs examples, and workspace tests; optimize before raising it again.
|
|
351
351
|
|
|
352
|
-
### 0.0.
|
|
352
|
+
### 0.0.7 dependency audit decision (2026-07-19)
|
|
353
353
|
|
|
354
|
-
`npm audit --audit-level=high` reports 0 vulnerabilities and `npm ls --all --depth=0` resolves the exact 30-package `0.0.
|
|
354
|
+
`npm audit --audit-level=high` reports 0 vulnerabilities and `npm ls --all --depth=0` resolves the exact 30-package `0.0.7` graph. No Phase 2 dependency was added. Native `better-sqlite3` remains the sole install-script dependency and stays in the opt-in SQLite package.
|
|
355
355
|
|
|
356
|
-
### 0.0.
|
|
356
|
+
### 0.0.7 release-candidate verification — 2026-07-19
|
|
357
357
|
|
|
358
|
-
Phase
|
|
358
|
+
Phase 2 validation ran from this working tree without creating a release commit/tag or publishing. Clean protected-branch/tag checks remain mandatory in the handoff above.
|
|
359
359
|
|
|
360
360
|
| Gate | Result |
|
|
361
361
|
| --- | --- |
|
|
362
|
-
| Node 24 full matrix | `npm run sdk:ready` passed inside its five-minute backstop: 1,
|
|
362
|
+
| Node 24 full matrix | `npm run sdk:ready` passed inside its five-minute backstop: 1,785 tests (1,760 pass, 25 explicit live skips, 0 fail), full typecheck/build, docs/export/install-smoke tests, and 30 dry-run packs. |
|
|
363
363
|
| Node 20 compatibility | Docker Node 20.20.2 built all workspaces and imported every public root export target. |
|
|
364
364
|
| PostgreSQL | Fresh `pgvector/pgvector:pg16` container: 17 session-store plus 14 memory/pgvector checks passed with 0 skips/failures. |
|
|
365
|
-
| Packed consumer | Offline install-smoke packed all 30 exact `0.0.
|
|
366
|
-
| Artifact contents | All 30 dry-run packs passed; core is
|
|
367
|
-
| Registry and order | Public-registry preflight found all 30 `@arnilo/*@0.0.
|
|
365
|
+
| Packed consumer | Offline install-smoke packed all 30 exact `0.0.7` tarballs into a fresh consumer, imported public surfaces, ran packed integration/composition journeys, and ran the generated `prism init` project. |
|
|
366
|
+
| Artifact contents | All 30 dry-run packs passed; core is 241 files, 466.5 kB packed, and 1.7 MB unpacked (+11 files, +21.0 kB packed versus 0.0.6). Packaging guards reject tests, maps, source, plans, internal artifacts, and real-looking secrets. |
|
|
367
|
+
| Registry and order | Public-registry preflight found all 30 `@arnilo/*@0.0.7` versions available. Dependency-ordered `release:publish --dry-run` completed 30/30 with explicit public/latest/provenance arguments; no publish occurred. Core uses npm's valid `bin` path form `dist/cli.js`. |
|
|
368
368
|
| Supply chain | `npm audit --audit-level=high`: 0 vulnerabilities. `npm ls --all --depth=0`: clean. |
|
|
369
|
-
| Provenance | Signed npm provenance is generated only by real OIDC publication from the clean signed `v0.0.
|
|
370
|
-
|
|
|
369
|
+
| Provenance | Signed npm provenance is generated only by real OIDC publication from the clean signed `v0.0.7` tag workflow. |
|
|
370
|
+
| Live prerequisites | No provider credentials or external A2A endpoint were configured, so those explicit smoke tests remain skipped. `PRISM_TEST_KEYCHAIN=1` passed its credential-store round trip (27 tests, 0 failures). A disposable `pgvector/pgvector:pg16` run passed 17 persistence and 14 memory checks. |
|
|
371
371
|
|
|
372
372
|
The temporary PostgreSQL container and local dry-run report are not release artifacts. CI recreates and retains package manifests, checksums, and the publication report.
|
|
373
373
|
|
package/docs/runs-and-usage.md
CHANGED
|
@@ -35,13 +35,40 @@ Set the ledger and optional ownership scope/idempotency key on the agent or the
|
|
|
35
35
|
|
|
36
36
|
| Method | Record | When called |
|
|
37
37
|
| --- | --- | --- |
|
|
38
|
-
| `appendRun` | `RunRecord` | After run starts (`running`) and again at finish (`succeeded`/`failed`/`aborted`). |
|
|
38
|
+
| `appendRun` | `RunRecord` | After run starts (`running`) and again at finish (`suspended`/`denied`/`succeeded`/`failed`/`aborted`). |
|
|
39
39
|
| `appendEvent` | `AgentEventRecord` | After every emitted `AgentEvent`, after redaction. |
|
|
40
40
|
| `appendToolCall` | `ToolCallRecord` | For each tool-call `started`, `progress`, `finished`, `error`, and `blocked` transition. |
|
|
41
41
|
| `appendUsage` | `UsageRecord` | Once per terminal provider turn (`scope: "provider_turn"`) and once for the O(turns) aggregate (`scope: "run_total"`). |
|
|
42
42
|
|
|
43
43
|
All methods may be sync or async (`void | Promise<void>`). The runtime awaits them at safe boundaries, so a slow adapter blocks the run.
|
|
44
44
|
|
|
45
|
+
## Run limits
|
|
46
|
+
|
|
47
|
+
`RunLimits` bounds one `session.run()` across turns, provider attempts, tool rounds/calls, elapsed wall time, request/response bytes, token usage, and optional cost. Configure defaults on `AgentConfig.limits`; `RunOptions.limits` can only narrow an agent-configured value.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
await session.run("Summarize", {
|
|
51
|
+
limits: {
|
|
52
|
+
maxTurns: 4,
|
|
53
|
+
maxProviderAttempts: 6,
|
|
54
|
+
maxToolCalls: 8,
|
|
55
|
+
maxWallTimeMs: 30_000,
|
|
56
|
+
maxTotalTokens: 12_000,
|
|
57
|
+
maxCost: { amount: 0.25, currency: "USD" },
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Defaults/hard caps are respectively: turns 16/64, provider attempts 24/256, tool rounds 8/64, tool calls 32/256, wall time 120 seconds/30 minutes, request and response bytes 8/64 MiB, input tokens 40,000/1,000,000, output tokens 10,000/250,000, total tokens 50,000/1,000,000, and cost 10,000 currency units. Integer values must be positive safe integers. Cost needs a finite non-negative amount plus one currency; when cost is limited, absent, non-finite, or mixed-currency provider cost fails closed.
|
|
63
|
+
|
|
64
|
+
Prism charges turns before assembly, provider attempts and request bytes before generation, response bytes per provider event, tool rounds before a batch, tool calls before dispatch, and usage before another turn. A breach stops new work, aborts active work through the run signal, emits exactly one redacted `run_limit_exceeded` event/ledger row, and throws `AgentRunError` with `result.limit` (`limit`, `maximum`, `observed`, optional `currency`). Provider-reported token/cost totals arrive after generation, so that completed provider turn can be the unavoidable overshoot boundary.
|
|
65
|
+
|
|
66
|
+
`createRunLimitTracker()` and `resolveRunLimits()` are public for adapters that need the same validation and accounting semantics. Workflow agent nodes forward `RunWorkflowOptions.limits`; supervisor delegation narrows its step/tool/token/timeout budget into core limits; MCP tool calls use a per-call tracker.
|
|
67
|
+
|
|
68
|
+
## Durable run state
|
|
69
|
+
|
|
70
|
+
`RunOptions.runState` writes a bounded, versioned checkpoint only at a safe interruption boundary. Its counters and absolute deadline resume with the run, while transcript history stays in `SessionStore` by session/leaf reference. `AgentRunResult.runState` exposes only redacted identity/status/version data; `interruption` excludes tool arguments. See [Agent/session runtime](agent-session-runtime.md#durable-interruption).
|
|
71
|
+
|
|
45
72
|
## Outputs / response / events
|
|
46
73
|
|
|
47
74
|
The adapter receives these record shapes:
|
|
@@ -56,7 +83,7 @@ The adapter receives these record shapes:
|
|
|
56
83
|
| `model` | Resolved model config for the run. |
|
|
57
84
|
| `provider` | Resolved provider id for the run. |
|
|
58
85
|
| `idempotencyKey` | Optional host key. |
|
|
59
|
-
| `status` | `queued` \| `running` \| `succeeded` \| `failed` \| `aborted`. |
|
|
86
|
+
| `status` | `queued` \| `running` \| `suspended` \| `denied` \| `succeeded` \| `failed` \| `aborted`. |
|
|
60
87
|
| `startedAt` / `finishedAt` | ISO timestamps. |
|
|
61
88
|
| `abortReason` | Set when status is `aborted`. |
|
|
62
89
|
| `error` | `ErrorInfo` when status is `failed`. |
|
package/docs/server.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
`@arnilo/prism-server` exposes explicitly selected agents and workflows through one framework-free `(Request) => Promise<Response>` handler. It supports direct agent results, bounded agent/workflow SSE, durable workflow start/enqueue/status/cancel/resume/replay, ownership-scoped schedules, host authorization, ownership propagation, redaction, and resource ceilings.
|
|
5
|
+
`@arnilo/prism-server` exposes explicitly selected agents and workflows through one framework-free `(Request) => Promise<Response>` handler. It supports direct agent results, bounded agent/workflow SSE, opt-in durable agent status/resume, durable workflow start/enqueue/status/cancel/resume/replay, ownership-scoped schedules, host authorization, ownership propagation, redaction, and resource ceilings.
|
|
6
6
|
|
|
7
7
|
No listener starts on import. Empty `agents`/`workflows` maps expose nothing. Authentication, authorization, route selection, durable stores, TLS, rate limiting, and framework/serverless adaptation remain host-owned.
|
|
8
8
|
|
|
@@ -17,6 +17,7 @@ Use `AgentSession` or workflow APIs directly for in-process applications. Do not
|
|
|
17
17
|
```ts
|
|
18
18
|
const handler = createPrismHandler({
|
|
19
19
|
agents?: Record<string, Agent | PrismAgentExposure>,
|
|
20
|
+
agentRuns?: Record<string, PrismAgentRunExposure>, // explicit durable status/resume only
|
|
20
21
|
workflows?: Record<string, PrismWorkflowExposure>,
|
|
21
22
|
schedules?: WorkflowSchedules | ((authorization, signal) => WorkflowSchedules),
|
|
22
23
|
authorize: async ({ request, operation, capabilityId }) => false | {
|
|
@@ -38,6 +39,8 @@ At least one non-empty ownership field must come from `authorize()`. Request JSO
|
|
|
38
39
|
| --- | --- | --- |
|
|
39
40
|
| `POST /prism/agents/:id/runs` | `agent.run` | `{ "input": string | Message | Message[] }` |
|
|
40
41
|
| `POST /prism/agents/:id/stream` | `agent.stream` | same; SSE response |
|
|
42
|
+
| `GET /prism/agents/:id/runs/:runId` | `agent.status` | none; redacted public state/version only |
|
|
43
|
+
| `POST /prism/agents/:id/runs/:runId/resume` | `agent.resume` | `{ "decision": "approve" | "deny", "expectedVersion": number }` |
|
|
41
44
|
| `POST /prism/workflows/:id/runs` | `workflow.run` | `{ "input": unknown, "runId"?: string }` |
|
|
42
45
|
| `POST /prism/workflows/:id/stream` | `workflow.stream` | same; SSE response |
|
|
43
46
|
| `POST /prism/workflows/:id/enqueue` | `workflow.enqueue` | `{ "input": unknown, "runId"?: string }`; returns `202` queued handle |
|
|
@@ -125,7 +128,7 @@ Default/hard ceilings:
|
|
|
125
128
|
- SSE uses bounded upstream subscriber queues. Consumer cancellation aborts owned work by default and releases concurrency; set `disconnectAborts: false` only when the host deliberately owns background completion.
|
|
126
129
|
- Source inputs/resource URLs remain host responsibilities and use existing resource/media SSRF policies. Server package does not fetch URLs.
|
|
127
130
|
- Schedule routes never accept ownership from JSON. Services carry mandatory ownership and explicit workflow/calculator registries; route authorization cannot broaden either. Replay applies workflow ownership/hash/approval checks.
|
|
128
|
-
-
|
|
131
|
+
- Agent status/resume routes exist only for keys in `agentRuns`. Supply one core `createAgentRunLifecycle({ checkpoints, resolveAgent })` capability per selected agent; its resolver returns current `{ agent, definitionRevision }`. It reuses core checkpoint parsing/CAS/fingerprint checks, returns only public state/version, and needs a durable `SessionStore` as well as checkpoints for restart-safe resume. Empty/default configuration adds no agent lifecycle route, polling, or server cache.
|
|
129
132
|
|
|
130
133
|
A2A routes are not added to `createPrismHandler()`. Install `@arnilo/prism-supervisor` and explicitly mount `createA2AHandler()` when protocol interoperability is required; this keeps cards and remote invoke absent from ordinary Prism servers.
|
|
131
134
|
|
package/docs/tools.md
CHANGED
|
@@ -53,6 +53,7 @@ When multiple filters are provided, each non-empty allow list must include the t
|
|
|
53
53
|
| `filter` | Optional exact allow/deny filter or ordered filters. |
|
|
54
54
|
| `middleware` | Optional `MiddlewareRegistry`; `tool_call` runs before validation/execution and `tool_result` runs after execution. |
|
|
55
55
|
| `validate` | Optional host validator returning `void`, a message string, or `ErrorInfo`. A non-`void` return blocks dispatch with reason `validation_failed` (redacted). Runs after the permission assertion and before `tool.execute()`. |
|
|
56
|
+
| `beforeExecute` | Optional adapter policy check immediately before the side effect; a rejection blocks dispatch with `execution_denied`. Workflows use it to retain `ExecutionPolicy` attribution after core guardrails. |
|
|
56
57
|
| `emit` | Optional `AgentEvent` callback for lifecycle events. |
|
|
57
58
|
| `secrets` | Known secret values to redact from thrown tool errors. |
|
|
58
59
|
| `redactor` | Optional `SecretRedactor` used to redact tool-call ledger records. |
|
|
@@ -244,6 +245,10 @@ createJsonSchemaToolArgumentValidator({
|
|
|
244
245
|
});
|
|
245
246
|
```
|
|
246
247
|
|
|
248
|
+
## Guardrails
|
|
249
|
+
|
|
250
|
+
`DispatchToolCallOptions.guardrails` evaluates `tool_input` after `tool_call` middleware normalization and before lookup, permission, validation, execution policy, or side effect. `tool_output` evaluates raw completed results before redaction, event emission, ledger rows, and transcript append. A block returns a blocked result; tripwire fails the enclosing run. See [Guardrails](guardrails.md).
|
|
251
|
+
|
|
247
252
|
## Related APIs
|
|
248
253
|
|
|
249
254
|
- [Agent/session runtime](agent-session-runtime.md): dispatches complete provider tool calls through the host-active tool harness and returns tool results on the next provider turn.
|
|
@@ -258,4 +263,4 @@ createJsonSchemaToolArgumentValidator({
|
|
|
258
263
|
- [MCP client bridge](mcp-tools.md): optional `@arnilo/prism-mcp` remote tool mapping.
|
|
259
264
|
- [Coding agent tools](coding-agent-tools.md): optional first-party `@arnilo/prism-coding-agent` `shell`/`read`/`write`/`edit` tools a host registers into this harness.
|
|
260
265
|
|
|
261
|
-
`DispatchToolCallOptions.
|
|
266
|
+
`DispatchToolCallOptions.trust` and `.permission` run before validation or `execute()`; denial emits `tool_execution_blocked`. Middleware cannot bypass either guard. `AgentConfig.validator`/`RunOptions.validate` run after these guards; their output is redacted through the active `SecretRedactor`. `createSecureAgent()` requires all three seams plus non-empty schemas and durable pre-tool approval. Prism does not sandbox tools. See [Security/auth/trust](settings-auth-trust-security.md).
|
package/docs/workflows.md
CHANGED
|
@@ -288,6 +288,7 @@ Use workflows for known, durable, replayable graphs. Use optional supervisor del
|
|
|
288
288
|
- Examples: `examples/workflow-research-and-review.ts`, `examples/workflow-parallel-research.ts`, `examples/workflow-tool-approval.ts`, `examples/workflow-multimodal-document.ts`, `examples/workflow-sqlite-resume.ts`, `examples/workflow-postgres-resume.ts`, `examples/workflow-event-sink.ts`, `examples/workflow-rpc-cancel.ts`, `examples/workflow-distributed-coordinator.ts` — offline runnable demos; PostgreSQL safely skips unless `PRISM_TEST_POSTGRES_URL` is set.
|
|
289
289
|
- [Workflow orchestration primitives](workflow-orchestration-primitives.md): Task 0–1 inventory and locked adapter contracts
|
|
290
290
|
- [Agent/session runtime](agent-session-runtime.md): `AgentSession.run()`/`stream()`, abort, subscribe
|
|
291
|
+
- [Guardrails](guardrails.md): `RunWorkflowOptions.guardrails` routes tool nodes through core dispatch before policy and side effects.
|
|
291
292
|
- [Supervisor delegation](supervisors.md): bounded dynamic child selection.
|
|
292
293
|
- [Agent events](agent-events.md): core `AgentEvent` wrapped by `agent_event`
|
|
293
294
|
- [Session stores and branching](session-stores-and-branching.md): session `leafId` reuse on resume
|