@lucern/sdk 0.3.0-alpha.0 → 0.3.0-alpha.1

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 (61) hide show
  1. package/README.md +33 -21
  2. package/dist/beliefs/index.d.ts +7 -7
  3. package/dist/beliefs/index.js +100 -99
  4. package/dist/beliefs/index.js.map +1 -1
  5. package/dist/beliefsClient.d.ts +14 -29
  6. package/dist/beliefsClient.js +34 -71
  7. package/dist/beliefsClient.js.map +1 -1
  8. package/dist/{client-DAuKnDlx.d.ts → client-B6aWUUwp.d.ts} +25 -20
  9. package/dist/client.d.ts +1 -1
  10. package/dist/client.js +100 -99
  11. package/dist/client.js.map +1 -1
  12. package/dist/contracts/index.js +1 -1
  13. package/dist/contracts/index.js.map +1 -1
  14. package/dist/contracts/workflow-runtime.contract.js +1 -1
  15. package/dist/contracts/workflow-runtime.contract.js.map +1 -1
  16. package/dist/contracts/workflowRuntime.js +1 -1
  17. package/dist/contracts/workflowRuntime.js.map +1 -1
  18. package/dist/contradictions/index.d.ts +1 -1
  19. package/dist/contradictions/index.js +100 -99
  20. package/dist/contradictions/index.js.map +1 -1
  21. package/dist/decisions/index.d.ts +1 -1
  22. package/dist/decisions/index.js +100 -99
  23. package/dist/decisions/index.js.map +1 -1
  24. package/dist/edges/index.d.ts +1 -1
  25. package/dist/edges/index.js +100 -99
  26. package/dist/edges/index.js.map +1 -1
  27. package/dist/evidence/index.d.ts +2 -1
  28. package/dist/evidence/index.js +100 -99
  29. package/dist/evidence/index.js.map +1 -1
  30. package/dist/gatewayFacades.d.ts +18 -6
  31. package/dist/gatewayFacades.js +22 -41
  32. package/dist/gatewayFacades.js.map +1 -1
  33. package/dist/index.d.ts +2 -2
  34. package/dist/index.js +103 -69
  35. package/dist/index.js.map +1 -1
  36. package/dist/lenses/index.d.ts +7 -5
  37. package/dist/lenses/index.js +100 -99
  38. package/dist/lenses/index.js.map +1 -1
  39. package/dist/nodes/index.d.ts +1 -1
  40. package/dist/nodes/index.js +100 -99
  41. package/dist/nodes/index.js.map +1 -1
  42. package/dist/ontologies/index.d.ts +1 -1
  43. package/dist/ontologies/index.js +100 -99
  44. package/dist/ontologies/index.js.map +1 -1
  45. package/dist/opinion.d.ts +2 -2
  46. package/dist/opinion.js +4 -4
  47. package/dist/opinion.js.map +1 -1
  48. package/dist/questions/index.d.ts +1 -1
  49. package/dist/questions/index.js +100 -99
  50. package/dist/questions/index.js.map +1 -1
  51. package/dist/topics/index.d.ts +1 -1
  52. package/dist/topics/index.js +100 -99
  53. package/dist/topics/index.js.map +1 -1
  54. package/dist/types.d.ts +7 -7
  55. package/dist/workflowClient.d.ts +18 -5
  56. package/dist/workflowClient.js +19 -7
  57. package/dist/workflowClient.js.map +1 -1
  58. package/dist/worktrees/index.d.ts +10 -7
  59. package/dist/worktrees/index.js +100 -99
  60. package/dist/worktrees/index.js.map +1 -1
  61. package/package.json +4 -3
@@ -89,7 +89,7 @@ type EvidenceLinkResult = GatewayRecord & {
89
89
  type BeliefCreateInput = {
90
90
  topicId?: string;
91
91
  text: string;
92
- baseRate: number;
92
+ baseRate?: number;
93
93
  rationale?: string;
94
94
  worktreeId?: string;
95
95
  pillar?: string;
@@ -158,6 +158,7 @@ type EvidenceCreateInput = {
158
158
  source?: string;
159
159
  targetId?: string;
160
160
  weight?: number;
161
+ rationale: string;
161
162
  metadata?: JsonObject;
162
163
  title?: string;
163
164
  content?: string;
@@ -267,7 +268,10 @@ type WorktreeCreateInput = {
267
268
  beliefIds?: string[];
268
269
  autoShape?: boolean;
269
270
  domainPackId?: string;
270
- executionOrder?: number;
271
+ campaign?: number;
272
+ lane?: string;
273
+ laneOrderInCampaign?: number;
274
+ orderInLane?: number;
271
275
  dependsOn?: string[];
272
276
  blocks?: string[];
273
277
  gate?: string;
@@ -279,6 +283,9 @@ type WorktreeCreateInput = {
279
283
  type WorktreeListQuery = {
280
284
  topicId?: string;
281
285
  status?: string;
286
+ groupBy?: "campaign" | "lane" | "flat";
287
+ lane?: string;
288
+ campaign?: number;
282
289
  limit?: number;
283
290
  };
284
291
  type WorktreeActivateInput = {
@@ -289,10 +296,10 @@ type WorktreeUpdateInput = {
289
296
  objective?: string;
290
297
  hypothesis?: string;
291
298
  rationale?: string;
292
- track?: string;
293
- trackPosition?: number;
294
- executionBand?: number;
295
- executionOrder?: number;
299
+ campaign?: number;
300
+ lane?: string;
301
+ laneOrderInCampaign?: number;
302
+ orderInLane?: number;
296
303
  dependsOn?: string[];
297
304
  blocks?: string[];
298
305
  gate?: string;
@@ -560,6 +567,11 @@ declare function createWebhooksFacade(config?: GatewayClientConfig): {
560
567
  declare function createWorktreesFacade(config?: GatewayClientConfig): {
561
568
  create(input: WorktreeCreateInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
562
569
  list(query: WorktreeListQuery): Promise<PlatformGatewaySuccess<WorktreesListResult>>;
570
+ listCampaigns(query?: {
571
+ topicId?: string;
572
+ status?: string;
573
+ limit?: number;
574
+ }): Promise<PlatformGatewaySuccess<GatewayRecord>>;
563
575
  activate(input: WorktreeActivateInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
564
576
  update(input: WorktreeUpdateInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
565
577
  merge(input: WorktreeMergeInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
@@ -334,38 +334,6 @@ function createGatewayRequestClient(config = {}) {
334
334
  };
335
335
  }
336
336
 
337
- // src/opinion.ts
338
- function clamp01(value) {
339
- if (!Number.isFinite(value)) {
340
- return 0;
341
- }
342
- return Math.max(0, Math.min(1, value));
343
- }
344
- function vacuous(baseRate = 0.5) {
345
- return { b: 0, d: 0, u: 1, a: clamp01(baseRate) };
346
- }
347
- function dogmatic(probability, baseRate = 0.5) {
348
- const p = clamp01(probability);
349
- return { b: p, d: 1 - p, u: 0, a: clamp01(baseRate) };
350
- }
351
- function opinionFromBaseRate(probability) {
352
- return vacuous(clamp01(probability));
353
- }
354
- function opinionFromDogmatic(probability, baseRate = 0.5) {
355
- return dogmatic(clamp01(probability), clamp01(baseRate));
356
- }
357
- function opinionFromProjected(probability, uncertainty, baseRate = 0.5) {
358
- const p = clamp01(probability);
359
- const u = clamp01(uncertainty);
360
- const remainingMass = 1 - u;
361
- return {
362
- b: p * remainingMass,
363
- d: (1 - p) * remainingMass,
364
- u,
365
- a: clamp01(baseRate)
366
- };
367
- }
368
-
369
337
  // src/sdkSurface.ts
370
338
  function asRecord(value) {
371
339
  return value && typeof value === "object" ? value : {};
@@ -1142,11 +1110,7 @@ function createTopicsClient(config = {}) {
1142
1110
 
1143
1111
  // src/gatewayFacades.ts
1144
1112
  function normalizeBeliefConfidenceInput(input) {
1145
- const opinion = "opinion" in input ? input.opinion : input.interpretation === "base_rate" ? opinionFromBaseRate(input.confidence) : input.interpretation === "dogmatic" ? opinionFromDogmatic(input.confidence, input.baseRate) : opinionFromProjected(
1146
- input.confidence,
1147
- input.uncertainty,
1148
- input.baseRate
1149
- );
1113
+ const opinion = input.opinion;
1150
1114
  return {
1151
1115
  belief: opinion.b,
1152
1116
  disbelief: opinion.d,
@@ -1154,6 +1118,11 @@ function normalizeBeliefConfidenceInput(input) {
1154
1118
  baseRate: opinion.a,
1155
1119
  trigger: input.trigger,
1156
1120
  rationale: input.rationale,
1121
+ triggeringEvidenceId: input.triggeringEvidenceId,
1122
+ triggeringQuestionId: input.triggeringQuestionId,
1123
+ triggeringAnswerId: input.triggeringAnswerId,
1124
+ triggeringContradictionId: input.triggeringContradictionId,
1125
+ triggeringWorktreeId: input.triggeringWorktreeId,
1157
1126
  maxInlinePropagationTargets: input.maxInlinePropagationTargets
1158
1127
  };
1159
1128
  }
@@ -1893,6 +1862,18 @@ function createWorktreesFacade(config = {}) {
1893
1862
  async list(query) {
1894
1863
  return gateway.request({
1895
1864
  path: `/api/platform/v1/worktrees${toQueryString({
1865
+ topicId: query.topicId,
1866
+ status: query.status,
1867
+ groupBy: query.groupBy,
1868
+ lane: query.lane,
1869
+ campaign: query.campaign,
1870
+ limit: query.limit
1871
+ })}`
1872
+ });
1873
+ },
1874
+ async listCampaigns(query = {}) {
1875
+ return gateway.request({
1876
+ path: `/api/platform/v1/worktrees/campaigns${toQueryString({
1896
1877
  topicId: query.topicId,
1897
1878
  status: query.status,
1898
1879
  limit: query.limit
@@ -1915,10 +1896,10 @@ function createWorktreesFacade(config = {}) {
1915
1896
  objective: input.objective,
1916
1897
  hypothesis: input.hypothesis,
1917
1898
  rationale: input.rationale,
1918
- track: input.track,
1919
- trackPosition: input.trackPosition,
1920
- executionBand: input.executionBand,
1921
- executionOrder: input.executionOrder,
1899
+ campaign: input.campaign,
1900
+ lane: input.lane,
1901
+ laneOrderInCampaign: input.laneOrderInCampaign,
1902
+ orderInLane: input.orderInLane,
1922
1903
  dependsOn: input.dependsOn,
1923
1904
  blocks: input.blocks,
1924
1905
  gate: input.gate,