@akagilnc/pi-workflow-roles 0.1.3771 → 0.1.3789
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/acp-host/production-host.js +793 -393
- package/dist/atomic-write.js +23 -0
- package/dist/collector-handbook.js +142 -0
- package/dist/collector-ledger.js +39 -47
- package/dist/collector-role.js +103 -14
- package/dist/collector-tool-schemas.js +25 -1
- package/dist/headless-host/description.js +77 -0
- package/dist/headless-host/mcp-relay.mjs +119 -0
- package/dist/headless-host/production-host.js +26841 -0
- package/dist/host-descriptions.js +44 -3
- package/dist/public-cli/load-production-external-host.js +19 -0
- package/dist/public-cli/load-production-headless-host.js +36 -0
- package/dist/public-cli/main.js +244 -234
- package/dist/public-cli/option-definitions.js +2 -2
- package/dist/public-role-summons.js +40 -5
- package/dist/role-runtime.js +3 -0
- package/extensions/role-runtime.ts +2 -0
- package/package.json +1 -1
- package/resources/collector-bot-handbook.md +33 -0
- package/scripts/build-package.mjs +28 -0
- package/src/acp-host/production-host.ts +4 -0
- package/src/acp-host/role-envelope.ts +141 -84
- package/src/acp-host/role-turn-host.ts +12 -0
- package/src/collector-handbook.ts +194 -0
- package/src/collector-ledger.ts +42 -62
- package/src/collector-role.ts +117 -11
- package/src/collector-tool-schemas.ts +25 -1
- package/src/headless-host/description.ts +123 -0
- package/src/headless-host/production-host.ts +75 -0
- package/src/headless-host/role-turn-host.ts +424 -0
- package/src/host-descriptions.ts +53 -6
- package/src/public-cli/cli.ts +2 -2
- package/src/public-cli/load-production-external-host.ts +29 -0
- package/src/public-cli/load-production-headless-host.ts +48 -0
- package/src/public-cli/main.ts +5 -0
- package/src/public-cli/option-definitions.ts +2 -2
- package/src/public-role-summons.ts +62 -9
- package/src/role-runtime.ts +5 -0
package/dist/public-cli/main.js
CHANGED
|
@@ -15453,16 +15453,24 @@ var init_institutional_resolution = __esm({
|
|
|
15453
15453
|
function lookupHostDescription(host) {
|
|
15454
15454
|
return Object.hasOwn(HOST_DESCRIPTIONS, host) ? HOST_DESCRIPTIONS[host] : void 0;
|
|
15455
15455
|
}
|
|
15456
|
+
function lookupHeadlessHostDescription(host) {
|
|
15457
|
+
return Object.hasOwn(HEADLESS_HOST_DESCRIPTIONS, host) ? HEADLESS_HOST_DESCRIPTIONS[host] : void 0;
|
|
15458
|
+
}
|
|
15459
|
+
function lookupHostFamily(host) {
|
|
15460
|
+
if (lookupHostDescription(host) !== void 0) return "acp";
|
|
15461
|
+
if (lookupHeadlessHostDescription(host) !== void 0) return "headless";
|
|
15462
|
+
return void 0;
|
|
15463
|
+
}
|
|
15456
15464
|
function packagedExternalHostNames() {
|
|
15457
|
-
return Object.keys(HOST_DESCRIPTIONS);
|
|
15465
|
+
return [...Object.keys(HOST_DESCRIPTIONS), ...Object.keys(HEADLESS_HOST_DESCRIPTIONS)];
|
|
15458
15466
|
}
|
|
15459
15467
|
function assertRegisteredHostName(host) {
|
|
15460
|
-
if (host === DEFAULT_ROLE_TURN_HOST ||
|
|
15468
|
+
if (host === DEFAULT_ROLE_TURN_HOST || lookupHostFamily(host) !== void 0) {
|
|
15461
15469
|
return host;
|
|
15462
15470
|
}
|
|
15463
15471
|
throw new Error(`unregistered host: ${host}`);
|
|
15464
15472
|
}
|
|
15465
|
-
var PRIVATE_COMPAT_ENV, DEFAULT_ROLE_TURN_HOST, HOST_DESCRIPTIONS;
|
|
15473
|
+
var PRIVATE_COMPAT_ENV, DEFAULT_ROLE_TURN_HOST, HOST_DESCRIPTIONS, HEADLESS_HOST_DESCRIPTIONS;
|
|
15466
15474
|
var init_host_descriptions = __esm({
|
|
15467
15475
|
"src/host-descriptions.ts"() {
|
|
15468
15476
|
"use strict";
|
|
@@ -15514,6 +15522,33 @@ var init_host_descriptions = __esm({
|
|
|
15514
15522
|
})
|
|
15515
15523
|
})
|
|
15516
15524
|
});
|
|
15525
|
+
HEADLESS_HOST_DESCRIPTIONS = Object.freeze({
|
|
15526
|
+
"claude": Object.freeze({
|
|
15527
|
+
binaryFromHome: Object.freeze([".local", "bin", "claude"]),
|
|
15528
|
+
sessionBindingFile: "claude-headless-session.json",
|
|
15529
|
+
fixedArgs: Object.freeze([
|
|
15530
|
+
// One result envelope (not stream-json): typed receipt only; no event-stream copy.
|
|
15531
|
+
"--output-format",
|
|
15532
|
+
"json",
|
|
15533
|
+
"--permission-mode",
|
|
15534
|
+
"bypassPermissions",
|
|
15535
|
+
// Empty sources: no user/project/local operator surface (envelope owns materials).
|
|
15536
|
+
"--setting-sources",
|
|
15537
|
+
"",
|
|
15538
|
+
// With adapter-supplied --mcp-config only (AK relay); drops operator + claude.ai MCP.
|
|
15539
|
+
"--strict-mcp-config"
|
|
15540
|
+
]),
|
|
15541
|
+
promptFlag: "-p",
|
|
15542
|
+
modelFlag: "--model",
|
|
15543
|
+
effortFlag: "--effort",
|
|
15544
|
+
// File path keeps large role envelopes off ARG_MAX.
|
|
15545
|
+
systemPromptFlag: "--system-prompt-file",
|
|
15546
|
+
jsonSchemaFlag: "--json-schema",
|
|
15547
|
+
mcpConfigFlag: "--mcp-config",
|
|
15548
|
+
sessionIdFlag: "--session-id",
|
|
15549
|
+
resumeFlag: "--resume"
|
|
15550
|
+
})
|
|
15551
|
+
});
|
|
15517
15552
|
}
|
|
15518
15553
|
});
|
|
15519
15554
|
|
|
@@ -16154,6 +16189,50 @@ var init_load_production_acp_host = __esm({
|
|
|
16154
16189
|
}
|
|
16155
16190
|
});
|
|
16156
16191
|
|
|
16192
|
+
// src/public-cli/load-production-headless-host.ts
|
|
16193
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
16194
|
+
import { join as join8 } from "node:path";
|
|
16195
|
+
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
16196
|
+
async function loadProductionHeadlessHostFactory(packageRoot2, host) {
|
|
16197
|
+
const description = lookupHeadlessHostDescription(host);
|
|
16198
|
+
if (description === void 0) {
|
|
16199
|
+
throw new Error(`unregistered headless host: ${host}`);
|
|
16200
|
+
}
|
|
16201
|
+
const built = join8(packageRoot2, "dist/headless-host/production-host.js");
|
|
16202
|
+
const source = join8(packageRoot2, "src/headless-host/production-host.ts");
|
|
16203
|
+
const target = existsSync4(built) ? built : source;
|
|
16204
|
+
const href = pathToFileURL2(target).href;
|
|
16205
|
+
const mod = await import(href);
|
|
16206
|
+
const create = mod.createProductionHeadlessRoleTurnHost;
|
|
16207
|
+
return (options) => create({ ...options, description });
|
|
16208
|
+
}
|
|
16209
|
+
var init_load_production_headless_host = __esm({
|
|
16210
|
+
"src/public-cli/load-production-headless-host.ts"() {
|
|
16211
|
+
"use strict";
|
|
16212
|
+
init_host_descriptions();
|
|
16213
|
+
}
|
|
16214
|
+
});
|
|
16215
|
+
|
|
16216
|
+
// src/public-cli/load-production-external-host.ts
|
|
16217
|
+
async function loadProductionExternalHostFactory(packageRoot2, host) {
|
|
16218
|
+
const family = lookupHostFamily(host);
|
|
16219
|
+
if (family === "acp") {
|
|
16220
|
+
return loadProductionAcpHostFactory(packageRoot2, host);
|
|
16221
|
+
}
|
|
16222
|
+
if (family === "headless") {
|
|
16223
|
+
return loadProductionHeadlessHostFactory(packageRoot2, host);
|
|
16224
|
+
}
|
|
16225
|
+
throw new Error(`unregistered host: ${host}`);
|
|
16226
|
+
}
|
|
16227
|
+
var init_load_production_external_host = __esm({
|
|
16228
|
+
"src/public-cli/load-production-external-host.ts"() {
|
|
16229
|
+
"use strict";
|
|
16230
|
+
init_host_descriptions();
|
|
16231
|
+
init_load_production_acp_host();
|
|
16232
|
+
init_load_production_headless_host();
|
|
16233
|
+
}
|
|
16234
|
+
});
|
|
16235
|
+
|
|
16157
16236
|
// src/host-contracts.ts
|
|
16158
16237
|
var ExplicitInternalActivationError;
|
|
16159
16238
|
var init_host_contracts = __esm({
|
|
@@ -16221,12 +16300,12 @@ var init_sitian_contracts = __esm({
|
|
|
16221
16300
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
16222
16301
|
import {
|
|
16223
16302
|
appendFileSync,
|
|
16224
|
-
existsSync as
|
|
16303
|
+
existsSync as existsSync5,
|
|
16225
16304
|
readFileSync as readFileSync2,
|
|
16226
16305
|
unlinkSync,
|
|
16227
16306
|
writeFileSync
|
|
16228
16307
|
} from "node:fs";
|
|
16229
|
-
import { basename as basename3, dirname as dirname5, join as
|
|
16308
|
+
import { basename as basename3, dirname as dirname5, join as join9, resolve as resolve3 } from "node:path";
|
|
16230
16309
|
function isRecord7(value) {
|
|
16231
16310
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16232
16311
|
}
|
|
@@ -16241,14 +16320,14 @@ function createExclusiveFile(path, contents) {
|
|
|
16241
16320
|
writeFileSync(path, contents, { encoding: "utf8", flag: "wx" });
|
|
16242
16321
|
}
|
|
16243
16322
|
function sealTornTail(recordFile) {
|
|
16244
|
-
if (!
|
|
16323
|
+
if (!existsSync5(recordFile)) return;
|
|
16245
16324
|
const buffer = readFileSync2(recordFile);
|
|
16246
16325
|
if (buffer.length > 0 && buffer[buffer.length - 1] !== 10) {
|
|
16247
16326
|
appendFileSync(recordFile, "\n", "utf8");
|
|
16248
16327
|
}
|
|
16249
16328
|
}
|
|
16250
16329
|
function findIdentityPointer(recordFile, identity, kind, level) {
|
|
16251
|
-
if (!
|
|
16330
|
+
if (!existsSync5(recordFile)) return void 0;
|
|
16252
16331
|
const text = readFileSync2(recordFile, "utf8");
|
|
16253
16332
|
for (const line2 of text.split("\n")) {
|
|
16254
16333
|
const trimmed = line2.trim();
|
|
@@ -16365,7 +16444,7 @@ function resolveSitianRecordPathInLedger(input, ledgerHome) {
|
|
|
16365
16444
|
const category = resolveSitianVolumeCategory(input.kind);
|
|
16366
16445
|
let sessionDir;
|
|
16367
16446
|
if (input.sessionParent !== void 0 && input.sessionParent.length > 0 && physicallyContainedIn(ledgerHome, input.sessionParent)) {
|
|
16368
|
-
sessionDir =
|
|
16447
|
+
sessionDir = join9(dirname5(input.sessionParent), category);
|
|
16369
16448
|
} else {
|
|
16370
16449
|
const bookKey = safeBookKey(cwd);
|
|
16371
16450
|
const bookDir = activationBookDirectory(ledgerHome, bookKey);
|
|
@@ -16379,12 +16458,12 @@ function resolveSitianRecordPathInLedger(input, ledgerHome) {
|
|
|
16379
16458
|
subjectStr = JSON.stringify(input.subject);
|
|
16380
16459
|
}
|
|
16381
16460
|
const digest = createHash2("sha256").update(subjectStr).digest("hex").slice(0, 32);
|
|
16382
|
-
sessionDir =
|
|
16461
|
+
sessionDir = join9(bookDir, category, digest);
|
|
16383
16462
|
} else {
|
|
16384
|
-
sessionDir =
|
|
16463
|
+
sessionDir = join9(bookDir, category);
|
|
16385
16464
|
}
|
|
16386
16465
|
}
|
|
16387
|
-
const recordFile =
|
|
16466
|
+
const recordFile = join9(sessionDir, "records.jsonl");
|
|
16388
16467
|
return { sessionDir, recordFile, ledgerHome };
|
|
16389
16468
|
}
|
|
16390
16469
|
function resolveSitianRecordPath(input) {
|
|
@@ -16441,13 +16520,13 @@ var init_sitian_appender = __esm({
|
|
|
16441
16520
|
});
|
|
16442
16521
|
|
|
16443
16522
|
// src/sitian-reader.ts
|
|
16444
|
-
import { existsSync as
|
|
16523
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
16445
16524
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
16446
16525
|
function isRecord8(value) {
|
|
16447
16526
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16448
16527
|
}
|
|
16449
16528
|
async function readSitianRecords(recordFile) {
|
|
16450
|
-
if (!
|
|
16529
|
+
if (!existsSync6(recordFile)) {
|
|
16451
16530
|
return { records: [], diagnostics: [] };
|
|
16452
16531
|
}
|
|
16453
16532
|
const text = await readFile2(recordFile, "utf8");
|
|
@@ -16505,12 +16584,12 @@ var init_sitian_facade = __esm({
|
|
|
16505
16584
|
import { execFile, spawn } from "node:child_process";
|
|
16506
16585
|
import { constants } from "node:fs";
|
|
16507
16586
|
import { access, appendFile, readFile as readFile3, realpath } from "node:fs/promises";
|
|
16508
|
-
import { delimiter as delimiter2, isAbsolute as isAbsolute3, join as
|
|
16587
|
+
import { delimiter as delimiter2, isAbsolute as isAbsolute3, join as join10, resolve as resolve4 } from "node:path";
|
|
16509
16588
|
import { platform } from "node:process";
|
|
16510
16589
|
import { promisify } from "node:util";
|
|
16511
16590
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
16512
16591
|
function resolveInternalRoleEntrypoint(packageRoot2) {
|
|
16513
|
-
return
|
|
16592
|
+
return join10(packageRoot2, INTERNAL_ROLE_ENTRYPOINT_RELATIVE2);
|
|
16514
16593
|
}
|
|
16515
16594
|
function buildExplicitInternalActivationArgs(selectedRoleEntry, extraArgs = []) {
|
|
16516
16595
|
return ["--no-extensions", "-e", selectedRoleEntry, ...extraArgs];
|
|
@@ -16854,7 +16933,7 @@ var init_role_turn_host = __esm({
|
|
|
16854
16933
|
|
|
16855
16934
|
// src/run-ticket-number.ts
|
|
16856
16935
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
16857
|
-
import { join as
|
|
16936
|
+
import { join as join11 } from "node:path";
|
|
16858
16937
|
function isEnoent(error) {
|
|
16859
16938
|
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
16860
16939
|
}
|
|
@@ -16867,7 +16946,7 @@ function ticketFromRecord(record4) {
|
|
|
16867
16946
|
}
|
|
16868
16947
|
async function readPageTicketNumber(runDirectory, page) {
|
|
16869
16948
|
try {
|
|
16870
|
-
const raw = JSON.parse(await readFile4(
|
|
16949
|
+
const raw = JSON.parse(await readFile4(join11(runDirectory, page), "utf8"));
|
|
16871
16950
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
16872
16951
|
return void 0;
|
|
16873
16952
|
}
|
|
@@ -17763,9 +17842,9 @@ var init_uuidv7 = __esm({
|
|
|
17763
17842
|
|
|
17764
17843
|
// src/typed-provider-http.ts
|
|
17765
17844
|
import { readFile as readFile7, unlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
17766
|
-
import { join as
|
|
17845
|
+
import { join as join12 } from "node:path";
|
|
17767
17846
|
function typedProviderHttpPath(runDirectory) {
|
|
17768
|
-
return
|
|
17847
|
+
return join12(runDirectory, TYPED_HTTP_FILE);
|
|
17769
17848
|
}
|
|
17770
17849
|
async function clearTypedProviderHttpObservation(runDirectory) {
|
|
17771
17850
|
try {
|
|
@@ -17810,7 +17889,7 @@ var init_typed_provider_http = __esm({
|
|
|
17810
17889
|
|
|
17811
17890
|
// src/public-cli/run-lifecycle.ts
|
|
17812
17891
|
import { chmod, open, readdir as readdir2, readFile as readFile8, unlink as unlink2, writeFile as writeFile3 } from "node:fs/promises";
|
|
17813
|
-
import { isAbsolute as isAbsolute4, join as
|
|
17892
|
+
import { isAbsolute as isAbsolute4, join as join13 } from "node:path";
|
|
17814
17893
|
function resumeRereadInstruction(materialPath, handbook) {
|
|
17815
17894
|
return handbook ? `\u91CD\u65B0\u8BFB ${materialPath}\uFF0C\u518D\u7EC4\u88C5\u5916\u5305 argv` : `\u91CD\u65B0\u8BFB ${materialPath}`;
|
|
17816
17895
|
}
|
|
@@ -17858,7 +17937,7 @@ function renderResumeCommand(runId) {
|
|
|
17858
17937
|
async function writeRoleRunState(runDirectory, record4) {
|
|
17859
17938
|
const payload = { ...record4, runDirectory };
|
|
17860
17939
|
await writeFile3(
|
|
17861
|
-
|
|
17940
|
+
join13(runDirectory, RUN_STATE_FILE),
|
|
17862
17941
|
`${JSON.stringify(payload, null, 2)}
|
|
17863
17942
|
`,
|
|
17864
17943
|
"utf8"
|
|
@@ -17908,7 +17987,7 @@ function parseCurrentCourtState(raw) {
|
|
|
17908
17987
|
async function readRoleRunStateDisk(runDirectory) {
|
|
17909
17988
|
let raw;
|
|
17910
17989
|
try {
|
|
17911
|
-
raw = JSON.parse(await readFile8(
|
|
17990
|
+
raw = JSON.parse(await readFile8(join13(runDirectory, RUN_STATE_FILE), "utf8"));
|
|
17912
17991
|
} catch {
|
|
17913
17992
|
return void 0;
|
|
17914
17993
|
}
|
|
@@ -17975,7 +18054,7 @@ async function writeRoleRunStateDisk(runDirectory, disk) {
|
|
|
17975
18054
|
...disk.currentCourt === void 0 ? {} : { currentCourt: disk.currentCourt }
|
|
17976
18055
|
};
|
|
17977
18056
|
await writeFile3(
|
|
17978
|
-
|
|
18057
|
+
join13(runDirectory, RUN_STATE_FILE),
|
|
17979
18058
|
`${JSON.stringify(payload, null, 2)}
|
|
17980
18059
|
`,
|
|
17981
18060
|
"utf8"
|
|
@@ -18219,15 +18298,15 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
|
|
|
18219
18298
|
};
|
|
18220
18299
|
const reportCleanupFailure = (error) => {
|
|
18221
18300
|
reportDiagnostic(
|
|
18222
|
-
`writer lease lock cleanup failed (release is best-effort; residual lock left in place) at ${
|
|
18301
|
+
`writer lease lock cleanup failed (release is best-effort; residual lock left in place) at ${join13(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
|
|
18223
18302
|
);
|
|
18224
18303
|
};
|
|
18225
18304
|
const reportReadFailure = (error) => {
|
|
18226
18305
|
reportDiagnostic(
|
|
18227
|
-
`writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${
|
|
18306
|
+
`writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${join13(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
|
|
18228
18307
|
);
|
|
18229
18308
|
};
|
|
18230
|
-
const lockPath =
|
|
18309
|
+
const lockPath = join13(runDirectory, WRITER_LOCK_FILE);
|
|
18231
18310
|
let lastAutopsy = { verdict: "absent" };
|
|
18232
18311
|
let lastReclaimFailure;
|
|
18233
18312
|
for (let reclaimsLeft = WRITER_LEASE_RECLAIM_ROUNDS; ; reclaimsLeft -= 1) {
|
|
@@ -18277,7 +18356,7 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
|
|
|
18277
18356
|
async function findRunDirectoryById(home, runId) {
|
|
18278
18357
|
if (runId.trim() === "") return void 0;
|
|
18279
18358
|
const ledgerHome = resolveActivationLedgerHome(home);
|
|
18280
|
-
const booksRoot =
|
|
18359
|
+
const booksRoot = join13(ledgerHome, "books");
|
|
18281
18360
|
let bookKeys;
|
|
18282
18361
|
try {
|
|
18283
18362
|
bookKeys = await readdir2(booksRoot);
|
|
@@ -18285,7 +18364,7 @@ async function findRunDirectoryById(home, runId) {
|
|
|
18285
18364
|
return void 0;
|
|
18286
18365
|
}
|
|
18287
18366
|
for (const bookKey of bookKeys) {
|
|
18288
|
-
const runsDir =
|
|
18367
|
+
const runsDir = join13(activationBookDirectory(ledgerHome, bookKey), "runs");
|
|
18289
18368
|
let entries;
|
|
18290
18369
|
try {
|
|
18291
18370
|
entries = await readdir2(runsDir);
|
|
@@ -18294,7 +18373,7 @@ async function findRunDirectoryById(home, runId) {
|
|
|
18294
18373
|
}
|
|
18295
18374
|
for (const entry of entries) {
|
|
18296
18375
|
if (entry === `${runId}@judge` || entry.startsWith(`${runId}@`)) {
|
|
18297
|
-
return
|
|
18376
|
+
return join13(runsDir, entry);
|
|
18298
18377
|
}
|
|
18299
18378
|
}
|
|
18300
18379
|
}
|
|
@@ -18309,7 +18388,7 @@ async function readRunParentPath(runDirectory) {
|
|
|
18309
18388
|
let raw;
|
|
18310
18389
|
try {
|
|
18311
18390
|
raw = JSON.parse(
|
|
18312
|
-
await readFile8(
|
|
18391
|
+
await readFile8(join13(runDirectory, "admitted-request.json"), "utf8")
|
|
18313
18392
|
);
|
|
18314
18393
|
} catch (error) {
|
|
18315
18394
|
if (errorCodeOf2(error) === "ENOENT") return void 0;
|
|
@@ -18329,7 +18408,7 @@ async function readRunParentPath(runDirectory) {
|
|
|
18329
18408
|
}
|
|
18330
18409
|
async function findLatestRunIdForSeatTicket(input) {
|
|
18331
18410
|
const ledgerHome = resolveActivationLedgerHome(input.home);
|
|
18332
|
-
const runsDir =
|
|
18411
|
+
const runsDir = join13(
|
|
18333
18412
|
activationBookDirectory(ledgerHome, input.bookKey),
|
|
18334
18413
|
"runs"
|
|
18335
18414
|
);
|
|
@@ -18346,7 +18425,7 @@ async function findLatestRunIdForSeatTicket(input) {
|
|
|
18346
18425
|
if (!entry.endsWith(suffix)) continue;
|
|
18347
18426
|
const runId = entry.slice(0, entry.length - suffix.length);
|
|
18348
18427
|
if (runId.length === 0) continue;
|
|
18349
|
-
const runDirectory =
|
|
18428
|
+
const runDirectory = join13(runsDir, entry);
|
|
18350
18429
|
if (input.parentRunPath !== void 0) {
|
|
18351
18430
|
const parentPath = await readRunParentPath(runDirectory);
|
|
18352
18431
|
if (parentPath !== input.parentRunPath) continue;
|
|
@@ -18531,7 +18610,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
18531
18610
|
let model;
|
|
18532
18611
|
try {
|
|
18533
18612
|
const invocationRaw = JSON.parse(
|
|
18534
|
-
await readFile8(
|
|
18613
|
+
await readFile8(join13(run.runDirectory, "invocation.json"), "utf8")
|
|
18535
18614
|
);
|
|
18536
18615
|
if (invocationRaw !== null && typeof invocationRaw === "object" && !Array.isArray(invocationRaw)) {
|
|
18537
18616
|
const rec = invocationRaw;
|
|
@@ -18939,7 +19018,7 @@ __export(notary_source_run_exports, {
|
|
|
18939
19018
|
loadNotarySourceRunLocator: () => loadNotarySourceRunLocator,
|
|
18940
19019
|
resolveNotarySourceRunLocator: () => resolveNotarySourceRunLocator
|
|
18941
19020
|
});
|
|
18942
|
-
import { dirname as dirname7, isAbsolute as isAbsolute5, join as
|
|
19021
|
+
import { dirname as dirname7, isAbsolute as isAbsolute5, join as join14, resolve as resolve6, basename as basename4 } from "node:path";
|
|
18943
19022
|
import { lstat as lstat2, realpath as realpath3 } from "node:fs/promises";
|
|
18944
19023
|
function parseRunDirectoryName(name) {
|
|
18945
19024
|
const match = RUN_DIR_NAME.exec(name);
|
|
@@ -18985,11 +19064,11 @@ async function resolveNotarySourceRunLocator(options) {
|
|
|
18985
19064
|
}
|
|
18986
19065
|
const ledgerHome = resolveActivationLedgerHome(options.home);
|
|
18987
19066
|
const bookKey = resolveBookKeyFromGit(options.projectRoot);
|
|
18988
|
-
const bookRunsRoot =
|
|
19067
|
+
const bookRunsRoot = join14(activationBookDirectory(ledgerHome, bookKey), "runs");
|
|
18989
19068
|
let candidate;
|
|
18990
19069
|
const bare = parseRunDirectoryName(raw);
|
|
18991
19070
|
if (bare !== void 0 && !raw.includes("/") && !raw.includes("\\")) {
|
|
18992
|
-
candidate =
|
|
19071
|
+
candidate = join14(bookRunsRoot, `${bare.runId}@${bare.role}`);
|
|
18993
19072
|
} else {
|
|
18994
19073
|
candidate = isAbsolute5(raw) ? raw : resolve6(options.projectRoot, raw);
|
|
18995
19074
|
}
|
|
@@ -19662,8 +19741,8 @@ var init_option_definitions = __esm({
|
|
|
19662
19741
|
repeatable: false,
|
|
19663
19742
|
form: "option",
|
|
19664
19743
|
description: {
|
|
19665
|
-
en: "Optional request manifest JSON path ({requests:[{id,body}]}).",
|
|
19666
|
-
zh: "\u53EF\u9009 request manifest JSON \u8DEF\u5F84\uFF08{requests:[{id,body}]}\uFF09\u3002"
|
|
19744
|
+
en: "Optional request manifest JSON path ({requests:[{id,body}]}). Role may also decide request bodies from handbook/field activity without this file.",
|
|
19745
|
+
zh: "\u53EF\u9009 request manifest JSON \u8DEF\u5F84\uFF08{requests:[{id,body}]}\uFF09\u3002\u89D2\u8272\u4EA6\u53EF\u4F9D\u624B\u518C/\u73B0\u573A\u81EA\u884C\u5224\u5B9A\u8BF7\u6C42\u6B63\u6587\uFF0C\u4E0D\u5FC5\u4F9D\u8D56\u672C\u6587\u4EF6\u3002"
|
|
19667
19746
|
}
|
|
19668
19747
|
}
|
|
19669
19748
|
];
|
|
@@ -20115,11 +20194,11 @@ import {
|
|
|
20115
20194
|
realpath as realpath4,
|
|
20116
20195
|
writeFile as writeFile4
|
|
20117
20196
|
} from "node:fs/promises";
|
|
20118
|
-
import { basename as basename5, isAbsolute as isAbsolute6, join as
|
|
20197
|
+
import { basename as basename5, isAbsolute as isAbsolute6, join as join15, resolve as resolve7, sep as sep3 } from "node:path";
|
|
20119
20198
|
function issueAdmissionPlacement(authority, request) {
|
|
20120
20199
|
const principal = authority.issue(request);
|
|
20121
20200
|
const { sessionDirectory, sessionFile } = authority.decode(principal);
|
|
20122
|
-
const runDirectory =
|
|
20201
|
+
const runDirectory = join15(sessionDirectory, "..");
|
|
20123
20202
|
const ledgerHome = resolveActivationLedgerHome(request.home);
|
|
20124
20203
|
const bookKey = resolveBookKeyFromGit(request.cwd);
|
|
20125
20204
|
return {
|
|
@@ -20167,14 +20246,14 @@ async function writeRoleInvocationLedger(source, role, effectiveModel) {
|
|
|
20167
20246
|
...effectiveModelLedgerFields(effectiveModel)
|
|
20168
20247
|
};
|
|
20169
20248
|
await writeFile4(
|
|
20170
|
-
|
|
20249
|
+
join15(source.runDirectory, "invocation.json"),
|
|
20171
20250
|
`${JSON.stringify(identity, null, 2)}
|
|
20172
20251
|
`,
|
|
20173
20252
|
"utf8"
|
|
20174
20253
|
);
|
|
20175
20254
|
}
|
|
20176
20255
|
async function recordEffectiveInvocationModel(runDirectory, model, engine, host) {
|
|
20177
|
-
const ledgerPath =
|
|
20256
|
+
const ledgerPath = join15(runDirectory, "invocation.json");
|
|
20178
20257
|
const current = JSON.parse(await readFile9(ledgerPath, "utf8"));
|
|
20179
20258
|
const next = { ...current };
|
|
20180
20259
|
if (model !== void 0) {
|
|
@@ -20202,7 +20281,7 @@ async function recordEffectiveInvocationModel(runDirectory, model, engine, host)
|
|
|
20202
20281
|
);
|
|
20203
20282
|
}
|
|
20204
20283
|
async function mergeInvocationIdentityPage(runDirectory, fields) {
|
|
20205
|
-
const ledgerPath =
|
|
20284
|
+
const ledgerPath = join15(runDirectory, "invocation.json");
|
|
20206
20285
|
const current = JSON.parse(await readFile9(ledgerPath, "utf8"));
|
|
20207
20286
|
await writeFile4(
|
|
20208
20287
|
ledgerPath,
|
|
@@ -20263,7 +20342,7 @@ async function recordLaunchedPiIdentity(runDirectory, identity) {
|
|
|
20263
20342
|
async function observeLaunchedRolePackageIdentity(packageRoot2, selectedRoleEntry) {
|
|
20264
20343
|
const rolePackageRoot = packageRoot2;
|
|
20265
20344
|
const raw = JSON.parse(
|
|
20266
|
-
await readFile9(
|
|
20345
|
+
await readFile9(join15(rolePackageRoot, "package.json"), "utf8")
|
|
20267
20346
|
);
|
|
20268
20347
|
if (typeof raw.version !== "string" || raw.version.trim() === "") {
|
|
20269
20348
|
throw new Error(
|
|
@@ -20510,7 +20589,7 @@ async function freezeRegularFileAttachment(sourcePath, destinationDir, index) {
|
|
|
20510
20589
|
}
|
|
20511
20590
|
const bytes = await readFile9(absolute);
|
|
20512
20591
|
const name = `${String(index).padStart(2, "0")}-${basename5(absolute)}`;
|
|
20513
|
-
const frozenPath =
|
|
20592
|
+
const frozenPath = join15(destinationDir, name);
|
|
20514
20593
|
await writeFile4(frozenPath, bytes);
|
|
20515
20594
|
return {
|
|
20516
20595
|
attachment: {
|
|
@@ -20538,7 +20617,7 @@ async function freezeAttachments(attachmentPaths, attachmentsDirectory) {
|
|
|
20538
20617
|
async function freezeAttachmentsIntoRun(attachmentPaths, runDirectory, summonsKey = `s-${Date.now().toString(36)}`) {
|
|
20539
20618
|
if (attachmentPaths.length === 0) return [];
|
|
20540
20619
|
const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(runDirectory));
|
|
20541
|
-
const attachmentsDirectory =
|
|
20620
|
+
const attachmentsDirectory = join15(runDirectory, "attachments", summonsKey);
|
|
20542
20621
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
20543
20622
|
return freezeAttachments(attachmentPaths, attachmentsDirectory);
|
|
20544
20623
|
}
|
|
@@ -20564,7 +20643,7 @@ async function admitStandardMaterialInvocation(role, options) {
|
|
|
20564
20643
|
role,
|
|
20565
20644
|
home: options.home
|
|
20566
20645
|
});
|
|
20567
|
-
const attachmentsDirectory =
|
|
20646
|
+
const attachmentsDirectory = join15(runDirectory, "attachments");
|
|
20568
20647
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
20569
20648
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
20570
20649
|
const attachments = await freezeAttachments(options.attachmentPaths, attachmentsDirectory);
|
|
@@ -20589,7 +20668,7 @@ async function admitStandardMaterialInvocation(role, options) {
|
|
|
20589
20668
|
mediaKind: a.mediaKind
|
|
20590
20669
|
}))
|
|
20591
20670
|
};
|
|
20592
|
-
const admittedRequestPath =
|
|
20671
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
20593
20672
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
20594
20673
|
sessionDirectory,
|
|
20595
20674
|
sessionFile
|
|
@@ -20667,7 +20746,7 @@ async function admitCountersignInvocation(options) {
|
|
|
20667
20746
|
role: "countersign",
|
|
20668
20747
|
home: options.home
|
|
20669
20748
|
});
|
|
20670
|
-
const attachmentsDirectory =
|
|
20749
|
+
const attachmentsDirectory = join15(runDirectory, "attachments");
|
|
20671
20750
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
20672
20751
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
20673
20752
|
const attachments = await freezeAttachments(options.attachmentPaths, attachmentsDirectory);
|
|
@@ -20691,7 +20770,7 @@ async function admitCountersignInvocation(options) {
|
|
|
20691
20770
|
mediaKind: a.mediaKind
|
|
20692
20771
|
}))
|
|
20693
20772
|
};
|
|
20694
|
-
const admittedRequestPath =
|
|
20773
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
20695
20774
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
20696
20775
|
sessionDirectory,
|
|
20697
20776
|
sessionFile
|
|
@@ -20715,7 +20794,7 @@ function buildCountersignTransportPrompt(admitted, engineMaterial) {
|
|
|
20715
20794
|
return buildInstructionTransportPrompt(admitted, engineMaterial);
|
|
20716
20795
|
}
|
|
20717
20796
|
async function ensureRunArtifactsDir(runDirectory) {
|
|
20718
|
-
const dir =
|
|
20797
|
+
const dir = join15(runDirectory, "artifacts");
|
|
20719
20798
|
await mkdir2(dir, { recursive: true });
|
|
20720
20799
|
return dir;
|
|
20721
20800
|
}
|
|
@@ -20747,11 +20826,11 @@ async function admitCoderInvocation(options) {
|
|
|
20747
20826
|
role: "coder",
|
|
20748
20827
|
home: options.home
|
|
20749
20828
|
});
|
|
20750
|
-
const attachmentsDirectory =
|
|
20829
|
+
const attachmentsDirectory = join15(runDirectory, "attachments");
|
|
20751
20830
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
20752
20831
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
20753
20832
|
const attachments = await freezeAttachments(options.attachmentPaths, attachmentsDirectory);
|
|
20754
|
-
const taskPath =
|
|
20833
|
+
const taskPath = join15(runDirectory, "task.md");
|
|
20755
20834
|
await writeFile4(taskPath, instruction, "utf8");
|
|
20756
20835
|
const admitted = {
|
|
20757
20836
|
role: "coder",
|
|
@@ -20772,7 +20851,7 @@ async function admitCoderInvocation(options) {
|
|
|
20772
20851
|
mediaKind: a.mediaKind
|
|
20773
20852
|
}))
|
|
20774
20853
|
};
|
|
20775
|
-
const admittedRequestPath =
|
|
20854
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
20776
20855
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
20777
20856
|
sessionDirectory,
|
|
20778
20857
|
sessionFile
|
|
@@ -20853,13 +20932,13 @@ async function admitFixerInvocation(options) {
|
|
|
20853
20932
|
role: "fixer",
|
|
20854
20933
|
home: options.home
|
|
20855
20934
|
});
|
|
20856
|
-
const attachmentsDirectory =
|
|
20935
|
+
const attachmentsDirectory = join15(runDirectory, "attachments");
|
|
20857
20936
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
20858
20937
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
20859
20938
|
const attachments = await freezeAttachments(options.attachmentPaths, attachmentsDirectory);
|
|
20860
20939
|
let prerequisitesPath;
|
|
20861
20940
|
if (prerequisitesSource !== void 0) {
|
|
20862
|
-
prerequisitesPath =
|
|
20941
|
+
prerequisitesPath = join15(runDirectory, "prerequisites.json");
|
|
20863
20942
|
await writeFile4(
|
|
20864
20943
|
prerequisitesPath,
|
|
20865
20944
|
`${JSON.stringify(prerequisites, null, 2)}
|
|
@@ -20867,7 +20946,7 @@ async function admitFixerInvocation(options) {
|
|
|
20867
20946
|
"utf8"
|
|
20868
20947
|
);
|
|
20869
20948
|
}
|
|
20870
|
-
const packetPath =
|
|
20949
|
+
const packetPath = join15(runDirectory, "fix-packet.md");
|
|
20871
20950
|
await writeFile4(packetPath, instruction, "utf8");
|
|
20872
20951
|
const admitted = {
|
|
20873
20952
|
role: "fixer",
|
|
@@ -20893,7 +20972,7 @@ async function admitFixerInvocation(options) {
|
|
|
20893
20972
|
mediaKind: a.mediaKind
|
|
20894
20973
|
}))
|
|
20895
20974
|
};
|
|
20896
|
-
const admittedRequestPath =
|
|
20975
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
20897
20976
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
20898
20977
|
sessionDirectory,
|
|
20899
20978
|
sessionFile
|
|
@@ -21087,7 +21166,7 @@ async function admitCollectorInvocation(options) {
|
|
|
21087
21166
|
role: "collector",
|
|
21088
21167
|
home: options.home
|
|
21089
21168
|
});
|
|
21090
|
-
const attachmentsDirectory =
|
|
21169
|
+
const attachmentsDirectory = join15(runDirectory, "attachments");
|
|
21091
21170
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
21092
21171
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
21093
21172
|
const attachments = await freezeAttachments(options.attachmentPaths ?? [], attachmentsDirectory);
|
|
@@ -21101,7 +21180,7 @@ async function admitCollectorInvocation(options) {
|
|
|
21101
21180
|
const prNumber = target.kind === "bound" ? target.prNumber : void 0;
|
|
21102
21181
|
let requestManifestPath;
|
|
21103
21182
|
if (manifestCanonicalJson !== void 0) {
|
|
21104
|
-
requestManifestPath =
|
|
21183
|
+
requestManifestPath = join15(runDirectory, "request-manifest.json");
|
|
21105
21184
|
await writeFile4(requestManifestPath, manifestCanonicalJson, "utf8");
|
|
21106
21185
|
}
|
|
21107
21186
|
const admitted = {
|
|
@@ -21126,7 +21205,7 @@ async function admitCollectorInvocation(options) {
|
|
|
21126
21205
|
mediaKind: a.mediaKind
|
|
21127
21206
|
}))
|
|
21128
21207
|
};
|
|
21129
|
-
const admittedRequestPath =
|
|
21208
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
21130
21209
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
21131
21210
|
sessionDirectory,
|
|
21132
21211
|
sessionFile
|
|
@@ -21223,7 +21302,7 @@ function parseDoctorArgv(args) {
|
|
|
21223
21302
|
}
|
|
21224
21303
|
async function resolveDoctorCaseRunsPath(options) {
|
|
21225
21304
|
const ledgerHome = resolveActivationLedgerHome(options.home);
|
|
21226
|
-
const defaultRuns =
|
|
21305
|
+
const defaultRuns = join15(
|
|
21227
21306
|
activationBookDirectory(ledgerHome, options.bookKey),
|
|
21228
21307
|
"issues",
|
|
21229
21308
|
String(options.issueNumber),
|
|
@@ -21330,7 +21409,7 @@ async function admitDoctorInvocation(options) {
|
|
|
21330
21409
|
{ cause: error }
|
|
21331
21410
|
);
|
|
21332
21411
|
}
|
|
21333
|
-
const attachmentsDirectory =
|
|
21412
|
+
const attachmentsDirectory = join15(runDirectory, "attachments");
|
|
21334
21413
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
21335
21414
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
21336
21415
|
const attachments = await freezeAttachments(options.attachmentPaths ?? [], attachmentsDirectory);
|
|
@@ -21356,7 +21435,7 @@ async function admitDoctorInvocation(options) {
|
|
|
21356
21435
|
mediaKind: a.mediaKind
|
|
21357
21436
|
}))
|
|
21358
21437
|
};
|
|
21359
|
-
const admittedRequestPath =
|
|
21438
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
21360
21439
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
21361
21440
|
sessionDirectory,
|
|
21362
21441
|
sessionFile
|
|
@@ -21488,7 +21567,7 @@ async function admitNotaryInvocation(options) {
|
|
|
21488
21567
|
...ticketFields,
|
|
21489
21568
|
...options.correlationId === void 0 ? {} : { correlationId: options.correlationId }
|
|
21490
21569
|
};
|
|
21491
|
-
const admittedRequestPath =
|
|
21570
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
21492
21571
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
21493
21572
|
sessionDirectory,
|
|
21494
21573
|
sessionFile
|
|
@@ -21590,7 +21669,7 @@ async function admitGleanerLeftInvocation(options) {
|
|
|
21590
21669
|
attachments: [],
|
|
21591
21670
|
...options.correlationId === void 0 ? {} : { correlationId: options.correlationId }
|
|
21592
21671
|
};
|
|
21593
|
-
const admittedRequestPath =
|
|
21672
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
21594
21673
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
21595
21674
|
sessionDirectory,
|
|
21596
21675
|
sessionFile
|
|
@@ -21695,7 +21774,7 @@ async function admitReviewerInvocation(options) {
|
|
|
21695
21774
|
role: "reviewer",
|
|
21696
21775
|
home: options.home
|
|
21697
21776
|
});
|
|
21698
|
-
const attachmentsDirectory =
|
|
21777
|
+
const attachmentsDirectory = join15(runDirectory, "attachments");
|
|
21699
21778
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
21700
21779
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
21701
21780
|
const attachments = await freezeAttachments(options.attachmentPaths, attachmentsDirectory);
|
|
@@ -21720,7 +21799,7 @@ async function admitReviewerInvocation(options) {
|
|
|
21720
21799
|
mediaKind: a.mediaKind
|
|
21721
21800
|
}))
|
|
21722
21801
|
};
|
|
21723
|
-
const admittedRequestPath =
|
|
21802
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
21724
21803
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
21725
21804
|
sessionDirectory,
|
|
21726
21805
|
sessionFile
|
|
@@ -21847,7 +21926,7 @@ async function admitMergerInvocation(options) {
|
|
|
21847
21926
|
role: "merger",
|
|
21848
21927
|
home: options.home
|
|
21849
21928
|
});
|
|
21850
|
-
const attachmentsDirectory =
|
|
21929
|
+
const attachmentsDirectory = join15(runDirectory, "attachments");
|
|
21851
21930
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
21852
21931
|
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
21853
21932
|
const attachments = await freezeAttachments(options.attachmentPaths, attachmentsDirectory);
|
|
@@ -21875,7 +21954,7 @@ async function admitMergerInvocation(options) {
|
|
|
21875
21954
|
// Authorized checks remain available on the assignment; default none.
|
|
21876
21955
|
authorizedChecks: []
|
|
21877
21956
|
});
|
|
21878
|
-
const mergerInputPath =
|
|
21957
|
+
const mergerInputPath = join15(runDirectory, "merger-input.json");
|
|
21879
21958
|
await writeFile4(
|
|
21880
21959
|
mergerInputPath,
|
|
21881
21960
|
`${JSON.stringify(mergerInput, null, 2)}
|
|
@@ -21907,7 +21986,7 @@ async function admitMergerInvocation(options) {
|
|
|
21907
21986
|
mediaKind: a.mediaKind
|
|
21908
21987
|
}))
|
|
21909
21988
|
};
|
|
21910
|
-
const admittedRequestPath =
|
|
21989
|
+
const admittedRequestPath = join15(runDirectory, "admitted-request.json");
|
|
21911
21990
|
await writeAdmittedRequestPersistence(admittedRequestPath, admitted, {
|
|
21912
21991
|
sessionDirectory,
|
|
21913
21992
|
sessionFile
|
|
@@ -22200,7 +22279,7 @@ var init_invocation = __esm({
|
|
|
22200
22279
|
// src/package-resources/method-skill.ts
|
|
22201
22280
|
import { createHash as createHash4 } from "node:crypto";
|
|
22202
22281
|
import { readFile as readFile10, realpath as realpath5 } from "node:fs/promises";
|
|
22203
|
-
import { join as
|
|
22282
|
+
import { join as join16 } from "node:path";
|
|
22204
22283
|
function gitBlobOid(bytes) {
|
|
22205
22284
|
const body = typeof bytes === "string" ? Buffer.from(bytes, "utf8") : Buffer.from(bytes);
|
|
22206
22285
|
const header = Buffer.from(`blob ${body.byteLength}\0`, "utf8");
|
|
@@ -22217,10 +22296,10 @@ function packagedMethodSkillRelativeDirectory(name) {
|
|
|
22217
22296
|
return `${METHOD_SKILL_RELATIVE_ROOT}/${name}`;
|
|
22218
22297
|
}
|
|
22219
22298
|
function resolvePackagedMethodSkillRoot(packageRoot2, name) {
|
|
22220
|
-
return
|
|
22299
|
+
return join16(packageRoot2, packagedMethodSkillRelativeDirectory(name));
|
|
22221
22300
|
}
|
|
22222
22301
|
function resolvePackagedMethodSkillPath(packageRoot2, name) {
|
|
22223
|
-
return
|
|
22302
|
+
return join16(resolvePackagedMethodSkillRoot(packageRoot2, name), "SKILL.md");
|
|
22224
22303
|
}
|
|
22225
22304
|
function isRecord10(value) {
|
|
22226
22305
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -22314,8 +22393,8 @@ function parseProvenance(raw, expectedName) {
|
|
|
22314
22393
|
}
|
|
22315
22394
|
async function loadPackagedMethodSkillMaterial(packageRoot2, name) {
|
|
22316
22395
|
const rootDirectory = resolvePackagedMethodSkillRoot(packageRoot2, name);
|
|
22317
|
-
const skillPathConfigured =
|
|
22318
|
-
const provenancePath =
|
|
22396
|
+
const skillPathConfigured = join16(rootDirectory, "SKILL.md");
|
|
22397
|
+
const provenancePath = join16(rootDirectory, "provenance.json");
|
|
22319
22398
|
let provenanceRaw;
|
|
22320
22399
|
try {
|
|
22321
22400
|
provenanceRaw = await readFile10(provenancePath, "utf8");
|
|
@@ -22332,7 +22411,7 @@ async function loadPackagedMethodSkillMaterial(packageRoot2, name) {
|
|
|
22332
22411
|
}
|
|
22333
22412
|
const provenance = parseProvenance(provenanceJson, name);
|
|
22334
22413
|
for (const [rel, expected] of Object.entries(provenance.files)) {
|
|
22335
|
-
const absolute =
|
|
22414
|
+
const absolute = join16(rootDirectory, rel);
|
|
22336
22415
|
let bytes;
|
|
22337
22416
|
try {
|
|
22338
22417
|
bytes = await readFile10(absolute);
|
|
@@ -22634,7 +22713,7 @@ var init_ledger_session_read = __esm({
|
|
|
22634
22713
|
|
|
22635
22714
|
// src/analyst-gate-cycles-read.ts
|
|
22636
22715
|
import { readdir as readdir3 } from "node:fs/promises";
|
|
22637
|
-
import { join as
|
|
22716
|
+
import { join as join17 } from "node:path";
|
|
22638
22717
|
function isRecord12(value) {
|
|
22639
22718
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22640
22719
|
}
|
|
@@ -22896,7 +22975,7 @@ async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, opti
|
|
|
22896
22975
|
throw error;
|
|
22897
22976
|
}
|
|
22898
22977
|
for (const name of names) {
|
|
22899
|
-
const path =
|
|
22978
|
+
const path = join17(directory, name);
|
|
22900
22979
|
const fromPointer = name.endsWith(".pointer.json");
|
|
22901
22980
|
const sessionPath = fromPointer ? await resolveOfficerSessionFromPointerFile(path) : path;
|
|
22902
22981
|
if (sessionPath === void 0) continue;
|
|
@@ -22939,7 +23018,7 @@ var init_analyst_gate_cycles_read = __esm({
|
|
|
22939
23018
|
|
|
22940
23019
|
// src/run-terminal-artifacts.ts
|
|
22941
23020
|
import { readdir as readdir4, readFile as readFile12 } from "node:fs/promises";
|
|
22942
|
-
import { basename as basename6, dirname as dirname8, join as
|
|
23021
|
+
import { basename as basename6, dirname as dirname8, join as join18 } from "node:path";
|
|
22943
23022
|
function isMissingPathError2(error) {
|
|
22944
23023
|
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
22945
23024
|
}
|
|
@@ -23014,7 +23093,7 @@ async function listUniqueErrorFallbackPaths(directories) {
|
|
|
23014
23093
|
}
|
|
23015
23094
|
for (const name of names.sort((a, b) => a.localeCompare(b))) {
|
|
23016
23095
|
if (!UNIQUE_ERROR_FALLBACK_NAME.test(name)) continue;
|
|
23017
|
-
found.push(
|
|
23096
|
+
found.push(join18(dir, name));
|
|
23018
23097
|
}
|
|
23019
23098
|
}
|
|
23020
23099
|
return found;
|
|
@@ -23030,14 +23109,14 @@ function presentUniqueFallbackBoundToRun(body, expectedRunId) {
|
|
|
23030
23109
|
return typeof body.runId === "string" && body.runId === expectedRunId;
|
|
23031
23110
|
}
|
|
23032
23111
|
async function readRunTerminalArtifact(runDirectory) {
|
|
23033
|
-
const artifactsDir =
|
|
23112
|
+
const artifactsDir = join18(runDirectory, "artifacts");
|
|
23034
23113
|
for (const file of RUN_TERMINAL_ARTIFACT_FILES) {
|
|
23035
|
-
const path =
|
|
23114
|
+
const path = join18(artifactsDir, file);
|
|
23036
23115
|
const read3 = await readTerminalArtifactAtPath(path, file);
|
|
23037
23116
|
if (read3 !== void 0) return read3;
|
|
23038
23117
|
}
|
|
23039
23118
|
for (const relative3 of RUN_TERMINAL_ERROR_FALLBACK_RELATIVE_PATHS) {
|
|
23040
|
-
const path =
|
|
23119
|
+
const path = join18(runDirectory, relative3);
|
|
23041
23120
|
const read3 = await readTerminalArtifactAtPath(path, "error.json");
|
|
23042
23121
|
if (read3 !== void 0) return read3;
|
|
23043
23122
|
}
|
|
@@ -23175,14 +23254,14 @@ var init_submission_ledger = __esm({
|
|
|
23175
23254
|
});
|
|
23176
23255
|
|
|
23177
23256
|
// src/session-opening-materials.ts
|
|
23178
|
-
import { existsSync as
|
|
23257
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
23179
23258
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
23180
|
-
import { dirname as dirname9, join as
|
|
23181
|
-
import { fileURLToPath, pathToFileURL as
|
|
23259
|
+
import { dirname as dirname9, join as join19 } from "node:path";
|
|
23260
|
+
import { fileURLToPath, pathToFileURL as pathToFileURL3 } from "node:url";
|
|
23182
23261
|
function resolvePackageRootDir(moduleUrl = import.meta.url) {
|
|
23183
23262
|
let dir = dirname9(fileURLToPath(moduleUrl));
|
|
23184
23263
|
for (let i = 0; i < 8; i += 1) {
|
|
23185
|
-
if (
|
|
23264
|
+
if (existsSync7(join19(dir, "package.json")) && existsSync7(join19(dir, "souls"))) {
|
|
23186
23265
|
return dir;
|
|
23187
23266
|
}
|
|
23188
23267
|
const parent = dirname9(dir);
|
|
@@ -23206,7 +23285,7 @@ var init_session_opening_materials = __esm({
|
|
|
23206
23285
|
"src/session-opening-materials.ts"() {
|
|
23207
23286
|
"use strict";
|
|
23208
23287
|
init_packaged_role_registry();
|
|
23209
|
-
packageRootUrl =
|
|
23288
|
+
packageRootUrl = pathToFileURL3(resolvePackageRootDir() + "/").href;
|
|
23210
23289
|
MAIN_ROLE_SESSION_MATERIALS = {
|
|
23211
23290
|
...Object.fromEntries(
|
|
23212
23291
|
PUBLIC_ROLE_RECORDS.map((record4) => [record4.role, record4.sessionMaterials])
|
|
@@ -23462,12 +23541,12 @@ var init_reviewer_dispatch = __esm({
|
|
|
23462
23541
|
|
|
23463
23542
|
// src/public-cli/reviewer-dispatch-rejection.ts
|
|
23464
23543
|
import { readFile as readFile14, unlink as unlink3 } from "node:fs/promises";
|
|
23465
|
-
import { join as
|
|
23544
|
+
import { join as join20 } from "node:path";
|
|
23466
23545
|
function isReviewerPreflightViolation(value) {
|
|
23467
23546
|
return typeof value === "string" && REVIEWER_PREFLIGHT_VIOLATIONS.includes(value);
|
|
23468
23547
|
}
|
|
23469
23548
|
function reviewerDispatchRejectionPath(runDirectory) {
|
|
23470
|
-
return
|
|
23549
|
+
return join20(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
|
|
23471
23550
|
}
|
|
23472
23551
|
async function clearReviewerDispatchRejection(runDirectory) {
|
|
23473
23552
|
try {
|
|
@@ -23534,84 +23613,14 @@ var init_collector_identity = __esm({
|
|
|
23534
23613
|
}
|
|
23535
23614
|
});
|
|
23536
23615
|
|
|
23537
|
-
// src/collector-tool-schemas.ts
|
|
23538
|
-
var collectorObserveArgsSchema, collectorRequestArgsSchema, collectorReadArgsSchema, collectorWaitArgsSchema, collectorBindTargetArgsSchema, collectorFindingItemDeclaration, collectorOutputBaseSchema, collectorOutputArgsSchema;
|
|
23539
|
-
var init_collector_tool_schemas = __esm({
|
|
23540
|
-
"src/collector-tool-schemas.ts"() {
|
|
23541
|
-
"use strict";
|
|
23542
|
-
init_build();
|
|
23543
|
-
init_collector_evidence();
|
|
23544
|
-
init_open_tool_schema();
|
|
23545
|
-
init_terminating_infrastructure();
|
|
23546
|
-
collectorObserveArgsSchema = typebox_exports.Object({}, { additionalProperties: false });
|
|
23547
|
-
collectorRequestArgsSchema = typebox_exports.Object({
|
|
23548
|
-
requestId: typebox_exports.String({ minLength: 1, description: "\u914D\u7F6E\u8BF7\u6C42\u8EAB\u4EFD" }),
|
|
23549
|
-
snapshotId: typebox_exports.String({ minLength: 1, description: "\u6700\u65B0\u7559\u5B58\u89C2\u5BDF\u5FEB\u7167" })
|
|
23550
|
-
}, { additionalProperties: false });
|
|
23551
|
-
collectorReadArgsSchema = typebox_exports.Object({
|
|
23552
|
-
evidenceId: typebox_exports.String({ minLength: 1, description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u8BC1\u636E id\uFF08evidenceId\uFF09" })
|
|
23553
|
-
}, { additionalProperties: false });
|
|
23554
|
-
collectorWaitArgsSchema = typebox_exports.Object({
|
|
23555
|
-
durationMs: typebox_exports.Integer({ minimum: 1, maximum: COLLECTOR_ELIGIBILITY_MS, description: "\u7B49\u5F85\u6BEB\u79D2\uFF1B\u5355\u6B21\u4E0A\u9650\u4E94\u5206\u949F\u4E14\u4E0D\u8D85\u5269\u4F59\u8D44\u683C" })
|
|
23556
|
-
}, { additionalProperties: false });
|
|
23557
|
-
collectorBindTargetArgsSchema = typebox_exports.Object({
|
|
23558
|
-
prNumber: typebox_exports.Optional(typebox_exports.Unknown({
|
|
23559
|
-
description: "\u89D2\u8272\u5224\u5B9A\u7684\u672C\u4ED3 PR \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002\u4E0E issueNumber \u4E8C\u9009\u4E00\u6216\u540C\u6307\u552F\u4E00\u76EE\u6807\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
23560
|
-
})),
|
|
23561
|
-
issueNumber: typebox_exports.Optional(typebox_exports.Unknown({
|
|
23562
|
-
description: "\u89D2\u8272\u5224\u5B9A\u7684\u672C\u4ED3 issue \u53F7\uFF08\u6B63\u6574\u6570\uFF09\uFF1Bruntime \u7ECF\u7EBF\u4E0A\u5173\u8054\u89E3\u6790\u552F\u4E00 PR\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
23563
|
-
}))
|
|
23564
|
-
}, { additionalProperties: true });
|
|
23565
|
-
collectorFindingItemDeclaration = (() => {
|
|
23566
|
-
const item = typebox_exports.Object(
|
|
23567
|
-
{
|
|
23568
|
-
evidenceId: typebox_exports.Unknown({
|
|
23569
|
-
description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u6307\u9488\uFF08\u5FC5\u586B\u8BED\u4E49\uFF09"
|
|
23570
|
-
}),
|
|
23571
|
-
category: typebox_exports.Unknown({
|
|
23572
|
-
description: "\u7B80\u77ED\u5F52\u7C7B\u6807\u7B7E\uFF0C\u4E0D\u662F\u6458\u8981"
|
|
23573
|
-
}),
|
|
23574
|
-
summary: typebox_exports.Unknown({
|
|
23575
|
-
description: "\u54EA\u4E2A bot\u3001\u4EC0\u4E48\u95EE\u9898\u7684\u6458\u8981\uFF1B\u4E0D\u8A8A\u6284\u6B63\u6587"
|
|
23576
|
-
})
|
|
23577
|
-
},
|
|
23578
|
-
{
|
|
23579
|
-
additionalProperties: true,
|
|
23580
|
-
description: "\u5355\u6761 finding \u6307\u9488\uFF1AevidenceId + \u53EF\u9009 category/summary\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
23581
|
-
}
|
|
23582
|
-
);
|
|
23583
|
-
item.required = [];
|
|
23584
|
-
return item;
|
|
23585
|
-
})();
|
|
23586
|
-
collectorOutputBaseSchema = openToolObject(
|
|
23587
|
-
typebox_exports.Object({
|
|
23588
|
-
// No root type:array — host must not shape-reject non-array findings (#676 C).
|
|
23589
|
-
// Nested item declarations ride `items` for registration preservation (ADR 0057).
|
|
23590
|
-
findings: typebox_exports.Unsafe({
|
|
23591
|
-
description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings\uFF08\u6307\u9488\u6570\u7EC4\u4E3A\u89C4\u8303\u5F62\uFF09\u3002\u96F6 finding \u7684\u6A21\u677F\u901A\u77E5\u4E0D\u5F97\u8FDB\u5165\uFF1B\u6B63\u5E38\u5B8C\u5DE5\u65E0 finding \u65F6\u7701\u7565\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002",
|
|
23592
|
-
items: collectorFindingItemDeclaration
|
|
23593
|
-
}),
|
|
23594
|
-
unfinishedReasons: typebox_exports.Unknown({
|
|
23595
|
-
description: "\u672A\u5B8C\u6210\u539F\u56E0\u5B57\u7B26\u4E32\u6570\u7EC4\uFF08\u989D\u5EA6/\u6545\u969C/\u7B49\u5F85\u5C4A\u6EE1\u7B49\u73B0\u573A\u4F9D\u636E\uFF09\uFF1B\u4E0D\u5F97\u628A\u672A\u5B8C\u6210\u8868\u8FF0\u4E3A\u65E0\u95EE\u9898\u3002\u65E0\u53EF\u62A5\u544A\u65F6\u7701\u7565\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
23596
|
-
})
|
|
23597
|
-
})
|
|
23598
|
-
);
|
|
23599
|
-
collectorOutputArgsSchema = withInfrastructureFailureDeclaration(
|
|
23600
|
-
collectorOutputBaseSchema
|
|
23601
|
-
);
|
|
23602
|
-
}
|
|
23603
|
-
});
|
|
23604
|
-
|
|
23605
23616
|
// src/collector-ledger.ts
|
|
23606
23617
|
var COLLECTOR_OBSERVE_TOOL, COLLECTOR_READ_TOOL, COLLECTOR_REQUEST_TOOL, COLLECTOR_WAIT_TOOL, COLLECTOR_BIND_TARGET_TOOL;
|
|
23607
23618
|
var init_collector_ledger = __esm({
|
|
23608
23619
|
"src/collector-ledger.ts"() {
|
|
23609
23620
|
"use strict";
|
|
23610
|
-
init_value2();
|
|
23611
23621
|
init_collector_evidence();
|
|
23612
23622
|
init_collector_github();
|
|
23613
23623
|
init_collector_identity();
|
|
23614
|
-
init_collector_tool_schemas();
|
|
23615
23624
|
init_collector_output();
|
|
23616
23625
|
COLLECTOR_OBSERVE_TOOL = "ak_collector_observe";
|
|
23617
23626
|
COLLECTOR_READ_TOOL = "ak_collector_read";
|
|
@@ -23919,7 +23928,7 @@ var init_terminal = __esm({
|
|
|
23919
23928
|
// src/public-cli/settlement.ts
|
|
23920
23929
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
23921
23930
|
import { appendFile as appendFile2, readFile as readFile15, readdir as readdir5, writeFile as writeFile5 } from "node:fs/promises";
|
|
23922
|
-
import { dirname as dirname10, join as
|
|
23931
|
+
import { dirname as dirname10, join as join21 } from "node:path";
|
|
23923
23932
|
function sealedLedgerHome(admitted) {
|
|
23924
23933
|
return homeFromRunDirectory(admitted.runDirectory);
|
|
23925
23934
|
}
|
|
@@ -24339,7 +24348,7 @@ async function readSessionProviderStop(sessionFile) {
|
|
|
24339
24348
|
}
|
|
24340
24349
|
}
|
|
24341
24350
|
async function readBoundEvidenceChildKnownFailure(sessionFile) {
|
|
24342
|
-
const childDirectory =
|
|
24351
|
+
const childDirectory = join21(dirname10(sessionFile), "evidence-children");
|
|
24343
24352
|
let names;
|
|
24344
24353
|
try {
|
|
24345
24354
|
names = await readdir5(childDirectory);
|
|
@@ -24350,7 +24359,7 @@ async function readBoundEvidenceChildKnownFailure(sessionFile) {
|
|
|
24350
24359
|
for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
|
|
24351
24360
|
let entries;
|
|
24352
24361
|
try {
|
|
24353
|
-
entries = await readBoundSessionEntries(
|
|
24362
|
+
entries = await readBoundSessionEntries(join21(childDirectory, file));
|
|
24354
24363
|
} catch (error) {
|
|
24355
24364
|
throw sessionReadFailure(error, "failed to read discovered evidence-child session");
|
|
24356
24365
|
}
|
|
@@ -24404,7 +24413,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
24404
24413
|
latestParentUserIndex = i;
|
|
24405
24414
|
break;
|
|
24406
24415
|
}
|
|
24407
|
-
const childDirectories = [
|
|
24416
|
+
const childDirectories = [join21(dirname10(sessionFile), "auditor-roles")];
|
|
24408
24417
|
const valid = [];
|
|
24409
24418
|
let sawAnyDirectory = false;
|
|
24410
24419
|
for (const childDirectory of childDirectories) {
|
|
@@ -24419,7 +24428,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
|
|
|
24419
24428
|
for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
|
|
24420
24429
|
let entries;
|
|
24421
24430
|
try {
|
|
24422
|
-
entries = await readBoundSessionEntries(
|
|
24431
|
+
entries = await readBoundSessionEntries(join21(childDirectory, file));
|
|
24423
24432
|
} catch (error) {
|
|
24424
24433
|
throw sessionReadFailure(error, "failed to read discovered auditor session");
|
|
24425
24434
|
}
|
|
@@ -24967,8 +24976,8 @@ function projectTerminalGateFact(rounds) {
|
|
|
24967
24976
|
};
|
|
24968
24977
|
}
|
|
24969
24978
|
async function extractGateFactFromSessionDirectory(sessionDirectory, options = {}) {
|
|
24970
|
-
const directories = [
|
|
24971
|
-
const parentSessionFile = options.parentSessionFile ??
|
|
24979
|
+
const directories = [join21(sessionDirectory, "auditor-roles")];
|
|
24980
|
+
const parentSessionFile = options.parentSessionFile ?? join21(sessionDirectory, "session.jsonl");
|
|
24972
24981
|
const rounds = await readAnalystGateCyclesFromAuditorRoles(directories, {
|
|
24973
24982
|
parentSessionFile
|
|
24974
24983
|
});
|
|
@@ -25066,8 +25075,8 @@ async function extractNavigatorFactFromAdmittedSession(sessionFile) {
|
|
|
25066
25075
|
async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
|
|
25067
25076
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25068
25077
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25069
|
-
const reportPath =
|
|
25070
|
-
const evidencePath =
|
|
25078
|
+
const reportPath = join21(artifactsDir, "report.json");
|
|
25079
|
+
const evidencePath = join21(artifactsDir, "evidence.json");
|
|
25071
25080
|
await writeFile5(
|
|
25072
25081
|
reportPath,
|
|
25073
25082
|
`${JSON.stringify(
|
|
@@ -25111,8 +25120,8 @@ async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
|
|
|
25111
25120
|
async function publishCoderArtifacts(admitted, roleOutcome, coordinates, options = {}) {
|
|
25112
25121
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25113
25122
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25114
|
-
const reportPath =
|
|
25115
|
-
const evidencePath =
|
|
25123
|
+
const reportPath = join21(artifactsDir, "report.json");
|
|
25124
|
+
const evidencePath = join21(artifactsDir, "evidence.json");
|
|
25116
25125
|
await writeFile5(
|
|
25117
25126
|
reportPath,
|
|
25118
25127
|
`${JSON.stringify(
|
|
@@ -25263,8 +25272,8 @@ function extractFixerMethodInvocations(entries, options) {
|
|
|
25263
25272
|
async function publishFixerArtifacts(admitted, roleOutcome, coordinates, options) {
|
|
25264
25273
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25265
25274
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25266
|
-
const reportPath =
|
|
25267
|
-
const evidencePath =
|
|
25275
|
+
const reportPath = join21(artifactsDir, "report.json");
|
|
25276
|
+
const evidencePath = join21(artifactsDir, "evidence.json");
|
|
25268
25277
|
await writeFile5(
|
|
25269
25278
|
reportPath,
|
|
25270
25279
|
`${JSON.stringify(
|
|
@@ -25354,8 +25363,8 @@ async function settleLawfulFixerTerminalResult(admitted, authority, options) {
|
|
|
25354
25363
|
async function publishCollectorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
|
|
25355
25364
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25356
25365
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25357
|
-
const reportPath =
|
|
25358
|
-
const evidencePath =
|
|
25366
|
+
const reportPath = join21(artifactsDir, "report.json");
|
|
25367
|
+
const evidencePath = join21(artifactsDir, "evidence.json");
|
|
25359
25368
|
await writeFile5(
|
|
25360
25369
|
reportPath,
|
|
25361
25370
|
`${JSON.stringify(
|
|
@@ -25462,8 +25471,8 @@ async function trySettleCollectorTerminalResult(admitted, authority) {
|
|
|
25462
25471
|
async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
|
|
25463
25472
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25464
25473
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25465
|
-
const reportPath =
|
|
25466
|
-
const evidencePath =
|
|
25474
|
+
const reportPath = join21(artifactsDir, "report.json");
|
|
25475
|
+
const evidencePath = join21(artifactsDir, "evidence.json");
|
|
25467
25476
|
await writeFile5(
|
|
25468
25477
|
reportPath,
|
|
25469
25478
|
`${JSON.stringify(
|
|
@@ -25723,8 +25732,8 @@ function extractReviewerMethodInvocations(entries, options) {
|
|
|
25723
25732
|
async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, options) {
|
|
25724
25733
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25725
25734
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25726
|
-
const reportPath =
|
|
25727
|
-
const evidencePath =
|
|
25735
|
+
const reportPath = join21(artifactsDir, "report.json");
|
|
25736
|
+
const evidencePath = join21(artifactsDir, "evidence.json");
|
|
25728
25737
|
await writeFile5(
|
|
25729
25738
|
reportPath,
|
|
25730
25739
|
`${JSON.stringify(
|
|
@@ -25838,8 +25847,8 @@ function extractMergerMethodInvocations(entries, options) {
|
|
|
25838
25847
|
async function publishMergerArtifacts(admitted, roleOutcome, coordinates, options) {
|
|
25839
25848
|
await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
|
|
25840
25849
|
const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
|
|
25841
|
-
const reportPath =
|
|
25842
|
-
const evidencePath =
|
|
25850
|
+
const reportPath = join21(artifactsDir, "report.json");
|
|
25851
|
+
const evidencePath = join21(artifactsDir, "evidence.json");
|
|
25843
25852
|
await writeFile5(
|
|
25844
25853
|
reportPath,
|
|
25845
25854
|
`${JSON.stringify(
|
|
@@ -25984,7 +25993,7 @@ function uniqueFailureFallbackDirs(runDirectory, baseDir) {
|
|
|
25984
25993
|
return dirs;
|
|
25985
25994
|
}
|
|
25986
25995
|
async function resolveFailureArtifactsBase(runDirectory) {
|
|
25987
|
-
const artifactsDir =
|
|
25996
|
+
const artifactsDir = join21(runDirectory, "artifacts");
|
|
25988
25997
|
try {
|
|
25989
25998
|
await ensureRunArtifactsDir(runDirectory);
|
|
25990
25999
|
return { baseDir: artifactsDir };
|
|
@@ -26000,7 +26009,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
|
|
|
26000
26009
|
const candidates = [
|
|
26001
26010
|
...preferredCandidates,
|
|
26002
26011
|
// One unique name per fallback dir — collisions on fixed names cannot exhaust this.
|
|
26003
|
-
...uniqueFallbackDirs.map((dir) =>
|
|
26012
|
+
...uniqueFallbackDirs.map((dir) => join21(dir, `${stem}.${randomUUID3()}.json`))
|
|
26004
26013
|
];
|
|
26005
26014
|
for (let i = 0; i < candidates.length; i += 1) {
|
|
26006
26015
|
const path = candidates[i];
|
|
@@ -26045,26 +26054,26 @@ async function publishFailureArtifacts(admitted, failure, authority) {
|
|
|
26045
26054
|
} catch (error) {
|
|
26046
26055
|
priorIssues.push(publicationAttemptFromError(sessionFile, error));
|
|
26047
26056
|
}
|
|
26048
|
-
const underArtifacts = baseDir ===
|
|
26057
|
+
const underArtifacts = baseDir === join21(admitted.runDirectory, "artifacts");
|
|
26049
26058
|
const uniqueFallbackDirs = uniqueFailureFallbackDirs(
|
|
26050
26059
|
admitted.runDirectory,
|
|
26051
26060
|
baseDir
|
|
26052
26061
|
);
|
|
26053
26062
|
const errorCandidates = underArtifacts ? [
|
|
26054
|
-
|
|
26055
|
-
|
|
26056
|
-
|
|
26063
|
+
join21(baseDir, "error.json"),
|
|
26064
|
+
join21(baseDir, "error.settlement.json"),
|
|
26065
|
+
join21(admitted.runDirectory, "error.settlement.json")
|
|
26057
26066
|
] : [
|
|
26058
|
-
|
|
26059
|
-
|
|
26067
|
+
join21(baseDir, "error.settlement.json"),
|
|
26068
|
+
join21(baseDir, "error.json")
|
|
26060
26069
|
];
|
|
26061
26070
|
const evidenceCandidates = underArtifacts ? [
|
|
26062
|
-
|
|
26063
|
-
|
|
26064
|
-
|
|
26071
|
+
join21(baseDir, "evidence.json"),
|
|
26072
|
+
join21(baseDir, "evidence.settlement.json"),
|
|
26073
|
+
join21(admitted.runDirectory, "evidence.settlement.json")
|
|
26065
26074
|
] : [
|
|
26066
|
-
|
|
26067
|
-
|
|
26075
|
+
join21(baseDir, "evidence.settlement.json"),
|
|
26076
|
+
join21(baseDir, "evidence.json")
|
|
26068
26077
|
];
|
|
26069
26078
|
const errorPayloadBase = {
|
|
26070
26079
|
kind: "error",
|
|
@@ -26366,7 +26375,7 @@ var init_ticket_provenance_contracts = __esm({
|
|
|
26366
26375
|
});
|
|
26367
26376
|
|
|
26368
26377
|
// src/ticket-provenance.ts
|
|
26369
|
-
import { join as
|
|
26378
|
+
import { join as join22 } from "node:path";
|
|
26370
26379
|
function ticketProvenanceSubject(ticketNumber) {
|
|
26371
26380
|
if (!Number.isSafeInteger(ticketNumber) || ticketNumber < 1) {
|
|
26372
26381
|
throw new Error(`ticket-provenance subject requires a positive ticket number, got ${String(ticketNumber)}`);
|
|
@@ -26384,7 +26393,7 @@ function resolveTicketProvenanceVolume(ticketNumber, cwd, home) {
|
|
|
26384
26393
|
return {
|
|
26385
26394
|
recordFile: path.recordFile,
|
|
26386
26395
|
volumeDir: path.sessionDir,
|
|
26387
|
-
humanViewFile:
|
|
26396
|
+
humanViewFile: join22(path.sessionDir, TICKET_PROVENANCE_HUMAN_VIEW)
|
|
26388
26397
|
};
|
|
26389
26398
|
}
|
|
26390
26399
|
var init_ticket_provenance = __esm({
|
|
@@ -26434,7 +26443,7 @@ var init_case_dossier_delivery = __esm({
|
|
|
26434
26443
|
|
|
26435
26444
|
// src/host-transition-prior-native.ts
|
|
26436
26445
|
import { access as access2, readdir as readdir6 } from "node:fs/promises";
|
|
26437
|
-
import { dirname as dirname11, join as
|
|
26446
|
+
import { dirname as dirname11, join as join23 } from "node:path";
|
|
26438
26447
|
function isEnoent2(error) {
|
|
26439
26448
|
return typeof error === "object" && error !== null && error.code === "ENOENT";
|
|
26440
26449
|
}
|
|
@@ -26459,7 +26468,7 @@ async function listSitianRecordPaths(sessionParent) {
|
|
|
26459
26468
|
const recordPaths = [];
|
|
26460
26469
|
for (const entry of entries) {
|
|
26461
26470
|
if (!entry.isDirectory()) continue;
|
|
26462
|
-
const recordFile =
|
|
26471
|
+
const recordFile = join23(sessionRoot, entry.name, "records.jsonl");
|
|
26463
26472
|
try {
|
|
26464
26473
|
await access2(recordFile);
|
|
26465
26474
|
recordPaths.push(recordFile);
|
|
@@ -26529,7 +26538,7 @@ var init_public_run_credentials = __esm({
|
|
|
26529
26538
|
import { constants as fsConstants } from "node:fs";
|
|
26530
26539
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
26531
26540
|
import { lstat as lstat5, mkdir as mkdir4, open as open2 } from "node:fs/promises";
|
|
26532
|
-
import { join as
|
|
26541
|
+
import { join as join24 } from "node:path";
|
|
26533
26542
|
function presentTerminal(terminal, io) {
|
|
26534
26543
|
if (terminal.roleOutcome.kind === "failure" || terminal.roleOutcome.kind === "no_receipt") {
|
|
26535
26544
|
presentFailureTerminal(terminal, io);
|
|
@@ -26548,7 +26557,7 @@ async function finalizeExceptionRunBestEffort(runDirectory, io) {
|
|
|
26548
26557
|
}
|
|
26549
26558
|
}
|
|
26550
26559
|
function runArtifactsDirectory(runDirectory) {
|
|
26551
|
-
return
|
|
26560
|
+
return join24(runDirectory, "artifacts");
|
|
26552
26561
|
}
|
|
26553
26562
|
async function ensureRealArtifactsDirectory(runDirectory) {
|
|
26554
26563
|
const runStat = await lstat5(runDirectory);
|
|
@@ -26631,7 +26640,7 @@ function jsonSafeReplacer() {
|
|
|
26631
26640
|
}
|
|
26632
26641
|
async function retainDispatchError(admitted, principalAuthority, sessionAppender, attempt, error) {
|
|
26633
26642
|
const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
|
|
26634
|
-
const filePath =
|
|
26643
|
+
const filePath = join24(
|
|
26635
26644
|
artifactsDir,
|
|
26636
26645
|
`dispatch-error-attempt-${attempt}-${randomUUID4()}.json`
|
|
26637
26646
|
);
|
|
@@ -26880,7 +26889,7 @@ var init_auto_resume = __esm({
|
|
|
26880
26889
|
// src/public-cli/post-admission.ts
|
|
26881
26890
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
26882
26891
|
import { readFile as readFile16, writeFile as writeFile6 } from "node:fs/promises";
|
|
26883
|
-
import { isAbsolute as isAbsolute7, join as
|
|
26892
|
+
import { isAbsolute as isAbsolute7, join as join25, resolve as resolve8 } from "node:path";
|
|
26884
26893
|
function appendContinuationSection(continuation, section) {
|
|
26885
26894
|
const prompt = `${continuation.prompt}
|
|
26886
26895
|
|
|
@@ -26889,7 +26898,7 @@ ${section}`;
|
|
|
26889
26898
|
}
|
|
26890
26899
|
async function readInvocationHost(runDirectory) {
|
|
26891
26900
|
try {
|
|
26892
|
-
const raw = JSON.parse(await readFile16(
|
|
26901
|
+
const raw = JSON.parse(await readFile16(join25(runDirectory, "invocation.json"), "utf8"));
|
|
26893
26902
|
return typeof raw.host === "string" && raw.host.trim() !== "" ? raw.host : void 0;
|
|
26894
26903
|
} catch (error) {
|
|
26895
26904
|
if (error.code === "ENOENT") return void 0;
|
|
@@ -27043,7 +27052,7 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
27043
27052
|
}
|
|
27044
27053
|
try {
|
|
27045
27054
|
await writeFile6(
|
|
27046
|
-
|
|
27055
|
+
join25(admitted.runDirectory, "stderr.log"),
|
|
27047
27056
|
result2.stderr,
|
|
27048
27057
|
"utf8"
|
|
27049
27058
|
);
|
|
@@ -27152,7 +27161,7 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
|
|
|
27152
27161
|
}
|
|
27153
27162
|
function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
|
|
27154
27163
|
const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve8(attachmentPath);
|
|
27155
|
-
return pathContainedIn(
|
|
27164
|
+
return pathContainedIn(join25(runDirectory, "attachments"), absolute);
|
|
27156
27165
|
}
|
|
27157
27166
|
async function prepareSummonsResumeMaterials(runDirectory, summons) {
|
|
27158
27167
|
if (summons === void 0) return void 0;
|
|
@@ -29321,7 +29330,7 @@ var init_judge_run = __esm({
|
|
|
29321
29330
|
|
|
29322
29331
|
// src/public-cli/merger-run.ts
|
|
29323
29332
|
import { mkdir as mkdir5, writeFile as writeFile7 } from "node:fs/promises";
|
|
29324
|
-
import { join as
|
|
29333
|
+
import { join as join26, resolve as resolve9 } from "node:path";
|
|
29325
29334
|
function mergerMethods(packageRoot2) {
|
|
29326
29335
|
return [
|
|
29327
29336
|
{
|
|
@@ -29387,8 +29396,8 @@ async function admitMergerShellForActivationFailure(options) {
|
|
|
29387
29396
|
expectedConflictPaths: [],
|
|
29388
29397
|
resolutionScope: []
|
|
29389
29398
|
};
|
|
29390
|
-
const admittedRequestPath =
|
|
29391
|
-
const mergerInputPath =
|
|
29399
|
+
const admittedRequestPath = join26(runDirectory, "admitted-request.json");
|
|
29400
|
+
const mergerInputPath = join26(runDirectory, "merger-input.json");
|
|
29392
29401
|
await writeFile7(
|
|
29393
29402
|
admittedRequestPath,
|
|
29394
29403
|
`${JSON.stringify(
|
|
@@ -29828,10 +29837,10 @@ var init_analyst_book_key = __esm({
|
|
|
29828
29837
|
// src/atomic-write.ts
|
|
29829
29838
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
29830
29839
|
import { rename, rm, writeFile as writeFile8 } from "node:fs/promises";
|
|
29831
|
-
import { dirname as dirname12, join as
|
|
29840
|
+
import { dirname as dirname12, join as join27 } from "node:path";
|
|
29832
29841
|
async function writeFileAtomically(destination, contents) {
|
|
29833
29842
|
const parent = dirname12(destination);
|
|
29834
|
-
const temporary =
|
|
29843
|
+
const temporary = join27(parent, `.atomic-write-${randomUUID6()}.tmp`);
|
|
29835
29844
|
try {
|
|
29836
29845
|
await writeFile8(temporary, contents);
|
|
29837
29846
|
await rename(temporary, destination);
|
|
@@ -29848,7 +29857,7 @@ var init_atomic_write = __esm({
|
|
|
29848
29857
|
|
|
29849
29858
|
// src/analyst-index.ts
|
|
29850
29859
|
import { open as open3, readFile as readFile17, unlink as unlink4 } from "node:fs/promises";
|
|
29851
|
-
import { dirname as dirname13, join as
|
|
29860
|
+
import { dirname as dirname13, join as join28 } from "node:path";
|
|
29852
29861
|
function sleep(ms) {
|
|
29853
29862
|
return new Promise((resolve11) => {
|
|
29854
29863
|
setTimeout(resolve11, ms);
|
|
@@ -29857,7 +29866,7 @@ function sleep(ms) {
|
|
|
29857
29866
|
async function withAnalystLibraryIndexLock(ledgerHome, fn) {
|
|
29858
29867
|
const indexPath = analystLibraryIndexPath(ledgerHome);
|
|
29859
29868
|
ensureRealDirectoryTree(ledgerHome, dirname13(indexPath));
|
|
29860
|
-
const lockPath =
|
|
29869
|
+
const lockPath = join28(dirname13(indexPath), LIBRARY_INDEX_LOCK_NAME);
|
|
29861
29870
|
assertLedgerFileInsideHome(lockPath, ledgerHome);
|
|
29862
29871
|
const startedAt = Date.now();
|
|
29863
29872
|
while (true) {
|
|
@@ -29884,7 +29893,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
|
|
|
29884
29893
|
}
|
|
29885
29894
|
}
|
|
29886
29895
|
function analystLibraryIndexPath(ledgerHome) {
|
|
29887
|
-
return
|
|
29896
|
+
return join28(ledgerHome, "analyst", "library-index.json");
|
|
29888
29897
|
}
|
|
29889
29898
|
function rowFromIssueMetricsPage(page) {
|
|
29890
29899
|
return {
|
|
@@ -30180,7 +30189,7 @@ var init_analyst_cohort = __esm({
|
|
|
30180
30189
|
|
|
30181
30190
|
// src/analyst-ledger.ts
|
|
30182
30191
|
import { readdir as readdir7, readFile as readFile18 } from "node:fs/promises";
|
|
30183
|
-
import { join as
|
|
30192
|
+
import { join as join29 } from "node:path";
|
|
30184
30193
|
function isMissingPathError5(error) {
|
|
30185
30194
|
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
30186
30195
|
}
|
|
@@ -30193,7 +30202,7 @@ function isRecord16(value) {
|
|
|
30193
30202
|
async function readExistingRunLifecycleState(runDirectory) {
|
|
30194
30203
|
try {
|
|
30195
30204
|
const raw = JSON.parse(
|
|
30196
|
-
await readFile18(
|
|
30205
|
+
await readFile18(join29(runDirectory, "run-state.json"), "utf8")
|
|
30197
30206
|
);
|
|
30198
30207
|
if (!isRecord16(raw) || typeof raw.state !== "string") return void 0;
|
|
30199
30208
|
return raw.state;
|
|
@@ -30225,7 +30234,7 @@ async function listLedgerBookNames(booksRoot) {
|
|
|
30225
30234
|
async function readInvocationScopeFields(runDirectory) {
|
|
30226
30235
|
let raw;
|
|
30227
30236
|
try {
|
|
30228
|
-
raw = await readFile18(
|
|
30237
|
+
raw = await readFile18(join29(runDirectory, "invocation.json"), "utf8");
|
|
30229
30238
|
} catch (error) {
|
|
30230
30239
|
if (isMissingPathError5(error)) return void 0;
|
|
30231
30240
|
throw error;
|
|
@@ -30257,7 +30266,7 @@ function decideIssueScope(input) {
|
|
|
30257
30266
|
}
|
|
30258
30267
|
async function resolveSessionFile(runDirectory) {
|
|
30259
30268
|
try {
|
|
30260
|
-
const raw = await readFile18(
|
|
30269
|
+
const raw = await readFile18(join29(runDirectory, "invocation.json"), "utf8");
|
|
30261
30270
|
const parsed = JSON.parse(raw);
|
|
30262
30271
|
if (isRecord16(parsed) && typeof parsed.sessionFile === "string" && parsed.sessionFile.trim() !== "") {
|
|
30263
30272
|
return parsed.sessionFile;
|
|
@@ -30265,7 +30274,7 @@ async function resolveSessionFile(runDirectory) {
|
|
|
30265
30274
|
} catch (error) {
|
|
30266
30275
|
if (!isMissingPathError5(error)) throw error;
|
|
30267
30276
|
}
|
|
30268
|
-
return
|
|
30277
|
+
return join29(runDirectory, "session", "session.jsonl");
|
|
30269
30278
|
}
|
|
30270
30279
|
function attributeSessionRowsForRun(input) {
|
|
30271
30280
|
if (pathContainedIn(input.runDirectory, input.sessionFile)) {
|
|
@@ -30437,9 +30446,9 @@ async function classifyScopedRun(input) {
|
|
|
30437
30446
|
}
|
|
30438
30447
|
let gateCycles;
|
|
30439
30448
|
try {
|
|
30440
|
-
const parentSessionFile =
|
|
30449
|
+
const parentSessionFile = join29(input.runDirectory, "session", "session.jsonl");
|
|
30441
30450
|
gateCycles = await readAnalystGateCyclesFromAuditorRoles(
|
|
30442
|
-
|
|
30451
|
+
join29(input.runDirectory, "session", "auditor-roles"),
|
|
30443
30452
|
{ parentSessionFile }
|
|
30444
30453
|
);
|
|
30445
30454
|
} catch (error) {
|
|
@@ -30472,7 +30481,7 @@ async function classifyScopedRun(input) {
|
|
|
30472
30481
|
async function scanAnalystIssueRuns(input) {
|
|
30473
30482
|
const ledgerHome = resolveActivationLedgerHome(input.home);
|
|
30474
30483
|
const scopeTicketNumber = input.ticketNumber;
|
|
30475
|
-
const booksRoot =
|
|
30484
|
+
const booksRoot = join29(ledgerHome, "books");
|
|
30476
30485
|
let wholeBook = false;
|
|
30477
30486
|
let scopeRootIdentity;
|
|
30478
30487
|
let bookNames;
|
|
@@ -30504,7 +30513,7 @@ async function scanAnalystIssueRuns(input) {
|
|
|
30504
30513
|
const unreadable = [];
|
|
30505
30514
|
const scopeConflicts = [];
|
|
30506
30515
|
for (const book of bookNames) {
|
|
30507
|
-
const runsDir =
|
|
30516
|
+
const runsDir = join29(booksRoot, book, "runs");
|
|
30508
30517
|
let runNames;
|
|
30509
30518
|
try {
|
|
30510
30519
|
const entries = await readdir7(runsDir, { withFileTypes: true });
|
|
@@ -30516,7 +30525,7 @@ async function scanAnalystIssueRuns(input) {
|
|
|
30516
30525
|
for (const runName of runNames) {
|
|
30517
30526
|
const parsed = parseRunDirectoryName2(runName);
|
|
30518
30527
|
if (parsed === void 0) continue;
|
|
30519
|
-
const runDirectory =
|
|
30528
|
+
const runDirectory = join29(runsDir, runName);
|
|
30520
30529
|
let scopeFields;
|
|
30521
30530
|
try {
|
|
30522
30531
|
scopeFields = await readInvocationScopeFields(runDirectory);
|
|
@@ -31370,7 +31379,7 @@ var init_analyst_metric_family = __esm({
|
|
|
31370
31379
|
|
|
31371
31380
|
// src/analyst-page.ts
|
|
31372
31381
|
import { createHash as createHash5 } from "node:crypto";
|
|
31373
|
-
import { dirname as dirname14, join as
|
|
31382
|
+
import { dirname as dirname14, join as join30 } from "node:path";
|
|
31374
31383
|
function analystIssuePageKey(address) {
|
|
31375
31384
|
const parts = ["book", address.bookKey];
|
|
31376
31385
|
if (address.issueNumber !== void 0) {
|
|
@@ -31381,7 +31390,7 @@ function analystIssuePageKey(address) {
|
|
|
31381
31390
|
return createHash5("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
|
|
31382
31391
|
}
|
|
31383
31392
|
function analystIssuePagePath(ledgerHome, address) {
|
|
31384
|
-
return
|
|
31393
|
+
return join30(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
|
|
31385
31394
|
}
|
|
31386
31395
|
function analystIssuePageAddressFromPage(page) {
|
|
31387
31396
|
return {
|
|
@@ -31914,7 +31923,7 @@ __export(cli_exports, {
|
|
|
31914
31923
|
runAkRole: () => runAkRole
|
|
31915
31924
|
});
|
|
31916
31925
|
import { realpath as realpath6 } from "node:fs/promises";
|
|
31917
|
-
import { join as
|
|
31926
|
+
import { join as join31 } from "node:path";
|
|
31918
31927
|
function takePublicGlobalFlag(argv, index, options) {
|
|
31919
31928
|
const tokens = argv.slice(index);
|
|
31920
31929
|
const taken = options.takeDashed(tokens);
|
|
@@ -31966,7 +31975,7 @@ function resolveRoleTurnHost(env, options) {
|
|
|
31966
31975
|
ok: true,
|
|
31967
31976
|
host: {
|
|
31968
31977
|
executeTurn: async (request) => {
|
|
31969
|
-
hostPromise ??=
|
|
31978
|
+
hostPromise ??= loadProductionExternalHostFactory(env.packageRoot, name).then(
|
|
31970
31979
|
(create) => create({
|
|
31971
31980
|
packageRoot: env.packageRoot,
|
|
31972
31981
|
principalAuthority: options.principalAuthority
|
|
@@ -32053,7 +32062,7 @@ function resolveHome(env) {
|
|
|
32053
32062
|
return env.home ?? packageMachineHome();
|
|
32054
32063
|
}
|
|
32055
32064
|
function resolveAgentDir(env, home) {
|
|
32056
|
-
return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ??
|
|
32065
|
+
return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join31(home, ".pi", "agent");
|
|
32057
32066
|
}
|
|
32058
32067
|
function parseThinking(value) {
|
|
32059
32068
|
return value;
|
|
@@ -32946,7 +32955,7 @@ var init_cli = __esm({
|
|
|
32946
32955
|
init_registry2();
|
|
32947
32956
|
init_cli_errors();
|
|
32948
32957
|
init_host_descriptions();
|
|
32949
|
-
|
|
32958
|
+
init_load_production_external_host();
|
|
32950
32959
|
init_role_turn_host();
|
|
32951
32960
|
init_invocation();
|
|
32952
32961
|
init_option_definitions();
|
|
@@ -33017,8 +33026,8 @@ var init_cli = __esm({
|
|
|
33017
33026
|
});
|
|
33018
33027
|
|
|
33019
33028
|
// src/public-cli/main.ts
|
|
33020
|
-
import { existsSync as
|
|
33021
|
-
import { dirname as dirname15, join as
|
|
33029
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
33030
|
+
import { dirname as dirname15, join as join32 } from "node:path";
|
|
33022
33031
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
33023
33032
|
|
|
33024
33033
|
// src/public-cli/host-pi-runtime.ts
|
|
@@ -33107,13 +33116,14 @@ function linkPackage(packageRoot2, name, targetDir) {
|
|
|
33107
33116
|
// src/public-cli/main.ts
|
|
33108
33117
|
var here = dirname15(fileURLToPath2(import.meta.url));
|
|
33109
33118
|
function resolvePackageRoot(binDir) {
|
|
33110
|
-
const canonical =
|
|
33111
|
-
if (
|
|
33119
|
+
const canonical = join32(binDir, "..", "..");
|
|
33120
|
+
if (existsSync8(join32(canonical, "package.json"))) {
|
|
33112
33121
|
return canonical;
|
|
33113
33122
|
}
|
|
33114
33123
|
return binDir;
|
|
33115
33124
|
}
|
|
33116
33125
|
var packageRoot = resolvePackageRoot(here);
|
|
33126
|
+
process.env.AK_ROLE_PACKAGE_ROOT = packageRoot;
|
|
33117
33127
|
ensureHostPiRuntimeResolvable(packageRoot);
|
|
33118
33128
|
var { runAkRole: runAkRole2 } = await Promise.resolve().then(() => (init_cli(), cli_exports));
|
|
33119
33129
|
var result = await runAkRole2(process.argv.slice(2), { packageRoot });
|