@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,40 @@
1
+ function passport(options) {
2
+ return options?.passportToken ? { headers: { 'X-Passport-Token': options.passportToken } } : undefined;
3
+ }
4
+ export class BrainService {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * Make drive files searchable: a file, a list of files, or every file whose name starts with a prefix. Returns one
11
+ * row per file with its status and an estimate of the pages reading it bills (the real pages are counted when the
12
+ * file is read). One action, checked against your controls.
13
+ */
14
+ async add(input, options) {
15
+ return this.client.post('/v1/brain/files', input, passport(options));
16
+ }
17
+ /** Take files out of the brain; they stay in the drive, only no longer searchable. Free. */
18
+ async remove(input, options) {
19
+ return this.client.post('/v1/brain/remove', input, passport(options));
20
+ }
21
+ /**
22
+ * Ask the brain a question and get the most relevant passages from the files the caller may see, each with its file
23
+ * and, for a PDF, the page. Up to 10 passages, every one untrusted content. Free.
24
+ */
25
+ async search(input, options) {
26
+ return this.client.post('/v1/brain/search', input, passport(options));
27
+ }
28
+ /**
29
+ * List the files in the brain the caller may see, each with its state and the month's usage (pages read, free pages
30
+ * left, what was charged). Free.
31
+ */
32
+ async list(query = {}, options) {
33
+ return this.client.get('/v1/brain/files', {
34
+ status: query.status,
35
+ cursor: query.cursor,
36
+ limit: query.limit !== undefined ? String(query.limit) : undefined,
37
+ }, passport(options));
38
+ }
39
+ }
40
+ //# sourceMappingURL=brain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brain.js","sourceRoot":"","sources":["../../src/services/brain.ts"],"names":[],"mappings":"AAuIA,SAAS,QAAQ,CAAC,OAA0B;IAC1C,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,MAAM,OAAO,YAAY;IACM;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;;;OAIG;IACH,KAAK,CAAC,GAAG,CAAC,KAAoB,EAAE,OAA0B;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAiB,iBAAiB,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,4FAA4F;IAC5F,KAAK,CAAC,MAAM,CAAC,KAAuB,EAAE,OAA0B;QAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAoB,kBAAkB,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,KAAuB,EAAE,OAA0B;QAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAoB,kBAAkB,EAAE,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,QAAwB,EAAE,EAAE,OAA0B;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACpB,iBAAiB,EACjB;YACE,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;SACnE,EACD,QAAQ,CAAC,OAAO,CAAC,CAClB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,256 @@
1
+ import type { HttpClient } from '../client.js';
2
+ import type { AccountAgentCallOptions, AccountSenderTag } from './accounts.js';
3
+ import type { MeetingVoice, MeetingVoiceSetting } from './meetings.js';
4
+ export type CalendarEventRole = 'organizer' | 'attendee';
5
+ export type CalendarEventStatus = 'confirmed' | 'tentative' | 'cancelled';
6
+ export type CalendarResponse = 'pending' | 'accepted' | 'tentative' | 'declined';
7
+ export type CalendarGuestStatus = 'needs_action' | 'accepted' | 'declined' | 'tentative' | 'delegated';
8
+ export type CalendarChangeScope = 'series' | 'occurrence' | 'following';
9
+ /** A guest: an address, or an address with the name to show. */
10
+ export type CalendarGuestInput = string | {
11
+ email: string;
12
+ name?: string;
13
+ };
14
+ export interface CalendarRepeatInput {
15
+ /** An RFC 5545 RRULE value, such as `FREQ=WEEKLY;BYDAY=MO,WE;UNTIL=20270101T000000Z`. */
16
+ rule: string;
17
+ /** Occurrences left out (EXDATE), written as `start` is. */
18
+ except?: string[];
19
+ /** Extra occurrences (RDATE), written as `start` is. */
20
+ also?: string[];
21
+ }
22
+ export interface CreateCalendarEventInput {
23
+ title: string;
24
+ start: string;
25
+ /** The end; with neither end nor a date start, the event has no length. A date start alone lasts the day. */
26
+ end?: string;
27
+ /** The IANA zone `start` and `end` are local to. */
28
+ time_zone?: string;
29
+ repeat?: CalendarRepeatInput;
30
+ /** Any text: a room, an address, a dial-in number. */
31
+ location?: string;
32
+ /** Any absolute URI (https:, zoommtg:, msteams:, tel: and others). With `meeting`, STACK's own room link is used instead. */
33
+ meeting_link?: string;
34
+ description?: string;
35
+ /** Each is sent the invite from the account's own address, and every change after it. */
36
+ guests?: CalendarGuestInput[];
37
+ /** Wake the agent this many minutes before each occurrence. */
38
+ wake_minutes_before?: number;
39
+ /** Give the event a meeting room of STACK's (Daily, EU): its link is the event's meeting link and goes in the invite. */
40
+ meeting?: boolean;
41
+ /** With `meeting`: STACK's meeting worker joins the room as the agent at each occurrence's start and wakes it ("Meeting started."). The customer's decider is asked once; a refusal makes the event without `attend` (`meeting.attend` in the answer). */
42
+ attend?: boolean;
43
+ /** With `attend`: how long the agent's part of each meeting may last, in seconds (60 or more). */
44
+ max_seconds?: number;
45
+ /** With `meeting`: the voice and language of the agent in this event's meetings; they replace the account's meeting voice for this event. */
46
+ meeting_voice?: MeetingVoice;
47
+ }
48
+ export interface UpdateCalendarEventInput {
49
+ title?: string;
50
+ start?: string;
51
+ end?: string | null;
52
+ time_zone?: string | null;
53
+ repeat?: CalendarRepeatInput | null;
54
+ location?: string;
55
+ meeting_link?: string | null;
56
+ description?: string;
57
+ guests?: CalendarGuestInput[];
58
+ wake_minutes_before?: number | null;
59
+ meeting?: boolean;
60
+ attend?: boolean;
61
+ max_seconds?: number | null;
62
+ /** The voice and language of the agent in this event's meetings; null clears them, so the account's meeting voice applies. */
63
+ meeting_voice?: MeetingVoice | null;
64
+ /** Which occurrence to change (its original start, as the agenda gives it). */
65
+ occurrence?: string;
66
+ /** The whole series (default without `occurrence`), that occurrence (default with it), or it and every later one. */
67
+ scope?: CalendarChangeScope;
68
+ /** The guest's proposal (`ccp_*`) this change accepts. */
69
+ counter_id?: string;
70
+ }
71
+ export interface CancelCalendarEventInput {
72
+ occurrence?: string;
73
+ scope?: CalendarChangeScope;
74
+ }
75
+ export interface RespondCalendarEventInput {
76
+ response: 'accept' | 'tentative' | 'decline';
77
+ /** Mail the organizer the answer (default true). False records it without telling anyone. */
78
+ notify_organizer?: boolean;
79
+ }
80
+ export interface ListCalendarEventsQuery {
81
+ role?: CalendarEventRole;
82
+ response?: CalendarResponse;
83
+ limit?: number;
84
+ cursor?: string;
85
+ }
86
+ export interface CalendarAgendaQuery {
87
+ from: string;
88
+ to: string;
89
+ /** The zone the agenda is written in. Default: the agent's wake-up time zone. */
90
+ time_zone?: string;
91
+ limit?: number;
92
+ cursor?: string;
93
+ }
94
+ export interface CalendarCounterProposal {
95
+ id: string;
96
+ from: string;
97
+ occurrence: string | null;
98
+ proposed_start: string | null;
99
+ proposed_end: string | null;
100
+ /** The guest's own words: third-party text. */
101
+ comment: string;
102
+ status: 'pending' | 'accepted' | 'declined';
103
+ received_at: string;
104
+ }
105
+ export interface CalendarEvent {
106
+ id: string;
107
+ account_id: string;
108
+ uid: string;
109
+ /** organizer: the agent's own event. attendee: an invite sent to it. */
110
+ role: CalendarEventRole;
111
+ status: CalendarEventStatus;
112
+ /** An invite: the agent's answer. Null for an own event. */
113
+ response: CalendarResponse | null;
114
+ sequence: number;
115
+ /** On an invite these are the sender's words: third-party text. */
116
+ title: string;
117
+ description: string;
118
+ location: string;
119
+ meeting_link: string | null;
120
+ start: string | null;
121
+ end: string | null;
122
+ time_zone: string | null;
123
+ all_day: boolean;
124
+ repeat: {
125
+ rule: string;
126
+ except: string[];
127
+ also: string[];
128
+ } | null;
129
+ changed_occurrences: Array<{
130
+ occurrence: string;
131
+ cancelled: boolean;
132
+ this_and_following: boolean;
133
+ start: string | null;
134
+ end: string | null;
135
+ title: string;
136
+ location: string;
137
+ meeting_link: string | null;
138
+ }>;
139
+ organizer: {
140
+ email: string;
141
+ name: string | null;
142
+ } | null;
143
+ guests: Array<{
144
+ email: string;
145
+ name: string | null;
146
+ status: CalendarGuestStatus;
147
+ }>;
148
+ counters: CalendarCounterProposal[];
149
+ meeting: {
150
+ provider: 'daily';
151
+ room: string;
152
+ attend: boolean;
153
+ max_seconds: number | null;
154
+ voice: MeetingVoiceSetting | null;
155
+ } | null;
156
+ wake_minutes_before: number | null;
157
+ next_wake_at: string | null;
158
+ /** An invite: who sent the mail, and STACK's own checks of that sender. They warn and never block. */
159
+ sender: string | null;
160
+ organizer_matches_sender: boolean;
161
+ sender_tags: AccountSenderTag[] | null;
162
+ sender_resembles: string | null;
163
+ message_id: string | null;
164
+ created_at: string;
165
+ updated_at: string;
166
+ }
167
+ export interface CalendarAgendaEntry {
168
+ event_id: string;
169
+ /** Names this occurrence to change or cancel it alone. */
170
+ occurrence: string;
171
+ title: string;
172
+ start: string;
173
+ end: string;
174
+ all_day: boolean;
175
+ location: string;
176
+ meeting_link: string | null;
177
+ role: CalendarEventRole;
178
+ response: CalendarResponse | null;
179
+ /** This occurrence differs from the series (moved or changed). */
180
+ changed: boolean;
181
+ }
182
+ export interface CalendarAgenda {
183
+ time_zone: string;
184
+ occurrences: CalendarAgendaEntry[];
185
+ next_cursor: string | null;
186
+ /** False when a repeat rule needed more steps than one read takes: what is listed is right, and more may follow. */
187
+ complete: boolean;
188
+ }
189
+ /** What a change told the guests. */
190
+ export interface CalendarNotices {
191
+ sent: boolean;
192
+ reason: string | null;
193
+ message_ids: string[];
194
+ }
195
+ export interface CalendarChange {
196
+ event: CalendarEvent;
197
+ /** A change of this and the following occurrences: the new event that carries them. */
198
+ following: CalendarEvent | null;
199
+ notices: CalendarNotices;
200
+ }
201
+ export interface RespondCalendarEventResult {
202
+ event: CalendarEvent;
203
+ reply: {
204
+ sent: boolean;
205
+ reason: string | null;
206
+ message_id: string | null;
207
+ };
208
+ }
209
+ export interface CalendarFeed {
210
+ exists: boolean;
211
+ /** Only when the feed was just made or rotated: shown once, never stored. */
212
+ url: string | null;
213
+ created_at: string | null;
214
+ rotated_at: string | null;
215
+ }
216
+ export declare class CalendarService {
217
+ private readonly client;
218
+ constructor(client: HttpClient);
219
+ private base;
220
+ /** The events and invites on the account's calendar, soonest first. A repeating event is listed once. */
221
+ listEvents(accountId: string, query?: ListCalendarEventsQuery, options?: AccountAgentCallOptions): Promise<{
222
+ events: CalendarEvent[];
223
+ next_cursor: string | null;
224
+ }>;
225
+ getEvent(accountId: string, eventId: string, options?: AccountAgentCallOptions): Promise<CalendarEvent>;
226
+ /** Occurrences between two times with repeats expanded, changes and cancellations applied, in a time zone. */
227
+ agenda(accountId: string, query: CalendarAgendaQuery, options?: AccountAgentCallOptions): Promise<CalendarAgenda>;
228
+ /** Make an event. One action; each guest is mailed the invite. */
229
+ createEvent(accountId: string, input: CreateCalendarEventInput, options?: AccountAgentCallOptions): Promise<CalendarChange>;
230
+ /** Change an event, one occurrence of it, or it and the following. One action; the guests get the update. */
231
+ updateEvent(accountId: string, eventId: string, input: UpdateCalendarEventInput, options?: AccountAgentCallOptions): Promise<CalendarChange>;
232
+ /** Cancel an event, one occurrence of it, or it and the following. One action; the guests are mailed the cancellation. */
233
+ cancelEvent(accountId: string, eventId: string, input?: CancelCalendarEventInput, options?: AccountAgentCallOptions): Promise<CalendarChange>;
234
+ /**
235
+ * Accept, decline or mark an invite tentative. One action: it mails the organizer an iCalendar reply from the account's
236
+ * own address (put to your decider as `email.send`), only when the organizer is who sent the invite. An accepted invite
237
+ * still to come wakes the agent before each occurrence, less `invite_lead_minutes`.
238
+ */
239
+ respond(accountId: string, eventId: string, input: RespondCalendarEventInput, options?: AccountAgentCallOptions): Promise<RespondCalendarEventResult>;
240
+ /** Turn down a guest's proposed time (the guest is mailed the refusal). To accept it, update the event with its `counter_id`. */
241
+ declineProposal(accountId: string, eventId: string, counterId: string, input?: {
242
+ comment?: string;
243
+ }, options?: AccountAgentCallOptions): Promise<CalendarChange>;
244
+ /** Whether the account has a feed (a private, read-only iCalendar URL for Google, Outlook or Apple Calendar). */
245
+ feed(accountId: string, options?: AccountAgentCallOptions): Promise<CalendarFeed>;
246
+ /**
247
+ * Make the feed, or give it a new URL (the old one stops at once). The URL is returned once; only a hash of its token is
248
+ * kept. Whoever holds the URL sees every event and the guests' addresses until it is rotated or ended.
249
+ */
250
+ rotateFeed(accountId: string, options?: AccountAgentCallOptions): Promise<CalendarFeed>;
251
+ /** End the feed: its URL stops working at once. */
252
+ revokeFeed(accountId: string, options?: AccountAgentCallOptions): Promise<{
253
+ revoked: boolean;
254
+ }>;
255
+ }
256
+ //# sourceMappingURL=calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/services/calendar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAgBvE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,UAAU,CAAC;AACzD,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AACjF,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;AACvG,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,WAAW,CAAC;AAExE,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,WAAW,m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,OAAO,CAAC,cAAc,CAAC;IAI1K,iHAAiH;IAC3G,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIvF;;;OAGG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,YAAY,CAAC;IAI7F,mDAAmD;IAC7C,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAGtG"}
@@ -0,0 +1,75 @@
1
+ const seg = encodeURIComponent;
2
+ function passport(options) {
3
+ return options?.passportToken ? { headers: { 'X-Passport-Token': options.passportToken } } : undefined;
4
+ }
5
+ export class CalendarService {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ base(accountId) {
11
+ return `/v1/accounts/${seg(accountId)}/calendar`;
12
+ }
13
+ /** The events and invites on the account's calendar, soonest first. A repeating event is listed once. */
14
+ async listEvents(accountId, query = {}, options) {
15
+ return this.client.get(`${this.base(accountId)}/events`, {
16
+ role: query.role,
17
+ response: query.response,
18
+ limit: query.limit !== undefined ? String(query.limit) : undefined,
19
+ cursor: query.cursor,
20
+ }, passport(options));
21
+ }
22
+ async getEvent(accountId, eventId, options) {
23
+ return this.client.get(`${this.base(accountId)}/events/${seg(eventId)}`, undefined, passport(options));
24
+ }
25
+ /** Occurrences between two times with repeats expanded, changes and cancellations applied, in a time zone. */
26
+ async agenda(accountId, query, options) {
27
+ return this.client.get(`${this.base(accountId)}/agenda`, {
28
+ from: query.from,
29
+ to: query.to,
30
+ time_zone: query.time_zone,
31
+ limit: query.limit !== undefined ? String(query.limit) : undefined,
32
+ cursor: query.cursor,
33
+ }, passport(options));
34
+ }
35
+ /** Make an event. One action; each guest is mailed the invite. */
36
+ async createEvent(accountId, input, options) {
37
+ return this.client.post(`${this.base(accountId)}/events`, input, passport(options));
38
+ }
39
+ /** Change an event, one occurrence of it, or it and the following. One action; the guests get the update. */
40
+ async updateEvent(accountId, eventId, input, options) {
41
+ return this.client.patch(`${this.base(accountId)}/events/${seg(eventId)}`, input, passport(options));
42
+ }
43
+ /** Cancel an event, one occurrence of it, or it and the following. One action; the guests are mailed the cancellation. */
44
+ async cancelEvent(accountId, eventId, input = {}, options) {
45
+ return this.client.post(`${this.base(accountId)}/events/${seg(eventId)}/cancel`, input, passport(options));
46
+ }
47
+ /**
48
+ * Accept, decline or mark an invite tentative. One action: it mails the organizer an iCalendar reply from the account's
49
+ * own address (put to your decider as `email.send`), only when the organizer is who sent the invite. An accepted invite
50
+ * still to come wakes the agent before each occurrence, less `invite_lead_minutes`.
51
+ */
52
+ async respond(accountId, eventId, input, options) {
53
+ return this.client.post(`${this.base(accountId)}/events/${seg(eventId)}/respond`, input, passport(options));
54
+ }
55
+ /** Turn down a guest's proposed time (the guest is mailed the refusal). To accept it, update the event with its `counter_id`. */
56
+ async declineProposal(accountId, eventId, counterId, input = {}, options) {
57
+ return this.client.post(`${this.base(accountId)}/events/${seg(eventId)}/counters/${seg(counterId)}/decline`, input, passport(options));
58
+ }
59
+ /** Whether the account has a feed (a private, read-only iCalendar URL for Google, Outlook or Apple Calendar). */
60
+ async feed(accountId, options) {
61
+ return this.client.get(`${this.base(accountId)}/feed`, undefined, passport(options));
62
+ }
63
+ /**
64
+ * Make the feed, or give it a new URL (the old one stops at once). The URL is returned once; only a hash of its token is
65
+ * kept. Whoever holds the URL sees every event and the guests' addresses until it is rotated or ended.
66
+ */
67
+ async rotateFeed(accountId, options) {
68
+ return this.client.post(`${this.base(accountId)}/feed`, undefined, passport(options));
69
+ }
70
+ /** End the feed: its URL stops working at once. */
71
+ async revokeFeed(accountId, options) {
72
+ return this.client.delete(`${this.base(accountId)}/feed`, passport(options));
73
+ }
74
+ }
75
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1 @@
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EAAE,OAAiC;QACnE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAuB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACrG,CAAC;CACF"}
@@ -0,0 +1,185 @@
1
+ import type { HttpClient } from '../client.js';
2
+ export type CatalogueEntryKind = 'model' | 'tool' | 'service' | 'skill' | 'account' | 'mcp_tool';
3
+ /** Who an `mcp_tool` is for: an agent's session, an owner's or a member's, or both. */
4
+ export type CatalogueToolAudience = 'agent' | 'owner' | 'both';
5
+ export type CatalogueOrigin = 'stack' | 'models' | 'tools' | 'publisher';
6
+ export type CatalogueSource = 'stack' | 'models' | 'tools' | 'services' | 'skills';
7
+ export type CatalogueSectionStatus = 'ok' | 'not_configured' | 'unavailable' | 'stale';
8
+ /** `lines`: the price is the list in `provider_cost.lines`, each line with a unit of its own. A unit you do not know is `varies`. */
9
+ export type CataloguePriceUnit = 'token' | 'call' | 'result' | 'image' | 'lines' | 'free' | 'varies';
10
+ /** What one line of a price is per. `audio_unit` is a second of audio or an audio token, as the model prices it. */
11
+ export type CataloguePricePer = 'token' | 'character' | 'second' | 'request' | 'image' | 'search' | 'megapixel_second' | 'generation' | 'audio_unit';
12
+ /** One price of a model as its provider lists it: `cost_usd_micros` for every `per_count` of `per`. */
13
+ export interface CataloguePriceLine {
14
+ /** The provider's own name for the price (`prompt`, `image_output`, `web_search`, `cents_per_second_output`, ...). */
15
+ item: string;
16
+ per: CataloguePricePer;
17
+ /** 1, or 1,000,000 when one unit costs less than a micro-dollar (a token always is per million). */
18
+ per_count: 1 | 1_000_000;
19
+ cost_usd_micros: number;
20
+ }
21
+ /** What the provider charges STACK, in millionths of a US dollar; whichever fields apply to the unit are set. */
22
+ export interface CatalogueProviderCost {
23
+ per_unit_usd_micros?: number;
24
+ flat_fee_usd_micros?: number;
25
+ input_per_million_tokens_usd_micros?: number;
26
+ output_per_million_tokens_usd_micros?: number;
27
+ worst_case_usd_micros?: number;
28
+ /** The prices a model provider lists beyond input and output tokens (all of them, for the unit `lines`). */
29
+ lines?: CataloguePriceLine[];
30
+ /** A fraction the provider takes off its prices: the charge is the figures times one minus this. */
31
+ discount?: number;
32
+ }
33
+ export interface CataloguePrice {
34
+ unit: CataloguePriceUnit;
35
+ currency: 'USD';
36
+ /** What the provider charges, passed through at cost; null when it is free or STACK cannot bound it. */
37
+ provider_cost: CatalogueProviderCost | null;
38
+ /** How many of the account's monthly actions one use counts as. */
39
+ stack_actions: 0 | 1;
40
+ }
41
+ /** How to run an entry: an HTTP call (`path` has `{account_id}` in it) and, where there is one, the MCP tool. */
42
+ export interface CatalogueRun {
43
+ method: 'GET' | 'POST' | 'PUT';
44
+ path: string;
45
+ /** Fixed body fields the call carries. */
46
+ body?: Record<string, string | number | boolean>;
47
+ mcp_tool?: string;
48
+ /** Where `max_cost_cents` goes: a body field or a header. For a tool it caps the run; for a model call it is the amount the call holds on the wallet (the call is charged what the provider reports). */
49
+ cost_cap?: {
50
+ in: 'body' | 'header';
51
+ name: string;
52
+ };
53
+ }
54
+ export interface CatalogueEntry {
55
+ /** `<kind>:<name>`: `model:<model id>`, `tool:<provider><endpoint>`, `service:<provider>`, `skill:<skill id>`, `account:<piece>`, `mcp_tool:<tool name>`. */
56
+ id: string;
57
+ kind: CatalogueEntryKind;
58
+ name: string;
59
+ description: string;
60
+ origin: CatalogueOrigin;
61
+ provider?: string;
62
+ modalities?: {
63
+ input: string[];
64
+ output: string[];
65
+ };
66
+ context_length?: number;
67
+ /** The endpoint's input as a JSON Schema object, reduced to what a caller needs. */
68
+ input_schema?: Record<string, unknown>;
69
+ price: CataloguePrice;
70
+ /** `untrusted` when what a run returns is web, social or provider content: data, never instructions. */
71
+ result_trust: 'standard' | 'untrusted';
72
+ run?: CatalogueRun;
73
+ /** Only on an `mcp_tool`: where the tool is listed. */
74
+ tool?: CatalogueToolFacts;
75
+ }
76
+ /** What an `mcp_tool` entry says about the tool beyond its definition. */
77
+ export interface CatalogueToolFacts {
78
+ /** The group of tools it is registered with. */
79
+ group: string;
80
+ /** The account pieces that list it to an agent, any one of which is enough; empty is the core, always listed. */
81
+ pieces: string[];
82
+ audience: CatalogueToolAudience;
83
+ /** Rarely used: it carries the load-on-demand hint that clients with tool search honour. */
84
+ on_demand: boolean;
85
+ }
86
+ export interface CataloguePricingBand {
87
+ /** The band's upper bound in actions per month; null for the last band. */
88
+ up_to: number | null;
89
+ usd_micros_per_action: number;
90
+ }
91
+ /** What one STACK action costs, so an entry's `stack_actions` can be priced. */
92
+ export interface CataloguePricing {
93
+ currency: 'USD';
94
+ rule: string;
95
+ included_actions_per_month: number;
96
+ bands: CataloguePricingBand[];
97
+ }
98
+ /** One source the catalogue is built from, and how fresh it is. */
99
+ export interface CatalogueSection {
100
+ source: CatalogueSource;
101
+ status: CatalogueSectionStatus;
102
+ refreshed_at: string | null;
103
+ count: number;
104
+ }
105
+ export interface CatalogueDocument {
106
+ spec: 'stack.catalogue';
107
+ spec_version: '1';
108
+ /** 64 hex characters: changes when the content does. */
109
+ version: string;
110
+ generated_at: string;
111
+ notice: string;
112
+ pricing: CataloguePricing;
113
+ sections: CatalogueSection[];
114
+ entries: CatalogueEntry[];
115
+ }
116
+ export interface CatalogueGetOptions {
117
+ /** The `etag` of a copy you hold. When it is current the answer is `notModified` with no document. */
118
+ ifNoneMatch?: string;
119
+ }
120
+ export interface CatalogueGetResult {
121
+ notModified: boolean;
122
+ /** The response's `ETag` (a weak tag over the document version); keep it for the next `ifNoneMatch`. */
123
+ etag: string | null;
124
+ /** The document; null when `notModified`. */
125
+ document: CatalogueDocument | null;
126
+ }
127
+ export interface CatalogueSearchQuery {
128
+ /** Words that must all appear in an entry's id, name, description or provider, in any case. */
129
+ q?: string;
130
+ kind?: CatalogueEntryKind;
131
+ /** 1 to 100, default 25. */
132
+ limit?: number;
133
+ /** 0 or more. */
134
+ offset?: number;
135
+ }
136
+ export interface CatalogueSearchResult {
137
+ version: string;
138
+ /** Every match, not only the page. */
139
+ total: number;
140
+ entries: CatalogueEntry[];
141
+ }
142
+ export interface CatalogueConnectedService {
143
+ /** `service:<provider>`. */
144
+ id: string;
145
+ provider: string;
146
+ name: string;
147
+ connection_id: string;
148
+ }
149
+ export interface CatalogueAccountPiece {
150
+ /** `account:<piece>`. */
151
+ id: string;
152
+ state: 'pending' | 'ready' | 'paused' | 'failed' | 'closing' | 'closed';
153
+ }
154
+ export interface CatalogueAccountTool {
155
+ /** `mcp_tool:<tool name>`. */
156
+ id: string;
157
+ /** Whether an agent session of the account lists the tool now. */
158
+ listed: boolean;
159
+ }
160
+ /** What one agent account has of the catalogue: the services it is connected to, the state of its pieces and which tools its agent lists. */
161
+ export interface CatalogueAccountView {
162
+ account_id: string;
163
+ /** The version of the catalogue the ids refer to; null when none is built yet. */
164
+ catalogue_version: string | null;
165
+ connected_services: CatalogueConnectedService[];
166
+ pieces: CatalogueAccountPiece[];
167
+ /** Every `mcp_tool` entry and whether an agent session of this account lists it now. */
168
+ tools?: CatalogueAccountTool[];
169
+ }
170
+ export declare class CatalogueService {
171
+ private readonly client;
172
+ constructor(client: HttpClient);
173
+ /**
174
+ * The whole catalogue. Pass the `etag` of a copy you hold as `ifNoneMatch`:
175
+ * when it is current the answer is `{ notModified: true, document: null }`.
176
+ * Answers 503 `CATALOGUE_UNAVAILABLE` (`details.reason` `not_built` or
177
+ * `store_unavailable`) when the catalogue has not been built yet.
178
+ */
179
+ get(options?: CatalogueGetOptions): Promise<CatalogueGetResult>;
180
+ /** Entries whose id, name, description or provider contain every word of `q`, filtered by `kind`, one page at a time. */
181
+ search(query?: CatalogueSearchQuery): Promise<CatalogueSearchResult>;
182
+ /** The services one of your agent accounts is connected to and the state of its pieces, by catalogue id. */
183
+ forAccount(accountId: string): Promise<CatalogueAccountView>;
184
+ }
185
+ //# sourceMappingURL=catalogue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue.d.ts","sourceRoot":"","sources":["../../src/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CAAC;IAChC,wFAAwF;IACxF,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAID,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAE/C;;;;;OAKG;IACG,GAAG,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKzE,yHAAyH;IACnH,MAAM,CAAC,KAAK,GAAE,oBAAyB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAS9E,4GAA4G;IACtG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAGnE"}
@@ -0,0 +1,31 @@
1
+ const seg = encodeURIComponent;
2
+ export class CatalogueService {
3
+ client;
4
+ constructor(client) {
5
+ this.client = client;
6
+ }
7
+ /**
8
+ * The whole catalogue. Pass the `etag` of a copy you hold as `ifNoneMatch`:
9
+ * when it is current the answer is `{ notModified: true, document: null }`.
10
+ * Answers 503 `CATALOGUE_UNAVAILABLE` (`details.reason` `not_built` or
11
+ * `store_unavailable`) when the catalogue has not been built yet.
12
+ */
13
+ async get(options = {}) {
14
+ const res = await this.client.getConditional('/v1/catalogue', { ifNoneMatch: options.ifNoneMatch });
15
+ return { notModified: res.status === 304, etag: res.etag, document: res.body };
16
+ }
17
+ /** Entries whose id, name, description or provider contain every word of `q`, filtered by `kind`, one page at a time. */
18
+ async search(query = {}) {
19
+ return this.client.get('/v1/catalogue/search', {
20
+ q: query.q,
21
+ kind: query.kind,
22
+ limit: query.limit !== undefined ? String(query.limit) : undefined,
23
+ offset: query.offset !== undefined ? String(query.offset) : undefined,
24
+ });
25
+ }
26
+ /** The services one of your agent accounts is connected to and the state of its pieces, by catalogue id. */
27
+ async forAccount(accountId) {
28
+ return this.client.get(`/v1/accounts/${seg(accountId)}/catalogue`);
29
+ }
30
+ }
31
+ //# sourceMappingURL=catalogue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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