@arnilo/prism 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/agent-approval.d.ts +49 -0
  3. package/dist/agent-approval.js +178 -0
  4. package/dist/agent-run-lifecycle.d.ts +7 -1
  5. package/dist/agent-run-lifecycle.js +213 -3
  6. package/dist/agent-run-state.d.ts +11 -0
  7. package/dist/agent-run-state.js +23 -0
  8. package/dist/agent-session.d.ts +98 -0
  9. package/dist/agent-session.js +1806 -0
  10. package/dist/agent-tool-dispatch.d.ts +13 -0
  11. package/dist/agent-tool-dispatch.js +92 -0
  12. package/dist/agents.d.ts +16 -9
  13. package/dist/agents.js +14 -2254
  14. package/dist/contracts-core.d.ts +1402 -0
  15. package/dist/contracts-core.js +119 -0
  16. package/dist/contracts-protocol.d.ts +596 -0
  17. package/dist/contracts-protocol.js +2 -0
  18. package/dist/contracts-run-state.d.ts +285 -0
  19. package/dist/contracts-run-state.js +77 -0
  20. package/dist/contracts.d.ts +7 -2261
  21. package/dist/contracts.js +7 -192
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +1 -1
  24. package/docs/0.1.0-readiness.md +3 -1
  25. package/docs/agent-identity.md +1 -1
  26. package/docs/agent-session-runtime.md +3 -1
  27. package/docs/browser-automation.md +13 -9
  28. package/docs/coding-agent-tools.md +13 -0
  29. package/docs/context-and-skills.md +2 -2
  30. package/docs/index.md +3 -14
  31. package/docs/migration.md +11 -5
  32. package/docs/performance.md +14 -4
  33. package/docs/persistence-credentials-multimodality-primitives.md +1 -1
  34. package/docs/provider-primitives.md +1 -1
  35. package/docs/public-contracts.md +2 -0
  36. package/docs/release-and-install.md +65 -0
  37. package/docs/session-stores.md +2 -2
  38. package/docs/thinking-and-reasoning.md +1 -1
  39. package/docs/tool-execution-primitives.md +2 -2
  40. package/docs/use-case-model-selection.md +1 -1
  41. package/docs/workflow-orchestration-primitives.md +1 -1
  42. package/package.json +4 -3
@@ -51,6 +51,7 @@ Consumers install the core package for the runtime and add first-party packages
51
51
  | Resume interrupted tagged publication | `npm run release:publish -- --version 0.1.0 --resume --report release-artifacts/publish-report.json` |
52
52
  | Protected PostgreSQL enterprise suite | `PRISM_TEST_POSTGRES_URL="$DATABASE_URL" npm run test:postgres` |
53
53
  | Full SDK readiness gate (typecheck + offline tests + pack) | `npm run sdk:ready` |
54
+ | Non-blocking unused-code sweep (report to `scripts/unused-sweep-report.txt`, always exits 0) | `npm run sweep:unused` |
54
55
 
55
56
  > **Build notes (0.1.1+).** `npm run build` no longer runs `npm run clean` first: concurrent builds/tests (`npm test`, `npm run typecheck`) are now race-free because the only destructive step was the `rm -rf` clean, and concurrent `tsc` is write-only and idempotent on identical input (two processes emitting the same files end byte-identical regardless of interleaving).
56
57
  >
@@ -273,6 +274,70 @@ git push origin v0.1.2 # tag push triggers release.yml publish job (prove
273
274
 
274
275
  **Rollback notes.** `release:publish --version 0.1.2 --resume --report release-artifacts/publish-report.json` resumes an interrupted publication and skips only registry versions whose internal dependency fingerprint matches the local manifest. A failed package aborts the run with its status written to the report; re-run after fixing the cause. npm cannot unpublish the `0.1.2` line after 72 hours — a post-publication defect ships as a `0.1.x` patch (additive-only compat promise, `release:gate` enforced), or as a documented break in the next line with a `docs/migration.md` entry. `0.1.2` is store-compatible with `0.1.1` in **both directions** (no migration ran — same checksum-protected contract), so an operator may defer or roll back the patch without a database rollback.
275
276
 
277
+ ### 0.1.4 publish handoff (plan 016 Task 6)
278
+
279
+ **Decision: GO when the operator prerequisites below are recorded.** Release **0.1.4** (plan 016) is the internal god-module split, compat-preserving on the frozen 0.1.x line: `src/agents.ts` and `src/contracts.ts` reorganized by concern behind barrel re-exports (`contracts-core`/`contracts-run-state`/`contracts-protocol`; `agent-session`/`agent-run-lifecycle`/`agent-approval`/`agent-tool-dispatch` reusing `agent-run-state`/`agent-loops`/`compaction`) with a **byte-identical public entry surface** (0 added/0 removed/0 changed vs the 0.1.3 baseline; the 14 additive union-surface helpers are internal cross-module exports, not consumer-importable — deviation #1), measured tree-shaking improvement (111,049 → 982 B `dist/agents.js`, 9,420 → 418 B `dist/contracts.js`, module count 64 → 70; evidence in `scripts/phase16-baseline.json`), and additive **`@arnilo/prism-browser` Chrome DevTools Protocol capabilities** (Tasks 4-5): `browser_evaluate`, `browser_observe`, `block_urls`/`unblock_urls`/`throttle`/`emulate` act actions, and `{ css }`/`{ xpath }` targets on Chromium hosts — 41 added / 0 removed / 18 changed declaration texts (15 re-export-statement artifacts + 3 optional-member/signature widenings), the documented deviation #2 carve-out; root `arnilo__prism.txt` regenerated with zero breaking deltas. Publishable graph stays **49** manifests (root + 48 workspace) at exact **0.1.4**. Store compatibility with 0.1.3: **compatible, no migration**; zero new dependencies (lockfile name-set unchanged).
280
+
281
+ ```bash
282
+ # Operator prerequisites (each a named blocked gate — none may be skipped):
283
+ # 1. protected live-canary matrix green (live-canaries.yml, canary-report.json retained)
284
+ # 2. PostgreSQL + keychain protected suites green (test:postgres, keychain suite)
285
+ # 3. CodeQL SAST green on the release commit (security.yml / release.yml codeql-release)
286
+ # 4. npm OIDC trusted publishing identity authenticated (NPM_TOKEN with id-token, provenance)
287
+
288
+ git diff --check
289
+ npm ci
290
+ npm run sdk:ready # includes typecheck, lint, format, full test, coverage, pack, release:gate
291
+ npm run security:threat-suites
292
+ PRISM_TEST_POSTGRES_URL="$DATABASE_URL" npm run test:postgres # Phase 7 + Phase 12 restart-recovery
293
+ npm audit --audit-level=moderate
294
+ npm run release:check -- --version 0.1.4 --report /tmp/prism-0.1.4-preflight.json
295
+ npm run release:publish -- --version 0.1.4 --dry-run --allow-dirty --allow-untagged --report /tmp/prism-0.1.4-dry-run.json
296
+ # run the dry-run twice and diff the reports: deterministic, byte-identical
297
+
298
+ # Sign the release on the clean tagged tree (operator GPG key):
299
+ git tag -s v0.1.4 -m "Prism 0.1.4"
300
+ git verify-tag v0.1.4
301
+ git push origin v0.1.4 # tag push triggers release.yml publish job (provenance, attestations)
302
+
303
+ # Real publication never bypasses the gates: release.mjs refuses
304
+ # --allow-dirty/--allow-untagged without --dry-run.
305
+ ```
306
+
307
+ **Rollback notes.** `release:publish --version 0.1.4 --resume --report release-artifacts/publish-report.json` resumes an interrupted publication and skips only registry versions whose internal dependency fingerprint matches the local manifest. A failed package aborts the run with its status written to the report; re-run after fixing the cause. npm cannot unpublish the `0.1.4` line after 72 hours — a post-publication defect ships as a `0.1.x` patch (additive-only compat promise, `release:gate` enforced), or as a documented break in the next line with a `docs/migration.md` entry. `0.1.4` is store-compatible with `0.1.3` in **both directions** (no migration ran — same checksum-protected contract), so an operator may defer or roll back the patch without a database rollback. The next line, **0.1.5**, is the documented breaking cut (deprecated-option removal) with its removed-symbols list landing in `docs/migration.md`.
308
+
309
+ ### 0.1.3 publish handoff (plan 015 Task 5)
310
+
311
+ **Decision: GO when the operator prerequisites below are recorded.** Release **0.1.3** (plan 015) is the dead-code and deprecation hygiene patch on the frozen 0.1.x line: one parameterized benchmark runner `scripts/benchmark.mjs --scenario <name>` replaces the per-version runners (16 orphaned `benchmark-0.0.{8..16}` runner/test files removed, evidence JSON kept; the CI schema leg runs `scripts/benchmark.test.mjs`), the 12 `docs/review-coverage-2026-07-*.md` evidence files moved to the tarball-excluded `docs/_evidence/` archive, a non-blocking unused-code sweep (`npm run sweep:unused` — tsc `noUnusedLocals`/`noUnusedParameters` over core + all workspace tsconfigs plus a zero-dep dead-export scan; always exits 0, report to `scripts/unused-sweep-report.txt`), and opt-in checkpoint persistence (`persistSessionState: true` on durable run/resume options — loaded-skill name catalog ≤64 names rides the run-state checkpoint and restores on resume, bodies re-resolve from the live registry; `createReadPathSetPersistence` in `@arnilo/prism-coding-agent` persists the read-before-write path set through the host `CheckpointStore`, ≤1024 paths, ownership-scoped). Publishable graph stays **49** manifests (root + 48 workspace) at exact **0.1.3**. Store compatibility with 0.1.2: **compatible, no migration**; declaration surface additive-only vs the frozen 0.1.x contract (`scripts/compat-baseline` regenerated at 0.1.3 with zero breaking deltas).
312
+
313
+ ```bash
314
+ # Operator prerequisites (each a named blocked gate — none may be skipped):
315
+ # 1. protected live-canary matrix green (live-canaries.yml, canary-report.json retained)
316
+ # 2. PostgreSQL + keychain protected suites green (test:postgres, keychain suite)
317
+ # 3. CodeQL SAST green on the release commit (security.yml / release.yml codeql-release)
318
+ # 4. npm OIDC trusted publishing identity authenticated (NPM_TOKEN with id-token, provenance)
319
+
320
+ git diff --check
321
+ npm ci
322
+ npm run sdk:ready # includes typecheck, lint, format, full test, coverage, pack, release:gate
323
+ npm run security:threat-suites
324
+ PRISM_TEST_POSTGRES_URL="$DATABASE_URL" npm run test:postgres # Phase 7 + Phase 12 restart-recovery
325
+ npm audit --audit-level=moderate
326
+ npm run release:check -- --version 0.1.3 --report /tmp/prism-0.1.3-preflight.json
327
+ npm run release:publish -- --version 0.1.3 --dry-run --allow-dirty --allow-untagged --report /tmp/prism-0.1.3-dry-run.json
328
+ # run the dry-run twice and diff the reports: deterministic, byte-identical
329
+
330
+ # Sign the release on the clean tagged tree (operator GPG key):
331
+ git tag -s v0.1.3 -m "Prism 0.1.3"
332
+ git verify-tag v0.1.3
333
+ git push origin v0.1.3 # tag push triggers release.yml publish job (provenance, attestations)
334
+
335
+ # Real publication never bypasses the gates: release.mjs refuses
336
+ # --allow-dirty/--allow-untagged without --dry-run.
337
+ ```
338
+
339
+ **Rollback notes.** `release:publish --version 0.1.3 --resume --report release-artifacts/publish-report.json` resumes an interrupted publication and skips only registry versions whose internal dependency fingerprint matches the local manifest. A failed package aborts the run with its status written to the report; re-run after fixing the cause. npm cannot unpublish the `0.1.3` line after 72 hours — a post-publication defect ships as a `0.1.x` patch (additive-only compat promise, `release:gate` enforced), or as a documented break in the next line with a `docs/migration.md` entry. `0.1.3` is store-compatible with `0.1.2` in **both directions** (no migration ran — same checksum-protected contract), so an operator may defer or roll back the patch without a database rollback.
340
+
276
341
  ### 0.0.28 publish handoff (historical)
277
342
 
278
343
  **Decision: GO after protected operator prerequisites below.** Release **0.0.28** (Phase 11, plan 011) ships the optional enterprise adapter seams: OIDC/JWKS identity verification (`@arnilo/prism-credentials-node/oidc`), OPA policy evaluation into the durable ledger (`@arnilo/prism-policy/opa`), MCP OAuth client/server support (`@arnilo/prism-mcp`), host-selected OpenAPI operations as effect-gated tools (`@arnilo/prism-openapi-tools`), and an S3-compatible artifact body store behind the new core body contract (`@arnilo/prism-server/artifact-bodies`). Every seam is opt-in and fail-closed; hosts that wire none keep exact prior behavior. Publishable graph stays **49** publishable manifests (root + 48 workspace packages; `prism-openapi-tools` joined the graph in this release). See [migration](migration.md) `0.0.27 → 0.0.28`.
@@ -126,7 +126,7 @@ const page = await store.searchSessions!({
126
126
  // Opt out: createMemorySessionStore([], { sessionSearchMode: "unsupported" })
127
127
  ```
128
128
 
129
- Finite caps (defaults / hard): page 20/100; query string 4 KiB/16 KiB; snippet 512 B/4 KiB; cursor 1 KiB/4 KiB; memory linear sessions 1000/5000, entries 10000/50000, bytes 8 MiB/64 MiB; DB FTS candidates 1000/5000. Overflow fails closed via `resolveSessionSearchQuery`. See [Phase 6 evidence](review-coverage-2026-07-22-phase-6.md).
129
+ Finite caps (defaults / hard): page 20/100; query string 4 KiB/16 KiB; snippet 512 B/4 KiB; cursor 1 KiB/4 KiB; memory linear sessions 1000/5000, entries 10000/50000, bytes 8 MiB/64 MiB; DB FTS candidates 1000/5000. Overflow fails closed via `resolveSessionSearchQuery`. See [Phase 6 evidence](_evidence/review-coverage-2026-07-22-phase-6.md).
130
130
 
131
131
  ## Session search (0.0.11)
132
132
 
@@ -144,7 +144,7 @@ const page = await store.searchSessions!({
144
144
  // Opt out: createMemorySessionStore([], { sessionSearchMode: "unsupported" })
145
145
  ```
146
146
 
147
- Finite caps (defaults / hard): page 20/100; query string 4 KiB/16 KiB; snippet 512 B/4 KiB; cursor 1 KiB/4 KiB; memory linear sessions 1000/5000, entries 10000/50000, bytes 8 MiB/64 MiB; DB FTS candidates 1000/5000. Overflow fails closed via `resolveSessionSearchQuery`. See [Phase 6 evidence](review-coverage-2026-07-22-phase-6.md).
147
+ Finite caps (defaults / hard): page 20/100; query string 4 KiB/16 KiB; snippet 512 B/4 KiB; cursor 1 KiB/4 KiB; memory linear sessions 1000/5000, entries 10000/50000, bytes 8 MiB/64 MiB; DB FTS candidates 1000/5000. Overflow fails closed via `resolveSessionSearchQuery`. See [Phase 6 evidence](_evidence/review-coverage-2026-07-22-phase-6.md).
148
148
 
149
149
  ## Security and performance notes
150
150
 
@@ -95,4 +95,4 @@ LLM compaction and observational memory accept `thinkingLevel?: string`. They ca
95
95
  - [Provider request policies](provider-request-policies.md) — `mergeProviderRequestOptions`
96
96
  - [Agent/session runtime](agent-session-runtime.md) — prior-reasoning preservation across turns
97
97
  - Per-provider pages under [docs/providers](providers/)
98
- - Evidence matrix: [Review coverage (2026-07-17 provider validation)](review-coverage-2026-07-17-provider-validation.md)
98
+ - Evidence matrix: [Review coverage (2026-07-17 provider validation)](_evidence/review-coverage-2026-07-17-provider-validation.md)
@@ -4,7 +4,7 @@
4
4
 
5
5
  This page freezes the reusable tool validation, parallel dispatch, MCP bridge, and coding execution-policy designs for Plan 055. It inventories existing `@arnilo/prism` tool harness seams, `@arnilo/prism-coding-agent` behavior, extension/contribution boundaries, and the MCP mapping surface Tasks 1–6 will implement against.
6
6
 
7
- Implementation is **shipped** for JSON Schema tool argument validation (Plan 055 Task 1), parallel single-shot tool dispatch (Task 2), the MCP client bridge (Task 3), coding execution policy (Task 4), and bounded image reads (Task 5). Task 6 verification evidence is recorded in [review coverage](review-coverage-2026-07-14.md).
7
+ Implementation is **shipped** for JSON Schema tool argument validation (Plan 055 Task 1), parallel single-shot tool dispatch (Task 2), the MCP client bridge (Task 3), coding execution policy (Task 4), and bounded image reads (Task 5). Task 6 verification evidence is recorded in [review coverage](_evidence/review-coverage-2026-07-14.md).
8
8
 
9
9
  ## When to use it
10
10
 
@@ -360,7 +360,7 @@ Core remains dependency-free: validators, MCP bridges, coding policy, sandboxes,
360
360
  - [Host security guide](host-security.md): permission, trust, validation checklist
361
361
  - [Coding agent tools](coding-agent-tools.md): first-party tool package behavior and limits
362
362
  - [Extensions](extensions.md): inert tool contributions
363
- - [Review coverage (2026-07-14)](review-coverage-2026-07-14.md): finding → plan traceability
363
+ - [Review coverage (2026-07-14)](_evidence/review-coverage-2026-07-14.md): finding → plan traceability
364
364
 
365
365
  ## Task ownership map
366
366
 
@@ -106,4 +106,4 @@ createLlmCompactionStrategy({
106
106
  - [LLM compaction package](compaction-llm.md)
107
107
  - [Agent/session runtime](agent-session-runtime.md) — `RunOptions.model` / `model_change`
108
108
  - [Working and semantic memory](working-and-semantic-memory.md) — `Embedder` (non-chat)
109
- - Evidence matrix: [Review coverage (2026-07-17 provider validation)](review-coverage-2026-07-17-provider-validation.md)
109
+ - Evidence matrix: [Review coverage (2026-07-17 provider validation)](_evidence/review-coverage-2026-07-17-provider-validation.md)
@@ -579,4 +579,4 @@ await session.run("Hi", { signal: AbortSignal.timeout(60_000) });
579
579
  - [Tool execution primitives](tool-execution-primitives.md): `ExecutionPolicy` and approval pattern.
580
580
  - [Host security guide](host-security.md): fail-closed checklist for workflow hosts.
581
581
  - [Performance limits](performance.md): subscriber queue defaults workflow tightens.
582
- - [Review coverage (2026-07-14)](review-coverage-2026-07-14.md): C-009/C-012 traceability.
582
+ - [Review coverage (2026-07-14)](_evidence/review-coverage-2026-07-14.md): C-009/C-012 traceability.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arnilo/prism",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Agent harness for AI providers, agents, sessions, and tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -107,7 +107,7 @@
107
107
  "!dist/__tests__",
108
108
  "!dist/**/*.map",
109
109
  "docs",
110
- "!docs/review-coverage-*",
110
+ "!docs/_evidence",
111
111
  "templates",
112
112
  "CHANGELOG.md"
113
113
  ],
@@ -141,7 +141,8 @@
141
141
  "clean": "rm -rf dist packages/*/dist",
142
142
  "build": "npm run build:core && npm run build --workspaces --if-present",
143
143
  "typecheck": "npm run build && npm run typecheck --workspaces --if-present && tsc -p examples --noEmit",
144
- "test": "npm run build && node --test dist/__tests__/*.test.js && node --test scripts/release-gate.test.mjs scripts/tooling-gate.test.mjs scripts/budget-gate.test.mjs scripts/phase8-conformance.test.mjs scripts/phase9-conformance.test.mjs scripts/phase10-conformance.test.mjs scripts/phase11-conformance.test.mjs scripts/phase11-freeze.test.mjs scripts/phase12-freeze.test.mjs scripts/phase13-freeze.test.mjs scripts/phase14-freeze.test.mjs scripts/benchmark-0.1.0.test.mjs scripts/e2e-enterprise-journey.test.mjs scripts/e2e-coding-journey.test.mjs && npm run test --workspaces --if-present",
144
+ "sweep:unused": "node scripts/sweep-unused.mjs",
145
+ "test": "npm run build && node --test dist/__tests__/*.test.js && node --test scripts/release-gate.test.mjs scripts/tooling-gate.test.mjs scripts/budget-gate.test.mjs scripts/phase8-conformance.test.mjs scripts/phase9-conformance.test.mjs scripts/phase10-conformance.test.mjs scripts/phase11-conformance.test.mjs scripts/phase11-freeze.test.mjs scripts/phase12-freeze.test.mjs scripts/phase13-freeze.test.mjs scripts/phase14-freeze.test.mjs scripts/phase15-freeze.test.mjs scripts/phase16-freeze.test.mjs scripts/benchmark-0.1.0.test.mjs scripts/sweep-unused.test.mjs scripts/e2e-enterprise-journey.test.mjs scripts/e2e-coding-journey.test.mjs && npm run test --workspaces --if-present",
145
146
  "test:coverage": "node --test --experimental-test-coverage --test-coverage-lines=60 --test-coverage-functions=70 --test-coverage-branches=75 --test-coverage-exclude='**/__tests__/**' --test-coverage-exclude='**/node_modules/**' --test-coverage-exclude='**/scripts/**' --test-coverage-exclude='**/packages/**' --test-coverage-exclude='**/examples/**' dist/__tests__/*.test.js && node scripts/coverage-summary.mjs",
146
147
  "coverage:summary": "node scripts/coverage-summary.mjs",
147
148
  "lint": "biome lint .",