@lucern/sdk 0.3.0-alpha.7 → 0.3.0-alpha.9
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.
- package/README.md +4 -4
- package/dist/beliefs/index.d.ts +1 -0
- package/dist/beliefs/index.js +51 -27
- package/dist/beliefs/index.js.map +1 -1
- package/dist/client.d.ts +6 -3
- package/dist/client.js +51 -27
- package/dist/client.js.map +1 -1
- package/dist/clientHelpers.d.ts +21 -2
- package/dist/clientHelpers.js +16 -1
- package/dist/clientHelpers.js.map +1 -1
- package/dist/contextClient.d.ts +4 -3
- package/dist/contextClient.js +30 -18
- package/dist/contextClient.js.map +1 -1
- package/dist/contextFacade.js +25 -16
- package/dist/contextFacade.js.map +1 -1
- package/dist/contextTypes.d.ts +2 -0
- package/dist/contradictions/index.d.ts +1 -0
- package/dist/contradictions/index.js +51 -27
- package/dist/contradictions/index.js.map +1 -1
- package/dist/decisions/index.d.ts +1 -0
- package/dist/decisions/index.js +51 -27
- package/dist/decisions/index.js.map +1 -1
- package/dist/edges/index.d.ts +1 -0
- package/dist/edges/index.js +51 -27
- package/dist/edges/index.js.map +1 -1
- package/dist/evidence/index.d.ts +1 -0
- package/dist/evidence/index.js +51 -27
- package/dist/evidence/index.js.map +1 -1
- package/dist/facade/context.d.ts +2 -1
- package/dist/facade/context.js +25 -16
- package/dist/facade/context.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +76 -43
- package/dist/index.js.map +1 -1
- package/dist/lenses/index.d.ts +1 -0
- package/dist/lenses/index.js +51 -27
- package/dist/lenses/index.js.map +1 -1
- package/dist/nodes/index.d.ts +1 -0
- package/dist/nodes/index.js +51 -27
- package/dist/nodes/index.js.map +1 -1
- package/dist/ontologies/index.d.ts +1 -0
- package/dist/ontologies/index.js +51 -27
- package/dist/ontologies/index.js.map +1 -1
- package/dist/questions/index.d.ts +1 -0
- package/dist/questions/index.js +51 -27
- package/dist/questions/index.js.map +1 -1
- package/dist/topics/index.d.ts +1 -0
- package/dist/topics/index.js +51 -27
- package/dist/topics/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/worktrees/index.d.ts +1 -0
- package/dist/worktrees/index.js +51 -27
- package/dist/worktrees/index.js.map +1 -1
- package/package.json +4 -4
package/dist/evidence/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ import '../learningClient.js';
|
|
|
52
52
|
import '../reportsClient.js';
|
|
53
53
|
import '../sourcesClient.js';
|
|
54
54
|
import '../workflowClient.js';
|
|
55
|
+
import '../clientHelpers.js';
|
|
55
56
|
|
|
56
57
|
type EvidenceClientConfig = LucernClientConfig;
|
|
57
58
|
type EvidenceClient = ReturnType<typeof createEvidenceClient>;
|
package/dist/evidence/index.js
CHANGED
|
@@ -3912,50 +3912,55 @@ function cleanNumber(value) {
|
|
|
3912
3912
|
function cleanBoolean(value) {
|
|
3913
3913
|
return typeof value === "boolean" ? value : void 0;
|
|
3914
3914
|
}
|
|
3915
|
-
function buildCompileContextRequest(
|
|
3916
|
-
const
|
|
3917
|
-
const
|
|
3915
|
+
function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
|
|
3916
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
3917
|
+
const payload = {};
|
|
3918
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString4(topicIdOrInput) : cleanString4(effectiveInput.topicId);
|
|
3919
|
+
if (topicId) {
|
|
3920
|
+
payload.topicId = topicId;
|
|
3921
|
+
}
|
|
3922
|
+
const query5 = cleanString4(effectiveInput.query);
|
|
3918
3923
|
if (query5) {
|
|
3919
3924
|
payload.query = query5;
|
|
3920
3925
|
}
|
|
3921
|
-
const budget = cleanNumber(
|
|
3926
|
+
const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
|
|
3922
3927
|
if (budget !== void 0) {
|
|
3923
3928
|
payload.budget = budget;
|
|
3924
3929
|
}
|
|
3925
|
-
const ranking = cleanString4(
|
|
3930
|
+
const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
|
|
3926
3931
|
if (ranking) {
|
|
3927
3932
|
payload.ranking = ranking;
|
|
3928
3933
|
}
|
|
3929
|
-
const limit = cleanNumber(
|
|
3934
|
+
const limit = cleanNumber(effectiveInput.limit);
|
|
3930
3935
|
if (limit !== void 0) {
|
|
3931
3936
|
payload.limit = limit;
|
|
3932
3937
|
}
|
|
3933
|
-
const maxDepth = cleanNumber(
|
|
3938
|
+
const maxDepth = cleanNumber(effectiveInput.maxDepth);
|
|
3934
3939
|
if (maxDepth !== void 0) {
|
|
3935
3940
|
payload.maxDepth = maxDepth;
|
|
3936
3941
|
}
|
|
3937
|
-
const includeEntities = cleanBoolean(
|
|
3942
|
+
const includeEntities = cleanBoolean(effectiveInput.includeEntities);
|
|
3938
3943
|
if (includeEntities !== void 0) {
|
|
3939
3944
|
payload.includeEntities = includeEntities;
|
|
3940
3945
|
}
|
|
3941
|
-
const mode = cleanString4(
|
|
3946
|
+
const mode = cleanString4(effectiveInput.mode);
|
|
3942
3947
|
if (mode) {
|
|
3943
3948
|
payload.mode = mode;
|
|
3944
3949
|
}
|
|
3945
|
-
const includeFailures = cleanBoolean(
|
|
3950
|
+
const includeFailures = cleanBoolean(effectiveInput.includeFailures);
|
|
3946
3951
|
if (includeFailures !== void 0) {
|
|
3947
3952
|
payload.includeFailures = includeFailures;
|
|
3948
3953
|
}
|
|
3949
|
-
const worktreeId = cleanString4(
|
|
3954
|
+
const worktreeId = cleanString4(effectiveInput.worktreeId);
|
|
3950
3955
|
if (worktreeId) {
|
|
3951
3956
|
payload.worktreeId = worktreeId;
|
|
3952
3957
|
}
|
|
3953
|
-
const sessionId = cleanString4(
|
|
3958
|
+
const sessionId = cleanString4(effectiveInput.sessionId);
|
|
3954
3959
|
if (sessionId) {
|
|
3955
3960
|
payload.sessionId = sessionId;
|
|
3956
3961
|
}
|
|
3957
|
-
if (Array.isArray(
|
|
3958
|
-
payload.packWeightOverrides =
|
|
3962
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
3963
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
3959
3964
|
}
|
|
3960
3965
|
return {
|
|
3961
3966
|
path: "/api/platform/v1/context/compile",
|
|
@@ -3967,13 +3972,20 @@ function createContextClient(config = {}) {
|
|
|
3967
3972
|
const gateway = createGatewayRequestClient(config);
|
|
3968
3973
|
return {
|
|
3969
3974
|
/**
|
|
3970
|
-
* Compile a focused reasoning context pack
|
|
3971
|
-
* @param
|
|
3975
|
+
* Compile a focused reasoning context pack.
|
|
3976
|
+
* @param topicIdOrInput - Optional topic ID, or compile input for query-first resolution.
|
|
3972
3977
|
* @param input - Optional compile parameters (query, budget, ranking, etc.).
|
|
3973
3978
|
* @returns The compiled context payload with beliefs, questions, and evidence.
|
|
3974
3979
|
*/
|
|
3975
|
-
async compile(
|
|
3976
|
-
const request = buildCompileContextRequest(
|
|
3980
|
+
async compile(topicIdOrInput = {}, input = {}) {
|
|
3981
|
+
const request = buildCompileContextRequest(topicIdOrInput, input);
|
|
3982
|
+
return gateway.request({
|
|
3983
|
+
...request,
|
|
3984
|
+
body: request.body
|
|
3985
|
+
});
|
|
3986
|
+
},
|
|
3987
|
+
async compileByQuery(input = {}) {
|
|
3988
|
+
const request = buildCompileContextRequest(input);
|
|
3977
3989
|
return gateway.request({
|
|
3978
3990
|
...request,
|
|
3979
3991
|
body: request.body
|
|
@@ -6248,6 +6260,21 @@ function createSchemaClient(config = {}) {
|
|
|
6248
6260
|
}
|
|
6249
6261
|
|
|
6250
6262
|
// src/clientHelpers.ts
|
|
6263
|
+
function normalizeCustomNamespace(namespace) {
|
|
6264
|
+
return namespace.trim() || "custom";
|
|
6265
|
+
}
|
|
6266
|
+
function normalizeCustomToolPayload(input) {
|
|
6267
|
+
return input && typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
6268
|
+
}
|
|
6269
|
+
function resolveCustomToolFullName(name) {
|
|
6270
|
+
return name.includes(".") ? name : `custom.${name}`;
|
|
6271
|
+
}
|
|
6272
|
+
function buildBeliefsRefinePayload(textOrInput, rationale) {
|
|
6273
|
+
return typeof textOrInput === "string" ? { text: textOrInput, rationale } : { text: textOrInput.text, rationale: textOrInput.rationale };
|
|
6274
|
+
}
|
|
6275
|
+
function buildBeliefsArchivePayload(input) {
|
|
6276
|
+
return typeof input === "string" ? { reason: input } : input ? { reason: input.reason ?? input.rationale } : void 0;
|
|
6277
|
+
}
|
|
6251
6278
|
function asNodeArray(data) {
|
|
6252
6279
|
const rows = asListItems(data, "nodes");
|
|
6253
6280
|
if (rows.length > 0) {
|
|
@@ -6625,7 +6652,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
6625
6652
|
}
|
|
6626
6653
|
|
|
6627
6654
|
// src/version.ts
|
|
6628
|
-
var LUCERN_SDK_VERSION = "0.3.0-alpha.
|
|
6655
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.9";
|
|
6629
6656
|
|
|
6630
6657
|
// src/workflowClient.ts
|
|
6631
6658
|
function normalizeLensQuery(value) {
|
|
@@ -7146,11 +7173,11 @@ function createLucernClient(config = {}) {
|
|
|
7146
7173
|
}
|
|
7147
7174
|
}
|
|
7148
7175
|
const invokeCustomTool = async (fullName, input = {}) => {
|
|
7149
|
-
const payload =
|
|
7176
|
+
const payload = normalizeCustomToolPayload(input);
|
|
7150
7177
|
return invokeRegisteredCustomTool(fullName, payload, { source: "sdk" });
|
|
7151
7178
|
};
|
|
7152
7179
|
const getCustomNamespace = (namespace) => {
|
|
7153
|
-
const normalized = namespace
|
|
7180
|
+
const normalized = normalizeCustomNamespace(namespace);
|
|
7154
7181
|
const cached = customNamespaceCache.get(normalized);
|
|
7155
7182
|
if (cached) {
|
|
7156
7183
|
return cached;
|
|
@@ -7610,10 +7637,7 @@ function createLucernClient(config = {}) {
|
|
|
7610
7637
|
return beliefsFacade.get(nodeId).then(exposeGatewayData);
|
|
7611
7638
|
},
|
|
7612
7639
|
refine(nodeId, textOrInput, rationale) {
|
|
7613
|
-
const payload =
|
|
7614
|
-
text: textOrInput.text,
|
|
7615
|
-
rationale: textOrInput.rationale
|
|
7616
|
-
};
|
|
7640
|
+
const payload = buildBeliefsRefinePayload(textOrInput, rationale);
|
|
7617
7641
|
return beliefsFacade.refine(nodeId, payload).then(exposeGatewayData);
|
|
7618
7642
|
},
|
|
7619
7643
|
updateConfidence(nodeId, input) {
|
|
@@ -7651,7 +7675,7 @@ function createLucernClient(config = {}) {
|
|
|
7651
7675
|
}).then(exposeGatewayData);
|
|
7652
7676
|
},
|
|
7653
7677
|
archive(nodeId, input) {
|
|
7654
|
-
const payload =
|
|
7678
|
+
const payload = buildBeliefsArchivePayload(input);
|
|
7655
7679
|
return beliefsFacade.archive(nodeId, payload).then(exposeGatewayData);
|
|
7656
7680
|
},
|
|
7657
7681
|
list(args) {
|
|
@@ -8691,7 +8715,7 @@ function createLucernClient(config = {}) {
|
|
|
8691
8715
|
list: listRegisteredCustomTools,
|
|
8692
8716
|
clear: clearRegisteredCustomTools,
|
|
8693
8717
|
invoke(name, input = {}) {
|
|
8694
|
-
const fullName = name
|
|
8718
|
+
const fullName = resolveCustomToolFullName(name);
|
|
8695
8719
|
return invokeCustomTool(fullName, input);
|
|
8696
8720
|
},
|
|
8697
8721
|
namespace: getCustomNamespace
|