@granular-software/sdk 0.3.4 → 0.4.2
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 +37 -14
- package/dist/adapters/anthropic.d.mts +1 -1
- package/dist/adapters/anthropic.d.ts +1 -1
- package/dist/adapters/langchain.d.mts +1 -1
- package/dist/adapters/langchain.d.ts +1 -1
- package/dist/adapters/mastra.d.mts +1 -1
- package/dist/adapters/mastra.d.ts +1 -1
- package/dist/adapters/openai.d.mts +1 -1
- package/dist/adapters/openai.d.ts +1 -1
- package/dist/cli/index.js +203 -45
- package/dist/index.d.mts +68 -162
- package/dist/index.d.ts +68 -162
- package/dist/index.js +519 -269
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +519 -269
- package/dist/index.mjs.map +1 -1
- package/dist/{types-D5B8WlF4.d.mts → types-C0AVRsVR.d.mts} +92 -31
- package/dist/{types-D5B8WlF4.d.ts → types-C0AVRsVR.d.ts} +92 -31
- package/package.json +1 -1
|
@@ -5,13 +5,19 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Configuration for the Granular client
|
|
7
7
|
*/
|
|
8
|
+
type AccessTokenProvider = () => Promise<string | null | undefined> | string | null | undefined;
|
|
9
|
+
type EndpointMode = 'auto' | 'local' | 'production';
|
|
8
10
|
interface GranularOptions {
|
|
9
11
|
/** Your Granular API key (for service/CLI auth; use with GRANULAR_API_KEY) */
|
|
10
12
|
apiKey?: string;
|
|
11
13
|
/** Application/session JWT (for user-context auth; use from simulator or getAccessToken) */
|
|
12
14
|
token?: string;
|
|
15
|
+
/** Optional provider used to refresh JWT before WebSocket (re)connect attempts */
|
|
16
|
+
tokenProvider?: AccessTokenProvider;
|
|
13
17
|
/** Optional API URL (for on-prem or testing) */
|
|
14
18
|
apiUrl?: string;
|
|
19
|
+
/** Optional endpoint mode when apiUrl is not explicitly provided */
|
|
20
|
+
endpointMode?: EndpointMode;
|
|
15
21
|
/** Optional WebSocket constructor (for Node.js environments) */
|
|
16
22
|
WebSocketCtor?: any;
|
|
17
23
|
/**
|
|
@@ -105,14 +111,21 @@ interface SandboxListResponse {
|
|
|
105
111
|
items: Sandbox[];
|
|
106
112
|
}
|
|
107
113
|
/**
|
|
108
|
-
* Rules defining what
|
|
114
|
+
* Rules defining what effects and resources are allowed or denied.
|
|
109
115
|
*/
|
|
110
116
|
interface PermissionRules {
|
|
111
|
-
/**
|
|
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`. */
|
|
112
125
|
tools?: {
|
|
113
|
-
/** Patterns for allowed
|
|
126
|
+
/** Patterns for allowed effects (e.g. ["*"] for all, ["read_*"] for prefix match) */
|
|
114
127
|
allow?: string[];
|
|
115
|
-
/** Patterns for denied
|
|
128
|
+
/** Patterns for denied effects */
|
|
116
129
|
deny?: string[];
|
|
117
130
|
};
|
|
118
131
|
/** Resource access rules */
|
|
@@ -242,17 +255,31 @@ interface BuildListResponse {
|
|
|
242
255
|
items: Build[];
|
|
243
256
|
}
|
|
244
257
|
/**
|
|
245
|
-
*
|
|
258
|
+
* Effect handler for static/global effects: receives (input, context)
|
|
246
259
|
*/
|
|
247
|
-
|
|
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>;
|
|
248
275
|
/**
|
|
249
|
-
*
|
|
276
|
+
* Effect handler for instance methods: receives (objectId, input, context)
|
|
250
277
|
*/
|
|
251
|
-
type InstanceToolHandler = (id: string, input: any) => Promise<unknown>;
|
|
278
|
+
type InstanceToolHandler = (id: string, input: any, context: EffectHandlerContext) => Promise<unknown>;
|
|
252
279
|
/**
|
|
253
|
-
*
|
|
280
|
+
* Effect schema for declaring or registering an effect.
|
|
254
281
|
*
|
|
255
|
-
*
|
|
282
|
+
* Effects come in three flavours:
|
|
256
283
|
*
|
|
257
284
|
* 1. **Instance methods** — set `className`, omit `static`.
|
|
258
285
|
* In the sandbox: `tolkien.get_bio({ detailed: true })`
|
|
@@ -262,7 +289,7 @@ type InstanceToolHandler = (id: string, input: any) => Promise<unknown>;
|
|
|
262
289
|
* In the sandbox: `Author.search({ query: 'tolkien' })`
|
|
263
290
|
* Handler signature: `(params: any) => any`
|
|
264
291
|
*
|
|
265
|
-
* 3. **Global
|
|
292
|
+
* 3. **Global effects** — omit `className`.
|
|
266
293
|
* In the sandbox: `global_search({ query: 'rings' })`
|
|
267
294
|
* Handler signature: `(params: any) => any`
|
|
268
295
|
*
|
|
@@ -271,9 +298,10 @@ type InstanceToolHandler = (id: string, input: any) => Promise<unknown>;
|
|
|
271
298
|
* TypeScript declarations that sandbox code imports from `./sandbox-tools`.
|
|
272
299
|
*/
|
|
273
300
|
interface ToolSchema {
|
|
301
|
+
effectKey?: string;
|
|
274
302
|
name: string;
|
|
275
303
|
description: string;
|
|
276
|
-
/** JSON Schema for the
|
|
304
|
+
/** JSON Schema for the effect input parameters */
|
|
277
305
|
inputSchema: Record<string, unknown>;
|
|
278
306
|
/**
|
|
279
307
|
* JSON Schema for the tool's return value.
|
|
@@ -299,9 +327,9 @@ interface ToolSchema {
|
|
|
299
327
|
};
|
|
300
328
|
tags?: string[];
|
|
301
329
|
/**
|
|
302
|
-
* The class this
|
|
303
|
-
* When set, the
|
|
304
|
-
* Omit for global
|
|
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).
|
|
305
333
|
*/
|
|
306
334
|
className?: string;
|
|
307
335
|
/**
|
|
@@ -312,8 +340,9 @@ interface ToolSchema {
|
|
|
312
340
|
*/
|
|
313
341
|
static?: boolean;
|
|
314
342
|
}
|
|
343
|
+
type EffectSchema = ToolSchema;
|
|
315
344
|
/**
|
|
316
|
-
*
|
|
345
|
+
* Effect with handler — what users provide to `registerEffect()`.
|
|
317
346
|
*
|
|
318
347
|
* - **Instance methods** (`className` set, `static` omitted):
|
|
319
348
|
* handler receives `(objectId: string, params: any)`
|
|
@@ -325,8 +354,9 @@ interface ToolSchema {
|
|
|
325
354
|
interface ToolWithHandler extends ToolSchema {
|
|
326
355
|
handler: ToolHandler | InstanceToolHandler;
|
|
327
356
|
}
|
|
357
|
+
type EffectWithHandler = ToolWithHandler;
|
|
328
358
|
/**
|
|
329
|
-
* Result from publishing
|
|
359
|
+
* Result from publishing or synchronizing effects
|
|
330
360
|
*/
|
|
331
361
|
interface PublishToolsResult {
|
|
332
362
|
accepted: boolean;
|
|
@@ -336,6 +366,7 @@ interface PublishToolsResult {
|
|
|
336
366
|
reason: string;
|
|
337
367
|
}>;
|
|
338
368
|
}
|
|
369
|
+
type PublishEffectsResult = PublishToolsResult;
|
|
339
370
|
/**
|
|
340
371
|
* Domain state response
|
|
341
372
|
*/
|
|
@@ -350,39 +381,48 @@ interface DomainState {
|
|
|
350
381
|
[key: string]: unknown;
|
|
351
382
|
}
|
|
352
383
|
/**
|
|
353
|
-
* Information about a
|
|
384
|
+
* Information about a live or declared effect
|
|
354
385
|
*/
|
|
355
386
|
interface ToolInfo {
|
|
356
|
-
|
|
387
|
+
effectKey?: string;
|
|
388
|
+
/** Unique name of the effect */
|
|
357
389
|
name: string;
|
|
358
|
-
/** Description of what the
|
|
390
|
+
/** Description of what the effect does */
|
|
359
391
|
description?: string;
|
|
360
|
-
/** JSON Schema for
|
|
392
|
+
/** JSON Schema for effect input */
|
|
361
393
|
inputSchema?: Record<string, unknown>;
|
|
362
|
-
/** JSON Schema for
|
|
394
|
+
/** JSON Schema for effect output */
|
|
363
395
|
outputSchema?: Record<string, unknown>;
|
|
364
|
-
/** Client ID that published this
|
|
396
|
+
/** Client ID that published this effect (absent for domain-only entries) */
|
|
365
397
|
clientId?: string;
|
|
366
|
-
/** Whether the
|
|
398
|
+
/** Whether the effect is ready for use (has a registered handler) */
|
|
367
399
|
ready: boolean;
|
|
368
|
-
/** Timestamp when the
|
|
400
|
+
/** Timestamp when the effect was published */
|
|
369
401
|
publishedAt?: number;
|
|
370
|
-
/** Class this
|
|
402
|
+
/** Class this effect belongs to (instance/static method) */
|
|
371
403
|
className?: string;
|
|
372
404
|
/** Whether this is a static method */
|
|
373
405
|
static?: boolean;
|
|
374
406
|
}
|
|
407
|
+
interface EffectInfo extends ToolInfo {
|
|
408
|
+
}
|
|
375
409
|
/**
|
|
376
|
-
* Event data when the list of available
|
|
410
|
+
* Event data when the list of available effects changes
|
|
377
411
|
*/
|
|
378
412
|
interface ToolsChangedEvent {
|
|
379
|
-
/** The current list of all available
|
|
413
|
+
/** The current list of all available effects */
|
|
380
414
|
tools: ToolInfo[];
|
|
381
|
-
/** Names of
|
|
415
|
+
/** Names of effects that were added or updated */
|
|
382
416
|
added: string[];
|
|
383
|
-
/** Names of
|
|
417
|
+
/** Names of effects that were removed */
|
|
384
418
|
removed: string[];
|
|
385
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;
|
|
386
426
|
type JobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'timeout' | 'canceled';
|
|
387
427
|
/**
|
|
388
428
|
* Result from submitting a job
|
|
@@ -429,6 +469,7 @@ interface WSClientOptions {
|
|
|
429
469
|
url: string;
|
|
430
470
|
sessionId: string;
|
|
431
471
|
token: string;
|
|
472
|
+
tokenProvider?: AccessTokenProvider;
|
|
432
473
|
WebSocketCtor?: any;
|
|
433
474
|
onUnexpectedClose?: (info: WSDisconnectInfo) => void;
|
|
434
475
|
onReconnectError?: (info: WSReconnectErrorInfo) => void;
|
|
@@ -593,6 +634,24 @@ interface ManifestRelationshipDef {
|
|
|
593
634
|
/** Whether the right side is a collection */
|
|
594
635
|
rightIsMany: boolean;
|
|
595
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
|
+
}
|
|
596
655
|
/**
|
|
597
656
|
* A single operation in a manifest volume
|
|
598
657
|
*/
|
|
@@ -609,6 +668,8 @@ interface ManifestOperation {
|
|
|
609
668
|
has?: Record<string, ManifestPropertySpec>;
|
|
610
669
|
/** Define a relationship between two classes */
|
|
611
670
|
defineRelationship?: ManifestRelationshipDef;
|
|
671
|
+
/** Declare a build-owned effect */
|
|
672
|
+
withEffect?: ManifestEffectDeclaration;
|
|
612
673
|
}
|
|
613
674
|
/**
|
|
614
675
|
* A volume in a manifest
|
|
@@ -662,4 +723,4 @@ interface DeleteResponse {
|
|
|
662
723
|
deleted: boolean;
|
|
663
724
|
}
|
|
664
725
|
|
|
665
|
-
export type {
|
|
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 };
|
|
@@ -5,13 +5,19 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Configuration for the Granular client
|
|
7
7
|
*/
|
|
8
|
+
type AccessTokenProvider = () => Promise<string | null | undefined> | string | null | undefined;
|
|
9
|
+
type EndpointMode = 'auto' | 'local' | 'production';
|
|
8
10
|
interface GranularOptions {
|
|
9
11
|
/** Your Granular API key (for service/CLI auth; use with GRANULAR_API_KEY) */
|
|
10
12
|
apiKey?: string;
|
|
11
13
|
/** Application/session JWT (for user-context auth; use from simulator or getAccessToken) */
|
|
12
14
|
token?: string;
|
|
15
|
+
/** Optional provider used to refresh JWT before WebSocket (re)connect attempts */
|
|
16
|
+
tokenProvider?: AccessTokenProvider;
|
|
13
17
|
/** Optional API URL (for on-prem or testing) */
|
|
14
18
|
apiUrl?: string;
|
|
19
|
+
/** Optional endpoint mode when apiUrl is not explicitly provided */
|
|
20
|
+
endpointMode?: EndpointMode;
|
|
15
21
|
/** Optional WebSocket constructor (for Node.js environments) */
|
|
16
22
|
WebSocketCtor?: any;
|
|
17
23
|
/**
|
|
@@ -105,14 +111,21 @@ interface SandboxListResponse {
|
|
|
105
111
|
items: Sandbox[];
|
|
106
112
|
}
|
|
107
113
|
/**
|
|
108
|
-
* Rules defining what
|
|
114
|
+
* Rules defining what effects and resources are allowed or denied.
|
|
109
115
|
*/
|
|
110
116
|
interface PermissionRules {
|
|
111
|
-
/**
|
|
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`. */
|
|
112
125
|
tools?: {
|
|
113
|
-
/** Patterns for allowed
|
|
126
|
+
/** Patterns for allowed effects (e.g. ["*"] for all, ["read_*"] for prefix match) */
|
|
114
127
|
allow?: string[];
|
|
115
|
-
/** Patterns for denied
|
|
128
|
+
/** Patterns for denied effects */
|
|
116
129
|
deny?: string[];
|
|
117
130
|
};
|
|
118
131
|
/** Resource access rules */
|
|
@@ -242,17 +255,31 @@ interface BuildListResponse {
|
|
|
242
255
|
items: Build[];
|
|
243
256
|
}
|
|
244
257
|
/**
|
|
245
|
-
*
|
|
258
|
+
* Effect handler for static/global effects: receives (input, context)
|
|
246
259
|
*/
|
|
247
|
-
|
|
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>;
|
|
248
275
|
/**
|
|
249
|
-
*
|
|
276
|
+
* Effect handler for instance methods: receives (objectId, input, context)
|
|
250
277
|
*/
|
|
251
|
-
type InstanceToolHandler = (id: string, input: any) => Promise<unknown>;
|
|
278
|
+
type InstanceToolHandler = (id: string, input: any, context: EffectHandlerContext) => Promise<unknown>;
|
|
252
279
|
/**
|
|
253
|
-
*
|
|
280
|
+
* Effect schema for declaring or registering an effect.
|
|
254
281
|
*
|
|
255
|
-
*
|
|
282
|
+
* Effects come in three flavours:
|
|
256
283
|
*
|
|
257
284
|
* 1. **Instance methods** — set `className`, omit `static`.
|
|
258
285
|
* In the sandbox: `tolkien.get_bio({ detailed: true })`
|
|
@@ -262,7 +289,7 @@ type InstanceToolHandler = (id: string, input: any) => Promise<unknown>;
|
|
|
262
289
|
* In the sandbox: `Author.search({ query: 'tolkien' })`
|
|
263
290
|
* Handler signature: `(params: any) => any`
|
|
264
291
|
*
|
|
265
|
-
* 3. **Global
|
|
292
|
+
* 3. **Global effects** — omit `className`.
|
|
266
293
|
* In the sandbox: `global_search({ query: 'rings' })`
|
|
267
294
|
* Handler signature: `(params: any) => any`
|
|
268
295
|
*
|
|
@@ -271,9 +298,10 @@ type InstanceToolHandler = (id: string, input: any) => Promise<unknown>;
|
|
|
271
298
|
* TypeScript declarations that sandbox code imports from `./sandbox-tools`.
|
|
272
299
|
*/
|
|
273
300
|
interface ToolSchema {
|
|
301
|
+
effectKey?: string;
|
|
274
302
|
name: string;
|
|
275
303
|
description: string;
|
|
276
|
-
/** JSON Schema for the
|
|
304
|
+
/** JSON Schema for the effect input parameters */
|
|
277
305
|
inputSchema: Record<string, unknown>;
|
|
278
306
|
/**
|
|
279
307
|
* JSON Schema for the tool's return value.
|
|
@@ -299,9 +327,9 @@ interface ToolSchema {
|
|
|
299
327
|
};
|
|
300
328
|
tags?: string[];
|
|
301
329
|
/**
|
|
302
|
-
* The class this
|
|
303
|
-
* When set, the
|
|
304
|
-
* Omit for global
|
|
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).
|
|
305
333
|
*/
|
|
306
334
|
className?: string;
|
|
307
335
|
/**
|
|
@@ -312,8 +340,9 @@ interface ToolSchema {
|
|
|
312
340
|
*/
|
|
313
341
|
static?: boolean;
|
|
314
342
|
}
|
|
343
|
+
type EffectSchema = ToolSchema;
|
|
315
344
|
/**
|
|
316
|
-
*
|
|
345
|
+
* Effect with handler — what users provide to `registerEffect()`.
|
|
317
346
|
*
|
|
318
347
|
* - **Instance methods** (`className` set, `static` omitted):
|
|
319
348
|
* handler receives `(objectId: string, params: any)`
|
|
@@ -325,8 +354,9 @@ interface ToolSchema {
|
|
|
325
354
|
interface ToolWithHandler extends ToolSchema {
|
|
326
355
|
handler: ToolHandler | InstanceToolHandler;
|
|
327
356
|
}
|
|
357
|
+
type EffectWithHandler = ToolWithHandler;
|
|
328
358
|
/**
|
|
329
|
-
* Result from publishing
|
|
359
|
+
* Result from publishing or synchronizing effects
|
|
330
360
|
*/
|
|
331
361
|
interface PublishToolsResult {
|
|
332
362
|
accepted: boolean;
|
|
@@ -336,6 +366,7 @@ interface PublishToolsResult {
|
|
|
336
366
|
reason: string;
|
|
337
367
|
}>;
|
|
338
368
|
}
|
|
369
|
+
type PublishEffectsResult = PublishToolsResult;
|
|
339
370
|
/**
|
|
340
371
|
* Domain state response
|
|
341
372
|
*/
|
|
@@ -350,39 +381,48 @@ interface DomainState {
|
|
|
350
381
|
[key: string]: unknown;
|
|
351
382
|
}
|
|
352
383
|
/**
|
|
353
|
-
* Information about a
|
|
384
|
+
* Information about a live or declared effect
|
|
354
385
|
*/
|
|
355
386
|
interface ToolInfo {
|
|
356
|
-
|
|
387
|
+
effectKey?: string;
|
|
388
|
+
/** Unique name of the effect */
|
|
357
389
|
name: string;
|
|
358
|
-
/** Description of what the
|
|
390
|
+
/** Description of what the effect does */
|
|
359
391
|
description?: string;
|
|
360
|
-
/** JSON Schema for
|
|
392
|
+
/** JSON Schema for effect input */
|
|
361
393
|
inputSchema?: Record<string, unknown>;
|
|
362
|
-
/** JSON Schema for
|
|
394
|
+
/** JSON Schema for effect output */
|
|
363
395
|
outputSchema?: Record<string, unknown>;
|
|
364
|
-
/** Client ID that published this
|
|
396
|
+
/** Client ID that published this effect (absent for domain-only entries) */
|
|
365
397
|
clientId?: string;
|
|
366
|
-
/** Whether the
|
|
398
|
+
/** Whether the effect is ready for use (has a registered handler) */
|
|
367
399
|
ready: boolean;
|
|
368
|
-
/** Timestamp when the
|
|
400
|
+
/** Timestamp when the effect was published */
|
|
369
401
|
publishedAt?: number;
|
|
370
|
-
/** Class this
|
|
402
|
+
/** Class this effect belongs to (instance/static method) */
|
|
371
403
|
className?: string;
|
|
372
404
|
/** Whether this is a static method */
|
|
373
405
|
static?: boolean;
|
|
374
406
|
}
|
|
407
|
+
interface EffectInfo extends ToolInfo {
|
|
408
|
+
}
|
|
375
409
|
/**
|
|
376
|
-
* Event data when the list of available
|
|
410
|
+
* Event data when the list of available effects changes
|
|
377
411
|
*/
|
|
378
412
|
interface ToolsChangedEvent {
|
|
379
|
-
/** The current list of all available
|
|
413
|
+
/** The current list of all available effects */
|
|
380
414
|
tools: ToolInfo[];
|
|
381
|
-
/** Names of
|
|
415
|
+
/** Names of effects that were added or updated */
|
|
382
416
|
added: string[];
|
|
383
|
-
/** Names of
|
|
417
|
+
/** Names of effects that were removed */
|
|
384
418
|
removed: string[];
|
|
385
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;
|
|
386
426
|
type JobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'timeout' | 'canceled';
|
|
387
427
|
/**
|
|
388
428
|
* Result from submitting a job
|
|
@@ -429,6 +469,7 @@ interface WSClientOptions {
|
|
|
429
469
|
url: string;
|
|
430
470
|
sessionId: string;
|
|
431
471
|
token: string;
|
|
472
|
+
tokenProvider?: AccessTokenProvider;
|
|
432
473
|
WebSocketCtor?: any;
|
|
433
474
|
onUnexpectedClose?: (info: WSDisconnectInfo) => void;
|
|
434
475
|
onReconnectError?: (info: WSReconnectErrorInfo) => void;
|
|
@@ -593,6 +634,24 @@ interface ManifestRelationshipDef {
|
|
|
593
634
|
/** Whether the right side is a collection */
|
|
594
635
|
rightIsMany: boolean;
|
|
595
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
|
+
}
|
|
596
655
|
/**
|
|
597
656
|
* A single operation in a manifest volume
|
|
598
657
|
*/
|
|
@@ -609,6 +668,8 @@ interface ManifestOperation {
|
|
|
609
668
|
has?: Record<string, ManifestPropertySpec>;
|
|
610
669
|
/** Define a relationship between two classes */
|
|
611
670
|
defineRelationship?: ManifestRelationshipDef;
|
|
671
|
+
/** Declare a build-owned effect */
|
|
672
|
+
withEffect?: ManifestEffectDeclaration;
|
|
612
673
|
}
|
|
613
674
|
/**
|
|
614
675
|
* A volume in a manifest
|
|
@@ -662,4 +723,4 @@ interface DeleteResponse {
|
|
|
662
723
|
deleted: boolean;
|
|
663
724
|
}
|
|
664
725
|
|
|
665
|
-
export type {
|
|
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 };
|