@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,135 @@
1
+ const seg = encodeURIComponent;
2
+ function passport(options) {
3
+ return options?.passportToken ? { headers: { 'X-Passport-Token': options.passportToken } } : undefined;
4
+ }
5
+ /** The account's agent builds the site; the owner's credential alone is refused, so refuse before sending. */
6
+ function agentPassport(options) {
7
+ if (!options?.passportToken) {
8
+ throw new TypeError("passportToken is required: the account's agent does this, under its Passport");
9
+ }
10
+ return { headers: { 'X-Passport-Token': options.passportToken } };
11
+ }
12
+ function toBase64(bytes) {
13
+ if (typeof Buffer !== 'undefined')
14
+ return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString('base64');
15
+ let binary = '';
16
+ for (let i = 0; i < bytes.length; i += 0x8000)
17
+ binary += String.fromCharCode(...bytes.subarray(i, i + 0x8000));
18
+ return btoa(binary);
19
+ }
20
+ /** The text of `bytes` when it is valid UTF-8 with no NUL, else null. Encoding the text again gives back the same bytes. */
21
+ function utf8Text(bytes) {
22
+ if (bytes.includes(0))
23
+ return null;
24
+ try {
25
+ return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes);
26
+ }
27
+ catch {
28
+ return null;
29
+ }
30
+ }
31
+ /**
32
+ * Build the `files` of a publish from files you hold. A string is sent as
33
+ * `content`; bytes are sent as `content`, too, when they are UTF-8 text, and
34
+ * as `content_base64` otherwise. Throws when the list is empty or a path repeats; the
35
+ * API checks the rest (a site has no limit on its number of files).
36
+ */
37
+ export function siteFiles(entries) {
38
+ if (entries.length === 0)
39
+ throw new RangeError('a site needs at least one file');
40
+ const seen = new Set();
41
+ return entries.map((entry) => {
42
+ if (seen.has(entry.path))
43
+ throw new RangeError(`the path ${entry.path} is in the bundle twice`);
44
+ seen.add(entry.path);
45
+ if (typeof entry.content === 'string')
46
+ return { path: entry.path, content: entry.content };
47
+ const text = utf8Text(entry.content);
48
+ return text !== null
49
+ ? { path: entry.path, content: text }
50
+ : { path: entry.path, content_base64: toBase64(entry.content) };
51
+ });
52
+ }
53
+ export class WebsiteService {
54
+ client;
55
+ constructor(client) {
56
+ this.client = client;
57
+ }
58
+ /** The account's site, with its addresses, live deploy, prices and limits. The empty site is created on the first read. */
59
+ async get(accountId, options) {
60
+ return this.client.get(`/v1/accounts/${seg(accountId)}/website`, undefined, passport(options));
61
+ }
62
+ /**
63
+ * Publish a bundle: it becomes the live site once the scan passes. One
64
+ * metered action, and a decision for the customer's controls. Throws
65
+ * `WebsitePublishRejectedError` (with the findings), `WebsiteLimitExceededError`
66
+ * or `WebsiteSuspendedError`. The same bundle again returns the live deploy.
67
+ */
68
+ async publish(accountId, input, options) {
69
+ return this.client.post(`/v1/accounts/${seg(accountId)}/website/deploys`, input, agentPassport(options));
70
+ }
71
+ /** The recent deploys, newest first. */
72
+ async listDeploys(accountId, query = {}, options) {
73
+ return this.client.get(`/v1/accounts/${seg(accountId)}/website/deploys`, { limit: query.limit !== undefined ? String(query.limit) : undefined }, passport(options));
74
+ }
75
+ async getDeploy(accountId, deployId, options) {
76
+ return this.client.get(`/v1/accounts/${seg(accountId)}/website/deploys/${seg(deployId)}`, undefined, passport(options));
77
+ }
78
+ /**
79
+ * Add the customer's own domain. It starts `pending`; `dns` lists what the
80
+ * customer sets at their DNS provider, and `checkHostname` moves it to
81
+ * `active` once it resolves. A pending name nobody verifies for 7 days is
82
+ * released.
83
+ */
84
+ async addHostname(accountId, input, options) {
85
+ return this.client.post(`/v1/accounts/${seg(accountId)}/website/hostnames`, input, agentPassport(options));
86
+ }
87
+ async listHostnames(accountId, options) {
88
+ return this.client.get(`/v1/accounts/${seg(accountId)}/website/hostnames`, undefined, passport(options));
89
+ }
90
+ /** Check the domain's DNS and certificate now. The owner or the agent. */
91
+ async checkHostname(accountId, hostnameId, options) {
92
+ return this.client.post(`/v1/accounts/${seg(accountId)}/website/hostnames/${seg(hostnameId)}/check`, undefined, passport(options));
93
+ }
94
+ /** Stop serving the site on a domain and release the name. */
95
+ async removeHostname(accountId, hostnameId, options) {
96
+ await this.client.delete(`/v1/accounts/${seg(accountId)}/website/hostnames/${seg(hostnameId)}`, agentPassport(options));
97
+ }
98
+ /**
99
+ * Set the paths that cost USDC to read. The list replaces the set. A visitor
100
+ * pays the agent's own wallet before the page is served; with no wallet or
101
+ * no payment service the price path answers 503 and never serves free.
102
+ */
103
+ async setPrices(accountId, input, options) {
104
+ return this.client.put(`/v1/accounts/${seg(accountId)}/website/prices`, input, agentPassport(options));
105
+ }
106
+ async getPrices(accountId, options) {
107
+ return this.client.get(`/v1/accounts/${seg(accountId)}/website/prices`, undefined, passport(options));
108
+ }
109
+ /** Take the site offline now. Owner or admin only; an agent is refused. `reason` is 3 to 500 characters. */
110
+ async suspend(accountId, reason) {
111
+ return this.client.post(`/v1/accounts/${seg(accountId)}/website/suspension`, { reason });
112
+ }
113
+ /** Bring the site back after your own suspension. A suspension by STACK is not lifted this way. */
114
+ async resume(accountId) {
115
+ return this.client.delete(`/v1/accounts/${seg(accountId)}/website/suspension`);
116
+ }
117
+ /** Suspend every site of your account at once. Returns how many were suspended. */
118
+ async suspendAll(reason) {
119
+ return this.client.post('/v1/websites/suspend-all', { reason });
120
+ }
121
+ /**
122
+ * Report a page on a STACK-hosted site. Anyone may: it needs no account and
123
+ * sends no credential. The answer is the same whether or not the address is
124
+ * one STACK hosts. `description` is 10 to 2000 characters.
125
+ */
126
+ async report(url, category, description, reporterEmail) {
127
+ return this.client.postPublic('/v1/public/site-reports', {
128
+ url,
129
+ category,
130
+ description,
131
+ ...(reporterEmail !== undefined ? { reporter_email: reporterEmail } : {}),
132
+ });
133
+ }
134
+ }
135
+ //# sourceMappingURL=website.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"website.js","sourceRoot":"","sources":["../../src/services/website.ts"],"names":[],"mappings":"AAuIA,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAE/B,SAAS,QAAQ,CAAC,OAAiC;IACjD,OAAO,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAAE,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACzG,CAAC;AAED,8GAA8G;AAC9G,SAAS,aAAa,CAAC,OAA4C;IACjE,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CAAC,8EAA8E,CAAC,CAAC;IACtG,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAAE,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;AACpE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAiB;IACjC,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3H,IAAI,MAAM,GA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Aa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1E,CAAC,CAAC;IACL,CAAC;CACF"}
package/dist/types.d.ts CHANGED
@@ -3,8 +3,9 @@
3
3
  * at the STACK proxy boundary; `direct` allows `credentials.get`. */
4
4
  export type CredentialAccess = 'direct' | 'proxy_preferred' | 'proxy_only';
5
5
  /** How strictly the agent is monitored. `enforced` gates every call on an
6
- * approved intent; `logged` records but does not gate; `standard` is no
7
- * accountability. */
6
+ * approved intent; `logged` (the default for a new agent) records but does
7
+ * not gate; `standard` is no accountability. A new agent starts `logged`;
8
+ * strict modes are the owner's choice. */
8
9
  export type AccountabilityMode = 'enforced' | 'logged' | 'standard';
9
10
  /** Signing-key model. `stack_managed` (default) auto-provisions the
10
11
  * keypair on first sign — no enrollment. `customer_managed` = BYO keypair
@@ -30,8 +31,8 @@ export interface Agent {
30
31
  * credential. `customer_managed` = an on-box agent keypair (enrolled),
31
32
  * the strongest "no operator credential on the box" posture. */
32
33
  key_mode: AgentKeyMode;
33
- /** Whether STACK prepends its security context to every `/v1/llm/*`
34
- * gateway call this agent makes. Defaults to `true` (fail-closed). */
34
+ /** Has no effect: STACK adds no system prompt to any `/v1/llm/*` gateway
35
+ * call. Accepted and ignored; kept so existing clients keep working. */
35
36
  llm_inject_system_prompt: boolean;
36
37
  /** Whether STACK scans user-role message content and redacts PII before
37
38
  * forwarding `/v1/llm/*` gateway calls to the provider. Defaults to
@@ -50,14 +51,63 @@ export interface RegisterAgentInput {
50
51
  accountability_mode?: AccountabilityMode;
51
52
  credential_access?: CredentialAccess;
52
53
  key_mode?: AgentKeyMode;
53
- /** Prepend the STACK security context to every `/v1/llm/*` gateway call.
54
- * Defaults to `true` (fail-closed) when omitted. */
54
+ /** Has no effect: accepted and ignored. STACK adds no system prompt to
55
+ * `/v1/llm/*` gateway calls. */
55
56
  llm_inject_system_prompt?: boolean;
56
57
  /** Redact PII from user-role message content before forwarding `/v1/llm/*`
57
58
  * gateway calls. Defaults to `true` (fail-closed) when omitted; `false`
58
59
  * means user PII flows to the LLM provider unredacted — an explicit
59
60
  * operator decision. */
60
61
  llm_redact_pii?: boolean;
62
+ /** Mark the agent as test or benchmark traffic. Detection stays on and events stay visible, but warnings arrive
63
+ * already resolved with no notification; criticals stay live. Set here it rides inside the registration approval. */
64
+ eval_traffic?: boolean;
65
+ }
66
+ /**
67
+ * One rule of a grant. A call is allowed when it meets the rule's intents and constraints together; a grant that lists
68
+ * several rules allows a call that meets any one of them (a read rule and, beside it, a post rule that names its channel).
69
+ */
70
+ export interface GrantAccessRule {
71
+ intents?: unknown[];
72
+ constraints?: unknown[];
73
+ }
74
+ /** A first grant in an agent setup: the `grant` input without the agent, which the setup is about to make. */
75
+ export interface AgentSetupGrant {
76
+ service_connection_id: string;
77
+ scopes: string[];
78
+ /** Limits every call must meet, whichever rule allows it. */
79
+ constraints?: unknown[];
80
+ intents?: unknown[];
81
+ /** Rules that each allow their own calls: a call must meet at least one. */
82
+ alternatives?: GrantAccessRule[];
83
+ allow_data_from?: string[];
84
+ }
85
+ /** The hosts one existing connection's credential may be sent to. */
86
+ export interface AgentSetupHosts {
87
+ service_connection_id: string;
88
+ allowed_hosts: string[];
89
+ }
90
+ /** Registration, first grants and credential hosts, decided once. */
91
+ export interface AgentSetupInput {
92
+ agent: RegisterAgentInput;
93
+ grants?: AgentSetupGrant[];
94
+ allowed_hosts?: AgentSetupHosts[];
95
+ }
96
+ export interface AgentSetupResult {
97
+ agent: Agent;
98
+ grants: Array<{
99
+ id: string;
100
+ service_connection_id: string;
101
+ }>;
102
+ allowed_hosts: AgentSetupHosts[];
103
+ }
104
+ /** What dismissing an agent's open warnings did. */
105
+ export interface DismissWarningsResult {
106
+ agent_id: string;
107
+ dismissed: number;
108
+ by_signal_type: Record<string, number>;
109
+ /** New events of the dismissed kinds for this agent are hidden for this long. */
110
+ repeats_hidden_for_seconds: number;
61
111
  }
62
112
  export interface UpdateAgentInput {
63
113
  name?: string;
@@ -69,6 +119,8 @@ export interface UpdateAgentInput {
69
119
  llm_inject_system_prompt?: boolean;
70
120
  /** Mutable post-registration. See {@link RegisterAgentInput.llm_redact_pii}. */
71
121
  llm_redact_pii?: boolean;
122
+ /** Mutable post-registration. Turning it on needs human approval. See {@link RegisterAgentInput.eval_traffic}. */
123
+ eval_traffic?: boolean;
72
124
  }
73
125
  export interface IssuedPassport {
74
126
  token: string;
@@ -104,8 +156,11 @@ export interface PassportIssueScope {
104
156
  /** Optional named intents that expand to constraints server-side. */
105
157
  intents?: unknown[];
106
158
  /**
107
- * Services whose content may flow INTO this one (the data-flow
108
- * declaration, enforced by the scope wall). Omit to inherit the operator
159
+ * Sources whose content may flow INTO this one (the data-flow
160
+ * declaration, enforced by the scope wall): a service, or one connection of
161
+ * a service written `service@<connection id>`. Content read through one
162
+ * connection of a service needs such an entry before it may go out through
163
+ * another connection of the same service. Omit to inherit the operator
109
164
  * grant; `[]` allows no cross-service flow. It must be a subset of the
110
165
  * grant and, on delegation, of the parent scope. A standing grant wildcard
111
166
  * is resolved to exact service names before signing and is never accepted
@@ -181,12 +236,16 @@ export interface ServiceConnection {
181
236
  operator_id: string;
182
237
  service_id: string;
183
238
  provider: string;
239
+ /** What this connection is called among the service's connections (`default` for the first one). */
240
+ name: string;
184
241
  status: string;
185
242
  verification_status: string | null;
186
243
  verified_at: string | null;
187
244
  proxy_enabled: boolean;
188
245
  connected_by: string | null;
189
246
  created_at: string;
247
+ /** The address of the service's MCP endpoint (given when it was connected, or the default of a service STACK knows); null when it has none. */
248
+ mcp_url?: string | null;
190
249
  }
191
250
  export interface ConnectServiceInput {
192
251
  service_id: string;
@@ -195,12 +254,89 @@ export interface ConnectServiceInput {
195
254
  credential: string;
196
255
  /** Required by the API (at least one). */
197
256
  scopes: string[];
257
+ /** The address of the service's MCP endpoint, when it speaks MCP over HTTP: https, on one of the connection's allowed hosts. */
258
+ mcp_url?: string;
259
+ /** Names the connection when the service already has one: 1 to 40 letters, digits, spaces or dashes. Omit for the first connection (`default`). */
260
+ connection_name?: string;
261
+ }
262
+ export type ConnectLinkMethod = 'oauth' | 'key';
263
+ export type ConnectLinkStatus = 'pending' | 'connected' | 'expired';
264
+ /**
265
+ * The customer's own API, which takes a key or token. Never a credential: the person enters that on the page the
266
+ * link opens.
267
+ */
268
+ export interface CustomConnectLinkService {
269
+ name: string;
270
+ description?: string;
271
+ /** Hosts the key may be sent to (1 to 100): bare hostnames (`api.example.com`) or dot-led domains (`.example.com`). The owner may correct them on the page before entering the key. */
272
+ allowed_hosts: string[];
273
+ /** A credential template whose fields the page asks for. Omitted: one API key field. */
274
+ template?: string;
275
+ /** The address of the API's MCP endpoint, when it speaks MCP over HTTP: https, on one of `allowed_hosts`. */
276
+ mcp_url?: string;
277
+ /** Names the connection the link makes (1 to 40 letters, digits, spaces or dashes). Omit for the first connection of the service (`default`). */
278
+ connection_name?: string;
279
+ }
280
+ export type CreateConnectLinkInput = {
281
+ /** A catalog service id or provider name, for example `github`. */
282
+ service_id: string;
283
+ /** OAuth scopes to ask for when the service connects through the provider's own sign-in. Omit for the service defaults. */
284
+ scopes?: string[];
285
+ /** Names the connection the link makes (1 to 40 letters, digits, spaces or dashes). Omit for the first connection of the service (`default`). */
286
+ connection_name?: string;
287
+ } | {
288
+ /** The customer's own API, connected with a key or token. A custom service that signs in with OAuth is not supported. */
289
+ custom: CustomConnectLinkService;
290
+ } | {
291
+ /**
292
+ * A key that belongs to one of the customer's own supplier accounts, entered on the page: a print-on-demand supplier
293
+ * (`gelato`, `prodigi`, `printful` or `lulu`), an agent account's Telegram bot, or the street address's mailbox.bot key.
294
+ * Owner or admin only.
295
+ */
296
+ connect: ConnectKeyTarget;
297
+ };
298
+ /** What a key link is for. Names the key's use only, never the key. */
299
+ export type ConnectKeyTarget = {
300
+ kind: 'making_supplier';
301
+ supplier: 'gelato' | 'prodigi' | 'printful' | 'lulu';
302
+ } | {
303
+ kind: 'telegram_bot';
304
+ account_id: string;
305
+ } | {
306
+ kind: 'post_address';
307
+ };
308
+ /** A connect link as it reads back: never the URL and never a credential. */
309
+ export interface ConnectLink {
310
+ link_id: string;
311
+ provider: string;
312
+ service_id: string;
313
+ /** The name the connection will get. */
314
+ connection_name: string;
315
+ /** `oauth`: the person signs in on the provider's page. `key`: they enter the key on a STACK page. */
316
+ method: ConnectLinkMethod;
317
+ status: ConnectLinkStatus;
318
+ /** The connection the link made, once `status` is `connected`. */
319
+ connection_id: string | null;
320
+ expires_at: string;
321
+ created_at: string;
322
+ completed_at: string | null;
323
+ }
324
+ /** A newly created connect link: the one and only copy of its URL. */
325
+ export interface CreatedConnectLink extends ConnectLink {
326
+ /** Open it in a browser signed in to STACK. It carries a one-time token: show it to the person, never log it. */
327
+ url: string;
198
328
  }
199
329
  export interface ConnectCustomServiceInput {
200
330
  name: string;
201
331
  description?: string;
202
332
  credential: string | Record<string, string>;
203
333
  scopes?: string[];
334
+ /** Hosts the credential may be sent to (the API needs them for a custom service unless the credential carries a base_url). */
335
+ allowed_hosts?: string[];
336
+ /** The address of the service's MCP endpoint, when it speaks MCP over HTTP: https, on one of `allowed_hosts`. */
337
+ mcp_url?: string;
338
+ /** Names the connection when the service already has one: 1 to 40 letters, digits, spaces or dashes. */
339
+ connection_name?: string;
204
340
  }
205
341
  export interface GrantAgentAccessInput {
206
342
  agent_id: string;
@@ -208,6 +344,14 @@ export interface GrantAgentAccessInput {
208
344
  service_connection_id: string;
209
345
  /** At least one scope; an explicit list is part of the grant's fail-closed contract. */
210
346
  scopes: string[];
347
+ /** Limits every call must meet, whichever rule allows it. */
348
+ constraints?: unknown[];
349
+ /** Named intents that expand to constraints server-side; every one must hold. */
350
+ intents?: unknown[];
351
+ /** Rules that each allow their own calls: a call must meet at least one, so a read rule and a post rule can sit side by side. */
352
+ alternatives?: GrantAccessRule[];
353
+ /** Sources whose content may flow into this one: a service, or one connection of it as `service@<connection id>`. */
354
+ allow_data_from?: string[];
211
355
  }
212
356
  export interface CredentialResult {
213
357
  provider: string;
@@ -218,7 +362,12 @@ export interface Dropoff {
218
362
  id: string;
219
363
  operator_id: string;
220
364
  from_agent_id: string;
365
+ /** The first agent named. */
221
366
  to_agent_id: string;
367
+ /** Every agent named, in the order named: each can see and collect it. */
368
+ to_agent_ids: string[];
369
+ /** The agent that collected it; null until one has. */
370
+ collected_by_agent_id: string | null;
222
371
  schema: Record<string, unknown>;
223
372
  status: string;
224
373
  on_expire: 'notify' | 'retry' | 'fail';
@@ -232,7 +381,12 @@ export interface Dropoff {
232
381
  export interface DropoffStatus {
233
382
  id: string;
234
383
  from_agent: string;
384
+ /** The first agent named. */
235
385
  to_agent: string;
386
+ /** Every agent named, in the order named. */
387
+ to_agents: string[];
388
+ /** The agent that collected it; null until one has. */
389
+ collected_by: string | null;
236
390
  status: string;
237
391
  created_at: string;
238
392
  deposited_at: string | null;
@@ -243,7 +397,13 @@ export interface DropoffStatus {
243
397
  }
244
398
  export interface CreateDropoffInput {
245
399
  from_agent: string;
246
- to_agent: string;
400
+ /** The one agent it is for. Give this or `to_agents`, not both. */
401
+ to_agent?: string;
402
+ /**
403
+ * Several of the customer's agents, 1 to 10, not the sender. Each can see it and is woken when it is deposited, and
404
+ * the first to collect it takes it; the others get DROPOFF_ALREADY_COLLECTED naming who did. Give this or `to_agent`.
405
+ */
406
+ to_agents?: string[];
247
407
  schema: Record<string, unknown>;
248
408
  ttl_seconds?: number;
249
409
  /** Legacy compatibility field. Every value now uses expire-and-purge. */
@@ -391,6 +551,19 @@ export interface VerificationResult {
391
551
  authorization_url?: string;
392
552
  status: string;
393
553
  }
554
+ /** Where a verification session stands; `completed`, `failed` and `expired` are final. */
555
+ export type IdentityVerificationSessionStatus = 'pending' | 'completed' | 'failed' | 'expired';
556
+ /** One identity verification session. No provider data and nothing about the person. */
557
+ export interface IdentityVerificationSession {
558
+ session_id: string;
559
+ provider_key: string;
560
+ session_ref: string;
561
+ status: IdentityVerificationSessionStatus;
562
+ requested_claims: string[];
563
+ created_at: string;
564
+ expires_at: string;
565
+ completed_at: string | null;
566
+ }
394
567
  /** Canonical body for one service identity requirement. */
395
568
  export interface SetServiceRequirementInput {
396
569
  layer: 'humanity' | 'identity' | 'delegation';
@@ -427,6 +600,51 @@ export interface TeamMember {
427
600
  invited_at: string;
428
601
  joined_at: string | null;
429
602
  revoked_at: string | null;
603
+ /** The identity provider (its `iss`) the member signed in through; null until they have. */
604
+ sso_issuer: string | null;
605
+ }
606
+ /** One member by id, or every member bound to one issuer. */
607
+ export type ClearSsoBindingsInput = {
608
+ member_id: string;
609
+ issuer?: never;
610
+ } | {
611
+ issuer: string;
612
+ member_id?: never;
613
+ };
614
+ export interface ClearSsoBindingsResult {
615
+ /** The members whose binding was forgotten, each with the issuer it was bound to. */
616
+ cleared: Array<{
617
+ id: string;
618
+ email: string;
619
+ sso_issuer: string;
620
+ }>;
621
+ }
622
+ /** The state of an e-mail domain claimed for the account's single sign-on. */
623
+ export type SsoDomainStatus = 'pending' | 'verified' | 'lapsed';
624
+ /** What one lookup of a domain's DNS record found: the record, no such record, or no answer. */
625
+ export type SsoDomainCheckResult = 'confirmed' | 'missing' | 'unavailable';
626
+ /** An e-mail domain of the account's single sign-on, with the DNS record that proves it. */
627
+ export interface SsoDomain {
628
+ id: string;
629
+ domain: string;
630
+ status: SsoDomainStatus;
631
+ /** Publish a TXT record at `name` with exactly `value`. */
632
+ record: {
633
+ type: 'TXT';
634
+ name: string;
635
+ value: string;
636
+ };
637
+ verified_at: string | null;
638
+ last_checked_at: string | null;
639
+ /** What the last lookup found; null before the first one. */
640
+ last_check: SsoDomainCheckResult | null;
641
+ /** Since when the record has been seen missing; null while it is there. */
642
+ missing_since: string | null;
643
+ created_at: string;
644
+ }
645
+ export interface SsoDomainCheck {
646
+ domain: SsoDomain;
647
+ check: SsoDomainCheckResult;
430
648
  }
431
649
  export interface InviteMemberInput {
432
650
  email: string;
@@ -519,6 +737,8 @@ interface ProxyRequestFields {
519
737
  headers?: Record<string, string>;
520
738
  body?: unknown;
521
739
  query?: Record<string, string>;
740
+ /** The connection to use when the service has several: its name (any case) or its `scon_` id. Omit when there is one. */
741
+ connection?: string;
522
742
  }
523
743
  /**
524
744
  * A request through STACK's credential-injecting proxy.
@@ -552,6 +772,11 @@ export interface ProxyRequestOptions {
552
772
  */
553
773
  onOperationId?: (operationId: string) => void | Promise<void>;
554
774
  }
775
+ /** Options of `proxy.serviceTools` and `proxy.serviceCallTool`: the per-call options, plus the connection to use when the service has several. */
776
+ export interface ServiceCallOptions extends ProxyRequestOptions {
777
+ /** The connection's name (any case) or `scon_` id. Omit when the service has one connection, or when all of them share one MCP address. */
778
+ connection?: string;
779
+ }
555
780
  export interface ProxyResponse {
556
781
  /** Wire-form recovery handle returned by the API for non-GET operations. */
557
782
  operation_id?: string;
@@ -574,6 +799,8 @@ export interface ProxyOperation {
574
799
  created_at: string;
575
800
  dispatched_at: string | null;
576
801
  response_received_at: string | null;
802
+ /** Set once the outcome stayed unknown for 7 days with nothing settling it: STACK never sends it again. */
803
+ unresolved_at: string | null;
577
804
  provider_outcome: 'not_required' | 'pending' | 'confirmed' | 'not_found' | 'contradictory' | 'expired';
578
805
  provider_status: 'pending' | 'requires_action' | 'succeeded' | 'failed' | 'canceled' | null;
579
806
  response?: {
@@ -615,14 +842,21 @@ export interface ScanResponse {
615
842
  duration_ms: number;
616
843
  match: ScanMatch | null;
617
844
  }
845
+ /**
846
+ * The plan an account is on. `platform`: the platform plan is live (or a live grant stands in for it); `internal`:
847
+ * STACK's own account; `contract`: a self-managed engine install; `none`: no live plan.
848
+ */
849
+ export type AccountPlan = 'platform' | 'internal' | 'contract' | 'none';
618
850
  export interface ScanUsage {
619
- /** The plan the account draws from (a tenant reports its partner's plan). */
620
- tier: string;
851
+ /** The plan the account is on (a tenant reports the plan its billing account resolves to). */
852
+ plan: AccountPlan;
853
+ /** @deprecated No longer sent; read `plan`. */
854
+ tier?: string;
621
855
  limit: number | null;
622
856
  used: number;
623
857
  remaining: number | null;
624
858
  period: string;
625
- /** Present on white-label tenants: `used`/`limit` are the partner's shared pool. */
859
+ /** Present on accounts of a partner on a negotiated hard cap: `used`/`limit` are the partner's shared pool. */
626
860
  pooled?: true;
627
861
  }
628
862
  /** GET /v1/proxy/usage. Same shape as the scan readout: one action pool. */
@@ -643,12 +877,14 @@ export type UsageTotalCoverage = 'complete' | 'lower_bound';
643
877
  export interface ActionUsageMeter extends UsageMeter {
644
878
  /** Whether `limit` is the allowance recorded for this exact UTC month. */
645
879
  allowance_coverage: 'complete' | 'unavailable';
646
- /** The tier recorded with the allowance, or null when history is unknown. */
647
- allowance_tier: string | null;
880
+ /** The plan the limit belongs to: the account's plan for the current month, or null for any other month. */
881
+ allowance_plan: AccountPlan | null;
882
+ /** @deprecated No longer sent; read `allowance_plan`. */
883
+ allowance_tier?: string | null;
648
884
  by_kind?: Record<string, number>;
649
885
  detail_coverage: UsageDetailCoverage;
650
886
  /**
651
- * Pooled accounts only (white-label tenants and their partners). When
887
+ * Pooled accounts only (the accounts of a partner on a negotiated hard cap, and the partner). When
652
888
  * `pooled` is true, `used` is the whole pool the allowance applies to,
653
889
  * `own_used` is this account's share of it, and `tenants` is how many
654
890
  * tenant accounts share it.
@@ -665,7 +901,10 @@ export interface ActionUsageMeter extends UsageMeter {
665
901
  * default period or "custom" when a since/until window was requested.
666
902
  */
667
903
  export interface UsageResponse {
668
- tier: string;
904
+ /** The plan the account is on. */
905
+ plan: AccountPlan;
906
+ /** @deprecated No longer sent; read `plan`. */
907
+ tier?: string;
669
908
  period_start: string;
670
909
  period_end: string | null;
671
910
  period_label: string;
@@ -686,9 +925,9 @@ export interface UsageResponse {
686
925
  * Overage bills from the wallet at a hundredth of a cent.
687
926
  */
688
927
  actions: ActionUsageMeter;
689
- /** Ungated on every tier. `limit` is null; the count is for your own use. */
928
+ /** Ungated on every plan. `limit` is null; the count is for your own use. */
690
929
  agents: UsageMeter;
691
- /** Ungated on every tier. `limit` is null. */
930
+ /** Ungated on every plan. `limit` is null. */
692
931
  published_skills: UsageMeter;
693
932
  /**
694
933
  * @deprecated The five per-domain meters collapsed into `actions`. These
@@ -706,14 +945,14 @@ export interface UsageResponse {
706
945
  /** @deprecated see `actions` */
707
946
  skill_invocations: UsageMeter;
708
947
  };
709
- /** Humans on the account, owner included. */
948
+ /** Humans on the account, owner included. No plan caps them: `included` and `total` are null. */
710
949
  seats: {
711
950
  used: number;
712
951
  included: number | null;
713
952
  purchased: number;
714
953
  total: number | null;
715
954
  };
716
- /** Real vendor bills. Included amount, then the wallet at cost + 15%.
955
+ /** Real vendor bills. Included amount, then the wallet at provider cost.
717
956
  * Null when a since/until window was requested: these counters only exist
718
957
  * for the current month, so a windowed request gets honest absence rather
719
958
  * than the wrong month's numbers. */
@@ -742,11 +981,6 @@ export interface UsageResponse {
742
981
  days: number | null;
743
982
  negotiated: boolean;
744
983
  };
745
- /** Terms, not meters. Crossing one starts a conversation, not a 402. */
746
- fair_use: {
747
- egress_gb_per_month: number | null;
748
- agent_registrations_per_hour: number | null;
749
- };
750
984
  spend_cents: {
751
985
  skills: number;
752
986
  llm_compute: number;