@arnilo/prism 0.3.2 → 0.5.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 +50 -1
- package/README.md +42 -62
- package/dist/agent-run-lifecycle.js +4 -0
- package/dist/agent-run-state.d.ts +5 -2
- package/dist/agent-run-state.js +18 -8
- package/dist/agent-session/session/assemble.d.ts +6 -0
- package/dist/agent-session/session/assemble.js +391 -0
- package/dist/agent-session/session/persist.d.ts +28 -0
- package/dist/agent-session/session/persist.js +166 -0
- package/dist/agent-session/session/provider-round.d.ts +6 -0
- package/dist/agent-session/session/provider-round.js +231 -0
- package/dist/agent-session/session/tool-round.d.ts +31 -0
- package/dist/agent-session/session/tool-round.js +473 -0
- package/dist/agent-session/session/types.d.ts +115 -0
- package/dist/agent-session/session/types.js +5 -0
- package/dist/agent-session/session.d.ts +54 -41
- package/dist/agent-session/session.js +23 -1132
- package/dist/capture.d.ts +63 -0
- package/dist/capture.js +67 -0
- package/dist/cli-dev.d.ts +29 -0
- package/dist/cli-dev.js +52 -0
- package/dist/cli-init.d.ts +34 -3
- package/dist/cli-init.js +192 -24
- package/dist/cli-runner.d.ts +6 -2
- package/dist/cli-runner.js +57 -10
- package/dist/content.d.ts +3 -3
- package/dist/content.js +3 -1
- package/dist/contracts-core/agent.d.ts +8 -0
- package/dist/contracts-core/batch.d.ts +97 -0
- package/dist/contracts-core/batch.js +65 -0
- package/dist/contracts-core/content.d.ts +72 -1
- package/dist/contracts-core/embeddings.d.ts +30 -0
- package/dist/contracts-core/embeddings.js +17 -0
- package/dist/contracts-core/images.d.ts +60 -0
- package/dist/contracts-core/images.js +17 -0
- package/dist/contracts-core/moderation.d.ts +46 -0
- package/dist/contracts-core/moderation.js +34 -0
- package/dist/contracts-core/speech.d.ts +39 -0
- package/dist/contracts-core/speech.js +17 -0
- package/dist/contracts-core/transcription.d.ts +48 -0
- package/dist/contracts-core/transcription.js +17 -0
- package/dist/contracts-core/video.d.ts +61 -0
- package/dist/contracts-core/video.js +17 -0
- package/dist/contracts-core.d.ts +7 -0
- package/dist/contracts-core.js +7 -0
- package/dist/contracts-protocol.d.ts +18 -0
- package/dist/contracts-run-state.d.ts +1 -2
- package/dist/index.d.ts +7 -3
- package/dist/index.js +5 -3
- package/dist/input.d.ts +8 -0
- package/dist/input.js +4 -0
- package/dist/node/agent-definitions.d.ts +1 -8
- package/dist/node/agent-definitions.js +0 -34
- package/dist/node/settings.d.ts +0 -1
- package/dist/node/settings.js +0 -5
- package/dist/pinned-fetch.js +29 -3
- package/dist/provider-events.js +3 -4
- package/dist/providers/media.d.ts +1 -2
- package/dist/providers/media.js +1 -4
- package/dist/rpc.d.ts +1 -1
- package/dist/rpc.js +4 -4
- package/dist/testing/persistence-schema.d.ts +1 -1
- package/dist/testing/persistence-schema.js +32 -28
- package/dist/testing/provider-conformance.d.ts +114 -5
- package/dist/testing/provider-conformance.js +342 -0
- package/dist/testing/tool-conformance.d.ts +25 -0
- package/dist/testing/tool-conformance.js +128 -1
- package/dist/testing/tool-effect-store-conformance.d.ts +0 -1
- package/dist/testing/tool-effect-store-conformance.js +0 -3
- package/dist/thinking.d.ts +48 -9
- package/dist/thinking.js +134 -8
- package/dist/tool-search.d.ts +76 -0
- package/dist/tool-search.js +199 -0
- package/docs/0.1.0-readiness.md +3 -3
- package/docs/a2a.md +2 -2
- package/docs/acp-agent.md +1 -1
- package/docs/acp.md +3 -3
- package/docs/ag-ui-adoption.md +1 -1
- package/docs/ag-ui.md +1 -2
- package/docs/agent-definitions.md +1 -1
- package/docs/agent-events.md +5 -5
- package/docs/agent-identity.md +13 -2
- package/docs/audit-export.md +3 -3
- package/docs/batch-jobs.md +120 -0
- package/docs/browser-automation.md +5 -5
- package/docs/caveman.md +2 -2
- package/docs/cli-rpc.md +43 -9
- package/docs/coding-agent-tools.md +19 -19
- package/docs/coding-review-and-diagnostics.md +2 -2
- package/docs/coding-security.md +5 -5
- package/docs/coding-tools.md +82 -0
- package/docs/coding-workspaces.md +2 -2
- package/docs/compaction-and-retry.md +2 -2
- package/docs/compaction-llm.md +4 -4
- package/docs/compaction-observational-memory.md +3 -3
- package/docs/computer-use-linux.md +13 -2
- package/docs/context-and-skills.md +3 -1
- package/docs/conversations.md +4 -4
- package/docs/core.md +85 -0
- package/docs/credential-storage.md +12 -8
- package/docs/credentials-and-redaction.md +1 -1
- package/docs/data-classification.md +1 -1
- package/docs/database-persistence.md +7 -3
- package/docs/dev-inspector.md +103 -0
- package/docs/device-adapters.md +2 -2
- package/docs/diagrams.md +247 -0
- package/docs/document-reader.md +6 -6
- package/docs/documents.md +214 -0
- package/docs/embeddings.md +112 -0
- package/docs/enterprise-postgres-state.md +7 -7
- package/docs/evaluations.md +41 -7
- package/docs/extensions.md +3 -3
- package/docs/forge-integration.md +3 -3
- package/docs/graft.md +5 -5
- package/docs/guardrails.md +2 -2
- package/docs/host-security.md +16 -15
- package/docs/image-generation.md +129 -0
- package/docs/impeccable.md +7 -5
- package/docs/index.md +84 -46
- package/docs/indexed-code-search.md +2 -2
- package/docs/language-intelligence.md +4 -4
- package/docs/live-testing.md +126 -0
- package/docs/mcp-tools.md +44 -13
- package/docs/middleware-hooks.md +1 -1
- package/docs/migrate-to-0.4.md +312 -0
- package/docs/migrate-to-0.5.md +122 -0
- package/docs/migration.md +51 -1
- package/docs/model-registry.md +38 -0
- package/docs/model-routing.md +6 -6
- package/docs/moderation.md +117 -0
- package/docs/multi-agent-patterns.md +177 -0
- package/docs/multimodal-content.md +27 -3
- package/docs/obscura.md +12 -12
- package/docs/observability.md +32 -7
- package/docs/openapi-tools.md +14 -4
- package/docs/operations.md +11 -0
- package/docs/performance.md +30 -10
- package/docs/persistence-credentials-multimodality-primitives.md +7 -7
- package/docs/policy-and-audit.md +18 -8
- package/docs/ponytail.md +3 -3
- package/docs/postgres-persistence.md +5 -5
- package/docs/process-sessions.md +2 -2
- package/docs/prompt-registry.md +106 -0
- package/docs/provider-caching.md +36 -32
- package/docs/provider-conformance.md +24 -2
- package/docs/provider-packages.md +58 -22
- package/docs/provider-primitives.md +5 -5
- package/docs/provider-request-policies.md +1 -1
- package/docs/providers/ai-sdk.md +18 -6
- package/docs/providers/alibaba.md +10 -6
- package/docs/providers/anthropic.md +10 -6
- package/docs/providers/azure.md +20 -4
- package/docs/providers/bedrock.md +18 -3
- package/docs/providers/clinepass.md +7 -3
- package/docs/providers/commandcode.md +253 -0
- package/docs/providers/deepseek.md +7 -3
- package/docs/providers/google.md +8 -4
- package/docs/providers/hyper.md +284 -0
- package/docs/providers/kimi.md +7 -3
- package/docs/providers/neuralwatt.md +12 -8
- package/docs/providers/ollama.md +18 -3
- package/docs/providers/openai-compatible.md +5 -1
- package/docs/providers/openai.md +9 -5
- package/docs/providers/opencode-go.md +8 -4
- package/docs/providers/openrouter.md +8 -4
- package/docs/providers/vertex.md +21 -5
- package/docs/providers/xai.md +7 -3
- package/docs/providers/zai.md +7 -3
- package/docs/rag.md +31 -9
- package/docs/release-and-install.md +181 -76
- package/docs/resource-loading.md +1 -1
- package/docs/runs-and-usage.md +28 -3
- package/docs/server.md +94 -5
- package/docs/settings-auth-trust-security.md +7 -5
- package/docs/sheets.md +229 -0
- package/docs/speech.md +126 -0
- package/docs/sqlite-persistence.md +4 -4
- package/docs/supervisors.md +4 -3
- package/docs/thinking-and-reasoning.md +93 -60
- package/docs/tool-conformance.md +28 -3
- package/docs/tool-execution-primitives.md +8 -8
- package/docs/tools.md +32 -5
- package/docs/web-tools.md +3 -3
- package/docs/wiki.md +7 -7
- package/docs/work-artifacts-and-review.md +17 -6
- package/docs/work-connectors.md +4 -4
- package/docs/work-tools.md +5 -5
- package/docs/workflow-orchestration-primitives.md +35 -11
- package/docs/workflows.md +74 -13
- package/docs/working-and-semantic-memory.md +53 -5
- package/package.json +14 -31
- package/templates/README.md +23 -0
- package/templates/deep-research/README.md.tmpl +47 -0
- package/templates/deep-research/env.example.tmpl +12 -0
- package/templates/deep-research/gitignore.tmpl +7 -0
- package/templates/deep-research/manifest.json +12 -0
- package/templates/deep-research/package.json.tmpl +23 -0
- package/templates/deep-research/src/agent.ts.tmpl +81 -0
- package/templates/deep-research/src/index.ts.tmpl +53 -0
- package/templates/deep-research/src/tests/research.test.ts.tmpl +114 -0
- package/templates/deep-research/src/tools.ts.tmpl +86 -0
- package/templates/deep-research/src/types.ts.tmpl +45 -0
- package/templates/deep-research/src/workflow.ts.tmpl +156 -0
- package/templates/deep-research/tsconfig.json.tmpl +15 -0
- package/templates/init/manifest.json +5 -0
- package/templates/init/package.json.tmpl +2 -1
- package/templates/init/providers.json +40 -24
- package/docs/antigravity-agent.md +0 -207
package/docs/cli-rpc.md
CHANGED
|
@@ -4,13 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
The `prism` bin is a thin adapter over `AgentSession` plus a tiny project scaffold:
|
|
6
6
|
|
|
7
|
-
- `prism -p "prompt"`: print assistant text deltas.
|
|
8
|
-
- `prism --mode json -p "prompt"`: write one normalized event envelope per line.
|
|
9
|
-
- `prism --mode rpc
|
|
7
|
+
- `prism --provider <id> -p "prompt"`: print assistant text deltas. Provider ids come from the init provider catalog (`templates/init/providers.json`); `mock` is built in, real providers are dynamically imported from their `@arnilo/prism-providers/*` package (must be installed) and read their credential from the catalog's env var. Without `--provider` the CLI fails with a usage error.
|
|
8
|
+
- `prism --mode json --provider <id> -p "prompt"`: write one normalized event envelope per line.
|
|
9
|
+
- `prism --mode rpc --provider <id>`: read LF-delimited JSON requests from stdin and write correlated JSON responses/events to stdout.
|
|
10
10
|
- `prism init <dir>`: create a minimal TypeScript project with one selected provider, `.env.example`, and one offline mock test.
|
|
11
|
+
- `prism dev`: boot the loopback dev inspector over the scaffolded agent (delegates into `@arnilo/prism-coding-tools/dev` when resolvable; plan 040 Task 4).
|
|
11
12
|
|
|
12
13
|
It does not add a TUI, app tools, provider globals, extension discovery, resource discovery, or credential storage. `init` uses Node standard-library filesystem APIs and checked-in templates only — no interactive prompts or template-engine dependency.
|
|
13
14
|
|
|
15
|
+
## Live CLI journey (plans/064 Task 5)
|
|
16
|
+
|
|
17
|
+
An env-gated e2e journey drives the packed `prism` bin end to end — `init` scaffold (generated offline test passes), `providers add` scaffold, and print/json/rpc modes over a real provider wire with a full-transcript secret scan:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
PRISM_LIVE_PROVIDER_TESTS=1 OPENAI_API_KEY=sk-... \
|
|
21
|
+
node --test scripts/e2e-cli-live.test.mjs
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The provider is the first init-catalog entry whose credential env var is present; override with `PRISM_LIVE_CLI_PROVIDER=<id>`. Wire legs skip (never fail) when the provider rejects the credential (401/403) — refresh the key and rerun. Registered in `scripts/live-matrix.json` as `cli/journey`.
|
|
25
|
+
|
|
14
26
|
## When to use it
|
|
15
27
|
|
|
16
28
|
Use the CLI for terminal smoke tests, scriptable JSON event streams, simple non-Node clients that can speak newline-delimited JSON, and bootstrapping a tiny host project with `prism init`.
|
|
@@ -22,19 +34,22 @@ Use the SDK directly when an app needs custom providers, tools, resources, crede
|
|
|
22
34
|
### `prism init`
|
|
23
35
|
|
|
24
36
|
```bash
|
|
25
|
-
prism init <dir> [--provider <name>] [--with-workflows] [--with-evals] [--force]
|
|
37
|
+
prism init <dir> [--template <name>] [--list-templates] [--provider <name>] [--with-workflows] [--with-evals] [--force]
|
|
26
38
|
```
|
|
27
39
|
|
|
28
40
|
| Flag / arg | Purpose |
|
|
29
41
|
| --- | --- |
|
|
30
|
-
| `<dir>` | Destination directory (created if missing). |
|
|
42
|
+
| `<dir>` | Destination directory (created if missing). Required unless `--list-templates` is specified. |
|
|
43
|
+
| `--template <name>` | Template starter name (`init` [default], `deep-research`). |
|
|
44
|
+
| `--list-templates` | List available starter templates from the templates gallery. |
|
|
31
45
|
| `--provider <name>` | `mock` (default), `openai`, `openrouter`, `kimi`, `zai`, `opencode-go`, or `neuralwatt`. |
|
|
32
|
-
| `--with-workflows` | Add `@arnilo/prism-workflows` and `src/workflows-example.ts`. |
|
|
33
|
-
| `--with-evals` | Add `@arnilo/prism-evals` and `src/evals-example.ts`. |
|
|
46
|
+
| `--with-workflows` | Add `@arnilo/prism-core/runtime/workflows` and `src/workflows-example.ts`. |
|
|
47
|
+
| `--with-evals` | Add `@arnilo/prism-core/governance/evals` and `src/evals-example.ts`. |
|
|
34
48
|
| `--force` | Overwrite generated files when the destination already exists. |
|
|
35
49
|
| `-h`, `--help` | Print init usage. |
|
|
36
50
|
|
|
37
|
-
Default generation installs only `@arnilo/prism` (mock provider). Selecting a real provider adds exactly one `@arnilo/prism-
|
|
51
|
+
Default generation (`init` template) installs only `@arnilo/prism` (mock provider). Selecting a real provider adds exactly one dependency: the `@arnilo/prism-providers` family package (the selected adapter imports from `@arnilo/prism-providers/<id>`). Specifying `--template deep-research` scaffolds a flagship deep research agent pipeline (`@arnilo/prism`, `@arnilo/prism-web-tools`, `@arnilo/prism-memory/rag`, `@arnilo/prism-core/runtime/workflows`) with planning, attributable citations, bounded refine loops, and HITL decision clarification. Rerunning without `--force` refuses non-empty destinations and existing generated files. `.env.example` contains placeholders only; `.gitignore` excludes `.env` and local stores.
|
|
52
|
+
|
|
38
53
|
|
|
39
54
|
### `prism providers add` (0.1.7)
|
|
40
55
|
|
|
@@ -68,6 +83,22 @@ header ownership, secret-leak redaction, and serialized-content coverage
|
|
|
68
83
|
against the base provider. Replace the starter model metadata and the docs
|
|
69
84
|
stub with docs-verified values before publishing.
|
|
70
85
|
|
|
86
|
+
### `prism dev` (0.3.2)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
prism dev [--port <n>] [--host <addr>]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Runs the local dev inspector over the current `prism init` scaffold's agent. Delegation, not duplication: the subcommand resolves `@arnilo/prism-coding-tools/dev` from the project's own `node_modules` (falling back to the CLI's own installation) and hands over to its `runDevCli` entry; unresolvable → install hint, exit `2`.
|
|
93
|
+
|
|
94
|
+
| Flag / arg | Purpose |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `--port <n>` | Bind port. Default `4311`. |
|
|
97
|
+
| `--host <addr>` | Bind host. Default `127.0.0.1`; any non-loopback value is refused before binding (`ERR_PRISM_DEV_REMOTE_BIND`) unless remote authorization is wired programmatically. |
|
|
98
|
+
| `-h`, `--help` | Print dev usage. |
|
|
99
|
+
|
|
100
|
+
Manifests of the negotiation are simple: the agent is loaded from the scaffold contract `dist/agent.js` exporting `createAppAgent()` (missing → "build the project first", exit `2`); the inspector binds loopback, prints `prism dev → http://127.0.0.1:<port>/…`, and `SIGINT` drains and closes (exit `0`). Credentials stay in the scaffold's agent config — the CLI never reads environment secrets itself. Scaffolded projects ship a matching `"dev": "prism dev"` npm script.
|
|
101
|
+
|
|
71
102
|
### Run/RPC CLI flags
|
|
72
103
|
|
|
73
104
|
| Flag | Purpose |
|
|
@@ -178,7 +209,10 @@ printf '{"id":"1","command":"prompt","params":{"input":"Hi"}}\n' | prism --provi
|
|
|
178
209
|
prism init my-agent
|
|
179
210
|
prism init my-agent --provider openai
|
|
180
211
|
prism init my-agent --provider openrouter --with-workflows --with-evals
|
|
212
|
+
prism init my-research --template deep-research
|
|
213
|
+
prism init --list-templates
|
|
181
214
|
cd my-agent && npm install && npm test
|
|
215
|
+
|
|
182
216
|
```
|
|
183
217
|
|
|
184
218
|
Programmatic hosts should use the public runtime directly:
|
|
@@ -199,7 +233,7 @@ CLI/RPC are adapters over `AgentSession`. They do not scan packages, import exte
|
|
|
199
233
|
|
|
200
234
|
RPC `command` executes only explicitly registered `CommandDefinition` values. `setModel` stores a model override for later prompt/follow-up calls. `compact`, `switchSession`, `forkSession`, `cloneSession`, and `checkout` call the existing session APIs.
|
|
201
235
|
|
|
202
|
-
Optional workflow control (from `@arnilo/prism-workflows`) registers `workflow.start`, `workflow.enqueue`, `workflow.replay`, `workflow.status`, `workflow.list`, `workflow.cancel`, and `workflow.resume` via `createWorkflowCommands({ workflows, checkpoints, runOptions? })`. Supplying an ownership-scoped `schedules` service additionally registers `schedule.create`, `schedule.list`, `schedule.pause`, `schedule.resume`, `schedule.trigger`, and `schedule.delete`. Pass the returned `CommandDefinition[]` into `runRpcServer({ commands })` the same way as observational-memory commands. Cancel aborts in-process runs through the package active-run registry; orphaned durable checkpoints still marked `running` are fail-closed to `aborted`.
|
|
236
|
+
Optional workflow control (from `@arnilo/prism-core/runtime/workflows`) registers `workflow.start`, `workflow.enqueue`, `workflow.replay`, `workflow.status`, `workflow.list`, `workflow.cancel`, and `workflow.resume` via `createWorkflowCommands({ workflows, checkpoints, runOptions? })`. Supplying an ownership-scoped `schedules` service additionally registers `schedule.create`, `schedule.list`, `schedule.pause`, `schedule.resume`, `schedule.trigger`, and `schedule.delete`. Pass the returned `CommandDefinition[]` into `runRpcServer({ commands })` the same way as observational-memory commands. Cancel aborts in-process runs through the package active-run registry; orphaned durable checkpoints still marked `running` are fail-closed to `aborted`.
|
|
203
237
|
|
|
204
238
|
Suspended workflow resume parameters are `{ workflowId, runId, decision: "approve" | "deny", input?, expectedVersion, ownership? }`. Read `expectedVersion` from `workflow.status`/`workflow.list`; stale or duplicate decisions fail checkpoint CAS before node execution. Ordinary recovery resume for failed/aborted runs remains backward-compatible without decision fields.
|
|
205
239
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
`@arnilo/prism-coding-agent` is an optional first-party package that provides host shell/filesystem/repository tools as Prism `ToolDefinition` objects. It ships nine default coding tools — `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`, `glob`, `delete`, `move` — plus opt-in structured Git/check set (`createGitTools`), opt-in `createAskUserDecisionTool({ ask })`, and bounded coding-plan/checkpoint helpers. The tools are **inert** until a host imports them and registers them into a `ToolRegistry`. Hosts may register any subset, omit aggregators entirely, or mix first-party tools with host-owned `ToolDefinition`s. Behavior for shell/read/write/edit is a behavioral port of the pi coding agent's tools, adapted to Prism's `ToolDefinition` / `ToolResult` contracts (no `@earendil-works/*` or `typebox` dependencies; only `diff` plus the Node standard library). List/search/glob/Git are native Prism tools with no picomatch/ripgrep/Git-library dependency (hand-rolled `*`/`?`/`**` glob matcher).
|
|
5
|
+
`@arnilo/prism-coding-tools/agent` is an optional first-party package that provides host shell/filesystem/repository tools as Prism `ToolDefinition` objects. It ships nine default coding tools — `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`, `glob`, `delete`, `move` — plus opt-in structured Git/check set (`createGitTools`), opt-in `createAskUserDecisionTool({ ask })`, and bounded coding-plan/checkpoint helpers. The tools are **inert** until a host imports them and registers them into a `ToolRegistry`. Hosts may register any subset, omit aggregators entirely, or mix first-party tools with host-owned `ToolDefinition`s. Behavior for shell/read/write/edit is a behavioral port of the pi coding agent's tools, adapted to Prism's `ToolDefinition` / `ToolResult` contracts (no `@earendil-works/*` or `typebox` dependencies; only `diff` plus the Node standard library). List/search/glob/Git are native Prism tools with no picomatch/ripgrep/Git-library dependency (hand-rolled `*`/`?`/`**` glob matcher).
|
|
6
6
|
|
|
7
7
|
| Export | Purpose |
|
|
8
8
|
| --- | --- |
|
|
@@ -44,7 +44,7 @@ Each factory returns a plain `ToolDefinition` (no auto-registration). Register w
|
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
46
|
import { createToolRegistry } from "@arnilo/prism";
|
|
47
|
-
import { createCodingTools } from "@arnilo/prism-coding-agent";
|
|
47
|
+
import { createCodingTools } from "@arnilo/prism-coding-tools/agent";
|
|
48
48
|
|
|
49
49
|
const tools = createToolRegistry(createCodingTools(process.cwd()));
|
|
50
50
|
```
|
|
@@ -56,7 +56,7 @@ Every tool carries an explicit `kind` (`shell`→`execute`, `read`/`repo_list`
|
|
|
56
56
|
`createAcpFilesystemOperations` adapts any client with `readTextFile({ path, line?, limit? })` and `writeTextFile({ path, content })` methods to the `ReadOperations`, `WriteOperations`, and `EditOperations` seams. All reads and writes stay client-backed; `mkdir` is a no-op, `statFile` measures a bounded UTF-8 text read, and image MIME detection is always `null`.
|
|
57
57
|
|
|
58
58
|
```ts
|
|
59
|
-
import { createAcpFilesystemOperations, createCodingTools } from "@arnilo/prism-coding-agent";
|
|
59
|
+
import { createAcpFilesystemOperations, createCodingTools } from "@arnilo/prism-coding-tools/agent";
|
|
60
60
|
|
|
61
61
|
const operations = createAcpFilesystemOperations(clientFilesystem);
|
|
62
62
|
const tools = createCodingTools(cwd, {
|
|
@@ -72,11 +72,11 @@ This is an editor-buffer adapter, not a repository backend: `repo_list`, `repo_s
|
|
|
72
72
|
|
|
73
73
|
Use this package when a host wants ready-made coding tools for an agent, session, or run, registered explicitly into a `ToolRegistry` and dispatched through the normal Prism tool harness. The tools perform **real** shell and filesystem operations on the host — they are not mocked or sandboxed. Use the individual factories when you need per-tool options or custom operation backends; use the aggregators when you want the default set.
|
|
74
74
|
|
|
75
|
-
Do not use this package as a sandbox, permission policy, secret store, or provider loop. Prism gates tool dispatch with `PermissionPolicy` / `ToolValidator` / trust policies; pass an optional `ExecutionPolicy` (for example from `@arnilo/prism-coding-security`) for path/command approval before side effects. Do not register these tools for an untrusted provider.
|
|
75
|
+
Do not use this package as a sandbox, permission policy, secret store, or provider loop. Prism gates tool dispatch with `PermissionPolicy` / `ToolValidator` / trust policies; pass an optional `ExecutionPolicy` (for example from `@arnilo/prism-coding-tools/security`) for path/command approval before side effects. Do not register these tools for an untrusted provider.
|
|
76
76
|
|
|
77
77
|
```ts
|
|
78
|
-
import { createCodingTools } from "@arnilo/prism-coding-agent";
|
|
79
|
-
import { createCodingApprovalPolicy } from "@arnilo/prism-coding-security";
|
|
78
|
+
import { createCodingTools } from "@arnilo/prism-coding-tools/agent";
|
|
79
|
+
import { createCodingApprovalPolicy } from "@arnilo/prism-coding-tools/security";
|
|
80
80
|
|
|
81
81
|
const tools = createCodingTools(workspaceRoot, {
|
|
82
82
|
executionPolicy: createCodingApprovalPolicy({
|
|
@@ -88,7 +88,7 @@ const tools = createCodingTools(workspaceRoot, {
|
|
|
88
88
|
|
|
89
89
|
### pi name mapping
|
|
90
90
|
|
|
91
|
-
| Prism (`@arnilo/prism-coding-agent`) | pi coding agent |
|
|
91
|
+
| Prism (`@arnilo/prism-coding-tools/agent`) | pi coding agent |
|
|
92
92
|
| --- | --- |
|
|
93
93
|
| `shell` | `bash` |
|
|
94
94
|
| `read` | `read` |
|
|
@@ -180,7 +180,7 @@ Read a text or image file.
|
|
|
180
180
|
| `executionPolicy` | — | Structured pre-execution policy (see [Coding security](coding-security.md)). |
|
|
181
181
|
|
|
182
182
|
```ts
|
|
183
|
-
import { createReadTool, DEFAULT_MAX_IMAGE_BYTES } from "@arnilo/prism-coding-agent";
|
|
183
|
+
import { createReadTool, DEFAULT_MAX_IMAGE_BYTES } from "@arnilo/prism-coding-tools/agent";
|
|
184
184
|
|
|
185
185
|
const read = createReadTool(cwd, {
|
|
186
186
|
maxImageBytes: DEFAULT_MAX_IMAGE_BYTES,
|
|
@@ -229,7 +229,7 @@ Default local `writeFile` uses same-directory temp + `rename` so a crash mid-wri
|
|
|
229
229
|
Hosts may opt in to a session-scoped soft guard: share one `createReadPathSet()` across `read` / `write` / `edit` and set `requireReadBeforeWrite: true` on write/edit options. Successful `read` marks the path; unread existing-file writes/edits fail with a clear error unless `force: true`. Default is **off** (no behavior change for hosts that ignore it).
|
|
230
230
|
|
|
231
231
|
```ts
|
|
232
|
-
import { createReadPathSet, createReadTool, createWriteTool, createEditTool } from "@arnilo/prism-coding-agent";
|
|
232
|
+
import { createReadPathSet, createReadTool, createWriteTool, createEditTool } from "@arnilo/prism-coding-tools/agent";
|
|
233
233
|
|
|
234
234
|
const readPaths = createReadPathSet();
|
|
235
235
|
const read = createReadTool(cwd, { readPathSet: readPaths });
|
|
@@ -240,7 +240,7 @@ const edit = createEditTool(cwd, { requireReadBeforeWrite: true, readPathSet: re
|
|
|
240
240
|
Since 0.1.3 (plan 015 Task 4) hosts may opt in to persisting the set across restarts via the host-owned `CheckpointStore`:
|
|
241
241
|
|
|
242
242
|
```ts
|
|
243
|
-
import { createReadPathSet, createReadPathSetPersistence } from "@arnilo/prism-coding-agent";
|
|
243
|
+
import { createReadPathSet, createReadPathSetPersistence } from "@arnilo/prism-coding-tools/agent";
|
|
244
244
|
|
|
245
245
|
const readPaths = createReadPathSet();
|
|
246
246
|
const persistence = createReadPathSetPersistence({ checkpoints, key: sessionId, ownership });
|
|
@@ -287,7 +287,7 @@ List repository entries with deterministic relative paths. Uses Node `opendir`/`
|
|
|
287
287
|
- **Security:** `.git` internals never listed; paths re-checked against the workspace root; symlink escapes match native fail-closed behavior.
|
|
288
288
|
|
|
289
289
|
```ts
|
|
290
|
-
import { createCodingTools, createGitAwareRepositoryOperations } from "@arnilo/prism-coding-agent";
|
|
290
|
+
import { createCodingTools, createGitAwareRepositoryOperations } from "@arnilo/prism-coding-tools/agent";
|
|
291
291
|
|
|
292
292
|
const operations = createGitAwareRepositoryOperations(cwd); // native fallback outside Git
|
|
293
293
|
const tools = createCodingTools(cwd, { repository: { operations } });
|
|
@@ -392,7 +392,7 @@ Opt-in tools over a host-pinned Git executable (`gitPath`, default `/usr/bin/git
|
|
|
392
392
|
| `coding_check` | Included when `checks` are declared: model selects only a name; executable/args/env are host-fixed. |
|
|
393
393
|
|
|
394
394
|
```ts
|
|
395
|
-
import { createGitTools } from "@arnilo/prism-coding-agent";
|
|
395
|
+
import { createGitTools } from "@arnilo/prism-coding-tools/agent";
|
|
396
396
|
|
|
397
397
|
const gitTools = createGitTools(workspaceRoot, {
|
|
398
398
|
gitPath: "/usr/bin/git",
|
|
@@ -431,7 +431,7 @@ import {
|
|
|
431
431
|
createCodingTools,
|
|
432
432
|
suspendAskUserDecision,
|
|
433
433
|
createAskUserDecisionResumeValidator,
|
|
434
|
-
} from "@arnilo/prism-coding-agent";
|
|
434
|
+
} from "@arnilo/prism-coding-tools/agent";
|
|
435
435
|
|
|
436
436
|
const tools = createToolRegistry([
|
|
437
437
|
...createCodingTools(workspaceRoot),
|
|
@@ -453,10 +453,10 @@ return suspendAskUserDecision({
|
|
|
453
453
|
|
|
454
454
|
### Goal → verify helper (`runCodingGoalVerify`)
|
|
455
455
|
|
|
456
|
-
Thin composition over existing plan Markdown, named checks, workflow `suspend`/`resumeWorkflow`, and bounded PR handoff. **No Goal table / second runtime.** Peer `@arnilo/prism-workflows`. Example: `examples/coding-goal-verify.ts`.
|
|
456
|
+
Thin composition over existing plan Markdown, named checks, workflow `suspend`/`resumeWorkflow`, and bounded PR handoff. **No Goal table / second runtime.** Peer `@arnilo/prism-core/runtime/workflows`. Example: `examples/coding-goal-verify.ts`.
|
|
457
457
|
|
|
458
458
|
```ts
|
|
459
|
-
import { runCodingGoalVerify } from "@arnilo/prism-coding-agent";
|
|
459
|
+
import { runCodingGoalVerify } from "@arnilo/prism-coding-tools/agent";
|
|
460
460
|
|
|
461
461
|
const result = await runCodingGoalVerify({
|
|
462
462
|
goal: "Fix the flake",
|
|
@@ -524,7 +524,7 @@ Minimal drop-in for any Prism app:
|
|
|
524
524
|
|
|
525
525
|
```ts
|
|
526
526
|
import { createToolRegistry } from "@arnilo/prism";
|
|
527
|
-
import { createCodingTools, createReadOnlyTools } from "@arnilo/prism-coding-agent";
|
|
527
|
+
import { createCodingTools, createReadOnlyTools } from "@arnilo/prism-coding-tools/agent";
|
|
528
528
|
|
|
529
529
|
// Full coding set (shell + read + write + edit + repo_list + repo_search + glob + delete + move):
|
|
530
530
|
const tools = createToolRegistry(createCodingTools(process.cwd()));
|
|
@@ -536,7 +536,7 @@ const ro = createToolRegistry(createReadOnlyTools(process.cwd()));
|
|
|
536
536
|
Customizing a single tool (force bash, cap output, delegate writes to a remote backend):
|
|
537
537
|
|
|
538
538
|
```ts
|
|
539
|
-
import { createShellTool, createWriteTool } from "@arnilo/prism-coding-agent";
|
|
539
|
+
import { createShellTool, createWriteTool } from "@arnilo/prism-coding-tools/agent";
|
|
540
540
|
|
|
541
541
|
const shell = createShellTool("/repo", {
|
|
542
542
|
shellPath: "/bin/bash",
|
|
@@ -560,11 +560,11 @@ Packed capability demo: `examples/coding-tools-capability-gaps.ts` (search modes
|
|
|
560
560
|
|
|
561
561
|
## Extension and configuration notes
|
|
562
562
|
|
|
563
|
-
- **Long coding sessions.** Use `createCodingCompactionStrategy()` from optional `@arnilo/prism-compaction
|
|
563
|
+
- **Long coding sessions.** Use `createCodingCompactionStrategy()` from optional `@arnilo/prism-memory/compaction/llm` when history needs a bounded coding handoff. It is selected explicitly through normal `session.compact()` / agent compaction configuration, preserves raw session entries, and prioritizes file paths, patch intent, checks, plan/todo state, blockers, and verification steps. It does not read files, retain full diffs, or create a second coding runtime.
|
|
564
564
|
- **Pluggable operation backends.** Every tool accepts an `operations` seam. Custom `ReadOperations` must implement bounded `readText` plus `statFile`; custom `EditOperations` must implement `statFile`; read/write methods receive caps/signals. `BashOperations` must stream through `onData` and honor `signal`/`timeout`. Custom `RepositoryOperations` must honor depth/entry/file/match/scan/time caps and abort (including `glob`). Custom `DeleteOperations` / `MoveOperations` must honor containment and abort. A hostile custom backend can still violate its host-owned contract, so isolate it separately.
|
|
565
565
|
- **Per-tool options.** `ShellToolOptions` adds `timeout` and `maxTotalOutputBytes`; `ReadToolOptions` adds `maxScanBytes` and optional `readPathSet`; `WriteToolOptions` / `EditToolOptions` add input caps plus optional `requireReadBeforeWrite` / `readPathSet` / `force`; list/search/glob accept `repository` limits and shared aggregator `ToolsOptions.repository`.
|
|
566
566
|
- **Aggregator options.** `ToolsOptions` (`{ executionPolicy?, shell?, read?, write?, edit?, delete?, move?, list?, search?, glob?, repository? }`) threads each sub-object to the matching tool. `createCodingTools()`, `createAllTools()`, and `createReadOnlyTools()` apply the shared policy unless that tool has an explicit per-tool override. Full membership is nine tools; read-only is `read` + `repo_list` + `repo_search` + `glob`.
|
|
567
|
-
- **Sandbox composition.** Prefer `@arnilo/prism-coding-security` `createSandboxCodingComposition(cwd, { workspaceMode, sandbox, ... })` (or tools-only wrappers). `workspaceMode` is required: `"sandbox"` keeps shell/read/write/edit/list/search/glob/delete/move on one disposable tree; `"host"` runs against host cwd and never claims containment. Mixed sandbox-shell + host-FS wiring throws unless `allowMixedWorkspaceWiring: true`. Same-tree Git: `createGitTools(composition.workspaceRoot, { execFile: sandbox.execFile, commitIdentity })`.
|
|
567
|
+
- **Sandbox composition.** Prefer `@arnilo/prism-coding-tools/security` `createSandboxCodingComposition(cwd, { workspaceMode, sandbox, ... })` (or tools-only wrappers). `workspaceMode` is required: `"sandbox"` keeps shell/read/write/edit/list/search/glob/delete/move on one disposable tree; `"host"` runs against host cwd and never claims containment. Mixed sandbox-shell + host-FS wiring throws unless `allowMixedWorkspaceWiring: true`. Same-tree Git: `createGitTools(composition.workspaceRoot, { execFile: sandbox.execFile, commitIdentity })`.
|
|
568
568
|
- **`ToolsOptions`** and the per-tool option types are exported from the package barrel for host configuration.
|
|
569
569
|
- No auto-discovery or manifest registration: import and register explicitly. This package registers no extensions and owns no globals (the mutation queue is a process-wide per-path map — see `ponytail:` note in the source).
|
|
570
570
|
|
|
@@ -19,8 +19,8 @@ Bounded patch-review manifests plus normalized LSP/check diagnostics for the cod
|
|
|
19
19
|
A review is created per patch handoff. The manifest binds: repository identity (credential-free remote fingerprint + default branch + optional worktree path), `base`/`head`, the patch artifact reference (`kind`, `uri`, `sha256`, `bytes`), changed paths, diffstat, named-check summaries, and diagnostic summaries. The `digest` is SHA-256 over the canonical manifest JSON; the structural artifact input carries the manifest in `preview.review` and the patch SHA-256 as the artifact hash.
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
import { createCodingPatchReviewManifest, assertCodingPatchAccepted } from "@arnilo/prism-coding-agent";
|
|
23
|
-
import { createArtifactService } from "@arnilo/prism-server";
|
|
22
|
+
import { createCodingPatchReviewManifest, assertCodingPatchAccepted } from "@arnilo/prism-coding-tools/agent";
|
|
23
|
+
import { createArtifactService } from "@arnilo/prism-core/runtime/server";
|
|
24
24
|
|
|
25
25
|
const { review, artifactInput } = createCodingPatchReviewManifest({
|
|
26
26
|
threadId: "thread-1",
|
package/docs/coding-security.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
`@arnilo/prism-coding-security` is an optional package that supplies structured execution policy for `@arnilo/prism-coding-agent` tools and one disposable Docker/OCI sandbox reference. It complements name-based `PermissionPolicy` at dispatch time with path/command context checked **inside** each tool before side effects, and optionally contains untrusted coding work in a host-invoked container.
|
|
5
|
+
`@arnilo/prism-coding-tools/security` is an optional package that supplies structured execution policy for `@arnilo/prism-coding-tools/agent` tools and one disposable Docker/OCI sandbox reference. It complements name-based `PermissionPolicy` at dispatch time with path/command context checked **inside** each tool before side effects, and optionally contains untrusted coding work in a host-invoked container.
|
|
6
6
|
|
|
7
7
|
| Export | Purpose |
|
|
8
8
|
| --- | --- |
|
|
@@ -43,7 +43,7 @@ Use `createEgressPolicy()` + `createAllowListEgressProxy()` when a coding agent
|
|
|
43
43
|
`createEgressPolicy({ allow, presets })` builds a deny-all policy. Rules are exact `{ host, port, protocol }` triples — no wildcards, no CIDR, no regex. Presets (`npm-registry`, `github`) expand to explicit rule lists at construction. The policy exposes a stable SHA-256 `fingerprint` over the canonical rule set.
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
|
-
import { createEgressPolicy, createAllowListEgressProxy } from "@arnilo/prism-coding-security";
|
|
46
|
+
import { createEgressPolicy, createAllowListEgressProxy } from "@arnilo/prism-coding-tools/security";
|
|
47
47
|
|
|
48
48
|
const policy = createEgressPolicy({
|
|
49
49
|
allow: [{ host: "api.github.com", port: 443, protocol: "https" }],
|
|
@@ -144,8 +144,8 @@ import {
|
|
|
144
144
|
createCodingApprovalPolicy,
|
|
145
145
|
createDockerSandbox,
|
|
146
146
|
createSandboxCodingComposition,
|
|
147
|
-
} from "@arnilo/prism-coding-security";
|
|
148
|
-
import { createGitTools } from "@arnilo/prism-coding-agent";
|
|
147
|
+
} from "@arnilo/prism-coding-tools/security";
|
|
148
|
+
import { createGitTools } from "@arnilo/prism-coding-tools/agent";
|
|
149
149
|
|
|
150
150
|
const policy = createCodingApprovalPolicy({
|
|
151
151
|
roots: [workspaceRoot],
|
|
@@ -194,7 +194,7 @@ await sandbox.close({
|
|
|
194
194
|
|
|
195
195
|
Policies are ordinary host values: attach one globally through `createCodingTools()`/`createReadOnlyTools()`/`createSandboxCodingComposition()` or per tool. A per-tool policy overrides the shared policy. `SandboxAdapter` / `DisposableSandbox` are replaceable and host-owned; approval policy and sandboxing are separate layers. Custom remote sandboxes can implement `DisposableSandbox` without using Docker.
|
|
196
196
|
|
|
197
|
-
`createSandboxCodingComposition()` requires `workspaceMode`. Sandbox mode auto-wires FS/list/search through `DisposableSandbox.execFile` (or host-supplied custom operations) so mutations stay on the disposable tree until export. Host mode runs every coding tool against the host cwd and reports no isolation capability (`containmentClaim` deprecated false). Sandbox shell + host FS throws unless `allowMixedWorkspaceWiring: true` (warnings + all capabilities false). Opt-in structured Git tools (`createGitTools(composition.workspaceRoot, { execFile: sandbox.execFile, commitIdentity })`) share the same tree/cwd; Prism still never pushes or opens PRs. Optional `@arnilo/prism-browser` can share the same disposable boundary: use `assertBrowserSandboxNetwork()` before browse-ready custom networks, and `createSharedSandboxBrowserOptions({ workspaceRoot, downloadsRoot, containedProxyAttestation })` so uploads/downloads align with `/workspace` and `/downloads`. Close the browser context before disposing the sandbox.
|
|
197
|
+
`createSandboxCodingComposition()` requires `workspaceMode`. Sandbox mode auto-wires FS/list/search through `DisposableSandbox.execFile` (or host-supplied custom operations) so mutations stay on the disposable tree until export. Host mode runs every coding tool against the host cwd and reports no isolation capability (`containmentClaim` deprecated false). Sandbox shell + host FS throws unless `allowMixedWorkspaceWiring: true` (warnings + all capabilities false). Opt-in structured Git tools (`createGitTools(composition.workspaceRoot, { execFile: sandbox.execFile, commitIdentity })`) share the same tree/cwd; Prism still never pushes or opens PRs. Optional `@arnilo/prism-web-tools/browser` can share the same disposable boundary: use `assertBrowserSandboxNetwork()` before browse-ready custom networks, and `createSharedSandboxBrowserOptions({ workspaceRoot, downloadsRoot, containedProxyAttestation })` so uploads/downloads align with `/workspace` and `/downloads`. Close the browser context before disposing the sandbox.
|
|
198
198
|
|
|
199
199
|
The Docker reference adapter starts by recorded container ID/label, uses argument arrays only, mounts source read-only, populates a size-bounded tmpfs `/workspace`, drops all capabilities, enables `no-new-privileges`, runs with `--init`, and never exposes the Docker socket, privileged mode, or host PID/IPC namespaces. Image pull/build/update stays outside Prism. Protected real-Docker checks are opt-in via `PRISM_TEST_DOCKER_SANDBOX=1` with host-supplied `PRISM_TEST_DOCKER_BIN` and digest-pinned `PRISM_TEST_DOCKER_IMAGE`.
|
|
200
200
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Coding Tools, Sandboxing, and Personas (@arnilo/prism-coding-tools)
|
|
2
|
+
|
|
3
|
+
The `@arnilo/prism-coding-tools` family package unifies Prism's coding agent tools, security sandboxing, document reading, OpenAPI integration, Linux desktop automation, Dev inspector, and persona extensions into explicit, import-isolated subpaths.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @arnilo/prism @arnilo/prism-coding-tools
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For document reading or specialized persona integrations, install the optional peer dependencies as needed:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# PDF and DOCX document extraction
|
|
15
|
+
npm install pdf-parse mammoth
|
|
16
|
+
|
|
17
|
+
# Ponytail upstream integration
|
|
18
|
+
npm install @dietrichgebert/ponytail
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Subpaths Map
|
|
22
|
+
|
|
23
|
+
| Subpath | Description | Optional Peers |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `@arnilo/prism-coding-tools/agent` | Core coding tools (read, write, edit, search, bash, git, diagnostics, check, ast-grep, lsp) | — |
|
|
26
|
+
| `@arnilo/prism-coding-tools/security` | Sandbox execution adapters (Docker/OCI, native disposable sandbox, approval policies, egress proxy) | — |
|
|
27
|
+
| `@arnilo/prism-coding-tools/document-reader` | Bounded PDF/DOCX literal-text extraction adapter with fail-closed loading | `pdf-parse`, `mammoth` |
|
|
28
|
+
| `@arnilo/prism-coding-tools/openapi` | OpenAPI 3.x tool generator and executor with SSRF protection and parameter validation | — |
|
|
29
|
+
| `@arnilo/prism-coding-tools/computer-use-linux` | Linux desktop observation and targeting tool bridge | — |
|
|
30
|
+
| `@arnilo/prism-coding-tools/dev` | Loopback-only developer inspector, event timeline visualizer, and local replay server | — |
|
|
31
|
+
| `@arnilo/prism-coding-tools/dev/cli` | Command-line entrypoint for `prism dev` | — |
|
|
32
|
+
| `@arnilo/prism-coding-tools/caveman` | Caveman ultra-terse engineering persona extension | — |
|
|
33
|
+
| `@arnilo/prism-coding-tools/ponytail` | Ponytail multi-agent planning and delegation persona extension | `@dietrichgebert/ponytail` |
|
|
34
|
+
| `@arnilo/prism-coding-tools/impeccable` | Impeccable high-precision frontend engineering persona extension | — |
|
|
35
|
+
|
|
36
|
+
## CLI
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Start the loopback dev inspector
|
|
40
|
+
npx prism-dev --port 4311
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage Examples
|
|
44
|
+
|
|
45
|
+
### Creating Coding Tools
|
|
46
|
+
```ts
|
|
47
|
+
import { createCodingTools } from "@arnilo/prism-coding-tools/agent";
|
|
48
|
+
|
|
49
|
+
const tools = createCodingTools({
|
|
50
|
+
workspaceRoot: process.cwd(),
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Sandboxed Execution
|
|
55
|
+
```ts
|
|
56
|
+
import { createDockerSandbox, createSandboxCodingComposition } from "@arnilo/prism-coding-tools/security";
|
|
57
|
+
|
|
58
|
+
const composition = createSandboxCodingComposition({
|
|
59
|
+
workspaceMode: "sandbox",
|
|
60
|
+
sandbox: createDockerSandbox({
|
|
61
|
+
image: "node:20-alpine@sha256:...",
|
|
62
|
+
workspaceRoot: process.cwd(),
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Persona Extensions
|
|
68
|
+
```ts
|
|
69
|
+
import { createCavemanExtension } from "@arnilo/prism-coding-tools/caveman";
|
|
70
|
+
import { createPonytailExtension } from "@arnilo/prism-coding-tools/ponytail";
|
|
71
|
+
import { createImpeccableExtension } from "@arnilo/prism-coding-tools/impeccable";
|
|
72
|
+
|
|
73
|
+
const caveman = createCavemanExtension();
|
|
74
|
+
const ponytail = createPonytailExtension();
|
|
75
|
+
const impeccable = createImpeccableExtension();
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Security & Import Isolation
|
|
79
|
+
|
|
80
|
+
- Importing `@arnilo/prism-coding-tools/agent` never loads Docker sandbox adapters, desktop MCP bridges, document parser peers, or Dev inspector modules.
|
|
81
|
+
- Document parser peers (`pdf-parse`, `mammoth`) and Ponytail optional peer fail closed when absent.
|
|
82
|
+
- Persona extensions are pure prompt and behavior modifiers and never gain implicit host privileges.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Coding workspaces
|
|
2
2
|
|
|
3
|
-
Ownership-scoped multi-repository and worktree lifecycle (plan 026 Task 3, `@arnilo/prism-coding-agent`). A durable coding workspace correlates task/session/run identity with host repositories and linked worktrees so that resume, cleanup, artifacts, and recovery stay bounded and reconcilable.
|
|
3
|
+
Ownership-scoped multi-repository and worktree lifecycle (plan 026 Task 3, `@arnilo/prism-coding-tools/agent`). A durable coding workspace correlates task/session/run identity with host repositories and linked worktrees so that resume, cleanup, artifacts, and recovery stay bounded and reconcilable.
|
|
4
4
|
|
|
5
5
|
The lifecycle composes existing bounded primitives only: `CheckpointStore` CAS records in a separate versioned namespace (`prism.coding-agent.workspace.v1`), `LeaseStore` fencing, and cwd-bound `GitOperations` runners. There is no clone manager, Git library, watcher, new database schema, or second task runtime.
|
|
6
6
|
|
|
7
7
|
## Activation
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import { createCodingWorkspaceLifecycle } from "@arnilo/prism-coding-agent";
|
|
10
|
+
import { createCodingWorkspaceLifecycle } from "@arnilo/prism-coding-tools/agent";
|
|
11
11
|
|
|
12
12
|
const workspaces = createCodingWorkspaceLifecycle({
|
|
13
13
|
checkpoints, // CheckpointStore (ownership-scoped)
|
|
@@ -149,11 +149,11 @@ await session.compact({ keepRecentEntries: 4 });
|
|
|
149
149
|
|
|
150
150
|
## Extension and configuration notes
|
|
151
151
|
|
|
152
|
-
Retry policies are ordinary `RetryPolicy` implementations and can be registered as `retryPolicy` contributions. Hosts must still pass the selected policy/config to `createAgent()` or `session.run()`. Retry middleware receives `{ context, decision }` before a retry is scheduled and can reduce delay or stop retrying. First-party providers emit `ErrorInfo.code` as the numeric HTTP status so the default policy's transient-code set (`429`/`500`/`502`/`503`) classifies retryability without provider-specific core branches; `@arnilo/prism-
|
|
152
|
+
Retry policies are ordinary `RetryPolicy` implementations and can be registered as `retryPolicy` contributions. Hosts must still pass the selected policy/config to `createAgent()` or `session.run()`. Retry middleware receives `{ context, decision }` before a retry is scheduled and can reduce delay or stop retrying. First-party providers emit `ErrorInfo.code` as the numeric HTTP status so the default policy's transient-code set (`429`/`500`/`502`/`503`) classifies retryability without provider-specific core branches; `@arnilo/prism-providers/neuralwatt` additionally exports `classifyNeuralWattError()` for hosts that want structured `Retry-After`/`retry_strategy` metadata.
|
|
153
153
|
|
|
154
154
|
Compaction strategies are ordinary `CompactionStrategy` implementations. Extensions can register strategies through the existing compaction strategy contribution registry, but registration is inert until a host explicitly selects and passes a strategy to runtime code. Extensions can also register `compaction` middleware; the runtime calls it only when the agent/session has that middleware registry configured.
|
|
155
155
|
|
|
156
|
-
The default strategy does not call a provider. Hosts that need model-generated summaries can use the optional [`@arnilo/prism-compaction
|
|
156
|
+
The default strategy does not call a provider. Hosts that need model-generated summaries can use the optional [`@arnilo/prism-memory/compaction/llm` subpath](compaction-llm.md); its `maxOutputTokens`/`maxSummaryTokens` budget is passed through `model.parameters.maxTokens` and first-party providers serialize that to provider output-token fields. Coding sessions can select that package's `createCodingCompactionStrategy()` preset for paths, patch intent, checks, plans/todos, blockers, and next verification steps; it remains an ordinary `CompactionStrategy` and does not retain complete diffs or add a coding runtime. Hosts that need prepared source-backed memory without a compaction-time model call can use [`@arnilo/prism-memory/compaction/observational-memory`](compaction-observational-memory.md).
|
|
157
157
|
|
|
158
158
|
## Security and performance notes
|
|
159
159
|
|
package/docs/compaction-llm.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# LLM compaction package
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
|
-
`@arnilo/prism-compaction
|
|
4
|
+
`@arnilo/prism-memory/compaction/llm` is an optional provider-backed compaction subpath. It prepares branch history, calls an explicit summary provider/model, and returns a standard Prism `CompactionStrategy`. The core default compaction remains local and conservative.
|
|
5
5
|
|
|
6
6
|
## When to use it
|
|
7
7
|
Use it when a host wants model-generated summaries while preserving raw append-only session history. Do not use it as a core default, provider SDK loader, hidden credential discovery layer, vector memory, or store rewrite.
|
|
@@ -59,7 +59,7 @@ Provider `error` events, empty summaries, or abort signals throw before returnin
|
|
|
59
59
|
|
|
60
60
|
## Implementation example
|
|
61
61
|
```ts
|
|
62
|
-
import { createLlmCompactionStrategy } from "@arnilo/prism-compaction
|
|
62
|
+
import { createLlmCompactionStrategy } from "@arnilo/prism-memory/compaction/llm";
|
|
63
63
|
|
|
64
64
|
const strategy = createLlmCompactionStrategy({
|
|
65
65
|
provider: summaryProvider,
|
|
@@ -80,7 +80,7 @@ await session.compact({ strategy, secrets: [apiKey] });
|
|
|
80
80
|
Coding-session example:
|
|
81
81
|
|
|
82
82
|
```ts
|
|
83
|
-
import { createCodingCompactionStrategy } from "@arnilo/prism-compaction
|
|
83
|
+
import { createCodingCompactionStrategy } from "@arnilo/prism-memory/compaction/llm";
|
|
84
84
|
|
|
85
85
|
const strategy = createCodingCompactionStrategy({
|
|
86
86
|
provider: summaryProvider,
|
|
@@ -110,7 +110,7 @@ This package is inert until imported. Direct strategy use works with `session.co
|
|
|
110
110
|
|
|
111
111
|
```ts
|
|
112
112
|
import { createAgent, createExtensionKernel } from "@arnilo/prism";
|
|
113
|
-
import { createLlmCompactionExtension } from "@arnilo/prism-compaction
|
|
113
|
+
import { createLlmCompactionExtension } from "@arnilo/prism-memory/compaction/llm";
|
|
114
114
|
|
|
115
115
|
const kernel = createExtensionKernel();
|
|
116
116
|
await kernel.load([createLlmCompactionExtension({ provider: summaryProvider, model: summaryModel })]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
`@arnilo/prism-compaction
|
|
5
|
+
`@arnilo/prism-memory/compaction/observational-memory` is an optional subpath for source-backed observational memory and fast compaction.
|
|
6
6
|
|
|
7
7
|
Current status: ledger/projection/render/recall utilities, explicit worker runtime, fast compaction strategy, inert extension helper, recall tool, and status/view command factories are available.
|
|
8
8
|
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
createRecallMemoryTool,
|
|
108
108
|
recallObservationalMemory,
|
|
109
109
|
renderObservationalMemory,
|
|
110
|
-
} from "@arnilo/prism-compaction
|
|
110
|
+
} from "@arnilo/prism-memory/compaction/observational-memory";
|
|
111
111
|
|
|
112
112
|
const om = createObservationalMemory({
|
|
113
113
|
observation: { provider: observerProvider, model: observerModel, messageTokens: 10_000 },
|
|
@@ -174,7 +174,7 @@ Hosts that need parent recall of child *source* work compose it themselves: wrap
|
|
|
174
174
|
|
|
175
175
|
```ts
|
|
176
176
|
import { createId, type SessionStore } from "@arnilo/prism";
|
|
177
|
-
import { isEligibleObservationSourceEntry } from "@arnilo/prism-compaction
|
|
177
|
+
import { isEligibleObservationSourceEntry } from "@arnilo/prism-memory/compaction/observational-memory";
|
|
178
178
|
|
|
179
179
|
function funnelChildMessagesToWorkspace(store: SessionStore, workspaceSessionId: string): SessionStore {
|
|
180
180
|
return {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
`@arnilo/prism-computer-use-linux` wraps the host-owned [`computer-use-linux`](https://github.com/agent-sh/computer-use-linux) MCP binary as Prism `ToolDefinition`s. It connects over stdio only when `createComputerUseLinuxTools()` is called, keeps upstream tool names, filters unknown tools, and composes desktop admission, execution approval, result bounds, serialization, redaction, and trust labeling over Prism's existing seams.
|
|
5
|
+
`@arnilo/prism-coding-tools/computer-use-linux` wraps the host-owned [`computer-use-linux`](https://github.com/agent-sh/computer-use-linux) MCP binary as Prism `ToolDefinition`s. It connects over stdio only when `createComputerUseLinuxTools()` is called, keeps upstream tool names, filters unknown tools, and composes desktop admission, execution approval, result bounds, serialization, redaction, and trust labeling over Prism's existing seams.
|
|
6
6
|
|
|
7
7
|
The package also exports `loadComputerUseLinuxSkill()`, which loads the short Prism-authored desktop procedure bundled at `skills/computer-use-linux/SKILL.md`. It does not resolve or vendor an upstream skill tree.
|
|
8
8
|
|
|
@@ -75,7 +75,7 @@ import { createToolRegistry, type Skill } from "@arnilo/prism";
|
|
|
75
75
|
import {
|
|
76
76
|
createComputerUseLinuxTools,
|
|
77
77
|
loadComputerUseLinuxSkill,
|
|
78
|
-
} from "@arnilo/prism-computer-use-linux";
|
|
78
|
+
} from "@arnilo/prism-coding-tools/computer-use-linux";
|
|
79
79
|
|
|
80
80
|
async function installDesktop(hostSkills: { register(skill: Skill): void }, hostApproved: boolean) {
|
|
81
81
|
const desktop = await createComputerUseLinuxTools({
|
|
@@ -112,6 +112,17 @@ async function installDesktop(hostSkills: { register(skill: Skill): void }, host
|
|
|
112
112
|
- Imports are inert. The default setup surface is off, the skill file is capped at 64 KiB, and no full upstream skill tree is shipped.
|
|
113
113
|
- The host must keep credentials, desktop session state, binary paths, sandbox identity, and approval state outside model-controlled arguments.
|
|
114
114
|
|
|
115
|
+
## Live probe (plans/064 Task 7)
|
|
116
|
+
|
|
117
|
+
A live leg drives the host's real `computer-use-linux` MCP binary over stdio — real tool inventory, one bounded read-only screenshot, clean close (≤30 s):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
PRISM_TEST_COMPUTER_USE=1 PRISM_COMPUTER_USE_BIN="$(command -v computer-use-linux)" \
|
|
121
|
+
node --test packages/prism-coding-tools/dist/computer-use-linux/__tests__/live.test.js
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Skips (never fails) when the flag, binary path, or a desktop session is unavailable. The suite performs no network I/O, so screenshot bytes cannot leave the process. Registered in `scripts/live-matrix.json` as `coding-tools/computer-use-live`.
|
|
125
|
+
|
|
115
126
|
## Related APIs
|
|
116
127
|
|
|
117
128
|
- [Device adapters](device-adapters.md): generic admission, shared limits, chunk bounds, and telemetry redaction contract.
|
|
@@ -158,6 +158,8 @@ Skill selection grants no tool access and cannot bypass permissions — a skill'
|
|
|
158
158
|
|
|
159
159
|
### Progressive skill disclosure
|
|
160
160
|
|
|
161
|
+
Skills apply the same progressive-disclosure discipline as plan 041's [tool disclosure](tools.md) (toolsDisclosure "search") — one mechanism applied to skills (prompt text) and tools (provider tool arrays).
|
|
162
|
+
|
|
161
163
|
`skillsDisclosure` on `AgentConfig` / `RunOptions` (`"progressive"` default, `"eager"` opt-in; run wins) controls how active skills render in provider input:
|
|
162
164
|
|
|
163
165
|
| Mode | Provider view per active skill |
|
|
@@ -198,7 +200,7 @@ await agent.createSession().run("…", { activeSkills: ["ponytail"] });
|
|
|
198
200
|
|
|
199
201
|
### Third-party behavior packages (Caveman, Ponytail, Impeccable)
|
|
200
202
|
|
|
201
|
-
`@arnilo/prism-caveman` and `@arnilo/prism-ponytail` register upstream skills into the extension kernel skill registry. Hosts should:
|
|
203
|
+
`@arnilo/prism-coding-tools/caveman` and `@arnilo/prism-coding-tools/ponytail` register upstream skills into the extension kernel skill registry. Hosts should:
|
|
202
204
|
|
|
203
205
|
1. `kernel.load([createCavemanExtension(...), createPonytailExtension(...)])` with session `appendEntry` / `getEntries` callbacks.
|
|
204
206
|
2. Build `createSkillRegistry(kernel.registries.skills.list())` and pass `activeSkills` / `resolveActiveSkills` names.
|
package/docs/conversations.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
`@arnilo/prism-server` ships a durable, user-scoped conversation service: create/list/get/continue/branch/archive/export/delete conversation threads on top of the existing session and event-ledger seams. A thread **is** an ownership-scoped session branch plus a `prismConversation` marker in `SessionRecord.metadata`; content stays in session entries and the redacted event ledger. Reconnectable replay pages durable redacted events without ever rerunning a provider or tool.
|
|
5
|
+
`@arnilo/prism-core/runtime/server` ships a durable, user-scoped conversation service: create/list/get/continue/branch/archive/export/delete conversation threads on top of the existing session and event-ledger seams. A thread **is** an ownership-scoped session branch plus a `prismConversation` marker in `SessionRecord.metadata`; content stays in session entries and the redacted event ledger. Reconnectable replay pages durable redacted events without ever rerunning a provider or tool.
|
|
6
6
|
|
|
7
|
-
Core (`@arnilo/prism`) exports only conversation **types and pure helpers** (`ConversationThread`, `ConversationError`, `CONVERSATION_METADATA_KEY`, thread-bound replay cursor codec, `conversationThreadFromRecord`, `conversationMarkerMetadata`). The service and optional HTTP handler live in `@arnilo/prism-server`.
|
|
7
|
+
Core (`@arnilo/prism`) exports only conversation **types and pure helpers** (`ConversationThread`, `ConversationError`, `CONVERSATION_METADATA_KEY`, thread-bound replay cursor codec, `conversationThreadFromRecord`, `conversationMarkerMetadata`). The service and optional HTTP handler live in `@arnilo/prism-core/runtime/server`.
|
|
8
8
|
|
|
9
9
|
## When to use it
|
|
10
10
|
|
|
@@ -15,8 +15,8 @@ Do not use it as a chat UI, a push/always-on daemon, or a file store. Slack/Team
|
|
|
15
15
|
## Inputs / request
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import { createConversationService, createConversationHandler } from "@arnilo/prism-server";
|
|
19
|
-
import { createSqlitePersistence } from "@arnilo/prism-
|
|
18
|
+
import { createConversationService, createConversationHandler } from "@arnilo/prism-core/runtime/server";
|
|
19
|
+
import { createSqlitePersistence } from "@arnilo/prism-core/sessions/sqlite";
|
|
20
20
|
|
|
21
21
|
const persistence = createSqlitePersistence({ filename }); // implements ConversationServiceStore
|
|
22
22
|
const service = createConversationService(persistence, {
|