@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
|
@@ -54,6 +54,7 @@ import '../learningClient.js';
|
|
|
54
54
|
import '../reportsClient.js';
|
|
55
55
|
import '../sourcesClient.js';
|
|
56
56
|
import '../workflowClient.js';
|
|
57
|
+
import '../clientHelpers.js';
|
|
57
58
|
|
|
58
59
|
type OntologiesClientConfig = LucernClientConfig;
|
|
59
60
|
type OntologiesClient = ReturnType<typeof createOntologiesClient>;
|
package/dist/ontologies/index.js
CHANGED
|
@@ -3914,50 +3914,55 @@ function cleanNumber(value) {
|
|
|
3914
3914
|
function cleanBoolean(value) {
|
|
3915
3915
|
return typeof value === "boolean" ? value : void 0;
|
|
3916
3916
|
}
|
|
3917
|
-
function buildCompileContextRequest(
|
|
3918
|
-
const
|
|
3919
|
-
const
|
|
3917
|
+
function buildCompileContextRequest(topicIdOrInput = {}, input = {}) {
|
|
3918
|
+
const effectiveInput = typeof topicIdOrInput === "string" ? input : topicIdOrInput;
|
|
3919
|
+
const payload = {};
|
|
3920
|
+
const topicId = typeof topicIdOrInput === "string" ? cleanString4(topicIdOrInput) : cleanString4(effectiveInput.topicId);
|
|
3921
|
+
if (topicId) {
|
|
3922
|
+
payload.topicId = topicId;
|
|
3923
|
+
}
|
|
3924
|
+
const query5 = cleanString4(effectiveInput.query);
|
|
3920
3925
|
if (query5) {
|
|
3921
3926
|
payload.query = query5;
|
|
3922
3927
|
}
|
|
3923
|
-
const budget = cleanNumber(
|
|
3928
|
+
const budget = cleanNumber(effectiveInput.budget) ?? cleanNumber(effectiveInput.tokenBudget);
|
|
3924
3929
|
if (budget !== void 0) {
|
|
3925
3930
|
payload.budget = budget;
|
|
3926
3931
|
}
|
|
3927
|
-
const ranking = cleanString4(
|
|
3932
|
+
const ranking = cleanString4(effectiveInput.ranking) ?? cleanString4(effectiveInput.rankingProfile);
|
|
3928
3933
|
if (ranking) {
|
|
3929
3934
|
payload.ranking = ranking;
|
|
3930
3935
|
}
|
|
3931
|
-
const limit = cleanNumber(
|
|
3936
|
+
const limit = cleanNumber(effectiveInput.limit);
|
|
3932
3937
|
if (limit !== void 0) {
|
|
3933
3938
|
payload.limit = limit;
|
|
3934
3939
|
}
|
|
3935
|
-
const maxDepth = cleanNumber(
|
|
3940
|
+
const maxDepth = cleanNumber(effectiveInput.maxDepth);
|
|
3936
3941
|
if (maxDepth !== void 0) {
|
|
3937
3942
|
payload.maxDepth = maxDepth;
|
|
3938
3943
|
}
|
|
3939
|
-
const includeEntities = cleanBoolean(
|
|
3944
|
+
const includeEntities = cleanBoolean(effectiveInput.includeEntities);
|
|
3940
3945
|
if (includeEntities !== void 0) {
|
|
3941
3946
|
payload.includeEntities = includeEntities;
|
|
3942
3947
|
}
|
|
3943
|
-
const mode = cleanString4(
|
|
3948
|
+
const mode = cleanString4(effectiveInput.mode);
|
|
3944
3949
|
if (mode) {
|
|
3945
3950
|
payload.mode = mode;
|
|
3946
3951
|
}
|
|
3947
|
-
const includeFailures = cleanBoolean(
|
|
3952
|
+
const includeFailures = cleanBoolean(effectiveInput.includeFailures);
|
|
3948
3953
|
if (includeFailures !== void 0) {
|
|
3949
3954
|
payload.includeFailures = includeFailures;
|
|
3950
3955
|
}
|
|
3951
|
-
const worktreeId = cleanString4(
|
|
3956
|
+
const worktreeId = cleanString4(effectiveInput.worktreeId);
|
|
3952
3957
|
if (worktreeId) {
|
|
3953
3958
|
payload.worktreeId = worktreeId;
|
|
3954
3959
|
}
|
|
3955
|
-
const sessionId = cleanString4(
|
|
3960
|
+
const sessionId = cleanString4(effectiveInput.sessionId);
|
|
3956
3961
|
if (sessionId) {
|
|
3957
3962
|
payload.sessionId = sessionId;
|
|
3958
3963
|
}
|
|
3959
|
-
if (Array.isArray(
|
|
3960
|
-
payload.packWeightOverrides =
|
|
3964
|
+
if (Array.isArray(effectiveInput.packWeightOverrides) && effectiveInput.packWeightOverrides.length > 0) {
|
|
3965
|
+
payload.packWeightOverrides = effectiveInput.packWeightOverrides;
|
|
3961
3966
|
}
|
|
3962
3967
|
return {
|
|
3963
3968
|
path: "/api/platform/v1/context/compile",
|
|
@@ -3969,13 +3974,20 @@ function createContextClient(config = {}) {
|
|
|
3969
3974
|
const gateway = createGatewayRequestClient(config);
|
|
3970
3975
|
return {
|
|
3971
3976
|
/**
|
|
3972
|
-
* Compile a focused reasoning context pack
|
|
3973
|
-
* @param
|
|
3977
|
+
* Compile a focused reasoning context pack.
|
|
3978
|
+
* @param topicIdOrInput - Optional topic ID, or compile input for query-first resolution.
|
|
3974
3979
|
* @param input - Optional compile parameters (query, budget, ranking, etc.).
|
|
3975
3980
|
* @returns The compiled context payload with beliefs, questions, and evidence.
|
|
3976
3981
|
*/
|
|
3977
|
-
async compile(
|
|
3978
|
-
const request = buildCompileContextRequest(
|
|
3982
|
+
async compile(topicIdOrInput = {}, input = {}) {
|
|
3983
|
+
const request = buildCompileContextRequest(topicIdOrInput, input);
|
|
3984
|
+
return gateway.request({
|
|
3985
|
+
...request,
|
|
3986
|
+
body: request.body
|
|
3987
|
+
});
|
|
3988
|
+
},
|
|
3989
|
+
async compileByQuery(input = {}) {
|
|
3990
|
+
const request = buildCompileContextRequest(input);
|
|
3979
3991
|
return gateway.request({
|
|
3980
3992
|
...request,
|
|
3981
3993
|
body: request.body
|
|
@@ -6250,6 +6262,21 @@ function createSchemaClient(config = {}) {
|
|
|
6250
6262
|
}
|
|
6251
6263
|
|
|
6252
6264
|
// src/clientHelpers.ts
|
|
6265
|
+
function normalizeCustomNamespace(namespace) {
|
|
6266
|
+
return namespace.trim() || "custom";
|
|
6267
|
+
}
|
|
6268
|
+
function normalizeCustomToolPayload(input) {
|
|
6269
|
+
return input && typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
6270
|
+
}
|
|
6271
|
+
function resolveCustomToolFullName(name) {
|
|
6272
|
+
return name.includes(".") ? name : `custom.${name}`;
|
|
6273
|
+
}
|
|
6274
|
+
function buildBeliefsRefinePayload(textOrInput, rationale) {
|
|
6275
|
+
return typeof textOrInput === "string" ? { text: textOrInput, rationale } : { text: textOrInput.text, rationale: textOrInput.rationale };
|
|
6276
|
+
}
|
|
6277
|
+
function buildBeliefsArchivePayload(input) {
|
|
6278
|
+
return typeof input === "string" ? { reason: input } : input ? { reason: input.reason ?? input.rationale } : void 0;
|
|
6279
|
+
}
|
|
6253
6280
|
function asNodeArray(data) {
|
|
6254
6281
|
const rows = asListItems(data, "nodes");
|
|
6255
6282
|
if (rows.length > 0) {
|
|
@@ -6627,7 +6654,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
6627
6654
|
}
|
|
6628
6655
|
|
|
6629
6656
|
// src/version.ts
|
|
6630
|
-
var LUCERN_SDK_VERSION = "0.3.0-alpha.
|
|
6657
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.9";
|
|
6631
6658
|
|
|
6632
6659
|
// src/workflowClient.ts
|
|
6633
6660
|
function normalizeLensQuery(value) {
|
|
@@ -7148,11 +7175,11 @@ function createLucernClient(config = {}) {
|
|
|
7148
7175
|
}
|
|
7149
7176
|
}
|
|
7150
7177
|
const invokeCustomTool = async (fullName, input = {}) => {
|
|
7151
|
-
const payload =
|
|
7178
|
+
const payload = normalizeCustomToolPayload(input);
|
|
7152
7179
|
return invokeRegisteredCustomTool(fullName, payload, { source: "sdk" });
|
|
7153
7180
|
};
|
|
7154
7181
|
const getCustomNamespace = (namespace) => {
|
|
7155
|
-
const normalized = namespace
|
|
7182
|
+
const normalized = normalizeCustomNamespace(namespace);
|
|
7156
7183
|
const cached = customNamespaceCache.get(normalized);
|
|
7157
7184
|
if (cached) {
|
|
7158
7185
|
return cached;
|
|
@@ -7612,10 +7639,7 @@ function createLucernClient(config = {}) {
|
|
|
7612
7639
|
return beliefsFacade.get(nodeId).then(exposeGatewayData);
|
|
7613
7640
|
},
|
|
7614
7641
|
refine(nodeId, textOrInput, rationale) {
|
|
7615
|
-
const payload =
|
|
7616
|
-
text: textOrInput.text,
|
|
7617
|
-
rationale: textOrInput.rationale
|
|
7618
|
-
};
|
|
7642
|
+
const payload = buildBeliefsRefinePayload(textOrInput, rationale);
|
|
7619
7643
|
return beliefsFacade.refine(nodeId, payload).then(exposeGatewayData);
|
|
7620
7644
|
},
|
|
7621
7645
|
updateConfidence(nodeId, input) {
|
|
@@ -7653,7 +7677,7 @@ function createLucernClient(config = {}) {
|
|
|
7653
7677
|
}).then(exposeGatewayData);
|
|
7654
7678
|
},
|
|
7655
7679
|
archive(nodeId, input) {
|
|
7656
|
-
const payload =
|
|
7680
|
+
const payload = buildBeliefsArchivePayload(input);
|
|
7657
7681
|
return beliefsFacade.archive(nodeId, payload).then(exposeGatewayData);
|
|
7658
7682
|
},
|
|
7659
7683
|
list(args) {
|
|
@@ -8693,7 +8717,7 @@ function createLucernClient(config = {}) {
|
|
|
8693
8717
|
list: listRegisteredCustomTools,
|
|
8694
8718
|
clear: clearRegisteredCustomTools,
|
|
8695
8719
|
invoke(name, input = {}) {
|
|
8696
|
-
const fullName = name
|
|
8720
|
+
const fullName = resolveCustomToolFullName(name);
|
|
8697
8721
|
return invokeCustomTool(fullName, input);
|
|
8698
8722
|
},
|
|
8699
8723
|
namespace: getCustomNamespace
|