@lucern/contracts 1.0.54 → 1.0.56

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 (45) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/events-types.contract.js +4 -0
  3. package/dist/events.contract.d.ts +1 -1
  4. package/dist/events.contract.js +4 -0
  5. package/dist/evidence-taxonomy-target-scope.contract.js +9 -0
  6. package/dist/function-registry/beliefs.js +70 -0
  7. package/dist/function-registry/coding.js +71 -1
  8. package/dist/function-registry/context.js +71 -0
  9. package/dist/function-registry/contracts.js +70 -0
  10. package/dist/function-registry/coordination.js +70 -0
  11. package/dist/function-registry/edges.js +100 -2
  12. package/dist/function-registry/embeddings.js +70 -0
  13. package/dist/function-registry/evidence.js +59 -14
  14. package/dist/function-registry/graph.js +70 -0
  15. package/dist/function-registry/helpers.d.ts +1 -0
  16. package/dist/function-registry/helpers.js +95 -1
  17. package/dist/function-registry/hybrid.js +70 -0
  18. package/dist/function-registry/identity.js +70 -0
  19. package/dist/function-registry/index.js +95 -1
  20. package/dist/function-registry/judgments.js +70 -0
  21. package/dist/function-registry/legacy.js +70 -0
  22. package/dist/function-registry/lenses.js +70 -0
  23. package/dist/function-registry/nodes.js +70 -0
  24. package/dist/function-registry/ontologies.js +70 -0
  25. package/dist/function-registry/pipeline.js +70 -0
  26. package/dist/function-registry/policy.js +70 -0
  27. package/dist/function-registry/questions.js +70 -0
  28. package/dist/function-registry/tasks.js +70 -0
  29. package/dist/function-registry/topics.js +98 -13
  30. package/dist/function-registry/worktrees.js +125 -2
  31. package/dist/index.js +14 -1
  32. package/dist/projections/check-convex-args-shape.js +9 -0
  33. package/dist/projections/create-evidence.projection.js +9 -0
  34. package/dist/projections/index.js +9 -0
  35. package/dist/proof-attestation.json +1 -1
  36. package/dist/schema-helpers/evidenceAdmission.d.ts +8 -0
  37. package/dist/schema-helpers/evidenceAdmission.js +167 -0
  38. package/dist/schemas/index.js +9 -0
  39. package/dist/schemas/manifest.js +9 -0
  40. package/dist/schemas/tables/kernel/spine.js +9 -0
  41. package/dist/schemas.values.js +9 -0
  42. package/dist/types/evidence-taxonomy-target-scope.d.ts +3 -0
  43. package/dist/types/evidence-taxonomy-target-scope.js +10 -1
  44. package/dist/worktree-belief-adoption.contract.js +1 -1
  45. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -178,3 +178,9 @@ All notable changes to `@lucern/contracts` are tracked in this repository.
178
178
  ## [1.0.54] - 2026-06-30
179
179
  - Supersedes the `1.0.53` package line with clean npm metadata after boundary
180
180
  manual-publish recovery exposed a leaked `workspace:*` dependency.
181
+
182
+ ## [1.0.55] - 2026-06-30
183
+ - Release notes pending.
184
+
185
+ ## [1.0.56] - 2026-07-02
186
+ - Release notes pending.
@@ -35,6 +35,10 @@ var DOMAIN_EVENT_TYPES = [
35
35
  "task.updated",
36
36
  "ontology.bound",
37
37
  "context.compiled",
38
+ "context.compile_failed",
39
+ "graph.mutation_written",
40
+ "admission.refused",
41
+ "worktree.session_closed",
38
42
  "identity.key_created",
39
43
  "identity.key_rotated",
40
44
  "identity.key_revoked",
@@ -14,7 +14,7 @@ export declare const DOMAIN_EVENT_VERSION: "1.0";
14
14
  export declare const EVENT_RETENTION_DEFAULT_DAYS = 30;
15
15
  export declare const WEBHOOK_MAX_ATTEMPTS = 5;
16
16
  export declare const WEBHOOK_RETRY_DELAYS_MS: readonly [1000, 5000, 30000, 300000];
17
- export declare const DOMAIN_EVENT_TYPES: readonly ["belief.created", "belief.forked", "belief.confidence_updated", "belief.archived", "belief.refined", "belief.contract_created", "belief.contract_evaluated", "belief.lineage_queried", "evidence.created", "evidence.linked", "evidence.search_executed", "question.created", "question.answered", "question.refined", "question.status_updated", "question.archived", "edge.created", "contradiction.flagged", "worktree.created", "worktree.activated", "worktree.merged", "worktree.targets_updated", "worktree.metadata_updated", "topic.created", "topic.updated", "topic.archived", "task.created", "task.completed", "task.updated", "ontology.bound", "context.compiled", "identity.key_created", "identity.key_rotated", "identity.key_revoked", "webhook.test"];
17
+ export declare const DOMAIN_EVENT_TYPES: readonly ["belief.created", "belief.forked", "belief.confidence_updated", "belief.archived", "belief.refined", "belief.contract_created", "belief.contract_evaluated", "belief.lineage_queried", "evidence.created", "evidence.linked", "evidence.search_executed", "question.created", "question.answered", "question.refined", "question.status_updated", "question.archived", "edge.created", "contradiction.flagged", "worktree.created", "worktree.activated", "worktree.merged", "worktree.targets_updated", "worktree.metadata_updated", "topic.created", "topic.updated", "topic.archived", "task.created", "task.completed", "task.updated", "ontology.bound", "context.compiled", "context.compile_failed", "graph.mutation_written", "admission.refused", "worktree.session_closed", "identity.key_created", "identity.key_rotated", "identity.key_revoked", "webhook.test"];
18
18
  export type DomainEventType = (typeof DOMAIN_EVENT_TYPES)[number];
19
19
  export type DomainResourceType = "belief" | "evidence" | "question" | "edge" | "contradiction" | "worktree" | "topic" | "task" | "ontology" | "context" | "identity" | "webhook";
20
20
  export type DomainActorType = "human" | "agent" | "service";
@@ -35,6 +35,10 @@ var DOMAIN_EVENT_TYPES = [
35
35
  "task.updated",
36
36
  "ontology.bound",
37
37
  "context.compiled",
38
+ "context.compile_failed",
39
+ "graph.mutation_written",
40
+ "admission.refused",
41
+ "worktree.session_closed",
38
42
  "identity.key_created",
39
43
  "identity.key_rotated",
40
44
  "identity.key_revoked",
@@ -5899,6 +5899,14 @@ DATA_MODEL_MANIFEST_SKELETON.surfaces.map(
5899
5899
  (surface) => surface.compositionEmitted
5900
5900
  );
5901
5901
  var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
5902
+ var EVIDENCE_KIND_VALUES = [
5903
+ "fact",
5904
+ "observation",
5905
+ "claim",
5906
+ "quote",
5907
+ "statistic",
5908
+ "signal"
5909
+ ];
5902
5910
  var EVIDENCE_METHODOLOGY_VALUES = [
5903
5911
  "primary_research",
5904
5912
  "expert_interview",
@@ -5952,6 +5960,7 @@ var EVIDENCE_TAXONOMY_REFUSAL_IDS = [
5952
5960
  "metadata_scoring_plan_refused"
5953
5961
  ];
5954
5962
  var EvidenceRelationSchema = z.enum(EVIDENCE_RELATION_VALUES);
5963
+ z.enum(EVIDENCE_KIND_VALUES);
5955
5964
  var EvidenceMethodologySchema = z.enum(EVIDENCE_METHODOLOGY_VALUES);
5956
5965
  var EvidenceInformationAsymmetrySchema = z.enum(
5957
5966
  EVIDENCE_INFORMATION_ASYMMETRY_VALUES
@@ -6089,6 +6089,76 @@ var WORKTREE_TYPE_VALUES = [
6089
6089
  ({
6090
6090
  topic_type: new Set(TOPIC_TYPE_VALUES),
6091
6091
  worktree_type: new Set(WORKTREE_TYPE_VALUES)});
6092
+ var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
6093
+ var EVIDENCE_KIND_VALUES = [
6094
+ "fact",
6095
+ "observation",
6096
+ "claim",
6097
+ "quote",
6098
+ "statistic",
6099
+ "signal"
6100
+ ];
6101
+ var EVIDENCE_METHODOLOGY_VALUES = [
6102
+ "primary_research",
6103
+ "expert_interview",
6104
+ "customer_interview",
6105
+ "field_observation",
6106
+ "proprietary_data",
6107
+ "desk_research",
6108
+ "regulatory_filing",
6109
+ "news_article",
6110
+ "academic_paper",
6111
+ "ai_synthesis",
6112
+ "ai_extraction"
6113
+ ];
6114
+ var EVIDENCE_INFORMATION_ASYMMETRY_VALUES = [
6115
+ "proprietary",
6116
+ "early",
6117
+ "common"
6118
+ ];
6119
+ var EVIDENCE_SOURCE_QUALITY_VALUES = [
6120
+ "primary",
6121
+ "analyzed",
6122
+ "secondary",
6123
+ "tertiary",
6124
+ "unknown"
6125
+ ];
6126
+ var EVIDENCE_SOURCE_TYPE_VALUES = [
6127
+ "human",
6128
+ "ai_extracted",
6129
+ "ai_generated",
6130
+ "imported",
6131
+ "system",
6132
+ "verified",
6133
+ "proprietary"
6134
+ ];
6135
+ var EVIDENCE_SCORING_DIMENSIONS = [
6136
+ "signedImpact",
6137
+ "evidenceRelation",
6138
+ "sourceQuality",
6139
+ "methodology",
6140
+ "informationAsymmetry",
6141
+ "sourceRef",
6142
+ "targetBeliefId",
6143
+ "verificationStatus"
6144
+ ];
6145
+ z.enum(EVIDENCE_RELATION_VALUES);
6146
+ z.enum(EVIDENCE_KIND_VALUES);
6147
+ z.enum(EVIDENCE_METHODOLOGY_VALUES);
6148
+ z.enum(
6149
+ EVIDENCE_INFORMATION_ASYMMETRY_VALUES
6150
+ );
6151
+ z.enum(
6152
+ EVIDENCE_SOURCE_QUALITY_VALUES
6153
+ );
6154
+ z.enum(EVIDENCE_SOURCE_TYPE_VALUES);
6155
+ z.enum(
6156
+ EVIDENCE_SCORING_DIMENSIONS
6157
+ );
6158
+
6159
+ // src/schema-helpers/evidenceAdmission.ts
6160
+ new Set(EVIDENCE_KIND_VALUES);
6161
+ new Set(EVIDENCE_SOURCE_TYPE_VALUES);
6092
6162
 
6093
6163
  // src/function-registry/helpers.ts
6094
6164
  var jsonObjectSchema = z.record(z.unknown());
@@ -5904,6 +5904,76 @@ var WORKTREE_TYPE_VALUES = [
5904
5904
  ({
5905
5905
  topic_type: new Set(TOPIC_TYPE_VALUES),
5906
5906
  worktree_type: new Set(WORKTREE_TYPE_VALUES)});
5907
+ var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
5908
+ var EVIDENCE_KIND_VALUES = [
5909
+ "fact",
5910
+ "observation",
5911
+ "claim",
5912
+ "quote",
5913
+ "statistic",
5914
+ "signal"
5915
+ ];
5916
+ var EVIDENCE_METHODOLOGY_VALUES = [
5917
+ "primary_research",
5918
+ "expert_interview",
5919
+ "customer_interview",
5920
+ "field_observation",
5921
+ "proprietary_data",
5922
+ "desk_research",
5923
+ "regulatory_filing",
5924
+ "news_article",
5925
+ "academic_paper",
5926
+ "ai_synthesis",
5927
+ "ai_extraction"
5928
+ ];
5929
+ var EVIDENCE_INFORMATION_ASYMMETRY_VALUES = [
5930
+ "proprietary",
5931
+ "early",
5932
+ "common"
5933
+ ];
5934
+ var EVIDENCE_SOURCE_QUALITY_VALUES = [
5935
+ "primary",
5936
+ "analyzed",
5937
+ "secondary",
5938
+ "tertiary",
5939
+ "unknown"
5940
+ ];
5941
+ var EVIDENCE_SOURCE_TYPE_VALUES = [
5942
+ "human",
5943
+ "ai_extracted",
5944
+ "ai_generated",
5945
+ "imported",
5946
+ "system",
5947
+ "verified",
5948
+ "proprietary"
5949
+ ];
5950
+ var EVIDENCE_SCORING_DIMENSIONS = [
5951
+ "signedImpact",
5952
+ "evidenceRelation",
5953
+ "sourceQuality",
5954
+ "methodology",
5955
+ "informationAsymmetry",
5956
+ "sourceRef",
5957
+ "targetBeliefId",
5958
+ "verificationStatus"
5959
+ ];
5960
+ z.enum(EVIDENCE_RELATION_VALUES);
5961
+ z.enum(EVIDENCE_KIND_VALUES);
5962
+ z.enum(EVIDENCE_METHODOLOGY_VALUES);
5963
+ z.enum(
5964
+ EVIDENCE_INFORMATION_ASYMMETRY_VALUES
5965
+ );
5966
+ z.enum(
5967
+ EVIDENCE_SOURCE_QUALITY_VALUES
5968
+ );
5969
+ z.enum(EVIDENCE_SOURCE_TYPE_VALUES);
5970
+ z.enum(
5971
+ EVIDENCE_SCORING_DIMENSIONS
5972
+ );
5973
+
5974
+ // src/schema-helpers/evidenceAdmission.ts
5975
+ new Set(EVIDENCE_KIND_VALUES);
5976
+ new Set(EVIDENCE_SOURCE_TYPE_VALUES);
5907
5977
 
5908
5978
  // src/function-registry/helpers.ts
5909
5979
  var jsonObjectSchema = z.record(z.unknown());
@@ -6418,7 +6488,7 @@ var learningInput = (input, context) => {
6418
6488
  title: input.title ?? input.summary ?? "Scope learning",
6419
6489
  content: input.body ?? input.content ?? input.summary,
6420
6490
  contentType: input.contentType,
6421
- kind: input.kind ?? "learning",
6491
+ kind: input.kind,
6422
6492
  tags: input.tags ?? [],
6423
6493
  sourceType: input.sourceType,
6424
6494
  externalSourceType: input.externalSourceType ?? input.sourceKind,
@@ -5904,6 +5904,76 @@ var WORKTREE_TYPE_VALUES = [
5904
5904
  ({
5905
5905
  topic_type: new Set(TOPIC_TYPE_VALUES),
5906
5906
  worktree_type: new Set(WORKTREE_TYPE_VALUES)});
5907
+ var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
5908
+ var EVIDENCE_KIND_VALUES = [
5909
+ "fact",
5910
+ "observation",
5911
+ "claim",
5912
+ "quote",
5913
+ "statistic",
5914
+ "signal"
5915
+ ];
5916
+ var EVIDENCE_METHODOLOGY_VALUES = [
5917
+ "primary_research",
5918
+ "expert_interview",
5919
+ "customer_interview",
5920
+ "field_observation",
5921
+ "proprietary_data",
5922
+ "desk_research",
5923
+ "regulatory_filing",
5924
+ "news_article",
5925
+ "academic_paper",
5926
+ "ai_synthesis",
5927
+ "ai_extraction"
5928
+ ];
5929
+ var EVIDENCE_INFORMATION_ASYMMETRY_VALUES = [
5930
+ "proprietary",
5931
+ "early",
5932
+ "common"
5933
+ ];
5934
+ var EVIDENCE_SOURCE_QUALITY_VALUES = [
5935
+ "primary",
5936
+ "analyzed",
5937
+ "secondary",
5938
+ "tertiary",
5939
+ "unknown"
5940
+ ];
5941
+ var EVIDENCE_SOURCE_TYPE_VALUES = [
5942
+ "human",
5943
+ "ai_extracted",
5944
+ "ai_generated",
5945
+ "imported",
5946
+ "system",
5947
+ "verified",
5948
+ "proprietary"
5949
+ ];
5950
+ var EVIDENCE_SCORING_DIMENSIONS = [
5951
+ "signedImpact",
5952
+ "evidenceRelation",
5953
+ "sourceQuality",
5954
+ "methodology",
5955
+ "informationAsymmetry",
5956
+ "sourceRef",
5957
+ "targetBeliefId",
5958
+ "verificationStatus"
5959
+ ];
5960
+ z.enum(EVIDENCE_RELATION_VALUES);
5961
+ z.enum(EVIDENCE_KIND_VALUES);
5962
+ z.enum(EVIDENCE_METHODOLOGY_VALUES);
5963
+ z.enum(
5964
+ EVIDENCE_INFORMATION_ASYMMETRY_VALUES
5965
+ );
5966
+ z.enum(
5967
+ EVIDENCE_SOURCE_QUALITY_VALUES
5968
+ );
5969
+ z.enum(EVIDENCE_SOURCE_TYPE_VALUES);
5970
+ z.enum(
5971
+ EVIDENCE_SCORING_DIMENSIONS
5972
+ );
5973
+
5974
+ // src/schema-helpers/evidenceAdmission.ts
5975
+ new Set(EVIDENCE_KIND_VALUES);
5976
+ new Set(EVIDENCE_SOURCE_TYPE_VALUES);
5907
5977
 
5908
5978
  // src/function-registry/helpers.ts
5909
5979
  var jsonObjectSchema = z.record(z.unknown());
@@ -6436,6 +6506,7 @@ var contextContracts = [
6436
6506
  convex: {
6437
6507
  module: "contextCompiler",
6438
6508
  functionName: "compileFromQuery",
6509
+ injectSessionContext: true,
6439
6510
  kind: "action"
6440
6511
  },
6441
6512
  args: compileContextArgs
@@ -5904,6 +5904,76 @@ var WORKTREE_TYPE_VALUES = [
5904
5904
  ({
5905
5905
  topic_type: new Set(TOPIC_TYPE_VALUES),
5906
5906
  worktree_type: new Set(WORKTREE_TYPE_VALUES)});
5907
+ var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
5908
+ var EVIDENCE_KIND_VALUES = [
5909
+ "fact",
5910
+ "observation",
5911
+ "claim",
5912
+ "quote",
5913
+ "statistic",
5914
+ "signal"
5915
+ ];
5916
+ var EVIDENCE_METHODOLOGY_VALUES = [
5917
+ "primary_research",
5918
+ "expert_interview",
5919
+ "customer_interview",
5920
+ "field_observation",
5921
+ "proprietary_data",
5922
+ "desk_research",
5923
+ "regulatory_filing",
5924
+ "news_article",
5925
+ "academic_paper",
5926
+ "ai_synthesis",
5927
+ "ai_extraction"
5928
+ ];
5929
+ var EVIDENCE_INFORMATION_ASYMMETRY_VALUES = [
5930
+ "proprietary",
5931
+ "early",
5932
+ "common"
5933
+ ];
5934
+ var EVIDENCE_SOURCE_QUALITY_VALUES = [
5935
+ "primary",
5936
+ "analyzed",
5937
+ "secondary",
5938
+ "tertiary",
5939
+ "unknown"
5940
+ ];
5941
+ var EVIDENCE_SOURCE_TYPE_VALUES = [
5942
+ "human",
5943
+ "ai_extracted",
5944
+ "ai_generated",
5945
+ "imported",
5946
+ "system",
5947
+ "verified",
5948
+ "proprietary"
5949
+ ];
5950
+ var EVIDENCE_SCORING_DIMENSIONS = [
5951
+ "signedImpact",
5952
+ "evidenceRelation",
5953
+ "sourceQuality",
5954
+ "methodology",
5955
+ "informationAsymmetry",
5956
+ "sourceRef",
5957
+ "targetBeliefId",
5958
+ "verificationStatus"
5959
+ ];
5960
+ z.enum(EVIDENCE_RELATION_VALUES);
5961
+ z.enum(EVIDENCE_KIND_VALUES);
5962
+ z.enum(EVIDENCE_METHODOLOGY_VALUES);
5963
+ z.enum(
5964
+ EVIDENCE_INFORMATION_ASYMMETRY_VALUES
5965
+ );
5966
+ z.enum(
5967
+ EVIDENCE_SOURCE_QUALITY_VALUES
5968
+ );
5969
+ z.enum(EVIDENCE_SOURCE_TYPE_VALUES);
5970
+ z.enum(
5971
+ EVIDENCE_SCORING_DIMENSIONS
5972
+ );
5973
+
5974
+ // src/schema-helpers/evidenceAdmission.ts
5975
+ new Set(EVIDENCE_KIND_VALUES);
5976
+ new Set(EVIDENCE_SOURCE_TYPE_VALUES);
5907
5977
 
5908
5978
  // src/function-registry/helpers.ts
5909
5979
  var jsonObjectSchema = z.record(z.unknown());
@@ -5904,6 +5904,76 @@ var WORKTREE_TYPE_VALUES = [
5904
5904
  ({
5905
5905
  topic_type: new Set(TOPIC_TYPE_VALUES),
5906
5906
  worktree_type: new Set(WORKTREE_TYPE_VALUES)});
5907
+ var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
5908
+ var EVIDENCE_KIND_VALUES = [
5909
+ "fact",
5910
+ "observation",
5911
+ "claim",
5912
+ "quote",
5913
+ "statistic",
5914
+ "signal"
5915
+ ];
5916
+ var EVIDENCE_METHODOLOGY_VALUES = [
5917
+ "primary_research",
5918
+ "expert_interview",
5919
+ "customer_interview",
5920
+ "field_observation",
5921
+ "proprietary_data",
5922
+ "desk_research",
5923
+ "regulatory_filing",
5924
+ "news_article",
5925
+ "academic_paper",
5926
+ "ai_synthesis",
5927
+ "ai_extraction"
5928
+ ];
5929
+ var EVIDENCE_INFORMATION_ASYMMETRY_VALUES = [
5930
+ "proprietary",
5931
+ "early",
5932
+ "common"
5933
+ ];
5934
+ var EVIDENCE_SOURCE_QUALITY_VALUES = [
5935
+ "primary",
5936
+ "analyzed",
5937
+ "secondary",
5938
+ "tertiary",
5939
+ "unknown"
5940
+ ];
5941
+ var EVIDENCE_SOURCE_TYPE_VALUES = [
5942
+ "human",
5943
+ "ai_extracted",
5944
+ "ai_generated",
5945
+ "imported",
5946
+ "system",
5947
+ "verified",
5948
+ "proprietary"
5949
+ ];
5950
+ var EVIDENCE_SCORING_DIMENSIONS = [
5951
+ "signedImpact",
5952
+ "evidenceRelation",
5953
+ "sourceQuality",
5954
+ "methodology",
5955
+ "informationAsymmetry",
5956
+ "sourceRef",
5957
+ "targetBeliefId",
5958
+ "verificationStatus"
5959
+ ];
5960
+ z.enum(EVIDENCE_RELATION_VALUES);
5961
+ z.enum(EVIDENCE_KIND_VALUES);
5962
+ z.enum(EVIDENCE_METHODOLOGY_VALUES);
5963
+ z.enum(
5964
+ EVIDENCE_INFORMATION_ASYMMETRY_VALUES
5965
+ );
5966
+ z.enum(
5967
+ EVIDENCE_SOURCE_QUALITY_VALUES
5968
+ );
5969
+ z.enum(EVIDENCE_SOURCE_TYPE_VALUES);
5970
+ z.enum(
5971
+ EVIDENCE_SCORING_DIMENSIONS
5972
+ );
5973
+
5974
+ // src/schema-helpers/evidenceAdmission.ts
5975
+ new Set(EVIDENCE_KIND_VALUES);
5976
+ new Set(EVIDENCE_SOURCE_TYPE_VALUES);
5907
5977
 
5908
5978
  // src/function-registry/helpers.ts
5909
5979
  var jsonObjectSchema = z.record(z.unknown());
@@ -135,6 +135,34 @@ new Set(
135
135
 
136
136
  // src/ids/index.ts
137
137
  var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
138
+ function formatUuid(bytes) {
139
+ const hex = Array.from(
140
+ bytes,
141
+ (byte) => byte.toString(16).padStart(2, "0")
142
+ ).join("");
143
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
144
+ }
145
+ function timestampByte(nowMs, byteIndex) {
146
+ return Math.floor(nowMs / 2 ** (8 * (5 - byteIndex))) % 256;
147
+ }
148
+ function generateUuidV7(nowMs = Date.now()) {
149
+ if (!Number.isInteger(nowMs) || nowMs < 0 || nowMs > 281474976710655) {
150
+ throw new Error(
151
+ "UUIDv7 timestamp must be an integer Unix millisecond value below 2^48."
152
+ );
153
+ }
154
+ const bytes = new Uint8Array(16);
155
+ crypto.getRandomValues(bytes);
156
+ bytes[0] = timestampByte(nowMs, 0);
157
+ bytes[1] = timestampByte(nowMs, 1);
158
+ bytes[2] = timestampByte(nowMs, 2);
159
+ bytes[3] = timestampByte(nowMs, 3);
160
+ bytes[4] = timestampByte(nowMs, 4);
161
+ bytes[5] = timestampByte(nowMs, 5);
162
+ bytes[6] = bytes[6] & 15 | 112;
163
+ bytes[8] = bytes[8] & 63 | 128;
164
+ return formatUuid(bytes);
165
+ }
138
166
  function isUuidV7(value) {
139
167
  return UUID_PATTERN.test(value) && value[14]?.toLowerCase() === "7";
140
168
  }
@@ -5995,6 +6023,76 @@ var WORKTREE_TYPE_VALUES = [
5995
6023
  ({
5996
6024
  topic_type: new Set(TOPIC_TYPE_VALUES),
5997
6025
  worktree_type: new Set(WORKTREE_TYPE_VALUES)});
6026
+ var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
6027
+ var EVIDENCE_KIND_VALUES = [
6028
+ "fact",
6029
+ "observation",
6030
+ "claim",
6031
+ "quote",
6032
+ "statistic",
6033
+ "signal"
6034
+ ];
6035
+ var EVIDENCE_METHODOLOGY_VALUES = [
6036
+ "primary_research",
6037
+ "expert_interview",
6038
+ "customer_interview",
6039
+ "field_observation",
6040
+ "proprietary_data",
6041
+ "desk_research",
6042
+ "regulatory_filing",
6043
+ "news_article",
6044
+ "academic_paper",
6045
+ "ai_synthesis",
6046
+ "ai_extraction"
6047
+ ];
6048
+ var EVIDENCE_INFORMATION_ASYMMETRY_VALUES = [
6049
+ "proprietary",
6050
+ "early",
6051
+ "common"
6052
+ ];
6053
+ var EVIDENCE_SOURCE_QUALITY_VALUES = [
6054
+ "primary",
6055
+ "analyzed",
6056
+ "secondary",
6057
+ "tertiary",
6058
+ "unknown"
6059
+ ];
6060
+ var EVIDENCE_SOURCE_TYPE_VALUES = [
6061
+ "human",
6062
+ "ai_extracted",
6063
+ "ai_generated",
6064
+ "imported",
6065
+ "system",
6066
+ "verified",
6067
+ "proprietary"
6068
+ ];
6069
+ var EVIDENCE_SCORING_DIMENSIONS = [
6070
+ "signedImpact",
6071
+ "evidenceRelation",
6072
+ "sourceQuality",
6073
+ "methodology",
6074
+ "informationAsymmetry",
6075
+ "sourceRef",
6076
+ "targetBeliefId",
6077
+ "verificationStatus"
6078
+ ];
6079
+ z.enum(EVIDENCE_RELATION_VALUES);
6080
+ z.enum(EVIDENCE_KIND_VALUES);
6081
+ z.enum(EVIDENCE_METHODOLOGY_VALUES);
6082
+ z.enum(
6083
+ EVIDENCE_INFORMATION_ASYMMETRY_VALUES
6084
+ );
6085
+ z.enum(
6086
+ EVIDENCE_SOURCE_QUALITY_VALUES
6087
+ );
6088
+ z.enum(EVIDENCE_SOURCE_TYPE_VALUES);
6089
+ z.enum(
6090
+ EVIDENCE_SCORING_DIMENSIONS
6091
+ );
6092
+
6093
+ // src/schema-helpers/evidenceAdmission.ts
6094
+ new Set(EVIDENCE_KIND_VALUES);
6095
+ new Set(EVIDENCE_SOURCE_TYPE_VALUES);
5998
6096
 
5999
6097
  // src/function-registry/helpers.ts
6000
6098
  var jsonObjectSchema = z.record(z.unknown());
@@ -6412,7 +6510,7 @@ var edgesContracts = [
6412
6510
  fromNodeId,
6413
6511
  toNodeId,
6414
6512
  edgeType: parsed.edgeType,
6415
- globalId: parsed.globalId,
6513
+ globalId: parsed.globalId ?? generateUuidV7(),
6416
6514
  weight: parsed.weight,
6417
6515
  confidence: parsed.confidence,
6418
6516
  context: parsed.context ?? parsed.reasoning,
@@ -6545,7 +6643,7 @@ var edgesContracts = [
6545
6643
  fromNodeId,
6546
6644
  toNodeId,
6547
6645
  edgeType: edge.edgeType,
6548
- globalId: edge.globalId,
6646
+ globalId: edge.globalId ?? generateUuidV7(),
6549
6647
  weight: edge.weight,
6550
6648
  confidence: edge.confidence,
6551
6649
  context: edge.context ?? edge.reasoning,
@@ -5904,6 +5904,76 @@ var WORKTREE_TYPE_VALUES = [
5904
5904
  ({
5905
5905
  topic_type: new Set(TOPIC_TYPE_VALUES),
5906
5906
  worktree_type: new Set(WORKTREE_TYPE_VALUES)});
5907
+ var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
5908
+ var EVIDENCE_KIND_VALUES = [
5909
+ "fact",
5910
+ "observation",
5911
+ "claim",
5912
+ "quote",
5913
+ "statistic",
5914
+ "signal"
5915
+ ];
5916
+ var EVIDENCE_METHODOLOGY_VALUES = [
5917
+ "primary_research",
5918
+ "expert_interview",
5919
+ "customer_interview",
5920
+ "field_observation",
5921
+ "proprietary_data",
5922
+ "desk_research",
5923
+ "regulatory_filing",
5924
+ "news_article",
5925
+ "academic_paper",
5926
+ "ai_synthesis",
5927
+ "ai_extraction"
5928
+ ];
5929
+ var EVIDENCE_INFORMATION_ASYMMETRY_VALUES = [
5930
+ "proprietary",
5931
+ "early",
5932
+ "common"
5933
+ ];
5934
+ var EVIDENCE_SOURCE_QUALITY_VALUES = [
5935
+ "primary",
5936
+ "analyzed",
5937
+ "secondary",
5938
+ "tertiary",
5939
+ "unknown"
5940
+ ];
5941
+ var EVIDENCE_SOURCE_TYPE_VALUES = [
5942
+ "human",
5943
+ "ai_extracted",
5944
+ "ai_generated",
5945
+ "imported",
5946
+ "system",
5947
+ "verified",
5948
+ "proprietary"
5949
+ ];
5950
+ var EVIDENCE_SCORING_DIMENSIONS = [
5951
+ "signedImpact",
5952
+ "evidenceRelation",
5953
+ "sourceQuality",
5954
+ "methodology",
5955
+ "informationAsymmetry",
5956
+ "sourceRef",
5957
+ "targetBeliefId",
5958
+ "verificationStatus"
5959
+ ];
5960
+ z.enum(EVIDENCE_RELATION_VALUES);
5961
+ z.enum(EVIDENCE_KIND_VALUES);
5962
+ z.enum(EVIDENCE_METHODOLOGY_VALUES);
5963
+ z.enum(
5964
+ EVIDENCE_INFORMATION_ASYMMETRY_VALUES
5965
+ );
5966
+ z.enum(
5967
+ EVIDENCE_SOURCE_QUALITY_VALUES
5968
+ );
5969
+ z.enum(EVIDENCE_SOURCE_TYPE_VALUES);
5970
+ z.enum(
5971
+ EVIDENCE_SCORING_DIMENSIONS
5972
+ );
5973
+
5974
+ // src/schema-helpers/evidenceAdmission.ts
5975
+ new Set(EVIDENCE_KIND_VALUES);
5976
+ new Set(EVIDENCE_SOURCE_TYPE_VALUES);
5907
5977
 
5908
5978
  // src/function-registry/helpers.ts
5909
5979
  var jsonObjectSchema = z.record(z.unknown());