@zarel-ai/sdk 0.6.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 (375) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +412 -0
  3. package/dist/_internal/auth-headers.d.ts +19 -0
  4. package/dist/_internal/auth-headers.d.ts.map +1 -0
  5. package/dist/_internal/auth-headers.js +30 -0
  6. package/dist/_internal/auth-headers.js.map +1 -0
  7. package/dist/_internal/confirmation.d.ts +24 -0
  8. package/dist/_internal/confirmation.d.ts.map +1 -0
  9. package/dist/_internal/confirmation.js +54 -0
  10. package/dist/_internal/confirmation.js.map +1 -0
  11. package/dist/_internal/event-iterator.d.ts +18 -0
  12. package/dist/_internal/event-iterator.d.ts.map +1 -0
  13. package/dist/_internal/event-iterator.js +151 -0
  14. package/dist/_internal/event-iterator.js.map +1 -0
  15. package/dist/_internal/fetch-client.d.ts +141 -0
  16. package/dist/_internal/fetch-client.d.ts.map +1 -0
  17. package/dist/_internal/fetch-client.js +471 -0
  18. package/dist/_internal/fetch-client.js.map +1 -0
  19. package/dist/_internal/interceptors.d.ts +40 -0
  20. package/dist/_internal/interceptors.d.ts.map +1 -0
  21. package/dist/_internal/interceptors.js +28 -0
  22. package/dist/_internal/interceptors.js.map +1 -0
  23. package/dist/_internal/mcp.d.ts +11 -0
  24. package/dist/_internal/mcp.d.ts.map +1 -0
  25. package/dist/_internal/mcp.js +79 -0
  26. package/dist/_internal/mcp.js.map +1 -0
  27. package/dist/_internal/pagination.d.ts +71 -0
  28. package/dist/_internal/pagination.d.ts.map +1 -0
  29. package/dist/_internal/pagination.js +130 -0
  30. package/dist/_internal/pagination.js.map +1 -0
  31. package/dist/_internal/require-token.d.ts +17 -0
  32. package/dist/_internal/require-token.d.ts.map +1 -0
  33. package/dist/_internal/require-token.js +25 -0
  34. package/dist/_internal/require-token.js.map +1 -0
  35. package/dist/_internal/retry-after.d.ts +2 -0
  36. package/dist/_internal/retry-after.d.ts.map +1 -0
  37. package/dist/_internal/retry-after.js +34 -0
  38. package/dist/_internal/retry-after.js.map +1 -0
  39. package/dist/_internal/sse-client.d.ts +43 -0
  40. package/dist/_internal/sse-client.d.ts.map +1 -0
  41. package/dist/_internal/sse-client.js +250 -0
  42. package/dist/_internal/sse-client.js.map +1 -0
  43. package/dist/_internal/version.d.ts +5 -0
  44. package/dist/_internal/version.d.ts.map +1 -0
  45. package/dist/_internal/version.js +12 -0
  46. package/dist/_internal/version.js.map +1 -0
  47. package/dist/client.d.ts +74 -0
  48. package/dist/client.d.ts.map +1 -0
  49. package/dist/client.js +86 -0
  50. package/dist/client.js.map +1 -0
  51. package/dist/contract/_singleton.d.ts +18 -0
  52. package/dist/contract/_singleton.d.ts.map +1 -0
  53. package/dist/contract/_singleton.js +27 -0
  54. package/dist/contract/_singleton.js.map +1 -0
  55. package/dist/contract/actions.d.ts +18 -0
  56. package/dist/contract/actions.d.ts.map +1 -0
  57. package/dist/contract/actions.js +36 -0
  58. package/dist/contract/actions.js.map +1 -0
  59. package/dist/contract/assistant.d.ts +65 -0
  60. package/dist/contract/assistant.d.ts.map +1 -0
  61. package/dist/contract/assistant.js +44 -0
  62. package/dist/contract/assistant.js.map +1 -0
  63. package/dist/contract/batch.d.ts +27 -0
  64. package/dist/contract/batch.d.ts.map +1 -0
  65. package/dist/contract/batch.js +20 -0
  66. package/dist/contract/batch.js.map +1 -0
  67. package/dist/contract/capabilities.d.ts +21 -0
  68. package/dist/contract/capabilities.d.ts.map +1 -0
  69. package/dist/contract/capabilities.js +31 -0
  70. package/dist/contract/capabilities.js.map +1 -0
  71. package/dist/contract/constraints.d.ts +21 -0
  72. package/dist/contract/constraints.d.ts.map +1 -0
  73. package/dist/contract/constraints.js +31 -0
  74. package/dist/contract/constraints.js.map +1 -0
  75. package/dist/contract/events.d.ts +33 -0
  76. package/dist/contract/events.d.ts.map +1 -0
  77. package/dist/contract/events.js +56 -0
  78. package/dist/contract/events.js.map +1 -0
  79. package/dist/contract/flows.d.ts +44 -0
  80. package/dist/contract/flows.d.ts.map +1 -0
  81. package/dist/contract/flows.js +109 -0
  82. package/dist/contract/flows.js.map +1 -0
  83. package/dist/contract/governance.d.ts +6 -0
  84. package/dist/contract/governance.d.ts.map +1 -0
  85. package/dist/contract/governance.js +17 -0
  86. package/dist/contract/governance.js.map +1 -0
  87. package/dist/contract/index.d.ts +137 -0
  88. package/dist/contract/index.d.ts.map +1 -0
  89. package/dist/contract/index.js +177 -0
  90. package/dist/contract/index.js.map +1 -0
  91. package/dist/contract/metadata.d.ts +26 -0
  92. package/dist/contract/metadata.d.ts.map +1 -0
  93. package/dist/contract/metadata.js +25 -0
  94. package/dist/contract/metadata.js.map +1 -0
  95. package/dist/contract/process-model.d.ts +31 -0
  96. package/dist/contract/process-model.d.ts.map +1 -0
  97. package/dist/contract/process-model.js +51 -0
  98. package/dist/contract/process-model.js.map +1 -0
  99. package/dist/contract/roots/channels.d.ts +27 -0
  100. package/dist/contract/roots/channels.d.ts.map +1 -0
  101. package/dist/contract/roots/channels.js +53 -0
  102. package/dist/contract/roots/channels.js.map +1 -0
  103. package/dist/contract/roots/events.d.ts +7 -0
  104. package/dist/contract/roots/events.d.ts.map +1 -0
  105. package/dist/contract/roots/events.js +19 -0
  106. package/dist/contract/roots/events.js.map +1 -0
  107. package/dist/contract/roots/index.d.ts +15 -0
  108. package/dist/contract/roots/index.d.ts.map +1 -0
  109. package/dist/contract/roots/index.js +38 -0
  110. package/dist/contract/roots/index.js.map +1 -0
  111. package/dist/contract/roots/mcp-servers.d.ts +46 -0
  112. package/dist/contract/roots/mcp-servers.d.ts.map +1 -0
  113. package/dist/contract/roots/mcp-servers.js +68 -0
  114. package/dist/contract/roots/mcp-servers.js.map +1 -0
  115. package/dist/contract/roots/profiles.d.ts +18 -0
  116. package/dist/contract/roots/profiles.d.ts.map +1 -0
  117. package/dist/contract/roots/profiles.js +31 -0
  118. package/dist/contract/roots/profiles.js.map +1 -0
  119. package/dist/contract/roots/timezone.d.ts +10 -0
  120. package/dist/contract/roots/timezone.d.ts.map +1 -0
  121. package/dist/contract/roots/timezone.js +19 -0
  122. package/dist/contract/roots/timezone.js.map +1 -0
  123. package/dist/contract/roots/treatment.d.ts +11 -0
  124. package/dist/contract/roots/treatment.d.ts.map +1 -0
  125. package/dist/contract/roots/treatment.js +37 -0
  126. package/dist/contract/roots/treatment.js.map +1 -0
  127. package/dist/contract/roots/vocabulary.d.ts +18 -0
  128. package/dist/contract/roots/vocabulary.d.ts.map +1 -0
  129. package/dist/contract/roots/vocabulary.js +31 -0
  130. package/dist/contract/roots/vocabulary.js.map +1 -0
  131. package/dist/contract/schemas.d.ts +18 -0
  132. package/dist/contract/schemas.d.ts.map +1 -0
  133. package/dist/contract/schemas.js +31 -0
  134. package/dist/contract/schemas.js.map +1 -0
  135. package/dist/contract/skills.d.ts +20 -0
  136. package/dist/contract/skills.d.ts.map +1 -0
  137. package/dist/contract/skills.js +36 -0
  138. package/dist/contract/skills.js.map +1 -0
  139. package/dist/errors.d.ts +65 -0
  140. package/dist/errors.d.ts.map +1 -0
  141. package/dist/errors.js +80 -0
  142. package/dist/errors.js.map +1 -0
  143. package/dist/generated/contract.d.ts +7688 -0
  144. package/dist/generated/contract.d.ts.map +1 -0
  145. package/dist/generated/contract.js +7 -0
  146. package/dist/generated/contract.js.map +1 -0
  147. package/dist/generated/index.d.ts +41 -0
  148. package/dist/generated/index.d.ts.map +1 -0
  149. package/dist/generated/index.js +3 -0
  150. package/dist/generated/index.js.map +1 -0
  151. package/dist/generated/runtime.d.ts +4020 -0
  152. package/dist/generated/runtime.d.ts.map +1 -0
  153. package/dist/generated/runtime.js +7 -0
  154. package/dist/generated/runtime.js.map +1 -0
  155. package/dist/generated/unwrap-map.d.ts +989 -0
  156. package/dist/generated/unwrap-map.d.ts.map +1 -0
  157. package/dist/generated/unwrap-map.js +344 -0
  158. package/dist/generated/unwrap-map.js.map +1 -0
  159. package/dist/index.d.ts +38 -0
  160. package/dist/index.d.ts.map +1 -0
  161. package/dist/index.js +27 -0
  162. package/dist/index.js.map +1 -0
  163. package/dist/resources/actions.d.ts +33 -0
  164. package/dist/resources/actions.d.ts.map +1 -0
  165. package/dist/resources/actions.js +52 -0
  166. package/dist/resources/actions.js.map +1 -0
  167. package/dist/resources/audit.d.ts +52 -0
  168. package/dist/resources/audit.d.ts.map +1 -0
  169. package/dist/resources/audit.js +86 -0
  170. package/dist/resources/audit.js.map +1 -0
  171. package/dist/resources/authorization-ceiling.d.ts +25 -0
  172. package/dist/resources/authorization-ceiling.d.ts.map +1 -0
  173. package/dist/resources/authorization-ceiling.js +26 -0
  174. package/dist/resources/authorization-ceiling.js.map +1 -0
  175. package/dist/resources/authorization-operation-ids.d.ts +15 -0
  176. package/dist/resources/authorization-operation-ids.d.ts.map +1 -0
  177. package/dist/resources/authorization-operation-ids.js +31 -0
  178. package/dist/resources/authorization-operation-ids.js.map +1 -0
  179. package/dist/resources/authorization.d.ts +60 -0
  180. package/dist/resources/authorization.d.ts.map +1 -0
  181. package/dist/resources/authorization.js +51 -0
  182. package/dist/resources/authorization.js.map +1 -0
  183. package/dist/resources/authorizations.d.ts +38 -0
  184. package/dist/resources/authorizations.d.ts.map +1 -0
  185. package/dist/resources/authorizations.js +19 -0
  186. package/dist/resources/authorizations.js.map +1 -0
  187. package/dist/resources/channels.d.ts +36 -0
  188. package/dist/resources/channels.d.ts.map +1 -0
  189. package/dist/resources/channels.js +61 -0
  190. package/dist/resources/channels.js.map +1 -0
  191. package/dist/resources/contracts.d.ts +46 -0
  192. package/dist/resources/contracts.d.ts.map +1 -0
  193. package/dist/resources/contracts.js +86 -0
  194. package/dist/resources/contracts.js.map +1 -0
  195. package/dist/resources/conversation-sessions.d.ts +62 -0
  196. package/dist/resources/conversation-sessions.d.ts.map +1 -0
  197. package/dist/resources/conversation-sessions.js +48 -0
  198. package/dist/resources/conversation-sessions.js.map +1 -0
  199. package/dist/resources/conversation.d.ts +48 -0
  200. package/dist/resources/conversation.d.ts.map +1 -0
  201. package/dist/resources/conversation.js +104 -0
  202. package/dist/resources/conversation.js.map +1 -0
  203. package/dist/resources/embedding-credentials.d.ts +60 -0
  204. package/dist/resources/embedding-credentials.d.ts.map +1 -0
  205. package/dist/resources/embedding-credentials.js +53 -0
  206. package/dist/resources/embedding-credentials.js.map +1 -0
  207. package/dist/resources/entities.d.ts +66 -0
  208. package/dist/resources/entities.d.ts.map +1 -0
  209. package/dist/resources/entities.js +106 -0
  210. package/dist/resources/entities.js.map +1 -0
  211. package/dist/resources/events.d.ts +45 -0
  212. package/dist/resources/events.d.ts.map +1 -0
  213. package/dist/resources/events.js +71 -0
  214. package/dist/resources/events.js.map +1 -0
  215. package/dist/resources/flows.d.ts +45 -0
  216. package/dist/resources/flows.d.ts.map +1 -0
  217. package/dist/resources/flows.js +82 -0
  218. package/dist/resources/flows.js.map +1 -0
  219. package/dist/resources/imports.d.ts +8 -0
  220. package/dist/resources/imports.d.ts.map +1 -0
  221. package/dist/resources/imports.js +14 -0
  222. package/dist/resources/imports.js.map +1 -0
  223. package/dist/resources/index.d.ts +24 -0
  224. package/dist/resources/index.d.ts.map +1 -0
  225. package/dist/resources/index.js +41 -0
  226. package/dist/resources/index.js.map +1 -0
  227. package/dist/resources/llm-credentials.d.ts +47 -0
  228. package/dist/resources/llm-credentials.d.ts.map +1 -0
  229. package/dist/resources/llm-credentials.js +46 -0
  230. package/dist/resources/llm-credentials.js.map +1 -0
  231. package/dist/resources/llm-services.d.ts +46 -0
  232. package/dist/resources/llm-services.d.ts.map +1 -0
  233. package/dist/resources/llm-services.js +41 -0
  234. package/dist/resources/llm-services.js.map +1 -0
  235. package/dist/resources/mcp.d.ts +8 -0
  236. package/dist/resources/mcp.d.ts.map +1 -0
  237. package/dist/resources/mcp.js +25 -0
  238. package/dist/resources/mcp.js.map +1 -0
  239. package/dist/resources/receipts.d.ts +25 -0
  240. package/dist/resources/receipts.d.ts.map +1 -0
  241. package/dist/resources/receipts.js +54 -0
  242. package/dist/resources/receipts.js.map +1 -0
  243. package/dist/resources/records.d.ts +51 -0
  244. package/dist/resources/records.d.ts.map +1 -0
  245. package/dist/resources/records.js +103 -0
  246. package/dist/resources/records.js.map +1 -0
  247. package/dist/resources/role-assignments.d.ts +27 -0
  248. package/dist/resources/role-assignments.d.ts.map +1 -0
  249. package/dist/resources/role-assignments.js +40 -0
  250. package/dist/resources/role-assignments.js.map +1 -0
  251. package/dist/resources/roles.d.ts +39 -0
  252. package/dist/resources/roles.d.ts.map +1 -0
  253. package/dist/resources/roles.js +42 -0
  254. package/dist/resources/roles.js.map +1 -0
  255. package/dist/resources/runtime-entities.d.ts +23 -0
  256. package/dist/resources/runtime-entities.d.ts.map +1 -0
  257. package/dist/resources/runtime-entities.js +29 -0
  258. package/dist/resources/runtime-entities.js.map +1 -0
  259. package/dist/resources/state-machine.d.ts +45 -0
  260. package/dist/resources/state-machine.d.ts.map +1 -0
  261. package/dist/resources/state-machine.js +86 -0
  262. package/dist/resources/state-machine.js.map +1 -0
  263. package/dist/resources/system.d.ts +12 -0
  264. package/dist/resources/system.d.ts.map +1 -0
  265. package/dist/resources/system.js +26 -0
  266. package/dist/resources/system.js.map +1 -0
  267. package/dist/resources/tools.d.ts +22 -0
  268. package/dist/resources/tools.d.ts.map +1 -0
  269. package/dist/resources/tools.js +33 -0
  270. package/dist/resources/tools.js.map +1 -0
  271. package/dist/resources/traces.d.ts +65 -0
  272. package/dist/resources/traces.d.ts.map +1 -0
  273. package/dist/resources/traces.js +97 -0
  274. package/dist/resources/traces.js.map +1 -0
  275. package/dist/runtime/index.d.ts +128 -0
  276. package/dist/runtime/index.d.ts.map +1 -0
  277. package/dist/runtime/index.js +210 -0
  278. package/dist/runtime/index.js.map +1 -0
  279. package/dist/types/actions.d.ts +32 -0
  280. package/dist/types/actions.d.ts.map +1 -0
  281. package/dist/types/actions.js +9 -0
  282. package/dist/types/actions.js.map +1 -0
  283. package/dist/types/audit.d.ts +65 -0
  284. package/dist/types/audit.d.ts.map +1 -0
  285. package/dist/types/audit.js +14 -0
  286. package/dist/types/audit.js.map +1 -0
  287. package/dist/types/channels.d.ts +37 -0
  288. package/dist/types/channels.d.ts.map +1 -0
  289. package/dist/types/channels.js +6 -0
  290. package/dist/types/channels.js.map +1 -0
  291. package/dist/types/confirmation.d.ts +53 -0
  292. package/dist/types/confirmation.d.ts.map +1 -0
  293. package/dist/types/confirmation.js +17 -0
  294. package/dist/types/confirmation.js.map +1 -0
  295. package/dist/types/contracts.d.ts +194 -0
  296. package/dist/types/contracts.d.ts.map +1 -0
  297. package/dist/types/contracts.js +10 -0
  298. package/dist/types/contracts.js.map +1 -0
  299. package/dist/types/conversation-sessions.d.ts +58 -0
  300. package/dist/types/conversation-sessions.d.ts.map +1 -0
  301. package/dist/types/conversation-sessions.js +6 -0
  302. package/dist/types/conversation-sessions.js.map +1 -0
  303. package/dist/types/conversation.d.ts +96 -0
  304. package/dist/types/conversation.d.ts.map +1 -0
  305. package/dist/types/conversation.js +3 -0
  306. package/dist/types/conversation.js.map +1 -0
  307. package/dist/types/entities.d.ts +22 -0
  308. package/dist/types/entities.d.ts.map +1 -0
  309. package/dist/types/entities.js +4 -0
  310. package/dist/types/entities.js.map +1 -0
  311. package/dist/types/events-stream.d.ts +82 -0
  312. package/dist/types/events-stream.d.ts.map +1 -0
  313. package/dist/types/events-stream.js +65 -0
  314. package/dist/types/events-stream.js.map +1 -0
  315. package/dist/types/flows-contract.d.ts +8 -0
  316. package/dist/types/flows-contract.d.ts.map +1 -0
  317. package/dist/types/flows-contract.js +7 -0
  318. package/dist/types/flows-contract.js.map +1 -0
  319. package/dist/types/flows.d.ts +66 -0
  320. package/dist/types/flows.d.ts.map +1 -0
  321. package/dist/types/flows.js +25 -0
  322. package/dist/types/flows.js.map +1 -0
  323. package/dist/types/imports.d.ts +57 -0
  324. package/dist/types/imports.d.ts.map +1 -0
  325. package/dist/types/imports.js +3 -0
  326. package/dist/types/imports.js.map +1 -0
  327. package/dist/types/index.d.ts +17 -0
  328. package/dist/types/index.d.ts.map +1 -0
  329. package/dist/types/index.js +3 -0
  330. package/dist/types/index.js.map +1 -0
  331. package/dist/types/locale.d.ts +24 -0
  332. package/dist/types/locale.d.ts.map +1 -0
  333. package/dist/types/locale.js +17 -0
  334. package/dist/types/locale.js.map +1 -0
  335. package/dist/types/mcp.d.ts +28 -0
  336. package/dist/types/mcp.d.ts.map +1 -0
  337. package/dist/types/mcp.js +12 -0
  338. package/dist/types/mcp.js.map +1 -0
  339. package/dist/types/platform.d.ts +51 -0
  340. package/dist/types/platform.d.ts.map +1 -0
  341. package/dist/types/platform.js +4 -0
  342. package/dist/types/platform.js.map +1 -0
  343. package/dist/types/receipt.d.ts +79 -0
  344. package/dist/types/receipt.d.ts.map +1 -0
  345. package/dist/types/receipt.js +15 -0
  346. package/dist/types/receipt.js.map +1 -0
  347. package/dist/types/records.d.ts +45 -0
  348. package/dist/types/records.d.ts.map +1 -0
  349. package/dist/types/records.js +4 -0
  350. package/dist/types/records.js.map +1 -0
  351. package/dist/types/spec.d.ts +6 -0
  352. package/dist/types/spec.d.ts.map +1 -0
  353. package/dist/types/spec.js +3 -0
  354. package/dist/types/spec.js.map +1 -0
  355. package/dist/types/state-machine.d.ts +100 -0
  356. package/dist/types/state-machine.d.ts.map +1 -0
  357. package/dist/types/state-machine.js +9 -0
  358. package/dist/types/state-machine.js.map +1 -0
  359. package/dist/types/system.d.ts +28 -0
  360. package/dist/types/system.d.ts.map +1 -0
  361. package/dist/types/system.js +3 -0
  362. package/dist/types/system.js.map +1 -0
  363. package/dist/types/tools.d.ts +188 -0
  364. package/dist/types/tools.d.ts.map +1 -0
  365. package/dist/types/tools.js +22 -0
  366. package/dist/types/tools.js.map +1 -0
  367. package/dist/types/traces.d.ts +77 -0
  368. package/dist/types/traces.d.ts.map +1 -0
  369. package/dist/types/traces.js +11 -0
  370. package/dist/types/traces.js.map +1 -0
  371. package/dist/types/workflows.d.ts +42 -0
  372. package/dist/types/workflows.d.ts.map +1 -0
  373. package/dist/types/workflows.js +11 -0
  374. package/dist/types/workflows.js.map +1 -0
  375. package/package.json +103 -0
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Spec-document types (spec-051 US2; renamed from Contract* prefix).
3
+ *
4
+ * Wire shapes mirror authoring/packages/contract/src/domain/types/spec-diff.ts.
5
+ * Kept as plain interfaces so SDK consumers do not depend on the runtime
6
+ * contract package.
7
+ */
8
+ export type SpecSection = 'entities' | 'flows' | 'roles' | 'authorization' | 'mcp_servers' | 'llm_services' | 'policies';
9
+ export type ChangeKind = 'added' | 'removed' | 'modified';
10
+ export type ImpactClass = 'breaking' | 'behavioural' | 'additive';
11
+ export type ReviewerRole = 'compliance' | 'ops-leadership' | 'engineering';
12
+ export interface SpecHashes {
13
+ readonly version: string;
14
+ readonly hash: string;
15
+ }
16
+ export interface SpecChange {
17
+ readonly path: string;
18
+ readonly section: SpecSection;
19
+ readonly kind: ChangeKind;
20
+ readonly before: Record<string, unknown> | null;
21
+ readonly after: Record<string, unknown> | null;
22
+ readonly impact_class: ImpactClass;
23
+ readonly human_summary: string;
24
+ }
25
+ export interface ImpactSummary {
26
+ readonly flows_affected: ReadonlyArray<string>;
27
+ readonly roles_affected: ReadonlyArray<string>;
28
+ readonly has_breaking_changes: boolean;
29
+ readonly may_reject_previously_allowed: boolean;
30
+ readonly may_require_hitl_previously_not: boolean;
31
+ readonly recommended_reviewers: ReadonlyArray<ReviewerRole>;
32
+ }
33
+ export interface SpecDiff {
34
+ readonly tenant: string;
35
+ readonly current: SpecHashes;
36
+ readonly proposed: SpecHashes;
37
+ readonly changes: ReadonlyArray<SpecChange>;
38
+ readonly impact_summary: ImpactSummary;
39
+ }
40
+ export type SpecApplyMode = 'upsert' | 'replace';
41
+ /**
42
+ * spec-039 — two-plane contract files. `structural` carries the legacy
43
+ * structural YAML (entities, fields, roles, policies, transitions, guards,
44
+ * flows — names/types/policies only). `semanticByLocale` carries the
45
+ * per-locale `.i18n.<locale>.yaml` content as a record keyed by locale code
46
+ * (e.g. `{ en: '...', es: '...' }`). The canonical locale (`en`) must
47
+ * validate atomically (FR-008a); other locales fail soft with warnings
48
+ * (FR-008b).
49
+ *
50
+ * The single-plane `{yaml: string}` shape was removed in spec-039 — lab
51
+ * phase, no back-compat. Callers shipping un-split YAML should send it as
52
+ * `files: { structural: yaml }` with no semantic siblings.
53
+ */
54
+ export interface SpecFiles {
55
+ readonly structural: string;
56
+ readonly semanticByLocale?: Readonly<Record<string, string>>;
57
+ }
58
+ export interface SpecPublishRequest {
59
+ readonly files: SpecFiles;
60
+ readonly mode: SpecApplyMode;
61
+ readonly expected_hash?: string;
62
+ /**
63
+ * ADR-0102 §6 (S3b) — explicit consent to proceed when plan-as-ceiling
64
+ * enforcement would strip more than the server threshold (10) of
65
+ * over-budget grants; without it such a publish fails 422
66
+ * `strip_threshold_exceeded`.
67
+ */
68
+ readonly force?: boolean;
69
+ }
70
+ /** ADR-0102 §6 (S3b) — a grant removed by plan-as-ceiling enforcement. */
71
+ export interface StrippedGrant {
72
+ readonly role: string;
73
+ readonly kind: 'section' | 'system';
74
+ readonly target: string | null;
75
+ readonly action: string;
76
+ readonly reason: 'envelope_exceeded' | 'owner_role_protected';
77
+ }
78
+ export interface SpecPublishResponse {
79
+ readonly tenant_name: string;
80
+ readonly applied_mode: SpecApplyMode;
81
+ readonly summary: {
82
+ readonly entities: number;
83
+ readonly roles: number;
84
+ readonly skills: number;
85
+ readonly actions: number;
86
+ };
87
+ /** ADR-0102 §6 (S3b) — grants stripped by this publish ([] when none). */
88
+ readonly stripped_grants: ReadonlyArray<StrippedGrant>;
89
+ }
90
+ export interface SpecDiffRequest {
91
+ readonly proposed_spec: string;
92
+ }
93
+ export interface SpecApplyGating {
94
+ readonly reject_breaking_changes?: boolean;
95
+ readonly max_changes?: number;
96
+ }
97
+ export interface SpecApplyRequest {
98
+ readonly files: SpecFiles;
99
+ readonly mode: SpecApplyMode;
100
+ readonly expected_hash?: string;
101
+ readonly gating?: SpecApplyGating;
102
+ /**
103
+ * ADR-0102 §6 (S3b) — same semantics as `SpecPublishRequest.force`:
104
+ * required to proceed when plan-as-ceiling enforcement would strip more
105
+ * than the server threshold (10) of over-budget grants (422
106
+ * `strip_threshold_exceeded` otherwise).
107
+ */
108
+ readonly force?: boolean;
109
+ }
110
+ export interface SpecApplyResponse {
111
+ readonly applied: true;
112
+ readonly diff: SpecDiff;
113
+ /** ADR-0102 §6 (S3b) — grants stripped by this apply ([] when none). */
114
+ readonly stripped_grants: ReadonlyArray<StrippedGrant>;
115
+ }
116
+ export interface SpecSnapshotV1Response {
117
+ readonly tenant_name: string;
118
+ readonly spec_version: string;
119
+ readonly contract_version: number;
120
+ readonly hash: string;
121
+ readonly contract: unknown;
122
+ }
123
+ export type SpecDryRunStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
124
+ export type SpecDryRunOutcome = 'executed' | 'refused' | 'awaiting_human_decision' | 'failed';
125
+ export type SpecDryRunUnknownCause = 'intent_classification_unreusable' | 'external_tool_result_uncached' | 'reference_to_removed_feature';
126
+ export interface SpecDryRunReplayWindow {
127
+ readonly from: string;
128
+ readonly to: string;
129
+ }
130
+ export interface SpecDryRunFilter {
131
+ readonly flow?: string;
132
+ readonly user?: string;
133
+ }
134
+ export interface SpecDryRunSubmitRequest {
135
+ readonly proposed_spec: string;
136
+ readonly replay_window: SpecDryRunReplayWindow;
137
+ readonly filter?: SpecDryRunFilter;
138
+ }
139
+ export interface SpecDryRunSubmitResponse {
140
+ readonly report_id: string;
141
+ readonly status: 'queued' | 'running';
142
+ }
143
+ export interface SpecDryRunChangeBreakdown {
144
+ readonly from_outcome: SpecDryRunOutcome;
145
+ readonly to_outcome: SpecDryRunOutcome;
146
+ readonly count: number;
147
+ readonly cause: string;
148
+ readonly example_trace_ids: ReadonlyArray<string>;
149
+ }
150
+ export interface SpecDryRunUnknown {
151
+ readonly cause: SpecDryRunUnknownCause;
152
+ readonly count: number;
153
+ readonly example_trace_ids: ReadonlyArray<string>;
154
+ }
155
+ export interface SpecDryRunAffectedUser {
156
+ readonly user_name: string;
157
+ readonly sessions_affected: number;
158
+ }
159
+ export interface SpecDryRunOperationalImplications {
160
+ readonly estimated_additional_hitl_per_month: number;
161
+ readonly required_roles: ReadonlyArray<string>;
162
+ }
163
+ export interface SpecDryRunReport {
164
+ readonly tenant: string;
165
+ readonly spec_diff: SpecDiff;
166
+ readonly replay_window: SpecDryRunReplayWindow;
167
+ readonly sessions_evaluated: number;
168
+ readonly outcomes_unchanged: number;
169
+ readonly outcomes_changed: number;
170
+ readonly change_breakdown: ReadonlyArray<SpecDryRunChangeBreakdown>;
171
+ readonly affected_users: ReadonlyArray<SpecDryRunAffectedUser>;
172
+ readonly unknowns: ReadonlyArray<SpecDryRunUnknown>;
173
+ readonly operational_implications: SpecDryRunOperationalImplications;
174
+ readonly generated_at: string;
175
+ }
176
+ export interface SpecDryRunJobProgress {
177
+ readonly traces_processed: number;
178
+ readonly traces_total: number | null;
179
+ }
180
+ export interface SpecDryRunJobFailure {
181
+ readonly code: string;
182
+ readonly message: string;
183
+ }
184
+ export interface SpecDryRunJob {
185
+ readonly tenant: string;
186
+ readonly report_id: string;
187
+ readonly status: SpecDryRunStatus;
188
+ readonly progress: SpecDryRunJobProgress | null;
189
+ readonly result: SpecDryRunReport | null;
190
+ readonly failure: SpecDryRunJobFailure | null;
191
+ readonly started_at: string;
192
+ readonly completed_at: string | null;
193
+ }
194
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/types/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,WAAW,GACjB,UAAU,GACV,OAAO,GACP,OAAO,GACP,eAAe,GACf,aAAa,GACb,cAAc,GACd,UAAU,CAAC;AAEjB,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,aAAa,GA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CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * Spec-document types (spec-051 US2; renamed from Contract* prefix).
4
+ *
5
+ * Wire shapes mirror authoring/packages/contract/src/domain/types/spec-diff.ts.
6
+ * Kept as plain interfaces so SDK consumers do not depend on the runtime
7
+ * contract package.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/types/contracts.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -0,0 +1,58 @@
1
+ export type ConversationSessionStatus = 'active' | 'expired' | 'cleared';
2
+ export interface ConversationSessionSummary {
3
+ tenant_name: string;
4
+ session_key: string;
5
+ user_name: string;
6
+ channel_name: string;
7
+ status: ConversationSessionStatus;
8
+ turn_count: number;
9
+ created_at: string;
10
+ last_activity: string;
11
+ }
12
+ export interface ConversationTurnRecord {
13
+ turn_number: number;
14
+ role: 'user' | 'assistant' | 'system';
15
+ content: string;
16
+ intent_id?: string;
17
+ intent_type?: string;
18
+ metadata?: Record<string, unknown>;
19
+ created_at: string;
20
+ }
21
+ export interface ConversationActionRecord {
22
+ id: string;
23
+ session_key: string;
24
+ turn_number: number;
25
+ action_type: string;
26
+ entity_name: string;
27
+ record_id: string;
28
+ action_data?: Record<string, unknown>;
29
+ changed_fields?: string[];
30
+ actor?: string;
31
+ created_at: string;
32
+ }
33
+ export interface ConversationSessionDetail {
34
+ session: ConversationSessionSummary & {
35
+ /**
36
+ * Session-level snapshot of the actor's roles (Spec-019 FR-A07). NOT
37
+ * a security gate — exposed for observability / UI display only.
38
+ */
39
+ roles_snapshot: string[];
40
+ metadata: Record<string, unknown>;
41
+ current_phase?: string;
42
+ updated_at: string;
43
+ };
44
+ turns: ConversationTurnRecord[];
45
+ actions: ConversationActionRecord[];
46
+ }
47
+ export interface ConversationSessionListParams {
48
+ channel_name?: string;
49
+ status?: ConversationSessionStatus;
50
+ from?: string;
51
+ to?: string;
52
+ limit?: number;
53
+ offset?: number;
54
+ }
55
+ export type ConversationSessionListResponse = ConversationSessionSummary[];
56
+ export type ConversationSessionDetailResponse = ConversationSessionDetail;
57
+ export type ConversationSessionActionsResponse = ConversationActionRecord[];
58
+ //# sourceMappingURL=conversation-sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-sessions.d.ts","sourceRoot":"","sources":["../../src/types/conversation-sessions.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,0BAA0B;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,yBAAyB,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACtC,OAAO,EAAE,0BAA0B,GAAG;QAClC;;;WAGG;QACH,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,OAAO,EAAE,wBAAwB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,6BAA6B;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,+BAA+B,GAAG,0BAA0B,EAAE,CAAC;AAE3E,MAAM,MAAM,iCAAiC,GAAG,yBAAyB,CAAC;AAE1E,MAAM,MAAM,kCAAkC,GAAG,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // ═══════════════════════════════════════════════════════════════════════════
3
+ // Conversation session history types — derived from docs/api/openapi-v1.yaml
4
+ // ═══════════════════════════════════════════════════════════════════════════
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=conversation-sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-sessions.js","sourceRoot":"","sources":["../../src/types/conversation-sessions.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E"}
@@ -0,0 +1,96 @@
1
+ import type { operations } from '../generated/runtime';
2
+ export type Channel = NonNullable<NonNullable<operations['listConversationSessions']['parameters']['query']>['channel_name']>;
3
+ export interface InteractionContext {
4
+ channel_name?: Channel;
5
+ audience?: 'human' | 'machine';
6
+ modality?: 'synchronous' | 'asynchronous';
7
+ platform?: string;
8
+ }
9
+ export interface ConversationRequest {
10
+ message: string;
11
+ role?: string;
12
+ interaction?: InteractionContext;
13
+ /** SpecKit 010 / FR-C07 (T077): explicit session lookup — sessions must be created first via `client.runtime.conversationSessions.create`. */
14
+ session_key?: string;
15
+ /** SpecKit 010 / FR-C04 (T077): per-turn LLM service override. Must be authorized for the actor in the session's scope. */
16
+ llm_service?: string;
17
+ /**
18
+ * ADR-0133 §B.4 / FR-C03: the inbound at-most-once dedupe token
19
+ * `deriveIdempotencyKey(channel, channel_message_id)` (a public sha256 hex).
20
+ * Set by a channel adapter's party turn so a redelivered provider message
21
+ * (a re-fired WhatsApp `wamid`) never creates a second turn; the runtime
22
+ * enforces it unique per `(tenant, channel)` — the channel is trust-rooted
23
+ * from the credential, never this body. Omit on ordinary tenant turns.
24
+ */
25
+ idempotency_key?: string;
26
+ /**
27
+ * ADR-0133 §B.7 / FR-E01: the edge-attestation of the inbound boundary crossing,
28
+ * from which the runtime builds the `channel.ingress` audit row — whether the
29
+ * adapter verified the provider signature, who attests the crossing (runtime vs
30
+ * channel_provider), the provider's clock, and the opaque provider message id (which
31
+ * MUST be hashed by the adapter if address-shaped, FR-E03). Set by a channel
32
+ * adapter's party turn; omit on ordinary tenant turns.
33
+ */
34
+ channel_attestation?: {
35
+ signature_verified: boolean;
36
+ attested_by: 'runtime' | 'channel_provider';
37
+ provider_timestamp?: string;
38
+ channel_message_id?: string;
39
+ };
40
+ }
41
+ export interface ConversationDebugInfo {
42
+ enabled?: boolean;
43
+ system_prompt?: string;
44
+ llm_raw_response?: unknown;
45
+ errors?: Array<{
46
+ source?: string;
47
+ message?: string;
48
+ metadata?: Record<string, unknown>;
49
+ }>;
50
+ flow?: Record<string, unknown>;
51
+ interaction?: {
52
+ channel_name?: string;
53
+ audience?: string;
54
+ modality?: string;
55
+ renderer_name?: string;
56
+ output_type?: string;
57
+ };
58
+ }
59
+ export interface ConversationResponse {
60
+ success: boolean;
61
+ message: string;
62
+ intent_type?: string;
63
+ intent_id?: string;
64
+ data?: unknown;
65
+ clarification_needed?: boolean;
66
+ options?: string[];
67
+ suggestions?: string[];
68
+ error?: string;
69
+ /** Desk Spec 3 (US2): the turn's correlation id, to tie it to its receipts. */
70
+ trace_id?: string;
71
+ /** ADR-0133 §B.7: the inbound turn's sequence number (present on channel party turns). */
72
+ conversation_turn_seq?: number;
73
+ _debug?: ConversationDebugInfo;
74
+ }
75
+ export interface ConversationTurn {
76
+ role: 'user' | 'assistant' | 'system';
77
+ content: string;
78
+ timestamp: string;
79
+ intent_id?: string;
80
+ metadata?: {
81
+ intent_type?: string;
82
+ entity_name?: string;
83
+ data?: Record<string, unknown>;
84
+ interaction_context?: {
85
+ channel_name?: string;
86
+ audience?: string;
87
+ modality?: string;
88
+ renderer_name?: string;
89
+ };
90
+ };
91
+ }
92
+ export interface ConversationHistoryResponse {
93
+ success: true;
94
+ history: ConversationTurn[];
95
+ }
96
+ //# sourceMappingURL=conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/types/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASvD,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;AAE9H,MAAM,WAAW,kBAAkB;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,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 //# sourceMappingURL=conversation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/types/conversation.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ export interface EntityInput {
2
+ name: string;
3
+ label?: string;
4
+ description?: string;
5
+ }
6
+ export interface FieldDefinitionInput {
7
+ name: string;
8
+ field_type: string;
9
+ label?: string;
10
+ description?: string;
11
+ is_required?: boolean;
12
+ config?: Record<string, unknown>;
13
+ options?: string[];
14
+ default_value?: unknown;
15
+ position?: number;
16
+ }
17
+ export interface ToolExecutionResult {
18
+ success: boolean;
19
+ data?: unknown;
20
+ error?: string;
21
+ }
22
+ //# sourceMappingURL=entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/types/entities.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAUD,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // ── Entities ─────────────────────────────────────────────────────────────
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=entities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../src/types/entities.ts"],"names":[],"mappings":";AAAA,4EAA4E"}
@@ -0,0 +1,82 @@
1
+ import type { SseConversationTurnCreatedData, SseConversationTurnCreatedPayload } from '../generated';
2
+ /** Metadata-only payload of a `conversation.turn_created` event (ADR-0104). */
3
+ export type ConversationTurnCreatedPayload = SseConversationTurnCreatedPayload;
4
+ /** The SSE bridge wraps every event's data as `{entity, record_id, payload, timestamp}`. */
5
+ export type ConversationTurnCreatedData = SseConversationTurnCreatedData;
6
+ /** A typed `conversation.turn_created` event. `id` is the SSE frame id (correlation / Last-Event-ID anchor). */
7
+ export interface ConversationTurnCreatedEvent {
8
+ event: 'conversation.turn_created';
9
+ id?: string;
10
+ data: ConversationTurnCreatedData;
11
+ }
12
+ /** Any other named runtime event — `data` is left unvalidated. */
13
+ export interface GenericStreamEvent {
14
+ event: string;
15
+ id?: string;
16
+ data: unknown;
17
+ }
18
+ /**
19
+ * A typed runtime stream event. Narrow to the `conversation.turn_created` arm with the
20
+ * exported `isConversationTurnCreatedEvent` guard (a plain `event === '…'` check does NOT
21
+ * narrow, because the generic arm's `event: string` overlaps the literal).
22
+ */
23
+ export type RuntimeStreamEvent = ConversationTurnCreatedEvent | GenericStreamEvent;
24
+ /** Handlers for `events.stream`. Only `onEvent` is typically needed. */
25
+ export interface EventStreamHandlers {
26
+ /** Each complete, parsed, typed frame. Heartbeats/comments never surface. */
27
+ onEvent?: (event: RuntimeStreamEvent) => void;
28
+ /** A terminal (non-reconnectable) error — invoked at most once. */
29
+ onError?: (err: unknown) => void;
30
+ /** Fired on each successful (re)connect. */
31
+ onOpen?: () => void;
32
+ }
33
+ /** Options for `events.stream`. */
34
+ export interface EventStreamOptions {
35
+ /** Aborting this is equivalent to `handle.close()`. */
36
+ signal?: AbortSignal;
37
+ /** Reconnect on transient disconnects (default: true). */
38
+ reconnect?: boolean;
39
+ /** Seed `Last-Event-ID` on the initial connect (resume a known position). */
40
+ lastEventId?: string;
41
+ }
42
+ /** The teardown handle returned by `events.stream`. */
43
+ export interface EventStreamHandle {
44
+ /** Idempotent teardown: abort the request, cancel the reader, stop reconnecting. */
45
+ close(): void;
46
+ }
47
+ /**
48
+ * Options for `events.iterate` — the async-iterable (pull) view over the same
49
+ * stream `events.stream` consumes via callbacks. Extends `EventStreamOptions`
50
+ * (`signal`/`reconnect`/`lastEventId` apply identically) with the pull-view's
51
+ * bounded-buffer controls. `onOpen` is intentionally absent: a per-connect
52
+ * signal has no meaning to a `for await` loop (use `events.stream` for that).
53
+ */
54
+ export interface EventIterateOptions extends EventStreamOptions {
55
+ /**
56
+ * Capacity of the bounded FIFO buffer between the push producer (SSE frames)
57
+ * and the pull consumer (`for await`). Default 1024. Values below 1 clamp to 1.
58
+ * On overflow the OLDEST queued event is dropped (loss-tolerant, matching the
59
+ * stream leg), keeping memory bounded regardless of consumer speed.
60
+ */
61
+ bufferSize?: number;
62
+ /**
63
+ * Invoked once per overflow drop with the running total of dropped events,
64
+ * so a slow consumer can observe loss out-of-band (the iterator value type
65
+ * stays a clean `RuntimeStreamEvent`).
66
+ */
67
+ onDropped?: (totalDropped: number) => void;
68
+ }
69
+ /**
70
+ * Runtime type-guard for a `conversation.turn_created` event's `data` envelope (the
71
+ * single boundary-validation authority for the typed arm — QI-004, ADR-0038, no `as`).
72
+ */
73
+ export declare function isConversationTurnCreatedData(data: unknown): data is ConversationTurnCreatedData;
74
+ /** Narrowing guard so consumers get the typed `conversation.turn_created` `data` shape. */
75
+ export declare function isConversationTurnCreatedEvent(event: RuntimeStreamEvent): event is ConversationTurnCreatedEvent;
76
+ /**
77
+ * Map a raw SSE frame (event name + parsed `data` JSON + optional id) to a typed
78
+ * `RuntimeStreamEvent`. Returns `undefined` when a `conversation.turn_created` frame fails
79
+ * validation (drop, never throw). Other named events pass through as the generic arm.
80
+ */
81
+ export declare function toRuntimeStreamEvent(eventName: string, data: unknown, id: string | undefined): RuntimeStreamEvent | undefined;
82
+ //# sourceMappingURL=events-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-stream.d.ts","sourceRoot":"","sources":["../../src/types/events-stream.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAQtG,+EAA+E;AAC/E,MAAM,MAAM,8BAA8B,GAAG,iCAAiC,CAAC;AAE/E,4FAA4F;AAC5F,MAAM,MAAM,2BAA2B,GAAG,8BAA8B,CAAC;AAEzE,gHAAgH;AAChH,MAAM,WAAW,4BAA4B;IACzC,KAAK,EAAE,2BAA2B,CAAC;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,2BAA2B,CAAC;CACrC;AAED,kEAAkE;AAClE,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,4BAA4B,GAAG,kBAAkB,CAAC;AAEnF,wEAAwE;AACxE,MAAM,WAAW,mBAAmB;IAChC,6EAA6E;IAC7E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC9C,mEAAmE;IACnE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IAC/B,uDAAuD;IACvD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,uDAAuD;AACvD,MAAM,WAAW,iBAAiB;IAC9B,oFAAoF;IACpF,KAAK,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC3D;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAQD;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,2BAA2B,CAWhG;AAED,2FAA2F;AAC3F,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,IAAI,4BAA4B,CAE/G;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,EACb,EAAE,EAAE,MAAM,GAAG,SAAS,GACvB,kBAAkB,GAAG,SAAS,CAQhC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ // G3 — typed runtime SSE event map for `client.runtime.events.stream`.
3
+ //
4
+ // The runtime event stream (`GET /runtime/events/stream`, ADR-0104) emits NAMED
5
+ // SSE frames. `conversation.turn_created` carries a fixed metadata-only envelope; all
6
+ // other named events (record mutations, state transitions, …) pass through as
7
+ // the generic arm with `data: unknown`.
8
+ //
9
+ // Boundary validation uses a HAND-WRITTEN runtime type-guard — NOT Zod: the SDK
10
+ // ships ZERO runtime dependencies, so it follows the hand-written envelope-shape
11
+ // guard precedent in `fetch-client.ts`. A frame whose JSON is malformed or whose shape
12
+ // fails the guard is dropped (never thrown into `onEvent`) — the leg is
13
+ // loss-tolerant, matching the dashboard's prior raw-EventSource behavior.
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.isConversationTurnCreatedData = isConversationTurnCreatedData;
16
+ exports.isConversationTurnCreatedEvent = isConversationTurnCreatedEvent;
17
+ exports.toRuntimeStreamEvent = toRuntimeStreamEvent;
18
+ const CONVERSATION_TURN_CREATED = 'conversation.turn_created';
19
+ function isRecord(value) {
20
+ return typeof value === 'object' && value !== null;
21
+ }
22
+ /**
23
+ * Runtime type-guard for a `conversation.turn_created` event's `data` envelope (the
24
+ * single boundary-validation authority for the typed arm — QI-004, ADR-0038, no `as`).
25
+ */
26
+ function isConversationTurnCreatedData(data) {
27
+ if (!isRecord(data))
28
+ return false;
29
+ if (typeof data.entity !== 'string')
30
+ return false;
31
+ if (typeof data.record_id !== 'string')
32
+ return false;
33
+ if (typeof data.timestamp !== 'string')
34
+ return false;
35
+ const payload = data.payload;
36
+ if (!isRecord(payload))
37
+ return false;
38
+ if (typeof payload.session_key !== 'string')
39
+ return false;
40
+ if (typeof payload.turn_number !== 'number')
41
+ return false;
42
+ if (typeof payload.role !== 'string')
43
+ return false;
44
+ return true;
45
+ }
46
+ /** Narrowing guard so consumers get the typed `conversation.turn_created` `data` shape. */
47
+ function isConversationTurnCreatedEvent(event) {
48
+ return event.event === CONVERSATION_TURN_CREATED;
49
+ }
50
+ /**
51
+ * Map a raw SSE frame (event name + parsed `data` JSON + optional id) to a typed
52
+ * `RuntimeStreamEvent`. Returns `undefined` when a `conversation.turn_created` frame fails
53
+ * validation (drop, never throw). Other named events pass through as the generic arm.
54
+ */
55
+ function toRuntimeStreamEvent(eventName, data, id) {
56
+ if (eventName === CONVERSATION_TURN_CREATED) {
57
+ if (!isConversationTurnCreatedData(data))
58
+ return undefined;
59
+ return id !== undefined
60
+ ? { event: CONVERSATION_TURN_CREATED, id, data }
61
+ : { event: CONVERSATION_TURN_CREATED, data };
62
+ }
63
+ return id !== undefined ? { event: eventName, id, data } : { event: eventName, data };
64
+ }
65
+ //# sourceMappingURL=events-stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events-stream.js","sourceRoot":"","sources":["../../src/types/events-stream.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,EAAE;AACF,gFAAgF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,SAAS,KAAK,yBAAyB,EAAE,CAAC;QAC1C,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC;YAAE,OAAO,SAAS,CAAC;QAC3D,OAAO,EAAE,KAAK,SAAS;YACnB,CAAC,CAAC,EAAE,KAAK,EAAE,yBAAyB,EAAE,EAAE,EAAE,IAAI,EAAE;YAChD,CAAC,CAAC,EAAE,KAAK,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,8 @@
1
+ export interface ContractFlowListItem {
2
+ readonly name: string;
3
+ readonly version?: string;
4
+ readonly description?: string;
5
+ readonly [key: string]: unknown;
6
+ }
7
+ export type ContractFlowInput = Record<string, unknown>;
8
+ //# sourceMappingURL=flows-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flows-contract.d.ts","sourceRoot":"","sources":["../../src/types/flows-contract.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ // Types for the contract.flows resource (A4). Flow *definitions* live on the
3
+ // contract plane (`contract.flows`); flow *instances/runs* are runtime-plane
4
+ // and typed separately in `./flows`. Kept intentionally open (index signature)
5
+ // pending the full flow-definition schema — broad typing is track G (NG-005).
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=flows-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flows-contract.js","sourceRoot":"","sources":["../../src/types/flows-contract.ts"],"names":[],"mappings":";AAAA,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E"}