@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/outbox.js CHANGED
@@ -3930,7 +3930,9 @@ defineTable({
3930
3930
  "defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
3931
3931
  "deployments": z.record(z.object({
3932
3932
  "url": z.string(),
3933
- "encryptedDeployKey": z.string()
3933
+ "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
3934
+ "encryptedDeployKey": z.string().optional(),
3935
+ "credentialRef": z.string().optional()
3934
3936
  })).optional(),
3935
3937
  "metadata": z.record(z.any()).optional(),
3936
3938
  "createdBy": z.string().optional(),
@@ -5127,6 +5129,14 @@ var ADD_WORKTREE = {
5127
5129
  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.",
5128
5130
  parameters: {
5129
5131
  title: { type: "string", description: "Worktree name/objective" },
5132
+ name: {
5133
+ type: "string",
5134
+ description: "Optional storage-name alias for callers that already use backend naming"
5135
+ },
5136
+ projectId: {
5137
+ type: "string",
5138
+ description: "Legacy topicId alias"
5139
+ },
5130
5140
  topicId: { type: "string", description: "Optional topic scope hint" },
5131
5141
  branchId: {
5132
5142
  type: "string",
@@ -5140,14 +5150,87 @@ var ADD_WORKTREE = {
5140
5150
  type: "string",
5141
5151
  description: "The testable claim this worktree investigates"
5142
5152
  },
5153
+ rationale: {
5154
+ type: "string",
5155
+ description: "Why this worktree exists and why it belongs in the campaign"
5156
+ },
5157
+ worktreeType: {
5158
+ type: "string",
5159
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
5160
+ },
5161
+ gate: {
5162
+ type: "string",
5163
+ description: "Exit gate name for this worktree"
5164
+ },
5165
+ startDate: {
5166
+ type: "number",
5167
+ description: "Planned start timestamp in milliseconds since epoch"
5168
+ },
5169
+ endDate: {
5170
+ type: "number",
5171
+ description: "Planned end timestamp in milliseconds since epoch"
5172
+ },
5173
+ durationWeeks: {
5174
+ type: "number",
5175
+ description: "Planned duration in weeks"
5176
+ },
5177
+ confidenceImpact: {
5178
+ type: "string",
5179
+ description: "Expected confidence impact if the worktree succeeds",
5180
+ enum: ["high", "medium", "low"]
5181
+ },
5182
+ beliefFocus: {
5183
+ type: "string",
5184
+ description: "Natural-language focus spanning the target belief neighborhood"
5185
+ },
5143
5186
  beliefIds: {
5144
5187
  type: "array",
5145
- description: "Beliefs to test in this worktree"
5188
+ description: "Legacy alias for targetBeliefIds"
5189
+ },
5190
+ beliefs: {
5191
+ type: "array",
5192
+ description: "Legacy alias for targetBeliefIds"
5193
+ },
5194
+ targetBeliefIds: {
5195
+ type: "array",
5196
+ description: "Belief node IDs this worktree is expected to test or update"
5197
+ },
5198
+ targetQuestionIds: {
5199
+ type: "array",
5200
+ description: "Question node IDs this worktree is expected to answer"
5201
+ },
5202
+ keyQuestions: {
5203
+ type: "array",
5204
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
5205
+ },
5206
+ evidenceSignals: {
5207
+ type: "array",
5208
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
5209
+ },
5210
+ decisionGate: {
5211
+ type: "object",
5212
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
5213
+ },
5214
+ goCriteria: {
5215
+ type: "array",
5216
+ description: "Shorthand go criteria used to build decisionGate"
5217
+ },
5218
+ noGoSignals: {
5219
+ type: "array",
5220
+ description: "Shorthand no-go signals used to build decisionGate"
5221
+ },
5222
+ proofArtifacts: {
5223
+ type: "array",
5224
+ description: "Expected proof artifacts required to close the worktree"
5146
5225
  },
5147
5226
  autoShape: {
5148
5227
  type: "boolean",
5149
5228
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
5150
5229
  },
5230
+ autoFixPolicy: {
5231
+ type: "object",
5232
+ description: "Policy for permitted automatic remediation inside the worktree"
5233
+ },
5151
5234
  domainPackId: {
5152
5235
  type: "string",
5153
5236
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
@@ -5176,9 +5259,17 @@ var ADD_WORKTREE = {
5176
5259
  type: "array",
5177
5260
  description: "Worktree IDs blocked by this worktree"
5178
5261
  },
5179
- gate: {
5262
+ staffingHint: {
5180
5263
  type: "string",
5181
- description: "Exit gate name for this worktree"
5264
+ description: "Suggested staffing or agent allocation note"
5265
+ },
5266
+ lensId: {
5267
+ type: "string",
5268
+ description: "Lens that scopes this worktree when applicable"
5269
+ },
5270
+ lastReconciledAt: {
5271
+ type: "number",
5272
+ description: "Timestamp when worktree metadata was last reconciled"
5182
5273
  }
5183
5274
  },
5184
5275
  required: ["title", "topicId"],
@@ -5208,7 +5299,7 @@ var MERGE = {
5208
5299
  worktreeId: { type: "string", description: "The worktree to merge" },
5209
5300
  outcomes: {
5210
5301
  type: "array",
5211
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
5302
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
5212
5303
  },
5213
5304
  summary: { type: "string", description: "Overall findings summary" }
5214
5305
  },
@@ -8227,6 +8318,69 @@ var GENERATE_SESSION_HANDOFF = {
8227
8318
  tier: "showcase",
8228
8319
  internal: true
8229
8320
  };
8321
+ var BEGIN_BUILD_SESSION = {
8322
+ name: "begin_build_session",
8323
+ 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.",
8324
+ parameters: {
8325
+ worktreeId: {
8326
+ type: "string",
8327
+ description: "The Lucern worktree ID to bootstrap."
8328
+ },
8329
+ branch: {
8330
+ type: "string",
8331
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
8332
+ },
8333
+ branchBase: {
8334
+ type: "string",
8335
+ description: 'Base branch for the feature branch. Default: "staging".'
8336
+ },
8337
+ prBase: {
8338
+ type: "string",
8339
+ description: 'Target branch for the PR. Default: "staging".'
8340
+ },
8341
+ sessionMode: {
8342
+ type: "string",
8343
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
8344
+ enum: ["async", "interactive"]
8345
+ },
8346
+ activateIfPlanning: {
8347
+ type: "boolean",
8348
+ description: "When true, automatically activate a planning worktree during bootstrap."
8349
+ }
8350
+ },
8351
+ required: ["worktreeId"],
8352
+ response: {
8353
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
8354
+ fields: {
8355
+ topicId: "string \u2014 canonical topic scope",
8356
+ topicName: "string \u2014 human-readable topic name",
8357
+ worktreeId: "string \u2014 worktree ID",
8358
+ worktreeName: "string \u2014 human-readable worktree name",
8359
+ branch: "string \u2014 git branch name",
8360
+ branchBase: "string \u2014 base branch",
8361
+ prBase: "string \u2014 PR target branch",
8362
+ campaign: "number | null \u2014 top-level pipeline campaign",
8363
+ lane: "string \u2014 campaign lane",
8364
+ gate: "string \u2014 exit gate",
8365
+ hypothesis: "string \u2014 worktree hypothesis",
8366
+ focus: "string \u2014 session focus",
8367
+ status: "string \u2014 worktree status after optional activation",
8368
+ sessionMode: "string \u2014 async | interactive",
8369
+ targetBeliefIds: "array \u2014 scoped belief IDs",
8370
+ targetQuestionIds: "array \u2014 scoped question IDs",
8371
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
8372
+ openQuestions: "array \u2014 open scoped questions",
8373
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
8374
+ dependencies: "array \u2014 upstream worktrees",
8375
+ unblocks: "array \u2014 downstream worktrees",
8376
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
8377
+ }
8378
+ },
8379
+ ownerModule: "bootstrap",
8380
+ ontologyPrimitive: "worktree",
8381
+ tier: "showcase",
8382
+ internal: true
8383
+ };
8230
8384
  var MCP_TOOL_CONTRACTS = {
8231
8385
  // Belief lifecycle (commit, amend, fork, archive)
8232
8386
  create_belief: CREATE_BELIEF,
@@ -8320,6 +8474,7 @@ var MCP_TOOL_CONTRACTS = {
8320
8474
  get_agent_inbox: GET_AGENT_INBOX,
8321
8475
  claim_files: CLAIM_FILES,
8322
8476
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
8477
+ begin_build_session: BEGIN_BUILD_SESSION,
8323
8478
  // Policy / ACL (workhorse)
8324
8479
  check_permission: CHECK_PERMISSION,
8325
8480
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -8533,6 +8688,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
8533
8688
  "get_change_history",
8534
8689
  "get_failure_log",
8535
8690
  "record_attempt",
8691
+ "begin_build_session",
8536
8692
  "push",
8537
8693
  "open_pull_request",
8538
8694
  "record_judgment",
@@ -8587,7 +8743,6 @@ var SDK_ONLY_OPERATION_NAMES = [
8587
8743
  "find_semantic_orphans"
8588
8744
  ];
8589
8745
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
8590
- "begin_build_session",
8591
8746
  "evaluate_engineering_contract",
8592
8747
  "evaluate_research_contract"
8593
8748
  ];
@@ -8973,8 +9128,31 @@ function assertSurfaceCoverage(contracts) {
8973
9128
  }
8974
9129
  }
8975
9130
  }
8976
-
8977
- // ../contracts/src/function-registry/context.ts
9131
+ var jsonRecordSchema2 = z.record(z.unknown());
9132
+ var observationArgs = z.object({
9133
+ topicId: z.string().optional().describe("Topic scope for the observation."),
9134
+ summary: z.string().describe("Short observation summary."),
9135
+ text: z.string().optional().describe("Canonical observation text alias."),
9136
+ title: z.string().optional().describe("Optional observation title."),
9137
+ content: z.string().optional().describe("Optional rich observation content."),
9138
+ contentType: z.string().optional().describe("Observation content type."),
9139
+ kind: z.string().optional().describe("Evidence kind to store."),
9140
+ observationType: z.string().optional().describe("Observation type."),
9141
+ tags: z.array(z.string()).optional().describe("Observation tags."),
9142
+ source: z.string().optional().describe("Observation source label."),
9143
+ sourceType: z.string().optional().describe("Evidence source type."),
9144
+ externalSourceType: z.string().optional().describe("External source type for imported observations."),
9145
+ sourceUrl: z.string().optional().describe("Canonical source URL."),
9146
+ confidence: z.number().optional().describe("Observation confidence."),
9147
+ metadata: jsonRecordSchema2.optional().describe("Observation metadata."),
9148
+ rationale: z.string().optional().describe("Why this observation should be recorded.")
9149
+ });
9150
+ var observationContextArgs = z.object({
9151
+ topicId: z.string().describe("Topic scope."),
9152
+ query: z.string().optional().describe("Optional context query."),
9153
+ limit: z.number().optional().describe("Maximum observations to return."),
9154
+ status: z.string().optional().describe("Observation status filter.")
9155
+ });
8978
9156
  var observationInput = (input, context) => withUserId(
8979
9157
  compactRecord4({
8980
9158
  projectId: input.projectId,
@@ -9033,7 +9211,8 @@ var contextContracts = [
9033
9211
  observationId: output && typeof output === "object" ? output.nodeId : void 0,
9034
9212
  observationType: input.observationType
9035
9213
  })
9036
- }
9214
+ },
9215
+ args: observationArgs
9037
9216
  }),
9038
9217
  surfaceContract({
9039
9218
  name: "get_observation_context",
@@ -9054,7 +9233,8 @@ var contextContracts = [
9054
9233
  status: input.status,
9055
9234
  userId: input.userId
9056
9235
  })
9057
- }
9236
+ },
9237
+ args: observationContextArgs
9058
9238
  })
9059
9239
  ];
9060
9240
 
@@ -9117,8 +9297,45 @@ var identityContracts = [
9117
9297
  }
9118
9298
  })
9119
9299
  ];
9120
-
9121
- // ../contracts/src/function-registry/beliefs.ts
9300
+ var jsonRecordSchema3 = z.record(z.unknown());
9301
+ var sourceTypeSchema = z.enum(["human", "ai_extracted", "ai_generated"]);
9302
+ var reversibilitySchema = z.enum([
9303
+ "irreversible",
9304
+ "hard_to_reverse",
9305
+ "reversible",
9306
+ "trivial"
9307
+ ]);
9308
+ var predictionMetaSchema = z.object({
9309
+ isPrediction: z.boolean().describe("Whether this belief is a prediction."),
9310
+ registeredAt: z.number().describe("Timestamp when the prediction was registered."),
9311
+ expectedBy: z.number().optional().describe("Timestamp when the prediction should be evaluated.")
9312
+ });
9313
+ var createBeliefArgs = z.object({
9314
+ canonicalText: z.string().describe("The belief statement the agent holds to be true."),
9315
+ topicId: z.string().optional().describe("Topic scope hint for the belief."),
9316
+ baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
9317
+ beliefType: z.string().optional().describe("Schema belief type."),
9318
+ metadata: jsonRecordSchema3.optional().describe("Extra metadata merged into the belief node."),
9319
+ rationale: z.string().optional().describe("Why this belief should enter the reasoning graph."),
9320
+ pillar: z.string().optional().describe("Innovation pillar or product pillar associated with the belief."),
9321
+ worktreeId: z.string().optional().describe("Worktree responsible for creating or testing this belief."),
9322
+ sourceBeliefIds: z.array(z.string()).optional().describe("Source belief IDs this belief derives from."),
9323
+ sourceType: sourceTypeSchema.optional().describe("Actor/source class that produced the belief."),
9324
+ reversibility: reversibilitySchema.optional().describe("How reversible the belief's implied decision is."),
9325
+ predictionMeta: predictionMetaSchema.optional().describe("Prediction lifecycle metadata when this belief is a forecast.")
9326
+ });
9327
+ var forkBeliefArgs = z.object({
9328
+ nodeId: z.string().describe("The scored belief to fork from."),
9329
+ newFormulation: z.string().describe("The evolved belief statement."),
9330
+ forkReason: z.enum([
9331
+ "refinement",
9332
+ "contradiction_response",
9333
+ "scope_change",
9334
+ "confidence_collapse",
9335
+ "manual"
9336
+ ]).describe("Why this fork was created."),
9337
+ rationale: z.string().optional().describe("Why the fork is warranted.")
9338
+ });
9122
9339
  var beliefLookupInput = (input) => compactRecord4({
9123
9340
  nodeId: input.nodeId ?? input.id ?? input.beliefId,
9124
9341
  beliefId: input.beliefId
@@ -9193,7 +9410,8 @@ var beliefsContracts = [
9193
9410
  functionName: "create",
9194
9411
  kind: "mutation",
9195
9412
  inputProjection: createBeliefInput
9196
- }
9413
+ },
9414
+ args: createBeliefArgs
9197
9415
  }),
9198
9416
  surfaceContract({
9199
9417
  name: "get_belief",
@@ -9284,7 +9502,8 @@ var beliefsContracts = [
9284
9502
  functionName: "forkBelief",
9285
9503
  kind: "mutation",
9286
9504
  inputProjection: forkBeliefInput
9287
- }
9505
+ },
9506
+ args: forkBeliefArgs
9288
9507
  }),
9289
9508
  surfaceContract({
9290
9509
  name: "archive_belief",
@@ -9365,8 +9584,46 @@ var beliefsContracts = [
9365
9584
  }
9366
9585
  })
9367
9586
  ];
9368
-
9369
- // ../contracts/src/function-registry/evidence.ts
9587
+ var jsonRecordSchema4 = z.record(z.unknown());
9588
+ var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
9589
+ var createEvidenceArgs = z.object({
9590
+ topicId: z.string().optional().describe("Topic scope for the evidence."),
9591
+ text: z.string().describe("Canonical evidence text."),
9592
+ source: z.string().optional().describe("Source URL or source label."),
9593
+ sourceUrl: z.string().optional().describe("Canonical source URL."),
9594
+ targetId: z.string().optional().describe("Belief or question identifier to link immediately."),
9595
+ linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
9596
+ evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
9597
+ confidence: z.number().optional().describe("Confidence in the evidence relation."),
9598
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
9599
+ metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
9600
+ rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
9601
+ reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
9602
+ title: z.string().optional().describe("Optional short title."),
9603
+ content: z.string().optional().describe("Optional long-form content."),
9604
+ contentType: z.string().optional().describe("Content format or MIME hint."),
9605
+ kind: z.string().optional().describe("Evidence kind."),
9606
+ tags: z.array(z.string()).optional().describe("Evidence tags."),
9607
+ sourceType: z.string().optional().describe("Evidence source type."),
9608
+ externalSourceType: z.string().optional().describe("External source type for imported evidence."),
9609
+ sourceQuestionId: z.string().optional().describe("Question that sourced this evidence."),
9610
+ methodology: z.string().optional().describe("Collection methodology."),
9611
+ informationAsymmetry: z.string().optional().describe("Information asymmetry class."),
9612
+ sourceDescription: z.string().optional().describe("Human-readable source description.")
9613
+ });
9614
+ var addEvidenceArgs = z.object({
9615
+ canonicalText: z.string().describe("The evidence statement."),
9616
+ text: z.string().optional().describe("Canonical evidence text alias used by newer callers."),
9617
+ topicId: z.string().optional().describe("Topic scope hint."),
9618
+ sourceUrl: z.string().optional().describe("URL of the source material."),
9619
+ targetNodeId: z.string().describe("The belief this evidence bears on."),
9620
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
9621
+ reasoning: z.string().describe("Why this evidence is relevant to the target belief."),
9622
+ title: z.string().optional().describe("Optional short title."),
9623
+ content: z.string().optional().describe("Optional long-form evidence content."),
9624
+ contentType: z.string().optional().describe("Content format or MIME hint."),
9625
+ metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
9626
+ });
9370
9627
  var evidenceIdInput = (input) => compactRecord4({
9371
9628
  evidenceId: input.evidenceId,
9372
9629
  insightId: input.insightId,
@@ -9441,7 +9698,8 @@ var evidenceContracts = [
9441
9698
  functionName: "create",
9442
9699
  kind: "mutation",
9443
9700
  inputProjection: createEvidenceInput
9444
- }
9701
+ },
9702
+ args: createEvidenceArgs
9445
9703
  }),
9446
9704
  surfaceContract({
9447
9705
  name: "add_evidence",
@@ -9477,7 +9735,8 @@ var evidenceContracts = [
9477
9735
  context
9478
9736
  );
9479
9737
  }
9480
- }
9738
+ },
9739
+ args: addEvidenceArgs
9481
9740
  }),
9482
9741
  surfaceContract({
9483
9742
  name: "get_evidence",
@@ -9584,8 +9843,91 @@ var evidenceContracts = [
9584
9843
  }
9585
9844
  })
9586
9845
  ];
9587
-
9588
- // ../contracts/src/function-registry/questions.ts
9846
+ var jsonRecordSchema5 = z.record(z.unknown());
9847
+ var questionPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
9848
+ var kernelQuestionPrioritySchema = z.enum([
9849
+ "critical",
9850
+ "high",
9851
+ "medium",
9852
+ "low"
9853
+ ]);
9854
+ var questionTypeSchema = z.enum([
9855
+ "validation",
9856
+ "falsification",
9857
+ "assumption_probe",
9858
+ "prediction_test",
9859
+ "counterfactual",
9860
+ "discovery",
9861
+ "clarification",
9862
+ "comparison",
9863
+ "causal",
9864
+ "mechanism",
9865
+ "general"
9866
+ ]);
9867
+ var createQuestionArgs = z.object({
9868
+ text: z.string().describe("The question text."),
9869
+ question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
9870
+ topicId: z.string().optional().describe("Topic scope hint."),
9871
+ priority: questionPrioritySchema.optional().describe("Human-facing question priority."),
9872
+ linkedBeliefId: z.string().optional().describe("Belief this question tests."),
9873
+ linkedBeliefNodeId: z.string().optional().describe("Belief node this question tests."),
9874
+ metadata: jsonRecordSchema5.optional().describe("Optional metadata merged into the question record."),
9875
+ category: z.string().optional().describe("Question category."),
9876
+ source: z.string().optional().describe("Question source."),
9877
+ testType: z.enum(["validates", "invalidates", "clarifies"]).optional().describe("How this question tests its linked belief."),
9878
+ importance: z.number().optional().describe("Numeric importance score."),
9879
+ epistemicUnlock: z.string().optional().describe("What this question unlocks if answered."),
9880
+ sourceQuestionIds: z.array(z.string()).optional().describe("Question IDs this question derives from."),
9881
+ linkedWorktreeId: z.string().optional().describe("Worktree this question belongs to."),
9882
+ questionType: questionTypeSchema.optional().describe("Question type."),
9883
+ questionPriority: kernelQuestionPrioritySchema.optional().describe("Kernel-native question priority.")
9884
+ });
9885
+ var refineQuestionArgs = z.object({
9886
+ id: z.string().describe("The question to refine."),
9887
+ text: z.string().describe("Updated question text."),
9888
+ question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
9889
+ rationale: z.string().optional().describe("Why the question is refined."),
9890
+ category: z.string().optional().describe("Updated question category."),
9891
+ priority: questionPrioritySchema.optional().describe("Updated human-facing priority.")
9892
+ });
9893
+ var createAnswerArgs = z.object({
9894
+ questionNodeId: z.string().describe("The question node ID this answer responds to."),
9895
+ questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
9896
+ answerText: z.string().describe("The answer content."),
9897
+ topicId: z.string().optional().describe("Topic scope for the answer."),
9898
+ confidence: z.string().optional().describe("Answer confidence."),
9899
+ evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node IDs supporting the answer."),
9900
+ answerSource: z.string().optional().describe("How the answer was produced."),
9901
+ worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
9902
+ sprintId: z.string().optional().describe("Legacy sprint identifier.")
9903
+ });
9904
+ var answerQuestionArgs = z.object({
9905
+ id: z.string().describe("Canonical question ID."),
9906
+ topicId: z.string().describe("Topic scope for the answer."),
9907
+ text: z.string().describe("Answer text."),
9908
+ confidence: z.enum(["weak", "medium", "strong"]).optional().describe("Optional answer confidence."),
9909
+ evidenceIds: z.array(z.string()).optional().describe("Canonical evidence IDs supporting the answer."),
9910
+ rationale: z.string().optional().describe("Why this answer is credible."),
9911
+ questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
9912
+ questionNodeId: z.string().optional().describe("Question node ID alias accepted by the projection."),
9913
+ answerText: z.string().optional().describe("Canonical answer text alias accepted by newer callers."),
9914
+ evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node ID alias accepted by newer callers."),
9915
+ answerSource: z.string().optional().describe("How the answer was produced."),
9916
+ worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
9917
+ sprintId: z.string().optional().describe("Legacy sprint identifier.")
9918
+ });
9919
+ var missingQuestionsArgs = z.object({
9920
+ topicId: z.string().describe("Topic scope."),
9921
+ minConfidence: z.number().optional().describe("Minimum confidence threshold for missing-question checks."),
9922
+ status: z.string().optional().describe("Question status filter."),
9923
+ limit: z.number().optional().describe("Maximum questions to inspect.")
9924
+ });
9925
+ var falsificationQuestionsArgs = z.object({
9926
+ topicId: z.string().describe("Topic scope."),
9927
+ beliefIds: z.array(z.string()).optional().describe("Beliefs to generate falsification questions for."),
9928
+ status: z.string().optional().describe("Question status filter."),
9929
+ limit: z.number().optional().describe("Maximum questions to inspect.")
9930
+ });
9589
9931
  var questionNodeInput = (input) => compactRecord4({
9590
9932
  nodeId: input.nodeId ?? input.id ?? input.questionId,
9591
9933
  questionId: input.questionId
@@ -9632,7 +9974,8 @@ var questionsContracts = [
9632
9974
  functionName: "create",
9633
9975
  kind: "mutation",
9634
9976
  inputProjection: createQuestionInput
9635
- }
9977
+ },
9978
+ args: createQuestionArgs
9636
9979
  }),
9637
9980
  surfaceContract({
9638
9981
  name: "get_question",
@@ -9688,7 +10031,8 @@ var questionsContracts = [
9688
10031
  category: input.category,
9689
10032
  priority: input.priority
9690
10033
  })
9691
- }
10034
+ },
10035
+ args: refineQuestionArgs
9692
10036
  }),
9693
10037
  surfaceContract({
9694
10038
  name: "update_question_status",
@@ -9764,7 +10108,8 @@ var questionsContracts = [
9764
10108
  }),
9765
10109
  context
9766
10110
  )
9767
- }
10111
+ },
10112
+ args: createAnswerArgs
9768
10113
  }),
9769
10114
  surfaceContract({
9770
10115
  name: "answer_question",
@@ -9793,7 +10138,8 @@ var questionsContracts = [
9793
10138
  }),
9794
10139
  context
9795
10140
  )
9796
- }
10141
+ },
10142
+ args: answerQuestionArgs
9797
10143
  }),
9798
10144
  surfaceContract({
9799
10145
  name: "get_answer",
@@ -9825,7 +10171,8 @@ var questionsContracts = [
9825
10171
  functionName: "getByTopic",
9826
10172
  kind: "query",
9827
10173
  inputProjection: questionTopicInput
9828
- }
10174
+ },
10175
+ args: missingQuestionsArgs
9829
10176
  }),
9830
10177
  surfaceContract({
9831
10178
  name: "get_high_priority_questions",
@@ -9860,11 +10207,22 @@ var questionsContracts = [
9860
10207
  functionName: "getByTopic",
9861
10208
  kind: "query",
9862
10209
  inputProjection: questionTopicInput
9863
- }
10210
+ },
10211
+ args: falsificationQuestionsArgs
9864
10212
  })
9865
10213
  ];
9866
-
9867
- // ../contracts/src/function-registry/topics.ts
10214
+ var updateTopicArgs = z.object({
10215
+ id: z.string().describe("Topic ID."),
10216
+ topicId: z.string().optional().describe("Topic ID alias."),
10217
+ name: z.string().optional().describe("Topic name."),
10218
+ description: z.string().optional().describe("Topic description."),
10219
+ type: z.string().optional().describe("Topic type."),
10220
+ status: z.string().optional().describe("Topic status."),
10221
+ visibility: z.string().optional().describe("Topic visibility."),
10222
+ ontologyId: z.string().optional().describe("Ontology to bind."),
10223
+ clearOntologyId: z.boolean().optional().describe("Whether to clear the ontology binding."),
10224
+ metadata: z.record(z.unknown()).optional().describe("Topic metadata.")
10225
+ });
9868
10226
  var topicIdInput = (input) => compactRecord4({
9869
10227
  id: input.id ?? input.topicId
9870
10228
  });
@@ -9945,7 +10303,8 @@ var topicsContracts = [
9945
10303
  functionName: "update",
9946
10304
  kind: "mutation",
9947
10305
  inputProjection: updateTopicInput
9948
- }
10306
+ },
10307
+ args: updateTopicArgs
9949
10308
  }),
9950
10309
  surfaceContract({
9951
10310
  name: "get_topic_tree",
@@ -9964,8 +10323,27 @@ var topicsContracts = [
9964
10323
  }
9965
10324
  })
9966
10325
  ];
9967
-
9968
- // ../contracts/src/function-registry/lenses.ts
10326
+ var lensPerspectiveSchema = z.enum([
10327
+ "investigation",
10328
+ "monitoring",
10329
+ "analysis",
10330
+ "comparison",
10331
+ "taxonomy"
10332
+ ]);
10333
+ var jsonRecordSchema6 = z.record(z.unknown());
10334
+ var createLensArgs = z.object({
10335
+ name: z.string().describe("Lens name."),
10336
+ workspaceId: z.string().optional().describe("Workspace scope for the lens."),
10337
+ topicId: z.string().optional().describe("Originating topic scope."),
10338
+ description: z.string().optional().describe("What this lens investigates or monitors."),
10339
+ perspectiveType: lensPerspectiveSchema.describe("Perspective type."),
10340
+ promptTemplates: z.array(jsonRecordSchema6).optional().describe("Prompt templates used through this lens."),
10341
+ workflowTemplates: z.array(jsonRecordSchema6).optional().describe("Guided workflow templates."),
10342
+ taskTemplates: z.array(jsonRecordSchema6).optional().describe("Default task templates."),
10343
+ questionTemplates: z.array(jsonRecordSchema6).optional().describe("Default question templates."),
10344
+ filterCriteria: jsonRecordSchema6.optional().describe("Belief/evidence filtering criteria."),
10345
+ metadata: jsonRecordSchema6.optional().describe("Additional lens metadata.")
10346
+ });
9969
10347
  var createLensInput = (input, context) => compactRecord4({
9970
10348
  name: input.name,
9971
10349
  description: input.description,
@@ -10002,7 +10380,8 @@ var lensesContracts = [
10002
10380
  functionName: "create",
10003
10381
  kind: "mutation",
10004
10382
  inputProjection: createLensInput
10005
- }
10383
+ },
10384
+ args: createLensArgs
10006
10385
  }),
10007
10386
  surfaceContract({
10008
10387
  name: "list_lenses",
@@ -10064,8 +10443,18 @@ var lensesContracts = [
10064
10443
  }
10065
10444
  })
10066
10445
  ];
10067
-
10068
- // ../contracts/src/function-registry/ontologies.ts
10446
+ var updateOntologyArgs = z.object({
10447
+ id: z.string().describe("Ontology definition ID."),
10448
+ ontologyId: z.string().optional().describe("Ontology ID alias."),
10449
+ name: z.string().optional().describe("Ontology display name."),
10450
+ description: z.string().optional().describe("Ontology description."),
10451
+ status: z.string().optional().describe("Ontology lifecycle status.")
10452
+ });
10453
+ var ontologyVersionLifecycleArgs = z.object({
10454
+ id: z.string().describe("Ontology version ID."),
10455
+ versionId: z.string().optional().describe("Ontology version ID alias."),
10456
+ ontologyId: z.string().optional().describe("Ontology definition ID.")
10457
+ });
10069
10458
  var ontologyIdInput = (input) => compactRecord4({
10070
10459
  id: input.id ?? input.ontologyId
10071
10460
  });
@@ -10144,11 +10533,11 @@ var ontologiesContracts = [
10144
10533
  id: input.id ?? input.ontologyId,
10145
10534
  name: input.name,
10146
10535
  description: input.description,
10147
- parentOntologyId: input.parentOntologyId,
10148
10536
  status: input.status,
10149
10537
  actorId: input.actorId
10150
10538
  })
10151
- }
10539
+ },
10540
+ args: updateOntologyArgs
10152
10541
  }),
10153
10542
  surfaceContract({
10154
10543
  name: "archive_ontology",
@@ -10231,7 +10620,8 @@ var ontologiesContracts = [
10231
10620
  functionName: "publishOntologyVersion",
10232
10621
  kind: "mutation",
10233
10622
  inputProjection: ontologyVersionIdInput
10234
- }
10623
+ },
10624
+ args: ontologyVersionLifecycleArgs
10235
10625
  }),
10236
10626
  surfaceContract({
10237
10627
  name: "deprecate_ontology_version",
@@ -10247,7 +10637,8 @@ var ontologiesContracts = [
10247
10637
  functionName: "deprecateOntologyVersion",
10248
10638
  kind: "mutation",
10249
10639
  inputProjection: ontologyVersionIdInput
10250
- }
10640
+ },
10641
+ args: ontologyVersionLifecycleArgs
10251
10642
  }),
10252
10643
  surfaceContract({
10253
10644
  name: "resolve_effective_ontology",
@@ -10266,8 +10657,76 @@ var ontologiesContracts = [
10266
10657
  }
10267
10658
  })
10268
10659
  ];
10269
-
10270
- // ../contracts/src/function-registry/worktrees.ts
10660
+ var autoFixPolicyInputSchema = z.object({
10661
+ enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
10662
+ mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
10663
+ maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
10664
+ reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
10665
+ maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
10666
+ permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
10667
+ requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
10668
+ escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
10669
+ }).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
10670
+ var worktreeKeyQuestionInputSchema = z.object({
10671
+ question: z.string().describe("Question the worktree must resolve."),
10672
+ status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
10673
+ answer: z.string().optional().describe("Captured answer when the key question is resolved."),
10674
+ answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
10675
+ linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
10676
+ }).passthrough().describe("Question contract embedded in the worktree plan.");
10677
+ var worktreeEvidenceSignalInputSchema = z.object({
10678
+ signal: z.string().describe("Evidence signal the worktree should collect."),
10679
+ collected: z.boolean().optional().describe("Whether the signal has already been collected."),
10680
+ progress: z.string().optional().describe("Collection progress note for the signal."),
10681
+ notes: z.string().optional().describe("Additional evidence collection notes.")
10682
+ }).passthrough().describe("Evidence signal embedded in the worktree plan.");
10683
+ var worktreeDecisionGateInputSchema = z.object({
10684
+ goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
10685
+ noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
10686
+ verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
10687
+ verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
10688
+ decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
10689
+ decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
10690
+ }).passthrough().describe("Decision gate contract for worktree activation or exit.");
10691
+ var addWorktreeArgs = z.object({
10692
+ title: z.string().optional().describe("Human-readable worktree name or objective."),
10693
+ name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
10694
+ topicId: z.string().describe("Primary topic scope for the worktree."),
10695
+ projectId: z.string().optional().describe("Legacy topicId alias."),
10696
+ branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
10697
+ objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
10698
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
10699
+ rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
10700
+ worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
10701
+ gate: z.string().optional().describe("Exit gate for this worktree."),
10702
+ startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
10703
+ endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
10704
+ durationWeeks: z.number().optional().describe("Planned duration in weeks."),
10705
+ confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
10706
+ beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
10707
+ beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
10708
+ beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
10709
+ targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
10710
+ targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
10711
+ keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
10712
+ evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
10713
+ decisionGate: worktreeDecisionGateInputSchema.optional(),
10714
+ goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
10715
+ noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
10716
+ proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
10717
+ autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
10718
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
10719
+ domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
10720
+ campaign: z.number().optional().describe("Top-level pipeline campaign number."),
10721
+ lane: z.string().optional().describe("Campaign lane for the worktree."),
10722
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
10723
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
10724
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
10725
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
10726
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
10727
+ lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
10728
+ lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
10729
+ });
10271
10730
  var worktreeIdInput = (input) => compactRecord4({
10272
10731
  worktreeId: input.worktreeId ?? input.id
10273
10732
  });
@@ -10300,6 +10759,50 @@ var worktreeMetadataInput = (input) => compactRecord4({
10300
10759
  autoFixPolicy: input.autoFixPolicy,
10301
10760
  lastReconciledAt: input.lastReconciledAt
10302
10761
  });
10762
+ var worktreeMetadataArgs = z.object({
10763
+ worktreeId: z.string().describe("The worktree to update."),
10764
+ id: z.string().optional().describe("Worktree ID alias."),
10765
+ topicId: z.string().optional().describe("Primary topic scope."),
10766
+ additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
10767
+ status: z.string().optional().describe("Worktree lifecycle status."),
10768
+ campaign: z.number().optional().describe("Top-level pipeline campaign."),
10769
+ lane: z.string().optional().describe("Campaign lane."),
10770
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
10771
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
10772
+ gate: z.string().optional().describe("Exit gate for this worktree."),
10773
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
10774
+ objective: z.string().optional().describe("Reasoning objective for the worktree."),
10775
+ rationale: z.string().optional().describe("Why this worktree is sequenced here."),
10776
+ proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
10777
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
10778
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
10779
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
10780
+ lensId: z.string().optional().describe("Lens that scopes this worktree."),
10781
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
10782
+ lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
10783
+ });
10784
+ var pushArgs = worktreeMetadataArgs.extend({
10785
+ targetContext: z.string().describe("Where to push merged findings."),
10786
+ beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
10787
+ });
10788
+ var openPullRequestArgs = worktreeMetadataArgs.extend({
10789
+ reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
10790
+ summary: z.string().describe("Summary of findings and why they are ready for review.")
10791
+ });
10792
+ var mergeKeyFindingsInput = (input) => {
10793
+ if (Array.isArray(input.keyFindings)) {
10794
+ return input.keyFindings;
10795
+ }
10796
+ if (Array.isArray(input.outcomes)) {
10797
+ const findings = input.outcomes.filter(
10798
+ (outcome) => typeof outcome === "string" && outcome.trim().length > 0
10799
+ );
10800
+ if (findings.length > 0) {
10801
+ return findings;
10802
+ }
10803
+ }
10804
+ return [input.summary ?? "Merged worktree"];
10805
+ };
10303
10806
  var listAllWorktreesInput = (input) => compactRecord4({
10304
10807
  status: input.status,
10305
10808
  lane: input.lane,
@@ -10307,6 +10810,16 @@ var listAllWorktreesInput = (input) => compactRecord4({
10307
10810
  limit: input.limit
10308
10811
  });
10309
10812
  var worktreesContracts = [
10813
+ surfaceContract({
10814
+ name: "begin_build_session",
10815
+ kind: "mutation",
10816
+ domain: "worktrees",
10817
+ surfaceClass: "platform_internal",
10818
+ path: "/mcp/build-session/begin",
10819
+ sdkNamespace: "worktrees",
10820
+ sdkMethod: "beginBuildSession",
10821
+ summary: "Begin a coding build session for a worktree."
10822
+ }),
10310
10823
  surfaceContract({
10311
10824
  name: "add_worktree",
10312
10825
  kind: "mutation",
@@ -10323,13 +10836,12 @@ var worktreesContracts = [
10323
10836
  inputProjection: (input, context) => withCreatedBy(
10324
10837
  compactRecord4({
10325
10838
  name: input.name ?? input.title,
10326
- topicId: input.topicId,
10839
+ topicId: input.topicId ?? input.projectId,
10327
10840
  worktreeType: input.worktreeType,
10328
10841
  objective: input.objective,
10329
10842
  gate: input.gate,
10330
10843
  hypothesis: input.hypothesis,
10331
10844
  rationale: input.rationale,
10332
- signal: input.signal,
10333
10845
  startDate: input.startDate,
10334
10846
  endDate: input.endDate,
10335
10847
  durationWeeks: input.durationWeeks,
@@ -10355,12 +10867,12 @@ var worktreesContracts = [
10355
10867
  staffingHint: input.staffingHint,
10356
10868
  domainPackId: input.domainPackId,
10357
10869
  lensId: input.lensId,
10358
- linkedQuestionId: input.linkedQuestionId,
10359
10870
  lastReconciledAt: input.lastReconciledAt
10360
10871
  }),
10361
10872
  context
10362
10873
  )
10363
- }
10874
+ },
10875
+ args: addWorktreeArgs
10364
10876
  }),
10365
10877
  surfaceContract({
10366
10878
  name: "activate_worktree",
@@ -10472,7 +10984,8 @@ var worktreesContracts = [
10472
10984
  functionName: "updateMetadata",
10473
10985
  kind: "mutation",
10474
10986
  inputProjection: worktreeMetadataInput
10475
- }
10987
+ },
10988
+ args: worktreeMetadataArgs
10476
10989
  }),
10477
10990
  surfaceContract({
10478
10991
  name: "merge",
@@ -10490,9 +11003,7 @@ var worktreesContracts = [
10490
11003
  inputProjection: (input, context) => withUserId(
10491
11004
  {
10492
11005
  ...worktreeIdInput(input),
10493
- keyFindings: input.keyFindings ?? [
10494
- input.summary ?? "Merged worktree"
10495
- ],
11006
+ keyFindings: mergeKeyFindingsInput(input),
10496
11007
  decisionsReached: input.decisionsReached ?? [],
10497
11008
  nextSteps: input.nextSteps ?? []
10498
11009
  },
@@ -10514,7 +11025,8 @@ var worktreesContracts = [
10514
11025
  functionName: "updateMetadata",
10515
11026
  kind: "mutation",
10516
11027
  inputProjection: worktreeMetadataInput
10517
- }
11028
+ },
11029
+ args: pushArgs
10518
11030
  }),
10519
11031
  surfaceContract({
10520
11032
  name: "open_pull_request",
@@ -10530,7 +11042,8 @@ var worktreesContracts = [
10530
11042
  functionName: "updateMetadata",
10531
11043
  kind: "mutation",
10532
11044
  inputProjection: worktreeMetadataInput
10533
- }
11045
+ },
11046
+ args: openPullRequestArgs
10534
11047
  })
10535
11048
  ];
10536
11049
 
@@ -10634,6 +11147,15 @@ var createEdgeArgs = z.object({
10634
11147
  topicId: z.string().optional(),
10635
11148
  trustedBypassAccessCheck: z.boolean().optional()
10636
11149
  });
11150
+ var queryLineageArgs = z.object({
11151
+ nodeId: z.string().describe("Starting node to trace from."),
11152
+ startNode: z.string().optional().describe("Starting node alias accepted by traversal callers."),
11153
+ depth: z.number().optional().describe("Traversal depth alias."),
11154
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11155
+ mode: z.string().optional().describe("Traversal mode."),
11156
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
11157
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
11158
+ });
10637
11159
  function graphRefNodeId(ref) {
10638
11160
  if (ref.kind === "epistemic_node") {
10639
11161
  return ref.nodeId;
@@ -10704,11 +11226,59 @@ var edgesContracts = [
10704
11226
  minLayer: input.minLayer,
10705
11227
  maxLayer: input.maxLayer
10706
11228
  })
10707
- }
11229
+ },
11230
+ args: queryLineageArgs
10708
11231
  })
10709
11232
  ];
10710
-
10711
- // ../contracts/src/function-registry/graph.ts
11233
+ var traversalLayerSchema = z.enum([
11234
+ "L4",
11235
+ "L3",
11236
+ "L2",
11237
+ "L1",
11238
+ "ontological",
11239
+ "organizational"
11240
+ ]);
11241
+ var traversalModeSchema = z.enum(["low", "medium", "high", "extra_high"]);
11242
+ var lineageAliasArgs = z.object({
11243
+ nodeId: z.string().optional().describe("Starting node to traverse from."),
11244
+ startNode: z.string().optional().describe("Starting node alias for traversal callers."),
11245
+ entityId: z.string().optional().describe("Entity identifier alias for impact tracing."),
11246
+ depth: z.number().optional().describe("Traversal depth alias."),
11247
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11248
+ mode: traversalModeSchema.optional().describe("Traversal mode."),
11249
+ minLayer: traversalLayerSchema.optional().describe("Minimum epistemic layer to include."),
11250
+ maxLayer: traversalLayerSchema.optional().describe("Maximum epistemic layer to include.")
11251
+ });
11252
+ var lineageArgs = lineageAliasArgs.extend({
11253
+ nodeId: z.string().describe("Starting node to traverse from.")
11254
+ });
11255
+ var traverseGraphArgs = lineageAliasArgs.extend({
11256
+ startNode: z.string().describe("Node to start traversal from."),
11257
+ direction: z.enum(["up", "down", "both"]).optional().describe("Traversal direction.")
11258
+ });
11259
+ var graphNeighborhoodArgs = z.object({
11260
+ globalId: z.string().optional().describe("Single root global ID."),
11261
+ globalIds: z.array(z.string()).optional().describe("Root global IDs for the neighborhood."),
11262
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11263
+ topicId: z.string().optional().describe("Topic scope for edge lookup."),
11264
+ limit: z.number().optional().describe("Maximum edges to return.")
11265
+ });
11266
+ var flagContradictionArgs = z.object({
11267
+ beliefA: z.string().describe("First belief in tension."),
11268
+ beliefB: z.string().describe("Second belief in tension."),
11269
+ topicId: z.string().optional().describe("Topic scope for the contradiction."),
11270
+ description: z.string().optional().describe("Human-readable contradiction."),
11271
+ severity: z.enum(["critical", "high", "medium", "low"]).optional().describe("Contradiction severity."),
11272
+ defeatType: z.string().optional().describe("Defeat type annotation."),
11273
+ supportingInsightIds: z.array(z.string()).optional().describe("Evidence supporting the primary belief."),
11274
+ contradictingInsightIds: z.array(z.string()).optional().describe("Evidence or beliefs contradicting the primary belief.")
11275
+ });
11276
+ var discoverEntityConnectionsArgs = lineageAliasArgs.extend({
11277
+ nodeId: z.string().describe("Epistemic node ID to find entity connections for."),
11278
+ topicId: z.string().optional().describe("Topic scope override."),
11279
+ minScore: z.number().optional().describe("Minimum match score."),
11280
+ limit: z.number().optional().describe("Maximum candidates to return.")
11281
+ });
10712
11282
  var contradictionSeverity = (value) => {
10713
11283
  switch (value) {
10714
11284
  case "critical":
@@ -10763,7 +11333,8 @@ var graphContracts = [
10763
11333
  functionName: "getLineage",
10764
11334
  kind: "query",
10765
11335
  inputProjection: lineageInput
10766
- }
11336
+ },
11337
+ args: traverseGraphArgs
10767
11338
  }),
10768
11339
  surfaceContract({
10769
11340
  name: "get_graph_neighborhood",
@@ -10779,7 +11350,8 @@ var graphContracts = [
10779
11350
  functionName: "getByTopic",
10780
11351
  kind: "query",
10781
11352
  inputProjection: topicEdgesInput
10782
- }
11353
+ },
11354
+ args: graphNeighborhoodArgs
10783
11355
  }),
10784
11356
  surfaceContract({
10785
11357
  name: "get_graph_structure_analysis",
@@ -10828,7 +11400,8 @@ var graphContracts = [
10828
11400
  functionName: "create",
10829
11401
  kind: "mutation",
10830
11402
  inputProjection: flagContradictionInput
10831
- }
11403
+ },
11404
+ args: flagContradictionArgs
10832
11405
  }),
10833
11406
  surfaceContract({
10834
11407
  name: "detect_confirmation_bias",
@@ -10919,7 +11492,8 @@ var graphContracts = [
10919
11492
  functionName: "getLineage",
10920
11493
  kind: "query",
10921
11494
  inputProjection: lineageInput
10922
- }
11495
+ },
11496
+ args: discoverEntityConnectionsArgs
10923
11497
  }),
10924
11498
  surfaceContract({
10925
11499
  name: "trigger_belief_review",
@@ -10950,7 +11524,8 @@ var graphContracts = [
10950
11524
  functionName: "getLineage",
10951
11525
  kind: "query",
10952
11526
  inputProjection: lineageInput
10953
- }
11527
+ },
11528
+ args: lineageArgs
10954
11529
  })
10955
11530
  ];
10956
11531
 
@@ -11002,8 +11577,16 @@ var contractsContracts = [
11002
11577
  }
11003
11578
  })
11004
11579
  ];
11005
-
11006
- // ../contracts/src/function-registry/judgments.ts
11580
+ var auditTrailArgs = z.object({
11581
+ nodeId: z.string().describe("The node to audit."),
11582
+ id: z.string().optional().describe("Node ID alias."),
11583
+ limit: z.number().optional().describe("Maximum entries to return."),
11584
+ depth: z.number().optional().describe("Traversal depth alias."),
11585
+ maxDepth: z.number().optional().describe("Maximum lineage depth."),
11586
+ mode: z.string().optional().describe("Traversal mode."),
11587
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
11588
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
11589
+ });
11007
11590
  var judgmentsContracts = [
11008
11591
  surfaceContract({
11009
11592
  name: "record_judgment",
@@ -11058,7 +11641,8 @@ var judgmentsContracts = [
11058
11641
  minLayer: input.minLayer,
11059
11642
  maxLayer: input.maxLayer
11060
11643
  })
11061
- }
11644
+ },
11645
+ args: auditTrailArgs
11062
11646
  })
11063
11647
  ];
11064
11648
 
@@ -11226,8 +11810,13 @@ var coordinationContracts = [
11226
11810
  }
11227
11811
  })
11228
11812
  ];
11229
-
11230
- // ../contracts/src/function-registry/pipeline.ts
11813
+ var pipelineSnapshotArgs = z.object({
11814
+ topicId: z.string().describe("Topic scope ID."),
11815
+ status: z.string().optional().describe("Worktree status filter."),
11816
+ lane: z.string().optional().describe("Campaign lane filter."),
11817
+ campaign: z.number().optional().describe("Campaign number filter."),
11818
+ limit: z.number().optional().describe("Maximum worktrees to inspect.")
11819
+ });
11231
11820
  var pipelineContracts = [
11232
11821
  surfaceContract({
11233
11822
  name: "pipeline_snapshot",
@@ -11248,7 +11837,8 @@ var pipelineContracts = [
11248
11837
  campaign: input.campaign,
11249
11838
  limit: input.limit
11250
11839
  })
11251
- }
11840
+ },
11841
+ args: pipelineSnapshotArgs
11252
11842
  }),
11253
11843
  surfaceContract({
11254
11844
  name: "seed_belief_lattice",
@@ -11300,7 +11890,31 @@ var recordScopeLearningArgs = z.object({
11300
11890
  rationale: z.string().optional().describe("Why this learning should enter the reasoning graph"),
11301
11891
  createQuestionText: z.string().optional().describe("Optional follow-up question text"),
11302
11892
  createBeliefText: z.string().optional().describe("Optional new belief text"),
11303
- beliefType: z.string().optional().describe("Optional belief type for createBeliefText")
11893
+ beliefType: z.string().optional().describe("Optional belief type for createBeliefText"),
11894
+ text: z.string().optional().describe("Canonical learning text alias."),
11895
+ content: z.string().optional().describe("Canonical learning content alias."),
11896
+ kind: z.string().optional().describe("Evidence kind to store."),
11897
+ sourceType: z.string().optional().describe("Evidence source type."),
11898
+ externalSourceType: z.string().optional().describe("External source type alias."),
11899
+ metadata: z.record(z.unknown()).optional().describe("Learning metadata.")
11900
+ });
11901
+ var codeContextArgs = z.object({
11902
+ topicId: z.string().optional().describe("Topic scope."),
11903
+ filePath: z.string().optional().describe("File path anchor."),
11904
+ includeFailures: z.boolean().optional().describe("Whether to include failed attempts."),
11905
+ limit: z.number().optional().describe("Maximum records to return."),
11906
+ status: z.string().optional().describe("Evidence status filter.")
11907
+ });
11908
+ var recordAttemptArgs = z.object({
11909
+ topicId: z.string().optional().describe("Topic scope."),
11910
+ description: z.string().describe("Attempt description."),
11911
+ errorMessage: z.string().optional().describe("Failure or error message."),
11912
+ filePaths: z.array(z.string()).optional().describe("Files involved in the attempt."),
11913
+ filePath: z.string().optional().describe("Single file path alias."),
11914
+ linkedBeliefId: z.string().optional().describe("Linked belief ID."),
11915
+ metadata: z.record(z.unknown()).optional().describe("Attempt metadata."),
11916
+ rationale: z.string().optional().describe("Why this attempt should be recorded."),
11917
+ title: z.string().optional().describe("Attempt evidence title.")
11304
11918
  });
11305
11919
  var learningInput = (input, context) => {
11306
11920
  const sourceKind = input.sourceKind ?? input.externalSourceType;
@@ -11417,7 +12031,8 @@ var codingContracts = [
11417
12031
  status: input.status,
11418
12032
  userId: input.userId
11419
12033
  })
11420
- }
12034
+ },
12035
+ args: codeContextArgs
11421
12036
  }),
11422
12037
  surfaceContract({
11423
12038
  name: "get_change_history",
@@ -11454,7 +12069,8 @@ var codingContracts = [
11454
12069
  functionName: "create",
11455
12070
  kind: "mutation",
11456
12071
  inputProjection: attemptInput
11457
- }
12072
+ },
12073
+ args: recordAttemptArgs
11458
12074
  }),
11459
12075
  surfaceContract({
11460
12076
  name: "get_failure_log",
@@ -11529,6 +12145,604 @@ new Map(
11529
12145
  ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
11530
12146
  );
11531
12147
 
12148
+ // ../contracts/src/tenant-bootstrap-seed.contract.ts
12149
+ function isCopyableSeedRequirement(entry) {
12150
+ 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;
12151
+ }
12152
+ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
12153
+ {
12154
+ component: "kernel",
12155
+ table: "agentMessages",
12156
+ prepopulation: "runtime_data",
12157
+ copyMode: "none",
12158
+ description: "Agent coordination messages are session data, not template data."
12159
+ },
12160
+ {
12161
+ component: "kernel",
12162
+ table: "agentSessions",
12163
+ prepopulation: "runtime_data",
12164
+ copyMode: "none",
12165
+ description: "Agent coordination sessions are created by active clients."
12166
+ },
12167
+ {
12168
+ component: "kernel",
12169
+ table: "autofixJobs",
12170
+ prepopulation: "runtime_queue",
12171
+ copyMode: "none",
12172
+ description: "Autofix work items are runtime queue rows."
12173
+ },
12174
+ {
12175
+ component: "kernel",
12176
+ table: "backgroundJobRuns",
12177
+ prepopulation: "runtime_log",
12178
+ copyMode: "none",
12179
+ description: "Background job executions are runtime logs."
12180
+ },
12181
+ {
12182
+ component: "kernel",
12183
+ table: "backgroundJobSettings",
12184
+ prepopulation: "required_template",
12185
+ copyMode: "template_global",
12186
+ scope: "global",
12187
+ uniqueKey: ["jobKey"],
12188
+ description: "Default job enablement settings must come from the K template."
12189
+ },
12190
+ {
12191
+ component: "kernel",
12192
+ table: "beliefConfidence",
12193
+ prepopulation: "runtime_data",
12194
+ copyMode: "none",
12195
+ description: "Belief confidence rows are created with tenant graph facts."
12196
+ },
12197
+ {
12198
+ component: "kernel",
12199
+ table: "beliefEvidenceLinks",
12200
+ prepopulation: "runtime_data",
12201
+ copyMode: "none",
12202
+ description: "Belief-to-evidence links are tenant graph data."
12203
+ },
12204
+ {
12205
+ component: "kernel",
12206
+ table: "beliefHistory",
12207
+ prepopulation: "runtime_data",
12208
+ copyMode: "none",
12209
+ description: "Belief history is append-only tenant graph data."
12210
+ },
12211
+ {
12212
+ component: "kernel",
12213
+ table: "beliefScenarios",
12214
+ prepopulation: "runtime_data",
12215
+ copyMode: "none",
12216
+ description: "Scenario rows are tenant-authored reasoning data."
12217
+ },
12218
+ {
12219
+ component: "kernel",
12220
+ table: "beliefVotes",
12221
+ prepopulation: "runtime_data",
12222
+ copyMode: "none",
12223
+ description: "Decision belief votes are tenant-authored data."
12224
+ },
12225
+ {
12226
+ component: "kernel",
12227
+ table: "calibrationScores",
12228
+ prepopulation: "runtime_derived",
12229
+ copyMode: "none",
12230
+ description: "Calibration scores are computed from tenant outcomes."
12231
+ },
12232
+ {
12233
+ component: "kernel",
12234
+ table: "contractEvaluations",
12235
+ prepopulation: "runtime_log",
12236
+ copyMode: "none",
12237
+ description: "Contract evaluation rows are runtime computation logs."
12238
+ },
12239
+ {
12240
+ component: "kernel",
12241
+ table: "contradictions",
12242
+ prepopulation: "runtime_data",
12243
+ copyMode: "none",
12244
+ description: "Contradictions are tenant graph facts."
12245
+ },
12246
+ {
12247
+ component: "kernel",
12248
+ table: "crossProjectConnections",
12249
+ prepopulation: "runtime_data",
12250
+ copyMode: "none",
12251
+ description: "Cross-topic connections are tenant graph facts."
12252
+ },
12253
+ {
12254
+ component: "kernel",
12255
+ table: "decisionComputedSummaries",
12256
+ prepopulation: "runtime_derived",
12257
+ copyMode: "none",
12258
+ description: "Decision summaries are derived tenant outputs."
12259
+ },
12260
+ {
12261
+ component: "kernel",
12262
+ table: "decisionEvents",
12263
+ prepopulation: "runtime_data",
12264
+ copyMode: "none",
12265
+ description: "Decision events are lifecycle data."
12266
+ },
12267
+ {
12268
+ component: "kernel",
12269
+ table: "decisionParticipants",
12270
+ prepopulation: "runtime_data",
12271
+ copyMode: "none",
12272
+ description: "Decision participants are tenant-selected actors."
12273
+ },
12274
+ {
12275
+ component: "kernel",
12276
+ table: "decisionRiskLedger",
12277
+ prepopulation: "runtime_data",
12278
+ copyMode: "none",
12279
+ description: "Decision risk rows are tenant decision data."
12280
+ },
12281
+ {
12282
+ component: "kernel",
12283
+ table: "decisionSnapshots",
12284
+ prepopulation: "runtime_derived",
12285
+ copyMode: "none",
12286
+ description: "Decision snapshots are derived from tenant state."
12287
+ },
12288
+ {
12289
+ component: "kernel",
12290
+ table: "deliberationContributions",
12291
+ prepopulation: "runtime_data",
12292
+ copyMode: "none",
12293
+ description: "Deliberation contributions are tenant-authored data."
12294
+ },
12295
+ {
12296
+ component: "kernel",
12297
+ table: "deliberationSessions",
12298
+ prepopulation: "runtime_data",
12299
+ copyMode: "none",
12300
+ description: "Deliberation sessions are created by tenant workflows."
12301
+ },
12302
+ {
12303
+ component: "kernel",
12304
+ table: "epistemicAudit",
12305
+ prepopulation: "runtime_log",
12306
+ copyMode: "none",
12307
+ description: "Epistemic audit rows are append-only runtime audit data."
12308
+ },
12309
+ {
12310
+ component: "kernel",
12311
+ table: "epistemicContracts",
12312
+ prepopulation: "runtime_data",
12313
+ copyMode: "none",
12314
+ description: "Epistemic contracts are tenant-authored governance data."
12315
+ },
12316
+ {
12317
+ component: "kernel",
12318
+ table: "epistemicEdges",
12319
+ prepopulation: "runtime_data",
12320
+ copyMode: "none",
12321
+ description: "Edges are tenant reasoning graph data."
12322
+ },
12323
+ {
12324
+ component: "kernel",
12325
+ table: "epistemicNodeEmbeddings",
12326
+ prepopulation: "runtime_derived",
12327
+ copyMode: "none",
12328
+ description: "Embeddings are derived from tenant graph nodes."
12329
+ },
12330
+ {
12331
+ component: "kernel",
12332
+ table: "epistemicNodes",
12333
+ prepopulation: "runtime_data",
12334
+ copyMode: "none",
12335
+ description: "Nodes are tenant reasoning graph data."
12336
+ },
12337
+ {
12338
+ component: "kernel",
12339
+ table: "graphAnalysisCache",
12340
+ prepopulation: "runtime_derived",
12341
+ copyMode: "none",
12342
+ description: "Graph analysis cache rows are derived from tenant graph state."
12343
+ },
12344
+ {
12345
+ component: "kernel",
12346
+ table: "graphAnalysisResults",
12347
+ prepopulation: "runtime_derived",
12348
+ copyMode: "none",
12349
+ description: "Graph analysis result rows are derived tenant outputs."
12350
+ },
12351
+ {
12352
+ component: "kernel",
12353
+ table: "graphSuggestions",
12354
+ prepopulation: "runtime_derived",
12355
+ copyMode: "none",
12356
+ description: "Graph suggestions are derived recommendations."
12357
+ },
12358
+ {
12359
+ component: "kernel",
12360
+ table: "harnessReplays",
12361
+ prepopulation: "runtime_log",
12362
+ copyMode: "none",
12363
+ description: "Harness replay rows are runtime verification logs."
12364
+ },
12365
+ {
12366
+ component: "kernel",
12367
+ table: "harnessRuns",
12368
+ prepopulation: "runtime_log",
12369
+ copyMode: "none",
12370
+ description: "Harness run rows are runtime verification logs."
12371
+ },
12372
+ {
12373
+ component: "kernel",
12374
+ table: "idempotencyTokens",
12375
+ prepopulation: "runtime_log",
12376
+ copyMode: "none",
12377
+ description: "Idempotency tokens are request-scoped runtime guards."
12378
+ },
12379
+ {
12380
+ component: "kernel",
12381
+ table: "lenses",
12382
+ prepopulation: "optional_template",
12383
+ copyMode: "none",
12384
+ description: "Reusable lens templates may live in K templates, but workspace-specific copies are not required for core SDK boot."
12385
+ },
12386
+ {
12387
+ component: "kernel",
12388
+ table: "lensTopicBindings",
12389
+ prepopulation: "runtime_data",
12390
+ copyMode: "none",
12391
+ description: "Lens bindings attach runtime topics to runtime/workspace lenses."
12392
+ },
12393
+ {
12394
+ component: "kernel",
12395
+ table: "neo4jSyncQueue",
12396
+ prepopulation: "runtime_queue",
12397
+ copyMode: "none",
12398
+ description: "Neo4j sync queue rows are runtime work items."
12399
+ },
12400
+ {
12401
+ component: "kernel",
12402
+ table: "ontologyDefinitions",
12403
+ prepopulation: "required_template",
12404
+ copyMode: "template_global",
12405
+ scope: "global",
12406
+ uniqueKey: ["ontologyKey"],
12407
+ description: "Platform ontology definitions power taxonomy reads and effective ontology resolution."
12408
+ },
12409
+ {
12410
+ component: "kernel",
12411
+ table: "ontologyVersions",
12412
+ prepopulation: "required_template",
12413
+ copyMode: "template_reference_remap",
12414
+ scope: "global",
12415
+ uniqueKey: ["ontologyKey", "version"],
12416
+ dependsOn: ["ontologyDefinitions"],
12417
+ description: "Ontology versions must be copied with ontologyDefinition ID remapping."
12418
+ },
12419
+ {
12420
+ component: "kernel",
12421
+ table: "platformAgentRunPolicyDecisions",
12422
+ prepopulation: "runtime_log",
12423
+ copyMode: "none",
12424
+ description: "Agent-run policy decisions are audit logs."
12425
+ },
12426
+ {
12427
+ component: "kernel",
12428
+ table: "platformAgentRunPromptResolutions",
12429
+ prepopulation: "runtime_log",
12430
+ copyMode: "none",
12431
+ description: "Agent-run prompt resolution rows are runtime logs."
12432
+ },
12433
+ {
12434
+ component: "kernel",
12435
+ table: "platformAgentRuns",
12436
+ prepopulation: "runtime_log",
12437
+ copyMode: "none",
12438
+ description: "Agent runs are runtime execution records."
12439
+ },
12440
+ {
12441
+ component: "kernel",
12442
+ table: "platformAgentRunToolCalls",
12443
+ prepopulation: "runtime_log",
12444
+ copyMode: "none",
12445
+ description: "Agent-run tool calls are runtime execution records."
12446
+ },
12447
+ {
12448
+ component: "kernel",
12449
+ table: "platformHarnessShadowAudit",
12450
+ prepopulation: "runtime_log",
12451
+ copyMode: "none",
12452
+ description: "Harness shadow audit rows are runtime audit records."
12453
+ },
12454
+ {
12455
+ component: "kernel",
12456
+ table: "publicationRules",
12457
+ prepopulation: "required_template",
12458
+ copyMode: "template_tenant_rewrite",
12459
+ scope: "tenant",
12460
+ uniqueKey: ["tenantId", "workspaceId", "name"],
12461
+ description: "Default publication policy rules are rewritten into each tenant."
12462
+ },
12463
+ {
12464
+ component: "kernel",
12465
+ table: "questionEvidenceLinks",
12466
+ prepopulation: "runtime_data",
12467
+ copyMode: "none",
12468
+ description: "Question-to-evidence links are tenant graph data."
12469
+ },
12470
+ {
12471
+ component: "kernel",
12472
+ table: "researchJobs",
12473
+ prepopulation: "runtime_queue",
12474
+ copyMode: "none",
12475
+ description: "Research job rows are runtime queue items."
12476
+ },
12477
+ {
12478
+ component: "kernel",
12479
+ table: "schemaEnumConfig",
12480
+ prepopulation: "required_template",
12481
+ copyMode: "template_global",
12482
+ scope: "global",
12483
+ uniqueKey: ["category", "value"],
12484
+ description: "Runtime-extensible enum defaults required by SDK graph APIs."
12485
+ },
12486
+ {
12487
+ component: "kernel",
12488
+ table: "stakeholderGroups",
12489
+ prepopulation: "runtime_data",
12490
+ copyMode: "none",
12491
+ description: "Stakeholder groups are tenant decision data."
12492
+ },
12493
+ {
12494
+ component: "kernel",
12495
+ table: "systemLogs",
12496
+ prepopulation: "runtime_log",
12497
+ copyMode: "none",
12498
+ description: "System logs are runtime telemetry."
12499
+ },
12500
+ {
12501
+ component: "kernel",
12502
+ table: "tasks",
12503
+ prepopulation: "runtime_data",
12504
+ copyMode: "none",
12505
+ description: "Tasks are tenant-authored work items."
12506
+ },
12507
+ {
12508
+ component: "kernel",
12509
+ table: "topics",
12510
+ prepopulation: "runtime_bootstrap",
12511
+ copyMode: "none",
12512
+ description: "Default topics are created by tenant provisioning, not copied from templates."
12513
+ },
12514
+ {
12515
+ component: "kernel",
12516
+ table: "workflowDefinitions",
12517
+ prepopulation: "optional_template",
12518
+ copyMode: "none",
12519
+ description: "Table-driven workflow definitions can be template data after the workflow engine leaves legacy mode."
12520
+ },
12521
+ {
12522
+ component: "kernel",
12523
+ table: "workflowPullRequests",
12524
+ prepopulation: "runtime_data",
12525
+ copyMode: "none",
12526
+ description: "Workflow pull requests are tenant workflow data."
12527
+ },
12528
+ {
12529
+ component: "kernel",
12530
+ table: "workflowStages",
12531
+ prepopulation: "optional_template",
12532
+ copyMode: "none",
12533
+ dependsOn: ["workflowDefinitions"],
12534
+ description: "Workflow stages can be template data after workflowDefinitions are enabled for bootstrap copying."
12535
+ },
12536
+ {
12537
+ component: "kernel",
12538
+ table: "worktreeBeliefCluster",
12539
+ prepopulation: "runtime_data",
12540
+ copyMode: "none",
12541
+ description: "Worktree cluster rows link runtime worktrees to runtime beliefs."
12542
+ },
12543
+ {
12544
+ component: "kernel",
12545
+ table: "worktrees",
12546
+ prepopulation: "runtime_data",
12547
+ copyMode: "none",
12548
+ description: "Worktrees are tenant/runtime planning data."
12549
+ },
12550
+ {
12551
+ component: "identity",
12552
+ table: "agents",
12553
+ prepopulation: "runtime_bootstrap",
12554
+ copyMode: "none",
12555
+ description: "Service agents are provisioned per tenant or service, not copied."
12556
+ },
12557
+ {
12558
+ component: "identity",
12559
+ table: "mcpWritePolicy",
12560
+ prepopulation: "required_template",
12561
+ copyMode: "template_global",
12562
+ scope: "global",
12563
+ uniqueKey: ["topicId", "role", "toolCategory"],
12564
+ description: "Global write policy defaults govern service and interactive MCP writes."
12565
+ },
12566
+ {
12567
+ component: "identity",
12568
+ table: "modelCallLogs",
12569
+ prepopulation: "runtime_log",
12570
+ copyMode: "none",
12571
+ description: "Model call logs are runtime telemetry."
12572
+ },
12573
+ {
12574
+ component: "identity",
12575
+ table: "modelFunctionSlots",
12576
+ prepopulation: "required_template",
12577
+ copyMode: "template_global",
12578
+ scope: "global",
12579
+ uniqueKey: ["slot"],
12580
+ description: "Function-to-model slots are required by model runtime resolution."
12581
+ },
12582
+ {
12583
+ component: "identity",
12584
+ table: "modelRegistry",
12585
+ prepopulation: "required_template",
12586
+ copyMode: "template_global",
12587
+ scope: "global",
12588
+ uniqueKey: ["key"],
12589
+ description: "Model catalog defaults are required by model runtime clients."
12590
+ },
12591
+ {
12592
+ component: "identity",
12593
+ table: "modelSlotConfigs",
12594
+ prepopulation: "required_template",
12595
+ copyMode: "template_global",
12596
+ scope: "global",
12597
+ uniqueKey: ["slot"],
12598
+ description: "Slot-level defaults are required before tenant overrides exist."
12599
+ },
12600
+ {
12601
+ component: "identity",
12602
+ table: "platformAudienceGrants",
12603
+ prepopulation: "runtime_data",
12604
+ copyMode: "none",
12605
+ description: "Audience grants are principal/group-specific access rows."
12606
+ },
12607
+ {
12608
+ component: "identity",
12609
+ table: "platformAudiences",
12610
+ prepopulation: "required_template",
12611
+ copyMode: "template_tenant_rewrite",
12612
+ scope: "tenant",
12613
+ uniqueKey: ["tenantId", "workspaceId", "audienceKey"],
12614
+ description: "Default tenant audience taxonomy rows are rewritten into each tenant."
12615
+ },
12616
+ {
12617
+ component: "identity",
12618
+ table: "platformPolicyDecisionLogs",
12619
+ prepopulation: "runtime_log",
12620
+ copyMode: "none",
12621
+ description: "Policy decisions are runtime audit logs."
12622
+ },
12623
+ {
12624
+ component: "identity",
12625
+ table: "projectGrants",
12626
+ prepopulation: "runtime_data",
12627
+ copyMode: "none",
12628
+ description: "Project/topic grants are principal or group-specific access rows."
12629
+ },
12630
+ {
12631
+ component: "identity",
12632
+ table: "reasoningPermissions",
12633
+ prepopulation: "runtime_data",
12634
+ copyMode: "none",
12635
+ description: "Reasoning permissions are principal-specific policy rows."
12636
+ },
12637
+ {
12638
+ component: "identity",
12639
+ table: "tenantApiKeys",
12640
+ prepopulation: "runtime_secret",
12641
+ copyMode: "none",
12642
+ description: "API keys are tenant credentials and must never be copied."
12643
+ },
12644
+ {
12645
+ component: "identity",
12646
+ table: "tenantConfig",
12647
+ prepopulation: "required_template",
12648
+ copyMode: "template_tenant_rewrite",
12649
+ scope: "tenant",
12650
+ uniqueKey: ["tenantId"],
12651
+ description: "Tenant-local config defaults are rewritten during bootstrap."
12652
+ },
12653
+ {
12654
+ component: "identity",
12655
+ table: "tenantIntegrations",
12656
+ prepopulation: "required_template",
12657
+ copyMode: "template_tenant_rewrite",
12658
+ scope: "tenant",
12659
+ uniqueKey: ["tenantId", "integrationKey"],
12660
+ description: "Non-secret integration descriptors are rewritten into each tenant."
12661
+ },
12662
+ {
12663
+ component: "identity",
12664
+ table: "tenantModelSlotBindings",
12665
+ prepopulation: "runtime_secret",
12666
+ copyMode: "none",
12667
+ description: "Tenant model slot bindings reference provider secrets and are runtime-only."
12668
+ },
12669
+ {
12670
+ component: "identity",
12671
+ table: "tenantPolicies",
12672
+ prepopulation: "required_template",
12673
+ copyMode: "template_tenant_rewrite",
12674
+ scope: "tenant",
12675
+ uniqueKey: ["tenantId", "workspaceId", "roleName"],
12676
+ description: "Default tenant policy roles are rewritten during bootstrap."
12677
+ },
12678
+ {
12679
+ component: "identity",
12680
+ table: "tenantProviderSecrets",
12681
+ prepopulation: "runtime_secret",
12682
+ copyMode: "none",
12683
+ description: "Provider secrets are credentials and must never be copied."
12684
+ },
12685
+ {
12686
+ component: "identity",
12687
+ table: "tenantProxyGatewayUsage",
12688
+ prepopulation: "runtime_log",
12689
+ copyMode: "none",
12690
+ description: "Proxy gateway usage rows are runtime telemetry."
12691
+ },
12692
+ {
12693
+ component: "identity",
12694
+ table: "tenantProxyTokenMints",
12695
+ prepopulation: "runtime_secret",
12696
+ copyMode: "none",
12697
+ description: "Proxy token mints are ephemeral secret-bearing runtime rows."
12698
+ },
12699
+ {
12700
+ component: "identity",
12701
+ table: "tenantSandboxAuditEvents",
12702
+ prepopulation: "runtime_log",
12703
+ copyMode: "none",
12704
+ description: "Sandbox audit rows are runtime security logs."
12705
+ },
12706
+ {
12707
+ component: "identity",
12708
+ table: "tenantSecrets",
12709
+ prepopulation: "runtime_secret",
12710
+ copyMode: "none",
12711
+ description: "Tenant secrets are credentials and must never be copied."
12712
+ },
12713
+ {
12714
+ component: "identity",
12715
+ table: "toolAcls",
12716
+ prepopulation: "required_template",
12717
+ copyMode: "template_global",
12718
+ scope: "global",
12719
+ uniqueKey: ["role", "toolName"],
12720
+ description: "Default role-to-tool grants are required for SDK/MCP tool access."
12721
+ },
12722
+ {
12723
+ component: "identity",
12724
+ table: "toolRegistry",
12725
+ prepopulation: "required_template",
12726
+ copyMode: "template_global",
12727
+ scope: "global",
12728
+ uniqueKey: ["toolName"],
12729
+ description: "Core tool catalog rows are required before pack or tenant tools exist."
12730
+ },
12731
+ {
12732
+ component: "identity",
12733
+ table: "users",
12734
+ prepopulation: "runtime_bootstrap",
12735
+ copyMode: "none",
12736
+ description: "Users are created from Clerk/MC principal resolution, not copied."
12737
+ }
12738
+ ];
12739
+ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
12740
+ isCopyableSeedRequirement
12741
+ );
12742
+ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
12743
+ (entry) => !isCopyableSeedRequirement(entry)
12744
+ ).map((entry) => entry.table);
12745
+
11532
12746
  export { buildDomainEvent, compareEventCursor, createEventId, decodeEventCursor, emitDomainEvent, encodeEventCursor, inferActorType, isAfterCursor, normalizeRetentionDays, sortEventsByCursor };
11533
12747
  //# sourceMappingURL=outbox.js.map
11534
12748
  //# sourceMappingURL=outbox.js.map