@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
|
@@ -1216,7 +1216,7 @@ async function runEngineDetourOnce(input) {
|
|
|
1216
1216
|
child.stderr.setEncoding("utf8").on("data", (chunk) => {
|
|
1217
1217
|
stderr += chunk;
|
|
1218
1218
|
});
|
|
1219
|
-
const
|
|
1219
|
+
const fail3 = (error) => {
|
|
1220
1220
|
if (settled) return;
|
|
1221
1221
|
settled = true;
|
|
1222
1222
|
if (signal !== void 0) {
|
|
@@ -1233,7 +1233,7 @@ async function runEngineDetourOnce(input) {
|
|
|
1233
1233
|
resolve21(result);
|
|
1234
1234
|
};
|
|
1235
1235
|
const onAbort = () => {
|
|
1236
|
-
|
|
1236
|
+
fail3(signal !== void 0 ? abortReasonError(signal) : new Error("aborted"));
|
|
1237
1237
|
try {
|
|
1238
1238
|
child.kill("SIGTERM");
|
|
1239
1239
|
} catch {
|
|
@@ -1246,7 +1246,7 @@ async function runEngineDetourOnce(input) {
|
|
|
1246
1246
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
child.on("error", (error) =>
|
|
1249
|
+
child.on("error", (error) => fail3(error));
|
|
1250
1250
|
child.on("close", (code) => {
|
|
1251
1251
|
succeed({ code: code ?? 1, stdout, stderr });
|
|
1252
1252
|
});
|
|
@@ -1608,85 +1608,8 @@ var init_fixer_output = __esm({
|
|
|
1608
1608
|
}
|
|
1609
1609
|
});
|
|
1610
1610
|
|
|
1611
|
-
// src/package-contracts/fixer-packet.ts
|
|
1612
|
-
import { Type as Type8 } from "typebox";
|
|
1613
|
-
import { Value } from "typebox/value";
|
|
1614
|
-
function causeMessage(cause) {
|
|
1615
|
-
if (cause instanceof Error) return cause.message;
|
|
1616
|
-
if (typeof cause === "string") return cause;
|
|
1617
|
-
try {
|
|
1618
|
-
return JSON.stringify(cause) ?? String(cause);
|
|
1619
|
-
} catch {
|
|
1620
|
-
return String(cause);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
function fail(cause) {
|
|
1624
|
-
throw new FixerPacketValidationError(cause);
|
|
1625
|
-
}
|
|
1626
|
-
function parseFailure(value) {
|
|
1627
|
-
if (!Array.isArray(value)) fail(new Error("Fixer prerequisites must be a JSON array"));
|
|
1628
|
-
for (const entry of value) {
|
|
1629
|
-
if (!isRecord(entry)) {
|
|
1630
|
-
fail(new Error("Fixer prerequisite entry must be an object with id and requirement fields"));
|
|
1631
|
-
}
|
|
1632
|
-
if (typeof entry.id !== "string" || !new RegExp(FIXER_PREREQUISITE_ID_PATTERN).test(entry.id)) {
|
|
1633
|
-
fail(new Error(`Fixer prerequisite id violates pattern ${FIXER_PREREQUISITE_ID_PATTERN}`));
|
|
1634
|
-
}
|
|
1635
|
-
if (typeof entry.requirement !== "string" || !/\S/.test(entry.requirement)) {
|
|
1636
|
-
fail(new Error("Fixer prerequisite requirement must be nonblank"));
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
fail(new Error("Fixer prerequisites violate the attachment schema"));
|
|
1640
|
-
}
|
|
1641
|
-
function validateFixerPrerequisites(value) {
|
|
1642
|
-
if (!Value.Check(fixerPrerequisitesSchema, value)) parseFailure(value);
|
|
1643
|
-
const entries = value;
|
|
1644
|
-
const ids = /* @__PURE__ */ new Set();
|
|
1645
|
-
const prerequisites = entries.map((entry) => {
|
|
1646
|
-
if (ids.has(entry.id)) {
|
|
1647
|
-
fail(new Error(`Fixer prerequisites contain duplicate id: ${entry.id}`));
|
|
1648
|
-
}
|
|
1649
|
-
ids.add(entry.id);
|
|
1650
|
-
return Object.freeze({ id: entry.id, requirement: entry.requirement });
|
|
1651
|
-
});
|
|
1652
|
-
return Object.freeze(prerequisites);
|
|
1653
|
-
}
|
|
1654
|
-
function parseFixerPrerequisites(source) {
|
|
1655
|
-
let decoded;
|
|
1656
|
-
try {
|
|
1657
|
-
decoded = JSON.parse(source);
|
|
1658
|
-
} catch (error) {
|
|
1659
|
-
fail(error);
|
|
1660
|
-
}
|
|
1661
|
-
return validateFixerPrerequisites(decoded);
|
|
1662
|
-
}
|
|
1663
|
-
var FIXER_PREREQUISITE_ID_PATTERN, fixerPrerequisiteSchema, fixerPrerequisitesSchema, FixerPacketValidationError;
|
|
1664
|
-
var init_fixer_packet = __esm({
|
|
1665
|
-
"src/package-contracts/fixer-packet.ts"() {
|
|
1666
|
-
"use strict";
|
|
1667
|
-
init_unknown_value();
|
|
1668
|
-
FIXER_PREREQUISITE_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]*$";
|
|
1669
|
-
fixerPrerequisiteSchema = Type8.Object({
|
|
1670
|
-
id: Type8.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }),
|
|
1671
|
-
requirement: Type8.String({ pattern: "\\S" })
|
|
1672
|
-
});
|
|
1673
|
-
fixerPrerequisitesSchema = Type8.Array(fixerPrerequisiteSchema);
|
|
1674
|
-
FixerPacketValidationError = class extends Error {
|
|
1675
|
-
code = "AK_INVALID_FIX_PACKET";
|
|
1676
|
-
constructor(cause) {
|
|
1677
|
-
const prefix = "Fixer prerequisites or instructions violate the invocation contract";
|
|
1678
|
-
super(
|
|
1679
|
-
cause === void 0 ? prefix : `${prefix}: ${causeMessage(cause)}`,
|
|
1680
|
-
cause === void 0 ? void 0 : { cause }
|
|
1681
|
-
);
|
|
1682
|
-
this.name = "FixerPacketValidationError";
|
|
1683
|
-
}
|
|
1684
|
-
};
|
|
1685
|
-
}
|
|
1686
|
-
});
|
|
1687
|
-
|
|
1688
1611
|
// src/package-contracts/worker-output.ts
|
|
1689
|
-
import { Type as
|
|
1612
|
+
import { Type as Type8 } from "typebox";
|
|
1690
1613
|
function validateAcceptedCoderDetails(output) {
|
|
1691
1614
|
return output;
|
|
1692
1615
|
}
|
|
@@ -1699,15 +1622,14 @@ var init_worker_output = __esm({
|
|
|
1699
1622
|
"use strict";
|
|
1700
1623
|
init_open_tool_schema();
|
|
1701
1624
|
init_fixer_output();
|
|
1702
|
-
init_fixer_packet();
|
|
1703
1625
|
init_terminating_infrastructure();
|
|
1704
1626
|
CODER_OUTPUT_TOOL_NAME = "ak_coder_output";
|
|
1705
1627
|
CODER_STATUS_DESCRIPTION = `planned | completed | refused | partially_completed | unfinished\u3002unfinished\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u81F4\u672C\u5C40\u672A\u5B8C\u6210\u3002${PARTIALLY_COMPLETED_DEFINITION}`;
|
|
1706
|
-
coderOutputObject =
|
|
1707
|
-
status:
|
|
1708
|
-
report:
|
|
1709
|
-
remainingScope:
|
|
1710
|
-
reason:
|
|
1628
|
+
coderOutputObject = Type8.Object({
|
|
1629
|
+
status: Type8.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
1630
|
+
report: Type8.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
|
|
1631
|
+
remainingScope: Type8.Unknown({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
|
|
1632
|
+
reason: Type8.Unknown({
|
|
1711
1633
|
description: "\u963B\u65AD\u539F\u56E0\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u3002\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002"
|
|
1712
1634
|
})
|
|
1713
1635
|
});
|
|
@@ -1725,7 +1647,7 @@ var init_canonical_json = __esm({
|
|
|
1725
1647
|
});
|
|
1726
1648
|
|
|
1727
1649
|
// src/doctor-contracts.ts
|
|
1728
|
-
import { Type as
|
|
1650
|
+
import { Type as Type9 } from "typebox";
|
|
1729
1651
|
function validateDoctorSubmissionShape(value) {
|
|
1730
1652
|
return value;
|
|
1731
1653
|
}
|
|
@@ -1751,25 +1673,25 @@ var init_doctor_contracts = __esm({
|
|
|
1751
1673
|
biteNone = "noRealBite";
|
|
1752
1674
|
DOCTOR_BITE_KINDS = [biteActual, biteNone];
|
|
1753
1675
|
DOCTOR_STATUS_DESCRIPTION = "completed | refused\u3002completed \u5141\u8BB8\u7A7A findings\uFF1Brefused \u4EC5\u5F53\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD";
|
|
1754
|
-
doctorSubmissionObject =
|
|
1755
|
-
status:
|
|
1756
|
-
case:
|
|
1676
|
+
doctorSubmissionObject = Type9.Object({
|
|
1677
|
+
status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
|
|
1678
|
+
case: Type9.Unknown({
|
|
1757
1679
|
description: "\u7559\u5B58\u592A\u533B\u7F72\u6848\u8EAB\u4EFD\uFF0C\u539F\u6837\u7559\u5B58\uFF08\u5982 issueNumber\u3001runsPath\uFF09\u3002\u673A\u68B0\u5C42\u53E6\u6309\u7ED1\u5B9A run \u6295\u5F71\u6848\u8EAB\u4EFD\uFF0C\u4E0D\u5728\u672C\u5B57\u6BB5\u91CD\u5224\u3002"
|
|
1758
1680
|
}),
|
|
1759
|
-
findings:
|
|
1681
|
+
findings: Type9.Unknown({
|
|
1760
1682
|
description: `\u9010\u6761\u8D44\u4EA7\u89C2\u5BDF\u4E0E\u5904\u65B9\uFF0C\u539F\u6837\u7559\u5B58\u3002\u4E00\u6761\u53EF\u542B targetKey\u3001targetKind\uFF08${DOCTOR_TARGET_KINDS.join(" | ")}\uFF09\u3001observation\u3001evidenceIds\u3001disposition\uFF08${DOCTOR_DISPOSITIONS.join(" | ")}\uFF09\u3001assetEvidence\uFF08targetKey\u3001targetKind\u3001evidenceId\uFF09\u3001guardrails\uFF08reproducibleFailure\u3001owningSeamOrInvariant\u3001deletionOrSimplificationSuffices\uFF0C\u5404\u9879\u53EF\u542B answer\u3001evidenceIds\u3001explanation\uFF09\u3001prescription\uFF08kind \u4E3A ${DOCTOR_PRESCRIPTION_KINDS.join(" | ")}\uFF0C\u53E6\u53EF\u5199 recommendation\u3001necessityExplanation\uFF09\u3001lastRealBite\uFF08kind \u4E3A ${DOCTOR_BITE_KINDS.join(" | ")}\uFF0C\u53E6\u53EF\u5199 targetKey\u3001evidenceId\u3001eligibleEvidenceIds\uFF09\u3002\u4E0D\u8981\u6C42\u4EFB\u4F55\u5904\u65B9\u6216\u53EF\u590D\u7528 finding\uFF1B\u7F3A\u53EF\u590D\u7528\u8D44\u4EA7\u6216 bounded-bite \u8BC1\u636E\u53EA\u6392\u9664\u5BF9\u5E94\u8D44\u4EA7\u5904\u65B9\u3002\u673A\u5668\u4E0D\u6838\u9A8C\u3002`
|
|
1761
1683
|
}),
|
|
1762
|
-
reason:
|
|
1684
|
+
reason: Type9.Unknown({
|
|
1763
1685
|
description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u8BC1\u8BCD\u7684\u539F\u56E0\uFF1B\u4EC5 refused \u65F6\u7528\u3002"
|
|
1764
1686
|
}),
|
|
1765
|
-
missingEvidence:
|
|
1687
|
+
missingEvidence: Type9.Unknown({
|
|
1766
1688
|
description: "\u5982\u5B9E\u8BC1\u8BCD\u6240\u9700\u800C\u5C1A\u7F3A\u7684\u8BC1\u636E\uFF0C\u539F\u6837\u7559\u5B58\uFF08\u5982\u6BCF\u9879 need\u3001targetKeys\uFF09\u3002"
|
|
1767
1689
|
})
|
|
1768
1690
|
});
|
|
1769
1691
|
doctorSubmissionSchema = withTerminatingOutputDeclarations(
|
|
1770
1692
|
openToolObject(doctorSubmissionObject)
|
|
1771
1693
|
);
|
|
1772
|
-
doctorEvidenceReadSchema =
|
|
1694
|
+
doctorEvidenceReadSchema = Type9.Object({ evidenceId: Type9.String({ minLength: 1, description: "\u5F85\u8BFB\u7559\u5B58\u8BC1\u636E\u6807\u8BC6" }), offset: Type9.Optional(Type9.Integer({ minimum: 0, description: "\u8D77\u59CB\u5B57\u8282\u504F\u79FB\uFF08\u4ECE 0 \u8BA1\uFF09" })), limit: Type9.Optional(Type9.Integer({ minimum: 1, description: "\u8FD4\u56DE\u5B57\u8282\u6570\uFF08\u65E0\u4E0A\u9650\uFF09" })) }, { additionalProperties: true });
|
|
1773
1695
|
DoctorEvidenceStore = class {
|
|
1774
1696
|
constructor(patient) {
|
|
1775
1697
|
this.patient = patient;
|
|
@@ -1838,8 +1760,8 @@ var init_exact_utf8 = __esm({
|
|
|
1838
1760
|
});
|
|
1839
1761
|
|
|
1840
1762
|
// src/merger-contracts.ts
|
|
1841
|
-
import { Type as
|
|
1842
|
-
function
|
|
1763
|
+
import { Type as Type10 } from "typebox";
|
|
1764
|
+
function fail(message = "Merger input violates its exact contract") {
|
|
1843
1765
|
throw new MergerInputContractError(message);
|
|
1844
1766
|
}
|
|
1845
1767
|
function deepFreeze(value) {
|
|
@@ -1850,14 +1772,17 @@ function deepFreeze(value) {
|
|
|
1850
1772
|
return value;
|
|
1851
1773
|
}
|
|
1852
1774
|
function readMaterial(value, label) {
|
|
1853
|
-
if (!isRecord(value) || typeof value.bytesBase64 !== "string")
|
|
1775
|
+
if (!isRecord(value) || typeof value.bytesBase64 !== "string") fail(`Merger ${label} material is malformed`);
|
|
1854
1776
|
exactUtf8(Buffer.from(value.bytesBase64, "base64"), `Merger ${label} material`);
|
|
1855
1777
|
return { bytesBase64: value.bytesBase64, sha256: typeof value.sha256 === "string" ? value.sha256 : "" };
|
|
1856
1778
|
}
|
|
1857
1779
|
function validateMergerInput(value) {
|
|
1858
|
-
if (!isRecord(value) || blank(value.attemptId))
|
|
1859
|
-
if (!isRecord(value.materials))
|
|
1860
|
-
const materials = {
|
|
1780
|
+
if (!isRecord(value) || blank(value.attemptId)) fail("Merger input requires a non-empty attemptId for accounting");
|
|
1781
|
+
if (!isRecord(value.materials)) fail("Merger materials are missing");
|
|
1782
|
+
const materials = {
|
|
1783
|
+
targetIntent: readMaterial(value.materials.targetIntent, "targetIntent"),
|
|
1784
|
+
sourceIntent: readMaterial(value.materials.sourceIntent, "sourceIntent")
|
|
1785
|
+
};
|
|
1861
1786
|
const authorizedChecks = Array.isArray(value.authorizedChecks) ? value.authorizedChecks.filter((check) => isRecord(check)).map((c) => ({ name: asString(c.name), argv: asStringArray(c.argv).filter((a) => a.trim().length > 0) })).filter((c) => c.name.trim().length > 0 && c.argv.length > 0) : [];
|
|
1862
1787
|
return deepFreeze(structuredClone({ attemptId: value.attemptId.trim(), targetObjectId: asString(value.targetObjectId), sourceObjectId: asString(value.sourceObjectId), materials, expectedConflictPaths: asStringArray(value.expectedConflictPaths), resolutionScope: asStringArray(value.resolutionScope), authorizedChecks }));
|
|
1863
1788
|
}
|
|
@@ -1869,24 +1794,25 @@ var init_merger_contracts = __esm({
|
|
|
1869
1794
|
init_open_tool_schema();
|
|
1870
1795
|
init_terminating_infrastructure();
|
|
1871
1796
|
init_unknown_value();
|
|
1872
|
-
materialSchema =
|
|
1873
|
-
checkSchema =
|
|
1874
|
-
mergerInputSchema =
|
|
1875
|
-
attemptId:
|
|
1876
|
-
targetObjectId:
|
|
1877
|
-
sourceObjectId:
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1797
|
+
materialSchema = Type10.Object({ bytesBase64: Type10.String(), sha256: Type10.String() });
|
|
1798
|
+
checkSchema = Type10.Object({ name: Type10.String({ minLength: 1 }), argv: Type10.Array(Type10.String({ minLength: 1 }), { minItems: 1 }) });
|
|
1799
|
+
mergerInputSchema = Type10.Object({
|
|
1800
|
+
attemptId: Type10.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
|
|
1801
|
+
targetObjectId: Type10.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
|
|
1802
|
+
sourceObjectId: Type10.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
|
|
1803
|
+
// #1168: task/authority dispatch copies removed; git-fact intents remain.
|
|
1804
|
+
materials: Type10.Object({ targetIntent: materialSchema, sourceIntent: materialSchema }),
|
|
1805
|
+
expectedConflictPaths: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
|
|
1806
|
+
resolutionScope: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
|
|
1807
|
+
authorizedChecks: Type10.Array(checkSchema)
|
|
1882
1808
|
});
|
|
1883
1809
|
MERGER_STATUS_DESCRIPTION = "completed | escalate";
|
|
1884
|
-
mergerOutputObject =
|
|
1885
|
-
status:
|
|
1886
|
-
attemptId:
|
|
1887
|
-
report:
|
|
1888
|
-
mergeCommitId:
|
|
1889
|
-
diagnosis:
|
|
1810
|
+
mergerOutputObject = Type10.Object({
|
|
1811
|
+
status: Type10.Unknown({ description: MERGER_STATUS_DESCRIPTION }),
|
|
1812
|
+
attemptId: Type10.Unknown({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }),
|
|
1813
|
+
report: Type10.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
|
|
1814
|
+
mergeCommitId: Type10.Unknown({ description: "\u5B8C\u6210\u5408\u5E76 commit object ID" }),
|
|
1815
|
+
diagnosis: Type10.Unknown({
|
|
1890
1816
|
description: "\u5408\u5E76\u65E0\u6CD5\u6216\u4E0D\u5E94\u7531\u672C\u5E2D\u5B8C\u6210\u7684\u539F\u56E0\uFF08\u542B\u65E0\u8FDB\u884C\u4E2D\u5408\u5E76\u3001\u65E0\u6D3B\u53EF\u5E72\u3001\u9700\u65B0\u7684\u4EA7\u54C1/\u6743\u529B\u51B3\u5B9A\uFF09"
|
|
1891
1817
|
})
|
|
1892
1818
|
});
|
|
@@ -1941,7 +1867,7 @@ var init_countersign_contracts = __esm({
|
|
|
1941
1867
|
});
|
|
1942
1868
|
|
|
1943
1869
|
// src/gleaner-left-contracts.ts
|
|
1944
|
-
import { Type as
|
|
1870
|
+
import { Type as Type11 } from "typebox";
|
|
1945
1871
|
var GLEANER_LEFT_OUTPUT_TOOL_NAME, gleanerLeftOutputSchema, GLEANER_LEFT_BASE_FLAG;
|
|
1946
1872
|
var init_gleaner_left_contracts = __esm({
|
|
1947
1873
|
"src/gleaner-left-contracts.ts"() {
|
|
@@ -1952,11 +1878,11 @@ var init_gleaner_left_contracts = __esm({
|
|
|
1952
1878
|
GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
|
|
1953
1879
|
gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
|
|
1954
1880
|
openToolObject(
|
|
1955
|
-
|
|
1956
|
-
status:
|
|
1881
|
+
Type11.Object({
|
|
1882
|
+
status: Type11.Unknown({
|
|
1957
1883
|
description: "completed"
|
|
1958
1884
|
}),
|
|
1959
|
-
findings:
|
|
1885
|
+
findings: Type11.Unknown({
|
|
1960
1886
|
description: "\u5F39\u7AE0\u5217\u8868\uFF1B\u6BCF\u6761\u53EF\u542B pointer\uFF08\u6587\u4EF6/\u884C\u6307\u9488\uFF09\u4E0E statement\uFF08\u7591\u70B9\u9648\u8FF0\uFF09\uFF0C\u539F\u6837\u7559\u5B58\u3002\u7A7A\u5217\u8868\u5408\u6CD5\u5B8C\u5C40\uFF1B\u673A\u5668\u4E0D\u5224\u5F39\u7AE0\u662F\u5426\u6210\u7ACB\u3002"
|
|
1961
1887
|
})
|
|
1962
1888
|
})
|
|
@@ -2044,7 +1970,7 @@ var init_ticket_provenance_contracts = __esm({
|
|
|
2044
1970
|
});
|
|
2045
1971
|
|
|
2046
1972
|
// src/diarist-contracts.ts
|
|
2047
|
-
import { Type as
|
|
1973
|
+
import { Type as Type12 } from "typebox";
|
|
2048
1974
|
function projectDiaristSessions(value) {
|
|
2049
1975
|
const raw = value?.sessions;
|
|
2050
1976
|
if (raw === void 0) return [];
|
|
@@ -2077,20 +2003,20 @@ var init_diarist_contracts = __esm({
|
|
|
2077
2003
|
DIARIST_SESSIONS_DESCRIPTION = "\u5BF9\u8BDD\u8FB9\u754C\u3002\u6BCF\u5377\u542B path\uFF08\u4F1A\u8BDD\u5377\u7EDD\u5BF9\u6216\u53EF\u8BFB\u8DEF\u5F84\uFF09\u4E0E ranges\uFF08\u672C\u5377\u672C\u8F6E\u5404\u533A\u95F4\uFF09\u3002\u6BCF\u6BB5\u533A\u95F4\u542B from / to\uFF1B\u8D77\u70B9\u4E0E\u7EC8\u70B9\u5404\u5199 id\uFF08\u539F\u751F id\uFF09\u6216 line\uFF08\u672C\u8F6E\u884C\u53F7\uFF09\uFF0C\u4E8C\u9009\u4E00\u3002\u7A7A\u5217\u8868\uFF1D\u672C\u8F6E\u65E0\u5BF9\u8BDD\u53EF\u5212\u3002\u7AEF\u70B9\u65E0\u6CD5\u6307\u540D\u65F6\u8D70 reask\uFF0C\u4E0D\u4E2D\u6B62\u3002";
|
|
2078
2004
|
diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
2079
2005
|
openToolObject(
|
|
2080
|
-
|
|
2081
|
-
status:
|
|
2006
|
+
Type12.Object({
|
|
2007
|
+
status: Type12.Unknown({
|
|
2082
2008
|
description: "completed | escalate"
|
|
2083
2009
|
}),
|
|
2084
|
-
ticketNumber:
|
|
2085
|
-
|
|
2010
|
+
ticketNumber: Type12.Optional(
|
|
2011
|
+
Type12.Unknown({
|
|
2086
2012
|
description: "\u672C\u5EAD\u5BF9\u8C61\u7968\u53F7\uFF08\u6B63\u6574\u6570\uFF09\u6216 null/\u7701\u7565\uFF1D\u771F\u65E0\u7968\uFF1B\u4E0B\u6E38\u8D70 typed \u952E\uFF1B\u8BA4\u4E0D\u51FA\u7528 status=escalate\uFF0C\u4E0D\u6D17\u6210\u65E0\u5F55\u3002\u673A\u68B0\u5C42\u4E0D\u91CD\u5224\u3002"
|
|
2087
2013
|
})
|
|
2088
2014
|
),
|
|
2089
|
-
reason:
|
|
2015
|
+
reason: Type12.Unknown({
|
|
2090
2016
|
description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
|
|
2091
2017
|
}),
|
|
2092
|
-
sessions:
|
|
2093
|
-
ticketSessions:
|
|
2018
|
+
sessions: Type12.Optional(Type12.Unknown({ description: DIARIST_SESSIONS_DESCRIPTION })),
|
|
2019
|
+
ticketSessions: Type12.Unknown({
|
|
2094
2020
|
description: `\u591A\u7968\u5EAD\u9010\u7968\u5BF9\u8BDD\u8FB9\u754C\uFF1B\u6BCF\u7968\u542B ticketNumber\uFF08\u672C\u6761\u8FB9\u754C\u6240\u5F52\u7968\u53F7\uFF0C\u6B63\u6574\u6570\uFF09\u4E0E sessions\uFF08${DIARIST_SESSIONS_DESCRIPTION}\uFF09\u3002\u4E00\u6B21\u4EA4\u5377\u5404\u7968\u5404\u81EA\u5206\u5F55\u3002\u4E0E\u5355\u7968 sessions \u4E8C\u9009\u4E00\u3002`
|
|
2095
2021
|
})
|
|
2096
2022
|
})
|
|
@@ -2100,7 +2026,7 @@ var init_diarist_contracts = __esm({
|
|
|
2100
2026
|
});
|
|
2101
2027
|
|
|
2102
2028
|
// src/secretariat-contracts.ts
|
|
2103
|
-
import { Type as
|
|
2029
|
+
import { Type as Type13 } from "typebox";
|
|
2104
2030
|
var SECRETARIAT_OUTPUT_TOOL_NAME, secretariatVerdictSchema, SECRETARIAT_GATE_OFFICER_ENTRY_TYPE, SECRETARIAT_COUNTERSIGN_TERMINAL_FACT_KEY;
|
|
2105
2031
|
var init_secretariat_contracts = __esm({
|
|
2106
2032
|
"src/secretariat-contracts.ts"() {
|
|
@@ -2108,17 +2034,17 @@ var init_secretariat_contracts = __esm({
|
|
|
2108
2034
|
init_terminating_infrastructure();
|
|
2109
2035
|
SECRETARIAT_OUTPUT_TOOL_NAME = "ak_secretariat_output";
|
|
2110
2036
|
secretariatVerdictSchema = withTerminatingOutputDeclarations(
|
|
2111
|
-
|
|
2037
|
+
Type13.Object(
|
|
2112
2038
|
{
|
|
2113
|
-
secretariatStatus:
|
|
2039
|
+
secretariatStatus: Type13.Unknown({
|
|
2114
2040
|
description: "converged | escalate"
|
|
2115
2041
|
}),
|
|
2116
|
-
ticketNumber:
|
|
2117
|
-
|
|
2042
|
+
ticketNumber: Type13.Optional(
|
|
2043
|
+
Type13.Unknown({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
|
|
2118
2044
|
),
|
|
2119
|
-
note:
|
|
2120
|
-
evidence:
|
|
2121
|
-
decisionGate:
|
|
2045
|
+
note: Type13.Unknown({ description: "\u9644\u6CE8" }),
|
|
2046
|
+
evidence: Type13.Optional(Type13.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
2047
|
+
decisionGate: Type13.Unknown({
|
|
2122
2048
|
description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879\uFF1B\u53EF\u5199 question \u4E0E options\uFF0C\u539F\u6837\u7559\u5B58\u3002"
|
|
2123
2049
|
})
|
|
2124
2050
|
},
|
|
@@ -2426,10 +2352,10 @@ var init_packaged_role_registry = __esm({
|
|
|
2426
2352
|
reportPhase: true
|
|
2427
2353
|
},
|
|
2428
2354
|
boardPlacement: "marshal",
|
|
2355
|
+
/** #1168: dispatch is first message; navigator reads admitted instruction. */
|
|
2356
|
+
navigatorSubject: "public-instruction",
|
|
2429
2357
|
activationFlags: [
|
|
2430
|
-
{ field: "
|
|
2431
|
-
{ field: "phase", flag: "ak-fixer-phase", binds: "phase" },
|
|
2432
|
-
{ field: "prerequisitesPath", flag: "ak-fixer-prerequisites" }
|
|
2358
|
+
{ field: "phase", flag: "ak-fixer-phase", binds: "phase" }
|
|
2433
2359
|
],
|
|
2434
2360
|
activationStage: "load-and-install",
|
|
2435
2361
|
sessionMaterials: [
|
|
@@ -2456,8 +2382,9 @@ var init_packaged_role_registry = __esm({
|
|
|
2456
2382
|
artifactFace: {
|
|
2457
2383
|
reportPhase: true
|
|
2458
2384
|
},
|
|
2385
|
+
/** #1168: dispatch is first message; navigator reads admitted instruction. */
|
|
2386
|
+
navigatorSubject: "public-instruction",
|
|
2459
2387
|
activationFlags: [
|
|
2460
|
-
{ field: "taskPath", flag: "ak-coder-task", binds: "input" },
|
|
2461
2388
|
{ field: "phase", flag: "ak-coder-phase", binds: "phase" }
|
|
2462
2389
|
],
|
|
2463
2390
|
activationStage: "load-and-install",
|
|
@@ -2826,7 +2753,7 @@ var init_cli_errors = __esm({
|
|
|
2826
2753
|
});
|
|
2827
2754
|
|
|
2828
2755
|
// src/collector-config.ts
|
|
2829
|
-
function
|
|
2756
|
+
function fail2(message, cause) {
|
|
2830
2757
|
throw new Error(message, cause === void 0 ? void 0 : { cause });
|
|
2831
2758
|
}
|
|
2832
2759
|
function conservativeAscii(input) {
|
|
@@ -2837,20 +2764,20 @@ function conservativeAscii(input) {
|
|
|
2837
2764
|
return true;
|
|
2838
2765
|
}
|
|
2839
2766
|
function parseCollectorRepository(raw) {
|
|
2840
|
-
if (typeof raw !== "string" || raw.trim() !== raw || raw.length === 0)
|
|
2841
|
-
if (!conservativeAscii(raw) || raw.includes("://") || /[?#@%\\ ]/.test(raw))
|
|
2767
|
+
if (typeof raw !== "string" || raw.trim() !== raw || raw.length === 0) fail2("Collector repository must be a string owner/repo");
|
|
2768
|
+
if (!conservativeAscii(raw) || raw.includes("://") || /[?#@%\\ ]/.test(raw)) fail2("Collector repository rejects URL syntax and non-identity bytes");
|
|
2842
2769
|
const parts = raw.split("/");
|
|
2843
|
-
if (parts.length !== 2)
|
|
2770
|
+
if (parts.length !== 2) fail2("Collector repository must contain exactly one '/' separating owner and repo");
|
|
2844
2771
|
const [ownerDisplay, repoDisplay] = parts;
|
|
2845
|
-
if (!COLLECTOR_OWNER_PATTERN.test(ownerDisplay) || !COLLECTOR_REPO_PATTERN.test(repoDisplay))
|
|
2772
|
+
if (!COLLECTOR_OWNER_PATTERN.test(ownerDisplay) || !COLLECTOR_REPO_PATTERN.test(repoDisplay)) fail2("Collector repository does not match the conservative owner/repo grammar");
|
|
2846
2773
|
const owner = ownerDisplay.toLowerCase();
|
|
2847
2774
|
const repo = repoDisplay.toLowerCase();
|
|
2848
2775
|
return { display: raw, canonical: `${owner}/${repo}`, owner, repo };
|
|
2849
2776
|
}
|
|
2850
2777
|
function parseCollectorPrNumber(raw) {
|
|
2851
|
-
if (typeof raw !== "string" && typeof raw !== "number")
|
|
2778
|
+
if (typeof raw !== "string" && typeof raw !== "number") fail2("Collector pull request number is required");
|
|
2852
2779
|
const value = parseTicketNumber(raw);
|
|
2853
|
-
if (value === void 0)
|
|
2780
|
+
if (value === void 0) fail2(typeof raw === "string" && !isTicketNumberString(raw) ? "Collector pull request number must be a positive safe integer string" : "Collector pull request number must be a positive safe integer");
|
|
2854
2781
|
return value;
|
|
2855
2782
|
}
|
|
2856
2783
|
var COLLECTOR_OWNER_PATTERN, COLLECTOR_REPO_PATTERN;
|
|
@@ -2871,7 +2798,7 @@ __export(auditor_dossier_tool_exports, {
|
|
|
2871
2798
|
createAuditorDossierTool: () => createAuditorDossierTool
|
|
2872
2799
|
});
|
|
2873
2800
|
import { join as join7, resolve as resolve3 } from "node:path";
|
|
2874
|
-
import { Type as
|
|
2801
|
+
import { Type as Type14 } from "typebox";
|
|
2875
2802
|
function auditorRunDirectory(context) {
|
|
2876
2803
|
const sessionFile = context.sessionManager?.getSessionFile?.();
|
|
2877
2804
|
if (sessionFile === void 0) return void 0;
|
|
@@ -2883,7 +2810,7 @@ function createAuditorDossierTool(runDirectory) {
|
|
|
2883
2810
|
description: "\u5B9A\u4F4D\u672C\u5BA1\u8BA1\u5E2D\u7ED1\u5B9A\u7684 run \u5377\u5B97\u53CA\u5176\u8BC1\u636E\u5165\u53E3\u3002",
|
|
2884
2811
|
// #836 r16 class 3: execute() ignores `_params` entirely — a closed root
|
|
2885
2812
|
// only rejects the role for saying more.
|
|
2886
|
-
parameters:
|
|
2813
|
+
parameters: Type14.Object({}, { additionalProperties: true }),
|
|
2887
2814
|
async execute(_id, _params) {
|
|
2888
2815
|
if (runDirectory === void 0) {
|
|
2889
2816
|
return {
|
|
@@ -3007,7 +2934,7 @@ var init_submission_errors = __esm({
|
|
|
3007
2934
|
});
|
|
3008
2935
|
|
|
3009
2936
|
// src/collector-tool-schemas.ts
|
|
3010
|
-
import { Type as
|
|
2937
|
+
import { Type as Type15 } from "typebox";
|
|
3011
2938
|
var collectorOutputBaseSchema, collectorOutputArgsSchema;
|
|
3012
2939
|
var init_collector_tool_schemas = __esm({
|
|
3013
2940
|
"src/collector-tool-schemas.ts"() {
|
|
@@ -3015,11 +2942,11 @@ var init_collector_tool_schemas = __esm({
|
|
|
3015
2942
|
init_open_tool_schema();
|
|
3016
2943
|
init_terminating_infrastructure();
|
|
3017
2944
|
collectorOutputBaseSchema = openToolObject(
|
|
3018
|
-
|
|
3019
|
-
groups:
|
|
2945
|
+
Type15.Object({
|
|
2946
|
+
groups: Type15.Unsafe({
|
|
3020
2947
|
description: "\u6309\u673A\u5668\u8EAB\u4EFD\u5F52\u7EC4\u7684\u51FA\u5E2D\u3001\u6750\u6599\u4E0E\u9010\u6761 findings\uFF08LLM \u81EA\u884C\u4ECE\u5BBF\u4E3B CLI \u53D6\u8BC1\u6574\u7406\uFF1B\u4EE3\u7801\u4E0D\u4EE3\u6536\u4E0D\u5F52\u5E76\uFF09\u3002"
|
|
3021
2948
|
}),
|
|
3022
|
-
unfinishedReasons:
|
|
2949
|
+
unfinishedReasons: Type15.Unknown({
|
|
3023
2950
|
description: "\u672A\u5B8C\u6210\u539F\u56E0\uFF1B\u53D6\u8BC1\u53D7\u9650\u65F6\u5982\u5B9E\u62A5\u544A\u3002"
|
|
3024
2951
|
})
|
|
3025
2952
|
})
|
|
@@ -6403,8 +6330,8 @@ var init_option_definitions = __esm({
|
|
|
6403
6330
|
repeatable: false,
|
|
6404
6331
|
form: "option",
|
|
6405
6332
|
description: {
|
|
6406
|
-
en: "
|
|
6407
|
-
zh: "
|
|
6333
|
+
en: "Caller prerequisites path passed as-is to the role. Package does not read, copy, or validate; use an absolute path when cwd differs from --project.",
|
|
6334
|
+
zh: "\u8C03\u7528\u65B9\u524D\u7F6E\u6761\u4EF6\u6587\u4EF6\u8DEF\u5F84\u539F\u6837\u9012\u7ED9\u8859\u95E8\u3002\u5305\u4E0D\u8BFB\u3001\u4E0D\u590D\u5236\u3001\u4E0D\u6821\u9A8C\uFF1B\u8C03\u7528\u65B9\u5F53\u524D\u76EE\u5F55\u4E0E --project \u4E0D\u540C\u65F6\u8BF7\u7ED9\u7EDD\u5BF9\u8DEF\u5F84\u3002"
|
|
6408
6335
|
}
|
|
6409
6336
|
}
|
|
6410
6337
|
];
|
|
@@ -7145,9 +7072,6 @@ async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
|
|
|
7145
7072
|
admittedRecord,
|
|
7146
7073
|
[
|
|
7147
7074
|
"runDirectory",
|
|
7148
|
-
"taskPath",
|
|
7149
|
-
"packetPath",
|
|
7150
|
-
"prerequisitesPath",
|
|
7151
7075
|
"mergerInputPath"
|
|
7152
7076
|
],
|
|
7153
7077
|
oldRunDirectory,
|
|
@@ -7280,7 +7204,7 @@ function assignPublicSeatOption(owner, taken, fields) {
|
|
|
7280
7204
|
fields.authorityRefs.push(requireAuthorityRef(value));
|
|
7281
7205
|
return;
|
|
7282
7206
|
case "prerequisites":
|
|
7283
|
-
fields.prerequisitesPath =
|
|
7207
|
+
fields.prerequisitesPath = requireProvidedOptionValue(taken.def.canonical, value);
|
|
7284
7208
|
return;
|
|
7285
7209
|
case "pr":
|
|
7286
7210
|
fields.prNumber = parsePositivePrOption(value);
|
|
@@ -7530,11 +7454,7 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
7530
7454
|
instruction,
|
|
7531
7455
|
attachmentPaths,
|
|
7532
7456
|
...project,
|
|
7533
|
-
placedFields: async (
|
|
7534
|
-
const taskPath = join11(placed.runDirectory, "task.md");
|
|
7535
|
-
await writeFile(taskPath, instruction, "utf8");
|
|
7536
|
-
return { phase, taskPath };
|
|
7537
|
-
}
|
|
7457
|
+
placedFields: async () => ({ phase })
|
|
7538
7458
|
});
|
|
7539
7459
|
}
|
|
7540
7460
|
case "worker-packet": {
|
|
@@ -7545,52 +7465,15 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
7545
7465
|
if (!record.phases.some((item) => item === phase)) {
|
|
7546
7466
|
throw new CliUsageError("fixer phase must be plan or apply");
|
|
7547
7467
|
}
|
|
7548
|
-
let prerequisites = Object.freeze([]);
|
|
7549
|
-
let prerequisitesSource;
|
|
7550
|
-
if (parsed.prerequisitesPath !== void 0) {
|
|
7551
|
-
const absolutePrereq = isAbsolute5(parsed.prerequisitesPath) ? parsed.prerequisitesPath : resolve9(parsed.prerequisitesPath);
|
|
7552
|
-
try {
|
|
7553
|
-
prerequisitesSource = await readFile7(absolutePrereq, "utf8");
|
|
7554
|
-
} catch (error) {
|
|
7555
|
-
throw new CliUsageError(
|
|
7556
|
-
`fixer prerequisites path is unreadable: ${parsed.prerequisitesPath}`,
|
|
7557
|
-
{ cause: error }
|
|
7558
|
-
);
|
|
7559
|
-
}
|
|
7560
|
-
try {
|
|
7561
|
-
prerequisites = parseFixerPrerequisites(prerequisitesSource);
|
|
7562
|
-
} catch (error) {
|
|
7563
|
-
if (error instanceof FixerPacketValidationError) {
|
|
7564
|
-
throw new CliUsageError(error.message, { cause: error });
|
|
7565
|
-
}
|
|
7566
|
-
throw error;
|
|
7567
|
-
}
|
|
7568
|
-
}
|
|
7569
7468
|
return admitStandardMaterialInvocation("fixer", {
|
|
7570
7469
|
...shared,
|
|
7571
7470
|
instruction,
|
|
7572
7471
|
attachmentPaths,
|
|
7573
7472
|
...project,
|
|
7574
|
-
placedFields: async (
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
await writeFile(
|
|
7579
|
-
prerequisitesPath,
|
|
7580
|
-
`${JSON.stringify(prerequisites, null, 2)}
|
|
7581
|
-
`,
|
|
7582
|
-
"utf8"
|
|
7583
|
-
);
|
|
7584
|
-
}
|
|
7585
|
-
const packetPath = join11(placed.runDirectory, "fix-packet.md");
|
|
7586
|
-
await writeFile(packetPath, instruction, "utf8");
|
|
7587
|
-
return {
|
|
7588
|
-
phase,
|
|
7589
|
-
packetPath,
|
|
7590
|
-
prerequisites,
|
|
7591
|
-
...prerequisitesPath === void 0 ? {} : { prerequisitesPath }
|
|
7592
|
-
};
|
|
7593
|
-
}
|
|
7473
|
+
placedFields: async () => ({
|
|
7474
|
+
phase,
|
|
7475
|
+
...parsed.prerequisitesPath === void 0 ? {} : { prerequisitesPath: parsed.prerequisitesPath }
|
|
7476
|
+
})
|
|
7594
7477
|
});
|
|
7595
7478
|
}
|
|
7596
7479
|
case "collect-target": {
|
|
@@ -7777,8 +7660,6 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
7777
7660
|
targetObjectId: derived.targetObjectId,
|
|
7778
7661
|
sourceObjectId: derived.sourceObjectId,
|
|
7779
7662
|
materials: {
|
|
7780
|
-
task: mergerMaterialFromUtf8(instruction),
|
|
7781
|
-
authority: mergerMaterialFromUtf8(instruction),
|
|
7782
7663
|
targetIntent: mergerMaterialFromUtf8(
|
|
7783
7664
|
`Investigate primary sources for target parent ${targetLabel}. Do not invent intent.`
|
|
7784
7665
|
),
|
|
@@ -7963,7 +7844,8 @@ function buildInstructionTransportPrompt(admitted) {
|
|
|
7963
7844
|
const lines = [admitted.instruction];
|
|
7964
7845
|
const flaggedPaths = [
|
|
7965
7846
|
...admitted.attachments.map((attachment) => `--attach ${attachment.path}`),
|
|
7966
|
-
...admitted.requestManifestPath === void 0 ? [] : [`--request-manifest ${admitted.requestManifestPath}`]
|
|
7847
|
+
...admitted.requestManifestPath === void 0 ? [] : [`--request-manifest ${admitted.requestManifestPath}`],
|
|
7848
|
+
...admitted.prerequisitesPath === void 0 ? [] : [`--prerequisites ${admitted.prerequisitesPath}`]
|
|
7967
7849
|
];
|
|
7968
7850
|
if (flaggedPaths.length > 0) {
|
|
7969
7851
|
lines.push("");
|
|
@@ -8363,7 +8245,6 @@ var init_invocation = __esm({
|
|
|
8363
8245
|
init_doctor_evidence();
|
|
8364
8246
|
init_collector_config();
|
|
8365
8247
|
init_github_remote();
|
|
8366
|
-
init_fixer_packet();
|
|
8367
8248
|
init_merger_git_state();
|
|
8368
8249
|
init_merger_contracts();
|
|
8369
8250
|
init_sha256();
|
|
@@ -12242,7 +12123,7 @@ function projectRelocatedTurnIdentity(request, result, admitted, relocation) {
|
|
|
12242
12123
|
mutableRequest.principal = admitted.principal;
|
|
12243
12124
|
const activation = mutableRequest.activation;
|
|
12244
12125
|
if (isRecord(activation)) {
|
|
12245
|
-
for (const field of ["
|
|
12126
|
+
for (const field of ["inputPath"]) {
|
|
12246
12127
|
const record = activation;
|
|
12247
12128
|
if (field in record) record[field] = rewrite(record[field]);
|
|
12248
12129
|
}
|
|
@@ -16574,7 +16455,7 @@ var init_analyst_model_groups = __esm({
|
|
|
16574
16455
|
|
|
16575
16456
|
// src/analyst-entry.ts
|
|
16576
16457
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
16577
|
-
import { Type as
|
|
16458
|
+
import { Type as Type16 } from "typebox";
|
|
16578
16459
|
function cachedPageMatchesRequestedScope(page, input) {
|
|
16579
16460
|
if (page.bookKey !== input.bookKey) return false;
|
|
16580
16461
|
const requestedTicket = input.ticketNumber ?? input.issueNumber;
|
|
@@ -16779,16 +16660,16 @@ var init_analyst_entry = __esm({
|
|
|
16779
16660
|
}
|
|
16780
16661
|
}
|
|
16781
16662
|
};
|
|
16782
|
-
analystSweepModeInputSchema =
|
|
16663
|
+
analystSweepModeInputSchema = Type16.Object(
|
|
16783
16664
|
{
|
|
16784
|
-
mode:
|
|
16785
|
-
mergedPullRequests:
|
|
16786
|
-
|
|
16665
|
+
mode: Type16.Literal("sweep"),
|
|
16666
|
+
mergedPullRequests: Type16.Array(
|
|
16667
|
+
Type16.Object(
|
|
16787
16668
|
{
|
|
16788
|
-
projectRoot:
|
|
16669
|
+
projectRoot: Type16.String(),
|
|
16789
16670
|
/** 排除后改动行数 — omit or 0 → typed 空缺; finite ≥ 0 only. */
|
|
16790
|
-
changedLines:
|
|
16791
|
-
|
|
16671
|
+
changedLines: Type16.Optional(
|
|
16672
|
+
Type16.Number({ minimum: 0, maximum: Number.MAX_VALUE })
|
|
16792
16673
|
)
|
|
16793
16674
|
}
|
|
16794
16675
|
)
|
|
@@ -16801,7 +16682,7 @@ var init_analyst_entry = __esm({
|
|
|
16801
16682
|
// src/public-cli/analyst-run.ts
|
|
16802
16683
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
16803
16684
|
import { isAbsolute as isAbsolute8, resolve as resolve13 } from "node:path";
|
|
16804
|
-
import { Value
|
|
16685
|
+
import { Value } from "typebox/value";
|
|
16805
16686
|
function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
|
|
16806
16687
|
try {
|
|
16807
16688
|
return resolveBookKeyFromGit(cwd);
|
|
@@ -16836,7 +16717,7 @@ async function buildAnalystIssueModeInputFromPublicArgv(parsed, _ledgerHome) {
|
|
|
16836
16717
|
};
|
|
16837
16718
|
}
|
|
16838
16719
|
function parseAnalystSweepModeInputFromJsonValue(value) {
|
|
16839
|
-
if (!
|
|
16720
|
+
if (!Value.Check(analystSweepModeInputSchema, value)) {
|
|
16840
16721
|
throw new CliUsageError(
|
|
16841
16722
|
"analyst sweep attachment must match AnalystSweepModeInput"
|
|
16842
16723
|
);
|
|
@@ -18620,10 +18501,9 @@ var init_role_run_relocation = __esm({
|
|
|
18620
18501
|
// pre-#1161 pages only
|
|
18621
18502
|
"sessionDirectory",
|
|
18622
18503
|
"sessionFile",
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
// #1165: requestManifestPath is a caller path — never rewrite.
|
|
18504
|
+
// #1165/#1168: caller file-flag paths (requestManifestPath, prerequisitesPath)
|
|
18505
|
+
// stay as given. Obsolete copy fields (taskPath/packetPath) are not rewritten —
|
|
18506
|
+
// stock volumes keep their bytes; live relocate no longer maintains them.
|
|
18627
18507
|
"mergerInputPath",
|
|
18628
18508
|
"sourceRunPath"
|
|
18629
18509
|
];
|
|
@@ -19156,10 +19036,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19156
19036
|
let instructionEmpty = true;
|
|
19157
19037
|
let attachments = [];
|
|
19158
19038
|
let phase;
|
|
19159
|
-
let taskPath;
|
|
19160
|
-
let packetPath;
|
|
19161
19039
|
let prerequisitesPath;
|
|
19162
|
-
let prerequisites;
|
|
19163
19040
|
let baseRevision;
|
|
19164
19041
|
let lens;
|
|
19165
19042
|
let authorityRefs;
|
|
@@ -19198,18 +19075,9 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19198
19075
|
if (record.phase === "plan" || record.phase === "apply") {
|
|
19199
19076
|
phase = record.phase;
|
|
19200
19077
|
}
|
|
19201
|
-
if (typeof record.
|
|
19202
|
-
taskPath = record.taskPath;
|
|
19203
|
-
}
|
|
19204
|
-
if (typeof record.packetPath === "string" && record.packetPath.trim() !== "") {
|
|
19205
|
-
packetPath = record.packetPath;
|
|
19206
|
-
}
|
|
19207
|
-
if (typeof record.prerequisitesPath === "string" && record.prerequisitesPath.trim() !== "") {
|
|
19078
|
+
if (typeof record.prerequisitesPath === "string") {
|
|
19208
19079
|
prerequisitesPath = record.prerequisitesPath;
|
|
19209
19080
|
}
|
|
19210
|
-
if (Array.isArray(record.prerequisites)) {
|
|
19211
|
-
prerequisites = record.prerequisites;
|
|
19212
|
-
}
|
|
19213
19081
|
if (typeof record.baseRevision === "string" && record.baseRevision.trim() !== "") {
|
|
19214
19082
|
baseRevision = record.baseRevision;
|
|
19215
19083
|
}
|
|
@@ -19346,10 +19214,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19346
19214
|
instructionEmpty,
|
|
19347
19215
|
attachments,
|
|
19348
19216
|
...phase === void 0 ? {} : { phase },
|
|
19349
|
-
...taskPath === void 0 ? {} : { taskPath },
|
|
19350
|
-
...packetPath === void 0 ? {} : { packetPath },
|
|
19351
19217
|
...prerequisitesPath === void 0 ? {} : { prerequisitesPath },
|
|
19352
|
-
...prerequisites === void 0 ? {} : { prerequisites },
|
|
19353
19218
|
...baseRevision === void 0 ? {} : { baseRevision },
|
|
19354
19219
|
...lens === void 0 ? {} : { lens },
|
|
19355
19220
|
...authorityRefs === void 0 ? {} : { authorityRefs },
|
|
@@ -19434,12 +19299,6 @@ function admitResumedRole(loaded) {
|
|
|
19434
19299
|
}
|
|
19435
19300
|
case "worker-task": {
|
|
19436
19301
|
const phase = resumedWorkerPhase(fields.phase ?? loaded.run.phase, record.phases, role, runId);
|
|
19437
|
-
const taskPath = fields.taskPath;
|
|
19438
|
-
if (taskPath === void 0) {
|
|
19439
|
-
throw new CliUsageError(
|
|
19440
|
-
`role run admitted coder task path is missing: ${runId}`
|
|
19441
|
-
);
|
|
19442
|
-
}
|
|
19443
19302
|
if (fields.instruction.trim() === "") {
|
|
19444
19303
|
throw new CliUsageError(
|
|
19445
19304
|
`role run admitted coder task is blank: ${runId}`
|
|
@@ -19449,33 +19308,23 @@ function admitResumedRole(loaded) {
|
|
|
19449
19308
|
role: "coder",
|
|
19450
19309
|
phase,
|
|
19451
19310
|
...base,
|
|
19452
|
-
instructionEmpty: false
|
|
19453
|
-
taskPath
|
|
19311
|
+
instructionEmpty: false
|
|
19454
19312
|
};
|
|
19455
19313
|
return admitted;
|
|
19456
19314
|
}
|
|
19457
19315
|
case "worker-packet": {
|
|
19458
19316
|
const phase = resumedWorkerPhase(fields.phase ?? loaded.run.phase, record.phases, role, runId);
|
|
19459
|
-
const packetPath = fields.packetPath;
|
|
19460
|
-
if (packetPath === void 0) {
|
|
19461
|
-
throw new CliUsageError(
|
|
19462
|
-
`role run admitted fixer packet path is missing: ${runId}`
|
|
19463
|
-
);
|
|
19464
|
-
}
|
|
19465
19317
|
if (fields.instruction.trim() === "") {
|
|
19466
19318
|
throw new CliUsageError(
|
|
19467
19319
|
`role run admitted fixer instruction is blank: ${runId}`
|
|
19468
19320
|
);
|
|
19469
19321
|
}
|
|
19470
|
-
const prerequisites = fields.prerequisites ?? Object.freeze([]);
|
|
19471
19322
|
const admitted = {
|
|
19472
19323
|
role: "fixer",
|
|
19473
19324
|
phase,
|
|
19474
19325
|
...base,
|
|
19475
19326
|
instructionEmpty: false,
|
|
19476
|
-
|
|
19477
|
-
...fields.prerequisitesPath === void 0 ? {} : { prerequisitesPath: fields.prerequisitesPath },
|
|
19478
|
-
prerequisites
|
|
19327
|
+
...fields.prerequisitesPath === void 0 ? {} : { prerequisitesPath: fields.prerequisitesPath }
|
|
19479
19328
|
};
|
|
19480
19329
|
return admitted;
|
|
19481
19330
|
}
|
|
@@ -20287,21 +20136,21 @@ init_filed_submission();
|
|
|
20287
20136
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
20288
20137
|
import { writeSync as writeSync2 } from "node:fs";
|
|
20289
20138
|
import { join as join34 } from "node:path";
|
|
20290
|
-
import { Value as
|
|
20139
|
+
import { Value as Value3 } from "typebox/value";
|
|
20291
20140
|
|
|
20292
20141
|
// src/activation-trace.ts
|
|
20293
|
-
import { Type as
|
|
20294
|
-
var causeSchema =
|
|
20295
|
-
identity:
|
|
20296
|
-
name:
|
|
20297
|
-
message:
|
|
20298
|
-
evidenceId:
|
|
20142
|
+
import { Type as Type17 } from "typebox";
|
|
20143
|
+
var causeSchema = Type17.Object({
|
|
20144
|
+
identity: Type17.String({ minLength: 1 }),
|
|
20145
|
+
name: Type17.String({ minLength: 1 }),
|
|
20146
|
+
message: Type17.String(),
|
|
20147
|
+
evidenceId: Type17.Optional(Type17.String({ minLength: 1 }))
|
|
20299
20148
|
}, { additionalProperties: false });
|
|
20300
|
-
var activationTraceRecordSchema =
|
|
20301
|
-
role:
|
|
20302
|
-
stageId:
|
|
20303
|
-
status:
|
|
20304
|
-
timestamp:
|
|
20149
|
+
var activationTraceRecordSchema = Type17.Object({
|
|
20150
|
+
role: Type17.String({ minLength: 1 }),
|
|
20151
|
+
stageId: Type17.String({ pattern: "^[a-z][a-z0-9-]*$" }),
|
|
20152
|
+
status: Type17.Literal("failed"),
|
|
20153
|
+
timestamp: Type17.String({ format: "date-time" }),
|
|
20305
20154
|
cause: causeSchema
|
|
20306
20155
|
}, { additionalProperties: false });
|
|
20307
20156
|
var activationCauseEvidence = 0;
|
|
@@ -20466,10 +20315,10 @@ init_engine_material();
|
|
|
20466
20315
|
init_engine_detour();
|
|
20467
20316
|
init_engine_detour_usage();
|
|
20468
20317
|
init_run_terminal_artifacts();
|
|
20469
|
-
import { Type as
|
|
20470
|
-
var engineDetourArgsSchema =
|
|
20318
|
+
import { Type as Type18 } from "typebox";
|
|
20319
|
+
var engineDetourArgsSchema = Type18.Object(
|
|
20471
20320
|
{
|
|
20472
|
-
argv:
|
|
20321
|
+
argv: Type18.Array(Type18.String({ minLength: 1 }), {
|
|
20473
20322
|
minItems: 1,
|
|
20474
20323
|
description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
|
|
20475
20324
|
})
|
|
@@ -20956,7 +20805,7 @@ init_packaged_role_registry();
|
|
|
20956
20805
|
init_activation_ledger_topology();
|
|
20957
20806
|
import { resolve as resolve17 } from "node:path";
|
|
20958
20807
|
import "@earendil-works/pi-coding-agent";
|
|
20959
|
-
import { Type as
|
|
20808
|
+
import { Type as Type20 } from "typebox";
|
|
20960
20809
|
|
|
20961
20810
|
// src/navigator-public-session.ts
|
|
20962
20811
|
init_host_session_record();
|
|
@@ -20965,8 +20814,8 @@ import { basename as basename13 } from "node:path";
|
|
|
20965
20814
|
|
|
20966
20815
|
// src/navigator-session-contracts.ts
|
|
20967
20816
|
init_unknown_value();
|
|
20968
|
-
import { Type as
|
|
20969
|
-
import { Value as
|
|
20817
|
+
import { Type as Type19 } from "typebox";
|
|
20818
|
+
import { Value as Value2 } from "typebox/value";
|
|
20970
20819
|
var NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
|
|
20971
20820
|
var NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
|
|
20972
20821
|
"context",
|
|
@@ -21070,26 +20919,26 @@ function navigatorProviderFailureFromPublicTerminal(outcome) {
|
|
|
21070
20919
|
if (typed !== void 0) return { source: typed, cause: typed };
|
|
21071
20920
|
return { source: "unknown", cause: "unknown" };
|
|
21072
20921
|
}
|
|
21073
|
-
var navigatorProviderFailureSchema =
|
|
21074
|
-
source:
|
|
21075
|
-
|
|
21076
|
-
|
|
21077
|
-
|
|
21078
|
-
|
|
21079
|
-
|
|
21080
|
-
|
|
21081
|
-
|
|
21082
|
-
|
|
20922
|
+
var navigatorProviderFailureSchema = Type19.Object({
|
|
20923
|
+
source: Type19.Union([
|
|
20924
|
+
Type19.Literal("context"),
|
|
20925
|
+
Type19.Literal("session"),
|
|
20926
|
+
Type19.Literal("model"),
|
|
20927
|
+
Type19.Literal("thinking"),
|
|
20928
|
+
Type19.Literal("auth"),
|
|
20929
|
+
Type19.Literal("quota"),
|
|
20930
|
+
Type19.Literal("transport"),
|
|
20931
|
+
Type19.Literal("unknown")
|
|
21083
20932
|
]),
|
|
21084
|
-
cause:
|
|
21085
|
-
|
|
21086
|
-
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
|
|
21092
|
-
|
|
20933
|
+
cause: Type19.Union([
|
|
20934
|
+
Type19.Literal("context"),
|
|
20935
|
+
Type19.Literal("session"),
|
|
20936
|
+
Type19.Literal("model"),
|
|
20937
|
+
Type19.Literal("thinking"),
|
|
20938
|
+
Type19.Literal("auth"),
|
|
20939
|
+
Type19.Literal("quota"),
|
|
20940
|
+
Type19.Literal("transport"),
|
|
20941
|
+
Type19.Literal("unknown")
|
|
21093
20942
|
])
|
|
21094
20943
|
}, { additionalProperties: false });
|
|
21095
20944
|
function parseNavigatorModelSetting(value) {
|
|
@@ -21467,8 +21316,8 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
|
21467
21316
|
return void 0;
|
|
21468
21317
|
}
|
|
21469
21318
|
var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
|
|
21470
|
-
var prepareSchema =
|
|
21471
|
-
prose:
|
|
21319
|
+
var prepareSchema = Type20.Object({
|
|
21320
|
+
prose: Type20.Optional(Type20.Unknown({
|
|
21472
21321
|
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002"
|
|
21473
21322
|
}))
|
|
21474
21323
|
}, { additionalProperties: true });
|
|
@@ -21940,7 +21789,6 @@ init_worker_output();
|
|
|
21940
21789
|
init_fixer_output();
|
|
21941
21790
|
init_filed_submission();
|
|
21942
21791
|
init_role_submission_declarations();
|
|
21943
|
-
init_fixer_packet();
|
|
21944
21792
|
|
|
21945
21793
|
// src/worker-submission-gates.ts
|
|
21946
21794
|
init_archivist_record_entry();
|
|
@@ -22230,20 +22078,6 @@ function fixerBashSeatbeltDenyReason(matched) {
|
|
|
22230
22078
|
init_unknown_value();
|
|
22231
22079
|
init_worker_output();
|
|
22232
22080
|
var FIXER_FLAG_DEFINITIONS = {
|
|
22233
|
-
packet: {
|
|
22234
|
-
name: "ak-fix-packet",
|
|
22235
|
-
definition: {
|
|
22236
|
-
description: "Path to opaque prose instructions for the Fixer",
|
|
22237
|
-
type: "string"
|
|
22238
|
-
}
|
|
22239
|
-
},
|
|
22240
|
-
prerequisites: {
|
|
22241
|
-
name: "ak-fixer-prerequisites",
|
|
22242
|
-
definition: {
|
|
22243
|
-
description: "Optional path to a JSON array of typed Fixer prerequisites",
|
|
22244
|
-
type: "string"
|
|
22245
|
-
}
|
|
22246
|
-
},
|
|
22247
22081
|
phase: {
|
|
22248
22082
|
name: "ak-fixer-phase",
|
|
22249
22083
|
definition: {
|
|
@@ -22302,22 +22136,11 @@ function assertAcceptableThroughHost(submissionGate, status, details, hostAction
|
|
|
22302
22136
|
}
|
|
22303
22137
|
function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
|
|
22304
22138
|
let soul;
|
|
22305
|
-
let packet;
|
|
22306
|
-
let packetPath;
|
|
22307
|
-
let prerequisitesPath;
|
|
22308
22139
|
let phase;
|
|
22309
22140
|
let lifecycleRegistered = false;
|
|
22310
22141
|
const submissionGate = createWorkerSubmissionGate({
|
|
22311
22142
|
unfinishedReasonBounceLimit: options?.unfinishedReasonBounceLimit ?? deliveryLimitFromEnv(process.env)
|
|
22312
22143
|
});
|
|
22313
|
-
pi.registerFlag(
|
|
22314
|
-
FIXER_FLAG_DEFINITIONS.packet.name,
|
|
22315
|
-
FIXER_FLAG_DEFINITIONS.packet.definition
|
|
22316
|
-
);
|
|
22317
|
-
pi.registerFlag(
|
|
22318
|
-
FIXER_FLAG_DEFINITIONS.prerequisites.name,
|
|
22319
|
-
FIXER_FLAG_DEFINITIONS.prerequisites.definition
|
|
22320
|
-
);
|
|
22321
22144
|
pi.registerFlag(
|
|
22322
22145
|
FIXER_FLAG_DEFINITIONS.phase.name,
|
|
22323
22146
|
FIXER_FLAG_DEFINITIONS.phase.definition
|
|
@@ -22333,29 +22156,11 @@ function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
|
|
|
22333
22156
|
);
|
|
22334
22157
|
}
|
|
22335
22158
|
phase = selectedPhase;
|
|
22336
|
-
const resolvedPacketPath = pi.getFlag(FIXER_FLAG_DEFINITIONS.packet.name);
|
|
22337
|
-
if (typeof resolvedPacketPath !== "string" || resolvedPacketPath.trim().length === 0) {
|
|
22338
|
-
throw new Error("Fixer role requires --ak-fix-packet");
|
|
22339
|
-
}
|
|
22340
|
-
packetPath = resolvedPacketPath;
|
|
22341
|
-
const instructions = await dependencies.loadPacket(packetPath);
|
|
22342
|
-
if (instructions.trim().length === 0) {
|
|
22343
|
-
throw new FixerPacketValidationError(
|
|
22344
|
-
new Error("Fixer instructions must be nonblank")
|
|
22345
|
-
);
|
|
22346
|
-
}
|
|
22347
|
-
const resolvedPrerequisitesPath = pi.getFlag(FIXER_FLAG_DEFINITIONS.prerequisites.name);
|
|
22348
|
-
if (resolvedPrerequisitesPath !== void 0 && (typeof resolvedPrerequisitesPath !== "string" || resolvedPrerequisitesPath.trim().length === 0)) {
|
|
22349
|
-
throw new Error("Fixer --ak-fixer-prerequisites path must be nonblank when supplied");
|
|
22350
|
-
}
|
|
22351
|
-
prerequisitesPath = typeof resolvedPrerequisitesPath === "string" ? resolvedPrerequisitesPath : void 0;
|
|
22352
|
-
const prerequisites = prerequisitesPath !== void 0 ? parseFixerPrerequisites(await dependencies.loadPacket(prerequisitesPath)) : Object.freeze([]);
|
|
22353
|
-
packet = Object.freeze({ instructions, prerequisites });
|
|
22354
22159
|
if (!lifecycleRegistered) {
|
|
22355
22160
|
lifecycleRegistered = true;
|
|
22356
22161
|
registerWorkerSubmission(pi, "fixer", {
|
|
22357
|
-
notReady: "\u4FEE\u5185\u53F8\
|
|
22358
|
-
ready: () =>
|
|
22162
|
+
notReady: "\u4FEE\u5185\u53F8\u9636\u6BB5\u672A\u88C5\u8F7D",
|
|
22163
|
+
ready: () => phase !== void 0,
|
|
22359
22164
|
phase: () => phase,
|
|
22360
22165
|
project: (parameters, current) => deepFreeze2(validateFixerOutput(parameters, current)),
|
|
22361
22166
|
submissionGate,
|
|
@@ -22374,12 +22179,6 @@ function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
|
|
|
22374
22179
|
});
|
|
22375
22180
|
pi.on("before_agent_start", (event) => {
|
|
22376
22181
|
if (soul === void 0) throw new Error("\u4FEE\u5185\u53F8\u804C\u5206\u672A\u88C5\u8F7D");
|
|
22377
|
-
if (packetPath === void 0) throw new Error("\u4FEE\u5185\u53F8\u4FEE\u7406\u5305\u8DEF\u5F84\u672A\u88C5\u8F7D");
|
|
22378
|
-
const prerequisitesBlock = prerequisitesPath === void 0 ? "" : `
|
|
22379
|
-
|
|
22380
|
-
<fixer_prerequisites_path>
|
|
22381
|
-
${prerequisitesPath}
|
|
22382
|
-
</fixer_prerequisites_path>`;
|
|
22383
22182
|
return {
|
|
22384
22183
|
systemPrompt: `${event.systemPrompt}
|
|
22385
22184
|
|
|
@@ -22389,11 +22188,7 @@ ${soul}
|
|
|
22389
22188
|
|
|
22390
22189
|
<fixer_phase>
|
|
22391
22190
|
${phase ?? ""}
|
|
22392
|
-
</fixer_phase
|
|
22393
|
-
|
|
22394
|
-
<fix_packet_path>
|
|
22395
|
-
${packetPath}
|
|
22396
|
-
</fix_packet_path>${prerequisitesBlock}`
|
|
22191
|
+
</fixer_phase>`
|
|
22397
22192
|
};
|
|
22398
22193
|
});
|
|
22399
22194
|
}
|
|
@@ -22405,22 +22200,17 @@ ${packetPath}
|
|
|
22405
22200
|
}
|
|
22406
22201
|
function createCoderRoleRuntime(pi, dependencies, hostActions, options) {
|
|
22407
22202
|
let soul;
|
|
22408
|
-
let task;
|
|
22409
22203
|
let phase;
|
|
22410
22204
|
let lifecycleRegistered = false;
|
|
22411
22205
|
const submissionGate = createWorkerSubmissionGate({
|
|
22412
22206
|
unfinishedReasonBounceLimit: options?.unfinishedReasonBounceLimit ?? deliveryLimitFromEnv(process.env)
|
|
22413
22207
|
});
|
|
22414
|
-
pi.registerFlag("ak-coder-task", {
|
|
22415
|
-
description: "Markdown task assigned to the coder role",
|
|
22416
|
-
type: "string"
|
|
22417
|
-
});
|
|
22418
22208
|
pi.registerFlag("ak-coder-phase", {
|
|
22419
22209
|
description: "Coder phase: plan (inspect and propose an implementation plan; no edits or commits) or apply (execute the approved plan and verify the first implementation)",
|
|
22420
22210
|
type: "string"
|
|
22421
22211
|
});
|
|
22422
22212
|
return {
|
|
22423
|
-
async activate(
|
|
22213
|
+
async activate() {
|
|
22424
22214
|
soul = (await dependencies.loadSoul()).trim();
|
|
22425
22215
|
if (soul.length === 0) throw new Error("Coder soul is empty");
|
|
22426
22216
|
const selectedPhase = pi.getFlag("ak-coder-phase");
|
|
@@ -22430,23 +22220,17 @@ function createCoderRoleRuntime(pi, dependencies, hostActions, options) {
|
|
|
22430
22220
|
);
|
|
22431
22221
|
}
|
|
22432
22222
|
phase = selectedPhase;
|
|
22433
|
-
const taskPath = pi.getFlag("ak-coder-task");
|
|
22434
|
-
if (typeof taskPath !== "string" || taskPath.trim().length === 0) {
|
|
22435
|
-
throw new Error("Coder role requires --ak-coder-task");
|
|
22436
|
-
}
|
|
22437
|
-
task = (await dependencies.loadTask(taskPath)).trim();
|
|
22438
|
-
if (task.length === 0) throw new Error("Coder task is empty");
|
|
22439
22223
|
if (!lifecycleRegistered) {
|
|
22440
22224
|
lifecycleRegistered = true;
|
|
22441
22225
|
registerWorkerSubmission(pi, "coder", {
|
|
22442
|
-
notReady: "\u5C06\u4F5C\u76D1\
|
|
22443
|
-
ready: () =>
|
|
22226
|
+
notReady: "\u5C06\u4F5C\u76D1\u9636\u6BB5\u672A\u88C5\u8F7D",
|
|
22227
|
+
ready: () => phase !== void 0,
|
|
22444
22228
|
phase: () => phase,
|
|
22445
22229
|
project: (parameters, current) => validateWorkerOutput(parameters, current, "Coder"),
|
|
22446
22230
|
submissionGate,
|
|
22447
22231
|
hostActions
|
|
22448
22232
|
});
|
|
22449
|
-
pi.on("before_agent_start", (event
|
|
22233
|
+
pi.on("before_agent_start", (event) => {
|
|
22450
22234
|
if (soul === void 0) throw new Error("\u5C06\u4F5C\u76D1\u804C\u5206\u672A\u88C5\u8F7D");
|
|
22451
22235
|
return {
|
|
22452
22236
|
systemPrompt: `${event.systemPrompt}
|
|
@@ -22457,11 +22241,7 @@ ${soul}
|
|
|
22457
22241
|
|
|
22458
22242
|
<coder_phase>
|
|
22459
22243
|
${phase ?? ""}
|
|
22460
|
-
</coder_phase
|
|
22461
|
-
|
|
22462
|
-
<coder_task>
|
|
22463
|
-
${task ?? ""}
|
|
22464
|
-
</coder_task>`
|
|
22244
|
+
</coder_phase>`
|
|
22465
22245
|
};
|
|
22466
22246
|
});
|
|
22467
22247
|
}
|
|
@@ -22506,7 +22286,16 @@ function createMergerRoleRuntime(pi, dependencies) {
|
|
|
22506
22286
|
});
|
|
22507
22287
|
pi.on("before_agent_start", (event) => {
|
|
22508
22288
|
if (!activation) throw new Error("\u6821\u4E66\u90CE\u672A\u6FC0\u6D3B");
|
|
22509
|
-
const admitted = {
|
|
22289
|
+
const admitted = {
|
|
22290
|
+
attemptId: activation.input.attemptId,
|
|
22291
|
+
targetObjectId: activation.input.targetObjectId,
|
|
22292
|
+
sourceObjectId: activation.input.sourceObjectId,
|
|
22293
|
+
targetIntent: materialText(activation.input, "targetIntent"),
|
|
22294
|
+
sourceIntent: materialText(activation.input, "sourceIntent"),
|
|
22295
|
+
expectedConflictPaths: activation.input.expectedConflictPaths,
|
|
22296
|
+
resolutionScope: activation.input.resolutionScope,
|
|
22297
|
+
authorizedChecks: activation.input.authorizedChecks
|
|
22298
|
+
};
|
|
22510
22299
|
return { systemPrompt: `${event.systemPrompt}
|
|
22511
22300
|
|
|
22512
22301
|
<merger_soul>
|
|
@@ -22537,7 +22326,6 @@ init_doctor_evidence();
|
|
|
22537
22326
|
init_judge_role();
|
|
22538
22327
|
init_engine_detour();
|
|
22539
22328
|
init_fixer_output();
|
|
22540
|
-
init_fixer_packet();
|
|
22541
22329
|
init_auditor_soul();
|
|
22542
22330
|
init_judge_auditor();
|
|
22543
22331
|
init_doctor_auditor();
|
|
@@ -22649,7 +22437,7 @@ function activationStage(role, activate) {
|
|
|
22649
22437
|
};
|
|
22650
22438
|
}
|
|
22651
22439
|
function validateActivationTraceRecord(record) {
|
|
22652
|
-
if (!
|
|
22440
|
+
if (!Value3.Check(activationTraceRecordSchema, record)) {
|
|
22653
22441
|
throw new TypeError("Activation trace record does not match its closed contract");
|
|
22654
22442
|
}
|
|
22655
22443
|
return record;
|
|
@@ -23432,13 +23220,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
|
|
|
23432
23220
|
const fixer = createFixerRoleRuntime(
|
|
23433
23221
|
roleHost,
|
|
23434
23222
|
{
|
|
23435
|
-
loadSoul: () => requireRoleSoul("fixer")
|
|
23436
|
-
async loadPacket(path) {
|
|
23437
|
-
if (dependencies.loadFixPacket === void 0) {
|
|
23438
|
-
throw new Error("Fixer packet loader is not configured");
|
|
23439
|
-
}
|
|
23440
|
-
return dependencies.loadFixPacket(path);
|
|
23441
|
-
}
|
|
23223
|
+
loadSoul: () => requireRoleSoul("fixer")
|
|
23442
23224
|
},
|
|
23443
23225
|
hostActions,
|
|
23444
23226
|
{ unfinishedReasonBounceLimit: deliveryLimit }
|
|
@@ -23446,13 +23228,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
|
|
|
23446
23228
|
const coder = createCoderRoleRuntime(
|
|
23447
23229
|
roleHost,
|
|
23448
23230
|
{
|
|
23449
|
-
loadSoul: () => requireRoleSoul("coder")
|
|
23450
|
-
async loadTask(path) {
|
|
23451
|
-
if (dependencies.loadCoderTask === void 0) {
|
|
23452
|
-
throw new Error("Coder task loader is not configured");
|
|
23453
|
-
}
|
|
23454
|
-
return dependencies.loadCoderTask(path);
|
|
23455
|
-
}
|
|
23231
|
+
loadSoul: () => requireRoleSoul("coder")
|
|
23456
23232
|
},
|
|
23457
23233
|
hostActions,
|
|
23458
23234
|
{ unfinishedReasonBounceLimit: deliveryLimit }
|
|
@@ -24440,8 +24216,6 @@ function createRoleRuntimeDependencies(packageRoot) {
|
|
|
24440
24216
|
packageRoot,
|
|
24441
24217
|
loadRoleReferenceMaterials: loadPackagedRoleReferenceMaterials,
|
|
24442
24218
|
loadRoleSoul: loadRegisteredRoleSoul,
|
|
24443
|
-
loadFixPacket: (path) => readFile17(path, "utf8"),
|
|
24444
|
-
loadCoderTask: (path) => readFile17(path, "utf8"),
|
|
24445
24219
|
loadDoctorCase,
|
|
24446
24220
|
loadNotarySourceRun: loadNotarySourceRunLocator,
|
|
24447
24221
|
loadMergerInput: async (path) => JSON.parse(await readFile17(path, "utf8")),
|