@arnilo/prism 0.3.1 → 0.4.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +34 -57
  3. package/dist/agent-definitions.js +4 -1
  4. package/dist/agent-run-lifecycle.js +4 -0
  5. package/dist/agent-run-state.d.ts +4 -0
  6. package/dist/agent-run-state.js +18 -5
  7. package/dist/agent-session/session.d.ts +7 -0
  8. package/dist/agent-session/session.js +59 -2
  9. package/dist/cli-dev.d.ts +29 -0
  10. package/dist/cli-dev.js +52 -0
  11. package/dist/cli-init.d.ts +17 -2
  12. package/dist/cli-init.js +194 -21
  13. package/dist/cli-runner.d.ts +5 -1
  14. package/dist/cli-runner.js +12 -1
  15. package/dist/contracts-core/agent.d.ts +29 -2
  16. package/dist/contracts-protocol.d.ts +18 -0
  17. package/dist/contracts-run-state.d.ts +1 -2
  18. package/dist/index.d.ts +3 -1
  19. package/dist/index.js +2 -1
  20. package/dist/input.d.ts +8 -0
  21. package/dist/input.js +4 -0
  22. package/dist/rpc.d.ts +4 -1
  23. package/dist/rpc.js +5 -1
  24. package/dist/testing/persistence-schema.d.ts +1 -1
  25. package/dist/testing/persistence-schema.js +32 -28
  26. package/dist/testing/tool-conformance.d.ts +25 -0
  27. package/dist/testing/tool-conformance.js +128 -1
  28. package/dist/tool-search.d.ts +76 -0
  29. package/dist/tool-search.js +199 -0
  30. package/docs/0.1.0-readiness.md +2 -2
  31. package/docs/acp-agent.md +1 -1
  32. package/docs/agent-definitions.md +1 -1
  33. package/docs/antigravity-agent.md +1 -1
  34. package/docs/browser-automation.md +5 -5
  35. package/docs/caveman.md +2 -2
  36. package/docs/cli-rpc.md +26 -3
  37. package/docs/coding-agent-tools.md +7 -1
  38. package/docs/coding-security.md +1 -1
  39. package/docs/coding-tools.md +82 -0
  40. package/docs/compaction-and-retry.md +5 -2
  41. package/docs/compaction-llm.md +4 -4
  42. package/docs/compaction-observational-memory.md +49 -2
  43. package/docs/context-and-skills.md +2 -0
  44. package/docs/core.md +85 -0
  45. package/docs/credential-storage.md +1 -1
  46. package/docs/database-persistence.md +4 -0
  47. package/docs/dev-inspector.md +103 -0
  48. package/docs/diagrams.md +247 -0
  49. package/docs/documents.md +213 -0
  50. package/docs/evaluations.md +35 -1
  51. package/docs/extension-authoring.md +42 -0
  52. package/docs/graft.md +3 -3
  53. package/docs/guardrails.md +1 -1
  54. package/docs/host-security.md +4 -3
  55. package/docs/impeccable.md +2 -2
  56. package/docs/index.md +34 -23
  57. package/docs/mcp-tools.md +1 -1
  58. package/docs/migrate-to-0.4.md +312 -0
  59. package/docs/migration.md +22 -0
  60. package/docs/model-routing.md +1 -1
  61. package/docs/multi-agent-patterns.md +177 -0
  62. package/docs/multimodal-content.md +1 -1
  63. package/docs/obscura.md +10 -10
  64. package/docs/openapi-tools.md +1 -1
  65. package/docs/performance.md +23 -3
  66. package/docs/persistence-credentials-multimodality-primitives.md +1 -1
  67. package/docs/policy-and-audit.md +1 -1
  68. package/docs/ponytail.md +2 -2
  69. package/docs/prompt-registry.md +106 -0
  70. package/docs/provider-caching.md +32 -32
  71. package/docs/provider-conformance.md +1 -1
  72. package/docs/provider-packages.md +19 -19
  73. package/docs/provider-primitives.md +4 -4
  74. package/docs/providers/ai-sdk.md +3 -3
  75. package/docs/providers/alibaba.md +5 -5
  76. package/docs/providers/anthropic.md +6 -6
  77. package/docs/providers/azure.md +3 -3
  78. package/docs/providers/bedrock.md +3 -3
  79. package/docs/providers/clinepass.md +3 -3
  80. package/docs/providers/deepseek.md +3 -3
  81. package/docs/providers/google.md +4 -4
  82. package/docs/providers/kimi.md +3 -3
  83. package/docs/providers/neuralwatt.md +8 -8
  84. package/docs/providers/ollama.md +3 -3
  85. package/docs/providers/openai-compatible.md +1 -1
  86. package/docs/providers/openai.md +5 -5
  87. package/docs/providers/opencode-go.md +4 -4
  88. package/docs/providers/openrouter.md +3 -3
  89. package/docs/providers/vertex.md +5 -5
  90. package/docs/providers/xai.md +3 -3
  91. package/docs/providers/zai.md +3 -3
  92. package/docs/public-contracts.md +1 -1
  93. package/docs/rag.md +5 -5
  94. package/docs/release-and-install.md +116 -50
  95. package/docs/runs-and-usage.md +14 -1
  96. package/docs/server.md +90 -1
  97. package/docs/sheets.md +229 -0
  98. package/docs/supervisors.md +9 -1
  99. package/docs/thinking-and-reasoning.md +10 -10
  100. package/docs/tool-conformance.md +27 -2
  101. package/docs/tools.md +29 -2
  102. package/docs/web-tools.md +2 -2
  103. package/docs/wiki.md +24 -10
  104. package/docs/workflow-orchestration-primitives.md +24 -0
  105. package/docs/workflows.md +102 -8
  106. package/docs/working-and-semantic-memory.md +53 -5
  107. package/package.json +10 -30
  108. package/templates/README.md +23 -0
  109. package/templates/deep-research/README.md.tmpl +47 -0
  110. package/templates/deep-research/env.example.tmpl +12 -0
  111. package/templates/deep-research/gitignore.tmpl +7 -0
  112. package/templates/deep-research/manifest.json +12 -0
  113. package/templates/deep-research/package.json.tmpl +23 -0
  114. package/templates/deep-research/src/agent.ts.tmpl +81 -0
  115. package/templates/deep-research/src/index.ts.tmpl +53 -0
  116. package/templates/deep-research/src/tests/research.test.ts.tmpl +114 -0
  117. package/templates/deep-research/src/tools.ts.tmpl +86 -0
  118. package/templates/deep-research/src/types.ts.tmpl +45 -0
  119. package/templates/deep-research/src/workflow.ts.tmpl +156 -0
  120. package/templates/deep-research/tsconfig.json.tmpl +15 -0
  121. package/templates/init/manifest.json +5 -0
  122. package/templates/init/package.json.tmpl +2 -1
  123. package/templates/init/providers.json +16 -16
package/CHANGELOG.md CHANGED
@@ -1,3 +1,61 @@
1
+ ## [0.4.0] - 2026-09-01 (plan 054)
2
+
3
+ ### Changed
4
+ - **Package consolidation (breaking import/package cut):** 11 active packages replace the 0.3.x graph. Families: `@arnilo/prism-core`, `@arnilo/prism-coding-tools`, `@arnilo/prism-web-tools`, `@arnilo/prism-memory`, `@arnilo/prism-providers` (17 adapter subpaths), `@arnilo/prism-office` (`/documents`, `/sheets`, `/diagrams`). Retired 54 published names stay installable at exact 0.3 pins; npm `legacy` dist-tag + `<0.4.0` deprecation warnings point at `docs/migrate-to-0.4.md`. Profile packages `prism-base`/`prism-code`/`prism-sdk`/`prism-all`/`prism-compaction` are gone — install the families. Peers and internal ranges are `^0.4.0`. No persisted-shape change; rollback = exact 0.3 pins.
5
+
6
+ ## [0.3.3] - 2026-08-31 (plans 041-044, 051, 052, 053)
7
+
8
+ ### Added
9
+ - **Documents engine (`@arnilo/prism-documents@0.3.0`, plan 051)**: Initial release of `@arnilo/prism-documents` with peer `@arnilo/prism@^0.3.0` (independent Decision B publication, omitted from `@arnilo/prism-all` and profile packages) — pure in-memory OpenXML generation, parsing, patching, and bounded preview rendering for Word (`.docx`), Excel (`.xlsx`), and PowerPoint (`.pptx`) artifacts; exact-pinned sub-packages `@office-open/{docx,xlsx,pptx}@0.12.3`; Draft-07 JSON Schema validation with on-demand slicing (`getDocumentModelSchema`) and transitive closures; typed AST patch engine with immutable undo/redo history (`createPatchHistory`); framework-neutral preview blocks and sanitize-by-construction HTML snippets; `SecretRedactor` boundary sanitization hook; dependency-free `DocumentsTelemetry` seam; and documented decimal fidelity ceiling (`{ type: "decimal", value: string }` representation with IEEE-754 round-trip limits in Excel cells).
10
+ - **Spreadsheet & CSV parsing engine (`@arnilo/prism-sheets@0.3.0`, plan 052)**: Initial release of `@arnilo/prism-sheets` with peer `@arnilo/prism@^0.3.0` (independent Decision B publication, omitted from `@arnilo/prism-all` and profile packages) — XLSX (`@office-open/xlsx@0.12.3` exact pin) and zero-dependency RFC 4180 CSV parsing with dialect sniffing (delimiter scoring across `,`, `;`, `\t`, `|`, quoted-region isolation, UTF-8 BOM stripping, UTF-16 rejection); decimal-safe typed schema inference (`inferAndTransformRows`, `normalizeDecimal`) with headline financial precision guarantees (monetary figures and currency patterns inferred as decimal strings `{ type: "decimal", value: string }` with zero floating-point coercion on decimal value paths; ambiguous numerics flagged `numeric-ambiguous`); bounded sampling window with full-parse validation; fail-closed caps (`DEFAULT_SHEETS_CAPS`: 100 MB file, 5M rows, 16k columns, 256 sheets, 500-row sample window, 20 max warnings); structured `InferenceWarning` and `SheetsDialectMismatchWarning` diagnostics; formula cell representation (`{ type: "formula", formula: string, value?: CellValue }`); dependency-free `SheetsTelemetry` seam.
11
+ - **Diagrams & draw.io embed client (`@arnilo/prism-diagrams@0.3.0`, plan 053)**: Initial release of `@arnilo/prism-diagrams` with peer `@arnilo/prism@^0.3.0` (independent Decision B publication, omitted from `@arnilo/prism-all` and profile packages) — origin-enforced iframe embed client (`createDrawioEmbed`) implementing diagrams.net `proto=json` protocol with dual inbound origin/source verification, strict outbound targetOrigin enforcement, and no public SaaS defaults (self-hosting as the documented deployment); typed lifecycle events (`init`, `load`, `save`, `autosave`, `exit`, `configure`, `export`, `error`); save-with-preview workflows generating SVG (`xmlsvg`) or PNG visual snapshots; XXE-safe mxGraph XML validation (`validateDrawioXml`) rejecting DOCTYPE/ENTITY declarations and billion-laughs payloads under strict element/attribute/byte caps; byte-stable deterministic XML canonicalization (`canonicalizeDrawioXml`) for content hashing; Visio binary (`.vsd`) and OpenXML (`.vsdx`) exclusion guard (`assertNotVisio`, P12); and dependency-free telemetry seam (`DiagramsTelemetry`, P15).
12
+ - **Progressive tool loading (plan 041)**: `search_tools({ query, k? })` — bounded inert name+description results (lexical disclosure, never wider than the eligible list, never zero via deterministic prefix), session-scoped activation persisted as names-only, dispatch re-checks allow/deny on every call (disclosure is not an authorization boundary). Benchmark: 86.4% provider-request tool-byte reduction at 128 tools / topK 16.
13
+ - **Prompt provenance (plan 042)**: `RunRecord.promptVersion` refs carried from `RunOptions` to durable run rows; session-store packages add the additive nullable `prompt_version` column + checked migrations (`@arnilo/prism-session-store-{codecs,sqlite,postgres}@0.3.1`); `PERSISTENCE_SCHEMA_VERSION` 8 → 9. `@arnilo/prism-prompts@0.0.1` initial cut ships the versioned immutable prompt store (independent host opt-in).
14
+ - **Docs**: `docs/documents.md` (documents, spreadsheets, and presentations hub guide), `docs/sheets.md` (spreadsheet and CSV parsing guide with decimal-safety invariant), `docs/diagrams.md` (diagramming and draw.io embed guide with origin-enforcement security), `docs/prompt-registry.md` (prompt registry contract), and composite memory recall scoring in `docs/working-and-semantic-memory.md`.
15
+ - **Package consolidation (plan 054, completed in 0.4.0)**: `@arnilo/prism-core` (Task 2) absorbs 16 runtime/session/governance/credentials/enterprise/work/validation packages behind explicit subpaths; `@arnilo/prism-coding-tools` (Task 3) absorbs nine coding/persona packages with the retained `prism-dev` bin; `@arnilo/prism-web-tools` (Task 4) absorbs `@arnilo/prism-browser` and `@arnilo/prism-obscura` as peer-gated `/browser` and `/obscura` subpaths; `@arnilo/prism-memory` (Task 5) absorbs `@arnilo/prism-rag`, both compaction strategies, `@arnilo/prism-graft`, and `@arnilo/prism-wiki` as `/rag`, `/compaction/{llm,observational-memory}`, `/graft`, and `/wiki` subpaths (deleting the `@arnilo/prism-compaction` profile; `prism-wiki` bin and skills ship from the memory tarball); `@arnilo/prism-providers` (Task 6) absorbs all 17 `@arnilo/prism-provider-*` packages as `/<adapter>` subpaths (deleting the standalone provider manifests, the 14-of-17 umbrella dependency set, and the Azure/Bedrock/Vertex all-only special case; the `/ai-sdk` adapter resolves its `@ai-sdk/provider` optional peer lazily at factory time) — public symbols and trust boundaries unchanged except import specifiers. A generated legacy-registry plan (`scripts/phase54-legacy-registry.mjs`) freezes each of the 54 retired names' final published version behind a `legacy` dist-tag and a `<0.4.0` install-time deprecation warning naming its exact 0.4 successor and migration-guide anchor; `--dry-run` verifies versions/anchors without mutating the registry and `--apply --confirm` is the idempotent, fail-closed cutover (Task 9). `@arnilo/prism-office` (Task 8) absorbs the unpublished documents/sheets/diagrams drafts as `/documents`, `/sheets`, `/diagrams` subpaths and deletes the `prism-base`/`prism-code`/`prism-sdk`/`prism-all` profile manifests; the 0.4 migration guide maps every retired name plus the office drafts.
16
+ - Package-level detail: `@arnilo/prism-memory@0.3.2` (composite recall scoring + importance at write), `@arnilo/prism-evals@0.3.1` (trace-to-dataset curation), `@arnilo/prism-documents@0.3.0` (initial cut), `@arnilo/prism-sheets@0.3.0` (initial cut), and `@arnilo/prism-diagrams@0.3.0` (initial cut).
17
+
18
+ ## [0.3.2] - 2026-08-29 (plan 050)
19
+
20
+ ### Added
21
+ - **OKF adoption (`@arnilo/prism-wiki`)**: wiki-init/refresh/lint emit and validate
22
+ OKF v0.2 bundles (Karpathy prompt retained). See `docs/wiki.md`.
23
+ - **DOCS-1 (Clay integration findings)**: three integrator contracts, in place on
24
+ the pages that own them — resume-aware workflow nodes (`ctx.resume` or silent
25
+ re-suspend) in `docs/workflows.md`; supervisor child factories return `Agent`
26
+ not `AgentSession` (`SupervisorError: child "<id>" factory must return an
27
+ Agent, got <type>`) plus durable-store nested approvals in `docs/supervisors.md`;
28
+ task-boundary `session.compact()` fails closed during an active run in
29
+ `docs/compaction-and-retry.md`. Each block links `examples/autonomous-coding-loop.ts`.
30
+ - **FEATURE-2 (Clay integration findings)**: documented bounded iterate-until-done
31
+ host-loop pattern in `docs/workflows.md` — one `runWorkflow` per iteration,
32
+ iteration state in workflow inputs, explicit termination predicate and budgets,
33
+ typed `BudgetExhaustedError` (fail-closed, never a hang), `replayWorkflow` per
34
+ iteration run id. Seeded by `examples/autonomous-coding-loop.ts`. Plan 045 `loop`
35
+ node remains the future in-graph primitive; this intake ships the docs+example
36
+ minimum only.
37
+ - **FEATURE-6 (Clay integration findings)**: composite `examples/autonomous-coding-loop.ts`
38
+ conformance reference — goal → roadmap → per-task supervisor children (per-child
39
+ models) → `runCodingGoalVerify`-style validation → observational-memory attach +
40
+ task-boundary compact + recall → human gate with simulated restart → host-side
41
+ bounded iterate-until-done with deterministic budget exhaustion. Mock providers
42
+ only; no credentials or network.
43
+ - **FEATURE-3 (Clay integration findings)**: host-opt-in command driver hooks.
44
+ `CommandExecutionContext` gains an optional `drivers?: CommandDrivers`
45
+ (`startRun` / `startWorkflow` / `steer` — typed minimal handles returning
46
+ `AgentRunResult`-shaped results / workflow run id + status) so a contributed
47
+ command can act through host-injected capabilities instead of being
48
+ re-implemented host-side. The RPC session factory accepts `drivers` and
49
+ forwards them at the single command-execution site; absent drivers leave
50
+ the context shape unchanged (no key, no allocation). Drivers are
51
+ host-injected capabilities, never package-supplied.
52
+ ### Fixed
53
+ - **FEATURE-1 (Clay integration findings)**: `resolveAgentDefinition` no longer
54
+ throws `Agent "<name>" has no model` when the declarative definition omits
55
+ `model` but `context.overrides.model` supplies one — the fallback is a
56
+ single `??` at `buildBaseConfig`, the `create()` path is unchanged, and a
57
+ definition with neither source still fails closed.
58
+
1
59
  ## [0.3.1] - 2026-08-29
2
60
 
3
61
  > Root + 28 changed packages move to 0.3.1 in the plan 039 changed-package cut; `@arnilo/prism-rag` moves 0.3.1 → 0.3.2; `@arnilo/prism-obscura` publishes new at 0.3.0. Distinct from the 2026-08-26 rag/memory/otel 0.3.1 patch below (independent Decision B tags).
package/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
  bring their tools, providers, credentials, storage, and UI; Prism supplies the
5
5
  common contracts, registries, agent/session runtime, replaceable input/prompt
6
6
  and compaction strategies, CLI/RPC adapters, and first-party provider/compaction
7
- packages. The current 0.3.0 line contains 56 publishable manifests, including
8
- optional Linux desktop control and independent package versioning after the final
9
- lockstep cut. Prism defines contracts, not apps.
7
+ packages. The current 0.3.3 line contains 11 publishable manifests, including
8
+ optional Linux desktop control, a versioned prompt registry, and independent
9
+ package versioning after the final lockstep cut. Prism defines contracts, not apps.
10
10
 
11
11
  ## Current scope
12
12
 
@@ -20,7 +20,7 @@ lockstep cut. Prism defines contracts, not apps.
20
20
  OpenAI/OpenRouter use best-effort explicit cache hints, NeuralWatt uses
21
21
  best-effort implicit prefix caching, and other providers have route/model-specific
22
22
  or no cache-control support; see [docs/provider-caching.md](docs/provider-caching.md).
23
- - **First-party packages**: seventeen provider adapters, two compaction strategies,
23
+ - **First-party packages**: seventeen provider adapter subpaths, two compaction strategies,
24
24
  coding tools/security, JSON Schema validation, MCP, workflows, OpenTelemetry,
25
25
  encrypted credentials, SQLite/PostgreSQL persistence, Linux desktop control,
26
26
  and manifest-only install profiles.
@@ -31,8 +31,8 @@ lockstep cut. Prism defines contracts, not apps.
31
31
  layering, and provider-input assembly — every stage replaceable.
32
32
  - **Sessions and memory**: in-memory and JSONL session stores, branching/fork/
33
33
  clone, default and LLM compaction strategies, retry policy,
34
- observational-memory recall/status/view, optional working/semantic memory
35
- (`@arnilo/prism-memory`), and bounded text/Markdown RAG (`@arnilo/prism-rag`).
34
+ observational-memory recall/status/view, and the `@arnilo/prism-memory` family
35
+ (working/semantic memory plus `/rag`, `/compaction/*`, `/graft`, `/wiki` subpaths).
36
36
  - **Extensions and manifests**: extension kernel + event bus, contribution
37
37
  registries, middleware hooks, and data-only package manifests.
38
38
  - **Config, settings, security**: layered config merge, settings providers,
@@ -55,14 +55,14 @@ a non-optional peer. Install atomic packages directly or choose a manifest-only
55
55
  family/profile; profiles install packages but expose no alias exports and activate nothing:
56
56
 
57
57
  ```bash
58
- npm install @arnilo/prism @arnilo/prism-provider-openai # core + one provider
59
- npm install @arnilo/prism-base # core + compaction + validation
60
- npm install @arnilo/prism-code @arnilo/prism-provider-openai # coding-agent profile
61
- npm install @arnilo/prism-sdk @arnilo/prism-provider-openai # application profile
62
- npm install @arnilo/prism-all # broad umbrella (21 direct / 47 workspace packages)
58
+ npm install @arnilo/prism @arnilo/prism-providers # core + all 17 provider adapters
59
+ npm install @arnilo/prism @arnilo/prism-core @arnilo/prism-memory # replaces prism-base
60
+ npm install @arnilo/prism @arnilo/prism-coding-tools @arnilo/prism-mcp @arnilo/prism-providers # replaces prism-code
61
+ npm install @arnilo/prism @arnilo/prism-core @arnilo/prism-mcp @arnilo/prism-providers # replaces prism-sdk
62
+ npm install @arnilo/prism @arnilo/prism-core @arnilo/prism-providers # pick families explicitly (no umbrella)
63
63
  npm install @arnilo/prism-server @arnilo/prism-workflows # optional Web API boundary
64
64
  npm install @arnilo/prism-supervisor # optional local delegation + A2A 1.0
65
- npm install @arnilo/prism-web-tools # optional bounded Brave/Exa/Firecrawl research
65
+ npm install @arnilo/prism-web-tools # unified web tools family (root search + /browser + /obscura subpaths)
66
66
  ```
67
67
 
68
68
  See [docs/release-and-install.md](docs/release-and-install.md) for install
@@ -70,15 +70,23 @@ specifiers, tarball contents, and the offline test budget.
70
70
 
71
71
  ## Quick start
72
72
 
73
- Scaffold a tiny project (offline mock test included):
73
+ Scaffold a project (offline mock test included):
74
74
 
75
75
  ```bash
76
76
  npx --package @arnilo/prism prism init my-agent
77
- # or, with a real provider package selected:
77
+ # or, scaffold with a real provider package selected:
78
78
  npx --package @arnilo/prism prism init my-agent --provider openai
79
+ # or, scaffold a full deep research agent from the template gallery:
80
+ npx --package @arnilo/prism prism init my-research --template deep-research
79
81
  cd my-agent && npm install && npm test
80
82
  ```
81
83
 
84
+ List available template gallery starters:
85
+ ```bash
86
+ prism init --list-templates
87
+ ```
88
+
89
+
82
90
  Or embed Prism directly:
83
91
 
84
92
  ```ts
@@ -118,7 +126,7 @@ Register a first-party provider package through the extension kernel:
118
126
 
119
127
  ```ts
120
128
  import { createExtensionKernel, createEnvCredentialResolver } from "@arnilo/prism";
121
- import { createOpenAIProviderPackage } from "@arnilo/prism-provider-openai";
129
+ import { createOpenAIProviderPackage } from "@arnilo/prism-providers/openai";
122
130
 
123
131
  const kernel = createExtensionKernel();
124
132
  await kernel.load([
@@ -153,47 +161,16 @@ printf '{"id":"1","command":"prompt","params":{"input":"Hi"}}\n' \
153
161
  | package | purpose |
154
162
  |---------|---------|
155
163
  | `@arnilo/prism` | core contracts, runtime, registries, CLI/RPC |
156
- | `@arnilo/prism-provider-openai` | OpenAI Responses + Codex OAuth provider |
157
- | `@arnilo/prism-provider-opencode-go` | OpenCode Go provider |
158
- | `@arnilo/prism-provider-openrouter` | OpenRouter provider with per-model cache control |
159
- | `@arnilo/prism-provider-zai` | ZAI GLM provider |
160
- | `@arnilo/prism-provider-kimi` | Kimi For Coding provider |
161
- | `@arnilo/prism-provider-neuralwatt` | NeuralWatt provider with implicit vLLM prefix caching |
162
- | `@arnilo/prism-provider-alibaba` | Alibaba Cloud (Model Studio / DashScope + Coding Plan) provider with dynamic discovery and explicit/implicit caching |
163
- | `@arnilo/prism-provider-ollama` | Ollama Cloud / local provider with dynamic discovery and implicit-only caching |
164
- | `@arnilo/prism-provider-anthropic` | Anthropic Messages provider |
165
- | `@arnilo/prism-provider-google` | Google Gemini provider |
166
- | `@arnilo/prism-provider-deepseek` | DeepSeek Chat Completions provider |
167
- | `@arnilo/prism-provider-xai` | xAI Grok Completions + SuperGrok OAuth |
168
- | `@arnilo/prism-provider-clinepass` | ClinePass OpenAI-compatible gateway |
169
- | `@arnilo/prism-provider-azure` | Azure OpenAI provider |
170
- | `@arnilo/prism-provider-bedrock` | AWS Bedrock provider |
171
- | `@arnilo/prism-provider-vertex` | Google Vertex provider |
172
- | `@arnilo/prism-provider-ai-sdk` | AI SDK interoperability adapter |
173
- | `@arnilo/prism-browser` | optional host-wired Playwright browser automation (not core; not auto-activated) |
174
- | `@arnilo/prism-obscura` | optional Obscura headless-browser engine over a host-installed binary: MCP surface, CDP + Playwright, bounded CLI web tools (not in umbrellas; install explicitly) |
175
- | `@arnilo/prism-computer-use-linux` | optional Linux desktop-control tools over a host-owned `computer-use-linux` MCP binary |
176
- | `@arnilo/prism-antigravity-agent` | optional Antigravity CLI delegated agent adapter with per-run Prism MCP capability exposure |
177
- | `@arnilo/prism-wiki` | optional Karpathy LLM Wiki knowledge compiler with local `qmd` hybrid search and Context7 line navigation |
178
- | `@arnilo/prism-compaction-llm` | provider-backed compaction strategy |
179
- | `@arnilo/prism-compaction-observational-memory` | source-backed memory + recall tool |
180
- | `@arnilo/prism-coding-agent` | bounded shell/read/write/edit tools |
181
- | `@arnilo/prism-coding-security` | coding approval, containment, and sandbox adapters |
182
- | `@arnilo/prism-tool-validator-json-schema` | bounded JSON Schema tool validation |
183
- | `@arnilo/prism-mcp` | MCP client/tool bridge |
184
- | `@arnilo/prism-workflows` | bounded DAG workflows, durable suspend/resume, schedules/background runs, composition/state/replay, and multi-process coordination |
185
- | `@arnilo/prism-supervisor` | bounded local child delegation and A2A 1.0 interoperability |
186
- | `@arnilo/prism-web-tools` | host-selected bounded Brave/Exa search and Firecrawl Markdown/schema extraction |
187
- | `@arnilo/prism-observability-opentelemetry` | optional OpenTelemetry adapter |
188
- | `@arnilo/prism-credentials-node` | encrypted-file and keychain credentials |
189
- | `@arnilo/prism-session-store-sqlite` | SQLite persistence/checkpoints/leases/owned run feedback |
190
- | `@arnilo/prism-session-store-postgres` | PostgreSQL persistence/checkpoints/leases/owned run feedback |
191
- | `@arnilo/prism-providers` | family: 14 of 17 first-party provider adapters (omits Azure, Bedrock, Vertex, which `prism-all` adds separately), including AI SDK interoperability |
192
- | `@arnilo/prism-compaction` | family: both compaction strategies |
193
- | `@arnilo/prism-base` | profile: core + compaction + JSON Schema validation |
194
- | `@arnilo/prism-code` | profile: base + coding tools/security + MCP |
195
- | `@arnilo/prism-sdk` | profile: base + workflows + MCP + credentials + OpenTelemetry |
196
- | `@arnilo/prism-all` | broad umbrella: 21 first-party packages (47 transitive) across a 47-package workspace closure — omits document-reader, OpenAPI tools, NATS, Caveman, Ponytail, Impeccable, computer-use-linux, antigravity-agent, Graft, Obscura, and wiki |
164
+ | `@arnilo/prism-core` | runtime/sessions/governance/credentials/enterprise/work/validation family |
165
+ | `@arnilo/prism-providers` | all 17 first-party adapters as `/<adapter>` subpaths (openai, anthropic, google, azure, bedrock, vertex, deepseek, xai, zai, alibaba, kimi, clinepass, neuralwatt, ollama, opencode-go, openrouter, ai-sdk) |
166
+ | `@arnilo/prism-coding-tools` | `/agent`, `/security`, `/document-reader`, `/openapi`, `/computer-use-linux`, `/dev`, `/caveman`, `/ponytail`, `/impeccable` |
167
+ | `@arnilo/prism-web-tools` | Brave/Exa/Firecrawl plus peer-gated `/browser` and `/obscura` |
168
+ | `@arnilo/prism-memory` | memory plus `/rag`, `/compaction/{llm,observational-memory}`, `/graft`, `/wiki` |
169
+ | `@arnilo/prism-mcp` | MCP client/server/OAuth interop |
170
+ | `@arnilo/prism-acp-agent` | ACP adapter |
171
+ | `@arnilo/prism-ag-ui` | AG-UI/A2A/A2UI adapter |
172
+ | `@arnilo/prism-antigravity-agent` | Antigravity CLI adapter |
173
+ | `@arnilo/prism-office` | `/documents`, `/sheets`, `/diagrams` |
197
174
 
198
175
  ## Scripts
199
176
 
@@ -207,6 +184,6 @@ printf '{"id":"1","command":"prompt","params":{"input":"Hi"}}\n' \
207
184
  ## Non-goals (v1)
208
185
 
209
186
  - Privileged tools, MCP servers, telemetry, credentials, or databases activated by install — hosts explicitly configure and register every capability.
210
- - Browser automation or interactive terminal UI in core — hosts may opt into `@arnilo/prism-browser` with their own Playwright lifecycle; Prism does not auto-start browsers or ship a TUI.
187
+ - Browser automation or interactive terminal UI in core — hosts may opt into the `@arnilo/prism-web-tools/browser` subpath with their own Playwright lifecycle; Prism does not auto-start browsers or ship a TUI.
211
188
  - Provider, credential, extension, or package auto-discovery.
212
189
  - Core-owned database drivers, secret persistence, sandbox, or application policy — optional packages implement adapters over host-owned boundaries.
@@ -20,7 +20,10 @@ export function resolveAgentDefinition(def, context) {
20
20
  return createAgent(applyConfigOverrides(baseConfig, context.overrides));
21
21
  }
22
22
  function buildBaseConfig(def, context) {
23
- const model = resolveModel(def.name, def.model, context);
23
+ // Model precedence: explicit def.model wins; a definition without a model
24
+ // falls back to context.overrides.model (host-injected selection). Neither
25
+ // present still fails closed in resolveModel.
26
+ const model = resolveModel(def.name, def.model ?? context.overrides?.model, context);
24
27
  const tools = resolveTools(def.tools, context);
25
28
  const skills = resolveSkills(def.skills, tools, context);
26
29
  return {
@@ -101,6 +101,10 @@ async function prepareAgentRunResume(agent, ref, resume, options, signal) {
101
101
  if (options.persistSessionState && state.sessionState?.loadedSkillNames) {
102
102
  session.restoreLoadedSkills(state.sessionState.loadedSkillNames);
103
103
  }
104
+ // Plan 041: re-add search-activated tool names (names only; absent tools stay inert until re-searched).
105
+ if (options.persistSessionState && state.sessionState?.activatedToolNames) {
106
+ session.restoreActivatedTools(state.sessionState.activatedToolNames);
107
+ }
104
108
  // Plan 018 Task 6 (closeout `checkpoint-bodies`): restore exact instructions so the
105
109
  // resumed session renders them registry-independently (no load_skill round-trip).
106
110
  if (options.persistSessionState && options.includeSkillBodies && state.sessionState?.loadedSkillBodies) {
@@ -43,11 +43,15 @@ export interface StoredAgentRunState extends AgentRunState {
43
43
  readonly sessionState?: {
44
44
  readonly loadedSkillNames?: readonly string[];
45
45
  readonly loadedSkillBodies?: readonly LoadedSkillBodiesEntry[];
46
+ /** Plan 041: tools activated via `search_tools` (names only; inert for absent tools on restore). */
47
+ readonly activatedToolNames?: readonly string[];
46
48
  };
47
49
  }
48
50
  /** Session-state caps (plan 015 Task 4): bounded names charged against the run-state byte budget. */
49
51
  export declare const MAX_PERSISTED_SKILL_NAMES = 64;
50
52
  export declare const MAX_PERSISTED_SKILL_NAME_CHARS = 256;
53
+ /** Plan 041: activated-tool names ride the same budget discipline (cap 128; multiple searches accumulate). */
54
+ export declare const MAX_PERSISTED_ACTIVATED_TOOL_NAMES = 128;
51
55
  /** Revision stamps of the built-in loops; custom strategies declare their own `revision`. */
52
56
  export declare const BUILT_IN_LOOP_REVISIONS: Readonly<Record<string, string>>;
53
57
  /** Validate a strategy snapshot as JSON-compatible and package it for the durable envelope. */
@@ -10,6 +10,8 @@ const MAX_PROPERTIES = 256;
10
10
  /** Session-state caps (plan 015 Task 4): bounded names charged against the run-state byte budget. */
11
11
  export const MAX_PERSISTED_SKILL_NAMES = 64;
12
12
  export const MAX_PERSISTED_SKILL_NAME_CHARS = 256;
13
+ /** Plan 041: activated-tool names ride the same budget discipline (cap 128; multiple searches accumulate). */
14
+ export const MAX_PERSISTED_ACTIVATED_TOOL_NAMES = 128;
13
15
  /** Revision stamps of the built-in loops; custom strategies declare their own `revision`. */
14
16
  export const BUILT_IN_LOOP_REVISIONS = {
15
17
  "single-shot": "1",
@@ -252,14 +254,25 @@ function validateSessionState(sessionState) {
252
254
  }
253
255
  }
254
256
  const names = sessionState.loadedSkillNames;
255
- if (names === undefined)
257
+ if (names !== undefined) {
258
+ if (!Array.isArray(names) || names.length > MAX_PERSISTED_SKILL_NAMES) {
259
+ throw new AgentRunStateError(`Loaded-skill names exceed ${MAX_PERSISTED_SKILL_NAMES} entries`);
260
+ }
261
+ for (const name of names) {
262
+ if (typeof name !== "string" || name.length > MAX_PERSISTED_SKILL_NAME_CHARS) {
263
+ throw new AgentRunStateError(`Loaded-skill name exceeds ${MAX_PERSISTED_SKILL_NAME_CHARS} chars`);
264
+ }
265
+ }
266
+ }
267
+ const activated = sessionState.activatedToolNames;
268
+ if (activated === undefined)
256
269
  return;
257
- if (!Array.isArray(names) || names.length > MAX_PERSISTED_SKILL_NAMES) {
258
- throw new AgentRunStateError(`Loaded-skill names exceed ${MAX_PERSISTED_SKILL_NAMES} entries`);
270
+ if (!Array.isArray(activated) || activated.length > MAX_PERSISTED_ACTIVATED_TOOL_NAMES) {
271
+ throw new AgentRunStateError(`Activated-tool names exceed ${MAX_PERSISTED_ACTIVATED_TOOL_NAMES} entries`);
259
272
  }
260
- for (const name of names) {
273
+ for (const name of activated) {
261
274
  if (typeof name !== "string" || name.length > MAX_PERSISTED_SKILL_NAME_CHARS) {
262
- throw new AgentRunStateError(`Loaded-skill name exceeds ${MAX_PERSISTED_SKILL_NAME_CHARS} chars`);
275
+ throw new AgentRunStateError(`Activated-tool name exceeds ${MAX_PERSISTED_SKILL_NAME_CHARS} chars`);
263
276
  }
264
277
  }
265
278
  }
@@ -26,6 +26,7 @@ export declare class RuntimeAgentSession implements AgentSession {
26
26
  private activeIdempotencyKey?;
27
27
  private activeGuardrails?;
28
28
  private activeMetadata?;
29
+ private activePromptVersion?;
29
30
  private activeLimits?;
30
31
  private activeLimitOutputBuffer;
31
32
  private activeDurable?;
@@ -34,12 +35,18 @@ export declare class RuntimeAgentSession implements AgentSession {
34
35
  private activeGatedRound?;
35
36
  private activeLoopTurn;
36
37
  private readonly loadedSkills;
38
+ /** Tools activated via `search_tools` this session (plan 041); names-only in persistence. */
39
+ private readonly activatedTools;
37
40
  /** Plan 018 Task 6 (closeout `checkpoint-bodies`): persisted exact instructions, registry-independent. */
38
41
  private restoredSkillBodies;
39
42
  /** Skills of the current run (for the bodies snapshot); replaced at each run start. */
40
43
  private activeRunSkills;
41
44
  /** Plan 015 Task 4: re-add persisted loaded-skill names (names only; bodies re-resolve on demand). */
42
45
  restoreLoadedSkills(names: readonly string[]): void;
46
+ /** Plan 041: re-add persisted activated-tool names (names only; inert for absent tools). */
47
+ restoreActivatedTools(names: readonly string[]): void;
48
+ /** Plan 041: host reset of search-activated tools. */
49
+ clearActivatedTools(): void;
43
50
  /** Plan 018 Task 6: restore persisted loaded-skill bodies (already validated fail-closed at load). */
44
51
  restoreLoadedSkillBodies(bodies: readonly LoadedSkillBodiesEntry[]): void;
45
52
  private ledgerChain;
@@ -23,10 +23,31 @@ import { assertStructuredOutputRequestSupported, resolveRunProviderOptions } fro
23
23
  import { composeSystemPrompt, mergeSystemPromptConfig } from "../system-prompts.js";
24
24
  import { canonicalToolEffectJson, toolEffectArgumentsHash } from "../tool-effects.js";
25
25
  import { resolveToolResultFold } from "../tool-result-fold.js";
26
- import { dispatchToolCall, resolveToolEffectDeclaration } from "../tools.js";
26
+ import { createActiveToolSet, createSearchToolsTool, createToolSearchState, resolveToolsDisclosure } from "../tool-search.js";
27
+ import { createToolRegistry, dispatchToolCall, resolveToolEffectDeclaration } from "../tools.js";
27
28
  import { createAgentSession } from "./create-agent.js";
28
29
  import { EventSubscriber } from "./event-subscriber.js";
29
30
  import { bridgeAbort, createUsageAccumulator, errorFromInfo, finalAssistantMessage, inputToMessages, isDurableLoop, isSteerSoftInterrupt, jsonBytes, mergeCompaction, mergeGuardrails, mergeRetry, messageTextBytes, ProviderTurnFailure, providerContent, randomId, reconstructMissingToolCalls, SteerSoftInterrupt, throwIfAborted, throwIfAbortedSignal, withoutTrailingInput, } from "./helpers.js";
31
+ const PROMPT_VERSION_MAX_NAME_BYTES = 256;
32
+ const PROMPT_VERSION_HASH_PATTERN = /^sha256:[0-9a-f]{64}$/;
33
+ /** Plan 042: validate the opaque provenance ref fail-closed before any session mutation. */
34
+ function assertPromptVersionRef(ref) {
35
+ if (ref === undefined)
36
+ return undefined;
37
+ if (typeof ref !== "object" || ref === null)
38
+ throw new TypeError("RunOptions.promptVersion must be a PromptVersionRef object");
39
+ const { name, version, hash } = ref;
40
+ if (typeof name !== "string" || name.length === 0 || Buffer.byteLength(name, "utf8") > PROMPT_VERSION_MAX_NAME_BYTES) {
41
+ throw new TypeError(`RunOptions.promptVersion.name must be 1-${PROMPT_VERSION_MAX_NAME_BYTES} UTF-8 bytes`);
42
+ }
43
+ if (!Number.isInteger(version) || version < 1 || version > 0x7fffffff) {
44
+ throw new TypeError("RunOptions.promptVersion.version must be an integer in [1, 2147483647]");
45
+ }
46
+ if (typeof hash !== "string" || !PROMPT_VERSION_HASH_PATTERN.test(hash)) {
47
+ throw new TypeError('RunOptions.promptVersion.hash must be "sha256:" plus 64 lowercase hex characters');
48
+ }
49
+ return ref;
50
+ }
30
51
  export class RuntimeAgentSession {
31
52
  id;
32
53
  agent;
@@ -50,6 +71,7 @@ export class RuntimeAgentSession {
50
71
  activeIdempotencyKey;
51
72
  activeGuardrails;
52
73
  activeMetadata;
74
+ activePromptVersion;
53
75
  activeLimits;
54
76
  activeLimitOutputBuffer = false;
55
77
  activeDurable;
@@ -58,6 +80,8 @@ export class RuntimeAgentSession {
58
80
  activeGatedRound;
59
81
  activeLoopTurn = 1;
60
82
  loadedSkills = createLoadedSkillSet();
83
+ /** Tools activated via `search_tools` this session (plan 041); names-only in persistence. */
84
+ activatedTools = createActiveToolSet();
61
85
  /** Plan 018 Task 6 (closeout `checkpoint-bodies`): persisted exact instructions, registry-independent. */
62
86
  restoredSkillBodies = [];
63
87
  /** Skills of the current run (for the bodies snapshot); replaced at each run start. */
@@ -67,6 +91,15 @@ export class RuntimeAgentSession {
67
91
  for (const name of names)
68
92
  this.loadedSkills.add(name);
69
93
  }
94
+ /** Plan 041: re-add persisted activated-tool names (names only; inert for absent tools). */
95
+ restoreActivatedTools(names) {
96
+ for (const name of names)
97
+ this.activatedTools.add(name);
98
+ }
99
+ /** Plan 041: host reset of search-activated tools. */
100
+ clearActivatedTools() {
101
+ this.activatedTools.clear();
102
+ }
70
103
  /** Plan 018 Task 6: restore persisted loaded-skill bodies (already validated fail-closed at load). */
71
104
  restoreLoadedSkillBodies(bodies) {
72
105
  validateLoadedSkillBodies(bodies);
@@ -167,6 +200,7 @@ export class RuntimeAgentSession {
167
200
  if (legacyMaxToolRounds !== undefined) {
168
201
  throw new TypeError("RunOptions.maxToolRounds was removed in 0.1.5; use RunOptions.limits.maxToolRounds instead");
169
202
  }
203
+ const promptVersion = assertPromptVersionRef(options.promptVersion);
170
204
  if (this.agent.config.secure &&
171
205
  (options.redactor !== undefined ||
172
206
  options.ownership !== undefined ||
@@ -228,6 +262,7 @@ export class RuntimeAgentSession {
228
262
  ...(this.activeIdentity ? identityTelemetryAttributes(this.activeIdentity) : {}),
229
263
  };
230
264
  this.activeMetadata = metadata;
265
+ this.activePromptVersion = promptVersion;
231
266
  const limits = new RunLimitTracker(resolvedLimits, {
232
267
  onExceeded: (breach) => {
233
268
  this.emit({ type: "run_limit_exceeded", sessionId: this.id, runId, breach });
@@ -253,11 +288,27 @@ export class RuntimeAgentSession {
253
288
  idempotencyKey: this.activeIdempotencyKey,
254
289
  status: "running",
255
290
  startedAt,
291
+ ...(promptVersion ? { promptVersion } : {}),
256
292
  ...this.activeOwnership,
257
293
  };
258
294
  await this.activeLedger?.appendRun(redactRunLedgerRecord(startRecord, this.activeRedactor));
259
295
  await this.rebuildHistory();
260
- const { registry, tools } = activeTools(this.agent.config.tools);
296
+ const { registry: baseRegistry, tools: activeToolList } = activeTools(this.agent.config.tools);
297
+ const toolsDisclosure = resolveToolsDisclosure(options.toolsDisclosure, this.agent.config.toolsDisclosure);
298
+ // Search mode: run-local registry copy plus the generated `search_tools` tool; the host
299
+ // registry is never mutated. Activation names are intersected at disclosure only.
300
+ const toolSearch = toolsDisclosure === "search" && activeToolList.length > 0
301
+ ? {
302
+ state: createToolSearchState({
303
+ tools: activeToolList,
304
+ activated: this.activatedTools,
305
+ search: this.agent.config.toolsSearch,
306
+ }),
307
+ }
308
+ : undefined;
309
+ const searchTool = toolSearch ? createSearchToolsTool(toolSearch.state) : undefined;
310
+ const registry = searchTool ? createToolRegistry([...activeToolList, searchTool]) : baseRegistry;
311
+ const tools = searchTool ? [...activeToolList, searchTool] : activeToolList;
261
312
  const activeSkills = this.resolveRunSkills(options, tools);
262
313
  this.activeRunSkills = activeSkills; // for the durable bodies snapshot (plan 018 Task 6)
263
314
  if (options.model && JSON.stringify(options.model) !== JSON.stringify(this.agent.config.model)) {
@@ -471,6 +522,9 @@ export class RuntimeAgentSession {
471
522
  contextProviders,
472
523
  skills: this.restoredSkillBodies.length ? applyRestoredSkillBodies(activeSkills, this.restoredSkillBodies) : activeSkills,
473
524
  skillsDisclosure: resolveSkillsDisclosure(options.skillsDisclosure, this.agent.config.skillsDisclosure),
525
+ toolsDisclosure,
526
+ toolsSearch: this.agent.config.toolsSearch,
527
+ activatedTools: this.activatedTools,
474
528
  toolResultFold: resolveToolResultFold(options.toolResultFold, this.agent.config.toolResultFold),
475
529
  loadedSkills: this.loadedSkills,
476
530
  tools,
@@ -920,6 +974,7 @@ export class RuntimeAgentSession {
920
974
  finishedAt: new Date().toISOString(),
921
975
  abortReason: controller.signal.aborted ? String(controller.signal.reason) : undefined,
922
976
  error: runError,
977
+ ...(this.activePromptVersion ? { promptVersion: this.activePromptVersion } : {}),
923
978
  ...this.activeOwnership,
924
979
  };
925
980
  await this.activeLedger.appendRun(redactRunLedgerRecord(finishRecord, this.activeRedactor));
@@ -935,6 +990,7 @@ export class RuntimeAgentSession {
935
990
  this.activeIdempotencyKey = undefined;
936
991
  this.activeGuardrails = undefined;
937
992
  this.activeMetadata = undefined;
993
+ this.activePromptVersion = undefined;
938
994
  this.activeLimits?.dispose();
939
995
  this.activeLimits = undefined;
940
996
  this.activeLimitOutputBuffer = false;
@@ -1124,6 +1180,7 @@ export class RuntimeAgentSession {
1124
1180
  ...state,
1125
1181
  sessionState: {
1126
1182
  loadedSkillNames: this.loadedSkills.list(),
1183
+ ...(this.activatedTools.list().length ? { activatedToolNames: this.activatedTools.list() } : {}),
1127
1184
  ...(durable.options.includeSkillBodies
1128
1185
  ? {
1129
1186
  loadedSkillBodies: snapshotLoadedSkillBodies(this.activeRunSkills, this.loadedSkills, this.restoredSkillBodies.length ? new Map(this.restoredSkillBodies.map((e) => [e.name, e.instructions])) : undefined),
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Plan 040 Task 4 — `prism dev` delegation into `@arnilo/prism-dev`.
3
+ * The core deliberately holds no compile-time dependency on the dev package
4
+ * (dev-only surface, omitted from umbrellas): the subcommand resolves the
5
+ * package from the current project's own `node_modules` and hands the CLI
6
+ * over. Unresolvable → actionable install hint, exit 2.
7
+ */
8
+ import type { Writable } from "node:stream";
9
+ export interface DevCliModule {
10
+ runDevCli(argv: readonly string[], runtime: {
11
+ stdout: Writable;
12
+ stderr: Writable;
13
+ cwd?: string;
14
+ }): Promise<number>;
15
+ }
16
+ export type PrismDevLoader = () => Promise<DevCliModule | undefined>;
17
+ export interface PrismDevSubcommandRuntime {
18
+ readonly stdout: Writable;
19
+ readonly stderr: Writable;
20
+ /** Test injection: overrides project-level `@arnilo/prism-dev` resolution. */
21
+ readonly loadDevCli?: PrismDevLoader;
22
+ }
23
+ /**
24
+ * Default loader: resolve `@arnilo/prism-coding-tools/dev/cli` (or `@arnilo/prism-dev/cli`)
25
+ * from the project the user is standing in, falling back to this CLI's own installation.
26
+ */
27
+ export declare const defaultLoadDevCli: PrismDevLoader;
28
+ /** Runs the `prism dev` subcommand by delegating into the resolved package. */
29
+ export declare function runPrismDevSubcommand(argv: readonly string[], runtime: PrismDevSubcommandRuntime): Promise<number>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Plan 040 Task 4 — `prism dev` delegation into `@arnilo/prism-dev`.
3
+ * The core deliberately holds no compile-time dependency on the dev package
4
+ * (dev-only surface, omitted from umbrellas): the subcommand resolves the
5
+ * package from the current project's own `node_modules` and hands the CLI
6
+ * over. Unresolvable → actionable install hint, exit 2.
7
+ */
8
+ import { createRequire } from "node:module";
9
+ import { join } from "node:path";
10
+ import process from "node:process";
11
+ import { pathToFileURL } from "node:url";
12
+ const installHint = "prism dev requires the dev inspector package in this project.\n" +
13
+ " npm install --save-dev @arnilo/prism-coding-tools\n" +
14
+ "(Scaffolded projects from newer `prism init` templates already include it.)\n";
15
+ /**
16
+ * Default loader: resolve `@arnilo/prism-coding-tools/dev/cli` (or `@arnilo/prism-dev/cli`)
17
+ * from the project the user is standing in, falling back to this CLI's own installation.
18
+ */
19
+ export const defaultLoadDevCli = async () => {
20
+ const specifiers = ["@arnilo/prism-coding-tools/dev/cli", "@arnilo/prism-dev/cli"];
21
+ for (const specifier of specifiers) {
22
+ try {
23
+ const require = createRequire(join(process.cwd(), "package.json"));
24
+ const resolved = require.resolve(specifier);
25
+ const mod = (await import(pathToFileURL(resolved).href));
26
+ if (typeof mod.runDevCli === "function")
27
+ return mod;
28
+ }
29
+ catch {
30
+ try {
31
+ const mod = (await import(specifier));
32
+ if (typeof mod.runDevCli === "function")
33
+ return mod;
34
+ }
35
+ catch {
36
+ // try next specifier
37
+ }
38
+ }
39
+ }
40
+ return undefined;
41
+ };
42
+ /** Runs the `prism dev` subcommand by delegating into the resolved package. */
43
+ export async function runPrismDevSubcommand(argv, runtime) {
44
+ const load = runtime.loadDevCli ?? defaultLoadDevCli;
45
+ const mod = await load();
46
+ if (!mod || typeof mod.runDevCli !== "function") {
47
+ runtime.stderr.write(installHint);
48
+ return 2;
49
+ }
50
+ return mod.runDevCli(argv, { stdout: runtime.stdout, stderr: runtime.stderr });
51
+ }
52
+ //# sourceMappingURL=cli-dev.js.map
@@ -4,6 +4,8 @@ export declare class InitUsageError extends Error {
4
4
  export type InitProvider = string;
5
5
  export interface InitOptions {
6
6
  readonly directory: string;
7
+ readonly template?: string;
8
+ readonly listTemplates?: boolean;
7
9
  readonly provider: InitProvider;
8
10
  readonly withWorkflows: boolean;
9
11
  readonly withEvals: boolean;
@@ -15,6 +17,8 @@ export interface InitRuntime {
15
17
  readonly stderr: Writable;
16
18
  /** Override template root (tests). Defaults to package `templates/init`. */
17
19
  readonly templatesRoot?: string;
20
+ /** Override gallery root (tests). Defaults to package `templates`. */
21
+ readonly galleryRoot?: string;
18
22
  /** Override package version stamped into generated package.json. */
19
23
  readonly packageVersion?: string;
20
24
  /** Working directory used to resolve relative destinations. Defaults to process.cwd(). */
@@ -23,17 +27,28 @@ export interface InitRuntime {
23
27
  export interface InitResult {
24
28
  readonly targetDir: string;
25
29
  readonly writtenFiles: readonly string[];
30
+ readonly template?: string;
26
31
  readonly provider: InitProvider;
27
32
  readonly withWorkflows: boolean;
28
33
  readonly withEvals: boolean;
29
34
  readonly totalBytes: number;
30
35
  }
36
+ export interface TemplateInfo {
37
+ readonly name: string;
38
+ readonly description: string;
39
+ readonly version?: string;
40
+ readonly path: string;
41
+ }
31
42
  /** Provider ids supported by `prism init --provider`. Loaded from templates data. */
32
43
  export declare function listInitProviders(templatesRoot?: string): readonly string[];
33
- export declare function getInitUsage(templatesRoot?: string): string;
44
+ /** Template list discovered from the templates gallery. */
45
+ export declare function listInitTemplates(galleryRoot?: string): readonly TemplateInfo[];
46
+ export declare function isInitTemplate(value: string, galleryRoot?: string): boolean;
47
+ export declare function getInitUsage(templatesRoot?: string, galleryRoot?: string): string;
34
48
  export declare const initUsage: string;
35
- export declare function parseInitArgs(argv: readonly string[], templatesRoot?: string): InitOptions;
49
+ export declare function parseInitArgs(argv: readonly string[], templatesRoot?: string, galleryRoot?: string): InitOptions;
36
50
  export declare function runInitCommand(argv: readonly string[], runtime: InitRuntime): Promise<number>;
37
51
  export declare function createInitProject(options: InitOptions, runtime?: InitRuntime): Promise<InitResult>;
38
52
  export declare function defaultTemplatesRoot(): string;
53
+ export declare function defaultGalleryRoot(): string;
39
54
  export declare function isInitProvider(value: string, templatesRoot?: string): value is InitProvider;