@lucern/contracts 0.1.0 → 0.1.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +3 -0
  3. package/dist/agents/v1.d.ts +2 -0
  4. package/dist/agents/v1.js +3 -0
  5. package/dist/agents/v1.js.map +1 -0
  6. package/dist/api-enums.contract.d.ts +30 -29
  7. package/dist/api-enums.contract.js +145 -133
  8. package/dist/api-enums.contract.js.map +1 -1
  9. package/dist/auth-context.contract.d.ts +2 -0
  10. package/dist/auth-context.contract.js +48 -0
  11. package/dist/auth-context.contract.js.map +1 -0
  12. package/dist/auth-session.contract.d.ts +2 -54
  13. package/dist/auth-session.contract.js +41 -43
  14. package/dist/auth-session.contract.js.map +1 -1
  15. package/dist/auth.contract.d.ts +92 -0
  16. package/dist/auth.contract.js +48 -0
  17. package/dist/auth.contract.js.map +1 -0
  18. package/dist/beliefs/v1.d.ts +2 -0
  19. package/dist/beliefs/v1.js +3 -0
  20. package/dist/beliefs/v1.js.map +1 -0
  21. package/dist/context-pack.contract.d.ts +55 -54
  22. package/dist/context-pack.contract.js +88 -160
  23. package/dist/context-pack.contract.js.map +1 -1
  24. package/dist/convex-admin.contract.d.ts +7 -0
  25. package/dist/convex-admin.contract.js +3 -0
  26. package/dist/convex-admin.contract.js.map +1 -0
  27. package/dist/events-types.contract.d.ts +1 -0
  28. package/dist/events-types.contract.js +136 -0
  29. package/dist/events-types.contract.js.map +1 -0
  30. package/dist/events.contract.d.ts +178 -0
  31. package/dist/events.contract.js +136 -0
  32. package/dist/events.contract.js.map +1 -0
  33. package/dist/evidence/v1.d.ts +2 -0
  34. package/dist/evidence/v1.js +3 -0
  35. package/dist/evidence/v1.js.map +1 -0
  36. package/dist/gateway.contract.d.ts +17 -12
  37. package/dist/gateway.contract.js +11 -11
  38. package/dist/gateway.contract.js.map +1 -1
  39. package/dist/graph/v1.d.ts +2 -0
  40. package/dist/graph/v1.js +3 -0
  41. package/dist/graph/v1.js.map +1 -0
  42. package/dist/ids.contract.d.ts +9 -0
  43. package/dist/ids.contract.js +29 -0
  44. package/dist/ids.contract.js.map +1 -0
  45. package/dist/index.d.ts +15 -22
  46. package/dist/index.js +5525 -21
  47. package/dist/index.js.map +1 -1
  48. package/dist/lens-filter.contract.d.ts +10 -9
  49. package/dist/lens-filter.contract.js +59 -84
  50. package/dist/lens-filter.contract.js.map +1 -1
  51. package/dist/lens-workflow.contract.d.ts +23 -21
  52. package/dist/lens-workflow.contract.js +116 -48
  53. package/dist/lens-workflow.contract.js.map +1 -1
  54. package/dist/mcp-tools.contract-D8kXcP6d.d.ts +254 -0
  55. package/dist/mcp-tools.contract.d.ts +1 -152
  56. package/dist/mcp-tools.contract.js +2984 -3280
  57. package/dist/mcp-tools.contract.js.map +1 -1
  58. package/dist/ontologies/v1.d.ts +2 -0
  59. package/dist/ontologies/v1.js +3 -0
  60. package/dist/ontologies/v1.js.map +1 -0
  61. package/dist/ontology-matching.contract.d.ts +1 -0
  62. package/dist/ontology-matching.contract.js +346 -0
  63. package/dist/ontology-matching.contract.js.map +1 -0
  64. package/dist/prompt.contract.d.ts +5 -4
  65. package/dist/prompt.contract.js +10 -23
  66. package/dist/prompt.contract.js.map +1 -1
  67. package/dist/questions/v1.d.ts +2 -0
  68. package/dist/questions/v1.js +3 -0
  69. package/dist/questions/v1.js.map +1 -0
  70. package/dist/sdk-methods.contract.d.ts +51 -45
  71. package/dist/sdk-methods.contract.js +2 -16
  72. package/dist/sdk-methods.contract.js.map +1 -1
  73. package/dist/sdk-tools.contract-BnV0hKLp.d.ts +150 -0
  74. package/dist/sdk-tools.contract.d.ts +2 -93
  75. package/dist/sdk-tools.contract.js +4220 -1397
  76. package/dist/sdk-tools.contract.js.map +1 -1
  77. package/dist/text-matching.contract.d.ts +55 -0
  78. package/dist/text-matching.contract.js +246 -0
  79. package/dist/text-matching.contract.js.map +1 -0
  80. package/dist/topic-scope.contract.d.ts +1 -0
  81. package/dist/topic-scope.contract.js +54 -0
  82. package/dist/topic-scope.contract.js.map +1 -0
  83. package/dist/topics/v1.d.ts +2 -0
  84. package/dist/topics/v1.js +3 -0
  85. package/dist/topics/v1.js.map +1 -0
  86. package/dist/v1/agents/v1.d.ts +2 -0
  87. package/dist/v1/agents/v1.js +3 -0
  88. package/dist/v1/agents/v1.js.map +1 -0
  89. package/dist/v1/beliefs/v1.d.ts +2 -0
  90. package/dist/v1/beliefs/v1.js +3 -0
  91. package/dist/v1/beliefs/v1.js.map +1 -0
  92. package/dist/v1/evidence/v1.d.ts +2 -0
  93. package/dist/v1/evidence/v1.js +3 -0
  94. package/dist/v1/evidence/v1.js.map +1 -0
  95. package/dist/v1/graph/v1.d.ts +2 -0
  96. package/dist/v1/graph/v1.js +3 -0
  97. package/dist/v1/graph/v1.js.map +1 -0
  98. package/dist/v1/ontologies/v1.d.ts +78 -0
  99. package/dist/v1/ontologies/v1.js +346 -0
  100. package/dist/v1/ontologies/v1.js.map +1 -0
  101. package/dist/v1/questions/v1.d.ts +2 -0
  102. package/dist/v1/questions/v1.js +3 -0
  103. package/dist/v1/questions/v1.js.map +1 -0
  104. package/dist/v1/topics/v1.d.ts +21 -0
  105. package/dist/v1/topics/v1.js +54 -0
  106. package/dist/v1/topics/v1.js.map +1 -0
  107. package/dist/v1/worktrees/v1.d.ts +2 -0
  108. package/dist/v1/worktrees/v1.js +3 -0
  109. package/dist/v1/worktrees/v1.js.map +1 -0
  110. package/dist/workflow-runtime.contract.d.ts +46 -45
  111. package/dist/workflow-runtime.contract.js +228 -241
  112. package/dist/workflow-runtime.contract.js.map +1 -1
  113. package/dist/worktrees/v1.d.ts +2 -0
  114. package/dist/worktrees/v1.js +3 -0
  115. package/dist/worktrees/v1.js.map +1 -0
  116. package/package.json +19 -13
  117. package/dist/api-enums.contract.d.ts.map +0 -1
  118. package/dist/auth-session.contract.d.ts.map +0 -1
  119. package/dist/context-pack.contract.d.ts.map +0 -1
  120. package/dist/gateway.contract.d.ts.map +0 -1
  121. package/dist/index.d.ts.map +0 -1
  122. package/dist/lens-filter.contract.d.ts.map +0 -1
  123. package/dist/lens-workflow.contract.d.ts.map +0 -1
  124. package/dist/mcp-tools.contract.d.ts.map +0 -1
  125. package/dist/prompt.contract.d.ts.map +0 -1
  126. package/dist/sdk-methods.contract.d.ts.map +0 -1
  127. package/dist/sdk-tools.contract.d.ts.map +0 -1
  128. package/dist/workflow-runtime.contract.d.ts.map +0 -1
@@ -1,50 +1,48 @@
1
- /**
2
- * Session + Delegation Contract
3
- *
4
- * Canonical session lifecycle vocabulary shared by platform gateway auth,
5
- * hosted MCP auth, Master Control persistence, and SDK session tokens.
6
- */
7
- export const SESSION_AUTH_MODES = [
8
- "interactive_user",
9
- "service_principal",
10
- "tenant_api_key",
11
- "session_token",
1
+ // src/auth.contract.ts
2
+ var SESSION_AUTH_MODES = [
3
+ "interactive_user",
4
+ "service_principal",
5
+ "tenant_api_key",
6
+ "session_token"
12
7
  ];
13
- export const SESSION_PRINCIPAL_TYPES = ["human", "service", "agent"];
14
- export const SESSION_LIFECYCLE_STATUSES = [
15
- "active",
16
- "expired",
17
- "revoked",
8
+ var SESSION_PRINCIPAL_TYPES = ["human", "service", "agent"];
9
+ var SESSION_LIFECYCLE_STATUSES = [
10
+ "active",
11
+ "expired",
12
+ "revoked"
18
13
  ];
19
- export function inferSessionPrincipalType(principalId) {
20
- if (principalId.startsWith("user:")) {
21
- return "human";
22
- }
23
- if (principalId.startsWith("agent:")) {
24
- return "agent";
25
- }
26
- return "service";
14
+ function inferSessionPrincipalType(principalId) {
15
+ if (principalId.startsWith("user:")) {
16
+ return "human";
17
+ }
18
+ if (principalId.startsWith("agent:")) {
19
+ return "agent";
20
+ }
21
+ return "service";
27
22
  }
28
- export function normalizeDelegationChain(args) {
29
- if (args.delegationChain && args.delegationChain.length > 0) {
30
- return [...args.delegationChain];
23
+ function normalizeDelegationChain(args) {
24
+ if (args.delegationChain && args.delegationChain.length > 0) {
25
+ return [...args.delegationChain];
26
+ }
27
+ if (!args.delegatedBy) {
28
+ return;
29
+ }
30
+ return [
31
+ {
32
+ principalId: args.delegatedBy,
33
+ principalType: args.delegatedByType ?? inferSessionPrincipalType(args.delegatedBy),
34
+ delegatedAt: args.delegatedAt,
35
+ reason: args.reason
31
36
  }
32
- if (!args.delegatedBy) {
33
- return;
34
- }
35
- return [
36
- {
37
- principalId: args.delegatedBy,
38
- principalType: args.delegatedByType ?? inferSessionPrincipalType(args.delegatedBy),
39
- delegatedAt: args.delegatedAt,
40
- reason: args.reason,
41
- },
42
- ];
37
+ ];
43
38
  }
44
- export function lastDelegator(delegationChain) {
45
- if (!delegationChain || delegationChain.length === 0) {
46
- return;
47
- }
48
- return delegationChain[delegationChain.length - 1]?.principalId;
39
+ function lastDelegator(delegationChain) {
40
+ if (!delegationChain || delegationChain.length === 0) {
41
+ return;
42
+ }
43
+ return delegationChain[delegationChain.length - 1]?.principalId;
49
44
  }
45
+
46
+ export { SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, inferSessionPrincipalType, lastDelegator, normalizeDelegationChain };
47
+ //# sourceMappingURL=auth-session.contract.js.map
50
48
  //# sourceMappingURL=auth-session.contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-session.contract.js","sourceRoot":"","sources":["../src/auth-session.contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,eAAe;CACP,CAAC;AAGX,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAU,CAAC;AAG9E,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,QAAQ;IACR,SAAS;IACT,SAAS;CACD,CAAC;AA2CX,MAAM,UAAU,yBAAyB,CACvC,WAAmB;IAEnB,IAAI,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,IAMxC;IACC,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,OAAO,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC;IACnC,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QACtB,OAAO;IACT,CAAC;IACD,OAAO;QACL;YACE,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,aAAa,EACX,IAAI,CAAC,eAAe,IAAI,yBAAyB,CAAC,IAAI,CAAC,WAAW,CAAC;YACrE,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,eAAiD;IAEjD,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IACD,OAAO,eAAe,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC;AAClE,CAAC"}
1
+ {"version":3,"sources":["../src/auth.contract.ts"],"names":[],"mappings":";AAgBO,IAAM,kBAAA,GAAqB;AAAA,EAChC,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAGO,IAAM,uBAAA,GAA0B,CAAC,OAAA,EAAS,SAAA,EAAW,OAAO;AAG5D,IAAM,0BAAA,GAA6B;AAAA,EACxC,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF;AA2CO,SAAS,0BACd,WAAA,EACsB;AACtB,EAAA,IAAI,WAAA,CAAY,UAAA,CAAW,OAAO,CAAA,EAAG;AACnC,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,IAAI,WAAA,CAAY,UAAA,CAAW,QAAQ,CAAA,EAAG;AACpC,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,OAAO,SAAA;AACT;AAEO,SAAS,yBAAyB,IAAA,EAMF;AACrC,EAAA,IAAI,IAAA,CAAK,eAAA,IAAmB,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAA,EAAG;AAC3D,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,eAAe,CAAA;AAAA,EACjC;AACA,EAAA,IAAI,CAAC,KAAK,WAAA,EAAa;AACrB,IAAA;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL;AAAA,MACE,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB,aAAA,EACE,IAAA,CAAK,eAAA,IAAmB,yBAAA,CAA0B,KAAK,WAAW,CAAA;AAAA,MACpE,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB,QAAQ,IAAA,CAAK;AAAA;AACf,GACF;AACF;AAEO,SAAS,cACd,eAAA,EACoB;AACpB,EAAA,IAAI,CAAC,eAAA,IAAmB,eAAA,CAAgB,MAAA,KAAW,CAAA,EAAG;AACpD,IAAA;AAAA,EACF;AACA,EAAA,OAAO,eAAA,CAAgB,eAAA,CAAgB,MAAA,GAAS,CAAC,CAAA,EAAG,WAAA;AACtD","file":"auth-session.contract.js","sourcesContent":["/**\n * @lucern/contracts — auth (canonical support contract)\n *\n * Consolidated flat support surface for Lucern authentication:\n * - Session primitives (auth modes, principal types, lifecycle)\n * - AuthContext shape + McpTransportKind + LucernSdkClient alias\n *\n * Consolidated from src/auth-session.contract.ts and src/auth-context.contract.ts\n * in EK-16 T1 PR 3a. Compat shims remain at both old paths until Lucern 1.0.0 (D12).\n */\n\n// =============================================================================\n// SESSION PRIMITIVES\n// (Formerly src/auth-session.contract.ts)\n// =============================================================================\n\nexport const SESSION_AUTH_MODES = [\n \"interactive_user\",\n \"service_principal\",\n \"tenant_api_key\",\n \"session_token\",\n] as const;\nexport type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];\n\nexport const SESSION_PRINCIPAL_TYPES = [\"human\", \"service\", \"agent\"] as const;\nexport type SessionPrincipalType = (typeof SESSION_PRINCIPAL_TYPES)[number];\n\nexport const SESSION_LIFECYCLE_STATUSES = [\n \"active\",\n \"expired\",\n \"revoked\",\n] as const;\nexport type SessionLifecycleStatus =\n (typeof SESSION_LIFECYCLE_STATUSES)[number];\n\nexport type SessionDelegationHop = {\n principalId: string;\n principalType: SessionPrincipalType;\n authMode?: SessionAuthMode;\n sessionId?: string;\n delegatedAt?: number;\n reason?: string;\n};\n\nexport type SessionAuditOutcome =\n | \"accepted\"\n | \"rejected\"\n | \"revoked\"\n | \"expired\";\n\nexport type SessionAuditEnvelope = {\n sessionId: string;\n authMode: SessionAuthMode;\n principalId: string;\n principalType: SessionPrincipalType;\n tenantId: string;\n workspaceId?: string;\n apiKeyId?: string;\n scopes: readonly string[];\n roles?: readonly string[];\n delegationChain?: readonly SessionDelegationHop[];\n sourceSessionId?: string;\n expiresAt?: number;\n request?: {\n endpoint?: string;\n method?: string;\n correlationId?: string;\n };\n result?: {\n outcome: SessionAuditOutcome;\n reason?: string;\n };\n};\n\nexport function inferSessionPrincipalType(\n principalId: string\n): SessionPrincipalType {\n if (principalId.startsWith(\"user:\")) {\n return \"human\";\n }\n if (principalId.startsWith(\"agent:\")) {\n return \"agent\";\n }\n return \"service\";\n}\n\nexport function normalizeDelegationChain(args: {\n delegationChain?: readonly SessionDelegationHop[];\n delegatedBy?: string;\n delegatedByType?: SessionPrincipalType;\n delegatedAt?: number;\n reason?: string;\n}): SessionDelegationHop[] | undefined {\n if (args.delegationChain && args.delegationChain.length > 0) {\n return [...args.delegationChain];\n }\n if (!args.delegatedBy) {\n return;\n }\n return [\n {\n principalId: args.delegatedBy,\n principalType:\n args.delegatedByType ?? inferSessionPrincipalType(args.delegatedBy),\n delegatedAt: args.delegatedAt,\n reason: args.reason,\n },\n ];\n}\n\nexport function lastDelegator(\n delegationChain?: readonly SessionDelegationHop[]\n): string | undefined {\n if (!delegationChain || delegationChain.length === 0) {\n return;\n }\n return delegationChain[delegationChain.length - 1]?.principalId;\n}\n\n// =============================================================================\n// AUTH CONTEXT\n// (Formerly src/auth-context.contract.ts)\n// =============================================================================\n\nimport type { ConvexAdminClient } from \"./convex-admin.contract\";\n\nexport type McpTransportKind = \"stdio\" | \"hosted\";\n\nexport type LucernSdkClient = unknown;\n\n/**\n * Session authentication context — injected by withAuth() middleware.\n *\n * Built from TenantConfig at dispatch time. Agent sessions get\n * AGENT_IDENTITY + \"agent:internal\" role + unrestricted access.\n * User sessions get Clerk userId + resolved role + tool ACLs.\n */\nexport type AuthContext = {\n sessionType: \"agent\" | \"user\";\n userId: string; // AGENT_IDENTITY for agents, Clerk userId for users\n tenantId: string;\n role: string; // \"agent:internal\" | \"platform_admin\" | \"tenant_admin\" | \"editor\" | \"viewer\" | ...\n allowedTopics: string[] | null; // null = unrestricted (agents, admins). Block 11D populates this.\n // Layer 2a: Group-pack binding — resolved at boot from MC resolveUserPackAccess\n groupIds: string[]; // Groups this user belongs to (empty for agents)\n permittedPackKeys: string[]; // Packs accessible via group assignments (empty = no pack filtering)\n sessionId: string; // S2-13K: MCP process session UUID for audit attribution\n principalId?: string;\n principalType?: SessionPrincipalType;\n workspaceId?: string;\n scopes?: string[];\n authMode?: SessionAuthMode;\n roles?: string[];\n transportKind?: McpTransportKind;\n lucernClient?: LucernSdkClient;\n convex?: ConvexAdminClient;\n setDefaultScopeContext?: (scopeId: string) => Promise<unknown>;\n matchesWorkspaceReasoningScope?: (\n node: unknown,\n scope: unknown\n ) => boolean;\n};\n"]}
@@ -0,0 +1,92 @@
1
+ import { ConvexAdminClient } from './convex-admin.contract.js';
2
+
3
+ /**
4
+ * @lucern/contracts — auth (canonical support contract)
5
+ *
6
+ * Consolidated flat support surface for Lucern authentication:
7
+ * - Session primitives (auth modes, principal types, lifecycle)
8
+ * - AuthContext shape + McpTransportKind + LucernSdkClient alias
9
+ *
10
+ * Consolidated from src/auth-session.contract.ts and src/auth-context.contract.ts
11
+ * in EK-16 T1 PR 3a. Compat shims remain at both old paths until Lucern 1.0.0 (D12).
12
+ */
13
+ declare const SESSION_AUTH_MODES: readonly ["interactive_user", "service_principal", "tenant_api_key", "session_token"];
14
+ type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];
15
+ declare const SESSION_PRINCIPAL_TYPES: readonly ["human", "service", "agent"];
16
+ type SessionPrincipalType = (typeof SESSION_PRINCIPAL_TYPES)[number];
17
+ declare const SESSION_LIFECYCLE_STATUSES: readonly ["active", "expired", "revoked"];
18
+ type SessionLifecycleStatus = (typeof SESSION_LIFECYCLE_STATUSES)[number];
19
+ type SessionDelegationHop = {
20
+ principalId: string;
21
+ principalType: SessionPrincipalType;
22
+ authMode?: SessionAuthMode;
23
+ sessionId?: string;
24
+ delegatedAt?: number;
25
+ reason?: string;
26
+ };
27
+ type SessionAuditOutcome = "accepted" | "rejected" | "revoked" | "expired";
28
+ type SessionAuditEnvelope = {
29
+ sessionId: string;
30
+ authMode: SessionAuthMode;
31
+ principalId: string;
32
+ principalType: SessionPrincipalType;
33
+ tenantId: string;
34
+ workspaceId?: string;
35
+ apiKeyId?: string;
36
+ scopes: readonly string[];
37
+ roles?: readonly string[];
38
+ delegationChain?: readonly SessionDelegationHop[];
39
+ sourceSessionId?: string;
40
+ expiresAt?: number;
41
+ request?: {
42
+ endpoint?: string;
43
+ method?: string;
44
+ correlationId?: string;
45
+ };
46
+ result?: {
47
+ outcome: SessionAuditOutcome;
48
+ reason?: string;
49
+ };
50
+ };
51
+ declare function inferSessionPrincipalType(principalId: string): SessionPrincipalType;
52
+ declare function normalizeDelegationChain(args: {
53
+ delegationChain?: readonly SessionDelegationHop[];
54
+ delegatedBy?: string;
55
+ delegatedByType?: SessionPrincipalType;
56
+ delegatedAt?: number;
57
+ reason?: string;
58
+ }): SessionDelegationHop[] | undefined;
59
+ declare function lastDelegator(delegationChain?: readonly SessionDelegationHop[]): string | undefined;
60
+
61
+ type McpTransportKind = "stdio" | "hosted";
62
+ type LucernSdkClient = unknown;
63
+ /**
64
+ * Session authentication context — injected by withAuth() middleware.
65
+ *
66
+ * Built from TenantConfig at dispatch time. Agent sessions get
67
+ * AGENT_IDENTITY + "agent:internal" role + unrestricted access.
68
+ * User sessions get Clerk userId + resolved role + tool ACLs.
69
+ */
70
+ type AuthContext = {
71
+ sessionType: "agent" | "user";
72
+ userId: string;
73
+ tenantId: string;
74
+ role: string;
75
+ allowedTopics: string[] | null;
76
+ groupIds: string[];
77
+ permittedPackKeys: string[];
78
+ sessionId: string;
79
+ principalId?: string;
80
+ principalType?: SessionPrincipalType;
81
+ workspaceId?: string;
82
+ scopes?: string[];
83
+ authMode?: SessionAuthMode;
84
+ roles?: string[];
85
+ transportKind?: McpTransportKind;
86
+ lucernClient?: LucernSdkClient;
87
+ convex?: ConvexAdminClient;
88
+ setDefaultScopeContext?: (scopeId: string) => Promise<unknown>;
89
+ matchesWorkspaceReasoningScope?: (node: unknown, scope: unknown) => boolean;
90
+ };
91
+
92
+ export { type AuthContext, type LucernSdkClient, type McpTransportKind, SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, type SessionAuditEnvelope, type SessionAuditOutcome, type SessionAuthMode, type SessionDelegationHop, type SessionLifecycleStatus, type SessionPrincipalType, inferSessionPrincipalType, lastDelegator, normalizeDelegationChain };
@@ -0,0 +1,48 @@
1
+ // src/auth.contract.ts
2
+ var SESSION_AUTH_MODES = [
3
+ "interactive_user",
4
+ "service_principal",
5
+ "tenant_api_key",
6
+ "session_token"
7
+ ];
8
+ var SESSION_PRINCIPAL_TYPES = ["human", "service", "agent"];
9
+ var SESSION_LIFECYCLE_STATUSES = [
10
+ "active",
11
+ "expired",
12
+ "revoked"
13
+ ];
14
+ function inferSessionPrincipalType(principalId) {
15
+ if (principalId.startsWith("user:")) {
16
+ return "human";
17
+ }
18
+ if (principalId.startsWith("agent:")) {
19
+ return "agent";
20
+ }
21
+ return "service";
22
+ }
23
+ function normalizeDelegationChain(args) {
24
+ if (args.delegationChain && args.delegationChain.length > 0) {
25
+ return [...args.delegationChain];
26
+ }
27
+ if (!args.delegatedBy) {
28
+ return;
29
+ }
30
+ return [
31
+ {
32
+ principalId: args.delegatedBy,
33
+ principalType: args.delegatedByType ?? inferSessionPrincipalType(args.delegatedBy),
34
+ delegatedAt: args.delegatedAt,
35
+ reason: args.reason
36
+ }
37
+ ];
38
+ }
39
+ function lastDelegator(delegationChain) {
40
+ if (!delegationChain || delegationChain.length === 0) {
41
+ return;
42
+ }
43
+ return delegationChain[delegationChain.length - 1]?.principalId;
44
+ }
45
+
46
+ export { SESSION_AUTH_MODES, SESSION_LIFECYCLE_STATUSES, SESSION_PRINCIPAL_TYPES, inferSessionPrincipalType, lastDelegator, normalizeDelegationChain };
47
+ //# sourceMappingURL=auth.contract.js.map
48
+ //# sourceMappingURL=auth.contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/auth.contract.ts"],"names":[],"mappings":";AAgBO,IAAM,kBAAA,GAAqB;AAAA,EAChC,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF;AAGO,IAAM,uBAAA,GAA0B,CAAC,OAAA,EAAS,SAAA,EAAW,OAAO;AAG5D,IAAM,0BAAA,GAA6B;AAAA,EACxC,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF;AA2CO,SAAS,0BACd,WAAA,EACsB;AACtB,EAAA,IAAI,WAAA,CAAY,UAAA,CAAW,OAAO,CAAA,EAAG;AACnC,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,IAAI,WAAA,CAAY,UAAA,CAAW,QAAQ,CAAA,EAAG;AACpC,IAAA,OAAO,OAAA;AAAA,EACT;AACA,EAAA,OAAO,SAAA;AACT;AAEO,SAAS,yBAAyB,IAAA,EAMF;AACrC,EAAA,IAAI,IAAA,CAAK,eAAA,IAAmB,IAAA,CAAK,eAAA,CAAgB,SAAS,CAAA,EAAG;AAC3D,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,eAAe,CAAA;AAAA,EACjC;AACA,EAAA,IAAI,CAAC,KAAK,WAAA,EAAa;AACrB,IAAA;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL;AAAA,MACE,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB,aAAA,EACE,IAAA,CAAK,eAAA,IAAmB,yBAAA,CAA0B,KAAK,WAAW,CAAA;AAAA,MACpE,aAAa,IAAA,CAAK,WAAA;AAAA,MAClB,QAAQ,IAAA,CAAK;AAAA;AACf,GACF;AACF;AAEO,SAAS,cACd,eAAA,EACoB;AACpB,EAAA,IAAI,CAAC,eAAA,IAAmB,eAAA,CAAgB,MAAA,KAAW,CAAA,EAAG;AACpD,IAAA;AAAA,EACF;AACA,EAAA,OAAO,eAAA,CAAgB,eAAA,CAAgB,MAAA,GAAS,CAAC,CAAA,EAAG,WAAA;AACtD","file":"auth.contract.js","sourcesContent":["/**\n * @lucern/contracts — auth (canonical support contract)\n *\n * Consolidated flat support surface for Lucern authentication:\n * - Session primitives (auth modes, principal types, lifecycle)\n * - AuthContext shape + McpTransportKind + LucernSdkClient alias\n *\n * Consolidated from src/auth-session.contract.ts and src/auth-context.contract.ts\n * in EK-16 T1 PR 3a. Compat shims remain at both old paths until Lucern 1.0.0 (D12).\n */\n\n// =============================================================================\n// SESSION PRIMITIVES\n// (Formerly src/auth-session.contract.ts)\n// =============================================================================\n\nexport const SESSION_AUTH_MODES = [\n \"interactive_user\",\n \"service_principal\",\n \"tenant_api_key\",\n \"session_token\",\n] as const;\nexport type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];\n\nexport const SESSION_PRINCIPAL_TYPES = [\"human\", \"service\", \"agent\"] as const;\nexport type SessionPrincipalType = (typeof SESSION_PRINCIPAL_TYPES)[number];\n\nexport const SESSION_LIFECYCLE_STATUSES = [\n \"active\",\n \"expired\",\n \"revoked\",\n] as const;\nexport type SessionLifecycleStatus =\n (typeof SESSION_LIFECYCLE_STATUSES)[number];\n\nexport type SessionDelegationHop = {\n principalId: string;\n principalType: SessionPrincipalType;\n authMode?: SessionAuthMode;\n sessionId?: string;\n delegatedAt?: number;\n reason?: string;\n};\n\nexport type SessionAuditOutcome =\n | \"accepted\"\n | \"rejected\"\n | \"revoked\"\n | \"expired\";\n\nexport type SessionAuditEnvelope = {\n sessionId: string;\n authMode: SessionAuthMode;\n principalId: string;\n principalType: SessionPrincipalType;\n tenantId: string;\n workspaceId?: string;\n apiKeyId?: string;\n scopes: readonly string[];\n roles?: readonly string[];\n delegationChain?: readonly SessionDelegationHop[];\n sourceSessionId?: string;\n expiresAt?: number;\n request?: {\n endpoint?: string;\n method?: string;\n correlationId?: string;\n };\n result?: {\n outcome: SessionAuditOutcome;\n reason?: string;\n };\n};\n\nexport function inferSessionPrincipalType(\n principalId: string\n): SessionPrincipalType {\n if (principalId.startsWith(\"user:\")) {\n return \"human\";\n }\n if (principalId.startsWith(\"agent:\")) {\n return \"agent\";\n }\n return \"service\";\n}\n\nexport function normalizeDelegationChain(args: {\n delegationChain?: readonly SessionDelegationHop[];\n delegatedBy?: string;\n delegatedByType?: SessionPrincipalType;\n delegatedAt?: number;\n reason?: string;\n}): SessionDelegationHop[] | undefined {\n if (args.delegationChain && args.delegationChain.length > 0) {\n return [...args.delegationChain];\n }\n if (!args.delegatedBy) {\n return;\n }\n return [\n {\n principalId: args.delegatedBy,\n principalType:\n args.delegatedByType ?? inferSessionPrincipalType(args.delegatedBy),\n delegatedAt: args.delegatedAt,\n reason: args.reason,\n },\n ];\n}\n\nexport function lastDelegator(\n delegationChain?: readonly SessionDelegationHop[]\n): string | undefined {\n if (!delegationChain || delegationChain.length === 0) {\n return;\n }\n return delegationChain[delegationChain.length - 1]?.principalId;\n}\n\n// =============================================================================\n// AUTH CONTEXT\n// (Formerly src/auth-context.contract.ts)\n// =============================================================================\n\nimport type { ConvexAdminClient } from \"./convex-admin.contract\";\n\nexport type McpTransportKind = \"stdio\" | \"hosted\";\n\nexport type LucernSdkClient = unknown;\n\n/**\n * Session authentication context — injected by withAuth() middleware.\n *\n * Built from TenantConfig at dispatch time. Agent sessions get\n * AGENT_IDENTITY + \"agent:internal\" role + unrestricted access.\n * User sessions get Clerk userId + resolved role + tool ACLs.\n */\nexport type AuthContext = {\n sessionType: \"agent\" | \"user\";\n userId: string; // AGENT_IDENTITY for agents, Clerk userId for users\n tenantId: string;\n role: string; // \"agent:internal\" | \"platform_admin\" | \"tenant_admin\" | \"editor\" | \"viewer\" | ...\n allowedTopics: string[] | null; // null = unrestricted (agents, admins). Block 11D populates this.\n // Layer 2a: Group-pack binding — resolved at boot from MC resolveUserPackAccess\n groupIds: string[]; // Groups this user belongs to (empty for agents)\n permittedPackKeys: string[]; // Packs accessible via group assignments (empty = no pack filtering)\n sessionId: string; // S2-13K: MCP process session UUID for audit attribution\n principalId?: string;\n principalType?: SessionPrincipalType;\n workspaceId?: string;\n scopes?: string[];\n authMode?: SessionAuthMode;\n roles?: string[];\n transportKind?: McpTransportKind;\n lucernClient?: LucernSdkClient;\n convex?: ConvexAdminClient;\n setDefaultScopeContext?: (scopeId: string) => Promise<unknown>;\n matchesWorkspaceReasoningScope?: (\n node: unknown,\n scope: unknown\n ) => boolean;\n};\n"]}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=v1.js.map
3
+ //# sourceMappingURL=v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"v1.js"}
@@ -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
- export declare const CONTEXT_PACK_SCHEMA_VERSION: "1.0.0";
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
- export type ContextRankingProfile = "baseline_v1" | "weighted_v1";
26
- export declare const CONTEXT_RANKING_PROFILES: readonly ContextRankingProfile[];
27
- export declare const DEFAULT_RANKING_PROFILE: ContextRankingProfile;
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
- export type ContextCompilationMode = "standard" | "delta";
36
- export declare const DEFAULT_COMPILATION_MODE: ContextCompilationMode;
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
- export type ContextPackSectionKey = "invariants" | "activeBeliefs" | "openQuestions" | "recentEvidence" | "contradictions";
42
- export declare const CONTEXT_PACK_SECTION_KEYS: readonly ContextPackSectionKey[];
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
- export declare const SECTION_BUDGET_RATIOS: Readonly<Record<ContextPackSectionKey, number>>;
54
+ declare const SECTION_BUDGET_RATIOS: Readonly<Record<ContextPackSectionKey, number>>;
55
55
  /** Minimum allowed token budget. Below this, context packs lose utility. */
56
- export declare const MIN_TOKEN_BUDGET = 400;
56
+ declare const MIN_TOKEN_BUDGET = 400;
57
57
  /** Maximum allowed token budget. Above this, context packs bloat prompts. */
58
- export declare const MAX_TOKEN_BUDGET = 8000;
58
+ declare const MAX_TOKEN_BUDGET = 8000;
59
59
  /** Default token budget when caller does not specify. */
60
- export declare const DEFAULT_TOKEN_BUDGET = 1800;
60
+ declare const DEFAULT_TOKEN_BUDGET = 1800;
61
61
  /** Default max items per section. */
62
- export declare const DEFAULT_SECTION_LIMIT = 8;
62
+ declare const DEFAULT_SECTION_LIMIT = 8;
63
63
  /** Hard ceiling on items per section. */
64
- export declare const MAX_SECTION_LIMIT = 25;
64
+ declare const MAX_SECTION_LIMIT = 25;
65
65
  /** Minimum contradiction section budget floor (tokens). */
66
- export declare const MIN_CONTRADICTION_BUDGET = 40;
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
- export type RankingWeightVector = {
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
- export declare const RANKING_WEIGHTS: Readonly<Record<ContextPackSectionKey, RankingWeightVector>>;
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
- export declare const RECENCY_HALF_LIFE_DAYS = 30;
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
- export declare const ENTITY_RANKING_WEIGHTS: {
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
- export declare const DEFAULT_ENTITY_LIMIT = 10;
100
+ declare const DEFAULT_ENTITY_LIMIT = 10;
101
101
  /** Hard ceiling on entities per context pack. */
102
- export declare const MAX_ENTITY_LIMIT = 50;
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
- export declare const BELIEF_TYPE_BONUS: Readonly<Record<string, number>>;
108
- export declare const DEFAULT_BELIEF_TYPE_BONUS = 0.4;
109
- export declare const PRIORITY_SCORES: Readonly<Record<string, number>>;
110
- export declare const DEFAULT_PRIORITY_SCORE = 0.5;
111
- export declare const SEVERITY_SCORES: Readonly<Record<string, number>>;
112
- export declare const DEFAULT_SEVERITY_SCORE = 0.5;
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
- export type ContextPackBelief = {
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
- export type ContextPackQuestion = {
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
- export type ContextPackEvidence = {
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
- export type ContextPackContradiction = {
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
- export type ContextPackEntity = {
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
- export type BeliefLatticeSeed = {
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
- export type ContextPackSummary = {
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
- export type ContextPackFailure = {
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
- export type ContextPackFailureContext = {
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
- export type VerificationObligation = {
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
- export type ContextPackDeltaReport = {
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
- export type PackWeightOverride = {
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
- export type ContextPackInjectionPolicy = {
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
- export type ContextPackDiagnostics = {
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
- export type PublicContextBelief = {
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
- export type PublicContextQuestion = {
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
- export type PublicContextEvidence = {
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
- export type PublicContextContradiction = {
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
- export type PublicContextEntity = {
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
- export type PublicContextInjectionPolicy = {
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
- export type PublicCompiledContext = {
352
+ type PublicCompiledContext = {
353
353
  schemaVersion: string;
354
354
  topicId: string;
355
355
  topicName: string;
@@ -400,7 +400,7 @@ 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
- export type ContextPackV1 = {
403
+ type ContextPackV1 = {
404
404
  /** Schema version for compatibility checking. */
405
405
  schemaVersion: typeof CONTEXT_PACK_SCHEMA_VERSION;
406
406
  /** Deprecated compatibility alias for the requested scope ID. */
@@ -452,7 +452,7 @@ export type ContextPackV1 = {
452
452
  * The canonical input schema for `compile_context`.
453
453
  * `topicId` is canonical. `projectId` remains an optional compatibility alias.
454
454
  */
455
- export type ContextPackRequestV1 = {
455
+ type ContextPackRequestV1 = {
456
456
  /** Topic scope ID (required). */
457
457
  topicId: string;
458
458
  /** Deprecated compatibility alias for older callers. */
@@ -484,12 +484,13 @@ export type ContextPackRequestV1 = {
484
484
  * Question statuses that are considered "resolved" (not open).
485
485
  * Used to filter which questions appear in the openQuestions section.
486
486
  */
487
- export declare const RESOLVED_QUESTION_STATUSES: readonly string[];
487
+ declare const RESOLVED_QUESTION_STATUSES: readonly string[];
488
488
  /**
489
489
  * Tokens-per-word multiplier for rough token estimation.
490
490
  * Conservative estimate: ~1.35 tokens per whitespace-delimited word.
491
491
  */
492
- export declare const TOKENS_PER_WORD = 1.35;
492
+ declare const TOKENS_PER_WORD = 1.35;
493
493
  /** Minimum token estimate for any non-empty string. */
494
- export declare const MIN_TOKEN_ESTIMATE = 8;
495
- //# sourceMappingURL=context-pack.contract.d.ts.map
494
+ declare const MIN_TOKEN_ESTIMATE = 8;
495
+
496
+ 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 };