@akagilnc/pi-workflow-roles 0.1.5593 → 0.1.5598
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/acp-host/production-host.js +168 -394
- package/dist/headless-host/production-host.js +168 -394
- package/dist/merger-contracts.js +6 -2
- package/dist/migrate-book-topology.js +4846 -10449
- package/dist/package-contracts/worker-output.js +1 -6
- package/dist/packaged-role-registry.js +5 -4
- package/dist/public-cli/invocation.js +20 -53
- package/dist/public-cli/main.js +18046 -18197
- package/dist/public-cli/option-definitions.js +2 -2
- package/dist/public-cli/post-admission.js +2 -2
- package/dist/public-cli/run-lifecycle.js +2 -29
- package/dist/role-run-relocation.js +3 -4
- package/package.json +1 -1
- package/scripts/build-package.mjs +0 -1
- package/src/host-contracts.ts +0 -3
- package/src/merger-contracts.ts +6 -2
- package/src/merger-role.ts +11 -1
- package/src/navigator-attendance.ts +2 -2
- package/src/package-contracts/worker-output.ts +0 -8
- package/src/packaged-role-registry.ts +4 -3
- package/src/public-cli/invocation.ts +25 -72
- package/src/public-cli/option-definitions.ts +2 -2
- package/src/public-cli/post-admission.ts +2 -2
- package/src/public-cli/run-lifecycle.ts +2 -39
- package/src/role-run-relocation.ts +3 -4
- package/src/role-runtime-dependencies.ts +0 -2
- package/src/role-runtime.ts +0 -16
- package/src/worker-role.ts +11 -78
- package/dist/package-contracts/fixer-packet.js +0 -77
- package/packets/fixer-prerequisites.json +0 -6
- package/src/package-contracts/fixer-packet.ts +0 -91
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
PARTIALLY_COMPLETED_DEFINITION,
|
|
7
7
|
validateFixerOutput
|
|
8
8
|
} from "./fixer-output.js";
|
|
9
|
-
import { fixerPrerequisiteSchema, fixerPrerequisitesSchema, parseFixerPrerequisites, validateFixerPrerequisites } from "./fixer-packet.js";
|
|
10
9
|
import { withTerminatingOutputDeclarations } from "./terminating-infrastructure.js";
|
|
11
10
|
const CODER_OUTPUT_TOOL_NAME = "ak_coder_output";
|
|
12
11
|
function validateAcceptedCoderDetails(output) {
|
|
@@ -32,11 +31,7 @@ export {
|
|
|
32
31
|
FIXER_OUTPUT_TOOL_NAME,
|
|
33
32
|
coderOutputSchema,
|
|
34
33
|
fixerOutputSchema,
|
|
35
|
-
fixerPrerequisiteSchema,
|
|
36
|
-
fixerPrerequisitesSchema,
|
|
37
|
-
parseFixerPrerequisites,
|
|
38
34
|
validateAcceptedCoderDetails,
|
|
39
35
|
validateAcceptedWorkerDetails,
|
|
40
|
-
validateFixerOutput
|
|
41
|
-
validateFixerPrerequisites
|
|
36
|
+
validateFixerOutput
|
|
42
37
|
};
|
|
@@ -91,10 +91,10 @@ const PUBLIC_ROLE_RECORDS = [
|
|
|
91
91
|
reportPhase: true
|
|
92
92
|
},
|
|
93
93
|
boardPlacement: "marshal",
|
|
94
|
+
/** #1168: dispatch is first message; navigator reads admitted instruction. */
|
|
95
|
+
navigatorSubject: "public-instruction",
|
|
94
96
|
activationFlags: [
|
|
95
|
-
{ field: "
|
|
96
|
-
{ field: "phase", flag: "ak-fixer-phase", binds: "phase" },
|
|
97
|
-
{ field: "prerequisitesPath", flag: "ak-fixer-prerequisites" }
|
|
97
|
+
{ field: "phase", flag: "ak-fixer-phase", binds: "phase" }
|
|
98
98
|
],
|
|
99
99
|
activationStage: "load-and-install",
|
|
100
100
|
sessionMaterials: [
|
|
@@ -121,8 +121,9 @@ const PUBLIC_ROLE_RECORDS = [
|
|
|
121
121
|
artifactFace: {
|
|
122
122
|
reportPhase: true
|
|
123
123
|
},
|
|
124
|
+
/** #1168: dispatch is first message; navigator reads admitted instruction. */
|
|
125
|
+
navigatorSubject: "public-instruction",
|
|
124
126
|
activationFlags: [
|
|
125
|
-
{ field: "taskPath", flag: "ak-coder-task", binds: "input" },
|
|
126
127
|
{ field: "phase", flag: "ak-coder-phase", binds: "phase" }
|
|
127
128
|
],
|
|
128
129
|
activationStage: "load-and-install",
|
|
@@ -16,7 +16,6 @@ import { readPageSync, renderCurrentSync, updateSectionSync, writeSectionSync }
|
|
|
16
16
|
import { loadDoctorCase, } from "../doctor-evidence.js";
|
|
17
17
|
import { parseCollectorPrNumber, parseCollectorRepository, } from "../collector-config.js";
|
|
18
18
|
import { ownerRepoFromGitHubRemoteUrl } from "./github-remote.js";
|
|
19
|
-
import { FixerPacketValidationError, parseFixerPrerequisites, } from "../package-contracts/fixer-packet.js";
|
|
20
19
|
import { createProductionMergerGitState } from "../merger-git-state.js";
|
|
21
20
|
import { validateMergerInput, } from "../merger-contracts.js";
|
|
22
21
|
import { sha256Hex } from "../sha256.js";
|
|
@@ -271,12 +270,10 @@ export async function relocateAdmittedRunToTicket(admitted, authority, heldLease
|
|
|
271
270
|
const admittedRecord = admitted;
|
|
272
271
|
rewriteRunDirectoryPathFields(admittedRecord, [
|
|
273
272
|
"runDirectory",
|
|
274
|
-
"taskPath",
|
|
275
|
-
"packetPath",
|
|
276
|
-
"prerequisitesPath",
|
|
277
273
|
"mergerInputPath",
|
|
278
274
|
], oldRunDirectory, target.runDirectory);
|
|
279
|
-
// #1165: caller
|
|
275
|
+
// #1165/#1168: caller file-flag paths stay as given. Obsolete copy fields
|
|
276
|
+
// (taskPath/packetPath) are not rewritten — stock volumes keep their bytes.
|
|
280
277
|
admitted.principal = principal;
|
|
281
278
|
// current.json projects host.original from this run directory. Ownership is
|
|
282
279
|
// already transferred; a refuse still carries the true cause to the caller
|
|
@@ -428,7 +425,8 @@ function assignPublicSeatOption(owner, taken, fields) {
|
|
|
428
425
|
fields.authorityRefs.push(requireAuthorityRef(value));
|
|
429
426
|
return;
|
|
430
427
|
case "prerequisites":
|
|
431
|
-
|
|
428
|
+
// #1168: same opaque file-flag rule as --attach.
|
|
429
|
+
fields.prerequisitesPath = requireProvidedOptionValue(taken.def.canonical, value);
|
|
432
430
|
return;
|
|
433
431
|
case "pr":
|
|
434
432
|
fields.prNumber = parsePositivePrOption(value);
|
|
@@ -716,16 +714,13 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
716
714
|
if (!record.phases.some((item) => item === phase)) {
|
|
717
715
|
throw new CliUsageError("coder phase must be plan or apply");
|
|
718
716
|
}
|
|
717
|
+
// #1168: dispatch text is the first message only — no task.md copy.
|
|
719
718
|
return admitStandardMaterialInvocation("coder", {
|
|
720
719
|
...shared,
|
|
721
720
|
instruction,
|
|
722
721
|
attachmentPaths,
|
|
723
722
|
...project,
|
|
724
|
-
placedFields: async (
|
|
725
|
-
const taskPath = join(placed.runDirectory, "task.md");
|
|
726
|
-
await writeFile(taskPath, instruction, "utf8");
|
|
727
|
-
return { phase, taskPath };
|
|
728
|
-
},
|
|
723
|
+
placedFields: async () => ({ phase }),
|
|
729
724
|
});
|
|
730
725
|
}
|
|
731
726
|
case "worker-packet": {
|
|
@@ -736,48 +731,18 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
736
731
|
if (!record.phases.some((item) => item === phase)) {
|
|
737
732
|
throw new CliUsageError("fixer phase must be plan or apply");
|
|
738
733
|
}
|
|
739
|
-
|
|
740
|
-
let prerequisitesSource;
|
|
741
|
-
if (parsed.prerequisitesPath !== undefined) {
|
|
742
|
-
const absolutePrereq = isAbsolute(parsed.prerequisitesPath)
|
|
743
|
-
? parsed.prerequisitesPath
|
|
744
|
-
: resolve(parsed.prerequisitesPath);
|
|
745
|
-
try {
|
|
746
|
-
prerequisitesSource = await readFile(absolutePrereq, "utf8");
|
|
747
|
-
}
|
|
748
|
-
catch (error) {
|
|
749
|
-
throw new CliUsageError(`fixer prerequisites path is unreadable: ${parsed.prerequisitesPath}`, { cause: error });
|
|
750
|
-
}
|
|
751
|
-
try {
|
|
752
|
-
prerequisites = parseFixerPrerequisites(prerequisitesSource);
|
|
753
|
-
}
|
|
754
|
-
catch (error) {
|
|
755
|
-
if (error instanceof FixerPacketValidationError) {
|
|
756
|
-
throw new CliUsageError(error.message, { cause: error });
|
|
757
|
-
}
|
|
758
|
-
throw error;
|
|
759
|
-
}
|
|
760
|
-
}
|
|
734
|
+
// #1168: dispatch once as first message; --prerequisites path as-is.
|
|
761
735
|
return admitStandardMaterialInvocation("fixer", {
|
|
762
736
|
...shared,
|
|
763
737
|
instruction,
|
|
764
738
|
attachmentPaths,
|
|
765
739
|
...project,
|
|
766
|
-
placedFields: async (
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
const packetPath = join(placed.runDirectory, "fix-packet.md");
|
|
773
|
-
await writeFile(packetPath, instruction, "utf8");
|
|
774
|
-
return {
|
|
775
|
-
phase,
|
|
776
|
-
packetPath,
|
|
777
|
-
prerequisites,
|
|
778
|
-
...(prerequisitesPath === undefined ? {} : { prerequisitesPath }),
|
|
779
|
-
};
|
|
780
|
-
},
|
|
740
|
+
placedFields: async () => ({
|
|
741
|
+
phase,
|
|
742
|
+
...(parsed.prerequisitesPath === undefined
|
|
743
|
+
? {}
|
|
744
|
+
: { prerequisitesPath: parsed.prerequisitesPath }),
|
|
745
|
+
}),
|
|
781
746
|
});
|
|
782
747
|
}
|
|
783
748
|
case "collect-target": {
|
|
@@ -960,13 +925,12 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
960
925
|
placedFields: async (placed) => {
|
|
961
926
|
const targetLabel = derived.targetObjectId === "" ? "(none observed)" : derived.targetObjectId;
|
|
962
927
|
const sourceLabel = derived.sourceObjectId === "" ? "(none observed)" : derived.sourceObjectId;
|
|
928
|
+
// #1168: git facts stay; do not encode dispatch text as task/authority copies.
|
|
963
929
|
const mergerInput = validateMergerInput({
|
|
964
930
|
attemptId: placed.runId,
|
|
965
931
|
targetObjectId: derived.targetObjectId,
|
|
966
932
|
sourceObjectId: derived.sourceObjectId,
|
|
967
933
|
materials: {
|
|
968
|
-
task: mergerMaterialFromUtf8(instruction),
|
|
969
|
-
authority: mergerMaterialFromUtf8(instruction),
|
|
970
934
|
targetIntent: mergerMaterialFromUtf8(`Investigate primary sources for target parent ${targetLabel}. Do not invent intent.`),
|
|
971
935
|
sourceIntent: mergerMaterialFromUtf8(`Investigate primary sources for source parent ${sourceLabel}. Do not invent intent.`),
|
|
972
936
|
},
|
|
@@ -1051,7 +1015,7 @@ async function persistPlacedAdmission(admitted, placed, model) {
|
|
|
1051
1015
|
* before materializeCountersignInvocation writes the page.
|
|
1052
1016
|
* Seats whose extra facts are known before placement pass them as admittedFields.
|
|
1053
1017
|
* Seats whose extra facts depend on the placed run pass placedFields
|
|
1054
|
-
* (
|
|
1018
|
+
* (merger writes merger-input.json with git facts; coder/fixer dispatch is first-message only, #1168).
|
|
1055
1019
|
*/
|
|
1056
1020
|
async function admitStandardMaterialInvocation(role, options) {
|
|
1057
1021
|
const defer = options.deferPersistence === true;
|
|
@@ -1162,14 +1126,17 @@ export function buildInstructionTransportPrompt(admitted) {
|
|
|
1162
1126
|
}
|
|
1163
1127
|
return lines.join("\n");
|
|
1164
1128
|
}
|
|
1165
|
-
// #1165 J3: assemble from the admitted instruction bytes themselves.
|
|
1129
|
+
// #1165 J3 / #1168: assemble from the admitted instruction bytes themselves.
|
|
1166
1130
|
const lines = [admitted.instruction];
|
|
1167
|
-
// #1164/#1165: each caller path keeps its file-flag provenance.
|
|
1131
|
+
// #1164/#1165/#1168: each caller path keeps its file-flag provenance.
|
|
1168
1132
|
const flaggedPaths = [
|
|
1169
1133
|
...admitted.attachments.map((attachment) => `--attach ${attachment.path}`),
|
|
1170
1134
|
...(admitted.requestManifestPath === undefined
|
|
1171
1135
|
? []
|
|
1172
1136
|
: [`--request-manifest ${admitted.requestManifestPath}`]),
|
|
1137
|
+
...(admitted.prerequisitesPath === undefined
|
|
1138
|
+
? []
|
|
1139
|
+
: [`--prerequisites ${admitted.prerequisitesPath}`]),
|
|
1173
1140
|
];
|
|
1174
1141
|
if (flaggedPaths.length > 0) {
|
|
1175
1142
|
lines.push("");
|