auditor-lambda 0.6.5 → 0.6.7

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.
@@ -2781,9 +2781,14 @@ async function runDistCommandInline(commandName, argv) {
2781
2781
  await mkdir(artifactsDir, { recursive: true });
2782
2782
  await ensureBuilt();
2783
2783
 
2784
- const distUrl = new URL(`file:///${distEntry.replace(/\\/g, '/')}`);
2784
+ // Import the module that exports runCli (dist/cli.js). dist/index.js has no
2785
+ // exports — it is the bare entrypoint that runs `runCli(process.argv)` as an
2786
+ // import side effect — so importing it here both fails to provide runCli and
2787
+ // double-starts the command from this process's argv.
2788
+ const distCliEntry = join(repoRoot, 'dist', 'cli.js');
2789
+ const distUrl = new URL(`file:///${distCliEntry.replace(/\\/g, '/')}`);
2785
2790
  const cli = await import(distUrl.href);
2786
- await cli.runCli([process.execPath, distEntry, commandName, ...commandArgs]);
2791
+ await cli.runCli([process.execPath, distCliEntry, commandName, ...commandArgs]);
2787
2792
  }
2788
2793
 
2789
2794
  export async function runAuditCodeWrapper({
@@ -22,9 +22,12 @@ export function mergeAndIngestCommand(artifactsDir, runId) {
22
22
  export function renderDispatchReviewPrompt(params) {
23
23
  const mergeCommand = mergeAndIngestCommand(params.artifactsDir, params.activeReviewRun.run_id);
24
24
  const continueCommand = nextStepCommand(params.root, params.artifactsDir);
25
+ // Only mention model_hint when the host can actually act on it. When it
26
+ // cannot, the field is left as inert plan metadata rather than surfacing a
27
+ // contradictory "here is model_hint, now ignore it" instruction.
25
28
  const modelLine = params.hostCanSelectSubagentModel
26
29
  ? "When launching each subagent, map `entry.model_hint.tier` (`small`, `standard`, `deep`) to an available host model without asking the user for model names."
27
- : "Ignore `entry.model_hint`; this host did not report per-subagent model selection.";
30
+ : null;
28
31
  const toolsLine = params.hostCanRestrictSubagentTools
29
32
  ? "Restrict review subagents to read/search plus the packet submit command named in their prompt. Do not give them source edit/write tools."
30
33
  : "Do not ask the user about per-subagent tool restrictions; this host did not report a callable restriction facility.";
@@ -59,7 +62,7 @@ export function renderDispatchReviewPrompt(params) {
59
62
  "",
60
63
  ' Read and follow the audit instructions in: <entry.prompt_path>',
61
64
  "",
62
- modelLine,
65
+ ...(modelLine ? [modelLine] : []),
63
66
  toolsLine,
64
67
  "",
65
68
  "Each subagent must submit its packet through the submit command printed in its packet prompt and stop after successful submission.",
@@ -8,7 +8,15 @@ export interface StepArtifact {
8
8
  prompt_path: string;
9
9
  status: StepStatus;
10
10
  run_id: string | null;
11
+ /** Shell commands the host may run for this step. */
11
12
  allowed_commands: string[];
13
+ /**
14
+ * MCP tool names equivalent to `allowed_commands`, for hosts driving the
15
+ * backend through the MCP adapter. Omitted when the step has no MCP
16
+ * equivalents, so a shell host never has to guess which list entries are
17
+ * tool names versus runnable commands.
18
+ */
19
+ allowed_mcp_tools?: string[];
12
20
  stop_condition: string;
13
21
  repo_root: string;
14
22
  artifacts_dir: string;
@@ -21,6 +29,7 @@ export declare function writeCurrentStep(params: {
21
29
  status: StepStatus;
22
30
  runId: string | null;
23
31
  allowedCommands: string[];
32
+ allowedMcpTools?: string[];
24
33
  stopCondition: string;
25
34
  repoRoot: string;
26
35
  artifactPaths: Record<string, string | null>;
package/dist/cli/steps.js CHANGED
@@ -15,6 +15,9 @@ export async function writeCurrentStep(params) {
15
15
  status: params.status,
16
16
  run_id: params.runId,
17
17
  allowed_commands: params.allowedCommands,
18
+ ...(params.allowedMcpTools && params.allowedMcpTools.length > 0
19
+ ? { allowed_mcp_tools: params.allowedMcpTools }
20
+ : {}),
18
21
  stop_condition: params.stopCondition,
19
22
  repo_root: params.repoRoot,
20
23
  artifacts_dir: params.artifactsDir,
package/dist/cli.js CHANGED
@@ -935,12 +935,8 @@ async function renderSemanticReviewStep(params) {
935
935
  stepKind: "dispatch_review",
936
936
  status: "ready",
937
937
  runId: activeReviewRun.run_id,
938
- allowedCommands: [
939
- "auditor_merge_and_ingest",
940
- "auditor_continue_audit",
941
- mergeCommand,
942
- continueCommand,
943
- ],
938
+ allowedCommands: [mergeCommand, continueCommand],
939
+ allowedMcpTools: ["auditor_merge_and_ingest", "auditor_continue_audit"],
944
940
  stopCondition: "Dispatch every packet, run merge-and-ingest once, then run next-step.",
945
941
  repoRoot: root,
946
942
  artifactPaths: {
@@ -87,6 +87,14 @@ export function scheduleWave(options) {
87
87
  : computeMaxSafeConcurrency(quotaStateEntry, halfLifeHours);
88
88
  waveSize = Math.min(waveSize, learnedCap);
89
89
  }
90
+ else if (hostConcurrencyLimit !== null) {
91
+ // The host explicitly reported its active-subagent capacity. That is a
92
+ // real concurrency signal, so it supersedes the conservative
93
+ // unknown-provider fallback (which exists only when we have no signal at
94
+ // all). Leaving waveSize untouched here lets applyHostConcurrencyLimit()
95
+ // below enforce the reported limit as the hard ceiling, while any RPM/TPM
96
+ // caps applied above still bind.
97
+ }
90
98
  else {
91
99
  const providerType = classifyProvider(providerName);
92
100
  const fallbackCap = providerType === "local"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auditor-lambda",
3
- "version": "0.6.5",
3
+ "version": "0.6.7",
4
4
  "private": false,
5
5
  "description": "Portable hybrid code-auditing framework for arbitrary repositories.",
6
6
  "type": "module",
@@ -83,10 +83,12 @@ audit-code
83
83
 
84
84
  from the target repository root.
85
85
 
86
- When developing inside the `auditor-lambda` repository itself, prefer:
86
+ When developing `auditor-lambda` itself, prefer the local wrapper at
87
+ `packages/audit-code/audit-code.mjs` (there is no `audit-code.mjs` at the
88
+ monorepo root):
87
89
 
88
90
  ```bash
89
- node audit-code.mjs
91
+ node packages/audit-code/audit-code.mjs # from the monorepo root
90
92
  ```
91
93
 
92
94
  That keeps the run pinned to the local wrapper and local `dist/` output instead
@@ -17,22 +17,30 @@ First, make sure the repository has current local audit assets:
17
17
  audit-code ensure --quiet
18
18
  ```
19
19
 
20
- Inside the `auditor-lambda` repository itself, use:
20
+ When developing `auditor-lambda` itself, the entrypoint lives at
21
+ `packages/audit-code/audit-code.mjs` (there is no `audit-code.mjs` at the
22
+ monorepo root). From the monorepo root use:
21
23
 
22
24
  ```bash
23
- node audit-code.mjs ensure --quiet
25
+ node packages/audit-code/audit-code.mjs ensure --quiet
24
26
  ```
25
27
 
26
- Then ask the backend for exactly one next step:
28
+ Then ask the backend for exactly one next step. This host can dispatch review
29
+ subagents in parallel (via the `Agent`/`task` tool), so report that capacity on
30
+ every `next-step` call — otherwise the backend assumes it cannot parallelize and
31
+ sizes dispatch waves to one packet at a time:
27
32
 
28
33
  ```bash
29
- audit-code next-step
34
+ audit-code next-step --host-max-active-subagents 4
30
35
  ```
31
36
 
32
- Inside the `auditor-lambda` repository itself, use:
37
+ `4` is a safe default for this host; raise it for more parallelism or lower it
38
+ under rate-limit pressure. The backend's learned quota adapts from there.
39
+
40
+ When developing `auditor-lambda` itself, from the monorepo root use:
33
41
 
34
42
  ```bash
35
- node audit-code.mjs next-step
43
+ node packages/audit-code/audit-code.mjs next-step --host-max-active-subagents 4
36
44
  ```
37
45
 
38
46
  Read the returned JSON only far enough to find `prompt_path`, then read and
@@ -45,7 +53,8 @@ Use MCP tools only as a compatibility adapter when direct shell access to
45
53
  `continue_audit` tools return the same one-step contract; they are not a
46
54
  separate orchestration path.
47
55
 
48
- When a step prompt tells you to continue, run `audit-code next-step` again and
49
- follow only the newly returned `prompt_path`.
56
+ When a step prompt tells you to continue, run
57
+ `audit-code next-step --host-max-active-subagents 4` again and follow only the
58
+ newly returned `prompt_path`.
50
59
 
51
60
  Stop when the current step prompt tells you to stop.