@lucern/sdk 0.2.0-alpha.5 → 0.2.0-alpha.6
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/dist/lib/platform/sdk/contextFacade.d.ts +10 -0
- package/dist/lib/platform/sdk/contextFacade.js +10 -0
- package/dist/lib/platform/sdk/contextPackCompiler.d.ts +1 -1
- package/dist/lib/platform/sdk/contextPackCompiler.js +2 -2
- package/dist/lib/platform/sdk/eventsCore.d.ts +13 -0
- package/dist/lib/platform/sdk/eventsCore.js +13 -0
- package/dist/lib/platform/sdk/index.d.ts +3 -0
- package/dist/lib/platform/sdk/index.js +3 -0
- package/dist/lib/platform/sdk/promptCatalog.d.ts +1 -1
- package/dist/lib/platform/sdk/promptCatalog.js +1 -1
- package/dist/lucern/contracts/src/auth-context.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/auth-context.contract.js +8 -0
- package/dist/lucern/contracts/src/auth-session.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/auth-session.contract.js +8 -0
- package/dist/lucern/contracts/src/auth.contract.d.ts +88 -0
- package/dist/lucern/contracts/src/auth.contract.js +57 -0
- package/dist/lucern/contracts/src/context-pack.contract.d.ts +494 -0
- package/dist/lucern/contracts/src/context-pack.contract.js +169 -0
- package/dist/lucern/contracts/src/convex-admin.contract.d.ts +5 -0
- package/dist/lucern/contracts/src/convex-admin.contract.js +1 -0
- package/dist/lucern/contracts/src/events-types.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/events-types.contract.js +8 -0
- package/dist/lucern/contracts/src/events.contract.d.ts +176 -0
- package/dist/lucern/contracts/src/events.contract.js +159 -0
- package/dist/lucern/contracts/src/gateway.contract.d.ts +74 -0
- package/dist/lucern/contracts/src/gateway.contract.js +19 -0
- package/dist/lucern/contracts/src/ids.contract.d.ts +7 -0
- package/dist/lucern/contracts/src/ids.contract.js +24 -0
- package/dist/lucern/contracts/src/index.d.ts +29 -0
- package/dist/lucern/contracts/src/index.js +29 -0
- package/dist/lucern/contracts/src/ontology-matching.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/ontology-matching.contract.js +8 -0
- package/dist/lucern/contracts/src/prompt.contract.d.ts +24 -0
- package/dist/lucern/contracts/src/prompt.contract.js +24 -0
- package/dist/lucern/contracts/src/sdk-methods.contract.d.ts +358 -0
- package/dist/lucern/contracts/src/sdk-methods.contract.js +19 -0
- package/dist/lucern/contracts/src/sdk-tools.contract.d.ts +92 -0
- package/dist/lucern/contracts/src/sdk-tools.contract.js +1398 -0
- package/dist/lucern/contracts/src/text-matching.contract.d.ts +53 -0
- package/dist/lucern/contracts/src/text-matching.contract.js +277 -0
- package/dist/lucern/contracts/src/topic-scope.contract.d.ts +8 -0
- package/dist/lucern/contracts/src/topic-scope.contract.js +8 -0
- package/dist/lucern/contracts/src/workflow-runtime.contract.d.ts +161 -0
- package/dist/lucern/contracts/src/workflow-runtime.contract.js +257 -0
- package/dist/realtime-refs.d.ts +1 -0
- package/dist/realtime-refs.js +1 -0
- package/dist/realtime.d.ts +1 -0
- package/dist/realtime.js +1 -0
- package/package.json +6 -7
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context facade factory exposed for testing / audit tooling.
|
|
3
|
+
*
|
|
4
|
+
* Lives canonically in `lucern/packages/sdk/src/facade/context` and is
|
|
5
|
+
* re-exported here so downstream tests can import from the public
|
|
6
|
+
* `@lucern/sdk` entry point.
|
|
7
|
+
*
|
|
8
|
+
* Added: EK-16 T7.3.4 (2026-04-18).
|
|
9
|
+
*/
|
|
10
|
+
export { createContextFacade, type ContextFacadeConfig, type ContextFacadeTransport, } from "./facade/context";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context facade factory exposed for testing / audit tooling.
|
|
3
|
+
*
|
|
4
|
+
* Lives canonically in `lucern/packages/sdk/src/facade/context` and is
|
|
5
|
+
* re-exported here so downstream tests can import from the public
|
|
6
|
+
* `@lucern/sdk` entry point.
|
|
7
|
+
*
|
|
8
|
+
* Added: EK-16 T7.3.4 (2026-04-18).
|
|
9
|
+
*/
|
|
10
|
+
export { createContextFacade, } from "./facade/context.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ContextCompilationMode, type ContextPackV1, type PackWeightOverride, type ContextRankingProfile } from "./contracts/context-pack.contract";
|
|
2
|
-
import { resolveEffectiveWeights } from "
|
|
2
|
+
import { resolveEffectiveWeights } from "@lucern/reasoning-kernel/compat/contextPackPolicy";
|
|
3
3
|
export type ContextPackTopicRow = {
|
|
4
4
|
_id: string;
|
|
5
5
|
name?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CONTEXT_PACK_SCHEMA_VERSION, DEFAULT_COMPILATION_MODE, DEFAULT_ENTITY_LIMIT, MAX_ENTITY_LIMIT, } from "./contracts/context-pack.contract.js";
|
|
2
|
-
import { buildInjectionPlan, parseTokenBudget, rankContextSection, rankEntities, resolveEffectiveWeights, } from "
|
|
3
|
-
import { validateContextPackSchema } from "
|
|
2
|
+
import { buildInjectionPlan, parseTokenBudget, rankContextSection, rankEntities, resolveEffectiveWeights, } from "@lucern/reasoning-kernel/compat/contextPackPolicy";
|
|
3
|
+
import { validateContextPackSchema } from "@/packages/mcp/src/contextPackSchema";
|
|
4
4
|
function assertContextPackSchema(payload) {
|
|
5
5
|
const result = validateContextPackSchema(payload);
|
|
6
6
|
if (!result.valid) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal events/webhooks client factories exposed for testing / audit.
|
|
3
|
+
*
|
|
4
|
+
* These core factories live in `@lucern/client-core` and are bundled
|
|
5
|
+
* into `@lucern/sdk` at build time via the tsup alias map. Re-exported
|
|
6
|
+
* here so downstream test/audit tooling can import them from the
|
|
7
|
+
* public `@lucern/sdk` entry point instead of reaching into the
|
|
8
|
+
* package internals directly.
|
|
9
|
+
*
|
|
10
|
+
* Added: EK-16 T7.3.4 (2026-04-18).
|
|
11
|
+
*/
|
|
12
|
+
export { createEventsClientCore, type EventsClientCoreConfig, } from "@/lucern/packages/client-core/src/events";
|
|
13
|
+
export { createWebhooksClientCore, type WebhooksClientCoreConfig, } from "@/lucern/packages/client-core/src/webhooks";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal events/webhooks client factories exposed for testing / audit.
|
|
3
|
+
*
|
|
4
|
+
* These core factories live in `@lucern/client-core` and are bundled
|
|
5
|
+
* into `@lucern/sdk` at build time via the tsup alias map. Re-exported
|
|
6
|
+
* here so downstream test/audit tooling can import them from the
|
|
7
|
+
* public `@lucern/sdk` entry point instead of reaching into the
|
|
8
|
+
* package internals directly.
|
|
9
|
+
*
|
|
10
|
+
* Added: EK-16 T7.3.4 (2026-04-18).
|
|
11
|
+
*/
|
|
12
|
+
export { createEventsClientCore, } from "@/lucern/packages/client-core/src/events";
|
|
13
|
+
export { createWebhooksClientCore, } from "@/lucern/packages/client-core/src/webhooks";
|
|
@@ -12,6 +12,7 @@ export * from "./audiencesClient";
|
|
|
12
12
|
export * from "./auditClient";
|
|
13
13
|
export * from "./beliefsClient";
|
|
14
14
|
export * from "./client";
|
|
15
|
+
export * from "./contextFacade";
|
|
15
16
|
export * from "./contextPackCompiler";
|
|
16
17
|
export * from "./controlObjectOwnership";
|
|
17
18
|
export * from "./coreClient";
|
|
@@ -28,11 +29,13 @@ export * from "./domainContext";
|
|
|
28
29
|
export * from "./customTools";
|
|
29
30
|
export * from "./decisionsClient";
|
|
30
31
|
export * from "./events";
|
|
32
|
+
export * from "./eventsCore";
|
|
31
33
|
export * from "./graphClient";
|
|
32
34
|
export * from "./harnessClient";
|
|
33
35
|
export * from "./identityClient";
|
|
34
36
|
export * from "./learningClient";
|
|
35
37
|
export * from "./mcpParityClient";
|
|
38
|
+
export * from "./mcpParitySurface";
|
|
36
39
|
export * from "./ontologyClient";
|
|
37
40
|
export * from "./packRuntime";
|
|
38
41
|
export * from "./packsClient";
|
|
@@ -12,6 +12,7 @@ export * from "./audiencesClient.js";
|
|
|
12
12
|
export * from "./auditClient.js";
|
|
13
13
|
export * from "./beliefsClient.js";
|
|
14
14
|
export * from "./client.js";
|
|
15
|
+
export * from "./contextFacade.js";
|
|
15
16
|
export * from "./contextPackCompiler.js";
|
|
16
17
|
export * from "./controlObjectOwnership.js";
|
|
17
18
|
export * from "./coreClient.js";
|
|
@@ -28,11 +29,13 @@ export * from "./domainContext.js";
|
|
|
28
29
|
export * from "./customTools.js";
|
|
29
30
|
export * from "./decisionsClient.js";
|
|
30
31
|
export * from "./events.js";
|
|
32
|
+
export * from "./eventsCore.js";
|
|
31
33
|
export * from "./graphClient.js";
|
|
32
34
|
export * from "./harnessClient.js";
|
|
33
35
|
export * from "./identityClient.js";
|
|
34
36
|
export * from "./learningClient.js";
|
|
35
37
|
export * from "./mcpParityClient.js";
|
|
38
|
+
export * from "./mcpParitySurface.js";
|
|
36
39
|
export * from "./ontologyClient.js";
|
|
37
40
|
export * from "./packRuntime.js";
|
|
38
41
|
export * from "./packsClient.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getPromptCatalogSnapshot } from "
|
|
1
|
+
export { getPromptCatalogSnapshot } from "@/lib/langfuse/prompt-catalog";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getPromptCatalogSnapshot } from "
|
|
1
|
+
export { getPromptCatalogSnapshot } from "@/lib/langfuse/prompt-catalog";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth-context compat shim
|
|
3
|
+
*
|
|
4
|
+
* This file consolidated into ./auth.contract.ts during EK-16 T1 PR 3a.
|
|
5
|
+
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
+
* New code should import from "@lucern/contracts" (barrel) or "./auth.contract".
|
|
7
|
+
*/
|
|
8
|
+
export * from "./auth.contract";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth-context compat shim
|
|
3
|
+
*
|
|
4
|
+
* This file consolidated into ./auth.contract.ts during EK-16 T1 PR 3a.
|
|
5
|
+
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
+
* New code should import from "@lucern/contracts" (barrel) or "./auth.contract".
|
|
7
|
+
*/
|
|
8
|
+
export * from "./auth.contract.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth-session compat shim
|
|
3
|
+
*
|
|
4
|
+
* This file consolidated into ./auth.contract.ts during EK-16 T1 PR 3a.
|
|
5
|
+
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
+
* New code should import from "@lucern/contracts" (barrel) or "./auth.contract".
|
|
7
|
+
*/
|
|
8
|
+
export * from "./auth.contract";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth-session compat shim
|
|
3
|
+
*
|
|
4
|
+
* This file consolidated into ./auth.contract.ts during EK-16 T1 PR 3a.
|
|
5
|
+
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
+
* New code should import from "@lucern/contracts" (barrel) or "./auth.contract".
|
|
7
|
+
*/
|
|
8
|
+
export * from "./auth.contract.js";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth (canonical support contract)
|
|
3
|
+
*
|
|
4
|
+
* Consolidated flat support surface for Lucern authentication:
|
|
5
|
+
* - Session primitives (auth modes, principal types, lifecycle)
|
|
6
|
+
* - AuthContext shape + McpTransportKind + LucernSdkClient alias
|
|
7
|
+
*
|
|
8
|
+
* Consolidated from src/auth-session.contract.ts and src/auth-context.contract.ts
|
|
9
|
+
* in EK-16 T1 PR 3a. Compat shims remain at both old paths until Lucern 1.0.0 (D12).
|
|
10
|
+
*/
|
|
11
|
+
export declare const SESSION_AUTH_MODES: readonly ["interactive_user", "service_principal", "tenant_api_key", "session_token"];
|
|
12
|
+
export type SessionAuthMode = (typeof SESSION_AUTH_MODES)[number];
|
|
13
|
+
export declare const SESSION_PRINCIPAL_TYPES: readonly ["human", "service", "agent"];
|
|
14
|
+
export type SessionPrincipalType = (typeof SESSION_PRINCIPAL_TYPES)[number];
|
|
15
|
+
export declare const SESSION_LIFECYCLE_STATUSES: readonly ["active", "expired", "revoked"];
|
|
16
|
+
export type SessionLifecycleStatus = (typeof SESSION_LIFECYCLE_STATUSES)[number];
|
|
17
|
+
export type SessionDelegationHop = {
|
|
18
|
+
principalId: string;
|
|
19
|
+
principalType: SessionPrincipalType;
|
|
20
|
+
authMode?: SessionAuthMode;
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
delegatedAt?: number;
|
|
23
|
+
reason?: string;
|
|
24
|
+
};
|
|
25
|
+
export type SessionAuditOutcome = "accepted" | "rejected" | "revoked" | "expired";
|
|
26
|
+
export type SessionAuditEnvelope = {
|
|
27
|
+
sessionId: string;
|
|
28
|
+
authMode: SessionAuthMode;
|
|
29
|
+
principalId: string;
|
|
30
|
+
principalType: SessionPrincipalType;
|
|
31
|
+
tenantId: string;
|
|
32
|
+
workspaceId?: string;
|
|
33
|
+
apiKeyId?: string;
|
|
34
|
+
scopes: readonly string[];
|
|
35
|
+
roles?: readonly string[];
|
|
36
|
+
delegationChain?: readonly SessionDelegationHop[];
|
|
37
|
+
sourceSessionId?: string;
|
|
38
|
+
expiresAt?: number;
|
|
39
|
+
request?: {
|
|
40
|
+
endpoint?: string;
|
|
41
|
+
method?: string;
|
|
42
|
+
correlationId?: string;
|
|
43
|
+
};
|
|
44
|
+
result?: {
|
|
45
|
+
outcome: SessionAuditOutcome;
|
|
46
|
+
reason?: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function inferSessionPrincipalType(principalId: string): SessionPrincipalType;
|
|
50
|
+
export declare function normalizeDelegationChain(args: {
|
|
51
|
+
delegationChain?: readonly SessionDelegationHop[];
|
|
52
|
+
delegatedBy?: string;
|
|
53
|
+
delegatedByType?: SessionPrincipalType;
|
|
54
|
+
delegatedAt?: number;
|
|
55
|
+
reason?: string;
|
|
56
|
+
}): SessionDelegationHop[] | undefined;
|
|
57
|
+
export declare function lastDelegator(delegationChain?: readonly SessionDelegationHop[]): string | undefined;
|
|
58
|
+
import type { ConvexAdminClient } from "./convex-admin.contract";
|
|
59
|
+
export type McpTransportKind = "stdio" | "hosted";
|
|
60
|
+
export type LucernSdkClient = unknown;
|
|
61
|
+
/**
|
|
62
|
+
* Session authentication context — injected by withAuth() middleware.
|
|
63
|
+
*
|
|
64
|
+
* Built from TenantConfig at dispatch time. Agent sessions get
|
|
65
|
+
* AGENT_IDENTITY + "agent:internal" role + unrestricted access.
|
|
66
|
+
* User sessions get Clerk userId + resolved role + tool ACLs.
|
|
67
|
+
*/
|
|
68
|
+
export type AuthContext = {
|
|
69
|
+
sessionType: "agent" | "user";
|
|
70
|
+
userId: string;
|
|
71
|
+
tenantId: string;
|
|
72
|
+
role: string;
|
|
73
|
+
allowedTopics: string[] | null;
|
|
74
|
+
groupIds: string[];
|
|
75
|
+
permittedPackKeys: string[];
|
|
76
|
+
sessionId: string;
|
|
77
|
+
principalId?: string;
|
|
78
|
+
principalType?: SessionPrincipalType;
|
|
79
|
+
workspaceId?: string;
|
|
80
|
+
scopes?: string[];
|
|
81
|
+
authMode?: SessionAuthMode;
|
|
82
|
+
roles?: string[];
|
|
83
|
+
transportKind?: McpTransportKind;
|
|
84
|
+
lucernClient?: LucernSdkClient;
|
|
85
|
+
convex?: ConvexAdminClient;
|
|
86
|
+
setDefaultScopeContext?: (scopeId: string) => Promise<unknown>;
|
|
87
|
+
matchesWorkspaceReasoningScope?: (node: unknown, scope: unknown) => boolean;
|
|
88
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lucern/contracts — auth (canonical support contract)
|
|
3
|
+
*
|
|
4
|
+
* Consolidated flat support surface for Lucern authentication:
|
|
5
|
+
* - Session primitives (auth modes, principal types, lifecycle)
|
|
6
|
+
* - AuthContext shape + McpTransportKind + LucernSdkClient alias
|
|
7
|
+
*
|
|
8
|
+
* Consolidated from src/auth-session.contract.ts and src/auth-context.contract.ts
|
|
9
|
+
* in EK-16 T1 PR 3a. Compat shims remain at both old paths until Lucern 1.0.0 (D12).
|
|
10
|
+
*/
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// SESSION PRIMITIVES
|
|
13
|
+
// (Formerly src/auth-session.contract.ts)
|
|
14
|
+
// =============================================================================
|
|
15
|
+
export const SESSION_AUTH_MODES = [
|
|
16
|
+
"interactive_user",
|
|
17
|
+
"service_principal",
|
|
18
|
+
"tenant_api_key",
|
|
19
|
+
"session_token",
|
|
20
|
+
];
|
|
21
|
+
export const SESSION_PRINCIPAL_TYPES = ["human", "service", "agent"];
|
|
22
|
+
export const SESSION_LIFECYCLE_STATUSES = [
|
|
23
|
+
"active",
|
|
24
|
+
"expired",
|
|
25
|
+
"revoked",
|
|
26
|
+
];
|
|
27
|
+
export function inferSessionPrincipalType(principalId) {
|
|
28
|
+
if (principalId.startsWith("user:")) {
|
|
29
|
+
return "human";
|
|
30
|
+
}
|
|
31
|
+
if (principalId.startsWith("agent:")) {
|
|
32
|
+
return "agent";
|
|
33
|
+
}
|
|
34
|
+
return "service";
|
|
35
|
+
}
|
|
36
|
+
export function normalizeDelegationChain(args) {
|
|
37
|
+
if (args.delegationChain && args.delegationChain.length > 0) {
|
|
38
|
+
return [...args.delegationChain];
|
|
39
|
+
}
|
|
40
|
+
if (!args.delegatedBy) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
principalId: args.delegatedBy,
|
|
46
|
+
principalType: args.delegatedByType ?? inferSessionPrincipalType(args.delegatedBy),
|
|
47
|
+
delegatedAt: args.delegatedAt,
|
|
48
|
+
reason: args.reason,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
export function lastDelegator(delegationChain) {
|
|
53
|
+
if (!delegationChain || delegationChain.length === 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
return delegationChain[delegationChain.length - 1]?.principalId;
|
|
57
|
+
}
|