@ai-matrx/api 0.0.0-stage → 0.1.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 (146) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +21 -0
  3. package/README.md +18 -2
  4. package/dist/account.cjs +670 -0
  5. package/dist/account.d.cts +3246 -0
  6. package/dist/account.d.ts +3246 -0
  7. package/dist/account.js +558 -0
  8. package/dist/agents.cjs +598 -0
  9. package/dist/agents.d.cts +3417 -0
  10. package/dist/agents.d.ts +3417 -0
  11. package/dist/agents.js +497 -0
  12. package/dist/ai.cjs +109 -0
  13. package/dist/ai.d.cts +493 -0
  14. package/dist/ai.d.ts +493 -0
  15. package/dist/ai.js +91 -0
  16. package/dist/apps.cjs +394 -0
  17. package/dist/apps.d.cts +1094 -0
  18. package/dist/apps.d.ts +1094 -0
  19. package/dist/apps.js +328 -0
  20. package/dist/architecture.cjs +1223 -0
  21. package/dist/architecture.d.cts +4701 -0
  22. package/dist/architecture.d.ts +4701 -0
  23. package/dist/architecture.js +1016 -0
  24. package/dist/audio.cjs +226 -0
  25. package/dist/audio.d.cts +723 -0
  26. package/dist/audio.d.ts +723 -0
  27. package/dist/audio.js +188 -0
  28. package/dist/chat.cjs +538 -0
  29. package/dist/chat.d.cts +2251 -0
  30. package/dist/chat.d.ts +2251 -0
  31. package/dist/chat.js +447 -0
  32. package/dist/chunk-2SXAAKGV.cjs +279 -0
  33. package/dist/chunk-AY5N6EA4.js +43 -0
  34. package/dist/chunk-BMQI7UET.cjs +48 -0
  35. package/dist/chunk-FNIYADWI.cjs +59 -0
  36. package/dist/chunk-KIEAFMKB.js +264 -0
  37. package/dist/chunk-UONBYRE4.js +1012 -0
  38. package/dist/chunk-YTEOFGFC.js +57 -0
  39. package/dist/chunk-YUDQWDCM.cjs +1047 -0
  40. package/dist/code.cjs +561 -0
  41. package/dist/code.d.cts +1976 -0
  42. package/dist/code.d.ts +1976 -0
  43. package/dist/code.js +467 -0
  44. package/dist/commerce.cjs +22 -0
  45. package/dist/commerce.d.cts +45 -0
  46. package/dist/commerce.d.ts +45 -0
  47. package/dist/commerce.js +18 -0
  48. package/dist/communications.cjs +215 -0
  49. package/dist/communications.d.cts +948 -0
  50. package/dist/communications.d.ts +948 -0
  51. package/dist/communications.js +179 -0
  52. package/dist/computer.cjs +330 -0
  53. package/dist/computer.d.cts +733 -0
  54. package/dist/computer.d.ts +733 -0
  55. package/dist/computer.js +275 -0
  56. package/dist/content.cjs +425 -0
  57. package/dist/content.d.cts +1796 -0
  58. package/dist/content.d.ts +1796 -0
  59. package/dist/content.js +354 -0
  60. package/dist/credentials.cjs +22 -0
  61. package/dist/credentials.d.cts +82 -0
  62. package/dist/credentials.d.ts +82 -0
  63. package/dist/credentials.js +1 -0
  64. package/dist/crm.cjs +271 -0
  65. package/dist/crm.d.cts +1731 -0
  66. package/dist/crm.d.ts +1731 -0
  67. package/dist/crm.js +226 -0
  68. package/dist/data.cjs +382 -0
  69. package/dist/data.d.cts +1860 -0
  70. package/dist/data.d.ts +1860 -0
  71. package/dist/data.js +318 -0
  72. package/dist/education.cjs +28 -0
  73. package/dist/education.d.cts +73 -0
  74. package/dist/education.d.ts +73 -0
  75. package/dist/education.js +23 -0
  76. package/dist/files.cjs +1330 -0
  77. package/dist/files.d.cts +4956 -0
  78. package/dist/files.d.ts +4956 -0
  79. package/dist/files.js +1104 -0
  80. package/dist/human-resources.cjs +178 -0
  81. package/dist/human-resources.d.cts +1208 -0
  82. package/dist/human-resources.d.ts +1208 -0
  83. package/dist/human-resources.js +148 -0
  84. package/dist/index-C2E-Cp19.d.ts +385 -0
  85. package/dist/index-wC2vtb70.d.cts +385 -0
  86. package/dist/index.cjs +1934 -0
  87. package/dist/index.d.cts +2006 -0
  88. package/dist/index.d.ts +2006 -0
  89. package/dist/index.js +1668 -0
  90. package/dist/integrations.cjs +5116 -0
  91. package/dist/integrations.d.cts +19213 -0
  92. package/dist/integrations.d.ts +19213 -0
  93. package/dist/integrations.js +4263 -0
  94. package/dist/intelligence.cjs +1305 -0
  95. package/dist/intelligence.d.cts +4658 -0
  96. package/dist/intelligence.d.ts +4658 -0
  97. package/dist/intelligence.js +1196 -0
  98. package/dist/knowledge.cjs +1113 -0
  99. package/dist/knowledge.d.cts +5427 -0
  100. package/dist/knowledge.d.ts +5427 -0
  101. package/dist/knowledge.js +921 -0
  102. package/dist/legal.cjs +225 -0
  103. package/dist/legal.d.cts +1038 -0
  104. package/dist/legal.d.ts +1038 -0
  105. package/dist/legal.js +187 -0
  106. package/dist/marketing.cjs +1155 -0
  107. package/dist/marketing.d.cts +7741 -0
  108. package/dist/marketing.d.ts +7741 -0
  109. package/dist/marketing.js +951 -0
  110. package/dist/masterwork.cjs +283 -0
  111. package/dist/masterwork.d.cts +1938 -0
  112. package/dist/masterwork.d.ts +1938 -0
  113. package/dist/masterwork.js +231 -0
  114. package/dist/media.cjs +610 -0
  115. package/dist/media.d.cts +2270 -0
  116. package/dist/media.d.ts +2270 -0
  117. package/dist/media.js +507 -0
  118. package/dist/net.cjs +67 -0
  119. package/dist/net.d.cts +204 -0
  120. package/dist/net.d.ts +204 -0
  121. package/dist/net.js +2 -0
  122. package/dist/platform.cjs +150 -0
  123. package/dist/platform.d.cts +572 -0
  124. package/dist/platform.d.ts +572 -0
  125. package/dist/platform.js +125 -0
  126. package/dist/publish.cjs +248 -0
  127. package/dist/publish.d.cts +1431 -0
  128. package/dist/publish.d.ts +1431 -0
  129. package/dist/publish.js +206 -0
  130. package/dist/schemas.cjs +2 -0
  131. package/dist/schemas.d.cts +1353 -0
  132. package/dist/schemas.d.ts +1353 -0
  133. package/dist/schemas.js +1 -0
  134. package/dist/stream.cjs +44 -0
  135. package/dist/stream.d.cts +2 -0
  136. package/dist/stream.d.ts +2 -0
  137. package/dist/stream.js +3 -0
  138. package/dist/web.cjs +1045 -0
  139. package/dist/web.d.cts +4186 -0
  140. package/dist/web.d.ts +4186 -0
  141. package/dist/web.js +867 -0
  142. package/dist/workflows.cjs +825 -0
  143. package/dist/workflows.d.cts +4699 -0
  144. package/dist/workflows.d.ts +4699 -0
  145. package/dist/workflows.js +686 -0
  146. package/package.json +418 -4
@@ -0,0 +1,1938 @@
1
+ import { A as Api, C as CallOptions, a as ApiStream, N as NdjsonEvent } from './index-C2E-Cp19.js';
2
+ import { JsonValue } from './schemas.js';
3
+ import './credentials.js';
4
+
5
+ /**
6
+ * GENERATED by @ai-matrx/api scripts/generate.mjs from aidream/api-contract — never edit by hand.
7
+ * CONTRACT_SHA256 50a790edb39e682b46e0fa9e674faf5ce2a0ba7de2cd01930a497fca4c47844a
8
+ */
9
+
10
+ /** Judge a Masterwork against a reference. THREE modes, one endpoint. */
11
+ type AuditionCompareRequest = {
12
+ /** Organization context for the request; omitted to use the authenticated context. */
13
+ organization_id?: string | null;
14
+ /** Optional associated project selected by the caller. */
15
+ project_id?: string | null;
16
+ /** Optional associated task selected by the caller. */
17
+ task_id?: string | null;
18
+ /** Stable application slug that initiated the request. */
19
+ source_app?: string | null;
20
+ /** Stable feature slug within the source application. */
21
+ source_feature?: string | null;
22
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
23
+ initiation?: ("user" | "auto") | null;
24
+ rulebook_id: string;
25
+ /** reference: candidate vs pasted exemplar. unfolding: sealed-case benchmark. elicitation: sealed-counterparty first-move benchmark. */
26
+ mode?: "reference" | "unfolding" | "elicitation";
27
+ /** reference mode: our Masterwork's output for the shared inputs. */
28
+ candidate_text?: string | null;
29
+ /** reference mode: the real published work for the same inputs. */
30
+ reference_text?: string | null;
31
+ /** unfolding mode: the one or two desks to audition. */
32
+ masterwork_ids?: string[];
33
+ /** unfolding mode: the sealed held-out `platform.masterwork_corpus_item` rows to run against. Their content is read server-side only. */
34
+ case_item_ids?: string[];
35
+ /** elicitation mode: the sealed `platform.masterwork_corpus_item` counterparty profiles to talk to. Their facts are read server-side only. */
36
+ profile_item_ids?: string[];
37
+ /** What the shared inputs were ('the Aug 14 newswire'). */
38
+ context_note?: string | null;
39
+ /** Land reference-only strengths as draft rules on the rulebook. */
40
+ capture_gaps?: boolean;
41
+ /** Three-way harness: also run a RAW vanilla model (same tier as the Masterwork's primary agent, no Rulebook) on vanilla_input and judge it against the same reference. A paid call — opt-in. */
42
+ compare_vanilla?: boolean;
43
+ /** compare_vanilla only: the SAME input the Masterwork was given (the text to edit, or the job brief), so the vanilla arm is a fair fight. */
44
+ vanilla_input?: string | null;
45
+ };
46
+ /** Judge one Masterwork run over a SEALED CASE by the held-out later fact. */
47
+ type AuditionOutcomeRequest = {
48
+ /** Organization context for the request; omitted to use the authenticated context. */
49
+ organization_id?: string | null;
50
+ /** Optional associated project selected by the caller. */
51
+ project_id?: string | null;
52
+ /** Optional associated task selected by the caller. */
53
+ task_id?: string | null;
54
+ /** Stable application slug that initiated the request. */
55
+ source_app?: string | null;
56
+ /** Stable feature slug within the source application. */
57
+ source_feature?: string | null;
58
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
59
+ initiation?: ("user" | "auto") | null;
60
+ rulebook_id: string;
61
+ /** platform.masterwork_corpus_item id (sealed_case) */
62
+ case_id: string;
63
+ /** The run whose disclosure ledger is judged, e.g. 'workflow_run:<id>'. */
64
+ run_scope: string;
65
+ /** Also hand the WHOLE case (resolution stripped) to the same model tier in one call, with nothing to ask, and judge it the same way. A paid call. */
66
+ compare_vanilla?: boolean;
67
+ /** The built Masterwork this run came from, when the caller knows it. */
68
+ masterwork_id?: string | null;
69
+ };
70
+ /** One finished Bench trial, as a screen shows it. Every field is copied */
71
+ type BenchProof = {
72
+ record_id: string;
73
+ trial_id: string;
74
+ subject?: string;
75
+ domain?: string;
76
+ finished_at?: string;
77
+ passed?: boolean;
78
+ void?: boolean;
79
+ void_reason?: string;
80
+ win_claimed?: string | null;
81
+ win_rationale?: string;
82
+ arm?: string;
83
+ budget_multiple?: number | null;
84
+ panel_winner?: string | null;
85
+ gt_in_pool?: boolean;
86
+ gt_won?: boolean;
87
+ panel_votes?: number;
88
+ c_cost_usd?: number | null;
89
+ c_seconds?: number | null;
90
+ spec_sha256?: string | null;
91
+ corpus_sha256?: string | null;
92
+ record_path?: string | null;
93
+ report_path?: string | null;
94
+ source?: string;
95
+ /** The one sentence a screen leads with — never a win without a record. */
96
+ headline: string;
97
+ };
98
+ /** What the run page asks for: the proof, whether one can be STARTED here, */
99
+ type BenchProofResponse = {
100
+ rulebook_id: string;
101
+ proof?: BenchProof | null;
102
+ reason?: string | null;
103
+ can_run_here?: boolean;
104
+ how_to_run?: string;
105
+ form?: BenchRunForm | null;
106
+ running?: BenchRunning | null;
107
+ searched?: string[];
108
+ };
109
+ /** What the screen needs to show a form that does not lie. */
110
+ type BenchRunForm = {
111
+ budget_multiple: number;
112
+ budget_multiple_source: string;
113
+ judge_model: string;
114
+ frontier_model: string;
115
+ cheap_model: string;
116
+ judge_model_name: string | null;
117
+ frontier_model_name: string | null;
118
+ cheap_model_name: string | null;
119
+ typical_run_cost_usd: number | null;
120
+ estimated_cost_usd: number | null;
121
+ estimated_cost_note: string;
122
+ masterwork_id: string;
123
+ masterwork_name: string;
124
+ corpus_sources: number | null;
125
+ corpus_note: string;
126
+ durable: boolean;
127
+ durable_note: string;
128
+ };
129
+ /** What the person typed, and nothing else. */
130
+ type BenchRunRequest = {
131
+ /** Organization context for the request; omitted to use the authenticated context. */
132
+ organization_id?: string | null;
133
+ /** Optional associated project selected by the caller. */
134
+ project_id?: string | null;
135
+ /** Optional associated task selected by the caller. */
136
+ task_id?: string | null;
137
+ /** Stable application slug that initiated the request. */
138
+ source_app?: string | null;
139
+ /** Stable feature slug within the source application. */
140
+ source_feature?: string | null;
141
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
142
+ initiation?: ("user" | "auto") | null;
143
+ rulebook_id?: string;
144
+ task_prompt: string;
145
+ case_input?: string;
146
+ ground_truth_text?: string;
147
+ budget_multiple?: number | null;
148
+ masterwork_id?: string | null;
149
+ };
150
+ /** A trial that is IN FLIGHT right now — not a proof, and never shown as one. */
151
+ type BenchRunning = {
152
+ run_id: string;
153
+ started_at?: string;
154
+ label?: string;
155
+ elapsed_minutes?: number;
156
+ remaining_minutes?: number | null;
157
+ headline?: string;
158
+ };
159
+ /** Build one Rulebook into a working Masterwork (agents + workflow). */
160
+ type BuildMasterworkRequest = {
161
+ /** Organization context for the request; omitted to use the authenticated context. */
162
+ organization_id?: string | null;
163
+ /** Optional associated project selected by the caller. */
164
+ project_id?: string | null;
165
+ /** Optional associated task selected by the caller. */
166
+ task_id?: string | null;
167
+ /** Stable application slug that initiated the request. */
168
+ source_app?: string | null;
169
+ /** Stable feature slug within the source application. */
170
+ source_feature?: string | null;
171
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
172
+ initiation?: ("user" | "auto") | null;
173
+ /** platform.rulebook id */
174
+ rulebook_id: string;
175
+ /** edit: audit + correct + persona ruling on a submitted text. generate: draft N variants, audit each, persona verdict. */
176
+ masterwork_kind: "edit" | "generate";
177
+ /** Masterwork name; defaults to '<Rulebook name> Masterwork'. */
178
+ name?: string | null;
179
+ /** generate Masterworks only: what the Masterwork produces (e.g. 'advertising copy', 'a keyword research plan'). Defaults from the rulebook. */
180
+ deliverable?: string | null;
181
+ variant_count?: number;
182
+ /** Optional. The facts that must be known before this Masterwork produces. Absent = it always produces (today's behaviour). */
183
+ refuse_until?: RefuseUntil | null;
184
+ };
185
+ /** Why it was stopped. Optional — the person clicking Stop owes nobody an */
186
+ type CancelRunRequest = {
187
+ reason?: string | null;
188
+ };
189
+ /** The plan page's whole ask of the server. */
190
+ type CapturePlanReminderEndpointRequest = {
191
+ /** Organization context for the request; omitted to use the authenticated context. */
192
+ organization_id?: string | null;
193
+ /** Optional associated project selected by the caller. */
194
+ project_id?: string | null;
195
+ /** Optional associated task selected by the caller. */
196
+ task_id?: string | null;
197
+ /** Stable application slug that initiated the request. */
198
+ source_app?: string | null;
199
+ /** Stable feature slug within the source application. */
200
+ source_feature?: string | null;
201
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
202
+ initiation?: ("user" | "auto") | null;
203
+ rulebook_id: string;
204
+ plan_id: string;
205
+ rulebook_name: string;
206
+ sessions?: CapturePlanSessionInput[];
207
+ channel?: string;
208
+ lead_minutes?: number;
209
+ };
210
+ /** CapturePlanReminderResponse */
211
+ type CapturePlanReminderResponse = {
212
+ queued: number;
213
+ superseded: number;
214
+ problem?: string | null;
215
+ };
216
+ /** One scheduled session, as the plan page holds it. */
217
+ type CapturePlanSessionInput = {
218
+ session_id: string;
219
+ method: string;
220
+ ask: string;
221
+ minutes: number;
222
+ due_at: string;
223
+ };
224
+ /** ChatConversationPreview */
225
+ type ChatConversationPreview = {
226
+ key: string;
227
+ title: string;
228
+ provider: string;
229
+ turns: number;
230
+ user_words: number;
231
+ total_words: number;
232
+ started_at?: string | null;
233
+ updated_at?: string | null;
234
+ };
235
+ /** Parse a chat export and list its conversations — no AI, no writes. */
236
+ type ChatImportPreviewRequest = {
237
+ /** cld_files id of an uploaded chat export (zip/json/jsonl/txt/md). */
238
+ file_id?: string | null;
239
+ /** A pasted conversation (the universal 'paste anything' door). */
240
+ text?: string | null;
241
+ /** Organization context for the request; omitted to use the authenticated context. */
242
+ organization_id?: string | null;
243
+ /** Optional associated project selected by the caller. */
244
+ project_id?: string | null;
245
+ /** Optional associated task selected by the caller. */
246
+ task_id?: string | null;
247
+ /** Stable application slug that initiated the request. */
248
+ source_app?: string | null;
249
+ /** Stable feature slug within the source application. */
250
+ source_feature?: string | null;
251
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
252
+ initiation?: ("user" | "auto") | null;
253
+ };
254
+ /** ChatImportPreviewResponse */
255
+ type ChatImportPreviewResponse = {
256
+ conversations: ChatConversationPreview[];
257
+ providers: string[];
258
+ skipped_files?: number;
259
+ notes?: string[];
260
+ };
261
+ /** Ask the shortlister Mandate which conversations look worth distilling. */
262
+ type ChatShortlistRequest = {
263
+ /** cld_files id of an uploaded chat export (zip/json/jsonl/txt/md). */
264
+ file_id?: string | null;
265
+ /** A pasted conversation (the universal 'paste anything' door). */
266
+ text?: string | null;
267
+ /** Organization context for the request; omitted to use the authenticated context. */
268
+ organization_id?: string | null;
269
+ /** Optional associated project selected by the caller. */
270
+ project_id?: string | null;
271
+ /** Optional associated task selected by the caller. */
272
+ task_id?: string | null;
273
+ /** Stable application slug that initiated the request. */
274
+ source_app?: string | null;
275
+ /** Stable feature slug within the source application. */
276
+ source_feature?: string | null;
277
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
278
+ initiation?: ("user" | "auto") | null;
279
+ /** What the Rulebook is about, in the Expert's words. */
280
+ topic?: string | null;
281
+ };
282
+ /** The Final Checkup — run every registered producer over the Rulebook and */
283
+ type CheckupRequest = {
284
+ /** Organization context for the request; omitted to use the authenticated context. */
285
+ organization_id?: string | null;
286
+ /** Optional associated project selected by the caller. */
287
+ project_id?: string | null;
288
+ /** Optional associated task selected by the caller. */
289
+ task_id?: string | null;
290
+ /** Stable application slug that initiated the request. */
291
+ source_app?: string | null;
292
+ /** Stable feature slug within the source application. */
293
+ source_feature?: string | null;
294
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
295
+ initiation?: ("user" | "auto") | null;
296
+ rulebook_id: string;
297
+ /** Producer keys to run. None = every registered producer. */
298
+ producers?: string[] | null;
299
+ /** Prefer the saved cleaned corpus over the raw one when it exists. */
300
+ use_cleaned?: boolean;
301
+ /** Drop findings below this certainty before they reach the Expert. */
302
+ min_confidence?: number;
303
+ };
304
+ /** Clean everything the Expert ever said about this Rulebook, and SAVE it. */
305
+ type CleanCorpusRequest = {
306
+ /** Organization context for the request; omitted to use the authenticated context. */
307
+ organization_id?: string | null;
308
+ /** Optional associated project selected by the caller. */
309
+ project_id?: string | null;
310
+ /** Optional associated task selected by the caller. */
311
+ task_id?: string | null;
312
+ /** Stable application slug that initiated the request. */
313
+ source_app?: string | null;
314
+ /** Stable feature slug within the source application. */
315
+ source_feature?: string | null;
316
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
317
+ initiation?: ("user" | "auto") | null;
318
+ rulebook_id: string;
319
+ /** Re-clean every segment even when a cached clean of the same raw text exists. */
320
+ force?: boolean;
321
+ };
322
+ /** Something the corpus does NOT contain, said out loud. */
323
+ type CorpusLimitOut = {
324
+ lane: string;
325
+ reason: string;
326
+ count: number;
327
+ recoverable: boolean;
328
+ };
329
+ /** One thing the Expert contributed, with every door that exists for it. */
330
+ type CorpusSegmentOut = {
331
+ label: string;
332
+ segment_id: string;
333
+ source_key?: string;
334
+ lane: string;
335
+ lane_label: string;
336
+ kind: string;
337
+ text: string;
338
+ chars: number;
339
+ expert_chars?: number;
340
+ turns?: CorpusTurnOut[];
341
+ title?: string | null;
342
+ when?: string | null;
343
+ truncated?: boolean;
344
+ cleaned?: boolean;
345
+ conversation_id?: string | null;
346
+ message_id?: string | null;
347
+ file_id?: string | null;
348
+ url?: string | null;
349
+ entity_token?: string | null;
350
+ entity_id?: string | null;
351
+ corpus_item_id?: string | null;
352
+ };
353
+ /** One turn of a contributed conversation, already classified for a reader. */
354
+ type CorpusTurnOut = {
355
+ voice: string;
356
+ text: string;
357
+ speaker?: string | null;
358
+ };
359
+ /** Seal one case onto a Rulebook. */
360
+ type CreateSealedCaseRequest = {
361
+ /** Organization context for the request; omitted to use the authenticated context. */
362
+ organization_id?: string | null;
363
+ /** Optional associated project selected by the caller. */
364
+ project_id?: string | null;
365
+ /** Optional associated task selected by the caller. */
366
+ task_id?: string | null;
367
+ /** Stable application slug that initiated the request. */
368
+ source_app?: string | null;
369
+ /** Stable feature slug within the source application. */
370
+ source_feature?: string | null;
371
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
372
+ initiation?: ("user" | "auto") | null;
373
+ rulebook_id: string;
374
+ title: string;
375
+ /** The FULL case, ending included. */
376
+ case_text: string;
377
+ /** The final answer, VERBATIM — what a run is graded against. */
378
+ resolution: string;
379
+ /** A phrase that appears exactly where the answer begins. Everything from it onward is removed before the case is ever asked anything. */
380
+ resolution_marker: string;
381
+ url?: string | null;
382
+ published_at?: string | null;
383
+ license?: string | null;
384
+ };
385
+ /** CreateSessionRequest */
386
+ type CreateSessionRequest = {
387
+ /** Organization context for the request; omitted to use the authenticated context. */
388
+ organization_id?: string | null;
389
+ /** Optional associated project selected by the caller. */
390
+ project_id?: string | null;
391
+ /** Optional associated task selected by the caller. */
392
+ task_id?: string | null;
393
+ /** Stable application slug that initiated the request. */
394
+ source_app?: string | null;
395
+ /** Stable feature slug within the source application. */
396
+ source_feature?: string | null;
397
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
398
+ initiation?: ("user" | "auto") | null;
399
+ title?: string;
400
+ /** The human's opening statement of the vision — becomes turn 0. */
401
+ vision_statement: string;
402
+ settings?: {
403
+ [key: string]: JsonValue;
404
+ };
405
+ };
406
+ /** What one pass did. Every field is reported, including the boring ones, so */
407
+ type DripSendReport = {
408
+ scanned?: number;
409
+ hit_scan_cap?: boolean;
410
+ subscribed?: number;
411
+ active?: number;
412
+ not_yet_their_hour?: number;
413
+ already_asked_today?: number;
414
+ asked?: number;
415
+ adapted?: number;
416
+ fell_back_to_base_question?: number;
417
+ paused_for_silence?: number;
418
+ owner_left_organization?: number;
419
+ errors?: number;
420
+ };
421
+ /** One resource inside a dump ingest — a platform entity (token + id), a */
422
+ type DumpResource = {
423
+ kind: "entity" | "url" | "kept_source";
424
+ /** platform.entity_types token (kind='entity' only). */
425
+ token?: string | null;
426
+ /** The entity row id (kind='entity' only). */
427
+ id?: string | null;
428
+ /** Public page URL (kind='url' only). */
429
+ url?: string | null;
430
+ /** platform.masterwork_source.source_key (kind='kept_source' only). It is also the rule identity, so a kept source distilled here and the same source distilled by its own lane are ONE source. */
431
+ source_key?: string | null;
432
+ /** Optional display label the client already knows. */
433
+ title?: string | null;
434
+ };
435
+ /** ExpertCorpusResponse */
436
+ type ExpertCorpusResponse = {
437
+ rulebook_id: string;
438
+ segments?: CorpusSegmentOut[];
439
+ interviews?: RulebookInterviewOut[];
440
+ limits?: CorpusLimitOut[];
441
+ lane_counts?: {
442
+ [key: string]: number;
443
+ };
444
+ total_chars?: number;
445
+ expert_chars?: number;
446
+ hidden_conversation_count?: number;
447
+ can_read_material?: boolean;
448
+ };
449
+ /** Is the connected door open? A `False` here means the surface renders no */
450
+ type InboxConnectionResponse = {
451
+ connected?: boolean;
452
+ provider?: string | null;
453
+ account_email?: string | null;
454
+ connection_id?: string | null;
455
+ days_back_default?: number | null;
456
+ how_to_connect?: string | null;
457
+ };
458
+ /** Parse a mail export and list its threads — no AI, no writes. */
459
+ type InboxPreviewRequest = {
460
+ /** cld_files id of an uploaded mail export (.eml / .mbox / .txt / .zip). */
461
+ file_id?: string | null;
462
+ /** A pasted email thread — your reply plus what you were answering. */
463
+ text?: string | null;
464
+ /** users.integration_connections id of a connected mailbox that granted read access. Only usable when GET /masterworks/inbox/connection says so. */
465
+ connection_id?: string | null;
466
+ /** WHICH address is the Expert's. Defaults to the signed-in account's email; never guessed from a display name. */
467
+ expert_email?: string | null;
468
+ /** Read only threads this person actually replied in (knob `masterwork.shadow_inbox.own_replies_only`, default on). None = the organization's standing answer. */
469
+ own_replies_only?: boolean | null;
470
+ /** Which voices in these threads are the Expert (from /masterworks/inbox/preview). Used when no address in the thread matches — a mail client's copy labels the person's own message 'me', which is a voice */
471
+ voice_keys?: string[] | null;
472
+ /** Organization context for the request; omitted to use the authenticated context. */
473
+ organization_id?: string | null;
474
+ /** Optional associated project selected by the caller. */
475
+ project_id?: string | null;
476
+ /** Optional associated task selected by the caller. */
477
+ task_id?: string | null;
478
+ /** Stable application slug that initiated the request. */
479
+ source_app?: string | null;
480
+ /** Stable feature slug within the source application. */
481
+ source_feature?: string | null;
482
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
483
+ initiation?: ("user" | "auto") | null;
484
+ /** The Rulebook this preview is for. Send it and the knobs answer at that Rulebook's rung, exactly as the ingest run reads them. */
485
+ rulebook_id?: string | null;
486
+ };
487
+ /** InboxPreviewResponse */
488
+ type InboxPreviewResponse = {
489
+ threads?: InboxThreadPreview[];
490
+ expert_email?: string;
491
+ skipped_files?: number;
492
+ notes?: string[];
493
+ own_replies_only?: boolean;
494
+ };
495
+ /** InboxThreadPreview */
496
+ type InboxThreadPreview = {
497
+ key: string;
498
+ subject: string;
499
+ participants?: string[];
500
+ messages?: number;
501
+ last_at?: string | null;
502
+ snippet?: string;
503
+ you_replied?: boolean;
504
+ has_given_draft?: boolean;
505
+ nothing_to_shadow?: string | null;
506
+ your_words?: number;
507
+ voices?: InboxVoicePreview[];
508
+ needs_voice_pick?: boolean;
509
+ };
510
+ /** One voice in a thread, so the Expert can say which one is them. */
511
+ type InboxVoicePreview = {
512
+ key: string;
513
+ name: string;
514
+ address?: string;
515
+ messages?: number;
516
+ words?: number;
517
+ is_you?: boolean;
518
+ };
519
+ /** Distill selected conversations from a chat export into DRAFT rules. */
520
+ type IngestChatRequest = {
521
+ /** cld_files id of an uploaded chat export (zip/json/jsonl/txt/md). */
522
+ file_id?: string | null;
523
+ /** A pasted conversation (the universal 'paste anything' door). */
524
+ text?: string | null;
525
+ /** Organization context for the request; omitted to use the authenticated context. */
526
+ organization_id?: string | null;
527
+ /** Optional associated project selected by the caller. */
528
+ project_id?: string | null;
529
+ /** Optional associated task selected by the caller. */
530
+ task_id?: string | null;
531
+ /** Stable application slug that initiated the request. */
532
+ source_app?: string | null;
533
+ /** Stable feature slug within the source application. */
534
+ source_feature?: string | null;
535
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
536
+ initiation?: ("user" | "auto") | null;
537
+ rulebook_id: string;
538
+ /** Parsed conversation keys to distill (from the preview). None = all. */
539
+ conversation_keys?: string[] | null;
540
+ /** Where this came from ('my ChatGPT export, Aug 2026'). */
541
+ source_note?: string | null;
542
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
543
+ redistill?: "refuse" | "replace";
544
+ };
545
+ /** Distill the Expert's own AI MATRX conversations — the zero-upload lane. */
546
+ type IngestConversationsRequest = {
547
+ /** Organization context for the request; omitted to use the authenticated context. */
548
+ organization_id?: string | null;
549
+ /** Optional associated project selected by the caller. */
550
+ project_id?: string | null;
551
+ /** Optional associated task selected by the caller. */
552
+ task_id?: string | null;
553
+ /** Stable application slug that initiated the request. */
554
+ source_app?: string | null;
555
+ /** Stable feature slug within the source application. */
556
+ source_feature?: string | null;
557
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
558
+ initiation?: ("user" | "auto") | null;
559
+ rulebook_id: string;
560
+ /** chat.conversation ids owned by the caller. */
561
+ conversation_ids: string[];
562
+ /** Optional label ('my AI Matrx SEO chats'). */
563
+ source_note?: string | null;
564
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
565
+ redistill?: "refuse" | "replace";
566
+ };
567
+ /** Distill an Expert's whole BODY OF PUBLISHED WORK into draft rules. */
568
+ type IngestCorpusRequest = {
569
+ /** Organization context for the request; omitted to use the authenticated context. */
570
+ organization_id?: string | null;
571
+ /** Optional associated project selected by the caller. */
572
+ project_id?: string | null;
573
+ /** Optional associated task selected by the caller. */
574
+ task_id?: string | null;
575
+ /** Stable application slug that initiated the request. */
576
+ source_app?: string | null;
577
+ /** Stable feature slug within the source application. */
578
+ source_feature?: string | null;
579
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
580
+ initiation?: ("user" | "auto") | null;
581
+ rulebook_id: string;
582
+ /** Links to the Expert's published pieces, as pasted. */
583
+ urls?: string[];
584
+ /** cld_files ids uploaded through the canonical file handler. */
585
+ file_ids?: string[];
586
+ /** exemplar (default — published work IS the finished work) or instructional when the corpus teaches. */
587
+ mode?: "instructional" | "exemplar";
588
+ /** Where this body of work is from ('my blog, 2019-2026'). */
589
+ source_note?: string | null;
590
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
591
+ redistill?: "refuse" | "replace";
592
+ };
593
+ /** Distil a run of the Expert's own daily answers into rules. */
594
+ type IngestDripAnswersRequest = {
595
+ /** Organization context for the request; omitted to use the authenticated context. */
596
+ organization_id?: string | null;
597
+ /** Optional associated project selected by the caller. */
598
+ project_id?: string | null;
599
+ /** Optional associated task selected by the caller. */
600
+ task_id?: string | null;
601
+ /** Stable application slug that initiated the request. */
602
+ source_app?: string | null;
603
+ /** Stable feature slug within the source application. */
604
+ source_feature?: string | null;
605
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
606
+ initiation?: ("user" | "auto") | null;
607
+ rulebook_id: string;
608
+ /** Which days to read, as YYYY-MM-DD. Omitted (the normal case) means every ANSWERED day no run has read yet — a run never re-reads a morning it already distilled. */
609
+ days?: string[] | null;
610
+ /** What this run of days is about ('my first month on the new line'). */
611
+ source_note?: string | null;
612
+ /** Registered Distillation Approach key (platform.approach) stamped on every rule's source_ref.approach. Defaults to 'daily_drip'. */
613
+ approach?: string | null;
614
+ /** Extra provenance keys merged into every rule's source_ref. Never overrides the lane's own keys. */
615
+ source_ref_extra?: {
616
+ [key: string]: JsonValue;
617
+ } | null;
618
+ };
619
+ /** Distill a RESOURCE DUMP — 'here is everything, figure it out' — into */
620
+ type IngestDumpRequest = {
621
+ /** Organization context for the request; omitted to use the authenticated context. */
622
+ organization_id?: string | null;
623
+ /** Optional associated project selected by the caller. */
624
+ project_id?: string | null;
625
+ /** Optional associated task selected by the caller. */
626
+ task_id?: string | null;
627
+ /** Stable application slug that initiated the request. */
628
+ source_app?: string | null;
629
+ /** Stable feature slug within the source application. */
630
+ source_feature?: string | null;
631
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
632
+ initiation?: ("user" | "auto") | null;
633
+ rulebook_id: string;
634
+ /** The dumped resources, in the order the user gave them. */
635
+ resources: DumpResource[];
636
+ /** instructional = the sources teach; exemplar = the sources ARE examples of great finished work. */
637
+ mode?: "instructional" | "exemplar";
638
+ /** Where this dump came from ('everything about my SEO method'). */
639
+ source_note?: string | null;
640
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
641
+ redistill?: "refuse" | "replace";
642
+ /** Read ONE part of the resource again — the 1-based `source_ref.section_index` a Sources panel shows beside a chapter that produced few rules. Only meaningful with exactly one resource and redistill='re */
643
+ only_section?: number | null;
644
+ };
645
+ /** Distill an UPLOADED FILE into DRAFT rules on an existing rulebook. */
646
+ type IngestFileRequest = {
647
+ /** Organization context for the request; omitted to use the authenticated context. */
648
+ organization_id?: string | null;
649
+ /** Optional associated project selected by the caller. */
650
+ project_id?: string | null;
651
+ /** Optional associated task selected by the caller. */
652
+ task_id?: string | null;
653
+ /** Stable application slug that initiated the request. */
654
+ source_app?: string | null;
655
+ /** Stable feature slug within the source application. */
656
+ source_feature?: string | null;
657
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
658
+ initiation?: ("user" | "auto") | null;
659
+ rulebook_id: string;
660
+ /** cld_files id from the canonical file handler upload. */
661
+ file_id: string;
662
+ /** instructional = the source teaches; exemplar = the source IS examples of great finished work. */
663
+ mode?: "instructional" | "exemplar";
664
+ /** Where this came from ('Chapter 3', 'the 2024 handbook'). */
665
+ source_note?: string | null;
666
+ /** Pages handed to the distiller per extraction chunk (documents only). */
667
+ pages_per_chunk?: number;
668
+ /** Registered Distillation Approach key stamped on every rule's source_ref.approach. Defaults to this lane's own stamps ('file', or 'monologue' for a recording); the corpus lane passes 'body_of_work'. */
669
+ approach?: string | null;
670
+ /** Extra provenance keys merged into every rule's source_ref — how a delegating lane anchors rules to the piece they came from. Never overrides the lane's own keys. */
671
+ source_ref_extra?: {
672
+ [key: string]: JsonValue;
673
+ } | null;
674
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
675
+ redistill?: "refuse" | "replace";
676
+ };
677
+ /** Distill the difference between the Expert's real replies and the reply a */
678
+ type IngestInboxRequest = {
679
+ /** cld_files id of an uploaded mail export (.eml / .mbox / .txt / .zip). */
680
+ file_id?: string | null;
681
+ /** A pasted email thread — your reply plus what you were answering. */
682
+ text?: string | null;
683
+ /** users.integration_connections id of a connected mailbox that granted read access. Only usable when GET /masterworks/inbox/connection says so. */
684
+ connection_id?: string | null;
685
+ /** WHICH address is the Expert's. Defaults to the signed-in account's email; never guessed from a display name. */
686
+ expert_email?: string | null;
687
+ /** Read only threads this person actually replied in (knob `masterwork.shadow_inbox.own_replies_only`, default on). None = the organization's standing answer. */
688
+ own_replies_only?: boolean | null;
689
+ /** Which voices in these threads are the Expert (from /masterworks/inbox/preview). Used when no address in the thread matches — a mail client's copy labels the person's own message 'me', which is a voice */
690
+ voice_keys?: string[] | null;
691
+ /** Organization context for the request; omitted to use the authenticated context. */
692
+ organization_id?: string | null;
693
+ /** Optional associated project selected by the caller. */
694
+ project_id?: string | null;
695
+ /** Optional associated task selected by the caller. */
696
+ task_id?: string | null;
697
+ /** Stable application slug that initiated the request. */
698
+ source_app?: string | null;
699
+ /** Stable feature slug within the source application. */
700
+ source_feature?: string | null;
701
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
702
+ initiation?: ("user" | "auto") | null;
703
+ rulebook_id: string;
704
+ /** Thread keys to shadow (from the preview). None = every thread found. */
705
+ thread_keys?: string[] | null;
706
+ /** Connected door only: how far back to look for threads you replied to (knob `masterwork.shadow_inbox.days_back`, default 30). */
707
+ days_back?: number | null;
708
+ /** Where this came from ('the Northline quote thread, Sept 2026'). */
709
+ source_note?: string | null;
710
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
711
+ redistill?: "refuse" | "replace";
712
+ };
713
+ /** THE RED-PEN LANE: a piece of someone else's work plus the Expert's */
714
+ type IngestMarkupRequest = {
715
+ /** Organization context for the request; omitted to use the authenticated context. */
716
+ organization_id?: string | null;
717
+ /** Optional associated project selected by the caller. */
718
+ project_id?: string | null;
719
+ /** Optional associated task selected by the caller. */
720
+ task_id?: string | null;
721
+ /** Stable application slug that initiated the request. */
722
+ source_app?: string | null;
723
+ /** Stable feature slug within the source application. */
724
+ source_feature?: string | null;
725
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
726
+ initiation?: ("user" | "auto") | null;
727
+ rulebook_id: string;
728
+ /** The piece of work being reviewed, verbatim. */
729
+ work_text: string;
730
+ /** The Expert's corrections, in the order they made them. The FLOOR is the `min_corrections_before_distilling` knob, enforced server-side; this bound only refuses an empty list. */
731
+ corrections: WorkCorrection[];
732
+ /** What the work is ('Dan's draft launch email', 'the Q3 proposal'). */
733
+ source_note?: string | null;
734
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
735
+ redistill?: "refuse" | "replace";
736
+ };
737
+ /** Scavenge meetings for the Expert's own judgment moments. */
738
+ type IngestMeetingRequest = {
739
+ /** communication.meet_meetings ids the caller may read. */
740
+ meeting_ids?: string[] | null;
741
+ /** files.files id of an uploaded transcript or recording. */
742
+ file_id?: string | null;
743
+ /** A pasted meeting transcript. */
744
+ text?: string | null;
745
+ /** Organization context for the request; omitted to use the authenticated context. */
746
+ organization_id?: string | null;
747
+ /** Optional associated project selected by the caller. */
748
+ project_id?: string | null;
749
+ /** Optional associated task selected by the caller. */
750
+ task_id?: string | null;
751
+ /** Stable application slug that initiated the request. */
752
+ source_app?: string | null;
753
+ /** Stable feature slug within the source application. */
754
+ source_feature?: string | null;
755
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
756
+ initiation?: ("user" | "auto") | null;
757
+ rulebook_id: string;
758
+ /** Which voices are the Expert (from /masterworks/meeting/preview). Required when own_turns_only resolves true and the source cannot prove which speaker the caller is. */
759
+ speaker_keys?: string[] | null;
760
+ /** Scavenge only the Expert's own turns (the default), or every speaker in the room. None = this organization's knob value. */
761
+ own_turns_only?: boolean | null;
762
+ /** The shortest continuous turn read as a judgment moment. None = this organization's knob value. */
763
+ min_moment_words?: number | null;
764
+ /** Optional label ('the Tuesday supplier reviews'). */
765
+ source_note?: string | null;
766
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
767
+ redistill?: "refuse" | "replace";
768
+ };
769
+ /** Distil the Expert's own SCORED predictions into rules and boundaries. */
770
+ type IngestPredictionsRequest = {
771
+ /** Organization context for the request; omitted to use the authenticated context. */
772
+ organization_id?: string | null;
773
+ /** Optional associated project selected by the caller. */
774
+ project_id?: string | null;
775
+ /** Optional associated task selected by the caller. */
776
+ task_id?: string | null;
777
+ /** Stable application slug that initiated the request. */
778
+ source_app?: string | null;
779
+ /** Stable feature slug within the source application. */
780
+ source_feature?: string | null;
781
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
782
+ initiation?: ("user" | "auto") | null;
783
+ rulebook_id: string;
784
+ /** Which ledger entries to read. Omitted (the normal case) means every RESOLVED entry no run has read yet — a run never re-reads a call it already distilled. */
785
+ entry_ids?: string[] | null;
786
+ /** What these calls are about ('Q3 fraud queue', 'autumn hiring round'). */
787
+ source_note?: string | null;
788
+ /** Registered Distillation Approach key (platform.approach) stamped on every rule's source_ref.approach. Defaults to 'prediction_ledger'. */
789
+ approach?: string | null;
790
+ /** Extra provenance keys merged into every rule's source_ref. Never overrides the lane's own keys. */
791
+ source_ref_extra?: {
792
+ [key: string]: JsonValue;
793
+ } | null;
794
+ };
795
+ /** Distil ONE answered boundary question into DRAFT rules. */
796
+ type IngestSortRequest = {
797
+ /** Organization context for the request; omitted to use the authenticated context. */
798
+ organization_id?: string | null;
799
+ /** Optional associated project selected by the caller. */
800
+ project_id?: string | null;
801
+ /** Optional associated task selected by the caller. */
802
+ task_id?: string | null;
803
+ /** Stable application slug that initiated the request. */
804
+ source_app?: string | null;
805
+ /** Stable feature slug within the source application. */
806
+ source_feature?: string | null;
807
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
808
+ initiation?: ("user" | "auto") | null;
809
+ rulebook_id: string;
810
+ question: SortBoundaryQuestion;
811
+ /** The Expert's own words about what separates them — spoken or typed. THE RULE CANDIDATE, and the only text a rule's quote may be verified against. */
812
+ reason: string;
813
+ /** Where this round came from; defaults to the question itself. */
814
+ source_note?: string | null;
815
+ };
816
+ /** Distill source material into DRAFT rules on an existing rulebook. */
817
+ type IngestSourceRequest = {
818
+ /** Organization context for the request; omitted to use the authenticated context. */
819
+ organization_id?: string | null;
820
+ /** Optional associated project selected by the caller. */
821
+ project_id?: string | null;
822
+ /** Optional associated task selected by the caller. */
823
+ task_id?: string | null;
824
+ /** Stable application slug that initiated the request. */
825
+ source_app?: string | null;
826
+ /** Stable feature slug within the source application. */
827
+ source_feature?: string | null;
828
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
829
+ initiation?: ("user" | "auto") | null;
830
+ rulebook_id: string;
831
+ /** The source material, verbatim. */
832
+ text: string;
833
+ /** instructional = the source teaches; exemplar = the source IS examples of great finished work. */
834
+ mode?: "instructional" | "exemplar";
835
+ /** Where this came from ('Chapter 3', 'recorded call, Aug 10'). */
836
+ source_note?: string | null;
837
+ /** Words per extraction chunk. */
838
+ chunk_words?: number;
839
+ /** Registered Distillation Approach key (platform.approach) stamped on every rule's source_ref.approach. Defaults from mode: instructional -> 'source', exemplar -> 'exemplar'. The file lane sets 'file' w */
840
+ approach?: string | null;
841
+ /** Extra provenance keys merged into every rule's source_ref — how a delegating lane (the corpus lane) anchors rules to the piece they came from ({url, corpus_item_id}). Never overrides the lane's own ke */
842
+ source_ref_extra?: {
843
+ [key: string]: JsonValue;
844
+ } | null;
845
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
846
+ redistill?: "refuse" | "replace";
847
+ /** Read ONE part of the source again and leave the rest alone — the 1-based `source_ref.section_index` the Sources panel shows beside a thin chapter. With redistill='replace' only THAT part's earlier dra */
848
+ only_section?: number | null;
849
+ };
850
+ /** Distill a case that UNFOLDS IN TIME into forward-looking POLICY rules. */
851
+ type IngestTimelineRequest = {
852
+ /** Organization context for the request; omitted to use the authenticated context. */
853
+ organization_id?: string | null;
854
+ /** Optional associated project selected by the caller. */
855
+ project_id?: string | null;
856
+ /** Optional associated task selected by the caller. */
857
+ task_id?: string | null;
858
+ /** Stable application slug that initiated the request. */
859
+ source_app?: string | null;
860
+ /** Stable feature slug within the source application. */
861
+ source_feature?: string | null;
862
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
863
+ initiation?: ("user" | "auto") | null;
864
+ rulebook_id: string;
865
+ /** The narrative, in the order it happened, verbatim. */
866
+ text: string;
867
+ /** Where this case came from ('ED case 3, March 2026'). */
868
+ source_note?: string | null;
869
+ /** Registered Distillation Approach key (platform.approach) stamped on every rule's source_ref.approach. Defaults to 'timeline'. */
870
+ approach?: string | null;
871
+ /** 🚨 Keep the ENDING away from the distiller (default). A rule written by an agent that already knows how the case turned out is hindsight wearing a rule's clothes — it says 'suspect X' where the expert */
872
+ hide_resolution?: boolean;
873
+ /** Word budget for the cumulative `known_before` history handed to each step. The step's own facts are never trimmed; the OLDEST history is. */
874
+ chunk_words?: number;
875
+ /** Extra provenance keys merged into every rule's source_ref — how a delegating lane anchors rules to the piece they came from. Never overrides the lane's own keys. */
876
+ source_ref_extra?: {
877
+ [key: string]: JsonValue;
878
+ } | null;
879
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
880
+ redistill?: "refuse" | "replace";
881
+ };
882
+ /** Distill ONE played Triad card into DRAFT rules. */
883
+ type IngestTriadRequest = {
884
+ /** Organization context for the request; omitted to use the authenticated context. */
885
+ organization_id?: string | null;
886
+ /** Optional associated project selected by the caller. */
887
+ project_id?: string | null;
888
+ /** Optional associated task selected by the caller. */
889
+ task_id?: string | null;
890
+ /** Stable application slug that initiated the request. */
891
+ source_app?: string | null;
892
+ /** Stable feature slug within the source application. */
893
+ source_feature?: string | null;
894
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
895
+ initiation?: ("user" | "auto") | null;
896
+ rulebook_id: string;
897
+ triad: TriadPayload;
898
+ /** Which item the Expert chose (best one, or odd one out). */
899
+ pick: "a" | "b" | "c";
900
+ /** The Expert's own one line about why — spoken or typed. THE RULE CANDIDATE, and the only text a rule's quote may be verified against. */
901
+ reason: string;
902
+ /** Where this card came from; defaults to the card's own question. */
903
+ source_note?: string | null;
904
+ };
905
+ /** Read a narrative that UNFOLDS IN TIME as a serial-observation timeline. */
906
+ type IngestUnfoldingRequest = {
907
+ /** Organization context for the request; omitted to use the authenticated context. */
908
+ organization_id?: string | null;
909
+ /** Optional associated project selected by the caller. */
910
+ project_id?: string | null;
911
+ /** Optional associated task selected by the caller. */
912
+ task_id?: string | null;
913
+ /** Stable application slug that initiated the request. */
914
+ source_app?: string | null;
915
+ /** Stable feature slug within the source application. */
916
+ source_feature?: string | null;
917
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
918
+ initiation?: ("user" | "auto") | null;
919
+ rulebook_id: string;
920
+ /** The narrative, verbatim — the case as it was written. */
921
+ text: string;
922
+ /** What this case is called, in the Expert's words. */
923
+ title: string;
924
+ /** What KIND of unfolding this is — clinical, incident, negotiation, sales, legal… Optional: the unfolder infers it from the narrative when the Expert does not say. Deliberately an open string; the platf */
925
+ domain?: string;
926
+ /** teaching = unfold and distil rules from it; heldout = unfold and SEAL it as an exam case — no rules are ever written from a held-out case, and only the case oracle and the unfolding judge ever read pa */
927
+ role?: "teaching" | "heldout";
928
+ /** Licence, link, publication date and external id of the case. */
929
+ source_meta?: TimelineSourceMeta | null;
930
+ /** Where this came from, in the Expert's words. */
931
+ source_note?: string | null;
932
+ /** What to do when this Rulebook already holds rules distilled from the same source: 'refuse' (default) stops and reports it in the terminal payload's `already_distilled`; 'replace' removes the earlier p */
933
+ redistill?: "refuse" | "replace";
934
+ };
935
+ /** MeetingPreviewItem */
936
+ type MeetingPreviewItem = {
937
+ key: string;
938
+ title: string;
939
+ origin: string;
940
+ slug?: string | null;
941
+ started_at?: string | null;
942
+ turns: number;
943
+ speakers: MeetingSpeakerPreview[];
944
+ };
945
+ /** Read the transcript(s) and list the voices — no AI, no writes. */
946
+ type MeetingPreviewRequest = {
947
+ /** communication.meet_meetings ids the caller may read. */
948
+ meeting_ids?: string[] | null;
949
+ /** files.files id of an uploaded transcript or recording. */
950
+ file_id?: string | null;
951
+ /** A pasted meeting transcript. */
952
+ text?: string | null;
953
+ /** Organization context for the request; omitted to use the authenticated context. */
954
+ organization_id?: string | null;
955
+ /** Optional associated project selected by the caller. */
956
+ project_id?: string | null;
957
+ /** Optional associated task selected by the caller. */
958
+ task_id?: string | null;
959
+ /** Stable application slug that initiated the request. */
960
+ source_app?: string | null;
961
+ /** Stable feature slug within the source application. */
962
+ source_feature?: string | null;
963
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
964
+ initiation?: ("user" | "auto") | null;
965
+ };
966
+ /** MeetingPreviewResponse */
967
+ type MeetingPreviewResponse = {
968
+ meetings?: MeetingPreviewItem[];
969
+ notes?: string[];
970
+ };
971
+ /** One voice in the room, so the Expert can say which one is them. */
972
+ type MeetingSpeakerPreview = {
973
+ key: string;
974
+ name: string;
975
+ turns: number;
976
+ words: number;
977
+ user_id?: string | null;
978
+ is_you?: boolean;
979
+ };
980
+ /** POST body for /vision-interview/sessions/{id}/observe. */
981
+ type ObserveTurnBody = {
982
+ /** Organization context for the request; omitted to use the authenticated context. */
983
+ organization_id?: string | null;
984
+ /** Optional associated project selected by the caller. */
985
+ project_id?: string | null;
986
+ /** Optional associated task selected by the caller. */
987
+ task_id?: string | null;
988
+ /** Stable application slug that initiated the request. */
989
+ source_app?: string | null;
990
+ /** Stable feature slug within the source application. */
991
+ source_feature?: string | null;
992
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
993
+ initiation?: ("user" | "auto") | null;
994
+ /** Which role's conversation just took a turn (the active stage tab). */
995
+ role_key: string;
996
+ /** Run the pass inline and return its counts instead of scheduling it. For tests and admin tooling — the room never waits. */
997
+ wait?: boolean;
998
+ };
999
+ /** ObserveTurnResult */
1000
+ type ObserveTurnResult = {
1001
+ session_id: string;
1002
+ role_key: string;
1003
+ /** True when the pass runs in the background (the normal path). */
1004
+ scheduled: boolean;
1005
+ turns_mirrored?: number;
1006
+ questions_closed?: number;
1007
+ scribe_applied?: boolean;
1008
+ verdicts?: number;
1009
+ };
1010
+ /** ONE arm of a blind pairwise Audition, and where its text comes from. */
1011
+ type PairwiseCandidate = {
1012
+ /** The operator's name for this arm. */
1013
+ label: string;
1014
+ /** Pasted output text. */
1015
+ text?: string | null;
1016
+ /** platform.masterwork_run id. */
1017
+ run_id?: string | null;
1018
+ /** platform.masterwork_corpus_item id (sealed_case). */
1019
+ case_id?: string | null;
1020
+ /** With case_id: the run whose committed answer is the arm. */
1021
+ run_scope?: string | null;
1022
+ /** faithfulness mode: this arm's OWN school. Defaults to the request's rulebook_id when both arms come from the same Rulebook. */
1023
+ rulebook_id?: string | null;
1024
+ };
1025
+ /** Judge TWO candidate outputs BLIND against each other — no reference. */
1026
+ type PairwiseCompareRequest = {
1027
+ /** Organization context for the request; omitted to use the authenticated context. */
1028
+ organization_id?: string | null;
1029
+ /** Optional associated project selected by the caller. */
1030
+ project_id?: string | null;
1031
+ /** Optional associated task selected by the caller. */
1032
+ task_id?: string | null;
1033
+ /** Stable application slug that initiated the request. */
1034
+ source_app?: string | null;
1035
+ /** Stable feature slug within the source application. */
1036
+ source_feature?: string | null;
1037
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1038
+ initiation?: ("user" | "auto") | null;
1039
+ /** The Rulebook this Audition belongs to — the run's home, the ownership check, and (unless an arm names its own) the school both arms are judged against. */
1040
+ rulebook_id: string;
1041
+ /** preference: which answer would a practitioner rather have received. faithfulness: is each answer true to ITS OWN school (each arm scored against its own Rulebook) — the mandate's two-schools shape. */
1042
+ mode?: "preference" | "faithfulness";
1043
+ candidate_one: PairwiseCandidate;
1044
+ candidate_two: PairwiseCandidate;
1045
+ /** The shared inputs both arms answered ('the shoes/kitchen-counter case'). */
1046
+ case_note?: string | null;
1047
+ /** preference mode: also give the judge the Rulebook's approved rules and ask for a rule-by-rule reading. Ignored in faithfulness mode, where the rules ARE the question. */
1048
+ judge_by_rules?: boolean;
1049
+ };
1050
+ /** What a surface needs to render the Prediction Ledger honestly. */
1051
+ type PredictionLedgerResponse = {
1052
+ rulebook_id: string;
1053
+ resolved: number;
1054
+ open: number;
1055
+ overdue: number;
1056
+ correct: number;
1057
+ brier?: number | null;
1058
+ buckets?: {
1059
+ [key: string]: JsonValue;
1060
+ }[];
1061
+ earliest_open_due_at?: string;
1062
+ ready_to_distill?: number;
1063
+ min_resolved_to_distill?: number;
1064
+ reminder_cadence_hours?: number;
1065
+ voice_default_on?: boolean;
1066
+ boundaries?: {
1067
+ [key: string]: JsonValue;
1068
+ }[];
1069
+ };
1070
+ /** ONE round of the Bad Example probe, as the client holds it. */
1071
+ type ProbeRound = {
1072
+ example_title?: string;
1073
+ /** The plausible-but-wrong work exactly as it was shown. */
1074
+ example_body?: string;
1075
+ /** The boundary this variant probed, as the generator named it. Carried back so the next round cannot re-probe ground already covered. */
1076
+ probe_label?: string;
1077
+ /** The Expert's own words about what is wrong with this example and what they would do instead — spoken or typed. THE RULE CANDIDATE, and the only text a rule's quote may be anchored in. Empty means they */
1078
+ critique?: string;
1079
+ };
1080
+ /** Run ONE round of the Bad Example probe. */
1081
+ type ProbeRoundRequest = {
1082
+ /** Organization context for the request; omitted to use the authenticated context. */
1083
+ organization_id?: string | null;
1084
+ /** Optional associated project selected by the caller. */
1085
+ project_id?: string | null;
1086
+ /** Optional associated task selected by the caller. */
1087
+ task_id?: string | null;
1088
+ /** Stable application slug that initiated the request. */
1089
+ source_app?: string | null;
1090
+ /** Stable feature slug within the source application. */
1091
+ source_feature?: string | null;
1092
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1093
+ initiation?: ("user" | "auto") | null;
1094
+ rulebook_id: string;
1095
+ /** What kind of work to fake, in the Expert's own words — the case, task or deliverable they handle. The one thing the Expert has to supply. */
1096
+ case_brief: string;
1097
+ /** Every round of this session so far, oldest first. Empty starts the probe. The LAST entry is the one whose critique is distilled by this call. */
1098
+ rounds?: ProbeRound[];
1099
+ /** The Expert said 'I'd never see that' — distil the last answer and stop instead of writing another variant. */
1100
+ finish?: boolean;
1101
+ /** Lower the number of rounds for THIS session only. Never raises the organization's `masterwork.probe.rounds` knob — the knob is the ceiling. */
1102
+ round_cap?: number | null;
1103
+ /** A short label for this probe; defaults to the case brief. */
1104
+ source_note?: string | null;
1105
+ };
1106
+ /** The declared condition: what must hold before this desk produces. */
1107
+ type RefuseUntil = {
1108
+ required_facts?: RequiredFact[];
1109
+ protocol_frame?: string;
1110
+ provenance?: string[];
1111
+ headline?: string;
1112
+ };
1113
+ /** One fact the frame requires before the desk may produce. */
1114
+ type RequiredFact = {
1115
+ /** What must be known, in one plain phrase. */
1116
+ fact: string;
1117
+ key?: string;
1118
+ why_it_matters?: string;
1119
+ how_to_get_it?: string;
1120
+ };
1121
+ /** RestoreWriteRequest */
1122
+ type RestoreWriteRequest = {
1123
+ /** Organization context for the request; omitted to use the authenticated context. */
1124
+ organization_id?: string | null;
1125
+ /** Optional associated project selected by the caller. */
1126
+ project_id?: string | null;
1127
+ /** Optional associated task selected by the caller. */
1128
+ task_id?: string | null;
1129
+ /** Stable application slug that initiated the request. */
1130
+ source_app?: string | null;
1131
+ /** Stable feature slug within the source application. */
1132
+ source_feature?: string | null;
1133
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1134
+ initiation?: ("user" | "auto") | null;
1135
+ assist_id: string;
1136
+ };
1137
+ /** RestoreWriteResponse */
1138
+ type RestoreWriteResponse = {
1139
+ restored: boolean;
1140
+ assist_id: string;
1141
+ action?: string | null;
1142
+ rules_restored?: number | null;
1143
+ detail?: JsonValue | null;
1144
+ };
1145
+ /** RoleBinding */
1146
+ type RoleBinding = {
1147
+ agent_id: string;
1148
+ is_version?: boolean;
1149
+ definition_agent_id: string;
1150
+ conversation_id: string;
1151
+ conversation_started?: boolean;
1152
+ };
1153
+ /** Every role's binding for a session — the v3 room's tab manifest. */
1154
+ type RolesReadyPayload = {
1155
+ session_id: string;
1156
+ roles: {
1157
+ [key: string]: RoleBinding;
1158
+ };
1159
+ };
1160
+ /** RulebookInterviewOut */
1161
+ type RulebookInterviewOut = {
1162
+ conversation_id: string;
1163
+ title?: string | null;
1164
+ created_at?: string | null;
1165
+ updated_at?: string | null;
1166
+ message_count?: number;
1167
+ expert_turn_count?: number;
1168
+ expert_chars?: number;
1169
+ first_expert_line?: string | null;
1170
+ rules_produced?: number;
1171
+ };
1172
+ /** What a first run of this Masterwork will likely cost, or null. */
1173
+ type RunEstimateResponse = {
1174
+ masterwork_id: string;
1175
+ estimated_cost_usd?: number | null;
1176
+ priced_runs?: number;
1177
+ basis?: string | null;
1178
+ };
1179
+ /** SealedCaseListResponse */
1180
+ type SealedCaseListResponse = {
1181
+ rulebook_id: string;
1182
+ cases?: SealedCaseSummary[];
1183
+ };
1184
+ /** A sealed case as a LIST row — never carries raw_value or the resolution. */
1185
+ type SealedCaseSummary = {
1186
+ case_id: string;
1187
+ rulebook_id: string;
1188
+ title?: string | null;
1189
+ canonical_key: string;
1190
+ url?: string | null;
1191
+ published_at?: string | null;
1192
+ license?: string | null;
1193
+ words?: number;
1194
+ sealed?: boolean;
1195
+ run_scopes?: string[];
1196
+ };
1197
+ /** Ask this Rulebook's owner today's question NOW. */
1198
+ type SendTodaysDripRequest = {
1199
+ /** Organization context for the request; omitted to use the authenticated context. */
1200
+ organization_id?: string | null;
1201
+ /** Optional associated project selected by the caller. */
1202
+ project_id?: string | null;
1203
+ /** Optional associated task selected by the caller. */
1204
+ task_id?: string | null;
1205
+ /** Stable application slug that initiated the request. */
1206
+ source_app?: string | null;
1207
+ /** Stable feature slug within the source application. */
1208
+ source_feature?: string | null;
1209
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1210
+ initiation?: ("user" | "auto") | null;
1211
+ rulebook_id: string;
1212
+ /** Skip the 'is it their hour yet' check. It never skips the day row: a forced send on a day already asked still asks nothing. */
1213
+ force?: boolean;
1214
+ };
1215
+ /** SessionPayload */
1216
+ type SessionPayload = {
1217
+ id: string;
1218
+ title: string;
1219
+ vision_statement?: string | null;
1220
+ stage: "capture" | "ground" | "enhance" | "articulate" | "stress" | "shape" | "revisit" | "done";
1221
+ current_round: number;
1222
+ run_id?: string | null;
1223
+ document?: string;
1224
+ };
1225
+ /** ONE question the boundary pass found worth the Expert's voice. */
1226
+ type SortBoundaryQuestion = {
1227
+ id: string;
1228
+ kind: "pair" | "empty_pile";
1229
+ prompt: string;
1230
+ left_case?: string;
1231
+ left_case_id?: string;
1232
+ left_pile?: string;
1233
+ right_case?: string;
1234
+ right_case_id?: string;
1235
+ right_pile?: string;
1236
+ empty_pile?: string;
1237
+ /** How close the two cases sit, 0–1 (an IDF-weighted cosine over the round's own vocabulary). 0 on an empty-pile question. */
1238
+ closeness?: number;
1239
+ pile_names?: string[];
1240
+ };
1241
+ /** The sorted piles → the questions worth asking. Pure arithmetic: no */
1242
+ type SortBoundaryRequest = {
1243
+ /** Organization context for the request; omitted to use the authenticated context. */
1244
+ organization_id?: string | null;
1245
+ /** Optional associated project selected by the caller. */
1246
+ project_id?: string | null;
1247
+ /** Optional associated task selected by the caller. */
1248
+ task_id?: string | null;
1249
+ /** Stable application slug that initiated the request. */
1250
+ source_app?: string | null;
1251
+ /** Stable feature slug within the source application. */
1252
+ source_feature?: string | null;
1253
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1254
+ initiation?: ("user" | "auto") | null;
1255
+ rulebook_id: string;
1256
+ cases: SortCasePayload[];
1257
+ piles: SortPilePayload[];
1258
+ /** case id → pile key, for the cases the Expert actually sorted. A case that is not in here was skipped, and a skipped case is not a judgment — it never becomes evidence. */
1259
+ assignments?: {
1260
+ [key: string]: string;
1261
+ };
1262
+ /** How many questions to ask. Omitted → the org knob `masterwork.sorting_table.boundary_questions_per_round` (5). */
1263
+ question_count?: number | null;
1264
+ };
1265
+ /** What the boundary pass found. `questions` may be SHORTER than */
1266
+ type SortBoundaryResponse = {
1267
+ rulebook_id: string;
1268
+ questions?: SortBoundaryQuestion[];
1269
+ requested?: number;
1270
+ sorted_cases?: number;
1271
+ };
1272
+ /** Write one round of cases for an Expert who brought none. Writes nothing. */
1273
+ type SortCaseGenerateRequest = {
1274
+ /** Organization context for the request; omitted to use the authenticated context. */
1275
+ organization_id?: string | null;
1276
+ /** Optional associated project selected by the caller. */
1277
+ project_id?: string | null;
1278
+ /** Optional associated task selected by the caller. */
1279
+ task_id?: string | null;
1280
+ /** Stable application slug that initiated the request. */
1281
+ source_app?: string | null;
1282
+ /** Stable feature slug within the source application. */
1283
+ source_feature?: string | null;
1284
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1285
+ initiation?: ("user" | "auto") | null;
1286
+ rulebook_id: string;
1287
+ /** How many cases to write. Omitted → the org knob `masterwork.sorting_table.cases_per_round` (20). */
1288
+ count?: number | null;
1289
+ /** How many piles this round sorts into. Omitted → the org knob `masterwork.sorting_table.piles` (3). */
1290
+ pile_count?: number | null;
1291
+ /** The piles in the Expert's own words, so the cases are written to be sortable into THEM. Empty → the round's default names. */
1292
+ pile_names?: string[];
1293
+ /** Cases this sitting has already sorted, verbatim. The table never deals the same case twice in one sitting, and the session is the only thing that knows what it has shown. */
1294
+ seen_cases?: string[];
1295
+ };
1296
+ /** ONE case exactly as it was shown to the Expert. */
1297
+ type SortCasePayload = {
1298
+ id: string;
1299
+ text: string;
1300
+ note?: string;
1301
+ };
1302
+ /** ONE pile, in the Expert's own word for it. */
1303
+ type SortPilePayload = {
1304
+ key: string;
1305
+ name: string;
1306
+ };
1307
+ /** POST body for /vision-interview/sessions/{id}/start — the session id */
1308
+ type StartRunBody = {
1309
+ /** Organization context for the request; omitted to use the authenticated context. */
1310
+ organization_id?: string | null;
1311
+ /** Optional associated project selected by the caller. */
1312
+ project_id?: string | null;
1313
+ /** Optional associated task selected by the caller. */
1314
+ task_id?: string | null;
1315
+ /** Stable application slug that initiated the request. */
1316
+ source_app?: string | null;
1317
+ /** Stable feature slug within the source application. */
1318
+ source_feature?: string | null;
1319
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1320
+ initiation?: ("user" | "auto") | null;
1321
+ };
1322
+ /** ONE round of a Teach-Back, as the client holds it. */
1323
+ type TeachBackRound = {
1324
+ /** The ONE decision this round explained back, in the Expert's words. */
1325
+ subject?: string;
1326
+ /** The explanation exactly as it was shown and spoken — the system's understanding of the Expert's method, said back to them. */
1327
+ explanation?: string;
1328
+ /** What this round's explanation was built from: `rulebook` (the Rulebook held material) or `generalist` (it held nothing, so the explanation is what anyone competent would do — and says so). */
1329
+ basis?: "rulebook" | "generalist" | "";
1330
+ /** The Rulebook rule ids this explanation leaned on. Empty on the generalist basis. THESE are the rules a `yes, that's it` signs. */
1331
+ rule_ids?: string[];
1332
+ /** The Expert's own words correcting this explanation — spoken or typed. THE RULE CANDIDATE, and the only text a rule's quote may be anchored in. Empty means they have not answered this round yet. */
1333
+ correction?: string;
1334
+ };
1335
+ /** Run ONE round of a Teach-Back. */
1336
+ type TeachBackRoundRequest = {
1337
+ /** Organization context for the request; omitted to use the authenticated context. */
1338
+ organization_id?: string | null;
1339
+ /** Optional associated project selected by the caller. */
1340
+ project_id?: string | null;
1341
+ /** Optional associated task selected by the caller. */
1342
+ task_id?: string | null;
1343
+ /** Stable application slug that initiated the request. */
1344
+ source_app?: string | null;
1345
+ /** Stable feature slug within the source application. */
1346
+ source_feature?: string | null;
1347
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1348
+ initiation?: ("user" | "auto") | null;
1349
+ rulebook_id: string;
1350
+ /** What the Expert asked to have explained back, in their own words. Empty is the normal answer — then the explainer picks the most load-bearing decision the Rulebook covers. THE ONE THING THIS LANE DOES */
1351
+ topic?: string | null;
1352
+ /** Every round of this session so far, oldest first. Empty starts the teach-back. The LAST entry is the one whose correction is distilled by this call. */
1353
+ rounds?: TeachBackRound[];
1354
+ /** The Expert said 'yes, that's it' — stamp the signed teach-back onto the rules the last explanation leaned on and stop, instead of explaining again. */
1355
+ agreed?: boolean;
1356
+ /** The `platform.masterwork_run` id of the round whose explanation was signed — the SAME subject the client wrote its `masterwork.expert_signature` verdict against, so the stamp on the rules and the verd */
1357
+ signature_subject_id?: string | null;
1358
+ /** Lower the number of rounds for THIS session only. Never raises the organization's `masterwork.teach_back.rounds` knob — the knob is the ceiling. */
1359
+ round_cap?: number | null;
1360
+ /** A short label for this teach-back; defaults to the subject. */
1361
+ source_note?: string | null;
1362
+ };
1363
+ /** Where this case came from, and under what licence we may hold it. */
1364
+ type TimelineSourceMeta = {
1365
+ licence?: string | null;
1366
+ url?: string | null;
1367
+ published?: string | null;
1368
+ external_id?: string | null;
1369
+ };
1370
+ /** Deal one session's deck of Triad cards. Writes nothing. */
1371
+ type TriadGenerateRequest = {
1372
+ /** Organization context for the request; omitted to use the authenticated context. */
1373
+ organization_id?: string | null;
1374
+ /** Optional associated project selected by the caller. */
1375
+ project_id?: string | null;
1376
+ /** Optional associated task selected by the caller. */
1377
+ task_id?: string | null;
1378
+ /** Stable application slug that initiated the request. */
1379
+ source_app?: string | null;
1380
+ /** Stable feature slug within the source application. */
1381
+ source_feature?: string | null;
1382
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1383
+ initiation?: ("user" | "auto") | null;
1384
+ rulebook_id: string;
1385
+ /** How many cards to deal. Omitted → the org knob `masterwork.triad_game.triads_per_session` (10). */
1386
+ count?: number | null;
1387
+ /** 'best_one' (which would you actually use?) or 'odd_one_out' (which two are alike?). Omitted → the org knob `masterwork.triad_game.default_mode` (best_one). */
1388
+ mode?: ("best_one" | "odd_one_out") | null;
1389
+ /** The card questions this session has already played, verbatim. The game never asks the same thing twice in one sitting, and the session is the only thing that knows what it has shown. */
1390
+ seen_prompts?: string[];
1391
+ };
1392
+ /** One of the three items exactly as it was shown to the Expert. */
1393
+ type TriadItemPayload = {
1394
+ key: "a" | "b" | "c";
1395
+ text: string;
1396
+ note?: string;
1397
+ };
1398
+ /** The card, played back to the server exactly as it was dealt. */
1399
+ type TriadPayload = {
1400
+ id: string;
1401
+ prompt: string;
1402
+ mode?: "best_one" | "odd_one_out";
1403
+ items: TriadItemPayload[];
1404
+ };
1405
+ /** Sort a Rulebook's DRAFT pile by what the Rulebook is FOR. */
1406
+ type TriageDraftsRequest = {
1407
+ /** Organization context for the request; omitted to use the authenticated context. */
1408
+ organization_id?: string | null;
1409
+ /** Optional associated project selected by the caller. */
1410
+ project_id?: string | null;
1411
+ /** Optional associated task selected by the caller. */
1412
+ task_id?: string | null;
1413
+ /** Stable application slug that initiated the request. */
1414
+ source_app?: string | null;
1415
+ /** Stable feature slug within the source application. */
1416
+ source_feature?: string | null;
1417
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1418
+ initiation?: ("user" | "auto") | null;
1419
+ rulebook_id: string;
1420
+ /** What SERVES this Rulebook, in the Expert's own words — the kind of rule that belongs here. */
1421
+ keep: string;
1422
+ /** The classes to set aside, in the Expert's own words. Optional: `keep` alone is a complete instruction, and an empty value means 'anything that does not serve the purpose'. */
1423
+ set_aside?: string;
1424
+ /** How many drafts one triage run reads. A CEILING, never a promise: the lane sizes every batch against the holder's real output ceiling and halves a batch whose reply was cut. */
1425
+ batch_size?: number;
1426
+ /** Return the plan — every draft with its verdict and reason — and write NOTHING. The Expert's 'show me first'. */
1427
+ dry_run?: boolean;
1428
+ };
1429
+ /** UnderstudyRefreshRequest */
1430
+ type UnderstudyRefreshRequest = {
1431
+ /** Organization context for the request; omitted to use the authenticated context. */
1432
+ organization_id?: string | null;
1433
+ /** Optional associated project selected by the caller. */
1434
+ project_id?: string | null;
1435
+ /** Optional associated task selected by the caller. */
1436
+ task_id?: string | null;
1437
+ /** Stable application slug that initiated the request. */
1438
+ source_app?: string | null;
1439
+ /** Stable feature slug within the source application. */
1440
+ source_feature?: string | null;
1441
+ /** How the client initiated this request: 'user' for a direct human action, 'auto' for client-code automation. Omit for API callers. */
1442
+ initiation?: ("user" | "auto") | null;
1443
+ rulebook_id: string;
1444
+ };
1445
+ /** What one refresh did — the router's response body. */
1446
+ type UnderstudyRefreshResult = {
1447
+ workflow_id: string;
1448
+ created: boolean;
1449
+ approved_rules: number;
1450
+ unconfirmed_rules: number;
1451
+ rulebook_version: number;
1452
+ };
1453
+ /** ONE red-pen correction: a passage the Expert struck through, what they */
1454
+ type WorkCorrection = {
1455
+ /** The passage the Expert highlighted, VERBATIM from the work. Re-checked against the work server-side; a passage that is not in the work refuses the run rather than anchoring a rule to evidence that doe */
1456
+ span: string;
1457
+ /** The Expert's own words: what is wrong with that passage and what they would do instead. Typed or dictated — the same field either way, because dictation writes into the same box. */
1458
+ comment: string;
1459
+ /** Character offset of the span in the work, as the client's selection saw it. */
1460
+ start?: number | null;
1461
+ /** Character offset of the end of the span in the work. */
1462
+ end?: number | null;
1463
+ /** True when the Expert spoke this correction rather than typing it. */
1464
+ voice?: boolean;
1465
+ /** ISO-8601 moment the correction was made — the recording moment. */
1466
+ at?: string | null;
1467
+ };
1468
+ /** CancelRunResponse */
1469
+ type aidream__api__routers__masterworks__CancelRunResponse = {
1470
+ run_id: string;
1471
+ status: string;
1472
+ cancelled: boolean;
1473
+ message: string;
1474
+ };
1475
+ type CreateInterviewSessionArgs = {
1476
+ body: CreateSessionRequest;
1477
+ };
1478
+ type CreateInterviewSessionResult = SessionPayload;
1479
+ /** Create Interview Session */
1480
+ /** `POST /vision-interview/sessions` · aidream · auth user · org required */
1481
+ declare function createInterviewSession(api: Api, args: CreateInterviewSessionArgs, options?: CallOptions): Promise<CreateInterviewSessionResult>;
1482
+ type EnsureInterviewRolesArgs = {
1483
+ path: {
1484
+ session_id: string;
1485
+ };
1486
+ };
1487
+ type EnsureInterviewRolesResult = RolesReadyPayload;
1488
+ /** Ensure Interview Roles */
1489
+ /** `POST /vision-interview/sessions/{session_id}/roles` · aidream · auth guest · org required */
1490
+ declare function ensureInterviewRoles(api: Api, args: EnsureInterviewRolesArgs, options?: CallOptions): Promise<EnsureInterviewRolesResult>;
1491
+ type ObserveInterviewTurnArgs = {
1492
+ path: {
1493
+ session_id: string;
1494
+ };
1495
+ body: ObserveTurnBody;
1496
+ };
1497
+ type ObserveInterviewTurnResult = ObserveTurnResult;
1498
+ /** Observe Interview Turn */
1499
+ /** `POST /vision-interview/sessions/{session_id}/observe` · aidream · auth guest · org required */
1500
+ declare function observeInterviewTurn(api: Api, args: ObserveInterviewTurnArgs, options?: CallOptions): Promise<ObserveInterviewTurnResult>;
1501
+ type StartInterviewSessionArgs = {
1502
+ path: {
1503
+ session_id: string;
1504
+ };
1505
+ body?: StartRunBody | null;
1506
+ };
1507
+ type StartInterviewSessionResult = unknown;
1508
+ /** Start Interview Session */
1509
+ /** `POST /vision-interview/sessions/{session_id}/start` · aidream · auth guest · org required · ndjson */
1510
+ declare function startInterviewSession(api: Api, args: StartInterviewSessionArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1511
+ type FinishInterviewSessionArgs = {
1512
+ path: {
1513
+ session_id: string;
1514
+ };
1515
+ body?: StartRunBody | null;
1516
+ };
1517
+ type FinishInterviewSessionResult = unknown;
1518
+ /** Finish Interview Session */
1519
+ /** `POST /vision-interview/sessions/{session_id}/finish` · aidream · auth guest · org required · ndjson */
1520
+ declare function finishInterviewSession(api: Api, args: FinishInterviewSessionArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1521
+ type BuildMasterworkEndpointArgs = {
1522
+ body: BuildMasterworkRequest;
1523
+ };
1524
+ type BuildMasterworkEndpointResult = unknown;
1525
+ /** Build Masterwork Endpoint */
1526
+ /** `POST /masterworks/build` · aidream · auth guest · org required · ndjson */
1527
+ declare function buildMasterworkEndpoint(api: Api, args: BuildMasterworkEndpointArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1528
+ type IngestRulebookSourceArgs = {
1529
+ body: IngestSourceRequest;
1530
+ };
1531
+ type IngestRulebookSourceResult = unknown;
1532
+ /** Ingest Rulebook Source */
1533
+ /** `POST /masterworks/ingest` · aidream · auth guest · org required · ndjson */
1534
+ declare function ingestRulebookSource(api: Api, args: IngestRulebookSourceArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1535
+ type IngestRulebookTimelineArgs = {
1536
+ body: IngestTimelineRequest;
1537
+ };
1538
+ type IngestRulebookTimelineResult = unknown;
1539
+ /** Ingest Rulebook Timeline */
1540
+ /** `POST /masterworks/ingest-timeline` · aidream · auth guest · org required · ndjson */
1541
+ declare function ingestRulebookTimeline(api: Api, args: IngestRulebookTimelineArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1542
+ type IngestRulebookMarkupArgs = {
1543
+ body: IngestMarkupRequest;
1544
+ };
1545
+ type IngestRulebookMarkupResult = unknown;
1546
+ /** Ingest Rulebook Markup */
1547
+ /** `POST /masterworks/ingest-markup` · aidream · auth guest · org required · ndjson */
1548
+ declare function ingestRulebookMarkup(api: Api, args: IngestRulebookMarkupArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1549
+ type IngestRulebookDripAnswersArgs = {
1550
+ body: IngestDripAnswersRequest;
1551
+ };
1552
+ type IngestRulebookDripAnswersResult = unknown;
1553
+ /** Ingest Rulebook Drip Answers */
1554
+ /** `POST /masterworks/ingest-drip` · aidream · auth guest · org required · ndjson */
1555
+ declare function ingestRulebookDripAnswers(api: Api, args: IngestRulebookDripAnswersArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1556
+ type SendTodaysDripArgs = {
1557
+ body: SendTodaysDripRequest;
1558
+ };
1559
+ type SendTodaysDripResult = DripSendReport;
1560
+ /** Send Todays Drip */
1561
+ /** `POST /masterworks/drip/send-now` · aidream · auth guest · org required */
1562
+ declare function sendTodaysDrip(api: Api, args: SendTodaysDripArgs, options?: CallOptions): Promise<SendTodaysDripResult>;
1563
+ type IngestRulebookPredictionsArgs = {
1564
+ body: IngestPredictionsRequest;
1565
+ };
1566
+ type IngestRulebookPredictionsResult = unknown;
1567
+ /** Ingest Rulebook Predictions */
1568
+ /** `POST /masterworks/ingest-predictions` · aidream · auth guest · org required · ndjson */
1569
+ declare function ingestRulebookPredictions(api: Api, args: IngestRulebookPredictionsArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1570
+ type ReadPredictionLedgerArgs = {
1571
+ path: {
1572
+ rulebook_id: string;
1573
+ };
1574
+ };
1575
+ type ReadPredictionLedgerResult = PredictionLedgerResponse;
1576
+ /** Read Prediction Ledger */
1577
+ /** `GET /masterworks/{rulebook_id}/predictions` · aidream · auth guest · org required */
1578
+ declare function readPredictionLedger(api: Api, args: ReadPredictionLedgerArgs, options?: CallOptions): Promise<ReadPredictionLedgerResult>;
1579
+ type TriageRulebookDraftsArgs = {
1580
+ body: TriageDraftsRequest;
1581
+ };
1582
+ type TriageRulebookDraftsResult = unknown;
1583
+ /** Triage Rulebook Drafts */
1584
+ /** `POST /masterworks/triage` · aidream · auth guest · org required · ndjson */
1585
+ declare function triageRulebookDrafts(api: Api, args: TriageRulebookDraftsArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1586
+ type IngestRulebookFileArgs = {
1587
+ body: IngestFileRequest;
1588
+ };
1589
+ type IngestRulebookFileResult = unknown;
1590
+ /** Ingest Rulebook File */
1591
+ /** `POST /masterworks/ingest-file` · aidream · auth guest · org required · ndjson */
1592
+ declare function ingestRulebookFile(api: Api, args: IngestRulebookFileArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1593
+ type IngestRulebookUnfoldingArgs = {
1594
+ body: IngestUnfoldingRequest;
1595
+ };
1596
+ type IngestRulebookUnfoldingResult = unknown;
1597
+ /** Ingest Rulebook Unfolding */
1598
+ /** `POST /masterworks/ingest-unfolding` · aidream · auth guest · org required · ndjson */
1599
+ declare function ingestRulebookUnfolding(api: Api, args: IngestRulebookUnfoldingArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1600
+ type IngestRulebookCorpusArgs = {
1601
+ body: IngestCorpusRequest;
1602
+ };
1603
+ type IngestRulebookCorpusResult = unknown;
1604
+ /** Ingest Rulebook Corpus */
1605
+ /** `POST /masterworks/ingest-corpus` · aidream · auth guest · org required · ndjson */
1606
+ declare function ingestRulebookCorpus(api: Api, args: IngestRulebookCorpusArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1607
+ type IngestRulebookDumpArgs = {
1608
+ body: IngestDumpRequest;
1609
+ };
1610
+ type IngestRulebookDumpResult = unknown;
1611
+ /** Ingest Rulebook Dump */
1612
+ /** `POST /masterworks/ingest-dump` · aidream · auth guest · org required · ndjson */
1613
+ declare function ingestRulebookDump(api: Api, args: IngestRulebookDumpArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1614
+ type PreviewChatImportArgs = {
1615
+ body: ChatImportPreviewRequest;
1616
+ };
1617
+ type PreviewChatImportResult = ChatImportPreviewResponse;
1618
+ /** Preview Chat Import */
1619
+ /** `POST /masterworks/chat-import/preview` · aidream · auth guest · org required */
1620
+ declare function previewChatImport(api: Api, args: PreviewChatImportArgs, options?: CallOptions): Promise<PreviewChatImportResult>;
1621
+ type ShortlistChatImportArgs = {
1622
+ body: ChatShortlistRequest;
1623
+ };
1624
+ type ShortlistChatImportResult = unknown;
1625
+ /** Shortlist Chat Import */
1626
+ /** `POST /masterworks/chat-import/shortlist` · aidream · auth guest · org required · ndjson */
1627
+ declare function shortlistChatImport(api: Api, args: ShortlistChatImportArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1628
+ type DealRulebookTriadsArgs = {
1629
+ body: TriadGenerateRequest;
1630
+ };
1631
+ type DealRulebookTriadsResult = unknown;
1632
+ /** Deal Rulebook Triads */
1633
+ /** `POST /masterworks/triads` · aidream · auth guest · org required · ndjson */
1634
+ declare function dealRulebookTriads(api: Api, args: DealRulebookTriadsArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1635
+ type IngestRulebookTriadArgs = {
1636
+ body: IngestTriadRequest;
1637
+ };
1638
+ type IngestRulebookTriadResult = unknown;
1639
+ /** Ingest Rulebook Triad */
1640
+ /** `POST /masterworks/ingest-triad` · aidream · auth guest · org required · ndjson */
1641
+ declare function ingestRulebookTriad(api: Api, args: IngestRulebookTriadArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1642
+ type WriteRulebookSortCasesArgs = {
1643
+ body: SortCaseGenerateRequest;
1644
+ };
1645
+ type WriteRulebookSortCasesResult = unknown;
1646
+ /** Write Rulebook Sort Cases */
1647
+ /** `POST /masterworks/sort/cases` · aidream · auth guest · org required · ndjson */
1648
+ declare function writeRulebookSortCases(api: Api, args: WriteRulebookSortCasesArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1649
+ type FindRulebookSortBoundaryArgs = {
1650
+ body: SortBoundaryRequest;
1651
+ };
1652
+ type FindRulebookSortBoundaryResult = SortBoundaryResponse;
1653
+ /** Find Rulebook Sort Boundary */
1654
+ /** `POST /masterworks/sort/boundary` · aidream · auth guest · org required */
1655
+ declare function findRulebookSortBoundary(api: Api, args: FindRulebookSortBoundaryArgs, options?: CallOptions): Promise<FindRulebookSortBoundaryResult>;
1656
+ type IngestRulebookSortAnswerArgs = {
1657
+ body: IngestSortRequest;
1658
+ };
1659
+ type IngestRulebookSortAnswerResult = unknown;
1660
+ /** Ingest Rulebook Sort Answer */
1661
+ /** `POST /masterworks/ingest-sort` · aidream · auth guest · org required · ndjson */
1662
+ declare function ingestRulebookSortAnswer(api: Api, args: IngestRulebookSortAnswerArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1663
+ type MasterworkBadExampleProbeArgs = {
1664
+ body: ProbeRoundRequest;
1665
+ };
1666
+ type MasterworkBadExampleProbeResult = unknown;
1667
+ /** Masterwork Bad Example Probe */
1668
+ /** `POST /masterworks/probe` · aidream · auth guest · org required · ndjson */
1669
+ declare function masterworkBadExampleProbe(api: Api, args: MasterworkBadExampleProbeArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1670
+ type MasterworkTeachBackArgs = {
1671
+ body: TeachBackRoundRequest;
1672
+ };
1673
+ type MasterworkTeachBackResult = unknown;
1674
+ /** Masterwork Teach Back */
1675
+ /** `POST /masterworks/teach-back` · aidream · auth guest · org required · ndjson */
1676
+ declare function masterworkTeachBack(api: Api, args: MasterworkTeachBackArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1677
+ type IngestRulebookChatArgs = {
1678
+ body: IngestChatRequest;
1679
+ };
1680
+ type IngestRulebookChatResult = unknown;
1681
+ /** Ingest Rulebook Chat */
1682
+ /** `POST /masterworks/ingest-chat` · aidream · auth guest · org required · ndjson */
1683
+ declare function ingestRulebookChat(api: Api, args: IngestRulebookChatArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1684
+ type IngestRulebookConversationsArgs = {
1685
+ body: IngestConversationsRequest;
1686
+ };
1687
+ type IngestRulebookConversationsResult = unknown;
1688
+ /** Ingest Rulebook Conversations */
1689
+ /** `POST /masterworks/ingest-conversations` · aidream · auth guest · org required · ndjson */
1690
+ declare function ingestRulebookConversations(api: Api, args: IngestRulebookConversationsArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1691
+ type PreviewMeetingTranscriptsArgs = {
1692
+ body: MeetingPreviewRequest;
1693
+ };
1694
+ type PreviewMeetingTranscriptsResult = MeetingPreviewResponse;
1695
+ /** Preview Meeting Transcripts */
1696
+ /** `POST /masterworks/meeting/preview` · aidream · auth guest · org required */
1697
+ declare function previewMeetingTranscripts(api: Api, args: PreviewMeetingTranscriptsArgs, options?: CallOptions): Promise<PreviewMeetingTranscriptsResult>;
1698
+ type IngestRulebookMeetingArgs = {
1699
+ body: IngestMeetingRequest;
1700
+ };
1701
+ type IngestRulebookMeetingResult = unknown;
1702
+ /** Ingest Rulebook Meeting */
1703
+ /** `POST /masterworks/ingest-meeting` · aidream · auth guest · org required · ndjson */
1704
+ declare function ingestRulebookMeeting(api: Api, args: IngestRulebookMeetingArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1705
+ type InboxConnectionArgs = {
1706
+ query?: {
1707
+ rulebook_id?: string | null;
1708
+ };
1709
+ };
1710
+ type InboxConnectionResult = InboxConnectionResponse;
1711
+ /** Inbox Connection */
1712
+ /** `GET /masterworks/inbox/connection` · aidream · auth guest · org required */
1713
+ declare function inboxConnection(api: Api, args?: InboxConnectionArgs, options?: CallOptions): Promise<InboxConnectionResult>;
1714
+ type PreviewInboxThreadsArgs = {
1715
+ body: InboxPreviewRequest;
1716
+ };
1717
+ type PreviewInboxThreadsResult = InboxPreviewResponse;
1718
+ /** Preview Inbox Threads */
1719
+ /** `POST /masterworks/inbox/preview` · aidream · auth guest · org required */
1720
+ declare function previewInboxThreads(api: Api, args: PreviewInboxThreadsArgs, options?: CallOptions): Promise<PreviewInboxThreadsResult>;
1721
+ type IngestRulebookInboxArgs = {
1722
+ body: IngestInboxRequest;
1723
+ };
1724
+ type IngestRulebookInboxResult = unknown;
1725
+ /** Ingest Rulebook Inbox */
1726
+ /** `POST /masterworks/ingest-inbox` · aidream · auth guest · org required · ndjson */
1727
+ declare function ingestRulebookInbox(api: Api, args: IngestRulebookInboxArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1728
+ type AuditionMasterworkEndpointArgs = {
1729
+ body: AuditionCompareRequest;
1730
+ };
1731
+ type AuditionMasterworkEndpointResult = unknown;
1732
+ /** Audition Masterwork Endpoint */
1733
+ /** `POST /masterworks/audition` · aidream · auth guest · org required · ndjson */
1734
+ declare function auditionMasterworkEndpoint(api: Api, args: AuditionMasterworkEndpointArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1735
+ type AuditionOutcomeEndpointArgs = {
1736
+ body: AuditionOutcomeRequest;
1737
+ };
1738
+ type AuditionOutcomeEndpointResult = unknown;
1739
+ /** Audition Outcome Endpoint */
1740
+ /** `POST /masterworks/audition-outcome` · aidream · auth guest · org required · ndjson */
1741
+ declare function auditionOutcomeEndpoint(api: Api, args: AuditionOutcomeEndpointArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1742
+ type AuditionPairwiseEndpointArgs = {
1743
+ body: PairwiseCompareRequest;
1744
+ };
1745
+ type AuditionPairwiseEndpointResult = unknown;
1746
+ /** Audition Pairwise Endpoint */
1747
+ /** `POST /masterworks/audition-pairwise` · aidream · auth guest · org required · ndjson */
1748
+ declare function auditionPairwiseEndpoint(api: Api, args: AuditionPairwiseEndpointArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1749
+ type CleanExpertCorpusEndpointArgs = {
1750
+ body: CleanCorpusRequest;
1751
+ };
1752
+ type CleanExpertCorpusEndpointResult = unknown;
1753
+ /** Clean Expert Corpus Endpoint */
1754
+ /** `POST /masterworks/clean-corpus` · aidream · auth guest · org required · ndjson */
1755
+ declare function cleanExpertCorpusEndpoint(api: Api, args: CleanExpertCorpusEndpointArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1756
+ type ReadExpertCorpusArgs = {
1757
+ path: {
1758
+ rulebook_id: string;
1759
+ };
1760
+ };
1761
+ type ReadExpertCorpusResult = ExpertCorpusResponse;
1762
+ /** Read Expert Corpus */
1763
+ /** `GET /masterworks/{rulebook_id}/corpus` · aidream · auth guest · org optional */
1764
+ declare function readExpertCorpus(api: Api, args: ReadExpertCorpusArgs, options?: CallOptions): Promise<ReadExpertCorpusResult>;
1765
+ type ReadBenchProofArgs = {
1766
+ path: {
1767
+ rulebook_id: string;
1768
+ };
1769
+ };
1770
+ type ReadBenchProofResult = BenchProofResponse;
1771
+ /** Read Bench Proof */
1772
+ /** `GET /masterworks/{rulebook_id}/bench` · aidream · auth guest · org optional */
1773
+ declare function readBenchProof(api: Api, args: ReadBenchProofArgs, options?: CallOptions): Promise<ReadBenchProofResult>;
1774
+ type ReadRunEstimateArgs = {
1775
+ path: {
1776
+ masterwork_id: string;
1777
+ };
1778
+ };
1779
+ type ReadRunEstimateResult = RunEstimateResponse;
1780
+ /** Read Run Estimate */
1781
+ /** `GET /masterworks/{masterwork_id}/run-estimate` · aidream · auth guest · org optional */
1782
+ declare function readRunEstimate(api: Api, args: ReadRunEstimateArgs, options?: CallOptions): Promise<ReadRunEstimateResult>;
1783
+ type StartBenchRunArgs = {
1784
+ path: {
1785
+ rulebook_id: string;
1786
+ };
1787
+ body: BenchRunRequest;
1788
+ };
1789
+ type StartBenchRunResult = unknown;
1790
+ /** Start Bench Run */
1791
+ /** `POST /masterworks/{rulebook_id}/bench/runs` · aidream · auth guest · org required · ndjson */
1792
+ declare function startBenchRun(api: Api, args: StartBenchRunArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1793
+ type CreateSealedCaseEndpointArgs = {
1794
+ body: CreateSealedCaseRequest;
1795
+ };
1796
+ type CreateSealedCaseEndpointResult = SealedCaseSummary;
1797
+ /** Create Sealed Case Endpoint */
1798
+ /** `POST /masterworks/sealed-cases` · aidream · auth guest · org required */
1799
+ declare function createSealedCaseEndpoint(api: Api, args: CreateSealedCaseEndpointArgs, options?: CallOptions): Promise<CreateSealedCaseEndpointResult>;
1800
+ type ListSealedCasesEndpointArgs = {
1801
+ path: {
1802
+ rulebook_id: string;
1803
+ };
1804
+ };
1805
+ type ListSealedCasesEndpointResult = SealedCaseListResponse;
1806
+ /** List Sealed Cases Endpoint */
1807
+ /** `GET /masterworks/{rulebook_id}/sealed-cases` · aidream · auth guest · org optional */
1808
+ declare function listSealedCasesEndpoint(api: Api, args: ListSealedCasesEndpointArgs, options?: CallOptions): Promise<ListSealedCasesEndpointResult>;
1809
+ type CheckupMasterworkEndpointArgs = {
1810
+ body: CheckupRequest;
1811
+ };
1812
+ type CheckupMasterworkEndpointResult = unknown;
1813
+ /** Checkup Masterwork Endpoint */
1814
+ /** `POST /masterworks/checkup` · aidream · auth guest · org required · ndjson */
1815
+ declare function checkupMasterworkEndpoint(api: Api, args: CheckupMasterworkEndpointArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1816
+ type ReconcileCapturePlanRemindersEndpointArgs = {
1817
+ body: CapturePlanReminderEndpointRequest;
1818
+ };
1819
+ type ReconcileCapturePlanRemindersEndpointResult = CapturePlanReminderResponse;
1820
+ /** Reconcile Capture Plan Reminders Endpoint */
1821
+ /** `POST /masterworks/capture-plan/reminders` · aidream · auth guest · org required */
1822
+ declare function reconcileCapturePlanRemindersEndpoint(api: Api, args: ReconcileCapturePlanRemindersEndpointArgs, options?: CallOptions): Promise<ReconcileCapturePlanRemindersEndpointResult>;
1823
+ type RefreshUnderstudyEndpointArgs = {
1824
+ body: UnderstudyRefreshRequest;
1825
+ };
1826
+ type RefreshUnderstudyEndpointResult = UnderstudyRefreshResult;
1827
+ /** Refresh Understudy Endpoint */
1828
+ /** `POST /masterworks/understudy/refresh` · aidream · auth guest · org required */
1829
+ declare function refreshUnderstudyEndpoint(api: Api, args: RefreshUnderstudyEndpointArgs, options?: CallOptions): Promise<RefreshUnderstudyEndpointResult>;
1830
+ type RestoreRulebookWriteArgs = {
1831
+ body: RestoreWriteRequest;
1832
+ };
1833
+ type RestoreRulebookWriteResult = RestoreWriteResponse;
1834
+ /** Restore Rulebook Write */
1835
+ /** `POST /masterworks/rulebook/restore-write` · aidream · auth guest · org required */
1836
+ declare function restoreRulebookWrite(api: Api, args: RestoreRulebookWriteArgs, options?: CallOptions): Promise<RestoreRulebookWriteResult>;
1837
+ type CancelMasterworkRunArgs = {
1838
+ path: {
1839
+ run_id: string;
1840
+ };
1841
+ body?: CancelRunRequest | null;
1842
+ };
1843
+ type CancelMasterworkRunResult = aidream__api__routers__masterworks__CancelRunResponse;
1844
+ /** Cancel Masterwork Run */
1845
+ /** `POST /masterworks/runs/{run_id}/cancel` · aidream · auth guest · org required */
1846
+ declare function cancelMasterworkRun(api: Api, args: CancelMasterworkRunArgs, options?: CallOptions): Promise<CancelMasterworkRunResult>;
1847
+ type RejoinMasterworkRunArgs = {
1848
+ path: {
1849
+ run_id: string;
1850
+ };
1851
+ };
1852
+ type RejoinMasterworkRunResult = unknown;
1853
+ /** Rejoin Masterwork Run */
1854
+ /** `POST /masterworks/runs/{run_id}/rejoin` · aidream · auth guest · org required · ndjson */
1855
+ declare function rejoinMasterworkRun(api: Api, args: RejoinMasterworkRunArgs, options?: CallOptions): Promise<ApiStream<NdjsonEvent>>;
1856
+ /** Every JSON operation of this domain by `METHOD path` — for path-keyed calls. */
1857
+ interface Operations {
1858
+ "POST /vision-interview/sessions": {
1859
+ args: CreateInterviewSessionArgs;
1860
+ result: CreateInterviewSessionResult;
1861
+ };
1862
+ "POST /vision-interview/sessions/{session_id}/roles": {
1863
+ args: EnsureInterviewRolesArgs;
1864
+ result: EnsureInterviewRolesResult;
1865
+ };
1866
+ "POST /vision-interview/sessions/{session_id}/observe": {
1867
+ args: ObserveInterviewTurnArgs;
1868
+ result: ObserveInterviewTurnResult;
1869
+ };
1870
+ "POST /masterworks/drip/send-now": {
1871
+ args: SendTodaysDripArgs;
1872
+ result: SendTodaysDripResult;
1873
+ };
1874
+ "GET /masterworks/{rulebook_id}/predictions": {
1875
+ args: ReadPredictionLedgerArgs;
1876
+ result: ReadPredictionLedgerResult;
1877
+ };
1878
+ "POST /masterworks/chat-import/preview": {
1879
+ args: PreviewChatImportArgs;
1880
+ result: PreviewChatImportResult;
1881
+ };
1882
+ "POST /masterworks/sort/boundary": {
1883
+ args: FindRulebookSortBoundaryArgs;
1884
+ result: FindRulebookSortBoundaryResult;
1885
+ };
1886
+ "POST /masterworks/meeting/preview": {
1887
+ args: PreviewMeetingTranscriptsArgs;
1888
+ result: PreviewMeetingTranscriptsResult;
1889
+ };
1890
+ "GET /masterworks/inbox/connection": {
1891
+ args: InboxConnectionArgs;
1892
+ result: InboxConnectionResult;
1893
+ };
1894
+ "POST /masterworks/inbox/preview": {
1895
+ args: PreviewInboxThreadsArgs;
1896
+ result: PreviewInboxThreadsResult;
1897
+ };
1898
+ "GET /masterworks/{rulebook_id}/corpus": {
1899
+ args: ReadExpertCorpusArgs;
1900
+ result: ReadExpertCorpusResult;
1901
+ };
1902
+ "GET /masterworks/{rulebook_id}/bench": {
1903
+ args: ReadBenchProofArgs;
1904
+ result: ReadBenchProofResult;
1905
+ };
1906
+ "GET /masterworks/{masterwork_id}/run-estimate": {
1907
+ args: ReadRunEstimateArgs;
1908
+ result: ReadRunEstimateResult;
1909
+ };
1910
+ "POST /masterworks/sealed-cases": {
1911
+ args: CreateSealedCaseEndpointArgs;
1912
+ result: CreateSealedCaseEndpointResult;
1913
+ };
1914
+ "GET /masterworks/{rulebook_id}/sealed-cases": {
1915
+ args: ListSealedCasesEndpointArgs;
1916
+ result: ListSealedCasesEndpointResult;
1917
+ };
1918
+ "POST /masterworks/capture-plan/reminders": {
1919
+ args: ReconcileCapturePlanRemindersEndpointArgs;
1920
+ result: ReconcileCapturePlanRemindersEndpointResult;
1921
+ };
1922
+ "POST /masterworks/understudy/refresh": {
1923
+ args: RefreshUnderstudyEndpointArgs;
1924
+ result: RefreshUnderstudyEndpointResult;
1925
+ };
1926
+ "POST /masterworks/rulebook/restore-write": {
1927
+ args: RestoreRulebookWriteArgs;
1928
+ result: RestoreRulebookWriteResult;
1929
+ };
1930
+ "POST /masterworks/runs/{run_id}/cancel": {
1931
+ args: CancelMasterworkRunArgs;
1932
+ result: CancelMasterworkRunResult;
1933
+ };
1934
+ }
1935
+ /** Path-keyed call, scoped to this domain only (never a global path map). */
1936
+ declare function call<K extends keyof Operations>(api: Api, key: K, args?: Operations[K]["args"], options?: CallOptions): Promise<Operations[K]["result"]>;
1937
+
1938
+ export { type AuditionCompareRequest, type AuditionMasterworkEndpointArgs, type AuditionMasterworkEndpointResult, type AuditionOutcomeEndpointArgs, type AuditionOutcomeEndpointResult, type AuditionOutcomeRequest, type AuditionPairwiseEndpointArgs, type AuditionPairwiseEndpointResult, type BenchProof, type BenchProofResponse, type BenchRunForm, type BenchRunRequest, type BenchRunning, type BuildMasterworkEndpointArgs, type BuildMasterworkEndpointResult, type BuildMasterworkRequest, type CancelMasterworkRunArgs, type CancelMasterworkRunResult, type CancelRunRequest, type CapturePlanReminderEndpointRequest, type CapturePlanReminderResponse, type CapturePlanSessionInput, type ChatConversationPreview, type ChatImportPreviewRequest, type ChatImportPreviewResponse, type ChatShortlistRequest, type CheckupMasterworkEndpointArgs, type CheckupMasterworkEndpointResult, type CheckupRequest, type CleanCorpusRequest, type CleanExpertCorpusEndpointArgs, type CleanExpertCorpusEndpointResult, type CorpusLimitOut, type CorpusSegmentOut, type CorpusTurnOut, type CreateInterviewSessionArgs, type CreateInterviewSessionResult, type CreateSealedCaseEndpointArgs, type CreateSealedCaseEndpointResult, type CreateSealedCaseRequest, type CreateSessionRequest, type DealRulebookTriadsArgs, type DealRulebookTriadsResult, type DripSendReport, type DumpResource, type EnsureInterviewRolesArgs, type EnsureInterviewRolesResult, type ExpertCorpusResponse, type FindRulebookSortBoundaryArgs, type FindRulebookSortBoundaryResult, type FinishInterviewSessionArgs, type FinishInterviewSessionResult, type InboxConnectionArgs, type InboxConnectionResponse, type InboxConnectionResult, type InboxPreviewRequest, type InboxPreviewResponse, type InboxThreadPreview, type InboxVoicePreview, type IngestChatRequest, type IngestConversationsRequest, type IngestCorpusRequest, type IngestDripAnswersRequest, type IngestDumpRequest, type IngestFileRequest, type IngestInboxRequest, type IngestMarkupRequest, type IngestMeetingRequest, type IngestPredictionsRequest, type IngestRulebookChatArgs, type IngestRulebookChatResult, type IngestRulebookConversationsArgs, type IngestRulebookConversationsResult, type IngestRulebookCorpusArgs, type IngestRulebookCorpusResult, type IngestRulebookDripAnswersArgs, type IngestRulebookDripAnswersResult, type IngestRulebookDumpArgs, type IngestRulebookDumpResult, type IngestRulebookFileArgs, type IngestRulebookFileResult, type IngestRulebookInboxArgs, type IngestRulebookInboxResult, type IngestRulebookMarkupArgs, type IngestRulebookMarkupResult, type IngestRulebookMeetingArgs, type IngestRulebookMeetingResult, type IngestRulebookPredictionsArgs, type IngestRulebookPredictionsResult, type IngestRulebookSortAnswerArgs, type IngestRulebookSortAnswerResult, type IngestRulebookSourceArgs, type IngestRulebookSourceResult, type IngestRulebookTimelineArgs, type IngestRulebookTimelineResult, type IngestRulebookTriadArgs, type IngestRulebookTriadResult, type IngestRulebookUnfoldingArgs, type IngestRulebookUnfoldingResult, type IngestSortRequest, type IngestSourceRequest, type IngestTimelineRequest, type IngestTriadRequest, type IngestUnfoldingRequest, type ListSealedCasesEndpointArgs, type ListSealedCasesEndpointResult, type MasterworkBadExampleProbeArgs, type MasterworkBadExampleProbeResult, type MasterworkTeachBackArgs, type MasterworkTeachBackResult, type MeetingPreviewItem, type MeetingPreviewRequest, type MeetingPreviewResponse, type MeetingSpeakerPreview, type ObserveInterviewTurnArgs, type ObserveInterviewTurnResult, type ObserveTurnBody, type ObserveTurnResult, type Operations, type PairwiseCandidate, type PairwiseCompareRequest, type PredictionLedgerResponse, type PreviewChatImportArgs, type PreviewChatImportResult, type PreviewInboxThreadsArgs, type PreviewInboxThreadsResult, type PreviewMeetingTranscriptsArgs, type PreviewMeetingTranscriptsResult, type ProbeRound, type ProbeRoundRequest, type ReadBenchProofArgs, type ReadBenchProofResult, type ReadExpertCorpusArgs, type ReadExpertCorpusResult, type ReadPredictionLedgerArgs, type ReadPredictionLedgerResult, type ReadRunEstimateArgs, type ReadRunEstimateResult, type ReconcileCapturePlanRemindersEndpointArgs, type ReconcileCapturePlanRemindersEndpointResult, type RefreshUnderstudyEndpointArgs, type RefreshUnderstudyEndpointResult, type RefuseUntil, type RejoinMasterworkRunArgs, type RejoinMasterworkRunResult, type RequiredFact, type RestoreRulebookWriteArgs, type RestoreRulebookWriteResult, type RestoreWriteRequest, type RestoreWriteResponse, type RoleBinding, type RolesReadyPayload, type RulebookInterviewOut, type RunEstimateResponse, type SealedCaseListResponse, type SealedCaseSummary, type SendTodaysDripArgs, type SendTodaysDripRequest, type SendTodaysDripResult, type SessionPayload, type ShortlistChatImportArgs, type ShortlistChatImportResult, type SortBoundaryQuestion, type SortBoundaryRequest, type SortBoundaryResponse, type SortCaseGenerateRequest, type SortCasePayload, type SortPilePayload, type StartBenchRunArgs, type StartBenchRunResult, type StartInterviewSessionArgs, type StartInterviewSessionResult, type StartRunBody, type TeachBackRound, type TeachBackRoundRequest, type TimelineSourceMeta, type TriadGenerateRequest, type TriadItemPayload, type TriadPayload, type TriageDraftsRequest, type TriageRulebookDraftsArgs, type TriageRulebookDraftsResult, type UnderstudyRefreshRequest, type UnderstudyRefreshResult, type WorkCorrection, type WriteRulebookSortCasesArgs, type WriteRulebookSortCasesResult, type aidream__api__routers__masterworks__CancelRunResponse, auditionMasterworkEndpoint, auditionOutcomeEndpoint, auditionPairwiseEndpoint, buildMasterworkEndpoint, call, cancelMasterworkRun, checkupMasterworkEndpoint, cleanExpertCorpusEndpoint, createInterviewSession, createSealedCaseEndpoint, dealRulebookTriads, ensureInterviewRoles, findRulebookSortBoundary, finishInterviewSession, inboxConnection, ingestRulebookChat, ingestRulebookConversations, ingestRulebookCorpus, ingestRulebookDripAnswers, ingestRulebookDump, ingestRulebookFile, ingestRulebookInbox, ingestRulebookMarkup, ingestRulebookMeeting, ingestRulebookPredictions, ingestRulebookSortAnswer, ingestRulebookSource, ingestRulebookTimeline, ingestRulebookTriad, ingestRulebookUnfolding, listSealedCasesEndpoint, masterworkBadExampleProbe, masterworkTeachBack, observeInterviewTurn, previewChatImport, previewInboxThreads, previewMeetingTranscripts, readBenchProof, readExpertCorpus, readPredictionLedger, readRunEstimate, reconcileCapturePlanRemindersEndpoint, refreshUnderstudyEndpoint, rejoinMasterworkRun, restoreRulebookWrite, sendTodaysDrip, shortlistChatImport, startBenchRun, startInterviewSession, triageRulebookDrafts, writeRulebookSortCases };