@lucern/events 0.3.0-alpha.2 → 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/types.js CHANGED
@@ -1888,6 +1888,40 @@ defineTable({
1888
1888
  { kind: "index", name: "by_tier_window_end", columns: ["tier", "windowEndMs"] }
1889
1889
  ]
1890
1890
  });
1891
+ defineTable({
1892
+ name: "oauthDeviceCodes",
1893
+ component: "mc",
1894
+ category: "identity",
1895
+ shape: z.object({
1896
+ "deviceCodeHash": z.string(),
1897
+ "userCode": z.string(),
1898
+ "clientId": z.string(),
1899
+ "scope": z.string(),
1900
+ "status": z.enum(["pending", "approved", "denied", "expired", "consumed"]),
1901
+ "expiresAt": z.number(),
1902
+ "intervalSeconds": z.number(),
1903
+ "lastPolledAt": z.number().optional(),
1904
+ "slowDownCount": z.number().optional(),
1905
+ "clerkUserId": z.string().optional(),
1906
+ "tenantId": idOf("tenants").optional(),
1907
+ "workspaceId": z.string().optional(),
1908
+ "principalId": z.string().optional(),
1909
+ "role": z.string().optional(),
1910
+ "scopes": z.array(z.string()).optional(),
1911
+ "sessionId": z.string().optional(),
1912
+ "approvedAt": z.number().optional(),
1913
+ "deniedAt": z.number().optional(),
1914
+ "consumedAt": z.number().optional(),
1915
+ "createdAt": z.number(),
1916
+ "updatedAt": z.number()
1917
+ }),
1918
+ indices: [
1919
+ { kind: "index", name: "by_deviceCodeHash", columns: ["deviceCodeHash"] },
1920
+ { kind: "index", name: "by_userCode", columns: ["userCode"] },
1921
+ { kind: "index", name: "by_status_expiresAt", columns: ["status", "expiresAt"] },
1922
+ { kind: "index", name: "by_sessionId", columns: ["sessionId"] }
1923
+ ]
1924
+ });
1891
1925
  defineTable({
1892
1926
  name: "servicePrincipalKeys",
1893
1927
  component: "mc",
@@ -3844,7 +3878,9 @@ defineTable({
3844
3878
  "defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
3845
3879
  "deployments": z.record(z.object({
3846
3880
  "url": z.string(),
3847
- "encryptedDeployKey": z.string()
3881
+ "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
3882
+ "encryptedDeployKey": z.string().optional(),
3883
+ "credentialRef": z.string().optional()
3848
3884
  })).optional(),
3849
3885
  "metadata": z.record(z.any()).optional(),
3850
3886
  "createdBy": z.string().optional(),
@@ -5041,6 +5077,14 @@ var ADD_WORKTREE = {
5041
5077
  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.",
5042
5078
  parameters: {
5043
5079
  title: { type: "string", description: "Worktree name/objective" },
5080
+ name: {
5081
+ type: "string",
5082
+ description: "Optional storage-name alias for callers that already use backend naming"
5083
+ },
5084
+ projectId: {
5085
+ type: "string",
5086
+ description: "Legacy topicId alias"
5087
+ },
5044
5088
  topicId: { type: "string", description: "Optional topic scope hint" },
5045
5089
  branchId: {
5046
5090
  type: "string",
@@ -5054,14 +5098,87 @@ var ADD_WORKTREE = {
5054
5098
  type: "string",
5055
5099
  description: "The testable claim this worktree investigates"
5056
5100
  },
5101
+ rationale: {
5102
+ type: "string",
5103
+ description: "Why this worktree exists and why it belongs in the campaign"
5104
+ },
5105
+ worktreeType: {
5106
+ type: "string",
5107
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
5108
+ },
5109
+ gate: {
5110
+ type: "string",
5111
+ description: "Exit gate name for this worktree"
5112
+ },
5113
+ startDate: {
5114
+ type: "number",
5115
+ description: "Planned start timestamp in milliseconds since epoch"
5116
+ },
5117
+ endDate: {
5118
+ type: "number",
5119
+ description: "Planned end timestamp in milliseconds since epoch"
5120
+ },
5121
+ durationWeeks: {
5122
+ type: "number",
5123
+ description: "Planned duration in weeks"
5124
+ },
5125
+ confidenceImpact: {
5126
+ type: "string",
5127
+ description: "Expected confidence impact if the worktree succeeds",
5128
+ enum: ["high", "medium", "low"]
5129
+ },
5130
+ beliefFocus: {
5131
+ type: "string",
5132
+ description: "Natural-language focus spanning the target belief neighborhood"
5133
+ },
5057
5134
  beliefIds: {
5058
5135
  type: "array",
5059
- description: "Beliefs to test in this worktree"
5136
+ description: "Legacy alias for targetBeliefIds"
5137
+ },
5138
+ beliefs: {
5139
+ type: "array",
5140
+ description: "Legacy alias for targetBeliefIds"
5141
+ },
5142
+ targetBeliefIds: {
5143
+ type: "array",
5144
+ description: "Belief node IDs this worktree is expected to test or update"
5145
+ },
5146
+ targetQuestionIds: {
5147
+ type: "array",
5148
+ description: "Question node IDs this worktree is expected to answer"
5149
+ },
5150
+ keyQuestions: {
5151
+ type: "array",
5152
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
5153
+ },
5154
+ evidenceSignals: {
5155
+ type: "array",
5156
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
5157
+ },
5158
+ decisionGate: {
5159
+ type: "object",
5160
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
5161
+ },
5162
+ goCriteria: {
5163
+ type: "array",
5164
+ description: "Shorthand go criteria used to build decisionGate"
5165
+ },
5166
+ noGoSignals: {
5167
+ type: "array",
5168
+ description: "Shorthand no-go signals used to build decisionGate"
5169
+ },
5170
+ proofArtifacts: {
5171
+ type: "array",
5172
+ description: "Expected proof artifacts required to close the worktree"
5060
5173
  },
5061
5174
  autoShape: {
5062
5175
  type: "boolean",
5063
5176
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
5064
5177
  },
5178
+ autoFixPolicy: {
5179
+ type: "object",
5180
+ description: "Policy for permitted automatic remediation inside the worktree"
5181
+ },
5065
5182
  domainPackId: {
5066
5183
  type: "string",
5067
5184
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
@@ -5090,9 +5207,17 @@ var ADD_WORKTREE = {
5090
5207
  type: "array",
5091
5208
  description: "Worktree IDs blocked by this worktree"
5092
5209
  },
5093
- gate: {
5210
+ staffingHint: {
5094
5211
  type: "string",
5095
- description: "Exit gate name for this worktree"
5212
+ description: "Suggested staffing or agent allocation note"
5213
+ },
5214
+ lensId: {
5215
+ type: "string",
5216
+ description: "Lens that scopes this worktree when applicable"
5217
+ },
5218
+ lastReconciledAt: {
5219
+ type: "number",
5220
+ description: "Timestamp when worktree metadata was last reconciled"
5096
5221
  }
5097
5222
  },
5098
5223
  required: ["title", "topicId"],
@@ -5122,7 +5247,7 @@ var MERGE = {
5122
5247
  worktreeId: { type: "string", description: "The worktree to merge" },
5123
5248
  outcomes: {
5124
5249
  type: "array",
5125
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
5250
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
5126
5251
  },
5127
5252
  summary: { type: "string", description: "Overall findings summary" }
5128
5253
  },
@@ -8141,6 +8266,69 @@ var GENERATE_SESSION_HANDOFF = {
8141
8266
  tier: "showcase",
8142
8267
  internal: true
8143
8268
  };
8269
+ var BEGIN_BUILD_SESSION = {
8270
+ name: "begin_build_session",
8271
+ 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.",
8272
+ parameters: {
8273
+ worktreeId: {
8274
+ type: "string",
8275
+ description: "The Lucern worktree ID to bootstrap."
8276
+ },
8277
+ branch: {
8278
+ type: "string",
8279
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
8280
+ },
8281
+ branchBase: {
8282
+ type: "string",
8283
+ description: 'Base branch for the feature branch. Default: "staging".'
8284
+ },
8285
+ prBase: {
8286
+ type: "string",
8287
+ description: 'Target branch for the PR. Default: "staging".'
8288
+ },
8289
+ sessionMode: {
8290
+ type: "string",
8291
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
8292
+ enum: ["async", "interactive"]
8293
+ },
8294
+ activateIfPlanning: {
8295
+ type: "boolean",
8296
+ description: "When true, automatically activate a planning worktree during bootstrap."
8297
+ }
8298
+ },
8299
+ required: ["worktreeId"],
8300
+ response: {
8301
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
8302
+ fields: {
8303
+ topicId: "string \u2014 canonical topic scope",
8304
+ topicName: "string \u2014 human-readable topic name",
8305
+ worktreeId: "string \u2014 worktree ID",
8306
+ worktreeName: "string \u2014 human-readable worktree name",
8307
+ branch: "string \u2014 git branch name",
8308
+ branchBase: "string \u2014 base branch",
8309
+ prBase: "string \u2014 PR target branch",
8310
+ campaign: "number | null \u2014 top-level pipeline campaign",
8311
+ lane: "string \u2014 campaign lane",
8312
+ gate: "string \u2014 exit gate",
8313
+ hypothesis: "string \u2014 worktree hypothesis",
8314
+ focus: "string \u2014 session focus",
8315
+ status: "string \u2014 worktree status after optional activation",
8316
+ sessionMode: "string \u2014 async | interactive",
8317
+ targetBeliefIds: "array \u2014 scoped belief IDs",
8318
+ targetQuestionIds: "array \u2014 scoped question IDs",
8319
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
8320
+ openQuestions: "array \u2014 open scoped questions",
8321
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
8322
+ dependencies: "array \u2014 upstream worktrees",
8323
+ unblocks: "array \u2014 downstream worktrees",
8324
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
8325
+ }
8326
+ },
8327
+ ownerModule: "bootstrap",
8328
+ ontologyPrimitive: "worktree",
8329
+ tier: "showcase",
8330
+ internal: true
8331
+ };
8144
8332
  var MCP_TOOL_CONTRACTS = {
8145
8333
  // Belief lifecycle (commit, amend, fork, archive)
8146
8334
  create_belief: CREATE_BELIEF,
@@ -8234,6 +8422,7 @@ var MCP_TOOL_CONTRACTS = {
8234
8422
  get_agent_inbox: GET_AGENT_INBOX,
8235
8423
  claim_files: CLAIM_FILES,
8236
8424
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
8425
+ begin_build_session: BEGIN_BUILD_SESSION,
8237
8426
  // Policy / ACL (workhorse)
8238
8427
  check_permission: CHECK_PERMISSION,
8239
8428
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -8447,6 +8636,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
8447
8636
  "get_change_history",
8448
8637
  "get_failure_log",
8449
8638
  "record_attempt",
8639
+ "begin_build_session",
8450
8640
  "push",
8451
8641
  "open_pull_request",
8452
8642
  "record_judgment",
@@ -8501,7 +8691,6 @@ var SDK_ONLY_OPERATION_NAMES = [
8501
8691
  "find_semantic_orphans"
8502
8692
  ];
8503
8693
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
8504
- "begin_build_session",
8505
8694
  "evaluate_engineering_contract",
8506
8695
  "evaluate_research_contract"
8507
8696
  ];
@@ -8887,8 +9076,31 @@ function assertSurfaceCoverage(contracts) {
8887
9076
  }
8888
9077
  }
8889
9078
  }
8890
-
8891
- // ../contracts/src/function-registry/context.ts
9079
+ var jsonRecordSchema2 = z.record(z.unknown());
9080
+ var observationArgs = z.object({
9081
+ topicId: z.string().optional().describe("Topic scope for the observation."),
9082
+ summary: z.string().describe("Short observation summary."),
9083
+ text: z.string().optional().describe("Canonical observation text alias."),
9084
+ title: z.string().optional().describe("Optional observation title."),
9085
+ content: z.string().optional().describe("Optional rich observation content."),
9086
+ contentType: z.string().optional().describe("Observation content type."),
9087
+ kind: z.string().optional().describe("Evidence kind to store."),
9088
+ observationType: z.string().optional().describe("Observation type."),
9089
+ tags: z.array(z.string()).optional().describe("Observation tags."),
9090
+ source: z.string().optional().describe("Observation source label."),
9091
+ sourceType: z.string().optional().describe("Evidence source type."),
9092
+ externalSourceType: z.string().optional().describe("External source type for imported observations."),
9093
+ sourceUrl: z.string().optional().describe("Canonical source URL."),
9094
+ confidence: z.number().optional().describe("Observation confidence."),
9095
+ metadata: jsonRecordSchema2.optional().describe("Observation metadata."),
9096
+ rationale: z.string().optional().describe("Why this observation should be recorded.")
9097
+ });
9098
+ var observationContextArgs = z.object({
9099
+ topicId: z.string().describe("Topic scope."),
9100
+ query: z.string().optional().describe("Optional context query."),
9101
+ limit: z.number().optional().describe("Maximum observations to return."),
9102
+ status: z.string().optional().describe("Observation status filter.")
9103
+ });
8892
9104
  var observationInput = (input, context) => withUserId(
8893
9105
  compactRecord4({
8894
9106
  projectId: input.projectId,
@@ -8947,7 +9159,8 @@ var contextContracts = [
8947
9159
  observationId: output && typeof output === "object" ? output.nodeId : void 0,
8948
9160
  observationType: input.observationType
8949
9161
  })
8950
- }
9162
+ },
9163
+ args: observationArgs
8951
9164
  }),
8952
9165
  surfaceContract({
8953
9166
  name: "get_observation_context",
@@ -8968,7 +9181,8 @@ var contextContracts = [
8968
9181
  status: input.status,
8969
9182
  userId: input.userId
8970
9183
  })
8971
- }
9184
+ },
9185
+ args: observationContextArgs
8972
9186
  })
8973
9187
  ];
8974
9188
 
@@ -9031,8 +9245,45 @@ var identityContracts = [
9031
9245
  }
9032
9246
  })
9033
9247
  ];
9034
-
9035
- // ../contracts/src/function-registry/beliefs.ts
9248
+ var jsonRecordSchema3 = z.record(z.unknown());
9249
+ var sourceTypeSchema = z.enum(["human", "ai_extracted", "ai_generated"]);
9250
+ var reversibilitySchema = z.enum([
9251
+ "irreversible",
9252
+ "hard_to_reverse",
9253
+ "reversible",
9254
+ "trivial"
9255
+ ]);
9256
+ var predictionMetaSchema = z.object({
9257
+ isPrediction: z.boolean().describe("Whether this belief is a prediction."),
9258
+ registeredAt: z.number().describe("Timestamp when the prediction was registered."),
9259
+ expectedBy: z.number().optional().describe("Timestamp when the prediction should be evaluated.")
9260
+ });
9261
+ var createBeliefArgs = z.object({
9262
+ canonicalText: z.string().describe("The belief statement the agent holds to be true."),
9263
+ topicId: z.string().optional().describe("Topic scope hint for the belief."),
9264
+ baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
9265
+ beliefType: z.string().optional().describe("Schema belief type."),
9266
+ metadata: jsonRecordSchema3.optional().describe("Extra metadata merged into the belief node."),
9267
+ rationale: z.string().optional().describe("Why this belief should enter the reasoning graph."),
9268
+ pillar: z.string().optional().describe("Innovation pillar or product pillar associated with the belief."),
9269
+ worktreeId: z.string().optional().describe("Worktree responsible for creating or testing this belief."),
9270
+ sourceBeliefIds: z.array(z.string()).optional().describe("Source belief IDs this belief derives from."),
9271
+ sourceType: sourceTypeSchema.optional().describe("Actor/source class that produced the belief."),
9272
+ reversibility: reversibilitySchema.optional().describe("How reversible the belief's implied decision is."),
9273
+ predictionMeta: predictionMetaSchema.optional().describe("Prediction lifecycle metadata when this belief is a forecast.")
9274
+ });
9275
+ var forkBeliefArgs = z.object({
9276
+ nodeId: z.string().describe("The scored belief to fork from."),
9277
+ newFormulation: z.string().describe("The evolved belief statement."),
9278
+ forkReason: z.enum([
9279
+ "refinement",
9280
+ "contradiction_response",
9281
+ "scope_change",
9282
+ "confidence_collapse",
9283
+ "manual"
9284
+ ]).describe("Why this fork was created."),
9285
+ rationale: z.string().optional().describe("Why the fork is warranted.")
9286
+ });
9036
9287
  var beliefLookupInput = (input) => compactRecord4({
9037
9288
  nodeId: input.nodeId ?? input.id ?? input.beliefId,
9038
9289
  beliefId: input.beliefId
@@ -9107,7 +9358,8 @@ var beliefsContracts = [
9107
9358
  functionName: "create",
9108
9359
  kind: "mutation",
9109
9360
  inputProjection: createBeliefInput
9110
- }
9361
+ },
9362
+ args: createBeliefArgs
9111
9363
  }),
9112
9364
  surfaceContract({
9113
9365
  name: "get_belief",
@@ -9198,7 +9450,8 @@ var beliefsContracts = [
9198
9450
  functionName: "forkBelief",
9199
9451
  kind: "mutation",
9200
9452
  inputProjection: forkBeliefInput
9201
- }
9453
+ },
9454
+ args: forkBeliefArgs
9202
9455
  }),
9203
9456
  surfaceContract({
9204
9457
  name: "archive_belief",
@@ -9279,8 +9532,46 @@ var beliefsContracts = [
9279
9532
  }
9280
9533
  })
9281
9534
  ];
9282
-
9283
- // ../contracts/src/function-registry/evidence.ts
9535
+ var jsonRecordSchema4 = z.record(z.unknown());
9536
+ var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
9537
+ var createEvidenceArgs = z.object({
9538
+ topicId: z.string().optional().describe("Topic scope for the evidence."),
9539
+ text: z.string().describe("Canonical evidence text."),
9540
+ source: z.string().optional().describe("Source URL or source label."),
9541
+ sourceUrl: z.string().optional().describe("Canonical source URL."),
9542
+ targetId: z.string().optional().describe("Belief or question identifier to link immediately."),
9543
+ linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
9544
+ evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
9545
+ confidence: z.number().optional().describe("Confidence in the evidence relation."),
9546
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
9547
+ metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
9548
+ rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
9549
+ reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
9550
+ title: z.string().optional().describe("Optional short title."),
9551
+ content: z.string().optional().describe("Optional long-form content."),
9552
+ contentType: z.string().optional().describe("Content format or MIME hint."),
9553
+ kind: z.string().optional().describe("Evidence kind."),
9554
+ tags: z.array(z.string()).optional().describe("Evidence tags."),
9555
+ sourceType: z.string().optional().describe("Evidence source type."),
9556
+ externalSourceType: z.string().optional().describe("External source type for imported evidence."),
9557
+ sourceQuestionId: z.string().optional().describe("Question that sourced this evidence."),
9558
+ methodology: z.string().optional().describe("Collection methodology."),
9559
+ informationAsymmetry: z.string().optional().describe("Information asymmetry class."),
9560
+ sourceDescription: z.string().optional().describe("Human-readable source description.")
9561
+ });
9562
+ var addEvidenceArgs = z.object({
9563
+ canonicalText: z.string().describe("The evidence statement."),
9564
+ text: z.string().optional().describe("Canonical evidence text alias used by newer callers."),
9565
+ topicId: z.string().optional().describe("Topic scope hint."),
9566
+ sourceUrl: z.string().optional().describe("URL of the source material."),
9567
+ targetNodeId: z.string().describe("The belief this evidence bears on."),
9568
+ weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
9569
+ reasoning: z.string().describe("Why this evidence is relevant to the target belief."),
9570
+ title: z.string().optional().describe("Optional short title."),
9571
+ content: z.string().optional().describe("Optional long-form evidence content."),
9572
+ contentType: z.string().optional().describe("Content format or MIME hint."),
9573
+ metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
9574
+ });
9284
9575
  var evidenceIdInput = (input) => compactRecord4({
9285
9576
  evidenceId: input.evidenceId,
9286
9577
  insightId: input.insightId,
@@ -9355,7 +9646,8 @@ var evidenceContracts = [
9355
9646
  functionName: "create",
9356
9647
  kind: "mutation",
9357
9648
  inputProjection: createEvidenceInput
9358
- }
9649
+ },
9650
+ args: createEvidenceArgs
9359
9651
  }),
9360
9652
  surfaceContract({
9361
9653
  name: "add_evidence",
@@ -9391,7 +9683,8 @@ var evidenceContracts = [
9391
9683
  context
9392
9684
  );
9393
9685
  }
9394
- }
9686
+ },
9687
+ args: addEvidenceArgs
9395
9688
  }),
9396
9689
  surfaceContract({
9397
9690
  name: "get_evidence",
@@ -9498,8 +9791,91 @@ var evidenceContracts = [
9498
9791
  }
9499
9792
  })
9500
9793
  ];
9501
-
9502
- // ../contracts/src/function-registry/questions.ts
9794
+ var jsonRecordSchema5 = z.record(z.unknown());
9795
+ var questionPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
9796
+ var kernelQuestionPrioritySchema = z.enum([
9797
+ "critical",
9798
+ "high",
9799
+ "medium",
9800
+ "low"
9801
+ ]);
9802
+ var questionTypeSchema = z.enum([
9803
+ "validation",
9804
+ "falsification",
9805
+ "assumption_probe",
9806
+ "prediction_test",
9807
+ "counterfactual",
9808
+ "discovery",
9809
+ "clarification",
9810
+ "comparison",
9811
+ "causal",
9812
+ "mechanism",
9813
+ "general"
9814
+ ]);
9815
+ var createQuestionArgs = z.object({
9816
+ text: z.string().describe("The question text."),
9817
+ question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
9818
+ topicId: z.string().optional().describe("Topic scope hint."),
9819
+ priority: questionPrioritySchema.optional().describe("Human-facing question priority."),
9820
+ linkedBeliefId: z.string().optional().describe("Belief this question tests."),
9821
+ linkedBeliefNodeId: z.string().optional().describe("Belief node this question tests."),
9822
+ metadata: jsonRecordSchema5.optional().describe("Optional metadata merged into the question record."),
9823
+ category: z.string().optional().describe("Question category."),
9824
+ source: z.string().optional().describe("Question source."),
9825
+ testType: z.enum(["validates", "invalidates", "clarifies"]).optional().describe("How this question tests its linked belief."),
9826
+ importance: z.number().optional().describe("Numeric importance score."),
9827
+ epistemicUnlock: z.string().optional().describe("What this question unlocks if answered."),
9828
+ sourceQuestionIds: z.array(z.string()).optional().describe("Question IDs this question derives from."),
9829
+ linkedWorktreeId: z.string().optional().describe("Worktree this question belongs to."),
9830
+ questionType: questionTypeSchema.optional().describe("Question type."),
9831
+ questionPriority: kernelQuestionPrioritySchema.optional().describe("Kernel-native question priority.")
9832
+ });
9833
+ var refineQuestionArgs = z.object({
9834
+ id: z.string().describe("The question to refine."),
9835
+ text: z.string().describe("Updated question text."),
9836
+ question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
9837
+ rationale: z.string().optional().describe("Why the question is refined."),
9838
+ category: z.string().optional().describe("Updated question category."),
9839
+ priority: questionPrioritySchema.optional().describe("Updated human-facing priority.")
9840
+ });
9841
+ var createAnswerArgs = z.object({
9842
+ questionNodeId: z.string().describe("The question node ID this answer responds to."),
9843
+ questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
9844
+ answerText: z.string().describe("The answer content."),
9845
+ topicId: z.string().optional().describe("Topic scope for the answer."),
9846
+ confidence: z.string().optional().describe("Answer confidence."),
9847
+ evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node IDs supporting the answer."),
9848
+ answerSource: z.string().optional().describe("How the answer was produced."),
9849
+ worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
9850
+ sprintId: z.string().optional().describe("Legacy sprint identifier.")
9851
+ });
9852
+ var answerQuestionArgs = z.object({
9853
+ id: z.string().describe("Canonical question ID."),
9854
+ topicId: z.string().describe("Topic scope for the answer."),
9855
+ text: z.string().describe("Answer text."),
9856
+ confidence: z.enum(["weak", "medium", "strong"]).optional().describe("Optional answer confidence."),
9857
+ evidenceIds: z.array(z.string()).optional().describe("Canonical evidence IDs supporting the answer."),
9858
+ rationale: z.string().optional().describe("Why this answer is credible."),
9859
+ questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
9860
+ questionNodeId: z.string().optional().describe("Question node ID alias accepted by the projection."),
9861
+ answerText: z.string().optional().describe("Canonical answer text alias accepted by newer callers."),
9862
+ evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node ID alias accepted by newer callers."),
9863
+ answerSource: z.string().optional().describe("How the answer was produced."),
9864
+ worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
9865
+ sprintId: z.string().optional().describe("Legacy sprint identifier.")
9866
+ });
9867
+ var missingQuestionsArgs = z.object({
9868
+ topicId: z.string().describe("Topic scope."),
9869
+ minConfidence: z.number().optional().describe("Minimum confidence threshold for missing-question checks."),
9870
+ status: z.string().optional().describe("Question status filter."),
9871
+ limit: z.number().optional().describe("Maximum questions to inspect.")
9872
+ });
9873
+ var falsificationQuestionsArgs = z.object({
9874
+ topicId: z.string().describe("Topic scope."),
9875
+ beliefIds: z.array(z.string()).optional().describe("Beliefs to generate falsification questions for."),
9876
+ status: z.string().optional().describe("Question status filter."),
9877
+ limit: z.number().optional().describe("Maximum questions to inspect.")
9878
+ });
9503
9879
  var questionNodeInput = (input) => compactRecord4({
9504
9880
  nodeId: input.nodeId ?? input.id ?? input.questionId,
9505
9881
  questionId: input.questionId
@@ -9546,7 +9922,8 @@ var questionsContracts = [
9546
9922
  functionName: "create",
9547
9923
  kind: "mutation",
9548
9924
  inputProjection: createQuestionInput
9549
- }
9925
+ },
9926
+ args: createQuestionArgs
9550
9927
  }),
9551
9928
  surfaceContract({
9552
9929
  name: "get_question",
@@ -9602,7 +9979,8 @@ var questionsContracts = [
9602
9979
  category: input.category,
9603
9980
  priority: input.priority
9604
9981
  })
9605
- }
9982
+ },
9983
+ args: refineQuestionArgs
9606
9984
  }),
9607
9985
  surfaceContract({
9608
9986
  name: "update_question_status",
@@ -9678,7 +10056,8 @@ var questionsContracts = [
9678
10056
  }),
9679
10057
  context
9680
10058
  )
9681
- }
10059
+ },
10060
+ args: createAnswerArgs
9682
10061
  }),
9683
10062
  surfaceContract({
9684
10063
  name: "answer_question",
@@ -9707,7 +10086,8 @@ var questionsContracts = [
9707
10086
  }),
9708
10087
  context
9709
10088
  )
9710
- }
10089
+ },
10090
+ args: answerQuestionArgs
9711
10091
  }),
9712
10092
  surfaceContract({
9713
10093
  name: "get_answer",
@@ -9739,7 +10119,8 @@ var questionsContracts = [
9739
10119
  functionName: "getByTopic",
9740
10120
  kind: "query",
9741
10121
  inputProjection: questionTopicInput
9742
- }
10122
+ },
10123
+ args: missingQuestionsArgs
9743
10124
  }),
9744
10125
  surfaceContract({
9745
10126
  name: "get_high_priority_questions",
@@ -9774,11 +10155,22 @@ var questionsContracts = [
9774
10155
  functionName: "getByTopic",
9775
10156
  kind: "query",
9776
10157
  inputProjection: questionTopicInput
9777
- }
10158
+ },
10159
+ args: falsificationQuestionsArgs
9778
10160
  })
9779
10161
  ];
9780
-
9781
- // ../contracts/src/function-registry/topics.ts
10162
+ var updateTopicArgs = z.object({
10163
+ id: z.string().describe("Topic ID."),
10164
+ topicId: z.string().optional().describe("Topic ID alias."),
10165
+ name: z.string().optional().describe("Topic name."),
10166
+ description: z.string().optional().describe("Topic description."),
10167
+ type: z.string().optional().describe("Topic type."),
10168
+ status: z.string().optional().describe("Topic status."),
10169
+ visibility: z.string().optional().describe("Topic visibility."),
10170
+ ontologyId: z.string().optional().describe("Ontology to bind."),
10171
+ clearOntologyId: z.boolean().optional().describe("Whether to clear the ontology binding."),
10172
+ metadata: z.record(z.unknown()).optional().describe("Topic metadata.")
10173
+ });
9782
10174
  var topicIdInput = (input) => compactRecord4({
9783
10175
  id: input.id ?? input.topicId
9784
10176
  });
@@ -9859,7 +10251,8 @@ var topicsContracts = [
9859
10251
  functionName: "update",
9860
10252
  kind: "mutation",
9861
10253
  inputProjection: updateTopicInput
9862
- }
10254
+ },
10255
+ args: updateTopicArgs
9863
10256
  }),
9864
10257
  surfaceContract({
9865
10258
  name: "get_topic_tree",
@@ -9878,8 +10271,27 @@ var topicsContracts = [
9878
10271
  }
9879
10272
  })
9880
10273
  ];
9881
-
9882
- // ../contracts/src/function-registry/lenses.ts
10274
+ var lensPerspectiveSchema = z.enum([
10275
+ "investigation",
10276
+ "monitoring",
10277
+ "analysis",
10278
+ "comparison",
10279
+ "taxonomy"
10280
+ ]);
10281
+ var jsonRecordSchema6 = z.record(z.unknown());
10282
+ var createLensArgs = z.object({
10283
+ name: z.string().describe("Lens name."),
10284
+ workspaceId: z.string().optional().describe("Workspace scope for the lens."),
10285
+ topicId: z.string().optional().describe("Originating topic scope."),
10286
+ description: z.string().optional().describe("What this lens investigates or monitors."),
10287
+ perspectiveType: lensPerspectiveSchema.describe("Perspective type."),
10288
+ promptTemplates: z.array(jsonRecordSchema6).optional().describe("Prompt templates used through this lens."),
10289
+ workflowTemplates: z.array(jsonRecordSchema6).optional().describe("Guided workflow templates."),
10290
+ taskTemplates: z.array(jsonRecordSchema6).optional().describe("Default task templates."),
10291
+ questionTemplates: z.array(jsonRecordSchema6).optional().describe("Default question templates."),
10292
+ filterCriteria: jsonRecordSchema6.optional().describe("Belief/evidence filtering criteria."),
10293
+ metadata: jsonRecordSchema6.optional().describe("Additional lens metadata.")
10294
+ });
9883
10295
  var createLensInput = (input, context) => compactRecord4({
9884
10296
  name: input.name,
9885
10297
  description: input.description,
@@ -9916,7 +10328,8 @@ var lensesContracts = [
9916
10328
  functionName: "create",
9917
10329
  kind: "mutation",
9918
10330
  inputProjection: createLensInput
9919
- }
10331
+ },
10332
+ args: createLensArgs
9920
10333
  }),
9921
10334
  surfaceContract({
9922
10335
  name: "list_lenses",
@@ -9978,8 +10391,18 @@ var lensesContracts = [
9978
10391
  }
9979
10392
  })
9980
10393
  ];
9981
-
9982
- // ../contracts/src/function-registry/ontologies.ts
10394
+ var updateOntologyArgs = z.object({
10395
+ id: z.string().describe("Ontology definition ID."),
10396
+ ontologyId: z.string().optional().describe("Ontology ID alias."),
10397
+ name: z.string().optional().describe("Ontology display name."),
10398
+ description: z.string().optional().describe("Ontology description."),
10399
+ status: z.string().optional().describe("Ontology lifecycle status.")
10400
+ });
10401
+ var ontologyVersionLifecycleArgs = z.object({
10402
+ id: z.string().describe("Ontology version ID."),
10403
+ versionId: z.string().optional().describe("Ontology version ID alias."),
10404
+ ontologyId: z.string().optional().describe("Ontology definition ID.")
10405
+ });
9983
10406
  var ontologyIdInput = (input) => compactRecord4({
9984
10407
  id: input.id ?? input.ontologyId
9985
10408
  });
@@ -10058,11 +10481,11 @@ var ontologiesContracts = [
10058
10481
  id: input.id ?? input.ontologyId,
10059
10482
  name: input.name,
10060
10483
  description: input.description,
10061
- parentOntologyId: input.parentOntologyId,
10062
10484
  status: input.status,
10063
10485
  actorId: input.actorId
10064
10486
  })
10065
- }
10487
+ },
10488
+ args: updateOntologyArgs
10066
10489
  }),
10067
10490
  surfaceContract({
10068
10491
  name: "archive_ontology",
@@ -10145,7 +10568,8 @@ var ontologiesContracts = [
10145
10568
  functionName: "publishOntologyVersion",
10146
10569
  kind: "mutation",
10147
10570
  inputProjection: ontologyVersionIdInput
10148
- }
10571
+ },
10572
+ args: ontologyVersionLifecycleArgs
10149
10573
  }),
10150
10574
  surfaceContract({
10151
10575
  name: "deprecate_ontology_version",
@@ -10161,7 +10585,8 @@ var ontologiesContracts = [
10161
10585
  functionName: "deprecateOntologyVersion",
10162
10586
  kind: "mutation",
10163
10587
  inputProjection: ontologyVersionIdInput
10164
- }
10588
+ },
10589
+ args: ontologyVersionLifecycleArgs
10165
10590
  }),
10166
10591
  surfaceContract({
10167
10592
  name: "resolve_effective_ontology",
@@ -10180,8 +10605,76 @@ var ontologiesContracts = [
10180
10605
  }
10181
10606
  })
10182
10607
  ];
10183
-
10184
- // ../contracts/src/function-registry/worktrees.ts
10608
+ var autoFixPolicyInputSchema = z.object({
10609
+ enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
10610
+ mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
10611
+ maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
10612
+ reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
10613
+ maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
10614
+ permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
10615
+ requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
10616
+ escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
10617
+ }).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
10618
+ var worktreeKeyQuestionInputSchema = z.object({
10619
+ question: z.string().describe("Question the worktree must resolve."),
10620
+ status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
10621
+ answer: z.string().optional().describe("Captured answer when the key question is resolved."),
10622
+ answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
10623
+ linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
10624
+ }).passthrough().describe("Question contract embedded in the worktree plan.");
10625
+ var worktreeEvidenceSignalInputSchema = z.object({
10626
+ signal: z.string().describe("Evidence signal the worktree should collect."),
10627
+ collected: z.boolean().optional().describe("Whether the signal has already been collected."),
10628
+ progress: z.string().optional().describe("Collection progress note for the signal."),
10629
+ notes: z.string().optional().describe("Additional evidence collection notes.")
10630
+ }).passthrough().describe("Evidence signal embedded in the worktree plan.");
10631
+ var worktreeDecisionGateInputSchema = z.object({
10632
+ goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
10633
+ noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
10634
+ verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
10635
+ verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
10636
+ decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
10637
+ decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
10638
+ }).passthrough().describe("Decision gate contract for worktree activation or exit.");
10639
+ var addWorktreeArgs = z.object({
10640
+ title: z.string().optional().describe("Human-readable worktree name or objective."),
10641
+ name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
10642
+ topicId: z.string().describe("Primary topic scope for the worktree."),
10643
+ projectId: z.string().optional().describe("Legacy topicId alias."),
10644
+ branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
10645
+ objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
10646
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
10647
+ rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
10648
+ worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
10649
+ gate: z.string().optional().describe("Exit gate for this worktree."),
10650
+ startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
10651
+ endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
10652
+ durationWeeks: z.number().optional().describe("Planned duration in weeks."),
10653
+ confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
10654
+ beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
10655
+ beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
10656
+ beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
10657
+ targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
10658
+ targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
10659
+ keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
10660
+ evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
10661
+ decisionGate: worktreeDecisionGateInputSchema.optional(),
10662
+ goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
10663
+ noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
10664
+ proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
10665
+ autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
10666
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
10667
+ domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
10668
+ campaign: z.number().optional().describe("Top-level pipeline campaign number."),
10669
+ lane: z.string().optional().describe("Campaign lane for the worktree."),
10670
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
10671
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
10672
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
10673
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
10674
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
10675
+ lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
10676
+ lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
10677
+ });
10185
10678
  var worktreeIdInput = (input) => compactRecord4({
10186
10679
  worktreeId: input.worktreeId ?? input.id
10187
10680
  });
@@ -10214,6 +10707,50 @@ var worktreeMetadataInput = (input) => compactRecord4({
10214
10707
  autoFixPolicy: input.autoFixPolicy,
10215
10708
  lastReconciledAt: input.lastReconciledAt
10216
10709
  });
10710
+ var worktreeMetadataArgs = z.object({
10711
+ worktreeId: z.string().describe("The worktree to update."),
10712
+ id: z.string().optional().describe("Worktree ID alias."),
10713
+ topicId: z.string().optional().describe("Primary topic scope."),
10714
+ additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
10715
+ status: z.string().optional().describe("Worktree lifecycle status."),
10716
+ campaign: z.number().optional().describe("Top-level pipeline campaign."),
10717
+ lane: z.string().optional().describe("Campaign lane."),
10718
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
10719
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
10720
+ gate: z.string().optional().describe("Exit gate for this worktree."),
10721
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
10722
+ objective: z.string().optional().describe("Reasoning objective for the worktree."),
10723
+ rationale: z.string().optional().describe("Why this worktree is sequenced here."),
10724
+ proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
10725
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
10726
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
10727
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
10728
+ lensId: z.string().optional().describe("Lens that scopes this worktree."),
10729
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
10730
+ lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
10731
+ });
10732
+ var pushArgs = worktreeMetadataArgs.extend({
10733
+ targetContext: z.string().describe("Where to push merged findings."),
10734
+ beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
10735
+ });
10736
+ var openPullRequestArgs = worktreeMetadataArgs.extend({
10737
+ reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
10738
+ summary: z.string().describe("Summary of findings and why they are ready for review.")
10739
+ });
10740
+ var mergeKeyFindingsInput = (input) => {
10741
+ if (Array.isArray(input.keyFindings)) {
10742
+ return input.keyFindings;
10743
+ }
10744
+ if (Array.isArray(input.outcomes)) {
10745
+ const findings = input.outcomes.filter(
10746
+ (outcome) => typeof outcome === "string" && outcome.trim().length > 0
10747
+ );
10748
+ if (findings.length > 0) {
10749
+ return findings;
10750
+ }
10751
+ }
10752
+ return [input.summary ?? "Merged worktree"];
10753
+ };
10217
10754
  var listAllWorktreesInput = (input) => compactRecord4({
10218
10755
  status: input.status,
10219
10756
  lane: input.lane,
@@ -10221,6 +10758,16 @@ var listAllWorktreesInput = (input) => compactRecord4({
10221
10758
  limit: input.limit
10222
10759
  });
10223
10760
  var worktreesContracts = [
10761
+ surfaceContract({
10762
+ name: "begin_build_session",
10763
+ kind: "mutation",
10764
+ domain: "worktrees",
10765
+ surfaceClass: "platform_internal",
10766
+ path: "/mcp/build-session/begin",
10767
+ sdkNamespace: "worktrees",
10768
+ sdkMethod: "beginBuildSession",
10769
+ summary: "Begin a coding build session for a worktree."
10770
+ }),
10224
10771
  surfaceContract({
10225
10772
  name: "add_worktree",
10226
10773
  kind: "mutation",
@@ -10237,13 +10784,12 @@ var worktreesContracts = [
10237
10784
  inputProjection: (input, context) => withCreatedBy(
10238
10785
  compactRecord4({
10239
10786
  name: input.name ?? input.title,
10240
- topicId: input.topicId,
10787
+ topicId: input.topicId ?? input.projectId,
10241
10788
  worktreeType: input.worktreeType,
10242
10789
  objective: input.objective,
10243
10790
  gate: input.gate,
10244
10791
  hypothesis: input.hypothesis,
10245
10792
  rationale: input.rationale,
10246
- signal: input.signal,
10247
10793
  startDate: input.startDate,
10248
10794
  endDate: input.endDate,
10249
10795
  durationWeeks: input.durationWeeks,
@@ -10269,12 +10815,12 @@ var worktreesContracts = [
10269
10815
  staffingHint: input.staffingHint,
10270
10816
  domainPackId: input.domainPackId,
10271
10817
  lensId: input.lensId,
10272
- linkedQuestionId: input.linkedQuestionId,
10273
10818
  lastReconciledAt: input.lastReconciledAt
10274
10819
  }),
10275
10820
  context
10276
10821
  )
10277
- }
10822
+ },
10823
+ args: addWorktreeArgs
10278
10824
  }),
10279
10825
  surfaceContract({
10280
10826
  name: "activate_worktree",
@@ -10386,7 +10932,8 @@ var worktreesContracts = [
10386
10932
  functionName: "updateMetadata",
10387
10933
  kind: "mutation",
10388
10934
  inputProjection: worktreeMetadataInput
10389
- }
10935
+ },
10936
+ args: worktreeMetadataArgs
10390
10937
  }),
10391
10938
  surfaceContract({
10392
10939
  name: "merge",
@@ -10404,9 +10951,7 @@ var worktreesContracts = [
10404
10951
  inputProjection: (input, context) => withUserId(
10405
10952
  {
10406
10953
  ...worktreeIdInput(input),
10407
- keyFindings: input.keyFindings ?? [
10408
- input.summary ?? "Merged worktree"
10409
- ],
10954
+ keyFindings: mergeKeyFindingsInput(input),
10410
10955
  decisionsReached: input.decisionsReached ?? [],
10411
10956
  nextSteps: input.nextSteps ?? []
10412
10957
  },
@@ -10428,7 +10973,8 @@ var worktreesContracts = [
10428
10973
  functionName: "updateMetadata",
10429
10974
  kind: "mutation",
10430
10975
  inputProjection: worktreeMetadataInput
10431
- }
10976
+ },
10977
+ args: pushArgs
10432
10978
  }),
10433
10979
  surfaceContract({
10434
10980
  name: "open_pull_request",
@@ -10444,7 +10990,8 @@ var worktreesContracts = [
10444
10990
  functionName: "updateMetadata",
10445
10991
  kind: "mutation",
10446
10992
  inputProjection: worktreeMetadataInput
10447
- }
10993
+ },
10994
+ args: openPullRequestArgs
10448
10995
  })
10449
10996
  ];
10450
10997
 
@@ -10548,6 +11095,15 @@ var createEdgeArgs = z.object({
10548
11095
  topicId: z.string().optional(),
10549
11096
  trustedBypassAccessCheck: z.boolean().optional()
10550
11097
  });
11098
+ var queryLineageArgs = z.object({
11099
+ nodeId: z.string().describe("Starting node to trace from."),
11100
+ startNode: z.string().optional().describe("Starting node alias accepted by traversal callers."),
11101
+ depth: z.number().optional().describe("Traversal depth alias."),
11102
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11103
+ mode: z.string().optional().describe("Traversal mode."),
11104
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
11105
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
11106
+ });
10551
11107
  function graphRefNodeId(ref) {
10552
11108
  if (ref.kind === "epistemic_node") {
10553
11109
  return ref.nodeId;
@@ -10618,11 +11174,59 @@ var edgesContracts = [
10618
11174
  minLayer: input.minLayer,
10619
11175
  maxLayer: input.maxLayer
10620
11176
  })
10621
- }
11177
+ },
11178
+ args: queryLineageArgs
10622
11179
  })
10623
11180
  ];
10624
-
10625
- // ../contracts/src/function-registry/graph.ts
11181
+ var traversalLayerSchema = z.enum([
11182
+ "L4",
11183
+ "L3",
11184
+ "L2",
11185
+ "L1",
11186
+ "ontological",
11187
+ "organizational"
11188
+ ]);
11189
+ var traversalModeSchema = z.enum(["low", "medium", "high", "extra_high"]);
11190
+ var lineageAliasArgs = z.object({
11191
+ nodeId: z.string().optional().describe("Starting node to traverse from."),
11192
+ startNode: z.string().optional().describe("Starting node alias for traversal callers."),
11193
+ entityId: z.string().optional().describe("Entity identifier alias for impact tracing."),
11194
+ depth: z.number().optional().describe("Traversal depth alias."),
11195
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11196
+ mode: traversalModeSchema.optional().describe("Traversal mode."),
11197
+ minLayer: traversalLayerSchema.optional().describe("Minimum epistemic layer to include."),
11198
+ maxLayer: traversalLayerSchema.optional().describe("Maximum epistemic layer to include.")
11199
+ });
11200
+ var lineageArgs = lineageAliasArgs.extend({
11201
+ nodeId: z.string().describe("Starting node to traverse from.")
11202
+ });
11203
+ var traverseGraphArgs = lineageAliasArgs.extend({
11204
+ startNode: z.string().describe("Node to start traversal from."),
11205
+ direction: z.enum(["up", "down", "both"]).optional().describe("Traversal direction.")
11206
+ });
11207
+ var graphNeighborhoodArgs = z.object({
11208
+ globalId: z.string().optional().describe("Single root global ID."),
11209
+ globalIds: z.array(z.string()).optional().describe("Root global IDs for the neighborhood."),
11210
+ maxDepth: z.number().optional().describe("Maximum traversal depth."),
11211
+ topicId: z.string().optional().describe("Topic scope for edge lookup."),
11212
+ limit: z.number().optional().describe("Maximum edges to return.")
11213
+ });
11214
+ var flagContradictionArgs = z.object({
11215
+ beliefA: z.string().describe("First belief in tension."),
11216
+ beliefB: z.string().describe("Second belief in tension."),
11217
+ topicId: z.string().optional().describe("Topic scope for the contradiction."),
11218
+ description: z.string().optional().describe("Human-readable contradiction."),
11219
+ severity: z.enum(["critical", "high", "medium", "low"]).optional().describe("Contradiction severity."),
11220
+ defeatType: z.string().optional().describe("Defeat type annotation."),
11221
+ supportingInsightIds: z.array(z.string()).optional().describe("Evidence supporting the primary belief."),
11222
+ contradictingInsightIds: z.array(z.string()).optional().describe("Evidence or beliefs contradicting the primary belief.")
11223
+ });
11224
+ var discoverEntityConnectionsArgs = lineageAliasArgs.extend({
11225
+ nodeId: z.string().describe("Epistemic node ID to find entity connections for."),
11226
+ topicId: z.string().optional().describe("Topic scope override."),
11227
+ minScore: z.number().optional().describe("Minimum match score."),
11228
+ limit: z.number().optional().describe("Maximum candidates to return.")
11229
+ });
10626
11230
  var contradictionSeverity = (value) => {
10627
11231
  switch (value) {
10628
11232
  case "critical":
@@ -10677,7 +11281,8 @@ var graphContracts = [
10677
11281
  functionName: "getLineage",
10678
11282
  kind: "query",
10679
11283
  inputProjection: lineageInput
10680
- }
11284
+ },
11285
+ args: traverseGraphArgs
10681
11286
  }),
10682
11287
  surfaceContract({
10683
11288
  name: "get_graph_neighborhood",
@@ -10693,7 +11298,8 @@ var graphContracts = [
10693
11298
  functionName: "getByTopic",
10694
11299
  kind: "query",
10695
11300
  inputProjection: topicEdgesInput
10696
- }
11301
+ },
11302
+ args: graphNeighborhoodArgs
10697
11303
  }),
10698
11304
  surfaceContract({
10699
11305
  name: "get_graph_structure_analysis",
@@ -10742,7 +11348,8 @@ var graphContracts = [
10742
11348
  functionName: "create",
10743
11349
  kind: "mutation",
10744
11350
  inputProjection: flagContradictionInput
10745
- }
11351
+ },
11352
+ args: flagContradictionArgs
10746
11353
  }),
10747
11354
  surfaceContract({
10748
11355
  name: "detect_confirmation_bias",
@@ -10833,7 +11440,8 @@ var graphContracts = [
10833
11440
  functionName: "getLineage",
10834
11441
  kind: "query",
10835
11442
  inputProjection: lineageInput
10836
- }
11443
+ },
11444
+ args: discoverEntityConnectionsArgs
10837
11445
  }),
10838
11446
  surfaceContract({
10839
11447
  name: "trigger_belief_review",
@@ -10864,7 +11472,8 @@ var graphContracts = [
10864
11472
  functionName: "getLineage",
10865
11473
  kind: "query",
10866
11474
  inputProjection: lineageInput
10867
- }
11475
+ },
11476
+ args: lineageArgs
10868
11477
  })
10869
11478
  ];
10870
11479
 
@@ -10916,8 +11525,16 @@ var contractsContracts = [
10916
11525
  }
10917
11526
  })
10918
11527
  ];
10919
-
10920
- // ../contracts/src/function-registry/judgments.ts
11528
+ var auditTrailArgs = z.object({
11529
+ nodeId: z.string().describe("The node to audit."),
11530
+ id: z.string().optional().describe("Node ID alias."),
11531
+ limit: z.number().optional().describe("Maximum entries to return."),
11532
+ depth: z.number().optional().describe("Traversal depth alias."),
11533
+ maxDepth: z.number().optional().describe("Maximum lineage depth."),
11534
+ mode: z.string().optional().describe("Traversal mode."),
11535
+ minLayer: z.string().optional().describe("Minimum epistemic layer."),
11536
+ maxLayer: z.string().optional().describe("Maximum epistemic layer.")
11537
+ });
10921
11538
  var judgmentsContracts = [
10922
11539
  surfaceContract({
10923
11540
  name: "record_judgment",
@@ -10972,7 +11589,8 @@ var judgmentsContracts = [
10972
11589
  minLayer: input.minLayer,
10973
11590
  maxLayer: input.maxLayer
10974
11591
  })
10975
- }
11592
+ },
11593
+ args: auditTrailArgs
10976
11594
  })
10977
11595
  ];
10978
11596
 
@@ -11140,8 +11758,13 @@ var coordinationContracts = [
11140
11758
  }
11141
11759
  })
11142
11760
  ];
11143
-
11144
- // ../contracts/src/function-registry/pipeline.ts
11761
+ var pipelineSnapshotArgs = z.object({
11762
+ topicId: z.string().describe("Topic scope ID."),
11763
+ status: z.string().optional().describe("Worktree status filter."),
11764
+ lane: z.string().optional().describe("Campaign lane filter."),
11765
+ campaign: z.number().optional().describe("Campaign number filter."),
11766
+ limit: z.number().optional().describe("Maximum worktrees to inspect.")
11767
+ });
11145
11768
  var pipelineContracts = [
11146
11769
  surfaceContract({
11147
11770
  name: "pipeline_snapshot",
@@ -11162,7 +11785,8 @@ var pipelineContracts = [
11162
11785
  campaign: input.campaign,
11163
11786
  limit: input.limit
11164
11787
  })
11165
- }
11788
+ },
11789
+ args: pipelineSnapshotArgs
11166
11790
  }),
11167
11791
  surfaceContract({
11168
11792
  name: "seed_belief_lattice",
@@ -11214,7 +11838,31 @@ var recordScopeLearningArgs = z.object({
11214
11838
  rationale: z.string().optional().describe("Why this learning should enter the reasoning graph"),
11215
11839
  createQuestionText: z.string().optional().describe("Optional follow-up question text"),
11216
11840
  createBeliefText: z.string().optional().describe("Optional new belief text"),
11217
- beliefType: z.string().optional().describe("Optional belief type for createBeliefText")
11841
+ beliefType: z.string().optional().describe("Optional belief type for createBeliefText"),
11842
+ text: z.string().optional().describe("Canonical learning text alias."),
11843
+ content: z.string().optional().describe("Canonical learning content alias."),
11844
+ kind: z.string().optional().describe("Evidence kind to store."),
11845
+ sourceType: z.string().optional().describe("Evidence source type."),
11846
+ externalSourceType: z.string().optional().describe("External source type alias."),
11847
+ metadata: z.record(z.unknown()).optional().describe("Learning metadata.")
11848
+ });
11849
+ var codeContextArgs = z.object({
11850
+ topicId: z.string().optional().describe("Topic scope."),
11851
+ filePath: z.string().optional().describe("File path anchor."),
11852
+ includeFailures: z.boolean().optional().describe("Whether to include failed attempts."),
11853
+ limit: z.number().optional().describe("Maximum records to return."),
11854
+ status: z.string().optional().describe("Evidence status filter.")
11855
+ });
11856
+ var recordAttemptArgs = z.object({
11857
+ topicId: z.string().optional().describe("Topic scope."),
11858
+ description: z.string().describe("Attempt description."),
11859
+ errorMessage: z.string().optional().describe("Failure or error message."),
11860
+ filePaths: z.array(z.string()).optional().describe("Files involved in the attempt."),
11861
+ filePath: z.string().optional().describe("Single file path alias."),
11862
+ linkedBeliefId: z.string().optional().describe("Linked belief ID."),
11863
+ metadata: z.record(z.unknown()).optional().describe("Attempt metadata."),
11864
+ rationale: z.string().optional().describe("Why this attempt should be recorded."),
11865
+ title: z.string().optional().describe("Attempt evidence title.")
11218
11866
  });
11219
11867
  var learningInput = (input, context) => {
11220
11868
  const sourceKind = input.sourceKind ?? input.externalSourceType;
@@ -11331,7 +11979,8 @@ var codingContracts = [
11331
11979
  status: input.status,
11332
11980
  userId: input.userId
11333
11981
  })
11334
- }
11982
+ },
11983
+ args: codeContextArgs
11335
11984
  }),
11336
11985
  surfaceContract({
11337
11986
  name: "get_change_history",
@@ -11368,7 +12017,8 @@ var codingContracts = [
11368
12017
  functionName: "create",
11369
12018
  kind: "mutation",
11370
12019
  inputProjection: attemptInput
11371
- }
12020
+ },
12021
+ args: recordAttemptArgs
11372
12022
  }),
11373
12023
  surfaceContract({
11374
12024
  name: "get_failure_log",
@@ -11443,6 +12093,604 @@ new Map(
11443
12093
  ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
11444
12094
  );
11445
12095
 
12096
+ // ../contracts/src/tenant-bootstrap-seed.contract.ts
12097
+ function isCopyableSeedRequirement(entry) {
12098
+ 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;
12099
+ }
12100
+ var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
12101
+ {
12102
+ component: "kernel",
12103
+ table: "agentMessages",
12104
+ prepopulation: "runtime_data",
12105
+ copyMode: "none",
12106
+ description: "Agent coordination messages are session data, not template data."
12107
+ },
12108
+ {
12109
+ component: "kernel",
12110
+ table: "agentSessions",
12111
+ prepopulation: "runtime_data",
12112
+ copyMode: "none",
12113
+ description: "Agent coordination sessions are created by active clients."
12114
+ },
12115
+ {
12116
+ component: "kernel",
12117
+ table: "autofixJobs",
12118
+ prepopulation: "runtime_queue",
12119
+ copyMode: "none",
12120
+ description: "Autofix work items are runtime queue rows."
12121
+ },
12122
+ {
12123
+ component: "kernel",
12124
+ table: "backgroundJobRuns",
12125
+ prepopulation: "runtime_log",
12126
+ copyMode: "none",
12127
+ description: "Background job executions are runtime logs."
12128
+ },
12129
+ {
12130
+ component: "kernel",
12131
+ table: "backgroundJobSettings",
12132
+ prepopulation: "required_template",
12133
+ copyMode: "template_global",
12134
+ scope: "global",
12135
+ uniqueKey: ["jobKey"],
12136
+ description: "Default job enablement settings must come from the K template."
12137
+ },
12138
+ {
12139
+ component: "kernel",
12140
+ table: "beliefConfidence",
12141
+ prepopulation: "runtime_data",
12142
+ copyMode: "none",
12143
+ description: "Belief confidence rows are created with tenant graph facts."
12144
+ },
12145
+ {
12146
+ component: "kernel",
12147
+ table: "beliefEvidenceLinks",
12148
+ prepopulation: "runtime_data",
12149
+ copyMode: "none",
12150
+ description: "Belief-to-evidence links are tenant graph data."
12151
+ },
12152
+ {
12153
+ component: "kernel",
12154
+ table: "beliefHistory",
12155
+ prepopulation: "runtime_data",
12156
+ copyMode: "none",
12157
+ description: "Belief history is append-only tenant graph data."
12158
+ },
12159
+ {
12160
+ component: "kernel",
12161
+ table: "beliefScenarios",
12162
+ prepopulation: "runtime_data",
12163
+ copyMode: "none",
12164
+ description: "Scenario rows are tenant-authored reasoning data."
12165
+ },
12166
+ {
12167
+ component: "kernel",
12168
+ table: "beliefVotes",
12169
+ prepopulation: "runtime_data",
12170
+ copyMode: "none",
12171
+ description: "Decision belief votes are tenant-authored data."
12172
+ },
12173
+ {
12174
+ component: "kernel",
12175
+ table: "calibrationScores",
12176
+ prepopulation: "runtime_derived",
12177
+ copyMode: "none",
12178
+ description: "Calibration scores are computed from tenant outcomes."
12179
+ },
12180
+ {
12181
+ component: "kernel",
12182
+ table: "contractEvaluations",
12183
+ prepopulation: "runtime_log",
12184
+ copyMode: "none",
12185
+ description: "Contract evaluation rows are runtime computation logs."
12186
+ },
12187
+ {
12188
+ component: "kernel",
12189
+ table: "contradictions",
12190
+ prepopulation: "runtime_data",
12191
+ copyMode: "none",
12192
+ description: "Contradictions are tenant graph facts."
12193
+ },
12194
+ {
12195
+ component: "kernel",
12196
+ table: "crossProjectConnections",
12197
+ prepopulation: "runtime_data",
12198
+ copyMode: "none",
12199
+ description: "Cross-topic connections are tenant graph facts."
12200
+ },
12201
+ {
12202
+ component: "kernel",
12203
+ table: "decisionComputedSummaries",
12204
+ prepopulation: "runtime_derived",
12205
+ copyMode: "none",
12206
+ description: "Decision summaries are derived tenant outputs."
12207
+ },
12208
+ {
12209
+ component: "kernel",
12210
+ table: "decisionEvents",
12211
+ prepopulation: "runtime_data",
12212
+ copyMode: "none",
12213
+ description: "Decision events are lifecycle data."
12214
+ },
12215
+ {
12216
+ component: "kernel",
12217
+ table: "decisionParticipants",
12218
+ prepopulation: "runtime_data",
12219
+ copyMode: "none",
12220
+ description: "Decision participants are tenant-selected actors."
12221
+ },
12222
+ {
12223
+ component: "kernel",
12224
+ table: "decisionRiskLedger",
12225
+ prepopulation: "runtime_data",
12226
+ copyMode: "none",
12227
+ description: "Decision risk rows are tenant decision data."
12228
+ },
12229
+ {
12230
+ component: "kernel",
12231
+ table: "decisionSnapshots",
12232
+ prepopulation: "runtime_derived",
12233
+ copyMode: "none",
12234
+ description: "Decision snapshots are derived from tenant state."
12235
+ },
12236
+ {
12237
+ component: "kernel",
12238
+ table: "deliberationContributions",
12239
+ prepopulation: "runtime_data",
12240
+ copyMode: "none",
12241
+ description: "Deliberation contributions are tenant-authored data."
12242
+ },
12243
+ {
12244
+ component: "kernel",
12245
+ table: "deliberationSessions",
12246
+ prepopulation: "runtime_data",
12247
+ copyMode: "none",
12248
+ description: "Deliberation sessions are created by tenant workflows."
12249
+ },
12250
+ {
12251
+ component: "kernel",
12252
+ table: "epistemicAudit",
12253
+ prepopulation: "runtime_log",
12254
+ copyMode: "none",
12255
+ description: "Epistemic audit rows are append-only runtime audit data."
12256
+ },
12257
+ {
12258
+ component: "kernel",
12259
+ table: "epistemicContracts",
12260
+ prepopulation: "runtime_data",
12261
+ copyMode: "none",
12262
+ description: "Epistemic contracts are tenant-authored governance data."
12263
+ },
12264
+ {
12265
+ component: "kernel",
12266
+ table: "epistemicEdges",
12267
+ prepopulation: "runtime_data",
12268
+ copyMode: "none",
12269
+ description: "Edges are tenant reasoning graph data."
12270
+ },
12271
+ {
12272
+ component: "kernel",
12273
+ table: "epistemicNodeEmbeddings",
12274
+ prepopulation: "runtime_derived",
12275
+ copyMode: "none",
12276
+ description: "Embeddings are derived from tenant graph nodes."
12277
+ },
12278
+ {
12279
+ component: "kernel",
12280
+ table: "epistemicNodes",
12281
+ prepopulation: "runtime_data",
12282
+ copyMode: "none",
12283
+ description: "Nodes are tenant reasoning graph data."
12284
+ },
12285
+ {
12286
+ component: "kernel",
12287
+ table: "graphAnalysisCache",
12288
+ prepopulation: "runtime_derived",
12289
+ copyMode: "none",
12290
+ description: "Graph analysis cache rows are derived from tenant graph state."
12291
+ },
12292
+ {
12293
+ component: "kernel",
12294
+ table: "graphAnalysisResults",
12295
+ prepopulation: "runtime_derived",
12296
+ copyMode: "none",
12297
+ description: "Graph analysis result rows are derived tenant outputs."
12298
+ },
12299
+ {
12300
+ component: "kernel",
12301
+ table: "graphSuggestions",
12302
+ prepopulation: "runtime_derived",
12303
+ copyMode: "none",
12304
+ description: "Graph suggestions are derived recommendations."
12305
+ },
12306
+ {
12307
+ component: "kernel",
12308
+ table: "harnessReplays",
12309
+ prepopulation: "runtime_log",
12310
+ copyMode: "none",
12311
+ description: "Harness replay rows are runtime verification logs."
12312
+ },
12313
+ {
12314
+ component: "kernel",
12315
+ table: "harnessRuns",
12316
+ prepopulation: "runtime_log",
12317
+ copyMode: "none",
12318
+ description: "Harness run rows are runtime verification logs."
12319
+ },
12320
+ {
12321
+ component: "kernel",
12322
+ table: "idempotencyTokens",
12323
+ prepopulation: "runtime_log",
12324
+ copyMode: "none",
12325
+ description: "Idempotency tokens are request-scoped runtime guards."
12326
+ },
12327
+ {
12328
+ component: "kernel",
12329
+ table: "lenses",
12330
+ prepopulation: "optional_template",
12331
+ copyMode: "none",
12332
+ description: "Reusable lens templates may live in K templates, but workspace-specific copies are not required for core SDK boot."
12333
+ },
12334
+ {
12335
+ component: "kernel",
12336
+ table: "lensTopicBindings",
12337
+ prepopulation: "runtime_data",
12338
+ copyMode: "none",
12339
+ description: "Lens bindings attach runtime topics to runtime/workspace lenses."
12340
+ },
12341
+ {
12342
+ component: "kernel",
12343
+ table: "neo4jSyncQueue",
12344
+ prepopulation: "runtime_queue",
12345
+ copyMode: "none",
12346
+ description: "Neo4j sync queue rows are runtime work items."
12347
+ },
12348
+ {
12349
+ component: "kernel",
12350
+ table: "ontologyDefinitions",
12351
+ prepopulation: "required_template",
12352
+ copyMode: "template_global",
12353
+ scope: "global",
12354
+ uniqueKey: ["ontologyKey"],
12355
+ description: "Platform ontology definitions power taxonomy reads and effective ontology resolution."
12356
+ },
12357
+ {
12358
+ component: "kernel",
12359
+ table: "ontologyVersions",
12360
+ prepopulation: "required_template",
12361
+ copyMode: "template_reference_remap",
12362
+ scope: "global",
12363
+ uniqueKey: ["ontologyKey", "version"],
12364
+ dependsOn: ["ontologyDefinitions"],
12365
+ description: "Ontology versions must be copied with ontologyDefinition ID remapping."
12366
+ },
12367
+ {
12368
+ component: "kernel",
12369
+ table: "platformAgentRunPolicyDecisions",
12370
+ prepopulation: "runtime_log",
12371
+ copyMode: "none",
12372
+ description: "Agent-run policy decisions are audit logs."
12373
+ },
12374
+ {
12375
+ component: "kernel",
12376
+ table: "platformAgentRunPromptResolutions",
12377
+ prepopulation: "runtime_log",
12378
+ copyMode: "none",
12379
+ description: "Agent-run prompt resolution rows are runtime logs."
12380
+ },
12381
+ {
12382
+ component: "kernel",
12383
+ table: "platformAgentRuns",
12384
+ prepopulation: "runtime_log",
12385
+ copyMode: "none",
12386
+ description: "Agent runs are runtime execution records."
12387
+ },
12388
+ {
12389
+ component: "kernel",
12390
+ table: "platformAgentRunToolCalls",
12391
+ prepopulation: "runtime_log",
12392
+ copyMode: "none",
12393
+ description: "Agent-run tool calls are runtime execution records."
12394
+ },
12395
+ {
12396
+ component: "kernel",
12397
+ table: "platformHarnessShadowAudit",
12398
+ prepopulation: "runtime_log",
12399
+ copyMode: "none",
12400
+ description: "Harness shadow audit rows are runtime audit records."
12401
+ },
12402
+ {
12403
+ component: "kernel",
12404
+ table: "publicationRules",
12405
+ prepopulation: "required_template",
12406
+ copyMode: "template_tenant_rewrite",
12407
+ scope: "tenant",
12408
+ uniqueKey: ["tenantId", "workspaceId", "name"],
12409
+ description: "Default publication policy rules are rewritten into each tenant."
12410
+ },
12411
+ {
12412
+ component: "kernel",
12413
+ table: "questionEvidenceLinks",
12414
+ prepopulation: "runtime_data",
12415
+ copyMode: "none",
12416
+ description: "Question-to-evidence links are tenant graph data."
12417
+ },
12418
+ {
12419
+ component: "kernel",
12420
+ table: "researchJobs",
12421
+ prepopulation: "runtime_queue",
12422
+ copyMode: "none",
12423
+ description: "Research job rows are runtime queue items."
12424
+ },
12425
+ {
12426
+ component: "kernel",
12427
+ table: "schemaEnumConfig",
12428
+ prepopulation: "required_template",
12429
+ copyMode: "template_global",
12430
+ scope: "global",
12431
+ uniqueKey: ["category", "value"],
12432
+ description: "Runtime-extensible enum defaults required by SDK graph APIs."
12433
+ },
12434
+ {
12435
+ component: "kernel",
12436
+ table: "stakeholderGroups",
12437
+ prepopulation: "runtime_data",
12438
+ copyMode: "none",
12439
+ description: "Stakeholder groups are tenant decision data."
12440
+ },
12441
+ {
12442
+ component: "kernel",
12443
+ table: "systemLogs",
12444
+ prepopulation: "runtime_log",
12445
+ copyMode: "none",
12446
+ description: "System logs are runtime telemetry."
12447
+ },
12448
+ {
12449
+ component: "kernel",
12450
+ table: "tasks",
12451
+ prepopulation: "runtime_data",
12452
+ copyMode: "none",
12453
+ description: "Tasks are tenant-authored work items."
12454
+ },
12455
+ {
12456
+ component: "kernel",
12457
+ table: "topics",
12458
+ prepopulation: "runtime_bootstrap",
12459
+ copyMode: "none",
12460
+ description: "Default topics are created by tenant provisioning, not copied from templates."
12461
+ },
12462
+ {
12463
+ component: "kernel",
12464
+ table: "workflowDefinitions",
12465
+ prepopulation: "optional_template",
12466
+ copyMode: "none",
12467
+ description: "Table-driven workflow definitions can be template data after the workflow engine leaves legacy mode."
12468
+ },
12469
+ {
12470
+ component: "kernel",
12471
+ table: "workflowPullRequests",
12472
+ prepopulation: "runtime_data",
12473
+ copyMode: "none",
12474
+ description: "Workflow pull requests are tenant workflow data."
12475
+ },
12476
+ {
12477
+ component: "kernel",
12478
+ table: "workflowStages",
12479
+ prepopulation: "optional_template",
12480
+ copyMode: "none",
12481
+ dependsOn: ["workflowDefinitions"],
12482
+ description: "Workflow stages can be template data after workflowDefinitions are enabled for bootstrap copying."
12483
+ },
12484
+ {
12485
+ component: "kernel",
12486
+ table: "worktreeBeliefCluster",
12487
+ prepopulation: "runtime_data",
12488
+ copyMode: "none",
12489
+ description: "Worktree cluster rows link runtime worktrees to runtime beliefs."
12490
+ },
12491
+ {
12492
+ component: "kernel",
12493
+ table: "worktrees",
12494
+ prepopulation: "runtime_data",
12495
+ copyMode: "none",
12496
+ description: "Worktrees are tenant/runtime planning data."
12497
+ },
12498
+ {
12499
+ component: "identity",
12500
+ table: "agents",
12501
+ prepopulation: "runtime_bootstrap",
12502
+ copyMode: "none",
12503
+ description: "Service agents are provisioned per tenant or service, not copied."
12504
+ },
12505
+ {
12506
+ component: "identity",
12507
+ table: "mcpWritePolicy",
12508
+ prepopulation: "required_template",
12509
+ copyMode: "template_global",
12510
+ scope: "global",
12511
+ uniqueKey: ["topicId", "role", "toolCategory"],
12512
+ description: "Global write policy defaults govern service and interactive MCP writes."
12513
+ },
12514
+ {
12515
+ component: "identity",
12516
+ table: "modelCallLogs",
12517
+ prepopulation: "runtime_log",
12518
+ copyMode: "none",
12519
+ description: "Model call logs are runtime telemetry."
12520
+ },
12521
+ {
12522
+ component: "identity",
12523
+ table: "modelFunctionSlots",
12524
+ prepopulation: "required_template",
12525
+ copyMode: "template_global",
12526
+ scope: "global",
12527
+ uniqueKey: ["slot"],
12528
+ description: "Function-to-model slots are required by model runtime resolution."
12529
+ },
12530
+ {
12531
+ component: "identity",
12532
+ table: "modelRegistry",
12533
+ prepopulation: "required_template",
12534
+ copyMode: "template_global",
12535
+ scope: "global",
12536
+ uniqueKey: ["key"],
12537
+ description: "Model catalog defaults are required by model runtime clients."
12538
+ },
12539
+ {
12540
+ component: "identity",
12541
+ table: "modelSlotConfigs",
12542
+ prepopulation: "required_template",
12543
+ copyMode: "template_global",
12544
+ scope: "global",
12545
+ uniqueKey: ["slot"],
12546
+ description: "Slot-level defaults are required before tenant overrides exist."
12547
+ },
12548
+ {
12549
+ component: "identity",
12550
+ table: "platformAudienceGrants",
12551
+ prepopulation: "runtime_data",
12552
+ copyMode: "none",
12553
+ description: "Audience grants are principal/group-specific access rows."
12554
+ },
12555
+ {
12556
+ component: "identity",
12557
+ table: "platformAudiences",
12558
+ prepopulation: "required_template",
12559
+ copyMode: "template_tenant_rewrite",
12560
+ scope: "tenant",
12561
+ uniqueKey: ["tenantId", "workspaceId", "audienceKey"],
12562
+ description: "Default tenant audience taxonomy rows are rewritten into each tenant."
12563
+ },
12564
+ {
12565
+ component: "identity",
12566
+ table: "platformPolicyDecisionLogs",
12567
+ prepopulation: "runtime_log",
12568
+ copyMode: "none",
12569
+ description: "Policy decisions are runtime audit logs."
12570
+ },
12571
+ {
12572
+ component: "identity",
12573
+ table: "projectGrants",
12574
+ prepopulation: "runtime_data",
12575
+ copyMode: "none",
12576
+ description: "Project/topic grants are principal or group-specific access rows."
12577
+ },
12578
+ {
12579
+ component: "identity",
12580
+ table: "reasoningPermissions",
12581
+ prepopulation: "runtime_data",
12582
+ copyMode: "none",
12583
+ description: "Reasoning permissions are principal-specific policy rows."
12584
+ },
12585
+ {
12586
+ component: "identity",
12587
+ table: "tenantApiKeys",
12588
+ prepopulation: "runtime_secret",
12589
+ copyMode: "none",
12590
+ description: "API keys are tenant credentials and must never be copied."
12591
+ },
12592
+ {
12593
+ component: "identity",
12594
+ table: "tenantConfig",
12595
+ prepopulation: "required_template",
12596
+ copyMode: "template_tenant_rewrite",
12597
+ scope: "tenant",
12598
+ uniqueKey: ["tenantId"],
12599
+ description: "Tenant-local config defaults are rewritten during bootstrap."
12600
+ },
12601
+ {
12602
+ component: "identity",
12603
+ table: "tenantIntegrations",
12604
+ prepopulation: "required_template",
12605
+ copyMode: "template_tenant_rewrite",
12606
+ scope: "tenant",
12607
+ uniqueKey: ["tenantId", "integrationKey"],
12608
+ description: "Non-secret integration descriptors are rewritten into each tenant."
12609
+ },
12610
+ {
12611
+ component: "identity",
12612
+ table: "tenantModelSlotBindings",
12613
+ prepopulation: "runtime_secret",
12614
+ copyMode: "none",
12615
+ description: "Tenant model slot bindings reference provider secrets and are runtime-only."
12616
+ },
12617
+ {
12618
+ component: "identity",
12619
+ table: "tenantPolicies",
12620
+ prepopulation: "required_template",
12621
+ copyMode: "template_tenant_rewrite",
12622
+ scope: "tenant",
12623
+ uniqueKey: ["tenantId", "workspaceId", "roleName"],
12624
+ description: "Default tenant policy roles are rewritten during bootstrap."
12625
+ },
12626
+ {
12627
+ component: "identity",
12628
+ table: "tenantProviderSecrets",
12629
+ prepopulation: "runtime_secret",
12630
+ copyMode: "none",
12631
+ description: "Provider secrets are credentials and must never be copied."
12632
+ },
12633
+ {
12634
+ component: "identity",
12635
+ table: "tenantProxyGatewayUsage",
12636
+ prepopulation: "runtime_log",
12637
+ copyMode: "none",
12638
+ description: "Proxy gateway usage rows are runtime telemetry."
12639
+ },
12640
+ {
12641
+ component: "identity",
12642
+ table: "tenantProxyTokenMints",
12643
+ prepopulation: "runtime_secret",
12644
+ copyMode: "none",
12645
+ description: "Proxy token mints are ephemeral secret-bearing runtime rows."
12646
+ },
12647
+ {
12648
+ component: "identity",
12649
+ table: "tenantSandboxAuditEvents",
12650
+ prepopulation: "runtime_log",
12651
+ copyMode: "none",
12652
+ description: "Sandbox audit rows are runtime security logs."
12653
+ },
12654
+ {
12655
+ component: "identity",
12656
+ table: "tenantSecrets",
12657
+ prepopulation: "runtime_secret",
12658
+ copyMode: "none",
12659
+ description: "Tenant secrets are credentials and must never be copied."
12660
+ },
12661
+ {
12662
+ component: "identity",
12663
+ table: "toolAcls",
12664
+ prepopulation: "required_template",
12665
+ copyMode: "template_global",
12666
+ scope: "global",
12667
+ uniqueKey: ["role", "toolName"],
12668
+ description: "Default role-to-tool grants are required for SDK/MCP tool access."
12669
+ },
12670
+ {
12671
+ component: "identity",
12672
+ table: "toolRegistry",
12673
+ prepopulation: "required_template",
12674
+ copyMode: "template_global",
12675
+ scope: "global",
12676
+ uniqueKey: ["toolName"],
12677
+ description: "Core tool catalog rows are required before pack or tenant tools exist."
12678
+ },
12679
+ {
12680
+ component: "identity",
12681
+ table: "users",
12682
+ prepopulation: "runtime_bootstrap",
12683
+ copyMode: "none",
12684
+ description: "Users are created from Clerk/MC principal resolution, not copied."
12685
+ }
12686
+ ];
12687
+ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
12688
+ isCopyableSeedRequirement
12689
+ );
12690
+ TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
12691
+ (entry) => !isCopyableSeedRequirement(entry)
12692
+ ).map((entry) => entry.table);
12693
+
11446
12694
  export { DOMAIN_EVENT_TYPES, DOMAIN_EVENT_VERSION, EVENT_RETENTION_DEFAULT_DAYS, WEBHOOK_MAX_ATTEMPTS, WEBHOOK_RETRY_DELAYS_MS };
11447
12695
  //# sourceMappingURL=types.js.map
11448
12696
  //# sourceMappingURL=types.js.map