@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
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { defineWorkflow, functionNode, resumeWorkflow, runWorkflow, suspend, } from "@arnilo/prism-workflows";
|
|
2
|
+
import { assertCodingResumeAllowed, buildCodingCheckpointMetadata, CODING_STATE_KEY, codingCheckpointStatePatch, codingPlanPathForTask, createCodingPlanMarkdown, fingerprintJson, parseCodingPlanTodos, readCodingCheckpointFromState, readCodingPlanFile, writeCodingPlanFile, } from "./coding-checkpoint.js";
|
|
3
|
+
import { DEFAULT_MAX_CHECK_SUMMARY_BYTES, DEFAULT_MAX_PR_HANDOFF_BYTES } from "./limits.js";
|
|
4
|
+
export const CODING_GOAL_VERIFY_WORKFLOW_ID = "coding-goal-verify";
|
|
5
|
+
export const CODING_GOAL_VERIFY_REVISION = "1";
|
|
6
|
+
export const CODING_GOAL_VERIFY_SUSPEND_REASON = "approve-coding-goal-verify";
|
|
7
|
+
export class CodingGoalVerifyError extends Error {
|
|
8
|
+
code = "ERR_PRISM_CODING_GOAL_VERIFY";
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "CodingGoalVerifyError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function requireCoding(state) {
|
|
15
|
+
const coding = readCodingCheckpointFromState(state);
|
|
16
|
+
if (!coding)
|
|
17
|
+
throw new CodingGoalVerifyError("missing state.coding");
|
|
18
|
+
return coding;
|
|
19
|
+
}
|
|
20
|
+
function clipSummary(summary) {
|
|
21
|
+
const max = DEFAULT_MAX_CHECK_SUMMARY_BYTES;
|
|
22
|
+
const bytes = Buffer.from(summary, "utf8");
|
|
23
|
+
if (bytes.length <= max)
|
|
24
|
+
return summary;
|
|
25
|
+
return bytes.subarray(0, max).toString("utf8");
|
|
26
|
+
}
|
|
27
|
+
function normalizeChecks(checks) {
|
|
28
|
+
return checks.map((check) => ({
|
|
29
|
+
name: check.name,
|
|
30
|
+
exitCode: check.exitCode,
|
|
31
|
+
summary: clipSummary(check.summary),
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
function assertHandoffBounded(handoff) {
|
|
35
|
+
const encoded = Buffer.byteLength(JSON.stringify(handoff), "utf8");
|
|
36
|
+
if (encoded > DEFAULT_MAX_PR_HANDOFF_BYTES) {
|
|
37
|
+
throw new CodingGoalVerifyError(`handoff exceeds ${DEFAULT_MAX_PR_HANDOFF_BYTES} byte limit (${encoded} bytes)`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function fingerprintsFor(checks) {
|
|
41
|
+
return {
|
|
42
|
+
workflowRevision: CODING_GOAL_VERIFY_REVISION,
|
|
43
|
+
toolFingerprint: fingerprintJson({ tools: ["coding_check", "git_pr_handoff"], checks }),
|
|
44
|
+
policyFingerprint: fingerprintJson({ requireApproval: [CODING_GOAL_VERIFY_SUSPEND_REASON] }),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function defaultTodos(checkNames) {
|
|
48
|
+
return [
|
|
49
|
+
{ id: "plan", text: "Write goal plan Markdown", done: false },
|
|
50
|
+
...checkNames.map((name) => ({ id: `check-${name}`, text: `Run named check ${name}`, done: false })),
|
|
51
|
+
{ id: "handoff", text: "Emit bounded PR handoff", done: false },
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
function markTodos(todos, doneIds) {
|
|
55
|
+
return todos.map((todo) => (doneIds.has(todo.id) ? { ...todo, done: true } : todo));
|
|
56
|
+
}
|
|
57
|
+
/** Build the durable DAG used by `runCodingGoalVerify` (exported for hosts that want the definition alone). */
|
|
58
|
+
export function createCodingGoalVerifyWorkflow(options) {
|
|
59
|
+
const planPath = codingPlanPathForTask(options.taskId);
|
|
60
|
+
const fps = () => fingerprintsFor(options.checks);
|
|
61
|
+
const planNode = functionNode({
|
|
62
|
+
execute: async (ctx) => {
|
|
63
|
+
const todos = defaultTodos(options.checks);
|
|
64
|
+
const markdown = createCodingPlanMarkdown({
|
|
65
|
+
title: options.title,
|
|
66
|
+
taskId: options.taskId,
|
|
67
|
+
status: "planned",
|
|
68
|
+
todos,
|
|
69
|
+
notes: options.goal,
|
|
70
|
+
});
|
|
71
|
+
const plan = await writeCodingPlanFile({
|
|
72
|
+
workspaceRoot: options.cwd,
|
|
73
|
+
planPath,
|
|
74
|
+
markdown,
|
|
75
|
+
});
|
|
76
|
+
const metadata = buildCodingCheckpointMetadata({
|
|
77
|
+
taskId: options.taskId,
|
|
78
|
+
workspaceRoot: options.cwd,
|
|
79
|
+
baseBranch: options.baseBranch,
|
|
80
|
+
branch: options.branch,
|
|
81
|
+
planPath,
|
|
82
|
+
plan,
|
|
83
|
+
fingerprints: fps(),
|
|
84
|
+
todos: parseCodingPlanTodos(markdown),
|
|
85
|
+
status: "planned",
|
|
86
|
+
});
|
|
87
|
+
await ctx.updateState(codingCheckpointStatePatch(metadata), { mode: "merge" });
|
|
88
|
+
return { planPath, planSha256: plan.sha256 };
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
const verifyNode = functionNode({
|
|
92
|
+
execute: async (ctx) => {
|
|
93
|
+
const coding = requireCoding(ctx.state);
|
|
94
|
+
const checks = normalizeChecks(await Promise.all(options.checks.map((name) => options.runCheck(name))));
|
|
95
|
+
const failed = checks.some((check) => check.exitCode !== 0);
|
|
96
|
+
const done = new Set(["plan", ...options.checks.map((name) => `check-${name}`)]);
|
|
97
|
+
const todos = markTodos(coding.todos.length ? coding.todos : defaultTodos(options.checks), done);
|
|
98
|
+
const markdown = createCodingPlanMarkdown({
|
|
99
|
+
title: options.title,
|
|
100
|
+
taskId: options.taskId,
|
|
101
|
+
status: failed ? "awaiting_approval" : "ready_for_handoff",
|
|
102
|
+
todos,
|
|
103
|
+
notes: options.goal,
|
|
104
|
+
});
|
|
105
|
+
const plan = await writeCodingPlanFile({
|
|
106
|
+
workspaceRoot: options.cwd,
|
|
107
|
+
planPath,
|
|
108
|
+
markdown,
|
|
109
|
+
});
|
|
110
|
+
const next = buildCodingCheckpointMetadata({
|
|
111
|
+
...coding,
|
|
112
|
+
plan,
|
|
113
|
+
checks,
|
|
114
|
+
todos: parseCodingPlanTodos(markdown),
|
|
115
|
+
status: failed ? "awaiting_approval" : "ready_for_handoff",
|
|
116
|
+
fingerprints: fps(),
|
|
117
|
+
updatedAt: new Date().toISOString(),
|
|
118
|
+
});
|
|
119
|
+
await ctx.updateState(codingCheckpointStatePatch(next), { mode: "merge" });
|
|
120
|
+
return { checks, failed };
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
const reviewNode = functionNode({
|
|
124
|
+
execute: async (ctx) => {
|
|
125
|
+
const coding = requireCoding(ctx.state);
|
|
126
|
+
const failed = coding.checks.some((check) => check.exitCode !== 0);
|
|
127
|
+
if (!failed)
|
|
128
|
+
return { approved: true, skipped: true };
|
|
129
|
+
if (!ctx.resume) {
|
|
130
|
+
return suspend({
|
|
131
|
+
reason: options.suspendReason,
|
|
132
|
+
data: {
|
|
133
|
+
taskId: coding.taskId,
|
|
134
|
+
branch: coding.branch,
|
|
135
|
+
planSha256: coding.plan.sha256,
|
|
136
|
+
checks: coding.checks,
|
|
137
|
+
},
|
|
138
|
+
resumeSchema: {
|
|
139
|
+
type: "object",
|
|
140
|
+
required: ["reviewer"],
|
|
141
|
+
properties: { reviewer: { type: "string" } },
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const reviewer = ctx.resume.input?.reviewer ?? "unknown";
|
|
146
|
+
return { approved: true, reviewer, planSha256: coding.plan.sha256 };
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
const handoffNode = functionNode({
|
|
150
|
+
execute: async (ctx) => {
|
|
151
|
+
const coding = requireCoding(ctx.state);
|
|
152
|
+
const planFile = await readCodingPlanFile({
|
|
153
|
+
workspaceRoot: options.cwd,
|
|
154
|
+
planPath: coding.planPath,
|
|
155
|
+
expected: coding.plan,
|
|
156
|
+
});
|
|
157
|
+
assertCodingResumeAllowed({
|
|
158
|
+
metadata: coding,
|
|
159
|
+
expected: fps(),
|
|
160
|
+
expectedWorkspaceRoot: options.cwd,
|
|
161
|
+
expectedBaseBranch: options.baseBranch,
|
|
162
|
+
planBytes: Buffer.from(planFile.markdown, "utf8"),
|
|
163
|
+
});
|
|
164
|
+
const handoff = await options.buildHandoff({ coding, checks: coding.checks });
|
|
165
|
+
assertHandoffBounded(handoff);
|
|
166
|
+
const todos = markTodos(coding.todos.length ? coding.todos : defaultTodos(options.checks), new Set(["plan", "handoff", ...options.checks.map((name) => `check-${name}`)]));
|
|
167
|
+
const markdown = createCodingPlanMarkdown({
|
|
168
|
+
title: options.title,
|
|
169
|
+
taskId: options.taskId,
|
|
170
|
+
status: "completed",
|
|
171
|
+
todos,
|
|
172
|
+
notes: options.goal,
|
|
173
|
+
});
|
|
174
|
+
const plan = await writeCodingPlanFile({
|
|
175
|
+
workspaceRoot: options.cwd,
|
|
176
|
+
planPath,
|
|
177
|
+
markdown,
|
|
178
|
+
});
|
|
179
|
+
const next = buildCodingCheckpointMetadata({
|
|
180
|
+
...coding,
|
|
181
|
+
plan,
|
|
182
|
+
handoff,
|
|
183
|
+
todos: parseCodingPlanTodos(markdown),
|
|
184
|
+
status: "completed",
|
|
185
|
+
fingerprints: fps(),
|
|
186
|
+
updatedAt: new Date().toISOString(),
|
|
187
|
+
});
|
|
188
|
+
await ctx.updateState(codingCheckpointStatePatch(next), { mode: "merge" });
|
|
189
|
+
return { handoff, codingStatus: next.status };
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
return defineWorkflow({
|
|
193
|
+
revision: CODING_GOAL_VERIFY_REVISION,
|
|
194
|
+
id: CODING_GOAL_VERIFY_WORKFLOW_ID,
|
|
195
|
+
nodes: {
|
|
196
|
+
plan: planNode,
|
|
197
|
+
verify: verifyNode,
|
|
198
|
+
review: reviewNode,
|
|
199
|
+
handoff: handoffNode,
|
|
200
|
+
},
|
|
201
|
+
edges: [
|
|
202
|
+
["plan", "verify"],
|
|
203
|
+
["verify", "review"],
|
|
204
|
+
["review", "handoff"],
|
|
205
|
+
],
|
|
206
|
+
limits: { maxConcurrency: 1, maxStateBytes: 64 * 1024 },
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Run (or resume) a thin goal→verify coding composition.
|
|
211
|
+
* Fails closed when `approval` / `approval.validateResume` is missing.
|
|
212
|
+
*/
|
|
213
|
+
export async function runCodingGoalVerify(options) {
|
|
214
|
+
if (!options.approval?.validateResume) {
|
|
215
|
+
throw new CodingGoalVerifyError("approval.validateResume is required");
|
|
216
|
+
}
|
|
217
|
+
if (!Array.isArray(options.checks) || options.checks.length < 1) {
|
|
218
|
+
throw new CodingGoalVerifyError("checks must declare at least one named check");
|
|
219
|
+
}
|
|
220
|
+
for (const name of options.checks) {
|
|
221
|
+
if (typeof name !== "string" || !/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(name)) {
|
|
222
|
+
throw new CodingGoalVerifyError(`invalid check name: ${String(name)}`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (typeof options.runCheck !== "function") {
|
|
226
|
+
throw new CodingGoalVerifyError("runCheck is required");
|
|
227
|
+
}
|
|
228
|
+
if (typeof options.buildHandoff !== "function") {
|
|
229
|
+
throw new CodingGoalVerifyError("buildHandoff is required");
|
|
230
|
+
}
|
|
231
|
+
if (typeof options.goal !== "string" || options.goal.trim().length < 1) {
|
|
232
|
+
throw new CodingGoalVerifyError("goal is required");
|
|
233
|
+
}
|
|
234
|
+
if (typeof options.cwd !== "string" || options.cwd.length < 1) {
|
|
235
|
+
throw new CodingGoalVerifyError("cwd is required");
|
|
236
|
+
}
|
|
237
|
+
const taskId = options.taskId ?? "goal";
|
|
238
|
+
const title = options.title ?? options.goal.slice(0, 120);
|
|
239
|
+
const baseBranch = options.baseBranch ?? "main";
|
|
240
|
+
const branch = options.branch ?? `codex/${taskId}`;
|
|
241
|
+
const suspendReason = options.approval.reason ?? CODING_GOAL_VERIFY_SUSPEND_REASON;
|
|
242
|
+
const workflow = createCodingGoalVerifyWorkflow({
|
|
243
|
+
goal: options.goal,
|
|
244
|
+
cwd: options.cwd,
|
|
245
|
+
taskId,
|
|
246
|
+
title,
|
|
247
|
+
baseBranch,
|
|
248
|
+
branch,
|
|
249
|
+
checks: options.checks,
|
|
250
|
+
runCheck: options.runCheck,
|
|
251
|
+
buildHandoff: options.buildHandoff,
|
|
252
|
+
suspendReason,
|
|
253
|
+
});
|
|
254
|
+
const validateState = async (input) => {
|
|
255
|
+
if (CODING_STATE_KEY in input.value) {
|
|
256
|
+
readCodingCheckpointFromState(input.value);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
const shared = {
|
|
260
|
+
checkpoints: options.checkpoints,
|
|
261
|
+
redactor: options.redactor,
|
|
262
|
+
ownership: options.ownership,
|
|
263
|
+
validateState,
|
|
264
|
+
validateResume: options.approval.validateResume,
|
|
265
|
+
signal: options.signal,
|
|
266
|
+
onEvent: options.onEvent,
|
|
267
|
+
};
|
|
268
|
+
if (options.resume) {
|
|
269
|
+
return resumeWorkflow(workflow, { runId: options.resume.runId, workflowId: workflow.id }, {
|
|
270
|
+
...shared,
|
|
271
|
+
resume: {
|
|
272
|
+
decision: options.resume.decision,
|
|
273
|
+
expectedVersion: options.resume.expectedVersion,
|
|
274
|
+
input: options.resume.input,
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
return runWorkflow(workflow, { goal: options.goal, baseBranch }, shared);
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=goal-verify.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,37 +1,65 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
1
|
+
export { createDirectoryArtifactWriter, createTempArtifactWriter, sha256Hex } from "./artifacts.js";
|
|
2
|
+
export type { AskUserDecisionAnswer, AskUserDecisionHandler, AskUserDecisionOption, AskUserDecisionRequest, AskUserDecisionSelectionMode, AskUserDecisionSuspendData, AskUserDecisionToolOptions, ResolvedAskUserDecisionAnswer, ResolvedAskUserDecisionLimits, SuspendAskUserDecisionOptions, } from "./ask-user-decision.js";
|
|
3
|
+
export { ASK_USER_DECISION_RATIONALE_COUNT, ASK_USER_DECISION_SUSPEND_REASON, ASK_USER_DECISION_TOOL_NAME, askUserDecisionResumeSchema, createAskUserDecisionResumeValidator, createAskUserDecisionTool, DEFAULT_MAX_ASK_USER_DECISION_BULLET_BYTES, DEFAULT_MAX_ASK_USER_DECISION_CUSTOM_BYTES, DEFAULT_MAX_ASK_USER_DECISION_LABEL_BYTES, DEFAULT_MAX_ASK_USER_DECISION_OPTIONS, DEFAULT_MAX_ASK_USER_DECISION_QUESTION_BYTES, HARD_MAX_ASK_USER_DECISION_BULLET_BYTES, HARD_MAX_ASK_USER_DECISION_CUSTOM_BYTES, HARD_MAX_ASK_USER_DECISION_LABEL_BYTES, HARD_MAX_ASK_USER_DECISION_OPTIONS, HARD_MAX_ASK_USER_DECISION_QUESTION_BYTES, parseAskUserDecisionArgs, resolveAskUserDecisionAnswer, resolveAskUserDecisionLimits, suspendAskUserDecision, toAskUserDecisionSuspendData, validateAskUserDecisionAgentResume, validateAskUserDecisionResume, } from "./ask-user-decision.js";
|
|
4
|
+
export type { CodingCheckToolOptions, NamedCheckDefinition } from "./checks.js";
|
|
5
|
+
export { createCodingCheckTool } from "./checks.js";
|
|
6
|
+
export type { DeleteOperations, DeleteToolOptions, MutationStat } from "./delete.js";
|
|
7
|
+
export { createDeleteTool } from "./delete.js";
|
|
8
|
+
export type { CodingLifecycleEvent, CodingLifecycleLimits, CodingLifecycleEmitter, CreateCodingLifecycleEmitterOptions, FileChangeOp, FileChangedEvent, WorktreeChangedEvent, PermissionDeniedEvent, ConfigurationChangedEvent, ResolvedCodingLifecycleLimits, } from "./lifecycle.js";
|
|
9
|
+
export { createCodingLifecycleEmitter, CodingLifecycleError, resolveCodingLifecycleLimits, } from "./lifecycle.js";
|
|
10
|
+
export type { CodingArtifactKind, CodingArtifactRef, CodingCheckpointLimitOptions, CodingCheckpointMetadata, CodingCheckSummary, CodingFingerprints, CodingHandoffSummary, CodingTaskStatus, CodingTodoItem, ResolvedCodingCheckpointLimits, } from "./coding-checkpoint.js";
|
|
11
|
+
export { assertCodingResumeAllowed, buildCodingCheckpointMetadata, CODING_CHECKPOINT_SCHEMA_VERSION, CODING_STATE_KEY, CodingCheckpointError, codingCheckpointStatePatch, codingPlanPathForTask, createCodingArtifactRef, createCodingPlanMarkdown, fingerprintJson, parseCodingPlanTodos, readCodingCheckpointFromState, readCodingPlanFile, resolveCodingCheckpointLimits, validateCodingCheckpointMetadata, verifyCodingArtifactBytes, writeCodingPlanFile, } from "./coding-checkpoint.js";
|
|
12
|
+
export type { Edit, EditOperations, EditToolDetails, EditToolOptions } from "./edit.js";
|
|
7
13
|
export { createEditTool } from "./edit.js";
|
|
8
|
-
export type {
|
|
9
|
-
export {
|
|
14
|
+
export type { CodingEffectReconciliation, CodingEffectReconciliationInput } from "./effects.js";
|
|
15
|
+
export { classifyGitApplyEffect, classifyGitBranchEffect, classifyGitWorktreeEffect, CODING_LOCAL_EFFECT, CODING_OBSERVATION_EFFECT, CODING_UNSUPPORTED_EFFECT, reconcileCodingToolEffect, } from "./effects.js";
|
|
16
|
+
export type { ArtifactReference, ArtifactWriter, BoundGitRunner, CreateGitOperationsOptions, CreateGitRunnerOptions, GitExecRequest, GitExecResult, GitLimitOptions, GitOperations, GitRunner, GitStatusBranch, GitStatusEntry, GitStatusEntryKind, GitStatusResult, PrHandoff, ResolvedGitLimits, } from "./git.js";
|
|
17
|
+
export { createBoundGitRunner, createGitOperations, GitError, parsePorcelainV2, resolveGitLimits, runGitCli, SAFE_GIT_CONFIG_ARGS, SAFE_GIT_ENV, } from "./git.js";
|
|
18
|
+
export type { GitToolsOptions } from "./git-tools.js";
|
|
19
|
+
export { createGitApplyTool, createGitBranchTool, createGitCommitTool, createGitDiffTool, createGitPrHandoffTool, createGitStatusTool, createGitTools, createGitWorktreeTool, } from "./git-tools.js";
|
|
20
|
+
export type { CodingGoalVerifyApproval, RunCodingGoalVerifyOptions, } from "./goal-verify.js";
|
|
21
|
+
export { CODING_GOAL_VERIFY_REVISION, CODING_GOAL_VERIFY_SUSPEND_REASON, CODING_GOAL_VERIFY_WORKFLOW_ID, CodingGoalVerifyError, createCodingGoalVerifyWorkflow, runCodingGoalVerify, } from "./goal-verify.js";
|
|
22
|
+
export type { GlobToolOptions } from "./glob.js";
|
|
23
|
+
export { createGlobTool } from "./glob.js";
|
|
24
|
+
export { matchGlobPattern, validateGlobPattern } from "./glob-match.js";
|
|
10
25
|
export type { ListToolOptions } from "./list.js";
|
|
11
|
-
export {
|
|
26
|
+
export { createRepoListTool } from "./list.js";
|
|
27
|
+
export type { MoveOperations, MoveToolOptions } from "./move.js";
|
|
28
|
+
export { createMoveTool } from "./move.js";
|
|
29
|
+
export type { ReadOperations, ReadTextOptions, ReadTextResult, ReadToolOptions, TransformImage, TransformImageInput, } from "./read.js";
|
|
30
|
+
export { createReadTool, DEFAULT_MAX_IMAGE_BYTES, detectSupportedImageMimeType, detectSupportedImageMimeTypeFromFile, } from "./read.js";
|
|
31
|
+
export type { ReadPathSet } from "./read-path-set.js";
|
|
32
|
+
export { createReadPathSet } from "./read-path-set.js";
|
|
33
|
+
export type { RepoEntryKind, RepoListEntry, RepositoryGlobRequest, RepositoryGlobResult, RepositoryLimitOptions, RepositoryListRequest, RepositoryListResult, RepositoryOperations, RepoSearchOutputMode, RepositorySearchMatch, RepositorySearchRequest, RepositorySearchResult, ResolvedRepositoryLimits, RepositoryWalk, RepositoryWalkEvent, RepositoryWalkLimits, } from "./repository.js";
|
|
34
|
+
export { compileSearchPattern, createLocalRepositoryOperations, DEFAULT_REPO_EXCLUDE, isBinaryBuffer, RepositoryError, resolveRepoPath, resolveRepositoryLimits, toRepoRelative, } from "./repository.js";
|
|
35
|
+
export type { GitAwareRepositoryOptions } from "./git-aware-repository.js";
|
|
36
|
+
export { createGitAwareRepositoryOperations, parseGitLsFilesZ } from "./git-aware-repository.js";
|
|
37
|
+
export type { CreateLanguageIntelligenceOptions, LanguageDiagnostic, LanguageIntelligence, LanguageIntelligenceLimits, LanguageLocation, LanguageServerSpec, LanguageSymbol, LanguageTextEdit, LanguageWorkspaceEdit, } from "./language/index.js";
|
|
38
|
+
export { applyTextEdits, createLanguageIntelligence, encodeLspFrame, LanguageIntelligenceError, LspFrameError, LspFrameReader, resolveLanguageIntelligenceLimits, } from "./language/index.js";
|
|
39
|
+
export type { CreateGitHubForgeOptions, ForgeCheck, ForgeCredential, ForgeCredentialResolver, ForgeCredentialResolverSource, ForgeErrorCode, ForgeHandoffReport, ForgeIssueContext, ForgeLimits, ForgeOperations, ForgePullRequest, ResolvedForgeLimits, } from "./forge/index.js";
|
|
40
|
+
export { createGitHubForge, ForgeError, resolveForgeLimits } from "./forge/index.js";
|
|
41
|
+
export type { CodingProcessEvent, CreateProcessSessionsOptions, ProcessExitResult, ProcessOutputChunk, ProcessSandboxBackend, ProcessSandboxHandle, ProcessSandboxStartRequest, ProcessSession, ProcessSessionLimits, ProcessSessionMetadata, ProcessSessions, ProcessSessionState, ProcessStartRequest, ResolvedProcessSessionLimits, } from "./process/index.js";
|
|
42
|
+
export { createProcessSessions, ProcessSessionError, resolveProcessSessionLimits, } from "./process/index.js";
|
|
12
43
|
export type { SearchToolOptions } from "./search.js";
|
|
13
|
-
export {
|
|
14
|
-
export type {
|
|
15
|
-
export {
|
|
16
|
-
export type {
|
|
17
|
-
export {
|
|
18
|
-
export type { GitToolsOptions } from "./git-tools.js";
|
|
19
|
-
export { createCodingCheckTool } from "./checks.js";
|
|
20
|
-
export type { CodingCheckToolOptions, NamedCheckDefinition } from "./checks.js";
|
|
21
|
-
export { createDirectoryArtifactWriter, createTempArtifactWriter, sha256Hex } from "./artifacts.js";
|
|
22
|
-
export { CODING_CHECKPOINT_SCHEMA_VERSION, CODING_STATE_KEY, CodingCheckpointError, assertCodingResumeAllowed, buildCodingCheckpointMetadata, codingCheckpointStatePatch, codingPlanPathForTask, createCodingArtifactRef, createCodingPlanMarkdown, fingerprintJson, parseCodingPlanTodos, readCodingCheckpointFromState, readCodingPlanFile, resolveCodingCheckpointLimits, validateCodingCheckpointMetadata, verifyCodingArtifactBytes, writeCodingPlanFile, } from "./coding-checkpoint.js";
|
|
23
|
-
export type { CodingArtifactKind, CodingArtifactRef, CodingCheckSummary, CodingCheckpointLimitOptions, CodingCheckpointMetadata, CodingFingerprints, CodingHandoffSummary, CodingTaskStatus, CodingTodoItem, ResolvedCodingCheckpointLimits, } from "./coding-checkpoint.js";
|
|
24
|
-
export { withFileMutationQueue } from "./file-mutation-queue.js";
|
|
44
|
+
export { createRepoSearchTool } from "./search.js";
|
|
45
|
+
export type { BashExecOptions, BashOperations, BashSpawnContext, BashSpawnHook, ShellConfig, ShellToolOptions, } from "./shell.js";
|
|
46
|
+
export { createLocalBashOperations, createShellTool, getShellConfig, killProcessTree, waitForChildProcess, } from "./shell.js";
|
|
47
|
+
export type { WriteOperations, WriteToolOptions } from "./write.js";
|
|
48
|
+
export { createWriteTool } from "./write.js";
|
|
25
49
|
export { enforceExecutionPolicy } from "./execution-policy.js";
|
|
26
|
-
export {
|
|
50
|
+
export { withFileMutationQueue } from "./file-mutation-queue.js";
|
|
51
|
+
export { DEFAULT_CHECK_TIMEOUT_MS, DEFAULT_GIT_TIMEOUT_MS, DEFAULT_MAX_BYTES, DEFAULT_MAX_CHECK_CONCURRENCY, DEFAULT_MAX_CHECK_DIAGNOSTIC_LINES, DEFAULT_MAX_CHECK_NAMES, DEFAULT_MAX_CHECK_OUTPUT_BYTES, DEFAULT_MAX_CHECK_SUMMARY_BYTES, DEFAULT_MAX_CODING_ARTIFACT_BYTES, DEFAULT_MAX_CODING_ARTIFACTS, DEFAULT_MAX_CODING_CHECKPOINT_BYTES, DEFAULT_MAX_EDIT_FILE_BYTES, DEFAULT_MAX_EDIT_INPUT_BYTES, DEFAULT_MAX_EDITS, DEFAULT_MAX_FORGE_COMMENTS_PER_REVIEW, DEFAULT_MAX_FORGE_PAGES_PER_OPERATION, DEFAULT_MAX_FORGE_PAYLOAD_BYTES, DEFAULT_MAX_FORGE_REQUEST_CONCURRENCY, DEFAULT_MAX_FORGE_REQUEST_TIMEOUT_MS, DEFAULT_MAX_GIT_CHANGED_FILES, DEFAULT_MAX_GIT_DIFF_LINES, DEFAULT_MAX_GIT_MESSAGE_BYTES, DEFAULT_MAX_GIT_OUTPUT_BYTES, DEFAULT_MAX_LS_FILES_OUTPUT_BYTES, DEFAULT_MAX_LSP_DIAGNOSTICS_PER_FILE, DEFAULT_MAX_LSP_MESSAGE_BYTES, DEFAULT_MAX_LSP_PENDING_REQUESTS, DEFAULT_MAX_LSP_RESULTS_PER_QUERY, DEFAULT_MAX_LSP_SERVERS, DEFAULT_MAX_LSP_TIMEOUT_MS, DEFAULT_MAX_GIT_PATCH_BYTES, DEFAULT_MAX_GIT_PATHS, DEFAULT_MAX_GIT_REF_BYTES, DEFAULT_MAX_GIT_WORKTREES, DEFAULT_MAX_LINES, DEFAULT_MAX_PLAN_BYTES, DEFAULT_MAX_PR_COMMITS, DEFAULT_MAX_PR_HANDOFF_BYTES, DEFAULT_MAX_PROCESS_INPUT_BYTES, DEFAULT_MAX_PROCESS_LIFETIME_MS, DEFAULT_MAX_PROCESS_OUTPUT_CHUNK_BYTES, DEFAULT_MAX_PROCESS_SESSIONS, DEFAULT_MAX_PROCESS_TOTAL_OUTPUT_BYTES, DEFAULT_MAX_REPO_CONCURRENCY, DEFAULT_MAX_REPO_DEPTH, DEFAULT_MAX_REPO_ENTRIES, DEFAULT_MAX_REPO_FILES, DEFAULT_MAX_REPO_RESULTS, DEFAULT_MAX_SEARCH_CONTEXT_LINES, DEFAULT_MAX_SEARCH_FILE_BYTES, DEFAULT_MAX_SEARCH_LINE_BYTES, DEFAULT_MAX_SEARCH_MATCHES, DEFAULT_MAX_SEARCH_PATTERN_BYTES, DEFAULT_MAX_SEARCH_SCAN_BYTES, DEFAULT_MAX_SEARCH_TIME_MS, DEFAULT_MAX_TEXT_SCAN_BYTES, DEFAULT_MAX_TODO_TEXT_BYTES, DEFAULT_MAX_TODOS, DEFAULT_MAX_TOTAL_OUTPUT_BYTES, DEFAULT_MAX_WRITE_BYTES, DEFAULT_SHELL_TIMEOUT_SECONDS, HARD_CHECK_TIMEOUT_MS, HARD_GIT_TIMEOUT_MS, HARD_MAX_BYTES, HARD_MAX_CHECK_CONCURRENCY, HARD_MAX_CHECK_DIAGNOSTIC_LINES, HARD_MAX_CHECK_NAMES, HARD_MAX_CHECK_OUTPUT_BYTES, HARD_MAX_CHECK_SUMMARY_BYTES, HARD_MAX_CODING_ARTIFACT_BYTES, HARD_MAX_CODING_ARTIFACTS, HARD_MAX_CODING_CHECKPOINT_BYTES, HARD_MAX_EDIT_FILE_BYTES, HARD_MAX_EDIT_INPUT_BYTES, HARD_MAX_EDITS, HARD_MAX_FORGE_COMMENTS_PER_REVIEW, HARD_MAX_FORGE_PAGES_PER_OPERATION, HARD_MAX_FORGE_PAYLOAD_BYTES, HARD_MAX_FORGE_REQUEST_CONCURRENCY, HARD_MAX_FORGE_REQUEST_TIMEOUT_MS, HARD_MAX_GIT_CHANGED_FILES, HARD_MAX_GIT_DIFF_LINES, HARD_MAX_GIT_MESSAGE_BYTES, HARD_MAX_GIT_OUTPUT_BYTES, HARD_MAX_LS_FILES_OUTPUT_BYTES, HARD_MAX_LSP_DIAGNOSTICS_PER_FILE, HARD_MAX_LSP_MESSAGE_BYTES, HARD_MAX_LSP_PENDING_REQUESTS, HARD_MAX_LSP_RESULTS_PER_QUERY, HARD_MAX_LSP_SERVERS, HARD_MAX_LSP_TIMEOUT_MS, HARD_MAX_GIT_PATCH_BYTES, HARD_MAX_GIT_PATHS, HARD_MAX_GIT_REF_BYTES, HARD_MAX_GIT_WORKTREES, HARD_MAX_IMAGE_BYTES, HARD_MAX_LINES, HARD_MAX_PLAN_BYTES, HARD_MAX_PR_COMMITS, HARD_MAX_PR_HANDOFF_BYTES, HARD_MAX_PROCESS_INPUT_BYTES, HARD_MAX_PROCESS_LIFETIME_MS, HARD_MAX_PROCESS_OUTPUT_CHUNK_BYTES, HARD_MAX_PROCESS_SESSIONS, HARD_MAX_PROCESS_TOTAL_OUTPUT_BYTES, HARD_MAX_REPO_CONCURRENCY, HARD_MAX_REPO_DEPTH, HARD_MAX_REPO_ENTRIES, HARD_MAX_REPO_FILES, HARD_MAX_REPO_RESULTS, HARD_MAX_SEARCH_CONTEXT_LINES, HARD_MAX_SEARCH_FILE_BYTES, HARD_MAX_SEARCH_LINE_BYTES, HARD_MAX_SEARCH_MATCHES, HARD_MAX_SEARCH_PATTERN_BYTES, HARD_MAX_SEARCH_SCAN_BYTES, HARD_MAX_SEARCH_TIME_MS, HARD_MAX_TEXT_SCAN_BYTES, HARD_MAX_TODO_TEXT_BYTES, HARD_MAX_TODOS, HARD_MAX_TOTAL_OUTPUT_BYTES, HARD_MAX_WRITE_BYTES, HARD_SHELL_TIMEOUT_SECONDS, LSP_RESTARTS_PER_SERVER, } from "./limits.js";
|
|
27
52
|
import type { ExecutionPolicy, ToolDefinition } from "@arnilo/prism";
|
|
28
|
-
import type {
|
|
29
|
-
import type { ReadToolOptions } from "./read.js";
|
|
30
|
-
import type { WriteToolOptions } from "./write.js";
|
|
53
|
+
import type { DeleteToolOptions } from "./delete.js";
|
|
31
54
|
import type { EditToolOptions } from "./edit.js";
|
|
55
|
+
import type { GlobToolOptions } from "./glob.js";
|
|
32
56
|
import type { ListToolOptions } from "./list.js";
|
|
33
|
-
import type {
|
|
57
|
+
import type { MoveToolOptions } from "./move.js";
|
|
58
|
+
import type { ReadToolOptions } from "./read.js";
|
|
34
59
|
import type { RepositoryLimitOptions, RepositoryOperations } from "./repository.js";
|
|
60
|
+
import type { SearchToolOptions } from "./search.js";
|
|
61
|
+
import type { ShellToolOptions } from "./shell.js";
|
|
62
|
+
import type { WriteToolOptions } from "./write.js";
|
|
35
63
|
/** Per-tool options combined for the aggregator factories. */
|
|
36
64
|
export interface ToolsOptions {
|
|
37
65
|
/** Shared execution policy applied to every coding tool unless overridden per tool. */
|
|
@@ -40,22 +68,27 @@ export interface ToolsOptions {
|
|
|
40
68
|
read?: ReadToolOptions;
|
|
41
69
|
write?: WriteToolOptions;
|
|
42
70
|
edit?: EditToolOptions;
|
|
71
|
+
delete?: DeleteToolOptions;
|
|
72
|
+
move?: MoveToolOptions;
|
|
43
73
|
list?: ListToolOptions;
|
|
44
74
|
search?: SearchToolOptions;
|
|
75
|
+
glob?: GlobToolOptions;
|
|
45
76
|
/**
|
|
46
|
-
* Shared repository limits/backends for `repo_list` / `repo_search`.
|
|
47
|
-
* Per-tool `list` / `search` options override these when both are set.
|
|
77
|
+
* Shared repository limits/backends for `repo_list` / `repo_search` / `glob`.
|
|
78
|
+
* Per-tool `list` / `search` / `glob` options override these when both are set.
|
|
48
79
|
*/
|
|
49
80
|
repository?: RepositoryLimitOptions & {
|
|
50
81
|
operations?: RepositoryOperations;
|
|
51
82
|
};
|
|
52
83
|
}
|
|
53
84
|
/**
|
|
54
|
-
* Full coding tool set: `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`.
|
|
85
|
+
* Full coding tool set: `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`, `glob`, `delete`, `move`.
|
|
86
|
+
* Opt-in tools (`createGitTools`, `createAskUserDecisionTool`, `createCodingCheckTool`)
|
|
87
|
+
* stay out — hosts register them explicitly.
|
|
55
88
|
*/
|
|
56
89
|
export declare function createCodingTools(cwd: string, options?: ToolsOptions): readonly ToolDefinition[];
|
|
57
90
|
/**
|
|
58
|
-
* Read-only subset: `read`, `repo_list`, `repo_search`.
|
|
91
|
+
* Read-only subset: `read`, `repo_list`, `repo_search`, `glob`.
|
|
59
92
|
* Deliberate 0.0.9 expansion from the previous `read`-only set.
|
|
60
93
|
*/
|
|
61
94
|
export declare function createReadOnlyTools(cwd: string, options?: ToolsOptions): readonly ToolDefinition[];
|
package/dist/index.js
CHANGED
|
@@ -4,28 +4,44 @@
|
|
|
4
4
|
// `ToolDefinition`s that hosts register into a `ToolRegistry` (e.g.
|
|
5
5
|
// `createToolRegistry(createCodingTools(cwd))`). No tools are auto-registered — import what you need.
|
|
6
6
|
// --- per-tool factories & types ---
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
7
|
+
export { createDirectoryArtifactWriter, createTempArtifactWriter, sha256Hex } from "./artifacts.js";
|
|
8
|
+
export { ASK_USER_DECISION_RATIONALE_COUNT, ASK_USER_DECISION_SUSPEND_REASON, ASK_USER_DECISION_TOOL_NAME, askUserDecisionResumeSchema, createAskUserDecisionResumeValidator, createAskUserDecisionTool, DEFAULT_MAX_ASK_USER_DECISION_BULLET_BYTES, DEFAULT_MAX_ASK_USER_DECISION_CUSTOM_BYTES, DEFAULT_MAX_ASK_USER_DECISION_LABEL_BYTES, DEFAULT_MAX_ASK_USER_DECISION_OPTIONS, DEFAULT_MAX_ASK_USER_DECISION_QUESTION_BYTES, HARD_MAX_ASK_USER_DECISION_BULLET_BYTES, HARD_MAX_ASK_USER_DECISION_CUSTOM_BYTES, HARD_MAX_ASK_USER_DECISION_LABEL_BYTES, HARD_MAX_ASK_USER_DECISION_OPTIONS, HARD_MAX_ASK_USER_DECISION_QUESTION_BYTES, parseAskUserDecisionArgs, resolveAskUserDecisionAnswer, resolveAskUserDecisionLimits, suspendAskUserDecision, toAskUserDecisionSuspendData, validateAskUserDecisionAgentResume, validateAskUserDecisionResume, } from "./ask-user-decision.js";
|
|
9
|
+
export { createCodingCheckTool } from "./checks.js";
|
|
10
|
+
export { createDeleteTool } from "./delete.js";
|
|
11
|
+
export { createCodingLifecycleEmitter, CodingLifecycleError, resolveCodingLifecycleLimits, } from "./lifecycle.js";
|
|
12
|
+
export { assertCodingResumeAllowed, buildCodingCheckpointMetadata, CODING_CHECKPOINT_SCHEMA_VERSION, CODING_STATE_KEY, CodingCheckpointError, codingCheckpointStatePatch, codingPlanPathForTask, createCodingArtifactRef, createCodingPlanMarkdown, fingerprintJson, parseCodingPlanTodos, readCodingCheckpointFromState, readCodingPlanFile, resolveCodingCheckpointLimits, validateCodingCheckpointMetadata, verifyCodingArtifactBytes, writeCodingPlanFile, } from "./coding-checkpoint.js";
|
|
10
13
|
export { createEditTool } from "./edit.js";
|
|
14
|
+
export { classifyGitApplyEffect, classifyGitBranchEffect, classifyGitWorktreeEffect, CODING_LOCAL_EFFECT, CODING_OBSERVATION_EFFECT, CODING_UNSUPPORTED_EFFECT, reconcileCodingToolEffect, } from "./effects.js";
|
|
15
|
+
export { createBoundGitRunner, createGitOperations, GitError, parsePorcelainV2, resolveGitLimits, runGitCli, SAFE_GIT_CONFIG_ARGS, SAFE_GIT_ENV, } from "./git.js";
|
|
16
|
+
export { createGitApplyTool, createGitBranchTool, createGitCommitTool, createGitDiffTool, createGitPrHandoffTool, createGitStatusTool, createGitTools, createGitWorktreeTool, } from "./git-tools.js";
|
|
17
|
+
export { CODING_GOAL_VERIFY_REVISION, CODING_GOAL_VERIFY_SUSPEND_REASON, CODING_GOAL_VERIFY_WORKFLOW_ID, CodingGoalVerifyError, createCodingGoalVerifyWorkflow, runCodingGoalVerify, } from "./goal-verify.js";
|
|
18
|
+
export { createGlobTool } from "./glob.js";
|
|
19
|
+
export { matchGlobPattern, validateGlobPattern } from "./glob-match.js";
|
|
11
20
|
export { createRepoListTool } from "./list.js";
|
|
21
|
+
export { createMoveTool } from "./move.js";
|
|
22
|
+
export { createReadTool, DEFAULT_MAX_IMAGE_BYTES, detectSupportedImageMimeType, detectSupportedImageMimeTypeFromFile, } from "./read.js";
|
|
23
|
+
export { createReadPathSet } from "./read-path-set.js";
|
|
24
|
+
export { compileSearchPattern, createLocalRepositoryOperations, DEFAULT_REPO_EXCLUDE, isBinaryBuffer, RepositoryError, resolveRepoPath, resolveRepositoryLimits, toRepoRelative, } from "./repository.js";
|
|
25
|
+
export { createGitAwareRepositoryOperations, parseGitLsFilesZ } from "./git-aware-repository.js";
|
|
26
|
+
export { applyTextEdits, createLanguageIntelligence, encodeLspFrame, LanguageIntelligenceError, LspFrameError, LspFrameReader, resolveLanguageIntelligenceLimits, } from "./language/index.js";
|
|
27
|
+
export { createGitHubForge, ForgeError, resolveForgeLimits } from "./forge/index.js";
|
|
28
|
+
export { createProcessSessions, ProcessSessionError, resolveProcessSessionLimits, } from "./process/index.js";
|
|
12
29
|
export { createRepoSearchTool } from "./search.js";
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export { createGitTools, createGitStatusTool, createGitDiffTool, createGitBranchTool, createGitWorktreeTool, createGitApplyTool, createGitCommitTool, createGitPrHandoffTool, } from "./git-tools.js";
|
|
16
|
-
export { createCodingCheckTool } from "./checks.js";
|
|
17
|
-
export { createDirectoryArtifactWriter, createTempArtifactWriter, sha256Hex } from "./artifacts.js";
|
|
18
|
-
export { CODING_CHECKPOINT_SCHEMA_VERSION, CODING_STATE_KEY, CodingCheckpointError, assertCodingResumeAllowed, buildCodingCheckpointMetadata, codingCheckpointStatePatch, codingPlanPathForTask, createCodingArtifactRef, createCodingPlanMarkdown, fingerprintJson, parseCodingPlanTodos, readCodingCheckpointFromState, readCodingPlanFile, resolveCodingCheckpointLimits, validateCodingCheckpointMetadata, verifyCodingArtifactBytes, writeCodingPlanFile, } from "./coding-checkpoint.js";
|
|
30
|
+
export { createLocalBashOperations, createShellTool, getShellConfig, killProcessTree, waitForChildProcess, } from "./shell.js";
|
|
31
|
+
export { createWriteTool } from "./write.js";
|
|
19
32
|
// --- generic primitives (re-exported for hosts that want them) ---
|
|
20
|
-
export { withFileMutationQueue } from "./file-mutation-queue.js";
|
|
21
33
|
export { enforceExecutionPolicy } from "./execution-policy.js";
|
|
22
|
-
export {
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
import { createWriteTool } from "./write.js";
|
|
34
|
+
export { withFileMutationQueue } from "./file-mutation-queue.js";
|
|
35
|
+
export { DEFAULT_CHECK_TIMEOUT_MS, DEFAULT_GIT_TIMEOUT_MS, DEFAULT_MAX_BYTES, DEFAULT_MAX_CHECK_CONCURRENCY, DEFAULT_MAX_CHECK_DIAGNOSTIC_LINES, DEFAULT_MAX_CHECK_NAMES, DEFAULT_MAX_CHECK_OUTPUT_BYTES, DEFAULT_MAX_CHECK_SUMMARY_BYTES, DEFAULT_MAX_CODING_ARTIFACT_BYTES, DEFAULT_MAX_CODING_ARTIFACTS, DEFAULT_MAX_CODING_CHECKPOINT_BYTES, DEFAULT_MAX_EDIT_FILE_BYTES, DEFAULT_MAX_EDIT_INPUT_BYTES, DEFAULT_MAX_EDITS, DEFAULT_MAX_FORGE_COMMENTS_PER_REVIEW, DEFAULT_MAX_FORGE_PAGES_PER_OPERATION, DEFAULT_MAX_FORGE_PAYLOAD_BYTES, DEFAULT_MAX_FORGE_REQUEST_CONCURRENCY, DEFAULT_MAX_FORGE_REQUEST_TIMEOUT_MS, DEFAULT_MAX_GIT_CHANGED_FILES, DEFAULT_MAX_GIT_DIFF_LINES, DEFAULT_MAX_GIT_MESSAGE_BYTES, DEFAULT_MAX_GIT_OUTPUT_BYTES, DEFAULT_MAX_LS_FILES_OUTPUT_BYTES, DEFAULT_MAX_LSP_DIAGNOSTICS_PER_FILE, DEFAULT_MAX_LSP_MESSAGE_BYTES, DEFAULT_MAX_LSP_PENDING_REQUESTS, DEFAULT_MAX_LSP_RESULTS_PER_QUERY, DEFAULT_MAX_LSP_SERVERS, DEFAULT_MAX_LSP_TIMEOUT_MS, DEFAULT_MAX_GIT_PATCH_BYTES, DEFAULT_MAX_GIT_PATHS, DEFAULT_MAX_GIT_REF_BYTES, DEFAULT_MAX_GIT_WORKTREES, DEFAULT_MAX_LINES, DEFAULT_MAX_PLAN_BYTES, DEFAULT_MAX_PR_COMMITS, DEFAULT_MAX_PR_HANDOFF_BYTES, DEFAULT_MAX_PROCESS_INPUT_BYTES, DEFAULT_MAX_PROCESS_LIFETIME_MS, DEFAULT_MAX_PROCESS_OUTPUT_CHUNK_BYTES, DEFAULT_MAX_PROCESS_SESSIONS, DEFAULT_MAX_PROCESS_TOTAL_OUTPUT_BYTES, DEFAULT_MAX_REPO_CONCURRENCY, DEFAULT_MAX_REPO_DEPTH, DEFAULT_MAX_REPO_ENTRIES, DEFAULT_MAX_REPO_FILES, DEFAULT_MAX_REPO_RESULTS, DEFAULT_MAX_SEARCH_CONTEXT_LINES, DEFAULT_MAX_SEARCH_FILE_BYTES, DEFAULT_MAX_SEARCH_LINE_BYTES, DEFAULT_MAX_SEARCH_MATCHES, DEFAULT_MAX_SEARCH_PATTERN_BYTES, DEFAULT_MAX_SEARCH_SCAN_BYTES, DEFAULT_MAX_SEARCH_TIME_MS, DEFAULT_MAX_TEXT_SCAN_BYTES, DEFAULT_MAX_TODO_TEXT_BYTES, DEFAULT_MAX_TODOS, DEFAULT_MAX_TOTAL_OUTPUT_BYTES, DEFAULT_MAX_WRITE_BYTES, DEFAULT_SHELL_TIMEOUT_SECONDS, HARD_CHECK_TIMEOUT_MS, HARD_GIT_TIMEOUT_MS, HARD_MAX_BYTES, HARD_MAX_CHECK_CONCURRENCY, HARD_MAX_CHECK_DIAGNOSTIC_LINES, HARD_MAX_CHECK_NAMES, HARD_MAX_CHECK_OUTPUT_BYTES, HARD_MAX_CHECK_SUMMARY_BYTES, HARD_MAX_CODING_ARTIFACT_BYTES, HARD_MAX_CODING_ARTIFACTS, HARD_MAX_CODING_CHECKPOINT_BYTES, HARD_MAX_EDIT_FILE_BYTES, HARD_MAX_EDIT_INPUT_BYTES, HARD_MAX_EDITS, HARD_MAX_FORGE_COMMENTS_PER_REVIEW, HARD_MAX_FORGE_PAGES_PER_OPERATION, HARD_MAX_FORGE_PAYLOAD_BYTES, HARD_MAX_FORGE_REQUEST_CONCURRENCY, HARD_MAX_FORGE_REQUEST_TIMEOUT_MS, HARD_MAX_GIT_CHANGED_FILES, HARD_MAX_GIT_DIFF_LINES, HARD_MAX_GIT_MESSAGE_BYTES, HARD_MAX_GIT_OUTPUT_BYTES, HARD_MAX_LS_FILES_OUTPUT_BYTES, HARD_MAX_LSP_DIAGNOSTICS_PER_FILE, HARD_MAX_LSP_MESSAGE_BYTES, HARD_MAX_LSP_PENDING_REQUESTS, HARD_MAX_LSP_RESULTS_PER_QUERY, HARD_MAX_LSP_SERVERS, HARD_MAX_LSP_TIMEOUT_MS, HARD_MAX_GIT_PATCH_BYTES, HARD_MAX_GIT_PATHS, HARD_MAX_GIT_REF_BYTES, HARD_MAX_GIT_WORKTREES, HARD_MAX_IMAGE_BYTES, HARD_MAX_LINES, HARD_MAX_PLAN_BYTES, HARD_MAX_PR_COMMITS, HARD_MAX_PR_HANDOFF_BYTES, HARD_MAX_PROCESS_INPUT_BYTES, HARD_MAX_PROCESS_LIFETIME_MS, HARD_MAX_PROCESS_OUTPUT_CHUNK_BYTES, HARD_MAX_PROCESS_SESSIONS, HARD_MAX_PROCESS_TOTAL_OUTPUT_BYTES, HARD_MAX_REPO_CONCURRENCY, HARD_MAX_REPO_DEPTH, HARD_MAX_REPO_ENTRIES, HARD_MAX_REPO_FILES, HARD_MAX_REPO_RESULTS, HARD_MAX_SEARCH_CONTEXT_LINES, HARD_MAX_SEARCH_FILE_BYTES, HARD_MAX_SEARCH_LINE_BYTES, HARD_MAX_SEARCH_MATCHES, HARD_MAX_SEARCH_PATTERN_BYTES, HARD_MAX_SEARCH_SCAN_BYTES, HARD_MAX_SEARCH_TIME_MS, HARD_MAX_TEXT_SCAN_BYTES, HARD_MAX_TODO_TEXT_BYTES, HARD_MAX_TODOS, HARD_MAX_TOTAL_OUTPUT_BYTES, HARD_MAX_WRITE_BYTES, HARD_SHELL_TIMEOUT_SECONDS, LSP_RESTARTS_PER_SERVER, } from "./limits.js";
|
|
36
|
+
import { createDeleteTool } from "./delete.js";
|
|
26
37
|
import { createEditTool } from "./edit.js";
|
|
38
|
+
import { createGlobTool } from "./glob.js";
|
|
27
39
|
import { createRepoListTool } from "./list.js";
|
|
40
|
+
import { createMoveTool } from "./move.js";
|
|
41
|
+
import { createReadTool } from "./read.js";
|
|
28
42
|
import { createRepoSearchTool } from "./search.js";
|
|
43
|
+
import { createShellTool } from "./shell.js";
|
|
44
|
+
import { createWriteTool } from "./write.js";
|
|
29
45
|
function withSharedExecutionPolicy(toolOptions, shared) {
|
|
30
46
|
if (!shared)
|
|
31
47
|
return (toolOptions ?? {});
|
|
@@ -42,12 +58,15 @@ function withRepositoryDefaults(toolOptions, shared) {
|
|
|
42
58
|
};
|
|
43
59
|
}
|
|
44
60
|
/**
|
|
45
|
-
* Full coding tool set: `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`.
|
|
61
|
+
* Full coding tool set: `shell`, `read`, `write`, `edit`, `repo_list`, `repo_search`, `glob`, `delete`, `move`.
|
|
62
|
+
* Opt-in tools (`createGitTools`, `createAskUserDecisionTool`, `createCodingCheckTool`)
|
|
63
|
+
* stay out — hosts register them explicitly.
|
|
46
64
|
*/
|
|
47
65
|
export function createCodingTools(cwd, options) {
|
|
48
66
|
const policy = options?.executionPolicy;
|
|
49
67
|
const listOpts = withRepositoryDefaults(options?.list, options?.repository);
|
|
50
68
|
const searchOpts = withRepositoryDefaults(options?.search, options?.repository);
|
|
69
|
+
const globOpts = withRepositoryDefaults(options?.glob, options?.repository);
|
|
51
70
|
return [
|
|
52
71
|
createShellTool(cwd, withSharedExecutionPolicy(options?.shell, policy)),
|
|
53
72
|
createReadTool(cwd, withSharedExecutionPolicy(options?.read, policy)),
|
|
@@ -55,20 +74,25 @@ export function createCodingTools(cwd, options) {
|
|
|
55
74
|
createEditTool(cwd, withSharedExecutionPolicy(options?.edit, policy)),
|
|
56
75
|
createRepoListTool(cwd, withSharedExecutionPolicy(listOpts, policy)),
|
|
57
76
|
createRepoSearchTool(cwd, withSharedExecutionPolicy(searchOpts, policy)),
|
|
77
|
+
createGlobTool(cwd, withSharedExecutionPolicy(globOpts, policy)),
|
|
78
|
+
createDeleteTool(cwd, withSharedExecutionPolicy(options?.delete, policy)),
|
|
79
|
+
createMoveTool(cwd, withSharedExecutionPolicy(options?.move, policy)),
|
|
58
80
|
];
|
|
59
81
|
}
|
|
60
82
|
/**
|
|
61
|
-
* Read-only subset: `read`, `repo_list`, `repo_search`.
|
|
83
|
+
* Read-only subset: `read`, `repo_list`, `repo_search`, `glob`.
|
|
62
84
|
* Deliberate 0.0.9 expansion from the previous `read`-only set.
|
|
63
85
|
*/
|
|
64
86
|
export function createReadOnlyTools(cwd, options) {
|
|
65
87
|
const policy = options?.executionPolicy;
|
|
66
88
|
const listOpts = withRepositoryDefaults(options?.list, options?.repository);
|
|
67
89
|
const searchOpts = withRepositoryDefaults(options?.search, options?.repository);
|
|
90
|
+
const globOpts = withRepositoryDefaults(options?.glob, options?.repository);
|
|
68
91
|
return [
|
|
69
92
|
createReadTool(cwd, withSharedExecutionPolicy(options?.read, policy)),
|
|
70
93
|
createRepoListTool(cwd, withSharedExecutionPolicy(listOpts, policy)),
|
|
71
94
|
createRepoSearchTool(cwd, withSharedExecutionPolicy(searchOpts, policy)),
|
|
95
|
+
createGlobTool(cwd, withSharedExecutionPolicy(globOpts, policy)),
|
|
72
96
|
];
|
|
73
97
|
}
|
|
74
98
|
/** Every tool this package provides — identical to {@link createCodingTools}. */
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal JSON-RPC LSP client over child stdio (LSP 3.17 framing).
|
|
3
|
+
* Lazy start; bounded pending requests, message bytes, timeout, restart budget.
|
|
4
|
+
*/
|
|
5
|
+
import { type ResolvedLanguageIntelligenceLimits } from "./types.js";
|
|
6
|
+
export interface LspServerSpec {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly command: string;
|
|
9
|
+
readonly args: readonly string[];
|
|
10
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
11
|
+
readonly cwd: string;
|
|
12
|
+
readonly rootUri: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class LspClient {
|
|
15
|
+
readonly spec: LspServerSpec;
|
|
16
|
+
private readonly limits;
|
|
17
|
+
private child;
|
|
18
|
+
private reader;
|
|
19
|
+
private nextId;
|
|
20
|
+
private pending;
|
|
21
|
+
private startPromise;
|
|
22
|
+
private disposed;
|
|
23
|
+
private shuttingDown;
|
|
24
|
+
private capabilities;
|
|
25
|
+
/** file URI → latest diagnostics payload from publishDiagnostics */
|
|
26
|
+
readonly diagnosticsByUri: Map<string, unknown>;
|
|
27
|
+
private readonly onUnexpectedExit;
|
|
28
|
+
constructor(spec: LspServerSpec, limits: ResolvedLanguageIntelligenceLimits, hooks?: {
|
|
29
|
+
onUnexpectedExit?: () => void;
|
|
30
|
+
});
|
|
31
|
+
get started(): boolean;
|
|
32
|
+
ensureStarted(signal?: AbortSignal): Promise<void>;
|
|
33
|
+
request(method: string, params: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
34
|
+
notify(method: string, params: unknown): void;
|
|
35
|
+
hasCapability(key: string): boolean;
|
|
36
|
+
dispose(): Promise<void>;
|
|
37
|
+
private write;
|
|
38
|
+
private spawnAndInitialize;
|
|
39
|
+
/** Internal request used during initialize before ensureStarted recursion. */
|
|
40
|
+
private requestUnlocked;
|
|
41
|
+
private onMessage;
|
|
42
|
+
private failTransport;
|
|
43
|
+
private rejectAll;
|
|
44
|
+
}
|