@lucern/sdk 0.2.0-alpha.6 → 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 (274) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{lib/platform/sdk/adminClient.d.ts → adminClient.d.ts} +56 -51
  3. package/dist/adminClient.js +755 -0
  4. package/dist/adminClient.js.map +1 -0
  5. package/dist/answersClient.d.ts +23 -0
  6. package/dist/answersClient.js +333 -0
  7. package/dist/answersClient.js.map +1 -0
  8. package/dist/{lib/platform/sdk/audiencesClient.d.ts → audiencesClient.d.ts} +24 -18
  9. package/dist/audiencesClient.js +472 -0
  10. package/dist/audiencesClient.js.map +1 -0
  11. package/dist/auditClient.d.ts +29 -0
  12. package/dist/auditClient.js +386 -0
  13. package/dist/auditClient.js.map +1 -0
  14. package/dist/{lib/platform/sdk/beliefsClient.d.ts → beliefsClient.d.ts} +32 -27
  15. package/dist/beliefsClient.js +477 -0
  16. package/dist/beliefsClient.js.map +1 -0
  17. package/dist/{lib/platform/sdk/client.d.ts → client.d.ts} +404 -395
  18. package/dist/client.js +6134 -0
  19. package/dist/client.js.map +1 -0
  20. package/dist/{lib/platform/sdk/contextClient.d.ts → contextClient.d.ts} +13 -7
  21. package/dist/contextClient.js +396 -0
  22. package/dist/contextClient.js.map +1 -0
  23. package/dist/contextFacade.d.ts +2 -0
  24. package/dist/contextFacade.js +73 -0
  25. package/dist/contextFacade.js.map +1 -0
  26. package/dist/{lib/platform/sdk/contextPackCompiler.d.ts → contextPackCompiler.d.ts} +11 -9
  27. package/dist/contextPackCompiler.js +1091 -0
  28. package/dist/contextPackCompiler.js.map +1 -0
  29. package/dist/contextPackPolicy.d.ts +84 -0
  30. package/dist/contextPackPolicy.js +347 -0
  31. package/dist/contextPackPolicy.js.map +1 -0
  32. package/dist/contextPackSchema.d.ts +7 -0
  33. package/dist/contextPackSchema.js +203 -0
  34. package/dist/contextPackSchema.js.map +1 -0
  35. package/dist/{lib/platform/sdk/contextTypes.d.ts → contextTypes.d.ts} +15 -13
  36. package/dist/contextTypes.js +3 -0
  37. package/dist/contextTypes.js.map +1 -0
  38. package/dist/contracts/api-enums.contract.d.ts +81 -0
  39. package/dist/contracts/api-enums.contract.js +92 -0
  40. package/dist/contracts/api-enums.contract.js.map +1 -0
  41. package/dist/contracts/auth-session.contract.d.ts +55 -0
  42. package/dist/contracts/auth-session.contract.js +48 -0
  43. package/dist/contracts/auth-session.contract.js.map +1 -0
  44. package/dist/{lucern/contracts/src → contracts}/context-pack.contract.d.ts +56 -58
  45. package/dist/contracts/context-pack.contract.js +98 -0
  46. package/dist/contracts/context-pack.contract.js.map +1 -0
  47. package/dist/contracts/contextPack.d.ts +1 -0
  48. package/dist/contracts/contextPack.js +98 -0
  49. package/dist/contracts/contextPack.js.map +1 -0
  50. package/dist/contracts/index.d.ts +9 -0
  51. package/dist/contracts/index.js +4892 -0
  52. package/dist/contracts/index.js.map +1 -0
  53. package/dist/{lucern/contracts/src → contracts}/lens-filter.contract.d.ts +10 -8
  54. package/dist/contracts/lens-filter.contract.js +71 -0
  55. package/dist/contracts/lens-filter.contract.js.map +1 -0
  56. package/dist/contracts/lens-workflow.contract.d.ts +87 -0
  57. package/dist/contracts/lens-workflow.contract.js +123 -0
  58. package/dist/contracts/lens-workflow.contract.js.map +1 -0
  59. package/dist/contracts/lensFilter.d.ts +1 -0
  60. package/dist/contracts/lensFilter.js +71 -0
  61. package/dist/contracts/lensFilter.js.map +1 -0
  62. package/dist/contracts/lensWorkflow.d.ts +2 -0
  63. package/dist/contracts/lensWorkflow.js +123 -0
  64. package/dist/contracts/lensWorkflow.js.map +1 -0
  65. package/dist/contracts/mcp-tools.contract.d.ts +1 -0
  66. package/dist/contracts/mcp-tools.contract.js +2986 -0
  67. package/dist/contracts/mcp-tools.contract.js.map +1 -0
  68. package/dist/contracts/mcpTools.d.ts +1 -0
  69. package/dist/contracts/mcpTools.js +2986 -0
  70. package/dist/contracts/mcpTools.js.map +1 -0
  71. package/dist/{lucern/contracts/src → contracts}/prompt.contract.d.ts +5 -3
  72. package/dist/contracts/prompt.contract.js +12 -0
  73. package/dist/contracts/prompt.contract.js.map +1 -0
  74. package/dist/contracts/prompt.d.ts +1 -0
  75. package/dist/contracts/prompt.js +12 -0
  76. package/dist/contracts/prompt.js.map +1 -0
  77. package/dist/contracts/sdk-tools.contract.d.ts +2 -0
  78. package/dist/contracts/sdk-tools.contract.js +4134 -0
  79. package/dist/contracts/sdk-tools.contract.js.map +1 -0
  80. package/dist/contracts/sdkTools.d.ts +2 -0
  81. package/dist/contracts/sdkTools.js +4134 -0
  82. package/dist/contracts/sdkTools.js.map +1 -0
  83. package/dist/contracts/workflow-runtime.contract.d.ts +163 -0
  84. package/dist/contracts/workflow-runtime.contract.js +245 -0
  85. package/dist/contracts/workflow-runtime.contract.js.map +1 -0
  86. package/dist/contracts/workflowRuntime.d.ts +1 -0
  87. package/dist/contracts/workflowRuntime.js +245 -0
  88. package/dist/contracts/workflowRuntime.js.map +1 -0
  89. package/dist/{lib/platform/sdk/controlObjectOwnership.d.ts → controlObjectOwnership.d.ts} +20 -18
  90. package/dist/controlObjectOwnership.js +215 -0
  91. package/dist/controlObjectOwnership.js.map +1 -0
  92. package/dist/{lib/platform/sdk/coreClient.d.ts → coreClient.d.ts} +19 -14
  93. package/dist/coreClient.js +339 -0
  94. package/dist/coreClient.js.map +1 -0
  95. package/dist/{lib/platform/sdk/customTools.d.ts → customTools.d.ts} +21 -16
  96. package/dist/customTools.js +248 -0
  97. package/dist/customTools.js.map +1 -0
  98. package/dist/{lib/platform/sdk/decisionsClient.d.ts → decisionsClient.d.ts} +29 -24
  99. package/dist/decisionsClient.js +522 -0
  100. package/dist/decisionsClient.js.map +1 -0
  101. package/dist/domainContext.d.ts +1 -0
  102. package/dist/domainContext.js +3 -0
  103. package/dist/domainContext.js.map +1 -0
  104. package/dist/events.d.ts +178 -0
  105. package/dist/events.js +249 -0
  106. package/dist/events.js.map +1 -0
  107. package/dist/eventsCore.d.ts +49 -0
  108. package/dist/eventsCore.js +429 -0
  109. package/dist/eventsCore.js.map +1 -0
  110. package/dist/facade/context.d.ts +18 -0
  111. package/dist/facade/context.js +73 -0
  112. package/dist/facade/context.js.map +1 -0
  113. package/dist/{lib/platform/sdk/gatewayFacades.d.ts → gatewayFacades.d.ts} +31 -26
  114. package/dist/gatewayFacades.js +1953 -0
  115. package/dist/gatewayFacades.js.map +1 -0
  116. package/dist/{lib/platform/sdk/graphClient.d.ts → graphClient.d.ts} +57 -52
  117. package/dist/graphClient.js +698 -0
  118. package/dist/graphClient.js.map +1 -0
  119. package/dist/{lib/platform/sdk/harnessClient.d.ts → harnessClient.d.ts} +44 -39
  120. package/dist/harnessClient.js +607 -0
  121. package/dist/harnessClient.js.map +1 -0
  122. package/dist/{lib/platform/sdk/identityClient.d.ts → identityClient.d.ts} +17 -11
  123. package/dist/identityClient.js +497 -0
  124. package/dist/identityClient.js.map +1 -0
  125. package/dist/index.d.ts +42 -3
  126. package/dist/index.js +11381 -3
  127. package/dist/index.js.map +1 -0
  128. package/dist/{lib/platform/sdk/learningClient.d.ts → learningClient.d.ts} +13 -7
  129. package/dist/learningClient.js +409 -0
  130. package/dist/learningClient.js.map +1 -0
  131. package/dist/{lib/platform/sdk/mcpParityClient.d.ts → mcpParityClient.d.ts} +10 -5
  132. package/dist/mcpParityClient.js +516 -0
  133. package/dist/mcpParityClient.js.map +1 -0
  134. package/dist/mcpParitySurface.d.ts +12 -0
  135. package/dist/mcpParitySurface.js +65 -0
  136. package/dist/mcpParitySurface.js.map +1 -0
  137. package/dist/mcpTools-DPZxowDX.d.ts +254 -0
  138. package/dist/{lib/platform/sdk/ontologyClient.d.ts → ontologyClient.d.ts} +28 -22
  139. package/dist/ontologyClient.js +513 -0
  140. package/dist/ontologyClient.js.map +1 -0
  141. package/dist/packRuntime.d.ts +2 -0
  142. package/dist/packRuntime.js +3 -0
  143. package/dist/packRuntime.js.map +1 -0
  144. package/dist/{lib/platform/sdk/packsClient.d.ts → packsClient.d.ts} +34 -29
  145. package/dist/packsClient.js +525 -0
  146. package/dist/packsClient.js.map +1 -0
  147. package/dist/{lib/platform/sdk/policyClient.d.ts → policyClient.d.ts} +26 -20
  148. package/dist/policyClient.js +625 -0
  149. package/dist/policyClient.js.map +1 -0
  150. package/dist/realtime/index.d.ts +29 -0
  151. package/dist/realtime/index.js +23 -0
  152. package/dist/realtime/index.js.map +1 -0
  153. package/dist/realtime/refs.d.ts +17 -0
  154. package/dist/realtime/refs.js +9 -0
  155. package/dist/realtime/refs.js.map +1 -0
  156. package/dist/reportsClient.d.ts +41 -0
  157. package/dist/reportsClient.js +418 -0
  158. package/dist/reportsClient.js.map +1 -0
  159. package/dist/{lib/platform/sdk/schemaClient.d.ts → schemaClient.d.ts} +20 -15
  160. package/dist/schemaClient.js +434 -0
  161. package/dist/schemaClient.js.map +1 -0
  162. package/dist/sdkSurface.d.ts +61 -0
  163. package/dist/sdkSurface.js +112 -0
  164. package/dist/sdkSurface.js.map +1 -0
  165. package/dist/sdkTools-CwXJDACb.d.ts +150 -0
  166. package/dist/{lib/platform/sdk/topicsClient.d.ts → topicsClient.d.ts} +24 -18
  167. package/dist/topicsClient.js +492 -0
  168. package/dist/topicsClient.js.map +1 -0
  169. package/dist/{lib/platform/sdk/types.d.ts → types.d.ts} +84 -80
  170. package/dist/types.js +3 -0
  171. package/dist/types.js.map +1 -0
  172. package/dist/version.d.ts +4 -0
  173. package/dist/version.js +6 -0
  174. package/dist/version.js.map +1 -0
  175. package/dist/{lib/platform/sdk/workflowClient.d.ts → workflowClient.d.ts} +60 -57
  176. package/dist/workflowClient.js +830 -0
  177. package/dist/workflowClient.js.map +1 -0
  178. package/package.json +25 -43
  179. package/dist/.generated +0 -2
  180. package/dist/lib/platform/auth/credentials.d.ts +0 -5
  181. package/dist/lib/platform/auth/credentials.js +0 -40
  182. package/dist/lib/platform/sdk/adminClient.js +0 -384
  183. package/dist/lib/platform/sdk/answersClient.d.ts +0 -16
  184. package/dist/lib/platform/sdk/answersClient.js +0 -21
  185. package/dist/lib/platform/sdk/audiencesClient.js +0 -111
  186. package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
  187. package/dist/lib/platform/sdk/auditClient.js +0 -21
  188. package/dist/lib/platform/sdk/beliefsClient.js +0 -124
  189. package/dist/lib/platform/sdk/client.js +0 -1831
  190. package/dist/lib/platform/sdk/contextClient.js +0 -86
  191. package/dist/lib/platform/sdk/contextFacade.d.ts +0 -10
  192. package/dist/lib/platform/sdk/contextFacade.js +0 -10
  193. package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
  194. package/dist/lib/platform/sdk/contextTypes.js +0 -1
  195. package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
  196. package/dist/lib/platform/sdk/coreClient.js +0 -366
  197. package/dist/lib/platform/sdk/customTools.js +0 -247
  198. package/dist/lib/platform/sdk/decisionsClient.js +0 -129
  199. package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
  200. package/dist/lib/platform/sdk/domainContext.js +0 -1
  201. package/dist/lib/platform/sdk/events.d.ts +0 -176
  202. package/dist/lib/platform/sdk/events.js +0 -261
  203. package/dist/lib/platform/sdk/eventsCore.d.ts +0 -13
  204. package/dist/lib/platform/sdk/eventsCore.js +0 -13
  205. package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
  206. package/dist/lib/platform/sdk/graphClient.js +0 -235
  207. package/dist/lib/platform/sdk/harnessClient.js +0 -219
  208. package/dist/lib/platform/sdk/identityClient.js +0 -131
  209. package/dist/lib/platform/sdk/index.d.ts +0 -49
  210. package/dist/lib/platform/sdk/index.js +0 -49
  211. package/dist/lib/platform/sdk/learningClient.js +0 -53
  212. package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
  213. package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
  214. package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
  215. package/dist/lib/platform/sdk/ontologyClient.js +0 -161
  216. package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
  217. package/dist/lib/platform/sdk/packRuntime.js +0 -1
  218. package/dist/lib/platform/sdk/packsClient.js +0 -157
  219. package/dist/lib/platform/sdk/policyClient.js +0 -277
  220. package/dist/lib/platform/sdk/promptCatalog.d.ts +0 -1
  221. package/dist/lib/platform/sdk/promptCatalog.js +0 -1
  222. package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
  223. package/dist/lib/platform/sdk/reportsClient.js +0 -64
  224. package/dist/lib/platform/sdk/schemaClient.js +0 -71
  225. package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
  226. package/dist/lib/platform/sdk/sdkSurface.js +0 -140
  227. package/dist/lib/platform/sdk/topicsClient.js +0 -118
  228. package/dist/lib/platform/sdk/types.js +0 -1
  229. package/dist/lib/platform/sdk/version.d.ts +0 -2
  230. package/dist/lib/platform/sdk/version.js +0 -2
  231. package/dist/lib/platform/sdk/workflowClient.js +0 -366
  232. package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
  233. package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
  234. package/dist/lucern/contracts/src/auth-context.contract.d.ts +0 -8
  235. package/dist/lucern/contracts/src/auth-context.contract.js +0 -8
  236. package/dist/lucern/contracts/src/auth-session.contract.d.ts +0 -8
  237. package/dist/lucern/contracts/src/auth-session.contract.js +0 -8
  238. package/dist/lucern/contracts/src/auth.contract.d.ts +0 -88
  239. package/dist/lucern/contracts/src/auth.contract.js +0 -57
  240. package/dist/lucern/contracts/src/context-pack.contract.js +0 -169
  241. package/dist/lucern/contracts/src/convex-admin.contract.d.ts +0 -5
  242. package/dist/lucern/contracts/src/convex-admin.contract.js +0 -1
  243. package/dist/lucern/contracts/src/events-types.contract.d.ts +0 -8
  244. package/dist/lucern/contracts/src/events-types.contract.js +0 -8
  245. package/dist/lucern/contracts/src/events.contract.d.ts +0 -176
  246. package/dist/lucern/contracts/src/events.contract.js +0 -159
  247. package/dist/lucern/contracts/src/gateway.contract.d.ts +0 -74
  248. package/dist/lucern/contracts/src/gateway.contract.js +0 -19
  249. package/dist/lucern/contracts/src/ids.contract.d.ts +0 -7
  250. package/dist/lucern/contracts/src/ids.contract.js +0 -24
  251. package/dist/lucern/contracts/src/index.d.ts +0 -29
  252. package/dist/lucern/contracts/src/index.js +0 -29
  253. package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
  254. package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
  255. package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
  256. package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
  257. package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
  258. package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +0 -8
  259. package/dist/lucern/contracts/src/ontology-matching.contract.js +0 -8
  260. package/dist/lucern/contracts/src/prompt.contract.js +0 -24
  261. package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +0 -358
  262. package/dist/lucern/contracts/src/sdk-methods.contract.js +0 -19
  263. package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +0 -92
  264. package/dist/lucern/contracts/src/sdk-tools.contract.js +0 -1398
  265. package/dist/lucern/contracts/src/text-matching.contract.d.ts +0 -53
  266. package/dist/lucern/contracts/src/text-matching.contract.js +0 -277
  267. package/dist/lucern/contracts/src/topic-scope.contract.d.ts +0 -8
  268. package/dist/lucern/contracts/src/topic-scope.contract.js +0 -8
  269. package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
  270. package/dist/lucern/contracts/src/workflow-runtime.contract.js +0 -257
  271. package/dist/realtime-refs.d.ts +0 -1
  272. package/dist/realtime-refs.js +0 -1
  273. package/dist/realtime.d.ts +0 -1
  274. package/dist/realtime.js +0 -1
@@ -1,118 +0,0 @@
1
- import { createGatewayRequestClient, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
2
- import { createListResult, mapGatewayData, resolveTopicId, withTopicAlias, } from "./sdkSurface.js";
3
- function asRecord(value) {
4
- return value && typeof value === "object"
5
- ? value
6
- : {};
7
- }
8
- function cleanString(value) {
9
- return typeof value === "string" && value.trim().length > 0
10
- ? value.trim()
11
- : undefined;
12
- }
13
- function normalizeTopicRecord(value) {
14
- const record = asRecord(value);
15
- const topicId = cleanString(record.topicId) ??
16
- cleanString(record.id) ??
17
- cleanString(record._id);
18
- return withTopicAlias({
19
- ...record,
20
- ...(topicId ? { topicId } : {}),
21
- });
22
- }
23
- function normalizeTopicTreeNode(value) {
24
- return normalizeTopicRecord(value);
25
- }
26
- /**
27
- * Create the topics client for managing hierarchical knowledge containers.
28
- *
29
- * @param config - Gateway transport configuration.
30
- * @returns An object with `list`, `get`, `create`, `update`, `getTree`, and `getCoverage` methods.
31
- */
32
- export function createTopicsClient(config = {}) {
33
- const gateway = createGatewayRequestClient(config);
34
- return {
35
- async list(query = {}) {
36
- const topicId = resolveTopicId(query);
37
- return gateway.request({
38
- path: `/api/platform/v1/topics${toQueryString({
39
- ...(topicId ? { topicId } : {}),
40
- ontologyId: query.ontologyId,
41
- parentTopicId: query.parentTopicId,
42
- status: query.status,
43
- type: query.type,
44
- })}`,
45
- }).then((response) => mapGatewayData(response, (data) => {
46
- const record = asRecord(data);
47
- const items = Array.isArray(record.topics)
48
- ? record.topics.map(normalizeTopicRecord)
49
- : [];
50
- return {
51
- ...createListResult(items, "topics"),
52
- ...record,
53
- topics: items,
54
- total: typeof record.total === "number" ? record.total : items.length,
55
- };
56
- }));
57
- },
58
- async get(topicId) {
59
- return gateway.request({
60
- path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}`,
61
- }).then((response) => mapGatewayData(response, (data) => normalizeTopicRecord(asRecord(data).topic ?? data)));
62
- },
63
- async create(input, idempotencyKey) {
64
- const topicId = resolveTopicId(input);
65
- return gateway.request({
66
- path: "/api/platform/v1/topics",
67
- method: "POST",
68
- body: {
69
- ...input,
70
- ...(topicId ? { topicId } : {}),
71
- type: input.type ?? "theme",
72
- },
73
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
74
- }).then((response) => mapGatewayData(response, (data) => normalizeTopicRecord(data)));
75
- },
76
- async update(topicId, input, idempotencyKey) {
77
- return gateway.request({
78
- path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}`,
79
- method: "PATCH",
80
- body: input,
81
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
82
- }).then((response) => mapGatewayData(response, (data) => normalizeTopicRecord(data)));
83
- },
84
- async getTree(topicId, query = {}) {
85
- return gateway.request({
86
- path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/tree${toQueryString(query)}`,
87
- }).then((response) => mapGatewayData(response, (data) => {
88
- const record = asRecord(data);
89
- return {
90
- tree: Array.isArray(record.tree)
91
- ? record.tree.map(normalizeTopicTreeNode)
92
- : [],
93
- };
94
- }));
95
- },
96
- async getCoverage(topicId, query = {}) {
97
- return gateway.request({
98
- path: `/api/platform/v1/topics/${encodeURIComponent(topicId)}/coverage${toQueryString(query)}`,
99
- });
100
- },
101
- async remove(topicId, idempotencyKey) {
102
- return gateway.request({
103
- path: "/api/platform/v1/topics/remove",
104
- method: "POST",
105
- body: { id: topicId },
106
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
107
- });
108
- },
109
- async bulkCreate(input, idempotencyKey) {
110
- return gateway.request({
111
- path: "/api/platform/v1/topics/bulk",
112
- method: "POST",
113
- body: input,
114
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
115
- });
116
- },
117
- };
118
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- /** Current SDK package version. */
2
- export declare const LUCERN_SDK_VERSION = "0.2.0-alpha.1";
@@ -1,2 +0,0 @@
1
- /** Current SDK package version. */
2
- export const LUCERN_SDK_VERSION = "0.2.0-alpha.1";
@@ -1,366 +0,0 @@
1
- import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, toQueryString, } from "./coreClient.js";
2
- import { asListItems, createListResult, mapAliasedList, mapGatewayData, normalizeTopicQuery, resolveTopicId, withTopicAlias, } from "./sdkSurface.js";
3
- export { LucernApiError };
4
- function normalizeLensQuery(value) {
5
- const topicId = resolveTopicId(value);
6
- return {
7
- ...value,
8
- ...(topicId ? { topicId } : {}),
9
- };
10
- }
11
- /**
12
- * Create the workflow client for lenses, legacy branches, worktrees, context,
13
- * and tasks.
14
- * @param config - Gateway transport configuration.
15
- * @returns An object with methods to manage branches, lenses, worktrees, topics, and tasks.
16
- */
17
- export function createWorkflowClient(config = {}) {
18
- const gateway = createGatewayRequestClient(config);
19
- const client = {
20
- /**
21
- * List workflow branches for a topic scope.
22
- */
23
- async listBranches(query) {
24
- return gateway.request({
25
- path: `/api/platform/v1/workflow/branches${toQueryString(normalizeTopicQuery(query))}`,
26
- }).then((response) => mapGatewayData(response, (data) => mapAliasedList(data, "branches")));
27
- },
28
- /**
29
- * Create a workflow branch.
30
- */
31
- async createBranch(input, idempotencyKey) {
32
- return gateway.request({
33
- path: "/api/platform/v1/workflow/branches",
34
- method: "POST",
35
- body: normalizeTopicQuery(input),
36
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
37
- }).then((response) => mapGatewayData(response, (data) => withTopicAlias(data)));
38
- },
39
- /**
40
- * List reusable lenses for a workspace or topic scope.
41
- */
42
- async listLenses(query) {
43
- return gateway.request({
44
- path: `/api/platform/v1/workflow/lenses${toQueryString(normalizeLensQuery(query))}`,
45
- }).then((response) => mapGatewayData(response, (data) => mapAliasedList(data, "lenses")));
46
- },
47
- /**
48
- * Create a reusable workflow lens.
49
- */
50
- async createLens(input, idempotencyKey) {
51
- const payload = normalizeLensQuery(input);
52
- return gateway.request({
53
- path: "/api/platform/v1/workflow/lenses",
54
- method: "POST",
55
- body: payload,
56
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
57
- }).then((response) => mapGatewayData(response, (data) => withTopicAlias(data)));
58
- },
59
- /**
60
- * Apply an existing lens to a topic.
61
- */
62
- async applyLensToTopic(input, idempotencyKey) {
63
- const payload = normalizeLensQuery(input);
64
- return gateway.request({
65
- path: "/api/platform/v1/workflow/lens-bindings",
66
- method: "POST",
67
- body: payload,
68
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
69
- }).then((response) => mapGatewayData(response, (data) => withTopicAlias(data)));
70
- },
71
- /**
72
- * Remove an applied lens from a topic.
73
- */
74
- async removeLensFromTopic(input, idempotencyKey) {
75
- const topicId = resolveTopicId(input);
76
- if (!topicId) {
77
- throw new LucernApiError({
78
- code: "INVALID_REQUEST",
79
- message: "topicId is required",
80
- status: 400,
81
- });
82
- }
83
- return gateway.request({
84
- path: `/api/platform/v1/workflow/lens-bindings${toQueryString({
85
- lensId: input.lensId,
86
- topicId,
87
- })}`,
88
- method: "DELETE",
89
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
90
- }).then((response) => mapGatewayData(response, (data) => withTopicAlias(data)));
91
- },
92
- /**
93
- * List worktrees for a topic scope.
94
- */
95
- async listWorktrees(query) {
96
- const normalized = normalizeTopicQuery(query);
97
- return gateway.request({
98
- path: `/api/platform/v1/worktrees${toQueryString({
99
- ...normalized,
100
- track: query.track,
101
- executionBand: query.executionBand,
102
- })}`,
103
- }).then((response) => mapGatewayData(response, (data) => mapAliasedList(data, "worktrees")));
104
- },
105
- /**
106
- * List all worktrees across accessible topics.
107
- */
108
- async listAllWorktrees(query = {}) {
109
- return gateway.request({
110
- path: `/api/platform/v1/worktrees${toQueryString({
111
- status: query.status,
112
- track: query.track,
113
- executionBand: query.executionBand,
114
- limit: query.limit,
115
- })}`,
116
- }).then((response) => mapGatewayData(response, (data) => {
117
- const record = data && typeof data === "object" && !Array.isArray(data)
118
- ? data
119
- : {};
120
- const list = mapAliasedList(data, "worktrees");
121
- return {
122
- ...list,
123
- ...(record.tracks &&
124
- typeof record.tracks === "object" &&
125
- !Array.isArray(record.tracks)
126
- ? { tracks: record.tracks }
127
- : {}),
128
- ...(record.bands &&
129
- typeof record.bands === "object" &&
130
- !Array.isArray(record.bands)
131
- ? { bands: record.bands }
132
- : {}),
133
- };
134
- }));
135
- },
136
- /**
137
- * Create a workflow worktree.
138
- */
139
- async createWorktree(input, idempotencyKey) {
140
- return gateway.request({
141
- path: "/api/platform/v1/worktrees",
142
- method: "POST",
143
- body: normalizeTopicQuery(input),
144
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
145
- }).then((response) => mapGatewayData(response, (data) => withTopicAlias(data)));
146
- },
147
- /**
148
- * @deprecated Use createWorktree.
149
- */
150
- async addWorktree(input, idempotencyKey) {
151
- return client.createWorktree(input, idempotencyKey);
152
- },
153
- /**
154
- * Merge a worktree into the main belief line.
155
- */
156
- async merge(worktreeId, input, idempotencyKey) {
157
- return gateway.request({
158
- path: `/api/platform/v1/worktrees/${encodeURIComponent(worktreeId)}/merge`,
159
- method: "POST",
160
- body: input,
161
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
162
- });
163
- },
164
- /**
165
- * Activate a planning worktree.
166
- */
167
- async activateWorktree(worktreeId, idempotencyKey) {
168
- return gateway.request({
169
- path: `/api/platform/v1/worktrees/${encodeURIComponent(worktreeId)}/activate`,
170
- method: "POST",
171
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
172
- }).then((response) => mapGatewayData(response, (data) => withTopicAlias(data)));
173
- },
174
- /**
175
- * Update targeted beliefs/questions for a worktree.
176
- */
177
- async updateWorktreeTargets(input, idempotencyKey) {
178
- const { worktreeId, ...body } = input;
179
- return gateway.request({
180
- path: `/api/platform/v1/worktrees/${encodeURIComponent(worktreeId)}/targets`,
181
- method: "POST",
182
- body,
183
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
184
- }).then((response) => mapGatewayData(response, (data) => withTopicAlias(data)));
185
- },
186
- /**
187
- * Mark a worktree record complete.
188
- */
189
- async completeWorktree(input, idempotencyKey) {
190
- return gateway.request({
191
- path: "/api/platform/v1/worktrees/complete",
192
- method: "POST",
193
- body: input,
194
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
195
- });
196
- },
197
- /**
198
- * Advance a worktree to its next lifecycle phase.
199
- */
200
- async advanceWorktreePhase(input, idempotencyKey) {
201
- return gateway.request({
202
- path: "/api/platform/v1/worktrees/advance-phase",
203
- method: "POST",
204
- body: input,
205
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
206
- });
207
- },
208
- /**
209
- * Force a worktree into a specific lifecycle phase.
210
- */
211
- async setWorktreePhase(input, idempotencyKey) {
212
- return gateway.request({
213
- path: "/api/platform/v1/worktrees/set-phase",
214
- method: "POST",
215
- body: input,
216
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
217
- });
218
- },
219
- /**
220
- * Patch opaque worktree state for orchestration flows.
221
- */
222
- async patchWorktreeState(input, idempotencyKey) {
223
- return gateway.request({
224
- path: "/api/platform/v1/worktrees/patch-state",
225
- method: "POST",
226
- body: input,
227
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
228
- });
229
- },
230
- /**
231
- * Batch create worktree records.
232
- */
233
- async bulkCreateWorktrees(input, idempotencyKey) {
234
- return gateway.request({
235
- path: "/api/platform/v1/worktrees/bulk",
236
- method: "POST",
237
- body: input,
238
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
239
- });
240
- },
241
- /**
242
- * Open a pull request for a worktree.
243
- */
244
- async openPullRequest(worktreeId, input, idempotencyKey) {
245
- return gateway.request({
246
- path: `/api/platform/v1/workflow/worktrees/${encodeURIComponent(worktreeId)}/pull-request`,
247
- method: "POST",
248
- body: input,
249
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
250
- });
251
- },
252
- /**
253
- * Push scored worktree findings into another context.
254
- */
255
- async push(worktreeId, input, idempotencyKey) {
256
- return gateway.request({
257
- path: `/api/platform/v1/workflow/worktrees/${encodeURIComponent(worktreeId)}/push`,
258
- method: "POST",
259
- body: input,
260
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
261
- });
262
- },
263
- /**
264
- * List accessible topic contexts.
265
- */
266
- async listTopics(query = {}) {
267
- return gateway.request({
268
- path: `/api/platform/v1/workflow/topics${toQueryString({
269
- includeShared: typeof query.includeShared === "boolean"
270
- ? query.includeShared
271
- ? "true"
272
- : "false"
273
- : undefined,
274
- limit: query.limit,
275
- })}`,
276
- }).then((response) => mapGatewayData(response, (data) => {
277
- const items = asListItems(data, "topics").map((item) => withTopicAlias(item));
278
- const record = data && typeof data === "object"
279
- ? data
280
- : {};
281
- return {
282
- ...record,
283
- ...createListResult(items, "topics"),
284
- total: typeof record.total === "number" ? record.total : items.length,
285
- };
286
- }));
287
- },
288
- /**
289
- * Switch the active context by topic or project name.
290
- */
291
- async switchTopicContext(input, idempotencyKey) {
292
- return gateway.request({
293
- path: "/api/platform/v1/workflow/topics/switch",
294
- method: "POST",
295
- body: {
296
- targetTopicName: input.targetTopicName,
297
- },
298
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
299
- }).then((response) => mapGatewayData(response, (data) => withTopicAlias(data)));
300
- },
301
- /**
302
- * Create a workflow task.
303
- */
304
- async createTask(input, idempotencyKey) {
305
- return gateway.request({
306
- path: "/api/platform/v1/workflow/tasks",
307
- method: "POST",
308
- body: normalizeTopicQuery(input),
309
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
310
- });
311
- },
312
- /**
313
- * Complete a workflow task.
314
- */
315
- async completeTask(taskId, input, idempotencyKey) {
316
- return gateway.request({
317
- path: `/api/platform/v1/workflow/tasks/${encodeURIComponent(taskId)}/complete`,
318
- method: "POST",
319
- body: input,
320
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
321
- });
322
- },
323
- /**
324
- * Update a workflow task.
325
- */
326
- async updateTask(taskId, input, idempotencyKey) {
327
- return gateway.request({
328
- path: `/api/platform/v1/workflow/tasks/${encodeURIComponent(taskId)}`,
329
- method: "PATCH",
330
- body: input,
331
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
332
- });
333
- },
334
- /**
335
- * @deprecated Use createBranch.
336
- */
337
- async createPillar(input, idempotencyKey) {
338
- return client.createBranch(input, idempotencyKey);
339
- },
340
- /**
341
- * @deprecated Use addWorktree.
342
- */
343
- async createSprint(input, idempotencyKey) {
344
- return client.createWorktree(input, idempotencyKey);
345
- },
346
- /**
347
- * @deprecated Use merge.
348
- */
349
- async completeSprint(worktreeId, input, idempotencyKey) {
350
- return client.merge(worktreeId, input, idempotencyKey);
351
- },
352
- /**
353
- * @deprecated Use openPullRequest.
354
- */
355
- async requestReview(worktreeId, input, idempotencyKey) {
356
- return client.openPullRequest(worktreeId, input, idempotencyKey);
357
- },
358
- /**
359
- * @deprecated Use push.
360
- */
361
- async publishFindings(worktreeId, input, idempotencyKey) {
362
- return client.push(worktreeId, input, idempotencyKey);
363
- },
364
- };
365
- return client;
366
- }
@@ -1,58 +0,0 @@
1
- /**
2
- * API Enum Contract Definitions
3
- *
4
- * Canonical enum values for all API-facing enumerations.
5
- * These are co-equal with MCP contracts as external contracts.
6
- * SDK types are DERIVED from these — not independently authored.
7
- *
8
- * CONTRACT SURFACE: Adding a new enum value is additive (non-breaking).
9
- * Removing or renaming an existing value is a BREAKING CHANGE.
10
- */
11
- /** Fork reasons — why a scored belief was branched */
12
- export declare const FORK_REASONS: readonly ["refinement", "contradiction_response", "scope_change", "confidence_collapse", "manual"];
13
- export type ForkReason = (typeof FORK_REASONS)[number];
14
- /** Confidence modulation triggers — what caused a confidence change */
15
- export declare const CONFIDENCE_TRIGGERS: readonly ["evidence_added", "contradiction_detected", "merge_outcome", "manual", "decay"];
16
- export type ConfidenceTrigger = (typeof CONFIDENCE_TRIGGERS)[number];
17
- /** Belief status — lifecycle state */
18
- export declare const BELIEF_STATUSES: readonly ["unscored", "scored", "archived"];
19
- export type BeliefStatus = (typeof BELIEF_STATUSES)[number];
20
- /** Reasoning methods — how an edge relationship was determined */
21
- export declare const REASONING_METHODS: readonly ["deductive", "inductive", "abductive", "analogical", "empirical"];
22
- export type ReasoningMethod = (typeof REASONING_METHODS)[number];
23
- /** Defeat types (Pollock taxonomy) — how a contradiction operates */
24
- export declare const DEFEAT_TYPES: readonly ["rebuts", "undercuts", "undermines"];
25
- export type DefeatType = (typeof DEFEAT_TYPES)[number];
26
- /** Contradiction severity levels */
27
- export declare const CONTRADICTION_SEVERITIES: readonly ["low", "medium", "high", "critical"];
28
- export type ContradictionSeverity = (typeof CONTRADICTION_SEVERITIES)[number];
29
- /** Contradiction resolution status */
30
- export declare const CONTRADICTION_STATUSES: readonly ["unresolved", "resolved", "accepted"];
31
- export type ContradictionStatus = (typeof CONTRADICTION_STATUSES)[number];
32
- /** Merge outcome types — how a worktree merge resolved */
33
- export declare const MERGE_OUTCOMES: readonly ["validated", "invalidated", "forked", "inconclusive"];
34
- export type MergeOutcome = (typeof MERGE_OUTCOMES)[number];
35
- /** Worktree phases — investigation lifecycle within a checked-out worktree */
36
- export declare const WORKTREE_PHASES: readonly ["hypothesis", "investigation", "evaluation", "resolution"];
37
- export type WorktreePhase = (typeof WORKTREE_PHASES)[number];
38
- /** Branch status — thematic branch lifecycle */
39
- export declare const BRANCH_STATUSES: readonly ["dormant", "active", "archived"];
40
- export type BranchStatus = (typeof BRANCH_STATUSES)[number];
41
- /** Pull request status — review lifecycle before merge */
42
- export declare const PULL_REQUEST_STATUSES: readonly ["pending_review", "changes_requested", "approved", "blocked"];
43
- export type PullRequestStatus = (typeof PULL_REQUEST_STATUSES)[number];
44
- /** Epistemic layers — the hierarchy of knowledge */
45
- export declare const EPISTEMIC_LAYERS: readonly ["L1", "L2", "L3", "L4"];
46
- export type EpistemicLayer = (typeof EPISTEMIC_LAYERS)[number];
47
- /**
48
- * Judgment type — classification of the determination.
49
- *
50
- * Phase 1: These are new enum values for the Judgment (L4) vocabulary.
51
- * The existing code uses "Decision" — these are the forward-looking terms
52
- * that will eventually replace the Decision vocabulary (Phase 2-3).
53
- */
54
- export declare const JUDGMENT_TYPES: readonly ["investment_thesis", "thesis_maturity", "contradiction_ruling", "scope_determination", "confidence_ruling"];
55
- export type JudgmentType = (typeof JUDGMENT_TYPES)[number];
56
- /** Core edge types used in the Integration Surfaces */
57
- export declare const INTEGRATION_EDGE_TYPES: readonly ["informs", "grounds", "answers", "contradicts", "supports", "depends_on", "derived_from", "contains", "supersedes", "tests"];
58
- export type IntegrationEdgeType = (typeof INTEGRATION_EDGE_TYPES)[number];