@arnilo/prism 0.2.8 → 0.3.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 +17 -0
- package/README.md +14 -6
- package/dist/contracts-protocol.d.ts +31 -1
- package/dist/delegated-agent-step.d.ts +20 -0
- package/dist/delegated-agent-step.js +99 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/oauth-device-code.d.ts +5 -0
- package/dist/oauth-device-code.js +38 -14
- package/docs/0.1.0-readiness.md +8 -8
- package/docs/acp.md +4 -3
- package/docs/ag-ui.md +5 -2
- package/docs/agent-events.md +8 -1
- package/docs/antigravity-agent.md +207 -0
- package/docs/caveman.md +3 -2
- package/docs/coding-agent-tools.md +32 -4
- package/docs/computer-use-linux.md +122 -0
- package/docs/context-and-skills.md +2 -2
- package/docs/credential-storage.md +1 -1
- package/docs/credentials-and-redaction.md +2 -2
- package/docs/device-adapters.md +4 -3
- package/docs/extensions.md +1 -0
- package/docs/impeccable.md +102 -0
- package/docs/index.md +14 -4
- package/docs/mcp-tools.md +1 -1
- package/docs/migration.md +26 -2
- package/docs/ponytail.md +2 -2
- package/docs/provider-caching.md +6 -0
- package/docs/provider-packages.md +19 -6
- package/docs/providers/clinepass.md +120 -0
- package/docs/providers/deepseek.md +147 -0
- package/docs/providers/openai.md +1 -1
- package/docs/providers/xai.md +138 -0
- package/docs/release-and-install.md +92 -29
- package/docs/thinking-and-reasoning.md +6 -3
- package/package.json +4 -2
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Antigravity delegated agent
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
`@arnilo/prism-antigravity-agent` provides a delegated agent adapter for the official [Google Antigravity CLI (`agy`)](https://github.com/google/antigravity). It enables Prism applications to delegate complex, multi-step coding tasks to an authenticated Antigravity CLI runner while exposing host-owned Prism tools, resources, and prompts over a per-run Model Context Protocol (MCP) server.
|
|
6
|
+
|
|
7
|
+
The package handles the end-to-end delegated execution lifecycle:
|
|
8
|
+
- Spawns the official headless CLI (`agy --agent <name> --workspace <dir>`) as a managed subprocess.
|
|
9
|
+
- Starts a run-bound loopback HTTP MCP server (`http://127.0.0.1:<port>/mcp`) authorized with an ephemeral Bearer token.
|
|
10
|
+
- Writes ephemeral workspace configuration (`.agents/mcp_config.json` and custom agent instructions) with automatic backup and fail-safe restoration.
|
|
11
|
+
- Parses the CLI's NDJSON output stream and projects steps into standard Prism `AgentEvent`s and [AG-UI](ag-ui.md) timeline activities.
|
|
12
|
+
- Persists and resumes multi-turn conversations via `--conversation <id>`.
|
|
13
|
+
- Provides an optional `createAntigravityDelegationTool` for Prism [supervisors](supervisors.md) and orchestrating agents.
|
|
14
|
+
|
|
15
|
+
Prism does not manage Google OAuth tokens, cookies, or credentials; the host environment owns the official `agy` binary and interactive authentication state (`agy login` / Google AI Pro subscription).
|
|
16
|
+
|
|
17
|
+
## When to use it
|
|
18
|
+
|
|
19
|
+
Use `@arnilo/prism-antigravity-agent` when:
|
|
20
|
+
- You want to delegate autonomous coding sessions to Google Antigravity while exposing host-owned Prism tools and capabilities via MCP.
|
|
21
|
+
- You need structured event streaming, token telemetry, and [AG-UI](ag-ui.md) visual timeline integration for Antigravity executions.
|
|
22
|
+
- You are orchestrating multi-agent workflows where a Prism supervisor or coding agent needs to delegate specialized subtasks to Antigravity.
|
|
23
|
+
- You want conversation continuation across multiple user turns in a persistent session.
|
|
24
|
+
|
|
25
|
+
Do **not** use it:
|
|
26
|
+
- As a generic LLM model provider. For direct Gemini API or Vertex AI foundation model inference without an autonomous loop, use [`@arnilo/prism-provider-google`](providers/google.md) or [`@arnilo/prism-provider-vertex`](providers/vertex.md).
|
|
27
|
+
- If you require step-by-step turn replacement of Antigravity's internal model loop, compaction, or planning strategy.
|
|
28
|
+
- If you require unreleased raw internal chain-of-thought text. Antigravity reasoning effort is projected as token counts and timeline activity steps, not raw hidden thoughts.
|
|
29
|
+
|
|
30
|
+
## Inputs / request
|
|
31
|
+
|
|
32
|
+
`createAntigravityCliAgent(options)` accepts agent configuration:
|
|
33
|
+
|
|
34
|
+
| Field | Type | Default | Purpose |
|
|
35
|
+
| --- | --- | --- | --- |
|
|
36
|
+
| `command` | `string` | `"agy"` | Path to the official `agy` executable on the host. |
|
|
37
|
+
| `args` | `readonly string[]` | `[]` | Additional command-line arguments passed to the CLI. |
|
|
38
|
+
| `cwd` | `string` | `process.cwd()` | Working directory for the runner process. |
|
|
39
|
+
| `env` | `Record<string, string | undefined>` | `process.env` | Process environment variables. |
|
|
40
|
+
| `timeoutMs` | `number` | `300000` (5m) | Maximum process execution time. |
|
|
41
|
+
| `toolPolicy` | `AntigravityToolPolicy` | `"hybrid"` | Built-in CLI tool permissions (`"hybrid"`, `"all"`, `"none"`, or custom). |
|
|
42
|
+
| `tools` | `ToolDefinition[]` | `[]` | Prism tools exposed to the agent via loopback MCP. |
|
|
43
|
+
| `resources` | `ResourceDefinition[]` | `[]` | Prism resources exposed via loopback MCP. |
|
|
44
|
+
| `prompts` | `PromptDefinition[]` | `[]` | Prism prompt templates exposed via loopback MCP. |
|
|
45
|
+
| `exposure` | `AntigravityMcpExposure` | auto-created | Custom MCP server exposure handle if sharing an external server. |
|
|
46
|
+
| `conversationStore` | `AntigravityConversationStore` | in-memory | Store for persisting conversation IDs across turns. |
|
|
47
|
+
| `redactor` | `SecretRedactor` | auto | Secret redactor applied to events and process output. |
|
|
48
|
+
| `agentName` | `string` | `"prism-agent"` | Ephemeral agent definition identifier. |
|
|
49
|
+
| `systemPrompt` | `string` | built-in instructions | Custom instructions appended to the agent definition. |
|
|
50
|
+
|
|
51
|
+
`agent.run(runOptions)` executes a prompt run:
|
|
52
|
+
|
|
53
|
+
| Field | Type | Default | Purpose |
|
|
54
|
+
| --- | --- | --- | --- |
|
|
55
|
+
| `prompt` | `string` | required | User task or instruction for Antigravity. |
|
|
56
|
+
| `workspace` | `string` | `agent.cwd` | Target workspace directory path for file modifications. |
|
|
57
|
+
| `sessionId` | `string` | auto-generated | Prism session identifier for conversation persistence. |
|
|
58
|
+
| `branchId` | `string` | `"main"` | Branch identifier for conversation isolation. |
|
|
59
|
+
| `conversationId` | `string` | auto-resolved | Existing Antigravity conversation ID to resume. |
|
|
60
|
+
| `signal` | `AbortSignal` | omitted | Cancellation signal to abort execution and clean up. |
|
|
61
|
+
| `eventSink` | `(event: AgentEvent) => void` | omitted | Real-time event listener for streaming UI updates. |
|
|
62
|
+
| `toolPolicy` | `AntigravityToolPolicy` | agent default | Per-run override for built-in tool policy. |
|
|
63
|
+
|
|
64
|
+
## Outputs / response / events
|
|
65
|
+
|
|
66
|
+
`agent.run()` returns a promise resolving to an `AntigravityRunResult`:
|
|
67
|
+
|
|
68
|
+
| Field | Type | Purpose |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| `text` | `string` | Final synthesized response text from the Antigravity CLI. |
|
|
71
|
+
| `conversationId` | `string` | Antigravity conversation ID for subsequent multi-turn resumption. |
|
|
72
|
+
| `exitCode` | `number` | Process exit status code (0 for success). |
|
|
73
|
+
| `durationMs` | `number` | Total elapsed execution time in milliseconds. |
|
|
74
|
+
| `events` | `readonly AgentEvent[]` | Complete sequence of projected Prism events emitted during the run. |
|
|
75
|
+
| `usage` | `UsageReport` | Aggregated prompt, completion, total, and thinking token counts. |
|
|
76
|
+
| `subagents` | `readonly AntigravitySubagentSummary[]` | Subagents spawned and completed during execution. |
|
|
77
|
+
|
|
78
|
+
### Streamed events
|
|
79
|
+
|
|
80
|
+
The runner emits standardized Prism `AgentEvent` objects to the provided `eventSink`:
|
|
81
|
+
- `delegated_agent_step`: High-level step progression with step name, status, and duration.
|
|
82
|
+
- `message_delta`: Incremental response text chunks.
|
|
83
|
+
- `tool_call_start` / `tool_call_delta` / `tool_call_result`: MCP tool invocations and results.
|
|
84
|
+
- `agent_thought_chunk`: Thinking activity indicators with token counts.
|
|
85
|
+
- `usage`: Token usage telemetry updates.
|
|
86
|
+
- `subagent_spawn` / `subagent_finish`: Internal subagent hierarchy lifecycle.
|
|
87
|
+
|
|
88
|
+
## Request/response example
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"prompt": "Inspect the repository and add unit tests for the auth helper.",
|
|
93
|
+
"workspace": "/home/user/project",
|
|
94
|
+
"sessionId": "session-101",
|
|
95
|
+
"toolPolicy": "hybrid"
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"text": "Added 4 unit tests covering token refresh and validation in auth.test.ts.",
|
|
102
|
+
"conversationId": "conv_9876543210",
|
|
103
|
+
"exitCode": 0,
|
|
104
|
+
"durationMs": 4250,
|
|
105
|
+
"usage": {
|
|
106
|
+
"promptTokens": 1520,
|
|
107
|
+
"completionTokens": 380,
|
|
108
|
+
"totalTokens": 1900,
|
|
109
|
+
"thinkingTokens": 640
|
|
110
|
+
},
|
|
111
|
+
"subagents": []
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Implementation example
|
|
116
|
+
|
|
117
|
+
### Direct runner
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import { createAntigravityCliAgent } from "@arnilo/prism-antigravity-agent";
|
|
121
|
+
import { createReadTool, createWriteTool } from "@arnilo/prism-coding-agent";
|
|
122
|
+
|
|
123
|
+
// Configure agent with host-owned Prism tools exposed over MCP
|
|
124
|
+
const agent = createAntigravityCliAgent({
|
|
125
|
+
command: "agy",
|
|
126
|
+
tools: [
|
|
127
|
+
createReadTool({ workspaceRoot: "/home/user/project" }),
|
|
128
|
+
createWriteTool({ workspaceRoot: "/home/user/project" }),
|
|
129
|
+
],
|
|
130
|
+
toolPolicy: "hybrid", // Built-in bash/editor tools enabled; Prism MCP tools added
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Run a task with real-time event streaming
|
|
134
|
+
const result = await agent.run({
|
|
135
|
+
prompt: "Refactor error handling in src/utils.ts to use typed AppError",
|
|
136
|
+
workspace: "/home/user/project",
|
|
137
|
+
sessionId: "session-42",
|
|
138
|
+
eventSink: (event) => {
|
|
139
|
+
if (event.type === "message_delta") {
|
|
140
|
+
process.stdout.write(event.delta.text);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
console.log(`\nCompleted in ${result.durationMs}ms with conversation ${result.conversationId}`);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Supervisor delegation tool
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import { createSupervisor } from "@arnilo/prism-supervisor";
|
|
152
|
+
import {
|
|
153
|
+
createAntigravityCliAgent,
|
|
154
|
+
createAntigravityDelegationTool,
|
|
155
|
+
} from "@arnilo/prism-antigravity-agent";
|
|
156
|
+
|
|
157
|
+
const antigravity = createAntigravityCliAgent({
|
|
158
|
+
workspace: "/home/user/project",
|
|
159
|
+
toolPolicy: "hybrid",
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const supervisor = createSupervisor({
|
|
163
|
+
tools: [
|
|
164
|
+
createAntigravityDelegationTool({
|
|
165
|
+
agent: antigravity,
|
|
166
|
+
name: "delegate_to_antigravity",
|
|
167
|
+
description: "Delegate complex coding tasks to Google Antigravity CLI",
|
|
168
|
+
}),
|
|
169
|
+
],
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Extension and configuration notes
|
|
174
|
+
|
|
175
|
+
### Ephemeral workspace configuration
|
|
176
|
+
|
|
177
|
+
During each execution, the adapter dynamically constructs:
|
|
178
|
+
1. `.agents/mcp_config.json`: Configures the local loopback MCP server endpoint (`http://127.0.0.1:<port>/mcp`) and authorization header.
|
|
179
|
+
2. `.agents/agents/<name>/agent.md`: Configures custom instructions and tool permissions.
|
|
180
|
+
|
|
181
|
+
If pre-existing configuration files exist in `.agents/`, they are backed up before the run and restored atomically upon completion, failure, or cancellation.
|
|
182
|
+
|
|
183
|
+
### Tool policies
|
|
184
|
+
|
|
185
|
+
The `toolPolicy` setting controls built-in CLI capabilities:
|
|
186
|
+
- `"hybrid"` (default): Enables built-in editor, terminal, and search tools while exposing configured Prism MCP tools.
|
|
187
|
+
- `"all"`: Enables all built-in CLI tools and MCP tools.
|
|
188
|
+
- `"none"`: Disables built-in tools; the agent relies exclusively on exposed Prism MCP tools.
|
|
189
|
+
- Custom object `{ allow?: string[], deny?: string[] }`: Explicit allow/deny lists for fine-grained governance.
|
|
190
|
+
|
|
191
|
+
## Security and performance notes
|
|
192
|
+
|
|
193
|
+
- **Host-owned authentication**: Prism does not read, store, or forward Google credentials. Authentication state resides in the official `agy` CLI's session store managed via `agy login`.
|
|
194
|
+
- **Loopback isolation**: The ephemeral MCP HTTP server binds exclusively to `127.0.0.1` on a dynamically assigned port, secured with a cryptographically random Bearer token.
|
|
195
|
+
- **Fail-safe cleanup**: Workspace configuration files and HTTP listener ports are cleaned up in `finally` blocks under all exit conditions, including `SIGINT`, timeouts, and unhandled errors.
|
|
196
|
+
- **Secret redaction**: All stdout, stderr, event payloads, and tool arguments are processed through Prism's secret redactor before event emission.
|
|
197
|
+
- **Terms and quota**: Antigravity CLI execution utilizes Google AI Pro subscription quotas through the authenticated official binary. Host operators should verify compliance with their organization's terms of service.
|
|
198
|
+
|
|
199
|
+
## Related APIs
|
|
200
|
+
|
|
201
|
+
- [Frontend interoperability (AG-UI and ACP)](ag-ui.md): Connect Antigravity event streams to AG-UI and web interfaces.
|
|
202
|
+
- [MCP client bridge and server exposure](mcp-tools.md): Core Model Context Protocol integration in Prism.
|
|
203
|
+
- [Supervisor delegation](supervisors.md): Hierarchical multi-agent delegation patterns.
|
|
204
|
+
- [Coding agent tools](coding-agent-tools.md): Native Prism file, edit, and terminal tools.
|
|
205
|
+
- [Google Gemini provider](providers/google.md): Direct Gemini API model inference without CLI delegation.
|
|
206
|
+
- [Google Vertex AI provider](providers/vertex.md): Enterprise cloud Vertex AI model inference.
|
|
207
|
+
- [Public contracts](public-contracts.md): Core message, event, tool, and session types.
|
package/docs/caveman.md
CHANGED
|
@@ -37,9 +37,9 @@ Session custom entry shape:
|
|
|
37
37
|
{ "kind": "custom", "data": { "type": "caveman-level", "level": "full" } }
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Required skills (fail closed if missing): `caveman`, `caveman-commit`, `caveman-review`, `caveman-stats`, `caveman-compress`, `caveman-help`, `cavecrew`. Extra `skills/*/SKILL.md` (v2.1 extras like `caveman-explore`) register as optional skills and `load_skill` commands. Dirs without `SKILL.md` (`*.mjs`, `registry.json`, `generated/`) are skipped.
|
|
41
41
|
|
|
42
|
-
Registered commands: `caveman
|
|
42
|
+
Registered commands: `caveman` (level), `caveman-init`, plus one `load_skill` dispatch per registered skill except `caveman`.
|
|
43
43
|
|
|
44
44
|
## Outputs / response / events
|
|
45
45
|
|
|
@@ -110,6 +110,7 @@ See `examples/caveman-ponytail.ts` for progressive catalog + `load_skill` wiring
|
|
|
110
110
|
- `caveman-stats` dispatches skill metadata only; full stats need host session-log integration.
|
|
111
111
|
- `caveman-init` returns upstream guidance text; it does not write files in the host repo.
|
|
112
112
|
- No TUI status bar; optional `caveman:status` events for host UI.
|
|
113
|
+
- Caveman 2 compression proxy/engine is **not** a Prism runtime. Only `SKILL.md` files under `skills/` load.
|
|
113
114
|
|
|
114
115
|
## Security and performance notes
|
|
115
116
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
| `createReadTool(cwd, options?)` | `read` tool: read a text or image file into `TextContent` / `ImageContent`. |
|
|
11
11
|
| `createWriteTool(cwd, options?)` | `write` tool: create or overwrite a file, creating parent directories. |
|
|
12
12
|
| `createEditTool(cwd, options?)` | `edit` tool: precise exact-then-fuzzy text replacement in an existing file. |
|
|
13
|
+
| `createAcpFilesystemOperations(client)` | Map an ACP-shaped text-file client to `read`/`write`/`edit` operations; no local-disk fallback, binary/image support, or remote `mkdir`. |
|
|
13
14
|
| `createRepoListTool(cwd, options?)` | `repo_list` tool: bounded deterministic repository listing. |
|
|
14
15
|
| `createRepoSearchTool(cwd, options?)` | `repo_search` tool: bounded literal text search (`outputMode`: content / files_with_matches / count). |
|
|
15
16
|
| `createGlobTool(cwd, options?)` | `glob` tool: bounded filename-pattern match (`*` / `?` / `**`; opt-in bounded `{a,b}` brace expansion via `braceExpansion`). |
|
|
@@ -50,6 +51,23 @@ const tools = createToolRegistry(createCodingTools(process.cwd()));
|
|
|
50
51
|
|
|
51
52
|
Every tool carries an explicit `kind` (`shell`→`execute`, `read`/`repo_list`→`read`, `write`/`edit`→`edit`, `repo_search`/`glob`→`search`, `delete`→`delete`, `move`→`move`) so ACP `tool_call` updates and other consumers can classify tools without name heuristics.
|
|
52
53
|
|
|
54
|
+
### ACP editor-buffer operations
|
|
55
|
+
|
|
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
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { createAcpFilesystemOperations, createCodingTools } from "@arnilo/prism-coding-agent";
|
|
60
|
+
|
|
61
|
+
const operations = createAcpFilesystemOperations(clientFilesystem);
|
|
62
|
+
const tools = createCodingTools(cwd, {
|
|
63
|
+
read: { operations: operations.read },
|
|
64
|
+
write: { operations: operations.write },
|
|
65
|
+
edit: { operations: operations.edit },
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This is an editor-buffer adapter, not a repository backend: `repo_list`, `repo_search`, `glob`, `delete`, and `move` remain disk-backed unless separately overridden. Binary/image and document reads are not silently delegated to local disk.
|
|
70
|
+
|
|
53
71
|
## When to use it
|
|
54
72
|
|
|
55
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.
|
|
@@ -144,8 +162,10 @@ Read a text or image file.
|
|
|
144
162
|
| `path` | `string` | Path to the file (relative or absolute; `~` and `file://` expanded). Required. |
|
|
145
163
|
| `offset` | `number` | Line to start reading from (1-indexed). |
|
|
146
164
|
| `limit` | `number` | Maximum number of lines to read. |
|
|
165
|
+
| `findText` | `string` | Literal substring to search for (no regex). When set, the tool pages through the file from `offset` and returns the page starting at the **first matching line** (re-read at the hit line so the match is the first line). No match is an error result with no file body. |
|
|
166
|
+
| `findMode` | `"exact" \| "case-insensitive"` | Match mode for `findText` (default `"exact"`). Two literals only — no regex, no fuzzy. |
|
|
147
167
|
|
|
148
|
-
**Outputs:** text files are scanned incrementally until one requested page, `maxLines`/`maxBytes`, EOF, or `maxScanBytes` (default 64 MiB scanned per call; 1 GiB hard cap). The default path never loads the complete file and returns a `Use offset=N to continue` footer when more remains. Exact total line count is reported only when EOF was already reached in the bounded scan. Image files (PNG/JPEG/GIF/WebP/BMP by **magic bytes**, not extension) become `[TextContent note, ImageContent]` with base64 `data` and `mimeType`. Oversize images are rejected by `stat` (when available) or `buffer.length` against `maxImageBytes` (default 10 MB) before base64 encoding. An optional `transformImage` callback lets hosts resize or re-encode images without adding image-processing dependencies to the base package. Read failures (missing file, offset beyond end, oversize image, abort) are error results.
|
|
168
|
+
**Outputs:** text files are scanned incrementally until one requested page, `maxLines`/`maxBytes`, EOF, or `maxScanBytes` (default 64 MiB scanned per call; 1 GiB hard cap). The default path never loads the complete file and returns a `Use offset=N to continue` footer when more remains. Exact total line count is reported only when EOF was already reached in the bounded scan. When `findText` is set, the tool pages through `readText` output (in `maxLines`-sized pages) from `offset`, returns the page whose first line is the first match, and stops at the same `maxScanBytes` scan cap — the search is a literal substring scan (per `findMode`), never regex. Image files (PNG/JPEG/GIF/WebP/BMP by **magic bytes**, not extension) become `[TextContent note, ImageContent]` with base64 `data` and `mimeType`. Oversize images are rejected by `stat` (when available) or `buffer.length` against `maxImageBytes` (default 10 MB) before base64 encoding. An optional `transformImage` callback lets hosts resize or re-encode images without adding image-processing dependencies to the base package. Read failures (missing file, offset beyond end, oversize image, abort, findText scan limit) are error results.
|
|
149
169
|
|
|
150
170
|
`read` tool options (via `createReadTool(cwd, options)` or `ToolsOptions.read`):
|
|
151
171
|
|
|
@@ -166,6 +186,14 @@ const read = createReadTool(cwd, {
|
|
|
166
186
|
maxImageBytes: DEFAULT_MAX_IMAGE_BYTES,
|
|
167
187
|
transformImage: async ({ buffer, mimeType }) => host.resizeImage(buffer, mimeType),
|
|
168
188
|
});
|
|
189
|
+
|
|
190
|
+
// jump to the first line containing the needle
|
|
191
|
+
await read.execute({ path: "src/edit.ts", findText: "createEditTool" }, ctx);
|
|
192
|
+
// case-insensitive search starting at offset 50
|
|
193
|
+
await read.execute(
|
|
194
|
+
{ path: "src/edit.ts", findText: "edittool", findMode: "case-insensitive", offset: 50 },
|
|
195
|
+
ctx,
|
|
196
|
+
);
|
|
169
197
|
```
|
|
170
198
|
|
|
171
199
|
`read` result `metadata`:
|
|
@@ -236,13 +264,13 @@ Precise text replacement in an existing file via exact-then-fuzzy matching.
|
|
|
236
264
|
|
|
237
265
|
Each `edits[].oldText` must match a unique, non-overlapping region of the original file. Matching is exact first, then fuzzy (unicode normalization / whitespace collapse).
|
|
238
266
|
|
|
239
|
-
**Fuzzy silent-success tradeoff (loud):** when exact match fails, fuzzy may still apply a replacement **
|
|
267
|
+
**Fuzzy silent-success tradeoff (loud):** when exact match fails, fuzzy may still apply a replacement and is **reported** — both the confirmation text (`Successfully replaced N block(s) in {path} (fuzzy match).`) and `metadata.fuzzy: true`. That can edit the wrong region if `oldText` is slightly off (extra/missing whitespace, unicode lookalikes). Prefer exact `oldText` copied from a fresh `read`. On **no match**, the error lists up to 3 nearby lines (1-indexed, clipped to 120 chars) whose first-line substring matches the edit's first non-empty `oldText` line, so the model can correct its `oldText` (skipped when the needle is shorter than 4 chars or no line contains it). Duplicate / non-unique matches already **fail closed** and leave the file unchanged — ambiguity is not silently resolved by picking the first hit.
|
|
240
268
|
|
|
241
269
|
A BOM is stripped before matching and re-prepended on write; original line endings are restored. Defaults reject targets over 8 MiB, aggregate old/new UTF-8 input over 2 MiB, or more than 100 edits (hard caps: 64 MiB, 16 MiB, and 1,000). Stat and bounded read checks run before matching or mutation. Default local `writeFile` uses same-directory temp + `rename` (crash-safe replace).
|
|
242
270
|
|
|
243
|
-
**Outputs:** a `TextContent` confirmation (`Successfully replaced N block(s) in {path}
|
|
271
|
+
**Outputs:** a `TextContent` confirmation (`Successfully replaced N block(s) in {path}.`, with ` (fuzzy match)` appended when the replacement applied via fuzzy matching) plus `metadata`. Any failure — missing/unreadable file, no match (with nearby line context), duplicate (non-unique) match, overlap, empty `oldText`, no-op edit, or abort — is an error result, and the file is left **unchanged** (the match runs before the write).
|
|
244
272
|
|
|
245
|
-
`edit` result `metadata`: `{ diff, patch, firstChangedLine }` — a display-oriented diff, a standard unified patch,
|
|
273
|
+
`edit` result `metadata`: `{ path, diff, patch, firstChangedLine, fuzzy? }` — the absolute path written, a display-oriented diff, a standard unified patch, the first changed line in the new file, and `fuzzy: true` present only when the replacement applied via fuzzy (not exact) matching. These are host-readable; the model only sees the short confirmation (keeps model context small).
|
|
246
274
|
|
|
247
275
|
### `repo_list`
|
|
248
276
|
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Linux desktop control
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
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.
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
## When to use it
|
|
10
|
+
|
|
11
|
+
Use this package when a Linux host has installed and configured `computer-use-linux` and an agent must inspect or operate that host's desktop. Use the generic [Device adapters](device-adapters.md) contract when implementing another vendor adapter or when the host needs only admission and stream-bound primitives.
|
|
12
|
+
|
|
13
|
+
Do not use it as a desktop launcher, a cross-platform adapter, or a permission bypass. The host owns the binary, desktop session, sandbox, approval decision, and execution policy.
|
|
14
|
+
|
|
15
|
+
## Inputs / request
|
|
16
|
+
|
|
17
|
+
`createComputerUseLinuxTools(options)` accepts:
|
|
18
|
+
|
|
19
|
+
| Field | Type | Default | Purpose |
|
|
20
|
+
| --- | --- | --- | --- |
|
|
21
|
+
| `command` | `string` | `computer-use-linux` | Host-owned executable. |
|
|
22
|
+
| `args` | `readonly string[]` | `["mcp"]` | MCP server arguments. |
|
|
23
|
+
| `cwd`, `env`, `stderr` | stdio transport options | omitted | Host-owned process configuration. |
|
|
24
|
+
| `serverId` | `string` | `computer-use-linux` | Bridge/error metadata identifier. |
|
|
25
|
+
| `device` | `DeviceAdapter` | required | Must be enabled `desktop-control` with a sandbox. |
|
|
26
|
+
| `runLimits` | `RunLimits` | required | Shared run accounting required by device admission. |
|
|
27
|
+
| `executionPolicy` | `ExecutionPolicy` | omitted | High-risk mutator approval/policy seam. |
|
|
28
|
+
| `approved` | `boolean` | `false` | Host approval for mutating calls. |
|
|
29
|
+
| `includeSetupTools` | `boolean` | `false` | Explicitly expose host setup tools. |
|
|
30
|
+
| `redactor` | `SecretRedactor` | omitted | Redacts returned external data. |
|
|
31
|
+
| `platform` | `NodeJS.Platform` | `process.platform` | Test/host seam; production must be Linux. |
|
|
32
|
+
| `connect` | MCP bridge factory | `connectMcpTools` | Test seam; not needed in production. |
|
|
33
|
+
|
|
34
|
+
`loadComputerUseLinuxSkill()` takes no arguments and reads only the package-local skill file. The file is capped at 64 KiB.
|
|
35
|
+
|
|
36
|
+
## Outputs / response / events
|
|
37
|
+
|
|
38
|
+
| Export | Result |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `createComputerUseLinuxTools` | `{ tools, close }`; `tools` contains known upstream tools returned by the bridge. |
|
|
41
|
+
| `tools` | Read observations (`doctor`, app/window discovery, `get_app_state`, `screenshot`) plus mutators; setup tools are excluded by default. |
|
|
42
|
+
| `close()` | Closes the MCP bridge and its host-owned process transport. |
|
|
43
|
+
| `loadComputerUseLinuxSkill` | Prism `Skill` with name `computer-use-linux` and bounded instructions. |
|
|
44
|
+
| `COMPUTER_USE_LINUX_*` constants | Read, mutating, setup, known-name, and skill-name lists for host filtering and registration. |
|
|
45
|
+
| `MAX_SKILL_FILE_BYTES` | 64 KiB bundled-skill read ceiling. |
|
|
46
|
+
| Tool result | External data with `metadata.trust = "untrusted_external"`; screenshot/app-state oversize results become `dropped_oversize`. |
|
|
47
|
+
|
|
48
|
+
Mutating calls are serialized through one mutex and run `assertDeviceAdmit` plus `assertExecutionAllowed` before the remote MCP call. Read observations bypass per-call approval but still require an admitted device.
|
|
49
|
+
|
|
50
|
+
## Request/response example
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"command": "computer-use-linux",
|
|
55
|
+
"args": ["mcp"],
|
|
56
|
+
"device": {
|
|
57
|
+
"kind": "desktop-control",
|
|
58
|
+
"enabled": true,
|
|
59
|
+
"requireApproval": true,
|
|
60
|
+
"sandbox": "linux-desktop"
|
|
61
|
+
},
|
|
62
|
+
"runLimits": {
|
|
63
|
+
"maxTurns": 32,
|
|
64
|
+
"maxToolCalls": 200
|
|
65
|
+
},
|
|
66
|
+
"approved": false,
|
|
67
|
+
"includeSetupTools": false
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Implementation example
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { createToolRegistry, type Skill } from "@arnilo/prism";
|
|
75
|
+
import {
|
|
76
|
+
createComputerUseLinuxTools,
|
|
77
|
+
loadComputerUseLinuxSkill,
|
|
78
|
+
} from "@arnilo/prism-computer-use-linux";
|
|
79
|
+
|
|
80
|
+
async function installDesktop(hostSkills: { register(skill: Skill): void }, hostApproved: boolean) {
|
|
81
|
+
const desktop = await createComputerUseLinuxTools({
|
|
82
|
+
device: {
|
|
83
|
+
kind: "desktop-control",
|
|
84
|
+
enabled: true,
|
|
85
|
+
requireApproval: true,
|
|
86
|
+
sandbox: "linux-desktop",
|
|
87
|
+
},
|
|
88
|
+
runLimits: { maxTurns: 32, maxToolCalls: 200 },
|
|
89
|
+
approved: hostApproved,
|
|
90
|
+
});
|
|
91
|
+
const tools = createToolRegistry(desktop.tools);
|
|
92
|
+
hostSkills.register(loadComputerUseLinuxSkill());
|
|
93
|
+
|
|
94
|
+
// Keep `desktop` alive while the run can call `tools`; close it at run end.
|
|
95
|
+
return { tools, close: () => desktop.close() };
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Extension and configuration notes
|
|
100
|
+
|
|
101
|
+
- Install and configure the host binary separately: `npm install -g @agent-sh/computer-use-linux` or another host-managed installation. Prism has no runtime dependency on that binary and never downloads it.
|
|
102
|
+
- The factory exposes unprefixed upstream names. Unknown or future upstream names are omitted until Prism classifies them.
|
|
103
|
+
- `setup_accessibility` and `setup_window_targeting` are host-only and omitted unless `includeSetupTools: true` is explicitly selected. The bundled skill never instructs agent turns to perform setup.
|
|
104
|
+
- `connect` is an injectable bridge factory for fake MCP tests. The package's normal path uses `connectMcpTools` with stdio `{ command, args: ["mcp"] }`.
|
|
105
|
+
- `loadComputerUseLinuxSkill()` is inert beyond reading its packaged file; it does not discover peers, resolve paths, or connect to MCP.
|
|
106
|
+
|
|
107
|
+
## Security and performance notes
|
|
108
|
+
|
|
109
|
+
- Construction fails closed on non-Linux hosts and requires `DeviceAdapter.kind = "desktop-control"`, explicit `enabled: true`, a sandbox, and shared `RunLimits` before connecting.
|
|
110
|
+
- Mutators are high-risk external mutations: they require device admission, host approval when configured, and `ExecutionPolicy`; input calls are serialized to prevent concurrent desktop state changes.
|
|
111
|
+
- Observation results are untrusted external content and pass the optional host redactor. Screenshot/app-state payloads pass `acceptDeviceChunk`; oversize payloads are replaced with `dropped_oversize`, not forwarded.
|
|
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
|
+
- The host must keep credentials, desktop session state, binary paths, sandbox identity, and approval state outside model-controlled arguments.
|
|
114
|
+
|
|
115
|
+
## Related APIs
|
|
116
|
+
|
|
117
|
+
- [Device adapters](device-adapters.md): generic admission, shared limits, chunk bounds, and telemetry redaction contract.
|
|
118
|
+
- [MCP client bridge](mcp-tools.md): host-owned MCP transport and bounded tool mapping.
|
|
119
|
+
- [Tools](tools.md): registry and dispatch lifecycle for the returned `ToolDefinition`s.
|
|
120
|
+
- [Context and skills](context-and-skills.md): explicit skill registration, activation, and progressive disclosure.
|
|
121
|
+
- [Host security](host-security.md): trust, approval, sandbox, and untrusted external-content boundaries.
|
|
122
|
+
- [Upstream computer-use-linux](https://github.com/agent-sh/computer-use-linux): host binary and desktop prerequisites.
|
|
@@ -196,7 +196,7 @@ await agent.createSession().run("…", { activeSkills: ["ponytail"] });
|
|
|
196
196
|
// Turn 1: catalog only. After load_skill({ name: "ponytail" }), later turns include instructions.
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
-
### Third-party behavior packages (Caveman, Ponytail)
|
|
199
|
+
### Third-party behavior packages (Caveman, Ponytail, Impeccable)
|
|
200
200
|
|
|
201
201
|
`@arnilo/prism-caveman` and `@arnilo/prism-ponytail` register upstream skills into the extension kernel skill registry. Hosts should:
|
|
202
202
|
|
|
@@ -205,7 +205,7 @@ await agent.createSession().run("…", { activeSkills: ["ponytail"] });
|
|
|
205
205
|
3. Keep `skillsDisclosure: "progressive"` and register `createLoadSkillTool` — full `SKILL.md` bodies stay catalog-only until `load_skill`.
|
|
206
206
|
4. Select `instructionInjectors: ["caveman-mode", "ponytail-mode"]` (or subset) for mode/level slices **without** forcing `skillsDisclosure: "eager"`.
|
|
207
207
|
|
|
208
|
-
Mode slices and skill bodies are independent: the injector can add `PONYTAIL MODE ACTIVE` while `ponytail-audit` remains catalog-only until loaded. See [Caveman](caveman.md), [Ponytail](ponytail.md), and `examples/caveman-ponytail.ts`.
|
|
208
|
+
Mode slices and skill bodies are independent: the injector can add `PONYTAIL MODE ACTIVE` while `ponytail-audit` remains catalog-only until loaded. See [Caveman](caveman.md), [Ponytail](ponytail.md), [Impeccable](impeccable.md), and `examples/caveman-ponytail.ts`.
|
|
209
209
|
|
|
210
210
|
Pure validation without the tool: `resolveSkillLoad({ registry, name, tools, loaded, activeSkillNames })`.
|
|
211
211
|
|
|
@@ -234,7 +234,7 @@ const providers = createOpenAIProviderPackage({ apiKey });
|
|
|
234
234
|
- Use distinct `namespace` or vault paths per tenant/environment.
|
|
235
235
|
- Keychain `list()` / `listOAuth()` are intentionally unsupported — enumerate credentials through host configuration instead of scanning the OS store.
|
|
236
236
|
- Combine with `createExplicitCredentialResolver()` so runtime overrides still win over stored values.
|
|
237
|
-
- Wire `createOAuthCredentialStoreAdapter(store)` into `refreshOAuthCredential()` only for an OAuth flow explicitly selected by the host and authorized by that provider.
|
|
237
|
+
- Wire `createOAuthCredentialStoreAdapter(store)` into `refreshOAuthCredential()` only for an OAuth flow explicitly selected by the host and authorized by that provider. That means OpenAI Codex, xAI SuperGrok / X Premium, and the Microsoft 365 / Google Workspace workload providers (`createMicrosoft365OAuthProvider` / `createGoogleWorkspaceOAuthProvider`) with least-privilege read/mutation scope bundles. Anthropic and Google *model* packages still accept API keys only. Never import or migrate Claude Code/Gemini CLI/`~/.grok` credential files, setup tokens, browser sessions, or CLI OAuth rows into this store.
|
|
238
238
|
- Enterprise cloud providers (`azure` / `bedrock` / `vertex`) expect host workload-identity callbacks (Entra / IAM / ADC), not this local encrypted/keychain store as a cloud token minting service. Store may hold opaque refresh material only when the host already owns the cloud auth flow.
|
|
239
239
|
|
|
240
240
|
## Security and performance notes
|
|
@@ -106,7 +106,7 @@ console.log(error.message);
|
|
|
106
106
|
|
|
107
107
|
### Subscription OAuth eligibility
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
First-party subscription OAuth is explicit and host-invoked: OpenAI Codex (`createOpenAICodexOAuthProvider()`) and xAI SuperGrok / X Premium (`createXaiOAuthProvider()`). Hosts own login UI and may use `createOAuthCredentialStoreAdapter()` for deliberately selected durable storage. Do not import `~/.grok` or grok-cli auth files.
|
|
110
110
|
|
|
111
111
|
Anthropic and Google provider packages are API-key-only. Do not scrape or import Claude Code/Gemini CLI credential files, setup tokens, environment values, or browser sessions, and do not route a user's Claude.ai/Gemini subscription through Prism. Anthropic states that developers building products must use Claude Console API keys or a supported cloud provider and may not offer Claude.ai login or route Free/Pro/Max credentials ([legal and compliance](https://docs.anthropic.com/en/docs/claude-code/legal-and-compliance)). Gemini CLI states that third-party software using its OAuth to access backend services violates applicable terms; its FAQ names Vertex AI or Google AI Studio API keys as the supported third-party path ([terms](https://github.com/google-gemini/gemini-cli/blob/main/docs/resources/tos-privacy.md), [FAQ](https://github.com/google-gemini/gemini-cli/blob/main/docs/resources/faq.md)).
|
|
112
112
|
|
|
@@ -124,7 +124,7 @@ A future provider-local OAuth adapter needs published permission for third-party
|
|
|
124
124
|
- `resolveCredentialValue()` and `createExplicitCredentialResolver()` do not cache values. Add host-side caching only if a real credential source needs it.
|
|
125
125
|
- `refreshOAuthCredential()` only calls the supplied OAuth provider and optional store; it has no built-in persistence or retry loop.
|
|
126
126
|
- OpenAI Codex device-code OAuth polls inside `createOpenAICodexOAuthProvider().login()` with bounded delays and abort support via `OAuthLoginCallbacks.signal`. Token-endpoint failures redact authorization codes, PKCE verifiers, device/user codes, and access/refresh tokens when those values are known.
|
|
127
|
-
- The shared bounded device/token flow lives in core `pollDeviceCodeToken` (0.2.1) and is used by the OpenAI Codex provider and the credentials-node OAuth 2.0 provider (Microsoft 365 / Google Workspace). It owns the RFC 8628 device-code request and poll loop (`authorization_pending` continue, `slow_down` +5s backoff, expiry deadline, abort), reads every response body under the shared byte ceiling, parses success bodies with a fail-closed shape gate (an `access_token` string is required), and redacts device/user codes, authorization codes, PKCE verifiers, and tokens from every thrown error. Adapter-specific fields (message prefix, extra token params, account binding) are plain options, never subclasses.
|
|
127
|
+
- The shared bounded device/token flow lives in core `pollDeviceCodeToken` (0.2.1) and is used by the OpenAI Codex provider and the credentials-node OAuth 2.0 provider (Microsoft 365 / Google Workspace). It owns the RFC 8628 device-code request and poll loop (`authorization_pending` continue, `slow_down` +5s backoff, expiry deadline, abort), reads every response body under the shared byte ceiling, parses success bodies with a fail-closed shape gate (an `access_token` string is required), and redacts device/user codes, authorization codes, PKCE verifiers, and tokens from every thrown error. Adapter-specific fields (message prefix, extra token params, account binding) are plain options, never subclasses. Optional `bodyEncoding: "form"` POSTs `application/x-www-form-urlencoded` for both the device-code request and every token poll (default remains `json` so existing callers stay byte-compatible). `extraDeviceParams` merge into the device-code body only. `verification_uri` and optional `verification_uri_complete` must be `https:`; the complete URI is what `onDeviceCode` receives when present.
|
|
128
128
|
|
|
129
129
|
## Related APIs
|
|
130
130
|
|
package/docs/device-adapters.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What it does
|
|
4
4
|
|
|
5
|
-
Optional realtime voice and desktop OS / computer-control surface for Prism agents, shipped in 0.0.14 as a **contract + deny-by-default policy
|
|
5
|
+
Optional realtime voice and desktop OS / computer-control surface for Prism agents, shipped in 0.0.14 as a **contract + deny-by-default policy** in `@arnilo/prism` (`src/devices.ts`). The first vendor adapter, `@arnilo/prism-computer-use-linux`, wraps the host-owned `computer-use-linux` MCP binary without changing this generic contract. The contract composes over the existing `PermissionPolicy`, `RunLimits`, approval (`tool_approval`), and redactor seams; it adds no second approval runtime and no device framework.
|
|
6
6
|
|
|
7
7
|
## When to use it
|
|
8
8
|
|
|
@@ -79,7 +79,7 @@ if (chunk.accepted) emit(redactDeviceTelemetry(createSecretRedactor([token]), fr
|
|
|
79
79
|
|
|
80
80
|
- Frozen caps: audio/screenshot/stream chunk **1 MiB / 8 MiB**; concurrent device sessions per identity **1 / 4**. Device wall time / turns / tool calls consume the shared `RunLimits` (admission fails closed without run accounting).
|
|
81
81
|
- `enabled` resolves to `true` only on an explicit `true`; any other value is disabled. `requireApproval` stays `true` unless the host explicitly sets `false` (it should not).
|
|
82
|
-
-
|
|
82
|
+
- `@arnilo/prism-computer-use-linux` is the first vendor package. It remains optional, Linux-only, host-binary-owned, and outside umbrella profiles; this page stays generic so future voice or desktop vendors can satisfy the same contract via `runDevicePolicyConformance`.
|
|
83
83
|
|
|
84
84
|
## Security and performance notes
|
|
85
85
|
|
|
@@ -91,7 +91,8 @@ if (chunk.accepted) emit(redactDeviceTelemetry(createSecretRedactor([token]), fr
|
|
|
91
91
|
## Related APIs
|
|
92
92
|
|
|
93
93
|
- [Browser automation](browser-automation.md): verified-state checkpoints + reload/verify-before-side-effect for browser composition.
|
|
94
|
+
- [Linux desktop control](computer-use-linux.md): first-party host-owned `computer-use-linux` MCP wrapper using this contract.
|
|
94
95
|
- [Conversations](conversations.md): durable threads that own the runs device sessions bind to.
|
|
95
96
|
- [Host security](host-security.md): approval, sandbox, and egress trust boundaries device adapters compose over.
|
|
96
97
|
- [Performance and resource limits](performance.md): shared `RunLimits` accounting.
|
|
97
|
-
- [Migration](migration.md): 0.0.14 additive seams and 0.
|
|
98
|
+
- [Migration](migration.md): historical 0.0.14 additive seams and device-vendor deferral; the 0.3.0 desktop wrapper is additive and optional.
|
package/docs/extensions.md
CHANGED
|
@@ -142,6 +142,7 @@ await kernel.middleware.run("provider_request", { metadata: {} });
|
|
|
142
142
|
- [Observational memory compaction package](compaction-observational-memory.md): optional extension helper that registers an inert fast memory compaction strategy.
|
|
143
143
|
- [Caveman behavior integration](caveman.md): optional `@arnilo/prism-caveman` upstream Caveman skills, commands, level injector, and session `caveman-level` persistence.
|
|
144
144
|
- [Ponytail behavior integration](ponytail.md): optional `@arnilo/prism-ponytail` upstream Ponytail skills, commands, mode injector, and session `ponytail-mode` persistence.
|
|
145
|
+
- [Impeccable behavior integration](impeccable.md): optional `@arnilo/prism-impeccable` upstream Impeccable skill and `load_skill` command.
|
|
145
146
|
- [Public contracts](public-contracts.md): `Extension`, `ExtensionAPI`, and contribution contract types.
|
|
146
147
|
- [Credentials and redaction](credentials-and-redaction.md): secret-redaction behavior used for extension errors.
|
|
147
148
|
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Impeccable behavior integration
|
|
2
|
+
|
|
3
|
+
## What it does
|
|
4
|
+
|
|
5
|
+
`@arnilo/prism-impeccable` is an optional package that wires a host-supplied
|
|
6
|
+
[Impeccable](https://github.com/pbakaus/impeccable) `SKILL.md` into Prism skill
|
|
7
|
+
and command registries.
|
|
8
|
+
|
|
9
|
+
It registers one skill (`impeccable`) and one command (`impeccable`) that
|
|
10
|
+
dispatches `{ skill: "impeccable", dispatch: "load_skill" }`. Import and
|
|
11
|
+
`setup` without a readable `SKILL.md` fail closed with a bounded redacted
|
|
12
|
+
error and register zero contributions.
|
|
13
|
+
|
|
14
|
+
Prism does not vendor skill bodies, run the detector CLI, spawn a browser,
|
|
15
|
+
install hooks, or write `PRODUCT.md` / `DESIGN.md`.
|
|
16
|
+
|
|
17
|
+
## When to use it
|
|
18
|
+
|
|
19
|
+
Use it when a host has a compiled Impeccable checkout (or a linked skills dir)
|
|
20
|
+
and wants the design skill in a Prism extension kernel via progressive
|
|
21
|
+
`load_skill`.
|
|
22
|
+
|
|
23
|
+
Skip it when you only need the detector CLI (`npx impeccable`) or live browser
|
|
24
|
+
iteration — those stay host-owned.
|
|
25
|
+
|
|
26
|
+
## Inputs / request
|
|
27
|
+
|
|
28
|
+
`createImpeccableExtension(options)`:
|
|
29
|
+
|
|
30
|
+
| Field | Type | Required | Purpose |
|
|
31
|
+
| --- | --- | --- | --- |
|
|
32
|
+
| `upstreamPath` | `string` | yes | Path to a tree with `skills/impeccable/SKILL.md` or `SKILL.md` at the path (e.g. `dist/universal/impeccable`). |
|
|
33
|
+
|
|
34
|
+
No optional peer. npm `impeccable` is the detector CLI, not a skill tree.
|
|
35
|
+
|
|
36
|
+
## Outputs / response / events
|
|
37
|
+
|
|
38
|
+
| Export | Purpose |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `createImpeccableExtension(options)` | Inert `Extension` until `kernel.load([...])`. |
|
|
41
|
+
| `impeccable` skill | Parsed upstream `SKILL.md` (`name: impeccable`). |
|
|
42
|
+
| `impeccable` command | Dispatch `{ skill: "impeccable", dispatch: "load_skill" }`. |
|
|
43
|
+
|
|
44
|
+
No instruction injector. No session persistence. No 23 Prism-native craft/polish commands.
|
|
45
|
+
|
|
46
|
+
## Request/response example
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{ "command": "impeccable", "args": {}, "sessionId": "s1" }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{ "skill": "impeccable", "dispatch": "load_skill" }
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Implementation example
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { createImpeccableExtension } from "@arnilo/prism-impeccable";
|
|
60
|
+
import {
|
|
61
|
+
createExtensionKernel,
|
|
62
|
+
createLoadSkillTool,
|
|
63
|
+
createLoadedSkillSet,
|
|
64
|
+
createSkillRegistry,
|
|
65
|
+
} from "@arnilo/prism";
|
|
66
|
+
|
|
67
|
+
const kernel = createExtensionKernel({ errorPolicy: "throw" });
|
|
68
|
+
await kernel.load([
|
|
69
|
+
createImpeccableExtension({
|
|
70
|
+
upstreamPath: "/path/to/impeccable/dist/universal/impeccable",
|
|
71
|
+
}),
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
const registry = createSkillRegistry(kernel.registries.skills.list());
|
|
75
|
+
const loaded = createLoadedSkillSet();
|
|
76
|
+
const loadSkill = createLoadSkillTool({ registry, loaded });
|
|
77
|
+
await kernel.registries.commands.get("impeccable")!.execute({}, { sessionId: "s1" });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Keep `skillsDisclosure: "progressive"` so the full `SKILL.md` stays catalog-only until `load_skill`.
|
|
81
|
+
|
|
82
|
+
## Extension and configuration notes
|
|
83
|
+
|
|
84
|
+
- `sideEffects: false`. Import registers nothing.
|
|
85
|
+
- `kernel.load` resolves `SKILL.md` first; failure throws before any `register*`.
|
|
86
|
+
- Point `upstreamPath` at a compiled skill dir or a parent that contains `skills/impeccable/SKILL.md`.
|
|
87
|
+
- Do not invent per-command Prism wrappers for upstream `craft` / `polish` / `live`.
|
|
88
|
+
- Not in `@arnilo/prism-all` / `prism-code` / `prism-sdk`.
|
|
89
|
+
|
|
90
|
+
## Security and performance notes
|
|
91
|
+
|
|
92
|
+
- Upstream `SKILL.md` is untrusted host content; reads capped at `MAX_SKILL_FILE_BYTES` (256 KiB).
|
|
93
|
+
- Path escape rejected. Errors redact home and absolute paths.
|
|
94
|
+
- No `npx`, hook install, env scan, or network on import/setup.
|
|
95
|
+
- Setup is one bounded file read.
|
|
96
|
+
|
|
97
|
+
## Related APIs
|
|
98
|
+
|
|
99
|
+
- [Caveman behavior integration](caveman.md)
|
|
100
|
+
- [Ponytail behavior integration](ponytail.md)
|
|
101
|
+
- [Extension kernel and event bus](extensions.md)
|
|
102
|
+
- [Context and skills](context-and-skills.md)
|