patchwarden 1.1.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +41 -7
- package/README.md +36 -9
- package/dist/controlCenter.js +197 -1
- package/dist/direct/directSessionStore.d.ts +2 -0
- package/dist/direct/directVerification.js +7 -0
- package/dist/doctor.js +1 -1
- package/dist/policy/projectPolicy.d.ts +55 -0
- package/dist/policy/projectPolicy.js +286 -0
- package/dist/smoke-test.js +8 -8
- package/dist/test/unit/evidence-pack.test.d.ts +1 -0
- package/dist/test/unit/evidence-pack.test.js +130 -0
- package/dist/test/unit/project-policy-release-mode.test.d.ts +1 -0
- package/dist/test/unit/project-policy-release-mode.test.js +125 -0
- package/dist/test/unit/run-task-loop.test.d.ts +1 -0
- package/dist/test/unit/run-task-loop.test.js +380 -0
- package/dist/test/unit/schema-drift-check.test.js +10 -9
- package/dist/tools/evidencePack.d.ts +39 -0
- package/dist/tools/evidencePack.js +168 -0
- package/dist/tools/recommendAgentForTask.d.ts +19 -0
- package/dist/tools/recommendAgentForTask.js +56 -0
- package/dist/tools/registry.js +376 -2
- package/dist/tools/releaseMode.d.ts +50 -0
- package/dist/tools/releaseMode.js +370 -0
- package/dist/tools/runDirectVerificationBundle.d.ts +26 -0
- package/dist/tools/runDirectVerificationBundle.js +64 -0
- package/dist/tools/runTaskLoop.d.ts +57 -0
- package/dist/tools/runTaskLoop.js +417 -0
- package/dist/tools/runVerification.d.ts +4 -0
- package/dist/tools/runVerification.js +4 -0
- package/dist/tools/safeViews.d.ts +6 -0
- package/dist/tools/safeViews.js +2 -0
- package/dist/tools/taskLineage.d.ts +91 -0
- package/dist/tools/taskLineage.js +175 -0
- package/dist/tools/toolCatalog.d.ts +2 -2
- package/dist/tools/toolCatalog.js +6 -0
- package/dist/tools/toolRegistry.js +110 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/docs/chatgpt-usage.md +31 -0
- package/docs/control-center/README.md +9 -0
- package/package.json +2 -2
- package/scripts/checks/control-center-smoke.js +87 -0
- package/scripts/checks/control-smoke.js +2 -2
- package/scripts/checks/mcp-manifest-check.js +12 -0
- package/scripts/checks/mcp-smoke.js +31 -7
- package/scripts/checks/watcher-supervisor-smoke.js +1 -1
- package/src/controlCenter.ts +198 -1
- package/src/direct/directSessionStore.ts +2 -0
- package/src/direct/directVerification.ts +7 -0
- package/src/doctor.ts +1 -1
- package/src/policy/projectPolicy.ts +344 -0
- package/src/smoke-test.ts +5 -5
- package/src/test/unit/evidence-pack.test.ts +142 -0
- package/src/test/unit/project-policy-release-mode.test.ts +156 -0
- package/src/test/unit/run-task-loop.test.ts +425 -0
- package/src/test/unit/schema-drift-check.test.ts +11 -9
- package/src/tools/evidencePack.ts +205 -0
- package/src/tools/listWorkspace.ts +71 -71
- package/src/tools/recommendAgentForTask.ts +79 -0
- package/src/tools/registry.ts +405 -2
- package/src/tools/releaseMode.ts +450 -0
- package/src/tools/runDirectVerificationBundle.ts +98 -0
- package/src/tools/runTaskLoop.ts +526 -0
- package/src/tools/runVerification.ts +8 -0
- package/src/tools/safeViews.ts +2 -0
- package/src/tools/taskLineage.ts +300 -0
- package/src/tools/toolCatalog.ts +6 -0
- package/src/tools/toolRegistry.ts +110 -0
- package/src/version.ts +2 -2
- package/ui/pages/dashboard.html +143 -2
package/src/tools/registry.ts
CHANGED
|
@@ -26,6 +26,10 @@ import { listAgents } from "../tools/listAgents.js";
|
|
|
26
26
|
import { healthCheck } from "../tools/healthCheck.js";
|
|
27
27
|
import { getTaskSummary } from "../tools/getTaskSummary.js";
|
|
28
28
|
import { waitForTask } from "../tools/waitForTask.js";
|
|
29
|
+
import { runTaskLoop } from "./runTaskLoop.js";
|
|
30
|
+
import { getTaskLineage } from "./taskLineage.js";
|
|
31
|
+
import { exportTaskEvidencePack } from "./evidencePack.js";
|
|
32
|
+
import { recommendAgentForTask } from "./recommendAgentForTask.js";
|
|
29
33
|
import { errorPayload, PatchWardenError } from "../errors.js";
|
|
30
34
|
import { auditTask } from "../tools/auditTask.js";
|
|
31
35
|
import { safeStatus } from "../tools/safeStatus.js";
|
|
@@ -49,6 +53,7 @@ import { createDirectSession } from "../tools/createDirectSession.js";
|
|
|
49
53
|
import { searchWorkspace } from "../tools/searchWorkspace.js";
|
|
50
54
|
import { applyPatch } from "../tools/applyPatch.js";
|
|
51
55
|
import { runVerification } from "../tools/runVerification.js";
|
|
56
|
+
import { runDirectVerificationBundle } from "../tools/runDirectVerificationBundle.js";
|
|
52
57
|
import { finalizeDirectSession } from "../tools/finalizeDirectSession.js";
|
|
53
58
|
import { auditSession } from "../tools/auditSession.js";
|
|
54
59
|
import { syncFile } from "../tools/syncFile.js";
|
|
@@ -58,6 +63,13 @@ import { exportHandoff } from "../goal/handoffExport.js";
|
|
|
58
63
|
import { acceptSubgoal, rejectSubgoal, summarizeGoalProgress } from "../goal/goalProgress.js";
|
|
59
64
|
import { createSubgoalTask } from "./goalSubgoalTask.js";
|
|
60
65
|
import { checkReleaseGate } from "./checkReleaseGate.js";
|
|
66
|
+
import {
|
|
67
|
+
getProjectPolicyTool,
|
|
68
|
+
releaseCheck,
|
|
69
|
+
releaseCleanup,
|
|
70
|
+
releasePrepare,
|
|
71
|
+
releaseVerify,
|
|
72
|
+
} from "./releaseMode.js";
|
|
61
73
|
import { mergeWorktreeTool } from "./mergeWorktree.js";
|
|
62
74
|
import { discardWorktreeTool } from "./discardWorktree.js";
|
|
63
75
|
import { TASK_TEMPLATE_NAMES } from "./taskTemplates.js";
|
|
@@ -84,10 +96,12 @@ export interface ToolDef {
|
|
|
84
96
|
export function getToolDefs(): ToolDef[] {
|
|
85
97
|
const config = getConfig();
|
|
86
98
|
const agentNames = Object.keys(config.agents).sort();
|
|
99
|
+
const routableAgentNames = [...agentNames, "auto"];
|
|
87
100
|
const agentDescription = agentNames.length > 0
|
|
88
|
-
? `Configured local agent name. Available agents: ${agentNames.map((name) => JSON.stringify(name)).join(", ")}
|
|
101
|
+
? `Configured local agent name. Available agents: ${agentNames.map((name) => JSON.stringify(name)).join(", ")}. run_task_loop also accepts "auto" for bounded routing.`
|
|
89
102
|
: "Configured local agent name. No agents are currently configured.";
|
|
90
103
|
const testCommands = getAllConfiguredTestCommands(config).sort();
|
|
104
|
+
const directCommands = getAllConfiguredDirectCommands(config);
|
|
91
105
|
const tools: ToolDef[] = [
|
|
92
106
|
{
|
|
93
107
|
name: "save_plan",
|
|
@@ -201,6 +215,178 @@ export function getToolDefs(): ToolDef[] {
|
|
|
201
215
|
required: [],
|
|
202
216
|
},
|
|
203
217
|
},
|
|
218
|
+
{
|
|
219
|
+
name: "run_task_loop",
|
|
220
|
+
description:
|
|
221
|
+
"Run a guarded PatchWarden task loop by composing create_task, wait_for_task, safe summaries, and audit_task. It does not bypass the watcher, command allow-list, workspace confinement, or confirmation boundaries. Returns only bounded structured lineage and final status.",
|
|
222
|
+
inputSchema: {
|
|
223
|
+
type: "object",
|
|
224
|
+
properties: {
|
|
225
|
+
repo_path: {
|
|
226
|
+
type: "string",
|
|
227
|
+
description: "Required repository path inside workspaceRoot. No implicit workspace-root fallback is allowed.",
|
|
228
|
+
},
|
|
229
|
+
goal: { type: "string", description: "Task goal to execute through the guarded loop." },
|
|
230
|
+
verify_commands: {
|
|
231
|
+
type: "array",
|
|
232
|
+
minItems: 1,
|
|
233
|
+
maxItems: 20,
|
|
234
|
+
items: {
|
|
235
|
+
type: "string",
|
|
236
|
+
...(testCommands.length > 0 ? { enum: testCommands } : {}),
|
|
237
|
+
},
|
|
238
|
+
description: "Exact-match verification commands. The loop reuses create_task validation and will not run commands outside the allow-list.",
|
|
239
|
+
},
|
|
240
|
+
agent: {
|
|
241
|
+
type: "string",
|
|
242
|
+
description: agentDescription,
|
|
243
|
+
...(agentNames.length > 0 ? { enum: routableAgentNames } : {}),
|
|
244
|
+
},
|
|
245
|
+
template: {
|
|
246
|
+
type: "string",
|
|
247
|
+
enum: ["inspect_only", "feature_small", "release_check"],
|
|
248
|
+
default: "feature_small",
|
|
249
|
+
description: "Initial guarded task template. Follow-up repair tasks use fix_tests automatically when verification fails.",
|
|
250
|
+
},
|
|
251
|
+
max_iterations: {
|
|
252
|
+
type: "integer",
|
|
253
|
+
minimum: 1,
|
|
254
|
+
maximum: 5,
|
|
255
|
+
default: 3,
|
|
256
|
+
description: "Maximum total main/fix task attempts.",
|
|
257
|
+
},
|
|
258
|
+
task_timeout_seconds: {
|
|
259
|
+
type: "integer",
|
|
260
|
+
minimum: 1,
|
|
261
|
+
maximum: config.maxTaskTimeoutSeconds,
|
|
262
|
+
default: config.defaultTaskTimeoutSeconds,
|
|
263
|
+
description: `Per-task wait budget in seconds (default ${config.defaultTaskTimeoutSeconds}, max ${config.maxTaskTimeoutSeconds}).`,
|
|
264
|
+
},
|
|
265
|
+
auto_fix_tests: {
|
|
266
|
+
type: "boolean",
|
|
267
|
+
default: true,
|
|
268
|
+
description: "When true, create a fix_tests follow-up task after failed_verification until max_iterations is reached.",
|
|
269
|
+
},
|
|
270
|
+
auto_cleanup_artifacts: {
|
|
271
|
+
type: "boolean",
|
|
272
|
+
default: true,
|
|
273
|
+
description: "Records cleanup intent in lineage. Low-risk cleanup remains handled by runTask post-task cleanup.",
|
|
274
|
+
},
|
|
275
|
+
stop_on_high_risk: {
|
|
276
|
+
type: "boolean",
|
|
277
|
+
default: true,
|
|
278
|
+
description: "When true, stop immediately on non-policy high-risk audit evidence. Scope, policy, sensitive-path, release/publish, and confirmation boundaries always stop regardless of this flag.",
|
|
279
|
+
},
|
|
280
|
+
direct_verify: {
|
|
281
|
+
type: "boolean",
|
|
282
|
+
default: false,
|
|
283
|
+
description: "When true, run an independent Direct verification session after the guarded task/audit succeeds. Direct never patches files in this loop.",
|
|
284
|
+
},
|
|
285
|
+
direct_verify_commands: {
|
|
286
|
+
type: "array",
|
|
287
|
+
minItems: 1,
|
|
288
|
+
maxItems: 20,
|
|
289
|
+
items: {
|
|
290
|
+
type: "string",
|
|
291
|
+
...(directCommands.length > 0 ? { enum: directCommands } : {}),
|
|
292
|
+
},
|
|
293
|
+
description: "Optional Direct verification commands. Defaults to verify_commands and still must pass the Direct command allow-list.",
|
|
294
|
+
},
|
|
295
|
+
direct_verify_timeout_seconds: {
|
|
296
|
+
type: "integer",
|
|
297
|
+
minimum: 1,
|
|
298
|
+
maximum: Math.min(config.maxTaskTimeoutSeconds, config.directSessionTtlSeconds),
|
|
299
|
+
default: 120,
|
|
300
|
+
description: "Per-command timeout for Direct verification.",
|
|
301
|
+
},
|
|
302
|
+
scope_files: {
|
|
303
|
+
type: "array",
|
|
304
|
+
maxItems: 50,
|
|
305
|
+
items: { type: "string" },
|
|
306
|
+
description: "Optional bounded file scope used only for agent routing hints.",
|
|
307
|
+
},
|
|
308
|
+
isolation_mode: {
|
|
309
|
+
type: "string",
|
|
310
|
+
enum: ["current_repo", "worktree"],
|
|
311
|
+
default: "current_repo",
|
|
312
|
+
description: "Use current_repo by default. worktree creates an isolated git worktree for the task but never auto-merges it.",
|
|
313
|
+
},
|
|
314
|
+
worktree_base_branch: {
|
|
315
|
+
type: "string",
|
|
316
|
+
description: "Optional base-branch label recorded in lineage. v1.5 does not auto-checkout or merge this branch.",
|
|
317
|
+
},
|
|
318
|
+
worktree_cleanup: {
|
|
319
|
+
type: "string",
|
|
320
|
+
enum: ["keep", "archive", "delete_ignored_only"],
|
|
321
|
+
default: "keep",
|
|
322
|
+
description: "Cleanup intent recorded in lineage. v1.5 keeps worktrees by default and does not auto-delete them.",
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
required: ["repo_path", "goal", "verify_commands"],
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: "recommend_agent_for_task",
|
|
330
|
+
description:
|
|
331
|
+
"Return a bounded read-only agent routing recommendation for a repo-scoped task. Does not start an agent, create a task, or read logs.",
|
|
332
|
+
inputSchema: {
|
|
333
|
+
type: "object",
|
|
334
|
+
properties: {
|
|
335
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
336
|
+
goal: { type: "string", description: "Task goal used for routing hints." },
|
|
337
|
+
scope_files: {
|
|
338
|
+
type: "array",
|
|
339
|
+
maxItems: 50,
|
|
340
|
+
items: { type: "string" },
|
|
341
|
+
description: "Optional bounded list of files or directories expected to be in scope.",
|
|
342
|
+
},
|
|
343
|
+
template: { type: "string", description: "Optional task template hint." },
|
|
344
|
+
risk_hint: { type: "string", description: "Optional compact risk hint text." },
|
|
345
|
+
},
|
|
346
|
+
required: ["repo_path", "goal"],
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: "get_task_lineage",
|
|
351
|
+
description:
|
|
352
|
+
"Read a bounded safe summary for a run_task_loop lineage. Does not return full logs, diffs, stdout, stderr, or markdown artifacts.",
|
|
353
|
+
inputSchema: {
|
|
354
|
+
type: "object",
|
|
355
|
+
properties: {
|
|
356
|
+
lineage_id: { type: "string", description: "Lineage ID returned by run_task_loop." },
|
|
357
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 8, description: "Maximum rounds/tasks/warnings to return." },
|
|
358
|
+
},
|
|
359
|
+
required: ["lineage_id"],
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
name: "export_task_evidence_pack",
|
|
364
|
+
description:
|
|
365
|
+
"Export a bounded evidence pack for a run_task_loop lineage. Writes evidence.json and EVIDENCE.md without stdout, stderr, full logs, full diff, or sensitive file contents.",
|
|
366
|
+
inputSchema: {
|
|
367
|
+
type: "object",
|
|
368
|
+
properties: {
|
|
369
|
+
lineage_id: { type: "string", description: "Lineage ID returned by run_task_loop." },
|
|
370
|
+
max_items: { type: "integer", minimum: 1, maximum: 50, default: 12, description: "Maximum rounds/tasks/warnings to include." },
|
|
371
|
+
},
|
|
372
|
+
required: ["lineage_id"],
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
name: "get_project_policy",
|
|
377
|
+
description:
|
|
378
|
+
"Read the bounded effective .patchwarden/project-policy.json summary for a repository. Missing policy returns safe defaults. Project policy never expands PatchWarden command allow-lists, workspace confinement, sensitive-path blocking, or watcher/audit boundaries.",
|
|
379
|
+
inputSchema: {
|
|
380
|
+
type: "object",
|
|
381
|
+
properties: {
|
|
382
|
+
repo_path: {
|
|
383
|
+
type: "string",
|
|
384
|
+
description: "Repository path inside workspaceRoot.",
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
required: ["repo_path"],
|
|
388
|
+
},
|
|
389
|
+
},
|
|
204
390
|
{
|
|
205
391
|
name: "get_task_status",
|
|
206
392
|
description: "Check task status, execution phase, watcher health, pending reason, current command, timeout, and change evidence.",
|
|
@@ -789,6 +975,91 @@ export function getToolDefs(): ToolDef[] {
|
|
|
789
975
|
required: ["repo_path", "target_stage"],
|
|
790
976
|
},
|
|
791
977
|
},
|
|
978
|
+
{
|
|
979
|
+
name: "release_check",
|
|
980
|
+
description:
|
|
981
|
+
"v1.3.0: Run a bounded release readiness check by wrapping the existing release gate. Local stages use existing guarded release-gate commands; remote stages are read-only. Does not publish, push, tag, or create a GitHub Release.",
|
|
982
|
+
inputSchema: {
|
|
983
|
+
type: "object",
|
|
984
|
+
properties: {
|
|
985
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
986
|
+
target_stage: {
|
|
987
|
+
type: "string",
|
|
988
|
+
enum: ["local_ready", "packed_ready", "published_verified", "github_release_verified", "ci_verified"],
|
|
989
|
+
default: "local_ready",
|
|
990
|
+
description: "Release gate stage to check. Defaults to local_ready.",
|
|
991
|
+
},
|
|
992
|
+
package_name: { type: "string", description: "npm package name for remote verification." },
|
|
993
|
+
version: { type: "string", description: "Version to verify. Defaults to project policy/package.json when omitted." },
|
|
994
|
+
github_repo: { type: "string", description: "GitHub repo in owner/repo form for release/CI verification." },
|
|
995
|
+
branch: { type: "string", default: "main", description: "Branch for CI verification." },
|
|
996
|
+
},
|
|
997
|
+
required: ["repo_path"],
|
|
998
|
+
},
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
name: "release_prepare",
|
|
1002
|
+
description:
|
|
1003
|
+
"v1.3.0: Run project-policy release preparation commands only when each command is already accepted by the existing PatchWarden command guard. Returns command status only, never stdout/stderr. Does not publish, push, tag, or create a GitHub Release.",
|
|
1004
|
+
inputSchema: {
|
|
1005
|
+
type: "object",
|
|
1006
|
+
properties: {
|
|
1007
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
1008
|
+
required_commands: {
|
|
1009
|
+
type: "array",
|
|
1010
|
+
maxItems: 10,
|
|
1011
|
+
items: {
|
|
1012
|
+
type: "string",
|
|
1013
|
+
...(testCommands.length > 0 ? { enum: testCommands } : {}),
|
|
1014
|
+
},
|
|
1015
|
+
description: "Optional exact-match release preparation commands. Defaults to project policy release_mode.required_commands.",
|
|
1016
|
+
},
|
|
1017
|
+
timeout_seconds: {
|
|
1018
|
+
type: "integer",
|
|
1019
|
+
minimum: 1,
|
|
1020
|
+
maximum: config.maxTaskTimeoutSeconds,
|
|
1021
|
+
default: 300,
|
|
1022
|
+
description: "Per-command timeout in seconds.",
|
|
1023
|
+
},
|
|
1024
|
+
},
|
|
1025
|
+
required: ["repo_path"],
|
|
1026
|
+
},
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
name: "release_verify",
|
|
1030
|
+
description:
|
|
1031
|
+
"v1.3.0: Verify npm/GitHub/CI release facts with read-only HTTPS requests. Does not run local shell commands and does not publish, push, tag, or create a GitHub Release.",
|
|
1032
|
+
inputSchema: {
|
|
1033
|
+
type: "object",
|
|
1034
|
+
properties: {
|
|
1035
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
1036
|
+
package_name: { type: "string", description: "npm package name. Defaults to package.json name." },
|
|
1037
|
+
version: { type: "string", description: "Version to verify. Defaults to project policy/package.json." },
|
|
1038
|
+
github_repo: { type: "string", description: "GitHub repo in owner/repo form. Defaults to package.json repository when available." },
|
|
1039
|
+
branch: { type: "string", default: "main", description: "Branch for CI verification." },
|
|
1040
|
+
},
|
|
1041
|
+
required: ["repo_path"],
|
|
1042
|
+
},
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
name: "release_cleanup",
|
|
1046
|
+
description:
|
|
1047
|
+
"v1.3.0: Clean up release artifacts using project-policy auto_cleanup rules. Defaults to dry_run=true. Non-dry-run cleanup only removes low-risk ignored/untracked artifacts under repo_path and writes an audit summary.",
|
|
1048
|
+
inputSchema: {
|
|
1049
|
+
type: "object",
|
|
1050
|
+
properties: {
|
|
1051
|
+
repo_path: { type: "string", description: "Repository path inside workspaceRoot." },
|
|
1052
|
+
dry_run: { type: "boolean", default: true, description: "Preview cleanup by default. Set false to remove eligible artifacts." },
|
|
1053
|
+
patterns: {
|
|
1054
|
+
type: "array",
|
|
1055
|
+
maxItems: 20,
|
|
1056
|
+
items: { type: "string" },
|
|
1057
|
+
description: "Optional cleanup patterns. Defaults to project policy auto_cleanup.patterns.",
|
|
1058
|
+
},
|
|
1059
|
+
},
|
|
1060
|
+
required: ["repo_path"],
|
|
1061
|
+
},
|
|
1062
|
+
},
|
|
792
1063
|
{
|
|
793
1064
|
name: "merge_worktree",
|
|
794
1065
|
description:
|
|
@@ -818,7 +1089,6 @@ export function getToolDefs(): ToolDef[] {
|
|
|
818
1089
|
];
|
|
819
1090
|
|
|
820
1091
|
// Direct session tools
|
|
821
|
-
const directCommands = getAllConfiguredDirectCommands(config);
|
|
822
1092
|
tools.push({
|
|
823
1093
|
name: "create_direct_session",
|
|
824
1094
|
description:
|
|
@@ -908,6 +1178,30 @@ export function getToolDefs(): ToolDef[] {
|
|
|
908
1178
|
},
|
|
909
1179
|
});
|
|
910
1180
|
|
|
1181
|
+
tools.push({
|
|
1182
|
+
name: "run_direct_verification_bundle",
|
|
1183
|
+
description:
|
|
1184
|
+
"Run multiple allowlisted Direct verification commands sequentially and return only bounded structured status. Omits stdout/stderr tails and log content.",
|
|
1185
|
+
inputSchema: {
|
|
1186
|
+
type: "object",
|
|
1187
|
+
properties: {
|
|
1188
|
+
session_id: { type: "string", description: "Direct session ID" },
|
|
1189
|
+
commands: {
|
|
1190
|
+
type: "array",
|
|
1191
|
+
minItems: 1,
|
|
1192
|
+
maxItems: 20,
|
|
1193
|
+
items: {
|
|
1194
|
+
type: "string",
|
|
1195
|
+
...(directCommands.length > 0 ? { enum: directCommands } : {}),
|
|
1196
|
+
},
|
|
1197
|
+
description: "Verification commands to run in order. Each command must be accepted by the existing Direct command guard.",
|
|
1198
|
+
},
|
|
1199
|
+
timeout_seconds: { type: "integer", minimum: 1, maximum: Math.min(config.maxTaskTimeoutSeconds, config.directSessionTtlSeconds), default: 120 },
|
|
1200
|
+
},
|
|
1201
|
+
required: ["session_id", "commands"],
|
|
1202
|
+
},
|
|
1203
|
+
});
|
|
1204
|
+
|
|
911
1205
|
tools.push({
|
|
912
1206
|
name: "finalize_direct_session",
|
|
913
1207
|
description:
|
|
@@ -1091,6 +1385,67 @@ async function handleToolCallInternal(name: string, args: Record<string, unknown
|
|
|
1091
1385
|
);
|
|
1092
1386
|
}
|
|
1093
1387
|
|
|
1388
|
+
case "run_task_loop": {
|
|
1389
|
+
return toResult(await runTaskLoop({
|
|
1390
|
+
repo_path: String(args?.repo_path ?? ""),
|
|
1391
|
+
goal: String(args?.goal ?? ""),
|
|
1392
|
+
verify_commands: Array.isArray(args?.verify_commands)
|
|
1393
|
+
? args.verify_commands.map((command) => String(command))
|
|
1394
|
+
: [],
|
|
1395
|
+
agent: args?.agent ? String(args.agent) : undefined,
|
|
1396
|
+
template:
|
|
1397
|
+
args?.template === "inspect_only" || args?.template === "release_check"
|
|
1398
|
+
? args.template
|
|
1399
|
+
: "feature_small",
|
|
1400
|
+
max_iterations: args?.max_iterations !== undefined ? Number(args.max_iterations) : undefined,
|
|
1401
|
+
task_timeout_seconds: args?.task_timeout_seconds !== undefined ? Number(args.task_timeout_seconds) : undefined,
|
|
1402
|
+
auto_fix_tests: args?.auto_fix_tests !== undefined ? Boolean(args.auto_fix_tests) : undefined,
|
|
1403
|
+
auto_cleanup_artifacts: args?.auto_cleanup_artifacts !== undefined ? Boolean(args.auto_cleanup_artifacts) : undefined,
|
|
1404
|
+
stop_on_high_risk: args?.stop_on_high_risk !== undefined ? Boolean(args.stop_on_high_risk) : undefined,
|
|
1405
|
+
direct_verify: args?.direct_verify !== undefined ? Boolean(args.direct_verify) : undefined,
|
|
1406
|
+
direct_verify_commands: Array.isArray(args?.direct_verify_commands)
|
|
1407
|
+
? args.direct_verify_commands.map((command) => String(command))
|
|
1408
|
+
: undefined,
|
|
1409
|
+
direct_verify_timeout_seconds: args?.direct_verify_timeout_seconds !== undefined ? Number(args.direct_verify_timeout_seconds) : undefined,
|
|
1410
|
+
scope_files: Array.isArray(args?.scope_files)
|
|
1411
|
+
? args.scope_files.map((entry) => String(entry))
|
|
1412
|
+
: undefined,
|
|
1413
|
+
isolation_mode: args?.isolation_mode === "worktree" ? "worktree" : "current_repo",
|
|
1414
|
+
worktree_base_branch: args?.worktree_base_branch ? String(args.worktree_base_branch) : undefined,
|
|
1415
|
+
worktree_cleanup:
|
|
1416
|
+
args?.worktree_cleanup === "archive" || args?.worktree_cleanup === "delete_ignored_only"
|
|
1417
|
+
? args.worktree_cleanup
|
|
1418
|
+
: "keep",
|
|
1419
|
+
}));
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
case "recommend_agent_for_task": {
|
|
1423
|
+
return toResult(recommendAgentForTask({
|
|
1424
|
+
repo_path: String(args?.repo_path ?? ""),
|
|
1425
|
+
goal: String(args?.goal ?? ""),
|
|
1426
|
+
scope_files: Array.isArray(args?.scope_files) ? args.scope_files.map((entry) => String(entry)) : undefined,
|
|
1427
|
+
template: args?.template ? String(args.template) : undefined,
|
|
1428
|
+
risk_hint: args?.risk_hint ? String(args.risk_hint) : undefined,
|
|
1429
|
+
}));
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
case "get_task_lineage": {
|
|
1433
|
+
return toResult(getTaskLineage(String(args?.lineage_id ?? ""), {
|
|
1434
|
+
max_items: args?.max_items !== undefined ? Number(args.max_items) : undefined,
|
|
1435
|
+
}));
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
case "export_task_evidence_pack": {
|
|
1439
|
+
return toResult(exportTaskEvidencePack({
|
|
1440
|
+
lineage_id: String(args?.lineage_id ?? ""),
|
|
1441
|
+
max_items: args?.max_items !== undefined ? Number(args.max_items) : undefined,
|
|
1442
|
+
}));
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
case "get_project_policy": {
|
|
1446
|
+
return toResult(getProjectPolicyTool(String(args?.repo_path ?? "")));
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1094
1449
|
case "get_task_status": {
|
|
1095
1450
|
return toResult(getTaskStatus(String(args?.task_id ?? "")));
|
|
1096
1451
|
}
|
|
@@ -1329,6 +1684,15 @@ async function handleToolCallInternal(name: string, args: Record<string, unknown
|
|
|
1329
1684
|
}));
|
|
1330
1685
|
}
|
|
1331
1686
|
|
|
1687
|
+
case "run_direct_verification_bundle": {
|
|
1688
|
+
guardDirectProfileEnabled();
|
|
1689
|
+
return toResult(await runDirectVerificationBundle({
|
|
1690
|
+
session_id: String(args?.session_id ?? ""),
|
|
1691
|
+
commands: Array.isArray(args?.commands) ? args.commands.map((command) => String(command)) : [],
|
|
1692
|
+
timeout_seconds: args?.timeout_seconds ? Number(args.timeout_seconds) : undefined,
|
|
1693
|
+
}));
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1332
1696
|
case "finalize_direct_session": {
|
|
1333
1697
|
guardDirectProfileEnabled();
|
|
1334
1698
|
return toResult(finalizeDirectSession({
|
|
@@ -1456,6 +1820,45 @@ async function handleToolCallInternal(name: string, args: Record<string, unknown
|
|
|
1456
1820
|
}));
|
|
1457
1821
|
}
|
|
1458
1822
|
|
|
1823
|
+
case "release_check": {
|
|
1824
|
+
return toResult(await releaseCheck({
|
|
1825
|
+
repo_path: String(args?.repo_path ?? ""),
|
|
1826
|
+
target_stage: String(args?.target_stage ?? "local_ready") as any,
|
|
1827
|
+
package_name: args?.package_name ? String(args.package_name) : undefined,
|
|
1828
|
+
version: args?.version ? String(args.version) : undefined,
|
|
1829
|
+
github_repo: args?.github_repo ? String(args.github_repo) : undefined,
|
|
1830
|
+
branch: args?.branch ? String(args.branch) : undefined,
|
|
1831
|
+
}));
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
case "release_prepare": {
|
|
1835
|
+
return toResult(releasePrepare({
|
|
1836
|
+
repo_path: String(args?.repo_path ?? ""),
|
|
1837
|
+
required_commands: Array.isArray(args?.required_commands)
|
|
1838
|
+
? args.required_commands.map(String)
|
|
1839
|
+
: undefined,
|
|
1840
|
+
timeout_seconds: args?.timeout_seconds !== undefined ? Number(args.timeout_seconds) : undefined,
|
|
1841
|
+
}));
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
case "release_verify": {
|
|
1845
|
+
return toResult(await releaseVerify({
|
|
1846
|
+
repo_path: String(args?.repo_path ?? ""),
|
|
1847
|
+
package_name: args?.package_name ? String(args.package_name) : undefined,
|
|
1848
|
+
version: args?.version ? String(args.version) : undefined,
|
|
1849
|
+
github_repo: args?.github_repo ? String(args.github_repo) : undefined,
|
|
1850
|
+
branch: args?.branch ? String(args.branch) : undefined,
|
|
1851
|
+
}));
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
case "release_cleanup": {
|
|
1855
|
+
return toResult(releaseCleanup({
|
|
1856
|
+
repo_path: String(args?.repo_path ?? ""),
|
|
1857
|
+
dry_run: args?.dry_run !== undefined ? Boolean(args.dry_run) : undefined,
|
|
1858
|
+
patterns: Array.isArray(args?.patterns) ? args.patterns.map(String) : undefined,
|
|
1859
|
+
}));
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1459
1862
|
case "merge_worktree": {
|
|
1460
1863
|
return toResult(mergeWorktreeTool({
|
|
1461
1864
|
worktree_id: String(args?.worktree_id ?? ""),
|