@lucern/events 0.3.0-alpha.12 → 0.3.0-alpha.13
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/webhooks.js
CHANGED
|
@@ -989,6 +989,35 @@ defineTable({
|
|
|
989
989
|
{ kind: "index", name: "by_source", columns: ["source"] }
|
|
990
990
|
]
|
|
991
991
|
});
|
|
992
|
+
defineTable({
|
|
993
|
+
name: "domainEvents",
|
|
994
|
+
component: "kernel",
|
|
995
|
+
category: "events",
|
|
996
|
+
shape: z.object({
|
|
997
|
+
"eventId": z.string(),
|
|
998
|
+
"type": z.string(),
|
|
999
|
+
"version": z.string(),
|
|
1000
|
+
"timestamp": z.number(),
|
|
1001
|
+
"tenantId": z.string().optional(),
|
|
1002
|
+
"workspaceId": z.string().optional(),
|
|
1003
|
+
"topicId": z.string(),
|
|
1004
|
+
"resourceId": z.string(),
|
|
1005
|
+
"resourceType": z.string(),
|
|
1006
|
+
"actorId": z.string(),
|
|
1007
|
+
"actorType": z.enum(["human", "agent", "service"]),
|
|
1008
|
+
"data": z.record(z.any()),
|
|
1009
|
+
"correlationId": z.string().optional(),
|
|
1010
|
+
"expiresAt": z.number()
|
|
1011
|
+
}),
|
|
1012
|
+
indices: [
|
|
1013
|
+
{ kind: "index", name: "by_eventId", columns: ["eventId"] },
|
|
1014
|
+
{ kind: "index", name: "by_topic_timestamp", columns: ["topicId", "timestamp"] },
|
|
1015
|
+
{ kind: "index", name: "by_tenant_workspace_timestamp", columns: ["tenantId", "workspaceId", "timestamp"] },
|
|
1016
|
+
{ kind: "index", name: "by_type_timestamp", columns: ["type", "timestamp"] },
|
|
1017
|
+
{ kind: "index", name: "by_resource", columns: ["resourceType", "resourceId", "timestamp"] },
|
|
1018
|
+
{ kind: "index", name: "by_expiresAt", columns: ["expiresAt"] }
|
|
1019
|
+
]
|
|
1020
|
+
});
|
|
992
1021
|
defineTable({
|
|
993
1022
|
name: "beliefConfidence",
|
|
994
1023
|
component: "kernel",
|
|
@@ -4395,7 +4424,10 @@ defineTable({
|
|
|
4395
4424
|
}),
|
|
4396
4425
|
indices: [
|
|
4397
4426
|
{ kind: "index", name: "by_principalId", columns: ["principalId"] },
|
|
4427
|
+
{ kind: "index", name: "by_provider_subject", columns: ["provider", "providerSubjectId"] },
|
|
4428
|
+
{ kind: "index", name: "by_provider_project_subject", columns: ["provider", "providerProjectId", "providerSubjectId"] },
|
|
4398
4429
|
{ kind: "index", name: "by_tenant_provider_subject", columns: ["tenantId", "provider", "providerSubjectId"] },
|
|
4430
|
+
{ kind: "index", name: "by_tenant_provider_project_subject", columns: ["tenantId", "provider", "providerProjectId", "providerSubjectId"] },
|
|
4399
4431
|
{
|
|
4400
4432
|
kind: "index",
|
|
4401
4433
|
name: "by_tenant_provider_alias",
|
|
@@ -9368,7 +9400,7 @@ var IDENTITY_WHOAMI = {
|
|
|
9368
9400
|
description: "Canonical identity summary for the current session",
|
|
9369
9401
|
fields: {
|
|
9370
9402
|
principalId: "string \u2014 canonical federated principal identifier",
|
|
9371
|
-
principalType: "string \u2014 human, service, or
|
|
9403
|
+
principalType: "string \u2014 human, service, agent, group, or external_viewer",
|
|
9372
9404
|
tenantId: "string | undefined \u2014 resolved tenant scope",
|
|
9373
9405
|
workspaceId: "string | undefined \u2014 resolved workspace scope",
|
|
9374
9406
|
scopes: "string[] | undefined \u2014 granted scopes for this session",
|
|
@@ -9379,6 +9411,49 @@ var IDENTITY_WHOAMI = {
|
|
|
9379
9411
|
ontologyPrimitive: "identity",
|
|
9380
9412
|
tier: "workhorse"
|
|
9381
9413
|
};
|
|
9414
|
+
var RESOLVE_INTERACTIVE_PRINCIPAL = {
|
|
9415
|
+
name: "resolve_interactive_principal",
|
|
9416
|
+
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.",
|
|
9417
|
+
parameters: {
|
|
9418
|
+
clerkId: {
|
|
9419
|
+
type: "string",
|
|
9420
|
+
description: "Authenticated Clerk subject (`sub`). Clerk proves identity only; it is not the authorization record."
|
|
9421
|
+
},
|
|
9422
|
+
tenantId: {
|
|
9423
|
+
type: "string",
|
|
9424
|
+
description: "Optional tenant scope. Omit only when the Clerk alias is globally unambiguous."
|
|
9425
|
+
},
|
|
9426
|
+
workspaceId: {
|
|
9427
|
+
type: "string",
|
|
9428
|
+
description: "Optional workspace scope. Required when the principal has access to multiple workspaces and no default can be inferred."
|
|
9429
|
+
},
|
|
9430
|
+
providerProjectId: {
|
|
9431
|
+
type: "string",
|
|
9432
|
+
description: "Optional Clerk project or provider instance id for tenants with multiple identity providers."
|
|
9433
|
+
}
|
|
9434
|
+
},
|
|
9435
|
+
required: ["clerkId"],
|
|
9436
|
+
response: {
|
|
9437
|
+
description: "Permit-backed Lucern principal context for tenant SDK bootstrap",
|
|
9438
|
+
fields: {
|
|
9439
|
+
principalId: "string \u2014 canonical Lucern principal identifier",
|
|
9440
|
+
principalType: "string \u2014 human, service, agent, group, or external_viewer",
|
|
9441
|
+
clerkId: "string \u2014 authenticated Clerk subject alias",
|
|
9442
|
+
tenantId: "string \u2014 resolved tenant scope",
|
|
9443
|
+
workspaceId: "string | null \u2014 resolved workspace scope",
|
|
9444
|
+
roles: "string[] \u2014 effective Permit roles",
|
|
9445
|
+
scopes: "string[] \u2014 effective scopes derived from Permit/control-plane projection",
|
|
9446
|
+
groupIds: "string[] \u2014 active Permit group memberships",
|
|
9447
|
+
principalStatus: "string \u2014 active, invited, suspended, disabled, revoked, or missing",
|
|
9448
|
+
tenantStatus: "string \u2014 projected tenant resource status",
|
|
9449
|
+
workspaceStatus: "string \u2014 projected workspace resource status",
|
|
9450
|
+
permit: "object \u2014 Permit subject, tenant, and optional workspace tuple"
|
|
9451
|
+
}
|
|
9452
|
+
},
|
|
9453
|
+
ownerModule: "control-plane",
|
|
9454
|
+
ontologyPrimitive: "identity",
|
|
9455
|
+
tier: "workhorse"
|
|
9456
|
+
};
|
|
9382
9457
|
var COMPILE_CONTEXT = {
|
|
9383
9458
|
name: "compile_context",
|
|
9384
9459
|
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.",
|
|
@@ -11281,6 +11356,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
11281
11356
|
update_worktree_targets: UPDATE_WORKTREE_TARGETS,
|
|
11282
11357
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
11283
11358
|
identity_whoami: IDENTITY_WHOAMI,
|
|
11359
|
+
resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
|
|
11284
11360
|
compile_context: COMPILE_CONTEXT,
|
|
11285
11361
|
record_scope_learning: RECORD_SCOPE_LEARNING,
|
|
11286
11362
|
pipeline_snapshot: PIPELINE_SNAPSHOT,
|
|
@@ -11398,6 +11474,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
|
|
|
11398
11474
|
var MCP_CORE_OPERATION_NAMES = [
|
|
11399
11475
|
"compile_context",
|
|
11400
11476
|
"identity_whoami",
|
|
11477
|
+
"resolve_interactive_principal",
|
|
11401
11478
|
"check_permission",
|
|
11402
11479
|
"filter_by_permission",
|
|
11403
11480
|
"create_belief",
|
|
@@ -11951,7 +12028,13 @@ function surfaceContract(args) {
|
|
|
11951
12028
|
scopes: args.scopes ?? [
|
|
11952
12029
|
args.kind === "query" ? `${args.domain}.read` : `${args.domain}.write`
|
|
11953
12030
|
],
|
|
11954
|
-
allowedPrincipalTypes: [
|
|
12031
|
+
allowedPrincipalTypes: [
|
|
12032
|
+
"user",
|
|
12033
|
+
"service",
|
|
12034
|
+
"agent",
|
|
12035
|
+
"group",
|
|
12036
|
+
"external_viewer"
|
|
12037
|
+
]
|
|
11955
12038
|
},
|
|
11956
12039
|
convex: args.convex,
|
|
11957
12040
|
gateway: args.gateway,
|
|
@@ -12093,8 +12176,6 @@ var contextContracts = [
|
|
|
12093
12176
|
args: observationContextArgs
|
|
12094
12177
|
})
|
|
12095
12178
|
];
|
|
12096
|
-
|
|
12097
|
-
// ../contracts/src/function-registry/identity.ts
|
|
12098
12179
|
var withPrincipal = (input, context) => ({
|
|
12099
12180
|
...input,
|
|
12100
12181
|
tenantId: input.tenantId ?? context.tenantId,
|
|
@@ -12120,6 +12201,28 @@ var identityContracts = [
|
|
|
12120
12201
|
inputProjection: withPrincipal
|
|
12121
12202
|
}
|
|
12122
12203
|
}),
|
|
12204
|
+
surfaceContract({
|
|
12205
|
+
name: "resolve_interactive_principal",
|
|
12206
|
+
kind: "query",
|
|
12207
|
+
domain: "controlPlane",
|
|
12208
|
+
surfaceClass: "platform_public",
|
|
12209
|
+
method: "POST",
|
|
12210
|
+
path: "/control-plane/identity/resolve-interactive-principal",
|
|
12211
|
+
sdkNamespace: "controlPlane.identity",
|
|
12212
|
+
sdkMethod: "resolveInteractivePrincipal",
|
|
12213
|
+
summary: "Resolve an authenticated Clerk user into a Permit-backed Lucern principal context.",
|
|
12214
|
+
args: z.object({
|
|
12215
|
+
clerkId: z.string().min(1),
|
|
12216
|
+
tenantId: z.string().min(1).optional(),
|
|
12217
|
+
workspaceId: z.string().min(1).optional(),
|
|
12218
|
+
providerProjectId: z.string().min(1).optional()
|
|
12219
|
+
}),
|
|
12220
|
+
convex: {
|
|
12221
|
+
module: "identity",
|
|
12222
|
+
functionName: "resolveInteractivePrincipal",
|
|
12223
|
+
kind: "query"
|
|
12224
|
+
}
|
|
12225
|
+
}),
|
|
12123
12226
|
surfaceContract({
|
|
12124
12227
|
name: "check_permission",
|
|
12125
12228
|
kind: "query",
|
|
@@ -15923,6 +16026,13 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
|
|
|
15923
16026
|
copyMode: "none",
|
|
15924
16027
|
description: "Deliberation sessions are created by tenant workflows."
|
|
15925
16028
|
},
|
|
16029
|
+
{
|
|
16030
|
+
component: "kernel",
|
|
16031
|
+
table: "domainEvents",
|
|
16032
|
+
prepopulation: "runtime_log",
|
|
16033
|
+
copyMode: "none",
|
|
16034
|
+
description: "Domain event rows are append-only runtime audit/exhaust data."
|
|
16035
|
+
},
|
|
15926
16036
|
{
|
|
15927
16037
|
component: "kernel",
|
|
15928
16038
|
table: "epistemicAudit",
|