@akagilnc/pi-workflow-roles 0.1.2020 → 0.1.2033
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/dist/compliance-transport.js +24 -19
- package/dist/evidence-child-executor.js +4 -0
- package/dist/package-owned-tool-idle.js +66 -4
- package/dist/public-cli/main.js +109 -121
- package/package.json +1 -1
- package/src/compliance-transport.ts +24 -19
- package/src/evidence-child-executor.ts +4 -0
- package/src/package-owned-tool-idle.ts +64 -7
- package/src/public-cli/cli.ts +2 -2
- package/src/public-cli/coder-run.ts +5 -14
- package/src/public-cli/collector-run.ts +4 -13
- package/src/public-cli/config.ts +45 -7
- package/src/public-cli/doctor-run.ts +4 -13
- package/src/public-cli/fixer-run.ts +5 -14
- package/src/public-cli/invocation.ts +78 -7
- package/src/public-cli/judge-run.ts +5 -14
- package/src/public-cli/merger-run.ts +5 -14
- package/src/public-cli/registry.ts +2 -1
- package/src/public-cli/reviewer-run.ts +5 -14
- package/src/public-cli/run-lifecycle.ts +14 -1
- package/src/ticket-trajectory.ts +5 -1
package/dist/public-cli/main.js
CHANGED
|
@@ -14387,12 +14387,15 @@ function parseModelSpec(spec, fallbackThinking) {
|
|
|
14387
14387
|
const thinkingSplit = trimmed.lastIndexOf(":");
|
|
14388
14388
|
let modelPart = trimmed;
|
|
14389
14389
|
let thinking = fallbackThinking;
|
|
14390
|
-
if (thinkingSplit
|
|
14390
|
+
if (thinkingSplit !== -1) {
|
|
14391
14391
|
const maybeThinking = trimmed.slice(thinkingSplit + 1);
|
|
14392
|
-
if (THINKING_LEVELS.has(maybeThinking)) {
|
|
14393
|
-
|
|
14394
|
-
|
|
14392
|
+
if (!THINKING_LEVELS.has(maybeThinking)) {
|
|
14393
|
+
throw new Error(
|
|
14394
|
+
`model specification must be provider/model[:thinking], got ${spec}`
|
|
14395
|
+
);
|
|
14395
14396
|
}
|
|
14397
|
+
thinking = maybeThinking;
|
|
14398
|
+
modelPart = trimmed.slice(0, thinkingSplit);
|
|
14396
14399
|
}
|
|
14397
14400
|
const slash = modelPart.indexOf("/");
|
|
14398
14401
|
if (slash <= 0 || slash === modelPart.length - 1) {
|
|
@@ -14402,15 +14405,34 @@ function parseModelSpec(spec, fallbackThinking) {
|
|
|
14402
14405
|
}
|
|
14403
14406
|
const provider = modelPart.slice(0, slash);
|
|
14404
14407
|
const model = modelPart.slice(slash + 1);
|
|
14405
|
-
|
|
14408
|
+
return thinking === void 0 ? { provider, model } : { provider, model, thinking };
|
|
14409
|
+
}
|
|
14410
|
+
function parsePersistentModelSpec(spec) {
|
|
14411
|
+
const parsed = parseModelSpec(spec);
|
|
14412
|
+
if (parsed.thinking === void 0) {
|
|
14406
14413
|
throw new Error(
|
|
14407
14414
|
`model specification requires a thinking level (provider/model:thinking), got ${spec}`
|
|
14408
14415
|
);
|
|
14409
14416
|
}
|
|
14410
|
-
return {
|
|
14417
|
+
return {
|
|
14418
|
+
provider: parsed.provider,
|
|
14419
|
+
model: parsed.model,
|
|
14420
|
+
thinking: parsed.thinking
|
|
14421
|
+
};
|
|
14411
14422
|
}
|
|
14412
14423
|
function formatModelSpec(selection) {
|
|
14413
|
-
|
|
14424
|
+
const base = `${selection.provider}/${selection.model}`;
|
|
14425
|
+
return selection.thinking === void 0 ? base : `${base}:${selection.thinking}`;
|
|
14426
|
+
}
|
|
14427
|
+
function buildSeatModelCliArgs(model) {
|
|
14428
|
+
if (model === void 0) return [];
|
|
14429
|
+
return [
|
|
14430
|
+
"--provider",
|
|
14431
|
+
model.provider,
|
|
14432
|
+
"--model",
|
|
14433
|
+
model.model,
|
|
14434
|
+
...model.thinking === void 0 ? [] : ["--thinking", model.thinking]
|
|
14435
|
+
];
|
|
14414
14436
|
}
|
|
14415
14437
|
function parsePublicCliConfig(value) {
|
|
14416
14438
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -15432,7 +15454,15 @@ import {
|
|
|
15432
15454
|
writeFile as writeFile2
|
|
15433
15455
|
} from "node:fs/promises";
|
|
15434
15456
|
import { basename as basename3, isAbsolute as isAbsolute3, join as join5, resolve as resolve4, sep as sep3 } from "node:path";
|
|
15435
|
-
|
|
15457
|
+
function effectiveModelLedgerFields(model) {
|
|
15458
|
+
if (model === void 0) return {};
|
|
15459
|
+
return {
|
|
15460
|
+
provider: model.provider,
|
|
15461
|
+
model: model.model,
|
|
15462
|
+
...model.thinking === void 0 ? {} : { thinking: model.thinking }
|
|
15463
|
+
};
|
|
15464
|
+
}
|
|
15465
|
+
async function writeRoleInvocationLedger(source, role, effectiveModel) {
|
|
15436
15466
|
const identity = {
|
|
15437
15467
|
role,
|
|
15438
15468
|
runId: source.runId,
|
|
@@ -15442,7 +15472,8 @@ async function writeRoleInvocationLedger(source, role) {
|
|
|
15442
15472
|
sessionDirectory: source.sessionDirectory,
|
|
15443
15473
|
sessionFile: source.sessionFile,
|
|
15444
15474
|
...source.correlationId === void 0 ? {} : { correlationId: source.correlationId },
|
|
15445
|
-
...source.ticketNumber === void 0 ? {} : { ticketNumber: source.ticketNumber }
|
|
15475
|
+
...source.ticketNumber === void 0 ? {} : { ticketNumber: source.ticketNumber },
|
|
15476
|
+
...effectiveModelLedgerFields(effectiveModel)
|
|
15446
15477
|
};
|
|
15447
15478
|
await writeFile2(
|
|
15448
15479
|
join5(source.runDirectory, "invocation.json"),
|
|
@@ -15451,6 +15482,26 @@ async function writeRoleInvocationLedger(source, role) {
|
|
|
15451
15482
|
"utf8"
|
|
15452
15483
|
);
|
|
15453
15484
|
}
|
|
15485
|
+
async function recordEffectiveInvocationModel(runDirectory, model) {
|
|
15486
|
+
const ledgerPath = join5(runDirectory, "invocation.json");
|
|
15487
|
+
const current = JSON.parse(await readFile4(ledgerPath, "utf8"));
|
|
15488
|
+
const next = {
|
|
15489
|
+
...current,
|
|
15490
|
+
provider: model.provider,
|
|
15491
|
+
model: model.model
|
|
15492
|
+
};
|
|
15493
|
+
if (model.thinking === void 0) {
|
|
15494
|
+
delete next.thinking;
|
|
15495
|
+
} else {
|
|
15496
|
+
next.thinking = model.thinking;
|
|
15497
|
+
}
|
|
15498
|
+
await writeFile2(
|
|
15499
|
+
ledgerPath,
|
|
15500
|
+
`${JSON.stringify(next, null, 2)}
|
|
15501
|
+
`,
|
|
15502
|
+
"utf8"
|
|
15503
|
+
);
|
|
15504
|
+
}
|
|
15454
15505
|
async function mergeInvocationIdentityPage(runDirectory, fields) {
|
|
15455
15506
|
const ledgerPath = join5(runDirectory, "invocation.json");
|
|
15456
15507
|
const current = JSON.parse(await readFile4(ledgerPath, "utf8"));
|
|
@@ -15753,7 +15804,7 @@ async function admitJudgeInvocation(options) {
|
|
|
15753
15804
|
const admittedRequestPath = join5(runDirectory, "admitted-request.json");
|
|
15754
15805
|
await writeFile2(admittedRequestPath, `${JSON.stringify(admitted, null, 2)}
|
|
15755
15806
|
`, "utf8");
|
|
15756
|
-
await writeRoleInvocationLedger(admitted, admitted.role);
|
|
15807
|
+
await writeRoleInvocationLedger(admitted, admitted.role, options.model);
|
|
15757
15808
|
return {
|
|
15758
15809
|
role: "judge",
|
|
15759
15810
|
runId,
|
|
@@ -15835,7 +15886,7 @@ async function admitCoderInvocation(options) {
|
|
|
15835
15886
|
const admittedRequestPath = join5(runDirectory, "admitted-request.json");
|
|
15836
15887
|
await writeFile2(admittedRequestPath, `${JSON.stringify(admitted, null, 2)}
|
|
15837
15888
|
`, "utf8");
|
|
15838
|
-
await writeRoleInvocationLedger(admitted, admitted.role);
|
|
15889
|
+
await writeRoleInvocationLedger(admitted, admitted.role, options.model);
|
|
15839
15890
|
return {
|
|
15840
15891
|
role: "coder",
|
|
15841
15892
|
phase: options.phase,
|
|
@@ -15950,7 +16001,7 @@ async function admitFixerInvocation(options) {
|
|
|
15950
16001
|
const admittedRequestPath = join5(runDirectory, "admitted-request.json");
|
|
15951
16002
|
await writeFile2(admittedRequestPath, `${JSON.stringify(admitted, null, 2)}
|
|
15952
16003
|
`, "utf8");
|
|
15953
|
-
await writeRoleInvocationLedger(admitted, admitted.role);
|
|
16004
|
+
await writeRoleInvocationLedger(admitted, admitted.role, options.model);
|
|
15954
16005
|
return {
|
|
15955
16006
|
role: "fixer",
|
|
15956
16007
|
phase: options.phase,
|
|
@@ -16194,7 +16245,7 @@ async function admitCollectorInvocation(options) {
|
|
|
16194
16245
|
`,
|
|
16195
16246
|
"utf8"
|
|
16196
16247
|
);
|
|
16197
|
-
await writeRoleInvocationLedger(admitted, admitted.role);
|
|
16248
|
+
await writeRoleInvocationLedger(admitted, admitted.role, options.model);
|
|
16198
16249
|
return {
|
|
16199
16250
|
role: "collector",
|
|
16200
16251
|
runId,
|
|
@@ -16444,7 +16495,7 @@ async function admitDoctorInvocation(options) {
|
|
|
16444
16495
|
`,
|
|
16445
16496
|
"utf8"
|
|
16446
16497
|
);
|
|
16447
|
-
await writeRoleInvocationLedger(admitted, admitted.role);
|
|
16498
|
+
await writeRoleInvocationLedger(admitted, admitted.role, options.model);
|
|
16448
16499
|
return {
|
|
16449
16500
|
role: "doctor",
|
|
16450
16501
|
runId,
|
|
@@ -16578,7 +16629,7 @@ async function admitReviewerInvocation(options) {
|
|
|
16578
16629
|
`,
|
|
16579
16630
|
"utf8"
|
|
16580
16631
|
);
|
|
16581
|
-
await writeRoleInvocationLedger(admitted, admitted.role);
|
|
16632
|
+
await writeRoleInvocationLedger(admitted, admitted.role, options.model);
|
|
16582
16633
|
return {
|
|
16583
16634
|
role: "reviewer",
|
|
16584
16635
|
runId,
|
|
@@ -16765,7 +16816,7 @@ async function admitMergerInvocation(options) {
|
|
|
16765
16816
|
`,
|
|
16766
16817
|
"utf8"
|
|
16767
16818
|
);
|
|
16768
|
-
await writeRoleInvocationLedger(admitted, admitted.role);
|
|
16819
|
+
await writeRoleInvocationLedger(admitted, admitted.role, options.model);
|
|
16769
16820
|
return {
|
|
16770
16821
|
role: "merger",
|
|
16771
16822
|
runId,
|
|
@@ -17816,7 +17867,10 @@ async function markRunAdmitted(admitted) {
|
|
|
17816
17867
|
...admitted.role === "coder" || admitted.role === "fixer" ? { phase: admitted.phase } : {}
|
|
17817
17868
|
});
|
|
17818
17869
|
}
|
|
17819
|
-
async function markRunRunning(runDirectory) {
|
|
17870
|
+
async function markRunRunning(runDirectory, effectiveModel) {
|
|
17871
|
+
if (effectiveModel !== void 0) {
|
|
17872
|
+
await recordEffectiveInvocationModel(runDirectory, effectiveModel);
|
|
17873
|
+
}
|
|
17820
17874
|
const current = await readRoleRunState(runDirectory);
|
|
17821
17875
|
if (current === void 0) {
|
|
17822
17876
|
throw new Error("cannot mark running: run state missing");
|
|
@@ -18394,11 +18448,14 @@ var init_tool_execution_observation = __esm({
|
|
|
18394
18448
|
});
|
|
18395
18449
|
|
|
18396
18450
|
// src/package-owned-tool-idle.ts
|
|
18451
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
18452
|
+
var packageOwnedToolIdleScope;
|
|
18397
18453
|
var init_package_owned_tool_idle = __esm({
|
|
18398
18454
|
"src/package-owned-tool-idle.ts"() {
|
|
18399
18455
|
"use strict";
|
|
18400
18456
|
init_stream_idle_guard();
|
|
18401
18457
|
init_tool_execution_observation();
|
|
18458
|
+
packageOwnedToolIdleScope = new AsyncLocalStorage();
|
|
18402
18459
|
}
|
|
18403
18460
|
});
|
|
18404
18461
|
|
|
@@ -18470,6 +18527,7 @@ var init_compliance_transport = __esm({
|
|
|
18470
18527
|
init_build();
|
|
18471
18528
|
init_evidence_child_executor();
|
|
18472
18529
|
init_auditor_dossier_tool();
|
|
18530
|
+
init_package_owned_tool_idle();
|
|
18473
18531
|
nonblank2 = typebox_exports.String({ minLength: 1, pattern: "\\S" });
|
|
18474
18532
|
decisionGateSchema = typebox_exports.Object({ question: nonblank2, options: typebox_exports.Array(nonblank2, { minItems: 1 }) }, { additionalProperties: false });
|
|
18475
18533
|
complianceDecisionSchema = typebox_exports.Object({ status: typebox_exports.Unknown({ description: "Auditor decision status." }), violations: typebox_exports.Array(nonblank2, { description: "Observed compliance violations." }), conflicts: typebox_exports.Array(nonblank2, { description: "Unresolved authority or execution conflicts." }), decisionGate: typebox_exports.Union([decisionGateSchema, typebox_exports.Null()], { description: "Escalation question and available options." }) }, { additionalProperties: true, required: [] });
|
|
@@ -21605,17 +21663,6 @@ var init_settlement = __esm({
|
|
|
21605
21663
|
// src/public-cli/coder-run.ts
|
|
21606
21664
|
import { writeFile as writeFile6 } from "node:fs/promises";
|
|
21607
21665
|
import { join as join11 } from "node:path";
|
|
21608
|
-
function buildModelArgs(model) {
|
|
21609
|
-
if (model === void 0) return [];
|
|
21610
|
-
return [
|
|
21611
|
-
"--provider",
|
|
21612
|
-
model.provider,
|
|
21613
|
-
"--model",
|
|
21614
|
-
model.model,
|
|
21615
|
-
"--thinking",
|
|
21616
|
-
model.thinking
|
|
21617
|
-
];
|
|
21618
|
-
}
|
|
21619
21666
|
function buildCoderActivationExtraArgs(admitted, options) {
|
|
21620
21667
|
const prompt = buildCoderTransportPrompt(admitted);
|
|
21621
21668
|
const skillArgs = admitted.phase === "apply" ? [
|
|
@@ -21641,7 +21688,7 @@ function buildCoderActivationExtraArgs(admitted, options) {
|
|
|
21641
21688
|
admitted.taskPath,
|
|
21642
21689
|
"--mode",
|
|
21643
21690
|
"json",
|
|
21644
|
-
...
|
|
21691
|
+
...buildSeatModelCliArgs(options.model),
|
|
21645
21692
|
prompt
|
|
21646
21693
|
];
|
|
21647
21694
|
}
|
|
@@ -21669,7 +21716,7 @@ function buildCoderResumeActivationExtraArgs(admitted, options) {
|
|
|
21669
21716
|
admitted.taskPath,
|
|
21670
21717
|
"--mode",
|
|
21671
21718
|
"json",
|
|
21672
|
-
...
|
|
21719
|
+
...buildSeatModelCliArgs(options.model),
|
|
21673
21720
|
RESUME_TRANSPORT_ENVELOPE
|
|
21674
21721
|
];
|
|
21675
21722
|
}
|
|
@@ -21735,7 +21782,7 @@ async function dispatchAdmittedCoder(input) {
|
|
|
21735
21782
|
io
|
|
21736
21783
|
);
|
|
21737
21784
|
}
|
|
21738
|
-
await markRunRunning(admitted.runDirectory);
|
|
21785
|
+
await markRunRunning(admitted.runDirectory, env.model);
|
|
21739
21786
|
await clearTypedProviderHttpObservation(admitted.runDirectory);
|
|
21740
21787
|
const childEnv = {
|
|
21741
21788
|
...process.env,
|
|
@@ -21841,7 +21888,8 @@ async function runPublicCoder(argv, env, io, parseCoderArgv2) {
|
|
|
21841
21888
|
instruction: parsed.instruction,
|
|
21842
21889
|
attachmentPaths: parsed.attachmentPaths,
|
|
21843
21890
|
...parsed.project === void 0 ? {} : { project: parsed.project },
|
|
21844
|
-
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId }
|
|
21891
|
+
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId },
|
|
21892
|
+
...env.model === void 0 ? {} : { model: env.model }
|
|
21845
21893
|
});
|
|
21846
21894
|
} catch (error) {
|
|
21847
21895
|
if (error instanceof CliUsageError) {
|
|
@@ -21995,17 +22043,6 @@ var init_coder_run = __esm({
|
|
|
21995
22043
|
// src/public-cli/collector-run.ts
|
|
21996
22044
|
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
21997
22045
|
import { join as join12 } from "node:path";
|
|
21998
|
-
function buildModelArgs2(model) {
|
|
21999
|
-
if (model === void 0) return [];
|
|
22000
|
-
return [
|
|
22001
|
-
"--provider",
|
|
22002
|
-
model.provider,
|
|
22003
|
-
"--model",
|
|
22004
|
-
model.model,
|
|
22005
|
-
"--thinking",
|
|
22006
|
-
model.thinking
|
|
22007
|
-
];
|
|
22008
|
-
}
|
|
22009
22046
|
function buildCollectorActivationExtraArgs(admitted, options = {}) {
|
|
22010
22047
|
const prompt = buildCollectorTransportPrompt(admitted);
|
|
22011
22048
|
return [
|
|
@@ -22027,7 +22064,7 @@ function buildCollectorActivationExtraArgs(admitted, options = {}) {
|
|
|
22027
22064
|
...admitted.requestManifestPath === void 0 ? [] : ["--ak-collector-request-manifest", admitted.requestManifestPath],
|
|
22028
22065
|
"--mode",
|
|
22029
22066
|
"json",
|
|
22030
|
-
...
|
|
22067
|
+
...buildSeatModelCliArgs(options.model),
|
|
22031
22068
|
prompt
|
|
22032
22069
|
];
|
|
22033
22070
|
}
|
|
@@ -22068,7 +22105,7 @@ async function dispatchAdmittedCollector(input) {
|
|
|
22068
22105
|
io
|
|
22069
22106
|
);
|
|
22070
22107
|
}
|
|
22071
|
-
await markRunRunning(admitted.runDirectory);
|
|
22108
|
+
await markRunRunning(admitted.runDirectory, env.model);
|
|
22072
22109
|
await clearTypedProviderHttpObservation(admitted.runDirectory);
|
|
22073
22110
|
const childEnv = {
|
|
22074
22111
|
...process.env,
|
|
@@ -22181,7 +22218,8 @@ async function runPublicCollector(argv, env, io, parseCollectorArgv2) {
|
|
|
22181
22218
|
...parsed.project === void 0 ? {} : { project: parsed.project },
|
|
22182
22219
|
...parsed.repo === void 0 ? {} : { repo: parsed.repo },
|
|
22183
22220
|
...parsed.requestManifestPath === void 0 ? {} : { requestManifestPath: parsed.requestManifestPath },
|
|
22184
|
-
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId }
|
|
22221
|
+
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId },
|
|
22222
|
+
...env.model === void 0 ? {} : { model: env.model }
|
|
22185
22223
|
});
|
|
22186
22224
|
} catch (error) {
|
|
22187
22225
|
if (error instanceof CliUsageError) {
|
|
@@ -22232,17 +22270,6 @@ var init_collector_run = __esm({
|
|
|
22232
22270
|
// src/public-cli/doctor-run.ts
|
|
22233
22271
|
import { writeFile as writeFile8 } from "node:fs/promises";
|
|
22234
22272
|
import { join as join13 } from "node:path";
|
|
22235
|
-
function buildModelArgs3(model) {
|
|
22236
|
-
if (model === void 0) return [];
|
|
22237
|
-
return [
|
|
22238
|
-
"--provider",
|
|
22239
|
-
model.provider,
|
|
22240
|
-
"--model",
|
|
22241
|
-
model.model,
|
|
22242
|
-
"--thinking",
|
|
22243
|
-
model.thinking
|
|
22244
|
-
];
|
|
22245
|
-
}
|
|
22246
22273
|
function buildDoctorActivationExtraArgs(admitted, options = {}) {
|
|
22247
22274
|
const prompt = buildDoctorTransportPrompt(admitted);
|
|
22248
22275
|
return [
|
|
@@ -22261,7 +22288,7 @@ function buildDoctorActivationExtraArgs(admitted, options = {}) {
|
|
|
22261
22288
|
admitted.caseRunsPath,
|
|
22262
22289
|
"--mode",
|
|
22263
22290
|
"json",
|
|
22264
|
-
...
|
|
22291
|
+
...buildSeatModelCliArgs(options.model),
|
|
22265
22292
|
prompt
|
|
22266
22293
|
];
|
|
22267
22294
|
}
|
|
@@ -22299,7 +22326,7 @@ async function dispatchAdmittedDoctor(input) {
|
|
|
22299
22326
|
io
|
|
22300
22327
|
);
|
|
22301
22328
|
}
|
|
22302
|
-
await markRunRunning(admitted.runDirectory);
|
|
22329
|
+
await markRunRunning(admitted.runDirectory, env.model);
|
|
22303
22330
|
await clearTypedProviderHttpObservation(admitted.runDirectory);
|
|
22304
22331
|
const childEnv = {
|
|
22305
22332
|
...process.env,
|
|
@@ -22417,7 +22444,8 @@ async function runPublicDoctor(argv, env, io, parseDoctorArgv2) {
|
|
|
22417
22444
|
attachmentPaths: parsed.attachmentPaths,
|
|
22418
22445
|
...parsed.project === void 0 ? {} : { project: parsed.project },
|
|
22419
22446
|
...parsed.runs === void 0 ? {} : { runs: parsed.runs },
|
|
22420
|
-
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId }
|
|
22447
|
+
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId },
|
|
22448
|
+
...env.model === void 0 ? {} : { model: env.model }
|
|
22421
22449
|
});
|
|
22422
22450
|
} catch (error) {
|
|
22423
22451
|
if (error instanceof CliUsageError) {
|
|
@@ -22465,17 +22493,6 @@ var init_doctor_run = __esm({
|
|
|
22465
22493
|
// src/public-cli/fixer-run.ts
|
|
22466
22494
|
import { writeFile as writeFile9 } from "node:fs/promises";
|
|
22467
22495
|
import { join as join14 } from "node:path";
|
|
22468
|
-
function buildModelArgs4(model) {
|
|
22469
|
-
if (model === void 0) return [];
|
|
22470
|
-
return [
|
|
22471
|
-
"--provider",
|
|
22472
|
-
model.provider,
|
|
22473
|
-
"--model",
|
|
22474
|
-
model.model,
|
|
22475
|
-
"--thinking",
|
|
22476
|
-
model.thinking
|
|
22477
|
-
];
|
|
22478
|
-
}
|
|
22479
22496
|
function buildFixerActivationExtraArgs(admitted, options) {
|
|
22480
22497
|
const prompt = buildFixerTransportPrompt(admitted);
|
|
22481
22498
|
const diagnosisSkillPath = resolvePackagedMethodSkillPath(
|
|
@@ -22507,7 +22524,7 @@ function buildFixerActivationExtraArgs(admitted, options) {
|
|
|
22507
22524
|
...prerequisiteArgs,
|
|
22508
22525
|
"--mode",
|
|
22509
22526
|
"json",
|
|
22510
|
-
...
|
|
22527
|
+
...buildSeatModelCliArgs(options.model),
|
|
22511
22528
|
prompt
|
|
22512
22529
|
];
|
|
22513
22530
|
}
|
|
@@ -22541,7 +22558,7 @@ function buildFixerResumeActivationExtraArgs(admitted, options) {
|
|
|
22541
22558
|
...prerequisiteArgs,
|
|
22542
22559
|
"--mode",
|
|
22543
22560
|
"json",
|
|
22544
|
-
...
|
|
22561
|
+
...buildSeatModelCliArgs(options.model),
|
|
22545
22562
|
RESUME_TRANSPORT_ENVELOPE
|
|
22546
22563
|
];
|
|
22547
22564
|
}
|
|
@@ -22604,7 +22621,7 @@ async function dispatchAdmittedFixer(input) {
|
|
|
22604
22621
|
io
|
|
22605
22622
|
);
|
|
22606
22623
|
}
|
|
22607
|
-
await markRunRunning(admitted.runDirectory);
|
|
22624
|
+
await markRunRunning(admitted.runDirectory, env.model);
|
|
22608
22625
|
await clearTypedProviderHttpObservation(admitted.runDirectory);
|
|
22609
22626
|
const childEnv = {
|
|
22610
22627
|
...process.env,
|
|
@@ -22733,7 +22750,8 @@ async function runPublicFixer(argv, env, io, parseFixerArgv2) {
|
|
|
22733
22750
|
attachmentPaths: parsed.attachmentPaths,
|
|
22734
22751
|
...parsed.prerequisitesPath === void 0 ? {} : { prerequisitesPath: parsed.prerequisitesPath },
|
|
22735
22752
|
...parsed.project === void 0 ? {} : { project: parsed.project },
|
|
22736
|
-
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId }
|
|
22753
|
+
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId },
|
|
22754
|
+
...env.model === void 0 ? {} : { model: env.model }
|
|
22737
22755
|
});
|
|
22738
22756
|
} catch (error) {
|
|
22739
22757
|
if (error instanceof CliUsageError) {
|
|
@@ -22873,17 +22891,6 @@ var init_fixer_run = __esm({
|
|
|
22873
22891
|
// src/public-cli/judge-run.ts
|
|
22874
22892
|
import { writeFile as writeFile10 } from "node:fs/promises";
|
|
22875
22893
|
import { join as join15 } from "node:path";
|
|
22876
|
-
function buildModelArgs5(model) {
|
|
22877
|
-
if (model === void 0) return [];
|
|
22878
|
-
return [
|
|
22879
|
-
"--provider",
|
|
22880
|
-
model.provider,
|
|
22881
|
-
"--model",
|
|
22882
|
-
model.model,
|
|
22883
|
-
"--thinking",
|
|
22884
|
-
model.thinking
|
|
22885
|
-
];
|
|
22886
|
-
}
|
|
22887
22894
|
function buildJudgeActivationExtraArgs(admitted, options = {}) {
|
|
22888
22895
|
const prompt = buildJudgeTransportPrompt(admitted);
|
|
22889
22896
|
return [
|
|
@@ -22901,7 +22908,7 @@ function buildJudgeActivationExtraArgs(admitted, options = {}) {
|
|
|
22901
22908
|
"judge",
|
|
22902
22909
|
"--mode",
|
|
22903
22910
|
"json",
|
|
22904
|
-
...
|
|
22911
|
+
...buildSeatModelCliArgs(options.model),
|
|
22905
22912
|
prompt
|
|
22906
22913
|
];
|
|
22907
22914
|
}
|
|
@@ -22920,7 +22927,7 @@ function buildJudgeResumeActivationExtraArgs(admitted, options = {}) {
|
|
|
22920
22927
|
"judge",
|
|
22921
22928
|
"--mode",
|
|
22922
22929
|
"json",
|
|
22923
|
-
...
|
|
22930
|
+
...buildSeatModelCliArgs(options.model),
|
|
22924
22931
|
RESUME_TRANSPORT_ENVELOPE
|
|
22925
22932
|
];
|
|
22926
22933
|
}
|
|
@@ -22983,7 +22990,7 @@ async function dispatchAdmittedJudge(input) {
|
|
|
22983
22990
|
io
|
|
22984
22991
|
);
|
|
22985
22992
|
}
|
|
22986
|
-
await markRunRunning(admitted.runDirectory);
|
|
22993
|
+
await markRunRunning(admitted.runDirectory, env.model);
|
|
22987
22994
|
await clearTypedProviderHttpObservation(admitted.runDirectory);
|
|
22988
22995
|
const childEnv = {
|
|
22989
22996
|
...process.env,
|
|
@@ -23102,7 +23109,8 @@ async function runPublicJudge(argv, env, io, parseJudgeArgv2) {
|
|
|
23102
23109
|
instruction: parsed.instruction,
|
|
23103
23110
|
attachmentPaths: parsed.attachmentPaths,
|
|
23104
23111
|
...parsed.project === void 0 ? {} : { project: parsed.project },
|
|
23105
|
-
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId }
|
|
23112
|
+
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId },
|
|
23113
|
+
...env.model === void 0 ? {} : { model: env.model }
|
|
23106
23114
|
});
|
|
23107
23115
|
} catch (error) {
|
|
23108
23116
|
if (error instanceof CliUsageError) {
|
|
@@ -23205,17 +23213,6 @@ var init_judge_run = __esm({
|
|
|
23205
23213
|
// src/public-cli/merger-run.ts
|
|
23206
23214
|
import { mkdir as mkdir4, writeFile as writeFile11 } from "node:fs/promises";
|
|
23207
23215
|
import { join as join16, resolve as resolve7 } from "node:path";
|
|
23208
|
-
function buildModelArgs6(model) {
|
|
23209
|
-
if (model === void 0) return [];
|
|
23210
|
-
return [
|
|
23211
|
-
"--provider",
|
|
23212
|
-
model.provider,
|
|
23213
|
-
"--model",
|
|
23214
|
-
model.model,
|
|
23215
|
-
"--thinking",
|
|
23216
|
-
model.thinking
|
|
23217
|
-
];
|
|
23218
|
-
}
|
|
23219
23216
|
function buildMergerActivationExtraArgs(admitted, options) {
|
|
23220
23217
|
const prompt = buildMergerTransportPrompt(admitted);
|
|
23221
23218
|
const skillPath = resolvePackagedMethodSkillPath(
|
|
@@ -23240,7 +23237,7 @@ function buildMergerActivationExtraArgs(admitted, options) {
|
|
|
23240
23237
|
admitted.mergerInputPath,
|
|
23241
23238
|
"--mode",
|
|
23242
23239
|
"json",
|
|
23243
|
-
...
|
|
23240
|
+
...buildSeatModelCliArgs(options.model),
|
|
23244
23241
|
prompt
|
|
23245
23242
|
];
|
|
23246
23243
|
}
|
|
@@ -23267,7 +23264,7 @@ function buildMergerResumeActivationExtraArgs(admitted, options) {
|
|
|
23267
23264
|
admitted.mergerInputPath,
|
|
23268
23265
|
"--mode",
|
|
23269
23266
|
"json",
|
|
23270
|
-
...
|
|
23267
|
+
...buildSeatModelCliArgs(options.model),
|
|
23271
23268
|
RESUME_TRANSPORT_ENVELOPE
|
|
23272
23269
|
];
|
|
23273
23270
|
}
|
|
@@ -23333,7 +23330,7 @@ async function dispatchAdmittedMerger(input) {
|
|
|
23333
23330
|
io
|
|
23334
23331
|
);
|
|
23335
23332
|
}
|
|
23336
|
-
await markRunRunning(admitted.runDirectory);
|
|
23333
|
+
await markRunRunning(admitted.runDirectory, env.model);
|
|
23337
23334
|
await clearTypedProviderHttpObservation(admitted.runDirectory);
|
|
23338
23335
|
const childEnv = {
|
|
23339
23336
|
...process.env,
|
|
@@ -23509,7 +23506,8 @@ async function runPublicMerger(argv, env, io, parseMergerArgv2) {
|
|
|
23509
23506
|
instruction: parsed.instruction,
|
|
23510
23507
|
attachmentPaths: parsed.attachmentPaths,
|
|
23511
23508
|
...parsed.project === void 0 ? {} : { project: parsed.project },
|
|
23512
|
-
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId }
|
|
23509
|
+
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId },
|
|
23510
|
+
...env.model === void 0 ? {} : { model: env.model }
|
|
23513
23511
|
});
|
|
23514
23512
|
} catch (error) {
|
|
23515
23513
|
if (error instanceof CliUsageError) {
|
|
@@ -23676,17 +23674,6 @@ var init_merger_run = __esm({
|
|
|
23676
23674
|
// src/public-cli/reviewer-run.ts
|
|
23677
23675
|
import { writeFile as writeFile12 } from "node:fs/promises";
|
|
23678
23676
|
import { join as join17 } from "node:path";
|
|
23679
|
-
function buildModelArgs7(model) {
|
|
23680
|
-
if (model === void 0) return [];
|
|
23681
|
-
return [
|
|
23682
|
-
"--provider",
|
|
23683
|
-
model.provider,
|
|
23684
|
-
"--model",
|
|
23685
|
-
model.model,
|
|
23686
|
-
"--thinking",
|
|
23687
|
-
model.thinking
|
|
23688
|
-
];
|
|
23689
|
-
}
|
|
23690
23677
|
function buildReviewerTicketNumberArgs(ticketNumber) {
|
|
23691
23678
|
return ticketNumber === void 0 ? [] : ["--ak-review-ticket-number", String(ticketNumber)];
|
|
23692
23679
|
}
|
|
@@ -23718,7 +23705,7 @@ function buildReviewerActivationExtraArgs(admitted, options) {
|
|
|
23718
23705
|
...ticketNumberArgs,
|
|
23719
23706
|
"--mode",
|
|
23720
23707
|
"json",
|
|
23721
|
-
...
|
|
23708
|
+
...buildSeatModelCliArgs(options.model),
|
|
23722
23709
|
prompt
|
|
23723
23710
|
];
|
|
23724
23711
|
}
|
|
@@ -23749,7 +23736,7 @@ function buildReviewerResumeActivationExtraArgs(admitted, options) {
|
|
|
23749
23736
|
...ticketNumberArgs,
|
|
23750
23737
|
"--mode",
|
|
23751
23738
|
"json",
|
|
23752
|
-
...
|
|
23739
|
+
...buildSeatModelCliArgs(options.model),
|
|
23753
23740
|
RESUME_TRANSPORT_ENVELOPE
|
|
23754
23741
|
];
|
|
23755
23742
|
}
|
|
@@ -23812,7 +23799,7 @@ async function dispatchAdmittedReviewer(input) {
|
|
|
23812
23799
|
io
|
|
23813
23800
|
);
|
|
23814
23801
|
}
|
|
23815
|
-
await markRunRunning(admitted.runDirectory);
|
|
23802
|
+
await markRunRunning(admitted.runDirectory, env.model);
|
|
23816
23803
|
await clearTypedProviderHttpObservation(admitted.runDirectory);
|
|
23817
23804
|
await clearReviewerDispatchRejection(admitted.runDirectory);
|
|
23818
23805
|
const childEnv = {
|
|
@@ -23942,7 +23929,8 @@ async function runPublicReviewer(argv, env, io, parseReviewerArgv2) {
|
|
|
23942
23929
|
baseRevision: parsed.baseRevision,
|
|
23943
23930
|
authorityRefs: parsed.authorityRefs,
|
|
23944
23931
|
...parsed.project === void 0 ? {} : { project: parsed.project },
|
|
23945
|
-
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId }
|
|
23932
|
+
...env.createRunId === void 0 ? {} : { createRunId: env.createRunId },
|
|
23933
|
+
...env.model === void 0 ? {} : { model: env.model }
|
|
23946
23934
|
});
|
|
23947
23935
|
} catch (error) {
|
|
23948
23936
|
if (error instanceof CliUsageError) {
|
|
@@ -26365,7 +26353,7 @@ async function runConfigCommand(args, home, io) {
|
|
|
26365
26353
|
if (!isPublicConfigurableSeat(seat)) {
|
|
26366
26354
|
throw new CliUsageError(`unknown configurable seat: ${seat}`);
|
|
26367
26355
|
}
|
|
26368
|
-
config = setPersistentSeatConfig(config, seat,
|
|
26356
|
+
config = setPersistentSeatConfig(config, seat, parsePersistentModelSpec(spec));
|
|
26369
26357
|
}
|
|
26370
26358
|
await savePublicCliConfig(config, home);
|
|
26371
26359
|
io.stdout(renderConfig(config));
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "./evidence-child-executor.ts";
|
|
8
8
|
import { createAuditorDossierTool } from "./auditor-dossier-tool.ts";
|
|
9
9
|
import type { DossierObservation } from "./dossier-resolution.ts";
|
|
10
|
+
import { withPackageOwnedToolIdleSuspended } from "./package-owned-tool-idle.ts";
|
|
10
11
|
import type { NoReceiptLifecycleFacts } from "./receipt-delivery-policy.ts";
|
|
11
12
|
|
|
12
13
|
export type ComplianceCompletion = AuditorCompletion;
|
|
@@ -116,24 +117,28 @@ export type RunComplianceAuditOptions = {
|
|
|
116
117
|
};
|
|
117
118
|
|
|
118
119
|
export async function runComplianceAudit(options: RunComplianceAuditOptions): Promise<ComplianceDecision> {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
120
|
+
// #339: only the real compliance-audit await leaves the outer package-owned
|
|
121
|
+
// idle owner. Pre/post-audit work stays under the single outer backstop.
|
|
122
|
+
return withPackageOwnedToolIdleSuspended(async () => {
|
|
123
|
+
const prompt = options.serializedInput ?? AUDITOR_DOSSIER_PROMPT;
|
|
124
|
+
const receipt = await executeAuditorChild({
|
|
125
|
+
tool: options.tool,
|
|
126
|
+
dossierTool: createAuditorDossierTool(options.runDirectory),
|
|
127
|
+
systemPrompt: options.systemPrompt,
|
|
128
|
+
prompt,
|
|
129
|
+
roleLabel: options.roleLabel,
|
|
130
|
+
context: options.context,
|
|
131
|
+
retainResponse: (response) => retainComplianceResponse(options.context, response),
|
|
132
|
+
...(options.runCompletion === undefined ? {} : { runCompletion: options.runCompletion }),
|
|
133
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
134
|
+
});
|
|
135
|
+
if (receipt.noReceiptLifecycle !== undefined) {
|
|
136
|
+
return {
|
|
137
|
+
status: "no-receipt",
|
|
138
|
+
...receipt.noReceiptLifecycle,
|
|
139
|
+
...(receipt.response.usage === undefined ? {} : { usage: receipt.response.usage }),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return readComplianceCandidate(receipt.decision, receipt.response.usage);
|
|
130
143
|
});
|
|
131
|
-
if (receipt.noReceiptLifecycle !== undefined) {
|
|
132
|
-
return {
|
|
133
|
-
status: "no-receipt",
|
|
134
|
-
...receipt.noReceiptLifecycle,
|
|
135
|
-
...(receipt.response.usage === undefined ? {} : { usage: receipt.response.usage }),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
return readComplianceCandidate(receipt.decision, receipt.response.usage);
|
|
139
144
|
}
|
|
@@ -381,6 +381,10 @@ export async function createInheritedRuntime(options: InheritedRuntimeOptions):
|
|
|
381
381
|
};
|
|
382
382
|
|
|
383
383
|
runtime.registerNativeProvider(provider);
|
|
384
|
+
// registerNativeProvider fires a background refresh; await it so child
|
|
385
|
+
// AgentSession.prompt sees configured auth without racing void refresh
|
|
386
|
+
// (mock timers / slow CI otherwise stall before the compliance stream).
|
|
387
|
+
await runtime.refresh({ allowNetwork: false });
|
|
384
388
|
return state;
|
|
385
389
|
}
|
|
386
390
|
|