@anuma/sdk 11.1.0 → 11.3.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.
@@ -2507,7 +2507,13 @@ type StreamingTransport = (options: StreamingTransportOptions) => StreamingTrans
2507
2507
  /**
2508
2508
  * Tool executor function type
2509
2509
  */
2510
- type ToolExecutor = (args: Record<string, unknown>, signal?: AbortSignal) => Promise<unknown> | unknown;
2510
+ type ToolExecutor = (args: Record<string, unknown>, signal?: AbortSignal, context?: ToolExecutionContext) => Promise<unknown> | unknown;
2511
+ /** How the portal treats a call to this device tool while the device is away. */
2512
+ type DetachedToolClass = "render" | "deferred";
2513
+ /** Context for one executor run; `detached` marks a call from an answer finished while the device was away. */
2514
+ type ToolExecutionContext = {
2515
+ detached?: boolean;
2516
+ };
2511
2517
  /**
2512
2518
  * Tool configuration with optional executor
2513
2519
  */
@@ -2577,6 +2583,8 @@ type ToolConfig = LlmapiChatCompletionTool & {
2577
2583
  * files from IndexedDB that `create_file` writes.
2578
2584
  */
2579
2585
  dependsOn?: string[];
2586
+ /** How the portal handles a call to this tool while the device is away; unset tools pause the turn. */
2587
+ detachedClass?: DetachedToolClass;
2580
2588
  };
2581
2589
  /**
2582
2590
  * Responses API options that can be passed to sendMessage
@@ -9136,6 +9144,8 @@ interface ResumeStreamOptions {
9136
9144
  onFinish?: (response: ApiResponse) => void;
9137
9145
  /** Called on a transient/unexpected failure. Never called for 410 (throws) nor interrupted terminals. */
9138
9146
  onError?: (error: Error) => void;
9147
+ /** Tools a finished replay may end on because the device runs them when the answer is stored. */
9148
+ finishedToolNames?: string[];
9139
9149
  }
9140
9150
  /**
9141
9151
  * Result of {@link resumeStream}. A `410 Gone` is the only outcome that throws
@@ -14930,6 +14940,11 @@ interface UseChatStorageOptions extends BaseUseChatStorageOptions {
14930
14940
  background?: boolean;
14931
14941
  /** The vault inbox that receives answers finished while no client was attached. */
14932
14942
  inbox?: VaultInbox;
14943
+ /**
14944
+ * Device tools that can finish a turn the portal completed while the device was away: their
14945
+ * executors run when that answer is stored. Pass the display tools and the memory save tool.
14946
+ */
14947
+ detachedTools?: ToolConfig[];
14933
14948
  /** Stream handle for each HTTP round, including client-tool continuations. */
14934
14949
  onStreamMeta?: (meta: StreamMeta) => void;
14935
14950
  /**
@@ -2507,7 +2507,13 @@ type StreamingTransport = (options: StreamingTransportOptions) => StreamingTrans
2507
2507
  /**
2508
2508
  * Tool executor function type
2509
2509
  */
2510
- type ToolExecutor = (args: Record<string, unknown>, signal?: AbortSignal) => Promise<unknown> | unknown;
2510
+ type ToolExecutor = (args: Record<string, unknown>, signal?: AbortSignal, context?: ToolExecutionContext) => Promise<unknown> | unknown;
2511
+ /** How the portal treats a call to this device tool while the device is away. */
2512
+ type DetachedToolClass = "render" | "deferred";
2513
+ /** Context for one executor run; `detached` marks a call from an answer finished while the device was away. */
2514
+ type ToolExecutionContext = {
2515
+ detached?: boolean;
2516
+ };
2511
2517
  /**
2512
2518
  * Tool configuration with optional executor
2513
2519
  */
@@ -2577,6 +2583,8 @@ type ToolConfig = LlmapiChatCompletionTool & {
2577
2583
  * files from IndexedDB that `create_file` writes.
2578
2584
  */
2579
2585
  dependsOn?: string[];
2586
+ /** How the portal handles a call to this tool while the device is away; unset tools pause the turn. */
2587
+ detachedClass?: DetachedToolClass;
2580
2588
  };
2581
2589
  /**
2582
2590
  * Responses API options that can be passed to sendMessage
@@ -9136,6 +9144,8 @@ interface ResumeStreamOptions {
9136
9144
  onFinish?: (response: ApiResponse) => void;
9137
9145
  /** Called on a transient/unexpected failure. Never called for 410 (throws) nor interrupted terminals. */
9138
9146
  onError?: (error: Error) => void;
9147
+ /** Tools a finished replay may end on because the device runs them when the answer is stored. */
9148
+ finishedToolNames?: string[];
9139
9149
  }
9140
9150
  /**
9141
9151
  * Result of {@link resumeStream}. A `410 Gone` is the only outcome that throws
@@ -14930,6 +14940,11 @@ interface UseChatStorageOptions extends BaseUseChatStorageOptions {
14930
14940
  background?: boolean;
14931
14941
  /** The vault inbox that receives answers finished while no client was attached. */
14932
14942
  inbox?: VaultInbox;
14943
+ /**
14944
+ * Device tools that can finish a turn the portal completed while the device was away: their
14945
+ * executors run when that answer is stored. Pass the display tools and the memory save tool.
14946
+ */
14947
+ detachedTools?: ToolConfig[];
14933
14948
  /** Stream handle for each HTTP round, including client-tool continuations. */
14934
14949
  onStreamMeta?: (meta: StreamMeta) => void;
14935
14950
  /**