@getstackrun/sdk 4.0.0 → 4.4.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.
Files changed (240) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +326 -10
  3. package/dist/agent-auth.d.ts.map +1 -1
  4. package/dist/agent-auth.js +3 -4
  5. package/dist/agent-auth.js.map +1 -1
  6. package/dist/browser-bootstrap.js +1 -1
  7. package/dist/browser-bootstrap.js.map +1 -1
  8. package/dist/client.d.ts +86 -1
  9. package/dist/client.d.ts.map +1 -1
  10. package/dist/client.js +235 -40
  11. package/dist/client.js.map +1 -1
  12. package/dist/control-socket-server.d.ts +134 -0
  13. package/dist/control-socket-server.d.ts.map +1 -0
  14. package/dist/control-socket-server.js +108 -0
  15. package/dist/control-socket-server.js.map +1 -0
  16. package/dist/credentials-file.d.ts +7 -0
  17. package/dist/credentials-file.d.ts.map +1 -1
  18. package/dist/credentials-file.js +57 -2
  19. package/dist/credentials-file.js.map +1 -1
  20. package/dist/errors.d.ts +316 -0
  21. package/dist/errors.d.ts.map +1 -1
  22. package/dist/errors.js +572 -0
  23. package/dist/errors.js.map +1 -1
  24. package/dist/index.d.ts +126 -24
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +150 -22
  27. package/dist/index.js.map +1 -1
  28. package/dist/network-install-key.d.ts +56 -0
  29. package/dist/network-install-key.d.ts.map +1 -0
  30. package/dist/network-install-key.js +92 -0
  31. package/dist/network-install-key.js.map +1 -0
  32. package/dist/network-install.d.ts +134 -0
  33. package/dist/network-install.d.ts.map +1 -0
  34. package/dist/network-install.js +70 -0
  35. package/dist/network-install.js.map +1 -0
  36. package/dist/service-mcp.d.ts +49 -0
  37. package/dist/service-mcp.d.ts.map +1 -0
  38. package/dist/service-mcp.js +122 -0
  39. package/dist/service-mcp.js.map +1 -0
  40. package/dist/services/accounts.d.ts +1548 -0
  41. package/dist/services/accounts.d.ts.map +1 -0
  42. package/dist/services/accounts.js +724 -0
  43. package/dist/services/accounts.js.map +1 -0
  44. package/dist/services/agent-identity.d.ts +58 -0
  45. package/dist/services/agent-identity.d.ts.map +1 -0
  46. package/dist/services/agent-identity.js +50 -0
  47. package/dist/services/agent-identity.js.map +1 -0
  48. package/dist/services/agents.d.ts +78 -3
  49. package/dist/services/agents.d.ts.map +1 -1
  50. package/dist/services/agents.js +29 -2
  51. package/dist/services/agents.js.map +1 -1
  52. package/dist/services/audit.d.ts +5 -0
  53. package/dist/services/audit.d.ts.map +1 -1
  54. package/dist/services/audit.js +5 -0
  55. package/dist/services/audit.js.map +1 -1
  56. package/dist/services/billing.d.ts +67 -0
  57. package/dist/services/billing.d.ts.map +1 -0
  58. package/dist/services/billing.js +42 -0
  59. package/dist/services/billing.js.map +1 -0
  60. package/dist/services/brain.d.ts +122 -0
  61. package/dist/services/brain.d.ts.map +1 -0
  62. package/dist/services/brain.js +40 -0
  63. package/dist/services/brain.js.map +1 -0
  64. package/dist/services/calendar.d.ts +256 -0
  65. package/dist/services/calendar.d.ts.map +1 -0
  66. package/dist/services/calendar.js +75 -0
  67. package/dist/services/calendar.js.map +1 -0
  68. package/dist/services/catalogue.d.ts +185 -0
  69. package/dist/services/catalogue.d.ts.map +1 -0
  70. package/dist/services/catalogue.js +31 -0
  71. package/dist/services/catalogue.js.map +1 -0
  72. package/dist/services/chat-channels.d.ts +82 -0
  73. package/dist/services/chat-channels.d.ts.map +1 -0
  74. package/dist/services/chat-channels.js +42 -0
  75. package/dist/services/chat-channels.js.map +1 -0
  76. package/dist/services/control-policies.d.ts +409 -0
  77. package/dist/services/control-policies.d.ts.map +1 -0
  78. package/dist/services/control-policies.js +101 -0
  79. package/dist/services/control-policies.js.map +1 -0
  80. package/dist/services/control-socket.d.ts +201 -0
  81. package/dist/services/control-socket.d.ts.map +1 -0
  82. package/dist/services/control-socket.js +165 -0
  83. package/dist/services/control-socket.js.map +1 -0
  84. package/dist/services/credentials.d.ts +2 -1
  85. package/dist/services/credentials.d.ts.map +1 -1
  86. package/dist/services/credentials.js +3 -2
  87. package/dist/services/credentials.js.map +1 -1
  88. package/dist/services/detector-config.d.ts +13 -12
  89. package/dist/services/detector-config.d.ts.map +1 -1
  90. package/dist/services/detector-config.js +13 -12
  91. package/dist/services/detector-config.js.map +1 -1
  92. package/dist/services/drive.d.ts +257 -0
  93. package/dist/services/drive.d.ts.map +1 -0
  94. package/dist/services/drive.js +167 -0
  95. package/dist/services/drive.js.map +1 -0
  96. package/dist/services/dropoffs.d.ts +5 -1
  97. package/dist/services/dropoffs.d.ts.map +1 -1
  98. package/dist/services/dropoffs.js +3 -1
  99. package/dist/services/dropoffs.js.map +1 -1
  100. package/dist/services/evidence-packs.d.ts +4 -2
  101. package/dist/services/evidence-packs.d.ts.map +1 -1
  102. package/dist/services/evidence-packs.js +4 -2
  103. package/dist/services/evidence-packs.js.map +1 -1
  104. package/dist/services/flagged-content.d.ts +30 -0
  105. package/dist/services/flagged-content.d.ts.map +1 -0
  106. package/dist/services/flagged-content.js +24 -0
  107. package/dist/services/flagged-content.js.map +1 -0
  108. package/dist/services/governance.d.ts +69 -0
  109. package/dist/services/governance.d.ts.map +1 -0
  110. package/dist/services/governance.js +39 -0
  111. package/dist/services/governance.js.map +1 -0
  112. package/dist/services/identity.d.ts +44 -4
  113. package/dist/services/identity.d.ts.map +1 -1
  114. package/dist/services/identity.js +54 -6
  115. package/dist/services/identity.js.map +1 -1
  116. package/dist/services/inbound-webhooks.d.ts +12 -1
  117. package/dist/services/inbound-webhooks.d.ts.map +1 -1
  118. package/dist/services/inbound-webhooks.js +7 -0
  119. package/dist/services/inbound-webhooks.js.map +1 -1
  120. package/dist/services/intents.d.ts +8 -2
  121. package/dist/services/intents.d.ts.map +1 -1
  122. package/dist/services/intents.js +7 -3
  123. package/dist/services/intents.js.map +1 -1
  124. package/dist/services/llm.d.ts +73 -1
  125. package/dist/services/llm.d.ts.map +1 -1
  126. package/dist/services/llm.js +62 -0
  127. package/dist/services/llm.js.map +1 -1
  128. package/dist/services/making.d.ts +263 -0
  129. package/dist/services/making.d.ts.map +1 -0
  130. package/dist/services/making.js +114 -0
  131. package/dist/services/making.js.map +1 -0
  132. package/dist/services/meetings.d.ts +183 -0
  133. package/dist/services/meetings.d.ts.map +1 -0
  134. package/dist/services/meetings.js +148 -0
  135. package/dist/services/meetings.js.map +1 -0
  136. package/dist/services/memory.d.ts +288 -0
  137. package/dist/services/memory.d.ts.map +1 -0
  138. package/dist/services/memory.js +116 -0
  139. package/dist/services/memory.js.map +1 -0
  140. package/dist/services/message-access.d.ts +50 -0
  141. package/dist/services/message-access.d.ts.map +1 -0
  142. package/dist/services/message-access.js +36 -0
  143. package/dist/services/message-access.js.map +1 -0
  144. package/dist/services/missions.d.ts +93 -7
  145. package/dist/services/missions.d.ts.map +1 -1
  146. package/dist/services/missions.js +29 -1
  147. package/dist/services/missions.js.map +1 -1
  148. package/dist/services/network.d.ts +266 -0
  149. package/dist/services/network.d.ts.map +1 -0
  150. package/dist/services/network.js +209 -0
  151. package/dist/services/network.js.map +1 -0
  152. package/dist/services/partner-accounts.d.ts +215 -0
  153. package/dist/services/partner-accounts.d.ts.map +1 -0
  154. package/dist/services/partner-accounts.js +133 -0
  155. package/dist/services/partner-accounts.js.map +1 -0
  156. package/dist/services/passports.d.ts +3 -2
  157. package/dist/services/passports.d.ts.map +1 -1
  158. package/dist/services/passports.js +3 -2
  159. package/dist/services/passports.js.map +1 -1
  160. package/dist/services/payments.d.ts +126 -0
  161. package/dist/services/payments.d.ts.map +1 -0
  162. package/dist/services/payments.js +66 -0
  163. package/dist/services/payments.js.map +1 -0
  164. package/dist/services/pii-config.d.ts +7 -17
  165. package/dist/services/pii-config.d.ts.map +1 -1
  166. package/dist/services/pii-config.js +9 -19
  167. package/dist/services/pii-config.js.map +1 -1
  168. package/dist/services/post.d.ts +240 -0
  169. package/dist/services/post.d.ts.map +1 -0
  170. package/dist/services/post.js +99 -0
  171. package/dist/services/post.js.map +1 -0
  172. package/dist/services/proxy.d.ts +20 -2
  173. package/dist/services/proxy.d.ts.map +1 -1
  174. package/dist/services/proxy.js +31 -1
  175. package/dist/services/proxy.js.map +1 -1
  176. package/dist/services/rentahuman.d.ts +92 -0
  177. package/dist/services/rentahuman.d.ts.map +1 -0
  178. package/dist/services/rentahuman.js +53 -0
  179. package/dist/services/rentahuman.js.map +1 -0
  180. package/dist/services/scan.d.ts +1 -1
  181. package/dist/services/scan.d.ts.map +1 -1
  182. package/dist/services/scan.js +1 -1
  183. package/dist/services/scan.js.map +1 -1
  184. package/dist/services/services.d.ts +28 -2
  185. package/dist/services/services.d.ts.map +1 -1
  186. package/dist/services/services.js +49 -1
  187. package/dist/services/services.js.map +1 -1
  188. package/dist/services/team.d.ts +13 -1
  189. package/dist/services/team.d.ts.map +1 -1
  190. package/dist/services/team.js +12 -0
  191. package/dist/services/team.js.map +1 -1
  192. package/dist/services/trust.d.ts +39 -0
  193. package/dist/services/trust.d.ts.map +1 -0
  194. package/dist/services/trust.js +35 -0
  195. package/dist/services/trust.js.map +1 -0
  196. package/dist/services/usage.d.ts +1 -1
  197. package/dist/services/usage.js +1 -1
  198. package/dist/services/wake.d.ts +257 -0
  199. package/dist/services/wake.d.ts.map +1 -0
  200. package/dist/services/wake.js +80 -0
  201. package/dist/services/wake.js.map +1 -0
  202. package/dist/services/website.d.ts +188 -0
  203. package/dist/services/website.d.ts.map +1 -0
  204. package/dist/services/website.js +135 -0
  205. package/dist/services/website.js.map +1 -0
  206. package/dist/types.d.ts +259 -25
  207. package/dist/types.d.ts.map +1 -1
  208. package/dist/verify-agent-identity.d.ts +73 -0
  209. package/dist/verify-agent-identity.d.ts.map +1 -0
  210. package/dist/verify-agent-identity.js +106 -0
  211. package/dist/verify-agent-identity.js.map +1 -0
  212. package/dist/verify-network.d.ts +159 -0
  213. package/dist/verify-network.d.ts.map +1 -0
  214. package/dist/verify-network.js +153 -0
  215. package/dist/verify-network.js.map +1 -0
  216. package/dist/wake-webhook.d.ts +57 -0
  217. package/dist/wake-webhook.d.ts.map +1 -0
  218. package/dist/wake-webhook.js +60 -0
  219. package/dist/wake-webhook.js.map +1 -0
  220. package/dist/wallet-key.d.ts +30 -0
  221. package/dist/wallet-key.d.ts.map +1 -0
  222. package/dist/wallet-key.js +108 -0
  223. package/dist/wallet-key.js.map +1 -0
  224. package/dist/webhook.d.ts +63 -0
  225. package/dist/webhook.d.ts.map +1 -0
  226. package/dist/webhook.js +136 -0
  227. package/dist/webhook.js.map +1 -0
  228. package/dist/x402-pay.d.ts +139 -0
  229. package/dist/x402-pay.d.ts.map +1 -0
  230. package/dist/x402-pay.js +235 -0
  231. package/dist/x402-pay.js.map +1 -0
  232. package/package.json +2 -1
  233. package/dist/services/partner-connect.d.ts +0 -64
  234. package/dist/services/partner-connect.d.ts.map +0 -1
  235. package/dist/services/partner-connect.js +0 -42
  236. package/dist/services/partner-connect.js.map +0 -1
  237. package/dist/services/partner-tenants.d.ts +0 -126
  238. package/dist/services/partner-tenants.d.ts.map +0 -1
  239. package/dist/services/partner-tenants.js +0 -79
  240. package/dist/services/partner-tenants.js.map +0 -1
@@ -0,0 +1,1548 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import type { DriveFileContent } from './drive.js';
3
+ import { MakingService } from './making.js';
4
+ import { type PayX402Options, type X402Result } from '../x402-pay.js';
5
+ export type AccountPieceKind = 'passport' | 'inbox' | 'phone' | 'models' | 'tools' | 'sandbox' | 'browser' | 'card' | 'wallet' | 'making' | 'workspace';
6
+ export type AccountPieceState = 'pending' | 'ready' | 'paused' | 'failed' | 'closing' | 'closed';
7
+ export type AgentAccountStatus = 'opening' | 'open' | 'suspended' | 'frozen' | 'closing' | 'closed';
8
+ export type AccountMessageChannel = 'email' | 'sms' | 'voicemail' | 'call' | 'telegram' | 'post' | 'meeting';
9
+ export interface OpenAgentAccountInput {
10
+ name: string;
11
+ description?: string;
12
+ /** Optional per-agent limit, USD cents, 100 to 10,000,000. Needs controls. */
13
+ monthly_budget_cents?: number;
14
+ /** A US number with no `area_code` is toll-free; an `area_code` or `number_type: 'local'` gets a local number. Canadian numbers are local. */
15
+ phone?: {
16
+ country: 'US' | 'CA';
17
+ area_code?: string;
18
+ number_type?: 'local' | 'toll_free';
19
+ };
20
+ /** `agent_public_key` is `generateAgentWalletKey().publicKey`; the private half stays with you. */
21
+ /**
22
+ * Caps are optional and a controls feature: with none, or without controls, the wallet's own USDC balance is the limit.
23
+ * STACK sets no maximum. Set or change them later with `accounts.wallet.setCaps`.
24
+ */
25
+ wallet?: {
26
+ agent_public_key: string;
27
+ per_payment_cap_usdc?: number;
28
+ daily_cap_usdc?: number;
29
+ };
30
+ /** The inbox on one of your own verified mail domains instead of the shared agent domain. */
31
+ inbox?: {
32
+ domain: string;
33
+ };
34
+ /** Pieces not wanted. Passport, models and tools always open. */
35
+ skip?: Array<'inbox' | 'phone' | 'browser' | 'card' | 'wallet' | 'making' | 'workspace'>;
36
+ }
37
+ export interface OpenAgentAccountOptions {
38
+ /** 8 to 128 characters. Reuse it, with the same input, for every retry of this open. */
39
+ idempotencyKey: string;
40
+ /** Sent as `X-Governance-Approval`. Opening no longer asks for one; kept for older callers. */
41
+ governanceApprovalId?: string;
42
+ }
43
+ export interface AgentAccountPiece {
44
+ kind: AccountPieceKind;
45
+ state: AccountPieceState;
46
+ provider: string;
47
+ details: Record<string, unknown>;
48
+ error_code: string | null;
49
+ /** Why a paused piece is paused: `unpaid` (its monthly charge), a reputation pause, a provider spend cap. */
50
+ pause_reason: string | null;
51
+ ready_at: string | null;
52
+ }
53
+ export interface AgentAccount {
54
+ id: string;
55
+ agent_id: string;
56
+ mission_id: string | null;
57
+ status: AgentAccountStatus;
58
+ /** Why a suspended account is suspended: its owner's platform subscription lapsed. */
59
+ suspend_reason: 'platform_lapsed' | null;
60
+ /** Null when the account has no per-agent budget. */
61
+ monthly_budget_cents: number | null;
62
+ /** `limit_cents` is null with no budget; spend is still recorded. */
63
+ budget: {
64
+ period_start: string;
65
+ limit_cents: number | null;
66
+ reserved_cents: number;
67
+ settled_cents: number;
68
+ };
69
+ pieces: AgentAccountPiece[];
70
+ created_at: string;
71
+ closed_at: string | null;
72
+ }
73
+ /**
74
+ * An attachment of a message. `file_id` is the drive file that holds it (the receiving agent sees it like a file it
75
+ * uploaded; untrusted like every drive file). `not_saved` is why an attachment that arrived is not in the drive:
76
+ * `too_large`, `unavailable`, `drive_read_only`, `waiting` (STACK is still saving it and tries for 30 days)
77
+ * or `withheld`; the email is kept either way. A received file goes with its message when it is deleted,
78
+ * unless its end is changed (`drive.update`).
79
+ */
80
+ export interface AccountMessageAttachment {
81
+ filename: string | null;
82
+ content_type: string | null;
83
+ size_bytes: number | null;
84
+ file_id?: string | null;
85
+ not_saved?: string | null;
86
+ }
87
+ export interface AccountMessage {
88
+ id: string;
89
+ account_id: string;
90
+ channel: AccountMessageChannel;
91
+ direction: 'inbound' | 'outbound';
92
+ /** `delivered` carries content; `withheld` carries only the notice. */
93
+ status: 'delivered' | 'withheld';
94
+ received_at: string;
95
+ read_at: string | null;
96
+ content: {
97
+ from: string;
98
+ to: string[];
99
+ cc: string[];
100
+ /** On an email the account sent. A message that arrived never shows any. */
101
+ bcc?: string[];
102
+ /** The mail provider's thread of an email: `replyEmail` answers in it. */
103
+ thread_id?: string | null;
104
+ subject: string | null;
105
+ body_text: string;
106
+ attachments: AccountMessageAttachment[];
107
+ truncated: boolean;
108
+ details: Record<string, string>;
109
+ } | null;
110
+ withheld: {
111
+ verdict: 'flagged' | 'blocked';
112
+ security_event_id: string | null;
113
+ reason: string;
114
+ } | null;
115
+ /** Set on a delivered message that matched a prompt-injection pattern while the owner's controls were off. */
116
+ flag: {
117
+ severity: 'warning' | 'critical';
118
+ security_event_id: string | null;
119
+ reason: string;
120
+ } | null;
121
+ }
122
+ /** On content delivered although it matched a prompt-injection pattern (controls off). */
123
+ export interface ContentFlag {
124
+ security_event_id: string | null;
125
+ message: string;
126
+ }
127
+ export interface ListAccountMessagesQuery {
128
+ /** 1 to 100, default 25. */
129
+ limit?: number;
130
+ /** `next_cursor` of the previous page. */
131
+ cursor?: string;
132
+ channel?: AccountMessageChannel;
133
+ }
134
+ export interface ListAccountMessagesResult {
135
+ messages: AccountMessage[];
136
+ next_cursor: string | null;
137
+ }
138
+ /**
139
+ * What `accounts.messages.search` filters on. Every filter is optional and they all apply together. Datetimes are ISO 8601
140
+ * with an offset (`2026-11-01T00:00:00Z`). The window is the last 30 days unless `after` and `before` say otherwise; a search
141
+ * on `q`, `sender`, `recipient` or `threadId` needs a window of at most 90 days (400 otherwise).
142
+ */
143
+ export interface SearchAccountMessagesQuery {
144
+ /** Only the messages of this agent. */
145
+ agentId?: string;
146
+ channel?: AccountMessageChannel;
147
+ /** The address or number the message came from. */
148
+ sender?: string;
149
+ /** An address or number the message went to. */
150
+ recipient?: string;
151
+ /** The mail provider's thread of an email. */
152
+ threadId?: string;
153
+ after?: string;
154
+ before?: string;
155
+ /** Text to find in the subject and the body. */
156
+ q?: string;
157
+ /** 1 to 50, default 25. */
158
+ limit?: number;
159
+ /** `next_cursor` of the previous page. */
160
+ cursor?: string;
161
+ }
162
+ /** A message in a search: the summary of one message, without its body (read it with `accounts.messages.get`). */
163
+ export interface AccountMessageSearchHit {
164
+ id: string;
165
+ account_id: string;
166
+ agent_id: string | null;
167
+ channel: AccountMessageChannel;
168
+ direction: 'inbound' | 'outbound';
169
+ /** `delivered` carries content; `withheld` is held back by a security check. */
170
+ status: 'delivered' | 'withheld';
171
+ from: string;
172
+ to: string[];
173
+ subject: string | null;
174
+ received_at: string;
175
+ thread_id: string | null;
176
+ attachments: AccountMessageAttachment[];
177
+ }
178
+ export interface SearchAccountMessagesResult {
179
+ messages: AccountMessageSearchHit[];
180
+ next_cursor: string | null;
181
+ /** The window that was searched. */
182
+ window: {
183
+ after: string;
184
+ before: string;
185
+ };
186
+ }
187
+ /**
188
+ * A file attached to an email: one of the agent's drive files by its id (`filename` renames it in this email only), or
189
+ * a small file sent inline as base64 (up to 10 MB in all). Together the attachments are at most 25 MB, which is the
190
+ * mail provider's limit.
191
+ */
192
+ export type SendAccountEmailAttachment = {
193
+ file_id: string;
194
+ filename?: string;
195
+ } | {
196
+ filename: string;
197
+ content_type: string;
198
+ content_base64: string;
199
+ };
200
+ export interface SendAccountEmailInput {
201
+ /**
202
+ * One address or a list. The mail provider takes one To address: the first is the message's To and any further ones
203
+ * are delivered as Cc (the answer's `cc` shows where each went). Required: `cc` or `bcc` alone is refused.
204
+ */
205
+ to: string | string[];
206
+ cc?: string[];
207
+ /** Blind copies: delivered, and shown to nobody else. */
208
+ bcc?: string[];
209
+ /** Required unless `thread_id` is set. One line: line breaks are refused. */
210
+ subject?: string;
211
+ body: string;
212
+ body_html?: string;
213
+ /** To answer an email the account received, use `replyEmail`. */
214
+ thread_id?: string;
215
+ attachments?: SendAccountEmailAttachment[];
216
+ /**
217
+ * The received message (`amsg_...`) this email answers. Needed when the policy sets the account's email recipients to
218
+ * `per_mission`: the email then goes only to whoever wrote that message. Any other id is 404.
219
+ */
220
+ reply_to_message?: string;
221
+ }
222
+ /**
223
+ * An answer to an email the account received. It goes in that email's thread to the person who wrote it (every address
224
+ * its From names, when it names several), or with `reply_all` to everyone else it was sent to as well.
225
+ */
226
+ export interface ReplyAccountEmailInput {
227
+ body: string;
228
+ body_html?: string;
229
+ reply_all?: boolean;
230
+ cc?: string[];
231
+ bcc?: string[];
232
+ /** Replaces the thread's own subject. */
233
+ subject?: string;
234
+ attachments?: SendAccountEmailAttachment[];
235
+ /** The answered email is quoted under your words unless this is `false`. */
236
+ include_quote?: boolean;
237
+ }
238
+ /** An email the account received, sent on to others as a new email (no thread) with "Fwd:" before its subject. */
239
+ export interface ForwardAccountEmailInput {
240
+ to: string | string[];
241
+ cc?: string[];
242
+ bcc?: string[];
243
+ /** Your own words above the forwarded message. */
244
+ body?: string;
245
+ /** The original's attachments are sent too unless this is `false`. */
246
+ include_attachments?: boolean;
247
+ /** More files beside the original's. */
248
+ attachments?: SendAccountEmailAttachment[];
249
+ /** The original's text and headers are carried under your words unless this is `false`. */
250
+ include_quote?: boolean;
251
+ }
252
+ export interface SendAccountSmsInput {
253
+ /** E.164, e.g. +14155550123: any country Twilio can reach from the account's number. */
254
+ to: string;
255
+ body: string;
256
+ /**
257
+ * The received message (`amsg_...`) this text answers. Needed when the policy sets the account's text recipients to
258
+ * `per_mission`: the text then goes only to whoever wrote that message. Any other id is 404.
259
+ */
260
+ reply_to_message?: string;
261
+ }
262
+ export interface SendAccountTelegramInput {
263
+ /** A chat that wrote to the agent's bot first (its id is in the received message's `details.chat_id`): a bot cannot message a chat first. */
264
+ chat_id: string;
265
+ /** Up to 4,096 characters. */
266
+ text: string;
267
+ }
268
+ export interface TelegramBot {
269
+ bot_id: string;
270
+ account_id: string;
271
+ /** The bot's @username, so people can find it. */
272
+ username: string;
273
+ status: 'active' | 'closed';
274
+ created_at: string;
275
+ /** Where a person starts a chat with the bot. */
276
+ start_url: string;
277
+ }
278
+ /** The link the account's owner opens in Telegram to have the agent's bot made (Telegram's Managed Bots). */
279
+ export interface ManagedTelegramBotRequest {
280
+ request_id: string;
281
+ account_id: string;
282
+ /** Open this in Telegram and confirm: only that confirmation creates the bot. Single-use. */
283
+ create_url: string;
284
+ /** The username the link suggests; the owner must keep it, it ties their confirmation to this request. */
285
+ suggested_username: string;
286
+ expires_at: string;
287
+ }
288
+ export interface TelegramChat {
289
+ chat_id: string;
290
+ chat_type: 'private' | 'group' | 'supergroup';
291
+ label: string;
292
+ first_seen_at: string;
293
+ last_inbound_at: string;
294
+ /** Telegram refused a message to it (blocked or removed); it can write again to unblock it. */
295
+ blocked: boolean;
296
+ }
297
+ export interface AccountMessageSent {
298
+ message_id: string;
299
+ channel: 'email' | 'sms' | 'telegram';
300
+ provider_message_id: string;
301
+ thread_id: string | null;
302
+ status: string;
303
+ }
304
+ /** The answer of an email send, reply or forward: who it went to and what it carried. */
305
+ export interface AccountEmailSent extends AccountMessageSent {
306
+ channel: 'email';
307
+ /** One address: a further To address of the request is in `cc`. */
308
+ to: string[];
309
+ cc: string[];
310
+ bcc: string[];
311
+ /** `file_id` is the drive file the attachment was read from, or null for an inline one. */
312
+ attachments: Array<{
313
+ filename: string;
314
+ content_type: string;
315
+ size_bytes: number;
316
+ file_id: string | null;
317
+ }>;
318
+ /**
319
+ * Addresses left out, each as it was given and why: `not_an_address` (an entry of a received message that is not one
320
+ * plain address). Absent when nothing was left out.
321
+ */
322
+ dropped?: Array<{
323
+ value: string;
324
+ reason: 'not_an_address';
325
+ }>;
326
+ }
327
+ export type WorkspaceState = 'starting' | 'running' | 'pausing' | 'paused' | 'deleting' | 'deleted' | 'failed';
328
+ /** A command to run in the account's workspace. */
329
+ export interface WorkspaceExecInput {
330
+ /** The workspace to run in. Leave it out to make a new one. */
331
+ workspace_id?: string;
332
+ command: string;
333
+ /** Working directory inside the workspace. */
334
+ cwd?: string;
335
+ /** Variables for this command only, at most 32. Names starting with STACK_ are set by STACK. Values are never recorded. */
336
+ env?: Record<string, string>;
337
+ /** Seconds the command may run while you wait for it; the default is 120 and STACK sets no longest. Not with `background`. */
338
+ timeout_seconds?: number;
339
+ /** Start the command and get a `command_id` at once; read it later with `workspaces.command`. It has no timeout and runs until it ends. Not with `timeout_seconds` or `stack_access`. */
340
+ background?: boolean;
341
+ /** Give the command a short-lived Passport of the agent (STACK_PASSPORT, STACK_API_URL) so code in the workspace reaches your connected services through STACK's proxy. Off by default; revoked when the command ends. */
342
+ stack_access?: boolean;
343
+ }
344
+ export interface WorkspaceReadFileInput {
345
+ path: string;
346
+ }
347
+ /**
348
+ * Exactly one of `content_text` and `content_base64`, at most 1 MB. `mode` is octal permission bits (such as "755")
349
+ * set on the file once it is written; the write fails if they cannot be set.
350
+ */
351
+ export type WorkspaceWriteFileInput = {
352
+ path: string;
353
+ content_text: string;
354
+ content_base64?: never;
355
+ mode?: string;
356
+ } | {
357
+ path: string;
358
+ content_base64: string;
359
+ content_text?: never;
360
+ mode?: string;
361
+ };
362
+ export interface WorkspaceSaveFileInput {
363
+ path: string;
364
+ /** The drive file's name; defaults to the file's own. */
365
+ name?: string;
366
+ /** The drive's media type; defaults to the one the extension says. */
367
+ content_type?: string;
368
+ /** `agent` (default): private to this agent. `account`: every agent of the account. */
369
+ visibility?: 'agent' | 'account';
370
+ }
371
+ export interface WorkspaceStopInput {
372
+ /** Delete the workspace and its files. Without it the workspace is paused and keeps its files. */
373
+ delete?: boolean;
374
+ }
375
+ /**
376
+ * The customer's workspace settings. Each field left out stays; `null` clears it so the agent account inherits the
377
+ * customer's default (and the default, cleared, is STACK's). What is not a setting is the money hold: a machine is never
378
+ * billed beyond what is held for it, so a machine with no idle pause runs until its hold is used and is then paused.
379
+ */
380
+ export interface WorkspaceSettingsInput {
381
+ /** Minutes with no action before a running workspace is paused: 5 or more, or 0 for no idle pause */
382
+ idle_pause_minutes?: number | null;
383
+ /** Days a stopped workspace is kept before it is deleted: 1 or more, or 0 to keep it until it is deleted by hand. A stopped workspace's disk storage is charged to the account until it is deleted. */
384
+ delete_after_days?: number | null;
385
+ /** Workspaces an agent account may have that are not deleted: per agent account, any number from 1. */
386
+ max_workspaces?: number | null;
387
+ }
388
+ /** One scope's own settings: what was set at this level, null where it inherits. */
389
+ export interface WorkspaceSettings {
390
+ /** Null for the customer's default. */
391
+ agent_id: string | null;
392
+ idle_pause_minutes: number | null;
393
+ delete_after_days: number | null;
394
+ max_workspaces: number | null;
395
+ updated_at: string | null;
396
+ }
397
+ /** What is in force for an agent account: its own over the customer's default over STACK's, within the plan. */
398
+ export interface EffectiveWorkspaceSettings {
399
+ /** 0: no idle pause. */
400
+ idle_pause_minutes: number;
401
+ /** 0: kept until deleted by hand. */
402
+ delete_after_days: number;
403
+ /** The customer's own number: there is no plan ceiling. */
404
+ max_workspaces: number;
405
+ }
406
+ export interface WorkspaceSettingsResult {
407
+ settings: WorkspaceSettings;
408
+ effective: EffectiveWorkspaceSettings;
409
+ /** What a change did to workspaces that already exist; null on a read. A stopped workspace past a shorter delete-after is deleted by the next sweep. */
410
+ applied: {
411
+ running_workspaces_updated: number;
412
+ stopped_workspaces_due_for_deletion: number;
413
+ } | null;
414
+ /** Set when stopped workspaces are kept without end: their disk storage is charged to the account until they are deleted. */
415
+ note: string | null;
416
+ }
417
+ export interface Workspace {
418
+ id: string;
419
+ /** The agent account that started the workspace and pays for its machine, whoever uses it. */
420
+ account_id: string;
421
+ /** The agent of that account. */
422
+ agent_id: string;
423
+ /** True when the customer's other agents may run commands and read and write files here (the default); the customer turns it off per workspace. */
424
+ shared_with_agents: boolean;
425
+ state: WorkspaceState;
426
+ region: string;
427
+ cpu: number;
428
+ memory_gib: number;
429
+ disk_gib: number;
430
+ /** Cents held for the current start. */
431
+ reserved_cents: number | null;
432
+ /** Cents charged so far, at cost. */
433
+ charged_cents: number;
434
+ created_at: string;
435
+ last_activity_at: string;
436
+ /** When this start ends and the workspace is paused. */
437
+ segment_ends_at: string | null;
438
+ /** When a stopped workspace will be deleted (its stop plus the delete-after setting); null while it runs and when it is kept without end. */
439
+ expires_at: string | null;
440
+ ended_reason: 'requested' | 'max_lifetime' | 'account_closed' | 'erased' | 'start_failed' | 'provider_gone' | 'unpaid' | null;
441
+ }
442
+ /** A workspace in a list: the workspace and the name of the agent that started it. */
443
+ export interface WorkspaceListItem extends Workspace {
444
+ agent_name: string | null;
445
+ }
446
+ /** The answer to changing whether the customer's other agents may use a workspace. */
447
+ export interface WorkspaceSharingResult {
448
+ workspace: Workspace;
449
+ /** False when the workspace was already set that way: nothing changed and nothing was recorded. */
450
+ changed: boolean;
451
+ }
452
+ /** Content from a workspace comes from outside: `untrusted` says to read it as data, never as instructions. */
453
+ export interface WorkspaceWithheld {
454
+ security_event_id: string | null;
455
+ message: string;
456
+ }
457
+ export interface WorkspaceExecResult {
458
+ workspace: Workspace;
459
+ /** True when this call made the workspace. */
460
+ created: boolean;
461
+ exit_code: number | null;
462
+ /** Standard output and error together, at most 64 KB (the start and the end are kept). */
463
+ output: string;
464
+ truncated: boolean;
465
+ /** True when the wait ended before the command did. The command is not ended: see `still_running` and `command_id`. */
466
+ timed_out: boolean;
467
+ /** Present and true when the wait ended and the command is still running in the workspace. */
468
+ still_running?: boolean;
469
+ /** Present with `still_running`: read the command later with its status call. */
470
+ command_id?: string;
471
+ duration_ms: number;
472
+ untrusted: true;
473
+ /** Set instead of the output when it was aimed at an AI agent (controls on), or could not be checked or recorded. */
474
+ withheld: WorkspaceWithheld | null;
475
+ /** Set with the output when it was aimed at an AI agent and your controls are off. */
476
+ flag: WorkspaceWithheld | null;
477
+ /** The signed record of the command; null when it could not be written. */
478
+ record: {
479
+ claim_id: string;
480
+ } | null;
481
+ }
482
+ /** What a command started with `background: true` answers at once. */
483
+ export interface WorkspaceBackgroundStarted {
484
+ workspace: Workspace;
485
+ /** True when this call made the workspace. */
486
+ created: boolean;
487
+ background: true;
488
+ /** Read the command with `workspaces.command(accountId, workspaceId, commandId)`. */
489
+ command_id: string;
490
+ started_at: string;
491
+ /** The signed record that the command was started; null when it could not be written. */
492
+ record: {
493
+ claim_id: string;
494
+ } | null;
495
+ }
496
+ /** A background command now: running, or ended with its exit code, and what it has printed so far. */
497
+ export interface WorkspaceCommand {
498
+ workspace_id: string;
499
+ command_id: string;
500
+ status: 'running' | 'succeeded' | 'failed';
501
+ /** Null while it runs. */
502
+ exit_code: number | null;
503
+ /** Standard output and error together, at most 64 KB (the start and the end are kept). */
504
+ output: string;
505
+ truncated: boolean;
506
+ untrusted: true;
507
+ withheld: WorkspaceWithheld | null;
508
+ flag: WorkspaceWithheld | null;
509
+ record: null;
510
+ }
511
+ export interface WorkspaceFile {
512
+ workspace_id: string;
513
+ path: string;
514
+ size_bytes: number;
515
+ /** UTF-8 text, or null when the bytes are not text (then `content_base64`). */
516
+ content_text: string | null;
517
+ content_base64: string | null;
518
+ untrusted: true;
519
+ withheld: WorkspaceWithheld | null;
520
+ flag: WorkspaceWithheld | null;
521
+ record: {
522
+ claim_id: string;
523
+ } | null;
524
+ }
525
+ export interface WorkspaceFileWritten {
526
+ workspace_id: string;
527
+ path: string;
528
+ size_bytes: number;
529
+ sha256: string;
530
+ record: {
531
+ claim_id: string;
532
+ } | null;
533
+ }
534
+ export interface WorkspaceFileSaved {
535
+ workspace_id: string;
536
+ path: string;
537
+ /** The drive file the bytes were saved as. */
538
+ drive_file_id: string;
539
+ name: string;
540
+ content_type: string;
541
+ size_bytes: number;
542
+ sha256: string;
543
+ record: {
544
+ claim_id: string;
545
+ } | null;
546
+ }
547
+ export interface WorkspaceStopped {
548
+ workspace: Workspace;
549
+ /** Cents the start that ended was settled for. */
550
+ charged_cents: number;
551
+ record: {
552
+ claim_id: string;
553
+ } | null;
554
+ }
555
+ /** An element by accessible role and name, visible text, label or CSS selector. */
556
+ export type BrowserTarget = {
557
+ role: string;
558
+ name?: string;
559
+ exact?: boolean;
560
+ } | {
561
+ text: string;
562
+ exact?: boolean;
563
+ } | {
564
+ label: string;
565
+ exact?: boolean;
566
+ } | {
567
+ selector: string;
568
+ };
569
+ export type BrowserAction = {
570
+ action: 'click';
571
+ target: BrowserTarget;
572
+ } | {
573
+ action: 'type';
574
+ target: BrowserTarget;
575
+ value: string;
576
+ sensitive?: boolean;
577
+ } | {
578
+ action: 'select';
579
+ target: BrowserTarget;
580
+ value: string | string[];
581
+ } | {
582
+ action: 'press';
583
+ key: string;
584
+ target?: BrowserTarget;
585
+ };
586
+ export interface BrowserSession {
587
+ session_id: string;
588
+ state: 'active';
589
+ max_minutes: number;
590
+ expires_at: string;
591
+ reserved_cents: number;
592
+ }
593
+ export type BrowserReading = {
594
+ withheld: false;
595
+ url: string;
596
+ title: string;
597
+ text: string;
598
+ accessibility: string;
599
+ truncated: boolean;
600
+ flag: ContentFlag | null;
601
+ } | {
602
+ withheld: true;
603
+ url: string;
604
+ security_event_id: string;
605
+ message: string;
606
+ };
607
+ export interface BrowserCheckoutInput {
608
+ /** The exact https origin of the checkout page. */
609
+ merchant_origin: string;
610
+ /** The total the page shows, in the currency's smallest unit. */
611
+ amount_minor: number;
612
+ /** ISO 4217. */
613
+ currency: string;
614
+ }
615
+ export interface BrowserCheckout {
616
+ purchase_id: string;
617
+ state: 'reserved';
618
+ reserved_cents: number;
619
+ /** A test number for the stored card's network, never a real card. */
620
+ placeholder_card: {
621
+ number: string;
622
+ security_code: string;
623
+ expiry_month: string;
624
+ expiry_year: string;
625
+ brand: string;
626
+ };
627
+ next: string;
628
+ }
629
+ export interface CardPurchase {
630
+ purchase_id: string;
631
+ state: string;
632
+ status: string;
633
+ user_action?: string;
634
+ outcome: string | null;
635
+ merchant_origin: string;
636
+ amount_minor: number;
637
+ currency: string;
638
+ created_at: string;
639
+ }
640
+ export type PurchaseMerchantResult = {
641
+ status: 'completed';
642
+ order_id: string;
643
+ } | {
644
+ status: 'failed';
645
+ } | {
646
+ status: 'pending';
647
+ } | {
648
+ status: 'requires_user_action';
649
+ reason: '3ds' | 'redirect' | 'other';
650
+ };
651
+ /** The body `signWalletPayment` returns. */
652
+ export interface WalletPaymentInput {
653
+ typed_data: Record<string, unknown>;
654
+ agent_signature: string;
655
+ }
656
+ export interface WalletPayment {
657
+ payment_id: string;
658
+ payload_hash: string;
659
+ /** The wallet's EIP-712 signature: the x402 payment authorization. */
660
+ signature: string;
661
+ from: string;
662
+ to: string;
663
+ amount_atomic: string;
664
+ amount_cents: number;
665
+ valid_before: string;
666
+ }
667
+ /** The voice a call speaks in. Each is optional; none set means Twilio's default voice and en-US. STACK keeps no list. */
668
+ export interface AccountCallVoice {
669
+ /** A text-to-speech provider Twilio's ConversationRelay documents. */
670
+ tts_provider?: 'Google' | 'Amazon' | 'ElevenLabs';
671
+ /** Any voice name the provider takes. */
672
+ voice?: string;
673
+ /** BCP-47, for example `fr-FR`. */
674
+ language?: string;
675
+ }
676
+ /** The account's own call voice and voicemail greeting, as read. */
677
+ export interface AccountCallVoiceSetting {
678
+ tts_provider: 'Google' | 'Amazon' | 'ElevenLabs' | null;
679
+ voice: string | null;
680
+ language: string | null;
681
+ /** What a caller hears before the beep when a call goes to voicemail. Null: only the beep. */
682
+ voicemail_greeting: string | null;
683
+ }
684
+ /**
685
+ * Placing a call. Without `brief` the agent holds the call itself (STACK runs no model and says nothing: the call opens
686
+ * with `greeting` or with silence, and the agent speaks with `say` or over `live`). With `on_behalf_of` and `brief`, STACK's
687
+ * model holds the call, opening with STACK's line that the other side is speaking with an AI on behalf of `on_behalf_of`.
688
+ */
689
+ export interface StartAccountCallInput {
690
+ /** E.164, any country Twilio can reach from the account's number. */
691
+ to: string;
692
+ /** From 30 to 14400 seconds (Twilio's own limit, and the default when omitted). A call is paid for 10 minutes at a time. */
693
+ max_seconds?: number;
694
+ /** The voice of this call; it wins over the account's. */
695
+ voice?: AccountCallVoice;
696
+ /** greeting is spoken only when your agent runs the call; on a call STACK holds, STACK opens with its own line. Words spoken first; left out, nothing is spoken until the other side speaks. */
697
+ greeting?: string;
698
+ /** wait_seconds applies only when your agent runs the call: how long to wait for the other side's first finished sentence (0 to 60 seconds, default 30). Ignored on a call STACK holds. */
699
+ wait_seconds?: number;
700
+ /** A call STACK holds: who it is for, a plain name of up to 60 characters. Given with `brief`. */
701
+ on_behalf_of?: string;
702
+ /** A call STACK holds: what the call is for and what to know, in the agent's own words. Given with `on_behalf_of`. */
703
+ brief?: string;
704
+ /**
705
+ * The received message (`amsg_...`) this call answers. Needed when the policy sets the account's call recipients to
706
+ * `per_mission`: the call then goes only to whoever wrote that message. Any other id is 404.
707
+ */
708
+ reply_to_message?: string;
709
+ }
710
+ /** Answering a call that rings on the account's number: the same as placing one, without a number to dial. */
711
+ export type AnswerAccountCallInput = Omit<StartAccountCallInput, 'to' | 'reply_to_message'>;
712
+ /** `ringing` is also an incoming call that the agent can still answer or decline. */
713
+ export type AccountCallState = 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'refused';
714
+ export type AccountCallEndReason = 'agent_hung_up' | 'goal_complete' | 'caller_hung_up' | 'max_duration' | 'revoked' | 'injection' | 'budget_exhausted' | 'model_unavailable' | 'no_speech' | 'repeating' | 'voicemail' | 'declined' | 'busy' | 'no_answer' | 'canceled' | 'failed';
715
+ /** What an incoming call became: the agent answered it, declined it, or it went to voicemail. */
716
+ export type AccountCallDecision = 'answered' | 'declined' | 'voicemail';
717
+ /**
718
+ * STACK's own checks of who is writing or calling, worked out when it arrived. A tag warns and never blocks.
719
+ */
720
+ export type AccountSenderTag = 'new_sender' | 'new_domain' | 'lookalike_domain' | 'name_matches_known_contact' | 'payment_details' | 'organizer_not_sender' | 'unverified_sender';
721
+ /** Something STACK recorded about a call on its row. `paid_time_ends`: the next 10 minutes cannot be held, so the call ends at `ends_at`. */
722
+ export interface AccountCallEvent {
723
+ at: string;
724
+ type: 'paid_time_ends' | 'no_speech' | 'repeating' | 'do_not_call';
725
+ message: string;
726
+ ends_at?: string;
727
+ }
728
+ /** A flag on something heard: the detectors found it suspicious. */
729
+ export interface AccountCallFlag {
730
+ severity: 'warning' | 'critical';
731
+ security_event_id: string | null;
732
+ }
733
+ /** What happens on a live call, as the agent hears it, numbered from 1 in the order it happened. */
734
+ export type AccountCallLiveEvent = {
735
+ seq: number;
736
+ at: string;
737
+ type: 'heard';
738
+ text?: string;
739
+ withheld?: boolean;
740
+ flag?: AccountCallFlag;
741
+ } | {
742
+ seq: number;
743
+ at: string;
744
+ type: 'keys';
745
+ digits: string;
746
+ } | {
747
+ seq: number;
748
+ at: string;
749
+ type: 'interrupted';
750
+ heard_of_agent: string;
751
+ } | {
752
+ seq: number;
753
+ at: string;
754
+ type: 'paid_time_ends';
755
+ in_seconds: number;
756
+ } | {
757
+ seq: number;
758
+ at: string;
759
+ type: 'ended';
760
+ reason: AccountCallEndReason;
761
+ };
762
+ /** One line of a call's live transcript. A line the owner's controls withhold has no text. */
763
+ export interface AccountCallLine {
764
+ at: string;
765
+ speaker: 'agent' | 'caller';
766
+ text?: string;
767
+ withheld?: boolean;
768
+ flag?: AccountCallFlag;
769
+ /** A switch of the language the call speaks and hears. */
770
+ language?: string;
771
+ scan?: 'unavailable';
772
+ }
773
+ export interface AccountCall {
774
+ call_id: string;
775
+ account_id: string;
776
+ direction: 'inbound' | 'outbound';
777
+ state: AccountCallState;
778
+ max_seconds: number;
779
+ duration_seconds: number | null;
780
+ end_reason: AccountCallEndReason | null;
781
+ charged_cents: number | null;
782
+ created_at: string;
783
+ started_at: string | null;
784
+ ended_at: string | null;
785
+ /**
786
+ * An incoming call: null while it rings (and when the caller hangs up first), then `answered`, `declined` or
787
+ * `voicemail` (the ring ran out, or the agent let it go). Null on a call the agent placed.
788
+ */
789
+ decision: AccountCallDecision | null;
790
+ /** A ringing call: when the ring runs out and the call goes to voicemail. Null otherwise. */
791
+ answer_by: string | null;
792
+ /** A ringing call: the number calling. Anyone can fake it, so it does not prove who is calling. Null otherwise. */
793
+ caller: string | null;
794
+ /**
795
+ * An incoming call: what the carrier vouches for the number with (STIR/SHAKEN): `A` it knows the caller and the number,
796
+ * `B` it knows the caller, `C` it only carried the call. Null when it did not validate the number, and on a call the
797
+ * agent placed. It says what the carrier checked, not who is calling.
798
+ */
799
+ caller_attestation: 'A' | 'B' | 'C' | null;
800
+ /** An incoming call: STACK's checks of the caller's number, made when it rang. Null: not assessed. */
801
+ sender_tags: AccountSenderTag[] | null;
802
+ /** The known domain a `lookalike_domain` sender imitates. Null when no tag names one. */
803
+ sender_resembles: string | null;
804
+ /** True when STACK holds the call with its own model. */
805
+ held_by_stack: boolean;
806
+ events: AccountCallEvent[];
807
+ }
808
+ /** What a call action returns: the call, and every event on it since this caller's last call action on it. */
809
+ export interface AccountCallTurn {
810
+ call: AccountCall;
811
+ events: AccountCallLiveEvent[];
812
+ }
813
+ /** One call with its transcript: `lines` while it is on the line, then the stored message on the `call` channel. */
814
+ export interface AccountCallWithTranscript extends AccountCall {
815
+ transcript: AccountMessage | null;
816
+ lines: AccountCallLine[];
817
+ }
818
+ export interface ListAccountCallsQuery {
819
+ /** 1 to 100, default 25. */
820
+ limit?: number;
821
+ /** `next_cursor` of the previous page. */
822
+ cursor?: string;
823
+ }
824
+ export interface ListAccountCallsResult {
825
+ calls: AccountCall[];
826
+ next_cursor: string | null;
827
+ }
828
+ /** A tool read that screening flagged (with controls on) or could not check comes back withheld, with only the notice. */
829
+ export interface AccountToolWithheld {
830
+ withheld: true;
831
+ security_event_id: string | null;
832
+ message: string;
833
+ }
834
+ export interface AccountToolSummary {
835
+ provider: string;
836
+ providerName: string | null;
837
+ endpoint: string;
838
+ description: string;
839
+ score: number | null;
840
+ tags: string[];
841
+ price: {
842
+ type: string;
843
+ amount_usd: number | null;
844
+ } | null;
845
+ }
846
+ export type AccountToolDiscovery = {
847
+ withheld: false;
848
+ flag: ContentFlag | null;
849
+ results: AccountToolSummary[];
850
+ } | AccountToolWithheld;
851
+ export type AccountToolInspection = {
852
+ withheld: false;
853
+ flag: ContentFlag | null;
854
+ endpoint: Record<string, unknown>;
855
+ } | AccountToolWithheld;
856
+ export interface AccountToolRunInput {
857
+ /** The paid-tools provider's slug for the tool. */
858
+ provider: string;
859
+ /** The tool's endpoint path, such as /acme/search. */
860
+ endpoint: string;
861
+ /** The endpoint's input, at most 64 KiB serialised. */
862
+ input?: Record<string, unknown>;
863
+ /** The most results a PER_RESULT endpoint may return and charge for, 1 to 1000. */
864
+ max_results?: number;
865
+ /** A cap of your own: a run whose worst case would cost more cents than this is refused before anything is held. */
866
+ max_cost_cents?: number;
867
+ }
868
+ /** One file a tool run produced. */
869
+ export interface ToolRunFile {
870
+ name: string;
871
+ content_type: string;
872
+ size_bytes: number | null;
873
+ /** The drive file it was saved to, when the account has a drive. */
874
+ drive_file_id: string | null;
875
+ /** Where the provider hosts it; provider links expire. */
876
+ source_url: string | null;
877
+ /** The bytes, base64, when the file is small and there is no drive to save it to. */
878
+ data_base64: string | null;
879
+ }
880
+ /** A key an account signs its outbound requests with (Web Bot Auth). */
881
+ export interface AccountSigningKey {
882
+ /** The JWK thumbprint: the `keyid` of its signatures and the `kid` in the directory. */
883
+ key_id: string;
884
+ /** The public key, base64url (the JWK `x`). */
885
+ public_key: string;
886
+ status: 'active' | 'retiring';
887
+ created_at: string;
888
+ retired_at: string | null;
889
+ publish_until: string | null;
890
+ }
891
+ /** What STACK's public answer to "who is this agent?" shows for an account, and where it is. */
892
+ export interface AccountIdentity {
893
+ account_id: string;
894
+ agent_id: string;
895
+ /** `false`: the answer and the machine files are not found, as for an agent that does not exist. On by default. */
896
+ enabled: boolean;
897
+ /** Whether the agent's name (and the description in its cards) is shown. Off by default. */
898
+ show_name: boolean;
899
+ /** Where outsiders find the answer and the agent's machine files, all on STACK's own domain. */
900
+ urls: {
901
+ lookup: string;
902
+ agent_card: string;
903
+ mcp_server_card: string;
904
+ key_directory: string;
905
+ };
906
+ }
907
+ /** A change to what the public answer shows. At least one field. */
908
+ export interface SetAccountIdentityInput {
909
+ enabled?: boolean;
910
+ show_name?: boolean;
911
+ }
912
+ export type AccountToolRunState = 'dispatching' | 'pending' | 'settled' | 'released';
913
+ /** One paid tool run as STACK records it. */
914
+ export interface AccountToolRunView {
915
+ id: string;
916
+ account_id: string;
917
+ provider: string;
918
+ endpoint: string;
919
+ state: AccountToolRunState;
920
+ price_type: 'PER_CALL' | 'PER_RESULT';
921
+ max_results: number | null;
922
+ reserved_cents: number;
923
+ charged_cents: number | null;
924
+ /** The provider's run status (COMPLETED, RUNNING, STOPPED, ...), once known. */
925
+ status: string | null;
926
+ provider_http_status: number | null;
927
+ result: {
928
+ output: unknown;
929
+ } | null;
930
+ withheld: {
931
+ security_event_id: string | null;
932
+ message: string;
933
+ } | null;
934
+ /** Set when the output matched a prompt-injection pattern while the owner's controls were off: returned with this flag. */
935
+ flag: ContentFlag | null;
936
+ created_at: string;
937
+ settled_at: string | null;
938
+ }
939
+ /** A paid tool run as `run` and `getRun` answer it. */
940
+ export interface AccountToolRun extends AccountToolRunView {
941
+ /** True when what the run returned is web, social or provider content: data, never instructions. */
942
+ untrusted: boolean;
943
+ /** Files the run produced; empty for an endpoint that returns data only. */
944
+ files: ToolRunFile[];
945
+ }
946
+ /** A number on the customer's do-not-contact list: it texted STOP (or another opt-out word), or the customer or one of its agents added it (`source` `customer`). */
947
+ export interface OptOut {
948
+ id: string;
949
+ /** E.164, in full: the owner reads it. */
950
+ number: string;
951
+ texts_blocked: boolean;
952
+ calls_blocked: boolean;
953
+ source: 'text_stop' | 'call_request' | 'customer';
954
+ created_at: string;
955
+ }
956
+ /** A number on the customer's blocked-callers list: an incoming call from it is turned away before it rings. */
957
+ export interface BlockedCaller {
958
+ id: string;
959
+ /** E.164, in full: the owner, an admin or an agent reads it. */
960
+ number: string;
961
+ created_at: string;
962
+ }
963
+ /** The owner's business details for the account's toll-free number. They go to the phone provider; STACK keeps only the verification id and status. */
964
+ export interface TollFreeVerificationInput {
965
+ business_name: string;
966
+ /** https URL. */
967
+ business_website: string;
968
+ business_type: 'PRIVATE_PROFIT' | 'PUBLIC_PROFIT' | 'SOLE_PROPRIETOR' | 'NON_PROFIT' | 'GOVERNMENT';
969
+ /** Required unless `business_type` is SOLE_PROPRIETOR. `authority` is EIN, CBN, CRN, VAT and the like; `country` is ISO 3166 alpha-2. */
970
+ business_registration?: {
971
+ number: string;
972
+ authority: string;
973
+ country: string;
974
+ };
975
+ business_address: {
976
+ street: string;
977
+ street2?: string;
978
+ city: string;
979
+ region: string;
980
+ postal_code: string;
981
+ country: string;
982
+ };
983
+ /** `phone` in E.164. */
984
+ contact: {
985
+ first_name: string;
986
+ last_name: string;
987
+ email: string;
988
+ phone: string;
989
+ };
990
+ /** Where the phone provider sends the review outcome. */
991
+ notification_email: string;
992
+ /** One to five of the phone provider's use-case categories, such as ACCOUNT_NOTIFICATIONS or CUSTOMER_CARE. */
993
+ use_case_categories: string[];
994
+ use_case_summary: string;
995
+ production_message_sample: string;
996
+ opt_in_type: 'VERBAL' | 'WEB_FORM' | 'PAPER_FORM' | 'VIA_TEXT' | 'MOBILE_QR_CODE';
997
+ /** One to five public https pages or images showing how recipients agree to receive texts. */
998
+ opt_in_image_urls: string[];
999
+ /** The phone provider's monthly volume bands: '10', '100', '1,000' up to '10,000,000+'. */
1000
+ message_volume: string;
1001
+ privacy_policy_url: string;
1002
+ terms_and_conditions_url: string;
1003
+ additional_information?: string;
1004
+ }
1005
+ export interface TollFreeVerification {
1006
+ account_id: string;
1007
+ verification_id: string | null;
1008
+ /** The provider's own review status values. */
1009
+ status: 'PENDING_REVIEW' | 'IN_REVIEW' | 'TWILIO_APPROVED' | 'TWILIO_REJECTED' | null;
1010
+ /** The provider's rejection reason, when rejected. */
1011
+ rejection_reason: string | null;
1012
+ sending_allowed: boolean;
1013
+ }
1014
+ /** One of the customer's own mail domains for agent inboxes. */
1015
+ export interface MailDomain {
1016
+ id: string;
1017
+ domain: string;
1018
+ /** The mail provider's state for the domain; `verified` once its DNS records check out. */
1019
+ status: string;
1020
+ /** The DNS records to publish at the domain. */
1021
+ records: Array<Record<string, unknown>>;
1022
+ warnings: Array<Record<string, unknown>>;
1023
+ verified_at: string | null;
1024
+ checked_at: string | null;
1025
+ created_at: string;
1026
+ /** Until when the name is held while unverified; null once verified. */
1027
+ claim_expires_at: string | null;
1028
+ }
1029
+ export interface ConnectMailDomainInput {
1030
+ /** A lower-case DNS name of two labels or more, such as `mail.example.com`. STACK's own mail domains are refused. */
1031
+ domain: string;
1032
+ }
1033
+ /** Operator actions a human approves first when the credential is not a dashboard session. */
1034
+ export interface AccountGovernedOptions {
1035
+ /** The approval id from `GovernanceApprovalRequiredError`, once a human approved it. Send the same input again. */
1036
+ governanceApprovalId?: string;
1037
+ }
1038
+ /**
1039
+ * Calls the account's agent makes run under its Passport's Mission. An agent
1040
+ * signing with its own key (`agent_id`) passes the Passport as `passportToken`,
1041
+ * sent as `X-Passport-Token`; an operator credential omits it.
1042
+ */
1043
+ export interface AccountAgentCallOptions {
1044
+ passportToken?: string;
1045
+ }
1046
+ export declare class AccountMessagesService {
1047
+ private readonly client;
1048
+ constructor(client: HttpClient);
1049
+ /** Inbound mail, SMS, voicemail and call transcripts, newest first. Flagged ones come back withheld with controls on, and with their flag with controls off. */
1050
+ list(accountId: string, query?: ListAccountMessagesQuery, options?: AccountAgentCallOptions): Promise<ListAccountMessagesResult>;
1051
+ get(accountId: string, messageId: string, options?: AccountAgentCallOptions): Promise<AccountMessage>;
1052
+ /**
1053
+ * Search every message the caller may read, across the customer's message accounts and channels, newest first. An
1054
+ * owner or admin reads all of them; an agent reads those of every account of the customer unless the owner limited it
1055
+ * to its own (`stack.messageAccess`). The summary of each message comes back without its body: read one with `get`, and a file
1056
+ * it carries with `readAttachment`. Only a search on `q`, `sender`, `recipient` or `threadId` needs a window of at most 90 days.
1057
+ */
1058
+ search(query?: SearchAccountMessagesQuery, options?: AccountAgentCallOptions): Promise<SearchAccountMessagesResult>;
1059
+ /**
1060
+ * A file a message carries (`content.attachments[].file_id`), read through the message: the same answer as `drive.read`
1061
+ * (UTF-8 text as text, anything else as base64, 256 KiB at most), including for a file that belongs to another agent of
1062
+ * the customer whose messages the caller may read. The content is untrusted.
1063
+ */
1064
+ readAttachment(accountId: string, messageId: string, fileId: string, options?: AccountAgentCallOptions): Promise<DriveFileContent>;
1065
+ /** Owner or admin only. */
1066
+ delete(accountId: string, messageId: string): Promise<void>;
1067
+ }
1068
+ /**
1069
+ * The customer's do-not-contact list: numbers that texted STOP and numbers the customer or an agent added. Texts and calls
1070
+ * to a listed number are refused (`RecipientOptedOutError`). The owner, an admin or an agent's credential may list and add;
1071
+ * only the owner or an admin removes.
1072
+ */
1073
+ export declare class AccountOptOutsService {
1074
+ private readonly client;
1075
+ constructor(client: HttpClient);
1076
+ /** Every number that asked not to be contacted. An agent may read it. */
1077
+ list(): Promise<{
1078
+ opt_outs: OptOut[];
1079
+ }>;
1080
+ /**
1081
+ * Add a number (E.164) to the list, so texts and calls to it are refused. The owner, an admin or the account's agent may add.
1082
+ * A number already listed returns its entry as it is.
1083
+ */
1084
+ add(number: string): Promise<OptOut>;
1085
+ /** Take a number off the list, by the id `list` returned, so texts and calls to it are allowed again. */
1086
+ remove(optOutId: string): Promise<{
1087
+ removed: boolean;
1088
+ }>;
1089
+ }
1090
+ /**
1091
+ * The customer's blocked-callers list: an incoming call from a listed number is turned away before it rings, wakes no
1092
+ * agent, takes no voicemail and costs nothing. The owner, an admin or an agent's credential may list and add; only the
1093
+ * owner or an admin removes.
1094
+ */
1095
+ export declare class AccountBlockedCallersService {
1096
+ private readonly client;
1097
+ constructor(client: HttpClient);
1098
+ /** Every blocked number. An agent may read it. */
1099
+ list(): Promise<{
1100
+ blocked_callers: BlockedCaller[];
1101
+ }>;
1102
+ /**
1103
+ * Block a number (E.164). The owner, an admin or the account's agent may add. A number already listed returns its entry
1104
+ * as it is.
1105
+ */
1106
+ add(number: string): Promise<BlockedCaller>;
1107
+ /** Take a number off the list, by the id `list` returned, so its calls ring again. The owner or an admin. */
1108
+ remove(blockedCallerId: string): Promise<{
1109
+ removed: boolean;
1110
+ }>;
1111
+ }
1112
+ /** The phone provider's toll-free verification for the account's toll-free number, which must be approved before it texts. */
1113
+ export declare class AccountTollFreeVerificationService {
1114
+ private readonly client;
1115
+ constructor(client: HttpClient);
1116
+ /**
1117
+ * Submit the owner's business details. Account admin only, and a governance
1118
+ * action: without a dashboard session this throws
1119
+ * `GovernanceApprovalRequiredError`; retry with the same details and its `approvalId`.
1120
+ */
1121
+ submit(accountId: string, details: TollFreeVerificationInput, options?: AccountGovernedOptions): Promise<TollFreeVerification>;
1122
+ /** The verification's status. Operator only. */
1123
+ get(accountId: string): Promise<TollFreeVerification>;
1124
+ }
1125
+ export declare class AccountCallsService {
1126
+ private readonly client;
1127
+ constructor(client: HttpClient);
1128
+ /**
1129
+ * Place a live call from the account's number to any country Twilio can reach, at cost. Any agent of the customer may
1130
+ * place it under its own Passport. Without `brief` the agent holds the call: STACK runs no model and says nothing, the
1131
+ * call opens with `greeting` or with silence, and this returns once the call is answered (with what the other side
1132
+ * first says, waiting up to `wait_seconds`) or ends unanswered. With `on_behalf_of` and `brief` STACK's model holds the
1133
+ * call and this returns at once. One action; the minutes (and a held call's model turns) are charged to the account's
1134
+ * budget. A number on the do-not-contact list is refused (`RecipientOptedOutError`), as is one Twilio has no price for
1135
+ * or does not allow (`DestinationNotAvailableError`).
1136
+ */
1137
+ place(accountId: string, input: StartAccountCallInput, options?: AccountAgentCallOptions): Promise<AccountCallTurn>;
1138
+ /**
1139
+ * Answer a call that is ringing on the account's number, held either way as for `place`. A call rings for 30 seconds,
1140
+ * then goes to voicemail; `answer_by` on the call says when, and a wake for the source `incoming_call` carries the call
1141
+ * id. One action, put to your decider as `call.answer`. A call that is not ringing any more answers 409
1142
+ * `CALL_NOT_RINGING` and is not counted.
1143
+ */
1144
+ answer(accountId: string, callId: string, input: AnswerAccountCallInput, options?: AccountAgentCallOptions): Promise<AccountCallTurn>;
1145
+ /**
1146
+ * Decline a call that is ringing on the account's number: the call is
1147
+ * hung up with nothing said. Not an action on the meter.
1148
+ * A call that is not ringing any more answers 409 `CALL_NOT_RINGING`.
1149
+ */
1150
+ decline(accountId: string, callId: string, options?: AccountAgentCallOptions): Promise<AccountCall>;
1151
+ /**
1152
+ * Speak on a call the agent holds: `text` is spoken as it is (none: only waits), then this waits up to `wait_seconds`
1153
+ * (0 to 60, default 30) for the other side's next finished sentence. Returns every event since your last call action.
1154
+ * Not metered. A call STACK holds is 409 `CALL_HELD_BY_STACK`; one not on the line 409 `CALL_NOT_LIVE`.
1155
+ */
1156
+ say(accountId: string, callId: string, input?: {
1157
+ text?: string;
1158
+ wait_seconds?: number;
1159
+ }, options?: AccountAgentCallOptions): Promise<AccountCallTurn>;
1160
+ /** Send keys to the other side as tones: 0-9, `*`, `#`, and `w` for a pause. */
1161
+ pressKeys(accountId: string, callId: string, digits: string, options?: AccountAgentCallOptions): Promise<AccountCallTurn>;
1162
+ /** A new voice or language for the rest of a call the agent holds. */
1163
+ setCallVoice(accountId: string, callId: string, voice: AccountCallVoice, options?: AccountAgentCallOptions): Promise<AccountCallTurn>;
1164
+ /** Hang up a call, whoever holds it. STACK says nothing. The transcript is stored and the account's agent woken. */
1165
+ hangUp(accountId: string, callId: string, options?: AccountAgentCallOptions): Promise<AccountCallTurn>;
1166
+ /**
1167
+ * The live stream of a call (a WebSocket): every event of the call as it happens, and the agent's words streamed on to
1168
+ * the call as they come (`text(token, last)`). The socket closes once the call has ended. In Node the global
1169
+ * `WebSocket` (Node 22 or later) is used, with the client's credential in the `Authorization` header; pass
1170
+ * `webSocket` to use another implementation that takes headers the same way.
1171
+ */
1172
+ live(accountId: string, callId: string, options?: AccountAgentCallOptions & {
1173
+ webSocket?: AccountCallWebSocketConstructor;
1174
+ }): Promise<AccountCallStream>;
1175
+ /** The account's calls, newest first. */
1176
+ list(accountId: string, query?: ListAccountCallsQuery, options?: AccountAgentCallOptions): Promise<ListAccountCallsResult>;
1177
+ /** One call: its live transcript while it is on the line, then its stored transcript and outcome. */
1178
+ get(accountId: string, callId: string, options?: AccountAgentCallOptions): Promise<AccountCallWithTranscript>;
1179
+ /** The account's call voice and voicemail greeting. The owner, an admin or the account's own agent. */
1180
+ getAccountVoice(accountId: string, options?: AccountAgentCallOptions): Promise<AccountCallVoiceSetting>;
1181
+ /** Set the account's call voice and voicemail greeting; a field left out is cleared. Not metered, no approval. */
1182
+ setAccountVoice(accountId: string, input: AccountCallVoice & {
1183
+ voicemail_greeting?: string;
1184
+ }, options?: AccountAgentCallOptions): Promise<AccountCallVoiceSetting>;
1185
+ }
1186
+ /** A WebSocket as the live stream uses it: the WHATWG shape, with headers given when it is made (Node's undici WebSocket). */
1187
+ export interface AccountCallWebSocket {
1188
+ readonly readyState: number;
1189
+ send(data: string): void;
1190
+ close(code?: number, reason?: string): void;
1191
+ addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (event: {
1192
+ data?: unknown;
1193
+ }) => void): void;
1194
+ }
1195
+ export type AccountCallWebSocketConstructor = new (url: string, init: {
1196
+ headers: Record<string, string>;
1197
+ }) => AccountCallWebSocket;
1198
+ /**
1199
+ * A call's live stream. `events()` yields every event of the call in order, ending after `ended`; `errors` are the
1200
+ * messages the stream could not use. Send with `text`, `pressKeys`, `setVoice` and `hangUp`.
1201
+ */
1202
+ export declare class AccountCallStream {
1203
+ private readonly socket;
1204
+ private readonly queue;
1205
+ private waiting;
1206
+ private done;
1207
+ private readonly opened;
1208
+ readonly errors: {
1209
+ code: string;
1210
+ message: string;
1211
+ }[];
1212
+ constructor(socket: AccountCallWebSocket);
1213
+ private wake;
1214
+ /** Every event of the call, oldest first from the start of the call, until it ends. */
1215
+ events(): AsyncGenerator<AccountCallLiveEvent>;
1216
+ private send;
1217
+ /** Words to speak, streamed as they come; `last` on the final token of what the agent says. */
1218
+ text(token: string, last?: boolean): Promise<void>;
1219
+ pressKeys(digits: string): Promise<void>;
1220
+ setVoice(voice: AccountCallVoice): Promise<void>;
1221
+ hangUp(): Promise<void>;
1222
+ close(): void;
1223
+ }
1224
+ /**
1225
+ * Paid tools: data endpoints of a paid-tools provider, used by the account's agent
1226
+ * under its Passport. Discover and inspect are free; a run holds the worst
1227
+ * case first and is charged at the provider's cost from the account's credit.
1228
+ */
1229
+ export declare class AccountToolsService {
1230
+ private readonly client;
1231
+ constructor(client: HttpClient);
1232
+ discover(accountId: string, input: {
1233
+ query: string;
1234
+ limit?: number;
1235
+ }, options: AccountAgentCallOptions): Promise<AccountToolDiscovery>;
1236
+ /** The endpoint's input schema and price. */
1237
+ inspect(accountId: string, input: {
1238
+ provider: string;
1239
+ endpoint: string;
1240
+ }, options: AccountAgentCallOptions): Promise<AccountToolInspection>;
1241
+ /**
1242
+ * Run any endpoint the tool provider lists (the catalogue lists them as tools),
1243
+ * charged what the provider reports for the run, with no STACK fee. Its worst
1244
+ * case is held first, or an estimate where the price and the input do not bound
1245
+ * it (`price_type` `ESTIMATED`); a cost above the hold is taken from the
1246
+ * account's credit at once; `max_cost_cents` lowers the hold. A run whose
1247
+ * `max_results` is outside 1 to 1000 is refused with `TOOL_PRICE_REFUSED`;
1248
+ * nothing is held then.
1249
+ * A run whose charge is not yet settled comes back `pending`; read it with `getRun`. */
1250
+ run(accountId: string, input: AccountToolRunInput, options: AccountAgentCallOptions): Promise<AccountToolRun>;
1251
+ getRun(accountId: string, runId: string, options?: AccountAgentCallOptions): Promise<AccountToolRun>;
1252
+ }
1253
+ /**
1254
+ * The keys an account signs its outbound requests with, so that a site that
1255
+ * checks for AI agents can tell whose they are (Web Bot Auth). STACK signs the
1256
+ * requests its proxy and cloud browser make for the account's agent, and
1257
+ * publishes the public keys at `/.well-known/http-message-signatures-directory`
1258
+ * (and, for this account alone, under its agent's id: see `accounts.identity`).
1259
+ */
1260
+ export declare class AccountSigningKeysService {
1261
+ private readonly client;
1262
+ constructor(client: HttpClient);
1263
+ /** The key in use and any retired one still published. */
1264
+ list(accountId: string): Promise<{
1265
+ keys: AccountSigningKey[];
1266
+ }>;
1267
+ /** A new key signs from now on; the old one stays published for two days. Owner or admin only, never the agent. */
1268
+ rotate(accountId: string): Promise<{
1269
+ keys: AccountSigningKey[];
1270
+ }>;
1271
+ }
1272
+ /**
1273
+ * What STACK's public answer to "who is this agent?" shows for an account (the lookup is
1274
+ * `stack.agentIdentity`). Two switches, both the owner's, never the agent's: `enabled` (on by
1275
+ * default) and `show_name` (off by default). Changing one is a row of the account's signed record.
1276
+ */
1277
+ export declare class AccountIdentityService {
1278
+ private readonly client;
1279
+ constructor(client: HttpClient);
1280
+ get(accountId: string): Promise<AccountIdentity>;
1281
+ /** Show or hide the agent's name, or switch the answer off or on. Owner or admin only, never an agent. */
1282
+ update(accountId: string, input: SetAccountIdentityInput): Promise<AccountIdentity>;
1283
+ }
1284
+ /**
1285
+ * The account's workspace: a machine of its own with a shell and git, with its own internet access, that keeps its
1286
+ * files between commands. The agent's calls run under its Passport. The account id of every call is the account that
1287
+ * owns the workspace: another agent of the same customer may run commands and read and write files in it while the
1288
+ * customer shares it with their agents (the default), under its own Passport and Mission, as its own action; only
1289
+ * the machine's time is charged to the owning account. Only the owning account's agent makes a workspace or stops one
1290
+ * (the owner may stop it too); listing is open to any principal of the operator. Machine time is held before it
1291
+ * starts and charged to the owning account's credit.
1292
+ */
1293
+ export declare class AccountWorkspaceService {
1294
+ private readonly client;
1295
+ constructor(client: HttpClient);
1296
+ private base;
1297
+ /** Run a command; without `workspace_id` a new workspace is made. What it prints is untrusted. */
1298
+ exec(accountId: string, input: WorkspaceExecInput & {
1299
+ background?: false;
1300
+ }, options?: AccountAgentCallOptions): Promise<WorkspaceExecResult>;
1301
+ /** Start a command in the background: the answer has its `command_id`; read it with `command`. */
1302
+ exec(accountId: string, input: WorkspaceExecInput & {
1303
+ background: true;
1304
+ }, options?: AccountAgentCallOptions): Promise<WorkspaceBackgroundStarted>;
1305
+ /** A command started in the background: whether it has ended, its exit code, and what it has printed so far. The workspace must be running. */
1306
+ command(accountId: string, workspaceId: string, commandId: string, options?: AccountAgentCallOptions): Promise<WorkspaceCommand>;
1307
+ readFile(accountId: string, workspaceId: string, input: WorkspaceReadFileInput, options?: AccountAgentCallOptions): Promise<WorkspaceFile>;
1308
+ writeFile(accountId: string, workspaceId: string, input: WorkspaceWriteFileInput, options?: AccountAgentCallOptions): Promise<WorkspaceFileWritten>;
1309
+ /** Save a file of the workspace to the account's drive. */
1310
+ saveFile(accountId: string, workspaceId: string, input: WorkspaceSaveFileInput, options?: AccountAgentCallOptions): Promise<WorkspaceFileSaved>;
1311
+ /**
1312
+ * The workspaces that still exist and the caller may use. With an account, that account's: an agent sees all of its
1313
+ * own account's and, of another agent's, only those shared with it. Without one, every workspace the caller may use
1314
+ * across the customer's accounts (the owner sees all). Each says whose it is and whether it is shared.
1315
+ */
1316
+ list(accountId?: string): Promise<WorkspaceListItem[]>;
1317
+ /**
1318
+ * Whether the customer's other agents may use one workspace (`shared` true, the default for every workspace) or only
1319
+ * the agent that owns it (false: every other agent then finds no such workspace). Owner or admin only; an agent
1320
+ * cannot change it. Never metered; a change is one audit row.
1321
+ */
1322
+ setSharing(accountId: string, workspaceId: string, shared: boolean): Promise<WorkspaceSharingResult>;
1323
+ /** Pause a workspace, or with `delete` delete it and its files. The owning account's agent and the owner only. */
1324
+ stop(accountId: string, workspaceId: string, input?: WorkspaceStopInput): Promise<WorkspaceStopped>;
1325
+ /**
1326
+ * The idle pause, the days a stopped workspace is kept and the number of workspaces, with what is in force: for one
1327
+ * agent account (its own over the customer's default), or without an account the customer's default. Owner or admin
1328
+ * only; an agent cannot read or change its own.
1329
+ */
1330
+ getSettings(accountId?: string): Promise<WorkspaceSettingsResult>;
1331
+ /** Change them, for one agent account or (without an account) the customer's default. Running workspaces take a new idle pause now. */
1332
+ setSettings(input: WorkspaceSettingsInput, accountId?: string): Promise<WorkspaceSettingsResult>;
1333
+ }
1334
+ export declare class AccountBrowserService {
1335
+ private readonly client;
1336
+ constructor(client: HttpClient);
1337
+ private session;
1338
+ /** Start a session. `maxMinutes` (1 to 360, 30 when left out) is how long it may run; the credit held is sized to it. */
1339
+ startSession(accountId: string, options?: AccountAgentCallOptions & {
1340
+ maxMinutes?: number;
1341
+ }): Promise<BrowserSession>;
1342
+ navigate(accountId: string, sessionId: string, input: {
1343
+ url: string;
1344
+ }, options?: AccountAgentCallOptions): Promise<{
1345
+ url: string;
1346
+ title: string;
1347
+ status: number | null;
1348
+ }>;
1349
+ act(accountId: string, sessionId: string, input: BrowserAction, options?: AccountAgentCallOptions): Promise<{
1350
+ done: true;
1351
+ value_recorded?: boolean;
1352
+ url: string;
1353
+ }>;
1354
+ /** The page's main text and accessibility snapshot, scanned first; a page aimed at an agent comes back withheld with controls on, and with its flag with controls off. */
1355
+ read(accountId: string, sessionId: string, options?: AccountAgentCallOptions): Promise<BrowserReading>;
1356
+ screenshot(accountId: string, sessionId: string, options?: AccountAgentCallOptions): Promise<{
1357
+ url: string;
1358
+ mime: 'image/jpeg';
1359
+ base64: string;
1360
+ }>;
1361
+ endSession(accountId: string, sessionId: string): Promise<{
1362
+ session_id: string;
1363
+ state: string;
1364
+ charged_cents: number | null;
1365
+ }>;
1366
+ /** Reserve the budget and start a card payment the customer approves on their own device. */
1367
+ checkout(accountId: string, sessionId: string, input: BrowserCheckoutInput, options?: AccountAgentCallOptions): Promise<BrowserCheckout>;
1368
+ }
1369
+ export declare class AccountPurchasesService {
1370
+ private readonly client;
1371
+ constructor(client: HttpClient);
1372
+ get(accountId: string, purchaseId: string): Promise<CardPurchase>;
1373
+ /** What the merchant's page showed after the customer approved. It never moves money. */
1374
+ reportMerchantResult(accountId: string, purchaseId: string, input: PurchaseMerchantResult, options?: AccountAgentCallOptions): Promise<CardPurchase>;
1375
+ }
1376
+ /** A wallet's caps as strings of USDC, `null` for none. */
1377
+ export interface WalletCaps {
1378
+ per_payment_cap_usdc: string | null;
1379
+ daily_cap_usdc: string | null;
1380
+ signer_policy: {
1381
+ per_payment_cap_usdc: string | null;
1382
+ covers_caps: boolean;
1383
+ };
1384
+ }
1385
+ export declare class AccountWalletService {
1386
+ private readonly client;
1387
+ constructor(client: HttpClient);
1388
+ /**
1389
+ * Pay from the account's wallet with a payment the agent signed with its own
1390
+ * wallet key (`signWalletPayment`). STACK checks the budget, the caps and the
1391
+ * customer's controls, then passes the request to the wallet provider
1392
+ * unchanged, or refuses it (and a refused payment is never sent). STACK holds
1393
+ * no key to the wallet. The agent's Passport is required.
1394
+ */
1395
+ pay(accountId: string, input: WalletPaymentInput, options?: AccountAgentCallOptions): Promise<WalletPayment>;
1396
+ /**
1397
+ * Buy from an x402 seller in one step: ask `url`, and when the seller answers 402, make the payment it asks for,
1398
+ * sign it with the agent's own wallet `key` (here, never sent anywhere), pay through STACK (the same checks as
1399
+ * `pay`) and ask again with the payment attached. The seller's answer is what was bought. An answer that is not
1400
+ * a 402 comes back unpaid. Only USDC on Base with x402's `exact` scheme can be paid (x402 versions 1 and 2); any
1401
+ * other ask, a price over `maxCents` or a URL that is not https is refused with `X402PaymentError` before STACK is
1402
+ * asked. The agent's Passport is required.
1403
+ */
1404
+ payUrl(accountId: string, url: string, options: PayX402Options & AccountAgentCallOptions & {
1405
+ fetch?: typeof fetch;
1406
+ }): Promise<X402Result>;
1407
+ /**
1408
+ * Set or change a wallet's caps after it is open (owner or admin, needs controls; an agent context is refused). A cap left
1409
+ * out is not changed and `null` removes it. `signer_policy` says what the wallet provider's own rule, fixed when the wallet
1410
+ * opened, still holds per payment.
1411
+ */
1412
+ setCaps(accountId: string, caps: {
1413
+ per_payment_cap_usdc?: number | null;
1414
+ daily_cap_usdc?: number | null;
1415
+ }): Promise<WalletCaps>;
1416
+ /** Whether the customer has become the owner of their agents' wallets (done at the STACK console). */
1417
+ ownerStatus(): Promise<{
1418
+ owner_set: boolean;
1419
+ }>;
1420
+ }
1421
+ /**
1422
+ * The customer's own mail domains for agent inboxes. An account opened with
1423
+ * `inbox: { domain }` gets its inbox there once the domain is verified.
1424
+ * Operator only; an agent context is refused. There is no remove call: an
1425
+ * unverified claim lapses on its own (`claim_expires_at`).
1426
+ */
1427
+ export declare class AccountMailDomainsService {
1428
+ private readonly client;
1429
+ constructor(client: HttpClient);
1430
+ /** Every connected domain, with its records and status. */
1431
+ list(): Promise<{
1432
+ domains: MailDomain[];
1433
+ }>;
1434
+ /**
1435
+ * Connect a domain and get the DNS records to publish. Needs the platform
1436
+ * subscription (`PLATFORM_SUBSCRIPTION_REQUIRED` otherwise) and an owner or
1437
+ * admin. Connecting the same name again returns the same domain; a name
1438
+ * another customer holds is a 409.
1439
+ */
1440
+ connect(input: ConnectMailDomainInput): Promise<MailDomain>;
1441
+ /** Ask the mail provider to check the domain's DNS records now. Owner or admin. */
1442
+ verify(domainId: string): Promise<MailDomain>;
1443
+ }
1444
+ /**
1445
+ * An agent's own Telegram bot: its identity on Telegram. `start` returns a link
1446
+ * the owner opens in Telegram to have STACK's manager bot make the bot (no
1447
+ * BotFather, no pasted token); or you make the bot with BotFather and give
1448
+ * STACK its token once with `connect`. People write to it, what they write
1449
+ * arrives with the account's other messages (`messages.list({ channel:
1450
+ * 'telegram' })`, scanned like mail and texts), and the agent answers with
1451
+ * `accounts.sendTelegram`. A bot cannot message a chat first.
1452
+ *
1453
+ * Operator only: an agent context is refused. The token is sent once, to STACK's
1454
+ * own route, and never returned; no OAuth token may connect a bot (the secret
1455
+ * would pass through a chat), so use an API key or the console.
1456
+ */
1457
+ export declare class AccountTelegramService {
1458
+ private readonly client;
1459
+ constructor(client: HttpClient);
1460
+ /**
1461
+ * Ask for the agent's bot to be made through STACK's Telegram manager bot. Returns `create_url`, which the
1462
+ * owner opens in Telegram and confirms: nothing is created until then, and STACK reads the new bot's token
1463
+ * itself. The link is single-use and lasts 10 minutes. Throws `NOT_CONFIGURED` when the deployment has no
1464
+ * manager bot: use `connect` then.
1465
+ */
1466
+ start(accountId: string, input?: {
1467
+ suggested_name?: string;
1468
+ }): Promise<ManagedTelegramBotRequest>;
1469
+ /** Give the agent its bot. `botToken` is the token BotFather gave you. */
1470
+ connect(accountId: string, botToken: string): Promise<TelegramBot>;
1471
+ /** The agent's bot. Throws a 404 `NOT_FOUND` when it has none. */
1472
+ get(accountId: string): Promise<TelegramBot>;
1473
+ /** The chats that have written to the bot, which the agent may answer. */
1474
+ chats(accountId: string): Promise<{
1475
+ chats: TelegramChat[];
1476
+ }>;
1477
+ /** Take the bot away: STACK removes its webhook and stops receiving. */
1478
+ disconnect(accountId: string): Promise<void>;
1479
+ }
1480
+ export declare class AccountsService {
1481
+ private readonly client;
1482
+ readonly telegram: AccountTelegramService;
1483
+ readonly messages: AccountMessagesService;
1484
+ readonly optOuts: AccountOptOutsService;
1485
+ readonly blockedCallers: AccountBlockedCallersService;
1486
+ readonly tollFreeVerification: AccountTollFreeVerificationService;
1487
+ readonly calls: AccountCallsService;
1488
+ readonly tools: AccountToolsService;
1489
+ readonly workspace: AccountWorkspaceService;
1490
+ readonly browser: AccountBrowserService;
1491
+ readonly purchases: AccountPurchasesService;
1492
+ readonly wallet: AccountWalletService;
1493
+ readonly mailDomains: AccountMailDomainsService;
1494
+ readonly signingKeys: AccountSigningKeysService;
1495
+ readonly identity: AccountIdentityService;
1496
+ /** Making: designs, quotes and orders with manufacturing and print-on-demand suppliers. */
1497
+ readonly making: MakingService;
1498
+ constructor(client: HttpClient);
1499
+ /**
1500
+ * Open an agent account. 201 when created, 200 when the same key already
1501
+ * opened it. Without a dashboard session this throws
1502
+ * `GovernanceApprovalRequiredError` first; retry with its `approvalId`.
1503
+ */
1504
+ open(input: OpenAgentAccountInput, options: OpenAgentAccountOptions): Promise<AgentAccount>;
1505
+ get(accountId: string): Promise<AgentAccount>;
1506
+ list(query?: {
1507
+ limit?: number;
1508
+ }): Promise<AgentAccount[]>;
1509
+ /**
1510
+ * Set, change or remove (`null`) the account's monthly spend budget, USD cents, a positive whole number. Owner or
1511
+ * admin only, never metered. Lowering applies at once. Raising or removing is a governance action: without a
1512
+ * dashboard session this throws `GovernanceApprovalRequiredError` first; once the owner approves at its link, send
1513
+ * the same call again with `governanceApprovalId`. Setting or raising needs controls (`CONTROLS_REQUIRED` otherwise).
1514
+ */
1515
+ setBudget(accountId: string, monthlyBudgetCents: number | null, options?: AccountGovernedOptions): Promise<AgentAccount>;
1516
+ /** Refuse the agent at once and close every piece at its provider. No approval needed. */
1517
+ close(accountId: string): Promise<AgentAccount>;
1518
+ /**
1519
+ * Send an email to one or several people, with copies and attachments. The mail provider takes one To address, so
1520
+ * further `to` addresses are delivered as Cc. Attach a drive file by `file_id` or a small file inline as base64.
1521
+ */
1522
+ sendEmail(accountId: string, input: SendAccountEmailInput, options?: AccountAgentCallOptions): Promise<AccountEmailSent>;
1523
+ /**
1524
+ * Answer an email the account received (`messageId` is its message id), in its thread, quoting that message unless
1525
+ * `include_quote` is `false`. `reply_all` also reaches everyone it was sent to. A message that cannot be answered throws `EmailMessageNotAnswerableError`.
1526
+ */
1527
+ replyEmail(accountId: string, messageId: string, input: ReplyAccountEmailInput, options?: AccountAgentCallOptions): Promise<AccountEmailSent>;
1528
+ /**
1529
+ * Send an email the account received on to others, as a new email in no thread, with its text unless `include_quote`
1530
+ * is `false` and, unless `include_attachments` is `false`, the attachments that were kept.
1531
+ */
1532
+ forwardEmail(accountId: string, messageId: string, input: ForwardAccountEmailInput, options?: AccountAgentCallOptions): Promise<AccountEmailSent>;
1533
+ sendSms(accountId: string, input: SendAccountSmsInput, options?: AccountAgentCallOptions): Promise<AccountMessageSent>;
1534
+ /**
1535
+ * Answer a chat on the agent's own Telegram bot. The chat must have written
1536
+ * to the bot first (`TelegramSendRefusedError` with reason `chat_unknown`
1537
+ * otherwise); the same admission, controls and data-flow rule as a text. Only the account's own agent (or the owner) sends from its bot.
1538
+ */
1539
+ sendTelegram(accountId: string, input: SendAccountTelegramInput, options?: AccountAgentCallOptions): Promise<AccountMessageSent>;
1540
+ /**
1541
+ * Lift a pause on the inbox or phone. Owner or admin only; it applies at
1542
+ * once and asks no one.
1543
+ */
1544
+ resumePiece(accountId: string, piece: 'inbox' | 'phone'): Promise<{
1545
+ state: string;
1546
+ }>;
1547
+ }
1548
+ //# sourceMappingURL=accounts.d.ts.map