@superpanel-sdk/runtime 0.2.3 → 0.7.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 (319) hide show
  1. package/README.md +30 -10
  2. package/dist/builder/codegen/emit.d.ts +25 -12
  3. package/dist/builder/codegen/emit.js +339 -78
  4. package/dist/builder/codegen/generate.d.ts +21 -2
  5. package/dist/builder/codegen/generate.js +147 -34
  6. package/dist/builder/company-import-graph.d.ts +2 -0
  7. package/dist/builder/company-import-graph.js +40 -8
  8. package/dist/builder/company-imports.d.ts +29 -0
  9. package/dist/builder/company-imports.js +122 -0
  10. package/dist/builder/compile/compile-sequence.d.ts +61 -8
  11. package/dist/builder/compile/compile-sequence.js +334 -80
  12. package/dist/builder/compile/function-code.d.ts +19 -3
  13. package/dist/builder/compile/function-code.js +123 -45
  14. package/dist/builder/compile/registry.d.ts +7 -3
  15. package/dist/builder/compile/registry.js +30 -27
  16. package/dist/builder/errors.d.ts +9 -0
  17. package/dist/builder/errors.js +17 -0
  18. package/dist/builder/function-params.d.ts +10 -0
  19. package/dist/builder/function-params.js +203 -0
  20. package/dist/builder/load.d.ts +70 -10
  21. package/dist/builder/load.js +258 -67
  22. package/dist/builder/paths.d.ts +9 -1
  23. package/dist/builder/paths.js +32 -2
  24. package/dist/builder/schedules.d.ts +25 -0
  25. package/dist/builder/schedules.js +101 -0
  26. package/dist/builder/slot-schema-validation.d.ts +4 -0
  27. package/dist/builder/slot-schema-validation.js +10 -0
  28. package/dist/builder/typecheck.d.ts +8 -0
  29. package/dist/builder/typecheck.js +102 -0
  30. package/dist/builder/types.d.ts +127 -19
  31. package/dist/builder/types.js +21 -1
  32. package/dist/cli/auth/auth.d.ts +37 -0
  33. package/dist/cli/auth/auth.js +211 -0
  34. package/dist/cli/auth/backend-url.d.ts +5 -0
  35. package/dist/cli/auth/backend-url.js +25 -0
  36. package/dist/cli/auth/clipboard.d.ts +9 -0
  37. package/dist/cli/auth/clipboard.js +38 -0
  38. package/dist/cli/auth/http.d.ts +20 -0
  39. package/dist/cli/auth/http.js +27 -0
  40. package/dist/cli/auth/index.d.ts +10 -0
  41. package/dist/cli/auth/index.js +27 -0
  42. package/dist/cli/auth/progress.d.ts +12 -0
  43. package/dist/cli/auth/progress.js +15 -0
  44. package/dist/cli/auth/serve-login.d.ts +8 -0
  45. package/dist/cli/auth/serve-login.js +24 -0
  46. package/dist/cli/calls/index.d.ts +177 -0
  47. package/dist/cli/calls/index.js +96 -0
  48. package/dist/cli/compile/index.js +3 -0
  49. package/dist/cli/config.d.ts +10 -0
  50. package/dist/cli/config.js +52 -0
  51. package/dist/cli/debug/index.d.ts +31 -0
  52. package/dist/cli/debug/index.js +119 -0
  53. package/dist/cli/exec/index.d.ts +39 -0
  54. package/dist/cli/exec/index.js +138 -0
  55. package/dist/cli/exec/session.d.ts +48 -0
  56. package/dist/cli/exec/session.js +82 -0
  57. package/dist/cli/exec/trace.d.ts +18 -0
  58. package/dist/cli/exec/trace.js +52 -0
  59. package/dist/cli/index.js +112 -9
  60. package/dist/cli/logs/index.d.ts +47 -0
  61. package/dist/cli/logs/index.js +113 -0
  62. package/dist/cli/mobile/index.d.ts +12 -0
  63. package/dist/cli/mobile/index.js +405 -0
  64. package/dist/cli/serve/index.d.ts +109 -3
  65. package/dist/cli/serve/index.js +506 -118
  66. package/dist/cli/turns/index.d.ts +105 -0
  67. package/dist/cli/turns/index.js +128 -0
  68. package/dist/cli/turns/run.d.ts +13 -0
  69. package/dist/cli/turns/run.js +57 -0
  70. package/dist/cli/turns/shadow.d.ts +112 -0
  71. package/dist/cli/turns/shadow.js +54 -0
  72. package/dist/cli/type-gen/index.js +9 -9
  73. package/dist/compiler.d.ts +7 -0
  74. package/dist/compiler.js +7 -0
  75. package/dist/compute-host/compute-host.d.ts +14 -23
  76. package/dist/compute-host/compute-host.js +18 -30
  77. package/dist/compute-host/index.d.ts +2 -4
  78. package/dist/compute-host/index.js +1 -2
  79. package/dist/compute-host/source-compute-host.d.ts +10 -10
  80. package/dist/compute-host/source-compute-host.js +33 -40
  81. package/dist/core/case-orchestrator/contact-hours.d.ts +70 -0
  82. package/dist/core/case-orchestrator/contact-hours.js +127 -0
  83. package/dist/core/case-orchestrator/index.d.ts +3 -0
  84. package/dist/core/case-orchestrator/index.js +3 -0
  85. package/dist/core/case-orchestrator/render.d.ts +75 -0
  86. package/dist/core/case-orchestrator/render.js +244 -0
  87. package/dist/core/case-orchestrator/time.d.ts +11 -0
  88. package/dist/core/case-orchestrator/time.js +29 -0
  89. package/dist/core/case-orchestrator/types.d.ts +708 -0
  90. package/dist/core/case-orchestrator/types.js +42 -0
  91. package/dist/core/context/call.d.ts +291 -0
  92. package/dist/core/context/call.js +94 -0
  93. package/dist/core/context/channels.d.ts +60 -0
  94. package/dist/core/context/channels.js +35 -0
  95. package/dist/core/context/contact.d.ts +96 -6
  96. package/dist/core/context/contact.js +48 -2
  97. package/dist/core/context/email-message.d.ts +198 -0
  98. package/dist/core/context/email-message.js +86 -0
  99. package/dist/core/context/email.d.ts +109 -0
  100. package/dist/core/context/email.js +90 -0
  101. package/dist/core/context/exchanges.d.ts +167 -0
  102. package/dist/core/context/exchanges.js +81 -0
  103. package/dist/core/context/instances.d.ts +307 -0
  104. package/dist/core/context/instances.js +137 -0
  105. package/dist/core/context/kv.d.ts +113 -0
  106. package/dist/core/context/kv.js +60 -0
  107. package/dist/core/context/platform-registry.d.ts +544 -4
  108. package/dist/core/context/platform-registry.js +14 -2
  109. package/dist/core/context/platform.d.ts +2 -1
  110. package/dist/core/context/sms.d.ts +177 -0
  111. package/dist/core/context/sms.js +77 -0
  112. package/dist/core/context/types.d.ts +79 -48
  113. package/dist/core/context/types.js +1 -7
  114. package/dist/core/conversation/index.d.ts +85 -0
  115. package/dist/core/conversation/index.js +133 -0
  116. package/dist/core/functions/errors.d.ts +74 -0
  117. package/dist/core/functions/errors.js +26 -0
  118. package/dist/core/functions/events.d.ts +192 -0
  119. package/dist/core/functions/events.js +23 -0
  120. package/dist/core/functions/schedules.d.ts +50 -0
  121. package/dist/core/functions/schedules.js +20 -0
  122. package/dist/core/functions/types.d.ts +29 -73
  123. package/dist/core/functions/types.js +1 -4
  124. package/dist/core/office-hours/index.d.ts +39 -0
  125. package/dist/core/office-hours/index.js +187 -0
  126. package/dist/core/page/define.d.ts +904 -0
  127. package/dist/core/page/define.js +518 -0
  128. package/dist/core/page/envelope.d.ts +55 -0
  129. package/dist/core/page/envelope.js +4 -0
  130. package/dist/core/page/fns.d.ts +448 -0
  131. package/dist/core/page/fns.js +539 -0
  132. package/dist/core/page/memory-reader.d.ts +27 -0
  133. package/dist/core/page/memory-reader.js +299 -0
  134. package/dist/core/page/ops.d.ts +58 -0
  135. package/dist/core/page/ops.js +220 -0
  136. package/dist/core/page/page-host.d.ts +20 -0
  137. package/dist/core/page/page-host.js +57 -0
  138. package/dist/core/page/records-query.d.ts +234 -0
  139. package/dist/core/page/records-query.js +780 -0
  140. package/dist/core/page/render.d.ts +295 -0
  141. package/dist/core/page/render.js +1060 -0
  142. package/dist/core/page/sandbox.d.ts +85 -0
  143. package/dist/core/page/sandbox.js +357 -0
  144. package/dist/core/page/time-format.d.ts +46 -0
  145. package/dist/core/page/time-format.js +125 -0
  146. package/dist/core/page/timeline.d.ts +40 -0
  147. package/dist/core/page/timeline.js +2 -0
  148. package/dist/core/page/typed.d.ts +648 -0
  149. package/dist/core/page/typed.js +2 -0
  150. package/dist/core/page/workspace.d.ts +57 -0
  151. package/dist/core/page/workspace.js +266 -0
  152. package/dist/core/party/index.d.ts +3 -0
  153. package/dist/core/party/index.js +3 -0
  154. package/dist/core/party/schema.d.ts +208 -0
  155. package/dist/core/party/schema.js +113 -0
  156. package/dist/core/party/types.d.ts +35 -0
  157. package/dist/core/party/types.js +15 -0
  158. package/dist/core/sequence/define.d.ts +56 -0
  159. package/dist/core/sequence/define.js +10 -0
  160. package/dist/core/sequence/index.d.ts +63 -0
  161. package/dist/core/sequence/index.js +231 -0
  162. package/dist/core/slot/binding.d.ts +40 -0
  163. package/dist/core/slot/binding.js +2 -0
  164. package/dist/core/slot/company-metadata.d.ts +102 -0
  165. package/dist/core/slot/company-metadata.js +536 -0
  166. package/dist/core/slot/compile-schema.d.ts +19 -13
  167. package/dist/core/slot/compile-schema.js +51 -248
  168. package/dist/core/slot/contact-timezone.d.ts +110 -0
  169. package/dist/core/slot/contact-timezone.js +186 -0
  170. package/dist/core/slot/field.d.ts +2 -25
  171. package/dist/core/slot/field.js +0 -71
  172. package/dist/core/slot/id-ref.d.ts +17 -2
  173. package/dist/core/slot/id-ref.js +16 -8
  174. package/dist/core/slot/index.d.ts +12 -13
  175. package/dist/core/slot/index.js +11 -12
  176. package/dist/core/slot/naming.d.ts +15 -0
  177. package/dist/core/slot/naming.js +96 -0
  178. package/dist/core/slot/platform-fields.d.ts +119 -0
  179. package/dist/core/slot/platform-fields.js +121 -0
  180. package/dist/core/slot/ref.d.ts +16 -0
  181. package/dist/core/slot/ref.js +14 -0
  182. package/dist/core/slot/row.d.ts +2 -9
  183. package/dist/core/slot/row.js +13 -23
  184. package/dist/core/slot/schema-compat.d.ts +17 -0
  185. package/dist/core/slot/schema-compat.js +103 -0
  186. package/dist/core/slot/schema.d.ts +353 -76
  187. package/dist/core/slot/schema.js +163 -10
  188. package/dist/core/slot/types.d.ts +30 -103
  189. package/dist/core/slot/value.d.ts +28 -3
  190. package/dist/core/slot/value.js +93 -57
  191. package/dist/dev-overlay/protocol.d.ts +74 -8
  192. package/dist/fn-context/build-context.d.ts +3 -1
  193. package/dist/fn-context/build-context.js +26 -10
  194. package/dist/fn-context/fake/empty-api.js +9 -28
  195. package/dist/fn-context/fake/index.d.ts +13 -4
  196. package/dist/fn-context/fake/index.js +29 -2
  197. package/dist/fn-context/fn-params.d.ts +3 -0
  198. package/dist/fn-context/fn-params.js +10 -0
  199. package/dist/fn-context/index.d.ts +5 -5
  200. package/dist/fn-context/index.js +4 -4
  201. package/dist/fn-context/log.js +2 -2
  202. package/dist/fn-context/make-ctx.d.ts +11 -0
  203. package/dist/fn-context/make-ctx.js +20 -9
  204. package/dist/fn-context/rpc/case-orchestrator-tools.d.ts +32 -0
  205. package/dist/fn-context/rpc/case-orchestrator-tools.js +12 -0
  206. package/dist/fn-context/rpc/errors.d.ts +13 -0
  207. package/dist/fn-context/rpc/errors.js +22 -0
  208. package/dist/fn-context/rpc/index.d.ts +4 -2
  209. package/dist/fn-context/rpc/index.js +4 -2
  210. package/dist/fn-context/rpc/integration/index.d.ts +15 -5
  211. package/dist/fn-context/rpc/integration/index.js +1 -1
  212. package/dist/fn-context/rpc/integration/list-surfaces.d.ts +21 -0
  213. package/dist/fn-context/rpc/integration/{list-bindings.js → list-surfaces.js} +4 -4
  214. package/dist/fn-context/rpc/log.d.ts +11 -1
  215. package/dist/fn-context/rpc/platform.d.ts +13 -3
  216. package/dist/fn-context/rpc/platform.js +1 -1
  217. package/dist/fn-context/rpc/records.d.ts +85 -0
  218. package/dist/fn-context/rpc/records.js +24 -0
  219. package/dist/fn-context/rpc/trpc-client.d.ts +44 -2
  220. package/dist/fn-context/rpc/trpc-client.js +222 -12
  221. package/dist/fn-context/rpc/trpc-init.d.ts +21 -3
  222. package/dist/fn-context/rpc/trpc-init.js +10 -4
  223. package/dist/fn-context/rpc/trpc-router-factory.d.ts +111 -7
  224. package/dist/fn-context/rpc/trpc-router-factory.js +2 -0
  225. package/dist/fn-context/run-scope.d.ts +4 -0
  226. package/dist/fn-context/run-scope.js +9 -0
  227. package/dist/fn-context/types.d.ts +52 -5
  228. package/dist/index.d.ts +36 -46
  229. package/dist/index.js +30 -33
  230. package/dist/logger.d.ts +11 -0
  231. package/dist/logger.js +49 -0
  232. package/dist/platform.d.ts +75 -0
  233. package/dist/platform.js +57 -0
  234. package/dist/testing-compile-child.d.ts +2 -0
  235. package/dist/testing-compile-child.js +20 -0
  236. package/dist/testing.d.ts +368 -0
  237. package/dist/testing.js +439 -0
  238. package/dist/voice-service/actions.d.ts +50 -6
  239. package/dist/voice-service/index.d.ts +2 -0
  240. package/dist/voice-service/index.js +2 -0
  241. package/dist/voice-service/protocol.d.ts +604 -0
  242. package/dist/voice-service/protocol.js +67 -0
  243. package/dist/voice-service/types.d.ts +55 -8
  244. package/dist/worker.d.ts +11 -0
  245. package/dist/worker.js +11 -0
  246. package/package.json +38 -15
  247. package/dist/builder/compile/compile-agenda.d.ts +0 -15
  248. package/dist/builder/compile/compile-agenda.js +0 -64
  249. package/dist/builder/merge.d.ts +0 -4
  250. package/dist/builder/merge.js +0 -19
  251. package/dist/compute-host/read-only-cache.d.ts +0 -20
  252. package/dist/compute-host/read-only-cache.js +0 -61
  253. package/dist/core/context/db.d.ts +0 -69
  254. package/dist/core/context/db.js +0 -44
  255. package/dist/core/context/docusign.d.ts +0 -134
  256. package/dist/core/context/docusign.js +0 -108
  257. package/dist/core/context/filevine.d.ts +0 -323
  258. package/dist/core/context/filevine.js +0 -254
  259. package/dist/core/context/http.d.ts +0 -9
  260. package/dist/core/context/http.js +0 -4
  261. package/dist/core/context/hubspot.d.ts +0 -250
  262. package/dist/core/context/hubspot.js +0 -191
  263. package/dist/core/context/twilio.d.ts +0 -50
  264. package/dist/core/context/twilio.js +0 -42
  265. package/dist/core/functions/define/case-context.d.ts +0 -14
  266. package/dist/core/functions/define/case-context.js +0 -15
  267. package/dist/core/functions/define/compute.d.ts +0 -7
  268. package/dist/core/functions/define/compute.js +0 -17
  269. package/dist/core/functions/define/custom.d.ts +0 -4
  270. package/dist/core/functions/define/custom.js +0 -8
  271. package/dist/core/functions/define/system.d.ts +0 -7
  272. package/dist/core/functions/define/system.js +0 -12
  273. package/dist/core/functions/func-ref.d.ts +0 -16
  274. package/dist/core/functions/func-ref.js +0 -20
  275. package/dist/core/slot/deps.d.ts +0 -15
  276. package/dist/core/slot/deps.js +0 -88
  277. package/dist/core/slot/derived.d.ts +0 -32
  278. package/dist/core/slot/derived.js +0 -115
  279. package/dist/core/slot/platform-session-fields.d.ts +0 -38
  280. package/dist/core/slot/platform-session-fields.js +0 -48
  281. package/dist/core/slot/sf-schema.d.ts +0 -23
  282. package/dist/core/slot/sf-schema.js +0 -125
  283. package/dist/core/slot/sf-validate.d.ts +0 -14
  284. package/dist/core/slot/sf-validate.js +0 -132
  285. package/dist/core/slot/snapshot.d.ts +0 -18
  286. package/dist/core/slot/snapshot.js +0 -138
  287. package/dist/core/slot/write.d.ts +0 -48
  288. package/dist/core/slot/write.js +0 -426
  289. package/dist/core/stage/builders.d.ts +0 -54
  290. package/dist/core/stage/builders.js +0 -31
  291. package/dist/core/stage/condition.d.ts +0 -17
  292. package/dist/core/stage/condition.js +0 -198
  293. package/dist/core/stage/drive.d.ts +0 -43
  294. package/dist/core/stage/drive.js +0 -78
  295. package/dist/core/stage/finish-when.d.ts +0 -20
  296. package/dist/core/stage/finish-when.js +0 -82
  297. package/dist/core/stage/flatten.d.ts +0 -27
  298. package/dist/core/stage/flatten.js +0 -466
  299. package/dist/core/stage/index.d.ts +0 -15
  300. package/dist/core/stage/index.js +0 -13
  301. package/dist/core/stage/interrupts.d.ts +0 -28
  302. package/dist/core/stage/interrupts.js +0 -120
  303. package/dist/core/stage/ivr-fields.d.ts +0 -9
  304. package/dist/core/stage/ivr-fields.js +0 -75
  305. package/dist/core/stage/simulate.d.ts +0 -24
  306. package/dist/core/stage/simulate.js +0 -33
  307. package/dist/core/stage/transfer-fields.d.ts +0 -19
  308. package/dist/core/stage/transfer-fields.js +0 -129
  309. package/dist/core/stage/transfer-spec.d.ts +0 -48
  310. package/dist/core/stage/transfer-spec.js +0 -113
  311. package/dist/core/stage/types.d.ts +0 -208
  312. package/dist/core/stage/types.js +0 -2
  313. package/dist/core/stage/validate.d.ts +0 -11
  314. package/dist/core/stage/validate.js +0 -330
  315. package/dist/core/stage/walk.d.ts +0 -39
  316. package/dist/core/stage/walk.js +0 -119
  317. package/dist/fn-context/rpc/integration/list-bindings.d.ts +0 -21
  318. package/dist/fn-context/system-args.d.ts +0 -6
  319. package/dist/fn-context/system-args.js +0 -14
@@ -0,0 +1,42 @@
1
+ /** Reserved export of `sequences/<id>/orchestrator.ts` and its name in the build's `functions`. */
2
+ export const ORCHESTRATOR_FUNCTION = 'orchestrator';
3
+ /** `ctx.meta.entry` / RunScope entry of a Case Orchestrator call. */
4
+ export const ORCHESTRATOR_ENTRY = 'orchestrator';
5
+ /** Platform tools a Run may open. Names, descriptions, schemas and executors belong to the platform. */
6
+ export const CASE_ORCHESTRATOR_TOOL_NAMES = [
7
+ 'readExchange',
8
+ 'searchExchanges',
9
+ 'scheduleCall',
10
+ 'scheduleSms',
11
+ 'scheduleEmail',
12
+ 'scheduleUpdateSlots',
13
+ 'rescheduleAction',
14
+ 'cancelScheduledAction',
15
+ 'scheduleNextSequence',
16
+ 'scheduleWake',
17
+ 'cancelWake',
18
+ ];
19
+ export const ACTIVITY_RECENT_LIMIT = 50;
20
+ /** How far back `recentAgreedActions` reaches. */
21
+ export const RECENT_AGREED_ACTIONS_DAYS = 14;
22
+ export const EMPTY_CASE_ACTIVITY = {
23
+ timezone: 'America/New_York',
24
+ all: {
25
+ firstAt: null,
26
+ total: 0,
27
+ dayNumber: 1,
28
+ today: { calls: 0, answeredCalls: 0, smsOut: 0, smsIn: 0, emailsOut: 0, emailsIn: 0 },
29
+ last: {
30
+ exchange: null,
31
+ inbound: null,
32
+ outbound: null,
33
+ call: null,
34
+ answeredCall: null,
35
+ sms: null,
36
+ email: null,
37
+ },
38
+ recent: [],
39
+ },
40
+ byContact: {},
41
+ };
42
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,291 @@
1
+ import { z } from 'zod';
2
+ import type { Id } from '../page/typed.js';
3
+ export declare const CALL_PAGE_LIMIT_MAX = 100;
4
+ export declare const callDirection: z.ZodEnum<{
5
+ inbound: "inbound";
6
+ outbound: "outbound";
7
+ }>;
8
+ export type CallDirection = z.infer<typeof callDirection>;
9
+ /** One side of a call (21 §5.3): the AI, or a person on a line. */
10
+ export declare const callParticipant: z.ZodObject<{
11
+ id: z.ZodString;
12
+ kind: z.ZodEnum<{
13
+ ai: "ai";
14
+ party: "party";
15
+ }>;
16
+ address: z.ZodNullable<z.ZodString>;
17
+ contactId: z.ZodNullable<z.ZodString>;
18
+ identifiedReason: z.ZodNullable<z.ZodString>;
19
+ isNewContact: z.ZodBoolean;
20
+ joinedAt: z.ZodString;
21
+ leftAt: z.ZodNullable<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ export type CallParticipant = z.infer<typeof callParticipant>;
24
+ /** Script-facing call projection (27 §5): who was on it; what was said is `transcript(id)`. */
25
+ export declare const callRecord: z.ZodObject<{
26
+ id: z.ZodString;
27
+ sessionId: z.ZodNullable<z.ZodType<Id<"session">, unknown, z.core.$ZodTypeInternals<Id<"session">, unknown>>>;
28
+ instanceId: z.ZodNullable<z.ZodString>;
29
+ instanceIds: z.ZodArray<z.ZodString>;
30
+ contactIds: z.ZodArray<z.ZodString>;
31
+ participants: z.ZodArray<z.ZodObject<{
32
+ id: z.ZodString;
33
+ kind: z.ZodEnum<{
34
+ ai: "ai";
35
+ party: "party";
36
+ }>;
37
+ address: z.ZodNullable<z.ZodString>;
38
+ contactId: z.ZodNullable<z.ZodString>;
39
+ identifiedReason: z.ZodNullable<z.ZodString>;
40
+ isNewContact: z.ZodBoolean;
41
+ joinedAt: z.ZodString;
42
+ leftAt: z.ZodNullable<z.ZodString>;
43
+ }, z.core.$strip>>;
44
+ externalId: z.ZodString;
45
+ direction: z.ZodEnum<{
46
+ inbound: "inbound";
47
+ outbound: "outbound";
48
+ }>;
49
+ from: z.ZodString;
50
+ to: z.ZodString;
51
+ status: z.ZodString;
52
+ outcome: z.ZodNullable<z.ZodString>;
53
+ startedAt: z.ZodString;
54
+ endedAt: z.ZodNullable<z.ZodString>;
55
+ durationSec: z.ZodNullable<z.ZodNumber>;
56
+ recordingUrl: z.ZodNullable<z.ZodString>;
57
+ }, z.core.$strip>;
58
+ export type CallRecord = z.infer<typeof callRecord>;
59
+ export declare const callListInput: z.ZodObject<{
60
+ offset: z.ZodNumber;
61
+ limit: z.ZodNumber;
62
+ instanceId: z.ZodOptional<z.ZodString>;
63
+ contactId: z.ZodOptional<z.ZodString>;
64
+ direction: z.ZodOptional<z.ZodEnum<{
65
+ inbound: "inbound";
66
+ outbound: "outbound";
67
+ }>>;
68
+ status: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strip>;
70
+ export type CallListParams = z.infer<typeof callListInput>;
71
+ export declare const callListOutput: z.ZodObject<{
72
+ calls: z.ZodArray<z.ZodObject<{
73
+ id: z.ZodString;
74
+ sessionId: z.ZodNullable<z.ZodType<Id<"session">, unknown, z.core.$ZodTypeInternals<Id<"session">, unknown>>>;
75
+ instanceId: z.ZodNullable<z.ZodString>;
76
+ instanceIds: z.ZodArray<z.ZodString>;
77
+ contactIds: z.ZodArray<z.ZodString>;
78
+ participants: z.ZodArray<z.ZodObject<{
79
+ id: z.ZodString;
80
+ kind: z.ZodEnum<{
81
+ ai: "ai";
82
+ party: "party";
83
+ }>;
84
+ address: z.ZodNullable<z.ZodString>;
85
+ contactId: z.ZodNullable<z.ZodString>;
86
+ identifiedReason: z.ZodNullable<z.ZodString>;
87
+ isNewContact: z.ZodBoolean;
88
+ joinedAt: z.ZodString;
89
+ leftAt: z.ZodNullable<z.ZodString>;
90
+ }, z.core.$strip>>;
91
+ externalId: z.ZodString;
92
+ direction: z.ZodEnum<{
93
+ inbound: "inbound";
94
+ outbound: "outbound";
95
+ }>;
96
+ from: z.ZodString;
97
+ to: z.ZodString;
98
+ status: z.ZodString;
99
+ outcome: z.ZodNullable<z.ZodString>;
100
+ startedAt: z.ZodString;
101
+ endedAt: z.ZodNullable<z.ZodString>;
102
+ durationSec: z.ZodNullable<z.ZodNumber>;
103
+ recordingUrl: z.ZodNullable<z.ZodString>;
104
+ }, z.core.$strip>>;
105
+ offset: z.ZodNumber;
106
+ limit: z.ZodNumber;
107
+ }, z.core.$strip>;
108
+ export type CallListResult = z.infer<typeof callListOutput>;
109
+ export declare const callGetInput: z.ZodString;
110
+ export declare const callGetOutput: z.ZodNullable<z.ZodObject<{
111
+ id: z.ZodString;
112
+ sessionId: z.ZodNullable<z.ZodType<Id<"session">, unknown, z.core.$ZodTypeInternals<Id<"session">, unknown>>>;
113
+ instanceId: z.ZodNullable<z.ZodString>;
114
+ instanceIds: z.ZodArray<z.ZodString>;
115
+ contactIds: z.ZodArray<z.ZodString>;
116
+ participants: z.ZodArray<z.ZodObject<{
117
+ id: z.ZodString;
118
+ kind: z.ZodEnum<{
119
+ ai: "ai";
120
+ party: "party";
121
+ }>;
122
+ address: z.ZodNullable<z.ZodString>;
123
+ contactId: z.ZodNullable<z.ZodString>;
124
+ identifiedReason: z.ZodNullable<z.ZodString>;
125
+ isNewContact: z.ZodBoolean;
126
+ joinedAt: z.ZodString;
127
+ leftAt: z.ZodNullable<z.ZodString>;
128
+ }, z.core.$strip>>;
129
+ externalId: z.ZodString;
130
+ direction: z.ZodEnum<{
131
+ inbound: "inbound";
132
+ outbound: "outbound";
133
+ }>;
134
+ from: z.ZodString;
135
+ to: z.ZodString;
136
+ status: z.ZodString;
137
+ outcome: z.ZodNullable<z.ZodString>;
138
+ startedAt: z.ZodString;
139
+ endedAt: z.ZodNullable<z.ZodString>;
140
+ durationSec: z.ZodNullable<z.ZodNumber>;
141
+ recordingUrl: z.ZodNullable<z.ZodString>;
142
+ }, z.core.$strip>>;
143
+ /** One spoken line of a call, oldest first (events such as a transfer or a hang-up left out). */
144
+ export declare const callTranscriptLine: z.ZodObject<{
145
+ at: z.ZodString;
146
+ speaker: z.ZodEnum<{
147
+ ai: "ai";
148
+ party: "party";
149
+ }>;
150
+ participantId: z.ZodNullable<z.ZodString>;
151
+ contactId: z.ZodNullable<z.ZodString>;
152
+ instanceId: z.ZodNullable<z.ZodString>;
153
+ text: z.ZodString;
154
+ interrupted: z.ZodBoolean;
155
+ }, z.core.$strip>;
156
+ export type CallTranscriptLine = z.infer<typeof callTranscriptLine>;
157
+ export declare const callTranscriptInput: z.ZodString;
158
+ export declare const callTranscriptOutput: z.ZodNullable<z.ZodObject<{
159
+ callId: z.ZodString;
160
+ lines: z.ZodArray<z.ZodObject<{
161
+ at: z.ZodString;
162
+ speaker: z.ZodEnum<{
163
+ ai: "ai";
164
+ party: "party";
165
+ }>;
166
+ participantId: z.ZodNullable<z.ZodString>;
167
+ contactId: z.ZodNullable<z.ZodString>;
168
+ instanceId: z.ZodNullable<z.ZodString>;
169
+ text: z.ZodString;
170
+ interrupted: z.ZodBoolean;
171
+ }, z.core.$strip>>;
172
+ }, z.core.$strip>>;
173
+ export type CallTranscript = NonNullable<z.infer<typeof callTranscriptOutput>>;
174
+ /** Platform call-history capability, reached from scripts as `ctx.api.call`. */
175
+ export type CallApi = {
176
+ list(input: CallListParams): Promise<CallListResult>;
177
+ get(id: string): Promise<CallRecord | null>;
178
+ /** What was said on any call of the company and environment (27 §5.3); null when there is no such call. */
179
+ transcript(id: string): Promise<CallTranscript | null>;
180
+ };
181
+ export declare const callMockService: CallApi;
182
+ export declare const callSurface: {
183
+ methods: {
184
+ list: {
185
+ input: z.ZodObject<{
186
+ offset: z.ZodNumber;
187
+ limit: z.ZodNumber;
188
+ instanceId: z.ZodOptional<z.ZodString>;
189
+ contactId: z.ZodOptional<z.ZodString>;
190
+ direction: z.ZodOptional<z.ZodEnum<{
191
+ inbound: "inbound";
192
+ outbound: "outbound";
193
+ }>>;
194
+ status: z.ZodOptional<z.ZodString>;
195
+ }, z.core.$strip>;
196
+ output: z.ZodObject<{
197
+ calls: z.ZodArray<z.ZodObject<{
198
+ id: z.ZodString;
199
+ sessionId: z.ZodNullable<z.ZodType<Id<"session">, unknown, z.core.$ZodTypeInternals<Id<"session">, unknown>>>;
200
+ instanceId: z.ZodNullable<z.ZodString>;
201
+ instanceIds: z.ZodArray<z.ZodString>;
202
+ contactIds: z.ZodArray<z.ZodString>;
203
+ participants: z.ZodArray<z.ZodObject<{
204
+ id: z.ZodString;
205
+ kind: z.ZodEnum<{
206
+ ai: "ai";
207
+ party: "party";
208
+ }>;
209
+ address: z.ZodNullable<z.ZodString>;
210
+ contactId: z.ZodNullable<z.ZodString>;
211
+ identifiedReason: z.ZodNullable<z.ZodString>;
212
+ isNewContact: z.ZodBoolean;
213
+ joinedAt: z.ZodString;
214
+ leftAt: z.ZodNullable<z.ZodString>;
215
+ }, z.core.$strip>>;
216
+ externalId: z.ZodString;
217
+ direction: z.ZodEnum<{
218
+ inbound: "inbound";
219
+ outbound: "outbound";
220
+ }>;
221
+ from: z.ZodString;
222
+ to: z.ZodString;
223
+ status: z.ZodString;
224
+ outcome: z.ZodNullable<z.ZodString>;
225
+ startedAt: z.ZodString;
226
+ endedAt: z.ZodNullable<z.ZodString>;
227
+ durationSec: z.ZodNullable<z.ZodNumber>;
228
+ recordingUrl: z.ZodNullable<z.ZodString>;
229
+ }, z.core.$strip>>;
230
+ offset: z.ZodNumber;
231
+ limit: z.ZodNumber;
232
+ }, z.core.$strip>;
233
+ };
234
+ get: {
235
+ input: z.ZodString;
236
+ output: z.ZodNullable<z.ZodObject<{
237
+ id: z.ZodString;
238
+ sessionId: z.ZodNullable<z.ZodType<Id<"session">, unknown, z.core.$ZodTypeInternals<Id<"session">, unknown>>>;
239
+ instanceId: z.ZodNullable<z.ZodString>;
240
+ instanceIds: z.ZodArray<z.ZodString>;
241
+ contactIds: z.ZodArray<z.ZodString>;
242
+ participants: z.ZodArray<z.ZodObject<{
243
+ id: z.ZodString;
244
+ kind: z.ZodEnum<{
245
+ ai: "ai";
246
+ party: "party";
247
+ }>;
248
+ address: z.ZodNullable<z.ZodString>;
249
+ contactId: z.ZodNullable<z.ZodString>;
250
+ identifiedReason: z.ZodNullable<z.ZodString>;
251
+ isNewContact: z.ZodBoolean;
252
+ joinedAt: z.ZodString;
253
+ leftAt: z.ZodNullable<z.ZodString>;
254
+ }, z.core.$strip>>;
255
+ externalId: z.ZodString;
256
+ direction: z.ZodEnum<{
257
+ inbound: "inbound";
258
+ outbound: "outbound";
259
+ }>;
260
+ from: z.ZodString;
261
+ to: z.ZodString;
262
+ status: z.ZodString;
263
+ outcome: z.ZodNullable<z.ZodString>;
264
+ startedAt: z.ZodString;
265
+ endedAt: z.ZodNullable<z.ZodString>;
266
+ durationSec: z.ZodNullable<z.ZodNumber>;
267
+ recordingUrl: z.ZodNullable<z.ZodString>;
268
+ }, z.core.$strip>>;
269
+ };
270
+ transcript: {
271
+ input: z.ZodString;
272
+ output: z.ZodNullable<z.ZodObject<{
273
+ callId: z.ZodString;
274
+ lines: z.ZodArray<z.ZodObject<{
275
+ at: z.ZodString;
276
+ speaker: z.ZodEnum<{
277
+ ai: "ai";
278
+ party: "party";
279
+ }>;
280
+ participantId: z.ZodNullable<z.ZodString>;
281
+ contactId: z.ZodNullable<z.ZodString>;
282
+ instanceId: z.ZodNullable<z.ZodString>;
283
+ text: z.ZodString;
284
+ interrupted: z.ZodBoolean;
285
+ }, z.core.$strip>>;
286
+ }, z.core.$strip>>;
287
+ };
288
+ };
289
+ mock: CallApi;
290
+ };
291
+ //# sourceMappingURL=call.d.ts.map
@@ -0,0 +1,94 @@
1
+ import { z } from 'zod';
2
+ export const CALL_PAGE_LIMIT_MAX = 100;
3
+ export const callDirection = z.enum(['inbound', 'outbound']);
4
+ /** A session id the platform hands out: typed as one, so `db.session.findUnique({ where: { id } })` takes it. */
5
+ const sessionId = z.string();
6
+ /** One side of a call (21 §5.3): the AI, or a person on a line. */
7
+ export const callParticipant = z.object({
8
+ id: z.string(),
9
+ kind: z.enum(['ai', 'party']),
10
+ /** Their number (E.164) or address; null for the AI. */
11
+ address: z.string().nullable(),
12
+ contactId: z.string().nullable(),
13
+ /** How the contact was found: `address_match` | `resolve` | `verified` | `reconnect`; null when not known. */
14
+ identifiedReason: z.string().nullable(),
15
+ /** The contact was created for this call. */
16
+ isNewContact: z.boolean(),
17
+ joinedAt: z.string(),
18
+ leftAt: z.string().nullable(),
19
+ });
20
+ /** Script-facing call projection (27 §5): who was on it; what was said is `transcript(id)`. */
21
+ export const callRecord = z.object({
22
+ id: z.string(),
23
+ /** Null when the call never became a conversation (no answer). */
24
+ sessionId: sessionId.nullable(),
25
+ /** The call's first case; `instanceIds` all of them (a call can move to another case). */
26
+ instanceId: z.string().nullable(),
27
+ instanceIds: z.array(z.string()),
28
+ /** The contacts of the parties (`participants` of kind `party`). */
29
+ contactIds: z.array(z.string()),
30
+ participants: z.array(callParticipant),
31
+ externalId: z.string(),
32
+ direction: callDirection,
33
+ from: z.string(),
34
+ to: z.string(),
35
+ /** The provider's status of the main line (`in-progress`, `completed`, `no-answer` …). */
36
+ status: z.string(),
37
+ /** How the call ended (21 §5.2): connected | voicemail | no_answer | busy | failed | fallback | apology; null while it goes on. */
38
+ outcome: z.string().nullable(),
39
+ startedAt: z.string(),
40
+ endedAt: z.string().nullable(),
41
+ durationSec: z.number().int().min(0).nullable(),
42
+ recordingUrl: z.string().nullable(),
43
+ });
44
+ export const callListInput = z.object({
45
+ offset: z.number().int().min(0),
46
+ limit: z.number().int().min(1).max(CALL_PAGE_LIMIT_MAX),
47
+ instanceId: z.string().optional(),
48
+ contactId: z.string().optional(),
49
+ direction: callDirection.optional(),
50
+ status: z.string().optional(),
51
+ });
52
+ export const callListOutput = z.object({
53
+ calls: z.array(callRecord),
54
+ offset: z.number().int(),
55
+ limit: z.number().int(),
56
+ });
57
+ export const callGetInput = z.string().min(1);
58
+ export const callGetOutput = callRecord.nullable();
59
+ /** One spoken line of a call, oldest first (events such as a transfer or a hang-up left out). */
60
+ export const callTranscriptLine = z.object({
61
+ /** When it started, ISO 8601. */
62
+ at: z.string(),
63
+ speaker: z.enum(['ai', 'party']),
64
+ /** Who said it (a {@link CallParticipant} id); null when unclear. */
65
+ participantId: z.string().nullable(),
66
+ contactId: z.string().nullable(),
67
+ /** The case the call was on when it was said. */
68
+ instanceId: z.string().nullable(),
69
+ text: z.string(),
70
+ /** The AI was cut off while saying it. */
71
+ interrupted: z.boolean(),
72
+ });
73
+ export const callTranscriptInput = z.string().min(1);
74
+ export const callTranscriptOutput = z.object({ callId: z.string(), lines: z.array(callTranscriptLine) }).nullable();
75
+ export const callMockService = {
76
+ async list(input) {
77
+ return { calls: [], offset: input.offset, limit: input.limit };
78
+ },
79
+ async get() {
80
+ return null;
81
+ },
82
+ async transcript() {
83
+ return null;
84
+ },
85
+ };
86
+ export const callSurface = {
87
+ methods: {
88
+ list: { input: callListInput, output: callListOutput },
89
+ get: { input: callGetInput, output: callGetOutput },
90
+ transcript: { input: callTranscriptInput, output: callTranscriptOutput },
91
+ },
92
+ mock: callMockService,
93
+ };
94
+ //# sourceMappingURL=call.js.map
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The environment's numbers and mailboxes (22-sequence-as-business-unit §8), read-only. Code picks one
4
+ * of them when it assigns a contact its own (`assigned_phone_number` / `assigned_mailbox`), e.g. a
5
+ * number local to the contact's area code; `name` is what an explicit `from` takes.
6
+ */
7
+ export declare const channelPhoneNumber: z.ZodObject<{
8
+ number: z.ZodString;
9
+ name: z.ZodNullable<z.ZodString>;
10
+ locality: z.ZodNullable<z.ZodString>;
11
+ region: z.ZodNullable<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export type ChannelPhoneNumber = z.infer<typeof channelPhoneNumber>;
14
+ export declare const channelMailbox: z.ZodObject<{
15
+ address: z.ZodString;
16
+ name: z.ZodNullable<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export type ChannelMailbox = z.infer<typeof channelMailbox>;
19
+ export declare const channelsListInput: z.ZodObject<{}, z.core.$strict>;
20
+ export type ChannelsListParams = z.infer<typeof channelsListInput>;
21
+ export declare const channelsListOutput: z.ZodObject<{
22
+ phoneNumbers: z.ZodArray<z.ZodObject<{
23
+ number: z.ZodString;
24
+ name: z.ZodNullable<z.ZodString>;
25
+ locality: z.ZodNullable<z.ZodString>;
26
+ region: z.ZodNullable<z.ZodString>;
27
+ }, z.core.$strip>>;
28
+ mailboxes: z.ZodArray<z.ZodObject<{
29
+ address: z.ZodString;
30
+ name: z.ZodNullable<z.ZodString>;
31
+ }, z.core.$strip>>;
32
+ }, z.core.$strip>;
33
+ export type ChannelsListResult = z.infer<typeof channelsListOutput>;
34
+ /** The environment's active numbers and mailboxes, reached from scripts as `ctx.api.channels`. */
35
+ export type ChannelsApi = {
36
+ list(input: ChannelsListParams): Promise<ChannelsListResult>;
37
+ };
38
+ /** Stand-in surface for fake contexts and local runs; never touches the database. */
39
+ export declare const channelsMockService: ChannelsApi;
40
+ export declare const channelsSurface: {
41
+ methods: {
42
+ list: {
43
+ input: z.ZodObject<{}, z.core.$strict>;
44
+ output: z.ZodObject<{
45
+ phoneNumbers: z.ZodArray<z.ZodObject<{
46
+ number: z.ZodString;
47
+ name: z.ZodNullable<z.ZodString>;
48
+ locality: z.ZodNullable<z.ZodString>;
49
+ region: z.ZodNullable<z.ZodString>;
50
+ }, z.core.$strip>>;
51
+ mailboxes: z.ZodArray<z.ZodObject<{
52
+ address: z.ZodString;
53
+ name: z.ZodNullable<z.ZodString>;
54
+ }, z.core.$strip>>;
55
+ }, z.core.$strip>;
56
+ };
57
+ };
58
+ mock: ChannelsApi;
59
+ };
60
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The environment's numbers and mailboxes (22-sequence-as-business-unit §8), read-only. Code picks one
4
+ * of them when it assigns a contact its own (`assigned_phone_number` / `assigned_mailbox`), e.g. a
5
+ * number local to the contact's area code; `name` is what an explicit `from` takes.
6
+ */
7
+ export const channelPhoneNumber = z.object({
8
+ /** E.164. */
9
+ number: z.string(),
10
+ name: z.string().nullable(),
11
+ locality: z.string().nullable(),
12
+ region: z.string().nullable(),
13
+ });
14
+ export const channelMailbox = z.object({
15
+ address: z.string(),
16
+ name: z.string().nullable(),
17
+ });
18
+ export const channelsListInput = z.strictObject({});
19
+ export const channelsListOutput = z.object({
20
+ phoneNumbers: z.array(channelPhoneNumber),
21
+ mailboxes: z.array(channelMailbox),
22
+ });
23
+ /** Stand-in surface for fake contexts and local runs; never touches the database. */
24
+ export const channelsMockService = {
25
+ async list() {
26
+ return { phoneNumbers: [], mailboxes: [] };
27
+ },
28
+ };
29
+ export const channelsSurface = {
30
+ methods: {
31
+ list: { input: channelsListInput, output: channelsListOutput },
32
+ },
33
+ mock: channelsMockService,
34
+ };
35
+ //# sourceMappingURL=channels.js.map
@@ -1,11 +1,16 @@
1
1
  import { z } from 'zod';
2
+ import type { Id } from '../page/typed.js';
2
3
  export declare const CONTACT_PAGE_LIMIT_MAX = 100;
4
+ /** A filled slot value as scripts read and write it. */
5
+ export declare const slotFieldValue: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>;
6
+ export type SlotFieldValue = z.infer<typeof slotFieldValue>;
3
7
  export declare const contactSummary: z.ZodObject<{
4
- id: z.ZodString;
8
+ id: z.ZodCustom<Id<"contact">, Id<"contact">>;
5
9
  kind: z.ZodString;
6
- externalIdentifier: z.ZodNullable<z.ZodString>;
7
10
  phone: z.ZodNullable<z.ZodString>;
11
+ email: z.ZodNullable<z.ZodString>;
8
12
  createdAt: z.ZodString;
13
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
9
14
  }, z.core.$strip>;
10
15
  export type ContactSummary = z.infer<typeof contactSummary>;
11
16
  export declare const contactListInput: z.ZodObject<{
@@ -17,19 +22,58 @@ export declare const contactListInput: z.ZodObject<{
17
22
  export type ContactListParams = z.infer<typeof contactListInput>;
18
23
  export declare const contactListOutput: z.ZodObject<{
19
24
  contacts: z.ZodArray<z.ZodObject<{
20
- id: z.ZodString;
25
+ id: z.ZodCustom<Id<"contact">, Id<"contact">>;
21
26
  kind: z.ZodString;
22
- externalIdentifier: z.ZodNullable<z.ZodString>;
23
27
  phone: z.ZodNullable<z.ZodString>;
28
+ email: z.ZodNullable<z.ZodString>;
24
29
  createdAt: z.ZodString;
30
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
25
31
  }, z.core.$strip>>;
26
32
  offset: z.ZodNumber;
27
33
  limit: z.ZodNumber;
28
34
  }, z.core.$strip>;
29
35
  export type ContactListResult = z.infer<typeof contactListOutput>;
36
+ /** Exactly one identity: an id, a phone or an email. */
37
+ export declare const contactFindInput: z.ZodUnion<readonly [z.ZodObject<{
38
+ id: z.ZodString;
39
+ }, z.core.$strict>, z.ZodObject<{
40
+ phone: z.ZodString;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ email: z.ZodString;
43
+ }, z.core.$strict>]>;
44
+ export type ContactFindParams = z.infer<typeof contactFindInput>;
45
+ export declare const contactFindOutput: z.ZodObject<{
46
+ contacts: z.ZodArray<z.ZodObject<{
47
+ id: z.ZodCustom<Id<"contact">, Id<"contact">>;
48
+ kind: z.ZodString;
49
+ phone: z.ZodNullable<z.ZodString>;
50
+ email: z.ZodNullable<z.ZodString>;
51
+ createdAt: z.ZodString;
52
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
53
+ }, z.core.$strip>>;
54
+ }, z.core.$strip>;
55
+ export type ContactFindResult = z.infer<typeof contactFindOutput>;
56
+ export declare const contactCreateInput: z.ZodObject<{
57
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
58
+ }, z.core.$strict>;
59
+ export type ContactCreateParams = z.infer<typeof contactCreateInput>;
60
+ export declare const contactIdInput: z.ZodObject<{
61
+ contactId: z.ZodString;
62
+ }, z.core.$strict>;
63
+ export type ContactIdParams = z.infer<typeof contactIdInput>;
30
64
  /** Platform contact capability, reached from scripts as `ctx.api.contact`. */
31
65
  export type ContactApi = {
32
66
  list(input: ContactListParams): Promise<ContactListResult>;
67
+ /** Contacts with this id, phone or email; several people can share a phone or an email. */
68
+ find(input: ContactFindParams): Promise<ContactFindResult>;
69
+ /** A new contact with these fields filled (`kind` defaults to `person`). */
70
+ create(input: ContactCreateParams): Promise<ContactSummary>;
71
+ /**
72
+ * "Remove" a contact (14-sequence-instance §5.5): clear its phone, email and every other identifier
73
+ * field, drop their lookup rows, cancel its pending scheduled actions. The record and its history
74
+ * stay. An opted-out contact's addresses go to the do-not-contact list first.
75
+ */
76
+ clearContactMethods(input: ContactIdParams): Promise<ContactSummary>;
33
77
  };
34
78
  /** Stand-in surface for fake contexts and local runs; never touches the database. */
35
79
  export declare const contactMockService: ContactApi;
@@ -44,16 +88,62 @@ export declare const contactSurface: {
44
88
  }, z.core.$strip>;
45
89
  output: z.ZodObject<{
46
90
  contacts: z.ZodArray<z.ZodObject<{
47
- id: z.ZodString;
91
+ id: z.ZodCustom<Id<"contact">, Id<"contact">>;
48
92
  kind: z.ZodString;
49
- externalIdentifier: z.ZodNullable<z.ZodString>;
50
93
  phone: z.ZodNullable<z.ZodString>;
94
+ email: z.ZodNullable<z.ZodString>;
51
95
  createdAt: z.ZodString;
96
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
52
97
  }, z.core.$strip>>;
53
98
  offset: z.ZodNumber;
54
99
  limit: z.ZodNumber;
55
100
  }, z.core.$strip>;
56
101
  };
102
+ find: {
103
+ input: z.ZodUnion<readonly [z.ZodObject<{
104
+ id: z.ZodString;
105
+ }, z.core.$strict>, z.ZodObject<{
106
+ phone: z.ZodString;
107
+ }, z.core.$strict>, z.ZodObject<{
108
+ email: z.ZodString;
109
+ }, z.core.$strict>]>;
110
+ output: z.ZodObject<{
111
+ contacts: z.ZodArray<z.ZodObject<{
112
+ id: z.ZodCustom<Id<"contact">, Id<"contact">>;
113
+ kind: z.ZodString;
114
+ phone: z.ZodNullable<z.ZodString>;
115
+ email: z.ZodNullable<z.ZodString>;
116
+ createdAt: z.ZodString;
117
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
118
+ }, z.core.$strip>>;
119
+ }, z.core.$strip>;
120
+ };
121
+ create: {
122
+ input: z.ZodObject<{
123
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
124
+ }, z.core.$strict>;
125
+ output: z.ZodObject<{
126
+ id: z.ZodCustom<Id<"contact">, Id<"contact">>;
127
+ kind: z.ZodString;
128
+ phone: z.ZodNullable<z.ZodString>;
129
+ email: z.ZodNullable<z.ZodString>;
130
+ createdAt: z.ZodString;
131
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
132
+ }, z.core.$strip>;
133
+ };
134
+ clearContactMethods: {
135
+ input: z.ZodObject<{
136
+ contactId: z.ZodString;
137
+ }, z.core.$strict>;
138
+ output: z.ZodObject<{
139
+ id: z.ZodCustom<Id<"contact">, Id<"contact">>;
140
+ kind: z.ZodString;
141
+ phone: z.ZodNullable<z.ZodString>;
142
+ email: z.ZodNullable<z.ZodString>;
143
+ createdAt: z.ZodString;
144
+ fields: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodNull]>>;
145
+ }, z.core.$strip>;
146
+ };
57
147
  };
58
148
  mock: ContactApi;
59
149
  };