@lucern/sdk 0.2.0-alpha.9 → 0.3.0-alpha.0

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 (101) hide show
  1. package/README.md +6 -0
  2. package/dist/adminClient.d.ts +15 -9
  3. package/dist/adminClient.js.map +1 -1
  4. package/dist/audience/index.d.ts +38 -0
  5. package/dist/audience/index.js +110 -0
  6. package/dist/audience/index.js.map +1 -0
  7. package/dist/beliefs/index.d.ts +463 -0
  8. package/dist/beliefs/index.js +6694 -0
  9. package/dist/beliefs/index.js.map +1 -0
  10. package/dist/beliefs/lifecycle.d.ts +24 -0
  11. package/dist/beliefs/lifecycle.js +98 -0
  12. package/dist/beliefs/lifecycle.js.map +1 -0
  13. package/dist/beliefsClient.d.ts +91 -12
  14. package/dist/beliefsClient.js +176 -7
  15. package/dist/beliefsClient.js.map +1 -1
  16. package/dist/client-DAuKnDlx.d.ts +2547 -0
  17. package/dist/client.d.ts +31 -2377
  18. package/dist/client.js +783 -245
  19. package/dist/client.js.map +1 -1
  20. package/dist/contracts/api-enums.contract.d.ts +1 -1
  21. package/dist/contracts/api-enums.contract.js +8 -2
  22. package/dist/contracts/api-enums.contract.js.map +1 -1
  23. package/dist/contracts/index.d.ts +4 -2
  24. package/dist/contracts/index.js +118 -4282
  25. package/dist/contracts/index.js.map +1 -1
  26. package/dist/contracts/mcpTools.d.ts +2 -1
  27. package/dist/contracts/mcpTools.js +22 -2981
  28. package/dist/contracts/mcpTools.js.map +1 -1
  29. package/dist/contracts/sdk-tools.contract.d.ts +1 -2
  30. package/dist/contracts/sdk-tools.contract.js +1 -4132
  31. package/dist/contracts/sdk-tools.contract.js.map +1 -1
  32. package/dist/contracts/sdkTools.d.ts +1 -2
  33. package/dist/contracts/sdkTools.js +20 -4127
  34. package/dist/contracts/sdkTools.js.map +1 -1
  35. package/dist/contracts/tool-contracts.d.ts +1 -0
  36. package/dist/contracts/tool-contracts.js +3 -0
  37. package/dist/contracts/tool-contracts.js.map +1 -0
  38. package/dist/contradictions/index.d.ts +156 -0
  39. package/dist/contradictions/index.js +6688 -0
  40. package/dist/contradictions/index.js.map +1 -0
  41. package/dist/customTools.d.ts +1 -1
  42. package/dist/decisions/index.d.ts +66 -0
  43. package/dist/decisions/index.js +6690 -0
  44. package/dist/decisions/index.js.map +1 -0
  45. package/dist/edges/index.d.ts +202 -0
  46. package/dist/edges/index.js +6689 -0
  47. package/dist/edges/index.js.map +1 -0
  48. package/dist/events.js +7 -5
  49. package/dist/events.js.map +1 -1
  50. package/dist/evidence/index.d.ts +293 -0
  51. package/dist/evidence/index.js +6689 -0
  52. package/dist/evidence/index.js.map +1 -0
  53. package/dist/evidenceClient.d.ts +119 -0
  54. package/dist/evidenceClient.js +350 -0
  55. package/dist/evidenceClient.js.map +1 -0
  56. package/dist/gatewayFacades.d.ts +8 -10
  57. package/dist/gatewayFacades.js +54 -1
  58. package/dist/gatewayFacades.js.map +1 -1
  59. package/dist/identityClient.d.ts +3 -3
  60. package/dist/identityClient.js.map +1 -1
  61. package/dist/index.d.ts +7 -6
  62. package/dist/index.js +1092 -3294
  63. package/dist/index.js.map +1 -1
  64. package/dist/lenses/index.d.ts +192 -0
  65. package/dist/lenses/index.js +6688 -0
  66. package/dist/lenses/index.js.map +1 -0
  67. package/dist/nodes/index.d.ts +61 -0
  68. package/dist/nodes/index.js +6690 -0
  69. package/dist/nodes/index.js.map +1 -0
  70. package/dist/ontologies/index.d.ts +179 -0
  71. package/dist/ontologies/index.js +6691 -0
  72. package/dist/ontologies/index.js.map +1 -0
  73. package/dist/opinion.d.ts +11 -0
  74. package/dist/opinion.js +35 -0
  75. package/dist/opinion.js.map +1 -0
  76. package/dist/questions/index.d.ts +295 -0
  77. package/dist/questions/index.js +6691 -0
  78. package/dist/questions/index.js.map +1 -0
  79. package/dist/sdk-tools.contract-B4c1Zr1o.d.ts +22 -0
  80. package/dist/sourcesClient.d.ts +24 -0
  81. package/dist/{mcpParityClient.js → sourcesClient.js} +15 -192
  82. package/dist/sourcesClient.js.map +1 -0
  83. package/dist/tool-contracts-BUiL9P6z.d.ts +22 -0
  84. package/dist/topics/index.d.ts +66 -0
  85. package/dist/topics/index.js +6689 -0
  86. package/dist/topics/index.js.map +1 -0
  87. package/dist/types.d.ts +20 -1
  88. package/dist/worktrees/index.d.ts +208 -0
  89. package/dist/worktrees/index.js +6691 -0
  90. package/dist/worktrees/index.js.map +1 -0
  91. package/package.json +55 -3
  92. package/dist/contracts/mcp-tools.contract.d.ts +0 -1
  93. package/dist/contracts/mcp-tools.contract.js +0 -2986
  94. package/dist/contracts/mcp-tools.contract.js.map +0 -1
  95. package/dist/mcpParityClient.d.ts +0 -74
  96. package/dist/mcpParityClient.js.map +0 -1
  97. package/dist/mcpParitySurface.d.ts +0 -12
  98. package/dist/mcpParitySurface.js +0 -65
  99. package/dist/mcpParitySurface.js.map +0 -1
  100. package/dist/mcpTools-DPZxowDX.d.ts +0 -254
  101. package/dist/sdkTools-CwXJDACb.d.ts +0 -150
@@ -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,295 @@
1
+ import { PlatformGatewaySuccess } from '../coreClient.js';
2
+ import { JsonObject } from '../types.js';
3
+ import { L as LucernClientConfig } from '../client-DAuKnDlx.js';
4
+ import * as v1 from '@lucern/contracts/questions/v1';
5
+ export { v1 as questionsContracts };
6
+ import * as toolContracts from '@lucern/contracts/tool-contracts';
7
+ export { toolContracts 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 '../policyClient.js';
23
+ import '../ontologyClient.js';
24
+ import '../contextTypes.js';
25
+ import '../topicsClient.js';
26
+ import '../answersClient.js';
27
+ import '../auditClient.js';
28
+ import '../contextClient.js';
29
+ import '../decisionsClient.js';
30
+ import '../evidenceClient.js';
31
+ import '../graphClient.js';
32
+ import '../learningClient.js';
33
+ import '../reportsClient.js';
34
+ import '../sourcesClient.js';
35
+ import '../workflowClient.js';
36
+
37
+ type QuestionsClientConfig = LucernClientConfig;
38
+ type QuestionsClient = ReturnType<typeof createQuestionsClient>;
39
+ declare function createQuestionsClient(config?: QuestionsClientConfig): {
40
+ createQuestion: (args: {
41
+ text: string;
42
+ topicId?: string;
43
+ priority?: string;
44
+ linkedBeliefId?: string;
45
+ metadata?: JsonObject;
46
+ }) => Promise<PlatformGatewaySuccess<{
47
+ [x: string]: unknown;
48
+ }> & {
49
+ [x: string]: unknown;
50
+ }>;
51
+ getQuestion: (questionId: string) => Promise<PlatformGatewaySuccess<{
52
+ [x: string]: unknown;
53
+ }> & {
54
+ [x: string]: unknown;
55
+ }>;
56
+ listQuestions: (args: {
57
+ topicId?: string;
58
+ status?: string;
59
+ priority?: string;
60
+ worktreeId?: string;
61
+ limit?: number;
62
+ cursor?: string;
63
+ }) => Promise<PlatformGatewaySuccess<{
64
+ [x: string]: unknown;
65
+ } & {
66
+ cursor?: string;
67
+ total?: number;
68
+ } & {
69
+ questions?: Array<{
70
+ [x: string]: unknown;
71
+ } & {
72
+ priority?: string;
73
+ }>;
74
+ }> & {
75
+ [x: string]: unknown;
76
+ } & {
77
+ cursor?: string;
78
+ total?: number;
79
+ } & {
80
+ questions?: Array<{
81
+ [x: string]: unknown;
82
+ } & {
83
+ priority?: string;
84
+ }>;
85
+ }>;
86
+ answerQuestion: (questionId: string, input: {
87
+ text: string;
88
+ confidence?: string;
89
+ evidenceIds?: string[];
90
+ rationale?: string;
91
+ }) => Promise<PlatformGatewaySuccess<{
92
+ [x: string]: unknown;
93
+ }> & {
94
+ [x: string]: unknown;
95
+ }>;
96
+ refineQuestion: (questionId: string, text: string, refinementReason?: string) => Promise<PlatformGatewaySuccess<{
97
+ [x: string]: unknown;
98
+ }> & {
99
+ [x: string]: unknown;
100
+ }>;
101
+ updateQuestionStatus: (questionId: string, status: string, rationale?: string) => Promise<PlatformGatewaySuccess<{
102
+ [x: string]: unknown;
103
+ }> & {
104
+ [x: string]: unknown;
105
+ }>;
106
+ archiveQuestion: (questionId: string, reason?: string) => Promise<PlatformGatewaySuccess<{
107
+ [x: string]: unknown;
108
+ }> & {
109
+ [x: string]: unknown;
110
+ }>;
111
+ getHighPriorityQuestions: (args: {
112
+ topicId?: string;
113
+ limit?: number;
114
+ includeAnswered?: boolean;
115
+ }) => Promise<{
116
+ questions: ({
117
+ priority?: string;
118
+ } & Record<string, unknown>)[];
119
+ }>;
120
+ findMissingQuestions: (args: {
121
+ topicId?: string;
122
+ minConfidence?: number;
123
+ }) => Promise<PlatformGatewaySuccess<Record<string, unknown>> & Record<string, unknown>>;
124
+ raw: {
125
+ create(args: {
126
+ text: string;
127
+ topicId?: string;
128
+ priority?: string;
129
+ linkedBeliefId?: string;
130
+ metadata?: JsonObject;
131
+ }): Promise<PlatformGatewaySuccess<{
132
+ [x: string]: unknown;
133
+ }> & {
134
+ [x: string]: unknown;
135
+ }>;
136
+ get(questionId: string): Promise<PlatformGatewaySuccess<{
137
+ [x: string]: unknown;
138
+ }> & {
139
+ [x: string]: unknown;
140
+ }>;
141
+ refine(questionId: string, text: string, refinementReason?: string): Promise<PlatformGatewaySuccess<{
142
+ [x: string]: unknown;
143
+ }> & {
144
+ [x: string]: unknown;
145
+ }>;
146
+ list(args: {
147
+ topicId?: string;
148
+ status?: string;
149
+ priority?: string;
150
+ worktreeId?: string;
151
+ limit?: number;
152
+ cursor?: string;
153
+ }): Promise<PlatformGatewaySuccess<{
154
+ [x: string]: unknown;
155
+ } & {
156
+ cursor?: string;
157
+ total?: number;
158
+ } & {
159
+ questions?: Array<{
160
+ [x: string]: unknown;
161
+ } & {
162
+ priority?: string;
163
+ }>;
164
+ }> & {
165
+ [x: string]: unknown;
166
+ } & {
167
+ cursor?: string;
168
+ total?: number;
169
+ } & {
170
+ questions?: Array<{
171
+ [x: string]: unknown;
172
+ } & {
173
+ priority?: string;
174
+ }>;
175
+ }>;
176
+ updateStatus(questionId: string, status: string, rationale?: string): Promise<PlatformGatewaySuccess<{
177
+ [x: string]: unknown;
178
+ }> & {
179
+ [x: string]: unknown;
180
+ }>;
181
+ batchCreate(input: Parameters<(input: {
182
+ [x: string]: unknown;
183
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
184
+ [x: string]: unknown;
185
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
186
+ [x: string]: unknown;
187
+ }> & {
188
+ [x: string]: unknown;
189
+ }>;
190
+ add(input: Parameters<(input: {
191
+ [x: string]: unknown;
192
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
193
+ [x: string]: unknown;
194
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
195
+ [x: string]: unknown;
196
+ }> & {
197
+ [x: string]: unknown;
198
+ }>;
199
+ updatePriority(input: Parameters<(input: {
200
+ [x: string]: unknown;
201
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
202
+ [x: string]: unknown;
203
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
204
+ [x: string]: unknown;
205
+ }> & {
206
+ [x: string]: unknown;
207
+ }>;
208
+ advanceToConviction(input: Parameters<(input: {
209
+ [x: string]: unknown;
210
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
211
+ [x: string]: unknown;
212
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
213
+ [x: string]: unknown;
214
+ }> & {
215
+ [x: string]: unknown;
216
+ }>;
217
+ updateConviction(input: Parameters<(input: {
218
+ [x: string]: unknown;
219
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
220
+ [x: string]: unknown;
221
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
222
+ [x: string]: unknown;
223
+ }> & {
224
+ [x: string]: unknown;
225
+ }>;
226
+ finalizeConviction(input: Parameters<(input: {
227
+ [x: string]: unknown;
228
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
229
+ [x: string]: unknown;
230
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
231
+ [x: string]: unknown;
232
+ }> & {
233
+ [x: string]: unknown;
234
+ }>;
235
+ update(input: Parameters<(input: {
236
+ [x: string]: unknown;
237
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
238
+ [x: string]: unknown;
239
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
240
+ [x: string]: unknown;
241
+ }> & {
242
+ [x: string]: unknown;
243
+ }>;
244
+ delete(input: Parameters<(input: {
245
+ [x: string]: unknown;
246
+ }, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<{
247
+ [x: string]: unknown;
248
+ }>>>[0], idempotencyKey?: string): Promise<PlatformGatewaySuccess<{
249
+ [x: string]: unknown;
250
+ }> & {
251
+ [x: string]: unknown;
252
+ }>;
253
+ answer(questionId: string, input: {
254
+ text: string;
255
+ confidence?: string;
256
+ evidenceIds?: string[];
257
+ rationale?: string;
258
+ }): Promise<PlatformGatewaySuccess<{
259
+ [x: string]: unknown;
260
+ }> & {
261
+ [x: string]: unknown;
262
+ }>;
263
+ archive(questionId: string, reason?: string): Promise<PlatformGatewaySuccess<{
264
+ [x: string]: unknown;
265
+ }> & {
266
+ [x: string]: unknown;
267
+ }>;
268
+ linkEvidence(args: {
269
+ evidenceId: string;
270
+ questionId: string;
271
+ relevance?: number;
272
+ weight?: number;
273
+ rationale?: string;
274
+ }): Promise<{
275
+ questionId: string;
276
+ relevance: number | undefined;
277
+ edgeId?: string;
278
+ }>;
279
+ getHighPriority(args: {
280
+ topicId?: string;
281
+ limit?: number;
282
+ includeAnswered?: boolean;
283
+ }): Promise<{
284
+ questions: ({
285
+ priority?: string;
286
+ } & Record<string, unknown>)[];
287
+ }>;
288
+ findMissing(args: {
289
+ topicId?: string;
290
+ minConfidence?: number;
291
+ }): Promise<PlatformGatewaySuccess<Record<string, unknown>> & Record<string, unknown>>;
292
+ };
293
+ };
294
+
295
+ export { type QuestionsClient, type QuestionsClientConfig, createQuestionsClient };