@akagilnc/pi-workflow-roles 0.1.5478 → 0.1.5504
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 +4945 -4980
- package/dist/analyst-gate-cycles-read.js +11 -29
- package/dist/analyst-ledger.js +10 -12
- package/dist/archivist-record-entry.js +4 -3
- package/dist/archivist-record-pointer.js +59 -32
- package/dist/atomic-write.js +2 -2
- package/dist/auditor-dossier-tool.js +8 -4
- package/dist/auditor-soul.js +2 -1
- package/dist/collector-config.js +6 -5
- package/dist/doctor-evidence.js +5 -1
- package/dist/engine-detour-usage.js +4 -10
- package/dist/headless-host/description.js +251 -0
- package/dist/headless-host/production-host.js +2787 -2658
- package/dist/ledger-session-read.js +5 -0
- package/dist/migrate-book-topology.js +129 -100
- package/dist/navigator-public-session.js +13 -17
- package/dist/notary-source-run.js +7 -15
- package/dist/packaged-role-registry.js +0 -12
- package/dist/pi/durable-principal.js +2 -3
- package/dist/pi/role-turn-host.js +27 -13
- package/dist/public-cli/instruction-seat-run.js +4 -4
- package/dist/public-cli/invocation.js +17 -45
- package/dist/public-cli/main.js +1074 -1085
- package/dist/public-cli/run-lifecycle.js +17 -47
- package/dist/public-cli/settlement.js +28 -128
- package/dist/public-cli/terminal.js +0 -12
- package/dist/role-run-placement.js +52 -5
- package/dist/role-run-relocation.js +39 -2
- package/dist/run-terminal-artifacts.js +2 -6
- package/dist/run-ticket-number.js +33 -4
- package/dist/session-assistant-usage.js +9 -18
- package/dist/session-identity.js +3 -4
- package/dist/sitian-appender.js +20 -6
- package/dist/submission-ledger.js +4 -4
- package/dist/ticket-provenance-contracts.js +2 -8
- package/dist/ticket-provenance.js +5 -4
- package/package.json +1 -1
- package/src/acp-host/role-turn-host.ts +2 -2
- package/src/analyst-gate-cycles-read.ts +11 -34
- package/src/analyst-ledger.ts +14 -14
- package/src/archivist-record-entry.ts +4 -3
- package/src/archivist-record-pointer.ts +70 -34
- package/src/atomic-write.ts +3 -1
- package/src/auditor-dossier-tool.ts +8 -4
- package/src/auditor-soul.ts +2 -1
- package/src/collector-config.ts +5 -3
- package/src/doctor-evidence.ts +5 -1
- package/src/engine-detour-usage.ts +10 -13
- package/src/factory-board.ts +16 -81
- package/src/headless-host/description.ts +248 -1
- package/src/headless-host/production-host.ts +1 -2
- package/src/headless-host/role-turn-host.ts +10 -9
- package/src/ledger-session-read.ts +6 -0
- package/src/navigator-public-session.ts +13 -18
- package/src/navigator-work-context.ts +3 -1
- package/src/notary-role.ts +2 -1
- package/src/notary-source-run.ts +7 -17
- package/src/packaged-role-registry.ts +0 -15
- package/src/pi/durable-principal.ts +2 -4
- package/src/pi/role-turn-host.ts +35 -12
- package/src/public-cli/instruction-seat-run.ts +4 -4
- package/src/public-cli/invocation.ts +29 -57
- package/src/public-cli/run-lifecycle.ts +20 -43
- package/src/public-cli/settlement.ts +30 -173
- package/src/public-cli/terminal.ts +0 -60
- package/src/role-envelope.ts +4 -2
- package/src/role-run-placement.ts +63 -4
- package/src/role-run-relocation.ts +39 -2
- package/src/role-runtime.ts +40 -59
- package/src/run-terminal-artifacts.ts +3 -5
- package/src/run-ticket-number.ts +41 -3
- package/src/session-assistant-usage.ts +8 -20
- package/src/session-identity.ts +3 -4
- package/src/sitian-appender.ts +20 -12
- package/src/submission-ledger.ts +4 -4
- package/src/ticket-provenance-contracts.ts +3 -6
- package/src/ticket-provenance.ts +5 -6
- package/src/ticket-snapshot.ts +3 -2
- package/src/ticket-trajectory.ts +85 -99
|
@@ -553,8 +553,20 @@ var init_activation_ledger_topology = __esm({
|
|
|
553
553
|
// src/run-ticket-number.ts
|
|
554
554
|
import { readFile } from "node:fs/promises";
|
|
555
555
|
import { join as join2 } from "node:path";
|
|
556
|
+
function isPositiveTicketNumber(value2) {
|
|
557
|
+
return typeof value2 === "number" && Number.isInteger(value2) && value2 >= 1;
|
|
558
|
+
}
|
|
556
559
|
function isSafePositiveTicketNumber(value2) {
|
|
557
|
-
return
|
|
560
|
+
return isPositiveTicketNumber(value2) && Number.isSafeInteger(value2);
|
|
561
|
+
}
|
|
562
|
+
function isTicketNumberString(value2) {
|
|
563
|
+
return typeof value2 === "string" && /^[1-9][0-9]*$/.test(value2);
|
|
564
|
+
}
|
|
565
|
+
function parseTicketNumber(value2) {
|
|
566
|
+
if (isSafePositiveTicketNumber(value2)) return value2;
|
|
567
|
+
if (!isTicketNumberString(value2)) return void 0;
|
|
568
|
+
const parsed2 = Number(value2);
|
|
569
|
+
return isSafePositiveTicketNumber(parsed2) ? parsed2 : void 0;
|
|
558
570
|
}
|
|
559
571
|
function requireSafePositiveTicketNumber(ticketNumber, context = "ticketNumber") {
|
|
560
572
|
if (!isSafePositiveTicketNumber(ticketNumber)) {
|
|
@@ -606,7 +618,16 @@ var init_run_ticket_number = __esm({
|
|
|
606
618
|
|
|
607
619
|
// src/role-run-placement.ts
|
|
608
620
|
import { readdir } from "node:fs/promises";
|
|
609
|
-
import { join as join3 } from "node:path";
|
|
621
|
+
import { basename as basename2, dirname as dirname2, join as join3 } from "node:path";
|
|
622
|
+
function formatRunLeaf(runId, role) {
|
|
623
|
+
return `${runId}@${role}`;
|
|
624
|
+
}
|
|
625
|
+
function sessionDirectoryOf(runDirectory) {
|
|
626
|
+
return join3(runDirectory, "session");
|
|
627
|
+
}
|
|
628
|
+
function sessionFileIn(sessionDirectory) {
|
|
629
|
+
return join3(sessionDirectory, ROLE_RUN_SESSION_FILENAME);
|
|
630
|
+
}
|
|
610
631
|
async function listBookRunDirectories(bookDir) {
|
|
611
632
|
const out = [];
|
|
612
633
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -649,13 +670,13 @@ function roleRunPlacement(ledgerHome, input) {
|
|
|
649
670
|
activationBookDirectory(ledgerHome, input.bookKey),
|
|
650
671
|
subjectDirectory,
|
|
651
672
|
"runs",
|
|
652
|
-
|
|
673
|
+
formatRunLeaf(input.runId, input.role)
|
|
653
674
|
);
|
|
654
|
-
const sessionDirectory =
|
|
675
|
+
const sessionDirectory = sessionDirectoryOf(runDirectory);
|
|
655
676
|
return {
|
|
656
677
|
runDirectory,
|
|
657
678
|
sessionDirectory,
|
|
658
|
-
sessionFile:
|
|
679
|
+
sessionFile: sessionFileIn(sessionDirectory),
|
|
659
680
|
artifactsDirectory: roleRunArtifactsDirectory(runDirectory),
|
|
660
681
|
attachmentsDirectory: join3(runDirectory, "attachments")
|
|
661
682
|
};
|
|
@@ -666,12 +687,14 @@ function roleRunArtifactsDirectory(runDirectory) {
|
|
|
666
687
|
function isUnboundRunDirectory(runDirectory) {
|
|
667
688
|
return runDirectory.replaceAll("\\", "/").includes("/unbound/runs/");
|
|
668
689
|
}
|
|
690
|
+
var ROLE_RUN_SESSION_FILENAME;
|
|
669
691
|
var init_role_run_placement = __esm({
|
|
670
692
|
"src/role-run-placement.ts"() {
|
|
671
693
|
"use strict";
|
|
672
694
|
init_activation_ledger_topology();
|
|
673
695
|
init_run_ticket_number();
|
|
674
696
|
init_unknown_value();
|
|
697
|
+
ROLE_RUN_SESSION_FILENAME = "session.jsonl";
|
|
675
698
|
}
|
|
676
699
|
});
|
|
677
700
|
|
|
@@ -699,6 +722,7 @@ var init_collector_config = __esm({
|
|
|
699
722
|
"use strict";
|
|
700
723
|
init_sha256();
|
|
701
724
|
init_unknown_value();
|
|
725
|
+
init_run_ticket_number();
|
|
702
726
|
}
|
|
703
727
|
});
|
|
704
728
|
|
|
@@ -13841,12 +13865,7 @@ var init_auditor_output = __esm({
|
|
|
13841
13865
|
|
|
13842
13866
|
// src/ticket-provenance-contracts.ts
|
|
13843
13867
|
function positiveInteger(value2) {
|
|
13844
|
-
|
|
13845
|
-
if (typeof value2 === "string" && /^[1-9][0-9]*$/.test(value2)) {
|
|
13846
|
-
const parsed2 = Number(value2);
|
|
13847
|
-
if (Number.isSafeInteger(parsed2)) return parsed2;
|
|
13848
|
-
}
|
|
13849
|
-
return void 0;
|
|
13868
|
+
return parseTicketNumber(value2);
|
|
13850
13869
|
}
|
|
13851
13870
|
function projectBound(value2) {
|
|
13852
13871
|
if (!isRecord(value2)) return void 0;
|
|
@@ -13897,6 +13916,7 @@ function projectTicketProvenanceHeader(value2) {
|
|
|
13897
13916
|
var init_ticket_provenance_contracts = __esm({
|
|
13898
13917
|
"src/ticket-provenance-contracts.ts"() {
|
|
13899
13918
|
"use strict";
|
|
13919
|
+
init_run_ticket_number();
|
|
13900
13920
|
init_unknown_value();
|
|
13901
13921
|
}
|
|
13902
13922
|
});
|
|
@@ -14287,8 +14307,6 @@ var init_packaged_role_registry = __esm({
|
|
|
14287
14307
|
sourceRunStored: "raw",
|
|
14288
14308
|
argvResult: "source-run",
|
|
14289
14309
|
sameParent: "source-locator",
|
|
14290
|
-
/** Infrastructure failure at this stage has no accepted gate cycle to project. */
|
|
14291
|
-
skipGateOnInfrastructureStage: true,
|
|
14292
14310
|
/** 符宝郎 is a review officer and inherits the gatekeeper model. */
|
|
14293
14311
|
reviewOfficer: true,
|
|
14294
14312
|
provinceConfig: true,
|
|
@@ -14396,8 +14414,6 @@ var init_packaged_role_registry = __esm({
|
|
|
14396
14414
|
sameParent: "gate-pointer",
|
|
14397
14415
|
/** Resume restores an optional source-run path onto the admitted face. */
|
|
14398
14416
|
resumeSourcePath: true,
|
|
14399
|
-
/** Infrastructure failure at this stage has no accepted gate cycle to project. */
|
|
14400
|
-
skipGateOnInfrastructureStage: true,
|
|
14401
14417
|
/** 台院 is a review officer and inherits the gatekeeper model. */
|
|
14402
14418
|
reviewOfficer: true,
|
|
14403
14419
|
provinceConfig: true,
|
|
@@ -14429,8 +14445,6 @@ var init_packaged_role_registry = __esm({
|
|
|
14429
14445
|
presentSettled: "always",
|
|
14430
14446
|
summonResume: true,
|
|
14431
14447
|
admission: "instruction",
|
|
14432
|
-
/** Infrastructure failure at this stage has no accepted gate cycle to project. */
|
|
14433
|
-
skipGateOnInfrastructureStage: true,
|
|
14434
14448
|
sameParent: "none",
|
|
14435
14449
|
/** Province model root. Officers name this seat via modelInheritsFrom. */
|
|
14436
14450
|
provinceConfig: true,
|
|
@@ -14890,7 +14904,7 @@ var init_compliance_transport = __esm({
|
|
|
14890
14904
|
// src/role-run-relocation.ts
|
|
14891
14905
|
import { existsSync } from "node:fs";
|
|
14892
14906
|
import { readdir as readdir2, readFile as readFile2, writeFile } from "node:fs/promises";
|
|
14893
|
-
import { join as join4, sep as sep2 } from "node:path";
|
|
14907
|
+
import { dirname as dirname3, join as join4, sep as sep2 } from "node:path";
|
|
14894
14908
|
function rewriteRunDirectoryPathValue(value2, oldRunDirectory, newRunDirectory) {
|
|
14895
14909
|
if (typeof value2 !== "string") return value2;
|
|
14896
14910
|
if (value2 === oldRunDirectory) return newRunDirectory;
|
|
@@ -15192,6 +15206,9 @@ var ADMITTED_PAGE_FIELDS, INVOCATION_PAGE_FIELDS, RUN_STATE_PAGE_FIELDS, SOURCE_
|
|
|
15192
15206
|
var init_role_run_relocation = __esm({
|
|
15193
15207
|
"src/role-run-relocation.ts"() {
|
|
15194
15208
|
"use strict";
|
|
15209
|
+
init_activation_ledger_topology();
|
|
15210
|
+
init_run_lifecycle();
|
|
15211
|
+
init_role_run_placement();
|
|
15195
15212
|
init_compliance_transport();
|
|
15196
15213
|
init_unknown_value();
|
|
15197
15214
|
ADMITTED_PAGE_FIELDS = [
|
|
@@ -15283,6 +15300,7 @@ var init_doctor_evidence = __esm({
|
|
|
15283
15300
|
"src/doctor-evidence.ts"() {
|
|
15284
15301
|
"use strict";
|
|
15285
15302
|
init_sha256();
|
|
15303
|
+
init_activation_ledger_topology();
|
|
15286
15304
|
init_terminating_tools();
|
|
15287
15305
|
init_unknown_value();
|
|
15288
15306
|
}
|
|
@@ -15323,14 +15341,6 @@ var init_ledger_session_read = __esm({
|
|
|
15323
15341
|
}
|
|
15324
15342
|
});
|
|
15325
15343
|
|
|
15326
|
-
// src/session-dialogue.ts
|
|
15327
|
-
var init_session_dialogue = __esm({
|
|
15328
|
-
"src/session-dialogue.ts"() {
|
|
15329
|
-
"use strict";
|
|
15330
|
-
init_unknown_value();
|
|
15331
|
-
}
|
|
15332
|
-
});
|
|
15333
|
-
|
|
15334
15344
|
// src/sitian-contracts.ts
|
|
15335
15345
|
var init_sitian_contracts = __esm({
|
|
15336
15346
|
"src/sitian-contracts.ts"() {
|
|
@@ -15343,6 +15353,8 @@ var S4_SUBMISSION_LEDGER_KINDS;
|
|
|
15343
15353
|
var init_sitian_appender = __esm({
|
|
15344
15354
|
"src/sitian-appender.ts"() {
|
|
15345
15355
|
"use strict";
|
|
15356
|
+
init_role_run_placement();
|
|
15357
|
+
init_run_ticket_number();
|
|
15346
15358
|
init_activation_ledger_git();
|
|
15347
15359
|
init_activation_ledger_topology();
|
|
15348
15360
|
init_sitian_contracts();
|
|
@@ -15356,6 +15368,14 @@ var init_sitian_appender = __esm({
|
|
|
15356
15368
|
}
|
|
15357
15369
|
});
|
|
15358
15370
|
|
|
15371
|
+
// src/session-dialogue.ts
|
|
15372
|
+
var init_session_dialogue = __esm({
|
|
15373
|
+
"src/session-dialogue.ts"() {
|
|
15374
|
+
"use strict";
|
|
15375
|
+
init_unknown_value();
|
|
15376
|
+
}
|
|
15377
|
+
});
|
|
15378
|
+
|
|
15359
15379
|
// src/sitian-reader.ts
|
|
15360
15380
|
var init_sitian_reader = __esm({
|
|
15361
15381
|
"src/sitian-reader.ts"() {
|
|
@@ -15382,6 +15402,8 @@ var init_ticket_provenance = __esm({
|
|
|
15382
15402
|
init_activation_ledger_topology();
|
|
15383
15403
|
init_ledger_session_read();
|
|
15384
15404
|
init_run_ticket_number();
|
|
15405
|
+
init_role_run_placement();
|
|
15406
|
+
init_sitian_appender();
|
|
15385
15407
|
init_session_dialogue();
|
|
15386
15408
|
init_sitian_facade();
|
|
15387
15409
|
init_ticket_provenance_contracts();
|
|
@@ -15403,6 +15425,7 @@ var init_notary_source_run = __esm({
|
|
|
15403
15425
|
init_activation_ledger_git();
|
|
15404
15426
|
init_activation_ledger_topology();
|
|
15405
15427
|
init_run_lifecycle();
|
|
15428
|
+
init_role_run_placement();
|
|
15406
15429
|
}
|
|
15407
15430
|
});
|
|
15408
15431
|
|
|
@@ -16805,19 +16828,19 @@ var init_text = __esm({
|
|
|
16805
16828
|
import { accessSync, constants, existsSync as existsSync2, readFileSync, realpathSync as realpathSync2 } from "fs";
|
|
16806
16829
|
import { createRequire } from "module";
|
|
16807
16830
|
import { homedir as homedir3 } from "os";
|
|
16808
|
-
import { basename as
|
|
16831
|
+
import { basename as basename4, dirname as dirname5, join as join7, resolve as resolve3, sep as sep4, win32 } from "path";
|
|
16809
16832
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
16810
16833
|
function findNodePackageDir(startDir) {
|
|
16811
16834
|
let dir = startDir;
|
|
16812
|
-
while (dir !==
|
|
16835
|
+
while (dir !== dirname5(dir)) {
|
|
16813
16836
|
if (existsSync2(join7(dir, "package.json"))) {
|
|
16814
|
-
const parent =
|
|
16815
|
-
if (
|
|
16837
|
+
const parent = dirname5(dir);
|
|
16838
|
+
if (basename4(dir) === "dist" && existsSync2(join7(parent, "package.json"))) {
|
|
16816
16839
|
return parent;
|
|
16817
16840
|
}
|
|
16818
16841
|
return dir;
|
|
16819
16842
|
}
|
|
16820
|
-
dir =
|
|
16843
|
+
dir = dirname5(dir);
|
|
16821
16844
|
}
|
|
16822
16845
|
return startDir;
|
|
16823
16846
|
}
|
|
@@ -16827,7 +16850,7 @@ function getPackageDir() {
|
|
|
16827
16850
|
return normalizePath(envDir);
|
|
16828
16851
|
}
|
|
16829
16852
|
if (isBunBinary) {
|
|
16830
|
-
return
|
|
16853
|
+
return dirname5(process.execPath);
|
|
16831
16854
|
}
|
|
16832
16855
|
return findNodePackageDir(__dirname);
|
|
16833
16856
|
}
|
|
@@ -16864,7 +16887,7 @@ var init_config3 = __esm({
|
|
|
16864
16887
|
init_paths();
|
|
16865
16888
|
init_text();
|
|
16866
16889
|
__filename2 = fileURLToPath2(import.meta.url);
|
|
16867
|
-
__dirname =
|
|
16890
|
+
__dirname = dirname5(__filename2);
|
|
16868
16891
|
isBunBinary = import.meta.url.includes("$bunfs") || import.meta.url.includes("~BUN") || import.meta.url.includes("%7EBUN");
|
|
16869
16892
|
isBunRuntime = !!process.versions.bun;
|
|
16870
16893
|
isBundledNode = typeof PI_BUNDLED_NODE !== "undefined" && PI_BUNDLED_NODE;
|
|
@@ -42088,13 +42111,13 @@ var require_ignore = __commonJS({
|
|
|
42088
42111
|
const rules = this._rules;
|
|
42089
42112
|
const { length } = rules;
|
|
42090
42113
|
const shortcut = this._basenameCount * 2 >= length;
|
|
42091
|
-
const
|
|
42114
|
+
const basename12 = shortcut ? basenameOf(path8) : path8;
|
|
42092
42115
|
for (let index3 = 0; index3 < length; index3++) {
|
|
42093
42116
|
const rule = rules[index3];
|
|
42094
42117
|
const { negative } = rule;
|
|
42095
42118
|
const skip = unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored;
|
|
42096
42119
|
if (!skip && rule[mode].test(
|
|
42097
|
-
shortcut && rule._basenameOnly ?
|
|
42120
|
+
shortcut && rule._basenameOnly ? basename12 : path8
|
|
42098
42121
|
)) {
|
|
42099
42122
|
ignored = !negative;
|
|
42100
42123
|
unignored = negative;
|
|
@@ -48679,10 +48702,10 @@ async function setupSkills(ctx) {
|
|
|
48679
48702
|
for (const skill of session.agent.skills) {
|
|
48680
48703
|
try {
|
|
48681
48704
|
const version = await client.beta.skills.versions.retrieve(skill.version, { skill_id: skill.skill_id });
|
|
48682
|
-
let
|
|
48683
|
-
if (
|
|
48684
|
-
|
|
48685
|
-
const dest = path.resolve(skillsRoot,
|
|
48705
|
+
let dirname16 = path.basename(version.name.trim());
|
|
48706
|
+
if (dirname16 === "" || dirname16 === "." || dirname16 === "..")
|
|
48707
|
+
dirname16 = skill.skill_id;
|
|
48708
|
+
const dest = path.resolve(skillsRoot, dirname16);
|
|
48686
48709
|
if (dest !== skillsRoot && !dest.startsWith(skillsRoot + path.sep)) {
|
|
48687
48710
|
log.warn("skill name escapes the skills dir; skipping", {
|
|
48688
48711
|
component: "agent-tool-context",
|
|
@@ -64931,20 +64954,20 @@ function getName2(value2, options) {
|
|
|
64931
64954
|
const name = "name" in value2 ? value2.name : void 0;
|
|
64932
64955
|
const explicitName = name && String(name) || "filename" in value2 && value2.filename && String(value2.filename);
|
|
64933
64956
|
if (explicitName) {
|
|
64934
|
-
return options?.stripFilename === false ? normalizeFilenamePath(explicitName) :
|
|
64957
|
+
return options?.stripFilename === false ? normalizeFilenamePath(explicitName) : basename5(explicitName);
|
|
64935
64958
|
}
|
|
64936
64959
|
const url = "url" in value2 && value2.url && String(value2.url);
|
|
64937
64960
|
if (url) {
|
|
64938
64961
|
try {
|
|
64939
|
-
return
|
|
64962
|
+
return basename5(new URL(url).pathname);
|
|
64940
64963
|
} catch {
|
|
64941
|
-
return
|
|
64964
|
+
return basename5(url);
|
|
64942
64965
|
}
|
|
64943
64966
|
}
|
|
64944
64967
|
const path8 = "path" in value2 && value2.path && String(value2.path);
|
|
64945
|
-
return path8 ?
|
|
64968
|
+
return path8 ? basename5(path8) : void 0;
|
|
64946
64969
|
}
|
|
64947
|
-
function
|
|
64970
|
+
function basename5(value2) {
|
|
64948
64971
|
return value2.split(/[\\/]/).pop() || void 0;
|
|
64949
64972
|
}
|
|
64950
64973
|
function normalizeFilenamePath(value2) {
|
|
@@ -65048,7 +65071,7 @@ function getStreamingFileName(value2, options) {
|
|
|
65048
65071
|
if (typeof name !== "string" || !name) {
|
|
65049
65072
|
throw new TypeError("Streaming upload file name must be a non-empty string");
|
|
65050
65073
|
}
|
|
65051
|
-
return options.stripFilenames === false ? normalizeFilenamePath(name) :
|
|
65074
|
+
return options.stripFilenames === false ? normalizeFilenamePath(name) : basename5(name) ?? "unknown_file";
|
|
65052
65075
|
}
|
|
65053
65076
|
return getName2(value2, { stripFilename: options.stripFilenames }) ?? "unknown_file";
|
|
65054
65077
|
}
|
|
@@ -89348,7 +89371,7 @@ var require_node_domexception = __commonJS({
|
|
|
89348
89371
|
|
|
89349
89372
|
// node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/from.js
|
|
89350
89373
|
import { statSync as statSync2, createReadStream as createReadStream2, promises as fs5 } from "node:fs";
|
|
89351
|
-
import { basename as
|
|
89374
|
+
import { basename as basename6 } from "node:path";
|
|
89352
89375
|
var import_node_domexception, stat2, blobFromSync, blobFrom, fileFrom, fileFromSync, fromBlob, fromFile, BlobDataItem;
|
|
89353
89376
|
var init_from = __esm({
|
|
89354
89377
|
"node_modules/.pnpm/fetch-blob@3.2.0/node_modules/fetch-blob/from.js"() {
|
|
@@ -89371,7 +89394,7 @@ var init_from = __esm({
|
|
|
89371
89394
|
size: stat7.size,
|
|
89372
89395
|
lastModified: stat7.mtimeMs,
|
|
89373
89396
|
start: 0
|
|
89374
|
-
})],
|
|
89397
|
+
})], basename6(path8), { type, lastModified: stat7.mtimeMs });
|
|
89375
89398
|
BlobDataItem = class _BlobDataItem {
|
|
89376
89399
|
#path;
|
|
89377
89400
|
#start;
|
|
@@ -154637,7 +154660,7 @@ var init_abort4 = __esm({
|
|
|
154637
154660
|
|
|
154638
154661
|
// node_modules/.pnpm/@earendil-works+pi-coding-agent@0.99.1_@aws-sdk+credential-provider-node@3.972.83_@smit_1f563b9fb7db4619e2913cc40d230799/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js
|
|
154639
154662
|
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
154640
|
-
import { dirname as
|
|
154663
|
+
import { dirname as dirname8, join as join10 } from "path";
|
|
154641
154664
|
import { setTimeout as sleep6 } from "timers/promises";
|
|
154642
154665
|
var import_proper_lockfile, AUTH_FILE_WRITE_OPTIONS, FileAuthStorageBackend;
|
|
154643
154666
|
var init_auth_storage = __esm({
|
|
@@ -154655,7 +154678,7 @@ var init_auth_storage = __esm({
|
|
|
154655
154678
|
this.authPath = normalizePath(authPath);
|
|
154656
154679
|
}
|
|
154657
154680
|
ensureParentDir() {
|
|
154658
|
-
const dir =
|
|
154681
|
+
const dir = dirname8(this.authPath);
|
|
154659
154682
|
if (!existsSync4(dir)) {
|
|
154660
154683
|
mkdirSync2(dir, { recursive: true, mode: 448 });
|
|
154661
154684
|
}
|
|
@@ -175118,7 +175141,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
175118
175141
|
"node_modules/.pnpm/undici@8.10.2/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
|
|
175119
175142
|
"use strict";
|
|
175120
175143
|
var { writeFile: writeFile10, readFile: readFile10, mkdir: mkdir7 } = __require("node:fs/promises");
|
|
175121
|
-
var { dirname:
|
|
175144
|
+
var { dirname: dirname16, resolve: resolve12 } = __require("node:path");
|
|
175122
175145
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("node:timers");
|
|
175123
175146
|
var { InvalidArgumentError, UndiciError } = require_errors2();
|
|
175124
175147
|
var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
|
|
@@ -175364,7 +175387,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
175364
175387
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
175365
175388
|
}
|
|
175366
175389
|
const resolvedPath = resolve12(path8);
|
|
175367
|
-
await mkdir7(
|
|
175390
|
+
await mkdir7(dirname16(resolvedPath), { recursive: true });
|
|
175368
175391
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
175369
175392
|
hash,
|
|
175370
175393
|
snapshot
|
|
@@ -189590,7 +189613,7 @@ var init_open_browser = __esm({
|
|
|
189590
189613
|
|
|
189591
189614
|
// node_modules/.pnpm/@earendil-works+pi-coding-agent@0.99.1_@aws-sdk+credential-provider-node@3.972.83_@smit_1f563b9fb7db4619e2913cc40d230799/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/config.js
|
|
189592
189615
|
import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
189593
|
-
import { dirname as
|
|
189616
|
+
import { dirname as dirname9, join as join12 } from "node:path";
|
|
189594
189617
|
function isRecord4(value2) {
|
|
189595
189618
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
189596
189619
|
}
|
|
@@ -189663,7 +189686,7 @@ function editMcpServers(path8, edit) {
|
|
|
189663
189686
|
if (!edit(servers, parsed2))
|
|
189664
189687
|
return;
|
|
189665
189688
|
const indent = text && /^([ \t]+)\S/m.exec(text)?.[1] || " ";
|
|
189666
|
-
mkdirSync3(
|
|
189689
|
+
mkdirSync3(dirname9(path8), { recursive: true });
|
|
189667
189690
|
writeFileSync2(path8, `${JSON.stringify(parsed2, null, indent)}
|
|
189668
189691
|
`);
|
|
189669
189692
|
}
|
|
@@ -192515,7 +192538,7 @@ var init_oauth2 = __esm({
|
|
|
192515
192538
|
|
|
192516
192539
|
// node_modules/.pnpm/@earendil-works+pi-coding-agent@0.99.1_@aws-sdk+credential-provider-node@3.972.83_@smit_1f563b9fb7db4619e2913cc40d230799/node_modules/@earendil-works/pi-coding-agent/dist/extensions/mcp/log.js
|
|
192517
192540
|
import { appendFileSync, mkdirSync as mkdirSync5, renameSync, statSync as statSync3 } from "node:fs";
|
|
192518
|
-
import { dirname as
|
|
192541
|
+
import { dirname as dirname10 } from "node:path";
|
|
192519
192542
|
function isRecord5(value2) {
|
|
192520
192543
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
192521
192544
|
}
|
|
@@ -192550,7 +192573,7 @@ var init_log3 = __esm({
|
|
|
192550
192573
|
const line = formatMcpLogMessage(server, params);
|
|
192551
192574
|
try {
|
|
192552
192575
|
if (this.size === void 0) {
|
|
192553
|
-
mkdirSync5(
|
|
192576
|
+
mkdirSync5(dirname10(this.path), { recursive: true });
|
|
192554
192577
|
this.size = this.currentSize();
|
|
192555
192578
|
}
|
|
192556
192579
|
if (this.size > MAX_LOG_BYTES) {
|
|
@@ -192585,7 +192608,7 @@ __export(runtime_exports, {
|
|
|
192585
192608
|
signInMcpServer: () => signInMcpServer
|
|
192586
192609
|
});
|
|
192587
192610
|
import { homedir as homedir5 } from "node:os";
|
|
192588
|
-
import { basename as
|
|
192611
|
+
import { basename as basename8, join as join15, resolve as resolve6 } from "node:path";
|
|
192589
192612
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
192590
192613
|
function errorMessage3(error) {
|
|
192591
192614
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -192847,7 +192870,7 @@ var init_runtime = __esm({
|
|
|
192847
192870
|
name: "pi",
|
|
192848
192871
|
version: VERSION,
|
|
192849
192872
|
requestTimeoutMs: this.timeoutMs,
|
|
192850
|
-
roots: [{ uri: pathToFileURL2(this.cwd).href, name:
|
|
192873
|
+
roots: [{ uri: pathToFileURL2(this.cwd).href, name: basename8(this.cwd) }]
|
|
192851
192874
|
});
|
|
192852
192875
|
const log = this.log;
|
|
192853
192876
|
if (log)
|
|
@@ -195328,6 +195351,11 @@ var init_archivist_record_pointer = __esm({
|
|
|
195328
195351
|
"src/archivist-record-pointer.ts"() {
|
|
195329
195352
|
"use strict";
|
|
195330
195353
|
init_unknown_value();
|
|
195354
|
+
init_activation_ledger_topology();
|
|
195355
|
+
init_run_lifecycle();
|
|
195356
|
+
init_role_run_relocation();
|
|
195357
|
+
init_role_run_placement();
|
|
195358
|
+
init_sitian_appender();
|
|
195331
195359
|
}
|
|
195332
195360
|
});
|
|
195333
195361
|
|
|
@@ -195340,7 +195368,7 @@ init_activation_ledger_topology();
|
|
|
195340
195368
|
init_run_lifecycle();
|
|
195341
195369
|
import { mkdir, readdir as readdir4, rename } from "node:fs/promises";
|
|
195342
195370
|
import { homedir } from "node:os";
|
|
195343
|
-
import { basename as
|
|
195371
|
+
import { basename as basename3, dirname as dirname4, join as join5, resolve as resolve2 } from "node:path";
|
|
195344
195372
|
function reconcileMigrationPartition(partition3, unit, outcomes) {
|
|
195345
195373
|
let placed = 0;
|
|
195346
195374
|
let unbound = 0;
|
|
@@ -195410,7 +195438,7 @@ ${active.join("\n")}`);
|
|
|
195410
195438
|
}
|
|
195411
195439
|
function datedBooksBackupDirectory(booksDirectory, now = /* @__PURE__ */ new Date()) {
|
|
195412
195440
|
const date = now.toISOString().slice(0, 10);
|
|
195413
|
-
return join5(
|
|
195441
|
+
return join5(dirname4(booksDirectory), `${basename3(booksDirectory)}-${date}`);
|
|
195414
195442
|
}
|
|
195415
195443
|
async function renameBooksToDatedBackup(booksDirectory, now = /* @__PURE__ */ new Date()) {
|
|
195416
195444
|
const backup = datedBooksBackupDirectory(booksDirectory, now);
|
|
@@ -195446,7 +195474,7 @@ async function migrateBookTopology(input) {
|
|
|
195446
195474
|
|
|
195447
195475
|
// src/book-topology-mixed-volume-migrators.ts
|
|
195448
195476
|
import { appendFile, cp as cp2, lstat as lstat2, mkdir as mkdir3, readFile as readFile7, writeFile as writeFile6 } from "node:fs/promises";
|
|
195449
|
-
import { dirname as
|
|
195477
|
+
import { dirname as dirname12, join as join18, relative as relative4, resolve as resolve9, sep as sep7 } from "node:path";
|
|
195450
195478
|
|
|
195451
195479
|
// src/archivist-record-entry.ts
|
|
195452
195480
|
init_activation_ledger_topology();
|
|
@@ -195460,6 +195488,7 @@ init_activation_ledger_topology();
|
|
|
195460
195488
|
init_dist8();
|
|
195461
195489
|
|
|
195462
195490
|
// src/archivist-record-entry.ts
|
|
195491
|
+
init_sitian_appender();
|
|
195463
195492
|
init_archivist_record_pointer();
|
|
195464
195493
|
var MAX_SESSION_HEADER_SCAN_BYTES2 = 1024 * 1024;
|
|
195465
195494
|
var WORKER_SUBMISSION_GATE_KIND = "worker-submission-gate";
|
|
@@ -195470,7 +195499,7 @@ init_role_run_placement();
|
|
|
195470
195499
|
init_run_ticket_number();
|
|
195471
195500
|
init_unknown_value();
|
|
195472
195501
|
import { readdir as readdir6, readFile as readFile6 } from "node:fs/promises";
|
|
195473
|
-
import { basename as
|
|
195502
|
+
import { basename as basename9, dirname as dirname11, isAbsolute as isAbsolute5, join as join17, relative as relative3, resolve as resolve8, sep as sep6 } from "node:path";
|
|
195474
195503
|
var TICKET_NUMBER_RE = /^[1-9][0-9]*$/;
|
|
195475
195504
|
var RUN_DIR_NAME_RE = /^([^@]+)@([^@]+)$/;
|
|
195476
195505
|
async function listMigrationBookKeys(booksDirectory) {
|
|
@@ -195496,7 +195525,7 @@ function ticketNumberFromUnknown(value2) {
|
|
|
195496
195525
|
if (typeof value2 === "string" && TICKET_NUMBER_RE.test(value2)) return Number(value2);
|
|
195497
195526
|
return void 0;
|
|
195498
195527
|
}
|
|
195499
|
-
function
|
|
195528
|
+
function isTicketNumberString2(value2) {
|
|
195500
195529
|
return TICKET_NUMBER_RE.test(value2);
|
|
195501
195530
|
}
|
|
195502
195531
|
function ticketNumberFromWorktreeBasename(pathBasename) {
|
|
@@ -195546,7 +195575,7 @@ async function resolveMigratingRunTicket(runDirectory) {
|
|
|
195546
195575
|
}
|
|
195547
195576
|
const project = await readProjectRootFromRun(runDirectory);
|
|
195548
195577
|
if (project === void 0) return { ticketNumber: void 0, derivation: void 0 };
|
|
195549
|
-
const leaf =
|
|
195578
|
+
const leaf = basename9(project.projectRoot.replace(/\\/g, "/"));
|
|
195550
195579
|
const ticketNumber = ticketNumberFromWorktreeBasename(leaf);
|
|
195551
195580
|
if (ticketNumber === void 0) return { ticketNumber: void 0, derivation: void 0 };
|
|
195552
195581
|
return {
|
|
@@ -195608,11 +195637,11 @@ async function listBackupRunLeaves(backupBookDirectory) {
|
|
|
195608
195637
|
await collect("runs", "flat");
|
|
195609
195638
|
await collect("unbound/runs", "unbound");
|
|
195610
195639
|
for (const subject of await listMigrationDirents(backupBookDirectory)) {
|
|
195611
|
-
if (!subject.isDirectory() || !
|
|
195640
|
+
if (!subject.isDirectory() || !isTicketNumberString2(subject.name)) continue;
|
|
195612
195641
|
await collect(`${subject.name}/runs`, "ticket");
|
|
195613
195642
|
}
|
|
195614
195643
|
for (const issue of await listMigrationDirents(join17(backupBookDirectory, "issues"))) {
|
|
195615
|
-
if (!issue.isDirectory() || !
|
|
195644
|
+
if (!issue.isDirectory() || !isTicketNumberString2(issue.name)) continue;
|
|
195616
195645
|
await collect(`issues/${issue.name}/runs`, "issues");
|
|
195617
195646
|
}
|
|
195618
195647
|
return leaves;
|
|
@@ -195639,13 +195668,13 @@ function destPathFromSourceRelative(booksDirectory, bookKey, sourceRelative2) {
|
|
|
195639
195668
|
const leaf = parts[runsIndex + 1];
|
|
195640
195669
|
const before = parts.slice(0, runsIndex);
|
|
195641
195670
|
if (leaf === void 0) return void 0;
|
|
195642
|
-
if (before.length === 2 && before[0] === "issues" && before[1] !== void 0 &&
|
|
195671
|
+
if (before.length === 2 && before[0] === "issues" && before[1] !== void 0 && isTicketNumberString2(before[1])) {
|
|
195643
195672
|
return join17(booksDirectory, bookKey, before[1], "runs", leaf);
|
|
195644
195673
|
}
|
|
195645
195674
|
if (before.length !== 1) return void 0;
|
|
195646
195675
|
const subject = before[0];
|
|
195647
195676
|
if (subject === void 0) return void 0;
|
|
195648
|
-
if (subject !== "unbound" && !
|
|
195677
|
+
if (subject !== "unbound" && !isTicketNumberString2(subject)) return void 0;
|
|
195649
195678
|
return join17(booksDirectory, bookKey, subject, "runs", leaf);
|
|
195650
195679
|
}
|
|
195651
195680
|
function placedRunFromPath(runDirectory) {
|
|
@@ -195725,7 +195754,7 @@ async function findUniquePrincipalPlacedRun(booksDirectory, bookKey, runId) {
|
|
|
195725
195754
|
return placedRunFromPath(matches[0]);
|
|
195726
195755
|
}
|
|
195727
195756
|
function destinationRunDirectory(booksDirectory, bookKey, ticketNumber, runId, role) {
|
|
195728
|
-
const ledgerHome =
|
|
195757
|
+
const ledgerHome = dirname11(booksDirectory);
|
|
195729
195758
|
const subject = ticketNumber !== void 0 ? { ticketNumber } : { unbound: true };
|
|
195730
195759
|
return roleRunPlacement(ledgerHome, {
|
|
195731
195760
|
bookKey,
|
|
@@ -195879,7 +195908,7 @@ async function placedRunForLeaf(cache, booksDirectory, bookKey, leaf, sourceRela
|
|
|
195879
195908
|
return placed;
|
|
195880
195909
|
}
|
|
195881
195910
|
async function appendRawLine(file, raw) {
|
|
195882
|
-
await mkdir3(
|
|
195911
|
+
await mkdir3(dirname12(file), { recursive: true });
|
|
195883
195912
|
await appendFile(file, `${raw}
|
|
195884
195913
|
`, "utf8");
|
|
195885
195914
|
}
|
|
@@ -195913,7 +195942,7 @@ async function migrateCurrentSessionPointer(input) {
|
|
|
195913
195942
|
destinationSessionFile = input.volumeDestinations.get(pointed) ?? input.volumeDestinations.get(sessionFile);
|
|
195914
195943
|
}
|
|
195915
195944
|
if (destinationSessionFile === void 0) {
|
|
195916
|
-
await mkdir3(
|
|
195945
|
+
await mkdir3(dirname12(input.unboundPointerFile), { recursive: true });
|
|
195917
195946
|
await writeFile6(
|
|
195918
195947
|
input.unboundPointerFile,
|
|
195919
195948
|
raw.endsWith("\n") ? raw : `${raw}
|
|
@@ -195922,8 +195951,8 @@ async function migrateCurrentSessionPointer(input) {
|
|
|
195922
195951
|
);
|
|
195923
195952
|
return;
|
|
195924
195953
|
}
|
|
195925
|
-
const pointerFile = join18(
|
|
195926
|
-
await mkdir3(
|
|
195954
|
+
const pointerFile = join18(dirname12(destinationSessionFile), CURRENT_SESSION_LEDGER);
|
|
195955
|
+
await mkdir3(dirname12(pointerFile), { recursive: true });
|
|
195927
195956
|
await writeFile6(
|
|
195928
195957
|
pointerFile,
|
|
195929
195958
|
`${JSON.stringify({ sessionFile: destinationSessionFile })}
|
|
@@ -196074,7 +196103,7 @@ async function migrateWorkerSubmissionGate(context) {
|
|
|
196074
196103
|
kind,
|
|
196075
196104
|
name
|
|
196076
196105
|
);
|
|
196077
|
-
await mkdir3(
|
|
196106
|
+
await mkdir3(dirname12(dest), { recursive: true });
|
|
196078
196107
|
await cp2(sourcePath, dest, { preserveTimestamps: true });
|
|
196079
196108
|
outcomes.push({
|
|
196080
196109
|
disposition: destRun?.disposition === "placed" ? "placed" : "unbound",
|
|
@@ -196111,7 +196140,7 @@ var BOOK_TOPOLOGY_MIXED_VOLUME_MIGRATORS = [
|
|
|
196111
196140
|
// src/book-topology-migrators-t11.ts
|
|
196112
196141
|
init_activation_ledger_topology();
|
|
196113
196142
|
import { cp as cp3, lstat as lstat3, mkdir as mkdir4, readFile as readFile8, stat as stat4, unlink as unlink2, utimes, writeFile as writeFile7 } from "node:fs/promises";
|
|
196114
|
-
import { basename as
|
|
196143
|
+
import { basename as basename10, dirname as dirname13, join as join19, relative as relative5, resolve as resolve10, sep as sep8 } from "node:path";
|
|
196115
196144
|
init_role_run_relocation();
|
|
196116
196145
|
init_unknown_value();
|
|
196117
196146
|
var AUDITOR_ROLES_PARTITION = "auditor-roles";
|
|
@@ -196141,7 +196170,7 @@ var DEPRECATED_RUN_PAGE_NAME_SET = new Set(DEPRECATED_RUN_PAGE_NAMES);
|
|
|
196141
196170
|
function isDeprecatedRunPage(name) {
|
|
196142
196171
|
return DEPRECATED_RUN_PAGE_NAME_SET.has(name);
|
|
196143
196172
|
}
|
|
196144
|
-
function
|
|
196173
|
+
function parseRunLeaf2(name) {
|
|
196145
196174
|
const match3 = RUN_LEAF.exec(name);
|
|
196146
196175
|
if (match3 === null) return void 0;
|
|
196147
196176
|
const runId = match3[1];
|
|
@@ -196212,13 +196241,13 @@ function parseParentRunBoundToMigration(booksDirectory, backupBooksDirectory, pa
|
|
|
196212
196241
|
let bookKey;
|
|
196213
196242
|
if (before.length === 1) {
|
|
196214
196243
|
bookKey = before[0];
|
|
196215
|
-
} else if (before.length === 2 && (before[1] === "unbound" || before[1] !== void 0 &&
|
|
196244
|
+
} else if (before.length === 2 && (before[1] === "unbound" || before[1] !== void 0 && isTicketNumberString2(before[1]))) {
|
|
196216
196245
|
bookKey = before[0];
|
|
196217
|
-
} else if (before.length === 3 && before[1] === "issues" && before[2] !== void 0 &&
|
|
196246
|
+
} else if (before.length === 3 && before[1] === "issues" && before[2] !== void 0 && isTicketNumberString2(before[2])) {
|
|
196218
196247
|
bookKey = before[0];
|
|
196219
196248
|
}
|
|
196220
196249
|
if (bookKey === void 0) return void 0;
|
|
196221
|
-
const leaf =
|
|
196250
|
+
const leaf = parseRunLeaf2(leafName);
|
|
196222
196251
|
if (leaf === void 0) return void 0;
|
|
196223
196252
|
return {
|
|
196224
196253
|
bookKey,
|
|
@@ -196319,7 +196348,7 @@ async function collectPlacedRunRewrites(booksDirectory, backupBooksDirectory) {
|
|
|
196319
196348
|
push(join19(booksDirectory, bookKey, "runs", run.name), finalPath);
|
|
196320
196349
|
push(join19(backupBooksDirectory, bookKey, "runs", run.name), finalPath);
|
|
196321
196350
|
push(join19(backupBooksDirectory, bookKey, subject.name, "runs", run.name), finalPath);
|
|
196322
|
-
if (
|
|
196351
|
+
if (isTicketNumberString2(subject.name)) {
|
|
196323
196352
|
push(
|
|
196324
196353
|
join19(booksDirectory, bookKey, "issues", subject.name, "runs", run.name),
|
|
196325
196354
|
finalPath
|
|
@@ -196403,8 +196432,8 @@ async function writeWinningCurrentSession(destPath, srcStat, destStat, nextRaw,
|
|
|
196403
196432
|
`book topology migration cannot compare current-session pointer at ${destPath}: file disappeared during tie-break`
|
|
196404
196433
|
);
|
|
196405
196434
|
}
|
|
196406
|
-
const srcName =
|
|
196407
|
-
const destName =
|
|
196435
|
+
const srcName = basename10(nextSessionFile ?? "");
|
|
196436
|
+
const destName = basename10(destSessionFile);
|
|
196408
196437
|
if (destName >= srcName) return;
|
|
196409
196438
|
}
|
|
196410
196439
|
}
|
|
@@ -196477,7 +196506,7 @@ async function copyVolumeIntoNest(volumeDirectory, historicalVolume, destNest) {
|
|
|
196477
196506
|
await mergeRewrittenCurrentSession(volumeDirectory, historicalVolume, destNest);
|
|
196478
196507
|
}
|
|
196479
196508
|
async function copyTree(source, destination) {
|
|
196480
|
-
await mkdir4(
|
|
196509
|
+
await mkdir4(dirname13(destination), { recursive: true });
|
|
196481
196510
|
await cp3(source, destination, { recursive: true, preserveTimestamps: true });
|
|
196482
196511
|
}
|
|
196483
196512
|
var bookTopologyAuditorRolesMigrator = {
|
|
@@ -196707,7 +196736,7 @@ var bookTopologyManualArchivesMigrator = {
|
|
|
196707
196736
|
async migrate(context) {
|
|
196708
196737
|
const outcomes = [];
|
|
196709
196738
|
const { backupBooksDirectory, booksDirectory } = context;
|
|
196710
|
-
const archivesRoot = join19(
|
|
196739
|
+
const archivesRoot = join19(dirname13(booksDirectory), MANUAL_ARCHIVES_PARTITION);
|
|
196711
196740
|
for (const bookKey of await listMigrationBookKeys(backupBooksDirectory)) {
|
|
196712
196741
|
for (const dirName of MANUAL_ARCHIVE_DIRECTORIES) {
|
|
196713
196742
|
const sourceDir = join19(backupBooksDirectory, bookKey, dirName);
|
|
@@ -196734,7 +196763,7 @@ var BOOK_TOPOLOGY_T11_MIGRATORS = [
|
|
|
196734
196763
|
|
|
196735
196764
|
// src/book-topology-record-class-migrators.ts
|
|
196736
196765
|
import { appendFile as appendFile2, mkdir as mkdir5, readFile as readFile9, stat as stat5, writeFile as writeFile8 } from "node:fs/promises";
|
|
196737
|
-
import { dirname as
|
|
196766
|
+
import { dirname as dirname14, join as join20, relative as relative6, sep as sep9 } from "node:path";
|
|
196738
196767
|
init_sitian_appender();
|
|
196739
196768
|
init_ticket_provenance_contracts();
|
|
196740
196769
|
init_sha256();
|
|
@@ -196827,14 +196856,14 @@ var RecordWriteCache = class {
|
|
|
196827
196856
|
}
|
|
196828
196857
|
}
|
|
196829
196858
|
this.destPlacements.delete(recordFile);
|
|
196830
|
-
await ensureDir(
|
|
196859
|
+
await ensureDir(dirname14(recordFile));
|
|
196831
196860
|
const text = body.endsWith("\n") ? body : `${body}
|
|
196832
196861
|
`;
|
|
196833
196862
|
await writeFile8(recordFile, text, "utf8");
|
|
196834
196863
|
this.markBareVolume(recordFile);
|
|
196835
196864
|
}
|
|
196836
196865
|
async append(recordFile, raw, options) {
|
|
196837
|
-
await ensureDir(
|
|
196866
|
+
await ensureDir(dirname14(recordFile));
|
|
196838
196867
|
const line = raw.endsWith("\n") ? raw : `${raw}
|
|
196839
196868
|
`;
|
|
196840
196869
|
const parsed2 = parseJsonlLine(raw);
|
|
@@ -196897,7 +196926,7 @@ function isHomeRecordClassRelativePath(relPosix) {
|
|
|
196897
196926
|
if (parts[0] === TICKET_PROVENANCE || parts[0] === SUBMISSION_LEDGER || parts[0] === ATTEMPT_HISTORY) {
|
|
196898
196927
|
return true;
|
|
196899
196928
|
}
|
|
196900
|
-
if (parts.length >= 2 &&
|
|
196929
|
+
if (parts.length >= 2 && isTicketNumberString2(parts[0])) {
|
|
196901
196930
|
if (parts[1] === TICKET_PROVENANCE) return true;
|
|
196902
196931
|
if (parts.length === 2 && parts[1] === "records.jsonl") return true;
|
|
196903
196932
|
}
|
|
@@ -197194,12 +197223,12 @@ async function migrateHomePartitionBook(context, bookKey, writes, category, outc
|
|
|
197194
197223
|
for (const filePath of rootFiles) {
|
|
197195
197224
|
await migrateJsonlFileByKind(context, bookKey, writes, filePath, category, outcomes);
|
|
197196
197225
|
if (category === TICKET_PROVENANCE) {
|
|
197197
|
-
await mergeCompanionsFromVolume(context, bookKey,
|
|
197226
|
+
await mergeCompanionsFromVolume(context, bookKey, dirname14(filePath), writes);
|
|
197198
197227
|
}
|
|
197199
197228
|
}
|
|
197200
197229
|
if (category !== TICKET_PROVENANCE) return;
|
|
197201
197230
|
for (const entry of await listMigrationDirents(backupBook)) {
|
|
197202
|
-
if (!entry.isDirectory() || !
|
|
197231
|
+
if (!entry.isDirectory() || !isTicketNumberString2(entry.name)) continue;
|
|
197203
197232
|
const ticketDir = join20(backupBook, entry.name);
|
|
197204
197233
|
for (const volumeDir of [
|
|
197205
197234
|
join20(ticketDir, TICKET_PROVENANCE),
|
|
@@ -197237,7 +197266,7 @@ async function scrubRawLinesFromFile(recordFile, rawLines) {
|
|
|
197237
197266
|
kept.push(normalized);
|
|
197238
197267
|
}
|
|
197239
197268
|
if (!changed) return;
|
|
197240
|
-
await ensureDir(
|
|
197269
|
+
await ensureDir(dirname14(recordFile));
|
|
197241
197270
|
await writeFile8(recordFile, kept.join(""), "utf8");
|
|
197242
197271
|
}
|
|
197243
197272
|
async function migrateMisplacedBook(context, bookKey, writes, outcomes) {
|
|
@@ -197344,14 +197373,14 @@ var BOOK_TOPOLOGY_RECORD_CLASS_MIGRATORS = [
|
|
|
197344
197373
|
|
|
197345
197374
|
// src/book-topology-runs-migrator.ts
|
|
197346
197375
|
import { cp as cp4, mkdir as mkdir6, rename as rename2, readdir as readdir7, stat as stat6, writeFile as writeFile9 } from "node:fs/promises";
|
|
197347
|
-
import { basename as
|
|
197376
|
+
import { basename as basename11, dirname as dirname15, join as join21, relative as relative7, sep as sep10 } from "node:path";
|
|
197348
197377
|
init_role_run_placement();
|
|
197349
197378
|
init_role_run_relocation();
|
|
197350
197379
|
init_run_ticket_number();
|
|
197351
197380
|
init_unknown_value();
|
|
197352
197381
|
var RUNS_PARTITION = "runs";
|
|
197353
197382
|
var RUN_LEAF2 = /^([A-Za-z0-9][A-Za-z0-9._-]*)@([A-Za-z][A-Za-z0-9_-]*)$/;
|
|
197354
|
-
function
|
|
197383
|
+
function parseRunLeaf3(name) {
|
|
197355
197384
|
const match3 = RUN_LEAF2.exec(name);
|
|
197356
197385
|
if (match3 === null) return void 0;
|
|
197357
197386
|
return { runId: match3[1], role: match3[2] };
|
|
@@ -197373,7 +197402,7 @@ async function writeDerivationPage(targetRunDirectory, derivation) {
|
|
|
197373
197402
|
page: derivation.sourcePage,
|
|
197374
197403
|
field: "projectRoot",
|
|
197375
197404
|
path: derivation.projectRoot,
|
|
197376
|
-
basename:
|
|
197405
|
+
basename: basename11(derivation.projectRoot)
|
|
197377
197406
|
}
|
|
197378
197407
|
};
|
|
197379
197408
|
await writeFile9(
|
|
@@ -197384,7 +197413,7 @@ async function writeDerivationPage(targetRunDirectory, derivation) {
|
|
|
197384
197413
|
);
|
|
197385
197414
|
}
|
|
197386
197415
|
async function copyRunTree(source, target, isDirectory) {
|
|
197387
|
-
await mkdir6(
|
|
197416
|
+
await mkdir6(dirname15(target), { recursive: true });
|
|
197388
197417
|
if (isDirectory) {
|
|
197389
197418
|
await cp4(source, target, { recursive: true, preserveTimestamps: true });
|
|
197390
197419
|
return;
|
|
@@ -197397,7 +197426,7 @@ async function planBookMoves(backupBooksDirectory, booksDirectory, bookKey) {
|
|
|
197397
197426
|
const planned = [];
|
|
197398
197427
|
for (const leaf of await listBackupRunLeaves(backupBook)) {
|
|
197399
197428
|
const sourceIdentity2 = relative7(backupBooksDirectory, leaf.sourcePath).split(sep10).join("/");
|
|
197400
|
-
const parsed2 = leaf.isDirectory ?
|
|
197429
|
+
const parsed2 = leaf.isDirectory ? parseRunLeaf3(leaf.leafName) : void 0;
|
|
197401
197430
|
let targetPath;
|
|
197402
197431
|
let disposition;
|
|
197403
197432
|
let historicalRunDirectory;
|
|
@@ -197405,7 +197434,7 @@ async function planBookMoves(backupBooksDirectory, booksDirectory, bookKey) {
|
|
|
197405
197434
|
if (leaf.layout === "issues") {
|
|
197406
197435
|
const parts = leaf.relativePath.replaceAll("\\", "/").split("/");
|
|
197407
197436
|
const ticketStr = parts[1];
|
|
197408
|
-
if (ticketStr !== void 0 &&
|
|
197437
|
+
if (ticketStr !== void 0 && isTicketNumberString2(ticketStr)) {
|
|
197409
197438
|
targetPath = join21(booksDirectory, bookKey, ticketStr, "runs", leaf.leafName);
|
|
197410
197439
|
disposition = "placed";
|
|
197411
197440
|
historicalRunDirectory = join21(
|
|
@@ -197535,8 +197564,8 @@ var bookTopologyRunsMigrator = {
|
|
|
197535
197564
|
}
|
|
197536
197565
|
};
|
|
197537
197566
|
async function relocateBoardBoundUnboundRunsInBook(bookDirectory) {
|
|
197538
|
-
const bookKey =
|
|
197539
|
-
const booksDirectory =
|
|
197567
|
+
const bookKey = basename11(bookDirectory);
|
|
197568
|
+
const booksDirectory = dirname15(bookDirectory);
|
|
197540
197569
|
const unboundRuns = join21(bookDirectory, "unbound", "runs");
|
|
197541
197570
|
let entries;
|
|
197542
197571
|
try {
|
|
@@ -197548,7 +197577,7 @@ async function relocateBoardBoundUnboundRunsInBook(bookDirectory) {
|
|
|
197548
197577
|
const planned = [];
|
|
197549
197578
|
for (const entry of entries) {
|
|
197550
197579
|
if (!entry.isDirectory()) continue;
|
|
197551
|
-
const parsed2 =
|
|
197580
|
+
const parsed2 = parseRunLeaf3(entry.name);
|
|
197552
197581
|
if (parsed2 === void 0) continue;
|
|
197553
197582
|
const sourcePath = join21(unboundRuns, entry.name);
|
|
197554
197583
|
const boardTicket = await readBoardTicketNumber(sourcePath);
|
|
@@ -197591,7 +197620,7 @@ async function relocateBoardBoundUnboundRunsInBook(bookDirectory) {
|
|
|
197591
197620
|
});
|
|
197592
197621
|
}
|
|
197593
197622
|
for (const move of planned) {
|
|
197594
|
-
await mkdir6(
|
|
197623
|
+
await mkdir6(dirname15(move.targetPath), { recursive: true });
|
|
197595
197624
|
await rename2(move.sourcePath, move.targetPath);
|
|
197596
197625
|
}
|
|
197597
197626
|
return planned.map((move) => ({
|