@getstackrun/sdk 3.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 (247) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +366 -22
  3. package/dist/agent-auth.js +5 -6
  4. package/dist/agent-auth.js.map +1 -1
  5. package/dist/browser-bootstrap.js +2 -2
  6. package/dist/browser-bootstrap.js.map +1 -1
  7. package/dist/client.d.ts +88 -3
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +237 -42
  10. package/dist/client.js.map +1 -1
  11. package/dist/control-socket-server.d.ts +134 -0
  12. package/dist/control-socket-server.d.ts.map +1 -0
  13. package/dist/control-socket-server.js +108 -0
  14. package/dist/control-socket-server.js.map +1 -0
  15. package/dist/credentials-file.d.ts +7 -0
  16. package/dist/credentials-file.d.ts.map +1 -1
  17. package/dist/credentials-file.js +57 -2
  18. package/dist/credentials-file.js.map +1 -1
  19. package/dist/errors.d.ts +316 -0
  20. package/dist/errors.d.ts.map +1 -1
  21. package/dist/errors.js +572 -0
  22. package/dist/errors.js.map +1 -1
  23. package/dist/index.d.ts +130 -28
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +157 -29
  26. package/dist/index.js.map +1 -1
  27. package/dist/network-install-key.d.ts +56 -0
  28. package/dist/network-install-key.d.ts.map +1 -0
  29. package/dist/network-install-key.js +92 -0
  30. package/dist/network-install-key.js.map +1 -0
  31. package/dist/network-install.d.ts +134 -0
  32. package/dist/network-install.d.ts.map +1 -0
  33. package/dist/network-install.js +70 -0
  34. package/dist/network-install.js.map +1 -0
  35. package/dist/service-mcp.d.ts +49 -0
  36. package/dist/service-mcp.d.ts.map +1 -0
  37. package/dist/service-mcp.js +122 -0
  38. package/dist/service-mcp.js.map +1 -0
  39. package/dist/services/accounts.d.ts +1548 -0
  40. package/dist/services/accounts.d.ts.map +1 -0
  41. package/dist/services/accounts.js +724 -0
  42. package/dist/services/accounts.js.map +1 -0
  43. package/dist/services/agent-identity.d.ts +58 -0
  44. package/dist/services/agent-identity.d.ts.map +1 -0
  45. package/dist/services/agent-identity.js +50 -0
  46. package/dist/services/agent-identity.js.map +1 -0
  47. package/dist/services/agents.d.ts +79 -4
  48. package/dist/services/agents.d.ts.map +1 -1
  49. package/dist/services/agents.js +30 -3
  50. package/dist/services/agents.js.map +1 -1
  51. package/dist/services/audit.d.ts +5 -0
  52. package/dist/services/audit.d.ts.map +1 -1
  53. package/dist/services/audit.js +5 -0
  54. package/dist/services/audit.js.map +1 -1
  55. package/dist/services/billing.d.ts +67 -0
  56. package/dist/services/billing.d.ts.map +1 -0
  57. package/dist/services/billing.js +42 -0
  58. package/dist/services/billing.js.map +1 -0
  59. package/dist/services/brain.d.ts +122 -0
  60. package/dist/services/brain.d.ts.map +1 -0
  61. package/dist/services/brain.js +40 -0
  62. package/dist/services/brain.js.map +1 -0
  63. package/dist/services/calendar.d.ts +256 -0
  64. package/dist/services/calendar.d.ts.map +1 -0
  65. package/dist/services/calendar.js +75 -0
  66. package/dist/services/calendar.js.map +1 -0
  67. package/dist/services/catalogue.d.ts +185 -0
  68. package/dist/services/catalogue.d.ts.map +1 -0
  69. package/dist/services/catalogue.js +31 -0
  70. package/dist/services/catalogue.js.map +1 -0
  71. package/dist/services/chat-channels.d.ts +82 -0
  72. package/dist/services/chat-channels.d.ts.map +1 -0
  73. package/dist/services/chat-channels.js +42 -0
  74. package/dist/services/chat-channels.js.map +1 -0
  75. package/dist/services/control-policies.d.ts +409 -0
  76. package/dist/services/control-policies.d.ts.map +1 -0
  77. package/dist/services/control-policies.js +101 -0
  78. package/dist/services/control-policies.js.map +1 -0
  79. package/dist/services/control-socket.d.ts +201 -0
  80. package/dist/services/control-socket.d.ts.map +1 -0
  81. package/dist/services/control-socket.js +165 -0
  82. package/dist/services/control-socket.js.map +1 -0
  83. package/dist/services/credentials.d.ts +2 -1
  84. package/dist/services/credentials.d.ts.map +1 -1
  85. package/dist/services/credentials.js +3 -2
  86. package/dist/services/credentials.js.map +1 -1
  87. package/dist/services/detector-config.d.ts +13 -12
  88. package/dist/services/detector-config.d.ts.map +1 -1
  89. package/dist/services/detector-config.js +13 -12
  90. package/dist/services/detector-config.js.map +1 -1
  91. package/dist/services/drive.d.ts +257 -0
  92. package/dist/services/drive.d.ts.map +1 -0
  93. package/dist/services/drive.js +167 -0
  94. package/dist/services/drive.js.map +1 -0
  95. package/dist/services/dropoffs.d.ts +5 -1
  96. package/dist/services/dropoffs.d.ts.map +1 -1
  97. package/dist/services/dropoffs.js +3 -1
  98. package/dist/services/dropoffs.js.map +1 -1
  99. package/dist/services/evidence-packs.d.ts +5 -3
  100. package/dist/services/evidence-packs.d.ts.map +1 -1
  101. package/dist/services/evidence-packs.js +6 -4
  102. package/dist/services/evidence-packs.js.map +1 -1
  103. package/dist/services/flagged-content.d.ts +30 -0
  104. package/dist/services/flagged-content.d.ts.map +1 -0
  105. package/dist/services/flagged-content.js +24 -0
  106. package/dist/services/flagged-content.js.map +1 -0
  107. package/dist/services/governance.d.ts +69 -0
  108. package/dist/services/governance.d.ts.map +1 -0
  109. package/dist/services/governance.js +39 -0
  110. package/dist/services/governance.js.map +1 -0
  111. package/dist/services/identity.d.ts +44 -4
  112. package/dist/services/identity.d.ts.map +1 -1
  113. package/dist/services/identity.js +54 -6
  114. package/dist/services/identity.js.map +1 -1
  115. package/dist/services/inbound-webhooks.d.ts +12 -1
  116. package/dist/services/inbound-webhooks.d.ts.map +1 -1
  117. package/dist/services/inbound-webhooks.js +7 -0
  118. package/dist/services/inbound-webhooks.js.map +1 -1
  119. package/dist/services/intents.d.ts +9 -3
  120. package/dist/services/intents.d.ts.map +1 -1
  121. package/dist/services/intents.js +11 -7
  122. package/dist/services/intents.js.map +1 -1
  123. package/dist/services/llm.d.ts +73 -1
  124. package/dist/services/llm.d.ts.map +1 -1
  125. package/dist/services/llm.js +63 -1
  126. package/dist/services/llm.js.map +1 -1
  127. package/dist/services/making.d.ts +263 -0
  128. package/dist/services/making.d.ts.map +1 -0
  129. package/dist/services/making.js +114 -0
  130. package/dist/services/making.js.map +1 -0
  131. package/dist/services/meetings.d.ts +183 -0
  132. package/dist/services/meetings.d.ts.map +1 -0
  133. package/dist/services/meetings.js +148 -0
  134. package/dist/services/meetings.js.map +1 -0
  135. package/dist/services/memory.d.ts +288 -0
  136. package/dist/services/memory.d.ts.map +1 -0
  137. package/dist/services/memory.js +116 -0
  138. package/dist/services/memory.js.map +1 -0
  139. package/dist/services/message-access.d.ts +50 -0
  140. package/dist/services/message-access.d.ts.map +1 -0
  141. package/dist/services/message-access.js +36 -0
  142. package/dist/services/message-access.js.map +1 -0
  143. package/dist/services/missions.d.ts +93 -7
  144. package/dist/services/missions.d.ts.map +1 -1
  145. package/dist/services/missions.js +31 -3
  146. package/dist/services/missions.js.map +1 -1
  147. package/dist/services/network.d.ts +266 -0
  148. package/dist/services/network.d.ts.map +1 -0
  149. package/dist/services/network.js +209 -0
  150. package/dist/services/network.js.map +1 -0
  151. package/dist/services/partner-accounts.d.ts +215 -0
  152. package/dist/services/partner-accounts.d.ts.map +1 -0
  153. package/dist/services/partner-accounts.js +133 -0
  154. package/dist/services/partner-accounts.js.map +1 -0
  155. package/dist/services/passport-header-verify.js +1 -1
  156. package/dist/services/passport-header-verify.js.map +1 -1
  157. package/dist/services/passport-session.js +1 -1
  158. package/dist/services/passport-session.js.map +1 -1
  159. package/dist/services/passports.d.ts +6 -4
  160. package/dist/services/passports.d.ts.map +1 -1
  161. package/dist/services/passports.js +5 -4
  162. package/dist/services/passports.js.map +1 -1
  163. package/dist/services/payments.d.ts +126 -0
  164. package/dist/services/payments.d.ts.map +1 -0
  165. package/dist/services/payments.js +66 -0
  166. package/dist/services/payments.js.map +1 -0
  167. package/dist/services/pii-config.d.ts +7 -17
  168. package/dist/services/pii-config.d.ts.map +1 -1
  169. package/dist/services/pii-config.js +9 -19
  170. package/dist/services/pii-config.js.map +1 -1
  171. package/dist/services/post.d.ts +240 -0
  172. package/dist/services/post.d.ts.map +1 -0
  173. package/dist/services/post.js +99 -0
  174. package/dist/services/post.js.map +1 -0
  175. package/dist/services/proxy.d.ts +22 -5
  176. package/dist/services/proxy.d.ts.map +1 -1
  177. package/dist/services/proxy.js +33 -4
  178. package/dist/services/proxy.js.map +1 -1
  179. package/dist/services/rentahuman.d.ts +92 -0
  180. package/dist/services/rentahuman.d.ts.map +1 -0
  181. package/dist/services/rentahuman.js +53 -0
  182. package/dist/services/rentahuman.js.map +1 -0
  183. package/dist/services/scan.d.ts +1 -1
  184. package/dist/services/scan.d.ts.map +1 -1
  185. package/dist/services/scan.js +1 -1
  186. package/dist/services/scan.js.map +1 -1
  187. package/dist/services/services.d.ts +29 -2
  188. package/dist/services/services.d.ts.map +1 -1
  189. package/dist/services/services.js +55 -1
  190. package/dist/services/services.js.map +1 -1
  191. package/dist/services/skills.d.ts +1 -1
  192. package/dist/services/skills.js +1 -1
  193. package/dist/services/team.d.ts +13 -1
  194. package/dist/services/team.d.ts.map +1 -1
  195. package/dist/services/team.js +12 -0
  196. package/dist/services/team.js.map +1 -1
  197. package/dist/services/trust.d.ts +39 -0
  198. package/dist/services/trust.d.ts.map +1 -0
  199. package/dist/services/trust.js +35 -0
  200. package/dist/services/trust.js.map +1 -0
  201. package/dist/services/usage.d.ts +1 -1
  202. package/dist/services/usage.js +1 -1
  203. package/dist/services/wake.d.ts +257 -0
  204. package/dist/services/wake.d.ts.map +1 -0
  205. package/dist/services/wake.js +80 -0
  206. package/dist/services/wake.js.map +1 -0
  207. package/dist/services/website.d.ts +188 -0
  208. package/dist/services/website.d.ts.map +1 -0
  209. package/dist/services/website.js +135 -0
  210. package/dist/services/website.js.map +1 -0
  211. package/dist/sign-claim.d.ts +1 -1
  212. package/dist/sign-claim.js +2 -2
  213. package/dist/types.d.ts +292 -51
  214. package/dist/types.d.ts.map +1 -1
  215. package/dist/verify-agent-identity.d.ts +73 -0
  216. package/dist/verify-agent-identity.d.ts.map +1 -0
  217. package/dist/verify-agent-identity.js +106 -0
  218. package/dist/verify-agent-identity.js.map +1 -0
  219. package/dist/verify-network.d.ts +159 -0
  220. package/dist/verify-network.d.ts.map +1 -0
  221. package/dist/verify-network.js +153 -0
  222. package/dist/verify-network.js.map +1 -0
  223. package/dist/wake-webhook.d.ts +57 -0
  224. package/dist/wake-webhook.d.ts.map +1 -0
  225. package/dist/wake-webhook.js +60 -0
  226. package/dist/wake-webhook.js.map +1 -0
  227. package/dist/wallet-key.d.ts +30 -0
  228. package/dist/wallet-key.d.ts.map +1 -0
  229. package/dist/wallet-key.js +108 -0
  230. package/dist/wallet-key.js.map +1 -0
  231. package/dist/webhook.d.ts +63 -0
  232. package/dist/webhook.d.ts.map +1 -0
  233. package/dist/webhook.js +136 -0
  234. package/dist/webhook.js.map +1 -0
  235. package/dist/x402-pay.d.ts +139 -0
  236. package/dist/x402-pay.d.ts.map +1 -0
  237. package/dist/x402-pay.js +235 -0
  238. package/dist/x402-pay.js.map +1 -0
  239. package/package.json +3 -1
  240. package/dist/services/partner-connect.d.ts +0 -64
  241. package/dist/services/partner-connect.d.ts.map +0 -1
  242. package/dist/services/partner-connect.js +0 -42
  243. package/dist/services/partner-connect.js.map +0 -1
  244. package/dist/services/partner-tenants.d.ts +0 -126
  245. package/dist/services/partner-tenants.d.ts.map +0 -1
  246. package/dist/services/partner-tenants.js +0 -79
  247. package/dist/services/partner-tenants.js.map +0 -1
@@ -0,0 +1,66 @@
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 asks to be paid; 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
+ export class PaymentsService {
13
+ client;
14
+ constructor(client) {
15
+ this.client = client;
16
+ }
17
+ /**
18
+ * Start the customer's Stripe connection, or return the open one. It is
19
+ * `awaiting_key`: the customer opens `connect_url`, adds `webhook_url` with
20
+ * `webhook_events` as an endpoint in their Stripe, and pastes a restricted
21
+ * key and that endpoint's signing secret on the page. Called by an agent it
22
+ * returns the connection without a `connect_url`.
23
+ */
24
+ async startStripe(accountId, options) {
25
+ return this.client.post(`/v1/accounts/${seg(accountId)}/payments/stripe`, {}, passport(options));
26
+ }
27
+ /** The connection, or null when there is none. */
28
+ async getStripe(accountId, options) {
29
+ return this.client.get(`/v1/accounts/${seg(accountId)}/payments/stripe`, undefined, passport(options));
30
+ }
31
+ /** Erase the key and signing secret and turn off the active links. Owner or admin only. */
32
+ async disconnectStripe(accountId) {
33
+ await this.client.delete(`/v1/accounts/${seg(accountId)}/payments/stripe`);
34
+ }
35
+ /**
36
+ * A reusable link for one fixed price. One metered action, and a decision
37
+ * for the customer's controls. Throws `PaymentConnectionRequiredError` when
38
+ * there is no active connection.
39
+ */
40
+ async createLink(accountId, input, options) {
41
+ return this.client.post(`/v1/accounts/${seg(accountId)}/payments/links`, input, agentPassport(options));
42
+ }
43
+ /** A one-off checkout session for one fixed price. Metered and decided like `createLink`. */
44
+ async createCheckoutSession(accountId, input, options) {
45
+ return this.client.post(`/v1/accounts/${seg(accountId)}/payments/checkout-sessions`, input, agentPassport(options));
46
+ }
47
+ async listLinks(accountId, query = {}, options) {
48
+ return this.client.get(`/v1/accounts/${seg(accountId)}/payments/links`, { limit: query.limit !== undefined ? String(query.limit) : undefined }, passport(options));
49
+ }
50
+ /** Turn a link off so it can no longer be paid. */
51
+ async deactivateLink(accountId, linkId, options) {
52
+ return this.client.post(`/v1/accounts/${seg(accountId)}/payments/links/${seg(linkId)}/deactivate`, undefined, agentPassport(options));
53
+ }
54
+ /** Payments received on either rail, newest first. */
55
+ async listPayments(accountId, query = {}, options) {
56
+ return this.client.get(`/v1/accounts/${seg(accountId)}/payments`, {
57
+ rail: query.rail,
58
+ limit: query.limit !== undefined ? String(query.limit) : undefined,
59
+ cursor: query.cursor,
60
+ }, passport(options));
61
+ }
62
+ async getPayment(accountId, paymentId, options) {
63
+ return this.client.get(`/v1/accounts/${seg(accountId)}/payments/${seg(paymentId)}`, undefined, passport(options));
64
+ }
65
+ }
66
+ //# sourceMappingURL=payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/services/payments.ts"],"names":[],"mappings":"AAkHA,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,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,OAAiC;QACpE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAmB,gBAAgB,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACrH,CAAC;IAED,kDAAkD;IAClD,KAAK,CAAC,SAAS,CAAC,SAAiB,EAAE,OAAiC;QAClE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAA0C,gBAAgB,GAAG,CAAC,SAAS,CAAC,kBAAkB,EAAE,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,CAAC,aAAa,EAAE,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IACrJ,CAAC;IAED,sDAAsD;IACtD,KAAK,CAAC,YAAY,CAAC,SAAiB,EAAE,QAA2B,EAAE,EAAE,OAAiC;QACpG,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACpB,gBAAgB,GAAG,CAAC,SAAS,CAAC,WAAW,EACzC;YACE,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;YAClE,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,EACD,QAAQ,CAAC,OAAO,CAAC,CAClB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,SAAiB,EAAE,SAAiB,EAAE,OAAiC;QACtF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,gBAAgB,GAAG,CAAC,SAAS,CAAC,aAAa,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7H,CAAC;CACF"}
@@ -16,19 +16,15 @@ import type { PiiConfig, PiiConfigUpdate } from '../types.js';
16
16
  * lets you lower the threshold safely — bare-format personal numbers start
17
17
  * redacting without every order number in your traffic going with them.
18
18
  *
19
- * Loosening (redaction off, a higher threshold, a narrower country list)
20
- * requires a human governance approval from an API-key session: the call
21
- * returns 403 `GOVERNANCE_APPROVAL_REQUIRED` with an approval id, a person
22
- * approves it in the dashboard, then you retry passing `governanceApprovalId`.
19
+ * Every change applies at once and asks no one, loosening included (redaction
20
+ * off, a higher threshold, a narrower country list). `direction` in the answer
21
+ * says which way it went.
23
22
  *
24
23
  * @example
25
24
  * ```ts
26
25
  * // A Nordic operator: only run SE/NO/DK schemes, and demand less
27
26
  * // confidence because there is far less to confuse them with.
28
- * await stack.piiConfig.update(
29
- * { countries: ['SE', 'NO', 'DK'], threshold: 0.2 },
30
- * { governanceApprovalId: 'gvr_...' },
31
- * );
27
+ * await stack.piiConfig.update({ countries: ['SE', 'NO', 'DK'], threshold: 0.2 });
32
28
  *
33
29
  * const cfg = await stack.piiConfig.get();
34
30
  * // { configured: true, enabled: true, threshold: 0.2, countries: ['SE','NO','DK'] }
@@ -47,15 +43,9 @@ export declare class PiiConfigService {
47
43
  * Partial update. Omit a field to leave it untouched; pass `null` for
48
44
  * `threshold` or `countries` to clear it back to the built-in default.
49
45
  */
50
- update(input: PiiConfigUpdate, opts?: {
51
- governanceApprovalId?: string;
52
- }): Promise<PiiConfig>;
53
- /** Delete the row and fall back to built-in defaults. Always needs the
54
- * governance approval: the direction of a reset is not knowable in
55
- * advance without reading the row being destroyed. */
56
- reset(opts?: {
57
- governanceApprovalId?: string;
58
- }): Promise<{
46
+ update(input: PiiConfigUpdate): Promise<PiiConfig>;
47
+ /** Delete the row and fall back to built-in defaults. Applies at once. */
48
+ reset(): Promise<{
59
49
  success: boolean;
60
50
  }>;
61
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pii-config.d.ts","sourceRoot":"","sources":["../../src/services/pii-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;OAIG;IACG,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;IAI/B;;;OAGG;IACG,MAAM,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE;QAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IAUlG;;2DAEuD;IACjD,KAAK,CAAC,IAAI,CAAC,EAAE;QAAE,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAQrF"}
1
+ {"version":3,"file":"pii-config.d.ts","sourceRoot":"","sources":["../../src/services/pii-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;;OAIG;IACG,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;IAI/B;;;OAGG;IACG,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC;IAIxD,0EAA0E;IACpE,KAAK,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAG7C"}
@@ -14,19 +14,15 @@
14
14
  * lets you lower the threshold safely — bare-format personal numbers start
15
15
  * redacting without every order number in your traffic going with them.
16
16
  *
17
- * Loosening (redaction off, a higher threshold, a narrower country list)
18
- * requires a human governance approval from an API-key session: the call
19
- * returns 403 `GOVERNANCE_APPROVAL_REQUIRED` with an approval id, a person
20
- * approves it in the dashboard, then you retry passing `governanceApprovalId`.
17
+ * Every change applies at once and asks no one, loosening included (redaction
18
+ * off, a higher threshold, a narrower country list). `direction` in the answer
19
+ * says which way it went.
21
20
  *
22
21
  * @example
23
22
  * ```ts
24
23
  * // A Nordic operator: only run SE/NO/DK schemes, and demand less
25
24
  * // confidence because there is far less to confuse them with.
26
- * await stack.piiConfig.update(
27
- * { countries: ['SE', 'NO', 'DK'], threshold: 0.2 },
28
- * { governanceApprovalId: 'gvr_...' },
29
- * );
25
+ * await stack.piiConfig.update({ countries: ['SE', 'NO', 'DK'], threshold: 0.2 });
30
26
  *
31
27
  * const cfg = await stack.piiConfig.get();
32
28
  * // { configured: true, enabled: true, threshold: 0.2, countries: ['SE','NO','DK'] }
@@ -49,18 +45,12 @@ export class PiiConfigService {
49
45
  * Partial update. Omit a field to leave it untouched; pass `null` for
50
46
  * `threshold` or `countries` to clear it back to the built-in default.
51
47
  */
52
- async update(input, opts) {
53
- return this.client.put('/v1/pii/config', input, opts?.governanceApprovalId
54
- ? { headers: { 'X-Governance-Approval': opts.governanceApprovalId } }
55
- : undefined);
48
+ async update(input) {
49
+ return this.client.put('/v1/pii/config', input);
56
50
  }
57
- /** Delete the row and fall back to built-in defaults. Always needs the
58
- * governance approval: the direction of a reset is not knowable in
59
- * advance without reading the row being destroyed. */
60
- async reset(opts) {
61
- return this.client.delete('/v1/pii/config', opts?.governanceApprovalId
62
- ? { headers: { 'X-Governance-Approval': opts.governanceApprovalId } }
63
- : undefined);
51
+ /** Delete the row and fall back to built-in defaults. Applies at once. */
52
+ async reset() {
53
+ return this.client.delete('/v1/pii/config');
64
54
  }
65
55
  }
66
56
  //# sourceMappingURL=pii-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pii-config.js","sourceRoot":"","sources":["../../src/services/pii-config.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;OAIG;IACH,KAAK,CAAC,GAAG;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAY,gBAAgB,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,KAAsB,EAAE,IAAwC;QAC3E,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACpB,gBAAgB,EAChB,KAAK,EACL,IAAI,EAAE,oBAAoB;YACxB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,uBAAuB,EAAE,IAAI,CAAC,oBAAoB,EAAE,EAAE;YACrE,CAAC,CAAC,SAAS,CACd,CAAC;IACJ,CAAC;IAED;;2DAEuD;IACvD,KAAK,CAAC,KAAK,CAAC,IAAwC;QAClD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CACvB,gBAAgB,EAChB,IAAI,EAAE,oBAAoB;YACxB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,uBAAuB,EAAE,IAAI,CAAC,oBAAoB,EAAE,EAAE;YACrE,CAAC,CAAC,SAAS,CACd,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"pii-config.js","sourceRoot":"","sources":["../../src/services/pii-config.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE1C;;;;OAIG;IACH,KAAK,CAAC,GAAG;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAY,gBAAgB,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,KAAsB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAY,gBAAgB,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,KAAK;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAuB,gBAAgB,CAAC,CAAC;IACpE,CAAC;CACF"}
@@ -0,0 +1,240 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import type { AccountAgentCallOptions } from './accounts.js';
3
+ export type PostalAddressStatus = 'pending_identity' | 'active' | 'suspended' | 'closed';
4
+ export type PostalSuspendReason = 'supplier' | 'owner' | 'unpaid';
5
+ export type PostalItemKind = 'letter' | 'flat' | 'parcel';
6
+ export type PostalItemCustodyStatus = 'received' | 'stored' | 'held' | 'forwarding' | 'forwarded' | 'returning' | 'returned' | 'shredded' | 'disposed' | 'exception';
7
+ export type PostalRouting = 'routed' | 'pending' | 'unassigned';
8
+ /** How an agent reads an item: `offered` names no agent and any agent of the account may take it; `taken` was taken by `taken_by_agent_id`. */
9
+ export type PostalItemRouting = PostalRouting | 'offered' | 'taken';
10
+ export type PostalItemAction = 'scan' | 'forward' | 'shred';
11
+ export type PostalActionStatus = 'requested' | 'requires_approval' | 'approved' | 'in_progress' | 'done' | 'rejected' | 'failed' | 'cancelled';
12
+ /** `tracking_stopped`: still on its way 60 days after it was sent; STACK stopped following it, and the agent was told. */
13
+ export type LetterState = 'submitting' | 'sent' | 'in_transit' | 'delivered' | 'returned' | 'failed' | 'cancelled' | 'tracking_stopped';
14
+ /** A recipient or a forwarding destination. A US address needs a two-letter state. */
15
+ export interface PostalRecipientAddress {
16
+ name?: string;
17
+ company?: string;
18
+ line1: string;
19
+ line2?: string;
20
+ city: string;
21
+ state?: string;
22
+ postal_code: string;
23
+ /** ISO 3166-1 alpha-2, default US. */
24
+ country?: string;
25
+ }
26
+ export interface PostalAddress {
27
+ id: string;
28
+ supplier: 'mailbox_bot';
29
+ status: PostalAddressStatus;
30
+ suspend_reason: PostalSuspendReason | null;
31
+ /** The supplier's own pages, where the customer signs up and completes Form 1583. Null once active. */
32
+ identity: {
33
+ url: string | null;
34
+ note: string | null;
35
+ };
36
+ address: {
37
+ street: string;
38
+ suite: string | null;
39
+ city: string | null;
40
+ state: string | null;
41
+ postal_code: string | null;
42
+ country: 'US';
43
+ } | null;
44
+ /** Where the supplier's webhook for this address points, and whether STACK holds a secret to check it. */
45
+ webhook: {
46
+ url: string;
47
+ signed: boolean;
48
+ };
49
+ /** What STACK charges monthly; null while the supplier bills the customer directly. */
50
+ monthly_fee_cents: number | null;
51
+ last_error_code: string | null;
52
+ activated_at: string | null;
53
+ created_at: string;
54
+ }
55
+ export interface ConnectPostalAddressInput {
56
+ /** The agent-scoped key created at the supplier. A sandbox key and the account-wide key are refused. */
57
+ api_key: string;
58
+ /** The `whsec_` secret of the webhook endpoint created at the supplier, for faster delivery. Optional. */
59
+ webhook_secret?: string;
60
+ }
61
+ /** What an agent prints on a form: its own line on the shared address. */
62
+ export interface AccountPostalAddress {
63
+ status: PostalAddressStatus;
64
+ mailing: {
65
+ attn: string;
66
+ street: string;
67
+ suite: string | null;
68
+ city: string | null;
69
+ state: string | null;
70
+ postal_code: string | null;
71
+ country: 'US';
72
+ } | null;
73
+ note: string;
74
+ }
75
+ export interface PostalItemActionView {
76
+ id: string;
77
+ action: PostalItemAction;
78
+ status: PostalActionStatus;
79
+ /** What the supplier quoted, in US cents. The supplier charges the owner's own account. */
80
+ quote_cents: number | null;
81
+ /** The message holding a scan's text, once it arrived. */
82
+ message_id: string | null;
83
+ created_at: string;
84
+ completed_at: string | null;
85
+ }
86
+ export interface PostalItem {
87
+ id: string;
88
+ reference_code: string | null;
89
+ kind: PostalItemKind;
90
+ custody_status: PostalItemCustodyStatus;
91
+ routing: PostalItemRouting;
92
+ account_id: string | null;
93
+ /** Set when `routing` is `taken`: the agent that took the item first. */
94
+ taken_by_agent_id: string | null;
95
+ /** The message that told the agent the item arrived. Its text is untrusted third-party content. */
96
+ message_id: string | null;
97
+ received_at: string;
98
+ actions: PostalItemActionView[];
99
+ }
100
+ export interface ListPostalItemsQuery {
101
+ /** 1 to 50, default 20. */
102
+ limit?: number;
103
+ cursor?: string;
104
+ /** The owner's list only. */
105
+ routing?: PostalRouting;
106
+ }
107
+ export interface ListPostalItemsResult {
108
+ items: PostalItem[];
109
+ next_cursor: string | null;
110
+ }
111
+ export interface AddressCheck {
112
+ deliverability: 'deliverable' | 'undeliverable';
113
+ provider_deliverability: string | null;
114
+ standardized: PostalRecipientAddress | null;
115
+ notes: string[];
116
+ }
117
+ interface SendCommon {
118
+ to: PostalRecipientAddress;
119
+ /** Who the post is from: the name on the return address, above the agent's line. Required, up to 40 characters. */
120
+ sender_name: string;
121
+ /** The sender address printed on the letter. Without it, the account's street address is used. Returned post goes to this address. A US address, checked like the recipient's. */
122
+ return_address?: PostalRecipientAddress;
123
+ /** 8 to 128 characters. Name each of two identical letters; the request itself is the default. */
124
+ idempotency_key?: string;
125
+ description?: string;
126
+ /** Promotion is `marketing`; the providers treat the two differently. Required. */
127
+ use_type: 'operational' | 'marketing';
128
+ }
129
+ export interface SendLetterInput extends SendCommon {
130
+ kind?: 'letter';
131
+ /** Plain text, or a PDF as base64 (4 MiB decoded; pages are the provider's own limit: Lob's 60 single-sided or 120 double-sided, 6 or 12 for a letter abroad). */
132
+ content: {
133
+ text: string;
134
+ } | {
135
+ pdf_base64: string;
136
+ };
137
+ color?: boolean;
138
+ double_sided?: boolean;
139
+ mail_class?: 'first_class' | 'standard';
140
+ /** Certified mail goes first class. */
141
+ extra_service?: 'certified' | 'certified_return_receipt';
142
+ }
143
+ export interface SendPostcardInput extends SendCommon {
144
+ kind: 'postcard';
145
+ size?: '4x6' | '6x9';
146
+ /** Text only: a postcard from a PDF is not offered. */
147
+ front: {
148
+ text: string;
149
+ };
150
+ back: {
151
+ text: string;
152
+ };
153
+ }
154
+ export interface Letter {
155
+ id: string;
156
+ account_id: string;
157
+ kind: 'letter' | 'postcard';
158
+ provider: 'lob' | 'postgrid';
159
+ /** `submitting` means the provider has not answered yet; STACK retries under the same key. */
160
+ state: LetterState;
161
+ /** SHA-256 of the content the provider was given; also in the signed record. */
162
+ content_sha256: string;
163
+ page_count: number | null;
164
+ recipient_country: string;
165
+ held_cents: number;
166
+ charged_cents: number | null;
167
+ expected_delivery: string | null;
168
+ preview_url: string | null;
169
+ events: Array<{
170
+ name: string;
171
+ occurred_at: string;
172
+ location: string | null;
173
+ }>;
174
+ last_error_code: string | null;
175
+ created_at: string;
176
+ sent_at: string | null;
177
+ }
178
+ export interface ListLettersQuery {
179
+ limit?: number;
180
+ cursor?: string;
181
+ }
182
+ export interface ListLettersResult {
183
+ letters: Letter[];
184
+ next_cursor: string | null;
185
+ }
186
+ export interface PostAgentCallOptions extends AccountAgentCallOptions {
187
+ /** Names one action; a retry with the same key and input is the same action. */
188
+ idempotencyKey?: string;
189
+ }
190
+ export declare class PostService {
191
+ private readonly client;
192
+ constructor(client: HttpClient);
193
+ /** What the address is and what it waits for. 404 before the owner starts one. */
194
+ getAddress(): Promise<PostalAddress>;
195
+ /** Start the address: the customer's own steps at the supplier come next (`identity.url`). */
196
+ startAddress(): Promise<PostalAddress>;
197
+ /** Hand over the agent key the customer created at the supplier. Never returned; never through a chat tool. */
198
+ connectAddress(input: ConnectPostalAddressInput): Promise<PostalAddress>;
199
+ /** Look at the supplier again now. */
200
+ refreshAddress(): Promise<PostalAddress>;
201
+ pauseAddress(): Promise<PostalAddress>;
202
+ /** Lifts the owner's own pause; an unpaid or supplier suspension is not the owner's to lift. */
203
+ resumeAddress(): Promise<PostalAddress>;
204
+ /** Disconnect: STACK forgets the supplier key and the mailbox's own details (its address, private mailbox number and ids). The mailbox at the supplier is untouched, and every item and scan already received stays. */
205
+ closeAddress(): Promise<PostalAddress>;
206
+ /** Every item at the address, including those no agent has taken yet (`routing: 'unassigned'`: offered to every agent of the account). */
207
+ listItems(q?: ListPostalItemsQuery): Promise<ListPostalItemsResult>;
208
+ /** Give an item that no agent has taken to an account. */
209
+ assignItem(itemId: string, accountId: string): Promise<PostalItem>;
210
+ /** The agent's own line on the address, to print on a form. */
211
+ accountAddress(accountId: string, options?: PostAgentCallOptions): Promise<AccountPostalAddress>;
212
+ listAccountItems(accountId: string, q?: ListPostalItemsQuery, options?: PostAgentCallOptions): Promise<ListPostalItemsResult>;
213
+ getAccountItem(accountId: string, itemId: string, options?: PostAgentCallOptions): Promise<PostalItem>;
214
+ /** Ask the supplier to open and scan an item. The owner approves at the supplier; the text then arrives as a message. */
215
+ scanItem(accountId: string, itemId: string, input?: {
216
+ capture?: 'document_pdf' | 'contents_photos' | 'both';
217
+ }, options?: PostAgentCallOptions): Promise<PostalItem>;
218
+ /** Ask the supplier to forward an item inside the US. */
219
+ forwardItem(accountId: string, itemId: string, input: {
220
+ destination: PostalRecipientAddress;
221
+ mail_class?: string;
222
+ }, options?: PostAgentCallOptions): Promise<PostalItem>;
223
+ /** Ask the supplier to shred an item. It cannot be undone, so the request says it knows. */
224
+ shredItem(accountId: string, itemId: string, options?: PostAgentCallOptions): Promise<PostalItem>;
225
+ /** Whether an address is deliverable, and the address as the provider standardises it. */
226
+ checkAddress(accountId: string, address: PostalRecipientAddress, options?: PostAgentCallOptions): Promise<AddressCheck>;
227
+ /**
228
+ * Send a letter (text or PDF) or a postcard (text). 201 when the provider
229
+ * took it, 202 while it has not answered yet (`state: 'submitting'`; STACK
230
+ * retries under the same key), 200 for a repeat of a request already made.
231
+ * Refused, with nothing held: prohibited content, an undeliverable address,
232
+ * no live street address.
233
+ */
234
+ send(accountId: string, input: SendLetterInput | SendPostcardInput, options?: PostAgentCallOptions): Promise<Letter>;
235
+ listLetters(accountId: string, q?: ListLettersQuery, options?: PostAgentCallOptions): Promise<ListLettersResult>;
236
+ /** One letter with its tracking events. */
237
+ getLetter(accountId: string, letterId: string, options?: PostAgentCallOptions): Promise<Letter>;
238
+ }
239
+ export {};
240
+ //# sourceMappingURL=post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/services/post.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAiB7D,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AACzF,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAC1D,MAAM,MA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AY,CAAC;IAI7H;;;;;;OAMG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,iBAAiB,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIpH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,GAAE,gBAAqB,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI1H,2CAA2C;IACrC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC;CAGtG"}
@@ -0,0 +1,99 @@
1
+ const seg = encodeURIComponent;
2
+ function headers(options) {
3
+ const out = {};
4
+ if (options?.passportToken)
5
+ out['X-Passport-Token'] = options.passportToken;
6
+ if (options?.idempotencyKey)
7
+ out['Idempotency-Key'] = options.idempotencyKey;
8
+ return Object.keys(out).length > 0 ? { headers: out } : undefined;
9
+ }
10
+ function query(q) {
11
+ return { limit: q.limit !== undefined ? String(q.limit) : undefined, cursor: q.cursor, routing: q.routing };
12
+ }
13
+ export class PostService {
14
+ client;
15
+ constructor(client) {
16
+ this.client = client;
17
+ }
18
+ // ─── the customer's street address (owner or admin) ───────────────
19
+ /** What the address is and what it waits for. 404 before the owner starts one. */
20
+ async getAddress() {
21
+ return this.client.get('/v1/post/address');
22
+ }
23
+ /** Start the address: the customer's own steps at the supplier come next (`identity.url`). */
24
+ async startAddress() {
25
+ return this.client.post('/v1/post/address');
26
+ }
27
+ /** Hand over the agent key the customer created at the supplier. Never returned; never through a chat tool. */
28
+ async connectAddress(input) {
29
+ return this.client.post('/v1/post/address/connect', input);
30
+ }
31
+ /** Look at the supplier again now. */
32
+ async refreshAddress() {
33
+ return this.client.post('/v1/post/address/refresh');
34
+ }
35
+ async pauseAddress() {
36
+ return this.client.post('/v1/post/address/pause');
37
+ }
38
+ /** Lifts the owner's own pause; an unpaid or supplier suspension is not the owner's to lift. */
39
+ async resumeAddress() {
40
+ return this.client.post('/v1/post/address/resume');
41
+ }
42
+ /** Disconnect: STACK forgets the supplier key and the mailbox's own details (its address, private mailbox number and ids). The mailbox at the supplier is untouched, and every item and scan already received stays. */
43
+ async closeAddress() {
44
+ return this.client.delete('/v1/post/address');
45
+ }
46
+ /** Every item at the address, including those no agent has taken yet (`routing: 'unassigned'`: offered to every agent of the account). */
47
+ async listItems(q = {}) {
48
+ return this.client.get('/v1/post/items', query(q));
49
+ }
50
+ /** Give an item that no agent has taken to an account. */
51
+ async assignItem(itemId, accountId) {
52
+ return this.client.post(`/v1/post/items/${seg(itemId)}/assign`, { account_id: accountId });
53
+ }
54
+ // ─── an account's post ────────────────────────────────────────────
55
+ /** The agent's own line on the address, to print on a form. */
56
+ async accountAddress(accountId, options) {
57
+ return this.client.get(`/v1/accounts/${seg(accountId)}/post/address`, undefined, headers(options));
58
+ }
59
+ async listAccountItems(accountId, q = {}, options) {
60
+ return this.client.get(`/v1/accounts/${seg(accountId)}/post/items`, query(q), headers(options));
61
+ }
62
+ async getAccountItem(accountId, itemId, options) {
63
+ return this.client.get(`/v1/accounts/${seg(accountId)}/post/items/${seg(itemId)}`, undefined, headers(options));
64
+ }
65
+ /** Ask the supplier to open and scan an item. The owner approves at the supplier; the text then arrives as a message. */
66
+ async scanItem(accountId, itemId, input = {}, options) {
67
+ return this.client.post(`/v1/accounts/${seg(accountId)}/post/items/${seg(itemId)}/scan`, input, headers(options));
68
+ }
69
+ /** Ask the supplier to forward an item inside the US. */
70
+ async forwardItem(accountId, itemId, input, options) {
71
+ return this.client.post(`/v1/accounts/${seg(accountId)}/post/items/${seg(itemId)}/forward`, input, headers(options));
72
+ }
73
+ /** Ask the supplier to shred an item. It cannot be undone, so the request says it knows. */
74
+ async shredItem(accountId, itemId, options) {
75
+ return this.client.post(`/v1/accounts/${seg(accountId)}/post/items/${seg(itemId)}/shred`, { confirm: true }, headers(options));
76
+ }
77
+ /** Whether an address is deliverable, and the address as the provider standardises it. */
78
+ async checkAddress(accountId, address, options) {
79
+ return this.client.post(`/v1/accounts/${seg(accountId)}/post/address-check`, { address }, headers(options));
80
+ }
81
+ /**
82
+ * Send a letter (text or PDF) or a postcard (text). 201 when the provider
83
+ * took it, 202 while it has not answered yet (`state: 'submitting'`; STACK
84
+ * retries under the same key), 200 for a repeat of a request already made.
85
+ * Refused, with nothing held: prohibited content, an undeliverable address,
86
+ * no live street address.
87
+ */
88
+ async send(accountId, input, options) {
89
+ return this.client.post(`/v1/accounts/${seg(accountId)}/post/letters`, input, headers(options));
90
+ }
91
+ async listLetters(accountId, q = {}, options) {
92
+ return this.client.get(`/v1/accounts/${seg(accountId)}/post/letters`, query(q), headers(options));
93
+ }
94
+ /** One letter with its tracking events. */
95
+ async getLetter(accountId, letterId, options) {
96
+ return this.client.get(`/v1/accounts/${seg(accountId)}/post/letters/${seg(letterId)}`, undefined, headers(options));
97
+ }
98
+ }
99
+ //# sourceMappingURL=post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.js","sourceRoot":"","sources":["../../src/services/post.ts"],"names":[],"mappings":"AAsMA,MAAM,GAAG,GAAG,kBAAkB,CAAC;AAE/B,SAAS,OAAO,CAAC,OAA8B;IAC7C,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,IAAI,OAAO,EAAE,aAAa;QAAE,GAAG,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAC5E,IAAI,OAAO,EAAE,cAAc;QAAE,GAAG,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC;IAC7E,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC;AAED,SAAS,KAAK,CAAC,CAAwD;IACrE,OAAO,E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,CAAC,MAAM,CAAC,GAAG,CAAoB,gBAAgB,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACvH,CAAC;IAED,2CAA2C;IAC3C,KAAK,CAAC,SAAS,CAAC,SAAiB,EAAE,QAAgB,EAAE,OAA8B;QACjF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAS,gBAAgB,GAAG,CAAC,SAAS,CAAC,iBAAiB,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9H,CAAC;CACF"}
@@ -1,5 +1,6 @@
1
1
  import type { HttpClient } from '../client.js';
2
- import type { ProxyOperation, ProxyOperationOptions, ProxyRequest, ProxyRequestOptions, ProxyResponse, ProxyUsage } from '../types.js';
2
+ import type { ProxyOperation, ProxyOperationOptions, ProxyRequest, ProxyRequestOptions, ProxyResponse, ProxyUsage, ServiceCallOptions } from '../types.js';
3
+ import { type ServiceToolList, type ServiceToolResult } from '../service-mcp.js';
3
4
  export declare class ProxyService {
4
5
  private client;
5
6
  constructor(client: HttpClient);
@@ -9,22 +10,38 @@ export declare class ProxyService {
9
10
  * @param input - service (or legacy provider)/method/url/body shape, validated server-side
10
11
  * @param options - optional headers:
11
12
  * - `passportToken`: passport JWT (REQUIRED by /v1/proxy — sent as
12
- * `X-Passport-Token`). Pre-2.4 the SDK did not thread this; callers
13
- * had to use the raw HTTP API. Added in 2.4 alongside approvalId.
13
+ * `X-Passport-Token`).
14
14
  * - `approvalId`: approval id from `intents.submitAndWait`
15
- * (Sub-chunk 2.4). Sent as `X-Intent-Approval-Id`. Required when
15
+ * . Sent as `X-Intent-Approval-Id`. Required when
16
16
  * the calling passport is in enforced mode — submit the intent
17
17
  * first via `stack.intents.submitAndWait` and pass the returned
18
18
  * `final.id` here.
19
+ * - `input.connection`: the connection to use when the service has several (its name, any case, or its `scon_` id); sent only
20
+ * when given.
19
21
  * - `authorityRequestId`: stable operation handle. Non-GET calls create
20
22
  * one before network I/O when omitted and expose it as
21
23
  * `response.operationId` or `error.operationId`. Persist it and reuse
22
24
  * it only for an unchanged retry.
23
25
  */
24
26
  request(input: ProxyRequest, options?: ProxyRequestOptions): Promise<ProxyResponse>;
27
+ /**
28
+ * The tools a connected service that speaks MCP over HTTP offers (`tools/list`), sent through the credential proxy: the Passport,
29
+ * the Mission, the grant, the customer's decider, the meter and the audit record all apply. Works for any connected service whose
30
+ * connection carries its MCP address (`mcp_url`, given when it was connected) and for RentAHuman, whose address STACK knows. What comes
31
+ * back is the provider's words: `untrusted` is always true.
32
+ */
33
+ serviceTools(service: string, options?: ServiceCallOptions): Promise<ServiceToolList>;
34
+ /**
35
+ * Call one tool of a connected service (`tools/call`) through the credential proxy. Reuse `authorityRequestId` for an exact retry of
36
+ * a call with an effect (posting or funding a bounty, sending a message): one id is one operation. A service's own error is thrown;
37
+ * a tool that reports an error in its result comes back with `is_error` true. The result is the provider's words: `untrusted`.
38
+ */
39
+ serviceCallTool(service: string, tool: string, args?: Record<string, unknown>, options?: ServiceCallOptions): Promise<ServiceToolResult>;
40
+ /** The service's MCP address: its connection's own (never one a caller names; the proxy checks it against the connection's allowed hosts). */
41
+ private mcpUrl;
25
42
  /** Read delivery state and, when authorized, the stored screened response. */
26
43
  getOperation(operationId: string, options: ProxyOperationOptions): Promise<ProxyOperation>;
27
- /** Month-to-date action pool. `pooled` is set on white-label tenants. */
44
+ /** Month-to-date action pool. `pooled` is set on the accounts of a partner on a negotiated hard cap. */
28
45
  usage(): Promise<ProxyUsage>;
29
46
  }
30
47
  //# sourceMappingURL=proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/services/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,cAAc,EAC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