auditor-lambda 0.3.32 → 0.3.33
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.md +2 -1
- package/audit-code-wrapper-lib.mjs +30 -28
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +29 -94
- package/dist/mcp/server.js +11 -11
- package/dist/supervisor/operatorHandoff.js +1 -1
- package/dist/types/sessionConfig.d.ts +1 -0
- package/dist/validation/sessionConfig.js +4 -0
- package/package.json +1 -1
- package/skills/audit-code/audit-code.prompt.md +5 -0
package/README.md
CHANGED
|
@@ -138,7 +138,8 @@ audit-code next-step
|
|
|
138
138
|
|
|
139
139
|
This writes `.audit-artifacts/steps/current-step.json` and
|
|
140
140
|
`.audit-artifacts/steps/current-prompt.md`; hosts should follow only the
|
|
141
|
-
returned step prompt.
|
|
141
|
+
returned step prompt. MCP tools are compatibility adapters over this same
|
|
142
|
+
`next-step` contract rather than a separate orchestration path.
|
|
142
143
|
|
|
143
144
|
For an operator-side artifact consistency check:
|
|
144
145
|
|
|
@@ -580,16 +580,17 @@ function replaceBackslashes(value) {
|
|
|
580
580
|
function renderVSCodeAgentFile() {
|
|
581
581
|
return [
|
|
582
582
|
'---',
|
|
583
|
-
'description: Plan and orchestrate /audit-code
|
|
583
|
+
'description: Plan and orchestrate /audit-code through the next-step machine before making code changes.',
|
|
584
584
|
'---',
|
|
585
585
|
'',
|
|
586
586
|
'# Auditor Agent',
|
|
587
587
|
'',
|
|
588
|
-
'Use
|
|
588
|
+
'Use `audit-code next-step` as the primary integration surface for the audit workflow. The installed auditor MCP server is a compatibility adapter over the same step contract.',
|
|
589
589
|
'',
|
|
590
590
|
'When the user asks to run or continue `/audit-code`:',
|
|
591
591
|
'',
|
|
592
|
-
'-
|
|
592
|
+
'- run `audit-code next-step` directly when shell access is available',
|
|
593
|
+
'- if MCP is the only available integration, call `start_audit`, `get_status`, and `continue_audit`; those tools return the same one-step contract',
|
|
593
594
|
'- read `audit-code://handoff/current` and `audit-code://artifacts/current` when the audit blocks or you need current context',
|
|
594
595
|
'- prefer imported audit results and runtime updates over ad hoc manual state edits',
|
|
595
596
|
'- treat the deterministic audit report as the final source of truth once the audit completes',
|
|
@@ -615,7 +616,7 @@ function renderCodexMcpSetupGuide(root) {
|
|
|
615
616
|
`args = ["${replaceBackslashes(toRepoRelativePath(root, join(root, '.audit-code', 'install', MCP_LAUNCHER_FILENAME)))}"]`,
|
|
616
617
|
'```',
|
|
617
618
|
'',
|
|
618
|
-
'
|
|
619
|
+
'Prefer `audit-code next-step` directly. Use the registered `auditor` MCP tools only when shell access is unavailable; they return the same one-step contract.',
|
|
619
620
|
'',
|
|
620
621
|
].join('\n');
|
|
621
622
|
}
|
|
@@ -626,9 +627,9 @@ function renderCodexAutomationRecipe() {
|
|
|
626
627
|
'',
|
|
627
628
|
'Suggested recurring task:',
|
|
628
629
|
'',
|
|
629
|
-
'- Prompt: Re-run the autonomous audit workflow for this repository
|
|
630
|
+
'- Prompt: Re-run the autonomous audit workflow for this repository with `audit-code next-step`, summarize only new or regressed findings, and stop once the deterministic report is current.',
|
|
630
631
|
'- Cadence: daily on active branches or before release cut-offs',
|
|
631
|
-
'- Inputs: repository root
|
|
632
|
+
'- Inputs: repository root; the installed `auditor` MCP server is optional compatibility plumbing',
|
|
632
633
|
'',
|
|
633
634
|
'Use this recipe as a starting point for a Codex automation once the local workflow is stable in your environment.',
|
|
634
635
|
'',
|
|
@@ -706,16 +707,17 @@ function renderOpenCodePermissionConfig() {
|
|
|
706
707
|
const OPENCODE_MCP_COMMAND_TEMPLATE = [
|
|
707
708
|
'# audit-code',
|
|
708
709
|
'',
|
|
709
|
-
'Use
|
|
710
|
+
'Use `audit-code next-step` as the primary interface to the audit workflow.',
|
|
710
711
|
'',
|
|
711
|
-
'1.
|
|
712
|
-
'2.
|
|
713
|
-
'3.
|
|
714
|
-
'4.
|
|
712
|
+
'1. Run `audit-code next-step` directly when shell access is available.',
|
|
713
|
+
'2. If MCP is your only available interface, call `auditor_start_audit` or `auditor_continue_audit`; both return the same one-step contract.',
|
|
714
|
+
'3. Read `prompt_content` in the response and follow it.',
|
|
715
|
+
'4. When a step completes (not blocked), run `audit-code next-step` again or call `auditor_continue_audit` as the compatibility adapter.',
|
|
716
|
+
'5. Stop when the step instructions say to stop.',
|
|
715
717
|
'',
|
|
716
|
-
'
|
|
718
|
+
'Use the `task` tool or equivalent for subagent dispatch when the step tells you to fan out review work.',
|
|
717
719
|
'',
|
|
718
|
-
'If `auditor_start_audit` is
|
|
720
|
+
'If neither shell access nor `auditor_start_audit` is available, stop and report that no next-step interface is connected.',
|
|
719
721
|
].join('\n');
|
|
720
722
|
|
|
721
723
|
function renderOpenCodeProjectConfig(_root) {
|
|
@@ -939,7 +941,7 @@ function renderClaudeDesktopProjectTemplate() {
|
|
|
939
941
|
'Suggested project instructions:',
|
|
940
942
|
'',
|
|
941
943
|
'- Treat `/audit-code` as the canonical autonomous audit workflow for this repository.',
|
|
942
|
-
'- Prefer the installed auditor MCP tools over
|
|
944
|
+
'- Prefer `audit-code next-step`; use the installed auditor MCP tools only as a compatibility adapter over the same step contract.',
|
|
943
945
|
'- Read the operator handoff and artifact resources before asking for more context.',
|
|
944
946
|
'- Present the final deterministic audit report as work blocks first.',
|
|
945
947
|
'',
|
|
@@ -951,7 +953,7 @@ function renderClaudeDesktopProjectTemplate() {
|
|
|
951
953
|
'',
|
|
952
954
|
'Starter prompt:',
|
|
953
955
|
'',
|
|
954
|
-
'> Start `/audit-code` for this repository using
|
|
956
|
+
'> Start `/audit-code` for this repository using `audit-code next-step`. Continue until the audit is complete or blocked for operator input, and summarize the current handoff status before you stop.',
|
|
955
957
|
'',
|
|
956
958
|
].join('\n');
|
|
957
959
|
}
|
|
@@ -981,7 +983,7 @@ function renderAntigravityPlanningGuide(root) {
|
|
|
981
983
|
'',
|
|
982
984
|
'1. Open Antigravity in Planning mode.',
|
|
983
985
|
'2. Load the repo-local prompt asset or the AGENTS instructions before starting the audit conversation.',
|
|
984
|
-
'3. Ask Antigravity to use
|
|
986
|
+
'3. Ask Antigravity to use `audit-code next-step` directly. The installed auditor MCP server is available only as compatibility plumbing when direct shell access is unavailable.',
|
|
985
987
|
'4. Review Antigravity artifacts before accepting major code changes or imported evidence.',
|
|
986
988
|
'',
|
|
987
989
|
'Recommended repo-local paths:',
|
|
@@ -1266,9 +1268,9 @@ async function buildClaudeDesktopBundle(root, results) {
|
|
|
1266
1268
|
name: 'auditor-lambda',
|
|
1267
1269
|
display_name: 'Auditor Lambda',
|
|
1268
1270
|
version: packageVersion,
|
|
1269
|
-
description: '
|
|
1271
|
+
description: 'Compatibility MCP bundle for the /audit-code autonomous audit workflow.',
|
|
1270
1272
|
long_description:
|
|
1271
|
-
'Runs
|
|
1273
|
+
'Runs a local compatibility MCP adapter whose start and continue tools return the same audit-code next-step contract as the direct CLI loop.',
|
|
1272
1274
|
author: {
|
|
1273
1275
|
name: 'auditor-lambda',
|
|
1274
1276
|
url: 'https://github.com/OhOkThisIsFine/auditor-lambda',
|
|
@@ -1390,7 +1392,7 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1390
1392
|
support_level: 'supported',
|
|
1391
1393
|
setup_kind: 'local-mcp-bundle',
|
|
1392
1394
|
summary:
|
|
1393
|
-
'Install the generated local MCP bundle in Claude Desktop, then use the project template and prompt asset as supporting context.',
|
|
1395
|
+
'Install the generated local MCP compatibility bundle in Claude Desktop, then use the project template and prompt asset as supporting context.',
|
|
1394
1396
|
primary_path_key: 'claudeDesktopDxtPath',
|
|
1395
1397
|
supporting_path_keys: [
|
|
1396
1398
|
'claudeDesktopMcpbPath',
|
|
@@ -1400,7 +1402,7 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1400
1402
|
],
|
|
1401
1403
|
steps: [
|
|
1402
1404
|
'Open Claude Desktop Settings and install the generated `.dxt` bundle.',
|
|
1403
|
-
'Configure the repository root when prompted so the bundle can launch the local auditor MCP
|
|
1405
|
+
'Configure the repository root when prompted so the bundle can launch the local auditor MCP adapter.',
|
|
1404
1406
|
'Use the project template and prompt asset to kick off `/audit-code` in conversation.',
|
|
1405
1407
|
],
|
|
1406
1408
|
profile: {
|
|
@@ -1492,7 +1494,7 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1492
1494
|
support_level: 'supported',
|
|
1493
1495
|
setup_kind: 'global-command+project-mcp',
|
|
1494
1496
|
summary:
|
|
1495
|
-
'Use the global OpenCode `/audit-code` command installed by npm plus generated project MCP
|
|
1497
|
+
'Use the global OpenCode `/audit-code` command installed by npm plus generated project permissions; MCP is compatibility-only.',
|
|
1496
1498
|
primary_path_key: 'opencodeConfigPath',
|
|
1497
1499
|
supporting_path_keys: [
|
|
1498
1500
|
'agentsInstructionsPath',
|
|
@@ -1501,7 +1503,7 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1501
1503
|
steps: [
|
|
1502
1504
|
'Open this repository in OpenCode.',
|
|
1503
1505
|
'Use the global `/audit-code` command installed by `npm install -g auditor-lambda`.',
|
|
1504
|
-
'Let OpenCode load the generated `opencode.json` for the
|
|
1506
|
+
'Let OpenCode load the generated `opencode.json` for project permissions; the global command drives `audit-code next-step` directly.',
|
|
1505
1507
|
],
|
|
1506
1508
|
profile: {
|
|
1507
1509
|
writeOpenCode: true,
|
|
@@ -1519,7 +1521,7 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1519
1521
|
assertOpenCodeAuditPermissionConfig(config?.permission, 'permission');
|
|
1520
1522
|
assertOpenCodeAuditPermissionConfig(config?.agent?.auditor?.permission, 'agent.auditor.permission');
|
|
1521
1523
|
return {
|
|
1522
|
-
summary: 'OpenCode project config has audit permissions;
|
|
1524
|
+
summary: 'OpenCode project config has audit permissions; /audit-code is supplied by the global npm-installed config.',
|
|
1523
1525
|
path: assetPaths.opencodeConfigPath,
|
|
1524
1526
|
};
|
|
1525
1527
|
});
|
|
@@ -1531,7 +1533,7 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1531
1533
|
support_level: 'supported',
|
|
1532
1534
|
setup_kind: 'prompt+agent+mcp',
|
|
1533
1535
|
summary:
|
|
1534
|
-
'Use the generated prompt file
|
|
1536
|
+
'Use the generated prompt file and custom agent for next-step-first VS Code integration; workspace MCP is compatibility-only.',
|
|
1535
1537
|
primary_path_key: 'vscodePromptPath',
|
|
1536
1538
|
supporting_path_keys: [
|
|
1537
1539
|
'vscodeAgentPath',
|
|
@@ -1540,8 +1542,8 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1540
1542
|
],
|
|
1541
1543
|
steps: [
|
|
1542
1544
|
'Open this repository in VS Code with Copilot.',
|
|
1543
|
-
'
|
|
1544
|
-
'
|
|
1545
|
+
'Invoke `/audit-code` from the generated prompt or chat so the workflow calls `audit-code next-step` directly.',
|
|
1546
|
+
'Use the workspace MCP adapter only when direct shell access is unavailable.',
|
|
1545
1547
|
],
|
|
1546
1548
|
profile: {
|
|
1547
1549
|
writeVSCode: true,
|
|
@@ -1587,7 +1589,7 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1587
1589
|
support_level: 'supported',
|
|
1588
1590
|
setup_kind: 'agent-skill+gemini-command+planning-guide+mcp-ready',
|
|
1589
1591
|
summary:
|
|
1590
|
-
'Uses the project-scoped .agent/skills/audit-code/SKILL.md skill, the .gemini/commands/audit-code.toml slash command, the planning guide, and AGENTS instructions. The shared MCP launcher is
|
|
1592
|
+
'Uses the project-scoped .agent/skills/audit-code/SKILL.md skill, the .gemini/commands/audit-code.toml slash command, the planning guide, and AGENTS instructions. The shared MCP launcher is compatibility-only.',
|
|
1591
1593
|
primary_path_key: 'antigravitySkillPath',
|
|
1592
1594
|
supporting_path_keys: [
|
|
1593
1595
|
'geminiCommandPath',
|
|
@@ -1600,7 +1602,7 @@ const INSTALL_HOST_DEFINITIONS = {
|
|
|
1600
1602
|
'Open this repository in Antigravity.',
|
|
1601
1603
|
'The audit-code skill is automatically discovered from .agent/skills/audit-code/SKILL.md.',
|
|
1602
1604
|
'The /audit-code slash command is also available from .gemini/commands/audit-code.toml.',
|
|
1603
|
-
'Use the shared auditor MCP
|
|
1605
|
+
'Use `audit-code next-step` directly; use the shared auditor MCP launcher only when direct shell access is unavailable.',
|
|
1604
1606
|
],
|
|
1605
1607
|
profile: {
|
|
1606
1608
|
writeAntigravity: true,
|
package/dist/cli.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import type { SessionConfig } from "./types/sessionConfig.js";
|
|
|
2
2
|
type UiMode = "visible" | "headless";
|
|
3
3
|
declare function getFlag(argv: string[], name: string, fallback?: string): string | undefined;
|
|
4
4
|
declare function hasFlag(argv: string[], name: string): boolean;
|
|
5
|
+
export declare function resolveHostDispatchCapability(options: {
|
|
6
|
+
explicit?: boolean;
|
|
7
|
+
sessionConfig: SessionConfig;
|
|
8
|
+
env?: NodeJS.ProcessEnv;
|
|
9
|
+
}): boolean;
|
|
5
10
|
declare function getArtifactsDir(argv: string[]): string;
|
|
6
11
|
declare function getRootDir(argv: string[]): string;
|
|
7
12
|
declare function warnIfNotGitRepo(root: string): void;
|
package/dist/cli.js
CHANGED
|
@@ -87,6 +87,22 @@ function getOptionalBooleanFlag(argv, name) {
|
|
|
87
87
|
}
|
|
88
88
|
throw new Error(`${name} must be either true or false.`);
|
|
89
89
|
}
|
|
90
|
+
function optionalBooleanEnv(value) {
|
|
91
|
+
if (value === "true")
|
|
92
|
+
return true;
|
|
93
|
+
if (value === "false")
|
|
94
|
+
return false;
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
export function resolveHostDispatchCapability(options) {
|
|
98
|
+
if (options.explicit !== undefined) {
|
|
99
|
+
return options.explicit;
|
|
100
|
+
}
|
|
101
|
+
if (options.sessionConfig.host_can_dispatch_subagents !== undefined) {
|
|
102
|
+
return options.sessionConfig.host_can_dispatch_subagents;
|
|
103
|
+
}
|
|
104
|
+
return optionalBooleanEnv((options.env ?? process.env).AUDIT_CODE_HOST_CAN_DISPATCH) ?? false;
|
|
105
|
+
}
|
|
90
106
|
function toBase64Url(value) {
|
|
91
107
|
return Buffer.from(value, "utf8").toString("base64url");
|
|
92
108
|
}
|
|
@@ -535,50 +551,6 @@ function mergeAndIngestCommand(artifactsDir, runId) {
|
|
|
535
551
|
artifactsDir,
|
|
536
552
|
]);
|
|
537
553
|
}
|
|
538
|
-
function renderCapabilityCheckPrompt(params) {
|
|
539
|
-
const yesCommand = nextStepCommand(params.root, params.artifactsDir, [
|
|
540
|
-
"--host-can-dispatch-subagents",
|
|
541
|
-
"true",
|
|
542
|
-
]);
|
|
543
|
-
const noCommand = nextStepCommand(params.root, params.artifactsDir, [
|
|
544
|
-
"--host-can-dispatch-subagents",
|
|
545
|
-
"false",
|
|
546
|
-
]);
|
|
547
|
-
return [
|
|
548
|
-
"# audit-code capability check",
|
|
549
|
-
"",
|
|
550
|
-
"Decide one thing from the active toolset: does this host expose a callable subagent/delegation tool for source-code review, such as `task`, Agent, or an equivalent built-in subagent call?",
|
|
551
|
-
"",
|
|
552
|
-
"Do not run shell commands to answer this. Do not inspect packet prompts, schemas, or backend command catalogs.",
|
|
553
|
-
"",
|
|
554
|
-
"**If auditor MCP tools are available** (preferred — no shell required):",
|
|
555
|
-
"",
|
|
556
|
-
"Call `auditor_report_capability` with:",
|
|
557
|
-
"- `can_dispatch_subagents: true` if the `task` tool or equivalent subagent dispatch is available",
|
|
558
|
-
"- `can_dispatch_subagents: false` if not",
|
|
559
|
-
"- Optionally `can_restrict_subagent_tools: true` and/or `can_select_subagent_model: true`",
|
|
560
|
-
"- If the host documents or exposes a hard cap on simultaneously active subagents, include `max_active_subagents`.",
|
|
561
|
-
"",
|
|
562
|
-
"Read the `prompt_content` field in the tool response and follow it.",
|
|
563
|
-
"",
|
|
564
|
-
"**Fallback — if auditor MCP tools are not available:**",
|
|
565
|
-
"",
|
|
566
|
-
"If callable subagents are available, run:",
|
|
567
|
-
"",
|
|
568
|
-
` ${yesCommand}`,
|
|
569
|
-
"",
|
|
570
|
-
"If callable subagents are not available, run:",
|
|
571
|
-
"",
|
|
572
|
-
` ${noCommand}`,
|
|
573
|
-
"",
|
|
574
|
-
"If the host can also restrict tools per subagent or select models per subagent, add the matching `--host-can-restrict-subagent-tools true` or `--host-can-select-subagent-model true` flags to the same command. Omit those flags when unsure.",
|
|
575
|
-
"",
|
|
576
|
-
"If the host has a known active-subagent ceiling, add `--host-max-active-subagents <n>` to the same command. For Codex Desktop, use 6.",
|
|
577
|
-
"",
|
|
578
|
-
"After the command writes the next step, read and follow only its `prompt_path`.",
|
|
579
|
-
"",
|
|
580
|
-
].join("\n");
|
|
581
|
-
}
|
|
582
554
|
function renderDispatchReviewPrompt(params) {
|
|
583
555
|
const mergeCommand = mergeAndIngestCommand(params.artifactsDir, params.activeReviewRun.run_id);
|
|
584
556
|
const continueCommand = nextStepCommand(params.root, params.artifactsDir);
|
|
@@ -588,32 +560,21 @@ function renderDispatchReviewPrompt(params) {
|
|
|
588
560
|
const toolsLine = params.hostCanRestrictSubagentTools
|
|
589
561
|
? "Restrict review subagents to read/search plus the packet submit command named in their prompt. Do not give them source edit/write tools."
|
|
590
562
|
: "Do not ask the user about per-subagent tool restrictions; this host did not report a callable restriction facility.";
|
|
591
|
-
const runId = params.activeReviewRun.run_id;
|
|
592
563
|
const dispatchDataLines = params.dispatchQuotaPath
|
|
593
564
|
? [
|
|
594
|
-
"
|
|
565
|
+
"Read these generated files unless the current tool response already included equivalent `dispatch_plan_entries` and `dispatch_quota` fields:",
|
|
595
566
|
"",
|
|
596
|
-
|
|
567
|
+
` Dispatch plan: ${params.dispatchPlanPath}`,
|
|
568
|
+
` Dispatch quota: ${params.dispatchQuotaPath}`,
|
|
597
569
|
"",
|
|
598
|
-
"Use the `wave_size` from
|
|
570
|
+
"Use the `wave_size` from the quota data. If `cooldown_until` is non-null, wait until that timestamp before starting the first wave.",
|
|
599
571
|
"",
|
|
600
|
-
"`
|
|
572
|
+
"`host_concurrency_limit` records any detected hard host cap that contributed to `wave_size`.",
|
|
601
573
|
"",
|
|
602
574
|
"For each wave: use the `task` tool (or equivalent subagent dispatch) to launch up to `wave_size` subagents in parallel (one per entry), wait for all to finish, then start the next wave.",
|
|
603
|
-
"",
|
|
604
|
-
"**Fallback — if auditor MCP tools are not available:** Read both of these files:",
|
|
605
|
-
"",
|
|
606
|
-
` Dispatch plan: ${params.dispatchPlanPath}`,
|
|
607
|
-
` Dispatch quota: ${params.dispatchQuotaPath}`,
|
|
608
|
-
"",
|
|
609
|
-
"Apply the same wave logic from the quota file.",
|
|
610
575
|
]
|
|
611
576
|
: [
|
|
612
|
-
"
|
|
613
|
-
"",
|
|
614
|
-
"The dispatch plan entries are in the `dispatch_plan_entries` field of the tool response that returned this step.",
|
|
615
|
-
"",
|
|
616
|
-
"**Fallback — if auditor MCP tools are not available:** Read this dispatch plan JSON:",
|
|
577
|
+
"Read this generated dispatch plan unless the current tool response already included equivalent `dispatch_plan_entries`:",
|
|
617
578
|
"",
|
|
618
579
|
` ${params.dispatchPlanPath}`,
|
|
619
580
|
"",
|
|
@@ -637,9 +598,7 @@ function renderDispatchReviewPrompt(params) {
|
|
|
637
598
|
"",
|
|
638
599
|
"**After all waves complete:**",
|
|
639
600
|
"",
|
|
640
|
-
"
|
|
641
|
-
"",
|
|
642
|
-
"Fallback — if auditor MCP tools are not available, run exactly:",
|
|
601
|
+
"Run exactly:",
|
|
643
602
|
"",
|
|
644
603
|
` ${mergeCommand}`,
|
|
645
604
|
"",
|
|
@@ -1185,6 +1144,10 @@ async function cmdNextStep(argv) {
|
|
|
1185
1144
|
console.log(JSON.stringify(step, null, 2));
|
|
1186
1145
|
return;
|
|
1187
1146
|
}
|
|
1147
|
+
const hostCanDispatch = resolveHostDispatchCapability({
|
|
1148
|
+
explicit: hostCanDispatchSubagents,
|
|
1149
|
+
sessionConfig,
|
|
1150
|
+
});
|
|
1188
1151
|
const result = await runDeterministicForNextStep({
|
|
1189
1152
|
root,
|
|
1190
1153
|
artifactsDir,
|
|
@@ -1226,35 +1189,7 @@ async function cmdNextStep(argv) {
|
|
|
1226
1189
|
console.log(JSON.stringify(step, null, 2));
|
|
1227
1190
|
return;
|
|
1228
1191
|
}
|
|
1229
|
-
if (
|
|
1230
|
-
const yesCommand = nextStepCommand(root, artifactsDir, [
|
|
1231
|
-
"--host-can-dispatch-subagents",
|
|
1232
|
-
"true",
|
|
1233
|
-
]);
|
|
1234
|
-
const noCommand = nextStepCommand(root, artifactsDir, [
|
|
1235
|
-
"--host-can-dispatch-subagents",
|
|
1236
|
-
"false",
|
|
1237
|
-
]);
|
|
1238
|
-
const step = await writeCurrentStep({
|
|
1239
|
-
artifactsDir,
|
|
1240
|
-
stepKind: "capability_check",
|
|
1241
|
-
status: "ready",
|
|
1242
|
-
runId: result.activeReviewRun.run_id,
|
|
1243
|
-
allowedCommands: [yesCommand, noCommand],
|
|
1244
|
-
stopCondition: "Run exactly one next-step command with an explicit host dispatch capability.",
|
|
1245
|
-
repoRoot: root,
|
|
1246
|
-
artifactPaths: {
|
|
1247
|
-
active_review_task: result.activeReviewRun.task_path,
|
|
1248
|
-
active_review_prompt: result.activeReviewRun.prompt_path,
|
|
1249
|
-
pending_audit_tasks: result.activeReviewRun.pending_audit_tasks_path ?? null,
|
|
1250
|
-
single_task_prompt: join(artifactsDir, "dispatch", "current-single-task-prompt.md"),
|
|
1251
|
-
},
|
|
1252
|
-
prompt: renderCapabilityCheckPrompt({ root, artifactsDir }),
|
|
1253
|
-
});
|
|
1254
|
-
console.log(JSON.stringify(step, null, 2));
|
|
1255
|
-
return;
|
|
1256
|
-
}
|
|
1257
|
-
if (!hostCanDispatchSubagents) {
|
|
1192
|
+
if (!hostCanDispatch) {
|
|
1258
1193
|
const singleTaskPromptPath = join(artifactsDir, "dispatch", "current-single-task-prompt.md");
|
|
1259
1194
|
const workerCommand = renderCommand(result.activeReviewRun.worker_command);
|
|
1260
1195
|
const step = await writeCurrentStep({
|
|
@@ -1299,7 +1234,7 @@ async function cmdNextStep(argv) {
|
|
|
1299
1234
|
mergeCommand,
|
|
1300
1235
|
continueCommand,
|
|
1301
1236
|
],
|
|
1302
|
-
stopCondition: "Dispatch every packet,
|
|
1237
|
+
stopCondition: "Dispatch every packet, run merge-and-ingest once, then run next-step.",
|
|
1303
1238
|
repoRoot: root,
|
|
1304
1239
|
artifactPaths: {
|
|
1305
1240
|
dispatch_plan: dispatch.dispatch_plan_path,
|
package/dist/mcp/server.js
CHANGED
|
@@ -250,16 +250,16 @@ function resourceListPayload() {
|
|
|
250
250
|
export const promptRegistry = [
|
|
251
251
|
{
|
|
252
252
|
name: "audit-code",
|
|
253
|
-
description: "Start or continue the autonomous audit loop through the
|
|
253
|
+
description: "Start or continue the autonomous audit loop through the next-step machine.",
|
|
254
254
|
arguments: [],
|
|
255
255
|
render() {
|
|
256
256
|
return [
|
|
257
|
-
"Use
|
|
258
|
-
"1.
|
|
259
|
-
"2. If
|
|
257
|
+
"Use `audit-code next-step` as the canonical interface to the backend wrapper.",
|
|
258
|
+
"1. Prefer running `audit-code next-step` directly from the repository root.",
|
|
259
|
+
"2. If this MCP adapter is your only available integration, call `start_audit` or `continue_audit`; both return the same one-step contract.",
|
|
260
|
+
"3. If the audit is blocked, inspect `audit-code://handoff/current`.",
|
|
260
261
|
" Do not read `audit-code://artifacts/current` unless explicitly needed for a specific task; it is massive and consumes your context window.",
|
|
261
|
-
"
|
|
262
|
-
"4. Call `continue_audit` until the status is complete or explicitly blocked for operator input.",
|
|
262
|
+
"4. When the user provides additional evidence, call `import_results` or `import_runtime_updates`.",
|
|
263
263
|
].join("\n");
|
|
264
264
|
},
|
|
265
265
|
},
|
|
@@ -306,7 +306,7 @@ function renderPrompt(name, args) {
|
|
|
306
306
|
}
|
|
307
307
|
return entry.render(args);
|
|
308
308
|
}
|
|
309
|
-
async function runContinueAudit(context, extraArgs = []) {
|
|
309
|
+
async function runContinueAudit(context, extraArgs = ["next-step"]) {
|
|
310
310
|
const step = await parseCliJson(extraArgs, context);
|
|
311
311
|
if (!step || typeof step !== "object" || Array.isArray(step))
|
|
312
312
|
return step;
|
|
@@ -410,7 +410,7 @@ function toolDefinitions() {
|
|
|
410
410
|
return [
|
|
411
411
|
{
|
|
412
412
|
name: "start_audit",
|
|
413
|
-
description: "
|
|
413
|
+
description: "Compatibility adapter over audit-code next-step; returns one step contract.",
|
|
414
414
|
inputSchema: {
|
|
415
415
|
type: "object",
|
|
416
416
|
properties: {
|
|
@@ -438,7 +438,7 @@ function toolDefinitions() {
|
|
|
438
438
|
},
|
|
439
439
|
{
|
|
440
440
|
name: "continue_audit",
|
|
441
|
-
description: "
|
|
441
|
+
description: "Compatibility adapter over audit-code next-step from the current artifacts directory.",
|
|
442
442
|
inputSchema: {
|
|
443
443
|
type: "object",
|
|
444
444
|
properties: {
|
|
@@ -542,7 +542,7 @@ function toolDefinitions() {
|
|
|
542
542
|
},
|
|
543
543
|
{
|
|
544
544
|
name: "report_capability",
|
|
545
|
-
description: "
|
|
545
|
+
description: "Compatibility adapter that calls audit-code next-step with host subagent capability flags.",
|
|
546
546
|
inputSchema: {
|
|
547
547
|
type: "object",
|
|
548
548
|
properties: {
|
|
@@ -632,7 +632,7 @@ export async function dispatchRequest(request, ctx) {
|
|
|
632
632
|
name: "audit-code",
|
|
633
633
|
version: ctx.version,
|
|
634
634
|
},
|
|
635
|
-
instructions: "Use
|
|
635
|
+
instructions: "Use audit-code next-step as the primary backend loop. These MCP tools are compatibility adapters that return the same one-step contract.",
|
|
636
636
|
capabilities: {
|
|
637
637
|
tools: { listChanged: false },
|
|
638
638
|
resources: { subscribe: false, listChanged: false },
|
|
@@ -168,7 +168,7 @@ function renderMarkdown(handoff) {
|
|
|
168
168
|
lines.push(`- ${command}`);
|
|
169
169
|
}
|
|
170
170
|
if (handoff.active_review_run) {
|
|
171
|
-
lines.push("- Use next-step so the backend renders either packet dispatch or single-task fallback
|
|
171
|
+
lines.push("- Use next-step so the backend renders either packet dispatch or single-task fallback from CLI flags, session config, environment, or the default single-task path.");
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
if (handoff.active_review_run) {
|
|
@@ -63,6 +63,7 @@ export interface SessionConfig {
|
|
|
63
63
|
provider?: ProviderName;
|
|
64
64
|
timeout_ms?: number;
|
|
65
65
|
ui_mode?: SessionUiMode;
|
|
66
|
+
host_can_dispatch_subagents?: boolean;
|
|
66
67
|
subprocess_template?: SubprocessTemplateConfig;
|
|
67
68
|
claude_code?: ClaudeCodeConfig;
|
|
68
69
|
opencode?: OpenCodeConfig;
|
|
@@ -151,6 +151,10 @@ export function validateSessionConfig(value) {
|
|
|
151
151
|
pushIssue(issues, "ui_mode", `ui_mode must be one of: ${Array.from(VALID_UI_MODES).join(", ")}.`);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
if (value.host_can_dispatch_subagents !== undefined &&
|
|
155
|
+
typeof value.host_can_dispatch_subagents !== "boolean") {
|
|
156
|
+
pushIssue(issues, "host_can_dispatch_subagents", "host_can_dispatch_subagents must be a boolean when provided.");
|
|
157
|
+
}
|
|
154
158
|
validateTemplateProviderSection(value.subprocess_template, "subprocess_template", issues, provider === "subprocess-template");
|
|
155
159
|
validateTemplateProviderSection(value.vscode_task, "vscode_task", issues, provider === "vscode-task");
|
|
156
160
|
validateAgentProviderSection(value.claude_code, "claude_code", issues);
|
package/package.json
CHANGED
|
@@ -40,6 +40,11 @@ follow only that prompt. Do not read packet prompts, schemas, command catalogs,
|
|
|
40
40
|
or handoff files unless the current step prompt explicitly instructs you to do
|
|
41
41
|
so.
|
|
42
42
|
|
|
43
|
+
Use MCP tools only as a compatibility adapter when direct shell access to
|
|
44
|
+
`audit-code next-step` is unavailable. The MCP `start_audit` and
|
|
45
|
+
`continue_audit` tools return the same one-step contract; they are not a
|
|
46
|
+
separate orchestration path.
|
|
47
|
+
|
|
43
48
|
When a step prompt tells you to continue, run `audit-code next-step` again and
|
|
44
49
|
follow only the newly returned `prompt_path`.
|
|
45
50
|
|