@aimount/core 0.1.0 → 0.2.0-beta.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.
@@ -1,88 +1,370 @@
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
+ };
11
+ export type RuntimeLimits = {
12
+ maxInputTextLength: number;
13
+ maxMessages: number | null;
14
+ maxTokens: number | null;
15
+ messagesPerMinute: number | null;
16
+ messagesPerHour: number | null;
17
+ messagesPerDay: number | null;
18
+ };
19
+ export type RuntimeProfile = {
20
+ scope: RuntimeProfileScope;
21
+ selection: {
22
+ roles: RuntimeSelectionOption[];
23
+ models: RuntimeSelectionOption[];
24
+ defaults: RuntimeSelection | null;
25
+ };
26
+ limits: RuntimeLimits;
27
+ };
28
+ type RuntimeSessionOwnership = {
29
+ agentId: string;
30
+ userId: string;
31
+ };
32
+ type RuntimeProfileScope = RuntimeSessionOwnership & {
33
+ profileId: string;
34
+ };
35
+ export type RuntimeSession = {
36
+ id: string;
37
+ agentId: string;
38
+ userId: string;
39
+ title: string | null;
40
+ createdAt: string;
41
+ updatedAt: string;
42
+ };
43
+ export type RuntimeSessionSummary = {
44
+ id: string;
13
45
  agentId: string;
46
+ userId: string;
47
+ title: string | null;
48
+ createdAt: string;
49
+ updatedAt: string;
50
+ lastActivityAt: string;
51
+ };
52
+ export type RuntimeSessionExecutionStatus = 'idle' | 'requested' | 'running' | 'waiting_tools' | 'stopping' | (string & {});
53
+ export type RuntimeSessionExecution = {
54
+ sessionId: string;
55
+ executionToken: string;
56
+ status: RuntimeSessionExecutionStatus;
57
+ inputBoundary?: RuntimeInputBoundary | null;
58
+ agentMessageId?: string | null;
59
+ selection?: RuntimeSelection | undefined;
60
+ createdAt: string;
61
+ updatedAt: string;
62
+ };
63
+ export type RuntimeTextContent = {
64
+ type: 'text';
65
+ id: string;
66
+ text: string;
67
+ };
68
+ export type RuntimeToolCallContent = {
69
+ type: 'tool_call';
70
+ id: string;
71
+ name: string;
72
+ status: 'succeeded';
73
+ input: Record<string, unknown>;
74
+ result: unknown;
75
+ } | {
76
+ type: 'tool_call';
77
+ id: string;
78
+ name: string;
79
+ status: 'failed';
80
+ input: Record<string, unknown>;
81
+ error: RuntimeError;
82
+ } | {
83
+ type: 'tool_call';
84
+ id: string;
85
+ name: string;
86
+ status: 'denied';
87
+ input: Record<string, unknown>;
88
+ denial: RuntimeError;
89
+ } | {
90
+ type: 'tool_call';
91
+ id: string;
92
+ name: string;
93
+ status: 'cancelled';
94
+ input: Record<string, unknown>;
95
+ cancellation: RuntimeError;
96
+ };
97
+ export type RuntimeUnknownContent = {
98
+ type: 'unknown';
99
+ id: string;
100
+ originalType: string;
101
+ payload: unknown;
102
+ };
103
+ export type RuntimeContent = RuntimeTextContent | RuntimeToolCallContent | RuntimeUnknownContent;
104
+ export type RuntimeUserMessageContent = RuntimeContent;
105
+ export type RuntimeAgentMessageContent = RuntimeContent;
106
+ export type RuntimeSelection = {
107
+ roleId: string;
14
108
  modelId: string;
15
- idempotencyKey: string;
16
- message: RuntimeRespondUserMessage;
17
- context?: string;
18
- tools?: Record<string, unknown>;
19
- signal?: AbortSignal;
20
109
  };
21
- export type RuntimeCreateResponseResult = {
22
- responseId: string;
110
+ export type RuntimeInputBoundary = {
111
+ lastUserMessageId: string;
112
+ };
113
+ export type RuntimeSessionItemBase<TType extends string> = {
114
+ type: TType;
115
+ id: string;
116
+ sessionId: string;
117
+ createdAt: string;
118
+ metadata?: Record<string, unknown>;
119
+ };
120
+ export type RuntimeUserMessage = RuntimeSessionItemBase<'user_message'> & {
121
+ commandId?: string;
122
+ content: RuntimeUserMessageContent[];
123
+ environment?: unknown;
124
+ selection?: RuntimeSelection;
125
+ };
126
+ export type RuntimePendingUserMessage = {
127
+ id: string;
128
+ commandId: string;
129
+ text: string;
130
+ selection: RuntimeSelection;
131
+ createdAt: string;
132
+ };
133
+ export type RuntimeAgentMessageStatus = 'in_progress' | 'completed' | 'failed' | 'cancelled';
134
+ export type RuntimeAgentMessage = RuntimeSessionItemBase<'agent_message'> & {
135
+ status: RuntimeAgentMessageStatus;
136
+ inputBoundary?: RuntimeInputBoundary | undefined;
137
+ selection?: RuntimeSelection;
138
+ content: RuntimeAgentMessageContent[];
139
+ };
140
+ export type RuntimeCompactionStatus = 'in_progress' | 'completed' | 'failed' | 'cancelled';
141
+ export type RuntimeCompaction = RuntimeSessionItemBase<'compaction'> & {
142
+ status: RuntimeCompactionStatus;
143
+ reason?: string | undefined;
144
+ beforeItemId?: string | undefined;
145
+ summary?: string | undefined;
146
+ retainedContext?: string | undefined;
147
+ error?: RuntimeError | undefined;
148
+ cancellation?: RuntimeError | undefined;
149
+ };
150
+ export type RuntimeUnknownSessionItem = RuntimeSessionItemBase<'unknown'> & {
151
+ originalType: string;
152
+ payload: unknown;
153
+ };
154
+ export type RuntimeSessionItem = RuntimeUserMessage | RuntimeAgentMessage | RuntimeCompaction | RuntimeUnknownSessionItem;
155
+ 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';
156
+ export type RuntimeSessionItemEventWire = {
157
+ eventId: string;
158
+ previousEventId: string | null;
159
+ sessionId: string;
160
+ commandId?: string | undefined;
161
+ type: 'session_item.created' | 'session_item.updated';
162
+ createdAt: string;
163
+ payload: {
164
+ item: RuntimeSessionItem;
165
+ };
166
+ };
167
+ export type RuntimePendingInputCreatedEventWire = {
168
+ eventId: string;
169
+ previousEventId: string | null;
23
170
  sessionId: string;
24
- userMessageId: string;
25
- runId: string;
171
+ commandId?: string | undefined;
172
+ type: 'pending_input.created';
173
+ createdAt: string;
174
+ payload: {
175
+ pendingInput: {
176
+ id: string;
177
+ sessionId: string;
178
+ commandId: string;
179
+ text: string;
180
+ requestedSelection?: Partial<RuntimeSelection> | undefined;
181
+ selection?: RuntimeSelection | undefined;
182
+ createdAt: string;
183
+ };
184
+ };
26
185
  };
27
- export type RuntimeContinueRunParams = {
28
- responseId: string;
29
- runId: string;
186
+ export type RuntimePendingInputCommittedEventWire = {
187
+ eventId: string;
188
+ previousEventId: string | null;
189
+ sessionId: string;
190
+ commandId?: string | undefined;
191
+ type: 'pending_input.committed';
192
+ createdAt: string;
193
+ payload: {
194
+ pendingInputId: string;
195
+ commandId: string;
196
+ itemId: string;
197
+ };
198
+ };
199
+ export type RuntimeSessionExecutionEventWire = {
200
+ eventId: string;
201
+ previousEventId: string | null;
202
+ sessionId: string;
203
+ type: 'session_execution.updated';
204
+ createdAt: string;
205
+ payload: {
206
+ execution: RuntimeSessionExecution;
207
+ };
208
+ };
209
+ export type RuntimeSessionItemContentDeltaEventWire = {
210
+ eventId: string;
211
+ previousEventId: string | null;
212
+ sessionId: string;
213
+ type: 'session_item.content_delta';
214
+ createdAt: string;
215
+ payload: {
216
+ itemId: string;
217
+ partId: string;
218
+ partType: 'text';
219
+ delta: string;
220
+ };
221
+ };
222
+ export type RuntimeSessionItemPartCreatedEventWire = {
223
+ eventId: string;
224
+ previousEventId: string | null;
225
+ sessionId: string;
226
+ type: 'session_item.part.created';
227
+ createdAt: string;
228
+ payload: {
229
+ itemId: string;
230
+ part: RuntimeTextContent & {
231
+ id: string;
232
+ };
233
+ };
234
+ };
235
+ export type RuntimeSessionCreatedEventWire = {
236
+ eventId: string;
237
+ previousEventId: null;
238
+ sessionId: string;
239
+ type: 'session.created';
240
+ createdAt: string;
241
+ payload: {
242
+ session: RuntimeSession;
243
+ execution: RuntimeSessionExecution;
244
+ };
245
+ };
246
+ export type RuntimeUnknownEventWire = {
247
+ eventId: string;
248
+ previousEventId: string | null;
249
+ sessionId: string;
250
+ type: 'unknown';
251
+ originalType: string;
252
+ createdAt: string;
253
+ payload: Record<string, unknown>;
254
+ };
255
+ export type RuntimeEventWire = RuntimeSessionCreatedEventWire | RuntimePendingInputCreatedEventWire | RuntimePendingInputCommittedEventWire | RuntimeSessionItemEventWire | RuntimeSessionItemPartCreatedEventWire | RuntimeSessionItemContentDeltaEventWire | RuntimeSessionExecutionEventWire | RuntimeUnknownEventWire;
256
+ export type RuntimeCommandAck = {
257
+ commandId: string;
258
+ status: 'accepted';
259
+ };
260
+ export type RuntimeInputCommandAck = RuntimeCommandAck;
261
+ export type RuntimeStopCommandAck = RuntimeCommandAck;
262
+ export type RuntimeCreateSessionParams = {
30
263
  idempotencyKey: string;
264
+ title?: string;
31
265
  signal?: AbortSignal;
32
266
  };
33
- export type RuntimeContinueRunResult = {
34
- responseId: string;
35
- runId: string;
36
- status: Extract<RuntimeRunStatus, 'queued'>;
37
- };
38
- export type RuntimeGetSessionMessageRunParams = {
267
+ export type RuntimeGetSessionViewParams = {
39
268
  sessionId: string;
40
- assistantMessageId: string;
269
+ itemsLimit?: number;
270
+ itemsCursor?: string;
41
271
  signal?: AbortSignal;
42
272
  };
43
- export type RuntimeMessageRun = {
44
- responseId: string;
45
- runId: string;
46
- status: RuntimeRunStatus;
47
- reason: string | null;
273
+ export type RuntimeListSessionsParams = {
274
+ limit?: number;
275
+ cursor?: string;
276
+ signal?: AbortSignal;
48
277
  };
49
- export type RuntimeCancelRunParams = {
50
- responseId: string;
51
- runId: string;
52
- reason?: 'user.cancelled' | 'client.unsync';
278
+ export type RuntimeReadSessionEventsParams = {
279
+ sessionId: string;
280
+ afterEventId?: string;
281
+ limit?: number;
282
+ waitMs?: number;
53
283
  signal?: AbortSignal;
54
284
  };
55
- export type RuntimeCancelRunResult = {
56
- responseId: string;
57
- runId: string;
58
- status: Extract<RuntimeRunStatus, 'cancelled'>;
285
+ export type RuntimeSubmitSessionInputParams = {
286
+ sessionId: string;
287
+ idempotencyKey: string;
288
+ text: string;
289
+ selection?: RuntimeSelection;
290
+ signal?: AbortSignal;
59
291
  };
60
- export type RuntimeCommitToolOutputsParams = {
61
- responseId: string;
62
- runId: string;
63
- toolOutputs: RuntimeToolOutputCommitRequest[];
292
+ export type RuntimeStopSessionExecutionParams = {
293
+ sessionId: string;
294
+ idempotencyKey: string;
295
+ executionToken: string;
64
296
  signal?: AbortSignal;
65
297
  };
66
- 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: (_: {
298
+ export type RuntimeCreateSessionResult = {
299
+ session: RuntimeSession;
300
+ execution: RuntimeSessionExecution;
301
+ lastEventId: string;
302
+ capabilities: RuntimeSessionView['capabilities'];
303
+ items: RuntimeSessionView['items'];
304
+ pendingInput: RuntimeSessionView['pendingInput'];
305
+ ack: {
74
306
  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>>;
307
+ commandId: string;
308
+ status: 'accepted';
309
+ };
310
+ };
311
+ type RuntimeCommandCapability<TReason extends string> = {
312
+ available: true;
313
+ } | {
314
+ available: false;
315
+ reason: TReason;
316
+ };
317
+ export type RuntimeSessionView = {
318
+ session: RuntimeSession;
319
+ execution: RuntimeSessionExecution;
320
+ lastEventId: string | null;
321
+ capabilities: {
322
+ sendText: RuntimeCommandCapability<'session_unavailable' | 'maintenance'>;
323
+ stop: RuntimeCommandCapability<'execution_not_active' | 'session_unavailable' | 'maintenance'>;
324
+ };
325
+ items: {
326
+ entries: RuntimeSessionItem[];
327
+ continuityToken: string;
328
+ olderCursor: string | null;
329
+ newerCursor: string | null;
330
+ hasOlder: boolean;
331
+ hasNewer: boolean;
332
+ };
333
+ pendingInput: {
334
+ entries: RuntimePendingUserMessage[];
335
+ };
336
+ };
337
+ export type RuntimeListSessionsResult = {
338
+ items: RuntimeSessionSummary[];
339
+ nextCursor: string | null;
340
+ };
341
+ export type RuntimeSessionEventsPage = {
342
+ events: RuntimeEventWire[];
343
+ nextEventId: string | null;
344
+ };
345
+ export type RuntimeApi = {
346
+ getProfile: (_?: {
347
+ signal?: AbortSignal;
348
+ }) => Promise<RuntimeResult<RuntimeProfile>>;
349
+ createSession: (_: RuntimeCreateSessionParams) => Promise<RuntimeResult<RuntimeCreateSessionResult>>;
350
+ listSessions: (_?: RuntimeListSessionsParams) => Promise<RuntimeResult<RuntimeListSessionsResult>>;
351
+ getSessionView: (_: RuntimeGetSessionViewParams) => Promise<RuntimeResult<RuntimeSessionView>>;
352
+ readSessionEvents: (_: RuntimeReadSessionEventsParams) => Promise<RuntimeResult<RuntimeSessionEventsPage>>;
353
+ submitSessionInput: (_: RuntimeSubmitSessionInputParams) => Promise<RuntimeResult<RuntimeInputCommandAck>>;
354
+ stopSessionExecution: (_: RuntimeStopSessionExecutionParams) => Promise<RuntimeResult<RuntimeStopCommandAck>>;
88
355
  };
356
+ export declare function parseRuntimeError(input: unknown): RuntimeError;
357
+ export declare function parseRuntimeProfile(input: unknown): RuntimeProfile;
358
+ export declare function parseRuntimeSession(input: unknown): RuntimeSession;
359
+ export declare function parseRuntimeSessionExecution(input: unknown): RuntimeSessionExecution;
360
+ export declare function parseRuntimeContent(input: unknown, contentIndex?: number): RuntimeContent;
361
+ export declare function parseRuntimeSessionItem(input: unknown): RuntimeSessionItem;
362
+ export declare function parseRuntimeEventWire(input: unknown): RuntimeEventWire;
363
+ export declare function parseRuntimeSessionEventsPage(input: unknown): RuntimeSessionEventsPage;
364
+ export declare function parseRuntimeCommandAck(input: unknown): RuntimeCommandAck;
365
+ export declare function parseRuntimeInputCommandAck(input: unknown): RuntimeInputCommandAck;
366
+ export declare function parseRuntimeStopCommandAck(input: unknown): RuntimeStopCommandAck;
367
+ export declare function parseRuntimeCreateSessionResult(input: unknown): RuntimeCreateSessionResult;
368
+ export declare function parseRuntimeSessionView(input: unknown): RuntimeSessionView;
369
+ export declare function parseRuntimeListSessionsResult(input: unknown): RuntimeListSessionsResult;
370
+ 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.0",
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';
package/dist/message.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { MessageFeedbackType } from './feedback';
2
- import { MessagePart } from './part';
3
- import { MessageStatus } from './status';
4
- export type MessageRole = 'user' | 'assistant' | 'system';
5
- export interface Message {
6
- id: string;
7
- role: MessageRole;
8
- parts: MessagePart[];
9
- createdAt: Date;
10
- status?: MessageStatus | undefined;
11
- policy?: unknown | undefined;
12
- rebased?: boolean | undefined;
13
- feedbackType?: MessageFeedbackType | null | undefined;
14
- feedbackReason?: string | null | undefined;
15
- feedbackUpdatedAt?: Date | null | undefined;
16
- }
@@ -1,46 +0,0 @@
1
- import { MessageFeedback } from './feedback';
2
- import { Message } from './message';
3
- import { MessagePart, MessagePartUnknown } from './part';
4
- import { MessageStatus, MessageStatusCode, MessageStatusReason } from './status';
5
- export type RuntimeMessage = Message;
6
- export type RuntimeMessageFeedback = MessageFeedback;
7
- export type RuntimeMessagePart = MessagePart;
8
- export type RuntimeUnknownMessagePart = MessagePartUnknown;
9
- export type RuntimeMessageStatus = MessageStatus;
10
- export type RuntimeMessageStatusCode = MessageStatusCode;
11
- export type RuntimeMessageStatusReason = MessageStatusReason;
12
- export type RuntimeMessagePage = {
13
- items: Message[];
14
- nextCursor: string | null;
15
- };
16
- export type RuntimeMessageQueryDirection = 'after' | 'before';
17
- export type RuntimeGetSessionMessagesParams = {
18
- sessionId: string;
19
- limit?: number;
20
- cursor?: string;
21
- direction?: RuntimeMessageQueryDirection;
22
- };
23
- export type RuntimeRespondUserMessagePart = {
24
- type: string;
25
- text?: string;
26
- state?: string;
27
- name?: string;
28
- toolCallId?: string;
29
- input?: unknown;
30
- output?: unknown;
31
- error?: string;
32
- [key: string]: unknown;
33
- };
34
- export type RuntimeRespondUserMessage = {
35
- id: string;
36
- role: 'user';
37
- parts: RuntimeRespondUserMessagePart[];
38
- };
39
- export type RuntimeSetMessageFeedbackParams = {
40
- sessionId: string;
41
- messageId: string;
42
- feedbackType: 'like' | 'dislike';
43
- reason?: string;
44
- };
45
- export type { RuntimeAssistantFilePart, RuntimeAssistantPart, RuntimeAssistantProviderMetadata, RuntimeAssistantReasoningPart, RuntimeAssistantSourceDocumentPart, RuntimeAssistantSourceUrlPart, RuntimeAssistantTextPart, RuntimeAssistantToolApproval, RuntimeAssistantToolPart, RuntimeAssistantToolPartState, RuntimeAssistantUnknownPart, } from './assistant-parts';
46
- export { collectPendingToolCallIdsFromAssistantParts, toDefaultStatusFromAssistantParts, } from './assistant-parts';