samva 0.46.0 → 0.47.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 (276) hide show
  1. package/AGENTS.md +13 -7
  2. package/README.md +107 -9
  3. package/dist/agent/index.d.ts +56 -0
  4. package/dist/agent/index.js +52 -0
  5. package/dist/agent/runtime.d.ts +3 -0
  6. package/dist/agent/runtime.js +74 -0
  7. package/dist/agent/test.d.ts +31 -0
  8. package/dist/agent/test.js +66 -0
  9. package/dist/agent/types.d.ts +123 -0
  10. package/dist/client/client/client.gen.d.ts +1 -1
  11. package/dist/client/client/index.d.ts +10 -10
  12. package/dist/client/client/types.gen.d.ts +4 -4
  13. package/dist/client/client/utils.gen.d.ts +2 -2
  14. package/dist/client/client.gen.d.ts +2 -2
  15. package/dist/client/core/bodySerializer.gen.d.ts +1 -1
  16. package/dist/client/core/serverSentEvents.gen.d.ts +1 -1
  17. package/dist/client/core/types.gen.d.ts +2 -2
  18. package/dist/client/core/utils.gen.d.ts +1 -1
  19. package/dist/client/sdk.gen.d.ts +41 -161
  20. package/dist/client/sdk.gen.js +1302 -1598
  21. package/dist/client/types.gen.d.ts +377 -966
  22. package/dist/effect/accounts.d.ts +6 -6
  23. package/dist/effect/accounts.js +2 -1
  24. package/dist/effect/agents.d.ts +355 -23
  25. package/dist/effect/agents.js +6 -3
  26. package/dist/effect/analytics.d.ts +6 -6
  27. package/dist/effect/analytics.js +2 -1
  28. package/dist/effect/api-keys.d.ts +13 -13
  29. package/dist/effect/api-keys.js +2 -1
  30. package/dist/effect/approval-requests.d.ts +4 -4
  31. package/dist/effect/approval-requests.js +2 -1
  32. package/dist/effect/attachments.d.ts +4 -4
  33. package/dist/effect/attachments.js +2 -1
  34. package/dist/effect/brands.d.ts +7 -7
  35. package/dist/effect/brands.js +2 -1
  36. package/dist/effect/campaigns.d.ts +205 -205
  37. package/dist/effect/campaigns.js +2 -1
  38. package/dist/effect/categories.d.ts +3 -3
  39. package/dist/effect/client.d.ts +1 -1
  40. package/dist/effect/contact-groups.d.ts +18 -18
  41. package/dist/effect/contact-groups.js +2 -1
  42. package/dist/effect/contacts.d.ts +41 -33
  43. package/dist/effect/contacts.js +8 -3
  44. package/dist/effect/conversations.d.ts +17 -17
  45. package/dist/effect/conversations.js +2 -1
  46. package/dist/effect/custom-fields.d.ts +4 -4
  47. package/dist/effect/custom-fields.js +2 -1
  48. package/dist/effect/descriptors/accounts.d.ts +59 -0
  49. package/dist/effect/descriptors/accounts.js +57 -0
  50. package/dist/effect/descriptors/agents.d.ts +129 -0
  51. package/dist/effect/descriptors/agents.js +127 -0
  52. package/dist/effect/descriptors/analytics.d.ts +56 -0
  53. package/dist/effect/descriptors/analytics.js +48 -0
  54. package/dist/effect/descriptors/api-keys.d.ts +80 -0
  55. package/dist/effect/descriptors/api-keys.js +80 -0
  56. package/dist/effect/descriptors/approval-requests.d.ts +41 -0
  57. package/dist/effect/descriptors/approval-requests.js +43 -0
  58. package/dist/effect/descriptors/attachments.d.ts +41 -0
  59. package/dist/effect/descriptors/attachments.js +43 -0
  60. package/dist/effect/descriptors/brands.d.ts +60 -0
  61. package/dist/effect/descriptors/brands.js +60 -0
  62. package/dist/effect/descriptors/campaigns.d.ts +148 -0
  63. package/dist/effect/descriptors/campaigns.js +144 -0
  64. package/dist/effect/descriptors/contact-groups.d.ts +99 -0
  65. package/dist/effect/descriptors/contact-groups.js +97 -0
  66. package/dist/effect/descriptors/contacts.d.ts +246 -0
  67. package/dist/effect/descriptors/contacts.js +234 -0
  68. package/dist/effect/descriptors/conversations.d.ts +130 -0
  69. package/dist/effect/descriptors/conversations.js +130 -0
  70. package/dist/effect/descriptors/custom-fields.d.ts +40 -0
  71. package/dist/effect/descriptors/custom-fields.js +40 -0
  72. package/dist/effect/descriptors/email.d.ts +607 -0
  73. package/dist/effect/descriptors/email.js +561 -0
  74. package/dist/effect/descriptors/events.d.ts +20 -0
  75. package/dist/effect/descriptors/events.js +20 -0
  76. package/dist/effect/descriptors/feedback.d.ts +11 -0
  77. package/dist/effect/descriptors/feedback.js +11 -0
  78. package/dist/effect/descriptors/integrations-catalog.d.ts +29 -0
  79. package/dist/effect/descriptors/integrations-catalog.js +27 -0
  80. package/dist/effect/descriptors/integrations.d.ts +70 -0
  81. package/dist/effect/descriptors/integrations.js +70 -0
  82. package/dist/effect/descriptors/journeys.d.ts +140 -0
  83. package/dist/effect/descriptors/journeys.js +140 -0
  84. package/dist/effect/descriptors/mailboxes.d.ts +724 -0
  85. package/dist/effect/descriptors/mailboxes.js +728 -0
  86. package/dist/effect/descriptors/media.d.ts +51 -0
  87. package/dist/effect/descriptors/media.js +53 -0
  88. package/dist/effect/descriptors/messages.d.ts +99 -0
  89. package/dist/effect/descriptors/messages.js +97 -0
  90. package/dist/effect/descriptors/namespaces.d.ts +110 -0
  91. package/dist/effect/descriptors/namespaces.js +114 -0
  92. package/dist/effect/descriptors/newsletter-domains.d.ts +42 -0
  93. package/dist/effect/descriptors/newsletter-domains.js +46 -0
  94. package/dist/effect/descriptors/newsletter-issues.d.ts +112 -0
  95. package/dist/effect/descriptors/newsletter-issues.js +116 -0
  96. package/dist/effect/descriptors/newsletters.d.ts +51 -0
  97. package/dist/effect/descriptors/newsletters.js +53 -0
  98. package/dist/effect/descriptors/operations.d.ts +31 -0
  99. package/dist/effect/descriptors/operations.js +33 -0
  100. package/dist/effect/descriptors/organizations.d.ts +111 -0
  101. package/dist/effect/descriptors/organizations.js +93 -0
  102. package/dist/effect/descriptors/policies.d.ts +32 -0
  103. package/dist/effect/descriptors/policies.js +36 -0
  104. package/dist/effect/descriptors/scheduled-messages.d.ts +50 -0
  105. package/dist/effect/descriptors/scheduled-messages.js +50 -0
  106. package/dist/effect/descriptors/subscriptions.d.ts +11 -0
  107. package/dist/effect/descriptors/subscriptions.js +11 -0
  108. package/dist/effect/descriptors/template-registrations.d.ts +32 -0
  109. package/dist/effect/descriptors/template-registrations.js +36 -0
  110. package/dist/effect/descriptors/template-share-links.d.ts +52 -0
  111. package/dist/effect/descriptors/template-share-links.js +56 -0
  112. package/dist/effect/descriptors/templates.d.ts +365 -0
  113. package/dist/effect/descriptors/templates.js +355 -0
  114. package/dist/effect/descriptors/topic-forms.d.ts +52 -0
  115. package/dist/effect/descriptors/topic-forms.js +56 -0
  116. package/dist/effect/descriptors/topics.d.ts +89 -0
  117. package/dist/effect/descriptors/topics.js +87 -0
  118. package/dist/effect/descriptors/webhooks.d.ts +110 -0
  119. package/dist/effect/descriptors/webhooks.js +110 -0
  120. package/dist/effect/descriptors/whats-app-flows.d.ts +99 -0
  121. package/dist/effect/descriptors/whats-app-flows.js +97 -0
  122. package/dist/effect/descriptors/whats-app-setup-links.d.ts +40 -0
  123. package/dist/effect/descriptors/whats-app-setup-links.js +40 -0
  124. package/dist/effect/descriptors/whats-app.d.ts +116 -0
  125. package/dist/effect/descriptors/whats-app.js +108 -0
  126. package/dist/effect/descriptors/whoami.d.ts +11 -0
  127. package/dist/effect/descriptors/whoami.js +11 -0
  128. package/dist/effect/email.d.ts +78 -78
  129. package/dist/effect/email.js +2 -1
  130. package/dist/effect/errors.d.ts +2 -2
  131. package/dist/effect/events.d.ts +3 -3
  132. package/dist/effect/events.js +2 -1
  133. package/dist/effect/feedback.d.ts +2 -2
  134. package/dist/effect/feedback.js +2 -1
  135. package/dist/effect/generated/accounts.d.ts +19 -9
  136. package/dist/effect/generated/accounts.js +1 -0
  137. package/dist/effect/generated/agents.d.ts +2967 -690
  138. package/dist/effect/generated/agents.js +54 -13
  139. package/dist/effect/generated/analytics.d.ts +1 -1
  140. package/dist/effect/generated/api-keys.d.ts +1 -1
  141. package/dist/effect/generated/approval-requests.d.ts +13 -13
  142. package/dist/effect/generated/attachments.d.ts +1 -1
  143. package/dist/effect/generated/brands.d.ts +1 -1
  144. package/dist/effect/generated/campaigns.d.ts +230 -230
  145. package/dist/effect/generated/contact-events.d.ts +4 -4
  146. package/dist/effect/generated/contact-groups.d.ts +1 -1
  147. package/dist/effect/generated/contacts.d.ts +907 -49
  148. package/dist/effect/generated/contacts.js +62 -3
  149. package/dist/effect/generated/conversations.d.ts +1 -1
  150. package/dist/effect/generated/custom-fields.d.ts +1 -1
  151. package/dist/effect/generated/email.d.ts +1 -1
  152. package/dist/effect/generated/events.d.ts +12 -12
  153. package/dist/effect/generated/feedback.d.ts +1 -1
  154. package/dist/effect/generated/index.d.ts +84 -88
  155. package/dist/effect/generated/integrations-catalog.d.ts +3 -3
  156. package/dist/effect/generated/integrations.d.ts +15 -15
  157. package/dist/effect/generated/journeys.d.ts +336 -96
  158. package/dist/effect/generated/journeys.js +3 -1
  159. package/dist/effect/generated/mailboxes.d.ts +93 -95
  160. package/dist/effect/generated/mailboxes.js +21 -25
  161. package/dist/effect/generated/media.d.ts +1 -1
  162. package/dist/effect/generated/messages.d.ts +1 -1
  163. package/dist/effect/generated/namespaces.d.ts +1 -1
  164. package/dist/effect/generated/newsletter-domains.d.ts +1 -1
  165. package/dist/effect/generated/newsletter-issues.d.ts +1 -1
  166. package/dist/effect/generated/newsletters.d.ts +1 -1
  167. package/dist/effect/generated/operations.d.ts +1 -1
  168. package/dist/effect/generated/organizations.d.ts +1 -1
  169. package/dist/effect/generated/policies.d.ts +1 -1
  170. package/dist/effect/generated/scheduled-messages.d.ts +147 -147
  171. package/dist/effect/generated/shared.d.ts +408 -102
  172. package/dist/effect/generated/shared.js +80 -36
  173. package/dist/effect/generated/subscriptions.d.ts +1 -1
  174. package/dist/effect/generated/template-registrations.d.ts +1 -4
  175. package/dist/effect/generated/template-registrations.js +2 -6
  176. package/dist/effect/generated/template-share-links.d.ts +1 -1
  177. package/dist/effect/generated/templates.d.ts +1 -1
  178. package/dist/effect/generated/topic-forms.d.ts +1 -1
  179. package/dist/effect/generated/topics.d.ts +1 -1
  180. package/dist/effect/generated/webhooks.d.ts +1 -1
  181. package/dist/effect/generated/whats-app-flows.d.ts +1 -1
  182. package/dist/effect/generated/whats-app-setup-links.d.ts +1 -1
  183. package/dist/effect/generated/whats-app.d.ts +1 -1
  184. package/dist/effect/generated/whoami.d.ts +1 -1
  185. package/dist/effect/generated-metadata.d.ts +18 -84
  186. package/dist/effect/generated-metadata.js +362 -415
  187. package/dist/effect/index.d.ts +45 -47
  188. package/dist/effect/index.js +1 -3
  189. package/dist/effect/integrations-catalog.d.ts +3 -3
  190. package/dist/effect/integrations-catalog.js +2 -1
  191. package/dist/effect/integrations.d.ts +11 -11
  192. package/dist/effect/integrations.js +2 -1
  193. package/dist/effect/internal/client.d.ts +3 -3
  194. package/dist/effect/internal/client.js +1 -1
  195. package/dist/effect/internal/email-sender.d.ts +4 -4
  196. package/dist/effect/internal/mailbox-events.d.ts +2 -2
  197. package/dist/effect/internal/operation.d.ts +24 -5
  198. package/dist/effect/internal/operation.js +25 -22
  199. package/dist/effect/internal/send.d.ts +4 -4
  200. package/dist/effect/journeys.d.ts +46 -22
  201. package/dist/effect/journeys.js +2 -1
  202. package/dist/effect/mailboxes.d.ts +163 -163
  203. package/dist/effect/mailboxes.js +2 -1
  204. package/dist/effect/media.d.ts +5 -5
  205. package/dist/effect/media.js +2 -1
  206. package/dist/effect/messages.d.ts +17 -17
  207. package/dist/effect/messages.js +2 -1
  208. package/dist/effect/namespaces.d.ts +15 -15
  209. package/dist/effect/namespaces.js +2 -1
  210. package/dist/effect/newsletter-domains.d.ts +6 -6
  211. package/dist/effect/newsletter-domains.js +2 -1
  212. package/dist/effect/newsletter-issues.d.ts +11 -11
  213. package/dist/effect/newsletter-issues.js +2 -1
  214. package/dist/effect/newsletters.d.ts +5 -5
  215. package/dist/effect/newsletters.js +2 -1
  216. package/dist/effect/operations.d.ts +5 -5
  217. package/dist/effect/operations.js +2 -1
  218. package/dist/effect/organizations.d.ts +12 -12
  219. package/dist/effect/organizations.js +2 -1
  220. package/dist/effect/policies.d.ts +3 -3
  221. package/dist/effect/policies.js +2 -1
  222. package/dist/effect/scheduled-messages.d.ts +371 -371
  223. package/dist/effect/scheduled-messages.js +2 -1
  224. package/dist/effect/subscriptions.d.ts +1 -1
  225. package/dist/effect/subscriptions.js +2 -1
  226. package/dist/effect/template-registrations.d.ts +3 -3
  227. package/dist/effect/template-registrations.js +2 -1
  228. package/dist/effect/template-share-links.d.ts +5 -5
  229. package/dist/effect/template-share-links.js +2 -1
  230. package/dist/effect/templates.d.ts +46 -46
  231. package/dist/effect/templates.js +2 -1
  232. package/dist/effect/topic-forms.d.ts +5 -5
  233. package/dist/effect/topic-forms.js +2 -1
  234. package/dist/effect/topics.d.ts +13 -13
  235. package/dist/effect/topics.js +2 -1
  236. package/dist/effect/webhooks.d.ts +16 -16
  237. package/dist/effect/webhooks.js +2 -1
  238. package/dist/effect/whatsapp-flows.d.ts +10 -10
  239. package/dist/effect/whatsapp-flows.js +2 -1
  240. package/dist/effect/whatsapp-setup-links.d.ts +6 -6
  241. package/dist/effect/whatsapp-setup-links.js +2 -1
  242. package/dist/effect/whatsapp.d.ts +12 -12
  243. package/dist/effect/whatsapp.js +2 -1
  244. package/dist/effect/whoami.d.ts +1 -1
  245. package/dist/effect/whoami.js +2 -1
  246. package/dist/index.d.ts +1 -1
  247. package/dist/package.js +1 -1
  248. package/dist/promises/client.d.ts +10 -14
  249. package/dist/promises/client.js +3 -7
  250. package/dist/promises/errors.gen.d.ts +1 -1
  251. package/dist/promises/index.d.ts +5 -5
  252. package/dist/promises/request.d.ts +2 -2
  253. package/dist/promises/request.js +1 -1
  254. package/dist/promises/types.gen.d.ts +1 -1
  255. package/dist/request-policy.d.ts +10 -2
  256. package/dist/request-policy.js +3 -5
  257. package/dist/service-map.d.ts +18 -75
  258. package/package.json +17 -29
  259. package/dist/effect/extension-installations.d.ts +0 -132
  260. package/dist/effect/extension-installations.js +0 -28
  261. package/dist/effect/extensions.d.ts +0 -102
  262. package/dist/effect/extensions.js +0 -20
  263. package/dist/effect/generated/extension-installations.d.ts +0 -2761
  264. package/dist/effect/generated/extension-installations.js +0 -405
  265. package/dist/effect/generated/extensions.d.ts +0 -1037
  266. package/dist/effect/generated/extensions.js +0 -214
  267. package/dist/mailbox/dispatch.d.ts +0 -10
  268. package/dist/mailbox/dispatch.js +0 -66
  269. package/dist/mailbox/index.d.ts +0 -17
  270. package/dist/mailbox/index.js +0 -30
  271. package/dist/mailbox/test.d.ts +0 -25
  272. package/dist/mailbox/test.js +0 -181
  273. package/dist/mailbox/types.d.ts +0 -221
  274. package/dist/mailbox/webhook.d.ts +0 -10
  275. package/dist/mailbox/webhook.js +0 -41
  276. package/dist/service-map.js +0 -830
package/AGENTS.md CHANGED
@@ -37,8 +37,7 @@ organization, mailbox, or API key's decision rules. Policy writes require a pers
37
37
  unset. Replacement requires the observed `ifVersion`; `deletePolicy({ kind, id, ifVersion })`
38
38
  clears the configuration. Both return the next snapshot, and clear keeps the counter. On
39
39
  `ConflictError` (`409`), reload and review before editing again; never automatically retry stale
40
- full configuration with a newer version. Agent definitions and extension installations carry
41
- their own `policy`.
40
+ full configuration with a newer version. Agent definitions carry their own `policy`.
42
41
  Read an action with `mailboxes.getAction` or read its decision in `mailboxes.getNeedsYou` before
43
42
  reviewing it. Both `approveAction` and `denyAction` require the observed decision's positive
44
43
  `reviewRound`. A stale round returns `409`; refresh the action and review its new decision before
@@ -68,11 +67,6 @@ client and call level. `contacts.startImport` retries only `mode: "new"`; a resu
68
67
  a generation fence and must be followed by `getImportJob` after an ambiguous response. Promise cursor lists expose lazy `.pages(params)` and `.items(params)`
69
68
  async iterators. `orgSlug` selects an organization when paired with `authToken`.
70
69
 
71
- Mailbox extensions import `samva/mailbox`, `samva/mailbox/test`, or `samva/mailbox/webhook`.
72
- Handlers receive the normal client and use flat calls such as
73
- `ctx.samva.mailboxes.reply({ id, messageId, text })`. Keep sends in stable order so dispatch
74
- reuses deterministic event keys.
75
-
76
70
  Use `client.newsletters` for newsletter management and `client.newsletters.domains` for custom archive domains. Effect entrypoints are `samva/effect/newsletters`, `samva/effect/newsletter-issues`, and `samva/effect/newsletter-domains`. A newsletter’s `topicId` names its consent and campaign audience.
77
71
 
78
72
  `client.newsletters.domains.list({ id, cursor, limit })` returns a hostname-ordered page with
@@ -88,3 +82,15 @@ for a `projectId`. Create accepts an optional `slug`; update exports the project
88
82
  at the same link. Rename changes the slug and breaks the old link. Delete removes the link;
89
83
  existing guest copies remain independent. Get returns the link, canonicalPath, view/open counts and update time,
90
84
  or `null` when the project has no share link.
85
+
86
+ Hosted agent modules import `defineAgent`, `defineTool`, and `AgentContext` from `samva/agent`;
87
+ offline evals import `defineEval`, `runAgent`, and `runEval` from `samva/agent/test`. These
88
+ entrypoints use the optional `effect` peer for tool input schemas. Register tools, Markdown skills,
89
+ events, and schedules explicitly in the entry module. `defineAgent` derives their manifest
90
+ descriptors; do not maintain a second tool list. `defineTool` decodes unknown input before calling
91
+ `execute`. Every tool declares `replay: "safe" | "unsafe"`; optional tool approval combines with
92
+ policy floors, and stricter requirements win. Keep each call's authority in its supplied `ctx`,
93
+ never in globals shared by a warm module. Event calls expose `eventId`, `eventType`, and
94
+ `attempt` in `ctx.capability.trigger`. SDK idempotent writes derive stable keys from the agent,
95
+ event, operation, and call ordinal; preserve write order across retries, or supply an explicit
96
+ `idempotencyKey`. Eval assertions reject `runEval` on failure.
package/README.md CHANGED
@@ -4,6 +4,103 @@ Samva is email and WhatsApp for AI agents, and the API developers build on. An a
4
4
 
5
5
  TypeScript SDK for Samva's public customer API.
6
6
 
7
+ ## Author a hosted agent
8
+
9
+ Import `defineAgent` and `defineTool` from `samva/agent`, and install the optional `effect` peer
10
+ for tool input schemas. An entry module registers its tools, event handlers, schedules, and
11
+ Markdown skills explicitly. `samva agents init` scaffolds a project; `samva agents build` produces
12
+ one self-contained ES module, and `samva agents publish` publishes an immutable version.
13
+
14
+ ```ts
15
+ import { Schema } from "effect";
16
+ import { defineAgent, defineTool } from "samva/agent";
17
+
18
+ const instructions = "Help customers manage their appointments.";
19
+ const reschedule = "# Reschedule\nAsk for the appointment id.";
20
+
21
+ export default defineAgent({
22
+ manifest: {
23
+ name: "Front desk",
24
+ version: "1.0.0",
25
+ endpointIds: [],
26
+ integrations: [],
27
+ eventTriggers: [],
28
+ policy: { presets: [], rules: [] },
29
+ model: "standard",
30
+ reasoning: "auto",
31
+ workingHours: null,
32
+ takeoverTimeoutMinutes: 30,
33
+ },
34
+ instructions,
35
+ skills: { reschedule },
36
+ tools: {
37
+ appointment: defineTool({
38
+ description: "Look up an appointment",
39
+ input: Schema.Struct({ id: Schema.String }),
40
+ replay: "safe",
41
+ async execute(input, ctx) {
42
+ return await ctx.connections.call("intg_yourintegration", "get_appointment", input);
43
+ },
44
+ }),
45
+ },
46
+ events: {
47
+ "appointment.confirmed"(event, ctx) {
48
+ ctx.log(event.type);
49
+ },
50
+ },
51
+ schedules: {
52
+ "0 9 * * *"(ctx) {
53
+ ctx.log("Daily check");
54
+ },
55
+ },
56
+ });
57
+ ```
58
+
59
+ `defineTool` validates input before calling `execute`, and infers its input type from the Effect
60
+ schema. Declare `replay: "safe"` only when repeating a call is safe; otherwise use `"unsafe"`.
61
+ A tool's optional `approval` (`"run"`, `"model"`, `"person"`, or `"never"`) sets a floor combined
62
+ with Samva's decision rules: stricter requirements win. Each call receives a fresh `ctx` with its
63
+ capability identity, the Samva client, integration calls, memory, and logging. Keep authority in
64
+ that context rather than module globals. Instructions can also be a function of `ctx`; `knowledge`
65
+ can supply static business facts separately. Markdown skills are registered by name and loaded
66
+ when needed. In a project, import instructions and skills from `.md` files as text; the CLI
67
+ bundles those imports into the module.
68
+
69
+ For a conversation call, `ctx.capability.trigger.target` provides the admitted `mailboxId`,
70
+ `threadId`, and `messageId` for scoped mailbox reads and replies, or `null` when there is no
71
+ mailbox target. Include this field when constructing a fake conversation context for an eval.
72
+
73
+ Eval files are ordinary TypeScript modules. Import `defineEval`, `runAgent`, and `runEval` from
74
+ `samva/agent/test`. Supply a fake `AgentContext`; the helper runs the registered tool or handler
75
+ without a server and preserves input validation:
76
+
77
+ ```ts
78
+ import type { AgentContext, AgentDefinition } from "samva/agent";
79
+ import { defineEval, runAgent, runEval } from "samva/agent/test";
80
+
81
+ declare const agent: AgentDefinition;
82
+ declare const ctx: AgentContext;
83
+
84
+ const evaluation = defineEval({
85
+ name: "appointment lookup",
86
+ async run(definition, context) {
87
+ const local = runAgent(definition, context);
88
+ await local.tool("appointment", { id: "appointment-1" });
89
+ await local.event({
90
+ id: "event-1",
91
+ type: "appointment.confirmed",
92
+ timestamp: "2026-01-01T00:00:00.000Z",
93
+ data: { appointmentId: "appointment-1" },
94
+ });
95
+ },
96
+ });
97
+
98
+ await runEval(agent, evaluation, ctx);
99
+ ```
100
+
101
+ Assertions thrown by an eval reject `runEval`. The runner also exposes `schedule(cron)`,
102
+ `instructions()`, and `skill(name)`; missing registrations fail explicitly.
103
+
7
104
  ## Give an agent a mailbox
8
105
 
9
106
  Create a mailbox, send from it, and read what comes back. A hosted `samva.email` address needs no DNS setup.
@@ -256,8 +353,6 @@ The Promise client exposes:
256
353
  - `customFields`
257
354
  - `email`
258
355
  - `events`
259
- - `extensionInstallations`
260
- - `extensions`
261
356
  - `feedback`
262
357
  - `integrationCatalog`
263
358
  - `integrations`
@@ -363,7 +458,7 @@ Promise lists expose lazy async iterators: `samva.contacts.list.pages(params)` y
363
458
 
364
459
  Effect pagination uses Streams:
365
460
 
366
- Every list answers `{ items, nextCursor }`: pass `nextCursor` back as `cursor` for the next page, and stop when it is null. Every list operation that pages carries two `Stream` companions, so you traverse pages without hand-rolling a cursor loop:
461
+ Cursor-paginated lists answer `{ items, nextCursor }`: pass `nextCursor` back as `cursor` for the next page, and stop when it is null. Every list operation that pages carries two `Stream` companions, so you traverse pages without hand-rolling a cursor loop:
367
462
 
368
463
  - **`list.items(input?)`**: a `Stream` of individual items across all pages.
369
464
  - **`list.pages(input?)`**: a `Stream` of raw page envelopes.
@@ -562,7 +657,7 @@ is the frozen public email snapshot; inspect the action type before using send-s
562
657
  Preserve the original key and body after a timeout. Replaying them reads the same action's current
563
658
  phase, and changing the body under that key is a conflict. `getAction` reads progress. A permitted
564
659
  person can `cancelAction` before acceptance or `retryAction` when `retryEligible` is true; Retry
565
- continues the original action and never extends `executeUntil`. API keys and extensions cannot
660
+ continues the original action and never extends `executeUntil`. API keys cannot
566
661
  cancel or Retry. `approveAction` returns an action with `202` while the send is pending; accepted,
567
662
  completed, and `notSent` replays return `200`. Non-send approvals execute synchronously and return
568
663
  `200`, as does `denyAction`.
@@ -675,9 +770,12 @@ const input = {
675
770
  const response = await samva.email.send(input);
676
771
  ```
677
772
 
678
- ## Mailbox extensions
773
+ ## Agent event handlers
679
774
 
680
- Import `defineExtension` from `samva/mailbox`, test helpers from `samva/mailbox/test`, and
681
- `createWebhookHandler` from `samva/mailbox/webhook`. Handlers receive a normal Samva client:
682
- `ctx.samva.mailboxes.reply({ id, messageId, text })`. Event dispatch supplies deterministic
683
- idempotency keys through the client hook, preserving the send order across retried events.
775
+ Import `defineAgent` from `samva/agent` and register handlers in `events`. Samva invokes each
776
+ matching handler with the event envelope and a fresh `ctx`; use `ctx.samva` for API calls.
777
+ Mailbox and contact events use the same module. Offline evals use `runAgent` from
778
+ `samva/agent/test`, with an explicitly supplied context. The event trigger includes its id,
779
+ type, and attempt number. Event SDK calls receive deterministic idempotency keys per agent,
780
+ event, operation, and call ordinal; keep writes in stable order across retries. An explicit
781
+ `idempotencyKey` overrides the generated key.
@@ -0,0 +1,56 @@
1
+ import { Schema } from "effect";
2
+ import type { AgentModuleTool } from "../client/types.gen.js";
3
+ import type { AgentContext, AgentDefinition, AgentEventHandler, AgentInstructions, AgentManifest, AgentScheduleHandler, AgentTool } from "./types.js";
4
+ export * from "./types.js";
5
+ /** Input is decoded before execute runs, in the host and in offline evals alike. */
6
+ export declare function defineTool<const S extends Schema.ConstraintDecoder<unknown>, Output>(definition: {
7
+ readonly description: string;
8
+ readonly input: S;
9
+ readonly approval?: AgentModuleTool["approval"];
10
+ readonly replay: AgentModuleTool["replay"];
11
+ readonly execute: (input: S["Type"], ctx: AgentContext) => Output;
12
+ }): {
13
+ input: S;
14
+ descriptor: {
15
+ readonly description: string;
16
+ readonly input: {
17
+ readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | /*elided*/ any | {
18
+ readonly [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null;
19
+ } | null)[] | {
20
+ readonly [x: string]: string | number | boolean | any | any | null;
21
+ } | null)[] | {
22
+ readonly [x: string]: string | number | boolean | any | any | null;
23
+ } | null)[] | {
24
+ readonly [x: string]: string | number | boolean | any | any | null;
25
+ } | null)[] | {
26
+ readonly [x: string]: string | number | boolean | any | any | null;
27
+ } | null)[] | {
28
+ readonly [x: string]: string | number | boolean | any | any | null;
29
+ } | null)[] | {
30
+ readonly [x: string]: string | number | boolean | any | any | null;
31
+ } | null)[] | {
32
+ readonly [x: string]: string | number | boolean | any | any | null;
33
+ } | null)[] | {
34
+ readonly [x: string]: string | number | boolean | any | any | null;
35
+ } | null)[] | {
36
+ readonly [x: string]: string | number | boolean | any | any | null;
37
+ } | null)[] | {
38
+ readonly [x: string]: string | number | boolean | any | any | null;
39
+ } | null)[] | {
40
+ readonly [x: string]: string | number | boolean | any | any | null;
41
+ } | null;
42
+ };
43
+ readonly approval?: import("../index.js").PolicyRequirement | undefined;
44
+ readonly replay: "safe" | "unsafe";
45
+ };
46
+ execute(input: unknown, ctx: AgentContext): Promise<Awaited<Output>>;
47
+ };
48
+ export declare function defineAgent<const Tools extends Readonly<Record<string, AgentTool>> = Record<never, never>>(definition: {
49
+ readonly manifest: AgentManifest;
50
+ readonly instructions: AgentInstructions;
51
+ readonly knowledge?: string;
52
+ readonly skills?: Readonly<Record<string, string>>;
53
+ readonly tools?: Tools;
54
+ readonly events?: Readonly<Record<string, AgentEventHandler>>;
55
+ readonly schedules?: Readonly<Record<string, AgentScheduleHandler>>;
56
+ }): AgentDefinition<Tools>;
@@ -0,0 +1,52 @@
1
+ import { invokeAgent } from "./runtime.js";
2
+ import { Schema } from "effect";
3
+ // src/agent/index.ts
4
+ /** Input is decoded before execute runs, in the host and in offline evals alike. */
5
+ function defineTool(definition) {
6
+ const document = Schema.toJsonSchemaDocument(definition.input);
7
+ const jsonObject = Schema.Record(Schema.String, Schema.Json);
8
+ const inputSchema = Schema.decodeUnknownSync(jsonObject)(document.schema);
9
+ const descriptor = {
10
+ description: definition.description,
11
+ input: {
12
+ ...inputSchema,
13
+ ...Object.keys(document.definitions).length > 0 ? { $defs: Schema.decodeUnknownSync(jsonObject)(document.definitions) } : {}
14
+ },
15
+ ...definition.approval === void 0 ? {} : { approval: definition.approval },
16
+ replay: definition.replay
17
+ };
18
+ return {
19
+ input: definition.input,
20
+ descriptor,
21
+ async execute(input, ctx) {
22
+ const decoded = await Schema.decodeUnknownPromise(definition.input)(input);
23
+ return await definition.execute(decoded, ctx);
24
+ }
25
+ };
26
+ }
27
+ function defineAgent(definition) {
28
+ const skills = definition.skills ?? {};
29
+ const tools = definition.tools ?? {};
30
+ const events = definition.events ?? {};
31
+ const schedules = definition.schedules ?? {};
32
+ const agent = {
33
+ __samvaAgentRuntime: (operation, capability, authority) => invokeAgent(agent, operation, capability, authority),
34
+ manifest: {
35
+ ...definition.manifest,
36
+ tools: Object.fromEntries(Object.entries(tools).map(([name, tool]) => [name, tool.descriptor])),
37
+ skills: Object.keys(skills).sort(),
38
+ events: Object.keys(events).sort(),
39
+ schedules: Object.keys(schedules).sort()
40
+ },
41
+ instructions: definition.instructions,
42
+ knowledge: definition.knowledge ?? "",
43
+ skills,
44
+ tools,
45
+ events,
46
+ schedules
47
+ };
48
+ return agent;
49
+ }
50
+ export { defineAgent, defineTool };
51
+
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ import type { AgentCallCapability, AgentDefinition, AgentModuleAuthority, AgentModuleOperation } from "./types.js";
2
+ /** The SDK transport carries no credential: only the supplied call-local RPC stub can reach Samva. */
3
+ export declare function invokeAgent(agent: AgentDefinition, operation: AgentModuleOperation, capability: AgentCallCapability, authority: AgentModuleAuthority): Promise<unknown>;
@@ -0,0 +1,74 @@
1
+ import { clientWithIdempotency, createBoundClient } from "../promises/client.js";
2
+ // src/agent/runtime.ts
3
+ /** The SDK transport carries no credential: only the supplied call-local RPC stub can reach Samva. */
4
+ async function invokeAgent(agent, operation, capability, authority) {
5
+ const pendingLogs = [];
6
+ const client = createBoundClient({
7
+ baseUrl: "https://api.samva.dev",
8
+ maxRetries: 0,
9
+ fetch: async (input, init) => {
10
+ const request = new Request(input, init);
11
+ const url = new URL(request.url);
12
+ if (url.origin !== "https://api.samva.dev") throw new Error("Agent Samva calls must target the Samva API");
13
+ const headers = new Headers(request.headers);
14
+ headers.delete("authorization");
15
+ headers.delete("x-api-key");
16
+ headers.delete("cookie");
17
+ const result = await authority.samva({
18
+ method: request.method,
19
+ path: `${url.pathname}${url.search}`,
20
+ headers: Object.fromEntries(headers),
21
+ body: request.body === null ? null : await request.text()
22
+ });
23
+ return new Response(result.status === 204 || result.status === 205 ? null : result.body, {
24
+ status: result.status,
25
+ headers: result.headers
26
+ });
27
+ }
28
+ });
29
+ const counts = /* @__PURE__ */ new Map();
30
+ const ctx = {
31
+ capability,
32
+ samva: operation.kind === "event" ? clientWithIdempotency(client, (method) => {
33
+ const count = (counts.get(method) ?? 0) + 1;
34
+ counts.set(method, count);
35
+ return `${capability.agentId}:${operation.event.id}:${method}:${count}`;
36
+ }) : client,
37
+ connections: { call: (integrationId, tool, input) => authority.connection(integrationId, tool, input) },
38
+ memory: {
39
+ search: (query) => authority.searchMemory(query),
40
+ remember: (content) => authority.remember(content)
41
+ },
42
+ log(...values) {
43
+ pendingLogs.push(authority.log(values));
44
+ }
45
+ };
46
+ try {
47
+ switch (operation.kind) {
48
+ case "instructions": return typeof agent.instructions === "string" ? agent.instructions : await agent.instructions(ctx);
49
+ case "knowledge": return agent.knowledge;
50
+ case "list-skills": return Object.keys(agent.skills).sort();
51
+ case "load-skill": {
52
+ const skill = agent.skills[operation.name];
53
+ if (skill === void 0) throw new Error(`Unknown agent skill: ${operation.name}`);
54
+ return skill;
55
+ }
56
+ case "event": {
57
+ if (capability.trigger.kind !== "event" || capability.trigger.eventId !== operation.event.id || capability.trigger.eventType !== operation.event.type || capability.trigger.attempt !== operation.attempt) throw new Error("The agent event does not match its call capability");
58
+ const handler = agent.events[operation.event.type];
59
+ if (handler === void 0) throw new Error(`Unknown agent event handler: ${operation.event.type}`);
60
+ return await handler(operation.event, ctx) ?? null;
61
+ }
62
+ case "tool": {
63
+ const tool = agent.tools[operation.name];
64
+ if (tool === void 0) throw new Error(`Unknown agent tool: ${operation.name}`);
65
+ return await tool.execute(operation.input, ctx);
66
+ }
67
+ }
68
+ } finally {
69
+ await Promise.all(pendingLogs);
70
+ }
71
+ }
72
+ export { invokeAgent };
73
+
74
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1,31 @@
1
+ import type { AgentContext, AgentDefinition, AgentEvent, AgentTool } from "./types.js";
2
+ export interface AgentTestRunner<Tools extends Readonly<Record<string, AgentTool>>> {
3
+ tool<Name extends keyof Tools & string>(name: Name, input: Tools[Name]["input"]["Encoded"]): ReturnType<Tools[Name]["execute"]>;
4
+ event(event: AgentEvent): Promise<unknown>;
5
+ schedule(cron: string): Promise<unknown>;
6
+ instructions(): Promise<string>;
7
+ skill(name: string): string;
8
+ }
9
+ /** Run the same registered handlers and validated tools with explicitly supplied fake authority. */
10
+ export declare function runAgent<Tools extends Readonly<Record<string, AgentTool>>>(agent: AgentDefinition<Tools>, ctx: AgentContext): AgentTestRunner<Tools>;
11
+ export interface AgentEval<Agent extends AgentDefinition = AgentDefinition> {
12
+ readonly name: string;
13
+ run(agent: Agent, ctx: AgentContext): void | Promise<void>;
14
+ }
15
+ /** Eval files are ordinary modules: define assertions in run and invoke them with runEval. */
16
+ export declare function defineEval<Agent extends AgentDefinition>(evaluation: AgentEval<Agent>): AgentEval<Agent>;
17
+ /** A failed assertion rejects instead of turning an unsuccessful evaluation into a pass. */
18
+ export declare function runEval<Agent extends AgentDefinition>(agent: Agent, evaluation: AgentEval<Agent>, ctx: AgentContext): Promise<{
19
+ name: string;
20
+ passed: boolean;
21
+ }>;
22
+ export interface RecordedCall {
23
+ method: string;
24
+ path: string;
25
+ body: unknown;
26
+ idempotencyKey: string | null;
27
+ }
28
+ /** Canned responses are keyed by `METHOD /path`. */
29
+ export declare function createTestClient(responses?: Record<string, unknown>): import("../index.js").SamvaClient & {
30
+ calls: RecordedCall[];
31
+ };
@@ -0,0 +1,66 @@
1
+ import { createBoundClient } from "../promises/client.js";
2
+ // src/agent/test.ts
3
+ function runAgent(agent, ctx) {
4
+ return {
5
+ async tool(name, input) {
6
+ const tool = agent.tools[name];
7
+ if (!tool) throw new Error(`Unknown agent tool: ${name}`);
8
+ return await tool.execute(input, ctx);
9
+ },
10
+ async event(event) {
11
+ const handler = agent.events[event.type];
12
+ if (!handler) throw new Error(`Unknown agent event handler: ${event.type}`);
13
+ return await handler(event, ctx);
14
+ },
15
+ async schedule(cron) {
16
+ const handler = agent.schedules[cron];
17
+ if (!handler) throw new Error(`Unknown agent schedule: ${cron}`);
18
+ return await handler(ctx);
19
+ },
20
+ async instructions() {
21
+ return typeof agent.instructions === "function" ? await agent.instructions(ctx) : agent.instructions;
22
+ },
23
+ skill(name) {
24
+ const markdown = agent.skills[name];
25
+ if (markdown === void 0) throw new Error(`Unknown agent skill: ${name}`);
26
+ return markdown;
27
+ }
28
+ };
29
+ }
30
+ /** Eval files are ordinary modules: define assertions in run and invoke them with runEval. */
31
+ function defineEval(evaluation) {
32
+ return evaluation;
33
+ }
34
+ /** A failed assertion rejects instead of turning an unsuccessful evaluation into a pass. */
35
+ async function runEval(agent, evaluation, ctx) {
36
+ await evaluation.run(agent, ctx);
37
+ return {
38
+ name: evaluation.name,
39
+ passed: true
40
+ };
41
+ }
42
+ /** Canned responses are keyed by `METHOD /path`. */
43
+ function createTestClient(responses = {}) {
44
+ const calls = [];
45
+ const client = createBoundClient({
46
+ baseUrl: "https://api.samva.dev",
47
+ async fetch(input, init) {
48
+ const request = new Request(input, init);
49
+ const url = new URL(request.url);
50
+ const path = url.pathname + url.search;
51
+ const text = await request.text();
52
+ calls.push({
53
+ method: request.method,
54
+ path,
55
+ body: text ? JSON.parse(text) : void 0,
56
+ idempotencyKey: request.headers.get("idempotency-key")
57
+ });
58
+ const response = responses[`${request.method} ${path}`];
59
+ return Response.json(response ?? {});
60
+ }
61
+ });
62
+ return Object.assign(client, { calls });
63
+ }
64
+ export { createTestClient, defineEval, runAgent, runEval };
65
+
66
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1,123 @@
1
+ import type { Schema } from "effect";
2
+ import type { AgentModuleManifest, AgentModuleTool } from "../client/types.gen.js";
3
+ import type { SamvaClient } from "../promises/client.js";
4
+ export type { AgentModuleManifest, AgentModuleTool } from "../client/types.gen.js";
5
+ type DeepReadonly<T> = T extends readonly (infer A)[] ? readonly DeepReadonly<A>[] : T extends object ? {
6
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
7
+ } : T;
8
+ /** Handler and tool descriptors are derived by defineAgent from the registered code. */
9
+ export type AgentManifest = DeepReadonly<Omit<AgentModuleManifest, "tools" | "skills" | "events" | "schedules">>;
10
+ /** The host supplies a fresh capability for every invocation; it is never an environment binding. */
11
+ export interface AgentCallCapability {
12
+ readonly callId: string;
13
+ readonly organizationId: string;
14
+ readonly agentId: string;
15
+ readonly versionId: string;
16
+ readonly bundleSha256: string;
17
+ /** Unix milliseconds. */
18
+ readonly expiresAt: number;
19
+ readonly trigger: {
20
+ readonly kind: "conversation";
21
+ readonly conversationId: string;
22
+ readonly counterpart: {
23
+ readonly kind: "contact";
24
+ readonly contactId: string;
25
+ } | {
26
+ readonly kind: "correspondent";
27
+ readonly correspondentId: string;
28
+ };
29
+ readonly admissionId: string;
30
+ /** The admitted mailbox target. The host still checks every SDK request against it. */
31
+ readonly target: {
32
+ readonly mailboxId: string;
33
+ readonly threadId: string;
34
+ readonly messageId: string;
35
+ } | null;
36
+ } | {
37
+ readonly kind: "event";
38
+ readonly eventId: string;
39
+ readonly eventType: string;
40
+ readonly attempt: number;
41
+ } | {
42
+ readonly kind: "schedule";
43
+ readonly cron: string;
44
+ readonly scheduledAt: number;
45
+ };
46
+ }
47
+ export interface AgentMemoryMatch {
48
+ readonly id: string;
49
+ readonly content: string;
50
+ }
51
+ export interface AgentContext {
52
+ readonly capability: AgentCallCapability;
53
+ readonly samva: SamvaClient;
54
+ readonly connections: {
55
+ call(integrationId: string, tool: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
56
+ };
57
+ readonly memory: {
58
+ search(query: string): Promise<ReadonlyArray<AgentMemoryMatch>>;
59
+ remember(content: string): Promise<void>;
60
+ };
61
+ log(...values: ReadonlyArray<unknown>): void;
62
+ }
63
+ export interface AgentEvent<Data = unknown> {
64
+ readonly id: string;
65
+ readonly type: string;
66
+ readonly timestamp: string;
67
+ readonly data: Data;
68
+ }
69
+ export type AgentEventHandler = (event: AgentEvent, ctx: AgentContext) => unknown | Promise<unknown>;
70
+ export type AgentScheduleHandler = (ctx: AgentContext) => unknown | Promise<unknown>;
71
+ export type AgentInstructions = string | ((ctx: AgentContext) => string | Promise<string>);
72
+ export interface AgentTool {
73
+ readonly input: Schema.ConstraintDecoder<unknown>;
74
+ readonly descriptor: DeepReadonly<AgentModuleTool>;
75
+ execute(input: unknown, ctx: AgentContext): Promise<unknown>;
76
+ }
77
+ export interface AgentDefinition<Tools extends Readonly<Record<string, AgentTool>> = Readonly<Record<string, AgentTool>>> {
78
+ readonly manifest: DeepReadonly<AgentModuleManifest>;
79
+ __samvaAgentRuntime(operation: AgentModuleOperation, capability: AgentCallCapability, authority: AgentModuleAuthority): Promise<unknown>;
80
+ readonly instructions: AgentInstructions;
81
+ readonly knowledge: string;
82
+ readonly skills: Readonly<Record<string, string>>;
83
+ readonly tools: Tools;
84
+ readonly events: Readonly<Record<string, AgentEventHandler>>;
85
+ readonly schedules: Readonly<Record<string, AgentScheduleHandler>>;
86
+ }
87
+ /** The host calls one operation with one call-local authority over Workers RPC. */
88
+ export type AgentModuleOperation = {
89
+ readonly kind: "instructions";
90
+ } | {
91
+ readonly kind: "knowledge";
92
+ } | {
93
+ readonly kind: "list-skills";
94
+ } | {
95
+ readonly kind: "load-skill";
96
+ readonly name: string;
97
+ } | {
98
+ readonly kind: "tool";
99
+ readonly name: string;
100
+ readonly input: unknown;
101
+ } | {
102
+ readonly kind: "event";
103
+ readonly event: AgentEvent;
104
+ readonly attempt: number;
105
+ };
106
+ export interface AgentModuleRequest {
107
+ readonly method: string;
108
+ readonly path: string;
109
+ readonly headers: Readonly<Record<string, string>>;
110
+ readonly body: string | null;
111
+ }
112
+ export interface AgentModuleResponse {
113
+ readonly status: number;
114
+ readonly headers: Readonly<Record<string, string>>;
115
+ readonly body: string;
116
+ }
117
+ export interface AgentModuleAuthority {
118
+ samva(request: AgentModuleRequest): Promise<AgentModuleResponse>;
119
+ connection(integrationId: string, tool: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
120
+ searchMemory(query: string): Promise<ReadonlyArray<AgentMemoryMatch>>;
121
+ remember(content: string): Promise<void>;
122
+ log(values: ReadonlyArray<unknown>): Promise<void>;
123
+ }
@@ -1,2 +1,2 @@
1
- import type { Client, Config } from "./types.gen";
1
+ import type { Client, Config } from "./types.gen.js";
2
2
  export declare const createClient: (config?: Config) => Client;
@@ -1,10 +1,10 @@
1
- export type { Auth } from "../core/auth.gen";
2
- export type { QuerySerializerOptions } from "../core/bodySerializer.gen";
3
- export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen";
4
- export { buildClientParams } from "../core/params.gen";
5
- export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen";
6
- export type { ServerSentEventsResult } from "../core/serverSentEvents.gen";
7
- export type { ClientMeta } from "../core/types.gen";
8
- export { createClient } from "./client.gen";
9
- export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from "./types.gen";
10
- export { createConfig, mergeHeaders } from "./utils.gen";
1
+ export type { Auth } from "../core/auth.gen.js";
2
+ export type { QuerySerializerOptions } from "../core/bodySerializer.gen.js";
3
+ export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen.js";
4
+ export { buildClientParams } from "../core/params.gen.js";
5
+ export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen.js";
6
+ export type { ServerSentEventsResult } from "../core/serverSentEvents.gen.js";
7
+ export type { ClientMeta } from "../core/types.gen.js";
8
+ export { createClient } from "./client.gen.js";
9
+ export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from "./types.gen.js";
10
+ export { createConfig, mergeHeaders } from "./utils.gen.js";
@@ -1,7 +1,7 @@
1
- import type { Auth } from "../core/auth.gen";
2
- import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen";
3
- import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen";
4
- import type { Middleware } from "./utils.gen";
1
+ import type { Auth } from "../core/auth.gen.js";
2
+ import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen.js";
3
+ import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen.js";
4
+ import type { Middleware } from "./utils.gen.js";
5
5
  export type ResponseStyle = "data" | "fields";
6
6
  export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, "body" | "headers" | "method">, CoreConfig {
7
7
  /**
@@ -1,5 +1,5 @@
1
- import type { QuerySerializerOptions } from "../core/bodySerializer.gen";
2
- import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen";
1
+ import type { QuerySerializerOptions } from "../core/bodySerializer.gen.js";
2
+ import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen.js";
3
3
  export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => ((queryParams: T) => string);
4
4
  /**
5
5
  * Infers parseAs value from provided Content-Type header.
@@ -1,5 +1,5 @@
1
- import { type Client, type ClientOptions, type Config } from "./client";
2
- import type { ClientOptions as ClientOptions2 } from "./types.gen";
1
+ import { type Client, type ClientOptions, type Config } from "./client/index.js";
2
+ import type { ClientOptions as ClientOptions2 } from "./types.gen.js";
3
3
  /**
4
4
  * The `createClientConfig()` function will be called on client initialization
5
5
  * and the returned object will become the client's initial configuration.