@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,75 @@
1
+ /**
2
+ * The whole runtime, for the platform: every other entry (the company API `index.ts`, the Worker shell
3
+ * `worker.ts`, the compiler `compiler.ts`) and the slot and page engines and RPC routers behind them.
4
+ * Platform services, tests and scripts import from here; only the Worker shell takes `./worker` and the
5
+ * compile child `./compiler`, which stay small. Platform-only: the package resolves `./platform` under the
6
+ * `superpanel-platform` condition, so company code cannot import it.
7
+ */
8
+ export type { CompanyFieldDef, CompanyNormalFieldDef, CompanySchema, CompanyTableDef, DataType, ContactSchedule, LocalTimeRange, ContactWeekday, ScalarDataType, NormalFieldCore, SessionDataType, SessionFieldDef, SessionSchema, TableRef, } from './core/slot/schema.js';
9
+ export { ROW_ID_FIELD, ROW_SYSTEM_KEYS, ROW_TIME_KEYS, isRowTimeKey, type RowSystemKey, type RowTimeKey, idFieldCore, normalFieldCoreSchema, companyNormalFieldDefSchema, tableRefSchema, companyFieldDefSchema, companyTableDefSchema, companySchemaSchema, contactScheduleValueSchema, localTimeRangeSchema, isCompanySchema, EMPTY_SESSION_SCHEMA, sessionFieldDefSchema, sessionSchemaSchema, } from './core/slot/schema.js';
10
+ export { CONTACT_OPT_OUT_FIELDS, CONTACT_TABLE, LIMITS, POLICY_IDS, PLATFORM_CONTACT_FIELDS, PLATFORM_SESSION_FIELDS, PLATFORM_SESSION_SCHEMA, SESSION_TABLE, validateCompanySchema, sessionSchemaIssues, isCustomTable, isParentField, isRecordTable, parentOf, subjectTableIssues, type ResponsePolicyId, type SlotFillingPolicyId, type VoiceProfileId, } from './core/slot/company-metadata.js';
11
+ export { STATE_CODES, STATE_TIMEZONES, areaCodeTimezone, contactTimezone, knownTimezone, postalTimezone, stateCode, type StateCode, type TimezoneSource, } from './core/slot/contact-timezone.js';
12
+ export { randomTimeBetween } from './core/case-orchestrator/time.js';
13
+ export { contactHoursOn, contactScheduleHours, everyDay, nextContactTime, withinContactHours, type ContactHours, type ContactHoursIgnore, type ContactHoursRange, type ContactHoursWeekday, type ContactScheduleValue, } from './core/case-orchestrator/contact-hours.js';
14
+ export { integrationSurfaceKeys } from './core/context/types.js';
15
+ export { lookupRef, parentRef } from './core/slot/id-ref.js';
16
+ export type { EmailApi, EmailAttachment, EmailGetAttachmentInput, EmailGetAttachmentOutput, EmailGetMessageInput, EmailGetMessageOutput, EmailListMessagesInput, EmailListMessagesOutput, EmailProvider, EmailProviderService, EmailSendEmailInput, EmailSendEmailOutput, EmailService, } from './core/context/email.js';
17
+ export { EMAIL_PLATFORM_ONLY_METHODS, emailGetAttachmentInput, emailGetAttachmentOutput, emailGetMessageInput, emailGetMessageOutput, emailListMessagesInput, emailListMessagesOutput, emailMockService, emailProvider, emailSendEmailInput, emailSendEmailOutput, } from './core/context/email.js';
18
+ export type { ContactApi, IntegrationSurfaceMeta, EnvApi, EnvService, FieldState, IntegrationAccountFields, IntegrationApi, IntegrationStub, IntegrationSurfaceKey, IntegrationTarget, Logger, MakeCtxOverrides, SystemContext, } from './core/context/types.js';
19
+ export { CALL_PAGE_LIMIT_MAX, callDirection, callGetInput, callGetOutput, callListInput, callListOutput, callMockService, callParticipant, callRecord, callSurface, callTranscriptInput, callTranscriptLine, callTranscriptOutput, type CallApi, type CallDirection, type CallListParams, type CallListResult, type CallParticipant, type CallRecord, type CallTranscript, type CallTranscriptLine, } from './core/context/call.js';
20
+ export { CONTACT_PAGE_LIMIT_MAX, contactCreateInput, contactFindInput, contactFindOutput, contactListInput, contactListOutput, contactMockService, contactSummary, contactSurface, slotFieldValue, type ContactCreateParams, type ContactFindParams, type ContactFindResult, type ContactListParams, type ContactListResult, type ContactSummary, type SlotFieldValue, } from './core/context/contact.js';
21
+ export { instanceCloseInput, instanceCloseOutput, instanceFindForContactInput, instanceIdInput, instanceListOutput, instanceNotifyInput, instanceNotifyOutput, instanceSetVariablesInput, instanceStartInput, instanceStartOutput, instanceSummary, instancesMockService, instancesSurface, type InstanceCloseParams, type InstanceCloseResult, type InstanceFindForContactParams, type InstanceIdParams, type InstanceListResult, type InstanceNotifyParams, type InstanceNotifyResult, type InstanceSetVariablesParams, type InstanceStartParams, type InstanceStartResult, type InstanceSummary, type InstancesApi, } from './core/context/instances.js';
22
+ export { channelMailbox, channelPhoneNumber, channelsListInput, channelsListOutput, channelsMockService, channelsSurface, type ChannelMailbox, type ChannelPhoneNumber, type ChannelsApi, type ChannelsListParams, type ChannelsListResult, } from './core/context/channels.js';
23
+ export { exchangeEmailThreadInput, exchangeEmailThreadOutput, exchangeLastInput, exchangeLastOutput, exchangeRef, exchangeSummary, exchangesMockService, exchangesSurface, type ExchangeRef, type ExchangeEmailThreadParams, type ExchangeEmailThreadResult, type ExchangeLastParams, type ExchangeLastResult, type ExchangeSummary, type ExchangesApi, } from './core/context/exchanges.js';
24
+ export { SYSTEM_VARIABLES, compileVariables, defineSequence, defineVariables, isSystemVariable, json, readVariables, startVariables, variableValueIssue, variablesSize, variablesWriteIssues, type CompiledExperiments, type CompiledVariable, type CompiledVariables, type ExperimentDecl, type JsonVariableType, type SequenceDefinition, type SystemVariableName, type VariableDecl, type VariableDecls, type VariablesOf, } from './core/sequence/index.js';
25
+ export { EMAIL_PAGE_LIMIT_MAX, emailDirection, emailGetInput, emailGetOutput, emailHistoryMockService, emailHistorySurface, emailListInput, emailListOutput, emailRecord, emailSendInput, emailSendOutput, type EmailDirection, type EmailHistoryApi, type EmailListParams, type EmailListResult, type EmailRecord, type EmailSendParams, type EmailSendResult, } from './core/context/email-message.js';
26
+ export { KV_KEY_MAX, KV_SCOPES, KV_TTL_SECONDS_MAX, KV_VALUE_MAX, kvDelInput, kvDelOutput, kvGetInput, kvGetOutput, kvMockService, kvScope, kvSetInput, kvSetOutput, kvSurface, type KvApi, type KvDelInput, type KvDelOutput, type KvGetInput, type KvGetOutput, type KvScope, type KvSetInput, type KvSetOutput, } from './core/context/kv.js';
27
+ export { SMS_PAGE_LIMIT_MAX, smsDirection, smsGetInput, smsGetOutput, smsListInput, smsListOutput, smsMockService, smsRecord, smsSurface, type SmsApi, type SmsDirection, type SmsListParams, type SmsListResult, type SmsRecord, } from './core/context/sms.js';
28
+ export { bindEnvService, envMockService, readEnvGet } from './core/context/env.js';
29
+ export type { AnyPlatformSurface, PlatformApiShape, PlatformImpl, PlatformSurface } from './core/context/platform.js';
30
+ export { platformSurfaces, type PlatformApis, type PlatformSurfaceKey } from './core/context/platform-registry.js';
31
+ export type { CompiledSlotSchema, FieldValue, MultiRowRecord, MultiRowTableData, RuntimeFieldDef, RuntimeTableDef, SingleRowTableData, SlotValue, UpdatedBy, ValidationIssue, ValidationResult, WriteSource, } from './core/slot/types.js';
32
+ export type { CompanyBuild, CompanyPart, FunctionSourceMap, RuntimePackageSource, SequenceBuild, SourceMaps } from './builder/types.js';
33
+ export { COMPANY_SCOPE, CONTEXT_PAGE_FUNCTION, functionKey, functionScriptFile } from './builder/types.js';
34
+ export { parseOfficeHours, resolveOfficeHours, type OfficeHours, type OfficeHoursSnapshot, type ParseOfficeHoursResult, type Weekday, type Window, } from './core/office-hours/index.js';
35
+ export type { Ctx, FuncMap, FunctionRegistry, FunctionRegistryEntry, PlainFn } from './core/functions/types.js';
36
+ export type { AnyEventHandlers, CallEndedEvent, CallEventBase, CallInboundEvent, CallOutboundEvent, EmailReceivedEvent, EmailEventBase, EmailSendRequestedEvent, EventHandler, EventHandlerArgs, EventHandlers, SmsReceivedEvent, SmsEventBase, SmsSendRequestedEvent, SystemEventMap, SystemEventName, SystemEventPayload, WebhookEvent, WebhookHandler, WebhookOutcome, WebhookRequest, } from './core/functions/events.js';
37
+ export { isSystemEventName, SYSTEM_EVENT_NAMES, SYSTEM_EVENTS, WEBHOOK_RECEIVED_FUNCTION, webhookOutcome, } from './core/functions/events.js';
38
+ export { defineSchedules, SCHEDULE_FUNCTION_PREFIX, SCHEDULES_MODULE, scheduleFunctionName, type ScheduleDefinition, type ScheduleManifest, type Schedules, type ScheduleTick, } from './core/functions/schedules.js';
39
+ export { parseSchedules, scheduleTimingIssue } from './builder/schedules.js';
40
+ export { ERROR_JSON_MAX_BYTES, ERRORS_MODULE, ON_ERROR_FUNCTION, PLATFORM_UNAVAILABLE_MESSAGE, PlatformUnavailableError, type CodeErrorEvent, type CodeErrorKind, type CodeErrorSourceType, type OnError, } from './core/functions/errors.js';
41
+ export { toEventRegistry, toFunctionRegistry } from './builder/compile/registry.js';
42
+ export { compileFunctionCode } from './builder/compile/function-code.js';
43
+ export { COMPILE_CONCURRENCY, COMPILE_SEQUENCE_TIMEOUT_MS, compileAll, compileCompanyPart, compileRepo, compileSequence, compileSequenceBuild, runtimePackageSource, runtimePackageVersion, type CompileRepoEvent, type CompileRepoOptions, type CompileRepoSequenceResult, type CompileSequenceOptions, type CompileSequenceResult, } from './builder/compile/compile-sequence.js';
44
+ export { loadSequenceEvents, loadSequenceFunctions } from './builder/load.js';
45
+ export { findTsModule } from './builder/paths.js';
46
+ export type { OverlayClientMessage, OverlayExecuteMessage, OverlayExecuteResultMessage, OverlayAuthErrorMessage, OverlayAuthMessage, OverlayAuthOkMessage, OverlayMessage, OverlayNoticeMessage, OverlayPushMessage, OverlayReplacedMessage, OverlayServerMessage, } from './dev-overlay/protocol.js';
47
+ export { encodeOverlayMessage, OVERLAY_REPLACED_CLOSE_CODE, parseOverlayMessage } from './dev-overlay/protocol.js';
48
+ export { asCaseOrchestratorRun, buildActionContext, buildCaseOrchestratorContext, bindLogMeta, createFakeApiHost, defaultPlatformApis, emptyIntegration, createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, encodeLogTagsHeader, formatRuntimeVersion, readLogTagsHeader, readRequestIdHeader, readRuntimeVersionHeader, makeCaseOrchestratorCtx, makeCtx, makeCtxAsync, noopLog, type ActionContext, type ActionDataSlice, type ApiGiven, type ApiHost, type CaseOrchestratorActionContext, type CaseOrchestratorApiHost, type CaseOrchestratorRunScope, type FakeApiHostOptions, type RunClaims, type RunScope, } from './fn-context/index.js';
49
+ export { createAppRouter, createIntegrationRouter, createListSurfacesProcedure, createLogRouter, createPlatformRouter, createCaseOrchestratorToolsRouter, createRecordsRouter, isRpcCodedError, parseScriptInput, reasonError, RpcReasonError, ScriptInputError, type AppRouter, type RpcCodedError, type RpcErrorCode, type IntegrationInvokeHandler, type LogEmitHandler, type PlatformInvokeHandler, type CaseOrchestratorToolInvokeHandler, type RecordsReadInput, type RecordsHandlers, type RecordsResult, type RecordsWriteInput, type RpcContext, } from './fn-context/rpc/index.js';
50
+ export * from './compute-host/index.js';
51
+ export type { BoundRow, Cell, CellBinding, CellRef, RowRef } from './core/slot/binding.js';
52
+ export { announceAction, createRowAction, definePage, deleteRowAction, emptyRuns, endAction, fieldCell, keypadAction, lastActionRun, pageEntry, transferTo, isSipUri, runFunction, voicemailAction, PAGE_TOOLS, type PageToolName, type ToolAction, type PageFarEnd, type PageHeard, type VoicemailAction, cancelFollowUpAction, followUpAction, choose, isChoose, refFieldCell, type RefFieldCell, type RefOption, type ChooseParam, type FunctionAction, type FollowUpAction, type CancelFollowUpAction, type PageTime, tried, type PageActionRun, type ActionRunScope, type AnnounceAction, type ChannelAction, type DefinedPage, type EndAction, type KeypadAction, type PageChannel, type PageDefinition, type PageFunction, type PagePersona, type PageNextStep, type PageFaq, type PageFaqEntry, type PageStart, checkPageStart, MAX_FAQ_ENTRIES, type PageRuns, type PageScheduledAction, type TransferAction, type ActionContext as PageActionContext, type ActionParam, type ActionParameters, type CreateRowAction, type CustomAction, type DeleteRowAction, type FieldCell, type FieldOptions, type FindArgs, type Placeable, type SchemaFieldParam, type PageAction as PageScriptAction, type PageContext, type PageContextOf, type PageBaseContext, type PageCallCaps, type PageCallPhase, type PagePreviousCall, type PageChannelCaps, type PageSmsMessage, type PageEmailMessage, PAGE_CHANNELS, type PageConversation, type PageHistory, type PageEntryArg, type PageRow as PageScriptRow, type Db, type ReadDb, type Slot, type SlotRef, type SlotState, type TableReader, type TableWriter, } from './core/page/define.js';
53
+ export { actionKey, runKeyOf, fallbackPage, PageDocumentError, pressedButton, renderDocument, RowNames, type AutoAction, type BlockNode, type PageNode, type PageReads, type InputProperty, type InputSchema, type ReadSlot, type RenderDocumentInput, type RenderedAction, type RenderedCell, type RenderedPage as RenderedPageDocument, } from './core/page/render.js';
54
+ export { announce, backgroundTransfer, block, button, cancelFollowUp, coldTransfer, convertTime, createRow, data, deleteRow, doNow, end, field, functionHandles, actionHandles, isNode, keypad, list, page, pressKeypad, refField, run, scheduleFollowUp, text, toFnPageResult, toolbox, voicemail, warmTransfer, type FunctionHandle, type PageActionHandle, type PageContent, type PageNode as PageFnNode, } from './core/page/fns.js';
55
+ export { isEnvelope, type Envelope, type EnvelopeNode, type EnvelopePage } from './core/page/envelope.js';
56
+ export { TIMELINE_KINDS, type TimelineEntry, type TimelineKind, type TimelineWhere } from './core/page/timeline.js';
57
+ export { blockAt, nextStepReference, viewText, workspaceText, type WorkspaceNote, type WorkspaceTextOptions } from './core/page/workspace.js';
58
+ export type { CreateData, FindManyArgs, FindUniqueArgs, Id, IncludeArg, PageFieldDesc, PageTablesDesc, RowOf, SelectArg, PageActionFn, TypedActionContext, TypedPageContext, TypedPageModule, TypedDb, TypedReadDb, TypedSlot, UpdateData, Where, } from './core/page/typed.js';
59
+ export { resolvePageOps, type ActionOp, type DroppedOp, type OpenOp, type PageOp, type PageOpsAllowed, type ResolvedActionOp, type ResolvedOp, type ResolvedOpenOp, type ResolvedSlotOp, type SlotOp, } from './core/page/ops.js';
60
+ export { emitSlotsSource } from './builder/codegen/emit.js';
61
+ export { companySchemaCompatibilityIssues, compiledTableEntries, compileSlotSchema, emptyFieldValue, formatFieldPath, getCompiledTable, getTableField, relationsOf, type TableRelation, isFieldValue, isReservedTableName, isResolved, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, DATE_VALUE_FORMAT, DATE_VALUE_PATTERN, DATETIME_VALUE_FORMAT, DATETIME_VALUE_PATTERN, isValidDataTypeValue, companyFieldToRuntime, makeFieldValue, parseFieldPath, refKind, refValueIssues, requireFieldPath, slotFieldEntries, slotFieldNames, validateBareValue, validateFieldRefs, } from './core/slot/index.js';
62
+ export type { RefKind } from './core/slot/index.js';
63
+ export type { FieldPath, ParsedFieldPath, SlotRow, } from './core/slot/index.js';
64
+ export { canonicalLanguage, CHANNELS, checkSpoken, CONTACT_LANGUAGES, fallbackSpoken, isContactLanguage, isSpokenLanguage, languageName, matchContactLanguage, matchSpokenLanguage, pickSpoken, SPOKEN_LANGUAGES, type Channel, type Direction, type ScheduledContactContext, type Spoken, type ContactLanguage, type SpokenLanguage, type SpokenTag, } from './core/conversation/index.js';
65
+ export * from './core/case-orchestrator/index.js';
66
+ export * from './core/party/index.js';
67
+ export * from './voice-service/index.js';
68
+ export { dayIn, formatTime, timeAt, timeParts, type FormatTimeOptions, type TimeParts, type TimeStyle } from './core/page/time-format.js';
69
+ export { CONSOLE_LINE_MAX_CHARS, CONSOLE_LINES_PER_RUN, CONSOLE_METHODS, DEFAULT_SANDBOX_LIMITS, runInSandbox, SandboxError, type ConsoleLevel, type ConsoleMethod, type ConsoleSink, type HostCall, type HostResult, type SandboxErrorKind, type SandboxInput, type SandboxLimits, type SandboxOutput, type SandboxStats, } from './core/page/sandbox.js';
70
+ export { asArray, checkListSizes, afterOf, COMBINATORS, findAnchors, indexConditions, indexedFieldsOf, indexOrder, indexValueOf, isPlainObject, isUuid, limitExceeded, matches, optionalCount, orderKeys, orderRows, pageRows, RECORDS_LIMITS, RecordsQueryError, refuseSearch, relatedKey, relationFilters, RELATION_INCLUDE_KEYS, selectFields, skipOf, startableConditions, tableIndexedFields, toSlot, unstartableWhy, WAY_BACK_FILTERS, wayBackFilters, type Anchor, type FindArgs as RecordsFindArgs, type IndexCondition, type IndexedField, type IndexOrder, type IndexValue, type MatchContext, type RecordsCall, type RecordsMethod, type RecordsQueryErrorCode, type RowOut, type SlotOut, type WhereInput, } from './core/page/records-query.js';
71
+ export { atCall, dayCall, DEFAULT_PAGE_ZONE, partsCall, timeCall, timeOfCaller } from './core/page/page-host.js';
72
+ export * from './index.js';
73
+ export * from './worker.js';
74
+ export * from './compiler.js';
75
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1,57 @@
1
+ export { ROW_ID_FIELD, ROW_SYSTEM_KEYS, ROW_TIME_KEYS, isRowTimeKey, idFieldCore, normalFieldCoreSchema, companyNormalFieldDefSchema, tableRefSchema, companyFieldDefSchema, companyTableDefSchema, companySchemaSchema, contactScheduleValueSchema, localTimeRangeSchema, isCompanySchema, EMPTY_SESSION_SCHEMA, sessionFieldDefSchema, sessionSchemaSchema, } from './core/slot/schema.js';
2
+ export { CONTACT_OPT_OUT_FIELDS, CONTACT_TABLE, LIMITS, POLICY_IDS, PLATFORM_CONTACT_FIELDS, PLATFORM_SESSION_FIELDS, PLATFORM_SESSION_SCHEMA, SESSION_TABLE, validateCompanySchema, sessionSchemaIssues, isCustomTable, isParentField, isRecordTable, parentOf, subjectTableIssues, } from './core/slot/company-metadata.js';
3
+ export { STATE_CODES, STATE_TIMEZONES, areaCodeTimezone, contactTimezone, knownTimezone, postalTimezone, stateCode, } from './core/slot/contact-timezone.js';
4
+ export { randomTimeBetween } from './core/case-orchestrator/time.js';
5
+ export { contactHoursOn, contactScheduleHours, everyDay, nextContactTime, withinContactHours, } from './core/case-orchestrator/contact-hours.js';
6
+ export { integrationSurfaceKeys } from './core/context/types.js';
7
+ export { lookupRef, parentRef } from './core/slot/id-ref.js';
8
+ export { EMAIL_PLATFORM_ONLY_METHODS, emailGetAttachmentInput, emailGetAttachmentOutput, emailGetMessageInput, emailGetMessageOutput, emailListMessagesInput, emailListMessagesOutput, emailMockService, emailProvider, emailSendEmailInput, emailSendEmailOutput, } from './core/context/email.js';
9
+ export { CALL_PAGE_LIMIT_MAX, callDirection, callGetInput, callGetOutput, callListInput, callListOutput, callMockService, callParticipant, callRecord, callSurface, callTranscriptInput, callTranscriptLine, callTranscriptOutput, } from './core/context/call.js';
10
+ export { CONTACT_PAGE_LIMIT_MAX, contactCreateInput, contactFindInput, contactFindOutput, contactListInput, contactListOutput, contactMockService, contactSummary, contactSurface, slotFieldValue, } from './core/context/contact.js';
11
+ export { instanceCloseInput, instanceCloseOutput, instanceFindForContactInput, instanceIdInput, instanceListOutput, instanceNotifyInput, instanceNotifyOutput, instanceSetVariablesInput, instanceStartInput, instanceStartOutput, instanceSummary, instancesMockService, instancesSurface, } from './core/context/instances.js';
12
+ export { channelMailbox, channelPhoneNumber, channelsListInput, channelsListOutput, channelsMockService, channelsSurface, } from './core/context/channels.js';
13
+ export { exchangeEmailThreadInput, exchangeEmailThreadOutput, exchangeLastInput, exchangeLastOutput, exchangeRef, exchangeSummary, exchangesMockService, exchangesSurface, } from './core/context/exchanges.js';
14
+ export { SYSTEM_VARIABLES, compileVariables, defineSequence, defineVariables, isSystemVariable, json, readVariables, startVariables, variableValueIssue, variablesSize, variablesWriteIssues, } from './core/sequence/index.js';
15
+ export { EMAIL_PAGE_LIMIT_MAX, emailDirection, emailGetInput, emailGetOutput, emailHistoryMockService, emailHistorySurface, emailListInput, emailListOutput, emailRecord, emailSendInput, emailSendOutput, } from './core/context/email-message.js';
16
+ export { KV_KEY_MAX, KV_SCOPES, KV_TTL_SECONDS_MAX, KV_VALUE_MAX, kvDelInput, kvDelOutput, kvGetInput, kvGetOutput, kvMockService, kvScope, kvSetInput, kvSetOutput, kvSurface, } from './core/context/kv.js';
17
+ export { SMS_PAGE_LIMIT_MAX, smsDirection, smsGetInput, smsGetOutput, smsListInput, smsListOutput, smsMockService, smsRecord, smsSurface, } from './core/context/sms.js';
18
+ export { bindEnvService, envMockService, readEnvGet } from './core/context/env.js';
19
+ export { platformSurfaces } from './core/context/platform-registry.js';
20
+ export { COMPANY_SCOPE, CONTEXT_PAGE_FUNCTION, functionKey, functionScriptFile } from './builder/types.js';
21
+ export { parseOfficeHours, resolveOfficeHours, } from './core/office-hours/index.js';
22
+ export { isSystemEventName, SYSTEM_EVENT_NAMES, SYSTEM_EVENTS, WEBHOOK_RECEIVED_FUNCTION, webhookOutcome, } from './core/functions/events.js';
23
+ export { defineSchedules, SCHEDULE_FUNCTION_PREFIX, SCHEDULES_MODULE, scheduleFunctionName, } from './core/functions/schedules.js';
24
+ export { parseSchedules, scheduleTimingIssue } from './builder/schedules.js';
25
+ export { ERROR_JSON_MAX_BYTES, ERRORS_MODULE, ON_ERROR_FUNCTION, PLATFORM_UNAVAILABLE_MESSAGE, PlatformUnavailableError, } from './core/functions/errors.js';
26
+ export { toEventRegistry, toFunctionRegistry } from './builder/compile/registry.js';
27
+ export { compileFunctionCode } from './builder/compile/function-code.js';
28
+ export { COMPILE_CONCURRENCY, COMPILE_SEQUENCE_TIMEOUT_MS, compileAll, compileCompanyPart, compileRepo, compileSequence, compileSequenceBuild, runtimePackageSource, runtimePackageVersion, } from './builder/compile/compile-sequence.js';
29
+ export { loadSequenceEvents, loadSequenceFunctions } from './builder/load.js';
30
+ export { findTsModule } from './builder/paths.js';
31
+ export { encodeOverlayMessage, OVERLAY_REPLACED_CLOSE_CODE, parseOverlayMessage } from './dev-overlay/protocol.js';
32
+ export { asCaseOrchestratorRun, buildActionContext, buildCaseOrchestratorContext, bindLogMeta, createFakeApiHost, defaultPlatformApis, emptyIntegration, createRpcApiHost, LOG_TAGS_HEADER, REQUEST_ID_HEADER, RUNTIME_VERSION_HEADER, encodeLogTagsHeader, formatRuntimeVersion, readLogTagsHeader, readRequestIdHeader, readRuntimeVersionHeader, makeCaseOrchestratorCtx, makeCtx, makeCtxAsync, noopLog, } from './fn-context/index.js';
33
+ export { createAppRouter, createIntegrationRouter, createListSurfacesProcedure, createLogRouter, createPlatformRouter, createCaseOrchestratorToolsRouter, createRecordsRouter, isRpcCodedError, parseScriptInput, reasonError, RpcReasonError, ScriptInputError, } from './fn-context/rpc/index.js';
34
+ export * from './compute-host/index.js';
35
+ export { announceAction, createRowAction, definePage, deleteRowAction, emptyRuns, endAction, fieldCell, keypadAction, lastActionRun, pageEntry, transferTo, isSipUri, runFunction, voicemailAction, PAGE_TOOLS, cancelFollowUpAction, followUpAction, choose, isChoose, refFieldCell, tried, checkPageStart, MAX_FAQ_ENTRIES, PAGE_CHANNELS, } from './core/page/define.js';
36
+ export { actionKey, runKeyOf, fallbackPage, PageDocumentError, pressedButton, renderDocument, RowNames, } from './core/page/render.js';
37
+ // The page in functions (76): the company API's, and what the platform and its tests read of them.
38
+ export { announce, backgroundTransfer, block, button, cancelFollowUp, coldTransfer, convertTime, createRow, data, deleteRow, doNow, end, field, functionHandles, actionHandles, isNode, keypad, list, page, pressKeypad, refField, run, scheduleFollowUp, text, toFnPageResult, toolbox, voicemail, warmTransfer, } from './core/page/fns.js';
39
+ export { isEnvelope } from './core/page/envelope.js';
40
+ export { TIMELINE_KINDS } from './core/page/timeline.js';
41
+ export { blockAt, nextStepReference, viewText, workspaceText } from './core/page/workspace.js';
42
+ export { resolvePageOps, } from './core/page/ops.js';
43
+ export { emitSlotsSource } from './builder/codegen/emit.js';
44
+ export { companySchemaCompatibilityIssues, compiledTableEntries, compileSlotSchema, emptyFieldValue, formatFieldPath, getCompiledTable, getTableField, relationsOf, isFieldValue, isReservedTableName, isResolved, isRowIdField, mintRowId, SNAPSHOT_CURRENT_KEY, DATE_VALUE_FORMAT, DATE_VALUE_PATTERN, DATETIME_VALUE_FORMAT, DATETIME_VALUE_PATTERN, isValidDataTypeValue, companyFieldToRuntime, makeFieldValue, parseFieldPath, refKind, refValueIssues, requireFieldPath, slotFieldEntries, slotFieldNames, validateBareValue, validateFieldRefs, } from './core/slot/index.js';
45
+ export { canonicalLanguage, CHANNELS, checkSpoken, CONTACT_LANGUAGES, fallbackSpoken, isContactLanguage, isSpokenLanguage, languageName, matchContactLanguage, matchSpokenLanguage, pickSpoken, SPOKEN_LANGUAGES, } from './core/conversation/index.js';
46
+ export * from './core/case-orchestrator/index.js';
47
+ export * from './core/party/index.js';
48
+ export * from './voice-service/index.js';
49
+ export { dayIn, formatTime, timeAt, timeParts } from './core/page/time-format.js';
50
+ export { CONSOLE_LINE_MAX_CHARS, CONSOLE_LINES_PER_RUN, CONSOLE_METHODS, DEFAULT_SANDBOX_LIMITS, runInSandbox, SandboxError, } from './core/page/sandbox.js';
51
+ export { asArray, checkListSizes, afterOf, COMBINATORS, findAnchors, indexConditions, indexedFieldsOf, indexOrder, indexValueOf, isPlainObject, isUuid, limitExceeded, matches, optionalCount, orderKeys, orderRows, pageRows, RECORDS_LIMITS, RecordsQueryError, refuseSearch, relatedKey, relationFilters, RELATION_INCLUDE_KEYS, selectFields, skipOf, startableConditions, tableIndexedFields, toSlot, unstartableWhy, WAY_BACK_FILTERS, wayBackFilters, } from './core/page/records-query.js';
52
+ export { atCall, dayCall, DEFAULT_PAGE_ZONE, partsCall, timeCall, timeOfCaller } from './core/page/page-host.js';
53
+ // The other entries in full, so this one holds them by construction (`package-entries.test.ts`).
54
+ export * from './index.js';
55
+ export * from './worker.js';
56
+ export * from './compiler.js';
57
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=testing-compile-child.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Compiles one sequence for the testing entry (`testing.ts`) in a process of its own, and sends back its
3
+ * build and compiled schema. Out of the test's process: the compile loads the company's code through its
4
+ * own import hooks, which would otherwise count in the test run's coverage and stay installed there.
5
+ *
6
+ * Run as `node testing-compile-child.js <repoRoot> <sequence>`; answers one IPC message.
7
+ */
8
+ import { compileSequence } from './builder/compile/compile-sequence.js';
9
+ const [repoRoot, sequence] = process.argv.slice(2);
10
+ async function main() {
11
+ try {
12
+ const { build, schema } = await compileSequence(repoRoot, sequence, { dryRun: true });
13
+ process.send({ ok: true, build, schema });
14
+ }
15
+ catch (error) {
16
+ process.send({ ok: false, error: error instanceof Error ? error.message : String(error) });
17
+ }
18
+ }
19
+ void main();
20
+ //# sourceMappingURL=testing-compile-child.js.map
@@ -0,0 +1,368 @@
1
+ import { type SequenceBuild } from './builder/types.js';
2
+ import { type LogLine, type LogsQuery } from './cli/logs/index.js';
3
+ import type { ApiCall } from './cli/exec/trace.js';
4
+ import { type TestCustomer, type TextCall } from './cli/calls/index.js';
5
+ import { type TurnRead, type TurnsQuery, type TurnSummary } from './cli/turns/index.js';
6
+ import type { CaseOrchestratorTools, ScheduledActionView } from './core/case-orchestrator/types.js';
7
+ import { type PageChannel, type PageContext, type PageEntryArg, type PageNextStep, type PageScheduledAction, type PageStart } from './core/page/define.js';
8
+ import { type MemoryRows } from './core/page/memory-reader.js';
9
+ import type { RecordsCall } from './core/page/records-query.js';
10
+ import { type RenderedPage } from './core/page/render.js';
11
+ import { type ConsoleLevel, type HostResult } from './core/page/sandbox.js';
12
+ import { type OfficeHours, type OfficeHoursSnapshot } from './core/office-hours/index.js';
13
+ import type { SystemContext } from './core/context/types.js';
14
+ import type { Db } from './core/page/define.js';
15
+ import { makeCaseOrchestratorCtx as makePlatformCaseOrchestratorCtx } from './fn-context/make-ctx.js';
16
+ import { type RunResult, type TurnInput } from './cli/turns/shadow.js';
17
+ export { fakeTools, unfaked } from './fn-context/fake/index.js';
18
+ /**
19
+ * What a test may set on the fake `ctx`. Each `api` surface takes only the methods the test fakes
20
+ * (`{ exchanges: { last: async () => ({ exchange: null }) } }`), the rest keep their stand-ins; `api.db`
21
+ * takes any object (`recordingDb`), so a test fakes only the tables it needs.
22
+ */
23
+ export type TestCtxOverrides = {
24
+ today?: string;
25
+ timezone?: string;
26
+ now?: number;
27
+ meta?: Partial<SystemContext['meta']>;
28
+ config?: Partial<SystemContext['config']>;
29
+ api?: {
30
+ [K in keyof SystemContext['api']]?: K extends 'db' ? object : Partial<SystemContext['api'][K]>;
31
+ };
32
+ };
33
+ /**
34
+ * A fake `ctx`, typed as the caller asks: `makeCtx<Ctx>()` for a function, with `Ctx` from the
35
+ * sequence's `__gen`. Data slice defaults: `today` 1970-01-01, `timezone` UTC. Any `api` call the test
36
+ * did not fake rejects, naming the call.
37
+ */
38
+ export declare function makeCtx<C = SystemContext>(overrides?: TestCtxOverrides): C;
39
+ /** A fake Orchestrator `ctx`, typed as the caller asks; `tools` fakes `ctx.api.tools`, `db` fakes `ctx.api.db`. */
40
+ export declare function makeCaseOrchestratorCtx<C = Awaited<ReturnType<typeof makePlatformCaseOrchestratorCtx>>>(overrides?: TestCtxOverrides & {
41
+ tools?: Partial<CaseOrchestratorTools>;
42
+ db?: object;
43
+ }): Promise<C>;
44
+ /** One call a function made on `db`. */
45
+ export type DbCall = {
46
+ table: string;
47
+ method: string;
48
+ args: unknown;
49
+ };
50
+ /** Answers for `db` calls, by table then method; the return value is what the call resolves to. */
51
+ export type DbHandlers = Record<string, Record<string, (args: any) => unknown>>;
52
+ /**
53
+ * A `db` that records every call in `calls`, in order, and answers from `handlers`. A call with no
54
+ * handler rejects, naming it, so a test sees every read and write the function makes.
55
+ */
56
+ export declare function recordingDb(handlers?: DbHandlers): {
57
+ db: Db;
58
+ calls: DbCall[];
59
+ };
60
+ /**
61
+ * A row as `ctx.api.db` hands it out, for a `recordingDb` handler to return: `id` as given, every other
62
+ * field a slot (`{ value, state, reason, updatedAt, ref }`), `filled` when it has a value, `empty` when
63
+ * null. A test that returns plain values instead (`{ crm_id: null }`) checks code against a shape the
64
+ * platform never gives: `if (row.crm_id)` is then false in the test and always true for real.
65
+ */
66
+ export declare function row(table: string, values: {
67
+ id: string;
68
+ } & Record<string, unknown>): any;
69
+ /** One request `mockFetch` answered. */
70
+ export type FetchCall = {
71
+ method: string;
72
+ url: string;
73
+ body: string | null;
74
+ };
75
+ /** A route: requests whose method (any, when left out) and URL (exact, or a pattern) match it. */
76
+ export type FetchRoute = {
77
+ method?: string;
78
+ url: string | RegExp;
79
+ /** A `Response` is returned as is; any other value is sent as JSON with status 200. */
80
+ respond: (request: Request) => unknown;
81
+ };
82
+ /**
83
+ * Replaces the global `fetch` until `restore()`: each request goes to the first matching route; one
84
+ * that matches none rejects, so a test never reaches a real system (a CRM, a payment provider).
85
+ */
86
+ export declare function mockFetch(routes: FetchRoute[]): {
87
+ calls: FetchCall[];
88
+ restore: () => void;
89
+ };
90
+ /** What the page function gets besides the data; each left out is what a conversation without it has. */
91
+ export type RenderPageInput = {
92
+ /** The sequence: its directory under `sequences/`. */
93
+ sequence: string;
94
+ /** The repository's root; the working directory when left out (where `npm test` runs). */
95
+ repoRoot?: string;
96
+ /** The rows the page can read, by table: `{ contact: [{ id: 'c1', first_name: 'Ann' }] }`. A field left out or null is empty. */
97
+ data: MemoryRows;
98
+ /** The id of the row the sequence runs about (its `subject` table's). */
99
+ subject: string;
100
+ /** The conversation's contact (`ctx.caller`), one of `data.contact`; none outside a conversation. */
101
+ caller?: string | null;
102
+ /** The page function to run; the page's first one when left out. */
103
+ channel?: PageChannel | null;
104
+ /** The render's time (ISO 8601); 2026-01-01T15:00:00Z when left out. */
105
+ now?: string;
106
+ scheduledAction?: PageScheduledAction | null;
107
+ officeHours?: PageContext['officeHours'];
108
+ nextSteps?: PageNextStep[];
109
+ /** `ctx.env`: the environment's configuration the page reads (76 §2.19); none when left out. A turn's export does not carry it. */
110
+ env?: Record<string, unknown>;
111
+ sms?: {
112
+ inbound: NonNullable<Extract<PageEntryArg, {
113
+ mode: 'render' | 'start';
114
+ }>['sms']>['inbound'];
115
+ };
116
+ email?: NonNullable<Extract<PageEntryArg, {
117
+ mode: 'render' | 'start';
118
+ }>['email']>;
119
+ call?: NonNullable<Extract<PageEntryArg, {
120
+ mode: 'render' | 'start';
121
+ }>['call']>;
122
+ /**
123
+ * `ctx.history`: the counts and the timeline the page reads; 0 and none when left out. Or each call and
124
+ * its answer (`[{ method, where, result }]`, a turn's export): a call not among them fails the render.
125
+ */
126
+ history?: {
127
+ sessionCount?: number;
128
+ exchangeCount?: number;
129
+ timeline?: unknown[];
130
+ } | HistoryAnswer[];
131
+ /** `ctx.session`, as the page gets it (a call's session row); none when left out. */
132
+ session?: RenderArg['session'];
133
+ /** `ctx.runs`: what the conversation's actions did; none when left out. */
134
+ runs?: RenderArg['runs'];
135
+ /** `ctx.conversation`; none when left out. */
136
+ conversation?: RenderArg['conversation'];
137
+ /** The case's id (`ctx.instanceId`); `test-instance` when left out. */
138
+ instanceId?: string;
139
+ };
140
+ /** What a render or a start of the page function is given. */
141
+ type RenderArg = Extract<PageEntryArg, {
142
+ mode: 'render' | 'start';
143
+ }>;
144
+ /** One `ctx.history` call a page made and its answer, as a turn's export keeps them. */
145
+ export type HistoryAnswer = {
146
+ method: unknown;
147
+ where: unknown;
148
+ result: HostResult;
149
+ };
150
+ export type RenderedTestPage = {
151
+ /** The page as the platform builds it from what the page function returned: its blocks, fields, buttons. */
152
+ page: RenderedPage;
153
+ /** The page as the AI reads it. */
154
+ text: string;
155
+ /** Every `db` read the page made, in order. */
156
+ reads: RecordsCall[];
157
+ /** The page's `console` lines. */
158
+ console: Array<{
159
+ level: ConsoleLevel;
160
+ text: string;
161
+ }>;
162
+ };
163
+ /** A page script that failed: what the sandbox said, and where in the compiled page it threw. */
164
+ export declare class PageTestError extends Error {
165
+ readonly scriptStack: string | null;
166
+ constructor(message: string, scriptStack: string | null);
167
+ }
168
+ /**
169
+ * Renders the sequence's page (`context.page.ts`) over `data`, as the platform renders it: the same
170
+ * compile, sandbox, `db` semantics and page building, with the rows read from `data` instead of the
171
+ * database. A read the platform refuses is refused here too.
172
+ */
173
+ export declare function renderPage(input: RenderPageInput): Promise<RenderedTestPage>;
174
+ /**
175
+ * A turn's export (`turns export <turnId>`, `exportTurn`) as `renderPage`'s input: the moment the turn
176
+ * began — its rows, its `ctx`, and each `ctx.history` answer — to render with this repository's code now.
177
+ */
178
+ export declare function fromTurn(dir: string, options?: {
179
+ repoRoot?: string;
180
+ }): RenderPageInput;
181
+ /** What the page decides when the conversation starts (its `persona` and `faq`), over `data`. */
182
+ export declare function startPage(input: RenderPageInput): Promise<PageStart>;
183
+ /**
184
+ * The office hours (`office-hours.ts`) at `at` (ISO 8601 or epoch ms), as the platform reads them: open
185
+ * or not, and today's windows. Office hours the platform would refuse fail with what is wrong.
186
+ */
187
+ export declare function officeHoursAt(officeHours: OfficeHours, at: string | number): OfficeHoursSnapshot;
188
+ /**
189
+ * The sequence compiled as a release compiles it (`index.ts`, its variables, functions, events, office
190
+ * hours, Orchestrator and page), for a test that checks its configuration. A configuration the release
191
+ * would refuse rejects with the release's message. Compiled once per test run.
192
+ */
193
+ export declare function compileForTest(input: {
194
+ sequence: string;
195
+ repoRoot?: string;
196
+ }): Promise<SequenceBuild>;
197
+ export type { ApiCall, LogLine, LogsQuery, OfficeHours, OfficeHoursSnapshot, SequenceBuild };
198
+ export type { TurnRead, TurnRecord, TurnSnapshot, TurnsQuery, TurnSummary } from './cli/turns/index.js';
199
+ export type { InboxItem, SentResult, TestCustomer, TextCall, TextCallEnd, TextCallEvent, TextCallStep } from './cli/calls/index.js';
200
+ /** An open connection to an environment for an integration test (`connect`). */
201
+ export type Connection<C = SystemContext> = {
202
+ /** The environment (never prod). */
203
+ environment: {
204
+ id: string;
205
+ name: string;
206
+ };
207
+ /** A real `ctx`: each `ctx.api` call reads and writes the environment's data, and is recorded in `calls`. */
208
+ ctx: C;
209
+ /**
210
+ * The last 200 `ctx.api` calls made through `ctx`, in order: `call`, `input`, `ok`, `output` or `error`,
211
+ * `ms`. Every call, however many, is in `callsFile` (one JSON per line).
212
+ */
213
+ calls: ApiCall[];
214
+ callsFile: string;
215
+ /**
216
+ * What the code wrote (`ctx.api.log`, the page's `console`, its functions' failures) in this environment,
217
+ * read from the platform's log store now: oldest first, since this connection opened unless `since` says
218
+ * otherwise, at most `limit` (200; 500 at most). Filter by `instance`, `run`, `contact`, `sequence`,
219
+ * `request`, `level` (`warn`: warn and error), `search`. Lines reach the store a few seconds after they
220
+ * are written.
221
+ */
222
+ logs(query?: Omit<LogsQuery, 'env'>): Promise<LogLine[]>;
223
+ /**
224
+ * A case's page as a conversation on it renders it now: this repository's page, the case's real data.
225
+ * `caller`: the conversation's contact; the case's subject when it is a contact and none is named.
226
+ * Returns `page` and `text` as the unit tests' `renderPage` does, so the same checks apply.
227
+ */
228
+ renderPage(input: {
229
+ instanceId: string;
230
+ channel: PageChannel;
231
+ caller?: string;
232
+ }): Promise<{
233
+ page: RenderedPage;
234
+ text: string;
235
+ }>;
236
+ /**
237
+ * The case's Orchestrator run now, as after an external event (`ctx.api.instances.notify`), with the
238
+ * inputs the platform builds for the case and this repository's code. Says how it ended and the
239
+ * follow-ups it scheduled and cancelled; they are real, and run when due.
240
+ */
241
+ runOrchestrator(input: {
242
+ instanceId: string;
243
+ reason?: string;
244
+ }): Promise<{
245
+ status: 'completed' | 'failed' | 'held' | 'idle' | 'no_orchestrator';
246
+ failureCode?: string;
247
+ scheduled: ScheduledActionView[];
248
+ cancelled: ScheduledActionView[];
249
+ }>;
250
+ /**
251
+ * One turn, always a shadow (68 §8): a text or email run, or a call's turn, as when the customer writes or
252
+ * says `say`, with this repository's page, the platform's model, and the case's data as it is now — or
253
+ * `from` a turn that ran (its id, or the directory it was exported to): its rows and conversation as they
254
+ * were then, its words heard again (`say` replaces them). It runs on a shadow of the environment's
255
+ * database: what it did comes back (`writes`, `actions`, `said`, `events`) and none of it is kept, sent,
256
+ * booked or woken. Company functions are not run: replayed from the turn's record (`from`), else
257
+ * `functions.results`, else answered as not run (`functions` says which). The model words things
258
+ * differently each time: check what it did, and with `repeat` how often (`rate(run => run.clicked('x'))`).
259
+ */
260
+ turn(input: TurnInput): Promise<RunResult>;
261
+ /**
262
+ * Runs `actions` on the case's page as the model's step would, with no model: `{ fill: '<field id>',
263
+ * value }`, `{ click: '<button id>', arguments }`, `{ note: '…' }`… (field and button ids as the page
264
+ * names them: `renderPage`'s `text`). Then the run ends without a reply. `stepResult` is what the
265
+ * platform told the model about each action.
266
+ */
267
+ act(input: TurnInput & {
268
+ actions: unknown[];
269
+ }): Promise<RunResult>;
270
+ /**
271
+ * The turns of a case, a run or a call in this environment, oldest first (68 §7.4): what the customer
272
+ * said, what the AI said, the buttons and functions it ran, the fields it wrote. Name one of them.
273
+ */
274
+ turns(query: TurnsQuery): Promise<TurnSummary[]>;
275
+ /** One turn, and what it began with (`snapshot`: null once it is no longer kept, after 30 days). */
276
+ readTurn(turnId: string): Promise<TurnRead>;
277
+ /** One turn written to `dir` (`.superpanel/turns/<turnId>/` when left out), as `turns export` writes it; the directory. */
278
+ exportTurn(turnId: string, dir?: string): Promise<string>;
279
+ /**
280
+ * Test lines and customers (68 §5.3): `line(name)` is the environment's simulated line of that name
281
+ * (`Main line` when left out), made when it has none, a number no provider carries; `phone()` a new test
282
+ * customer's number. A simulated line reaches test customers only, and a test customer only a simulated line.
283
+ */
284
+ sim: {
285
+ /**
286
+ * When a real line has that name, the simulated line stands in for it (`mirrors`): your `resolve` sees
287
+ * it by that name, and code's `from` that names the real line reaches a test customer through it.
288
+ */
289
+ line(name?: string): Promise<{
290
+ id: string;
291
+ number: string;
292
+ name: string;
293
+ mirrors: {
294
+ id: string;
295
+ number: string;
296
+ } | null;
297
+ }>;
298
+ /** The environment's simulated mailbox of that name (`Support` when left out), made when it has none: an address no provider has; standing in for a real one of that name, as `line` does. */
299
+ mailbox(name?: string): Promise<{
300
+ id: string;
301
+ address: string;
302
+ name: string;
303
+ mirrors: {
304
+ id: string;
305
+ address: string;
306
+ } | null;
307
+ }>;
308
+ phone(): string;
309
+ /**
310
+ * A test customer (68 §5.2), a new number and address unless given: they text and email the simulated
311
+ * lines and mailboxes, wait for what the environment sends them (`next('sms')`, `next('call')`), and
312
+ * answer or let ring its calls.
313
+ */
314
+ customer(input?: {
315
+ phone?: string;
316
+ email?: string;
317
+ }): TestCustomer;
318
+ };
319
+ /**
320
+ * A case's next scheduled step done now, as its job would when due (68 §6.4): for a step that waits for a
321
+ * day ("call on day 2"). Contact hours are the environment's to switch off (Environments page), not this.
322
+ */
323
+ runDue(input: {
324
+ instanceId: string;
325
+ scheduledActionId?: string;
326
+ }): Promise<{
327
+ action: {
328
+ id: string;
329
+ kind: string;
330
+ name: string | null;
331
+ reason: string | null;
332
+ scheduledFor: string;
333
+ } | null;
334
+ result: unknown;
335
+ }>;
336
+ /**
337
+ * A call in text (68 §4): a test customer (`from`, `sim.phone()`) calls a simulated line (`to`, its name or
338
+ * number, `Main line` when left out). This repository's code on the environment's real data, as a real
339
+ * call: the resolves, the opening, each turn, the wrap-up after the hang-up, `call.ended`, the Orchestrator.
340
+ * What the AI says comes back as text; a keypad, a transfer or a voicemail as an event to answer.
341
+ */
342
+ call: {
343
+ inbound(input: {
344
+ from: string;
345
+ to?: string;
346
+ }): Promise<TextCall>;
347
+ };
348
+ /** Stops serving this repository on the environment. Called by itself after the test file's tests. */
349
+ close(): Promise<void>;
350
+ };
351
+ export type { RunResult, ShadowRun, TurnInput } from './cli/turns/shadow.js';
352
+ /**
353
+ * Connects a test file to an environment (`sandbox` when `env` is left out) as the CLI's login: this
354
+ * repository's code serves it (as `superpanel-sdk-runtime serve` does, its imports checked as a release
355
+ * checks them) until the file's tests are done, and `ctx` reads and writes the environment's real data.
356
+ * What a test writes is written.
357
+ */
358
+ /**
359
+ * `debug`: when a test's debug package is written (68 §9, `.superpanel/tests/`): `failed` (the default),
360
+ * `always`, or `off`; `SUPERPANEL_TEST_DEBUG` overrides it.
361
+ */
362
+ export declare function connect<C = SystemContext>(options?: {
363
+ env?: string;
364
+ repoRoot?: string;
365
+ url?: string;
366
+ debug?: 'failed' | 'always' | 'off';
367
+ }): Promise<Connection<C>>;
368
+ //# sourceMappingURL=testing.d.ts.map