@arnilo/prism-coding-agent 0.0.96 → 0.1.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 +139 -3
- package/README.md +48 -19
- package/dist/ask-user-decision.d.ts +160 -0
- package/dist/ask-user-decision.js +495 -0
- package/dist/atomic-write.d.ts +3 -0
- package/dist/atomic-write.js +24 -0
- package/dist/checks.js +5 -0
- package/dist/coding-checkpoint.js +6 -15
- package/dist/delete.d.ts +29 -0
- package/dist/delete.js +119 -0
- package/dist/edit-diff.js +1 -4
- package/dist/edit.d.ts +5 -1
- package/dist/edit.js +20 -9
- package/dist/effects.d.ts +33 -0
- package/dist/effects.js +89 -0
- package/dist/execution-policy.d.ts +8 -3
- package/dist/execution-policy.js +5 -2
- package/dist/file-mutation-queue.js +1 -2
- package/dist/forge/github.d.ts +2 -0
- package/dist/forge/github.js +554 -0
- package/dist/forge/index.d.ts +3 -0
- package/dist/forge/index.js +3 -0
- package/dist/forge/types.d.ts +150 -0
- package/dist/forge/types.js +19 -0
- package/dist/git-aware-repository.d.ts +25 -0
- package/dist/git-aware-repository.js +268 -0
- package/dist/git-exec.js +1 -1
- package/dist/git-tools.d.ts +4 -1
- package/dist/git-tools.js +15 -7
- package/dist/git.d.ts +3 -3
- package/dist/git.js +14 -14
- package/dist/glob-match.d.ts +6 -0
- package/dist/glob-match.js +81 -0
- package/dist/glob.d.ts +14 -0
- package/dist/glob.js +147 -0
- package/dist/goal-verify.d.ts +66 -0
- package/dist/goal-verify.js +280 -0
- package/dist/index.d.ts +63 -30
- package/dist/index.js +40 -16
- package/dist/language/client.d.ts +44 -0
- package/dist/language/client.js +290 -0
- package/dist/language/framing.d.ts +23 -0
- package/dist/language/framing.js +112 -0
- package/dist/language/index.d.ts +4 -0
- package/dist/language/index.js +4 -0
- package/dist/language/intelligence.d.ts +10 -0
- package/dist/language/intelligence.js +526 -0
- package/dist/language/types.d.ts +106 -0
- package/dist/language/types.js +21 -0
- package/dist/lifecycle.d.ts +75 -0
- package/dist/lifecycle.js +102 -0
- package/dist/limits.d.ts +41 -0
- package/dist/limits.js +41 -0
- package/dist/list.js +6 -10
- package/dist/move.d.ts +24 -0
- package/dist/move.js +150 -0
- package/dist/mutation-path.d.ts +7 -0
- package/dist/mutation-path.js +51 -0
- package/dist/output-accumulator.d.ts +8 -0
- package/dist/output-accumulator.js +45 -1
- package/dist/path-utils.js +1 -1
- package/dist/process/index.d.ts +3 -0
- package/dist/process/index.js +3 -0
- package/dist/process/sessions.d.ts +2 -0
- package/dist/process/sessions.js +592 -0
- package/dist/process/types.d.ts +146 -0
- package/dist/process/types.js +19 -0
- package/dist/read-path-set.d.ts +14 -0
- package/dist/read-path-set.js +26 -0
- package/dist/read.d.ts +3 -0
- package/dist/read.js +11 -17
- package/dist/repository.d.ts +54 -3
- package/dist/repository.js +144 -38
- package/dist/search.d.ts +1 -1
- package/dist/search.js +91 -27
- package/dist/shell.d.ts +3 -0
- package/dist/shell.js +23 -8
- package/dist/truncate.js +1 -1
- package/dist/write.d.ts +5 -1
- package/dist/write.js +19 -6
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,149 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2026-08-09
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Released with exact 0.1.0 graph.
|
|
7
|
+
|
|
8
|
+
## [0.0.28] - 2026-08-08
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Released with exact 0.0.28 graph.
|
|
12
|
+
|
|
13
|
+
## [0.0.27] - 2026-08-07
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- `createCodingLifecycleEmitter(options?)` — consumer-gated coding lifecycle events (Phase 10): ships `process_*` (reuses `CodingProcessEvent`) plus `file_changed`, `worktree_changed`, `permission_denied`, `configuration_changed`; synchronous bounded `emit`/`on`; drops unknown/oversized events without breaking producer paths; invalid limits fail closed with `CodingLifecycleError` (`ERR_PRISM_LIFECYCLE_LIMIT`); frozen `DEFAULT_LIFECYCLE_MAX_*` / `HARD_LIFECYCLE_MAX_*` caps.
|
|
17
|
+
- `onEvent` option on `createWriteTool` / `createEditTool` / `createMoveTool` / `createDeleteTool` / `createGitWorktreeTool` — tools emit `file_changed` (write/edit/move/delete) and `worktree_changed` (add/remove) after successful mutation, and `permission_denied` via the shared `enforceExecutionPolicy` deny hook (never raw tool arguments).
|
|
18
|
+
- `enforceExecutionPolicy(..., onDenied?)` — optional callback invoked once per policy denial (additive; existing callers unaffected).
|
|
19
|
+
|
|
20
|
+
## [0.0.26] - 2026-08-06
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- `createGitHubForge(options)` — reference GitHub adapter: issue context, authenticated push (`GIT_CONFIG_*` credential injection, never argv), PR create/update, review comments, checks/status, bounded `reconcileHandoff`; every mutation gated by `ExecutionPolicy` and recorded in `ToolEffectStore` (retry never duplicates PRs/comments); typed `ERR_PRISM_FORGE_*` codes; frozen `DEFAULT_MAX_FORGE_*` / `HARD_MAX_FORGE_*` caps; no octokit dependency.
|
|
24
|
+
- `createGitAwareRepositoryOperations(cwd, options?)` — ignore-aware enumeration via fixed `git ls-files` with native walker fallback; host-only `includeIgnored`; `DEFAULT_MAX_LS_FILES_OUTPUT_BYTES` / `HARD_MAX_LS_FILES_OUTPUT_BYTES`.
|
|
25
|
+
- `createLanguageIntelligence(options)` — host-selected LSP 3.17 client (Content-Length framing); symbols/definitions/references/diagnostics/hover/rename; lazy spawn; `ERR_PRISM_LSP_*`; frozen `DEFAULT_MAX_LSP_*` / `HARD_MAX_LSP_*` caps.
|
|
26
|
+
- `createProcessSessions(options)` — managed process sessions (start/output/input/wait/signal/kill/release); optional sandbox `startProcess` backend + `reconcile`/sandbox-loss → `unknown`; ownership/identity + expiry sweep; `CodingProcessEvent`; `ERR_PRISM_PROCESS_*`; frozen `DEFAULT_MAX_PROCESS_*` / `HARD_MAX_PROCESS_*` caps; `OutputAccumulator.readRaw` for cursor paging.
|
|
27
|
+
- `CreateGitHubForgeOptions.fetch?` — host-injectable fetch (defaults to `globalThis.fetch`); enables routing forge traffic through an egress proxy and mock-fetch tests.
|
|
28
|
+
|
|
29
|
+
## [0.0.25] - 2026-08-06
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
- `ask_user_decision` durable elicitation hook maps onto shared pending decisions (blocking `ask()` unchanged for process-local path).
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- Released with exact 0.0.25 graph.
|
|
36
|
+
|
|
37
|
+
See [migration guide](../../docs/migration.md) for the 0.0.24 → 0.0.25 notes.
|
|
38
|
+
|
|
39
|
+
## [0.0.24] - 2026-08-04
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- Durable `AgentEventSource` (memory + PostgreSQL LISTEN/NOTIFY), recoverable `ToolEffectStore`, and AG-UI MCP/MCP Apps/A2A fronting for Phase 7.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- Publishable graph remains **47** manifests at **0.0.24**; peers and lockfile move together.
|
|
46
|
+
|
|
47
|
+
See [migration guide](../../docs/migration.md) for the 0.0.23 → 0.0.24 notes.
|
|
48
|
+
|
|
49
|
+
## [0.0.23] - 2026-08-03
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
- Released with exact 0.0.23 graph.
|
|
53
|
+
|
|
54
|
+
## [0.0.22] - 2026-07-31
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
- Released with exact 0.0.22 graph.
|
|
58
|
+
|
|
59
|
+
## [0.0.21] - 2026-07-31
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
- `repo_search` `outputMode` (`content` | `files_with_matches` | `count`).
|
|
63
|
+
- Bounded `glob` tool (`*`/`?`/`**`; no brace expansion).
|
|
64
|
+
- Optional session-scoped `requireReadBeforeWrite` + `ReadPathSet` + `force` on write/edit.
|
|
65
|
+
- Bounded `delete` (file or empty dir) and `move` tools with dual-path mutation queue.
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
- `createCodingTools` returns 9 tools; `createReadOnlyTools` returns 4 (includes `glob`).
|
|
69
|
+
|
|
70
|
+
## [0.0.20] - 2026-07-31
|
|
71
|
+
|
|
72
|
+
### Changed
|
|
73
|
+
- Released with exact 0.0.20 graph.
|
|
74
|
+
|
|
75
|
+
## [0.0.19] - 2026-07-30
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
- Released with exact 0.0.19 graph.
|
|
79
|
+
|
|
80
|
+
## [0.0.18] - 2026-07-30
|
|
81
|
+
|
|
82
|
+
### Changed
|
|
83
|
+
- `repo_search` is literal-only: `mode: "regex"` removed from the tool schema; `compileSearchPattern` no longer compiles `RegExp` (ReDoS mitigation).
|
|
84
|
+
- Default `write`/`edit` local `writeFile` uses same-directory temp + `rename` for crash-safe replacement.
|
|
85
|
+
|
|
86
|
+
## [0.0.17] - 2026-07-29
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
- `ShellToolOptions.envAllowlist` restricts the environment the spawn hook and child process see (secret scrubbing without re-implementing the hook).
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
- Released with exact 0.0.17 graph.
|
|
93
|
+
|
|
94
|
+
## [0.0.16] - 2026-07-26
|
|
95
|
+
|
|
96
|
+
### Changed
|
|
97
|
+
- Released with exact 0.0.16 graph.
|
|
98
|
+
|
|
99
|
+
## [0.0.15] - 2026-07-26
|
|
100
|
+
|
|
101
|
+
## [0.0.14] - 2026-07-26
|
|
102
|
+
|
|
103
|
+
### Changed
|
|
104
|
+
|
|
105
|
+
- Released with exact 0.0.14 graph.
|
|
106
|
+
|
|
107
|
+
## [0.0.13] - 2026-07-24
|
|
108
|
+
|
|
109
|
+
### Changed
|
|
110
|
+
|
|
111
|
+
- Released with exact 0.0.13 graph.
|
|
112
|
+
|
|
113
|
+
## [0.0.12] - 2026-07-22
|
|
114
|
+
|
|
115
|
+
### Changed
|
|
116
|
+
|
|
117
|
+
- Released with exact 0.0.12 graph.
|
|
118
|
+
|
|
119
|
+
## [0.0.11] - 2026-07-22
|
|
120
|
+
|
|
121
|
+
### Docs
|
|
122
|
+
|
|
123
|
+
- Documented ask_user_decision multi/free-text/suspend glue + `runCodingGoalVerify` in `docs/coding-agent-tools.md` / README.
|
|
124
|
+
|
|
125
|
+
### Added
|
|
126
|
+
|
|
127
|
+
- `runCodingGoalVerify` / `createCodingGoalVerifyWorkflow`: thin goal→verify composition over plan Markdown, named checks, workflow suspend/approve, and bounded PR handoff (peer `@arnilo/prism-workflows`). No Goal table / second runtime.
|
|
128
|
+
- Opt-in `createAskUserDecisionTool({ ask })`: model proposes 2+ options with exactly 3 pros + 3 cons each; host `ask` returns `selectedId` / `selectedIds` / `customText`. Supports `selectionMode: "single" | "multiple"` and `allowCustom` (custom XOR selection; default/hard custom bytes match question caps). Not in `createCodingTools` / `createAllTools` / `createReadOnlyTools`.
|
|
129
|
+
- Durable ask-user helpers: `suspendAskUserDecision`, `createAskUserDecisionResumeValidator`, `validateAskUserDecisionResume`, `validateAskUserDecisionAgentResume` (workflow-first; agent path reuses same validator without new `AgentRunInterruption` kinds).
|
|
130
|
+
|
|
131
|
+
## [0.0.10] - 2026-07-21
|
|
132
|
+
|
|
133
|
+
### Changed
|
|
134
|
+
|
|
135
|
+
- Released with exact 0.0.10 graph.
|
|
136
|
+
|
|
137
|
+
### Notes
|
|
138
|
+
|
|
139
|
+
- Sandbox composition / workspace-mode contract lives in `@arnilo/prism-coding-security` (required `workspaceMode`, same-tree Git via `createGitTools(composition.workspaceRoot, { execFile })`). Coding-agent tool surfaces unchanged for 0.0.10.
|
|
140
|
+
|
|
2
141
|
## [0.0.96] - 2026-07-21
|
|
3
142
|
|
|
4
143
|
### Changed
|
|
5
144
|
|
|
6
145
|
- Released with exact 0.0.96 graph.
|
|
7
146
|
|
|
8
|
-
|
|
9
147
|
## [0.0.9] - 2026-07-21
|
|
10
148
|
|
|
11
149
|
- Added bounded native `repo_list` / `repo_search` tools with streaming walks, literal/regex search, finite depth/entry/match/scan/time caps, and pluggable `RepositoryOperations`.
|
|
@@ -18,7 +156,6 @@
|
|
|
18
156
|
|
|
19
157
|
- Released with the exact 0.0.8 first-party package graph.
|
|
20
158
|
|
|
21
|
-
|
|
22
159
|
## [0.0.7] - 2026-07-19
|
|
23
160
|
|
|
24
161
|
- Released with the exact 0.0.7 first-party package graph.
|
|
@@ -42,7 +179,6 @@
|
|
|
42
179
|
|
|
43
180
|
- Pinned the required `@arnilo/prism` peer and package metadata to 0.0.5; runtime behavior is unchanged.
|
|
44
181
|
|
|
45
|
-
|
|
46
182
|
## [0.0.4] - 2026-07-14
|
|
47
183
|
|
|
48
184
|
### Added
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @arnilo/prism-coding-agent
|
|
2
2
|
|
|
3
|
-
Optional first-party coding tools package for [Prism](https://www.npmjs.com/package/@arnilo/prism). Provides host shell/filesystem/repository tools — `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search` — plus opt-in structured Git/check tools via `createGitTools()` and durable plan/checkpoint helpers for workflow composition — as Prism `ToolDefinition` objects. **Inert until a host imports it and registers the tools into a `ToolRegistry`.**
|
|
3
|
+
Optional first-party coding tools package for [Prism](https://www.npmjs.com/package/@arnilo/prism). Provides host shell/filesystem/repository tools — `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`, `glob`, `delete`, `move` — plus opt-in structured Git/check tools via `createGitTools()`, opt-in `createAskUserDecisionTool({ ask })` (durable runs surface as shared elicitation decisions), and durable plan/checkpoint helpers for workflow composition — as Prism `ToolDefinition` objects. **Inert until a host imports it and registers the tools into a `ToolRegistry`.** No tool is auto-registered; hosts pick factories (or filter aggregator output) and may mix in their own `ToolDefinition`s.
|
|
4
4
|
|
|
5
|
-
Behavior is a behavioral port of the pi coding agent's `bash`/`read`/`write`/`edit` tools, adapted to Prism's `ToolDefinition` / `ToolResult` contracts (no `@earendil-works/*` or `typebox` dependencies). List/search/Git are native Prism tools.
|
|
5
|
+
Behavior is a behavioral port of the pi coding agent's `bash`/`read`/`write`/`edit` tools, adapted to Prism's `ToolDefinition` / `ToolResult` contracts (no `@earendil-works/*` or `typebox` dependencies). List/search/glob/Git are native Prism tools (hand-rolled glob; no picomatch/ripgrep).
|
|
6
6
|
|
|
7
|
-
> ⚠️ **These tools perform real shell and filesystem operations on the host. They provide no sandbox.** Gate them with Prism `PermissionPolicy` / `ToolValidator` / trust policies before registering them for any provider turn. See the [coding agent tools docs](https://github.com/ashiqrniloy/prism/blob/main/docs/coding-agent-tools.md) and the [host security guide](https://github.com/ashiqrniloy/prism/blob/main/docs/host-security.md).
|
|
7
|
+
> ⚠️ **These tools perform real shell and filesystem operations on the host. They provide no sandbox.** Gate them with Prism `PermissionPolicy` / `ToolValidator` / trust policies before registering them for any provider turn. For disposable sandbox composition with required `workspaceMode`, use `@arnilo/prism-coding-security` (`createSandboxCodingComposition`). See the [coding agent tools docs](https://github.com/ashiqrniloy/prism/blob/main/docs/coding-agent-tools.md) and the [host security guide](https://github.com/ashiqrniloy/prism/blob/main/docs/host-security.md).
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -12,11 +12,11 @@ Behavior is a behavioral port of the pi coding agent's `bash`/`read`/`write`/`ed
|
|
|
12
12
|
npm install @arnilo/prism-coding-agent
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
`@arnilo/prism` is a peer dependency.
|
|
15
|
+
`@arnilo/prism` is a peer dependency. `runCodingGoalVerify` also peers `@arnilo/prism-workflows`.
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
-
Register the full coding set:
|
|
19
|
+
Register the full coding set (nine tools):
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
22
|
import { createToolRegistry } from "@arnilo/prism";
|
|
@@ -25,7 +25,7 @@ import { createCodingTools } from "@arnilo/prism-coding-agent";
|
|
|
25
25
|
const tools = createToolRegistry(createCodingTools(process.cwd()));
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Read-only subset (inspection-only agents):
|
|
28
|
+
Read-only subset (inspection-only agents — includes `glob`):
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
31
|
import { createReadOnlyTools } from "@arnilo/prism-coding-agent";
|
|
@@ -38,7 +38,14 @@ Shared `ToolsOptions.executionPolicy` applies to every tool returned by full, al
|
|
|
38
38
|
Individual tools with options:
|
|
39
39
|
|
|
40
40
|
```ts
|
|
41
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
createShellTool,
|
|
43
|
+
createWriteTool,
|
|
44
|
+
createAskUserDecisionTool,
|
|
45
|
+
createReadPathSet,
|
|
46
|
+
createReadTool,
|
|
47
|
+
createEditTool,
|
|
48
|
+
} from "@arnilo/prism-coding-agent";
|
|
42
49
|
|
|
43
50
|
const shell = createShellTool(process.cwd(), {
|
|
44
51
|
shellPath: "/bin/bash", // force bash; default: SHELL env → /bin/bash → sh
|
|
@@ -54,19 +61,37 @@ const remoteWrite = createWriteTool(process.cwd(), {
|
|
|
54
61
|
mkdir: async (dir) => { /* mkdir -p remotely */ },
|
|
55
62
|
},
|
|
56
63
|
});
|
|
64
|
+
|
|
65
|
+
// Optional soft guard: share one ReadPathSet across read/write/edit.
|
|
66
|
+
const readPaths = createReadPathSet();
|
|
67
|
+
const read = createReadTool(process.cwd(), { readPathSet: readPaths });
|
|
68
|
+
const write = createWriteTool(process.cwd(), { requireReadBeforeWrite: true, readPathSet: readPaths });
|
|
69
|
+
const edit = createEditTool(process.cwd(), { requireReadBeforeWrite: true, readPathSet: readPaths });
|
|
70
|
+
|
|
71
|
+
// Opt-in: not in createCodingTools(). Host owns the UI.
|
|
72
|
+
const askUser = createAskUserDecisionTool({
|
|
73
|
+
ask: async ({ question, options }) => {
|
|
74
|
+
const selectedId = await host.promptChoice(question, options);
|
|
75
|
+
return { selectedId };
|
|
76
|
+
},
|
|
77
|
+
});
|
|
57
78
|
```
|
|
58
79
|
|
|
59
80
|
## Tools
|
|
60
81
|
|
|
61
82
|
| Tool | Input | Result |
|
|
62
83
|
| --- | --- | --- |
|
|
63
|
-
| `shell` | `{ command, timeout? }` | Combined output + `metadata.exitCode`; 600-second default timeout and 64 MiB total-output cap. Non-zero exit is **not** an error. |
|
|
64
|
-
| `read` | `{ path, offset?, limit? }` | Streamed bounded text page or bounded `[note, ImageContent]`. |
|
|
65
|
-
| `write` | `{ path, content }` |
|
|
66
|
-
| `edit` | `{ path, edits: [{oldText,newText}] }` |
|
|
67
|
-
| `repo_list` | `{ path?, includeHidden?, maxDepth?, maxResults?, offset? }` | Deterministic relative entries;
|
|
68
|
-
| `repo_search` | `{ query, path?, mode?, caseSensitive?, includeHidden?, context?, maxMatches? }` | Literal
|
|
69
|
-
| `
|
|
84
|
+
| `shell` | `{ command, timeout? }` | Combined output + `metadata.exitCode`; 600-second default timeout and 64 MiB total-output cap. Non-zero exit is **not** an error. Prefer dedicated tools when they fit. |
|
|
85
|
+
| `read` | `{ path, offset?, limit? }` | Streamed bounded text page or bounded `[note, ImageContent]`. Continue with suggested offset when truncated. |
|
|
86
|
+
| `write` | `{ path, content, force? }` | Full overwrite; bounded UTF-8 input; optional read-before-write. |
|
|
87
|
+
| `edit` | `{ path, edits: [{oldText,newText}], force? }` | Exact-then-fuzzy replace; **fuzzy may succeed silently** — prefer exact `oldText`; duplicates fail closed. |
|
|
88
|
+
| `repo_list` | `{ path?, includeHidden?, maxDepth?, maxResults?, offset? }` | Deterministic relative entries; paginates with `nextOffset`. Prefer `glob` for patterns. |
|
|
89
|
+
| `repo_search` | `{ query, path?, mode?, caseSensitive?, includeHidden?, context?, maxMatches?, outputMode? }` | Literal search; `outputMode`: `content` \| `files_with_matches` \| `count`. |
|
|
90
|
+
| `glob` | `{ pattern, path?, includeHidden?, maxDepth?, maxResults?, offset? }` | Filename match (`*`/`?`/`**`; no braces). Files only. |
|
|
91
|
+
| `delete` | `{ path }` | High-risk: file or empty dir only; **no trash**. |
|
|
92
|
+
| `move` | `{ from, to, overwrite? }` | High-risk rename/move; `overwrite` default false; **no trash**. |
|
|
93
|
+
| `git_*` / `coding_check` | via `createGitTools(cwd, { commitIdentity, checks? })` | Opt-in structured Git + named checks. Not in `createCodingTools()`. |
|
|
94
|
+
| `ask_user_decision` | via `createAskUserDecisionTool({ ask })` | Opt-in user choice. Not in default aggregators. |
|
|
70
95
|
|
|
71
96
|
### pi name mapping
|
|
72
97
|
|
|
@@ -74,19 +99,23 @@ const remoteWrite = createWriteTool(process.cwd(), {
|
|
|
74
99
|
| --- | --- |
|
|
75
100
|
| `shell` | `bash` |
|
|
76
101
|
| `read` / `write` / `edit` | `read` / `write` / `edit` |
|
|
77
|
-
| `repo_list` / `repo_search` | _(native; no pi equivalent shipped)_ |
|
|
102
|
+
| `repo_list` / `repo_search` / `glob` / `delete` / `move` | _(native; no pi equivalent shipped)_ |
|
|
103
|
+
|
|
104
|
+
### Phase 4 non-goals
|
|
105
|
+
|
|
106
|
+
No PDF reader, trash daemon, or PTY in 0.0.21. Phase 9 optionals: `createLanguageIntelligence`, `createProcessSessions`, `createGitHubForge`. See [coding agent tools docs](https://github.com/ashiqrniloy/prism/blob/main/docs/coding-agent-tools.md), [language intelligence](https://github.com/ashiqrniloy/prism/blob/main/docs/language-intelligence.md), [process sessions](https://github.com/ashiqrniloy/prism/blob/main/docs/process-sessions.md), and [forge integration](https://github.com/ashiqrniloy/prism/blob/main/docs/forge-integration.md).
|
|
78
107
|
|
|
79
108
|
## Exports
|
|
80
109
|
|
|
81
|
-
Factories: `createShellTool`, `createReadTool`, `createWriteTool`, `createEditTool`, `createRepoListTool`, `createRepoSearchTool`, `createCodingTools`, `createReadOnlyTools`, `createAllTools`, `createGitTools`, `createCodingCheckTool`, `createLocalBashOperations`, `createLocalRepositoryOperations`, `createGitOperations`.
|
|
110
|
+
Factories: `createShellTool`, `createReadTool`, `createWriteTool`, `createEditTool`, `createRepoListTool`, `createRepoSearchTool`, `createGlobTool`, `createDeleteTool`, `createMoveTool`, `createCodingTools`, `createReadOnlyTools`, `createAllTools`, `createGitTools`, `createCodingCheckTool`, `createAskUserDecisionTool`, `createLocalBashOperations`, `createLocalRepositoryOperations`, `createGitAwareRepositoryOperations`, `createLanguageIntelligence`, `createProcessSessions`, `createGitHubForge`, `createGitOperations`, `createReadPathSet`.
|
|
82
111
|
|
|
83
|
-
Helpers: `detectSupportedImageMimeType`, `detectSupportedImageMimeTypeFromFile`, `getShellConfig`, `killProcessTree`, `waitForChildProcess`, `withFileMutationQueue`, `resolveRepositoryLimits`, `writeCodingPlanFile`, `readCodingPlanFile`, `buildCodingCheckpointMetadata`, `validateCodingCheckpointMetadata`, `assertCodingResumeAllowed`, `fingerprintJson`. Default/hard coding, repository, Git, and plan/checkpoint limit constants are exported for host configuration.
|
|
112
|
+
Helpers: `detectSupportedImageMimeType`, `detectSupportedImageMimeTypeFromFile`, `getShellConfig`, `killProcessTree`, `waitForChildProcess`, `withFileMutationQueue`, `resolveRepositoryLimits`, `matchGlobPattern`, `validateGlobPattern`, `writeCodingPlanFile`, `readCodingPlanFile`, `buildCodingCheckpointMetadata`, `validateCodingCheckpointMetadata`, `assertCodingResumeAllowed`, `fingerprintJson`, `runCodingGoalVerify`, `createCodingGoalVerifyWorkflow`, `suspendAskUserDecision`, `createAskUserDecisionResumeValidator`, `validateAskUserDecisionResume`, `validateAskUserDecisionAgentResume`. Default/hard coding, repository, Git, and plan/checkpoint limit constants are exported for host configuration.
|
|
84
113
|
|
|
85
|
-
Option/operation types: `ToolsOptions`, `ShellToolOptions`/`BashOperations`, `ReadToolOptions`/`ReadOperations`/`ReadTextOptions`/`ReadTextResult`, `WriteToolOptions`/`WriteOperations`, `EditToolOptions`/`EditOperations`/`EditToolDetails`.
|
|
114
|
+
Option/operation types: `ToolsOptions`, `ShellToolOptions`/`BashOperations`, `ReadToolOptions`/`ReadOperations`/`ReadTextOptions`/`ReadTextResult`, `WriteToolOptions`/`WriteOperations`, `EditToolOptions`/`EditOperations`/`EditToolDetails`, `DeleteToolOptions`/`DeleteOperations`, `MoveToolOptions`/`MoveOperations`, `GlobToolOptions`, `ReadPathSet`.
|
|
86
115
|
|
|
87
116
|
Text reads stop after one page or `maxScanBytes` instead of loading the file. Custom `ReadOperations` must implement bounded `readText` and `statFile`; custom `EditOperations` must implement `statFile` and honor the supplied read cap/signal. Successful truncated shell output is retained in an exclusive Unix `0600` temp file owned by the host; timeout, abort, output-limit, and spill failures remove unpublished spill files. Hosts should delete published `metadata.fullOutputPath` files after use.
|
|
88
117
|
|
|
89
|
-
Network-free adversarial evaluation fixtures live in `src/__tests__/eval-fixtures.test.ts` and reuse `@arnilo/prism-evals` for CI thresholds. See `examples/coding-browser-evaluation.ts` and `docs/evaluations.md`.
|
|
118
|
+
Network-free adversarial evaluation fixtures live in `src/__tests__/eval-fixtures.test.ts` and reuse `@arnilo/prism-evals` for CI thresholds. See `examples/coding-browser-evaluation.ts`, `examples/coding-tools-capability-gaps.ts`, and `docs/evaluations.md`.
|
|
90
119
|
|
|
91
120
|
## License
|
|
92
121
|
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opt-in `ask_user_decision` tool: model proposes choices with pros/cons;
|
|
3
|
+
* host-injected `ask` blocks until the user picks one or more option ids.
|
|
4
|
+
*
|
|
5
|
+
* Durable path (opt-in): `suspendAskUserDecision` / `validateAskUserDecisionResume`
|
|
6
|
+
* compose `@arnilo/prism-workflows` suspend/resume — no Goal DB, no second store.
|
|
7
|
+
* Blocking `ask()` remains the default. Agent durable interruption kinds are
|
|
8
|
+
* unchanged; hosts reuse the same resume validator against host-held request data.
|
|
9
|
+
*
|
|
10
|
+
* Not included in `createCodingTools` / `createAllTools` / `createReadOnlyTools`.
|
|
11
|
+
*/
|
|
12
|
+
import type { ExecutionPolicy, JsonObject, ToolDefinition } from "@arnilo/prism";
|
|
13
|
+
import { type WorkflowResumeValidator, type WorkflowSuspension } from "@arnilo/prism-workflows";
|
|
14
|
+
export declare const ASK_USER_DECISION_TOOL_NAME: "ask_user_decision";
|
|
15
|
+
export declare const ASK_USER_DECISION_SUSPEND_REASON: "ask_user_decision";
|
|
16
|
+
/** Exactly three rationale bullets per side. */
|
|
17
|
+
export declare const ASK_USER_DECISION_RATIONALE_COUNT: 3;
|
|
18
|
+
export declare const DEFAULT_MAX_ASK_USER_DECISION_OPTIONS = 6;
|
|
19
|
+
export declare const HARD_MAX_ASK_USER_DECISION_OPTIONS = 16;
|
|
20
|
+
export declare const DEFAULT_MAX_ASK_USER_DECISION_QUESTION_BYTES = 2048;
|
|
21
|
+
export declare const HARD_MAX_ASK_USER_DECISION_QUESTION_BYTES = 8192;
|
|
22
|
+
export declare const DEFAULT_MAX_ASK_USER_DECISION_LABEL_BYTES = 512;
|
|
23
|
+
export declare const HARD_MAX_ASK_USER_DECISION_LABEL_BYTES = 2048;
|
|
24
|
+
export declare const DEFAULT_MAX_ASK_USER_DECISION_BULLET_BYTES = 512;
|
|
25
|
+
export declare const HARD_MAX_ASK_USER_DECISION_BULLET_BYTES = 2048;
|
|
26
|
+
/** Same ceiling as question text — free-text answers stay short. */
|
|
27
|
+
export declare const DEFAULT_MAX_ASK_USER_DECISION_CUSTOM_BYTES = 2048;
|
|
28
|
+
export declare const HARD_MAX_ASK_USER_DECISION_CUSTOM_BYTES = 8192;
|
|
29
|
+
export type AskUserDecisionSelectionMode = "single" | "multiple";
|
|
30
|
+
export interface AskUserDecisionOption {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
readonly label: string;
|
|
33
|
+
readonly pros: readonly [string, string, string];
|
|
34
|
+
readonly cons: readonly [string, string, string];
|
|
35
|
+
}
|
|
36
|
+
export interface AskUserDecisionRequest {
|
|
37
|
+
readonly question: string;
|
|
38
|
+
readonly options: readonly AskUserDecisionOption[];
|
|
39
|
+
readonly selectionMode: AskUserDecisionSelectionMode;
|
|
40
|
+
readonly allowCustom: boolean;
|
|
41
|
+
readonly toolCallId: string;
|
|
42
|
+
readonly sessionId?: string;
|
|
43
|
+
readonly runId?: string;
|
|
44
|
+
readonly signal?: AbortSignal;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Host answer shapes. Custom text is XOR with selection (v1): never both.
|
|
48
|
+
* `allowCustom` must be true for `{ customText }`.
|
|
49
|
+
*/
|
|
50
|
+
export type AskUserDecisionAnswer = {
|
|
51
|
+
readonly selectedId: string;
|
|
52
|
+
readonly selectedIds?: never;
|
|
53
|
+
readonly customText?: never;
|
|
54
|
+
} | {
|
|
55
|
+
readonly selectedIds: readonly string[];
|
|
56
|
+
readonly selectedId?: never;
|
|
57
|
+
readonly customText?: never;
|
|
58
|
+
} | {
|
|
59
|
+
readonly selectedId: string;
|
|
60
|
+
readonly selectedIds: readonly string[];
|
|
61
|
+
readonly customText?: never;
|
|
62
|
+
} | {
|
|
63
|
+
readonly customText: string;
|
|
64
|
+
readonly selectedId?: never;
|
|
65
|
+
readonly selectedIds?: never;
|
|
66
|
+
};
|
|
67
|
+
export type ResolvedAskUserDecisionAnswer = {
|
|
68
|
+
readonly kind: "selection";
|
|
69
|
+
readonly selectedId: string;
|
|
70
|
+
readonly selectedIds: readonly string[];
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "custom";
|
|
73
|
+
readonly customText: string;
|
|
74
|
+
};
|
|
75
|
+
export type AskUserDecisionHandler = (request: AskUserDecisionRequest) => Promise<AskUserDecisionAnswer>;
|
|
76
|
+
export interface AskUserDecisionToolOptions {
|
|
77
|
+
/** Required host UI/callback — tool fails closed without it. */
|
|
78
|
+
readonly ask: AskUserDecisionHandler;
|
|
79
|
+
readonly executionPolicy?: ExecutionPolicy;
|
|
80
|
+
readonly maxOptions?: number;
|
|
81
|
+
readonly maxQuestionBytes?: number;
|
|
82
|
+
readonly maxLabelBytes?: number;
|
|
83
|
+
readonly maxBulletBytes?: number;
|
|
84
|
+
readonly maxCustomTextBytes?: number;
|
|
85
|
+
}
|
|
86
|
+
export interface ResolvedAskUserDecisionLimits {
|
|
87
|
+
readonly maxOptions: number;
|
|
88
|
+
readonly maxQuestionBytes: number;
|
|
89
|
+
readonly maxLabelBytes: number;
|
|
90
|
+
readonly maxBulletBytes: number;
|
|
91
|
+
readonly maxCustomTextBytes: number;
|
|
92
|
+
}
|
|
93
|
+
export declare function resolveAskUserDecisionLimits(options?: Pick<AskUserDecisionToolOptions, "maxOptions" | "maxQuestionBytes" | "maxLabelBytes" | "maxBulletBytes" | "maxCustomTextBytes">): ResolvedAskUserDecisionLimits;
|
|
94
|
+
/** Normalize host answer against mode + allowCustom. Exported for tests. */
|
|
95
|
+
export declare function resolveAskUserDecisionAnswer(answer: AskUserDecisionAnswer | null | undefined, selectionMode: AskUserDecisionSelectionMode, options: readonly AskUserDecisionOption[], gates: {
|
|
96
|
+
readonly allowCustom: boolean;
|
|
97
|
+
readonly maxCustomTextBytes: number;
|
|
98
|
+
}): ResolvedAskUserDecisionAnswer;
|
|
99
|
+
/** Parse + validate model args into a bounded decision request. Exported for tests. */
|
|
100
|
+
export declare function parseAskUserDecisionArgs(args: Record<string, unknown>, limits: ResolvedAskUserDecisionLimits): {
|
|
101
|
+
question: string;
|
|
102
|
+
options: AskUserDecisionOption[];
|
|
103
|
+
selectionMode: AskUserDecisionSelectionMode;
|
|
104
|
+
allowCustom: boolean;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Create the opt-in `ask_user_decision` tool.
|
|
108
|
+
* Host must supply `ask`; factory throws if missing.
|
|
109
|
+
*/
|
|
110
|
+
export declare function createAskUserDecisionTool(options: AskUserDecisionToolOptions): ToolDefinition;
|
|
111
|
+
/** Durable decision payload for workflow suspension `data` (no AbortSignal / secrets). */
|
|
112
|
+
export interface AskUserDecisionSuspendData {
|
|
113
|
+
readonly question: string;
|
|
114
|
+
readonly options: readonly AskUserDecisionOption[];
|
|
115
|
+
readonly selectionMode: AskUserDecisionSelectionMode;
|
|
116
|
+
readonly allowCustom: boolean;
|
|
117
|
+
readonly toolCallId?: string;
|
|
118
|
+
readonly sessionId?: string;
|
|
119
|
+
readonly runId?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface SuspendAskUserDecisionOptions {
|
|
122
|
+
readonly reason?: string;
|
|
123
|
+
readonly maxCustomTextBytes?: number;
|
|
124
|
+
}
|
|
125
|
+
/** JSON Schema describing resume `input` (= AskUserDecisionAnswer). */
|
|
126
|
+
export declare function askUserDecisionResumeSchema(request: Pick<AskUserDecisionSuspendData, "selectionMode" | "allowCustom" | "options">): JsonObject;
|
|
127
|
+
export declare function toAskUserDecisionSuspendData(request: {
|
|
128
|
+
readonly question: string;
|
|
129
|
+
readonly options: readonly AskUserDecisionOption[];
|
|
130
|
+
readonly selectionMode: AskUserDecisionSelectionMode;
|
|
131
|
+
readonly allowCustom: boolean;
|
|
132
|
+
readonly toolCallId?: string;
|
|
133
|
+
readonly sessionId?: string;
|
|
134
|
+
readonly runId?: string;
|
|
135
|
+
}): AskUserDecisionSuspendData;
|
|
136
|
+
/**
|
|
137
|
+
* Return from a workflow node to pause for a user decision (opt-in durable path).
|
|
138
|
+
* Host resumes via `resumeWorkflow` + `createAskUserDecisionResumeValidator` / `validateAskUserDecisionResume`.
|
|
139
|
+
*/
|
|
140
|
+
export declare function suspendAskUserDecision(request: AskUserDecisionSuspendData | Pick<AskUserDecisionRequest, "question" | "options" | "selectionMode" | "allowCustom" | "toolCallId" | "sessionId" | "runId">, options?: SuspendAskUserDecisionOptions): WorkflowSuspension<AskUserDecisionAnswer>;
|
|
141
|
+
/**
|
|
142
|
+
* Validate resume input against the original decision request.
|
|
143
|
+
* Shared by workflow `validateResume` and host-held agent resume adapters.
|
|
144
|
+
*/
|
|
145
|
+
export declare function validateAskUserDecisionResume(request: AskUserDecisionSuspendData, value: unknown, limits?: Pick<ResolvedAskUserDecisionLimits, "maxCustomTextBytes">): ResolvedAskUserDecisionAnswer;
|
|
146
|
+
/**
|
|
147
|
+
* Workflow `validateResume` adapter. Reads durable request from `suspension.data`
|
|
148
|
+
* (written by `suspendAskUserDecision`). Deny paths skip answer validation.
|
|
149
|
+
*/
|
|
150
|
+
export declare function createAskUserDecisionResumeValidator(limits?: Pick<ResolvedAskUserDecisionLimits, "maxCustomTextBytes">): WorkflowResumeValidator;
|
|
151
|
+
/**
|
|
152
|
+
* Thin agent-path adapter: same validation as workflow resume, for hosts that
|
|
153
|
+
* persist `AskUserDecisionSuspendData` outside `AgentRunInterruption` (core kinds
|
|
154
|
+
* unchanged in 0.0.12). Call after operator supplies an answer.
|
|
155
|
+
*/
|
|
156
|
+
export declare function validateAskUserDecisionAgentResume(input: {
|
|
157
|
+
readonly request: AskUserDecisionSuspendData;
|
|
158
|
+
readonly answer: unknown;
|
|
159
|
+
readonly maxCustomTextBytes?: number;
|
|
160
|
+
}): ResolvedAskUserDecisionAnswer;
|