@aimount/core 0.1.0 → 0.2.0-beta.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.
@@ -1,88 +1,448 @@
1
- import { RuntimeRunEventStream, RuntimeStreamRunEventsParams, RuntimeTelemetryEvent } from './events';
2
- import { MessageFeedback } from './feedback';
3
- import { Session, SessionPage, SessionStar } from './session';
4
- import { RuntimeGetSessionMessagesParams, RuntimeMessagePage, RuntimeRespondUserMessage, RuntimeSetMessageFeedbackParams } from './messages';
5
- import { RuntimeConfiguration, RuntimeRemainingLimits } from './profile';
6
- import { RuntimeCreateSessionParams, RuntimeGetSessionsParams } from './sessions';
7
- import { RuntimeResult } from './shared';
8
- import { RuntimeToolClaim, RuntimeToolClaimRequest, RuntimeToolClaimRenewParams, RuntimeToolOutputCommitRequest } from './tools';
9
- export type RuntimeRunStatus = 'queued' | 'running' | 'waiting_tool_outputs' | 'ready_to_continue' | 'continued' | 'completed' | 'interrupted' | 'failed' | 'cancelled';
10
- export type RuntimeCreateResponseParams = {
11
- sessionId: string;
12
- toolsKey: string;
1
+ import { RuntimeResult } from './shared.js';
2
+ export type RuntimeError = {
3
+ code: string;
4
+ message: string;
5
+ details?: Record<string, unknown> | undefined;
6
+ };
7
+ export type RuntimeSelectionOption = {
8
+ id: string;
9
+ name: string;
10
+ modalities?: RuntimeModelModalities | undefined;
11
+ };
12
+ export type RuntimeModelInputModality = 'text' | 'image' | 'pdf' | (string & {});
13
+ export type RuntimeModelOutputModality = 'text' | (string & {});
14
+ export type RuntimeModelModalities = {
15
+ input: RuntimeModelInputModality[];
16
+ output: RuntimeModelOutputModality[];
17
+ };
18
+ export type RuntimeLimits = {
19
+ maxInputTextLength: number;
20
+ maxMessages: number | null;
21
+ maxTokens: number | null;
22
+ messagesPerMinute: number | null;
23
+ messagesPerHour: number | null;
24
+ messagesPerDay: number | null;
25
+ };
26
+ export type RuntimeProfile = {
27
+ scope: RuntimeProfileScope;
28
+ selection: {
29
+ roles: RuntimeSelectionOption[];
30
+ models: RuntimeSelectionOption[];
31
+ defaults: RuntimeSelection | null;
32
+ };
33
+ limits: RuntimeLimits;
34
+ };
35
+ type RuntimeSessionOwnership = {
36
+ agentId: string;
37
+ userId: string;
38
+ };
39
+ type RuntimeProfileScope = RuntimeSessionOwnership & {
40
+ profileId: string;
41
+ };
42
+ export type RuntimeSession = {
43
+ id: string;
13
44
  agentId: string;
45
+ userId: string;
46
+ title: string | null;
47
+ createdAt: string;
48
+ updatedAt: string;
49
+ };
50
+ export type RuntimeSessionSummary = {
51
+ id: string;
52
+ agentId: string;
53
+ userId: string;
54
+ title: string | null;
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ lastActivityAt: string;
58
+ };
59
+ export type RuntimeSessionExecutionStatus = 'idle' | 'requested' | 'running' | 'waiting_tools' | 'stopping' | (string & {});
60
+ export type RuntimeSessionExecution = {
61
+ sessionId: string;
62
+ executionToken: string;
63
+ status: RuntimeSessionExecutionStatus;
64
+ inputBoundary?: RuntimeInputBoundary | null;
65
+ agentMessageId?: string | null;
66
+ selection?: RuntimeSelection | undefined;
67
+ createdAt: string;
68
+ updatedAt: string;
69
+ };
70
+ export type RuntimeTextContent = {
71
+ type: 'text';
72
+ id: string;
73
+ text: string;
74
+ };
75
+ export type RuntimeFileContent = {
76
+ type: 'file';
77
+ id: string;
78
+ fileId: string;
79
+ name?: string | undefined;
80
+ mediaType?: string | undefined;
81
+ sizeBytes?: number | undefined;
82
+ };
83
+ export type RuntimeToolCallContent = {
84
+ type: 'tool_call';
85
+ id: string;
86
+ name: string;
87
+ status: 'succeeded';
88
+ input: Record<string, unknown>;
89
+ result: unknown;
90
+ } | {
91
+ type: 'tool_call';
92
+ id: string;
93
+ name: string;
94
+ status: 'failed';
95
+ input: Record<string, unknown>;
96
+ error: RuntimeError;
97
+ } | {
98
+ type: 'tool_call';
99
+ id: string;
100
+ name: string;
101
+ status: 'denied';
102
+ input: Record<string, unknown>;
103
+ denial: RuntimeError;
104
+ } | {
105
+ type: 'tool_call';
106
+ id: string;
107
+ name: string;
108
+ status: 'cancelled';
109
+ input: Record<string, unknown>;
110
+ cancellation: RuntimeError;
111
+ };
112
+ export type RuntimeUnknownContent = {
113
+ type: 'unknown';
114
+ id: string;
115
+ originalType: string;
116
+ payload: unknown;
117
+ };
118
+ export type RuntimeContent = RuntimeTextContent | RuntimeFileContent | RuntimeToolCallContent | RuntimeUnknownContent;
119
+ export type RuntimeUserMessageContent = RuntimeContent;
120
+ export type RuntimeAgentMessageContent = RuntimeContent;
121
+ export type RuntimeSelection = {
122
+ roleId: string;
14
123
  modelId: string;
124
+ };
125
+ export type RuntimeInputBoundary = {
126
+ lastUserMessageId: string;
127
+ };
128
+ export type RuntimeSubmitInputContent = {
129
+ type: 'text';
130
+ text: string;
131
+ } | {
132
+ type: 'file';
133
+ fileId: string;
134
+ };
135
+ export type RuntimeSessionItemBase<TType extends string> = {
136
+ type: TType;
137
+ id: string;
138
+ sessionId: string;
139
+ createdAt: string;
140
+ metadata?: Record<string, unknown>;
141
+ };
142
+ export type RuntimeUserMessage = RuntimeSessionItemBase<'user_message'> & {
143
+ commandId?: string;
144
+ content: RuntimeUserMessageContent[];
145
+ environment?: unknown;
146
+ selection?: RuntimeSelection;
147
+ };
148
+ export type RuntimePendingUserMessage = {
149
+ id: string;
150
+ commandId: string;
151
+ content: RuntimeSubmitInputContent[];
152
+ selection?: RuntimeSelection;
153
+ createdAt: string;
154
+ };
155
+ export type RuntimeAgentMessageStatus = 'in_progress' | 'completed' | 'failed' | 'cancelled';
156
+ export type RuntimeAgentMessage = RuntimeSessionItemBase<'agent_message'> & {
157
+ status: RuntimeAgentMessageStatus;
158
+ inputBoundary?: RuntimeInputBoundary | undefined;
159
+ selection?: RuntimeSelection;
160
+ content: RuntimeAgentMessageContent[];
161
+ };
162
+ export type RuntimeCompactionStatus = 'in_progress' | 'completed' | 'failed' | 'cancelled';
163
+ export type RuntimeCompaction = RuntimeSessionItemBase<'compaction'> & {
164
+ status: RuntimeCompactionStatus;
165
+ reason?: string | undefined;
166
+ beforeItemId?: string | undefined;
167
+ summary?: string | undefined;
168
+ retainedContext?: string | undefined;
169
+ error?: RuntimeError | undefined;
170
+ cancellation?: RuntimeError | undefined;
171
+ };
172
+ export type RuntimeUnknownSessionItem = RuntimeSessionItemBase<'unknown'> & {
173
+ originalType: string;
174
+ payload: unknown;
175
+ };
176
+ export type RuntimeSessionItem = RuntimeUserMessage | RuntimeAgentMessage | RuntimeCompaction | RuntimeUnknownSessionItem;
177
+ export type RuntimeEventType = 'session.created' | 'pending_input.created' | 'pending_input.committed' | 'session_item.created' | 'session_item.part.created' | 'session_item.content_delta' | 'session_item.updated' | 'session_execution.updated';
178
+ export type RuntimeSessionItemEventWire = {
179
+ eventId: string;
180
+ previousEventId: string | null;
181
+ sessionId: string;
182
+ commandId?: string | undefined;
183
+ type: 'session_item.created' | 'session_item.updated';
184
+ createdAt: string;
185
+ payload: {
186
+ item: RuntimeSessionItem;
187
+ };
188
+ };
189
+ export type RuntimePendingInputCreatedEventWire = {
190
+ eventId: string;
191
+ previousEventId: string | null;
192
+ sessionId: string;
193
+ commandId?: string | undefined;
194
+ type: 'pending_input.created';
195
+ createdAt: string;
196
+ payload: {
197
+ pendingInput: {
198
+ id: string;
199
+ sessionId: string;
200
+ commandId: string;
201
+ content: RuntimeSubmitInputContent[];
202
+ requestedSelection?: Partial<RuntimeSelection> | undefined;
203
+ selection?: RuntimeSelection | undefined;
204
+ createdAt: string;
205
+ };
206
+ };
207
+ };
208
+ export type RuntimePendingInputCommittedEventWire = {
209
+ eventId: string;
210
+ previousEventId: string | null;
211
+ sessionId: string;
212
+ commandId?: string | undefined;
213
+ type: 'pending_input.committed';
214
+ createdAt: string;
215
+ payload: {
216
+ pendingInputId: string;
217
+ commandId: string;
218
+ itemId: string;
219
+ };
220
+ };
221
+ export type RuntimeSessionExecutionEventWire = {
222
+ eventId: string;
223
+ previousEventId: string | null;
224
+ sessionId: string;
225
+ type: 'session_execution.updated';
226
+ createdAt: string;
227
+ payload: {
228
+ execution: RuntimeSessionExecution;
229
+ };
230
+ };
231
+ export type RuntimeSessionItemContentDeltaEventWire = {
232
+ eventId: string;
233
+ previousEventId: string | null;
234
+ sessionId: string;
235
+ type: 'session_item.content_delta';
236
+ createdAt: string;
237
+ payload: {
238
+ itemId: string;
239
+ partId: string;
240
+ partType: 'text';
241
+ delta: string;
242
+ };
243
+ };
244
+ export type RuntimeSessionItemPartCreatedEventWire = {
245
+ eventId: string;
246
+ previousEventId: string | null;
247
+ sessionId: string;
248
+ type: 'session_item.part.created';
249
+ createdAt: string;
250
+ payload: {
251
+ itemId: string;
252
+ part: RuntimeTextContent & {
253
+ id: string;
254
+ };
255
+ };
256
+ };
257
+ export type RuntimeSessionCreatedEventWire = {
258
+ eventId: string;
259
+ previousEventId: null;
260
+ sessionId: string;
261
+ type: 'session.created';
262
+ createdAt: string;
263
+ payload: {
264
+ session: RuntimeSession;
265
+ execution: RuntimeSessionExecution;
266
+ };
267
+ };
268
+ export type RuntimeUnknownEventWire = {
269
+ eventId: string;
270
+ previousEventId: string | null;
271
+ sessionId: string;
272
+ type: 'unknown';
273
+ originalType: string;
274
+ createdAt: string;
275
+ payload: Record<string, unknown>;
276
+ };
277
+ export type RuntimeEventWire = RuntimeSessionCreatedEventWire | RuntimePendingInputCreatedEventWire | RuntimePendingInputCommittedEventWire | RuntimeSessionItemEventWire | RuntimeSessionItemPartCreatedEventWire | RuntimeSessionItemContentDeltaEventWire | RuntimeSessionExecutionEventWire | RuntimeUnknownEventWire;
278
+ export type RuntimeCommandAck = {
279
+ commandId: string;
280
+ status: 'accepted';
281
+ };
282
+ export type RuntimeInputCommandAck = RuntimeCommandAck;
283
+ export type RuntimeStopCommandAck = RuntimeCommandAck;
284
+ export type RuntimeCreateFileUploadParams = {
285
+ name: string;
286
+ mediaType: string;
287
+ sizeBytes: number;
288
+ signal?: AbortSignal;
289
+ };
290
+ export type RuntimeCreateFileUploadResult = {
291
+ fileId: string;
292
+ status: 'draft';
293
+ uploadUrl: string;
294
+ uploadUrlExpiresAt: string;
295
+ name: string;
296
+ mediaType: string;
297
+ sizeBytes: number;
298
+ };
299
+ export type RuntimeRefreshFileUploadUrlParams = {
300
+ fileId: string;
301
+ signal?: AbortSignal;
302
+ };
303
+ export type RuntimeRefreshFileUploadUrlResult = {
304
+ fileId: string;
305
+ uploadUrl: string;
306
+ uploadUrlExpiresAt: string;
307
+ };
308
+ export type RuntimeCompleteFileUploadParams = {
309
+ fileId: string;
310
+ signal?: AbortSignal;
311
+ };
312
+ export type RuntimeCompleteFileUploadResult = {
313
+ fileId: string;
314
+ status: 'ready';
315
+ name: string;
316
+ mediaType: string;
317
+ sizeBytes: number;
318
+ };
319
+ export type RuntimeCreateFileAccessUrlParams = {
320
+ fileId: string;
321
+ signal?: AbortSignal;
322
+ };
323
+ export type RuntimeCreateFileAccessUrlResult = {
324
+ url: string;
325
+ expiresAt: string;
326
+ };
327
+ export type RuntimeCreateSessionParams = {
15
328
  idempotencyKey: string;
16
- message: RuntimeRespondUserMessage;
17
- context?: string;
18
- tools?: Record<string, unknown>;
329
+ title?: string;
19
330
  signal?: AbortSignal;
20
331
  };
21
- export type RuntimeCreateResponseResult = {
22
- responseId: string;
332
+ export type RuntimeGetSessionViewParams = {
23
333
  sessionId: string;
24
- userMessageId: string;
25
- runId: string;
334
+ itemsLimit?: number;
335
+ itemsCursor?: string;
336
+ signal?: AbortSignal;
26
337
  };
27
- export type RuntimeContinueRunParams = {
28
- responseId: string;
29
- runId: string;
30
- idempotencyKey: string;
338
+ export type RuntimeListSessionsParams = {
339
+ limit?: number;
340
+ cursor?: string;
31
341
  signal?: AbortSignal;
32
342
  };
33
- export type RuntimeContinueRunResult = {
34
- responseId: string;
35
- runId: string;
36
- status: Extract<RuntimeRunStatus, 'queued'>;
343
+ export type RuntimeDeleteSessionParams = {
344
+ sessionId: string;
345
+ signal?: AbortSignal;
37
346
  };
38
- export type RuntimeGetSessionMessageRunParams = {
347
+ export type RuntimeReadSessionEventsParams = {
39
348
  sessionId: string;
40
- assistantMessageId: string;
349
+ afterEventId?: string;
350
+ limit?: number;
351
+ waitMs?: number;
41
352
  signal?: AbortSignal;
42
353
  };
43
- export type RuntimeMessageRun = {
44
- responseId: string;
45
- runId: string;
46
- status: RuntimeRunStatus;
47
- reason: string | null;
354
+ export type RuntimeSubmitSessionInputParams = {
355
+ sessionId: string;
356
+ idempotencyKey: string;
357
+ content: RuntimeSubmitInputContent[];
358
+ selection?: RuntimeSelection;
359
+ signal?: AbortSignal;
48
360
  };
49
- export type RuntimeCancelRunParams = {
50
- responseId: string;
51
- runId: string;
52
- reason?: 'user.cancelled' | 'client.unsync';
361
+ export type RuntimeStopSessionExecutionParams = {
362
+ sessionId: string;
363
+ idempotencyKey: string;
364
+ executionToken: string;
53
365
  signal?: AbortSignal;
54
366
  };
55
- export type RuntimeCancelRunResult = {
56
- responseId: string;
57
- runId: string;
58
- status: Extract<RuntimeRunStatus, 'cancelled'>;
367
+ export type RuntimeCreateSessionResult = {
368
+ session: RuntimeSession;
369
+ execution: RuntimeSessionExecution;
370
+ lastEventId: string;
371
+ capabilities: RuntimeSessionView['capabilities'];
372
+ items: RuntimeSessionView['items'];
373
+ pendingInput: RuntimeSessionView['pendingInput'];
374
+ ack: {
375
+ sessionId: string;
376
+ commandId: string;
377
+ status: 'accepted';
378
+ };
59
379
  };
60
- export type RuntimeCommitToolOutputsParams = {
61
- responseId: string;
62
- runId: string;
63
- toolOutputs: RuntimeToolOutputCommitRequest[];
64
- signal?: AbortSignal;
380
+ type RuntimeCommandCapability<TReason extends string> = {
381
+ available: true;
382
+ } | {
383
+ available: false;
384
+ reason: TReason;
385
+ };
386
+ export type RuntimeSessionView = {
387
+ session: RuntimeSession;
388
+ execution: RuntimeSessionExecution;
389
+ lastEventId: string | null;
390
+ capabilities: {
391
+ sendText: RuntimeCommandCapability<'session_unavailable' | 'maintenance'>;
392
+ stop: RuntimeCommandCapability<'execution_not_active' | 'session_unavailable' | 'maintenance'>;
393
+ };
394
+ items: {
395
+ entries: RuntimeSessionItem[];
396
+ continuityToken: string;
397
+ olderCursor: string | null;
398
+ newerCursor: string | null;
399
+ hasOlder: boolean;
400
+ hasNewer: boolean;
401
+ };
402
+ pendingInput: {
403
+ entries: RuntimePendingUserMessage[];
404
+ };
405
+ };
406
+ export type RuntimeListSessionsResult = {
407
+ items: RuntimeSessionSummary[];
408
+ nextCursor: string | null;
409
+ };
410
+ export type RuntimeSessionEventsPage = {
411
+ events: RuntimeEventWire[];
412
+ nextEventId: string | null;
65
413
  };
66
414
  export type RuntimeApi = {
67
- getConfiguration: () => Promise<RuntimeResult<RuntimeConfiguration>>;
68
- getRemainingLimits: () => Promise<RuntimeResult<RuntimeRemainingLimits>>;
69
- getSessions: (_?: RuntimeGetSessionsParams) => Promise<RuntimeResult<SessionPage>>;
70
- createSession: (_?: RuntimeCreateSessionParams) => Promise<RuntimeResult<Session>>;
71
- getSession: (_: string) => Promise<RuntimeResult<Session>>;
72
- deleteSession: (_: string) => Promise<RuntimeResult<void>>;
73
- setSessionStar: (_: {
74
- sessionId: string;
75
- starred: boolean;
76
- }) => Promise<RuntimeResult<SessionStar>>;
77
- getSessionMessages: (_: RuntimeGetSessionMessagesParams) => Promise<RuntimeResult<RuntimeMessagePage>>;
78
- setMessageFeedback: (_: RuntimeSetMessageFeedbackParams) => Promise<RuntimeResult<MessageFeedback>>;
79
- recordTelemetryEvents: (_: RuntimeTelemetryEvent[]) => Promise<RuntimeResult<void>>;
80
- createResponse: (_: RuntimeCreateResponseParams) => Promise<RuntimeResult<RuntimeCreateResponseResult>>;
81
- getSessionMessageRun: (_: RuntimeGetSessionMessageRunParams) => Promise<RuntimeResult<RuntimeMessageRun | null>>;
82
- continueRun: (_: RuntimeContinueRunParams) => Promise<RuntimeResult<RuntimeContinueRunResult>>;
83
- cancelRun: (_: RuntimeCancelRunParams) => Promise<RuntimeResult<RuntimeCancelRunResult>>;
84
- streamRunEvents: (_: RuntimeStreamRunEventsParams) => Promise<RuntimeResult<RuntimeRunEventStream>>;
85
- claimToolCall: (_: RuntimeToolClaimRequest) => Promise<RuntimeResult<RuntimeToolClaim>>;
86
- renewToolClaim: (_: RuntimeToolClaimRenewParams) => Promise<RuntimeResult<RuntimeToolClaim>>;
87
- commitToolOutputs: (_: RuntimeCommitToolOutputsParams) => Promise<RuntimeResult<void>>;
415
+ getProfile: (_?: {
416
+ signal?: AbortSignal;
417
+ }) => Promise<RuntimeResult<RuntimeProfile>>;
418
+ createFileUpload: (_: RuntimeCreateFileUploadParams) => Promise<RuntimeResult<RuntimeCreateFileUploadResult>>;
419
+ refreshFileUploadUrl: (_: RuntimeRefreshFileUploadUrlParams) => Promise<RuntimeResult<RuntimeRefreshFileUploadUrlResult>>;
420
+ completeFileUpload: (_: RuntimeCompleteFileUploadParams) => Promise<RuntimeResult<RuntimeCompleteFileUploadResult>>;
421
+ createFileAccessUrl: (_: RuntimeCreateFileAccessUrlParams) => Promise<RuntimeResult<RuntimeCreateFileAccessUrlResult>>;
422
+ createSession: (_: RuntimeCreateSessionParams) => Promise<RuntimeResult<RuntimeCreateSessionResult>>;
423
+ listSessions: (_?: RuntimeListSessionsParams) => Promise<RuntimeResult<RuntimeListSessionsResult>>;
424
+ deleteSession: (_: RuntimeDeleteSessionParams) => Promise<RuntimeResult<void>>;
425
+ getSessionView: (_: RuntimeGetSessionViewParams) => Promise<RuntimeResult<RuntimeSessionView>>;
426
+ readSessionEvents: (_: RuntimeReadSessionEventsParams) => Promise<RuntimeResult<RuntimeSessionEventsPage>>;
427
+ submitSessionInput: (_: RuntimeSubmitSessionInputParams) => Promise<RuntimeResult<RuntimeInputCommandAck>>;
428
+ stopSessionExecution: (_: RuntimeStopSessionExecutionParams) => Promise<RuntimeResult<RuntimeStopCommandAck>>;
88
429
  };
430
+ export declare function parseRuntimeError(input: unknown): RuntimeError;
431
+ export declare function parseRuntimeProfile(input: unknown): RuntimeProfile;
432
+ export declare function parseRuntimeSession(input: unknown): RuntimeSession;
433
+ export declare function parseRuntimeSessionExecution(input: unknown): RuntimeSessionExecution;
434
+ export declare function parseRuntimeContent(input: unknown, contentIndex?: number): RuntimeContent;
435
+ export declare function parseRuntimeSessionItem(input: unknown): RuntimeSessionItem;
436
+ export declare function parseRuntimeEventWire(input: unknown): RuntimeEventWire;
437
+ export declare function parseRuntimeSessionEventsPage(input: unknown): RuntimeSessionEventsPage;
438
+ export declare function parseRuntimeCommandAck(input: unknown): RuntimeCommandAck;
439
+ export declare function parseRuntimeInputCommandAck(input: unknown): RuntimeInputCommandAck;
440
+ export declare function parseRuntimeStopCommandAck(input: unknown): RuntimeStopCommandAck;
441
+ export declare function parseRuntimeFileUploadResult(input: unknown): RuntimeCreateFileUploadResult;
442
+ export declare function parseRuntimeFileUploadUrlResult(input: unknown): RuntimeRefreshFileUploadUrlResult;
443
+ export declare function parseRuntimeFileCompleteResult(input: unknown): RuntimeCompleteFileUploadResult;
444
+ export declare function parseRuntimeFileAccessUrlResult(input: unknown): RuntimeCreateFileAccessUrlResult;
445
+ export declare function parseRuntimeCreateSessionResult(input: unknown): RuntimeCreateSessionResult;
446
+ export declare function parseRuntimeSessionView(input: unknown): RuntimeSessionView;
447
+ export declare function parseRuntimeListSessionsResult(input: unknown): RuntimeListSessionsResult;
448
+ export {};
package/dist/shared.d.ts CHANGED
@@ -1 +1 @@
1
- export type RuntimeResult<T, E extends Error = Error> = readonly [T, null] | readonly [null, E];
1
+ export type RuntimeResult<T, E = Error> = readonly [T, null] | readonly [null, E];
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aimount/core",
3
3
  "private": false,
4
- "version": "0.1.0",
4
+ "version": "0.2.0-beta.1",
5
5
  "type": "module",
6
- "description": "Core runtime contracts, tool authoring primitives, and message DTOs for aimount",
6
+ "description": "Core Runtime API contracts and DTOs for aimount",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -27,7 +27,6 @@
27
27
  "test": "bun test src"
28
28
  },
29
29
  "dependencies": {
30
- "ai": "6",
31
30
  "zod": "^4.3.6"
32
31
  },
33
32
  "devDependencies": {
@@ -1,7 +0,0 @@
1
- import { MessageKnownPart, MessagePartUnknown } from './part';
2
- import { MessageStatus } from './status';
3
- export type { MessagePartFile as RuntimeAssistantFilePart, MessagePartReasoning as RuntimeAssistantReasoningPart, MessageProviderMetadata as RuntimeAssistantProviderMetadata, MessagePartSourceDocument as RuntimeAssistantSourceDocumentPart, MessagePartSourceUrl as RuntimeAssistantSourceUrlPart, MessagePartText as RuntimeAssistantTextPart, MessageToolApproval as RuntimeAssistantToolApproval, MessagePartTool as RuntimeAssistantToolPart, MessagePartUnknown as RuntimeAssistantUnknownPart, } from './part';
4
- export type RuntimeAssistantToolPartState = 'streaming' | 'call' | 'done' | 'error' | 'canceled';
5
- export type RuntimeAssistantPart = MessageKnownPart | MessagePartUnknown;
6
- export declare function collectPendingToolCallIdsFromAssistantParts(parts: ReadonlyArray<RuntimeAssistantPart>): string[];
7
- export declare function toDefaultStatusFromAssistantParts(parts: ReadonlyArray<RuntimeAssistantPart>): MessageStatus;
package/dist/events.d.ts DELETED
@@ -1,127 +0,0 @@
1
- import { RuntimeMessageStatus } from './messages';
2
- export type RuntimeTelemetryEvent = {
3
- type: 'chat.rendered.v1' | 'chat.focus_changed.v1' | 'chat.session_selected.v1' | 'chat.prompt_edit_started.v1' | 'chat.prompt_submitted.v1' | 'chat.response_started.v1' | 'chat.response_finished.v1' | 'chat.response_stopped.v1' | 'chat.feedback_set.v1' | 'chat.tool_call_started.v1' | 'chat.tool_call_finished.v1';
4
- occurredAt: Date;
5
- sessionId?: string | undefined;
6
- messageId?: string | undefined;
7
- payload: Record<string, unknown>;
8
- };
9
- export type RuntimeMessageStreamFinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other';
10
- export type RuntimeEvent = {
11
- v: 1;
12
- type: 'message.created';
13
- messageId: string;
14
- sessionId: string;
15
- role: 'assistant';
16
- status: RuntimeMessageStatus;
17
- } | {
18
- v: 1;
19
- type: 'message.checkpoint.created';
20
- messageId: string;
21
- checkpointId: string;
22
- } | {
23
- v: 1;
24
- type: 'message.revision.rebased';
25
- messageId: string;
26
- checkpointId: string;
27
- revisionId: string;
28
- } | {
29
- v: 1;
30
- type: 'part.text.start';
31
- partId: string;
32
- } | {
33
- v: 1;
34
- type: 'part.text.delta';
35
- partId: string;
36
- delta: string;
37
- } | {
38
- v: 1;
39
- type: 'part.text.end';
40
- partId: string;
41
- } | {
42
- v: 1;
43
- type: 'part.reasoning.start';
44
- partId: string;
45
- } | {
46
- v: 1;
47
- type: 'part.reasoning.delta';
48
- partId: string;
49
- delta: string;
50
- } | {
51
- v: 1;
52
- type: 'part.reasoning.end';
53
- partId: string;
54
- } | {
55
- v: 1;
56
- type: 'part.source-url';
57
- sourceId: string;
58
- url: string;
59
- title?: string;
60
- } | {
61
- v: 1;
62
- type: 'part.source-document';
63
- sourceId: string;
64
- mediaType: string;
65
- title: string;
66
- filename?: string;
67
- } | {
68
- v: 1;
69
- type: 'part.file';
70
- url: string;
71
- mediaType: string;
72
- filename?: string;
73
- } | {
74
- v: 1;
75
- type: 'part.tool.input.start';
76
- toolCallId: string;
77
- name: string;
78
- } | {
79
- v: 1;
80
- type: 'part.tool.input.delta';
81
- toolCallId: string;
82
- delta: string;
83
- } | {
84
- v: 1;
85
- type: 'part.tool.call';
86
- toolCallId: string;
87
- name: string;
88
- input: unknown;
89
- } | {
90
- v: 1;
91
- type: 'part.tool.result';
92
- toolCallId: string;
93
- output: unknown;
94
- preliminary?: boolean;
95
- } | {
96
- v: 1;
97
- type: 'part.tool.error';
98
- toolCallId: string;
99
- error: string;
100
- } | {
101
- v: 1;
102
- type: 'part.tool.denied';
103
- toolCallId: string;
104
- } | {
105
- v: 1;
106
- type: 'part.unknown';
107
- rawType: string;
108
- reason: 'unsupported_chunk' | 'invalid_chunk';
109
- payload?: unknown;
110
- } | {
111
- v: 1;
112
- type: 'message.status';
113
- messageId: string;
114
- status: RuntimeMessageStatus;
115
- pendingToolCallIds?: string[];
116
- };
117
- export type RuntimeRunEvent = {
118
- seq: number;
119
- event: RuntimeEvent;
120
- };
121
- export type RuntimeRunEventStream = AsyncIterable<RuntimeRunEvent>;
122
- export type RuntimeStreamRunEventsParams = {
123
- responseId: string;
124
- runId: string;
125
- afterSeq: number;
126
- signal?: AbortSignal;
127
- };
@@ -1,8 +0,0 @@
1
- export type MessageFeedbackType = 'like' | 'dislike';
2
- export type MessageFeedback = {
3
- sessionId: string;
4
- messageId: string;
5
- feedbackType: MessageFeedbackType;
6
- reason: string | null;
7
- updatedAt: Date;
8
- };
@@ -1 +0,0 @@
1
- export type { Message as MessageData } from './message';