@akagilnc/pi-workflow-roles 0.1.1751
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/LICENSE +202 -0
- package/README.md +104 -0
- package/README.zh-CN.md +133 -0
- package/THIRD_PARTY_NOTICES.md +60 -0
- package/dist/activation-ledger-git.js +68 -0
- package/dist/activation-ledger-session.js +120 -0
- package/dist/activation-ledger-topology.js +239 -0
- package/dist/activation-reconciliation.js +61 -0
- package/dist/audit-escalation.js +108 -0
- package/dist/auditor-dossier-tool.js +35 -0
- package/dist/canonical-json.js +78 -0
- package/dist/compliance-transport.js +77 -0
- package/dist/doctor-contracts.js +172 -0
- package/dist/dossier-resolution.js +103 -0
- package/dist/evidence-child-executor.js +661 -0
- package/dist/exact-utf8.js +12 -0
- package/dist/git-object-id.js +7 -0
- package/dist/in-process-session.js +50 -0
- package/dist/merger-contracts.js +76 -0
- package/dist/navigator-attendance.js +995 -0
- package/dist/navigator-invocation-identity.js +220 -0
- package/dist/open-tool-schema.js +39 -0
- package/dist/package-contracts/collector-output.js +50 -0
- package/dist/package-contracts/fixer-output.js +72 -0
- package/dist/package-contracts/fixer-packet.js +77 -0
- package/dist/package-contracts/judge-output.js +17 -0
- package/dist/package-contracts/reviewer-output.js +82 -0
- package/dist/package-contracts/terminating-tools.js +173 -0
- package/dist/package-contracts/worker-output.js +13 -0
- package/dist/package-owned-tool-idle.js +104 -0
- package/dist/packaged-role-registry.js +34 -0
- package/dist/public-cli/main.js +23867 -0
- package/dist/public-command-renderer.js +20 -0
- package/dist/reviewer-agent.js +93 -0
- package/dist/reviewer-child-executor.js +23 -0
- package/dist/reviewer-construction.js +95 -0
- package/dist/reviewer-dispatch.js +77 -0
- package/dist/reviewer-execution-ledger.js +160 -0
- package/dist/reviewer-failure-diagnostic.js +17 -0
- package/dist/reviewer-git-snapshot.js +38 -0
- package/dist/reviewer-pinned-git.js +146 -0
- package/dist/reviewer-preflight-error.js +15 -0
- package/dist/reviewer-prompt-identity.js +10 -0
- package/dist/reviewer-scope-prompt.js +21 -0
- package/dist/reviewer-workspace.js +151 -0
- package/dist/sha256.js +5 -0
- package/dist/sitian-record-entry.js +33 -0
- package/dist/stderr-jsonl.js +26 -0
- package/dist/stream-idle-guard.js +75 -0
- package/dist/tool-execution-observation.js +141 -0
- package/dist/uuidv7.js +21 -0
- package/dist/work-subject-identity.js +53 -0
- package/extensions/role-runtime.ts +303 -0
- package/package.json +69 -0
- package/packets/fixer-prerequisites.json +6 -0
- package/packets/fixer-repair.md +5 -0
- package/packets/judge-apply.md +77 -0
- package/packets/judge-authority.md +64 -0
- package/packets/judge-plan.md +55 -0
- package/packets/judge-review.md +49 -0
- package/packets/judge-submission.md +34 -0
- package/resources/methods/code-review/SKILL.md +92 -0
- package/resources/methods/code-review/agents/openai.yaml +3 -0
- package/resources/methods/code-review/provenance.json +26 -0
- package/resources/methods/diagnosing-bugs/SKILL.md +134 -0
- package/resources/methods/diagnosing-bugs/agents/openai.yaml +3 -0
- package/resources/methods/diagnosing-bugs/provenance.json +31 -0
- package/resources/methods/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/resources/methods/resolving-merge-conflicts/SKILL.md +14 -0
- package/resources/methods/resolving-merge-conflicts/agents/openai.yaml +3 -0
- package/resources/methods/resolving-merge-conflicts/provenance.json +26 -0
- package/resources/methods/tdd/SKILL.md +38 -0
- package/resources/methods/tdd/agents/openai.yaml +3 -0
- package/resources/methods/tdd/mocking.md +59 -0
- package/resources/methods/tdd/provenance.json +36 -0
- package/resources/methods/tdd/tests.md +77 -0
- package/resources/navigator-route-playbook.md +32 -0
- package/schemas/tool-execution-observation.schema.json +107 -0
- package/scripts/build-package.mjs +65 -0
- package/scripts/generate-tool-execution-observation-schema.ts +7 -0
- package/souls/coder.md +10 -0
- package/souls/collector.md +11 -0
- package/souls/doctor-auditor.md +23 -0
- package/souls/doctor.md +8 -0
- package/souls/fixer-auditor.md +33 -0
- package/souls/fixer.md +13 -0
- package/souls/judge-auditor.md +33 -0
- package/souls/judge.md +74 -0
- package/souls/merger.md +5 -0
- package/souls/navigator.md +5 -0
- package/souls/reviewer-auditor.md +25 -0
- package/souls/reviewer.md +11 -0
- package/src/activation-ledger-git.ts +96 -0
- package/src/activation-ledger-session.ts +188 -0
- package/src/activation-ledger-topology.ts +301 -0
- package/src/activation-ledger.ts +240 -0
- package/src/activation-reconciliation.ts +163 -0
- package/src/activation-trace.ts +38 -0
- package/src/audit-escalation.ts +177 -0
- package/src/auditor-dossier-tool.ts +48 -0
- package/src/auditor-soul.ts +28 -0
- package/src/canonical-json.ts +74 -0
- package/src/canonical-skill-binding.ts +107 -0
- package/src/collector-config.ts +89 -0
- package/src/collector-evidence.ts +461 -0
- package/src/collector-github.ts +656 -0
- package/src/collector-identity.ts +161 -0
- package/src/collector-ledger.ts +827 -0
- package/src/collector-receipt.ts +87 -0
- package/src/collector-role.ts +592 -0
- package/src/collector-tool-schemas.ts +19 -0
- package/src/compliance-transport.ts +130 -0
- package/src/doctor-auditor.ts +53 -0
- package/src/doctor-contracts.ts +166 -0
- package/src/doctor-evidence.ts +47 -0
- package/src/doctor-role.ts +18 -0
- package/src/dossier-resolution.ts +137 -0
- package/src/evidence-child-executor.ts +775 -0
- package/src/exact-utf8.ts +9 -0
- package/src/factory-board.ts +1822 -0
- package/src/git-object-id.ts +11 -0
- package/src/human-format.ts +65 -0
- package/src/in-process-session.ts +78 -0
- package/src/judge-auditor.ts +55 -0
- package/src/judge-recording-anti-forge.ts +53 -0
- package/src/judge-role.ts +160 -0
- package/src/merger-contracts.ts +71 -0
- package/src/merger-git-state.ts +76 -0
- package/src/merger-role.ts +60 -0
- package/src/navigator-attendance.ts +1254 -0
- package/src/navigator-invocation-identity.ts +446 -0
- package/src/open-tool-schema.ts +46 -0
- package/src/package-contracts/collector-output.ts +109 -0
- package/src/package-contracts/fixer-output.ts +81 -0
- package/src/package-contracts/fixer-packet.ts +93 -0
- package/src/package-contracts/judge-output.ts +39 -0
- package/src/package-contracts/reviewer-output.ts +115 -0
- package/src/package-contracts/terminating-tools.ts +259 -0
- package/src/package-contracts/worker-output.ts +36 -0
- package/src/package-owned-tool-idle.ts +134 -0
- package/src/package-resources/method-skill-binding.ts +87 -0
- package/src/package-resources/method-skill.ts +358 -0
- package/src/packaged-role-registry.ts +36 -0
- package/src/public-cli/cli-errors.ts +11 -0
- package/src/public-cli/cli-io.ts +4 -0
- package/src/public-cli/cli.ts +912 -0
- package/src/public-cli/coder-run.ts +575 -0
- package/src/public-cli/collector-run.ts +375 -0
- package/src/public-cli/command-renderer.ts +8 -0
- package/src/public-cli/config.ts +346 -0
- package/src/public-cli/doctor-run.ts +355 -0
- package/src/public-cli/explicit-internal.ts +274 -0
- package/src/public-cli/fixer-run.ts +587 -0
- package/src/public-cli/host-pi-runtime.ts +112 -0
- package/src/public-cli/invocation.ts +1958 -0
- package/src/public-cli/judge-run.ts +507 -0
- package/src/public-cli/main.ts +15 -0
- package/src/public-cli/merger-run.ts +681 -0
- package/src/public-cli/public-run-credentials.ts +71 -0
- package/src/public-cli/registry.ts +153 -0
- package/src/public-cli/reviewer-run.ts +561 -0
- package/src/public-cli/run-lifecycle.ts +884 -0
- package/src/public-cli/settlement.ts +3765 -0
- package/src/public-cli/terminal.ts +325 -0
- package/src/public-command-renderer.ts +43 -0
- package/src/reviewer-agent.ts +94 -0
- package/src/reviewer-auditor.ts +53 -0
- package/src/reviewer-child-executor.ts +31 -0
- package/src/reviewer-construction.ts +137 -0
- package/src/reviewer-dispatch.ts +94 -0
- package/src/reviewer-execution-ledger.ts +206 -0
- package/src/reviewer-failure-diagnostic.ts +18 -0
- package/src/reviewer-git-snapshot.ts +53 -0
- package/src/reviewer-pinned-git.ts +144 -0
- package/src/reviewer-preflight-error.ts +14 -0
- package/src/reviewer-prompt-identity.ts +17 -0
- package/src/reviewer-role.ts +193 -0
- package/src/reviewer-scope-prompt.ts +24 -0
- package/src/reviewer-settlement.ts +63 -0
- package/src/reviewer-workspace.ts +111 -0
- package/src/role-runtime.ts +884 -0
- package/src/sha256.ts +6 -0
- package/src/sitian-record-entry.ts +57 -0
- package/src/stderr-jsonl.ts +28 -0
- package/src/stream-idle-guard.ts +98 -0
- package/src/ticket-snapshot.ts +662 -0
- package/src/ticket-trajectory.ts +1000 -0
- package/src/tool-execution-observation.ts +168 -0
- package/src/uuidv7.ts +1 -0
- package/src/work-subject-identity.ts +94 -0
- package/src/worker-role.ts +434 -0
- package/src/worker-submission-gates.ts +225 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type GitHubIssueComment,
|
|
3
|
+
type GitHubMachineIdentity,
|
|
4
|
+
type GitHubPullRequestReaction,
|
|
5
|
+
type GitHubReview,
|
|
6
|
+
type GitHubReviewComment,
|
|
7
|
+
} from "./collector-github.ts";
|
|
8
|
+
import type { CollectorEvidenceRecord, HeadRelation } from "./collector-evidence.ts";
|
|
9
|
+
|
|
10
|
+
export type GitHubIdentityMaterial = GitHubReview | GitHubIssueComment | GitHubReviewComment | GitHubPullRequestReaction;
|
|
11
|
+
|
|
12
|
+
export type CollectorMaterialRef = {
|
|
13
|
+
kind: "review" | "issue_comment" | "review_comment" | "reaction";
|
|
14
|
+
id: number;
|
|
15
|
+
/** Original review body, retained as uninterpreted material. */
|
|
16
|
+
body?: string;
|
|
17
|
+
/** Receipt-local immutable source reference. */
|
|
18
|
+
evidenceId?: string;
|
|
19
|
+
headRelation?: HeadRelation | "unbound";
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type CollectorFinding = {
|
|
23
|
+
identity: GitHubMachineIdentity;
|
|
24
|
+
source: CollectorMaterialRef;
|
|
25
|
+
category: "inline";
|
|
26
|
+
body: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type CollectorIdentityGroup = {
|
|
30
|
+
identity: GitHubMachineIdentity | null;
|
|
31
|
+
/** Human-readable metadata only; never participates in grouping. */
|
|
32
|
+
displayLogin?: string;
|
|
33
|
+
attendance?: true;
|
|
34
|
+
findings?: CollectorFinding[];
|
|
35
|
+
materials: CollectorMaterialRef[];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function materialKind(material: GitHubIdentityMaterial): CollectorIdentityGroup["materials"][number]["kind"] {
|
|
39
|
+
if ("pullRequestReviewId" in material) return "review_comment";
|
|
40
|
+
if ("state" in material) return "review";
|
|
41
|
+
if ("content" in material) return "reaction";
|
|
42
|
+
return "issue_comment";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function identityKey(identity: GitHubMachineIdentity | null): string {
|
|
46
|
+
if (identity === null) return "unassigned";
|
|
47
|
+
// GitHub omits App metadata on some surfaces (notably review comments).
|
|
48
|
+
// The stable user ID is the grouping identity; richer observed structure is
|
|
49
|
+
// merged below and must not split one actor across transport surfaces.
|
|
50
|
+
return String(identity.userId);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function mergeMachineIdentity(
|
|
54
|
+
current: GitHubMachineIdentity | null,
|
|
55
|
+
observed: GitHubMachineIdentity | null,
|
|
56
|
+
): GitHubMachineIdentity | null {
|
|
57
|
+
if (current === null) return observed;
|
|
58
|
+
if (observed === null) return current;
|
|
59
|
+
if (current.appId === undefined && observed.appId !== undefined) return observed;
|
|
60
|
+
if (current.appId !== undefined && observed.appId === undefined) return current;
|
|
61
|
+
return observed.userType < current.userType ? observed : current;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Group observed GitHub materials only by API machine identity fields. */
|
|
65
|
+
export function groupGitHubMaterialsByIdentity(
|
|
66
|
+
materials: readonly GitHubIdentityMaterial[],
|
|
67
|
+
): CollectorIdentityGroup[] {
|
|
68
|
+
const groups = new Map<string, CollectorIdentityGroup>();
|
|
69
|
+
for (const material of materials) {
|
|
70
|
+
const identity = material.machineIdentity ?? null;
|
|
71
|
+
const key = identityKey(identity);
|
|
72
|
+
let group = groups.get(key);
|
|
73
|
+
if (group === undefined) {
|
|
74
|
+
group = {
|
|
75
|
+
identity,
|
|
76
|
+
...(material.userLogin === null ? {} : { displayLogin: material.userLogin }),
|
|
77
|
+
materials: [],
|
|
78
|
+
};
|
|
79
|
+
groups.set(key, group);
|
|
80
|
+
} else {
|
|
81
|
+
group.identity = mergeMachineIdentity(group.identity, identity);
|
|
82
|
+
}
|
|
83
|
+
const kind = materialKind(material);
|
|
84
|
+
group.materials.push({
|
|
85
|
+
kind,
|
|
86
|
+
id: material.id,
|
|
87
|
+
...(kind === "review" && "body" in material ? { body: material.body } : {}),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return [...groups.values()];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const CODEX_USER_ID = 199175422;
|
|
94
|
+
const CODERABBIT_USER_ID = 136622811;
|
|
95
|
+
export type ExtractedCollectorIdentityGroup = CollectorIdentityGroup & {
|
|
96
|
+
attendance: true;
|
|
97
|
+
findings: CollectorFinding[];
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** Extract attendance and provider findings without using login/display text as identity. */
|
|
101
|
+
export function extractGitHubIdentityGroups(materials: readonly GitHubIdentityMaterial[]): ExtractedCollectorIdentityGroup[] {
|
|
102
|
+
const groups = groupGitHubMaterialsByIdentity(materials);
|
|
103
|
+
const byKey = new Map(groups.map((group) => [identityKey(group.identity), group]));
|
|
104
|
+
for (const group of groups) {
|
|
105
|
+
group.attendance = true;
|
|
106
|
+
group.findings = [];
|
|
107
|
+
}
|
|
108
|
+
for (const material of materials) {
|
|
109
|
+
const identity = material.machineIdentity ?? null;
|
|
110
|
+
const group = byKey.get(identityKey(identity))!;
|
|
111
|
+
if (identity === null) continue;
|
|
112
|
+
const source = { kind: materialKind(material), id: material.id };
|
|
113
|
+
if (source.kind === "review_comment" && "body" in material && (identity.userId === CODEX_USER_ID || identity.userId === CODERABBIT_USER_ID)) {
|
|
114
|
+
group.findings!.push({ identity, source, category: "inline", body: material.body });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return groups as ExtractedCollectorIdentityGroup[];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Receipt adapter consuming the typed facts retained by transport normalization. */
|
|
121
|
+
export function extractCollectorEvidenceIdentityGroups(
|
|
122
|
+
records: readonly CollectorEvidenceRecord[],
|
|
123
|
+
targetHead: string,
|
|
124
|
+
): ExtractedCollectorIdentityGroup[] {
|
|
125
|
+
const groups = new Map<string, ExtractedCollectorIdentityGroup>();
|
|
126
|
+
for (const record of records) {
|
|
127
|
+
if (record.kind !== "review" && record.kind !== "issue_comment" && record.kind !== "review_comment" && record.kind !== "reaction") continue;
|
|
128
|
+
if (record.githubId === undefined) continue;
|
|
129
|
+
const identity = record.machineIdentity ?? null;
|
|
130
|
+
const kind = record.kind;
|
|
131
|
+
const source: CollectorMaterialRef = {
|
|
132
|
+
kind,
|
|
133
|
+
id: record.githubId,
|
|
134
|
+
...(kind === "review" && record.body !== undefined ? { body: record.body } : {}),
|
|
135
|
+
evidenceId: record.evidenceId,
|
|
136
|
+
headRelation: record.commitOid === undefined || record.commitOid === null
|
|
137
|
+
? "unbound"
|
|
138
|
+
: record.commitOid === targetHead ? "current" : "prior",
|
|
139
|
+
};
|
|
140
|
+
const key = identityKey(identity);
|
|
141
|
+
let group = groups.get(key);
|
|
142
|
+
if (group === undefined) {
|
|
143
|
+
group = {
|
|
144
|
+
identity,
|
|
145
|
+
...(record.authorLogin === undefined ? {} : { displayLogin: record.authorLogin }),
|
|
146
|
+
attendance: true,
|
|
147
|
+
findings: [],
|
|
148
|
+
materials: [],
|
|
149
|
+
};
|
|
150
|
+
groups.set(key, group);
|
|
151
|
+
} else {
|
|
152
|
+
group.identity = mergeMachineIdentity(group.identity, identity);
|
|
153
|
+
}
|
|
154
|
+
group.materials.push(source);
|
|
155
|
+
if (identity === null || record.body === undefined) continue;
|
|
156
|
+
if (kind === "review_comment" && (identity.userId === CODEX_USER_ID || identity.userId === CODERABBIT_USER_ID)) {
|
|
157
|
+
group.findings.push({ identity, source: { ...source }, category: "inline", body: record.body });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return [...groups.values()];
|
|
161
|
+
}
|