@akagilnc/pi-workflow-roles 0.1.3682 → 0.1.3700
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/acp-host/production-host.js +519 -561
- package/dist/analyst-gate-cycles-read.js +11 -1
- package/dist/archivist-record-entry.js +1 -1
- package/dist/audit-escalation.js +4 -3
- package/dist/auditor-dossier-tool.js +12 -0
- package/dist/doctor-role.js +2 -1
- package/dist/dossier-resolution.js +0 -35
- package/dist/gatekeeper-pass-envelope.js +39 -34
- package/dist/gatekeeper-role.js +70 -76
- package/dist/judge-auditor.js +5 -24
- package/dist/judge-role.js +39 -41
- package/dist/notary-contracts.js +2 -17
- package/dist/notary-role.js +3 -6
- package/dist/package-contracts/judge-output.js +0 -2
- package/dist/package-contracts/terminating-tools.js +2 -2
- package/dist/public-cli/inspector-run.js +16 -2
- package/dist/public-cli/instruction-seat-run.js +14 -2
- package/dist/public-cli/main.js +198 -213
- package/dist/public-cli/notary-run.js +23 -20
- package/dist/public-cli/post-admission.js +30 -23
- package/dist/public-cli/run-lifecycle.js +6 -14
- package/dist/public-role-summons.js +38 -11
- package/dist/readable-gate-item.js +16 -0
- package/dist/role-runtime.js +28 -3
- package/dist/submission-correctable-error.js +2 -1
- package/dist/submission-errors.js +26 -8
- package/dist/submission-ledger.js +7 -23
- package/extensions/role-runtime.ts +0 -2
- package/package.json +1 -1
- package/souls/countersign.md +3 -1
- package/souls/notary.md +5 -0
- package/src/acp-host/production-host.ts +1 -4
- package/src/acp-host/role-envelope.ts +1 -1
- package/src/analyst-gate-cycles-read.ts +10 -1
- package/src/archivist-record-entry.ts +7 -3
- package/src/audit-escalation.ts +4 -3
- package/src/auditor-dossier-tool.ts +21 -0
- package/src/doctor-role.ts +2 -1
- package/src/dossier-resolution.ts +0 -39
- package/src/gatekeeper-pass-envelope.ts +59 -43
- package/src/gatekeeper-role.ts +114 -112
- package/src/host-contracts.ts +3 -3
- package/src/judge-auditor.ts +5 -43
- package/src/judge-role.ts +41 -53
- package/src/notary-contracts.ts +8 -27
- package/src/notary-role.ts +2 -7
- package/src/package-contracts/judge-output.ts +0 -1
- package/src/package-contracts/terminating-tools.ts +2 -2
- package/src/public-cli/inspector-run.ts +32 -2
- package/src/public-cli/instruction-seat-run.ts +30 -2
- package/src/public-cli/notary-run.ts +48 -16
- package/src/public-cli/post-admission.ts +31 -37
- package/src/public-cli/run-lifecycle.ts +6 -17
- package/src/public-role-summons.ts +76 -12
- package/src/readable-gate-item.ts +20 -0
- package/src/role-runtime.ts +34 -9
- package/src/submission-correctable-error.ts +2 -0
- package/src/submission-errors.ts +28 -8
- package/src/submission-ledger.ts +8 -32
- package/dist/shape-unreadable-failure.js +0 -34
package/dist/public-cli/main.js
CHANGED
|
@@ -14854,26 +14854,11 @@ var init_merger_contracts = __esm({
|
|
|
14854
14854
|
function isRecord5(value) {
|
|
14855
14855
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14856
14856
|
}
|
|
14857
|
-
function asStringArray2(value) {
|
|
14858
|
-
if (!Array.isArray(value)) return [];
|
|
14859
|
-
return value.filter((item) => typeof item === "string");
|
|
14860
|
-
}
|
|
14861
14857
|
function projectLawfulNotaryOutput(value) {
|
|
14862
14858
|
if (!isRecord5(value)) return void 0;
|
|
14863
14859
|
const status = typeof value.status === "string" ? value.status : void 0;
|
|
14864
|
-
if (status === "bounce") {
|
|
14865
|
-
|
|
14866
|
-
if (clone.disposition === void 0) clone.disposition = "rewrite";
|
|
14867
|
-
if (!Array.isArray(clone.findings)) clone.findings = asStringArray2(clone.findings);
|
|
14868
|
-
return clone;
|
|
14869
|
-
}
|
|
14870
|
-
if (status === "pass") {
|
|
14871
|
-
const clone = structuredClone(value);
|
|
14872
|
-
if (!Array.isArray(clone.findings)) clone.findings = asStringArray2(clone.findings);
|
|
14873
|
-
return clone;
|
|
14874
|
-
}
|
|
14875
|
-
if (status === "escalate") {
|
|
14876
|
-
return structuredClone(value);
|
|
14860
|
+
if (status === "bounce" || status === "pass" || status === "escalate") {
|
|
14861
|
+
return value;
|
|
14877
14862
|
}
|
|
14878
14863
|
return void 0;
|
|
14879
14864
|
}
|
|
@@ -16687,6 +16672,13 @@ var init_run_ticket_number = __esm({
|
|
|
16687
16672
|
}
|
|
16688
16673
|
});
|
|
16689
16674
|
|
|
16675
|
+
// src/readable-gate-item.ts
|
|
16676
|
+
var init_readable_gate_item = __esm({
|
|
16677
|
+
"src/readable-gate-item.ts"() {
|
|
16678
|
+
"use strict";
|
|
16679
|
+
}
|
|
16680
|
+
});
|
|
16681
|
+
|
|
16690
16682
|
// src/audit-escalation.ts
|
|
16691
16683
|
function isAuditEscalationResult(value) {
|
|
16692
16684
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -16698,6 +16690,7 @@ var AUDIT_ESCALATION_KIND;
|
|
|
16698
16690
|
var init_audit_escalation = __esm({
|
|
16699
16691
|
"src/audit-escalation.ts"() {
|
|
16700
16692
|
"use strict";
|
|
16693
|
+
init_readable_gate_item();
|
|
16701
16694
|
AUDIT_ESCALATION_KIND = "audit_escalation";
|
|
16702
16695
|
}
|
|
16703
16696
|
});
|
|
@@ -16706,6 +16699,7 @@ var init_audit_escalation = __esm({
|
|
|
16706
16699
|
var init_submission_errors = __esm({
|
|
16707
16700
|
"src/submission-errors.ts"() {
|
|
16708
16701
|
"use strict";
|
|
16702
|
+
init_readable_gate_item();
|
|
16709
16703
|
}
|
|
16710
16704
|
});
|
|
16711
16705
|
|
|
@@ -16755,10 +16749,10 @@ function validateAcceptedDetails(toolName, details) {
|
|
|
16755
16749
|
[COLLECTOR_OUTPUT_TOOL]: [],
|
|
16756
16750
|
[DOCTOR_OUTPUT_TOOL_NAME]: ["completed", "refused"],
|
|
16757
16751
|
[MERGER_OUTPUT_TOOL_NAME]: ["completed", "escalate"],
|
|
16758
|
-
[NOTARY_OUTPUT_TOOL_NAME]: ["pass", "bounce"],
|
|
16752
|
+
[NOTARY_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
|
|
16759
16753
|
[COUNTERSIGN_OUTPUT_TOOL_NAME]: ["converged", "continue", "escalate"],
|
|
16760
16754
|
[GLEANER_LEFT_OUTPUT_TOOL_NAME]: ["completed"],
|
|
16761
|
-
[INSPECTOR_OUTPUT_TOOL_NAME]: ["pass", "bounce"],
|
|
16755
|
+
[INSPECTOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
|
|
16762
16756
|
[GATEKEEPER_OUTPUT_TOOL_NAME]: ["dispatch", "pass"],
|
|
16763
16757
|
[NAVIGATOR_OUTPUT_TOOL_NAME]: ["advice"],
|
|
16764
16758
|
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
|
|
@@ -17275,13 +17269,6 @@ function instructResumeHandbookRead(prompt, engineMaterial) {
|
|
|
17275
17269
|
return line2;
|
|
17276
17270
|
}).join("\n");
|
|
17277
17271
|
}
|
|
17278
|
-
function appendResumeMaterialReread(prompt, materialPath) {
|
|
17279
|
-
const instruction = resumeRereadInstruction(materialPath, false);
|
|
17280
|
-
const lines = prompt.split("\n");
|
|
17281
|
-
if (lines.includes(instruction)) return prompt;
|
|
17282
|
-
return prompt.length === 0 ? instruction : `${prompt}
|
|
17283
|
-
${instruction}`;
|
|
17284
|
-
}
|
|
17285
17272
|
function selectResumeContinuationPrompt(message, engineMaterial) {
|
|
17286
17273
|
const base = message !== void 0 ? message : RESUME_TRANSPORT_ENVELOPE;
|
|
17287
17274
|
return instructResumeHandbookRead(
|
|
@@ -21891,16 +21878,10 @@ var init_method_skill = __esm({
|
|
|
21891
21878
|
});
|
|
21892
21879
|
|
|
21893
21880
|
// src/auditor-dossier-tool.ts
|
|
21894
|
-
import { dirname as dirname8, join as join15, resolve as resolve8 } from "node:path";
|
|
21895
|
-
function gateSubmissionCandidatePath(runDirectory) {
|
|
21896
|
-
return join15(runDirectory, "artifacts", GATE_SUBMISSION_CANDIDATE_FILE);
|
|
21897
|
-
}
|
|
21898
|
-
var GATE_SUBMISSION_CANDIDATE_FILE;
|
|
21899
21881
|
var init_auditor_dossier_tool = __esm({
|
|
21900
21882
|
"src/auditor-dossier-tool.ts"() {
|
|
21901
21883
|
"use strict";
|
|
21902
21884
|
init_build();
|
|
21903
|
-
GATE_SUBMISSION_CANDIDATE_FILE = "gate-submission-candidate.json";
|
|
21904
21885
|
}
|
|
21905
21886
|
});
|
|
21906
21887
|
|
|
@@ -22100,7 +22081,7 @@ var init_ledger_session_read = __esm({
|
|
|
22100
22081
|
|
|
22101
22082
|
// src/analyst-gate-cycles-read.ts
|
|
22102
22083
|
import { readdir as readdir3 } from "node:fs/promises";
|
|
22103
|
-
import { join as
|
|
22084
|
+
import { join as join15 } from "node:path";
|
|
22104
22085
|
function isRecord11(value) {
|
|
22105
22086
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22106
22087
|
}
|
|
@@ -22349,6 +22330,7 @@ async function resolveOfficerSessionFromPointerFile(pointerPath) {
|
|
|
22349
22330
|
async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, options = {}) {
|
|
22350
22331
|
const directories = typeof auditorRolesDirectory === "string" ? [auditorRolesDirectory] : auditorRolesDirectory;
|
|
22351
22332
|
const volumes = [];
|
|
22333
|
+
const classifiedOfficerSessions = /* @__PURE__ */ new Set();
|
|
22352
22334
|
for (const directory of directories) {
|
|
22353
22335
|
let names;
|
|
22354
22336
|
try {
|
|
@@ -22361,9 +22343,14 @@ async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, opti
|
|
|
22361
22343
|
throw error;
|
|
22362
22344
|
}
|
|
22363
22345
|
for (const name of names) {
|
|
22364
|
-
const path =
|
|
22365
|
-
const
|
|
22346
|
+
const path = join15(directory, name);
|
|
22347
|
+
const fromPointer = name.endsWith(".pointer.json");
|
|
22348
|
+
const sessionPath = fromPointer ? await resolveOfficerSessionFromPointerFile(path) : path;
|
|
22366
22349
|
if (sessionPath === void 0) continue;
|
|
22350
|
+
if (fromPointer) {
|
|
22351
|
+
if (classifiedOfficerSessions.has(sessionPath)) continue;
|
|
22352
|
+
classifiedOfficerSessions.add(sessionPath);
|
|
22353
|
+
}
|
|
22367
22354
|
const classified = await classifyAuditorVolume(sessionPath);
|
|
22368
22355
|
for (const volume of classified) {
|
|
22369
22356
|
if (options.parentSessionFile !== void 0 && volume.parentSessionFile !== void 0 && volume.parentSessionFile !== options.parentSessionFile) {
|
|
@@ -22397,31 +22384,9 @@ var init_analyst_gate_cycles_read = __esm({
|
|
|
22397
22384
|
}
|
|
22398
22385
|
});
|
|
22399
22386
|
|
|
22400
|
-
// src/shape-unreadable-failure.ts
|
|
22401
|
-
var init_shape_unreadable_failure = __esm({
|
|
22402
|
-
"src/shape-unreadable-failure.ts"() {
|
|
22403
|
-
"use strict";
|
|
22404
|
-
}
|
|
22405
|
-
});
|
|
22406
|
-
|
|
22407
|
-
// src/gatekeeper-role.ts
|
|
22408
|
-
var MISSING_ARGUMENTS_SUBMISSION;
|
|
22409
|
-
var init_gatekeeper_role = __esm({
|
|
22410
|
-
"src/gatekeeper-role.ts"() {
|
|
22411
|
-
"use strict";
|
|
22412
|
-
init_auditor_dossier_tool();
|
|
22413
|
-
init_submission_errors();
|
|
22414
|
-
init_inspector_contracts();
|
|
22415
|
-
init_gatekeeper_output();
|
|
22416
|
-
init_shape_unreadable_failure();
|
|
22417
|
-
init_submission_errors();
|
|
22418
|
-
MISSING_ARGUMENTS_SUBMISSION = Object.freeze({ missing: "arguments" });
|
|
22419
|
-
}
|
|
22420
|
-
});
|
|
22421
|
-
|
|
22422
22387
|
// src/run-terminal-artifacts.ts
|
|
22423
22388
|
import { readdir as readdir4, readFile as readFile12 } from "node:fs/promises";
|
|
22424
|
-
import { basename as basename6, dirname as
|
|
22389
|
+
import { basename as basename6, dirname as dirname8, join as join16 } from "node:path";
|
|
22425
22390
|
function isMissingPathError2(error) {
|
|
22426
22391
|
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
22427
22392
|
}
|
|
@@ -22496,7 +22461,7 @@ async function listUniqueErrorFallbackPaths(directories) {
|
|
|
22496
22461
|
}
|
|
22497
22462
|
for (const name of names.sort((a, b) => a.localeCompare(b))) {
|
|
22498
22463
|
if (!UNIQUE_ERROR_FALLBACK_NAME.test(name)) continue;
|
|
22499
|
-
found.push(
|
|
22464
|
+
found.push(join16(dir, name));
|
|
22500
22465
|
}
|
|
22501
22466
|
}
|
|
22502
22467
|
return found;
|
|
@@ -22512,14 +22477,14 @@ function presentUniqueFallbackBoundToRun(body, expectedRunId) {
|
|
|
22512
22477
|
return typeof body.runId === "string" && body.runId === expectedRunId;
|
|
22513
22478
|
}
|
|
22514
22479
|
async function readRunTerminalArtifact(runDirectory) {
|
|
22515
|
-
const artifactsDir =
|
|
22480
|
+
const artifactsDir = join16(runDirectory, "artifacts");
|
|
22516
22481
|
for (const file of RUN_TERMINAL_ARTIFACT_FILES) {
|
|
22517
|
-
const path =
|
|
22482
|
+
const path = join16(artifactsDir, file);
|
|
22518
22483
|
const read3 = await readTerminalArtifactAtPath(path, file);
|
|
22519
22484
|
if (read3 !== void 0) return read3;
|
|
22520
22485
|
}
|
|
22521
22486
|
for (const relative3 of RUN_TERMINAL_ERROR_FALLBACK_RELATIVE_PATHS) {
|
|
22522
|
-
const path =
|
|
22487
|
+
const path = join16(runDirectory, relative3);
|
|
22523
22488
|
const read3 = await readTerminalArtifactAtPath(path, "error.json");
|
|
22524
22489
|
if (read3 !== void 0) return read3;
|
|
22525
22490
|
}
|
|
@@ -22528,7 +22493,7 @@ async function readRunTerminalArtifact(runDirectory) {
|
|
|
22528
22493
|
if (read3 !== void 0) return read3;
|
|
22529
22494
|
}
|
|
22530
22495
|
const expectedRunId = runIdFromRunDirectory(runDirectory);
|
|
22531
|
-
for (const path of await listUniqueErrorFallbackPaths([
|
|
22496
|
+
for (const path of await listUniqueErrorFallbackPaths([dirname8(runDirectory)])) {
|
|
22532
22497
|
const read3 = await readTerminalArtifactAtPath(path, "error.json");
|
|
22533
22498
|
if (read3 === void 0) continue;
|
|
22534
22499
|
if (read3.status === "present") {
|
|
@@ -22648,7 +22613,6 @@ var init_submission_ledger = __esm({
|
|
|
22648
22613
|
"use strict";
|
|
22649
22614
|
init_activation_ledger_topology();
|
|
22650
22615
|
init_audit_escalation();
|
|
22651
|
-
init_gatekeeper_role();
|
|
22652
22616
|
init_terminating_tools();
|
|
22653
22617
|
init_run_terminal_artifacts();
|
|
22654
22618
|
init_sitian_facade();
|
|
@@ -22660,15 +22624,15 @@ var init_submission_ledger = __esm({
|
|
|
22660
22624
|
// src/session-opening-materials.ts
|
|
22661
22625
|
import { existsSync as existsSync6 } from "node:fs";
|
|
22662
22626
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
22663
|
-
import { dirname as
|
|
22627
|
+
import { dirname as dirname9, join as join17 } from "node:path";
|
|
22664
22628
|
import { fileURLToPath, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
22665
22629
|
function resolvePackageRootDir(moduleUrl = import.meta.url) {
|
|
22666
|
-
let dir =
|
|
22630
|
+
let dir = dirname9(fileURLToPath(moduleUrl));
|
|
22667
22631
|
for (let i = 0; i < 8; i += 1) {
|
|
22668
|
-
if (existsSync6(
|
|
22632
|
+
if (existsSync6(join17(dir, "package.json")) && existsSync6(join17(dir, "souls"))) {
|
|
22669
22633
|
return dir;
|
|
22670
22634
|
}
|
|
22671
|
-
const parent =
|
|
22635
|
+
const parent = dirname9(dir);
|
|
22672
22636
|
if (parent === dir) break;
|
|
22673
22637
|
dir = parent;
|
|
22674
22638
|
}
|
|
@@ -22770,7 +22734,6 @@ var init_auditor_soul = __esm({
|
|
|
22770
22734
|
var init_dossier_resolution = __esm({
|
|
22771
22735
|
"src/dossier-resolution.ts"() {
|
|
22772
22736
|
"use strict";
|
|
22773
|
-
init_judge_output();
|
|
22774
22737
|
}
|
|
22775
22738
|
});
|
|
22776
22739
|
|
|
@@ -22788,9 +22751,6 @@ var init_doctor_auditor = __esm({
|
|
|
22788
22751
|
var init_judge_auditor = __esm({
|
|
22789
22752
|
"src/judge-auditor.ts"() {
|
|
22790
22753
|
"use strict";
|
|
22791
|
-
init_compliance_transport();
|
|
22792
|
-
init_auditor_dossier_tool();
|
|
22793
|
-
init_dossier_resolution();
|
|
22794
22754
|
}
|
|
22795
22755
|
});
|
|
22796
22756
|
|
|
@@ -22991,12 +22951,12 @@ var init_reviewer_dispatch = __esm({
|
|
|
22991
22951
|
|
|
22992
22952
|
// src/public-cli/reviewer-dispatch-rejection.ts
|
|
22993
22953
|
import { readFile as readFile14, unlink as unlink3 } from "node:fs/promises";
|
|
22994
|
-
import { join as
|
|
22954
|
+
import { join as join18 } from "node:path";
|
|
22995
22955
|
function isReviewerPreflightViolation(value) {
|
|
22996
22956
|
return typeof value === "string" && REVIEWER_PREFLIGHT_VIOLATIONS.includes(value);
|
|
22997
22957
|
}
|
|
22998
22958
|
function reviewerDispatchRejectionPath(runDirectory) {
|
|
22999
|
-
return
|
|
22959
|
+
return join18(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
|
|
23000
22960
|
}
|
|
23001
22961
|
async function clearReviewerDispatchRejection(runDirectory) {
|
|
23002
22962
|
try {
|
|
@@ -23205,7 +23165,7 @@ function normalizeReviewComment(raw) {
|
|
|
23205
23165
|
function createGhApiRunner(options = {}) {
|
|
23206
23166
|
const spawnImpl = options.spawnImpl ?? spawn2;
|
|
23207
23167
|
return async (args, runOptions = {}) => {
|
|
23208
|
-
return await new Promise((
|
|
23168
|
+
return await new Promise((resolve12, reject) => {
|
|
23209
23169
|
const signal = runOptions.signal;
|
|
23210
23170
|
if (signal?.aborted) {
|
|
23211
23171
|
reject(signal.reason ?? new Error("aborted"));
|
|
@@ -23278,11 +23238,11 @@ function createGhApiRunner(options = {}) {
|
|
|
23278
23238
|
const value = line2.slice(idx + 1).trim();
|
|
23279
23239
|
headers[name] = value;
|
|
23280
23240
|
}
|
|
23281
|
-
|
|
23241
|
+
resolve12({ status, headers, bodyText });
|
|
23282
23242
|
return;
|
|
23283
23243
|
}
|
|
23284
23244
|
if (code === 0) {
|
|
23285
|
-
|
|
23245
|
+
resolve12({ status: 200, headers: {}, bodyText: stdout });
|
|
23286
23246
|
return;
|
|
23287
23247
|
}
|
|
23288
23248
|
const failure = new Error(
|
|
@@ -23860,7 +23820,7 @@ var init_terminal = __esm({
|
|
|
23860
23820
|
// src/public-cli/settlement.ts
|
|
23861
23821
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
23862
23822
|
import { appendFile as appendFile2, readFile as readFile15, readdir as readdir5, writeFile as writeFile5 } from "node:fs/promises";
|
|
23863
|
-
import { dirname as
|
|
23823
|
+
import { dirname as dirname10, join as join19 } from "node:path";
|
|
23864
23824
|
function sealedLedgerHome(admitted) {
|
|
23865
23825
|
return homeFromRunDirectory(admitted.runDirectory);
|
|
23866
23826
|
}
|
|
@@ -24235,7 +24195,7 @@ async function readSitianRetainedAuditorProviderStop(sessionFile) {
|
|
|
24235
24195
|
kind: "auditor",
|
|
24236
24196
|
sessionParent: sessionFile,
|
|
24237
24197
|
// Path is driven by sessionParent when under ledger home; cwd is a fallback only.
|
|
24238
|
-
cwd:
|
|
24198
|
+
cwd: dirname10(sessionFile)
|
|
24239
24199
|
});
|
|
24240
24200
|
const { records: records2 } = await readSitianRecords(recordFile);
|
|
24241
24201
|
for (let i = records2.length - 1; i >= 0; i -= 1) {
|
|
@@ -24261,7 +24221,7 @@ async function readSessionProviderStop(sessionFile) {
|
|
|
24261
24221
|
}
|
|
24262
24222
|
}
|
|
24263
24223
|
async function readBoundEvidenceChildKnownFailure(sessionFile) {
|
|
24264
|
-
const childDirectory =
|
|
24224
|
+
const childDirectory = join19(dirname10(sessionFile), "evidence-children");
|
|
24265
24225
|
let names;
|
|
24266
24226
|
try {
|
|
24267
24227
|
names = await readdir5(childDirectory);
|
|
@@ -24272,7 +24232,7 @@ async function readBoundEvidenceChildKnownFailure(sessionFile) {
|
|
|
24272
24232
|
for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
|
|
24273
24233
|
let entries;
|
|
24274
24234
|
try {
|
|
24275
|
-
entries = await readBoundSessionEntries(
|
|
24235
|
+
entries = await readBoundSessionEntries(join19(childDirectory, file));
|
|
24276
24236
|
} catch (error) {
|
|
24277
24237
|
throw sessionReadFailure(error, "failed to read discovered evidence-child session");
|
|
24278
24238
|
}
|
|
@@ -24326,7 +24286,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
24326
24286
|
latestParentUserIndex = i;
|
|
24327
24287
|
break;
|
|
24328
24288
|
}
|
|
24329
|
-
const childDirectories = [
|
|
24289
|
+
const childDirectories = [join19(dirname10(sessionFile), "auditor-roles")];
|
|
24330
24290
|
const valid = [];
|
|
24331
24291
|
let sawAnyDirectory = false;
|
|
24332
24292
|
for (const childDirectory of childDirectories) {
|
|
@@ -24341,7 +24301,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
24341
24301
|
for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
|
|
24342
24302
|
let entries;
|
|
24343
24303
|
try {
|
|
24344
|
-
entries = await readBoundSessionEntries(
|
|
24304
|
+
entries = await readBoundSessionEntries(join19(childDirectory, file));
|
|
24345
24305
|
} catch (error) {
|
|
24346
24306
|
throw sessionReadFailure(error, "failed to read discovered auditor session");
|
|
24347
24307
|
}
|
|
@@ -24873,8 +24833,8 @@ function projectTerminalGateFact(rounds) {
|
|
|
24873
24833
|
};
|
|
24874
24834
|
}
|
|
24875
24835
|
async function extractGateFactFromSessionDirectory(sessionDirectory, options = {}) {
|
|
24876
|
-
const directories = [
|
|
24877
|
-
const parentSessionFile = options.parentSessionFile ??
|
|
24836
|
+
const directories = [join19(sessionDirectory, "auditor-roles")];
|
|
24837
|
+
const parentSessionFile = options.parentSessionFile ?? join19(sessionDirectory, "session.jsonl");
|
|
24878
24838
|
const rounds = await readAnalystGateCyclesFromAuditorRoles(directories, {
|
|
24879
24839
|
parentSessionFile
|
|
24880
24840
|
});
|
|
@@ -24972,8 +24932,8 @@ async function extractNavigatorFactFromAdmittedSession(sessionFile) {
|
|
|
24972
24932
|
async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
|
|
24973
24933
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
24974
24934
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
24975
|
-
const reportPath =
|
|
24976
|
-
const evidencePath =
|
|
24935
|
+
const reportPath = join19(artifactsDir, "report.json");
|
|
24936
|
+
const evidencePath = join19(artifactsDir, "evidence.json");
|
|
24977
24937
|
await writeFile5(
|
|
24978
24938
|
reportPath,
|
|
24979
24939
|
`${JSON.stringify(
|
|
@@ -25017,8 +24977,8 @@ async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
|
|
|
25017
24977
|
async function publishCoderArtifacts(admitted, roleOutcome, coordinates, options = {}) {
|
|
25018
24978
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25019
24979
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25020
|
-
const reportPath =
|
|
25021
|
-
const evidencePath =
|
|
24980
|
+
const reportPath = join19(artifactsDir, "report.json");
|
|
24981
|
+
const evidencePath = join19(artifactsDir, "evidence.json");
|
|
25022
24982
|
await writeFile5(
|
|
25023
24983
|
reportPath,
|
|
25024
24984
|
`${JSON.stringify(
|
|
@@ -25169,8 +25129,8 @@ function extractFixerMethodInvocations(entries, options) {
|
|
|
25169
25129
|
async function publishFixerArtifacts(admitted, roleOutcome, coordinates, options) {
|
|
25170
25130
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25171
25131
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25172
|
-
const reportPath =
|
|
25173
|
-
const evidencePath =
|
|
25132
|
+
const reportPath = join19(artifactsDir, "report.json");
|
|
25133
|
+
const evidencePath = join19(artifactsDir, "evidence.json");
|
|
25174
25134
|
await writeFile5(
|
|
25175
25135
|
reportPath,
|
|
25176
25136
|
`${JSON.stringify(
|
|
@@ -25260,8 +25220,8 @@ async function settleLawfulFixerTerminalResult(admitted, authority, options) {
|
|
|
25260
25220
|
async function publishCollectorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
|
|
25261
25221
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25262
25222
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25263
|
-
const reportPath =
|
|
25264
|
-
const evidencePath =
|
|
25223
|
+
const reportPath = join19(artifactsDir, "report.json");
|
|
25224
|
+
const evidencePath = join19(artifactsDir, "evidence.json");
|
|
25265
25225
|
await writeFile5(
|
|
25266
25226
|
reportPath,
|
|
25267
25227
|
`${JSON.stringify(
|
|
@@ -25368,8 +25328,8 @@ async function trySettleCollectorTerminalResult(admitted, authority) {
|
|
|
25368
25328
|
async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
|
|
25369
25329
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25370
25330
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25371
|
-
const reportPath =
|
|
25372
|
-
const evidencePath =
|
|
25331
|
+
const reportPath = join19(artifactsDir, "report.json");
|
|
25332
|
+
const evidencePath = join19(artifactsDir, "evidence.json");
|
|
25373
25333
|
await writeFile5(
|
|
25374
25334
|
reportPath,
|
|
25375
25335
|
`${JSON.stringify(
|
|
@@ -25629,8 +25589,8 @@ function extractReviewerMethodInvocations(entries, options) {
|
|
|
25629
25589
|
async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, options) {
|
|
25630
25590
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25631
25591
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25632
|
-
const reportPath =
|
|
25633
|
-
const evidencePath =
|
|
25592
|
+
const reportPath = join19(artifactsDir, "report.json");
|
|
25593
|
+
const evidencePath = join19(artifactsDir, "evidence.json");
|
|
25634
25594
|
await writeFile5(
|
|
25635
25595
|
reportPath,
|
|
25636
25596
|
`${JSON.stringify(
|
|
@@ -25744,8 +25704,8 @@ function extractMergerMethodInvocations(entries, options) {
|
|
|
25744
25704
|
async function publishMergerArtifacts(admitted, roleOutcome, coordinates, options) {
|
|
25745
25705
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25746
25706
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25747
|
-
const reportPath =
|
|
25748
|
-
const evidencePath =
|
|
25707
|
+
const reportPath = join19(artifactsDir, "report.json");
|
|
25708
|
+
const evidencePath = join19(artifactsDir, "evidence.json");
|
|
25749
25709
|
await writeFile5(
|
|
25750
25710
|
reportPath,
|
|
25751
25711
|
`${JSON.stringify(
|
|
@@ -25884,13 +25844,13 @@ function publicationAttemptFromError(path, error) {
|
|
|
25884
25844
|
}
|
|
25885
25845
|
function uniqueFailureFallbackDirs(runDirectory, baseDir) {
|
|
25886
25846
|
const dirs = [];
|
|
25887
|
-
for (const dir of [baseDir, runDirectory,
|
|
25847
|
+
for (const dir of [baseDir, runDirectory, dirname10(runDirectory)]) {
|
|
25888
25848
|
if (!dirs.includes(dir)) dirs.push(dir);
|
|
25889
25849
|
}
|
|
25890
25850
|
return dirs;
|
|
25891
25851
|
}
|
|
25892
25852
|
async function resolveFailureArtifactsBase(runDirectory) {
|
|
25893
|
-
const artifactsDir =
|
|
25853
|
+
const artifactsDir = join19(runDirectory, "artifacts");
|
|
25894
25854
|
try {
|
|
25895
25855
|
await ensureRunArtifactsDir(runDirectory);
|
|
25896
25856
|
return { baseDir: artifactsDir };
|
|
@@ -25906,7 +25866,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
|
|
|
25906
25866
|
const candidates = [
|
|
25907
25867
|
...preferredCandidates,
|
|
25908
25868
|
// One unique name per fallback dir — collisions on fixed names cannot exhaust this.
|
|
25909
|
-
...uniqueFallbackDirs.map((dir) =>
|
|
25869
|
+
...uniqueFallbackDirs.map((dir) => join19(dir, `${stem}.${randomUUID3()}.json`))
|
|
25910
25870
|
];
|
|
25911
25871
|
for (let i = 0; i < candidates.length; i += 1) {
|
|
25912
25872
|
const path = candidates[i];
|
|
@@ -25951,26 +25911,26 @@ async function publishFailureArtifacts(admitted, failure, authority) {
|
|
|
25951
25911
|
} catch (error) {
|
|
25952
25912
|
priorIssues.push(publicationAttemptFromError(sessionFile, error));
|
|
25953
25913
|
}
|
|
25954
|
-
const underArtifacts = baseDir ===
|
|
25914
|
+
const underArtifacts = baseDir === join19(admitted.runDirectory, "artifacts");
|
|
25955
25915
|
const uniqueFallbackDirs = uniqueFailureFallbackDirs(
|
|
25956
25916
|
admitted.runDirectory,
|
|
25957
25917
|
baseDir
|
|
25958
25918
|
);
|
|
25959
25919
|
const errorCandidates = underArtifacts ? [
|
|
25960
|
-
|
|
25961
|
-
|
|
25962
|
-
|
|
25920
|
+
join19(baseDir, "error.json"),
|
|
25921
|
+
join19(baseDir, "error.settlement.json"),
|
|
25922
|
+
join19(admitted.runDirectory, "error.settlement.json")
|
|
25963
25923
|
] : [
|
|
25964
|
-
|
|
25965
|
-
|
|
25924
|
+
join19(baseDir, "error.settlement.json"),
|
|
25925
|
+
join19(baseDir, "error.json")
|
|
25966
25926
|
];
|
|
25967
25927
|
const evidenceCandidates = underArtifacts ? [
|
|
25968
|
-
|
|
25969
|
-
|
|
25970
|
-
|
|
25928
|
+
join19(baseDir, "evidence.json"),
|
|
25929
|
+
join19(baseDir, "evidence.settlement.json"),
|
|
25930
|
+
join19(admitted.runDirectory, "evidence.settlement.json")
|
|
25971
25931
|
] : [
|
|
25972
|
-
|
|
25973
|
-
|
|
25932
|
+
join19(baseDir, "evidence.settlement.json"),
|
|
25933
|
+
join19(baseDir, "evidence.json")
|
|
25974
25934
|
];
|
|
25975
25935
|
const errorPayloadBase = {
|
|
25976
25936
|
kind: "error",
|
|
@@ -26336,7 +26296,7 @@ var init_ticket_provenance_contracts = __esm({
|
|
|
26336
26296
|
// src/ticket-provenance.ts
|
|
26337
26297
|
import { createHash as createHash5 } from "node:crypto";
|
|
26338
26298
|
import { appendFileSync as appendFileSync2, existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
26339
|
-
import { join as
|
|
26299
|
+
import { join as join20 } from "node:path";
|
|
26340
26300
|
function ticketProvenanceSubject(ticketNumber) {
|
|
26341
26301
|
if (!Number.isSafeInteger(ticketNumber) || ticketNumber < 1) {
|
|
26342
26302
|
throw new Error(`ticket-provenance subject requires a positive ticket number, got ${String(ticketNumber)}`);
|
|
@@ -26370,8 +26330,8 @@ function resolveTicketProvenanceVolume(ticketNumber, cwd, home) {
|
|
|
26370
26330
|
return {
|
|
26371
26331
|
recordFile: path.recordFile,
|
|
26372
26332
|
volumeDir: path.sessionDir,
|
|
26373
|
-
humanViewFile:
|
|
26374
|
-
offeredWatermarkFile:
|
|
26333
|
+
humanViewFile: join20(path.sessionDir, TICKET_PROVENANCE_HUMAN_VIEW),
|
|
26334
|
+
offeredWatermarkFile: join20(path.sessionDir, TICKET_PROVENANCE_OFFERED_WATERMARK)
|
|
26375
26335
|
};
|
|
26376
26336
|
}
|
|
26377
26337
|
function readOfferedIdentities(ticketNumber, cwd, home) {
|
|
@@ -26608,7 +26568,7 @@ var init_case_dossier_delivery = __esm({
|
|
|
26608
26568
|
|
|
26609
26569
|
// src/host-transition-prior-native.ts
|
|
26610
26570
|
import { access as access2, readdir as readdir6 } from "node:fs/promises";
|
|
26611
|
-
import { dirname as
|
|
26571
|
+
import { dirname as dirname11, join as join21 } from "node:path";
|
|
26612
26572
|
function isEnoent2(error) {
|
|
26613
26573
|
return typeof error === "object" && error !== null && error.code === "ENOENT";
|
|
26614
26574
|
}
|
|
@@ -26622,7 +26582,7 @@ async function listPiNativeRecordPaths(sessionFile) {
|
|
|
26622
26582
|
}
|
|
26623
26583
|
}
|
|
26624
26584
|
async function listSitianRecordPaths(sessionParent) {
|
|
26625
|
-
const sessionRoot =
|
|
26585
|
+
const sessionRoot = dirname11(sessionParent);
|
|
26626
26586
|
let entries;
|
|
26627
26587
|
try {
|
|
26628
26588
|
entries = await readdir6(sessionRoot, { withFileTypes: true });
|
|
@@ -26633,7 +26593,7 @@ async function listSitianRecordPaths(sessionParent) {
|
|
|
26633
26593
|
const recordPaths = [];
|
|
26634
26594
|
for (const entry of entries) {
|
|
26635
26595
|
if (!entry.isDirectory()) continue;
|
|
26636
|
-
const recordFile =
|
|
26596
|
+
const recordFile = join21(sessionRoot, entry.name, "records.jsonl");
|
|
26637
26597
|
try {
|
|
26638
26598
|
await access2(recordFile);
|
|
26639
26599
|
recordPaths.push(recordFile);
|
|
@@ -26703,7 +26663,7 @@ var init_public_run_credentials = __esm({
|
|
|
26703
26663
|
import { constants as fsConstants } from "node:fs";
|
|
26704
26664
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
26705
26665
|
import { lstat as lstat5, mkdir as mkdir4, open as open2 } from "node:fs/promises";
|
|
26706
|
-
import { join as
|
|
26666
|
+
import { join as join22 } from "node:path";
|
|
26707
26667
|
function presentTerminal(terminal, io) {
|
|
26708
26668
|
if (terminal.roleOutcome.kind === "failure" || terminal.roleOutcome.kind === "no_receipt") {
|
|
26709
26669
|
presentFailureTerminal(terminal, io);
|
|
@@ -26722,7 +26682,7 @@ async function finalizeExceptionRunBestEffort(runDirectory, io) {
|
|
|
26722
26682
|
}
|
|
26723
26683
|
}
|
|
26724
26684
|
function runArtifactsDirectory(runDirectory) {
|
|
26725
|
-
return
|
|
26685
|
+
return join22(runDirectory, "artifacts");
|
|
26726
26686
|
}
|
|
26727
26687
|
async function ensureRealArtifactsDirectory(runDirectory) {
|
|
26728
26688
|
const runStat = await lstat5(runDirectory);
|
|
@@ -26805,7 +26765,7 @@ function jsonSafeReplacer() {
|
|
|
26805
26765
|
}
|
|
26806
26766
|
async function retainDispatchError(admitted, principalAuthority, sessionAppender, attempt, error) {
|
|
26807
26767
|
const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
|
|
26808
|
-
const filePath =
|
|
26768
|
+
const filePath = join22(
|
|
26809
26769
|
artifactsDir,
|
|
26810
26770
|
`dispatch-error-attempt-${attempt}-${randomUUID4()}.json`
|
|
26811
26771
|
);
|
|
@@ -27054,7 +27014,7 @@ var init_auto_resume = __esm({
|
|
|
27054
27014
|
// src/public-cli/post-admission.ts
|
|
27055
27015
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
27056
27016
|
import { readFile as readFile16, writeFile as writeFile6 } from "node:fs/promises";
|
|
27057
|
-
import { isAbsolute as isAbsolute7, join as
|
|
27017
|
+
import { isAbsolute as isAbsolute7, join as join23, resolve as resolve8 } from "node:path";
|
|
27058
27018
|
function appendContinuationSection(continuation, section) {
|
|
27059
27019
|
const prompt = `${continuation.prompt}
|
|
27060
27020
|
|
|
@@ -27063,7 +27023,7 @@ ${section}`;
|
|
|
27063
27023
|
}
|
|
27064
27024
|
async function readInvocationHost(runDirectory) {
|
|
27065
27025
|
try {
|
|
27066
|
-
const raw = JSON.parse(await readFile16(
|
|
27026
|
+
const raw = JSON.parse(await readFile16(join23(runDirectory, "invocation.json"), "utf8"));
|
|
27067
27027
|
return typeof raw.host === "string" && raw.host.trim() !== "" ? raw.host : void 0;
|
|
27068
27028
|
} catch (error) {
|
|
27069
27029
|
if (error.code === "ENOENT") return void 0;
|
|
@@ -27217,7 +27177,7 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
27217
27177
|
}
|
|
27218
27178
|
try {
|
|
27219
27179
|
await writeFile6(
|
|
27220
|
-
|
|
27180
|
+
join23(admitted.runDirectory, "stderr.log"),
|
|
27221
27181
|
result2.stderr,
|
|
27222
27182
|
"utf8"
|
|
27223
27183
|
);
|
|
@@ -27283,24 +27243,16 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
27283
27243
|
}
|
|
27284
27244
|
}
|
|
27285
27245
|
function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepared) {
|
|
27286
|
-
const engineMaterial = engineSessionMaterialFromOptions({
|
|
27287
|
-
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
27288
|
-
packageRoot: env.packageRoot
|
|
27289
|
-
});
|
|
27290
27246
|
let prompt;
|
|
27291
27247
|
if (request.message !== void 0) {
|
|
27292
|
-
if (summonsPrepared !== void 0
|
|
27293
|
-
prompt =
|
|
27294
|
-
|
|
27295
|
-
|
|
27296
|
-
|
|
27297
|
-
|
|
27298
|
-
|
|
27299
|
-
|
|
27300
|
-
engineMaterial
|
|
27301
|
-
),
|
|
27302
|
-
engineMaterial
|
|
27303
|
-
);
|
|
27248
|
+
if (summonsPrepared !== void 0) {
|
|
27249
|
+
prompt = buildInstructionTransportPrompt({
|
|
27250
|
+
instruction: request.message,
|
|
27251
|
+
instructionEmpty: false,
|
|
27252
|
+
attachments: summonsPrepared.attachments
|
|
27253
|
+
});
|
|
27254
|
+
} else if (request.summons !== void 0) {
|
|
27255
|
+
prompt = request.message;
|
|
27304
27256
|
} else {
|
|
27305
27257
|
prompt = buildResumeContinuationPrompt({
|
|
27306
27258
|
packageRoot: env.packageRoot,
|
|
@@ -27309,10 +27261,9 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
|
|
|
27309
27261
|
});
|
|
27310
27262
|
}
|
|
27311
27263
|
} else if (summonsPrepared !== void 0) {
|
|
27312
|
-
prompt =
|
|
27313
|
-
|
|
27314
|
-
|
|
27315
|
-
);
|
|
27264
|
+
prompt = buildInstructionTransportPrompt(summonsPrepared);
|
|
27265
|
+
} else if (request.summons !== void 0) {
|
|
27266
|
+
prompt = RESUME_TRANSPORT_ENVELOPE;
|
|
27316
27267
|
} else {
|
|
27317
27268
|
prompt = buildResumeContinuationPrompt({
|
|
27318
27269
|
packageRoot: env.packageRoot,
|
|
@@ -27334,8 +27285,8 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
|
|
|
27334
27285
|
};
|
|
27335
27286
|
}
|
|
27336
27287
|
function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
|
|
27337
|
-
const absolute = isAbsolute7(attachmentPath) ? attachmentPath :
|
|
27338
|
-
return pathContainedIn(
|
|
27288
|
+
const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve8(attachmentPath);
|
|
27289
|
+
return pathContainedIn(join23(runDirectory, "attachments"), absolute);
|
|
27339
27290
|
}
|
|
27340
27291
|
async function prepareSummonsResumeMaterials(runDirectory, summons) {
|
|
27341
27292
|
if (summons === void 0) return void 0;
|
|
@@ -27627,7 +27578,6 @@ var init_post_admission = __esm({
|
|
|
27627
27578
|
init_cli_errors();
|
|
27628
27579
|
init_invocation();
|
|
27629
27580
|
init_activation_ledger_topology();
|
|
27630
|
-
init_engine_material();
|
|
27631
27581
|
init_case_dossier_delivery();
|
|
27632
27582
|
init_host_transition_prior_native();
|
|
27633
27583
|
init_public_run_credentials();
|
|
@@ -27998,9 +27948,12 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
|
|
|
27998
27948
|
return { exitCode: 2 };
|
|
27999
27949
|
}
|
|
28000
27950
|
}
|
|
27951
|
+
const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
|
|
28001
27952
|
const summons = {
|
|
28002
|
-
|
|
28003
|
-
|
|
27953
|
+
...resumeInstruction === void 0 ? {
|
|
27954
|
+
instruction: parsed.instruction,
|
|
27955
|
+
instructionEmpty: parsed.instruction.trim() === ""
|
|
27956
|
+
} : { instruction: resumeInstruction, instructionEmpty: false },
|
|
28004
27957
|
attachmentPaths: parsed.attachmentPaths
|
|
28005
27958
|
};
|
|
28006
27959
|
if (role === "auditor" && auditorSourceRun !== void 0) {
|
|
@@ -28022,6 +27975,15 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
|
|
|
28022
27975
|
})
|
|
28023
27976
|
});
|
|
28024
27977
|
if (resumed !== void 0) return resumed;
|
|
27978
|
+
if (env.reviewReask !== void 0) {
|
|
27979
|
+
presentStructuralRejection(
|
|
27980
|
+
new CliUsageError(
|
|
27981
|
+
"auditor review reask requires a prior same-parent run to resume"
|
|
27982
|
+
),
|
|
27983
|
+
io
|
|
27984
|
+
);
|
|
27985
|
+
return { exitCode: 2 };
|
|
27986
|
+
}
|
|
28025
27987
|
}
|
|
28026
27988
|
let admitted;
|
|
28027
27989
|
try {
|
|
@@ -28212,7 +28174,7 @@ var init_collector_run = __esm({
|
|
|
28212
28174
|
// src/diarist-mechanical.ts
|
|
28213
28175
|
import { createHash as createHash6 } from "node:crypto";
|
|
28214
28176
|
import { existsSync as existsSync8, readdirSync as readdirSync2, readFileSync as readFileSync3, realpathSync as realpathSync3, statSync as statSync2 } from "node:fs";
|
|
28215
|
-
import { basename as basename7, join as
|
|
28177
|
+
import { basename as basename7, join as join24, resolve as resolve9 } from "node:path";
|
|
28216
28178
|
import { homedir } from "node:os";
|
|
28217
28179
|
function extractCornerQuotes(text, minLength = DEFAULT_QUOTE_MIN) {
|
|
28218
28180
|
const out = [];
|
|
@@ -28292,16 +28254,16 @@ function isNotificationRow(type, text) {
|
|
|
28292
28254
|
return false;
|
|
28293
28255
|
}
|
|
28294
28256
|
function readCcSessionBlocks(options) {
|
|
28295
|
-
const root = options.projectsRoot ??
|
|
28257
|
+
const root = options.projectsRoot ?? join24(homedir(), ".claude", "projects");
|
|
28296
28258
|
if (!existsSync8(root)) return [];
|
|
28297
28259
|
const blocks = [];
|
|
28298
28260
|
const dirs = /* @__PURE__ */ new Set();
|
|
28299
28261
|
for (const cwd of options.cwds) {
|
|
28300
|
-
dirs.add(
|
|
28262
|
+
dirs.add(join24(root, encodeClaudeProjectDir(cwd)));
|
|
28301
28263
|
}
|
|
28302
28264
|
for (const cwd of options.cwds) {
|
|
28303
28265
|
if (cwd.includes("projects")) continue;
|
|
28304
|
-
const direct =
|
|
28266
|
+
const direct = join24(root, cwd);
|
|
28305
28267
|
if (existsSync8(direct)) dirs.add(direct);
|
|
28306
28268
|
}
|
|
28307
28269
|
for (const dir of dirs) {
|
|
@@ -28330,7 +28292,7 @@ function readCcSessionBlocks(options) {
|
|
|
28330
28292
|
);
|
|
28331
28293
|
}
|
|
28332
28294
|
for (const name of files) {
|
|
28333
|
-
const sessionFile =
|
|
28295
|
+
const sessionFile = join24(dir, name);
|
|
28334
28296
|
let text;
|
|
28335
28297
|
try {
|
|
28336
28298
|
text = readFileSync3(sessionFile, "utf8");
|
|
@@ -28426,11 +28388,11 @@ function readIssueFaceBlocks(input) {
|
|
|
28426
28388
|
function readAdrDecisionKeyBlocks(input) {
|
|
28427
28389
|
const timestamp2 = input.timestamp ?? (/* @__PURE__ */ new Date(0)).toISOString();
|
|
28428
28390
|
const blocks = [];
|
|
28429
|
-
const cwdAbs =
|
|
28430
|
-
const adrRootAbs =
|
|
28391
|
+
const cwdAbs = resolve9(input.cwd);
|
|
28392
|
+
const adrRootAbs = resolve9(cwdAbs, DIARIST_ADR_ROOT_REL);
|
|
28431
28393
|
let adrRootReal;
|
|
28432
28394
|
try {
|
|
28433
|
-
adrRootReal = existsSync8(adrRootAbs) ? realpathSync3(adrRootAbs) :
|
|
28395
|
+
adrRootReal = existsSync8(adrRootAbs) ? realpathSync3(adrRootAbs) : resolve9(realpathSync3(cwdAbs), DIARIST_ADR_ROOT_REL);
|
|
28434
28396
|
} catch (error) {
|
|
28435
28397
|
throw new DiaristSourceReadError(
|
|
28436
28398
|
"adr-unreadable",
|
|
@@ -28444,11 +28406,11 @@ function readAdrDecisionKeyBlocks(input) {
|
|
|
28444
28406
|
if (segments[0] !== "docs" || segments[1] !== "adr" || segments.length < 3 || segments.some((part) => part === "" || part === "." || part === "..")) {
|
|
28445
28407
|
throw new DiaristSourceReadError(
|
|
28446
28408
|
"adr-escape",
|
|
28447
|
-
|
|
28409
|
+
resolve9(cwdAbs, rel),
|
|
28448
28410
|
`diarist referenced ADR escapes docs/adr (${rel})`
|
|
28449
28411
|
);
|
|
28450
28412
|
}
|
|
28451
|
-
const abs =
|
|
28413
|
+
const abs = resolve9(cwdAbs, rel);
|
|
28452
28414
|
if (abs !== adrRootAbs && !pathContainedIn(adrRootAbs, abs)) {
|
|
28453
28415
|
throw new DiaristSourceReadError(
|
|
28454
28416
|
"adr-escape",
|
|
@@ -28749,7 +28711,7 @@ __export(diarist_run_exports, {
|
|
|
28749
28711
|
});
|
|
28750
28712
|
import { existsSync as existsSync9 } from "node:fs";
|
|
28751
28713
|
import { writeFile as writeFile7 } from "node:fs/promises";
|
|
28752
|
-
import { join as
|
|
28714
|
+
import { join as join25 } from "node:path";
|
|
28753
28715
|
function withDiaristCatalogPath(prompt, sourcesPath) {
|
|
28754
28716
|
if (sourcesPath === void 0 || sourcesPath.trim() === "") return prompt;
|
|
28755
28717
|
return `${prompt}
|
|
@@ -28774,7 +28736,7 @@ function buildDiaristTurnRequest(admitted, options, sourcesPath) {
|
|
|
28774
28736
|
);
|
|
28775
28737
|
}
|
|
28776
28738
|
async function freezeDiaristSourceCatalog(admitted, env) {
|
|
28777
|
-
const path =
|
|
28739
|
+
const path = join25(admitted.runDirectory, DIARIST_SOURCE_CATALOG_FILE);
|
|
28778
28740
|
if (existsSync9(path)) {
|
|
28779
28741
|
const identity = await readRoleRunIdentity(admitted.runDirectory);
|
|
28780
28742
|
if (identity !== void 0 && identity.state !== "terminal") return path;
|
|
@@ -29628,7 +29590,6 @@ var init_fixer_run = __esm({
|
|
|
29628
29590
|
});
|
|
29629
29591
|
|
|
29630
29592
|
// src/public-cli/notary-run.ts
|
|
29631
|
-
import { existsSync as existsSync10 } from "node:fs";
|
|
29632
29593
|
function buildNotaryTurnRequest(admitted, options) {
|
|
29633
29594
|
return projectRoleTurnRequest(
|
|
29634
29595
|
admitted,
|
|
@@ -29670,9 +29631,11 @@ async function runPublicNotary(argv, env, io, parseNotaryArgv2) {
|
|
|
29670
29631
|
throw error;
|
|
29671
29632
|
}
|
|
29672
29633
|
{
|
|
29634
|
+
const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
|
|
29673
29635
|
const summons = {
|
|
29674
29636
|
sourceRunPath: source.runDirectory,
|
|
29675
|
-
sourceRun: source
|
|
29637
|
+
sourceRun: source,
|
|
29638
|
+
...resumeInstruction === void 0 ? {} : { instruction: resumeInstruction, instructionEmpty: false }
|
|
29676
29639
|
};
|
|
29677
29640
|
const resumed = await tryResumeSameTicketSeatRun({
|
|
29678
29641
|
home: env.home,
|
|
@@ -29688,6 +29651,15 @@ async function runPublicNotary(argv, env, io, parseNotaryArgv2) {
|
|
|
29688
29651
|
)
|
|
29689
29652
|
});
|
|
29690
29653
|
if (resumed !== void 0) return resumed;
|
|
29654
|
+
if (env.reviewReask !== void 0) {
|
|
29655
|
+
presentStructuralRejection(
|
|
29656
|
+
new CliUsageError(
|
|
29657
|
+
"notary review reask requires a prior same-parent run to resume"
|
|
29658
|
+
),
|
|
29659
|
+
io
|
|
29660
|
+
);
|
|
29661
|
+
return { exitCode: 2 };
|
|
29662
|
+
}
|
|
29691
29663
|
}
|
|
29692
29664
|
let admitted;
|
|
29693
29665
|
try {
|
|
@@ -29770,18 +29742,20 @@ async function runPublicNotaryResume(request, env, io) {
|
|
|
29770
29742
|
}
|
|
29771
29743
|
return loaded;
|
|
29772
29744
|
},
|
|
29773
|
-
buildTurnRequest: (admitted, effective) => {
|
|
29774
|
-
const
|
|
29745
|
+
buildTurnRequest: async (admitted, effective) => {
|
|
29746
|
+
const summonsPrepared = effective.summons === void 0 ? void 0 : await prepareSummonsResumeMaterials(
|
|
29747
|
+
admitted.runDirectory,
|
|
29748
|
+
effective.summons
|
|
29749
|
+
);
|
|
29750
|
+
return buildNotaryTurnRequest(
|
|
29775
29751
|
admitted,
|
|
29776
|
-
|
|
29777
|
-
|
|
29752
|
+
resumeTurnRequestProjectionOptions(
|
|
29753
|
+
admitted,
|
|
29754
|
+
effective,
|
|
29755
|
+
env,
|
|
29756
|
+
summonsPrepared
|
|
29757
|
+
)
|
|
29778
29758
|
);
|
|
29779
|
-
const candidatePath = gateSubmissionCandidatePath(admitted.sourceRunPath);
|
|
29780
|
-
const prompt = existsSync10(candidatePath) ? appendResumeMaterialReread(projection.continuation.prompt, candidatePath) : projection.continuation.prompt;
|
|
29781
|
-
return buildNotaryTurnRequest(admitted, {
|
|
29782
|
-
...projection,
|
|
29783
|
-
continuation: { kind: "resume", prompt }
|
|
29784
|
-
});
|
|
29785
29759
|
},
|
|
29786
29760
|
adapters: notaryAdapters(),
|
|
29787
29761
|
...env.engine === void 0 ? {} : { effectiveEngine: env.engine }
|
|
@@ -29790,7 +29764,6 @@ async function runPublicNotaryResume(request, env, io) {
|
|
|
29790
29764
|
var init_notary_run = __esm({
|
|
29791
29765
|
"src/public-cli/notary-run.ts"() {
|
|
29792
29766
|
"use strict";
|
|
29793
|
-
init_auditor_dossier_tool();
|
|
29794
29767
|
init_notary_source_run();
|
|
29795
29768
|
init_engine_material();
|
|
29796
29769
|
init_cli_errors();
|
|
@@ -29829,9 +29802,12 @@ async function runPublicInspector(argv, env, io, parseInspectorArgv2) {
|
|
|
29829
29802
|
const projectRoot = parsed.project ?? env.cwd;
|
|
29830
29803
|
const parentRunPath = parentRunPathFromGatePointerInstruction(parsed.instruction);
|
|
29831
29804
|
if (parentRunPath !== void 0) {
|
|
29805
|
+
const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
|
|
29832
29806
|
const summons = {
|
|
29833
|
-
|
|
29834
|
-
|
|
29807
|
+
...resumeInstruction === void 0 ? {
|
|
29808
|
+
instruction: parsed.instruction,
|
|
29809
|
+
instructionEmpty: parsed.instruction.trim() === ""
|
|
29810
|
+
} : { instruction: resumeInstruction, instructionEmpty: false },
|
|
29835
29811
|
attachmentPaths: parsed.attachmentPaths
|
|
29836
29812
|
};
|
|
29837
29813
|
const resumed = await tryResumeSameTicketSeatRun({
|
|
@@ -29848,6 +29824,15 @@ async function runPublicInspector(argv, env, io, parseInspectorArgv2) {
|
|
|
29848
29824
|
)
|
|
29849
29825
|
});
|
|
29850
29826
|
if (resumed !== void 0) return resumed;
|
|
29827
|
+
if (env.reviewReask !== void 0) {
|
|
29828
|
+
presentStructuralRejection(
|
|
29829
|
+
new CliUsageError(
|
|
29830
|
+
"inspector review reask requires a prior same-parent run to resume"
|
|
29831
|
+
),
|
|
29832
|
+
io
|
|
29833
|
+
);
|
|
29834
|
+
return { exitCode: 2 };
|
|
29835
|
+
}
|
|
29851
29836
|
}
|
|
29852
29837
|
let admitted;
|
|
29853
29838
|
try {
|
|
@@ -30057,7 +30042,7 @@ var init_judge_run = __esm({
|
|
|
30057
30042
|
|
|
30058
30043
|
// src/public-cli/merger-run.ts
|
|
30059
30044
|
import { mkdir as mkdir5, writeFile as writeFile8 } from "node:fs/promises";
|
|
30060
|
-
import { join as
|
|
30045
|
+
import { join as join26, resolve as resolve10 } from "node:path";
|
|
30061
30046
|
function mergerMethods(packageRoot2) {
|
|
30062
30047
|
return [
|
|
30063
30048
|
{
|
|
@@ -30099,7 +30084,7 @@ async function loadMergerMethodMaterial(packageRoot2) {
|
|
|
30099
30084
|
);
|
|
30100
30085
|
}
|
|
30101
30086
|
async function admitMergerShellForActivationFailure(options) {
|
|
30102
|
-
const projectRoot =
|
|
30087
|
+
const projectRoot = resolve10(options.project ?? options.cwd);
|
|
30103
30088
|
const runId = (options.createRunId ?? uuidv7)();
|
|
30104
30089
|
const {
|
|
30105
30090
|
principal,
|
|
@@ -30123,8 +30108,8 @@ async function admitMergerShellForActivationFailure(options) {
|
|
|
30123
30108
|
expectedConflictPaths: [],
|
|
30124
30109
|
resolutionScope: []
|
|
30125
30110
|
};
|
|
30126
|
-
const admittedRequestPath =
|
|
30127
|
-
const mergerInputPath =
|
|
30111
|
+
const admittedRequestPath = join26(runDirectory, "admitted-request.json");
|
|
30112
|
+
const mergerInputPath = join26(runDirectory, "merger-input.json");
|
|
30128
30113
|
await writeFile8(
|
|
30129
30114
|
admittedRequestPath,
|
|
30130
30115
|
`${JSON.stringify(
|
|
@@ -30564,10 +30549,10 @@ var init_analyst_book_key = __esm({
|
|
|
30564
30549
|
// src/atomic-write.ts
|
|
30565
30550
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
30566
30551
|
import { rename, rm, writeFile as writeFile9 } from "node:fs/promises";
|
|
30567
|
-
import { dirname as
|
|
30552
|
+
import { dirname as dirname12, join as join27 } from "node:path";
|
|
30568
30553
|
async function writeFileAtomically(destination, contents) {
|
|
30569
|
-
const parent =
|
|
30570
|
-
const temporary =
|
|
30554
|
+
const parent = dirname12(destination);
|
|
30555
|
+
const temporary = join27(parent, `.atomic-write-${randomUUID6()}.tmp`);
|
|
30571
30556
|
try {
|
|
30572
30557
|
await writeFile9(temporary, contents);
|
|
30573
30558
|
await rename(temporary, destination);
|
|
@@ -30584,16 +30569,16 @@ var init_atomic_write = __esm({
|
|
|
30584
30569
|
|
|
30585
30570
|
// src/analyst-index.ts
|
|
30586
30571
|
import { open as open3, readFile as readFile17, unlink as unlink4 } from "node:fs/promises";
|
|
30587
|
-
import { dirname as
|
|
30572
|
+
import { dirname as dirname13, join as join28 } from "node:path";
|
|
30588
30573
|
function sleep(ms) {
|
|
30589
|
-
return new Promise((
|
|
30590
|
-
setTimeout(
|
|
30574
|
+
return new Promise((resolve12) => {
|
|
30575
|
+
setTimeout(resolve12, ms);
|
|
30591
30576
|
});
|
|
30592
30577
|
}
|
|
30593
30578
|
async function withAnalystLibraryIndexLock(ledgerHome, fn) {
|
|
30594
30579
|
const indexPath = analystLibraryIndexPath(ledgerHome);
|
|
30595
|
-
ensureRealDirectoryTree(ledgerHome,
|
|
30596
|
-
const lockPath =
|
|
30580
|
+
ensureRealDirectoryTree(ledgerHome, dirname13(indexPath));
|
|
30581
|
+
const lockPath = join28(dirname13(indexPath), LIBRARY_INDEX_LOCK_NAME);
|
|
30597
30582
|
assertLedgerFileInsideHome(lockPath, ledgerHome);
|
|
30598
30583
|
const startedAt = Date.now();
|
|
30599
30584
|
while (true) {
|
|
@@ -30620,7 +30605,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
|
|
|
30620
30605
|
}
|
|
30621
30606
|
}
|
|
30622
30607
|
function analystLibraryIndexPath(ledgerHome) {
|
|
30623
|
-
return
|
|
30608
|
+
return join28(ledgerHome, "analyst", "library-index.json");
|
|
30624
30609
|
}
|
|
30625
30610
|
function rowFromIssueMetricsPage(page) {
|
|
30626
30611
|
return {
|
|
@@ -30729,7 +30714,7 @@ async function readAnalystLibraryIndexPage(ledgerHome) {
|
|
|
30729
30714
|
}
|
|
30730
30715
|
async function writeAnalystLibraryIndexPage(ledgerHome, page) {
|
|
30731
30716
|
const path = analystLibraryIndexPath(ledgerHome);
|
|
30732
|
-
ensureRealDirectoryTree(ledgerHome,
|
|
30717
|
+
ensureRealDirectoryTree(ledgerHome, dirname13(path));
|
|
30733
30718
|
assertLedgerFileInsideHome(path, ledgerHome);
|
|
30734
30719
|
await writeFileAtomically(path, `${JSON.stringify(page, null, 2)}
|
|
30735
30720
|
`);
|
|
@@ -30916,7 +30901,7 @@ var init_analyst_cohort = __esm({
|
|
|
30916
30901
|
|
|
30917
30902
|
// src/analyst-ledger.ts
|
|
30918
30903
|
import { readdir as readdir7, readFile as readFile18 } from "node:fs/promises";
|
|
30919
|
-
import { join as
|
|
30904
|
+
import { join as join29 } from "node:path";
|
|
30920
30905
|
function isMissingPathError5(error) {
|
|
30921
30906
|
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
30922
30907
|
}
|
|
@@ -30929,7 +30914,7 @@ function isRecord18(value) {
|
|
|
30929
30914
|
async function readExistingRunLifecycleState(runDirectory) {
|
|
30930
30915
|
try {
|
|
30931
30916
|
const raw = JSON.parse(
|
|
30932
|
-
await readFile18(
|
|
30917
|
+
await readFile18(join29(runDirectory, "run-state.json"), "utf8")
|
|
30933
30918
|
);
|
|
30934
30919
|
if (!isRecord18(raw) || typeof raw.state !== "string") return void 0;
|
|
30935
30920
|
return raw.state;
|
|
@@ -30961,7 +30946,7 @@ async function listLedgerBookNames(booksRoot) {
|
|
|
30961
30946
|
async function readInvocationScopeFields(runDirectory) {
|
|
30962
30947
|
let raw;
|
|
30963
30948
|
try {
|
|
30964
|
-
raw = await readFile18(
|
|
30949
|
+
raw = await readFile18(join29(runDirectory, "invocation.json"), "utf8");
|
|
30965
30950
|
} catch (error) {
|
|
30966
30951
|
if (isMissingPathError5(error)) return void 0;
|
|
30967
30952
|
throw error;
|
|
@@ -30993,7 +30978,7 @@ function decideIssueScope(input) {
|
|
|
30993
30978
|
}
|
|
30994
30979
|
async function resolveSessionFile(runDirectory) {
|
|
30995
30980
|
try {
|
|
30996
|
-
const raw = await readFile18(
|
|
30981
|
+
const raw = await readFile18(join29(runDirectory, "invocation.json"), "utf8");
|
|
30997
30982
|
const parsed = JSON.parse(raw);
|
|
30998
30983
|
if (isRecord18(parsed) && typeof parsed.sessionFile === "string" && parsed.sessionFile.trim() !== "") {
|
|
30999
30984
|
return parsed.sessionFile;
|
|
@@ -31001,7 +30986,7 @@ async function resolveSessionFile(runDirectory) {
|
|
|
31001
30986
|
} catch (error) {
|
|
31002
30987
|
if (!isMissingPathError5(error)) throw error;
|
|
31003
30988
|
}
|
|
31004
|
-
return
|
|
30989
|
+
return join29(runDirectory, "session", "session.jsonl");
|
|
31005
30990
|
}
|
|
31006
30991
|
function attributeSessionRowsForRun(input) {
|
|
31007
30992
|
if (pathContainedIn(input.runDirectory, input.sessionFile)) {
|
|
@@ -31173,9 +31158,9 @@ async function classifyScopedRun(input) {
|
|
|
31173
31158
|
}
|
|
31174
31159
|
let gateCycles;
|
|
31175
31160
|
try {
|
|
31176
|
-
const parentSessionFile =
|
|
31161
|
+
const parentSessionFile = join29(input.runDirectory, "session", "session.jsonl");
|
|
31177
31162
|
gateCycles = await readAnalystGateCyclesFromAuditorRoles(
|
|
31178
|
-
|
|
31163
|
+
join29(input.runDirectory, "session", "auditor-roles"),
|
|
31179
31164
|
{ parentSessionFile }
|
|
31180
31165
|
);
|
|
31181
31166
|
} catch (error) {
|
|
@@ -31208,7 +31193,7 @@ async function classifyScopedRun(input) {
|
|
|
31208
31193
|
async function scanAnalystIssueRuns(input) {
|
|
31209
31194
|
const ledgerHome = resolveActivationLedgerHome(input.home);
|
|
31210
31195
|
const scopeTicketNumber = input.ticketNumber;
|
|
31211
|
-
const booksRoot =
|
|
31196
|
+
const booksRoot = join29(ledgerHome, "books");
|
|
31212
31197
|
let wholeBook = false;
|
|
31213
31198
|
let scopeRootIdentity;
|
|
31214
31199
|
let bookNames;
|
|
@@ -31240,7 +31225,7 @@ async function scanAnalystIssueRuns(input) {
|
|
|
31240
31225
|
const unreadable = [];
|
|
31241
31226
|
const scopeConflicts = [];
|
|
31242
31227
|
for (const book of bookNames) {
|
|
31243
|
-
const runsDir =
|
|
31228
|
+
const runsDir = join29(booksRoot, book, "runs");
|
|
31244
31229
|
let runNames;
|
|
31245
31230
|
try {
|
|
31246
31231
|
const entries = await readdir7(runsDir, { withFileTypes: true });
|
|
@@ -31252,7 +31237,7 @@ async function scanAnalystIssueRuns(input) {
|
|
|
31252
31237
|
for (const runName of runNames) {
|
|
31253
31238
|
const parsed = parseRunDirectoryName2(runName);
|
|
31254
31239
|
if (parsed === void 0) continue;
|
|
31255
|
-
const runDirectory =
|
|
31240
|
+
const runDirectory = join29(runsDir, runName);
|
|
31256
31241
|
let scopeFields;
|
|
31257
31242
|
try {
|
|
31258
31243
|
scopeFields = await readInvocationScopeFields(runDirectory);
|
|
@@ -32106,7 +32091,7 @@ var init_analyst_metric_family = __esm({
|
|
|
32106
32091
|
|
|
32107
32092
|
// src/analyst-page.ts
|
|
32108
32093
|
import { createHash as createHash7 } from "node:crypto";
|
|
32109
|
-
import { dirname as
|
|
32094
|
+
import { dirname as dirname14, join as join30 } from "node:path";
|
|
32110
32095
|
function analystIssuePageKey(address) {
|
|
32111
32096
|
const parts = ["book", address.bookKey];
|
|
32112
32097
|
if (address.issueNumber !== void 0) {
|
|
@@ -32117,7 +32102,7 @@ function analystIssuePageKey(address) {
|
|
|
32117
32102
|
return createHash7("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
|
|
32118
32103
|
}
|
|
32119
32104
|
function analystIssuePagePath(ledgerHome, address) {
|
|
32120
|
-
return
|
|
32105
|
+
return join30(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
|
|
32121
32106
|
}
|
|
32122
32107
|
function analystIssuePageAddressFromPage(page) {
|
|
32123
32108
|
return {
|
|
@@ -32236,7 +32221,7 @@ async function buildAnalystIssueMetricsPage(input) {
|
|
|
32236
32221
|
}
|
|
32237
32222
|
async function writeAnalystIssueMetricsPage(ledgerHome, page) {
|
|
32238
32223
|
const path = analystIssuePagePath(ledgerHome, analystIssuePageAddressFromPage(page));
|
|
32239
|
-
ensureRealDirectoryTree(ledgerHome,
|
|
32224
|
+
ensureRealDirectoryTree(ledgerHome, dirname14(path));
|
|
32240
32225
|
assertLedgerFileInsideHome(path, ledgerHome);
|
|
32241
32226
|
await writeFileAtomically(path, `${JSON.stringify(page, null, 2)}
|
|
32242
32227
|
`);
|
|
@@ -32478,7 +32463,7 @@ var init_analyst_entry = __esm({
|
|
|
32478
32463
|
|
|
32479
32464
|
// src/public-cli/analyst-run.ts
|
|
32480
32465
|
import { readFile as readFile20 } from "node:fs/promises";
|
|
32481
|
-
import { isAbsolute as isAbsolute9, resolve as
|
|
32466
|
+
import { isAbsolute as isAbsolute9, resolve as resolve11 } from "node:path";
|
|
32482
32467
|
function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
|
|
32483
32468
|
try {
|
|
32484
32469
|
return resolveBookKeyFromGit(cwd);
|
|
@@ -32527,7 +32512,7 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
|
|
|
32527
32512
|
);
|
|
32528
32513
|
}
|
|
32529
32514
|
const sourcePath = attachmentPaths[0];
|
|
32530
|
-
const absolute = isAbsolute9(sourcePath) ? sourcePath :
|
|
32515
|
+
const absolute = isAbsolute9(sourcePath) ? sourcePath : resolve11(sourcePath);
|
|
32531
32516
|
let bytes;
|
|
32532
32517
|
try {
|
|
32533
32518
|
bytes = await readFile20(absolute);
|
|
@@ -32650,7 +32635,7 @@ __export(cli_exports, {
|
|
|
32650
32635
|
runAkRole: () => runAkRole
|
|
32651
32636
|
});
|
|
32652
32637
|
import { realpath as realpath6 } from "node:fs/promises";
|
|
32653
|
-
import { join as
|
|
32638
|
+
import { join as join31 } from "node:path";
|
|
32654
32639
|
function takePublicGlobalFlag(argv, index, options) {
|
|
32655
32640
|
const tokens = argv.slice(index);
|
|
32656
32641
|
const taken = options.takeDashed(tokens);
|
|
@@ -32782,7 +32767,7 @@ function resolveHome(env) {
|
|
|
32782
32767
|
return env.home ?? packageMachineHome();
|
|
32783
32768
|
}
|
|
32784
32769
|
function resolveAgentDir(env, home) {
|
|
32785
|
-
return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ??
|
|
32770
|
+
return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join31(home, ".pi", "agent");
|
|
32786
32771
|
}
|
|
32787
32772
|
function parseThinking(value) {
|
|
32788
32773
|
return value;
|
|
@@ -33737,8 +33722,8 @@ var init_cli = __esm({
|
|
|
33737
33722
|
});
|
|
33738
33723
|
|
|
33739
33724
|
// src/public-cli/main.ts
|
|
33740
|
-
import { existsSync as
|
|
33741
|
-
import { dirname as
|
|
33725
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
33726
|
+
import { dirname as dirname15, join as join32 } from "node:path";
|
|
33742
33727
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
33743
33728
|
|
|
33744
33729
|
// src/public-cli/host-pi-runtime.ts
|
|
@@ -33825,10 +33810,10 @@ function linkPackage(packageRoot2, name, targetDir) {
|
|
|
33825
33810
|
}
|
|
33826
33811
|
|
|
33827
33812
|
// src/public-cli/main.ts
|
|
33828
|
-
var here =
|
|
33813
|
+
var here = dirname15(fileURLToPath2(import.meta.url));
|
|
33829
33814
|
function resolvePackageRoot(binDir) {
|
|
33830
|
-
const canonical =
|
|
33831
|
-
if (
|
|
33815
|
+
const canonical = join32(binDir, "..", "..");
|
|
33816
|
+
if (existsSync10(join32(canonical, "package.json"))) {
|
|
33832
33817
|
return canonical;
|
|
33833
33818
|
}
|
|
33834
33819
|
return binDir;
|