@hypercli.com/sdk 0.9.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.
Files changed (193) hide show
  1. package/README.md +629 -0
  2. package/dist/acp-driver.d.ts +72 -0
  3. package/dist/acp-driver.d.ts.map +1 -0
  4. package/dist/acp-driver.js +147 -0
  5. package/dist/acp-driver.js.map +1 -0
  6. package/dist/acp-pool.d.ts +70 -0
  7. package/dist/acp-pool.d.ts.map +1 -0
  8. package/dist/acp-pool.js +181 -0
  9. package/dist/acp-pool.js.map +1 -0
  10. package/dist/acp.d.ts +179 -0
  11. package/dist/acp.d.ts.map +1 -0
  12. package/dist/acp.js +487 -0
  13. package/dist/acp.js.map +1 -0
  14. package/dist/agent-persona.d.ts +68 -0
  15. package/dist/agent-persona.d.ts.map +1 -0
  16. package/dist/agent-persona.js +78 -0
  17. package/dist/agent-persona.js.map +1 -0
  18. package/dist/agent-slots.d.ts +18 -0
  19. package/dist/agent-slots.d.ts.map +1 -0
  20. package/dist/agent-slots.js +24 -0
  21. package/dist/agent-slots.js.map +1 -0
  22. package/dist/agent-urls.d.ts +47 -0
  23. package/dist/agent-urls.d.ts.map +1 -0
  24. package/dist/agent-urls.js +178 -0
  25. package/dist/agent-urls.js.map +1 -0
  26. package/dist/agent.d.ts +482 -0
  27. package/dist/agent.d.ts.map +1 -0
  28. package/dist/agent.js +926 -0
  29. package/dist/agent.js.map +1 -0
  30. package/dist/agents.d.ts +1452 -0
  31. package/dist/agents.d.ts.map +1 -0
  32. package/dist/agents.js +4022 -0
  33. package/dist/agents.js.map +1 -0
  34. package/dist/billing.d.ts +72 -0
  35. package/dist/billing.d.ts.map +1 -0
  36. package/dist/billing.js +93 -0
  37. package/dist/billing.js.map +1 -0
  38. package/dist/browser-jobs.d.ts +24 -0
  39. package/dist/browser-jobs.d.ts.map +1 -0
  40. package/dist/browser-jobs.js +209 -0
  41. package/dist/browser-jobs.js.map +1 -0
  42. package/dist/browser.d.ts +41 -0
  43. package/dist/browser.d.ts.map +1 -0
  44. package/dist/browser.js +57 -0
  45. package/dist/browser.js.map +1 -0
  46. package/dist/buzz-activity.d.ts +169 -0
  47. package/dist/buzz-activity.d.ts.map +1 -0
  48. package/dist/buzz-activity.js +844 -0
  49. package/dist/buzz-activity.js.map +1 -0
  50. package/dist/channels.d.ts +99 -0
  51. package/dist/channels.d.ts.map +1 -0
  52. package/dist/channels.js +27 -0
  53. package/dist/channels.js.map +1 -0
  54. package/dist/chat-integrations.d.ts +44 -0
  55. package/dist/chat-integrations.d.ts.map +1 -0
  56. package/dist/chat-integrations.js +138 -0
  57. package/dist/chat-integrations.js.map +1 -0
  58. package/dist/client.d.ts +88 -0
  59. package/dist/client.d.ts.map +1 -0
  60. package/dist/client.js +144 -0
  61. package/dist/client.js.map +1 -0
  62. package/dist/config.d.ts +44 -0
  63. package/dist/config.d.ts.map +1 -0
  64. package/dist/config.js +192 -0
  65. package/dist/config.js.map +1 -0
  66. package/dist/connectors.d.ts +80 -0
  67. package/dist/connectors.d.ts.map +1 -0
  68. package/dist/connectors.js +2 -0
  69. package/dist/connectors.js.map +1 -0
  70. package/dist/errors.d.ts +16 -0
  71. package/dist/errors.d.ts.map +1 -0
  72. package/dist/errors.js +26 -0
  73. package/dist/errors.js.map +1 -0
  74. package/dist/files.d.ts +60 -0
  75. package/dist/files.d.ts.map +1 -0
  76. package/dist/files.js +128 -0
  77. package/dist/files.js.map +1 -0
  78. package/dist/http.d.ts +56 -0
  79. package/dist/http.d.ts.map +1 -0
  80. package/dist/http.js +362 -0
  81. package/dist/http.js.map +1 -0
  82. package/dist/index.d.ts +49 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +64 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/instances.d.ts +94 -0
  87. package/dist/instances.d.ts.map +1 -0
  88. package/dist/instances.js +197 -0
  89. package/dist/instances.js.map +1 -0
  90. package/dist/integrations.d.ts +111 -0
  91. package/dist/integrations.d.ts.map +1 -0
  92. package/dist/integrations.js +206 -0
  93. package/dist/integrations.js.map +1 -0
  94. package/dist/job/base.d.ts +86 -0
  95. package/dist/job/base.d.ts.map +1 -0
  96. package/dist/job/base.js +206 -0
  97. package/dist/job/base.js.map +1 -0
  98. package/dist/job/comfyui.d.ts +259 -0
  99. package/dist/job/comfyui.d.ts.map +1 -0
  100. package/dist/job/comfyui.js +1563 -0
  101. package/dist/job/comfyui.js.map +1 -0
  102. package/dist/job/gradio.d.ts +48 -0
  103. package/dist/job/gradio.d.ts.map +1 -0
  104. package/dist/job/gradio.js +90 -0
  105. package/dist/job/gradio.js.map +1 -0
  106. package/dist/job-codecs.d.ts +66 -0
  107. package/dist/job-codecs.d.ts.map +1 -0
  108. package/dist/job-codecs.js +132 -0
  109. package/dist/job-codecs.js.map +1 -0
  110. package/dist/jobs.d.ts +148 -0
  111. package/dist/jobs.d.ts.map +1 -0
  112. package/dist/jobs.js +480 -0
  113. package/dist/jobs.js.map +1 -0
  114. package/dist/keys.d.ts +99 -0
  115. package/dist/keys.d.ts.map +1 -0
  116. package/dist/keys.js +145 -0
  117. package/dist/keys.js.map +1 -0
  118. package/dist/logs.d.ts +54 -0
  119. package/dist/logs.d.ts.map +1 -0
  120. package/dist/logs.js +256 -0
  121. package/dist/logs.js.map +1 -0
  122. package/dist/managed-context.d.ts +20 -0
  123. package/dist/managed-context.d.ts.map +1 -0
  124. package/dist/managed-context.js +95 -0
  125. package/dist/managed-context.js.map +1 -0
  126. package/dist/mcp.d.ts +7 -0
  127. package/dist/mcp.d.ts.map +1 -0
  128. package/dist/mcp.js +8 -0
  129. package/dist/mcp.js.map +1 -0
  130. package/dist/memory.d.ts +87 -0
  131. package/dist/memory.d.ts.map +1 -0
  132. package/dist/memory.js +79 -0
  133. package/dist/memory.js.map +1 -0
  134. package/dist/models.d.ts +15 -0
  135. package/dist/models.d.ts.map +1 -0
  136. package/dist/models.js +19 -0
  137. package/dist/models.js.map +1 -0
  138. package/dist/openclaw-control-ui-origin.d.ts +23 -0
  139. package/dist/openclaw-control-ui-origin.d.ts.map +1 -0
  140. package/dist/openclaw-control-ui-origin.js +53 -0
  141. package/dist/openclaw-control-ui-origin.js.map +1 -0
  142. package/dist/renders.d.ts +187 -0
  143. package/dist/renders.d.ts.map +1 -0
  144. package/dist/renders.js +360 -0
  145. package/dist/renders.js.map +1 -0
  146. package/dist/routines.d.ts +59 -0
  147. package/dist/routines.d.ts.map +1 -0
  148. package/dist/routines.js +135 -0
  149. package/dist/routines.js.map +1 -0
  150. package/dist/runners.d.ts +61 -0
  151. package/dist/runners.d.ts.map +1 -0
  152. package/dist/runners.js +127 -0
  153. package/dist/runners.js.map +1 -0
  154. package/dist/sessions.d.ts +280 -0
  155. package/dist/sessions.d.ts.map +1 -0
  156. package/dist/sessions.js +292 -0
  157. package/dist/sessions.js.map +1 -0
  158. package/dist/skills.d.ts +170 -0
  159. package/dist/skills.d.ts.map +1 -0
  160. package/dist/skills.js +2 -0
  161. package/dist/skills.js.map +1 -0
  162. package/dist/user.d.ts +78 -0
  163. package/dist/user.d.ts.map +1 -0
  164. package/dist/user.js +143 -0
  165. package/dist/user.js.map +1 -0
  166. package/dist/version.d.ts +2 -0
  167. package/dist/version.d.ts.map +1 -0
  168. package/dist/version.js +3 -0
  169. package/dist/version.js.map +1 -0
  170. package/dist/voice-session.d.ts +66 -0
  171. package/dist/voice-session.d.ts.map +1 -0
  172. package/dist/voice-session.js +366 -0
  173. package/dist/voice-session.js.map +1 -0
  174. package/dist/voice-transcription-session.d.ts +64 -0
  175. package/dist/voice-transcription-session.d.ts.map +1 -0
  176. package/dist/voice-transcription-session.js +228 -0
  177. package/dist/voice-transcription-session.js.map +1 -0
  178. package/dist/voice.d.ts +62 -0
  179. package/dist/voice.d.ts.map +1 -0
  180. package/dist/voice.js +134 -0
  181. package/dist/voice.js.map +1 -0
  182. package/dist/workspace-tomd.d.ts +61 -0
  183. package/dist/workspace-tomd.d.ts.map +1 -0
  184. package/dist/workspace-tomd.js +177 -0
  185. package/dist/workspace-tomd.js.map +1 -0
  186. package/dist/workspaces.d.ts +255 -0
  187. package/dist/workspaces.d.ts.map +1 -0
  188. package/dist/workspaces.js +653 -0
  189. package/dist/workspaces.js.map +1 -0
  190. package/package.json +115 -0
  191. package/runtime/config-require.browser.js +4 -0
  192. package/runtime/config-require.d.ts +2 -0
  193. package/runtime/config-require.node.js +8 -0
@@ -0,0 +1,1452 @@
1
+ declare function preferredWebSocket(): typeof WebSocket;
2
+ export { preferredWebSocket };
3
+ import { type AgentSlot, type AgentSlotInventory, type AgentSlotSize } from './agent-slots.js';
4
+ export { agentSlotFromDict, parseAgentSlotSize, type AgentSlot, type AgentSlotInventory, type AgentSlotSize, } from './agent-slots.js';
5
+ export { parseControlUiAllowedOrigins, } from './openclaw-control-ui-origin.js';
6
+ import { type BuzzActivityHandlers, type BuzzActivityRouteHandlers, type BuzzActivitySubscription } from './buzz-activity.js';
7
+ import { CodingAgentAcpClient, type CodingAgentAcpConnectOptions } from './acp.js';
8
+ import { CodingAgentAcpPool } from './acp-pool.js';
9
+ import { AcpTurnDriver, type AcpTurnDriverOptions } from './acp-driver.js';
10
+ export { CodingAgentAcpClient, CodingAgentAcpConnectionError, CodingAgentAcpRequestError, CodingAgentAcpAttachmentError, CodingAgentAcpUnavailableError, ACP_RECONNECT_DELAYS_MS, type CodingAgentAcpConnectOptions, type CodingAgentAcpStage, type CodingAgentAcpDiagnostic, type CodingAgentAcpDiagnosticError, } from './acp.js';
11
+ export { AcpTurnDriver, type AcpTurnBundle, type AcpTurnDriverOptions, type AcpTurnDriverState, type AcpTurnOutcome, } from './acp-driver.js';
12
+ export { CodingAgentAcpPool, type AcpLease } from './acp-pool.js';
13
+ export { BuzzActivityGapError, BuzzActivityRouteUnavailableError, } from './buzz-activity.js';
14
+ import { APIError } from './errors.js';
15
+ import { HTTPClient, type RequestOverrides } from './http.js';
16
+ export declare const DEFAULT_OPENCLAW_IMAGE = "ghcr.io/hypercli/hypercli-openclaw:prod";
17
+ export declare const DEFAULT_HERMES_AGENT_IMAGE = "ghcr.io/hypercli/hypercli-hermes:latest";
18
+ export declare const DEFAULT_OPENCODE_IMAGE = "ghcr.io/hypercli/hypercli-opencode:latest";
19
+ export declare const DEFAULT_CODEX_IMAGE = "ghcr.io/hypercli/hypercli-codex:latest";
20
+ export declare const DEFAULT_CLAUDE_CODE_IMAGE = "ghcr.io/hypercli/hypercli-claude:latest";
21
+ export declare const DEFAULT_GOOSE_IMAGE = "ghcr.io/hypercli/hypercli-goose:latest";
22
+ export declare const DEFAULT_KIMI_CODE_IMAGE = "ghcr.io/hypercli/hypercli-kimi-code:latest";
23
+ export declare const DEFAULT_PI_IMAGE = "ghcr.io/hypercli/hypercli-pi:latest";
24
+ export declare const DEFAULT_BUZZ_AGENT_IMAGE = "ghcr.io/hypercli/hypercli-buzz-agent:latest";
25
+ export declare const DEFAULT_BUZZ_OPENCODE_IMAGE = "ghcr.io/hypercli/hypercli-opencode:latest";
26
+ export declare const DEFAULT_BUZZ_CODEX_IMAGE = "ghcr.io/hypercli/hypercli-codex:latest";
27
+ export declare const DEFAULT_BUZZ_CLAUDE_CODE_IMAGE = "ghcr.io/hypercli/hypercli-claude:latest";
28
+ export declare const DEFAULT_BUZZ_GOOSE_IMAGE = "ghcr.io/hypercli/hypercli-goose:latest";
29
+ export declare const DEFAULT_BUZZ_KIMI_CODE_IMAGE = "ghcr.io/hypercli/hypercli-kimi-code:latest";
30
+ export declare const DEFAULT_AGENT_RUNTIME_SCOPES: readonly string[];
31
+ export declare const DEFAULT_CODING_AGENT_SYNC_ROOT = "/home/node";
32
+ export declare const MAX_DOCKER_VOLUMES = 64;
33
+ export declare const DEFAULT_PI_ENV: Readonly<{}>;
34
+ export type ManagedAgentRuntime = 'generic' | 'openclaw_acp' | 'hermes_acp' | 'buzz-agent' | 'opencode' | 'codex' | 'claude-code' | 'goose' | 'kimi-code' | 'pi';
35
+ export type CodingAgentRuntime = Extract<ManagedAgentRuntime, 'buzz-agent' | 'opencode' | 'codex' | 'claude-code' | 'goose' | 'kimi-code' | 'pi'>;
36
+ export declare const DEFAULT_CODING_AGENT_IMAGES: Readonly<Record<CodingAgentRuntime, string>>;
37
+ export declare const DEFAULT_CODING_AGENT_SYNC_INCLUDES: Readonly<Record<CodingAgentRuntime, readonly string[] | null>>;
38
+ export declare const DEFAULT_BUZZ_CODING_AGENT_IMAGES: Readonly<Record<CodingAgentRuntime, string>>;
39
+ export declare const DEFAULT_BUZZ_RUST_LOG = "hyper_acp=info,buzz_acp=info,pool::prompt=info,acp::stream=off";
40
+ export declare const OPENCLAW_MEMORY_SEARCH_ENV_DEFAULTS: {
41
+ readonly OPENCLAW_MEMORY_SEARCH_ENABLED: "1";
42
+ readonly OPENCLAW_MEMORY_SEARCH_SYNC_ON_SESSION_START: "0";
43
+ readonly OPENCLAW_MEMORY_SEARCH_SYNC_ON_SEARCH: "0";
44
+ readonly OPENCLAW_MEMORY_SEARCH_SYNC_WATCH: "0";
45
+ readonly OPENCLAW_MEMORY_SEARCH_SYNC_WATCH_DEBOUNCE_MS: "30000";
46
+ readonly OPENCLAW_MEMORY_SEARCH_SYNC_INTERVAL_MINUTES: "0";
47
+ };
48
+ export declare const WORKSPACES_SYNC_ENV_DEFAULTS: {
49
+ readonly HYPER_WORKSPACES_BOOT_SYNC: "1";
50
+ readonly HYPER_WORKSPACES_DIR: "/home/node/shared";
51
+ readonly HYPER_WORKSPACES_SYNC_READY_ONLY: "1";
52
+ };
53
+ export declare const OPENCLAW_CRON_ENV_DEFAULTS: {
54
+ readonly OPENCLAW_CRON_ENABLED: "1";
55
+ };
56
+ export declare const HERMES_CRON_ENV_DEFAULTS: {
57
+ readonly HERMES_CRON_ENABLED: "1";
58
+ };
59
+ export declare const DEFAULT_HERMES_AGENT_SYNC_ROOT = "/home/hermes";
60
+ export declare const DEFAULT_HERMES_AGENT_SYNC_EXCLUDE: readonly ["shared/**"];
61
+ export declare const DEFAULT_HERMES_AGENT_SYNC_UID = 10000;
62
+ export declare const DEFAULT_HERMES_AGENT_SYNC_GID = 10000;
63
+ export declare const AGENT_FILE_MAX_BYTES: number;
64
+ export declare const AGENT_FILE_WRITE_MAX_BYTES: number;
65
+ export declare const AGENT_FILE_TRANSFER_CHUNK_BYTES: number;
66
+ export declare const AGENT_FILE_OPERATION_TIMEOUT_MS = 300000;
67
+ export interface AgentExecResult {
68
+ exitCode: number;
69
+ stdout: string;
70
+ stderr: string;
71
+ }
72
+ /** Buffered exec stdin cap, mirrored by the backend exec protocol. */
73
+ export declare const AGENT_EXEC_STDIN_MAX_BYTES = 262144;
74
+ export interface AgentMetricsResult {
75
+ event: 'agent_metrics_result';
76
+ ok: true;
77
+ cpu: string;
78
+ memory: string;
79
+ timestamp: number;
80
+ }
81
+ export interface AgentOperationTokenResponse {
82
+ agent_id: string;
83
+ token: string;
84
+ expires_at: string;
85
+ ws_url: string;
86
+ }
87
+ export interface AgentTokenResponse {
88
+ agent_id?: string;
89
+ token: string;
90
+ expires_at?: string | null;
91
+ desktop_viewport?: {
92
+ width: number;
93
+ height: number;
94
+ } | null;
95
+ }
96
+ export interface BrowserDesktopUrlOptions {
97
+ redirect?: string | null;
98
+ resize?: string | null;
99
+ }
100
+ export interface AgentEnvResponse {
101
+ agent_id: string;
102
+ env: Record<string, string>;
103
+ launch_epoch: number;
104
+ }
105
+ /** Minimal response from mutating one stored launch-environment key. */
106
+ export interface AgentEnvMutationResponse {
107
+ agent_id: string;
108
+ key: string;
109
+ present: boolean;
110
+ launch_epoch: number;
111
+ }
112
+ /** Minimal response from mutating one stored launch secret; values are never returned. */
113
+ export type AgentSecretMutationResponse = AgentEnvMutationResponse;
114
+ export interface AgentSecretNamesResponse {
115
+ agent_id: string;
116
+ names: string[];
117
+ launch_epoch: number;
118
+ }
119
+ export interface AgentSecretResponse {
120
+ agent_id: string;
121
+ key: string;
122
+ value: string;
123
+ launch_epoch: number;
124
+ }
125
+ export interface AgentShellTokenResponse {
126
+ agent_id: string;
127
+ token: string;
128
+ expires_at: string;
129
+ ws_url: string;
130
+ shell: string;
131
+ }
132
+ export interface AgentShellConnectOptions {
133
+ signal?: AbortSignal;
134
+ tokenTimeoutMs?: number;
135
+ openTimeoutMs?: number;
136
+ }
137
+ export interface AgentLogsTokenResponse {
138
+ agent_id?: string;
139
+ token: string;
140
+ expires_at?: string | null;
141
+ ws_url?: string;
142
+ }
143
+ /** Captured runner-file provenance, matching AssignmentLogResult's product projection. */
144
+ export interface AgentLogCapture {
145
+ assignment_id: string;
146
+ source: 'stdout' | 'stderr';
147
+ generation: 'current' | 'previous';
148
+ file_generation: string | null;
149
+ launch_epoch: number | null;
150
+ /** Exact bytes. Empty string is an available empty file; null is unavailable. */
151
+ content_base64: string | null;
152
+ truncated: boolean;
153
+ unavailable: 'unavailable' | 'not_supported' | 'invalid_limit' | 'io_error' | null;
154
+ capture: {
155
+ state: 'unknown' | 'capturing' | 'complete' | 'unavailable';
156
+ dropped_bytes: number;
157
+ } | null;
158
+ diagnostics_dropped: number;
159
+ runner_version: string;
160
+ runner_revision: string | null;
161
+ executable_sha256: string | null;
162
+ }
163
+ export interface AgentCapturedLogsSnapshot {
164
+ agent_id: string;
165
+ transport: 'runner';
166
+ /** Lossy UTF-8 display projection, stdout then stderr; not chronological merging. */
167
+ logs: string | null;
168
+ unavailable: AgentLogCapture['unavailable'] | 'unsupported' | 'offline' | 'timeout' | 'busy';
169
+ captures: AgentLogCapture[];
170
+ }
171
+ export interface AgentCapturedLogsEvent extends AgentCapturedLogsSnapshot {
172
+ event: 'captured_logs';
173
+ }
174
+ export type AgentLogsResponse = {
175
+ agent_id: string;
176
+ logs: string;
177
+ transport?: undefined;
178
+ } | AgentCapturedLogsSnapshot;
179
+ export interface AgentLogsReadOptions {
180
+ source?: 'both' | 'stdout' | 'stderr';
181
+ generation?: 'current' | 'previous';
182
+ /** Per-source bound, 1..65536. Omitted uses the backend default. */
183
+ maxBytes?: number;
184
+ /** Per-source bound, 1..1000. Omitted uses the backend default. */
185
+ maxLines?: number;
186
+ }
187
+ export declare class AgentCapturedLogsError extends APIError {
188
+ readonly snapshot: AgentCapturedLogsSnapshot;
189
+ constructor(error: APIError, snapshot: AgentCapturedLogsSnapshot);
190
+ }
191
+ /**
192
+ * One decoded frame from the agent logs WebSocket.
193
+ *
194
+ * The socket opens with the replayed history as `log` frames, sends
195
+ * `history_end` once replay is complete, then streams live `log` frames. A
196
+ * frame that is not a recognisable envelope degrades to a log line rather than
197
+ * vanishing, so a pre-envelope or plain-text server stays readable. Unknown
198
+ * envelope events are ignored so future control frames never reach the log view.
199
+ */
200
+ export type AgentLogFrame = {
201
+ kind: 'log';
202
+ line: string;
203
+ } | {
204
+ kind: 'capturedLogs';
205
+ snapshot: AgentCapturedLogsEvent;
206
+ } | {
207
+ kind: 'historyEnd';
208
+ } | {
209
+ kind: 'error';
210
+ detail: string;
211
+ } | {
212
+ kind: 'ignore';
213
+ };
214
+ export declare function parseAgentLogFrame(raw: string): AgentLogFrame;
215
+ export interface AgentLogsConnectOptions extends AgentLogsReadOptions {
216
+ /** Historical lines to replay before live frames. 0 replays the whole buffer. */
217
+ tailLines?: number;
218
+ container?: string;
219
+ signal?: AbortSignal;
220
+ }
221
+ export interface AgentLogsSubscribeOptions extends AgentLogsConnectOptions {
222
+ /** Runs after socket authentication and before any frame is read. */
223
+ onReady?: () => void | Promise<void>;
224
+ /** Runs once replay is complete, before any live frame is delivered. */
225
+ onHistoryEnd?: () => void | Promise<void>;
226
+ /** Replace the captured-tail view. Never append these overlapping snapshots as lines. */
227
+ onCapturedLogs?: (snapshot: AgentCapturedLogsEvent) => void | Promise<void>;
228
+ /**
229
+ * Runs when the peer closes the socket, carrying the close code. Reconnect
230
+ * policy lives with the caller, so the caller needs the code that decides it:
231
+ * an auth-scoped close must not be retried, a transport drop may be.
232
+ */
233
+ onClose?: (event: {
234
+ code: number;
235
+ reason: string;
236
+ }) => void;
237
+ /**
238
+ * Keep the socket open after replay. With `follow: false` the returned
239
+ * promise resolves at `history_end` or after the first captured snapshot:
240
+ * its socket is snapshot-then-silence and would otherwise hang.
241
+ */
242
+ follow?: boolean;
243
+ }
244
+ export interface AgentRelayKey {
245
+ key_id?: string | null;
246
+ key_name?: string | null;
247
+ tags?: string[];
248
+ api_key?: string | null;
249
+ api_key_preview?: string | null;
250
+ last4?: string | null;
251
+ [key: string]: any;
252
+ }
253
+ export interface AgentProfileImageUploadResult {
254
+ id: string;
255
+ avatar_url: string | null;
256
+ s3_key: string | null;
257
+ }
258
+ export interface ListAgentsOptions extends RequestOverrides {
259
+ state?: string | null;
260
+ handle?: string | null;
261
+ name?: string | null;
262
+ query?: string | null;
263
+ includeDeleted?: boolean | null;
264
+ }
265
+ export interface AgentCapacity {
266
+ items: Agent[];
267
+ totalAgents: number;
268
+ maxAgentsPerAccount: number;
269
+ runningAgents: number;
270
+ slots: Record<string, AgentSlotInventory>;
271
+ agentSlots: AgentSlot[];
272
+ pooledTpd: number;
273
+ }
274
+ export interface SlackOAuthStartOptions {
275
+ relayBaseUrl: string;
276
+ token: string;
277
+ }
278
+ export interface SlackOAuthStartResult {
279
+ authorizeUrl: string;
280
+ expiresAt?: string | null;
281
+ }
282
+ export interface SlackInstallStatusOptions {
283
+ relayBaseUrl: string;
284
+ token: string;
285
+ }
286
+ export interface SlackInstallStatus {
287
+ connected: boolean;
288
+ teamId?: string | null;
289
+ teamName?: string | null;
290
+ botUserId?: string | null;
291
+ installerUserId?: string | null;
292
+ updatedAt?: string | null;
293
+ }
294
+ export interface SlackDirectoryOptions {
295
+ relayBaseUrl: string;
296
+ token: string;
297
+ cursor?: string | null;
298
+ limit?: number | null;
299
+ }
300
+ export interface SlackDirectoryConversationsOptions extends SlackDirectoryOptions {
301
+ types?: string | null;
302
+ }
303
+ export interface SlackDirectoryConversation {
304
+ id: string;
305
+ name?: string | null;
306
+ isChannel?: boolean | null;
307
+ isGroup?: boolean | null;
308
+ isIm?: boolean | null;
309
+ isMpim?: boolean | null;
310
+ isMember?: boolean | null;
311
+ isPrivate?: boolean | null;
312
+ }
313
+ export interface SlackDirectoryUser {
314
+ id: string;
315
+ name?: string | null;
316
+ realName?: string | null;
317
+ teamId?: string | null;
318
+ isBot?: boolean | null;
319
+ deleted?: boolean | null;
320
+ }
321
+ export interface SlackDirectoryConversationsResult {
322
+ conversations: SlackDirectoryConversation[];
323
+ nextCursor?: string | null;
324
+ }
325
+ export interface SlackDirectoryUsersResult {
326
+ users: SlackDirectoryUser[];
327
+ nextCursor?: string | null;
328
+ }
329
+ export interface AttachSlackRelayAgentOptions {
330
+ relayBaseUrl: string;
331
+ token: string;
332
+ agentId: string;
333
+ }
334
+ export interface AttachSlackRelayAgentResult {
335
+ connected: boolean;
336
+ agentId: string;
337
+ gatewayId: string;
338
+ restartRequired: boolean;
339
+ teamId?: string | null;
340
+ teamName?: string | null;
341
+ botUserId?: string | null;
342
+ }
343
+ export interface AttachDeploymentSlackRelayAgentOptions {
344
+ relayBaseUrl: string;
345
+ token?: string;
346
+ }
347
+ export interface BraveWebSearchOptions {
348
+ count?: number;
349
+ country?: string;
350
+ searchLang?: string;
351
+ uiLang?: string;
352
+ freshness?: string;
353
+ }
354
+ export interface BraveWebSearchResponse {
355
+ query?: Record<string, any>;
356
+ web?: {
357
+ results?: Array<Record<string, any>>;
358
+ [key: string]: any;
359
+ };
360
+ [key: string]: any;
361
+ }
362
+ export interface AgentRouteConfig {
363
+ port: number;
364
+ prefix?: string;
365
+ auth?: boolean;
366
+ /** Request headers to remove before forwarding upstream. */
367
+ remove_headers?: string[];
368
+ }
369
+ export interface AgentCorsConfig {
370
+ allowed_origins: string[];
371
+ allow_credentials?: boolean;
372
+ allowed_headers?: string[];
373
+ allowed_methods?: string[];
374
+ max_age?: number;
375
+ }
376
+ export interface AgentRoutesState {
377
+ agentId: string;
378
+ routes: Record<string, AgentRouteConfig>;
379
+ cors: AgentCorsConfig | null;
380
+ routeStatuses: Record<string, Record<string, unknown>>;
381
+ }
382
+ export interface SetRoutesOptions {
383
+ cors?: AgentCorsConfig | null;
384
+ }
385
+ /**
386
+ * What the presented credential is, as the Backend resolves it.
387
+ *
388
+ * `agentId` is set only for an Agent runtime key, which speaks for exactly one
389
+ * Agent; it is null for an owner user credential or any other key.
390
+ */
391
+ export interface AgentAccessIdentity {
392
+ userId: string;
393
+ authType: string;
394
+ /** The one Agent a runtime key speaks for; null for every other credential. */
395
+ agentId: string | null;
396
+ tags: string[];
397
+ capabilities: string[];
398
+ keyId: string | null;
399
+ keyName: string | null;
400
+ teamId: string | null;
401
+ planId: string | null;
402
+ /** True when this credential is one Agent's own runtime key. */
403
+ isAgentRuntimeKey: boolean;
404
+ }
405
+ export type LaunchConfigFlatMap = Record<string, unknown>;
406
+ export interface AgentDesktopConfigSource {
407
+ launchConfig?: unknown;
408
+ launch_config?: unknown;
409
+ routes?: unknown;
410
+ }
411
+ export interface RegistryAuth {
412
+ username: string;
413
+ password: string;
414
+ }
415
+ /** Runner-docker launch options; bind mounts use Compose short syntax (`source:target[:ro]`). */
416
+ export interface AgentDockerOptions {
417
+ volumes?: string[];
418
+ }
419
+ /** Runner executor; required for runner-placed agents, forbidden for hosted agents. */
420
+ export type AgentExecutor = 'process' | 'docker';
421
+ /** Complete Backend launch_config replacement contract. */
422
+ export interface AgentLaunchConfig {
423
+ config?: Record<string, any>;
424
+ image: string | null;
425
+ env: Record<string, string>;
426
+ secrets: Record<string, string>;
427
+ routes: Record<string, AgentRouteConfig>;
428
+ cors?: AgentCorsConfig | null;
429
+ command: string[];
430
+ entrypoint: string[];
431
+ restart: boolean;
432
+ sync_root: string | null;
433
+ sync_include?: string[] | null;
434
+ sync_exclude?: string[] | null;
435
+ sync_uid: number | null;
436
+ sync_gid: number | null;
437
+ registry_url: string | null;
438
+ registry_auth: RegistryAuth | Record<string, never>;
439
+ runtime_scopes: string[];
440
+ executor?: AgentExecutor;
441
+ /** Retained Runner workspace; resolved on the Runner host. */
442
+ cwd?: string | null;
443
+ docker?: AgentDockerOptions | null;
444
+ }
445
+ export interface BuildAgentConfigOptions {
446
+ /** Absolute Runner-host workspace. Omission selects the Runner OS owner's home. */
447
+ cwd?: string | null;
448
+ env?: Record<string, string>;
449
+ secrets?: Record<string, string>;
450
+ routes?: Record<string, AgentRouteConfig> | null;
451
+ command?: string[] | null;
452
+ entrypoint?: string[] | null;
453
+ image?: string | null;
454
+ /** Absolute runtime mount path for retained PVC storage. */
455
+ syncRoot?: string | null;
456
+ /**
457
+ * Relative paths selected for steady upload and cold restore. Must contain at
458
+ * least one path when supplied; null selects the whole sync root.
459
+ */
460
+ syncInclude?: readonly string[] | null;
461
+ /**
462
+ * Relative patterns excluded from whole-root mode. An empty array excludes
463
+ * nothing. Ignored when a non-null include policy is supplied.
464
+ */
465
+ syncExclude?: readonly string[] | null;
466
+ syncUid?: number | null;
467
+ syncGid?: number | null;
468
+ registryUrl?: string | null;
469
+ registryAuth?: RegistryAuth | null;
470
+ /** Route-plane CORS policy reconciled onto the agent's public routes. */
471
+ cors?: AgentCorsConfig | null;
472
+ restart?: boolean;
473
+ runtimeScopes?: readonly string[] | null;
474
+ /** Runner executor (process runs the command on the runner host, docker runs the image). */
475
+ executor?: AgentExecutor;
476
+ /** Runner-docker launch options (Compose-shape bind volumes); runner placements only. */
477
+ docker?: AgentDockerOptions | null;
478
+ }
479
+ export interface OpenClawRouteOptions {
480
+ includeDesktop?: boolean;
481
+ desktopPort?: number;
482
+ desktopAuth?: boolean;
483
+ desktopPrefix?: string;
484
+ }
485
+ export declare const OPENCLAW_TRUSTED_PROXIES_ENV = "OPENCLAW_TRUSTED_PROXIES";
486
+ export declare function buildOpenClawTrustedProxiesEnv(trustedProxies: readonly string[] | null | undefined): Record<string, string>;
487
+ export interface OpenClawMemoryIndexOptions {
488
+ enabled?: boolean | null;
489
+ onSessionStart?: boolean | null;
490
+ onSearch?: boolean | null;
491
+ watch?: boolean | null;
492
+ watchDebounceMs?: number | null;
493
+ intervalMinutes?: number | null;
494
+ }
495
+ export interface WorkspacesSyncOptions {
496
+ enabled?: boolean | null;
497
+ readyOnly?: boolean | null;
498
+ workspace?: string | null;
499
+ }
500
+ export interface OpenClawHeartbeatConfig {
501
+ every?: string;
502
+ model?: string;
503
+ session?: string;
504
+ target?: string;
505
+ directPolicy?: 'allow' | 'block';
506
+ to?: string;
507
+ accountId?: string;
508
+ prompt?: string;
509
+ includeSystemPromptSection?: boolean;
510
+ ackMaxChars?: number;
511
+ suppressToolErrorWarnings?: boolean;
512
+ timeoutSeconds?: number;
513
+ lightContext?: boolean;
514
+ isolatedSession?: boolean;
515
+ includeReasoning?: boolean;
516
+ activeHours?: Record<string, any>;
517
+ [key: string]: any;
518
+ }
519
+ export interface AgentUiAvatarMeta {
520
+ image?: string | null;
521
+ icon_index?: number | null;
522
+ }
523
+ export interface AgentUiMeta {
524
+ description?: string | null;
525
+ avatar?: AgentUiAvatarMeta | null;
526
+ }
527
+ /**
528
+ * Per-provider integration toggle stored under meta.integrations; semantics
529
+ * per the backend model (agents/backend/agents/launch_contract.py
530
+ * AgentIntegrationMeta): enabled ?? true, `enabled: null` on write unsets.
531
+ */
532
+ export interface AgentIntegrationMeta {
533
+ enabled?: boolean | null;
534
+ }
535
+ export interface AgentMeta {
536
+ ui?: AgentUiMeta | null;
537
+ status?: DeploymentMetaStatus | null;
538
+ integrations?: Record<string, AgentIntegrationMeta> | null;
539
+ [key: string]: any;
540
+ }
541
+ export type OpenClawModelApi = 'openai-completions' | 'openai-responses' | 'openai-codex-responses' | 'anthropic-messages' | 'google-generative-ai' | 'github-copilot' | 'bedrock-converse-stream' | 'ollama';
542
+ export type OpenClawModelProviderAuthMode = 'api-key' | 'aws-sdk' | 'oauth' | 'token';
543
+ export type OpenClawSecretInput = string | {
544
+ source?: string;
545
+ provider?: string;
546
+ id?: string;
547
+ [key: string]: any;
548
+ };
549
+ export interface OpenClawModelCompatConfig {
550
+ thinkingFormat?: string;
551
+ supportsTools?: boolean;
552
+ toolSchemaProfile?: string;
553
+ nativeWebSearchTool?: boolean;
554
+ toolCallArgumentsEncoding?: string;
555
+ requiresMistralToolIds?: boolean;
556
+ requiresOpenAiAnthropicToolPayload?: boolean;
557
+ [key: string]: any;
558
+ }
559
+ export interface OpenClawModelDefinitionConfig {
560
+ id: string;
561
+ name?: string;
562
+ api?: OpenClawModelApi;
563
+ reasoning?: boolean;
564
+ input?: Array<'text' | 'image'>;
565
+ cost?: {
566
+ input?: number;
567
+ output?: number;
568
+ cacheRead?: number;
569
+ cacheWrite?: number;
570
+ [key: string]: any;
571
+ };
572
+ contextWindow?: number;
573
+ maxTokens?: number;
574
+ headers?: Record<string, string>;
575
+ compat?: OpenClawModelCompatConfig;
576
+ [key: string]: any;
577
+ }
578
+ export interface OpenClawModelProviderConfig {
579
+ baseUrl: string;
580
+ apiKey?: OpenClawSecretInput;
581
+ auth?: OpenClawModelProviderAuthMode;
582
+ api?: OpenClawModelApi;
583
+ injectNumCtxForOpenAICompat?: boolean;
584
+ headers?: Record<string, OpenClawSecretInput>;
585
+ authHeader?: boolean;
586
+ models?: OpenClawModelDefinitionConfig[];
587
+ [key: string]: any;
588
+ }
589
+ export type OpenClawModelProviderPatch = Partial<Omit<OpenClawModelProviderConfig, 'baseUrl'>> & Pick<OpenClawModelProviderConfig, 'baseUrl'>;
590
+ /**
591
+ * Self-hosted runner placement for POST /deployments
592
+ * (monorepo acp/hyper-runner/RUNNER.md). Tags match runner tags for the same owner;
593
+ * runnerId pins one runner when tags are ambiguous.
594
+ */
595
+ export interface RunnerTargetOptions {
596
+ tags?: string[];
597
+ runnerId?: string | null;
598
+ }
599
+ export interface CreateAgentOptions extends BuildAgentConfigOptions {
600
+ name?: string;
601
+ handle?: string | null;
602
+ size?: string;
603
+ config?: Record<string, any>;
604
+ meta?: AgentMeta | null;
605
+ tags?: string[];
606
+ runner?: RunnerTargetOptions | null;
607
+ dryRun?: boolean;
608
+ runtime?: ManagedAgentRuntime;
609
+ }
610
+ export interface StartAgentOptions {
611
+ dryRun?: boolean;
612
+ }
613
+ /**
614
+ * Options for the deployment lifecycle actions stop, archive, restore, and
615
+ * delete. Mirrors the Backend's LifecycleActionRequest (extra="forbid").
616
+ */
617
+ export interface LifecycleActionOptions {
618
+ /**
619
+ * Validate the action only. The Backend returns the current Agent record
620
+ * unchanged -- nothing mutates and the state stays as it was (the Agent is
621
+ * not stopped, archived, restored, or deleted).
622
+ */
623
+ dryRun?: boolean;
624
+ }
625
+ export interface UpdateAgentOptions {
626
+ ui?: Pick<AgentUiMeta, 'description'>;
627
+ name?: string;
628
+ handle?: string | null;
629
+ size?: string;
630
+ launchConfig?: Record<string, any> | null;
631
+ /** Runtime family label; re-labeling is allowed at any time. */
632
+ runtime?: ManagedAgentRuntime;
633
+ /** Replace the stored launch image with the platform default for the (new or current) runtime on next start. Requires the agent stopped. */
634
+ resetImage?: boolean;
635
+ /**
636
+ * Per-provider integration overrides (meta.integrations): shallow-merged
637
+ * per provider; `enabled: null` removes the provider key (unset → default
638
+ * enabled). See {@link AgentIntegrationMeta} for the effective semantics.
639
+ */
640
+ integrations?: Record<string, AgentIntegrationMeta>;
641
+ /** @deprecated Not accepted by the backend (UpdateAgentRequest is extra="forbid"); ignored. */
642
+ refreshFromLagoon?: boolean;
643
+ /** @deprecated Not accepted by the backend (UpdateAgentRequest is extra="forbid"); ignored. */
644
+ error?: string | null;
645
+ }
646
+ export interface ResetRuntimeDefaultsOptions {
647
+ runtime: ManagedAgentRuntime;
648
+ }
649
+ export interface ResetRuntimeDefaultsResult {
650
+ agent: Agent;
651
+ droppedLaunchKeys: string[];
652
+ }
653
+ /**
654
+ * Folded create options for {@link Deployments.createAgent}: the generic
655
+ * launch contract plus every per-runtime facade knob
656
+ * (openClawRoutes/trustedProxies/cronEnabled/memoryIndex/
657
+ * workspacesSync/permissionMode/buzz). A runtime's
658
+ * own launch branch reads the knobs it understands and ignores the rest,
659
+ * exactly as the old per-runtime facades ignored fields outside their type.
660
+ *
661
+ * There is no Slack knob: hosted Slack is relay-attached after create
662
+ * (`attachSlackRelayAgent`); the agents never dial a channel relay, so no
663
+ * Slack launch env exists to set here.
664
+ */
665
+ export interface ManagedAgentCreateOptions extends CreateAgentOptions {
666
+ openClawRoutes?: OpenClawRouteOptions | null;
667
+ /** Trusted proxies written as OPENCLAW_TRUSTED_PROXIES, replacing gateway.trustedProxies. */
668
+ trustedProxies?: string[] | null;
669
+ cronEnabled?: boolean | null;
670
+ memoryIndex?: OpenClawMemoryIndexOptions | null;
671
+ workspacesSync?: WorkspacesSyncOptions | boolean | null;
672
+ /**
673
+ * @deprecated Launch permission presets are rejected. Select an advertised
674
+ * native session configuration instead.
675
+ */
676
+ permissionMode?: string;
677
+ /** @deprecated Use the typed `buzz` launch contract. */
678
+ buzzEnabled?: boolean;
679
+ /** Launch Buzz ACP with runtime-specific harness and MCP defaults. */
680
+ buzz?: BuzzLaunchConfig | null;
681
+ }
682
+ /** @deprecated Use `ManagedAgentCreateOptions` with `Deployments.createAgent(runtime, options)`. */
683
+ export type CodingAgentCreateOptions = Omit<ManagedAgentCreateOptions, 'runtime'>;
684
+ export interface BuzzLaunchConfig {
685
+ privateKeyNsec: string;
686
+ relayUrl: string;
687
+ authTag?: string | null;
688
+ model?: string | null;
689
+ respondTo?: string | null;
690
+ respondToAllowlist?: string[];
691
+ rustLog?: string;
692
+ }
693
+ /** Construct the Buzz-owned launch fields for create or a stopped deployment update.
694
+ * Callers retain all other stored launch fields. No network or identity generation.
695
+ */
696
+ export declare function buildBuzzLaunchConfig(runtime: CodingAgentRuntime, buzz: BuzzLaunchConfig | null, apiBase: string, stored?: Record<string, any>): Record<string, any>;
697
+ /** Whether the runtime has a Buzz coding harness launch mapping. */
698
+ export declare function supportsBuzzRuntime(runtime: string | null | undefined): runtime is CodingAgentRuntime;
699
+ export interface RuntimeAuthMethod {
700
+ id: string;
701
+ name: string;
702
+ description: string;
703
+ kind: string;
704
+ command: string[];
705
+ metadata: Record<string, unknown>;
706
+ }
707
+ export interface RuntimeAuthStatus {
708
+ authenticated: boolean;
709
+ provider?: string | null;
710
+ account?: string | null;
711
+ method?: string | null;
712
+ detail: Record<string, unknown>;
713
+ }
714
+ export interface RuntimeAuthLoginOptions {
715
+ method?: string;
716
+ provider?: string;
717
+ providerMethod?: string;
718
+ email?: string;
719
+ challengeTimeoutMs?: number;
720
+ }
721
+ export interface AgentExecOptions {
722
+ timeout?: number;
723
+ dryRun?: boolean;
724
+ /**
725
+ * Optional buffered stdin delivered to the command, then closed (stdin EOF).
726
+ * Omit on interactive callers; the pod command sees stdin attached only
727
+ * when this is set.
728
+ */
729
+ stdin?: string | Uint8Array;
730
+ }
731
+ export interface AgentFileEntry {
732
+ name: string;
733
+ path: string;
734
+ type: 'file' | 'directory';
735
+ size?: number;
736
+ size_formatted?: string;
737
+ mime_type?: string;
738
+ mimeType?: string;
739
+ content_type?: string;
740
+ contentType?: string;
741
+ last_modified?: string;
742
+ checksum?: string;
743
+ checksum_algorithm?: string;
744
+ checksumAlgorithm?: string;
745
+ hash?: string;
746
+ hash_algorithm?: string;
747
+ hashAlgorithm?: string;
748
+ sha256?: string;
749
+ sha_256?: string;
750
+ md5?: string;
751
+ etag?: string;
752
+ version_id?: string;
753
+ versionId?: string;
754
+ [key: string]: any;
755
+ }
756
+ export interface AgentFileReadOptions {
757
+ maxBytes?: number;
758
+ signal?: AbortSignal;
759
+ }
760
+ /** Tuning for {@link Deployments.waitForFileApiReady}. */
761
+ export interface AgentFileApiReadyOptions {
762
+ /** Give up after this long. Default 90s. */
763
+ timeoutMs?: number;
764
+ /** Successful reads required in a row before declaring ready. Default 2. */
765
+ consecutive?: number;
766
+ /** Delay between attempts. Default 1s. */
767
+ pollMs?: number;
768
+ }
769
+ export interface AgentFileReadBytesResult {
770
+ content: Uint8Array;
771
+ mimeType?: string;
772
+ }
773
+ export interface AgentFileTokenResponse {
774
+ url: string;
775
+ token: string;
776
+ expires_at: string;
777
+ }
778
+ /** Maximum decoded bytes for the native runner file transport. */
779
+ export declare const RUNNER_FILE_MAX_BYTES: number;
780
+ /** Backend-discovered file access scoped to an agent's retained storage root. */
781
+ export declare class AgentFiles {
782
+ private readonly agent;
783
+ private readonly deployments;
784
+ constructor(agent: Agent, deployments: Deployments);
785
+ list(path?: string): Promise<AgentFileEntry[]>;
786
+ readBytes(path: string, options?: AgentFileReadOptions): Promise<Uint8Array>;
787
+ readBytesWithMetadata(path: string, options?: AgentFileReadOptions): Promise<AgentFileReadBytesResult>;
788
+ read(path: string, options?: AgentFileReadOptions): Promise<string>;
789
+ writeBytes(path: string, content: Uint8Array | ArrayBuffer | string, options?: {
790
+ signal?: AbortSignal;
791
+ }): Promise<Record<string, any>>;
792
+ write(path: string, content: string): Promise<Record<string, any>>;
793
+ delete(path: string, options?: {
794
+ recursive?: boolean;
795
+ }): Promise<Record<string, any>>;
796
+ }
797
+ export interface AgentDirectoryListing {
798
+ type: 'directory';
799
+ prefix: string;
800
+ directories: AgentFileEntry[];
801
+ files: AgentFileEntry[];
802
+ truncated?: boolean;
803
+ [key: string]: any;
804
+ }
805
+ export type AgentState = 'CREATING' | 'STARTING' | 'RESTORING' | 'RUNNING' | 'STOPPING' | 'STOPPED' | 'ARCHIVING' | 'ARCHIVED' | 'FAILED' | 'NO_NAMESPACE' | 'DELETED' | (string & {});
806
+ /** Canonical states understood by this SDK. AgentState remains forward-open. */
807
+ export declare const CANONICAL_AGENT_STATES: readonly ["CREATING", "STARTING", "RESTORING", "RUNNING", "STOPPING", "STOPPED", "ARCHIVING", "ARCHIVED", "FAILED", "NO_NAMESPACE", "DELETED"];
808
+ export declare const AGENT_TRANSITIONAL_STATES: ReadonlySet<AgentState>;
809
+ export declare const AGENT_RUNTIME_INACTIVE_STATES: ReadonlySet<AgentState>;
810
+ export declare function isAgentTransitionalState(state: string): boolean;
811
+ export declare function isAgentRuntimeInactiveState(state: string): boolean;
812
+ export type DeploymentMetaObservedState = 'RUNNING' | 'STOPPED';
813
+ export interface DeploymentMetaStatus {
814
+ status: 'ok' | 'error' | string;
815
+ clusterId: string | null;
816
+ namespace: string | null;
817
+ observedState: DeploymentMetaObservedState | null;
818
+ reason: string | null;
819
+ message: string | null;
820
+ observedAt: string | null;
821
+ }
822
+ export interface DeploymentTransitionEvent {
823
+ type: 'deployment.transition';
824
+ agent_id: string;
825
+ state?: AgentState;
826
+ reason?: string | null;
827
+ error?: string | null;
828
+ message?: string | null;
829
+ }
830
+ export interface DeploymentImportStatusEvent {
831
+ type: 'deployment.import_status';
832
+ agent_id: string;
833
+ status: 'ok' | 'error' | string;
834
+ namespace: string;
835
+ observed_state?: AgentState | null;
836
+ reason?: string | null;
837
+ message?: string | null;
838
+ observed_at: string;
839
+ }
840
+ export interface RunnerPresenceEvent {
841
+ type: 'runner.presence';
842
+ runner_id: string;
843
+ presence: 'connected' | 'disconnected' | 'registered' | 'deregistered';
844
+ at: string;
845
+ }
846
+ export type DeploymentEvent = DeploymentTransitionEvent | DeploymentImportStatusEvent | RunnerPresenceEvent | import('./sessions.js').SessionReactionOperation;
847
+ export interface DeploymentSubscribeOptions {
848
+ signal?: AbortSignal;
849
+ /** Runs after socket authentication and before transition frames are read. */
850
+ onReady?: () => void | Promise<void>;
851
+ }
852
+ export interface AgentStateFields {
853
+ id: string;
854
+ userId: string;
855
+ state: AgentState;
856
+ name?: string | null;
857
+ handle?: string | null;
858
+ displayName?: string | null;
859
+ avatarUrl?: string | null;
860
+ avatarAudioUrl?: string | null;
861
+ displayIdentity?: Record<string, any> | null;
862
+ runtime?: string | null;
863
+ managed?: boolean | null;
864
+ isLaunchable?: boolean;
865
+ gatewayId?: string | null;
866
+ relayKey?: AgentRelayKey | null;
867
+ cpu: number;
868
+ memory: number;
869
+ requestedSize?: AgentSlotSize | null;
870
+ hostname?: string | null;
871
+ tags?: string[];
872
+ jwtToken?: string | null;
873
+ jwtExpiresAt?: Date | null;
874
+ startedAt?: Date | null;
875
+ stoppedAt?: Date | null;
876
+ archivedAt?: Date | null;
877
+ archivePrefix?: string | null;
878
+ deletedAt?: Date | null;
879
+ disconnectedAt?: Date | null;
880
+ agentSlotId?: string | null;
881
+ clusterId?: string | null;
882
+ /** Pinned self-hosted runner placement, when the Agent deployment is runner-bound. */
883
+ runner?: {
884
+ tags: string[];
885
+ runnerId: string | null;
886
+ } | null;
887
+ launchEpoch?: number;
888
+ createdAt?: Date | null;
889
+ updatedAt?: Date | null;
890
+ launchConfig?: Record<string, any> | null;
891
+ meta?: AgentMeta | null;
892
+ routes: Record<string, AgentRouteConfig>;
893
+ command: string[];
894
+ entrypoint: string[];
895
+ dryRun: boolean;
896
+ }
897
+ export interface AgentHydrationData {
898
+ id?: string;
899
+ user_id?: string;
900
+ state?: AgentState;
901
+ name?: string | null;
902
+ handle?: string | null;
903
+ display_name?: string | null;
904
+ avatar_url?: string | null;
905
+ avatar_audio_url?: string | null;
906
+ display_identity?: Record<string, any> | null;
907
+ runtime?: string | null;
908
+ managed?: boolean | null;
909
+ is_launchable?: boolean;
910
+ gateway_id?: string | null;
911
+ relay_key?: AgentRelayKey | null;
912
+ cpu?: number;
913
+ memory?: number;
914
+ requested_size?: unknown;
915
+ hostname?: string | null;
916
+ tags?: string[] | null;
917
+ jwt_token?: string | null;
918
+ jwt_expires_at?: string | null;
919
+ started_at?: string | null;
920
+ stopped_at?: string | null;
921
+ archived_at?: string | null;
922
+ archive_prefix?: string | null;
923
+ deleted_at?: string | null;
924
+ disconnected_at?: string | null;
925
+ agent_slot_id?: string | null;
926
+ cluster_id?: string | null;
927
+ runner?: {
928
+ tags?: string[];
929
+ runner_id?: string | null;
930
+ } | null;
931
+ launch_epoch?: number;
932
+ created_at?: string | null;
933
+ updated_at?: string | null;
934
+ launch_config?: Record<string, any> | null;
935
+ meta?: Record<string, any> | null;
936
+ routes?: Record<string, AgentRouteConfig> | null;
937
+ command?: string[] | null;
938
+ entrypoint?: string[] | null;
939
+ dry_run?: boolean;
940
+ [key: string]: any;
941
+ }
942
+ export declare function flattenLaunchConfig(launchConfig: unknown): LaunchConfigFlatMap;
943
+ export declare function getLaunchConfigValue(launchConfig: unknown, path: string | Array<string | number>): unknown;
944
+ export declare function routesHaveDesktop(routes: unknown): boolean;
945
+ export declare function launchConfigHasDesktop(launchConfig: unknown): boolean;
946
+ export declare function agentConfigHasDesktop(source: AgentDesktopConfigSource | null | undefined): boolean;
947
+ export declare function buildBrowserDesktopUrl(desktopBaseUrl: string, token: string, options?: BrowserDesktopUrlOptions): string;
948
+ export { defaultAcpProxyWsUrl, defaultHyperAcpWsUrl, resolveAgentsApiBase } from './agent-urls.js';
949
+ export declare function buildAgentConfig(config?: Record<string, any>, options?: BuildAgentConfigOptions): {
950
+ config: AgentLaunchConfig;
951
+ };
952
+ export declare function startSlackOAuth(options: SlackOAuthStartOptions): Promise<SlackOAuthStartResult>;
953
+ export declare function getSlackInstallStatus(options: SlackInstallStatusOptions): Promise<SlackInstallStatus>;
954
+ export declare function listSlackDirectoryConversations(options: SlackDirectoryConversationsOptions): Promise<SlackDirectoryConversationsResult>;
955
+ export declare function listSlackDirectoryUsers(options: SlackDirectoryOptions): Promise<SlackDirectoryUsersResult>;
956
+ export declare function attachSlackRelayAgent(options: AttachSlackRelayAgentOptions): Promise<AttachSlackRelayAgentResult>;
957
+ export declare function buildOpenClawDesktopRoute(options?: OpenClawRouteOptions): Record<string, AgentRouteConfig>;
958
+ export declare function buildOpenClawMemoryIndexEnv(memoryIndex?: OpenClawMemoryIndexOptions | null): Record<string, string>;
959
+ export declare function buildOpenClawCronEnv(enabled?: boolean | null): Record<string, string>;
960
+ export declare function buildHermesCronEnv(enabled?: boolean | null): Record<string, string>;
961
+ export declare function buildWorkspacesSyncEnv(workspacesSync?: WorkspacesSyncOptions | boolean | null): Record<string, string>;
962
+ export declare class Agent {
963
+ readonly id: string;
964
+ readonly userId: string;
965
+ readonly state: string;
966
+ readonly name: string | null;
967
+ readonly handle: string | null;
968
+ readonly displayName: string | null;
969
+ readonly avatarUrl: string | null;
970
+ readonly avatarAudioUrl: string | null;
971
+ readonly displayIdentity: Record<string, any> | null;
972
+ readonly runtime: string | null;
973
+ readonly managed: boolean | null;
974
+ readonly isLaunchable: boolean;
975
+ readonly gatewayId: string | null;
976
+ readonly relayKey: AgentRelayKey | null;
977
+ readonly cpu: number;
978
+ readonly memory: number;
979
+ readonly requestedSize: AgentSlotSize | null;
980
+ readonly hostname: string | null;
981
+ readonly tags: string[];
982
+ jwtToken: string | null;
983
+ jwtExpiresAt: Date | null;
984
+ readonly startedAt: Date | null;
985
+ readonly stoppedAt: Date | null;
986
+ readonly archivedAt: Date | null;
987
+ readonly archivePrefix: string | null;
988
+ readonly deletedAt: Date | null;
989
+ readonly disconnectedAt: Date | null;
990
+ readonly agentSlotId: string | null;
991
+ readonly clusterId: string | null;
992
+ readonly runner: {
993
+ tags: string[];
994
+ runnerId: string | null;
995
+ } | null;
996
+ readonly launchEpoch: number;
997
+ readonly createdAt: Date | null;
998
+ readonly updatedAt: Date | null;
999
+ launchConfig: Record<string, any> | null;
1000
+ readonly meta: AgentMeta | null;
1001
+ routes: Record<string, AgentRouteConfig>;
1002
+ command: string[];
1003
+ entrypoint: string[];
1004
+ readonly dryRun: boolean;
1005
+ _deployments: Deployments | null;
1006
+ constructor(fields: AgentStateFields);
1007
+ static fromDict(data: AgentHydrationData): Agent;
1008
+ get publicUrl(): string | null;
1009
+ protected routePrefix(routeName: string, defaultPrefix?: string | null): string | null;
1010
+ routeUrl(routeName: string, defaultPrefix?: string | null): string | null;
1011
+ get desktopUrl(): string | null;
1012
+ get vncUrl(): string | null;
1013
+ browserDesktopUrl(token: string, options?: BrowserDesktopUrlOptions): string | null;
1014
+ get shellUrl(): string | null;
1015
+ get isRunning(): boolean;
1016
+ get isTransitioning(): boolean;
1017
+ /** True when the agent is cold-restorable from its verified archive. */
1018
+ get isArchived(): boolean;
1019
+ /** True only for an explicitly included deletion tombstone. */
1020
+ get isDeleted(): boolean;
1021
+ get hasDesktop(): boolean;
1022
+ protected requireDeployments(): Deployments;
1023
+ /** Runtime auth flows for this agent's pod (coding runtimes only). */
1024
+ get auth(): RuntimeAuthClient;
1025
+ /**
1026
+ * Connect to this agent's ACP surface through the backend session proxy.
1027
+ *
1028
+ * Default (`options.transport` unset): dials `/ws/acp` — the client-facing
1029
+ * ACP session authority (sessions/README §14). The proxy owns the backend
1030
+ * session record `{session_id → legs}`, fans runtime frames out to every
1031
+ * attached session client, and answers `session/new` with the backend
1032
+ * session id (backend-keyed, not the pod-side ACP id). Create-or-attach
1033
+ * semantics key on `options.sessionId`:
1034
+ *
1035
+ * - omitted: the socket starts session-less; `newSession()` runs the
1036
+ * proxy's `session/new`, minting the backend session.
1037
+ * - provided: the dial itself is session-less; AFTER the `initialize`
1038
+ * handshake the client resumes the session over the connected socket
1039
+ * (`session/resume` on v1), without replay. History uses the separate
1040
+ * platform sessions API. A refused resume rejects acpConnect with the
1041
+ * original error and closes its client; it never creates a replacement
1042
+ * session.
1043
+ *
1044
+ * `transport: 'direct'` dials the agent-keyed `/ws` bridge instead
1045
+ * (`?agent_id&token`), the pre-proxy path. Infra/debug only: `/ws` is
1046
+ * being hardened to runtime + backend-service identities, and combining
1047
+ * it with `sessionId` throws (the bridge has no session binding).
1048
+ *
1049
+ * The ACP `initialize` handshake offers protocol version 1 only
1050
+ * (see `client.negotiatedProtocolVersion`). The proxy authority is
1051
+ * v1-only and the client closes on any answered version other than 1.
1052
+ * The `cwd` default comes from the runtime's validated launch-directory
1053
+ * advertisement, never from the pod sync root or the caller's machine.
1054
+ *
1055
+ * Auth: the dial carries the client API key on the `token` query param;
1056
+ * `options.token` overrides that credential.
1057
+ */
1058
+ acpConnect(options?: CodingAgentAcpConnectOptions): Promise<CodingAgentAcpClient>;
1059
+ private acpPoolValue;
1060
+ /**
1061
+ * Lazily created connection pool for this agent's ACP surface. Two
1062
+ * clients dialed to the same agent share one pod-side stdio session, so all
1063
+ * ACP consumers (chat panes, session sweeps, turn drivers) must ride ONE
1064
+ * pooled connection via leases instead of dialing their own — the bridge
1065
+ * rejects a duplicate runtime attach. The pool closes the connection when
1066
+ * the last lease releases, so a lease taken by a long-lived consumer (a
1067
+ * turn driver) outlives callers that unmount (a chat pane) and vice versa.
1068
+ *
1069
+ * Under the default proxy transport the pooled connection dials session-less:
1070
+ * prompting a session id the proxy has never seen (a stored id whose
1071
+ * runtime was evicted backend-side) fails with an unknown-session error.
1072
+ * Prompt against ids created through this proxy, or attach first with a
1073
+ * dedicated `acpConnect({ sessionId })`.
1074
+ */
1075
+ get acpPool(): CodingAgentAcpPool;
1076
+ /**
1077
+ * Acquire a lease on this agent's pooled ACP connection and return a ready
1078
+ * per-session {@link AcpTurnDriver} bound to it. `options.sessionId` is the
1079
+ * pinned ACP session id (the id the app persists, e.g. under
1080
+ * `localStorage["acp-session:<agentId>"]`); drivers are cheap — one per
1081
+ * session, all sharing the same lease-held connection. The driver holds
1082
+ * its lease until
1083
+ * `driver.close()`; the pooled connection stays up for other leaseholders.
1084
+ */
1085
+ acpTurnDriver(options: AcpTurnDriverOptions): Promise<AcpTurnDriver>;
1086
+ routeRequiresAuth(routeName: string, defaultValue?: boolean): boolean;
1087
+ refreshToken(): Promise<AgentTokenResponse>;
1088
+ waitRunning(timeoutMs?: number, pollIntervalMs?: number): Promise<Agent>;
1089
+ update(options: UpdateAgentOptions): Promise<Agent>;
1090
+ resetRuntimeDefaults(options: ResetRuntimeDefaultsOptions): Promise<ResetRuntimeDefaultsResult>;
1091
+ resize(options: Pick<UpdateAgentOptions, 'size'>): Promise<Agent>;
1092
+ /** Accept background archival and return its transitional Agent projection. */
1093
+ archive(options?: LifecycleActionOptions): Promise<Agent>;
1094
+ env(): Promise<Record<string, string>>;
1095
+ setEnv(key: string, value: string): Promise<AgentEnvMutationResponse>;
1096
+ deleteEnv(key: string): Promise<AgentEnvMutationResponse>;
1097
+ secretNames(): Promise<string[]>;
1098
+ secret(key: string): Promise<string>;
1099
+ setSecret(key: string, value: string): Promise<AgentSecretMutationResponse>;
1100
+ deleteSecret(key: string): Promise<AgentSecretMutationResponse>;
1101
+ exec(command: string[], options?: AgentExecOptions): Promise<AgentExecResult>;
1102
+ /** Reef-backed files scoped to this agent's configured sync root. */
1103
+ get files(): AgentFiles;
1104
+ filesList(path?: string): Promise<AgentFileEntry[]>;
1105
+ fileReadBytes(path: string, options?: AgentFileReadOptions): Promise<Uint8Array>;
1106
+ fileReadBytesWithMetadata(path: string, options?: AgentFileReadOptions): Promise<AgentFileReadBytesResult>;
1107
+ fileRead(path: string, options?: AgentFileReadOptions): Promise<string>;
1108
+ fileWriteBytes(path: string, content: Uint8Array | ArrayBuffer | string): Promise<Record<string, any>>;
1109
+ fileWrite(path: string, content: string): Promise<Record<string, any>>;
1110
+ fileDelete(path: string, options?: {
1111
+ recursive?: boolean;
1112
+ }): Promise<Record<string, any>>;
1113
+ cpTo(localPath: string, remotePath: string): Promise<Record<string, any>>;
1114
+ cpFrom(remotePath: string, localPath: string): Promise<string>;
1115
+ shellConnect(shell?: string, options?: AgentShellConnectOptions): Promise<WebSocket>;
1116
+ }
1117
+ export declare class RuntimeLoginSession {
1118
+ private readonly authClient;
1119
+ readonly socket: WebSocket;
1120
+ private readonly requiresDeviceChallenge;
1121
+ output: string;
1122
+ verificationUrl: string | null;
1123
+ userCode: string | null;
1124
+ interactiveRequired: boolean;
1125
+ private rawOutput;
1126
+ private exitCode;
1127
+ private readonly marker;
1128
+ private readonly completion;
1129
+ private readonly ready;
1130
+ private complete;
1131
+ private markReady;
1132
+ private constructor();
1133
+ static start(authClient: RuntimeAuthClient, command: string[], challengeTimeoutMs?: number, requiresDeviceChallenge?: boolean): Promise<RuntimeLoginSession>;
1134
+ private consume;
1135
+ send(text: string): void;
1136
+ wait(timeoutMs?: number): Promise<RuntimeAuthStatus>;
1137
+ cancel(): void;
1138
+ }
1139
+ export declare class RuntimeAuthClient {
1140
+ readonly agent: Agent;
1141
+ private readonly config;
1142
+ constructor(agent: Agent);
1143
+ methods(): Promise<RuntimeAuthMethod[]>;
1144
+ status(): Promise<RuntimeAuthStatus>;
1145
+ login(options?: RuntimeAuthLoginOptions): Promise<RuntimeLoginSession>;
1146
+ logout(provider?: string): Promise<RuntimeAuthStatus>;
1147
+ }
1148
+ /**
1149
+ * Every managed runtime — openclaw_acp, hermes_acp, and the
1150
+ * coding-agent runtimes — boots its pod behind `hyper-acp`, so chat,
1151
+ * sessions, runtime auth, and turn driving all ride the same ACP bridge; the
1152
+ * runtimes differ only in the `runtime` label plus launch-config data
1153
+ * (images, sync roots/uid/gid, harness env). Session protocol behavior is
1154
+ * version-keyed (`negotiatedProtocolVersion`), never runtime-keyed.
1155
+ *
1156
+ * There is no per-runtime facade class: `Agent` carries the ACP members
1157
+ * directly. ACP availability is determined by the peer; runtime auth uses
1158
+ * the runtime auth table.
1159
+ *
1160
+ * @deprecated Every deployment hydrates to the single flat {@link Agent};
1161
+ * use `Agent` in place of `CodingAgent`.
1162
+ */
1163
+ export type CodingAgent = Agent;
1164
+ export declare class Deployments {
1165
+ private readonly apiKey;
1166
+ private readonly apiBase;
1167
+ private readonly agentsWsUrl;
1168
+ private readonly agentHttp;
1169
+ constructor(http: HTTPClient, agentApiKey?: string, agentApiBase?: string, agentsWsUrl?: string, requestTimeout?: number);
1170
+ get agentApiKey(): string;
1171
+ get agentApiBase(): string;
1172
+ /** Authoritative runtime-host launch directory, resolved by the platform. */
1173
+ runtimePaths(agentId: string, requestOptions?: RequestOverrides): Promise<{
1174
+ cwd: string;
1175
+ }>;
1176
+ private hydrateAgent;
1177
+ private getById;
1178
+ resolveAgent(agentIdOrName: string, requestOptions?: RequestOverrides): Promise<Agent>;
1179
+ resolveAgentId(agentIdOrName: string, requestOptions?: RequestOverrides): Promise<string>;
1180
+ private routesTarget;
1181
+ private agentIdFor;
1182
+ private fetchRaw;
1183
+ private fileAccess;
1184
+ private fetchReef;
1185
+ create(options?: CreateAgentOptions): Promise<Agent>;
1186
+ /**
1187
+ * Create a managed agent for a runtime in one call.
1188
+ *
1189
+ * `runtime` selects the launch defaults (image, sync root and
1190
+ * include/exclude presets, uid/gid, env presets, routes, boot command) from
1191
+ * the ACP_RUNTIME_TABLE data table; `options` folds the old per-runtime
1192
+ * facade option types — each runtime reads the knobs it understands and
1193
+ * ignores the rest. `create()` stays the raw generic entry; `createAgent`
1194
+ * is the typed one. Every non-generic runtime boots behind hyper-acp;
1195
+ * `buzz` switches to the Buzz launch (coding runtimes only).
1196
+ */
1197
+ createAgent(runtime: ManagedAgentRuntime, options?: ManagedAgentCreateOptions): Promise<Agent>;
1198
+ /**
1199
+ * Create an ACP-fronted coding agent. All coding runtimes share one launch
1200
+ * contract; `runtime` selects the default image and sync includes.
1201
+ * Runtime configuration roots are selected on the runtime host.
1202
+ *
1203
+ * @deprecated Use {@link Deployments.createAgent} with the runtime label;
1204
+ * the folded entry takes the same options bag.
1205
+ */
1206
+ createCodingAgent(runtime: CodingAgentRuntime, options?: CodingAgentCreateOptions): Promise<Agent>;
1207
+ /**
1208
+ * The one canonical ACP launch path: every non-generic runtime launches
1209
+ * through here, with per-family differences read from ACP_RUNTIME_TABLE.
1210
+ */
1211
+ private createAcpAgentDeployment;
1212
+ budget(): Promise<Record<string, any>>;
1213
+ private oneShotAgentWebSocket;
1214
+ metrics(agentIdOrName: string): Promise<AgentMetricsResult>;
1215
+ list(options?: ListAgentsOptions): Promise<Agent[]>;
1216
+ listWithCapacity(options?: ListAgentsOptions): Promise<AgentCapacity>;
1217
+ get(agentIdOrName: string, requestOptions?: RequestOverrides): Promise<Agent>;
1218
+ attachSlackRelayAgent(agentIdOrName: string, options: AttachDeploymentSlackRelayAgentOptions): Promise<AttachSlackRelayAgentResult>;
1219
+ subscribe(handler: (event: DeploymentEvent) => void | Promise<void>, options?: DeploymentSubscribeOptions): Promise<void>;
1220
+ waitForState(agentIdOrName: string, states: readonly AgentState[], timeoutMs?: number, failureStates?: readonly AgentState[], minimumLaunchEpoch?: number, pollIntervalMs?: number): Promise<Agent>;
1221
+ waitRunning(agentIdOrName: string, timeoutMs?: number, pollIntervalMs?: number, minimumLaunchEpoch?: number): Promise<Agent>;
1222
+ /**
1223
+ * Read back every launch secret value the projection refuses to return.
1224
+ *
1225
+ * Agent projections list secret *names* and expose values only through the
1226
+ * per-secret retrieval endpoint, so a complete `secrets` mapping has to be
1227
+ * reassembled one key at a time. Every response is checked against
1228
+ * `launchEpoch` so a rebuild never silently mixes values from an older
1229
+ * launch generation into a new one.
1230
+ */
1231
+ private recoverRedactedSecrets;
1232
+ /**
1233
+ * Restore the two launch_config keys an Agent projection redacts.
1234
+ *
1235
+ * WHY THIS EXISTS — do not delete it as redundant validation sugar. The
1236
+ * Backend's owner-facing Agent projection deliberately strips `secrets` and
1237
+ * `registry_auth` before returning an Agent to a user-scoped caller
1238
+ * (`hydrate_managed_agent` pops both), and this SDK's own hydrator drops
1239
+ * `secrets` again. A caller that writes launch_config before start still
1240
+ * needs a complete replacement object. Without this step the obvious round
1241
+ * trip can never succeed, because the read side is structurally incapable of
1242
+ * returning what the write side requires:
1243
+ *
1244
+ * ```ts
1245
+ * const agent = await client.deployments.get(agentId);
1246
+ * await client.deployments.update(agentId, { launchConfig: agent.launchConfig });
1247
+ * // Error: launchConfig is incomplete; missing: secrets, registry_auth
1248
+ * ```
1249
+ *
1250
+ * The fix is to complete the object honestly, never to weaken the
1251
+ * completeness contract — launch_config writes are replacements, not merges.
1252
+ *
1253
+ * Only keys that are genuinely ABSENT are rebuilt. A caller-supplied
1254
+ * `secrets` or `registry_auth` is honoured verbatim, including an explicit
1255
+ * empty object, so "redacted by the projection" and "deliberately empty"
1256
+ * remain distinguishable.
1257
+ *
1258
+ * `secrets` is recoverable because values can be read back one name at a
1259
+ * time. `registry_auth` is NOT: it is caller-held, write-only, and never
1260
+ * stored server-side. It therefore falls back to an explicitly supplied
1261
+ * `registryAuth`, then to `{}` only when the configuration pulls from no
1262
+ * `registry_url`; when a registry is configured an empty credential would
1263
+ * silently break the image pull, so the caller is told to supply it instead.
1264
+ */
1265
+ private rehydrateRedactedLaunchConfig;
1266
+ /**
1267
+ * Rebuild a complete replacement launch_config from
1268
+ * nothing but the Agent's stored projection.
1269
+ *
1270
+ * This SDK starts stored config without reading it. This method is retained
1271
+ * for callers that want to explicitly update stored launch_config;
1272
+ * it is also the only place that canonicalizes the two legacy projection
1273
+ * shapes the inline repair never sees, because the repair fills absent keys
1274
+ * and touches nothing else:
1275
+ * nullable `restart`, and a projection carrying both or neither sync policy.
1276
+ *
1277
+ * Reads the stored Agent projection, rehydrates redacted secrets through the
1278
+ * per-secret retrieval endpoint, requires caller-held registry_auth whenever
1279
+ * the stored config references a registry_url, normalizes those legacy
1280
+ * shapes, and self-checks through the completeness gatekeeper.
1281
+ */
1282
+ storedLaunchConfig(agentIdOrName: string, options?: {
1283
+ registryAuth?: RegistryAuth;
1284
+ }): Promise<AgentLaunchConfig>;
1285
+ start(agentIdOrName: string, options?: StartAgentOptions): Promise<Agent>;
1286
+ update(agentIdOrName: string, options?: UpdateAgentOptions): Promise<Agent>;
1287
+ /**
1288
+ * Reset a deployment back to this runtime's platform defaults.
1289
+ *
1290
+ * The empty launch_config is intentional: Backend treats `{}` as "clear every
1291
+ * mutable launch setting" while preserving protected launch identity and
1292
+ * retained-storage fields. Runtime-specific files are deleted best-effort so
1293
+ * the image can reseed its own config on the next boot.
1294
+ */
1295
+ resetRuntimeDefaults(agentIdOrName: string, options: ResetRuntimeDefaultsOptions): Promise<ResetRuntimeDefaultsResult>;
1296
+ uploadProfileImage(agentId: string, content: Blob | ArrayBuffer | ArrayBufferView, contentType?: string): Promise<AgentProfileImageUploadResult>;
1297
+ deleteProfileImage(agentId: string): Promise<AgentProfileImageUploadResult>;
1298
+ resize(agentId: string, options: Pick<UpdateAgentOptions, 'size'>): Promise<Agent>;
1299
+ /**
1300
+ * Request an agent stop.
1301
+ *
1302
+ * The returned agent remains `STOPPING` while runtime cleanup is in
1303
+ * progress. Fetch it again until it becomes `STOPPED` before treating its
1304
+ * deployment slot as released.
1305
+ *
1306
+ * With `dryRun: true` the Backend only validates the request and returns
1307
+ * the current Agent unchanged -- nothing mutates and no stop is started.
1308
+ */
1309
+ stop(agentIdOrName: string, options?: LifecycleActionOptions): Promise<Agent>;
1310
+ /**
1311
+ * Archive durable storage without launching the agent.
1312
+ *
1313
+ * With `dryRun: true` the Backend only validates the request and returns
1314
+ * the current Agent unchanged -- nothing mutates and no archive is started.
1315
+ */
1316
+ archive(agentIdOrName: string, options?: LifecycleActionOptions): Promise<Agent>;
1317
+ /**
1318
+ * Restore durable storage. The accepted snapshot is `RESTORING`; completion is `STOPPED`.
1319
+ *
1320
+ * With `dryRun: true` the Backend only validates the request and returns
1321
+ * the current Agent unchanged -- nothing mutates and no restore is started.
1322
+ */
1323
+ restore(agentIdOrName: string, options?: LifecycleActionOptions): Promise<Agent>;
1324
+ /**
1325
+ * Resolve who the presented credential is, per the Backend
1326
+ * (`GET /deployments/auth/me`).
1327
+ *
1328
+ * Answers the three questions a credential should be able to ask about
1329
+ * itself: which Agent it is (`agentId`, set only for an Agent runtime key),
1330
+ * which account owns it (`userId`, `teamId`, `planId`), and what it may do
1331
+ * (`tags`, `capabilities`). It returns only what the credential already
1332
+ * carries, so it is unscoped and safe for any caller.
1333
+ *
1334
+ * Distinct from the product-wide `client.user.authMe()`: this is the agent
1335
+ * product's own introspection and is the only one that reports `agentId`.
1336
+ */
1337
+ accessIdentity(requestOptions?: RequestOverrides): Promise<AgentAccessIdentity>;
1338
+ getRoutes(agentIdOrName: string, options?: RequestOverrides): Promise<AgentRoutesState>;
1339
+ setRoutes(agentIdOrName: string, routes: Record<string, AgentRouteConfig>, options?: SetRoutesOptions): Promise<AgentRoutesState>;
1340
+ setRoute(agentIdOrName: string, name: string, route: AgentRouteConfig): Promise<AgentRoutesState>;
1341
+ removeRoute(agentIdOrName: string, name: string): Promise<AgentRoutesState>;
1342
+ /**
1343
+ * Delete a deployment.
1344
+ *
1345
+ * With `dryRun: true` the Backend only validates the request and returns
1346
+ * the current Agent record unchanged -- nothing mutates and the deployment
1347
+ * is not deleted.
1348
+ */
1349
+ delete(agentIdOrName: string, options?: LifecycleActionOptions): Promise<Record<string, any>>;
1350
+ refreshToken(agentIdOrName: string): Promise<AgentTokenResponse>;
1351
+ /**
1352
+ * Signed URL for the agent's VNC desktop. Requires a running agent with the
1353
+ * `desktop` route enabled; throws otherwise.
1354
+ */
1355
+ desktopUrl(agentIdOrName: string, options?: BrowserDesktopUrlOptions): Promise<{
1356
+ url: string;
1357
+ expiresAt: Date | null;
1358
+ viewport: {
1359
+ width: number;
1360
+ height: number;
1361
+ } | null;
1362
+ }>;
1363
+ createScopedKey(agentIdOrName: string, name?: string): Promise<Record<string, any>>;
1364
+ webSearch(query: string, options?: BraveWebSearchOptions): Promise<BraveWebSearchResponse>;
1365
+ logsToken(agentIdOrName: string): Promise<AgentLogsTokenResponse>;
1366
+ env(agentIdOrName: string, requestOptions?: RequestOverrides): Promise<AgentEnvResponse>;
1367
+ setEnv(agentIdOrName: string, key: string, value: string): Promise<AgentEnvMutationResponse>;
1368
+ deleteEnv(agentIdOrName: string, key: string): Promise<AgentEnvMutationResponse>;
1369
+ secretNames(agentIdOrName: string, requestOptions?: RequestOverrides): Promise<AgentSecretNamesResponse>;
1370
+ secret(agentIdOrName: string, key: string, requestOptions?: RequestOverrides): Promise<AgentSecretResponse>;
1371
+ setSecret(agentIdOrName: string, key: string, value: string): Promise<AgentSecretMutationResponse>;
1372
+ deleteSecret(agentIdOrName: string, key: string): Promise<AgentSecretMutationResponse>;
1373
+ exec(target: Agent | string, command: string[], options?: AgentExecOptions): Promise<AgentExecResult>;
1374
+ /**
1375
+ * Wait until the Agent file API is serving. Native assignments use a bounded
1376
+ * file read; hosted assignments use the Reef readiness checks below.
1377
+ *
1378
+ * Probing the Agent hostname alone cannot answer this. The Agent domain is a
1379
+ * wildcard, so a host with no route still resolves and the edge answers a
1380
+ * plain-text `404 page not found` — byte for byte what a route that has not
1381
+ * converged yet returns. A caller polling the hostname therefore cannot tell
1382
+ * "not ready" from "never will be", and will retry until its deadline against
1383
+ * a host that was never going to work.
1384
+ *
1385
+ * So ask the API for the authoritative Agent state first: a deleted or failed
1386
+ * Agent rejects immediately with that state rather than timing out. Then
1387
+ * require consecutive successful reads, because one success only proves the
1388
+ * route answered once — the next request can still 404 while the edge settles.
1389
+ */
1390
+ waitForFileApiReady(target: Agent | string, options?: AgentFileApiReadyOptions): Promise<void>;
1391
+ filesList(target: Agent | string, path?: string): Promise<AgentFileEntry[]>;
1392
+ fileReadBytesWithMetadata(target: Agent | string, path: string, options?: AgentFileReadOptions): Promise<AgentFileReadBytesResult>;
1393
+ fileReadBytes(target: Agent | string, path: string, options?: AgentFileReadOptions): Promise<Uint8Array>;
1394
+ fileRead(target: Agent | string, path: string, options?: AgentFileReadOptions): Promise<string>;
1395
+ /**
1396
+ * Write bytes to a relative path through Reef or the native runner transport.
1397
+ *
1398
+ * Per-file writes are limited to 100 MiB (`AGENT_FILE_WRITE_MAX_BYTES`,
1399
+ * the Cloudflare edge request-body cap on the agent hostname). Larger data
1400
+ * should be split across files or synced via the agent's own tooling.
1401
+ * Native runner files are limited to 100 MiB under the retained assignment root.
1402
+ */
1403
+ fileWriteBytes(target: Agent | string, path: string, content: Uint8Array | ArrayBuffer | string, options?: {
1404
+ signal?: AbortSignal;
1405
+ }): Promise<Record<string, any>>;
1406
+ /**
1407
+ * Write a UTF-8 text file to an agent.
1408
+ *
1409
+ * Subject to the 100 MiB per-file write limit; see `fileWriteBytes`.
1410
+ */
1411
+ fileWrite(target: Agent | string, path: string, content: string): Promise<Record<string, any>>;
1412
+ fileDelete(target: Agent | string, path: string, options?: {
1413
+ recursive?: boolean;
1414
+ }): Promise<Record<string, any>>;
1415
+ cpTo(target: Agent | string, localPath: string, remotePath: string): Promise<Record<string, any>>;
1416
+ cpFrom(target: Agent | string, remotePath: string, localPath: string): Promise<string>;
1417
+ /** One bounded display/capture read. All-unavailable capture errors retain their metadata. */
1418
+ getLogs(agentIdOrName: string, options?: AgentLogsReadOptions): Promise<AgentLogsResponse>;
1419
+ logsConnect(agentIdOrName: string, options?: AgentLogsConnectOptions): Promise<WebSocket>;
1420
+ private connectLogs;
1421
+ /**
1422
+ * Cluster logs replay history then stream lines. Runner logs instead deliver
1423
+ * bounded replacement snapshots to onCapturedLogs, without history_end.
1424
+ *
1425
+ * One mechanism rather than a REST read plus a separate subscribe. The two-step
1426
+ * form leaves a seam between the two calls that no server change can close,
1427
+ * because the fetch and the subscribe share no lock; the backend takes the
1428
+ * history snapshot and registers the subscriber under a single lock, so a line
1429
+ * arriving mid-replay is delivered exactly once.
1430
+ *
1431
+ * Deliberately does not reconnect. A reconnect replays history again, which
1432
+ * would duplicate lines into a consumer that has already rendered them;
1433
+ * reconnect policy belongs to the caller, which knows whether it is resuming
1434
+ * or restarting the view.
1435
+ */
1436
+ subscribeLogs(agentIdOrName: string, handler: (line: string) => void | Promise<void>, options?: AgentLogsSubscribeOptions): Promise<void>;
1437
+ /**
1438
+ * Buzz-backed agents publish observer telemetry to a Nostr relay (kind
1439
+ * 24200, NIP-44-v2-encrypted to the owner). This subscribes the relay
1440
+ * directly and decrypts locally; see {@link subscribeBuzzActivity}.
1441
+ */
1442
+ subscribeBuzzActivity(agentIdOrName: string, handlers: BuzzActivityHandlers): Promise<BuzzActivitySubscription>;
1443
+ /**
1444
+ * Legacy Buzz activity through an agent `hyper-acp` WS route. Hosted Buzz
1445
+ * launches no longer provision this route; the raw ACP path is outbound
1446
+ * `HYPER_ACP_WS_URL`. See {@link subscribeBuzzActivityRoute}.
1447
+ */
1448
+ subscribeBuzzActivityRoute(agentIdOrName: string, handlers: BuzzActivityRouteHandlers): Promise<BuzzActivitySubscription>;
1449
+ shellToken(agentIdOrName: string, shell?: string, requestOptions?: RequestOverrides): Promise<AgentShellTokenResponse>;
1450
+ shellConnect(agentIdOrName: string, shell?: string, options?: AgentShellConnectOptions): Promise<WebSocket>;
1451
+ }
1452
+ //# sourceMappingURL=agents.d.ts.map