@lucern/sdk 0.3.0-alpha.7 → 0.3.0-alpha.8
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.js +31 -19
- package/dist/beliefs/index.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +31 -19
- package/dist/client.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.js +31 -19
- package/dist/contradictions/index.js.map +1 -1
- package/dist/decisions/index.js +31 -19
- package/dist/decisions/index.js.map +1 -1
- package/dist/edges/index.js +31 -19
- package/dist/edges/index.js.map +1 -1
- package/dist/evidence/index.js +31 -19
- 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.js +56 -35
- package/dist/index.js.map +1 -1
- package/dist/lenses/index.js +31 -19
- package/dist/lenses/index.js.map +1 -1
- package/dist/nodes/index.js +31 -19
- package/dist/nodes/index.js.map +1 -1
- package/dist/ontologies/index.js +31 -19
- package/dist/ontologies/index.js.map +1 -1
- package/dist/questions/index.js +31 -19
- package/dist/questions/index.js.map +1 -1
- package/dist/topics/index.js +31 -19
- 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.js +31 -19
- package/dist/worktrees/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -326,7 +326,7 @@ await lucern.graph.createEdge({
|
|
|
326
326
|
Before your agent starts its next session, it reads the graph:
|
|
327
327
|
|
|
328
328
|
```typescript
|
|
329
|
-
const context = await lucern.context.compile(
|
|
329
|
+
const context = await lucern.context.compile({
|
|
330
330
|
query: "code review strategy and static analysis coverage",
|
|
331
331
|
ranking: "weighted_v1",
|
|
332
332
|
tokenBudget: 2000,
|
|
@@ -492,7 +492,7 @@ traversal.data.nodes.forEach(node => {
|
|
|
492
492
|
### Inject Reasoning Context Into Any LLM Call
|
|
493
493
|
|
|
494
494
|
```typescript
|
|
495
|
-
const context = await lucern.context.compile(
|
|
495
|
+
const context = await lucern.context.compile({
|
|
496
496
|
query: "security review priorities",
|
|
497
497
|
ranking: "weighted_v1",
|
|
498
498
|
tokenBudget: 3000,
|
|
@@ -603,7 +603,7 @@ architectural decisions, check the reasoning graph:
|
|
|
603
603
|
|
|
604
604
|
- Read current beliefs: `lucern.beliefs.list({ topicId: "..." })`
|
|
605
605
|
- Check for contradictions: `lucern.contradictions.list({ topicId: "..." })`
|
|
606
|
-
- Compile context before analysis: `lucern.context.compile(
|
|
606
|
+
- Compile context before analysis: `lucern.context.compile({ query: "..." })`
|
|
607
607
|
|
|
608
608
|
After making decisions, write them back:
|
|
609
609
|
- Create beliefs for architectural decisions
|
|
@@ -634,7 +634,7 @@ contradictions, or knowledge state.
|
|
|
634
634
|
Compile the current context to understand what the graph knows:
|
|
635
635
|
|
|
636
636
|
\`\`\`typescript
|
|
637
|
-
const context = await lucern.context.compile(
|
|
637
|
+
const context = await lucern.context.compile({
|
|
638
638
|
query: "<what you're working on>",
|
|
639
639
|
tokenBudget: 2000,
|
|
640
640
|
});
|
package/dist/beliefs/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
|
|
@@ -6627,7 +6639,7 @@ function createToolRegistryClient(config = {}) {
|
|
|
6627
6639
|
}
|
|
6628
6640
|
|
|
6629
6641
|
// src/version.ts
|
|
6630
|
-
var LUCERN_SDK_VERSION = "0.3.0-alpha.
|
|
6642
|
+
var LUCERN_SDK_VERSION = "0.3.0-alpha.8";
|
|
6631
6643
|
|
|
6632
6644
|
// src/workflowClient.ts
|
|
6633
6645
|
function normalizeLensQuery(value) {
|