@akagilnc/pi-workflow-roles 0.1.5577 → 0.1.5593
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 +2 -0
- package/README.zh-CN.md +2 -0
- package/dist/acp-host/production-host.js +338 -617
- package/dist/collector-config.js +0 -44
- package/dist/headless-host/production-host.js +241 -520
- package/dist/migrate-book-topology.js +16 -32
- package/dist/package-resources/engine-material.js +22 -25
- package/dist/public-cli/instruction-seat-run.js +11 -21
- package/dist/public-cli/invocation.js +83 -193
- package/dist/public-cli/main.js +225 -528
- package/dist/public-cli/option-definitions.js +5 -5
- package/dist/public-cli/post-admission.js +12 -48
- package/dist/public-cli/run-lifecycle.js +13 -21
- package/dist/public-role-summons.js +1 -1
- package/dist/role-run-relocation.js +12 -20
- package/package.json +1 -1
- package/src/collector-config.ts +0 -42
- package/src/collector-role.ts +10 -20
- package/src/package-resources/engine-material.ts +42 -35
- package/src/public-cli/instruction-seat-run.ts +10 -27
- package/src/public-cli/invocation.ts +97 -292
- package/src/public-cli/option-definitions.ts +5 -5
- package/src/public-cli/post-admission.ts +13 -64
- package/src/public-cli/run-lifecycle.ts +13 -34
- package/src/public-role-summons.ts +1 -1
- package/src/role-run-placement.ts +0 -1
- package/src/role-run-relocation.ts +12 -22
- package/src/role-runtime.ts +18 -16
|
@@ -1392,23 +1392,10 @@ var init_cli_errors = __esm({
|
|
|
1392
1392
|
}
|
|
1393
1393
|
});
|
|
1394
1394
|
|
|
1395
|
-
// src/sha256.ts
|
|
1396
|
-
import { createHash } from "node:crypto";
|
|
1397
|
-
function sha256Hex(bytes) {
|
|
1398
|
-
return createHash("sha256").update(bytes).digest("hex");
|
|
1399
|
-
}
|
|
1400
|
-
var init_sha256 = __esm({
|
|
1401
|
-
"src/sha256.ts"() {
|
|
1402
|
-
"use strict";
|
|
1403
|
-
}
|
|
1404
|
-
});
|
|
1405
|
-
|
|
1406
1395
|
// src/collector-config.ts
|
|
1407
1396
|
var init_collector_config = __esm({
|
|
1408
1397
|
"src/collector-config.ts"() {
|
|
1409
1398
|
"use strict";
|
|
1410
|
-
init_sha256();
|
|
1411
|
-
init_unknown_value();
|
|
1412
1399
|
init_run_ticket_number();
|
|
1413
1400
|
}
|
|
1414
1401
|
});
|
|
@@ -15608,22 +15595,10 @@ function rewriteSummonsMaterials(value2, rewrites) {
|
|
|
15608
15595
|
rewrites
|
|
15609
15596
|
);
|
|
15610
15597
|
rewriteSourceRunLocator(value2.sourceRun, rewrites);
|
|
15611
|
-
if (Array.isArray(value2.attachmentPaths)) {
|
|
15612
|
-
value2.attachmentPaths = value2.attachmentPaths.map(
|
|
15613
|
-
(path8) => rewriteRunDirectoryPathValueAgainstRewrites(path8, rewrites)
|
|
15614
|
-
);
|
|
15615
|
-
}
|
|
15616
15598
|
}
|
|
15617
15599
|
function rewriteAdmittedRoleRunPage(page, rewrites) {
|
|
15618
15600
|
rewriteRunDirectoryPathFieldsAgainstRewrites(page, ADMITTED_PAGE_FIELDS, rewrites);
|
|
15619
15601
|
rewriteSourceRunLocator(page.sourceRun, rewrites);
|
|
15620
|
-
if (Array.isArray(page.attachments)) {
|
|
15621
|
-
for (const attachment of page.attachments) {
|
|
15622
|
-
if (isRecord(attachment)) {
|
|
15623
|
-
rewriteRunDirectoryPathFieldsAgainstRewrites(attachment, ["frozenPath"], rewrites);
|
|
15624
|
-
}
|
|
15625
|
-
}
|
|
15626
|
-
}
|
|
15627
15602
|
if (isRecord(page.principal)) {
|
|
15628
15603
|
rewriteRunDirectoryPathFieldsAgainstRewrites(
|
|
15629
15604
|
page.principal,
|
|
@@ -15859,7 +15834,7 @@ var init_role_run_relocation = __esm({
|
|
|
15859
15834
|
"taskPath",
|
|
15860
15835
|
"packetPath",
|
|
15861
15836
|
"prerequisitesPath",
|
|
15862
|
-
|
|
15837
|
+
// #1165: requestManifestPath is a caller path — never rewrite.
|
|
15863
15838
|
"mergerInputPath",
|
|
15864
15839
|
"sourceRunPath"
|
|
15865
15840
|
];
|
|
@@ -15884,6 +15859,17 @@ var init_role_run_relocation = __esm({
|
|
|
15884
15859
|
}
|
|
15885
15860
|
});
|
|
15886
15861
|
|
|
15862
|
+
// src/sha256.ts
|
|
15863
|
+
import { createHash } from "node:crypto";
|
|
15864
|
+
function sha256Hex(bytes) {
|
|
15865
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
15866
|
+
}
|
|
15867
|
+
var init_sha256 = __esm({
|
|
15868
|
+
"src/sha256.ts"() {
|
|
15869
|
+
"use strict";
|
|
15870
|
+
}
|
|
15871
|
+
});
|
|
15872
|
+
|
|
15887
15873
|
// src/submission-correctable-error.ts
|
|
15888
15874
|
var correctableSubmissionErrorBrand, CorrectableSubmissionError;
|
|
15889
15875
|
var init_submission_correctable_error = __esm({
|
|
@@ -16149,8 +16135,8 @@ var init_option_definitions = __esm({
|
|
|
16149
16135
|
repeatable: true,
|
|
16150
16136
|
form: "option",
|
|
16151
16137
|
description: {
|
|
16152
|
-
en: "
|
|
16153
|
-
zh: "\
|
|
16138
|
+
en: "Caller file path passed as-is to the role (repeatable). Package does not read, copy, or validate; use an absolute path when cwd differs from --project.",
|
|
16139
|
+
zh: "\u8C03\u7528\u65B9\u6587\u4EF6\u8DEF\u5F84\u539F\u6837\u9012\u7ED9\u8859\u95E8\uFF08\u53EF\u91CD\u590D\uFF09\u3002\u5305\u4E0D\u8BFB\u3001\u4E0D\u590D\u5236\u3001\u4E0D\u6821\u9A8C\uFF1B\u8C03\u7528\u65B9\u5F53\u524D\u76EE\u5F55\u4E0E --project \u4E0D\u540C\u65F6\u8BF7\u7ED9\u7EDD\u5BF9\u8DEF\u5F84\u3002"
|
|
16154
16140
|
}
|
|
16155
16141
|
};
|
|
16156
16142
|
SHARED_PHASE_SEMANTICS = {
|
|
@@ -16325,8 +16311,8 @@ var init_option_definitions = __esm({
|
|
|
16325
16311
|
repeatable: false,
|
|
16326
16312
|
form: "option",
|
|
16327
16313
|
description: {
|
|
16328
|
-
en: "
|
|
16329
|
-
zh: "\
|
|
16314
|
+
en: "Caller path to a request manifest JSON file, passed as-is. Package does not read, copy, or validate; use an absolute path when cwd differs from --project.",
|
|
16315
|
+
zh: "\u8C03\u7528\u65B9 request manifest JSON \u8DEF\u5F84\uFF0C\u539F\u6837\u4F20\u9012\u3002\u5305\u4E0D\u8BFB\u3001\u4E0D\u590D\u5236\u3001\u4E0D\u6821\u9A8C\uFF1B\u8C03\u7528\u65B9\u5F53\u524D\u76EE\u5F55\u4E0E --project \u4E0D\u540C\u65F6\u8BF7\u7ED9\u7EDD\u5BF9\u8DEF\u5F84\u3002"
|
|
16330
16316
|
}
|
|
16331
16317
|
}
|
|
16332
16318
|
];
|
|
@@ -16802,7 +16788,6 @@ var init_invocation = __esm({
|
|
|
16802
16788
|
init_uuidv7();
|
|
16803
16789
|
init_notary_contracts();
|
|
16804
16790
|
init_notary_source_run();
|
|
16805
|
-
init_engine_material();
|
|
16806
16791
|
init_cli_errors();
|
|
16807
16792
|
init_option_definitions();
|
|
16808
16793
|
init_unknown_value();
|
|
@@ -16856,7 +16841,6 @@ var init_run_lifecycle = __esm({
|
|
|
16856
16841
|
init_cli_errors();
|
|
16857
16842
|
init_collector_config();
|
|
16858
16843
|
init_role_run_relocation();
|
|
16859
|
-
init_engine_material();
|
|
16860
16844
|
init_packaged_role_registry();
|
|
16861
16845
|
init_invocation();
|
|
16862
16846
|
init_run_dossier();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { existsSync, readdirSync } from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
const ENGINE_MATERIAL_RELATIVE_ROOT = "resources/engines";
|
|
4
|
+
const ENGINE_DISPATCH_RELATIVE_PATH = "resources/engine-dispatch.md";
|
|
4
5
|
function pickEngineAxis(source) {
|
|
5
6
|
return {
|
|
6
7
|
...source.engine === void 0 ? {} : { engine: source.engine },
|
|
@@ -26,6 +27,9 @@ function engineMaterialRelativeDirectory() {
|
|
|
26
27
|
function resolveEngineMaterialDirectory(packageRoot) {
|
|
27
28
|
return join(packageRoot, ENGINE_MATERIAL_RELATIVE_ROOT);
|
|
28
29
|
}
|
|
30
|
+
function resolveEngineDispatchMaterialPath(packageRoot) {
|
|
31
|
+
return join(packageRoot, ENGINE_DISPATCH_RELATIVE_PATH);
|
|
32
|
+
}
|
|
29
33
|
function listEngineMaterialNames(packageRoot) {
|
|
30
34
|
const dir = resolveEngineMaterialDirectory(packageRoot);
|
|
31
35
|
if (!existsSync(dir)) return Object.freeze([]);
|
|
@@ -51,41 +55,34 @@ function engineSessionMaterialFromOptions(options) {
|
|
|
51
55
|
const model = options.engineModel === void 0 ? void 0 : assertLegalEngineModel(options.engineModel);
|
|
52
56
|
const materialPath = resolveEngineMaterialPath(options.packageRoot, name);
|
|
53
57
|
const modelField = model === void 0 ? {} : { model };
|
|
54
|
-
if (existsSync(materialPath)) {
|
|
55
|
-
return Object.freeze({ name,
|
|
58
|
+
if (!existsSync(materialPath)) {
|
|
59
|
+
return Object.freeze({ name, ...modelField });
|
|
56
60
|
}
|
|
57
|
-
|
|
61
|
+
const handbook = readFileSync(materialPath, "utf8");
|
|
62
|
+
const dispatchPath = resolveEngineDispatchMaterialPath(options.packageRoot);
|
|
63
|
+
const dispatchField = existsSync(dispatchPath) ? { dispatchHandbook: readFileSync(dispatchPath, "utf8") } : {};
|
|
64
|
+
return Object.freeze({ name, handbook, ...dispatchField, ...modelField });
|
|
58
65
|
}
|
|
59
|
-
function
|
|
60
|
-
if (engineMaterial === void 0)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (engineMaterial.model !== void 0) {
|
|
69
|
-
out.push(`- engineModel: ${engineMaterial.model}`);
|
|
70
|
-
}
|
|
71
|
-
out.push(`- ${engineMaterial.materialPath}`);
|
|
72
|
-
} else {
|
|
73
|
-
out.push(`- engine: ${engineMaterial.name}`);
|
|
74
|
-
if (engineMaterial.model !== void 0) {
|
|
75
|
-
out.push(`- engineModel: ${engineMaterial.model}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return out;
|
|
66
|
+
function engineSessionReadingMaterial(engineMaterial) {
|
|
67
|
+
if (engineMaterial === void 0) return void 0;
|
|
68
|
+
return {
|
|
69
|
+
kind: "engine-session-material",
|
|
70
|
+
name: engineMaterial.name,
|
|
71
|
+
...engineMaterial.model === void 0 ? {} : { model: engineMaterial.model },
|
|
72
|
+
...engineMaterial.handbook === void 0 ? {} : { handbook: engineMaterial.handbook },
|
|
73
|
+
...engineMaterial.dispatchHandbook === void 0 ? {} : { dispatchHandbook: engineMaterial.dispatchHandbook }
|
|
74
|
+
};
|
|
79
75
|
}
|
|
80
76
|
export {
|
|
81
|
-
appendEngineSessionMaterial,
|
|
82
77
|
assertLegalEngineModel,
|
|
83
78
|
assertLegalEngineName,
|
|
84
79
|
engineMaterialRelativeDirectory,
|
|
85
80
|
engineSessionMaterialFromOptions,
|
|
81
|
+
engineSessionReadingMaterial,
|
|
86
82
|
isEngineNameSyntax,
|
|
87
83
|
listEngineMaterialNames,
|
|
88
84
|
pickEngineAxis,
|
|
85
|
+
resolveEngineDispatchMaterialPath,
|
|
89
86
|
resolveEngineMaterialDirectory,
|
|
90
87
|
resolveEngineMaterialPath
|
|
91
88
|
};
|
|
@@ -24,11 +24,10 @@ import { sessionFileFromPublicSummon } from "../session-assistant-usage.js";
|
|
|
24
24
|
import { latestQueuePayload, latestQueueStatus, } from "../submission-gate.js";
|
|
25
25
|
import { isSafePositiveTicketNumber, readBoardTicketNumber } from "../run-ticket-number.js";
|
|
26
26
|
import { NotarySourceRunError, resolveNotarySourceRunLocator } from "../notary-source-run.js";
|
|
27
|
-
import { engineSessionMaterialFromOptions, pickEngineAxis } from "../package-resources/engine-material.js";
|
|
28
27
|
import { packagedAdmitsCountersign, packagedBindsBoardTicket, packagedRebindSourceOnResume, packagedRoleMetadata, } from "../packaged-role-registry.js";
|
|
29
28
|
import { readAuditorResumeBinding } from "../auditor-soul.js";
|
|
30
29
|
import { CliUsageError } from "./cli-errors.js";
|
|
31
|
-
import { admitPublicRole, bindAdmittedTicketNumber, buildInstructionTransportPrompt, materializeCountersignInvocation, persistAdmittedSourceRunPath, recordAdmittedCorrelation, recordChildDiaristRun, relocateAdmittedRunToTicket,
|
|
30
|
+
import { admitPublicRole, bindAdmittedTicketNumber, buildInstructionTransportPrompt, materializeCountersignInvocation, persistAdmittedSourceRunPath, recordAdmittedCorrelation, recordChildDiaristRun, relocateAdmittedRunToTicket, } from "./invocation.js";
|
|
32
31
|
import { bindDiaristAssertedTicketNumber, presentControlledFailure, packageFaultNoteFor, prepareSummonsResumeMaterials, roleTurnOptions, runPostAdmissionOneShot, runPostAdmissionResumable, runPostAdmissionSeatResume, showResumeErrorPointer, resumeTurnRequestProjectionOptions, } from "./post-admission.js";
|
|
33
32
|
import { presentTerminal } from "./auto-resume.js";
|
|
34
33
|
import { buildAutoResumeContinuationPrompt, loadResumablePublicRole, markRunAdmitted, parentRunPathFromGatePointerInstruction, readCurrentCourt, } from "./run-lifecycle.js";
|
|
@@ -175,10 +174,7 @@ function initialPrompt(admitted, env) {
|
|
|
175
174
|
if (reask !== undefined && "reaskPrompt" in record && record.reaskPrompt === true) {
|
|
176
175
|
return reask;
|
|
177
176
|
}
|
|
178
|
-
return buildInstructionTransportPrompt(admitted
|
|
179
|
-
...pickEngineAxis(env),
|
|
180
|
-
packageRoot: env.packageRoot,
|
|
181
|
-
}));
|
|
177
|
+
return buildInstructionTransportPrompt(admitted);
|
|
182
178
|
}
|
|
183
179
|
function isBoardTicketSeat(seat) {
|
|
184
180
|
return packagedBindsBoardTicket(seat.role);
|
|
@@ -284,10 +280,7 @@ async function dispatchAdmitted(admitted, env, io) {
|
|
|
284
280
|
buildInitialRequest: () => buildInstructionSeatTurnRequest(admitted, roleTurnOptions(activeEnv, admitted, { kind: "initial", prompt: initialPrompt(admitted, activeEnv) })),
|
|
285
281
|
buildResumeRequest: () => buildInstructionSeatTurnRequest(admitted, roleTurnOptions(activeEnv, admitted, {
|
|
286
282
|
kind: "resume",
|
|
287
|
-
prompt: buildAutoResumeContinuationPrompt(
|
|
288
|
-
packageRoot: activeEnv.packageRoot,
|
|
289
|
-
...pickEngineAxis(activeEnv),
|
|
290
|
-
}),
|
|
283
|
+
prompt: buildAutoResumeContinuationPrompt(),
|
|
291
284
|
})),
|
|
292
285
|
adapters,
|
|
293
286
|
...(activeEnv.engine === undefined ? {} : { effectiveEngine: activeEnv.engine }),
|
|
@@ -436,7 +429,7 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
436
429
|
summons: {
|
|
437
430
|
sourceRunPath: gateParentRunPath,
|
|
438
431
|
instruction: resumeInstruction,
|
|
439
|
-
instructionEmpty: resumeInstruction.
|
|
432
|
+
instructionEmpty: resumeInstruction.length === 0,
|
|
440
433
|
},
|
|
441
434
|
});
|
|
442
435
|
if (resumed != null)
|
|
@@ -453,12 +446,12 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
453
446
|
throw error;
|
|
454
447
|
}
|
|
455
448
|
try {
|
|
456
|
-
|
|
449
|
+
{
|
|
457
450
|
const materializeAdmission = async (ticketNumber) => {
|
|
458
451
|
await materializeCountersignInvocation(admitted, {
|
|
459
452
|
home: env.home,
|
|
460
453
|
principalAuthority: env.principalAuthority,
|
|
461
|
-
|
|
454
|
+
attachmentPaths: parsed.attachmentPaths ?? [],
|
|
462
455
|
...(env.model === undefined ? {} : { model: env.model }),
|
|
463
456
|
...(ticketNumber === undefined ? {} : { ticketNumber }),
|
|
464
457
|
});
|
|
@@ -472,10 +465,7 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
472
465
|
const turnProjection = roleTurnOptions(env, admitted, {
|
|
473
466
|
kind: "initial",
|
|
474
467
|
prompt: (env.reviewReask ?? env.gateReviewInstruction)
|
|
475
|
-
?? buildInstructionTransportPrompt(admitted,
|
|
476
|
-
...pickEngineAxis(env),
|
|
477
|
-
packageRoot: env.packageRoot,
|
|
478
|
-
})),
|
|
468
|
+
?? buildInstructionTransportPrompt(admitted),
|
|
479
469
|
});
|
|
480
470
|
const turnRequest = buildInstructionSeatTurnRequest(admitted, turnProjection);
|
|
481
471
|
const result = await runPostAdmissionOneShot({
|
|
@@ -496,7 +486,7 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
496
486
|
});
|
|
497
487
|
await relocateAdmittedRunToTicket(admitted, env.principalAuthority);
|
|
498
488
|
return result;
|
|
499
|
-
}
|
|
489
|
+
}
|
|
500
490
|
}
|
|
501
491
|
catch (error) {
|
|
502
492
|
const rejected = usageExit(error, io);
|
|
@@ -567,7 +557,7 @@ export async function runPublicInstructionSeat(argv, env, io, role, parseArgv) {
|
|
|
567
557
|
const summons = {
|
|
568
558
|
...sameParentInstruction(env, {
|
|
569
559
|
instruction: parsed.instruction ?? "",
|
|
570
|
-
instructionEmpty: (parsed.instruction ?? "").
|
|
560
|
+
instructionEmpty: (parsed.instruction ?? "").length === 0,
|
|
571
561
|
}),
|
|
572
562
|
attachmentPaths: parsed.attachmentPaths ?? [],
|
|
573
563
|
};
|
|
@@ -593,7 +583,7 @@ export async function runPublicInstructionSeat(argv, env, io, role, parseArgv) {
|
|
|
593
583
|
sourceRunPath: parentRunPath,
|
|
594
584
|
...sameParentInstruction(env, {
|
|
595
585
|
instruction: parsed.instruction ?? "",
|
|
596
|
-
instructionEmpty: (parsed.instruction ?? "").
|
|
586
|
+
instructionEmpty: (parsed.instruction ?? "").length === 0,
|
|
597
587
|
}),
|
|
598
588
|
attachmentPaths: parsed.attachmentPaths ?? [],
|
|
599
589
|
};
|
|
@@ -679,7 +669,7 @@ export async function runPublicInstructionSeat(argv, env, io, role, parseArgv) {
|
|
|
679
669
|
instruction: parsed.instruction ?? "",
|
|
680
670
|
projectRoot: admitted.projectRoot,
|
|
681
671
|
failureLabel: "secretariat unbound summons",
|
|
682
|
-
attachmentPaths: admitted.attachments.map((attachment) => attachment.
|
|
672
|
+
attachmentPaths: admitted.attachments.map((attachment) => attachment.path),
|
|
683
673
|
correlationId: admitted.runId,
|
|
684
674
|
}, env, io);
|
|
685
675
|
}
|