@lucern/sdk 0.2.0-alpha.7 → 0.2.0-alpha.8

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 (257) hide show
  1. package/dist/adminClient.d.ts +409 -0
  2. package/dist/adminClient.js +755 -0
  3. package/dist/adminClient.js.map +1 -0
  4. package/dist/answersClient.d.ts +23 -0
  5. package/dist/answersClient.js +333 -0
  6. package/dist/answersClient.js.map +1 -0
  7. package/dist/audiencesClient.d.ts +99 -0
  8. package/dist/audiencesClient.js +472 -0
  9. package/dist/audiencesClient.js.map +1 -0
  10. package/dist/auditClient.d.ts +29 -0
  11. package/dist/auditClient.js +386 -0
  12. package/dist/auditClient.js.map +1 -0
  13. package/dist/beliefsClient.d.ts +162 -0
  14. package/dist/beliefsClient.js +477 -0
  15. package/dist/beliefsClient.js.map +1 -0
  16. package/dist/client.d.ts +2378 -0
  17. package/dist/client.js +6134 -0
  18. package/dist/client.js.map +1 -0
  19. package/dist/contextClient.d.ts +27 -0
  20. package/dist/contextClient.js +396 -0
  21. package/dist/contextClient.js.map +1 -0
  22. package/dist/contextFacade.d.ts +2 -0
  23. package/dist/contextFacade.js +73 -0
  24. package/dist/contextFacade.js.map +1 -0
  25. package/dist/contextPackCompiler.d.ts +102 -0
  26. package/dist/contextPackCompiler.js +1091 -0
  27. package/dist/contextPackCompiler.js.map +1 -0
  28. package/dist/contextPackPolicy.d.ts +84 -0
  29. package/dist/contextPackPolicy.js +347 -0
  30. package/dist/contextPackPolicy.js.map +1 -0
  31. package/dist/contextPackSchema.d.ts +7 -0
  32. package/{src/contextPackSchema.ts → dist/contextPackSchema.js} +22 -70
  33. package/dist/contextPackSchema.js.map +1 -0
  34. package/dist/contextTypes.d.ts +135 -0
  35. package/dist/contextTypes.js +3 -0
  36. package/dist/contextTypes.js.map +1 -0
  37. package/dist/contracts/api-enums.contract.d.ts +81 -0
  38. package/dist/contracts/api-enums.contract.js +92 -0
  39. package/dist/contracts/api-enums.contract.js.map +1 -0
  40. package/dist/contracts/auth-session.contract.d.ts +55 -0
  41. package/dist/contracts/auth-session.contract.js +48 -0
  42. package/dist/contracts/auth-session.contract.js.map +1 -0
  43. package/dist/contracts/context-pack.contract.d.ts +492 -0
  44. package/dist/contracts/context-pack.contract.js +98 -0
  45. package/dist/contracts/context-pack.contract.js.map +1 -0
  46. package/dist/contracts/contextPack.d.ts +1 -0
  47. package/dist/contracts/contextPack.js +98 -0
  48. package/dist/contracts/contextPack.js.map +1 -0
  49. package/dist/contracts/index.d.ts +9 -0
  50. package/dist/contracts/index.js +4892 -0
  51. package/dist/contracts/index.js.map +1 -0
  52. package/dist/contracts/lens-filter.contract.d.ts +72 -0
  53. package/dist/contracts/lens-filter.contract.js +71 -0
  54. package/dist/contracts/lens-filter.contract.js.map +1 -0
  55. package/dist/contracts/lens-workflow.contract.d.ts +87 -0
  56. package/dist/contracts/lens-workflow.contract.js +123 -0
  57. package/dist/contracts/lens-workflow.contract.js.map +1 -0
  58. package/dist/contracts/lensFilter.d.ts +1 -0
  59. package/dist/contracts/lensFilter.js +71 -0
  60. package/dist/contracts/lensFilter.js.map +1 -0
  61. package/dist/contracts/lensWorkflow.d.ts +2 -0
  62. package/dist/contracts/lensWorkflow.js +123 -0
  63. package/dist/contracts/lensWorkflow.js.map +1 -0
  64. package/dist/contracts/mcp-tools.contract.d.ts +1 -0
  65. package/dist/contracts/mcp-tools.contract.js +2986 -0
  66. package/dist/contracts/mcp-tools.contract.js.map +1 -0
  67. package/dist/contracts/mcpTools.d.ts +1 -0
  68. package/dist/contracts/mcpTools.js +2986 -0
  69. package/dist/contracts/mcpTools.js.map +1 -0
  70. package/dist/contracts/prompt.contract.d.ts +26 -0
  71. package/dist/contracts/prompt.contract.js +12 -0
  72. package/dist/contracts/prompt.contract.js.map +1 -0
  73. package/dist/contracts/prompt.d.ts +1 -0
  74. package/dist/contracts/prompt.js +12 -0
  75. package/dist/contracts/prompt.js.map +1 -0
  76. package/dist/contracts/sdk-tools.contract.d.ts +2 -0
  77. package/dist/contracts/sdk-tools.contract.js +4134 -0
  78. package/dist/contracts/sdk-tools.contract.js.map +1 -0
  79. package/dist/contracts/sdkTools.d.ts +2 -0
  80. package/dist/contracts/sdkTools.js +4134 -0
  81. package/dist/contracts/sdkTools.js.map +1 -0
  82. package/dist/contracts/workflow-runtime.contract.d.ts +163 -0
  83. package/dist/contracts/workflow-runtime.contract.js +245 -0
  84. package/dist/contracts/workflow-runtime.contract.js.map +1 -0
  85. package/dist/contracts/workflowRuntime.d.ts +1 -0
  86. package/dist/contracts/workflowRuntime.js +245 -0
  87. package/dist/contracts/workflowRuntime.js.map +1 -0
  88. package/dist/controlObjectOwnership.d.ts +310 -0
  89. package/{src/controlObjectOwnership.ts → dist/controlObjectOwnership.js} +53 -124
  90. package/dist/controlObjectOwnership.js.map +1 -0
  91. package/dist/coreClient.d.ts +144 -0
  92. package/dist/coreClient.js +339 -0
  93. package/dist/coreClient.js.map +1 -0
  94. package/dist/customTools.d.ts +88 -0
  95. package/dist/customTools.js +248 -0
  96. package/dist/customTools.js.map +1 -0
  97. package/dist/decisionsClient.d.ts +111 -0
  98. package/dist/decisionsClient.js +522 -0
  99. package/dist/decisionsClient.js.map +1 -0
  100. package/dist/domainContext.d.ts +1 -0
  101. package/dist/domainContext.js +3 -0
  102. package/dist/domainContext.js.map +1 -0
  103. package/dist/events.d.ts +178 -0
  104. package/dist/events.js +249 -0
  105. package/dist/events.js.map +1 -0
  106. package/dist/eventsCore.d.ts +49 -0
  107. package/dist/eventsCore.js +429 -0
  108. package/dist/eventsCore.js.map +1 -0
  109. package/dist/facade/context.d.ts +18 -0
  110. package/dist/facade/context.js +73 -0
  111. package/dist/facade/context.js.map +1 -0
  112. package/dist/gatewayFacades.d.ts +591 -0
  113. package/dist/gatewayFacades.js +1953 -0
  114. package/dist/gatewayFacades.js.map +1 -0
  115. package/dist/graphClient.d.ts +271 -0
  116. package/dist/graphClient.js +698 -0
  117. package/dist/graphClient.js.map +1 -0
  118. package/dist/harnessClient.d.ts +314 -0
  119. package/dist/harnessClient.js +607 -0
  120. package/dist/harnessClient.js.map +1 -0
  121. package/dist/identityClient.d.ts +140 -0
  122. package/dist/identityClient.js +497 -0
  123. package/dist/identityClient.js.map +1 -0
  124. package/dist/index.d.ts +42 -0
  125. package/dist/index.js +11381 -0
  126. package/dist/index.js.map +1 -0
  127. package/dist/learningClient.d.ts +46 -0
  128. package/dist/learningClient.js +409 -0
  129. package/dist/learningClient.js.map +1 -0
  130. package/dist/mcpParityClient.d.ts +74 -0
  131. package/dist/mcpParityClient.js +516 -0
  132. package/dist/mcpParityClient.js.map +1 -0
  133. package/dist/mcpParitySurface.d.ts +12 -0
  134. package/{src/mcpParitySurface.ts → dist/mcpParitySurface.js} +9 -14
  135. package/dist/mcpParitySurface.js.map +1 -0
  136. package/dist/mcpTools-DPZxowDX.d.ts +254 -0
  137. package/dist/ontologyClient.d.ts +137 -0
  138. package/dist/ontologyClient.js +513 -0
  139. package/dist/ontologyClient.js.map +1 -0
  140. package/dist/packRuntime.d.ts +2 -0
  141. package/dist/packRuntime.js +3 -0
  142. package/dist/packRuntime.js.map +1 -0
  143. package/dist/packsClient.d.ts +131 -0
  144. package/dist/packsClient.js +525 -0
  145. package/dist/packsClient.js.map +1 -0
  146. package/dist/policyClient.d.ts +299 -0
  147. package/dist/policyClient.js +625 -0
  148. package/dist/policyClient.js.map +1 -0
  149. package/dist/realtime/index.d.ts +29 -0
  150. package/dist/realtime/index.js +23 -0
  151. package/dist/realtime/index.js.map +1 -0
  152. package/{src/realtime/refs.ts → dist/realtime/refs.d.ts} +5 -5
  153. package/dist/realtime/refs.js +9 -0
  154. package/dist/realtime/refs.js.map +1 -0
  155. package/dist/reportsClient.d.ts +41 -0
  156. package/dist/reportsClient.js +418 -0
  157. package/dist/reportsClient.js.map +1 -0
  158. package/dist/schemaClient.d.ts +64 -0
  159. package/dist/schemaClient.js +434 -0
  160. package/dist/schemaClient.js.map +1 -0
  161. package/dist/sdkSurface.d.ts +61 -0
  162. package/dist/sdkSurface.js +112 -0
  163. package/dist/sdkSurface.js.map +1 -0
  164. package/dist/sdkTools-CwXJDACb.d.ts +150 -0
  165. package/dist/topicsClient.d.ts +84 -0
  166. package/dist/topicsClient.js +492 -0
  167. package/dist/topicsClient.js.map +1 -0
  168. package/dist/types.d.ts +696 -0
  169. package/dist/types.js +3 -0
  170. package/dist/types.js.map +1 -0
  171. package/dist/version.d.ts +4 -0
  172. package/dist/version.js +6 -0
  173. package/dist/version.js.map +1 -0
  174. package/dist/workflowClient.d.ts +316 -0
  175. package/dist/workflowClient.js +830 -0
  176. package/dist/workflowClient.js.map +1 -0
  177. package/package.json +31 -7
  178. package/.turbo/turbo-build.log +0 -7
  179. package/.turbo/turbo-typecheck.log +0 -4
  180. package/examples/README.md +0 -69
  181. package/examples/contradiction.ts +0 -94
  182. package/examples/investigation-context.ts +0 -118
  183. package/examples/questions-and-tasks.ts +0 -55
  184. package/examples/quickstart.ts +0 -97
  185. package/examples/shared.ts +0 -318
  186. package/examples/strict-public-types.ts +0 -143
  187. package/examples/worktree-lifecycle.ts +0 -79
  188. package/src/README.md +0 -6
  189. package/src/adminClient.ts +0 -789
  190. package/src/answersClient.ts +0 -29
  191. package/src/audiencesClient.ts +0 -209
  192. package/src/auditClient.ts +0 -50
  193. package/src/beliefsClient.ts +0 -319
  194. package/src/client.ts +0 -2647
  195. package/src/contextClient.ts +0 -130
  196. package/src/contextFacade.ts +0 -15
  197. package/src/contextPackCompiler.ts +0 -828
  198. package/src/contextTypes.ts +0 -153
  199. package/src/contracts/api-enums.contract.ts +0 -202
  200. package/src/contracts/auth-session.contract.ts +0 -109
  201. package/src/contracts/context-pack.contract.ts +0 -700
  202. package/src/contracts/contextPack.ts +0 -1
  203. package/src/contracts/index.ts +0 -10
  204. package/src/contracts/lens-filter.contract.ts +0 -183
  205. package/src/contracts/lens-workflow.contract.ts +0 -162
  206. package/src/contracts/lensFilter.ts +0 -1
  207. package/src/contracts/lensWorkflow.ts +0 -1
  208. package/src/contracts/mcp-tools.contract.ts +0 -3636
  209. package/src/contracts/mcpTools.ts +0 -1
  210. package/src/contracts/prompt.contract.ts +0 -50
  211. package/src/contracts/prompt.ts +0 -1
  212. package/src/contracts/sdk-tools.contract.ts +0 -1457
  213. package/src/contracts/sdkTools.ts +0 -1
  214. package/src/contracts/workflow-runtime.contract.ts +0 -440
  215. package/src/contracts/workflowRuntime.ts +0 -1
  216. package/src/coreClient.ts +0 -570
  217. package/src/customTools.ts +0 -398
  218. package/src/decisionsClient.ts +0 -286
  219. package/src/domainContext.ts +0 -15
  220. package/src/events.ts +0 -531
  221. package/src/eventsCore.ts +0 -168
  222. package/src/facade/beliefs.ts +0 -83
  223. package/src/facade/context.ts +0 -110
  224. package/src/facade/contradictions.ts +0 -29
  225. package/src/facade/edges.ts +0 -30
  226. package/src/facade/events.ts +0 -23
  227. package/src/facade/evidence.ts +0 -41
  228. package/src/facade/graph.ts +0 -38
  229. package/src/facade/identity.ts +0 -16
  230. package/src/facade/ontologies.ts +0 -34
  231. package/src/facade/questions.ts +0 -59
  232. package/src/facade/search.ts +0 -16
  233. package/src/facade/tasks.ts +0 -37
  234. package/src/facade/topics.ts +0 -42
  235. package/src/facade/webhooks.ts +0 -58
  236. package/src/facade/worktrees.ts +0 -51
  237. package/src/gatewayFacades.ts +0 -1666
  238. package/src/graphClient.ts +0 -529
  239. package/src/harnessClient.ts +0 -585
  240. package/src/identityClient.ts +0 -278
  241. package/src/index.ts +0 -49
  242. package/src/learningClient.ts +0 -95
  243. package/src/mcpParityClient.ts +0 -240
  244. package/src/ontologyClient.ts +0 -275
  245. package/src/packRuntime.ts +0 -3
  246. package/src/packsClient.ts +0 -260
  247. package/src/policyClient.ts +0 -572
  248. package/src/promptCatalog.ts +0 -1
  249. package/src/realtime/index.ts +0 -51
  250. package/src/reportsClient.ts +0 -99
  251. package/src/schemaClient.ts +0 -129
  252. package/src/sdkSurface.ts +0 -190
  253. package/src/topicsClient.ts +0 -243
  254. package/src/types.ts +0 -807
  255. package/src/version.ts +0 -2
  256. package/src/workflowClient.ts +0 -826
  257. package/tsconfig.json +0 -9
@@ -1,1666 +0,0 @@
1
- import {
2
- createGatewayRequestClient,
3
- randomIdempotencyKey,
4
- toQueryString,
5
- type GatewayClientConfig,
6
- type PlatformGatewaySuccess,
7
- } from "./coreClient";
8
- import {
9
- createOntologyClient,
10
- type OntologyBindingInput,
11
- } from "./ontologyClient";
12
- import { createGraphClient } from "./graphClient";
13
- import { createIdentityClient } from "./identityClient";
14
- import {
15
- createTopicsClient,
16
- type TopicBulkCreateInput,
17
- type TopicCreateInput,
18
- type TopicCoverageQuery,
19
- type TopicListInput,
20
- type TopicTreeQuery,
21
- type TopicUpdateInput,
22
- } from "./topicsClient";
23
- import type { GraphAnalyticsMetric, JsonObject } from "./types";
24
-
25
- type GatewayRecord = Record<string, unknown>;
26
- type GatewayList = GatewayRecord & { cursor?: string; total?: number };
27
-
28
- type BeliefRecord = GatewayRecord & {
29
- id?: string;
30
- beliefId?: string;
31
- nodeId?: string;
32
- };
33
-
34
- type BeliefsListResult = GatewayList & {
35
- beliefs?: BeliefRecord[];
36
- };
37
-
38
- type BeliefsLineageResult = GatewayRecord & {
39
- beliefId?: string;
40
- lineage?: GatewayRecord[];
41
- };
42
-
43
- type SearchResult = GatewayList & {
44
- beliefs?: GatewayRecord[];
45
- results?: GatewayRecord[];
46
- };
47
-
48
- type GraphNeighborhoodInput = {
49
- globalId?: string;
50
- globalIds?: string | string[];
51
- maxDepth?: number;
52
- };
53
-
54
- type GraphTraverseInput = {
55
- startNode: string;
56
- direction?: string;
57
- maxDepth?: number;
58
- topicId?: string;
59
- };
60
-
61
- type GraphAnalyzeInput = {
62
- topicId?: string;
63
- metric?: GraphAnalyticsMetric;
64
- limit?: number;
65
- };
66
-
67
- type GraphBiasInput = {
68
- topicId?: string;
69
- threshold?: number;
70
- limit?: number;
71
- };
72
-
73
- type GraphGapsInput = {
74
- topicId?: string;
75
- minConfidence?: number;
76
- };
77
-
78
- type GraphFalsifyInput = {
79
- topicId?: string;
80
- beliefId?: string;
81
- beliefIds?: string[];
82
- minConfidence?: number;
83
- };
84
-
85
- type EventsListResult = GatewayList & {
86
- events?: GatewayRecord[];
87
- };
88
-
89
- type WebhooksListResult = GatewayList & {
90
- webhooks?: GatewayRecord[];
91
- };
92
-
93
- type QuestionsListResult = GatewayList & {
94
- questions?: Array<GatewayRecord & { priority?: string }>;
95
- };
96
-
97
- type ContradictionsListResult = GatewayList & {
98
- contradictions?: GatewayRecord[];
99
- };
100
-
101
- type WorktreesListResult = GatewayList & {
102
- worktrees?: GatewayRecord[];
103
- };
104
-
105
- type TaskListResult = GatewayList & {
106
- tasks?: GatewayRecord[];
107
- };
108
-
109
- type EvidenceCreateResult = GatewayRecord & {
110
- id?: string;
111
- };
112
-
113
- type EvidenceLinkResult = GatewayRecord & {
114
- edgeId?: string;
115
- };
116
-
117
- type BeliefCreateInput = {
118
- topicId: string;
119
- text: string;
120
- rationale?: string;
121
- worktreeId?: string;
122
- pillar?: string;
123
- sourceBeliefIds?: string[];
124
- sourceType?: string;
125
- beliefType?: string;
126
- reversibility?: string;
127
- predictionMeta?: JsonObject;
128
- metadata?: JsonObject;
129
- };
130
-
131
- type BeliefsListQuery = {
132
- topicId?: string;
133
- status?: string;
134
- worktreeId?: string;
135
- minConfidence?: number;
136
- limit?: number;
137
- cursor?: string;
138
- };
139
-
140
- type BeliefRefineInput = {
141
- text: string;
142
- rationale?: string;
143
- };
144
-
145
- type BeliefForkInput = {
146
- text: string;
147
- forkReason?: string;
148
- rationale?: string;
149
- };
150
-
151
- type BeliefConfidenceInput = {
152
- confidence: number;
153
- trigger?: string;
154
- rationale: string;
155
- certainty?: number;
156
- maxInlinePropagationTargets?: number;
157
- };
158
-
159
- type BeliefArchiveInput = {
160
- reason?: string;
161
- rationale?: string;
162
- };
163
-
164
- type BeliefContractInput = GatewayRecord;
165
-
166
- type BeliefBisectInput = {
167
- expectedDirection: "overconfident" | "underconfident";
168
- timeRange?: {
169
- start: number;
170
- end: number;
171
- };
172
- };
173
-
174
- type EdgeCreateInput = {
175
- sourceId: string;
176
- targetId: string;
177
- edgeType: string;
178
- topicId?: string;
179
- confidence?: number;
180
- weight?: number;
181
- context?: string;
182
- reasoning?: string;
183
- };
184
-
185
- type EdgeListQuery = {
186
- sourceId?: string;
187
- edgeType?: string;
188
- limit?: number;
189
- cursor?: string;
190
- };
191
-
192
- type EdgeTraverseInput = {
193
- startNode: string;
194
- direction?: string;
195
- maxDepth?: number;
196
- topicId?: string;
197
- };
198
-
199
- type EvidenceCreateInput = {
200
- topicId: string;
201
- text: string;
202
- source?: string;
203
- targetId?: string;
204
- weight?: number;
205
- metadata?: JsonObject;
206
- title?: string;
207
- content?: string;
208
- contentType?: string;
209
- kind?: string;
210
- };
211
-
212
- type EvidenceListQuery = {
213
- topicId?: string;
214
- targetId?: string;
215
- limit?: number;
216
- cursor?: string;
217
- };
218
-
219
- type EvidenceSearchInput = {
220
- q: string;
221
- topicId?: string;
222
- targetId?: string;
223
- methodology?: string;
224
- limit?: number;
225
- cursor?: string;
226
- };
227
-
228
- type EvidenceLinkInput = {
229
- evidenceId: string;
230
- targetId: string;
231
- targetType?: "belief" | "question";
232
- weight?: number;
233
- rationale?: string;
234
- };
235
-
236
- type QuestionsListQuery = {
237
- topicId?: string;
238
- status?: string;
239
- priority?: string;
240
- worktreeId?: string;
241
- limit?: number;
242
- cursor?: string;
243
- };
244
-
245
- type QuestionCreateInput = {
246
- topicId: string;
247
- text: string;
248
- priority?: string;
249
- linkedBeliefId?: string;
250
- metadata?: JsonObject;
251
- };
252
-
253
- type QuestionAnswerInput = {
254
- text: string;
255
- confidence?: string;
256
- evidenceIds?: string[];
257
- rationale?: string;
258
- };
259
-
260
- type QuestionRefineInput = {
261
- text: string;
262
- rationale?: string;
263
- };
264
-
265
- type QuestionArchiveInput = {
266
- reason?: string;
267
- rationale?: string;
268
- };
269
-
270
- type QuestionStatusInput = {
271
- status: string;
272
- rationale?: string;
273
- };
274
-
275
- type SearchQueryInput = {
276
- q?: string;
277
- query?: string;
278
- topicId?: string;
279
- types?: string[];
280
- status?: string;
281
- minConfidence?: number;
282
- limit?: number;
283
- cursor?: string;
284
- };
285
-
286
- type TaskCreateInput = {
287
- topicId?: string;
288
- title: string;
289
- description?: string;
290
- taskType?: string;
291
- priority?: string;
292
- linkedBeliefId?: string;
293
- linkedQuestionId?: string;
294
- linkedWorktreeId?: string;
295
- };
296
-
297
- type TaskUpdateInput = {
298
- id: string;
299
- title?: string;
300
- description?: string;
301
- priority?: string;
302
- status?: string;
303
- linkedBeliefId?: string;
304
- linkedQuestionId?: string;
305
- linkedWorktreeId?: string;
306
- metadata?: JsonObject;
307
- };
308
-
309
- type TaskCompleteInput = {
310
- id: string;
311
- outputSummary: string;
312
- };
313
-
314
- type TaskListQuery = {
315
- topicId?: string;
316
- worktreeId?: string;
317
- status?: string;
318
- limit?: number;
319
- };
320
-
321
- type WorktreeCreateInput = {
322
- title: string;
323
- topicId?: string;
324
- objective?: string;
325
- hypothesis?: string;
326
- beliefIds?: string[];
327
- autoShape?: boolean;
328
- domainPackId?: string;
329
- executionOrder?: number;
330
- dependsOn?: string[];
331
- blocks?: string[];
332
- gate?: string;
333
- proofArtifacts?: unknown[];
334
- staffingHint?: string;
335
- lastReconciledAt?: number;
336
- autoFixPolicy?: unknown;
337
- };
338
-
339
- type WorktreeListQuery = {
340
- topicId?: string;
341
- status?: string;
342
- limit?: number;
343
- };
344
-
345
- type WorktreeActivateInput = {
346
- id: string;
347
- };
348
-
349
- type WorktreeUpdateInput = {
350
- id: string;
351
- objective?: string;
352
- hypothesis?: string;
353
- rationale?: string;
354
- track?: string;
355
- trackPosition?: number;
356
- executionBand?: number;
357
- executionOrder?: number;
358
- dependsOn?: string[];
359
- blocks?: string[];
360
- gate?: string;
361
- status?: string;
362
- topicId?: string;
363
- additionalTopicIds?: string[];
364
- proofArtifacts?: unknown[];
365
- staffingHint?: string;
366
- lastReconciledAt?: number;
367
- autoFixPolicy?: unknown;
368
- lensId?: string;
369
- };
370
-
371
- type WorktreeMergeInput = {
372
- id: string;
373
- summary?: string;
374
- outcomes: Array<{
375
- beliefId: string;
376
- confidence: number;
377
- rationale: string;
378
- }>;
379
- };
380
-
381
- type WorktreeTargetsInput = {
382
- id: string;
383
- addBeliefIds?: string[];
384
- addQuestionIds?: string[];
385
- removeBeliefIds?: string[];
386
- removeQuestionIds?: string[];
387
- };
388
-
389
- type OntologyListInput = {
390
- tenantId?: string;
391
- tier?: string;
392
- status?: string;
393
- };
394
-
395
- type OntologyMatchInput = GatewayRecord;
396
-
397
- type WebhookCreateInput = GatewayRecord;
398
- type WebhookUpdateInput = GatewayRecord;
399
- type WebhookListQuery = {
400
- topicId?: string;
401
- };
402
- type WebhookTestInput = {
403
- topicId?: string;
404
- };
405
- type WebhookDeliveriesQuery = {
406
- limit?: number;
407
- };
408
-
409
- type EventsListQuery = {
410
- topicId?: string;
411
- after?: string;
412
- types?: string[];
413
- startTime?: number;
414
- endTime?: number;
415
- limit?: number;
416
- };
417
-
418
- type ReplayEventsInput = GatewayRecord;
419
-
420
- function serializeTypes(types: string[] | undefined) {
421
- return Array.isArray(types) && types.length > 0 ? types.join(",") : undefined;
422
- }
423
-
424
- export function createBeliefsFacade(config: GatewayClientConfig = {}) {
425
- const gateway = createGatewayRequestClient(config);
426
-
427
- return {
428
- async create(
429
- input: BeliefCreateInput,
430
- idempotencyKey = randomIdempotencyKey()
431
- ): Promise<PlatformGatewaySuccess<BeliefRecord>> {
432
- return gateway.request<BeliefRecord>({
433
- path: "/api/platform/v1/beliefs",
434
- method: "POST",
435
- body: input as JsonObject,
436
- idempotencyKey,
437
- });
438
- },
439
-
440
- async get(id: string): Promise<PlatformGatewaySuccess<BeliefRecord>> {
441
- return gateway.request<BeliefRecord>({
442
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`,
443
- });
444
- },
445
-
446
- async list(
447
- query: BeliefsListQuery
448
- ): Promise<PlatformGatewaySuccess<BeliefsListResult>> {
449
- return gateway.request<BeliefsListResult>({
450
- path: `/api/platform/v1/beliefs${toQueryString({
451
- topicId: query.topicId,
452
- status: query.status,
453
- worktreeId: query.worktreeId,
454
- minConfidence: query.minConfidence,
455
- limit: query.limit,
456
- cursor: query.cursor,
457
- })}`,
458
- });
459
- },
460
-
461
- async refine(
462
- id: string,
463
- input: BeliefRefineInput,
464
- idempotencyKey = randomIdempotencyKey()
465
- ): Promise<PlatformGatewaySuccess<BeliefRecord>> {
466
- return gateway.request<BeliefRecord>({
467
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`,
468
- method: "PATCH",
469
- body: input as JsonObject,
470
- idempotencyKey,
471
- });
472
- },
473
-
474
- async fork(
475
- id: string,
476
- input: BeliefForkInput,
477
- idempotencyKey = randomIdempotencyKey()
478
- ): Promise<PlatformGatewaySuccess<BeliefRecord>> {
479
- return gateway.request<BeliefRecord>({
480
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/fork`,
481
- method: "POST",
482
- body: input as JsonObject,
483
- idempotencyKey,
484
- });
485
- },
486
-
487
- async updateConfidence(
488
- id: string,
489
- input: BeliefConfidenceInput,
490
- idempotencyKey = randomIdempotencyKey()
491
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
492
- return gateway.request<GatewayRecord>({
493
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence`,
494
- method: "POST",
495
- body: input as JsonObject,
496
- idempotencyKey,
497
- });
498
- },
499
-
500
- async updateStatus(
501
- input: {
502
- id?: string;
503
- nodeId?: string;
504
- beliefId?: string;
505
- status: "active" | "superseded" | "archived";
506
- reason?: string;
507
- },
508
- idempotencyKey = randomIdempotencyKey()
509
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
510
- return gateway.request<GatewayRecord>({
511
- path: "/api/platform/v1/beliefs/update-status",
512
- method: "POST",
513
- body: input as JsonObject,
514
- idempotencyKey,
515
- });
516
- },
517
-
518
- async updateRationale(
519
- input: {
520
- id?: string;
521
- nodeId?: string;
522
- beliefId?: string;
523
- rationale?: string;
524
- },
525
- idempotencyKey = randomIdempotencyKey()
526
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
527
- return gateway.request<GatewayRecord>({
528
- path: "/api/platform/v1/beliefs/update-rationale",
529
- method: "POST",
530
- body: input as JsonObject,
531
- idempotencyKey,
532
- });
533
- },
534
-
535
- async linkBeliefs(
536
- input: {
537
- fromNodeId: string;
538
- toNodeId: string;
539
- edgeType: string;
540
- weight?: number;
541
- context?: string;
542
- },
543
- idempotencyKey = randomIdempotencyKey()
544
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
545
- return gateway.request<GatewayRecord>({
546
- path: "/api/platform/v1/beliefs/link",
547
- method: "POST",
548
- body: input as JsonObject,
549
- idempotencyKey,
550
- });
551
- },
552
-
553
- async unlinkEvidence(
554
- input: {
555
- beliefNodeId?: string;
556
- beliefId?: string;
557
- insightId?: string;
558
- evidenceId?: string;
559
- },
560
- idempotencyKey = randomIdempotencyKey()
561
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
562
- return gateway.request<GatewayRecord>({
563
- path: "/api/platform/v1/beliefs/unlink-evidence",
564
- method: "POST",
565
- body: input as JsonObject,
566
- idempotencyKey,
567
- });
568
- },
569
-
570
- async updateCriticality(
571
- input: {
572
- id?: string;
573
- nodeId?: string;
574
- beliefId?: string;
575
- criticality: string;
576
- },
577
- idempotencyKey = randomIdempotencyKey()
578
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
579
- return gateway.request<GatewayRecord>({
580
- path: "/api/platform/v1/beliefs/update-criticality",
581
- method: "POST",
582
- body: input as JsonObject,
583
- idempotencyKey,
584
- });
585
- },
586
-
587
- async batchUpdateCriticality(
588
- input: {
589
- updates: GatewayRecord[];
590
- },
591
- idempotencyKey = randomIdempotencyKey()
592
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
593
- return gateway.request<GatewayRecord>({
594
- path: "/api/platform/v1/beliefs/batch-update-criticality",
595
- method: "POST",
596
- body: input as JsonObject,
597
- idempotencyKey,
598
- });
599
- },
600
-
601
- async reassignTopic(
602
- input: {
603
- beliefNodeIds?: string[];
604
- beliefIds?: string[];
605
- targetTopicId: string;
606
- reason?: string;
607
- },
608
- idempotencyKey = randomIdempotencyKey()
609
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
610
- return gateway.request<GatewayRecord>({
611
- path: "/api/platform/v1/beliefs/reassign-topic",
612
- method: "POST",
613
- body: input as JsonObject,
614
- idempotencyKey,
615
- });
616
- },
617
-
618
- async archive(
619
- id: string,
620
- input: BeliefArchiveInput = {},
621
- idempotencyKey = randomIdempotencyKey()
622
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
623
- return gateway.request<GatewayRecord>({
624
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`,
625
- method: "DELETE",
626
- body: input as JsonObject,
627
- idempotencyKey,
628
- });
629
- },
630
-
631
- async lineage(
632
- id: string
633
- ): Promise<PlatformGatewaySuccess<BeliefsLineageResult>> {
634
- return gateway.request<BeliefsLineageResult>({
635
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/lineage`,
636
- });
637
- },
638
-
639
- async confidenceHistory(
640
- id: string
641
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
642
- return gateway.request<GatewayRecord>({
643
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence-history`,
644
- });
645
- },
646
-
647
- async createContract(
648
- id: string,
649
- input: BeliefContractInput,
650
- idempotencyKey = randomIdempotencyKey()
651
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
652
- return gateway.request<GatewayRecord>({
653
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/contracts`,
654
- method: "POST",
655
- body: input as JsonObject,
656
- idempotencyKey,
657
- });
658
- },
659
-
660
- async bisect(
661
- id: string,
662
- input: BeliefBisectInput,
663
- idempotencyKey = randomIdempotencyKey()
664
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
665
- return gateway.request<GatewayRecord>({
666
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/bisect`,
667
- method: "POST",
668
- body: input as JsonObject,
669
- idempotencyKey,
670
- });
671
- },
672
- };
673
- }
674
-
675
- export function createContradictionsFacade(config: GatewayClientConfig = {}) {
676
- const gateway = createGatewayRequestClient(config);
677
-
678
- return {
679
- async flag(
680
- input: GatewayRecord,
681
- idempotencyKey = randomIdempotencyKey()
682
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
683
- return gateway.request<GatewayRecord>({
684
- path: "/api/platform/v1/contradictions",
685
- method: "POST",
686
- body: input as JsonObject,
687
- idempotencyKey,
688
- });
689
- },
690
-
691
- async list(
692
- query: {
693
- topicId?: string;
694
- status?: string;
695
- limit?: number;
696
- cursor?: string;
697
- }
698
- ): Promise<PlatformGatewaySuccess<ContradictionsListResult>> {
699
- return gateway.request<ContradictionsListResult>({
700
- path: `/api/platform/v1/contradictions${toQueryString({
701
- topicId: query.topicId,
702
- status: query.status,
703
- limit: query.limit,
704
- cursor: query.cursor,
705
- })}`,
706
- });
707
- },
708
-
709
- async get(id: string): Promise<PlatformGatewaySuccess<GatewayRecord>> {
710
- return gateway.request<GatewayRecord>({
711
- path: `/api/platform/v1/contradictions/${encodeURIComponent(id)}`,
712
- });
713
- },
714
- };
715
- }
716
-
717
- export function createEdgesFacade(config: GatewayClientConfig = {}) {
718
- const gateway = createGatewayRequestClient(config);
719
-
720
- return {
721
- async create(
722
- input: EdgeCreateInput,
723
- idempotencyKey = randomIdempotencyKey()
724
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
725
- return gateway.request<GatewayRecord>({
726
- path: "/api/platform/v1/edges",
727
- method: "POST",
728
- body: input as JsonObject,
729
- idempotencyKey,
730
- });
731
- },
732
-
733
- async list(
734
- query: EdgeListQuery
735
- ): Promise<PlatformGatewaySuccess<GatewayList>> {
736
- return gateway.request<GatewayList>({
737
- path: `/api/platform/v1/edges${toQueryString({
738
- sourceId: query.sourceId,
739
- edgeType: query.edgeType,
740
- limit: query.limit,
741
- cursor: query.cursor,
742
- })}`,
743
- });
744
- },
745
-
746
- async traverse(
747
- input: EdgeTraverseInput,
748
- idempotencyKey = randomIdempotencyKey()
749
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
750
- return gateway.request<GatewayRecord>({
751
- path: "/api/platform/v1/edges/traverse",
752
- method: "POST",
753
- body: input as JsonObject,
754
- idempotencyKey,
755
- });
756
- },
757
-
758
- async update(
759
- input: {
760
- edgeId: string;
761
- weight?: number;
762
- confidence?: number;
763
- context?: string;
764
- derivationType?: string;
765
- },
766
- idempotencyKey = randomIdempotencyKey()
767
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
768
- return gateway.request<GatewayRecord>({
769
- path: "/api/platform/v1/edges/update",
770
- method: "POST",
771
- body: input as JsonObject,
772
- idempotencyKey,
773
- });
774
- },
775
-
776
- async remove(
777
- input: { edgeId: string },
778
- idempotencyKey = randomIdempotencyKey()
779
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
780
- return gateway.request<GatewayRecord>({
781
- path: "/api/platform/v1/edges/remove",
782
- method: "POST",
783
- body: input as JsonObject,
784
- idempotencyKey,
785
- });
786
- },
787
-
788
- async removeBetween(
789
- input: {
790
- fromNodeId: string;
791
- toNodeId: string;
792
- edgeType?: string;
793
- },
794
- idempotencyKey = randomIdempotencyKey()
795
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
796
- return gateway.request<GatewayRecord>({
797
- path: "/api/platform/v1/edges/remove-between",
798
- method: "POST",
799
- body: input as JsonObject,
800
- idempotencyKey,
801
- });
802
- },
803
-
804
- async batchCreate(
805
- input: {
806
- edges: GatewayRecord[];
807
- skipLayerValidation?: boolean;
808
- },
809
- idempotencyKey = randomIdempotencyKey()
810
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
811
- return gateway.request<GatewayRecord>({
812
- path: "/api/platform/v1/edges/batch",
813
- method: "POST",
814
- body: input as JsonObject,
815
- idempotencyKey,
816
- });
817
- },
818
-
819
- async delete(
820
- input: { edgeIds: string[] },
821
- idempotencyKey = randomIdempotencyKey()
822
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
823
- return gateway.request<GatewayRecord>({
824
- path: "/api/platform/v1/edges/delete",
825
- method: "POST",
826
- body: input as JsonObject,
827
- idempotencyKey,
828
- });
829
- },
830
- };
831
- }
832
-
833
- export function createEvidenceFacade(config: GatewayClientConfig = {}) {
834
- const gateway = createGatewayRequestClient(config);
835
-
836
- return {
837
- async create(
838
- input: EvidenceCreateInput,
839
- idempotencyKey = randomIdempotencyKey()
840
- ): Promise<PlatformGatewaySuccess<EvidenceCreateResult>> {
841
- return gateway.request<EvidenceCreateResult>({
842
- path: "/api/platform/v1/evidence",
843
- method: "POST",
844
- body: input as JsonObject,
845
- idempotencyKey,
846
- });
847
- },
848
-
849
- async get(id: string): Promise<PlatformGatewaySuccess<GatewayRecord>> {
850
- return gateway.request<GatewayRecord>({
851
- path: `/api/platform/v1/evidence/${encodeURIComponent(id)}`,
852
- });
853
- },
854
-
855
- async list(
856
- query: EvidenceListQuery
857
- ): Promise<PlatformGatewaySuccess<GatewayList>> {
858
- return gateway.request<GatewayList>({
859
- path: `/api/platform/v1/evidence${toQueryString({
860
- topicId: query.topicId,
861
- targetId: query.targetId,
862
- limit: query.limit,
863
- cursor: query.cursor,
864
- })}`,
865
- });
866
- },
867
-
868
- async link(
869
- input: EvidenceLinkInput,
870
- idempotencyKey = randomIdempotencyKey()
871
- ): Promise<PlatformGatewaySuccess<EvidenceLinkResult>> {
872
- return gateway.request<EvidenceLinkResult>({
873
- path: `/api/platform/v1/evidence/${encodeURIComponent(input.evidenceId)}/link`,
874
- method: "POST",
875
- body: {
876
- targetId: input.targetId,
877
- targetType: input.targetType,
878
- weight: input.weight,
879
- rationale: input.rationale,
880
- } as JsonObject,
881
- idempotencyKey,
882
- });
883
- },
884
-
885
- async search(
886
- query: EvidenceSearchInput,
887
- idempotencyKey = randomIdempotencyKey()
888
- ): Promise<PlatformGatewaySuccess<GatewayList>> {
889
- return gateway.request<GatewayList>({
890
- path: "/api/platform/v1/evidence/search",
891
- method: "POST",
892
- body: query as JsonObject,
893
- idempotencyKey,
894
- });
895
- },
896
-
897
- async updateStatus(
898
- input: GatewayRecord,
899
- idempotencyKey = randomIdempotencyKey()
900
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
901
- return gateway.request<GatewayRecord>({
902
- path: "/api/platform/v1/evidence/update-status",
903
- method: "POST",
904
- body: input as JsonObject,
905
- idempotencyKey,
906
- });
907
- },
908
-
909
- async update(
910
- input: GatewayRecord,
911
- idempotencyKey = randomIdempotencyKey()
912
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
913
- return gateway.request<GatewayRecord>({
914
- path: "/api/platform/v1/evidence/update",
915
- method: "POST",
916
- body: input as JsonObject,
917
- idempotencyKey,
918
- });
919
- },
920
-
921
- async flagIncorrect(
922
- input: GatewayRecord,
923
- idempotencyKey = randomIdempotencyKey()
924
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
925
- return gateway.request<GatewayRecord>({
926
- path: "/api/platform/v1/evidence/flag-incorrect",
927
- method: "POST",
928
- body: input as JsonObject,
929
- idempotencyKey,
930
- });
931
- },
932
-
933
- async remove(
934
- input: GatewayRecord,
935
- idempotencyKey = randomIdempotencyKey()
936
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
937
- return gateway.request<GatewayRecord>({
938
- path: "/api/platform/v1/evidence/remove",
939
- method: "POST",
940
- body: input as JsonObject,
941
- idempotencyKey,
942
- });
943
- },
944
-
945
- async updateVerificationStatus(
946
- input: GatewayRecord,
947
- idempotencyKey = randomIdempotencyKey()
948
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
949
- return gateway.request<GatewayRecord>({
950
- path: "/api/platform/v1/evidence/update-verification-status",
951
- method: "POST",
952
- body: input as JsonObject,
953
- idempotencyKey,
954
- });
955
- },
956
- };
957
- }
958
-
959
- export function createEventsFacade(config: GatewayClientConfig = {}) {
960
- const gateway = createGatewayRequestClient(config);
961
-
962
- return {
963
- async list(
964
- query: EventsListQuery = {}
965
- ): Promise<PlatformGatewaySuccess<EventsListResult>> {
966
- return gateway.request<EventsListResult>({
967
- path: `/api/platform/v1/events${toQueryString({
968
- topicId: query.topicId,
969
- after: query.after,
970
- types: serializeTypes(query.types),
971
- startTime: query.startTime,
972
- endTime: query.endTime,
973
- limit: query.limit,
974
- })}`,
975
- });
976
- },
977
-
978
- async replay(
979
- input: ReplayEventsInput,
980
- idempotencyKey = randomIdempotencyKey()
981
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
982
- return gateway.request<GatewayRecord>({
983
- path: "/api/platform/v1/events/replay",
984
- method: "POST",
985
- body: input as JsonObject,
986
- idempotencyKey,
987
- });
988
- },
989
- };
990
- }
991
-
992
- export function createGraphFacade(config: GatewayClientConfig = {}) {
993
- const graphClient = createGraphClient(config);
994
- const gateway = createGatewayRequestClient(config);
995
-
996
- return {
997
- async neighborhood(input: GraphNeighborhoodInput) {
998
- return graphClient.neighborhood({
999
- globalId: input.globalId,
1000
- globalIds: Array.isArray(input.globalIds)
1001
- ? input.globalIds.join(",")
1002
- : input.globalIds,
1003
- maxDepth: input.maxDepth,
1004
- });
1005
- },
1006
-
1007
- async traverse(input: GraphTraverseInput) {
1008
- return graphClient.traverse(input);
1009
- },
1010
-
1011
- async analyze(input: GraphAnalyzeInput = {}) {
1012
- return graphClient.analyze(input);
1013
- },
1014
-
1015
- async bias(input: GraphBiasInput = {}) {
1016
- return graphClient.bias(input);
1017
- },
1018
-
1019
- async gaps(input: GraphGapsInput) {
1020
- return graphClient.gaps(input);
1021
- },
1022
-
1023
- async falsify(
1024
- input: GraphFalsifyInput,
1025
- idempotencyKey = randomIdempotencyKey()
1026
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1027
- return gateway.request<GatewayRecord>({
1028
- path: "/api/platform/v1/graph/falsify",
1029
- method: "POST",
1030
- body: input as JsonObject,
1031
- idempotencyKey,
1032
- });
1033
- },
1034
- };
1035
- }
1036
-
1037
- export function createIdentityFacade(config: GatewayClientConfig = {}) {
1038
- const identityClient = createIdentityClient(config);
1039
-
1040
- return {
1041
- async whoami() {
1042
- const response = await identityClient.whoami();
1043
- return Object.assign({}, response, response.data);
1044
- },
1045
- };
1046
- }
1047
-
1048
- export function createOntologiesFacade(config: GatewayClientConfig = {}) {
1049
- const ontologyClient = createOntologyClient(config);
1050
- const gateway = createGatewayRequestClient(config);
1051
-
1052
- return {
1053
- async get(id: string): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1054
- return gateway.request<GatewayRecord>({
1055
- path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`,
1056
- });
1057
- },
1058
-
1059
- async list(query: OntologyListInput = {}) {
1060
- return ontologyClient.list(query);
1061
- },
1062
-
1063
- async bind(
1064
- input: OntologyBindingInput,
1065
- idempotencyKey?: string
1066
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1067
- return gateway.request<GatewayRecord>({
1068
- path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
1069
- method: "POST",
1070
- body: {
1071
- topicId: input.topicId,
1072
- } as JsonObject,
1073
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
1074
- });
1075
- },
1076
-
1077
- async match(
1078
- input: OntologyMatchInput,
1079
- idempotencyKey?: string
1080
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1081
- return gateway.request<GatewayRecord>({
1082
- path: "/api/platform/v1/ontologies/match",
1083
- method: "POST",
1084
- body: input as JsonObject,
1085
- idempotencyKey,
1086
- });
1087
- },
1088
- };
1089
- }
1090
-
1091
- export function createQuestionsFacade(config: GatewayClientConfig = {}) {
1092
- const gateway = createGatewayRequestClient(config);
1093
-
1094
- return {
1095
- async create(
1096
- input: QuestionCreateInput,
1097
- idempotencyKey = randomIdempotencyKey()
1098
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1099
- return gateway.request<GatewayRecord>({
1100
- path: "/api/platform/v1/questions",
1101
- method: "POST",
1102
- body: input as JsonObject,
1103
- idempotencyKey,
1104
- });
1105
- },
1106
-
1107
- async get(id: string): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1108
- return gateway.request<GatewayRecord>({
1109
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}`,
1110
- });
1111
- },
1112
-
1113
- async list(
1114
- query: QuestionsListQuery
1115
- ): Promise<PlatformGatewaySuccess<QuestionsListResult>> {
1116
- return gateway.request<QuestionsListResult>({
1117
- path: `/api/platform/v1/questions${toQueryString({
1118
- topicId: query.topicId,
1119
- status: query.status,
1120
- priority: query.priority,
1121
- worktreeId: query.worktreeId,
1122
- limit: query.limit,
1123
- cursor: query.cursor,
1124
- })}`,
1125
- });
1126
- },
1127
-
1128
- async answer(
1129
- id: string,
1130
- input: QuestionAnswerInput,
1131
- idempotencyKey = randomIdempotencyKey()
1132
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1133
- return gateway.request<GatewayRecord>({
1134
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}/answer`,
1135
- method: "POST",
1136
- body: input as JsonObject,
1137
- idempotencyKey,
1138
- });
1139
- },
1140
-
1141
- async refine(
1142
- id: string,
1143
- input: QuestionRefineInput,
1144
- idempotencyKey = randomIdempotencyKey()
1145
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1146
- return gateway.request<GatewayRecord>({
1147
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}/refine`,
1148
- method: "POST",
1149
- body: input as JsonObject,
1150
- idempotencyKey,
1151
- });
1152
- },
1153
-
1154
- async archive(
1155
- id: string,
1156
- input: QuestionArchiveInput = {},
1157
- idempotencyKey = randomIdempotencyKey()
1158
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1159
- return gateway.request<GatewayRecord>({
1160
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}`,
1161
- method: "DELETE",
1162
- body: input as JsonObject,
1163
- idempotencyKey,
1164
- });
1165
- },
1166
-
1167
- async updateStatus(
1168
- id: string,
1169
- input: QuestionStatusInput,
1170
- idempotencyKey = randomIdempotencyKey()
1171
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1172
- return gateway.request<GatewayRecord>({
1173
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}/status`,
1174
- method: "PATCH",
1175
- body: input as JsonObject,
1176
- idempotencyKey,
1177
- });
1178
- },
1179
-
1180
- async batchCreate(
1181
- input: GatewayRecord,
1182
- idempotencyKey = randomIdempotencyKey()
1183
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1184
- return gateway.request<GatewayRecord>({
1185
- path: "/api/platform/v1/questions/batch",
1186
- method: "POST",
1187
- body: input as JsonObject,
1188
- idempotencyKey,
1189
- });
1190
- },
1191
-
1192
- async add(
1193
- input: GatewayRecord,
1194
- idempotencyKey = randomIdempotencyKey()
1195
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1196
- return gateway.request<GatewayRecord>({
1197
- path: "/api/platform/v1/questions/add",
1198
- method: "POST",
1199
- body: input as JsonObject,
1200
- idempotencyKey,
1201
- });
1202
- },
1203
-
1204
- async updatePriority(
1205
- input: GatewayRecord,
1206
- idempotencyKey = randomIdempotencyKey()
1207
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1208
- return gateway.request<GatewayRecord>({
1209
- path: "/api/platform/v1/questions/update-priority",
1210
- method: "POST",
1211
- body: input as JsonObject,
1212
- idempotencyKey,
1213
- });
1214
- },
1215
-
1216
- async advanceToConviction(
1217
- input: GatewayRecord,
1218
- idempotencyKey = randomIdempotencyKey()
1219
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1220
- return gateway.request<GatewayRecord>({
1221
- path: "/api/platform/v1/questions/advance-to-conviction",
1222
- method: "POST",
1223
- body: input as JsonObject,
1224
- idempotencyKey,
1225
- });
1226
- },
1227
-
1228
- async updateConviction(
1229
- input: GatewayRecord,
1230
- idempotencyKey = randomIdempotencyKey()
1231
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1232
- return gateway.request<GatewayRecord>({
1233
- path: "/api/platform/v1/questions/update-conviction",
1234
- method: "POST",
1235
- body: input as JsonObject,
1236
- idempotencyKey,
1237
- });
1238
- },
1239
-
1240
- async finalizeConviction(
1241
- input: GatewayRecord,
1242
- idempotencyKey = randomIdempotencyKey()
1243
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1244
- return gateway.request<GatewayRecord>({
1245
- path: "/api/platform/v1/questions/finalize-conviction",
1246
- method: "POST",
1247
- body: input as JsonObject,
1248
- idempotencyKey,
1249
- });
1250
- },
1251
-
1252
- async update(
1253
- input: GatewayRecord,
1254
- idempotencyKey = randomIdempotencyKey()
1255
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1256
- return gateway.request<GatewayRecord>({
1257
- path: "/api/platform/v1/questions/update",
1258
- method: "POST",
1259
- body: input as JsonObject,
1260
- idempotencyKey,
1261
- });
1262
- },
1263
-
1264
- async delete(
1265
- input: GatewayRecord,
1266
- idempotencyKey = randomIdempotencyKey()
1267
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1268
- return gateway.request<GatewayRecord>({
1269
- path: "/api/platform/v1/questions/delete",
1270
- method: "POST",
1271
- body: input as JsonObject,
1272
- idempotencyKey,
1273
- });
1274
- },
1275
- };
1276
- }
1277
-
1278
- export function createSearchFacade(config: GatewayClientConfig = {}) {
1279
- const gateway = createGatewayRequestClient(config);
1280
-
1281
- return {
1282
- async query(
1283
- input: SearchQueryInput
1284
- ): Promise<PlatformGatewaySuccess<SearchResult>> {
1285
- return gateway.request<SearchResult>({
1286
- path: "/api/platform/v1/search",
1287
- method: "POST",
1288
- body: input as JsonObject,
1289
- });
1290
- },
1291
- };
1292
- }
1293
-
1294
- export function createTasksFacade(config: GatewayClientConfig = {}) {
1295
- const gateway = createGatewayRequestClient(config);
1296
-
1297
- return {
1298
- async create(
1299
- input: TaskCreateInput,
1300
- idempotencyKey = randomIdempotencyKey()
1301
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1302
- return gateway.request<GatewayRecord>({
1303
- path: "/api/platform/v1/tasks",
1304
- method: "POST",
1305
- body: input as JsonObject,
1306
- idempotencyKey,
1307
- });
1308
- },
1309
-
1310
- async update(
1311
- input: TaskUpdateInput,
1312
- idempotencyKey = randomIdempotencyKey()
1313
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1314
- return gateway.request<GatewayRecord>({
1315
- path: `/api/platform/v1/tasks/${encodeURIComponent(input.id)}`,
1316
- method: "PATCH",
1317
- body: {
1318
- title: input.title,
1319
- description: input.description,
1320
- priority: input.priority,
1321
- status: input.status,
1322
- linkedBeliefId: input.linkedBeliefId,
1323
- linkedQuestionId: input.linkedQuestionId,
1324
- linkedWorktreeId: input.linkedWorktreeId,
1325
- metadata: input.metadata,
1326
- } as JsonObject,
1327
- idempotencyKey,
1328
- });
1329
- },
1330
-
1331
- async complete(
1332
- input: TaskCompleteInput,
1333
- idempotencyKey = randomIdempotencyKey()
1334
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1335
- return gateway.request<GatewayRecord>({
1336
- path: `/api/platform/v1/tasks/${encodeURIComponent(input.id)}/complete`,
1337
- method: "POST",
1338
- body: {
1339
- outputSummary: input.outputSummary,
1340
- } as JsonObject,
1341
- idempotencyKey,
1342
- });
1343
- },
1344
-
1345
- async list(
1346
- query: TaskListQuery
1347
- ): Promise<PlatformGatewaySuccess<TaskListResult>> {
1348
- return gateway.request<TaskListResult>({
1349
- path: `/api/platform/v1/tasks${toQueryString({
1350
- topicId: query.topicId,
1351
- worktreeId: query.worktreeId,
1352
- status: query.status,
1353
- limit: query.limit,
1354
- })}`,
1355
- });
1356
- },
1357
- };
1358
- }
1359
-
1360
- export function createTopicsFacade(config: GatewayClientConfig = {}) {
1361
- const topicsClient = createTopicsClient(config);
1362
-
1363
- return {
1364
- async create(input: TopicCreateInput, idempotencyKey?: string) {
1365
- return topicsClient.create(input, idempotencyKey);
1366
- },
1367
-
1368
- async get(id: string) {
1369
- return topicsClient.get(id);
1370
- },
1371
-
1372
- async list(query: TopicListInput = {}) {
1373
- return topicsClient.list(query);
1374
- },
1375
-
1376
- async update(
1377
- input: TopicUpdateInput & { id: string },
1378
- idempotencyKey?: string
1379
- ) {
1380
- const { id, ...rest } = input;
1381
- return topicsClient.update(id, rest, idempotencyKey);
1382
- },
1383
-
1384
- async tree(input: TopicTreeQuery & { id: string }) {
1385
- return topicsClient.getTree(input.id, {
1386
- maxDepth: input.maxDepth,
1387
- });
1388
- },
1389
-
1390
- async coverage(input: TopicCoverageQuery & { id: string }) {
1391
- return topicsClient.getCoverage(input.id, {
1392
- includeDescendants: input.includeDescendants,
1393
- maxDepth: input.maxDepth,
1394
- });
1395
- },
1396
-
1397
- async remove(id: string, idempotencyKey = randomIdempotencyKey()) {
1398
- return topicsClient.remove(id, idempotencyKey);
1399
- },
1400
-
1401
- async bulkCreate(
1402
- input: TopicBulkCreateInput,
1403
- idempotencyKey = randomIdempotencyKey()
1404
- ) {
1405
- return topicsClient.bulkCreate(input, idempotencyKey);
1406
- },
1407
- };
1408
- }
1409
-
1410
- export function createWebhooksFacade(config: GatewayClientConfig = {}) {
1411
- const gateway = createGatewayRequestClient(config);
1412
-
1413
- return {
1414
- async create(
1415
- input: WebhookCreateInput,
1416
- idempotencyKey = randomIdempotencyKey()
1417
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1418
- return gateway.request<GatewayRecord>({
1419
- path: "/api/platform/v1/webhooks",
1420
- method: "POST",
1421
- body: input as JsonObject,
1422
- idempotencyKey,
1423
- });
1424
- },
1425
-
1426
- async list(
1427
- query: WebhookListQuery = {}
1428
- ): Promise<PlatformGatewaySuccess<WebhooksListResult>> {
1429
- return gateway.request<WebhooksListResult>({
1430
- path: `/api/platform/v1/webhooks${toQueryString({
1431
- topicId: query.topicId,
1432
- })}`,
1433
- });
1434
- },
1435
-
1436
- async get(id: string): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1437
- return gateway.request<GatewayRecord>({
1438
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}`,
1439
- });
1440
- },
1441
-
1442
- async update(
1443
- id: string,
1444
- input: WebhookUpdateInput,
1445
- idempotencyKey = randomIdempotencyKey()
1446
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1447
- return gateway.request<GatewayRecord>({
1448
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}`,
1449
- method: "PATCH",
1450
- body: input as JsonObject,
1451
- idempotencyKey,
1452
- });
1453
- },
1454
-
1455
- async delete(
1456
- id: string,
1457
- idempotencyKey = randomIdempotencyKey()
1458
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1459
- return gateway.request<GatewayRecord>({
1460
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}`,
1461
- method: "DELETE",
1462
- idempotencyKey,
1463
- });
1464
- },
1465
-
1466
- async test(
1467
- id: string,
1468
- input: WebhookTestInput = {},
1469
- idempotencyKey = randomIdempotencyKey()
1470
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1471
- return gateway.request<GatewayRecord>({
1472
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/test`,
1473
- method: "POST",
1474
- body: input as JsonObject,
1475
- idempotencyKey,
1476
- });
1477
- },
1478
-
1479
- async deliveries(
1480
- id: string,
1481
- query: WebhookDeliveriesQuery = {}
1482
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1483
- return gateway.request<GatewayRecord>({
1484
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/deliveries${toQueryString({
1485
- limit: query.limit,
1486
- })}`,
1487
- });
1488
- },
1489
-
1490
- async health(id: string): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1491
- return gateway.request<GatewayRecord>({
1492
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/health`,
1493
- });
1494
- },
1495
- };
1496
- }
1497
-
1498
- export function createWorktreesFacade(config: GatewayClientConfig = {}) {
1499
- const gateway = createGatewayRequestClient(config);
1500
-
1501
- return {
1502
- async create(
1503
- input: WorktreeCreateInput,
1504
- idempotencyKey = randomIdempotencyKey()
1505
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1506
- return gateway.request<GatewayRecord>({
1507
- path: "/api/platform/v1/worktrees",
1508
- method: "POST",
1509
- body: input as JsonObject,
1510
- idempotencyKey,
1511
- });
1512
- },
1513
-
1514
- async list(
1515
- query: WorktreeListQuery
1516
- ): Promise<PlatformGatewaySuccess<WorktreesListResult>> {
1517
- return gateway.request<WorktreesListResult>({
1518
- path: `/api/platform/v1/worktrees${toQueryString({
1519
- topicId: query.topicId,
1520
- status: query.status,
1521
- limit: query.limit,
1522
- })}`,
1523
- });
1524
- },
1525
-
1526
- async activate(
1527
- input: WorktreeActivateInput,
1528
- idempotencyKey = randomIdempotencyKey()
1529
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1530
- return gateway.request<GatewayRecord>({
1531
- path: `/api/platform/v1/worktrees/${encodeURIComponent(input.id)}/activate`,
1532
- method: "POST",
1533
- body: {} as JsonObject,
1534
- idempotencyKey,
1535
- });
1536
- },
1537
-
1538
- async update(
1539
- input: WorktreeUpdateInput,
1540
- idempotencyKey = randomIdempotencyKey()
1541
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1542
- return gateway.request<GatewayRecord>({
1543
- path: `/api/platform/v1/worktrees/${encodeURIComponent(input.id)}`,
1544
- method: "PATCH",
1545
- body: {
1546
- objective: input.objective,
1547
- hypothesis: input.hypothesis,
1548
- rationale: input.rationale,
1549
- track: input.track,
1550
- trackPosition: input.trackPosition,
1551
- executionBand: input.executionBand,
1552
- executionOrder: input.executionOrder,
1553
- dependsOn: input.dependsOn,
1554
- blocks: input.blocks,
1555
- gate: input.gate,
1556
- status: input.status,
1557
- topicId: input.topicId,
1558
- additionalTopicIds: input.additionalTopicIds,
1559
- proofArtifacts: input.proofArtifacts,
1560
- staffingHint: input.staffingHint,
1561
- lastReconciledAt: input.lastReconciledAt,
1562
- autoFixPolicy: input.autoFixPolicy,
1563
- lensId: input.lensId,
1564
- } as JsonObject,
1565
- idempotencyKey,
1566
- });
1567
- },
1568
-
1569
- async merge(
1570
- input: WorktreeMergeInput,
1571
- idempotencyKey = randomIdempotencyKey()
1572
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1573
- return gateway.request<GatewayRecord>({
1574
- path: `/api/platform/v1/worktrees/${encodeURIComponent(input.id)}/merge`,
1575
- method: "POST",
1576
- body: {
1577
- summary: input.summary,
1578
- outcomes: input.outcomes,
1579
- } as JsonObject,
1580
- idempotencyKey,
1581
- });
1582
- },
1583
-
1584
- async updateTargets(
1585
- input: WorktreeTargetsInput,
1586
- idempotencyKey = randomIdempotencyKey()
1587
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1588
- return gateway.request<GatewayRecord>({
1589
- path: `/api/platform/v1/worktrees/${encodeURIComponent(input.id)}/targets`,
1590
- method: "POST",
1591
- body: {
1592
- addBeliefIds: input.addBeliefIds,
1593
- addQuestionIds: input.addQuestionIds,
1594
- removeBeliefIds: input.removeBeliefIds,
1595
- removeQuestionIds: input.removeQuestionIds,
1596
- } as JsonObject,
1597
- idempotencyKey,
1598
- });
1599
- },
1600
-
1601
- async complete(
1602
- input: {
1603
- worktreeId: string;
1604
- keyFindings?: string[];
1605
- decisionsReached?: string[];
1606
- nextSteps?: string[];
1607
- },
1608
- idempotencyKey = randomIdempotencyKey()
1609
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1610
- return gateway.request<GatewayRecord>({
1611
- path: "/api/platform/v1/worktrees/complete",
1612
- method: "POST",
1613
- body: input as JsonObject,
1614
- idempotencyKey,
1615
- });
1616
- },
1617
-
1618
- async advancePhase(
1619
- input: { worktreeId: string },
1620
- idempotencyKey = randomIdempotencyKey()
1621
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1622
- return gateway.request<GatewayRecord>({
1623
- path: "/api/platform/v1/worktrees/advance-phase",
1624
- method: "POST",
1625
- body: input as JsonObject,
1626
- idempotencyKey,
1627
- });
1628
- },
1629
-
1630
- async setPhase(
1631
- input: { worktreeId: string; phase: string },
1632
- idempotencyKey = randomIdempotencyKey()
1633
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1634
- return gateway.request<GatewayRecord>({
1635
- path: "/api/platform/v1/worktrees/set-phase",
1636
- method: "POST",
1637
- body: input as JsonObject,
1638
- idempotencyKey,
1639
- });
1640
- },
1641
-
1642
- async patchState(
1643
- input: { worktreeId: string; patch: GatewayRecord },
1644
- idempotencyKey = randomIdempotencyKey()
1645
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1646
- return gateway.request<GatewayRecord>({
1647
- path: "/api/platform/v1/worktrees/patch-state",
1648
- method: "POST",
1649
- body: input as JsonObject,
1650
- idempotencyKey,
1651
- });
1652
- },
1653
-
1654
- async bulkCreate(
1655
- input: { worktrees: unknown[] },
1656
- idempotencyKey = randomIdempotencyKey()
1657
- ): Promise<PlatformGatewaySuccess<GatewayRecord>> {
1658
- return gateway.request<GatewayRecord>({
1659
- path: "/api/platform/v1/worktrees/bulk",
1660
- method: "POST",
1661
- body: input as JsonObject,
1662
- idempotencyKey,
1663
- });
1664
- },
1665
- };
1666
- }