@lucern/contracts 0.1.0 → 0.1.1-alpha.1

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 (87) hide show
  1. package/dist/index.d.ts +2003 -21
  2. package/dist/index.js +5627 -22
  3. package/package.json +15 -25
  4. package/src/agents/v1.ts +8 -0
  5. package/src/api-enums.contract.ts +183 -0
  6. package/src/auth-context.contract.ts +9 -0
  7. package/src/auth-session.contract.ts +9 -0
  8. package/src/auth.contract.ts +162 -0
  9. package/src/beliefs/v1.ts +8 -0
  10. package/src/context-pack.contract.ts +704 -0
  11. package/src/convex-admin.contract.ts +14 -0
  12. package/src/events-types.contract.ts +9 -0
  13. package/src/events.contract.ts +376 -0
  14. package/src/evidence/v1.ts +8 -0
  15. package/src/gateway.contract.ts +151 -0
  16. package/src/graph/v1.ts +8 -0
  17. package/src/ids.contract.ts +36 -0
  18. package/src/index.ts +30 -0
  19. package/src/lens-filter.contract.ts +183 -0
  20. package/src/lens-workflow.contract.ts +162 -0
  21. package/src/mcp-tools.contract.ts +3636 -0
  22. package/src/ontologies/v1.ts +8 -0
  23. package/src/ontology-matching.contract.ts +9 -0
  24. package/src/prompt.contract.ts +50 -0
  25. package/src/questions/v1.ts +8 -0
  26. package/src/sdk-methods.contract.ts +522 -0
  27. package/src/sdk-tools.contract.ts +1545 -0
  28. package/src/text-matching.contract.ts +347 -0
  29. package/src/topic-scope.contract.ts +9 -0
  30. package/src/topics/v1.ts +8 -0
  31. package/src/v1/agents/v1.ts +8 -0
  32. package/src/v1/beliefs/v1.ts +8 -0
  33. package/src/v1/evidence/v1.ts +8 -0
  34. package/src/v1/graph/v1.ts +8 -0
  35. package/src/v1/ontologies/v1.ts +276 -0
  36. package/src/v1/questions/v1.ts +8 -0
  37. package/src/v1/topics/v1.ts +79 -0
  38. package/src/v1/worktrees/v1.ts +8 -0
  39. package/src/workflow-runtime.contract.ts +440 -0
  40. package/src/worktrees/v1.ts +8 -0
  41. package/tsconfig.json +9 -0
  42. package/dist/api-enums.contract.d.ts +0 -59
  43. package/dist/api-enums.contract.d.ts.map +0 -1
  44. package/dist/api-enums.contract.js +0 -148
  45. package/dist/api-enums.contract.js.map +0 -1
  46. package/dist/auth-session.contract.d.ts +0 -54
  47. package/dist/auth-session.contract.d.ts.map +0 -1
  48. package/dist/auth-session.contract.js +0 -50
  49. package/dist/auth-session.contract.js.map +0 -1
  50. package/dist/context-pack.contract.d.ts +0 -495
  51. package/dist/context-pack.contract.d.ts.map +0 -1
  52. package/dist/context-pack.contract.js +0 -170
  53. package/dist/context-pack.contract.js.map +0 -1
  54. package/dist/gateway.contract.d.ts +0 -74
  55. package/dist/gateway.contract.d.ts.map +0 -1
  56. package/dist/gateway.contract.js +0 -12
  57. package/dist/gateway.contract.js.map +0 -1
  58. package/dist/index.d.ts.map +0 -1
  59. package/dist/index.js.map +0 -1
  60. package/dist/lens-filter.contract.d.ts +0 -71
  61. package/dist/lens-filter.contract.d.ts.map +0 -1
  62. package/dist/lens-filter.contract.js +0 -96
  63. package/dist/lens-filter.contract.js.map +0 -1
  64. package/dist/lens-workflow.contract.d.ts +0 -85
  65. package/dist/lens-workflow.contract.d.ts.map +0 -1
  66. package/dist/lens-workflow.contract.js +0 -55
  67. package/dist/lens-workflow.contract.js.map +0 -1
  68. package/dist/mcp-tools.contract.d.ts +0 -152
  69. package/dist/mcp-tools.contract.d.ts.map +0 -1
  70. package/dist/mcp-tools.contract.js +0 -3282
  71. package/dist/mcp-tools.contract.js.map +0 -1
  72. package/dist/prompt.contract.d.ts +0 -25
  73. package/dist/prompt.contract.d.ts.map +0 -1
  74. package/dist/prompt.contract.js +0 -25
  75. package/dist/prompt.contract.js.map +0 -1
  76. package/dist/sdk-methods.contract.d.ts +0 -356
  77. package/dist/sdk-methods.contract.d.ts.map +0 -1
  78. package/dist/sdk-methods.contract.js +0 -17
  79. package/dist/sdk-methods.contract.js.map +0 -1
  80. package/dist/sdk-tools.contract.d.ts +0 -93
  81. package/dist/sdk-tools.contract.d.ts.map +0 -1
  82. package/dist/sdk-tools.contract.js +0 -1399
  83. package/dist/sdk-tools.contract.js.map +0 -1
  84. package/dist/workflow-runtime.contract.d.ts +0 -162
  85. package/dist/workflow-runtime.contract.d.ts.map +0 -1
  86. package/dist/workflow-runtime.contract.js +0 -258
  87. package/dist/workflow-runtime.contract.js.map +0 -1
@@ -1,148 +0,0 @@
1
- /**
2
- * API Enum Contract Definitions
3
- *
4
- * Canonical enum values for all API-facing enumerations.
5
- * These are co-equal with MCP contracts as external contracts.
6
- * SDK types are DERIVED from these — not independently authored.
7
- *
8
- * CONTRACT SURFACE: Adding a new enum value is additive (non-breaking).
9
- * Removing or renaming an existing value is a BREAKING CHANGE.
10
- */
11
- // =============================================================================
12
- // BELIEF ENUMS
13
- // =============================================================================
14
- /** Fork reasons — why a scored belief was branched */
15
- export const FORK_REASONS = [
16
- "refinement", // Belief text evolved based on new understanding
17
- "contradiction_response", // Created in response to a detected contradiction
18
- "scope_change", // Belief scope narrowed or broadened
19
- "confidence_collapse", // Confidence dropped below viability threshold
20
- "manual", // User-initiated fork without specific trigger
21
- ];
22
- /** Confidence modulation triggers — what caused a confidence change */
23
- export const CONFIDENCE_TRIGGERS = [
24
- "evidence_added", // New evidence bore on the belief
25
- "contradiction_detected", // A contradiction was flagged involving this belief
26
- "merge_outcome", // Merge scoring determined this confidence
27
- "manual", // User manually adjusted confidence
28
- "decay", // Time-based confidence erosion
29
- ];
30
- /** Belief status — lifecycle state */
31
- export const BELIEF_STATUSES = [
32
- "unscored", // Draft — editable in worktree (on feature branch, pre-merge)
33
- "scored", // Merged — formulation frozen (merged to main)
34
- "archived", // Soft-deleted — preserved in history (git rm)
35
- ];
36
- // =============================================================================
37
- // EDGE ENUMS
38
- // =============================================================================
39
- /** Reasoning methods — how an edge relationship was determined */
40
- export const REASONING_METHODS = [
41
- "deductive", // Logically entailed
42
- "inductive", // Generalized from instances
43
- "abductive", // Best explanation inference
44
- "analogical", // Reasoning by analogy
45
- "empirical", // Direct observation/measurement
46
- ];
47
- /** Defeat types (Pollock taxonomy) — how a contradiction operates */
48
- export const DEFEAT_TYPES = [
49
- "rebuts", // Direct contradiction — reasons for the negation
50
- "undercuts", // Breaks the inference link between evidence and belief
51
- "undermines", // Attacks a premise the belief depends on
52
- ];
53
- /** Contradiction severity levels */
54
- export const CONTRADICTION_SEVERITIES = [
55
- "low", // Minor tension, may not require action
56
- "medium", // Moderate conflict, should be investigated
57
- "high", // Significant contradiction, likely needs resolution
58
- "critical", // Blocks progress — must be addressed before judgment
59
- ];
60
- /** Contradiction resolution status */
61
- export const CONTRADICTION_STATUSES = [
62
- "unresolved", // Open conflict — may persist indefinitely
63
- "resolved", // Conflict addressed (one belief forked, archived, or confidence adjusted)
64
- "accepted", // Explicitly accepted as irreconcilable — both beliefs maintained
65
- ];
66
- // =============================================================================
67
- // WORKTREE ENUMS (git worktree lifecycle)
68
- // =============================================================================
69
- /** Merge outcome types — how a worktree merge resolved */
70
- export const MERGE_OUTCOMES = [
71
- "validated", // Beliefs confirmed — clean merge to main
72
- "invalidated", // Defeat recorded — confidence collapsed (merge with revert)
73
- "forked", // Beliefs split into competing versions (fork from merge point)
74
- "inconclusive", // Insufficient evidence — stashed (git stash)
75
- ];
76
- /** Worktree phases — investigation lifecycle within a checked-out worktree */
77
- export const WORKTREE_PHASES = [
78
- "hypothesis", // Form testable claims (write the code — commits)
79
- "investigation", // Collect evidence (run the tests — more commits)
80
- "evaluation", // Update credences (review the results — amend as needed)
81
- "resolution", // Determine outcome (merge to main, fork, or stash)
82
- ];
83
- // =============================================================================
84
- // BRANCH ENUMS (git branch lifecycle)
85
- // =============================================================================
86
- /** Branch status — thematic branch lifecycle */
87
- export const BRANCH_STATUSES = [
88
- "dormant", // Branch exists but no active worktree (no one investigating)
89
- "active", // At least one worktree is investigating this branch
90
- "archived", // Branch retired — no longer a relevant thematic container
91
- ];
92
- // =============================================================================
93
- // PULL REQUEST ENUMS (git pull request lifecycle)
94
- // =============================================================================
95
- /** Pull request status — review lifecycle before merge */
96
- export const PULL_REQUEST_STATUSES = [
97
- "pending_review", // PR opened — awaiting reviewer feedback
98
- "changes_requested", // Reviewer requests changes before merge
99
- "approved", // Approved — ready to merge
100
- "blocked", // Blocked — cannot merge until contradiction is resolved
101
- ];
102
- // =============================================================================
103
- // LAYER ENUMS
104
- // =============================================================================
105
- /** Epistemic layers — the hierarchy of knowledge */
106
- export const EPISTEMIC_LAYERS = [
107
- "L1", // Source — the given (vendored deps)
108
- "L2", // Evidence — the interpreted (test suite)
109
- "L3", // Belief — the structural (source files)
110
- "L4", // Judgment — the committed (release tags)
111
- ];
112
- // =============================================================================
113
- // JUDGMENT ENUMS (Phase 1: new vocabulary)
114
- // =============================================================================
115
- /**
116
- * Judgment type — classification of the determination.
117
- *
118
- * Phase 1: These are new enum values for the Judgment (L4) vocabulary.
119
- * The existing code uses "Decision" — these are the forward-looking terms
120
- * that will eventually replace the Decision vocabulary (Phase 2-3).
121
- */
122
- export const JUDGMENT_TYPES = [
123
- "investment_thesis", // Judgment on an investment opportunity
124
- "thesis_maturity", // Judgment that a thesis is ready for IC presentation
125
- "contradiction_ruling", // Judgment on how to handle an irreconcilable contradiction
126
- "scope_determination", // Judgment that defines or redefines investigation scope
127
- "confidence_ruling", // Judgment that overrides automated confidence for policy reasons
128
- ];
129
- // =============================================================================
130
- // SUPPORT RELATION ENUMS
131
- // =============================================================================
132
- /** Core edge types used in the Integration Surfaces */
133
- export const INTEGRATION_EDGE_TYPES = [
134
- // Support relations
135
- "informs", // Evidence bears on a belief (weight = direction/strength)
136
- "grounds", // Source provides raw basis for evidence
137
- "answers", // Evidence or belief resolves a question
138
- // Defeat relations (Pollock) — weight carries direction
139
- "contradicts", // Rebuts — direct contradiction
140
- "supports", // Weight carries valence (negative = weakens/undercuts)
141
- // Structural relations
142
- "depends_on", // Belief B requires Belief A
143
- "derived_from", // Provenance lineage
144
- "contains", // Hierarchical containment
145
- "supersedes", // New version replaces old (lineage)
146
- "tests", // Question tests a belief
147
- ];
148
- //# sourceMappingURL=api-enums.contract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-enums.contract.js","sourceRoot":"","sources":["../src/api-enums.contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF,sDAAsD;AACtD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,YAAY,EAAE,iDAAiD;IAC/D,wBAAwB,EAAE,kDAAkD;IAC5E,cAAc,EAAE,qCAAqC;IACrD,qBAAqB,EAAE,+CAA+C;IACtE,QAAQ,EAAE,+CAA+C;CACjD,CAAC;AAGX,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,gBAAgB,EAAE,kCAAkC;IACpD,wBAAwB,EAAE,oDAAoD;IAC9E,eAAe,EAAE,2CAA2C;IAC5D,QAAQ,EAAE,oCAAoC;IAC9C,OAAO,EAAE,gCAAgC;CACjC,CAAC;AAGX,sCAAsC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,UAAU,EAAE,8DAA8D;IAC1E,QAAQ,EAAE,+CAA+C;IACzD,UAAU,EAAE,+CAA+C;CACnD,CAAC;AAGX,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,6BAA6B;IAC1C,YAAY,EAAE,uBAAuB;IACrC,WAAW,EAAE,iCAAiC;CACtC,CAAC;AAGX,qEAAqE;AACrE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,kDAAkD;IAC5D,WAAW,EAAE,wDAAwD;IACrE,YAAY,EAAE,0CAA0C;CAChD,CAAC;AAGX,oCAAoC;AACpC,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,KAAK,EAAE,w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IAC/C,IAAI,EAAE,0CAA0C;CACxC,CAAC;AAGX,gFAAgF;AAChF,2CAA2C;AAC3C,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mBAAmB,EAAE,wCAAwC;IAC7D,iBAAiB,EAAE,sDAAsD;IACzE,sBAAsB,EAAE,4DAA4D;IACpF,qBAAqB,EAAE,yDAAyD;IAChF,mBAAmB,EAAE,kEAAkE;CAC/E,CAAC;AAGX,gFAAgF;AAChF,yBAAyB;AACzB,gFAAgF;AAEhF,uDAAuD;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,oBAAoB;IACpB,SAAS,EAAE,2DAA2D;IACtE,SAAS,EAAE,yCAAyC;IACpD,SAAS,EAAE,yCAAyC;IACpD,wDAAwD;IACxD,aAAa,EAAE,gCAAgC;IAC/C,UAAU,EAAE,wDAAwD;IACpE,uBAAuB;IACvB,YAAY,EAAE,6BAA6B;IAC3C,cAAc,EAAE,qBAAqB;IACrC,UAAU,EAAE,2BAA2B;IACvC,YAAY,EAAE,qCAAqC;IACnD,OAAO,EAAE,0BAA0B;CAC3B,CAAC"}
@@ -1,54 +0,0 @@
1
- /**
2
- * Session + Delegation Contract
3
- *
4
- * Canonical session lifecycle vocabulary shared by platform gateway auth,
5
- * hosted MCP auth, Master Control persistence, and SDK session tokens.
6
- */
7
- export declare const SESSION_AUTH_MODES: readonly ["interactive_user", "service_principal", "tenant_api_key", "session_token"];
8
- export type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];
9
- export declare const SESSION_PRINCIPAL_TYPES: readonly ["human", "service", "agent"];
10
- export type SessionPrincipalType = (typeof SESSION_PRINCIPAL_TYPES)[number];
11
- export declare const SESSION_LIFECYCLE_STATUSES: readonly ["active", "expired", "revoked"];
12
- export type SessionLifecycleStatus = (typeof SESSION_LIFECYCLE_STATUSES)[number];
13
- export type SessionDelegationHop = {
14
- principalId: string;
15
- principalType: SessionPrincipalType;
16
- authMode?: SessionAuthMode;
17
- sessionId?: string;
18
- delegatedAt?: number;
19
- reason?: string;
20
- };
21
- export type SessionAuditOutcome = "accepted" | "rejected" | "revoked" | "expired";
22
- export type SessionAuditEnvelope = {
23
- sessionId: string;
24
- authMode: SessionAuthMode;
25
- principalId: string;
26
- principalType: SessionPrincipalType;
27
- tenantId: string;
28
- workspaceId?: string;
29
- apiKeyId?: string;
30
- scopes: readonly string[];
31
- roles?: readonly string[];
32
- delegationChain?: readonly SessionDelegationHop[];
33
- sourceSessionId?: string;
34
- expiresAt?: number;
35
- request?: {
36
- endpoint?: string;
37
- method?: string;
38
- correlationId?: string;
39
- };
40
- result?: {
41
- outcome: SessionAuditOutcome;
42
- reason?: string;
43
- };
44
- };
45
- export declare function inferSessionPrincipalType(principalId: string): SessionPrincipalType;
46
- export declare function normalizeDelegationChain(args: {
47
- delegationChain?: readonly SessionDelegationHop[];
48
- delegatedBy?: string;
49
- delegatedByType?: SessionPrincipalType;
50
- delegatedAt?: number;
51
- reason?: string;
52
- }): SessionDelegationHop[] | undefined;
53
- export declare function lastDelegator(delegationChain?: readonly SessionDelegationHop[]): string | undefined;
54
- //# sourceMappingURL=auth-session.contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-session.contract.d.ts","sourceRoot":"","sources":["../src/auth-session.contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB,uFAKrB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,eAAO,MAAM,uBAAuB,wCAAyC,CAAC;AAC9E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,eAAO,MAAM,0BAA0B,2CAI7B,CAAC;AACX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,MA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CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,oBAAoB,EAAE,GAAG,SAAS,CAgBrC;AAED,wBAAgB,aAAa,CAC3B,eAAe,CAAC,EAAE,SAAS,oBAAoB,EAAE,GAChD,MAAM,GAAG,SAAS,CAKpB"}
@@ -1,50 +0,0 @@
1
- /**
2
- * Session + Delegation Contract
3
- *
4
- * Canonical session lifecycle vocabulary shared by platform gateway auth,
5
- * hosted MCP auth, Master Control persistence, and SDK session tokens.
6
- */
7
- export const SESSION_AUTH_MODES = [
8
- "interactive_user",
9
- "service_principal",
10
- "tenant_api_key",
11
- "session_token",
12
- ];
13
- export const SESSION_PRINCIPAL_TYPES = ["human", "service", "agent"];
14
- export const SESSION_LIFECYCLE_STATUSES = [
15
- "active",
16
- "expired",
17
- "revoked",
18
- ];
19
- export function inferSessionPrincipalType(principalId) {
20
- if (principalId.startsWith("user:")) {
21
- return "human";
22
- }
23
- if (principalId.startsWith("agent:")) {
24
- return "agent";
25
- }
26
- return "service";
27
- }
28
- export function normalizeDelegationChain(args) {
29
- if (args.delegationChain && args.delegationChain.length > 0) {
30
- return [...args.delegationChain];
31
- }
32
- if (!args.delegatedBy) {
33
- return;
34
- }
35
- return [
36
- {
37
- principalId: args.delegatedBy,
38
- principalType: args.delegatedByType ?? inferSessionPrincipalType(args.delegatedBy),
39
- delegatedAt: args.delegatedAt,
40
- reason: args.reason,
41
- },
42
- ];
43
- }
44
- export function lastDelegator(delegationChain) {
45
- if (!delegationChain || delegationChain.length === 0) {
46
- return;
47
- }
48
- return delegationChain[delegationChain.length - 1]?.principalId;
49
- }
50
- //# sourceMappingURL=auth-session.contract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-session.contract.js","sourceRoot":"","sources":["../src/auth-session.contract.ts"],"names":[],"mappings":"AAAA;;;;;GA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