@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,100 @@
1
+ export interface StateMachineInstance {
2
+ id: string;
3
+ entity_name: string;
4
+ record_id: number;
5
+ field_name: string;
6
+ current_state: string;
7
+ created_at: string;
8
+ updated_at?: string;
9
+ }
10
+ export interface StateMachineInstanceListResponse {
11
+ count: number;
12
+ instances: StateMachineInstance[];
13
+ }
14
+ export type StateMachineInstanceResponse = StateMachineInstance;
15
+ export interface StateMachineEventListParams {
16
+ entity_name?: string;
17
+ instance_id?: string;
18
+ }
19
+ export interface StateMachineEvent {
20
+ id: string;
21
+ instance_id: string;
22
+ from_state: string;
23
+ to_state: string;
24
+ actor?: string;
25
+ actor_role?: string | null;
26
+ payload?: Record<string, unknown>;
27
+ rule_evaluations?: unknown;
28
+ created_at: string;
29
+ }
30
+ export interface StateMachineEventListResponse {
31
+ count: number;
32
+ events: StateMachineEvent[];
33
+ }
34
+ export type StateMachineEventResponse = StateMachineEvent;
35
+ export type TransitionRequestStatus = 'pending' | 'approved' | 'rejected';
36
+ export interface TransitionRequestListParams {
37
+ status?: TransitionRequestStatus;
38
+ /**
39
+ * Filter to requests whose `required_roles` intersect with any of the
40
+ * supplied roles. Serialized as repeated query parameters.
41
+ */
42
+ roles?: string[];
43
+ }
44
+ export interface TransitionRequestItem {
45
+ transition_request_id: string;
46
+ entity_name: string;
47
+ record_id: number;
48
+ current_state: string;
49
+ target_state: string;
50
+ field_name?: string;
51
+ required_roles: string[];
52
+ reason?: string;
53
+ status?: TransitionRequestStatus;
54
+ created_at: string;
55
+ }
56
+ export interface TransitionRequestListResponse {
57
+ count: number;
58
+ transition_requests: TransitionRequestItem[];
59
+ }
60
+ export type TransitionRequestResponse = TransitionRequestItem;
61
+ export interface TransitionRequestCreateBody {
62
+ instance_id: string;
63
+ entity_name: string;
64
+ record_id: number;
65
+ field_name: string;
66
+ current_state: string;
67
+ requested_transition: string;
68
+ /**
69
+ * Server derives `required_roles` from the contract's matching transition
70
+ * edges (`allowed_roles` union). Clients should normally omit this field;
71
+ * supplied values are used only when the server has no contract context
72
+ * (e.g., test stubs) and are otherwise ignored.
73
+ */
74
+ required_roles?: string[];
75
+ reason?: string;
76
+ }
77
+ export interface TransitionRequestPatchBody {
78
+ decision: 'approved' | 'rejected';
79
+ role?: string;
80
+ field_name?: string;
81
+ decision_notes?: string;
82
+ }
83
+ export interface TransitionRequestPatchResponse {
84
+ mode?: string;
85
+ entity_name?: string;
86
+ record_id?: number;
87
+ transition_request?: {
88
+ transition_request_id: string;
89
+ status: 'approved' | 'rejected';
90
+ resolved_by: string;
91
+ entity_name: string;
92
+ record_id: number;
93
+ };
94
+ state_machine_event?: {
95
+ id: string;
96
+ from_state: string;
97
+ to_state: string;
98
+ } | null;
99
+ }
100
+ //# sourceMappingURL=state-machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-machine.d.ts","sourceRoot":"","sources":["../../src/types/state-machine.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gCAAgC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,oBAAoB,EAAE,CAAC;CACrC;AAED,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAEhE,MAAM,WAAW,2BAA2B;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,C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C;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,0BAA0B;IACvC,QAAQ,EAAE,UAAU,GAAG,UAAU,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,8BAA8B;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE;QACjB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;QAChC,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,mBAAmB,CAAC,EAAE;QAClB,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;CACZ"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // ── State Machine ────────────────────────────────────────────────────────
3
+ //
4
+ // Canonical runtime-scope state-machine types. Backing tables:
5
+ // runtime."state_machine/instances" (readonly)
6
+ // runtime."state_machine/events" (readonly; was exposed as /workflows/timeline pre-P10)
7
+ // runtime."state_machine/transition_requests" (mutable)
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=state-machine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-machine.js","sourceRoot":"","sources":["../../src/types/state-machine.ts"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,EAAE;AACF,+DAA+D;AAC/D,0DAA0D;AAC1D,sGAAsG;AACtG,0DAA0D"}
@@ -0,0 +1,28 @@
1
+ export interface HealthResponse {
2
+ status: 'healthy';
3
+ timestamp: string;
4
+ }
5
+ export type MetricsResponse = Record<string, unknown>;
6
+ export interface ApiKeyCreateRequest {
7
+ name: string;
8
+ scopes?: string[];
9
+ }
10
+ export interface ApiKeyCreateResponse {
11
+ id: string;
12
+ name: string;
13
+ key: string;
14
+ scopes?: string[];
15
+ created_at?: string;
16
+ }
17
+ export interface ApiKeyListItem {
18
+ id: string;
19
+ name: string;
20
+ key_prefix: string;
21
+ scopes?: string[];
22
+ created_at?: string;
23
+ }
24
+ export type ApiKeyListResponse = ApiKeyListItem[];
25
+ export interface ApiKeyDeleteResponse {
26
+ success: true;
27
+ }
28
+ //# sourceMappingURL=system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/types/system.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,kBAAkB,GAAG,cAAc,EAAE,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,IAAI,CAAC;CACjB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/types/system.ts"],"names":[],"mappings":""}
@@ -0,0 +1,188 @@
1
+ export interface UserVisibleAction {
2
+ action: 'create' | 'read' | 'list' | 'update' | 'delete';
3
+ owned_only: boolean;
4
+ }
5
+ export interface FieldToolDefinition {
6
+ name: string;
7
+ type: string;
8
+ required: boolean;
9
+ label?: string;
10
+ description?: string;
11
+ config?: Record<string, unknown>;
12
+ options?: string[];
13
+ /**
14
+ * Enum value → localized display label, resolved from the field's i18n
15
+ * sidecar at projection time. Present only for enum fields; options with no
16
+ * authored label are omitted, so consumers MUST fall back to the raw
17
+ * `options` code when a key is absent. (Mirror of the contract-side
18
+ * `FieldToolDefinition` — kept in lockstep.)
19
+ */
20
+ values?: Record<string, string>;
21
+ default?: unknown;
22
+ references?: string;
23
+ /**
24
+ * The effective display field of the *referenced* entity for a
25
+ * reference/reference[] field — the field a client labels/searches the target
26
+ * by (ADR-0134 T007). Resolved server-side; omitted when unresolvable.
27
+ * (Mirror of the contract-side `FieldToolDefinition` — kept in lockstep.)
28
+ */
29
+ display_field?: string;
30
+ constraints?: Record<string, unknown>;
31
+ compute?: {
32
+ expression?: string;
33
+ strategy?: 'write' | 'read';
34
+ cache?: boolean;
35
+ };
36
+ binding?: {
37
+ bind: string;
38
+ } | {
39
+ assert: string;
40
+ } | {
41
+ immutable_after_set: true;
42
+ };
43
+ }
44
+ export interface UserVisibleEntityTool {
45
+ entity_name: string;
46
+ entity_label: string;
47
+ description?: string;
48
+ actions: UserVisibleAction[];
49
+ fields: FieldToolDefinition[];
50
+ tool_names: string[];
51
+ }
52
+ /**
53
+ * Per-edge projection of a `StateMachineTransition` exposed to UIs through
54
+ * the catalog (spec 015 / M4). `requires_reason` is omitted when the
55
+ * underlying flag is `false` or absent.
56
+ */
57
+ export interface TransitionEdge {
58
+ from: string;
59
+ to: string;
60
+ requires_reason?: boolean;
61
+ }
62
+ /**
63
+ * Per-user projection of a state-machine `(entity, field)` transition tool
64
+ * trio (ADR-0081). Carries the rendering inputs needed by the M4 UI surfaces
65
+ * (`<FieldTransitions>`, `<TransitionRequestQueue>`).
66
+ */
67
+ export interface UserVisibleTransitionTool {
68
+ entity_name: string;
69
+ field_name: string;
70
+ request_tool_name: string;
71
+ resolve_tool_name: string;
72
+ list_pending_tool_name: string;
73
+ target_states: readonly string[];
74
+ transitions: readonly TransitionEdge[];
75
+ field_label?: string;
76
+ field_description?: string;
77
+ inspect: boolean;
78
+ }
79
+ /**
80
+ * Per-user projection of a YAML-declared `action` (ADR-0085) the user is
81
+ * authorized to dispatch. Carries the rendering inputs needed by the M5 UI
82
+ * surfaces (`<EntityActions>`, `<EntityRecordActions>`).
83
+ *
84
+ * Emitted only when the action-surface-resolver returns `kind: 'action'` for
85
+ * the underlying `(entity, verb)` pair under the user's capabilities. Hidden
86
+ * and entity-fallback decisions are NOT projected.
87
+ */
88
+ export interface UserVisibleActionTool {
89
+ /** Action name from YAML — unique within the tenant. */
90
+ name: string;
91
+ /** Underlying entity the action operates on. */
92
+ entity: string;
93
+ /** CRUD verb the action invokes server-side. */
94
+ verb: 'create' | 'read' | 'update' | 'delete' | 'list';
95
+ /** Human-readable description (from YAML `action.description`). */
96
+ description?: string;
97
+ /** Dispatcher-recognised intent string — `action.<name>` or `external.<ns>.<tool>`. */
98
+ intent_type: string;
99
+ /** Whether the action is native (declared in tenant YAML) or external (ADR-0076). */
100
+ provenance: 'native' | 'external';
101
+ }
102
+ /**
103
+ * Per-tenant role declaration. Always projected for every caller — read-only
104
+ * metadata used by UIs to render role pickers and label other catalog
105
+ * references. Editing is gated separately by the `roles` contract-section
106
+ * policy (W3: surfaced to UIs via {@link UserToolCatalog.admin_sections}).
107
+ */
108
+ export interface UserVisibleRole {
109
+ name: string;
110
+ label?: string;
111
+ description?: string;
112
+ }
113
+ /**
114
+ * Per-tenant flow declaration projected for users with `inspect` policy on the
115
+ * flow (open-by-default per ADR-0065). Only carries the rendering inputs the
116
+ * dashboard sidebar needs — full editable shape is fetched elsewhere.
117
+ */
118
+ export interface UserVisibleFlow {
119
+ name: string;
120
+ description?: string;
121
+ }
122
+ /**
123
+ * Per-tenant skill declaration projected for users whose role set satisfies
124
+ * the skill's YAML `constraints[]`.
125
+ */
126
+ export interface UserVisibleSkill {
127
+ name: string;
128
+ label?: string;
129
+ description?: string;
130
+ }
131
+ /**
132
+ * W3 — mirror of `@zarel-ai/contract`'s `CONTRACT_SECTION_NAMES`. The closed set
133
+ * of contract sections; `UserToolCatalog.admin_sections` is a subset (the
134
+ * sections the user can `update`). The SDK is published standalone and cannot
135
+ * import the contract package, so this is a hand-maintained mirror — and it
136
+ * DRIFTED: it named two roots that no longer exist and none of the nine that a
137
+ * dissolution had created. The ADR-0136 QI-001 gate compared seven mirrors and
138
+ * did not compare this one, which is why nothing said so. It does now.
139
+ */
140
+ export declare const CONTRACT_SECTION_NAMES: readonly ["metadata", "entities", "roles", "skills", "actions", "schemas", "capabilities", "flows", "constraints", "events", "llm", "embeddings", "treatment", "channels", "channels/credentials", "mcp_servers", "quotas", "timezone", "process_model", "authorization"];
141
+ export type ContractSectionName = typeof CONTRACT_SECTION_NAMES[number];
142
+ export interface UserToolCatalog {
143
+ tenant_name: string;
144
+ user_name: string;
145
+ user_roles: string[];
146
+ entities: UserVisibleEntityTool[];
147
+ /** M4 / ADR-0081 trio-coupled state-machine projection. */
148
+ transitions?: UserVisibleTransitionTool[];
149
+ /** M5 / ADR-0085 per-user authorized action projection. */
150
+ actions?: UserVisibleActionTool[];
151
+ /** Spec-042: declared roles in the tenant contract (read-only metadata). */
152
+ roles: UserVisibleRole[];
153
+ /** Spec-042: flows the user can `inspect` (ADR-0065 open-by-default). */
154
+ flows: UserVisibleFlow[];
155
+ /** Spec-042: skills whose YAML `constraints` evaluate true for the user. */
156
+ skills: UserVisibleSkill[];
157
+ /**
158
+ * W3 (ADR-0102 §3 closure): contract sections the user can `update`. The
159
+ * dashboard derives admin **mutation** pages (Roles, Skills, Flows,
160
+ * Authorization/Policies, State-machines, Settings) and the admin-tier
161
+ * pages (Imports, API-keys) from this, replacing the retired `edit_*` /
162
+ * `manage_imports` / `manage_api_keys` capability codes.
163
+ */
164
+ admin_sections: ContractSectionName[];
165
+ }
166
+ export interface ToolCatalogResponse {
167
+ success: true;
168
+ catalog: UserToolCatalog;
169
+ }
170
+ export interface McpToolDefinition {
171
+ name: string;
172
+ title?: string;
173
+ description?: string;
174
+ inputSchema?: Record<string, unknown>;
175
+ }
176
+ export interface McpToolsResponse {
177
+ success: true;
178
+ tools: McpToolDefinition[];
179
+ }
180
+ export interface ToolCallRequest {
181
+ tool: string;
182
+ parameters: Record<string, unknown>;
183
+ }
184
+ export interface ToolCallResponse {
185
+ success: boolean;
186
+ result?: unknown;
187
+ }
188
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACzD,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAA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AAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC1C,2DAA2D;IAC3D,OAAO,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAClC,4EAA4E;IAC5E,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,yEAAyE;IACzE,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,4EAA4E;IAC5E,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B;;;;;;OAMG;IACH,cAAc,EAAE,mBAAmB,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,eAAe,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // ── Tools ────────────────────────────────────────────────────────────────
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CONTRACT_SECTION_NAMES = void 0;
5
+ /**
6
+ * W3 — mirror of `@zarel-ai/contract`'s `CONTRACT_SECTION_NAMES`. The closed set
7
+ * of contract sections; `UserToolCatalog.admin_sections` is a subset (the
8
+ * sections the user can `update`). The SDK is published standalone and cannot
9
+ * import the contract package, so this is a hand-maintained mirror — and it
10
+ * DRIFTED: it named two roots that no longer exist and none of the nine that a
11
+ * dissolution had created. The ADR-0136 QI-001 gate compared seven mirrors and
12
+ * did not compare this one, which is why nothing said so. It does now.
13
+ */
14
+ exports.CONTRACT_SECTION_NAMES = [
15
+ 'metadata', 'entities', 'roles', 'skills', 'actions', 'schemas',
16
+ 'capabilities', 'flows', 'constraints', 'events',
17
+ 'llm', 'embeddings', 'treatment',
18
+ 'channels', 'channels/credentials',
19
+ 'mcp_servers', 'quotas', 'timezone',
20
+ 'process_model', 'authorization',
21
+ ];
22
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":";AAAA,4EAA4E;;;AA4I5E;;;;;;;;GAQG;AACU,QAAA,sBAAsB,GAAG;IAClC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS;IAC/D,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ;IAChD,KAAK,EAAE,YAAY,EAAE,WAAW;IAChC,UAAU,EAAE,sBAAsB;IAClC,aAAa,EAAE,QAAQ,EAAE,UAAU;IACnC,eAAe,EAAE,eAAe;CAC1B,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Trace observability types (Spec-020 US1).
3
+ *
4
+ * Wire shapes mirror the runtime contract module's `Trace` / `TraceSummary`
5
+ * (see authoring/packages/contract/src/domain/types/trace.ts). Keeping the
6
+ * canonical-with-runtime surface here as plain interfaces avoids forcing
7
+ * SDK consumers to depend on the runtime contract package.
8
+ */
9
+ /**
10
+ * WHICH WINDOW a trace's timing fields were measured over.
11
+ *
12
+ * The listing and the single-trace read answer different questions about the same trace
13
+ * and used to answer them silently: a conversation answered in 6 s whose webhook retry
14
+ * settled at 40 s reported 6 s in the list and 40 s when opened. Both true; neither said
15
+ * so. Each surface now declares its own.
16
+ */
17
+ export type TraceDurationBasis = 'anchor_evidence' | 'all_evidence';
18
+ export type TraceOutcome = 'executed' | 'refused' | 'awaiting_human_decision' | 'failed';
19
+ export type TraceStage = 'topic_gate' | 'intent_scoring' | 'envelope' | 'gatekeeper' | 'preconditions' | 'hitl' | 'execution' | 'audit';
20
+ export interface TraceEventError {
21
+ readonly code: string;
22
+ readonly message: string;
23
+ }
24
+ export interface TraceEvent {
25
+ readonly type: string;
26
+ readonly timestamp: string;
27
+ readonly stage: TraceStage;
28
+ readonly data: Record<string, unknown>;
29
+ readonly error?: TraceEventError | null;
30
+ }
31
+ export interface TraceUserRef {
32
+ readonly user_name: string;
33
+ readonly roles: ReadonlyArray<string>;
34
+ }
35
+ export interface Trace {
36
+ readonly trace_id: string;
37
+ readonly tenant: string;
38
+ readonly session_key: string | null;
39
+ readonly parent_trace_id: string | null;
40
+ readonly spec_version: string;
41
+ readonly spec_hash: string;
42
+ readonly user: TraceUserRef | null;
43
+ readonly flow: string | null;
44
+ readonly started_at: string;
45
+ readonly completed_at: string | null;
46
+ readonly duration_ms: number | null;
47
+ /** Always `all_evidence`: this view lists every event, so its window covers them. */
48
+ readonly duration_basis: TraceDurationBasis;
49
+ readonly outcome: TraceOutcome;
50
+ readonly events: ReadonlyArray<TraceEvent>;
51
+ }
52
+ export interface TraceSummary {
53
+ readonly trace_id: string;
54
+ readonly started_at: string;
55
+ readonly completed_at: string | null;
56
+ readonly flow: string | null;
57
+ readonly user_name: string | null;
58
+ readonly duration_ms: number | null;
59
+ /** Always `anchor_evidence`: the anchoring evidence's span, so one late delivery
60
+ * cannot make a fast conversation look slow in a scanned page. */
61
+ readonly duration_basis: TraceDurationBasis;
62
+ readonly outcome: TraceOutcome;
63
+ }
64
+ export interface TraceListParams {
65
+ readonly flow?: string;
66
+ readonly user?: string;
67
+ readonly from?: string;
68
+ readonly to?: string;
69
+ readonly outcome?: TraceOutcome;
70
+ readonly limit?: number;
71
+ readonly cursor?: string;
72
+ }
73
+ export interface TraceListResponse {
74
+ readonly traces: ReadonlyArray<TraceSummary>;
75
+ readonly next_cursor: string | null;
76
+ }
77
+ //# sourceMappingURL=traces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traces.d.ts","sourceRoot":"","sources":["../../src/types/traces.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,cAAc,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,yBAAyB,GAAG,QAAQ,CAAC;AAEzF,MAAM,MAAM,UAAU,GAChB,YAAY,GACZ,gBAAgB,GAChB,UAAU,GACV,YAAY,GACZ,eAAe,GACf,MAAM,GACN,WAAW,GACX,OAAO,CAAC;AAEd,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,KAAK;IAClB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,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,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Trace observability types (Spec-020 US1).
4
+ *
5
+ * Wire shapes mirror the runtime contract module's `Trace` / `TraceSummary`
6
+ * (see authoring/packages/contract/src/domain/types/trace.ts). Keeping the
7
+ * canonical-with-runtime surface here as plain interfaces avoids forcing
8
+ * SDK consumers to depend on the runtime contract package.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ //# sourceMappingURL=traces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traces.js","sourceRoot":"","sources":["../../src/types/traces.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}
@@ -0,0 +1,42 @@
1
+ export interface WorkflowTransitionRule {
2
+ condition: string;
3
+ description: string;
4
+ }
5
+ export interface WorkflowTransitionConfig {
6
+ from: string;
7
+ to: string;
8
+ allowed_roles?: string[];
9
+ rules?: WorkflowTransitionRule[];
10
+ }
11
+ export interface WorkflowStateMachineConfig {
12
+ field: string;
13
+ initial: string;
14
+ transitions: WorkflowTransitionConfig[];
15
+ }
16
+ export interface WorkflowReplayRequest {
17
+ instance_id: string;
18
+ new_config: WorkflowStateMachineConfig;
19
+ }
20
+ export interface WorkflowReplayEventResult {
21
+ event_id: string;
22
+ from_state: string;
23
+ to_state: string;
24
+ original_passed: boolean;
25
+ replay_passed: boolean;
26
+ diverged: boolean;
27
+ reason?: string;
28
+ }
29
+ export interface WorkflowReplayResult {
30
+ instance_id: string;
31
+ total_events: number;
32
+ diverged_count: number;
33
+ events: WorkflowReplayEventResult[];
34
+ }
35
+ export interface WorkflowReplayEmptyResult {
36
+ message: string;
37
+ total_events: 0;
38
+ diverged_count: 0;
39
+ events: [];
40
+ }
41
+ export type WorkflowReplayResponse = WorkflowReplayResult | WorkflowReplayEmptyResult;
42
+ //# sourceMappingURL=workflows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/types/workflows.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,0BAA0B;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,wBAAwB,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,qBAAqB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,0BAA0B,CAAC;CAC1C;AAED,MAAM,WAAW,yBAAyB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,yBAAyB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,yBAAyB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,CAAC,CAAC;IAChB,cAAc,EAAE,CAAC,CAAC;IAClB,MAAM,EAAE,EAAE,CAAC;CACd;AAED,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,GAAG,yBAAyB,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // ── Workflows (service-endpoint only) ────────────────────────────────────
3
+ //
4
+ // `POST /workflows/replay` is a permanent Service endpoint per ADR-0077
5
+ // FR-4#3 (Q3 resolution). Types below describe its request/response shapes.
6
+ // All other types that used to live here moved in P12:
7
+ // - timeline/event types → ./state-machine.ts
8
+ // - transition-request types → ./state-machine.ts
9
+ // - flow instance/step types → ./flows.ts
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ //# sourceMappingURL=workflows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../src/types/workflows.ts"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,EAAE;AACF,wEAAwE;AACxE,4EAA4E;AAC5E,uDAAuD;AACvD,iDAAiD;AACjD,oDAAoD;AACpD,4CAA4C"}
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "@zarel-ai/sdk",
3
+ "version": "0.6.0",
4
+ "description": "TypeScript SDK for the Zarel API",
5
+ "license": "MIT",
6
+ "author": "Zarel AI",
7
+ "homepage": "https://zarel.ai",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Zarel-AI/platform.git",
11
+ "directory": "sdk/packages/sdk"
12
+ },
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js",
19
+ "require": "./dist/index.js"
20
+ },
21
+ "./client": {
22
+ "types": "./dist/client.d.ts",
23
+ "import": "./dist/client.js",
24
+ "require": "./dist/client.js"
25
+ },
26
+ "./errors": {
27
+ "types": "./dist/errors.d.ts",
28
+ "import": "./dist/errors.js",
29
+ "require": "./dist/errors.js"
30
+ },
31
+ "./types": {
32
+ "types": "./dist/types/index.d.ts",
33
+ "import": "./dist/types/index.js",
34
+ "require": "./dist/types/index.js"
35
+ },
36
+ "./resources": {
37
+ "types": "./dist/resources/index.d.ts",
38
+ "import": "./dist/resources/index.js",
39
+ "require": "./dist/resources/index.js"
40
+ },
41
+ "./resources/*": {
42
+ "types": "./dist/resources/*.d.ts",
43
+ "import": "./dist/resources/*.js",
44
+ "require": "./dist/resources/*.js"
45
+ }
46
+ },
47
+ "typesVersions": {
48
+ "*": {
49
+ "client": [
50
+ "dist/client.d.ts"
51
+ ],
52
+ "errors": [
53
+ "dist/errors.d.ts"
54
+ ],
55
+ "types": [
56
+ "dist/types/index.d.ts"
57
+ ],
58
+ "resources": [
59
+ "dist/resources/index.d.ts"
60
+ ],
61
+ "resources/*": [
62
+ "dist/resources/*.d.ts"
63
+ ]
64
+ }
65
+ },
66
+ "files": [
67
+ "dist",
68
+ "README.md",
69
+ "LICENSE"
70
+ ],
71
+ "engines": {
72
+ "node": ">=18.0.0"
73
+ },
74
+ "sideEffects": false,
75
+ "publishConfig": {
76
+ "access": "public"
77
+ },
78
+ "scripts": {
79
+ "prepack": "npm run build",
80
+ "build": "tsc",
81
+ "test": "jest",
82
+ "lint": "eslint src/ tests/",
83
+ "gen:sdk-types": "openapi-typescript ../../../docs/api/runtime-openapi-v1.yaml -o src/generated/runtime.ts && openapi-typescript ../../../docs/api/contract-openapi-v1.yaml -o src/generated/contract.ts",
84
+ "gen:sdk-unwrap-map": "tsx ../../../scripts/toolchain/gen-sdk-unwrap-map.ts src/generated/unwrap-map.ts",
85
+ "gen:sdk": "npm run gen:sdk-types && npm run gen:sdk-unwrap-map"
86
+ },
87
+ "devDependencies": {
88
+ "@types/jest": "^29.5.12",
89
+ "@types/node": "^20.11.0",
90
+ "jest": "^29.7.0",
91
+ "openapi-typescript": "7.13.0",
92
+ "ts-jest": "^29.1.2",
93
+ "tsx": "^4.7.0",
94
+ "typescript": "^5.3.3",
95
+ "yaml": "2.8.2"
96
+ },
97
+ "keywords": [
98
+ "zarel",
99
+ "zarel-ai",
100
+ "sdk",
101
+ "api-client"
102
+ ]
103
+ }