@akagilnc/pi-workflow-roles 0.1.4243 → 0.1.4274
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 +27 -23
- package/README.zh-CN.md +24 -21
- package/dist/acp-host/production-host.js +4607 -3524
- package/dist/engine-detour-tool.js +64 -5
- package/dist/engine-detour-usage.js +285 -0
- package/dist/headless-host/production-host.js +6057 -4974
- package/dist/navigator-attendance.js +0 -2
- package/dist/navigator-public-session.js +2 -4
- package/dist/navigator-session-contracts.js +6 -13
- package/dist/pi/role-turn-host.js +10 -0
- package/dist/public-cli/config.js +16 -20
- package/dist/public-cli/main.js +935 -613
- package/dist/public-cli/post-admission.js +72 -43
- package/dist/public-cli/registry.js +0 -57
- package/dist/public-cli/settlement.js +80 -24
- package/dist/public-cli/turn-request.js +3 -0
- package/dist/public-role-summons.js +121 -96
- package/package.json +1 -1
- package/src/engine-detour-tool.ts +106 -8
- package/src/engine-detour-usage.ts +373 -0
- package/src/host-contracts.ts +12 -1
- package/src/navigator-attendance.ts +0 -2
- package/src/navigator-public-session.ts +3 -3
- package/src/navigator-session-contracts.ts +8 -14
- package/src/pi/adapter.ts +6 -0
- package/src/pi/role-turn-host.ts +6 -0
- package/src/public-cli/cli.ts +115 -307
- package/src/public-cli/config.ts +35 -23
- package/src/public-cli/post-admission.ts +91 -49
- package/src/public-cli/registry.ts +2 -66
- package/src/public-cli/settlement.ts +148 -23
- package/src/public-cli/turn-request.ts +5 -0
- package/src/public-role-summons.ts +197 -125
- package/src/role-envelope.ts +2 -0
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
} from "./activation-ledger-topology.js";
|
|
16
16
|
import { createNativeNavigatorSessionFactory } from "./navigator-public-session.js";
|
|
17
17
|
import {
|
|
18
|
-
NAVIGATOR_DEFAULT_MODEL,
|
|
19
18
|
NAVIGATOR_PREPARE_TOOL_NAME,
|
|
20
19
|
NavigatorUnavailableError,
|
|
21
20
|
navigatorModelSettingPath,
|
|
@@ -685,7 +684,6 @@ function registerNavigatorModelCommand(pi, path = navigatorModelSettingPath()) {
|
|
|
685
684
|
});
|
|
686
685
|
}
|
|
687
686
|
export {
|
|
688
|
-
NAVIGATOR_DEFAULT_MODEL,
|
|
689
687
|
NAVIGATOR_EVENT_TYPE,
|
|
690
688
|
NAVIGATOR_PREPARE_ACCEPTED_TEXT,
|
|
691
689
|
NAVIGATOR_PREPARE_TOOL_NAME,
|
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
navigatorProviderFailureFromPublicTerminal,
|
|
5
5
|
navigatorProviderFailureFromError,
|
|
6
6
|
navigatorUnavailableError,
|
|
7
|
-
parseNavigatorModelSetting
|
|
8
|
-
resolveNavigatorSeatSelection
|
|
7
|
+
parseNavigatorModelSetting
|
|
9
8
|
} from "./navigator-session-contracts.js";
|
|
10
9
|
import { runDirectoryFromHostContext } from "./host-contracts.js";
|
|
11
10
|
async function resolveNavigatorLedgerHome(context) {
|
|
@@ -24,8 +23,7 @@ async function resolveNavigatorLedgerHome(context) {
|
|
|
24
23
|
}
|
|
25
24
|
function createNativeNavigatorSessionFactory() {
|
|
26
25
|
return async ({ context, subject, tool }) => {
|
|
27
|
-
|
|
28
|
-
let thinkingLevel = resolved.thinkingLevel;
|
|
26
|
+
let thinkingLevel;
|
|
29
27
|
const { createRecordSession, NAVIGATOR_RECORD_KIND } = await import("./archivist-record-entry.js");
|
|
30
28
|
const home = await resolveNavigatorLedgerHome(context);
|
|
31
29
|
const sessionManager = createRecordSession({
|
|
@@ -4,7 +4,6 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import { Type } from "typebox";
|
|
5
5
|
import { Value } from "typebox/value";
|
|
6
6
|
const NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
|
|
7
|
-
const NAVIGATOR_DEFAULT_MODEL = "openai-codex/gpt-5.6-luna:max";
|
|
8
7
|
const NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
|
|
9
8
|
"context",
|
|
10
9
|
"session",
|
|
@@ -149,7 +148,7 @@ async function readNavigatorModelSetting(path = navigatorModelSettingPath()) {
|
|
|
149
148
|
return raw.model;
|
|
150
149
|
} catch (error) {
|
|
151
150
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
152
|
-
|
|
151
|
+
throw new Error("Navigator model setting is missing");
|
|
153
152
|
}
|
|
154
153
|
throw error;
|
|
155
154
|
}
|
|
@@ -192,16 +191,11 @@ async function resolveNavigatorSeatSelection(context) {
|
|
|
192
191
|
const config = await loadPublicCliConfig(home);
|
|
193
192
|
const modelOnly = seatModelOnly(config.seats.navigator);
|
|
194
193
|
if (modelOnly === void 0) {
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
...parsed.thinkingLevel === void 0 ? {} : { thinking: parsed.thinkingLevel }
|
|
201
|
-
},
|
|
202
|
-
configuredLabel: NAVIGATOR_DEFAULT_MODEL,
|
|
203
|
-
...parsed.thinkingLevel === void 0 ? {} : { thinkingLevel: parsed.thinkingLevel }
|
|
204
|
-
};
|
|
194
|
+
const { missingResolvedSeatModelMessage } = await import("./public-cli/config.js");
|
|
195
|
+
throw navigatorUnavailableError(
|
|
196
|
+
"model",
|
|
197
|
+
new Error(missingResolvedSeatModelMessage("navigator"))
|
|
198
|
+
);
|
|
205
199
|
}
|
|
206
200
|
const thinkingRaw = modelOnly.thinking;
|
|
207
201
|
const configuredLabel = thinkingRaw === void 0 ? `${modelOnly.provider}/${modelOnly.model}` : `${modelOnly.provider}/${modelOnly.model}:${thinkingRaw}`;
|
|
@@ -219,7 +213,6 @@ async function resolveNavigatorSeatSelection(context) {
|
|
|
219
213
|
}
|
|
220
214
|
}
|
|
221
215
|
export {
|
|
222
|
-
NAVIGATOR_DEFAULT_MODEL,
|
|
223
216
|
NAVIGATOR_PREPARE_TOOL_NAME,
|
|
224
217
|
NavigatorUnavailableError,
|
|
225
218
|
navigatorModelSettingPath,
|
|
@@ -338,6 +338,16 @@ export function createPiRoleTurnHost(config) {
|
|
|
338
338
|
delete env.AK_ROLE_COURT_ATTEMPT;
|
|
339
339
|
else
|
|
340
340
|
env.AK_ROLE_COURT_ATTEMPT = request.courtAttemptId;
|
|
341
|
+
// Public-invocation scope (#537): omit must not inherit a parent env value.
|
|
342
|
+
if (request.invocationScopeId === undefined)
|
|
343
|
+
delete env.AK_ROLE_INVOCATION_SCOPE;
|
|
344
|
+
else
|
|
345
|
+
env.AK_ROLE_INVOCATION_SCOPE = request.invocationScopeId;
|
|
346
|
+
// Selected host axis (#537 / ADR 0082): omit must not inherit a parent env value.
|
|
347
|
+
if (request.host === undefined || request.host.trim() === "")
|
|
348
|
+
delete env.AK_ROLE_HOST;
|
|
349
|
+
else
|
|
350
|
+
env.AK_ROLE_HOST = request.host.trim();
|
|
341
351
|
applyEngineChildEnv(env, request.engine);
|
|
342
352
|
// Nested auditor dossier tool binds the parent run pointer when published.
|
|
343
353
|
if (typeof process.env.AK_ROLE_AUDITOR_SOURCE_RUN === "string"
|
|
@@ -12,8 +12,7 @@ import {
|
|
|
12
12
|
PUBLIC_CONFIGURABLE_SEATS,
|
|
13
13
|
isPublicCallableRole,
|
|
14
14
|
isPublicConfigurableSeat,
|
|
15
|
-
seatModelOnly
|
|
16
|
-
publicStartupCandidates
|
|
15
|
+
seatModelOnly
|
|
17
16
|
} from "./registry.js";
|
|
18
17
|
const GATE_OFFICER_SEATS = [
|
|
19
18
|
"gatekeeper",
|
|
@@ -360,13 +359,16 @@ function missingPublicProviderCredential(provider, credentials) {
|
|
|
360
359
|
if (provider !== "openai-codex" && provider !== "xai") return false;
|
|
361
360
|
return !providerConfigured(credentials, provider);
|
|
362
361
|
}
|
|
363
|
-
function
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
362
|
+
function resolvedSeatWithModel(seat) {
|
|
363
|
+
if (seat.selection === void 0) return void 0;
|
|
364
|
+
return seat;
|
|
365
|
+
}
|
|
366
|
+
function missingResolvedSeatModelMessage(seat, remediation = "config") {
|
|
367
|
+
const configSet = `ak-role config set ${seat} <provider/model[:thinking]>`;
|
|
368
|
+
if (remediation === "invocation-or-config") {
|
|
369
|
+
return `seat ${seat} has no model configured; set with --model <provider/model[:thinking]> or ${configSet}`;
|
|
368
370
|
}
|
|
369
|
-
return
|
|
371
|
+
return `seat ${seat} has no model configured; set with ${configSet}`;
|
|
370
372
|
}
|
|
371
373
|
function attachHostAxis(seat, config, invocation) {
|
|
372
374
|
if (invocation?.host !== void 0) return { ...seat, host: invocation.host, hostSource: "invocation" };
|
|
@@ -409,7 +411,7 @@ function attachEngineAxis(seat, config, invocation) {
|
|
|
409
411
|
engineSource: "unconfigured"
|
|
410
412
|
};
|
|
411
413
|
}
|
|
412
|
-
function resolveBaseSeat(config, seat
|
|
414
|
+
function resolveBaseSeat(config, seat) {
|
|
413
415
|
if (seat === "notary" || seat === "inspector") {
|
|
414
416
|
const resolved = resolveConfiguredProvinceOfficer(config, seat);
|
|
415
417
|
return {
|
|
@@ -428,22 +430,14 @@ function resolveBaseSeat(config, seat, credentials) {
|
|
|
428
430
|
engineSource: "unconfigured"
|
|
429
431
|
};
|
|
430
432
|
}
|
|
431
|
-
const startup = pickStartupCandidate(seat, credentials);
|
|
432
|
-
if (startup !== void 0) {
|
|
433
|
-
return {
|
|
434
|
-
seat,
|
|
435
|
-
source: "startup",
|
|
436
|
-
selection: startup,
|
|
437
|
-
engineSource: "unconfigured"
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
433
|
return { seat, source: "unconfigured", engineSource: "unconfigured" };
|
|
441
434
|
}
|
|
442
435
|
function resolveEffectiveSeat(config, seat, credentials, invocation) {
|
|
443
436
|
const hasModelInvocation = invocation !== void 0 && (invocation.model !== void 0 || invocation.thinking !== void 0);
|
|
437
|
+
void credentials;
|
|
444
438
|
let modelSeat;
|
|
445
439
|
if (!hasModelInvocation || invocation === void 0) {
|
|
446
|
-
modelSeat = resolveBaseSeat(config, seat
|
|
440
|
+
modelSeat = resolveBaseSeat(config, seat);
|
|
447
441
|
} else if (invocation.model !== void 0) {
|
|
448
442
|
const spec = invocation.model.includes(":") || invocation.thinking === void 0 ? invocation.model : `${invocation.model}:${invocation.thinking}`;
|
|
449
443
|
modelSeat = {
|
|
@@ -453,7 +447,7 @@ function resolveEffectiveSeat(config, seat, credentials, invocation) {
|
|
|
453
447
|
engineSource: "unconfigured"
|
|
454
448
|
};
|
|
455
449
|
} else {
|
|
456
|
-
const base = resolveBaseSeat(config, seat
|
|
450
|
+
const base = resolveBaseSeat(config, seat);
|
|
457
451
|
if (base.selection === void 0 || invocation.thinking === void 0) {
|
|
458
452
|
modelSeat = {
|
|
459
453
|
seat,
|
|
@@ -516,11 +510,13 @@ export {
|
|
|
516
510
|
loadCredentialProviders,
|
|
517
511
|
loadPublicCliConfig,
|
|
518
512
|
missingPublicProviderCredential,
|
|
513
|
+
missingResolvedSeatModelMessage,
|
|
519
514
|
parseAutoResumeLimit,
|
|
520
515
|
parseModelSpec,
|
|
521
516
|
providerConfigured,
|
|
522
517
|
publicCliConfigPath,
|
|
523
518
|
resolveEffectiveSeat,
|
|
519
|
+
resolvedSeatWithModel,
|
|
524
520
|
savePublicCliConfig,
|
|
525
521
|
setAutoResumeLimit,
|
|
526
522
|
setPersistentSeatConfig,
|