@lucern/events 0.3.0-alpha.11 → 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 +117 -5
- package/dist/index.js.map +1 -1
- package/dist/outbox.js +117 -5
- package/dist/outbox.js.map +1 -1
- package/dist/types.js +117 -5
- package/dist/types.js.map +1 -1
- package/dist/webhooks.js +117 -5
- 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",
|
|
@@ -4287,7 +4316,9 @@ var permitObjectType = z.enum([
|
|
|
4287
4316
|
"group",
|
|
4288
4317
|
"resource_instance",
|
|
4289
4318
|
"relationship_tuple",
|
|
4290
|
-
"role_assignment"
|
|
4319
|
+
"role_assignment",
|
|
4320
|
+
"attribute_binding",
|
|
4321
|
+
"policy_bundle"
|
|
4291
4322
|
]);
|
|
4292
4323
|
var permitOutboxOperation = z.enum([
|
|
4293
4324
|
"upsert",
|
|
@@ -4393,7 +4424,10 @@ defineTable({
|
|
|
4393
4424
|
}),
|
|
4394
4425
|
indices: [
|
|
4395
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"] },
|
|
4396
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"] },
|
|
4397
4431
|
{
|
|
4398
4432
|
kind: "index",
|
|
4399
4433
|
name: "by_tenant_provider_alias",
|
|
@@ -9366,7 +9400,7 @@ var IDENTITY_WHOAMI = {
|
|
|
9366
9400
|
description: "Canonical identity summary for the current session",
|
|
9367
9401
|
fields: {
|
|
9368
9402
|
principalId: "string \u2014 canonical federated principal identifier",
|
|
9369
|
-
principalType: "string \u2014 human, service, or
|
|
9403
|
+
principalType: "string \u2014 human, service, agent, group, or external_viewer",
|
|
9370
9404
|
tenantId: "string | undefined \u2014 resolved tenant scope",
|
|
9371
9405
|
workspaceId: "string | undefined \u2014 resolved workspace scope",
|
|
9372
9406
|
scopes: "string[] | undefined \u2014 granted scopes for this session",
|
|
@@ -9377,6 +9411,49 @@ var IDENTITY_WHOAMI = {
|
|
|
9377
9411
|
ontologyPrimitive: "identity",
|
|
9378
9412
|
tier: "workhorse"
|
|
9379
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
|
+
};
|
|
9380
9457
|
var COMPILE_CONTEXT = {
|
|
9381
9458
|
name: "compile_context",
|
|
9382
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.",
|
|
@@ -11279,6 +11356,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
11279
11356
|
update_worktree_targets: UPDATE_WORKTREE_TARGETS,
|
|
11280
11357
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
11281
11358
|
identity_whoami: IDENTITY_WHOAMI,
|
|
11359
|
+
resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
|
|
11282
11360
|
compile_context: COMPILE_CONTEXT,
|
|
11283
11361
|
record_scope_learning: RECORD_SCOPE_LEARNING,
|
|
11284
11362
|
pipeline_snapshot: PIPELINE_SNAPSHOT,
|
|
@@ -11396,6 +11474,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
|
|
|
11396
11474
|
var MCP_CORE_OPERATION_NAMES = [
|
|
11397
11475
|
"compile_context",
|
|
11398
11476
|
"identity_whoami",
|
|
11477
|
+
"resolve_interactive_principal",
|
|
11399
11478
|
"check_permission",
|
|
11400
11479
|
"filter_by_permission",
|
|
11401
11480
|
"create_belief",
|
|
@@ -11949,7 +12028,13 @@ function surfaceContract(args) {
|
|
|
11949
12028
|
scopes: args.scopes ?? [
|
|
11950
12029
|
args.kind === "query" ? `${args.domain}.read` : `${args.domain}.write`
|
|
11951
12030
|
],
|
|
11952
|
-
allowedPrincipalTypes: [
|
|
12031
|
+
allowedPrincipalTypes: [
|
|
12032
|
+
"user",
|
|
12033
|
+
"service",
|
|
12034
|
+
"agent",
|
|
12035
|
+
"group",
|
|
12036
|
+
"external_viewer"
|
|
12037
|
+
]
|
|
11953
12038
|
},
|
|
11954
12039
|
convex: args.convex,
|
|
11955
12040
|
gateway: args.gateway,
|
|
@@ -12091,8 +12176,6 @@ var contextContracts = [
|
|
|
12091
12176
|
args: observationContextArgs
|
|
12092
12177
|
})
|
|
12093
12178
|
];
|
|
12094
|
-
|
|
12095
|
-
// ../contracts/src/function-registry/identity.ts
|
|
12096
12179
|
var withPrincipal = (input, context) => ({
|
|
12097
12180
|
...input,
|
|
12098
12181
|
tenantId: input.tenantId ?? context.tenantId,
|
|
@@ -12118,6 +12201,28 @@ var identityContracts = [
|
|
|
12118
12201
|
inputProjection: withPrincipal
|
|
12119
12202
|
}
|
|
12120
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
|
+
}),
|
|
12121
12226
|
surfaceContract({
|
|
12122
12227
|
name: "check_permission",
|
|
12123
12228
|
kind: "query",
|
|
@@ -15921,6 +16026,13 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
|
|
|
15921
16026
|
copyMode: "none",
|
|
15922
16027
|
description: "Deliberation sessions are created by tenant workflows."
|
|
15923
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
|
+
},
|
|
15924
16036
|
{
|
|
15925
16037
|
component: "kernel",
|
|
15926
16038
|
table: "epistemicAudit",
|