@meistrari/chat-nuxt 3.10.0 → 3.11.1
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/README.md +1 -1
- package/dist/module.json +1 -1
- package/dist/runtime/embed/components/chat-embed-inner.vue +76 -40
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.d.vue.ts +2 -2
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue +0 -1
- package/dist/runtime/embed/components/mobile/chat-mobile-shell.vue.d.ts +2 -2
- package/dist/runtime/embed/composables/use-agent-wake.d.ts +22 -0
- package/dist/runtime/embed/composables/use-agent-wake.js +178 -0
- package/dist/runtime/embed/feature-config.d.ts +4 -4
- package/dist/runtime/embed/feature-config.js +2 -1
- package/dist/runtime/embed/loading-messages.d.ts +16 -0
- package/dist/runtime/embed/loading-messages.js +10 -0
- package/dist/runtime/messages/components/chat-message-bubble.d.vue.ts +10 -1
- package/dist/runtime/messages/components/chat-message-bubble.vue +18 -7
- package/dist/runtime/messages/components/chat-message-bubble.vue.d.ts +10 -1
- package/dist/runtime/messages/components/chat-message-list.d.vue.ts +6 -1
- package/dist/runtime/messages/components/chat-message-list.vue +11 -2
- package/dist/runtime/messages/components/chat-message-list.vue.d.ts +6 -1
- package/dist/runtime/messages/components/reasoning/chat-reasoning-thought.d.vue.ts +2 -1
- package/dist/runtime/messages/components/reasoning/chat-reasoning-thought.vue +9 -8
- package/dist/runtime/messages/components/reasoning/chat-reasoning-thought.vue.d.ts +2 -1
- package/dist/runtime/messages/composables/chat.d.ts +8 -2
- package/dist/runtime/messages/composables/chat.js +180 -25
- package/dist/runtime/messages/composables/use-direct-stream.d.ts +41 -0
- package/dist/runtime/messages/composables/use-direct-stream.js +263 -0
- package/dist/runtime/messages/reasoning.d.ts +7 -0
- package/dist/runtime/messages/reasoning.js +5 -0
- package/dist/runtime/types/schemas/chat/conversations.d.ts +2 -0
- package/dist/runtime/types/schemas/chat/messages.d.ts +39 -0
- package/dist/runtime/types/schemas/chat/messages.js +24 -0
- package/dist/runtime/types/schemas/chat/models.d.ts +3 -2
- package/dist/runtime/types/schemas/chat/models.js +2 -1
- package/dist/runtime/types/schemas/chat/ui.d.ts +10 -0
- package/dist/runtime/types/schemas/chat/ui.js +1 -0
- package/dist/runtime/types/schemas/integrations/tela-agent-api.d.ts +35 -0
- package/dist/runtime/types/schemas/integrations/tela-agent-api.js +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SendMessageResponse } from '../../types/schemas/chat/messages.js';
|
|
2
|
+
export type DirectStreamActivity = 'idle' | 'connected' | 'active';
|
|
3
|
+
export type SseFrame = {
|
|
4
|
+
event?: string;
|
|
5
|
+
data: string;
|
|
6
|
+
};
|
|
7
|
+
export type MessagePartsEvent = {
|
|
8
|
+
kind: 'message-parts';
|
|
9
|
+
runId: string;
|
|
10
|
+
deltaSeq: number;
|
|
11
|
+
parentToolUseId?: string | null;
|
|
12
|
+
event: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
export type MessagePartsAccumulator = {
|
|
15
|
+
runId: string | null;
|
|
16
|
+
lastDeltaSeq: number;
|
|
17
|
+
textByIndex: Record<number, string>;
|
|
18
|
+
thinkingByIndex: Record<number, string>;
|
|
19
|
+
};
|
|
20
|
+
export declare function parseSseFrames(source: string): {
|
|
21
|
+
frames: SseFrame[];
|
|
22
|
+
rest: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function createMessagePartsAccumulator(runId?: string | null): MessagePartsAccumulator;
|
|
25
|
+
export declare function applyMessagePartsEvent(accumulator: MessagePartsAccumulator, input: MessagePartsEvent): {
|
|
26
|
+
text: string;
|
|
27
|
+
thinking: string;
|
|
28
|
+
changed: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare function useDirectStream(options?: {
|
|
31
|
+
onResult?: () => void;
|
|
32
|
+
onDisconnect?: () => void;
|
|
33
|
+
}): {
|
|
34
|
+
activity: any;
|
|
35
|
+
streamingText: any;
|
|
36
|
+
streamingThinking: any;
|
|
37
|
+
activeRunId: any;
|
|
38
|
+
connectMessage: (url: string, init: RequestInit, onAccepted: (response: SendMessageResponse) => void) => Promise<SendMessageResponse>;
|
|
39
|
+
beginMessage: () => void;
|
|
40
|
+
disconnect: (reset?: boolean) => void;
|
|
41
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
function isRecord(value) {
|
|
2
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
export function parseSseFrames(source) {
|
|
5
|
+
const frames = [];
|
|
6
|
+
let rest = source;
|
|
7
|
+
while (true) {
|
|
8
|
+
const boundary = /\r?\n\r?\n/.exec(rest);
|
|
9
|
+
if (!boundary || boundary.index === void 0)
|
|
10
|
+
break;
|
|
11
|
+
const rawFrame = rest.slice(0, boundary.index);
|
|
12
|
+
rest = rest.slice(boundary.index + boundary[0].length);
|
|
13
|
+
let event;
|
|
14
|
+
const data = [];
|
|
15
|
+
for (const line of rawFrame.split(/\r?\n/)) {
|
|
16
|
+
if (line.startsWith(":"))
|
|
17
|
+
continue;
|
|
18
|
+
const separator = line.indexOf(":");
|
|
19
|
+
const field = separator === -1 ? line : line.slice(0, separator);
|
|
20
|
+
const rawValue = separator === -1 ? "" : line.slice(separator + 1);
|
|
21
|
+
const value = rawValue.startsWith(" ") ? rawValue.slice(1) : rawValue;
|
|
22
|
+
if (field === "event")
|
|
23
|
+
event = value;
|
|
24
|
+
else if (field === "data")
|
|
25
|
+
data.push(value);
|
|
26
|
+
}
|
|
27
|
+
if (data.length > 0)
|
|
28
|
+
frames.push({ ...event ? { event } : {}, data: data.join("\n") });
|
|
29
|
+
}
|
|
30
|
+
return { frames, rest };
|
|
31
|
+
}
|
|
32
|
+
export function createMessagePartsAccumulator(runId = null) {
|
|
33
|
+
return {
|
|
34
|
+
runId,
|
|
35
|
+
lastDeltaSeq: -1,
|
|
36
|
+
textByIndex: {},
|
|
37
|
+
thinkingByIndex: {}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function joinedBlocks(blocks) {
|
|
41
|
+
return Object.entries(blocks).sort(([left], [right]) => Number(left) - Number(right)).map(([, value]) => value).join("");
|
|
42
|
+
}
|
|
43
|
+
export function applyMessagePartsEvent(accumulator, input) {
|
|
44
|
+
if (accumulator.runId !== input.runId) {
|
|
45
|
+
accumulator.runId = input.runId;
|
|
46
|
+
accumulator.lastDeltaSeq = -1;
|
|
47
|
+
accumulator.textByIndex = {};
|
|
48
|
+
accumulator.thinkingByIndex = {};
|
|
49
|
+
}
|
|
50
|
+
if (input.deltaSeq <= accumulator.lastDeltaSeq) {
|
|
51
|
+
return {
|
|
52
|
+
text: joinedBlocks(accumulator.textByIndex),
|
|
53
|
+
thinking: joinedBlocks(accumulator.thinkingByIndex),
|
|
54
|
+
changed: false
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
accumulator.lastDeltaSeq = input.deltaSeq;
|
|
58
|
+
if (input.parentToolUseId) {
|
|
59
|
+
return {
|
|
60
|
+
text: joinedBlocks(accumulator.textByIndex),
|
|
61
|
+
thinking: joinedBlocks(accumulator.thinkingByIndex),
|
|
62
|
+
changed: false
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const providerEvent = input.event;
|
|
66
|
+
if (providerEvent.type === "message_start") {
|
|
67
|
+
accumulator.textByIndex = {};
|
|
68
|
+
accumulator.thinkingByIndex = {};
|
|
69
|
+
return { text: "", thinking: "", changed: true };
|
|
70
|
+
}
|
|
71
|
+
const index = providerEvent.index;
|
|
72
|
+
if (typeof index !== "number" || !Number.isInteger(index)) {
|
|
73
|
+
return {
|
|
74
|
+
text: joinedBlocks(accumulator.textByIndex),
|
|
75
|
+
thinking: joinedBlocks(accumulator.thinkingByIndex),
|
|
76
|
+
changed: false
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const contentBlock = isRecord(providerEvent.content_block) ? providerEvent.content_block : null;
|
|
80
|
+
const delta = isRecord(providerEvent.delta) ? providerEvent.delta : null;
|
|
81
|
+
let changed = false;
|
|
82
|
+
if (providerEvent.type === "content_block_start" && contentBlock?.type === "text" && typeof contentBlock.text === "string") {
|
|
83
|
+
accumulator.textByIndex[index] = contentBlock.text;
|
|
84
|
+
changed = true;
|
|
85
|
+
} else if (providerEvent.type === "content_block_start" && contentBlock?.type === "thinking" && typeof contentBlock.thinking === "string") {
|
|
86
|
+
accumulator.thinkingByIndex[index] = contentBlock.thinking;
|
|
87
|
+
changed = true;
|
|
88
|
+
} else if (providerEvent.type === "content_block_delta" && delta?.type === "text_delta" && typeof delta.text === "string") {
|
|
89
|
+
accumulator.textByIndex[index] = `${accumulator.textByIndex[index] ?? ""}${delta.text}`;
|
|
90
|
+
changed = true;
|
|
91
|
+
} else if (providerEvent.type === "content_block_delta" && delta?.type === "thinking_delta" && typeof delta.thinking === "string") {
|
|
92
|
+
accumulator.thinkingByIndex[index] = `${accumulator.thinkingByIndex[index] ?? ""}${delta.thinking}`;
|
|
93
|
+
changed = true;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
text: joinedBlocks(accumulator.textByIndex),
|
|
97
|
+
thinking: joinedBlocks(accumulator.thinkingByIndex),
|
|
98
|
+
changed
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function reviveMessagePair(input) {
|
|
102
|
+
return {
|
|
103
|
+
userMessage: {
|
|
104
|
+
...input.userMessage,
|
|
105
|
+
createdAt: new Date(input.userMessage.createdAt),
|
|
106
|
+
updatedAt: input.userMessage.updatedAt ? new Date(input.userMessage.updatedAt) : null
|
|
107
|
+
},
|
|
108
|
+
assistantMessage: {
|
|
109
|
+
...input.assistantMessage,
|
|
110
|
+
createdAt: new Date(input.assistantMessage.createdAt),
|
|
111
|
+
updatedAt: input.assistantMessage.updatedAt ? new Date(input.assistantMessage.updatedAt) : null
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export function useDirectStream(options = {}) {
|
|
116
|
+
const activity = ref("idle");
|
|
117
|
+
const streamingText = ref("");
|
|
118
|
+
const streamingThinking = ref("");
|
|
119
|
+
const activeRunId = ref(null);
|
|
120
|
+
let accumulator = createMessagePartsAccumulator();
|
|
121
|
+
let abortController = null;
|
|
122
|
+
function resetAccumulator(runId = null) {
|
|
123
|
+
accumulator = createMessagePartsAccumulator(runId);
|
|
124
|
+
activeRunId.value = runId;
|
|
125
|
+
streamingText.value = "";
|
|
126
|
+
streamingThinking.value = "";
|
|
127
|
+
}
|
|
128
|
+
function beginMessage() {
|
|
129
|
+
resetAccumulator(activeRunId.value);
|
|
130
|
+
activity.value = "idle";
|
|
131
|
+
}
|
|
132
|
+
function disconnect(reset = true) {
|
|
133
|
+
abortController?.abort();
|
|
134
|
+
abortController = null;
|
|
135
|
+
activity.value = "idle";
|
|
136
|
+
if (reset)
|
|
137
|
+
resetAccumulator();
|
|
138
|
+
}
|
|
139
|
+
async function connectMessage(url, init, onAccepted) {
|
|
140
|
+
if (import.meta.server)
|
|
141
|
+
throw new Error("Message streaming is unavailable during server rendering");
|
|
142
|
+
abortController?.abort();
|
|
143
|
+
const controller = new AbortController();
|
|
144
|
+
abortController = controller;
|
|
145
|
+
let response;
|
|
146
|
+
try {
|
|
147
|
+
response = await fetch(url, { ...init, signal: controller.signal });
|
|
148
|
+
} catch (error) {
|
|
149
|
+
if (abortController === controller)
|
|
150
|
+
abortController = null;
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
if (!response.ok) {
|
|
154
|
+
if (abortController === controller)
|
|
155
|
+
abortController = null;
|
|
156
|
+
throw new Error(`Message stream request failed with status ${response.status}`);
|
|
157
|
+
}
|
|
158
|
+
if (!response.body) {
|
|
159
|
+
if (abortController === controller)
|
|
160
|
+
abortController = null;
|
|
161
|
+
throw new Error("Message stream response has no body");
|
|
162
|
+
}
|
|
163
|
+
activity.value = "connected";
|
|
164
|
+
let resolveAccepted;
|
|
165
|
+
let rejectAccepted;
|
|
166
|
+
const acceptedPromise = new Promise((resolve, reject) => {
|
|
167
|
+
resolveAccepted = resolve;
|
|
168
|
+
rejectAccepted = reject;
|
|
169
|
+
});
|
|
170
|
+
let accepted = false;
|
|
171
|
+
let terminal = false;
|
|
172
|
+
void (async () => {
|
|
173
|
+
try {
|
|
174
|
+
const reader = response.body.getReader();
|
|
175
|
+
const decoder = new TextDecoder();
|
|
176
|
+
let buffered = "";
|
|
177
|
+
while (!controller.signal.aborted) {
|
|
178
|
+
const { value, done } = await reader.read();
|
|
179
|
+
if (done)
|
|
180
|
+
break;
|
|
181
|
+
if (controller.signal.aborted)
|
|
182
|
+
break;
|
|
183
|
+
buffered += decoder.decode(value, { stream: true });
|
|
184
|
+
const parsed = parseSseFrames(buffered);
|
|
185
|
+
buffered = parsed.rest;
|
|
186
|
+
for (const frame of parsed.frames) {
|
|
187
|
+
if (controller.signal.aborted)
|
|
188
|
+
break;
|
|
189
|
+
if (frame.data === "[DONE]")
|
|
190
|
+
continue;
|
|
191
|
+
if (frame.event === "message-accepted") {
|
|
192
|
+
try {
|
|
193
|
+
const messagePair = reviveMessagePair(JSON.parse(frame.data));
|
|
194
|
+
accepted = true;
|
|
195
|
+
onAccepted(messagePair);
|
|
196
|
+
resolveAccepted(messagePair);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
rejectAccepted(error);
|
|
199
|
+
}
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
let event;
|
|
203
|
+
try {
|
|
204
|
+
event = JSON.parse(frame.data);
|
|
205
|
+
} catch {
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (!isRecord(event) || typeof event.kind !== "string")
|
|
209
|
+
continue;
|
|
210
|
+
activity.value = "active";
|
|
211
|
+
if (event.kind === "result") {
|
|
212
|
+
terminal = true;
|
|
213
|
+
options.onResult?.();
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (event.kind === "error") {
|
|
217
|
+
if (event.recoverable !== true) {
|
|
218
|
+
terminal = true;
|
|
219
|
+
options.onResult?.();
|
|
220
|
+
}
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (event.kind === "status" && (event.status === "failed" || event.status === "cancelled")) {
|
|
224
|
+
terminal = true;
|
|
225
|
+
options.onResult?.();
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
if (event.kind !== "message-parts" || typeof event.runId !== "string" || typeof event.deltaSeq !== "number" || !Number.isInteger(event.deltaSeq) || event.deltaSeq < 0 || !isRecord(event.event)) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const accumulated = applyMessagePartsEvent(accumulator, event);
|
|
232
|
+
activeRunId.value = accumulator.runId;
|
|
233
|
+
if (accumulated.changed) {
|
|
234
|
+
streamingText.value = accumulated.text;
|
|
235
|
+
streamingThinking.value = accumulated.thinking;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (!accepted)
|
|
240
|
+
rejectAccepted(new Error("Message stream ended before acknowledgement"));
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (!accepted)
|
|
243
|
+
rejectAccepted(error);
|
|
244
|
+
} finally {
|
|
245
|
+
if (abortController === controller)
|
|
246
|
+
abortController = null;
|
|
247
|
+
if (accepted && !terminal && !controller.signal.aborted)
|
|
248
|
+
options.onDisconnect?.();
|
|
249
|
+
}
|
|
250
|
+
})();
|
|
251
|
+
return acceptedPromise;
|
|
252
|
+
}
|
|
253
|
+
onUnmounted(() => disconnect());
|
|
254
|
+
return {
|
|
255
|
+
activity: readonly(activity),
|
|
256
|
+
streamingText: readonly(streamingText),
|
|
257
|
+
streamingThinking: readonly(streamingThinking),
|
|
258
|
+
activeRunId: readonly(activeRunId),
|
|
259
|
+
connectMessage,
|
|
260
|
+
beginMessage,
|
|
261
|
+
disconnect
|
|
262
|
+
};
|
|
263
|
+
}
|
|
@@ -15,3 +15,10 @@ export type ToolGroup = {
|
|
|
15
15
|
toolResult?: ToolResult;
|
|
16
16
|
};
|
|
17
17
|
export type ReasoningStep = string | ToolGroup;
|
|
18
|
+
/**
|
|
19
|
+
* A turn that is still working towards its first output has no reasoning of its
|
|
20
|
+
* own yet, so the preparing steps stand in. That makes the wait read as an agent
|
|
21
|
+
* which has started working rather than as a loading placeholder. Any real
|
|
22
|
+
* reasoning wins immediately — the stand-ins never compete with it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveDisplayedReasoning(reasoningData: ReasoningStep[] | null | undefined, preparingSteps?: readonly string[] | null): ReasoningStep[];
|
|
@@ -213,6 +213,7 @@ export declare const conversationWithMessagesSchema: z.ZodObject<{
|
|
|
213
213
|
export type ConversationWithMessages = z.infer<typeof conversationWithMessagesSchema>;
|
|
214
214
|
export declare const createConversationRequestSchema: z.ZodObject<{
|
|
215
215
|
model: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
216
|
+
"claude-opus-5": "claude-opus-5";
|
|
216
217
|
"claude-opus-4-8": "claude-opus-4-8";
|
|
217
218
|
"claude-sonnet-5": "claude-sonnet-5";
|
|
218
219
|
"claude-haiku-4-5": "claude-haiku-4-5";
|
|
@@ -249,6 +250,7 @@ export type ConversationAgentInputsResponse = z.infer<typeof conversationAgentIn
|
|
|
249
250
|
export declare const updateConversationRequestSchema: z.ZodObject<{
|
|
250
251
|
title: z.ZodOptional<z.ZodString>;
|
|
251
252
|
model: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
253
|
+
"claude-opus-5": "claude-opus-5";
|
|
252
254
|
"claude-opus-4-8": "claude-opus-4-8";
|
|
253
255
|
"claude-sonnet-5": "claude-sonnet-5";
|
|
254
256
|
"claude-haiku-4-5": "claude-haiku-4-5";
|
|
@@ -30,6 +30,26 @@ export declare const messageOverviewResponseSchema: z.ZodObject<{
|
|
|
30
30
|
}, z.core.$strict>>;
|
|
31
31
|
}, z.core.$strict>;
|
|
32
32
|
export type MessageOverviewResponse = z.infer<typeof messageOverviewResponseSchema>;
|
|
33
|
+
/**
|
|
34
|
+
* What the send looked like from the client's side, so first-token latency can
|
|
35
|
+
* be reported against what the user actually saw. Durations only, never
|
|
36
|
+
* timestamps — the browser's clock never has to agree with the server's.
|
|
37
|
+
*/
|
|
38
|
+
export declare const sendMessageClientTimingSchema: z.ZodObject<{
|
|
39
|
+
/**
|
|
40
|
+
* Elapsed from the user's send to this request. Non-zero whenever the client
|
|
41
|
+
* gate held the send behind conversation creation, a model change or a
|
|
42
|
+
* sandbox wake.
|
|
43
|
+
*/
|
|
44
|
+
sinceSendMs: z.ZodNumber;
|
|
45
|
+
/**
|
|
46
|
+
* When the client's stand-in step lands, measured from the same send. A run
|
|
47
|
+
* that produces nothing before then has already shown the user an answer
|
|
48
|
+
* starting, whatever the run's own latency turns out to be.
|
|
49
|
+
*/
|
|
50
|
+
standInOutputAtMs: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
export type SendMessageClientTiming = z.infer<typeof sendMessageClientTimingSchema>;
|
|
33
53
|
export declare const sendMessageBodySchema: z.ZodObject<{
|
|
34
54
|
content: z.ZodString;
|
|
35
55
|
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -50,6 +70,21 @@ export declare const sendMessageBodySchema: z.ZodObject<{
|
|
|
50
70
|
name: z.ZodString;
|
|
51
71
|
content: z.ZodString;
|
|
52
72
|
}, z.core.$strip>], "type">>>;
|
|
73
|
+
wakeSessionId: z.ZodOptional<z.ZodString>;
|
|
74
|
+
clientTiming: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
/**
|
|
76
|
+
* Elapsed from the user's send to this request. Non-zero whenever the client
|
|
77
|
+
* gate held the send behind conversation creation, a model change or a
|
|
78
|
+
* sandbox wake.
|
|
79
|
+
*/
|
|
80
|
+
sinceSendMs: z.ZodNumber;
|
|
81
|
+
/**
|
|
82
|
+
* When the client's stand-in step lands, measured from the same send. A run
|
|
83
|
+
* that produces nothing before then has already shown the user an answer
|
|
84
|
+
* starting, whatever the run's own latency turns out to be.
|
|
85
|
+
*/
|
|
86
|
+
standInOutputAtMs: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
}, z.core.$strict>>;
|
|
53
88
|
}, z.core.$strict>;
|
|
54
89
|
export type SendMessageBody = z.infer<typeof sendMessageBodySchema>;
|
|
55
90
|
export declare const sendMessageResponseSchema: z.ZodObject<{
|
|
@@ -165,6 +200,10 @@ export declare const messagePollResponseSchema: z.ZodObject<{
|
|
|
165
200
|
}, z.core.$strip>>>;
|
|
166
201
|
}, z.core.$strip>;
|
|
167
202
|
export type MessagePollResponse = z.infer<typeof messagePollResponseSchema>;
|
|
203
|
+
export declare const retryMessageBodySchema: z.ZodObject<{
|
|
204
|
+
wakeSessionId: z.ZodOptional<z.ZodString>;
|
|
205
|
+
}, z.core.$strict>;
|
|
206
|
+
export type RetryMessageBody = z.infer<typeof retryMessageBodySchema>;
|
|
168
207
|
export declare const cancelConversationResponseSchema: z.ZodObject<{
|
|
169
208
|
success: z.ZodLiteral<true>;
|
|
170
209
|
cancelled: z.ZodBoolean;
|
|
@@ -26,10 +26,31 @@ export const messageOverviewResponseSchema = z.strictObject({
|
|
|
26
26
|
createdAt: z.date(),
|
|
27
27
|
}).nullable(),
|
|
28
28
|
});
|
|
29
|
+
/**
|
|
30
|
+
* What the send looked like from the client's side, so first-token latency can
|
|
31
|
+
* be reported against what the user actually saw. Durations only, never
|
|
32
|
+
* timestamps — the browser's clock never has to agree with the server's.
|
|
33
|
+
*/
|
|
34
|
+
export const sendMessageClientTimingSchema = z.strictObject({
|
|
35
|
+
/**
|
|
36
|
+
* Elapsed from the user's send to this request. Non-zero whenever the client
|
|
37
|
+
* gate held the send behind conversation creation, a model change or a
|
|
38
|
+
* sandbox wake.
|
|
39
|
+
*/
|
|
40
|
+
sinceSendMs: z.number().int().min(0).max(600_000),
|
|
41
|
+
/**
|
|
42
|
+
* When the client's stand-in step lands, measured from the same send. A run
|
|
43
|
+
* that produces nothing before then has already shown the user an answer
|
|
44
|
+
* starting, whatever the run's own latency turns out to be.
|
|
45
|
+
*/
|
|
46
|
+
standInOutputAtMs: z.number().int().min(0).max(600_000).optional(),
|
|
47
|
+
});
|
|
29
48
|
export const sendMessageBodySchema = z.strictObject({
|
|
30
49
|
content: z.string(),
|
|
31
50
|
files: z.array(fileUploadInputSchema).optional(),
|
|
32
51
|
agentInputs: z.array(telaAgentExecutionInputSchema).optional(),
|
|
52
|
+
wakeSessionId: z.string().uuid().optional(),
|
|
53
|
+
clientTiming: sendMessageClientTimingSchema.optional(),
|
|
33
54
|
});
|
|
34
55
|
export const sendMessageResponseSchema = z.object({
|
|
35
56
|
userMessage: messageSchema,
|
|
@@ -39,6 +60,9 @@ export const messagePollResponseSchema = z.object({
|
|
|
39
60
|
messages: z.array(messageSchema),
|
|
40
61
|
newFiles: z.array(messageFileSchema).optional(),
|
|
41
62
|
});
|
|
63
|
+
export const retryMessageBodySchema = z.strictObject({
|
|
64
|
+
wakeSessionId: z.string().uuid().optional(),
|
|
65
|
+
});
|
|
42
66
|
export const cancelConversationResponseSchema = z.object({
|
|
43
67
|
success: z.literal(true),
|
|
44
68
|
cancelled: z.boolean(),
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const chatModelIds: readonly ["claude-opus-4-8", "claude-sonnet-5", "claude-haiku-4-5"];
|
|
2
|
+
export declare const chatModelIds: readonly ["claude-opus-5", "claude-opus-4-8", "claude-sonnet-5", "claude-haiku-4-5"];
|
|
3
3
|
export declare const chatModelSchema: z.ZodEnum<{
|
|
4
|
+
"claude-opus-5": "claude-opus-5";
|
|
4
5
|
"claude-opus-4-8": "claude-opus-4-8";
|
|
5
6
|
"claude-sonnet-5": "claude-sonnet-5";
|
|
6
7
|
"claude-haiku-4-5": "claude-haiku-4-5";
|
|
7
8
|
}>;
|
|
8
9
|
export type ChatModel = z.infer<typeof chatModelSchema>;
|
|
9
|
-
export declare const defaultChatModel = "claude-opus-
|
|
10
|
+
export declare const defaultChatModel = "claude-opus-5";
|
|
10
11
|
export declare function isValidChatModel(value: unknown): value is ChatModel;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export const chatModelIds = [
|
|
3
|
+
'claude-opus-5',
|
|
3
4
|
'claude-opus-4-8',
|
|
4
5
|
'claude-sonnet-5',
|
|
5
6
|
'claude-haiku-4-5',
|
|
6
7
|
];
|
|
7
8
|
export const chatModelSchema = z.enum(chatModelIds);
|
|
8
|
-
export const defaultChatModel = 'claude-opus-
|
|
9
|
+
export const defaultChatModel = 'claude-opus-5';
|
|
9
10
|
export function isValidChatModel(value) {
|
|
10
11
|
return typeof value === 'string' && chatModelIds.includes(value);
|
|
11
12
|
}
|
|
@@ -20,6 +20,16 @@ export type ChatModelOption = {
|
|
|
20
20
|
tabs: readonly string[];
|
|
21
21
|
};
|
|
22
22
|
export declare const chatModelOptions: readonly [{
|
|
23
|
+
readonly value: "claude-opus-5";
|
|
24
|
+
readonly label: "Claude Opus 5";
|
|
25
|
+
readonly description: "Agente de ponta para trabalho complexo";
|
|
26
|
+
readonly provider: "Anthropic";
|
|
27
|
+
readonly cost: 5;
|
|
28
|
+
readonly maxInputTokens: 1000000;
|
|
29
|
+
readonly maxOutputTokens: 128000;
|
|
30
|
+
readonly isMultiModal: true;
|
|
31
|
+
readonly tabs: readonly ["all", "advanced", "multimodal"];
|
|
32
|
+
}, {
|
|
23
33
|
readonly value: "claude-opus-4-8";
|
|
24
34
|
readonly label: "Claude 4.8 Opus";
|
|
25
35
|
readonly description: "Agente de ponta para tarefas complexas";
|
|
@@ -6,6 +6,7 @@ export const conversationCreatorFilterOptions = [
|
|
|
6
6
|
// Metadata follows the agent model catalog on the Tela platform
|
|
7
7
|
// (packages/application/composables/model.ts), curated to the models this app offers.
|
|
8
8
|
export const chatModelOptions = [
|
|
9
|
+
{ value: 'claude-opus-5', label: 'Claude Opus 5', description: 'Agente de ponta para trabalho complexo', provider: 'Anthropic', cost: 5, maxInputTokens: 1_000_000, maxOutputTokens: 128_000, isMultiModal: true, tabs: ['all', 'advanced', 'multimodal'] },
|
|
9
10
|
{ value: 'claude-opus-4-8', label: 'Claude 4.8 Opus', description: 'Agente de ponta para tarefas complexas', provider: 'Anthropic', cost: 4, maxInputTokens: 1_000_000, maxOutputTokens: 128_000, isMultiModal: true, tabs: ['all', 'advanced', 'multimodal'] },
|
|
10
11
|
{ value: 'claude-sonnet-5', label: 'Claude Sonnet 5', description: 'Agente rápido e inteligente de nova geração', provider: 'Anthropic', cost: 4, maxInputTokens: 1_000_000, maxOutputTokens: 64_000, isMultiModal: true, tabs: ['all', 'advanced', 'multimodal'] },
|
|
11
12
|
{ value: 'claude-haiku-4-5', label: 'Claude 4.5 Haiku', description: 'Agente rápido e eficiente para tarefas simples', provider: 'Anthropic', cost: 3, maxInputTokens: 200_000, maxOutputTokens: 64_000, isMultiModal: true, tabs: ['all', 'cheap', 'multimodal'] },
|
|
@@ -71,6 +71,7 @@ export declare const telaAgentContextFileSchema: z.ZodObject<{
|
|
|
71
71
|
export type TelaAgentContextFile = z.infer<typeof telaAgentContextFileSchema>;
|
|
72
72
|
export declare const telaAgentSchema: z.ZodObject<{
|
|
73
73
|
id: z.ZodString;
|
|
74
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
74
75
|
organizationName: z.ZodOptional<z.ZodString>;
|
|
75
76
|
repository: z.ZodOptional<z.ZodString>;
|
|
76
77
|
publishedId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -185,6 +186,13 @@ export declare const telaAgentSessionResultSchema: z.ZodObject<{
|
|
|
185
186
|
structuredContent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
186
187
|
childEventIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
188
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
189
|
+
export declare const telaAgentDirectStreamSchema: z.ZodObject<{
|
|
190
|
+
url: z.ZodString;
|
|
191
|
+
token: z.ZodString;
|
|
192
|
+
expiresAt: z.ZodNumber;
|
|
193
|
+
runId: z.ZodString;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
export type TelaAgentDirectStream = z.infer<typeof telaAgentDirectStreamSchema>;
|
|
188
196
|
export declare const telaAgentSessionSchema: z.ZodObject<{
|
|
189
197
|
sessionId: z.ZodString;
|
|
190
198
|
status: z.ZodEnum<{
|
|
@@ -205,6 +213,12 @@ export declare const telaAgentSessionSchema: z.ZodObject<{
|
|
|
205
213
|
calculatedCostUsd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
206
214
|
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
207
215
|
nextCursor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
216
|
+
directStream: z.ZodOptional<z.ZodObject<{
|
|
217
|
+
url: z.ZodString;
|
|
218
|
+
token: z.ZodString;
|
|
219
|
+
expiresAt: z.ZodNumber;
|
|
220
|
+
runId: z.ZodString;
|
|
221
|
+
}, z.core.$strip>>;
|
|
208
222
|
result: z.ZodOptional<z.ZodObject<{
|
|
209
223
|
usage: z.ZodOptional<z.ZodObject<{
|
|
210
224
|
duration: z.ZodOptional<z.ZodNumber>;
|
|
@@ -226,6 +240,25 @@ export declare const telaAgentSessionSchema: z.ZodObject<{
|
|
|
226
240
|
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
227
241
|
}, z.core.$catchall<z.ZodUnknown>>;
|
|
228
242
|
export type TelaAgentSession = z.infer<typeof telaAgentSessionSchema>;
|
|
243
|
+
export declare const telaAgentWakeRequestSchema: z.ZodObject<{
|
|
244
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
245
|
+
model: z.ZodOptional<z.ZodEnum<{
|
|
246
|
+
"claude-opus-5": "claude-opus-5";
|
|
247
|
+
"claude-opus-4-8": "claude-opus-4-8";
|
|
248
|
+
"claude-sonnet-5": "claude-sonnet-5";
|
|
249
|
+
"claude-haiku-4-5": "claude-haiku-4-5";
|
|
250
|
+
}>>;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
export type TelaAgentWakeRequest = z.infer<typeof telaAgentWakeRequestSchema>;
|
|
253
|
+
export declare const telaAgentWakeResponseSchema: z.ZodObject<{
|
|
254
|
+
status: z.ZodEnum<{
|
|
255
|
+
waking: "waking";
|
|
256
|
+
ready: "ready";
|
|
257
|
+
unavailable: "unavailable";
|
|
258
|
+
}>;
|
|
259
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
260
|
+
}, z.core.$strip>;
|
|
261
|
+
export type TelaAgentWakeResponse = z.infer<typeof telaAgentWakeResponseSchema>;
|
|
229
262
|
export declare const telaAgentV4SessionStatusEventSchema: z.ZodObject<{
|
|
230
263
|
kind: z.ZodLiteral<"status">;
|
|
231
264
|
sessionId: z.ZodString;
|
|
@@ -370,6 +403,7 @@ export declare const telaAgentRunApiResponseSchema: z.ZodObject<{
|
|
|
370
403
|
export declare const telaAgentApiResponseSchema: z.ZodObject<{
|
|
371
404
|
data: z.ZodObject<{
|
|
372
405
|
id: z.ZodString;
|
|
406
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
373
407
|
organizationName: z.ZodOptional<z.ZodString>;
|
|
374
408
|
repository: z.ZodOptional<z.ZodString>;
|
|
375
409
|
publishedId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -413,6 +447,7 @@ export declare const telaAgentApiResponseSchema: z.ZodObject<{
|
|
|
413
447
|
export declare const telaAgentResolveApiResponseSchema: z.ZodObject<{
|
|
414
448
|
agent: z.ZodObject<{
|
|
415
449
|
id: z.ZodString;
|
|
450
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
416
451
|
organizationName: z.ZodOptional<z.ZodString>;
|
|
417
452
|
repository: z.ZodOptional<z.ZodString>;
|
|
418
453
|
publishedId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { chatModelSchema } from '../chat/models';
|
|
2
3
|
export const telaAgentAttachmentSchema = z.object({
|
|
3
4
|
vaultRef: z.string().startsWith('vault://'),
|
|
4
5
|
filename: z.string().min(1).max(255),
|
|
@@ -43,6 +44,7 @@ export const telaAgentContextFileSchema = z.object({
|
|
|
43
44
|
});
|
|
44
45
|
export const telaAgentSchema = z.object({
|
|
45
46
|
id: z.string(),
|
|
47
|
+
projectId: z.string().optional(),
|
|
46
48
|
organizationName: z.string().optional(),
|
|
47
49
|
repository: z.string().optional(),
|
|
48
50
|
publishedId: z.string().nullable().optional(),
|
|
@@ -99,16 +101,31 @@ export const telaAgentSessionResultSchema = z.object({
|
|
|
99
101
|
structuredContent: z.record(z.string(), z.unknown()).optional(),
|
|
100
102
|
childEventIds: z.array(z.string()).optional(),
|
|
101
103
|
}).catchall(z.unknown());
|
|
104
|
+
export const telaAgentDirectStreamSchema = z.object({
|
|
105
|
+
url: z.string().url(),
|
|
106
|
+
token: z.string().min(1),
|
|
107
|
+
expiresAt: z.number(),
|
|
108
|
+
runId: z.string().min(1),
|
|
109
|
+
});
|
|
102
110
|
export const telaAgentSessionSchema = z.object({
|
|
103
111
|
sessionId: z.string(),
|
|
104
112
|
status: telaAgentSessionStatusSchema,
|
|
105
113
|
steps: z.array(telaAgentStepSchema),
|
|
106
114
|
nextCursor: z.number().nullable().optional(),
|
|
115
|
+
directStream: telaAgentDirectStreamSchema.optional(),
|
|
107
116
|
result: telaAgentSessionResultSchema.optional(),
|
|
108
117
|
error: z.string().optional(),
|
|
109
118
|
createdAt: z.number().optional(),
|
|
110
119
|
updatedAt: z.number().optional(),
|
|
111
120
|
}).catchall(z.unknown());
|
|
121
|
+
export const telaAgentWakeRequestSchema = z.object({
|
|
122
|
+
sessionId: z.string().uuid().optional(),
|
|
123
|
+
model: chatModelSchema.optional(),
|
|
124
|
+
});
|
|
125
|
+
export const telaAgentWakeResponseSchema = z.object({
|
|
126
|
+
status: z.enum(['waking', 'ready', 'unavailable']),
|
|
127
|
+
sessionId: z.string().optional(),
|
|
128
|
+
});
|
|
112
129
|
export const telaAgentV4SessionStatusEventSchema = z.object({
|
|
113
130
|
kind: z.literal('status'),
|
|
114
131
|
sessionId: z.string(),
|