@lucern/contracts 1.0.10 → 1.0.12

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 (112) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/function-registry/beliefs.d.ts +1 -1
  3. package/dist/function-registry/beliefs.js +79 -0
  4. package/dist/function-registry/beliefs.js.map +1 -1
  5. package/dist/function-registry/coding.d.ts +1 -1
  6. package/dist/function-registry/coding.js +79 -0
  7. package/dist/function-registry/coding.js.map +1 -1
  8. package/dist/function-registry/context.d.ts +44 -4
  9. package/dist/function-registry/context.js +101 -0
  10. package/dist/function-registry/context.js.map +1 -1
  11. package/dist/function-registry/contracts.d.ts +1 -1
  12. package/dist/function-registry/contracts.js +79 -0
  13. package/dist/function-registry/contracts.js.map +1 -1
  14. package/dist/function-registry/coordination.d.ts +1 -1
  15. package/dist/function-registry/coordination.js +79 -0
  16. package/dist/function-registry/coordination.js.map +1 -1
  17. package/dist/function-registry/edges.d.ts +1 -1
  18. package/dist/function-registry/edges.js +79 -0
  19. package/dist/function-registry/edges.js.map +1 -1
  20. package/dist/function-registry/evidence.d.ts +1 -1
  21. package/dist/function-registry/evidence.js +144 -24
  22. package/dist/function-registry/evidence.js.map +1 -1
  23. package/dist/function-registry/graph.d.ts +1 -1
  24. package/dist/function-registry/graph.js +81 -4
  25. package/dist/function-registry/graph.js.map +1 -1
  26. package/dist/function-registry/helpers.js +79 -0
  27. package/dist/function-registry/helpers.js.map +1 -1
  28. package/dist/function-registry/identity.d.ts +1 -1
  29. package/dist/function-registry/identity.js +79 -0
  30. package/dist/function-registry/identity.js.map +1 -1
  31. package/dist/function-registry/index.js +79 -0
  32. package/dist/function-registry/index.js.map +1 -1
  33. package/dist/function-registry/judgments.d.ts +1 -1
  34. package/dist/function-registry/judgments.js +79 -0
  35. package/dist/function-registry/judgments.js.map +1 -1
  36. package/dist/function-registry/legacy.d.ts +1 -1
  37. package/dist/function-registry/legacy.js +79 -0
  38. package/dist/function-registry/legacy.js.map +1 -1
  39. package/dist/function-registry/lenses.d.ts +1 -1
  40. package/dist/function-registry/lenses.js +79 -0
  41. package/dist/function-registry/lenses.js.map +1 -1
  42. package/dist/function-registry/manifest.d.ts +2 -2
  43. package/dist/function-registry/manifest.js +1 -0
  44. package/dist/function-registry/manifest.js.map +1 -1
  45. package/dist/function-registry/nodes.d.ts +1 -1
  46. package/dist/function-registry/nodes.js +79 -0
  47. package/dist/function-registry/nodes.js.map +1 -1
  48. package/dist/function-registry/ontologies.d.ts +1 -1
  49. package/dist/function-registry/ontologies.js +79 -0
  50. package/dist/function-registry/ontologies.js.map +1 -1
  51. package/dist/function-registry/pipeline.d.ts +1 -1
  52. package/dist/function-registry/pipeline.js +79 -0
  53. package/dist/function-registry/pipeline.js.map +1 -1
  54. package/dist/function-registry/questions.d.ts +1 -1
  55. package/dist/function-registry/questions.js +79 -0
  56. package/dist/function-registry/questions.js.map +1 -1
  57. package/dist/function-registry/tasks.d.ts +1 -1
  58. package/dist/function-registry/tasks.js +79 -0
  59. package/dist/function-registry/tasks.js.map +1 -1
  60. package/dist/function-registry/topics.d.ts +1 -1
  61. package/dist/function-registry/topics.js +81 -4
  62. package/dist/function-registry/topics.js.map +1 -1
  63. package/dist/function-registry/types.d.ts +1 -1
  64. package/dist/function-registry/worktrees.d.ts +1 -1
  65. package/dist/function-registry/worktrees.js +79 -0
  66. package/dist/function-registry/worktrees.js.map +1 -1
  67. package/dist/generated/infisicalRuntimeEnv.js +536 -1
  68. package/dist/generated/infisicalRuntimeEnv.js.map +1 -1
  69. package/dist/index.d.ts +2 -1
  70. package/dist/index.js +831 -4
  71. package/dist/index.js.map +1 -1
  72. package/dist/infisical-runtime.base.d.ts +42 -1
  73. package/dist/infisical-runtime.base.js +50 -1
  74. package/dist/infisical-runtime.base.js.map +1 -1
  75. package/dist/infisical-runtime.contract.d.ts +102 -0
  76. package/dist/infisical-runtime.contract.js +170 -1
  77. package/dist/infisical-runtime.contract.js.map +1 -1
  78. package/dist/infisical-runtime.platform-secrets.d.ts +102 -0
  79. package/dist/infisical-runtime.platform-secrets.js +120 -0
  80. package/dist/infisical-runtime.platform-secrets.js.map +1 -1
  81. package/dist/infisical-runtime.tenant-secrets.js.map +1 -1
  82. package/dist/manifests/infisical-runtime-manifest.d.ts +144 -1
  83. package/dist/manifests/infisical-runtime-manifest.js +170 -1
  84. package/dist/manifests/infisical-runtime-manifest.js.map +1 -1
  85. package/dist/projections/check-convex-args-shape.js +60 -2
  86. package/dist/projections/check-convex-args-shape.js.map +1 -1
  87. package/dist/projections/create-evidence.projection.js +60 -2
  88. package/dist/projections/create-evidence.projection.js.map +1 -1
  89. package/dist/projections/index.js +60 -2
  90. package/dist/projections/index.js.map +1 -1
  91. package/dist/proof-attestation.json +1 -1
  92. package/dist/schemas/manifest.d.ts +20 -20
  93. package/dist/schemas/tables/kernel/platform.d.ts +4 -4
  94. package/dist/sdk-tools.contract.js +78 -0
  95. package/dist/sdk-tools.contract.js.map +1 -1
  96. package/dist/sdk-tools.contract.registry.js +78 -0
  97. package/dist/sdk-tools.contract.registry.js.map +1 -1
  98. package/dist/sdk-tools.contract.values.js +78 -0
  99. package/dist/sdk-tools.contract.values.js.map +1 -1
  100. package/dist/tool-contracts.context-orientation.d.ts +5 -0
  101. package/dist/tool-contracts.context-orientation.js +56 -0
  102. package/dist/tool-contracts.context-orientation.js.map +1 -0
  103. package/dist/tool-contracts.d.ts +1 -0
  104. package/dist/tool-contracts.js +79 -1
  105. package/dist/tool-contracts.js.map +1 -1
  106. package/dist/tool-contracts.questions-listing.js +24 -0
  107. package/dist/tool-contracts.questions-listing.js.map +1 -1
  108. package/dist/{tool-contracts.values-DjctSW7S.d.ts → tool-contracts.values-BhxfrXS5.d.ts} +3 -1
  109. package/dist/tool-contracts.values.d.ts +1 -0
  110. package/dist/tool-contracts.values.js +79 -1
  111. package/dist/tool-contracts.values.js.map +1 -1
  112. package/package.json +1 -1
@@ -69,7 +69,7 @@ type FunctionConvexTarget = {
69
69
  outputProjection?: ContractOutputProjection;
70
70
  };
71
71
  type FunctionGatewayTarget = {
72
- handler: "identity.whoami" | "beliefs.list" | "evidence.list" | "questions.list" | "worktrees.get" | "tasks.create" | "tasks.list" | "tasks.update" | "tasks.complete";
72
+ handler: "identity.whoami" | "beliefs.list" | "evidence.get" | "evidence.list" | "evidence.search" | "questions.list" | "worktrees.get" | "tasks.create" | "tasks.list" | "tasks.update" | "tasks.complete" | "context.lucernOrient" | "graph.listIntelligenceQueries" | "topics.graphSpine";
73
73
  };
74
74
 
75
75
  declare const evidenceContracts: readonly [{
@@ -1659,6 +1659,59 @@ var REMOVE_LENS_FROM_TOPIC = {
1659
1659
  tier: "workhorse"
1660
1660
  };
1661
1661
 
1662
+ // src/tool-contracts.context-orientation.ts
1663
+ var LUCERN_ORIENT = {
1664
+ name: "lucern_orient",
1665
+ description: "Load the Lucern reasoning grammar before operating. Like `git help` plus a repository CONTRIBUTING guide for reasoning state - teaches the git-shaped model of topics, campaigns, lanes, worktrees, beliefs, questions, evidence, receipts, gates, and merges.",
1666
+ parameters: {
1667
+ audience: {
1668
+ type: "string",
1669
+ description: "Audience for the primer: agent, human, operator, or developer.",
1670
+ enum: ["agent", "human", "operator", "developer"]
1671
+ },
1672
+ depth: {
1673
+ type: "string",
1674
+ description: "Orientation depth: quick, standard, or deep.",
1675
+ enum: ["quick", "standard", "deep"]
1676
+ },
1677
+ situation: {
1678
+ type: "string",
1679
+ description: "Optional task or query context used to tailor suggested next calls."
1680
+ },
1681
+ includeExamples: {
1682
+ type: "boolean",
1683
+ description: "Whether to include concrete tool-call examples."
1684
+ },
1685
+ includeToolMap: {
1686
+ type: "boolean",
1687
+ description: "Whether to include situation-to-tool routing guidance."
1688
+ },
1689
+ includeFuture: {
1690
+ type: "boolean",
1691
+ description: "Whether to include future exemplar, gauntlet, and training-data capabilities."
1692
+ }
1693
+ },
1694
+ required: [],
1695
+ response: {
1696
+ description: "Canonical operator primer for Lucern's git-shaped reasoning substrate.",
1697
+ fields: {
1698
+ schemaVersion: "string - lucern_orientation.v1",
1699
+ canonicalMentalModel: "object - concise model of Lucern as git-shaped reasoning state",
1700
+ workflow: "array - recommended branch -> investigate -> prove gate -> merge workflow",
1701
+ grammarMap: "array - primitive-to-git-analogy map for topics, campaigns, worktrees, beliefs, questions, evidence, edges, contradictions, and gates",
1702
+ firstMoves: "array - recommended first tools for a cold-start agent",
1703
+ receiptRules: "array - how to interpret candidateCounts, broadening, coverageWarning, and noDefaultGlobalScan",
1704
+ safetyRules: "array - mutation and completion rules that preserve reasoning lineage",
1705
+ toolMap: "array | undefined - situation-to-tool routing map when requested",
1706
+ examples: "array | undefined - concrete tool-call examples when requested",
1707
+ suggestedNextCalls: "array - safe next tool calls for the current situation"
1708
+ }
1709
+ },
1710
+ ownerModule: "reasoning-kernel",
1711
+ ontologyPrimitive: "graph",
1712
+ tier: "showcase"
1713
+ };
1714
+
1662
1715
  // src/tool-contracts.intelligence-evidence.ts
1663
1716
  var DETECT_CONFIRMATION_BIAS = {
1664
1717
  name: "detect_confirmation_bias",
@@ -2709,10 +2762,34 @@ var COMPILE_CONTEXT = {
2709
2762
  type: "string",
2710
2763
  description: "Optional source kind used as a resolver signal, such as cli, worktree, commit, or docs."
2711
2764
  },
2765
+ campaign: {
2766
+ type: "number",
2767
+ description: "Optional campaign dimension seed. When supplied without topicId, the compiler fans out across all carrier topics for that campaign instead of resolving a single topic."
2768
+ },
2769
+ lane: {
2770
+ type: "string",
2771
+ description: "Optional lane dimension seed. When supplied without topicId, the compiler reads all matching worktrees and their carrier topics."
2772
+ },
2773
+ status: {
2774
+ type: "string",
2775
+ description: "Optional state/status dimension seed for worktrees and graph rows."
2776
+ },
2777
+ principalId: {
2778
+ type: "string",
2779
+ description: "Optional principal seed for work authored, touched, or owned by a human, agent, group, or service principal."
2780
+ },
2781
+ workspaceId: {
2782
+ type: "string",
2783
+ description: "Optional workspace seed used by hosted MCP and SDK clients when compiling tenant-scoped context."
2784
+ },
2712
2785
  budget: {
2713
2786
  type: "number",
2714
2787
  description: "Token budget for prompt injection planning"
2715
2788
  },
2789
+ tokenBudget: {
2790
+ type: "number",
2791
+ description: "Compatibility alias for budget. External MCP clients may send tokenBudget when requesting prompt injection planning."
2792
+ },
2716
2793
  ranking: {
2717
2794
  type: "string",
2718
2795
  description: "Ranking profile for context ordering",
@@ -4619,6 +4696,7 @@ var MCP_TOOL_CONTRACTS = {
4619
4696
  update_worktree_metadata: UPDATE_WORKTREE_METADATA,
4620
4697
  identity_whoami: IDENTITY_WHOAMI,
4621
4698
  resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
4699
+ lucern_orient: LUCERN_ORIENT,
4622
4700
  compile_context: COMPILE_CONTEXT,
4623
4701
  record_scope_learning: RECORD_SCOPE_LEARNING,
4624
4702
  pipeline_snapshot: PIPELINE_SNAPSHOT,
@@ -4734,6 +4812,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
4734
4812
  );
4735
4813
  }
4736
4814
  var MCP_CORE_OPERATION_NAMES = [
4815
+ "lucern_orient",
4737
4816
  "compile_context",
4738
4817
  "identity_whoami",
4739
4818
  "resolve_interactive_principal",
@@ -5329,6 +5408,20 @@ function surfaceContract(args) {
5329
5408
  });
5330
5409
  }
5331
5410
 
5411
+ // src/ids.contract.ts
5412
+ var PREFIXED_ID_PATTERN = /^([a-z][a-z0-9]*)_(.+)$/;
5413
+ function decodePrefixedId(id) {
5414
+ const normalized = id.trim();
5415
+ const match = PREFIXED_ID_PATTERN.exec(normalized);
5416
+ if (!match) {
5417
+ throw new Error(`Invalid prefixed ID: ${id}`);
5418
+ }
5419
+ return {
5420
+ prefix: match[1],
5421
+ value: match[2]
5422
+ };
5423
+ }
5424
+
5332
5425
  // src/projections/projection-dsl.ts
5333
5426
  function defineProjection(def) {
5334
5427
  return def;
@@ -5383,15 +5476,57 @@ function isRecord(value) {
5383
5476
  function recordValue2(value) {
5384
5477
  return isRecord(value) ? value : {};
5385
5478
  }
5479
+ function normalizeTopicIdForKernel(topicId) {
5480
+ const normalized = topicId?.trim();
5481
+ if (!normalized) {
5482
+ return void 0;
5483
+ }
5484
+ try {
5485
+ const decoded = decodePrefixedId(normalized);
5486
+ return decoded.prefix === "top" ? decoded.value : normalized;
5487
+ } catch {
5488
+ return normalized;
5489
+ }
5490
+ }
5491
+ function normalizeWorktreeId(value) {
5492
+ const normalized = value?.trim();
5493
+ if (!normalized) {
5494
+ return void 0;
5495
+ }
5496
+ if (normalized.startsWith("wt_")) {
5497
+ return normalized.slice("wt_".length);
5498
+ }
5499
+ return normalized;
5500
+ }
5501
+ function targetKind(targetId) {
5502
+ const normalized = targetId?.trim();
5503
+ if (!normalized) {
5504
+ return "unknown";
5505
+ }
5506
+ if (normalized.startsWith("wt_") || /^tn[a-z0-9]+$/i.test(normalized)) {
5507
+ return "worktree";
5508
+ }
5509
+ if (normalized.startsWith("que_")) {
5510
+ return "question";
5511
+ }
5512
+ if (normalized.startsWith("bel_")) {
5513
+ return "belief";
5514
+ }
5515
+ return "unknown";
5516
+ }
5386
5517
  var createEvidenceProjection = defineProjection({
5387
5518
  contractName: "create_evidence",
5388
5519
  inputSchema: createEvidenceInputSchema,
5389
5520
  project: (input) => {
5390
5521
  const text = input.text ?? input.canonicalText;
5391
5522
  const weight = typeof input.weight === "number" ? input.weight : void 0;
5523
+ const target = input.targetId ?? input.targetNodeId;
5524
+ const kind = targetKind(target);
5525
+ const linkedWorktreeId = kind === "worktree" ? normalizeWorktreeId(target) : void 0;
5526
+ const linkedBeliefNodeId = input.linkedBeliefNodeId ?? (kind === "belief" || kind === "unknown" ? input.targetNodeId ?? input.targetId : void 0);
5392
5527
  return compactRecord2({
5393
5528
  projectId: input.projectId,
5394
- topicId: input.topicId,
5529
+ topicId: normalizeTopicIdForKernel(input.topicId),
5395
5530
  text,
5396
5531
  title: input.title ?? text,
5397
5532
  content: input.content ?? text,
@@ -5410,11 +5545,13 @@ var createEvidenceProjection = defineProjection({
5410
5545
  source: input.source,
5411
5546
  targetId: input.targetId,
5412
5547
  targetNodeId: input.targetNodeId,
5548
+ targetKind: kind === "unknown" ? void 0 : kind,
5549
+ linkedWorktreeId,
5413
5550
  weight,
5414
5551
  reasoning: input.reasoning,
5415
5552
  rationale: input.rationale
5416
5553
  }),
5417
- linkedBeliefNodeId: input.linkedBeliefNodeId ?? input.targetNodeId ?? input.targetId,
5554
+ linkedBeliefNodeId,
5418
5555
  evidenceRelation: input.evidenceRelation ?? (weight === void 0 ? void 0 : weight < 0 ? "contradicts" : "supports"),
5419
5556
  confidence: input.confidence ?? (weight === void 0 ? void 0 : Math.min(1, Math.max(0, Math.abs(weight)))),
5420
5557
  rationale: input.rationale,
@@ -5457,7 +5594,7 @@ var createEvidenceArgs = z.object({
5457
5594
  text: z.string().describe("Canonical evidence text."),
5458
5595
  source: z.string().optional().describe("Source URL or source label."),
5459
5596
  sourceUrl: z.string().optional().describe("Canonical source URL."),
5460
- targetId: z.string().optional().describe("Belief or question identifier to link immediately."),
5597
+ targetId: z.string().optional().describe("Belief, question, or worktree identifier to link or preserve on the evidence record."),
5461
5598
  linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
5462
5599
  evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
5463
5600
  confidence: z.number().optional().describe("Confidence in the evidence relation."),
@@ -5490,11 +5627,6 @@ var addEvidenceArgs = z.object({
5490
5627
  contentType: z.string().optional().describe("Content format or MIME hint."),
5491
5628
  metadata: jsonRecordSchema2.optional().describe("Optional metadata merged into the evidence node.")
5492
5629
  });
5493
- var evidenceIdInput = (input) => compactRecord({
5494
- evidenceId: input.evidenceId,
5495
- insightId: input.insightId,
5496
- nodeId: input.nodeId ?? input.id ?? input.evidenceId
5497
- });
5498
5630
  var createEvidenceInput = (input, context) => {
5499
5631
  const parsed = createEvidenceProjection.inputSchema.safeParse(input);
5500
5632
  if (!parsed.success) {
@@ -5608,11 +5740,8 @@ var evidenceContracts = [
5608
5740
  sdkNamespace: "evidence",
5609
5741
  sdkMethod: "getEvidence",
5610
5742
  summary: "Get evidence.",
5611
- convex: {
5612
- module: "evidence",
5613
- functionName: "getById",
5614
- kind: "query",
5615
- inputProjection: evidenceIdInput
5743
+ gateway: {
5744
+ handler: "evidence.get"
5616
5745
  }
5617
5746
  }),
5618
5747
  surfaceContract({
@@ -5638,17 +5767,8 @@ var evidenceContracts = [
5638
5767
  sdkNamespace: "evidence",
5639
5768
  sdkMethod: "searchEvidence",
5640
5769
  summary: "Search evidence.",
5641
- convex: {
5642
- module: "nodes",
5643
- functionName: "search",
5644
- kind: "query",
5645
- inputProjection: (input) => compactRecord({
5646
- searchQuery: input.searchQuery ?? input.q ?? input.query,
5647
- projectId: input.projectId,
5648
- topicId: input.topicId,
5649
- nodeType: "evidence",
5650
- limit: input.limit
5651
- })
5770
+ gateway: {
5771
+ handler: "evidence.search"
5652
5772
  }
5653
5773
  }),
5654
5774
  surfaceContract({