@lucern/contracts 0.1.0-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.
- package/README.md +43 -0
- package/dist/api-enums.contract.d.ts +59 -0
- package/dist/api-enums.contract.d.ts.map +1 -0
- package/dist/api-enums.contract.js +148 -0
- package/dist/api-enums.contract.js.map +1 -0
- package/dist/auth-context.contract.d.ts +9 -0
- package/dist/auth-context.contract.d.ts.map +1 -0
- package/dist/auth-context.contract.js +9 -0
- package/dist/auth-context.contract.js.map +1 -0
- package/dist/auth-session.contract.d.ts +9 -0
- package/dist/auth-session.contract.d.ts.map +1 -0
- package/dist/auth-session.contract.js +9 -0
- package/dist/auth-session.contract.js.map +1 -0
- package/dist/auth.contract.d.ts +89 -0
- package/dist/auth.contract.d.ts.map +1 -0
- package/dist/auth.contract.js +58 -0
- package/dist/auth.contract.js.map +1 -0
- package/dist/context-pack.contract.d.ts +495 -0
- package/dist/context-pack.contract.d.ts.map +1 -0
- package/dist/context-pack.contract.js +170 -0
- package/dist/context-pack.contract.js.map +1 -0
- package/dist/convex-admin.contract.d.ts +6 -0
- package/dist/convex-admin.contract.d.ts.map +1 -0
- package/dist/convex-admin.contract.js +2 -0
- package/dist/convex-admin.contract.js.map +1 -0
- package/dist/events-types.contract.d.ts +9 -0
- package/dist/events-types.contract.d.ts.map +1 -0
- package/dist/events-types.contract.js +9 -0
- package/dist/events-types.contract.js.map +1 -0
- package/dist/events.contract.d.ts +177 -0
- package/dist/events.contract.d.ts.map +1 -0
- package/dist/events.contract.js +160 -0
- package/dist/events.contract.js.map +1 -0
- package/dist/gateway.contract.d.ts +75 -0
- package/dist/gateway.contract.d.ts.map +1 -0
- package/dist/gateway.contract.js +20 -0
- package/dist/gateway.contract.js.map +1 -0
- package/dist/ids.contract.d.ts +8 -0
- package/dist/ids.contract.d.ts.map +1 -0
- package/dist/ids.contract.js +25 -0
- package/dist/ids.contract.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/lens-filter.contract.d.ts +71 -0
- package/dist/lens-filter.contract.d.ts.map +1 -0
- package/dist/lens-filter.contract.js +96 -0
- package/dist/lens-filter.contract.js.map +1 -0
- package/dist/lens-workflow.contract.d.ts +85 -0
- package/dist/lens-workflow.contract.d.ts.map +1 -0
- package/dist/lens-workflow.contract.js +55 -0
- package/dist/lens-workflow.contract.js.map +1 -0
- package/dist/mcp-tools.contract.d.ts +152 -0
- package/dist/mcp-tools.contract.d.ts.map +1 -0
- package/dist/mcp-tools.contract.js +3282 -0
- package/dist/mcp-tools.contract.js.map +1 -0
- package/dist/ontology-matching.contract.d.ts +9 -0
- package/dist/ontology-matching.contract.d.ts.map +1 -0
- package/dist/ontology-matching.contract.js +9 -0
- package/dist/ontology-matching.contract.js.map +1 -0
- package/dist/prompt.contract.d.ts +25 -0
- package/dist/prompt.contract.d.ts.map +1 -0
- package/dist/prompt.contract.js +25 -0
- package/dist/prompt.contract.js.map +1 -0
- package/dist/sdk-methods.contract.d.ts +356 -0
- package/dist/sdk-methods.contract.d.ts.map +1 -0
- package/dist/sdk-methods.contract.js +17 -0
- package/dist/sdk-methods.contract.js.map +1 -0
- package/dist/sdk-tools.contract.d.ts +93 -0
- package/dist/sdk-tools.contract.d.ts.map +1 -0
- package/dist/sdk-tools.contract.js +1399 -0
- package/dist/sdk-tools.contract.js.map +1 -0
- package/dist/text-matching.contract.d.ts +54 -0
- package/dist/text-matching.contract.d.ts.map +1 -0
- package/dist/text-matching.contract.js +278 -0
- package/dist/text-matching.contract.js.map +1 -0
- package/dist/topic-scope.contract.d.ts +9 -0
- package/dist/topic-scope.contract.d.ts.map +1 -0
- package/dist/topic-scope.contract.js +9 -0
- package/dist/topic-scope.contract.js.map +1 -0
- package/dist/v1/agents/v1.d.ts +9 -0
- package/dist/v1/agents/v1.d.ts.map +1 -0
- package/dist/v1/agents/v1.js +2 -0
- package/dist/v1/agents/v1.js.map +1 -0
- package/dist/v1/beliefs/v1.d.ts +9 -0
- package/dist/v1/beliefs/v1.d.ts.map +1 -0
- package/dist/v1/beliefs/v1.js +2 -0
- package/dist/v1/beliefs/v1.js.map +1 -0
- package/dist/v1/evidence/v1.d.ts +9 -0
- package/dist/v1/evidence/v1.d.ts.map +1 -0
- package/dist/v1/evidence/v1.js +2 -0
- package/dist/v1/evidence/v1.js.map +1 -0
- package/dist/v1/graph/v1.d.ts +9 -0
- package/dist/v1/graph/v1.d.ts.map +1 -0
- package/dist/v1/graph/v1.js +2 -0
- package/dist/v1/graph/v1.js.map +1 -0
- package/dist/v1/ontologies/v1.d.ts +77 -0
- package/dist/v1/ontologies/v1.d.ts.map +1 -0
- package/dist/v1/ontologies/v1.js +179 -0
- package/dist/v1/ontologies/v1.js.map +1 -0
- package/dist/v1/questions/v1.d.ts +9 -0
- package/dist/v1/questions/v1.d.ts.map +1 -0
- package/dist/v1/questions/v1.js +2 -0
- package/dist/v1/questions/v1.js.map +1 -0
- package/dist/v1/topics/v1.d.ts +20 -0
- package/dist/v1/topics/v1.d.ts.map +1 -0
- package/dist/v1/topics/v1.js +62 -0
- package/dist/v1/topics/v1.js.map +1 -0
- package/dist/v1/worktrees/v1.d.ts +9 -0
- package/dist/v1/worktrees/v1.d.ts.map +1 -0
- package/dist/v1/worktrees/v1.js +2 -0
- package/dist/v1/worktrees/v1.js.map +1 -0
- package/dist/workflow-runtime.contract.d.ts +162 -0
- package/dist/workflow-runtime.contract.d.ts.map +1 -0
- package/dist/workflow-runtime.contract.js +258 -0
- package/dist/workflow-runtime.contract.js.map +1 -0
- package/package.json +69 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @lucern/contracts
|
|
2
|
+
|
|
3
|
+
Shared boundary contracts and public types for the Lucern reasoning platform.
|
|
4
|
+
|
|
5
|
+
## What's in the box
|
|
6
|
+
|
|
7
|
+
- **Versioned resource namespaces** at `./v1/<resource>/v1.ts`:
|
|
8
|
+
- `@lucern/contracts/v1/beliefs`, `/v1/evidence`, `/v1/questions`, `/v1/topics`,
|
|
9
|
+
`/v1/graph`, `/v1/agents`, `/v1/worktrees`, `/v1/ontologies`
|
|
10
|
+
- These are the contract surfaces for each Lucern resource type. Use them when you
|
|
11
|
+
want to commit to a specific major version of a resource's schema.
|
|
12
|
+
- **Flat support contracts** at the package root:
|
|
13
|
+
- `auth`, `gateway`, `context-pack`, `prompt`, `workflow-runtime`, `lens-filter`,
|
|
14
|
+
`lens-workflow`, `mcp-tools`, `sdk-methods`, `sdk-tools`, `api-enums`,
|
|
15
|
+
`text-matching`, `ids`, `convex-admin`, `events`
|
|
16
|
+
- Cross-cutting surfaces that don't cleanly slot into a single resource namespace.
|
|
17
|
+
|
|
18
|
+
## Stability
|
|
19
|
+
|
|
20
|
+
This package is an **alpha preview** published during the EK-16 code-separation track.
|
|
21
|
+
Breaking changes may land between alpha versions without a major-version bump until
|
|
22
|
+
the first `1.0.0` release.
|
|
23
|
+
|
|
24
|
+
Compatibility barrels at pre-reshape import paths (`auth-context`, `auth-session`,
|
|
25
|
+
`events-types`, `topic-scope`, `ontology-matching`) are retained until the
|
|
26
|
+
`1.0.0` cut to smooth the consumer migration.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
// Versioned resource import (preferred for new code)
|
|
32
|
+
import { ROOT_TOPIC_ID, type TopicDoc } from "@lucern/contracts/v1/topics";
|
|
33
|
+
|
|
34
|
+
// Flat support contract import
|
|
35
|
+
import type { AuthContext } from "@lucern/contracts/auth.contract";
|
|
36
|
+
|
|
37
|
+
// Or via the package-root barrel (re-exports everything)
|
|
38
|
+
import type { AuthContext, TopicDoc } from "@lucern/contracts";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
UNLICENSED — internal Lucern / Stack use. See project root for details.
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
/** Fork reasons — why a scored belief was branched */
|
|
12
|
+
export declare const FORK_REASONS: readonly ["refinement", "contradiction_response", "scope_change", "confidence_collapse", "manual"];
|
|
13
|
+
export type ForkReason = (typeof FORK_REASONS)[number];
|
|
14
|
+
/** Confidence modulation triggers — what caused a confidence change */
|
|
15
|
+
export declare const CONFIDENCE_TRIGGERS: readonly ["evidence_added", "contradiction_detected", "merge_outcome", "manual", "decay"];
|
|
16
|
+
export type ConfidenceTrigger = (typeof CONFIDENCE_TRIGGERS)[number];
|
|
17
|
+
/** Belief status — lifecycle state */
|
|
18
|
+
export declare const BELIEF_STATUSES: readonly ["unscored", "scored", "archived"];
|
|
19
|
+
export type BeliefStatus = (typeof BELIEF_STATUSES)[number];
|
|
20
|
+
/** Reasoning methods — how an edge relationship was determined */
|
|
21
|
+
export declare const REASONING_METHODS: readonly ["deductive", "inductive", "abductive", "analogical", "empirical"];
|
|
22
|
+
export type ReasoningMethod = (typeof REASONING_METHODS)[number];
|
|
23
|
+
/** Defeat types (Pollock taxonomy) — how a contradiction operates */
|
|
24
|
+
export declare const DEFEAT_TYPES: readonly ["rebuts", "undercuts", "undermines"];
|
|
25
|
+
export type DefeatType = (typeof DEFEAT_TYPES)[number];
|
|
26
|
+
/** Contradiction severity levels */
|
|
27
|
+
export declare const CONTRADICTION_SEVERITIES: readonly ["low", "medium", "high", "critical"];
|
|
28
|
+
export type ContradictionSeverity = (typeof CONTRADICTION_SEVERITIES)[number];
|
|
29
|
+
/** Contradiction resolution status */
|
|
30
|
+
export declare const CONTRADICTION_STATUSES: readonly ["unresolved", "resolved", "accepted"];
|
|
31
|
+
export type ContradictionStatus = (typeof CONTRADICTION_STATUSES)[number];
|
|
32
|
+
/** Merge outcome types — how a worktree merge resolved */
|
|
33
|
+
export declare const MERGE_OUTCOMES: readonly ["validated", "invalidated", "forked", "inconclusive"];
|
|
34
|
+
export type MergeOutcome = (typeof MERGE_OUTCOMES)[number];
|
|
35
|
+
/** Worktree phases — investigation lifecycle within a checked-out worktree */
|
|
36
|
+
export declare const WORKTREE_PHASES: readonly ["hypothesis", "investigation", "evaluation", "resolution"];
|
|
37
|
+
export type WorktreePhase = (typeof WORKTREE_PHASES)[number];
|
|
38
|
+
/** Branch status — thematic branch lifecycle */
|
|
39
|
+
export declare const BRANCH_STATUSES: readonly ["dormant", "active", "archived"];
|
|
40
|
+
export type BranchStatus = (typeof BRANCH_STATUSES)[number];
|
|
41
|
+
/** Pull request status — review lifecycle before merge */
|
|
42
|
+
export declare const PULL_REQUEST_STATUSES: readonly ["pending_review", "changes_requested", "approved", "blocked"];
|
|
43
|
+
export type PullRequestStatus = (typeof PULL_REQUEST_STATUSES)[number];
|
|
44
|
+
/** Epistemic layers — the hierarchy of knowledge */
|
|
45
|
+
export declare const EPISTEMIC_LAYERS: readonly ["L1", "L2", "L3", "L4"];
|
|
46
|
+
export type EpistemicLayer = (typeof EPISTEMIC_LAYERS)[number];
|
|
47
|
+
/**
|
|
48
|
+
* Judgment type — classification of the determination.
|
|
49
|
+
*
|
|
50
|
+
* Phase 1: These are new enum values for the Judgment (L4) vocabulary.
|
|
51
|
+
* The existing code uses "Decision" — these are the forward-looking terms
|
|
52
|
+
* that will eventually replace the Decision vocabulary (Phase 2-3).
|
|
53
|
+
*/
|
|
54
|
+
export declare const JUDGMENT_TYPES: readonly ["investment_thesis", "thesis_maturity", "contradiction_ruling", "scope_determination", "confidence_ruling"];
|
|
55
|
+
export type JudgmentType = (typeof JUDGMENT_TYPES)[number];
|
|
56
|
+
/** Core edge types used in the Integration Surfaces */
|
|
57
|
+
export declare const INTEGRATION_EDGE_TYPES: readonly ["informs", "grounds", "answers", "contradicts", "supports", "depends_on", "derived_from", "contains", "supersedes", "tests"];
|
|
58
|
+
export type IntegrationEdgeType = (typeof INTEGRATION_EDGE_TYPES)[number];
|
|
59
|
+
//# sourceMappingURL=api-enums.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-enums.contract.d.ts","sourceRoot":"","sources":["../src/api-enums.contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,sDAAsD;AACtD,eAAO,MAAM,YAAY,oGAMf,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,2FAMtB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,sCAAsC;AACtC,eAAO,MAAM,eAAe,6CAIlB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAM5D,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,6EAMpB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,qEAAqE;AACrE,eAAO,MAAM,YAAY,gDAIf,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,oCAAoC;AACpC,eAAO,MAAM,wBAAwB,gDAK3B,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,sCAAsC;AACtC,eAAO,MAAM,sBAAsB,iDAIzB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAM1E,0DAA0D;AAC1D,eAAO,MAAM,cAAc,iEAKjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,8EAA8E;AAC9E,eAAO,MAAM,eAAe,sEAKlB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAM7D,gDAAgD;AAChD,eAAO,MAAM,eAAe,4CAIlB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAM5D,0DAA0D;AAC1D,eAAO,MAAM,qBAAqB,yEAKxB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAMvE,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,mCAKnB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAM/D;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,uHAMjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAM3D,uDAAuD;AACvD,eAAO,MAAM,sBAAsB,wIAczB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;AAC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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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth-context compat shim
|
|
3
|
+
*
|
|
4
|
+
* This file consolidated into ./auth.contract.ts during EK-16 T1 PR 3a.
|
|
5
|
+
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
+
* New code should import from "@lucern/contracts" (barrel) or "./auth.contract".
|
|
7
|
+
*/
|
|
8
|
+
export * from "./auth.contract";
|
|
9
|
+
//# sourceMappingURL=auth-context.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-context.contract.d.ts","sourceRoot":"","sources":["../src/auth-context.contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth-context compat shim
|
|
3
|
+
*
|
|
4
|
+
* This file consolidated into ./auth.contract.ts during EK-16 T1 PR 3a.
|
|
5
|
+
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
+
* New code should import from "@lucern/contracts" (barrel) or "./auth.contract".
|
|
7
|
+
*/
|
|
8
|
+
export * from "./auth.contract";
|
|
9
|
+
//# sourceMappingURL=auth-context.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-context.contract.js","sourceRoot":"","sources":["../src/auth-context.contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth-session compat shim
|
|
3
|
+
*
|
|
4
|
+
* This file consolidated into ./auth.contract.ts during EK-16 T1 PR 3a.
|
|
5
|
+
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
+
* New code should import from "@lucern/contracts" (barrel) or "./auth.contract".
|
|
7
|
+
*/
|
|
8
|
+
export * from "./auth.contract";
|
|
9
|
+
//# sourceMappingURL=auth-session.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-session.contract.d.ts","sourceRoot":"","sources":["../src/auth-session.contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth-session compat shim
|
|
3
|
+
*
|
|
4
|
+
* This file consolidated into ./auth.contract.ts during EK-16 T1 PR 3a.
|
|
5
|
+
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
+
* New code should import from "@lucern/contracts" (barrel) or "./auth.contract".
|
|
7
|
+
*/
|
|
8
|
+
export * from "./auth.contract";
|
|
9
|
+
//# sourceMappingURL=auth-session.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-session.contract.js","sourceRoot":"","sources":["../src/auth-session.contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth (canonical support contract)
|
|
3
|
+
*
|
|
4
|
+
* Consolidated flat support surface for Lucern authentication:
|
|
5
|
+
* - Session primitives (auth modes, principal types, lifecycle)
|
|
6
|
+
* - AuthContext shape + McpTransportKind + LucernSdkClient alias
|
|
7
|
+
*
|
|
8
|
+
* Consolidated from src/auth-session.contract.ts and src/auth-context.contract.ts
|
|
9
|
+
* in EK-16 T1 PR 3a. Compat shims remain at both old paths until Lucern 1.0.0 (D12).
|
|
10
|
+
*/
|
|
11
|
+
export declare const SESSION_AUTH_MODES: readonly ["interactive_user", "service_principal", "tenant_api_key", "session_token"];
|
|
12
|
+
export type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];
|
|
13
|
+
export declare const SESSION_PRINCIPAL_TYPES: readonly ["human", "service", "agent"];
|
|
14
|
+
export type SessionPrincipalType = (typeof SESSION_PRINCIPAL_TYPES)[number];
|
|
15
|
+
export declare const SESSION_LIFECYCLE_STATUSES: readonly ["active", "expired", "revoked"];
|
|
16
|
+
export type SessionLifecycleStatus = (typeof SESSION_LIFECYCLE_STATUSES)[number];
|
|
17
|
+
export type SessionDelegationHop = {
|
|
18
|
+
principalId: string;
|
|
19
|
+
principalType: SessionPrincipalType;
|
|
20
|
+
authMode?: SessionAuthMode;
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
delegatedAt?: number;
|
|
23
|
+
reason?: string;
|
|
24
|
+
};
|
|
25
|
+
export type SessionAuditOutcome = "accepted" | "rejected" | "revoked" | "expired";
|
|
26
|
+
export type SessionAuditEnvelope = {
|
|
27
|
+
sessionId: string;
|
|
28
|
+
authMode: SessionAuthMode;
|
|
29
|
+
principalId: string;
|
|
30
|
+
principalType: SessionPrincipalType;
|
|
31
|
+
tenantId: string;
|
|
32
|
+
workspaceId?: string;
|
|
33
|
+
apiKeyId?: string;
|
|
34
|
+
scopes: readonly string[];
|
|
35
|
+
roles?: readonly string[];
|
|
36
|
+
delegationChain?: readonly SessionDelegationHop[];
|
|
37
|
+
sourceSessionId?: string;
|
|
38
|
+
expiresAt?: number;
|
|
39
|
+
request?: {
|
|
40
|
+
endpoint?: string;
|
|
41
|
+
method?: string;
|
|
42
|
+
correlationId?: string;
|
|
43
|
+
};
|
|
44
|
+
result?: {
|
|
45
|
+
outcome: SessionAuditOutcome;
|
|
46
|
+
reason?: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function inferSessionPrincipalType(principalId: string): SessionPrincipalType;
|
|
50
|
+
export declare function normalizeDelegationChain(args: {
|
|
51
|
+
delegationChain?: readonly SessionDelegationHop[];
|
|
52
|
+
delegatedBy?: string;
|
|
53
|
+
delegatedByType?: SessionPrincipalType;
|
|
54
|
+
delegatedAt?: number;
|
|
55
|
+
reason?: string;
|
|
56
|
+
}): SessionDelegationHop[] | undefined;
|
|
57
|
+
export declare function lastDelegator(delegationChain?: readonly SessionDelegationHop[]): string | undefined;
|
|
58
|
+
import type { ConvexAdminClient } from "./convex-admin.contract";
|
|
59
|
+
export type McpTransportKind = "stdio" | "hosted";
|
|
60
|
+
export type LucernSdkClient = unknown;
|
|
61
|
+
/**
|
|
62
|
+
* Session authentication context — injected by withAuth() middleware.
|
|
63
|
+
*
|
|
64
|
+
* Built from TenantConfig at dispatch time. Agent sessions get
|
|
65
|
+
* AGENT_IDENTITY + "agent:internal" role + unrestricted access.
|
|
66
|
+
* User sessions get Clerk userId + resolved role + tool ACLs.
|
|
67
|
+
*/
|
|
68
|
+
export type AuthContext = {
|
|
69
|
+
sessionType: "agent" | "user";
|
|
70
|
+
userId: string;
|
|
71
|
+
tenantId: string;
|
|
72
|
+
role: string;
|
|
73
|
+
allowedTopics: string[] | null;
|
|
74
|
+
groupIds: string[];
|
|
75
|
+
permittedPackKeys: string[];
|
|
76
|
+
sessionId: string;
|
|
77
|
+
principalId?: string;
|
|
78
|
+
principalType?: SessionPrincipalType;
|
|
79
|
+
workspaceId?: string;
|
|
80
|
+
scopes?: string[];
|
|
81
|
+
authMode?: SessionAuthMode;
|
|
82
|
+
roles?: string[];
|
|
83
|
+
transportKind?: McpTransportKind;
|
|
84
|
+
lucernClient?: LucernSdkClient;
|
|
85
|
+
convex?: ConvexAdminClient;
|
|
86
|
+
setDefaultScopeContext?: (scopeId: string) => Promise<unknown>;
|
|
87
|
+
matchesWorkspaceReasoningScope?: (node: unknown, scope: unknown) => boolean;
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=auth.contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.contract.d.ts","sourceRoot":"","sources":["../src/auth.contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,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,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B,UAAU,GACV,UAAU,GACV,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,oBAAoB,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,KAA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AM,EAAE,GAAG,IAAI,CAAC;IAE/B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,8BAA8B,CAAC,EAAE,CAC/B,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,KACX,OAAO,CAAC;CACd,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth (canonical support contract)
|
|
3
|
+
*
|
|
4
|
+
* Consolidated flat support surface for Lucern authentication:
|
|
5
|
+
* - Session primitives (auth modes, principal types, lifecycle)
|
|
6
|
+
* - AuthContext shape + McpTransportKind + LucernSdkClient alias
|
|
7
|
+
*
|
|
8
|
+
* Consolidated from src/auth-session.contract.ts and src/auth-context.contract.ts
|
|
9
|
+
* in EK-16 T1 PR 3a. Compat shims remain at both old paths until Lucern 1.0.0 (D12).
|
|
10
|
+
*/
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// SESSION PRIMITIVES
|
|
13
|
+
// (Formerly src/auth-session.contract.ts)
|
|
14
|
+
// =============================================================================
|
|
15
|
+
export const SESSION_AUTH_MODES = [
|
|
16
|
+
"interactive_user",
|
|
17
|
+
"service_principal",
|
|
18
|
+
"tenant_api_key",
|
|
19
|
+
"session_token",
|
|
20
|
+
];
|
|
21
|
+
export const SESSION_PRINCIPAL_TYPES = ["human", "service", "agent"];
|
|
22
|
+
export const SESSION_LIFECYCLE_STATUSES = [
|
|
23
|
+
"active",
|
|
24
|
+
"expired",
|
|
25
|
+
"revoked",
|
|
26
|
+
];
|
|
27
|
+
export function inferSessionPrincipalType(principalId) {
|
|
28
|
+
if (principalId.startsWith("user:")) {
|
|
29
|
+
return "human";
|
|
30
|
+
}
|
|
31
|
+
if (principalId.startsWith("agent:")) {
|
|
32
|
+
return "agent";
|
|
33
|
+
}
|
|
34
|
+
return "service";
|
|
35
|
+
}
|
|
36
|
+
export function normalizeDelegationChain(args) {
|
|
37
|
+
if (args.delegationChain && args.delegationChain.length > 0) {
|
|
38
|
+
return [...args.delegationChain];
|
|
39
|
+
}
|
|
40
|
+
if (!args.delegatedBy) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
principalId: args.delegatedBy,
|
|
46
|
+
principalType: args.delegatedByType ?? inferSessionPrincipalType(args.delegatedBy),
|
|
47
|
+
delegatedAt: args.delegatedAt,
|
|
48
|
+
reason: args.reason,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
export function lastDelegator(delegationChain) {
|
|
53
|
+
if (!delegationChain || delegationChain.length === 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
return delegationChain[delegationChain.length - 1]?.principalId;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=auth.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.contract.js","sourceRoot":"","sources":["../src/auth.contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,gFAAgF;AAChF,qBAAqB;AACrB,0CAA0C;AAC1C,gFAAgF;AAEhF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,kBA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