@meistrari/chat-nuxt 4.11.0-rc.2 → 4.11.0-rc.4

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meistrari/chat-nuxt",
3
3
  "configKey": "chatNuxt",
4
- "version": "4.11.0-rc.2",
4
+ "version": "4.11.0-rc.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -72,8 +72,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
72
72
  copyLink: () => any;
73
73
  debug: () => any;
74
74
  selectConversation: (id: string) => any;
75
- settings: () => any;
76
75
  send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
76
+ settings: () => any;
77
77
  selectExecutionProfile: (profile: ChatExecutionProfile) => any;
78
78
  tabChange: (tab: TopbarTab) => any;
79
79
  newConversation: (groupId?: string | null | undefined) => any;
@@ -94,8 +94,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
94
94
  onCopyLink?: (() => any) | undefined;
95
95
  onDebug?: (() => any) | undefined;
96
96
  onSelectConversation?: ((id: string) => any) | undefined;
97
- onSettings?: (() => any) | undefined;
98
97
  onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
98
+ onSettings?: (() => any) | undefined;
99
99
  onSelectExecutionProfile?: ((profile: ChatExecutionProfile) => any) | undefined;
100
100
  "onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
101
101
  "onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
@@ -72,8 +72,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
72
72
  copyLink: () => any;
73
73
  debug: () => any;
74
74
  selectConversation: (id: string) => any;
75
- settings: () => any;
76
75
  send: (content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any;
76
+ settings: () => any;
77
77
  selectExecutionProfile: (profile: ChatExecutionProfile) => any;
78
78
  tabChange: (tab: TopbarTab) => any;
79
79
  newConversation: (groupId?: string | null | undefined) => any;
@@ -94,8 +94,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
94
94
  onCopyLink?: (() => any) | undefined;
95
95
  onDebug?: (() => any) | undefined;
96
96
  onSelectConversation?: ((id: string) => any) | undefined;
97
- onSettings?: (() => any) | undefined;
98
97
  onSend?: ((content: string, files: FileUploadInput[], agentInputs?: TelaAgentExecutionInput[] | undefined) => any) | undefined;
98
+ onSettings?: (() => any) | undefined;
99
99
  onSelectExecutionProfile?: ((profile: ChatExecutionProfile) => any) | undefined;
100
100
  "onUpdate:selectedModel"?: ((value: string | null) => any) | undefined;
101
101
  "onUpdate:selectedReasoningEffort"?: ((value: any) => any) | undefined;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { type V5SessionEvent } from '../integrations/agent-events';
2
3
  /**
3
4
  * Chat API v3 (`/v3/chat`): the conversational surface over agent-api v5 events-v1.
4
5
  * The chat-api owns the thread; agent-api owns the session and its history.
@@ -123,11 +124,65 @@ export declare const CHAT_V3_MESSAGE_PAGE: {
123
124
  readonly default: 30;
124
125
  readonly max: 100;
125
126
  };
126
- /** A message's text; above the inline limit agent-api keeps it in Vault and the event points at it. */
127
+ /** How many files one message carries; with the message they stay within agent-api's batch. */
128
+ export declare const CHAT_V3_FILES_PER_MESSAGE = 10;
129
+ /** The largest file a message carries, as the largest artifact agent-api publishes. */
130
+ export declare const CHAT_V3_FILE_BYTES: number;
131
+ export declare const CHAT_V3_FILE_NAME_CHARS = 255;
132
+ /** `POST /files`: the file about to be uploaded, before its bytes. */
133
+ export declare const chatV3CreateFileSchema: z.ZodObject<{
134
+ name: z.ZodString;
135
+ size: z.ZodNumber;
136
+ contentType: z.ZodString;
137
+ }, z.core.$strict>;
138
+ export type ChatV3CreateFile = z.infer<typeof chatV3CreateFileSchema>;
139
+ /** A file in Vault, ready to go with a message: only its reference travels to agent-api. */
140
+ export declare const chatV3FileSchema: z.ZodObject<{
141
+ vaultReference: z.ZodString;
142
+ name: z.ZodString;
143
+ size: z.ZodNumber;
144
+ contentType: z.ZodString;
145
+ }, z.core.$strip>;
146
+ export type ChatV3File = z.infer<typeof chatV3FileSchema>;
147
+ /**
148
+ * A file created in Vault and waiting for its bytes: the browser sends them straight to
149
+ * `uploadUrl` with a `PUT` and the same `Content-Type`, before it expires. They never pass
150
+ * through chat-api.
151
+ */
152
+ export declare const chatV3FileUploadSchema: z.ZodObject<{
153
+ vaultReference: z.ZodString;
154
+ name: z.ZodString;
155
+ size: z.ZodNumber;
156
+ contentType: z.ZodString;
157
+ uploadUrl: z.ZodString;
158
+ expiresAt: z.ZodString;
159
+ }, z.core.$strip>;
160
+ export type ChatV3FileUpload = z.infer<typeof chatV3FileUploadSchema>;
161
+ /**
162
+ * A message's text, and the files sent with it. Above the inline limit agent-api keeps the text in
163
+ * Vault and the event points at it; each file goes as an `input` the agent finds in `attachments/`.
164
+ */
127
165
  export declare const chatV3SendMessageSchema: z.ZodObject<{
128
166
  text: z.ZodString;
167
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
168
+ vaultReference: z.ZodString;
169
+ }, z.core.$strict>>>;
129
170
  }, z.core.$strict>;
130
171
  export type ChatV3SendMessage = z.infer<typeof chatV3SendMessageSchema>;
172
+ /** Text sent into a running turn; files go only with a queued message. */
173
+ export declare const chatV3SteerMessageSchema: z.ZodObject<{
174
+ text: z.ZodString;
175
+ }, z.core.$strict>;
176
+ export type ChatV3SteerMessage = z.infer<typeof chatV3SteerMessageSchema>;
177
+ /**
178
+ * The answers to the agent's question, by question id: free text, or the `value` of the option
179
+ * chosen. agent-api checks them against the question, and their size, and opens the next turn
180
+ * with them.
181
+ */
182
+ export declare const chatV3AnswerSchema: z.ZodObject<{
183
+ answers: z.ZodRecord<z.ZodString, z.ZodString>;
184
+ }, z.core.$strict>;
185
+ export type ChatV3Answer = z.infer<typeof chatV3AnswerSchema>;
131
186
  /** Cancels the running turn; the turnId comes from the message that started it. */
132
187
  export declare const chatV3CancelTurnSchema: z.ZodObject<{
133
188
  turnId: z.ZodString;
@@ -149,6 +204,42 @@ export declare const chatV3MessageStatusSchema: z.ZodEnum<{
149
204
  uncertain: "uncertain";
150
205
  }>;
151
206
  export type ChatV3MessageStatus = z.infer<typeof chatV3MessageStatusSchema>;
207
+ /**
208
+ * A question the agent asked (`ask_user`), answered by its `toolCallId`. `answeredBy` is the
209
+ * message that answered it; nothing else tracks whether the agent still waits. One too long for
210
+ * agent-api to keep inline has no questions and cannot be answered (`answerable`).
211
+ */
212
+ export declare const chatV3QuestionSchema: z.ZodObject<{
213
+ eventId: z.ZodString;
214
+ toolCallId: z.ZodString;
215
+ requestId: z.ZodString;
216
+ prompt: z.ZodNullable<z.ZodString>;
217
+ questions: z.ZodArray<z.ZodObject<{
218
+ id: z.ZodString;
219
+ label: z.ZodString;
220
+ description: z.ZodOptional<z.ZodString>;
221
+ required: z.ZodOptional<z.ZodBoolean>;
222
+ type: z.ZodEnum<{
223
+ text: "text";
224
+ single_select: "single_select";
225
+ }>;
226
+ placeholder: z.ZodOptional<z.ZodString>;
227
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
228
+ value: z.ZodString;
229
+ label: z.ZodString;
230
+ description: z.ZodOptional<z.ZodString>;
231
+ }, z.core.$loose>>>;
232
+ }, z.core.$loose>>;
233
+ answerable: z.ZodBoolean;
234
+ answeredBy: z.ZodNullable<z.ZodString>;
235
+ }, z.core.$strip>;
236
+ export type ChatV3Question = z.infer<typeof chatV3QuestionSchema>;
237
+ /**
238
+ * The question of a `user_input.requested` event as the agent asked it, from the event's text
239
+ * (`{ prompt, questions }`). One kept without its text, or whose text does not read as a question,
240
+ * is shown but cannot be answered: agent-api could not check its answers.
241
+ */
242
+ export declare function questionOfEvent(event: V5SessionEvent): ChatV3Question | null;
152
243
  /**
153
244
  * One message of the user and the agent's reply to it, rebuilt from the session's events on
154
245
  * every read. `text` is `null` while it is only in Vault (`textInVault`); `reply` is the
@@ -174,6 +265,31 @@ export declare const chatV3MessageSchema: z.ZodObject<{
174
265
  textInVault: z.ZodBoolean;
175
266
  reply: z.ZodString;
176
267
  createdAt: z.ZodString;
268
+ fileCount: z.ZodNumber;
269
+ question: z.ZodNullable<z.ZodObject<{
270
+ eventId: z.ZodString;
271
+ toolCallId: z.ZodString;
272
+ requestId: z.ZodString;
273
+ prompt: z.ZodNullable<z.ZodString>;
274
+ questions: z.ZodArray<z.ZodObject<{
275
+ id: z.ZodString;
276
+ label: z.ZodString;
277
+ description: z.ZodOptional<z.ZodString>;
278
+ required: z.ZodOptional<z.ZodBoolean>;
279
+ type: z.ZodEnum<{
280
+ text: "text";
281
+ single_select: "single_select";
282
+ }>;
283
+ placeholder: z.ZodOptional<z.ZodString>;
284
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
285
+ value: z.ZodString;
286
+ label: z.ZodString;
287
+ description: z.ZodOptional<z.ZodString>;
288
+ }, z.core.$loose>>>;
289
+ }, z.core.$loose>>;
290
+ answerable: z.ZodBoolean;
291
+ answeredBy: z.ZodNullable<z.ZodString>;
292
+ }, z.core.$strip>>;
177
293
  }, z.core.$strip>;
178
294
  export type ChatV3Message = z.infer<typeof chatV3MessageSchema>;
179
295
  export declare const chatV3MessageListQuerySchema: z.ZodObject<{
@@ -206,6 +322,31 @@ export declare const chatV3MessageListSchema: z.ZodObject<{
206
322
  textInVault: z.ZodBoolean;
207
323
  reply: z.ZodString;
208
324
  createdAt: z.ZodString;
325
+ fileCount: z.ZodNumber;
326
+ question: z.ZodNullable<z.ZodObject<{
327
+ eventId: z.ZodString;
328
+ toolCallId: z.ZodString;
329
+ requestId: z.ZodString;
330
+ prompt: z.ZodNullable<z.ZodString>;
331
+ questions: z.ZodArray<z.ZodObject<{
332
+ id: z.ZodString;
333
+ label: z.ZodString;
334
+ description: z.ZodOptional<z.ZodString>;
335
+ required: z.ZodOptional<z.ZodBoolean>;
336
+ type: z.ZodEnum<{
337
+ text: "text";
338
+ single_select: "single_select";
339
+ }>;
340
+ placeholder: z.ZodOptional<z.ZodString>;
341
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
342
+ value: z.ZodString;
343
+ label: z.ZodString;
344
+ description: z.ZodOptional<z.ZodString>;
345
+ }, z.core.$loose>>>;
346
+ }, z.core.$loose>>;
347
+ answerable: z.ZodBoolean;
348
+ answeredBy: z.ZodNullable<z.ZodString>;
349
+ }, z.core.$strip>>;
209
350
  }, z.core.$strip>>;
210
351
  nextCursor: z.ZodNullable<z.ZodString>;
211
352
  eventCursor: z.ZodNullable<z.ZodString>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { v5ArtifactPageSchema, v5EventIdSchema, v5HarnessSchema, v5Limits, v5SessionEventSchema, v5TurnIdSchema } from '../integrations/agent-events';
2
+ import { parseV5EventHint, v5ArtifactPageSchema, v5EventIdSchema, v5HarnessSchema, v5Limits, v5SessionEventSchema, v5TurnIdSchema, v5UserInputRequestSchema, v5VaultReferenceSchema } from '../integrations/agent-events';
3
3
  /**
4
4
  * Chat API v3 (`/v3/chat`): the conversational surface over agent-api v5 events-v1.
5
5
  * The chat-api owns the thread; agent-api owns the session and its history.
@@ -79,9 +79,53 @@ export const chatV3ThreadListSchema = z.object({
79
79
  nextCursor: z.string().uuid().nullable(),
80
80
  });
81
81
  export const CHAT_V3_MESSAGE_PAGE = { default: 30, max: 100 };
82
- /** A message's text; above the inline limit agent-api keeps it in Vault and the event points at it. */
82
+ /** How many files one message carries; with the message they stay within agent-api's batch. */
83
+ export const CHAT_V3_FILES_PER_MESSAGE = 10;
84
+ /** The largest file a message carries, as the largest artifact agent-api publishes. */
85
+ export const CHAT_V3_FILE_BYTES = 100 * 1024 * 1024;
86
+ export const CHAT_V3_FILE_NAME_CHARS = 255;
87
+ /** `POST /files`: the file about to be uploaded, before its bytes. */
88
+ export const chatV3CreateFileSchema = z.object({
89
+ name: z.string().trim().min(1).max(CHAT_V3_FILE_NAME_CHARS),
90
+ size: z.number().int().min(1).max(CHAT_V3_FILE_BYTES),
91
+ contentType: z.string().trim().min(1).max(255),
92
+ }).strict();
93
+ /** A file in Vault, ready to go with a message: only its reference travels to agent-api. */
94
+ export const chatV3FileSchema = z.object({
95
+ vaultReference: v5VaultReferenceSchema,
96
+ name: z.string(),
97
+ size: z.number().int().nonnegative(),
98
+ contentType: z.string(),
99
+ });
100
+ /**
101
+ * A file created in Vault and waiting for its bytes: the browser sends them straight to
102
+ * `uploadUrl` with a `PUT` and the same `Content-Type`, before it expires. They never pass
103
+ * through chat-api.
104
+ */
105
+ export const chatV3FileUploadSchema = chatV3FileSchema.extend({
106
+ uploadUrl: z.string().url(),
107
+ expiresAt: z.string(),
108
+ });
109
+ /**
110
+ * A message's text, and the files sent with it. Above the inline limit agent-api keeps the text in
111
+ * Vault and the event points at it; each file goes as an `input` the agent finds in `attachments/`.
112
+ */
83
113
  export const chatV3SendMessageSchema = z.object({
84
114
  text: z.string().min(1).max(v5Limits.messageTextChars),
115
+ files: z.array(z.object({ vaultReference: v5VaultReferenceSchema }).strict()).max(CHAT_V3_FILES_PER_MESSAGE).optional(),
116
+ }).strict();
117
+ /** Text sent into a running turn; files go only with a queued message. */
118
+ export const chatV3SteerMessageSchema = z.object({
119
+ text: z.string().min(1).max(v5Limits.messageTextChars),
120
+ }).strict();
121
+ /**
122
+ * The answers to the agent's question, by question id: free text, or the `value` of the option
123
+ * chosen. agent-api checks them against the question, and their size, and opens the next turn
124
+ * with them.
125
+ */
126
+ export const chatV3AnswerSchema = z.object({
127
+ answers: z.record(z.string().min(1), z.string())
128
+ .refine(answers => Object.keys(answers).length > 0, { message: 'Answer at least one question.' }),
85
129
  }).strict();
86
130
  /** Cancels the running turn; the turnId comes from the message that started it. */
87
131
  export const chatV3CancelTurnSchema = z.object({ turnId: v5TurnIdSchema }).strict();
@@ -92,6 +136,50 @@ export const chatV3MessageReceiptSchema = z.object({
92
136
  status: z.string(),
93
137
  });
94
138
  export const chatV3MessageStatusSchema = z.enum(['queued', 'running', 'completed', 'failed', 'cancelled', 'uncertain']);
139
+ /**
140
+ * A question the agent asked (`ask_user`), answered by its `toolCallId`. `answeredBy` is the
141
+ * message that answered it; nothing else tracks whether the agent still waits. One too long for
142
+ * agent-api to keep inline has no questions and cannot be answered (`answerable`).
143
+ */
144
+ export const chatV3QuestionSchema = z.object({
145
+ eventId: v5EventIdSchema,
146
+ toolCallId: z.string(),
147
+ /** What `user_input.resolved` names it by. */
148
+ requestId: z.string(),
149
+ prompt: z.string().nullable(),
150
+ questions: v5UserInputRequestSchema.shape.questions,
151
+ answerable: z.boolean(),
152
+ answeredBy: v5EventIdSchema.nullable(),
153
+ });
154
+ /**
155
+ * The question of a `user_input.requested` event as the agent asked it, from the event's text
156
+ * (`{ prompt, questions }`). One kept without its text, or whose text does not read as a question,
157
+ * is shown but cannot be answered: agent-api could not check its answers.
158
+ */
159
+ export function questionOfEvent(event) {
160
+ const hint = event.type === 'user_input.requested' ? parseV5EventHint('user_input.requested', event.hint) : null;
161
+ if (!hint || !event.toolCallId)
162
+ return null;
163
+ const asked = hint.contentOmitted !== true && event.text !== null ? parseQuestion(event.text) : null;
164
+ return {
165
+ eventId: event.eventId,
166
+ toolCallId: event.toolCallId,
167
+ requestId: hint.requestId,
168
+ prompt: asked?.prompt ?? null,
169
+ questions: asked?.questions ?? [],
170
+ answerable: asked !== null && asked.questions.length > 0,
171
+ answeredBy: null,
172
+ };
173
+ }
174
+ function parseQuestion(text) {
175
+ try {
176
+ const parsed = v5UserInputRequestSchema.safeParse(JSON.parse(text));
177
+ return parsed.success ? parsed.data : null;
178
+ }
179
+ catch {
180
+ return null;
181
+ }
182
+ }
95
183
  /**
96
184
  * One message of the user and the agent's reply to it, rebuilt from the session's events on
97
185
  * every read. `text` is `null` while it is only in Vault (`textInVault`); `reply` is the
@@ -106,6 +194,10 @@ export const chatV3MessageSchema = z.object({
106
194
  textInVault: z.boolean(),
107
195
  reply: z.string(),
108
196
  createdAt: z.string(),
197
+ /** Files sent with the message. agent-api keeps no name for them, so only how many. */
198
+ fileCount: z.number().int().nonnegative(),
199
+ /** What the agent asked while answering, if it did: its turn ended waiting for the answer. */
200
+ question: chatV3QuestionSchema.nullable(),
109
201
  });
110
202
  export const chatV3MessageListQuerySchema = z.object({
111
203
  /** Exclusive cursor: the `nextCursor` of the previous page, which reads older messages. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/chat-nuxt",
3
- "version": "4.11.0-rc.2",
3
+ "version": "4.11.0-rc.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {