@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/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",
|
|
@@ -4326,7 +4355,9 @@ var permitObjectType = z.enum([
|
|
|
4326
4355
|
"group",
|
|
4327
4356
|
"resource_instance",
|
|
4328
4357
|
"relationship_tuple",
|
|
4329
|
-
"role_assignment"
|
|
4358
|
+
"role_assignment",
|
|
4359
|
+
"attribute_binding",
|
|
4360
|
+
"policy_bundle"
|
|
4330
4361
|
]);
|
|
4331
4362
|
var permitOutboxOperation = z.enum([
|
|
4332
4363
|
"upsert",
|
|
@@ -4432,7 +4463,10 @@ defineTable({
|
|
|
4432
4463
|
}),
|
|
4433
4464
|
indices: [
|
|
4434
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"] },
|
|
4435
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"] },
|
|
4436
4470
|
{
|
|
4437
4471
|
kind: "index",
|
|
4438
4472
|
name: "by_tenant_provider_alias",
|
|
@@ -9405,7 +9439,7 @@ var IDENTITY_WHOAMI = {
|
|
|
9405
9439
|
description: "Canonical identity summary for the current session",
|
|
9406
9440
|
fields: {
|
|
9407
9441
|
principalId: "string \u2014 canonical federated principal identifier",
|
|
9408
|
-
principalType: "string \u2014 human, service, or
|
|
9442
|
+
principalType: "string \u2014 human, service, agent, group, or external_viewer",
|
|
9409
9443
|
tenantId: "string | undefined \u2014 resolved tenant scope",
|
|
9410
9444
|
workspaceId: "string | undefined \u2014 resolved workspace scope",
|
|
9411
9445
|
scopes: "string[] | undefined \u2014 granted scopes for this session",
|
|
@@ -9416,6 +9450,49 @@ var IDENTITY_WHOAMI = {
|
|
|
9416
9450
|
ontologyPrimitive: "identity",
|
|
9417
9451
|
tier: "workhorse"
|
|
9418
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
|
+
};
|
|
9419
9496
|
var COMPILE_CONTEXT = {
|
|
9420
9497
|
name: "compile_context",
|
|
9421
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.",
|
|
@@ -11318,6 +11395,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
11318
11395
|
update_worktree_targets: UPDATE_WORKTREE_TARGETS,
|
|
11319
11396
|
update_worktree_metadata: UPDATE_WORKTREE_METADATA,
|
|
11320
11397
|
identity_whoami: IDENTITY_WHOAMI,
|
|
11398
|
+
resolve_interactive_principal: RESOLVE_INTERACTIVE_PRINCIPAL,
|
|
11321
11399
|
compile_context: COMPILE_CONTEXT,
|
|
11322
11400
|
record_scope_learning: RECORD_SCOPE_LEARNING,
|
|
11323
11401
|
pipeline_snapshot: PIPELINE_SNAPSHOT,
|
|
@@ -11435,6 +11513,7 @@ function entries(names, surfaceClass, surfaceIntent, surfaces, rationale) {
|
|
|
11435
11513
|
var MCP_CORE_OPERATION_NAMES = [
|
|
11436
11514
|
"compile_context",
|
|
11437
11515
|
"identity_whoami",
|
|
11516
|
+
"resolve_interactive_principal",
|
|
11438
11517
|
"check_permission",
|
|
11439
11518
|
"filter_by_permission",
|
|
11440
11519
|
"create_belief",
|
|
@@ -11988,7 +12067,13 @@ function surfaceContract(args) {
|
|
|
11988
12067
|
scopes: args.scopes ?? [
|
|
11989
12068
|
args.kind === "query" ? `${args.domain}.read` : `${args.domain}.write`
|
|
11990
12069
|
],
|
|
11991
|
-
allowedPrincipalTypes: [
|
|
12070
|
+
allowedPrincipalTypes: [
|
|
12071
|
+
"user",
|
|
12072
|
+
"service",
|
|
12073
|
+
"agent",
|
|
12074
|
+
"group",
|
|
12075
|
+
"external_viewer"
|
|
12076
|
+
]
|
|
11992
12077
|
},
|
|
11993
12078
|
convex: args.convex,
|
|
11994
12079
|
gateway: args.gateway,
|
|
@@ -12130,8 +12215,6 @@ var contextContracts = [
|
|
|
12130
12215
|
args: observationContextArgs
|
|
12131
12216
|
})
|
|
12132
12217
|
];
|
|
12133
|
-
|
|
12134
|
-
// ../contracts/src/function-registry/identity.ts
|
|
12135
12218
|
var withPrincipal = (input, context) => ({
|
|
12136
12219
|
...input,
|
|
12137
12220
|
tenantId: input.tenantId ?? context.tenantId,
|
|
@@ -12157,6 +12240,28 @@ var identityContracts = [
|
|
|
12157
12240
|
inputProjection: withPrincipal
|
|
12158
12241
|
}
|
|
12159
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
|
+
}),
|
|
12160
12265
|
surfaceContract({
|
|
12161
12266
|
name: "check_permission",
|
|
12162
12267
|
kind: "query",
|
|
@@ -15960,6 +16065,13 @@ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
|
|
|
15960
16065
|
copyMode: "none",
|
|
15961
16066
|
description: "Deliberation sessions are created by tenant workflows."
|
|
15962
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
|
+
},
|
|
15963
16075
|
{
|
|
15964
16076
|
component: "kernel",
|
|
15965
16077
|
table: "epistemicAudit",
|