@akagilnc/pi-workflow-roles 0.1.5575 → 0.1.5583
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/CLAUDE.md +1 -1
- package/dist/acp-host/production-host.js +115 -159
- package/dist/headless-host/production-host.js +42 -86
- package/dist/migrate-book-topology.js +0 -2
- package/dist/package-resources/engine-material.js +22 -25
- package/dist/public-cli/instruction-seat-run.js +3 -13
- package/dist/public-cli/invocation.js +6 -6
- package/dist/public-cli/main.js +115 -192
- package/dist/public-cli/post-admission.js +1 -8
- package/dist/public-cli/run-lifecycle.js +4 -7
- package/package.json +1 -1
- package/src/package-resources/engine-material.ts +42 -35
- package/src/public-cli/instruction-seat-run.ts +3 -19
- package/src/public-cli/invocation.ts +5 -9
- package/src/public-cli/post-admission.ts +1 -8
- package/src/public-cli/run-lifecycle.ts +4 -18
- package/src/role-runtime.ts +18 -16
package/dist/public-cli/main.js
CHANGED
|
@@ -1565,8 +1565,6 @@ var init_durable_principal = __esm({
|
|
|
1565
1565
|
});
|
|
1566
1566
|
|
|
1567
1567
|
// src/package-resources/engine-material.ts
|
|
1568
|
-
import { existsSync as existsSync2, readdirSync } from "node:fs";
|
|
1569
|
-
import { join as join7 } from "node:path";
|
|
1570
1568
|
function pickEngineAxis(source) {
|
|
1571
1569
|
return {
|
|
1572
1570
|
...source.engine === void 0 ? {} : { engine: source.engine },
|
|
@@ -1586,59 +1584,15 @@ function isEngineNameSyntax(name) {
|
|
|
1586
1584
|
if (name.includes("/") || name.includes("\\") || name.includes("\0")) return false;
|
|
1587
1585
|
return true;
|
|
1588
1586
|
}
|
|
1589
|
-
function resolveEngineMaterialDirectory(packageRoot2) {
|
|
1590
|
-
return join7(packageRoot2, ENGINE_MATERIAL_RELATIVE_ROOT);
|
|
1591
|
-
}
|
|
1592
|
-
function resolveEngineMaterialPath(packageRoot2, name) {
|
|
1593
|
-
const legal = assertLegalEngineName(name);
|
|
1594
|
-
return join7(resolveEngineMaterialDirectory(packageRoot2), `${legal}.md`);
|
|
1595
|
-
}
|
|
1596
1587
|
function assertLegalEngineName(name) {
|
|
1597
1588
|
if (!isEngineNameSyntax(name)) {
|
|
1598
1589
|
throw new Error(`illegal engine name: ${name}`);
|
|
1599
1590
|
}
|
|
1600
1591
|
return name;
|
|
1601
1592
|
}
|
|
1602
|
-
function engineSessionMaterialFromOptions(options) {
|
|
1603
|
-
if (options.engine === void 0) return void 0;
|
|
1604
|
-
if (options.packageRoot === void 0 || options.packageRoot.trim() === "") {
|
|
1605
|
-
throw new Error("packageRoot is required when engine is configured");
|
|
1606
|
-
}
|
|
1607
|
-
const name = assertLegalEngineName(options.engine);
|
|
1608
|
-
const model = options.engineModel === void 0 ? void 0 : assertLegalEngineModel(options.engineModel);
|
|
1609
|
-
const materialPath = resolveEngineMaterialPath(options.packageRoot, name);
|
|
1610
|
-
const modelField = model === void 0 ? {} : { model };
|
|
1611
|
-
if (existsSync2(materialPath)) {
|
|
1612
|
-
return Object.freeze({ name, materialPath, ...modelField });
|
|
1613
|
-
}
|
|
1614
|
-
return Object.freeze({ name, ...modelField });
|
|
1615
|
-
}
|
|
1616
|
-
function appendEngineSessionMaterial(lines, engineMaterial) {
|
|
1617
|
-
if (engineMaterial === void 0) {
|
|
1618
|
-
return [...lines];
|
|
1619
|
-
}
|
|
1620
|
-
const out = [...lines];
|
|
1621
|
-
out.push("");
|
|
1622
|
-
if (engineMaterial.materialPath !== void 0) {
|
|
1623
|
-
out.push("\u672C\u6B21\u914D\u7F6E\u7684\u52B3\u52A1\u5F15\u64CE\u53CA\u5176\u624B\u518C\uFF1A");
|
|
1624
|
-
out.push(`- engine: ${engineMaterial.name}`);
|
|
1625
|
-
if (engineMaterial.model !== void 0) {
|
|
1626
|
-
out.push(`- engineModel: ${engineMaterial.model}`);
|
|
1627
|
-
}
|
|
1628
|
-
out.push(`- ${engineMaterial.materialPath}`);
|
|
1629
|
-
} else {
|
|
1630
|
-
out.push(`- engine: ${engineMaterial.name}`);
|
|
1631
|
-
if (engineMaterial.model !== void 0) {
|
|
1632
|
-
out.push(`- engineModel: ${engineMaterial.model}`);
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
return out;
|
|
1636
|
-
}
|
|
1637
|
-
var ENGINE_MATERIAL_RELATIVE_ROOT;
|
|
1638
1593
|
var init_engine_material = __esm({
|
|
1639
1594
|
"src/package-resources/engine-material.ts"() {
|
|
1640
1595
|
"use strict";
|
|
1641
|
-
ENGINE_MATERIAL_RELATIVE_ROOT = "resources/engines";
|
|
1642
1596
|
}
|
|
1643
1597
|
});
|
|
1644
1598
|
|
|
@@ -16241,9 +16195,9 @@ var init_institutional_resolution = __esm({
|
|
|
16241
16195
|
});
|
|
16242
16196
|
|
|
16243
16197
|
// src/host-descriptions.ts
|
|
16244
|
-
import { join as
|
|
16198
|
+
import { join as join7 } from "node:path";
|
|
16245
16199
|
function resolveHostBinary(description, operatorHome) {
|
|
16246
|
-
return
|
|
16200
|
+
return join7(operatorHome, ...description.binaryFromHome);
|
|
16247
16201
|
}
|
|
16248
16202
|
function lookupHostDescription(host) {
|
|
16249
16203
|
return Object.hasOwn(HOST_DESCRIPTIONS, host) ? HOST_DESCRIPTIONS[host] : void 0;
|
|
@@ -16375,7 +16329,7 @@ __export(config_exports, {
|
|
|
16375
16329
|
validatePublicCliConfigAxes: () => validatePublicCliConfigAxes
|
|
16376
16330
|
});
|
|
16377
16331
|
import { mkdir, readFile as readFile3, writeFile } from "node:fs/promises";
|
|
16378
|
-
import { dirname as dirname6, join as
|
|
16332
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
16379
16333
|
function isGateOfficerSeat(value) {
|
|
16380
16334
|
return packagedProvinceConfig(value);
|
|
16381
16335
|
}
|
|
@@ -16383,7 +16337,7 @@ function publicCliConfigPath(home) {
|
|
|
16383
16337
|
if (typeof home !== "string" || home.trim() === "") {
|
|
16384
16338
|
throw new Error("home must be explicitly provided");
|
|
16385
16339
|
}
|
|
16386
|
-
return
|
|
16340
|
+
return join8(home, ".ak-roles", "public-cli.json");
|
|
16387
16341
|
}
|
|
16388
16342
|
async function loadPublicCliConfig(home) {
|
|
16389
16343
|
const path = publicCliConfigPath(home);
|
|
@@ -16843,11 +16797,11 @@ function credentialProvidersFromAuthData(data) {
|
|
|
16843
16797
|
};
|
|
16844
16798
|
}
|
|
16845
16799
|
function resolvePublicAgentDir(explicit, home) {
|
|
16846
|
-
return explicit ?? process.env.PI_CODING_AGENT_DIR ??
|
|
16800
|
+
return explicit ?? process.env.PI_CODING_AGENT_DIR ?? join8(home, ".pi", "agent");
|
|
16847
16801
|
}
|
|
16848
16802
|
async function loadCredentialProviders(agentDir) {
|
|
16849
16803
|
try {
|
|
16850
|
-
const raw = await readFile3(
|
|
16804
|
+
const raw = await readFile3(join8(agentDir, "auth.json"), "utf8");
|
|
16851
16805
|
return credentialProvidersFromAuthData(JSON.parse(raw));
|
|
16852
16806
|
} catch (error) {
|
|
16853
16807
|
if (isEnoent(error)) return { "openai-codex": false, xai: false };
|
|
@@ -16872,15 +16826,15 @@ var init_config2 = __esm({
|
|
|
16872
16826
|
|
|
16873
16827
|
// src/public-cli/host-providers.ts
|
|
16874
16828
|
import { readFileSync as readFileSync2 } from "node:fs";
|
|
16875
|
-
import { join as
|
|
16829
|
+
import { join as join9 } from "node:path";
|
|
16876
16830
|
function hostProvidersPath(home) {
|
|
16877
16831
|
if (typeof home !== "string" || home.trim() === "") {
|
|
16878
16832
|
throw new Error("home must be explicitly provided");
|
|
16879
16833
|
}
|
|
16880
|
-
return
|
|
16834
|
+
return join9(home, ".ak-roles", "host-providers.json");
|
|
16881
16835
|
}
|
|
16882
16836
|
function hermesProviderModelsCachePath(home) {
|
|
16883
|
-
return
|
|
16837
|
+
return join9(home, ".hermes", "provider_models_cache.json");
|
|
16884
16838
|
}
|
|
16885
16839
|
function parseHostProvidersTable(value) {
|
|
16886
16840
|
if (!isRecord(value)) {
|
|
@@ -17054,16 +17008,16 @@ var init_cli_errors = __esm({
|
|
|
17054
17008
|
// src/public-cli/machine-method-skills.ts
|
|
17055
17009
|
import { accessSync, constants, statSync as statSync3 } from "node:fs";
|
|
17056
17010
|
import { lstat, mkdir as mkdir2, symlink } from "node:fs/promises";
|
|
17057
|
-
import { join as
|
|
17011
|
+
import { join as join10 } from "node:path";
|
|
17058
17012
|
import { spawnSync } from "node:child_process";
|
|
17059
17013
|
function skillRoot(home) {
|
|
17060
|
-
return
|
|
17014
|
+
return join10(home, ".agents/skills");
|
|
17061
17015
|
}
|
|
17062
17016
|
function installedMethodSkillPath(home, name) {
|
|
17063
17017
|
return installedSkillPath(skillRoot(home), name);
|
|
17064
17018
|
}
|
|
17065
17019
|
function installedSkillPath(root, name) {
|
|
17066
|
-
const path =
|
|
17020
|
+
const path = join10(root, name, "SKILL.md");
|
|
17067
17021
|
try {
|
|
17068
17022
|
if (!statSync3(path).isFile()) return void 0;
|
|
17069
17023
|
accessSync(path, constants.R_OK);
|
|
@@ -17076,9 +17030,9 @@ function installedSkillPath(root, name) {
|
|
|
17076
17030
|
}
|
|
17077
17031
|
function linkedSkillRoot(home, host) {
|
|
17078
17032
|
if (host === "claude" || host === "claude-code") {
|
|
17079
|
-
return
|
|
17033
|
+
return join10(process.env.CLAUDE_CONFIG_DIR?.trim() || join10(home, ".claude"), "skills");
|
|
17080
17034
|
}
|
|
17081
|
-
if (host === "hermes") return
|
|
17035
|
+
if (host === "hermes") return join10(home, ".hermes/skills");
|
|
17082
17036
|
return void 0;
|
|
17083
17037
|
}
|
|
17084
17038
|
async function occupied(path) {
|
|
@@ -17135,7 +17089,7 @@ async function runMachineSkillSetup(home, stdout) {
|
|
|
17135
17089
|
const missingBySource = /* @__PURE__ */ new Map();
|
|
17136
17090
|
let unsourced = false;
|
|
17137
17091
|
for (const name of packagedMethodSkillNames()) {
|
|
17138
|
-
const path =
|
|
17092
|
+
const path = join10(canonical, name);
|
|
17139
17093
|
if (await occupied(path)) {
|
|
17140
17094
|
warnOccupied(path, stdout);
|
|
17141
17095
|
continue;
|
|
@@ -17165,9 +17119,9 @@ async function runMachineSkillSetup(home, stdout) {
|
|
|
17165
17119
|
throw error;
|
|
17166
17120
|
}
|
|
17167
17121
|
for (const name of packagedMethodSkillNames()) {
|
|
17168
|
-
const target =
|
|
17122
|
+
const target = join10(canonical, name);
|
|
17169
17123
|
if (installedMethodSkillPath(home, name) === void 0) continue;
|
|
17170
|
-
const link =
|
|
17124
|
+
const link = join10(root, name);
|
|
17171
17125
|
if (await occupied(link)) {
|
|
17172
17126
|
warnOccupied(link, stdout);
|
|
17173
17127
|
continue;
|
|
@@ -17283,7 +17237,7 @@ var init_collector_config = __esm({
|
|
|
17283
17237
|
});
|
|
17284
17238
|
|
|
17285
17239
|
// src/auditor-dossier-tool.ts
|
|
17286
|
-
import { join as
|
|
17240
|
+
import { join as join11, resolve as resolve3 } from "node:path";
|
|
17287
17241
|
function auditorRunDirectory(context) {
|
|
17288
17242
|
const sessionFile = context.sessionManager?.getSessionFile?.();
|
|
17289
17243
|
if (sessionFile === void 0) return void 0;
|
|
@@ -18520,15 +18474,15 @@ import { randomBytes } from "node:crypto";
|
|
|
18520
18474
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
18521
18475
|
import {
|
|
18522
18476
|
copyFileSync,
|
|
18523
|
-
existsSync as
|
|
18477
|
+
existsSync as existsSync2,
|
|
18524
18478
|
mkdirSync as mkdirSync3,
|
|
18525
|
-
readdirSync
|
|
18479
|
+
readdirSync,
|
|
18526
18480
|
renameSync as renameSync2,
|
|
18527
18481
|
rmSync as rmSync3,
|
|
18528
18482
|
statSync as statSync4
|
|
18529
18483
|
} from "node:fs";
|
|
18530
18484
|
import { homedir } from "node:os";
|
|
18531
|
-
import { dirname as dirname7, join as
|
|
18485
|
+
import { dirname as dirname7, join as join12 } from "node:path";
|
|
18532
18486
|
function declareHostSessionFailure(error) {
|
|
18533
18487
|
const message = error instanceof Error ? error.stack || error.message : String(error);
|
|
18534
18488
|
process.stderr.write(`[host-session] Dossier record failure: ${message}
|
|
@@ -18547,13 +18501,13 @@ function findCodexRollout(sessionsDir, sessionId) {
|
|
|
18547
18501
|
if (depth > 6) return;
|
|
18548
18502
|
let entries;
|
|
18549
18503
|
try {
|
|
18550
|
-
entries =
|
|
18504
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
18551
18505
|
} catch (error) {
|
|
18552
18506
|
if (isEnoent(error)) return;
|
|
18553
18507
|
throw error;
|
|
18554
18508
|
}
|
|
18555
18509
|
for (const entry of entries) {
|
|
18556
|
-
const fullPath =
|
|
18510
|
+
const fullPath = join12(dir, entry.name);
|
|
18557
18511
|
if (entry.isDirectory()) {
|
|
18558
18512
|
scan(fullPath, depth + 1);
|
|
18559
18513
|
} else if (entry.isFile() && entry.name.endsWith(".jsonl") && entry.name.includes(sessionId)) {
|
|
@@ -18583,24 +18537,24 @@ function sanitizeClaudeCwd(cwd) {
|
|
|
18583
18537
|
function resolveNativeSessionPath(options) {
|
|
18584
18538
|
const home = options.home || homedir();
|
|
18585
18539
|
if (options.host === "claude") {
|
|
18586
|
-
const configDir = process.env.CLAUDE_CONFIG_DIR ||
|
|
18540
|
+
const configDir = process.env.CLAUDE_CONFIG_DIR || join12(home, ".claude");
|
|
18587
18541
|
const sanitizedCwd = sanitizeClaudeCwd(options.cwd);
|
|
18588
|
-
return
|
|
18542
|
+
return join12(configDir, "projects", sanitizedCwd, `${options.sessionId}.jsonl`);
|
|
18589
18543
|
}
|
|
18590
18544
|
if (options.host === "codex") {
|
|
18591
18545
|
return findCodexRollout(codexSessionsDirectory(home), options.sessionId);
|
|
18592
18546
|
}
|
|
18593
18547
|
if (options.host === "grok-build") {
|
|
18594
|
-
const grokHome = process.env.GROK_HOME ||
|
|
18595
|
-
return
|
|
18548
|
+
const grokHome = process.env.GROK_HOME || join12(home, ".grok");
|
|
18549
|
+
return join12(grokHome, "sessions", encodeURIComponent(options.cwd), options.sessionId);
|
|
18596
18550
|
}
|
|
18597
18551
|
return void 0;
|
|
18598
18552
|
}
|
|
18599
18553
|
function codexSessionsDirectory(home) {
|
|
18600
|
-
return
|
|
18554
|
+
return join12(process.env.CODEX_HOME || join12(home || homedir(), ".codex"), "sessions");
|
|
18601
18555
|
}
|
|
18602
18556
|
function resolveHostDossierLandingPath(options) {
|
|
18603
|
-
return options.host === "grok-build" ?
|
|
18557
|
+
return options.host === "grok-build" ? join12(options.sessionDirectory, options.host) : join12(options.sessionDirectory, `${options.host}.jsonl`);
|
|
18604
18558
|
}
|
|
18605
18559
|
function copyFileCloneOrFallback(src, dest) {
|
|
18606
18560
|
try {
|
|
@@ -18612,8 +18566,8 @@ function copyFileCloneOrFallback(src, dest) {
|
|
|
18612
18566
|
}
|
|
18613
18567
|
function copyGrokDossier(srcDir, destDir) {
|
|
18614
18568
|
mkdirSync3(destDir, { recursive: true });
|
|
18615
|
-
copyFileCloneOrFallback(
|
|
18616
|
-
copyFileCloneOrFallback(
|
|
18569
|
+
copyFileCloneOrFallback(join12(srcDir, "chat_history.jsonl"), join12(destDir, "chat_history.jsonl"));
|
|
18570
|
+
copyFileCloneOrFallback(join12(srcDir, "usage.json"), join12(destDir, "usage.json"));
|
|
18617
18571
|
}
|
|
18618
18572
|
function copyAndRecordHostDossier(options) {
|
|
18619
18573
|
if (options.host === "hermes") {
|
|
@@ -18668,7 +18622,7 @@ function copyAndRecordHostDossier(options) {
|
|
|
18668
18622
|
}
|
|
18669
18623
|
if (options.host === "grok-build") {
|
|
18670
18624
|
const previous = `${landingPath}.previous.${attemptToken}`;
|
|
18671
|
-
const hadPrevious =
|
|
18625
|
+
const hadPrevious = existsSync2(landingPath);
|
|
18672
18626
|
let parked = false;
|
|
18673
18627
|
let keepUniquePrevious = false;
|
|
18674
18628
|
let cleanupError;
|
|
@@ -18682,12 +18636,12 @@ function copyAndRecordHostDossier(options) {
|
|
|
18682
18636
|
try {
|
|
18683
18637
|
renameSync2(staging, landingPath);
|
|
18684
18638
|
} catch (swapError) {
|
|
18685
|
-
if (parked &&
|
|
18639
|
+
if (parked && existsSync2(previous) && !existsSync2(landingPath)) {
|
|
18686
18640
|
try {
|
|
18687
18641
|
renameSync2(previous, landingPath);
|
|
18688
18642
|
} catch (error) {
|
|
18689
18643
|
restoreError = error;
|
|
18690
|
-
if (
|
|
18644
|
+
if (existsSync2(previous) && !existsSync2(landingPath)) {
|
|
18691
18645
|
keepUniquePrevious = true;
|
|
18692
18646
|
}
|
|
18693
18647
|
}
|
|
@@ -18695,7 +18649,7 @@ function copyAndRecordHostDossier(options) {
|
|
|
18695
18649
|
swapFailure = swapError;
|
|
18696
18650
|
}
|
|
18697
18651
|
} finally {
|
|
18698
|
-
if (parked &&
|
|
18652
|
+
if (parked && existsSync2(previous) && !keepUniquePrevious) {
|
|
18699
18653
|
try {
|
|
18700
18654
|
rmSync3(previous, { recursive: true, force: true });
|
|
18701
18655
|
} catch (error) {
|
|
@@ -19146,7 +19100,7 @@ var init_engine_detour_usage = __esm({
|
|
|
19146
19100
|
});
|
|
19147
19101
|
|
|
19148
19102
|
// src/dossier-resolution.ts
|
|
19149
|
-
import { existsSync as
|
|
19103
|
+
import { existsSync as existsSync3, statSync as statSync5 } from "node:fs";
|
|
19150
19104
|
import { resolve as resolve4 } from "node:path";
|
|
19151
19105
|
function isHostContext(value) {
|
|
19152
19106
|
return "sessionManager" in value;
|
|
@@ -19166,7 +19120,7 @@ function resolveAuditDossier(source) {
|
|
|
19166
19120
|
}
|
|
19167
19121
|
const runDirectory = resolve4(raw);
|
|
19168
19122
|
try {
|
|
19169
|
-
if (!
|
|
19123
|
+
if (!existsSync3(runDirectory) || !statSync5(runDirectory).isDirectory()) {
|
|
19170
19124
|
return { status: "incomplete", observation: { kind: "missing-dossier" } };
|
|
19171
19125
|
}
|
|
19172
19126
|
} catch {
|
|
@@ -19568,7 +19522,7 @@ var init_session_dialogue = __esm({
|
|
|
19568
19522
|
|
|
19569
19523
|
// src/ticket-provenance.ts
|
|
19570
19524
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
19571
|
-
import { join as
|
|
19525
|
+
import { join as join13, resolve as resolve7 } from "node:path";
|
|
19572
19526
|
function ticketProvenanceSubject(ticketNumber) {
|
|
19573
19527
|
if (!isSafePositiveTicketNumber(ticketNumber)) {
|
|
19574
19528
|
throw new Error(
|
|
@@ -19591,7 +19545,7 @@ async function rehomeUnboundTicketProvenance(runDirectory, ticketNumber, cwd, ho
|
|
|
19591
19545
|
const ticketInput = ticketProvenanceRecordInput(ticketNumber, cwd, home);
|
|
19592
19546
|
let history;
|
|
19593
19547
|
try {
|
|
19594
|
-
history = await readFile8(
|
|
19548
|
+
history = await readFile8(join13(runDirectory, RUN_HISTORY_FILE), "utf8");
|
|
19595
19549
|
} catch (error) {
|
|
19596
19550
|
if (errnoCode(error) === "ENOENT") return;
|
|
19597
19551
|
throw error;
|
|
@@ -19647,7 +19601,7 @@ var init_uuidv7 = __esm({
|
|
|
19647
19601
|
});
|
|
19648
19602
|
|
|
19649
19603
|
// src/notary-source-run.ts
|
|
19650
|
-
import { dirname as dirname9, isAbsolute as isAbsolute4, join as
|
|
19604
|
+
import { dirname as dirname9, isAbsolute as isAbsolute4, join as join14, resolve as resolve8, basename as basename7 } from "node:path";
|
|
19651
19605
|
import { lstat as lstat2, realpath as realpath2 } from "node:fs/promises";
|
|
19652
19606
|
async function readRetainedIdentity(runDirectory) {
|
|
19653
19607
|
try {
|
|
@@ -19699,11 +19653,11 @@ async function resolveNotarySourceRunLocator(options) {
|
|
|
19699
19653
|
const ledgerHome = resolveActivationLedgerHome(options.home);
|
|
19700
19654
|
const bookKey = resolveBookKeyFromGit(options.projectRoot);
|
|
19701
19655
|
const bookDirectory = activationBookDirectory(ledgerHome, bookKey);
|
|
19702
|
-
const bookRunsRoot =
|
|
19656
|
+
const bookRunsRoot = join14(bookDirectory, "runs");
|
|
19703
19657
|
let candidate;
|
|
19704
19658
|
const bare = parseRunLeaf(raw);
|
|
19705
19659
|
if (bare !== void 0 && !raw.includes("/") && !raw.includes("\\")) {
|
|
19706
|
-
candidate = await findRunDirectoryById(options.home, bare.runId, bookKey, bare.role) ??
|
|
19660
|
+
candidate = await findRunDirectoryById(options.home, bare.runId, bookKey, bare.role) ?? join14(bookRunsRoot, formatRunLeaf(bare.runId, bare.role));
|
|
19707
19661
|
} else {
|
|
19708
19662
|
candidate = isAbsolute4(raw) ? raw : resolve8(options.projectRoot, raw);
|
|
19709
19663
|
const identity2 = parseRunLeaf(basename7(candidate));
|
|
@@ -20808,7 +20762,7 @@ var init_option_definitions = __esm({
|
|
|
20808
20762
|
|
|
20809
20763
|
// src/public-cli/invocation.ts
|
|
20810
20764
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20811
|
-
import { existsSync as
|
|
20765
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
20812
20766
|
import {
|
|
20813
20767
|
lstat as lstat3,
|
|
20814
20768
|
mkdtemp,
|
|
@@ -20819,7 +20773,7 @@ import {
|
|
|
20819
20773
|
writeFile as writeFile2
|
|
20820
20774
|
} from "node:fs/promises";
|
|
20821
20775
|
import { tmpdir } from "node:os";
|
|
20822
|
-
import { basename as basename8, dirname as dirname10, isAbsolute as isAbsolute5, join as
|
|
20776
|
+
import { basename as basename8, dirname as dirname10, isAbsolute as isAbsolute5, join as join15, resolve as resolve9 } from "node:path";
|
|
20823
20777
|
function issueAdmissionPlacement(authority, request) {
|
|
20824
20778
|
const ledgerHome = resolveActivationLedgerHome(request.home);
|
|
20825
20779
|
const bookKey = resolveBookKeyFromGit(request.cwd);
|
|
@@ -20962,8 +20916,8 @@ async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
|
|
|
20962
20916
|
const childRunIds = readPageSync(oldRunDirectory, "admitted")?.childDiaristRunIds;
|
|
20963
20917
|
for (const childRunId of Array.isArray(childRunIds) ? childRunIds : []) {
|
|
20964
20918
|
if (typeof childRunId !== "string") continue;
|
|
20965
|
-
const childDirectory =
|
|
20966
|
-
if (!
|
|
20919
|
+
const childDirectory = join15(dirname10(oldRunDirectory), formatRunLeaf(childRunId, "diarist"));
|
|
20920
|
+
if (!existsSync4(childDirectory)) continue;
|
|
20967
20921
|
const childTarget = roleRunPlacement(ledgerHome, {
|
|
20968
20922
|
bookKey: admitted.bookKey,
|
|
20969
20923
|
subject: { ticketNumber: admitted.ticketNumber },
|
|
@@ -21047,7 +21001,7 @@ async function recordLaunchedPiIdentity(runDirectory, identity) {
|
|
|
21047
21001
|
async function observeLaunchedRolePackageIdentity(packageRoot2, selectedRoleEntry) {
|
|
21048
21002
|
const rolePackageRoot = packageRoot2;
|
|
21049
21003
|
const raw = JSON.parse(
|
|
21050
|
-
await readFile9(
|
|
21004
|
+
await readFile9(join15(rolePackageRoot, "package.json"), "utf8")
|
|
21051
21005
|
);
|
|
21052
21006
|
if (typeof raw.version !== "string" || raw.version.trim() === "") {
|
|
21053
21007
|
throw new Error(
|
|
@@ -21344,13 +21298,13 @@ async function removePreparedAttachmentDirectory(stagingDirectory) {
|
|
|
21344
21298
|
}
|
|
21345
21299
|
async function withPreparedAttachments(attachmentPaths, use) {
|
|
21346
21300
|
if (attachmentPaths.length === 0) return await use([]);
|
|
21347
|
-
const stagingDirectory = await mkdtemp(
|
|
21301
|
+
const stagingDirectory = await mkdtemp(join15(tmpdir(), "ak-role-attachments-"));
|
|
21348
21302
|
const prepared = [];
|
|
21349
21303
|
let result;
|
|
21350
21304
|
try {
|
|
21351
21305
|
for (let index = 0; index < attachmentPaths.length; index += 1) {
|
|
21352
21306
|
const { absolute, bytes } = await readRegularFileAttachment(attachmentPaths[index]);
|
|
21353
|
-
const snapshotPath =
|
|
21307
|
+
const snapshotPath = join15(stagingDirectory, String(index).padStart(6, "0"));
|
|
21354
21308
|
await writeFile2(snapshotPath, bytes);
|
|
21355
21309
|
prepared.push({ absolute, snapshotPath });
|
|
21356
21310
|
}
|
|
@@ -21371,7 +21325,7 @@ async function withPreparedAttachments(attachmentPaths, use) {
|
|
|
21371
21325
|
return result;
|
|
21372
21326
|
}
|
|
21373
21327
|
async function freezeAttachmentBytes(provenancePath, bytes, destinationDir, index) {
|
|
21374
|
-
const frozenPath =
|
|
21328
|
+
const frozenPath = join15(
|
|
21375
21329
|
destinationDir,
|
|
21376
21330
|
`${String(index).padStart(2, "0")}-${basename8(provenancePath)}`
|
|
21377
21331
|
);
|
|
@@ -21417,14 +21371,14 @@ async function freezeAttachments(ledgerHome, attachmentPaths, attachmentsDirecto
|
|
|
21417
21371
|
async function freezeAttachmentsIntoRun(attachmentPaths, runDirectory, summonsKey = `s-${Date.now().toString(36)}`) {
|
|
21418
21372
|
if (attachmentPaths.length === 0) return [];
|
|
21419
21373
|
const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(runDirectory));
|
|
21420
|
-
const attachmentsDirectory =
|
|
21374
|
+
const attachmentsDirectory = join15(runDirectory, "attachments", summonsKey);
|
|
21421
21375
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
21422
21376
|
return freezeAttachments(ledgerHome, attachmentPaths, attachmentsDirectory);
|
|
21423
21377
|
}
|
|
21424
21378
|
async function freezePreparedAttachmentsIntoRun(prepared, runDirectory, summonsKey) {
|
|
21425
21379
|
if (prepared.length === 0) return [];
|
|
21426
21380
|
const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(runDirectory));
|
|
21427
|
-
const attachmentsDirectory = summonsKey === void 0 ?
|
|
21381
|
+
const attachmentsDirectory = summonsKey === void 0 ? join15(runDirectory, "attachments") : join15(runDirectory, "attachments", summonsKey);
|
|
21428
21382
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
21429
21383
|
const attachments = [];
|
|
21430
21384
|
for (let index = 0; index < prepared.length; index += 1) {
|
|
@@ -21501,7 +21455,7 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
21501
21455
|
attachmentPaths,
|
|
21502
21456
|
...project,
|
|
21503
21457
|
placedFields: async (placed) => {
|
|
21504
|
-
const taskPath =
|
|
21458
|
+
const taskPath = join15(placed.runDirectory, "task.md");
|
|
21505
21459
|
await writeFile2(taskPath, instruction, "utf8");
|
|
21506
21460
|
return { phase, taskPath };
|
|
21507
21461
|
}
|
|
@@ -21544,7 +21498,7 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
21544
21498
|
placedFields: async (placed) => {
|
|
21545
21499
|
let prerequisitesPath;
|
|
21546
21500
|
if (prerequisitesSource !== void 0) {
|
|
21547
|
-
prerequisitesPath =
|
|
21501
|
+
prerequisitesPath = join15(placed.runDirectory, "prerequisites.json");
|
|
21548
21502
|
await writeFile2(
|
|
21549
21503
|
prerequisitesPath,
|
|
21550
21504
|
`${JSON.stringify(prerequisites, null, 2)}
|
|
@@ -21552,7 +21506,7 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
21552
21506
|
"utf8"
|
|
21553
21507
|
);
|
|
21554
21508
|
}
|
|
21555
|
-
const packetPath =
|
|
21509
|
+
const packetPath = join15(placed.runDirectory, "fix-packet.md");
|
|
21556
21510
|
await writeFile2(packetPath, instruction, "utf8");
|
|
21557
21511
|
return {
|
|
21558
21512
|
phase,
|
|
@@ -21599,7 +21553,7 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
21599
21553
|
placedFields: async (placed) => {
|
|
21600
21554
|
let requestManifestPath;
|
|
21601
21555
|
if (manifestCanonicalJson !== void 0) {
|
|
21602
|
-
requestManifestPath =
|
|
21556
|
+
requestManifestPath = join15(placed.runDirectory, "request-manifest.json");
|
|
21603
21557
|
await writeFile2(requestManifestPath, manifestCanonicalJson, "utf8");
|
|
21604
21558
|
}
|
|
21605
21559
|
return {
|
|
@@ -21785,7 +21739,7 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
21785
21739
|
resolutionScope: [...derived.resolutionScope],
|
|
21786
21740
|
authorizedChecks: []
|
|
21787
21741
|
});
|
|
21788
|
-
const mergerInputPath =
|
|
21742
|
+
const mergerInputPath = join15(placed.runDirectory, "merger-input.json");
|
|
21789
21743
|
await writeFile2(
|
|
21790
21744
|
mergerInputPath,
|
|
21791
21745
|
`${JSON.stringify(mergerInput, null, 2)}
|
|
@@ -21929,13 +21883,13 @@ function admittedTransportPromptKind(admitted) {
|
|
|
21929
21883
|
if (record !== void 0 && "transportPrompt" in record) return record.transportPrompt;
|
|
21930
21884
|
return "instruction";
|
|
21931
21885
|
}
|
|
21932
|
-
function buildInstructionTransportPrompt(admitted
|
|
21886
|
+
function buildInstructionTransportPrompt(admitted) {
|
|
21933
21887
|
const kind = admittedTransportPromptKind(admitted);
|
|
21934
21888
|
if (kind === "fixed-kickoff") {
|
|
21935
21889
|
if (admitted.sourceRunPath === void 0 || admitted.sourceRunPath.trim() === "") {
|
|
21936
21890
|
throw new Error("fixed-kickoff transport prompt is missing the source run pointer");
|
|
21937
21891
|
}
|
|
21938
|
-
return
|
|
21892
|
+
return admitted.sourceRunPath;
|
|
21939
21893
|
}
|
|
21940
21894
|
if (kind === "baseline") {
|
|
21941
21895
|
if (admitted.baseRevision === void 0) {
|
|
@@ -21945,7 +21899,7 @@ function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
21945
21899
|
if (!admitted.instructionEmpty) {
|
|
21946
21900
|
lines2.push("", admitted.instruction);
|
|
21947
21901
|
}
|
|
21948
|
-
return
|
|
21902
|
+
return lines2.join("\n");
|
|
21949
21903
|
}
|
|
21950
21904
|
if (kind === "skill-args") {
|
|
21951
21905
|
if (admitted.baseRevision === void 0 || admitted.lens === void 0 || admitted.authorityRefs === void 0) {
|
|
@@ -21959,7 +21913,7 @@ function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
21959
21913
|
if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
|
|
21960
21914
|
lines2.push("", admitted.instruction);
|
|
21961
21915
|
}
|
|
21962
|
-
return
|
|
21916
|
+
return lines2.join("\n");
|
|
21963
21917
|
}
|
|
21964
21918
|
const lines = [admitted.instructionEmpty ? "" : admitted.instruction];
|
|
21965
21919
|
if (admitted.attachments.length > 0) {
|
|
@@ -21969,7 +21923,7 @@ function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
21969
21923
|
lines.push(`- ${attachment.frozenPath}`);
|
|
21970
21924
|
}
|
|
21971
21925
|
}
|
|
21972
|
-
return
|
|
21926
|
+
return lines.join("\n");
|
|
21973
21927
|
}
|
|
21974
21928
|
async function materializeCountersignInvocation(admitted, options) {
|
|
21975
21929
|
const placed = await placeRoleAdmission({
|
|
@@ -22066,7 +22020,7 @@ function parseDoctorIssueNumber(raw) {
|
|
|
22066
22020
|
}
|
|
22067
22021
|
async function resolveDoctorCaseRunsPath(options) {
|
|
22068
22022
|
const ledgerHome = resolveActivationLedgerHome(options.home);
|
|
22069
|
-
const defaultRuns =
|
|
22023
|
+
const defaultRuns = join15(
|
|
22070
22024
|
activationBookDirectory(ledgerHome, options.bookKey),
|
|
22071
22025
|
String(options.issueNumber),
|
|
22072
22026
|
"runs"
|
|
@@ -22355,7 +22309,6 @@ var init_invocation = __esm({
|
|
|
22355
22309
|
init_uuidv7();
|
|
22356
22310
|
init_notary_contracts();
|
|
22357
22311
|
init_notary_source_run();
|
|
22358
|
-
init_engine_material();
|
|
22359
22312
|
init_cli_errors();
|
|
22360
22313
|
init_option_definitions();
|
|
22361
22314
|
init_unknown_value();
|
|
@@ -23596,7 +23549,7 @@ var init_settlement = __esm({
|
|
|
23596
23549
|
});
|
|
23597
23550
|
|
|
23598
23551
|
// src/session-identity.ts
|
|
23599
|
-
import { dirname as dirname11, join as
|
|
23552
|
+
import { dirname as dirname11, join as join16 } from "node:path";
|
|
23600
23553
|
function createSessionIdentityAuthority(authority, hostName) {
|
|
23601
23554
|
const runDirectoryOf = (principal) => dirname11(authority.decode(principal).sessionDirectory);
|
|
23602
23555
|
return {
|
|
@@ -23605,7 +23558,7 @@ function createSessionIdentityAuthority(authority, hostName) {
|
|
|
23605
23558
|
},
|
|
23606
23559
|
async load(principal) {
|
|
23607
23560
|
const runDirectory = runDirectoryOf(principal);
|
|
23608
|
-
const { records, diagnostics } = await readSitianRecords(
|
|
23561
|
+
const { records, diagnostics } = await readSitianRecords(join16(runDirectory, RUN_STATE_FILE));
|
|
23609
23562
|
if (diagnostics.length > 0) {
|
|
23610
23563
|
throw new Error(
|
|
23611
23564
|
`${RUN_STATE_FILE} has ${diagnostics.length} malformed row(s); refusing stale session binding: ${runDirectory}`
|
|
@@ -23675,12 +23628,12 @@ __export(role_turn_host_exports, {
|
|
|
23675
23628
|
import { execFile as execFile2, spawn } from "node:child_process";
|
|
23676
23629
|
import { constants as constants2 } from "node:fs";
|
|
23677
23630
|
import { access as access2, appendFile, realpath as realpath4 } from "node:fs/promises";
|
|
23678
|
-
import { delimiter as delimiter2, dirname as dirname12, isAbsolute as isAbsolute6, join as
|
|
23631
|
+
import { delimiter as delimiter2, dirname as dirname12, isAbsolute as isAbsolute6, join as join17, resolve as resolve10 } from "node:path";
|
|
23679
23632
|
import { platform } from "node:process";
|
|
23680
23633
|
import { promisify as promisify2 } from "node:util";
|
|
23681
23634
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
23682
23635
|
function resolveInternalRoleEntrypoint(packageRoot2) {
|
|
23683
|
-
return
|
|
23636
|
+
return join17(packageRoot2, INTERNAL_ROLE_ENTRYPOINT_RELATIVE2);
|
|
23684
23637
|
}
|
|
23685
23638
|
function buildExplicitInternalActivationArgs(selectedRoleEntry, extraArgs = []) {
|
|
23686
23639
|
return ["--no-extensions", "-e", selectedRoleEntry, ...extraArgs];
|
|
@@ -24042,17 +23995,17 @@ var init_role_turn_host = __esm({
|
|
|
24042
23995
|
});
|
|
24043
23996
|
|
|
24044
23997
|
// src/public-cli/load-production-acp-host.ts
|
|
24045
|
-
import { existsSync as
|
|
24046
|
-
import { join as
|
|
23998
|
+
import { existsSync as existsSync5 } from "node:fs";
|
|
23999
|
+
import { join as join18 } from "node:path";
|
|
24047
24000
|
import { pathToFileURL } from "node:url";
|
|
24048
24001
|
async function loadProductionAcpHostFactory(packageRoot2, host) {
|
|
24049
24002
|
const description = lookupHostDescription(host);
|
|
24050
24003
|
if (description === void 0) {
|
|
24051
24004
|
throw new Error(`unregistered host: ${host}`);
|
|
24052
24005
|
}
|
|
24053
|
-
const built =
|
|
24054
|
-
const source =
|
|
24055
|
-
const target =
|
|
24006
|
+
const built = join18(packageRoot2, "dist/acp-host/production-host.js");
|
|
24007
|
+
const source = join18(packageRoot2, "src/acp-host/production-host.ts");
|
|
24008
|
+
const target = existsSync5(built) ? built : source;
|
|
24056
24009
|
const href = pathToFileURL(target).href;
|
|
24057
24010
|
const mod = await import(href);
|
|
24058
24011
|
const create = mod.createProductionAcpRoleTurnHost;
|
|
@@ -24066,17 +24019,17 @@ var init_load_production_acp_host = __esm({
|
|
|
24066
24019
|
});
|
|
24067
24020
|
|
|
24068
24021
|
// src/public-cli/load-production-headless-host.ts
|
|
24069
|
-
import { existsSync as
|
|
24070
|
-
import { join as
|
|
24022
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
24023
|
+
import { join as join19 } from "node:path";
|
|
24071
24024
|
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
24072
24025
|
async function loadProductionHeadlessHostFactory(packageRoot2, host) {
|
|
24073
24026
|
const description = lookupHeadlessHostDescription(host);
|
|
24074
24027
|
if (description === void 0) {
|
|
24075
24028
|
throw new Error(`unregistered headless host: ${host}`);
|
|
24076
24029
|
}
|
|
24077
|
-
const built =
|
|
24078
|
-
const source =
|
|
24079
|
-
const target =
|
|
24030
|
+
const built = join19(packageRoot2, "dist/headless-host/production-host.js");
|
|
24031
|
+
const source = join19(packageRoot2, "src/headless-host/production-host.ts");
|
|
24032
|
+
const target = existsSync6(built) ? built : source;
|
|
24080
24033
|
const href = pathToFileURL2(target).href;
|
|
24081
24034
|
const mod = await import(href);
|
|
24082
24035
|
const create = mod.createProductionHeadlessRoleTurnHost;
|
|
@@ -24243,7 +24196,7 @@ var init_role_seat_runtime = __esm({
|
|
|
24243
24196
|
});
|
|
24244
24197
|
|
|
24245
24198
|
// src/archivist-record-pointer.ts
|
|
24246
|
-
import { basename as basename9, join as
|
|
24199
|
+
import { basename as basename9, join as join20 } from "node:path";
|
|
24247
24200
|
function bookDirectOfficerRunPointer(options) {
|
|
24248
24201
|
const submissionToolCallId = options.submissionToolCallId?.trim() ?? "";
|
|
24249
24202
|
const pointer = {
|
|
@@ -24292,7 +24245,7 @@ async function resolveOfficerPointer(raw, parentRunDirectory) {
|
|
|
24292
24245
|
};
|
|
24293
24246
|
}
|
|
24294
24247
|
async function readBookedOfficerPointers(parentRunDirectory) {
|
|
24295
|
-
const { records, diagnostics } = await readSitianRecords(
|
|
24248
|
+
const { records, diagnostics } = await readSitianRecords(join20(parentRunDirectory, RUN_HISTORY_FILE));
|
|
24296
24249
|
if (diagnostics.length > 0) {
|
|
24297
24250
|
throw new Error(
|
|
24298
24251
|
`${RUN_HISTORY_FILE} has ${diagnostics.length} malformed row(s); officer pointers unreadable: ${parentRunDirectory}`
|
|
@@ -24584,14 +24537,14 @@ var init_submission_gate = __esm({
|
|
|
24584
24537
|
});
|
|
24585
24538
|
|
|
24586
24539
|
// src/session-opening-materials.ts
|
|
24587
|
-
import { existsSync as
|
|
24540
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
24588
24541
|
import { readFile as readFile10 } from "node:fs/promises";
|
|
24589
|
-
import { dirname as dirname13, join as
|
|
24542
|
+
import { dirname as dirname13, join as join21 } from "node:path";
|
|
24590
24543
|
import { fileURLToPath, pathToFileURL as pathToFileURL3 } from "node:url";
|
|
24591
24544
|
function resolvePackageRootDir(moduleUrl = import.meta.url) {
|
|
24592
24545
|
let dir = dirname13(fileURLToPath(moduleUrl));
|
|
24593
24546
|
for (let i = 0; i < 8; i += 1) {
|
|
24594
|
-
if (
|
|
24547
|
+
if (existsSync7(join21(dir, "package.json")) && existsSync7(join21(dir, "souls"))) {
|
|
24595
24548
|
return dir;
|
|
24596
24549
|
}
|
|
24597
24550
|
const parent = dirname13(dir);
|
|
@@ -25313,13 +25266,7 @@ function initialPrompt(admitted, env) {
|
|
|
25313
25266
|
if (reask !== void 0 && "reaskPrompt" in record && record.reaskPrompt === true) {
|
|
25314
25267
|
return reask;
|
|
25315
25268
|
}
|
|
25316
|
-
return buildInstructionTransportPrompt(
|
|
25317
|
-
admitted,
|
|
25318
|
-
engineSessionMaterialFromOptions({
|
|
25319
|
-
...pickEngineAxis(env),
|
|
25320
|
-
packageRoot: env.packageRoot
|
|
25321
|
-
})
|
|
25322
|
-
);
|
|
25269
|
+
return buildInstructionTransportPrompt(admitted);
|
|
25323
25270
|
}
|
|
25324
25271
|
function isBoardTicketSeat(seat) {
|
|
25325
25272
|
return packagedBindsBoardTicket(seat.role);
|
|
@@ -25413,10 +25360,7 @@ async function dispatchAdmitted(admitted, env, io) {
|
|
|
25413
25360
|
admitted,
|
|
25414
25361
|
roleTurnOptions(activeEnv, admitted, {
|
|
25415
25362
|
kind: "resume",
|
|
25416
|
-
prompt: buildAutoResumeContinuationPrompt(
|
|
25417
|
-
packageRoot: activeEnv.packageRoot,
|
|
25418
|
-
...pickEngineAxis(activeEnv)
|
|
25419
|
-
})
|
|
25363
|
+
prompt: buildAutoResumeContinuationPrompt()
|
|
25420
25364
|
})
|
|
25421
25365
|
),
|
|
25422
25366
|
adapters,
|
|
@@ -25582,13 +25526,7 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
25582
25526
|
}
|
|
25583
25527
|
const turnProjection = roleTurnOptions(env, admitted, {
|
|
25584
25528
|
kind: "initial",
|
|
25585
|
-
prompt: env.reviewReask ?? env.gateReviewInstruction ?? buildInstructionTransportPrompt(
|
|
25586
|
-
admitted,
|
|
25587
|
-
engineSessionMaterialFromOptions({
|
|
25588
|
-
...pickEngineAxis(env),
|
|
25589
|
-
packageRoot: env.packageRoot
|
|
25590
|
-
})
|
|
25591
|
-
)
|
|
25529
|
+
prompt: env.reviewReask ?? env.gateReviewInstruction ?? buildInstructionTransportPrompt(admitted)
|
|
25592
25530
|
});
|
|
25593
25531
|
const turnRequest = buildInstructionSeatTurnRequest(admitted, turnProjection);
|
|
25594
25532
|
const result = await runPostAdmissionOneShot({
|
|
@@ -26285,7 +26223,6 @@ var init_instruction_seat_run = __esm({
|
|
|
26285
26223
|
init_submission_gate();
|
|
26286
26224
|
init_run_ticket_number();
|
|
26287
26225
|
init_notary_source_run();
|
|
26288
|
-
init_engine_material();
|
|
26289
26226
|
init_packaged_role_registry();
|
|
26290
26227
|
init_auditor_soul();
|
|
26291
26228
|
init_cli_errors();
|
|
@@ -26350,9 +26287,9 @@ __export(public_role_summons_exports, {
|
|
|
26350
26287
|
summonPublicRole: () => summonPublicRole
|
|
26351
26288
|
});
|
|
26352
26289
|
import { execFile as execFile3 } from "node:child_process";
|
|
26353
|
-
import { existsSync as
|
|
26290
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
26354
26291
|
import { realpath as realpath5 } from "node:fs/promises";
|
|
26355
|
-
import { join as
|
|
26292
|
+
import { join as join23 } from "node:path";
|
|
26356
26293
|
import { promisify as promisify3 } from "node:util";
|
|
26357
26294
|
function createCapturingIo() {
|
|
26358
26295
|
const chunks = [];
|
|
@@ -26376,7 +26313,7 @@ function parentDir(path) {
|
|
|
26376
26313
|
function walkPackageRoot(start) {
|
|
26377
26314
|
let dir = start;
|
|
26378
26315
|
for (let i = 0; i < 12; i += 1) {
|
|
26379
|
-
if (
|
|
26316
|
+
if (existsSync8(join23(dir, "package.json")) && existsSync8(join23(dir, "souls"))) {
|
|
26380
26317
|
return dir;
|
|
26381
26318
|
}
|
|
26382
26319
|
const parent = parentDir(dir);
|
|
@@ -26979,7 +26916,7 @@ var init_compliance_transport = __esm({
|
|
|
26979
26916
|
});
|
|
26980
26917
|
|
|
26981
26918
|
// src/role-run-relocation.ts
|
|
26982
|
-
import { dirname as dirname15, join as
|
|
26919
|
+
import { dirname as dirname15, join as join24, sep as sep4 } from "node:path";
|
|
26983
26920
|
function rewriteRunDirectoryPathValue(value, oldRunDirectory, newRunDirectory) {
|
|
26984
26921
|
if (typeof value !== "string") return value;
|
|
26985
26922
|
if (value === oldRunDirectory) return newRunDirectory;
|
|
@@ -27129,15 +27066,9 @@ __export(run_lifecycle_exports, {
|
|
|
27129
27066
|
writeRoleRunState: () => writeRoleRunState
|
|
27130
27067
|
});
|
|
27131
27068
|
import { chmod, lstat as lstat4, open, readdir as readdir3, readFile as readFile11, unlink } from "node:fs/promises";
|
|
27132
|
-
import { basename as basename11, join as
|
|
27133
|
-
function buildAutoResumeContinuationPrompt(
|
|
27134
|
-
return
|
|
27135
|
-
[RESUME_TRANSPORT_ENVELOPE],
|
|
27136
|
-
engineSessionMaterialFromOptions({
|
|
27137
|
-
packageRoot: options.packageRoot,
|
|
27138
|
-
...pickEngineAxis(options)
|
|
27139
|
-
})
|
|
27140
|
-
).join("\n");
|
|
27069
|
+
import { basename as basename11, join as join25 } from "node:path";
|
|
27070
|
+
function buildAutoResumeContinuationPrompt() {
|
|
27071
|
+
return RESUME_TRANSPORT_ENVELOPE;
|
|
27141
27072
|
}
|
|
27142
27073
|
async function writeRoleRunState(runDirectory, record) {
|
|
27143
27074
|
const payload = { ...record, runDirectory };
|
|
@@ -27432,7 +27363,7 @@ async function createWriterLease(lockPath, runDirectory, reportCleanupFailure) {
|
|
|
27432
27363
|
},
|
|
27433
27364
|
relocate(nextRunDirectory) {
|
|
27434
27365
|
currentRunDirectory = nextRunDirectory;
|
|
27435
|
-
currentLockPath =
|
|
27366
|
+
currentLockPath = join25(nextRunDirectory, WRITER_LOCK_FILE);
|
|
27436
27367
|
},
|
|
27437
27368
|
async release() {
|
|
27438
27369
|
if (released) return;
|
|
@@ -27471,10 +27402,10 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
|
|
|
27471
27402
|
};
|
|
27472
27403
|
const reportReadFailure = (error) => {
|
|
27473
27404
|
reportDiagnostic(
|
|
27474
|
-
`writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${
|
|
27405
|
+
`writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${join25(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
|
|
27475
27406
|
);
|
|
27476
27407
|
};
|
|
27477
|
-
const lockPath =
|
|
27408
|
+
const lockPath = join25(runDirectory, WRITER_LOCK_FILE);
|
|
27478
27409
|
let lastAutopsy = { verdict: "absent" };
|
|
27479
27410
|
let lastReclaimFailure;
|
|
27480
27411
|
for (let reclaimsLeft = WRITER_LEASE_RECLAIM_ROUNDS; ; reclaimsLeft -= 1) {
|
|
@@ -27531,7 +27462,7 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
|
|
|
27531
27462
|
async function findRunDirectoryById(home, runId, onlyBookKey, onlyRole) {
|
|
27532
27463
|
if (runId.trim() === "") return void 0;
|
|
27533
27464
|
const ledgerHome = resolveActivationLedgerHome(home);
|
|
27534
|
-
const booksRoot =
|
|
27465
|
+
const booksRoot = join25(ledgerHome, "books");
|
|
27535
27466
|
let bookKeys;
|
|
27536
27467
|
try {
|
|
27537
27468
|
bookKeys = await readdir3(booksRoot);
|
|
@@ -27582,7 +27513,7 @@ async function findLatestRunIdForSeatTicket(input) {
|
|
|
27582
27513
|
let runDirectories;
|
|
27583
27514
|
try {
|
|
27584
27515
|
runDirectories = await listBookRunDirectories(
|
|
27585
|
-
input.ticketNumber === void 0 ? bookDir :
|
|
27516
|
+
input.ticketNumber === void 0 ? bookDir : join25(bookDir, String(input.ticketNumber))
|
|
27586
27517
|
);
|
|
27587
27518
|
} catch (error) {
|
|
27588
27519
|
if (errorCodeOf(error) === "ENOENT") return void 0;
|
|
@@ -28111,7 +28042,6 @@ var init_run_lifecycle = __esm({
|
|
|
28111
28042
|
init_cli_errors();
|
|
28112
28043
|
init_collector_config();
|
|
28113
28044
|
init_role_run_relocation();
|
|
28114
|
-
init_engine_material();
|
|
28115
28045
|
init_packaged_role_registry();
|
|
28116
28046
|
init_invocation();
|
|
28117
28047
|
init_run_dossier();
|
|
@@ -28141,7 +28071,7 @@ var init_run_lifecycle = __esm({
|
|
|
28141
28071
|
|
|
28142
28072
|
// src/public-cli/post-admission.ts
|
|
28143
28073
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
28144
|
-
import { isAbsolute as isAbsolute8, join as
|
|
28074
|
+
import { isAbsolute as isAbsolute8, join as join26, resolve as resolve12 } from "node:path";
|
|
28145
28075
|
function describeCaughtError(error) {
|
|
28146
28076
|
if (error instanceof Error) {
|
|
28147
28077
|
const code = error.code;
|
|
@@ -28979,7 +28909,7 @@ async function runSettledAutoResumeLoop(input) {
|
|
|
28979
28909
|
}
|
|
28980
28910
|
function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
|
|
28981
28911
|
const absolute = isAbsolute8(attachmentPath) ? attachmentPath : resolve12(attachmentPath);
|
|
28982
|
-
return pathContainedIn(
|
|
28912
|
+
return pathContainedIn(join26(runDirectory, "attachments"), absolute);
|
|
28983
28913
|
}
|
|
28984
28914
|
async function prepareSummonsResumeMaterials(runDirectory, summons) {
|
|
28985
28915
|
if (summons === void 0) return void 0;
|
|
@@ -29226,13 +29156,7 @@ async function runPostAdmissionOneShot(input) {
|
|
|
29226
29156
|
...input.request,
|
|
29227
29157
|
continuation: {
|
|
29228
29158
|
kind: "resume",
|
|
29229
|
-
prompt: buildAutoResumeContinuationPrompt(
|
|
29230
|
-
packageRoot: input.env.packageRoot,
|
|
29231
|
-
...pickEngineAxis({
|
|
29232
|
-
engine: input.effectiveEngine ?? input.env.engine,
|
|
29233
|
-
engineModel: input.env.engineModel
|
|
29234
|
-
})
|
|
29235
|
-
})
|
|
29159
|
+
prompt: buildAutoResumeContinuationPrompt()
|
|
29236
29160
|
}
|
|
29237
29161
|
}),
|
|
29238
29162
|
adapters: input.adapters,
|
|
@@ -29316,7 +29240,6 @@ var init_post_admission = __esm({
|
|
|
29316
29240
|
init_submission_ledger();
|
|
29317
29241
|
init_run_ticket_number();
|
|
29318
29242
|
init_activation_ledger_topology();
|
|
29319
|
-
init_engine_material();
|
|
29320
29243
|
init_session_identity();
|
|
29321
29244
|
init_sitian_facade();
|
|
29322
29245
|
init_receipt_delivery_policy();
|
|
@@ -29371,10 +29294,10 @@ var init_analyst_book_key = __esm({
|
|
|
29371
29294
|
// src/atomic-write.ts
|
|
29372
29295
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
29373
29296
|
import { rename as rename2, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
|
|
29374
|
-
import { dirname as dirname16, join as
|
|
29297
|
+
import { dirname as dirname16, join as join27 } from "node:path";
|
|
29375
29298
|
async function writeFileAtomically(destination, contents, options) {
|
|
29376
29299
|
const parent = dirname16(destination);
|
|
29377
|
-
const temporary =
|
|
29300
|
+
const temporary = join27(parent, `.atomic-write-${randomUUID6()}.tmp`);
|
|
29378
29301
|
try {
|
|
29379
29302
|
await writeFile4(temporary, contents, options);
|
|
29380
29303
|
await rename2(temporary, destination);
|
|
@@ -29391,12 +29314,12 @@ var init_atomic_write = __esm({
|
|
|
29391
29314
|
|
|
29392
29315
|
// src/analyst-index.ts
|
|
29393
29316
|
import { open as open2, readFile as readFile12, unlink as unlink2 } from "node:fs/promises";
|
|
29394
|
-
import { dirname as dirname17, join as
|
|
29317
|
+
import { dirname as dirname17, join as join28 } from "node:path";
|
|
29395
29318
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
29396
29319
|
async function withAnalystLibraryIndexLock(ledgerHome, fn) {
|
|
29397
29320
|
const indexPath = analystLibraryIndexPath(ledgerHome);
|
|
29398
29321
|
ensureRealDirectoryTree(ledgerHome, dirname17(indexPath));
|
|
29399
|
-
const lockPath =
|
|
29322
|
+
const lockPath = join28(dirname17(indexPath), LIBRARY_INDEX_LOCK_NAME);
|
|
29400
29323
|
assertLedgerFileInsideHome(lockPath, ledgerHome);
|
|
29401
29324
|
const startedAt = Date.now();
|
|
29402
29325
|
while (true) {
|
|
@@ -29423,7 +29346,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
|
|
|
29423
29346
|
}
|
|
29424
29347
|
}
|
|
29425
29348
|
function analystLibraryIndexPath(ledgerHome) {
|
|
29426
|
-
return
|
|
29349
|
+
return join28(ledgerHome, "analyst", "library-index.json");
|
|
29427
29350
|
}
|
|
29428
29351
|
function rowFromIssueMetricsPage(page) {
|
|
29429
29352
|
return {
|
|
@@ -29969,7 +29892,7 @@ var init_analyst_gate_cycles_read = __esm({
|
|
|
29969
29892
|
|
|
29970
29893
|
// src/analyst-ledger.ts
|
|
29971
29894
|
import { readdir as readdir4 } from "node:fs/promises";
|
|
29972
|
-
import { basename as basename12, join as
|
|
29895
|
+
import { basename as basename12, join as join29 } from "node:path";
|
|
29973
29896
|
async function readExistingRunLifecycleState(runDirectory) {
|
|
29974
29897
|
return (await readRoleRunIdentity(runDirectory))?.state;
|
|
29975
29898
|
}
|
|
@@ -29989,7 +29912,7 @@ function ghostLeaseCheckFromAutopsy(autopsy) {
|
|
|
29989
29912
|
}
|
|
29990
29913
|
}
|
|
29991
29914
|
async function classifyGhostCandidate(input) {
|
|
29992
|
-
const autopsy = await autopsyWriterLock(
|
|
29915
|
+
const autopsy = await autopsyWriterLock(join29(input.runDirectory, "writer.lock"));
|
|
29993
29916
|
const leaseCheck = ghostLeaseCheckFromAutopsy(autopsy);
|
|
29994
29917
|
if (leaseCheck === void 0) return { kind: "live" };
|
|
29995
29918
|
return {
|
|
@@ -30279,7 +30202,7 @@ async function classifyScopedRun(input) {
|
|
|
30279
30202
|
async function scanAnalystIssueRuns(input) {
|
|
30280
30203
|
const ledgerHome = resolveActivationLedgerHome(input.home);
|
|
30281
30204
|
const scopeTicketNumber = input.ticketNumber;
|
|
30282
|
-
const booksRoot =
|
|
30205
|
+
const booksRoot = join29(ledgerHome, "books");
|
|
30283
30206
|
let wholeBook = false;
|
|
30284
30207
|
let scopeRootIdentity;
|
|
30285
30208
|
let bookNames;
|
|
@@ -30312,7 +30235,7 @@ async function scanAnalystIssueRuns(input) {
|
|
|
30312
30235
|
const ghostLegs = [];
|
|
30313
30236
|
const scopeConflicts = [];
|
|
30314
30237
|
for (const book of bookNames) {
|
|
30315
|
-
const bookDir =
|
|
30238
|
+
const bookDir = join29(booksRoot, book);
|
|
30316
30239
|
let runDirectories;
|
|
30317
30240
|
try {
|
|
30318
30241
|
runDirectories = await listBookRunDirectories(bookDir);
|
|
@@ -31058,7 +30981,7 @@ var init_analyst_metric_family = __esm({
|
|
|
31058
30981
|
});
|
|
31059
30982
|
|
|
31060
30983
|
// src/analyst-page.ts
|
|
31061
|
-
import { dirname as dirname18, join as
|
|
30984
|
+
import { dirname as dirname18, join as join30 } from "node:path";
|
|
31062
30985
|
function analystIssuePageKey(address) {
|
|
31063
30986
|
const parts = ["book", address.bookKey];
|
|
31064
30987
|
if (address.issueNumber !== void 0) {
|
|
@@ -31069,7 +30992,7 @@ function analystIssuePageKey(address) {
|
|
|
31069
30992
|
return sha256Hex(parts.join("\0")).slice(0, 32);
|
|
31070
30993
|
}
|
|
31071
30994
|
function analystIssuePagePath(ledgerHome, address) {
|
|
31072
|
-
return
|
|
30995
|
+
return join30(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
|
|
31073
30996
|
}
|
|
31074
30997
|
function analystIssuePageAddressFromPage(page) {
|
|
31075
30998
|
return {
|
|
@@ -32604,8 +32527,8 @@ var init_cli = __esm({
|
|
|
32604
32527
|
});
|
|
32605
32528
|
|
|
32606
32529
|
// src/public-cli/main.ts
|
|
32607
|
-
import { existsSync as
|
|
32608
|
-
import { dirname as dirname19, join as
|
|
32530
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
32531
|
+
import { dirname as dirname19, join as join31 } from "node:path";
|
|
32609
32532
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
32610
32533
|
|
|
32611
32534
|
// src/public-cli/host-pi-runtime.ts
|
|
@@ -32694,8 +32617,8 @@ function linkPackage(packageRoot2, name, targetDir) {
|
|
|
32694
32617
|
// src/public-cli/main.ts
|
|
32695
32618
|
var here = dirname19(fileURLToPath2(import.meta.url));
|
|
32696
32619
|
function resolvePackageRoot(binDir) {
|
|
32697
|
-
const canonical =
|
|
32698
|
-
if (
|
|
32620
|
+
const canonical = join31(binDir, "..", "..");
|
|
32621
|
+
if (existsSync9(join31(canonical, "package.json"))) {
|
|
32699
32622
|
return canonical;
|
|
32700
32623
|
}
|
|
32701
32624
|
return binDir;
|