pi-herdsman 0.40.0 → 0.41.0
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/CHANGELOG.md +44 -0
- package/README.md +18 -1
- package/SKILL.md +8 -6
- package/dist/coordinators/manager.md +5 -6
- package/dist/index.js +1643 -1300
- package/dist/index.js.map +4 -4
- package/dist/peer-bridge.js +23 -13
- package/dist/peer-bridge.js.map +3 -3
- package/docs/README.md +2 -2
- package/docs/concepts/agents.md +1 -1
- package/docs/concepts/lifecycle.md +6 -4
- package/docs/coordination-api.md +3 -2
- package/docs/development/validation.md +12 -8
- package/docs/getting-started.md +9 -2
- package/docs/guides/container-deployment.md +126 -38
- package/docs/guides/project-orchestration.md +10 -0
- package/docs/guides/recovery.md +12 -11
- package/docs/reference/agent-definition-schema.md +1 -1
- package/docs/reference/agent-states.md +10 -10
- package/docs/reference/agent.md +26 -25
- package/docs/reference/commands.md +1 -1
- package/docs/reference/staff.md +9 -2
- package/package.json +3 -2
package/dist/peer-bridge.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
openSync as openSync4,
|
|
11
11
|
readFileSync as readFileSync6,
|
|
12
12
|
renameSync as renameSync5,
|
|
13
|
-
rmSync
|
|
13
|
+
rmSync,
|
|
14
14
|
writeSync as writeSync2,
|
|
15
15
|
writeFileSync as writeFileSync4
|
|
16
16
|
} from "node:fs";
|
|
@@ -483,7 +483,7 @@ function nodeOnlyAgentDir() {
|
|
|
483
483
|
if (directory2 === "~") return homedir();
|
|
484
484
|
if (directory2.startsWith("~/") || process.platform === "win32" && directory2.startsWith("~\\"))
|
|
485
485
|
return join2(homedir(), directory2.slice(2));
|
|
486
|
-
if (
|
|
486
|
+
if (directory2.startsWith("file://")) return fileURLToPath(directory2);
|
|
487
487
|
return directory2;
|
|
488
488
|
}
|
|
489
489
|
function validateResultId(requestId) {
|
|
@@ -839,7 +839,7 @@ function withChiefMessageLock(path, operation) {
|
|
|
839
839
|
function writeChiefMessage(record, runtime2 = supervisionRuntime(), clearQuarantine = true) {
|
|
840
840
|
if (!record.build)
|
|
841
841
|
throw new Error("Coordination message build identity is required");
|
|
842
|
-
if (!validMessage(record) || record
|
|
842
|
+
if (!validMessage(record) || Reflect.get(record, "bodyRef") !== void 0)
|
|
843
843
|
throw new Error("Invalid Chief message record");
|
|
844
844
|
return withChiefMessageLock(
|
|
845
845
|
chiefMessagePath(runtime2, record.toSessionId, record.id),
|
|
@@ -1162,7 +1162,9 @@ function validProjectAssignment(value) {
|
|
|
1162
1162
|
];
|
|
1163
1163
|
return required.every((key) => Object.hasOwn(r, key)) && Object.keys(r).every(
|
|
1164
1164
|
(key) => required.includes(key) || optional.includes(key)
|
|
1165
|
-
) && Object.keys(r).length >= required.length && r.version === 2 && UUID2.test(String(r.id)) && validNativeIdentity(r.repoKey) && validNativeIdentity(r.branch) && typeof r.text === "string" && r.text.length > 0 && (r.gitBaselineSha === void 0 || typeof r.gitBaselineSha === "string" && /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u.test(r.gitBaselineSha)) && (r.checkoutPath === void 0 || typeof r.checkoutPath === "string" && isAbsolute(r.checkoutPath) && normalize(r.checkoutPath) === r.checkoutPath &&
|
|
1165
|
+
) && Object.keys(r).length >= required.length && r.version === 2 && UUID2.test(String(r.id)) && validNativeIdentity(r.repoKey) && validNativeIdentity(r.branch) && typeof r.text === "string" && r.text.length > 0 && (r.gitBaselineSha === void 0 || typeof r.gitBaselineSha === "string" && /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/u.test(r.gitBaselineSha)) && (r.checkoutPath === void 0 || typeof r.checkoutPath === "string" && isAbsolute(r.checkoutPath) && normalize(r.checkoutPath) === r.checkoutPath && ![...r.checkoutPath].some(
|
|
1166
|
+
(character) => character.charCodeAt(0) <= 31
|
|
1167
|
+
)) && (r.piSessionFile === void 0 || typeof r.piSessionFile === "string" && r.piSessionFile.length > 0) && (r.resultBindings === void 0 || Array.isArray(r.resultBindings) && r.resultBindings.every(isResultBinding)) && (r.requiredEvidence === void 0 || Array.isArray(r.requiredEvidence) && r.requiredEvidence.every(isRequiredEvidence) && r.requiredEvidence.every(
|
|
1166
1168
|
(evidence) => "result" in evidence || evidence.sourceAssignmentId === r.id
|
|
1167
1169
|
) && new Set(r.requiredEvidence.map((evidence) => evidence.id)).size === r.requiredEvidence.length) && (r.currentEvidenceIds === void 0 || Array.isArray(r.currentEvidenceIds) && new Set(r.currentEvidenceIds).size === r.currentEvidenceIds.length && r.currentEvidenceIds.every(
|
|
1168
1170
|
(id) => typeof id === "string" && r.requiredEvidence?.some(
|
|
@@ -1350,9 +1352,14 @@ function peerPayloadDigest(value) {
|
|
|
1350
1352
|
|
|
1351
1353
|
// extension/peer-correspondence.ts
|
|
1352
1354
|
function validPeerDisplayText(value) {
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
)
|
|
1355
|
+
if (typeof value !== "string" || value.trim().length === 0 || value.length > 512)
|
|
1356
|
+
return false;
|
|
1357
|
+
for (const character of value) {
|
|
1358
|
+
const code = character.codePointAt(0);
|
|
1359
|
+
if (code >= 0 && code <= 31 || code >= 127 && code <= 159 || code === 1564 || code === 8206 || code === 8207 || code >= 8232 && code <= 8238 || code >= 8294 && code <= 8297)
|
|
1360
|
+
return false;
|
|
1361
|
+
}
|
|
1362
|
+
return true;
|
|
1356
1363
|
}
|
|
1357
1364
|
function validOriginDisplay(value) {
|
|
1358
1365
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
@@ -1953,10 +1960,13 @@ if (action === "probe") {
|
|
|
1953
1960
|
}
|
|
1954
1961
|
} finally {
|
|
1955
1962
|
if (fd !== void 0) closeSync4(fd);
|
|
1956
|
-
|
|
1963
|
+
rmSync(temp, { force: true });
|
|
1957
1964
|
}
|
|
1958
1965
|
if (!acceptedRace) afterDurablePeerAcceptanceStep("pending-marker-durable");
|
|
1959
1966
|
}
|
|
1967
|
+
if (!Array.isArray(envelope.attachments) || envelope.attachments.length > 32)
|
|
1968
|
+
throw new Error("invalid peer transfer evidence");
|
|
1969
|
+
const attachments = envelope.attachments;
|
|
1960
1970
|
acceptTransfer: {
|
|
1961
1971
|
if (acceptedRace) {
|
|
1962
1972
|
console.log(JSON.stringify({ accepted: true, id: record.id }));
|
|
@@ -1966,7 +1976,7 @@ if (action === "probe") {
|
|
|
1966
1976
|
throw new Error("peer correspondence does not match message route");
|
|
1967
1977
|
const receivedRefs = [];
|
|
1968
1978
|
let receivedText = record.text;
|
|
1969
|
-
for (const attachment of
|
|
1979
|
+
for (const attachment of attachments) {
|
|
1970
1980
|
if (typeof attachment.name !== "string" || typeof attachment.marker !== "string" || typeof attachment.text !== "string" || typeof attachment.sha256 !== "string" || !/^[0-9a-f]{64}$/u.test(attachment.sha256))
|
|
1971
1981
|
throw new Error("invalid peer attachment metadata");
|
|
1972
1982
|
const contentDigest = createHash7("sha256").update(attachment.text, "utf8").digest("hex");
|
|
@@ -2044,11 +2054,11 @@ ${receivedRefs.join("\n")}`
|
|
|
2044
2054
|
);
|
|
2045
2055
|
renameSync5(pendingTemp, marker);
|
|
2046
2056
|
} finally {
|
|
2047
|
-
|
|
2057
|
+
rmSync(pendingTemp, { force: true });
|
|
2048
2058
|
}
|
|
2049
2059
|
syncDirectory(markerDir);
|
|
2050
2060
|
}
|
|
2051
|
-
for (const attachment of
|
|
2061
|
+
for (const attachment of attachments) {
|
|
2052
2062
|
const binding = record.resultBindings?.find(
|
|
2053
2063
|
(item) => item.ref === attachment.ref
|
|
2054
2064
|
);
|
|
@@ -2064,7 +2074,7 @@ ${receivedRefs.join("\n")}`
|
|
|
2064
2074
|
);
|
|
2065
2075
|
}
|
|
2066
2076
|
} else {
|
|
2067
|
-
for (const attachment of
|
|
2077
|
+
for (const attachment of attachments) {
|
|
2068
2078
|
const binding = record.resultBindings?.find(
|
|
2069
2079
|
(item) => item.ref === attachment.ref
|
|
2070
2080
|
);
|
|
@@ -2146,7 +2156,7 @@ ${receivedRefs.join("\n")}`
|
|
|
2146
2156
|
afterAcceptedMarkerTempWriteForTests(markerTemp, marker);
|
|
2147
2157
|
renameSync5(markerTemp, marker);
|
|
2148
2158
|
} finally {
|
|
2149
|
-
|
|
2159
|
+
rmSync(markerTemp, { force: true });
|
|
2150
2160
|
}
|
|
2151
2161
|
syncDirectory(markerDir);
|
|
2152
2162
|
console.log(
|