@lucern/events 0.3.0-alpha.15 → 0.3.0-alpha.17

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/webhooks.js CHANGED
@@ -738,6 +738,7 @@ defineTable({
738
738
  shape: z.object({
739
739
  "tenantId": idOf("tenants"),
740
740
  "workspaceId": idOf("workspaces").optional(),
741
+ "environment": z.enum(["dev", "staging", "prod"]).optional(),
741
742
  "keyPrefix": z.enum(["luc", "stk"]),
742
743
  "keyHash": z.string(),
743
744
  "keyHint": z.string(),
@@ -765,7 +766,7 @@ defineTable({
765
766
  shape: z.object({
766
767
  "tenantId": idOf("tenants").optional(),
767
768
  "apiKeyId": idOf("apiKeys").optional(),
768
- "action": z.enum(["key_created", "key_revoked", "key_expired", "key_used", "tenant_secret_created", "tenant_secret_rotated", "tenant_secret_revoked", "tenant_slot_binding_upserted", "tenant_slot_binding_revoked", "proxy_token_minted", "proxy_token_lease_issued", "proxy_token_lease_renewed", "proxy_token_lease_revoked", "proxy_request_recorded", "tenant_created", "tenant_updated", "tenant_suspended", "tenant_archived", "tenant_reactivated", "principal_created", "principal_updated", "principal_suspended", "principal_identity_alias_upserted", "principal_identity_alias_revoked", "membership_created", "membership_updated", "membership_revoked", "group_created", "group_updated", "group_deleted", "group_member_added", "group_member_removed", "workspace_created", "workspace_updated", "workspace_archived", "workspace_deployment_set", "workspace_deployment_removed", "deployment_host_registered", "deployment_host_revoked", "service_key_created", "service_key_rotated", "service_key_revoked", "service_key_used", "service_key_auth_failed", "session_created", "session_validated", "session_revoked", "session_cascade_revoked", "session_expired", "sandbox_created", "sandbox_secret_injected", "sandbox_execution_started", "sandbox_execution_completed", "sandbox_limit_violated", "policy_created", "policy_updated", "policy_enforced", "policy_archived", "permit_sync_enqueued", "permit_sync_succeeded", "permit_sync_failed", "permit_sync_skipped", "agent_registered", "agent_updated", "tool_registered", "tool_updated", "pack_entitled", "pack_installed", "pack_enabled", "pack_disabled", "pack_entitlement_revoked", "pack_upgraded", "pack_upgrade_committed", "pack_upgrade_rolled_back", "pack_group_assigned", "pack_group_unassigned", "methodology_pack_created", "methodology_pack_updated", "methodology_pack_assigned", "methodology_pack_removed", "pack_assigned_to_group", "pack_revoked_from_group", "pack_ontology_materialized", "pack_ontology_topic_bound", "cutover_flag_set", "cutover_flag_cleared"]),
769
+ "action": z.enum(["key_created", "key_revoked", "key_expired", "key_used", "tenant_secret_created", "tenant_secret_rotated", "tenant_secret_revoked", "tenant_slot_binding_upserted", "tenant_slot_binding_revoked", "proxy_token_minted", "proxy_token_lease_issued", "proxy_token_lease_renewed", "proxy_token_lease_revoked", "proxy_request_recorded", "tenant_created", "tenant_updated", "tenant_suspended", "tenant_archived", "tenant_reactivated", "tenant_clerk_organization_linked", "principal_created", "principal_updated", "principal_suspended", "principal_identity_alias_upserted", "principal_identity_alias_revoked", "membership_created", "membership_updated", "membership_revoked", "group_created", "group_updated", "group_deleted", "group_member_added", "group_member_removed", "workspace_created", "workspace_updated", "workspace_archived", "workspace_deployment_set", "workspace_deployment_removed", "deployment_host_registered", "deployment_host_revoked", "service_key_created", "service_key_rotated", "service_key_revoked", "service_key_used", "service_key_auth_failed", "session_created", "session_validated", "session_revoked", "session_cascade_revoked", "session_expired", "sandbox_created", "sandbox_secret_injected", "sandbox_execution_started", "sandbox_execution_completed", "sandbox_limit_violated", "policy_created", "policy_updated", "policy_enforced", "policy_archived", "permit_sync_enqueued", "permit_sync_succeeded", "permit_sync_failed", "permit_sync_skipped", "agent_registered", "agent_updated", "tool_registered", "tool_updated", "pack_entitled", "pack_installed", "pack_enabled", "pack_disabled", "pack_entitlement_revoked", "pack_upgraded", "pack_upgrade_committed", "pack_upgrade_rolled_back", "pack_group_assigned", "pack_group_unassigned", "methodology_pack_created", "methodology_pack_updated", "methodology_pack_assigned", "methodology_pack_removed", "pack_assigned_to_group", "pack_revoked_from_group", "pack_ontology_materialized", "pack_ontology_topic_bound", "cutover_flag_set", "cutover_flag_cleared"]),
769
770
  "actorClerkId": z.string(),
770
771
  "details": z.any().optional(),
771
772
  "createdAt": z.number()
@@ -6894,7 +6895,7 @@ function compactRecord2(input) {
6894
6895
  Object.entries(input).filter(([, value]) => value !== void 0)
6895
6896
  );
6896
6897
  }
6897
- var listBeliefsProjection = defineProjection({
6898
+ defineProjection({
6898
6899
  contractName: "list_beliefs",
6899
6900
  inputSchema: listBeliefsInputSchema,
6900
6901
  project: (input) => compactRecord2({
@@ -9403,7 +9404,7 @@ var IDENTITY_WHOAMI = {
9403
9404
  response: {
9404
9405
  description: "Canonical identity summary for the current session",
9405
9406
  fields: {
9406
- principalId: "string \u2014 canonical federated principal identifier",
9407
+ principalId: "string \u2014 canonical principal identifier; for humans this is the Clerk user_... ID",
9407
9408
  principalType: "string \u2014 human, service, agent, group, or external_viewer",
9408
9409
  tenantId: "string | undefined \u2014 resolved tenant scope",
9409
9410
  workspaceId: "string | undefined \u2014 resolved workspace scope",
@@ -9417,7 +9418,7 @@ var IDENTITY_WHOAMI = {
9417
9418
  };
9418
9419
  var RESOLVE_INTERACTIVE_PRINCIPAL = {
9419
9420
  name: "resolve_interactive_principal",
9420
- 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.",
9421
+ 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 Clerk subject into tenant/workspace authorization context.",
9421
9422
  parameters: {
9422
9423
  clerkId: {
9423
9424
  type: "string",
@@ -9440,7 +9441,7 @@ var RESOLVE_INTERACTIVE_PRINCIPAL = {
9440
9441
  response: {
9441
9442
  description: "Permit-backed Lucern principal context for tenant SDK bootstrap",
9442
9443
  fields: {
9443
- principalId: "string \u2014 canonical Lucern principal identifier",
9444
+ principalId: "string \u2014 canonical Clerk user_... ID for human sessions",
9444
9445
  principalType: "string \u2014 human, service, agent, group, or external_viewer",
9445
9446
  clerkId: "string \u2014 authenticated Clerk subject alias",
9446
9447
  tenantId: "string \u2014 resolved tenant scope",
@@ -10268,7 +10269,7 @@ var MANAGE_WRITE_POLICY = {
10268
10269
  },
10269
10270
  role: {
10270
10271
  type: "string",
10271
- description: "Role to set policy for (required for 'set'). E.g. 'agent:internal', 'user:analyst'."
10272
+ description: "Role to set policy for (required for 'set'). E.g. 'agent:internal' or a Permit role key such as 'workspace_admin'."
10272
10273
  },
10273
10274
  permission: {
10274
10275
  type: "string",
@@ -12198,11 +12199,8 @@ var identityContracts = [
12198
12199
  sdkNamespace: "identity",
12199
12200
  sdkMethod: "whoami",
12200
12201
  summary: "Describe the current gateway principal.",
12201
- convex: {
12202
- module: "identity",
12203
- functionName: "whoami",
12204
- kind: "query",
12205
- inputProjection: withPrincipal
12202
+ gateway: {
12203
+ handler: "identity.whoami"
12206
12204
  }
12207
12205
  }),
12208
12206
  surfaceContract({
@@ -12222,7 +12220,7 @@ var identityContracts = [
12222
12220
  providerProjectId: z.string().min(1).optional()
12223
12221
  }),
12224
12222
  convex: {
12225
- module: "identity",
12223
+ module: "platform",
12226
12224
  functionName: "resolveInteractivePrincipal",
12227
12225
  kind: "query"
12228
12226
  }
@@ -12306,15 +12304,6 @@ var beliefLookupInput = (input) => compactRecord4({
12306
12304
  var beliefNodeInput = (input) => compactRecord4({
12307
12305
  nodeId: input.nodeId ?? input.id ?? input.beliefId
12308
12306
  });
12309
- var beliefTopicInput = (input) => {
12310
- const parsed = listBeliefsProjection.inputSchema.safeParse(input);
12311
- if (!parsed.success) {
12312
- throw new Error(
12313
- `list_beliefs projection input rejected: ${parsed.error.message}`
12314
- );
12315
- }
12316
- return compactRecord4(listBeliefsProjection.project(parsed.data));
12317
- };
12318
12307
  var createBeliefInput = (input, context) => {
12319
12308
  return withUserId(
12320
12309
  compactRecord4({
@@ -12403,11 +12392,8 @@ var beliefsContracts = [
12403
12392
  sdkNamespace: "beliefs",
12404
12393
  sdkMethod: "listBeliefs",
12405
12394
  summary: "List beliefs for a topic.",
12406
- convex: {
12407
- module: "beliefs",
12408
- functionName: "getByTopic",
12409
- kind: "query",
12410
- inputProjection: beliefTopicInput
12395
+ gateway: {
12396
+ handler: "beliefs.list"
12411
12397
  },
12412
12398
  args: listBeliefsInputSchema
12413
12399
  }),
@@ -12592,12 +12578,6 @@ var evidenceIdInput = (input) => compactRecord4({
12592
12578
  insightId: input.insightId,
12593
12579
  nodeId: input.nodeId ?? input.id ?? input.evidenceId
12594
12580
  });
12595
- var evidenceTopicInput = (input) => compactRecord4({
12596
- topicId: input.topicId,
12597
- status: input.status,
12598
- userId: input.userId,
12599
- limit: input.limit
12600
- });
12601
12581
  var createEvidenceInput = (input, context) => {
12602
12582
  const parsed = createEvidenceProjection.inputSchema.safeParse(input);
12603
12583
  if (!parsed.success) {
@@ -12728,11 +12708,8 @@ var evidenceContracts = [
12728
12708
  sdkNamespace: "evidence",
12729
12709
  sdkMethod: "listEvidence",
12730
12710
  summary: "List evidence for a topic.",
12731
- convex: {
12732
- module: "evidence",
12733
- functionName: "getByTopic",
12734
- kind: "query",
12735
- inputProjection: evidenceTopicInput
12711
+ gateway: {
12712
+ handler: "evidence.list"
12736
12713
  }
12737
12714
  }),
12738
12715
  surfaceContract({
@@ -12967,11 +12944,8 @@ var questionsContracts = [
12967
12944
  sdkNamespace: "questions",
12968
12945
  sdkMethod: "listQuestions",
12969
12946
  summary: "List questions for a topic.",
12970
- convex: {
12971
- module: "questions",
12972
- functionName: "getByTopic",
12973
- kind: "query",
12974
- inputProjection: questionTopicInput
12947
+ gateway: {
12948
+ handler: "questions.list"
12975
12949
  }
12976
12950
  }),
12977
12951
  surfaceContract({
@@ -14076,6 +14050,19 @@ var worktreeEvidenceSignalInputSchema = z.object({
14076
14050
  progress: z.string().optional().describe("Collection progress note for the signal."),
14077
14051
  notes: z.string().optional().describe("Additional evidence collection notes.")
14078
14052
  }).passthrough().describe("Evidence signal embedded in the worktree plan.");
14053
+ var worktreeDocCompanionTargetSchema = z.object({
14054
+ docPath: z.string().describe(
14055
+ "Repo-relative path to a documentation file the worktree promises to update."
14056
+ ),
14057
+ sectionAnchor: z.string().optional().describe(
14058
+ "Markdown heading anchor (e.g. '## Function-surface manifest') that scopes the promised update."
14059
+ ),
14060
+ reason: z.string().describe(
14061
+ "Why this doc section must be updated for the worktree to be complete."
14062
+ )
14063
+ }).passthrough().describe(
14064
+ "Intent-driven docs companion target. pr-gate-reviewer verifies that the PR actually touches each declared (docPath, sectionAnchor). Distinct from the touch-driven docs-loop. See docs/development/docs-sync-discipline.md Lock 3."
14065
+ );
14079
14066
  var worktreeDecisionGateInputSchema = z.object({
14080
14067
  goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
14081
14068
  noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
@@ -14108,6 +14095,9 @@ var addWorktreeArgs = z.object({
14108
14095
  keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
14109
14096
  evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
14110
14097
  decisionGate: worktreeDecisionGateInputSchema.optional(),
14098
+ docCompanionTargets: z.array(worktreeDocCompanionTargetSchema).optional().describe(
14099
+ "Doc sections the worktree promises to update at PR time. Enforced by pr-gate-reviewer (Lock 3)."
14100
+ ),
14111
14101
  goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
14112
14102
  noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
14113
14103
  proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),