@opengeni/sdk 0.1.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 +157 -0
- package/dist/index.d.ts +1196 -0
- package/dist/index.js +955 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
- package/src/client.ts +846 -0
- package/src/errors.ts +40 -0
- package/src/index.ts +142 -0
- package/src/proxy.ts +171 -0
- package/src/sse.ts +90 -0
- package/src/stream.ts +192 -0
- package/src/types.ts +1036 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,1036 @@
|
|
|
1
|
+
// Hand-written mirrors of the public wire shapes in `@opengeni/contracts`.
|
|
2
|
+
// The SDK keeps zero runtime dependencies so it stays framework-agnostic and
|
|
3
|
+
// publishable on its own; `test/contract-parity.test.ts` pins these types to
|
|
4
|
+
// the contracts package so drift fails the gate instead of shipping.
|
|
5
|
+
|
|
6
|
+
export type SessionStatus =
|
|
7
|
+
| "queued"
|
|
8
|
+
| "running"
|
|
9
|
+
| "idle"
|
|
10
|
+
| "requires_action"
|
|
11
|
+
| "failed"
|
|
12
|
+
| "cancelled";
|
|
13
|
+
|
|
14
|
+
export type SandboxBackend = "docker" | "modal" | "local" | "none";
|
|
15
|
+
|
|
16
|
+
export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
17
|
+
|
|
18
|
+
export type RepositoryResourceRef = {
|
|
19
|
+
kind: "repository";
|
|
20
|
+
uri: string;
|
|
21
|
+
ref: string;
|
|
22
|
+
mountPath?: string | undefined;
|
|
23
|
+
subpath?: string | undefined;
|
|
24
|
+
githubInstallationId?: number | undefined;
|
|
25
|
+
githubRepositoryId?: number | undefined;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type FileResourceRef = {
|
|
29
|
+
kind: "file";
|
|
30
|
+
fileId: string;
|
|
31
|
+
mountPath?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type ResourceRef = RepositoryResourceRef | FileResourceRef;
|
|
35
|
+
|
|
36
|
+
export type ToolRef = {
|
|
37
|
+
kind: "mcp";
|
|
38
|
+
id: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type GoalSpec = {
|
|
42
|
+
text: string;
|
|
43
|
+
successCriteria?: string | undefined;
|
|
44
|
+
maxAutoContinuations?: number | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type Session = {
|
|
48
|
+
id: string;
|
|
49
|
+
workspaceId: string;
|
|
50
|
+
accountId: string;
|
|
51
|
+
status: SessionStatus;
|
|
52
|
+
initialMessage: string;
|
|
53
|
+
resources: ResourceRef[];
|
|
54
|
+
tools: ToolRef[];
|
|
55
|
+
metadata: Record<string, unknown>;
|
|
56
|
+
model: string;
|
|
57
|
+
sandboxBackend: SandboxBackend;
|
|
58
|
+
environmentId: string | null;
|
|
59
|
+
firstPartyMcpPermissions: string[] | null;
|
|
60
|
+
createIdempotencyKey: string | null;
|
|
61
|
+
temporalWorkflowId: string | null;
|
|
62
|
+
activeTurnId: string | null;
|
|
63
|
+
lastSequence: number;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
updatedAt: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type SessionTurnStatus =
|
|
69
|
+
| "queued"
|
|
70
|
+
| "running"
|
|
71
|
+
| "requires_action"
|
|
72
|
+
| "completed"
|
|
73
|
+
| "failed"
|
|
74
|
+
| "cancelled";
|
|
75
|
+
|
|
76
|
+
export type SessionTurnSource = "user" | "scheduled_task" | "api" | "goal";
|
|
77
|
+
|
|
78
|
+
export type SessionTurn = {
|
|
79
|
+
id: string;
|
|
80
|
+
workspaceId: string;
|
|
81
|
+
sessionId: string;
|
|
82
|
+
triggerEventId: string;
|
|
83
|
+
temporalWorkflowId: string;
|
|
84
|
+
status: SessionTurnStatus;
|
|
85
|
+
source: SessionTurnSource;
|
|
86
|
+
position: number;
|
|
87
|
+
prompt: string;
|
|
88
|
+
resources: ResourceRef[];
|
|
89
|
+
tools: ToolRef[];
|
|
90
|
+
model: string;
|
|
91
|
+
reasoningEffort: ReasoningEffort;
|
|
92
|
+
sandboxBackend: SandboxBackend;
|
|
93
|
+
metadata: Record<string, unknown>;
|
|
94
|
+
startedAt: string | null;
|
|
95
|
+
finishedAt: string | null;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
updatedAt: string;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const SESSION_EVENT_TYPES = [
|
|
101
|
+
"session.created",
|
|
102
|
+
"session.status.changed",
|
|
103
|
+
"session.requiresAction",
|
|
104
|
+
"session.context.compacted",
|
|
105
|
+
"session.context.cleared",
|
|
106
|
+
"user.message",
|
|
107
|
+
"user.interrupt",
|
|
108
|
+
"user.approvalDecision",
|
|
109
|
+
"turn.queued",
|
|
110
|
+
"turn.updated",
|
|
111
|
+
"turn.started",
|
|
112
|
+
"turn.completed",
|
|
113
|
+
"turn.failed",
|
|
114
|
+
"turn.cancelled",
|
|
115
|
+
"turn.preempted",
|
|
116
|
+
"agent.message.delta",
|
|
117
|
+
"agent.message.completed",
|
|
118
|
+
"agent.reasoning.delta",
|
|
119
|
+
"agent.toolCall.created",
|
|
120
|
+
"agent.toolCall.output",
|
|
121
|
+
"agent.updated",
|
|
122
|
+
"sandbox.operation.started",
|
|
123
|
+
"sandbox.operation.completed",
|
|
124
|
+
"sandbox.operation.failed",
|
|
125
|
+
"sandbox.command.output.delta",
|
|
126
|
+
"artifact.created",
|
|
127
|
+
"goal.set",
|
|
128
|
+
"goal.updated",
|
|
129
|
+
"goal.completed",
|
|
130
|
+
"goal.paused",
|
|
131
|
+
"goal.resumed",
|
|
132
|
+
"goal.continuation",
|
|
133
|
+
] as const;
|
|
134
|
+
|
|
135
|
+
export type KnownSessionEventType = (typeof SESSION_EVENT_TYPES)[number];
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Event types the SDK knows about today, kept open so a newer OpenGeni server
|
|
139
|
+
* can introduce event types without breaking older SDK consumers.
|
|
140
|
+
*/
|
|
141
|
+
export type SessionEventType = KnownSessionEventType | (string & {});
|
|
142
|
+
|
|
143
|
+
export type SessionEvent = {
|
|
144
|
+
id: string;
|
|
145
|
+
workspaceId: string;
|
|
146
|
+
sessionId: string;
|
|
147
|
+
/** Per-session sequence number: positive, contiguous, strictly increasing. */
|
|
148
|
+
sequence: number;
|
|
149
|
+
type: SessionEventType;
|
|
150
|
+
payload: unknown;
|
|
151
|
+
occurredAt: string;
|
|
152
|
+
clientEventId?: string | null | undefined;
|
|
153
|
+
turnId?: string | null | undefined;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// Payload shapes for the high-traffic event types. `SessionEvent.payload` is
|
|
157
|
+
// `unknown` on the wire; these are the documented shapes producers emit today.
|
|
158
|
+
export type AgentTextDeltaPayload = { text: string };
|
|
159
|
+
export type AgentMessageCompletedPayload = { text: string };
|
|
160
|
+
export type AgentToolCallCreatedPayload = {
|
|
161
|
+
id: string | null;
|
|
162
|
+
name: string;
|
|
163
|
+
arguments: unknown;
|
|
164
|
+
raw?: unknown | undefined;
|
|
165
|
+
};
|
|
166
|
+
export type AgentToolCallOutputPayload = { id: string | null; output: unknown };
|
|
167
|
+
export type SessionStatusChangedPayload = { status: SessionStatus };
|
|
168
|
+
|
|
169
|
+
export type ScheduledTaskStatus = "active" | "paused";
|
|
170
|
+
|
|
171
|
+
export type ScheduledTaskRunMode = "new_session_per_run" | "reusable_session";
|
|
172
|
+
|
|
173
|
+
export type ScheduledTaskOverlapPolicy = "allow_concurrent" | "skip" | "buffer_one";
|
|
174
|
+
|
|
175
|
+
export type ScheduledTaskDayOfWeek =
|
|
176
|
+
| "SUNDAY"
|
|
177
|
+
| "MONDAY"
|
|
178
|
+
| "TUESDAY"
|
|
179
|
+
| "WEDNESDAY"
|
|
180
|
+
| "THURSDAY"
|
|
181
|
+
| "FRIDAY"
|
|
182
|
+
| "SATURDAY";
|
|
183
|
+
|
|
184
|
+
export type ScheduledTaskScheduleSpec =
|
|
185
|
+
| { type: "once"; runAt: string; timeZone: string }
|
|
186
|
+
| {
|
|
187
|
+
type: "interval";
|
|
188
|
+
everySeconds: number;
|
|
189
|
+
startAt?: string | undefined;
|
|
190
|
+
endAt?: string | undefined;
|
|
191
|
+
}
|
|
192
|
+
| {
|
|
193
|
+
type: "calendar";
|
|
194
|
+
timeZone: string;
|
|
195
|
+
hour: number;
|
|
196
|
+
minute: number;
|
|
197
|
+
daysOfWeek?: ScheduledTaskDayOfWeek[] | undefined;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export type ScheduledTaskAgentConfig = {
|
|
201
|
+
prompt: string;
|
|
202
|
+
resources: ResourceRef[];
|
|
203
|
+
tools: ToolRef[];
|
|
204
|
+
metadata: Record<string, unknown>;
|
|
205
|
+
model?: string | undefined;
|
|
206
|
+
reasoningEffort?: ReasoningEffort | undefined;
|
|
207
|
+
sandboxBackend?: SandboxBackend | undefined;
|
|
208
|
+
goal?: GoalSpec | undefined;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export type ScheduledTask = {
|
|
212
|
+
id: string;
|
|
213
|
+
accountId: string;
|
|
214
|
+
workspaceId: string;
|
|
215
|
+
name: string;
|
|
216
|
+
status: ScheduledTaskStatus;
|
|
217
|
+
schedule: ScheduledTaskScheduleSpec;
|
|
218
|
+
temporalScheduleId: string;
|
|
219
|
+
runMode: ScheduledTaskRunMode;
|
|
220
|
+
overlapPolicy: ScheduledTaskOverlapPolicy;
|
|
221
|
+
agentConfig: ScheduledTaskAgentConfig;
|
|
222
|
+
reusableSessionId: string | null;
|
|
223
|
+
environmentId: string | null;
|
|
224
|
+
metadata: Record<string, unknown>;
|
|
225
|
+
createdAt: string;
|
|
226
|
+
updatedAt: string;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export type CreateSessionRequest = {
|
|
230
|
+
initialMessage: string;
|
|
231
|
+
resources?: ResourceRef[] | undefined;
|
|
232
|
+
tools?: ToolRef[] | undefined;
|
|
233
|
+
metadata?: Record<string, unknown> | undefined;
|
|
234
|
+
model?: string | undefined;
|
|
235
|
+
reasoningEffort?: ReasoningEffort | undefined;
|
|
236
|
+
sandboxBackend?: SandboxBackend | undefined;
|
|
237
|
+
environmentId?: string | undefined;
|
|
238
|
+
goal?: GoalSpec | undefined;
|
|
239
|
+
clientEventId?: string | undefined;
|
|
240
|
+
// Workspace-scoped CREATE idempotency key: forward a STABLE value to make a
|
|
241
|
+
// double-submit/retry of the same logical create collapse to one session.
|
|
242
|
+
// Distinct from the per-call clientEventId.
|
|
243
|
+
idempotencyKey?: string | undefined;
|
|
244
|
+
firstPartyMcpPermissions?: string[] | undefined;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
// --- Access, workspaces, API keys -------------------------------------------
|
|
248
|
+
|
|
249
|
+
export const KNOWN_PERMISSIONS = [
|
|
250
|
+
"account:read",
|
|
251
|
+
"account:admin",
|
|
252
|
+
"members:manage",
|
|
253
|
+
"workspace:create",
|
|
254
|
+
"billing:read",
|
|
255
|
+
"billing:manage",
|
|
256
|
+
"workspace:read",
|
|
257
|
+
"workspace:admin",
|
|
258
|
+
"sessions:create",
|
|
259
|
+
"sessions:read",
|
|
260
|
+
"sessions:control",
|
|
261
|
+
"files:upload",
|
|
262
|
+
"files:read",
|
|
263
|
+
"documents:manage",
|
|
264
|
+
"documents:search",
|
|
265
|
+
"scheduled_tasks:manage",
|
|
266
|
+
"scheduled_tasks:run",
|
|
267
|
+
"github:manage",
|
|
268
|
+
"github:use",
|
|
269
|
+
"api_keys:manage",
|
|
270
|
+
"environments:manage",
|
|
271
|
+
"environments:use",
|
|
272
|
+
"goals:manage",
|
|
273
|
+
] as const;
|
|
274
|
+
|
|
275
|
+
export type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Permissions the SDK knows about today, kept open so a newer OpenGeni server
|
|
279
|
+
* can introduce permissions without breaking older SDK consumers.
|
|
280
|
+
*/
|
|
281
|
+
export type Permission = KnownPermission | (string & {});
|
|
282
|
+
|
|
283
|
+
export type ProductAccessMode = "local" | "configured" | "managed";
|
|
284
|
+
|
|
285
|
+
export type AccountRole = "owner" | "admin" | "member";
|
|
286
|
+
|
|
287
|
+
export type AccountGrant = {
|
|
288
|
+
accountId: string;
|
|
289
|
+
subjectId: string;
|
|
290
|
+
subjectLabel?: string | undefined;
|
|
291
|
+
role?: AccountRole | undefined;
|
|
292
|
+
permissions: Permission[];
|
|
293
|
+
metadata?: Record<string, unknown> | undefined;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export type AccessGrant = {
|
|
297
|
+
workspaceId: string;
|
|
298
|
+
accountId: string;
|
|
299
|
+
subjectId: string;
|
|
300
|
+
subjectLabel?: string | undefined;
|
|
301
|
+
permissions: Permission[];
|
|
302
|
+
metadata?: Record<string, unknown> | undefined;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export type AccessContext = {
|
|
306
|
+
mode: ProductAccessMode;
|
|
307
|
+
subjectId: string;
|
|
308
|
+
subjectLabel?: string | undefined;
|
|
309
|
+
accountGrants: AccountGrant[];
|
|
310
|
+
workspaceGrants: AccessGrant[];
|
|
311
|
+
defaultAccountId: string | null;
|
|
312
|
+
defaultWorkspaceId: string | null;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
export type Workspace = {
|
|
316
|
+
id: string;
|
|
317
|
+
accountId: string;
|
|
318
|
+
name: string;
|
|
319
|
+
slug: string | null;
|
|
320
|
+
externalSource: string | null;
|
|
321
|
+
externalId: string | null;
|
|
322
|
+
agentInstructions: string | null;
|
|
323
|
+
createdAt: string;
|
|
324
|
+
updatedAt: string;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export type CreateWorkspaceRequest = {
|
|
328
|
+
accountId?: string | undefined;
|
|
329
|
+
name: string;
|
|
330
|
+
slug?: string | undefined;
|
|
331
|
+
externalSource?: string | undefined;
|
|
332
|
+
externalId?: string | undefined;
|
|
333
|
+
agentInstructions?: string | null | undefined;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export type UpdateWorkspaceRequest = {
|
|
337
|
+
name?: string | undefined;
|
|
338
|
+
slug?: string | null | undefined;
|
|
339
|
+
agentInstructions?: string | null | undefined;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export type ApiKey = {
|
|
343
|
+
id: string;
|
|
344
|
+
accountId: string;
|
|
345
|
+
workspaceId: string | null;
|
|
346
|
+
name: string;
|
|
347
|
+
prefix: string;
|
|
348
|
+
permissions: Permission[];
|
|
349
|
+
expiresAt: string | null;
|
|
350
|
+
revokedAt: string | null;
|
|
351
|
+
lastUsedAt: string | null;
|
|
352
|
+
createdAt: string;
|
|
353
|
+
updatedAt: string;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
export type CreateApiKeyRequest = {
|
|
357
|
+
name: string;
|
|
358
|
+
permissions: Permission[];
|
|
359
|
+
expiresAt?: string | undefined;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
export type CreateApiKeyResponse = {
|
|
363
|
+
apiKey: ApiKey;
|
|
364
|
+
/** The full secret token — shown once at creation, never returned again. */
|
|
365
|
+
token: string;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
export type ListApiKeysResponse = {
|
|
369
|
+
apiKeys: ApiKey[];
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
// --- Goals -------------------------------------------------------------------
|
|
373
|
+
|
|
374
|
+
export type SessionGoalStatus = "active" | "paused" | "completed";
|
|
375
|
+
|
|
376
|
+
export type SessionGoalCreatedBy = "api" | "agent" | "scheduled_task";
|
|
377
|
+
|
|
378
|
+
export type SessionGoal = {
|
|
379
|
+
id: string;
|
|
380
|
+
accountId: string;
|
|
381
|
+
workspaceId: string;
|
|
382
|
+
sessionId: string;
|
|
383
|
+
status: SessionGoalStatus;
|
|
384
|
+
text: string;
|
|
385
|
+
successCriteria: string | null;
|
|
386
|
+
evidence: string | null;
|
|
387
|
+
rationale: string | null;
|
|
388
|
+
pausedReason: string | null;
|
|
389
|
+
createdBy: SessionGoalCreatedBy;
|
|
390
|
+
version: number;
|
|
391
|
+
autoContinuations: number;
|
|
392
|
+
noProgressStreak: number;
|
|
393
|
+
maxAutoContinuations: number | null;
|
|
394
|
+
metadata: Record<string, unknown>;
|
|
395
|
+
createdAt: string;
|
|
396
|
+
updatedAt: string;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
export type UpdateSessionGoalRequest = {
|
|
400
|
+
status: "paused" | "active";
|
|
401
|
+
rationale?: string | undefined;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// --- Operator context controls (/clear, /compact) ----------------------------
|
|
405
|
+
|
|
406
|
+
/** Outcome of a manual /compact trigger. */
|
|
407
|
+
export type CompactSessionContextResult = {
|
|
408
|
+
/**
|
|
409
|
+
* queued: a client-side (Azure) compaction will run before the next turn.
|
|
410
|
+
* noop: nothing to do (server-managed provider, mode off, or no history).
|
|
411
|
+
*/
|
|
412
|
+
status: "queued" | "noop";
|
|
413
|
+
message: string;
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
// --- Turn queue --------------------------------------------------------------
|
|
417
|
+
|
|
418
|
+
export type UpdateSessionTurnRequest = {
|
|
419
|
+
prompt?: string | undefined;
|
|
420
|
+
resources?: ResourceRef[] | undefined;
|
|
421
|
+
tools?: ToolRef[] | undefined;
|
|
422
|
+
model?: string | undefined;
|
|
423
|
+
reasoningEffort?: ReasoningEffort | undefined;
|
|
424
|
+
sandboxBackend?: SandboxBackend | undefined;
|
|
425
|
+
metadata?: Record<string, unknown> | undefined;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
// --- Scheduled tasks: requests + runs ----------------------------------------
|
|
429
|
+
|
|
430
|
+
/** Input shape for agent config on create/update (server applies defaults). */
|
|
431
|
+
export type ScheduledTaskAgentConfigInput = {
|
|
432
|
+
prompt: string;
|
|
433
|
+
resources?: ResourceRef[] | undefined;
|
|
434
|
+
tools?: ToolRef[] | undefined;
|
|
435
|
+
metadata?: Record<string, unknown> | undefined;
|
|
436
|
+
model?: string | undefined;
|
|
437
|
+
reasoningEffort?: ReasoningEffort | undefined;
|
|
438
|
+
sandboxBackend?: SandboxBackend | undefined;
|
|
439
|
+
goal?: GoalSpec | undefined;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export type CreateScheduledTaskRequest = {
|
|
443
|
+
name: string;
|
|
444
|
+
schedule: ScheduledTaskScheduleSpec;
|
|
445
|
+
runMode?: ScheduledTaskRunMode | undefined;
|
|
446
|
+
overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
|
|
447
|
+
agentConfig: ScheduledTaskAgentConfigInput;
|
|
448
|
+
status?: ScheduledTaskStatus | undefined;
|
|
449
|
+
environmentId?: string | null | undefined;
|
|
450
|
+
metadata?: Record<string, unknown> | undefined;
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
export type UpdateScheduledTaskRequest = {
|
|
454
|
+
name?: string | undefined;
|
|
455
|
+
schedule?: ScheduledTaskScheduleSpec | undefined;
|
|
456
|
+
runMode?: ScheduledTaskRunMode | undefined;
|
|
457
|
+
overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
|
|
458
|
+
agentConfig?: ScheduledTaskAgentConfigInput | undefined;
|
|
459
|
+
status?: ScheduledTaskStatus | undefined;
|
|
460
|
+
environmentId?: string | null | undefined;
|
|
461
|
+
metadata?: Record<string, unknown> | undefined;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
export type ScheduledTaskRunStatus = "queued" | "dispatched" | "failed";
|
|
465
|
+
|
|
466
|
+
export type ScheduledTaskTriggerType = "scheduled" | "manual";
|
|
467
|
+
|
|
468
|
+
export type ScheduledTaskRun = {
|
|
469
|
+
id: string;
|
|
470
|
+
accountId: string;
|
|
471
|
+
workspaceId: string;
|
|
472
|
+
taskId: string;
|
|
473
|
+
status: ScheduledTaskRunStatus;
|
|
474
|
+
triggerType: ScheduledTaskTriggerType;
|
|
475
|
+
scheduledAt: string | null;
|
|
476
|
+
firedAt: string;
|
|
477
|
+
sessionId: string | null;
|
|
478
|
+
triggerEventId: string | null;
|
|
479
|
+
error: string | null;
|
|
480
|
+
createdAt: string;
|
|
481
|
+
updatedAt: string;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
// --- Environments -------------------------------------------------------------
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Variable values are write-only by design: the API never returns a value, so
|
|
488
|
+
* reads expose name + version metadata only. Values are decrypted exclusively
|
|
489
|
+
* inside the worker at sandbox materialization time.
|
|
490
|
+
*/
|
|
491
|
+
export type WorkspaceEnvironmentVariableMetadata = {
|
|
492
|
+
name: string;
|
|
493
|
+
version: number;
|
|
494
|
+
createdAt: string;
|
|
495
|
+
updatedAt: string;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
export type WorkspaceEnvironment = {
|
|
499
|
+
id: string;
|
|
500
|
+
accountId: string;
|
|
501
|
+
workspaceId: string;
|
|
502
|
+
name: string;
|
|
503
|
+
description: string | null;
|
|
504
|
+
variables: WorkspaceEnvironmentVariableMetadata[];
|
|
505
|
+
createdAt: string;
|
|
506
|
+
updatedAt: string;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
export type CreateWorkspaceEnvironmentRequest = {
|
|
510
|
+
name: string;
|
|
511
|
+
description?: string | undefined;
|
|
512
|
+
/** Initial variables. Values are write-only: they never come back on reads. */
|
|
513
|
+
variables?: { name: string; value: string }[] | undefined;
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
export type UpdateWorkspaceEnvironmentRequest = {
|
|
517
|
+
name?: string | undefined;
|
|
518
|
+
description?: string | null | undefined;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
// --- Files ---------------------------------------------------------------------
|
|
522
|
+
|
|
523
|
+
export type FileStatus = "pending_upload" | "ready" | "failed" | "expired" | "deleted";
|
|
524
|
+
|
|
525
|
+
export type FileAsset = {
|
|
526
|
+
id: string;
|
|
527
|
+
workspaceId: string;
|
|
528
|
+
status: FileStatus;
|
|
529
|
+
filename: string;
|
|
530
|
+
safeFilename: string;
|
|
531
|
+
contentType: string;
|
|
532
|
+
sizeBytes: number;
|
|
533
|
+
sha256: string | null;
|
|
534
|
+
bucket: string;
|
|
535
|
+
objectKey: string;
|
|
536
|
+
createdAt: string;
|
|
537
|
+
updatedAt: string;
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
export type CreateFileUploadRequest = {
|
|
541
|
+
filename: string;
|
|
542
|
+
contentType: string;
|
|
543
|
+
sizeBytes: number;
|
|
544
|
+
sha256?: string | undefined;
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
export type CreateFileUploadResponse = {
|
|
548
|
+
fileId: string;
|
|
549
|
+
uploadId: string;
|
|
550
|
+
/** Pre-signed PUT URL for the file bytes (direct to object storage). */
|
|
551
|
+
putUrl: string;
|
|
552
|
+
/** Headers that MUST be sent with the PUT for the signature to validate. */
|
|
553
|
+
requiredHeaders: Record<string, string>;
|
|
554
|
+
expiresAt: string;
|
|
555
|
+
maxSizeBytes: number;
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
export type CompleteFileUploadResponse = {
|
|
559
|
+
file: FileAsset;
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
export type FileDownloadUrlResponse = {
|
|
563
|
+
url: string;
|
|
564
|
+
expiresAt: string;
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
/** Bytes accepted by the `uploadFile` helper. */
|
|
568
|
+
export type FileUploadData = Blob | ArrayBuffer | Uint8Array | string;
|
|
569
|
+
|
|
570
|
+
export type UploadFileInput = {
|
|
571
|
+
filename: string;
|
|
572
|
+
contentType: string;
|
|
573
|
+
data: FileUploadData;
|
|
574
|
+
sha256?: string | undefined;
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
// --- Documents -------------------------------------------------------------------
|
|
578
|
+
|
|
579
|
+
export type DocumentStatus = "queued" | "indexing" | "ready" | "failed";
|
|
580
|
+
|
|
581
|
+
export type DocumentBase = {
|
|
582
|
+
id: string;
|
|
583
|
+
workspaceId: string;
|
|
584
|
+
name: string;
|
|
585
|
+
description: string | null;
|
|
586
|
+
createdAt: string;
|
|
587
|
+
updatedAt: string;
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
export type Document = {
|
|
591
|
+
id: string;
|
|
592
|
+
workspaceId: string;
|
|
593
|
+
baseId: string;
|
|
594
|
+
fileId: string;
|
|
595
|
+
status: DocumentStatus;
|
|
596
|
+
title: string;
|
|
597
|
+
parser: string;
|
|
598
|
+
chunkCount: number;
|
|
599
|
+
error: string | null;
|
|
600
|
+
createdAt: string;
|
|
601
|
+
updatedAt: string;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
export type DocumentSearchResult = {
|
|
605
|
+
chunkId: string;
|
|
606
|
+
workspaceId: string;
|
|
607
|
+
documentId: string;
|
|
608
|
+
baseId: string;
|
|
609
|
+
fileId: string;
|
|
610
|
+
title: string;
|
|
611
|
+
text: string;
|
|
612
|
+
score: number;
|
|
613
|
+
chunkIndex: number;
|
|
614
|
+
metadata: Record<string, unknown>;
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
export type CreateDocumentBaseRequest = {
|
|
618
|
+
name: string;
|
|
619
|
+
description?: string | undefined;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
export type DocumentSearchRequest = {
|
|
623
|
+
query: string;
|
|
624
|
+
limit?: number | undefined;
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
export type DocumentSearchResponse = {
|
|
628
|
+
results: DocumentSearchResult[];
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
// --- Capability packs ---------------------------------------------------------
|
|
632
|
+
|
|
633
|
+
export type CapabilityPackConnectorAuthModel =
|
|
634
|
+
| "oauth2_authorization_code_pkce"
|
|
635
|
+
| "oauth2_authorization_code"
|
|
636
|
+
| "api_key"
|
|
637
|
+
| "credential_ref";
|
|
638
|
+
|
|
639
|
+
export type CapabilityPackConnector = {
|
|
640
|
+
id: string;
|
|
641
|
+
name: string;
|
|
642
|
+
category: string;
|
|
643
|
+
authModel: CapabilityPackConnectorAuthModel;
|
|
644
|
+
providers: string[];
|
|
645
|
+
scopes: string[];
|
|
646
|
+
required: boolean;
|
|
647
|
+
metadata: Record<string, unknown>;
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
export type CapabilityPackKnowledge = {
|
|
651
|
+
type: "document_base";
|
|
652
|
+
id: string;
|
|
653
|
+
name: string;
|
|
654
|
+
description: string | null;
|
|
655
|
+
required: boolean;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
export type CapabilityPackScheduledTaskTemplate = {
|
|
659
|
+
id: string;
|
|
660
|
+
name: string;
|
|
661
|
+
description: string;
|
|
662
|
+
defaultSchedule: ScheduledTaskScheduleSpec;
|
|
663
|
+
defaultRunMode: ScheduledTaskRunMode;
|
|
664
|
+
defaultOverlapPolicy: ScheduledTaskOverlapPolicy;
|
|
665
|
+
prompt?: string | undefined;
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
export type CapabilityPackSkillFile = {
|
|
669
|
+
path: string;
|
|
670
|
+
content: string;
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
export type CapabilityPackSkill = {
|
|
674
|
+
name: string;
|
|
675
|
+
description?: string | undefined;
|
|
676
|
+
files: CapabilityPackSkillFile[];
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
export type CapabilityPackEnvironmentSpec = {
|
|
680
|
+
description: string;
|
|
681
|
+
requiredVariables: string[];
|
|
682
|
+
required: boolean;
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
export type CapabilityPack = {
|
|
686
|
+
id: string;
|
|
687
|
+
name: string;
|
|
688
|
+
description: string;
|
|
689
|
+
role: string;
|
|
690
|
+
category: string;
|
|
691
|
+
version: string;
|
|
692
|
+
sandboxImage?: string | undefined;
|
|
693
|
+
skills: CapabilityPackSkill[];
|
|
694
|
+
tools: ToolRef[];
|
|
695
|
+
connectors: CapabilityPackConnector[];
|
|
696
|
+
knowledge: CapabilityPackKnowledge[];
|
|
697
|
+
scheduledTaskTemplates: CapabilityPackScheduledTaskTemplate[];
|
|
698
|
+
environment?: CapabilityPackEnvironmentSpec | undefined;
|
|
699
|
+
metadata: Record<string, unknown>;
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
/** Input shape for registering a pack manifest (server applies defaults). */
|
|
703
|
+
export type RegisterCapabilityPackRequest = {
|
|
704
|
+
id: string;
|
|
705
|
+
name: string;
|
|
706
|
+
description: string;
|
|
707
|
+
role: string;
|
|
708
|
+
category: string;
|
|
709
|
+
version: string;
|
|
710
|
+
sandboxImage?: string | undefined;
|
|
711
|
+
skills?: {
|
|
712
|
+
name: string;
|
|
713
|
+
description?: string | undefined;
|
|
714
|
+
files: CapabilityPackSkillFile[];
|
|
715
|
+
}[] | undefined;
|
|
716
|
+
tools?: ToolRef[] | undefined;
|
|
717
|
+
connectors?: {
|
|
718
|
+
id: string;
|
|
719
|
+
name: string;
|
|
720
|
+
category: string;
|
|
721
|
+
authModel: CapabilityPackConnectorAuthModel;
|
|
722
|
+
providers?: string[] | undefined;
|
|
723
|
+
scopes?: string[] | undefined;
|
|
724
|
+
required?: boolean | undefined;
|
|
725
|
+
metadata?: Record<string, unknown> | undefined;
|
|
726
|
+
}[] | undefined;
|
|
727
|
+
knowledge?: {
|
|
728
|
+
type: "document_base";
|
|
729
|
+
id: string;
|
|
730
|
+
name: string;
|
|
731
|
+
description?: string | null | undefined;
|
|
732
|
+
required?: boolean | undefined;
|
|
733
|
+
}[] | undefined;
|
|
734
|
+
scheduledTaskTemplates?: {
|
|
735
|
+
id: string;
|
|
736
|
+
name: string;
|
|
737
|
+
description: string;
|
|
738
|
+
defaultSchedule: ScheduledTaskScheduleSpec;
|
|
739
|
+
defaultRunMode?: ScheduledTaskRunMode | undefined;
|
|
740
|
+
defaultOverlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
|
|
741
|
+
prompt?: string | undefined;
|
|
742
|
+
}[] | undefined;
|
|
743
|
+
environment?: {
|
|
744
|
+
description: string;
|
|
745
|
+
requiredVariables?: string[] | undefined;
|
|
746
|
+
required?: boolean | undefined;
|
|
747
|
+
} | undefined;
|
|
748
|
+
metadata?: Record<string, unknown> | undefined;
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
export type WorkspaceRegisteredPack = {
|
|
752
|
+
accountId: string;
|
|
753
|
+
workspaceId: string;
|
|
754
|
+
pack: CapabilityPack;
|
|
755
|
+
createdAt: string;
|
|
756
|
+
updatedAt: string;
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
export type PackInstallationStatus = "active" | "disabled";
|
|
760
|
+
|
|
761
|
+
export type PackInstallation = {
|
|
762
|
+
id: string;
|
|
763
|
+
accountId: string;
|
|
764
|
+
workspaceId: string;
|
|
765
|
+
packId: string;
|
|
766
|
+
status: PackInstallationStatus;
|
|
767
|
+
metadata: Record<string, unknown>;
|
|
768
|
+
enabledAt: string;
|
|
769
|
+
updatedAt: string;
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
export type EnablePackRequest = {
|
|
773
|
+
environmentId?: string | undefined;
|
|
774
|
+
metadata?: Record<string, unknown> | undefined;
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
export type ListPacksResponse = {
|
|
778
|
+
packs: CapabilityPack[];
|
|
779
|
+
installations: PackInstallation[];
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
export type GetPackResponse = {
|
|
783
|
+
pack: CapabilityPack;
|
|
784
|
+
installation: PackInstallation | null;
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
// --- Capabilities ---------------------------------------------------------------
|
|
788
|
+
|
|
789
|
+
export type CapabilityKind = "pack" | "mcp" | "api" | "skill" | "plugin";
|
|
790
|
+
|
|
791
|
+
export type CapabilitySource = "built_in" | "configured" | "public_registry" | "manual";
|
|
792
|
+
|
|
793
|
+
export type CapabilityInstallationStatus = "active" | "disabled";
|
|
794
|
+
|
|
795
|
+
export type CapabilityRuntime = {
|
|
796
|
+
available: boolean;
|
|
797
|
+
mcpServerId?: string | undefined;
|
|
798
|
+
transport?: string | undefined;
|
|
799
|
+
notes: string | null;
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
export type CapabilityCatalogItem = {
|
|
803
|
+
id: string;
|
|
804
|
+
accountId?: string | undefined;
|
|
805
|
+
workspaceId?: string | undefined;
|
|
806
|
+
kind: CapabilityKind;
|
|
807
|
+
source: CapabilitySource;
|
|
808
|
+
name: string;
|
|
809
|
+
description: string | null;
|
|
810
|
+
category: string;
|
|
811
|
+
tags: string[];
|
|
812
|
+
homepageUrl: string | null;
|
|
813
|
+
endpointUrl: string | null;
|
|
814
|
+
installUrl: string | null;
|
|
815
|
+
authModel: string | null;
|
|
816
|
+
tools: ToolRef[];
|
|
817
|
+
runtime: CapabilityRuntime;
|
|
818
|
+
enabled: boolean;
|
|
819
|
+
enabledReason: string | null;
|
|
820
|
+
metadata: Record<string, unknown>;
|
|
821
|
+
createdAt?: string | undefined;
|
|
822
|
+
updatedAt?: string | undefined;
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
export type CapabilityInstallation = {
|
|
826
|
+
id: string;
|
|
827
|
+
accountId: string;
|
|
828
|
+
workspaceId: string;
|
|
829
|
+
capabilityId: string;
|
|
830
|
+
kind: CapabilityKind;
|
|
831
|
+
status: CapabilityInstallationStatus;
|
|
832
|
+
config: Record<string, unknown>;
|
|
833
|
+
metadata: Record<string, unknown>;
|
|
834
|
+
enabledAt: string;
|
|
835
|
+
updatedAt: string;
|
|
836
|
+
};
|
|
837
|
+
|
|
838
|
+
export type CapabilityCatalogResponse = {
|
|
839
|
+
items: CapabilityCatalogItem[];
|
|
840
|
+
installations: CapabilityInstallation[];
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
export type CreateCapabilityCatalogItemRequest = {
|
|
844
|
+
id?: string | undefined;
|
|
845
|
+
kind: Exclude<CapabilityKind, "pack">;
|
|
846
|
+
source?: CapabilitySource | undefined;
|
|
847
|
+
name: string;
|
|
848
|
+
description?: string | undefined;
|
|
849
|
+
category?: string | undefined;
|
|
850
|
+
tags?: string[] | undefined;
|
|
851
|
+
homepageUrl?: string | undefined;
|
|
852
|
+
endpointUrl?: string | undefined;
|
|
853
|
+
installUrl?: string | undefined;
|
|
854
|
+
authModel?: string | undefined;
|
|
855
|
+
metadata?: Record<string, unknown> | undefined;
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
export type EnableCapabilityRequest = {
|
|
859
|
+
config?: Record<string, unknown> | undefined;
|
|
860
|
+
metadata?: Record<string, unknown> | undefined;
|
|
861
|
+
/**
|
|
862
|
+
* Credential headers for remote MCP capabilities. Write-only: encrypted at
|
|
863
|
+
* rest, injected only into the runtime MCP client, never returned by the
|
|
864
|
+
* API (responses expose header names only).
|
|
865
|
+
*/
|
|
866
|
+
headers?: Record<string, string> | undefined;
|
|
867
|
+
/**
|
|
868
|
+
* Initial environment attachment for kind=pack capabilities — mirrors the
|
|
869
|
+
* dedicated POST /packs/:id/enable body. Required to enable an
|
|
870
|
+
* environment.required pack through this unified path; ignored otherwise.
|
|
871
|
+
*/
|
|
872
|
+
environmentId?: string | undefined;
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
export type DiscoverMcpCapabilitiesResponse = {
|
|
876
|
+
items: CapabilityCatalogItem[];
|
|
877
|
+
source: "official_mcp_registry";
|
|
878
|
+
sourceUrl: string;
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
// --- GitHub ---------------------------------------------------------------------
|
|
882
|
+
|
|
883
|
+
export type GitHubRepository = {
|
|
884
|
+
id: number;
|
|
885
|
+
installationId: number;
|
|
886
|
+
fullName: string;
|
|
887
|
+
name: string;
|
|
888
|
+
private: boolean;
|
|
889
|
+
htmlUrl: string;
|
|
890
|
+
cloneUrl: string;
|
|
891
|
+
defaultBranch: string;
|
|
892
|
+
accountLogin: string;
|
|
893
|
+
accountType: string | null;
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
export type GitHubAppInfo = {
|
|
897
|
+
configured: boolean;
|
|
898
|
+
appId: string | null;
|
|
899
|
+
clientId: string | null;
|
|
900
|
+
appSlug: string | null;
|
|
901
|
+
/** Ready-to-open GitHub install URL (carries the signed state), if configured. */
|
|
902
|
+
installUrl: string | null;
|
|
903
|
+
/** Setting names still missing when `configured` is false. */
|
|
904
|
+
missing: string[];
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
export type GitHubRepositoriesResponse = {
|
|
908
|
+
repositories: GitHubRepository[];
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
export type CreateGitHubAppManifestRequest = {
|
|
912
|
+
appName?: string | undefined;
|
|
913
|
+
organization?: string | undefined;
|
|
914
|
+
public?: boolean | undefined;
|
|
915
|
+
includeCiPermissions?: boolean | undefined;
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
export type CreateGitHubAppManifestResponse = {
|
|
919
|
+
/** GitHub URL to POST the manifest to (personal or organization flow). */
|
|
920
|
+
actionUrl: string;
|
|
921
|
+
state: string;
|
|
922
|
+
manifest: Record<string, unknown>;
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
// --- Billing --------------------------------------------------------------------
|
|
926
|
+
|
|
927
|
+
export type BillingMode = "disabled" | "stripe";
|
|
928
|
+
|
|
929
|
+
export type EntitlementsMode = "none" | "static" | "managed";
|
|
930
|
+
|
|
931
|
+
export type BillingBalance = {
|
|
932
|
+
accountId: string;
|
|
933
|
+
balanceMicros: number;
|
|
934
|
+
currency: "usd";
|
|
935
|
+
updatedAt: string;
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
export const KNOWN_USAGE_EVENT_TYPES = [
|
|
939
|
+
"agent_run.created",
|
|
940
|
+
"agent_run.completed",
|
|
941
|
+
"model.tokens",
|
|
942
|
+
"model.cost",
|
|
943
|
+
"file.uploaded",
|
|
944
|
+
"file.deleted",
|
|
945
|
+
"document.indexed",
|
|
946
|
+
"scheduled_task.fired",
|
|
947
|
+
"api_key.request",
|
|
948
|
+
] as const;
|
|
949
|
+
|
|
950
|
+
export type KnownUsageEventType = (typeof KNOWN_USAGE_EVENT_TYPES)[number];
|
|
951
|
+
|
|
952
|
+
export type UsageEventType = KnownUsageEventType | (string & {});
|
|
953
|
+
|
|
954
|
+
export type UsageEvent = {
|
|
955
|
+
id: string;
|
|
956
|
+
workspaceId: string;
|
|
957
|
+
accountId: string;
|
|
958
|
+
subjectId: string | null;
|
|
959
|
+
eventType: UsageEventType;
|
|
960
|
+
quantity: number;
|
|
961
|
+
unit: string;
|
|
962
|
+
sourceResourceType: string | null;
|
|
963
|
+
sourceResourceId: string | null;
|
|
964
|
+
idempotencyKey: string;
|
|
965
|
+
occurredAt: string;
|
|
966
|
+
recordedAt: string;
|
|
967
|
+
exportedToBillingAt: string | null;
|
|
968
|
+
billingProviderEventId: string | null;
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
export type EntitlementValue = boolean | string | number | string[];
|
|
972
|
+
|
|
973
|
+
export type Entitlements = Record<string, EntitlementValue>;
|
|
974
|
+
|
|
975
|
+
export type BillingSummary = {
|
|
976
|
+
mode: BillingMode;
|
|
977
|
+
balance: BillingBalance;
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
export type BillingUsageResponse = {
|
|
981
|
+
balance: BillingBalance;
|
|
982
|
+
usage: UsageEvent[];
|
|
983
|
+
};
|
|
984
|
+
|
|
985
|
+
export type BillingEntitlementsResponse = {
|
|
986
|
+
accountId: string;
|
|
987
|
+
mode: EntitlementsMode;
|
|
988
|
+
entitlements: Entitlements;
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
export type CreateCheckoutRequest = {
|
|
992
|
+
accountId?: string | undefined;
|
|
993
|
+
/** USD amount with cent precision (server enforces min/max). */
|
|
994
|
+
amountUsd: number;
|
|
995
|
+
successUrl?: string | undefined;
|
|
996
|
+
cancelUrl?: string | undefined;
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
export type CreateCheckoutResponse = {
|
|
1000
|
+
checkoutSessionId: string;
|
|
1001
|
+
url: string;
|
|
1002
|
+
};
|
|
1003
|
+
|
|
1004
|
+
export type UserMessageEventInput = {
|
|
1005
|
+
type: "user.message";
|
|
1006
|
+
clientEventId?: string | undefined;
|
|
1007
|
+
payload: {
|
|
1008
|
+
text: string;
|
|
1009
|
+
resources?: ResourceRef[] | undefined;
|
|
1010
|
+
tools?: ToolRef[] | undefined;
|
|
1011
|
+
model?: string | undefined;
|
|
1012
|
+
reasoningEffort?: ReasoningEffort | undefined;
|
|
1013
|
+
};
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
export type UserInterruptEventInput = {
|
|
1017
|
+
type: "user.interrupt";
|
|
1018
|
+
clientEventId?: string | undefined;
|
|
1019
|
+
payload?: { reason?: string | undefined } | undefined;
|
|
1020
|
+
};
|
|
1021
|
+
|
|
1022
|
+
export type UserApprovalDecisionEventInput = {
|
|
1023
|
+
type: "user.approvalDecision";
|
|
1024
|
+
clientEventId?: string | undefined;
|
|
1025
|
+
payload: {
|
|
1026
|
+
approvalId: string;
|
|
1027
|
+
decision: "approve" | "reject";
|
|
1028
|
+
message?: string | undefined;
|
|
1029
|
+
};
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
/** Control/user events a client may POST to a session's event log. */
|
|
1033
|
+
export type ClientSessionEventInput =
|
|
1034
|
+
| UserMessageEventInput
|
|
1035
|
+
| UserInterruptEventInput
|
|
1036
|
+
| UserApprovalDecisionEventInput;
|