@lucern/contracts 1.0.38 → 1.0.39
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/CHANGELOG.md +3 -0
- package/dist/function-registry/embeddings.js +6293 -0
- package/dist/function-registry/hybrid.js +6297 -0
- package/dist/function-registry/index.js +9 -253
- package/dist/function-registry/policy.js +6220 -0
- package/dist/proof-attestation.json +1 -1
- package/dist/types/evidence-taxonomy-target-scope.js +70 -0
- package/dist/types/graph-ref.js +173 -0
- package/dist/types/reasoning-method.js +15 -0
- package/dist/types/traversal-mode-constitution.js +96 -0
- package/package.json +1 -1
|
@@ -10,12 +10,16 @@ import { coordinationContracts } from './coordination.js';
|
|
|
10
10
|
export { coordinationContracts } from './coordination.js';
|
|
11
11
|
import { edgesContracts } from './edges.js';
|
|
12
12
|
export { edgesContracts } from './edges.js';
|
|
13
|
-
import {
|
|
14
|
-
|
|
13
|
+
import { embeddingsContracts } from './embeddings.js';
|
|
14
|
+
export { embeddingsContracts } from './embeddings.js';
|
|
15
15
|
import { evidenceContracts } from './evidence.js';
|
|
16
16
|
export { evidenceContracts } from './evidence.js';
|
|
17
17
|
import { graphContracts } from './graph.js';
|
|
18
18
|
export { graphContracts } from './graph.js';
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
import 'convex/values';
|
|
21
|
+
import { hybridContracts } from './hybrid.js';
|
|
22
|
+
export { hybridContracts } from './hybrid.js';
|
|
19
23
|
import { identityContracts } from './identity.js';
|
|
20
24
|
export { identityContracts } from './identity.js';
|
|
21
25
|
import { judgmentsContracts } from './judgments.js';
|
|
@@ -30,6 +34,8 @@ import { ontologiesContracts } from './ontologies.js';
|
|
|
30
34
|
export { ontologiesContracts } from './ontologies.js';
|
|
31
35
|
import { pipelineContracts } from './pipeline.js';
|
|
32
36
|
export { pipelineContracts } from './pipeline.js';
|
|
37
|
+
import { policyContracts } from './policy.js';
|
|
38
|
+
export { policyContracts } from './policy.js';
|
|
33
39
|
import { questionsContracts } from './questions.js';
|
|
34
40
|
export { questionsContracts } from './questions.js';
|
|
35
41
|
import { tasksContracts } from './tasks.js';
|
|
@@ -6339,256 +6345,6 @@ function assertSurfaceCoverage(contracts) {
|
|
|
6339
6345
|
}
|
|
6340
6346
|
}
|
|
6341
6347
|
}
|
|
6342
|
-
|
|
6343
|
-
// src/function-registry/embeddings.ts
|
|
6344
|
-
var nodeType = z.string().optional().describe("Optional epistemic node type filter.");
|
|
6345
|
-
var embeddingScopeArgs = z.object({
|
|
6346
|
-
topicId: uuidV7StringSchema.describe(
|
|
6347
|
-
"Topic scope for the embedding operation."
|
|
6348
|
-
),
|
|
6349
|
-
workspaceId: z.string().optional().describe("Workspace scope for the embedding operation."),
|
|
6350
|
-
nodeType,
|
|
6351
|
-
embeddingModel: z.string().optional().describe("Optional embedding model filter."),
|
|
6352
|
-
includeInactive: z.boolean().optional().describe(
|
|
6353
|
-
"Include archived, superseded, or otherwise inactive epistemic nodes in coverage checks."
|
|
6354
|
-
),
|
|
6355
|
-
limit: z.number().optional().describe("Maximum rows to return."),
|
|
6356
|
-
cursor: z.string().optional().describe("Pagination cursor.")
|
|
6357
|
-
});
|
|
6358
|
-
var searchEmbeddingsArgs = embeddingScopeArgs.extend({
|
|
6359
|
-
queryText: z.string().optional().describe("Natural-language query to embed and search with."),
|
|
6360
|
-
queryVector: z.array(z.number()).optional().describe("Optional precomputed query vector."),
|
|
6361
|
-
minScore: z.number().optional().describe("Minimum vector score.")
|
|
6362
|
-
});
|
|
6363
|
-
var getEmbeddingsArgs = embeddingScopeArgs.extend({
|
|
6364
|
-
nodeIds: z.array(uuidV7StringSchema).describe("Epistemic node IDs to inspect.")
|
|
6365
|
-
});
|
|
6366
|
-
var queueEmbeddingBackfillArgs = getEmbeddingsArgs.extend({
|
|
6367
|
-
metadata: z.record(z.unknown()).optional().describe("Backfill scheduling metadata.")
|
|
6368
|
-
});
|
|
6369
|
-
var passthroughInput = (input) => compactRecord(input);
|
|
6370
|
-
var embeddingsContracts = [
|
|
6371
|
-
surfaceContract({
|
|
6372
|
-
name: "list_missing_embeddings",
|
|
6373
|
-
kind: "query",
|
|
6374
|
-
domain: "embeddings",
|
|
6375
|
-
surfaceClass: "platform_public",
|
|
6376
|
-
method: "GET",
|
|
6377
|
-
path: "/embeddings/missing",
|
|
6378
|
-
sdkNamespace: "embeddings",
|
|
6379
|
-
sdkMethod: "listMissingForTopic",
|
|
6380
|
-
summary: "List epistemic nodes missing fresh Convex embeddings.",
|
|
6381
|
-
convex: {
|
|
6382
|
-
module: "embeddings",
|
|
6383
|
-
functionName: "listMissingForTopic",
|
|
6384
|
-
kind: "query",
|
|
6385
|
-
componentPath: "lucern",
|
|
6386
|
-
inputProjection: passthroughInput
|
|
6387
|
-
},
|
|
6388
|
-
args: embeddingScopeArgs
|
|
6389
|
-
}),
|
|
6390
|
-
surfaceContract({
|
|
6391
|
-
name: "search_embeddings",
|
|
6392
|
-
kind: "action",
|
|
6393
|
-
domain: "embeddings",
|
|
6394
|
-
surfaceClass: "platform_public",
|
|
6395
|
-
path: "/embeddings/vector-search",
|
|
6396
|
-
sdkNamespace: "embeddings",
|
|
6397
|
-
sdkMethod: "vectorSearchByTopic",
|
|
6398
|
-
summary: "Search topic-scoped epistemic nodes through the Convex vector index.",
|
|
6399
|
-
idempotent: false,
|
|
6400
|
-
effects: ["read"],
|
|
6401
|
-
scopes: ["embeddings.read"],
|
|
6402
|
-
convex: {
|
|
6403
|
-
module: "embeddings",
|
|
6404
|
-
functionName: "vectorSearchByTopic",
|
|
6405
|
-
kind: "action",
|
|
6406
|
-
componentPath: "lucern",
|
|
6407
|
-
inputProjection: passthroughInput
|
|
6408
|
-
},
|
|
6409
|
-
args: searchEmbeddingsArgs
|
|
6410
|
-
}),
|
|
6411
|
-
surfaceContract({
|
|
6412
|
-
name: "get_embeddings_by_node_ids",
|
|
6413
|
-
kind: "query",
|
|
6414
|
-
domain: "embeddings",
|
|
6415
|
-
surfaceClass: "platform_public",
|
|
6416
|
-
path: "/embeddings/by-node-ids",
|
|
6417
|
-
sdkNamespace: "embeddings",
|
|
6418
|
-
sdkMethod: "getByNodeIds",
|
|
6419
|
-
summary: "Fetch embedding records for explicit epistemic node IDs.",
|
|
6420
|
-
convex: {
|
|
6421
|
-
module: "embeddings",
|
|
6422
|
-
functionName: "getByNodeIds",
|
|
6423
|
-
kind: "query",
|
|
6424
|
-
componentPath: "lucern",
|
|
6425
|
-
inputProjection: passthroughInput
|
|
6426
|
-
},
|
|
6427
|
-
args: getEmbeddingsArgs
|
|
6428
|
-
}),
|
|
6429
|
-
surfaceContract({
|
|
6430
|
-
name: "queue_embedding_backfill",
|
|
6431
|
-
kind: "mutation",
|
|
6432
|
-
domain: "embeddings",
|
|
6433
|
-
surfaceClass: "platform_public",
|
|
6434
|
-
path: "/embeddings/backfill-queued",
|
|
6435
|
-
sdkNamespace: "embeddings",
|
|
6436
|
-
sdkMethod: "markEmbeddingBackfillQueued",
|
|
6437
|
-
summary: "Queue background embedding generation for explicit epistemic nodes.",
|
|
6438
|
-
convex: {
|
|
6439
|
-
module: "embeddings",
|
|
6440
|
-
functionName: "markEmbeddingBackfillQueued",
|
|
6441
|
-
kind: "mutation",
|
|
6442
|
-
componentPath: "lucern",
|
|
6443
|
-
inputProjection: passthroughInput
|
|
6444
|
-
},
|
|
6445
|
-
args: queueEmbeddingBackfillArgs
|
|
6446
|
-
})
|
|
6447
|
-
];
|
|
6448
|
-
var includeKindSchema = z.enum([
|
|
6449
|
-
"topics",
|
|
6450
|
-
"nodes",
|
|
6451
|
-
"worktrees",
|
|
6452
|
-
"tasks",
|
|
6453
|
-
"evidence",
|
|
6454
|
-
"edges"
|
|
6455
|
-
]);
|
|
6456
|
-
var viaKindSchema = z.enum([
|
|
6457
|
-
"bm25",
|
|
6458
|
-
"embeddings",
|
|
6459
|
-
"edges",
|
|
6460
|
-
"topic-tree",
|
|
6461
|
-
"state",
|
|
6462
|
-
"graph-algorithms"
|
|
6463
|
-
]);
|
|
6464
|
-
var hybridPlannerArgs = z.object({
|
|
6465
|
-
query: z.string().optional().describe("Natural-language query text."),
|
|
6466
|
-
queryText: z.string().optional().describe("Explicit query text alias."),
|
|
6467
|
-
text: z.string().optional().describe("Raw pasted text to use as query input."),
|
|
6468
|
-
topicId: uuidV7StringSchema.optional().describe("Optional topic scope."),
|
|
6469
|
-
workspaceId: z.string().optional().describe("Optional workspace scope."),
|
|
6470
|
-
nodeId: uuidV7StringSchema.optional().describe("Optional source node."),
|
|
6471
|
-
include: z.array(includeKindSchema).optional().describe("Result families to include."),
|
|
6472
|
-
via: z.array(viaKindSchema).optional().describe("Retrieval methods to use."),
|
|
6473
|
-
depth: z.number().optional().describe("Graph expansion depth."),
|
|
6474
|
-
limit: z.number().optional().describe("Maximum rows per result family."),
|
|
6475
|
-
minScore: z.number().optional().describe("Minimum fused score."),
|
|
6476
|
-
campaign: z.number().optional().describe("Optional worktree campaign filter."),
|
|
6477
|
-
lane: z.string().optional().describe("Optional worktree lane filter."),
|
|
6478
|
-
status: z.string().optional().describe("Optional state/status filter."),
|
|
6479
|
-
nodeType: z.string().optional().describe("Single node type filter."),
|
|
6480
|
-
nodeTypes: z.array(z.string()).optional().describe("Node type filters."),
|
|
6481
|
-
changedPaths: z.array(z.string()).optional().describe("Changed file path signals."),
|
|
6482
|
-
metadata: z.record(z.unknown()).optional().describe("Planner metadata.")
|
|
6483
|
-
});
|
|
6484
|
-
var modeInput = (mode) => (input) => compactRecord({
|
|
6485
|
-
...input,
|
|
6486
|
-
mode,
|
|
6487
|
-
queryText: input.queryText ?? input.query ?? input.text
|
|
6488
|
-
});
|
|
6489
|
-
function hybridContract(args) {
|
|
6490
|
-
return surfaceContract({
|
|
6491
|
-
name: args.name,
|
|
6492
|
-
kind: "action",
|
|
6493
|
-
domain: "hybrid",
|
|
6494
|
-
surfaceClass: "platform_public",
|
|
6495
|
-
path: args.path,
|
|
6496
|
-
sdkNamespace: "hybrid",
|
|
6497
|
-
sdkMethod: args.sdkMethod,
|
|
6498
|
-
summary: args.summary,
|
|
6499
|
-
idempotent: false,
|
|
6500
|
-
effects: ["read"],
|
|
6501
|
-
scopes: ["hybrid.read"],
|
|
6502
|
-
convex: {
|
|
6503
|
-
module: "hybridDiscovery",
|
|
6504
|
-
functionName: args.sdkMethod,
|
|
6505
|
-
kind: "action",
|
|
6506
|
-
componentPath: "lucern",
|
|
6507
|
-
inputProjection: modeInput(args.mode)
|
|
6508
|
-
},
|
|
6509
|
-
args: hybridPlannerArgs
|
|
6510
|
-
});
|
|
6511
|
-
}
|
|
6512
|
-
var hybridContracts = [
|
|
6513
|
-
hybridContract({
|
|
6514
|
-
name: "hybrid_discover",
|
|
6515
|
-
path: "/hybrid/discover",
|
|
6516
|
-
sdkMethod: "hybridDiscover",
|
|
6517
|
-
summary: "Discover typed graph context with BM25, embeddings, topic tree traversal, and graph neighborhoods.",
|
|
6518
|
-
mode: "discover"
|
|
6519
|
-
}),
|
|
6520
|
-
hybridContract({
|
|
6521
|
-
name: "resolve_topic_semantic",
|
|
6522
|
-
path: "/hybrid/topics/resolve",
|
|
6523
|
-
sdkMethod: "resolveTopicSemantic",
|
|
6524
|
-
summary: "Resolve an ambiguous topic using BM25, vector candidates, and topic-tree context.",
|
|
6525
|
-
mode: "resolve_topic"
|
|
6526
|
-
}),
|
|
6527
|
-
hybridContract({
|
|
6528
|
-
name: "expand_graph_neighborhood",
|
|
6529
|
-
path: "/hybrid/neighborhood",
|
|
6530
|
-
sdkMethod: "expandGraphNeighborhood",
|
|
6531
|
-
summary: "Expand a typed graph neighborhood around a query, topic, or node.",
|
|
6532
|
-
mode: "neighborhood"
|
|
6533
|
-
}),
|
|
6534
|
-
hybridContract({
|
|
6535
|
-
name: "find_related_nodes",
|
|
6536
|
-
path: "/hybrid/related-nodes",
|
|
6537
|
-
sdkMethod: "findRelatedNodes",
|
|
6538
|
-
summary: "Find semantically and structurally related nodes across the reasoning graph.",
|
|
6539
|
-
mode: "related_nodes"
|
|
6540
|
-
}),
|
|
6541
|
-
hybridContract({
|
|
6542
|
-
name: "analyze_graph_impact",
|
|
6543
|
-
path: "/hybrid/impact",
|
|
6544
|
-
sdkMethod: "analyzeGraphImpact",
|
|
6545
|
-
summary: "Analyze which graph objects are affected by files, PR text, incidents, or campaign objectives.",
|
|
6546
|
-
mode: "impact"
|
|
6547
|
-
}),
|
|
6548
|
-
hybridContract({
|
|
6549
|
-
name: "detect_graph_drift",
|
|
6550
|
-
path: "/hybrid/drift",
|
|
6551
|
-
sdkMethod: "detectGraphDrift",
|
|
6552
|
-
summary: "Detect duplicate, stale, orphaned, or weakly linked reasoning graph surface.",
|
|
6553
|
-
mode: "drift"
|
|
6554
|
-
})
|
|
6555
|
-
];
|
|
6556
|
-
var graphPolicyFactsSchema = z.object({
|
|
6557
|
-
principal: z.record(z.unknown()).optional(),
|
|
6558
|
-
resource: z.record(z.unknown()),
|
|
6559
|
-
request: z.record(z.unknown())
|
|
6560
|
-
}).strict();
|
|
6561
|
-
var permitDecisionSchema = z.record(z.unknown());
|
|
6562
|
-
var policyContracts = [
|
|
6563
|
-
surfaceContract({
|
|
6564
|
-
name: "compile_capability_slice",
|
|
6565
|
-
kind: "query",
|
|
6566
|
-
domain: "policy",
|
|
6567
|
-
surfaceClass: "platform_public",
|
|
6568
|
-
path: "/policy/capability-slice",
|
|
6569
|
-
sdkNamespace: "policy",
|
|
6570
|
-
sdkMethod: "compileCapabilitySlice",
|
|
6571
|
-
summary: "Compile a Permit-filtered graph context package with public-safe omission records.",
|
|
6572
|
-
gateway: {
|
|
6573
|
-
handler: "policy.compileCapabilitySlice"
|
|
6574
|
-
},
|
|
6575
|
-
args: z.object({
|
|
6576
|
-
sliceUuid: z.string().min(1).optional(),
|
|
6577
|
-
context: z.string().min(1).optional(),
|
|
6578
|
-
surface: z.string().min(1).optional(),
|
|
6579
|
-
baseFacts: graphPolicyFactsSchema,
|
|
6580
|
-
nodes: z.array(z.record(z.unknown())),
|
|
6581
|
-
edges: z.array(z.record(z.unknown())).optional(),
|
|
6582
|
-
fallbackPermitDecision: permitDecisionSchema.optional(),
|
|
6583
|
-
permitDecision: permitDecisionSchema.optional(),
|
|
6584
|
-
permitDecisionsByResourceId: z.record(permitDecisionSchema).optional(),
|
|
6585
|
-
policyDecisionId: z.string().min(1).optional(),
|
|
6586
|
-
decisionLogId: z.string().min(1).optional(),
|
|
6587
|
-
traceId: z.string().min(1).optional(),
|
|
6588
|
-
decisionProof: z.string().min(1).optional()
|
|
6589
|
-
}).strict()
|
|
6590
|
-
})
|
|
6591
|
-
];
|
|
6592
6348
|
var ALL_FUNCTION_CONTRACTS = [
|
|
6593
6349
|
...contextContracts,
|
|
6594
6350
|
...identityContracts,
|
|
@@ -6624,4 +6380,4 @@ var getFunctionContract = FUNCTION_CONTRACTS_BY_NAME.get.bind(
|
|
|
6624
6380
|
FUNCTION_CONTRACTS_BY_NAME
|
|
6625
6381
|
);
|
|
6626
6382
|
|
|
6627
|
-
export { ALL_FUNCTION_CONTRACTS, DUPLICATE_OPERATION_NAMES, FORBIDDEN_APPLICATION_OPERATION_NAMES, FUNCTION_CONTRACTS_BY_NAME, FUNCTION_SURFACE_CONTRACTS, LEGACY_COMPAT_OPERATION_NAMES, LUCERN_OPERATION_MANIFEST, MCP_ANALYSIS_PLATFORM_OPERATION_NAMES, MCP_ANALYSIS_TENANT_OPERATION_NAMES, MCP_AUTOMATION_OPERATION_NAMES, MCP_CORE_OPERATION_NAMES, MCP_GOVERNANCE_PLATFORM_OPERATION_NAMES, MCP_GOVERNANCE_TENANT_OPERATION_NAMES, MCP_ONLY_INTERNAL_OPERATION_NAMES, MCP_WORKFLOW_PLATFORM_OPERATION_NAMES, MCP_WORKFLOW_TENANT_OPERATION_NAMES, NODE_TYPE, PLATFORM_INTERNAL_OPERATION_NAMES, PLATFORM_PUBLIC_OPERATION_NAMES, SDK_ONLY_OPERATION_NAMES, TENANT_PUBLIC_OPERATION_NAMES, TOPIC_TYPE_VALUES, WORKTREE_TYPE_VALUES, actingPrincipalId, argsSchemaFromMcpContract, assertSurfaceCoverage, authUserId, classifyContract, compactRecord, defineFunctionContract,
|
|
6383
|
+
export { ALL_FUNCTION_CONTRACTS, DUPLICATE_OPERATION_NAMES, FORBIDDEN_APPLICATION_OPERATION_NAMES, FUNCTION_CONTRACTS_BY_NAME, FUNCTION_SURFACE_CONTRACTS, LEGACY_COMPAT_OPERATION_NAMES, LUCERN_OPERATION_MANIFEST, MCP_ANALYSIS_PLATFORM_OPERATION_NAMES, MCP_ANALYSIS_TENANT_OPERATION_NAMES, MCP_AUTOMATION_OPERATION_NAMES, MCP_CORE_OPERATION_NAMES, MCP_GOVERNANCE_PLATFORM_OPERATION_NAMES, MCP_GOVERNANCE_TENANT_OPERATION_NAMES, MCP_ONLY_INTERNAL_OPERATION_NAMES, MCP_WORKFLOW_PLATFORM_OPERATION_NAMES, MCP_WORKFLOW_TENANT_OPERATION_NAMES, NODE_TYPE, PLATFORM_INTERNAL_OPERATION_NAMES, PLATFORM_PUBLIC_OPERATION_NAMES, SDK_ONLY_OPERATION_NAMES, TENANT_PUBLIC_OPERATION_NAMES, TOPIC_TYPE_VALUES, WORKTREE_TYPE_VALUES, actingPrincipalId, argsSchemaFromMcpContract, assertSurfaceCoverage, authUserId, classifyContract, compactRecord, defineFunctionContract, generateUuidV7, getFunctionContract, inputSchemaFromMcpContract, isUuidV7, jsonObjectSchema, recordValue, surfaceContract, surfaceEnabled, surfaceIntentGateViolations, surfaceMcpContract, uuidV7StringSchema, withCreatedBy, withCreatedByAndOwnerPrincipal, withUserId };
|