@lucern/events 0.3.0-alpha.3 → 0.3.0-alpha.4

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
@@ -3994,7 +3994,9 @@ defineTable({
3994
3994
  "defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
3995
3995
  "deployments": z.record(z.object({
3996
3996
  "url": z.string(),
3997
- "encryptedDeployKey": z.string()
3997
+ "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
3998
+ "encryptedDeployKey": z.string().optional(),
3999
+ "credentialRef": z.string().optional()
3998
4000
  })).optional(),
3999
4001
  "metadata": z.record(z.any()).optional(),
4000
4002
  "createdBy": z.string().optional(),
@@ -5191,6 +5193,14 @@ var ADD_WORKTREE = {
5191
5193
  description: "Check out a branch into an active worktree for investigation. Like `git worktree add <branch>` \u2014 creates independent working state on a thematic branch. Beliefs committed within the worktree can be freely amended (draft code on a feature branch). When investigation is complete, `merge` integrates findings into main.",
5192
5194
  parameters: {
5193
5195
  title: { type: "string", description: "Worktree name/objective" },
5196
+ name: {
5197
+ type: "string",
5198
+ description: "Optional storage-name alias for callers that already use backend naming"
5199
+ },
5200
+ projectId: {
5201
+ type: "string",
5202
+ description: "Legacy topicId alias"
5203
+ },
5194
5204
  topicId: { type: "string", description: "Optional topic scope hint" },
5195
5205
  branchId: {
5196
5206
  type: "string",
@@ -5204,14 +5214,87 @@ var ADD_WORKTREE = {
5204
5214
  type: "string",
5205
5215
  description: "The testable claim this worktree investigates"
5206
5216
  },
5217
+ rationale: {
5218
+ type: "string",
5219
+ description: "Why this worktree exists and why it belongs in the campaign"
5220
+ },
5221
+ worktreeType: {
5222
+ type: "string",
5223
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
5224
+ },
5225
+ gate: {
5226
+ type: "string",
5227
+ description: "Exit gate name for this worktree"
5228
+ },
5229
+ startDate: {
5230
+ type: "number",
5231
+ description: "Planned start timestamp in milliseconds since epoch"
5232
+ },
5233
+ endDate: {
5234
+ type: "number",
5235
+ description: "Planned end timestamp in milliseconds since epoch"
5236
+ },
5237
+ durationWeeks: {
5238
+ type: "number",
5239
+ description: "Planned duration in weeks"
5240
+ },
5241
+ confidenceImpact: {
5242
+ type: "string",
5243
+ description: "Expected confidence impact if the worktree succeeds",
5244
+ enum: ["high", "medium", "low"]
5245
+ },
5246
+ beliefFocus: {
5247
+ type: "string",
5248
+ description: "Natural-language focus spanning the target belief neighborhood"
5249
+ },
5207
5250
  beliefIds: {
5208
5251
  type: "array",
5209
- description: "Beliefs to test in this worktree"
5252
+ description: "Legacy alias for targetBeliefIds"
5253
+ },
5254
+ beliefs: {
5255
+ type: "array",
5256
+ description: "Legacy alias for targetBeliefIds"
5257
+ },
5258
+ targetBeliefIds: {
5259
+ type: "array",
5260
+ description: "Belief node IDs this worktree is expected to test or update"
5261
+ },
5262
+ targetQuestionIds: {
5263
+ type: "array",
5264
+ description: "Question node IDs this worktree is expected to answer"
5265
+ },
5266
+ keyQuestions: {
5267
+ type: "array",
5268
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
5269
+ },
5270
+ evidenceSignals: {
5271
+ type: "array",
5272
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
5273
+ },
5274
+ decisionGate: {
5275
+ type: "object",
5276
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
5277
+ },
5278
+ goCriteria: {
5279
+ type: "array",
5280
+ description: "Shorthand go criteria used to build decisionGate"
5281
+ },
5282
+ noGoSignals: {
5283
+ type: "array",
5284
+ description: "Shorthand no-go signals used to build decisionGate"
5285
+ },
5286
+ proofArtifacts: {
5287
+ type: "array",
5288
+ description: "Expected proof artifacts required to close the worktree"
5210
5289
  },
5211
5290
  autoShape: {
5212
5291
  type: "boolean",
5213
5292
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
5214
5293
  },
5294
+ autoFixPolicy: {
5295
+ type: "object",
5296
+ description: "Policy for permitted automatic remediation inside the worktree"
5297
+ },
5215
5298
  domainPackId: {
5216
5299
  type: "string",
5217
5300
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
@@ -5240,9 +5323,17 @@ var ADD_WORKTREE = {
5240
5323
  type: "array",
5241
5324
  description: "Worktree IDs blocked by this worktree"
5242
5325
  },
5243
- gate: {
5326
+ staffingHint: {
5244
5327
  type: "string",
5245
- description: "Exit gate name for this worktree"
5328
+ description: "Suggested staffing or agent allocation note"
5329
+ },
5330
+ lensId: {
5331
+ type: "string",
5332
+ description: "Lens that scopes this worktree when applicable"
5333
+ },
5334
+ lastReconciledAt: {
5335
+ type: "number",
5336
+ description: "Timestamp when worktree metadata was last reconciled"
5246
5337
  }
5247
5338
  },
5248
5339
  required: ["title", "topicId"],
@@ -5272,7 +5363,7 @@ var MERGE = {
5272
5363
  worktreeId: { type: "string", description: "The worktree to merge" },
5273
5364
  outcomes: {
5274
5365
  type: "array",
5275
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
5366
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
5276
5367
  },
5277
5368
  summary: { type: "string", description: "Overall findings summary" }
5278
5369
  },
@@ -8291,6 +8382,69 @@ var GENERATE_SESSION_HANDOFF = {
8291
8382
  tier: "showcase",
8292
8383
  internal: true
8293
8384
  };
8385
+ var BEGIN_BUILD_SESSION = {
8386
+ name: "begin_build_session",
8387
+ description: "Bootstrap a coding build session for a Lucern worktree. Like `git worktree add` plus `git status` \u2014 returns the compact context packet an agent needs before editing.",
8388
+ parameters: {
8389
+ worktreeId: {
8390
+ type: "string",
8391
+ description: "The Lucern worktree ID to bootstrap."
8392
+ },
8393
+ branch: {
8394
+ type: "string",
8395
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
8396
+ },
8397
+ branchBase: {
8398
+ type: "string",
8399
+ description: 'Base branch for the feature branch. Default: "staging".'
8400
+ },
8401
+ prBase: {
8402
+ type: "string",
8403
+ description: 'Target branch for the PR. Default: "staging".'
8404
+ },
8405
+ sessionMode: {
8406
+ type: "string",
8407
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
8408
+ enum: ["async", "interactive"]
8409
+ },
8410
+ activateIfPlanning: {
8411
+ type: "boolean",
8412
+ description: "When true, automatically activate a planning worktree during bootstrap."
8413
+ }
8414
+ },
8415
+ required: ["worktreeId"],
8416
+ response: {
8417
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
8418
+ fields: {
8419
+ topicId: "string \u2014 canonical topic scope",
8420
+ topicName: "string \u2014 human-readable topic name",
8421
+ worktreeId: "string \u2014 worktree ID",
8422
+ worktreeName: "string \u2014 human-readable worktree name",
8423
+ branch: "string \u2014 git branch name",
8424
+ branchBase: "string \u2014 base branch",
8425
+ prBase: "string \u2014 PR target branch",
8426
+ campaign: "number | null \u2014 top-level pipeline campaign",
8427
+ lane: "string \u2014 campaign lane",
8428
+ gate: "string \u2014 exit gate",
8429
+ hypothesis: "string \u2014 worktree hypothesis",
8430
+ focus: "string \u2014 session focus",
8431
+ status: "string \u2014 worktree status after optional activation",
8432
+ sessionMode: "string \u2014 async | interactive",
8433
+ targetBeliefIds: "array \u2014 scoped belief IDs",
8434
+ targetQuestionIds: "array \u2014 scoped question IDs",
8435
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
8436
+ openQuestions: "array \u2014 open scoped questions",
8437
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
8438
+ dependencies: "array \u2014 upstream worktrees",
8439
+ unblocks: "array \u2014 downstream worktrees",
8440
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
8441
+ }
8442
+ },
8443
+ ownerModule: "bootstrap",
8444
+ ontologyPrimitive: "worktree",
8445
+ tier: "showcase",
8446
+ internal: true
8447
+ };
8294
8448
  var MCP_TOOL_CONTRACTS = {
8295
8449
  // Belief lifecycle (commit, amend, fork, archive)
8296
8450
  create_belief: CREATE_BELIEF,
@@ -8384,6 +8538,7 @@ var MCP_TOOL_CONTRACTS = {
8384
8538
  get_agent_inbox: GET_AGENT_INBOX,
8385
8539
  claim_files: CLAIM_FILES,
8386
8540
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
8541
+ begin_build_session: BEGIN_BUILD_SESSION,
8387
8542
  // Policy / ACL (workhorse)
8388
8543
  check_permission: CHECK_PERMISSION,
8389
8544
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -8597,6 +8752,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
8597
8752
  "get_change_history",
8598
8753
  "get_failure_log",
8599
8754
  "record_attempt",
8755
+ "begin_build_session",
8600
8756
  "push",
8601
8757
  "open_pull_request",
8602
8758
  "record_judgment",
@@ -8651,7 +8807,6 @@ var SDK_ONLY_OPERATION_NAMES = [
8651
8807
  "find_semantic_orphans"
8652
8808
  ];
8653
8809
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
8654
- "begin_build_session",
8655
8810
  "evaluate_engineering_contract",
8656
8811
  "evaluate_research_contract"
8657
8812
  ];
@@ -9037,8 +9192,31 @@ function assertSurfaceCoverage(contracts) {
9037
9192
  }
9038
9193
  }
9039
9194
  }
9040
-
9041
- // ../contracts/src/function-registry/context.ts
9195
+ var jsonRecordSchema2 = z.record(z.unknown());
9196
+ var observationArgs = z.object({
9197
+ topicId: z.string().optional().describe("Topic scope for the observation."),
9198
+ summary: z.string().describe("Short observation summary."),
9199
+ text: z.string().optional().describe("Canonical observation text alias."),
9200
+ title: z.string().optional().describe("Optional observation title."),
9201
+ content: z.string().optional().describe("Optional rich observation content."),
9202
+ contentType: z.string().optional().describe("Observation content type."),
9203
+ kind: z.string().optional().describe("Evidence kind to store."),
9204
+ observationType: z.string().optional().describe("Observation type."),
9205
+ tags: z.array(z.string()).optional().describe("Observation tags."),
9206
+ source: z.string().optional().describe("Observation source label."),
9207
+ sourceType: z.string().optional().describe("Evidence source type."),
9208
+ externalSourceType: z.string().optional().describe("External source type for imported observations."),
9209
+ sourceUrl: z.string().optional().describe("Canonical source URL."),
9210
+ confidence: z.number().optional().describe("Observation confidence."),
9211
+ metadata: jsonRecordSchema2.optional().describe("Observation metadata."),
9212
+ rationale: z.string().optional().describe("Why this observation should be recorded.")
9213
+ });
9214
+ var observationContextArgs = z.object({
9215
+ topicId: z.string().describe("Topic scope."),
9216
+ query: z.string().optional().describe("Optional context query."),
9217
+ limit: z.number().optional().describe("Maximum observations to return."),
9218
+ status: z.string().optional().describe("Observation status filter.")
9219
+ });
9042
9220
  var observationInput = (input, context) => withUserId(
9043
9221
  compactRecord4({
9044
9222
  projectId: input.projectId,
@@ -9097,7 +9275,8 @@ var contextContracts = [
9097
9275
  observationId: output && typeof output === "object" ? output.nodeId : void 0,
9098
9276
  observationType: input.observationType
9099
9277
  })
9100
- }
9278
+ },
9279
+ args: observationArgs
9101
9280
  }),
9102
9281
  surfaceContract({
9103
9282
  name: "get_observation_context",
@@ -9118,7 +9297,8 @@ var contextContracts = [
9118
9297
  status: input.status,
9119
9298
  userId: input.userId
9120
9299
  })
9121
- }
9300
+ },
9301
+ args: observationContextArgs
9122
9302
  })
9123
9303
  ];
9124
9304
 
@@ -9181,8 +9361,45 @@ var identityContracts = [
9181
9361
  }
9182
9362
  })
9183
9363
  ];
9184
-
9185
- // ../contracts/src/function-registry/beliefs.ts
9364
+ var jsonRecordSchema3 = z.record(z.unknown());
9365
+ var sourceTypeSchema = z.enum(["human", "ai_extracted", "ai_generated"]);
9366
+ var reversibilitySchema = z.enum([
9367
+ "irreversible",
9368
+ "hard_to_reverse",
9369
+ "reversible",
9370
+ "trivial"
9371
+ ]);
9372
+ var predictionMetaSchema = z.object({
9373
+ isPrediction: z.boolean().describe("Whether this belief is a prediction."),
9374
+ registeredAt: z.number().describe("Timestamp when the prediction was registered."),
9375
+ expectedBy: z.number().optional().describe("Timestamp when the prediction should be evaluated.")
9376
+ });
9377
+ var createBeliefArgs = z.object({
9378
+ canonicalText: z.string().describe("The belief statement the agent holds to be true."),
9379
+ topicId: z.string().optional().describe("Topic scope hint for the belief."),
9380
+ baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
9381
+ beliefType: z.string().optional().describe("Schema belief type."),
9382
+ metadata: jsonRecordSchema3.optional().describe("Extra metadata merged into the belief node."),
9383
+ rationale: z.string().optional().describe("Why this belief should enter the reasoning graph."),
9384
+ pillar: z.string().optional().describe("Innovation pillar or product pillar associated with the belief."),
9385
+ worktreeId: z.string().optional().describe("Worktree responsible for creating or testing this belief."),
9386
+ sourceBeliefIds: z.array(z.string()).optional().describe("Source belief IDs this belief derives from."),
9387
+ sourceType: sourceTypeSchema.optional().describe("Actor/source class that produced the belief."),
9388
+ reversibility: reversibilitySchema.optional().describe("How reversible the belief's implied decision is."),
9389
+ predictionMeta: predictionMetaSchema.optional().describe("Prediction lifecycle metadata when this belief is a forecast.")
9390
+ });
9391
+ var forkBeliefArgs = z.object({
9392
+ nodeId: z.string().describe("The scored belief to fork from."),
9393
+ newFormulation: z.string().describe("The evolved belief statement."),
9394
+ forkReason: z.enum([
9395
+ "refinement",
9396
+ "contradiction_response",
9397
+ "scope_change",
9398
+ "confidence_collapse",
9399
+ "manual"
9400
+ ]).describe("Why this fork was created."),
9401
+ rationale: z.string().optional().describe("Why the fork is warranted.")
9402
+ });
9186
9403
  var beliefLookupInput = (input) => compactRecord4({
9187
9404
  nodeId: input.nodeId ?? input.id ?? input.beliefId,
9188
9405
  beliefId: input.beliefId
@@ -9257,7 +9474,8 @@ var beliefsContracts = [
9257
9474
  functionName: "create",
9258
9475
  kind: "mutation",
9259
9476
  inputProjection: createBeliefInput
9260
- }
9477
+ },
9478
+ args: createBeliefArgs
9261
9479
  }),
9262
9480
  surfaceContract({
9263
9481
  name: "get_belief",
@@ -9348,7 +9566,8 @@ var beliefsContracts = [
9348
9566
  functionName: "forkBelief",
9349
9567
  kind: "mutation",
9350
9568
  inputProjection: forkBeliefInput
9351
- }
9569
+ },
9570
+ args: forkBeliefArgs
9352
9571
  }),
9353
9572
  surfaceContract({
9354
9573
  name: "archive_belief",
@@ -9429,8 +9648,46 @@ var beliefsContracts = [
9429
9648
  }
9430
9649
  })
9431
9650
  ];
9432
-
9433
- // ../contracts/src/function-registry/evidence.ts
9651
+ var jsonRecordSchema4 = z.record(z.unknown());
9652
+ var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
9653
+ var createEvidenceArgs = z.object({
9654
+ topicId: z.string().optional().describe("Topic scope for the evidence."),
9655
+ text: z.string().describe("Canonical evidence text."),
9656
+ source: z.string().optional().describe("Source URL or source label."),
9657
+ sourceUrl: z.string().optional().describe("Canonical source URL."),
9658
+ targetId: z.string().optional().describe("Belief or question identifier to link immediately."),
9659
+ linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
9660
+ evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
9661
+ confidence: z.number().optional().describe("Confidence in the evidence relation."),
9662
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
9663
+ metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
9664
+ rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
9665
+ reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
9666
+ title: z.string().optional().describe("Optional short title."),
9667
+ content: z.string().optional().describe("Optional long-form content."),
9668
+ contentType: z.string().optional().describe("Content format or MIME hint."),
9669
+ kind: z.string().optional().describe("Evidence kind."),
9670
+ tags: z.array(z.string()).optional().describe("Evidence tags."),
9671
+ sourceType: z.string().optional().describe("Evidence source type."),
9672
+ externalSourceType: z.string().optional().describe("External source type for imported evidence."),
9673
+ sourceQuestionId: z.string().optional().describe("Question that sourced this evidence."),
9674
+ methodology: z.string().optional().describe("Collection methodology."),
9675
+ informationAsymmetry: z.string().optional().describe("Information asymmetry class."),
9676
+ sourceDescription: z.string().optional().describe("Human-readable source description.")
9677
+ });
9678
+ var addEvidenceArgs = z.object({
9679
+ canonicalText: z.string().describe("The evidence statement."),
9680
+ text: z.string().optional().describe("Canonical evidence text alias used by newer callers."),
9681
+ topicId: z.string().optional().describe("Topic scope hint."),
9682
+ sourceUrl: z.string().optional().describe("URL of the source material."),
9683
+ targetNodeId: z.string().describe("The belief this evidence bears on."),
9684
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
9685
+ reasoning: z.string().describe("Why this evidence is relevant to the target belief."),
9686
+ title: z.string().optional().describe("Optional short title."),
9687
+ content: z.string().optional().describe("Optional long-form evidence content."),
9688
+ contentType: z.string().optional().describe("Content format or MIME hint."),
9689
+ metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
9690
+ });
9434
9691
  var evidenceIdInput = (input) => compactRecord4({
9435
9692
  evidenceId: input.evidenceId,
9436
9693
  insightId: input.insightId,
@@ -9505,7 +9762,8 @@ var evidenceContracts = [
9505
9762
  functionName: "create",
9506
9763
  kind: "mutation",
9507
9764
  inputProjection: createEvidenceInput
9508
- }
9765
+ },
9766
+ args: createEvidenceArgs
9509
9767
  }),
9510
9768
  surfaceContract({
9511
9769
  name: "add_evidence",
@@ -9541,7 +9799,8 @@ var evidenceContracts = [
9541
9799
  context
9542
9800
  );
9543
9801
  }
9544
- }
9802
+ },
9803
+ args: addEvidenceArgs
9545
9804
  }),
9546
9805
  surfaceContract({
9547
9806
  name: "get_evidence",
@@ -9648,8 +9907,91 @@ var evidenceContracts = [
9648
9907
  }
9649
9908
  })
9650
9909
  ];
9651
-
9652
- // ../contracts/src/function-registry/questions.ts
9910
+ var jsonRecordSchema5 = z.record(z.unknown());
9911
+ var questionPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
9912
+ var kernelQuestionPrioritySchema = z.enum([
9913
+ "critical",
9914
+ "high",
9915
+ "medium",
9916
+ "low"
9917
+ ]);
9918
+ var questionTypeSchema = z.enum([
9919
+ "validation",
9920
+ "falsification",
9921
+ "assumption_probe",
9922
+ "prediction_test",
9923
+ "counterfactual",
9924
+ "discovery",
9925
+ "clarification",
9926
+ "comparison",
9927
+ "causal",
9928
+ "mechanism",
9929
+ "general"
9930
+ ]);
9931
+ var createQuestionArgs = z.object({
9932
+ text: z.string().describe("The question text."),
9933
+ question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
9934
+ topicId: z.string().optional().describe("Topic scope hint."),
9935
+ priority: questionPrioritySchema.optional().describe("Human-facing question priority."),
9936
+ linkedBeliefId: z.string().optional().describe("Belief this question tests."),
9937
+ linkedBeliefNodeId: z.string().optional().describe("Belief node this question tests."),
9938
+ metadata: jsonRecordSchema5.optional().describe("Optional metadata merged into the question record."),
9939
+ category: z.string().optional().describe("Question category."),
9940
+ source: z.string().optional().describe("Question source."),
9941
+ testType: z.enum(["validates", "invalidates", "clarifies"]).optional().describe("How this question tests its linked belief."),
9942
+ importance: z.number().optional().describe("Numeric importance score."),
9943
+ epistemicUnlock: z.string().optional().describe("What this question unlocks if answered."),
9944
+ sourceQuestionIds: z.array(z.string()).optional().describe("Question IDs this question derives from."),
9945
+ linkedWorktreeId: z.string().optional().describe("Worktree this question belongs to."),
9946
+ questionType: questionTypeSchema.optional().describe("Question type."),
9947
+ questionPriority: kernelQuestionPrioritySchema.optional().describe("Kernel-native question priority.")
9948
+ });
9949
+ var refineQuestionArgs = z.object({
9950
+ id: z.string().describe("The question to refine."),
9951
+ text: z.string().describe("Updated question text."),
9952
+ question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
9953
+ rationale: z.string().optional().describe("Why the question is refined."),
9954
+ category: z.string().optional().describe("Updated question category."),
9955
+ priority: questionPrioritySchema.optional().describe("Updated human-facing priority.")
9956
+ });
9957
+ var createAnswerArgs = z.object({
9958
+ questionNodeId: z.string().describe("The question node ID this answer responds to."),
9959
+ questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
9960
+ answerText: z.string().describe("The answer content."),
9961
+ topicId: z.string().optional().describe("Topic scope for the answer."),
9962
+ confidence: z.string().optional().describe("Answer confidence."),
9963
+ evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node IDs supporting the answer."),
9964
+ answerSource: z.string().optional().describe("How the answer was produced."),
9965
+ worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
9966
+ sprintId: z.string().optional().describe("Legacy sprint identifier.")
9967
+ });
9968
+ var answerQuestionArgs = z.object({
9969
+ id: z.string().describe("Canonical question ID."),
9970
+ topicId: z.string().describe("Topic scope for the answer."),
9971
+ text: z.string().describe("Answer text."),
9972
+ confidence: z.enum(["weak", "medium", "strong"]).optional().describe("Optional answer confidence."),
9973
+ evidenceIds: z.array(z.string()).optional().describe("Canonical evidence IDs supporting the answer."),
9974
+ rationale: z.string().optional().describe("Why this answer is credible."),
9975
+ questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
9976
+ questionNodeId: z.string().optional().describe("Question node ID alias accepted by the projection."),
9977
+ answerText: z.string().optional().describe("Canonical answer text alias accepted by newer callers."),
9978
+ evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node ID alias accepted by newer callers."),
9979
+ answerSource: z.string().optional().describe("How the answer was produced."),
9980
+ worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
9981
+ sprintId: z.string().optional().describe("Legacy sprint identifier.")
9982
+ });
9983
+ var missingQuestionsArgs = z.object({
9984
+ topicId: z.string().describe("Topic scope."),
9985
+ minConfidence: z.number().optional().describe("Minimum confidence threshold for missing-question checks."),
9986
+ status: z.string().optional().describe("Question status filter."),
9987
+ limit: z.number().optional().describe("Maximum questions to inspect.")
9988
+ });
9989
+ var falsificationQuestionsArgs = z.object({
9990
+ topicId: z.string().describe("Topic scope."),
9991
+ beliefIds: z.array(z.string()).optional().describe("Beliefs to generate falsification questions for."),
9992
+ status: z.string().optional().describe("Question status filter."),
9993
+ limit: z.number().optional().describe("Maximum questions to inspect.")
9994
+ });
9653
9995
  var questionNodeInput = (input) => compactRecord4({
9654
9996
  nodeId: input.nodeId ?? input.id ?? input.questionId,
9655
9997
  questionId: input.questionId
@@ -9696,7 +10038,8 @@ var questionsContracts = [
9696
10038
  functionName: "create",
9697
10039
  kind: "mutation",
9698
10040
  inputProjection: createQuestionInput
9699
- }
10041
+ },
10042
+ args: createQuestionArgs
9700
10043
  }),
9701
10044
  surfaceContract({
9702
10045
  name: "get_question",
@@ -9752,7 +10095,8 @@ var questionsContracts = [
9752
10095
  category: input.category,
9753
10096
  priority: input.priority
9754
10097
  })
9755
- }
10098
+ },
10099
+ args: refineQuestionArgs
9756
10100
  }),
9757
10101
  surfaceContract({
9758
10102
  name: "update_question_status",
@@ -9828,7 +10172,8 @@ var questionsContracts = [
9828
10172
  }),
9829
10173
  context
9830
10174
  )
9831
- }
10175
+ },
10176
+ args: createAnswerArgs
9832
10177
  }),
9833
10178
  surfaceContract({
9834
10179
  name: "answer_question",
@@ -9857,7 +10202,8 @@ var questionsContracts = [
9857
10202
  }),
9858
10203
  context
9859
10204
  )
9860
- }
10205
+ },
10206
+ args: answerQuestionArgs
9861
10207
  }),
9862
10208
  surfaceContract({
9863
10209
  name: "get_answer",
@@ -9889,7 +10235,8 @@ var questionsContracts = [
9889
10235
  functionName: "getByTopic",
9890
10236
  kind: "query",
9891
10237
  inputProjection: questionTopicInput
9892
- }
10238
+ },
10239
+ args: missingQuestionsArgs
9893
10240
  }),
9894
10241
  surfaceContract({
9895
10242
  name: "get_high_priority_questions",
@@ -9924,11 +10271,22 @@ var questionsContracts = [
9924
10271
  functionName: "getByTopic",
9925
10272
  kind: "query",
9926
10273
  inputProjection: questionTopicInput
9927
- }
10274
+ },
10275
+ args: falsificationQuestionsArgs
9928
10276
  })
9929
10277
  ];
9930
-
9931
- // ../contracts/src/function-registry/topics.ts
10278
+ var updateTopicArgs = z.object({
10279
+ id: z.string().describe("Topic ID."),
10280
+ topicId: z.string().optional().describe("Topic ID alias."),
10281
+ name: z.string().optional().describe("Topic name."),
10282
+ description: z.string().optional().describe("Topic description."),
10283
+ type: z.string().optional().describe("Topic type."),
10284
+ status: z.string().optional().describe("Topic status."),
10285
+ visibility: z.string().optional().describe("Topic visibility."),
10286
+ ontologyId: z.string().optional().describe("Ontology to bind."),
10287
+ clearOntologyId: z.boolean().optional().describe("Whether to clear the ontology binding."),
10288
+ metadata: z.record(z.unknown()).optional().describe("Topic metadata.")
10289
+ });
9932
10290
  var topicIdInput = (input) => compactRecord4({
9933
10291
  id: input.id ?? input.topicId
9934
10292
  });
@@ -10009,7 +10367,8 @@ var topicsContracts = [
10009
10367
  functionName: "update",
10010
10368
  kind: "mutation",
10011
10369
  inputProjection: updateTopicInput
10012
- }
10370
+ },
10371
+ args: updateTopicArgs
10013
10372
  }),
10014
10373
  surfaceContract({
10015
10374
  name: "get_topic_tree",
@@ -10028,8 +10387,27 @@ var topicsContracts = [
10028
10387
  }
10029
10388
  })
10030
10389
  ];
10031
-
10032
- // ../contracts/src/function-registry/lenses.ts
10390
+ var lensPerspectiveSchema = z.enum([
10391
+ "investigation",
10392
+ "monitoring",
10393
+ "analysis",
10394
+ "comparison",
10395
+ "taxonomy"
10396
+ ]);
10397
+ var jsonRecordSchema6 = z.record(z.unknown());
10398
+ var createLensArgs = z.object({
10399
+ name: z.string().describe("Lens name."),
10400
+ workspaceId: z.string().optional().describe("Workspace scope for the lens."),
10401
+ topicId: z.string().optional().describe("Originating topic scope."),
10402
+ description: z.string().optional().describe("What this lens investigates or monitors."),
10403
+ perspectiveType: lensPerspectiveSchema.describe("Perspective type."),
10404
+ promptTemplates: z.array(jsonRecordSchema6).optional().describe("Prompt templates used through this lens."),
10405
+ workflowTemplates: z.array(jsonRecordSchema6).optional().describe("Guided workflow templates."),
10406
+ taskTemplates: z.array(jsonRecordSchema6).optional().describe("Default task templates."),
10407
+ questionTemplates: z.array(jsonRecordSchema6).optional().describe("Default question templates."),
10408
+ filterCriteria: jsonRecordSchema6.optional().describe("Belief/evidence filtering criteria."),
10409
+ metadata: jsonRecordSchema6.optional().describe("Additional lens metadata.")
10410
+ });
10033
10411
  var createLensInput = (input, context) => compactRecord4({
10034
10412
  name: input.name,
10035
10413
  description: input.description,
@@ -10066,7 +10444,8 @@ var lensesContracts = [
10066
10444
  functionName: "create",
10067
10445
  kind: "mutation",
10068
10446
  inputProjection: createLensInput
10069
- }
10447
+ },
10448
+ args: createLensArgs
10070
10449
  }),
10071
10450
  surfaceContract({
10072
10451
  name: "list_lenses",
@@ -10128,8 +10507,18 @@ var lensesContracts = [
10128
10507
  }
10129
10508
  })
10130
10509
  ];
10131
-
10132
- // ../contracts/src/function-registry/ontologies.ts
10510
+ var updateOntologyArgs = z.object({
10511
+ id: z.string().describe("Ontology definition ID."),
10512
+ ontologyId: z.string().optional().describe("Ontology ID alias."),
10513
+ name: z.string().optional().describe("Ontology display name."),
10514
+ description: z.string().optional().describe("Ontology description."),
10515
+ status: z.string().optional().describe("Ontology lifecycle status.")
10516
+ });
10517
+ var ontologyVersionLifecycleArgs = z.object({
10518
+ id: z.string().describe("Ontology version ID."),
10519
+ versionId: z.string().optional().describe("Ontology version ID alias."),
10520
+ ontologyId: z.string().optional().describe("Ontology definition ID.")
10521
+ });
10133
10522
  var ontologyIdInput = (input) => compactRecord4({
10134
10523
  id: input.id ?? input.ontologyId
10135
10524
  });
@@ -10208,11 +10597,11 @@ var ontologiesContracts = [
10208
10597
  id: input.id ?? input.ontologyId,
10209
10598
  name: input.name,
10210
10599
  description: input.description,
10211
- parentOntologyId: input.parentOntologyId,
10212
10600
  status: input.status,
10213
10601
  actorId: input.actorId
10214
10602
  })
10215
- }
10603
+ },
10604
+ args: updateOntologyArgs
10216
10605
  }),
10217
10606
  surfaceContract({
10218
10607
  name: "archive_ontology",
@@ -10295,7 +10684,8 @@ var ontologiesContracts = [
10295
10684
  functionName: "publishOntologyVersion",
10296
10685
  kind: "mutation",
10297
10686
  inputProjection: ontologyVersionIdInput
10298
- }
10687
+ },
10688
+ args: ontologyVersionLifecycleArgs
10299
10689
  }),
10300
10690
  surfaceContract({
10301
10691
  name: "deprecate_ontology_version",
@@ -10311,7 +10701,8 @@ var ontologiesContracts = [
10311
10701
  functionName: "deprecateOntologyVersion",
10312
10702
  kind: "mutation",
10313
10703
  inputProjection: ontologyVersionIdInput
10314
- }
10704
+ },
10705
+ args: ontologyVersionLifecycleArgs
10315
10706
  }),
10316
10707
  surfaceContract({
10317
10708
  name: "resolve_effective_ontology",
@@ -10330,8 +10721,76 @@ var ontologiesContracts = [
10330
10721
  }
10331
10722
  })
10332
10723
  ];
10333
-
10334
- // ../contracts/src/function-registry/worktrees.ts
10724
+ var autoFixPolicyInputSchema = z.object({
10725
+ enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
10726
+ mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
10727
+ maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
10728
+ reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
10729
+ maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
10730
+ permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
10731
+ requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
10732
+ escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
10733
+ }).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
10734
+ var worktreeKeyQuestionInputSchema = z.object({
10735
+ question: z.string().describe("Question the worktree must resolve."),
10736
+ status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
10737
+ answer: z.string().optional().describe("Captured answer when the key question is resolved."),
10738
+ answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
10739
+ linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
10740
+ }).passthrough().describe("Question contract embedded in the worktree plan.");
10741
+ var worktreeEvidenceSignalInputSchema = z.object({
10742
+ signal: z.string().describe("Evidence signal the worktree should collect."),
10743
+ collected: z.boolean().optional().describe("Whether the signal has already been collected."),
10744
+ progress: z.string().optional().describe("Collection progress note for the signal."),
10745
+ notes: z.string().optional().describe("Additional evidence collection notes.")
10746
+ }).passthrough().describe("Evidence signal embedded in the worktree plan.");
10747
+ var worktreeDecisionGateInputSchema = z.object({
10748
+ goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
10749
+ noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
10750
+ verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
10751
+ verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
10752
+ decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
10753
+ decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
10754
+ }).passthrough().describe("Decision gate contract for worktree activation or exit.");
10755
+ var addWorktreeArgs = z.object({
10756
+ title: z.string().optional().describe("Human-readable worktree name or objective."),
10757
+ name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
10758
+ topicId: z.string().describe("Primary topic scope for the worktree."),
10759
+ projectId: z.string().optional().describe("Legacy topicId alias."),
10760
+ branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
10761
+ objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
10762
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
10763
+ rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
10764
+ worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
10765
+ gate: z.string().optional().describe("Exit gate for this worktree."),
10766
+ startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
10767
+ endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
10768
+ durationWeeks: z.number().optional().describe("Planned duration in weeks."),
10769
+ confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
10770
+ beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
10771
+ beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
10772
+ beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
10773
+ targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
10774
+ targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
10775
+ keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
10776
+ evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
10777
+ decisionGate: worktreeDecisionGateInputSchema.optional(),
10778
+ goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
10779
+ noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
10780
+ proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
10781
+ autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
10782
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
10783
+ domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
10784
+ campaign: z.number().optional().describe("Top-level pipeline campaign number."),
10785
+ lane: z.string().optional().describe("Campaign lane for the worktree."),
10786
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
10787
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
10788
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
10789
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
10790
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
10791
+ lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
10792
+ lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
10793
+ });
10335
10794
  var worktreeIdInput = (input) => compactRecord4({
10336
10795
  worktreeId: input.worktreeId ?? input.id
10337
10796
  });
@@ -10364,6 +10823,50 @@ var worktreeMetadataInput = (input) => compactRecord4({
10364
10823
  autoFixPolicy: input.autoFixPolicy,
10365
10824
  lastReconciledAt: input.lastReconciledAt
10366
10825
  });
10826
+ var worktreeMetadataArgs = z.object({
10827
+ worktreeId: z.string().describe("The worktree to update."),
10828
+ id: z.string().optional().describe("Worktree ID alias."),
10829
+ topicId: z.string().optional().describe("Primary topic scope."),
10830
+ additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
10831
+ status: z.string().optional().describe("Worktree lifecycle status."),
10832
+ campaign: z.number().optional().describe("Top-level pipeline campaign."),
10833
+ lane: z.string().optional().describe("Campaign lane."),
10834
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
10835
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
10836
+ gate: z.string().optional().describe("Exit gate for this worktree."),
10837
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
10838
+ objective: z.string().optional().describe("Reasoning objective for the worktree."),
10839
+ rationale: z.string().optional().describe("Why this worktree is sequenced here."),
10840
+ proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
10841
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
10842
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
10843
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
10844
+ lensId: z.string().optional().describe("Lens that scopes this worktree."),
10845
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
10846
+ lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
10847
+ });
10848
+ var pushArgs = worktreeMetadataArgs.extend({
10849
+ targetContext: z.string().describe("Where to push merged findings."),
10850
+ beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
10851
+ });
10852
+ var openPullRequestArgs = worktreeMetadataArgs.extend({
10853
+ reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
10854
+ summary: z.string().describe("Summary of findings and why they are ready for review.")
10855
+ });
10856
+ var mergeKeyFindingsInput = (input) => {
10857
+ if (Array.isArray(input.keyFindings)) {
10858
+ return input.keyFindings;
10859
+ }
10860
+ if (Array.isArray(input.outcomes)) {
10861
+ const findings = input.outcomes.filter(
10862
+ (outcome) => typeof outcome === "string" && outcome.trim().length > 0
10863
+ );
10864
+ if (findings.length > 0) {
10865
+ return findings;
10866
+ }
10867
+ }
10868
+ return [input.summary ?? "Merged worktree"];
10869
+ };
10367
10870
  var listAllWorktreesInput = (input) => compactRecord4({
10368
10871
  status: input.status,
10369
10872
  lane: input.lane,
@@ -10371,6 +10874,16 @@ var listAllWorktreesInput = (input) => compactRecord4({
10371
10874
  limit: input.limit
10372
10875
  });
10373
10876
  var worktreesContracts = [
10877
+ surfaceContract({
10878
+ name: "begin_build_session",
10879
+ kind: "mutation",
10880
+ domain: "worktrees",
10881
+ surfaceClass: "platform_internal",
10882
+ path: "/mcp/build-session/begin",
10883
+ sdkNamespace: "worktrees",
10884
+ sdkMethod: "beginBuildSession",
10885
+ summary: "Begin a coding build session for a worktree."
10886
+ }),
10374
10887
  surfaceContract({
10375
10888
  name: "add_worktree",
10376
10889
  kind: "mutation",
@@ -10387,13 +10900,12 @@ var worktreesContracts = [
10387
10900
  inputProjection: (input, context) => withCreatedBy(
10388
10901
  compactRecord4({
10389
10902
  name: input.name ?? input.title,
10390
- topicId: input.topicId,
10903
+ topicId: input.topicId ?? input.projectId,
10391
10904
  worktreeType: input.worktreeType,
10392
10905
  objective: input.objective,
10393
10906
  gate: input.gate,
10394
10907
  hypothesis: input.hypothesis,
10395
10908
  rationale: input.rationale,
10396
- signal: input.signal,
10397
10909
  startDate: input.startDate,
10398
10910
  endDate: input.endDate,
10399
10911
  durationWeeks: input.durationWeeks,
@@ -10419,12 +10931,12 @@ var worktreesContracts = [
10419
10931
  staffingHint: input.staffingHint,
10420
10932
  domainPackId: input.domainPackId,
10421
10933
  lensId: input.lensId,
10422
- linkedQuestionId: input.linkedQuestionId,
10423
10934
  lastReconciledAt: input.lastReconciledAt
10424
10935
  }),
10425
10936
  context
10426
10937
  )
10427
- }
10938
+ },
10939
+ args: addWorktreeArgs
10428
10940
  }),
10429
10941
  surfaceContract({
10430
10942
  name: "activate_worktree",
@@ -10536,7 +11048,8 @@ var worktreesContracts = [
10536
11048
  functionName: "updateMetadata",
10537
11049
  kind: "mutation",
10538
11050
  inputProjection: worktreeMetadataInput
10539
- }
11051
+ },
11052
+ args: worktreeMetadataArgs
10540
11053
  }),
10541
11054
  surfaceContract({
10542
11055
  name: "merge",
@@ -10554,9 +11067,7 @@ var worktreesContracts = [
10554
11067
  inputProjection: (input, context) => withUserId(
10555
11068
  {
10556
11069
  ...worktreeIdInput(input),
10557
- keyFindings: input.keyFindings ?? [
10558
- input.summary ?? "Merged worktree"
10559
- ],
11070
+ keyFindings: mergeKeyFindingsInput(input),
10560
11071
  decisionsReached: input.decisionsReached ?? [],
10561
11072
  nextSteps: input.nextSteps ?? []
10562
11073
  },
@@ -10578,7 +11089,8 @@ var worktreesContracts = [
10578
11089
  functionName: "updateMetadata",
10579
11090
  kind: "mutation",
10580
11091
  inputProjection: worktreeMetadataInput
10581
- }
11092
+ },
11093
+ args: pushArgs
10582
11094
  }),
10583
11095
  surfaceContract({
10584
11096
  name: "open_pull_request",
@@ -10594,7 +11106,8 @@ var worktreesContracts = [
10594
11106
  functionName: "updateMetadata",
10595
11107
  kind: "mutation",
10596
11108
  inputProjection: worktreeMetadataInput
10597
- }
11109
+ },
11110
+ args: openPullRequestArgs
10598
11111
  })
10599
11112
  ];
10600
11113
 
@@ -10698,6 +11211,15 @@ var createEdgeArgs = z.object({
10698
11211
  topicId: z.string().optional(),
10699
11212
  trustedBypassAccessCheck: z.boolean().optional()
10700
11213
  });
11214
+ var queryLineageArgs = z.object({
11215
+ nodeId: z.string().describe("Starting node to trace from."),
11216
+ startNode: z.string().optional().describe("Starting node alias accepted by traversal callers."),
11217
+ depth: z.number().optional().describe("Traversal depth alias."),
11218
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11219
+ mode: z.string().optional().describe("Traversal mode."),
11220
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
11221
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
11222
+ });
10701
11223
  function graphRefNodeId(ref) {
10702
11224
  if (ref.kind === "epistemic_node") {
10703
11225
  return ref.nodeId;
@@ -10768,11 +11290,59 @@ var edgesContracts = [
10768
11290
  minLayer: input.minLayer,
10769
11291
  maxLayer: input.maxLayer
10770
11292
  })
10771
- }
11293
+ },
11294
+ args: queryLineageArgs
10772
11295
  })
10773
11296
  ];
10774
-
10775
- // ../contracts/src/function-registry/graph.ts
11297
+ var traversalLayerSchema = z.enum([
11298
+ "L4",
11299
+ "L3",
11300
+ "L2",
11301
+ "L1",
11302
+ "ontological",
11303
+ "organizational"
11304
+ ]);
11305
+ var traversalModeSchema = z.enum(["low", "medium", "high", "extra_high"]);
11306
+ var lineageAliasArgs = z.object({
11307
+ nodeId: z.string().optional().describe("Starting node to traverse from."),
11308
+ startNode: z.string().optional().describe("Starting node alias for traversal callers."),
11309
+ entityId: z.string().optional().describe("Entity identifier alias for impact tracing."),
11310
+ depth: z.number().optional().describe("Traversal depth alias."),
11311
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11312
+ mode: traversalModeSchema.optional().describe("Traversal mode."),
11313
+ minLayer: traversalLayerSchema.optional().describe("Minimum epistemic layer to include."),
11314
+ maxLayer: traversalLayerSchema.optional().describe("Maximum epistemic layer to include.")
11315
+ });
11316
+ var lineageArgs = lineageAliasArgs.extend({
11317
+ nodeId: z.string().describe("Starting node to traverse from.")
11318
+ });
11319
+ var traverseGraphArgs = lineageAliasArgs.extend({
11320
+ startNode: z.string().describe("Node to start traversal from."),
11321
+ direction: z.enum(["up", "down", "both"]).optional().describe("Traversal direction.")
11322
+ });
11323
+ var graphNeighborhoodArgs = z.object({
11324
+ globalId: z.string().optional().describe("Single root global ID."),
11325
+ globalIds: z.array(z.string()).optional().describe("Root global IDs for the neighborhood."),
11326
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11327
+ topicId: z.string().optional().describe("Topic scope for edge lookup."),
11328
+ limit: z.number().optional().describe("Maximum edges to return.")
11329
+ });
11330
+ var flagContradictionArgs = z.object({
11331
+ beliefA: z.string().describe("First belief in tension."),
11332
+ beliefB: z.string().describe("Second belief in tension."),
11333
+ topicId: z.string().optional().describe("Topic scope for the contradiction."),
11334
+ description: z.string().optional().describe("Human-readable contradiction."),
11335
+ severity: z.enum(["critical", "high", "medium", "low"]).optional().describe("Contradiction severity."),
11336
+ defeatType: z.string().optional().describe("Defeat type annotation."),
11337
+ supportingInsightIds: z.array(z.string()).optional().describe("Evidence supporting the primary belief."),
11338
+ contradictingInsightIds: z.array(z.string()).optional().describe("Evidence or beliefs contradicting the primary belief.")
11339
+ });
11340
+ var discoverEntityConnectionsArgs = lineageAliasArgs.extend({
11341
+ nodeId: z.string().describe("Epistemic node ID to find entity connections for."),
11342
+ topicId: z.string().optional().describe("Topic scope override."),
11343
+ minScore: z.number().optional().describe("Minimum match score."),
11344
+ limit: z.number().optional().describe("Maximum candidates to return.")
11345
+ });
10776
11346
  var contradictionSeverity = (value) => {
10777
11347
  switch (value) {
10778
11348
  case "critical":
@@ -10827,7 +11397,8 @@ var graphContracts = [
10827
11397
  functionName: "getLineage",
10828
11398
  kind: "query",
10829
11399
  inputProjection: lineageInput
10830
- }
11400
+ },
11401
+ args: traverseGraphArgs
10831
11402
  }),
10832
11403
  surfaceContract({
10833
11404
  name: "get_graph_neighborhood",
@@ -10843,7 +11414,8 @@ var graphContracts = [
10843
11414
  functionName: "getByTopic",
10844
11415
  kind: "query",
10845
11416
  inputProjection: topicEdgesInput
10846
- }
11417
+ },
11418
+ args: graphNeighborhoodArgs
10847
11419
  }),
10848
11420
  surfaceContract({
10849
11421
  name: "get_graph_structure_analysis",
@@ -10892,7 +11464,8 @@ var graphContracts = [
10892
11464
  functionName: "create",
10893
11465
  kind: "mutation",
10894
11466
  inputProjection: flagContradictionInput
10895
- }
11467
+ },
11468
+ args: flagContradictionArgs
10896
11469
  }),
10897
11470
  surfaceContract({
10898
11471
  name: "detect_confirmation_bias",
@@ -10983,7 +11556,8 @@ var graphContracts = [
10983
11556
  functionName: "getLineage",
10984
11557
  kind: "query",
10985
11558
  inputProjection: lineageInput
10986
- }
11559
+ },
11560
+ args: discoverEntityConnectionsArgs
10987
11561
  }),
10988
11562
  surfaceContract({
10989
11563
  name: "trigger_belief_review",
@@ -11014,7 +11588,8 @@ var graphContracts = [
11014
11588
  functionName: "getLineage",
11015
11589
  kind: "query",
11016
11590
  inputProjection: lineageInput
11017
- }
11591
+ },
11592
+ args: lineageArgs
11018
11593
  })
11019
11594
  ];
11020
11595
 
@@ -11066,8 +11641,16 @@ var contractsContracts = [
11066
11641
  }
11067
11642
  })
11068
11643
  ];
11069
-
11070
- // ../contracts/src/function-registry/judgments.ts
11644
+ var auditTrailArgs = z.object({
11645
+ nodeId: z.string().describe("The node to audit."),
11646
+ id: z.string().optional().describe("Node ID alias."),
11647
+ limit: z.number().optional().describe("Maximum entries to return."),
11648
+ depth: z.number().optional().describe("Traversal depth alias."),
11649
+ maxDepth: z.number().optional().describe("Maximum lineage depth."),
11650
+ mode: z.string().optional().describe("Traversal mode."),
11651
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
11652
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
11653
+ });
11071
11654
  var judgmentsContracts = [
11072
11655
  surfaceContract({
11073
11656
  name: "record_judgment",
@@ -11122,7 +11705,8 @@ var judgmentsContracts = [
11122
11705
  minLayer: input.minLayer,
11123
11706
  maxLayer: input.maxLayer
11124
11707
  })
11125
- }
11708
+ },
11709
+ args: auditTrailArgs
11126
11710
  })
11127
11711
  ];
11128
11712
 
@@ -11290,8 +11874,13 @@ var coordinationContracts = [
11290
11874
  }
11291
11875
  })
11292
11876
  ];
11293
-
11294
- // ../contracts/src/function-registry/pipeline.ts
11877
+ var pipelineSnapshotArgs = z.object({
11878
+ topicId: z.string().describe("Topic scope ID."),
11879
+ status: z.string().optional().describe("Worktree status filter."),
11880
+ lane: z.string().optional().describe("Campaign lane filter."),
11881
+ campaign: z.number().optional().describe("Campaign number filter."),
11882
+ limit: z.number().optional().describe("Maximum worktrees to inspect.")
11883
+ });
11295
11884
  var pipelineContracts = [
11296
11885
  surfaceContract({
11297
11886
  name: "pipeline_snapshot",
@@ -11312,7 +11901,8 @@ var pipelineContracts = [
11312
11901
  campaign: input.campaign,
11313
11902
  limit: input.limit
11314
11903
  })
11315
- }
11904
+ },
11905
+ args: pipelineSnapshotArgs
11316
11906
  }),
11317
11907
  surfaceContract({
11318
11908
  name: "seed_belief_lattice",
@@ -11364,7 +11954,31 @@ var recordScopeLearningArgs = z.object({
11364
11954
  rationale: z.string().optional().describe("Why this learning should enter the reasoning graph"),
11365
11955
  createQuestionText: z.string().optional().describe("Optional follow-up question text"),
11366
11956
  createBeliefText: z.string().optional().describe("Optional new belief text"),
11367
- beliefType: z.string().optional().describe("Optional belief type for createBeliefText")
11957
+ beliefType: z.string().optional().describe("Optional belief type for createBeliefText"),
11958
+ text: z.string().optional().describe("Canonical learning text alias."),
11959
+ content: z.string().optional().describe("Canonical learning content alias."),
11960
+ kind: z.string().optional().describe("Evidence kind to store."),
11961
+ sourceType: z.string().optional().describe("Evidence source type."),
11962
+ externalSourceType: z.string().optional().describe("External source type alias."),
11963
+ metadata: z.record(z.unknown()).optional().describe("Learning metadata.")
11964
+ });
11965
+ var codeContextArgs = z.object({
11966
+ topicId: z.string().optional().describe("Topic scope."),
11967
+ filePath: z.string().optional().describe("File path anchor."),
11968
+ includeFailures: z.boolean().optional().describe("Whether to include failed attempts."),
11969
+ limit: z.number().optional().describe("Maximum records to return."),
11970
+ status: z.string().optional().describe("Evidence status filter.")
11971
+ });
11972
+ var recordAttemptArgs = z.object({
11973
+ topicId: z.string().optional().describe("Topic scope."),
11974
+ description: z.string().describe("Attempt description."),
11975
+ errorMessage: z.string().optional().describe("Failure or error message."),
11976
+ filePaths: z.array(z.string()).optional().describe("Files involved in the attempt."),
11977
+ filePath: z.string().optional().describe("Single file path alias."),
11978
+ linkedBeliefId: z.string().optional().describe("Linked belief ID."),
11979
+ metadata: z.record(z.unknown()).optional().describe("Attempt metadata."),
11980
+ rationale: z.string().optional().describe("Why this attempt should be recorded."),
11981
+ title: z.string().optional().describe("Attempt evidence title.")
11368
11982
  });
11369
11983
  var learningInput = (input, context) => {
11370
11984
  const sourceKind = input.sourceKind ?? input.externalSourceType;
@@ -11481,7 +12095,8 @@ var codingContracts = [
11481
12095
  status: input.status,
11482
12096
  userId: input.userId
11483
12097
  })
11484
- }
12098
+ },
12099
+ args: codeContextArgs
11485
12100
  }),
11486
12101
  surfaceContract({
11487
12102
  name: "get_change_history",
@@ -11518,7 +12133,8 @@ var codingContracts = [
11518
12133
  functionName: "create",
11519
12134
  kind: "mutation",
11520
12135
  inputProjection: attemptInput
11521
- }
12136
+ },
12137
+ args: recordAttemptArgs
11522
12138
  }),
11523
12139
  surfaceContract({
11524
12140
  name: "get_failure_log",
@@ -11593,6 +12209,604 @@ new Map(
11593
12209
  ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
11594
12210
  );
11595
12211
 
12212
+ // ../contracts/src/tenant-bootstrap-seed.contract.ts
12213
+ function isCopyableSeedRequirement(entry) {
12214
+ return (entry.copyMode === "template_global" || entry.copyMode === "template_tenant_rewrite" || entry.copyMode === "template_reference_remap") && Boolean(entry.scope) && Array.isArray(entry.uniqueKey) && entry.uniqueKey.length > 0;
12215
+ }
12216
+ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
12217
+ {
12218
+ component: "kernel",
12219
+ table: "agentMessages",
12220
+ prepopulation: "runtime_data",
12221
+ copyMode: "none",
12222
+ description: "Agent coordination messages are session data, not template data."
12223
+ },
12224
+ {
12225
+ component: "kernel",
12226
+ table: "agentSessions",
12227
+ prepopulation: "runtime_data",
12228
+ copyMode: "none",
12229
+ description: "Agent coordination sessions are created by active clients."
12230
+ },
12231
+ {
12232
+ component: "kernel",
12233
+ table: "autofixJobs",
12234
+ prepopulation: "runtime_queue",
12235
+ copyMode: "none",
12236
+ description: "Autofix work items are runtime queue rows."
12237
+ },
12238
+ {
12239
+ component: "kernel",
12240
+ table: "backgroundJobRuns",
12241
+ prepopulation: "runtime_log",
12242
+ copyMode: "none",
12243
+ description: "Background job executions are runtime logs."
12244
+ },
12245
+ {
12246
+ component: "kernel",
12247
+ table: "backgroundJobSettings",
12248
+ prepopulation: "required_template",
12249
+ copyMode: "template_global",
12250
+ scope: "global",
12251
+ uniqueKey: ["jobKey"],
12252
+ description: "Default job enablement settings must come from the K template."
12253
+ },
12254
+ {
12255
+ component: "kernel",
12256
+ table: "beliefConfidence",
12257
+ prepopulation: "runtime_data",
12258
+ copyMode: "none",
12259
+ description: "Belief confidence rows are created with tenant graph facts."
12260
+ },
12261
+ {
12262
+ component: "kernel",
12263
+ table: "beliefEvidenceLinks",
12264
+ prepopulation: "runtime_data",
12265
+ copyMode: "none",
12266
+ description: "Belief-to-evidence links are tenant graph data."
12267
+ },
12268
+ {
12269
+ component: "kernel",
12270
+ table: "beliefHistory",
12271
+ prepopulation: "runtime_data",
12272
+ copyMode: "none",
12273
+ description: "Belief history is append-only tenant graph data."
12274
+ },
12275
+ {
12276
+ component: "kernel",
12277
+ table: "beliefScenarios",
12278
+ prepopulation: "runtime_data",
12279
+ copyMode: "none",
12280
+ description: "Scenario rows are tenant-authored reasoning data."
12281
+ },
12282
+ {
12283
+ component: "kernel",
12284
+ table: "beliefVotes",
12285
+ prepopulation: "runtime_data",
12286
+ copyMode: "none",
12287
+ description: "Decision belief votes are tenant-authored data."
12288
+ },
12289
+ {
12290
+ component: "kernel",
12291
+ table: "calibrationScores",
12292
+ prepopulation: "runtime_derived",
12293
+ copyMode: "none",
12294
+ description: "Calibration scores are computed from tenant outcomes."
12295
+ },
12296
+ {
12297
+ component: "kernel",
12298
+ table: "contractEvaluations",
12299
+ prepopulation: "runtime_log",
12300
+ copyMode: "none",
12301
+ description: "Contract evaluation rows are runtime computation logs."
12302
+ },
12303
+ {
12304
+ component: "kernel",
12305
+ table: "contradictions",
12306
+ prepopulation: "runtime_data",
12307
+ copyMode: "none",
12308
+ description: "Contradictions are tenant graph facts."
12309
+ },
12310
+ {
12311
+ component: "kernel",
12312
+ table: "crossProjectConnections",
12313
+ prepopulation: "runtime_data",
12314
+ copyMode: "none",
12315
+ description: "Cross-topic connections are tenant graph facts."
12316
+ },
12317
+ {
12318
+ component: "kernel",
12319
+ table: "decisionComputedSummaries",
12320
+ prepopulation: "runtime_derived",
12321
+ copyMode: "none",
12322
+ description: "Decision summaries are derived tenant outputs."
12323
+ },
12324
+ {
12325
+ component: "kernel",
12326
+ table: "decisionEvents",
12327
+ prepopulation: "runtime_data",
12328
+ copyMode: "none",
12329
+ description: "Decision events are lifecycle data."
12330
+ },
12331
+ {
12332
+ component: "kernel",
12333
+ table: "decisionParticipants",
12334
+ prepopulation: "runtime_data",
12335
+ copyMode: "none",
12336
+ description: "Decision participants are tenant-selected actors."
12337
+ },
12338
+ {
12339
+ component: "kernel",
12340
+ table: "decisionRiskLedger",
12341
+ prepopulation: "runtime_data",
12342
+ copyMode: "none",
12343
+ description: "Decision risk rows are tenant decision data."
12344
+ },
12345
+ {
12346
+ component: "kernel",
12347
+ table: "decisionSnapshots",
12348
+ prepopulation: "runtime_derived",
12349
+ copyMode: "none",
12350
+ description: "Decision snapshots are derived from tenant state."
12351
+ },
12352
+ {
12353
+ component: "kernel",
12354
+ table: "deliberationContributions",
12355
+ prepopulation: "runtime_data",
12356
+ copyMode: "none",
12357
+ description: "Deliberation contributions are tenant-authored data."
12358
+ },
12359
+ {
12360
+ component: "kernel",
12361
+ table: "deliberationSessions",
12362
+ prepopulation: "runtime_data",
12363
+ copyMode: "none",
12364
+ description: "Deliberation sessions are created by tenant workflows."
12365
+ },
12366
+ {
12367
+ component: "kernel",
12368
+ table: "epistemicAudit",
12369
+ prepopulation: "runtime_log",
12370
+ copyMode: "none",
12371
+ description: "Epistemic audit rows are append-only runtime audit data."
12372
+ },
12373
+ {
12374
+ component: "kernel",
12375
+ table: "epistemicContracts",
12376
+ prepopulation: "runtime_data",
12377
+ copyMode: "none",
12378
+ description: "Epistemic contracts are tenant-authored governance data."
12379
+ },
12380
+ {
12381
+ component: "kernel",
12382
+ table: "epistemicEdges",
12383
+ prepopulation: "runtime_data",
12384
+ copyMode: "none",
12385
+ description: "Edges are tenant reasoning graph data."
12386
+ },
12387
+ {
12388
+ component: "kernel",
12389
+ table: "epistemicNodeEmbeddings",
12390
+ prepopulation: "runtime_derived",
12391
+ copyMode: "none",
12392
+ description: "Embeddings are derived from tenant graph nodes."
12393
+ },
12394
+ {
12395
+ component: "kernel",
12396
+ table: "epistemicNodes",
12397
+ prepopulation: "runtime_data",
12398
+ copyMode: "none",
12399
+ description: "Nodes are tenant reasoning graph data."
12400
+ },
12401
+ {
12402
+ component: "kernel",
12403
+ table: "graphAnalysisCache",
12404
+ prepopulation: "runtime_derived",
12405
+ copyMode: "none",
12406
+ description: "Graph analysis cache rows are derived from tenant graph state."
12407
+ },
12408
+ {
12409
+ component: "kernel",
12410
+ table: "graphAnalysisResults",
12411
+ prepopulation: "runtime_derived",
12412
+ copyMode: "none",
12413
+ description: "Graph analysis result rows are derived tenant outputs."
12414
+ },
12415
+ {
12416
+ component: "kernel",
12417
+ table: "graphSuggestions",
12418
+ prepopulation: "runtime_derived",
12419
+ copyMode: "none",
12420
+ description: "Graph suggestions are derived recommendations."
12421
+ },
12422
+ {
12423
+ component: "kernel",
12424
+ table: "harnessReplays",
12425
+ prepopulation: "runtime_log",
12426
+ copyMode: "none",
12427
+ description: "Harness replay rows are runtime verification logs."
12428
+ },
12429
+ {
12430
+ component: "kernel",
12431
+ table: "harnessRuns",
12432
+ prepopulation: "runtime_log",
12433
+ copyMode: "none",
12434
+ description: "Harness run rows are runtime verification logs."
12435
+ },
12436
+ {
12437
+ component: "kernel",
12438
+ table: "idempotencyTokens",
12439
+ prepopulation: "runtime_log",
12440
+ copyMode: "none",
12441
+ description: "Idempotency tokens are request-scoped runtime guards."
12442
+ },
12443
+ {
12444
+ component: "kernel",
12445
+ table: "lenses",
12446
+ prepopulation: "optional_template",
12447
+ copyMode: "none",
12448
+ description: "Reusable lens templates may live in K templates, but workspace-specific copies are not required for core SDK boot."
12449
+ },
12450
+ {
12451
+ component: "kernel",
12452
+ table: "lensTopicBindings",
12453
+ prepopulation: "runtime_data",
12454
+ copyMode: "none",
12455
+ description: "Lens bindings attach runtime topics to runtime/workspace lenses."
12456
+ },
12457
+ {
12458
+ component: "kernel",
12459
+ table: "neo4jSyncQueue",
12460
+ prepopulation: "runtime_queue",
12461
+ copyMode: "none",
12462
+ description: "Neo4j sync queue rows are runtime work items."
12463
+ },
12464
+ {
12465
+ component: "kernel",
12466
+ table: "ontologyDefinitions",
12467
+ prepopulation: "required_template",
12468
+ copyMode: "template_global",
12469
+ scope: "global",
12470
+ uniqueKey: ["ontologyKey"],
12471
+ description: "Platform ontology definitions power taxonomy reads and effective ontology resolution."
12472
+ },
12473
+ {
12474
+ component: "kernel",
12475
+ table: "ontologyVersions",
12476
+ prepopulation: "required_template",
12477
+ copyMode: "template_reference_remap",
12478
+ scope: "global",
12479
+ uniqueKey: ["ontologyKey", "version"],
12480
+ dependsOn: ["ontologyDefinitions"],
12481
+ description: "Ontology versions must be copied with ontologyDefinition ID remapping."
12482
+ },
12483
+ {
12484
+ component: "kernel",
12485
+ table: "platformAgentRunPolicyDecisions",
12486
+ prepopulation: "runtime_log",
12487
+ copyMode: "none",
12488
+ description: "Agent-run policy decisions are audit logs."
12489
+ },
12490
+ {
12491
+ component: "kernel",
12492
+ table: "platformAgentRunPromptResolutions",
12493
+ prepopulation: "runtime_log",
12494
+ copyMode: "none",
12495
+ description: "Agent-run prompt resolution rows are runtime logs."
12496
+ },
12497
+ {
12498
+ component: "kernel",
12499
+ table: "platformAgentRuns",
12500
+ prepopulation: "runtime_log",
12501
+ copyMode: "none",
12502
+ description: "Agent runs are runtime execution records."
12503
+ },
12504
+ {
12505
+ component: "kernel",
12506
+ table: "platformAgentRunToolCalls",
12507
+ prepopulation: "runtime_log",
12508
+ copyMode: "none",
12509
+ description: "Agent-run tool calls are runtime execution records."
12510
+ },
12511
+ {
12512
+ component: "kernel",
12513
+ table: "platformHarnessShadowAudit",
12514
+ prepopulation: "runtime_log",
12515
+ copyMode: "none",
12516
+ description: "Harness shadow audit rows are runtime audit records."
12517
+ },
12518
+ {
12519
+ component: "kernel",
12520
+ table: "publicationRules",
12521
+ prepopulation: "required_template",
12522
+ copyMode: "template_tenant_rewrite",
12523
+ scope: "tenant",
12524
+ uniqueKey: ["tenantId", "workspaceId", "name"],
12525
+ description: "Default publication policy rules are rewritten into each tenant."
12526
+ },
12527
+ {
12528
+ component: "kernel",
12529
+ table: "questionEvidenceLinks",
12530
+ prepopulation: "runtime_data",
12531
+ copyMode: "none",
12532
+ description: "Question-to-evidence links are tenant graph data."
12533
+ },
12534
+ {
12535
+ component: "kernel",
12536
+ table: "researchJobs",
12537
+ prepopulation: "runtime_queue",
12538
+ copyMode: "none",
12539
+ description: "Research job rows are runtime queue items."
12540
+ },
12541
+ {
12542
+ component: "kernel",
12543
+ table: "schemaEnumConfig",
12544
+ prepopulation: "required_template",
12545
+ copyMode: "template_global",
12546
+ scope: "global",
12547
+ uniqueKey: ["category", "value"],
12548
+ description: "Runtime-extensible enum defaults required by SDK graph APIs."
12549
+ },
12550
+ {
12551
+ component: "kernel",
12552
+ table: "stakeholderGroups",
12553
+ prepopulation: "runtime_data",
12554
+ copyMode: "none",
12555
+ description: "Stakeholder groups are tenant decision data."
12556
+ },
12557
+ {
12558
+ component: "kernel",
12559
+ table: "systemLogs",
12560
+ prepopulation: "runtime_log",
12561
+ copyMode: "none",
12562
+ description: "System logs are runtime telemetry."
12563
+ },
12564
+ {
12565
+ component: "kernel",
12566
+ table: "tasks",
12567
+ prepopulation: "runtime_data",
12568
+ copyMode: "none",
12569
+ description: "Tasks are tenant-authored work items."
12570
+ },
12571
+ {
12572
+ component: "kernel",
12573
+ table: "topics",
12574
+ prepopulation: "runtime_bootstrap",
12575
+ copyMode: "none",
12576
+ description: "Default topics are created by tenant provisioning, not copied from templates."
12577
+ },
12578
+ {
12579
+ component: "kernel",
12580
+ table: "workflowDefinitions",
12581
+ prepopulation: "optional_template",
12582
+ copyMode: "none",
12583
+ description: "Table-driven workflow definitions can be template data after the workflow engine leaves legacy mode."
12584
+ },
12585
+ {
12586
+ component: "kernel",
12587
+ table: "workflowPullRequests",
12588
+ prepopulation: "runtime_data",
12589
+ copyMode: "none",
12590
+ description: "Workflow pull requests are tenant workflow data."
12591
+ },
12592
+ {
12593
+ component: "kernel",
12594
+ table: "workflowStages",
12595
+ prepopulation: "optional_template",
12596
+ copyMode: "none",
12597
+ dependsOn: ["workflowDefinitions"],
12598
+ description: "Workflow stages can be template data after workflowDefinitions are enabled for bootstrap copying."
12599
+ },
12600
+ {
12601
+ component: "kernel",
12602
+ table: "worktreeBeliefCluster",
12603
+ prepopulation: "runtime_data",
12604
+ copyMode: "none",
12605
+ description: "Worktree cluster rows link runtime worktrees to runtime beliefs."
12606
+ },
12607
+ {
12608
+ component: "kernel",
12609
+ table: "worktrees",
12610
+ prepopulation: "runtime_data",
12611
+ copyMode: "none",
12612
+ description: "Worktrees are tenant/runtime planning data."
12613
+ },
12614
+ {
12615
+ component: "identity",
12616
+ table: "agents",
12617
+ prepopulation: "runtime_bootstrap",
12618
+ copyMode: "none",
12619
+ description: "Service agents are provisioned per tenant or service, not copied."
12620
+ },
12621
+ {
12622
+ component: "identity",
12623
+ table: "mcpWritePolicy",
12624
+ prepopulation: "required_template",
12625
+ copyMode: "template_global",
12626
+ scope: "global",
12627
+ uniqueKey: ["topicId", "role", "toolCategory"],
12628
+ description: "Global write policy defaults govern service and interactive MCP writes."
12629
+ },
12630
+ {
12631
+ component: "identity",
12632
+ table: "modelCallLogs",
12633
+ prepopulation: "runtime_log",
12634
+ copyMode: "none",
12635
+ description: "Model call logs are runtime telemetry."
12636
+ },
12637
+ {
12638
+ component: "identity",
12639
+ table: "modelFunctionSlots",
12640
+ prepopulation: "required_template",
12641
+ copyMode: "template_global",
12642
+ scope: "global",
12643
+ uniqueKey: ["slot"],
12644
+ description: "Function-to-model slots are required by model runtime resolution."
12645
+ },
12646
+ {
12647
+ component: "identity",
12648
+ table: "modelRegistry",
12649
+ prepopulation: "required_template",
12650
+ copyMode: "template_global",
12651
+ scope: "global",
12652
+ uniqueKey: ["key"],
12653
+ description: "Model catalog defaults are required by model runtime clients."
12654
+ },
12655
+ {
12656
+ component: "identity",
12657
+ table: "modelSlotConfigs",
12658
+ prepopulation: "required_template",
12659
+ copyMode: "template_global",
12660
+ scope: "global",
12661
+ uniqueKey: ["slot"],
12662
+ description: "Slot-level defaults are required before tenant overrides exist."
12663
+ },
12664
+ {
12665
+ component: "identity",
12666
+ table: "platformAudienceGrants",
12667
+ prepopulation: "runtime_data",
12668
+ copyMode: "none",
12669
+ description: "Audience grants are principal/group-specific access rows."
12670
+ },
12671
+ {
12672
+ component: "identity",
12673
+ table: "platformAudiences",
12674
+ prepopulation: "required_template",
12675
+ copyMode: "template_tenant_rewrite",
12676
+ scope: "tenant",
12677
+ uniqueKey: ["tenantId", "workspaceId", "audienceKey"],
12678
+ description: "Default tenant audience taxonomy rows are rewritten into each tenant."
12679
+ },
12680
+ {
12681
+ component: "identity",
12682
+ table: "platformPolicyDecisionLogs",
12683
+ prepopulation: "runtime_log",
12684
+ copyMode: "none",
12685
+ description: "Policy decisions are runtime audit logs."
12686
+ },
12687
+ {
12688
+ component: "identity",
12689
+ table: "projectGrants",
12690
+ prepopulation: "runtime_data",
12691
+ copyMode: "none",
12692
+ description: "Project/topic grants are principal or group-specific access rows."
12693
+ },
12694
+ {
12695
+ component: "identity",
12696
+ table: "reasoningPermissions",
12697
+ prepopulation: "runtime_data",
12698
+ copyMode: "none",
12699
+ description: "Reasoning permissions are principal-specific policy rows."
12700
+ },
12701
+ {
12702
+ component: "identity",
12703
+ table: "tenantApiKeys",
12704
+ prepopulation: "runtime_secret",
12705
+ copyMode: "none",
12706
+ description: "API keys are tenant credentials and must never be copied."
12707
+ },
12708
+ {
12709
+ component: "identity",
12710
+ table: "tenantConfig",
12711
+ prepopulation: "required_template",
12712
+ copyMode: "template_tenant_rewrite",
12713
+ scope: "tenant",
12714
+ uniqueKey: ["tenantId"],
12715
+ description: "Tenant-local config defaults are rewritten during bootstrap."
12716
+ },
12717
+ {
12718
+ component: "identity",
12719
+ table: "tenantIntegrations",
12720
+ prepopulation: "required_template",
12721
+ copyMode: "template_tenant_rewrite",
12722
+ scope: "tenant",
12723
+ uniqueKey: ["tenantId", "integrationKey"],
12724
+ description: "Non-secret integration descriptors are rewritten into each tenant."
12725
+ },
12726
+ {
12727
+ component: "identity",
12728
+ table: "tenantModelSlotBindings",
12729
+ prepopulation: "runtime_secret",
12730
+ copyMode: "none",
12731
+ description: "Tenant model slot bindings reference provider secrets and are runtime-only."
12732
+ },
12733
+ {
12734
+ component: "identity",
12735
+ table: "tenantPolicies",
12736
+ prepopulation: "required_template",
12737
+ copyMode: "template_tenant_rewrite",
12738
+ scope: "tenant",
12739
+ uniqueKey: ["tenantId", "workspaceId", "roleName"],
12740
+ description: "Default tenant policy roles are rewritten during bootstrap."
12741
+ },
12742
+ {
12743
+ component: "identity",
12744
+ table: "tenantProviderSecrets",
12745
+ prepopulation: "runtime_secret",
12746
+ copyMode: "none",
12747
+ description: "Provider secrets are credentials and must never be copied."
12748
+ },
12749
+ {
12750
+ component: "identity",
12751
+ table: "tenantProxyGatewayUsage",
12752
+ prepopulation: "runtime_log",
12753
+ copyMode: "none",
12754
+ description: "Proxy gateway usage rows are runtime telemetry."
12755
+ },
12756
+ {
12757
+ component: "identity",
12758
+ table: "tenantProxyTokenMints",
12759
+ prepopulation: "runtime_secret",
12760
+ copyMode: "none",
12761
+ description: "Proxy token mints are ephemeral secret-bearing runtime rows."
12762
+ },
12763
+ {
12764
+ component: "identity",
12765
+ table: "tenantSandboxAuditEvents",
12766
+ prepopulation: "runtime_log",
12767
+ copyMode: "none",
12768
+ description: "Sandbox audit rows are runtime security logs."
12769
+ },
12770
+ {
12771
+ component: "identity",
12772
+ table: "tenantSecrets",
12773
+ prepopulation: "runtime_secret",
12774
+ copyMode: "none",
12775
+ description: "Tenant secrets are credentials and must never be copied."
12776
+ },
12777
+ {
12778
+ component: "identity",
12779
+ table: "toolAcls",
12780
+ prepopulation: "required_template",
12781
+ copyMode: "template_global",
12782
+ scope: "global",
12783
+ uniqueKey: ["role", "toolName"],
12784
+ description: "Default role-to-tool grants are required for SDK/MCP tool access."
12785
+ },
12786
+ {
12787
+ component: "identity",
12788
+ table: "toolRegistry",
12789
+ prepopulation: "required_template",
12790
+ copyMode: "template_global",
12791
+ scope: "global",
12792
+ uniqueKey: ["toolName"],
12793
+ description: "Core tool catalog rows are required before pack or tenant tools exist."
12794
+ },
12795
+ {
12796
+ component: "identity",
12797
+ table: "users",
12798
+ prepopulation: "runtime_bootstrap",
12799
+ copyMode: "none",
12800
+ description: "Users are created from Clerk/MC principal resolution, not copied."
12801
+ }
12802
+ ];
12803
+ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
12804
+ isCopyableSeedRequirement
12805
+ );
12806
+ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
12807
+ (entry) => !isCopyableSeedRequirement(entry)
12808
+ ).map((entry) => entry.table);
12809
+
11596
12810
  // src/webhooks.ts
11597
12811
  var LOCALHOST_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
11598
12812
  function normalizeUrl(url) {