@granular-software/sdk 0.1.0 → 0.2.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.
@@ -10,6 +10,8 @@ interface GranularOptions {
10
10
  apiKey: string;
11
11
  /** Optional API URL (for on-prem or testing) */
12
12
  apiUrl?: string;
13
+ /** Optional WebSocket constructor (for Node.js environments) */
14
+ WebSocketCtor?: any;
13
15
  }
14
16
  /**
15
17
  * A user/subject object returned from recordUser()
@@ -60,6 +62,9 @@ interface ConnectOptions {
60
62
  sandbox: string;
61
63
  /** The user to connect as (from recordUser()) */
62
64
  user: User;
65
+ /** Optional stable client ID. Defaults to `client_${Date.now()}`. Use a fixed
66
+ * value for long-lived effect hosts so tool catalogs don't accumulate. */
67
+ clientId?: string;
63
68
  }
64
69
  /**
65
70
  * A sandbox container
@@ -330,6 +335,40 @@ interface DomainState {
330
335
  }>;
331
336
  [key: string]: unknown;
332
337
  }
338
+ /**
339
+ * Information about a published tool
340
+ */
341
+ interface ToolInfo {
342
+ /** Unique name of the tool */
343
+ name: string;
344
+ /** Description of what the tool does */
345
+ description?: string;
346
+ /** JSON Schema for tool input */
347
+ inputSchema?: Record<string, unknown>;
348
+ /** JSON Schema for tool output */
349
+ outputSchema?: Record<string, unknown>;
350
+ /** Client ID that published this tool (absent for domain-only entries) */
351
+ clientId?: string;
352
+ /** Whether the tool is ready for use (has a registered handler) */
353
+ ready: boolean;
354
+ /** Timestamp when the tool was published */
355
+ publishedAt?: number;
356
+ /** Class this tool belongs to (instance/static method) */
357
+ className?: string;
358
+ /** Whether this is a static method */
359
+ static?: boolean;
360
+ }
361
+ /**
362
+ * Event data when the list of available tools changes
363
+ */
364
+ interface ToolsChangedEvent {
365
+ /** The current list of all available tools */
366
+ tools: ToolInfo[];
367
+ /** Names of tools that were added or updated */
368
+ added: string[];
369
+ /** Names of tools that were removed */
370
+ removed: string[];
371
+ }
333
372
  type JobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'timeout' | 'canceled';
334
373
  /**
335
374
  * Result from submitting a job
@@ -362,6 +401,7 @@ interface WSClientOptions {
362
401
  url: string;
363
402
  sessionId: string;
364
403
  token: string;
404
+ WebSocketCtor?: any;
365
405
  }
366
406
  interface RPCRequest {
367
407
  type: 'rpc';
@@ -592,4 +632,4 @@ interface DeleteResponse {
592
632
  deleted: boolean;
593
633
  }
594
634
 
595
- export type { APIError as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, Prompt as F, GranularOptions as G, RPCRequest as H, InstanceToolHandler as I, Job as J, RPCResponse as K, SyncMessage as L, ModelRef as M, RPCRequestFromServer as N, ToolInvokeParams as O, PublishToolsResult as P, ToolResultParams as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, ManifestPropertySpec as V, WSClientOptions as W, ManifestRelationshipDef as X, ManifestOperation as Y, ManifestImport as Z, ManifestVolume as _, ToolHandler as a, GraphQLResult as b, DefineRelationshipOptions as c, RelationshipInfo as d, ManifestContent as e, RecordObjectOptions as f, RecordObjectResult as g, Sandbox as h, CreateSandboxData as i, DeleteResponse as j, PermissionProfile as k, CreatePermissionProfileData as l, CreateEnvironmentData as m, Subject as n, ToolSchema as o, PermissionRules as p, PermissionProfileListResponse as q, Assignment as r, EnvironmentListResponse as s, Manifest as t, ManifestListResponse as u, BuildStatus as v, Build as w, BuildListResponse as x, JobStatus as y, JobSubmitResult as z };
635
+ export type { ManifestImport as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, JobStatus as F, GranularOptions as G, JobSubmitResult as H, InstanceToolHandler as I, Job as J, Prompt as K, RPCRequest as L, ModelRef as M, RPCResponse as N, SyncMessage as O, PublishToolsResult as P, RPCRequestFromServer as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, ToolInvokeParams as V, WSClientOptions as W, ToolResultParams as X, ManifestPropertySpec as Y, ManifestRelationshipDef as Z, ManifestOperation as _, ToolHandler as a, ManifestVolume as a0, APIError as a1, 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, PermissionRules as r, PermissionProfileListResponse as s, Assignment as t, EnvironmentListResponse as u, Manifest as v, ManifestListResponse as w, BuildStatus as x, Build as y, BuildListResponse as z };
@@ -10,6 +10,8 @@ interface GranularOptions {
10
10
  apiKey: string;
11
11
  /** Optional API URL (for on-prem or testing) */
12
12
  apiUrl?: string;
13
+ /** Optional WebSocket constructor (for Node.js environments) */
14
+ WebSocketCtor?: any;
13
15
  }
14
16
  /**
15
17
  * A user/subject object returned from recordUser()
@@ -60,6 +62,9 @@ interface ConnectOptions {
60
62
  sandbox: string;
61
63
  /** The user to connect as (from recordUser()) */
62
64
  user: User;
65
+ /** Optional stable client ID. Defaults to `client_${Date.now()}`. Use a fixed
66
+ * value for long-lived effect hosts so tool catalogs don't accumulate. */
67
+ clientId?: string;
63
68
  }
64
69
  /**
65
70
  * A sandbox container
@@ -330,6 +335,40 @@ interface DomainState {
330
335
  }>;
331
336
  [key: string]: unknown;
332
337
  }
338
+ /**
339
+ * Information about a published tool
340
+ */
341
+ interface ToolInfo {
342
+ /** Unique name of the tool */
343
+ name: string;
344
+ /** Description of what the tool does */
345
+ description?: string;
346
+ /** JSON Schema for tool input */
347
+ inputSchema?: Record<string, unknown>;
348
+ /** JSON Schema for tool output */
349
+ outputSchema?: Record<string, unknown>;
350
+ /** Client ID that published this tool (absent for domain-only entries) */
351
+ clientId?: string;
352
+ /** Whether the tool is ready for use (has a registered handler) */
353
+ ready: boolean;
354
+ /** Timestamp when the tool was published */
355
+ publishedAt?: number;
356
+ /** Class this tool belongs to (instance/static method) */
357
+ className?: string;
358
+ /** Whether this is a static method */
359
+ static?: boolean;
360
+ }
361
+ /**
362
+ * Event data when the list of available tools changes
363
+ */
364
+ interface ToolsChangedEvent {
365
+ /** The current list of all available tools */
366
+ tools: ToolInfo[];
367
+ /** Names of tools that were added or updated */
368
+ added: string[];
369
+ /** Names of tools that were removed */
370
+ removed: string[];
371
+ }
333
372
  type JobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'timeout' | 'canceled';
334
373
  /**
335
374
  * Result from submitting a job
@@ -362,6 +401,7 @@ interface WSClientOptions {
362
401
  url: string;
363
402
  sessionId: string;
364
403
  token: string;
404
+ WebSocketCtor?: any;
365
405
  }
366
406
  interface RPCRequest {
367
407
  type: 'rpc';
@@ -592,4 +632,4 @@ interface DeleteResponse {
592
632
  deleted: boolean;
593
633
  }
594
634
 
595
- export type { APIError as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, Prompt as F, GranularOptions as G, RPCRequest as H, InstanceToolHandler as I, Job as J, RPCResponse as K, SyncMessage as L, ModelRef as M, RPCRequestFromServer as N, ToolInvokeParams as O, PublishToolsResult as P, ToolResultParams as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, ManifestPropertySpec as V, WSClientOptions as W, ManifestRelationshipDef as X, ManifestOperation as Y, ManifestImport as Z, ManifestVolume as _, ToolHandler as a, GraphQLResult as b, DefineRelationshipOptions as c, RelationshipInfo as d, ManifestContent as e, RecordObjectOptions as f, RecordObjectResult as g, Sandbox as h, CreateSandboxData as i, DeleteResponse as j, PermissionProfile as k, CreatePermissionProfileData as l, CreateEnvironmentData as m, Subject as n, ToolSchema as o, PermissionRules as p, PermissionProfileListResponse as q, Assignment as r, EnvironmentListResponse as s, Manifest as t, ManifestListResponse as u, BuildStatus as v, Build as w, BuildListResponse as x, JobStatus as y, JobSubmitResult as z };
635
+ export type { ManifestImport as $, AssignmentListResponse as A, BuildPolicy as B, ConnectOptions as C, DomainState as D, EnvironmentData as E, JobStatus as F, GranularOptions as G, JobSubmitResult as H, InstanceToolHandler as I, Job as J, Prompt as K, RPCRequest as L, ModelRef as M, RPCResponse as N, SyncMessage as O, PublishToolsResult as P, RPCRequestFromServer as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, ToolInvokeParams as V, WSClientOptions as W, ToolResultParams as X, ManifestPropertySpec as Y, ManifestRelationshipDef as Z, ManifestOperation as _, ToolHandler as a, ManifestVolume as a0, APIError as a1, 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, PermissionRules as r, PermissionProfileListResponse as s, Assignment as t, EnvironmentListResponse as u, Manifest as v, ManifestListResponse as w, BuildStatus as x, Build as y, BuildListResponse as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@granular-software/sdk",
3
- "version": "0.1.0",
4
- "description": "TypeScript SDK for Granular - wrap your existing tools and run them in secure sandboxes",
3
+ "version": "0.2.1",
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",
7
7
  "types": "dist/index.d.ts",
@@ -32,6 +32,9 @@
32
32
  "require": "./dist/adapters/anthropic.js"
33
33
  }
34
34
  },
35
+ "bin": {
36
+ "granular": "./dist/cli/index.js"
37
+ },
35
38
  "files": [
36
39
  "dist",
37
40
  "README.md"
@@ -50,6 +53,7 @@
50
53
  "keywords": [
51
54
  "granular",
52
55
  "sdk",
56
+ "cli",
53
57
  "ai",
54
58
  "agent",
55
59
  "tools",
@@ -66,18 +70,24 @@
66
70
  "url": "https://github.com/granular-dev/granular-sdk"
67
71
  },
68
72
  "dependencies": {
69
- "@automerge/automerge": "^2.2.9",
70
- "ws": "^8.18.2",
73
+ "@automerge/automerge": "^3.2.1",
74
+ "chalk": "^5.4.1",
75
+ "chokidar": "^4.0.3",
76
+ "commander": "^13.1.0",
77
+ "dotenv": "^16.4.7",
78
+ "ora": "^8.2.0",
71
79
  "zod-to-json-schema": "^3.25.1"
72
80
  },
73
81
  "devDependencies": {
82
+ "@anthropic-ai/sdk": "^0.10.0",
83
+ "@langchain/core": "^0.1.0",
84
+ "@types/commander": "^2.12.5",
85
+ "@types/node": "^25.2.3",
74
86
  "@types/ws": "^8.18.1",
87
+ "openai": "^4.0.0",
75
88
  "tsup": "^8.0.0",
76
89
  "typescript": "^5.0.0",
77
- "zod": "3.25.76",
78
- "@langchain/core": "^0.1.0",
79
- "openai": "^4.0.0",
80
- "@anthropic-ai/sdk": "^0.10.0"
90
+ "zod": "3.25.76"
81
91
  },
82
92
  "peerDependencies": {
83
93
  "@mastra/core": ">=0.1.0",