@shardflux/sdk 0.14.0 → 0.15.0

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.
@@ -731,6 +731,87 @@ export interface paths {
731
731
  patch?: never;
732
732
  trace?: never;
733
733
  };
734
+ "/v1/workspaces/{workspace_id}/computer": {
735
+ parameters: {
736
+ query?: never;
737
+ header?: never;
738
+ path: {
739
+ workspace_id: components["parameters"]["WorkspaceId"];
740
+ };
741
+ cookie?: never;
742
+ };
743
+ /**
744
+ * The workspace desktop's state (does not start it)
745
+ * @description Contracts §45.4. Tool `computer` (the token carries it only while the
746
+ * workspace's computer use is on, §45.1).
747
+ */
748
+ get: operations["computerStatus"];
749
+ put?: never;
750
+ /**
751
+ * Start the workspace desktop (no-op while it runs)
752
+ * @description The size applies when this call starts the desktop; a running desktop
753
+ * keeps its size (stop it first to change it). `409 conflict`
754
+ * `details.reason computer_use_unavailable` when the workspace's template
755
+ * cannot run a desktop.
756
+ */
757
+ post: operations["computerStart"];
758
+ /** Stop the workspace desktop (its windows close) */
759
+ delete: operations["computerStop"];
760
+ options?: never;
761
+ head?: never;
762
+ patch?: never;
763
+ trace?: never;
764
+ };
765
+ "/v1/workspaces/{workspace_id}/computer/actions": {
766
+ parameters: {
767
+ query?: never;
768
+ header?: never;
769
+ path: {
770
+ workspace_id: components["parameters"]["WorkspaceId"];
771
+ };
772
+ cookie?: never;
773
+ };
774
+ get?: never;
775
+ put?: never;
776
+ /**
777
+ * Run a batch of computer actions, optionally ending with a screenshot
778
+ * @description Contracts §45.3. Starts the desktop when it does not run. The actions
779
+ * run in order; the first failure stops the batch and the rest are
780
+ * reported `skipped`. An invalid batch runs nothing: `422
781
+ * validation_failed` with `details.index` (-1 for the batch itself).
782
+ */
783
+ post: operations["computerActions"];
784
+ delete?: never;
785
+ options?: never;
786
+ head?: never;
787
+ patch?: never;
788
+ trace?: never;
789
+ };
790
+ "/v1/workspaces/{workspace_id}/computer/stream": {
791
+ parameters: {
792
+ query?: never;
793
+ header?: never;
794
+ path: {
795
+ workspace_id: components["parameters"]["WorkspaceId"];
796
+ };
797
+ cookie?: never;
798
+ };
799
+ get?: never;
800
+ put?: never;
801
+ /**
802
+ * Start the desktop viewer on its guest port
803
+ * @description Contracts §45.5. Expose the returned port with the ports API and open a
804
+ * signed link whose `path` is the returned path. Port 61002 is view
805
+ * only (the guest drops input); 61003 lets the viewer use the desktop.
806
+ */
807
+ post: operations["computerStreamStart"];
808
+ /** End every view of the desktop */
809
+ delete: operations["computerStreamStop"];
810
+ options?: never;
811
+ head?: never;
812
+ patch?: never;
813
+ trace?: never;
814
+ };
734
815
  "/v1/workspaces/{workspace_id}/wake-hint": {
735
816
  parameters: {
736
817
  query?: never;
@@ -1490,6 +1571,111 @@ export interface components {
1490
1571
  }[];
1491
1572
  stderr?: string;
1492
1573
  };
1574
+ ComputerStartRequest: {
1575
+ /** @default 1280 */
1576
+ width?: number;
1577
+ /** @default 800 */
1578
+ height?: number;
1579
+ };
1580
+ ComputerStatus: {
1581
+ running: boolean;
1582
+ /** @example :1 */
1583
+ display?: string;
1584
+ width?: number;
1585
+ height?: number;
1586
+ /** Format: date-time */
1587
+ started_at?: string;
1588
+ /** @description The session command (window manager and panel). */
1589
+ session?: string;
1590
+ streams: {
1591
+ view: boolean;
1592
+ interactive: boolean;
1593
+ };
1594
+ };
1595
+ /**
1596
+ * @description One of Claude's computer toolset members with its parameters
1597
+ * (contracts §45.3). A parameter the action does not take is refused.
1598
+ */
1599
+ ComputerAction: {
1600
+ /** @enum {string} */
1601
+ action: "screenshot" | "zoom" | "left_click" | "right_click" | "middle_click" | "double_click" | "triple_click" | "left_click_drag" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "cursor_position" | "scroll" | "type" | "key" | "hold_key" | "wait";
1602
+ /** @description [x, y] screen pixels. */
1603
+ coordinate?: number[];
1604
+ start_coordinate?: number[];
1605
+ /** @description zoom: [x0, y0, x1, y1]. */
1606
+ region?: number[];
1607
+ /** @description type: the text; key/hold_key: key combinations; clicks, drag, scroll: modifiers held. */
1608
+ text?: string;
1609
+ /** @enum {string} */
1610
+ scroll_direction?: "up" | "down" | "left" | "right";
1611
+ scroll_amount?: number;
1612
+ /** @description Seconds (wait */
1613
+ duration?: number;
1614
+ repeat?: number;
1615
+ };
1616
+ ComputerActionsRequest: {
1617
+ actions: components["schemas"]["ComputerAction"][];
1618
+ /**
1619
+ * @description Append a screenshot after the last action that ran.
1620
+ * @default false
1621
+ */
1622
+ screenshot?: boolean;
1623
+ /** @default 250 */
1624
+ settle_ms?: number;
1625
+ /**
1626
+ * @default png
1627
+ * @enum {string}
1628
+ */
1629
+ format?: "png" | "jpeg";
1630
+ /**
1631
+ * @description jpeg only.
1632
+ * @default 80
1633
+ */
1634
+ quality?: number;
1635
+ };
1636
+ ComputerImage: {
1637
+ /** @enum {string} */
1638
+ format: "png" | "jpeg";
1639
+ width: number;
1640
+ height: number;
1641
+ data: string;
1642
+ };
1643
+ ComputerActionResult: {
1644
+ action: string;
1645
+ ok: boolean;
1646
+ /** @description cursor_position: X=…, Y=… */
1647
+ output?: string;
1648
+ image?: components["schemas"]["ComputerImage"];
1649
+ error?: {
1650
+ /** @enum {string} */
1651
+ code: "action_failed";
1652
+ message: string;
1653
+ };
1654
+ /** @description An earlier action of the batch failed; this one did not run. */
1655
+ skipped?: boolean;
1656
+ /** Format: int64 */
1657
+ took_ms: number;
1658
+ };
1659
+ ComputerActionsResult: {
1660
+ results: components["schemas"]["ComputerActionResult"][];
1661
+ screenshot?: components["schemas"]["ComputerImage"];
1662
+ cursor: number[];
1663
+ display: {
1664
+ width: number;
1665
+ height: number;
1666
+ };
1667
+ };
1668
+ ComputerStreamRequest: {
1669
+ /** @default false */
1670
+ interactive?: boolean;
1671
+ };
1672
+ ComputerStream: {
1673
+ /** @enum {integer} */
1674
+ port: 61002 | 61003;
1675
+ interactive: boolean;
1676
+ /** @description The viewer page */
1677
+ path: string;
1678
+ };
1493
1679
  BrowserScreenshotRequest: {
1494
1680
  url: string;
1495
1681
  /** @default 1280 */
@@ -2582,6 +2768,152 @@ export interface operations {
2582
2768
  default: components["responses"]["Error"];
2583
2769
  };
2584
2770
  };
2771
+ computerStatus: {
2772
+ parameters: {
2773
+ query?: never;
2774
+ header?: never;
2775
+ path: {
2776
+ workspace_id: components["parameters"]["WorkspaceId"];
2777
+ };
2778
+ cookie?: never;
2779
+ };
2780
+ requestBody?: never;
2781
+ responses: {
2782
+ /** @description Desktop state. */
2783
+ 200: {
2784
+ headers: {
2785
+ [name: string]: unknown;
2786
+ };
2787
+ content: {
2788
+ "application/json": components["schemas"]["ComputerStatus"];
2789
+ };
2790
+ };
2791
+ default: components["responses"]["Error"];
2792
+ };
2793
+ };
2794
+ computerStart: {
2795
+ parameters: {
2796
+ query?: never;
2797
+ header?: never;
2798
+ path: {
2799
+ workspace_id: components["parameters"]["WorkspaceId"];
2800
+ };
2801
+ cookie?: never;
2802
+ };
2803
+ requestBody?: {
2804
+ content: {
2805
+ "application/json": components["schemas"]["ComputerStartRequest"];
2806
+ };
2807
+ };
2808
+ responses: {
2809
+ /** @description Desktop state. */
2810
+ 200: {
2811
+ headers: {
2812
+ [name: string]: unknown;
2813
+ };
2814
+ content: {
2815
+ "application/json": components["schemas"]["ComputerStatus"];
2816
+ };
2817
+ };
2818
+ default: components["responses"]["Error"];
2819
+ };
2820
+ };
2821
+ computerStop: {
2822
+ parameters: {
2823
+ query?: never;
2824
+ header?: never;
2825
+ path: {
2826
+ workspace_id: components["parameters"]["WorkspaceId"];
2827
+ };
2828
+ cookie?: never;
2829
+ };
2830
+ requestBody?: never;
2831
+ responses: {
2832
+ /** @description Stopped */
2833
+ 204: {
2834
+ headers: {
2835
+ [name: string]: unknown;
2836
+ };
2837
+ content?: never;
2838
+ };
2839
+ default: components["responses"]["Error"];
2840
+ };
2841
+ };
2842
+ computerActions: {
2843
+ parameters: {
2844
+ query?: never;
2845
+ header?: never;
2846
+ path: {
2847
+ workspace_id: components["parameters"]["WorkspaceId"];
2848
+ };
2849
+ cookie?: never;
2850
+ };
2851
+ requestBody: {
2852
+ content: {
2853
+ "application/json": components["schemas"]["ComputerActionsRequest"];
2854
+ };
2855
+ };
2856
+ responses: {
2857
+ /** @description Per-action results. */
2858
+ 200: {
2859
+ headers: {
2860
+ [name: string]: unknown;
2861
+ };
2862
+ content: {
2863
+ "application/json": components["schemas"]["ComputerActionsResult"];
2864
+ };
2865
+ };
2866
+ default: components["responses"]["Error"];
2867
+ };
2868
+ };
2869
+ computerStreamStart: {
2870
+ parameters: {
2871
+ query?: never;
2872
+ header?: never;
2873
+ path: {
2874
+ workspace_id: components["parameters"]["WorkspaceId"];
2875
+ };
2876
+ cookie?: never;
2877
+ };
2878
+ requestBody?: {
2879
+ content: {
2880
+ "application/json": components["schemas"]["ComputerStreamRequest"];
2881
+ };
2882
+ };
2883
+ responses: {
2884
+ /** @description Viewer started. */
2885
+ 200: {
2886
+ headers: {
2887
+ [name: string]: unknown;
2888
+ };
2889
+ content: {
2890
+ "application/json": components["schemas"]["ComputerStream"];
2891
+ };
2892
+ };
2893
+ default: components["responses"]["Error"];
2894
+ };
2895
+ };
2896
+ computerStreamStop: {
2897
+ parameters: {
2898
+ query?: never;
2899
+ header?: never;
2900
+ path: {
2901
+ workspace_id: components["parameters"]["WorkspaceId"];
2902
+ };
2903
+ cookie?: never;
2904
+ };
2905
+ requestBody?: never;
2906
+ responses: {
2907
+ /** @description Viewers stopped. */
2908
+ 204: {
2909
+ headers: {
2910
+ [name: string]: unknown;
2911
+ };
2912
+ content?: never;
2913
+ };
2914
+ default: components["responses"]["Error"];
2915
+ };
2916
+ };
2585
2917
  workspaceWakeHint: {
2586
2918
  parameters: {
2587
2919
  query?: never;
package/dist/http.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { RetryRecord } from './progress.js';
2
- export declare const SDK_VERSION = "0.14.0";
2
+ export declare const SDK_VERSION = "0.15.0";
3
3
  export interface RequestOptions {
4
4
  query?: Record<string, string | number | boolean | undefined | null>;
5
5
  json?: unknown;
package/dist/http.js CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { ShardfluxApiError, ShardfluxProtocolError, apiError, isErrorBody, isWorkingQuotaRefusal } from "./errors.js";
13
13
  import { describeFailure } from "./progress.js";
14
- export const SDK_VERSION = '0.14.0';
14
+ export const SDK_VERSION = '0.15.0';
15
15
  export const defaultSleep = (ms) => new Promise((r) => setTimeout(r, ms));
16
16
  /**
17
17
  * How long an idle pooled connection stays reusable (ms): 5 minutes, instead of undici's 4 s default, so the request
package/dist/index.d.ts CHANGED
@@ -14,8 +14,10 @@
14
14
  */
15
15
  export type { components, operations, paths } from './generated/app-api.js';
16
16
  export type { components as CellComponents, paths as CellPaths } from './generated/cell-api.js';
17
- export { BillingApi, Shardflux, WorkspacesApi, fetchBillingCatalog, pickByKey } from './client.js';
18
- export type { AgentSession, AllocationMode, BillingCatalog, BillingSubscription, Caps, CheckoutSession, DiskLayout, Entitlements, FindByKeyOptions, ForkTarget, Invoice, InvoicePage, LifetimeFilter, ListParams, Me, OpenParams, OpenResponse, Operation, Page, PortalSession, PurposeFilter, ResetWorkspaceBody, ResizeAppliesAt, ResizeCpu, ResizeDeferReason, ResizeDisk, ResizeLimitReason, ResizeMemory, ResizeParams, ResizeResult, ResizeResponse, ResumeAnswer, ResumeRequestOptions, ResumeResponse, ShardfluxOptions, SuspendRequest, SuspendWhenIdleOptions, SuspendWhenIdleResponse, SuspendWhenIdleResult, WaitOptions, WorkspaceInputs, WorkspaceLifetime, WorkspaceMemory, WorkspaceOrigin, WorkspacePurpose, WorkspaceView, } from './client.js';
17
+ export { BillingApi, Shardflux, WorkspacesApi, fetchBillingCatalog, pickByKey, workspace } from './client.js';
18
+ export { WorkspaceRef } from './workspace-ref.js';
19
+ export type { WorkspaceRefFiles, WorkspaceRefParams } from './workspace-ref.js';
20
+ export type { AgentSession, AllocationMode, ComputerUse, BillingCatalog, BillingSubscription, Caps, CheckoutSession, DiskLayout, Entitlements, FindByKeyOptions, ForkTarget, Invoice, InvoicePage, LifetimeFilter, ListParams, Me, OpenParams, OpenResponse, Operation, Page, PortalSession, PurposeFilter, ResetWorkspaceBody, ResizeAppliesAt, ResizeCpu, ResizeDeferReason, ResizeDisk, ResizeLimitReason, ResizeMemory, ResizeParams, ResizeResult, ResizeResponse, ResumeAnswer, ResumeRequestOptions, ResumeResponse, ShardfluxOptions, SuspendRequest, SuspendWhenIdleOptions, SuspendWhenIdleResponse, SuspendWhenIdleResult, WaitOptions, WorkspaceInputs, WorkspaceLifetime, WorkspaceMemory, WorkspaceOrigin, WorkspacePurpose, WorkspaceView, } from './client.js';
19
21
  export type { FinishedOperation, ForkOptions, LifecycleOptions, ResumeOptions, SuspendOptions, WaitedForkOptions, WaitedLifecycleOptions, WaitedResumeOptions, WaitedSuspendOptions } from './lifecycle.js';
20
22
  export { COLD_BOOT_REASONS, durabilityOf, formatTiming, hostLostOf, isDurable, lostSuspendOf } from './progress.js';
21
23
  export type { ColdBootReason, Durability, HostLost, LostSuspend, LifecycleAction, LifecyclePhase, LifecycleTiming, ProgressEvent, ProgressListener, RetryRecord, ServerTiming, TimingOutcome, TimingPhase, } from './progress.js';
@@ -30,6 +32,8 @@ export { tarEnd, tarHeader, tarPadding } from './tar.js';
30
32
  export type { TarEntry, TarEntryType } from './tar.js';
31
33
  export type { BuildFromFileEvent, BuildFromFileOptions, BuildFromFileResult, BuildFromRecipeOptions, BuilderAvailability, CreateDraftBody, CreateDraftParams, CreateTemplateBuildParams, CreateTestInstanceBody, CreateVersionTestInstanceBody, CreateVersionTestInstanceParams, DraftOpened, LocalUpload, DraftState, OpenTestInstanceParams, OrgTemplateStorage, PublishDraftBody, PublishDraftParams, PutUploadOptions, SaveAsTemplateBody, SaveAsTemplateParams, SaveAsTemplateResponse, TemplateBuild, TemplateBuildLogUrl, TemplateBuildRecipeV2, TemplateBuildRegistrationState, TemplateBuildState, TemplateCategory, TemplateDefaults, TemplateDefaultsInput, TemplateDetail, TemplateDiffChange, TemplateDiffEntry, TemplateDiffPage, TemplateDiffParams, TemplateDraft, TemplateDraftSummary, TemplateEgressDefault, TemplateFileEntry, TemplateFilePage, TemplateFilesParams, TemplateFilesSummary, TemplateInput, TemplateLanguage, TemplateLanguages, TemplateOwner, TemplatePackage, TemplatePackageEcosystem, TemplatePackagePage, TemplateRecipe, TemplateRecipeV2, TemplateRecipeV2File, TemplateService, TemplateSettings, TemplateSettingsInput, TemplateSource, TemplateStartCommand, TemplateStorage, TemplateStorageWarning, TemplateSummary, TemplateUpload, TemplateUploadRequest, TemplateUploadResponse, TemplateUploadResult, TemplateVersion, TemplateVersionImmutable, TemplateVersionRecipe, TemplateVersionState, UploadData, WaitForBuildOptions, WorkspaceStartup, } from './templates.js';
32
34
  export { WorkspacePorts } from './ports.js';
35
+ export { COMPUTER_TOOLSET, WorkspaceComputer, computerToolset, decodeComputerImage } from './computer.js';
36
+ export type { ComputerActOptions, ComputerScreenshot, ComputerStream, ComputerStreamOptions, ComputerToolResult, ComputerToolsetOptions, ToolUseBlockLike } from './computer.js';
33
37
  export type { ExposePortResult, ExposedPort, PortCallbackResponse, PortCallbackUrl, PortLink, PortLinkOptions, PortLinkResponse, PortToken, PortTokenOptions, PortTokenResponse, PortView } from './ports.js';
34
38
  export { SecretsApi, WorkspaceSecrets } from './secrets.js';
35
39
  export type { BoundSecretStatus, CreateOrganizationSecretParams, CreateSecretParams, Secret, SecretAccessEvent, SecretPermissions, SecretScope, SecretVersion, UpdateSecretParams, WorkspaceSecretBindings, } from './secrets.js';
@@ -44,11 +48,11 @@ export type { HintOptions, HintResult, WakeOptions } from './workspace.js';
44
48
  export { CellClient, DEFAULT_TRANSITION_TIMEOUT_MS, cellPath, ndjson } from './cell.js';
45
49
  export { EXECUTION_ID, ExecutionResult, newExecutionId } from './executions.js';
46
50
  export type { ExecutionChange, ExecutionError, ExecutionGetOptions, ExecutionResultBody, ExecutionRunOptions, ExecutionState } from './executions.js';
47
- export type { TreeRevisionOptions, BrowserContent, BrowserContentRequest, BrowserScreenshotRequest, CellClientOptions, ExecSession, ExecStartRequest, MemoryGrow, BurstSummary, BurstError, FileEdit, FileInfo, FileList, FilePatchEdit, FilePatchParams, FilePatchRequest, FilePatchResult, FileReadResult, FileRevision, FileSearchMatch, FileSearchOptions, FileSearchRequest, FileSearchResponse, FileSearchResult, FileWriteResult, GitResult, GitStatus, OutputEvent, ProcessList, PtyOpenRequest, PtySession, Residency, ResourceHint, RunOptions, RunResult, ServedFrom, Signal, WakeHintResult, WorkspaceChange, WorkspaceChangeKind, WorkspaceChangesPage, WorkspaceChangesParams, WorkspaceChangesSummary, } from './cell.js';
51
+ export type { TreeRevisionOptions, BrowserContent, BrowserContentRequest, BrowserScreenshotRequest, CellClientOptions, ComputerAction, ComputerActionName, ComputerActionResult, ComputerActionsRequest, ComputerActionsResult, ComputerImage, ComputerStartRequest, ComputerStatus, ComputerStreamInfo, ExecSession, ExecStartRequest, MemoryGrow, BurstSummary, BurstError, FileEdit, FileInfo, FileList, FilePatchEdit, FilePatchParams, FilePatchRequest, FilePatchResult, FileReadResult, FileRevision, FileSearchMatch, FileSearchOptions, FileSearchRequest, FileSearchResponse, FileSearchResult, FileWriteResult, GitResult, GitStatus, OutputEvent, ProcessList, PtyOpenRequest, PtySession, Residency, ResourceHint, RunOptions, RunResult, ServedFrom, Signal, WakeHintResult, WorkspaceChange, WorkspaceChangeKind, WorkspaceChangesPage, WorkspaceChangesParams, WorkspaceChangesSummary, } from './cell.js';
48
52
  export { ToolTokenManager } from './tokens.js';
49
53
  export type { ToolName, ToolToken, ToolTokenOptions } from './tokens.js';
50
54
  export { ToolArgumentError, executeToolCall, toAnthropicTools, toOpenAITools, validateArgs, workspaceTools } from './tools.js';
51
- export type { AnthropicToolDefinition, JsonSchema, OpenAIChatToolDefinition, OpenAIResponsesToolDefinition, WorkspaceTool, WorkspaceToolsOptions } from './tools.js';
55
+ export type { AnthropicToolDefinition, JsonSchema, OpenAIChatToolDefinition, OpenAIResponsesToolDefinition, ToolTarget, WorkspaceTool, WorkspaceToolsOptions } from './tools.js';
52
56
  export { CaptureError, ToolCallCapture, captureTool } from './capture.js';
53
57
  export type { CallLike, CallRef, CaptureCall, CaptureErrorKind, CaptureEvent, CaptureFlushResult, CapturePart, CaptureSelector, CaptureSource, CaptureStats, CaptureStatus, DropReason, ToolCallCaptureOptions, WrapOptions, } from './capture.js';
54
58
  export type { AiSdkAdapter, AiSdkToolEndEvent, AnthropicAdapter, ClaudeAdapter, ClaudeCaptureHooks, ClaudeHookCallback, ClaudeHookMatcher, LangChainAdapter, LangChainToolHandler, MastraAdapter, MastraAfterToolCallContext, McpAdapter, OpenAIAgentsAdapter, } from './capture-adapters.js';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export { BillingApi, Shardflux, WorkspacesApi, fetchBillingCatalog, pickByKey } from "./client.js";
1
+ export { BillingApi, Shardflux, WorkspacesApi, fetchBillingCatalog, pickByKey, workspace } from "./client.js";
2
+ export { WorkspaceRef } from "./workspace-ref.js";
2
3
  export { COLD_BOOT_REASONS, durabilityOf, formatTiming, hostLostOf, isDurable, lostSuspendOf } from "./progress.js";
3
4
  export { FEEDBACK_CATEGORIES, FEEDBACK_MESSAGE_MAX_LENGTH } from "./feedback.js";
4
5
  export { UsageApi } from "./usage.js";
@@ -6,6 +7,8 @@ export { TemplateBuildTimeoutError, TemplateBuildsApi, TemplateDraftApi, Templat
6
7
  export { TemplateFileError, packDirectory, parseTemplateText, readTemplateFile } from "./template-file.js";
7
8
  export { tarEnd, tarHeader, tarPadding } from "./tar.js";
8
9
  export { WorkspacePorts } from "./ports.js";
10
+ // Computer use (0.15.0+, contracts §45).
11
+ export { COMPUTER_TOOLSET, WorkspaceComputer, computerToolset, decodeComputerImage } from "./computer.js";
9
12
  export { SecretsApi, WorkspaceSecrets } from "./secrets.js";
10
13
  export { EgressPolicyApi } from "./egress.js";
11
14
  export { VolumesApi } from "./volumes.js";
@@ -215,6 +215,8 @@ export interface TemplateSummary {
215
215
  memory_mib: number | null;
216
216
  idle_policy: string | null;
217
217
  };
218
+ /** Computer use (0.15.0+, contracts §45.1): the template's switch for its workspaces (a workspace may override it). */
219
+ computer_use: boolean;
218
220
  open_version: TemplateVersion | null;
219
221
  /** The live draft (organization templates in dev mode), or null. */
220
222
  draft: TemplateDraftSummary | null;
@@ -900,6 +902,16 @@ export declare class TemplatesApi {
900
902
  includeArchived?: boolean;
901
903
  owner?: TemplateOwner;
902
904
  }): Promise<TemplateDetail>;
905
+ /**
906
+ * Computer use (0.15.0+, contracts §45.1): switches it on or off for every workspace of one of your organization's
907
+ * templates (a workspace may override it with setComputerUse). 403 for platform templates (switch a workspace on
908
+ * instead). Owners and admins (sessions) or API keys of the organization with a tool permission.
909
+ */
910
+ setComputerUse(slug: string, enabled: boolean, params?: {
911
+ organizationId?: string;
912
+ }): Promise<{
913
+ enabled: boolean;
914
+ }>;
903
915
  /** Like get() but resolves to null on 404 (unknown slug or outside the organization). */
904
916
  find(slug: string, params?: {
905
917
  organizationId?: string;
package/dist/templates.js CHANGED
@@ -693,6 +693,15 @@ export class TemplatesApi {
693
693
  const path = params.organizationId === undefined ? `/v1/templates/${enc(slug)}` : `/v1/organizations/${enc(params.organizationId)}/templates/${enc(slug)}`;
694
694
  return this.#ctx().http.json('GET', path, { query: { include_archived: params.includeArchived, owner: params.owner } }, this.#ctx().authorization);
695
695
  }
696
+ /**
697
+ * Computer use (0.15.0+, contracts §45.1): switches it on or off for every workspace of one of your organization's
698
+ * templates (a workspace may override it with setComputerUse). 403 for platform templates (switch a workspace on
699
+ * instead). Owners and admins (sessions) or API keys of the organization with a tool permission.
700
+ */
701
+ async setComputerUse(slug, enabled, params = {}) {
702
+ const path = params.organizationId === undefined ? `/v1/templates/${enc(slug)}/computer-use` : `/v1/organizations/${enc(params.organizationId)}/templates/${enc(slug)}/computer-use`;
703
+ return this.#ctx().http.json('PUT', path, { json: { enabled } }, this.#ctx().authorization);
704
+ }
696
705
  /** Like get() but resolves to null on 404 (unknown slug or outside the organization). */
697
706
  async find(slug, params = {}) {
698
707
  try {
package/dist/tools.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { CellClientOptions } from './cell.js';
1
+ import type { CellClient, CellClientOptions } from './cell.js';
2
2
  import type { WorkspaceMode } from './errors.js';
3
3
  import type { ToolName } from './tokens.js';
4
- import type { Workspace } from './workspace.js';
4
+ import type { HintOptions, HintResult } from './workspace.js';
5
5
  /**
6
6
  * The JSON Schema subset of the tool definitions. A type alias rather than an interface (0.8.0+), so a schema is
7
7
  * assignable to the providers' open schema types (`{ [key: string]: unknown }`) without a cast, and an object literal
@@ -48,6 +48,19 @@ export declare class ToolArgumentError extends Error {
48
48
  }
49
49
  /** Validates the JSON-Schema subset used by the tool definitions. Returns problems (empty = valid). */
50
50
  export declare function validateArgs(schema: JsonSchema, value: unknown, path?: string): string[];
51
+ /**
52
+ * What workspace tools act on: an opened `Workspace`, or a `WorkspaceRef` (0.15.0+) whose first tool call opens the key.
53
+ * `cell()` may return a promise (a ref opens first); `mode` and `grantedTools` are read when the tools are built.
54
+ */
55
+ export interface ToolTarget {
56
+ readonly mode: WorkspaceMode;
57
+ readonly grantedTools: ToolName[] | null;
58
+ cell(opts?: {
59
+ agentLabel?: string;
60
+ tools?: ToolName[];
61
+ } & CellClientOptions): CellClient | Promise<CellClient>;
62
+ hint(opts?: HintOptions): Promise<HintResult>;
63
+ }
51
64
  export interface WorkspaceToolsOptions {
52
65
  /**
53
66
  * Tool permissions to expose (default: the tools of the workspace's last token, else all). A file-first workspace
@@ -102,7 +115,7 @@ export interface WorkspaceToolsOptions {
102
115
  burst?: boolean;
103
116
  }
104
117
  /** Builds the tool list for a workspace. Synchronous: tokens are fetched on first use. */
105
- export declare function workspaceTools(workspace: Workspace, opts?: WorkspaceToolsOptions): WorkspaceTool[];
118
+ export declare function workspaceTools(workspace: ToolTarget, opts?: WorkspaceToolsOptions): WorkspaceTool[];
106
119
  /** Anthropic Messages API tool definition; assignable to `Anthropic.Tool` (0.8.0+). */
107
120
  export type AnthropicToolDefinition = {
108
121
  name: string;