@akagilnc/pi-workflow-roles 0.1.5575 → 0.1.5583
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +1 -1
- package/dist/acp-host/production-host.js +115 -159
- package/dist/headless-host/production-host.js +42 -86
- package/dist/migrate-book-topology.js +0 -2
- package/dist/package-resources/engine-material.js +22 -25
- package/dist/public-cli/instruction-seat-run.js +3 -13
- package/dist/public-cli/invocation.js +6 -6
- package/dist/public-cli/main.js +115 -192
- package/dist/public-cli/post-admission.js +1 -8
- package/dist/public-cli/run-lifecycle.js +4 -7
- package/package.json +1 -1
- package/src/package-resources/engine-material.ts +42 -35
- package/src/public-cli/instruction-seat-run.ts +3 -19
- package/src/public-cli/invocation.ts +5 -9
- package/src/public-cli/post-admission.ts +1 -8
- package/src/public-cli/run-lifecycle.ts +4 -18
- package/src/role-runtime.ts +18 -16
|
@@ -3597,7 +3597,7 @@ var init_host_session_record = __esm({
|
|
|
3597
3597
|
});
|
|
3598
3598
|
|
|
3599
3599
|
// src/package-resources/engine-material.ts
|
|
3600
|
-
import { existsSync as existsSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
3600
|
+
import { existsSync as existsSync2, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
3601
3601
|
import { join as join8 } from "node:path";
|
|
3602
3602
|
function pickEngineAxis(source) {
|
|
3603
3603
|
return {
|
|
@@ -3621,6 +3621,9 @@ function isEngineNameSyntax(name) {
|
|
|
3621
3621
|
function resolveEngineMaterialDirectory(packageRoot) {
|
|
3622
3622
|
return join8(packageRoot, ENGINE_MATERIAL_RELATIVE_ROOT);
|
|
3623
3623
|
}
|
|
3624
|
+
function resolveEngineDispatchMaterialPath(packageRoot) {
|
|
3625
|
+
return join8(packageRoot, ENGINE_DISPATCH_RELATIVE_PATH);
|
|
3626
|
+
}
|
|
3624
3627
|
function resolveEngineMaterialPath(packageRoot, name) {
|
|
3625
3628
|
const legal = assertLegalEngineName(name);
|
|
3626
3629
|
return join8(resolveEngineMaterialDirectory(packageRoot), `${legal}.md`);
|
|
@@ -3640,37 +3643,30 @@ function engineSessionMaterialFromOptions(options) {
|
|
|
3640
3643
|
const model = options.engineModel === void 0 ? void 0 : assertLegalEngineModel(options.engineModel);
|
|
3641
3644
|
const materialPath = resolveEngineMaterialPath(options.packageRoot, name);
|
|
3642
3645
|
const modelField = model === void 0 ? {} : { model };
|
|
3643
|
-
if (existsSync2(materialPath)) {
|
|
3644
|
-
return Object.freeze({ name,
|
|
3646
|
+
if (!existsSync2(materialPath)) {
|
|
3647
|
+
return Object.freeze({ name, ...modelField });
|
|
3645
3648
|
}
|
|
3646
|
-
|
|
3649
|
+
const handbook = readFileSync2(materialPath, "utf8");
|
|
3650
|
+
const dispatchPath = resolveEngineDispatchMaterialPath(options.packageRoot);
|
|
3651
|
+
const dispatchField = existsSync2(dispatchPath) ? { dispatchHandbook: readFileSync2(dispatchPath, "utf8") } : {};
|
|
3652
|
+
return Object.freeze({ name, handbook, ...dispatchField, ...modelField });
|
|
3647
3653
|
}
|
|
3648
|
-
function
|
|
3649
|
-
if (engineMaterial === void 0)
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
if (engineMaterial.model !== void 0) {
|
|
3658
|
-
out.push(`- engineModel: ${engineMaterial.model}`);
|
|
3659
|
-
}
|
|
3660
|
-
out.push(`- ${engineMaterial.materialPath}`);
|
|
3661
|
-
} else {
|
|
3662
|
-
out.push(`- engine: ${engineMaterial.name}`);
|
|
3663
|
-
if (engineMaterial.model !== void 0) {
|
|
3664
|
-
out.push(`- engineModel: ${engineMaterial.model}`);
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
return out;
|
|
3654
|
+
function engineSessionReadingMaterial(engineMaterial) {
|
|
3655
|
+
if (engineMaterial === void 0) return void 0;
|
|
3656
|
+
return {
|
|
3657
|
+
kind: "engine-session-material",
|
|
3658
|
+
name: engineMaterial.name,
|
|
3659
|
+
...engineMaterial.model === void 0 ? {} : { model: engineMaterial.model },
|
|
3660
|
+
...engineMaterial.handbook === void 0 ? {} : { handbook: engineMaterial.handbook },
|
|
3661
|
+
...engineMaterial.dispatchHandbook === void 0 ? {} : { dispatchHandbook: engineMaterial.dispatchHandbook }
|
|
3662
|
+
};
|
|
3668
3663
|
}
|
|
3669
|
-
var ENGINE_MATERIAL_RELATIVE_ROOT;
|
|
3664
|
+
var ENGINE_MATERIAL_RELATIVE_ROOT, ENGINE_DISPATCH_RELATIVE_PATH;
|
|
3670
3665
|
var init_engine_material = __esm({
|
|
3671
3666
|
"src/package-resources/engine-material.ts"() {
|
|
3672
3667
|
"use strict";
|
|
3673
3668
|
ENGINE_MATERIAL_RELATIVE_ROOT = "resources/engines";
|
|
3669
|
+
ENGINE_DISPATCH_RELATIVE_PATH = "resources/engine-dispatch.md";
|
|
3674
3670
|
}
|
|
3675
3671
|
});
|
|
3676
3672
|
|
|
@@ -9212,13 +9208,13 @@ function admittedTransportPromptKind(admitted) {
|
|
|
9212
9208
|
if (record !== void 0 && "transportPrompt" in record) return record.transportPrompt;
|
|
9213
9209
|
return "instruction";
|
|
9214
9210
|
}
|
|
9215
|
-
function buildInstructionTransportPrompt(admitted
|
|
9211
|
+
function buildInstructionTransportPrompt(admitted) {
|
|
9216
9212
|
const kind = admittedTransportPromptKind(admitted);
|
|
9217
9213
|
if (kind === "fixed-kickoff") {
|
|
9218
9214
|
if (admitted.sourceRunPath === void 0 || admitted.sourceRunPath.trim() === "") {
|
|
9219
9215
|
throw new Error("fixed-kickoff transport prompt is missing the source run pointer");
|
|
9220
9216
|
}
|
|
9221
|
-
return
|
|
9217
|
+
return admitted.sourceRunPath;
|
|
9222
9218
|
}
|
|
9223
9219
|
if (kind === "baseline") {
|
|
9224
9220
|
if (admitted.baseRevision === void 0) {
|
|
@@ -9228,7 +9224,7 @@ function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
9228
9224
|
if (!admitted.instructionEmpty) {
|
|
9229
9225
|
lines2.push("", admitted.instruction);
|
|
9230
9226
|
}
|
|
9231
|
-
return
|
|
9227
|
+
return lines2.join("\n");
|
|
9232
9228
|
}
|
|
9233
9229
|
if (kind === "skill-args") {
|
|
9234
9230
|
if (admitted.baseRevision === void 0 || admitted.lens === void 0 || admitted.authorityRefs === void 0) {
|
|
@@ -9242,7 +9238,7 @@ function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
9242
9238
|
if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
|
|
9243
9239
|
lines2.push("", admitted.instruction);
|
|
9244
9240
|
}
|
|
9245
|
-
return
|
|
9241
|
+
return lines2.join("\n");
|
|
9246
9242
|
}
|
|
9247
9243
|
const lines = [admitted.instructionEmpty ? "" : admitted.instruction];
|
|
9248
9244
|
if (admitted.attachments.length > 0) {
|
|
@@ -9252,7 +9248,7 @@ function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
9252
9248
|
lines.push(`- ${attachment.frozenPath}`);
|
|
9253
9249
|
}
|
|
9254
9250
|
}
|
|
9255
|
-
return
|
|
9251
|
+
return lines.join("\n");
|
|
9256
9252
|
}
|
|
9257
9253
|
async function materializeCountersignInvocation(admitted, options) {
|
|
9258
9254
|
const placed = await placeRoleAdmission({
|
|
@@ -9655,7 +9651,6 @@ var init_invocation = __esm({
|
|
|
9655
9651
|
init_uuidv7();
|
|
9656
9652
|
init_notary_contracts();
|
|
9657
9653
|
init_notary_source_run();
|
|
9658
|
-
init_engine_material();
|
|
9659
9654
|
init_cli_errors();
|
|
9660
9655
|
init_option_definitions();
|
|
9661
9656
|
init_unknown_value();
|
|
@@ -11229,7 +11224,7 @@ var init_role_turn_host = __esm({
|
|
|
11229
11224
|
});
|
|
11230
11225
|
|
|
11231
11226
|
// src/public-cli/host-providers.ts
|
|
11232
|
-
import { readFileSync as
|
|
11227
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
11233
11228
|
import { join as join18 } from "node:path";
|
|
11234
11229
|
function hostProvidersPath(home) {
|
|
11235
11230
|
if (typeof home !== "string" || home.trim() === "") {
|
|
@@ -11275,7 +11270,7 @@ function parseHostProvidersTable(value) {
|
|
|
11275
11270
|
function loadHostProvidersTable(home) {
|
|
11276
11271
|
const path = hostProvidersPath(home);
|
|
11277
11272
|
try {
|
|
11278
|
-
const raw =
|
|
11273
|
+
const raw = readFileSync3(path, "utf8");
|
|
11279
11274
|
return parseHostProvidersTable(JSON.parse(raw));
|
|
11280
11275
|
} catch (error) {
|
|
11281
11276
|
if (isEnoent(error)) return {};
|
|
@@ -11291,7 +11286,7 @@ function listHermesProvidersForModel(home, seatModel) {
|
|
|
11291
11286
|
const path = hermesProviderModelsCachePath(home);
|
|
11292
11287
|
let text;
|
|
11293
11288
|
try {
|
|
11294
|
-
text =
|
|
11289
|
+
text = readFileSync3(path, "utf8");
|
|
11295
11290
|
} catch (error) {
|
|
11296
11291
|
if (isEnoent(error)) return [];
|
|
11297
11292
|
throw error;
|
|
@@ -13738,13 +13733,7 @@ async function runPostAdmissionOneShot(input) {
|
|
|
13738
13733
|
...input.request,
|
|
13739
13734
|
continuation: {
|
|
13740
13735
|
kind: "resume",
|
|
13741
|
-
prompt: buildAutoResumeContinuationPrompt(
|
|
13742
|
-
packageRoot: input.env.packageRoot,
|
|
13743
|
-
...pickEngineAxis({
|
|
13744
|
-
engine: input.effectiveEngine ?? input.env.engine,
|
|
13745
|
-
engineModel: input.env.engineModel
|
|
13746
|
-
})
|
|
13747
|
-
})
|
|
13736
|
+
prompt: buildAutoResumeContinuationPrompt()
|
|
13748
13737
|
}
|
|
13749
13738
|
}),
|
|
13750
13739
|
adapters: input.adapters,
|
|
@@ -13828,7 +13817,6 @@ var init_post_admission = __esm({
|
|
|
13828
13817
|
init_submission_ledger();
|
|
13829
13818
|
init_run_ticket_number();
|
|
13830
13819
|
init_activation_ledger_topology();
|
|
13831
|
-
init_engine_material();
|
|
13832
13820
|
init_session_identity();
|
|
13833
13821
|
init_sitian_facade();
|
|
13834
13822
|
init_receipt_delivery_policy();
|
|
@@ -14059,13 +14047,7 @@ function initialPrompt(admitted, env) {
|
|
|
14059
14047
|
if (reask !== void 0 && "reaskPrompt" in record && record.reaskPrompt === true) {
|
|
14060
14048
|
return reask;
|
|
14061
14049
|
}
|
|
14062
|
-
return buildInstructionTransportPrompt(
|
|
14063
|
-
admitted,
|
|
14064
|
-
engineSessionMaterialFromOptions({
|
|
14065
|
-
...pickEngineAxis(env),
|
|
14066
|
-
packageRoot: env.packageRoot
|
|
14067
|
-
})
|
|
14068
|
-
);
|
|
14050
|
+
return buildInstructionTransportPrompt(admitted);
|
|
14069
14051
|
}
|
|
14070
14052
|
function isBoardTicketSeat(seat) {
|
|
14071
14053
|
return packagedBindsBoardTicket(seat.role);
|
|
@@ -14159,10 +14141,7 @@ async function dispatchAdmitted(admitted, env, io) {
|
|
|
14159
14141
|
admitted,
|
|
14160
14142
|
roleTurnOptions(activeEnv, admitted, {
|
|
14161
14143
|
kind: "resume",
|
|
14162
|
-
prompt: buildAutoResumeContinuationPrompt(
|
|
14163
|
-
packageRoot: activeEnv.packageRoot,
|
|
14164
|
-
...pickEngineAxis(activeEnv)
|
|
14165
|
-
})
|
|
14144
|
+
prompt: buildAutoResumeContinuationPrompt()
|
|
14166
14145
|
})
|
|
14167
14146
|
),
|
|
14168
14147
|
adapters,
|
|
@@ -14328,13 +14307,7 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
14328
14307
|
}
|
|
14329
14308
|
const turnProjection = roleTurnOptions(env, admitted, {
|
|
14330
14309
|
kind: "initial",
|
|
14331
|
-
prompt: env.reviewReask ?? env.gateReviewInstruction ?? buildInstructionTransportPrompt(
|
|
14332
|
-
admitted,
|
|
14333
|
-
engineSessionMaterialFromOptions({
|
|
14334
|
-
...pickEngineAxis(env),
|
|
14335
|
-
packageRoot: env.packageRoot
|
|
14336
|
-
})
|
|
14337
|
-
)
|
|
14310
|
+
prompt: env.reviewReask ?? env.gateReviewInstruction ?? buildInstructionTransportPrompt(admitted)
|
|
14338
14311
|
});
|
|
14339
14312
|
const turnRequest = buildInstructionSeatTurnRequest(admitted, turnProjection);
|
|
14340
14313
|
const result = await runPostAdmissionOneShot({
|
|
@@ -15031,7 +15004,6 @@ var init_instruction_seat_run = __esm({
|
|
|
15031
15004
|
init_submission_gate();
|
|
15032
15005
|
init_run_ticket_number();
|
|
15033
15006
|
init_notary_source_run();
|
|
15034
|
-
init_engine_material();
|
|
15035
15007
|
init_packaged_role_registry();
|
|
15036
15008
|
init_auditor_soul();
|
|
15037
15009
|
init_cli_errors();
|
|
@@ -19130,14 +19102,8 @@ __export(run_lifecycle_exports, {
|
|
|
19130
19102
|
});
|
|
19131
19103
|
import { chmod, lstat as lstat4, open as open2, readdir as readdir4, readFile as readFile16, unlink as unlink2 } from "node:fs/promises";
|
|
19132
19104
|
import { basename as basename13, join as join31 } from "node:path";
|
|
19133
|
-
function buildAutoResumeContinuationPrompt(
|
|
19134
|
-
return
|
|
19135
|
-
[RESUME_TRANSPORT_ENVELOPE],
|
|
19136
|
-
engineSessionMaterialFromOptions({
|
|
19137
|
-
packageRoot: options.packageRoot,
|
|
19138
|
-
...pickEngineAxis(options)
|
|
19139
|
-
})
|
|
19140
|
-
).join("\n");
|
|
19105
|
+
function buildAutoResumeContinuationPrompt() {
|
|
19106
|
+
return RESUME_TRANSPORT_ENVELOPE;
|
|
19141
19107
|
}
|
|
19142
19108
|
async function writeRoleRunState(runDirectory, record) {
|
|
19143
19109
|
const payload = { ...record, runDirectory };
|
|
@@ -20111,7 +20077,6 @@ var init_run_lifecycle = __esm({
|
|
|
20111
20077
|
init_cli_errors();
|
|
20112
20078
|
init_collector_config();
|
|
20113
20079
|
init_role_run_relocation();
|
|
20114
|
-
init_engine_material();
|
|
20115
20080
|
init_packaged_role_registry();
|
|
20116
20081
|
init_invocation();
|
|
20117
20082
|
init_run_dossier();
|
|
@@ -20220,7 +20185,7 @@ import {
|
|
|
20220
20185
|
existsSync as existsSync11,
|
|
20221
20186
|
openSync,
|
|
20222
20187
|
readdirSync as readdirSync3,
|
|
20223
|
-
readFileSync as
|
|
20188
|
+
readFileSync as readFileSync4,
|
|
20224
20189
|
readSync,
|
|
20225
20190
|
realpathSync as realpathSync3,
|
|
20226
20191
|
statSync as statSync7,
|
|
@@ -20231,7 +20196,7 @@ import { StringDecoder } from "node:string_decoder";
|
|
|
20231
20196
|
function readCurrentSession(sessionDir) {
|
|
20232
20197
|
const ledger = currentSessionLedgerPath(sessionDir);
|
|
20233
20198
|
try {
|
|
20234
|
-
const value = JSON.parse(
|
|
20199
|
+
const value = JSON.parse(readFileSync4(ledger, "utf8"));
|
|
20235
20200
|
if (typeof value !== "object" || value === null || typeof value.sessionFile !== "string" || value.sessionFile.length === 0) {
|
|
20236
20201
|
throw new Error("sessionFile is missing");
|
|
20237
20202
|
}
|
|
@@ -22315,7 +22280,7 @@ init_unknown_value();
|
|
|
22315
22280
|
init_submission_errors();
|
|
22316
22281
|
init_worker_submission_contracts();
|
|
22317
22282
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
22318
|
-
import { existsSync as existsSync13, lstatSync as lstatSync3, readdirSync as readdirSync4, readFileSync as
|
|
22283
|
+
import { existsSync as existsSync13, lstatSync as lstatSync3, readdirSync as readdirSync4, readFileSync as readFileSync5, rmdirSync, rmSync as rmSync3 } from "node:fs";
|
|
22319
22284
|
import { resolve as resolve20 } from "node:path";
|
|
22320
22285
|
var WORKER_SUBMISSION_GATE_RECORD_KIND = WORKER_SUBMISSION_GATE_KIND;
|
|
22321
22286
|
var WORKER_COMMIT_BASELINE_ENTRY_TYPE = "commit-baseline";
|
|
@@ -22356,7 +22321,7 @@ function tryGetAll(file, key) {
|
|
|
22356
22321
|
}
|
|
22357
22322
|
function ownedHook(path) {
|
|
22358
22323
|
if (!existsSync13(path)) return false;
|
|
22359
|
-
return
|
|
22324
|
+
return readFileSync5(path, "utf8").includes(HOOK_MARKER);
|
|
22360
22325
|
}
|
|
22361
22326
|
function escapeGitConfigValueRegex(value) {
|
|
22362
22327
|
return value.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
@@ -23593,9 +23558,6 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
|
|
|
23593
23558
|
}
|
|
23594
23559
|
});
|
|
23595
23560
|
roleHost.on("before_agent_start", () => {
|
|
23596
|
-
const role = selectedRole ?? roleHost.getFlag(ROLE_FLAG.name);
|
|
23597
|
-
if (typeof role !== "string" || !isOfficerReviewSeat(role)) return;
|
|
23598
|
-
if (roleHost.getFlag(STATION_CHILD_FLAG.name) !== true) return;
|
|
23599
23561
|
const engine = resolveEngineName((name) => roleHost.getFlag(name));
|
|
23600
23562
|
if (engine === void 0 || dependencies.packageRoot === void 0) return;
|
|
23601
23563
|
const engineModel = resolveEngineModel((name) => roleHost.getFlag(name));
|
|
@@ -23604,15 +23566,9 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
|
|
|
23604
23566
|
...engineModel === void 0 ? {} : { engineModel },
|
|
23605
23567
|
packageRoot: dependencies.packageRoot
|
|
23606
23568
|
});
|
|
23607
|
-
|
|
23608
|
-
return
|
|
23609
|
-
|
|
23610
|
-
kind: "engine-session-material",
|
|
23611
|
-
name: material.name,
|
|
23612
|
-
...material.model === void 0 ? {} : { model: material.model },
|
|
23613
|
-
...material.materialPath === void 0 ? {} : { materialPath: material.materialPath }
|
|
23614
|
-
}
|
|
23615
|
-
};
|
|
23569
|
+
const reading = engineSessionReadingMaterial(material);
|
|
23570
|
+
if (reading === void 0) return;
|
|
23571
|
+
return { readingMaterial: reading };
|
|
23616
23572
|
});
|
|
23617
23573
|
roleHost.on("before_agent_start", () => {
|
|
23618
23574
|
const path = roleHost.getFlag(INSPECTOR_SOURCE_RUN_FLAG.name);
|
|
@@ -16802,7 +16802,6 @@ var init_invocation = __esm({
|
|
|
16802
16802
|
init_uuidv7();
|
|
16803
16803
|
init_notary_contracts();
|
|
16804
16804
|
init_notary_source_run();
|
|
16805
|
-
init_engine_material();
|
|
16806
16805
|
init_cli_errors();
|
|
16807
16806
|
init_option_definitions();
|
|
16808
16807
|
init_unknown_value();
|
|
@@ -16856,7 +16855,6 @@ var init_run_lifecycle = __esm({
|
|
|
16856
16855
|
init_cli_errors();
|
|
16857
16856
|
init_collector_config();
|
|
16858
16857
|
init_role_run_relocation();
|
|
16859
|
-
init_engine_material();
|
|
16860
16858
|
init_packaged_role_registry();
|
|
16861
16859
|
init_invocation();
|
|
16862
16860
|
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,7 +24,6 @@ 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";
|
|
@@ -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 }),
|
|
@@ -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({
|
|
@@ -25,7 +25,6 @@ import { rehomeUnboundTicketProvenance } from "../ticket-provenance.js";
|
|
|
25
25
|
import { uuidv7 } from "../uuidv7.js";
|
|
26
26
|
import {} from "../notary-contracts.js";
|
|
27
27
|
import { NotarySourceRunError, resolveNotarySourceRunLocator, } from "../notary-source-run.js";
|
|
28
|
-
import { appendEngineSessionMaterial, } from "../package-resources/engine-material.js";
|
|
29
28
|
import { CliUsageError } from "./cli-errors.js";
|
|
30
29
|
import { REJECTED_PUBLIC_SPELLINGS, createTypedOptionConsumer, evaluateAnalystModeOptionContract, optionsForOwner, resolveAnalystMode, } from "./option-definitions.js";
|
|
31
30
|
import { errorText, isRecord } from "../unknown-value.js";
|
|
@@ -1246,14 +1245,15 @@ function admittedTransportPromptKind(admitted) {
|
|
|
1246
1245
|
* One initial prompt transport. The registry `transportPrompt` leaf selects
|
|
1247
1246
|
* a fixed kickoff, a bound baseline, or frozen skill args. Absent means the
|
|
1248
1247
|
* caller instruction plus frozen attachment paths.
|
|
1248
|
+
* Engine / outsourcing material rides startup readingMaterial (#1167), not here.
|
|
1249
1249
|
*/
|
|
1250
|
-
export function buildInstructionTransportPrompt(admitted
|
|
1250
|
+
export function buildInstructionTransportPrompt(admitted) {
|
|
1251
1251
|
const kind = admittedTransportPromptKind(admitted);
|
|
1252
1252
|
if (kind === "fixed-kickoff") {
|
|
1253
1253
|
if (admitted.sourceRunPath === undefined || admitted.sourceRunPath.trim() === "") {
|
|
1254
1254
|
throw new Error("fixed-kickoff transport prompt is missing the source run pointer");
|
|
1255
1255
|
}
|
|
1256
|
-
return
|
|
1256
|
+
return admitted.sourceRunPath;
|
|
1257
1257
|
}
|
|
1258
1258
|
if (kind === "baseline") {
|
|
1259
1259
|
if (admitted.baseRevision === undefined) {
|
|
@@ -1263,7 +1263,7 @@ export function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
1263
1263
|
if (!admitted.instructionEmpty) {
|
|
1264
1264
|
lines.push("", admitted.instruction);
|
|
1265
1265
|
}
|
|
1266
|
-
return
|
|
1266
|
+
return lines.join("\n");
|
|
1267
1267
|
}
|
|
1268
1268
|
if (kind === "skill-args") {
|
|
1269
1269
|
if (admitted.baseRevision === undefined
|
|
@@ -1279,7 +1279,7 @@ export function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
1279
1279
|
if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
|
|
1280
1280
|
lines.push("", admitted.instruction);
|
|
1281
1281
|
}
|
|
1282
|
-
return
|
|
1282
|
+
return lines.join("\n");
|
|
1283
1283
|
}
|
|
1284
1284
|
const lines = [admitted.instructionEmpty ? "" : admitted.instruction];
|
|
1285
1285
|
if (admitted.attachments.length > 0) {
|
|
@@ -1289,7 +1289,7 @@ export function buildInstructionTransportPrompt(admitted, engineMaterial) {
|
|
|
1289
1289
|
lines.push(`- ${attachment.frozenPath}`);
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
|
-
return
|
|
1292
|
+
return lines.join("\n");
|
|
1293
1293
|
}
|
|
1294
1294
|
/** Persist a deferred Countersign admission after same-ticket lookup found no retained run. */
|
|
1295
1295
|
export async function materializeCountersignInvocation(admitted, options) {
|