@lucern/sdk 1.0.28 → 1.0.30

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 (191) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/accessControl.d.ts +31 -31
  3. package/dist/accessControl.js +1 -0
  4. package/dist/adminClient.d.ts +74 -74
  5. package/dist/adminClient.js +38 -30
  6. package/dist/{answersClient.d.ts → answers-client.d.ts} +1 -1
  7. package/dist/{answersClient.js → answers-client.js} +2 -2
  8. package/dist/audience/index.d.ts +12 -12
  9. package/dist/{audiencesClient.d.ts → audiences-client.d.ts} +1 -1
  10. package/dist/audiences-client.js +107 -0
  11. package/dist/{auditClient.d.ts → audit-client.d.ts} +2 -3
  12. package/dist/{auditClient.js → audit-client.js} +8 -7
  13. package/dist/authContext.d.ts +26 -26
  14. package/dist/authDeviceClient.d.ts +11 -11
  15. package/dist/authDeviceClient.js +4 -6
  16. package/dist/beliefs/index.d.ts +56 -28
  17. package/dist/beliefs/index.js +2 -1
  18. package/dist/beliefsClient.d.ts +71 -63
  19. package/dist/beliefsClient.js +90 -67
  20. package/dist/{boundaryClientSurface.d.ts → boundary-client-surface.d.ts} +4 -4
  21. package/dist/{boundaryClientSurface.js → boundary-client-surface.js} +9 -7
  22. package/dist/client-assembly-types.d.ts +219 -0
  23. package/dist/client-assembly-types.js +2 -0
  24. package/dist/{clientConfig.d.ts → client-config.d.ts} +16 -32
  25. package/dist/client-config.js +2 -0
  26. package/dist/{clientEvidenceCompat.d.ts → client-evidence-compat.d.ts} +24 -24
  27. package/dist/{clientEvidenceCompat.js → client-evidence-compat.js} +2 -2
  28. package/dist/client.d.ts +1906 -352
  29. package/dist/client.js +34 -30
  30. package/dist/clientGraphNamespaces.d.ts +35 -25
  31. package/dist/clientGraphNamespaces.js +11 -5
  32. package/dist/clientHelpers.js +8 -5
  33. package/dist/clientKnowledgeNamespaces.d.ts +124 -84
  34. package/dist/clientKnowledgeNamespaces.js +35 -34
  35. package/dist/clientLocalHelpers.d.ts +81 -52
  36. package/dist/clientLocalHelpers.js +193 -43
  37. package/dist/clientPlatformNamespaces.d.ts +1541 -150
  38. package/dist/clientPlatformNamespaces.js +10 -5
  39. package/dist/clientRuntime.d.ts +1 -1
  40. package/dist/clientRuntime.js +1 -1
  41. package/dist/clientWorkflowNamespaces.d.ts +211 -97
  42. package/dist/clientWorkflowNamespaces.js +22 -19
  43. package/dist/contextClient.d.ts +2 -2
  44. package/dist/contextClient.js +79 -50
  45. package/dist/contextFacade.d.ts +1 -1
  46. package/dist/contextFacade.js +2 -0
  47. package/dist/contextPackCompiler.d.ts +52 -52
  48. package/dist/contextPackCompiler.js +192 -122
  49. package/dist/contextPackPolicy.d.ts +22 -22
  50. package/dist/contextPackPolicy.js +21 -9
  51. package/dist/contextPackSchema.d.ts +3 -3
  52. package/dist/contextPackSchema.js +1 -0
  53. package/dist/contextTypes.d.ts +155 -155
  54. package/dist/contracts/api-enums.contract.js +2 -11
  55. package/dist/contracts/auth-session.contract.d.ts +16 -16
  56. package/dist/contracts/auth-session.contract.js +3 -2
  57. package/dist/contracts/context-pack.contract.d.ts +216 -216
  58. package/dist/contracts/contextPack.js +2 -0
  59. package/dist/contracts/index.d.ts +1 -1
  60. package/dist/contracts/index.js +2 -1
  61. package/dist/contracts/lens-filter.contract.d.ts +8 -8
  62. package/dist/contracts/lens-filter.contract.js +10 -10
  63. package/dist/contracts/lens-workflow.contract.d.ts +32 -32
  64. package/dist/contracts/lens-workflow.contract.js +2 -1
  65. package/dist/contracts/lensFilter.js +2 -0
  66. package/dist/contracts/lensWorkflow.js +2 -0
  67. package/dist/contracts/mcpTools.d.ts +19 -19
  68. package/dist/contracts/mcpTools.js +3 -1
  69. package/dist/contracts/prompt.contract.d.ts +12 -12
  70. package/dist/contracts/prompt.js +1 -0
  71. package/dist/contracts/sdk-tools.contract.js +1 -0
  72. package/dist/contracts/sdkTools.js +2 -0
  73. package/dist/contracts/tool-contracts.js +1 -0
  74. package/dist/contracts/workflow-runtime.contract.d.ts +45 -45
  75. package/dist/contracts/workflow-runtime.contract.js +1 -5
  76. package/dist/contracts/workflowRuntime.js +2 -0
  77. package/dist/contradictions/index.d.ts +8 -8
  78. package/dist/contradictions/index.js +1 -0
  79. package/dist/control-plane.d.ts +10 -10
  80. package/dist/control-plane.js +2 -2
  81. package/dist/controlObjectOwnership.d.ts +11 -11
  82. package/dist/controlObjectOwnership.js +1 -0
  83. package/dist/coreClient.d.ts +51 -51
  84. package/dist/coreClient.js +269 -101
  85. package/dist/customTools.d.ts +19 -19
  86. package/dist/customTools.js +4 -2
  87. package/dist/decisions/index.d.ts +18 -18
  88. package/dist/decisions/index.js +1 -0
  89. package/dist/decisionsClient.d.ts +4 -4
  90. package/dist/decisionsClient.js +36 -27
  91. package/dist/edges/index.d.ts +20 -18
  92. package/dist/edges/index.js +1 -0
  93. package/dist/embeddingsClient.d.ts +29 -29
  94. package/dist/embeddingsClient.js +15 -8
  95. package/dist/eventingClient.d.ts +27 -27
  96. package/dist/eventingClient.js +10 -5
  97. package/dist/events.d.ts +83 -83
  98. package/dist/events.js +19 -15
  99. package/dist/eventsCore.d.ts +7 -7
  100. package/dist/eventsCore.js +11 -10
  101. package/dist/evidence/index.d.ts +23 -21
  102. package/dist/evidence/index.js +1 -0
  103. package/dist/evidenceClient.d.ts +23 -23
  104. package/dist/evidenceClient.js +10 -6
  105. package/dist/facade/context.d.ts +9 -9
  106. package/dist/facade/context.js +67 -41
  107. package/dist/functionSurface.js +2 -0
  108. package/dist/functionSurfaceClient.js +2 -0
  109. package/dist/gatewayFacades.d.ts +215 -215
  110. package/dist/gatewayFacades.factories.d.ts +23 -44
  111. package/dist/gatewayFacades.factories.js +63 -62
  112. package/dist/gatewayFacades.js +31 -32
  113. package/dist/graphAnalysisClient.d.ts +60 -60
  114. package/dist/graphAnalysisClient.js +19 -18
  115. package/dist/graphClient.d.ts +34 -34
  116. package/dist/graphClient.js +56 -35
  117. package/dist/graphIntel.js +2 -0
  118. package/dist/graphIntelligence.d.ts +2 -2
  119. package/dist/graphIntelligence.js +1 -1
  120. package/dist/graphRecommendationsClient.d.ts +24 -24
  121. package/dist/graphRecommendationsClient.js +12 -7
  122. package/dist/graphStateClassifierClient.d.ts +13 -13
  123. package/dist/graphStateClassifierClient.js +10 -5
  124. package/dist/harnessClient.d.ts +61 -61
  125. package/dist/harnessClient.js +44 -31
  126. package/dist/identityClient.d.ts +33 -59
  127. package/dist/identityClient.js +126 -98
  128. package/dist/index.d.ts +20 -20
  129. package/dist/index.js +20 -19
  130. package/dist/infisicalRuntime.d.ts +11 -11
  131. package/dist/infisicalRuntime.js +20 -14
  132. package/dist/jobsClient.d.ts +28 -28
  133. package/dist/jobsClient.js +6 -3
  134. package/dist/learningClient.js +13 -8
  135. package/dist/lenses/index.d.ts +124 -28
  136. package/dist/lenses/index.js +1 -0
  137. package/dist/mcpClient.d.ts +1 -1
  138. package/dist/mcpClient.js +3 -3
  139. package/dist/modelRuntimeClient.d.ts +27 -27
  140. package/dist/modelRuntimeClient.js +10 -5
  141. package/dist/nodes/index.d.ts +9 -9
  142. package/dist/nodes/index.js +1 -0
  143. package/dist/ontologies/index.d.ts +68 -22
  144. package/dist/ontologies/index.js +1 -0
  145. package/dist/ontologyClient.js +24 -17
  146. package/dist/ontologyLinksClient.d.ts +35 -35
  147. package/dist/ontologyLinksClient.js +9 -6
  148. package/dist/opinion.d.ts +3 -3
  149. package/dist/opinion.js +12 -5
  150. package/dist/orgGraphSearchClient.d.ts +39 -39
  151. package/dist/orgGraphSearchClient.js +22 -13
  152. package/dist/packsClient.d.ts +1 -1
  153. package/dist/packsClient.js +28 -19
  154. package/dist/policyClient.d.ts +79 -68
  155. package/dist/policyClient.js +18 -12
  156. package/dist/proof-attestation.json +1 -1
  157. package/dist/questions/index.d.ts +38 -27
  158. package/dist/questions/index.js +1 -0
  159. package/dist/realtime/index.d.ts +3 -3
  160. package/dist/realtime/index.js +1 -0
  161. package/dist/realtime/refs.d.ts +2 -2
  162. package/dist/{reportsClient.d.ts → reports-client.d.ts} +2 -2
  163. package/dist/{reportsClient.js → reports-client.js} +19 -13
  164. package/dist/{schemaClient.d.ts → schema-client.d.ts} +2 -3
  165. package/dist/{schemaClient.js → schema-client.js} +14 -11
  166. package/dist/sdkSurface.d.ts +12 -12
  167. package/dist/sdkSurface.js +14 -10
  168. package/dist/secrets.d.ts +1 -1
  169. package/dist/secrets.js +2 -1
  170. package/dist/{sourcesClient.d.ts → sources-client.d.ts} +8 -9
  171. package/dist/{sourcesClient.js → sources-client.js} +4 -5
  172. package/dist/{telemetryClient.d.ts → telemetry-client.d.ts} +14 -14
  173. package/dist/{telemetryClient.js → telemetry-client.js} +6 -4
  174. package/dist/toolRegistryClient.d.ts +46 -46
  175. package/dist/toolRegistryClient.js +22 -11
  176. package/dist/topics/index.d.ts +23 -23
  177. package/dist/topics/index.js +2 -1
  178. package/dist/topicsClient.d.ts +6 -6
  179. package/dist/topicsClient.js +29 -18
  180. package/dist/types.d.ts +356 -355
  181. package/dist/version.d.ts +1 -1
  182. package/dist/version.js +1 -1
  183. package/dist/workflowClient.d.ts +36 -35
  184. package/dist/workflowClient.js +88 -60
  185. package/dist/worktrees/index.d.ts +118 -32
  186. package/dist/worktrees/index.js +2 -1
  187. package/package.json +45 -5
  188. package/dist/audiencesClient.js +0 -115
  189. package/dist/clientAssemblyTypes.d.ts +0 -33
  190. package/dist/clientAssemblyTypes.js +0 -2
  191. package/dist/clientConfig.js +0 -2
@@ -1,27 +1,27 @@
1
- import { type GatewayClientConfig, LucernApiError, type PlatformGatewaySuccess } from "./coreClient";
1
+ import { type GatewayClientConfig, LucernApiError } from "./coreClient";
2
2
  import type { ForkBeliefResponse, JsonObject } from "./types";
3
- export { LucernApiError };
4
3
  export type { PlatformGatewaySuccess } from "./coreClient";
5
- export type { CreateBeliefResponse, ForkBeliefResponse, } from "./types";
6
4
  export type { Opinion } from "./opinion";
5
+ export type { CreateBeliefResponse, ForkBeliefResponse, } from "./types";
6
+ export { LucernApiError };
7
7
  /** Configuration for the beliefs client. Inherits gateway transport settings. */
8
8
  export type BeliefsClientConfig = GatewayClientConfig;
9
- export type OpinionHistoryEntry = {
10
- t: number;
9
+ export interface OpinionHistoryEntry {
10
+ a: number;
11
11
  b: number;
12
12
  d: number;
13
- u: number;
14
- a: number;
15
13
  P: number;
14
+ rationale?: string;
15
+ slOperator?: string;
16
+ t: number;
16
17
  trigger: string;
17
18
  triggeringRef?: {
18
19
  kind: "evidence" | "question" | "answer" | "contradiction" | "worktree";
19
20
  id: string;
20
21
  };
21
- rationale?: string;
22
+ u: number;
22
23
  userId?: string;
23
- slOperator?: string;
24
- };
24
+ }
25
25
  type GatewayRecord = Record<string, unknown>;
26
26
  export declare function mapOpinionHistoryEntriesFromGatewayData(payload: GatewayRecord): OpinionHistoryEntry[];
27
27
  /**
@@ -34,84 +34,92 @@ export declare function mapOpinionHistoryEntriesFromGatewayData(payload: Gateway
34
34
  * Beliefs start as drafts with a vacuous prior `(0, 0, 1, a)`. When omitted,
35
35
  * `baseRate` defaults to the canonical neutral prior `0.5`.
36
36
  */
37
- export type CreateBeliefInput = {
38
- /** Required UUIDv7 topic epistemicNodes globalId. */
39
- topicGlobalId: string;
40
- /** Preferred belief statement alias. */
41
- text?: string;
37
+ export interface CreateBeliefInput {
38
+ baseRate?: number;
39
+ beliefStatus?: string;
40
+ beliefType?: string;
42
41
  /** @deprecated Use text. */
43
42
  canonicalText?: string;
44
- layer?: "L1" | "L2" | "L3" | "L4";
45
- domain?: string;
46
- sourceType?: "human" | "ai" | "agent" | "imported";
43
+ confidence?: number;
47
44
  content?: string;
48
45
  contentHash?: string;
46
+ domain?: string;
49
47
  globalId?: string;
50
- title?: string;
48
+ layer?: "L1" | "L2" | "L3" | "L4";
49
+ metadata?: JsonObject;
50
+ pillar?: string;
51
+ predictionMeta?: JsonObject;
52
+ rationale?: string;
53
+ reversibility?: string;
54
+ sourceBeliefIds?: string[];
55
+ sourceType?: "human" | "ai" | "agent" | "imported";
51
56
  subtype?: string;
52
- confidence?: number;
53
- baseRate?: number;
54
57
  tags?: string[];
55
- metadata?: JsonObject;
58
+ /** Preferred belief statement alias. */
59
+ text?: string;
60
+ title?: string;
61
+ /** Required UUIDv7 topic epistemicNodes globalId. */
62
+ topicGlobalId: string;
56
63
  verificationStatus?: "unverified" | "verified" | "rejected";
57
- };
64
+ worktreeId?: string;
65
+ }
58
66
  /**
59
67
  * Input for refining an existing draft belief.
60
68
  *
61
69
  * Use `text` as the canonical belief statement.
62
70
  * `canonicalText` remains available as a legacy alias for backwards compatibility.
63
71
  */
64
- export type RefineBeliefInput = {
65
- /** Preferred belief statement alias. */
66
- text?: string;
72
+ export interface RefineBeliefInput {
67
73
  /** @deprecated Use text. */
68
74
  canonicalText?: string;
69
75
  rationale?: string;
76
+ /** Preferred belief statement alias. */
77
+ text?: string;
70
78
  title?: string;
71
- };
79
+ }
72
80
  /**
73
81
  * Input for forking an evidence-bearing belief into a new formulation.
74
82
  * Every fork must cite evidence already attached to the parent through SL.
75
83
  */
76
- export type ForkBeliefInput = {
77
- newFormulation: string;
78
- forkReason: "refinement" | "contradiction_response" | "scope_change" | "confidence_collapse";
84
+ export interface ForkBeliefInput {
79
85
  forkMode?: "supersede" | "branch";
80
- triggeringEvidenceId: string;
86
+ forkReason: "refinement" | "contradiction_response" | "scope_change" | "confidence_collapse";
87
+ newFormulation: string;
81
88
  rationale?: string;
82
- };
89
+ triggeringEvidenceId: string;
90
+ }
83
91
  /** Input for updating a belief's rationale without refining its text. */
84
- export type UpdateBeliefRationaleInput = {
92
+ export interface UpdateBeliefRationaleInput {
93
+ beliefId?: string;
85
94
  id?: string;
86
95
  nodeId?: string;
87
- beliefId?: string;
88
96
  rationale?: string;
89
- };
97
+ }
90
98
  /** Input for creating a belief-to-belief reasoning edge. */
91
- export type LinkBeliefsInput = {
99
+ export interface LinkBeliefsInput {
100
+ context?: string;
101
+ edgeType: string;
92
102
  fromNodeId: string;
93
103
  toNodeId: string;
94
- edgeType: string;
95
104
  weight?: number;
96
- context?: string;
97
- };
105
+ }
98
106
  /** Input for unlinking a belief from an attached evidence item. */
99
- export type UnlinkBeliefEvidenceInput = {
100
- beliefNodeId?: string;
107
+ export interface UnlinkBeliefEvidenceInput {
101
108
  beliefId?: string;
102
- nodeId?: string;
103
- insightId?: string;
109
+ beliefNodeId?: string;
104
110
  evidenceId?: string;
105
- };
106
- /** Input for updating a belief's criticality classification. */
107
- export type UpdateBeliefCriticalityInput = {
108
- id?: string;
111
+ insightId?: string;
109
112
  nodeId?: string;
113
+ }
114
+ /** Input for updating a belief's criticality classification. */
115
+ export interface UpdateBeliefCriticalityInput {
110
116
  beliefId?: string;
111
117
  criticality: "blocking" | "important" | "supporting" | "essential" | "nice_to_have";
112
- };
118
+ id?: string;
119
+ nodeId?: string;
120
+ }
113
121
  /** Input for bulk-updating multiple beliefs' criticality. */
114
- export type BatchUpdateBeliefCriticalityInput = {
122
+ export interface BatchUpdateBeliefCriticalityInput {
115
123
  updates: Array<{
116
124
  beliefId: string;
117
125
  criticality: "blocking" | "important" | "supporting" | "essential" | "nice_to_have";
@@ -121,14 +129,14 @@ export type BatchUpdateBeliefCriticalityInput = {
121
129
  dependentBeliefIds?: string[];
122
130
  blockedByBeliefIds?: string[];
123
131
  }>;
124
- };
132
+ }
125
133
  /** Input for moving beliefs into a different topic scope. */
126
- export type ReassignBeliefsTopicInput = {
127
- beliefNodeIds?: string[];
134
+ export interface ReassignBeliefsTopicInput {
128
135
  beliefIds?: string[];
129
- targetTopicId: string;
136
+ beliefNodeIds?: string[];
130
137
  reason?: string;
131
- };
138
+ targetTopicId: string;
139
+ }
132
140
  /**
133
141
  * Create the beliefs client for belief lifecycle operations.
134
142
  *
@@ -139,11 +147,11 @@ export declare function createBeliefsClient(config?: BeliefsClientConfig): {
139
147
  /**
140
148
  * Create a belief within a topic scope.
141
149
  */
142
- createBelief(input: CreateBeliefInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<import("./types").PlatformBeliefRecord>>;
150
+ createBelief(input: CreateBeliefInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").PlatformBeliefRecord>>;
143
151
  /**
144
152
  * Refine a draft belief in place.
145
153
  */
146
- refineBelief(beliefId: string, input: RefineBeliefInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<import("./types").PlatformBeliefRecord>>;
154
+ refineBelief(beliefId: string, input: RefineBeliefInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<import("./types").PlatformBeliefRecord>>;
147
155
  /**
148
156
  * Returns the belief's confidence trajectory as a chronological array.
149
157
  *
@@ -163,30 +171,30 @@ export declare function createBeliefsClient(config?: BeliefsClientConfig): {
163
171
  /**
164
172
  * Fork a scored belief into a new formulation.
165
173
  */
166
- forkBelief(beliefId: string, input: ForkBeliefInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<ForkBeliefResponse>>;
174
+ forkBelief(beliefId: string, input: ForkBeliefInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<ForkBeliefResponse>>;
167
175
  /**
168
176
  * Update a belief's rationale without changing its text.
169
177
  */
170
- updateBeliefRationale(input: UpdateBeliefRationaleInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
178
+ updateBeliefRationale(input: UpdateBeliefRationaleInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
171
179
  /**
172
180
  * Create a typed relationship between two beliefs.
173
181
  */
174
- linkBeliefs(input: LinkBeliefsInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
182
+ linkBeliefs(input: LinkBeliefsInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
175
183
  /**
176
184
  * Remove an evidence attachment from a belief.
177
185
  */
178
- unlinkBeliefEvidence(input: UnlinkBeliefEvidenceInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
186
+ unlinkBeliefEvidence(input: UnlinkBeliefEvidenceInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
179
187
  /**
180
188
  * Update a belief's criticality metadata.
181
189
  */
182
- updateBeliefCriticality(input: UpdateBeliefCriticalityInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
190
+ updateBeliefCriticality(input: UpdateBeliefCriticalityInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
183
191
  /**
184
192
  * Update multiple beliefs' criticality in one mutation.
185
193
  */
186
- batchUpdateBeliefCriticality(input: BatchUpdateBeliefCriticalityInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
194
+ batchUpdateBeliefCriticality(input: BatchUpdateBeliefCriticalityInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
187
195
  /**
188
196
  * Reassign beliefs to a different topic scope.
189
197
  */
190
- reassignBeliefsTopic(input: ReassignBeliefsTopicInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
198
+ reassignBeliefsTopic(input: ReassignBeliefsTopicInput, idempotencyKey?: string): Promise<import("./coreClient").PlatformGatewaySuccess<Record<string, unknown>>>;
191
199
  };
192
200
  //# sourceMappingURL=beliefsClient.d.ts.map
@@ -1,6 +1,9 @@
1
- import { createGatewayRequestClient, LucernApiError, randomIdempotencyKey, } from "./coreClient.js";
2
- import { normalizeNodeWriteInput } from "./sdkSurface.js";
1
+ // biome-ignore-all lint/style/useFilenamingConvention: This file is an @lucern/sdk public import ABI / package subpath compatibility surface; the camelCase filename is intentional.
3
2
  import { isUuidV7 } from "@lucern/contracts/ids";
3
+ import { createGatewayRequestClient,
4
+ // biome-ignore lint/style/noExportedImports: beliefsClient preserves this legacy compatibility re-export while package root also exports coreClient.
5
+ LucernApiError, randomIdempotencyKey, } from "./coreClient.js";
6
+ import { normalizeNodeWriteInput } from "./sdkSurface.js";
4
7
  export { LucernApiError };
5
8
  function asRecord(value) {
6
9
  return value && typeof value === "object" && !Array.isArray(value)
@@ -9,13 +12,15 @@ function asRecord(value) {
9
12
  }
10
13
  function readString(value) {
11
14
  if (typeof value !== "string") {
12
- return undefined;
15
+ return;
13
16
  }
14
17
  const normalized = value.trim();
15
18
  return normalized.length > 0 ? normalized : undefined;
16
19
  }
17
20
  function readNumber(value) {
18
- return typeof value === "number" && Number.isFinite(value) ? value : undefined;
21
+ return typeof value === "number" && Number.isFinite(value)
22
+ ? value
23
+ : undefined;
19
24
  }
20
25
  function clamp01(value) {
21
26
  return Math.max(0, Math.min(1, value));
@@ -39,51 +44,67 @@ function normalizeOpinionTuple(record) {
39
44
  a: clamp01(rawBaseRate),
40
45
  };
41
46
  }
47
+ function readOpinionTriggeringRef(record) {
48
+ const triggeringEvidenceId = readString(record.triggeringEvidenceId);
49
+ if (triggeringEvidenceId) {
50
+ return { kind: "evidence", id: triggeringEvidenceId };
51
+ }
52
+ const triggeringQuestionId = readString(record.triggeringQuestionId);
53
+ if (triggeringQuestionId) {
54
+ return { kind: "question", id: triggeringQuestionId };
55
+ }
56
+ const triggeringAnswerId = readString(record.triggeringAnswerId);
57
+ if (triggeringAnswerId) {
58
+ return { kind: "answer", id: triggeringAnswerId };
59
+ }
60
+ const triggeringContradictionId = readString(record.triggeringContradictionId);
61
+ if (triggeringContradictionId) {
62
+ return { kind: "contradiction", id: triggeringContradictionId };
63
+ }
64
+ const triggeringWorktreeId = readString(record.triggeringWorktreeId);
65
+ return triggeringWorktreeId
66
+ ? { kind: "worktree", id: triggeringWorktreeId }
67
+ : undefined;
68
+ }
69
+ function mapOpinionHistoryEntry(value) {
70
+ const record = asRecord(value);
71
+ const tuple = normalizeOpinionTuple(record);
72
+ const projected = readNumber(record.confidence) ?? clamp01(tuple.b + tuple.a * tuple.u);
73
+ const trigger = readString(record.trigger);
74
+ if (!trigger) {
75
+ throw new Error("Gateway opinion history entries must include trigger.");
76
+ }
77
+ const entry = {
78
+ t: readNumber(record.timestamp) ?? readNumber(record.assessedAt) ?? 0,
79
+ b: tuple.b,
80
+ d: tuple.d,
81
+ u: tuple.u,
82
+ a: tuple.a,
83
+ P: clamp01(projected),
84
+ trigger,
85
+ };
86
+ const triggeringRef = readOpinionTriggeringRef(record);
87
+ if (triggeringRef) {
88
+ entry.triggeringRef = triggeringRef;
89
+ }
90
+ const rationale = readString(record.rationale);
91
+ if (rationale) {
92
+ entry.rationale = rationale;
93
+ }
94
+ const userId = readString(record.userId);
95
+ if (userId) {
96
+ entry.userId = userId;
97
+ }
98
+ const slOperator = readString(record.slOperator);
99
+ if (slOperator) {
100
+ entry.slOperator = slOperator;
101
+ }
102
+ return entry;
103
+ }
42
104
  export function mapOpinionHistoryEntriesFromGatewayData(payload) {
43
105
  const entries = Array.isArray(payload.entries) ? payload.entries : [];
44
106
  return entries
45
- .map((value) => {
46
- const record = asRecord(value);
47
- const tuple = normalizeOpinionTuple(record);
48
- const projected = readNumber(record.confidence) ?? clamp01(tuple.b + tuple.a * tuple.u);
49
- const triggeringEvidenceId = readString(record.triggeringEvidenceId);
50
- const triggeringQuestionId = readString(record.triggeringQuestionId);
51
- const triggeringAnswerId = readString(record.triggeringAnswerId);
52
- const triggeringContradictionId = readString(record.triggeringContradictionId);
53
- const triggeringWorktreeId = readString(record.triggeringWorktreeId);
54
- const triggeringRef = triggeringEvidenceId
55
- ? { kind: "evidence", id: triggeringEvidenceId }
56
- : triggeringQuestionId
57
- ? { kind: "question", id: triggeringQuestionId }
58
- : triggeringAnswerId
59
- ? { kind: "answer", id: triggeringAnswerId }
60
- : triggeringContradictionId
61
- ? { kind: "contradiction", id: triggeringContradictionId }
62
- : triggeringWorktreeId
63
- ? { kind: "worktree", id: triggeringWorktreeId }
64
- : undefined;
65
- const trigger = readString(record.trigger);
66
- if (!trigger) {
67
- throw new Error("Gateway opinion history entries must include trigger.");
68
- }
69
- return {
70
- t: readNumber(record.timestamp) ?? readNumber(record.assessedAt) ?? 0,
71
- b: tuple.b,
72
- d: tuple.d,
73
- u: tuple.u,
74
- a: tuple.a,
75
- P: clamp01(projected),
76
- trigger,
77
- ...(triggeringRef ? { triggeringRef } : {}),
78
- ...(readString(record.rationale)
79
- ? { rationale: readString(record.rationale) }
80
- : {}),
81
- ...(readString(record.userId) ? { userId: readString(record.userId) } : {}),
82
- ...(readString(record.slOperator)
83
- ? { slOperator: readString(record.slOperator) }
84
- : {}),
85
- };
86
- })
107
+ .map(mapOpinionHistoryEntry)
87
108
  .sort((left, right) => left.t - right.t);
88
109
  }
89
110
  /**
@@ -104,13 +125,13 @@ export function createBeliefsClient(config = {}) {
104
125
  }
105
126
  function normalizeCreateBeliefInput(input) {
106
127
  const topicGlobalId = readString(input.topicGlobalId);
107
- if (!topicGlobalId || !isUuidV7(topicGlobalId)) {
128
+ if (!(topicGlobalId && isUuidV7(topicGlobalId))) {
108
129
  throw new Error("createBelief requires topicGlobalId to be a UUIDv7 topic epistemic-node globalId.");
109
130
  }
110
131
  const text = readString(input.text) ?? readString(input.canonicalText);
111
132
  const body = { ...input, topicGlobalId };
112
- delete body.topicId;
113
- delete body.topicNodeId;
133
+ body.topicId = undefined;
134
+ body.topicNodeId = undefined;
114
135
  if (text) {
115
136
  body.text = text;
116
137
  body.canonicalText = text;
@@ -127,22 +148,24 @@ export function createBeliefsClient(config = {}) {
127
148
  /**
128
149
  * Create a belief within a topic scope.
129
150
  */
130
- async createBelief(input, idempotencyKey) {
131
- const baseRate = normalizeBaseRate(input.baseRate);
132
- return gateway.request({
133
- path: "/api/platform/v1/beliefs",
134
- method: "POST",
135
- body: {
136
- ...normalizeCreateBeliefInput(input),
137
- baseRate,
138
- },
139
- idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
151
+ createBelief(input, idempotencyKey) {
152
+ return Promise.resolve().then(() => {
153
+ const baseRate = normalizeBaseRate(input.baseRate);
154
+ return gateway.request({
155
+ path: "/api/platform/v1/beliefs",
156
+ method: "POST",
157
+ body: {
158
+ ...normalizeCreateBeliefInput(input),
159
+ baseRate,
160
+ },
161
+ idempotencyKey: idempotencyKey ?? randomIdempotencyKey(),
162
+ });
140
163
  });
141
164
  },
142
165
  /**
143
166
  * Refine a draft belief in place.
144
167
  */
145
- async refineBelief(beliefId, input, idempotencyKey) {
168
+ refineBelief(beliefId, input, idempotencyKey) {
146
169
  return gateway.request({
147
170
  path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}`,
148
171
  method: "PATCH",
@@ -169,7 +192,7 @@ export function createBeliefsClient(config = {}) {
169
192
  /**
170
193
  * Fork a scored belief into a new formulation.
171
194
  */
172
- async forkBelief(beliefId, input, idempotencyKey) {
195
+ forkBelief(beliefId, input, idempotencyKey) {
173
196
  return gateway.request({
174
197
  path: `/api/platform/v1/beliefs/${encodeURIComponent(beliefId)}/fork`,
175
198
  method: "POST",
@@ -180,7 +203,7 @@ export function createBeliefsClient(config = {}) {
180
203
  /**
181
204
  * Update a belief's rationale without changing its text.
182
205
  */
183
- async updateBeliefRationale(input, idempotencyKey) {
206
+ updateBeliefRationale(input, idempotencyKey) {
184
207
  return gateway.request({
185
208
  path: "/api/platform/v1/beliefs/update-rationale",
186
209
  method: "POST",
@@ -191,7 +214,7 @@ export function createBeliefsClient(config = {}) {
191
214
  /**
192
215
  * Create a typed relationship between two beliefs.
193
216
  */
194
- async linkBeliefs(input, idempotencyKey) {
217
+ linkBeliefs(input, idempotencyKey) {
195
218
  return gateway.request({
196
219
  path: "/api/platform/v1/beliefs/link",
197
220
  method: "POST",
@@ -202,7 +225,7 @@ export function createBeliefsClient(config = {}) {
202
225
  /**
203
226
  * Remove an evidence attachment from a belief.
204
227
  */
205
- async unlinkBeliefEvidence(input, idempotencyKey) {
228
+ unlinkBeliefEvidence(input, idempotencyKey) {
206
229
  return gateway.request({
207
230
  path: "/api/platform/v1/beliefs/unlink-evidence",
208
231
  method: "POST",
@@ -213,7 +236,7 @@ export function createBeliefsClient(config = {}) {
213
236
  /**
214
237
  * Update a belief's criticality metadata.
215
238
  */
216
- async updateBeliefCriticality(input, idempotencyKey) {
239
+ updateBeliefCriticality(input, idempotencyKey) {
217
240
  return gateway.request({
218
241
  path: "/api/platform/v1/beliefs/update-criticality",
219
242
  method: "POST",
@@ -224,7 +247,7 @@ export function createBeliefsClient(config = {}) {
224
247
  /**
225
248
  * Update multiple beliefs' criticality in one mutation.
226
249
  */
227
- async batchUpdateBeliefCriticality(input, idempotencyKey) {
250
+ batchUpdateBeliefCriticality(input, idempotencyKey) {
228
251
  return gateway.request({
229
252
  path: "/api/platform/v1/beliefs/batch-update-criticality",
230
253
  method: "POST",
@@ -235,7 +258,7 @@ export function createBeliefsClient(config = {}) {
235
258
  /**
236
259
  * Reassign beliefs to a different topic scope.
237
260
  */
238
- async reassignBeliefsTopic(input, idempotencyKey) {
261
+ reassignBeliefsTopic(input, idempotencyKey) {
239
262
  return gateway.request({
240
263
  path: "/api/platform/v1/beliefs/reassign-topic",
241
264
  method: "POST",
@@ -1,9 +1,9 @@
1
1
  import type { JsonObject, ListResult } from "./types";
2
- export type TopicProjectAliasInput = {
3
- topicId?: string;
2
+ export interface TopicProjectAliasInput {
4
3
  /** @deprecated Use topicId. */
5
4
  projectId?: string;
6
- };
5
+ topicId?: string;
6
+ }
7
7
  export declare function cleanOptionalString(value: string | undefined): string | undefined;
8
8
  export declare function cleanRequiredString(value: string | undefined, label: string): string;
9
9
  export declare function readTopicId(input: TopicProjectAliasInput): string | undefined;
@@ -12,4 +12,4 @@ export declare function assertKnownKeys<T extends string>(input: Record<string,
12
12
  export declare function knownPayload<T extends string>(input: Record<string, unknown>, allowed: readonly T[], operation: string): JsonObject;
13
13
  export declare function topicPayload<T extends string>(input: TopicProjectAliasInput & Record<string, unknown>, allowed: readonly T[], operation: string): JsonObject;
14
14
  export declare function listResultFromEnvelope<T, LegacyKey extends string>(data: unknown, legacyKey: LegacyKey): ListResult<T, LegacyKey>;
15
- //# sourceMappingURL=boundaryClientSurface.d.ts.map
15
+ //# sourceMappingURL=boundary-client-surface.d.ts.map
@@ -14,7 +14,7 @@ export function cleanRequiredString(value, label) {
14
14
  return normalized;
15
15
  }
16
16
  export function readTopicId(input) {
17
- return cleanOptionalString(input.topicId) ?? cleanOptionalString(input.projectId);
17
+ return (cleanOptionalString(input.topicId) ?? cleanOptionalString(input.projectId));
18
18
  }
19
19
  export function requireTopicId(input) {
20
20
  const topicId = readTopicId(input);
@@ -45,10 +45,12 @@ export function topicPayload(input, allowed, operation) {
45
45
  export function listResultFromEnvelope(data, legacyKey) {
46
46
  const record = isRecord(data) ? data : {};
47
47
  const legacyItems = record[legacyKey];
48
- return createListResult(Array.isArray(legacyItems)
49
- ? legacyItems
50
- : Array.isArray(data)
51
- ? data
52
- : [], legacyKey);
48
+ if (Array.isArray(legacyItems)) {
49
+ return createListResult(legacyItems, legacyKey);
50
+ }
51
+ if (Array.isArray(data)) {
52
+ return createListResult(data, legacyKey);
53
+ }
54
+ return createListResult([], legacyKey);
53
55
  }
54
- //# sourceMappingURL=boundaryClientSurface.js.map
56
+ //# sourceMappingURL=boundary-client-surface.js.map