@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 @@
1
+ {"version":3,"file":"control-socket-server.d.ts","sourceRoot":"","sources":["../src/control-socket-server.ts"],"names":[],"mappings":"AAwBA,2EAA2E;AAC3E,eAAO,MAAM,0CAA0C,QAA4B,CAAC;AAKpF;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,GAAG,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC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AAED,MAAM,WAAW,yBAAyB;IACxC,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,OAAO,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,MAAM,CAAC;QAAC,mBAAmB,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7F;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,GAAG,yBAAyB,CA6BtG"}
@@ -0,0 +1,108 @@
1
+ // The server side of the control socket: what your decision server does with a
2
+ // request from STACK. Both directions use Standard Webhooks
3
+ // (https://www.standardwebhooks.com): three headers, `webhook-id`,
4
+ // `webhook-timestamp` and `webhook-signature`, with an HMAC-SHA256 over
5
+ // `<id>.<timestamp>.<body>` keyed with the bytes of your `whsec_<base64>`
6
+ // secret. These two functions are the whole of it, with no dependency beyond
7
+ // node:crypto; any published Standard Webhooks library verifies STACK's
8
+ // requests as well.
9
+ //
10
+ // const check = verifyControlSocketRequest({ headers, body: rawBody, secret });
11
+ // if (!check.ok) return reply.status(401).send();
12
+ // const { headers: answerHeaders, body: answerBody } = signControlSocketAnswer({
13
+ // decisionId: check.request.decision_id,
14
+ // requestDigest: check.request.request_digest,
15
+ // verdict: 'allow',
16
+ // secrets: [secret],
17
+ // });
18
+ //
19
+ // Verify the raw body exactly as received; re-serialised JSON does not match.
20
+ import { signWebhookBody, verifyWebhook, WEBHOOK_TOLERANCE_SECONDS } from './webhook.js';
21
+ const SECRET_PREFIX = 'whsec_';
22
+ /** A signed message older (or newer) than this many seconds is refused. */
23
+ export const CONTROL_SOCKET_SIGNATURE_TOLERANCE_SECONDS = WEBHOOK_TOLERANCE_SECONDS;
24
+ const REASON_CODE_PATTERN = /^[a-z0-9_]{1,64}$/;
25
+ const REASON_MESSAGE_MAX_CHARS = 200;
26
+ function requireWhsec(secret) {
27
+ if (!secret.startsWith(SECRET_PREFIX))
28
+ throw new Error('A control socket secret starts with whsec_');
29
+ }
30
+ function sign(secret, id, timestamp, body) {
31
+ return signWebhookBody(secret, id, timestamp, body);
32
+ }
33
+ /**
34
+ * Check that a request really comes from STACK and is fresh, then read it. The
35
+ * signature is compared in constant time against every secret given; a
36
+ * malformed signature is a mismatch, never a throw. A malformed secret throws,
37
+ * because that is your configuration, not an attacker's input. (`verifyWebhook`
38
+ * is the same check for every other message STACK signs.)
39
+ */
40
+ export function verifyControlSocketRequest(input) {
41
+ const secrets = typeof input.secret === 'string' ? [input.secret] : [...input.secret];
42
+ if (secrets.length === 0)
43
+ throw new Error('At least one secret is needed to verify');
44
+ for (const secret of secrets)
45
+ requireWhsec(secret);
46
+ const checked = verifyWebhook({
47
+ headers: input.headers,
48
+ body: input.body,
49
+ secret: secrets,
50
+ toleranceSeconds: input.toleranceSeconds ?? CONTROL_SOCKET_SIGNATURE_TOLERANCE_SECONDS,
51
+ ...(input.now !== undefined ? { now: input.now } : {}),
52
+ });
53
+ if (!checked.ok)
54
+ return { ok: false, reason: checked.reason };
55
+ const parsed = checked.payload;
56
+ if (!isDecisionRequest(parsed))
57
+ return { ok: false, reason: 'bad_body' };
58
+ // STACK signs a decision with its decision id as the message id.
59
+ if (parsed.decision_id !== checked.id)
60
+ return { ok: false, reason: 'id_mismatch' };
61
+ return { ok: true, request: parsed };
62
+ }
63
+ function isDecisionRequest(value) {
64
+ if (!value || typeof value !== 'object')
65
+ return false;
66
+ const fields = value;
67
+ return (fields['type'] === 'stack.decision.request' &&
68
+ typeof fields['decision_id'] === 'string' &&
69
+ typeof fields['request_digest'] === 'string' &&
70
+ typeof fields['action'] === 'object' && fields['action'] !== null);
71
+ }
72
+ /**
73
+ * Build and sign the answer to a decision request: the body to return and the
74
+ * three headers that go with it, `webhook-id` being the decision id. Return
75
+ * the body as given; the signature covers its exact bytes.
76
+ */
77
+ export function signControlSocketAnswer(input) {
78
+ const secrets = typeof input.secrets === 'string' ? [input.secrets] : [...input.secrets];
79
+ if (secrets.length === 0)
80
+ throw new Error('At least one secret is needed to sign');
81
+ if (input.reason && !REASON_CODE_PATTERN.test(input.reason.code)) {
82
+ throw new Error('A reason code is 1 to 64 lower-case letters, digits or underscores');
83
+ }
84
+ if (input.reason?.message !== undefined && input.reason.message.length > REASON_MESSAGE_MAX_CHARS) {
85
+ throw new Error(`A reason message is at most ${REASON_MESSAGE_MAX_CHARS} characters`);
86
+ }
87
+ const answer = {
88
+ decision_id: input.decisionId,
89
+ request_digest: input.requestDigest,
90
+ verdict: input.verdict,
91
+ ...(input.reason ? { reason: input.reason } : {}),
92
+ ...(input.retry ? { retry: input.retry } : {}),
93
+ ...(input.policyRef !== undefined ? { policy_ref: input.policyRef } : {}),
94
+ };
95
+ const body = JSON.stringify(answer);
96
+ for (const secret of secrets)
97
+ requireWhsec(secret);
98
+ const timestamp = String(input.timestamp ?? Math.floor(Date.now() / 1000));
99
+ return {
100
+ body,
101
+ headers: {
102
+ 'webhook-id': input.decisionId,
103
+ 'webhook-timestamp': timestamp,
104
+ 'webhook-signature': secrets.map((secret) => `v1,${sign(secret, input.decisionId, timestamp, body).toString('base64')}`).join(' '),
105
+ },
106
+ };
107
+ }
108
+ //# sourceMappingURL=control-socket-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-socket-server.js","sourceRoot":"","sources":["../src/control-socket-server.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,4DAA4D;AAC5D,mEAAmE;AACnE,wEAAwE;AACxE,0EAA0E;AAC1E,6EAA6E;AAC7E,wEAAwE;AACxE,oBAAoB;AACpB,EAAE;AACF,kFAAkF;AAClF,oDAAoD;AACpD,mFAAmF;AACnF,6CAA6C;AAC7C,mDAAmD;AACnD,wBAAwB;AACxB,yBAAyB;AACzB,QAAQ;AACR,EAAE;AACF,8EAA8E;AAE9E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAEzF,MAAM,aAAa,GAAG,QAAQ,CAAC;AAE/B,2EAA2E;AAC3E,MAA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AC9B,mBAAmB,EAAE,SAAS;YAC9B,mBAAmB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;SACnI;KACF,CAAC;AACJ,CAAC"}
@@ -9,4 +9,11 @@ export interface StoredCredentials {
9
9
  export declare function credentialsFilePath(): Promise<string>;
10
10
  export declare function readCredentialsFile(): Promise<StoredCredentials | null>;
11
11
  export declare function writeCredentialsFile(creds: StoredCredentials): Promise<void>;
12
+ /**
13
+ * Run `work` holding `~/.stack/credentials.lock` (spec/credentials-files, section 5), so that two processes do not post the
14
+ * same refresh token and have the server end the whole family. The lock is an exclusive create; a lock older than 30 seconds
15
+ * is a dead holder's; a client that cannot take it (a permission, the wait of 5 seconds) goes on without it. `work` must
16
+ * read the credentials file again itself: the holder before it may have rotated the token.
17
+ */
18
+ export declare function withCredentialsLock<T>(work: () => Promise<T>): Promise<T>;
12
19
  //# sourceMappingURL=credentials-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials-file.d.ts","sourceRoot":"","sources":["../src/credentials-file.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAI3D;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAS7E;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYlF"}
1
+ {"version":3,"file":"credentials-file.d.ts","sourceRoot":"","sources":["../src/credentials-file.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAI3D;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAc7E;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAclF;AAMD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CA+B/E"}
@@ -14,7 +14,14 @@ export async function readCredentialsFile() {
14
14
  const { readFile } = await import('node:fs/promises');
15
15
  const path = await credentialsFilePath();
16
16
  const raw = await readFile(path, 'utf8');
17
- return JSON.parse(raw);
17
+ const parsed = JSON.parse(raw);
18
+ // A file that cannot sign anyone in is no sign-in at all (spec/credentials-files).
19
+ if (parsed === null || typeof parsed !== 'object')
20
+ return null;
21
+ const { client_id: clientId, refresh_token: refreshToken } = parsed;
22
+ if (typeof clientId !== 'string' || clientId === '' || typeof refreshToken !== 'string' || refreshToken === '')
23
+ return null;
24
+ return parsed;
18
25
  }
19
26
  catch {
20
27
  return null;
@@ -26,7 +33,9 @@ export async function writeCredentialsFile(creds) {
26
33
  const { homedir } = await import('node:os');
27
34
  const path = join(homedir(), '.stack', 'credentials.json');
28
35
  await mkdir(dirname(path), { recursive: true });
29
- await writeFile(path, JSON.stringify(creds, null, 2), 'utf8');
36
+ // Created readable by the owner only: the refresh token is a bearer secret, and a file made with the default mode is
37
+ // readable by others until the chmod below runs.
38
+ await writeFile(path, JSON.stringify(creds, null, 2), { encoding: 'utf8', mode: 0o600 });
30
39
  try {
31
40
  await chmod(path, 0o600);
32
41
  }
@@ -34,4 +43,50 @@ export async function writeCredentialsFile(creds) {
34
43
  /* Windows / unsupported FS — default ACL on %USERPROFILE%\.stack is user-scoped */
35
44
  }
36
45
  }
46
+ const LOCK_ACQUIRE_TIMEOUT_MS = 5_000;
47
+ const LOCK_RETRY_INTERVAL_MS = 50;
48
+ const LOCK_STALE_MS = 30_000;
49
+ /**
50
+ * Run `work` holding `~/.stack/credentials.lock` (spec/credentials-files, section 5), so that two processes do not post the
51
+ * same refresh token and have the server end the whole family. The lock is an exclusive create; a lock older than 30 seconds
52
+ * is a dead holder's; a client that cannot take it (a permission, the wait of 5 seconds) goes on without it. `work` must
53
+ * read the credentials file again itself: the holder before it may have rotated the token.
54
+ */
55
+ export async function withCredentialsLock(work) {
56
+ const { mkdir, writeFile, stat, unlink } = await import('node:fs/promises');
57
+ const { dirname, join } = await import('node:path');
58
+ const path = await credentialsFilePath();
59
+ const lockPath = join(dirname(path), 'credentials.lock');
60
+ await mkdir(dirname(path), { recursive: true });
61
+ const deadline = Date.now() + LOCK_ACQUIRE_TIMEOUT_MS;
62
+ let held = false;
63
+ while (Date.now() < deadline) {
64
+ try {
65
+ await writeFile(lockPath, String(process.pid), { flag: 'wx', mode: 0o600 });
66
+ held = true;
67
+ break;
68
+ }
69
+ catch (err) {
70
+ if (err.code !== 'EEXIST')
71
+ break;
72
+ try {
73
+ if (Date.now() - (await stat(lockPath)).mtimeMs > LOCK_STALE_MS) {
74
+ await unlink(lockPath).catch(() => undefined);
75
+ continue;
76
+ }
77
+ }
78
+ catch {
79
+ continue; // the lock went away between the failed create and the look: take it
80
+ }
81
+ await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_INTERVAL_MS));
82
+ }
83
+ }
84
+ try {
85
+ return await work();
86
+ }
87
+ finally {
88
+ if (held)
89
+ await unlink(lockPath).catch(() => undefined);
90
+ }
91
+ }
37
92
  //# sourceMappingURL=credentials-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials-file.js","sourceRoot":"","sources":["../src/credentials-file.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,EAAE;AACF,+DAA+D;AAC/D,qEAAqE;AACrE,kEAAkE;AAClE,4BAA4B;AAW5B,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;QACtD,MAAM,IAAI,GAAG,MAAM,mBAAmB,EAAE,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAsB,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAwB;IACjE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACrE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;IACpD,MAAM,EAAE,OAAO,EAAE,GAAG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O,GAAG,aAAa,EAAE,CAAC;oBAChE,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;oBAC9C,SAAS;gBACX,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,SAAS,CAAC,qEAAqE;YACjF,CAAC;YACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;YAAS,CAAC;QACT,IAAI,IAAI;YAAE,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
package/dist/errors.d.ts CHANGED
@@ -25,4 +25,320 @@ export declare class MissionNotLiveError extends StackError {
25
25
  export declare class ValidationError extends StackError {
26
26
  constructor(message: string, details?: unknown);
27
27
  }
28
+ /**
29
+ * 403 `GOVERNANCE_APPROVAL_REQUIRED`: the call needs a human's approval. Send
30
+ * the person to `approvalUrl`; once approved, retry the same call with the
31
+ * same input and `governanceApprovalId: approvalId`.
32
+ */
33
+ export declare class GovernanceApprovalRequiredError extends StackError {
34
+ readonly approvalId: string;
35
+ readonly approvalUrl: string;
36
+ constructor(message: string, status: number, details?: unknown);
37
+ }
38
+ /**
39
+ * 403 `GOVERNANCE_APPROVAL_PENDING`, `GOVERNANCE_APPROVAL_REJECTED` or `GOVERNANCE_APPROVAL_EXPIRED`: a retry named an
40
+ * approval that cannot be used. Pending: wait for the person and retry. Rejected or expired: ask for a new one by making
41
+ * the call again without the approval. `approvalStatus` is `pending`, `rejected` or `expired`.
42
+ */
43
+ export declare class GovernanceApprovalStateError extends StackError {
44
+ readonly approvalId: string;
45
+ readonly approvalStatus: string;
46
+ constructor(message: string, code: string, status: number, details?: unknown);
47
+ }
48
+ /** 409 `ACCOUNT_PIECE_NOT_READY`: a piece of the agent account is not ready; read the account to follow it. */
49
+ export declare class AccountPieceNotReadyError extends StackError {
50
+ readonly accountId: string;
51
+ readonly piece: string;
52
+ readonly state: string;
53
+ constructor(message: string, status: number, details?: unknown);
54
+ }
55
+ /** 402 `AGENT_BUDGET_EXCEEDED`: the agent has reached its monthly budget. */
56
+ export declare class AgentBudgetExceededError extends StackError {
57
+ readonly accountId: string;
58
+ readonly remainingCents: number;
59
+ constructor(message: string, status: number, details?: unknown);
60
+ }
61
+ /** 403 `RECIPIENT_OPTED_OUT`: the number asked not to be contacted, so it is on the customer's do-not-contact list and texts and calls to it are refused. */
62
+ export declare class RecipientOptedOutError extends StackError {
63
+ readonly accountId: string;
64
+ constructor(message: string, status: number, details?: unknown);
65
+ }
66
+ /**
67
+ * 422 `DESTINATION_NOT_AVAILABLE`: texts and calls to this number are not available. `reason` is `no_price` (Twilio has
68
+ * no price for the destination, so STACK cannot charge it at cost) or `refused_by_twilio` (Twilio's own geographic
69
+ * permissions or high-risk number blocking do not allow it from this account's number). Nothing was charged.
70
+ */
71
+ export declare class DestinationNotAvailableError extends StackError {
72
+ readonly reason: string;
73
+ constructor(message: string, status: number, details?: unknown);
74
+ }
75
+ /** 503 `BROWSER_TIME_USED_UP`: the browser time STACK has for this month is spent. Nothing was charged; browsers are available again when the month turns. */
76
+ export declare class BrowserTimeUsedUpError extends StackError {
77
+ readonly provider: string;
78
+ constructor(message: string, status: number, details?: unknown);
79
+ }
80
+ /** 503 `BROWSER_SESSION_LENGTH_REFUSED`: the browser plan does not allow a session this long. Nothing was charged; retrying does not help. */
81
+ export declare class BrowserSessionLengthRefusedError extends StackError {
82
+ readonly provider: string;
83
+ constructor(message: string, status: number, details?: unknown);
84
+ }
85
+ /** 503 `PROVIDER_CAPACITY_UNAVAILABLE`: a provider declined STACK's own account, or STACK paused its own spend at Twilio. Nothing was charged; retry in a few minutes. */
86
+ export declare class ProviderCapacityUnavailableError extends StackError {
87
+ readonly provider: string;
88
+ constructor(message: string, status: number, details?: unknown);
89
+ }
90
+ /**
91
+ * `ACCOUNT_CALL_FAILED`: the call did not go through. When `retryable` (502)
92
+ * the call may have been placed: read the account's calls before retrying.
93
+ * Otherwise (422) the provider refused it.
94
+ */
95
+ export declare class AccountCallFailedError extends StackError {
96
+ readonly reason: string;
97
+ readonly retryable: boolean;
98
+ constructor(message: string, status: number, details?: unknown);
99
+ }
100
+ /** 422 `TOOL_PRICE_REFUSED`: a paid tool run refused before it is held (`max_results` out of range, an input too deep). Nothing was held or charged. */
101
+ export declare class ToolPriceRefusedError extends StackError {
102
+ readonly reason: string;
103
+ constructor(message: string, status: number, details?: unknown);
104
+ }
105
+ /** 503 `TOOLS_UNAVAILABLE`: paid tools are unavailable on STACK's side. Nothing was charged; retry later. */
106
+ export declare class ToolsUnavailableError extends StackError {
107
+ readonly reason: string;
108
+ constructor(message: string, status: number, details?: unknown);
109
+ }
110
+ /** 503 `MAKING_UNAVAILABLE`: making cannot serve the call on STACK's or a supplier's side. Nothing was ordered or charged; retry later. */
111
+ export declare class MakingUnavailableError extends StackError {
112
+ readonly reason: string;
113
+ constructor(message: string, status: number, details?: unknown);
114
+ }
115
+ /** 400 `TOOL_RUN_REJECTED`: the tool provider refused the request; inspect the endpoint's schema. Nothing was charged. */
116
+ export declare class ToolRunRejectedError extends StackError {
117
+ readonly providerStatus: number | null;
118
+ constructor(message: string, status: number, details?: unknown);
119
+ }
120
+ /**
121
+ * 403 `BUDGET_NEEDS_CONTROLS`: a per-agent monthly budget needs controls. Open
122
+ * the account without `monthly_budget_cents` (prepaid credit is its limit), or
123
+ * turn on controls first.
124
+ */
125
+ export declare class BudgetNeedsControlsError extends StackError {
126
+ constructor(message: string, status: number, details?: unknown);
127
+ }
128
+ /**
129
+ * 402 `PLATFORM_SUBSCRIPTION_REQUIRED`: every agent call, an agent account's
130
+ * or not, needs the platform subscription trialing or active (a contract plan
131
+ * never does). `subscriptionStatus` is its status now (none, incomplete,
132
+ * lapsed or canceled). The error's details carry how to start it
133
+ * (`subscribe.api`, `subscribe.cli`, `subscribe.url`).
134
+ */
135
+ export declare class PlatformSubscriptionRequiredError extends StackError {
136
+ readonly subscriptionStatus: string;
137
+ constructor(message: string, status: number, details?: unknown);
138
+ }
139
+ /**
140
+ * 429 `SHARED_MAIL_DAILY_LIMIT`: the customer's agents have reached `limit` recipients
141
+ * today (UTC) on the shared agent domain; every To, Cc and Bcc address counts, not each email. The limit is
142
+ * 20 for a customer's first 14 days and 100 after. It resets at midnight UTC; inboxes
143
+ * on an own verified domain have no STACK daily limit.
144
+ */
145
+ export declare class SharedMailDailyLimitError extends StackError {
146
+ readonly limit: number;
147
+ constructor(message: string, status: number, details?: unknown);
148
+ }
149
+ /**
150
+ * A Telegram send STACK refused before anything left. `reason` says why:
151
+ * `no_bot` (the agent has no bot), `chat_unknown` (the chat never wrote to the
152
+ * bot: a Telegram bot cannot message a chat first), `chat_blocked`,
153
+ * `bot_unavailable` (Telegram no longer accepts the bot's token).
154
+ * Nothing was sent.
155
+ */
156
+ export declare class TelegramSendRefusedError extends StackError {
157
+ readonly reason: string;
158
+ constructor(message: string, status: number, details?: unknown);
159
+ }
160
+ /**
161
+ * 413 `EMAIL_ATTACHMENTS_TOO_LARGE`: the files attached to an email come to more than the mail provider takes in one
162
+ * message (`limitBytes`, 25 MB). Nothing was sent. Attach fewer or smaller files, or send a share link.
163
+ */
164
+ export declare class EmailAttachmentsTooLargeError extends StackError {
165
+ readonly totalBytes: number;
166
+ readonly limitBytes: number;
167
+ constructor(message: string, status: number, details?: unknown);
168
+ }
169
+ /**
170
+ * 422 `EMAIL_MESSAGE_NOT_ANSWERABLE`: a reply or forward names a message that cannot be answered. `reason` is
171
+ * `not_email`, `withheld`, `not_received` (the account sent it) or `no_sender` (its From names no address).
172
+ * Nothing was sent.
173
+ */
174
+ export declare class EmailMessageNotAnswerableError extends StackError {
175
+ readonly reason: string;
176
+ constructor(message: string, status: number, details?: unknown);
177
+ }
178
+ /** One policy rule that allows a send without naming who receives it (the `rules` of an `UnboundedSendRuleError`). */
179
+ export interface UnboundSendRuleFinding {
180
+ ruleId: string;
181
+ connectionId: string;
182
+ provider: string | null;
183
+ /** `unbound_recipient`, `implicit_recipient`, `unpinned_operation` or `unknown_intent`. */
184
+ reason: string;
185
+ /** The send intents involved. */
186
+ intents: string[];
187
+ /** The recipient fields that need an `eq` or `in` constraint. */
188
+ unboundPaths: string[];
189
+ }
190
+ /**
191
+ * 400 `UNBOUNDED_SEND_RULE`: a new or revised policy allows a send without
192
+ * naming who receives it. `rules` lists each offending rule; bind the recipient
193
+ * fields, set the rule's `recipients` to `"per_mission"` so each Mission names
194
+ * them, or set the rule to `review` or `deny`.
195
+ */
196
+ export declare class UnboundedSendRuleError extends StackError {
197
+ readonly rules: UnboundSendRuleFinding[];
198
+ constructor(message: string, status: number, details?: unknown);
199
+ }
200
+ /** Which rule of a policy refused an action. Never a value from the call. */
201
+ export interface ControlRefusalRuleDetails {
202
+ policyId: string;
203
+ policyRevision: number;
204
+ /** The part of the policy: `connections`, `actions`, `recipients`, `spend`, `review`, `models`, `browser`, `card`, `wallet`, `sandbox` or `tools`. */
205
+ section: string;
206
+ /** The rule that refused: a connection rule id, or the policy field. */
207
+ rule: string;
208
+ /** The stable reason, for example `recipient_not_allowed`, `recipients_not_pinned` or `review_required`. */
209
+ code: string;
210
+ /** The policy's own side of the comparison (a limit, a list's size), never what the call carried. */
211
+ detail: Record<string, string | number | boolean | null> | null;
212
+ }
213
+ /**
214
+ * 403 `CONTROL_DENIED`: your controls refused the action. Nothing was charged.
215
+ * `rule` says which rule of a hosted policy refused it (null when your own
216
+ * decision server refused). An action held for a person carries `retry`: once
217
+ * the person approves it, send the same action again with the header
218
+ * `X-Control-Ref: <retry.ref>`.
219
+ */
220
+ export declare class ControlDeniedError extends StackError {
221
+ readonly decisionId: string;
222
+ readonly reasonCode: string | null;
223
+ readonly retry: {
224
+ ref: string;
225
+ afterSeconds: number | null;
226
+ } | null;
227
+ readonly rule: ControlRefusalRuleDetails | null;
228
+ constructor(message: string, status: number, details?: unknown);
229
+ }
230
+ /**
231
+ * 403 `CONTROL_LIMIT_EXCEEDED`: a limit of your policy was reached while the
232
+ * action was being paid for. Nothing was reserved or charged. `limit` is the
233
+ * window (`day`, `month`, `mission` or `action`) and unit that was hit,
234
+ * `remaining` what is left of it, and `maxPerActionCents` the most one action
235
+ * may cost when that was the limit.
236
+ */
237
+ export declare class ControlLimitExceededError extends StackError {
238
+ /** `scope` names the spend rule's counter that refused (`spend:<rule id>`); absent for the account's shared windows. */
239
+ readonly limit: {
240
+ window: string;
241
+ unit: string;
242
+ scope?: string;
243
+ } | null;
244
+ readonly remaining: number;
245
+ readonly maxPerActionCents: number | null;
246
+ constructor(message: string, status: number, details?: unknown);
247
+ }
248
+ /** 409 `CONTROLS_NOT_ENABLED`: policies need hosted controls, which are not on for this account. Turn them on with `billing.subscribeControls`. */
249
+ export declare class ControlsNotEnabledError extends StackError {
250
+ constructor(message: string, status: number, details?: unknown);
251
+ }
252
+ /**
253
+ * 402 `CONTROLS_REQUIRED`: this is a controls feature and the account has no controls. `feature` is `record` for a
254
+ * read of the record (the audit record, evidence packs and signed records, Mission dossiers and replay, passport
255
+ * reports, operator-review downloads), `detector_settings` for a change of the detector settings, `detector_reads` for
256
+ * reading them, `policies` for control policies and their simulation, `reviews` for control reviews, `pii_settings` for
257
+ * the PII redaction settings, `missions` for listing Missions, `fleets` for fleets, `intent_checks` for
258
+ * pending intent checks `wallet_caps` for an agent wallet's caps and `budget` for an agent account's monthly budget. STACK keeps the record either way: switch controls on with `billing.subscribeControls` to read
259
+ * all of it, including what came before.
260
+ */
261
+ export declare class ControlsRequiredError extends StackError {
262
+ readonly feature: string;
263
+ constructor(message: string, status: number, details?: unknown);
264
+ }
265
+ /** One thing the publish scan found: a closed `code` and the file it is in, never page text. */
266
+ export interface SiteScanFinding {
267
+ /** For example `brand_impersonation`, `unsafe_link` or `scanner_unavailable`. */
268
+ code: string;
269
+ path: string | null;
270
+ }
271
+ /**
272
+ * 422 `WEBSITE_PUBLISH_REJECTED`: the publish scan found something the service
273
+ * does not host, so nothing went live. `findings` names each one and the file
274
+ * it is in. Fix them and publish again. A `scanner_unavailable` finding means
275
+ * the scan could not run: publishing is refused rather than accepted unscanned,
276
+ * so retry later.
277
+ */
278
+ export declare class WebsitePublishRejectedError extends StackError {
279
+ readonly findings: SiteScanFinding[];
280
+ constructor(message: string, status: number, details?: unknown);
281
+ }
282
+ /** 403 `WEBSITE_LIMIT_EXCEEDED`: the account is at `max` for `limit` (the size of the whole site) for a website. */
283
+ export declare class WebsiteLimitExceededError extends StackError {
284
+ readonly limit: string;
285
+ readonly max: number;
286
+ constructor(message: string, status: number, details?: unknown);
287
+ }
288
+ /** 403 `WEBSITE_SUSPENDED`: the site is `suspended` or `taken_down` (`by` says who), so nothing can be published to it. */
289
+ export declare class WebsiteSuspendedError extends StackError {
290
+ readonly state: string;
291
+ readonly by: string | null;
292
+ constructor(message: string, status: number, details?: unknown);
293
+ }
294
+ /** 409 `WEBSITE_HOSTNAME_UNAVAILABLE`: the address is taken, is not a name STACK can serve, or its ownership is not proven yet. `reason` says which. */
295
+ export declare class WebsiteHostnameUnavailableError extends StackError {
296
+ readonly reason: string;
297
+ constructor(message: string, status: number, details?: unknown);
298
+ }
299
+ /** 409 `PAYMENT_CONNECTION_REQUIRED`: the account has no active Stripe connection. The customer connects their own Stripe first (`payments.startStripe`). */
300
+ export declare class PaymentConnectionRequiredError extends StackError {
301
+ constructor(message: string, status: number, details?: unknown);
302
+ }
303
+ /** `STRIPE_REQUEST_FAILED`: Stripe refused or failed a call made with the customer's key; nothing was created. `kind` is `permission`, `rejected` or `unavailable` (502: try again shortly). */
304
+ export declare class StripeRequestFailedError extends StackError {
305
+ readonly kind: string;
306
+ readonly providerStatus: number | null;
307
+ constructor(message: string, status: number, details?: unknown);
308
+ }
309
+ /**
310
+ * 400 or 422 `POST_REFUSED`: a letter or postcard was refused before anything was held or sent. `reason` says why:
311
+ * `address_undeliverable`, `pdf_unreadable`, `too_many_pages` or `provider_refused` (the print provider's own refusal).
312
+ * Nothing was charged.
313
+ */
314
+ export declare class PostRefusedError extends StackError {
315
+ readonly reason: string;
316
+ constructor(message: string, status: number, details?: unknown);
317
+ }
318
+ /** 503 `POST_UNAVAILABLE`: post is unavailable on STACK's side (provider not configured, or not answering). Nothing was charged; retry later. */
319
+ export declare class PostUnavailableError extends StackError {
320
+ readonly reason: string;
321
+ constructor(message: string, status: number, details?: unknown);
322
+ }
323
+ /**
324
+ * 409 `POSTAL_ADDRESS_NOT_ACTIVE`: the customer's street address is not live. `addressStatus` is `none`,
325
+ * `pending_identity` (the owner's steps at the supplier are unfinished) or `suspended`.
326
+ */
327
+ export declare class PostalAddressNotActiveError extends StackError {
328
+ readonly addressStatus: string;
329
+ constructor(message: string, status: number, details?: unknown);
330
+ }
331
+ /**
332
+ * 409 `CONNECTION_AMBIGUOUS`: the service has several connections and the call named none. Nothing was sent upstream.
333
+ * `connections` is the `{ id, name }` list the call could have used; repeat it with `connection` set to one of them.
334
+ */
335
+ export declare class ConnectionAmbiguousError extends StackError {
336
+ readonly connections: Array<{
337
+ id: string;
338
+ name: string;
339
+ }>;
340
+ constructor(message: string, status: number, details?: unknown);
341
+ }
342
+ /** The error for a non-2xx API response: a typed subclass for the codes callers act on, else `StackError`. */
343
+ export declare function apiError(message: string, code: string, status: number, details?: unknown): StackError;
28
344
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;aAGjB,IAAI,EAAE,MAAM;aACZ,MAAM,EAAE,MAAM;aACd,OAAO,CAAC,EAAE,OAAO;gBAHjC,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,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