auditor-lambda 0.3.40 → 0.3.41
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/audit-code-wrapper-lib.mjs +20 -2
- package/dist/cli/args.d.ts +59 -0
- package/dist/cli/args.js +244 -0
- package/dist/cli/dispatch.d.ts +80 -0
- package/dist/cli/dispatch.js +528 -0
- package/dist/cli/prompts.d.ts +18 -0
- package/dist/cli/prompts.js +130 -0
- package/dist/cli/steps.d.ts +29 -0
- package/dist/cli/steps.js +30 -0
- package/dist/cli/waveManifest.d.ts +40 -0
- package/dist/cli/waveManifest.js +41 -0
- package/dist/cli/workerResult.d.ts +18 -0
- package/dist/cli/workerResult.js +42 -0
- package/dist/cli.d.ts +2 -22
- package/dist/cli.js +160 -973
- package/dist/extractors/browserExtension.d.ts +1 -3
- package/dist/extractors/browserExtension.js +2 -2
- package/dist/extractors/designAssessment.d.ts +1 -3
- package/dist/extractors/disposition.d.ts +2 -1
- package/dist/extractors/disposition.js +3 -0
- package/dist/extractors/flows.d.ts +1 -3
- package/dist/extractors/flows.js +2 -2
- package/dist/extractors/graph.d.ts +1 -2
- package/dist/extractors/graph.js +4 -326
- package/dist/extractors/graphManifestEdges.d.ts +1 -1
- package/dist/extractors/graphPathUtils.d.ts +1 -1
- package/dist/extractors/graphPythonImports.d.ts +3 -0
- package/dist/extractors/graphPythonImports.js +326 -0
- package/dist/extractors/risk.d.ts +1 -2
- package/dist/extractors/surfaces.d.ts +1 -3
- package/dist/extractors/surfaces.js +2 -2
- package/dist/io/artifacts.d.ts +1 -5
- package/dist/io/artifacts.js +1 -1
- package/dist/io/runArtifacts.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/orchestrator/advance.d.ts +1 -0
- package/dist/orchestrator/advance.js +8 -5
- package/dist/orchestrator/auditTaskUtils.d.ts +4 -0
- package/dist/orchestrator/auditTaskUtils.js +27 -0
- package/dist/orchestrator/fileAnchors.d.ts +1 -1
- package/dist/orchestrator/fileIntegrity.d.ts +7 -0
- package/dist/orchestrator/fileIntegrity.js +41 -0
- package/dist/orchestrator/flowCoverage.d.ts +1 -1
- package/dist/orchestrator/flowPlanning.d.ts +1 -1
- package/dist/orchestrator/flowRequeue.d.ts +1 -1
- package/dist/orchestrator/internalExecutors.d.ts +3 -1
- package/dist/orchestrator/internalExecutors.js +23 -5
- package/dist/orchestrator/nextStep.d.ts +2 -1
- package/dist/orchestrator/nextStep.js +1 -1
- package/dist/orchestrator/planning.d.ts +1 -1
- package/dist/orchestrator/requeueCommand.d.ts +1 -1
- package/dist/orchestrator/reviewPackets.d.ts +1 -1
- package/dist/orchestrator/reviewPackets.js +21 -113
- package/dist/orchestrator/runtimeValidation.d.ts +1 -1
- package/dist/orchestrator/taskBuilder.d.ts +1 -1
- package/dist/orchestrator/taskBuilder.js +1 -12
- package/dist/orchestrator/unionFind.d.ts +7 -0
- package/dist/orchestrator/unionFind.js +32 -0
- package/dist/orchestrator/unitBuilder.d.ts +2 -2
- package/dist/orchestrator/unitBuilder.js +4 -18
- package/dist/prompts/renderWorkerPrompt.js +18 -1
- package/dist/providers/claudeCodeProvider.d.ts +4 -4
- package/dist/providers/claudeCodeProvider.js +9 -3
- package/dist/providers/constants.d.ts +1 -1
- package/dist/providers/constants.js +1 -1
- package/dist/providers/index.d.ts +1 -2
- package/dist/providers/index.js +5 -4
- package/dist/providers/localSubprocessProvider.d.ts +2 -2
- package/dist/providers/localSubprocessProvider.js +1 -1
- package/dist/providers/opencodeProvider.d.ts +4 -4
- package/dist/providers/opencodeProvider.js +7 -2
- package/dist/providers/spawnLoggedCommand.d.ts +3 -1
- package/dist/providers/spawnLoggedCommand.js +21 -0
- package/dist/providers/subprocessTemplateProvider.d.ts +4 -4
- package/dist/providers/subprocessTemplateProvider.js +8 -3
- package/dist/providers/vscodeTaskProvider.d.ts +3 -4
- package/dist/providers/vscodeTaskProvider.js +2 -2
- package/dist/quota/discoveredLimits.js +1 -1
- package/dist/quota/hostLimits.d.ts +1 -2
- package/dist/quota/hostLimits.js +4 -46
- package/dist/quota/index.d.ts +18 -15
- package/dist/quota/index.js +4 -9
- package/dist/quota/scheduler.d.ts +1 -3
- package/dist/quota/scheduler.js +1 -2
- package/dist/reporting/synthesis.d.ts +1 -2
- package/dist/reporting/synthesis.js +2 -0
- package/dist/reporting/workBlocks.d.ts +1 -2
- package/dist/supervisor/operatorHandoff.js +1 -1
- package/dist/supervisor/runLedger.d.ts +1 -1
- package/dist/supervisor/runLedger.js +2 -2
- package/dist/supervisor/sessionConfig.d.ts +1 -1
- package/dist/supervisor/sessionConfig.js +1 -3
- package/dist/types/reviewPlanning.d.ts +1 -1
- package/dist/types/workerSession.d.ts +6 -0
- package/dist/validation/artifacts.d.ts +1 -1
- package/dist/validation/artifacts.js +1 -1
- package/dist/validation/auditResults.d.ts +1 -1
- package/dist/validation/auditResults.js +1 -1
- package/dist/validation/sessionConfig.d.ts +2 -3
- package/dist/validation/sessionConfig.js +2 -3
- package/package.json +4 -2
- package/scripts/postinstall.mjs +0 -1
- package/dist/io/json.d.ts +0 -10
- package/dist/io/json.js +0 -142
- package/dist/providers/types.d.ts +0 -33
- package/dist/providers/types.js +0 -1
- package/dist/quota/compositeQuotaSource.d.ts +0 -7
- package/dist/quota/compositeQuotaSource.js +0 -20
- package/dist/quota/errorParsers/claudeCodeErrorParser.d.ts +0 -6
- package/dist/quota/errorParsers/claudeCodeErrorParser.js +0 -39
- package/dist/quota/errorParsers/genericErrorParser.d.ts +0 -9
- package/dist/quota/errorParsers/genericErrorParser.js +0 -7
- package/dist/quota/errorParsers/index.d.ts +0 -5
- package/dist/quota/errorParsers/index.js +0 -12
- package/dist/quota/errorParsing.d.ts +0 -7
- package/dist/quota/errorParsing.js +0 -69
- package/dist/quota/fileLock.d.ts +0 -6
- package/dist/quota/fileLock.js +0 -64
- package/dist/quota/learnedQuotaSource.d.ts +0 -7
- package/dist/quota/learnedQuotaSource.js +0 -25
- package/dist/quota/limits.d.ts +0 -16
- package/dist/quota/limits.js +0 -77
- package/dist/quota/quotaSource.d.ts +0 -12
- package/dist/quota/quotaSource.js +0 -1
- package/dist/quota/slidingWindow.d.ts +0 -4
- package/dist/quota/slidingWindow.js +0 -28
- package/dist/quota/state.d.ts +0 -15
- package/dist/quota/state.js +0 -148
- package/dist/quota/types.d.ts +0 -67
- package/dist/quota/types.js +0 -1
- package/dist/reporting/rootCause.d.ts +0 -10
- package/dist/reporting/rootCause.js +0 -146
- package/dist/types/disposition.d.ts +0 -9
- package/dist/types/disposition.js +0 -1
- package/dist/types/flows.d.ts +0 -17
- package/dist/types/flows.js +0 -1
- package/dist/types/graph.d.ts +0 -22
- package/dist/types/graph.js +0 -1
- package/dist/types/risk.d.ts +0 -9
- package/dist/types/risk.js +0 -1
- package/dist/types/runLedger.d.ts +0 -17
- package/dist/types/runLedger.js +0 -6
- package/dist/types/sessionConfig.d.ts +0 -79
- package/dist/types/sessionConfig.js +0 -15
- package/dist/types/surfaces.d.ts +0 -15
- package/dist/types/surfaces.js +0 -1
- package/dist/validation/basic.d.ts +0 -13
- package/dist/validation/basic.js +0 -46
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StepStatus } from "@audit-tools/shared";
|
|
2
|
+
import type { AccessDeclaration } from "../types/workerSession.js";
|
|
3
|
+
export declare const STEP_CONTRACT_VERSION = "audit-code-step/v1alpha1";
|
|
4
|
+
export type StepKind = "dispatch_review" | "single_task_fallback" | "design_review" | "present_report" | "blocked";
|
|
5
|
+
export interface StepArtifact {
|
|
6
|
+
contract_version: typeof STEP_CONTRACT_VERSION;
|
|
7
|
+
step_kind: StepKind;
|
|
8
|
+
prompt_path: string;
|
|
9
|
+
status: StepStatus;
|
|
10
|
+
run_id: string | null;
|
|
11
|
+
allowed_commands: string[];
|
|
12
|
+
stop_condition: string;
|
|
13
|
+
repo_root: string;
|
|
14
|
+
artifacts_dir: string;
|
|
15
|
+
artifact_paths: Record<string, string | null>;
|
|
16
|
+
access?: AccessDeclaration;
|
|
17
|
+
}
|
|
18
|
+
export declare function writeCurrentStep(params: {
|
|
19
|
+
artifactsDir: string;
|
|
20
|
+
stepKind: StepKind;
|
|
21
|
+
status: StepStatus;
|
|
22
|
+
runId: string | null;
|
|
23
|
+
allowedCommands: string[];
|
|
24
|
+
stopCondition: string;
|
|
25
|
+
repoRoot: string;
|
|
26
|
+
artifactPaths: Record<string, string | null>;
|
|
27
|
+
prompt: string;
|
|
28
|
+
access?: AccessDeclaration;
|
|
29
|
+
}): Promise<StepArtifact>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { writeJsonFile } from "@audit-tools/shared";
|
|
4
|
+
export const STEP_CONTRACT_VERSION = "audit-code-step/v1alpha1";
|
|
5
|
+
export async function writeCurrentStep(params) {
|
|
6
|
+
const stepsDir = join(params.artifactsDir, "steps");
|
|
7
|
+
await mkdir(stepsDir, { recursive: true });
|
|
8
|
+
const promptPath = join(stepsDir, "current-prompt.md");
|
|
9
|
+
const stepPath = join(stepsDir, "current-step.json");
|
|
10
|
+
await writeFile(promptPath, params.prompt, "utf8");
|
|
11
|
+
const step = {
|
|
12
|
+
contract_version: STEP_CONTRACT_VERSION,
|
|
13
|
+
step_kind: params.stepKind,
|
|
14
|
+
prompt_path: promptPath,
|
|
15
|
+
status: params.status,
|
|
16
|
+
run_id: params.runId,
|
|
17
|
+
allowed_commands: params.allowedCommands,
|
|
18
|
+
stop_condition: params.stopCondition,
|
|
19
|
+
repo_root: params.repoRoot,
|
|
20
|
+
artifacts_dir: params.artifactsDir,
|
|
21
|
+
artifact_paths: {
|
|
22
|
+
current_step: stepPath,
|
|
23
|
+
current_prompt: promptPath,
|
|
24
|
+
...params.artifactPaths,
|
|
25
|
+
},
|
|
26
|
+
...(params.access ? { access: params.access } : {}),
|
|
27
|
+
};
|
|
28
|
+
await writeJsonFile(stepPath, step);
|
|
29
|
+
return step;
|
|
30
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AuditTask } from "../types.js";
|
|
2
|
+
declare const WAVE_MANIFEST_CONTRACT = "audit-code-wave/v1alpha1";
|
|
3
|
+
export interface WaveSlotEntry {
|
|
4
|
+
run_id: string;
|
|
5
|
+
task_path: string;
|
|
6
|
+
prompt_path: string;
|
|
7
|
+
result_path: string;
|
|
8
|
+
stdout_path: string;
|
|
9
|
+
stderr_path: string;
|
|
10
|
+
status_path: string;
|
|
11
|
+
audit_results_path: string;
|
|
12
|
+
pending_tasks_path: string;
|
|
13
|
+
task_ids: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface WaveManifest {
|
|
16
|
+
contract_version: typeof WAVE_MANIFEST_CONTRACT;
|
|
17
|
+
obligation_id: string;
|
|
18
|
+
started_at: string;
|
|
19
|
+
pid: number;
|
|
20
|
+
slots: WaveSlotEntry[];
|
|
21
|
+
}
|
|
22
|
+
export declare function waveManifestPath(artifactsDir: string): string;
|
|
23
|
+
export declare function writeWaveManifest(artifactsDir: string, manifest: Omit<WaveManifest, "contract_version">): Promise<void>;
|
|
24
|
+
export declare function readWaveManifest(artifactsDir: string): Promise<WaveManifest | null>;
|
|
25
|
+
export declare function removeWaveManifest(artifactsDir: string): Promise<void>;
|
|
26
|
+
export declare function buildWaveSlotEntry(slot: {
|
|
27
|
+
runId: string;
|
|
28
|
+
paths: {
|
|
29
|
+
taskPath: string;
|
|
30
|
+
promptPath: string;
|
|
31
|
+
resultPath: string;
|
|
32
|
+
stdoutPath: string;
|
|
33
|
+
stderrPath: string;
|
|
34
|
+
statusPath: string;
|
|
35
|
+
};
|
|
36
|
+
auditResultsPath: string;
|
|
37
|
+
pendingTasksPath: string;
|
|
38
|
+
group: AuditTask[];
|
|
39
|
+
}): WaveSlotEntry;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { rm } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { isFileMissingError, readJsonFile, writeJsonFile } from "@audit-tools/shared";
|
|
4
|
+
const WAVE_MANIFEST_FILENAME = "wave-manifest.json";
|
|
5
|
+
const WAVE_MANIFEST_CONTRACT = "audit-code-wave/v1alpha1";
|
|
6
|
+
export function waveManifestPath(artifactsDir) {
|
|
7
|
+
return join(artifactsDir, "dispatch", WAVE_MANIFEST_FILENAME);
|
|
8
|
+
}
|
|
9
|
+
export async function writeWaveManifest(artifactsDir, manifest) {
|
|
10
|
+
await writeJsonFile(waveManifestPath(artifactsDir), {
|
|
11
|
+
contract_version: WAVE_MANIFEST_CONTRACT,
|
|
12
|
+
...manifest,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export async function readWaveManifest(artifactsDir) {
|
|
16
|
+
try {
|
|
17
|
+
return await readJsonFile(waveManifestPath(artifactsDir));
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (isFileMissingError(error))
|
|
21
|
+
return null;
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export async function removeWaveManifest(artifactsDir) {
|
|
26
|
+
await rm(waveManifestPath(artifactsDir), { force: true });
|
|
27
|
+
}
|
|
28
|
+
export function buildWaveSlotEntry(slot) {
|
|
29
|
+
return {
|
|
30
|
+
run_id: slot.runId,
|
|
31
|
+
task_path: slot.paths.taskPath,
|
|
32
|
+
prompt_path: slot.paths.promptPath,
|
|
33
|
+
result_path: slot.paths.resultPath,
|
|
34
|
+
stdout_path: slot.paths.stdoutPath,
|
|
35
|
+
stderr_path: slot.paths.stderrPath,
|
|
36
|
+
status_path: slot.paths.statusPath,
|
|
37
|
+
audit_results_path: slot.auditResultsPath,
|
|
38
|
+
pending_tasks_path: slot.pendingTasksPath,
|
|
39
|
+
task_ids: slot.group.map((t) => t.task_id),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WorkerResult } from "../types/workerResult.js";
|
|
2
|
+
import type { RunPaths } from "../io/runArtifacts.js";
|
|
3
|
+
export declare const WORKER_RESULT_CONTRACT_VERSION = "audit-code-worker-result/v1alpha1";
|
|
4
|
+
export declare function buildWorkerResult(params: {
|
|
5
|
+
runId: string;
|
|
6
|
+
obligationId: string | null;
|
|
7
|
+
status: WorkerResult["status"];
|
|
8
|
+
progressMade: boolean;
|
|
9
|
+
selectedExecutor: string | null;
|
|
10
|
+
artifactsWritten: string[];
|
|
11
|
+
summary: string;
|
|
12
|
+
nextLikelyStep: string | null;
|
|
13
|
+
errors: string[];
|
|
14
|
+
}): WorkerResult;
|
|
15
|
+
export declare function persistWorkerRunArtifacts(paths: RunPaths, workerResult: WorkerResult, executionMode: string): Promise<void>;
|
|
16
|
+
export declare function isWorkerResult(value: unknown): value is WorkerResult;
|
|
17
|
+
export declare function buildWorkerFailureBlocker(workerResult: WorkerResult): string;
|
|
18
|
+
export declare function formatAuditResultValidationError(issues: ReturnType<typeof import("../validation/auditResults.js").validateAuditResults>): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { writeJsonFile } from "@audit-tools/shared";
|
|
2
|
+
import { formatAuditResultIssues } from "../validation/auditResults.js";
|
|
3
|
+
export const WORKER_RESULT_CONTRACT_VERSION = "audit-code-worker-result/v1alpha1";
|
|
4
|
+
export function buildWorkerResult(params) {
|
|
5
|
+
return {
|
|
6
|
+
contract_version: WORKER_RESULT_CONTRACT_VERSION,
|
|
7
|
+
run_id: params.runId,
|
|
8
|
+
obligation_id: params.obligationId,
|
|
9
|
+
status: params.status,
|
|
10
|
+
progress_made: params.progressMade,
|
|
11
|
+
selected_executor: params.selectedExecutor,
|
|
12
|
+
artifacts_written: params.artifactsWritten,
|
|
13
|
+
summary: params.summary,
|
|
14
|
+
next_likely_step: params.nextLikelyStep,
|
|
15
|
+
errors: params.errors,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export async function persistWorkerRunArtifacts(paths, workerResult, executionMode) {
|
|
19
|
+
await writeJsonFile(paths.resultPath, workerResult);
|
|
20
|
+
await writeJsonFile(paths.statusPath, {
|
|
21
|
+
run_id: workerResult.run_id,
|
|
22
|
+
status: workerResult.status,
|
|
23
|
+
execution_mode: executionMode,
|
|
24
|
+
result_path: paths.resultPath,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function isWorkerResult(value) {
|
|
28
|
+
return (typeof value === "object" &&
|
|
29
|
+
value !== null &&
|
|
30
|
+
value.contract_version ===
|
|
31
|
+
WORKER_RESULT_CONTRACT_VERSION);
|
|
32
|
+
}
|
|
33
|
+
export function buildWorkerFailureBlocker(workerResult) {
|
|
34
|
+
const details = workerResult.errors.filter((error) => error.trim().length > 0);
|
|
35
|
+
return details.length > 0
|
|
36
|
+
? `${workerResult.summary} ${details.join(" ")}`
|
|
37
|
+
: workerResult.summary;
|
|
38
|
+
}
|
|
39
|
+
export function formatAuditResultValidationError(issues) {
|
|
40
|
+
return (`audit-results validation failed with ${issues.length} error(s):\n` +
|
|
41
|
+
formatAuditResultIssues(issues));
|
|
42
|
+
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
type UiMode
|
|
3
|
-
declare function getFlag(argv: string[], name: string, fallback?: string): string | undefined;
|
|
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;
|
|
10
|
-
declare function getArtifactsDir(argv: string[]): string;
|
|
11
|
-
declare function getRootDir(argv: string[]): string;
|
|
12
|
-
declare function warnIfNotGitRepo(root: string): void;
|
|
13
|
-
declare function getBatchResultsDir(argv: string[]): string | undefined;
|
|
14
|
-
declare function getMaxRuns(argv: string[]): number;
|
|
15
|
-
declare function getAgentBatchSize(argv: string[], sessionConfig: SessionConfig): number;
|
|
16
|
-
declare function getParallelWorkers(argv: string[], sessionConfig: SessionConfig): number;
|
|
17
|
-
declare function getTimeoutMs(argv: string[], sessionConfig: SessionConfig): number;
|
|
18
|
-
declare function chunkArray<T>(arr: T[], size: number): T[][];
|
|
19
|
-
declare function getUiMode(argv: string[], fallback?: UiMode): UiMode;
|
|
20
|
-
declare function countLines(path: string): Promise<number>;
|
|
21
|
-
declare function looksLikeCliFlag(value: string | undefined): boolean;
|
|
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";
|
|
22
3
|
export declare const cliTestUtils: {
|
|
23
4
|
defaults: {
|
|
24
5
|
rootDir: string;
|
|
@@ -46,4 +27,3 @@ export declare const cliTestUtils: {
|
|
|
46
27
|
};
|
|
47
28
|
export declare function runSample(argv?: string[]): Promise<void>;
|
|
48
29
|
export declare function runCli(argv: string[]): Promise<void>;
|
|
49
|
-
export {};
|