@arnilo/prism 0.6.0 → 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 +44 -5
- package/README.md +10 -10
- package/dist/agent-definitions.js +1 -0
- 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 +14 -0
- package/dist/agent-session/session.js +40 -3
- 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/context-budget.d.ts +20 -1
- package/dist/context-budget.js +10 -1
- package/dist/contracts-core/agent.d.ts +7 -0
- 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 +9 -6
- package/dist/index.js +5 -4
- package/dist/input.d.ts +13 -1
- package/dist/input.js +40 -1
- package/dist/secure-agent.d.ts +2 -0
- package/dist/secure-agent.js +6 -1
- 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 +2 -1
- package/docs/ag-ui.md +5 -3
- package/docs/agent-definitions.md +9 -1
- package/docs/agent-events.md +4 -1
- package/docs/agent-session-runtime.md +6 -6
- package/docs/attention-compiler.md +272 -0
- 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/conversations.md +1 -1
- package/docs/dev-inspector.md +4 -0
- package/docs/device-adapters.md +1 -0
- package/docs/document-reader.md +11 -3
- package/docs/documents.md +10 -2
- package/docs/enterprise-postgres-state.md +2 -2
- package/docs/evaluations.md +168 -4
- package/docs/execution-timeline.md +180 -0
- 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 +37 -1
- package/docs/host-compositions.md +147 -0
- package/docs/hosted-sandboxes.md +94 -0
- package/docs/index.md +58 -39
- package/docs/input-and-prompt-assembly.md +1 -0
- package/docs/knowledge-sync.md +84 -0
- package/docs/language-intelligence.md +1 -1
- 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 +1 -1
- package/docs/migrate-to-0.6.md +1 -0
- package/docs/migrate-to-0.7.md +345 -0
- package/docs/migration.md +13 -1
- package/docs/model-routing.md +79 -4
- package/docs/multi-agent-patterns.md +20 -6
- package/docs/observability.md +52 -1
- package/docs/operations.md +13 -1
- package/docs/options-index.md +13 -1
- package/docs/peer-dependencies.md +6 -4
- 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 +1 -1
- package/docs/provider-packages.md +22 -22
- package/docs/providers/bedrock.md +71 -7
- package/docs/providers/openai.md +1 -1
- package/docs/rag.md +24 -8
- package/docs/realtime-voice.md +87 -0
- package/docs/release-and-install.md +36 -34
- package/docs/runs-and-usage.md +3 -2
- package/docs/server.md +5 -3
- package/docs/speech.md +2 -0
- package/docs/supervisors.md +33 -5
- package/docs/testing.md +1 -1
- package/docs/thinking-and-reasoning.md +3 -1
- package/docs/tools.md +6 -5
- package/docs/web-tools.md +2 -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 +1 -1
- 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
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# Release 0.7.0 — Primitive, Compatibility, and Integration-Boundary Review
|
|
2
|
+
|
|
3
|
+
Plan: [073-Release-0-7-0-Host-Completeness.md](../../plans/073-Release-0-7-0-Host-Completeness.md) Task 1
|
|
4
|
+
Baseline: Released `0.6.0`
|
|
5
|
+
Target: Release `0.7.0` (Host Completeness, Evidence, and Capability Boundaries)
|
|
6
|
+
Date: 2026-09-13
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. Executive Summary & Review Scope
|
|
11
|
+
|
|
12
|
+
This review freezes the architectural primitives, compatibility contracts, performance budgets, and security boundaries for Release **0.7.0**.
|
|
13
|
+
|
|
14
|
+
The release addresses the **three integration traps** identified in 0.6.0 (Traps A, B, C) and delivers the **fourteen P0–P2 host completeness recommendations** (R01–R06, R08–R14), integrating:
|
|
15
|
+
- **R07 / R15** from [Plan 072 — Host Eval and Observability Cockpit](../../plans/072-Host-Eval-And-Observability-Cockpit.md) (frozen in [`docs/_evidence/phase72-primitive-review.md`](../_evidence/phase72-primitive-review.md)),
|
|
16
|
+
- **R16** from [Plan 077 — Work-Scope Memory Index](../../plans/077-Work-Scope-Memory-Index.md) (`WorkScope` / `projectWorkMemory`),
|
|
17
|
+
- **R17** from [Plan 074 — Attention Compiler](../../plans/074-Attention-Compiler.md) (`assembleTurn`, cache-stable attention ratio gate, sticky stubs).
|
|
18
|
+
|
|
19
|
+
### Universal Invariants Upheld
|
|
20
|
+
|
|
21
|
+
1. **Fail closed at trust boundaries**: Identity validation, tenant scoping, document authorization, and sandbox isolation fail closed. Never weaken fail-closed assertions.
|
|
22
|
+
2. **No new dependencies without explicit plan authorization**: Root remains zero runtime dependencies. Optional SDKs live strictly as optional peer dependencies within owning integration packages, never loaded at import or module evaluation time.
|
|
23
|
+
3. **No second agent loops or duplicated control planes**: Reuse existing core primitives (`Agent`, `AIProvider`, `ModelRouter`, `CheckpointStore`, `LeaseStore`, `ToolEffectStore`, `RunLedger`, `ProcessSessions`, `DeviceAdapter`).
|
|
24
|
+
4. **Byte hard caps preserved**: All process-safety limits (`maxRequestBytes`, `maxResponseBytes`, `maxEventBytes`, `maxResultBytes`) remain immutable ceilings.
|
|
25
|
+
5. **Truth in capability and state**: No simulated or mock-only claims for production infrastructure. Unobserved or ambiguous external mutations remain explicitly `unknown`, never fabricated as succeeded or zero-cost.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 2. Coverage Ledger & Primitive Mapping
|
|
30
|
+
|
|
31
|
+
Every review row is mapped below to its reusable baseline primitives, implementation owner, generic capability gap, dependencies, and required release evidence.
|
|
32
|
+
|
|
33
|
+
| ID | Title | Reusable Baseline Primitives | Implementation Owner | Generic Capability Gap | Dependencies | Release Evidence |
|
|
34
|
+
|---|---|---|---|---|---|---|
|
|
35
|
+
| **Trap A** | Parsed ACP MCP destination allow-list | `packages/acp-agent/src/index.ts`, `selectMcpServers` | `packages/acp-agent/src/` | URL-parsed origin and strict path-segment subtree matching | None (Node `URL`) | Origin lookalike rejection, traversal/separator refusal, port/scheme validation |
|
|
36
|
+
| **Trap B** | Router sync facade fail-loud governance | `createModelRouter`, `providerSource` | `packages/prism-core/src/governance/model-router/` | Fast synchronous check throwing `ERR_PRISM_MODEL_ROUTER_ASYNC_REQUIRED` when budget/circuit/rateLimit configured | None | Sync bypass rejection on budget/circuit, async `resolve` passes |
|
|
37
|
+
| **Trap C** | ACP real model/provider configuration | `PrismAcpAgentConfig`, `createSpawnableAgent` | `packages/acp-agent/src/` | Validated `model` + `credentialRef` config parsing, explicit mock opt-in | `@arnilo/prism-providers` | Direct provider invocation via ACP, unknown provider refusal, credential canary check |
|
|
38
|
+
| **R01** | Governed provider invocation & aggregate accounting | `ModelRouter.resolve`, `recordUsage`, `AIProvider` | `packages/prism-core/src/governance/model-router/` | `GovernedAIProvider` adapter wrapping select, reserve, request policy, invoke, settle | None | Zero-budget denial, stream settlement, duplicate settlement idempotency |
|
|
39
|
+
| **R01** | Aggregate task/tenant accounting | `PostgresModelRouterStateStore`, `stateKey` | `packages/prism-core/src/enterprise/postgres/model-router/` | Cross-call aggregate task/tenant dimensions; reservation renewal & fencing | PostgreSQL driver | Concurrent 32-attempt allocation under cap, non-session tool/embedding charging |
|
|
40
|
+
| **R02** | Durable business-action drafts & review | `WorkIdempotencyStore`, `ArtifactBodyStore` | `packages/prism-core/src/integrations/work/` | Revision-bound draft state machine, payload digest verification, expiry | Persistence backends | Draft edit invalidates prior approval, resume executes exact revision, unknown outcome logged |
|
|
41
|
+
| **R02** | Editable durable approvals (AG-UI/server) | `RunDecision`, `approveWithEdits`, AG-UI handler | `packages/ag-ui/src/`, `packages/prism-core/src/runtime/server/` | `approveWithEdits` protocol capability, CAS expectedVersion validation | `@arnilo/prism-ag-ui` | Edited approval round-trip, invalid schema denial, quorum invalidation |
|
|
42
|
+
| **R03** | Docker process sessions & workspace coherence | `DockerSandboxSession`, `createProcessSessions` | `packages/prism-coding-tools/src/security/`, `agent/process/` | `startProcess` on `DockerSandboxSession`, attested container reattach | Docker CLI | Watcher I/O, kill/signal, registry restart recovery without duplicate spawn |
|
|
43
|
+
| **R03** | Hosted sandbox (E2B) | `DisposableSandbox`, `ProcessSandboxBackend` | `packages/prism-coding-tools/src/security/e2b-sandbox.ts` | E2B adapter implementing `DisposableSandbox` + `startProcess` + snapshot resume | `@e2b/code-interpreter` (optional peer) | E2B execution, pause/resume, snapshot integrity, cleanup on abort |
|
|
44
|
+
| **R04** | Document authorization in RAG | `retrieveContext`, `VectorStore`, `lexicalQuery` | `packages/memory/src/rag/`, `packages/memory/src/postgres.ts` | Principal/group ACL constraint injected into vector/lexical query legs | None / pgvector | Pre-ranking candidate exclusion, post-topK non-starvation, ACL update revocation |
|
|
45
|
+
| **R04** | Incremental enterprise-source sync (Drive) | `RagStore`, `Chunker`, `VectorMemory` | `packages/memory/src/rag/sync.ts`, `connectors/google-drive.ts` | Change-token pagination (`newStartPageToken`), tombstone deletion, ACL sync | Google Drive API / `@googleapis/drive` | Incremental change ingestion, tombstone deletion, stale-token recovery |
|
|
46
|
+
| **R05** | Validated host compositions | `createSecureAgent`, `createAgent` | `templates/personal-assistant/`, `templates/business-worker/` | Validated production wiring templates & static composition inspection | Internal packages | Packed npm install smoke, unredacted secret check, memory-persistence refusal |
|
|
47
|
+
| **R06** | Fair background admission & drain | `createWorkflowCoordinator`, `PrismDrainController` | `packages/prism-core/src/runtime/server/drain.ts`, `workflows/coordinator.ts` | Multi-tenant fair queuing, graceful drain deadline, active run tracking | None | 503 on drain admit, queue fairness across tenants, clean in-flight completion |
|
|
48
|
+
| **R07** | Behavioral & trajectory evaluation | `EvaluationTrace`, `runExperiment` (Plan 072) | `packages/prism-coding-tools/src/dev/` (inspector wiring) | Wiring 072 trajectory & scenario eval into inspector UI and release gates | Plan 072 artifacts | Scenario gate pass, trajectory deviation scoring, inspector run visualization |
|
|
49
|
+
| **R15** | Execution timeline & workflow graph | `ExecutionTimeline`, `serializeWorkflowGraph` (Plan 072) | Plan 072 implementation | Consumed by 0.7.0 release journeys and Dev Inspector | Plan 072 artifacts | Timeline step rendering, node overlay, trace aggregation |
|
|
50
|
+
| **R16** | Work-scope session memory index | `WorkScope`, `projectWorkMemory` (Plan 077) | Plan 077 implementation | Parallel session memory index; task isolation until explicit promote | Plan 077 artifacts | Task isolation test, promotion round-trip, scope boundary enforcement |
|
|
51
|
+
| **R17** | Attention compiler & compaction trigger | `assembleTurn`, ratio gate (Plan 074) | Plan 074 implementation | Cache-stable prompt assembly, sticky stub compaction | Plan 074 artifacts | Ratio gate no-op under ceiling, sticky stubs above ceiling |
|
|
52
|
+
| **R08** | Cross-layer memory correction & provenance | `ObservationalMemory`, `VectorMemory` | `packages/memory/src/memory.ts`, `compaction/observational-memory/` | Point correction, tombstoning, cross-layer provenance lineage, sharing grant | None / Postgres | Correct memory update, tombstone tombstoning in search, lineage query |
|
|
53
|
+
| **R09** | External coding runtime delegation | `Supervisor`, `SubagentTool` | `packages/prism-coding-tools/src/agent/delegated/` | Typed adapters for Codex, Claude, Copilot, Gemini CLI, Cursor | Optional vendor SDKs | Approval interception, tool call containment, session resume |
|
|
54
|
+
| **R10** | Semantic artifact diffs & evidence citations | `ArtifactBodyStore`, `patchDocument` | `packages/office/src/documents/diff.ts`, `packages/web-tools/src/evidence.ts` | Structural document diffs, evidence citation attestation and OCR grounding | None | Semantic diff visualization, citation verification, tampering rejection |
|
|
55
|
+
| **R10** | Scanned document layout & OCR (Mistral) | `DocumentReader`, `parseDocument` | `packages/prism-coding-tools/src/document-reader/mistral-ocr.ts` | External layout analysis and OCR extraction adapter | Mistral AI API | PDF table extraction, layout preservation, fallback handling |
|
|
56
|
+
| **R11** | Per-run tool narrowing & capability invalidation | `createToolRegistry`, `RunOptions` | `src/contracts-protocol.ts`, `src/tools.ts`, `packages/mcp/` | `RunOptions.toolAllowList`, dynamic tool filtering, remote capability cache refresh | None | Hidden tool schema, rejection of unauthorized tool call, MCP change invalidation |
|
|
57
|
+
| **R12** | Native Bedrock Converse & ConverseStream | `bedrockProvider` (0.6.0 wraps `/openai/v1`) | `packages/prism-providers/src/bedrock/` | Native AWS Bedrock Converse & ConverseStream protocol adapter with SigV4 | `@aws-sdk/client-bedrock-runtime` | Native Converse tool round, ConverseStream event decode, token counting |
|
|
58
|
+
| **R13** | Native Vertex Gemini with workload identity | `vertexProvider` (0.6.0 wraps OpenAI-compat) | `packages/prism-providers/src/vertex/` | Native Google Vertex Gemini `generateContent` & `streamGenerateContent` | `@google-cloud/vertexai` | Native content parts, tool round, Google ADC credential rotation |
|
|
59
|
+
| **R13** | Thin Python & .NET remote clients | `PrismServer` HTTP / SSE routes | `clients/python/`, `clients/dotnet/` | Remote typed clients for run execution, SSE stream consumption, and approval | Python stdlib, .NET HttpClient | Stream framing, reconnection with Last-Event-ID, edited approval payload |
|
|
60
|
+
| **R13** | Authenticated Slack & Teams recipes | `PrismServer` webhooks & decision routes | `examples/channels/slack/`, `examples/channels/teams/` | Webhook verification (Slack HMAC, Teams JWT), interactive review cards | Optional Bot SDKs | Forged signature denial, interactive card approval, draft re-review |
|
|
61
|
+
| **R14** | Governed realtime voice orchestration | `RealtimeSession`, `DeviceAdapter` | `packages/prism-core/src/runtime/realtime/`, `packages/prism-providers/src/openai/realtime.ts` | Realtime tool calling bridge, microphone admission, barge-in cancellation | None (WebSocket) | Mic admission check, interruption cancellation, audio privacy retention |
|
|
62
|
+
| **Release** | Integrated journeys, truth & publish | Release tooling, packaging, gates | `scripts/`, `docs/`, `packages/*/` | Lockstep 0.7.0 cut, generated package truth, live matrix evidence | Node 22/24 | Clean build, packaging gate pass, live matrix green, dry-run publish |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 3. Reference Integration Matrix & Version-Selection Rules
|
|
67
|
+
|
|
68
|
+
Prism adheres strictly to a zero-eager-dependency policy: optional third-party integrations must never bloat package install size or trigger unreviewed imports.
|
|
69
|
+
|
|
70
|
+
| Domain | Selected Reference Implementation | Vendor / Package Identifier | Pinning & Version Selection Rule | Operational Role & Boundary |
|
|
71
|
+
|---|---|---|---|---|
|
|
72
|
+
| **Hosted Sandbox** | E2B | `@e2b/code-interpreter` | Pinned to `^1.0.0` as optional peer in `@arnilo/prism-coding-tools`. Evaluated only when host passes `createE2bSandbox`. | Untrusted ephemeral execution environment with filesystem snapshotting. Network strictly egress-controlled. |
|
|
73
|
+
| **Enterprise Source** | Google Drive | `@googleapis/drive` (or native fetch REST v3) | Google Drive API v3. Optional peer or direct REST fetch in `@arnilo/prism-memory`. | Document knowledge source. Sync uses `changes.list` with `startPageToken` and ACL sync. |
|
|
74
|
+
| **Layout / OCR** | Mistral OCR | `@mistralai/mistralai` (or native fetch) | Mistral Document AI API (`mistral-ocr-latest`). Optional peer in `@arnilo/prism-coding-tools`. | Scanned PDF / complex image layout parser. Output ingested as structured Markdown blocks. |
|
|
75
|
+
| **Delegation: OpenAI** | OpenAI Codex | `@openai/codex` (or direct app-server) | Official OpenAI Codex thread SDK. Pinned peer in `@arnilo/prism-coding-tools`. | Cloud coding agent delegation via `startThread` / `resumeThread`. Tool execution approvals intercepted. |
|
|
76
|
+
| **Delegation: Anthropic** | Claude Code / Agent SDK | `@anthropic-ai/claude-code` | Stable Agent SDK V1 (`query`, `canUseTool`, `options.resume`). No unstable V2. | Local/cloud coding agent delegation with explicit tool permission callbacks. |
|
|
77
|
+
| **Delegation: GitHub** | GitHub Copilot | `@github/copilot-sdk` | Official Copilot Workspace/CLI SDK. Optional peer in `@arnilo/prism-coding-tools`. | Repo-scoped coding delegation. Enforces GitHub enterprise auth & token boundary. |
|
|
78
|
+
| **Delegation: Google** | Google Gemini CLI | `@google-gemini/gemini-cli` | Official Gemini CLI SDK. Pinned peer in `@arnilo/prism-coding-tools`. | Local workspace CLI agent delegation. |
|
|
79
|
+
| **Delegation: Cursor** | Cursor SDK | `@cursor/sdk` (or local CLI engine) | Cursor TypeScript SDK / local engine. Pinned peer in `@arnilo/prism-coding-tools`. | Editor-bound workspace task delegation. |
|
|
80
|
+
| **Cloud Provider: AWS** | AWS Bedrock | `@aws-sdk/client-bedrock-runtime` | Pinned `^3.700.0` optional peer in `@arnilo/prism-providers`. | Native Converse & ConverseStream endpoints. Uses SigV4 request signing and AWS event streams. |
|
|
81
|
+
| **Cloud Provider: GCP** | Google Vertex AI | `@google-cloud/vertexai` | Pinned `^1.9.0` optional peer in `@arnilo/prism-providers` (or direct REST). | Native Gemini `generateContent` & `streamGenerateContent` with Google ADC credentials. |
|
|
82
|
+
| **Remote Client: Python** | `prism-agent-client` | `clients/python` | Target Python `>= 3.10`. Zero runtime dependencies outside Python standard library (`urllib.request`, `json`). | Remote client for starting runs, streaming SSE events, and submitting edited approvals. |
|
|
83
|
+
| **Remote Client: .NET** | `Prism.Client` | `clients/dotnet` | Target `.NET 8.0+` LTS. Pure `System.Net.Http` and `System.Text.Json`. | Remote C# client for Prism Server communication. |
|
|
84
|
+
| **Channel: Slack** | Slack Webhook Recipe | `examples/channels/slack` | Uses raw Node HTTP HMAC verification or optional `@slack/bolt`. | Webhook receiver verifying `X-Slack-Signature` and rendering Block Kit editable approval cards. |
|
|
85
|
+
| **Channel: Teams** | Teams Bot Recipe | `examples/channels/teams` | Uses Bot Framework JWT verification or `@microsoft/teamsfx`. | Bot Framework webhook receiver validating Microsoft tenant and rendering Adaptive Cards. |
|
|
86
|
+
| **Realtime Voice** | OpenAI Realtime | Native WebSocket | Pinned to OpenAI Realtime API (`gpt-4o-realtime-preview`). Pure WebSocket transport in `@arnilo/prism-providers`. | Governed bidirectional audio streaming with microphone device admission and barge-in cancellation. |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 4. Performance, Startup, and Package Budgets
|
|
91
|
+
|
|
92
|
+
All implementations in 0.7.0 must adhere to established performance ceilings recorded in `scripts/budgets.json`.
|
|
93
|
+
|
|
94
|
+
### 4.1 Package Size & File Count Budgets
|
|
95
|
+
|
|
96
|
+
| Package | Packed Bytes Baseline (±5%) | Unpacked Bytes Baseline (±5%) | File Count Baseline (±5%) | Public Export Count Ceiling |
|
|
97
|
+
|---|---|---|---|---|
|
|
98
|
+
| `@arnilo/prism` (root) | 1,098,881 | 3,690,682 | 441 | 1,287 |
|
|
99
|
+
| `@arnilo/prism-acp-agent` | — | — | — | 11 |
|
|
100
|
+
| `@arnilo/prism-ag-ui` | — | — | — | 312 |
|
|
101
|
+
| `@arnilo/prism-mcp` | — | — | — | 134 |
|
|
102
|
+
| `@arnilo/prism-memory` | — | — | — | 638 |
|
|
103
|
+
| `@arnilo/prism-office` | — | — | — | 230 |
|
|
104
|
+
| `@arnilo/prism-coding-tools` | — | — | — | 955 |
|
|
105
|
+
| `@arnilo/prism-core` | — | — | — | 1,333 |
|
|
106
|
+
| `@arnilo/prism-providers` | — | — | — | 506 |
|
|
107
|
+
| `@arnilo/prism-web-tools` | — | — | — | 303 |
|
|
108
|
+
|
|
109
|
+
*Rule:* Any increase in root packed bytes or file count must be justified in `scripts/budgets.json`. Export ceilings fail closed under `scripts/budget-gate.test.mjs`.
|
|
110
|
+
|
|
111
|
+
### 4.2 Startup Time Budgets
|
|
112
|
+
|
|
113
|
+
- **Cold-Process `import('@arnilo/prism')` Wall Time**:
|
|
114
|
+
- Baseline: `38 ms`
|
|
115
|
+
- Hard Ceiling: `250 ms`
|
|
116
|
+
- **Machine-Relative Startup Ratio (`importMs / processStartMs`)**:
|
|
117
|
+
- Baseline Ratio: `3.3`
|
|
118
|
+
- Idle Ceiling Ratio: `8.0`
|
|
119
|
+
- Under-Load Ceiling Ratio (`loadavg >= 1.5` per CPU): `20.0`
|
|
120
|
+
|
|
121
|
+
*Enforcement:* No optional provider, tool, database, or SDK dependency may evaluate at package import time. All heavy imports are deferred to dynamic `await import()` upon explicit host activation.
|
|
122
|
+
|
|
123
|
+
### 4.3 Workload Bounds & Hard Caps
|
|
124
|
+
|
|
125
|
+
- **Request / Response Safety Caps**:
|
|
126
|
+
- `DEFAULT_MAX_REQUEST_BYTES`: `4 MiB` (hard ceiling `32 MiB`)
|
|
127
|
+
- `DEFAULT_MAX_RESPONSE_BYTES`: `4 MiB` (hard ceiling `32 MiB`)
|
|
128
|
+
- `HARD_CHUNK_SIZE_CAP` (RAG): `64 KiB`
|
|
129
|
+
- **Event Streaming Caps**:
|
|
130
|
+
- Ring buffer size: `100` items default, `10,000` hard max
|
|
131
|
+
- SSE message size: `64 KiB` max per frame
|
|
132
|
+
- **Concurrency & Conformance Bounds**:
|
|
133
|
+
- Max concurrent distributed coordinator claims: `4` default, `16` max
|
|
134
|
+
- Router concurrent reservation stress: `32` concurrent workers across `>= 2` models
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 5. Architectural Invariants & Shared Contracts
|
|
139
|
+
|
|
140
|
+
To maintain code quality and prevent divergence across packages:
|
|
141
|
+
|
|
142
|
+
### 5.1 No Duplicated Primitives
|
|
143
|
+
- **Agent Loop**: Single execution loop in `src/agent-session/session.ts`. No secondary loop in ACP, supervisor, or delegated wrappers.
|
|
144
|
+
- **Approval Store**: Approvals managed strictly through `RunDecision` and `CheckpointStore`. No standalone approval database.
|
|
145
|
+
- **Scheduler**: Workflow execution managed by `createWorkflowCoordinator` with `LeaseStore`. No secondary cron or background queue daemon.
|
|
146
|
+
- **Tool Registry**: Single `ToolRegistry` implementation in `src/tools.ts`. Per-run narrowing filters the registry dynamically; it does not instantiate a separate registry.
|
|
147
|
+
|
|
148
|
+
### 5.2 Genuinely Shared Contracts
|
|
149
|
+
1. **Governed Provider Invocation**:
|
|
150
|
+
```ts
|
|
151
|
+
export interface GovernedInvocationOptions {
|
|
152
|
+
readonly router: ModelRouter;
|
|
153
|
+
readonly model: ModelConfig;
|
|
154
|
+
readonly identity: AgentIdentity;
|
|
155
|
+
readonly maxCostUsd?: number;
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
Wraps `AIProvider.generate()` / `generateStream()` with atomic reservation, request policy injection, response metering, and commit/release.
|
|
159
|
+
2. **Durable Action Draft & Revision Reference**:
|
|
160
|
+
```ts
|
|
161
|
+
export interface ActionDraftRevision {
|
|
162
|
+
readonly draftId: string;
|
|
163
|
+
readonly revision: number;
|
|
164
|
+
readonly payloadDigest: string; // sha256 of canonical payload
|
|
165
|
+
readonly policyRevision: string;
|
|
166
|
+
readonly createdAt: string;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
Ensures that any edit to a draft changes its digest and invalidates prior approvals.
|
|
170
|
+
3. **RAG Access Constraint**:
|
|
171
|
+
```ts
|
|
172
|
+
export interface RagAccessConstraint {
|
|
173
|
+
readonly principalId: string;
|
|
174
|
+
readonly groupIds: readonly string[];
|
|
175
|
+
readonly tenantId: string;
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
Passed down to both vector search and lexical query legs to enforce pre-ranking exclusion.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 6. Threat Model & Security Enforcement
|
|
183
|
+
|
|
184
|
+
| Threat Domain | Threat Vector | Mitigation & Fail-Closed Enforcement | Visibility & Audit |
|
|
185
|
+
|---|---|---|---|
|
|
186
|
+
| **Identity & Tenant Scope** | Cross-tenant access, spoofed userId in distributed calls | Identity active and ownership matching verified via `assertIdentityMatchesOwnership`. Cross-tenant budget or session access throws `ERR_PRISM_SECURITY_TENANT_MISMATCH`. | OTel trace tenant tag; `AgentEvent.agent_denied` emitted on mismatch. |
|
|
187
|
+
| **Source ACLs (RAG)** | Unauthorized document exposure via vector similarity or lexical search | Predicate pushdown into SQL / vector queries. Unauthorized candidates never enter candidate list or top-K ranking. Revocation invalidates cached candidates. | Audit log records query principal and accessed document IDs. Text is never logged. |
|
|
188
|
+
| **Durable Approvals** | Approval replay, editing payload after approval, unauthorized approver | `expectedVersion` CAS on resume. Approved digest must match current draft digest. Edits invalidate approval and increment revision. Separation-of-duties requires distinct approver. | `RunDecision` records approver identity, timestamp, and payload digest. |
|
|
189
|
+
| **Credentials & Secrets** | Leaked provider tokens in logs, event streams, or process argv | Credential references (`credentialRef`) used in configs. Secrets resolved only at provider edge. `SecretRedactor` scrubs all ledgers and event streams. | Canary strings tested across all event streams, logs, and artifacts. |
|
|
190
|
+
| **Execution Containment** | Malicious shell execution, sandbox breakout, directory traversal | Docker sandbox with `network: "none"` or audited proxy; non-root user; workspace root confinement via realpath traversal checks. E2B uses isolated cloud VMs. | Container ID, image digest, and execution policy audited per session. |
|
|
191
|
+
| **Durable Resume & Fencing** | Split-brain execution, duplicate side-effect replay upon network failure | Distributed lease acquisition with fencing tokens. External mutations record `ToolEffectStore` idempotent keys. Ambiguous outcomes stay `unknown`. | Lease records in PostgreSQL with TTL; unknown effects surfaced in run status. |
|
|
192
|
+
| **Budget & Cost Exhaustion** | Runaway LLM loops, unmetered tool/compaction calls | Atomic budget reservation before model call. Strict budget mode rejects calls without known pricing. Background compaction and embeddings charged against task budget. | Aggregated usage records linked to `taskId` and `tenantId`. |
|
|
193
|
+
| **Remote Runtime Delegation** | Prompt injection via delegated agents (Codex/Claude/Cursor) | All external agent tool requests route through Prism's `ExecutionPolicy`. Approval interception preserves host control. External session state kept isolated. | Delegated agent steps logged as `delegated_agent_step` events with token usage. |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 7. Plan 072, 074, 077 Boundary Freeze
|
|
198
|
+
|
|
199
|
+
To maintain strict modularity across concurrent plans:
|
|
200
|
+
- **Plan 072 Freeze (Eval & Observability)**:
|
|
201
|
+
- `ExecutionTimeline`, `projectAgentTimeline`, `projectTraceTimeline`, `projectWorkflowTimeline` are owned by Plan 072.
|
|
202
|
+
- `WorkflowGraphView` and `serializeWorkflowGraph` are owned by Plan 072.
|
|
203
|
+
- Trajectory scorers (`createToolCallMatchScorer`) and scenario runners are owned by Plan 072.
|
|
204
|
+
- Task 15 of Plan 073 strictly wires these surfaces into Dev Inspector and Release Gates; it **does not** create duplicate timeline projectors.
|
|
205
|
+
- **Plan 077 Freeze (Work-Scope Memory Index)**:
|
|
206
|
+
- `WorkScope`, `projectWorkMemory`, session memory isolation are owned by Plan 077.
|
|
207
|
+
- Plan 073 assumes work-scope isolation in its coding journeys without reimplementing the index.
|
|
208
|
+
- **Plan 074 Freeze (Attention Compiler)**:
|
|
209
|
+
- `assembleTurn`, ratio gates, and sticky stub compaction triggers are owned by Plan 074.
|
|
210
|
+
- Plan 073 does not introduce a competing prompt assembly or compaction trigger.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 8. Resolution of File Lists & Barrels (Tasks 2–29)
|
|
215
|
+
|
|
216
|
+
Below are the exact resolved file paths and implementation splits for all tasks where tentative or proposed filenames appeared in the plan:
|
|
217
|
+
|
|
218
|
+
| Task | Capability | Resolved Implementation & Test Files | Export / Barrel Location |
|
|
219
|
+
|---|---|---|---|
|
|
220
|
+
| **Task 4** | Real-provider ACP launcher | `packages/acp-agent/src/config.ts`, `packages/acp-agent/src/index.ts`, `packages/acp-agent/bin/prism-acp-agent.ts`, `packages/acp-agent/src/__tests__/agent.test.ts` | `packages/acp-agent/src/index.ts` |
|
|
221
|
+
| **Task 5** | Host composition templates | `templates/personal-assistant/src/index.ts`, `templates/personal-assistant/package.json`, `templates/business-worker/src/index.ts`, `templates/business-worker/package.json`, `packages/prism-coding-tools/src/dev/inspector.ts` | `templates/README.md`, `packages/prism-coding-tools/src/dev/index.ts` |
|
|
222
|
+
| **Task 6** | Governed provider invocation | `packages/prism-core/src/governance/model-router/invocation.ts`, `packages/prism-core/src/governance/model-router/__tests__/invocation.test.ts` | `packages/prism-core/src/governance/model-router/index.ts` |
|
|
223
|
+
| **Task 7** | Aggregate task accounting | `packages/prism-core/src/enterprise/postgres/model-router/reservations.ts`, `packages/prism-core/src/enterprise/postgres/model-router/state-store.ts`, `packages/prism-core/src/enterprise/postgres/migrations.ts` | `packages/prism-core/src/enterprise/postgres/index.ts` |
|
|
224
|
+
| **Task 8** | Durable draft review | `packages/prism-core/src/integrations/work/drafts.ts`, `packages/prism-core/src/integrations/work/tools.ts`, `packages/prism-core/src/integrations/work/google-workspace.ts`, `packages/prism-core/src/integrations/work/microsoft365.ts`, `packages/prism-core/src/integrations/work/__tests__/drafts.test.ts` | `packages/prism-core/src/integrations/work/index.ts` |
|
|
225
|
+
| **Task 9** | AG-UI editable approvals | `packages/ag-ui/src/handler.ts`, `packages/ag-ui/src/types.ts`, `packages/ag-ui/src/projection.ts`, `packages/prism-core/src/runtime/server/handler/core.ts`, `packages/prism-core/src/runtime/server/handler/readers.ts` | `packages/ag-ui/src/index.ts` |
|
|
226
|
+
| **Task 10** | Docker process sessions | `packages/prism-coding-tools/src/security/docker-sandbox.ts`, `packages/prism-coding-tools/src/security/docker-cli.ts`, `packages/prism-coding-tools/src/agent/process/sessions-spawn.ts`, `packages/prism-coding-tools/src/agent/process/sessions-recovery.ts` | `packages/prism-coding-tools/src/security/index.ts` |
|
|
227
|
+
| **Task 11** | Document authorization in RAG | `packages/memory/src/rag/retrieve.ts`, `packages/memory/src/rag/types.ts`, `packages/memory/src/postgres.ts`, `packages/memory/src/__tests__/rag-acl.test.ts` | `packages/memory/src/rag/index.ts` |
|
|
228
|
+
| **Task 12** | Google Drive incremental sync | `packages/memory/src/rag/sync.ts`, `packages/memory/src/connectors/google-drive.ts`, `packages/memory/src/__tests__/sync.test.ts` | `packages/memory/src/index.ts` |
|
|
229
|
+
| **Task 13** | Hosted sandbox (E2B) | `packages/prism-coding-tools/src/security/e2b-sandbox.ts`, `packages/prism-coding-tools/src/security/__tests__/e2b-sandbox.test.ts` | `packages/prism-coding-tools/src/security/index.ts` |
|
|
230
|
+
| **Task 14** | Fair background admission & drain | `packages/prism-core/src/runtime/server/drain.ts`, `packages/prism-core/src/runtime/workflows/coordinator.ts`, `packages/prism-core/src/runtime/server/__tests__/drain.test.ts` | `packages/prism-core/src/runtime/server/index.ts` |
|
|
231
|
+
| **Task 15** | Inspector eval/journey wiring | `packages/prism-coding-tools/src/dev/ui/inspector.ts`, `packages/prism-coding-tools/src/dev/server.ts`, `packages/prism-coding-tools/src/dev/__tests__/inspector.test.ts` | `packages/prism-coding-tools/src/dev/index.ts` |
|
|
232
|
+
| **Task 16** | Cross-layer memory correction | `packages/memory/src/memory.ts`, `packages/memory/src/lineage.ts`, `packages/memory/src/compaction/observational-memory/runtime.ts`, `packages/memory/src/compaction/observational-memory/ledger.ts` | `packages/memory/src/index.ts` |
|
|
233
|
+
| **Task 17** | Delegated runtimes (Codex/Claude) | `packages/prism-coding-tools/src/agent/delegated/codex.ts`, `packages/prism-coding-tools/src/agent/delegated/claude.ts`, `packages/prism-coding-tools/src/agent/delegated/types.ts`, `packages/prism-coding-tools/src/agent/delegated/index.ts` | `packages/prism-coding-tools/src/index.ts` |
|
|
234
|
+
| **Task 18** | Delegated runtimes (Copilot/Gemini/Cursor) | `packages/prism-coding-tools/src/agent/delegated/copilot.ts`, `packages/prism-coding-tools/src/agent/delegated/gemini-cli.ts`, `packages/prism-coding-tools/src/agent/delegated/cursor.ts` | `packages/prism-coding-tools/src/agent/delegated/index.ts` |
|
|
235
|
+
| **Task 19** | Semantic artifact diffs & evidence | `packages/office/src/documents/diff.ts`, `packages/prism-core/src/runtime/server/artifacts-service.ts`, `packages/web-tools/src/evidence.ts` | `packages/office/src/index.ts`, `packages/web-tools/src/index.ts` |
|
|
236
|
+
| **Task 20** | Scanned document OCR (Mistral) | `packages/office/src/documents/parse.ts`, `packages/prism-coding-tools/src/document-reader/mistral-ocr.ts` | `packages/prism-coding-tools/src/document-reader/index.ts` |
|
|
237
|
+
| **Task 21** | Per-run tool narrowing | `src/contracts-protocol.ts` (`RunOptions.toolAllowList`), `src/tools.ts`, `src/agent-session/session/provider-round.ts`, `packages/mcp/src/bridge.ts`, `packages/mcp/src/capabilities.ts` | `src/index.ts`, `packages/mcp/src/index.ts` |
|
|
238
|
+
| **Task 22** | Native Bedrock Converse | `packages/prism-providers/src/bedrock/converse.ts`, `packages/prism-providers/src/bedrock/converse-stream.ts`, `packages/prism-providers/src/bedrock/provider.ts` | `packages/prism-providers/src/bedrock/index.ts` |
|
|
239
|
+
| **Task 23** | Native Vertex Gemini | `packages/prism-providers/src/vertex/native.ts`, `packages/prism-providers/src/vertex/provider.ts` | `packages/prism-providers/src/vertex/index.ts` |
|
|
240
|
+
| **Task 24** | Python & .NET remote clients | `clients/python/prism_client/{__init__.py,client.py}`, `clients/dotnet/Prism.Client/{PrismClient.cs,Prism.Client.csproj}` | Standalone client directories (excluded from npm root) |
|
|
241
|
+
| **Task 25** | Slack & Teams channel recipes | `examples/channels/slack/{index.ts,package.json}`, `examples/channels/teams/{index.ts,package.json}` | `examples/channels/` |
|
|
242
|
+
| **Task 26** | Governed realtime voice | `packages/prism-core/src/runtime/realtime/index.ts`, `packages/prism-core/src/runtime/realtime/session.ts`, `packages/prism-providers/src/openai/realtime.ts` | `packages/prism-core/src/runtime/index.ts`, `packages/prism-providers/src/index.ts` |
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## 8. Evidence Checklist
|
|
247
|
+
|
|
248
|
+
Every capability delivered under 0.7.0 must satisfy this verification matrix:
|
|
249
|
+
|
|
250
|
+
- [ ] **Positive Verification**: Proves expected behavior on compliant inputs.
|
|
251
|
+
- [ ] **Refusal & Fail-Closed**: Proves rejected state on lookalike, malformed, unauthenticated, or cross-tenant inputs.
|
|
252
|
+
- [ ] **Restart & Recovery**: Proves state durability across process restarts without duplicate execution or state corruption.
|
|
253
|
+
- [ ] **Bounds & Limits**: Proves strict adherence to byte caps, timeout limits, and concurrency ceilings.
|
|
254
|
+
- [ ] **Documentation & Migration**: Proves accurate contract documentation in `/docs` and migration guidance in `docs/migrate-to-0.7.md`.
|
|
@@ -513,7 +513,7 @@ OAuth client behavior is 2026-07-28 conformant: `finishAuth` now takes the full
|
|
|
513
513
|
|
|
514
514
|
### Monolithic SDK 1.x → modular SDK v2 migration table
|
|
515
515
|
|
|
516
|
-
| v1 (`@modelcontextprotocol/sdk` 1.30.0) | v2 / current
|
|
516
|
+
| v1 (`@modelcontextprotocol/sdk` 1.30.0) | v2 / current Prism MCP API | Notes |
|
|
517
517
|
| --- | --- | --- |
|
|
518
518
|
| `new Client(...)` from `sdk/client/index.js` | same name from `@modelcontextprotocol/client` | `ClientOptions` gains `versionNegotiation`, `listChanged`, `inputRequired`, `cachePartition`, `listMaxPages` |
|
|
519
519
|
| `InMemoryTransport` / `StdioClientTransport` / `StreamableHTTPClientTransport` | `InMemoryTransport`/`StreamableHTTPClientTransport` from `@modelcontextprotocol/client`; `StdioClientTransport` from `@modelcontextprotocol/client/stdio` | subpath moves only |
|
|
@@ -529,7 +529,7 @@ OAuth client behavior is 2026-07-28 conformant: `finishAuth` now takes the full
|
|
|
529
529
|
|
|
530
530
|
- **Now (default):** `createPrismMcpWebHandler(factory)` without `sessionIdGenerator` is stateless dual-era — modern 2026-07-28 serving plus the SDK stateless fallback for 2025 clients. No `Mcp-Session-Id`, no sticky routing, `Last-Event-ID` replay not enabled.
|
|
531
531
|
- **Now (opt-in):** configuring `sessionIdGenerator` keeps identity-bound legacy sessions (POST/GET/DELETE/SSE beside the strict modern handler) for hosts that still need them; the pairing requires exact `allowedOrigins` and host `resolveIdentity`.
|
|
532
|
-
- **Planned removal:** the legacy session leg is deprecated once
|
|
532
|
+
- **Planned removal:** the legacy session leg is deprecated once the package's clients and documented hosts are modern-era; removal lands as a breaking 0.x cut with a migration note here (the `sessionIdGenerator` option disappears and legacy traffic gets the SDK stateless fallback, which 2025 clients already work against). No date is committed in this release.
|
|
533
533
|
|
|
534
534
|
## 0.0.7 → 0.0.8 OpenTelemetry adapter
|
|
535
535
|
|
|
@@ -2,6 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Operator publish handoffs per release line, kept verbatim. Not read on the hot path.
|
|
4
4
|
|
|
5
|
+
### 0.7.0 publish handoff (plan 073 Tasks 28–29)
|
|
6
|
+
|
|
7
|
+
**Decision: GO when the operator prerequisites below are recorded.** Release **0.7.0** is the **six-plan cut** that closed the extended line: [072](../evaluations.md) (execution timeline, workflow graph, trajectory/outcome evals, cockpit aggregations, workflow OTel), [073](../index.md) (host completeness: traps A–C, R01–R06, R08, R10–R14, Tasks 15/30/31 and the cut itself), [074](../attention-compiler.md) (R17 attention compiler and the host-programmable compaction trigger), [075](../memory-fabric.md) (Memory Fabric subpath), [077](../compaction-observational-memory.md) (R16 work-scope memory index) and [078](../supervisors.md) (host-owned subagent spawn, bounded async spawn/wait/cancel, worktree isolation). **Plan 079 (Telegram/Signal channels) was moved to 0.8.0 on 2026-09-15** so the cut stopped waiting on unstarted work; no channel adapter ships in 0.7.0.
|
|
8
|
+
|
|
9
|
+
The graph is **10 publishable manifests** at exact **0.7.0** with internal caret ranges `^0.7.0`: root `@arnilo/prism` plus 9 workspace packages (3 `prism-*` family packages, 6 capability packages, 19 provider adapter subpaths inside the providers family). The predecessor published release is **0.6.0**.
|
|
10
|
+
|
|
11
|
+
Host-visible delta (full detail in [migrate-to-0.7.md](../migrate-to-0.7.md)): two **hard refusals** inside existing surfaces — `@arnilo/prism-acp-agent` matches `mcp.allow` by WHATWG origin plus path-segment subtree (lookalike hosts, sibling prefixes, credentials, and ambiguous encodings now fail closed) and no longer silently falls back to a mock provider; `router.providerSource(model)` throws `ERR_PRISM_MODEL_ROUTER_ASYNC_REQUIRED` / `_ASYNC_STATE` instead of bypassing budgets, rate limits, circuits, fallbacks, selection policies, or durable state. Everything else is additive: opt-in attention compiler, `@arnilo/prism-memory/fabric`, the observational-memory work-scope index, supervisor `spawn_agent`/`wait_agent`/`cancel_agent`, plus behavioral tightenings inside R01–R14 surfaces. **No export was removed**: the compat baselines were regenerated and reviewed as **+469 public declarations, zero removals**.
|
|
12
|
+
|
|
13
|
+
Evidence recorded for the tree under publication. `scripts/release-evidence.json` — **42 surfaces, 11 pass, 31 protected with reasons, `blocked: false`** (`test:postgres durable conformance` is a real pass; the only unavailable leg is the real-phase26 coding journey). `npm test` 5/5 stages; `npm run typecheck` green for root, all workspaces, and `examples/`; coverage core 92.43 lines against the 60/70/75 gate with every non-protected workspace above its recorded lines threshold (acp-agent recovered to 94.72 by exporting and testing its provider resolver); `npm run pack:dry-run` green for all ten packages; `npm run release:check --lockstep --version 0.7.0` reports **10/10 packages available**; `npm run release:publish --dry-run` produces all ten packs deterministically; `npm run security:threat-suites` **83/83**; `npm audit --audit-level=moderate` **0**; tracked+untracked secret scan **2328 files, 0 findings**; SBOM regenerated (172 packages) and `scripts/verify-sbom.mjs` clean against `security/license-policy.json`.
|
|
14
|
+
|
|
15
|
+
Protected legs actually run here (not just recorded): `PRISM_TEST_POSTGRES_URL=… npm run test:postgres` against `pgvector/pgvector:pg16` — core **72/72**, memory **457/457**, phase conformance **11/11**; `node scripts/drill-migration-rollback.mjs --url …` — Postgres apply → downgrade `009` → verify-compat → re-apply → checksum-fail-closed and the SQLite flow all pass, plus the `--self-test` URL-refusal check. That leg found and closed three real defects hermetic doubles could not see: a `42P08` parameter-type ambiguity on the first task-scoped budget insert, a swallowed serialization failure that issued SQL against an aborted transaction (`25P02`), and a retry policy too small for 16 concurrent serializable writers. The release workflow's `postgres-integration` job must be green on the release commit before publication.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Operator prerequisites (each a named blocked gate — none may be skipped):
|
|
19
|
+
# 1. protected live-canary matrix green (live-canaries.yml, canary-report.json retained)
|
|
20
|
+
# 2. PostgreSQL protected suite green (test:postgres) and CodeQL SAST green on the release commit
|
|
21
|
+
# 3. npm OIDC trusted publishing identity authenticated (NPM_TOKEN with id-token, provenance)
|
|
22
|
+
# 4. branch protection: the compatibility leg is node22-compat
|
|
23
|
+
|
|
24
|
+
git diff --check
|
|
25
|
+
npm ci
|
|
26
|
+
# sdk:ready phases, as .github/workflows/release.yml runs them (env scoped to release:gate only):
|
|
27
|
+
npm run typecheck && npm run lint && npm run format:check
|
|
28
|
+
npm test && npm run test:coverage && npm run pack:dry-run
|
|
29
|
+
PRISM_TEST_POSTGRES_URL=... npm run release:gate
|
|
30
|
+
npm run security:threat-suites
|
|
31
|
+
|
|
32
|
+
# Sign the release on the clean tagged tree (operator GPG key):
|
|
33
|
+
git tag -s v0.7.0 -m "0.7.0"
|
|
34
|
+
node scripts/release.mjs publish --lockstep --version 0.7.0
|
|
35
|
+
|
|
36
|
+
# First-party package tags: push in batches of <=3 per push (tag-push storms; VENT 26-08-29).
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Rollback pins the previous published line — `@arnilo/prism@0.6.0` and its siblings, exact pins per package. Persisted shapes are additive across 0.6.0 → 0.7.0 (fabric notes, scope entries, and spawn handles write new records through existing stores; migrations `001`–`006` are forward-only), so a pin rollback is store-safe: a 0.6.0 host ignores entries it cannot read and regains the pre-0.7.0 ACP prefix matching and router facade bypass, which is why those two refusals should be re-checked before rolling back.
|
|
40
|
+
|
|
5
41
|
### 0.6.0 publish handoff (plan 071 Task 16)
|
|
6
42
|
|
|
7
43
|
|
|
@@ -271,7 +307,7 @@ node scripts/release.mjs publish --independent --baseline c600eaa18f65b56764ec2f
|
|
|
271
307
|
### 0.3.2 changed-package cut (plan 050 Task 12)
|
|
272
308
|
|
|
273
309
|
|
|
274
|
-
**Decision: GO when the operator prerequisites below are recorded.** The plan 050 cut covers the
|
|
310
|
+
**Decision: GO when the operator prerequisites below are recorded.** The plan 050 cut covers the integration-findings remediation and the OKF wiki adoption: baseline `edb4fcf` (the parent of the plan 050 implementation work); five packages publish in dependency order — root `@arnilo/prism` (FEATURE-1 agent-definition model override fallback, FEATURE-3 command driver hooks, FEATURE-2/6 docs+example, DOCS-1 contracts), `@arnilo/prism-coding-agent` (BUG-1 `allowCustom` default + optional `toolCallId`), `@arnilo/prism-supervisor` (BUG-2 child-factory `Agent` guard, FEATURE-4 opt-in child event passthrough), `@arnilo/prism-wiki` (OKF v0.2 bundle emission, 0.0.2 → 0.0.3), and `@arnilo/prism-acp-agent` (sqlite `:memory:` pass-through fix, 0.0.x-style patch 0.3.1 → 0.3.2). Every unchanged package stays byte-identical; docs-only packages (`@arnilo/prism-workflows`, `@arnilo/prism-compaction-observational-memory`) do not bump. Republished packages carry `^0.3.2` root peers; unchanged packages keep their window peers. Docs-only change on the root: none of the deltas are breaking (additive fields and fail-closed guards), compat additive-only, no migration.
|
|
275
311
|
|
|
276
312
|
```bash
|
|
277
313
|
node scripts/release.mjs changed --baseline edb4fcf # 5 packages
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Host compositions
|
|
2
|
+
|
|
3
|
+
Prism agents are host-assembled: the host application owns credentials, providers, persistence, permissions, and tool definitions. Prism provides two canonical, maintained host compositions and a zero-network inspection and readiness API to ensure host setups conform to their operational contracts:
|
|
4
|
+
|
|
5
|
+
- **`personal` (`personal-assistant`)**: Local-personal host composition for single-operator productivity, personal tools, local/memory persistence, and secret redaction.
|
|
6
|
+
- **`business` (`business-worker`)**: Multi-tenant enterprise worker host composition with verified tenant identity, mandatory durable storage, sandbox workspace containment, and strict governance enforcement.
|
|
7
|
+
|
|
8
|
+
## Profiles
|
|
9
|
+
|
|
10
|
+
| Profile | Ownership | Identity | Persistence | Sandbox | Governance |
|
|
11
|
+
| --- | --- | --- | --- | --- | --- |
|
|
12
|
+
| `personal` | Single user (`userId`) | Optional unverified operator | Memory or durable storage | Local workspace | Optional |
|
|
13
|
+
| `business` | Tenant + user (`tenantId`, `userId`) | Mandatory verified identity (`verified: true`) matching tenant | Mandatory durable store (`durable: true`); memory rejected | Contained sandbox roots within workspace | Required supported governance |
|
|
14
|
+
|
|
15
|
+
## Host composition API
|
|
16
|
+
|
|
17
|
+
Both helper functions and the error class are exported from `@arnilo/prism`:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import {
|
|
21
|
+
inspectHostComposition,
|
|
22
|
+
assertHostCompositionReadiness,
|
|
23
|
+
HostCompositionError,
|
|
24
|
+
type HostCompositionProfile,
|
|
25
|
+
type HostCompositionOptions,
|
|
26
|
+
type HostCompositionReport,
|
|
27
|
+
} from "@arnilo/prism";
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### `inspectHostComposition(options)`
|
|
31
|
+
|
|
32
|
+
Inspects an agent configuration and returns a typed `HostCompositionReport`. Inspection is **completely inert and performs zero network calls**. Canary secrets in credentials are never leaked.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const report = inspectHostComposition({
|
|
36
|
+
profile: "personal",
|
|
37
|
+
agent: personalAgent,
|
|
38
|
+
store: memoryStore,
|
|
39
|
+
credentialRefs: ["OPENAI_API_KEY"],
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Report structure:
|
|
44
|
+
|
|
45
|
+
- `profile`: `"personal"` or `"business"`.
|
|
46
|
+
- `effectiveTools`: Readonly list of tool names registered on the agent.
|
|
47
|
+
- `credentialRefs`: Host credential references (sanitized, values never included).
|
|
48
|
+
- `ownership`: Tenant and user ownership identifiers.
|
|
49
|
+
- `storage`: Storage summary with `kind` (`"memory"`, `"postgres"`, `"sqlite"`, etc.) and `durable` boolean. Memory stores are truthfully reported with `durable: false`.
|
|
50
|
+
- `sandbox`: Isolation status and resolved root paths.
|
|
51
|
+
- `governance`: Coverage flags (authorization, trust, and custom policies).
|
|
52
|
+
- `readiness`: Object with `ok: boolean` and list of `reasons` if not ready.
|
|
53
|
+
|
|
54
|
+
### `assertHostCompositionReadiness(options)`
|
|
55
|
+
|
|
56
|
+
Validates that the host composition satisfies all profile constraints. Throws `HostCompositionError` on the first violated rule:
|
|
57
|
+
|
|
58
|
+
| Error Code | Violation |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| `ERR_PRISM_HOST_COMPOSITION_PROFILE` | Unknown or missing profile. |
|
|
61
|
+
| `ERR_PRISM_HOST_COMPOSITION_OWNERSHIP` | Missing `userId` (personal), missing `tenantId` (business), or identity/ownership mismatch. |
|
|
62
|
+
| `ERR_PRISM_HOST_COMPOSITION_STORAGE` | Non-durable or in-memory persistence passed to a business composition. |
|
|
63
|
+
| `ERR_PRISM_HOST_COMPOSITION_SECRETS` | Agent lacks a configured `SecretRedactor`. |
|
|
64
|
+
| `ERR_PRISM_HOST_COMPOSITION_PROVIDER` | Agent lacks an active `AIProvider` or model selection. |
|
|
65
|
+
| `ERR_PRISM_HOST_COMPOSITION_SANDBOX` | Sandbox roots escape the declared `workspaceRoot`. |
|
|
66
|
+
| `ERR_PRISM_HOST_COMPOSITION_GOVERNANCE` | Governance policy disabled or unsupported. |
|
|
67
|
+
|
|
68
|
+
### Integration with `createSecureAgent`
|
|
69
|
+
|
|
70
|
+
`createSecureAgent` accepts an optional `composition` field. When provided, readiness is asserted immediately before the agent is returned:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { createSecureAgent } from "@arnilo/prism";
|
|
74
|
+
|
|
75
|
+
const agent = createSecureAgent({
|
|
76
|
+
id: "worker-1",
|
|
77
|
+
definitionRevision: "1",
|
|
78
|
+
ownership: { tenantId: "acme-corp", userId: "worker-prod" },
|
|
79
|
+
identity: {
|
|
80
|
+
tenantId: "acme-corp",
|
|
81
|
+
userId: "worker-prod",
|
|
82
|
+
principal: { kind: "user", id: "worker-prod" },
|
|
83
|
+
scopes: ["task:execute"],
|
|
84
|
+
verified: true,
|
|
85
|
+
issuedAt: new Date().toISOString(),
|
|
86
|
+
},
|
|
87
|
+
composition: {
|
|
88
|
+
profile: "business",
|
|
89
|
+
store: postgresStore,
|
|
90
|
+
workspaceRoot: "/data/acme",
|
|
91
|
+
sandboxRoots: ["/data/acme/scratch"],
|
|
92
|
+
},
|
|
93
|
+
// ... other required secure agent options
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Package install vs. import subpaths
|
|
98
|
+
|
|
99
|
+
Always install containing packages directly. **NPM install never accepts subpaths**:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Correct — install containing published packages:
|
|
103
|
+
npm install @arnilo/prism @arnilo/prism-core @arnilo/prism-providers
|
|
104
|
+
|
|
105
|
+
# Never install subpaths:
|
|
106
|
+
# npm install @arnilo/prism-core/integrations/work (WRONG: fails with 404 / E404)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
In your application code, import from documented subpaths:
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
// Subpaths exported by @arnilo/prism-core:
|
|
113
|
+
import { createWorkTools } from "@arnilo/prism-core/integrations/work";
|
|
114
|
+
import { createJsonSchemaArgumentValidator } from "@arnilo/prism-core/validation/json-schema";
|
|
115
|
+
|
|
116
|
+
// Subpaths exported by @arnilo/prism-providers:
|
|
117
|
+
import { createOpenAIProvider } from "@arnilo/prism-providers/openai";
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Background workers
|
|
121
|
+
|
|
122
|
+
Business workers that share a durable checkpoint queue should pass `admission: { perTenant, drain }` into `createWorkflowCoordinator` and mount `createPrismOperatorHandler` beside health/drain. See [Operations runbook](operations.md) and [Workflows](workflows.md). Do not introduce a second scheduler.
|
|
123
|
+
|
|
124
|
+
## Starter templates
|
|
125
|
+
|
|
126
|
+
Scaffold fresh host compositions using `prism init`:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Personal assistant composition
|
|
130
|
+
prism init my-assistant --template personal-assistant
|
|
131
|
+
|
|
132
|
+
# Business worker composition
|
|
133
|
+
prism init my-worker --template business-worker
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Each template produces a runnable agent, mock test fixtures, environment templates, and strict typing.
|
|
137
|
+
|
|
138
|
+
## Dev inspector endpoint
|
|
139
|
+
|
|
140
|
+
When running `@arnilo/prism-coding-tools/dev`, host compositions can be inspected via HTTP:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
GET /inspect
|
|
144
|
+
# or GET {basePath}/inspect
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Returns the JSON serialized `HostCompositionReport` corresponding to the inspected agent and options.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Hosted sandboxes
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
`createE2BSandbox` / `connectE2BSandbox` map one hosted vendor (E2B) onto the existing `DisposableSandbox` contract: `execFile`, optional `startProcess` / `attachProcess`, `pause` / `resume`, and explicit `kill`. Prism does not run hosted compute. The host owns the E2B account, template, API key, and lifecycle. Pause is the snapshot. `keepMemory: false` is filesystem-only: resume reboots and running processes are gone. `Sandbox.connect` auto-resumes a paused sandbox; this adapter never calls it unless the host calls `resume()` or passes `resume: true`.
|
|
6
|
+
|
|
7
|
+
## When to use it
|
|
8
|
+
|
|
9
|
+
Use this adapter when coding or process work should run in an E2B cloud sandbox rather than Docker. Use `createDockerSandbox` when you need a local digest-pinned container with `network: none`. Do not assume E2B isolation matches Docker: default capabilities report `networkIsolated` and `egressRestricted` false (E2B sandboxes have internet).
|
|
10
|
+
|
|
11
|
+
## Inputs / request
|
|
12
|
+
|
|
13
|
+
| Field | Required | Notes |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `apiKey` | unless `client` | Resolved at the SDK edge only. Never logged. |
|
|
16
|
+
| `client` | unless `apiKey` | Host-injected `e2b` `Sandbox` surface for tests or a pinned SDK. |
|
|
17
|
+
| `template` | no | Default `base`. Host-owned image/template. |
|
|
18
|
+
| `workdir` | no | Default `/workspace`. |
|
|
19
|
+
| `timeoutMs` / `limits.wallTimeMs` | no | Passed to E2B as sandbox timeout (idle/cost budget). |
|
|
20
|
+
| `onTimeout` | no | `kill` (default) or `pause`. `autoResume` is always false. |
|
|
21
|
+
| `labels` | no | Stored as E2B metadata for reconnect attestation. No secrets. |
|
|
22
|
+
| `expectedLabels` (connect) | no | Fail-closed mismatch → wrong owner. |
|
|
23
|
+
| `resume` (connect) | no | Default false. Paused sandboxes stay paused until `resume()`. |
|
|
24
|
+
| `capabilities` | no | Full host attestation; omitted fields resolve false. |
|
|
25
|
+
|
|
26
|
+
Optional peer: `e2b@2.49.1` (MIT). Install it or pass `client`.
|
|
27
|
+
|
|
28
|
+
## Outputs / response / events
|
|
29
|
+
|
|
30
|
+
`createE2BSandbox` returns a `DisposableSandbox`:
|
|
31
|
+
|
|
32
|
+
- `id` is the E2B sandbox id (non-secret reconnect identity).
|
|
33
|
+
- `pause({ keepMemory })` → `{ kind: "memory" \| "filesystem", state: "paused" }`. HTTP 503 (`ServiceBusyError`) leaves the sandbox **running**.
|
|
34
|
+
- `resume()` calls `Sandbox.connect` (explicit).
|
|
35
|
+
- `startProcess` refs are `prism-e2b-proc:<base64url>`. Filesystem-only pause makes `attachProcess` return null.
|
|
36
|
+
- `stop()` pauses with memory. `kill()` / `close()` destroy the sandbox. `close({ export })` is unsupported (pause is the snapshot).
|
|
37
|
+
- Default capabilities: workspace coherent, filesystem isolated from the host, process isolated; **not** network/egress/privilege isolated.
|
|
38
|
+
|
|
39
|
+
## Request/response example
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"template": "base",
|
|
44
|
+
"timeoutMs": 600000,
|
|
45
|
+
"onTimeout": "kill",
|
|
46
|
+
"labels": { "app.owner": "alice" },
|
|
47
|
+
"pause": { "keepMemory": false }
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Implementation example
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { connectE2BSandbox, createE2BSandbox } from "@arnilo/prism-coding-tools/security";
|
|
55
|
+
|
|
56
|
+
const sandbox = await createE2BSandbox({
|
|
57
|
+
apiKey: process.env.E2B_API_KEY,
|
|
58
|
+
labels: { "app.owner": "alice" },
|
|
59
|
+
timeoutMs: 10 * 60_000,
|
|
60
|
+
});
|
|
61
|
+
await sandbox.execFile({ file: "/bin/echo", args: ["ok"], cwd: "/workspace" });
|
|
62
|
+
await sandbox.pause!({ keepMemory: false });
|
|
63
|
+
|
|
64
|
+
const again = await connectE2BSandbox({
|
|
65
|
+
apiKey: process.env.E2B_API_KEY,
|
|
66
|
+
sandboxId: sandbox.id,
|
|
67
|
+
expectedLabels: { "app.owner": "alice" },
|
|
68
|
+
});
|
|
69
|
+
await again.resume!();
|
|
70
|
+
await again.kill();
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Extension and configuration notes
|
|
74
|
+
|
|
75
|
+
- Detect `pause` / `startProcess` like Docker: `typeof sandbox.pause === "function"`. Absence is not an error on other backends.
|
|
76
|
+
- `createE2BProcessRecoveryBackend(sandbox, { expectedSandboxId, expectedWorkspace, expectedLabels })` is the attested `ProcessRecoveryBackend`. `createProcessSessions({ sandbox })` still auto-wires `attachProcess` when present.
|
|
77
|
+
- `lifecycle.autoResume` is forced false. Activity (exec, file, HTTP) must not resume paused work.
|
|
78
|
+
- Paused E2B sandboxes persist until `kill()`. There is no vendor TTL; the host must delete.
|
|
79
|
+
|
|
80
|
+
## Security and performance notes
|
|
81
|
+
|
|
82
|
+
- Attest vendor isolation; do not copy Docker `network: none` claims. Override `capabilities` only when the host actually restricted the template/network.
|
|
83
|
+
- API keys belong in `apiKey` or the injected client, never metadata, refs, labels, argv, or logs. Errors pass through `createSecretRedactor`.
|
|
84
|
+
- Process refs carry sandbox id, pid, command fingerprint, and workspace — no secrets.
|
|
85
|
+
- Pause duration is vendor-bound (about 4s per GiB RAM). Command output, env, and concurrent execs use the same sandbox limit caps as Docker (`maxOutputBytes`, `maxCommands`, `maxConcurrentExecs`).
|
|
86
|
+
- A 503 pause refusal is not success: status stays `running`.
|
|
87
|
+
- Filesystem-only resume is a reboot: in-memory state and processes are gone; do not auto-restart them.
|
|
88
|
+
|
|
89
|
+
## Related APIs
|
|
90
|
+
|
|
91
|
+
- [Coding execution approval and sandboxing](coding-security.md)
|
|
92
|
+
- [Process sessions](process-sessions.md)
|
|
93
|
+
- [Optional peer dependencies](peer-dependencies.md)
|
|
94
|
+
- [Live testing](live-testing.md)
|