@akagilnc/pi-workflow-roles 0.1.5241 → 0.1.5252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/README.zh-CN.md +2 -3
- package/dist/acp-host/production-host.js +482 -3141
- package/dist/collector-config.js +0 -1
- package/dist/headless-host/production-host.js +590 -3249
- package/dist/migrate-book-topology.js +40 -107
- package/dist/navigator-invocation-identity.js +0 -57
- package/dist/package-contracts/collector-output.js +1 -90
- package/dist/package-contracts/terminating-tools.js +2 -2
- package/dist/packaged-role-registry.js +8 -11
- package/dist/public-cli/invocation.js +2 -22
- package/dist/public-cli/main.js +256 -749
- package/dist/public-cli/option-definitions.js +4 -19
- package/dist/public-cli/settlement.js +12 -138
- package/package.json +1 -1
- package/resources/collector-bot-handbook.md +4 -2
- package/src/collector-config.ts +0 -1
- package/src/collector-role.ts +40 -535
- package/src/collector-tool-schemas.ts +7 -117
- package/src/gh-api-runner.ts +102 -0
- package/src/navigator-invocation-identity.ts +4 -121
- package/src/package-contracts/collector-output.ts +15 -174
- package/src/package-contracts/terminating-tools.ts +0 -2
- package/src/packaged-role-registry.ts +7 -10
- package/src/public-cli/invocation.ts +3 -27
- package/src/public-cli/option-definitions.ts +4 -19
- package/src/public-cli/settlement.ts +11 -177
- package/src/role-runtime-dependencies.ts +0 -4
- package/src/role-runtime.ts +39 -103
- package/src/ticket-snapshot.ts +1 -1
- package/dist/collector-evidence.js +0 -319
- package/dist/collector-github.js +0 -725
- package/dist/collector-identity.js +0 -92
- package/dist/collector-ledger.js +0 -888
- package/dist/collector-target.js +0 -169
- package/src/collector-evidence.ts +0 -466
- package/src/collector-github.ts +0 -1032
- package/src/collector-handbook.ts +0 -194
- package/src/collector-identity.ts +0 -151
- package/src/collector-ledger.ts +0 -1186
- package/src/collector-target.ts +0 -207
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { CorrectableSubmissionError } from "./submission-correctable-error.js";
|
|
2
|
-
function identityKey(identity) {
|
|
3
|
-
if (identity === null)
|
|
4
|
-
return "unassigned";
|
|
5
|
-
// GitHub omits App metadata on some surfaces (notably review comments).
|
|
6
|
-
// The stable user ID is the grouping identity; richer observed structure is
|
|
7
|
-
// merged below and must not split one actor across transport surfaces.
|
|
8
|
-
return String(identity.userId);
|
|
9
|
-
}
|
|
10
|
-
function mergeMachineIdentity(current, observed) {
|
|
11
|
-
if (current === null)
|
|
12
|
-
return observed;
|
|
13
|
-
if (observed === null)
|
|
14
|
-
return current;
|
|
15
|
-
if (current.appId === undefined && observed.appId !== undefined)
|
|
16
|
-
return observed;
|
|
17
|
-
if (current.appId !== undefined && observed.appId === undefined)
|
|
18
|
-
return current;
|
|
19
|
-
return observed.userType < current.userType ? observed : current;
|
|
20
|
-
}
|
|
21
|
-
function headRelationFor(record, targetHead) {
|
|
22
|
-
return record.commitOid === undefined || record.commitOid === null
|
|
23
|
-
? "unbound"
|
|
24
|
-
: record.commitOid === targetHead ? "current" : "prior";
|
|
25
|
-
}
|
|
26
|
-
/** Receipt adapter consuming the typed facts retained by transport normalization. */
|
|
27
|
-
export function extractCollectorEvidenceIdentityGroups(records, targetHead) {
|
|
28
|
-
const groups = new Map();
|
|
29
|
-
for (const record of records) {
|
|
30
|
-
if (record.kind !== "review" && record.kind !== "issue_comment" && record.kind !== "review_comment" && record.kind !== "reaction")
|
|
31
|
-
continue;
|
|
32
|
-
if (record.githubId === undefined)
|
|
33
|
-
continue;
|
|
34
|
-
const identity = record.machineIdentity ?? null;
|
|
35
|
-
const kind = record.kind;
|
|
36
|
-
const source = {
|
|
37
|
-
kind,
|
|
38
|
-
id: record.githubId,
|
|
39
|
-
evidenceId: record.evidenceId,
|
|
40
|
-
headRelation: headRelationFor(record, targetHead),
|
|
41
|
-
};
|
|
42
|
-
const key = identityKey(identity);
|
|
43
|
-
let group = groups.get(key);
|
|
44
|
-
if (group === undefined) {
|
|
45
|
-
group = {
|
|
46
|
-
identity,
|
|
47
|
-
...(record.authorLogin === undefined ? {} : { displayLogin: record.authorLogin }),
|
|
48
|
-
attendance: true,
|
|
49
|
-
findings: [],
|
|
50
|
-
materials: [],
|
|
51
|
-
};
|
|
52
|
-
groups.set(key, group);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
group.identity = mergeMachineIdentity(group.identity, identity);
|
|
56
|
-
}
|
|
57
|
-
group.materials.push(source);
|
|
58
|
-
}
|
|
59
|
-
return [...groups.values()];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* #641 chain①: pointer-open failures are model misuse, not host failures. The
|
|
63
|
-
* seat rejects them as correctable so the model can retry with a stored
|
|
64
|
-
* evidenceId — on Pi and Grok/ACP alike (第 0 条: 模型提交方式可纠正).
|
|
65
|
-
*/
|
|
66
|
-
export class CollectorUnknownEvidenceError extends CorrectableSubmissionError {
|
|
67
|
-
constructor(evidenceId) {
|
|
68
|
-
super(`未在本局已观测材料中找到 evidenceId ${evidenceId};请用 observe 返回的指针重试。`);
|
|
69
|
-
this.name = "CollectorUnknownEvidenceError";
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* #676 D6: non-OPEN targets keep collected materials and must not fire new review
|
|
74
|
-
* requests. Bounce the request as correctable so the seat can still seal output.
|
|
75
|
-
*/
|
|
76
|
-
export class CollectorNonOpenRequestError extends CorrectableSubmissionError {
|
|
77
|
-
constructor(prState) {
|
|
78
|
-
super(`通进司请求要求 OPEN 状态的 PR 快照;当前为 ${prState},不再触发新评审,请直接交回已有材料`);
|
|
79
|
-
this.name = "CollectorNonOpenRequestError";
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/** #678: wait window not open or already ended — bounce without latching fatal so materials still seal. */
|
|
83
|
-
export class CollectorWaitWindowClosedError extends CorrectableSubmissionError {
|
|
84
|
-
constructor(action) {
|
|
85
|
-
super(action === "request"
|
|
86
|
-
? "通进司请求不在资格截止前"
|
|
87
|
-
: action === "wait-before-open"
|
|
88
|
-
? "通进司等待需要先在工作步骤开启等待窗(新建 PR 用创建成功时刻;已有 PR 在触发阶段结束后开启)"
|
|
89
|
-
: "通进司等待不在资格截止前");
|
|
90
|
-
this.name = "CollectorWaitWindowClosedError";
|
|
91
|
-
}
|
|
92
|
-
}
|