@locusai/shared 0.11.5 → 0.11.7
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/dist/__tests__/protocol-contracts.test.d.ts +2 -0
- package/dist/__tests__/protocol-contracts.test.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +601 -0
- package/dist/protocol/cli-stream.d.ts +270 -0
- package/dist/protocol/cli-stream.d.ts.map +1 -0
- package/dist/protocol/context.d.ts +55 -0
- package/dist/protocol/context.d.ts.map +1 -0
- package/dist/protocol/envelope.d.ts +14 -0
- package/dist/protocol/envelope.d.ts.map +1 -0
- package/dist/protocol/errors.d.ts +44 -0
- package/dist/protocol/errors.d.ts.map +1 -0
- package/dist/protocol/helpers.d.ts +58 -0
- package/dist/protocol/helpers.d.ts.map +1 -0
- package/dist/protocol/host-events.d.ts +354 -0
- package/dist/protocol/host-events.d.ts.map +1 -0
- package/dist/protocol/index.d.ts +9 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/session.d.ts +97 -0
- package/dist/protocol/session.d.ts.map +1 -0
- package/dist/protocol/ui-intents.d.ts +165 -0
- package/dist/protocol/ui-intents.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const HostEventType: {
|
|
3
|
+
readonly SESSION_STATE: "session_state";
|
|
4
|
+
readonly TEXT_DELTA: "text_delta";
|
|
5
|
+
readonly TOOL_STARTED: "tool_started";
|
|
6
|
+
readonly TOOL_COMPLETED: "tool_completed";
|
|
7
|
+
readonly THINKING: "thinking";
|
|
8
|
+
readonly ERROR: "error";
|
|
9
|
+
readonly SESSION_LIST: "session_list";
|
|
10
|
+
readonly SESSION_COMPLETED: "session_completed";
|
|
11
|
+
};
|
|
12
|
+
export type HostEventType = (typeof HostEventType)[keyof typeof HostEventType];
|
|
13
|
+
export declare const HostEventTypeSchema: z.ZodEnum<{
|
|
14
|
+
readonly SESSION_STATE: "session_state";
|
|
15
|
+
readonly TEXT_DELTA: "text_delta";
|
|
16
|
+
readonly TOOL_STARTED: "tool_started";
|
|
17
|
+
readonly TOOL_COMPLETED: "tool_completed";
|
|
18
|
+
readonly THINKING: "thinking";
|
|
19
|
+
readonly ERROR: "error";
|
|
20
|
+
readonly SESSION_LIST: "session_list";
|
|
21
|
+
readonly SESSION_COMPLETED: "session_completed";
|
|
22
|
+
}>;
|
|
23
|
+
export declare const TimelineEntryKind: {
|
|
24
|
+
readonly MESSAGE: "message";
|
|
25
|
+
readonly TOOL_CALL: "tool_call";
|
|
26
|
+
readonly STATUS: "status";
|
|
27
|
+
readonly ERROR: "error";
|
|
28
|
+
readonly DONE: "done";
|
|
29
|
+
};
|
|
30
|
+
export type TimelineEntryKind = (typeof TimelineEntryKind)[keyof typeof TimelineEntryKind];
|
|
31
|
+
export declare const TimelineEntryKindSchema: z.ZodEnum<{
|
|
32
|
+
readonly MESSAGE: "message";
|
|
33
|
+
readonly TOOL_CALL: "tool_call";
|
|
34
|
+
readonly STATUS: "status";
|
|
35
|
+
readonly ERROR: "error";
|
|
36
|
+
readonly DONE: "done";
|
|
37
|
+
}>;
|
|
38
|
+
export declare const TimelineEntrySchema: z.ZodObject<{
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
kind: z.ZodEnum<{
|
|
41
|
+
readonly MESSAGE: "message";
|
|
42
|
+
readonly TOOL_CALL: "tool_call";
|
|
43
|
+
readonly STATUS: "status";
|
|
44
|
+
readonly ERROR: "error";
|
|
45
|
+
readonly DONE: "done";
|
|
46
|
+
}>;
|
|
47
|
+
timestamp: z.ZodNumber;
|
|
48
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type TimelineEntry = z.infer<typeof TimelineEntrySchema>;
|
|
51
|
+
export declare const SessionStateEventSchema: z.ZodObject<{
|
|
52
|
+
protocol: z.ZodLiteral<1>;
|
|
53
|
+
type: z.ZodLiteral<"session_state">;
|
|
54
|
+
payload: z.ZodObject<{
|
|
55
|
+
sessionId: z.ZodString;
|
|
56
|
+
status: z.ZodEnum<{
|
|
57
|
+
readonly IDLE: "idle";
|
|
58
|
+
readonly STARTING: "starting";
|
|
59
|
+
readonly RUNNING: "running";
|
|
60
|
+
readonly STREAMING: "streaming";
|
|
61
|
+
readonly COMPLETED: "completed";
|
|
62
|
+
readonly CANCELED: "canceled";
|
|
63
|
+
readonly INTERRUPTED: "interrupted";
|
|
64
|
+
readonly FAILED: "failed";
|
|
65
|
+
readonly RESUMING: "resuming";
|
|
66
|
+
}>;
|
|
67
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
68
|
+
sessionId: z.ZodString;
|
|
69
|
+
status: z.ZodEnum<{
|
|
70
|
+
readonly IDLE: "idle";
|
|
71
|
+
readonly STARTING: "starting";
|
|
72
|
+
readonly RUNNING: "running";
|
|
73
|
+
readonly STREAMING: "streaming";
|
|
74
|
+
readonly COMPLETED: "completed";
|
|
75
|
+
readonly CANCELED: "canceled";
|
|
76
|
+
readonly INTERRUPTED: "interrupted";
|
|
77
|
+
readonly FAILED: "failed";
|
|
78
|
+
readonly RESUMING: "resuming";
|
|
79
|
+
}>;
|
|
80
|
+
model: z.ZodOptional<z.ZodString>;
|
|
81
|
+
createdAt: z.ZodNumber;
|
|
82
|
+
updatedAt: z.ZodNumber;
|
|
83
|
+
title: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
timeline: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
kind: z.ZodEnum<{
|
|
88
|
+
readonly MESSAGE: "message";
|
|
89
|
+
readonly TOOL_CALL: "tool_call";
|
|
90
|
+
readonly STATUS: "status";
|
|
91
|
+
readonly ERROR: "error";
|
|
92
|
+
readonly DONE: "done";
|
|
93
|
+
}>;
|
|
94
|
+
timestamp: z.ZodNumber;
|
|
95
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
96
|
+
}, z.core.$strip>>>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export type SessionStateEvent = z.infer<typeof SessionStateEventSchema>;
|
|
100
|
+
export declare const TextDeltaEventSchema: z.ZodObject<{
|
|
101
|
+
protocol: z.ZodLiteral<1>;
|
|
102
|
+
type: z.ZodLiteral<"text_delta">;
|
|
103
|
+
payload: z.ZodObject<{
|
|
104
|
+
sessionId: z.ZodString;
|
|
105
|
+
content: z.ZodString;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
export type TextDeltaEvent = z.infer<typeof TextDeltaEventSchema>;
|
|
109
|
+
export declare const ToolStartedEventSchema: z.ZodObject<{
|
|
110
|
+
protocol: z.ZodLiteral<1>;
|
|
111
|
+
type: z.ZodLiteral<"tool_started">;
|
|
112
|
+
payload: z.ZodObject<{
|
|
113
|
+
sessionId: z.ZodString;
|
|
114
|
+
tool: z.ZodString;
|
|
115
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
116
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
}, z.core.$strip>;
|
|
119
|
+
export type ToolStartedEvent = z.infer<typeof ToolStartedEventSchema>;
|
|
120
|
+
export declare const ToolCompletedEventSchema: z.ZodObject<{
|
|
121
|
+
protocol: z.ZodLiteral<1>;
|
|
122
|
+
type: z.ZodLiteral<"tool_completed">;
|
|
123
|
+
payload: z.ZodObject<{
|
|
124
|
+
sessionId: z.ZodString;
|
|
125
|
+
tool: z.ZodString;
|
|
126
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
127
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
128
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
success: z.ZodBoolean;
|
|
130
|
+
error: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
export type ToolCompletedEvent = z.infer<typeof ToolCompletedEventSchema>;
|
|
134
|
+
export declare const ThinkingEventSchema: z.ZodObject<{
|
|
135
|
+
protocol: z.ZodLiteral<1>;
|
|
136
|
+
type: z.ZodLiteral<"thinking">;
|
|
137
|
+
payload: z.ZodObject<{
|
|
138
|
+
sessionId: z.ZodString;
|
|
139
|
+
content: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
export type ThinkingEvent = z.infer<typeof ThinkingEventSchema>;
|
|
143
|
+
export declare const ErrorEventSchema: z.ZodObject<{
|
|
144
|
+
protocol: z.ZodLiteral<1>;
|
|
145
|
+
type: z.ZodLiteral<"error">;
|
|
146
|
+
payload: z.ZodObject<{
|
|
147
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
148
|
+
error: z.ZodObject<{
|
|
149
|
+
code: z.ZodEnum<{
|
|
150
|
+
readonly CLI_NOT_FOUND: "CLI_NOT_FOUND";
|
|
151
|
+
readonly AUTH_EXPIRED: "AUTH_EXPIRED";
|
|
152
|
+
readonly NETWORK_TIMEOUT: "NETWORK_TIMEOUT";
|
|
153
|
+
readonly CONTEXT_LIMIT: "CONTEXT_LIMIT";
|
|
154
|
+
readonly MALFORMED_EVENT: "MALFORMED_EVENT";
|
|
155
|
+
readonly PROCESS_CRASHED: "PROCESS_CRASHED";
|
|
156
|
+
readonly SESSION_NOT_FOUND: "SESSION_NOT_FOUND";
|
|
157
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
158
|
+
}>;
|
|
159
|
+
message: z.ZodString;
|
|
160
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
161
|
+
recoverable: z.ZodBoolean;
|
|
162
|
+
}, z.core.$strip>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export type ErrorEvent = z.infer<typeof ErrorEventSchema>;
|
|
166
|
+
export declare const SessionListEventSchema: z.ZodObject<{
|
|
167
|
+
protocol: z.ZodLiteral<1>;
|
|
168
|
+
type: z.ZodLiteral<"session_list">;
|
|
169
|
+
payload: z.ZodObject<{
|
|
170
|
+
sessions: z.ZodArray<z.ZodObject<{
|
|
171
|
+
sessionId: z.ZodString;
|
|
172
|
+
status: z.ZodEnum<{
|
|
173
|
+
readonly IDLE: "idle";
|
|
174
|
+
readonly STARTING: "starting";
|
|
175
|
+
readonly RUNNING: "running";
|
|
176
|
+
readonly STREAMING: "streaming";
|
|
177
|
+
readonly COMPLETED: "completed";
|
|
178
|
+
readonly CANCELED: "canceled";
|
|
179
|
+
readonly INTERRUPTED: "interrupted";
|
|
180
|
+
readonly FAILED: "failed";
|
|
181
|
+
readonly RESUMING: "resuming";
|
|
182
|
+
}>;
|
|
183
|
+
model: z.ZodOptional<z.ZodString>;
|
|
184
|
+
title: z.ZodOptional<z.ZodString>;
|
|
185
|
+
createdAt: z.ZodNumber;
|
|
186
|
+
updatedAt: z.ZodNumber;
|
|
187
|
+
messageCount: z.ZodNumber;
|
|
188
|
+
toolCount: z.ZodNumber;
|
|
189
|
+
}, z.core.$strip>>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
export type SessionListEvent = z.infer<typeof SessionListEventSchema>;
|
|
193
|
+
export declare const SessionCompletedEventSchema: z.ZodObject<{
|
|
194
|
+
protocol: z.ZodLiteral<1>;
|
|
195
|
+
type: z.ZodLiteral<"session_completed">;
|
|
196
|
+
payload: z.ZodObject<{
|
|
197
|
+
sessionId: z.ZodString;
|
|
198
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
export type SessionCompletedEvent = z.infer<typeof SessionCompletedEventSchema>;
|
|
202
|
+
export declare const HostEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
203
|
+
protocol: z.ZodLiteral<1>;
|
|
204
|
+
type: z.ZodLiteral<"session_state">;
|
|
205
|
+
payload: z.ZodObject<{
|
|
206
|
+
sessionId: z.ZodString;
|
|
207
|
+
status: z.ZodEnum<{
|
|
208
|
+
readonly IDLE: "idle";
|
|
209
|
+
readonly STARTING: "starting";
|
|
210
|
+
readonly RUNNING: "running";
|
|
211
|
+
readonly STREAMING: "streaming";
|
|
212
|
+
readonly COMPLETED: "completed";
|
|
213
|
+
readonly CANCELED: "canceled";
|
|
214
|
+
readonly INTERRUPTED: "interrupted";
|
|
215
|
+
readonly FAILED: "failed";
|
|
216
|
+
readonly RESUMING: "resuming";
|
|
217
|
+
}>;
|
|
218
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
sessionId: z.ZodString;
|
|
220
|
+
status: z.ZodEnum<{
|
|
221
|
+
readonly IDLE: "idle";
|
|
222
|
+
readonly STARTING: "starting";
|
|
223
|
+
readonly RUNNING: "running";
|
|
224
|
+
readonly STREAMING: "streaming";
|
|
225
|
+
readonly COMPLETED: "completed";
|
|
226
|
+
readonly CANCELED: "canceled";
|
|
227
|
+
readonly INTERRUPTED: "interrupted";
|
|
228
|
+
readonly FAILED: "failed";
|
|
229
|
+
readonly RESUMING: "resuming";
|
|
230
|
+
}>;
|
|
231
|
+
model: z.ZodOptional<z.ZodString>;
|
|
232
|
+
createdAt: z.ZodNumber;
|
|
233
|
+
updatedAt: z.ZodNumber;
|
|
234
|
+
title: z.ZodOptional<z.ZodString>;
|
|
235
|
+
}, z.core.$strip>>;
|
|
236
|
+
timeline: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
237
|
+
id: z.ZodString;
|
|
238
|
+
kind: z.ZodEnum<{
|
|
239
|
+
readonly MESSAGE: "message";
|
|
240
|
+
readonly TOOL_CALL: "tool_call";
|
|
241
|
+
readonly STATUS: "status";
|
|
242
|
+
readonly ERROR: "error";
|
|
243
|
+
readonly DONE: "done";
|
|
244
|
+
}>;
|
|
245
|
+
timestamp: z.ZodNumber;
|
|
246
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
247
|
+
}, z.core.$strip>>>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
250
|
+
protocol: z.ZodLiteral<1>;
|
|
251
|
+
type: z.ZodLiteral<"text_delta">;
|
|
252
|
+
payload: z.ZodObject<{
|
|
253
|
+
sessionId: z.ZodString;
|
|
254
|
+
content: z.ZodString;
|
|
255
|
+
}, z.core.$strip>;
|
|
256
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
257
|
+
protocol: z.ZodLiteral<1>;
|
|
258
|
+
type: z.ZodLiteral<"tool_started">;
|
|
259
|
+
payload: z.ZodObject<{
|
|
260
|
+
sessionId: z.ZodString;
|
|
261
|
+
tool: z.ZodString;
|
|
262
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
263
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
264
|
+
}, z.core.$strip>;
|
|
265
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
266
|
+
protocol: z.ZodLiteral<1>;
|
|
267
|
+
type: z.ZodLiteral<"tool_completed">;
|
|
268
|
+
payload: z.ZodObject<{
|
|
269
|
+
sessionId: z.ZodString;
|
|
270
|
+
tool: z.ZodString;
|
|
271
|
+
toolId: z.ZodOptional<z.ZodString>;
|
|
272
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
273
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
274
|
+
success: z.ZodBoolean;
|
|
275
|
+
error: z.ZodOptional<z.ZodString>;
|
|
276
|
+
}, z.core.$strip>;
|
|
277
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
278
|
+
protocol: z.ZodLiteral<1>;
|
|
279
|
+
type: z.ZodLiteral<"thinking">;
|
|
280
|
+
payload: z.ZodObject<{
|
|
281
|
+
sessionId: z.ZodString;
|
|
282
|
+
content: z.ZodOptional<z.ZodString>;
|
|
283
|
+
}, z.core.$strip>;
|
|
284
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
285
|
+
protocol: z.ZodLiteral<1>;
|
|
286
|
+
type: z.ZodLiteral<"error">;
|
|
287
|
+
payload: z.ZodObject<{
|
|
288
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
289
|
+
error: z.ZodObject<{
|
|
290
|
+
code: z.ZodEnum<{
|
|
291
|
+
readonly CLI_NOT_FOUND: "CLI_NOT_FOUND";
|
|
292
|
+
readonly AUTH_EXPIRED: "AUTH_EXPIRED";
|
|
293
|
+
readonly NETWORK_TIMEOUT: "NETWORK_TIMEOUT";
|
|
294
|
+
readonly CONTEXT_LIMIT: "CONTEXT_LIMIT";
|
|
295
|
+
readonly MALFORMED_EVENT: "MALFORMED_EVENT";
|
|
296
|
+
readonly PROCESS_CRASHED: "PROCESS_CRASHED";
|
|
297
|
+
readonly SESSION_NOT_FOUND: "SESSION_NOT_FOUND";
|
|
298
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
299
|
+
}>;
|
|
300
|
+
message: z.ZodString;
|
|
301
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
302
|
+
recoverable: z.ZodBoolean;
|
|
303
|
+
}, z.core.$strip>;
|
|
304
|
+
}, z.core.$strip>;
|
|
305
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
306
|
+
protocol: z.ZodLiteral<1>;
|
|
307
|
+
type: z.ZodLiteral<"session_list">;
|
|
308
|
+
payload: z.ZodObject<{
|
|
309
|
+
sessions: z.ZodArray<z.ZodObject<{
|
|
310
|
+
sessionId: z.ZodString;
|
|
311
|
+
status: z.ZodEnum<{
|
|
312
|
+
readonly IDLE: "idle";
|
|
313
|
+
readonly STARTING: "starting";
|
|
314
|
+
readonly RUNNING: "running";
|
|
315
|
+
readonly STREAMING: "streaming";
|
|
316
|
+
readonly COMPLETED: "completed";
|
|
317
|
+
readonly CANCELED: "canceled";
|
|
318
|
+
readonly INTERRUPTED: "interrupted";
|
|
319
|
+
readonly FAILED: "failed";
|
|
320
|
+
readonly RESUMING: "resuming";
|
|
321
|
+
}>;
|
|
322
|
+
model: z.ZodOptional<z.ZodString>;
|
|
323
|
+
title: z.ZodOptional<z.ZodString>;
|
|
324
|
+
createdAt: z.ZodNumber;
|
|
325
|
+
updatedAt: z.ZodNumber;
|
|
326
|
+
messageCount: z.ZodNumber;
|
|
327
|
+
toolCount: z.ZodNumber;
|
|
328
|
+
}, z.core.$strip>>;
|
|
329
|
+
}, z.core.$strip>;
|
|
330
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
331
|
+
protocol: z.ZodLiteral<1>;
|
|
332
|
+
type: z.ZodLiteral<"session_completed">;
|
|
333
|
+
payload: z.ZodObject<{
|
|
334
|
+
sessionId: z.ZodString;
|
|
335
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
336
|
+
}, z.core.$strip>;
|
|
337
|
+
}, z.core.$strip>], "type">;
|
|
338
|
+
export type HostEvent = z.infer<typeof HostEventSchema>;
|
|
339
|
+
type HostEventPayloadMap = {
|
|
340
|
+
[HostEventType.SESSION_STATE]: SessionStateEvent["payload"];
|
|
341
|
+
[HostEventType.TEXT_DELTA]: TextDeltaEvent["payload"];
|
|
342
|
+
[HostEventType.TOOL_STARTED]: ToolStartedEvent["payload"];
|
|
343
|
+
[HostEventType.TOOL_COMPLETED]: ToolCompletedEvent["payload"];
|
|
344
|
+
[HostEventType.THINKING]: ThinkingEvent["payload"];
|
|
345
|
+
[HostEventType.ERROR]: ErrorEvent["payload"];
|
|
346
|
+
[HostEventType.SESSION_LIST]: SessionListEvent["payload"];
|
|
347
|
+
[HostEventType.SESSION_COMPLETED]: SessionCompletedEvent["payload"];
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* Create a validated host event message.
|
|
351
|
+
*/
|
|
352
|
+
export declare function createHostEvent<T extends HostEventType>(type: T, payload: HostEventPayloadMap[T]): HostEvent;
|
|
353
|
+
export {};
|
|
354
|
+
//# sourceMappingURL=host-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-events.d.ts","sourceRoot":"","sources":["../../src/protocol/host-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,aAAa;;;;;;;;;CAShB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,eAAO,MAAM,mBAAmB;;;;;;;;;EAAwB,CAAC;AAMzD,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE7D,eAAO,MAAM,uBAAuB;;;;;;EAA4B,CAAC;AAEjE,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAK9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAMhE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,oBAAoB;;;;;;;iBAO/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,sBAAsB;;;;;;;;;iBASjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,wBAA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cAAc,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC,aAAa,CAAC,iBAAiB,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;CACrE,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,aAAa,EACrD,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAC9B,SAAS,CAMX"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./cli-stream";
|
|
2
|
+
export * from "./context";
|
|
3
|
+
export * from "./envelope";
|
|
4
|
+
export * from "./errors";
|
|
5
|
+
export * from "./helpers";
|
|
6
|
+
export * from "./host-events";
|
|
7
|
+
export * from "./session";
|
|
8
|
+
export * from "./ui-intents";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocol/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SessionStatus: {
|
|
3
|
+
readonly IDLE: "idle";
|
|
4
|
+
readonly STARTING: "starting";
|
|
5
|
+
readonly RUNNING: "running";
|
|
6
|
+
readonly STREAMING: "streaming";
|
|
7
|
+
readonly COMPLETED: "completed";
|
|
8
|
+
readonly CANCELED: "canceled";
|
|
9
|
+
readonly INTERRUPTED: "interrupted";
|
|
10
|
+
readonly FAILED: "failed";
|
|
11
|
+
readonly RESUMING: "resuming";
|
|
12
|
+
};
|
|
13
|
+
export type SessionStatus = (typeof SessionStatus)[keyof typeof SessionStatus];
|
|
14
|
+
export declare const SessionStatusSchema: z.ZodEnum<{
|
|
15
|
+
readonly IDLE: "idle";
|
|
16
|
+
readonly STARTING: "starting";
|
|
17
|
+
readonly RUNNING: "running";
|
|
18
|
+
readonly STREAMING: "streaming";
|
|
19
|
+
readonly COMPLETED: "completed";
|
|
20
|
+
readonly CANCELED: "canceled";
|
|
21
|
+
readonly INTERRUPTED: "interrupted";
|
|
22
|
+
readonly FAILED: "failed";
|
|
23
|
+
readonly RESUMING: "resuming";
|
|
24
|
+
}>;
|
|
25
|
+
export declare const SessionTransitionEvent: {
|
|
26
|
+
readonly CREATE_SESSION: "create_session";
|
|
27
|
+
readonly CLI_SPAWNED: "cli_spawned";
|
|
28
|
+
readonly FIRST_TEXT_DELTA: "first_text_delta";
|
|
29
|
+
readonly RESULT_RECEIVED: "result_received";
|
|
30
|
+
readonly USER_STOP: "user_stop";
|
|
31
|
+
readonly PROCESS_LOST: "process_lost";
|
|
32
|
+
readonly RESUME: "resume";
|
|
33
|
+
readonly ERROR: "error";
|
|
34
|
+
};
|
|
35
|
+
export type SessionTransitionEvent = (typeof SessionTransitionEvent)[keyof typeof SessionTransitionEvent];
|
|
36
|
+
export declare const SessionTransitionEventSchema: z.ZodEnum<{
|
|
37
|
+
readonly CREATE_SESSION: "create_session";
|
|
38
|
+
readonly CLI_SPAWNED: "cli_spawned";
|
|
39
|
+
readonly FIRST_TEXT_DELTA: "first_text_delta";
|
|
40
|
+
readonly RESULT_RECEIVED: "result_received";
|
|
41
|
+
readonly USER_STOP: "user_stop";
|
|
42
|
+
readonly PROCESS_LOST: "process_lost";
|
|
43
|
+
readonly RESUME: "resume";
|
|
44
|
+
readonly ERROR: "error";
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Valid state transitions for the session state machine.
|
|
48
|
+
* Maps `from → event → to`.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SESSION_TRANSITIONS: ReadonlyArray<{
|
|
51
|
+
from: SessionStatus;
|
|
52
|
+
event: SessionTransitionEvent;
|
|
53
|
+
to: SessionStatus;
|
|
54
|
+
}>;
|
|
55
|
+
/** Terminal states — no transitions out except new session creation. */
|
|
56
|
+
export declare const TERMINAL_STATUSES: ReadonlySet<SessionStatus>;
|
|
57
|
+
export declare const SessionMetadataSchema: z.ZodObject<{
|
|
58
|
+
sessionId: z.ZodString;
|
|
59
|
+
status: z.ZodEnum<{
|
|
60
|
+
readonly IDLE: "idle";
|
|
61
|
+
readonly STARTING: "starting";
|
|
62
|
+
readonly RUNNING: "running";
|
|
63
|
+
readonly STREAMING: "streaming";
|
|
64
|
+
readonly COMPLETED: "completed";
|
|
65
|
+
readonly CANCELED: "canceled";
|
|
66
|
+
readonly INTERRUPTED: "interrupted";
|
|
67
|
+
readonly FAILED: "failed";
|
|
68
|
+
readonly RESUMING: "resuming";
|
|
69
|
+
}>;
|
|
70
|
+
model: z.ZodOptional<z.ZodString>;
|
|
71
|
+
createdAt: z.ZodNumber;
|
|
72
|
+
updatedAt: z.ZodNumber;
|
|
73
|
+
title: z.ZodOptional<z.ZodString>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
export type SessionMetadata = z.infer<typeof SessionMetadataSchema>;
|
|
76
|
+
export declare const SessionSummarySchema: z.ZodObject<{
|
|
77
|
+
sessionId: z.ZodString;
|
|
78
|
+
status: z.ZodEnum<{
|
|
79
|
+
readonly IDLE: "idle";
|
|
80
|
+
readonly STARTING: "starting";
|
|
81
|
+
readonly RUNNING: "running";
|
|
82
|
+
readonly STREAMING: "streaming";
|
|
83
|
+
readonly COMPLETED: "completed";
|
|
84
|
+
readonly CANCELED: "canceled";
|
|
85
|
+
readonly INTERRUPTED: "interrupted";
|
|
86
|
+
readonly FAILED: "failed";
|
|
87
|
+
readonly RESUMING: "resuming";
|
|
88
|
+
}>;
|
|
89
|
+
model: z.ZodOptional<z.ZodString>;
|
|
90
|
+
title: z.ZodOptional<z.ZodString>;
|
|
91
|
+
createdAt: z.ZodNumber;
|
|
92
|
+
updatedAt: z.ZodNumber;
|
|
93
|
+
messageCount: z.ZodNumber;
|
|
94
|
+
toolCount: z.ZodNumber;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
export type SessionSummary = z.infer<typeof SessionSummarySchema>;
|
|
97
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/protocol/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,aAAa;;;;;;;;;;CAUhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,eAAO,MAAM,mBAAmB;;;;;;;;;;EAAwB,CAAC;AAMzD,eAAO,MAAM,sBAAsB;;;;;;;;;CASzB,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAEvE,eAAO,MAAM,4BAA4B;;;;;;;;;EAAiC,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC;IAC9C,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,sBAAsB,CAAC;IAC9B,EAAE,EAAE,aAAa,CAAC;CACnB,CAsFS,CAAC;AAEX,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,aAAa,CAIvD,CAAC;AAMH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;iBAOhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAMpE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;iBAS/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const UIIntentType: {
|
|
3
|
+
readonly SUBMIT_PROMPT: "submit_prompt";
|
|
4
|
+
readonly STOP_SESSION: "stop_session";
|
|
5
|
+
readonly RESUME_SESSION: "resume_session";
|
|
6
|
+
readonly REQUEST_SESSIONS: "request_sessions";
|
|
7
|
+
readonly REQUEST_SESSION_DETAIL: "request_session_detail";
|
|
8
|
+
readonly CLEAR_SESSION: "clear_session";
|
|
9
|
+
readonly WEBVIEW_READY: "webview_ready";
|
|
10
|
+
};
|
|
11
|
+
export type UIIntentType = (typeof UIIntentType)[keyof typeof UIIntentType];
|
|
12
|
+
export declare const UIIntentTypeSchema: z.ZodEnum<{
|
|
13
|
+
readonly SUBMIT_PROMPT: "submit_prompt";
|
|
14
|
+
readonly STOP_SESSION: "stop_session";
|
|
15
|
+
readonly RESUME_SESSION: "resume_session";
|
|
16
|
+
readonly REQUEST_SESSIONS: "request_sessions";
|
|
17
|
+
readonly REQUEST_SESSION_DETAIL: "request_session_detail";
|
|
18
|
+
readonly CLEAR_SESSION: "clear_session";
|
|
19
|
+
readonly WEBVIEW_READY: "webview_ready";
|
|
20
|
+
}>;
|
|
21
|
+
export declare const SubmitPromptIntentSchema: z.ZodObject<{
|
|
22
|
+
protocol: z.ZodLiteral<1>;
|
|
23
|
+
type: z.ZodLiteral<"submit_prompt">;
|
|
24
|
+
payload: z.ZodObject<{
|
|
25
|
+
text: z.ZodString;
|
|
26
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
rootPath: z.ZodString;
|
|
29
|
+
name: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
31
|
+
activeFile: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
filePath: z.ZodString;
|
|
33
|
+
languageId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
selection: z.ZodOptional<z.ZodObject<{
|
|
36
|
+
filePath: z.ZodString;
|
|
37
|
+
languageId: z.ZodOptional<z.ZodString>;
|
|
38
|
+
startLine: z.ZodNumber;
|
|
39
|
+
startColumn: z.ZodNumber;
|
|
40
|
+
endLine: z.ZodNumber;
|
|
41
|
+
endColumn: z.ZodNumber;
|
|
42
|
+
text: z.ZodString;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type SubmitPromptIntent = z.infer<typeof SubmitPromptIntentSchema>;
|
|
48
|
+
export declare const StopSessionIntentSchema: z.ZodObject<{
|
|
49
|
+
protocol: z.ZodLiteral<1>;
|
|
50
|
+
type: z.ZodLiteral<"stop_session">;
|
|
51
|
+
payload: z.ZodObject<{
|
|
52
|
+
sessionId: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type StopSessionIntent = z.infer<typeof StopSessionIntentSchema>;
|
|
56
|
+
export declare const ResumeSessionIntentSchema: z.ZodObject<{
|
|
57
|
+
protocol: z.ZodLiteral<1>;
|
|
58
|
+
type: z.ZodLiteral<"resume_session">;
|
|
59
|
+
payload: z.ZodObject<{
|
|
60
|
+
sessionId: z.ZodString;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type ResumeSessionIntent = z.infer<typeof ResumeSessionIntentSchema>;
|
|
64
|
+
export declare const RequestSessionsIntentSchema: z.ZodObject<{
|
|
65
|
+
protocol: z.ZodLiteral<1>;
|
|
66
|
+
type: z.ZodLiteral<"request_sessions">;
|
|
67
|
+
payload: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export type RequestSessionsIntent = z.infer<typeof RequestSessionsIntentSchema>;
|
|
70
|
+
export declare const RequestSessionDetailIntentSchema: z.ZodObject<{
|
|
71
|
+
protocol: z.ZodLiteral<1>;
|
|
72
|
+
type: z.ZodLiteral<"request_session_detail">;
|
|
73
|
+
payload: z.ZodObject<{
|
|
74
|
+
sessionId: z.ZodString;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type RequestSessionDetailIntent = z.infer<typeof RequestSessionDetailIntentSchema>;
|
|
78
|
+
export declare const ClearSessionIntentSchema: z.ZodObject<{
|
|
79
|
+
protocol: z.ZodLiteral<1>;
|
|
80
|
+
type: z.ZodLiteral<"clear_session">;
|
|
81
|
+
payload: z.ZodObject<{
|
|
82
|
+
sessionId: z.ZodString;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
export type ClearSessionIntent = z.infer<typeof ClearSessionIntentSchema>;
|
|
86
|
+
export declare const WebviewReadyIntentSchema: z.ZodObject<{
|
|
87
|
+
protocol: z.ZodLiteral<1>;
|
|
88
|
+
type: z.ZodLiteral<"webview_ready">;
|
|
89
|
+
payload: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export type WebviewReadyIntent = z.infer<typeof WebviewReadyIntentSchema>;
|
|
92
|
+
export declare const UIIntentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
93
|
+
protocol: z.ZodLiteral<1>;
|
|
94
|
+
type: z.ZodLiteral<"submit_prompt">;
|
|
95
|
+
payload: z.ZodObject<{
|
|
96
|
+
text: z.ZodString;
|
|
97
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
98
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
99
|
+
rootPath: z.ZodString;
|
|
100
|
+
name: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
activeFile: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
filePath: z.ZodString;
|
|
104
|
+
languageId: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
selection: z.ZodOptional<z.ZodObject<{
|
|
107
|
+
filePath: z.ZodString;
|
|
108
|
+
languageId: z.ZodOptional<z.ZodString>;
|
|
109
|
+
startLine: z.ZodNumber;
|
|
110
|
+
startColumn: z.ZodNumber;
|
|
111
|
+
endLine: z.ZodNumber;
|
|
112
|
+
endColumn: z.ZodNumber;
|
|
113
|
+
text: z.ZodString;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
118
|
+
protocol: z.ZodLiteral<1>;
|
|
119
|
+
type: z.ZodLiteral<"stop_session">;
|
|
120
|
+
payload: z.ZodObject<{
|
|
121
|
+
sessionId: z.ZodString;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
124
|
+
protocol: z.ZodLiteral<1>;
|
|
125
|
+
type: z.ZodLiteral<"resume_session">;
|
|
126
|
+
payload: z.ZodObject<{
|
|
127
|
+
sessionId: z.ZodString;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
130
|
+
protocol: z.ZodLiteral<1>;
|
|
131
|
+
type: z.ZodLiteral<"request_sessions">;
|
|
132
|
+
payload: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
protocol: z.ZodLiteral<1>;
|
|
135
|
+
type: z.ZodLiteral<"request_session_detail">;
|
|
136
|
+
payload: z.ZodObject<{
|
|
137
|
+
sessionId: z.ZodString;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
140
|
+
protocol: z.ZodLiteral<1>;
|
|
141
|
+
type: z.ZodLiteral<"clear_session">;
|
|
142
|
+
payload: z.ZodObject<{
|
|
143
|
+
sessionId: z.ZodString;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
146
|
+
protocol: z.ZodLiteral<1>;
|
|
147
|
+
type: z.ZodLiteral<"webview_ready">;
|
|
148
|
+
payload: z.ZodOptional<z.ZodObject<{}, z.core.$strip>>;
|
|
149
|
+
}, z.core.$strip>], "type">;
|
|
150
|
+
export type UIIntent = z.infer<typeof UIIntentSchema>;
|
|
151
|
+
type IntentPayloadMap = {
|
|
152
|
+
[UIIntentType.SUBMIT_PROMPT]: SubmitPromptIntent["payload"];
|
|
153
|
+
[UIIntentType.STOP_SESSION]: StopSessionIntent["payload"];
|
|
154
|
+
[UIIntentType.RESUME_SESSION]: ResumeSessionIntent["payload"];
|
|
155
|
+
[UIIntentType.REQUEST_SESSIONS]: RequestSessionsIntent["payload"];
|
|
156
|
+
[UIIntentType.REQUEST_SESSION_DETAIL]: RequestSessionDetailIntent["payload"];
|
|
157
|
+
[UIIntentType.CLEAR_SESSION]: ClearSessionIntent["payload"];
|
|
158
|
+
[UIIntentType.WEBVIEW_READY]: WebviewReadyIntent["payload"];
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Create a validated UI intent message.
|
|
162
|
+
*/
|
|
163
|
+
export declare function createUIIntent<T extends UIIntentType>(type: T, payload: IntentPayloadMap[T]): UIIntent;
|
|
164
|
+
export {};
|
|
165
|
+
//# sourceMappingURL=ui-intents.d.ts.map
|
|
@@ -0,0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