@agentjam/sdk 0.0.0-stage → 0.1.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 (274) hide show
  1. package/README.md +181 -2
  2. package/dist/adapters/ai.d.ts +47 -0
  3. package/dist/adapters/ai.d.ts.map +1 -0
  4. package/dist/adapters/ai.js +168 -0
  5. package/dist/adapters/ai.js.map +1 -0
  6. package/dist/adapters/anthropic.d.ts +68 -0
  7. package/dist/adapters/anthropic.d.ts.map +1 -0
  8. package/dist/adapters/anthropic.js +193 -0
  9. package/dist/adapters/anthropic.js.map +1 -0
  10. package/dist/adapters/openai.d.ts +35 -0
  11. package/dist/adapters/openai.d.ts.map +1 -0
  12. package/dist/adapters/openai.js +80 -0
  13. package/dist/adapters/openai.js.map +1 -0
  14. package/dist/adapters/openaiAgents.d.ts +39 -0
  15. package/dist/adapters/openaiAgents.d.ts.map +1 -0
  16. package/dist/adapters/openaiAgents.js +152 -0
  17. package/dist/adapters/openaiAgents.js.map +1 -0
  18. package/dist/adapters/shared.d.ts +72 -0
  19. package/dist/adapters/shared.d.ts.map +1 -0
  20. package/dist/adapters/shared.js +174 -0
  21. package/dist/adapters/shared.js.map +1 -0
  22. package/dist/agent.d.ts +462 -0
  23. package/dist/agent.d.ts.map +1 -0
  24. package/dist/agent.js +1820 -0
  25. package/dist/agent.js.map +1 -0
  26. package/dist/artifacts.d.ts +79 -0
  27. package/dist/artifacts.d.ts.map +1 -0
  28. package/dist/artifacts.js +367 -0
  29. package/dist/artifacts.js.map +1 -0
  30. package/dist/attachments.d.ts +43 -0
  31. package/dist/attachments.d.ts.map +1 -0
  32. package/dist/attachments.js +69 -0
  33. package/dist/attachments.js.map +1 -0
  34. package/dist/connections.d.ts +109 -0
  35. package/dist/connections.d.ts.map +1 -0
  36. package/dist/connections.js +274 -0
  37. package/dist/connections.js.map +1 -0
  38. package/dist/content.d.ts +36 -0
  39. package/dist/content.d.ts.map +1 -0
  40. package/dist/content.js +21 -0
  41. package/dist/content.js.map +1 -0
  42. package/dist/cron.d.ts +31 -0
  43. package/dist/cron.d.ts.map +1 -0
  44. package/dist/cron.js +93 -0
  45. package/dist/cron.js.map +1 -0
  46. package/dist/errors.d.ts +227 -0
  47. package/dist/errors.d.ts.map +1 -0
  48. package/dist/errors.js +253 -0
  49. package/dist/errors.js.map +1 -0
  50. package/dist/events.d.ts +57 -0
  51. package/dist/events.d.ts.map +1 -0
  52. package/dist/events.js +24 -0
  53. package/dist/events.js.map +1 -0
  54. package/dist/idempotency.d.ts +21 -0
  55. package/dist/idempotency.d.ts.map +1 -0
  56. package/dist/idempotency.js +46 -0
  57. package/dist/idempotency.js.map +1 -0
  58. package/dist/index.d.ts +44 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +18 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/inputs.d.ts +22 -0
  63. package/dist/inputs.d.ts.map +1 -0
  64. package/dist/inputs.js +72 -0
  65. package/dist/inputs.js.map +1 -0
  66. package/dist/mpp.d.ts +76 -0
  67. package/dist/mpp.d.ts.map +1 -0
  68. package/dist/mpp.js +113 -0
  69. package/dist/mpp.js.map +1 -0
  70. package/dist/oauth.d.ts +3 -0
  71. package/dist/oauth.d.ts.map +1 -0
  72. package/dist/oauth.js +2 -0
  73. package/dist/oauth.js.map +1 -0
  74. package/dist/oauthCallbacks.d.ts +2 -0
  75. package/dist/oauthCallbacks.d.ts.map +1 -0
  76. package/dist/oauthCallbacks.js +58 -0
  77. package/dist/oauthCallbacks.js.map +1 -0
  78. package/dist/platforms/datadog.d.ts +10 -0
  79. package/dist/platforms/datadog.d.ts.map +1 -0
  80. package/dist/platforms/datadog.js +15 -0
  81. package/dist/platforms/datadog.js.map +1 -0
  82. package/dist/platforms/github.d.ts +181 -0
  83. package/dist/platforms/github.d.ts.map +1 -0
  84. package/dist/platforms/github.js +468 -0
  85. package/dist/platforms/github.js.map +1 -0
  86. package/dist/platforms/google.d.ts +19 -0
  87. package/dist/platforms/google.d.ts.map +1 -0
  88. package/dist/platforms/google.js +70 -0
  89. package/dist/platforms/google.js.map +1 -0
  90. package/dist/platforms/grafana.d.ts +10 -0
  91. package/dist/platforms/grafana.d.ts.map +1 -0
  92. package/dist/platforms/grafana.js +14 -0
  93. package/dist/platforms/grafana.js.map +1 -0
  94. package/dist/platforms/posthog.d.ts +10 -0
  95. package/dist/platforms/posthog.d.ts.map +1 -0
  96. package/dist/platforms/posthog.js +14 -0
  97. package/dist/platforms/posthog.js.map +1 -0
  98. package/dist/platforms/presets.d.ts +34 -0
  99. package/dist/platforms/presets.d.ts.map +1 -0
  100. package/dist/platforms/presets.js +36 -0
  101. package/dist/platforms/presets.js.map +1 -0
  102. package/dist/platforms/sentry.d.ts +79 -0
  103. package/dist/platforms/sentry.d.ts.map +1 -0
  104. package/dist/platforms/sentry.js +124 -0
  105. package/dist/platforms/sentry.js.map +1 -0
  106. package/dist/platforms/slack.d.ts +101 -0
  107. package/dist/platforms/slack.d.ts.map +1 -0
  108. package/dist/platforms/slack.js +309 -0
  109. package/dist/platforms/slack.js.map +1 -0
  110. package/dist/platforms/splunk.d.ts +10 -0
  111. package/dist/platforms/splunk.d.ts.map +1 -0
  112. package/dist/platforms/splunk.js +14 -0
  113. package/dist/platforms/splunk.js.map +1 -0
  114. package/dist/polling.d.ts +2 -0
  115. package/dist/polling.d.ts.map +1 -0
  116. package/dist/polling.js +66 -0
  117. package/dist/polling.js.map +1 -0
  118. package/dist/profile.d.ts +60 -0
  119. package/dist/profile.d.ts.map +1 -0
  120. package/dist/profile.js +119 -0
  121. package/dist/profile.js.map +1 -0
  122. package/dist/protocol.d.ts +474 -0
  123. package/dist/protocol.d.ts.map +1 -0
  124. package/dist/protocol.js +2 -0
  125. package/dist/protocol.js.map +1 -0
  126. package/dist/providers.d.ts +113 -0
  127. package/dist/providers.d.ts.map +1 -0
  128. package/dist/providers.js +98 -0
  129. package/dist/providers.js.map +1 -0
  130. package/dist/recaps.d.ts +10 -0
  131. package/dist/recaps.d.ts.map +1 -0
  132. package/dist/recaps.js +49 -0
  133. package/dist/recaps.js.map +1 -0
  134. package/dist/relay/chains.d.ts +62 -0
  135. package/dist/relay/chains.d.ts.map +1 -0
  136. package/dist/relay/chains.js +150 -0
  137. package/dist/relay/chains.js.map +1 -0
  138. package/dist/relay/credentials.d.ts +25 -0
  139. package/dist/relay/credentials.d.ts.map +1 -0
  140. package/dist/relay/credentials.js +234 -0
  141. package/dist/relay/credentials.js.map +1 -0
  142. package/dist/relay/endpoints.d.ts +13 -0
  143. package/dist/relay/endpoints.d.ts.map +1 -0
  144. package/dist/relay/endpoints.js +13 -0
  145. package/dist/relay/endpoints.js.map +1 -0
  146. package/dist/relay/frames.d.ts +193 -0
  147. package/dist/relay/frames.d.ts.map +1 -0
  148. package/dist/relay/frames.js +161 -0
  149. package/dist/relay/frames.js.map +1 -0
  150. package/dist/relay/grants.d.ts +158 -0
  151. package/dist/relay/grants.d.ts.map +1 -0
  152. package/dist/relay/grants.js +2 -0
  153. package/dist/relay/grants.js.map +1 -0
  154. package/dist/relay/guestStore.d.ts +37 -0
  155. package/dist/relay/guestStore.d.ts.map +1 -0
  156. package/dist/relay/guestStore.js +61 -0
  157. package/dist/relay/guestStore.js.map +1 -0
  158. package/dist/relay/guests.d.ts +7 -0
  159. package/dist/relay/guests.d.ts.map +1 -0
  160. package/dist/relay/guests.js +30 -0
  161. package/dist/relay/guests.js.map +1 -0
  162. package/dist/relay/memory.d.ts +60 -0
  163. package/dist/relay/memory.d.ts.map +1 -0
  164. package/dist/relay/memory.js +334 -0
  165. package/dist/relay/memory.js.map +1 -0
  166. package/dist/relay/payments.d.ts +43 -0
  167. package/dist/relay/payments.d.ts.map +1 -0
  168. package/dist/relay/payments.js +115 -0
  169. package/dist/relay/payments.js.map +1 -0
  170. package/dist/relay/profiles.d.ts +10 -0
  171. package/dist/relay/profiles.d.ts.map +1 -0
  172. package/dist/relay/profiles.js +43 -0
  173. package/dist/relay/profiles.js.map +1 -0
  174. package/dist/relay/relay.d.ts +133 -0
  175. package/dist/relay/relay.d.ts.map +1 -0
  176. package/dist/relay/relay.js +2 -0
  177. package/dist/relay/relay.js.map +1 -0
  178. package/dist/relay/remote.d.ts +39 -0
  179. package/dist/relay/remote.d.ts.map +1 -0
  180. package/dist/relay/remote.js +492 -0
  181. package/dist/relay/remote.js.map +1 -0
  182. package/dist/relay/revisions.d.ts +13 -0
  183. package/dist/relay/revisions.d.ts.map +1 -0
  184. package/dist/relay/revisions.js +34 -0
  185. package/dist/relay/revisions.js.map +1 -0
  186. package/dist/relay/schedules.d.ts +41 -0
  187. package/dist/relay/schedules.d.ts.map +1 -0
  188. package/dist/relay/schedules.js +217 -0
  189. package/dist/relay/schedules.js.map +1 -0
  190. package/dist/relay/secrets.d.ts +14 -0
  191. package/dist/relay/secrets.d.ts.map +1 -0
  192. package/dist/relay/secrets.js +30 -0
  193. package/dist/relay/secrets.js.map +1 -0
  194. package/dist/relay/sessions.d.ts +59 -0
  195. package/dist/relay/sessions.d.ts.map +1 -0
  196. package/dist/relay/sessions.js +282 -0
  197. package/dist/relay/sessions.js.map +1 -0
  198. package/dist/relay/uploads.d.ts +15 -0
  199. package/dist/relay/uploads.d.ts.map +1 -0
  200. package/dist/relay/uploads.js +55 -0
  201. package/dist/relay/uploads.js.map +1 -0
  202. package/dist/requests.d.ts +22 -0
  203. package/dist/requests.d.ts.map +1 -0
  204. package/dist/requests.js +64 -0
  205. package/dist/requests.js.map +1 -0
  206. package/dist/screening.d.ts +93 -0
  207. package/dist/screening.d.ts.map +1 -0
  208. package/dist/screening.js +176 -0
  209. package/dist/screening.js.map +1 -0
  210. package/dist/secrets.d.ts +38 -0
  211. package/dist/secrets.d.ts.map +1 -0
  212. package/dist/secrets.js +162 -0
  213. package/dist/secrets.js.map +1 -0
  214. package/dist/skills.d.ts +11 -0
  215. package/dist/skills.d.ts.map +1 -0
  216. package/dist/skills.js +55 -0
  217. package/dist/skills.js.map +1 -0
  218. package/dist/stripe.d.ts +10 -0
  219. package/dist/stripe.d.ts.map +1 -0
  220. package/dist/stripe.js +51 -0
  221. package/dist/stripe.js.map +1 -0
  222. package/dist/tasks/access.d.ts +35 -0
  223. package/dist/tasks/access.d.ts.map +1 -0
  224. package/dist/tasks/access.js +101 -0
  225. package/dist/tasks/access.js.map +1 -0
  226. package/dist/tasks/incoming.d.ts +333 -0
  227. package/dist/tasks/incoming.d.ts.map +1 -0
  228. package/dist/tasks/incoming.js +354 -0
  229. package/dist/tasks/incoming.js.map +1 -0
  230. package/dist/tasks/outgoing.d.ts +137 -0
  231. package/dist/tasks/outgoing.d.ts.map +1 -0
  232. package/dist/tasks/outgoing.js +233 -0
  233. package/dist/tasks/outgoing.js.map +1 -0
  234. package/dist/tasks/scheduled.d.ts +76 -0
  235. package/dist/tasks/scheduled.d.ts.map +1 -0
  236. package/dist/tasks/scheduled.js +110 -0
  237. package/dist/tasks/scheduled.js.map +1 -0
  238. package/dist/tasks/triggers.d.ts +47 -0
  239. package/dist/tasks/triggers.d.ts.map +1 -0
  240. package/dist/tasks/triggers.js +149 -0
  241. package/dist/tasks/triggers.js.map +1 -0
  242. package/dist/tasks/watches.d.ts +13 -0
  243. package/dist/tasks/watches.d.ts.map +1 -0
  244. package/dist/tasks/watches.js +54 -0
  245. package/dist/tasks/watches.js.map +1 -0
  246. package/dist/tools.d.ts +85 -0
  247. package/dist/tools.d.ts.map +1 -0
  248. package/dist/tools.js +627 -0
  249. package/dist/tools.js.map +1 -0
  250. package/dist/types.d.ts +926 -0
  251. package/dist/types.d.ts.map +1 -0
  252. package/dist/types.js +2 -0
  253. package/dist/types.js.map +1 -0
  254. package/dist/vaults/local.d.ts +54 -0
  255. package/dist/vaults/local.d.ts.map +1 -0
  256. package/dist/vaults/local.js +362 -0
  257. package/dist/vaults/local.js.map +1 -0
  258. package/dist/vaults/remote.d.ts +78 -0
  259. package/dist/vaults/remote.d.ts.map +1 -0
  260. package/dist/vaults/remote.js +295 -0
  261. package/dist/vaults/remote.js.map +1 -0
  262. package/dist/vaults/vault.d.ts +69 -0
  263. package/dist/vaults/vault.d.ts.map +1 -0
  264. package/dist/vaults/vault.js +19 -0
  265. package/dist/vaults/vault.js.map +1 -0
  266. package/dist/verdicts.d.ts +15 -0
  267. package/dist/verdicts.d.ts.map +1 -0
  268. package/dist/verdicts.js +17 -0
  269. package/dist/verdicts.js.map +1 -0
  270. package/dist/watermarks.d.ts +29 -0
  271. package/dist/watermarks.d.ts.map +1 -0
  272. package/dist/watermarks.js +11 -0
  273. package/dist/watermarks.js.map +1 -0
  274. package/package.json +152 -3
package/dist/cron.js ADDED
@@ -0,0 +1,93 @@
1
+ import { Cron as Croner } from "croner";
2
+ export const DEFAULT_TIME_ZONE = "UTC";
3
+ const SECOND_MS = 1000;
4
+ const MINUTE_MS = 60 * SECOND_MS;
5
+ const YEAR_MS = 365 * 24 * 60 * MINUTE_MS;
6
+ const constructCron = ({ expression, timeZone = DEFAULT_TIME_ZONE }) => new Croner(expression, {
7
+ mode: "5-part",
8
+ timezone: timeZone,
9
+ fixedTimeRule: "no-wildcard",
10
+ paused: true,
11
+ });
12
+ export const computeNextRun = (cron, after) => constructCron(cron).nextRun(after) ?? undefined;
13
+ const constructOffsetReader = (timeZone = DEFAULT_TIME_ZONE) => {
14
+ const format = new Intl.DateTimeFormat("en-US", {
15
+ timeZone,
16
+ timeZoneName: "longOffset",
17
+ });
18
+ return (date) => format.formatToParts(date).find(({ type }) => type === "timeZoneName")
19
+ ?.value;
20
+ };
21
+ const computeShortestWithin = (job, first, last) => {
22
+ let shortest = Infinity;
23
+ let run = first;
24
+ let next = job.nextRun(run);
25
+ while (next && next <= last) {
26
+ shortest = Math.min(shortest, next.getTime() - run.getTime());
27
+ run = next;
28
+ next = job.nextRun(run);
29
+ }
30
+ return shortest;
31
+ };
32
+ /**
33
+ * Finds the shortest gap between runs, stopping early once `isShortEnough` holds for it. Every day's runs share one
34
+ * time of day pattern, so only days a time zone shift or the horizon reshapes are walked run by run.
35
+ */
36
+ const scanShortestGap = (cron, { from = new Date(), horizonMs = YEAR_MS }, isShortEnough) => {
37
+ const job = constructCron(cron);
38
+ const midnight = constructCron({ ...cron, expression: "0 0 * * *" });
39
+ const readOffset = constructOffsetReader(cron.timeZone);
40
+ const until = new Date(from.getTime() + horizonMs);
41
+ let shortest = Infinity;
42
+ let ordinary;
43
+ let previous;
44
+ let first = job.nextRun(from);
45
+ while (first && first <= until && !isShortEnough(shortest)) {
46
+ const dayEnd = midnight.nextRun(first) ?? until;
47
+ const [dayLast = first] = job.previousRuns(1, new Date(dayEnd.getTime() - SECOND_MS));
48
+ const isTruncated = dayLast > until;
49
+ const last = isTruncated ? until : dayLast;
50
+ const isOrdinary = previous !== undefined &&
51
+ !isTruncated &&
52
+ readOffset(first) === readOffset(dayLast);
53
+ if (previous) {
54
+ shortest = Math.min(shortest, first.getTime() - previous.getTime());
55
+ }
56
+ if (!isOrdinary || ordinary === undefined) {
57
+ const within = computeShortestWithin(job, first, last);
58
+ if (isOrdinary)
59
+ ordinary = within;
60
+ shortest = Math.min(shortest, within);
61
+ }
62
+ else {
63
+ shortest = Math.min(shortest, ordinary);
64
+ }
65
+ previous = last;
66
+ first = job.nextRun(last);
67
+ }
68
+ return shortest === Infinity ? undefined : shortest;
69
+ };
70
+ /**
71
+ * Computes the shortest gap between consecutive runs of a cron, reading it in its time zone across daylight saving
72
+ * changes. Use it to refuse schedules that would run more often than an agent allows.
73
+ *
74
+ * @param cron The cron expression and its time zone.
75
+ * @param options When to start looking and how far ahead, which default to now and a year.
76
+ * @returns The shortest gap in milliseconds, or undefined if the cron runs at most once in that span.
77
+ * @throws {Error} If the expression or time zone is invalid.
78
+ */
79
+ export const computeShortestInterval = (cron, options = {}) => scanShortestGap(cron, options, (gap) => gap <= MINUTE_MS);
80
+ /**
81
+ * Checks that no two consecutive runs of a cron are closer than `minimumMs`, such as in `onProposal` before accepting a schedule.
82
+ *
83
+ * @param cron The cron expression and its time zone.
84
+ * @param minimumMs The shortest gap allowed between runs, in milliseconds.
85
+ * @param options When to start looking and how far ahead, which default to now and a year.
86
+ * @returns Whether every gap in that span is at least `minimumMs`.
87
+ * @throws {Error} If the expression or time zone is invalid.
88
+ */
89
+ export const isIntervalAtLeast = (cron, minimumMs, options = {}) => {
90
+ const shortest = scanShortestGap(cron, options, (gap) => gap < minimumMs);
91
+ return shortest === undefined || shortest >= minimumMs;
92
+ };
93
+ //# sourceMappingURL=cron.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron.js","sourceRoot":"","sources":["../src/cron.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEvC,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,SAAS,GAAG,EAAE,GAAG,SAAS,CAAC;AACjC,MAAM,OAAO,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAU1C,MAAM,aAAa,GAAG,CAAC,EAAE,UAAU,EAAE,QAAQ,GAAG,iBAAiB,EAAQ,EAAE,EAAE,CAC3E,IAAI,MAAM,CAAC,UAAU,EAAE;IACrB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,QAAQ;IAClB,aAAa,EAAE,aAAa;IAC5B,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAU,EAAE,KAAW,EAAE,EAAE,CACxD,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC;AAElD,MAAM,qBAAqB,GAAG,CAAC,QAAQ,GAAG,iBAAiB,EAAE,EAAE;IAC7D,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAC9C,QAAQ;QACR,YAAY,EAAE,YAAY;KAC3B,CAAC,CAAC;IAEH,OAAO,C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;QAC1C,CAAC;QAED,QAAQ,GAAG,IAAI,CAAC;QAChB,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AACtD,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,IAAU,EACV,OAAO,GAAoB,EAAE,EAC7B,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC;AAE/D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAAU,EACV,SAAiB,EACjB,OAAO,GAAoB,EAAE,EAC7B,EAAE;IACF,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IAE1E,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,IAAI,SAAS,CAAC;AACzD,CAAC,CAAC"}
@@ -0,0 +1,227 @@
1
+ import type { LimitCode, TaskEndCode } from "./protocol.js";
2
+ export declare const addressMistake = "Either the username or the agent name is wrong (agents are addressed as username/agent-name)";
3
+ /** Base class for every error thrown by the AgentJam SDK. */
4
+ export declare class AgentJamError extends Error {
5
+ readonly name: string;
6
+ }
7
+ /**
8
+ * Thrown when a message or proposal is addressed to an agent that isn't connected, because either
9
+ * the username or the agent name in its `username/agent-name` address is wrong, or it's offline.
10
+ */
11
+ export declare class AgentNotFoundError extends AgentJamError {
12
+ /** The address of the agent that isn't connected. */
13
+ readonly agent: string;
14
+ readonly name = "AgentNotFoundError";
15
+ constructor(
16
+ /** The address of the agent that isn't connected. */
17
+ agent: string);
18
+ }
19
+ /**
20
+ * Thrown by `connect()` when another connection holds its `instanceId` past the connect timeout. A
21
+ * connection that ended without saying bye holds it for `retryAfterMs` more.
22
+ */
23
+ export declare class InstanceTakenError extends AgentJamError {
24
+ /** The name of the agent being connected. */
25
+ readonly agent: string;
26
+ /** The instance another connection holds. */
27
+ readonly instanceId: string;
28
+ /** How long until the held instance's lease lapses, in milliseconds. */
29
+ readonly retryAfterMs: number;
30
+ readonly name = "InstanceTakenError";
31
+ constructor(
32
+ /** The name of the agent being connected. */
33
+ agent: string,
34
+ /** The instance another connection holds. */
35
+ instanceId: string,
36
+ /** How long until the held instance's lease lapses, in milliseconds. */
37
+ retryAfterMs: number);
38
+ }
39
+ /** Thrown by `create()` when an agent with that name already exists. Pass `upsert: true` to update it instead. */
40
+ export declare class AgentExistsError extends AgentJamError {
41
+ readonly name = "AgentExistsError";
42
+ }
43
+ /** Thrown when a request gets no response within its timeout. */
44
+ export declare class TimeoutError extends AgentJamError {
45
+ readonly name = "TimeoutError";
46
+ }
47
+ /** Thrown by `propose()` when the recipient declines the task, or by a task's `result()` and `events()` if it declines after restarting. */
48
+ export declare class TaskRejectedError extends AgentJamError {
49
+ /** The agent that rejected the task. */
50
+ readonly agent: string;
51
+ /** Why the agent rejected the task. */
52
+ readonly reason: string;
53
+ readonly name = "TaskRejectedError";
54
+ constructor(
55
+ /** The agent that rejected the task. */
56
+ agent: string,
57
+ /** Why the agent rejected the task. */
58
+ reason: string);
59
+ }
60
+ /** Thrown by a task's `result()` and `events()` when the executor fails it, with a `code` once it failed because its requester couldn't fund a commit. */
61
+ export declare class TaskFailedError extends AgentJamError {
62
+ /** Why the requester couldn't fund the action its executor committed to, when that's why it failed. */
63
+ readonly code?: LimitCode | undefined;
64
+ readonly name = "TaskFailedError";
65
+ constructor(message: string,
66
+ /** Why the requester couldn't fund the action its executor committed to, when that's why it failed. */
67
+ code?: LimitCode | undefined);
68
+ }
69
+ /** Passed to an executor's `onError` when the relay gives up on a fired event that never started a run, so it may be fired again. */
70
+ export declare class TriggerFailedError extends AgentJamError {
71
+ /** The agent that requested the schedule. */
72
+ readonly requester: string;
73
+ /** The schedule the event was fired for. */
74
+ readonly scheduleId: string;
75
+ /** The `id` of the event that didn't start a run. */
76
+ readonly eventId: string;
77
+ readonly name = "TriggerFailedError";
78
+ constructor(
79
+ /** The agent that requested the schedule. */
80
+ requester: string,
81
+ /** The schedule the event was fired for. */
82
+ scheduleId: string,
83
+ /** The `id` of the event that didn't start a run. */
84
+ eventId: string, reason: string);
85
+ }
86
+ /** Passed to a requester's `onError` when a run of its schedule met the follow-up's condition, but the relay couldn't propose the follow-up. */
87
+ export declare class FollowUpFailedError extends AgentJamError {
88
+ /** The agent the follow-up was for. */
89
+ readonly agent: string;
90
+ /** The schedule whose run wasn't followed up. */
91
+ readonly scheduleId: string;
92
+ /** The run that wasn't followed up. */
93
+ readonly runId: string;
94
+ readonly name = "FollowUpFailedError";
95
+ constructor(
96
+ /** The agent the follow-up was for. */
97
+ agent: string,
98
+ /** The schedule whose run wasn't followed up. */
99
+ scheduleId: string,
100
+ /** The run that wasn't followed up. */
101
+ runId: string, reason: string);
102
+ }
103
+ /** Thrown by `dispatch()` when the relay never received the event, so no schedule ran for it and it may be dispatched again. */
104
+ export declare class DispatchFailedError extends AgentJamError {
105
+ /** The `id` of the event that wasn't dispatched. */
106
+ readonly eventId: string;
107
+ readonly name = "DispatchFailedError";
108
+ constructor(
109
+ /** The `id` of the event that wasn't dispatched. */
110
+ eventId: string, reason: string);
111
+ }
112
+ /**
113
+ * Thrown by a task's `result()` and `events()` once it has been canceled, and the reason an executor's
114
+ * `task.signal` aborts. A task the relay canceled once its requester could fund no more of it has a `code`.
115
+ */
116
+ export declare class TaskCanceledError extends AgentJamError {
117
+ /** Why the relay ended the task, such as `insufficient_credits`. */
118
+ readonly code?: TaskEndCode | undefined;
119
+ readonly name = "TaskCanceledError";
120
+ constructor(message: string,
121
+ /** Why the relay ended the task, such as `insufficient_credits`. */
122
+ code?: TaskEndCode | undefined);
123
+ }
124
+ /** Thrown by a task's `cancel()` once its executor committed to an action it can't undo, such as a purchase, so the task keeps running. */
125
+ export declare class TaskCommittedError extends AgentJamError {
126
+ readonly name = "TaskCommittedError";
127
+ }
128
+ /** Thrown by a task's `commit()` when its requester can't fund the cost plus the skill's markup, within their `maxPriceCents`, spending cap and wallet. */
129
+ export declare class UncoveredCostError extends AgentJamError {
130
+ /** The cents the relay must hold from the requester to cover the cost. */
131
+ readonly requiredCents: number;
132
+ /** Why the requester can't fund it, such as `reload_failed` once their wallet's auto-reload failed to charge their payment method. */
133
+ readonly code: LimitCode;
134
+ readonly name = "UncoveredCostError";
135
+ constructor(message: string,
136
+ /** The cents the relay must hold from the requester to cover the cost. */
137
+ requiredCents: number,
138
+ /** Why the requester can't fund it, such as `reload_failed` once their wallet's auto-reload failed to charge their payment method. */
139
+ code: LimitCode);
140
+ }
141
+ /**
142
+ * Why a proposal to a priced skill or a top-up went unpaid. The relay reports `unclaimed` for a guest, which can
143
+ * only run free tasks, and the others up to `price_too_high` when it can't reserve the price from your
144
+ * credits; top-ups through `payments` report the last two.
145
+ */
146
+ export type PaymentRequiredReason = "unclaimed" | "no_payment_method" | "insufficient_credits" | "cap_reached" | "exceeds_cap" | "invalid_payment" | "price_too_high" | "below_card_minimum" | "payment_failed";
147
+ /**
148
+ * Thrown by `propose()` when the task's skill is priced and the agent couldn't pay for it. `setupUrl`
149
+ * opens the page where the agent's human fixes it: the claim page for an unclaimed guest, or billing settings.
150
+ */
151
+ export declare class PaymentRequiredError extends AgentJamError {
152
+ /** Why the task couldn't be paid for. */
153
+ readonly reason: PaymentRequiredReason;
154
+ /** The page where the agent's human fixes the payment, if there is one. */
155
+ readonly setupUrl?: string | undefined;
156
+ readonly name = "PaymentRequiredError";
157
+ constructor(
158
+ /** Why the task couldn't be paid for. */
159
+ reason: PaymentRequiredReason, message?: string,
160
+ /** The page where the agent's human fixes the payment, if there is one. */
161
+ setupUrl?: string | undefined);
162
+ /** The single-use link where a guest's human claims it, set only when `reason` is `unclaimed`. */
163
+ get claimUrl(): string | undefined;
164
+ }
165
+ /** Thrown by `propose()` when the agent charges for its skills and the proposal doesn't name one of them. */
166
+ export declare class SkillRequiredError extends AgentJamError {
167
+ /** The agent that charges for its skills. */
168
+ readonly agent: string;
169
+ readonly name = "SkillRequiredError";
170
+ constructor(
171
+ /** The agent that charges for its skills. */
172
+ agent: string, message?: string);
173
+ }
174
+ /** Thrown by `propose()` and `schedule()` when the input doesn't match the skill's input schema, is missing for a skill with one, or is sent to a skill without one. */
175
+ export declare class InvalidInputError extends AgentJamError {
176
+ /** The agent whose skill refused the input. */
177
+ readonly agent: string;
178
+ readonly name = "InvalidInputError";
179
+ constructor(
180
+ /** The agent whose skill refused the input. */
181
+ agent: string, message: string);
182
+ }
183
+ /** Thrown by `credentials()` and an OAuth connection once the requester's account with `provider` is no longer connected, such as after its human revoked access. */
184
+ export declare class ConnectionRevokedError extends AgentJamError {
185
+ /** The provider of the account that is no longer connected. */
186
+ readonly provider: string;
187
+ /** Why the account is no longer connected. */
188
+ readonly reason: string;
189
+ readonly name = "ConnectionRevokedError";
190
+ constructor(
191
+ /** The provider of the account that is no longer connected. */
192
+ provider: string,
193
+ /** Why the account is no longer connected. */
194
+ reason: string);
195
+ }
196
+ /** Thrown by an OAuth connection's `callback()` when connecting the account failed after the human consented, who can try again at `url`. */
197
+ export declare class ConnectionFailedError extends AgentJamError {
198
+ /** The provider of the account that failed to connect. */
199
+ readonly provider: string;
200
+ /** Why connecting failed. */
201
+ readonly reason: string;
202
+ /** The link where the human tries again. */
203
+ readonly url: string;
204
+ readonly name = "ConnectionFailedError";
205
+ constructor(
206
+ /** The provider of the account that failed to connect. */
207
+ provider: string,
208
+ /** Why connecting failed. */
209
+ reason: string,
210
+ /** The link where the human tries again. */
211
+ url: string);
212
+ }
213
+ /** Thrown by a `connectionFetch()` function when the platform refuses to send a request, such as one the skill's allowlist doesn't permit. */
214
+ export declare class RequestRefusedError extends AgentJamError {
215
+ /** The provider of the secret connection the request was for. */
216
+ readonly provider: string;
217
+ /** Why the platform refused, such as `unlisted_request`, `invalid_target` or `rate_limited`. */
218
+ readonly reason: string;
219
+ readonly name = "RequestRefusedError";
220
+ constructor(
221
+ /** The provider of the secret connection the request was for. */
222
+ provider: string,
223
+ /** Why the platform refused, such as `unlisted_request`, `invalid_target` or `rate_limited`. */
224
+ reason: string, message: string);
225
+ }
226
+ export declare const describeError: (error: unknown) => string;
227
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5D,eAAO,MAAM,cAAc,iGACqE,CAAC;AAEjG,6DAA6D;AAC7D,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAyB,IAAI,EAAE,MAAM,CAAmB;CACzD;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IAIjD,qDAAqD;aACrC,KAAK,EAAE,MAAM;IAJ/B,SAAyB,IAAI,wBAAwB;IAErD;IACE,qDAAqD;IACrC,KAAK,EAAE,MAAM,EAK9B;CACF;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IAIjD,6CAA6C;aAC7B,KAAK,EAAE,MAAM;IAC7B,6CAA6C;aAC7B,UAAU,EAAE,MAAM;IAClC,wEAAwE;aACxD,YAAY,EAAE,MAAM;IARtC,SAAyB,IAAI,wBAAwB;IAErD;IACE,6CAA6C;IAC7B,KAAK,EAAE,MAAM;IAC7B,6CAA6C;IAC7B,UAAU,EAAE,MAAM;IAClC,wEAAwE;IACxD,YAAY,EAAE,MAAM,EAMrC;CACF;AAED,kHAAkH;AAClH,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,SAAyB,IAAI,sBAAsB;CACpD;AAED,iEAAiE;AACjE,qBAAa,YAAa,SAAQ,aAAa;IAC7C,SAAyB,IAAI,kBAAkB;C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E,MAAM,EAC9B,OAAO,EAAE,MAAM,EAGhB;CACF;AAED,eAAO,MAAM,aAAa,UAAW,OAAO,WACY,CAAC"}
package/dist/errors.js ADDED
@@ -0,0 +1,253 @@
1
+ export const addressMistake = "Either the username or the agent name is wrong (agents are addressed as username/agent-name)";
2
+ /** Base class for every error thrown by the AgentJam SDK. */
3
+ export class AgentJamError extends Error {
4
+ name = "AgentJamError";
5
+ }
6
+ /**
7
+ * Thrown when a message or proposal is addressed to an agent that isn't connected, because either
8
+ * the username or the agent name in its `username/agent-name` address is wrong, or it's offline.
9
+ */
10
+ export class AgentNotFoundError extends AgentJamError {
11
+ agent;
12
+ name = "AgentNotFoundError";
13
+ constructor(
14
+ /** The address of the agent that isn't connected. */
15
+ agent) {
16
+ super(`No agent named "${agent}" is connected. ${addressMistake}, or the agent is offline`);
17
+ this.agent = agent;
18
+ }
19
+ }
20
+ /**
21
+ * Thrown by `connect()` when another connection holds its `instanceId` past the connect timeout. A
22
+ * connection that ended without saying bye holds it for `retryAfterMs` more.
23
+ */
24
+ export class InstanceTakenError extends AgentJamError {
25
+ agent;
26
+ instanceId;
27
+ retryAfterMs;
28
+ name = "InstanceTakenError";
29
+ constructor(
30
+ /** The name of the agent being connected. */
31
+ agent,
32
+ /** The instance another connection holds. */
33
+ instanceId,
34
+ /** How long until the held instance's lease lapses, in milliseconds. */
35
+ retryAfterMs) {
36
+ const seconds = Math.ceil(retryAfterMs / 1000);
37
+ super(`Instance "${instanceId}" of "${agent}" is already connected. If that connection is gone, its lease lapses in ${seconds}s`);
38
+ this.agent = agent;
39
+ this.instanceId = instanceId;
40
+ this.retryAfterMs = retryAfterMs;
41
+ }
42
+ }
43
+ /** Thrown by `create()` when an agent with that name already exists. Pass `upsert: true` to update it instead. */
44
+ export class AgentExistsError extends AgentJamError {
45
+ name = "AgentExistsError";
46
+ }
47
+ /** Thrown when a request gets no response within its timeout. */
48
+ export class TimeoutError extends AgentJamError {
49
+ name = "TimeoutError";
50
+ }
51
+ /** Thrown by `propose()` when the recipient declines the task, or by a task's `result()` and `events()` if it declines after restarting. */
52
+ export class TaskRejectedError extends AgentJamError {
53
+ agent;
54
+ reason;
55
+ name = "TaskRejectedError";
56
+ constructor(
57
+ /** The agent that rejected the task. */
58
+ agent,
59
+ /** Why the agent rejected the task. */
60
+ reason) {
61
+ super(`${agent} rejected the task: ${reason}`);
62
+ this.agent = agent;
63
+ this.reason = reason;
64
+ }
65
+ }
66
+ /** Thrown by a task's `result()` and `events()` when the executor fails it, with a `code` once it failed because its requester couldn't fund a commit. */
67
+ export class TaskFailedError extends AgentJamError {
68
+ code;
69
+ name = "TaskFailedError";
70
+ constructor(message,
71
+ /** Why the requester couldn't fund the action its executor committed to, when that's why it failed. */
72
+ code) {
73
+ super(message);
74
+ this.code = code;
75
+ }
76
+ }
77
+ /** Passed to an executor's `onError` when the relay gives up on a fired event that never started a run, so it may be fired again. */
78
+ export class TriggerFailedError extends AgentJamError {
79
+ requester;
80
+ scheduleId;
81
+ eventId;
82
+ name = "TriggerFailedError";
83
+ constructor(
84
+ /** The agent that requested the schedule. */
85
+ requester,
86
+ /** The schedule the event was fired for. */
87
+ scheduleId,
88
+ /** The `id` of the event that didn't start a run. */
89
+ eventId, reason) {
90
+ super(`Event ${eventId} of ${requester}'s schedule ${scheduleId} didn't start a run: ${reason}`);
91
+ this.requester = requester;
92
+ this.scheduleId = scheduleId;
93
+ this.eventId = eventId;
94
+ }
95
+ }
96
+ /** Passed to a requester's `onError` when a run of its schedule met the follow-up's condition, but the relay couldn't propose the follow-up. */
97
+ export class FollowUpFailedError extends AgentJamError {
98
+ agent;
99
+ scheduleId;
100
+ runId;
101
+ name = "FollowUpFailedError";
102
+ constructor(
103
+ /** The agent the follow-up was for. */
104
+ agent,
105
+ /** The schedule whose run wasn't followed up. */
106
+ scheduleId,
107
+ /** The run that wasn't followed up. */
108
+ runId, reason) {
109
+ super(`Run ${runId} of schedule ${scheduleId} wasn't followed up with ${agent}: ${reason}`);
110
+ this.agent = agent;
111
+ this.scheduleId = scheduleId;
112
+ this.runId = runId;
113
+ }
114
+ }
115
+ /** Thrown by `dispatch()` when the relay never received the event, so no schedule ran for it and it may be dispatched again. */
116
+ export class DispatchFailedError extends AgentJamError {
117
+ eventId;
118
+ name = "DispatchFailedError";
119
+ constructor(
120
+ /** The `id` of the event that wasn't dispatched. */
121
+ eventId, reason) {
122
+ super(`Event ${eventId} wasn't dispatched: ${reason}`);
123
+ this.eventId = eventId;
124
+ }
125
+ }
126
+ /**
127
+ * Thrown by a task's `result()` and `events()` once it has been canceled, and the reason an executor's
128
+ * `task.signal` aborts. A task the relay canceled once its requester could fund no more of it has a `code`.
129
+ */
130
+ export class TaskCanceledError extends AgentJamError {
131
+ code;
132
+ name = "TaskCanceledError";
133
+ constructor(message,
134
+ /** Why the relay ended the task, such as `insufficient_credits`. */
135
+ code) {
136
+ super(message);
137
+ this.code = code;
138
+ }
139
+ }
140
+ /** Thrown by a task's `cancel()` once its executor committed to an action it can't undo, such as a purchase, so the task keeps running. */
141
+ export class TaskCommittedError extends AgentJamError {
142
+ name = "TaskCommittedError";
143
+ }
144
+ /** Thrown by a task's `commit()` when its requester can't fund the cost plus the skill's markup, within their `maxPriceCents`, spending cap and wallet. */
145
+ export class UncoveredCostError extends AgentJamError {
146
+ requiredCents;
147
+ code;
148
+ name = "UncoveredCostError";
149
+ constructor(message,
150
+ /** The cents the relay must hold from the requester to cover the cost. */
151
+ requiredCents,
152
+ /** Why the requester can't fund it, such as `reload_failed` once their wallet's auto-reload failed to charge their payment method. */
153
+ code) {
154
+ super(message);
155
+ this.requiredCents = requiredCents;
156
+ this.code = code;
157
+ }
158
+ }
159
+ /**
160
+ * Thrown by `propose()` when the task's skill is priced and the agent couldn't pay for it. `setupUrl`
161
+ * opens the page where the agent's human fixes it: the claim page for an unclaimed guest, or billing settings.
162
+ */
163
+ export class PaymentRequiredError extends AgentJamError {
164
+ reason;
165
+ setupUrl;
166
+ name = "PaymentRequiredError";
167
+ constructor(
168
+ /** Why the task couldn't be paid for. */
169
+ reason, message = `The task requires payment (${reason})`,
170
+ /** The page where the agent's human fixes the payment, if there is one. */
171
+ setupUrl) {
172
+ super(message);
173
+ this.reason = reason;
174
+ this.setupUrl = setupUrl;
175
+ }
176
+ /** The single-use link where a guest's human claims it, set only when `reason` is `unclaimed`. */
177
+ get claimUrl() {
178
+ return this.reason === "unclaimed" ? this.setupUrl : undefined;
179
+ }
180
+ }
181
+ /** Thrown by `propose()` when the agent charges for its skills and the proposal doesn't name one of them. */
182
+ export class SkillRequiredError extends AgentJamError {
183
+ agent;
184
+ name = "SkillRequiredError";
185
+ constructor(
186
+ /** The agent that charges for its skills. */
187
+ agent, message = `${agent} charges for its skills, so the proposal must name one of them`) {
188
+ super(message);
189
+ this.agent = agent;
190
+ }
191
+ }
192
+ /** Thrown by `propose()` and `schedule()` when the input doesn't match the skill's input schema, is missing for a skill with one, or is sent to a skill without one. */
193
+ export class InvalidInputError extends AgentJamError {
194
+ agent;
195
+ name = "InvalidInputError";
196
+ constructor(
197
+ /** The agent whose skill refused the input. */
198
+ agent, message) {
199
+ super(message);
200
+ this.agent = agent;
201
+ }
202
+ }
203
+ /** Thrown by `credentials()` and an OAuth connection once the requester's account with `provider` is no longer connected, such as after its human revoked access. */
204
+ export class ConnectionRevokedError extends AgentJamError {
205
+ provider;
206
+ reason;
207
+ name = "ConnectionRevokedError";
208
+ constructor(
209
+ /** The provider of the account that is no longer connected. */
210
+ provider,
211
+ /** Why the account is no longer connected. */
212
+ reason) {
213
+ super(`The ${provider} account is no longer connected: ${reason}`);
214
+ this.provider = provider;
215
+ this.reason = reason;
216
+ }
217
+ }
218
+ /** Thrown by an OAuth connection's `callback()` when connecting the account failed after the human consented, who can try again at `url`. */
219
+ export class ConnectionFailedError extends AgentJamError {
220
+ provider;
221
+ reason;
222
+ url;
223
+ name = "ConnectionFailedError";
224
+ constructor(
225
+ /** The provider of the account that failed to connect. */
226
+ provider,
227
+ /** Why connecting failed. */
228
+ reason,
229
+ /** The link where the human tries again. */
230
+ url) {
231
+ super(`Connecting the ${provider} account failed: ${reason}`);
232
+ this.provider = provider;
233
+ this.reason = reason;
234
+ this.url = url;
235
+ }
236
+ }
237
+ /** Thrown by a `connectionFetch()` function when the platform refuses to send a request, such as one the skill's allowlist doesn't permit. */
238
+ export class RequestRefusedError extends AgentJamError {
239
+ provider;
240
+ reason;
241
+ name = "RequestRefusedError";
242
+ constructor(
243
+ /** The provider of the secret connection the request was for. */
244
+ provider,
245
+ /** Why the platform refused, such as `unlisted_request`, `invalid_target` or `rate_limited`. */
246
+ reason, message) {
247
+ super(message);
248
+ this.provider = provider;
249
+ this.reason = reason;
250
+ }
251
+ }
252
+ export const describeError = (error) => error instanceof Error ? error.message : String(error);
253
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GACzB,8FAA8F,CAAC;AAEjG,6DAA6D;AAC7D,MAAM,OAAO,aAAc,SAAQ,KAAK;IACb,IAAI,GAAW,eAAe,CAAC;CACzD;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IAKjC,KAAK;IAJE,IAAI,GAAG,oBAAoB,CAAC;IAErD;IACE,qDAAqD;IACrC,KAAa;QAE7B,KAAK,CACH,mBAAmB,KAAK,mBAAmB,cAAc,2BAA2B,CACrF,CAAC;qBAJc,KAAK;IAKvB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IAKjC,KAAK;IAEL,UAAU;IAEV,YAAY;IARL,IAAI,GAAG,oBAAoB,CAAC;IAErD;IACE,6CAA6C;IAC7B,KAAa;IAC7B,6CAA6C;IAC7B,UAAkB;IAClC,wEAAwE;IACxD,YAAoB;QAEpC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;Q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;IACb,MAAc;IAC9B,4CAA4C;IAC5B,GAAW;QAE3B,KAAK,CAAC,kBAAkB,QAAQ,oBAAoB,MAAM,EAAE,CAAC,CAAC;wBAN9C,QAAQ;sBAER,MAAM;mBAEN,GAAG;IAGrB,CAAC;CACF;AAED,8IAA8I;AAC9I,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAKlC,QAAQ;IAER,MAAM;IANC,IAAI,GAAG,qBAAqB,CAAC;IAEtD;IACE,iEAAiE;IACjD,QAAgB;IAChC,gGAAgG;IAChF,MAAc,EAC9B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;wBALC,QAAQ;sBAER,MAAM;IAIxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAE,EAAE,CAC9C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { AccountRevocation } from "./providers.js";
2
+ import type { TriggerEvent } from "./types.js";
3
+ /** A provider's webhook request, as a web `Request` or the headers and raw body any server framework hands over. */
4
+ export type SourceRequest = Request | {
5
+ headers: Headers | Record<string, string | string[] | undefined>;
6
+ /** The body exactly as the provider sent it, since providers sign the raw bytes. */
7
+ body: string | Uint8Array;
8
+ };
9
+ /** A webhook request's headers and raw body, read the same way whichever shape it came in. */
10
+ export type ReceivedRequest = {
11
+ headers: Headers;
12
+ body: string;
13
+ };
14
+ /** The answer an event source's endpoint sends back to the provider. */
15
+ export type SourceResponse = {
16
+ status: number;
17
+ headers?: Record<string, string>;
18
+ body?: string;
19
+ };
20
+ /**
21
+ * What a provider's webhook reported: an event to dispatch under its keys, or an account that lost access
22
+ * with the provider, such as a workspace that uninstalled the app.
23
+ */
24
+ export type SourceEvent = {
25
+ type: "event";
26
+ eventKeys: string[];
27
+ event: TriggerEvent;
28
+ } | ({
29
+ type: "revoked";
30
+ provider: string;
31
+ } & AccountRevocation);
32
+ /** The answer to a webhook request and the events it carried. */
33
+ export type SourceDelivery = {
34
+ response: SourceResponse;
35
+ events: SourceEvent[];
36
+ };
37
+ /**
38
+ * Reads a provider's webhook requests into events, such as `slackEvents()`. Pass one to `agent.receiveEvents()`.
39
+ * It verifies each request itself, answering one it can't verify with an error response and no events.
40
+ */
41
+ export interface EventSource {
42
+ /**
43
+ * Verifies a webhook request and reads the events it carries.
44
+ *
45
+ * @param request The provider's request. `readSourceRequest()` reads either shape.
46
+ * @returns The answer to send the provider, and the events to dispatch or revoke.
47
+ */
48
+ receive(request: SourceRequest): Promise<SourceDelivery>;
49
+ }
50
+ /**
51
+ * Reads a webhook request's headers and raw body, whichever shape it came in, for an `EventSource` to verify.
52
+ *
53
+ * @param request A web `Request`, or the headers and raw body a server framework hands over.
54
+ * @returns The request's headers and its body as text.
55
+ */
56
+ export declare const readSourceRequest: (request: SourceRequest) => Promise<ReceivedRequest>;
57
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,oHAAoH;AACpH,MAAM,MAAM,aAAa,GACrB,OAAO,GACP;IACE,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACjE,oFAAoF;IACpF,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;CAC3B,CAAC;AAEN,8FAA8F;AAC9F,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,M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