@myagentroam/protocol 0.10.40 → 0.10.42

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.
@@ -0,0 +1,13 @@
1
+ export interface ComposerMarkupField {
2
+ readonly name: string;
3
+ readonly attributes: Record<string, string>;
4
+ readonly text: string;
5
+ }
6
+ export declare function escapeMarkup(value: string): string;
7
+ export declare function markupAttributes(values: object): string;
8
+ export declare function parseComposerMarkup(raw: string): {
9
+ name: string;
10
+ attributes: Record<string, string>;
11
+ fields: ComposerMarkupField[];
12
+ };
13
+ export declare function composerMarkupEnd(text: string, start: number): number;
@@ -0,0 +1,103 @@
1
+ export function escapeMarkup(value) {
2
+ return value.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
3
+ }
4
+ export function markupAttributes(values) {
5
+ return Object.entries(values)
6
+ .filter(([, value]) => value !== undefined)
7
+ .map(([key, value]) => ` ${key}="${escapeMarkup(String(value)).replaceAll('"', '&quot;').replaceAll('\r', '&#13;').replaceAll('\n', '&#10;').replaceAll('\t', '&#9;')}"`)
8
+ .join('');
9
+ }
10
+ function decode(value) {
11
+ if (value.includes('<'))
12
+ throw new Error('COMPOSER_TAG_INVALID');
13
+ return value.replace(/&([^;]*);|&/gu, (_, name) => {
14
+ const predefined = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'" };
15
+ if (name && Object.hasOwn(predefined, name))
16
+ return predefined[name];
17
+ if (name && /^#(?:[0-9]+|x[0-9a-fA-F]+)$/u.test(name)) {
18
+ const point = name[1] === 'x' ? Number.parseInt(name.slice(2), 16) : Number(name.slice(1));
19
+ if (point === 9 ||
20
+ point === 10 ||
21
+ point === 13 ||
22
+ (point >= 32 &&
23
+ point <= 0x10ffff &&
24
+ !(point >= 0xd800 && point <= 0xdfff) &&
25
+ point !== 0xfffe &&
26
+ point !== 0xffff))
27
+ return String.fromCodePoint(point);
28
+ }
29
+ throw new Error('COMPOSER_TAG_INVALID');
30
+ });
31
+ }
32
+ const header = /^<([a-z_]+)((?:\s+[A-Za-z][A-Za-z0-9]*="[^"<]*")*)\s*(\/?)>/u;
33
+ function attributes(text) {
34
+ const result = Object.create(null);
35
+ for (const match of text.matchAll(/\s+([A-Za-z][A-Za-z0-9]*)="([^"]*)"/gu)) {
36
+ if (Object.hasOwn(result, match[1]))
37
+ throw new Error('COMPOSER_TAG_INVALID');
38
+ result[match[1]] = decode(match[2]);
39
+ }
40
+ return result;
41
+ }
42
+ export function parseComposerMarkup(raw) {
43
+ const root = header.exec(raw);
44
+ if (!root)
45
+ throw new Error('COMPOSER_TAG_INVALID');
46
+ const result = {
47
+ name: root[1],
48
+ attributes: attributes(root[2]),
49
+ fields: []
50
+ };
51
+ if (root[3]) {
52
+ if (root[0].length !== raw.length)
53
+ throw new Error('COMPOSER_TAG_INVALID');
54
+ return result;
55
+ }
56
+ const close = `</${root[1]}>`;
57
+ if (!raw.endsWith(close))
58
+ throw new Error('COMPOSER_TAG_INVALID');
59
+ const body = raw.slice(root[0].length, -close.length);
60
+ let offset = 0;
61
+ while (offset < body.length) {
62
+ offset += /^\s*/u.exec(body.slice(offset))[0].length;
63
+ if (offset === body.length)
64
+ break;
65
+ const field = header.exec(body.slice(offset));
66
+ if (!field)
67
+ throw new Error('COMPOSER_TAG_INVALID');
68
+ offset += field[0].length;
69
+ let text = '';
70
+ if (!field[3]) {
71
+ const end = body.indexOf(`</${field[1]}>`, offset);
72
+ if (end < 0)
73
+ throw new Error('COMPOSER_TAG_INVALID');
74
+ text = decode(body.slice(offset, end));
75
+ offset = end + field[1].length + 3;
76
+ }
77
+ result.fields.push({ name: field[1], attributes: attributes(field[2]), text });
78
+ }
79
+ return result;
80
+ }
81
+ // Find the whole candidate before validating it, so invalid parents cannot hide children.
82
+ export function composerMarkupEnd(text, start) {
83
+ const tags = /<\/?([^\s<>/"']+)(?=[\s/>])(?:"[^"]*"|'[^']*'|[^'"<>])*>/gu;
84
+ tags.lastIndex = start;
85
+ const opening = tags.exec(text);
86
+ if (!opening || opening.index !== start)
87
+ return text.length;
88
+ if (/\/\s*>$/u.test(opening[0]))
89
+ return tags.lastIndex;
90
+ const rootName = opening[1];
91
+ let depth = 1;
92
+ for (let token = tags.exec(text); token; token = tags.exec(text)) {
93
+ if (token[1] !== rootName)
94
+ continue;
95
+ if (token[0].startsWith('</'))
96
+ depth--;
97
+ else if (!/\/\s*>$/u.test(token[0]))
98
+ depth++;
99
+ if (depth === 0)
100
+ return tags.lastIndex;
101
+ }
102
+ return text.length;
103
+ }
@@ -44,12 +44,24 @@ export declare const composerTagSchemas: {
44
44
  }>;
45
45
  readonly mar_goal_start: z.ZodObject<{
46
46
  objective: z.ZodString;
47
+ instruction: z.ZodOptional<z.ZodString>;
47
48
  }, "strict", z.ZodTypeAny, {
48
49
  objective: string;
50
+ instruction?: string | undefined;
49
51
  }, {
50
52
  objective: string;
53
+ instruction?: string | undefined;
54
+ }>;
55
+ readonly mar_goal_continue: z.ZodObject<{
56
+ objective: z.ZodOptional<z.ZodString>;
57
+ instruction: z.ZodOptional<z.ZodString>;
58
+ }, "strict", z.ZodTypeAny, {
59
+ objective?: string | undefined;
60
+ instruction?: string | undefined;
61
+ }, {
62
+ objective?: string | undefined;
63
+ instruction?: string | undefined;
51
64
  }>;
52
- readonly mar_goal_continue: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
53
65
  readonly mar_restart: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
54
66
  readonly mar_attachments: z.ZodObject<{
55
67
  files: z.ZodArray<z.ZodEffects<z.ZodObject<{
@@ -117,16 +129,16 @@ export declare const composerTagSchemas: {
117
129
  source: "NODE_HOME" | "WORKSPACE";
118
130
  }>, "many">;
119
131
  }, "strict", z.ZodTypeAny, {
120
- action: "use";
121
132
  instruction: string;
133
+ action: "use";
122
134
  skills: {
123
135
  path: string;
124
136
  name: string;
125
137
  source: "NODE_HOME" | "WORKSPACE";
126
138
  }[];
127
139
  }, {
128
- action: "use";
129
140
  instruction: string;
141
+ action: "use";
130
142
  skills: {
131
143
  path: string;
132
144
  name: string;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { composerMarkupEnd, escapeMarkup, markupAttributes, parseComposerMarkup } from './composer-markup.js';
2
3
  const path = z.string().min(1).max(4096);
3
4
  const name = z.string().min(1).max(512);
4
5
  const MAX_COMPOSER_TAG_BYTES = 128 * 1024;
@@ -39,8 +40,15 @@ const attachment = z
39
40
  export const composerTagSchemas = {
40
41
  mar_steer: z.object({ message: z.string().max(100_000) }).strict(),
41
42
  mar_channel: channelOriginSchema,
42
- mar_goal_start: z.object({ objective: z.string().max(100_000) }).strict(),
43
- mar_goal_continue: z.object({}).strict(),
43
+ mar_goal_start: z
44
+ .object({ objective: z.string().max(100_000), instruction: z.string().max(100_000).optional() })
45
+ .strict(),
46
+ mar_goal_continue: z
47
+ .object({
48
+ objective: z.string().max(100_000).optional(),
49
+ instruction: z.string().max(100_000).optional()
50
+ })
51
+ .strict(),
44
52
  mar_restart: z.object({}).strict(),
45
53
  mar_attachments: z.object({ files: z.array(attachment).min(1).max(5) }).strict(),
46
54
  mar_schedule: z.object({ objective: z.string().min(1).max(100_000) }).strict(),
@@ -71,11 +79,7 @@ export const composerTagSchemas = {
71
79
  .strict()
72
80
  };
73
81
  export const COMPOSER_SKILL_INSTRUCTION = 'Use the selected skills for this task; load them through the available skill mechanism.';
74
- const STEER_PREFIX = '\nAdditional information received while you were working. Continue the current task and consider it where relevant.\n<message>\n';
75
- const STEER_SUFFIX = '\n</message>\n';
76
- function encodeSteerText(text) {
77
- return text.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
78
- }
82
+ const STEER_INSTRUCTION = 'Additional information received while you were working. Continue the current task and consider it where relevant.';
79
83
  export function steerComposerMessage(text) {
80
84
  const parts = parseComposerTags(text);
81
85
  const message = parts
@@ -91,25 +95,99 @@ export function serializeComposerTag(kind, payload) {
91
95
  const parsed = composerTagSchemas[kind].safeParse(payload);
92
96
  if (!parsed.success)
93
97
  throw new Error('COMPOSER_TAG_INVALID');
94
- if (kind === 'mar_steer') {
95
- const encoded = STEER_PREFIX +
96
- encodeSteerText(parsed.data.message) +
97
- STEER_SUFFIX;
98
- if (new TextEncoder().encode(encoded).byteLength > MAX_COMPOSER_TAG_BYTES)
99
- throw new Error('COMPOSER_TAG_INVALID');
100
- return `<mar_steer>${encoded}</mar_steer>`;
98
+ const value = parsed.data;
99
+ const children = [];
100
+ const attributes = {};
101
+ for (const [key, item] of Object.entries(value)) {
102
+ if (item === undefined)
103
+ continue;
104
+ if (kind === 'mar_channel' || key === 'action')
105
+ attributes[key] = item;
106
+ else if (Array.isArray(item)) {
107
+ const leaf = key === 'files' ? 'file' : key === 'skills' ? 'skill' : 'reference';
108
+ for (const entry of item)
109
+ children.push(` <${leaf}${markupAttributes(entry)} />`);
110
+ }
111
+ else
112
+ children.push(item === '' ? ` <${key} />` : ` <${key}>${escapeMarkup(String(item))}</${key}>`);
101
113
  }
102
- const encoded = JSON.stringify(parsed.data).replaceAll('<', '\\u003c');
114
+ if (kind === 'mar_steer')
115
+ children.unshift(` <instruction>${STEER_INSTRUCTION}</instruction>`);
116
+ const opening = `<${kind}${markupAttributes(attributes)}`;
117
+ const encoded = children.length
118
+ ? `${opening}>
119
+ ${children.join('\n')}
120
+ </${kind}>`
121
+ : `${opening} />`;
103
122
  if (new TextEncoder().encode(encoded).byteLength > MAX_COMPOSER_TAG_BYTES)
104
123
  throw new Error('COMPOSER_TAG_INVALID');
105
- return `<${kind}>\n${encoded}\n</${kind}>`;
124
+ return encoded;
125
+ }
126
+ function parseComposerPayload(raw) {
127
+ try {
128
+ if (new TextEncoder().encode(raw).byteLength > MAX_COMPOSER_TAG_BYTES)
129
+ return undefined;
130
+ const root = parseComposerMarkup(raw);
131
+ if (!Object.hasOwn(composerTagSchemas, root.name))
132
+ return undefined;
133
+ const kind = root.name;
134
+ const payload = { ...root.attributes };
135
+ const list = kind === 'mar_attachments'
136
+ ? ['file', 'files']
137
+ : kind === 'mar_skills'
138
+ ? ['skill', 'skills']
139
+ : kind === 'mar_references'
140
+ ? ['reference', 'references']
141
+ : undefined;
142
+ const scalar = kind === 'mar_steer'
143
+ ? ['instruction', 'message']
144
+ : kind === 'mar_goal_start' || kind === 'mar_goal_continue'
145
+ ? ['objective', 'instruction']
146
+ : kind === 'mar_schedule'
147
+ ? ['objective']
148
+ : kind === 'mar_skills'
149
+ ? ['instruction']
150
+ : [];
151
+ for (const field of root.fields) {
152
+ if (list && field.name === list[0]) {
153
+ if (field.text !== '')
154
+ return undefined;
155
+ const values = (payload[list[1]] ??= []);
156
+ if (!Array.isArray(values))
157
+ return undefined;
158
+ values.push({ ...field.attributes });
159
+ }
160
+ else {
161
+ if (!scalar.includes(field.name) ||
162
+ Object.keys(field.attributes).length ||
163
+ Object.hasOwn(payload, field.name))
164
+ return undefined;
165
+ payload[field.name] = field.text;
166
+ }
167
+ }
168
+ if (kind !== 'mar_channel' &&
169
+ Object.keys(root.attributes).some((key) => kind !== 'mar_skills' || key !== 'action'))
170
+ return undefined;
171
+ if (kind === 'mar_steer') {
172
+ if (typeof payload.instruction !== 'string' ||
173
+ payload.instruction.length === 0 ||
174
+ payload.instruction.length > 512)
175
+ return undefined;
176
+ delete payload.instruction;
177
+ }
178
+ const result = composerTagSchemas[kind].safeParse(payload);
179
+ return result.success ? { kind, payload: result.data, raw } : undefined;
180
+ }
181
+ catch {
182
+ return undefined;
183
+ }
106
184
  }
107
185
  export function parseComposerTags(text) {
108
186
  const parts = [];
109
- const pattern = /(^ {0,3}(`{3,}|~{3,})([^\n]*)(?:\n|$))|<(mar_steer|mar_goal_start|mar_goal_continue|mar_restart|mar_attachments|mar_schedule|mar_skills|mar_references|mar_channel)>([\s\S]*?)<\/\4>/gmu;
187
+ const pattern = /(^ {0,3}(`{3,}|~{3,})([^\n]*)(?:\n|$))|<mar_/gmu;
110
188
  let fence;
111
189
  let offset = 0;
112
- for (const match of text.matchAll(pattern)) {
190
+ for (let match = pattern.exec(text); match; match = pattern.exec(text)) {
113
191
  if (match[1] !== undefined) {
114
192
  const marker = match[2];
115
193
  if (fence === undefined) {
@@ -122,38 +200,17 @@ export function parseComposerTags(text) {
122
200
  fence = undefined;
123
201
  continue;
124
202
  }
125
- const kind = match[4];
126
- const encoded = match[5];
127
- if (new TextEncoder().encode(encoded).byteLength > MAX_COMPOSER_TAG_BYTES)
203
+ if (fence !== undefined)
128
204
  continue;
129
- let payload;
130
- if (kind === 'mar_steer') {
131
- if (fence !== undefined)
132
- continue;
133
- if (!encoded.startsWith(STEER_PREFIX) || !encoded.endsWith(STEER_SUFFIX))
134
- continue;
135
- const message = encoded.slice(STEER_PREFIX.length, -STEER_SUFFIX.length);
136
- if (/[<>]|&(?!amp;|lt;|gt;)/u.test(message))
137
- continue;
138
- payload = {
139
- message: message.replace(/&(amp|lt|gt);/gu, (_, entity) => entity === 'amp' ? '&' : entity === 'lt' ? '<' : '>')
140
- };
141
- }
142
- else {
143
- try {
144
- payload = JSON.parse(encoded);
145
- }
146
- catch {
147
- continue;
148
- }
149
- }
150
- const result = composerTagSchemas[kind].safeParse(payload);
151
- if (!result.success)
205
+ const end = composerMarkupEnd(text, match.index);
206
+ pattern.lastIndex = end;
207
+ const parsed = parseComposerPayload(text.slice(match.index, end));
208
+ if (!parsed)
152
209
  continue;
153
210
  if (match.index > offset)
154
211
  parts.push({ kind: 'text', text: text.slice(offset, match.index) });
155
- parts.push({ kind, payload: result.data, raw: match[0] });
156
- offset = match.index + match[0].length;
212
+ parts.push(parsed);
213
+ offset = end;
157
214
  }
158
215
  if (offset < text.length)
159
216
  parts.push({ kind: 'text', text: text.slice(offset) });
package/dist/index.d.ts CHANGED
@@ -9687,29 +9687,29 @@ export declare const conversationItemSchema: z.ZodDiscriminatedUnion<"kind", [z.
9687
9687
  index: z.ZodNumber;
9688
9688
  text: z.ZodString;
9689
9689
  }, "strip", z.ZodTypeAny, {
9690
- text: string;
9691
9690
  index: number;
9692
- }, {
9693
9691
  text: string;
9692
+ }, {
9694
9693
  index: number;
9694
+ text: string;
9695
9695
  }>, "many">;
9696
9696
  }, "strip", z.ZodTypeAny, {
9697
9697
  sections: {
9698
- text: string;
9699
9698
  index: number;
9699
+ text: string;
9700
9700
  }[];
9701
9701
  }, {
9702
9702
  sections: {
9703
- text: string;
9704
9703
  index: number;
9704
+ text: string;
9705
9705
  }[];
9706
9706
  }>;
9707
9707
  }, "strip", z.ZodTypeAny, {
9708
9708
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
9709
9709
  payload: {
9710
9710
  sections: {
9711
- text: string;
9712
9711
  index: number;
9712
+ text: string;
9713
9713
  }[];
9714
9714
  };
9715
9715
  kind: "reasoning_summary";
@@ -9739,8 +9739,8 @@ export declare const conversationItemSchema: z.ZodDiscriminatedUnion<"kind", [z.
9739
9739
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
9740
9740
  payload: {
9741
9741
  sections: {
9742
- text: string;
9743
9742
  index: number;
9743
+ text: string;
9744
9744
  }[];
9745
9745
  };
9746
9746
  kind: "reasoning_summary";
@@ -12300,29 +12300,29 @@ export declare const conversationTurnSchema: z.ZodObject<{
12300
12300
  index: z.ZodNumber;
12301
12301
  text: z.ZodString;
12302
12302
  }, "strip", z.ZodTypeAny, {
12303
- text: string;
12304
12303
  index: number;
12305
- }, {
12306
12304
  text: string;
12305
+ }, {
12307
12306
  index: number;
12307
+ text: string;
12308
12308
  }>, "many">;
12309
12309
  }, "strip", z.ZodTypeAny, {
12310
12310
  sections: {
12311
- text: string;
12312
12311
  index: number;
12312
+ text: string;
12313
12313
  }[];
12314
12314
  }, {
12315
12315
  sections: {
12316
- text: string;
12317
12316
  index: number;
12317
+ text: string;
12318
12318
  }[];
12319
12319
  }>;
12320
12320
  }, "strip", z.ZodTypeAny, {
12321
12321
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
12322
12322
  payload: {
12323
12323
  sections: {
12324
- text: string;
12325
12324
  index: number;
12325
+ text: string;
12326
12326
  }[];
12327
12327
  };
12328
12328
  kind: "reasoning_summary";
@@ -12352,8 +12352,8 @@ export declare const conversationTurnSchema: z.ZodObject<{
12352
12352
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
12353
12353
  payload: {
12354
12354
  sections: {
12355
- text: string;
12356
12355
  index: number;
12356
+ text: string;
12357
12357
  }[];
12358
12358
  };
12359
12359
  kind: "reasoning_summary";
@@ -14659,8 +14659,8 @@ export declare const conversationTurnSchema: z.ZodObject<{
14659
14659
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
14660
14660
  payload: {
14661
14661
  sections: {
14662
- text: string;
14663
14662
  index: number;
14663
+ text: string;
14664
14664
  }[];
14665
14665
  };
14666
14666
  kind: "reasoning_summary";
@@ -15212,8 +15212,8 @@ export declare const conversationTurnSchema: z.ZodObject<{
15212
15212
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
15213
15213
  payload: {
15214
15214
  sections: {
15215
- text: string;
15216
15215
  index: number;
15216
+ text: string;
15217
15217
  }[];
15218
15218
  };
15219
15219
  kind: "reasoning_summary";
@@ -17517,29 +17517,29 @@ export declare const hostedConversationSnapshotSchema: z.ZodEffects<z.ZodObject<
17517
17517
  index: z.ZodNumber;
17518
17518
  text: z.ZodString;
17519
17519
  }, "strip", z.ZodTypeAny, {
17520
- text: string;
17521
17520
  index: number;
17522
- }, {
17523
17521
  text: string;
17522
+ }, {
17524
17523
  index: number;
17524
+ text: string;
17525
17525
  }>, "many">;
17526
17526
  }, "strip", z.ZodTypeAny, {
17527
17527
  sections: {
17528
- text: string;
17529
17528
  index: number;
17529
+ text: string;
17530
17530
  }[];
17531
17531
  }, {
17532
17532
  sections: {
17533
- text: string;
17534
17533
  index: number;
17534
+ text: string;
17535
17535
  }[];
17536
17536
  }>;
17537
17537
  }, "strip", z.ZodTypeAny, {
17538
17538
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
17539
17539
  payload: {
17540
17540
  sections: {
17541
- text: string;
17542
17541
  index: number;
17542
+ text: string;
17543
17543
  }[];
17544
17544
  };
17545
17545
  kind: "reasoning_summary";
@@ -17569,8 +17569,8 @@ export declare const hostedConversationSnapshotSchema: z.ZodEffects<z.ZodObject<
17569
17569
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
17570
17570
  payload: {
17571
17571
  sections: {
17572
- text: string;
17573
17572
  index: number;
17573
+ text: string;
17574
17574
  }[];
17575
17575
  };
17576
17576
  kind: "reasoning_summary";
@@ -19876,8 +19876,8 @@ export declare const hostedConversationSnapshotSchema: z.ZodEffects<z.ZodObject<
19876
19876
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
19877
19877
  payload: {
19878
19878
  sections: {
19879
- text: string;
19880
19879
  index: number;
19880
+ text: string;
19881
19881
  }[];
19882
19882
  };
19883
19883
  kind: "reasoning_summary";
@@ -20429,8 +20429,8 @@ export declare const hostedConversationSnapshotSchema: z.ZodEffects<z.ZodObject<
20429
20429
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
20430
20430
  payload: {
20431
20431
  sections: {
20432
- text: string;
20433
20432
  index: number;
20433
+ text: string;
20434
20434
  }[];
20435
20435
  };
20436
20436
  kind: "reasoning_summary";
@@ -21211,8 +21211,8 @@ export declare const hostedConversationSnapshotSchema: z.ZodEffects<z.ZodObject<
21211
21211
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
21212
21212
  payload: {
21213
21213
  sections: {
21214
- text: string;
21215
21214
  index: number;
21215
+ text: string;
21216
21216
  }[];
21217
21217
  };
21218
21218
  kind: "reasoning_summary";
@@ -21829,8 +21829,8 @@ export declare const hostedConversationSnapshotSchema: z.ZodEffects<z.ZodObject<
21829
21829
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
21830
21830
  payload: {
21831
21831
  sections: {
21832
- text: string;
21833
21832
  index: number;
21833
+ text: string;
21834
21834
  }[];
21835
21835
  };
21836
21836
  kind: "reasoning_summary";
@@ -22447,8 +22447,8 @@ export declare const hostedConversationSnapshotSchema: z.ZodEffects<z.ZodObject<
22447
22447
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
22448
22448
  payload: {
22449
22449
  sections: {
22450
- text: string;
22451
22450
  index: number;
22451
+ text: string;
22452
22452
  }[];
22453
22453
  };
22454
22454
  kind: "reasoning_summary";
@@ -23065,8 +23065,8 @@ export declare const hostedConversationSnapshotSchema: z.ZodEffects<z.ZodObject<
23065
23065
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
23066
23066
  payload: {
23067
23067
  sections: {
23068
- text: string;
23069
23068
  index: number;
23069
+ text: string;
23070
23070
  }[];
23071
23071
  };
23072
23072
  kind: "reasoning_summary";
@@ -24176,29 +24176,29 @@ export declare const hostedConversationHistoryPageSchema: z.ZodObject<{
24176
24176
  index: z.ZodNumber;
24177
24177
  text: z.ZodString;
24178
24178
  }, "strip", z.ZodTypeAny, {
24179
- text: string;
24180
24179
  index: number;
24181
- }, {
24182
24180
  text: string;
24181
+ }, {
24183
24182
  index: number;
24183
+ text: string;
24184
24184
  }>, "many">;
24185
24185
  }, "strip", z.ZodTypeAny, {
24186
24186
  sections: {
24187
- text: string;
24188
24187
  index: number;
24188
+ text: string;
24189
24189
  }[];
24190
24190
  }, {
24191
24191
  sections: {
24192
- text: string;
24193
24192
  index: number;
24193
+ text: string;
24194
24194
  }[];
24195
24195
  }>;
24196
24196
  }, "strip", z.ZodTypeAny, {
24197
24197
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
24198
24198
  payload: {
24199
24199
  sections: {
24200
- text: string;
24201
24200
  index: number;
24201
+ text: string;
24202
24202
  }[];
24203
24203
  };
24204
24204
  kind: "reasoning_summary";
@@ -24228,8 +24228,8 @@ export declare const hostedConversationHistoryPageSchema: z.ZodObject<{
24228
24228
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
24229
24229
  payload: {
24230
24230
  sections: {
24231
- text: string;
24232
24231
  index: number;
24232
+ text: string;
24233
24233
  }[];
24234
24234
  };
24235
24235
  kind: "reasoning_summary";
@@ -26535,8 +26535,8 @@ export declare const hostedConversationHistoryPageSchema: z.ZodObject<{
26535
26535
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
26536
26536
  payload: {
26537
26537
  sections: {
26538
- text: string;
26539
26538
  index: number;
26539
+ text: string;
26540
26540
  }[];
26541
26541
  };
26542
26542
  kind: "reasoning_summary";
@@ -27088,8 +27088,8 @@ export declare const hostedConversationHistoryPageSchema: z.ZodObject<{
27088
27088
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
27089
27089
  payload: {
27090
27090
  sections: {
27091
- text: string;
27092
27091
  index: number;
27092
+ text: string;
27093
27093
  }[];
27094
27094
  };
27095
27095
  kind: "reasoning_summary";
@@ -27645,8 +27645,8 @@ export declare const hostedConversationHistoryPageSchema: z.ZodObject<{
27645
27645
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
27646
27646
  payload: {
27647
27647
  sections: {
27648
- text: string;
27649
27648
  index: number;
27649
+ text: string;
27650
27650
  }[];
27651
27651
  };
27652
27652
  kind: "reasoning_summary";
@@ -28201,8 +28201,8 @@ export declare const hostedConversationHistoryPageSchema: z.ZodObject<{
28201
28201
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
28202
28202
  payload: {
28203
28203
  sections: {
28204
- text: string;
28205
28204
  index: number;
28205
+ text: string;
28206
28206
  }[];
28207
28207
  };
28208
28208
  kind: "reasoning_summary";
@@ -29752,29 +29752,29 @@ export declare const conversationSegmentSchema: z.ZodObject<{
29752
29752
  index: z.ZodNumber;
29753
29753
  text: z.ZodString;
29754
29754
  }, "strip", z.ZodTypeAny, {
29755
- text: string;
29756
29755
  index: number;
29757
- }, {
29758
29756
  text: string;
29757
+ }, {
29759
29758
  index: number;
29759
+ text: string;
29760
29760
  }>, "many">;
29761
29761
  }, "strip", z.ZodTypeAny, {
29762
29762
  sections: {
29763
- text: string;
29764
29763
  index: number;
29764
+ text: string;
29765
29765
  }[];
29766
29766
  }, {
29767
29767
  sections: {
29768
- text: string;
29769
29768
  index: number;
29769
+ text: string;
29770
29770
  }[];
29771
29771
  }>;
29772
29772
  }, "strip", z.ZodTypeAny, {
29773
29773
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
29774
29774
  payload: {
29775
29775
  sections: {
29776
- text: string;
29777
29776
  index: number;
29777
+ text: string;
29778
29778
  }[];
29779
29779
  };
29780
29780
  kind: "reasoning_summary";
@@ -29804,8 +29804,8 @@ export declare const conversationSegmentSchema: z.ZodObject<{
29804
29804
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
29805
29805
  payload: {
29806
29806
  sections: {
29807
- text: string;
29808
29807
  index: number;
29808
+ text: string;
29809
29809
  }[];
29810
29810
  };
29811
29811
  kind: "reasoning_summary";
@@ -31897,6 +31897,7 @@ export declare const conversationSegmentSchema: z.ZodObject<{
31897
31897
  completedAt: z.ZodNullable<z.ZodNumber>;
31898
31898
  }, "strip", z.ZodTypeAny, {
31899
31899
  status: "SUCCEEDED" | "FAILED" | "CANCELLED" | "RUNNING" | "INTERRUPTED" | "PREPARING" | "WAITING_INPUT" | "WAITING_APPROVAL" | "LOST";
31900
+ index: number;
31900
31901
  id: string;
31901
31902
  runId: string | null;
31902
31903
  sessionId: string;
@@ -32109,8 +32110,8 @@ export declare const conversationSegmentSchema: z.ZodObject<{
32109
32110
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
32110
32111
  payload: {
32111
32112
  sections: {
32112
- text: string;
32113
32113
  index: number;
32114
+ text: string;
32114
32115
  }[];
32115
32116
  };
32116
32117
  kind: "reasoning_summary";
@@ -32441,13 +32442,13 @@ export declare const conversationSegmentSchema: z.ZodObject<{
32441
32442
  } | undefined;
32442
32443
  })[];
32443
32444
  turnId: string;
32444
- index: number;
32445
32445
  rewind?: {
32446
32446
  before: string | null;
32447
32447
  after: string;
32448
32448
  } | undefined;
32449
32449
  }, {
32450
32450
  status: "SUCCEEDED" | "FAILED" | "CANCELLED" | "RUNNING" | "INTERRUPTED" | "PREPARING" | "WAITING_INPUT" | "WAITING_APPROVAL" | "LOST";
32451
+ index: number;
32451
32452
  id: string;
32452
32453
  runId: string | null;
32453
32454
  sessionId: string;
@@ -32660,8 +32661,8 @@ export declare const conversationSegmentSchema: z.ZodObject<{
32660
32661
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
32661
32662
  payload: {
32662
32663
  sections: {
32663
- text: string;
32664
32664
  index: number;
32665
+ text: string;
32665
32666
  }[];
32666
32667
  };
32667
32668
  kind: "reasoning_summary";
@@ -32992,7 +32993,6 @@ export declare const conversationSegmentSchema: z.ZodObject<{
32992
32993
  } | undefined;
32993
32994
  })[];
32994
32995
  turnId: string;
32995
- index: number;
32996
32996
  rewind?: {
32997
32997
  before: string | null;
32998
32998
  after: string;
@@ -33470,29 +33470,29 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
33470
33470
  index: z.ZodNumber;
33471
33471
  text: z.ZodString;
33472
33472
  }, "strip", z.ZodTypeAny, {
33473
- text: string;
33474
33473
  index: number;
33475
- }, {
33476
33474
  text: string;
33475
+ }, {
33477
33476
  index: number;
33477
+ text: string;
33478
33478
  }>, "many">;
33479
33479
  }, "strip", z.ZodTypeAny, {
33480
33480
  sections: {
33481
- text: string;
33482
33481
  index: number;
33482
+ text: string;
33483
33483
  }[];
33484
33484
  }, {
33485
33485
  sections: {
33486
- text: string;
33487
33486
  index: number;
33487
+ text: string;
33488
33488
  }[];
33489
33489
  }>;
33490
33490
  }, "strip", z.ZodTypeAny, {
33491
33491
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
33492
33492
  payload: {
33493
33493
  sections: {
33494
- text: string;
33495
33494
  index: number;
33495
+ text: string;
33496
33496
  }[];
33497
33497
  };
33498
33498
  kind: "reasoning_summary";
@@ -33522,8 +33522,8 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
33522
33522
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
33523
33523
  payload: {
33524
33524
  sections: {
33525
- text: string;
33526
33525
  index: number;
33526
+ text: string;
33527
33527
  }[];
33528
33528
  };
33529
33529
  kind: "reasoning_summary";
@@ -35615,6 +35615,7 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
35615
35615
  completedAt: z.ZodNullable<z.ZodNumber>;
35616
35616
  }, "strip", z.ZodTypeAny, {
35617
35617
  status: "SUCCEEDED" | "FAILED" | "CANCELLED" | "RUNNING" | "INTERRUPTED" | "PREPARING" | "WAITING_INPUT" | "WAITING_APPROVAL" | "LOST";
35618
+ index: number;
35618
35619
  id: string;
35619
35620
  runId: string | null;
35620
35621
  sessionId: string;
@@ -35827,8 +35828,8 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
35827
35828
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
35828
35829
  payload: {
35829
35830
  sections: {
35830
- text: string;
35831
35831
  index: number;
35832
+ text: string;
35832
35833
  }[];
35833
35834
  };
35834
35835
  kind: "reasoning_summary";
@@ -36159,13 +36160,13 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
36159
36160
  } | undefined;
36160
36161
  })[];
36161
36162
  turnId: string;
36162
- index: number;
36163
36163
  rewind?: {
36164
36164
  before: string | null;
36165
36165
  after: string;
36166
36166
  } | undefined;
36167
36167
  }, {
36168
36168
  status: "SUCCEEDED" | "FAILED" | "CANCELLED" | "RUNNING" | "INTERRUPTED" | "PREPARING" | "WAITING_INPUT" | "WAITING_APPROVAL" | "LOST";
36169
+ index: number;
36169
36170
  id: string;
36170
36171
  runId: string | null;
36171
36172
  sessionId: string;
@@ -36378,8 +36379,8 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
36378
36379
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
36379
36380
  payload: {
36380
36381
  sections: {
36381
- text: string;
36382
36382
  index: number;
36383
+ text: string;
36383
36384
  }[];
36384
36385
  };
36385
36386
  kind: "reasoning_summary";
@@ -36710,7 +36711,6 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
36710
36711
  } | undefined;
36711
36712
  })[];
36712
36713
  turnId: string;
36713
- index: number;
36714
36714
  rewind?: {
36715
36715
  before: string | null;
36716
36716
  after: string;
@@ -36729,6 +36729,7 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
36729
36729
  unit: "SEGMENT";
36730
36730
  segments: {
36731
36731
  status: "SUCCEEDED" | "FAILED" | "CANCELLED" | "RUNNING" | "INTERRUPTED" | "PREPARING" | "WAITING_INPUT" | "WAITING_APPROVAL" | "LOST";
36732
+ index: number;
36732
36733
  id: string;
36733
36734
  runId: string | null;
36734
36735
  sessionId: string;
@@ -36941,8 +36942,8 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
36941
36942
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
36942
36943
  payload: {
36943
36944
  sections: {
36944
- text: string;
36945
36945
  index: number;
36946
+ text: string;
36946
36947
  }[];
36947
36948
  };
36948
36949
  kind: "reasoning_summary";
@@ -37273,7 +37274,6 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
37273
37274
  } | undefined;
37274
37275
  })[];
37275
37276
  turnId: string;
37276
- index: number;
37277
37277
  rewind?: {
37278
37278
  before: string | null;
37279
37279
  after: string;
@@ -37289,6 +37289,7 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
37289
37289
  unit: "SEGMENT";
37290
37290
  segments: {
37291
37291
  status: "SUCCEEDED" | "FAILED" | "CANCELLED" | "RUNNING" | "INTERRUPTED" | "PREPARING" | "WAITING_INPUT" | "WAITING_APPROVAL" | "LOST";
37292
+ index: number;
37292
37293
  id: string;
37293
37294
  runId: string | null;
37294
37295
  sessionId: string;
@@ -37501,8 +37502,8 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
37501
37502
  status: "PENDING" | "FAILED" | "CANCELLED" | "INTERRUPTED" | "IN_PROGRESS" | "COMPLETED" | "DECLINED";
37502
37503
  payload: {
37503
37504
  sections: {
37504
- text: string;
37505
37505
  index: number;
37506
+ text: string;
37506
37507
  }[];
37507
37508
  };
37508
37509
  kind: "reasoning_summary";
@@ -37833,7 +37834,6 @@ export declare const conversationSegmentPageSchema: z.ZodObject<{
37833
37834
  } | undefined;
37834
37835
  })[];
37835
37836
  turnId: string;
37836
- index: number;
37837
37837
  rewind?: {
37838
37838
  before: string | null;
37839
37839
  after: string;
@@ -8,7 +8,7 @@ export declare const mailNotificationRequestSchema: z.ZodObject<{
8
8
  callId: z.ZodString;
9
9
  templateId: z.ZodString;
10
10
  title: z.ZodOptional<z.ZodString>;
11
- recipientEmail: z.ZodString;
11
+ recipientEmail: z.ZodOptional<z.ZodString>;
12
12
  message: z.ZodString;
13
13
  }, "strict", z.ZodTypeAny, {
14
14
  message: string;
@@ -19,8 +19,8 @@ export declare const mailNotificationRequestSchema: z.ZodObject<{
19
19
  userId: number;
20
20
  executionId: string;
21
21
  callId: string;
22
- recipientEmail: string;
23
22
  title?: string | undefined;
23
+ recipientEmail?: string | undefined;
24
24
  }, {
25
25
  message: string;
26
26
  source: "MANUAL" | "SCHEDULED";
@@ -30,8 +30,8 @@ export declare const mailNotificationRequestSchema: z.ZodObject<{
30
30
  userId: number;
31
31
  executionId: string;
32
32
  callId: string;
33
- recipientEmail: string;
34
33
  title?: string | undefined;
34
+ recipientEmail?: string | undefined;
35
35
  }>;
36
36
  export type MailNotificationRequest = z.infer<typeof mailNotificationRequestSchema>;
37
37
  export declare const mailNotificationResponseSchema: z.ZodUnion<[z.ZodObject<{
@@ -21,7 +21,7 @@ export const mailNotificationRequestSchema = z
21
21
  .max(160)
22
22
  .regex(/^[^\r\n]*$/u)
23
23
  .optional(),
24
- recipientEmail: z.string().min(3).max(320),
24
+ recipientEmail: z.string().min(3).max(320).optional(),
25
25
  message: z.string().min(1).max(4000)
26
26
  })
27
27
  .strict();
@@ -20,9 +20,8 @@ const notificationInput = z
20
20
  function validateChannels(input, context) {
21
21
  if (new Set(input.channels).size !== input.channels.length)
22
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)
23
+ if (!input.channels.includes('email') &&
24
+ (input.recipientEmail !== undefined || input.templateId !== undefined))
26
25
  context.addIssue({
27
26
  code: 'custom',
28
27
  message: 'Email parameters must match the requested channels.'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/protocol",
3
- "version": "0.10.40",
3
+ "version": "0.10.42",
4
4
  "description": "Shared runtime protocol schemas for MyAgentRoam.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",