auditor-lambda 0.6.10 → 0.6.11

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.
@@ -0,0 +1,11 @@
1
+ import type { ActiveReviewRun } from "../supervisor/operatorHandoff.js";
2
+ import { writeCurrentStep } from "./steps.js";
3
+ export declare function renderSemanticReviewStep(params: {
4
+ root: string;
5
+ artifactsDir: string;
6
+ activeReviewRun: ActiveReviewRun;
7
+ hostCanDispatch: boolean;
8
+ hostMaxActiveSubagents: number | null;
9
+ hostCanRestrictSubagentTools: boolean;
10
+ hostCanSelectSubagentModel: boolean;
11
+ }): Promise<Awaited<ReturnType<typeof writeCurrentStep>>>;
@@ -0,0 +1,103 @@
1
+ import { join } from "node:path";
2
+ import { loadSessionConfig } from "../supervisor/sessionConfig.js";
3
+ import { createFreshSessionProvider } from "../providers/index.js";
4
+ import { renderCommand } from "./args.js";
5
+ import { writeCurrentStep } from "./steps.js";
6
+ import { mergeAndIngestCommand, nextStepCommand, renderDispatchReviewPrompt, renderSingleTaskFallbackStepPrompt, } from "./prompts.js";
7
+ import { prepareDispatchArtifacts } from "./dispatch.js";
8
+ import { packageRoot } from "./paths.js";
9
+ // Renders the actionable semantic-review step (packet dispatch or single-task
10
+ // fallback) and writes steps/current-step.json. Shared by next-step and
11
+ // run-to-completion so the backend produces the actionable step itself rather
12
+ // than handing the host a second command. Host dispatch capability is resolved
13
+ // by the caller (flag -> session config -> env -> default true) and is never
14
+ // required from the host to make progress.
15
+ export async function renderSemanticReviewStep(params) {
16
+ const { root, artifactsDir, activeReviewRun } = params;
17
+ if (!params.hostCanDispatch) {
18
+ const singleTaskPromptPath = join(artifactsDir, "dispatch", "current-single-task-prompt.md");
19
+ const workerCommand = renderCommand(activeReviewRun.worker_command);
20
+ return writeCurrentStep({
21
+ artifactsDir,
22
+ stepKind: "single_task_fallback",
23
+ status: "ready",
24
+ runId: activeReviewRun.run_id,
25
+ allowedCommands: [workerCommand],
26
+ stopCondition: "Run the exact worker_command after one result, then stop without looping.",
27
+ repoRoot: root,
28
+ artifactPaths: {
29
+ active_review_task: activeReviewRun.task_path,
30
+ active_review_prompt: activeReviewRun.prompt_path,
31
+ pending_audit_tasks: activeReviewRun.pending_audit_tasks_path ?? null,
32
+ audit_results: activeReviewRun.audit_results_path,
33
+ single_task_prompt: singleTaskPromptPath,
34
+ },
35
+ prompt: renderSingleTaskFallbackStepPrompt({
36
+ singleTaskPromptPath,
37
+ activeReviewRun,
38
+ }),
39
+ access: {
40
+ read_paths: [singleTaskPromptPath],
41
+ write_paths: [activeReviewRun.audit_results_path],
42
+ },
43
+ });
44
+ }
45
+ const sessionConfig = await loadSessionConfig(artifactsDir).catch(() => ({}));
46
+ const provider = createFreshSessionProvider(undefined, sessionConfig);
47
+ const dispatch = await prepareDispatchArtifacts({
48
+ packageRoot,
49
+ runId: activeReviewRun.run_id,
50
+ artifactsDir,
51
+ root,
52
+ sessionConfig,
53
+ hostModel: sessionConfig.block_quota?.host_model ?? null,
54
+ queryLimits: provider.queryLimits?.bind(provider),
55
+ hostActiveSubagentLimit: params.hostMaxActiveSubagents,
56
+ });
57
+ const mergeCommand = mergeAndIngestCommand(artifactsDir, activeReviewRun.run_id);
58
+ const continueCommand = nextStepCommand(root, artifactsDir);
59
+ return writeCurrentStep({
60
+ artifactsDir,
61
+ stepKind: "dispatch_review",
62
+ status: "ready",
63
+ runId: activeReviewRun.run_id,
64
+ allowedCommands: [mergeCommand, continueCommand],
65
+ allowedMcpTools: ["auditor_merge_and_ingest", "auditor_continue_audit"],
66
+ progress: {
67
+ summary: `Dispatching ${dispatch.packet_count} review packet(s) covering ` +
68
+ `${dispatch.task_count} task(s) in waves of ${dispatch.wave_size}` +
69
+ (dispatch.skipped_task_count > 0
70
+ ? `; ${dispatch.skipped_task_count} task(s) already completed.`
71
+ : "."),
72
+ pending_packets: dispatch.packet_count,
73
+ pending_tasks: dispatch.task_count,
74
+ completed_tasks: dispatch.skipped_task_count,
75
+ wave_size: dispatch.wave_size,
76
+ },
77
+ stopCondition: "Dispatch every packet, run merge-and-ingest once, then run next-step.",
78
+ repoRoot: root,
79
+ artifactPaths: {
80
+ dispatch_plan: dispatch.dispatch_plan_path,
81
+ dispatch_quota: dispatch.dispatch_quota_path,
82
+ dispatch_warnings: dispatch.dispatch_warnings_path,
83
+ active_review_task: activeReviewRun.task_path,
84
+ pending_audit_tasks: activeReviewRun.pending_audit_tasks_path ?? null,
85
+ },
86
+ prompt: renderDispatchReviewPrompt({
87
+ root,
88
+ artifactsDir,
89
+ activeReviewRun,
90
+ dispatchPlanPath: dispatch.dispatch_plan_path,
91
+ dispatchQuotaPath: dispatch.dispatch_quota_path,
92
+ hostCanRestrictSubagentTools: params.hostCanRestrictSubagentTools,
93
+ hostCanSelectSubagentModel: params.hostCanSelectSubagentModel,
94
+ }),
95
+ access: {
96
+ read_paths: [
97
+ dispatch.dispatch_plan_path,
98
+ ...(dispatch.dispatch_quota_path ? [dispatch.dispatch_quota_path] : []),
99
+ ],
100
+ write_paths: [],
101
+ },
102
+ });
103
+ }
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { resolveHostDispatchCapability, DIRECT_CLI_DEFAULTS, getFlag, hasFlag, getOptionalBooleanFlag, getArtifactsDir, getRootDir, getBatchResultsDir, getMaxRuns, getAgentBatchSize, getParallelWorkers, getTimeoutMs, chunkArray, getUiMode, looksLikeCliFlag, countLines, warnIfNotGitRepo, } from "./cli/args.js";
2
- import { type UiMode, getFlag, hasFlag, getArtifactsDir, getRootDir, warnIfNotGitRepo, getBatchResultsDir, getMaxRuns, getAgentBatchSize, getParallelWorkers, getTimeoutMs, chunkArray, getUiMode, looksLikeCliFlag, countLines } from "./cli/args.js";
2
+ import { getFlag, hasFlag, getArtifactsDir, getRootDir, warnIfNotGitRepo, getBatchResultsDir, getMaxRuns, getAgentBatchSize, getParallelWorkers, getTimeoutMs, chunkArray, getUiMode, looksLikeCliFlag, countLines } from "./cli/args.js";
3
3
  export declare const cliTestUtils: {
4
4
  defaults: {
5
5
  rootDir: string;
@@ -8,7 +8,7 @@ export declare const cliTestUtils: {
8
8
  agentBatchSize: number;
9
9
  parallelWorkers: number;
10
10
  timeoutMs: number;
11
- uiMode: UiMode;
11
+ uiMode: import("./cli/args.js").UiMode;
12
12
  };
13
13
  getFlag: typeof getFlag;
14
14
  hasFlag: typeof hasFlag;