@granular-software/sdk 0.3.3 → 0.3.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.
@@ -14,6 +14,16 @@ interface GranularOptions {
14
14
  apiUrl?: string;
15
15
  /** Optional WebSocket constructor (for Node.js environments) */
16
16
  WebSocketCtor?: any;
17
+ /**
18
+ * Optional callback invoked when a connected WebSocket closes unexpectedly.
19
+ * Useful for forwarding close diagnostics to monitoring (e.g., Sentry).
20
+ */
21
+ onUnexpectedClose?: (info: WSDisconnectInfo) => void;
22
+ /**
23
+ * Optional callback invoked when automatic reconnect fails.
24
+ * Useful to capture auth or gateway rejection causes.
25
+ */
26
+ onReconnectError?: (info: WSReconnectErrorInfo) => void;
17
27
  }
18
28
  /** Resolved auth credential: either apiKey or token must be provided */
19
29
  type GranularAuth = string;
@@ -401,11 +411,27 @@ interface Prompt {
401
411
  options?: string[];
402
412
  defaultValue?: unknown;
403
413
  }
414
+ interface WSDisconnectInfo {
415
+ code?: number;
416
+ reason?: string;
417
+ wasClean?: boolean;
418
+ unexpected: boolean;
419
+ timestamp: number;
420
+ reconnectScheduled: boolean;
421
+ reconnectDelayMs?: number;
422
+ }
423
+ interface WSReconnectErrorInfo {
424
+ sessionId: string;
425
+ error: string;
426
+ timestamp: number;
427
+ }
404
428
  interface WSClientOptions {
405
429
  url: string;
406
430
  sessionId: string;
407
431
  token: string;
408
432
  WebSocketCtor?: any;
433
+ onUnexpectedClose?: (info: WSDisconnectInfo) => void;
434
+ onReconnectError?: (info: WSReconnectErrorInfo) => void;
409
435
  }
410
436
  interface RPCRequest {
411
437
  type: 'rpc';
@@ -636,4 +662,4 @@ interface DeleteResponse {
636
662
  deleted: boolean;
637
663
  }
638
664
 
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 };
665
+ export type { ManifestPropertySpec 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, WSDisconnectInfo as N, WSReconnectErrorInfo as O, PublishToolsResult as P, RPCRequest as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, RPCResponse as V, WSClientOptions as W, SyncMessage as X, RPCRequestFromServer as Y, ToolInvokeParams as Z, ToolResultParams as _, ToolHandler as a, ManifestRelationshipDef as a0, ManifestOperation as a1, ManifestImport as a2, ManifestVolume as a3, APIError as a4, 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 };
@@ -14,6 +14,16 @@ interface GranularOptions {
14
14
  apiUrl?: string;
15
15
  /** Optional WebSocket constructor (for Node.js environments) */
16
16
  WebSocketCtor?: any;
17
+ /**
18
+ * Optional callback invoked when a connected WebSocket closes unexpectedly.
19
+ * Useful for forwarding close diagnostics to monitoring (e.g., Sentry).
20
+ */
21
+ onUnexpectedClose?: (info: WSDisconnectInfo) => void;
22
+ /**
23
+ * Optional callback invoked when automatic reconnect fails.
24
+ * Useful to capture auth or gateway rejection causes.
25
+ */
26
+ onReconnectError?: (info: WSReconnectErrorInfo) => void;
17
27
  }
18
28
  /** Resolved auth credential: either apiKey or token must be provided */
19
29
  type GranularAuth = string;
@@ -401,11 +411,27 @@ interface Prompt {
401
411
  options?: string[];
402
412
  defaultValue?: unknown;
403
413
  }
414
+ interface WSDisconnectInfo {
415
+ code?: number;
416
+ reason?: string;
417
+ wasClean?: boolean;
418
+ unexpected: boolean;
419
+ timestamp: number;
420
+ reconnectScheduled: boolean;
421
+ reconnectDelayMs?: number;
422
+ }
423
+ interface WSReconnectErrorInfo {
424
+ sessionId: string;
425
+ error: string;
426
+ timestamp: number;
427
+ }
404
428
  interface WSClientOptions {
405
429
  url: string;
406
430
  sessionId: string;
407
431
  token: string;
408
432
  WebSocketCtor?: any;
433
+ onUnexpectedClose?: (info: WSDisconnectInfo) => void;
434
+ onReconnectError?: (info: WSReconnectErrorInfo) => void;
409
435
  }
410
436
  interface RPCRequest {
411
437
  type: 'rpc';
@@ -636,4 +662,4 @@ interface DeleteResponse {
636
662
  deleted: boolean;
637
663
  }
638
664
 
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 };
665
+ export type { ManifestPropertySpec 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, WSDisconnectInfo as N, WSReconnectErrorInfo as O, PublishToolsResult as P, RPCRequest as Q, RecordUserOptions as R, SandboxListResponse as S, ToolWithHandler as T, User as U, RPCResponse as V, WSClientOptions as W, SyncMessage as X, RPCRequestFromServer as Y, ToolInvokeParams as Z, ToolResultParams as _, ToolHandler as a, ManifestRelationshipDef as a0, ManifestOperation as a1, ManifestImport as a2, ManifestVolume as a3, APIError as a4, 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.3",
3
+ "version": "0.3.4",
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",