@lucern/sdk 0.2.0-alpha.10 → 0.2.0-alpha.11

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 (57) hide show
  1. package/dist/audience/index.d.ts +38 -0
  2. package/dist/audience/index.js +110 -0
  3. package/dist/audience/index.js.map +1 -0
  4. package/dist/beliefs/index.d.ts +465 -0
  5. package/dist/beliefs/index.js +6433 -0
  6. package/dist/beliefs/index.js.map +1 -0
  7. package/dist/beliefs/lifecycle.d.ts +24 -0
  8. package/dist/beliefs/lifecycle.js +98 -0
  9. package/dist/beliefs/lifecycle.js.map +1 -0
  10. package/dist/beliefsClient.d.ts +2 -3
  11. package/dist/beliefsClient.js +40 -10
  12. package/dist/beliefsClient.js.map +1 -1
  13. package/dist/client.d.ts +3 -3
  14. package/dist/client.js +42 -9
  15. package/dist/client.js.map +1 -1
  16. package/dist/contradictions/index.d.ts +158 -0
  17. package/dist/contradictions/index.js +6427 -0
  18. package/dist/contradictions/index.js.map +1 -0
  19. package/dist/decisions/index.d.ts +68 -0
  20. package/dist/decisions/index.js +6429 -0
  21. package/dist/decisions/index.js.map +1 -0
  22. package/dist/edges/index.d.ts +204 -0
  23. package/dist/edges/index.js +6428 -0
  24. package/dist/edges/index.js.map +1 -0
  25. package/dist/events.js +7 -5
  26. package/dist/events.js.map +1 -1
  27. package/dist/evidence/index.d.ts +295 -0
  28. package/dist/evidence/index.js +6428 -0
  29. package/dist/evidence/index.js.map +1 -0
  30. package/dist/gatewayFacades.d.ts +1 -1
  31. package/dist/gatewayFacades.js +32 -2
  32. package/dist/gatewayFacades.js.map +1 -1
  33. package/dist/index.d.ts +1 -1
  34. package/dist/index.js +55 -23
  35. package/dist/index.js.map +1 -1
  36. package/dist/lenses/index.d.ts +194 -0
  37. package/dist/lenses/index.js +6427 -0
  38. package/dist/lenses/index.js.map +1 -0
  39. package/dist/nodes/index.d.ts +62 -0
  40. package/dist/nodes/index.js +6429 -0
  41. package/dist/nodes/index.js.map +1 -0
  42. package/dist/ontologies/index.d.ts +178 -0
  43. package/dist/ontologies/index.js +6430 -0
  44. package/dist/ontologies/index.js.map +1 -0
  45. package/dist/opinion.d.ts +11 -0
  46. package/dist/opinion.js +35 -0
  47. package/dist/opinion.js.map +1 -0
  48. package/dist/questions/index.d.ts +297 -0
  49. package/dist/questions/index.js +6430 -0
  50. package/dist/questions/index.js.map +1 -0
  51. package/dist/topics/index.d.ts +68 -0
  52. package/dist/topics/index.js +6428 -0
  53. package/dist/topics/index.js.map +1 -0
  54. package/dist/worktrees/index.d.ts +210 -0
  55. package/dist/worktrees/index.js +6430 -0
  56. package/dist/worktrees/index.js.map +1 -0
  57. package/package.json +53 -2
@@ -0,0 +1,11 @@
1
+ type Opinion = {
2
+ b: number;
3
+ d: number;
4
+ u: number;
5
+ a: number;
6
+ };
7
+ declare function opinionFromBaseRate(probability: number): Opinion;
8
+ declare function opinionFromDogmatic(probability: number, baseRate?: number): Opinion;
9
+ declare function opinionFromProjected(probability: number, uncertainty: number, baseRate?: number): Opinion;
10
+
11
+ export { type Opinion, opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected };
@@ -0,0 +1,35 @@
1
+ // src/opinion.ts
2
+ function clamp01(value) {
3
+ if (!Number.isFinite(value)) {
4
+ return 0;
5
+ }
6
+ return Math.max(0, Math.min(1, value));
7
+ }
8
+ function vacuous(baseRate = 0.5) {
9
+ return { b: 0, d: 0, u: 1, a: clamp01(baseRate) };
10
+ }
11
+ function dogmatic(probability, baseRate = 0.5) {
12
+ const p = clamp01(probability);
13
+ return { b: p, d: 1 - p, u: 0, a: clamp01(baseRate) };
14
+ }
15
+ function opinionFromBaseRate(probability) {
16
+ return vacuous(clamp01(probability));
17
+ }
18
+ function opinionFromDogmatic(probability, baseRate = 0.5) {
19
+ return dogmatic(clamp01(probability), clamp01(baseRate));
20
+ }
21
+ function opinionFromProjected(probability, uncertainty, baseRate = 0.5) {
22
+ const p = clamp01(probability);
23
+ const u = clamp01(uncertainty);
24
+ const remainingMass = 1 - u;
25
+ return {
26
+ b: p * remainingMass,
27
+ d: (1 - p) * remainingMass,
28
+ u,
29
+ a: clamp01(baseRate)
30
+ };
31
+ }
32
+
33
+ export { opinionFromBaseRate, opinionFromDogmatic, opinionFromProjected };
34
+ //# sourceMappingURL=opinion.js.map
35
+ //# sourceMappingURL=opinion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/opinion.ts"],"names":[],"mappings":";AAOA,SAAS,QAAQ,KAAA,EAAuB;AACtC,EAAA,IAAI,CAAC,MAAA,CAAO,QAAA,CAAS,KAAK,CAAA,EAAG;AAC3B,IAAA,OAAO,CAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAK,GAAA,CAAI,CAAA,EAAG,KAAK,GAAA,CAAI,CAAA,EAAG,KAAK,CAAC,CAAA;AACvC;AAEA,SAAS,OAAA,CAAQ,WAAmB,GAAA,EAAc;AAChD,EAAA,OAAO,EAAE,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,GAAG,CAAA,EAAG,CAAA,EAAG,OAAA,CAAQ,QAAQ,CAAA,EAAE;AAClD;AAEA,SAAS,QAAA,CAAS,WAAA,EAAqB,QAAA,GAAmB,GAAA,EAAc;AACtE,EAAA,MAAM,CAAA,GAAI,QAAQ,WAAW,CAAA;AAC7B,EAAA,OAAO,EAAE,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,OAAA,CAAQ,QAAQ,CAAA,EAAE;AACtD;AAEO,SAAS,oBAAoB,WAAA,EAA8B;AAChE,EAAA,OAAO,OAAA,CAAQ,OAAA,CAAQ,WAAW,CAAC,CAAA;AACrC;AAEO,SAAS,mBAAA,CACd,WAAA,EACA,QAAA,GAAmB,GAAA,EACV;AACT,EAAA,OAAO,SAAS,OAAA,CAAQ,WAAW,CAAA,EAAG,OAAA,CAAQ,QAAQ,CAAC,CAAA;AACzD;AAEO,SAAS,oBAAA,CACd,WAAA,EACA,WAAA,EACA,QAAA,GAAmB,GAAA,EACV;AACT,EAAA,MAAM,CAAA,GAAI,QAAQ,WAAW,CAAA;AAC7B,EAAA,MAAM,CAAA,GAAI,QAAQ,WAAW,CAAA;AAC7B,EAAA,MAAM,gBAAgB,CAAA,GAAI,CAAA;AAC1B,EAAA,OAAO;AAAA,IACL,GAAG,CAAA,GAAI,aAAA;AAAA,IACP,CAAA,EAAA,CAAI,IAAI,CAAA,IAAK,aAAA;AAAA,IACb,CAAA;AAAA,IACA,CAAA,EAAG,QAAQ,QAAQ;AAAA,GACrB;AACF","file":"opinion.js","sourcesContent":["export type Opinion = {\n b: number;\n d: number;\n u: number;\n a: number;\n};\n\nfunction clamp01(value: number): number {\n if (!Number.isFinite(value)) {\n return 0;\n }\n return Math.max(0, Math.min(1, value));\n}\n\nfunction vacuous(baseRate: number = 0.5): Opinion {\n return { b: 0, d: 0, u: 1, a: clamp01(baseRate) };\n}\n\nfunction dogmatic(probability: number, baseRate: number = 0.5): Opinion {\n const p = clamp01(probability);\n return { b: p, d: 1 - p, u: 0, a: clamp01(baseRate) };\n}\n\nexport function opinionFromBaseRate(probability: number): Opinion {\n return vacuous(clamp01(probability));\n}\n\nexport function opinionFromDogmatic(\n probability: number,\n baseRate: number = 0.5\n): Opinion {\n return dogmatic(clamp01(probability), clamp01(baseRate));\n}\n\nexport function opinionFromProjected(\n probability: number,\n uncertainty: number,\n baseRate: number = 0.5\n): Opinion {\n const p = clamp01(probability);\n const u = clamp01(uncertainty);\n const remainingMass = 1 - u;\n return {\n b: p * remainingMass,\n d: (1 - p) * remainingMass,\n u,\n a: clamp01(baseRate),\n };\n}\n"]}
@@ -0,0 +1,297 @@
1
+ import { PlatformGatewaySuccess } from '../coreClient.js';
2
+ import { JsonObject } from '../types.js';
3
+ import { LucernClientConfig } from '../client.js';
4
+ import * as v1 from '@lucern/contracts/questions/v1';
5
+ export { v1 as questionsContracts };
6
+ import * as mcpTools_contract from '@lucern/contracts/mcp-tools.contract';
7
+ export { mcpTools_contract as toolSchemas };
8
+ import '../contracts/workflow-runtime.contract.js';
9
+ import '../contracts/lens-workflow.contract.js';
10
+ import '../contracts/lens-filter.contract.js';
11
+ import '../audiencesClient.js';
12
+ import '../schemaClient.js';
13
+ import '../harnessClient.js';
14
+ import '../identityClient.js';
15
+ import '../adminClient.js';
16
+ import '../controlObjectOwnership.js';
17
+ import '../beliefsClient.js';
18
+ import '../opinion.js';
19
+ import '../packsClient.js';
20
+ import '../customTools.js';
21
+ import 'zod';
22
+ import '../mcpTools-DPZxowDX.js';
23
+ import '../policyClient.js';
24
+ import '../ontologyClient.js';
25
+ import '../contextTypes.js';
26
+ import '../topicsClient.js';
27
+ import '../answersClient.js';
28
+ import '../auditClient.js';
29
+ import '../contextClient.js';
30
+ import '../decisionsClient.js';
31
+ import '../evidenceClient.js';
32
+ import '../graphClient.js';
33
+ import '../learningClient.js';
34
+ import '../mcpParityClient.js';
35
+ import '../reportsClient.js';
36
+ import '../sourcesClient.js';
37
+ import '../workflowClient.js';
38
+
39
+ type QuestionsClientConfig = LucernClientConfig;
40
+ type QuestionsClient = ReturnType<typeof createQuestionsClient>;
41
+ declare function createQuestionsClient(config?: QuestionsClientConfig): {
42
+ createQuestion: (args: {
43
+ text: string;
44
+ topicId?: string;
45
+ priority?: string;
46
+ linkedBeliefId?: string;
47
+ metadata?: JsonObject;
48
+ }) => Promise<PlatformGatewaySuccess<{
49
+ [x: string]: unknown;
50
+ }> & {
51
+ [x: string]: unknown;
52
+ }>;
53
+ getQuestion: (questionId: string) => Promise<PlatformGatewaySuccess<{
54
+ [x: string]: unknown;
55
+ }> & {
56
+ [x: string]: unknown;
57
+ }>;
58
+ listQuestions: (args: {
59
+ topicId?: string;
60
+ status?: string;
61
+ priority?: string;
62
+ worktreeId?: string;
63
+ limit?: number;
64
+ cursor?: string;
65
+ }) => Promise<PlatformGatewaySuccess<{
66
+ [x: string]: unknown;
67
+ } & {
68
+ cursor?: string;
69
+ total?: number;
70
+ } & {
71
+ questions?: Array<{
72
+ [x: string]: unknown;
73
+ } & {
74
+ priority?: string;
75
+ }>;
76
+ }> & {
77
+ [x: string]: unknown;
78
+ } & {
79
+ cursor?: string;
80
+ total?: number;
81
+ } & {
82
+ questions?: Array<{
83
+ [x: string]: unknown;
84
+ } & {
85
+ priority?: string;
86
+ }>;
87
+ }>;
88
+ answerQuestion: (questionId: string, input: {
89
+ text: string;
90
+ confidence?: string;
91
+ evidenceIds?: string[];
92
+ rationale?: string;
93
+ }) => Promise<PlatformGatewaySuccess<{
94
+ [x: string]: unknown;
95
+ }> & {
96
+ [x: string]: unknown;
97
+ }>;
98
+ refineQuestion: (questionId: string, text: string, refinementReason?: string) => Promise<PlatformGatewaySuccess<{
99
+ [x: string]: unknown;
100
+ }> & {
101
+ [x: string]: unknown;
102
+ }>;
103
+ updateQuestionStatus: (questionId: string, status: string, rationale?: string) => Promise<PlatformGatewaySuccess<{
104
+ [x: string]: unknown;
105
+ }> & {
106
+ [x: string]: unknown;
107
+ }>;
108
+ archiveQuestion: (questionId: string, reason?: string) => Promise<PlatformGatewaySuccess<{
109
+ [x: string]: unknown;
110
+ }> & {
111
+ [x: string]: unknown;
112
+ }>;
113
+ getHighPriorityQuestions: (args: {
114
+ topicId?: string;
115
+ limit?: number;
116
+ includeAnswered?: boolean;
117
+ }) => Promise<{
118
+ questions: ({
119
+ priority?: string;
120
+ } & Record<string, unknown>)[];
121
+ }>;
122
+ findMissingQuestions: (args: {
123
+ topicId?: string;
124
+ minConfidence?: number;
125
+ }) => Promise<PlatformGatewaySuccess<Record<string, unknown>> & Record<string, unknown>>;
126
+ raw: {
127
+ create(args: {
128
+ text: string;
129
+ topicId?: string;
130
+ priority?: string;
131
+ linkedBeliefId?: string;
132
+ metadata?: JsonObject;
133
+ }): Promise<PlatformGatewaySuccess<{
134
+ [x: string]: unknown;
135
+ }> & {
136
+ [x: string]: unknown;
137
+ }>;
138
+ get(questionId: string): Promise<PlatformGatewaySuccess<{
139
+ [x: string]: unknown;
140
+ }> & {
141
+ [x: string]: unknown;
142
+ }>;
143
+ refine(questionId: string, text: string, refinementReason?: string): Promise<PlatformGatewaySuccess<{
144
+ [x: string]: unknown;
145
+ }> & {
146
+ [x: string]: unknown;
147
+ }>;
148
+ list(args: {
149
+ topicId?: string;
150
+ status?: string;
151
+ priority?: string;
152
+ worktreeId?: string;
153
+ limit?: number;
154
+ cursor?: string;
155
+ }): Promise<PlatformGatewaySuccess<{
156
+ [x: string]: unknown;
157
+ } & {
158
+ cursor?: string;
159
+ total?: number;
160
+ } & {
161
+ questions?: Array<{
162
+ [x: string]: unknown;
163
+ } & {
164
+ priority?: string;
165
+ }>;
166
+ }> & {
167
+ [x: string]: unknown;
168
+ } & {
169
+ cursor?: string;
170
+ total?: number;
171
+ } & {
172
+ questions?: Array<{
173
+ [x: string]: unknown;
174
+ } & {
175
+ priority?: string;
176
+ }>;
177
+ }>;
178
+ updateStatus(questionId: string, status: string, rationale?: string): Promise<PlatformGatewaySuccess<{
179
+ [x: string]: unknown;
180
+ }> & {
181
+ [x: string]: unknown;
182
+ }>;
183
+ batchCreate(input: Parameters<(input: {
184
+ [x: string]: unknown;
185
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
186
+ [x: string]: unknown;
187
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
188
+ [x: string]: unknown;
189
+ }> & {
190
+ [x: string]: unknown;
191
+ }>;
192
+ add(input: Parameters<(input: {
193
+ [x: string]: unknown;
194
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
195
+ [x: string]: unknown;
196
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
197
+ [x: string]: unknown;
198
+ }> & {
199
+ [x: string]: unknown;
200
+ }>;
201
+ updatePriority(input: Parameters<(input: {
202
+ [x: string]: unknown;
203
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
204
+ [x: string]: unknown;
205
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
206
+ [x: string]: unknown;
207
+ }> & {
208
+ [x: string]: unknown;
209
+ }>;
210
+ advanceToConviction(input: Parameters<(input: {
211
+ [x: string]: unknown;
212
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
213
+ [x: string]: unknown;
214
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
215
+ [x: string]: unknown;
216
+ }> & {
217
+ [x: string]: unknown;
218
+ }>;
219
+ updateConviction(input: Parameters<(input: {
220
+ [x: string]: unknown;
221
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
222
+ [x: string]: unknown;
223
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
224
+ [x: string]: unknown;
225
+ }> & {
226
+ [x: string]: unknown;
227
+ }>;
228
+ finalizeConviction(input: Parameters<(input: {
229
+ [x: string]: unknown;
230
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
231
+ [x: string]: unknown;
232
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
233
+ [x: string]: unknown;
234
+ }> & {
235
+ [x: string]: unknown;
236
+ }>;
237
+ update(input: Parameters<(input: {
238
+ [x: string]: unknown;
239
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
240
+ [x: string]: unknown;
241
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
242
+ [x: string]: unknown;
243
+ }> & {
244
+ [x: string]: unknown;
245
+ }>;
246
+ delete(input: Parameters<(input: {
247
+ [x: string]: unknown;
248
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
249
+ [x: string]: unknown;
250
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
251
+ [x: string]: unknown;
252
+ }> & {
253
+ [x: string]: unknown;
254
+ }>;
255
+ answer(questionId: string, input: {
256
+ text: string;
257
+ confidence?: string;
258
+ evidenceIds?: string[];
259
+ rationale?: string;
260
+ }): Promise<PlatformGatewaySuccess<{
261
+ [x: string]: unknown;
262
+ }> & {
263
+ [x: string]: unknown;
264
+ }>;
265
+ archive(questionId: string, reason?: string): Promise<PlatformGatewaySuccess<{
266
+ [x: string]: unknown;
267
+ }> & {
268
+ [x: string]: unknown;
269
+ }>;
270
+ linkEvidence(args: {
271
+ evidenceId: string;
272
+ questionId: string;
273
+ relevance?: number;
274
+ weight?: number;
275
+ rationale?: string;
276
+ }): Promise<{
277
+ questionId: string;
278
+ relevance: number | undefined;
279
+ edgeId?: string;
280
+ }>;
281
+ getHighPriority(args: {
282
+ topicId?: string;
283
+ limit?: number;
284
+ includeAnswered?: boolean;
285
+ }): Promise<{
286
+ questions: ({
287
+ priority?: string;
288
+ } & Record<string, unknown>)[];
289
+ }>;
290
+ findMissing(args: {
291
+ topicId?: string;
292
+ minConfidence?: number;
293
+ }): Promise<PlatformGatewaySuccess<Record<string, unknown>> & Record<string, unknown>>;
294
+ };
295
+ };
296
+
297
+ export { type QuestionsClient, type QuestionsClientConfig, createQuestionsClient };