@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/outbox.js CHANGED
@@ -1940,6 +1940,40 @@ defineTable({
1940
1940
  { kind: "index", name: "by_tier_window_end", columns: ["tier", "windowEndMs"] }
1941
1941
  ]
1942
1942
  });
1943
+ defineTable({
1944
+ name: "oauthDeviceCodes",
1945
+ component: "mc",
1946
+ category: "identity",
1947
+ shape: z.object({
1948
+ "deviceCodeHash": z.string(),
1949
+ "userCode": z.string(),
1950
+ "clientId": z.string(),
1951
+ "scope": z.string(),
1952
+ "status": z.enum(["pending", "approved", "denied", "expired", "consumed"]),
1953
+ "expiresAt": z.number(),
1954
+ "intervalSeconds": z.number(),
1955
+ "lastPolledAt": z.number().optional(),
1956
+ "slowDownCount": z.number().optional(),
1957
+ "clerkUserId": z.string().optional(),
1958
+ "tenantId": idOf("tenants").optional(),
1959
+ "workspaceId": z.string().optional(),
1960
+ "principalId": z.string().optional(),
1961
+ "role": z.string().optional(),
1962
+ "scopes": z.array(z.string()).optional(),
1963
+ "sessionId": z.string().optional(),
1964
+ "approvedAt": z.number().optional(),
1965
+ "deniedAt": z.number().optional(),
1966
+ "consumedAt": z.number().optional(),
1967
+ "createdAt": z.number(),
1968
+ "updatedAt": z.number()
1969
+ }),
1970
+ indices: [
1971
+ { kind: "index", name: "by_deviceCodeHash", columns: ["deviceCodeHash"] },
1972
+ { kind: "index", name: "by_userCode", columns: ["userCode"] },
1973
+ { kind: "index", name: "by_status_expiresAt", columns: ["status", "expiresAt"] },
1974
+ { kind: "index", name: "by_sessionId", columns: ["sessionId"] }
1975
+ ]
1976
+ });
1943
1977
  defineTable({
1944
1978
  name: "servicePrincipalKeys",
1945
1979
  component: "mc",
@@ -3896,7 +3930,9 @@ defineTable({
3896
3930
  "defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
3897
3931
  "deployments": z.record(z.object({
3898
3932
  "url": z.string(),
3899
- "encryptedDeployKey": z.string()
3933
+ "target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
3934
+ "encryptedDeployKey": z.string().optional(),
3935
+ "credentialRef": z.string().optional()
3900
3936
  })).optional(),
3901
3937
  "metadata": z.record(z.any()).optional(),
3902
3938
  "createdBy": z.string().optional(),
@@ -5093,6 +5129,14 @@ var ADD_WORKTREE = {
5093
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.",
5094
5130
  parameters: {
5095
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
+ },
5096
5140
  topicId: { type: "string", description: "Optional topic scope hint" },
5097
5141
  branchId: {
5098
5142
  type: "string",
@@ -5106,14 +5150,87 @@ var ADD_WORKTREE = {
5106
5150
  type: "string",
5107
5151
  description: "The testable claim this worktree investigates"
5108
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
+ },
5109
5186
  beliefIds: {
5110
5187
  type: "array",
5111
- 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"
5112
5225
  },
5113
5226
  autoShape: {
5114
5227
  type: "boolean",
5115
5228
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
5116
5229
  },
5230
+ autoFixPolicy: {
5231
+ type: "object",
5232
+ description: "Policy for permitted automatic remediation inside the worktree"
5233
+ },
5117
5234
  domainPackId: {
5118
5235
  type: "string",
5119
5236
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
@@ -5142,9 +5259,17 @@ var ADD_WORKTREE = {
5142
5259
  type: "array",
5143
5260
  description: "Worktree IDs blocked by this worktree"
5144
5261
  },
5145
- gate: {
5262
+ staffingHint: {
5146
5263
  type: "string",
5147
- 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"
5148
5273
  }
5149
5274
  },
5150
5275
  required: ["title", "topicId"],
@@ -5174,7 +5299,7 @@ var MERGE = {
5174
5299
  worktreeId: { type: "string", description: "The worktree to merge" },
5175
5300
  outcomes: {
5176
5301
  type: "array",
5177
- 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 }"
5178
5303
  },
5179
5304
  summary: { type: "string", description: "Overall findings summary" }
5180
5305
  },
@@ -8193,6 +8318,69 @@ var GENERATE_SESSION_HANDOFF = {
8193
8318
  tier: "showcase",
8194
8319
  internal: true
8195
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
+ };
8196
8384
  var MCP_TOOL_CONTRACTS = {
8197
8385
  // Belief lifecycle (commit, amend, fork, archive)
8198
8386
  create_belief: CREATE_BELIEF,
@@ -8286,6 +8474,7 @@ var MCP_TOOL_CONTRACTS = {
8286
8474
  get_agent_inbox: GET_AGENT_INBOX,
8287
8475
  claim_files: CLAIM_FILES,
8288
8476
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
8477
+ begin_build_session: BEGIN_BUILD_SESSION,
8289
8478
  // Policy / ACL (workhorse)
8290
8479
  check_permission: CHECK_PERMISSION,
8291
8480
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -8499,6 +8688,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
8499
8688
  "get_change_history",
8500
8689
  "get_failure_log",
8501
8690
  "record_attempt",
8691
+ "begin_build_session",
8502
8692
  "push",
8503
8693
  "open_pull_request",
8504
8694
  "record_judgment",
@@ -8553,7 +8743,6 @@ var SDK_ONLY_OPERATION_NAMES = [
8553
8743
  "find_semantic_orphans"
8554
8744
  ];
8555
8745
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
8556
- "begin_build_session",
8557
8746
  "evaluate_engineering_contract",
8558
8747
  "evaluate_research_contract"
8559
8748
  ];
@@ -8939,8 +9128,31 @@ function assertSurfaceCoverage(contracts) {
8939
9128
  }
8940
9129
  }
8941
9130
  }
8942
-
8943
- // ../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
+ });
8944
9156
  var observationInput = (input, context) => withUserId(
8945
9157
  compactRecord4({
8946
9158
  projectId: input.projectId,
@@ -8999,7 +9211,8 @@ var contextContracts = [
8999
9211
  observationId: output && typeof output === "object" ? output.nodeId : void 0,
9000
9212
  observationType: input.observationType
9001
9213
  })
9002
- }
9214
+ },
9215
+ args: observationArgs
9003
9216
  }),
9004
9217
  surfaceContract({
9005
9218
  name: "get_observation_context",
@@ -9020,7 +9233,8 @@ var contextContracts = [
9020
9233
  status: input.status,
9021
9234
  userId: input.userId
9022
9235
  })
9023
- }
9236
+ },
9237
+ args: observationContextArgs
9024
9238
  })
9025
9239
  ];
9026
9240
 
@@ -9083,8 +9297,45 @@ var identityContracts = [
9083
9297
  }
9084
9298
  })
9085
9299
  ];
9086
-
9087
- // ../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
+ });
9088
9339
  var beliefLookupInput = (input) => compactRecord4({
9089
9340
  nodeId: input.nodeId ?? input.id ?? input.beliefId,
9090
9341
  beliefId: input.beliefId
@@ -9159,7 +9410,8 @@ var beliefsContracts = [
9159
9410
  functionName: "create",
9160
9411
  kind: "mutation",
9161
9412
  inputProjection: createBeliefInput
9162
- }
9413
+ },
9414
+ args: createBeliefArgs
9163
9415
  }),
9164
9416
  surfaceContract({
9165
9417
  name: "get_belief",
@@ -9250,7 +9502,8 @@ var beliefsContracts = [
9250
9502
  functionName: "forkBelief",
9251
9503
  kind: "mutation",
9252
9504
  inputProjection: forkBeliefInput
9253
- }
9505
+ },
9506
+ args: forkBeliefArgs
9254
9507
  }),
9255
9508
  surfaceContract({
9256
9509
  name: "archive_belief",
@@ -9331,8 +9584,46 @@ var beliefsContracts = [
9331
9584
  }
9332
9585
  })
9333
9586
  ];
9334
-
9335
- // ../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
+ });
9336
9627
  var evidenceIdInput = (input) => compactRecord4({
9337
9628
  evidenceId: input.evidenceId,
9338
9629
  insightId: input.insightId,
@@ -9407,7 +9698,8 @@ var evidenceContracts = [
9407
9698
  functionName: "create",
9408
9699
  kind: "mutation",
9409
9700
  inputProjection: createEvidenceInput
9410
- }
9701
+ },
9702
+ args: createEvidenceArgs
9411
9703
  }),
9412
9704
  surfaceContract({
9413
9705
  name: "add_evidence",
@@ -9443,7 +9735,8 @@ var evidenceContracts = [
9443
9735
  context
9444
9736
  );
9445
9737
  }
9446
- }
9738
+ },
9739
+ args: addEvidenceArgs
9447
9740
  }),
9448
9741
  surfaceContract({
9449
9742
  name: "get_evidence",
@@ -9550,8 +9843,91 @@ var evidenceContracts = [
9550
9843
  }
9551
9844
  })
9552
9845
  ];
9553
-
9554
- // ../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
+ });
9555
9931
  var questionNodeInput = (input) => compactRecord4({
9556
9932
  nodeId: input.nodeId ?? input.id ?? input.questionId,
9557
9933
  questionId: input.questionId
@@ -9598,7 +9974,8 @@ var questionsContracts = [
9598
9974
  functionName: "create",
9599
9975
  kind: "mutation",
9600
9976
  inputProjection: createQuestionInput
9601
- }
9977
+ },
9978
+ args: createQuestionArgs
9602
9979
  }),
9603
9980
  surfaceContract({
9604
9981
  name: "get_question",
@@ -9654,7 +10031,8 @@ var questionsContracts = [
9654
10031
  category: input.category,
9655
10032
  priority: input.priority
9656
10033
  })
9657
- }
10034
+ },
10035
+ args: refineQuestionArgs
9658
10036
  }),
9659
10037
  surfaceContract({
9660
10038
  name: "update_question_status",
@@ -9730,7 +10108,8 @@ var questionsContracts = [
9730
10108
  }),
9731
10109
  context
9732
10110
  )
9733
- }
10111
+ },
10112
+ args: createAnswerArgs
9734
10113
  }),
9735
10114
  surfaceContract({
9736
10115
  name: "answer_question",
@@ -9759,7 +10138,8 @@ var questionsContracts = [
9759
10138
  }),
9760
10139
  context
9761
10140
  )
9762
- }
10141
+ },
10142
+ args: answerQuestionArgs
9763
10143
  }),
9764
10144
  surfaceContract({
9765
10145
  name: "get_answer",
@@ -9791,7 +10171,8 @@ var questionsContracts = [
9791
10171
  functionName: "getByTopic",
9792
10172
  kind: "query",
9793
10173
  inputProjection: questionTopicInput
9794
- }
10174
+ },
10175
+ args: missingQuestionsArgs
9795
10176
  }),
9796
10177
  surfaceContract({
9797
10178
  name: "get_high_priority_questions",
@@ -9826,11 +10207,22 @@ var questionsContracts = [
9826
10207
  functionName: "getByTopic",
9827
10208
  kind: "query",
9828
10209
  inputProjection: questionTopicInput
9829
- }
10210
+ },
10211
+ args: falsificationQuestionsArgs
9830
10212
  })
9831
10213
  ];
9832
-
9833
- // ../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
+ });
9834
10226
  var topicIdInput = (input) => compactRecord4({
9835
10227
  id: input.id ?? input.topicId
9836
10228
  });
@@ -9911,7 +10303,8 @@ var topicsContracts = [
9911
10303
  functionName: "update",
9912
10304
  kind: "mutation",
9913
10305
  inputProjection: updateTopicInput
9914
- }
10306
+ },
10307
+ args: updateTopicArgs
9915
10308
  }),
9916
10309
  surfaceContract({
9917
10310
  name: "get_topic_tree",
@@ -9930,8 +10323,27 @@ var topicsContracts = [
9930
10323
  }
9931
10324
  })
9932
10325
  ];
9933
-
9934
- // ../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
+ });
9935
10347
  var createLensInput = (input, context) => compactRecord4({
9936
10348
  name: input.name,
9937
10349
  description: input.description,
@@ -9968,7 +10380,8 @@ var lensesContracts = [
9968
10380
  functionName: "create",
9969
10381
  kind: "mutation",
9970
10382
  inputProjection: createLensInput
9971
- }
10383
+ },
10384
+ args: createLensArgs
9972
10385
  }),
9973
10386
  surfaceContract({
9974
10387
  name: "list_lenses",
@@ -10030,8 +10443,18 @@ var lensesContracts = [
10030
10443
  }
10031
10444
  })
10032
10445
  ];
10033
-
10034
- // ../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
+ });
10035
10458
  var ontologyIdInput = (input) => compactRecord4({
10036
10459
  id: input.id ?? input.ontologyId
10037
10460
  });
@@ -10110,11 +10533,11 @@ var ontologiesContracts = [
10110
10533
  id: input.id ?? input.ontologyId,
10111
10534
  name: input.name,
10112
10535
  description: input.description,
10113
- parentOntologyId: input.parentOntologyId,
10114
10536
  status: input.status,
10115
10537
  actorId: input.actorId
10116
10538
  })
10117
- }
10539
+ },
10540
+ args: updateOntologyArgs
10118
10541
  }),
10119
10542
  surfaceContract({
10120
10543
  name: "archive_ontology",
@@ -10197,7 +10620,8 @@ var ontologiesContracts = [
10197
10620
  functionName: "publishOntologyVersion",
10198
10621
  kind: "mutation",
10199
10622
  inputProjection: ontologyVersionIdInput
10200
- }
10623
+ },
10624
+ args: ontologyVersionLifecycleArgs
10201
10625
  }),
10202
10626
  surfaceContract({
10203
10627
  name: "deprecate_ontology_version",
@@ -10213,7 +10637,8 @@ var ontologiesContracts = [
10213
10637
  functionName: "deprecateOntologyVersion",
10214
10638
  kind: "mutation",
10215
10639
  inputProjection: ontologyVersionIdInput
10216
- }
10640
+ },
10641
+ args: ontologyVersionLifecycleArgs
10217
10642
  }),
10218
10643
  surfaceContract({
10219
10644
  name: "resolve_effective_ontology",
@@ -10232,8 +10657,76 @@ var ontologiesContracts = [
10232
10657
  }
10233
10658
  })
10234
10659
  ];
10235
-
10236
- // ../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
+ });
10237
10730
  var worktreeIdInput = (input) => compactRecord4({
10238
10731
  worktreeId: input.worktreeId ?? input.id
10239
10732
  });
@@ -10266,6 +10759,50 @@ var worktreeMetadataInput = (input) => compactRecord4({
10266
10759
  autoFixPolicy: input.autoFixPolicy,
10267
10760
  lastReconciledAt: input.lastReconciledAt
10268
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
+ };
10269
10806
  var listAllWorktreesInput = (input) => compactRecord4({
10270
10807
  status: input.status,
10271
10808
  lane: input.lane,
@@ -10273,6 +10810,16 @@ var listAllWorktreesInput = (input) => compactRecord4({
10273
10810
  limit: input.limit
10274
10811
  });
10275
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
+ }),
10276
10823
  surfaceContract({
10277
10824
  name: "add_worktree",
10278
10825
  kind: "mutation",
@@ -10289,13 +10836,12 @@ var worktreesContracts = [
10289
10836
  inputProjection: (input, context) => withCreatedBy(
10290
10837
  compactRecord4({
10291
10838
  name: input.name ?? input.title,
10292
- topicId: input.topicId,
10839
+ topicId: input.topicId ?? input.projectId,
10293
10840
  worktreeType: input.worktreeType,
10294
10841
  objective: input.objective,
10295
10842
  gate: input.gate,
10296
10843
  hypothesis: input.hypothesis,
10297
10844
  rationale: input.rationale,
10298
- signal: input.signal,
10299
10845
  startDate: input.startDate,
10300
10846
  endDate: input.endDate,
10301
10847
  durationWeeks: input.durationWeeks,
@@ -10321,12 +10867,12 @@ var worktreesContracts = [
10321
10867
  staffingHint: input.staffingHint,
10322
10868
  domainPackId: input.domainPackId,
10323
10869
  lensId: input.lensId,
10324
- linkedQuestionId: input.linkedQuestionId,
10325
10870
  lastReconciledAt: input.lastReconciledAt
10326
10871
  }),
10327
10872
  context
10328
10873
  )
10329
- }
10874
+ },
10875
+ args: addWorktreeArgs
10330
10876
  }),
10331
10877
  surfaceContract({
10332
10878
  name: "activate_worktree",
@@ -10438,7 +10984,8 @@ var worktreesContracts = [
10438
10984
  functionName: "updateMetadata",
10439
10985
  kind: "mutation",
10440
10986
  inputProjection: worktreeMetadataInput
10441
- }
10987
+ },
10988
+ args: worktreeMetadataArgs
10442
10989
  }),
10443
10990
  surfaceContract({
10444
10991
  name: "merge",
@@ -10456,9 +11003,7 @@ var worktreesContracts = [
10456
11003
  inputProjection: (input, context) => withUserId(
10457
11004
  {
10458
11005
  ...worktreeIdInput(input),
10459
- keyFindings: input.keyFindings ?? [
10460
- input.summary ?? "Merged worktree"
10461
- ],
11006
+ keyFindings: mergeKeyFindingsInput(input),
10462
11007
  decisionsReached: input.decisionsReached ?? [],
10463
11008
  nextSteps: input.nextSteps ?? []
10464
11009
  },
@@ -10480,7 +11025,8 @@ var worktreesContracts = [
10480
11025
  functionName: "updateMetadata",
10481
11026
  kind: "mutation",
10482
11027
  inputProjection: worktreeMetadataInput
10483
- }
11028
+ },
11029
+ args: pushArgs
10484
11030
  }),
10485
11031
  surfaceContract({
10486
11032
  name: "open_pull_request",
@@ -10496,7 +11042,8 @@ var worktreesContracts = [
10496
11042
  functionName: "updateMetadata",
10497
11043
  kind: "mutation",
10498
11044
  inputProjection: worktreeMetadataInput
10499
- }
11045
+ },
11046
+ args: openPullRequestArgs
10500
11047
  })
10501
11048
  ];
10502
11049
 
@@ -10600,6 +11147,15 @@ var createEdgeArgs = z.object({
10600
11147
  topicId: z.string().optional(),
10601
11148
  trustedBypassAccessCheck: z.boolean().optional()
10602
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
+ });
10603
11159
  function graphRefNodeId(ref) {
10604
11160
  if (ref.kind === "epistemic_node") {
10605
11161
  return ref.nodeId;
@@ -10670,11 +11226,59 @@ var edgesContracts = [
10670
11226
  minLayer: input.minLayer,
10671
11227
  maxLayer: input.maxLayer
10672
11228
  })
10673
- }
11229
+ },
11230
+ args: queryLineageArgs
10674
11231
  })
10675
11232
  ];
10676
-
10677
- // ../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
+ });
10678
11282
  var contradictionSeverity = (value) => {
10679
11283
  switch (value) {
10680
11284
  case "critical":
@@ -10729,7 +11333,8 @@ var graphContracts = [
10729
11333
  functionName: "getLineage",
10730
11334
  kind: "query",
10731
11335
  inputProjection: lineageInput
10732
- }
11336
+ },
11337
+ args: traverseGraphArgs
10733
11338
  }),
10734
11339
  surfaceContract({
10735
11340
  name: "get_graph_neighborhood",
@@ -10745,7 +11350,8 @@ var graphContracts = [
10745
11350
  functionName: "getByTopic",
10746
11351
  kind: "query",
10747
11352
  inputProjection: topicEdgesInput
10748
- }
11353
+ },
11354
+ args: graphNeighborhoodArgs
10749
11355
  }),
10750
11356
  surfaceContract({
10751
11357
  name: "get_graph_structure_analysis",
@@ -10794,7 +11400,8 @@ var graphContracts = [
10794
11400
  functionName: "create",
10795
11401
  kind: "mutation",
10796
11402
  inputProjection: flagContradictionInput
10797
- }
11403
+ },
11404
+ args: flagContradictionArgs
10798
11405
  }),
10799
11406
  surfaceContract({
10800
11407
  name: "detect_confirmation_bias",
@@ -10885,7 +11492,8 @@ var graphContracts = [
10885
11492
  functionName: "getLineage",
10886
11493
  kind: "query",
10887
11494
  inputProjection: lineageInput
10888
- }
11495
+ },
11496
+ args: discoverEntityConnectionsArgs
10889
11497
  }),
10890
11498
  surfaceContract({
10891
11499
  name: "trigger_belief_review",
@@ -10916,7 +11524,8 @@ var graphContracts = [
10916
11524
  functionName: "getLineage",
10917
11525
  kind: "query",
10918
11526
  inputProjection: lineageInput
10919
- }
11527
+ },
11528
+ args: lineageArgs
10920
11529
  })
10921
11530
  ];
10922
11531
 
@@ -10968,8 +11577,16 @@ var contractsContracts = [
10968
11577
  }
10969
11578
  })
10970
11579
  ];
10971
-
10972
- // ../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
+ });
10973
11590
  var judgmentsContracts = [
10974
11591
  surfaceContract({
10975
11592
  name: "record_judgment",
@@ -11024,7 +11641,8 @@ var judgmentsContracts = [
11024
11641
  minLayer: input.minLayer,
11025
11642
  maxLayer: input.maxLayer
11026
11643
  })
11027
- }
11644
+ },
11645
+ args: auditTrailArgs
11028
11646
  })
11029
11647
  ];
11030
11648
 
@@ -11192,8 +11810,13 @@ var coordinationContracts = [
11192
11810
  }
11193
11811
  })
11194
11812
  ];
11195
-
11196
- // ../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
+ });
11197
11820
  var pipelineContracts = [
11198
11821
  surfaceContract({
11199
11822
  name: "pipeline_snapshot",
@@ -11214,7 +11837,8 @@ var pipelineContracts = [
11214
11837
  campaign: input.campaign,
11215
11838
  limit: input.limit
11216
11839
  })
11217
- }
11840
+ },
11841
+ args: pipelineSnapshotArgs
11218
11842
  }),
11219
11843
  surfaceContract({
11220
11844
  name: "seed_belief_lattice",
@@ -11266,7 +11890,31 @@ var recordScopeLearningArgs = z.object({
11266
11890
  rationale: z.string().optional().describe("Why this learning should enter the reasoning graph"),
11267
11891
  createQuestionText: z.string().optional().describe("Optional follow-up question text"),
11268
11892
  createBeliefText: z.string().optional().describe("Optional new belief text"),
11269
- 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.")
11270
11918
  });
11271
11919
  var learningInput = (input, context) => {
11272
11920
  const sourceKind = input.sourceKind ?? input.externalSourceType;
@@ -11383,7 +12031,8 @@ var codingContracts = [
11383
12031
  status: input.status,
11384
12032
  userId: input.userId
11385
12033
  })
11386
- }
12034
+ },
12035
+ args: codeContextArgs
11387
12036
  }),
11388
12037
  surfaceContract({
11389
12038
  name: "get_change_history",
@@ -11420,7 +12069,8 @@ var codingContracts = [
11420
12069
  functionName: "create",
11421
12070
  kind: "mutation",
11422
12071
  inputProjection: attemptInput
11423
- }
12072
+ },
12073
+ args: recordAttemptArgs
11424
12074
  }),
11425
12075
  surfaceContract({
11426
12076
  name: "get_failure_log",
@@ -11495,6 +12145,604 @@ new Map(
11495
12145
  ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
11496
12146
  );
11497
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
+
11498
12746
  export { buildDomainEvent, compareEventCursor, createEventId, decodeEventCursor, emitDomainEvent, encodeEventCursor, inferActorType, isAfterCursor, normalizeRetentionDays, sortEventsByCursor };
11499
12747
  //# sourceMappingURL=outbox.js.map
11500
12748
  //# sourceMappingURL=outbox.js.map