@archastro/sdk 0.5.3 → 0.7.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.
- package/README.md +25 -0
- package/dist/app-session.d.ts +66 -0
- package/dist/app-session.d.ts.map +1 -0
- package/dist/app-session.js +158 -0
- package/dist/app-session.js.map +1 -0
- package/dist/channels/api_chat_channel.d.ts +4 -0
- package/dist/channels/api_chat_channel.d.ts.map +1 -1
- package/dist/channels/api_chat_channel.js +9 -1
- package/dist/channels/api_chat_channel.js.map +1 -1
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.native.d.ts +14 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/index.native.js +14 -0
- package/dist/index.native.js.map +1 -0
- package/dist/passwordless.d.ts +49 -0
- package/dist/passwordless.d.ts.map +1 -0
- package/dist/passwordless.js +70 -0
- package/dist/passwordless.js.map +1 -0
- package/dist/phx_channel/socket.d.ts.map +1 -1
- package/dist/phx_channel/socket.js +10 -22
- package/dist/phx_channel/socket.js.map +1 -1
- package/dist/phx_channel/websocket.d.ts +19 -0
- package/dist/phx_channel/websocket.d.ts.map +1 -0
- package/dist/phx_channel/websocket.js +28 -0
- package/dist/phx_channel/websocket.js.map +1 -0
- package/dist/phx_channel/websocket.native.d.ts +17 -0
- package/dist/phx_channel/websocket.native.d.ts.map +1 -0
- package/dist/phx_channel/websocket.native.js +16 -0
- package/dist/phx_channel/websocket.native.js.map +1 -0
- package/dist/platform-socket.d.ts +20 -0
- package/dist/platform-socket.d.ts.map +1 -0
- package/dist/platform-socket.js +25 -0
- package/dist/platform-socket.js.map +1 -0
- package/dist/runtime/http-client.d.ts +17 -0
- package/dist/runtime/http-client.d.ts.map +1 -1
- package/dist/runtime/http-client.js +123 -4
- package/dist/runtime/http-client.js.map +1 -1
- package/dist/runtime/url.d.ts +15 -0
- package/dist/runtime/url.d.ts.map +1 -0
- package/dist/runtime/url.js +34 -0
- package/dist/runtime/url.js.map +1 -0
- package/dist/types/ai.d.ts +271 -2
- package/dist/types/ai.d.ts.map +1 -1
- package/dist/types/ai.js +51 -1
- package/dist/types/ai.js.map +1 -1
- package/dist/types/chat.d.ts +142 -0
- package/dist/types/chat.d.ts.map +1 -1
- package/dist/types/common.d.ts +88 -27
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +12 -6
- package/dist/types/common.js.map +1 -1
- package/dist/types/config.d.ts +6 -6
- package/dist/types/teams.d.ts +12 -0
- package/dist/types/teams.d.ts.map +1 -1
- package/dist/types/threads.d.ts +10 -0
- package/dist/types/threads.d.ts.map +1 -1
- package/dist/v1/resources/activity_feed.d.ts +1 -0
- package/dist/v1/resources/activity_feed.d.ts.map +1 -1
- package/dist/v1/resources/activity_feed.js +1 -1
- package/dist/v1/resources/agents.d.ts +3 -1
- package/dist/v1/resources/agents.d.ts.map +1 -1
- package/dist/v1/resources/agents.js +3 -2
- package/dist/v1/resources/agents.js.map +1 -1
- package/dist/v1/resources/ai.d.ts +81 -3
- package/dist/v1/resources/ai.d.ts.map +1 -1
- package/dist/v1/resources/ai.js +26 -3
- package/dist/v1/resources/ai.js.map +1 -1
- package/dist/v1/resources/config.d.ts +8 -0
- package/dist/v1/resources/config.d.ts.map +1 -1
- package/dist/v1/resources/config.js +5 -1
- package/dist/v1/resources/config.js.map +1 -1
- package/dist/v1/resources/solutions.d.ts +11 -7
- package/dist/v1/resources/solutions.d.ts.map +1 -1
- package/dist/v1/resources/solutions.js +12 -8
- package/dist/v1/resources/solutions.js.map +1 -1
- package/dist/v1/resources/teams.d.ts +3 -0
- package/dist/v1/resources/teams.d.ts.map +1 -1
- package/dist/v1/resources/teams.js +1 -1
- package/dist/v1/resources/threads.d.ts +24 -4
- package/dist/v1/resources/threads.d.ts.map +1 -1
- package/dist/v1/resources/threads.js +37 -5
- package/dist/v1/resources/threads.js.map +1 -1
- package/dist/v1/resources/users.d.ts +2 -0
- package/dist/v1/resources/users.d.ts.map +1 -1
- package/dist/v1/resources/users.js +1 -1
- package/docs/authentication.md +91 -0
- package/docs/react-native.md +118 -0
- package/docs/scenarios.md +57 -0
- package/package.json +28 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/runtime/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAClD,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC;IAClE,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IACxE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,yBAAyB,UAAU,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,GAAG,MAAM,MAAM,IAAI,uBAAuB,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAW,EACX,MAA8B;IAE9B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,KAAK,CAAC,IAAI,CACR,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAC1D,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IACnC,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC;AAC7D,CAAC"}
|
package/dist/types/ai.d.ts
CHANGED
|
@@ -1,4 +1,50 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** Terminal event marking the end of a streaming chat completion (SSE `done` event). */
|
|
3
|
+
export interface AIChatStreamDone {
|
|
4
|
+
/** The overall finish reason for the completion. */
|
|
5
|
+
finish_reason?: string | undefined;
|
|
6
|
+
/** Number of model runs executed, including continuations triggered by tool calls. */
|
|
7
|
+
run_count?: number | undefined;
|
|
8
|
+
/** Aggregate token usage across every run in the completion (including tool-call continuations), keyed by model ID. */
|
|
9
|
+
total_usage?: Record<string, unknown> | undefined;
|
|
10
|
+
/** Token usage for the final run, keyed by model ID. */
|
|
11
|
+
usage?: Record<string, unknown> | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** Runtime validator for {@link AIChatStreamDone}. */
|
|
14
|
+
export declare const aIChatStreamDoneSchema: z.ZodObject<{
|
|
15
|
+
/** The overall finish reason for the completion. */
|
|
16
|
+
finish_reason: z.ZodOptional<z.ZodString>;
|
|
17
|
+
/** Number of model runs executed, including continuations triggered by tool calls. */
|
|
18
|
+
run_count: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
/** Aggregate token usage across every run in the completion (including tool-call continuations), keyed by model ID. */
|
|
20
|
+
total_usage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
21
|
+
/** Token usage for the final run, keyed by model ID. */
|
|
22
|
+
usage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
run_count?: number | undefined;
|
|
25
|
+
finish_reason?: string | undefined;
|
|
26
|
+
total_usage?: Record<string, unknown> | undefined;
|
|
27
|
+
usage?: Record<string, unknown> | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
run_count?: number | undefined;
|
|
30
|
+
finish_reason?: string | undefined;
|
|
31
|
+
total_usage?: Record<string, unknown> | undefined;
|
|
32
|
+
usage?: Record<string, unknown> | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
/** Terminal error event for a streaming chat completion (SSE `error` event). */
|
|
35
|
+
export interface AIChatStreamError {
|
|
36
|
+
/** Human-readable description of the error that terminated the stream. */
|
|
37
|
+
message: string;
|
|
38
|
+
}
|
|
39
|
+
/** Runtime validator for {@link AIChatStreamError}. */
|
|
40
|
+
export declare const aIChatStreamErrorSchema: z.ZodObject<{
|
|
41
|
+
/** Human-readable description of the error that terminated the stream. */
|
|
42
|
+
message: z.ZodString;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
message: string;
|
|
45
|
+
}, {
|
|
46
|
+
message: string;
|
|
47
|
+
}>;
|
|
2
48
|
/** A tool (function) call emitted by the assistant within an AI message. Mirrors the OpenAI tool-call object format. */
|
|
3
49
|
export interface AIToolCall {
|
|
4
50
|
/** Arguments the model wants to pass to the tool, as a key-value map. Deserialize and validate these against the tool's input schema before executing. */
|
|
@@ -171,6 +217,229 @@ export declare const aIMessageSchema: z.ZodObject<{
|
|
|
171
217
|
resolution?: unknown;
|
|
172
218
|
}[] | undefined;
|
|
173
219
|
}>;
|
|
220
|
+
/** The fully assembled assistant message for one run of a streaming chat completion (SSE `message_complete` event). */
|
|
221
|
+
export interface AIChatStreamMessageComplete {
|
|
222
|
+
/** Why the model stopped generating this message, e.g. `"stop"`, `"length"`, or `"tool_calls"`. */
|
|
223
|
+
finish_reason?: string | undefined;
|
|
224
|
+
/** The complete assistant message for this run, assembled from the preceding deltas. */
|
|
225
|
+
message: AIMessage;
|
|
226
|
+
/** Token consumption for this run, keyed by model ID. `null` when usage data is unavailable. */
|
|
227
|
+
usage?: Record<string, unknown> | undefined;
|
|
228
|
+
}
|
|
229
|
+
/** Runtime validator for {@link AIChatStreamMessageComplete}. */
|
|
230
|
+
export declare const aIChatStreamMessageCompleteSchema: z.ZodObject<{
|
|
231
|
+
/** Why the model stopped generating this message, e.g. `"stop"`, `"length"`, or `"tool_calls"`. */
|
|
232
|
+
finish_reason: z.ZodOptional<z.ZodString>;
|
|
233
|
+
/** The complete assistant message for this run, assembled from the preceding deltas. */
|
|
234
|
+
message: z.ZodObject<{
|
|
235
|
+
/** Plain-text content of the message. Present for `system`, `user`, and `assistant` messages. `null` when the message body is expressed through `content_parts` or `tool_calls`. */
|
|
236
|
+
content: z.ZodOptional<z.ZodString>;
|
|
237
|
+
/** Multimodal content parts for the message, used when the body includes images or mixed media. Each part is a map with a `type` key (`"text"`, `"image_url"`, or `"image_data"`). `null` when `content` is set. */
|
|
238
|
+
content_parts: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
239
|
+
/** Opaque token that can be passed on a subsequent request to resume this conversation from the current state. `null` when the provider does not support conversation resumption. */
|
|
240
|
+
resume_token: z.ZodOptional<z.ZodString>;
|
|
241
|
+
/** The speaker role for this message. One of `"system"`, `"user"`, `"assistant"`, or `"tool"`. */
|
|
242
|
+
role: z.ZodString;
|
|
243
|
+
/** Parsed structured data returned by the model when a JSON schema or structured-output mode was requested. Shape varies by the schema supplied at call time. `null` when structured output was not requested. */
|
|
244
|
+
structured_output: z.ZodOptional<z.ZodUnknown>;
|
|
245
|
+
/** Tool calls requested by the model in an `assistant` message. Present only on assistant messages that invoke one or more tools. `null` on all other message roles. */
|
|
246
|
+
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
247
|
+
/** Arguments the model wants to pass to the tool, as a key-value map. Deserialize and validate these against the tool's input schema before executing. */
|
|
248
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
249
|
+
/** Unique identifier for this tool call, assigned by the model. Use this value as `id` when submitting the corresponding tool result. */
|
|
250
|
+
id: z.ZodString;
|
|
251
|
+
/** Name of the tool or function the model wants to invoke, e.g. `"web_search"` or `"run_code"`. */
|
|
252
|
+
name: z.ZodString;
|
|
253
|
+
/** Opaque signature representing the model's internal reasoning that led to this tool call. `null` when the provider does not expose chain-of-thought data. */
|
|
254
|
+
thought_signature: z.ZodOptional<z.ZodString>;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
id: string;
|
|
257
|
+
name: string;
|
|
258
|
+
arguments: Record<string, unknown>;
|
|
259
|
+
thought_signature?: string | undefined;
|
|
260
|
+
}, {
|
|
261
|
+
id: string;
|
|
262
|
+
name: string;
|
|
263
|
+
arguments: Record<string, unknown>;
|
|
264
|
+
thought_signature?: string | undefined;
|
|
265
|
+
}>, "many">>;
|
|
266
|
+
/** Tool execution results provided in a `tool` message. Each entry corresponds to a prior tool call by its `id`. `null` on all other message roles. */
|
|
267
|
+
tool_results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
268
|
+
/** Plain-text output produced by the tool execution. `null` when the result is expressed entirely through `resolution`. */
|
|
269
|
+
content: z.ZodOptional<z.ZodString>;
|
|
270
|
+
/** ID of the tool call this result satisfies. Must match the `id` from the corresponding `AIToolCall`. */
|
|
271
|
+
id: z.ZodString;
|
|
272
|
+
/** Name of the tool or function that was executed, e.g. `"web_search"`. Must match the `name` from the corresponding `AIToolCall`. */
|
|
273
|
+
name: z.ZodString;
|
|
274
|
+
/** Structured result data from the tool execution. Shape varies by tool. `null` when the result is expressed as plain text in `content`. */
|
|
275
|
+
resolution: z.ZodOptional<z.ZodUnknown>;
|
|
276
|
+
}, "strip", z.ZodTypeAny, {
|
|
277
|
+
id: string;
|
|
278
|
+
name: string;
|
|
279
|
+
content?: string | undefined;
|
|
280
|
+
resolution?: unknown;
|
|
281
|
+
}, {
|
|
282
|
+
id: string;
|
|
283
|
+
name: string;
|
|
284
|
+
content?: string | undefined;
|
|
285
|
+
resolution?: unknown;
|
|
286
|
+
}>, "many">>;
|
|
287
|
+
}, "strip", z.ZodTypeAny, {
|
|
288
|
+
role: string;
|
|
289
|
+
content?: string | undefined;
|
|
290
|
+
content_parts?: Record<string, unknown>[] | undefined;
|
|
291
|
+
resume_token?: string | undefined;
|
|
292
|
+
structured_output?: unknown;
|
|
293
|
+
tool_calls?: {
|
|
294
|
+
id: string;
|
|
295
|
+
name: string;
|
|
296
|
+
arguments: Record<string, unknown>;
|
|
297
|
+
thought_signature?: string | undefined;
|
|
298
|
+
}[] | undefined;
|
|
299
|
+
tool_results?: {
|
|
300
|
+
id: string;
|
|
301
|
+
name: string;
|
|
302
|
+
content?: string | undefined;
|
|
303
|
+
resolution?: unknown;
|
|
304
|
+
}[] | undefined;
|
|
305
|
+
}, {
|
|
306
|
+
role: string;
|
|
307
|
+
content?: string | undefined;
|
|
308
|
+
content_parts?: Record<string, unknown>[] | undefined;
|
|
309
|
+
resume_token?: string | undefined;
|
|
310
|
+
structured_output?: unknown;
|
|
311
|
+
tool_calls?: {
|
|
312
|
+
id: string;
|
|
313
|
+
name: string;
|
|
314
|
+
arguments: Record<string, unknown>;
|
|
315
|
+
thought_signature?: string | undefined;
|
|
316
|
+
}[] | undefined;
|
|
317
|
+
tool_results?: {
|
|
318
|
+
id: string;
|
|
319
|
+
name: string;
|
|
320
|
+
content?: string | undefined;
|
|
321
|
+
resolution?: unknown;
|
|
322
|
+
}[] | undefined;
|
|
323
|
+
}>;
|
|
324
|
+
/** Token consumption for this run, keyed by model ID. `null` when usage data is unavailable. */
|
|
325
|
+
usage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
326
|
+
}, "strip", z.ZodTypeAny, {
|
|
327
|
+
message: {
|
|
328
|
+
role: string;
|
|
329
|
+
content?: string | undefined;
|
|
330
|
+
content_parts?: Record<string, unknown>[] | undefined;
|
|
331
|
+
resume_token?: string | undefined;
|
|
332
|
+
structured_output?: unknown;
|
|
333
|
+
tool_calls?: {
|
|
334
|
+
id: string;
|
|
335
|
+
name: string;
|
|
336
|
+
arguments: Record<string, unknown>;
|
|
337
|
+
thought_signature?: string | undefined;
|
|
338
|
+
}[] | undefined;
|
|
339
|
+
tool_results?: {
|
|
340
|
+
id: string;
|
|
341
|
+
name: string;
|
|
342
|
+
content?: string | undefined;
|
|
343
|
+
resolution?: unknown;
|
|
344
|
+
}[] | undefined;
|
|
345
|
+
};
|
|
346
|
+
finish_reason?: string | undefined;
|
|
347
|
+
usage?: Record<string, unknown> | undefined;
|
|
348
|
+
}, {
|
|
349
|
+
message: {
|
|
350
|
+
role: string;
|
|
351
|
+
content?: string | undefined;
|
|
352
|
+
content_parts?: Record<string, unknown>[] | undefined;
|
|
353
|
+
resume_token?: string | undefined;
|
|
354
|
+
structured_output?: unknown;
|
|
355
|
+
tool_calls?: {
|
|
356
|
+
id: string;
|
|
357
|
+
name: string;
|
|
358
|
+
arguments: Record<string, unknown>;
|
|
359
|
+
thought_signature?: string | undefined;
|
|
360
|
+
}[] | undefined;
|
|
361
|
+
tool_results?: {
|
|
362
|
+
id: string;
|
|
363
|
+
name: string;
|
|
364
|
+
content?: string | undefined;
|
|
365
|
+
resolution?: unknown;
|
|
366
|
+
}[] | undefined;
|
|
367
|
+
};
|
|
368
|
+
finish_reason?: string | undefined;
|
|
369
|
+
usage?: Record<string, unknown> | undefined;
|
|
370
|
+
}>;
|
|
371
|
+
/** Incremental assistant text emitted during a streaming chat completion (SSE `message_delta` event). */
|
|
372
|
+
export interface AIChatStreamMessageDelta {
|
|
373
|
+
/** The chunk of assistant text produced since the previous `message_delta` event. Concatenate deltas in order to reconstruct the message. */
|
|
374
|
+
delta: string;
|
|
375
|
+
}
|
|
376
|
+
/** Runtime validator for {@link AIChatStreamMessageDelta}. */
|
|
377
|
+
export declare const aIChatStreamMessageDeltaSchema: z.ZodObject<{
|
|
378
|
+
/** The chunk of assistant text produced since the previous `message_delta` event. Concatenate deltas in order to reconstruct the message. */
|
|
379
|
+
delta: z.ZodString;
|
|
380
|
+
}, "strip", z.ZodTypeAny, {
|
|
381
|
+
delta: string;
|
|
382
|
+
}, {
|
|
383
|
+
delta: string;
|
|
384
|
+
}>;
|
|
385
|
+
/** Incremental tool-call data emitted as the model assembles a tool invocation (SSE `tool_call_delta` event). */
|
|
386
|
+
export interface AIChatStreamToolCallDelta {
|
|
387
|
+
/** A chunk of the tool call's serialized arguments. Concatenate deltas to reconstruct the arguments JSON. */
|
|
388
|
+
delta?: string | undefined;
|
|
389
|
+
/** Identifier of the tool call this delta belongs to, once the model has assigned one. */
|
|
390
|
+
id?: string | undefined;
|
|
391
|
+
/** Name of the tool being called, once known. */
|
|
392
|
+
name?: string | undefined;
|
|
393
|
+
}
|
|
394
|
+
/** Runtime validator for {@link AIChatStreamToolCallDelta}. */
|
|
395
|
+
export declare const aIChatStreamToolCallDeltaSchema: z.ZodObject<{
|
|
396
|
+
/** A chunk of the tool call's serialized arguments. Concatenate deltas to reconstruct the arguments JSON. */
|
|
397
|
+
delta: z.ZodOptional<z.ZodString>;
|
|
398
|
+
/** Identifier of the tool call this delta belongs to, once the model has assigned one. */
|
|
399
|
+
id: z.ZodOptional<z.ZodString>;
|
|
400
|
+
/** Name of the tool being called, once known. */
|
|
401
|
+
name: z.ZodOptional<z.ZodString>;
|
|
402
|
+
}, "strip", z.ZodTypeAny, {
|
|
403
|
+
id?: string | undefined;
|
|
404
|
+
name?: string | undefined;
|
|
405
|
+
delta?: string | undefined;
|
|
406
|
+
}, {
|
|
407
|
+
id?: string | undefined;
|
|
408
|
+
name?: string | undefined;
|
|
409
|
+
delta?: string | undefined;
|
|
410
|
+
}>;
|
|
411
|
+
/** The result of a server-executed tool, streamed back into the run (SSE `tool_result` event). */
|
|
412
|
+
export interface AIChatStreamToolResult {
|
|
413
|
+
/** The tool's output, serialized as a string. */
|
|
414
|
+
content?: string | undefined;
|
|
415
|
+
/** ID of the tool call this result satisfies. */
|
|
416
|
+
id?: string | undefined;
|
|
417
|
+
/** Name of the tool that produced this result. */
|
|
418
|
+
name?: string | undefined;
|
|
419
|
+
/** How the tool call resolved, e.g. `"ok"` or `"error"`. */
|
|
420
|
+
resolution?: string | undefined;
|
|
421
|
+
}
|
|
422
|
+
/** Runtime validator for {@link AIChatStreamToolResult}. */
|
|
423
|
+
export declare const aIChatStreamToolResultSchema: z.ZodObject<{
|
|
424
|
+
/** The tool's output, serialized as a string. */
|
|
425
|
+
content: z.ZodOptional<z.ZodString>;
|
|
426
|
+
/** ID of the tool call this result satisfies. */
|
|
427
|
+
id: z.ZodOptional<z.ZodString>;
|
|
428
|
+
/** Name of the tool that produced this result. */
|
|
429
|
+
name: z.ZodOptional<z.ZodString>;
|
|
430
|
+
/** How the tool call resolved, e.g. `"ok"` or `"error"`. */
|
|
431
|
+
resolution: z.ZodOptional<z.ZodString>;
|
|
432
|
+
}, "strip", z.ZodTypeAny, {
|
|
433
|
+
content?: string | undefined;
|
|
434
|
+
id?: string | undefined;
|
|
435
|
+
name?: string | undefined;
|
|
436
|
+
resolution?: string | undefined;
|
|
437
|
+
}, {
|
|
438
|
+
content?: string | undefined;
|
|
439
|
+
id?: string | undefined;
|
|
440
|
+
name?: string | undefined;
|
|
441
|
+
resolution?: string | undefined;
|
|
442
|
+
}>;
|
|
174
443
|
/** The result of an AI chat completion request. Returned by chat completion endpoints after the model finishes generating. */
|
|
175
444
|
export interface AICompletionResult {
|
|
176
445
|
/** The reason the model stopped generating. Common values include `"stop"` (natural end), `"length"` (token limit reached), and `"tool_calls"` (the model invoked a tool). */
|
|
@@ -508,23 +777,23 @@ export declare const aIImageResultSchema: z.ZodObject<{
|
|
|
508
777
|
width?: number | undefined;
|
|
509
778
|
image_url?: string | undefined;
|
|
510
779
|
size?: string | undefined;
|
|
780
|
+
usage?: Record<string, unknown> | undefined;
|
|
511
781
|
aspect_ratio?: string | undefined;
|
|
512
782
|
image_data?: string | undefined;
|
|
513
783
|
image_size?: string | undefined;
|
|
514
784
|
image_type?: string | undefined;
|
|
515
785
|
revised_prompt?: string | undefined;
|
|
516
|
-
usage?: Record<string, unknown> | undefined;
|
|
517
786
|
}, {
|
|
518
787
|
model: string;
|
|
519
788
|
height?: number | undefined;
|
|
520
789
|
width?: number | undefined;
|
|
521
790
|
image_url?: string | undefined;
|
|
522
791
|
size?: string | undefined;
|
|
792
|
+
usage?: Record<string, unknown> | undefined;
|
|
523
793
|
aspect_ratio?: string | undefined;
|
|
524
794
|
image_data?: string | undefined;
|
|
525
795
|
image_size?: string | undefined;
|
|
526
796
|
image_type?: string | undefined;
|
|
527
797
|
revised_prompt?: string | undefined;
|
|
528
|
-
usage?: Record<string, unknown> | undefined;
|
|
529
798
|
}>;
|
|
530
799
|
//# sourceMappingURL=ai.d.ts.map
|
package/dist/types/ai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/types/ai.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wHAAwH;AACxH,MAAM,WAAW,UAAU;IACzB,0JAA0J;IAC1J,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,yIAAyI;IACzI,EAAE,EAAE,MAAM,CAAC;IACX,mGAAmG;IACnG,IAAI,EAAE,MAAM,CAAC;IACb,+JAA+J;IAC/J,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,gDAAgD;AAChD,eAAO,MAAM,gBAAgB;IAC3B,0JAA0J;;IAE1J,yIAAyI;;IAEzI,mGAAmG;;IAEnG,+JAA+J;;;;;;;;;;;;EAED,CAAC;AAEjK,6IAA6I;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IAC/B,0FAA0F;IAC1F,KAAK,EAAE,MAAM,CAAC;IACd,4MAA4M;IAC5M,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,uGAAuG;IACvG,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,sIAAsI;IACtI,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC5C,mGAAmG;IACnG,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,mDAAmD;AACnD,eAAO,MAAM,mBAAmB;IAC9B,+GAA+G;;IAE/G,oGAAoG;;IAEpG,mJAAmJ;;IAEnJ,0HAA0H;;IAE1H,uIAAuI;;IAEvI,sLAAsL;;IAEtL,0FAA0F;;IAE1F,4MAA4M;;IAE5M,uGAAuG;;IAEvG,sIAAsI;;IAEtI,mGAAmG;;;;;;;;;;;;;;;;;;;;;;;;;;EAEuH,CAAC"}
|
package/dist/types/ai.js
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
// Copyright (c) 2026 ArchAstro Inc. All Rights Reserved.
|
|
2
2
|
// This file is auto-generated by @archastro/sdk-generator. Do not edit.
|
|
3
|
-
// Content hash:
|
|
3
|
+
// Content hash: a9120b7e4fcc
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
/** Runtime validator for {@link AIChatStreamDone}. */
|
|
6
|
+
export const aIChatStreamDoneSchema = z.object({
|
|
7
|
+
/** The overall finish reason for the completion. */
|
|
8
|
+
finish_reason: z.string().optional().describe("The overall finish reason for the completion."),
|
|
9
|
+
/** Number of model runs executed, including continuations triggered by tool calls. */
|
|
10
|
+
run_count: z.number().int().optional().describe("Number of model runs executed, including continuations triggered by tool calls."),
|
|
11
|
+
/** Aggregate token usage across every run in the completion (including tool-call continuations), keyed by model ID. */
|
|
12
|
+
total_usage: z.record(z.unknown()).optional().describe("Aggregate token usage across every run in the completion (including tool-call continuations), keyed by model ID."),
|
|
13
|
+
/** Token usage for the final run, keyed by model ID. */
|
|
14
|
+
usage: z.record(z.unknown()).optional().describe("Token usage for the final run, keyed by model ID."),
|
|
15
|
+
}).describe("Terminal event marking the end of a streaming chat completion (SSE `done` event).");
|
|
16
|
+
/** Runtime validator for {@link AIChatStreamError}. */
|
|
17
|
+
export const aIChatStreamErrorSchema = z.object({
|
|
18
|
+
/** Human-readable description of the error that terminated the stream. */
|
|
19
|
+
message: z.string().describe("Human-readable description of the error that terminated the stream."),
|
|
20
|
+
}).describe("Terminal error event for a streaming chat completion (SSE `error` event).");
|
|
5
21
|
/** Runtime validator for {@link AIToolCall}. */
|
|
6
22
|
export const aIToolCallSchema = z.object({
|
|
7
23
|
/** Arguments the model wants to pass to the tool, as a key-value map. Deserialize and validate these against the tool's input schema before executing. */
|
|
@@ -41,6 +57,40 @@ export const aIMessageSchema = z.object({
|
|
|
41
57
|
/** Tool execution results provided in a `tool` message. Each entry corresponds to a prior tool call by its `id`. `null` on all other message roles. */
|
|
42
58
|
tool_results: z.array(aIToolResultSchema).optional().describe("Tool execution results provided in a `tool` message. Each entry corresponds to a prior tool call by its `id`. `null` on all other message roles."),
|
|
43
59
|
}).describe("A single message in an AI conversation, following the OpenAI-compatible chat format. Used in both request inputs and completion responses.");
|
|
60
|
+
/** Runtime validator for {@link AIChatStreamMessageComplete}. */
|
|
61
|
+
export const aIChatStreamMessageCompleteSchema = z.object({
|
|
62
|
+
/** Why the model stopped generating this message, e.g. `"stop"`, `"length"`, or `"tool_calls"`. */
|
|
63
|
+
finish_reason: z.string().optional().describe("Why the model stopped generating this message, e.g. `\"stop\"`, `\"length\"`, or `\"tool_calls\"`."),
|
|
64
|
+
/** The complete assistant message for this run, assembled from the preceding deltas. */
|
|
65
|
+
message: aIMessageSchema.describe("The complete assistant message for this run, assembled from the preceding deltas."),
|
|
66
|
+
/** Token consumption for this run, keyed by model ID. `null` when usage data is unavailable. */
|
|
67
|
+
usage: z.record(z.unknown()).optional().describe("Token consumption for this run, keyed by model ID. `null` when usage data is unavailable."),
|
|
68
|
+
}).describe("The fully assembled assistant message for one run of a streaming chat completion (SSE `message_complete` event).");
|
|
69
|
+
/** Runtime validator for {@link AIChatStreamMessageDelta}. */
|
|
70
|
+
export const aIChatStreamMessageDeltaSchema = z.object({
|
|
71
|
+
/** The chunk of assistant text produced since the previous `message_delta` event. Concatenate deltas in order to reconstruct the message. */
|
|
72
|
+
delta: z.string().describe("The chunk of assistant text produced since the previous `message_delta` event. Concatenate deltas in order to reconstruct the message."),
|
|
73
|
+
}).describe("Incremental assistant text emitted during a streaming chat completion (SSE `message_delta` event).");
|
|
74
|
+
/** Runtime validator for {@link AIChatStreamToolCallDelta}. */
|
|
75
|
+
export const aIChatStreamToolCallDeltaSchema = z.object({
|
|
76
|
+
/** A chunk of the tool call's serialized arguments. Concatenate deltas to reconstruct the arguments JSON. */
|
|
77
|
+
delta: z.string().optional().describe("A chunk of the tool call's serialized arguments. Concatenate deltas to reconstruct the arguments JSON."),
|
|
78
|
+
/** Identifier of the tool call this delta belongs to, once the model has assigned one. */
|
|
79
|
+
id: z.string().optional().describe("Identifier of the tool call this delta belongs to, once the model has assigned one."),
|
|
80
|
+
/** Name of the tool being called, once known. */
|
|
81
|
+
name: z.string().optional().describe("Name of the tool being called, once known."),
|
|
82
|
+
}).describe("Incremental tool-call data emitted as the model assembles a tool invocation (SSE `tool_call_delta` event).");
|
|
83
|
+
/** Runtime validator for {@link AIChatStreamToolResult}. */
|
|
84
|
+
export const aIChatStreamToolResultSchema = z.object({
|
|
85
|
+
/** The tool's output, serialized as a string. */
|
|
86
|
+
content: z.string().optional().describe("The tool's output, serialized as a string."),
|
|
87
|
+
/** ID of the tool call this result satisfies. */
|
|
88
|
+
id: z.string().optional().describe("ID of the tool call this result satisfies."),
|
|
89
|
+
/** Name of the tool that produced this result. */
|
|
90
|
+
name: z.string().optional().describe("Name of the tool that produced this result."),
|
|
91
|
+
/** How the tool call resolved, e.g. `"ok"` or `"error"`. */
|
|
92
|
+
resolution: z.string().optional().describe("How the tool call resolved, e.g. `\"ok\"` or `\"error\"`."),
|
|
93
|
+
}).describe("The result of a server-executed tool, streamed back into the run (SSE `tool_result` event).");
|
|
44
94
|
/** Runtime validator for {@link AICompletionResult}. */
|
|
45
95
|
export const aICompletionResultSchema = z.object({
|
|
46
96
|
/** The reason the model stopped generating. Common values include `"stop"` (natural end), `"length"` (token limit reached), and `"tool_calls"` (the model invoked a tool). */
|
package/dist/types/ai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../../src/types/ai.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,wEAAwE;AACxE,6BAA6B;AAE7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,gDAAgD;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,0JAA0J;IAC1J,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,qJAAqJ,CAAC;IAChM,yIAAyI;IACzI,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oIAAoI,CAAC;IAC7J,mGAAmG;IACnG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kGAAkG,CAAC;IAC7H,+JAA+J;IAC/J,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0JAA0J,CAAC;CAC9M,CAAC,CAAC,QAAQ,CAAC,mHAAmH,CAAiC,CAAC;AAcjK,kDAAkD;AAClD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,2HAA2H;IAC3H,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sHAAsH,CAAC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