@lucern/sdk 0.2.0-alpha.6 → 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 (206) 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 -58
  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/{dist/lib/platform/sdk/contextFacade.d.ts → src/contextFacade.ts} +6 -1
  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/src/learningClient.ts +95 -0
  69. package/src/mcpParityClient.ts +240 -0
  70. package/src/mcpParitySurface.ts +70 -0
  71. package/src/ontologyClient.ts +275 -0
  72. package/src/packRuntime.ts +3 -0
  73. package/src/packsClient.ts +260 -0
  74. package/src/policyClient.ts +572 -0
  75. package/src/realtime/index.ts +51 -0
  76. package/src/realtime/refs.ts +17 -0
  77. package/src/reportsClient.ts +99 -0
  78. package/src/schemaClient.ts +129 -0
  79. package/src/sdkSurface.ts +190 -0
  80. package/src/topicsClient.ts +243 -0
  81. package/src/types.ts +807 -0
  82. package/src/workflowClient.ts +826 -0
  83. package/tsconfig.json +9 -0
  84. package/dist/.generated +0 -2
  85. package/dist/index.d.ts +0 -3
  86. package/dist/index.js +0 -3
  87. package/dist/lib/platform/auth/credentials.d.ts +0 -5
  88. package/dist/lib/platform/auth/credentials.js +0 -40
  89. package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
  90. package/dist/lib/platform/sdk/adminClient.js +0 -384
  91. package/dist/lib/platform/sdk/answersClient.js +0 -21
  92. package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
  93. package/dist/lib/platform/sdk/audiencesClient.js +0 -111
  94. package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
  95. package/dist/lib/platform/sdk/auditClient.js +0 -21
  96. package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
  97. package/dist/lib/platform/sdk/beliefsClient.js +0 -124
  98. package/dist/lib/platform/sdk/client.d.ts +0 -2369
  99. package/dist/lib/platform/sdk/client.js +0 -1831
  100. package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
  101. package/dist/lib/platform/sdk/contextClient.js +0 -86
  102. package/dist/lib/platform/sdk/contextFacade.js +0 -10
  103. package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
  104. package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
  105. package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
  106. package/dist/lib/platform/sdk/contextTypes.js +0 -1
  107. package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
  108. package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
  109. package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
  110. package/dist/lib/platform/sdk/coreClient.js +0 -366
  111. package/dist/lib/platform/sdk/customTools.d.ts +0 -83
  112. package/dist/lib/platform/sdk/customTools.js +0 -247
  113. package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
  114. package/dist/lib/platform/sdk/decisionsClient.js +0 -129
  115. package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
  116. package/dist/lib/platform/sdk/domainContext.js +0 -1
  117. package/dist/lib/platform/sdk/events.d.ts +0 -176
  118. package/dist/lib/platform/sdk/events.js +0 -261
  119. package/dist/lib/platform/sdk/eventsCore.d.ts +0 -13
  120. package/dist/lib/platform/sdk/eventsCore.js +0 -13
  121. package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
  122. package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
  123. package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
  124. package/dist/lib/platform/sdk/graphClient.js +0 -235
  125. package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
  126. package/dist/lib/platform/sdk/harnessClient.js +0 -219
  127. package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
  128. package/dist/lib/platform/sdk/identityClient.js +0 -131
  129. package/dist/lib/platform/sdk/index.js +0 -49
  130. package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
  131. package/dist/lib/platform/sdk/learningClient.js +0 -53
  132. package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
  133. package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
  134. package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
  135. package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
  136. package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
  137. package/dist/lib/platform/sdk/ontologyClient.js +0 -161
  138. package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
  139. package/dist/lib/platform/sdk/packRuntime.js +0 -1
  140. package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
  141. package/dist/lib/platform/sdk/packsClient.js +0 -157
  142. package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
  143. package/dist/lib/platform/sdk/policyClient.js +0 -277
  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/auth-context.contract.d.ts +0 -8
  161. package/dist/lucern/contracts/src/auth-context.contract.js +0 -8
  162. package/dist/lucern/contracts/src/auth-session.contract.d.ts +0 -8
  163. package/dist/lucern/contracts/src/auth-session.contract.js +0 -8
  164. package/dist/lucern/contracts/src/auth.contract.d.ts +0 -88
  165. package/dist/lucern/contracts/src/auth.contract.js +0 -57
  166. package/dist/lucern/contracts/src/context-pack.contract.d.ts +0 -494
  167. package/dist/lucern/contracts/src/context-pack.contract.js +0 -169
  168. package/dist/lucern/contracts/src/convex-admin.contract.d.ts +0 -5
  169. package/dist/lucern/contracts/src/convex-admin.contract.js +0 -1
  170. package/dist/lucern/contracts/src/events-types.contract.d.ts +0 -8
  171. package/dist/lucern/contracts/src/events-types.contract.js +0 -8
  172. package/dist/lucern/contracts/src/events.contract.d.ts +0 -176
  173. package/dist/lucern/contracts/src/events.contract.js +0 -159
  174. package/dist/lucern/contracts/src/gateway.contract.d.ts +0 -74
  175. package/dist/lucern/contracts/src/gateway.contract.js +0 -19
  176. package/dist/lucern/contracts/src/ids.contract.d.ts +0 -7
  177. package/dist/lucern/contracts/src/ids.contract.js +0 -24
  178. package/dist/lucern/contracts/src/index.d.ts +0 -29
  179. package/dist/lucern/contracts/src/index.js +0 -29
  180. package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
  181. package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
  182. package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
  183. package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
  184. package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
  185. package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
  186. package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +0 -8
  187. package/dist/lucern/contracts/src/ontology-matching.contract.js +0 -8
  188. package/dist/lucern/contracts/src/prompt.contract.d.ts +0 -24
  189. package/dist/lucern/contracts/src/prompt.contract.js +0 -24
  190. package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +0 -358
  191. package/dist/lucern/contracts/src/sdk-methods.contract.js +0 -19
  192. package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +0 -92
  193. package/dist/lucern/contracts/src/sdk-tools.contract.js +0 -1398
  194. package/dist/lucern/contracts/src/text-matching.contract.d.ts +0 -53
  195. package/dist/lucern/contracts/src/text-matching.contract.js +0 -277
  196. package/dist/lucern/contracts/src/topic-scope.contract.d.ts +0 -8
  197. package/dist/lucern/contracts/src/topic-scope.contract.js +0 -8
  198. package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
  199. package/dist/lucern/contracts/src/workflow-runtime.contract.js +0 -257
  200. package/dist/realtime-refs.d.ts +0 -1
  201. package/dist/realtime-refs.js +0 -1
  202. package/dist/realtime.d.ts +0 -1
  203. package/dist/realtime.js +0 -1
  204. /package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +0 -0
  205. /package/{dist/lib/platform/sdk/promptCatalog.d.ts → src/promptCatalog.ts} +0 -0
  206. /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
@@ -1,313 +0,0 @@
1
- import { type GatewayClientConfig, LucernApiError } from "./coreClient";
2
- import type { LensPerspectiveType, LensPromptTemplateReference, LensStatus, LensTaskTemplate, LensWorkflowTemplate } from "./contracts/lensWorkflow";
3
- import type { WorkflowAutoFixPolicy, WorkflowProofArtifact, WorkflowStaffingHint } from "./contracts/workflowRuntime";
4
- import type { CompleteTaskResponse, CreateTaskResponse, JsonObject, ListTopicsResponse, ListWorktreesResponse, MergeWorktreeResponse, OpenPullRequestResponse, PushWorktreeResponse, SwitchTopicContextResponse, TopicIdentifierInput, UpdateTaskResponse, WorkflowBranchRecord, WorkflowLensRecord, WorkflowWorktreeRecord } from "./types";
5
- export { LucernApiError };
6
- export type { PlatformGatewaySuccess } from "./coreClient";
7
- export type { AddWorktreeResponse, CompleteTaskResponse, CreateBranchResponse, CreateLensResponse, CreateTaskResponse, LensTopicBindingResponse, ListBranchesResponse, ListLensesResponse, ListTopicsResponse, ListWorktreesResponse, MergeWorktreeResponse, OpenPullRequestResponse, PushWorktreeResponse, SwitchTopicContextResponse, UpdateTaskResponse, } from "./types";
8
- /** Configuration for the workflow client. */
9
- export type WorkflowClientConfig = GatewayClientConfig;
10
- /** Lifecycle status of a workflow branch. */
11
- export type WorkflowBranchStatus = "dormant" | "active" | "archived";
12
- /** Lifecycle status of a workflow lens. */
13
- export type WorkflowLensStatus = LensStatus;
14
- /** Analytical perspective type for a lens overlay. */
15
- export type WorkflowLensPerspectiveType = LensPerspectiveType;
16
- /** Lifecycle status of a workflow worktree. */
17
- export type WorkflowWorktreeStatus = "planning" | "active" | "paused" | "completed" | "merged" | "failed" | "archived";
18
- /** Possible outcomes when merging worktree findings into the main belief line. */
19
- export type WorkflowMergeOutcome = "validated" | "invalidated" | "forked" | "inconclusive";
20
- /** Input for creating a new workflow worktree. */
21
- export type AddWorktreeInput = {
22
- title: string;
23
- topicId?: string;
24
- branchId?: string;
25
- objective?: string;
26
- hypothesis?: string;
27
- beliefIds?: string[];
28
- autoShape?: boolean;
29
- domainPackId?: string;
30
- executionOrder?: number;
31
- dependsOn?: string[];
32
- blocks?: string[];
33
- gate?: string;
34
- proofArtifacts?: WorkflowProofArtifact[];
35
- staffingHint?: WorkflowStaffingHint | string;
36
- lastReconciledAt?: number;
37
- autoFixPolicy?: WorkflowAutoFixPolicy;
38
- } & TopicIdentifierInput;
39
- /** Input for merging worktree findings with belief confidence outcomes. */
40
- export type MergeInput = {
41
- outcomes: Array<{
42
- beliefId: string;
43
- confidence: number;
44
- rationale: string;
45
- }>;
46
- summary?: string;
47
- };
48
- /** Input for updating the beliefs and questions tracked by a worktree. */
49
- export type UpdateWorktreeTargetsInput = {
50
- worktreeId: string;
51
- addBeliefIds?: string[];
52
- addQuestionIds?: string[];
53
- removeBeliefIds?: string[];
54
- removeQuestionIds?: string[];
55
- };
56
- /** Input for marking a worktree complete with recorded outcomes. */
57
- export type CompleteWorktreeInput = {
58
- worktreeId: string;
59
- keyFindings?: string[];
60
- decisionsReached?: string[];
61
- nextSteps?: string[];
62
- };
63
- /** Input for moving a worktree forward to its next phase. */
64
- export type AdvanceWorktreePhaseInput = {
65
- worktreeId: string;
66
- };
67
- /** Input for forcing a worktree into a specific phase. */
68
- export type SetWorktreePhaseInput = {
69
- worktreeId: string;
70
- phase: string;
71
- };
72
- /** Input for patching arbitrary structured worktree state. */
73
- export type PatchWorktreeStateInput = {
74
- worktreeId: string;
75
- patch: JsonObject;
76
- };
77
- /** Input for batch-creating worktrees through the workflow surface. */
78
- export type BulkCreateWorktreesInput = {
79
- worktrees: unknown[];
80
- };
81
- /** Input for listing accessible topic contexts. */
82
- export type ListTopicsInput = {
83
- includeShared?: boolean;
84
- limit?: number;
85
- };
86
- /** Input for switching the active topic context by name. */
87
- export type SwitchTopicContextInput = {
88
- targetTopicName: string;
89
- };
90
- /** Input for creating a workflow task linked to a question or worktree. */
91
- export type CreateTaskInput = {
92
- title: string;
93
- topicId?: string;
94
- taskType?: "research" | "interview" | "analysis" | "data_collection";
95
- linkedQuestionId?: string;
96
- linkedWorktreeId?: string;
97
- linkedBeliefId?: string;
98
- description?: string;
99
- priority?: "low" | "medium" | "high" | "urgent";
100
- } & TopicIdentifierInput;
101
- /** Input for marking a workflow task as completed with an output summary. */
102
- export type CompleteTaskInput = {
103
- outputSummary: string;
104
- evidenceCreated?: boolean;
105
- };
106
- /** Input for partially updating an existing workflow task. */
107
- export type UpdateTaskInput = {
108
- title?: string;
109
- description?: string;
110
- linkedBeliefId?: string;
111
- linkedQuestionId?: string;
112
- linkedWorktreeId?: string;
113
- priority?: "critical" | "high" | "medium" | "low";
114
- status?: "todo" | "in_progress" | "blocked" | "done";
115
- };
116
- /**
117
- * Create the workflow client for lenses, legacy branches, worktrees, context,
118
- * and tasks.
119
- * @param config - Gateway transport configuration.
120
- * @returns An object with methods to manage branches, lenses, worktrees, topics, and tasks.
121
- */
122
- export declare function createWorkflowClient(config?: WorkflowClientConfig): {
123
- /**
124
- * List workflow branches for a topic scope.
125
- */
126
- listBranches(query: {
127
- topicId?: string;
128
- status?: WorkflowBranchStatus;
129
- limit?: number;
130
- } & TopicIdentifierInput): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<WorkflowBranchRecord, "branches">>>;
131
- /**
132
- * Create a workflow branch.
133
- */
134
- createBranch(input: {
135
- name: string;
136
- topicId?: string;
137
- description?: string;
138
- metadata?: JsonObject;
139
- } & TopicIdentifierInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<WorkflowBranchRecord>>;
140
- /**
141
- * List reusable lenses for a workspace or topic scope.
142
- */
143
- listLenses(query: {
144
- workspaceId?: string;
145
- topicId?: string;
146
- status?: WorkflowLensStatus;
147
- perspectiveType?: WorkflowLensPerspectiveType;
148
- } & TopicIdentifierInput): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<WorkflowLensRecord, "lenses">>>;
149
- /**
150
- * Create a reusable workflow lens.
151
- */
152
- createLens(input: {
153
- name: string;
154
- workspaceId?: string;
155
- topicId?: string;
156
- description?: string;
157
- perspectiveType: WorkflowLensPerspectiveType;
158
- promptTemplates?: LensPromptTemplateReference[];
159
- workflowTemplates?: LensWorkflowTemplate[];
160
- taskTemplates?: LensTaskTemplate[];
161
- filterCriteria?: JsonObject;
162
- } & TopicIdentifierInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<WorkflowLensRecord>>;
163
- /**
164
- * Apply an existing lens to a topic.
165
- */
166
- applyLensToTopic(input: {
167
- lensId: string;
168
- topicId?: string;
169
- metadata?: JsonObject;
170
- } & TopicIdentifierInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").WorkflowLensBindingRecord>>;
171
- /**
172
- * Remove an applied lens from a topic.
173
- */
174
- removeLensFromTopic(input: {
175
- lensId: string;
176
- topicId?: string;
177
- } & TopicIdentifierInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").WorkflowLensBindingRecord>>;
178
- /**
179
- * List worktrees for a topic scope.
180
- */
181
- listWorktrees(query: {
182
- topicId?: string;
183
- branchId?: string;
184
- status?: WorkflowWorktreeStatus;
185
- track?: string;
186
- executionBand?: number;
187
- limit?: number;
188
- } & TopicIdentifierInput): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").ListResult<WorkflowWorktreeRecord, "worktrees">>>;
189
- /**
190
- * List all worktrees across accessible topics.
191
- */
192
- listAllWorktrees(query?: {
193
- status?: WorkflowWorktreeStatus;
194
- track?: string;
195
- executionBand?: number;
196
- limit?: number;
197
- }): Promise<import("./coreClient").PlatformGatewaySuccess<ListWorktreesResponse>>;
198
- /**
199
- * Create a workflow worktree.
200
- */
201
- createWorktree(input: AddWorktreeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<WorkflowWorktreeRecord>>;
202
- /**
203
- * @deprecated Use createWorktree.
204
- */
205
- addWorktree(input: AddWorktreeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<WorkflowWorktreeRecord>>;
206
- /**
207
- * Merge a worktree into the main belief line.
208
- */
209
- merge(worktreeId: string, input: MergeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<MergeWorktreeResponse>>;
210
- /**
211
- * Activate a planning worktree.
212
- */
213
- activateWorktree(worktreeId: string, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<WorkflowWorktreeRecord>>;
214
- /**
215
- * Update targeted beliefs/questions for a worktree.
216
- */
217
- updateWorktreeTargets(input: UpdateWorktreeTargetsInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<WorkflowWorktreeRecord>>;
218
- /**
219
- * Mark a worktree record complete.
220
- */
221
- completeWorktree(input: CompleteWorktreeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
222
- /**
223
- * Advance a worktree to its next lifecycle phase.
224
- */
225
- advanceWorktreePhase(input: AdvanceWorktreePhaseInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
226
- /**
227
- * Force a worktree into a specific lifecycle phase.
228
- */
229
- setWorktreePhase(input: SetWorktreePhaseInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
230
- /**
231
- * Patch opaque worktree state for orchestration flows.
232
- */
233
- patchWorktreeState(input: PatchWorktreeStateInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
234
- /**
235
- * Batch create worktree records.
236
- */
237
- bulkCreateWorktrees(input: BulkCreateWorktreesInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
238
- /**
239
- * Open a pull request for a worktree.
240
- */
241
- openPullRequest(worktreeId: string, input: {
242
- summary: string;
243
- reviewers?: string[];
244
- status?: "pending_review" | "changes_requested" | "approved" | "blocked";
245
- }, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<OpenPullRequestResponse>>;
246
- /**
247
- * Push scored worktree findings into another context.
248
- */
249
- push(worktreeId: string, input: {
250
- targetContext: string;
251
- beliefIds?: string[];
252
- metadata?: JsonObject;
253
- }, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<PushWorktreeResponse>>;
254
- /**
255
- * List accessible topic contexts.
256
- */
257
- listTopics(query?: ListTopicsInput): Promise<import("./coreClient").PlatformGatewaySuccess<ListTopicsResponse>>;
258
- /**
259
- * Switch the active context by topic or project name.
260
- */
261
- switchTopicContext(input: SwitchTopicContextInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<SwitchTopicContextResponse>>;
262
- /**
263
- * Create a workflow task.
264
- */
265
- createTask(input: CreateTaskInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<CreateTaskResponse>>;
266
- /**
267
- * Complete a workflow task.
268
- */
269
- completeTask(taskId: string, input: CompleteTaskInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<CompleteTaskResponse>>;
270
- /**
271
- * Update a workflow task.
272
- */
273
- updateTask(taskId: string, input: UpdateTaskInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<UpdateTaskResponse>>;
274
- /**
275
- * @deprecated Use createBranch.
276
- */
277
- createPillar(input: {
278
- name: string;
279
- topicId?: string;
280
- description?: string;
281
- metadata?: JsonObject;
282
- } & TopicIdentifierInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<WorkflowBranchRecord>>;
283
- /**
284
- * @deprecated Use addWorktree.
285
- */
286
- createSprint(input: {
287
- title: string;
288
- topicId?: string;
289
- branchId?: string;
290
- hypothesis?: string;
291
- beliefIds?: string[];
292
- } & TopicIdentifierInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<WorkflowWorktreeRecord>>;
293
- /**
294
- * @deprecated Use merge.
295
- */
296
- completeSprint(worktreeId: string, input: MergeInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<MergeWorktreeResponse>>;
297
- /**
298
- * @deprecated Use openPullRequest.
299
- */
300
- requestReview(worktreeId: string, input: {
301
- summary: string;
302
- reviewers?: string[];
303
- status?: "pending_review" | "changes_requested" | "approved" | "blocked";
304
- }, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<OpenPullRequestResponse>>;
305
- /**
306
- * @deprecated Use push.
307
- */
308
- publishFindings(worktreeId: string, input: {
309
- targetContext: string;
310
- beliefIds?: string[];
311
- metadata?: JsonObject;
312
- }, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<PushWorktreeResponse>>;
313
- };
@@ -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
- }