@granular-software/sdk 0.4.2 → 0.4.4
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 +3 -41
- package/dist/cli/index.js +42 -42
- package/dist/index.d.mts +726 -3
- package/dist/index.d.ts +726 -3
- package/dist/index.js +53 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -52
- package/dist/adapters/anthropic.d.mts +0 -64
- package/dist/adapters/anthropic.d.ts +0 -64
- package/dist/adapters/anthropic.js +0 -77
- package/dist/adapters/anthropic.js.map +0 -1
- package/dist/adapters/anthropic.mjs +0 -72
- package/dist/adapters/anthropic.mjs.map +0 -1
- package/dist/adapters/langchain.d.mts +0 -31
- package/dist/adapters/langchain.d.ts +0 -31
- package/dist/adapters/langchain.js +0 -49
- package/dist/adapters/langchain.js.map +0 -1
- package/dist/adapters/langchain.mjs +0 -46
- package/dist/adapters/langchain.mjs.map +0 -1
- package/dist/adapters/mastra.d.mts +0 -23
- package/dist/adapters/mastra.d.ts +0 -23
- package/dist/adapters/mastra.js +0 -26
- package/dist/adapters/mastra.js.map +0 -1
- package/dist/adapters/mastra.mjs +0 -24
- package/dist/adapters/mastra.mjs.map +0 -1
- package/dist/adapters/openai.d.mts +0 -76
- package/dist/adapters/openai.d.ts +0 -76
- package/dist/adapters/openai.js +0 -81
- package/dist/adapters/openai.js.map +0 -1
- package/dist/adapters/openai.mjs +0 -76
- package/dist/adapters/openai.mjs.map +0 -1
- package/dist/types-C0AVRsVR.d.mts +0 -726
- package/dist/types-C0AVRsVR.d.ts +0 -726
|
@@ -1,726 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module @granular-software/sdk/types
|
|
3
|
-
* Type definitions for the Granular SDK
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Configuration for the Granular client
|
|
7
|
-
*/
|
|
8
|
-
type AccessTokenProvider = () => Promise<string | null | undefined> | string | null | undefined;
|
|
9
|
-
type EndpointMode = 'auto' | 'local' | 'production';
|
|
10
|
-
interface GranularOptions {
|
|
11
|
-
/** Your Granular API key (for service/CLI auth; use with GRANULAR_API_KEY) */
|
|
12
|
-
apiKey?: string;
|
|
13
|
-
/** Application/session JWT (for user-context auth; use from simulator or getAccessToken) */
|
|
14
|
-
token?: string;
|
|
15
|
-
/** Optional provider used to refresh JWT before WebSocket (re)connect attempts */
|
|
16
|
-
tokenProvider?: AccessTokenProvider;
|
|
17
|
-
/** Optional API URL (for on-prem or testing) */
|
|
18
|
-
apiUrl?: string;
|
|
19
|
-
/** Optional endpoint mode when apiUrl is not explicitly provided */
|
|
20
|
-
endpointMode?: EndpointMode;
|
|
21
|
-
/** Optional WebSocket constructor (for Node.js environments) */
|
|
22
|
-
WebSocketCtor?: any;
|
|
23
|
-
/**
|
|
24
|
-
* Optional callback invoked when a connected WebSocket closes unexpectedly.
|
|
25
|
-
* Useful for forwarding close diagnostics to monitoring (e.g., Sentry).
|
|
26
|
-
*/
|
|
27
|
-
onUnexpectedClose?: (info: WSDisconnectInfo) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Optional callback invoked when automatic reconnect fails.
|
|
30
|
-
* Useful to capture auth or gateway rejection causes.
|
|
31
|
-
*/
|
|
32
|
-
onReconnectError?: (info: WSReconnectErrorInfo) => void;
|
|
33
|
-
}
|
|
34
|
-
/** Resolved auth credential: either apiKey or token must be provided */
|
|
35
|
-
type GranularAuth = string;
|
|
36
|
-
/**
|
|
37
|
-
* A user/subject object returned from recordUser()
|
|
38
|
-
*/
|
|
39
|
-
interface User {
|
|
40
|
-
/** Internal subject ID */
|
|
41
|
-
subjectId: string;
|
|
42
|
-
/** External identity ID (e.g. Auth0 ID) */
|
|
43
|
-
identityId: string;
|
|
44
|
-
/** User's display name */
|
|
45
|
-
name?: string;
|
|
46
|
-
/** User's email */
|
|
47
|
-
email?: string;
|
|
48
|
-
/** Permission profile IDs to be assigned when connecting */
|
|
49
|
-
permissions: string[];
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Options for recording a user
|
|
53
|
-
*/
|
|
54
|
-
interface RecordUserOptions {
|
|
55
|
-
/** External user/identity ID (e.g. your Auth0 or database user ID) */
|
|
56
|
-
userId: string;
|
|
57
|
-
/** User's display name */
|
|
58
|
-
name?: string;
|
|
59
|
-
/** User's email */
|
|
60
|
-
email?: string;
|
|
61
|
-
/** Permission profile IDs to assign when connecting to sandboxes */
|
|
62
|
-
permissions?: string[];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Subject as returned from the API
|
|
66
|
-
*/
|
|
67
|
-
interface Subject {
|
|
68
|
-
subjectId: string;
|
|
69
|
-
tenantId: string;
|
|
70
|
-
identityId: string;
|
|
71
|
-
email?: string | null;
|
|
72
|
-
name?: string | null;
|
|
73
|
-
metadata?: Record<string, unknown>;
|
|
74
|
-
createdAt: number;
|
|
75
|
-
updatedAt: number;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Options for connecting to a sandbox
|
|
79
|
-
*/
|
|
80
|
-
interface ConnectOptions {
|
|
81
|
-
/** The sandbox name or ID to connect to */
|
|
82
|
-
sandbox: string;
|
|
83
|
-
/** The user to connect as (from recordUser()) */
|
|
84
|
-
user: User;
|
|
85
|
-
/** Optional stable client ID. Defaults to `client_${Date.now()}`. Use a fixed
|
|
86
|
-
* value for long-lived effect hosts so tool catalogs don't accumulate. */
|
|
87
|
-
clientId?: string;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* A sandbox container
|
|
91
|
-
*/
|
|
92
|
-
interface Sandbox {
|
|
93
|
-
sandboxId: string;
|
|
94
|
-
tenantId: string;
|
|
95
|
-
name: string;
|
|
96
|
-
description?: string | null;
|
|
97
|
-
createdAt: number;
|
|
98
|
-
updatedAt: number;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Data for creating a new sandbox
|
|
102
|
-
*/
|
|
103
|
-
interface CreateSandboxData {
|
|
104
|
-
name: string;
|
|
105
|
-
description?: string;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* List response for sandboxes
|
|
109
|
-
*/
|
|
110
|
-
interface SandboxListResponse {
|
|
111
|
-
items: Sandbox[];
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Rules defining what effects and resources are allowed or denied.
|
|
115
|
-
*/
|
|
116
|
-
interface PermissionRules {
|
|
117
|
-
/** Effect access rules */
|
|
118
|
-
effects?: {
|
|
119
|
-
/** Patterns for allowed effects (e.g. ["*"] for all, ["read_*"] for prefix match) */
|
|
120
|
-
allow?: string[];
|
|
121
|
-
/** Patterns for denied effects */
|
|
122
|
-
deny?: string[];
|
|
123
|
-
};
|
|
124
|
-
/** Legacy alias accepted by the backend while migrating to `effects`. */
|
|
125
|
-
tools?: {
|
|
126
|
-
/** Patterns for allowed effects (e.g. ["*"] for all, ["read_*"] for prefix match) */
|
|
127
|
-
allow?: string[];
|
|
128
|
-
/** Patterns for denied effects */
|
|
129
|
-
deny?: string[];
|
|
130
|
-
};
|
|
131
|
-
/** Resource access rules */
|
|
132
|
-
resources?: {
|
|
133
|
-
/** Patterns for allowed resources */
|
|
134
|
-
allow?: string[];
|
|
135
|
-
/** Patterns for denied resources */
|
|
136
|
-
deny?: string[];
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* A permission profile defines access controls for an environment
|
|
141
|
-
*/
|
|
142
|
-
interface PermissionProfile {
|
|
143
|
-
permissionProfileId: string;
|
|
144
|
-
sandboxId: string;
|
|
145
|
-
name: string;
|
|
146
|
-
rules: PermissionRules;
|
|
147
|
-
createdAt: number;
|
|
148
|
-
updatedAt: number;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Data for creating a new permission profile
|
|
152
|
-
*/
|
|
153
|
-
interface CreatePermissionProfileData {
|
|
154
|
-
name: string;
|
|
155
|
-
rules: PermissionRules;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* List response for permission profiles
|
|
159
|
-
*/
|
|
160
|
-
interface PermissionProfileListResponse {
|
|
161
|
-
items: PermissionProfile[];
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* An assignment links a subject to a sandbox with a permission profile
|
|
165
|
-
*/
|
|
166
|
-
interface Assignment {
|
|
167
|
-
assignmentId: string;
|
|
168
|
-
tenantId: string;
|
|
169
|
-
subjectId: string;
|
|
170
|
-
sandboxId: string;
|
|
171
|
-
permissionProfileId: string;
|
|
172
|
-
createdAt: number;
|
|
173
|
-
createdBy?: string | null;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* List response for assignments
|
|
177
|
-
*/
|
|
178
|
-
interface AssignmentListResponse {
|
|
179
|
-
items: Assignment[];
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Build policy for environments
|
|
183
|
-
*/
|
|
184
|
-
interface BuildPolicy {
|
|
185
|
-
mode: 'current' | 'pinned';
|
|
186
|
-
buildId?: string;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* An environment links a user (subject) to a sandbox with specific permissions
|
|
190
|
-
*/
|
|
191
|
-
interface EnvironmentData {
|
|
192
|
-
environmentId: string;
|
|
193
|
-
sandboxId: string;
|
|
194
|
-
buildId: string;
|
|
195
|
-
subjectId: string;
|
|
196
|
-
permissionProfileId: string;
|
|
197
|
-
buildPolicy: BuildPolicy;
|
|
198
|
-
createdAt: number;
|
|
199
|
-
updatedAt: number;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Data for creating a new environment
|
|
203
|
-
*/
|
|
204
|
-
interface CreateEnvironmentData {
|
|
205
|
-
/** The user/subject ID to create the environment for */
|
|
206
|
-
subjectId: string;
|
|
207
|
-
/** The permission profile to apply (optional - uses assignment if not specified) */
|
|
208
|
-
permissionProfileId?: string | null;
|
|
209
|
-
/** Build policy (defaults to current build) */
|
|
210
|
-
buildPolicy?: BuildPolicy;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* List response for environments
|
|
214
|
-
*/
|
|
215
|
-
interface EnvironmentListResponse {
|
|
216
|
-
items: EnvironmentData[];
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* A manifest describes the structure and behavior of a sandbox
|
|
220
|
-
*/
|
|
221
|
-
interface Manifest {
|
|
222
|
-
manifestId: string;
|
|
223
|
-
sandboxId: string;
|
|
224
|
-
version: string;
|
|
225
|
-
digest: string;
|
|
226
|
-
content?: Record<string, unknown>;
|
|
227
|
-
createdAt: number;
|
|
228
|
-
locked?: boolean;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* List response for manifests
|
|
232
|
-
*/
|
|
233
|
-
interface ManifestListResponse {
|
|
234
|
-
items: Manifest[];
|
|
235
|
-
}
|
|
236
|
-
type BuildStatus = 'queued' | 'building' | 'completed' | 'failed' | 'canceled';
|
|
237
|
-
/**
|
|
238
|
-
* A build represents a compiled version of a manifest
|
|
239
|
-
*/
|
|
240
|
-
interface Build {
|
|
241
|
-
buildId: string;
|
|
242
|
-
sandboxId: string;
|
|
243
|
-
manifestId: string;
|
|
244
|
-
status: BuildStatus;
|
|
245
|
-
graphBinaryId?: string | null;
|
|
246
|
-
logsUri?: string | null;
|
|
247
|
-
createdAt: number;
|
|
248
|
-
updatedAt: number;
|
|
249
|
-
isCurrent?: boolean;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* List response for builds
|
|
253
|
-
*/
|
|
254
|
-
interface BuildListResponse {
|
|
255
|
-
items: Build[];
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Effect handler for static/global effects: receives (input, context)
|
|
259
|
-
*/
|
|
260
|
-
interface EffectHandlerContext {
|
|
261
|
-
effectClientId: string;
|
|
262
|
-
sandboxId: string;
|
|
263
|
-
environmentId: string;
|
|
264
|
-
sessionId: string;
|
|
265
|
-
tenantId?: string;
|
|
266
|
-
principalId?: string;
|
|
267
|
-
permissionProfileId?: string;
|
|
268
|
-
user: {
|
|
269
|
-
subjectId: string;
|
|
270
|
-
identityId?: string;
|
|
271
|
-
principalId?: string;
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
type ToolHandler = (input: any, context: EffectHandlerContext) => Promise<unknown>;
|
|
275
|
-
/**
|
|
276
|
-
* Effect handler for instance methods: receives (objectId, input, context)
|
|
277
|
-
*/
|
|
278
|
-
type InstanceToolHandler = (id: string, input: any, context: EffectHandlerContext) => Promise<unknown>;
|
|
279
|
-
/**
|
|
280
|
-
* Effect schema for declaring or registering an effect.
|
|
281
|
-
*
|
|
282
|
-
* Effects come in three flavours:
|
|
283
|
-
*
|
|
284
|
-
* 1. **Instance methods** — set `className`, omit `static`.
|
|
285
|
-
* In the sandbox: `tolkien.get_bio({ detailed: true })`
|
|
286
|
-
* Handler signature: `(objectId: string, params: any) => any`
|
|
287
|
-
*
|
|
288
|
-
* 2. **Static methods** — set `className` + `static: true`.
|
|
289
|
-
* In the sandbox: `Author.search({ query: 'tolkien' })`
|
|
290
|
-
* Handler signature: `(params: any) => any`
|
|
291
|
-
*
|
|
292
|
-
* 3. **Global effects** — omit `className`.
|
|
293
|
-
* In the sandbox: `global_search({ query: 'rings' })`
|
|
294
|
-
* Handler signature: `(params: any) => any`
|
|
295
|
-
*
|
|
296
|
-
* Both `inputSchema` and `outputSchema` accept JSON Schema objects.
|
|
297
|
-
* The `outputSchema` drives the return type in the auto-generated
|
|
298
|
-
* TypeScript declarations that sandbox code imports from `./sandbox-tools`.
|
|
299
|
-
*/
|
|
300
|
-
interface ToolSchema {
|
|
301
|
-
effectKey?: string;
|
|
302
|
-
name: string;
|
|
303
|
-
description: string;
|
|
304
|
-
/** JSON Schema for the effect input parameters */
|
|
305
|
-
inputSchema: Record<string, unknown>;
|
|
306
|
-
/**
|
|
307
|
-
* JSON Schema for the tool's return value.
|
|
308
|
-
* Used to generate typed return types in the sandbox TypeScript declarations.
|
|
309
|
-
*
|
|
310
|
-
* @example
|
|
311
|
-
* ```typescript
|
|
312
|
-
* outputSchema: {
|
|
313
|
-
* type: 'object',
|
|
314
|
-
* properties: {
|
|
315
|
-
* bio: { type: 'string', description: 'The biography text' },
|
|
316
|
-
* source: { type: 'string', description: 'Source of the bio' },
|
|
317
|
-
* },
|
|
318
|
-
* required: ['bio'],
|
|
319
|
-
* }
|
|
320
|
-
* // Generates: Promise<{ bio: string; source?: string }>
|
|
321
|
-
* ```
|
|
322
|
-
*/
|
|
323
|
-
outputSchema?: Record<string, unknown>;
|
|
324
|
-
stability?: 'stable' | 'experimental' | 'deprecated';
|
|
325
|
-
provenance?: {
|
|
326
|
-
source: 'mcp' | 'custom';
|
|
327
|
-
};
|
|
328
|
-
tags?: string[];
|
|
329
|
-
/**
|
|
330
|
-
* The class this effect belongs to (e.g., `'author'`, `'book'`).
|
|
331
|
-
* When set, the effect becomes a method on the auto-generated class.
|
|
332
|
-
* Omit for global effects (standalone exported functions).
|
|
333
|
-
*/
|
|
334
|
-
className?: string;
|
|
335
|
-
/**
|
|
336
|
-
* If `true`, this is a static/class-level method (no object ID required).
|
|
337
|
-
* If `false` or omitted and `className` is set, this is an instance method
|
|
338
|
-
* that operates on a specific object (the object's real-world ID is
|
|
339
|
-
* passed as the first argument to the handler).
|
|
340
|
-
*/
|
|
341
|
-
static?: boolean;
|
|
342
|
-
}
|
|
343
|
-
type EffectSchema = ToolSchema;
|
|
344
|
-
/**
|
|
345
|
-
* Effect with handler — what users provide to `registerEffect()`.
|
|
346
|
-
*
|
|
347
|
-
* - **Instance methods** (`className` set, `static` omitted):
|
|
348
|
-
* handler receives `(objectId: string, params: any)`
|
|
349
|
-
* - **Static methods** (`className` set, `static: true`):
|
|
350
|
-
* handler receives `(params: any)`
|
|
351
|
-
* - **Global tools** (no `className`):
|
|
352
|
-
* handler receives `(params: any)`
|
|
353
|
-
*/
|
|
354
|
-
interface ToolWithHandler extends ToolSchema {
|
|
355
|
-
handler: ToolHandler | InstanceToolHandler;
|
|
356
|
-
}
|
|
357
|
-
type EffectWithHandler = ToolWithHandler;
|
|
358
|
-
/**
|
|
359
|
-
* Result from publishing or synchronizing effects
|
|
360
|
-
*/
|
|
361
|
-
interface PublishToolsResult {
|
|
362
|
-
accepted: boolean;
|
|
363
|
-
domainRevision: string;
|
|
364
|
-
rejected?: Array<{
|
|
365
|
-
name: string;
|
|
366
|
-
reason: string;
|
|
367
|
-
}>;
|
|
368
|
-
}
|
|
369
|
-
type PublishEffectsResult = PublishToolsResult;
|
|
370
|
-
/**
|
|
371
|
-
* Domain state response
|
|
372
|
-
*/
|
|
373
|
-
interface DomainState {
|
|
374
|
-
activeDomainRevision?: string;
|
|
375
|
-
tools?: Array<{
|
|
376
|
-
name: string;
|
|
377
|
-
description?: string;
|
|
378
|
-
inputSchema?: Record<string, unknown>;
|
|
379
|
-
outputSchema?: Record<string, unknown>;
|
|
380
|
-
}>;
|
|
381
|
-
[key: string]: unknown;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Information about a live or declared effect
|
|
385
|
-
*/
|
|
386
|
-
interface ToolInfo {
|
|
387
|
-
effectKey?: string;
|
|
388
|
-
/** Unique name of the effect */
|
|
389
|
-
name: string;
|
|
390
|
-
/** Description of what the effect does */
|
|
391
|
-
description?: string;
|
|
392
|
-
/** JSON Schema for effect input */
|
|
393
|
-
inputSchema?: Record<string, unknown>;
|
|
394
|
-
/** JSON Schema for effect output */
|
|
395
|
-
outputSchema?: Record<string, unknown>;
|
|
396
|
-
/** Client ID that published this effect (absent for domain-only entries) */
|
|
397
|
-
clientId?: string;
|
|
398
|
-
/** Whether the effect is ready for use (has a registered handler) */
|
|
399
|
-
ready: boolean;
|
|
400
|
-
/** Timestamp when the effect was published */
|
|
401
|
-
publishedAt?: number;
|
|
402
|
-
/** Class this effect belongs to (instance/static method) */
|
|
403
|
-
className?: string;
|
|
404
|
-
/** Whether this is a static method */
|
|
405
|
-
static?: boolean;
|
|
406
|
-
}
|
|
407
|
-
interface EffectInfo extends ToolInfo {
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Event data when the list of available effects changes
|
|
411
|
-
*/
|
|
412
|
-
interface ToolsChangedEvent {
|
|
413
|
-
/** The current list of all available effects */
|
|
414
|
-
tools: ToolInfo[];
|
|
415
|
-
/** Names of effects that were added or updated */
|
|
416
|
-
added: string[];
|
|
417
|
-
/** Names of effects that were removed */
|
|
418
|
-
removed: string[];
|
|
419
|
-
}
|
|
420
|
-
interface EffectsChangedEvent extends ToolsChangedEvent {
|
|
421
|
-
/** The current list of all available effects */
|
|
422
|
-
effects: EffectInfo[];
|
|
423
|
-
}
|
|
424
|
-
type EffectHandler = ToolHandler;
|
|
425
|
-
type InstanceEffectHandler = InstanceToolHandler;
|
|
426
|
-
type JobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'timeout' | 'canceled';
|
|
427
|
-
/**
|
|
428
|
-
* Result from submitting a job
|
|
429
|
-
*/
|
|
430
|
-
interface JobSubmitResult {
|
|
431
|
-
jobId: string;
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Represents a job executed in the sandbox
|
|
435
|
-
*/
|
|
436
|
-
interface Job {
|
|
437
|
-
/** Unique Job ID */
|
|
438
|
-
id: string;
|
|
439
|
-
/** Current status of the job */
|
|
440
|
-
status: JobStatus;
|
|
441
|
-
/** Promise that resolves with the job result */
|
|
442
|
-
result: Promise<unknown>;
|
|
443
|
-
/** Subscribe to job events */
|
|
444
|
-
on(event: string, handler: (data: unknown) => void): void;
|
|
445
|
-
}
|
|
446
|
-
interface Prompt {
|
|
447
|
-
id: string;
|
|
448
|
-
type: 'confirm' | 'choice' | 'input';
|
|
449
|
-
title: string;
|
|
450
|
-
message: string;
|
|
451
|
-
options?: string[];
|
|
452
|
-
defaultValue?: unknown;
|
|
453
|
-
}
|
|
454
|
-
interface WSDisconnectInfo {
|
|
455
|
-
code?: number;
|
|
456
|
-
reason?: string;
|
|
457
|
-
wasClean?: boolean;
|
|
458
|
-
unexpected: boolean;
|
|
459
|
-
timestamp: number;
|
|
460
|
-
reconnectScheduled: boolean;
|
|
461
|
-
reconnectDelayMs?: number;
|
|
462
|
-
}
|
|
463
|
-
interface WSReconnectErrorInfo {
|
|
464
|
-
sessionId: string;
|
|
465
|
-
error: string;
|
|
466
|
-
timestamp: number;
|
|
467
|
-
}
|
|
468
|
-
interface WSClientOptions {
|
|
469
|
-
url: string;
|
|
470
|
-
sessionId: string;
|
|
471
|
-
token: string;
|
|
472
|
-
tokenProvider?: AccessTokenProvider;
|
|
473
|
-
WebSocketCtor?: any;
|
|
474
|
-
onUnexpectedClose?: (info: WSDisconnectInfo) => void;
|
|
475
|
-
onReconnectError?: (info: WSReconnectErrorInfo) => void;
|
|
476
|
-
}
|
|
477
|
-
interface RPCRequest {
|
|
478
|
-
type: 'rpc';
|
|
479
|
-
method: string;
|
|
480
|
-
params: unknown;
|
|
481
|
-
id: string;
|
|
482
|
-
}
|
|
483
|
-
interface RPCResponse {
|
|
484
|
-
type: 'rpc_result' | 'rpc_error';
|
|
485
|
-
id: string;
|
|
486
|
-
result?: unknown;
|
|
487
|
-
error?: {
|
|
488
|
-
code: number;
|
|
489
|
-
message: string;
|
|
490
|
-
data?: unknown;
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
interface SyncMessage {
|
|
494
|
-
type: 'sync';
|
|
495
|
-
message?: string | number[] | Uint8Array;
|
|
496
|
-
data?: number[];
|
|
497
|
-
}
|
|
498
|
-
interface RPCRequestFromServer {
|
|
499
|
-
type: 'rpc';
|
|
500
|
-
method: string;
|
|
501
|
-
params: unknown;
|
|
502
|
-
id: string;
|
|
503
|
-
}
|
|
504
|
-
interface ToolInvokeParams {
|
|
505
|
-
callId: string;
|
|
506
|
-
toolName: string;
|
|
507
|
-
input: unknown;
|
|
508
|
-
}
|
|
509
|
-
interface ToolResultParams {
|
|
510
|
-
callId: string;
|
|
511
|
-
result?: unknown;
|
|
512
|
-
error?: string | {
|
|
513
|
-
code: string;
|
|
514
|
-
message: string;
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* A model reference as returned from relationship queries
|
|
519
|
-
*/
|
|
520
|
-
interface ModelRef {
|
|
521
|
-
path: string;
|
|
522
|
-
label?: string;
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Relationship info as returned from the GraphQL API.
|
|
526
|
-
* Represents a typed, bidirectional relationship between two model types,
|
|
527
|
-
* seen from one model's perspective.
|
|
528
|
-
*/
|
|
529
|
-
interface RelationshipInfo {
|
|
530
|
-
/** Unique name of this relationship definition */
|
|
531
|
-
name: string;
|
|
532
|
-
/** The submodel on this model that holds the relationship */
|
|
533
|
-
local_submodel: ModelRef;
|
|
534
|
-
/** Whether this side is a "many" collection */
|
|
535
|
-
local_is_many: boolean;
|
|
536
|
-
/** The submodel on the foreign model */
|
|
537
|
-
foreign_submodel: ModelRef;
|
|
538
|
-
/** Whether the foreign side is a "many" collection */
|
|
539
|
-
foreign_is_many: boolean;
|
|
540
|
-
/** The foreign model type */
|
|
541
|
-
foreign_model: ModelRef;
|
|
542
|
-
/** Computed relationship kind: "one_to_one" | "one_to_many" | "many_to_one" | "many_to_many" */
|
|
543
|
-
relationship_kind: 'one_to_one' | 'one_to_many' | 'many_to_one' | 'many_to_many';
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* Options for defining a relationship between two model types
|
|
547
|
-
*/
|
|
548
|
-
interface DefineRelationshipOptions {
|
|
549
|
-
/** The model to define the relationship on (the "left" / "local" type) */
|
|
550
|
-
model: string;
|
|
551
|
-
/** The submodel name on the local model (e.g., "books") */
|
|
552
|
-
localSubmodel: string;
|
|
553
|
-
/** Whether the local side is "many" */
|
|
554
|
-
localIsMany: boolean;
|
|
555
|
-
/** The foreign model type (e.g., "book") */
|
|
556
|
-
foreignModel: string;
|
|
557
|
-
/** The submodel name on the foreign model (e.g., "author") */
|
|
558
|
-
foreignSubmodel: string;
|
|
559
|
-
/** Whether the foreign side is "many" */
|
|
560
|
-
foreignIsMany: boolean;
|
|
561
|
-
/** Optional relationship name (auto-generated if omitted) */
|
|
562
|
-
name?: string;
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* Options for creating or updating a class instance in the graph.
|
|
566
|
-
*
|
|
567
|
-
* `recordObject` uses the graph's `instantiate` (find-or-create) semantics:
|
|
568
|
-
* if an instance with the given `id` already exists under the class, its
|
|
569
|
-
* fields are updated in place; otherwise a new instance is created.
|
|
570
|
-
*/
|
|
571
|
-
interface RecordObjectOptions {
|
|
572
|
-
/** The class to instantiate (e.g., "author") */
|
|
573
|
-
className: string;
|
|
574
|
-
/**
|
|
575
|
-
* Real-world object ID. Unique within its class, but two objects of
|
|
576
|
-
* different classes may share the same ID. Internally the SDK derives
|
|
577
|
-
* a unique graph path as `{className}__{id}`.
|
|
578
|
-
*/
|
|
579
|
-
id: string;
|
|
580
|
-
/** Optional display label (defaults to `id`) */
|
|
581
|
-
label?: string;
|
|
582
|
-
/** Scalar field values to set on the instance */
|
|
583
|
-
fields?: Record<string, string | number | boolean | null>;
|
|
584
|
-
/**
|
|
585
|
-
* Relationship attachments.
|
|
586
|
-
* Keys are relationship submodel names. Values are real-world IDs
|
|
587
|
-
* (not graph paths) — the SDK resolves them using the foreign class
|
|
588
|
-
* derived from the relationship definition.
|
|
589
|
-
* - For a "one" side: pass a single target ID (string)
|
|
590
|
-
* - For a "many" side: pass an array of target IDs
|
|
591
|
-
*/
|
|
592
|
-
relationships?: Record<string, string | string[]>;
|
|
593
|
-
}
|
|
594
|
-
/**
|
|
595
|
-
* Return value from `recordObject()`
|
|
596
|
-
*/
|
|
597
|
-
interface RecordObjectResult {
|
|
598
|
-
/** The internal graph path (e.g., "author__tolkien") */
|
|
599
|
-
path: string;
|
|
600
|
-
/** The real-world object ID as provided by the caller (e.g., "tolkien") */
|
|
601
|
-
id: string;
|
|
602
|
-
/** Whether the instance was newly created (false = updated) */
|
|
603
|
-
created: boolean;
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Property specification in a manifest operation
|
|
607
|
-
*/
|
|
608
|
-
interface ManifestPropertySpec {
|
|
609
|
-
value?: string | number | boolean;
|
|
610
|
-
ref?: string;
|
|
611
|
-
instanceOf?: string;
|
|
612
|
-
create?: string;
|
|
613
|
-
has?: Record<string, ManifestPropertySpec>;
|
|
614
|
-
type?: string;
|
|
615
|
-
description?: string;
|
|
616
|
-
required?: boolean;
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* Relationship definition between two classes
|
|
620
|
-
*/
|
|
621
|
-
interface ManifestRelationshipDef {
|
|
622
|
-
/** Optional name (auto-generated from left_right if omitted) */
|
|
623
|
-
name?: string;
|
|
624
|
-
/** Left model path */
|
|
625
|
-
left: string;
|
|
626
|
-
/** Right model path */
|
|
627
|
-
right: string;
|
|
628
|
-
/** Submodel name on the left model */
|
|
629
|
-
leftSubmodel: string;
|
|
630
|
-
/** Submodel name on the right model */
|
|
631
|
-
rightSubmodel: string;
|
|
632
|
-
/** Whether the left side is a collection */
|
|
633
|
-
leftIsMany: boolean;
|
|
634
|
-
/** Whether the right side is a collection */
|
|
635
|
-
rightIsMany: boolean;
|
|
636
|
-
}
|
|
637
|
-
interface ManifestEffectSchema {
|
|
638
|
-
type: string;
|
|
639
|
-
properties?: Record<string, unknown>;
|
|
640
|
-
required?: string[];
|
|
641
|
-
items?: unknown;
|
|
642
|
-
description?: string;
|
|
643
|
-
[key: string]: unknown;
|
|
644
|
-
}
|
|
645
|
-
interface ManifestEffectDeclaration {
|
|
646
|
-
name: string;
|
|
647
|
-
description?: string;
|
|
648
|
-
attachedClass?: string;
|
|
649
|
-
isStatic?: boolean;
|
|
650
|
-
inputSchema: ManifestEffectSchema;
|
|
651
|
-
outputSchema?: ManifestEffectSchema;
|
|
652
|
-
stability?: 'stable' | 'experimental' | 'deprecated';
|
|
653
|
-
tags?: string[];
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* A single operation in a manifest volume
|
|
657
|
-
*/
|
|
658
|
-
interface ManifestOperation {
|
|
659
|
-
/** Create a new model/class */
|
|
660
|
-
create?: string;
|
|
661
|
-
/** Target an existing model for modification */
|
|
662
|
-
on?: string;
|
|
663
|
-
/** Extend from a parent class */
|
|
664
|
-
extends?: string;
|
|
665
|
-
/** Instantiate a type */
|
|
666
|
-
instanceOf?: string;
|
|
667
|
-
/** Define submodels/fields */
|
|
668
|
-
has?: Record<string, ManifestPropertySpec>;
|
|
669
|
-
/** Define a relationship between two classes */
|
|
670
|
-
defineRelationship?: ManifestRelationshipDef;
|
|
671
|
-
/** Declare a build-owned effect */
|
|
672
|
-
withEffect?: ManifestEffectDeclaration;
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* A volume in a manifest
|
|
676
|
-
*/
|
|
677
|
-
/**
|
|
678
|
-
* Import descriptor for referencing modules
|
|
679
|
-
*/
|
|
680
|
-
interface ManifestImport {
|
|
681
|
-
/** Alias prefix used in operations (e.g., "@std") */
|
|
682
|
-
alias: string;
|
|
683
|
-
/** Module name (e.g., "standard_modules") */
|
|
684
|
-
name: string;
|
|
685
|
-
/** Version label (e.g., "prod", "v1.2.3") */
|
|
686
|
-
label?: string;
|
|
687
|
-
}
|
|
688
|
-
interface ManifestVolume {
|
|
689
|
-
name: string;
|
|
690
|
-
scope: 'sandbox' | 'build' | 'user';
|
|
691
|
-
imports?: ManifestImport[];
|
|
692
|
-
operations: ManifestOperation[];
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* A manifest defines the structure of a sandbox's data model
|
|
696
|
-
*/
|
|
697
|
-
interface ManifestContent {
|
|
698
|
-
schemaVersion: 2;
|
|
699
|
-
name: string;
|
|
700
|
-
description?: string;
|
|
701
|
-
volumes: ManifestVolume[];
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Result from a GraphQL query execution
|
|
705
|
-
*/
|
|
706
|
-
interface GraphQLResult<T = any> {
|
|
707
|
-
data?: T;
|
|
708
|
-
errors?: Array<{
|
|
709
|
-
message: string;
|
|
710
|
-
locations?: Array<{
|
|
711
|
-
line: number;
|
|
712
|
-
column: number;
|
|
713
|
-
}>;
|
|
714
|
-
path?: Array<string | number>;
|
|
715
|
-
extensions?: Record<string, any>;
|
|
716
|
-
}>;
|
|
717
|
-
}
|
|
718
|
-
interface APIError {
|
|
719
|
-
error: string;
|
|
720
|
-
message?: string;
|
|
721
|
-
}
|
|
722
|
-
interface DeleteResponse {
|
|
723
|
-
deleted: boolean;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
export type { JobSubmitResult as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EffectInfo as E, Manifest as F, GranularOptions as G, ManifestListResponse as H, InstanceToolHandler as I, Job as J, BuildStatus as K, Build as L, ModelRef as M, BuildListResponse as N, EffectHandlerContext as O, PublishToolsResult as P, EffectSchema as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, EffectWithHandler as V, WSClientOptions as W, PublishEffectsResult as X, EffectHandler as Y, InstanceEffectHandler as Z, JobStatus as _, ToolHandler as a, Prompt as a0, WSDisconnectInfo as a1, WSReconnectErrorInfo as a2, RPCRequest as a3, RPCResponse as a4, SyncMessage as a5, RPCRequestFromServer as a6, ToolInvokeParams as a7, ToolResultParams as a8, ManifestPropertySpec as a9, ManifestRelationshipDef as aa, ManifestEffectSchema as ab, ManifestEffectDeclaration as ac, ManifestOperation as ad, ManifestImport as ae, ManifestVolume as af, APIError as ag, ToolInfo as b, EffectsChangedEvent as c, ToolsChangedEvent as d, EnvironmentData as e, GraphQLResult as f, DefineRelationshipOptions as g, RelationshipInfo as h, ManifestContent as i, RecordObjectOptions as j, RecordObjectResult as k, Sandbox as l, CreateSandboxData as m, DeleteResponse as n, PermissionProfile as o, CreatePermissionProfileData as p, CreateEnvironmentData as q, Subject as r, ToolSchema as s, AccessTokenProvider as t, EndpointMode as u, GranularAuth as v, PermissionRules as w, PermissionProfileListResponse as x, Assignment as y, EnvironmentListResponse as z };
|