@lucern/events 0.3.0-alpha.6 → 0.3.0-alpha.7

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 CHANGED
@@ -4979,6 +4979,11 @@ var TENANT_CLIENT_INSTALLABLE_PACKAGES = [
4979
4979
  role: "sdk_dependency",
4980
4980
  directTenantImport: false
4981
4981
  },
4982
+ {
4983
+ packageName: "@lucern/graph-sync",
4984
+ role: "host_addon_runtime",
4985
+ directTenantImport: true
4986
+ },
4982
4987
  {
4983
4988
  packageName: "@lucern/identity",
4984
4989
  role: "component_runtime",
@@ -5098,8 +5103,11 @@ function compactRecord(input) {
5098
5103
  Object.entries(input).filter(([, value]) => value !== void 0)
5099
5104
  );
5100
5105
  }
5106
+ function isRecord(value) {
5107
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
5108
+ }
5101
5109
  function recordValue(value) {
5102
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
5110
+ return isRecord(value) ? value : {};
5103
5111
  }
5104
5112
  var createEvidenceProjection = defineProjection({
5105
5113
  contractName: "create_evidence",
@@ -5805,9 +5813,16 @@ var ADD_WORKTREE = {
5805
5813
  },
5806
5814
  projectId: {
5807
5815
  type: "string",
5808
- description: "Legacy topicId alias"
5816
+ description: "Legacy topicId alias or resolver hint"
5817
+ },
5818
+ topicId: {
5819
+ type: "string",
5820
+ description: "Optional topic scope hint for resolver validation"
5821
+ },
5822
+ topicHint: {
5823
+ type: "string",
5824
+ description: "Natural-language topic hint for automatic topic resolution"
5809
5825
  },
5810
- topicId: { type: "string", description: "Optional topic scope hint" },
5811
5826
  branchId: {
5812
5827
  type: "string",
5813
5828
  description: "The branch this worktree investigates"
@@ -5905,6 +5920,22 @@ var ADD_WORKTREE = {
5905
5920
  type: "string",
5906
5921
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
5907
5922
  },
5923
+ tags: {
5924
+ type: "array",
5925
+ description: "Additional topic-resolution tags for the worktree"
5926
+ },
5927
+ touchedPaths: {
5928
+ type: "array",
5929
+ description: "File paths used as topic-resolution signals"
5930
+ },
5931
+ sourceRef: {
5932
+ type: "string",
5933
+ description: "Source reference used as a topic-resolution signal"
5934
+ },
5935
+ sourceKind: {
5936
+ type: "string",
5937
+ description: "Source kind used as a topic-resolution signal"
5938
+ },
5908
5939
  campaign: {
5909
5940
  type: "number",
5910
5941
  description: "Top-level pipeline campaign number. Campaigns define the outer execution slice."
@@ -5942,7 +5973,7 @@ var ADD_WORKTREE = {
5942
5973
  description: "Timestamp when worktree metadata was last reconciled"
5943
5974
  }
5944
5975
  },
5945
- required: ["title", "topicId"],
5976
+ required: ["title"],
5946
5977
  response: {
5947
5978
  description: "The created worktree",
5948
5979
  fields: {
@@ -7645,18 +7676,60 @@ var CREATE_TASK = {
7645
7676
  name: "create_task",
7646
7677
  description: "Create an execution task tied to the reasoning state. Like `git task` \u2014 tracks concrete work items (calls to make, data to gather, analyses to run) linked to questions, beliefs, or worktrees.",
7647
7678
  parameters: {
7648
- title: { type: "string", description: "Task description" },
7679
+ title: { type: "string", description: "Task title" },
7649
7680
  topicId: { type: "string", description: "Topic scope" },
7681
+ description: {
7682
+ type: "string",
7683
+ description: "Long-form task description"
7684
+ },
7650
7685
  taskType: {
7651
7686
  type: "string",
7652
- description: "Type: research, interview, analysis, data_collection",
7653
- enum: ["research", "interview", "analysis", "data_collection"]
7687
+ description: "Task taxonomy",
7688
+ enum: [
7689
+ "general",
7690
+ "find_evidence",
7691
+ "verify_claim",
7692
+ "research",
7693
+ "review",
7694
+ "interview",
7695
+ "analysis",
7696
+ "track_metrics"
7697
+ ]
7698
+ },
7699
+ priority: {
7700
+ type: "string",
7701
+ description: "Priority",
7702
+ enum: ["urgent", "high", "medium", "low"]
7703
+ },
7704
+ status: {
7705
+ type: "string",
7706
+ description: "Initial status (defaults to todo)",
7707
+ enum: ["todo", "in_progress", "blocked", "done"]
7708
+ },
7709
+ linkedWorktreeId: {
7710
+ type: "string",
7711
+ description: "Worktree this task belongs to"
7712
+ },
7713
+ linkedBeliefId: {
7714
+ type: "string",
7715
+ description: "Belief this task supports"
7654
7716
  },
7655
7717
  linkedQuestionId: {
7656
7718
  type: "string",
7657
7719
  description: "Question this task addresses"
7658
7720
  },
7659
- linkedWorktreeId: { type: "string", description: "Worktree scope" }
7721
+ assigneeId: {
7722
+ type: "string",
7723
+ description: "Principal assigned to the task"
7724
+ },
7725
+ dueDate: {
7726
+ type: "number",
7727
+ description: "Due date as epoch milliseconds"
7728
+ },
7729
+ tags: {
7730
+ type: "array",
7731
+ description: "Free-form string tags"
7732
+ }
7660
7733
  },
7661
7734
  required: ["title"],
7662
7735
  response: {
@@ -9739,9 +9812,7 @@ function mcpContractFromArgsSchema(base, args, contractName) {
9739
9812
  required: converted.filter(([, field]) => field.required).map(([fieldName]) => fieldName)
9740
9813
  };
9741
9814
  }
9742
- function defineFunctionContract(contract) {
9743
- return contract;
9744
- }
9815
+ var defineFunctionContract = (contract) => contract;
9745
9816
  function authUserId(context) {
9746
9817
  return context.userId ?? context.principalId ?? "lucern-agent";
9747
9818
  }
@@ -9895,6 +9966,9 @@ var observationContextArgs = z.object({
9895
9966
  limit: z.number().optional().describe("Maximum observations to return."),
9896
9967
  status: z.string().optional().describe("Observation status filter.")
9897
9968
  });
9969
+ function isRecord2(value) {
9970
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
9971
+ }
9898
9972
  var observationInput = (input, context) => withUserId(
9899
9973
  compactRecord4({
9900
9974
  projectId: input.projectId,
@@ -9949,8 +10023,8 @@ var contextContracts = [
9949
10023
  kind: "mutation",
9950
10024
  inputProjection: observationInput,
9951
10025
  outputProjection: (output, input) => ({
9952
- ...output && typeof output === "object" ? output : {},
9953
- observationId: output && typeof output === "object" ? output.nodeId : void 0,
10026
+ ...isRecord2(output) ? output : {},
10027
+ observationId: isRecord2(output) ? output.nodeId : void 0,
9954
10028
  observationType: input.observationType
9955
10029
  })
9956
10030
  },
@@ -11431,10 +11505,11 @@ var worktreeDecisionGateInputSchema = z.object({
11431
11505
  decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
11432
11506
  }).passthrough().describe("Decision gate contract for worktree activation or exit.");
11433
11507
  var addWorktreeArgs = z.object({
11434
- title: z.string().optional().describe("Human-readable worktree name or objective."),
11508
+ title: z.string().describe("Human-readable worktree name or objective."),
11435
11509
  name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
11436
- topicId: z.string().describe("Primary topic scope for the worktree."),
11437
- projectId: z.string().optional().describe("Legacy topicId alias."),
11510
+ topicId: z.string().optional().describe("Optional primary topic scope hint for resolver validation."),
11511
+ projectId: z.string().optional().describe("Legacy topicId alias/hint."),
11512
+ topicHint: z.string().optional().describe("Natural-language topic hint for automatic topic resolution."),
11438
11513
  branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
11439
11514
  objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
11440
11515
  hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
@@ -11459,6 +11534,10 @@ var addWorktreeArgs = z.object({
11459
11534
  autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
11460
11535
  autoFixPolicy: autoFixPolicyInputSchema.optional(),
11461
11536
  domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
11537
+ tags: z.array(z.string()).optional().describe("Additional topic-resolution tags for the worktree."),
11538
+ touchedPaths: z.array(z.string()).optional().describe("File paths used as topic-resolution signals."),
11539
+ sourceRef: z.string().optional().describe("Source reference used as a topic-resolution signal."),
11540
+ sourceKind: z.string().optional().describe("Source kind used as a topic-resolution signal."),
11462
11541
  campaign: z.number().optional().describe("Top-level pipeline campaign number."),
11463
11542
  lane: z.string().optional().describe("Campaign lane for the worktree."),
11464
11543
  laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
@@ -11788,8 +11867,46 @@ var worktreesContracts = [
11788
11867
  args: openPullRequestArgs
11789
11868
  })
11790
11869
  ];
11791
-
11792
- // ../contracts/src/function-registry/tasks.ts
11870
+ var taskPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
11871
+ var taskStatusSchema2 = z.enum(["todo", "in_progress", "blocked", "done"]);
11872
+ var taskTypeSchema = z.enum([
11873
+ "general",
11874
+ "find_evidence",
11875
+ "verify_claim",
11876
+ "research",
11877
+ "review",
11878
+ "interview",
11879
+ "analysis",
11880
+ "track_metrics"
11881
+ ]);
11882
+ var createTaskArgs = z.object({
11883
+ title: z.string().describe("Task title."),
11884
+ topicId: z.string().optional().describe("Topic scope."),
11885
+ description: z.string().optional().describe("Long-form task description."),
11886
+ taskType: taskTypeSchema.optional().describe("Task taxonomy."),
11887
+ priority: taskPrioritySchema.optional().describe("Priority. Defaults to medium when omitted by the server."),
11888
+ status: taskStatusSchema2.optional().describe("Initial status. Defaults to todo."),
11889
+ linkedWorktreeId: z.string().optional().describe("Worktree this task belongs to."),
11890
+ linkedBeliefId: z.string().optional().describe("Belief this task supports."),
11891
+ linkedQuestionId: z.string().optional().describe("Question this task addresses."),
11892
+ assigneeId: z.string().optional().describe("Principal assigned to the task."),
11893
+ dueDate: z.number().optional().describe("Due date as epoch milliseconds."),
11894
+ tags: z.array(z.string()).optional().describe("Free-form tags.")
11895
+ });
11896
+ var createTaskInput = (input) => compactRecord4({
11897
+ title: input.title,
11898
+ topicId: input.topicId,
11899
+ description: input.description,
11900
+ taskType: input.taskType,
11901
+ priority: input.priority ?? "medium",
11902
+ status: input.status ?? "todo",
11903
+ linkedWorktreeId: input.linkedWorktreeId,
11904
+ linkedBeliefId: input.linkedBeliefId,
11905
+ linkedQuestionId: input.linkedQuestionId,
11906
+ assigneeId: input.assigneeId,
11907
+ dueDate: input.dueDate,
11908
+ tags: input.tags
11909
+ });
11793
11910
  var taskInput = (input) => compactRecord4({
11794
11911
  ...input,
11795
11912
  taskId: input.taskId ?? input.id
@@ -11821,8 +11938,10 @@ var tasksContracts = [
11821
11938
  convex: {
11822
11939
  module: "tasks",
11823
11940
  functionName: "create",
11824
- kind: "mutation"
11825
- }
11941
+ kind: "mutation",
11942
+ inputProjection: createTaskInput
11943
+ },
11944
+ args: createTaskArgs
11826
11945
  }),
11827
11946
  surfaceContract({
11828
11947
  name: "list_tasks",
@@ -12940,9 +13059,12 @@ var ALL_FUNCTION_CONTRACTS = [
12940
13059
  ...legacyContracts
12941
13060
  ];
12942
13061
  assertSurfaceCoverage(ALL_FUNCTION_CONTRACTS);
12943
- new Map(
13062
+ var FUNCTION_CONTRACTS_BY_NAME = new Map(
12944
13063
  ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
12945
13064
  );
13065
+ FUNCTION_CONTRACTS_BY_NAME.get.bind(
13066
+ FUNCTION_CONTRACTS_BY_NAME
13067
+ );
12946
13068
 
12947
13069
  // ../contracts/src/tenant-bootstrap-seed.contract.ts
12948
13070
  function isCopyableSeedRequirement(entry) {
@@ -13544,11 +13666,16 @@ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
13544
13666
 
13545
13667
  // src/webhooks.ts
13546
13668
  var LOCALHOST_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
13669
+ function invalidWebhookUrlError(error) {
13670
+ return new Error("Webhook URL must be a valid absolute URL.", {
13671
+ cause: error
13672
+ });
13673
+ }
13547
13674
  function normalizeUrl(url) {
13548
13675
  try {
13549
13676
  return new URL(url.trim());
13550
- } catch {
13551
- throw new Error("Webhook URL must be a valid absolute URL.");
13677
+ } catch (error) {
13678
+ throw invalidWebhookUrlError(error);
13552
13679
  }
13553
13680
  }
13554
13681
  function assertValidWebhookUrl(url) {