dsh-kingdom 2.0.0 → 3.2.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/ASSETS_NOTICE.md +22 -22
- package/README.md +246 -243
- package/THIRD_PARTY_NOTICES.md +92 -92
- package/docs/DSH-KINGDOM-3.0-ANNOUNCEMENT.md +13 -0
- package/docs/V2.0-RELEASE-NOTES.md +30 -30
- package/docs/V2.0-USER-GUIDE.md +74 -74
- package/docs/V3.0-RELEASE-NOTES.md +21 -0
- package/docs/V3.0-USER-GUIDE.md +33 -0
- package/docs/V3.1-RELEASE-NOTES.md +76 -0
- package/docs/V3.2-RELEASE-NOTES.md +103 -0
- package/lib/core/binding.js +167 -60
- package/lib/core/binding.js.map +1 -1
- package/lib/core/db.js +582 -546
- package/lib/core/db.js.map +1 -1
- package/lib/core/delivery-ack.js +1356 -0
- package/lib/core/delivery-ack.js.map +1 -0
- package/lib/core/delivery-change.js +1237 -0
- package/lib/core/delivery-change.js.map +1 -0
- package/lib/core/owner-binding-intent.js +14 -25
- package/lib/core/owner-binding-intent.js.map +1 -1
- package/lib/core/owner-window.js +698 -23
- package/lib/core/owner-window.js.map +1 -1
- package/lib/core/task-service.js +144 -5
- package/lib/core/task-service.js.map +1 -1
- package/lib/core/territory.js +43 -9
- package/lib/core/territory.js.map +1 -1
- package/lib/gui/assets/characters/chancellor-idle.svg +67 -67
- package/lib/gui/assets/characters/chancellor-sleeping.svg +67 -67
- package/lib/gui/assets/characters/chancellor-thinking.svg +67 -67
- package/lib/gui/assets/characters/chancellor-working.svg +67 -67
- package/lib/gui/assets/characters/knight-redraw-r1-idle.svg +67 -67
- package/lib/gui/assets/characters/knight-redraw-r1-sleeping.svg +67 -67
- package/lib/gui/assets/characters/knight-redraw-r1-thinking.svg +67 -67
- package/lib/gui/assets/characters/knight-redraw-r1-working.svg +67 -67
- package/lib/gui/assets/characters/supervisor-idle.svg +67 -67
- package/lib/gui/assets/characters/supervisor-sleeping.svg +67 -67
- package/lib/gui/assets/characters/supervisor-thinking.svg +67 -67
- package/lib/gui/assets/characters/supervisor-working.svg +67 -67
- package/lib/gui/console-app.js +7 -1
- package/lib/gui/console-app.js.map +1 -1
- package/lib/gui/contract.js +6 -0
- package/lib/gui/contract.js.map +1 -1
- package/lib/gui/control-contract.js +3 -2
- package/lib/gui/control-contract.js.map +1 -1
- package/lib/gui/owner-control.js +114 -4
- package/lib/gui/owner-control.js.map +1 -1
- package/lib/gui/owner-ui.js +645 -183
- package/lib/gui/owner-ui.js.map +1 -1
- package/lib/gui/server.js +109 -109
- package/lib/gui/snapshot.js +127 -4
- package/lib/gui/snapshot.js.map +1 -1
- package/lib/gui/visual-assets.js +37 -21
- package/lib/gui/visual-assets.js.map +1 -1
- package/lib/gui/visual-system.js +269 -269
- package/lib/gui/workbench-ui.js +549 -136
- package/lib/gui/workbench-ui.js.map +1 -1
- package/lib/gui/workbench.js +133 -0
- package/lib/gui/workbench.js.map +1 -1
- package/lib/index.js +392 -40
- package/lib/index.js.map +1 -1
- package/lib/types/core/binding.d.ts +29 -0
- package/lib/types/core/db.d.ts +14 -0
- package/lib/types/core/delivery-ack.d.ts +688 -0
- package/lib/types/core/delivery-change.d.ts +381 -0
- package/lib/types/core/owner-binding-intent.d.ts +9 -1
- package/lib/types/core/owner-window.d.ts +237 -3
- package/lib/types/core/task-service.d.ts +22 -0
- package/lib/types/core/territory.d.ts +18 -3
- package/lib/types/gui/contract.d.ts +162 -1
- package/lib/types/gui/owner-control.d.ts +61 -1
- package/lib/types/gui/snapshot.d.ts +8 -0
- package/lib/types/gui/visual-assets.d.ts +16 -0
- package/lib/types/gui/workbench.d.ts +47 -1
- package/lib/types/index.d.ts +60 -1
- package/lib/types/worker/governed-executor.d.ts +15 -0
- package/lib/worker/governed-executor.js +21 -0
- package/lib/worker/governed-executor.js.map +1 -1
- package/package.json +80 -75
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import type { EventRow, KingdomStore } from './db.js';
|
|
2
|
+
import { CHANGE_EVIDENCE_LABEL, CHANGE_EVIDENCE_NOTE } from './delivery-ack.js';
|
|
3
|
+
export { CHANGE_EVIDENCE_LABEL, CHANGE_EVIDENCE_NOTE };
|
|
4
|
+
export declare const DELIVERY_CHANGE_SNAPSHOT_EVENT_TYPE = "DELIVERY_CHANGE_SNAPSHOT";
|
|
5
|
+
export declare const DELIVERY_CHANGE_MANIFEST_VERSION = "KingdomDeliveryChangeManifest/v1";
|
|
6
|
+
export declare const DELIVERY_CHANGE_SNAPSHOT_VERSION = "KingdomDeliveryWorkspaceSnapshot/v1";
|
|
7
|
+
export declare const CHANGE_EVIDENCE_DRIFT = "\u8BC1\u636E\u6B63\u6587\u7F3A\u5931\u6216\u54C8\u5E0C\u6F02\u79FB\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u53EF\u4FE1\u6539\u52A8\u5B9A\u4F4D\u3002";
|
|
8
|
+
/** 采集与分析的有界上限;任何一项被触发都会如实反映为部分覆盖。 */
|
|
9
|
+
export interface DeliveryChangeBounds {
|
|
10
|
+
maxFiles: number;
|
|
11
|
+
maxFileBytes: number;
|
|
12
|
+
/**
|
|
13
|
+
* 单个文件的**完整内容 hash**上限;超过即无法完整比较,只能如实记 `UNKNOWN`,
|
|
14
|
+
* 不得用「真实大小 + 有界首段」的前缀摘要冒充完整内容 hash。
|
|
15
|
+
*/
|
|
16
|
+
maxHashBytes: number;
|
|
17
|
+
/** 单次采集允许读取的总字节数;超出后不再读取,未比较的文件必须如实计入部分覆盖。 */
|
|
18
|
+
maxReadBytes: number;
|
|
19
|
+
maxStoredBytes: number;
|
|
20
|
+
maxDiffLines: number;
|
|
21
|
+
maxEntries: number;
|
|
22
|
+
/** Git 候选枚举的字节上限;超出即视为无法安全枚举,如实报失败而不是截断成「无改动」。 */
|
|
23
|
+
maxCandidateBytes: number;
|
|
24
|
+
/** VCS 忽略样本的字节上限;只用于报告有多少内容被 ignore 规则排除,不读取其正文。 */
|
|
25
|
+
maxIgnoredBytes: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const DEFAULT_DELIVERY_CHANGE_BOUNDS: DeliveryChangeBounds;
|
|
28
|
+
export type DeliveryChangePhase = 'PRE' | 'POST';
|
|
29
|
+
/**
|
|
30
|
+
* `UNKNOWN` 只用于「无法证明是否变化」的候选:内容过长/不可读/是符号链接导致
|
|
31
|
+
* 比较不可靠。它**不是**可由主管确认的改动条目,选择它会被拒绝。
|
|
32
|
+
*/
|
|
33
|
+
export type DeliveryChangeStatus = 'ADDED' | 'MODIFIED' | 'DELETED' | 'UNKNOWN';
|
|
34
|
+
export type DeliveryChangeEvidenceKind = 'SUPERVISOR_CONFIRMED_BOUNDED_WINDOW';
|
|
35
|
+
export interface DeliverySnapshotCoverage {
|
|
36
|
+
complete: boolean;
|
|
37
|
+
observedFiles: number;
|
|
38
|
+
retainedFiles: number;
|
|
39
|
+
/** 因上限被跳过的条目数下界;达到文件或读取预算上限后不再继续读取。 */
|
|
40
|
+
omittedByLimit: number;
|
|
41
|
+
/** 采集时无法读取、因此无法证明是否变化的候选数。 */
|
|
42
|
+
omittedUnreadable: number;
|
|
43
|
+
skippedSymlinks: number;
|
|
44
|
+
skippedOversize: number;
|
|
45
|
+
binaryFiles: number;
|
|
46
|
+
/** 检测到 PEM 私钥/证书标记、因而**不保留正文**的候选数(只保留摘要)。 */
|
|
47
|
+
sensitiveBodiesSkipped: number;
|
|
48
|
+
/**
|
|
49
|
+
* 被 VCS ignore 规则排除、因而从未成为候选的路径数(只计数与保留路径名样本)。
|
|
50
|
+
*
|
|
51
|
+
* 这是**有意**的范围限定:候选集合本身完整、只是不含被忽略内容,所以它只让
|
|
52
|
+
* `complete=false`,**不**使未忽略路径的「不在快照里 = 当时不存在」失效。
|
|
53
|
+
*/
|
|
54
|
+
ignoredPaths: number;
|
|
55
|
+
/** 证据目录位于工作区内时被有意排除的路径数(避免把自身快照算成改动),同理不推断枚举被截断。 */
|
|
56
|
+
evidenceRootExcluded: number;
|
|
57
|
+
reasons: string[];
|
|
58
|
+
/** 被 VCS ignore 规则排除的路径名样本;只保留路径,不含正文。 */
|
|
59
|
+
ignoredSamples: string[];
|
|
60
|
+
}
|
|
61
|
+
export type DeliveryFileReadability = 'READABLE' | 'ABSENT' | 'UNREADABLE' | 'SYMLINK';
|
|
62
|
+
export interface DeliveryWorkspaceFileObservation {
|
|
63
|
+
/** 工作区内采集用的规范化相对路径;仅用于本地读取与条目身份,不直接作为公开展示路径。 */
|
|
64
|
+
path: string;
|
|
65
|
+
/** 仓库相对路径;Owner 展示、主管候选与「查看改动」一律使用这一路径。 */
|
|
66
|
+
repoPath: string | null;
|
|
67
|
+
size: number;
|
|
68
|
+
binary: boolean;
|
|
69
|
+
symlink: boolean;
|
|
70
|
+
oversize: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* 是否命中 PEM 私钥/证书标记、因而**不保留正文**。两侧任一为 `true` 时差异条目
|
|
73
|
+
* 都不展示正文片段:否则未命中一侧的历史正文会把另一侧的主体带进公开视图。
|
|
74
|
+
*/
|
|
75
|
+
sensitive: boolean;
|
|
76
|
+
/** 是否把脱敏后的正文写入了内容寻址 blob(两侧都保留,便于展示增删片段)。 */
|
|
77
|
+
retained: boolean;
|
|
78
|
+
/** 完整内容摘要;无法完整读取(超限/部分读取)时为 null,绝不退化成前缀摘要。 */
|
|
79
|
+
rawHash: string | null;
|
|
80
|
+
storedHash: string | null;
|
|
81
|
+
/** 采集时刻该路径的 `git status --porcelain` 代码;无 VCS 时为 null。 */
|
|
82
|
+
vcs: string | null;
|
|
83
|
+
/** 本次采集对该路径的实际可读性判定;决定差异能否被证明。 */
|
|
84
|
+
readability: DeliveryFileReadability;
|
|
85
|
+
}
|
|
86
|
+
export interface DeliveryRepoIdentity {
|
|
87
|
+
vcs: 'GIT' | 'UNAVAILABLE';
|
|
88
|
+
/** 仓库身份的不可逆摘要,避免证据里出现本机绝对路径。 */
|
|
89
|
+
identity: string | null;
|
|
90
|
+
head: string | null;
|
|
91
|
+
scope: 'REPO_ROOT' | 'WORKSPACE_SUBDIR' | 'OUTSIDE_REPO' | 'UNKNOWN';
|
|
92
|
+
reason: string | null;
|
|
93
|
+
}
|
|
94
|
+
export interface DeliveryWorkspaceSnapshot {
|
|
95
|
+
version: typeof DELIVERY_CHANGE_SNAPSHOT_VERSION;
|
|
96
|
+
snapshotId: string;
|
|
97
|
+
phase: DeliveryChangePhase;
|
|
98
|
+
taskId: string;
|
|
99
|
+
attemptNo: number;
|
|
100
|
+
territoryId: string;
|
|
101
|
+
workspaceKey: string;
|
|
102
|
+
executionId: string | null;
|
|
103
|
+
leaseId: string | null;
|
|
104
|
+
dispatchId: string | null;
|
|
105
|
+
repo: DeliveryRepoIdentity;
|
|
106
|
+
capturedAt: string;
|
|
107
|
+
files: DeliveryWorkspaceFileObservation[];
|
|
108
|
+
coverage: DeliverySnapshotCoverage;
|
|
109
|
+
/** 候选枚举本身的有界元数据(不含正文):便于区分「无改动」与「没能枚举完整」。 */
|
|
110
|
+
candidateScope: {
|
|
111
|
+
kind: 'VCS_CANDIDATES';
|
|
112
|
+
candidateCount: number;
|
|
113
|
+
pathspec: string;
|
|
114
|
+
evidencePrefix: string | null;
|
|
115
|
+
evidenceRootExcluded: number;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* 该时刻的候选集合是否**完整可信**:本快照里「没有该路径」是否可以当成「它当时不存在」。
|
|
119
|
+
*
|
|
120
|
+
* 只有下列条件同时成立才为 `true`:候选枚举未被文件/读取预算截断,也没有读不出来的候选。
|
|
121
|
+
*
|
|
122
|
+
* `.gitignore` 排除的内容与证据目录自身是**有意**待在候选集合之外的范围限定:候选
|
|
123
|
+
* 枚举本身是完整的,因此它们只如实记为部分覆盖(`coverage.reasons`),**不**推断
|
|
124
|
+
* 「未忽略路径的存在性不可证明」。把有意排除当成枚举截断会让真实新增无法确认。
|
|
125
|
+
*/
|
|
126
|
+
enumerationComplete: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* 被 ignore 规则排除的路径身份(工作区相对);只含路径名,不含任何正文。
|
|
129
|
+
*
|
|
130
|
+
* 增删判定不只看「该路径在不在快照里」,还要看它是否出现在**另一时点**的这份身份
|
|
131
|
+
* 集合中:只改忽略规则时,内容未变的旧文件会离开或进入候选集合,那个缺项其实是被
|
|
132
|
+
* ignore,既不是窗口内新增也不是窗口内删除。
|
|
133
|
+
*/
|
|
134
|
+
ignoredPathIdentities: string[];
|
|
135
|
+
/**
|
|
136
|
+
* 上述身份集合是否完整可信(枚举未被字节上限截断)。
|
|
137
|
+
*
|
|
138
|
+
* `false` 时不得把「路径不在集合里」当成「它当时未被忽略」:增删判定必须 fail-closed,
|
|
139
|
+
* 否则无法排除「另一个时点其实被 ignore」这一可能。
|
|
140
|
+
*/
|
|
141
|
+
ignoredPathsComplete: boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface DeliveryChangeHunk {
|
|
144
|
+
kind: 'ADDED' | 'REMOVED';
|
|
145
|
+
beforeLine: number | null;
|
|
146
|
+
afterLine: number | null;
|
|
147
|
+
text: string;
|
|
148
|
+
}
|
|
149
|
+
export interface DeliveryChangeEntry {
|
|
150
|
+
entryId: string;
|
|
151
|
+
/** 工作区相对路径;本地读取与身份用,不作为公开展示路径。 */
|
|
152
|
+
path: string;
|
|
153
|
+
/** 仓库相对路径(Owner 详情、主管候选与工作台固定展示这一条)。 */
|
|
154
|
+
repoPath: string;
|
|
155
|
+
status: DeliveryChangeStatus;
|
|
156
|
+
reasonCode: string;
|
|
157
|
+
labels: string[];
|
|
158
|
+
note: string;
|
|
159
|
+
binary: boolean;
|
|
160
|
+
bodyRetained: boolean;
|
|
161
|
+
beforeHash: string | null;
|
|
162
|
+
afterHash: string | null;
|
|
163
|
+
/** 基线正文未保留(预算/二进制/超限)时无法展示删除片段。 */
|
|
164
|
+
baselineBodyUnavailable: boolean;
|
|
165
|
+
hunks: DeliveryChangeHunk[];
|
|
166
|
+
}
|
|
167
|
+
export interface DeliveryChangeManifest {
|
|
168
|
+
version: typeof DELIVERY_CHANGE_MANIFEST_VERSION;
|
|
169
|
+
evidenceId: string;
|
|
170
|
+
taskId: string;
|
|
171
|
+
attemptNo: number;
|
|
172
|
+
territoryId: string;
|
|
173
|
+
workspaceKey: string;
|
|
174
|
+
repo: DeliveryRepoIdentity;
|
|
175
|
+
executionId: string | null;
|
|
176
|
+
leaseId: string | null;
|
|
177
|
+
dispatchId: string | null;
|
|
178
|
+
pre: {
|
|
179
|
+
snapshotId: string;
|
|
180
|
+
capturedAt: string;
|
|
181
|
+
coverage: DeliverySnapshotCoverage;
|
|
182
|
+
};
|
|
183
|
+
post: {
|
|
184
|
+
snapshotId: string;
|
|
185
|
+
capturedAt: string;
|
|
186
|
+
coverage: DeliverySnapshotCoverage;
|
|
187
|
+
};
|
|
188
|
+
entries: DeliveryChangeEntry[];
|
|
189
|
+
coverage: {
|
|
190
|
+
complete: boolean;
|
|
191
|
+
reasons: string[];
|
|
192
|
+
entryCount: number;
|
|
193
|
+
omitted: number;
|
|
194
|
+
};
|
|
195
|
+
note: string;
|
|
196
|
+
createdAt: string;
|
|
197
|
+
}
|
|
198
|
+
/** 主管 ACCEPT 时显式选中的改动引用(写入 TASK_ACCEPTED payload)。 */
|
|
199
|
+
export interface DeliveryChangeEvidenceRef {
|
|
200
|
+
kind: DeliveryChangeEvidenceKind;
|
|
201
|
+
evidenceId: string;
|
|
202
|
+
attemptNo: number;
|
|
203
|
+
entryIds: string[];
|
|
204
|
+
selectionDigest: string;
|
|
205
|
+
entryCount: number;
|
|
206
|
+
selectedCount: number;
|
|
207
|
+
coverageComplete: boolean;
|
|
208
|
+
coverageReasons: string[];
|
|
209
|
+
repoHead: string | null;
|
|
210
|
+
note: string;
|
|
211
|
+
}
|
|
212
|
+
export interface DeliveryEvidencePaths {
|
|
213
|
+
root: string;
|
|
214
|
+
snapshots: string;
|
|
215
|
+
blobs: string;
|
|
216
|
+
manifests: string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* 交付改动证据的专用本机持久目录:<dshHome>/kingdom/delivery-evidence。
|
|
220
|
+
*
|
|
221
|
+
* 只保存有界、脱敏、内容寻址的快照与差异;不接触 kingdom.db 本身。
|
|
222
|
+
* `DSH_KINGDOM_EVIDENCE_ROOT` 只用于把测试指向一次性临时目录。
|
|
223
|
+
*/
|
|
224
|
+
export declare function deliveryEvidenceRoot(): string;
|
|
225
|
+
export declare function deliveryEvidencePaths(evidenceRoot?: string): DeliveryEvidencePaths;
|
|
226
|
+
export declare function readChangeBlob(evidenceRoot: string | undefined, storedHash: string): string | null;
|
|
227
|
+
export type CaptureSnapshotResult = {
|
|
228
|
+
ok: true;
|
|
229
|
+
snapshot: DeliveryWorkspaceSnapshot;
|
|
230
|
+
snapshotFile: string;
|
|
231
|
+
} | {
|
|
232
|
+
ok: false;
|
|
233
|
+
code: string;
|
|
234
|
+
reason: string;
|
|
235
|
+
};
|
|
236
|
+
export interface CaptureSnapshotInput {
|
|
237
|
+
workspacePath: string;
|
|
238
|
+
taskId: string;
|
|
239
|
+
attemptNo: number;
|
|
240
|
+
territoryId: string;
|
|
241
|
+
phase: DeliveryChangePhase;
|
|
242
|
+
executionId?: string | null;
|
|
243
|
+
leaseId?: string | null;
|
|
244
|
+
dispatchId?: string | null;
|
|
245
|
+
evidenceRoot?: string;
|
|
246
|
+
bounds?: Partial<DeliveryChangeBounds>;
|
|
247
|
+
now?: string;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* 冻结一份有界工作区快照。**永不抛出**:采集失败只返回 `ok:false`,
|
|
251
|
+
* 调用方据此不产生任何改动链接,而不是把失败伪装成空差异。
|
|
252
|
+
*
|
|
253
|
+
* 候选路径全部来自 Git(见 {@link enumerateCandidates}):没有可用的 Git 基准、
|
|
254
|
+
* 枚举失败或输出超限时直接返回失败,绝不退化成「扫描任意工作区正文」。
|
|
255
|
+
*/
|
|
256
|
+
export declare function captureWorkspaceSnapshot(input: CaptureSnapshotInput): CaptureSnapshotResult;
|
|
257
|
+
export declare function readWorkspaceSnapshot(evidenceRoot: string | undefined, snapshotId: string): DeliveryWorkspaceSnapshot | null;
|
|
258
|
+
export declare function deliveryChangeEvidenceId(manifest: DeliveryChangeManifest): string;
|
|
259
|
+
export type BuildChangeManifestResult = {
|
|
260
|
+
ok: true;
|
|
261
|
+
manifest: DeliveryChangeManifest;
|
|
262
|
+
file: string;
|
|
263
|
+
} | {
|
|
264
|
+
ok: false;
|
|
265
|
+
code: string;
|
|
266
|
+
reason: string;
|
|
267
|
+
};
|
|
268
|
+
/** 采集执行前的有界基线;失败返回 null(调用方不得伪造空差异)。 */
|
|
269
|
+
export declare function capturePreChangeSnapshot(input: Omit<CaptureSnapshotInput, 'phase'>): DeliveryWorkspaceSnapshot | null;
|
|
270
|
+
export interface CompleteChangeManifestInput {
|
|
271
|
+
workspacePath: string;
|
|
272
|
+
pre: DeliveryWorkspaceSnapshot;
|
|
273
|
+
taskId: string;
|
|
274
|
+
attemptNo: number;
|
|
275
|
+
territoryId: string;
|
|
276
|
+
executionId?: string | null;
|
|
277
|
+
leaseId?: string | null;
|
|
278
|
+
dispatchId?: string | null;
|
|
279
|
+
evidenceRoot?: string;
|
|
280
|
+
bounds?: Partial<DeliveryChangeBounds>;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* terminal / WorkerResult 之前采集 POST 并生成差异 manifest。
|
|
284
|
+
*
|
|
285
|
+
* 采集或写入任一步失败都返回 null:宁可没有改动定位,也不产生不可信的链接。
|
|
286
|
+
*/
|
|
287
|
+
export declare function capturePostAndBuildChangeManifest(input: CompleteChangeManifestInput): DeliveryChangeManifest | null;
|
|
288
|
+
export interface BuildChangeManifestInput {
|
|
289
|
+
evidenceRoot?: string;
|
|
290
|
+
pre: DeliveryWorkspaceSnapshot;
|
|
291
|
+
post: DeliveryWorkspaceSnapshot;
|
|
292
|
+
bounds?: Partial<DeliveryChangeBounds>;
|
|
293
|
+
resultRef?: string | null;
|
|
294
|
+
now?: string;
|
|
295
|
+
}
|
|
296
|
+
/** 由 PRE/POST 两份快照生成有界、脱敏的差异 manifest,并原子写入内容寻址文件。 */
|
|
297
|
+
export declare function buildDeliveryChangeManifest(input: BuildChangeManifestInput): BuildChangeManifestResult;
|
|
298
|
+
/** 有界行级差异:裁掉公共前后缀后,把中段如实标成 REMOVED/ADDED 片段。 */
|
|
299
|
+
export declare function diffLines(before: string, after: string, maxLines: number): DeliveryChangeHunk[];
|
|
300
|
+
export type VerifyChangeManifestResult = {
|
|
301
|
+
ok: true;
|
|
302
|
+
manifest: DeliveryChangeManifest;
|
|
303
|
+
} | {
|
|
304
|
+
ok: false;
|
|
305
|
+
code: string;
|
|
306
|
+
reason: string;
|
|
307
|
+
};
|
|
308
|
+
/** 读回并按内容寻址重验 manifest 与保留正文的 hash;漂移即不可用。 */
|
|
309
|
+
export declare function verifyChangeManifest(evidenceRoot: string | undefined, evidenceId: string): VerifyChangeManifestResult;
|
|
310
|
+
/** 读取由主管 ACCEPT 绑定在该 Task 上的改动证据引用。 */
|
|
311
|
+
export declare function readAcceptedChangeEvidence(review: EventRow | null): DeliveryChangeEvidenceRef | null;
|
|
312
|
+
export declare function selectionDigest(entryIds: readonly string[]): string;
|
|
313
|
+
/**
|
|
314
|
+
* 校验主管显式选择:evidence 必须存在且 hash 一致,选中的 entry 必须真实存在。
|
|
315
|
+
* 任一失败都返回错误,调用方必须拒绝并零写入。
|
|
316
|
+
*/
|
|
317
|
+
export declare function validateChangeSelection(evidenceRoot: string | undefined, manifest: DeliveryChangeManifest, entryIds: readonly string[], expected: {
|
|
318
|
+
taskId: string;
|
|
319
|
+
attemptNo: number;
|
|
320
|
+
}): {
|
|
321
|
+
ok: true;
|
|
322
|
+
ref: DeliveryChangeEvidenceRef;
|
|
323
|
+
} | {
|
|
324
|
+
ok: false;
|
|
325
|
+
code: string;
|
|
326
|
+
reason: string;
|
|
327
|
+
};
|
|
328
|
+
/** 事件载荷:只含 task/attempt/result、manifest/hash 与有界元数据,不含仓库正文。 */
|
|
329
|
+
export declare function changeSnapshotEventPayload(manifest: DeliveryChangeManifest, resultRef: string | null): Record<string, unknown>;
|
|
330
|
+
export declare function changeSnapshotEventId(kingdomId: string, taskId: string, attemptNo: number, executionRef: string | null): string;
|
|
331
|
+
/** Territory canonical workspace 的不可逆摘要,用于把快照绑定到具体领地工作区。 */
|
|
332
|
+
export declare function workspaceKeyOf(workspacePath: string): string | null;
|
|
333
|
+
export interface ChangeSnapshotEventRef {
|
|
334
|
+
event: EventRow;
|
|
335
|
+
evidenceId: string;
|
|
336
|
+
attemptNo: number;
|
|
337
|
+
resultId: string | null;
|
|
338
|
+
executionId: string | null;
|
|
339
|
+
coverageComplete: boolean;
|
|
340
|
+
coverageReasons: string[];
|
|
341
|
+
}
|
|
342
|
+
/** 精确读取某 Task/attempt 的改动快照事件(不走有界 GUI 投影)。 */
|
|
343
|
+
export declare function readChangeSnapshotEvent(store: KingdomStore, kingdomId: string, taskId: string, attemptNo: number): ChangeSnapshotEventRef | null;
|
|
344
|
+
/** 主管候选清单用的有界条目视图(只读,不写任何事实);展示路径是仓库相对路径。 */
|
|
345
|
+
export declare function listChangeEntries(manifest: DeliveryChangeManifest, limit?: number): {
|
|
346
|
+
entryId: string;
|
|
347
|
+
repoPath: string;
|
|
348
|
+
status: string;
|
|
349
|
+
note: string;
|
|
350
|
+
}[];
|
|
351
|
+
/** 读回一条已确认改动条目的有界视图:只按 entry id 取,不接受任意路径。 */
|
|
352
|
+
export declare function readChangeEntry(evidenceRoot: string | undefined, ref: DeliveryChangeEvidenceRef, entryId: string): {
|
|
353
|
+
ok: true;
|
|
354
|
+
entry: DeliveryChangeEntry;
|
|
355
|
+
manifest: DeliveryChangeManifest;
|
|
356
|
+
} | {
|
|
357
|
+
ok: false;
|
|
358
|
+
code: string;
|
|
359
|
+
reason: string;
|
|
360
|
+
};
|
|
361
|
+
/** 交付条目派生用的已解析证据形状(与 `delivery-ack.ts` 的结构一致)。 */
|
|
362
|
+
export interface ResolvedChangeEvidence {
|
|
363
|
+
evidenceId: string;
|
|
364
|
+
attemptNo: number;
|
|
365
|
+
repoHead: string | null;
|
|
366
|
+
coverageComplete: boolean;
|
|
367
|
+
coverageReasons: string[];
|
|
368
|
+
note: string;
|
|
369
|
+
/** 条目展示路径一律是仓库相对路径。 */
|
|
370
|
+
entries: {
|
|
371
|
+
entryId: string;
|
|
372
|
+
repoPath: string;
|
|
373
|
+
status: string;
|
|
374
|
+
note: string;
|
|
375
|
+
}[];
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* 把已确认的改动引用解析成可投影条目。任何 hash 漂移或正文缺失都返回 null,
|
|
379
|
+
* 调用方据此显示「不可定位」,而不是继续用可能被替换的正文。
|
|
380
|
+
*/
|
|
381
|
+
export declare function resolveChangeEvidenceForDelivery(evidenceRoot: string | undefined, ref: DeliveryChangeEvidenceRef): ResolvedChangeEvidence | null;
|
|
@@ -132,6 +132,11 @@ export interface RoleBindDraftOperation {
|
|
|
132
132
|
role_type: IntentRoleType;
|
|
133
133
|
role_name: string;
|
|
134
134
|
session_id: string;
|
|
135
|
+
/**
|
|
136
|
+
* v3.2.0:主管的任命必须同时给出领地,且席位与主理在同一事务里一次写完。
|
|
137
|
+
* 因此主管 Draft 是**单步** `role.bind`(带 territory_id),不再有第二步 territory.supervisor。
|
|
138
|
+
*/
|
|
139
|
+
territory_id?: string;
|
|
135
140
|
};
|
|
136
141
|
}
|
|
137
142
|
export interface RoleSessionDraftOperation {
|
|
@@ -160,7 +165,10 @@ export interface OwnerBindingIntentDraft {
|
|
|
160
165
|
confirmation: typeof DIRECT_SLASH_CONFIRM_REQUIRED | null;
|
|
161
166
|
ambiguity: DraftAmbiguity | null;
|
|
162
167
|
}
|
|
163
|
-
/**
|
|
168
|
+
/**
|
|
169
|
+
* 旧两步流程的材料化(v3.2.0 之前:先 role.bind,再拿返回的 binding_id 执行第二步)。
|
|
170
|
+
* 3.2.0 起主管任命是单步原子命令,本函数只为仍然引用它的调用方保留,不再是 Draft 的步骤。
|
|
171
|
+
*/
|
|
164
172
|
export declare function canonicalTerritorySupervisorSlash(territoryId: string, supervisorBindingId: string): string | null;
|
|
165
173
|
/** Parse one bounded natural-language intent without performing any write. */
|
|
166
174
|
export declare function draftOwnerBindingIntent(input: OwnerBindingIntentInput): OwnerBindingIntentDraft;
|