@openspecui/core 3.4.0 → 3.5.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/dist/hosted-app.d.mts +1 -1
- package/dist/hosted-app.mjs +1 -1
- package/dist/index.d.mts +149 -105
- package/dist/index.mjs +71 -8
- package/dist/notifications-DOQwtdfS.d.mts +550 -0
- package/dist/notifications-F81mmO55.mjs +145 -0
- package/dist/notifications.d.mts +3 -0
- package/dist/notifications.mjs +5 -0
- package/dist/opsx-display-path.d.mts +1 -1
- package/dist/opsx-display-path.mjs +1 -1
- package/dist/sounds-C0dNSFm8.mjs +158 -0
- package/dist/sounds-CxwbTXZS.d.mts +86 -0
- package/dist/sounds.d.mts +2 -0
- package/dist/sounds.mjs +3 -0
- package/dist/terminal-audio-BoSdMyBY.d.mts +13 -0
- package/dist/terminal-audio-DDwxz9sJ.mjs +21 -0
- package/dist/terminal-audio.d.mts +3 -0
- package/dist/terminal-audio.mjs +4 -0
- package/dist/terminal-control-DtBprY6-.mjs +236 -0
- package/dist/terminal-control.d.mts +3 -0
- package/dist/terminal-control.mjs +3 -0
- package/dist/{terminal-invocation-ajsrCPhf.d.mts → terminal-invocation-BAcs7OE-.d.mts} +179 -87
- package/dist/terminal-invocation.d.mts +1 -1
- package/dist/terminal-invocation.mjs +1 -1
- package/dist/terminal-theme.d.mts +1 -1
- package/dist/terminal-theme.mjs +1 -1
- package/package.json +19 -3
- /package/dist/{hosted-app-CC8DBuyE.mjs → hosted-app-CIOJpbzc.mjs} +0 -0
- /package/dist/{hosted-app-Be-ourtC.d.mts → hosted-app-DaGUbBJn.d.mts} +0 -0
- /package/dist/{opsx-display-path-DNqQo2uK.mjs → opsx-display-path-B6Owu17P.mjs} +0 -0
- /package/dist/{opsx-display-path-ElGeez1E.d.mts → opsx-display-path-CuQyGB_A.d.mts} +0 -0
- /package/dist/{terminal-invocation-8OLmCJfv.mjs → terminal-invocation-Cdi6_Kl6.mjs} +0 -0
- /package/dist/{terminal-theme-Cyyo2Zln.mjs → terminal-theme-CMQqJvIQ.mjs} +0 -0
- /package/dist/{terminal-theme-C_2UGXPr.d.mts → terminal-theme-wbkK9vVH.d.mts} +0 -0
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { x as SoundId } from "./sounds-CxwbTXZS.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/terminal-control.d.ts
|
|
5
|
+
type TerminalProgressState = 'clear' | 'set' | 'error' | 'indeterminate' | 'warning';
|
|
6
|
+
type TerminalPromptState = 'prompt-start' | 'prompt-end' | 'command-start' | 'command-output' | 'command-end';
|
|
7
|
+
type TerminalNotificationProtocol = 'osc9' | 'osc777';
|
|
8
|
+
type TerminalTitleTarget = 'icon' | 'window' | 'both';
|
|
9
|
+
type TerminalControlEvent = {
|
|
10
|
+
type: 'bell';
|
|
11
|
+
} | {
|
|
12
|
+
type: 'notification';
|
|
13
|
+
protocol: TerminalNotificationProtocol;
|
|
14
|
+
title?: string;
|
|
15
|
+
body: string;
|
|
16
|
+
} | {
|
|
17
|
+
type: 'title';
|
|
18
|
+
title: string;
|
|
19
|
+
target: TerminalTitleTarget;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'cwd';
|
|
22
|
+
cwd: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'progress';
|
|
25
|
+
state: TerminalProgressState;
|
|
26
|
+
value: number | null;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'prompt-state';
|
|
29
|
+
state: TerminalPromptState;
|
|
30
|
+
exitCode?: number;
|
|
31
|
+
};
|
|
32
|
+
interface TerminalControlParseResult {
|
|
33
|
+
output: string;
|
|
34
|
+
events: TerminalControlEvent[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Stateful parser for terminal control escape sequences.
|
|
38
|
+
*
|
|
39
|
+
* It extracts terminal-local control metadata separately from notification
|
|
40
|
+
* intents so progress, title, cwd, and prompt-state protocols cannot leak into
|
|
41
|
+
* the web notification platform.
|
|
42
|
+
*/
|
|
43
|
+
declare class TerminalControlParser {
|
|
44
|
+
private pending;
|
|
45
|
+
push(chunk: string): TerminalControlParseResult;
|
|
46
|
+
}
|
|
47
|
+
declare function terminalNotificationEventToPublishInput(input: {
|
|
48
|
+
event: Extract<TerminalControlEvent, {
|
|
49
|
+
type: 'notification';
|
|
50
|
+
}>;
|
|
51
|
+
sessionId: string;
|
|
52
|
+
terminalTitle?: string;
|
|
53
|
+
}): NotificationPublishInput;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/notifications.d.ts
|
|
56
|
+
declare const NOTIFICATION_SOUND_VALUES: readonly ["silent", "soft", "clear", "pulse"];
|
|
57
|
+
declare const NotificationSoundSchema: z.ZodEffects<z.ZodUnion<[z.ZodLiteral<"silent">, z.ZodEnum<["builtin:Basso", "builtin:Blow", "builtin:Bottle", "builtin:Frog", "builtin:Funk", "builtin:Glass", "builtin:Hero", "builtin:Morse", "builtin:Ping", "builtin:Pop", "builtin:Purr", "builtin:Sosumi", "builtin:Submarine", "builtin:Tink"]>, z.ZodType<`custom:${string}`, z.ZodTypeDef, `custom:${string}`>]>, "silent" | "builtin:Tink" | "builtin:Blow" | "builtin:Basso" | "builtin:Bottle" | "builtin:Frog" | "builtin:Funk" | "builtin:Glass" | "builtin:Hero" | "builtin:Morse" | "builtin:Ping" | "builtin:Pop" | "builtin:Purr" | "builtin:Sosumi" | "builtin:Submarine" | `custom:${string}`, unknown>;
|
|
58
|
+
type NotificationSound = SoundId;
|
|
59
|
+
declare const NOTIFICATION_SOUND_OPTIONS: readonly {
|
|
60
|
+
id: NotificationSound;
|
|
61
|
+
label: string;
|
|
62
|
+
}[];
|
|
63
|
+
declare const NotificationSettingsSchema: z.ZodObject<{
|
|
64
|
+
sound: z.ZodDefault<z.ZodEffects<z.ZodUnion<[z.ZodLiteral<"silent">, z.ZodEnum<["builtin:Basso", "builtin:Blow", "builtin:Bottle", "builtin:Frog", "builtin:Funk", "builtin:Glass", "builtin:Hero", "builtin:Morse", "builtin:Ping", "builtin:Pop", "builtin:Purr", "builtin:Sosumi", "builtin:Submarine", "builtin:Tink"]>, z.ZodType<`custom:${string}`, z.ZodTypeDef, `custom:${string}`>]>, "silent" | "builtin:Tink" | "builtin:Blow" | "builtin:Basso" | "builtin:Bottle" | "builtin:Frog" | "builtin:Funk" | "builtin:Glass" | "builtin:Hero" | "builtin:Morse" | "builtin:Ping" | "builtin:Pop" | "builtin:Purr" | "builtin:Sosumi" | "builtin:Submarine" | `custom:${string}`, unknown>>;
|
|
65
|
+
volume: z.ZodDefault<z.ZodNumber>;
|
|
66
|
+
systemNotificationsEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
sound: "silent" | "builtin:Tink" | "builtin:Blow" | "builtin:Basso" | "builtin:Bottle" | "builtin:Frog" | "builtin:Funk" | "builtin:Glass" | "builtin:Hero" | "builtin:Morse" | "builtin:Ping" | "builtin:Pop" | "builtin:Purr" | "builtin:Sosumi" | "builtin:Submarine" | `custom:${string}`;
|
|
69
|
+
volume: number;
|
|
70
|
+
systemNotificationsEnabled: boolean;
|
|
71
|
+
}, {
|
|
72
|
+
sound?: unknown;
|
|
73
|
+
volume?: number | undefined;
|
|
74
|
+
systemNotificationsEnabled?: boolean | undefined;
|
|
75
|
+
}>;
|
|
76
|
+
type NotificationSettings = z.infer<typeof NotificationSettingsSchema>;
|
|
77
|
+
declare const NotificationSourceSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
78
|
+
type: z.ZodLiteral<"terminal">;
|
|
79
|
+
sessionId: z.ZodString;
|
|
80
|
+
title: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
type: "terminal";
|
|
83
|
+
sessionId: string;
|
|
84
|
+
title?: string | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
type: "terminal";
|
|
87
|
+
sessionId: string;
|
|
88
|
+
title?: string | undefined;
|
|
89
|
+
}>, z.ZodObject<{
|
|
90
|
+
type: z.ZodLiteral<"openspec-change">;
|
|
91
|
+
changeId: z.ZodString;
|
|
92
|
+
title: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
type: "openspec-change";
|
|
95
|
+
changeId: string;
|
|
96
|
+
title?: string | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
type: "openspec-change";
|
|
99
|
+
changeId: string;
|
|
100
|
+
title?: string | undefined;
|
|
101
|
+
}>, z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"hooks-plugin">;
|
|
103
|
+
pluginId: z.ZodString;
|
|
104
|
+
title: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
type: "hooks-plugin";
|
|
107
|
+
pluginId: string;
|
|
108
|
+
title?: string | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
type: "hooks-plugin";
|
|
111
|
+
pluginId: string;
|
|
112
|
+
title?: string | undefined;
|
|
113
|
+
}>, z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"custom">;
|
|
115
|
+
groupId: z.ZodString;
|
|
116
|
+
title: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
type: "custom";
|
|
119
|
+
groupId: string;
|
|
120
|
+
title?: string | undefined;
|
|
121
|
+
}, {
|
|
122
|
+
type: "custom";
|
|
123
|
+
groupId: string;
|
|
124
|
+
title?: string | undefined;
|
|
125
|
+
}>]>;
|
|
126
|
+
type NotificationSource = z.infer<typeof NotificationSourceSchema>;
|
|
127
|
+
declare const NotificationActionSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
128
|
+
type: z.ZodLiteral<"terminal.focus">;
|
|
129
|
+
label: z.ZodDefault<z.ZodString>;
|
|
130
|
+
target: z.ZodObject<{
|
|
131
|
+
sessionId: z.ZodString;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
sessionId: string;
|
|
134
|
+
}, {
|
|
135
|
+
sessionId: string;
|
|
136
|
+
}>;
|
|
137
|
+
}, "strip", z.ZodTypeAny, {
|
|
138
|
+
type: "terminal.focus";
|
|
139
|
+
label: string;
|
|
140
|
+
target: {
|
|
141
|
+
sessionId: string;
|
|
142
|
+
};
|
|
143
|
+
}, {
|
|
144
|
+
type: "terminal.focus";
|
|
145
|
+
target: {
|
|
146
|
+
sessionId: string;
|
|
147
|
+
};
|
|
148
|
+
label?: string | undefined;
|
|
149
|
+
}>, z.ZodObject<{
|
|
150
|
+
type: z.ZodLiteral<"href.open">;
|
|
151
|
+
label: z.ZodDefault<z.ZodString>;
|
|
152
|
+
target: z.ZodObject<{
|
|
153
|
+
href: z.ZodString;
|
|
154
|
+
}, "strip", z.ZodTypeAny, {
|
|
155
|
+
href: string;
|
|
156
|
+
}, {
|
|
157
|
+
href: string;
|
|
158
|
+
}>;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
type: "href.open";
|
|
161
|
+
label: string;
|
|
162
|
+
target: {
|
|
163
|
+
href: string;
|
|
164
|
+
};
|
|
165
|
+
}, {
|
|
166
|
+
type: "href.open";
|
|
167
|
+
target: {
|
|
168
|
+
href: string;
|
|
169
|
+
};
|
|
170
|
+
label?: string | undefined;
|
|
171
|
+
}>]>;
|
|
172
|
+
type NotificationAction = z.infer<typeof NotificationActionSchema>;
|
|
173
|
+
declare const NotificationGroupKeySchema: z.ZodString;
|
|
174
|
+
type NotificationGroupKey = z.infer<typeof NotificationGroupKeySchema>;
|
|
175
|
+
declare const NotificationPublishInputSchema: z.ZodObject<{
|
|
176
|
+
title: z.ZodString;
|
|
177
|
+
body: z.ZodDefault<z.ZodString>;
|
|
178
|
+
source: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"terminal">;
|
|
180
|
+
sessionId: z.ZodString;
|
|
181
|
+
title: z.ZodOptional<z.ZodString>;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
type: "terminal";
|
|
184
|
+
sessionId: string;
|
|
185
|
+
title?: string | undefined;
|
|
186
|
+
}, {
|
|
187
|
+
type: "terminal";
|
|
188
|
+
sessionId: string;
|
|
189
|
+
title?: string | undefined;
|
|
190
|
+
}>, z.ZodObject<{
|
|
191
|
+
type: z.ZodLiteral<"openspec-change">;
|
|
192
|
+
changeId: z.ZodString;
|
|
193
|
+
title: z.ZodOptional<z.ZodString>;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
type: "openspec-change";
|
|
196
|
+
changeId: string;
|
|
197
|
+
title?: string | undefined;
|
|
198
|
+
}, {
|
|
199
|
+
type: "openspec-change";
|
|
200
|
+
changeId: string;
|
|
201
|
+
title?: string | undefined;
|
|
202
|
+
}>, z.ZodObject<{
|
|
203
|
+
type: z.ZodLiteral<"hooks-plugin">;
|
|
204
|
+
pluginId: z.ZodString;
|
|
205
|
+
title: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, "strip", z.ZodTypeAny, {
|
|
207
|
+
type: "hooks-plugin";
|
|
208
|
+
pluginId: string;
|
|
209
|
+
title?: string | undefined;
|
|
210
|
+
}, {
|
|
211
|
+
type: "hooks-plugin";
|
|
212
|
+
pluginId: string;
|
|
213
|
+
title?: string | undefined;
|
|
214
|
+
}>, z.ZodObject<{
|
|
215
|
+
type: z.ZodLiteral<"custom">;
|
|
216
|
+
groupId: z.ZodString;
|
|
217
|
+
title: z.ZodOptional<z.ZodString>;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
type: "custom";
|
|
220
|
+
groupId: string;
|
|
221
|
+
title?: string | undefined;
|
|
222
|
+
}, {
|
|
223
|
+
type: "custom";
|
|
224
|
+
groupId: string;
|
|
225
|
+
title?: string | undefined;
|
|
226
|
+
}>]>;
|
|
227
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
228
|
+
type: z.ZodLiteral<"terminal.focus">;
|
|
229
|
+
label: z.ZodDefault<z.ZodString>;
|
|
230
|
+
target: z.ZodObject<{
|
|
231
|
+
sessionId: z.ZodString;
|
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
|
233
|
+
sessionId: string;
|
|
234
|
+
}, {
|
|
235
|
+
sessionId: string;
|
|
236
|
+
}>;
|
|
237
|
+
}, "strip", z.ZodTypeAny, {
|
|
238
|
+
type: "terminal.focus";
|
|
239
|
+
label: string;
|
|
240
|
+
target: {
|
|
241
|
+
sessionId: string;
|
|
242
|
+
};
|
|
243
|
+
}, {
|
|
244
|
+
type: "terminal.focus";
|
|
245
|
+
target: {
|
|
246
|
+
sessionId: string;
|
|
247
|
+
};
|
|
248
|
+
label?: string | undefined;
|
|
249
|
+
}>, z.ZodObject<{
|
|
250
|
+
type: z.ZodLiteral<"href.open">;
|
|
251
|
+
label: z.ZodDefault<z.ZodString>;
|
|
252
|
+
target: z.ZodObject<{
|
|
253
|
+
href: z.ZodString;
|
|
254
|
+
}, "strip", z.ZodTypeAny, {
|
|
255
|
+
href: string;
|
|
256
|
+
}, {
|
|
257
|
+
href: string;
|
|
258
|
+
}>;
|
|
259
|
+
}, "strip", z.ZodTypeAny, {
|
|
260
|
+
type: "href.open";
|
|
261
|
+
label: string;
|
|
262
|
+
target: {
|
|
263
|
+
href: string;
|
|
264
|
+
};
|
|
265
|
+
}, {
|
|
266
|
+
type: "href.open";
|
|
267
|
+
target: {
|
|
268
|
+
href: string;
|
|
269
|
+
};
|
|
270
|
+
label?: string | undefined;
|
|
271
|
+
}>]>, "many">>;
|
|
272
|
+
level: z.ZodDefault<z.ZodEnum<["info", "success", "warning", "error"]>>;
|
|
273
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
title: string;
|
|
276
|
+
body: string;
|
|
277
|
+
source: {
|
|
278
|
+
type: "terminal";
|
|
279
|
+
sessionId: string;
|
|
280
|
+
title?: string | undefined;
|
|
281
|
+
} | {
|
|
282
|
+
type: "openspec-change";
|
|
283
|
+
changeId: string;
|
|
284
|
+
title?: string | undefined;
|
|
285
|
+
} | {
|
|
286
|
+
type: "hooks-plugin";
|
|
287
|
+
pluginId: string;
|
|
288
|
+
title?: string | undefined;
|
|
289
|
+
} | {
|
|
290
|
+
type: "custom";
|
|
291
|
+
groupId: string;
|
|
292
|
+
title?: string | undefined;
|
|
293
|
+
};
|
|
294
|
+
actions: ({
|
|
295
|
+
type: "terminal.focus";
|
|
296
|
+
label: string;
|
|
297
|
+
target: {
|
|
298
|
+
sessionId: string;
|
|
299
|
+
};
|
|
300
|
+
} | {
|
|
301
|
+
type: "href.open";
|
|
302
|
+
label: string;
|
|
303
|
+
target: {
|
|
304
|
+
href: string;
|
|
305
|
+
};
|
|
306
|
+
})[];
|
|
307
|
+
level: "info" | "success" | "warning" | "error";
|
|
308
|
+
createdAt?: number | undefined;
|
|
309
|
+
}, {
|
|
310
|
+
title: string;
|
|
311
|
+
source: {
|
|
312
|
+
type: "terminal";
|
|
313
|
+
sessionId: string;
|
|
314
|
+
title?: string | undefined;
|
|
315
|
+
} | {
|
|
316
|
+
type: "openspec-change";
|
|
317
|
+
changeId: string;
|
|
318
|
+
title?: string | undefined;
|
|
319
|
+
} | {
|
|
320
|
+
type: "hooks-plugin";
|
|
321
|
+
pluginId: string;
|
|
322
|
+
title?: string | undefined;
|
|
323
|
+
} | {
|
|
324
|
+
type: "custom";
|
|
325
|
+
groupId: string;
|
|
326
|
+
title?: string | undefined;
|
|
327
|
+
};
|
|
328
|
+
createdAt?: number | undefined;
|
|
329
|
+
body?: string | undefined;
|
|
330
|
+
actions?: ({
|
|
331
|
+
type: "terminal.focus";
|
|
332
|
+
target: {
|
|
333
|
+
sessionId: string;
|
|
334
|
+
};
|
|
335
|
+
label?: string | undefined;
|
|
336
|
+
} | {
|
|
337
|
+
type: "href.open";
|
|
338
|
+
target: {
|
|
339
|
+
href: string;
|
|
340
|
+
};
|
|
341
|
+
label?: string | undefined;
|
|
342
|
+
})[] | undefined;
|
|
343
|
+
level?: "info" | "success" | "warning" | "error" | undefined;
|
|
344
|
+
}>;
|
|
345
|
+
type NotificationPublishInput = z.infer<typeof NotificationPublishInputSchema>;
|
|
346
|
+
declare const NotificationRecordSchema: z.ZodObject<{
|
|
347
|
+
title: z.ZodString;
|
|
348
|
+
body: z.ZodDefault<z.ZodString>;
|
|
349
|
+
source: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
350
|
+
type: z.ZodLiteral<"terminal">;
|
|
351
|
+
sessionId: z.ZodString;
|
|
352
|
+
title: z.ZodOptional<z.ZodString>;
|
|
353
|
+
}, "strip", z.ZodTypeAny, {
|
|
354
|
+
type: "terminal";
|
|
355
|
+
sessionId: string;
|
|
356
|
+
title?: string | undefined;
|
|
357
|
+
}, {
|
|
358
|
+
type: "terminal";
|
|
359
|
+
sessionId: string;
|
|
360
|
+
title?: string | undefined;
|
|
361
|
+
}>, z.ZodObject<{
|
|
362
|
+
type: z.ZodLiteral<"openspec-change">;
|
|
363
|
+
changeId: z.ZodString;
|
|
364
|
+
title: z.ZodOptional<z.ZodString>;
|
|
365
|
+
}, "strip", z.ZodTypeAny, {
|
|
366
|
+
type: "openspec-change";
|
|
367
|
+
changeId: string;
|
|
368
|
+
title?: string | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
type: "openspec-change";
|
|
371
|
+
changeId: string;
|
|
372
|
+
title?: string | undefined;
|
|
373
|
+
}>, z.ZodObject<{
|
|
374
|
+
type: z.ZodLiteral<"hooks-plugin">;
|
|
375
|
+
pluginId: z.ZodString;
|
|
376
|
+
title: z.ZodOptional<z.ZodString>;
|
|
377
|
+
}, "strip", z.ZodTypeAny, {
|
|
378
|
+
type: "hooks-plugin";
|
|
379
|
+
pluginId: string;
|
|
380
|
+
title?: string | undefined;
|
|
381
|
+
}, {
|
|
382
|
+
type: "hooks-plugin";
|
|
383
|
+
pluginId: string;
|
|
384
|
+
title?: string | undefined;
|
|
385
|
+
}>, z.ZodObject<{
|
|
386
|
+
type: z.ZodLiteral<"custom">;
|
|
387
|
+
groupId: z.ZodString;
|
|
388
|
+
title: z.ZodOptional<z.ZodString>;
|
|
389
|
+
}, "strip", z.ZodTypeAny, {
|
|
390
|
+
type: "custom";
|
|
391
|
+
groupId: string;
|
|
392
|
+
title?: string | undefined;
|
|
393
|
+
}, {
|
|
394
|
+
type: "custom";
|
|
395
|
+
groupId: string;
|
|
396
|
+
title?: string | undefined;
|
|
397
|
+
}>]>;
|
|
398
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
399
|
+
type: z.ZodLiteral<"terminal.focus">;
|
|
400
|
+
label: z.ZodDefault<z.ZodString>;
|
|
401
|
+
target: z.ZodObject<{
|
|
402
|
+
sessionId: z.ZodString;
|
|
403
|
+
}, "strip", z.ZodTypeAny, {
|
|
404
|
+
sessionId: string;
|
|
405
|
+
}, {
|
|
406
|
+
sessionId: string;
|
|
407
|
+
}>;
|
|
408
|
+
}, "strip", z.ZodTypeAny, {
|
|
409
|
+
type: "terminal.focus";
|
|
410
|
+
label: string;
|
|
411
|
+
target: {
|
|
412
|
+
sessionId: string;
|
|
413
|
+
};
|
|
414
|
+
}, {
|
|
415
|
+
type: "terminal.focus";
|
|
416
|
+
target: {
|
|
417
|
+
sessionId: string;
|
|
418
|
+
};
|
|
419
|
+
label?: string | undefined;
|
|
420
|
+
}>, z.ZodObject<{
|
|
421
|
+
type: z.ZodLiteral<"href.open">;
|
|
422
|
+
label: z.ZodDefault<z.ZodString>;
|
|
423
|
+
target: z.ZodObject<{
|
|
424
|
+
href: z.ZodString;
|
|
425
|
+
}, "strip", z.ZodTypeAny, {
|
|
426
|
+
href: string;
|
|
427
|
+
}, {
|
|
428
|
+
href: string;
|
|
429
|
+
}>;
|
|
430
|
+
}, "strip", z.ZodTypeAny, {
|
|
431
|
+
type: "href.open";
|
|
432
|
+
label: string;
|
|
433
|
+
target: {
|
|
434
|
+
href: string;
|
|
435
|
+
};
|
|
436
|
+
}, {
|
|
437
|
+
type: "href.open";
|
|
438
|
+
target: {
|
|
439
|
+
href: string;
|
|
440
|
+
};
|
|
441
|
+
label?: string | undefined;
|
|
442
|
+
}>]>, "many">>;
|
|
443
|
+
level: z.ZodDefault<z.ZodEnum<["info", "success", "warning", "error"]>>;
|
|
444
|
+
} & {
|
|
445
|
+
id: z.ZodString;
|
|
446
|
+
createdAt: z.ZodNumber;
|
|
447
|
+
groupKey: z.ZodString;
|
|
448
|
+
}, "strip", z.ZodTypeAny, {
|
|
449
|
+
id: string;
|
|
450
|
+
createdAt: number;
|
|
451
|
+
title: string;
|
|
452
|
+
body: string;
|
|
453
|
+
source: {
|
|
454
|
+
type: "terminal";
|
|
455
|
+
sessionId: string;
|
|
456
|
+
title?: string | undefined;
|
|
457
|
+
} | {
|
|
458
|
+
type: "openspec-change";
|
|
459
|
+
changeId: string;
|
|
460
|
+
title?: string | undefined;
|
|
461
|
+
} | {
|
|
462
|
+
type: "hooks-plugin";
|
|
463
|
+
pluginId: string;
|
|
464
|
+
title?: string | undefined;
|
|
465
|
+
} | {
|
|
466
|
+
type: "custom";
|
|
467
|
+
groupId: string;
|
|
468
|
+
title?: string | undefined;
|
|
469
|
+
};
|
|
470
|
+
actions: ({
|
|
471
|
+
type: "terminal.focus";
|
|
472
|
+
label: string;
|
|
473
|
+
target: {
|
|
474
|
+
sessionId: string;
|
|
475
|
+
};
|
|
476
|
+
} | {
|
|
477
|
+
type: "href.open";
|
|
478
|
+
label: string;
|
|
479
|
+
target: {
|
|
480
|
+
href: string;
|
|
481
|
+
};
|
|
482
|
+
})[];
|
|
483
|
+
level: "info" | "success" | "warning" | "error";
|
|
484
|
+
groupKey: string;
|
|
485
|
+
}, {
|
|
486
|
+
id: string;
|
|
487
|
+
createdAt: number;
|
|
488
|
+
title: string;
|
|
489
|
+
source: {
|
|
490
|
+
type: "terminal";
|
|
491
|
+
sessionId: string;
|
|
492
|
+
title?: string | undefined;
|
|
493
|
+
} | {
|
|
494
|
+
type: "openspec-change";
|
|
495
|
+
changeId: string;
|
|
496
|
+
title?: string | undefined;
|
|
497
|
+
} | {
|
|
498
|
+
type: "hooks-plugin";
|
|
499
|
+
pluginId: string;
|
|
500
|
+
title?: string | undefined;
|
|
501
|
+
} | {
|
|
502
|
+
type: "custom";
|
|
503
|
+
groupId: string;
|
|
504
|
+
title?: string | undefined;
|
|
505
|
+
};
|
|
506
|
+
groupKey: string;
|
|
507
|
+
body?: string | undefined;
|
|
508
|
+
actions?: ({
|
|
509
|
+
type: "terminal.focus";
|
|
510
|
+
target: {
|
|
511
|
+
sessionId: string;
|
|
512
|
+
};
|
|
513
|
+
label?: string | undefined;
|
|
514
|
+
} | {
|
|
515
|
+
type: "href.open";
|
|
516
|
+
target: {
|
|
517
|
+
href: string;
|
|
518
|
+
};
|
|
519
|
+
label?: string | undefined;
|
|
520
|
+
})[] | undefined;
|
|
521
|
+
level?: "info" | "success" | "warning" | "error" | undefined;
|
|
522
|
+
}>;
|
|
523
|
+
type NotificationRecord = z.infer<typeof NotificationRecordSchema>;
|
|
524
|
+
interface NotificationAggregate {
|
|
525
|
+
key: string;
|
|
526
|
+
notifications: NotificationRecord[];
|
|
527
|
+
latest: NotificationRecord;
|
|
528
|
+
count: number;
|
|
529
|
+
}
|
|
530
|
+
interface NotificationGroup {
|
|
531
|
+
key: NotificationGroupKey;
|
|
532
|
+
label: string;
|
|
533
|
+
source: NotificationSource;
|
|
534
|
+
notifications: NotificationRecord[];
|
|
535
|
+
aggregates: NotificationAggregate[];
|
|
536
|
+
latest: NotificationRecord;
|
|
537
|
+
unreadCount: number;
|
|
538
|
+
}
|
|
539
|
+
declare function getNotificationGroupKey(notification: {
|
|
540
|
+
source: NotificationSource;
|
|
541
|
+
}): NotificationGroupKey;
|
|
542
|
+
declare function getNotificationGroupLabel(source: NotificationSource): string;
|
|
543
|
+
declare function getNotificationAggregateKey(notification: NotificationRecord): string;
|
|
544
|
+
declare function aggregateNotifications(notifications: readonly NotificationRecord[]): NotificationAggregate[];
|
|
545
|
+
declare function groupNotifications(notifications: readonly NotificationRecord[]): NotificationGroup[];
|
|
546
|
+
type TerminalNotificationEvent = TerminalControlEvent;
|
|
547
|
+
type TerminalNotificationParseResult = TerminalControlParseResult;
|
|
548
|
+
declare const TerminalNotificationParser: typeof TerminalControlParser;
|
|
549
|
+
//#endregion
|
|
550
|
+
export { TerminalNotificationProtocol as A, getNotificationAggregateKey as C, TerminalControlEvent as D, groupNotifications as E, TerminalPromptState as M, TerminalTitleTarget as N, TerminalControlParseResult as O, terminalNotificationEventToPublishInput as P, aggregateNotifications as S, getNotificationGroupLabel as T, NotificationSource as _, NotificationAggregate as a, TerminalNotificationParseResult as b, NotificationGroupKeySchema as c, NotificationRecord as d, NotificationRecordSchema as f, NotificationSoundSchema as g, NotificationSound as h, NotificationActionSchema as i, TerminalProgressState as j, TerminalControlParser as k, NotificationPublishInput as l, NotificationSettingsSchema as m, NOTIFICATION_SOUND_VALUES as n, NotificationGroup as o, NotificationSettings as p, NotificationAction as r, NotificationGroupKey as s, NOTIFICATION_SOUND_OPTIONS as t, NotificationPublishInputSchema as u, NotificationSourceSchema as v, getNotificationGroupKey as w, TerminalNotificationParser as x, TerminalNotificationEvent as y };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { g as SoundVolumeSchema, m as SoundConfigIdSchema, u as DEFAULT_NOTIFICATION_SOUND_ID } from "./sounds-C0dNSFm8.mjs";
|
|
2
|
+
import { t as TerminalControlParser } from "./terminal-control-DtBprY6-.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/notifications.ts
|
|
6
|
+
const NOTIFICATION_SOUND_VALUES = [
|
|
7
|
+
"silent",
|
|
8
|
+
"soft",
|
|
9
|
+
"clear",
|
|
10
|
+
"pulse"
|
|
11
|
+
];
|
|
12
|
+
const NotificationSoundSchema = SoundConfigIdSchema;
|
|
13
|
+
const NOTIFICATION_SOUND_OPTIONS = [{
|
|
14
|
+
id: "silent",
|
|
15
|
+
label: "Silent"
|
|
16
|
+
}, {
|
|
17
|
+
id: DEFAULT_NOTIFICATION_SOUND_ID,
|
|
18
|
+
label: "Blow"
|
|
19
|
+
}];
|
|
20
|
+
const NotificationSettingsSchema = z.object({
|
|
21
|
+
sound: NotificationSoundSchema.default(DEFAULT_NOTIFICATION_SOUND_ID),
|
|
22
|
+
volume: SoundVolumeSchema,
|
|
23
|
+
systemNotificationsEnabled: z.boolean().default(false)
|
|
24
|
+
});
|
|
25
|
+
const NotificationSourceSchema = z.discriminatedUnion("type", [
|
|
26
|
+
z.object({
|
|
27
|
+
type: z.literal("terminal"),
|
|
28
|
+
sessionId: z.string().min(1),
|
|
29
|
+
title: z.string().optional()
|
|
30
|
+
}),
|
|
31
|
+
z.object({
|
|
32
|
+
type: z.literal("openspec-change"),
|
|
33
|
+
changeId: z.string().min(1),
|
|
34
|
+
title: z.string().optional()
|
|
35
|
+
}),
|
|
36
|
+
z.object({
|
|
37
|
+
type: z.literal("hooks-plugin"),
|
|
38
|
+
pluginId: z.string().min(1),
|
|
39
|
+
title: z.string().optional()
|
|
40
|
+
}),
|
|
41
|
+
z.object({
|
|
42
|
+
type: z.literal("custom"),
|
|
43
|
+
groupId: z.string().min(1),
|
|
44
|
+
title: z.string().optional()
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
47
|
+
const NotificationActionSchema = z.discriminatedUnion("type", [z.object({
|
|
48
|
+
type: z.literal("terminal.focus"),
|
|
49
|
+
label: z.string().default("Focus terminal"),
|
|
50
|
+
target: z.object({ sessionId: z.string().min(1) })
|
|
51
|
+
}), z.object({
|
|
52
|
+
type: z.literal("href.open"),
|
|
53
|
+
label: z.string().default("Open"),
|
|
54
|
+
target: z.object({ href: z.string().min(1) })
|
|
55
|
+
})]);
|
|
56
|
+
const NotificationGroupKeySchema = z.string().min(1);
|
|
57
|
+
const NotificationPublishInputSchema = z.object({
|
|
58
|
+
title: z.string().min(1).max(160),
|
|
59
|
+
body: z.string().max(2e3).default(""),
|
|
60
|
+
source: NotificationSourceSchema,
|
|
61
|
+
actions: z.array(NotificationActionSchema).default([]),
|
|
62
|
+
level: z.enum([
|
|
63
|
+
"info",
|
|
64
|
+
"success",
|
|
65
|
+
"warning",
|
|
66
|
+
"error"
|
|
67
|
+
]).default("info"),
|
|
68
|
+
createdAt: z.number().int().positive().optional()
|
|
69
|
+
});
|
|
70
|
+
const NotificationRecordSchema = NotificationPublishInputSchema.extend({
|
|
71
|
+
id: z.string().min(1),
|
|
72
|
+
createdAt: z.number().int().positive(),
|
|
73
|
+
groupKey: NotificationGroupKeySchema
|
|
74
|
+
});
|
|
75
|
+
function getNotificationGroupKey(notification) {
|
|
76
|
+
const { source } = notification;
|
|
77
|
+
if (source.type === "terminal") return `terminal:${source.sessionId}`;
|
|
78
|
+
if (source.type === "openspec-change") return `openspec-change:${source.changeId}`;
|
|
79
|
+
if (source.type === "hooks-plugin") return `hooks-plugin:${source.pluginId}`;
|
|
80
|
+
return `custom:${source.groupId}`;
|
|
81
|
+
}
|
|
82
|
+
function getNotificationGroupLabel(source) {
|
|
83
|
+
if (source.type === "terminal") return source.title?.trim() || `Terminal ${source.sessionId}`;
|
|
84
|
+
if (source.type === "openspec-change") return source.title?.trim() || `Change ${source.changeId}`;
|
|
85
|
+
if (source.type === "hooks-plugin") return source.title?.trim() || `Plugin ${source.pluginId}`;
|
|
86
|
+
return source.title?.trim() || source.groupId;
|
|
87
|
+
}
|
|
88
|
+
function stableStringify(value) {
|
|
89
|
+
if (Array.isArray(value)) return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
90
|
+
if (value && typeof value === "object") return `{${Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`;
|
|
91
|
+
return JSON.stringify(value);
|
|
92
|
+
}
|
|
93
|
+
function getNotificationAggregateKey(notification) {
|
|
94
|
+
return stableStringify({
|
|
95
|
+
groupKey: notification.groupKey,
|
|
96
|
+
title: notification.title,
|
|
97
|
+
body: notification.body,
|
|
98
|
+
source: notification.source,
|
|
99
|
+
actions: notification.actions,
|
|
100
|
+
level: notification.level
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function aggregateNotifications(notifications) {
|
|
104
|
+
const aggregates = /* @__PURE__ */ new Map();
|
|
105
|
+
for (const notification of notifications) {
|
|
106
|
+
const key = getNotificationAggregateKey(notification);
|
|
107
|
+
const aggregate = aggregates.get(key);
|
|
108
|
+
if (aggregate) aggregate.push(notification);
|
|
109
|
+
else aggregates.set(key, [notification]);
|
|
110
|
+
}
|
|
111
|
+
return [...aggregates.entries()].map(([key, items]) => {
|
|
112
|
+
const sortedItems = [...items].sort((a, b) => b.createdAt - a.createdAt);
|
|
113
|
+
return {
|
|
114
|
+
key,
|
|
115
|
+
notifications: sortedItems,
|
|
116
|
+
latest: sortedItems[0],
|
|
117
|
+
count: sortedItems.length
|
|
118
|
+
};
|
|
119
|
+
}).sort((a, b) => b.latest.createdAt - a.latest.createdAt);
|
|
120
|
+
}
|
|
121
|
+
function groupNotifications(notifications) {
|
|
122
|
+
const groups = /* @__PURE__ */ new Map();
|
|
123
|
+
for (const notification of notifications) {
|
|
124
|
+
const group = groups.get(notification.groupKey);
|
|
125
|
+
if (group) group.push(notification);
|
|
126
|
+
else groups.set(notification.groupKey, [notification]);
|
|
127
|
+
}
|
|
128
|
+
return [...groups.entries()].map(([key, items]) => {
|
|
129
|
+
const sortedItems = [...items].sort((a, b) => b.createdAt - a.createdAt);
|
|
130
|
+
const latest = sortedItems[0];
|
|
131
|
+
return {
|
|
132
|
+
key,
|
|
133
|
+
label: getNotificationGroupLabel(latest.source),
|
|
134
|
+
source: latest.source,
|
|
135
|
+
notifications: sortedItems,
|
|
136
|
+
aggregates: aggregateNotifications(sortedItems),
|
|
137
|
+
latest,
|
|
138
|
+
unreadCount: sortedItems.length
|
|
139
|
+
};
|
|
140
|
+
}).sort((a, b) => b.latest.createdAt - a.latest.createdAt);
|
|
141
|
+
}
|
|
142
|
+
const TerminalNotificationParser = TerminalControlParser;
|
|
143
|
+
|
|
144
|
+
//#endregion
|
|
145
|
+
export { NotificationPublishInputSchema as a, NotificationSoundSchema as c, aggregateNotifications as d, getNotificationAggregateKey as f, groupNotifications as h, NotificationGroupKeySchema as i, NotificationSourceSchema as l, getNotificationGroupLabel as m, NOTIFICATION_SOUND_VALUES as n, NotificationRecordSchema as o, getNotificationGroupKey as p, NotificationActionSchema as r, NotificationSettingsSchema as s, NOTIFICATION_SOUND_OPTIONS as t, TerminalNotificationParser as u };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./sounds-CxwbTXZS.mjs";
|
|
2
|
+
import { C as getNotificationAggregateKey, E as groupNotifications, P as terminalNotificationEventToPublishInput, S as aggregateNotifications, T as getNotificationGroupLabel, _ as NotificationSource, a as NotificationAggregate, b as TerminalNotificationParseResult, c as NotificationGroupKeySchema, d as NotificationRecord, f as NotificationRecordSchema, g as NotificationSoundSchema, h as NotificationSound, i as NotificationActionSchema, k as TerminalControlParser, l as NotificationPublishInput, m as NotificationSettingsSchema, n as NOTIFICATION_SOUND_VALUES, o as NotificationGroup, p as NotificationSettings, r as NotificationAction, s as NotificationGroupKey, t as NOTIFICATION_SOUND_OPTIONS, u as NotificationPublishInputSchema, v as NotificationSourceSchema, w as getNotificationGroupKey, x as TerminalNotificationParser, y as TerminalNotificationEvent } from "./notifications-DOQwtdfS.mjs";
|
|
3
|
+
export { NOTIFICATION_SOUND_OPTIONS, NOTIFICATION_SOUND_VALUES, NotificationAction, NotificationActionSchema, NotificationAggregate, NotificationGroup, NotificationGroupKey, NotificationGroupKeySchema, NotificationPublishInput, NotificationPublishInputSchema, NotificationRecord, NotificationRecordSchema, NotificationSettings, NotificationSettingsSchema, NotificationSound, NotificationSoundSchema, NotificationSource, NotificationSourceSchema, TerminalControlParser, TerminalNotificationEvent, TerminalNotificationParseResult, TerminalNotificationParser, aggregateNotifications, getNotificationAggregateKey, getNotificationGroupKey, getNotificationGroupLabel, groupNotifications, terminalNotificationEventToPublishInput };
|