@akagilnc/pi-workflow-roles 0.1.5295 → 0.1.5301
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 +7 -3
- package/README.zh-CN.md +7 -3
- package/dist/acp-host/production-host.js +10 -367
- package/dist/diarist-contracts.js +1 -96
- package/dist/headless-host/production-host.js +10 -367
- package/dist/migrate-book-topology.js +75 -77
- package/dist/public-cli/countersign-run.js +3 -124
- package/dist/public-cli/instruction-seat-run.js +5 -97
- package/dist/public-cli/invocation.js +0 -33
- package/dist/public-cli/main.js +10 -362
- package/dist/public-cli/post-admission.js +2 -14
- package/dist/public-cli/run-lifecycle.js +0 -85
- package/dist/public-role-summons.js +2 -2
- package/package.json +1 -1
- package/src/diarist-contracts.ts +1 -116
- package/src/diarist-role.ts +0 -6
- package/src/public-cli/countersign-run.ts +7 -184
- package/src/public-cli/instruction-seat-run.ts +6 -101
- package/src/public-cli/invocation.ts +2 -64
- package/src/public-cli/post-admission.ts +2 -15
- package/src/public-cli/run-lifecycle.ts +0 -117
- package/src/public-role-summons.ts +3 -3
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ The examples below are usage sketches; option identity, aliases, requiredness, a
|
|
|
83
83
|
# ak-role config set <seat> <provider/model[:thinking]>
|
|
84
84
|
# …or pass --model on the call (shown below). No package default model.
|
|
85
85
|
|
|
86
|
-
# countersign — ticket-court review before work starts;
|
|
86
|
+
# countersign — ticket-court review before work starts; does not summon the diarist; resume continues the exact session
|
|
87
87
|
ak-role countersign --model <provider/model[:thinking]> --attach ./ticket.md "裁:本票 #582 是否足以开工。"
|
|
88
88
|
|
|
89
89
|
# secretariat — rewrite ticket per 票面法; submission routes converged verdicts through the shared countersign gate (#924, #1021)
|
|
@@ -130,10 +130,14 @@ ak-role gatekeeper --model <provider/model[:thinking]> --attach ./submission.jso
|
|
|
130
130
|
# navigator — direct free-form prose route advice; attends automatically on top-level public entry legs only
|
|
131
131
|
ak-role navigator --model <provider/model[:thinking]> "刚完成 coder apply 收敛,下一步?"
|
|
132
132
|
|
|
133
|
-
# diarist — gather
|
|
133
|
+
# diarist — gather this case's decisions into per-ticket 起居录; secretariat summons it before drafting a new ticket
|
|
134
134
|
ak-role diarist --model <provider/model[:thinking]> "整理 #708 的本案依据。"
|
|
135
135
|
|
|
136
|
-
# countersign
|
|
136
|
+
# before a countersign court, call the diarist only if the owner has said something new about the ticket since its last record; otherwise open or resume the court directly
|
|
137
|
+
ak-role diarist --model <provider/model[:thinking]> "整理 #582 自上次成录以来的御话。"
|
|
138
|
+
# for a multi-ticket court, summon once with all ticket numbers; the diarist records each ticket separately
|
|
139
|
+
ak-role diarist --model <provider/model[:thinking]> "整理 #582、#583 自上次成录以来的御话,分别成录。"
|
|
140
|
+
# countersign reports ticketNumber itself: use an existing diary's ticket number first; without a diary the officer identifies it
|
|
137
141
|
ak-role countersign --model <provider/model[:thinking]> --attach ./ticket.md "裁:本票 #582 是否足以开工。"
|
|
138
142
|
|
|
139
143
|
# analyst — deterministic metrics; bare call = whole book (no model seat)
|
package/README.zh-CN.md
CHANGED
|
@@ -120,7 +120,11 @@ ak-role gatekeeper --model <provider/model[:thinking]> --attach ./submission.jso
|
|
|
120
120
|
# 游奕使——直调散文路线建议;随公开入口顶层腿自动出席
|
|
121
121
|
ak-role navigator --model <provider/model[:thinking]> "刚完成 coder apply 收敛,下一步?"
|
|
122
122
|
|
|
123
|
-
#
|
|
123
|
+
# 开庭前:自上次成录后陛下对本票有新话,调用者自行传召起居郎;无新话直接开庭或续跑
|
|
124
|
+
ak-role diarist --model <provider/model[:thinking]> "整理 #582 自上次成录以来的御话。"
|
|
125
|
+
# 多票庭只传召一次,指令列明全部票号,起居郎按票分别成录
|
|
126
|
+
ak-role diarist --model <provider/model[:thinking]> "整理 #582、#583 自上次成录以来的御话,分别成录。"
|
|
127
|
+
# 给事中——票庭五问;不自动传召起居郎;已有起居录先沿用录上票号,无录时自行认票并在交卷申报
|
|
124
128
|
ak-role countersign --model <provider/model[:thinking]> --attach ./ticket.md "裁:本票 #582 是否足以开工。"
|
|
125
129
|
|
|
126
130
|
# 中书省——按《票面法》改票,一次调用内处理给事中封驳并重送,直至署或上呈(#924)
|
|
@@ -151,14 +155,14 @@ ak-role --model <provider/model[:thinking]> resume <runId> "<裁定>"
|
|
|
151
155
|
| **审刑院** | judge-auditor/doctor-auditor(无 CLI,共享内部接缝;御史台侧闸已退役) | **复核成案。** 不重新争论事情本身,而是检查整个办理过程是否合乎规矩。关注是否有人越过职责、是否遗漏必要步骤、是否以错误方式得出正确结果。直属陛下,不入门下省编制。 |
|
|
152
156
|
| **门下省** | gatekeeper(交卷闸不再自动出席;可 `ak-role gatekeeper` 独立直调) | **审署诏敕与质量保证的省。** 交卷闸按受审物直接传召台院/符宝郎;中书省 converged 交卷经既有闸传召给事中(#1021);本省不介入选席。调用者仍可独立传召本省作 dispatch/pass;左拾遗由调用者合并前传召;省内政,不是外层编排器。规范见 [ADR 0067](docs/adr/0067-menxia-province-founding-jishizhong-fubaolang.md)、[ADR 0072](docs/adr/0072-menxia-pre-pr-submission-hooks.md)、[ADR 0074](docs/adr/0074-gate-province-reorg-jishizhong-chaiyuan-split.md)、[ADR 0079](docs/adr/0079-direct-officer-summons-ticket-memory-pointer-input.md)。 |
|
|
153
157
|
| **中书省** | secretariat(converged 交卷进入给事中交卷闸;#924、#1021) | **改票的出令省。** 按公用《票面法》把草稿修成可送庭文书;署(converged)交卷自动进入给事中审读,封驳后在同一中书省会话改写重交;对外终局只有署或上呈(escalate)。暂不细分席位。 |
|
|
154
|
-
| **给事中** | countersign(中书省 converged 交卷触发交卷闸;亦可独立调用) | **票庭审读五问。**
|
|
158
|
+
| **给事中** | countersign(中书省 converged 交卷触发交卷闸;亦可独立调用) | **票庭审读五问。** 制度符合/授权真实(以起居录为据)/文书符意/退回重议/发布资格;读码取证是本职,实现细节不上票面。开庭不自动起居郎;已有起居录先用录上票号,无录自行认票,交卷申报 `ticketNumber`;交卷闸出席符宝郎。署=放行开工,封驳=退票重议,上呈=陛下裁决。规范见 [ADR 0074](docs/adr/0074-gate-province-reorg-jishizhong-chaiyuan-split.md)、[ADR 0075](docs/adr/0075-ticket-provenance-diarist-pipeline.md)。 |
|
|
155
159
|
| **左拾遗** | gleaner-left(无交卷闸派发;合并前由调用者传召) | **合并前无锚定风闻。** 对全幅合并候选作冷眼评审;只上弹章、不封驳不裁决。规范见 [ADR 0067](docs/adr/0067-menxia-province-founding-jishizhong-fubaolang.md) 修正案。 |
|
|
156
160
|
| **台院** | inspector | **纠举推鞫:复杂度与测试质量两轴。** 受审物是将作监/修内司完成侧交卷;封驳=当场打回重写,不是本局失败。可被门下省派发,也可 `ak-role inspector` 单独调。原给事中,ADR 0074 分立;中文名由 #584 修订为台院,机器键不动。 |
|
|
157
161
|
| **符宝郎** | notary | **首责唯一:核实实际授权出处**(防乱编乱扩)。行事两步:读该票起居录→以录核旨;引语真伪与票面对齐为手段。受审物是大理寺拟判与给事中署章;可被门下省派发,也可 `ak-role notary` 单独调。规范见 [ADR 0075](docs/adr/0075-ticket-provenance-diarist-pipeline.md)。 |
|
|
158
162
|
| **通进司** | collector | **承接百议/收证。** 门下省下的收证衙门:收集外部 GitHub PR 材料与意见,只收不审、不替人裁决。canonical 键仍为 `collector`。 |
|
|
159
163
|
| **校书郎** | merger | **雠校异文。** 面对不同来源的修改,负责整理、校合与调和。保留双方有价值的部分,解决彼此冲突;无进行中合并、无活可干或遇到无法自行决定之处,则升级。 |
|
|
160
164
|
| **游奕使** | navigator(随公开入口顶层腿自动出席,亦可 `ak-role navigator` 直调) | **巡行问路。** 不掌具体事务,而是观察全局变化,结合当前局面提醒下一步方向。它提供建议与路径参考,但最终选择仍由执掌之人决定。 |
|
|
161
|
-
| **起居郎** | diarist(`ak-role diarist`
|
|
165
|
+
| **起居郎** | diarist(`ak-role diarist` 可单独传召;中书省立票前自动传召) | **修起居录。** 为本票搜集、整理决策依据,写进每票起居录;LLM 自行搜集、整理、认票(#779 后无机械验真,机械只做 IO;起居录供符宝郎读录核旨)。只记录已作出的决定,不立法、不批准设计、不指挥施工。规范见 [ADR 0075](docs/adr/0075-ticket-provenance-diarist-pipeline.md)(起居郎是 LLM 角色)、[ADR 0081](docs/adr/0081-diarist-case-context-and-delivery.md)。 |
|
|
162
166
|
|
|
163
167
|
其余席位:
|
|
164
168
|
|
|
@@ -1029,79 +1029,6 @@ var init_run_ticket_number = __esm({
|
|
|
1029
1029
|
});
|
|
1030
1030
|
|
|
1031
1031
|
// src/diarist-contracts.ts
|
|
1032
|
-
function projectCourtTicketNumbers(raw, options) {
|
|
1033
|
-
if (!Array.isArray(raw)) return null;
|
|
1034
|
-
const out = [];
|
|
1035
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1036
|
-
for (const item of raw) {
|
|
1037
|
-
if (!isSafePositiveTicketNumber(item)) continue;
|
|
1038
|
-
if (seen.has(item)) continue;
|
|
1039
|
-
seen.add(item);
|
|
1040
|
-
out.push(item);
|
|
1041
|
-
}
|
|
1042
|
-
const principal = options?.principalTicket;
|
|
1043
|
-
if (principal === void 0) return out;
|
|
1044
|
-
requireSafePositiveTicketNumber(principal, "projectCourtTicketNumbers principalTicket");
|
|
1045
|
-
if (seen.has(principal)) return out;
|
|
1046
|
-
return [principal, ...out];
|
|
1047
|
-
}
|
|
1048
|
-
function interpretDurableCourtTicketNumbers(record4, options) {
|
|
1049
|
-
if (!Object.hasOwn(record4, "courtTicketNumbers")) {
|
|
1050
|
-
return { kind: "absent" };
|
|
1051
|
-
}
|
|
1052
|
-
const raw = record4.courtTicketNumbers;
|
|
1053
|
-
if (!Array.isArray(raw)) {
|
|
1054
|
-
return {
|
|
1055
|
-
kind: "damage",
|
|
1056
|
-
reason: "courtTicketNumbers is present but not an array"
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
if (raw.length === 0) {
|
|
1060
|
-
return {
|
|
1061
|
-
kind: "damage",
|
|
1062
|
-
reason: "courtTicketNumbers is present but empty"
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
for (let i = 0; i < raw.length; i += 1) {
|
|
1066
|
-
const item = raw[i];
|
|
1067
|
-
if (!isSafePositiveTicketNumber(item)) {
|
|
1068
|
-
return {
|
|
1069
|
-
kind: "damage",
|
|
1070
|
-
reason: `courtTicketNumbers[${i}] is not a safe positive integer`
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
const tickets = projectCourtTicketNumbers(raw);
|
|
1075
|
-
if (tickets === null || tickets.length === 0) {
|
|
1076
|
-
return {
|
|
1077
|
-
kind: "damage",
|
|
1078
|
-
reason: "courtTicketNumbers projected empty after lawful members"
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1081
|
-
const principal = options?.principalTicket;
|
|
1082
|
-
if (principal !== void 0) {
|
|
1083
|
-
if (!isSafePositiveTicketNumber(principal)) {
|
|
1084
|
-
return {
|
|
1085
|
-
kind: "damage",
|
|
1086
|
-
reason: "courtTicketNumbers principal ticket is not a safe positive integer"
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
if (!tickets.includes(principal)) {
|
|
1090
|
-
return {
|
|
1091
|
-
kind: "damage",
|
|
1092
|
-
reason: `courtTicketNumbers is missing principal ticket #${principal}`
|
|
1093
|
-
};
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
return { kind: "ok", tickets: Object.freeze([...tickets]) };
|
|
1097
|
-
}
|
|
1098
|
-
function sameCourtTicketNumbers(left, right) {
|
|
1099
|
-
if (left.length !== right.length) return false;
|
|
1100
|
-
for (let i = 0; i < left.length; i += 1) {
|
|
1101
|
-
if (left[i] !== right[i]) return false;
|
|
1102
|
-
}
|
|
1103
|
-
return true;
|
|
1104
|
-
}
|
|
1105
1032
|
function projectDiaristSessions(value) {
|
|
1106
1033
|
const raw = value?.sessions;
|
|
1107
1034
|
if (raw === void 0) return [];
|
|
@@ -6419,43 +6346,6 @@ async function recordAdmittedCorrelation(admitted, correlationId) {
|
|
|
6419
6346
|
mutable.correlationId = correlationId;
|
|
6420
6347
|
mutable.correlationIds = correlationIds;
|
|
6421
6348
|
}
|
|
6422
|
-
async function bindCourtTicketNumbersOnAdmitted(admitted, courtTicketNumbers) {
|
|
6423
|
-
if (admitted.ticketNumber === void 0) {
|
|
6424
|
-
throw new Error(
|
|
6425
|
-
"bindCourtTicketNumbersOnAdmitted requires a bound principal ticketNumber"
|
|
6426
|
-
);
|
|
6427
|
-
}
|
|
6428
|
-
const principal = requireSafePositiveTicketNumber(
|
|
6429
|
-
admitted.ticketNumber,
|
|
6430
|
-
"bindCourtTicketNumbersOnAdmitted principal ticketNumber"
|
|
6431
|
-
);
|
|
6432
|
-
for (const item of courtTicketNumbers) {
|
|
6433
|
-
if (!isSafePositiveTicketNumber(item)) {
|
|
6434
|
-
throw new Error(
|
|
6435
|
-
`bindCourtTicketNumbersOnAdmitted requires safe positive integers, got ${String(item)}`
|
|
6436
|
-
);
|
|
6437
|
-
}
|
|
6438
|
-
}
|
|
6439
|
-
const projected = projectCourtTicketNumbers(courtTicketNumbers, {
|
|
6440
|
-
principalTicket: principal
|
|
6441
|
-
});
|
|
6442
|
-
if (projected === null || projected.length === 0) {
|
|
6443
|
-
throw new Error("bindCourtTicketNumbersOnAdmitted requires a non-empty ticket set");
|
|
6444
|
-
}
|
|
6445
|
-
const frozen = Object.freeze([...projected]);
|
|
6446
|
-
const admittedPath = admitted.admittedRequestPath;
|
|
6447
|
-
const current = JSON.parse(await readFile11(admittedPath, "utf8"));
|
|
6448
|
-
await writeFile3(
|
|
6449
|
-
admittedPath,
|
|
6450
|
-
`${JSON.stringify({ ...current, courtTicketNumbers: frozen }, null, 2)}
|
|
6451
|
-
`,
|
|
6452
|
-
"utf8"
|
|
6453
|
-
);
|
|
6454
|
-
await mergeInvocationIdentityPage(admitted.runDirectory, {
|
|
6455
|
-
courtTicketNumbers: frozen
|
|
6456
|
-
});
|
|
6457
|
-
admitted.courtTicketNumbers = frozen;
|
|
6458
|
-
}
|
|
6459
6349
|
async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
|
|
6460
6350
|
if (admitted.ticketNumber === void 0 || !admitted.runDirectory.includes(`${sep3}unbound${sep3}runs${sep3}`)) return void 0;
|
|
6461
6351
|
const oldRunDirectory = admitted.runDirectory;
|
|
@@ -7915,7 +7805,6 @@ var init_invocation = __esm({
|
|
|
7915
7805
|
init_run_ticket_number();
|
|
7916
7806
|
init_role_run_relocation();
|
|
7917
7807
|
init_doctor_evidence();
|
|
7918
|
-
init_diarist_contracts();
|
|
7919
7808
|
init_collector_config();
|
|
7920
7809
|
init_github_remote();
|
|
7921
7810
|
init_fixer_packet();
|
|
@@ -13094,9 +12983,6 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
13094
12983
|
io,
|
|
13095
12984
|
persistRunState
|
|
13096
12985
|
);
|
|
13097
|
-
if (error instanceof StationChildExhaustedError) {
|
|
13098
|
-
return { ...settled2, skipAutoResume: true, ...deferredPersist };
|
|
13099
|
-
}
|
|
13100
12986
|
return { ...settled2, ...deferredPersist };
|
|
13101
12987
|
}
|
|
13102
12988
|
}
|
|
@@ -13799,7 +13685,7 @@ async function runPostAdmissionManualResume(input) {
|
|
|
13799
13685
|
}
|
|
13800
13686
|
return result;
|
|
13801
13687
|
}
|
|
13802
|
-
var
|
|
13688
|
+
var POST_ADMISSION_CLEANUP_DIAGNOSTIC_ENTRY_TYPE;
|
|
13803
13689
|
var init_post_admission = __esm({
|
|
13804
13690
|
"src/public-cli/post-admission.ts"() {
|
|
13805
13691
|
"use strict";
|
|
@@ -13821,9 +13707,6 @@ var init_post_admission = __esm({
|
|
|
13821
13707
|
init_settlement();
|
|
13822
13708
|
init_terminal();
|
|
13823
13709
|
init_auto_resume();
|
|
13824
|
-
StationChildExhaustedError = class extends Error {
|
|
13825
|
-
name = "StationChildExhaustedError";
|
|
13826
|
-
};
|
|
13827
13710
|
POST_ADMISSION_CLEANUP_DIAGNOSTIC_ENTRY_TYPE = "ak_post_admission_cleanup_diagnostic";
|
|
13828
13711
|
}
|
|
13829
13712
|
});
|
|
@@ -14122,30 +14005,6 @@ function courtDiaristEscalateDiagnostic(roleOutcome, submissions) {
|
|
|
14122
14005
|
currentConclusion: escalatePayloads[escalatePayloads.length - 1]
|
|
14123
14006
|
})}`;
|
|
14124
14007
|
}
|
|
14125
|
-
function courtTicketNumbersFromOutcome(roleOutcome, principalTicket, submissions) {
|
|
14126
|
-
if (roleOutcome === void 0) return void 0;
|
|
14127
|
-
const payloads = courtDiaristPayloadRows(roleOutcome, submissions);
|
|
14128
|
-
let latest;
|
|
14129
|
-
for (const payload of payloads) {
|
|
14130
|
-
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
14131
|
-
continue;
|
|
14132
|
-
}
|
|
14133
|
-
const record4 = payload;
|
|
14134
|
-
if (!Object.hasOwn(record4, "courtTicketNumbers")) continue;
|
|
14135
|
-
const raw = record4.courtTicketNumbers;
|
|
14136
|
-
if (!Array.isArray(raw)) continue;
|
|
14137
|
-
const members = projectCourtTicketNumbers(raw);
|
|
14138
|
-
if (members === null) continue;
|
|
14139
|
-
if (members.length === 0) {
|
|
14140
|
-
if (raw.length === 0) {
|
|
14141
|
-
latest = projectCourtTicketNumbers([], { principalTicket }) ?? void 0;
|
|
14142
|
-
}
|
|
14143
|
-
continue;
|
|
14144
|
-
}
|
|
14145
|
-
latest = projectCourtTicketNumbers(raw, { principalTicket }) ?? void 0;
|
|
14146
|
-
}
|
|
14147
|
-
return latest;
|
|
14148
|
-
}
|
|
14149
14008
|
function latestPayloadEscalated(roleOutcome) {
|
|
14150
14009
|
if (roleOutcome === void 0) return false;
|
|
14151
14010
|
if (roleOutcome.kind === "audit_escalation") return true;
|
|
@@ -14185,7 +14044,6 @@ async function invokeCourtDiarist(input, env, io) {
|
|
|
14185
14044
|
...env.credentials === void 0 ? {} : { credentials: env.credentials },
|
|
14186
14045
|
...env.signal === void 0 ? {} : { signal: env.signal },
|
|
14187
14046
|
...input.correlationId === void 0 ? {} : { correlationId: input.correlationId },
|
|
14188
|
-
...input.boundTicketNumber === void 0 ? {} : { boundTicketNumber: input.boundTicketNumber },
|
|
14189
14047
|
// Child seat selects from the composition-root table. Do not pass the
|
|
14190
14048
|
// already-selected parent adapter (#840 / ADR 0082: --host 旗标>席位配置>缺省 pi).
|
|
14191
14049
|
...env.hostAdapters === void 0 ? {} : { hostAdapters: env.hostAdapters }
|
|
@@ -14212,78 +14070,15 @@ async function invokeCourtDiarist(input, env, io) {
|
|
|
14212
14070
|
}
|
|
14213
14071
|
};
|
|
14214
14072
|
}
|
|
14215
|
-
const asserted = result.admitted?.ticketNumber;
|
|
14216
|
-
if (isSafePositiveTicketNumber(asserted)) {
|
|
14217
|
-
const courtTicketNumbers = courtTicketNumbersFromOutcome(
|
|
14218
|
-
roleOutcome,
|
|
14219
|
-
asserted,
|
|
14220
|
-
submissions
|
|
14221
|
-
);
|
|
14222
|
-
return {
|
|
14223
|
-
identity: {
|
|
14224
|
-
kind: "ticket",
|
|
14225
|
-
ticketNumber: asserted,
|
|
14226
|
-
...courtTicketNumbers === void 0 ? {} : { courtTicketNumbers }
|
|
14227
|
-
},
|
|
14228
|
-
...result.admitted === void 0 ? {} : { admitted: result.admitted }
|
|
14229
|
-
};
|
|
14230
|
-
}
|
|
14231
14073
|
return {
|
|
14232
14074
|
identity: { kind: "unbound" },
|
|
14233
14075
|
...result.admitted === void 0 ? {} : { admitted: result.admitted }
|
|
14234
14076
|
};
|
|
14235
14077
|
}
|
|
14236
|
-
async function runCountersignCourtDiaristStation(admitted, env, io, afterTicketNumber) {
|
|
14237
|
-
if (env.runCourtDiaristStation !== void 0) {
|
|
14238
|
-
await env.runCourtDiaristStation(admitted);
|
|
14239
|
-
return;
|
|
14240
|
-
}
|
|
14241
|
-
if (admitted.ticketNumber === void 0) return;
|
|
14242
|
-
let refreshTickets;
|
|
14243
|
-
if (admitted.courtTicketNumbers !== void 0) {
|
|
14244
|
-
if (admitted.courtTicketNumbers.length === 0 || !admitted.courtTicketNumbers.includes(admitted.ticketNumber)) {
|
|
14245
|
-
throw new StationChildExhaustedError(
|
|
14246
|
-
`court diarist station: courtTicketNumbers is damaged (empty or missing principal #${admitted.ticketNumber})`
|
|
14247
|
-
);
|
|
14248
|
-
}
|
|
14249
|
-
refreshTickets = admitted.courtTicketNumbers;
|
|
14250
|
-
} else {
|
|
14251
|
-
refreshTickets = [admitted.ticketNumber];
|
|
14252
|
-
}
|
|
14253
|
-
const completedIndex = afterTicketNumber === void 0 ? -1 : refreshTickets.indexOf(afterTicketNumber);
|
|
14254
|
-
for (const ticketNumber of refreshTickets.slice(completedIndex + 1)) {
|
|
14255
|
-
const outcome = await invokeCourtDiarist(
|
|
14256
|
-
{
|
|
14257
|
-
instruction: admitted.instruction,
|
|
14258
|
-
projectRoot: admitted.projectRoot,
|
|
14259
|
-
failureLabel: `ticket #${ticketNumber}`,
|
|
14260
|
-
correlationId: admitted.runId,
|
|
14261
|
-
// Refresh holds a typed key — hand it off so identity is bound before turn.
|
|
14262
|
-
boundTicketNumber: ticketNumber
|
|
14263
|
-
},
|
|
14264
|
-
env,
|
|
14265
|
-
io
|
|
14266
|
-
);
|
|
14267
|
-
if (outcome.failedWithoutEscalate !== void 0) {
|
|
14268
|
-
throw new StationChildExhaustedError(
|
|
14269
|
-
outcome.failedWithoutEscalate.diagnostic
|
|
14270
|
-
);
|
|
14271
|
-
}
|
|
14272
|
-
if (outcome.identity.kind === "escalate" && outcome.terminal !== void 0) {
|
|
14273
|
-
return {
|
|
14274
|
-
terminal: outcome.terminal,
|
|
14275
|
-
...outcome.admitted === void 0 ? {} : { childRunId: outcome.admitted.runId }
|
|
14276
|
-
};
|
|
14277
|
-
}
|
|
14278
|
-
}
|
|
14279
|
-
}
|
|
14280
14078
|
var init_countersign_run = __esm({
|
|
14281
14079
|
"src/public-cli/countersign-run.ts"() {
|
|
14282
14080
|
"use strict";
|
|
14283
|
-
init_diarist_contracts();
|
|
14284
14081
|
init_readable_gate_item();
|
|
14285
|
-
init_run_ticket_number();
|
|
14286
|
-
init_post_admission();
|
|
14287
14082
|
}
|
|
14288
14083
|
});
|
|
14289
14084
|
|
|
@@ -14570,84 +14365,14 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
14570
14365
|
...ticketNumber === void 0 ? {} : { ticketNumber }
|
|
14571
14366
|
});
|
|
14572
14367
|
};
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
let childDiaristRunId;
|
|
14577
|
-
let pausedDiaristTerminal;
|
|
14578
|
-
if (gateParentRunPath === void 0 && env.runCourtDiaristStation === void 0) {
|
|
14579
|
-
let outcome;
|
|
14580
|
-
try {
|
|
14581
|
-
outcome = await invokeCourtDiarist({
|
|
14582
|
-
instruction: parsed.instruction ?? "",
|
|
14583
|
-
projectRoot: admitted.projectRoot,
|
|
14584
|
-
failureLabel: "unbound summons",
|
|
14585
|
-
correlationId: admitted.runId,
|
|
14586
|
-
...env.boundTicketNumber === void 0 ? {} : { boundTicketNumber: env.boundTicketNumber }
|
|
14587
|
-
}, env, io);
|
|
14588
|
-
} catch (error) {
|
|
14589
|
-
await materializeAdmission(
|
|
14590
|
-
isSafePositiveTicketNumber(env.boundTicketNumber) ? env.boundTicketNumber : void 0
|
|
14591
|
-
);
|
|
14592
|
-
await markRunAdmitted(admitted, env.principalAuthority);
|
|
14593
|
-
return await presentControlledFailure2(admitted, {
|
|
14594
|
-
timedOut: false,
|
|
14595
|
-
code: null,
|
|
14596
|
-
stderr: "",
|
|
14597
|
-
thrown: error
|
|
14598
|
-
}, seatAdapters(admitted, env), env.principalAuthority, io);
|
|
14599
|
-
}
|
|
14600
|
-
identityDiaristRan = true;
|
|
14601
|
-
if (outcome.identity.kind === "escalate") pausedDiaristTerminal = outcome.terminal;
|
|
14602
|
-
if (outcome.admitted?.runDirectory.includes(`${sep4}unbound${sep4}runs${sep4}`)) {
|
|
14603
|
-
childDiaristRunId = outcome.admitted.runId;
|
|
14604
|
-
}
|
|
14605
|
-
if (outcome.failedWithoutEscalate !== void 0) {
|
|
14606
|
-
const diagnostic = outcome.failedWithoutEscalate.diagnostic;
|
|
14607
|
-
await materializeAdmission(
|
|
14608
|
-
isSafePositiveTicketNumber(env.boundTicketNumber) ? env.boundTicketNumber : void 0
|
|
14609
|
-
);
|
|
14610
|
-
if (childDiaristRunId !== void 0) await recordChildDiaristRun(admitted, childDiaristRunId);
|
|
14611
|
-
await markRunAdmitted(admitted, env.principalAuthority);
|
|
14612
|
-
return await presentControlledFailure2(admitted, {
|
|
14613
|
-
timedOut: false,
|
|
14614
|
-
code: null,
|
|
14615
|
-
stderr: "",
|
|
14616
|
-
thrown: new Error(diagnostic)
|
|
14617
|
-
}, seatAdapters(admitted, env), env.principalAuthority, io);
|
|
14618
|
-
}
|
|
14619
|
-
if (outcome.identity.kind === "ticket") {
|
|
14620
|
-
typedTicket = outcome.identity.ticketNumber;
|
|
14621
|
-
typedCourtTicketNumbers = outcome.identity.courtTicketNumbers;
|
|
14622
|
-
}
|
|
14623
|
-
}
|
|
14624
|
-
await materializeAdmission(typedTicket);
|
|
14368
|
+
await materializeAdmission(
|
|
14369
|
+
isSafePositiveTicketNumber(env.boundTicketNumber) ? env.boundTicketNumber : void 0
|
|
14370
|
+
);
|
|
14625
14371
|
await markRunAdmitted(admitted, env.principalAuthority);
|
|
14626
|
-
if (childDiaristRunId !== void 0) {
|
|
14627
|
-
await recordChildDiaristRun(admitted, childDiaristRunId);
|
|
14628
|
-
}
|
|
14629
|
-
if (pausedDiaristTerminal !== void 0) {
|
|
14630
|
-
io.stdout(formatTerminalResult(pausedDiaristTerminal));
|
|
14631
|
-
return { exitCode: 0, admitted, terminal: pausedDiaristTerminal };
|
|
14632
|
-
}
|
|
14633
14372
|
if (gateParentRunPath !== void 0) {
|
|
14634
14373
|
await persistAdmittedSourceRunPath(admitted, gateParentRunPath);
|
|
14635
14374
|
admitted = { ...admitted, sourceRunPath: gateParentRunPath };
|
|
14636
14375
|
}
|
|
14637
|
-
if (identityDiaristRan && typedTicket !== void 0) {
|
|
14638
|
-
try {
|
|
14639
|
-
await bindAdmittedTicketNumber(admitted, typedTicket);
|
|
14640
|
-
await relocateAdmittedRunToTicket(admitted, env.principalAuthority);
|
|
14641
|
-
await bindCourtTicketNumbersOnAdmitted(admitted, typedCourtTicketNumbers ?? [typedTicket]);
|
|
14642
|
-
} catch (error) {
|
|
14643
|
-
return await presentControlledFailure2(admitted, {
|
|
14644
|
-
timedOut: false,
|
|
14645
|
-
code: null,
|
|
14646
|
-
stderr: "",
|
|
14647
|
-
thrown: error
|
|
14648
|
-
}, seatAdapters(admitted, env), env.principalAuthority, io);
|
|
14649
|
-
}
|
|
14650
|
-
}
|
|
14651
14376
|
const turnProjection = {
|
|
14652
14377
|
packageRoot: env.packageRoot,
|
|
14653
14378
|
home: env.home,
|
|
@@ -14677,13 +14402,6 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
14677
14402
|
...seatAdapters(admitted, env),
|
|
14678
14403
|
beforeDispatch: async (admittedSeat, lease) => {
|
|
14679
14404
|
if (!packagedAdmitsCountersign(admittedSeat.role)) return;
|
|
14680
|
-
if (!identityDiaristRan || typedTicket !== void 0) {
|
|
14681
|
-
const refresh = await runCountersignCourtDiaristStation(admittedSeat, env, io);
|
|
14682
|
-
if (refresh !== void 0) {
|
|
14683
|
-
io.stdout(formatTerminalResult(refresh.terminal));
|
|
14684
|
-
return refresh.terminal;
|
|
14685
|
-
}
|
|
14686
|
-
}
|
|
14687
14405
|
await relocateAdmittedRunToTicket(admittedSeat, env.principalAuthority, lease);
|
|
14688
14406
|
Object.assign(turnRequest, buildInstructionSeatTurnRequest(admittedSeat, turnProjection));
|
|
14689
14407
|
}
|
|
@@ -15015,13 +14733,6 @@ async function continueParentAfterChild(parentRunId, child, env, io) {
|
|
|
15015
14733
|
return runPublicInstructionSeatResume({ runId: parentRunId }, env, io);
|
|
15016
14734
|
}
|
|
15017
14735
|
const admitted = loaded.admitted;
|
|
15018
|
-
if (admitted.role === "countersign" && admitted.ticketNumber !== void 0 && child.role === "diarist") {
|
|
15019
|
-
const refresh = await runCountersignCourtDiaristStation(admitted, env, io, child.ticketNumber);
|
|
15020
|
-
if (refresh !== void 0) {
|
|
15021
|
-
io.stdout(formatTerminalResult(refresh.terminal));
|
|
15022
|
-
return { exitCode: 0, admitted, terminal: refresh.terminal };
|
|
15023
|
-
}
|
|
15024
|
-
}
|
|
15025
14736
|
const resolved = await queueConclusionFromChild(child, env, io);
|
|
15026
14737
|
if (resolved !== void 0 && "stop" in resolved) return resolved.stop;
|
|
15027
14738
|
if (resolved !== void 0 && resolved.status === "escalate") {
|
|
@@ -18588,8 +18299,8 @@ async function summonPublicRole(options) {
|
|
|
18588
18299
|
// Nested court stations keep station-child semantics; dual-lens
|
|
18589
18300
|
// ordinary Reviewer axes opt out (#946 / ADR 0082).
|
|
18590
18301
|
...options.stationChild === false ? {} : { stationChild: true },
|
|
18591
|
-
// Forward composition-root adapters so nested
|
|
18592
|
-
//
|
|
18302
|
+
// Forward composition-root adapters so nested stations (e.g.
|
|
18303
|
+
// secretariat → diarist) select the same faux/production table (#924).
|
|
18593
18304
|
...options.hostAdapters === void 0 ? {} : { hostAdapters: options.hostAdapters },
|
|
18594
18305
|
...config.autoResumeLimit === void 0 ? {} : { autoResumeLimit: config.autoResumeLimit },
|
|
18595
18306
|
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
@@ -18873,10 +18584,10 @@ async function summonGateOfficer(options) {
|
|
|
18873
18584
|
);
|
|
18874
18585
|
}
|
|
18875
18586
|
const correlationId = parentRunId;
|
|
18876
|
-
const { isSafePositiveTicketNumber:
|
|
18587
|
+
const { isSafePositiveTicketNumber: isSafePositiveTicketNumber3, readBoardTicketNumber: readBoardTicketNumber2 } = await Promise.resolve().then(() => (init_run_ticket_number(), run_ticket_number_exports));
|
|
18877
18588
|
const parentTicket = await readBoardTicketNumber2(options.sourceRunDirectory);
|
|
18878
18589
|
const submittedTicket = options.submission !== null && typeof options.submission === "object" && !Array.isArray(options.submission) ? options.submission.ticketNumber : void 0;
|
|
18879
|
-
const courtTicket =
|
|
18590
|
+
const courtTicket = isSafePositiveTicketNumber3(submittedTicket) ? submittedTicket : parentTicket;
|
|
18880
18591
|
const instruction = options.reask ?? gateReviewInstruction ?? "";
|
|
18881
18592
|
return summonPublicRole({
|
|
18882
18593
|
role: options.officer,
|
|
@@ -19768,52 +19479,10 @@ function parsePersistedTicketIdentity(record4) {
|
|
|
19768
19479
|
...ticketNumber === void 0 ? {} : { ticketNumber }
|
|
19769
19480
|
};
|
|
19770
19481
|
}
|
|
19771
|
-
function readDurableCourtTicketNumbersPage(record4, principalTicket, pageLabel) {
|
|
19772
|
-
const interpreted = interpretDurableCourtTicketNumbers(record4, {
|
|
19773
|
-
...principalTicket === void 0 ? {} : { principalTicket }
|
|
19774
|
-
});
|
|
19775
|
-
if (interpreted.kind === "damage") {
|
|
19776
|
-
return {
|
|
19777
|
-
kind: "damage",
|
|
19778
|
-
reason: `role run ${pageLabel} courtTicketNumbers is damaged: ${interpreted.reason}`
|
|
19779
|
-
};
|
|
19780
|
-
}
|
|
19781
|
-
if (interpreted.kind === "ok") {
|
|
19782
|
-
return { kind: "ok", tickets: interpreted.tickets };
|
|
19783
|
-
}
|
|
19784
|
-
return { kind: "absent" };
|
|
19785
|
-
}
|
|
19786
|
-
function mergeDurableCourtTicketNumbers(input) {
|
|
19787
|
-
const fromAdmitted = input.admittedRecord === void 0 ? { kind: "absent" } : readDurableCourtTicketNumbersPage(
|
|
19788
|
-
input.admittedRecord,
|
|
19789
|
-
input.principalTicket,
|
|
19790
|
-
"admitted-request"
|
|
19791
|
-
);
|
|
19792
|
-
const fromInvocation = input.invocationRecord === void 0 ? { kind: "absent" } : readDurableCourtTicketNumbersPage(
|
|
19793
|
-
input.invocationRecord,
|
|
19794
|
-
input.principalTicket,
|
|
19795
|
-
"invocation"
|
|
19796
|
-
);
|
|
19797
|
-
if (fromAdmitted.kind === "damage") return fromAdmitted;
|
|
19798
|
-
if (fromInvocation.kind === "damage") return fromInvocation;
|
|
19799
|
-
if (fromAdmitted.kind === "ok" && fromInvocation.kind === "ok") {
|
|
19800
|
-
if (!sameCourtTicketNumbers(fromAdmitted.tickets, fromInvocation.tickets)) {
|
|
19801
|
-
return {
|
|
19802
|
-
kind: "damage",
|
|
19803
|
-
reason: "role run courtTicketNumbers differs between admitted-request and invocation"
|
|
19804
|
-
};
|
|
19805
|
-
}
|
|
19806
|
-
return { kind: "ok", tickets: fromAdmitted.tickets };
|
|
19807
|
-
}
|
|
19808
|
-
if (fromAdmitted.kind === "ok") return { kind: "ok", tickets: fromAdmitted.tickets };
|
|
19809
|
-
if (fromInvocation.kind === "ok") return { kind: "ok", tickets: fromInvocation.tickets };
|
|
19810
|
-
return { kind: "ok" };
|
|
19811
|
-
}
|
|
19812
19482
|
function restoredTicketFields(fields) {
|
|
19813
19483
|
return {
|
|
19814
19484
|
...fields.correlationId === void 0 ? {} : { correlationId: fields.correlationId },
|
|
19815
|
-
...fields.ticketNumber === void 0 ? {} : { ticketNumber: fields.ticketNumber }
|
|
19816
|
-
...fields.courtTicketNumbers === void 0 ? {} : { courtTicketNumbers: fields.courtTicketNumbers }
|
|
19485
|
+
...fields.ticketNumber === void 0 ? {} : { ticketNumber: fields.ticketNumber }
|
|
19817
19486
|
};
|
|
19818
19487
|
}
|
|
19819
19488
|
async function loadResumableRunRecord(home, runId, authority) {
|
|
@@ -19845,10 +19514,6 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19845
19514
|
let derived;
|
|
19846
19515
|
let correlationId;
|
|
19847
19516
|
let ticketNumber;
|
|
19848
|
-
let courtTicketNumbers;
|
|
19849
|
-
let courtTicketNumbersDamage;
|
|
19850
|
-
let admittedIdentityRecord;
|
|
19851
|
-
let invocationIdentityRecord;
|
|
19852
19517
|
let prNumber;
|
|
19853
19518
|
let repository;
|
|
19854
19519
|
let repositoryDisplay;
|
|
@@ -19970,7 +19635,6 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19970
19635
|
};
|
|
19971
19636
|
}
|
|
19972
19637
|
}
|
|
19973
|
-
admittedIdentityRecord = record4;
|
|
19974
19638
|
const fromAdmitted = parsePersistedTicketIdentity(record4);
|
|
19975
19639
|
correlationId = fromAdmitted.correlationId;
|
|
19976
19640
|
ticketNumber = fromAdmitted.ticketNumber;
|
|
@@ -19989,7 +19653,6 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19989
19653
|
);
|
|
19990
19654
|
if (invocationRaw !== null && typeof invocationRaw === "object" && !Array.isArray(invocationRaw)) {
|
|
19991
19655
|
const rec = invocationRaw;
|
|
19992
|
-
invocationIdentityRecord = rec;
|
|
19993
19656
|
if (typeof rec.provider === "string" && typeof rec.model === "string") {
|
|
19994
19657
|
model = {
|
|
19995
19658
|
provider: rec.provider,
|
|
@@ -20014,16 +19677,6 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
20014
19677
|
);
|
|
20015
19678
|
}
|
|
20016
19679
|
}
|
|
20017
|
-
const mergedSet = mergeDurableCourtTicketNumbers({
|
|
20018
|
-
admittedRecord: admittedIdentityRecord,
|
|
20019
|
-
invocationRecord: invocationIdentityRecord,
|
|
20020
|
-
principalTicket: ticketNumber
|
|
20021
|
-
});
|
|
20022
|
-
if (mergedSet.kind === "damage") {
|
|
20023
|
-
courtTicketNumbersDamage = mergedSet.reason;
|
|
20024
|
-
} else if (mergedSet.tickets !== void 0) {
|
|
20025
|
-
courtTicketNumbers = mergedSet.tickets;
|
|
20026
|
-
}
|
|
20027
19680
|
const sourceRunLeaf = basename9(sourceRunPath ?? "").split("@");
|
|
20028
19681
|
const referencedRunId = sourceRun?.runId ?? sourceRunLeaf[0];
|
|
20029
19682
|
const referencedRole = sourceRun?.role ?? sourceRunLeaf[1];
|
|
@@ -20061,8 +19714,6 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
20061
19714
|
...derived === void 0 ? {} : { derived },
|
|
20062
19715
|
...correlationId === void 0 ? {} : { correlationId },
|
|
20063
19716
|
...ticketNumber === void 0 ? {} : { ticketNumber },
|
|
20064
|
-
...courtTicketNumbers === void 0 ? {} : { courtTicketNumbers },
|
|
20065
|
-
...courtTicketNumbersDamage === void 0 ? {} : { courtTicketNumbersDamage },
|
|
20066
19717
|
...prNumber === void 0 ? {} : { prNumber },
|
|
20067
19718
|
...repository === void 0 ? {} : { repository },
|
|
20068
19719
|
...repositoryDisplay === void 0 ? {} : { repositoryDisplay },
|
|
@@ -20137,9 +19788,7 @@ function admitResumedRole(loaded) {
|
|
|
20137
19788
|
case "court-materials": {
|
|
20138
19789
|
const admitted = {
|
|
20139
19790
|
role: "countersign",
|
|
20140
|
-
...base
|
|
20141
|
-
...base.courtTicketNumbers === void 0 ? {} : { courtTicketNumbers: base.courtTicketNumbers },
|
|
20142
|
-
...fields.courtTicketNumbersDamage === void 0 ? {} : { courtTicketNumbersDamage: fields.courtTicketNumbersDamage }
|
|
19791
|
+
...base
|
|
20143
19792
|
};
|
|
20144
19793
|
return admitted;
|
|
20145
19794
|
}
|
|
@@ -20346,7 +19995,6 @@ var init_run_lifecycle = __esm({
|
|
|
20346
19995
|
init_typed_provider_http();
|
|
20347
19996
|
init_typed_provider_http();
|
|
20348
19997
|
init_collector_config();
|
|
20349
|
-
init_diarist_contracts();
|
|
20350
19998
|
init_role_run_relocation();
|
|
20351
19999
|
init_engine_material();
|
|
20352
20000
|
init_packaged_role_registry();
|
|
@@ -21928,11 +21576,6 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
|
21928
21576
|
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"
|
|
21929
21577
|
})
|
|
21930
21578
|
),
|
|
21931
|
-
courtTicketNumbers: Type16.Optional(
|
|
21932
|
-
Type16.Unknown({
|
|
21933
|
-
description: "#871 \u672C\u6B21\u5408\u5BA1\u5E94\u5404\u81EA\u6210\u5F55\u7684\u7968\u53F7\u96C6\u5408\uFF08\u6B63\u6574\u6570\u6570\u7EC4\uFF0C\u542B\u4E3B\u7968\uFF09\uFF1B\u5355\u7968\u53EF\u7701\u7565\u3002\u673A\u68B0\u5C42\u53EA\u505A\u7C7B\u578B/\u53BB\u91CD\u6295\u5F71\uFF0C\u4E0D\u4ECE\u6563\u6587\u731C\u7968\u3002"
|
|
21934
|
-
})
|
|
21935
|
-
),
|
|
21936
21579
|
reason: Type16.Optional(
|
|
21937
21580
|
Type16.String({
|
|
21938
21581
|
description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
|