@granular-software/sdk 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +231 -13
- package/dist/index.d.mts +200 -20
- package/dist/index.d.ts +200 -20
- package/dist/index.js +4433 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4428 -57
- package/dist/index.mjs.map +1 -1
- package/dist/{types-D46q5WTh.d.mts → types-CnX4jXYQ.d.mts} +47 -3
- package/dist/{types-D46q5WTh.d.ts → types-CnX4jXYQ.d.ts} +47 -3
- package/package.json +2 -3
|
@@ -6,11 +6,17 @@
|
|
|
6
6
|
* Configuration for the Granular client
|
|
7
7
|
*/
|
|
8
8
|
interface GranularOptions {
|
|
9
|
-
/** Your Granular API key */
|
|
10
|
-
apiKey
|
|
9
|
+
/** Your Granular API key (for service/CLI auth; use with GRANULAR_API_KEY) */
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Application/session JWT (for user-context auth; use from simulator or getAccessToken) */
|
|
12
|
+
token?: string;
|
|
11
13
|
/** Optional API URL (for on-prem or testing) */
|
|
12
14
|
apiUrl?: string;
|
|
15
|
+
/** Optional WebSocket constructor (for Node.js environments) */
|
|
16
|
+
WebSocketCtor?: any;
|
|
13
17
|
}
|
|
18
|
+
/** Resolved auth credential: either apiKey or token must be provided */
|
|
19
|
+
type GranularAuth = string;
|
|
14
20
|
/**
|
|
15
21
|
* A user/subject object returned from recordUser()
|
|
16
22
|
*/
|
|
@@ -60,6 +66,9 @@ interface ConnectOptions {
|
|
|
60
66
|
sandbox: string;
|
|
61
67
|
/** The user to connect as (from recordUser()) */
|
|
62
68
|
user: User;
|
|
69
|
+
/** Optional stable client ID. Defaults to `client_${Date.now()}`. Use a fixed
|
|
70
|
+
* value for long-lived effect hosts so tool catalogs don't accumulate. */
|
|
71
|
+
clientId?: string;
|
|
63
72
|
}
|
|
64
73
|
/**
|
|
65
74
|
* A sandbox container
|
|
@@ -330,6 +339,40 @@ interface DomainState {
|
|
|
330
339
|
}>;
|
|
331
340
|
[key: string]: unknown;
|
|
332
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Information about a published tool
|
|
344
|
+
*/
|
|
345
|
+
interface ToolInfo {
|
|
346
|
+
/** Unique name of the tool */
|
|
347
|
+
name: string;
|
|
348
|
+
/** Description of what the tool does */
|
|
349
|
+
description?: string;
|
|
350
|
+
/** JSON Schema for tool input */
|
|
351
|
+
inputSchema?: Record<string, unknown>;
|
|
352
|
+
/** JSON Schema for tool output */
|
|
353
|
+
outputSchema?: Record<string, unknown>;
|
|
354
|
+
/** Client ID that published this tool (absent for domain-only entries) */
|
|
355
|
+
clientId?: string;
|
|
356
|
+
/** Whether the tool is ready for use (has a registered handler) */
|
|
357
|
+
ready: boolean;
|
|
358
|
+
/** Timestamp when the tool was published */
|
|
359
|
+
publishedAt?: number;
|
|
360
|
+
/** Class this tool belongs to (instance/static method) */
|
|
361
|
+
className?: string;
|
|
362
|
+
/** Whether this is a static method */
|
|
363
|
+
static?: boolean;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Event data when the list of available tools changes
|
|
367
|
+
*/
|
|
368
|
+
interface ToolsChangedEvent {
|
|
369
|
+
/** The current list of all available tools */
|
|
370
|
+
tools: ToolInfo[];
|
|
371
|
+
/** Names of tools that were added or updated */
|
|
372
|
+
added: string[];
|
|
373
|
+
/** Names of tools that were removed */
|
|
374
|
+
removed: string[];
|
|
375
|
+
}
|
|
333
376
|
type JobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'timeout' | 'canceled';
|
|
334
377
|
/**
|
|
335
378
|
* Result from submitting a job
|
|
@@ -362,6 +405,7 @@ interface WSClientOptions {
|
|
|
362
405
|
url: string;
|
|
363
406
|
sessionId: string;
|
|
364
407
|
token: string;
|
|
408
|
+
WebSocketCtor?: any;
|
|
365
409
|
}
|
|
366
410
|
interface RPCRequest {
|
|
367
411
|
type: 'rpc';
|
|
@@ -592,4 +636,4 @@ interface DeleteResponse {
|
|
|
592
636
|
deleted: boolean;
|
|
593
637
|
}
|
|
594
638
|
|
|
595
|
-
export type {
|
|
639
|
+
export type { ManifestOperation as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, BuildListResponse as F, GranularOptions as G, JobStatus as H, InstanceToolHandler as I, Job as J, JobSubmitResult as K, Prompt as L, ModelRef as M, RPCRequest as N, RPCResponse as O, PublishToolsResult as P, SyncMessage as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, RPCRequestFromServer as V, WSClientOptions as W, ToolInvokeParams as X, ToolResultParams as Y, ManifestPropertySpec as Z, ManifestRelationshipDef as _, ToolHandler as a, ManifestImport as a0, ManifestVolume as a1, APIError as a2, ToolInfo as b, ToolsChangedEvent as c, GraphQLResult as d, DefineRelationshipOptions as e, RelationshipInfo as f, ManifestContent as g, RecordObjectOptions as h, RecordObjectResult as i, Sandbox as j, CreateSandboxData as k, DeleteResponse as l, PermissionProfile as m, CreatePermissionProfileData as n, CreateEnvironmentData as o, Subject as p, ToolSchema as q, GranularAuth as r, PermissionRules as s, PermissionProfileListResponse as t, Assignment as u, EnvironmentListResponse as v, Manifest as w, ManifestListResponse as x, BuildStatus as y, Build as z };
|
|
@@ -6,11 +6,17 @@
|
|
|
6
6
|
* Configuration for the Granular client
|
|
7
7
|
*/
|
|
8
8
|
interface GranularOptions {
|
|
9
|
-
/** Your Granular API key */
|
|
10
|
-
apiKey
|
|
9
|
+
/** Your Granular API key (for service/CLI auth; use with GRANULAR_API_KEY) */
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Application/session JWT (for user-context auth; use from simulator or getAccessToken) */
|
|
12
|
+
token?: string;
|
|
11
13
|
/** Optional API URL (for on-prem or testing) */
|
|
12
14
|
apiUrl?: string;
|
|
15
|
+
/** Optional WebSocket constructor (for Node.js environments) */
|
|
16
|
+
WebSocketCtor?: any;
|
|
13
17
|
}
|
|
18
|
+
/** Resolved auth credential: either apiKey or token must be provided */
|
|
19
|
+
type GranularAuth = string;
|
|
14
20
|
/**
|
|
15
21
|
* A user/subject object returned from recordUser()
|
|
16
22
|
*/
|
|
@@ -60,6 +66,9 @@ interface ConnectOptions {
|
|
|
60
66
|
sandbox: string;
|
|
61
67
|
/** The user to connect as (from recordUser()) */
|
|
62
68
|
user: User;
|
|
69
|
+
/** Optional stable client ID. Defaults to `client_${Date.now()}`. Use a fixed
|
|
70
|
+
* value for long-lived effect hosts so tool catalogs don't accumulate. */
|
|
71
|
+
clientId?: string;
|
|
63
72
|
}
|
|
64
73
|
/**
|
|
65
74
|
* A sandbox container
|
|
@@ -330,6 +339,40 @@ interface DomainState {
|
|
|
330
339
|
}>;
|
|
331
340
|
[key: string]: unknown;
|
|
332
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Information about a published tool
|
|
344
|
+
*/
|
|
345
|
+
interface ToolInfo {
|
|
346
|
+
/** Unique name of the tool */
|
|
347
|
+
name: string;
|
|
348
|
+
/** Description of what the tool does */
|
|
349
|
+
description?: string;
|
|
350
|
+
/** JSON Schema for tool input */
|
|
351
|
+
inputSchema?: Record<string, unknown>;
|
|
352
|
+
/** JSON Schema for tool output */
|
|
353
|
+
outputSchema?: Record<string, unknown>;
|
|
354
|
+
/** Client ID that published this tool (absent for domain-only entries) */
|
|
355
|
+
clientId?: string;
|
|
356
|
+
/** Whether the tool is ready for use (has a registered handler) */
|
|
357
|
+
ready: boolean;
|
|
358
|
+
/** Timestamp when the tool was published */
|
|
359
|
+
publishedAt?: number;
|
|
360
|
+
/** Class this tool belongs to (instance/static method) */
|
|
361
|
+
className?: string;
|
|
362
|
+
/** Whether this is a static method */
|
|
363
|
+
static?: boolean;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Event data when the list of available tools changes
|
|
367
|
+
*/
|
|
368
|
+
interface ToolsChangedEvent {
|
|
369
|
+
/** The current list of all available tools */
|
|
370
|
+
tools: ToolInfo[];
|
|
371
|
+
/** Names of tools that were added or updated */
|
|
372
|
+
added: string[];
|
|
373
|
+
/** Names of tools that were removed */
|
|
374
|
+
removed: string[];
|
|
375
|
+
}
|
|
333
376
|
type JobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'timeout' | 'canceled';
|
|
334
377
|
/**
|
|
335
378
|
* Result from submitting a job
|
|
@@ -362,6 +405,7 @@ interface WSClientOptions {
|
|
|
362
405
|
url: string;
|
|
363
406
|
sessionId: string;
|
|
364
407
|
token: string;
|
|
408
|
+
WebSocketCtor?: any;
|
|
365
409
|
}
|
|
366
410
|
interface RPCRequest {
|
|
367
411
|
type: 'rpc';
|
|
@@ -592,4 +636,4 @@ interface DeleteResponse {
|
|
|
592
636
|
deleted: boolean;
|
|
593
637
|
}
|
|
594
638
|
|
|
595
|
-
export type {
|
|
639
|
+
export type { ManifestOperation as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, BuildListResponse as F, GranularOptions as G, JobStatus as H, InstanceToolHandler as I, Job as J, JobSubmitResult as K, Prompt as L, ModelRef as M, RPCRequest as N, RPCResponse as O, PublishToolsResult as P, SyncMessage as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, RPCRequestFromServer as V, WSClientOptions as W, ToolInvokeParams as X, ToolResultParams as Y, ManifestPropertySpec as Z, ManifestRelationshipDef as _, ToolHandler as a, ManifestImport as a0, ManifestVolume as a1, APIError as a2, ToolInfo as b, ToolsChangedEvent as c, GraphQLResult as d, DefineRelationshipOptions as e, RelationshipInfo as f, ManifestContent as g, RecordObjectOptions as h, RecordObjectResult as i, Sandbox as j, CreateSandboxData as k, DeleteResponse as l, PermissionProfile as m, CreatePermissionProfileData as n, CreateEnvironmentData as o, Subject as p, ToolSchema as q, GranularAuth as r, PermissionRules as s, PermissionProfileListResponse as t, Assignment as u, EnvironmentListResponse as v, Manifest as w, ManifestListResponse as x, BuildStatus as y, Build as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@granular-software/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "TypeScript SDK and CLI for Granular - define, build, and deploy AI sandboxes",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -70,13 +70,12 @@
|
|
|
70
70
|
"url": "https://github.com/granular-dev/granular-sdk"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@automerge/automerge": "^
|
|
73
|
+
"@automerge/automerge": "^3.2.1",
|
|
74
74
|
"chalk": "^5.4.1",
|
|
75
75
|
"chokidar": "^4.0.3",
|
|
76
76
|
"commander": "^13.1.0",
|
|
77
77
|
"dotenv": "^16.4.7",
|
|
78
78
|
"ora": "^8.2.0",
|
|
79
|
-
"ws": "^8.18.2",
|
|
80
79
|
"zod-to-json-schema": "^3.25.1"
|
|
81
80
|
},
|
|
82
81
|
"devDependencies": {
|