@lucern/sdk 0.2.0-alpha.1 → 0.2.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +691 -61
- package/dist/adminClient.d.ts +409 -0
- package/dist/adminClient.js +755 -0
- package/dist/adminClient.js.map +1 -0
- package/dist/answersClient.d.ts +23 -0
- package/dist/answersClient.js +333 -0
- package/dist/answersClient.js.map +1 -0
- package/dist/{packages/sdk/src/audiencesClient.d.ts → audiencesClient.d.ts} +30 -18
- package/dist/audiencesClient.js +472 -0
- package/dist/audiencesClient.js.map +1 -0
- package/dist/auditClient.d.ts +29 -0
- package/dist/auditClient.js +386 -0
- package/dist/auditClient.js.map +1 -0
- package/dist/beliefsClient.d.ts +242 -0
- package/dist/beliefsClient.js +616 -0
- package/dist/beliefsClient.js.map +1 -0
- package/dist/client.d.ts +2398 -0
- package/dist/client.js +6378 -0
- package/dist/client.js.map +1 -0
- package/dist/contextClient.d.ts +27 -0
- package/dist/contextClient.js +396 -0
- package/dist/contextClient.js.map +1 -0
- package/dist/contextFacade.d.ts +2 -0
- package/dist/contextFacade.js +73 -0
- package/dist/contextFacade.js.map +1 -0
- package/dist/{lucern/packages/domain-context/src/context-pack-compiler.d.ts → contextPackCompiler.d.ts} +11 -10
- package/dist/contextPackCompiler.js +1091 -0
- package/dist/contextPackCompiler.js.map +1 -0
- package/dist/contextPackPolicy.d.ts +84 -0
- package/dist/contextPackPolicy.js +347 -0
- package/dist/contextPackPolicy.js.map +1 -0
- package/dist/contextPackSchema.d.ts +7 -0
- package/dist/contextPackSchema.js +203 -0
- package/dist/contextPackSchema.js.map +1 -0
- package/dist/contextTypes.d.ts +135 -0
- package/dist/contextTypes.js +3 -0
- package/dist/contextTypes.js.map +1 -0
- package/dist/contracts/api-enums.contract.d.ts +81 -0
- package/dist/contracts/api-enums.contract.js +98 -0
- package/dist/contracts/api-enums.contract.js.map +1 -0
- package/dist/{lucern/contracts/src → contracts}/auth-session.contract.d.ts +14 -12
- package/dist/contracts/auth-session.contract.js +48 -0
- package/dist/contracts/auth-session.contract.js.map +1 -0
- package/dist/{lucern/contracts/src → contracts}/context-pack.contract.d.ts +56 -58
- package/dist/contracts/context-pack.contract.js +98 -0
- package/dist/contracts/context-pack.contract.js.map +1 -0
- package/dist/contracts/contextPack.d.ts +1 -0
- package/dist/contracts/contextPack.js +98 -0
- package/dist/contracts/contextPack.js.map +1 -0
- package/dist/contracts/index.d.ts +9 -0
- package/dist/contracts/index.js +4928 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/{lucern/contracts/src → contracts}/lens-filter.contract.d.ts +10 -8
- package/dist/contracts/lens-filter.contract.js +71 -0
- package/dist/contracts/lens-filter.contract.js.map +1 -0
- package/dist/contracts/lens-workflow.contract.d.ts +87 -0
- package/dist/contracts/lens-workflow.contract.js +123 -0
- package/dist/contracts/lens-workflow.contract.js.map +1 -0
- package/dist/contracts/lensFilter.d.ts +1 -0
- package/dist/contracts/lensFilter.js +71 -0
- package/dist/contracts/lensFilter.js.map +1 -0
- package/dist/contracts/lensWorkflow.d.ts +2 -0
- package/dist/contracts/lensWorkflow.js +123 -0
- package/dist/contracts/lensWorkflow.js.map +1 -0
- package/dist/contracts/mcp-tools.contract.d.ts +1 -0
- package/dist/contracts/mcp-tools.contract.js +3016 -0
- package/dist/contracts/mcp-tools.contract.js.map +1 -0
- package/dist/contracts/mcpTools.d.ts +1 -0
- package/dist/contracts/mcpTools.js +3016 -0
- package/dist/contracts/mcpTools.js.map +1 -0
- package/dist/contracts/prompt.contract.d.ts +26 -0
- package/dist/contracts/prompt.contract.js +12 -0
- package/dist/contracts/prompt.contract.js.map +1 -0
- package/dist/contracts/prompt.d.ts +1 -0
- package/dist/contracts/prompt.js +12 -0
- package/dist/contracts/prompt.js.map +1 -0
- package/dist/contracts/sdk-tools.contract.d.ts +2 -0
- package/dist/contracts/sdk-tools.contract.js +4164 -0
- package/dist/contracts/sdk-tools.contract.js.map +1 -0
- package/dist/contracts/sdkTools.d.ts +2 -0
- package/dist/contracts/sdkTools.js +4164 -0
- package/dist/contracts/sdkTools.js.map +1 -0
- package/dist/contracts/workflow-runtime.contract.d.ts +163 -0
- package/dist/contracts/workflow-runtime.contract.js +245 -0
- package/dist/contracts/workflow-runtime.contract.js.map +1 -0
- package/dist/contracts/workflowRuntime.d.ts +1 -0
- package/dist/contracts/workflowRuntime.js +245 -0
- package/dist/contracts/workflowRuntime.js.map +1 -0
- package/dist/{packages/sdk/src/controlObjectOwnership.d.ts → controlObjectOwnership.d.ts} +35 -18
- package/dist/controlObjectOwnership.js +215 -0
- package/dist/controlObjectOwnership.js.map +1 -0
- package/dist/{packages/sdk/src/coreClient.d.ts → coreClient.d.ts} +38 -14
- package/dist/coreClient.js +339 -0
- package/dist/coreClient.js.map +1 -0
- package/dist/customTools.d.ts +88 -0
- package/dist/customTools.js +248 -0
- package/dist/customTools.js.map +1 -0
- package/dist/decisionsClient.d.ts +111 -0
- package/dist/decisionsClient.js +522 -0
- package/dist/decisionsClient.js.map +1 -0
- package/dist/domainContext.d.ts +1 -0
- package/dist/domainContext.js +3 -0
- package/dist/domainContext.js.map +1 -0
- package/dist/events.d.ts +178 -0
- package/dist/events.js +249 -0
- package/dist/events.js.map +1 -0
- package/dist/eventsCore.d.ts +49 -0
- package/dist/eventsCore.js +429 -0
- package/dist/eventsCore.js.map +1 -0
- package/dist/evidenceClient.d.ts +119 -0
- package/dist/evidenceClient.js +350 -0
- package/dist/evidenceClient.js.map +1 -0
- package/dist/facade/context.d.ts +18 -0
- package/dist/facade/context.js +73 -0
- package/dist/facade/context.js.map +1 -0
- package/dist/gatewayFacades.d.ts +589 -0
- package/dist/gatewayFacades.js +1976 -0
- package/dist/gatewayFacades.js.map +1 -0
- package/dist/graphClient.d.ts +271 -0
- package/dist/graphClient.js +698 -0
- package/dist/graphClient.js.map +1 -0
- package/dist/{packages/sdk/src/harnessClient.d.ts → harnessClient.d.ts} +127 -35
- package/dist/harnessClient.js +607 -0
- package/dist/harnessClient.js.map +1 -0
- package/dist/identityClient.d.ts +140 -0
- package/dist/identityClient.js +497 -0
- package/dist/identityClient.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +5263 -2579
- package/dist/index.js.map +1 -1
- package/dist/learningClient.d.ts +46 -0
- package/dist/learningClient.js +409 -0
- package/dist/learningClient.js.map +1 -0
- package/dist/{packages/sdk/src/mcpParityClient.d.ts → mcpParityClient.d.ts} +11 -5
- package/dist/mcpParityClient.js +516 -0
- package/dist/mcpParityClient.js.map +1 -0
- package/dist/mcpParitySurface.d.ts +12 -0
- package/dist/mcpParitySurface.js +65 -0
- package/dist/mcpParitySurface.js.map +1 -0
- package/dist/mcpTools-DPZxowDX.d.ts +254 -0
- package/dist/{packages/sdk/src/ontologyClient.d.ts → ontologyClient.d.ts} +44 -22
- package/dist/ontologyClient.js +513 -0
- package/dist/ontologyClient.js.map +1 -0
- package/dist/packRuntime.d.ts +2 -0
- package/dist/packRuntime.js +3 -0
- package/dist/packRuntime.js.map +1 -0
- package/dist/packsClient.d.ts +131 -0
- package/dist/packsClient.js +525 -0
- package/dist/packsClient.js.map +1 -0
- package/dist/{packages/sdk/src/policyClient.d.ts → policyClient.d.ts} +113 -18
- package/dist/policyClient.js +625 -0
- package/dist/policyClient.js.map +1 -0
- package/dist/realtime/index.d.ts +29 -0
- package/dist/realtime/index.js +23 -0
- package/dist/realtime/index.js.map +1 -0
- package/dist/realtime/refs.d.ts +17 -0
- package/dist/realtime/refs.js +9 -0
- package/dist/realtime/refs.js.map +1 -0
- package/dist/reportsClient.d.ts +41 -0
- package/dist/reportsClient.js +418 -0
- package/dist/reportsClient.js.map +1 -0
- package/dist/schemaClient.d.ts +64 -0
- package/dist/schemaClient.js +434 -0
- package/dist/schemaClient.js.map +1 -0
- package/dist/sdkSurface.d.ts +61 -0
- package/dist/sdkSurface.js +112 -0
- package/dist/sdkSurface.js.map +1 -0
- package/dist/sdkTools-CwXJDACb.d.ts +150 -0
- package/dist/sourcesClient.d.ts +24 -0
- package/dist/sourcesClient.js +339 -0
- package/dist/sourcesClient.js.map +1 -0
- package/dist/topicsClient.d.ts +84 -0
- package/dist/topicsClient.js +492 -0
- package/dist/topicsClient.js.map +1 -0
- package/dist/types.d.ts +715 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/workflowClient.d.ts +316 -0
- package/dist/workflowClient.js +830 -0
- package/dist/workflowClient.js.map +1 -0
- package/package.json +41 -37
- package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
- package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
- package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +0 -161
- package/dist/lucern/mcp-server/src/context-pack-policy.d.ts +0 -119
- package/dist/lucern/mcp-server/src/context-pack-schema.d.ts +0 -18
- package/dist/lucern/modules/graph-primitives/src/ontology-matching.d.ts +0 -78
- package/dist/lucern/modules/graph-primitives/src/text-matching.d.ts +0 -53
- package/dist/lucern/packages/client-core/src/beliefs.d.ts +0 -30
- package/dist/lucern/packages/client-core/src/context.d.ts +0 -29
- package/dist/lucern/packages/client-core/src/contradictions.d.ts +0 -11
- package/dist/lucern/packages/client-core/src/edges.d.ts +0 -11
- package/dist/lucern/packages/client-core/src/events.d.ts +0 -9
- package/dist/lucern/packages/client-core/src/evidence.d.ts +0 -21
- package/dist/lucern/packages/client-core/src/graph.d.ts +0 -17
- package/dist/lucern/packages/client-core/src/identity.d.ts +0 -7
- package/dist/lucern/packages/client-core/src/ids.d.ts +0 -7
- package/dist/lucern/packages/client-core/src/ontologies.d.ts +0 -13
- package/dist/lucern/packages/client-core/src/questions.d.ts +0 -39
- package/dist/lucern/packages/client-core/src/search.d.ts +0 -7
- package/dist/lucern/packages/client-core/src/tasks.d.ts +0 -13
- package/dist/lucern/packages/client-core/src/topics.d.ts +0 -17
- package/dist/lucern/packages/client-core/src/webhooks.d.ts +0 -35
- package/dist/lucern/packages/client-core/src/worktrees.d.ts +0 -17
- package/dist/lucern/packages/domain-beliefs/src/beliefs.d.ts +0 -283
- package/dist/lucern/packages/domain-beliefs/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-context/src/compile.d.ts +0 -11
- package/dist/lucern/packages/domain-context/src/index.d.ts +0 -4
- package/dist/lucern/packages/domain-context/src/ports.d.ts +0 -58
- package/dist/lucern/packages/domain-context/src/public-types.d.ts +0 -1
- package/dist/lucern/packages/domain-edges/src/contradictions.d.ts +0 -59
- package/dist/lucern/packages/domain-edges/src/edges.d.ts +0 -91
- package/dist/lucern/packages/domain-edges/src/index.d.ts +0 -2
- package/dist/lucern/packages/domain-evidence/src/evidence.d.ts +0 -115
- package/dist/lucern/packages/domain-evidence/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-graph/src/graph.d.ts +0 -150
- package/dist/lucern/packages/domain-identity/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-identity/src/whoami.d.ts +0 -13
- package/dist/lucern/packages/domain-ontologies/src/ontologies.d.ts +0 -123
- package/dist/lucern/packages/domain-questions/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-questions/src/questions.d.ts +0 -147
- package/dist/lucern/packages/domain-search/src/search.d.ts +0 -97
- package/dist/lucern/packages/domain-tasks/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-tasks/src/tasks.d.ts +0 -102
- package/dist/lucern/packages/domain-topics/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-topics/src/topics.d.ts +0 -147
- package/dist/lucern/packages/domain-worktrees/src/index.d.ts +0 -1
- package/dist/lucern/packages/domain-worktrees/src/worktrees.d.ts +0 -185
- package/dist/lucern/packages/events/src/index.d.ts +0 -4
- package/dist/lucern/packages/events/src/matching.d.ts +0 -3
- package/dist/lucern/packages/events/src/outbox.d.ts +0 -15
- package/dist/lucern/packages/events/src/types.d.ts +0 -151
- package/dist/lucern/packages/events/src/webhooks.d.ts +0 -9
- package/dist/lucern/packages/sdk-typescript/src/facade/beliefs.d.ts +0 -15
- package/dist/lucern/packages/sdk-typescript/src/facade/context.d.ts +0 -12
- package/dist/lucern/packages/sdk-typescript/src/facade/contradictions.d.ts +0 -7
- package/dist/lucern/packages/sdk-typescript/src/facade/edges.d.ts +0 -7
- package/dist/lucern/packages/sdk-typescript/src/facade/events.d.ts +0 -6
- package/dist/lucern/packages/sdk-typescript/src/facade/evidence.d.ts +0 -21
- package/dist/lucern/packages/sdk-typescript/src/facade/graph.d.ts +0 -10
- package/dist/lucern/packages/sdk-typescript/src/facade/identity.d.ts +0 -5
- package/dist/lucern/packages/sdk-typescript/src/facade/ontologies.d.ts +0 -8
- package/dist/lucern/packages/sdk-typescript/src/facade/questions.d.ts +0 -39
- package/dist/lucern/packages/sdk-typescript/src/facade/search.d.ts +0 -5
- package/dist/lucern/packages/sdk-typescript/src/facade/tasks.d.ts +0 -8
- package/dist/lucern/packages/sdk-typescript/src/facade/topics.d.ts +0 -10
- package/dist/lucern/packages/sdk-typescript/src/facade/webhooks.d.ts +0 -16
- package/dist/lucern/packages/sdk-typescript/src/facade/worktrees.d.ts +0 -10
- package/dist/lucern/packages/sdk-typescript/src/index.d.ts +0 -28
- package/dist/packages/sdk/src/adminClient.d.ts +0 -89
- package/dist/packages/sdk/src/answersClient.d.ts +0 -5
- package/dist/packages/sdk/src/auditClient.d.ts +0 -23
- package/dist/packages/sdk/src/beliefsClient.d.ts +0 -54
- package/dist/packages/sdk/src/client.d.ts +0 -1610
- package/dist/packages/sdk/src/contextClient.d.ts +0 -9
- package/dist/packages/sdk/src/contracts/api-enums.contract.d.ts +0 -58
- package/dist/packages/sdk/src/customTools.d.ts +0 -65
- package/dist/packages/sdk/src/decisionsClient.d.ts +0 -110
- package/dist/packages/sdk/src/graphClient.d.ts +0 -209
- package/dist/packages/sdk/src/identityClient.d.ts +0 -104
- package/dist/packages/sdk/src/index.d.ts +0 -28
- package/dist/packages/sdk/src/learningClient.d.ts +0 -43
- package/dist/packages/sdk/src/mcpParitySurface.d.ts +0 -8
- package/dist/packages/sdk/src/packsClient.d.ts +0 -101
- package/dist/packages/sdk/src/reportsClient.d.ts +0 -31
- package/dist/packages/sdk/src/schemaClient.d.ts +0 -54
- package/dist/packages/sdk/src/sdkSurface.d.ts +0 -56
- package/dist/packages/sdk/src/topicsClient.d.ts +0 -45
- package/dist/packages/sdk/src/types.d.ts +0 -489
- package/dist/packages/sdk/src/version.d.ts +0 -2
- package/dist/packages/sdk/src/workflowClient.d.ts +0 -274
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - Changing the version string is BREAKING (consumers check it)
|
|
15
15
|
*/
|
|
16
16
|
/** Canonical version string. Consumers MUST check this field for compatibility. */
|
|
17
|
-
|
|
17
|
+
declare const CONTEXT_PACK_SCHEMA_VERSION: "1.0.0";
|
|
18
18
|
/**
|
|
19
19
|
* Available ranking profiles for context-pack assembly.
|
|
20
20
|
*
|
|
@@ -22,9 +22,9 @@ export declare const CONTEXT_PACK_SCHEMA_VERSION: "1.0.0";
|
|
|
22
22
|
* - `weighted_v1`: Multi-signal scoring combining query relevance, recency, confidence,
|
|
23
23
|
* belief type, priority, and severity with section-specific weight vectors.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
type ContextRankingProfile = "baseline_v1" | "weighted_v1";
|
|
26
|
+
declare const CONTEXT_RANKING_PROFILES: readonly ContextRankingProfile[];
|
|
27
|
+
declare const DEFAULT_RANKING_PROFILE: ContextRankingProfile;
|
|
28
28
|
/**
|
|
29
29
|
* Context compilation mode.
|
|
30
30
|
*
|
|
@@ -32,14 +32,14 @@ export declare const DEFAULT_RANKING_PROFILE: ContextRankingProfile;
|
|
|
32
32
|
* - `delta`: Diff-aware — adds failure context, verification obligations,
|
|
33
33
|
* and worktree ledger analysis to the standard context pack.
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
type ContextCompilationMode = "standard" | "delta";
|
|
36
|
+
declare const DEFAULT_COMPILATION_MODE: ContextCompilationMode;
|
|
37
37
|
/**
|
|
38
38
|
* The five canonical sections of a context pack.
|
|
39
39
|
* Order matters: invariants are injected first, contradictions last.
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
type ContextPackSectionKey = "invariants" | "activeBeliefs" | "openQuestions" | "recentEvidence" | "contradictions";
|
|
42
|
+
declare const CONTEXT_PACK_SECTION_KEYS: readonly ContextPackSectionKey[];
|
|
43
43
|
/**
|
|
44
44
|
* Token budget allocation ratios per section.
|
|
45
45
|
* These sum to 1.0 and determine how the total tokenBudget is divided.
|
|
@@ -51,19 +51,19 @@ export declare const CONTEXT_PACK_SECTION_KEYS: readonly ContextPackSectionKey[]
|
|
|
51
51
|
* - recentEvidence (0.17): Implementation context for grounding
|
|
52
52
|
* - contradictions (0.08): Tension signals, smallest section
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
declare const SECTION_BUDGET_RATIOS: Readonly<Record<ContextPackSectionKey, number>>;
|
|
55
55
|
/** Minimum allowed token budget. Below this, context packs lose utility. */
|
|
56
|
-
|
|
56
|
+
declare const MIN_TOKEN_BUDGET = 400;
|
|
57
57
|
/** Maximum allowed token budget. Above this, context packs bloat prompts. */
|
|
58
|
-
|
|
58
|
+
declare const MAX_TOKEN_BUDGET = 8000;
|
|
59
59
|
/** Default token budget when caller does not specify. */
|
|
60
|
-
|
|
60
|
+
declare const DEFAULT_TOKEN_BUDGET = 1800;
|
|
61
61
|
/** Default max items per section. */
|
|
62
|
-
|
|
62
|
+
declare const DEFAULT_SECTION_LIMIT = 8;
|
|
63
63
|
/** Hard ceiling on items per section. */
|
|
64
|
-
|
|
64
|
+
declare const MAX_SECTION_LIMIT = 25;
|
|
65
65
|
/** Minimum contradiction section budget floor (tokens). */
|
|
66
|
-
|
|
66
|
+
declare const MIN_CONTRADICTION_BUDGET = 40;
|
|
67
67
|
/**
|
|
68
68
|
* Weight vectors for the weighted_v1 ranking profile.
|
|
69
69
|
* Each section has a different signal mix:
|
|
@@ -75,7 +75,7 @@ export declare const MIN_CONTRADICTION_BUDGET = 40;
|
|
|
75
75
|
* - priority: Question priority (critical > high > medium > low)
|
|
76
76
|
* - severity: Contradiction severity (critical > high > medium > low)
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
type RankingWeightVector = {
|
|
79
79
|
query: number;
|
|
80
80
|
recency: number;
|
|
81
81
|
confidence?: number;
|
|
@@ -83,35 +83,35 @@ export type RankingWeightVector = {
|
|
|
83
83
|
priority?: number;
|
|
84
84
|
severity?: number;
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
declare const RANKING_WEIGHTS: Readonly<Record<ContextPackSectionKey, RankingWeightVector>>;
|
|
87
87
|
/** Recency decay half-life in days. After 30 days, recency score = 0.5. */
|
|
88
|
-
|
|
88
|
+
declare const RECENCY_HALF_LIFE_DAYS = 30;
|
|
89
89
|
/**
|
|
90
90
|
* Ranking weight vector for the relatedEntities section.
|
|
91
91
|
* Entities are ranked by query relevance and connectivity (bridge edge count).
|
|
92
92
|
* Separate from RANKING_WEIGHTS because entities are not part of the
|
|
93
93
|
* token-budgeted injection plan.
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
declare const ENTITY_RANKING_WEIGHTS: {
|
|
96
96
|
readonly query: 0.4;
|
|
97
97
|
readonly connectivity: 0.6;
|
|
98
98
|
};
|
|
99
99
|
/** Default max entities to include in the context pack. */
|
|
100
|
-
|
|
100
|
+
declare const DEFAULT_ENTITY_LIMIT = 10;
|
|
101
101
|
/** Hard ceiling on entities per context pack. */
|
|
102
|
-
|
|
102
|
+
declare const MAX_ENTITY_LIMIT = 50;
|
|
103
103
|
/**
|
|
104
104
|
* Bonus multiplier for belief types in ranking.
|
|
105
105
|
* Invariants get 1.0, unknown types get 0.4.
|
|
106
106
|
*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
declare const BELIEF_TYPE_BONUS: Readonly<Record<string, number>>;
|
|
108
|
+
declare const DEFAULT_BELIEF_TYPE_BONUS = 0.4;
|
|
109
|
+
declare const PRIORITY_SCORES: Readonly<Record<string, number>>;
|
|
110
|
+
declare const DEFAULT_PRIORITY_SCORE = 0.5;
|
|
111
|
+
declare const SEVERITY_SCORES: Readonly<Record<string, number>>;
|
|
112
|
+
declare const DEFAULT_SEVERITY_SCORE = 0.5;
|
|
113
113
|
/** A ranked belief in the invariants or activeBeliefs section. */
|
|
114
|
-
|
|
114
|
+
type ContextPackBelief = {
|
|
115
115
|
nodeId: string;
|
|
116
116
|
canonicalText: string;
|
|
117
117
|
confidence: number | null;
|
|
@@ -124,7 +124,7 @@ export type ContextPackBelief = {
|
|
|
124
124
|
justification?: string;
|
|
125
125
|
};
|
|
126
126
|
/** A ranked question in the openQuestions section. */
|
|
127
|
-
|
|
127
|
+
type ContextPackQuestion = {
|
|
128
128
|
questionId: string;
|
|
129
129
|
text: string;
|
|
130
130
|
status: string;
|
|
@@ -135,7 +135,7 @@ export type ContextPackQuestion = {
|
|
|
135
135
|
justification?: string;
|
|
136
136
|
};
|
|
137
137
|
/** A ranked evidence item in the recentEvidence section. */
|
|
138
|
-
|
|
138
|
+
type ContextPackEvidence = {
|
|
139
139
|
nodeId: string;
|
|
140
140
|
canonicalText: string;
|
|
141
141
|
sourceUrl: string | null;
|
|
@@ -146,7 +146,7 @@ export type ContextPackEvidence = {
|
|
|
146
146
|
justification?: string;
|
|
147
147
|
};
|
|
148
148
|
/** A ranked contradiction in the contradictions section. */
|
|
149
|
-
|
|
149
|
+
type ContextPackContradiction = {
|
|
150
150
|
contradictionId: string;
|
|
151
151
|
severity: string;
|
|
152
152
|
status: string;
|
|
@@ -161,7 +161,7 @@ export type ContextPackContradiction = {
|
|
|
161
161
|
* to beliefs via bridge edges. They provide the "reality anchor" that makes
|
|
162
162
|
* the reasoning graph domain-aware.
|
|
163
163
|
*/
|
|
164
|
-
|
|
164
|
+
type ContextPackEntity = {
|
|
165
165
|
/** Convex document ID of the entity node. */
|
|
166
166
|
nodeId: string;
|
|
167
167
|
/** Entity type (e.g., "company", "person", "function"). */
|
|
@@ -181,7 +181,7 @@ export type ContextPackEntity = {
|
|
|
181
181
|
* A lattice seed entry representing a belief that was auto-generated
|
|
182
182
|
* to cover an ontology entity type within a topic scope.
|
|
183
183
|
*/
|
|
184
|
-
|
|
184
|
+
type BeliefLatticeSeed = {
|
|
185
185
|
/** The belief node ID that was created or already existed. */
|
|
186
186
|
beliefNodeId: string;
|
|
187
187
|
/** The entity type this seed belief covers. */
|
|
@@ -192,7 +192,7 @@ export type BeliefLatticeSeed = {
|
|
|
192
192
|
canonicalText: string;
|
|
193
193
|
};
|
|
194
194
|
/** Counts and scoped health signals for the context pack. */
|
|
195
|
-
|
|
195
|
+
type ContextPackSummary = {
|
|
196
196
|
totalBeliefs: number;
|
|
197
197
|
invariants: number;
|
|
198
198
|
openQuestions: number;
|
|
@@ -205,7 +205,7 @@ export type ContextPackSummary = {
|
|
|
205
205
|
query: string | null;
|
|
206
206
|
};
|
|
207
207
|
/** A failed approach surfaced from the failure log for anti-repetition. */
|
|
208
|
-
|
|
208
|
+
type ContextPackFailure = {
|
|
209
209
|
/** Lucern attempt/evidence node ID. */
|
|
210
210
|
attemptId: string;
|
|
211
211
|
/** What was tried. */
|
|
@@ -218,14 +218,14 @@ export type ContextPackFailure = {
|
|
|
218
218
|
score: number;
|
|
219
219
|
};
|
|
220
220
|
/** Failure context section appended to context packs in delta mode. */
|
|
221
|
-
|
|
221
|
+
type ContextPackFailureContext = {
|
|
222
222
|
/** Ranked failed approaches relevant to the current query. */
|
|
223
223
|
failures: ContextPackFailure[];
|
|
224
224
|
/** IDs of items suppressed from other sections due to anti-repetition. */
|
|
225
225
|
suppressedIds: string[];
|
|
226
226
|
};
|
|
227
227
|
/** A verification obligation surfaced by delta compilation. */
|
|
228
|
-
|
|
228
|
+
type VerificationObligation = {
|
|
229
229
|
/** What must be verified. */
|
|
230
230
|
description: string;
|
|
231
231
|
/** Source of the obligation (e.g., "belief:xyz confidence drop"). */
|
|
@@ -234,7 +234,7 @@ export type VerificationObligation = {
|
|
|
234
234
|
severity: "critical" | "high" | "medium" | "low";
|
|
235
235
|
};
|
|
236
236
|
/** Delta report appended to context packs when mode = "delta". */
|
|
237
|
-
|
|
237
|
+
type ContextPackDeltaReport = {
|
|
238
238
|
/** Items that changed since the reference point (new, updated, removed). */
|
|
239
239
|
changedItems: Array<{
|
|
240
240
|
id: string;
|
|
@@ -251,14 +251,14 @@ export type ContextPackDeltaReport = {
|
|
|
251
251
|
* Per-section weight overrides that domain packs can apply.
|
|
252
252
|
* Overrides merge with RANKING_WEIGHTS — only specified fields replace defaults.
|
|
253
253
|
*/
|
|
254
|
-
|
|
254
|
+
type PackWeightOverride = {
|
|
255
255
|
/** Which section to override weights for. */
|
|
256
256
|
section: ContextPackSectionKey;
|
|
257
257
|
/** Partial weight vector — only specified fields replace defaults. */
|
|
258
258
|
weights: Partial<RankingWeightVector>;
|
|
259
259
|
};
|
|
260
260
|
/** Token-budgeted section selections for prompt injection. */
|
|
261
|
-
|
|
261
|
+
type ContextPackInjectionPolicy = {
|
|
262
262
|
/** Total token budget for the entire context pack. */
|
|
263
263
|
tokenBudget: number;
|
|
264
264
|
/** Estimated tokens consumed across all sections. */
|
|
@@ -278,7 +278,7 @@ export type ContextPackInjectionPolicy = {
|
|
|
278
278
|
}>;
|
|
279
279
|
};
|
|
280
280
|
/** Telemetry for context pack assembly. */
|
|
281
|
-
|
|
281
|
+
type ContextPackDiagnostics = {
|
|
282
282
|
/** Total candidates scored across all sections. */
|
|
283
283
|
itemsScored: number;
|
|
284
284
|
/** Ratio of estimatedTokens / tokenBudget. Range [0, 1+]. */
|
|
@@ -290,7 +290,7 @@ export type ContextPackDiagnostics = {
|
|
|
290
290
|
* This preserves the existing external shape while the canonical compiler
|
|
291
291
|
* contract evolves in parallel as ContextPackV1.
|
|
292
292
|
*/
|
|
293
|
-
|
|
293
|
+
type PublicContextBelief = {
|
|
294
294
|
beliefId: string;
|
|
295
295
|
text: string;
|
|
296
296
|
confidence: number | null;
|
|
@@ -300,7 +300,7 @@ export type PublicContextBelief = {
|
|
|
300
300
|
score: number;
|
|
301
301
|
justification?: string;
|
|
302
302
|
};
|
|
303
|
-
|
|
303
|
+
type PublicContextQuestion = {
|
|
304
304
|
questionId: string;
|
|
305
305
|
text: string;
|
|
306
306
|
status: string;
|
|
@@ -309,7 +309,7 @@ export type PublicContextQuestion = {
|
|
|
309
309
|
score: number;
|
|
310
310
|
justification?: string;
|
|
311
311
|
};
|
|
312
|
-
|
|
312
|
+
type PublicContextEvidence = {
|
|
313
313
|
evidenceId: string;
|
|
314
314
|
text: string;
|
|
315
315
|
sourceUrl?: string | null;
|
|
@@ -318,7 +318,7 @@ export type PublicContextEvidence = {
|
|
|
318
318
|
score: number;
|
|
319
319
|
justification?: string;
|
|
320
320
|
};
|
|
321
|
-
|
|
321
|
+
type PublicContextContradiction = {
|
|
322
322
|
contradictionId: string;
|
|
323
323
|
severity: string;
|
|
324
324
|
status: string;
|
|
@@ -326,7 +326,7 @@ export type PublicContextContradiction = {
|
|
|
326
326
|
score: number;
|
|
327
327
|
justification?: string;
|
|
328
328
|
};
|
|
329
|
-
|
|
329
|
+
type PublicContextEntity = {
|
|
330
330
|
entityId: string;
|
|
331
331
|
entityType: string;
|
|
332
332
|
title: string;
|
|
@@ -336,7 +336,7 @@ export type PublicContextEntity = {
|
|
|
336
336
|
score: number;
|
|
337
337
|
metadata?: Record<string, unknown>;
|
|
338
338
|
};
|
|
339
|
-
|
|
339
|
+
type PublicContextInjectionPolicy = {
|
|
340
340
|
tokenBudget: number;
|
|
341
341
|
estimatedTokens: number;
|
|
342
342
|
sectionBudgets: Record<string, number>;
|
|
@@ -349,7 +349,7 @@ export type PublicContextInjectionPolicy = {
|
|
|
349
349
|
score: number;
|
|
350
350
|
}>;
|
|
351
351
|
};
|
|
352
|
-
|
|
352
|
+
type PublicCompiledContext = {
|
|
353
353
|
schemaVersion: string;
|
|
354
354
|
topicId: string;
|
|
355
355
|
topicName: string;
|
|
@@ -400,11 +400,9 @@ export type PublicCompiledContext = {
|
|
|
400
400
|
* in the output. Adding optional fields is non-breaking; removing or
|
|
401
401
|
* changing types is breaking (requires version bump).
|
|
402
402
|
*/
|
|
403
|
-
|
|
403
|
+
type ContextPackV1 = {
|
|
404
404
|
/** Schema version for compatibility checking. */
|
|
405
405
|
schemaVersion: typeof CONTEXT_PACK_SCHEMA_VERSION;
|
|
406
|
-
/** Deprecated compatibility alias for the requested scope ID. */
|
|
407
|
-
projectId?: string;
|
|
408
406
|
/** Resolved topic ID after scope resolution. */
|
|
409
407
|
topicId: string;
|
|
410
408
|
/** Human-readable topic name. */
|
|
@@ -450,13 +448,11 @@ export type ContextPackV1 = {
|
|
|
450
448
|
};
|
|
451
449
|
/**
|
|
452
450
|
* The canonical input schema for `compile_context`.
|
|
453
|
-
* `topicId` is
|
|
451
|
+
* `topicId` is the only scope identifier.
|
|
454
452
|
*/
|
|
455
|
-
|
|
453
|
+
type ContextPackRequestV1 = {
|
|
456
454
|
/** Topic scope ID (required). */
|
|
457
455
|
topicId: string;
|
|
458
|
-
/** Deprecated compatibility alias for older callers. */
|
|
459
|
-
projectId?: string;
|
|
460
456
|
/** Focus query for relevance ranking. */
|
|
461
457
|
query?: string;
|
|
462
458
|
/** Max items per section. Default: DEFAULT_SECTION_LIMIT. */
|
|
@@ -484,11 +480,13 @@ export type ContextPackRequestV1 = {
|
|
|
484
480
|
* Question statuses that are considered "resolved" (not open).
|
|
485
481
|
* Used to filter which questions appear in the openQuestions section.
|
|
486
482
|
*/
|
|
487
|
-
|
|
483
|
+
declare const RESOLVED_QUESTION_STATUSES: readonly string[];
|
|
488
484
|
/**
|
|
489
485
|
* Tokens-per-word multiplier for rough token estimation.
|
|
490
486
|
* Conservative estimate: ~1.35 tokens per whitespace-delimited word.
|
|
491
487
|
*/
|
|
492
|
-
|
|
488
|
+
declare const TOKENS_PER_WORD = 1.35;
|
|
493
489
|
/** Minimum token estimate for any non-empty string. */
|
|
494
|
-
|
|
490
|
+
declare const MIN_TOKEN_ESTIMATE = 8;
|
|
491
|
+
|
|
492
|
+
export { BELIEF_TYPE_BONUS, type BeliefLatticeSeed, CONTEXT_PACK_SCHEMA_VERSION, CONTEXT_PACK_SECTION_KEYS, CONTEXT_RANKING_PROFILES, type ContextCompilationMode, type ContextPackBelief, type ContextPackContradiction, type ContextPackDeltaReport, type ContextPackDiagnostics, type ContextPackEntity, type ContextPackEvidence, type ContextPackFailure, type ContextPackFailureContext, type ContextPackInjectionPolicy, type ContextPackQuestion, type ContextPackRequestV1, type ContextPackSectionKey, type ContextPackSummary, type ContextPackV1, type ContextRankingProfile, DEFAULT_BELIEF_TYPE_BONUS, DEFAULT_COMPILATION_MODE, DEFAULT_ENTITY_LIMIT, DEFAULT_PRIORITY_SCORE, DEFAULT_RANKING_PROFILE, DEFAULT_SECTION_LIMIT, DEFAULT_SEVERITY_SCORE, DEFAULT_TOKEN_BUDGET, ENTITY_RANKING_WEIGHTS, MAX_ENTITY_LIMIT, MAX_SECTION_LIMIT, MAX_TOKEN_BUDGET, MIN_CONTRADICTION_BUDGET, MIN_TOKEN_BUDGET, MIN_TOKEN_ESTIMATE, PRIORITY_SCORES, type PackWeightOverride, type PublicCompiledContext, type PublicContextBelief, type PublicContextContradiction, type PublicContextEntity, type PublicContextEvidence, type PublicContextInjectionPolicy, type PublicContextQuestion, RANKING_WEIGHTS, RECENCY_HALF_LIFE_DAYS, RESOLVED_QUESTION_STATUSES, type RankingWeightVector, SECTION_BUDGET_RATIOS, SEVERITY_SCORES, TOKENS_PER_WORD, type VerificationObligation };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/contracts/context-pack.contract.ts
|
|
2
|
+
var CONTEXT_PACK_SCHEMA_VERSION = "1.0.0";
|
|
3
|
+
var CONTEXT_RANKING_PROFILES = [
|
|
4
|
+
"baseline_v1",
|
|
5
|
+
"weighted_v1"
|
|
6
|
+
];
|
|
7
|
+
var DEFAULT_RANKING_PROFILE = "weighted_v1";
|
|
8
|
+
var DEFAULT_COMPILATION_MODE = "standard";
|
|
9
|
+
var CONTEXT_PACK_SECTION_KEYS = [
|
|
10
|
+
"invariants",
|
|
11
|
+
"activeBeliefs",
|
|
12
|
+
"openQuestions",
|
|
13
|
+
"recentEvidence",
|
|
14
|
+
"contradictions"
|
|
15
|
+
];
|
|
16
|
+
var SECTION_BUDGET_RATIOS = {
|
|
17
|
+
invariants: 0.28,
|
|
18
|
+
activeBeliefs: 0.3,
|
|
19
|
+
openQuestions: 0.17,
|
|
20
|
+
recentEvidence: 0.17,
|
|
21
|
+
contradictions: 0.08
|
|
22
|
+
};
|
|
23
|
+
var MIN_TOKEN_BUDGET = 400;
|
|
24
|
+
var MAX_TOKEN_BUDGET = 8e3;
|
|
25
|
+
var DEFAULT_TOKEN_BUDGET = 1800;
|
|
26
|
+
var DEFAULT_SECTION_LIMIT = 8;
|
|
27
|
+
var MAX_SECTION_LIMIT = 25;
|
|
28
|
+
var MIN_CONTRADICTION_BUDGET = 40;
|
|
29
|
+
var RANKING_WEIGHTS = {
|
|
30
|
+
invariants: {
|
|
31
|
+
query: 0.35,
|
|
32
|
+
recency: 0.1,
|
|
33
|
+
confidence: 0.4,
|
|
34
|
+
beliefType: 0.15
|
|
35
|
+
},
|
|
36
|
+
activeBeliefs: {
|
|
37
|
+
query: 0.5,
|
|
38
|
+
recency: 0.2,
|
|
39
|
+
confidence: 0.2,
|
|
40
|
+
beliefType: 0.1
|
|
41
|
+
},
|
|
42
|
+
openQuestions: {
|
|
43
|
+
query: 0.55,
|
|
44
|
+
recency: 0.2,
|
|
45
|
+
priority: 0.25
|
|
46
|
+
},
|
|
47
|
+
recentEvidence: {
|
|
48
|
+
query: 0.6,
|
|
49
|
+
recency: 0.4
|
|
50
|
+
},
|
|
51
|
+
contradictions: {
|
|
52
|
+
query: 0.4,
|
|
53
|
+
recency: 0.2,
|
|
54
|
+
severity: 0.4
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var RECENCY_HALF_LIFE_DAYS = 30;
|
|
58
|
+
var ENTITY_RANKING_WEIGHTS = {
|
|
59
|
+
query: 0.4,
|
|
60
|
+
connectivity: 0.6
|
|
61
|
+
};
|
|
62
|
+
var DEFAULT_ENTITY_LIMIT = 10;
|
|
63
|
+
var MAX_ENTITY_LIMIT = 50;
|
|
64
|
+
var BELIEF_TYPE_BONUS = {
|
|
65
|
+
invariant: 1,
|
|
66
|
+
tenet: 0.8,
|
|
67
|
+
principle: 0.6
|
|
68
|
+
};
|
|
69
|
+
var DEFAULT_BELIEF_TYPE_BONUS = 0.4;
|
|
70
|
+
var PRIORITY_SCORES = {
|
|
71
|
+
critical: 1,
|
|
72
|
+
high: 0.85,
|
|
73
|
+
medium: 0.55,
|
|
74
|
+
low: 0.35
|
|
75
|
+
};
|
|
76
|
+
var DEFAULT_PRIORITY_SCORE = 0.5;
|
|
77
|
+
var SEVERITY_SCORES = {
|
|
78
|
+
critical: 1,
|
|
79
|
+
high: 0.85,
|
|
80
|
+
medium: 0.6,
|
|
81
|
+
low: 0.35
|
|
82
|
+
};
|
|
83
|
+
var DEFAULT_SEVERITY_SCORE = 0.5;
|
|
84
|
+
var RESOLVED_QUESTION_STATUSES = [
|
|
85
|
+
"answered",
|
|
86
|
+
"archived",
|
|
87
|
+
"closed",
|
|
88
|
+
"resolved",
|
|
89
|
+
"resolved_support",
|
|
90
|
+
"resolved_contra",
|
|
91
|
+
"belief_forked"
|
|
92
|
+
];
|
|
93
|
+
var TOKENS_PER_WORD = 1.35;
|
|
94
|
+
var MIN_TOKEN_ESTIMATE = 8;
|
|
95
|
+
|
|
96
|
+
export { BELIEF_TYPE_BONUS, CONTEXT_PACK_SCHEMA_VERSION, CONTEXT_PACK_SECTION_KEYS, CONTEXT_RANKING_PROFILES, DEFAULT_BELIEF_TYPE_BONUS, DEFAULT_COMPILATION_MODE, DEFAULT_ENTITY_LIMIT, DEFAULT_PRIORITY_SCORE, DEFAULT_RANKING_PROFILE, DEFAULT_SECTION_LIMIT, DEFAULT_SEVERITY_SCORE, DEFAULT_TOKEN_BUDGET, ENTITY_RANKING_WEIGHTS, MAX_ENTITY_LIMIT, MAX_SECTION_LIMIT, MAX_TOKEN_BUDGET, MIN_CONTRADICTION_BUDGET, MIN_TOKEN_BUDGET, MIN_TOKEN_ESTIMATE, PRIORITY_SCORES, RANKING_WEIGHTS, RECENCY_HALF_LIFE_DAYS, RESOLVED_QUESTION_STATUSES, SECTION_BUDGET_RATIOS, SEVERITY_SCORES, TOKENS_PER_WORD };
|
|
97
|
+
//# sourceMappingURL=context-pack.contract.js.map
|
|
98
|
+
//# sourceMappingURL=context-pack.contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/contracts/context-pack.contract.ts"],"names":[],"mappings":";AAqBO,IAAM,2BAAA,GAA8B;AAepC,IAAM,wBAAA,GAA6D;AAAA,EACxE,aAAA;AAAA,EACA;AACF;AAEO,IAAM,uBAAA,GAAiD;AAevD,IAAM,wBAAA,GAAmD;AAiBzD,IAAM,yBAAA,GAA8D;AAAA,EACzE,YAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAiBO,IAAM,qBAAA,GAET;AAAA,EACF,UAAA,EAAY,IAAA;AAAA,EACZ,aAAA,EAAe,GAAA;AAAA,EACf,aAAA,EAAe,IAAA;AAAA,EACf,cAAA,EAAgB,IAAA;AAAA,EAChB,cAAA,EAAgB;AAClB;AAOO,IAAM,gBAAA,GAAmB;AAGzB,IAAM,gBAAA,GAAmB;AAGzB,IAAM,oBAAA,GAAuB;AAG7B,IAAM,qBAAA,GAAwB;AAG9B,IAAM,iBAAA,GAAoB;AAG1B,IAAM,wBAAA,GAA2B;AA0BjC,IAAM,eAAA,GAET;AAAA,EACF,UAAA,EAAY;AAAA,IACV,KAAA,EAAO,IAAA;AAAA,IACP,OAAA,EAAS,GAAA;AAAA,IACT,UAAA,EAAY,GAAA;AAAA,IACZ,UAAA,EAAY;AAAA,GACd;AAAA,EACA,aAAA,EAAe;AAAA,IACb,KAAA,EAAO,GAAA;AAAA,IACP,OAAA,EAAS,GAAA;AAAA,IACT,UAAA,EAAY,GAAA;AAAA,IACZ,UAAA,EAAY;AAAA,GACd;AAAA,EACA,aAAA,EAAe;AAAA,IACb,KAAA,EAAO,IAAA;AAAA,IACP,OAAA,EAAS,GAAA;AAAA,IACT,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,KAAA,EAAO,GAAA;AAAA,IACP,OAAA,EAAS;AAAA,GACX;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,KAAA,EAAO,GAAA;AAAA,IACP,OAAA,EAAS,GAAA;AAAA,IACT,QAAA,EAAU;AAAA;AAEd;AAGO,IAAM,sBAAA,GAAyB;AAQ/B,IAAM,sBAAA,GAAyB;AAAA,EACpC,KAAA,EAAO,GAAA;AAAA,EACP,YAAA,EAAc;AAChB;AAGO,IAAM,oBAAA,GAAuB;AAG7B,IAAM,gBAAA,GAAmB;AAUzB,IAAM,iBAAA,GAAsD;AAAA,EACjE,SAAA,EAAW,CAAA;AAAA,EACX,KAAA,EAAO,GAAA;AAAA,EACP,SAAA,EAAW;AACb;AAEO,IAAM,yBAAA,GAA4B;AAMlC,IAAM,eAAA,GAAoD;AAAA,EAC/D,QAAA,EAAU,CAAA;AAAA,EACV,IAAA,EAAM,IAAA;AAAA,EACN,MAAA,EAAQ,IAAA;AAAA,EACR,GAAA,EAAK;AACP;AAEO,IAAM,sBAAA,GAAyB;AAE/B,IAAM,eAAA,GAAoD;AAAA,EAC/D,QAAA,EAAU,CAAA;AAAA,EACV,IAAA,EAAM,IAAA;AAAA,EACN,MAAA,EAAQ,GAAA;AAAA,EACR,GAAA,EAAK;AACP;AAEO,IAAM,sBAAA,GAAyB;AAub/B,IAAM,0BAAA,GAAgD;AAAA,EAC3D,UAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,kBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF;AAUO,IAAM,eAAA,GAAkB;AAGxB,IAAM,kBAAA,GAAqB","file":"context-pack.contract.js","sourcesContent":["/**\n * Context-Pack Contract v1\n *\n * Canonical TypeScript types and constants for the context-pack output schema.\n * This is the external contract consumed by:\n * - MCP tool `compile_context` (canonical compiler read)\n * - SDK/HTTP consumers that read compiled context packs programmatically\n * - Benchmark harnesses (context-pack-ab)\n *\n * BREAKING CHANGE RULES:\n * - Adding optional fields to ContextPackV1 is NON-breaking\n * - Removing fields or changing types is BREAKING (bump CONTEXT_PACK_SCHEMA_VERSION)\n * - Changing section budget ratios or ranking weights is NON-breaking (tuning)\n * - Changing the version string is BREAKING (consumers check it)\n */\n\n// =============================================================================\n// SCHEMA VERSION\n// =============================================================================\n\n/** Canonical version string. Consumers MUST check this field for compatibility. */\nexport const CONTEXT_PACK_SCHEMA_VERSION = \"1.0.0\" as const;\n\n// =============================================================================\n// RANKING PROFILES\n// =============================================================================\n\n/**\n * Available ranking profiles for context-pack assembly.\n *\n * - `baseline_v1`: Simple token-hit counting. Items with zero query hits are excluded.\n * - `weighted_v1`: Multi-signal scoring combining query relevance, recency, confidence,\n * belief type, priority, and severity with section-specific weight vectors.\n */\nexport type ContextRankingProfile = \"baseline_v1\" | \"weighted_v1\";\n\nexport const CONTEXT_RANKING_PROFILES: readonly ContextRankingProfile[] = [\n \"baseline_v1\",\n \"weighted_v1\",\n] as const;\n\nexport const DEFAULT_RANKING_PROFILE: ContextRankingProfile = \"weighted_v1\";\n\n// =============================================================================\n// COMPILATION MODE (RS-2)\n// =============================================================================\n\n/**\n * Context compilation mode.\n *\n * - `standard`: Default — ranked beliefs, questions, evidence, contradictions.\n * - `delta`: Diff-aware — adds failure context, verification obligations,\n * and worktree ledger analysis to the standard context pack.\n */\nexport type ContextCompilationMode = \"standard\" | \"delta\";\n\nexport const DEFAULT_COMPILATION_MODE: ContextCompilationMode = \"standard\";\n\n// =============================================================================\n// SECTION KEYS\n// =============================================================================\n\n/**\n * The five canonical sections of a context pack.\n * Order matters: invariants are injected first, contradictions last.\n */\nexport type ContextPackSectionKey =\n | \"invariants\"\n | \"activeBeliefs\"\n | \"openQuestions\"\n | \"recentEvidence\"\n | \"contradictions\";\n\nexport const CONTEXT_PACK_SECTION_KEYS: readonly ContextPackSectionKey[] = [\n \"invariants\",\n \"activeBeliefs\",\n \"openQuestions\",\n \"recentEvidence\",\n \"contradictions\",\n] as const;\n\n// =============================================================================\n// SECTION BUDGET RATIOS\n// =============================================================================\n\n/**\n * Token budget allocation ratios per section.\n * These sum to 1.0 and determine how the total tokenBudget is divided.\n *\n * Rationale:\n * - invariants (0.28): Highest-priority constraints, injected first\n * - activeBeliefs (0.30): Largest section, carries domain knowledge\n * - openQuestions (0.17): Unresolved work items guide agent behavior\n * - recentEvidence (0.17): Implementation context for grounding\n * - contradictions (0.08): Tension signals, smallest section\n */\nexport const SECTION_BUDGET_RATIOS: Readonly<\n Record<ContextPackSectionKey, number>\n> = {\n invariants: 0.28,\n activeBeliefs: 0.3,\n openQuestions: 0.17,\n recentEvidence: 0.17,\n contradictions: 0.08,\n} as const;\n\n// =============================================================================\n// TOKEN BUDGET CONSTRAINTS\n// =============================================================================\n\n/** Minimum allowed token budget. Below this, context packs lose utility. */\nexport const MIN_TOKEN_BUDGET = 400;\n\n/** Maximum allowed token budget. Above this, context packs bloat prompts. */\nexport const MAX_TOKEN_BUDGET = 8000;\n\n/** Default token budget when caller does not specify. */\nexport const DEFAULT_TOKEN_BUDGET = 1800;\n\n/** Default max items per section. */\nexport const DEFAULT_SECTION_LIMIT = 8;\n\n/** Hard ceiling on items per section. */\nexport const MAX_SECTION_LIMIT = 25;\n\n/** Minimum contradiction section budget floor (tokens). */\nexport const MIN_CONTRADICTION_BUDGET = 40;\n\n// =============================================================================\n// RANKING WEIGHT VECTORS\n// =============================================================================\n\n/**\n * Weight vectors for the weighted_v1 ranking profile.\n * Each section has a different signal mix:\n *\n * - query: How many query tokens appear in the candidate text\n * - recency: Exponential decay from updatedAt (half-life = 30 days)\n * - confidence: Belief confidence score [0,1]\n * - beliefType: Bonus for invariant > tenet > principle > other\n * - priority: Question priority (critical > high > medium > low)\n * - severity: Contradiction severity (critical > high > medium > low)\n */\nexport type RankingWeightVector = {\n query: number;\n recency: number;\n confidence?: number;\n beliefType?: number;\n priority?: number;\n severity?: number;\n};\n\nexport const RANKING_WEIGHTS: Readonly<\n Record<ContextPackSectionKey, RankingWeightVector>\n> = {\n invariants: {\n query: 0.35,\n recency: 0.1,\n confidence: 0.4,\n beliefType: 0.15,\n },\n activeBeliefs: {\n query: 0.5,\n recency: 0.2,\n confidence: 0.2,\n beliefType: 0.1,\n },\n openQuestions: {\n query: 0.55,\n recency: 0.2,\n priority: 0.25,\n },\n recentEvidence: {\n query: 0.6,\n recency: 0.4,\n },\n contradictions: {\n query: 0.4,\n recency: 0.2,\n severity: 0.4,\n },\n} as const;\n\n/** Recency decay half-life in days. After 30 days, recency score = 0.5. */\nexport const RECENCY_HALF_LIFE_DAYS = 30;\n\n/**\n * Ranking weight vector for the relatedEntities section.\n * Entities are ranked by query relevance and connectivity (bridge edge count).\n * Separate from RANKING_WEIGHTS because entities are not part of the\n * token-budgeted injection plan.\n */\nexport const ENTITY_RANKING_WEIGHTS = {\n query: 0.4,\n connectivity: 0.6,\n} as const;\n\n/** Default max entities to include in the context pack. */\nexport const DEFAULT_ENTITY_LIMIT = 10;\n\n/** Hard ceiling on entities per context pack. */\nexport const MAX_ENTITY_LIMIT = 50;\n\n// =============================================================================\n// BELIEF TYPE BONUS MAP\n// =============================================================================\n\n/**\n * Bonus multiplier for belief types in ranking.\n * Invariants get 1.0, unknown types get 0.4.\n */\nexport const BELIEF_TYPE_BONUS: Readonly<Record<string, number>> = {\n invariant: 1.0,\n tenet: 0.8,\n principle: 0.6,\n} as const;\n\nexport const DEFAULT_BELIEF_TYPE_BONUS = 0.4;\n\n// =============================================================================\n// PRIORITY / SEVERITY SCORE MAPS\n// =============================================================================\n\nexport const PRIORITY_SCORES: Readonly<Record<string, number>> = {\n critical: 1.0,\n high: 0.85,\n medium: 0.55,\n low: 0.35,\n} as const;\n\nexport const DEFAULT_PRIORITY_SCORE = 0.5;\n\nexport const SEVERITY_SCORES: Readonly<Record<string, number>> = {\n critical: 1.0,\n high: 0.85,\n medium: 0.6,\n low: 0.35,\n} as const;\n\nexport const DEFAULT_SEVERITY_SCORE = 0.5;\n\n// =============================================================================\n// SECTION ITEM TYPES\n// =============================================================================\n\n/** A ranked belief in the invariants or activeBeliefs section. */\nexport type ContextPackBelief = {\n nodeId: string;\n canonicalText: string;\n confidence: number | null;\n beliefType: string | null;\n score: number;\n /** Present in activeBeliefs, absent in invariants */\n status?: string;\n updatedAt?: number | null;\n /** Human-readable explanation of why this item was ranked here (RS-2). */\n justification?: string;\n};\n\n/** A ranked question in the openQuestions section. */\nexport type ContextPackQuestion = {\n questionId: string;\n text: string;\n status: string;\n priority: string;\n updatedAt?: number | null;\n score: number;\n /** Human-readable explanation of why this item was ranked here (RS-2). */\n justification?: string;\n};\n\n/** A ranked evidence item in the recentEvidence section. */\nexport type ContextPackEvidence = {\n nodeId: string;\n canonicalText: string;\n sourceUrl: string | null;\n kind: string;\n createdAt: number | null;\n score: number;\n /** Human-readable explanation of why this item was ranked here (RS-2). */\n justification?: string;\n};\n\n/** A ranked contradiction in the contradictions section. */\nexport type ContextPackContradiction = {\n contradictionId: string;\n severity: string;\n status: string;\n description: string;\n score: number;\n /** Human-readable explanation of why this item was ranked here (RS-2). */\n justification?: string;\n};\n\n/**\n * An entity from the ontological layer surfaced in the context pack.\n * Entities are domain objects (companies, people, functions, etc.) connected\n * to beliefs via bridge edges. They provide the \"reality anchor\" that makes\n * the reasoning graph domain-aware.\n */\nexport type ContextPackEntity = {\n /** Convex document ID of the entity node. */\n nodeId: string;\n /** Entity type (e.g., \"company\", \"person\", \"function\"). */\n entityType: string;\n /** Human-readable title/name of the entity. */\n title: string;\n /** Number of beliefs connected to this entity via bridge edges. */\n connectedBeliefCount: number;\n /** Number of evidence items referencing this entity. */\n connectedEvidenceCount: number;\n /** Relevance score from ranking algorithm. */\n score: number;\n /** Entity metadata (structured per ontology schema). */\n metadata?: Record<string, unknown>;\n};\n\n/**\n * A lattice seed entry representing a belief that was auto-generated\n * to cover an ontology entity type within a topic scope.\n */\nexport type BeliefLatticeSeed = {\n /** The belief node ID that was created or already existed. */\n beliefNodeId: string;\n /** The entity type this seed belief covers. */\n entityType: string;\n /** Whether this seed was newly created or already existed. */\n created: boolean;\n /** The canonical text of the seed belief. */\n canonicalText: string;\n};\n\n// =============================================================================\n// SUMMARY\n// =============================================================================\n\n/** Counts and scoped health signals for the context pack. */\nexport type ContextPackSummary = {\n totalBeliefs: number;\n invariants: number;\n openQuestions: number;\n evidenceItems: number;\n contradictions: number;\n /** Number of ontological entities in scope (optional, present when entity graph is active). */\n relatedEntities?: number;\n scopedTopics: number;\n descendantDepth: number;\n query: string | null;\n};\n\n// =============================================================================\n// FAILURE CONTEXT (RS-2)\n// =============================================================================\n\n/** A failed approach surfaced from the failure log for anti-repetition. */\nexport type ContextPackFailure = {\n /** Lucern attempt/evidence node ID. */\n attemptId: string;\n /** What was tried. */\n approach: string;\n /** Why it failed. */\n outcome: string;\n /** When the attempt was recorded (ms since epoch). */\n recordedAt: number;\n /** Relevance score from ranking algorithm. */\n score: number;\n};\n\n/** Failure context section appended to context packs in delta mode. */\nexport type ContextPackFailureContext = {\n /** Ranked failed approaches relevant to the current query. */\n failures: ContextPackFailure[];\n /** IDs of items suppressed from other sections due to anti-repetition. */\n suppressedIds: string[];\n};\n\n// =============================================================================\n// DELTA REPORT (RS-2)\n// =============================================================================\n\n/** A verification obligation surfaced by delta compilation. */\nexport type VerificationObligation = {\n /** What must be verified. */\n description: string;\n /** Source of the obligation (e.g., \"belief:xyz confidence drop\"). */\n source: string;\n /** Severity: how important it is to verify. */\n severity: \"critical\" | \"high\" | \"medium\" | \"low\";\n};\n\n/** Delta report appended to context packs when mode = \"delta\". */\nexport type ContextPackDeltaReport = {\n /** Items that changed since the reference point (new, updated, removed). */\n changedItems: Array<{\n id: string;\n section: ContextPackSectionKey;\n changeType: \"added\" | \"updated\" | \"removed\" | \"confidence_changed\";\n summary: string;\n }>;\n /** Obligations the consuming session must verify. */\n verificationObligations: VerificationObligation[];\n /** Reference point for the delta (worktree ID, timestamp, or commit SHA). */\n referencePoint: string;\n};\n\n// =============================================================================\n// PACK WEIGHT OVERRIDES (RS-2)\n// =============================================================================\n\n/**\n * Per-section weight overrides that domain packs can apply.\n * Overrides merge with RANKING_WEIGHTS — only specified fields replace defaults.\n */\nexport type PackWeightOverride = {\n /** Which section to override weights for. */\n section: ContextPackSectionKey;\n /** Partial weight vector — only specified fields replace defaults. */\n weights: Partial<RankingWeightVector>;\n};\n\n// =============================================================================\n// INJECTION POLICY\n// =============================================================================\n\n/** Token-budgeted section selections for prompt injection. */\nexport type ContextPackInjectionPolicy = {\n /** Total token budget for the entire context pack. */\n tokenBudget: number;\n /** Estimated tokens consumed across all sections. */\n estimatedTokens: number;\n /** Per-section token budgets derived from SECTION_BUDGET_RATIOS. */\n sectionBudgets: Record<ContextPackSectionKey, number>;\n /** Actual token usage per section after greedy fill. */\n sectionUsage: Record<ContextPackSectionKey, number>;\n /** Node/question IDs selected for injection, per section. */\n selected: Record<ContextPackSectionKey, string[]>;\n /** Items that were scored but excluded from injection, with reason (RS-2). */\n excludedItems?: Array<{\n id: string;\n section: ContextPackSectionKey;\n reason: \"budget_exceeded\" | \"anti_repetition\" | \"below_threshold\";\n score: number;\n }>;\n};\n\n// =============================================================================\n// DIAGNOSTICS\n// =============================================================================\n\n/** Telemetry for context pack assembly. */\nexport type ContextPackDiagnostics = {\n /** Total candidates scored across all sections. */\n itemsScored: number;\n /** Ratio of estimatedTokens / tokenBudget. Range [0, 1+]. */\n tokenBudgetUtilization: number;\n};\n\n// =============================================================================\n// PUBLIC COMPILED CONTEXT TYPES\n// =============================================================================\n\n/**\n * Public context surface returned by the SDK-facing context client.\n *\n * This preserves the existing external shape while the canonical compiler\n * contract evolves in parallel as ContextPackV1.\n */\nexport type PublicContextBelief = {\n beliefId: string;\n text: string;\n confidence: number | null;\n beliefType?: string | null;\n status?: string;\n updatedAt?: number | null;\n score: number;\n justification?: string;\n};\n\nexport type PublicContextQuestion = {\n questionId: string;\n text: string;\n status: string;\n priority: string;\n updatedAt?: number | null;\n score: number;\n justification?: string;\n};\n\nexport type PublicContextEvidence = {\n evidenceId: string;\n text: string;\n sourceUrl?: string | null;\n kind: string;\n createdAt?: number | null;\n score: number;\n justification?: string;\n};\n\nexport type PublicContextContradiction = {\n contradictionId: string;\n severity: string;\n status: string;\n description: string;\n score: number;\n justification?: string;\n};\n\nexport type PublicContextEntity = {\n entityId: string;\n entityType: string;\n title: string;\n text?: string;\n connectedBeliefCount: number;\n connectedEvidenceCount: number;\n score: number;\n metadata?: Record<string, unknown>;\n};\n\nexport type PublicContextInjectionPolicy = {\n tokenBudget: number;\n estimatedTokens: number;\n sectionBudgets: Record<string, number>;\n sectionUsage: Record<string, number>;\n selected: Record<string, string[]>;\n excludedItems?: Array<{\n id: string;\n section: string;\n reason: \"budget_exceeded\" | \"anti_repetition\" | \"below_threshold\";\n score: number;\n }>;\n};\n\nexport type PublicCompiledContext = {\n schemaVersion: string;\n topicId: string;\n topicName: string;\n scopedTopicIds: string[];\n generatedAt: number;\n ranking: ContextRankingProfile;\n summary: Record<string, unknown>;\n invariants: PublicContextBelief[];\n activeBeliefs: PublicContextBelief[];\n openQuestions: PublicContextQuestion[];\n recentEvidence: PublicContextEvidence[];\n contradictions: PublicContextContradiction[];\n relatedEntities?: PublicContextEntity[];\n contextNarrative: string[];\n injectionPolicy: PublicContextInjectionPolicy;\n diagnostics: Record<string, unknown>;\n compilationMode?: string;\n failureContext?: {\n failures: Array<{\n attemptId: string;\n approach: string;\n outcome: string;\n recordedAt: number;\n score: number;\n }>;\n suppressedIds: string[];\n };\n deltaReport?: {\n changedItems: Array<{\n id: string;\n section: string;\n changeType: string;\n summary: string;\n }>;\n verificationObligations: Array<{\n description: string;\n source: string;\n severity: \"critical\" | \"high\" | \"medium\" | \"low\";\n }>;\n referencePoint: string;\n };\n appliedWeightOverrides?: unknown[];\n};\n\n// =============================================================================\n// CONTEXT PACK V1 (TOP-LEVEL OUTPUT)\n// =============================================================================\n\n/**\n * The canonical output schema for context compilation responses.\n *\n * This is the contract that consumers depend on. All fields are required\n * in the output. Adding optional fields is non-breaking; removing or\n * changing types is breaking (requires version bump).\n */\nexport type ContextPackV1 = {\n /** Schema version for compatibility checking. */\n schemaVersion: typeof CONTEXT_PACK_SCHEMA_VERSION;\n /** Resolved topic ID after scope resolution. */\n topicId: string;\n /** Human-readable topic name. */\n topicName: string;\n /** All topic IDs included in the neighborhood expansion. */\n scopedTopicIds: string[];\n /** Deterministic freshness watermark for this pack (ms since epoch). */\n generatedAt: number;\n /** Which ranking profile was used. */\n rankingProfile: ContextRankingProfile;\n /** Aggregate counts and health signals. */\n summary: ContextPackSummary;\n /** High-confidence invariant beliefs (beliefType = \"invariant\"). */\n invariants: ContextPackBelief[];\n /** Active beliefs ranked by query relevance. */\n activeBeliefs: ContextPackBelief[];\n /** Open questions ranked by relevance and priority. */\n openQuestions: ContextPackQuestion[];\n /** Recent evidence ranked by relevance and recency. */\n recentEvidence: ContextPackEvidence[];\n /** Active contradictions ranked by severity. */\n contradictions: ContextPackContradiction[];\n /**\n * Ontological entities connected to beliefs in scope, ranked by connectivity.\n * Optional — present when entity graph substrate is active for this topic.\n * NON-BREAKING addition per contract rules.\n */\n relatedEntities?: ContextPackEntity[];\n /** Concise instructions for agent context injection. */\n contextNarrative: string[];\n /** Token-budgeted injection selections. */\n injectionPolicy: ContextPackInjectionPolicy;\n /** Assembly telemetry. */\n diagnostics: ContextPackDiagnostics;\n /** Compilation mode used to generate this pack (RS-2). Default: \"standard\". */\n compilationMode?: ContextCompilationMode;\n /** Failure context for anti-repetition (RS-2). Present when failures are relevant. */\n failureContext?: ContextPackFailureContext;\n /** Delta report (RS-2). Present only when compilationMode = \"delta\". */\n deltaReport?: ContextPackDeltaReport;\n /** Pack weight overrides applied during ranking (RS-2). */\n appliedWeightOverrides?: PackWeightOverride[];\n};\n\n// =============================================================================\n// CONTEXT PACK REQUEST V1 (INPUT)\n// =============================================================================\n\n/**\n * The canonical input schema for `compile_context`.\n * `topicId` is the only scope identifier.\n */\nexport type ContextPackRequestV1 = {\n /** Topic scope ID (required). */\n topicId: string;\n /** Focus query for relevance ranking. */\n query?: string;\n /** Max items per section. Default: DEFAULT_SECTION_LIMIT. */\n limit?: number;\n /** Ranking profile. Default: DEFAULT_RANKING_PROFILE. */\n rankingProfile?: ContextRankingProfile;\n /** Total token budget. Default: DEFAULT_TOKEN_BUDGET. */\n tokenBudget?: number;\n /** Descendant topic depth for neighborhood expansion. */\n maxDepth?: number;\n /** Include ontological entities connected to beliefs in scope. Default: true. */\n includeEntities?: boolean;\n /** Compilation mode (RS-2). Default: \"standard\". */\n mode?: ContextCompilationMode;\n /** Include failure log context for anti-repetition (RS-2). Default: false. */\n includeFailures?: boolean;\n /** Active worktree ID for delta mode reference point (RS-2). */\n worktreeId?: string;\n /** Session ID for anti-repetition dedup (RS-2). */\n sessionId?: string;\n /** Pack weight overrides from domain pack binding (RS-2). */\n packWeightOverrides?: PackWeightOverride[];\n};\n\n// =============================================================================\n// RESOLVED QUESTION STATUSES\n// =============================================================================\n\n/**\n * Question statuses that are considered \"resolved\" (not open).\n * Used to filter which questions appear in the openQuestions section.\n */\nexport const RESOLVED_QUESTION_STATUSES: readonly string[] = [\n \"answered\",\n \"archived\",\n \"closed\",\n \"resolved\",\n \"resolved_support\",\n \"resolved_contra\",\n \"belief_forked\",\n] as const;\n\n// =============================================================================\n// TOKEN ESTIMATION\n// =============================================================================\n\n/**\n * Tokens-per-word multiplier for rough token estimation.\n * Conservative estimate: ~1.35 tokens per whitespace-delimited word.\n */\nexport const TOKENS_PER_WORD = 1.35;\n\n/** Minimum token estimate for any non-empty string. */\nexport const MIN_TOKEN_ESTIMATE = 8;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BELIEF_TYPE_BONUS, BeliefLatticeSeed, CONTEXT_PACK_SCHEMA_VERSION, CONTEXT_PACK_SECTION_KEYS, CONTEXT_RANKING_PROFILES, ContextCompilationMode, ContextPackBelief, ContextPackContradiction, ContextPackDeltaReport, ContextPackDiagnostics, ContextPackEntity, ContextPackEvidence, ContextPackFailure, ContextPackFailureContext, ContextPackInjectionPolicy, ContextPackQuestion, ContextPackRequestV1, ContextPackSectionKey, ContextPackSummary, ContextPackV1, ContextRankingProfile, DEFAULT_BELIEF_TYPE_BONUS, DEFAULT_COMPILATION_MODE, DEFAULT_ENTITY_LIMIT, DEFAULT_PRIORITY_SCORE, DEFAULT_RANKING_PROFILE, DEFAULT_SECTION_LIMIT, DEFAULT_SEVERITY_SCORE, DEFAULT_TOKEN_BUDGET, ENTITY_RANKING_WEIGHTS, MAX_ENTITY_LIMIT, MAX_SECTION_LIMIT, MAX_TOKEN_BUDGET, MIN_CONTRADICTION_BUDGET, MIN_TOKEN_BUDGET, MIN_TOKEN_ESTIMATE, PRIORITY_SCORES, PackWeightOverride, PublicCompiledContext, PublicContextBelief, PublicContextContradiction, PublicContextEntity, PublicContextEvidence, PublicContextInjectionPolicy, PublicContextQuestion, RANKING_WEIGHTS, RECENCY_HALF_LIFE_DAYS, RESOLVED_QUESTION_STATUSES, RankingWeightVector, SECTION_BUDGET_RATIOS, SEVERITY_SCORES, TOKENS_PER_WORD, VerificationObligation } from './context-pack.contract.js';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/contracts/context-pack.contract.ts
|
|
2
|
+
var CONTEXT_PACK_SCHEMA_VERSION = "1.0.0";
|
|
3
|
+
var CONTEXT_RANKING_PROFILES = [
|
|
4
|
+
"baseline_v1",
|
|
5
|
+
"weighted_v1"
|
|
6
|
+
];
|
|
7
|
+
var DEFAULT_RANKING_PROFILE = "weighted_v1";
|
|
8
|
+
var DEFAULT_COMPILATION_MODE = "standard";
|
|
9
|
+
var CONTEXT_PACK_SECTION_KEYS = [
|
|
10
|
+
"invariants",
|
|
11
|
+
"activeBeliefs",
|
|
12
|
+
"openQuestions",
|
|
13
|
+
"recentEvidence",
|
|
14
|
+
"contradictions"
|
|
15
|
+
];
|
|
16
|
+
var SECTION_BUDGET_RATIOS = {
|
|
17
|
+
invariants: 0.28,
|
|
18
|
+
activeBeliefs: 0.3,
|
|
19
|
+
openQuestions: 0.17,
|
|
20
|
+
recentEvidence: 0.17,
|
|
21
|
+
contradictions: 0.08
|
|
22
|
+
};
|
|
23
|
+
var MIN_TOKEN_BUDGET = 400;
|
|
24
|
+
var MAX_TOKEN_BUDGET = 8e3;
|
|
25
|
+
var DEFAULT_TOKEN_BUDGET = 1800;
|
|
26
|
+
var DEFAULT_SECTION_LIMIT = 8;
|
|
27
|
+
var MAX_SECTION_LIMIT = 25;
|
|
28
|
+
var MIN_CONTRADICTION_BUDGET = 40;
|
|
29
|
+
var RANKING_WEIGHTS = {
|
|
30
|
+
invariants: {
|
|
31
|
+
query: 0.35,
|
|
32
|
+
recency: 0.1,
|
|
33
|
+
confidence: 0.4,
|
|
34
|
+
beliefType: 0.15
|
|
35
|
+
},
|
|
36
|
+
activeBeliefs: {
|
|
37
|
+
query: 0.5,
|
|
38
|
+
recency: 0.2,
|
|
39
|
+
confidence: 0.2,
|
|
40
|
+
beliefType: 0.1
|
|
41
|
+
},
|
|
42
|
+
openQuestions: {
|
|
43
|
+
query: 0.55,
|
|
44
|
+
recency: 0.2,
|
|
45
|
+
priority: 0.25
|
|
46
|
+
},
|
|
47
|
+
recentEvidence: {
|
|
48
|
+
query: 0.6,
|
|
49
|
+
recency: 0.4
|
|
50
|
+
},
|
|
51
|
+
contradictions: {
|
|
52
|
+
query: 0.4,
|
|
53
|
+
recency: 0.2,
|
|
54
|
+
severity: 0.4
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var RECENCY_HALF_LIFE_DAYS = 30;
|
|
58
|
+
var ENTITY_RANKING_WEIGHTS = {
|
|
59
|
+
query: 0.4,
|
|
60
|
+
connectivity: 0.6
|
|
61
|
+
};
|
|
62
|
+
var DEFAULT_ENTITY_LIMIT = 10;
|
|
63
|
+
var MAX_ENTITY_LIMIT = 50;
|
|
64
|
+
var BELIEF_TYPE_BONUS = {
|
|
65
|
+
invariant: 1,
|
|
66
|
+
tenet: 0.8,
|
|
67
|
+
principle: 0.6
|
|
68
|
+
};
|
|
69
|
+
var DEFAULT_BELIEF_TYPE_BONUS = 0.4;
|
|
70
|
+
var PRIORITY_SCORES = {
|
|
71
|
+
critical: 1,
|
|
72
|
+
high: 0.85,
|
|
73
|
+
medium: 0.55,
|
|
74
|
+
low: 0.35
|
|
75
|
+
};
|
|
76
|
+
var DEFAULT_PRIORITY_SCORE = 0.5;
|
|
77
|
+
var SEVERITY_SCORES = {
|
|
78
|
+
critical: 1,
|
|
79
|
+
high: 0.85,
|
|
80
|
+
medium: 0.6,
|
|
81
|
+
low: 0.35
|
|
82
|
+
};
|
|
83
|
+
var DEFAULT_SEVERITY_SCORE = 0.5;
|
|
84
|
+
var RESOLVED_QUESTION_STATUSES = [
|
|
85
|
+
"answered",
|
|
86
|
+
"archived",
|
|
87
|
+
"closed",
|
|
88
|
+
"resolved",
|
|
89
|
+
"resolved_support",
|
|
90
|
+
"resolved_contra",
|
|
91
|
+
"belief_forked"
|
|
92
|
+
];
|
|
93
|
+
var TOKENS_PER_WORD = 1.35;
|
|
94
|
+
var MIN_TOKEN_ESTIMATE = 8;
|
|
95
|
+
|
|
96
|
+
export { BELIEF_TYPE_BONUS, CONTEXT_PACK_SCHEMA_VERSION, CONTEXT_PACK_SECTION_KEYS, CONTEXT_RANKING_PROFILES, DEFAULT_BELIEF_TYPE_BONUS, DEFAULT_COMPILATION_MODE, DEFAULT_ENTITY_LIMIT, DEFAULT_PRIORITY_SCORE, DEFAULT_RANKING_PROFILE, DEFAULT_SECTION_LIMIT, DEFAULT_SEVERITY_SCORE, DEFAULT_TOKEN_BUDGET, ENTITY_RANKING_WEIGHTS, MAX_ENTITY_LIMIT, MAX_SECTION_LIMIT, MAX_TOKEN_BUDGET, MIN_CONTRADICTION_BUDGET, MIN_TOKEN_BUDGET, MIN_TOKEN_ESTIMATE, PRIORITY_SCORES, RANKING_WEIGHTS, RECENCY_HALF_LIFE_DAYS, RESOLVED_QUESTION_STATUSES, SECTION_BUDGET_RATIOS, SEVERITY_SCORES, TOKENS_PER_WORD };
|
|
97
|
+
//# sourceMappingURL=contextPack.js.map
|
|
98
|
+
//# sourceMappingURL=contextPack.js.map
|