@lucern/events 0.3.0-alpha.12 → 0.3.0-alpha.14
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/index.js +114 -4
- package/dist/index.js.map +1 -1
- package/dist/outbox.js +114 -4
- package/dist/outbox.js.map +1 -1
- package/dist/types.js +114 -4
- package/dist/types.js.map +1 -1
- package/dist/webhooks.js +114 -4
- package/dist/webhooks.js.map +1 -1
- package/package.json +2 -2
package/dist/types.js
CHANGED
|
@@ -1028,6 +1028,35 @@ defineTable({
|
|
|
1028
1028
|
{ kind: "index", name: "by_source", columns: ["source"] }
|
|
1029
1029
|
]
|
|
1030
1030
|
});
|
|
1031
|
+
defineTable({
|
|
1032
|
+
name: "domainEvents",
|
|
1033
|
+
component: "kernel",
|
|
1034
|
+
category: "events",
|
|
1035
|
+
shape: z.object({
|
|
1036
|
+
"eventId": z.string(),
|
|
1037
|
+
"type": z.string(),
|
|
1038
|
+
"version": z.string(),
|
|
1039
|
+
"timestamp": z.number(),
|
|
1040
|
+
"tenantId": z.string().optional(),
|
|
1041
|
+
"workspaceId": z.string().optional(),
|
|
1042
|
+
"topicId": z.string(),
|
|
1043
|
+
"resourceId": z.string(),
|
|
1044
|
+
"resourceType": z.string(),
|
|
1045
|
+
"actorId": z.string(),
|
|
1046
|
+
"actorType": z.enum(["human", "agent", "service"]),
|
|
1047
|
+
"data": z.record(z.any()),
|
|
1048
|
+
"correlationId": z.string().optional(),
|
|
1049
|
+
"expiresAt": z.number()
|
|
1050
|
+
}),
|
|
1051
|
+
indices: [
|
|
1052
|
+
{ kind: "index", name: "by_eventId", columns: ["eventId"] },
|
|
1053
|
+
{ kind: "index", name: "by_topic_timestamp", columns: ["topicId", "timestamp"] },
|
|
1054
|
+
{ kind: "index", name: "by_tenant_workspace_timestamp", columns: ["tenantId", "workspaceId", "timestamp"] },
|
|
1055
|
+
{ kind: "index", name: "by_type_timestamp", columns: ["type", "timestamp"] },
|
|
1056
|
+
{ kind: "index", name: "by_resource", columns: ["resourceType", "resourceId", "timestamp"] },
|
|
1057
|
+
{ kind: "index", name: "by_expiresAt", columns: ["expiresAt"] }
|
|
1058
|
+
]
|
|
1059
|
+
});
|
|
1031
1060
|
defineTable({
|
|
1032
1061
|
name: "beliefConfidence",
|
|
1033
1062
|
component: "kernel",
|
|
@@ -4434,7 +4463,10 @@ defineTable({
|
|
|
4434
4463
|
}),
|
|
4435
4464
|
indices: [
|
|
4436
4465
|
{ kind: "index", name: "by_principalId", columns: ["principalId"] },
|
|
4466
|
+
{ kind: "index", name: "by_provider_subject", columns: ["provider", "providerSubjectId"] },
|
|
4467
|
+
{ kind: "index", name: "by_provider_project_subject", columns: ["provider", "providerProjectId", "providerSubjectId"] },
|
|
4437
4468
|
{ kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "providerSubjectId"] },
|
|
4469
|
+
{ kind: "index", name: "by_tenant_provider_project_subject", columns: ["tenantId", "provider", "providerProjectId", "providerSubjectId"] },
|
|
4438
4470
|
{
|
|
4439
4471
|
kind: "index",
|
|
4440
4472
|
name: "by_tenant_provider_alias",
|
|
@@ -9407,7 +9439,7 @@ var IDENTITY_WHOAMI = {
|
|
|
9407
9439
|
description: "Canonical identity summary for the current session",
|
|
9408
9440
|
fields: {
|
|
9409
9441
|
principalId: "string \u2014 canonical federated principal identifier",
|
|
9410
|
-
principalType: "string \u2014 human, service, or
|
|
9442
|
+
principalType: "string \u2014 human, service, agent, group, or external_viewer",
|
|
9411
9443
|
tenantId: "string | undefined \u2014 resolved tenant scope",
|
|
9412
9444
|
workspaceId: "string | undefined \u2014 resolved workspace scope",
|
|
9413
9445
|
scopes: "string[] | undefined \u2014 granted scopes for this session",
|
|
@@ -9418,6 +9450,49 @@ var IDENTITY_WHOAMI = {
|
|
|
9418
9450
|
ontologyPrimitive: "identity",
|
|
9419
9451
|
tier: "workhorse"
|
|
9420
9452
|
};
|
|
9453
|
+
var RESOLVE_INTERACTIVE_PRINCIPAL = {
|
|
9454
|
+
name: "resolve_interactive_principal",
|
|
9455
|
+
description: "Read the Permit-backed Lucern principal context for an authenticated Clerk user. Like `git config --get user.email` plus the repository ACL \u2014 resolves the identity alias into the canonical authorization subject.",
|
|
9456
|
+
parameters: {
|
|
9457
|
+
clerkId: {
|
|
9458
|
+
type: "string",
|
|
9459
|
+
description: "Authenticated Clerk subject (`sub`). Clerk proves identity only; it is not the authorization record."
|
|
9460
|
+
},
|
|
9461
|
+
tenantId: {
|
|
9462
|
+
type: "string",
|
|
9463
|
+
description: "Optional tenant scope. Omit only when the Clerk alias is globally unambiguous."
|
|
9464
|
+
},
|
|
9465
|
+
workspaceId: {
|
|
9466
|
+
type: "string",
|
|
9467
|
+
description: "Optional workspace scope. Required when the principal has access to multiple workspaces and no default can be inferred."
|
|
9468
|
+
},
|
|
9469
|
+
providerProjectId: {
|
|
9470
|
+
type: "string",
|
|
9471
|
+
description: "Optional Clerk project or provider instance id for tenants with multiple identity providers."
|
|
9472
|
+
}
|
|
9473
|
+
},
|
|
9474
|
+
required: ["clerkId"],
|
|
9475
|
+
response: {
|
|
9476
|
+
description: "Permit-backed Lucern principal context for tenant SDK bootstrap",
|
|
9477
|
+
fields: {
|
|
9478
|
+
principalId: "string \u2014 canonical Lucern principal identifier",
|
|
9479
|
+
principalType: "string \u2014 human, service, agent, group, or external_viewer",
|
|
9480
|
+
clerkId: "string \u2014 authenticated Clerk subject alias",
|
|
9481
|
+
tenantId: "string \u2014 resolved tenant scope",
|
|
9482
|
+
workspaceId: "string | null \u2014 resolved workspace scope",
|
|
9483
|
+
roles: "string[] \u2014 effective Permit roles",
|
|
9484
|
+
scopes: "string[] \u2014 effective scopes derived from Permit/control-plane projection",
|
|
9485
|
+
groupIds: "string[] \u2014 active Permit group memberships",
|
|
9486
|
+
principalStatus: "string \u2014 active, invited, suspended, disabled, revoked, or missing",
|
|
9487
|
+
tenantStatus: "string \u2014 projected tenant resource status",
|
|
9488
|
+
workspaceStatus: "string \u2014 projected workspace resource status",
|
|
9489
|
+
permit: "object \u2014 Permit subject, tenant, and optional workspace tuple"
|
|
9490
|
+
}
|
|
9491
|
+
},
|
|
9492
|
+
ownerModule: "control-plane",
|
|
9493
|
+
ontologyPrimitive: "identity",
|
|
9494
|
+
tier: "workhorse"
|
|
9495
|
+
};
|
|
9421
9496
|
var COMPILE_CONTEXT = {
|
|
9422
9497
|
name: "compile_context",
|
|
9423
9498
|
description: "Compile a focused reasoning context. If topicId is omitted, Lucern resolves the best topic from the query. Like `git log --graph --decorate` for the reasoning substrate \u2014 returns the canonical Pillar 3 context pack through the public API shape.",
|
|
@@ -11320,6 +11395,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
11320
11395
|
update_worktree_targets: UPDATE_WORKTREE_TARGETS,
|
|
11321
11396
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
11322
11397
|
identity_whoami: IDENTITY_WHOAMI,
|
|
11398
|
+
resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
|
|
11323
11399
|
compile_context: COMPILE_CONTEXT,
|
|
11324
11400
|
record_scope_learning: RECORD_SCOPE_LEARNING,
|
|
11325
11401
|
pipeline_snapshot: PIPELINE_SNAPSHOT,
|
|
@@ -11437,6 +11513,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
|
|
|
11437
11513
|
var MCP_CORE_OPERATION_NAMES = [
|
|
11438
11514
|
"compile_context",
|
|
11439
11515
|
"identity_whoami",
|
|
11516
|
+
"resolve_interactive_principal",
|
|
11440
11517
|
"check_permission",
|
|
11441
11518
|
"filter_by_permission",
|
|
11442
11519
|
"create_belief",
|
|
@@ -11990,7 +12067,13 @@ function surfaceContract(args) {
|
|
|
11990
12067
|
scopes: args.scopes ?? [
|
|
11991
12068
|
args.kind === "query" ? `${args.domain}.read` : `${args.domain}.write`
|
|
11992
12069
|
],
|
|
11993
|
-
allowedPrincipalTypes: [
|
|
12070
|
+
allowedPrincipalTypes: [
|
|
12071
|
+
"user",
|
|
12072
|
+
"service",
|
|
12073
|
+
"agent",
|
|
12074
|
+
"group",
|
|
12075
|
+
"external_viewer"
|
|
12076
|
+
]
|
|
11994
12077
|
},
|
|
11995
12078
|
convex: args.convex,
|
|
11996
12079
|
gateway: args.gateway,
|
|
@@ -12132,8 +12215,6 @@ var contextContracts = [
|
|
|
12132
12215
|
args: observationContextArgs
|
|
12133
12216
|
})
|
|
12134
12217
|
];
|
|
12135
|
-
|
|
12136
|
-
// ../contracts/src/function-registry/identity.ts
|
|
12137
12218
|
var withPrincipal = (input, context) => ({
|
|
12138
12219
|
...input,
|
|
12139
12220
|
tenantId: input.tenantId ?? context.tenantId,
|
|
@@ -12159,6 +12240,28 @@ var identityContracts = [
|
|
|
12159
12240
|
inputProjection: withPrincipal
|
|
12160
12241
|
}
|
|
12161
12242
|
}),
|
|
12243
|
+
surfaceContract({
|
|
12244
|
+
name: "resolve_interactive_principal",
|
|
12245
|
+
kind: "query",
|
|
12246
|
+
domain: "controlPlane",
|
|
12247
|
+
surfaceClass: "platform_public",
|
|
12248
|
+
method: "POST",
|
|
12249
|
+
path: "/control-plane/identity/resolve-interactive-principal",
|
|
12250
|
+
sdkNamespace: "controlPlane.identity",
|
|
12251
|
+
sdkMethod: "resolveInteractivePrincipal",
|
|
12252
|
+
summary: "Resolve an authenticated Clerk user into a Permit-backed Lucern principal context.",
|
|
12253
|
+
args: z.object({
|
|
12254
|
+
clerkId: z.string().min(1),
|
|
12255
|
+
tenantId: z.string().min(1).optional(),
|
|
12256
|
+
workspaceId: z.string().min(1).optional(),
|
|
12257
|
+
providerProjectId: z.string().min(1).optional()
|
|
12258
|
+
}),
|
|
12259
|
+
convex: {
|
|
12260
|
+
module: "identity",
|
|
12261
|
+
functionName: "resolveInteractivePrincipal",
|
|
12262
|
+
kind: "query"
|
|
12263
|
+
}
|
|
12264
|
+
}),
|
|
12162
12265
|
surfaceContract({
|
|
12163
12266
|
name: "check_permission",
|
|
12164
12267
|
kind: "query",
|
|
@@ -15962,6 +16065,13 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
|
|
|
15962
16065
|
copyMode: "none",
|
|
15963
16066
|
description: "Deliberation sessions are created by tenant workflows."
|
|
15964
16067
|
},
|
|
16068
|
+
{
|
|
16069
|
+
component: "kernel",
|
|
16070
|
+
table: "domainEvents",
|
|
16071
|
+
prepopulation: "runtime_log",
|
|
16072
|
+
copyMode: "none",
|
|
16073
|
+
description: "Domain event rows are append-only runtime audit/exhaust data."
|
|
16074
|
+
},
|
|
15965
16075
|
{
|
|
15966
16076
|
component: "kernel",
|
|
15967
16077
|
table: "epistemicAudit",
|