@meistrari/chat-nuxt 1.4.0 → 1.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.
Files changed (85) hide show
  1. package/README.md +51 -16
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +12 -8
  4. package/dist/runtime/components/MeistrariChatEmbed.d.vue.ts +2 -18
  5. package/dist/runtime/components/MeistrariChatEmbed.vue +22 -4
  6. package/dist/runtime/components/MeistrariChatEmbed.vue.d.ts +2 -18
  7. package/dist/runtime/components/chat/message-input.d.vue.ts +30 -4
  8. package/dist/runtime/components/chat/message-input.vue +268 -24
  9. package/dist/runtime/components/chat/message-input.vue.d.ts +30 -4
  10. package/dist/runtime/composables/useChat.d.ts +3 -5
  11. package/dist/runtime/composables/useChat.js +18 -4
  12. package/dist/runtime/composables/useChatApi.js +4 -0
  13. package/dist/runtime/composables/useConversations.js +8 -2
  14. package/dist/runtime/composables/useEmbedConfig.d.ts +7 -1
  15. package/dist/runtime/composables/useEmbedConfig.js +8 -0
  16. package/dist/runtime/composables/useFeatureFlags.d.ts +1 -2
  17. package/dist/runtime/composables/useTelaAgentMetadata.d.ts +8 -0
  18. package/dist/runtime/composables/useTelaAgentMetadata.js +65 -0
  19. package/dist/runtime/composables/useWorkspaceSettings.d.ts +1 -19
  20. package/dist/runtime/embed/components/ChatConfigurationModal.d.vue.ts +1 -1
  21. package/dist/runtime/embed/components/ChatConfigurationModal.vue.d.ts +1 -1
  22. package/dist/runtime/embed/components/ChatEmbed.d.vue.ts +3 -23
  23. package/dist/runtime/embed/components/ChatEmbed.vue +34 -9
  24. package/dist/runtime/embed/components/ChatEmbed.vue.d.ts +3 -23
  25. package/dist/runtime/embed/components/ChatEmbedInner.vue +36 -12
  26. package/dist/runtime/plugins/markstream.d.ts +1 -1
  27. package/dist/runtime/plugins/markstream.js +1 -1
  28. package/dist/runtime/server/api/conversations/[id]/cancel.post.d.ts +1 -1
  29. package/dist/runtime/server/api/conversations/[id]/cancel.post.js +37 -17
  30. package/dist/runtime/server/api/conversations/[id]/clear.post.js +28 -13
  31. package/dist/runtime/server/api/conversations/[id]/duplicate.post.js +11 -13
  32. package/dist/runtime/server/api/conversations/[id]/files.get.js +5 -7
  33. package/dist/runtime/server/api/conversations/[id]/index.delete.js +13 -12
  34. package/dist/runtime/server/api/conversations/[id]/index.get.js +6 -13
  35. package/dist/runtime/server/api/conversations/[id]/index.patch.js +11 -10
  36. package/dist/runtime/server/api/conversations/[id]/messages/[messageId]/retry.post.js +46 -80
  37. package/dist/runtime/server/api/conversations/[id]/messages/index.get.d.ts +1 -14
  38. package/dist/runtime/server/api/conversations/[id]/messages/index.get.js +81 -187
  39. package/dist/runtime/server/api/conversations/[id]/messages/index.post.js +68 -86
  40. package/dist/runtime/server/api/conversations/[id]/usage.get.js +4 -8
  41. package/dist/runtime/server/api/conversations/generate-title.post.js +4 -3
  42. package/dist/runtime/server/api/conversations/index.get.js +5 -4
  43. package/dist/runtime/server/api/conversations/index.post.js +5 -4
  44. package/dist/runtime/server/api/tela/agents/[id].get.d.ts +6 -0
  45. package/dist/runtime/server/api/tela/agents/[id].get.js +25 -0
  46. package/dist/runtime/server/api/workspace/settings.patch.js +1 -1
  47. package/dist/runtime/server/db/schema/conversations.d.ts +17 -0
  48. package/dist/runtime/server/db/schema/conversations.js +3 -1
  49. package/dist/runtime/server/db/schema/workspace-settings.d.ts +1 -1
  50. package/dist/runtime/server/utils/chat-context.d.ts +5 -0
  51. package/dist/runtime/server/utils/chat-context.js +20 -0
  52. package/dist/runtime/server/utils/conversation-agent-turn.d.ts +39 -0
  53. package/dist/runtime/server/utils/conversation-agent-turn.js +170 -0
  54. package/dist/runtime/server/utils/conversation-message-files.d.ts +10 -0
  55. package/dist/runtime/server/utils/conversation-message-files.js +77 -0
  56. package/dist/runtime/server/utils/conversation-message-sync.d.ts +31 -0
  57. package/dist/runtime/server/utils/conversation-message-sync.js +132 -0
  58. package/dist/runtime/server/utils/conversation-scope.d.ts +2 -0
  59. package/dist/runtime/server/utils/conversation-scope.js +12 -0
  60. package/dist/runtime/server/utils/tela-agent-api.d.ts +29 -0
  61. package/dist/runtime/server/utils/tela-agent-api.js +107 -0
  62. package/dist/runtime/server/utils/tela-agent-session.d.ts +48 -0
  63. package/dist/runtime/server/utils/tela-agent-session.js +350 -0
  64. package/dist/runtime/types/embed.d.ts +29 -0
  65. package/dist/runtime/types/embed.js +0 -0
  66. package/dist/runtime/types/tela-agent.d.ts +243 -0
  67. package/dist/runtime/types/tela-agent.js +98 -0
  68. package/dist/runtime/types/workspace-settings-data.d.ts +19 -0
  69. package/dist/runtime/types/workspace-settings-data.js +0 -0
  70. package/dist/runtime/types/workspace-settings.d.ts +1 -1
  71. package/dist/runtime/utils/agent-input-readiness.d.ts +14 -0
  72. package/dist/runtime/utils/agent-input-readiness.js +15 -0
  73. package/dist/runtime/utils/features.d.ts +9 -0
  74. package/dist/runtime/utils/features.js +5 -4
  75. package/dist/runtime/utils/file.js +46 -7
  76. package/dist/runtime/utils/markdown-nodes.d.ts +1 -0
  77. package/dist/runtime/utils/markdown-nodes.js +6 -0
  78. package/dist/runtime/utils/tela-chat.d.ts +6 -0
  79. package/dist/runtime/utils/tela-chat.js +12 -1
  80. package/drizzle/0014_faulty_lake.sql +2 -0
  81. package/drizzle/meta/0014_snapshot.json +732 -0
  82. package/drizzle/meta/_journal.json +7 -0
  83. package/package.json +1 -1
  84. package/dist/runtime/types/feature-flags.d.ts +0 -7
  85. package/dist/runtime/types/feature-flags.js +0 -6
@@ -0,0 +1,350 @@
1
+ import { createError } from "h3";
2
+ import { jsonMarkdown } from "#chat-runtime/utils/markdown-nodes";
3
+ const INTERRUPTED_GENERATION_TEXT = "_Gera\xE7\xE3o interrompida pelo usu\xE1rio_";
4
+ const POSTGRES_NUL_BYTE = String.fromCharCode(0);
5
+ const REASONING_TAG_PATTERN = /<reasoning>[\s\S]*?(?:<\/reasoning>|$)/g;
6
+ const ANSWER_TAG_PATTERN = /<answer>([\s\S]*?)(?:<\/answer>|$)/;
7
+ const MARKDOWN_HEADING_PATTERN = /(?:^|\r?\n)#{1,6}\s+\S.*$/gm;
8
+ const BINARY_ARTIFACT_MARKERS = [
9
+ "%PDF-",
10
+ `PK${String.fromCharCode(3)}${String.fromCharCode(4)}`
11
+ ];
12
+ function getVaultRef(file) {
13
+ return file.vaultReference?.trim() || (file.url.startsWith("vault://") ? file.url : null);
14
+ }
15
+ function requireVaultRef(file) {
16
+ const vaultRef = getVaultRef(file);
17
+ if (!vaultRef) {
18
+ throw createError({
19
+ statusCode: 400,
20
+ statusMessage: "Tela agent attachments require vault-backed files"
21
+ });
22
+ }
23
+ return vaultRef;
24
+ }
25
+ export function toTelaAgentInputSchema(files, inputVariables) {
26
+ const fileInputVariables = (inputVariables ?? []).filter((input) => input.type === "file" && input.name.trim());
27
+ if (fileInputVariables.length !== 1)
28
+ return [];
29
+ const inputName = fileInputVariables[0].name;
30
+ return (files ?? []).map((file) => {
31
+ return {
32
+ type: "file",
33
+ name: inputName,
34
+ vaultRef: requireVaultRef(file),
35
+ filename: file.name.slice(0, 255)
36
+ };
37
+ });
38
+ }
39
+ export function toTelaAgentAttachments(files) {
40
+ return (files ?? []).map((file) => ({
41
+ vaultRef: requireVaultRef(file),
42
+ filename: file.name.slice(0, 255)
43
+ }));
44
+ }
45
+ export function getTelaAgentStepSyncId(step) {
46
+ return step.eventId ?? step.id;
47
+ }
48
+ function isRecord(value) {
49
+ return !!value && typeof value === "object" && !Array.isArray(value);
50
+ }
51
+ function sanitizeText(value) {
52
+ return value.replaceAll(POSTGRES_NUL_BYTE, "");
53
+ }
54
+ function sanitizeUnknown(value) {
55
+ if (typeof value === "string")
56
+ return sanitizeText(value);
57
+ if (Array.isArray(value))
58
+ return value.map((item) => sanitizeUnknown(item));
59
+ if (isRecord(value)) {
60
+ return Object.fromEntries(
61
+ Object.entries(value).map(([key, item]) => [key, sanitizeUnknown(item)])
62
+ );
63
+ }
64
+ return value;
65
+ }
66
+ function sanitizeRecord(value) {
67
+ return sanitizeUnknown(value);
68
+ }
69
+ function decodeUriSegment(value) {
70
+ try {
71
+ return decodeURIComponent(value);
72
+ } catch {
73
+ return value;
74
+ }
75
+ }
76
+ function extractMissingVaultFileName(error) {
77
+ const messageMatch = /\bFile\s+(.+?)\s+not found in workspace\b/i.exec(error);
78
+ const messageFileName = messageMatch?.[1]?.trim();
79
+ if (messageFileName)
80
+ return sanitizeText(messageFileName);
81
+ const urlMatch = /\/files\/([^:\s?#]+).*?\b404\s+Not Found\b/is.exec(error);
82
+ const urlFileName = urlMatch?.[1]?.trim();
83
+ if (urlFileName)
84
+ return sanitizeText(decodeUriSegment(urlFileName));
85
+ return null;
86
+ }
87
+ function formatTelaAgentFailureMessage(error) {
88
+ const sanitizedError = sanitizeText(error ?? "Agent execution failed");
89
+ const missingVaultFileName = extractMissingVaultFileName(sanitizedError);
90
+ if (missingVaultFileName) {
91
+ return `Erro: O arquivo ${JSON.stringify(missingVaultFileName)} n\xE3o foi encontrado neste workspace. Envie o arquivo novamente ou confira se a refer\xEAncia do Vault pertence ao workspace atual.`;
92
+ }
93
+ return `Error: ${sanitizedError}`;
94
+ }
95
+ function extractTaggedAnswer(value) {
96
+ const match = value.match(ANSWER_TAG_PATTERN);
97
+ return match?.[1]?.trim() || null;
98
+ }
99
+ function stripTaggedReasoning(value) {
100
+ return value.replace(REASONING_TAG_PATTERN, "").trim();
101
+ }
102
+ function findBinaryArtifactStart(value) {
103
+ let index = -1;
104
+ for (const marker of BINARY_ARTIFACT_MARKERS) {
105
+ let searchStart = 0;
106
+ while (searchStart < value.length) {
107
+ const markerIndex = value.indexOf(marker, searchStart);
108
+ if (markerIndex === -1)
109
+ break;
110
+ if (markerIndex === 0 || value[markerIndex - 1] === "\n") {
111
+ index = index === -1 ? markerIndex : Math.min(index, markerIndex);
112
+ break;
113
+ }
114
+ searchStart = markerIndex + marker.length;
115
+ }
116
+ }
117
+ return index;
118
+ }
119
+ function stripBinaryArtifactContent(value) {
120
+ const index = findBinaryArtifactStart(value);
121
+ if (index === -1)
122
+ return value;
123
+ return value.slice(0, index).trimEnd();
124
+ }
125
+ function looksLikeGeneratedArtifactScript(value) {
126
+ const trimmed = value.trim();
127
+ if (!trimmed)
128
+ return false;
129
+ const hasScriptShape = /^#!\/usr\/bin\/env\s+\S+/m.test(trimmed) || /(?:^|\n)# -\*- coding:/.test(trimmed) || /(?:^|\n)from\s+\S+\s+import\s+\S+/.test(trimmed) || /(?:^|\n)import\s+\S+/.test(trimmed) || /(?:^|\n)(?:class|def)\s+\w+/.test(trimmed);
130
+ const hasGeneratedFileSignal = /vault:\/\/|\.output\s*\(|open\s*\([^)]*,\s*['"][wa]/.test(trimmed);
131
+ return hasScriptShape && hasGeneratedFileSignal;
132
+ }
133
+ function findGeneratedArtifactMarkdownStart(value) {
134
+ for (const match of value.matchAll(MARKDOWN_HEADING_PATTERN)) {
135
+ if (match.index === void 0)
136
+ continue;
137
+ const headingOffset = match[0].match(/^[\r\n]+/)?.[0].length ?? 0;
138
+ const markdownStart = match.index + headingOffset;
139
+ const heading = value.slice(markdownStart, match.index + match[0].length).trim();
140
+ if (/^#{1,6}\s+-\*-/.test(heading))
141
+ continue;
142
+ if (looksLikeGeneratedArtifactScript(value.slice(0, markdownStart)))
143
+ return markdownStart;
144
+ }
145
+ return -1;
146
+ }
147
+ function stripGeneratedArtifactScriptPrefix(value) {
148
+ const markdownStart = findGeneratedArtifactMarkdownStart(value);
149
+ if (markdownStart === -1)
150
+ return value;
151
+ return value.slice(markdownStart).trimStart();
152
+ }
153
+ function normalizeTelaAgentResultContent(value) {
154
+ const sanitized = sanitizeText(value);
155
+ const taggedAnswer = extractTaggedAnswer(sanitized);
156
+ let normalized = taggedAnswer ?? sanitized;
157
+ let changed = taggedAnswer !== null;
158
+ const withoutTaggedReasoning = stripTaggedReasoning(normalized);
159
+ changed ||= withoutTaggedReasoning !== normalized;
160
+ normalized = withoutTaggedReasoning;
161
+ const withoutBinaryArtifacts = stripBinaryArtifactContent(normalized);
162
+ changed ||= withoutBinaryArtifacts !== normalized;
163
+ normalized = withoutBinaryArtifacts;
164
+ const withoutGeneratedScript = stripGeneratedArtifactScriptPrefix(normalized);
165
+ changed ||= withoutGeneratedScript !== normalized;
166
+ normalized = withoutGeneratedScript;
167
+ const withoutTrailingBinaryArtifacts = stripBinaryArtifactContent(normalized);
168
+ changed ||= withoutTrailingBinaryArtifacts !== normalized;
169
+ normalized = withoutTrailingBinaryArtifacts;
170
+ return changed ? normalized.trim() : normalized;
171
+ }
172
+ function getStringProperty(record, key) {
173
+ const value = record[key];
174
+ if (typeof value !== "string")
175
+ return null;
176
+ const sanitized = sanitizeText(value);
177
+ return sanitized.trim() ? sanitized : null;
178
+ }
179
+ function getContentPartText(part) {
180
+ return getStringProperty(part, "text") ?? getStringProperty(part, "thinking");
181
+ }
182
+ function normalizeToolResultContent(content) {
183
+ if (typeof content === "string")
184
+ return sanitizeText(content);
185
+ if (Array.isArray(content))
186
+ return sanitizeUnknown(content);
187
+ return "";
188
+ }
189
+ function normalizeMessageContentPart(part) {
190
+ if (!isRecord(part))
191
+ return null;
192
+ const type = getStringProperty(part, "type");
193
+ if (!type)
194
+ return null;
195
+ if (type === "text" || type === "thinking" || type === "reasoning") {
196
+ const text2 = getContentPartText(part);
197
+ return text2 ? { type: "text", text: text2 } : null;
198
+ }
199
+ if (type === "tool_use") {
200
+ const id = getStringProperty(part, "id");
201
+ const name = getStringProperty(part, "name");
202
+ if (!id || !name)
203
+ return null;
204
+ return {
205
+ type: "tool_use",
206
+ id,
207
+ name,
208
+ input: isRecord(part.input) ? sanitizeRecord(part.input) : {}
209
+ };
210
+ }
211
+ if (type === "tool_result") {
212
+ const toolUseId = getStringProperty(part, "tool_use_id");
213
+ if (!toolUseId)
214
+ return null;
215
+ return {
216
+ type: "tool_result",
217
+ tool_use_id: toolUseId,
218
+ content: normalizeToolResultContent(part.content),
219
+ ...typeof part.is_error === "boolean" ? { is_error: part.is_error } : {}
220
+ };
221
+ }
222
+ const text = getContentPartText(part);
223
+ return text ? { type: "text", text } : null;
224
+ }
225
+ function normalizeStepMessageContent(step) {
226
+ const record = step;
227
+ const message = record.message;
228
+ if (isRecord(message) && Array.isArray(message.content)) {
229
+ return message.content.map((part) => normalizeMessageContentPart(part)).filter((part) => Boolean(part));
230
+ }
231
+ const text = getStepText(step);
232
+ return text ? [{ type: "text", text }] : [];
233
+ }
234
+ function getStepText(step) {
235
+ const record = step;
236
+ const directText = getStringProperty(record, "content") ?? getStringProperty(record, "text") ?? getStringProperty(record, "output");
237
+ if (directText)
238
+ return directText;
239
+ const message = record.message;
240
+ if (typeof message === "string" && message.trim())
241
+ return message;
242
+ if (isRecord(message) && Array.isArray(message.content)) {
243
+ for (const part of message.content) {
244
+ if (!isRecord(part))
245
+ continue;
246
+ const text = getContentPartText(part);
247
+ if (text)
248
+ return text;
249
+ }
250
+ }
251
+ return null;
252
+ }
253
+ export function normalizeTelaAgentReasoningStep(sessionId, step) {
254
+ const content = normalizeStepMessageContent(step);
255
+ if (content.length === 0)
256
+ return null;
257
+ const record = step;
258
+ const message = isRecord(record.message) ? record.message : null;
259
+ const sourceType = getStringProperty(record, "type");
260
+ const type = sourceType === "user" ? "user" : "assistant";
261
+ const role = message ? getStringProperty(message, "role") : null;
262
+ const timestamp = typeof record.timestamp === "number" ? record.timestamp : Date.now();
263
+ const timeElapsed = typeof record.timeElapsed === "number" ? record.timeElapsed : 0;
264
+ const parentToolUseId = getStringProperty(record, "parent_tool_use_id");
265
+ return {
266
+ type,
267
+ uuid: getTelaAgentStepSyncId(step),
268
+ message: {
269
+ role: role ?? (type === "user" ? "user" : "assistant"),
270
+ content
271
+ },
272
+ timestamp,
273
+ session_id: sessionId,
274
+ timeElapsed,
275
+ parent_tool_use_id: parentToolUseId
276
+ };
277
+ }
278
+ export function getNewTelaAgentSteps(session, lastSyncedStepId) {
279
+ if (!lastSyncedStepId)
280
+ return session.steps;
281
+ const lastSyncedIndex = session.steps.findIndex((step) => getTelaAgentStepSyncId(step) === lastSyncedStepId);
282
+ return session.steps.slice(lastSyncedIndex + 1);
283
+ }
284
+ export function extractTelaAgentAssistantContent(session, steps = session.steps) {
285
+ const structuredContent = session.result?.structuredContent;
286
+ if (structuredContent)
287
+ return sanitizeText(jsonMarkdown(structuredContent));
288
+ if (session.result?.content)
289
+ return normalizeTelaAgentResultContent(session.result.content);
290
+ for (let i = steps.length - 1; i >= 0; i--) {
291
+ const text = getStepText(steps[i]);
292
+ if (text)
293
+ return text;
294
+ }
295
+ return "";
296
+ }
297
+ export function mapTelaAgentSessionToMessageUpdate(session, options = {}) {
298
+ const now = options.now ?? /* @__PURE__ */ new Date();
299
+ const newSteps = getNewTelaAgentSteps(session, options.lastSyncedStepId);
300
+ const reasoningData = newSteps.map((step) => normalizeTelaAgentReasoningStep(session.sessionId, step)).filter((step) => Boolean(step));
301
+ const accumulatedReasoningData = [
302
+ ...options.existingReasoningData ?? [],
303
+ ...reasoningData
304
+ ];
305
+ const lastStep = newSteps.at(-1);
306
+ const update = {};
307
+ if (reasoningData.length > 0)
308
+ update.reasoningData = accumulatedReasoningData;
309
+ if (reasoningData.length > 0 && lastStep)
310
+ update.externalUuid = getTelaAgentStepSyncId(lastStep);
311
+ if (!options.pendingMessageTtft && options.userMessageCreatedAt && reasoningData.length > 0) {
312
+ update.ttft = String(now.getTime() - options.userMessageCreatedAt.getTime());
313
+ }
314
+ if (session.status === "completed" || session.status === "waiting_messages") {
315
+ update.content = extractTelaAgentAssistantContent(session);
316
+ update.status = "completed";
317
+ update.updatedAt = now;
318
+ } else if (session.status === "failed") {
319
+ update.content = formatTelaAgentFailureMessage(session.error);
320
+ update.status = "failed";
321
+ update.updatedAt = now;
322
+ } else if (session.status === "cancelled") {
323
+ update.content = INTERRUPTED_GENERATION_TEXT;
324
+ update.status = "completed";
325
+ update.updatedAt = now;
326
+ }
327
+ return update;
328
+ }
329
+ export function mapTelaAgentUsage(session) {
330
+ const usage = session.result?.usage;
331
+ if (!usage)
332
+ return null;
333
+ return {
334
+ promptTokens: usage.promptTokens ?? 0,
335
+ completionTokens: usage.completionTokens ?? 0,
336
+ totalTokens: usage.totalTokens ?? 0,
337
+ promptCost: String(usage.promptCost ?? 0),
338
+ completionCost: String(usage.completionCost ?? 0),
339
+ totalCost: String(usage.totalCost ?? 0),
340
+ durationMs: usage.duration ?? null,
341
+ turns: usage.turns ?? null,
342
+ model: null,
343
+ cacheReadInputTokens: null,
344
+ cacheCreationInputTokens: null,
345
+ modelUsage: null,
346
+ durationApiMs: null,
347
+ webSearchRequests: null,
348
+ webFetchRequests: null
349
+ };
350
+ }
@@ -0,0 +1,29 @@
1
+ import type { Component, DeepReadonly } from 'vue';
2
+ import type { WorkspaceSettings } from './workspace-settings-data.js';
3
+ import type { TelaAgentExecutionInput } from './tela-agent.js';
4
+ import type { ChatLoadingMessageMode } from '../utils/chat-loading-messages.js';
5
+ import type { ChatActor, ChatFeatureConfig } from '../utils/tela-chat.js';
6
+ export type ChatEmbedSharedProps = {
7
+ conversationId?: string | null;
8
+ initialConversationId?: string | null;
9
+ hideSidebar?: boolean;
10
+ loadingMessages?: readonly string[] | null;
11
+ loadingMessagesMode?: ChatLoadingMessageMode | null;
12
+ customComponents?: Record<string, Component>;
13
+ customHtmlTags?: readonly string[];
14
+ };
15
+ export type DefaultChatEmbedProps = ChatEmbedSharedProps & {
16
+ telaAgentId?: undefined;
17
+ telaAgentInputs?: undefined;
18
+ workspaceSettings?: DeepReadonly<WorkspaceSettings> | WorkspaceSettings | null;
19
+ user?: ChatActor | null;
20
+ features?: Partial<ChatFeatureConfig>;
21
+ };
22
+ export type TelaAgentChatEmbedProps = ChatEmbedSharedProps & {
23
+ telaAgentId: string;
24
+ telaAgentInputs?: DeepReadonly<TelaAgentExecutionInput[]> | null;
25
+ workspaceSettings?: never;
26
+ user?: never;
27
+ features?: Partial<ChatFeatureConfig>;
28
+ };
29
+ export type MeistrariChatEmbedProps = DefaultChatEmbedProps | TelaAgentChatEmbedProps;
File without changes
@@ -0,0 +1,243 @@
1
+ import { z } from 'zod';
2
+ export declare const telaAgentAttachmentSchema: z.ZodObject<{
3
+ vaultRef: z.ZodString;
4
+ filename: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export declare const telaAgentInputVariableSchema: z.ZodObject<{
7
+ id: z.ZodOptional<z.ZodString>;
8
+ name: z.ZodString;
9
+ type: z.ZodEnum<{
10
+ text: "text";
11
+ file: "file";
12
+ }>;
13
+ required: z.ZodOptional<z.ZodBoolean>;
14
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ }, z.core.$catchall<z.ZodUnknown>>;
16
+ export type TelaAgentInputVariable = z.infer<typeof telaAgentInputVariableSchema>;
17
+ export declare const telaAgentFileInputSchema: z.ZodObject<{
18
+ type: z.ZodLiteral<"file">;
19
+ name: z.ZodString;
20
+ vaultRef: z.ZodString;
21
+ filename: z.ZodString;
22
+ metadata: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>;
24
+ export declare const telaAgentTextInputSchema: z.ZodObject<{
25
+ type: z.ZodLiteral<"text">;
26
+ name: z.ZodString;
27
+ content: z.ZodString;
28
+ }, z.core.$strip>;
29
+ export declare const telaAgentExecutionInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
30
+ type: z.ZodLiteral<"file">;
31
+ name: z.ZodString;
32
+ vaultRef: z.ZodString;
33
+ filename: z.ZodString;
34
+ metadata: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>, z.ZodObject<{
36
+ type: z.ZodLiteral<"text">;
37
+ name: z.ZodString;
38
+ content: z.ZodString;
39
+ }, z.core.$strip>], "type">;
40
+ export type TelaAgentExecutionInput = z.infer<typeof telaAgentExecutionInputSchema>;
41
+ export declare const telaAgentRunPayloadSchema: z.ZodObject<{
42
+ message: z.ZodString;
43
+ sessionId: z.ZodOptional<z.ZodString>;
44
+ inputSchema: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
45
+ type: z.ZodLiteral<"file">;
46
+ name: z.ZodString;
47
+ vaultRef: z.ZodString;
48
+ filename: z.ZodString;
49
+ metadata: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ type: z.ZodLiteral<"text">;
52
+ name: z.ZodString;
53
+ content: z.ZodString;
54
+ }, z.core.$strip>], "type">>>;
55
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
+ vaultRef: z.ZodString;
57
+ filename: z.ZodString;
58
+ }, z.core.$strip>>>;
59
+ }, z.core.$catchall<z.ZodUnknown>>;
60
+ export type TelaAgentRunPayload = z.infer<typeof telaAgentRunPayloadSchema>;
61
+ export declare const telaAgentSchema: z.ZodObject<{
62
+ id: z.ZodString;
63
+ inputSchema: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
64
+ id: z.ZodOptional<z.ZodString>;
65
+ name: z.ZodString;
66
+ type: z.ZodEnum<{
67
+ text: "text";
68
+ file: "file";
69
+ }>;
70
+ required: z.ZodOptional<z.ZodBoolean>;
71
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ }, z.core.$catchall<z.ZodUnknown>>>>>, z.ZodTransform<{
73
+ [x: string]: unknown;
74
+ name: string;
75
+ type: "text" | "file";
76
+ id?: string | undefined;
77
+ required?: boolean | undefined;
78
+ description?: string | null | undefined;
79
+ }[], {
80
+ [x: string]: unknown;
81
+ name: string;
82
+ type: "text" | "file";
83
+ id?: string | undefined;
84
+ required?: boolean | undefined;
85
+ description?: string | null | undefined;
86
+ }[] | null | undefined>>;
87
+ isMultiturn: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
88
+ }, z.core.$catchall<z.ZodUnknown>>;
89
+ export type TelaAgent = z.infer<typeof telaAgentSchema>;
90
+ export declare const telaAgentRunResponseSchema: z.ZodObject<{
91
+ sessionId: z.ZodString;
92
+ }, z.core.$catchall<z.ZodUnknown>>;
93
+ export type TelaAgentRunResponse = z.infer<typeof telaAgentRunResponseSchema>;
94
+ export declare const telaAgentSessionStatusSchema: z.ZodEnum<{
95
+ pending: "pending";
96
+ running: "running";
97
+ completed: "completed";
98
+ failed: "failed";
99
+ waiting_messages: "waiting_messages";
100
+ cancelled: "cancelled";
101
+ }>;
102
+ export type TelaAgentSessionStatus = z.infer<typeof telaAgentSessionStatusSchema>;
103
+ export declare const telaAgentStepSchema: z.ZodObject<{
104
+ id: z.ZodString;
105
+ eventId: z.ZodOptional<z.ZodString>;
106
+ inputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
107
+ outputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
108
+ cacheReadInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
109
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
110
+ calculatedCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
111
+ }, z.core.$catchall<z.ZodUnknown>>;
112
+ export type TelaAgentStep = z.infer<typeof telaAgentStepSchema>;
113
+ export declare const telaAgentUsageSchema: z.ZodObject<{
114
+ duration: z.ZodOptional<z.ZodNumber>;
115
+ turns: z.ZodOptional<z.ZodNumber>;
116
+ completionTokens: z.ZodOptional<z.ZodNumber>;
117
+ promptTokens: z.ZodOptional<z.ZodNumber>;
118
+ totalTokens: z.ZodOptional<z.ZodNumber>;
119
+ completionCost: z.ZodOptional<z.ZodNumber>;
120
+ promptCost: z.ZodOptional<z.ZodNumber>;
121
+ totalCost: z.ZodOptional<z.ZodNumber>;
122
+ }, z.core.$catchall<z.ZodUnknown>>;
123
+ export declare const telaAgentSessionSchema: z.ZodObject<{
124
+ sessionId: z.ZodString;
125
+ status: z.ZodEnum<{
126
+ pending: "pending";
127
+ running: "running";
128
+ completed: "completed";
129
+ failed: "failed";
130
+ waiting_messages: "waiting_messages";
131
+ cancelled: "cancelled";
132
+ }>;
133
+ steps: z.ZodArray<z.ZodObject<{
134
+ id: z.ZodString;
135
+ eventId: z.ZodOptional<z.ZodString>;
136
+ inputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
137
+ outputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
138
+ cacheReadInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
139
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
140
+ calculatedCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
141
+ }, z.core.$catchall<z.ZodUnknown>>>;
142
+ nextCursor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
143
+ result: z.ZodOptional<z.ZodObject<{
144
+ usage: z.ZodOptional<z.ZodObject<{
145
+ duration: z.ZodOptional<z.ZodNumber>;
146
+ turns: z.ZodOptional<z.ZodNumber>;
147
+ completionTokens: z.ZodOptional<z.ZodNumber>;
148
+ promptTokens: z.ZodOptional<z.ZodNumber>;
149
+ totalTokens: z.ZodOptional<z.ZodNumber>;
150
+ completionCost: z.ZodOptional<z.ZodNumber>;
151
+ promptCost: z.ZodOptional<z.ZodNumber>;
152
+ totalCost: z.ZodOptional<z.ZodNumber>;
153
+ }, z.core.$catchall<z.ZodUnknown>>>;
154
+ content: z.ZodOptional<z.ZodString>;
155
+ structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
156
+ childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
+ }, z.core.$catchall<z.ZodUnknown>>>;
158
+ error: z.ZodOptional<z.ZodString>;
159
+ createdAt: z.ZodOptional<z.ZodNumber>;
160
+ updatedAt: z.ZodOptional<z.ZodNumber>;
161
+ }, z.core.$catchall<z.ZodUnknown>>;
162
+ export type TelaAgentSession = z.infer<typeof telaAgentSessionSchema>;
163
+ export declare const telaAgentRunApiResponseSchema: z.ZodObject<{
164
+ data: z.ZodObject<{
165
+ sessionId: z.ZodString;
166
+ }, z.core.$catchall<z.ZodUnknown>>;
167
+ }, z.core.$catchall<z.ZodUnknown>>;
168
+ export declare const telaAgentApiResponseSchema: z.ZodObject<{
169
+ data: z.ZodObject<{
170
+ id: z.ZodString;
171
+ inputSchema: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
172
+ id: z.ZodOptional<z.ZodString>;
173
+ name: z.ZodString;
174
+ type: z.ZodEnum<{
175
+ text: "text";
176
+ file: "file";
177
+ }>;
178
+ required: z.ZodOptional<z.ZodBoolean>;
179
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ }, z.core.$catchall<z.ZodUnknown>>>>>, z.ZodTransform<{
181
+ [x: string]: unknown;
182
+ name: string;
183
+ type: "text" | "file";
184
+ id?: string | undefined;
185
+ required?: boolean | undefined;
186
+ description?: string | null | undefined;
187
+ }[], {
188
+ [x: string]: unknown;
189
+ name: string;
190
+ type: "text" | "file";
191
+ id?: string | undefined;
192
+ required?: boolean | undefined;
193
+ description?: string | null | undefined;
194
+ }[] | null | undefined>>;
195
+ isMultiturn: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
196
+ }, z.core.$catchall<z.ZodUnknown>>;
197
+ }, z.core.$catchall<z.ZodUnknown>>;
198
+ export declare const telaAgentSessionApiResponseSchema: z.ZodObject<{
199
+ data: z.ZodObject<{
200
+ sessionId: z.ZodString;
201
+ status: z.ZodEnum<{
202
+ pending: "pending";
203
+ running: "running";
204
+ completed: "completed";
205
+ failed: "failed";
206
+ waiting_messages: "waiting_messages";
207
+ cancelled: "cancelled";
208
+ }>;
209
+ steps: z.ZodArray<z.ZodObject<{
210
+ id: z.ZodString;
211
+ eventId: z.ZodOptional<z.ZodString>;
212
+ inputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
213
+ outputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
214
+ cacheReadInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
215
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
216
+ calculatedCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
217
+ }, z.core.$catchall<z.ZodUnknown>>>;
218
+ nextCursor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
219
+ result: z.ZodOptional<z.ZodObject<{
220
+ usage: z.ZodOptional<z.ZodObject<{
221
+ duration: z.ZodOptional<z.ZodNumber>;
222
+ turns: z.ZodOptional<z.ZodNumber>;
223
+ completionTokens: z.ZodOptional<z.ZodNumber>;
224
+ promptTokens: z.ZodOptional<z.ZodNumber>;
225
+ totalTokens: z.ZodOptional<z.ZodNumber>;
226
+ completionCost: z.ZodOptional<z.ZodNumber>;
227
+ promptCost: z.ZodOptional<z.ZodNumber>;
228
+ totalCost: z.ZodOptional<z.ZodNumber>;
229
+ }, z.core.$catchall<z.ZodUnknown>>>;
230
+ content: z.ZodOptional<z.ZodString>;
231
+ structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
232
+ childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
233
+ }, z.core.$catchall<z.ZodUnknown>>>;
234
+ error: z.ZodOptional<z.ZodString>;
235
+ createdAt: z.ZodOptional<z.ZodNumber>;
236
+ updatedAt: z.ZodOptional<z.ZodNumber>;
237
+ }, z.core.$catchall<z.ZodUnknown>>;
238
+ }, z.core.$catchall<z.ZodUnknown>>;
239
+ export declare const telaAgentEndSessionApiResponseSchema: z.ZodObject<{
240
+ data: z.ZodObject<{
241
+ success: z.ZodBoolean;
242
+ }, z.core.$catchall<z.ZodUnknown>>;
243
+ }, z.core.$catchall<z.ZodUnknown>>;