@akagilnc/pi-workflow-roles 0.1.5593 → 0.1.5614
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 +521 -707
- package/dist/compliance-transport.js +2 -5
- package/dist/doctor-auditor.js +1 -1
- package/dist/gatekeeper-role.js +1 -1
- package/dist/headless-host/production-host.js +505 -691
- package/dist/merger-contracts.js +6 -2
- package/dist/migrate-book-topology.js +5142 -10735
- package/dist/navigator-public-session.js +4 -4
- package/dist/navigator-work-base.js +5 -30
- package/dist/package-contracts/worker-output.js +1 -6
- package/dist/packaged-role-registry.js +9 -6
- package/dist/pi/role-turn-host.js +10 -1
- package/dist/public-cli/instruction-seat-run.js +133 -38
- package/dist/public-cli/invocation.js +38 -74
- package/dist/public-cli/main.js +18155 -18235
- package/dist/public-cli/option-definitions.js +21 -2
- package/dist/public-cli/post-admission.js +25 -24
- package/dist/public-cli/run-lifecycle.js +4 -43
- package/dist/public-cli/turn-request.js +4 -9
- package/dist/public-role-summons.js +5 -3
- package/dist/role-run-placement.js +7 -1
- package/dist/role-run-relocation.js +3 -4
- package/package.json +1 -1
- package/scripts/build-package.mjs +2 -4
- package/src/audited-run-identity.ts +30 -0
- package/src/compliance-transport.ts +1 -4
- package/src/doctor-auditor.ts +1 -1
- package/src/gatekeeper-role.ts +1 -1
- package/src/host-contracts.ts +6 -4
- package/src/merger-contracts.ts +6 -2
- package/src/merger-role.ts +11 -1
- package/src/navigator-attendance.ts +2 -2
- package/src/navigator-public-session.ts +9 -5
- package/src/navigator-work-base.ts +19 -34
- package/src/notary-role.ts +12 -21
- package/src/package-contracts/worker-output.ts +0 -8
- package/src/packaged-role-registry.ts +8 -7
- package/src/pi/role-turn-host.ts +11 -1
- package/src/public-cli/instruction-seat-run.ts +162 -42
- package/src/public-cli/invocation.ts +55 -93
- package/src/public-cli/option-definitions.ts +22 -2
- package/src/public-cli/post-admission.ts +30 -24
- package/src/public-cli/run-lifecycle.ts +4 -56
- package/src/public-cli/turn-request.ts +9 -8
- package/src/public-role-summons.ts +17 -6
- package/src/role-envelope.ts +4 -0
- package/src/role-run-placement.ts +10 -1
- package/src/role-run-relocation.ts +3 -4
- package/src/role-runtime-dependencies.ts +0 -2
- package/src/role-runtime.ts +54 -47
- package/src/worker-role.ts +11 -78
- package/dist/auditor-dossier-tool.js +0 -47
- package/dist/package-contracts/fixer-packet.js +0 -77
- package/packets/fixer-prerequisites.json +0 -6
- package/src/auditor-dossier-tool.ts +0 -63
- package/src/package-contracts/fixer-packet.ts +0 -91
|
@@ -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;
|
|
@@ -1120,19 +1084,35 @@ function admittedTransportPromptKind(admitted) {
|
|
|
1120
1084
|
return record.transportPrompt;
|
|
1121
1085
|
return "instruction";
|
|
1122
1086
|
}
|
|
1087
|
+
/** Append opaque caller file-flag paths after dialogue (#1165 / #1166 J11 / #1168). */
|
|
1088
|
+
export function appendCallerFileFlagPaths(body, attachments, requestManifestPath, prerequisitesPath) {
|
|
1089
|
+
const flaggedPaths = [
|
|
1090
|
+
...attachments.map((attachment) => `--attach ${attachment.path}`),
|
|
1091
|
+
...(requestManifestPath === undefined
|
|
1092
|
+
? []
|
|
1093
|
+
: [`--request-manifest ${requestManifestPath}`]),
|
|
1094
|
+
...(prerequisitesPath === undefined
|
|
1095
|
+
? []
|
|
1096
|
+
: [`--prerequisites ${prerequisitesPath}`]),
|
|
1097
|
+
];
|
|
1098
|
+
if (flaggedPaths.length === 0)
|
|
1099
|
+
return body;
|
|
1100
|
+
// ADR 0087 / #1165 / #1166 J13: after caller words, only necessary file flags
|
|
1101
|
+
// and original paths — no package-authored title or list wrapper.
|
|
1102
|
+
return [body, "", ...flaggedPaths].join("\n");
|
|
1103
|
+
}
|
|
1123
1104
|
/**
|
|
1124
1105
|
* One initial prompt transport. The registry `transportPrompt` leaf selects
|
|
1125
|
-
* a fixed kickoff, a bound baseline, or
|
|
1126
|
-
*
|
|
1106
|
+
* a fixed kickoff, a bound baseline, or skill args. Absent means the caller
|
|
1107
|
+
* instruction plus caller file-flag paths (ADR 0087).
|
|
1127
1108
|
* Engine / outsourcing material rides startup readingMaterial (#1167), not here.
|
|
1128
1109
|
*/
|
|
1129
1110
|
export function buildInstructionTransportPrompt(admitted) {
|
|
1130
1111
|
const kind = admittedTransportPromptKind(admitted);
|
|
1131
1112
|
if (kind === "fixed-kickoff") {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
return admitted.sourceRunPath;
|
|
1113
|
+
// #1166 / ADR 0087: audited-run identity rides startup materials; dialogue
|
|
1114
|
+
// prompt is peer body / reask only — never a package-computed directory path.
|
|
1115
|
+
return "";
|
|
1136
1116
|
}
|
|
1137
1117
|
if (kind === "baseline") {
|
|
1138
1118
|
if (admitted.baseRevision === undefined) {
|
|
@@ -1162,23 +1142,7 @@ export function buildInstructionTransportPrompt(admitted) {
|
|
|
1162
1142
|
}
|
|
1163
1143
|
return lines.join("\n");
|
|
1164
1144
|
}
|
|
1165
|
-
|
|
1166
|
-
const lines = [admitted.instruction];
|
|
1167
|
-
// #1164/#1165: each caller path keeps its file-flag provenance.
|
|
1168
|
-
const flaggedPaths = [
|
|
1169
|
-
...admitted.attachments.map((attachment) => `--attach ${attachment.path}`),
|
|
1170
|
-
...(admitted.requestManifestPath === undefined
|
|
1171
|
-
? []
|
|
1172
|
-
: [`--request-manifest ${admitted.requestManifestPath}`]),
|
|
1173
|
-
];
|
|
1174
|
-
if (flaggedPaths.length > 0) {
|
|
1175
|
-
lines.push("");
|
|
1176
|
-
lines.push("已受理附件:");
|
|
1177
|
-
for (const entry of flaggedPaths) {
|
|
1178
|
-
lines.push(`- ${entry}`);
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
return lines.join("\n");
|
|
1145
|
+
return appendCallerFileFlagPaths(admitted.instruction, admitted.attachments, admitted.requestManifestPath, admitted.prerequisitesPath);
|
|
1182
1146
|
}
|
|
1183
1147
|
/** Persist a deferred Countersign admission after same-ticket lookup found no retained run. */
|
|
1184
1148
|
export async function materializeCountersignInvocation(admitted, options) {
|