@akagilnc/pi-workflow-roles 0.1.4586 → 0.1.4620
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 -2
- package/README.zh-CN.md +2 -2
- package/dist/acp-host/production-host.js +951 -497
- package/dist/archivist-record-topology.js +27 -35
- package/dist/headless-host/description.js +7 -4
- package/dist/headless-host/production-host.js +783 -393
- package/dist/migrate-book-topology.js +3 -6
- package/dist/navigator-attendance.js +146 -241
- package/dist/navigator-public-session.js +81 -15
- package/dist/package-contracts/navigator-output.js +30 -12
- package/dist/public-cli/judge-run.js +2 -2
- package/dist/public-cli/main.js +69 -94
- package/dist/public-cli/option-definitions.js +1 -1
- package/dist/public-cli/post-admission.js +2 -2
- package/dist/public-cli/run-lifecycle.js +29 -7
- package/dist/public-cli/settlement.js +46 -32
- package/dist/public-cli/terminal.js +8 -27
- package/dist/public-role-summons.js +22 -4
- package/dist/submission-ledger.js +56 -23
- package/package.json +1 -1
- package/resources/836-deleted-machine-instruction-inventory.md +2 -0
- package/resources/navigator-route-playbook.md +9 -0
- package/scripts/build-package.mjs +6 -1
- package/src/acp-host/role-turn-host.ts +129 -13
- package/src/headless-host/description.ts +17 -7
- package/src/headless-host/role-turn-host.ts +42 -11
- package/src/navigator-attendance.ts +290 -425
- package/src/navigator-public-session.ts +126 -25
- package/src/navigator-role.ts +2 -2
- package/src/package-contracts/navigator-output.ts +41 -25
- package/src/public-cli/coder-run.ts +2 -2
- package/src/public-cli/fixer-run.ts +2 -2
- package/src/public-cli/judge-run.ts +2 -2
- package/src/public-cli/merger-run.ts +2 -2
- package/src/public-cli/option-definitions.ts +1 -1
- package/src/public-cli/post-admission.ts +2 -1
- package/src/public-cli/run-lifecycle.ts +37 -7
- package/src/public-cli/settlement.ts +42 -33
- package/src/public-cli/terminal.ts +12 -37
- package/src/public-role-summons.ts +34 -5
- package/src/role-envelope.ts +89 -4
- package/src/role-runtime.ts +74 -14
- package/src/submission-ledger.ts +63 -21
- package/dist/public-cli/command-renderer.js +0 -5
- package/dist/public-command-renderer.js +0 -29
- package/src/public-cli/command-renderer.ts +0 -9
- package/src/public-command-renderer.ts +0 -55
|
@@ -83,7 +83,11 @@ export function headlessTurnArgs(options: {
|
|
|
83
83
|
readonly description: ClaudePrintHostDescription;
|
|
84
84
|
/** Absolute path written by the adapter; paired with `systemPromptFlag`. */
|
|
85
85
|
readonly systemPromptPath: string;
|
|
86
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Closed JSON Schema for structured_output seats.
|
|
88
|
+
* Optional: omit for prose-exit seats (#959 navigator) so the model may speak free text.
|
|
89
|
+
*/
|
|
90
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
87
91
|
/** Absolute path to host-native MCP config JSON; omitted when no AK MCP servers. */
|
|
88
92
|
readonly mcpConfigPath?: string;
|
|
89
93
|
readonly model?: string;
|
|
@@ -99,9 +103,10 @@ export function headlessTurnArgs(options: {
|
|
|
99
103
|
...description.fixedArgs,
|
|
100
104
|
description.systemPromptFlag,
|
|
101
105
|
options.systemPromptPath,
|
|
102
|
-
description.jsonSchemaFlag,
|
|
103
|
-
JSON.stringify(options.jsonSchema),
|
|
104
106
|
];
|
|
107
|
+
if (options.jsonSchema !== undefined) {
|
|
108
|
+
args.push(description.jsonSchemaFlag, JSON.stringify(options.jsonSchema));
|
|
109
|
+
}
|
|
105
110
|
if (options.pluginDir) args.push("--plugin-dir", options.pluginDir);
|
|
106
111
|
if (options.mcpConfigPath !== undefined && options.mcpConfigPath !== "") {
|
|
107
112
|
args.push(description.mcpConfigFlag, options.mcpConfigPath);
|
|
@@ -145,7 +150,7 @@ function codexTomlStringTable(entries: Readonly<Record<string, string>>): string
|
|
|
145
150
|
* Free-form JSON leaf for Type.Unknown under Codex strict transport.
|
|
146
151
|
* Strict rejects bare untyped nodes and root-level additionalProperties:true;
|
|
147
152
|
* a $defs anyOf of JSON values (with nested additionalProperties as $ref)
|
|
148
|
-
* is accepted and keeps array/object receipts expressible
|
|
153
|
+
* is accepted and keeps array/object receipts expressible.
|
|
149
154
|
* Package code still does not validate or reject the receipt against schema.
|
|
150
155
|
*/
|
|
151
156
|
const CODEX_JSON_VALUE_DEF = "codexJsonValue";
|
|
@@ -398,8 +403,11 @@ function codexMcpConfigArgs(
|
|
|
398
403
|
export function codexTurnArgs(options: {
|
|
399
404
|
/** Absolute path for `-c model_instructions_file=…`. */
|
|
400
405
|
readonly systemPromptPath: string;
|
|
401
|
-
/**
|
|
402
|
-
|
|
406
|
+
/**
|
|
407
|
+
* Absolute path for `--output-schema` (closed transport schema).
|
|
408
|
+
* Optional: omit for prose-exit seats (#959 navigator) so agent_message stays free text.
|
|
409
|
+
*/
|
|
410
|
+
readonly outputSchemaPath?: string;
|
|
403
411
|
readonly mcpServers: readonly Readonly<Record<string, unknown>>[];
|
|
404
412
|
readonly model?: string;
|
|
405
413
|
readonly effort?: string;
|
|
@@ -441,7 +449,9 @@ export function codexTurnArgs(options: {
|
|
|
441
449
|
}
|
|
442
450
|
|
|
443
451
|
args.push("-c", `model_instructions_file=${codexTomlString(options.systemPromptPath)}`);
|
|
444
|
-
|
|
452
|
+
if (options.outputSchemaPath !== undefined) {
|
|
453
|
+
args.push("--output-schema", options.outputSchemaPath);
|
|
454
|
+
}
|
|
445
455
|
args.push(...codexMcpConfigArgs(options.mcpServers));
|
|
446
456
|
|
|
447
457
|
if (options.model !== undefined && options.model !== "") {
|
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
isPlainObject,
|
|
40
40
|
type HeadlessHostDescription,
|
|
41
41
|
} from "./description.ts";
|
|
42
|
+
import { NAVIGATOR_OUTPUT_TOOL_NAME } from "../package-contracts/navigator-output.ts";
|
|
42
43
|
|
|
43
44
|
export type HeadlessRoleTurnHostConfig = Readonly<{
|
|
44
45
|
description: HeadlessHostDescription;
|
|
@@ -406,7 +407,8 @@ function terminalFromSpawned(
|
|
|
406
407
|
function buildTurnArgs(options: {
|
|
407
408
|
readonly description: HeadlessHostDescription;
|
|
408
409
|
readonly systemPromptPath: string;
|
|
409
|
-
|
|
410
|
+
/** Closed schema; omit for #959 navigator prose-exit seats. */
|
|
411
|
+
readonly jsonSchema?: Readonly<Record<string, unknown>>;
|
|
410
412
|
readonly mcpServers: readonly Readonly<Record<string, unknown>>[];
|
|
411
413
|
readonly mcpConfigPath?: string;
|
|
412
414
|
readonly outputSchemaPath?: string;
|
|
@@ -422,10 +424,10 @@ function buildTurnArgs(options: {
|
|
|
422
424
|
if (options.sessionKind === "resume" && !options.sessionId) {
|
|
423
425
|
throw new Error("codex resume requires a bound thread_id");
|
|
424
426
|
}
|
|
425
|
-
|
|
427
|
+
// #959: prose-exit seats (navigator) omit --output-schema; other seats still require it.
|
|
426
428
|
return codexTurnArgs({
|
|
427
429
|
systemPromptPath: options.systemPromptPath,
|
|
428
|
-
outputSchemaPath: options.outputSchemaPath,
|
|
430
|
+
...(options.outputSchemaPath === undefined ? {} : { outputSchemaPath: options.outputSchemaPath }),
|
|
429
431
|
mcpServers: options.mcpServers,
|
|
430
432
|
...(options.model === undefined ? {} : { model: options.model }),
|
|
431
433
|
...(options.effort === undefined ? {} : { effort: options.effort }),
|
|
@@ -443,7 +445,8 @@ function buildTurnArgs(options: {
|
|
|
443
445
|
return headlessTurnArgs({
|
|
444
446
|
description: options.description,
|
|
445
447
|
systemPromptPath: options.systemPromptPath,
|
|
446
|
-
|
|
448
|
+
// #959: navigator omits --json-schema so free-form prose is a lawful exit.
|
|
449
|
+
...(options.jsonSchema === undefined ? {} : { jsonSchema: options.jsonSchema }),
|
|
447
450
|
mcpConfigPath: options.mcpConfigPath,
|
|
448
451
|
...(options.model === undefined ? {} : { model: options.model }),
|
|
449
452
|
...(options.effort === undefined ? {} : { effort: options.effort }),
|
|
@@ -482,12 +485,15 @@ export function createHeadlessRoleTurnHost(config: HeadlessRoleTurnHostConfig):
|
|
|
482
485
|
? (prompt) => applyCodexSkillInvocation(request.methods, prompt)
|
|
483
486
|
: (prompt) => prompt;
|
|
484
487
|
if (codex) {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
outputSchemaPath,
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
488
|
+
// #959: navigator is a prose-exit seat — no closed output-schema.
|
|
489
|
+
if (prepared.terminatingToolName !== NAVIGATOR_OUTPUT_TOOL_NAME) {
|
|
490
|
+
outputSchemaPath = join(request.runDirectory, "headless-output-schema.json");
|
|
491
|
+
await writeFile(
|
|
492
|
+
outputSchemaPath,
|
|
493
|
+
`${JSON.stringify(closeJsonSchemaForCodex(prepared.jsonSchema), null, 2)}\n`,
|
|
494
|
+
"utf8",
|
|
495
|
+
);
|
|
496
|
+
}
|
|
491
497
|
} else {
|
|
492
498
|
mcpConfigPath = join(request.runDirectory, "headless-mcp-config.json");
|
|
493
499
|
await writeFile(
|
|
@@ -517,7 +523,10 @@ export function createHeadlessRoleTurnHost(config: HeadlessRoleTurnHostConfig):
|
|
|
517
523
|
args = buildTurnArgs({
|
|
518
524
|
description: config.description,
|
|
519
525
|
systemPromptPath,
|
|
520
|
-
|
|
526
|
+
// #959: navigator prose exit — no closed JSON schema on claude either.
|
|
527
|
+
...(prepared.terminatingToolName === NAVIGATOR_OUTPUT_TOOL_NAME
|
|
528
|
+
? {}
|
|
529
|
+
: { jsonSchema: prepared.jsonSchema }),
|
|
521
530
|
mcpServers: prepared.mcpServers,
|
|
522
531
|
...(mcpConfigPath === undefined ? {} : { mcpConfigPath }),
|
|
523
532
|
...(outputSchemaPath === undefined ? {} : { outputSchemaPath }),
|
|
@@ -657,6 +666,20 @@ export function createHeadlessRoleTurnHost(config: HeadlessRoleTurnHostConfig):
|
|
|
657
666
|
});
|
|
658
667
|
}
|
|
659
668
|
|
|
669
|
+
// #959: navigator prose exit — final agent_message is presented as-is.
|
|
670
|
+
// Empty text is not a lawful accepted receipt (align pi no_receipt / loud empty).
|
|
671
|
+
if (prepared.terminatingToolName === NAVIGATOR_OUTPUT_TOOL_NAME) {
|
|
672
|
+
if (observation.finalMessage.trim() === "") {
|
|
673
|
+
return terminalFromSpawned(spawned, {
|
|
674
|
+
cause: "output",
|
|
675
|
+
identity: { name: "HeadlessEmptyOutput", code: "empty-stdout" },
|
|
676
|
+
diagnostic: spawned.stderr.trim() || "codex exec produced empty agent_message",
|
|
677
|
+
details: { sessionId, exitCode: spawned.code },
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
await prepared.ingestStructuredOutput({ prose: observation.finalMessage });
|
|
681
|
+
return { status: "delivered", stderr: spawned.stderr };
|
|
682
|
+
}
|
|
660
683
|
let receipt: unknown;
|
|
661
684
|
try {
|
|
662
685
|
receipt = JSON.parse(observation.finalMessage);
|
|
@@ -716,6 +739,14 @@ export function createHeadlessRoleTurnHost(config: HeadlessRoleTurnHostConfig):
|
|
|
716
739
|
|
|
717
740
|
if (envelope.structured_output !== undefined) {
|
|
718
741
|
await prepared.ingestStructuredOutput(envelope.structured_output);
|
|
742
|
+
} else if (
|
|
743
|
+
prepared.terminatingToolName === NAVIGATOR_OUTPUT_TOOL_NAME
|
|
744
|
+
&& typeof envelope.result === "string"
|
|
745
|
+
&& envelope.result.trim() !== ""
|
|
746
|
+
) {
|
|
747
|
+
// #959: claude prose exit — free-form result text is the receipt body
|
|
748
|
+
// when structured_output is absent (json-schema omitted for navigator).
|
|
749
|
+
await prepared.ingestStructuredOutput({ prose: envelope.result });
|
|
719
750
|
}
|
|
720
751
|
return { status: "delivered", stderr: spawned.stderr };
|
|
721
752
|
},
|