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

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 (166) hide show
  1. package/.turbo/turbo-build.log +7 -0
  2. package/.turbo/turbo-typecheck.log +4 -0
  3. package/CHANGELOG.md +13 -0
  4. package/examples/README.md +69 -0
  5. package/examples/contradiction.ts +94 -0
  6. package/examples/investigation-context.ts +118 -0
  7. package/examples/questions-and-tasks.ts +55 -0
  8. package/examples/quickstart.ts +97 -0
  9. package/examples/shared.ts +318 -0
  10. package/examples/strict-public-types.ts +143 -0
  11. package/examples/worktree-lifecycle.ts +79 -0
  12. package/package.json +16 -59
  13. package/src/README.md +6 -0
  14. package/src/adminClient.ts +789 -0
  15. package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
  16. package/src/audiencesClient.ts +209 -0
  17. package/src/auditClient.ts +50 -0
  18. package/src/beliefsClient.ts +319 -0
  19. package/src/client.ts +2647 -0
  20. package/src/contextClient.ts +130 -0
  21. package/src/contextFacade.ts +15 -0
  22. package/src/contextPackCompiler.ts +828 -0
  23. package/src/contextPackSchema.ts +251 -0
  24. package/src/contextTypes.ts +153 -0
  25. package/src/contracts/api-enums.contract.ts +202 -0
  26. package/src/contracts/auth-session.contract.ts +109 -0
  27. package/src/contracts/context-pack.contract.ts +700 -0
  28. package/src/contracts/contextPack.ts +1 -0
  29. package/src/contracts/index.ts +10 -0
  30. package/src/contracts/lens-filter.contract.ts +183 -0
  31. package/src/contracts/lens-workflow.contract.ts +162 -0
  32. package/src/contracts/lensFilter.ts +1 -0
  33. package/src/contracts/lensWorkflow.ts +1 -0
  34. package/src/contracts/mcp-tools.contract.ts +3636 -0
  35. package/src/contracts/mcpTools.ts +1 -0
  36. package/src/contracts/prompt.contract.ts +50 -0
  37. package/src/contracts/prompt.ts +1 -0
  38. package/src/contracts/sdk-tools.contract.ts +1457 -0
  39. package/src/contracts/sdkTools.ts +1 -0
  40. package/src/contracts/workflow-runtime.contract.ts +440 -0
  41. package/src/contracts/workflowRuntime.ts +1 -0
  42. package/src/controlObjectOwnership.ts +286 -0
  43. package/src/coreClient.ts +570 -0
  44. package/src/customTools.ts +398 -0
  45. package/src/decisionsClient.ts +286 -0
  46. package/src/domainContext.ts +15 -0
  47. package/src/events.ts +531 -0
  48. package/src/eventsCore.ts +168 -0
  49. package/src/facade/beliefs.ts +83 -0
  50. package/src/facade/context.ts +110 -0
  51. package/src/facade/contradictions.ts +29 -0
  52. package/src/facade/edges.ts +30 -0
  53. package/src/facade/events.ts +23 -0
  54. package/src/facade/evidence.ts +41 -0
  55. package/src/facade/graph.ts +38 -0
  56. package/src/facade/identity.ts +16 -0
  57. package/src/facade/ontologies.ts +34 -0
  58. package/src/facade/questions.ts +59 -0
  59. package/src/facade/search.ts +16 -0
  60. package/src/facade/tasks.ts +37 -0
  61. package/src/facade/topics.ts +42 -0
  62. package/src/facade/webhooks.ts +58 -0
  63. package/src/facade/worktrees.ts +51 -0
  64. package/src/gatewayFacades.ts +1666 -0
  65. package/src/graphClient.ts +529 -0
  66. package/src/harnessClient.ts +585 -0
  67. package/src/identityClient.ts +278 -0
  68. package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +3 -0
  69. package/src/learningClient.ts +95 -0
  70. package/src/mcpParityClient.ts +240 -0
  71. package/src/mcpParitySurface.ts +70 -0
  72. package/src/ontologyClient.ts +275 -0
  73. package/src/packRuntime.ts +3 -0
  74. package/src/packsClient.ts +260 -0
  75. package/src/policyClient.ts +572 -0
  76. package/src/promptCatalog.ts +1 -0
  77. package/src/realtime/index.ts +51 -0
  78. package/src/realtime/refs.ts +17 -0
  79. package/src/reportsClient.ts +99 -0
  80. package/src/schemaClient.ts +129 -0
  81. package/src/sdkSurface.ts +190 -0
  82. package/src/topicsClient.ts +243 -0
  83. package/src/types.ts +807 -0
  84. package/src/workflowClient.ts +826 -0
  85. package/tsconfig.json +9 -0
  86. package/dist/.generated +0 -2
  87. package/dist/index.d.ts +0 -3
  88. package/dist/index.js +0 -3
  89. package/dist/lib/platform/auth/credentials.d.ts +0 -5
  90. package/dist/lib/platform/auth/credentials.js +0 -40
  91. package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
  92. package/dist/lib/platform/sdk/adminClient.js +0 -384
  93. package/dist/lib/platform/sdk/answersClient.js +0 -21
  94. package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
  95. package/dist/lib/platform/sdk/audiencesClient.js +0 -111
  96. package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
  97. package/dist/lib/platform/sdk/auditClient.js +0 -21
  98. package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
  99. package/dist/lib/platform/sdk/beliefsClient.js +0 -124
  100. package/dist/lib/platform/sdk/client.d.ts +0 -2369
  101. package/dist/lib/platform/sdk/client.js +0 -1831
  102. package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
  103. package/dist/lib/platform/sdk/contextClient.js +0 -86
  104. package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
  105. package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
  106. package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
  107. package/dist/lib/platform/sdk/contextTypes.js +0 -1
  108. package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
  109. package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
  110. package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
  111. package/dist/lib/platform/sdk/coreClient.js +0 -366
  112. package/dist/lib/platform/sdk/customTools.d.ts +0 -83
  113. package/dist/lib/platform/sdk/customTools.js +0 -247
  114. package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
  115. package/dist/lib/platform/sdk/decisionsClient.js +0 -129
  116. package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
  117. package/dist/lib/platform/sdk/domainContext.js +0 -1
  118. package/dist/lib/platform/sdk/events.d.ts +0 -176
  119. package/dist/lib/platform/sdk/events.js +0 -261
  120. package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
  121. package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
  122. package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
  123. package/dist/lib/platform/sdk/graphClient.js +0 -235
  124. package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
  125. package/dist/lib/platform/sdk/harnessClient.js +0 -219
  126. package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
  127. package/dist/lib/platform/sdk/identityClient.js +0 -131
  128. package/dist/lib/platform/sdk/index.js +0 -46
  129. package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
  130. package/dist/lib/platform/sdk/learningClient.js +0 -53
  131. package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
  132. package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
  133. package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
  134. package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
  135. package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
  136. package/dist/lib/platform/sdk/ontologyClient.js +0 -161
  137. package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
  138. package/dist/lib/platform/sdk/packRuntime.js +0 -1
  139. package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
  140. package/dist/lib/platform/sdk/packsClient.js +0 -157
  141. package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
  142. package/dist/lib/platform/sdk/policyClient.js +0 -277
  143. package/dist/lib/platform/sdk/promptCatalog.d.ts +0 -1
  144. package/dist/lib/platform/sdk/promptCatalog.js +0 -1
  145. package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
  146. package/dist/lib/platform/sdk/reportsClient.js +0 -64
  147. package/dist/lib/platform/sdk/schemaClient.d.ts +0 -59
  148. package/dist/lib/platform/sdk/schemaClient.js +0 -71
  149. package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
  150. package/dist/lib/platform/sdk/sdkSurface.js +0 -140
  151. package/dist/lib/platform/sdk/topicsClient.d.ts +0 -78
  152. package/dist/lib/platform/sdk/topicsClient.js +0 -118
  153. package/dist/lib/platform/sdk/types.d.ts +0 -692
  154. package/dist/lib/platform/sdk/types.js +0 -1
  155. package/dist/lib/platform/sdk/version.d.ts +0 -2
  156. package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
  157. package/dist/lib/platform/sdk/workflowClient.js +0 -366
  158. package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
  159. package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
  160. package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
  161. package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
  162. package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
  163. package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
  164. package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
  165. package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
  166. /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
@@ -1,845 +0,0 @@
1
- import { createGatewayRequestClient, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
2
- import { createOntologyClient, } from "./ontologyClient.js";
3
- import { createGraphClient } from "./graphClient.js";
4
- import { createIdentityClient } from "./identityClient.js";
5
- import { createTopicsClient, } from "./topicsClient.js";
6
- function serializeTypes(types) {
7
- return Array.isArray(types) && types.length > 0 ? types.join(",") : undefined;
8
- }
9
- export function createBeliefsFacade(config = {}) {
10
- const gateway = createGatewayRequestClient(config);
11
- return {
12
- async create(input, idempotencyKey = randomIdempotencyKey()) {
13
- return gateway.request({
14
- path: "/api/platform/v1/beliefs",
15
- method: "POST",
16
- body: input,
17
- idempotencyKey,
18
- });
19
- },
20
- async get(id) {
21
- return gateway.request({
22
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`,
23
- });
24
- },
25
- async list(query) {
26
- return gateway.request({
27
- path: `/api/platform/v1/beliefs${toQueryString({
28
- topicId: query.topicId,
29
- status: query.status,
30
- worktreeId: query.worktreeId,
31
- minConfidence: query.minConfidence,
32
- limit: query.limit,
33
- cursor: query.cursor,
34
- })}`,
35
- });
36
- },
37
- async refine(id, input, idempotencyKey = randomIdempotencyKey()) {
38
- return gateway.request({
39
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`,
40
- method: "PATCH",
41
- body: input,
42
- idempotencyKey,
43
- });
44
- },
45
- async fork(id, input, idempotencyKey = randomIdempotencyKey()) {
46
- return gateway.request({
47
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/fork`,
48
- method: "POST",
49
- body: input,
50
- idempotencyKey,
51
- });
52
- },
53
- async updateConfidence(id, input, idempotencyKey = randomIdempotencyKey()) {
54
- return gateway.request({
55
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence`,
56
- method: "POST",
57
- body: input,
58
- idempotencyKey,
59
- });
60
- },
61
- async updateStatus(input, idempotencyKey = randomIdempotencyKey()) {
62
- return gateway.request({
63
- path: "/api/platform/v1/beliefs/update-status",
64
- method: "POST",
65
- body: input,
66
- idempotencyKey,
67
- });
68
- },
69
- async updateRationale(input, idempotencyKey = randomIdempotencyKey()) {
70
- return gateway.request({
71
- path: "/api/platform/v1/beliefs/update-rationale",
72
- method: "POST",
73
- body: input,
74
- idempotencyKey,
75
- });
76
- },
77
- async linkBeliefs(input, idempotencyKey = randomIdempotencyKey()) {
78
- return gateway.request({
79
- path: "/api/platform/v1/beliefs/link",
80
- method: "POST",
81
- body: input,
82
- idempotencyKey,
83
- });
84
- },
85
- async unlinkEvidence(input, idempotencyKey = randomIdempotencyKey()) {
86
- return gateway.request({
87
- path: "/api/platform/v1/beliefs/unlink-evidence",
88
- method: "POST",
89
- body: input,
90
- idempotencyKey,
91
- });
92
- },
93
- async updateCriticality(input, idempotencyKey = randomIdempotencyKey()) {
94
- return gateway.request({
95
- path: "/api/platform/v1/beliefs/update-criticality",
96
- method: "POST",
97
- body: input,
98
- idempotencyKey,
99
- });
100
- },
101
- async batchUpdateCriticality(input, idempotencyKey = randomIdempotencyKey()) {
102
- return gateway.request({
103
- path: "/api/platform/v1/beliefs/batch-update-criticality",
104
- method: "POST",
105
- body: input,
106
- idempotencyKey,
107
- });
108
- },
109
- async reassignTopic(input, idempotencyKey = randomIdempotencyKey()) {
110
- return gateway.request({
111
- path: "/api/platform/v1/beliefs/reassign-topic",
112
- method: "POST",
113
- body: input,
114
- idempotencyKey,
115
- });
116
- },
117
- async archive(id, input = {}, idempotencyKey = randomIdempotencyKey()) {
118
- return gateway.request({
119
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}`,
120
- method: "DELETE",
121
- body: input,
122
- idempotencyKey,
123
- });
124
- },
125
- async lineage(id) {
126
- return gateway.request({
127
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/lineage`,
128
- });
129
- },
130
- async confidenceHistory(id) {
131
- return gateway.request({
132
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/confidence-history`,
133
- });
134
- },
135
- async createContract(id, input, idempotencyKey = randomIdempotencyKey()) {
136
- return gateway.request({
137
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/contracts`,
138
- method: "POST",
139
- body: input,
140
- idempotencyKey,
141
- });
142
- },
143
- async bisect(id, input, idempotencyKey = randomIdempotencyKey()) {
144
- return gateway.request({
145
- path: `/api/platform/v1/beliefs/${encodeURIComponent(id)}/bisect`,
146
- method: "POST",
147
- body: input,
148
- idempotencyKey,
149
- });
150
- },
151
- };
152
- }
153
- export function createContradictionsFacade(config = {}) {
154
- const gateway = createGatewayRequestClient(config);
155
- return {
156
- async flag(input, idempotencyKey = randomIdempotencyKey()) {
157
- return gateway.request({
158
- path: "/api/platform/v1/contradictions",
159
- method: "POST",
160
- body: input,
161
- idempotencyKey,
162
- });
163
- },
164
- async list(query) {
165
- return gateway.request({
166
- path: `/api/platform/v1/contradictions${toQueryString({
167
- topicId: query.topicId,
168
- status: query.status,
169
- limit: query.limit,
170
- cursor: query.cursor,
171
- })}`,
172
- });
173
- },
174
- async get(id) {
175
- return gateway.request({
176
- path: `/api/platform/v1/contradictions/${encodeURIComponent(id)}`,
177
- });
178
- },
179
- };
180
- }
181
- export function createEdgesFacade(config = {}) {
182
- const gateway = createGatewayRequestClient(config);
183
- return {
184
- async create(input, idempotencyKey = randomIdempotencyKey()) {
185
- return gateway.request({
186
- path: "/api/platform/v1/edges",
187
- method: "POST",
188
- body: input,
189
- idempotencyKey,
190
- });
191
- },
192
- async list(query) {
193
- return gateway.request({
194
- path: `/api/platform/v1/edges${toQueryString({
195
- sourceId: query.sourceId,
196
- edgeType: query.edgeType,
197
- limit: query.limit,
198
- cursor: query.cursor,
199
- })}`,
200
- });
201
- },
202
- async traverse(input, idempotencyKey = randomIdempotencyKey()) {
203
- return gateway.request({
204
- path: "/api/platform/v1/edges/traverse",
205
- method: "POST",
206
- body: input,
207
- idempotencyKey,
208
- });
209
- },
210
- async update(input, idempotencyKey = randomIdempotencyKey()) {
211
- return gateway.request({
212
- path: "/api/platform/v1/edges/update",
213
- method: "POST",
214
- body: input,
215
- idempotencyKey,
216
- });
217
- },
218
- async remove(input, idempotencyKey = randomIdempotencyKey()) {
219
- return gateway.request({
220
- path: "/api/platform/v1/edges/remove",
221
- method: "POST",
222
- body: input,
223
- idempotencyKey,
224
- });
225
- },
226
- async removeBetween(input, idempotencyKey = randomIdempotencyKey()) {
227
- return gateway.request({
228
- path: "/api/platform/v1/edges/remove-between",
229
- method: "POST",
230
- body: input,
231
- idempotencyKey,
232
- });
233
- },
234
- async batchCreate(input, idempotencyKey = randomIdempotencyKey()) {
235
- return gateway.request({
236
- path: "/api/platform/v1/edges/batch",
237
- method: "POST",
238
- body: input,
239
- idempotencyKey,
240
- });
241
- },
242
- async delete(input, idempotencyKey = randomIdempotencyKey()) {
243
- return gateway.request({
244
- path: "/api/platform/v1/edges/delete",
245
- method: "POST",
246
- body: input,
247
- idempotencyKey,
248
- });
249
- },
250
- };
251
- }
252
- export function createEvidenceFacade(config = {}) {
253
- const gateway = createGatewayRequestClient(config);
254
- return {
255
- async create(input, idempotencyKey = randomIdempotencyKey()) {
256
- return gateway.request({
257
- path: "/api/platform/v1/evidence",
258
- method: "POST",
259
- body: input,
260
- idempotencyKey,
261
- });
262
- },
263
- async get(id) {
264
- return gateway.request({
265
- path: `/api/platform/v1/evidence/${encodeURIComponent(id)}`,
266
- });
267
- },
268
- async list(query) {
269
- return gateway.request({
270
- path: `/api/platform/v1/evidence${toQueryString({
271
- topicId: query.topicId,
272
- targetId: query.targetId,
273
- limit: query.limit,
274
- cursor: query.cursor,
275
- })}`,
276
- });
277
- },
278
- async link(input, idempotencyKey = randomIdempotencyKey()) {
279
- return gateway.request({
280
- path: `/api/platform/v1/evidence/${encodeURIComponent(input.evidenceId)}/link`,
281
- method: "POST",
282
- body: {
283
- targetId: input.targetId,
284
- targetType: input.targetType,
285
- weight: input.weight,
286
- rationale: input.rationale,
287
- },
288
- idempotencyKey,
289
- });
290
- },
291
- async search(query, idempotencyKey = randomIdempotencyKey()) {
292
- return gateway.request({
293
- path: "/api/platform/v1/evidence/search",
294
- method: "POST",
295
- body: query,
296
- idempotencyKey,
297
- });
298
- },
299
- async updateStatus(input, idempotencyKey = randomIdempotencyKey()) {
300
- return gateway.request({
301
- path: "/api/platform/v1/evidence/update-status",
302
- method: "POST",
303
- body: input,
304
- idempotencyKey,
305
- });
306
- },
307
- async update(input, idempotencyKey = randomIdempotencyKey()) {
308
- return gateway.request({
309
- path: "/api/platform/v1/evidence/update",
310
- method: "POST",
311
- body: input,
312
- idempotencyKey,
313
- });
314
- },
315
- async flagIncorrect(input, idempotencyKey = randomIdempotencyKey()) {
316
- return gateway.request({
317
- path: "/api/platform/v1/evidence/flag-incorrect",
318
- method: "POST",
319
- body: input,
320
- idempotencyKey,
321
- });
322
- },
323
- async remove(input, idempotencyKey = randomIdempotencyKey()) {
324
- return gateway.request({
325
- path: "/api/platform/v1/evidence/remove",
326
- method: "POST",
327
- body: input,
328
- idempotencyKey,
329
- });
330
- },
331
- async updateVerificationStatus(input, idempotencyKey = randomIdempotencyKey()) {
332
- return gateway.request({
333
- path: "/api/platform/v1/evidence/update-verification-status",
334
- method: "POST",
335
- body: input,
336
- idempotencyKey,
337
- });
338
- },
339
- };
340
- }
341
- export function createEventsFacade(config = {}) {
342
- const gateway = createGatewayRequestClient(config);
343
- return {
344
- async list(query = {}) {
345
- return gateway.request({
346
- path: `/api/platform/v1/events${toQueryString({
347
- topicId: query.topicId,
348
- after: query.after,
349
- types: serializeTypes(query.types),
350
- startTime: query.startTime,
351
- endTime: query.endTime,
352
- limit: query.limit,
353
- })}`,
354
- });
355
- },
356
- async replay(input, idempotencyKey = randomIdempotencyKey()) {
357
- return gateway.request({
358
- path: "/api/platform/v1/events/replay",
359
- method: "POST",
360
- body: input,
361
- idempotencyKey,
362
- });
363
- },
364
- };
365
- }
366
- export function createGraphFacade(config = {}) {
367
- const graphClient = createGraphClient(config);
368
- const gateway = createGatewayRequestClient(config);
369
- return {
370
- async neighborhood(input) {
371
- return graphClient.neighborhood({
372
- globalId: input.globalId,
373
- globalIds: Array.isArray(input.globalIds)
374
- ? input.globalIds.join(",")
375
- : input.globalIds,
376
- maxDepth: input.maxDepth,
377
- });
378
- },
379
- async traverse(input) {
380
- return graphClient.traverse(input);
381
- },
382
- async analyze(input = {}) {
383
- return graphClient.analyze(input);
384
- },
385
- async bias(input = {}) {
386
- return graphClient.bias(input);
387
- },
388
- async gaps(input) {
389
- return graphClient.gaps(input);
390
- },
391
- async falsify(input, idempotencyKey = randomIdempotencyKey()) {
392
- return gateway.request({
393
- path: "/api/platform/v1/graph/falsify",
394
- method: "POST",
395
- body: input,
396
- idempotencyKey,
397
- });
398
- },
399
- };
400
- }
401
- export function createIdentityFacade(config = {}) {
402
- const identityClient = createIdentityClient(config);
403
- return {
404
- async whoami() {
405
- const response = await identityClient.whoami();
406
- return Object.assign({}, response, response.data);
407
- },
408
- };
409
- }
410
- export function createOntologiesFacade(config = {}) {
411
- const ontologyClient = createOntologyClient(config);
412
- const gateway = createGatewayRequestClient(config);
413
- return {
414
- async get(id) {
415
- return gateway.request({
416
- path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`,
417
- });
418
- },
419
- async list(query = {}) {
420
- return ontologyClient.list(query);
421
- },
422
- async bind(input, idempotencyKey) {
423
- return gateway.request({
424
- path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
425
- method: "POST",
426
- body: {
427
- topicId: input.topicId,
428
- },
429
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
430
- });
431
- },
432
- async match(input, idempotencyKey) {
433
- return gateway.request({
434
- path: "/api/platform/v1/ontologies/match",
435
- method: "POST",
436
- body: input,
437
- idempotencyKey,
438
- });
439
- },
440
- };
441
- }
442
- export function createQuestionsFacade(config = {}) {
443
- const gateway = createGatewayRequestClient(config);
444
- return {
445
- async create(input, idempotencyKey = randomIdempotencyKey()) {
446
- return gateway.request({
447
- path: "/api/platform/v1/questions",
448
- method: "POST",
449
- body: input,
450
- idempotencyKey,
451
- });
452
- },
453
- async get(id) {
454
- return gateway.request({
455
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}`,
456
- });
457
- },
458
- async list(query) {
459
- return gateway.request({
460
- path: `/api/platform/v1/questions${toQueryString({
461
- topicId: query.topicId,
462
- status: query.status,
463
- priority: query.priority,
464
- worktreeId: query.worktreeId,
465
- limit: query.limit,
466
- cursor: query.cursor,
467
- })}`,
468
- });
469
- },
470
- async answer(id, input, idempotencyKey = randomIdempotencyKey()) {
471
- return gateway.request({
472
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}/answer`,
473
- method: "POST",
474
- body: input,
475
- idempotencyKey,
476
- });
477
- },
478
- async refine(id, input, idempotencyKey = randomIdempotencyKey()) {
479
- return gateway.request({
480
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}/refine`,
481
- method: "POST",
482
- body: input,
483
- idempotencyKey,
484
- });
485
- },
486
- async archive(id, input = {}, idempotencyKey = randomIdempotencyKey()) {
487
- return gateway.request({
488
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}`,
489
- method: "DELETE",
490
- body: input,
491
- idempotencyKey,
492
- });
493
- },
494
- async updateStatus(id, input, idempotencyKey = randomIdempotencyKey()) {
495
- return gateway.request({
496
- path: `/api/platform/v1/questions/${encodeURIComponent(id)}/status`,
497
- method: "PATCH",
498
- body: input,
499
- idempotencyKey,
500
- });
501
- },
502
- async batchCreate(input, idempotencyKey = randomIdempotencyKey()) {
503
- return gateway.request({
504
- path: "/api/platform/v1/questions/batch",
505
- method: "POST",
506
- body: input,
507
- idempotencyKey,
508
- });
509
- },
510
- async add(input, idempotencyKey = randomIdempotencyKey()) {
511
- return gateway.request({
512
- path: "/api/platform/v1/questions/add",
513
- method: "POST",
514
- body: input,
515
- idempotencyKey,
516
- });
517
- },
518
- async updatePriority(input, idempotencyKey = randomIdempotencyKey()) {
519
- return gateway.request({
520
- path: "/api/platform/v1/questions/update-priority",
521
- method: "POST",
522
- body: input,
523
- idempotencyKey,
524
- });
525
- },
526
- async advanceToConviction(input, idempotencyKey = randomIdempotencyKey()) {
527
- return gateway.request({
528
- path: "/api/platform/v1/questions/advance-to-conviction",
529
- method: "POST",
530
- body: input,
531
- idempotencyKey,
532
- });
533
- },
534
- async updateConviction(input, idempotencyKey = randomIdempotencyKey()) {
535
- return gateway.request({
536
- path: "/api/platform/v1/questions/update-conviction",
537
- method: "POST",
538
- body: input,
539
- idempotencyKey,
540
- });
541
- },
542
- async finalizeConviction(input, idempotencyKey = randomIdempotencyKey()) {
543
- return gateway.request({
544
- path: "/api/platform/v1/questions/finalize-conviction",
545
- method: "POST",
546
- body: input,
547
- idempotencyKey,
548
- });
549
- },
550
- async update(input, idempotencyKey = randomIdempotencyKey()) {
551
- return gateway.request({
552
- path: "/api/platform/v1/questions/update",
553
- method: "POST",
554
- body: input,
555
- idempotencyKey,
556
- });
557
- },
558
- async delete(input, idempotencyKey = randomIdempotencyKey()) {
559
- return gateway.request({
560
- path: "/api/platform/v1/questions/delete",
561
- method: "POST",
562
- body: input,
563
- idempotencyKey,
564
- });
565
- },
566
- };
567
- }
568
- export function createSearchFacade(config = {}) {
569
- const gateway = createGatewayRequestClient(config);
570
- return {
571
- async query(input) {
572
- return gateway.request({
573
- path: "/api/platform/v1/search",
574
- method: "POST",
575
- body: input,
576
- });
577
- },
578
- };
579
- }
580
- export function createTasksFacade(config = {}) {
581
- const gateway = createGatewayRequestClient(config);
582
- return {
583
- async create(input, idempotencyKey = randomIdempotencyKey()) {
584
- return gateway.request({
585
- path: "/api/platform/v1/tasks",
586
- method: "POST",
587
- body: input,
588
- idempotencyKey,
589
- });
590
- },
591
- async update(input, idempotencyKey = randomIdempotencyKey()) {
592
- return gateway.request({
593
- path: `/api/platform/v1/tasks/${encodeURIComponent(input.id)}`,
594
- method: "PATCH",
595
- body: {
596
- title: input.title,
597
- description: input.description,
598
- priority: input.priority,
599
- status: input.status,
600
- linkedBeliefId: input.linkedBeliefId,
601
- linkedQuestionId: input.linkedQuestionId,
602
- linkedWorktreeId: input.linkedWorktreeId,
603
- metadata: input.metadata,
604
- },
605
- idempotencyKey,
606
- });
607
- },
608
- async complete(input, idempotencyKey = randomIdempotencyKey()) {
609
- return gateway.request({
610
- path: `/api/platform/v1/tasks/${encodeURIComponent(input.id)}/complete`,
611
- method: "POST",
612
- body: {
613
- outputSummary: input.outputSummary,
614
- },
615
- idempotencyKey,
616
- });
617
- },
618
- async list(query) {
619
- return gateway.request({
620
- path: `/api/platform/v1/tasks${toQueryString({
621
- topicId: query.topicId,
622
- worktreeId: query.worktreeId,
623
- status: query.status,
624
- limit: query.limit,
625
- })}`,
626
- });
627
- },
628
- };
629
- }
630
- export function createTopicsFacade(config = {}) {
631
- const topicsClient = createTopicsClient(config);
632
- return {
633
- async create(input, idempotencyKey) {
634
- return topicsClient.create(input, idempotencyKey);
635
- },
636
- async get(id) {
637
- return topicsClient.get(id);
638
- },
639
- async list(query = {}) {
640
- return topicsClient.list(query);
641
- },
642
- async update(input, idempotencyKey) {
643
- const { id, ...rest } = input;
644
- return topicsClient.update(id, rest, idempotencyKey);
645
- },
646
- async tree(input) {
647
- return topicsClient.getTree(input.id, {
648
- maxDepth: input.maxDepth,
649
- });
650
- },
651
- async coverage(input) {
652
- return topicsClient.getCoverage(input.id, {
653
- includeDescendants: input.includeDescendants,
654
- maxDepth: input.maxDepth,
655
- });
656
- },
657
- async remove(id, idempotencyKey = randomIdempotencyKey()) {
658
- return topicsClient.remove(id, idempotencyKey);
659
- },
660
- async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
661
- return topicsClient.bulkCreate(input, idempotencyKey);
662
- },
663
- };
664
- }
665
- export function createWebhooksFacade(config = {}) {
666
- const gateway = createGatewayRequestClient(config);
667
- return {
668
- async create(input, idempotencyKey = randomIdempotencyKey()) {
669
- return gateway.request({
670
- path: "/api/platform/v1/webhooks",
671
- method: "POST",
672
- body: input,
673
- idempotencyKey,
674
- });
675
- },
676
- async list(query = {}) {
677
- return gateway.request({
678
- path: `/api/platform/v1/webhooks${toQueryString({
679
- topicId: query.topicId,
680
- })}`,
681
- });
682
- },
683
- async get(id) {
684
- return gateway.request({
685
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}`,
686
- });
687
- },
688
- async update(id, input, idempotencyKey = randomIdempotencyKey()) {
689
- return gateway.request({
690
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}`,
691
- method: "PATCH",
692
- body: input,
693
- idempotencyKey,
694
- });
695
- },
696
- async delete(id, idempotencyKey = randomIdempotencyKey()) {
697
- return gateway.request({
698
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}`,
699
- method: "DELETE",
700
- idempotencyKey,
701
- });
702
- },
703
- async test(id, input = {}, idempotencyKey = randomIdempotencyKey()) {
704
- return gateway.request({
705
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/test`,
706
- method: "POST",
707
- body: input,
708
- idempotencyKey,
709
- });
710
- },
711
- async deliveries(id, query = {}) {
712
- return gateway.request({
713
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/deliveries${toQueryString({
714
- limit: query.limit,
715
- })}`,
716
- });
717
- },
718
- async health(id) {
719
- return gateway.request({
720
- path: `/api/platform/v1/webhooks/${encodeURIComponent(id)}/health`,
721
- });
722
- },
723
- };
724
- }
725
- export function createWorktreesFacade(config = {}) {
726
- const gateway = createGatewayRequestClient(config);
727
- return {
728
- async create(input, idempotencyKey = randomIdempotencyKey()) {
729
- return gateway.request({
730
- path: "/api/platform/v1/worktrees",
731
- method: "POST",
732
- body: input,
733
- idempotencyKey,
734
- });
735
- },
736
- async list(query) {
737
- return gateway.request({
738
- path: `/api/platform/v1/worktrees${toQueryString({
739
- topicId: query.topicId,
740
- status: query.status,
741
- limit: query.limit,
742
- })}`,
743
- });
744
- },
745
- async activate(input, idempotencyKey = randomIdempotencyKey()) {
746
- return gateway.request({
747
- path: `/api/platform/v1/worktrees/${encodeURIComponent(input.id)}/activate`,
748
- method: "POST",
749
- body: {},
750
- idempotencyKey,
751
- });
752
- },
753
- async update(input, idempotencyKey = randomIdempotencyKey()) {
754
- return gateway.request({
755
- path: `/api/platform/v1/worktrees/${encodeURIComponent(input.id)}`,
756
- method: "PATCH",
757
- body: {
758
- objective: input.objective,
759
- hypothesis: input.hypothesis,
760
- rationale: input.rationale,
761
- track: input.track,
762
- trackPosition: input.trackPosition,
763
- executionBand: input.executionBand,
764
- executionOrder: input.executionOrder,
765
- dependsOn: input.dependsOn,
766
- blocks: input.blocks,
767
- gate: input.gate,
768
- status: input.status,
769
- topicId: input.topicId,
770
- additionalTopicIds: input.additionalTopicIds,
771
- proofArtifacts: input.proofArtifacts,
772
- staffingHint: input.staffingHint,
773
- lastReconciledAt: input.lastReconciledAt,
774
- autoFixPolicy: input.autoFixPolicy,
775
- lensId: input.lensId,
776
- },
777
- idempotencyKey,
778
- });
779
- },
780
- async merge(input, idempotencyKey = randomIdempotencyKey()) {
781
- return gateway.request({
782
- path: `/api/platform/v1/worktrees/${encodeURIComponent(input.id)}/merge`,
783
- method: "POST",
784
- body: {
785
- summary: input.summary,
786
- outcomes: input.outcomes,
787
- },
788
- idempotencyKey,
789
- });
790
- },
791
- async updateTargets(input, idempotencyKey = randomIdempotencyKey()) {
792
- return gateway.request({
793
- path: `/api/platform/v1/worktrees/${encodeURIComponent(input.id)}/targets`,
794
- method: "POST",
795
- body: {
796
- addBeliefIds: input.addBeliefIds,
797
- addQuestionIds: input.addQuestionIds,
798
- removeBeliefIds: input.removeBeliefIds,
799
- removeQuestionIds: input.removeQuestionIds,
800
- },
801
- idempotencyKey,
802
- });
803
- },
804
- async complete(input, idempotencyKey = randomIdempotencyKey()) {
805
- return gateway.request({
806
- path: "/api/platform/v1/worktrees/complete",
807
- method: "POST",
808
- body: input,
809
- idempotencyKey,
810
- });
811
- },
812
- async advancePhase(input, idempotencyKey = randomIdempotencyKey()) {
813
- return gateway.request({
814
- path: "/api/platform/v1/worktrees/advance-phase",
815
- method: "POST",
816
- body: input,
817
- idempotencyKey,
818
- });
819
- },
820
- async setPhase(input, idempotencyKey = randomIdempotencyKey()) {
821
- return gateway.request({
822
- path: "/api/platform/v1/worktrees/set-phase",
823
- method: "POST",
824
- body: input,
825
- idempotencyKey,
826
- });
827
- },
828
- async patchState(input, idempotencyKey = randomIdempotencyKey()) {
829
- return gateway.request({
830
- path: "/api/platform/v1/worktrees/patch-state",
831
- method: "POST",
832
- body: input,
833
- idempotencyKey,
834
- });
835
- },
836
- async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
837
- return gateway.request({
838
- path: "/api/platform/v1/worktrees/bulk",
839
- method: "POST",
840
- body: input,
841
- idempotencyKey,
842
- });
843
- },
844
- };
845
- }