dsh-kingdom 1.0.0 → 2.0.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 +18 -2
- package/LICENSE +661 -661
- package/NOTICE +9 -9
- package/README.md +26 -20
- package/THIRD_PARTY_NOTICES.md +84 -0
- package/cordis.patch.yml +6 -6
- package/docs/V2.0-RELEASE-NOTES.md +30 -0
- package/docs/V2.0-USER-GUIDE.md +74 -0
- package/lib/adapter/dsh-backend.js +10 -6
- package/lib/adapter/dsh-backend.js.map +1 -1
- package/lib/adapter/dsh-cost.js +68 -0
- package/lib/adapter/dsh-cost.js.map +1 -0
- package/lib/adapter/dsh-session-events.js +86 -0
- package/lib/adapter/dsh-session-events.js.map +1 -0
- package/lib/adapter/dsh-usage.js +159 -0
- package/lib/adapter/dsh-usage.js.map +1 -0
- package/lib/capability/admin.js +4 -4
- package/lib/capability/admin.js.map +1 -1
- package/lib/capability/dsh-enforcement.js +19 -4
- package/lib/capability/dsh-enforcement.js.map +1 -1
- package/lib/capability/service.js +11 -0
- package/lib/capability/service.js.map +1 -1
- package/lib/capability/tool-disclosure.js +144 -0
- package/lib/capability/tool-disclosure.js.map +1 -0
- package/lib/core/binding.js +20 -18
- package/lib/core/binding.js.map +1 -1
- package/lib/core/budget.js +304 -0
- package/lib/core/budget.js.map +1 -0
- package/lib/core/collaboration.js +422 -0
- package/lib/core/collaboration.js.map +1 -0
- package/lib/core/cost.js +212 -0
- package/lib/core/cost.js.map +1 -0
- package/lib/core/db.js +124 -0
- package/lib/core/db.js.map +1 -1
- package/lib/core/governed-claim.js +46 -0
- package/lib/core/governed-claim.js.map +1 -0
- package/lib/core/governed.js +112 -7
- package/lib/core/governed.js.map +1 -1
- package/lib/core/kingdom.js +58 -56
- package/lib/core/kingdom.js.map +1 -1
- package/lib/core/owner-control.js +48 -7
- package/lib/core/owner-control.js.map +1 -1
- package/lib/core/owner-window.js +822 -0
- package/lib/core/owner-window.js.map +1 -0
- package/lib/core/task-service.js +103 -72
- package/lib/core/task-service.js.map +1 -1
- package/lib/core/territory.js +33 -11
- package/lib/core/territory.js.map +1 -1
- package/lib/core/usage.js +39 -0
- package/lib/core/usage.js.map +1 -0
- package/lib/core/workspace-admission.js +225 -0
- package/lib/core/workspace-admission.js.map +1 -0
- package/lib/dispatch/evidence.js +5 -2
- package/lib/dispatch/evidence.js.map +1 -1
- package/lib/dispatch/service.js +136 -5
- package/lib/dispatch/service.js.map +1 -1
- package/lib/gui/assets/characters/chancellor-idle.svg +67 -221
- package/lib/gui/assets/characters/chancellor-sleeping.svg +67 -221
- package/lib/gui/assets/characters/chancellor-thinking.svg +67 -221
- package/lib/gui/assets/characters/chancellor-working.svg +67 -221
- package/lib/gui/assets/characters/knight-redraw-r1-idle.svg +67 -111
- package/lib/gui/assets/characters/knight-redraw-r1-sleeping.svg +67 -115
- package/lib/gui/assets/characters/knight-redraw-r1-thinking.svg +67 -173
- package/lib/gui/assets/characters/knight-redraw-r1-working.svg +67 -248
- package/lib/gui/assets/characters/supervisor-idle.svg +67 -266
- package/lib/gui/assets/characters/supervisor-sleeping.svg +67 -266
- package/lib/gui/assets/characters/supervisor-thinking.svg +67 -266
- package/lib/gui/assets/characters/supervisor-working.svg +67 -266
- package/lib/gui/console-app.js +1964 -1927
- package/lib/gui/console-app.js.map +1 -1
- package/lib/gui/contract.js.map +1 -1
- package/lib/gui/control-contract.js +2 -0
- package/lib/gui/control-contract.js.map +1 -1
- package/lib/gui/local-control.js +1 -0
- package/lib/gui/local-control.js.map +1 -1
- package/lib/gui/owner-control.js +310 -0
- package/lib/gui/owner-control.js.map +1 -0
- package/lib/gui/owner-ui.js +191 -0
- package/lib/gui/owner-ui.js.map +1 -0
- package/lib/gui/server.js +4 -0
- package/lib/gui/server.js.map +1 -1
- package/lib/gui/snapshot.js +150 -15
- package/lib/gui/snapshot.js.map +1 -1
- package/lib/gui/visual-assets.js +56 -0
- package/lib/gui/visual-assets.js.map +1 -0
- package/lib/gui/visual-system.js +272 -0
- package/lib/gui/visual-system.js.map +1 -0
- package/lib/gui/workbench-ui.js +358 -0
- package/lib/gui/workbench-ui.js.map +1 -0
- package/lib/gui/workbench.js +163 -0
- package/lib/gui/workbench.js.map +1 -0
- package/lib/index.js +269 -39
- package/lib/index.js.map +1 -1
- package/lib/runner-context-broker.js +8 -2
- package/lib/runner-context-broker.js.map +1 -1
- package/lib/runtime-cost-observer.js +145 -0
- package/lib/runtime-cost-observer.js.map +1 -0
- package/lib/types/adapter/contract.d.ts +2 -0
- package/lib/types/adapter/dsh-backend.d.ts +2 -6
- package/lib/types/adapter/dsh-cost.d.ts +13 -0
- package/lib/types/adapter/dsh-session-events.d.ts +16 -0
- package/lib/types/adapter/dsh-usage.d.ts +36 -0
- package/lib/types/capability/dsh-enforcement.d.ts +8 -6
- package/lib/types/capability/service.d.ts +1 -0
- package/lib/types/capability/tool-disclosure.d.ts +36 -0
- package/lib/types/core/binding.d.ts +4 -3
- package/lib/types/core/budget.d.ts +81 -0
- package/lib/types/core/collaboration.d.ts +110 -0
- package/lib/types/core/cost.d.ts +99 -0
- package/lib/types/core/db.d.ts +21 -0
- package/lib/types/core/governed-claim.d.ts +7 -0
- package/lib/types/core/governed.d.ts +19 -1
- package/lib/types/core/kingdom.d.ts +3 -0
- package/lib/types/core/owner-control.d.ts +19 -3
- package/lib/types/core/owner-window.d.ts +226 -0
- package/lib/types/core/task-service.d.ts +36 -0
- package/lib/types/core/territory.d.ts +7 -0
- package/lib/types/core/usage.d.ts +26 -0
- package/lib/types/core/workspace-admission.d.ts +43 -0
- package/lib/types/dispatch/evidence.d.ts +2 -5
- package/lib/types/dispatch/service.d.ts +18 -0
- package/lib/types/gui/console-app.d.ts +2 -1
- package/lib/types/gui/contract.d.ts +176 -2
- package/lib/types/gui/control-contract.d.ts +1 -1
- package/lib/types/gui/owner-control.d.ts +45 -0
- package/lib/types/gui/owner-ui.d.ts +2 -0
- package/lib/types/gui/server.d.ts +3 -0
- package/lib/types/gui/snapshot.d.ts +3 -10
- package/lib/types/gui/visual-assets.d.ts +27 -0
- package/lib/types/gui/visual-system.d.ts +2 -0
- package/lib/types/gui/workbench-ui.d.ts +5 -0
- package/lib/types/gui/workbench.d.ts +33 -0
- package/lib/types/index.d.ts +36 -4
- package/lib/types/runtime-cost-observer.d.ts +22 -0
- package/lib/types/worker/collaboration.d.ts +35 -0
- package/lib/types/worker/executor.d.ts +3 -0
- package/lib/types/worker/governed-executor.d.ts +2 -0
- package/lib/worker/collaboration.js +172 -0
- package/lib/worker/collaboration.js.map +1 -0
- package/lib/worker/executor.js +5 -1
- package/lib/worker/executor.js.map +1 -1
- package/lib/worker/governed-executor.js +161 -93
- package/lib/worker/governed-executor.js.map +1 -1
- package/package.json +19 -8
|
@@ -36,6 +36,7 @@ export declare const CONSOLE_APP_DEFAULT_COMMANDS: {
|
|
|
36
36
|
readonly taskCreate: "plan";
|
|
37
37
|
readonly assign: "assign";
|
|
38
38
|
readonly start: "start";
|
|
39
|
+
readonly reconcile: "reconcile";
|
|
39
40
|
readonly review: "review";
|
|
40
41
|
readonly executionPause: "execution.pause";
|
|
41
42
|
readonly executionResume: "execution.resume";
|
|
@@ -85,7 +86,7 @@ export interface ConsoleCommandEnvelope {
|
|
|
85
86
|
name: string;
|
|
86
87
|
payload: Record<string, unknown>;
|
|
87
88
|
}
|
|
88
|
-
export type ConsoleSection = 'overview' | 'organization' | 'tasks' | 'executions' | 'activity' | 'management' | 'ledger';
|
|
89
|
+
export type ConsoleSection = 'today' | 'inbox' | 'map' | 'usage' | 'settings' | 'overview' | 'organization' | 'tasks' | 'executions' | 'activity' | 'management' | 'ledger';
|
|
89
90
|
export declare const CONSOLE_APP_THEMES: readonly [{
|
|
90
91
|
readonly id: "parchment";
|
|
91
92
|
readonly label: "羊皮纸王国志";
|
|
@@ -45,7 +45,7 @@ export type ActorState = (typeof ACTOR_STATES)[number];
|
|
|
45
45
|
*/
|
|
46
46
|
export type ActorActivity = 'plan' | 'read' | 'assign' | 'review' | 'rework' | 'accept' | 'execute' | null;
|
|
47
47
|
/** 命令返回的稳定错误码。GUI 据此决定提示与可用按钮,不解析中文文案。 */
|
|
48
|
-
export type KingdomErrorCode = 'KINGDOM_NOT_INITIALIZED' | 'ROLE_BINDING_MISSING' | 'UNAUTHORIZED_PRINCIPAL' | 'SESSION_AUTH_REQUIRED' | 'TERRITORY_MISSING' | 'TERRITORY_AMBIGUOUS' | 'TERRITORY_NOT_IN_KINGDOM' | 'TASK_NOT_FOUND' | 'TASK_NOT_IN_KINGDOM' | 'ILLEGAL_TASK_STATE' | 'INVALID_INPUT' | 'INVALID_DECISION' | 'REASON_REQUIRED' | 'WORKER_BINDING_INVALID' | 'WORKER_AMBIGUOUS' | 'TERRITORY_SUPERVISOR_MISSING' | 'TASK_OUT_OF_SCOPE' | 'EXECUTOR_UNAVAILABLE' | 'WORKER_EXECUTION_FAILED' | 'CLAIM_INTEGRITY_BLOCKED' | 'EXECUTION_NOT_FOUND' | 'ILLEGAL_EXECUTION_STATE';
|
|
48
|
+
export type KingdomErrorCode = 'KINGDOM_NOT_INITIALIZED' | 'ROLE_BINDING_MISSING' | 'UNAUTHORIZED_PRINCIPAL' | 'SESSION_AUTH_REQUIRED' | 'TERRITORY_MISSING' | 'TERRITORY_AMBIGUOUS' | 'TERRITORY_NOT_IN_KINGDOM' | 'TASK_NOT_FOUND' | 'TASK_NOT_IN_KINGDOM' | 'ILLEGAL_TASK_STATE' | 'INVALID_INPUT' | 'INVALID_DECISION' | 'REASON_REQUIRED' | 'WORKER_BINDING_INVALID' | 'WORKER_AMBIGUOUS' | 'TERRITORY_SUPERVISOR_MISSING' | 'TASK_OUT_OF_SCOPE' | 'EXECUTOR_UNAVAILABLE' | 'WORKER_EXECUTION_FAILED' | 'CLAIM_INTEGRITY_BLOCKED' | 'EXECUTION_NOT_FOUND' | 'ILLEGAL_EXECUTION_STATE' | 'RECOVERY_REQUIRED';
|
|
49
49
|
/**
|
|
50
50
|
* v0.5.2(M1-B/P0-B):GUI 写命令守卫。
|
|
51
51
|
*
|
|
@@ -61,7 +61,7 @@ export declare function guiWriteGuard(authMode: string): {
|
|
|
61
61
|
code: 'SESSION_AUTH_REQUIRED';
|
|
62
62
|
};
|
|
63
63
|
/** GUI 可以呈现为按钮的下一步动作。 */
|
|
64
|
-
export type AllowedAction = 'assign' | 'start' | 'review:accept' | 'review:rework' | 'review:fail' | 'review:handoff' | 'execution:pause' | 'execution:resume' | 'execution:abort';
|
|
64
|
+
export type AllowedAction = 'assign' | 'start' | 'reconcile' | 'review:accept' | 'review:rework' | 'review:fail' | 'review:handoff' | 'execution:pause' | 'execution:resume' | 'execution:abort';
|
|
65
65
|
/** v0.9 S1:Projection 的可公开、可追溯来源引用。不得放入 raw payload/session/path。 */
|
|
66
66
|
export type ProjectionSourceType = 'table-row' | 'event' | 'runtime-evidence' | 'derived-rule';
|
|
67
67
|
export interface SourceRef {
|
|
@@ -214,12 +214,179 @@ export interface TaskProjectionData {
|
|
|
214
214
|
} | null;
|
|
215
215
|
actionAvailability: ActionAvailability[];
|
|
216
216
|
}
|
|
217
|
+
/** v1.2:工作台只是现有事实的有界投影,不创建待办/验收状态库。 */
|
|
218
|
+
export interface WorkbenchQueue<T> {
|
|
219
|
+
totalCount: number;
|
|
220
|
+
items: T[];
|
|
221
|
+
truncated: boolean;
|
|
222
|
+
}
|
|
223
|
+
export interface WorkbenchActionItem {
|
|
224
|
+
id: string;
|
|
225
|
+
kind: string;
|
|
226
|
+
taskId: string | null;
|
|
227
|
+
territoryId: string | null;
|
|
228
|
+
title: string;
|
|
229
|
+
summary: string;
|
|
230
|
+
responsibility: 'OWNER' | 'CHANCELLOR' | 'SUPERVISOR' | 'UNDETERMINED';
|
|
231
|
+
responsibleBindingId: string | null;
|
|
232
|
+
/** 复用原有服务端许可;责任分类本身不授予调用权限。 */
|
|
233
|
+
actionAvailability: ActionAvailability[];
|
|
234
|
+
sourceRefs: SourceRef[];
|
|
235
|
+
}
|
|
236
|
+
export interface WorkbenchDeliveryItem {
|
|
237
|
+
taskId: string;
|
|
238
|
+
title: string;
|
|
239
|
+
status: string;
|
|
240
|
+
claim: ClaimView | null;
|
|
241
|
+
supervisorAccepted: boolean;
|
|
242
|
+
supervisorDecision: SupervisorDecisionView | null;
|
|
243
|
+
/** 当前没有人类验收事实;DONE 也不能填为人类已验收。 */
|
|
244
|
+
humanAcceptance: 'NOT_RECORDED';
|
|
245
|
+
updatedAt: string;
|
|
246
|
+
sourceRefs: SourceRef[];
|
|
247
|
+
}
|
|
248
|
+
export interface WorkbenchRoleItem {
|
|
249
|
+
bindingId: string;
|
|
250
|
+
roleType: string;
|
|
251
|
+
roleName: string;
|
|
252
|
+
sessionBound: boolean;
|
|
253
|
+
taskCount: number;
|
|
254
|
+
taskIds: string[];
|
|
255
|
+
taskIdsTruncated: boolean;
|
|
256
|
+
activeExecutionCount: number;
|
|
257
|
+
reviewTaskCount: number;
|
|
258
|
+
recoveringTaskCount: number;
|
|
259
|
+
sourceRefs: SourceRef[];
|
|
260
|
+
}
|
|
261
|
+
export interface WorkbenchUsageSummary {
|
|
262
|
+
scope: 'WORKER_DISPATCH_ONLY';
|
|
263
|
+
totalDispatches: number;
|
|
264
|
+
completeDispatches: number;
|
|
265
|
+
partialDispatches: number;
|
|
266
|
+
unavailableDispatches: number;
|
|
267
|
+
/** 实际执行中没有对应 Dispatch 的次数,可能包括 legacy 执行。 */
|
|
268
|
+
executionsWithoutDispatch: number;
|
|
269
|
+
coverage: 'COMPLETE' | 'PARTIAL' | 'UNAVAILABLE';
|
|
270
|
+
/** 仅累加完整、对应当前 Dispatch 的供应商报告;无完整报告返回 null。 */
|
|
271
|
+
reportedTotals: {
|
|
272
|
+
uncachedInputTokens: number;
|
|
273
|
+
outputTokens: number;
|
|
274
|
+
totalTokens: number;
|
|
275
|
+
} | null;
|
|
276
|
+
cost: null;
|
|
277
|
+
costStatus: 'NOT_RECORDED';
|
|
278
|
+
sourceRefs: SourceRef[];
|
|
279
|
+
}
|
|
280
|
+
export interface WorkbenchCostRuntime {
|
|
281
|
+
toolDisclosureMode: 'off' | 'pilot';
|
|
282
|
+
observerAvailable: boolean;
|
|
283
|
+
}
|
|
284
|
+
/** Public assembly measurements, without runtime/session references or prompt text. */
|
|
285
|
+
export interface WorkbenchPromptCostView {
|
|
286
|
+
bindingId: string | null;
|
|
287
|
+
roleType: string;
|
|
288
|
+
toolsBefore: number | null;
|
|
289
|
+
toolsAfter: number | null;
|
|
290
|
+
toolsBytesBefore: number | null;
|
|
291
|
+
toolsBytesAfter: number | null;
|
|
292
|
+
sections: {
|
|
293
|
+
name: string;
|
|
294
|
+
bytes: number | null;
|
|
295
|
+
}[];
|
|
296
|
+
contexts: {
|
|
297
|
+
name: string;
|
|
298
|
+
bytes: number | null;
|
|
299
|
+
}[];
|
|
300
|
+
partsTruncated: boolean;
|
|
301
|
+
historyBytes: null;
|
|
302
|
+
tokenEstimate: null;
|
|
303
|
+
mode: 'off' | 'pilot' | 'UNKNOWN';
|
|
304
|
+
reasonCode: string | null;
|
|
305
|
+
}
|
|
306
|
+
export interface WorkbenchCostSummary {
|
|
307
|
+
additionalRoles: import('../core/cost.js').AdditionalRoleCostSummary | null;
|
|
308
|
+
budget: import('../core/budget.js').BudgetView | null;
|
|
309
|
+
prompts: WorkbenchQueue<WorkbenchPromptCostView>;
|
|
310
|
+
runtime: {
|
|
311
|
+
toolDisclosureMode: 'off' | 'pilot' | 'UNKNOWN';
|
|
312
|
+
observerAvailable: boolean | null;
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
export interface WorkbenchPlanReadiness {
|
|
316
|
+
ready: boolean;
|
|
317
|
+
reasonCode: string | null;
|
|
318
|
+
blockingTaskIds: string[];
|
|
319
|
+
acceptedResults: {
|
|
320
|
+
taskId: string;
|
|
321
|
+
attemptNo: number;
|
|
322
|
+
resultId: string;
|
|
323
|
+
resultDigest: string;
|
|
324
|
+
acceptEventId: string;
|
|
325
|
+
}[];
|
|
326
|
+
}
|
|
327
|
+
export interface WorkbenchPlanView {
|
|
328
|
+
planId: string;
|
|
329
|
+
parentTaskId: string;
|
|
330
|
+
title: string;
|
|
331
|
+
version: number;
|
|
332
|
+
digest: string;
|
|
333
|
+
state: 'PROPOSED' | 'ADOPTED' | 'STALE';
|
|
334
|
+
mode: 'EXPERT' | 'TEAM';
|
|
335
|
+
reason: string;
|
|
336
|
+
integratorBindingId: string;
|
|
337
|
+
integratorName: string;
|
|
338
|
+
parentStatus: string;
|
|
339
|
+
budgetTokens: number;
|
|
340
|
+
reserveTokens: number;
|
|
341
|
+
adoptedAt: string | null;
|
|
342
|
+
integration: WorkbenchPlanReadiness | null;
|
|
343
|
+
budget: import('../core/collaboration.js').PlanBudgetView | null;
|
|
344
|
+
items: {
|
|
345
|
+
key: string;
|
|
346
|
+
taskId: string;
|
|
347
|
+
title: string;
|
|
348
|
+
description: string;
|
|
349
|
+
acceptanceCriteria: string;
|
|
350
|
+
territoryId: string;
|
|
351
|
+
territoryName: string;
|
|
352
|
+
workerBindingId: string;
|
|
353
|
+
workerName: string;
|
|
354
|
+
access: 'READ_ONLY' | 'WRITE';
|
|
355
|
+
dependsOn: string[];
|
|
356
|
+
expectedArtifact: string;
|
|
357
|
+
status: string;
|
|
358
|
+
readiness: WorkbenchPlanReadiness | null;
|
|
359
|
+
}[];
|
|
360
|
+
}
|
|
361
|
+
export interface WorkbenchCollaborationView {
|
|
362
|
+
plans: WorkbenchQueue<WorkbenchPlanView>;
|
|
363
|
+
pendingAdoptionCount: number;
|
|
364
|
+
/** Held resources only; absence is not proof that a future start can acquire a workspace. */
|
|
365
|
+
resources: WorkbenchQueue<{
|
|
366
|
+
taskId: string;
|
|
367
|
+
attemptNo: number;
|
|
368
|
+
access: 'READ_ONLY' | 'WRITE';
|
|
369
|
+
state: string;
|
|
370
|
+
recovery: boolean;
|
|
371
|
+
}>;
|
|
372
|
+
}
|
|
373
|
+
export interface PersonalWorkbenchData {
|
|
374
|
+
ownerActions: WorkbenchQueue<WorkbenchActionItem>;
|
|
375
|
+
internalActions: WorkbenchQueue<WorkbenchActionItem>;
|
|
376
|
+
exceptions: WorkbenchQueue<WorkbenchActionItem>;
|
|
377
|
+
deliveries: WorkbenchQueue<WorkbenchDeliveryItem>;
|
|
378
|
+
roles: WorkbenchQueue<WorkbenchRoleItem>;
|
|
379
|
+
usage: WorkbenchUsageSummary;
|
|
380
|
+
cost: WorkbenchCostSummary;
|
|
381
|
+
collaboration: WorkbenchCollaborationView;
|
|
382
|
+
}
|
|
217
383
|
export interface ReadonlySnapshotProjection {
|
|
218
384
|
overview: ProjectionEnvelope<OverviewProjectionData>;
|
|
219
385
|
organization: ProjectionEnvelope<OrganizationProjectionData>;
|
|
220
386
|
executions: ProjectionEnvelope<ExecutionProjectionData>;
|
|
221
387
|
timeline: ProjectionEnvelope<TimelineItem[]>;
|
|
222
388
|
attention: ProjectionEnvelope<AttentionItem[]>;
|
|
389
|
+
workbench: ProjectionEnvelope<PersonalWorkbenchData>;
|
|
223
390
|
}
|
|
224
391
|
/**
|
|
225
392
|
* S1 只读派生所需的 Host-only 可验证上下文;缺任一项时 action 必须 fail-closed。
|
|
@@ -352,6 +519,7 @@ export interface CapabilityDecisionView {
|
|
|
352
519
|
}
|
|
353
520
|
/** Dispatch Record 投影(RECOVERING 必须如实显示,禁止显示成 Done)。 */
|
|
354
521
|
export interface DispatchView {
|
|
522
|
+
usage?: import('../core/usage.js').DispatchUsageView | null;
|
|
355
523
|
dispatchId: string;
|
|
356
524
|
leaseId: string;
|
|
357
525
|
executionId: string;
|
|
@@ -498,10 +666,16 @@ export interface TaskDetailView {
|
|
|
498
666
|
executions: ExecutionView[];
|
|
499
667
|
/** Supervisor 的历次裁定(从 events 还原,不存在 task_reviews 表)。 */
|
|
500
668
|
reviews: SupervisorDecisionView[];
|
|
669
|
+
reviewsTruncated: boolean;
|
|
501
670
|
relatedEvents: EventView[];
|
|
671
|
+
/** 先按本任务取事件再应用窗口,不受其他任务的事件数量影响。 */
|
|
672
|
+
relatedEventsTruncated: boolean;
|
|
673
|
+
humanAcceptance: 'NOT_RECORDED';
|
|
502
674
|
allowedActions: AllowedAction[];
|
|
503
675
|
/** v0.8:本任务的 Runtime Governance 投影(Lease/Decision/Dispatch)。 */
|
|
504
676
|
governance: RuntimeGovernanceView;
|
|
677
|
+
/** Exact single-task attribution only; shared and unattributed units remain outside task totals. */
|
|
678
|
+
additionalRoleCost: import('../core/cost.js').AdditionalRoleCostSummary | null;
|
|
505
679
|
/** v0.9 S1:Task Detail 的只读 Projection Envelope。 */
|
|
506
680
|
projection: ProjectionEnvelope<TaskProjectionData>;
|
|
507
681
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* from the direct `/kingdom gui` activation.
|
|
9
9
|
*/
|
|
10
10
|
/** Commands that the loopback GUI may submit after control-session admission. */
|
|
11
|
-
export declare const GUI_SESSION_COMMANDS: readonly ["plan", "assign", "start", "review", "execution.pause", "execution.resume", "execution.abort", "control.revoke"];
|
|
11
|
+
export declare const GUI_SESSION_COMMANDS: readonly ["plan", "assign", "start", "reconcile", "review", "execution.pause", "execution.resume", "execution.abort", "control.revoke"];
|
|
12
12
|
export type GuiSessionCommand = (typeof GUI_SESSION_COMMANDS)[number];
|
|
13
13
|
/** Exact browser-controlled top-level fields for each executable command. */
|
|
14
14
|
export declare const GUI_COMMAND_PAYLOAD_FIELDS: Record<GuiSessionCommand, readonly string[]>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { OwnerControlCapability } from '../core/owner-control.js';
|
|
3
|
+
import type { OwnerDecisionController, OwnerDecisionInput } from '../core/owner-window.js';
|
|
4
|
+
import { type GuiControlRequestMeta } from './control-contract.js';
|
|
5
|
+
export declare const OWNER_CONTROL_COOKIE = "dsh_kingdom_owner";
|
|
6
|
+
export declare class OwnerTransportError extends Error {
|
|
7
|
+
readonly code: string;
|
|
8
|
+
readonly status: number;
|
|
9
|
+
constructor(code: string, message: string, status?: number);
|
|
10
|
+
}
|
|
11
|
+
export interface OwnerLocalControlOptions {
|
|
12
|
+
controller: OwnerDecisionController;
|
|
13
|
+
expectedOrigin: string | (() => string);
|
|
14
|
+
now?: () => number;
|
|
15
|
+
}
|
|
16
|
+
/** Transport references existing direct-human decisions; it never accepts an HTTP identity. */
|
|
17
|
+
export declare class OwnerLocalControlManager {
|
|
18
|
+
private readonly options;
|
|
19
|
+
private readonly tickets;
|
|
20
|
+
private readonly windows;
|
|
21
|
+
private readonly now;
|
|
22
|
+
private closed;
|
|
23
|
+
constructor(options: OwnerLocalControlOptions);
|
|
24
|
+
private origin;
|
|
25
|
+
checkTransport(meta: GuiControlRequestMeta, mutation?: boolean, navigation?: boolean): void;
|
|
26
|
+
activate(capability: OwnerControlCapability, input: OwnerDecisionInput): {
|
|
27
|
+
launchTicket: string;
|
|
28
|
+
launchPath: '/owner';
|
|
29
|
+
decisionId: string;
|
|
30
|
+
expiresAt: string;
|
|
31
|
+
ttlMs: number;
|
|
32
|
+
};
|
|
33
|
+
redeem(ticket: string, meta: GuiControlRequestMeta): {
|
|
34
|
+
cookie: string;
|
|
35
|
+
maxAgeSeconds: number;
|
|
36
|
+
};
|
|
37
|
+
private window;
|
|
38
|
+
inspect(cookie: string | null, meta: GuiControlRequestMeta): Promise<unknown>;
|
|
39
|
+
receipt(cookie: string | null, meta: GuiControlRequestMeta, operationId: string, decisionId: string | null): unknown;
|
|
40
|
+
mutate(cookie: string | null, csrf: string | null, requestId: string | null, meta: GuiControlRequestMeta, action: 'prepare' | 'commit' | 'revoke', payload: Record<string, unknown>): Promise<unknown>;
|
|
41
|
+
private invalidate;
|
|
42
|
+
dispose(): void;
|
|
43
|
+
}
|
|
44
|
+
/** Runs before the Role Plane bearer/admission routes. Neither cookie upgrades the other. */
|
|
45
|
+
export declare function handleOwnerRequest(req: IncomingMessage, res: ServerResponse, url: URL, manager: OwnerLocalControlManager | undefined): Promise<boolean>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CommandResultView, SnapshotView, TaskDetailView } from './contract.js';
|
|
2
2
|
import type { EventView } from './contract.js';
|
|
3
|
+
import { type OwnerLocalControlManager } from './owner-control.js';
|
|
3
4
|
import { GuiControlBroker, GuiControlExecutionContext, type GuiControlReadContext } from './control-contract.js';
|
|
4
5
|
export interface GuiServerHandlers {
|
|
5
6
|
snapshot(readContext?: GuiControlReadContext): SnapshotView;
|
|
@@ -21,6 +22,8 @@ export interface GuiServerOptions {
|
|
|
21
22
|
token?: string;
|
|
22
23
|
allowOrigins?: string[];
|
|
23
24
|
control?: GuiControlBroker;
|
|
25
|
+
/** Independent direct-human decision transport; never upgrades Role cookies. */
|
|
26
|
+
ownerControl?: OwnerLocalControlManager;
|
|
24
27
|
onListening?(address: GuiServerAddress): void;
|
|
25
28
|
onUnavailable?(error: Error): void;
|
|
26
29
|
logger?: {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* dsh-kingdom — DB 行 → GUI 视图的投影(Phase 3)。
|
|
3
|
-
*
|
|
4
|
-
* 全部是**纯函数**:给定 (库状态, now) 就唯一确定输出。
|
|
5
|
-
* 因此 GUI 轮询即可拿到正确的表演状态,服务端不需要任何定时器或推送状态机。
|
|
6
|
-
*
|
|
7
|
-
* 再次强调边界:本文件只产出 `{ role, state, activity }` 这类语义,
|
|
8
|
-
* 绝不产出贴图、clip、场景文件名——那些是 GUI 的 visual-map 的事。
|
|
9
|
-
*/
|
|
10
|
-
import type { AllowedAction, ActionAvailability, AttentionItem, BindingView, ClaimView, EventView, ExecutionView, ProjectionEnvelope, ProjectionSecurityContext, ReadonlySnapshotProjection, RuntimeGovernanceView, SourceRef, StageActorView, TaskProjectionData, TaskDetailView, TaskView, TerritoryView, SnapshotView, TimelineItem, AuthView } from './contract.js';
|
|
1
|
+
import type { AllowedAction, ActionAvailability, AttentionItem, BindingView, ClaimView, EventView, ExecutionView, ProjectionEnvelope, ProjectionSecurityContext, ReadonlySnapshotProjection, RuntimeGovernanceView, SourceRef, StageActorView, TaskProjectionData, TaskDetailView, TaskView, TerritoryView, SnapshotView, TimelineItem, AuthView, WorkbenchCostRuntime } from './contract.js';
|
|
11
2
|
import { type EventRow, type ExecutionRow, type KingdomStore, type RoleBindingRow, type TaskRow, type TerritoryRow, type WorkerResultRow } from '../core/db.js';
|
|
12
3
|
/** 对外暴露前统一限制数量与标识格式;不接受 session/raw payload/path 作为引用。 */
|
|
13
4
|
export declare function boundedSourceRefs(refs: SourceRef[]): SourceRef[];
|
|
@@ -57,6 +48,7 @@ export interface ReadonlyProjectionOptions {
|
|
|
57
48
|
eventLimit?: number;
|
|
58
49
|
nowMs?: number;
|
|
59
50
|
security?: ProjectionSecurityContext;
|
|
51
|
+
costRuntime?: WorkbenchCostRuntime;
|
|
60
52
|
}
|
|
61
53
|
/** S1 顶层只读 Projection;没有 kingdom 时显式返回 UNKNOWN/空数据。 */
|
|
62
54
|
export declare function buildReadonlySnapshotProjection(store: KingdomStore, kingdomId: string | null, options?: ReadonlyProjectionOptions): ReadonlySnapshotProjection;
|
|
@@ -68,6 +60,7 @@ export interface SnapshotOptions {
|
|
|
68
60
|
nowMs?: number;
|
|
69
61
|
/** 缺少完整主体/scope/Host context 时 action 保持 fail-closed。 */
|
|
70
62
|
security?: ProjectionSecurityContext;
|
|
63
|
+
costRuntime?: WorkbenchCostRuntime;
|
|
71
64
|
}
|
|
72
65
|
export declare function buildSnapshot(store: KingdomStore, options: SnapshotOptions): SnapshotView;
|
|
73
66
|
export declare function buildTaskDetail(store: KingdomStore, kingdomId: string, taskId: string, options?: {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Decorative icons must be paired with visible text or an accessible control name. */
|
|
2
|
+
export declare const GUI_ICONS: Readonly<{
|
|
3
|
+
map: string;
|
|
4
|
+
management: string;
|
|
5
|
+
ledger: string;
|
|
6
|
+
refresh: string;
|
|
7
|
+
chancellor: string;
|
|
8
|
+
supervisor: string;
|
|
9
|
+
worker: string;
|
|
10
|
+
plan: string;
|
|
11
|
+
assign: string;
|
|
12
|
+
next: string;
|
|
13
|
+
run: string;
|
|
14
|
+
review: string;
|
|
15
|
+
accept: string;
|
|
16
|
+
lock: string;
|
|
17
|
+
error: string;
|
|
18
|
+
idle: string;
|
|
19
|
+
unknown: string;
|
|
20
|
+
empty: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** Original gate-and-organization brand mark; the adjacent wordmark supplies its name. */
|
|
23
|
+
export declare const KINGDOM_BRAND_SVG = "<svg class=\"kingdom-brand-mark\" xmlns=\"http://www.w3.org/2000/svg\" width=\"48\" height=\"48\" viewBox=\"0 0 48 48\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M9 31V12h6v5h6v-5h6v5h6v-5h6v19H9Z\" />\n <path d=\"M19 31v-7a5 5 0 0 1 10 0v7M24 31v5M12 36h24M12 36v3M36 36v3\" />\n <circle cx=\"12\" cy=\"41\" r=\"2\" /><circle cx=\"24\" cy=\"38\" r=\"2\" /><circle cx=\"36\" cy=\"41\" r=\"2\" />\n</svg>";
|
|
24
|
+
/** Original decorative empty state. It deliberately contains no role or binding claims. */
|
|
25
|
+
export declare const EMPTY_STATE_SVG = "<svg class=\"empty-state-art\" xmlns=\"http://www.w3.org/2000/svg\" width=\"240\" height=\"128\" viewBox=\"0 0 240 128\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M84 67V27h12v9h16v-9h16v9h16v-9h12v40H84Z\" />\n <path d=\"M109 67V53a11 11 0 0 1 22 0v14M76 67h88\" />\n <path d=\"M120 74v10M62 84h116M62 84v12M120 84v12M178 84v12\" stroke-dasharray=\"4 5\" opacity=\".55\" />\n <rect x=\"43\" y=\"96\" width=\"38\" height=\"20\" rx=\"6\" stroke-dasharray=\"4 5\" opacity=\".65\" />\n <rect x=\"101\" y=\"96\" width=\"38\" height=\"20\" rx=\"6\" stroke-dasharray=\"4 5\" opacity=\".65\" />\n <rect x=\"159\" y=\"96\" width=\"38\" height=\"20\" rx=\"6\" stroke-dasharray=\"4 5\" opacity=\".65\" />\n</svg>";
|
|
26
|
+
/** Static governance guidance, never a projection of current task progress. */
|
|
27
|
+
export declare const GOVERNANCE_FLOW_HTML: string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Personal workbench presentation. No model calls or authority are created here. */
|
|
2
|
+
export declare const WORKBENCH_CSS: string;
|
|
3
|
+
export declare const WORKBENCH_HTML: string;
|
|
4
|
+
/** Injected into the existing console closure; all Host text uses append/textContent. */
|
|
5
|
+
export declare const WORKBENCH_SCRIPT: string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ActionAvailability, ExecutionView, PersonalWorkbenchData, RuntimeGovernanceView, SupervisorDecisionView, TaskView, WorkbenchUsageSummary, WorkbenchCostSummary, WorkbenchCollaborationView } from './contract.js';
|
|
2
|
+
export declare const WORKBENCH_ITEM_LIMIT = 40;
|
|
3
|
+
/** All inputs are public projections. This module has no Store, command or model access. */
|
|
4
|
+
export interface PersonalWorkbenchInput {
|
|
5
|
+
kingdomPresent: boolean;
|
|
6
|
+
bindings: {
|
|
7
|
+
bindingId: string;
|
|
8
|
+
roleType: string;
|
|
9
|
+
roleName: string;
|
|
10
|
+
status: string;
|
|
11
|
+
sessionBound: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
territories: {
|
|
14
|
+
territoryId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
status: string;
|
|
17
|
+
supervisorBindingId: string | null;
|
|
18
|
+
}[];
|
|
19
|
+
tasks: {
|
|
20
|
+
task: Pick<TaskView, 'taskId' | 'territoryId' | 'title' | 'status' | 'assignedBindingId' | 'latestClaim' | 'latestExecution' | 'updatedAt'>;
|
|
21
|
+
actionAvailability: ActionAvailability[];
|
|
22
|
+
latestReview: SupervisorDecisionView | null;
|
|
23
|
+
claimExecutionMismatch: boolean;
|
|
24
|
+
}[];
|
|
25
|
+
executions: Pick<ExecutionView, 'executionId' | 'taskId' | 'workerBindingId' | 'state'>[];
|
|
26
|
+
governance: RuntimeGovernanceView;
|
|
27
|
+
cost?: WorkbenchCostSummary;
|
|
28
|
+
collaboration?: WorkbenchCollaborationView;
|
|
29
|
+
}
|
|
30
|
+
/** Sum only provider reports whose identity and numeric shape match this Dispatch. */
|
|
31
|
+
export declare function buildWorkbenchUsage(input: Pick<PersonalWorkbenchInput, 'governance' | 'executions'>): WorkbenchUsageSummary;
|
|
32
|
+
/** Derive current work; past DENIED and ordinary in-flight receipts are not current incidents. */
|
|
33
|
+
export declare function buildPersonalWorkbench(input: PersonalWorkbenchInput): PersonalWorkbenchData;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import type { Context } from '@deepseek-ai/cordis';
|
|
27
27
|
import z from '@deepseek-ai/schemastery';
|
|
28
|
+
import { type ToolDisclosureConfig } from './capability/tool-disclosure.js';
|
|
28
29
|
import { type AdminAuth, type ExecutionProfileV1 } from './core/binding.js';
|
|
29
30
|
import type { KingdomStore, RoleBindingRow, TerritoryRow } from './core/db.js';
|
|
30
31
|
import type { CommandResult } from '@deepseek-ai/dsh-commands';
|
|
@@ -32,6 +33,7 @@ import { type TargetSessionClassification } from './core/owner-binding-intent.js
|
|
|
32
33
|
export declare const name = "dsh-kingdom";
|
|
33
34
|
export declare const inject: string[];
|
|
34
35
|
export interface Config {
|
|
36
|
+
toolDisclosure?: ToolDisclosureConfig;
|
|
35
37
|
kingdomName: string;
|
|
36
38
|
ownerName: string;
|
|
37
39
|
workerProvider: string;
|
|
@@ -48,6 +50,10 @@ export interface Config {
|
|
|
48
50
|
* functions are not Config, HTTP, GUI payload, or persisted-state inputs.
|
|
49
51
|
*/
|
|
50
52
|
export interface ApplyDependencies {
|
|
53
|
+
governedPolling?: {
|
|
54
|
+
intervalMs: number;
|
|
55
|
+
maxPolls: number;
|
|
56
|
+
};
|
|
51
57
|
openLocalConsole?: (url: string) => boolean;
|
|
52
58
|
loadS4Policy?: () => Promise<{
|
|
53
59
|
sandboxPolicy: {
|
|
@@ -121,6 +127,19 @@ export declare function resolveTrustedToolSession(execution: KingdomToolExecutio
|
|
|
121
127
|
/** Validate a direct Owner Slash target without requiring current-initiator scope. */
|
|
122
128
|
export declare function validateLiveDirectSession(sessionId: string, seam: KingdomDshRegistrySeam): LiveDirectSessionResolution;
|
|
123
129
|
export declare const Config: z<Schemastery.ObjectS<{
|
|
130
|
+
toolDisclosure: z<Schemastery.ObjectS<{
|
|
131
|
+
mode: z<"off" | "pilot", "off" | "pilot">;
|
|
132
|
+
residentTools: z<string[], string[]>;
|
|
133
|
+
phaseTools: z<string[], string[]>;
|
|
134
|
+
maxResults: z<number, number>;
|
|
135
|
+
maxResultBytes: z<number, number>;
|
|
136
|
+
}>, Schemastery.ObjectT<{
|
|
137
|
+
mode: z<"off" | "pilot", "off" | "pilot">;
|
|
138
|
+
residentTools: z<string[], string[]>;
|
|
139
|
+
phaseTools: z<string[], string[]>;
|
|
140
|
+
maxResults: z<number, number>;
|
|
141
|
+
maxResultBytes: z<number, number>;
|
|
142
|
+
}>>;
|
|
124
143
|
kingdomName: z<string, string>;
|
|
125
144
|
ownerName: z<string, string>;
|
|
126
145
|
/** Worker 执行用的 subagent provider(dsh base bundle 默认注册 spawn / fork)。 */
|
|
@@ -130,7 +149,7 @@ export declare const Config: z<Schemastery.ObjectS<{
|
|
|
130
149
|
* 设为非零值即启用,只绑定 127.0.0.1。
|
|
131
150
|
*/
|
|
132
151
|
guiPort: z<number, number>;
|
|
133
|
-
/** 可选 bearer
|
|
152
|
+
/** Role GUI 可选 bearer;独立 Owner 路由使用其直接激活的短期凭据,不升级 Role 权限。 */
|
|
134
153
|
guiToken: z<string, string>;
|
|
135
154
|
/** CORS 允许的 Origin 列表;默认放开(服务只绑本机回环)。 */
|
|
136
155
|
guiAllowOrigins: z<string[], string[]>;
|
|
@@ -140,7 +159,7 @@ export declare const Config: z<Schemastery.ObjectS<{
|
|
|
140
159
|
* **不验证调用者就是该角色** —— snapshot 会如实报 `trustLevel: local-demo`。
|
|
141
160
|
* `session-bound` 额外要求调用方 session 与 binding.session_id 一致。
|
|
142
161
|
*/
|
|
143
|
-
authMode: z<"
|
|
162
|
+
authMode: z<"declarative" | "session-bound", "declarative" | "session-bound">;
|
|
144
163
|
/**
|
|
145
164
|
* v0.8(M3-S2 v6):允许对已有 v3 库执行 Schema v4 迁移。
|
|
146
165
|
* **默认 false**:正式 kingdom.db 受 Formal DB Migration Gate 保护——
|
|
@@ -148,6 +167,19 @@ export declare const Config: z<Schemastery.ObjectS<{
|
|
|
148
167
|
*/
|
|
149
168
|
migrateV4: z<boolean, boolean>;
|
|
150
169
|
}>, Schemastery.ObjectT<{
|
|
170
|
+
toolDisclosure: z<Schemastery.ObjectS<{
|
|
171
|
+
mode: z<"off" | "pilot", "off" | "pilot">;
|
|
172
|
+
residentTools: z<string[], string[]>;
|
|
173
|
+
phaseTools: z<string[], string[]>;
|
|
174
|
+
maxResults: z<number, number>;
|
|
175
|
+
maxResultBytes: z<number, number>;
|
|
176
|
+
}>, Schemastery.ObjectT<{
|
|
177
|
+
mode: z<"off" | "pilot", "off" | "pilot">;
|
|
178
|
+
residentTools: z<string[], string[]>;
|
|
179
|
+
phaseTools: z<string[], string[]>;
|
|
180
|
+
maxResults: z<number, number>;
|
|
181
|
+
maxResultBytes: z<number, number>;
|
|
182
|
+
}>>;
|
|
151
183
|
kingdomName: z<string, string>;
|
|
152
184
|
ownerName: z<string, string>;
|
|
153
185
|
/** Worker 执行用的 subagent provider(dsh base bundle 默认注册 spawn / fork)。 */
|
|
@@ -157,7 +189,7 @@ export declare const Config: z<Schemastery.ObjectS<{
|
|
|
157
189
|
* 设为非零值即启用,只绑定 127.0.0.1。
|
|
158
190
|
*/
|
|
159
191
|
guiPort: z<number, number>;
|
|
160
|
-
/** 可选 bearer
|
|
192
|
+
/** Role GUI 可选 bearer;独立 Owner 路由使用其直接激活的短期凭据,不升级 Role 权限。 */
|
|
161
193
|
guiToken: z<string, string>;
|
|
162
194
|
/** CORS 允许的 Origin 列表;默认放开(服务只绑本机回环)。 */
|
|
163
195
|
guiAllowOrigins: z<string[], string[]>;
|
|
@@ -167,7 +199,7 @@ export declare const Config: z<Schemastery.ObjectS<{
|
|
|
167
199
|
* **不验证调用者就是该角色** —— snapshot 会如实报 `trustLevel: local-demo`。
|
|
168
200
|
* `session-bound` 额外要求调用方 session 与 binding.session_id 一致。
|
|
169
201
|
*/
|
|
170
|
-
authMode: z<"
|
|
202
|
+
authMode: z<"declarative" | "session-bound", "declarative" | "session-bound">;
|
|
171
203
|
/**
|
|
172
204
|
* v0.8(M3-S2 v6):允许对已有 v3 库执行 Schema v4 迁移。
|
|
173
205
|
* **默认 false**:正式 kingdom.db 受 Formal DB Migration Gate 保护——
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { KingdomStore } from './core/db.js';
|
|
2
|
+
export interface RuntimeCostHost {
|
|
3
|
+
on?(event: string, callback: (...args: any[]) => any): () => void;
|
|
4
|
+
get(name: string): unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface DisclosureCostMeta {
|
|
7
|
+
toolsBefore: number;
|
|
8
|
+
toolsAfter: number;
|
|
9
|
+
toolsBytesBefore: number;
|
|
10
|
+
toolsBytesAfter: number;
|
|
11
|
+
mode: 'off' | 'pilot';
|
|
12
|
+
reasonCode: string | null;
|
|
13
|
+
}
|
|
14
|
+
/** Integration observer: Runtime evidence is neutral; all role attribution comes from Core bindings. */
|
|
15
|
+
export declare function installRuntimeCostObservers(host: RuntimeCostHost, store: KingdomStore, input: {
|
|
16
|
+
runtimeInstanceRef: string;
|
|
17
|
+
mode: 'off' | 'pilot';
|
|
18
|
+
disclosureMeta?: (assembly: object) => DisclosureCostMeta | undefined;
|
|
19
|
+
}): {
|
|
20
|
+
available: boolean;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { KingdomStore } from '../core/db.js';
|
|
2
|
+
import { type CommandContext } from '../core/task-service.js';
|
|
3
|
+
export interface AdvanceCollaborationInput {
|
|
4
|
+
planId: string;
|
|
5
|
+
version: number;
|
|
6
|
+
digest: string;
|
|
7
|
+
strategy: 'SERIAL' | 'PARALLEL';
|
|
8
|
+
items: {
|
|
9
|
+
taskId: string;
|
|
10
|
+
grant: Record<string, boolean>;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export interface CollaborationStartInput {
|
|
14
|
+
taskId: string;
|
|
15
|
+
grantJson: string;
|
|
16
|
+
sandboxMode: 'read-only' | 'workspace-write';
|
|
17
|
+
}
|
|
18
|
+
export interface CollaborationStartResult {
|
|
19
|
+
ok: boolean;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AdvanceCollaborationResult {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
planId: string;
|
|
25
|
+
startedTaskIds: string[];
|
|
26
|
+
failedTaskId: string | null;
|
|
27
|
+
reasonCode: string | null;
|
|
28
|
+
results: {
|
|
29
|
+
taskId: string;
|
|
30
|
+
ok: boolean;
|
|
31
|
+
message: string;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
/** One bounded batch, using current Supervisor authority and the existing governed start callback. */
|
|
35
|
+
export declare function advanceCollaboration(store: KingdomStore, currentContext: () => CommandContext | null, raw: AdvanceCollaborationInput, start: (input: CollaborationStartInput) => Promise<CollaborationStartResult>): Promise<AdvanceCollaborationResult>;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* 本文件**零 dsh 依赖**:只有类型和纯函数,因此 Task Core 与自测都不需要活的 DSH。
|
|
11
11
|
*/
|
|
12
12
|
import type { TaskRow } from '../core/db.js';
|
|
13
|
+
import type { CollaborationReadiness } from '../core/collaboration.js';
|
|
13
14
|
/**
|
|
14
15
|
* Worker 交回的结构化结果(受 subagent outputSchema 约束)。
|
|
15
16
|
*
|
|
@@ -39,6 +40,8 @@ export interface WorkerContext {
|
|
|
39
40
|
prevResultSummary?: string;
|
|
40
41
|
/** Supervisor 的 REWORK 理由(仅 REWORK 时存在)。 */
|
|
41
42
|
reworkReason?: string;
|
|
43
|
+
/** Only this task's accepted dependency references; no broadcast conversation history. */
|
|
44
|
+
collaboration?: CollaborationReadiness;
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* 一次 Worker 执行的结果,只有两种:
|
|
@@ -13,6 +13,8 @@ import type { RuntimeAdapter, RuntimeTrustFence } from '../adapter/contract.js';
|
|
|
13
13
|
import { type CleanupReceipt } from '../dispatch/service.js';
|
|
14
14
|
import type { GrantMap } from '../capability/resolver.js';
|
|
15
15
|
export interface GovernedTaskInput {
|
|
16
|
+
/** Internal current-principal check; never supplied by a model or browser. */
|
|
17
|
+
stillAuthorized?: () => boolean;
|
|
16
18
|
store: KingdomStore;
|
|
17
19
|
adapter: RuntimeAdapter;
|
|
18
20
|
kingdomId: string;
|