@akagilnc/pi-workflow-roles 0.1.5235 → 0.1.5245
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/CLAUDE.md +3 -0
- package/README.md +2 -3
- package/README.zh-CN.md +2 -3
- package/dist/acp-host/production-host.js +528 -3266
- package/dist/collector-config.js +0 -1
- package/dist/headless-host/production-host.js +671 -3409
- package/dist/migrate-book-topology.js +40 -107
- 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 +302 -827
- package/dist/public-cli/option-definitions.js +4 -19
- package/dist/public-cli/post-admission.js +4 -17
- package/dist/public-cli/settlement.js +2 -79
- package/dist/sitian-appender.js +0 -9
- 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/notary-role.ts +0 -1
- 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/countersign-run.ts +4 -3
- package/src/public-cli/invocation.ts +3 -27
- package/src/public-cli/option-definitions.ts +4 -19
- package/src/public-cli/post-admission.ts +4 -18
- package/src/public-cli/settlement.ts +3 -102
- package/src/role-envelope.ts +2 -2
- package/src/role-runtime-dependencies.ts +0 -4
- package/src/role-runtime.ts +16 -112
- package/src/sitian-appender.ts +0 -14
- 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/dist/public-cli/case-dossier-delivery.js +0 -109
- 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
- package/src/public-cli/case-dossier-delivery.ts +0 -147
|
@@ -429,13 +429,12 @@ const COLLECTOR_OPTIONS = [
|
|
|
429
429
|
canonical: "--pr",
|
|
430
430
|
aliases: [],
|
|
431
431
|
valueMetavar: "number",
|
|
432
|
-
// #676 D1: optional when context uniquely determines the PR; ambiguous → require explicit.
|
|
433
432
|
required: false,
|
|
434
433
|
repeatable: false,
|
|
435
434
|
form: "option",
|
|
436
435
|
description: {
|
|
437
|
-
en: "Positive GitHub pull request number. Optional when
|
|
438
|
-
zh: "正整数 GitHub PR
|
|
436
|
+
en: "Positive GitHub pull request number. Optional when the Collector role locates the PR via host CLI from task materials.",
|
|
437
|
+
zh: "正整数 GitHub PR 号。可选;省略时由通进司经宿主 CLI 从任务材料自行定位。",
|
|
439
438
|
},
|
|
440
439
|
},
|
|
441
440
|
{
|
|
@@ -462,22 +461,8 @@ const COLLECTOR_OPTIONS = [
|
|
|
462
461
|
repeatable: false,
|
|
463
462
|
form: "option",
|
|
464
463
|
description: {
|
|
465
|
-
en: "Optional request manifest JSON path ({requests:[{id,body}]}).
|
|
466
|
-
zh: "可选 request manifest JSON 路径({requests:[{id,body}]}
|
|
467
|
-
},
|
|
468
|
-
},
|
|
469
|
-
{
|
|
470
|
-
id: "wait-ms",
|
|
471
|
-
owner: "collector",
|
|
472
|
-
canonical: "--wait-ms",
|
|
473
|
-
aliases: [],
|
|
474
|
-
valueMetavar: "ms",
|
|
475
|
-
required: false,
|
|
476
|
-
repeatable: false,
|
|
477
|
-
form: "option",
|
|
478
|
-
description: {
|
|
479
|
-
en: "Wait-window duration in milliseconds after the work step opens (default 600000 = 10 minutes). Does not require a code change to adjust.",
|
|
480
|
-
zh: "工作步骤开启后的等待窗时长(毫秒;默认 600000=十分钟)。改配置即可,无需改代码。",
|
|
464
|
+
en: "Optional request manifest JSON path ({requests:[{id,body}]}). Parsed for semantics and passed to the Collector as materials — not a machine collection directive.",
|
|
465
|
+
zh: "可选 request manifest JSON 路径({requests:[{id,body}]})。按语义解析后作为材料递给通进司,不是机器代收 finding 的指令。",
|
|
481
466
|
},
|
|
482
467
|
},
|
|
483
468
|
];
|
|
@@ -18,7 +18,6 @@ import { pickEngineAxis } from "../package-resources/engine-material.js";
|
|
|
18
18
|
import { readStoredHostSessionId, resolveHostAwareSessionAvailability, } from "../session-identity.js";
|
|
19
19
|
import { rewriteRunDirectoryPathValue } from "../role-run-relocation.js";
|
|
20
20
|
import { isOfficerReviewSeat } from "../packaged-role-registry.js";
|
|
21
|
-
import { deliverCaseDossierAsAttachment } from "./case-dossier-delivery.js";
|
|
22
21
|
/** Original error bytes, never relabeled — a secondary fact riding beside a classified cause. */
|
|
23
22
|
function describeCaughtError(error) {
|
|
24
23
|
if (error instanceof Error) {
|
|
@@ -29,8 +28,8 @@ function describeCaughtError(error) {
|
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* Nested gate summons (station child) on an officer seat: dialogue content is
|
|
32
|
-
* peer words only (#879).
|
|
33
|
-
*
|
|
31
|
+
* peer words only (#879). Never RoleTurnRequest.materials; #1092 drops code-side
|
|
32
|
+
* 起居录 path pointer freeze — roles locate records by ticket number.
|
|
34
33
|
*/
|
|
35
34
|
function isStationChildOfficerDialogue(role, env) {
|
|
36
35
|
return env.stationChild === true && isOfficerReviewSeat(role);
|
|
@@ -438,10 +437,8 @@ export async function dispatchPostAdmissionTurn(input) {
|
|
|
438
437
|
}
|
|
439
438
|
// Turn request is assembled after beforeDispatch so this turn sees whatever it
|
|
440
439
|
// settled — the seat's ticket bind re-projection and any court diarist station
|
|
441
|
-
// writes (#742).
|
|
442
|
-
//
|
|
443
|
-
// (station-child and ordinary share one seam). Dialogue continuation stays
|
|
444
|
-
// caller/peer opaque — never splice system path sections into user dialogue.
|
|
440
|
+
// writes (#742). Dialogue continuation stays caller/peer opaque. #1092: no
|
|
441
|
+
// code-side 起居录 path freeze or readingMaterial inject — roles read by ticket.
|
|
445
442
|
// No package-resume parallel face or typed resume identity.
|
|
446
443
|
// #990: one-shot / auto-resume may freeze principal+runDirectory before
|
|
447
444
|
// relocate; always take durable identity from the live admitted object.
|
|
@@ -458,16 +455,6 @@ export async function dispatchPostAdmissionTurn(input) {
|
|
|
458
455
|
if (typeof env.host === "string" && env.host.trim() !== "") {
|
|
459
456
|
turnRequest = { ...turnRequest, host: env.host.trim() };
|
|
460
457
|
}
|
|
461
|
-
// 0081 non-dialogue face: freeze pointer section under run/attachments/.
|
|
462
|
-
// Seat consumes via loadCaseDossierReadingMaterial → existing agent-start
|
|
463
|
-
// readingMaterial / systemPrompt.materials fold. Caller instruction, empty
|
|
464
|
-
// request, and resume --message stay verbatim.
|
|
465
|
-
await deliverCaseDossierAsAttachment({
|
|
466
|
-
ticketNumber: admitted.ticketNumber,
|
|
467
|
-
projectRoot: admitted.projectRoot,
|
|
468
|
-
home: env.home,
|
|
469
|
-
runDirectory: admitted.runDirectory,
|
|
470
|
-
});
|
|
471
458
|
// Authoritative host write happens here, at the real dispatch boundary —
|
|
472
459
|
// immediately before the turn actually starts, after every retryable
|
|
473
460
|
// pre-turn step above has succeeded on this attempt (#840 r9 判词 class 2).
|
|
@@ -17,16 +17,14 @@ import { isV1ResumableProvider, readLatestTypedProviderHttpObservation, readType
|
|
|
17
17
|
import { AUDITOR_COMPLIANCE_FAILURE_ENTRY_TYPE, AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE, COMPLIANCE_RESPONSE_ENTRY_TYPE, readComplianceCandidate, } from "../compliance-transport.js";
|
|
18
18
|
// COMPLIANCE_RESPONSE_ENTRY_TYPE remains for boundRetainedAuditResponse (call/result
|
|
19
19
|
// interval binding on historical session bytes). Provider-stop retain authority is Sitian.
|
|
20
|
-
import {
|
|
21
|
-
import { ENGINE_DETOUR_TOOL_NAME } from "../engine-detour.js";
|
|
20
|
+
import { ENGINE_DETOUR_TOOL_NAME, } from "../engine-detour.js";
|
|
22
21
|
import { projectEngineDetourToolUsageForPublicTerminal, readEngineDetourToolUsage, readInvocationEngineMounted, runDirectoryFromSessionDirectory, sessionFileFromSessionDirectory, withEngineDetourToolUsageFact, } from "../engine-detour-usage.js";
|
|
23
22
|
import { JUDGE_OUTPUT_TOOL_NAME, } from "../package-contracts/judge-output.js";
|
|
24
|
-
import { COLLECTOR_OUTPUT_TOOL, } from "../package-contracts/collector-output.js";
|
|
25
23
|
import { CODER_OUTPUT_TOOL_NAME, FIXER_OUTPUT_TOOL_NAME, } from "../package-contracts/worker-output.js";
|
|
26
24
|
import { DOCTOR_OUTPUT_TOOL_NAME, } from "../doctor-contracts.js";
|
|
27
25
|
import { DOCTOR_CANDIDATE_ENTRY_TYPE } from "../dossier-resolution.js";
|
|
28
26
|
import { REVIEWER_OUTPUT_TOOL_NAME, } from "../package-contracts/reviewer-output.js";
|
|
29
|
-
import { packagedAuditToolName, packagedDurableOfficerEntry,
|
|
27
|
+
import { packagedAuditToolName, packagedDurableOfficerEntry, packagedRoleAcceptedOutputTool, packagedRoleMetadata, packagedSkipsGateOnInfrastructureStage, } from "../packaged-role-registry.js";
|
|
30
28
|
import { SECRETARIAT_COUNTERSIGN_TERMINAL_FACT_KEY, SECRETARIAT_GATE_OFFICER_ENTRY_TYPE, } from "../secretariat-contracts.js";
|
|
31
29
|
import { classifyPackagedRoleTerminalResult, findLatestDurablePackagedRoleTerminal, hasNavigatorInfrastructureFailureBase, isAcceptedPackagedRoleTerminalResult, isReceiptSettlementBindingClear, NAVIGATOR_INVOCATION_ENTRY, NAVIGATOR_ROUTE_PLAYBOOK_FAILURE_ENTRY, parseInvocationMarkerIdentity, } from "../navigator-invocation-identity.js";
|
|
32
30
|
import { NO_RECEIPT_LIFECYCLE_ENTRY_TYPE, RECEIPT_DELIVERY_TURN_LIMIT, noReceiptLifecycleFacts, parseNoReceiptLifecycleFacts, } from "../receipt-delivery-policy.js";
|
|
@@ -1037,35 +1035,6 @@ function toolResultText(message) {
|
|
|
1037
1035
|
.join("")
|
|
1038
1036
|
.trim();
|
|
1039
1037
|
}
|
|
1040
|
-
/**
|
|
1041
|
-
* #676 D1/J3: durable bind-target rejection on the current attempt → public no_receipt facts.
|
|
1042
|
-
* Callers must learn they need explicit --pr without opening the session 正本.
|
|
1043
|
-
* Authority is the latest bind-target toolResult only — a later success clears an earlier failure.
|
|
1044
|
-
*/
|
|
1045
|
-
function extractCollectorTargetBindRejection(entries) {
|
|
1046
|
-
for (let i = entries.length - 1; i >= 0; i -= 1) {
|
|
1047
|
-
const entry = entries[i];
|
|
1048
|
-
if (entry?.type !== "message")
|
|
1049
|
-
continue;
|
|
1050
|
-
const message = entry.message;
|
|
1051
|
-
if (message?.role !== "toolResult")
|
|
1052
|
-
continue;
|
|
1053
|
-
if (message.toolName !== COLLECTOR_BIND_TARGET_TOOL)
|
|
1054
|
-
continue;
|
|
1055
|
-
// Latest bind result wins: success means the attempt is no longer rejected.
|
|
1056
|
-
if (message.isError !== true)
|
|
1057
|
-
return undefined;
|
|
1058
|
-
const diagnostic = toolResultText(message);
|
|
1059
|
-
if (diagnostic.length === 0)
|
|
1060
|
-
return undefined;
|
|
1061
|
-
const details = message.details;
|
|
1062
|
-
const code = isRecord(details) && typeof details.code === "string" && details.code.trim() !== ""
|
|
1063
|
-
? details.code
|
|
1064
|
-
: undefined;
|
|
1065
|
-
return code === undefined ? { diagnostic } : { diagnostic, code };
|
|
1066
|
-
}
|
|
1067
|
-
return undefined;
|
|
1068
|
-
}
|
|
1069
1038
|
function boundErroredToolCandidate(entries, resultIndex, message, toolName) {
|
|
1070
1039
|
if (message.toolName !== toolName || message.isError !== true)
|
|
1071
1040
|
return undefined;
|
|
@@ -1075,21 +1044,6 @@ function boundErroredToolCandidate(entries, resultIndex, message, toolName) {
|
|
|
1075
1044
|
? undefined
|
|
1076
1045
|
: { candidate: bound.candidate, diagnostic, callIndex: bound.callIndex };
|
|
1077
1046
|
}
|
|
1078
|
-
/** Collector operational tools that fail closed via host infrastructure abort. */
|
|
1079
|
-
const COLLECTOR_INFRASTRUCTURE_TOOLS = new Set([
|
|
1080
|
-
COLLECTOR_OBSERVE_TOOL,
|
|
1081
|
-
COLLECTOR_READ_TOOL,
|
|
1082
|
-
COLLECTOR_REQUEST_TOOL,
|
|
1083
|
-
COLLECTOR_WAIT_TOOL,
|
|
1084
|
-
]);
|
|
1085
|
-
const COLLECTOR_INFRASTRUCTURE_FAILURE_SPEC = {
|
|
1086
|
-
matchTool: (toolName) => COLLECTOR_INFRASTRUCTURE_TOOLS.has(toolName),
|
|
1087
|
-
cause: "activation",
|
|
1088
|
-
identityName: "CollectorInfrastructureError",
|
|
1089
|
-
// read alone has a correctable rejection mode (unknown/non-openable pointers);
|
|
1090
|
-
// only its typed infrastructure-failure fact counts as a real host failure.
|
|
1091
|
-
requireInfrastructureFact: (toolName) => toolName === COLLECTOR_READ_TOOL,
|
|
1092
|
-
};
|
|
1093
1047
|
const ENGINE_DETOUR_INFRASTRUCTURE_FAILURE_SPEC = {
|
|
1094
1048
|
matchTool: (toolName) => toolName === ENGINE_DETOUR_TOOL_NAME,
|
|
1095
1049
|
cause: "output",
|
|
@@ -1146,21 +1100,6 @@ async function readInfrastructureToolFailure(sessionFile, spec, options = {}) {
|
|
|
1146
1100
|
return undefined;
|
|
1147
1101
|
}
|
|
1148
1102
|
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Prefer a real Collector infrastructure tool failure already on the session
|
|
1151
|
-
* principal over a later secondary provider-stop (failure-honesty).
|
|
1152
|
-
* Observe/request/wait host failures keep their diagnostic identity (e.g. HTTP 404).
|
|
1153
|
-
*/
|
|
1154
|
-
export function extractCollectorInfrastructureFailure(entries) {
|
|
1155
|
-
return extractInfrastructureToolFailure(entries, COLLECTOR_INFRASTRUCTURE_FAILURE_SPEC);
|
|
1156
|
-
}
|
|
1157
|
-
/** Read the bound session principal for a Collector infrastructure tool failure. */
|
|
1158
|
-
export async function readCollectorInfrastructureFailure(sessionFile) {
|
|
1159
|
-
return readInfrastructureToolFailure(sessionFile, COLLECTOR_INFRASTRUCTURE_FAILURE_SPEC,
|
|
1160
|
-
// Multi-attempt resume: only a current-attempt infrastructure failure
|
|
1161
|
-
// may preempt the current failure cause (#633).
|
|
1162
|
-
{ currentAttemptOnly: true });
|
|
1163
|
-
}
|
|
1164
1103
|
/**
|
|
1165
1104
|
* Prefer a real engine-detour infrastructure tool failure already on the session
|
|
1166
1105
|
* principal over a later secondary provider-stop (failure-honesty / #357 T2).
|
|
@@ -1189,10 +1128,6 @@ const RUNNER_FAILURE_POLICY = {
|
|
|
1189
1128
|
read: readEngineDetourInfrastructureFailure,
|
|
1190
1129
|
rank: "record-first",
|
|
1191
1130
|
},
|
|
1192
|
-
"collector-known-first": {
|
|
1193
|
-
read: readCollectorInfrastructureFailure,
|
|
1194
|
-
rank: "known-first",
|
|
1195
|
-
},
|
|
1196
1131
|
};
|
|
1197
1132
|
/**
|
|
1198
1133
|
* Runner-failure rank for one seat. The composition-root `runnerFailure`
|
|
@@ -2441,18 +2376,6 @@ export async function settleFailureTerminalResult(admitted, failure, authority,
|
|
|
2441
2376
|
facts.runPointer === admitted.runDirectory &&
|
|
2442
2377
|
facts.attemptPointer === `current:${admitted.runDirectory}`) {
|
|
2443
2378
|
let decisiveFacts = facts;
|
|
2444
|
-
// #676 D1/J3: project durable bind-target rejection onto public no_receipt facts.
|
|
2445
|
-
if (packagedProjectsTargetBindRejection(admitted.role)) {
|
|
2446
|
-
const bindRejection = extractCollectorTargetBindRejection(entries.slice(attemptStart));
|
|
2447
|
-
if (bindRejection !== undefined) {
|
|
2448
|
-
decisiveFacts = {
|
|
2449
|
-
...facts,
|
|
2450
|
-
targetBindRejected: true,
|
|
2451
|
-
targetBindDiagnostic: bindRejection.diagnostic,
|
|
2452
|
-
...(bindRejection.code === undefined ? {} : { targetBindCode: bindRejection.code }),
|
|
2453
|
-
};
|
|
2454
|
-
}
|
|
2455
|
-
}
|
|
2456
2379
|
// #478: no_receipt is still a public Terminal — project accepted gate facts.
|
|
2457
2380
|
// #953: empty public terminal face — clear every reader-adoptable prior face.
|
|
2458
2381
|
await clearOppositeTerminalArtifactFace(admitted.runDirectory);
|
package/dist/sitian-appender.js
CHANGED
|
@@ -73,14 +73,6 @@ function resolveSitianRecordPathInLedger(input, ledgerHome) {
|
|
|
73
73
|
}
|
|
74
74
|
return { sessionDir, recordFile, ledgerHome };
|
|
75
75
|
}
|
|
76
|
-
function projectTicketRecordsPathShape() {
|
|
77
|
-
const { recordFile } = ticketProvenanceUnderBookPaths(
|
|
78
|
-
join("~", ".ak-roles"),
|
|
79
|
-
"<\u7C3F>",
|
|
80
|
-
"<\u7968\u53F7>"
|
|
81
|
-
);
|
|
82
|
-
return recordFile.replace(/\\/g, "/");
|
|
83
|
-
}
|
|
84
76
|
function resolveSitianRecordPath(input) {
|
|
85
77
|
const ledgerHome = input.home !== void 0 && input.home.length > 0 ? resolveActivationLedgerHome(input.home) : resolveActivationLedgerHomeForPath(input.runDirectory ?? input.sessionParent);
|
|
86
78
|
return resolveSitianRecordPathInLedger(input, ledgerHome);
|
|
@@ -126,7 +118,6 @@ export {
|
|
|
126
118
|
S4_SUBMISSION_LEDGER_KINDS,
|
|
127
119
|
appendSitianRecord,
|
|
128
120
|
appendSitianRecordBlock,
|
|
129
|
-
projectTicketRecordsPathShape,
|
|
130
121
|
resolveSitianRecordPath,
|
|
131
122
|
resolveSitianRecordPathInLedger,
|
|
132
123
|
resolveSitianVolumeCategory
|
package/package.json
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
内容是角色阅读与修正的工作记忆,不是代码状态规则;临时额度/故障不得固化为永久行为。
|
|
5
5
|
参与者依本仓使用与现场活动辨认,不把下列名称当作全仓固定名单。
|
|
6
6
|
|
|
7
|
+
#1088:用宿主 CLI(如 `gh`)自行取证与请求;代码不代收、不选择、不归并 finding。取证受限时如实报告。
|
|
8
|
+
|
|
7
9
|
## Codex(hosted GitHub connector)
|
|
8
10
|
|
|
9
11
|
- 官方:https://learn.chatgpt.com/docs/third-party/github
|
|
@@ -29,9 +31,9 @@
|
|
|
29
31
|
|
|
30
32
|
## 工序
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
从任务材料与 `--pr` / `--request-manifest` 材料判定目标后,用宿主 CLI 读取有评审的 PR,按各 reviewer 已记录的完成形态收集 findings,整理并交卷。未绑定 PR 时用 `gh` 等自行定位;无法确定时不猜,交给调用方明确目标。交卷交按机器身份归组的出席、材料与 findings;没有 finding 就不要编一条。未完成写现场原因,不写成没问题。
|
|
33
35
|
|
|
34
36
|
## 修正规则
|
|
35
37
|
|
|
36
|
-
-
|
|
38
|
+
- 优先引用官方文档;现场差异附 PR/证据指针
|
|
37
39
|
- 未知或暂未响应 ≠ 通过或确定死亡
|
package/src/collector-config.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
3
|
|
|
4
|
-
export const COLLECTOR_HOST = "github.com" as const;
|
|
5
4
|
export const COLLECTOR_OWNER_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/;
|
|
6
5
|
export const COLLECTOR_REPO_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,98}[A-Za-z0-9])?$/;
|
|
7
6
|
|