@akagilnc/pi-workflow-roles 0.1.3986 → 0.1.3995
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 +4 -0
- package/README.zh-CN.md +4 -0
- package/dist/acp-host/production-host.js +242 -121
- package/dist/engine-detour-tool.js +8 -2
- package/dist/engine-detour.js +9 -0
- package/dist/headless-host/production-host.js +250 -129
- package/dist/package-resources/engine-material.js +24 -2
- package/dist/public-cli/config.js +76 -12
- package/dist/public-cli/diarist-run.js +3 -3
- package/dist/public-cli/doctor-run.js +6 -3
- package/dist/public-cli/inspector-run.js +3 -3
- package/dist/public-cli/instruction-seat-run.js +3 -3
- package/dist/public-cli/invocation.js +10 -4
- package/dist/public-cli/judge-run.js +5 -5
- package/dist/public-cli/main.js +242 -71
- package/dist/public-cli/notary-run.js +3 -3
- package/dist/public-cli/option-definitions.js +5 -1
- package/dist/public-cli/post-admission.js +9 -6
- package/dist/public-cli/run-lifecycle.js +10 -4
- package/dist/public-cli/turn-request.js +2 -1
- package/dist/public-role-summons.js +2 -1
- package/package.json +1 -1
- package/souls/fixer.md +1 -1
- package/src/engine-detour-tool.ts +13 -2
- package/src/engine-detour.ts +17 -0
- package/src/host-contracts.ts +2 -0
- package/src/package-resources/engine-material.ts +39 -2
- package/src/public-cli/cli.ts +83 -12
- package/src/public-cli/coder-run.ts +5 -5
- package/src/public-cli/collector-run.ts +9 -3
- package/src/public-cli/config.ts +108 -15
- package/src/public-cli/countersign-run.ts +3 -3
- package/src/public-cli/diarist-run.ts +3 -3
- package/src/public-cli/doctor-run.ts +9 -3
- package/src/public-cli/fixer-run.ts +5 -5
- package/src/public-cli/gleaner-left-run.ts +3 -3
- package/src/public-cli/inspector-run.ts +3 -3
- package/src/public-cli/instruction-seat-run.ts +3 -3
- package/src/public-cli/invocation.ts +9 -3
- package/src/public-cli/judge-run.ts +5 -5
- package/src/public-cli/merger-run.ts +6 -5
- package/src/public-cli/notary-run.ts +3 -3
- package/src/public-cli/option-definitions.ts +5 -1
- package/src/public-cli/post-admission.ts +17 -6
- package/src/public-cli/reviewer-run.ts +5 -5
- package/src/public-cli/run-lifecycle.ts +10 -1
- package/src/public-cli/turn-request.ts +4 -1
- package/src/public-role-summons.ts +7 -3
- package/src/role-envelope.ts +8 -3
|
@@ -178,13 +178,20 @@ function resolveEngineName(getFlag) {
|
|
|
178
178
|
}
|
|
179
179
|
return engineNameFromEnv();
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
function resolveEngineModel(getFlag) {
|
|
182
|
+
if (getFlag === void 0) return void 0;
|
|
183
|
+
const flag = getFlag(ENGINE_MODEL_FLAG_NAME);
|
|
184
|
+
if (typeof flag !== "string") return void 0;
|
|
185
|
+
return normalizeEngineName(flag);
|
|
186
|
+
}
|
|
187
|
+
var ENGINE_DETOUR_TOOL_NAME, AK_ROLE_ENGINE_ENV, ENGINE_FLAG_NAME, ENGINE_MODEL_FLAG_NAME, ENGINE_DETOUR_STAGED_PROMPT_TOKEN, ENGINE_DETOUR_EMPTY_STDOUT_DIAGNOSTIC;
|
|
182
188
|
var init_engine_detour = __esm({
|
|
183
189
|
"src/engine-detour.ts"() {
|
|
184
190
|
"use strict";
|
|
185
191
|
ENGINE_DETOUR_TOOL_NAME = "ak_engine_detour";
|
|
186
192
|
AK_ROLE_ENGINE_ENV = "AK_ROLE_ENGINE";
|
|
187
193
|
ENGINE_FLAG_NAME = "ak-engine";
|
|
194
|
+
ENGINE_MODEL_FLAG_NAME = "ak-engine-model";
|
|
188
195
|
ENGINE_DETOUR_STAGED_PROMPT_TOKEN = "<<ak-engine-staged-prompt>>";
|
|
189
196
|
ENGINE_DETOUR_EMPTY_STDOUT_DIAGNOSTIC = "\u52B3\u52A1\u5F15\u64CE stdout \u4E3A\u7A7A";
|
|
190
197
|
}
|
|
@@ -1009,6 +1016,84 @@ var init_gatekeeper_output = __esm({
|
|
|
1009
1016
|
}
|
|
1010
1017
|
});
|
|
1011
1018
|
|
|
1019
|
+
// src/package-resources/engine-material.ts
|
|
1020
|
+
import { existsSync as existsSync2, readdirSync } from "node:fs";
|
|
1021
|
+
import { join as join6 } from "node:path";
|
|
1022
|
+
function pickEngineAxis(source) {
|
|
1023
|
+
return {
|
|
1024
|
+
...source.engine === void 0 ? {} : { engine: source.engine },
|
|
1025
|
+
...source.engineModel === void 0 ? {} : { engineModel: source.engineModel }
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
function assertLegalEngineModel(model) {
|
|
1029
|
+
if (typeof model !== "string" || model.trim() === "" || model.trim() !== model) {
|
|
1030
|
+
throw new Error(`illegal engine model: ${JSON.stringify(model)}`);
|
|
1031
|
+
}
|
|
1032
|
+
return model;
|
|
1033
|
+
}
|
|
1034
|
+
function isEngineNameSyntax(name) {
|
|
1035
|
+
if (typeof name !== "string") return false;
|
|
1036
|
+
if (name.length === 0 || name.trim() !== name) return false;
|
|
1037
|
+
if (name === "." || name === "..") return false;
|
|
1038
|
+
if (name.includes("/") || name.includes("\\") || name.includes("\0")) return false;
|
|
1039
|
+
return true;
|
|
1040
|
+
}
|
|
1041
|
+
function resolveEngineMaterialDirectory(packageRoot) {
|
|
1042
|
+
return join6(packageRoot, ENGINE_MATERIAL_RELATIVE_ROOT);
|
|
1043
|
+
}
|
|
1044
|
+
function resolveEngineMaterialPath(packageRoot, name) {
|
|
1045
|
+
const legal = assertLegalEngineName(name);
|
|
1046
|
+
return join6(resolveEngineMaterialDirectory(packageRoot), `${legal}.md`);
|
|
1047
|
+
}
|
|
1048
|
+
function assertLegalEngineName(name) {
|
|
1049
|
+
if (!isEngineNameSyntax(name)) {
|
|
1050
|
+
throw new Error(`illegal engine name: ${name}`);
|
|
1051
|
+
}
|
|
1052
|
+
return name;
|
|
1053
|
+
}
|
|
1054
|
+
function engineSessionMaterialFromOptions(options) {
|
|
1055
|
+
if (options.engine === void 0) return void 0;
|
|
1056
|
+
if (options.packageRoot === void 0 || options.packageRoot.trim() === "") {
|
|
1057
|
+
throw new Error("packageRoot is required when engine is configured");
|
|
1058
|
+
}
|
|
1059
|
+
const name = assertLegalEngineName(options.engine);
|
|
1060
|
+
const model = options.engineModel === void 0 ? void 0 : assertLegalEngineModel(options.engineModel);
|
|
1061
|
+
const materialPath = resolveEngineMaterialPath(options.packageRoot, name);
|
|
1062
|
+
const modelField = model === void 0 ? {} : { model };
|
|
1063
|
+
if (existsSync2(materialPath)) {
|
|
1064
|
+
return Object.freeze({ name, materialPath, ...modelField });
|
|
1065
|
+
}
|
|
1066
|
+
return Object.freeze({ name, ...modelField });
|
|
1067
|
+
}
|
|
1068
|
+
function appendEngineSessionMaterial(lines, engineMaterial) {
|
|
1069
|
+
if (engineMaterial === void 0) {
|
|
1070
|
+
return [...lines];
|
|
1071
|
+
}
|
|
1072
|
+
const out = [...lines];
|
|
1073
|
+
out.push("");
|
|
1074
|
+
if (engineMaterial.materialPath !== void 0) {
|
|
1075
|
+
out.push("\u672C\u6B21\u914D\u7F6E\u7684\u52B3\u52A1\u5F15\u64CE\u53CA\u5176\u624B\u518C\uFF1A");
|
|
1076
|
+
out.push(`- engine: ${engineMaterial.name}`);
|
|
1077
|
+
if (engineMaterial.model !== void 0) {
|
|
1078
|
+
out.push(`- engineModel: ${engineMaterial.model}`);
|
|
1079
|
+
}
|
|
1080
|
+
out.push(`- ${engineMaterial.materialPath}`);
|
|
1081
|
+
} else {
|
|
1082
|
+
out.push(`- engine: ${engineMaterial.name}`);
|
|
1083
|
+
if (engineMaterial.model !== void 0) {
|
|
1084
|
+
out.push(`- engineModel: ${engineMaterial.model}`);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
return out;
|
|
1088
|
+
}
|
|
1089
|
+
var ENGINE_MATERIAL_RELATIVE_ROOT;
|
|
1090
|
+
var init_engine_material = __esm({
|
|
1091
|
+
"src/package-resources/engine-material.ts"() {
|
|
1092
|
+
"use strict";
|
|
1093
|
+
ENGINE_MATERIAL_RELATIVE_ROOT = "resources/engines";
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1012
1097
|
// src/pi/durable-principal.ts
|
|
1013
1098
|
var durable_principal_exports = {};
|
|
1014
1099
|
__export(durable_principal_exports, {
|
|
@@ -1016,25 +1101,25 @@ __export(durable_principal_exports, {
|
|
|
1016
1101
|
piDurablePrincipalAuthority: () => piDurablePrincipalAuthority
|
|
1017
1102
|
});
|
|
1018
1103
|
import { lstat } from "node:fs/promises";
|
|
1019
|
-
import { join as
|
|
1104
|
+
import { join as join7 } from "node:path";
|
|
1020
1105
|
function encode(coordinates) {
|
|
1021
1106
|
return coordinates;
|
|
1022
1107
|
}
|
|
1023
1108
|
function issuePiDurablePrincipalCoordinates(request) {
|
|
1024
1109
|
const ledgerHome = resolveActivationLedgerHome(request.home);
|
|
1025
1110
|
const bookKey = resolveBookKeyFromGit(request.cwd);
|
|
1026
|
-
const runDirectory =
|
|
1111
|
+
const runDirectory = join7(
|
|
1027
1112
|
activationBookDirectory(ledgerHome, bookKey),
|
|
1028
1113
|
"runs",
|
|
1029
1114
|
`${request.runId}@${request.role}`
|
|
1030
1115
|
);
|
|
1031
|
-
const sessionDirectory =
|
|
1116
|
+
const sessionDirectory = join7(runDirectory, "session");
|
|
1032
1117
|
return {
|
|
1033
1118
|
ledgerHome,
|
|
1034
1119
|
bookKey,
|
|
1035
1120
|
runDirectory,
|
|
1036
1121
|
sessionDirectory,
|
|
1037
|
-
sessionFile:
|
|
1122
|
+
sessionFile: join7(sessionDirectory, "session.jsonl")
|
|
1038
1123
|
};
|
|
1039
1124
|
}
|
|
1040
1125
|
var piDurablePrincipalAuthority;
|
|
@@ -1067,7 +1152,7 @@ var init_durable_principal = __esm({
|
|
|
1067
1152
|
}
|
|
1068
1153
|
return {
|
|
1069
1154
|
sessionDirectory: record4.sessionDirectory,
|
|
1070
|
-
sessionFile: typeof record4.sessionFile === "string" && record4.sessionFile.trim() !== "" ? record4.sessionFile :
|
|
1155
|
+
sessionFile: typeof record4.sessionFile === "string" && record4.sessionFile.trim() !== "" ? record4.sessionFile : join7(record4.sessionDirectory, "session.jsonl")
|
|
1071
1156
|
};
|
|
1072
1157
|
},
|
|
1073
1158
|
async isAvailable(principal) {
|
|
@@ -1945,12 +2030,12 @@ var init_sitian_contracts = __esm({
|
|
|
1945
2030
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
1946
2031
|
import {
|
|
1947
2032
|
appendFileSync,
|
|
1948
|
-
existsSync as
|
|
2033
|
+
existsSync as existsSync3,
|
|
1949
2034
|
readFileSync as readFileSync2,
|
|
1950
2035
|
unlinkSync,
|
|
1951
2036
|
writeFileSync as writeFileSync2
|
|
1952
2037
|
} from "node:fs";
|
|
1953
|
-
import { basename as basename3, dirname as dirname5, join as
|
|
2038
|
+
import { basename as basename3, dirname as dirname5, join as join8, resolve as resolve5 } from "node:path";
|
|
1954
2039
|
function isRecord(value) {
|
|
1955
2040
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1956
2041
|
}
|
|
@@ -1965,14 +2050,14 @@ function createExclusiveFile(path, contents) {
|
|
|
1965
2050
|
writeFileSync2(path, contents, { encoding: "utf8", flag: "wx" });
|
|
1966
2051
|
}
|
|
1967
2052
|
function sealTornTail(recordFile) {
|
|
1968
|
-
if (!
|
|
2053
|
+
if (!existsSync3(recordFile)) return;
|
|
1969
2054
|
const buffer = readFileSync2(recordFile);
|
|
1970
2055
|
if (buffer.length > 0 && buffer[buffer.length - 1] !== 10) {
|
|
1971
2056
|
appendFileSync(recordFile, "\n", "utf8");
|
|
1972
2057
|
}
|
|
1973
2058
|
}
|
|
1974
2059
|
function findIdentityPointer(recordFile, identity, kind, level) {
|
|
1975
|
-
if (!
|
|
2060
|
+
if (!existsSync3(recordFile)) return void 0;
|
|
1976
2061
|
const text = readFileSync2(recordFile, "utf8");
|
|
1977
2062
|
for (const line2 of text.split("\n")) {
|
|
1978
2063
|
const trimmed = line2.trim();
|
|
@@ -2089,7 +2174,7 @@ function resolveSitianRecordPathInLedger(input, ledgerHome) {
|
|
|
2089
2174
|
const category = resolveSitianVolumeCategory(input.kind);
|
|
2090
2175
|
let sessionDir;
|
|
2091
2176
|
if (input.sessionParent !== void 0 && input.sessionParent.length > 0 && physicallyContainedIn(ledgerHome, input.sessionParent)) {
|
|
2092
|
-
sessionDir =
|
|
2177
|
+
sessionDir = join8(dirname5(input.sessionParent), category);
|
|
2093
2178
|
} else {
|
|
2094
2179
|
const bookKey = safeBookKey(cwd);
|
|
2095
2180
|
const bookDir = activationBookDirectory(ledgerHome, bookKey);
|
|
@@ -2103,12 +2188,12 @@ function resolveSitianRecordPathInLedger(input, ledgerHome) {
|
|
|
2103
2188
|
subjectStr = JSON.stringify(input.subject);
|
|
2104
2189
|
}
|
|
2105
2190
|
const digest = createHash2("sha256").update(subjectStr).digest("hex").slice(0, 32);
|
|
2106
|
-
sessionDir =
|
|
2191
|
+
sessionDir = join8(bookDir, category, digest);
|
|
2107
2192
|
} else {
|
|
2108
|
-
sessionDir =
|
|
2193
|
+
sessionDir = join8(bookDir, category);
|
|
2109
2194
|
}
|
|
2110
2195
|
}
|
|
2111
|
-
const recordFile =
|
|
2196
|
+
const recordFile = join8(sessionDir, "records.jsonl");
|
|
2112
2197
|
return { sessionDir, recordFile, ledgerHome };
|
|
2113
2198
|
}
|
|
2114
2199
|
function resolveSitianRecordPath(input) {
|
|
@@ -2165,13 +2250,13 @@ var init_sitian_appender = __esm({
|
|
|
2165
2250
|
});
|
|
2166
2251
|
|
|
2167
2252
|
// src/sitian-reader.ts
|
|
2168
|
-
import { existsSync as
|
|
2253
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
2169
2254
|
import { readFile } from "node:fs/promises";
|
|
2170
2255
|
function isRecord2(value) {
|
|
2171
2256
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2172
2257
|
}
|
|
2173
2258
|
async function readSitianRecords(recordFile) {
|
|
2174
|
-
if (!
|
|
2259
|
+
if (!existsSync4(recordFile)) {
|
|
2175
2260
|
return { records: [], diagnostics: [] };
|
|
2176
2261
|
}
|
|
2177
2262
|
const text = await readFile(recordFile, "utf8");
|
|
@@ -2240,12 +2325,12 @@ __export(role_turn_host_exports, {
|
|
|
2240
2325
|
import { execFile, spawn as spawn2 } from "node:child_process";
|
|
2241
2326
|
import { constants } from "node:fs";
|
|
2242
2327
|
import { access, appendFile, readFile as readFile2, realpath } from "node:fs/promises";
|
|
2243
|
-
import { basename as basename4, delimiter, dirname as dirname6, isAbsolute as isAbsolute3, join as
|
|
2328
|
+
import { basename as basename4, delimiter, dirname as dirname6, isAbsolute as isAbsolute3, join as join9, resolve as resolve6 } from "node:path";
|
|
2244
2329
|
import { platform } from "node:process";
|
|
2245
2330
|
import { promisify } from "node:util";
|
|
2246
2331
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
2247
2332
|
function resolveInternalRoleEntrypoint(packageRoot) {
|
|
2248
|
-
return
|
|
2333
|
+
return join9(packageRoot, INTERNAL_ROLE_ENTRYPOINT_RELATIVE);
|
|
2249
2334
|
}
|
|
2250
2335
|
function buildExplicitInternalActivationArgs(selectedRoleEntry, extraArgs = []) {
|
|
2251
2336
|
return ["--no-extensions", "-e", selectedRoleEntry, ...extraArgs];
|
|
@@ -2649,7 +2734,7 @@ var init_host_descriptions = __esm({
|
|
|
2649
2734
|
|
|
2650
2735
|
// src/run-ticket-number.ts
|
|
2651
2736
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
2652
|
-
import { join as
|
|
2737
|
+
import { join as join10 } from "node:path";
|
|
2653
2738
|
function isEnoent(error) {
|
|
2654
2739
|
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
2655
2740
|
}
|
|
@@ -2662,7 +2747,7 @@ function ticketFromRecord(record4) {
|
|
|
2662
2747
|
}
|
|
2663
2748
|
async function readPageTicketNumber(runDirectory, page) {
|
|
2664
2749
|
try {
|
|
2665
|
-
const raw = JSON.parse(await readFile3(
|
|
2750
|
+
const raw = JSON.parse(await readFile3(join10(runDirectory, page), "utf8"));
|
|
2666
2751
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
2667
2752
|
return void 0;
|
|
2668
2753
|
}
|
|
@@ -3954,9 +4039,9 @@ var init_uuidv7 = __esm({
|
|
|
3954
4039
|
|
|
3955
4040
|
// src/typed-provider-http.ts
|
|
3956
4041
|
import { readFile as readFile7, unlink, writeFile as writeFile2 } from "node:fs/promises";
|
|
3957
|
-
import { join as
|
|
4042
|
+
import { join as join11 } from "node:path";
|
|
3958
4043
|
function typedProviderHttpPath(runDirectory) {
|
|
3959
|
-
return
|
|
4044
|
+
return join11(runDirectory, TYPED_HTTP_FILE);
|
|
3960
4045
|
}
|
|
3961
4046
|
async function clearTypedProviderHttpObservation(runDirectory) {
|
|
3962
4047
|
try {
|
|
@@ -4015,64 +4100,6 @@ var init_typed_provider_http = __esm({
|
|
|
4015
4100
|
}
|
|
4016
4101
|
});
|
|
4017
4102
|
|
|
4018
|
-
// src/package-resources/engine-material.ts
|
|
4019
|
-
import { existsSync as existsSync4, readdirSync } from "node:fs";
|
|
4020
|
-
import { join as join11 } from "node:path";
|
|
4021
|
-
function isEngineNameSyntax(name) {
|
|
4022
|
-
if (typeof name !== "string") return false;
|
|
4023
|
-
if (name.length === 0 || name.trim() !== name) return false;
|
|
4024
|
-
if (name === "." || name === "..") return false;
|
|
4025
|
-
if (name.includes("/") || name.includes("\\") || name.includes("\0")) return false;
|
|
4026
|
-
return true;
|
|
4027
|
-
}
|
|
4028
|
-
function resolveEngineMaterialDirectory(packageRoot) {
|
|
4029
|
-
return join11(packageRoot, ENGINE_MATERIAL_RELATIVE_ROOT);
|
|
4030
|
-
}
|
|
4031
|
-
function resolveEngineMaterialPath(packageRoot, name) {
|
|
4032
|
-
const legal = assertLegalEngineName(name);
|
|
4033
|
-
return join11(resolveEngineMaterialDirectory(packageRoot), `${legal}.md`);
|
|
4034
|
-
}
|
|
4035
|
-
function assertLegalEngineName(name) {
|
|
4036
|
-
if (!isEngineNameSyntax(name)) {
|
|
4037
|
-
throw new Error(`illegal engine name: ${name}`);
|
|
4038
|
-
}
|
|
4039
|
-
return name;
|
|
4040
|
-
}
|
|
4041
|
-
function engineSessionMaterialFromOptions(options) {
|
|
4042
|
-
if (options.engine === void 0) return void 0;
|
|
4043
|
-
if (options.packageRoot === void 0 || options.packageRoot.trim() === "") {
|
|
4044
|
-
throw new Error("packageRoot is required when engine is configured");
|
|
4045
|
-
}
|
|
4046
|
-
const name = assertLegalEngineName(options.engine);
|
|
4047
|
-
const materialPath = resolveEngineMaterialPath(options.packageRoot, name);
|
|
4048
|
-
if (existsSync4(materialPath)) {
|
|
4049
|
-
return Object.freeze({ name, materialPath });
|
|
4050
|
-
}
|
|
4051
|
-
return Object.freeze({ name });
|
|
4052
|
-
}
|
|
4053
|
-
function appendEngineSessionMaterial(lines, engineMaterial) {
|
|
4054
|
-
if (engineMaterial === void 0) {
|
|
4055
|
-
return [...lines];
|
|
4056
|
-
}
|
|
4057
|
-
const out = [...lines];
|
|
4058
|
-
out.push("");
|
|
4059
|
-
if (engineMaterial.materialPath !== void 0) {
|
|
4060
|
-
out.push("\u672C\u6B21\u914D\u7F6E\u7684\u52B3\u52A1\u5F15\u64CE\u53CA\u5176\u624B\u518C\uFF1A");
|
|
4061
|
-
out.push(`- engine: ${engineMaterial.name}`);
|
|
4062
|
-
out.push(`- ${engineMaterial.materialPath}`);
|
|
4063
|
-
} else {
|
|
4064
|
-
out.push(`- engine: ${engineMaterial.name}`);
|
|
4065
|
-
}
|
|
4066
|
-
return out;
|
|
4067
|
-
}
|
|
4068
|
-
var ENGINE_MATERIAL_RELATIVE_ROOT;
|
|
4069
|
-
var init_engine_material = __esm({
|
|
4070
|
-
"src/package-resources/engine-material.ts"() {
|
|
4071
|
-
"use strict";
|
|
4072
|
-
ENGINE_MATERIAL_RELATIVE_ROOT = "resources/engines";
|
|
4073
|
-
}
|
|
4074
|
-
});
|
|
4075
|
-
|
|
4076
4103
|
// src/public-cli/run-lifecycle.ts
|
|
4077
4104
|
import { chmod, open, readdir as readdir2, readFile as readFile8, unlink as unlink2, writeFile as writeFile3 } from "node:fs/promises";
|
|
4078
4105
|
import { join as join12 } from "node:path";
|
|
@@ -4084,8 +4111,8 @@ function buildResumeContinuationPrompt(options) {
|
|
|
4084
4111
|
return selectResumeContinuationPrompt(
|
|
4085
4112
|
options.message,
|
|
4086
4113
|
engineSessionMaterialFromOptions({
|
|
4087
|
-
|
|
4088
|
-
|
|
4114
|
+
packageRoot: options.packageRoot,
|
|
4115
|
+
...pickEngineAxis(options)
|
|
4089
4116
|
})
|
|
4090
4117
|
);
|
|
4091
4118
|
}
|
|
@@ -4277,7 +4304,7 @@ async function markRunAdmitted(admitted, authority) {
|
|
|
4277
4304
|
...admitted.role === "coder" || admitted.role === "fixer" ? { phase: admitted.phase } : {}
|
|
4278
4305
|
});
|
|
4279
4306
|
}
|
|
4280
|
-
async function markRunRunning(runDirectory, effectiveModel, effectiveEngine, effectiveHost) {
|
|
4307
|
+
async function markRunRunning(runDirectory, effectiveModel, effectiveEngine, effectiveHost, effectiveEngineModel) {
|
|
4281
4308
|
const current = await readRoleRunStateDisk(runDirectory);
|
|
4282
4309
|
if (current === void 0) {
|
|
4283
4310
|
throw new Error("cannot mark running: run state missing");
|
|
@@ -4299,7 +4326,9 @@ async function markRunRunning(runDirectory, effectiveModel, effectiveEngine, eff
|
|
|
4299
4326
|
effectiveModel,
|
|
4300
4327
|
// Authoritative seat projection: absent engine ⇒ null (delete).
|
|
4301
4328
|
effectiveEngine === void 0 ? null : effectiveEngine,
|
|
4302
|
-
effectiveHost
|
|
4329
|
+
effectiveHost,
|
|
4330
|
+
// Authoritative with engine: absent model ⇒ null (delete) when engine axis is written.
|
|
4331
|
+
effectiveEngine === void 0 ? null : effectiveEngineModel === void 0 ? null : effectiveEngineModel
|
|
4303
4332
|
);
|
|
4304
4333
|
}
|
|
4305
4334
|
async function markRunResumable(runDirectory, observation) {
|
|
@@ -6065,8 +6094,10 @@ var init_option_definitions = __esm({
|
|
|
6065
6094
|
usage: [
|
|
6066
6095
|
"ak-role config set <seat> <provider/model[:thinking]> [<seat> <spec> ...]",
|
|
6067
6096
|
"ak-role config unset <gatekeeper|inspector|notary>",
|
|
6068
|
-
"ak-role config set-engine <seat> <name>",
|
|
6097
|
+
"ak-role config set-engine <seat> <name> [model]",
|
|
6069
6098
|
"ak-role config unset-engine <seat>",
|
|
6099
|
+
"ak-role config set-engine-model <seat> <model>",
|
|
6100
|
+
"ak-role config unset-engine-model <seat>",
|
|
6070
6101
|
"ak-role config set-host <seat> <name>",
|
|
6071
6102
|
"ak-role config unset-host <seat>",
|
|
6072
6103
|
"ak-role config set-auto-resume-limit <N>"
|
|
@@ -6075,6 +6106,8 @@ var init_option_definitions = __esm({
|
|
|
6075
6106
|
"ak-role config set judge openai-codex/gpt-5.6-sol:high",
|
|
6076
6107
|
"ak-role config unset gatekeeper",
|
|
6077
6108
|
"ak-role config set-engine judge opus",
|
|
6109
|
+
"ak-role config set-engine coder cursor cursor-grok-4.6-high",
|
|
6110
|
+
"ak-role config set-engine-model coder cursor-grok-4.6-high",
|
|
6078
6111
|
"ak-role config set-host judge grok-build",
|
|
6079
6112
|
"ak-role config set-auto-resume-limit 3"
|
|
6080
6113
|
]
|
|
@@ -6250,7 +6283,7 @@ async function writeRoleInvocationLedger(source, role, effectiveModel) {
|
|
|
6250
6283
|
"utf8"
|
|
6251
6284
|
);
|
|
6252
6285
|
}
|
|
6253
|
-
async function recordEffectiveInvocationModel(runDirectory, model, engine, host) {
|
|
6286
|
+
async function recordEffectiveInvocationModel(runDirectory, model, engine, host, engineModel) {
|
|
6254
6287
|
const ledgerPath = join14(runDirectory, "invocation.json");
|
|
6255
6288
|
const current = JSON.parse(await readFile9(ledgerPath, "utf8"));
|
|
6256
6289
|
const next = { ...current };
|
|
@@ -6268,6 +6301,11 @@ async function recordEffectiveInvocationModel(runDirectory, model, engine, host)
|
|
|
6268
6301
|
} else if (engine !== void 0) {
|
|
6269
6302
|
next.engine = engine;
|
|
6270
6303
|
}
|
|
6304
|
+
if (engineModel === null) {
|
|
6305
|
+
delete next.engineModel;
|
|
6306
|
+
} else if (engineModel !== void 0) {
|
|
6307
|
+
next.engineModel = engineModel;
|
|
6308
|
+
}
|
|
6271
6309
|
if (host !== void 0) {
|
|
6272
6310
|
next.host = host;
|
|
6273
6311
|
}
|
|
@@ -8843,6 +8881,7 @@ __export(config_exports, {
|
|
|
8843
8881
|
setAutoResumeLimit: () => setAutoResumeLimit,
|
|
8844
8882
|
setPersistentSeatConfig: () => setPersistentSeatConfig,
|
|
8845
8883
|
setPersistentSeatEngine: () => setPersistentSeatEngine,
|
|
8884
|
+
setPersistentSeatEngineModel: () => setPersistentSeatEngineModel,
|
|
8846
8885
|
setPersistentSeatHost: () => setPersistentSeatHost,
|
|
8847
8886
|
validatePublicCliConfigAxes: () => validatePublicCliConfigAxes
|
|
8848
8887
|
});
|
|
@@ -8891,7 +8930,7 @@ function setPersistentSeatConfig(config, seat, selection) {
|
|
|
8891
8930
|
[seat]: {
|
|
8892
8931
|
...selection,
|
|
8893
8932
|
// Model rewrite preserves a previously configured engine axis.
|
|
8894
|
-
...previous
|
|
8933
|
+
...pickEngineAxis(previous ?? {}),
|
|
8895
8934
|
...previous?.host === void 0 ? {} : { host: previous.host }
|
|
8896
8935
|
}
|
|
8897
8936
|
}
|
|
@@ -8906,7 +8945,7 @@ function clearPersistentSeatConfig(config, seat) {
|
|
|
8906
8945
|
seats: {
|
|
8907
8946
|
...config.seats,
|
|
8908
8947
|
[seat]: {
|
|
8909
|
-
...previous
|
|
8948
|
+
...pickEngineAxis(previous),
|
|
8910
8949
|
...previous.host === void 0 ? {} : { host: previous.host }
|
|
8911
8950
|
}
|
|
8912
8951
|
}
|
|
@@ -8922,7 +8961,7 @@ function setPersistentSeatHost(config, seat, host) {
|
|
|
8922
8961
|
}
|
|
8923
8962
|
if (host === void 0) {
|
|
8924
8963
|
const { host: _dropped, ...rest } = previous;
|
|
8925
|
-
if (seatModelOnly(rest) === void 0 && rest.engine === void 0) {
|
|
8964
|
+
if (seatModelOnly(rest) === void 0 && rest.engine === void 0 && rest.engineModel === void 0) {
|
|
8926
8965
|
const { [seat]: _row, ...seats } = config.seats;
|
|
8927
8966
|
return { ...config, seats };
|
|
8928
8967
|
}
|
|
@@ -8931,7 +8970,7 @@ function setPersistentSeatHost(config, seat, host) {
|
|
|
8931
8970
|
const registered = assertRegisteredHostName(host);
|
|
8932
8971
|
return { ...config, seats: { ...config.seats, [seat]: { ...previous, host: registered } } };
|
|
8933
8972
|
}
|
|
8934
|
-
function setPersistentSeatEngine(config, seat, engine) {
|
|
8973
|
+
function setPersistentSeatEngine(config, seat, engine, engineModel) {
|
|
8935
8974
|
const previous = config.seats[seat];
|
|
8936
8975
|
if (previous === void 0) {
|
|
8937
8976
|
throw new Error(
|
|
@@ -8939,7 +8978,7 @@ function setPersistentSeatEngine(config, seat, engine) {
|
|
|
8939
8978
|
);
|
|
8940
8979
|
}
|
|
8941
8980
|
if (engine === void 0) {
|
|
8942
|
-
const { engine: _dropped, ...modelOnly } = previous;
|
|
8981
|
+
const { engine: _dropped, engineModel: _droppedModel, ...modelOnly } = previous;
|
|
8943
8982
|
if (seatModelOnly(modelOnly) === void 0 && modelOnly.host === void 0) {
|
|
8944
8983
|
const { [seat]: _row, ...seats } = config.seats;
|
|
8945
8984
|
return { ...config, seats };
|
|
@@ -8952,11 +8991,38 @@ function setPersistentSeatEngine(config, seat, engine) {
|
|
|
8952
8991
|
}
|
|
8953
8992
|
};
|
|
8954
8993
|
}
|
|
8994
|
+
const { engineModel: _priorModel, ...withoutModel } = previous;
|
|
8995
|
+
const next = engineModel === void 0 ? { ...withoutModel, engine } : { ...withoutModel, engine, engineModel };
|
|
8955
8996
|
return {
|
|
8956
8997
|
...config,
|
|
8957
8998
|
seats: {
|
|
8958
8999
|
...config.seats,
|
|
8959
|
-
[seat]:
|
|
9000
|
+
[seat]: next
|
|
9001
|
+
}
|
|
9002
|
+
};
|
|
9003
|
+
}
|
|
9004
|
+
function setPersistentSeatEngineModel(config, seat, engineModel) {
|
|
9005
|
+
const previous = config.seats[seat];
|
|
9006
|
+
if (previous === void 0 || previous.engine === void 0) {
|
|
9007
|
+
throw new Error(
|
|
9008
|
+
`config seat ${seat} has no persistent engine; set-engine before engine model`
|
|
9009
|
+
);
|
|
9010
|
+
}
|
|
9011
|
+
if (engineModel === void 0) {
|
|
9012
|
+
const { engineModel: _dropped, ...rest } = previous;
|
|
9013
|
+
return {
|
|
9014
|
+
...config,
|
|
9015
|
+
seats: {
|
|
9016
|
+
...config.seats,
|
|
9017
|
+
[seat]: rest
|
|
9018
|
+
}
|
|
9019
|
+
};
|
|
9020
|
+
}
|
|
9021
|
+
return {
|
|
9022
|
+
...config,
|
|
9023
|
+
seats: {
|
|
9024
|
+
...config.seats,
|
|
9025
|
+
[seat]: { ...previous, engineModel }
|
|
8960
9026
|
}
|
|
8961
9027
|
};
|
|
8962
9028
|
}
|
|
@@ -8984,6 +9050,21 @@ function validatePublicCliConfigAxes(config, _packageRoot) {
|
|
|
8984
9050
|
);
|
|
8985
9051
|
}
|
|
8986
9052
|
}
|
|
9053
|
+
if (row?.engineModel !== void 0) {
|
|
9054
|
+
if (row.engine === void 0) {
|
|
9055
|
+
throw new Error(
|
|
9056
|
+
`config seat ${seat} engineModel requires engine`
|
|
9057
|
+
);
|
|
9058
|
+
}
|
|
9059
|
+
try {
|
|
9060
|
+
assertLegalEngineModel(row.engineModel);
|
|
9061
|
+
} catch (error) {
|
|
9062
|
+
throw new Error(
|
|
9063
|
+
`config seat ${seat} engineModel is illegal: ${row.engineModel}`,
|
|
9064
|
+
{ cause: error }
|
|
9065
|
+
);
|
|
9066
|
+
}
|
|
9067
|
+
}
|
|
8987
9068
|
if (row?.host !== void 0) {
|
|
8988
9069
|
try {
|
|
8989
9070
|
assertRegisteredHostName(row.host);
|
|
@@ -9098,13 +9179,19 @@ function parseSeatModelConfig(value, seat) {
|
|
|
9098
9179
|
if (raw.engine !== void 0 && typeof raw.engine !== "string") {
|
|
9099
9180
|
throw new Error(`config seat ${seat} engine must be a string`);
|
|
9100
9181
|
}
|
|
9182
|
+
if (raw.engineModel !== void 0 && typeof raw.engineModel !== "string") {
|
|
9183
|
+
throw new Error(`config seat ${seat} engineModel must be a string`);
|
|
9184
|
+
}
|
|
9101
9185
|
if (!hasProvider) {
|
|
9102
9186
|
if ((seat === "notary" || seat === "inspector") && (typeof raw.engine === "string" || typeof raw.host === "string")) {
|
|
9103
9187
|
if (raw.thinking !== void 0) {
|
|
9104
9188
|
throw new Error(`config seat ${seat} thinking requires provider/model`);
|
|
9105
9189
|
}
|
|
9106
9190
|
return {
|
|
9107
|
-
...
|
|
9191
|
+
...pickEngineAxis({
|
|
9192
|
+
engine: typeof raw.engine === "string" ? raw.engine : void 0,
|
|
9193
|
+
engineModel: typeof raw.engineModel === "string" ? raw.engineModel : void 0
|
|
9194
|
+
}),
|
|
9108
9195
|
...raw.host === void 0 ? {} : { host: raw.host }
|
|
9109
9196
|
};
|
|
9110
9197
|
}
|
|
@@ -9123,7 +9210,10 @@ function parseSeatModelConfig(value, seat) {
|
|
|
9123
9210
|
provider: raw.provider,
|
|
9124
9211
|
model: raw.model,
|
|
9125
9212
|
...raw.thinking === void 0 ? {} : { thinking: raw.thinking },
|
|
9126
|
-
...
|
|
9213
|
+
...pickEngineAxis({
|
|
9214
|
+
engine: typeof raw.engine === "string" ? raw.engine : void 0,
|
|
9215
|
+
engineModel: typeof raw.engineModel === "string" ? raw.engineModel : void 0
|
|
9216
|
+
}),
|
|
9127
9217
|
...raw.host === void 0 ? {} : { host: raw.host }
|
|
9128
9218
|
};
|
|
9129
9219
|
return parsed;
|
|
@@ -9158,18 +9248,26 @@ function attachEngineAxis(seat, config, invocation) {
|
|
|
9158
9248
|
engineSource: "unconfigured"
|
|
9159
9249
|
};
|
|
9160
9250
|
}
|
|
9161
|
-
const
|
|
9251
|
+
const persistentRow = config.seats[seat.seat];
|
|
9252
|
+
const persistentEngine = persistentRow?.engine;
|
|
9253
|
+
const persistentEngineModel = persistentRow?.engineModel;
|
|
9162
9254
|
if (invocation?.engine !== void 0) {
|
|
9163
9255
|
return {
|
|
9164
9256
|
...seat,
|
|
9165
|
-
|
|
9257
|
+
...pickEngineAxis({
|
|
9258
|
+
engine: invocation.engine,
|
|
9259
|
+
engineModel: invocation.engineModel
|
|
9260
|
+
}),
|
|
9166
9261
|
engineSource: "invocation"
|
|
9167
9262
|
};
|
|
9168
9263
|
}
|
|
9169
9264
|
if (persistentEngine !== void 0) {
|
|
9170
9265
|
return {
|
|
9171
9266
|
...seat,
|
|
9172
|
-
|
|
9267
|
+
...pickEngineAxis({
|
|
9268
|
+
engine: persistentEngine,
|
|
9269
|
+
engineModel: persistentEngineModel
|
|
9270
|
+
}),
|
|
9173
9271
|
engineSource: "persistent"
|
|
9174
9272
|
};
|
|
9175
9273
|
}
|
|
@@ -15555,7 +15653,13 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
15555
15653
|
)
|
|
15556
15654
|
};
|
|
15557
15655
|
}
|
|
15558
|
-
await markRunRunning(
|
|
15656
|
+
await markRunRunning(
|
|
15657
|
+
admitted.runDirectory,
|
|
15658
|
+
env.model,
|
|
15659
|
+
effectiveEngine,
|
|
15660
|
+
env.host,
|
|
15661
|
+
env.engineModel
|
|
15662
|
+
);
|
|
15559
15663
|
let result;
|
|
15560
15664
|
try {
|
|
15561
15665
|
result = await env.roleTurnHost.executeTurn(turnRequest);
|
|
@@ -15789,7 +15893,7 @@ ${body}`;
|
|
|
15789
15893
|
} else {
|
|
15790
15894
|
prompt = buildResumeContinuationPrompt({
|
|
15791
15895
|
packageRoot: env.packageRoot,
|
|
15792
|
-
...env
|
|
15896
|
+
...pickEngineAxis(env),
|
|
15793
15897
|
message: request.message
|
|
15794
15898
|
});
|
|
15795
15899
|
}
|
|
@@ -15808,7 +15912,7 @@ ${GATE_DOSSIER_POINTER_PREFIX}${path}`;
|
|
|
15808
15912
|
} else {
|
|
15809
15913
|
prompt = buildResumeContinuationPrompt({
|
|
15810
15914
|
packageRoot: env.packageRoot,
|
|
15811
|
-
...env
|
|
15915
|
+
...pickEngineAxis(env)
|
|
15812
15916
|
});
|
|
15813
15917
|
}
|
|
15814
15918
|
return {
|
|
@@ -15816,7 +15920,7 @@ ${GATE_DOSSIER_POINTER_PREFIX}${path}`;
|
|
|
15816
15920
|
home: env.home,
|
|
15817
15921
|
agentDir: env.agentDir,
|
|
15818
15922
|
...env.model === void 0 ? {} : { model: env.model },
|
|
15819
|
-
...env
|
|
15923
|
+
...pickEngineAxis(env),
|
|
15820
15924
|
...env.timeoutMs === void 0 ? {} : { timeoutMs: env.timeoutMs },
|
|
15821
15925
|
...admitted.correlationId === void 0 && env.correlationId === void 0 ? {} : { correlationId: admitted.correlationId ?? env.correlationId },
|
|
15822
15926
|
continuation: {
|
|
@@ -16008,7 +16112,6 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
16008
16112
|
}
|
|
16009
16113
|
}
|
|
16010
16114
|
async function runPostAdmissionOneShot(input) {
|
|
16011
|
-
const engine = input.effectiveEngine ?? input.env.engine;
|
|
16012
16115
|
return await runPostAdmissionResumable({
|
|
16013
16116
|
admitted: input.admitted,
|
|
16014
16117
|
env: input.env,
|
|
@@ -16020,7 +16123,10 @@ async function runPostAdmissionOneShot(input) {
|
|
|
16020
16123
|
kind: "resume",
|
|
16021
16124
|
prompt: buildResumeContinuationPrompt({
|
|
16022
16125
|
packageRoot: input.env.packageRoot,
|
|
16023
|
-
...
|
|
16126
|
+
...pickEngineAxis({
|
|
16127
|
+
engine: input.effectiveEngine ?? input.env.engine,
|
|
16128
|
+
engineModel: input.env.engineModel
|
|
16129
|
+
})
|
|
16024
16130
|
})
|
|
16025
16131
|
}
|
|
16026
16132
|
}),
|
|
@@ -16133,6 +16239,7 @@ var init_post_admission = __esm({
|
|
|
16133
16239
|
init_cli_errors();
|
|
16134
16240
|
init_invocation();
|
|
16135
16241
|
init_activation_ledger_topology();
|
|
16242
|
+
init_engine_material();
|
|
16136
16243
|
init_session_identity();
|
|
16137
16244
|
init_case_dossier_delivery();
|
|
16138
16245
|
init_host_transition_prior_native();
|
|
@@ -16161,7 +16268,7 @@ function projectRoleTurnRequest(admitted, roleDetails, options) {
|
|
|
16161
16268
|
methods: roleDetails.methods ?? [],
|
|
16162
16269
|
continuation: options.continuation,
|
|
16163
16270
|
...options.model === void 0 ? {} : { model: options.model },
|
|
16164
|
-
...options
|
|
16271
|
+
...pickEngineAxis(options),
|
|
16165
16272
|
cwd,
|
|
16166
16273
|
home: options.home,
|
|
16167
16274
|
agentDir: options.agentDir,
|
|
@@ -16175,6 +16282,7 @@ function projectRoleTurnRequest(admitted, roleDetails, options) {
|
|
|
16175
16282
|
var init_turn_request = __esm({
|
|
16176
16283
|
"src/public-cli/turn-request.ts"() {
|
|
16177
16284
|
"use strict";
|
|
16285
|
+
init_engine_material();
|
|
16178
16286
|
}
|
|
16179
16287
|
});
|
|
16180
16288
|
|
|
@@ -16268,7 +16376,7 @@ async function runPublicNotary(argv, env, io, parseNotaryArgv2) {
|
|
|
16268
16376
|
}
|
|
16269
16377
|
await markRunAdmitted(admitted, env.principalAuthority);
|
|
16270
16378
|
const engineMaterial = engineSessionMaterialFromOptions({
|
|
16271
|
-
...env
|
|
16379
|
+
...pickEngineAxis(env),
|
|
16272
16380
|
packageRoot: env.packageRoot
|
|
16273
16381
|
});
|
|
16274
16382
|
const turnRequest = buildNotaryTurnRequest(admitted, {
|
|
@@ -16276,7 +16384,7 @@ async function runPublicNotary(argv, env, io, parseNotaryArgv2) {
|
|
|
16276
16384
|
home: env.home,
|
|
16277
16385
|
agentDir: env.agentDir,
|
|
16278
16386
|
...env.model === void 0 ? {} : { model: env.model },
|
|
16279
|
-
...env
|
|
16387
|
+
...pickEngineAxis(env),
|
|
16280
16388
|
...env.timeoutMs === void 0 ? {} : { timeoutMs: env.timeoutMs },
|
|
16281
16389
|
...env.correlationId === void 0 || env.correlationId.trim() === "" ? {} : { correlationId: env.correlationId },
|
|
16282
16390
|
continuation: {
|
|
@@ -16440,7 +16548,7 @@ async function runPublicInspector(argv, env, io, parseInspectorArgv2) {
|
|
|
16440
16548
|
}
|
|
16441
16549
|
await markRunAdmitted(admitted, env.principalAuthority);
|
|
16442
16550
|
const engineMaterial = engineSessionMaterialFromOptions({
|
|
16443
|
-
...env
|
|
16551
|
+
...pickEngineAxis(env),
|
|
16444
16552
|
packageRoot: env.packageRoot
|
|
16445
16553
|
});
|
|
16446
16554
|
const turnRequest = buildInspectorTurnRequest(admitted, {
|
|
@@ -16448,7 +16556,7 @@ async function runPublicInspector(argv, env, io, parseInspectorArgv2) {
|
|
|
16448
16556
|
home: env.home,
|
|
16449
16557
|
agentDir: env.agentDir,
|
|
16450
16558
|
...env.model === void 0 ? {} : { model: env.model },
|
|
16451
|
-
...env
|
|
16559
|
+
...pickEngineAxis(env),
|
|
16452
16560
|
...env.timeoutMs === void 0 ? {} : { timeoutMs: env.timeoutMs },
|
|
16453
16561
|
...env.correlationId === void 0 || env.correlationId.trim() === "" ? {} : { correlationId: env.correlationId },
|
|
16454
16562
|
continuation: {
|
|
@@ -16738,7 +16846,7 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv) {
|
|
|
16738
16846
|
home: env.home,
|
|
16739
16847
|
agentDir: env.agentDir,
|
|
16740
16848
|
...env.model === void 0 ? {} : { model: env.model },
|
|
16741
|
-
...env
|
|
16849
|
+
...pickEngineAxis(env),
|
|
16742
16850
|
...env.timeoutMs === void 0 ? {} : { timeoutMs: env.timeoutMs },
|
|
16743
16851
|
...env.correlationId === void 0 || env.correlationId.trim() === "" ? {} : { correlationId: env.correlationId },
|
|
16744
16852
|
continuation: {
|
|
@@ -16746,7 +16854,7 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv) {
|
|
|
16746
16854
|
prompt: buildInstructionTransportPrompt(
|
|
16747
16855
|
admitted,
|
|
16748
16856
|
engineSessionMaterialFromOptions({
|
|
16749
|
-
...env
|
|
16857
|
+
...pickEngineAxis(env),
|
|
16750
16858
|
packageRoot: env.packageRoot
|
|
16751
16859
|
})
|
|
16752
16860
|
)
|
|
@@ -16838,7 +16946,7 @@ async function runPublicJudge(argv, env, io, parseJudgeArgv2) {
|
|
|
16838
16946
|
home: env.home,
|
|
16839
16947
|
agentDir: env.agentDir,
|
|
16840
16948
|
...env.model === void 0 ? {} : { model: env.model },
|
|
16841
|
-
...env
|
|
16949
|
+
...pickEngineAxis(env),
|
|
16842
16950
|
...env.timeoutMs === void 0 ? {} : { timeoutMs: env.timeoutMs },
|
|
16843
16951
|
...admitted.correlationId === void 0 && env.correlationId === void 0 ? {} : { correlationId: admitted.correlationId ?? env.correlationId },
|
|
16844
16952
|
continuation: {
|
|
@@ -16846,7 +16954,7 @@ async function runPublicJudge(argv, env, io, parseJudgeArgv2) {
|
|
|
16846
16954
|
prompt: buildJudgeTransportPrompt(
|
|
16847
16955
|
admitted,
|
|
16848
16956
|
engineSessionMaterialFromOptions({
|
|
16849
|
-
...env
|
|
16957
|
+
...pickEngineAxis(env),
|
|
16850
16958
|
packageRoot: env.packageRoot
|
|
16851
16959
|
})
|
|
16852
16960
|
)
|
|
@@ -16857,14 +16965,14 @@ async function runPublicJudge(argv, env, io, parseJudgeArgv2) {
|
|
|
16857
16965
|
home: env.home,
|
|
16858
16966
|
agentDir: env.agentDir,
|
|
16859
16967
|
...env.model === void 0 ? {} : { model: env.model },
|
|
16860
|
-
...env
|
|
16968
|
+
...pickEngineAxis(env),
|
|
16861
16969
|
...env.timeoutMs === void 0 ? {} : { timeoutMs: env.timeoutMs },
|
|
16862
16970
|
...admitted.correlationId === void 0 && env.correlationId === void 0 ? {} : { correlationId: admitted.correlationId ?? env.correlationId },
|
|
16863
16971
|
continuation: {
|
|
16864
16972
|
kind: "resume",
|
|
16865
16973
|
prompt: buildResumeContinuationPrompt({
|
|
16866
16974
|
packageRoot: env.packageRoot,
|
|
16867
|
-
...env
|
|
16975
|
+
...pickEngineAxis(env)
|
|
16868
16976
|
})
|
|
16869
16977
|
}
|
|
16870
16978
|
}),
|
|
@@ -16944,12 +17052,18 @@ async function runPublicDoctor(argv, env, io, parseDoctorArgv2) {
|
|
|
16944
17052
|
home: env.home,
|
|
16945
17053
|
agentDir: env.agentDir,
|
|
16946
17054
|
...env.model === void 0 ? {} : { model: env.model },
|
|
16947
|
-
...env
|
|
17055
|
+
...pickEngineAxis(env),
|
|
16948
17056
|
...env.timeoutMs === void 0 ? {} : { timeoutMs: env.timeoutMs },
|
|
16949
17057
|
...env.correlationId === void 0 || env.correlationId.trim() === "" ? {} : { correlationId: env.correlationId },
|
|
16950
17058
|
continuation: {
|
|
16951
17059
|
kind: "initial",
|
|
16952
|
-
prompt: buildDoctorTransportPrompt(
|
|
17060
|
+
prompt: buildDoctorTransportPrompt(
|
|
17061
|
+
admitted,
|
|
17062
|
+
engineSessionMaterialFromOptions({
|
|
17063
|
+
...pickEngineAxis(env),
|
|
17064
|
+
packageRoot: env.packageRoot
|
|
17065
|
+
})
|
|
17066
|
+
)
|
|
16953
17067
|
}
|
|
16954
17068
|
});
|
|
16955
17069
|
return await runPostAdmissionOneShot({
|
|
@@ -17082,7 +17196,7 @@ async function runPublicDiarist(argv, env, io, parseDiaristArgv2) {
|
|
|
17082
17196
|
home: env.home,
|
|
17083
17197
|
agentDir: env.agentDir,
|
|
17084
17198
|
...env.model === void 0 ? {} : { model: env.model },
|
|
17085
|
-
...env
|
|
17199
|
+
...pickEngineAxis(env),
|
|
17086
17200
|
...env.timeoutMs === void 0 ? {} : { timeoutMs: env.timeoutMs },
|
|
17087
17201
|
...env.correlationId === void 0 || env.correlationId.trim() === "" ? {} : { correlationId: env.correlationId },
|
|
17088
17202
|
continuation: {
|
|
@@ -17090,7 +17204,7 @@ async function runPublicDiarist(argv, env, io, parseDiaristArgv2) {
|
|
|
17090
17204
|
prompt: buildInstructionTransportPrompt(
|
|
17091
17205
|
admitted,
|
|
17092
17206
|
engineSessionMaterialFromOptions({
|
|
17093
|
-
...env
|
|
17207
|
+
...pickEngineAxis(env),
|
|
17094
17208
|
packageRoot: env.packageRoot
|
|
17095
17209
|
})
|
|
17096
17210
|
)
|
|
@@ -17235,7 +17349,7 @@ async function resolveSummonHome(options) {
|
|
|
17235
17349
|
return packageMachineHome2();
|
|
17236
17350
|
}
|
|
17237
17351
|
function projectSeatEngine(seat) {
|
|
17238
|
-
return seat
|
|
17352
|
+
return pickEngineAxis(seat);
|
|
17239
17353
|
}
|
|
17240
17354
|
function projectSeatHost(seat) {
|
|
17241
17355
|
return seat.host === void 0 ? {} : { host: seat.host };
|
|
@@ -17476,6 +17590,7 @@ var AK_ROLE_PACKAGE_ROOT_ENV;
|
|
|
17476
17590
|
var init_public_role_summons = __esm({
|
|
17477
17591
|
"src/public-role-summons.ts"() {
|
|
17478
17592
|
"use strict";
|
|
17593
|
+
init_engine_material();
|
|
17479
17594
|
AK_ROLE_PACKAGE_ROOT_ENV = "AK_ROLE_PACKAGE_ROOT";
|
|
17480
17595
|
}
|
|
17481
17596
|
});
|
|
@@ -18158,10 +18273,12 @@ function isCallerCancellation(error, signal) {
|
|
|
18158
18273
|
}
|
|
18159
18274
|
function createEngineDetourToolDefinition(input) {
|
|
18160
18275
|
const engineName = input.engineName;
|
|
18276
|
+
const engineModel = input.engineModel;
|
|
18277
|
+
const engineCoord = engineModel === void 0 ? `engine=${engineName}` : `engine=${engineName}, model=${engineModel}`;
|
|
18161
18278
|
return {
|
|
18162
18279
|
name: ENGINE_DETOUR_TOOL_NAME,
|
|
18163
18280
|
label: "\u52B3\u52A1\u5F15\u64CE",
|
|
18164
|
-
description: `\u8FD0\u884C\u4E00\u6B21\u52B3\u52A1\u5F15\u64CE\u5B50\u8FDB\u7A0B\
|
|
18281
|
+
description: `\u8FD0\u884C\u4E00\u6B21\u52B3\u52A1\u5F15\u64CE\u5B50\u8FDB\u7A0B\uFF08${engineCoord}\uFF09\uFF0Cstdout \u8FD4\u56DE\u672C session\u3002`,
|
|
18165
18282
|
promptSnippet: "\u8FD0\u884C\u914D\u7F6E\u7684\u52B3\u52A1\u5F15\u64CE\u4E00\u6B21\u5E76\u8FD4\u56DE stdout",
|
|
18166
18283
|
parameters: engineDetourArgsSchema,
|
|
18167
18284
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
@@ -18205,12 +18322,15 @@ function createEngineDetourToolDefinition(input) {
|
|
|
18205
18322
|
};
|
|
18206
18323
|
}
|
|
18207
18324
|
function registerEngineDetourTool(roleHost, hostActions) {
|
|
18208
|
-
const
|
|
18325
|
+
const getFlag = (name) => roleHost.getFlag(name);
|
|
18326
|
+
const engineName = resolveEngineName(getFlag);
|
|
18209
18327
|
if (engineName === void 0) {
|
|
18210
18328
|
return false;
|
|
18211
18329
|
}
|
|
18330
|
+
const engineModel = resolveEngineModel(getFlag);
|
|
18212
18331
|
const definition = createEngineDetourToolDefinition({
|
|
18213
18332
|
engineName,
|
|
18333
|
+
...engineModel === void 0 ? {} : { engineModel },
|
|
18214
18334
|
fail(error, toolCallId, ctx) {
|
|
18215
18335
|
hostActions.failInfrastructure(error, ctx, toolCallId);
|
|
18216
18336
|
}
|
|
@@ -22587,6 +22707,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
22587
22707
|
}
|
|
22588
22708
|
const flags = projectActivationFlags(request);
|
|
22589
22709
|
flags.set(ENGINE_FLAG_NAME, normalizeEngineName(request.engine) ?? "");
|
|
22710
|
+
flags.set(ENGINE_MODEL_FLAG_NAME, normalizeEngineName(request.engineModel) ?? "");
|
|
22590
22711
|
const tools = /* @__PURE__ */ new Map();
|
|
22591
22712
|
const handlers = /* @__PURE__ */ new Map();
|
|
22592
22713
|
const calls = [];
|