@atlaswork/atlascode 0.1.125 → 0.1.126

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.
Files changed (73) hide show
  1. package/dist/atlasweb-carrier.json +6 -0
  2. package/dist/cli.js +514 -18
  3. package/dist/web-session-runtime/atlascode/web/entry.d.ts +2 -0
  4. package/dist/web-session-runtime/atlascode/web/executionOutlet.d.ts +60 -0
  5. package/dist/web-session-runtime/atlascode/web/runtimeEntry.d.ts +16 -0
  6. package/dist/web-session-runtime/index.d.ts +1 -1
  7. package/dist/web-session-runtime/kernel/execution/executionOutlet.d.ts +60 -0
  8. package/dist/web-session-runtime/kernel/protocol/webExecutionV0.d.ts +542 -0
  9. package/dist/web-session-runtime/kernel/state/injection.d.ts +28 -0
  10. package/dist/web-session-runtime/kernel/state/ports.d.ts +67 -0
  11. package/dist/web-session-runtime-execution/atlascode/web/contract.d.ts +10 -0
  12. package/dist/web-session-runtime-execution/atlascode/web/cursorLedger.d.ts +63 -0
  13. package/dist/web-session-runtime-execution/atlascode/web/entry.d.ts +24 -0
  14. package/dist/web-session-runtime-execution/atlascode/web/errors.d.ts +16 -0
  15. package/dist/web-session-runtime-execution/atlascode/web/follow.d.ts +82 -0
  16. package/dist/web-session-runtime-execution/atlascode/web/limits.d.ts +63 -0
  17. package/dist/web-session-runtime-execution/atlascode/web/projection.d.ts +69 -0
  18. package/dist/web-session-runtime-execution/atlascode/web/readonlyRuntime.d.ts +156 -0
  19. package/dist/web-session-runtime-execution/atlascode/web/runtimeDefault.d.ts +26 -0
  20. package/dist/web-session-runtime-execution/atlascode/web/sessionStoreAdapter.d.ts +70 -0
  21. package/dist/web-session-runtime-execution/engine/session/env.d.ts +32 -0
  22. package/dist/web-session-runtime-execution/engine/session/firstPrompt.d.ts +21 -0
  23. package/dist/web-session-runtime-execution/engine/session/json.d.ts +27 -0
  24. package/dist/web-session-runtime-execution/engine/session/load.d.ts +88 -0
  25. package/dist/web-session-runtime-execution/engine/session/paths.d.ts +25 -0
  26. package/dist/web-session-runtime-execution/engine/session/predicates.d.ts +55 -0
  27. package/dist/web-session-runtime-execution/engine/session/readonly.d.ts +29 -0
  28. package/dist/web-session-runtime-execution/engine/session/scanner.d.ts +26 -0
  29. package/dist/web-session-runtime-execution/engine/session/search.d.ts +44 -0
  30. package/dist/web-session-runtime-execution/engine/session/types.d.ts +379 -0
  31. package/dist/web-session-runtime-execution/index.d.ts +1 -0
  32. package/dist/web-session-runtime-execution/index.js +8396 -0
  33. package/dist/web-session-runtime-execution/kernel/execution/executionOutlet.d.ts +60 -0
  34. package/dist/web-session-runtime-execution/kernel/protocol/webExecutionV0.d.ts +547 -0
  35. package/dist/web-session-runtime-execution/kernel/protocol/webSessionV0.d.ts +727 -0
  36. package/dist/web-session-runtime-execution/kernel/state/injection.d.ts +28 -0
  37. package/dist/web-session-runtime-execution/kernel/state/ports.d.ts +67 -0
  38. package/dist/web-session-runtime-execution/shared/ProductDefinition.d.ts +47 -0
  39. package/dist/web-session-runtime-execution/shared/agentRoleTemplates.d.ts +44 -0
  40. package/dist/web-session-runtime-execution/shared/agentSwarmsEnabled.d.ts +5 -0
  41. package/dist/web-session-runtime-execution/shared/boundedImageRead.d.ts +31 -0
  42. package/dist/web-session-runtime-execution/shared/circular-buffer.d.ts +42 -0
  43. package/dist/web-session-runtime-execution/shared/configDir.d.ts +57 -0
  44. package/dist/web-session-runtime-execution/shared/constants.d.ts +19 -0
  45. package/dist/web-session-runtime-execution/shared/debug.d.ts +32 -0
  46. package/dist/web-session-runtime-execution/shared/env.d.ts +38 -0
  47. package/dist/web-session-runtime-execution/shared/errors.d.ts +56 -0
  48. package/dist/web-session-runtime-execution/shared/feature.d.ts +25 -0
  49. package/dist/web-session-runtime-execution/shared/format.d.ts +11 -0
  50. package/dist/web-session-runtime-execution/shared/fs-operations.d.ts +116 -0
  51. package/dist/web-session-runtime-execution/shared/hash.d.ts +13 -0
  52. package/dist/web-session-runtime-execution/shared/identity.d.ts +23 -0
  53. package/dist/web-session-runtime-execution/shared/index.d.ts +46 -0
  54. package/dist/web-session-runtime-execution/shared/lazySchema.d.ts +12 -0
  55. package/dist/web-session-runtime-execution/shared/log.d.ts +1 -0
  56. package/dist/web-session-runtime-execution/shared/path.d.ts +22 -0
  57. package/dist/web-session-runtime-execution/shared/pdfPageImages.d.ts +19 -0
  58. package/dist/web-session-runtime-execution/shared/pdfReference.d.ts +70 -0
  59. package/dist/web-session-runtime-execution/shared/permissionDeadline.d.ts +24 -0
  60. package/dist/web-session-runtime-execution/shared/platform.d.ts +8 -0
  61. package/dist/web-session-runtime-execution/shared/stringUtils.d.ts +110 -0
  62. package/dist/web-session-runtime-execution/shared/swarmSchemaFilter.d.ts +23 -0
  63. package/dist/web-session-runtime-execution/shared/teamFileSchema.d.ts +151 -0
  64. package/dist/web-session-runtime-execution/shared/teamInboxSchema.d.ts +112 -0
  65. package/dist/web-session-runtime-execution/shared/teammateContext.d.ts +89 -0
  66. package/dist/web-session-runtime-execution/shared/tempDir.d.ts +1 -0
  67. package/dist/web-session-runtime-execution/shared/textEncoding.d.ts +41 -0
  68. package/dist/web-session-runtime-execution/shared/tokenEstimation.d.ts +36 -0
  69. package/dist/web-session-runtime-execution/shared/types-session.d.ts +266 -0
  70. package/dist/web-session-runtime-execution/shared/types.d.ts +190 -0
  71. package/dist/web-session-runtime-execution/shared/unc.d.ts +5 -0
  72. package/dist/web-session-runtime-execution/shared/windowsPaths.d.ts +24 -0
  73. package/package.json +11 -4
@@ -0,0 +1,60 @@
1
+ /**
2
+ * 执行出口 —— B0 执行出口波 S2(呈批书 §2 S2 + f4 批复条件①②)。
3
+ * 合同 docs/superpowers/specs/2026-11-20-first-wave-execution-contract.md
4
+ * §2(六命令)/ §7(组合根恰一次注入、单接触点)。
5
+ *
6
+ * 设计约束:
7
+ * - 懒触达(E1 增格,f4 批复条件②):createExecutionOutlet 构造零副作用、
8
+ * 不 boot kernel;能力开关默认 off(fail-closed),off 下六命令任一 = 拒
9
+ * (capabilityDisabled)且内核零痕迹(dispatch 零触达)。
10
+ * - kernel 侧能力开关落点 = options.isExecutionEnabled(组合根注入;
11
+ * probe 查询经此读门,泄露面仅 on/off + 受支持 v,合同 §2 审计登记 b)。
12
+ * - 薄适配:enabled 命令经 options.dispatchCommand 原样透传 kernel 命令面,
13
+ * 事件/错误原样上抛——不重写排序(cursor 唯一权威)、不改结算、
14
+ * §3 幂等与 §4/§5/§8 上限执法全归 kernel 侧(S3)。
15
+ * - 单接触点(条件①):本文件是 src 面唯一 createExecutionOutlet 定义点;
16
+ * 消费面仅 entry.ts 扩具名导出(符号级扫描腿机器判)。
17
+ * - 本文件 import 面 = webExecutionV0 唯一(零 engine/kernel 状态导入,
18
+ * 懒触达由加载图保证,非仅运行时纪律)。
19
+ */
20
+ import { EXECUTION_PROTOCOL_VERSION, type ExecutionReplay, type WebExecutionCommand, type WebExecutionError, type WebExecutionEvent } from '../protocol/webExecutionV0.js';
21
+ /** capability.probe 应答:泄露面仅 on/off + 受支持 v(合同 §2 审计登记 b)。 */
22
+ export type WebExecutionProbeResult = {
23
+ type: 'capability.probe';
24
+ enabled: boolean;
25
+ protocolVersion: typeof EXECUTION_PROTOCOL_VERSION;
26
+ };
27
+ export type ExecutionDispatchResult = WebExecutionEvent | WebExecutionError;
28
+ export type ExecutionOutletOptions = {
29
+ /** kernel 侧能力开关读门(默认 off = fail-closed;组合根注入,S3 接线)。 */
30
+ isExecutionEnabled?: () => boolean;
31
+ /** kernel 命令面薄适配(唯一 kernel 触达缝;事件/错误原样上抛)。 */
32
+ dispatchCommand: (command: WebExecutionCommand) => Promise<ExecutionDispatchResult>;
33
+ /**
34
+ * §6 follow 恢复缝(S4):kernel.replaySince 直通(不经 dispatch)。
35
+ * 缺省 = off 车道恒拒。
36
+ */
37
+ resumeExecution?: (bind: {
38
+ workspaceId: string;
39
+ sessionId: string;
40
+ }, cursor?: string) => ExecutionReplay;
41
+ };
42
+ export type ExecutionHandleResult = ExecutionDispatchResult | WebExecutionProbeResult | ExecutionReplay;
43
+ export type ExecutionOutlet = {
44
+ /** 能力探针:不经 dispatch(kernel 零痕迹),仅读门求值。 */
45
+ probe: () => WebExecutionProbeResult;
46
+ /**
47
+ * 六命令统一入口:probe=off 下 probe 外五命令一律 capabilityDisabled 拒
48
+ * 且 dispatch 零触达;on 下薄适配透传。
49
+ */
50
+ handle: (command: WebExecutionCommand) => Promise<ExecutionHandleResult>;
51
+ /**
52
+ * §6 follow 恢复(S4):off = capabilityDisabled 拒且内核零痕迹;on =
53
+ * kernel.replaySince 透传(baseline/delta/expired 三态,增量恰一次)。
54
+ */
55
+ followResume: (bind: {
56
+ workspaceId: string;
57
+ sessionId: string;
58
+ }, cursor?: string) => ExecutionReplay | WebExecutionError;
59
+ };
60
+ export declare function createExecutionOutlet(options: ExecutionOutletOptions): ExecutionOutlet;
@@ -0,0 +1,547 @@
1
+ /**
2
+ * Web execution contract v0 —— B0 执行出口波 S2 单源公共契约。
3
+ * 呈批书 docs/2026-11-21-execution-outlet-wave-lockface-brief.md §2 S2
4
+ * (f4 批复六条件 @a62925c0,条件①②随本源落格);
5
+ * 合同 docs/superpowers/specs/2026-11-20-first-wave-execution-contract.md §2。
6
+ *
7
+ * 本文件为执行出口协议唯一源(沿 kernel/protocol/webSessionV0.ts 同法):
8
+ * - import 面 = zod/v4 唯一(格 C 闭包);零仓库内 / Node 内建 / UI 反向导入。
9
+ * - strictObject 全覆盖(未知字段拒 = fail-closed);ID = 非空 ≤128 opaque 串。
10
+ * - 协议版本分域:schemaVersion=0(消息形)/ protocolVersion='v0'(配对域)。
11
+ * - 信任级(合同 §2 审计登记 a):ts 仅信息性,绝不参与结算/排序/授权——
12
+ * 排序以 cursor 为唯一权威,身份以 bind 三元组为准,时钟一律服务端。
13
+ * - 事件 payload 取 S2 最小 strict 形(turn 域事件以 bind.turnId 绑定,同
14
+ * 「全部携带与命令相同的 bind」);schema 演进经 schemaVersion 分域升级,
15
+ * 不在本源内静默扩字段。
16
+ * - 幂等键 (workspaceId, sessionId, submitId) 与 §4/§5/§8 状态机/上限执法
17
+ * 归 kernel 侧(S3),本源只锁 wire 形。
18
+ */
19
+ import { z } from 'zod/v4';
20
+ export declare const EXECUTION_SCHEMA_VERSION = 0;
21
+ export declare const EXECUTION_PROTOCOL_VERSION = "v0";
22
+ /** 非空 ≤128 的 opaque 标识(同 webSessionV0 词汇)。 */
23
+ export declare const ExecutionOpaqueIdSchema: z.ZodString;
24
+ /** Opaque 游标 token;cursor 是事件唯一排序权威(合同 §2/§6)。 */
25
+ export declare const ExecutionCursorSchema: z.ZodString;
26
+ /** bind 三元组:身份以 bind 为准(审计登记 a);turnId 域命令必填面见各命令。 */
27
+ export declare const ExecutionBindSchema: z.ZodObject<{
28
+ workspaceId: z.ZodString;
29
+ sessionId: z.ZodString;
30
+ turnId: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strict>;
32
+ export declare const CapabilityProbeCommandSchema: z.ZodObject<{
33
+ type: z.ZodLiteral<"capability.probe">;
34
+ payload: z.ZodObject<{}, z.core.$strict>;
35
+ v: z.ZodLiteral<0>;
36
+ id: z.ZodUUID;
37
+ ts: z.ZodNumber;
38
+ bind: z.ZodObject<{
39
+ workspaceId: z.ZodString;
40
+ sessionId: z.ZodString;
41
+ turnId: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strict>;
43
+ }, z.core.$strict>;
44
+ export declare const TurnSubmitCommandSchema: z.ZodObject<{
45
+ type: z.ZodLiteral<"turn.submit">;
46
+ payload: z.ZodObject<{
47
+ submitId: z.ZodUUID;
48
+ text: z.ZodString;
49
+ }, z.core.$strict>;
50
+ v: z.ZodLiteral<0>;
51
+ id: z.ZodUUID;
52
+ ts: z.ZodNumber;
53
+ bind: z.ZodObject<{
54
+ workspaceId: z.ZodString;
55
+ sessionId: z.ZodString;
56
+ turnId: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strict>;
58
+ }, z.core.$strict>;
59
+ export declare const TurnCancelCommandSchema: z.ZodObject<{
60
+ type: z.ZodLiteral<"turn.cancel">;
61
+ payload: z.ZodObject<{
62
+ targetTurnId: z.ZodString;
63
+ }, z.core.$strict>;
64
+ v: z.ZodLiteral<0>;
65
+ id: z.ZodUUID;
66
+ ts: z.ZodNumber;
67
+ bind: z.ZodObject<{
68
+ workspaceId: z.ZodString;
69
+ sessionId: z.ZodString;
70
+ turnId: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strict>;
72
+ }, z.core.$strict>;
73
+ /** queue.remove 语义 ≡ turn.cancel(queued):落 cancelled 终态,不静默移除(审计必改 1)。 */
74
+ export declare const QueueRemoveCommandSchema: z.ZodObject<{
75
+ type: z.ZodLiteral<"queue.remove">;
76
+ payload: z.ZodObject<{
77
+ targetTurnId: z.ZodString;
78
+ }, z.core.$strict>;
79
+ v: z.ZodLiteral<0>;
80
+ id: z.ZodUUID;
81
+ ts: z.ZodNumber;
82
+ bind: z.ZodObject<{
83
+ workspaceId: z.ZodString;
84
+ sessionId: z.ZodString;
85
+ turnId: z.ZodOptional<z.ZodString>;
86
+ }, z.core.$strict>;
87
+ }, z.core.$strict>;
88
+ /** decide 归属绑定:bind 须含 turnId 且 ≡ approval.requested 归属 turn(审计必改 2)。 */
89
+ export declare const ApprovalDecideCommandSchema: z.ZodObject<{
90
+ bind: z.ZodObject<{
91
+ workspaceId: z.ZodString;
92
+ sessionId: z.ZodString;
93
+ turnId: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
94
+ }, z.core.$strict>;
95
+ type: z.ZodLiteral<"approval.decide">;
96
+ payload: z.ZodObject<{
97
+ approvalId: z.ZodString;
98
+ decision: z.ZodEnum<{
99
+ approved: "approved";
100
+ denied: "denied";
101
+ }>;
102
+ }, z.core.$strict>;
103
+ v: z.ZodLiteral<0>;
104
+ id: z.ZodUUID;
105
+ ts: z.ZodNumber;
106
+ }, z.core.$strict>;
107
+ export declare const FollowResumeCommandSchema: z.ZodObject<{
108
+ type: z.ZodLiteral<"follow.resume">;
109
+ payload: z.ZodObject<{
110
+ cursor: z.ZodOptional<z.ZodString>;
111
+ }, z.core.$strict>;
112
+ v: z.ZodLiteral<0>;
113
+ id: z.ZodUUID;
114
+ ts: z.ZodNumber;
115
+ bind: z.ZodObject<{
116
+ workspaceId: z.ZodString;
117
+ sessionId: z.ZodString;
118
+ turnId: z.ZodOptional<z.ZodString>;
119
+ }, z.core.$strict>;
120
+ }, z.core.$strict>;
121
+ export declare const WebExecutionCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
122
+ type: z.ZodLiteral<"capability.probe">;
123
+ payload: z.ZodObject<{}, z.core.$strict>;
124
+ v: z.ZodLiteral<0>;
125
+ id: z.ZodUUID;
126
+ ts: z.ZodNumber;
127
+ bind: z.ZodObject<{
128
+ workspaceId: z.ZodString;
129
+ sessionId: z.ZodString;
130
+ turnId: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strict>;
132
+ }, z.core.$strict>, z.ZodObject<{
133
+ type: z.ZodLiteral<"turn.submit">;
134
+ payload: z.ZodObject<{
135
+ submitId: z.ZodUUID;
136
+ text: z.ZodString;
137
+ }, z.core.$strict>;
138
+ v: z.ZodLiteral<0>;
139
+ id: z.ZodUUID;
140
+ ts: z.ZodNumber;
141
+ bind: z.ZodObject<{
142
+ workspaceId: z.ZodString;
143
+ sessionId: z.ZodString;
144
+ turnId: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strict>;
146
+ }, z.core.$strict>, z.ZodObject<{
147
+ type: z.ZodLiteral<"turn.cancel">;
148
+ payload: z.ZodObject<{
149
+ targetTurnId: z.ZodString;
150
+ }, z.core.$strict>;
151
+ v: z.ZodLiteral<0>;
152
+ id: z.ZodUUID;
153
+ ts: z.ZodNumber;
154
+ bind: z.ZodObject<{
155
+ workspaceId: z.ZodString;
156
+ sessionId: z.ZodString;
157
+ turnId: z.ZodOptional<z.ZodString>;
158
+ }, z.core.$strict>;
159
+ }, z.core.$strict>, z.ZodObject<{
160
+ type: z.ZodLiteral<"queue.remove">;
161
+ payload: z.ZodObject<{
162
+ targetTurnId: z.ZodString;
163
+ }, z.core.$strict>;
164
+ v: z.ZodLiteral<0>;
165
+ id: z.ZodUUID;
166
+ ts: z.ZodNumber;
167
+ bind: z.ZodObject<{
168
+ workspaceId: z.ZodString;
169
+ sessionId: z.ZodString;
170
+ turnId: z.ZodOptional<z.ZodString>;
171
+ }, z.core.$strict>;
172
+ }, z.core.$strict>, z.ZodObject<{
173
+ bind: z.ZodObject<{
174
+ workspaceId: z.ZodString;
175
+ sessionId: z.ZodString;
176
+ turnId: z.ZodNonOptional<z.ZodOptional<z.ZodString>>;
177
+ }, z.core.$strict>;
178
+ type: z.ZodLiteral<"approval.decide">;
179
+ payload: z.ZodObject<{
180
+ approvalId: z.ZodString;
181
+ decision: z.ZodEnum<{
182
+ approved: "approved";
183
+ denied: "denied";
184
+ }>;
185
+ }, z.core.$strict>;
186
+ v: z.ZodLiteral<0>;
187
+ id: z.ZodUUID;
188
+ ts: z.ZodNumber;
189
+ }, z.core.$strict>, z.ZodObject<{
190
+ type: z.ZodLiteral<"follow.resume">;
191
+ payload: z.ZodObject<{
192
+ cursor: z.ZodOptional<z.ZodString>;
193
+ }, z.core.$strict>;
194
+ v: z.ZodLiteral<0>;
195
+ id: z.ZodUUID;
196
+ ts: z.ZodNumber;
197
+ bind: z.ZodObject<{
198
+ workspaceId: z.ZodString;
199
+ sessionId: z.ZodString;
200
+ turnId: z.ZodOptional<z.ZodString>;
201
+ }, z.core.$strict>;
202
+ }, z.core.$strict>], "type">;
203
+ export declare const WebExecutionErrorSchema: z.ZodObject<{
204
+ code: z.ZodString;
205
+ message: z.ZodString;
206
+ retryable: z.ZodBoolean;
207
+ }, z.core.$strict>;
208
+ /** 出口面默认拒(能力开关 off)专用 code —— E1 增格落点(f4 批复条件②)。 */
209
+ export declare const EXECUTION_CAPABILITY_DISABLED_CODE = "capabilityDisabled";
210
+ export declare const TurnAcceptedEventSchema: z.ZodObject<{
211
+ type: z.ZodLiteral<"turn.accepted">;
212
+ payload: z.ZodObject<{
213
+ submitId: z.ZodUUID;
214
+ }, z.core.$strict>;
215
+ cursor: z.ZodString;
216
+ v: z.ZodLiteral<0>;
217
+ id: z.ZodUUID;
218
+ ts: z.ZodNumber;
219
+ bind: z.ZodObject<{
220
+ workspaceId: z.ZodString;
221
+ sessionId: z.ZodString;
222
+ turnId: z.ZodOptional<z.ZodString>;
223
+ }, z.core.$strict>;
224
+ }, z.core.$strict>;
225
+ export declare const TurnStartedEventSchema: z.ZodObject<{
226
+ type: z.ZodLiteral<"turn.started">;
227
+ payload: z.ZodObject<{}, z.core.$strict>;
228
+ cursor: z.ZodString;
229
+ v: z.ZodLiteral<0>;
230
+ id: z.ZodUUID;
231
+ ts: z.ZodNumber;
232
+ bind: z.ZodObject<{
233
+ workspaceId: z.ZodString;
234
+ sessionId: z.ZodString;
235
+ turnId: z.ZodOptional<z.ZodString>;
236
+ }, z.core.$strict>;
237
+ }, z.core.$strict>;
238
+ export declare const TurnDeltaEventSchema: z.ZodObject<{
239
+ type: z.ZodLiteral<"turn.delta">;
240
+ payload: z.ZodObject<{
241
+ text: z.ZodString;
242
+ }, z.core.$strict>;
243
+ cursor: z.ZodString;
244
+ v: z.ZodLiteral<0>;
245
+ id: z.ZodUUID;
246
+ ts: z.ZodNumber;
247
+ bind: z.ZodObject<{
248
+ workspaceId: z.ZodString;
249
+ sessionId: z.ZodString;
250
+ turnId: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strict>;
252
+ }, z.core.$strict>;
253
+ export declare const TurnCompletedEventSchema: z.ZodObject<{
254
+ type: z.ZodLiteral<"turn.completed">;
255
+ payload: z.ZodObject<{}, z.core.$strict>;
256
+ cursor: z.ZodString;
257
+ v: z.ZodLiteral<0>;
258
+ id: z.ZodUUID;
259
+ ts: z.ZodNumber;
260
+ bind: z.ZodObject<{
261
+ workspaceId: z.ZodString;
262
+ sessionId: z.ZodString;
263
+ turnId: z.ZodOptional<z.ZodString>;
264
+ }, z.core.$strict>;
265
+ }, z.core.$strict>;
266
+ export declare const TurnFailedEventSchema: z.ZodObject<{
267
+ type: z.ZodLiteral<"turn.failed">;
268
+ payload: z.ZodObject<{
269
+ message: z.ZodString;
270
+ }, z.core.$strict>;
271
+ cursor: z.ZodString;
272
+ v: z.ZodLiteral<0>;
273
+ id: z.ZodUUID;
274
+ ts: z.ZodNumber;
275
+ bind: z.ZodObject<{
276
+ workspaceId: z.ZodString;
277
+ sessionId: z.ZodString;
278
+ turnId: z.ZodOptional<z.ZodString>;
279
+ }, z.core.$strict>;
280
+ }, z.core.$strict>;
281
+ export declare const TurnCancelledEventSchema: z.ZodObject<{
282
+ type: z.ZodLiteral<"turn.cancelled">;
283
+ payload: z.ZodObject<{}, z.core.$strict>;
284
+ cursor: z.ZodString;
285
+ v: z.ZodLiteral<0>;
286
+ id: z.ZodUUID;
287
+ ts: z.ZodNumber;
288
+ bind: z.ZodObject<{
289
+ workspaceId: z.ZodString;
290
+ sessionId: z.ZodString;
291
+ turnId: z.ZodOptional<z.ZodString>;
292
+ }, z.core.$strict>;
293
+ }, z.core.$strict>;
294
+ export declare const ApprovalRequestedEventSchema: z.ZodObject<{
295
+ type: z.ZodLiteral<"approval.requested">;
296
+ payload: z.ZodObject<{
297
+ approvalId: z.ZodString;
298
+ }, z.core.$strict>;
299
+ cursor: z.ZodString;
300
+ v: z.ZodLiteral<0>;
301
+ id: z.ZodUUID;
302
+ ts: z.ZodNumber;
303
+ bind: z.ZodObject<{
304
+ workspaceId: z.ZodString;
305
+ sessionId: z.ZodString;
306
+ turnId: z.ZodOptional<z.ZodString>;
307
+ }, z.core.$strict>;
308
+ }, z.core.$strict>;
309
+ /**
310
+ * 有效决定恰一个(§4):approved | denied | expired | voidedByCancel。
311
+ * settled payload 携 actorId + timestamp(f4 S2 抽验裁定 @2026-11-21):
312
+ * §5 证据记录七字段中服务端产两字段经本事件上抛(B 附表 §3 actorId 展示值
313
+ * 取自 approval.settled,不本地推断);actorId = 服务端解析的连接身份,
314
+ * timestamp = 服务端时钟(与信封 ts 同信任级:仅展示/互证,不参与结算)。
315
+ */
316
+ export declare const ApprovalSettledEventSchema: z.ZodObject<{
317
+ type: z.ZodLiteral<"approval.settled">;
318
+ payload: z.ZodObject<{
319
+ approvalId: z.ZodString;
320
+ decision: z.ZodEnum<{
321
+ expired: "expired";
322
+ approved: "approved";
323
+ denied: "denied";
324
+ voidedByCancel: "voidedByCancel";
325
+ }>;
326
+ actorId: z.ZodString;
327
+ timestamp: z.ZodNumber;
328
+ }, z.core.$strict>;
329
+ cursor: z.ZodString;
330
+ v: z.ZodLiteral<0>;
331
+ id: z.ZodUUID;
332
+ ts: z.ZodNumber;
333
+ bind: z.ZodObject<{
334
+ workspaceId: z.ZodString;
335
+ sessionId: z.ZodString;
336
+ turnId: z.ZodOptional<z.ZodString>;
337
+ }, z.core.$strict>;
338
+ }, z.core.$strict>;
339
+ export declare const QueueUpdatedEventSchema: z.ZodObject<{
340
+ type: z.ZodLiteral<"queue.updated">;
341
+ payload: z.ZodObject<{
342
+ depth: z.ZodNumber;
343
+ }, z.core.$strict>;
344
+ cursor: z.ZodString;
345
+ v: z.ZodLiteral<0>;
346
+ id: z.ZodUUID;
347
+ ts: z.ZodNumber;
348
+ bind: z.ZodObject<{
349
+ workspaceId: z.ZodString;
350
+ sessionId: z.ZodString;
351
+ turnId: z.ZodOptional<z.ZodString>;
352
+ }, z.core.$strict>;
353
+ }, z.core.$strict>;
354
+ export declare const ErrorEventSchema: z.ZodObject<{
355
+ type: z.ZodLiteral<"error">;
356
+ payload: z.ZodObject<{
357
+ error: z.ZodObject<{
358
+ code: z.ZodString;
359
+ message: z.ZodString;
360
+ retryable: z.ZodBoolean;
361
+ }, z.core.$strict>;
362
+ }, z.core.$strict>;
363
+ cursor: z.ZodString;
364
+ v: z.ZodLiteral<0>;
365
+ id: z.ZodUUID;
366
+ ts: z.ZodNumber;
367
+ bind: z.ZodObject<{
368
+ workspaceId: z.ZodString;
369
+ sessionId: z.ZodString;
370
+ turnId: z.ZodOptional<z.ZodString>;
371
+ }, z.core.$strict>;
372
+ }, z.core.$strict>;
373
+ export declare const WebExecutionEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
374
+ type: z.ZodLiteral<"turn.accepted">;
375
+ payload: z.ZodObject<{
376
+ submitId: z.ZodUUID;
377
+ }, z.core.$strict>;
378
+ cursor: z.ZodString;
379
+ v: z.ZodLiteral<0>;
380
+ id: z.ZodUUID;
381
+ ts: z.ZodNumber;
382
+ bind: z.ZodObject<{
383
+ workspaceId: z.ZodString;
384
+ sessionId: z.ZodString;
385
+ turnId: z.ZodOptional<z.ZodString>;
386
+ }, z.core.$strict>;
387
+ }, z.core.$strict>, z.ZodObject<{
388
+ type: z.ZodLiteral<"turn.started">;
389
+ payload: z.ZodObject<{}, z.core.$strict>;
390
+ cursor: z.ZodString;
391
+ v: z.ZodLiteral<0>;
392
+ id: z.ZodUUID;
393
+ ts: z.ZodNumber;
394
+ bind: z.ZodObject<{
395
+ workspaceId: z.ZodString;
396
+ sessionId: z.ZodString;
397
+ turnId: z.ZodOptional<z.ZodString>;
398
+ }, z.core.$strict>;
399
+ }, z.core.$strict>, z.ZodObject<{
400
+ type: z.ZodLiteral<"turn.delta">;
401
+ payload: z.ZodObject<{
402
+ text: z.ZodString;
403
+ }, z.core.$strict>;
404
+ cursor: z.ZodString;
405
+ v: z.ZodLiteral<0>;
406
+ id: z.ZodUUID;
407
+ ts: z.ZodNumber;
408
+ bind: z.ZodObject<{
409
+ workspaceId: z.ZodString;
410
+ sessionId: z.ZodString;
411
+ turnId: z.ZodOptional<z.ZodString>;
412
+ }, z.core.$strict>;
413
+ }, z.core.$strict>, z.ZodObject<{
414
+ type: z.ZodLiteral<"turn.completed">;
415
+ payload: z.ZodObject<{}, z.core.$strict>;
416
+ cursor: z.ZodString;
417
+ v: z.ZodLiteral<0>;
418
+ id: z.ZodUUID;
419
+ ts: z.ZodNumber;
420
+ bind: z.ZodObject<{
421
+ workspaceId: z.ZodString;
422
+ sessionId: z.ZodString;
423
+ turnId: z.ZodOptional<z.ZodString>;
424
+ }, z.core.$strict>;
425
+ }, z.core.$strict>, z.ZodObject<{
426
+ type: z.ZodLiteral<"turn.failed">;
427
+ payload: z.ZodObject<{
428
+ message: z.ZodString;
429
+ }, z.core.$strict>;
430
+ cursor: z.ZodString;
431
+ v: z.ZodLiteral<0>;
432
+ id: z.ZodUUID;
433
+ ts: z.ZodNumber;
434
+ bind: z.ZodObject<{
435
+ workspaceId: z.ZodString;
436
+ sessionId: z.ZodString;
437
+ turnId: z.ZodOptional<z.ZodString>;
438
+ }, z.core.$strict>;
439
+ }, z.core.$strict>, z.ZodObject<{
440
+ type: z.ZodLiteral<"turn.cancelled">;
441
+ payload: z.ZodObject<{}, z.core.$strict>;
442
+ cursor: z.ZodString;
443
+ v: z.ZodLiteral<0>;
444
+ id: z.ZodUUID;
445
+ ts: z.ZodNumber;
446
+ bind: z.ZodObject<{
447
+ workspaceId: z.ZodString;
448
+ sessionId: z.ZodString;
449
+ turnId: z.ZodOptional<z.ZodString>;
450
+ }, z.core.$strict>;
451
+ }, z.core.$strict>, z.ZodObject<{
452
+ type: z.ZodLiteral<"approval.requested">;
453
+ payload: z.ZodObject<{
454
+ approvalId: z.ZodString;
455
+ }, z.core.$strict>;
456
+ cursor: z.ZodString;
457
+ v: z.ZodLiteral<0>;
458
+ id: z.ZodUUID;
459
+ ts: z.ZodNumber;
460
+ bind: z.ZodObject<{
461
+ workspaceId: z.ZodString;
462
+ sessionId: z.ZodString;
463
+ turnId: z.ZodOptional<z.ZodString>;
464
+ }, z.core.$strict>;
465
+ }, z.core.$strict>, z.ZodObject<{
466
+ type: z.ZodLiteral<"approval.settled">;
467
+ payload: z.ZodObject<{
468
+ approvalId: z.ZodString;
469
+ decision: z.ZodEnum<{
470
+ expired: "expired";
471
+ approved: "approved";
472
+ denied: "denied";
473
+ voidedByCancel: "voidedByCancel";
474
+ }>;
475
+ actorId: z.ZodString;
476
+ timestamp: z.ZodNumber;
477
+ }, z.core.$strict>;
478
+ cursor: z.ZodString;
479
+ v: z.ZodLiteral<0>;
480
+ id: z.ZodUUID;
481
+ ts: z.ZodNumber;
482
+ bind: z.ZodObject<{
483
+ workspaceId: z.ZodString;
484
+ sessionId: z.ZodString;
485
+ turnId: z.ZodOptional<z.ZodString>;
486
+ }, z.core.$strict>;
487
+ }, z.core.$strict>, z.ZodObject<{
488
+ type: z.ZodLiteral<"queue.updated">;
489
+ payload: z.ZodObject<{
490
+ depth: z.ZodNumber;
491
+ }, z.core.$strict>;
492
+ cursor: z.ZodString;
493
+ v: z.ZodLiteral<0>;
494
+ id: z.ZodUUID;
495
+ ts: z.ZodNumber;
496
+ bind: z.ZodObject<{
497
+ workspaceId: z.ZodString;
498
+ sessionId: z.ZodString;
499
+ turnId: z.ZodOptional<z.ZodString>;
500
+ }, z.core.$strict>;
501
+ }, z.core.$strict>, z.ZodObject<{
502
+ type: z.ZodLiteral<"error">;
503
+ payload: z.ZodObject<{
504
+ error: z.ZodObject<{
505
+ code: z.ZodString;
506
+ message: z.ZodString;
507
+ retryable: z.ZodBoolean;
508
+ }, z.core.$strict>;
509
+ }, z.core.$strict>;
510
+ cursor: z.ZodString;
511
+ v: z.ZodLiteral<0>;
512
+ id: z.ZodUUID;
513
+ ts: z.ZodNumber;
514
+ bind: z.ZodObject<{
515
+ workspaceId: z.ZodString;
516
+ sessionId: z.ZodString;
517
+ turnId: z.ZodOptional<z.ZodString>;
518
+ }, z.core.$strict>;
519
+ }, z.core.$strict>], "type">;
520
+ /**
521
+ * §6 follow 恢复原语结果(S4):按当前订阅代采信、增量恰一次、过期 → 基线
522
+ * 替换信号(不合并旧事件)。baseline = 初始跟随(投影走持久化回读,SSE 仅
523
+ * 视图);delta = cursor 后增量(不重不漏);expired = cursor 不在缓冲/
524
+ * 溢出丢弃/外来未来 cursor(fail-closed)。型归协议文件以保出口 import 闭包。
525
+ *
526
+ * f4 S4 修正裁定(wire 形):follow.resume 命令响应与本原语同形归一(完整
527
+ * 三态,不并存两形)。baseline 语义明示:**执行流基线为空**(events=[] +
528
+ * headCursor)——内容基线经只读 replay 面重读;基线替换 = 重读持久态 +
529
+ * 自 headCursor 收增量(B1 adapter 按此消费)。
530
+ */
531
+ export type ExecutionReplay = {
532
+ kind: 'baseline';
533
+ events: [];
534
+ headCursor: string;
535
+ } | {
536
+ kind: 'delta';
537
+ events: WebExecutionEvent[];
538
+ headCursor: string;
539
+ } | {
540
+ kind: 'expired';
541
+ events: [];
542
+ headCursor: string;
543
+ };
544
+ export type ExecutionBind = z.infer<typeof ExecutionBindSchema>;
545
+ export type WebExecutionCommand = z.infer<typeof WebExecutionCommandSchema>;
546
+ export type WebExecutionEvent = z.infer<typeof WebExecutionEventSchema>;
547
+ export type WebExecutionError = z.infer<typeof WebExecutionErrorSchema>;