@myagentroam/protocol 0.10.24 → 0.10.25

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/index.js CHANGED
@@ -17,6 +17,8 @@ export * from './git-identity.js';
17
17
  export * from './direct-transfer.js';
18
18
  export * from './terminal-direct.js';
19
19
  export * from './mail-notification.js';
20
+ export * from './notification-channels.js';
21
+ export * from './web-push.js';
20
22
  export * from './model-usage.js';
21
23
  export * from './management-pagination.js';
22
24
  export const healthStatusSchema = z.object({
@@ -1713,6 +1715,21 @@ export const eventCursorSchema = z.object({
1713
1715
  streamId: z.string().min(1).max(128),
1714
1716
  cursor: z.string().min(1).max(1024)
1715
1717
  });
1718
+ export const permissionStopSchema = z.object({
1719
+ action: z.enum(['ask', 'deny']),
1720
+ reason: z
1721
+ .string()
1722
+ .trim()
1723
+ .min(1)
1724
+ .refine((value) => [...value].length <= 240),
1725
+ source: z.object({
1726
+ sessionId: z.string().min(1).max(128),
1727
+ executionId: z.string().min(1).max(128),
1728
+ callId: z.string().min(1).max(128),
1729
+ toolName: z.string().min(1).max(128),
1730
+ parentCallId: z.string().min(1).max(128).optional()
1731
+ })
1732
+ });
1716
1733
  const conversationItemBaseSchema = z.object({
1717
1734
  id: z.string().min(1).max(128),
1718
1735
  sessionId: z.string().min(1).max(128),
@@ -1733,7 +1750,8 @@ const conversationItemBaseSchema = z.object({
1733
1750
  startedAt: z.number().int().nonnegative().nullable(),
1734
1751
  completedAt: z.number().int().nonnegative().nullable(),
1735
1752
  segmentId: z.string().min(1).max(256).optional(),
1736
- segmentIndex: z.number().int().nonnegative().optional()
1753
+ segmentIndex: z.number().int().nonnegative().optional(),
1754
+ permissionStop: permissionStopSchema.optional()
1737
1755
  });
1738
1756
  export const contextReferenceSchema = z.object({
1739
1757
  type: z.enum(['file', 'directory', 'changes', 'diff', 'turn', 'message', 'terminal_selection']),
@@ -0,0 +1,436 @@
1
+ import { z } from 'zod';
2
+ export declare const notificationInputSchema: z.ZodEffects<z.ZodObject<{
3
+ channels: z.ZodDefault<z.ZodArray<z.ZodEnum<["push", "email"]>, "many">>;
4
+ title: z.ZodOptional<z.ZodString>;
5
+ message: z.ZodString;
6
+ recipientEmail: z.ZodOptional<z.ZodString>;
7
+ templateId: z.ZodOptional<z.ZodEnum<["", "notification-en-US", "notification-zh-CN"]>>;
8
+ }, "strict", z.ZodTypeAny, {
9
+ message: string;
10
+ channels: ("push" | "email")[];
11
+ templateId?: "" | "notification-en-US" | "notification-zh-CN" | undefined;
12
+ title?: string | undefined;
13
+ recipientEmail?: string | undefined;
14
+ }, {
15
+ message: string;
16
+ templateId?: "" | "notification-en-US" | "notification-zh-CN" | undefined;
17
+ title?: string | undefined;
18
+ recipientEmail?: string | undefined;
19
+ channels?: ("push" | "email")[] | undefined;
20
+ }>, {
21
+ message: string;
22
+ channels: ("push" | "email")[];
23
+ templateId?: "" | "notification-en-US" | "notification-zh-CN" | undefined;
24
+ title?: string | undefined;
25
+ recipientEmail?: string | undefined;
26
+ }, {
27
+ message: string;
28
+ templateId?: "" | "notification-en-US" | "notification-zh-CN" | undefined;
29
+ title?: string | undefined;
30
+ recipientEmail?: string | undefined;
31
+ channels?: ("push" | "email")[] | undefined;
32
+ }>;
33
+ export declare const notificationChannelsRequestSchema: z.ZodEffects<z.ZodObject<{
34
+ channels: z.ZodDefault<z.ZodArray<z.ZodEnum<["push", "email"]>, "many">>;
35
+ title: z.ZodOptional<z.ZodString>;
36
+ message: z.ZodString;
37
+ recipientEmail: z.ZodOptional<z.ZodString>;
38
+ templateId: z.ZodOptional<z.ZodEnum<["", "notification-en-US", "notification-zh-CN"]>>;
39
+ } & {
40
+ apiVersion: z.ZodLiteral<1>;
41
+ eventType: z.ZodLiteral<"notification">;
42
+ kind: z.ZodLiteral<"AGENT_MESSAGE">;
43
+ occurredAt: z.ZodNumber;
44
+ sessionTitle: z.ZodString;
45
+ source: z.ZodEnum<["MANUAL", "SCHEDULED"]>;
46
+ workspaceId: z.ZodString;
47
+ sessionId: z.ZodString;
48
+ userId: z.ZodNumber;
49
+ executionId: z.ZodString;
50
+ callId: z.ZodString;
51
+ }, "strict", z.ZodTypeAny, {
52
+ message: string;
53
+ apiVersion: 1;
54
+ source: "MANUAL" | "SCHEDULED";
55
+ kind: "AGENT_MESSAGE";
56
+ workspaceId: string;
57
+ eventType: "notification";
58
+ occurredAt: number;
59
+ sessionId: string;
60
+ userId: number;
61
+ executionId: string;
62
+ callId: string;
63
+ channels: ("push" | "email")[];
64
+ sessionTitle: string;
65
+ templateId?: "" | "notification-en-US" | "notification-zh-CN" | undefined;
66
+ title?: string | undefined;
67
+ recipientEmail?: string | undefined;
68
+ }, {
69
+ message: string;
70
+ apiVersion: 1;
71
+ source: "MANUAL" | "SCHEDULED";
72
+ kind: "AGENT_MESSAGE";
73
+ workspaceId: string;
74
+ eventType: "notification";
75
+ occurredAt: number;
76
+ sessionId: string;
77
+ userId: number;
78
+ executionId: string;
79
+ callId: string;
80
+ sessionTitle: string;
81
+ templateId?: "" | "notification-en-US" | "notification-zh-CN" | undefined;
82
+ title?: string | undefined;
83
+ recipientEmail?: string | undefined;
84
+ channels?: ("push" | "email")[] | undefined;
85
+ }>, {
86
+ message: string;
87
+ apiVersion: 1;
88
+ source: "MANUAL" | "SCHEDULED";
89
+ kind: "AGENT_MESSAGE";
90
+ workspaceId: string;
91
+ eventType: "notification";
92
+ occurredAt: number;
93
+ sessionId: string;
94
+ userId: number;
95
+ executionId: string;
96
+ callId: string;
97
+ channels: ("push" | "email")[];
98
+ sessionTitle: string;
99
+ templateId?: "" | "notification-en-US" | "notification-zh-CN" | undefined;
100
+ title?: string | undefined;
101
+ recipientEmail?: string | undefined;
102
+ }, {
103
+ message: string;
104
+ apiVersion: 1;
105
+ source: "MANUAL" | "SCHEDULED";
106
+ kind: "AGENT_MESSAGE";
107
+ workspaceId: string;
108
+ eventType: "notification";
109
+ occurredAt: number;
110
+ sessionId: string;
111
+ userId: number;
112
+ executionId: string;
113
+ callId: string;
114
+ sessionTitle: string;
115
+ templateId?: "" | "notification-en-US" | "notification-zh-CN" | undefined;
116
+ title?: string | undefined;
117
+ recipientEmail?: string | undefined;
118
+ channels?: ("push" | "email")[] | undefined;
119
+ }>;
120
+ export type NotificationChannelsRequest = z.infer<typeof notificationChannelsRequestSchema>;
121
+ export declare const pushDeliveryResultSchema: z.ZodObject<{
122
+ status: z.ZodEnum<["suppressed", "skipped", "accepted", "partial", "failed", "uncertain"]>;
123
+ reason: z.ZodOptional<z.ZodString>;
124
+ eligible: z.ZodNumber;
125
+ attempted: z.ZodNumber;
126
+ accepted: z.ZodNumber;
127
+ skipped: z.ZodNumber;
128
+ failed: z.ZodNumber;
129
+ uncertain: z.ZodNumber;
130
+ }, "strict", z.ZodTypeAny, {
131
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
132
+ failed: number;
133
+ accepted: number;
134
+ skipped: number;
135
+ uncertain: number;
136
+ eligible: number;
137
+ attempted: number;
138
+ reason?: string | undefined;
139
+ }, {
140
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
141
+ failed: number;
142
+ accepted: number;
143
+ skipped: number;
144
+ uncertain: number;
145
+ eligible: number;
146
+ attempted: number;
147
+ reason?: string | undefined;
148
+ }>;
149
+ export type PushDeliveryResult = z.infer<typeof pushDeliveryResultSchema>;
150
+ export declare const notificationChannelsResultSchema: z.ZodObject<{
151
+ callId: z.ZodString;
152
+ push: z.ZodOptional<z.ZodObject<{
153
+ notificationId: z.ZodOptional<z.ZodString>;
154
+ persisted: z.ZodBoolean;
155
+ delivery: z.ZodObject<{
156
+ status: z.ZodEnum<["suppressed", "skipped", "accepted", "partial", "failed", "uncertain"]>;
157
+ reason: z.ZodOptional<z.ZodString>;
158
+ eligible: z.ZodNumber;
159
+ attempted: z.ZodNumber;
160
+ accepted: z.ZodNumber;
161
+ skipped: z.ZodNumber;
162
+ failed: z.ZodNumber;
163
+ uncertain: z.ZodNumber;
164
+ }, "strict", z.ZodTypeAny, {
165
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
166
+ failed: number;
167
+ accepted: number;
168
+ skipped: number;
169
+ uncertain: number;
170
+ eligible: number;
171
+ attempted: number;
172
+ reason?: string | undefined;
173
+ }, {
174
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
175
+ failed: number;
176
+ accepted: number;
177
+ skipped: number;
178
+ uncertain: number;
179
+ eligible: number;
180
+ attempted: number;
181
+ reason?: string | undefined;
182
+ }>;
183
+ }, "strict", z.ZodTypeAny, {
184
+ persisted: boolean;
185
+ delivery: {
186
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
187
+ failed: number;
188
+ accepted: number;
189
+ skipped: number;
190
+ uncertain: number;
191
+ eligible: number;
192
+ attempted: number;
193
+ reason?: string | undefined;
194
+ };
195
+ notificationId?: string | undefined;
196
+ }, {
197
+ persisted: boolean;
198
+ delivery: {
199
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
200
+ failed: number;
201
+ accepted: number;
202
+ skipped: number;
203
+ uncertain: number;
204
+ eligible: number;
205
+ attempted: number;
206
+ reason?: string | undefined;
207
+ };
208
+ notificationId?: string | undefined;
209
+ }>>;
210
+ email: z.ZodOptional<z.ZodObject<{
211
+ status: z.ZodEnum<["accepted", "failed", "uncertain"]>;
212
+ error: z.ZodOptional<z.ZodObject<{
213
+ code: z.ZodString;
214
+ message: z.ZodString;
215
+ }, "strict", z.ZodTypeAny, {
216
+ code: string;
217
+ message: string;
218
+ }, {
219
+ code: string;
220
+ message: string;
221
+ }>>;
222
+ }, "strict", z.ZodTypeAny, {
223
+ status: "failed" | "accepted" | "uncertain";
224
+ error?: {
225
+ code: string;
226
+ message: string;
227
+ } | undefined;
228
+ }, {
229
+ status: "failed" | "accepted" | "uncertain";
230
+ error?: {
231
+ code: string;
232
+ message: string;
233
+ } | undefined;
234
+ }>>;
235
+ }, "strict", z.ZodTypeAny, {
236
+ callId: string;
237
+ push?: {
238
+ persisted: boolean;
239
+ delivery: {
240
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
241
+ failed: number;
242
+ accepted: number;
243
+ skipped: number;
244
+ uncertain: number;
245
+ eligible: number;
246
+ attempted: number;
247
+ reason?: string | undefined;
248
+ };
249
+ notificationId?: string | undefined;
250
+ } | undefined;
251
+ email?: {
252
+ status: "failed" | "accepted" | "uncertain";
253
+ error?: {
254
+ code: string;
255
+ message: string;
256
+ } | undefined;
257
+ } | undefined;
258
+ }, {
259
+ callId: string;
260
+ push?: {
261
+ persisted: boolean;
262
+ delivery: {
263
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
264
+ failed: number;
265
+ accepted: number;
266
+ skipped: number;
267
+ uncertain: number;
268
+ eligible: number;
269
+ attempted: number;
270
+ reason?: string | undefined;
271
+ };
272
+ notificationId?: string | undefined;
273
+ } | undefined;
274
+ email?: {
275
+ status: "failed" | "accepted" | "uncertain";
276
+ error?: {
277
+ code: string;
278
+ message: string;
279
+ } | undefined;
280
+ } | undefined;
281
+ }>;
282
+ export type NotificationChannelsResult = z.infer<typeof notificationChannelsResultSchema>;
283
+ export declare const notificationChannelsResponseSchema: z.ZodUnion<[z.ZodObject<{
284
+ callId: z.ZodString;
285
+ push: z.ZodOptional<z.ZodObject<{
286
+ notificationId: z.ZodOptional<z.ZodString>;
287
+ persisted: z.ZodBoolean;
288
+ delivery: z.ZodObject<{
289
+ status: z.ZodEnum<["suppressed", "skipped", "accepted", "partial", "failed", "uncertain"]>;
290
+ reason: z.ZodOptional<z.ZodString>;
291
+ eligible: z.ZodNumber;
292
+ attempted: z.ZodNumber;
293
+ accepted: z.ZodNumber;
294
+ skipped: z.ZodNumber;
295
+ failed: z.ZodNumber;
296
+ uncertain: z.ZodNumber;
297
+ }, "strict", z.ZodTypeAny, {
298
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
299
+ failed: number;
300
+ accepted: number;
301
+ skipped: number;
302
+ uncertain: number;
303
+ eligible: number;
304
+ attempted: number;
305
+ reason?: string | undefined;
306
+ }, {
307
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
308
+ failed: number;
309
+ accepted: number;
310
+ skipped: number;
311
+ uncertain: number;
312
+ eligible: number;
313
+ attempted: number;
314
+ reason?: string | undefined;
315
+ }>;
316
+ }, "strict", z.ZodTypeAny, {
317
+ persisted: boolean;
318
+ delivery: {
319
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
320
+ failed: number;
321
+ accepted: number;
322
+ skipped: number;
323
+ uncertain: number;
324
+ eligible: number;
325
+ attempted: number;
326
+ reason?: string | undefined;
327
+ };
328
+ notificationId?: string | undefined;
329
+ }, {
330
+ persisted: boolean;
331
+ delivery: {
332
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
333
+ failed: number;
334
+ accepted: number;
335
+ skipped: number;
336
+ uncertain: number;
337
+ eligible: number;
338
+ attempted: number;
339
+ reason?: string | undefined;
340
+ };
341
+ notificationId?: string | undefined;
342
+ }>>;
343
+ email: z.ZodOptional<z.ZodObject<{
344
+ status: z.ZodEnum<["accepted", "failed", "uncertain"]>;
345
+ error: z.ZodOptional<z.ZodObject<{
346
+ code: z.ZodString;
347
+ message: z.ZodString;
348
+ }, "strict", z.ZodTypeAny, {
349
+ code: string;
350
+ message: string;
351
+ }, {
352
+ code: string;
353
+ message: string;
354
+ }>>;
355
+ }, "strict", z.ZodTypeAny, {
356
+ status: "failed" | "accepted" | "uncertain";
357
+ error?: {
358
+ code: string;
359
+ message: string;
360
+ } | undefined;
361
+ }, {
362
+ status: "failed" | "accepted" | "uncertain";
363
+ error?: {
364
+ code: string;
365
+ message: string;
366
+ } | undefined;
367
+ }>>;
368
+ }, "strict", z.ZodTypeAny, {
369
+ callId: string;
370
+ push?: {
371
+ persisted: boolean;
372
+ delivery: {
373
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
374
+ failed: number;
375
+ accepted: number;
376
+ skipped: number;
377
+ uncertain: number;
378
+ eligible: number;
379
+ attempted: number;
380
+ reason?: string | undefined;
381
+ };
382
+ notificationId?: string | undefined;
383
+ } | undefined;
384
+ email?: {
385
+ status: "failed" | "accepted" | "uncertain";
386
+ error?: {
387
+ code: string;
388
+ message: string;
389
+ } | undefined;
390
+ } | undefined;
391
+ }, {
392
+ callId: string;
393
+ push?: {
394
+ persisted: boolean;
395
+ delivery: {
396
+ status: "failed" | "partial" | "accepted" | "suppressed" | "skipped" | "uncertain";
397
+ failed: number;
398
+ accepted: number;
399
+ skipped: number;
400
+ uncertain: number;
401
+ eligible: number;
402
+ attempted: number;
403
+ reason?: string | undefined;
404
+ };
405
+ notificationId?: string | undefined;
406
+ } | undefined;
407
+ email?: {
408
+ status: "failed" | "accepted" | "uncertain";
409
+ error?: {
410
+ code: string;
411
+ message: string;
412
+ } | undefined;
413
+ } | undefined;
414
+ }>, z.ZodObject<{
415
+ error: z.ZodObject<{
416
+ code: z.ZodString;
417
+ message: z.ZodString;
418
+ }, "strict", z.ZodTypeAny, {
419
+ code: string;
420
+ message: string;
421
+ }, {
422
+ code: string;
423
+ message: string;
424
+ }>;
425
+ }, "strict", z.ZodTypeAny, {
426
+ error: {
427
+ code: string;
428
+ message: string;
429
+ };
430
+ }, {
431
+ error: {
432
+ code: string;
433
+ message: string;
434
+ };
435
+ }>]>;
436
+ export type NotificationChannelsResponse = z.infer<typeof notificationChannelsResponseSchema>;
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod';
2
+ import { mailNotificationRequestSchema } from './mail-notification.js';
3
+ const notificationInput = z
4
+ .object({
5
+ channels: z
6
+ .array(z.enum(['push', 'email']))
7
+ .min(1)
8
+ .max(2)
9
+ .default(['push']),
10
+ title: z
11
+ .string()
12
+ .max(160)
13
+ .regex(/^[^\r\n]*$/u)
14
+ .optional(),
15
+ message: z.string().min(1).max(4000),
16
+ recipientEmail: z.string().email().max(320).optional(),
17
+ templateId: z.enum(['', 'notification-en-US', 'notification-zh-CN']).optional()
18
+ })
19
+ .strict();
20
+ function validateChannels(input, context) {
21
+ if (new Set(input.channels).size !== input.channels.length)
22
+ context.addIssue({ code: 'custom', message: 'Duplicate notification channels.' });
23
+ if (input.channels.includes('email')
24
+ ? input.recipientEmail === undefined
25
+ : input.recipientEmail !== undefined || input.templateId !== undefined)
26
+ context.addIssue({
27
+ code: 'custom',
28
+ message: 'Email parameters must match the requested channels.'
29
+ });
30
+ }
31
+ export const notificationInputSchema = notificationInput.superRefine(validateChannels);
32
+ export const notificationChannelsRequestSchema = notificationInput
33
+ .extend({
34
+ ...mailNotificationRequestSchema.pick({
35
+ executionId: true,
36
+ sessionId: true,
37
+ workspaceId: true,
38
+ userId: true,
39
+ source: true,
40
+ callId: true
41
+ }).shape,
42
+ apiVersion: z.literal(1),
43
+ eventType: z.literal('notification'),
44
+ kind: z.literal('AGENT_MESSAGE'),
45
+ occurredAt: z.number().int().nonnegative().safe(),
46
+ sessionTitle: z.string().min(1).max(160)
47
+ })
48
+ .superRefine(validateChannels);
49
+ const count = z.number().int().min(0).max(32);
50
+ export const pushDeliveryResultSchema = z
51
+ .object({
52
+ status: z.enum(['suppressed', 'skipped', 'accepted', 'partial', 'failed', 'uncertain']),
53
+ reason: z
54
+ .string()
55
+ .regex(/^[A-Z][A-Z0-9_]{0,127}$/u)
56
+ .optional(),
57
+ eligible: count,
58
+ attempted: count,
59
+ accepted: count,
60
+ skipped: count,
61
+ failed: count,
62
+ uncertain: count
63
+ })
64
+ .strict();
65
+ const channelError = z
66
+ .object({
67
+ code: z.string().regex(/^[A-Z][A-Z0-9_]{0,127}$/u),
68
+ message: z.string().min(1).max(512)
69
+ })
70
+ .strict();
71
+ export const notificationChannelsResultSchema = z
72
+ .object({
73
+ callId: z.string().uuid(),
74
+ push: z
75
+ .object({
76
+ notificationId: z.string().uuid().optional(),
77
+ persisted: z.boolean(),
78
+ delivery: pushDeliveryResultSchema
79
+ })
80
+ .strict()
81
+ .optional(),
82
+ email: z
83
+ .object({
84
+ status: z.enum(['accepted', 'failed', 'uncertain']),
85
+ error: channelError.optional()
86
+ })
87
+ .strict()
88
+ .optional()
89
+ })
90
+ .strict();
91
+ export const notificationChannelsResponseSchema = z.union([
92
+ notificationChannelsResultSchema,
93
+ z.object({ error: channelError }).strict()
94
+ ]);