@lucern/mcp 0.3.0-alpha.3 → 0.3.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +18970 -16917
- package/dist/cli.js.map +1 -1
- package/dist/gateway.d.ts +7 -1
- package/dist/gateway.js +1615 -87
- package/dist/gateway.js.map +1 -1
- package/dist/hosted-route.js +2631 -1050
- package/dist/hosted-route.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +19091 -17033
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +1416 -100
- package/dist/runtime.js.map +1 -1
- package/package.json +6 -6
package/dist/runtime.js
CHANGED
|
@@ -4040,7 +4040,9 @@ defineTable({
|
|
|
4040
4040
|
"defaultProjectVisibility": z.enum(["private", "team", "firm", "external", "public"]).optional(),
|
|
4041
4041
|
"deployments": z.record(z.object({
|
|
4042
4042
|
"url": z.string(),
|
|
4043
|
-
"
|
|
4043
|
+
"target": z.enum(["kernelDeployment", "appDeployment"]).optional(),
|
|
4044
|
+
"encryptedDeployKey": z.string().optional(),
|
|
4045
|
+
"credentialRef": z.string().optional()
|
|
4044
4046
|
})).optional(),
|
|
4045
4047
|
"metadata": z.record(z.any()).optional(),
|
|
4046
4048
|
"createdBy": z.string().optional(),
|
|
@@ -5305,6 +5307,14 @@ var ADD_WORKTREE = {
|
|
|
5305
5307
|
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.",
|
|
5306
5308
|
parameters: {
|
|
5307
5309
|
title: { type: "string", description: "Worktree name/objective" },
|
|
5310
|
+
name: {
|
|
5311
|
+
type: "string",
|
|
5312
|
+
description: "Optional storage-name alias for callers that already use backend naming"
|
|
5313
|
+
},
|
|
5314
|
+
projectId: {
|
|
5315
|
+
type: "string",
|
|
5316
|
+
description: "Legacy topicId alias"
|
|
5317
|
+
},
|
|
5308
5318
|
topicId: { type: "string", description: "Optional topic scope hint" },
|
|
5309
5319
|
branchId: {
|
|
5310
5320
|
type: "string",
|
|
@@ -5318,14 +5328,87 @@ var ADD_WORKTREE = {
|
|
|
5318
5328
|
type: "string",
|
|
5319
5329
|
description: "The testable claim this worktree investigates"
|
|
5320
5330
|
},
|
|
5331
|
+
rationale: {
|
|
5332
|
+
type: "string",
|
|
5333
|
+
description: "Why this worktree exists and why it belongs in the campaign"
|
|
5334
|
+
},
|
|
5335
|
+
worktreeType: {
|
|
5336
|
+
type: "string",
|
|
5337
|
+
description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
|
|
5338
|
+
},
|
|
5339
|
+
gate: {
|
|
5340
|
+
type: "string",
|
|
5341
|
+
description: "Exit gate name for this worktree"
|
|
5342
|
+
},
|
|
5343
|
+
startDate: {
|
|
5344
|
+
type: "number",
|
|
5345
|
+
description: "Planned start timestamp in milliseconds since epoch"
|
|
5346
|
+
},
|
|
5347
|
+
endDate: {
|
|
5348
|
+
type: "number",
|
|
5349
|
+
description: "Planned end timestamp in milliseconds since epoch"
|
|
5350
|
+
},
|
|
5351
|
+
durationWeeks: {
|
|
5352
|
+
type: "number",
|
|
5353
|
+
description: "Planned duration in weeks"
|
|
5354
|
+
},
|
|
5355
|
+
confidenceImpact: {
|
|
5356
|
+
type: "string",
|
|
5357
|
+
description: "Expected confidence impact if the worktree succeeds",
|
|
5358
|
+
enum: ["high", "medium", "low"]
|
|
5359
|
+
},
|
|
5360
|
+
beliefFocus: {
|
|
5361
|
+
type: "string",
|
|
5362
|
+
description: "Natural-language focus spanning the target belief neighborhood"
|
|
5363
|
+
},
|
|
5321
5364
|
beliefIds: {
|
|
5322
5365
|
type: "array",
|
|
5323
|
-
description: "
|
|
5366
|
+
description: "Legacy alias for targetBeliefIds"
|
|
5367
|
+
},
|
|
5368
|
+
beliefs: {
|
|
5369
|
+
type: "array",
|
|
5370
|
+
description: "Legacy alias for targetBeliefIds"
|
|
5371
|
+
},
|
|
5372
|
+
targetBeliefIds: {
|
|
5373
|
+
type: "array",
|
|
5374
|
+
description: "Belief node IDs this worktree is expected to test or update"
|
|
5375
|
+
},
|
|
5376
|
+
targetQuestionIds: {
|
|
5377
|
+
type: "array",
|
|
5378
|
+
description: "Question node IDs this worktree is expected to answer"
|
|
5379
|
+
},
|
|
5380
|
+
keyQuestions: {
|
|
5381
|
+
type: "array",
|
|
5382
|
+
description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
|
|
5383
|
+
},
|
|
5384
|
+
evidenceSignals: {
|
|
5385
|
+
type: "array",
|
|
5386
|
+
description: "Evidence signal objects with signal, optional collected state, progress, and notes"
|
|
5387
|
+
},
|
|
5388
|
+
decisionGate: {
|
|
5389
|
+
type: "object",
|
|
5390
|
+
description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
|
|
5391
|
+
},
|
|
5392
|
+
goCriteria: {
|
|
5393
|
+
type: "array",
|
|
5394
|
+
description: "Shorthand go criteria used to build decisionGate"
|
|
5395
|
+
},
|
|
5396
|
+
noGoSignals: {
|
|
5397
|
+
type: "array",
|
|
5398
|
+
description: "Shorthand no-go signals used to build decisionGate"
|
|
5399
|
+
},
|
|
5400
|
+
proofArtifacts: {
|
|
5401
|
+
type: "array",
|
|
5402
|
+
description: "Expected proof artifacts required to close the worktree"
|
|
5324
5403
|
},
|
|
5325
5404
|
autoShape: {
|
|
5326
5405
|
type: "boolean",
|
|
5327
5406
|
description: "Whether to invoke inquiry auto-shaping during worktree creation"
|
|
5328
5407
|
},
|
|
5408
|
+
autoFixPolicy: {
|
|
5409
|
+
type: "object",
|
|
5410
|
+
description: "Policy for permitted automatic remediation inside the worktree"
|
|
5411
|
+
},
|
|
5329
5412
|
domainPackId: {
|
|
5330
5413
|
type: "string",
|
|
5331
5414
|
description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
|
|
@@ -5354,9 +5437,17 @@ var ADD_WORKTREE = {
|
|
|
5354
5437
|
type: "array",
|
|
5355
5438
|
description: "Worktree IDs blocked by this worktree"
|
|
5356
5439
|
},
|
|
5357
|
-
|
|
5440
|
+
staffingHint: {
|
|
5358
5441
|
type: "string",
|
|
5359
|
-
description: "
|
|
5442
|
+
description: "Suggested staffing or agent allocation note"
|
|
5443
|
+
},
|
|
5444
|
+
lensId: {
|
|
5445
|
+
type: "string",
|
|
5446
|
+
description: "Lens that scopes this worktree when applicable"
|
|
5447
|
+
},
|
|
5448
|
+
lastReconciledAt: {
|
|
5449
|
+
type: "number",
|
|
5450
|
+
description: "Timestamp when worktree metadata was last reconciled"
|
|
5360
5451
|
}
|
|
5361
5452
|
},
|
|
5362
5453
|
required: ["title", "topicId"],
|
|
@@ -5386,7 +5477,7 @@ var MERGE = {
|
|
|
5386
5477
|
worktreeId: { type: "string", description: "The worktree to merge" },
|
|
5387
5478
|
outcomes: {
|
|
5388
5479
|
type: "array",
|
|
5389
|
-
description: "
|
|
5480
|
+
description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
|
|
5390
5481
|
},
|
|
5391
5482
|
summary: { type: "string", description: "Overall findings summary" }
|
|
5392
5483
|
},
|
|
@@ -8405,6 +8496,69 @@ var GENERATE_SESSION_HANDOFF = {
|
|
|
8405
8496
|
tier: "showcase",
|
|
8406
8497
|
internal: true
|
|
8407
8498
|
};
|
|
8499
|
+
var BEGIN_BUILD_SESSION = {
|
|
8500
|
+
name: "begin_build_session",
|
|
8501
|
+
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.",
|
|
8502
|
+
parameters: {
|
|
8503
|
+
worktreeId: {
|
|
8504
|
+
type: "string",
|
|
8505
|
+
description: "The Lucern worktree ID to bootstrap."
|
|
8506
|
+
},
|
|
8507
|
+
branch: {
|
|
8508
|
+
type: "string",
|
|
8509
|
+
description: "Optional git branch name. Auto-generated from the worktree name when omitted."
|
|
8510
|
+
},
|
|
8511
|
+
branchBase: {
|
|
8512
|
+
type: "string",
|
|
8513
|
+
description: 'Base branch for the feature branch. Default: "staging".'
|
|
8514
|
+
},
|
|
8515
|
+
prBase: {
|
|
8516
|
+
type: "string",
|
|
8517
|
+
description: 'Target branch for the PR. Default: "staging".'
|
|
8518
|
+
},
|
|
8519
|
+
sessionMode: {
|
|
8520
|
+
type: "string",
|
|
8521
|
+
description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
|
|
8522
|
+
enum: ["async", "interactive"]
|
|
8523
|
+
},
|
|
8524
|
+
activateIfPlanning: {
|
|
8525
|
+
type: "boolean",
|
|
8526
|
+
description: "When true, automatically activate a planning worktree during bootstrap."
|
|
8527
|
+
}
|
|
8528
|
+
},
|
|
8529
|
+
required: ["worktreeId"],
|
|
8530
|
+
response: {
|
|
8531
|
+
description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
|
|
8532
|
+
fields: {
|
|
8533
|
+
topicId: "string \u2014 canonical topic scope",
|
|
8534
|
+
topicName: "string \u2014 human-readable topic name",
|
|
8535
|
+
worktreeId: "string \u2014 worktree ID",
|
|
8536
|
+
worktreeName: "string \u2014 human-readable worktree name",
|
|
8537
|
+
branch: "string \u2014 git branch name",
|
|
8538
|
+
branchBase: "string \u2014 base branch",
|
|
8539
|
+
prBase: "string \u2014 PR target branch",
|
|
8540
|
+
campaign: "number | null \u2014 top-level pipeline campaign",
|
|
8541
|
+
lane: "string \u2014 campaign lane",
|
|
8542
|
+
gate: "string \u2014 exit gate",
|
|
8543
|
+
hypothesis: "string \u2014 worktree hypothesis",
|
|
8544
|
+
focus: "string \u2014 session focus",
|
|
8545
|
+
status: "string \u2014 worktree status after optional activation",
|
|
8546
|
+
sessionMode: "string \u2014 async | interactive",
|
|
8547
|
+
targetBeliefIds: "array \u2014 scoped belief IDs",
|
|
8548
|
+
targetQuestionIds: "array \u2014 scoped question IDs",
|
|
8549
|
+
topBeliefs: "array \u2014 highest-confidence scoped beliefs",
|
|
8550
|
+
openQuestions: "array \u2014 open scoped questions",
|
|
8551
|
+
resolvedDecisions: "array \u2014 answered questions summarized for the session",
|
|
8552
|
+
dependencies: "array \u2014 upstream worktrees",
|
|
8553
|
+
unblocks: "array \u2014 downstream worktrees",
|
|
8554
|
+
mergeOrderNotes: "string \u2014 merge ordering advisory"
|
|
8555
|
+
}
|
|
8556
|
+
},
|
|
8557
|
+
ownerModule: "bootstrap",
|
|
8558
|
+
ontologyPrimitive: "worktree",
|
|
8559
|
+
tier: "showcase",
|
|
8560
|
+
internal: true
|
|
8561
|
+
};
|
|
8408
8562
|
var MCP_TOOL_CONTRACTS = {
|
|
8409
8563
|
// Belief lifecycle (commit, amend, fork, archive)
|
|
8410
8564
|
create_belief: CREATE_BELIEF,
|
|
@@ -8498,6 +8652,7 @@ var MCP_TOOL_CONTRACTS = {
|
|
|
8498
8652
|
get_agent_inbox: GET_AGENT_INBOX,
|
|
8499
8653
|
claim_files: CLAIM_FILES,
|
|
8500
8654
|
generate_session_handoff: GENERATE_SESSION_HANDOFF,
|
|
8655
|
+
begin_build_session: BEGIN_BUILD_SESSION,
|
|
8501
8656
|
// Policy / ACL (workhorse)
|
|
8502
8657
|
check_permission: CHECK_PERMISSION,
|
|
8503
8658
|
filter_by_permission: FILTER_BY_PERMISSION,
|
|
@@ -8711,6 +8866,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
|
|
|
8711
8866
|
"get_change_history",
|
|
8712
8867
|
"get_failure_log",
|
|
8713
8868
|
"record_attempt",
|
|
8869
|
+
"begin_build_session",
|
|
8714
8870
|
"push",
|
|
8715
8871
|
"open_pull_request",
|
|
8716
8872
|
"record_judgment",
|
|
@@ -8765,7 +8921,6 @@ var SDK_ONLY_OPERATION_NAMES = [
|
|
|
8765
8921
|
"find_semantic_orphans"
|
|
8766
8922
|
];
|
|
8767
8923
|
var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
|
|
8768
|
-
"begin_build_session",
|
|
8769
8924
|
"evaluate_engineering_contract",
|
|
8770
8925
|
"evaluate_research_contract"
|
|
8771
8926
|
];
|
|
@@ -9151,8 +9306,31 @@ function assertSurfaceCoverage(contracts) {
|
|
|
9151
9306
|
}
|
|
9152
9307
|
}
|
|
9153
9308
|
}
|
|
9154
|
-
|
|
9155
|
-
|
|
9309
|
+
var jsonRecordSchema2 = z.record(z.unknown());
|
|
9310
|
+
var observationArgs = z.object({
|
|
9311
|
+
topicId: z.string().optional().describe("Topic scope for the observation."),
|
|
9312
|
+
summary: z.string().describe("Short observation summary."),
|
|
9313
|
+
text: z.string().optional().describe("Canonical observation text alias."),
|
|
9314
|
+
title: z.string().optional().describe("Optional observation title."),
|
|
9315
|
+
content: z.string().optional().describe("Optional rich observation content."),
|
|
9316
|
+
contentType: z.string().optional().describe("Observation content type."),
|
|
9317
|
+
kind: z.string().optional().describe("Evidence kind to store."),
|
|
9318
|
+
observationType: z.string().optional().describe("Observation type."),
|
|
9319
|
+
tags: z.array(z.string()).optional().describe("Observation tags."),
|
|
9320
|
+
source: z.string().optional().describe("Observation source label."),
|
|
9321
|
+
sourceType: z.string().optional().describe("Evidence source type."),
|
|
9322
|
+
externalSourceType: z.string().optional().describe("External source type for imported observations."),
|
|
9323
|
+
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
9324
|
+
confidence: z.number().optional().describe("Observation confidence."),
|
|
9325
|
+
metadata: jsonRecordSchema2.optional().describe("Observation metadata."),
|
|
9326
|
+
rationale: z.string().optional().describe("Why this observation should be recorded.")
|
|
9327
|
+
});
|
|
9328
|
+
var observationContextArgs = z.object({
|
|
9329
|
+
topicId: z.string().describe("Topic scope."),
|
|
9330
|
+
query: z.string().optional().describe("Optional context query."),
|
|
9331
|
+
limit: z.number().optional().describe("Maximum observations to return."),
|
|
9332
|
+
status: z.string().optional().describe("Observation status filter.")
|
|
9333
|
+
});
|
|
9156
9334
|
var observationInput = (input, context) => withUserId(
|
|
9157
9335
|
compactRecord4({
|
|
9158
9336
|
projectId: input.projectId,
|
|
@@ -9211,7 +9389,8 @@ var contextContracts = [
|
|
|
9211
9389
|
observationId: output && typeof output === "object" ? output.nodeId : void 0,
|
|
9212
9390
|
observationType: input.observationType
|
|
9213
9391
|
})
|
|
9214
|
-
}
|
|
9392
|
+
},
|
|
9393
|
+
args: observationArgs
|
|
9215
9394
|
}),
|
|
9216
9395
|
surfaceContract({
|
|
9217
9396
|
name: "get_observation_context",
|
|
@@ -9232,7 +9411,8 @@ var contextContracts = [
|
|
|
9232
9411
|
status: input.status,
|
|
9233
9412
|
userId: input.userId
|
|
9234
9413
|
})
|
|
9235
|
-
}
|
|
9414
|
+
},
|
|
9415
|
+
args: observationContextArgs
|
|
9236
9416
|
})
|
|
9237
9417
|
];
|
|
9238
9418
|
|
|
@@ -9295,8 +9475,45 @@ var identityContracts = [
|
|
|
9295
9475
|
}
|
|
9296
9476
|
})
|
|
9297
9477
|
];
|
|
9298
|
-
|
|
9299
|
-
|
|
9478
|
+
var jsonRecordSchema3 = z.record(z.unknown());
|
|
9479
|
+
var sourceTypeSchema = z.enum(["human", "ai_extracted", "ai_generated"]);
|
|
9480
|
+
var reversibilitySchema = z.enum([
|
|
9481
|
+
"irreversible",
|
|
9482
|
+
"hard_to_reverse",
|
|
9483
|
+
"reversible",
|
|
9484
|
+
"trivial"
|
|
9485
|
+
]);
|
|
9486
|
+
var predictionMetaSchema = z.object({
|
|
9487
|
+
isPrediction: z.boolean().describe("Whether this belief is a prediction."),
|
|
9488
|
+
registeredAt: z.number().describe("Timestamp when the prediction was registered."),
|
|
9489
|
+
expectedBy: z.number().optional().describe("Timestamp when the prediction should be evaluated.")
|
|
9490
|
+
});
|
|
9491
|
+
var createBeliefArgs = z.object({
|
|
9492
|
+
canonicalText: z.string().describe("The belief statement the agent holds to be true."),
|
|
9493
|
+
topicId: z.string().optional().describe("Topic scope hint for the belief."),
|
|
9494
|
+
baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
|
|
9495
|
+
beliefType: z.string().optional().describe("Schema belief type."),
|
|
9496
|
+
metadata: jsonRecordSchema3.optional().describe("Extra metadata merged into the belief node."),
|
|
9497
|
+
rationale: z.string().optional().describe("Why this belief should enter the reasoning graph."),
|
|
9498
|
+
pillar: z.string().optional().describe("Innovation pillar or product pillar associated with the belief."),
|
|
9499
|
+
worktreeId: z.string().optional().describe("Worktree responsible for creating or testing this belief."),
|
|
9500
|
+
sourceBeliefIds: z.array(z.string()).optional().describe("Source belief IDs this belief derives from."),
|
|
9501
|
+
sourceType: sourceTypeSchema.optional().describe("Actor/source class that produced the belief."),
|
|
9502
|
+
reversibility: reversibilitySchema.optional().describe("How reversible the belief's implied decision is."),
|
|
9503
|
+
predictionMeta: predictionMetaSchema.optional().describe("Prediction lifecycle metadata when this belief is a forecast.")
|
|
9504
|
+
});
|
|
9505
|
+
var forkBeliefArgs = z.object({
|
|
9506
|
+
nodeId: z.string().describe("The scored belief to fork from."),
|
|
9507
|
+
newFormulation: z.string().describe("The evolved belief statement."),
|
|
9508
|
+
forkReason: z.enum([
|
|
9509
|
+
"refinement",
|
|
9510
|
+
"contradiction_response",
|
|
9511
|
+
"scope_change",
|
|
9512
|
+
"confidence_collapse",
|
|
9513
|
+
"manual"
|
|
9514
|
+
]).describe("Why this fork was created."),
|
|
9515
|
+
rationale: z.string().optional().describe("Why the fork is warranted.")
|
|
9516
|
+
});
|
|
9300
9517
|
var beliefLookupInput = (input) => compactRecord4({
|
|
9301
9518
|
nodeId: input.nodeId ?? input.id ?? input.beliefId,
|
|
9302
9519
|
beliefId: input.beliefId
|
|
@@ -9371,7 +9588,8 @@ var beliefsContracts = [
|
|
|
9371
9588
|
functionName: "create",
|
|
9372
9589
|
kind: "mutation",
|
|
9373
9590
|
inputProjection: createBeliefInput
|
|
9374
|
-
}
|
|
9591
|
+
},
|
|
9592
|
+
args: createBeliefArgs
|
|
9375
9593
|
}),
|
|
9376
9594
|
surfaceContract({
|
|
9377
9595
|
name: "get_belief",
|
|
@@ -9462,7 +9680,8 @@ var beliefsContracts = [
|
|
|
9462
9680
|
functionName: "forkBelief",
|
|
9463
9681
|
kind: "mutation",
|
|
9464
9682
|
inputProjection: forkBeliefInput
|
|
9465
|
-
}
|
|
9683
|
+
},
|
|
9684
|
+
args: forkBeliefArgs
|
|
9466
9685
|
}),
|
|
9467
9686
|
surfaceContract({
|
|
9468
9687
|
name: "archive_belief",
|
|
@@ -9543,8 +9762,46 @@ var beliefsContracts = [
|
|
|
9543
9762
|
}
|
|
9544
9763
|
})
|
|
9545
9764
|
];
|
|
9546
|
-
|
|
9547
|
-
|
|
9765
|
+
var jsonRecordSchema4 = z.record(z.unknown());
|
|
9766
|
+
var evidenceRelationSchema = z.enum(["supports", "contradicts", "neutral"]);
|
|
9767
|
+
var createEvidenceArgs = z.object({
|
|
9768
|
+
topicId: z.string().optional().describe("Topic scope for the evidence."),
|
|
9769
|
+
text: z.string().describe("Canonical evidence text."),
|
|
9770
|
+
source: z.string().optional().describe("Source URL or source label."),
|
|
9771
|
+
sourceUrl: z.string().optional().describe("Canonical source URL."),
|
|
9772
|
+
targetId: z.string().optional().describe("Belief or question identifier to link immediately."),
|
|
9773
|
+
linkedBeliefNodeId: z.string().optional().describe("Belief node this evidence bears on."),
|
|
9774
|
+
evidenceRelation: evidenceRelationSchema.optional().describe("How the evidence relates to the linked belief."),
|
|
9775
|
+
confidence: z.number().optional().describe("Confidence in the evidence relation."),
|
|
9776
|
+
weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
|
|
9777
|
+
metadata: jsonRecordSchema4.optional().describe("Metadata merged into the canonical evidence node."),
|
|
9778
|
+
rationale: z.string().describe("Why this evidence should enter the reasoning graph."),
|
|
9779
|
+
reasoning: z.string().optional().describe("Reasoning note preserved in evidence metadata."),
|
|
9780
|
+
title: z.string().optional().describe("Optional short title."),
|
|
9781
|
+
content: z.string().optional().describe("Optional long-form content."),
|
|
9782
|
+
contentType: z.string().optional().describe("Content format or MIME hint."),
|
|
9783
|
+
kind: z.string().optional().describe("Evidence kind."),
|
|
9784
|
+
tags: z.array(z.string()).optional().describe("Evidence tags."),
|
|
9785
|
+
sourceType: z.string().optional().describe("Evidence source type."),
|
|
9786
|
+
externalSourceType: z.string().optional().describe("External source type for imported evidence."),
|
|
9787
|
+
sourceQuestionId: z.string().optional().describe("Question that sourced this evidence."),
|
|
9788
|
+
methodology: z.string().optional().describe("Collection methodology."),
|
|
9789
|
+
informationAsymmetry: z.string().optional().describe("Information asymmetry class."),
|
|
9790
|
+
sourceDescription: z.string().optional().describe("Human-readable source description.")
|
|
9791
|
+
});
|
|
9792
|
+
var addEvidenceArgs = z.object({
|
|
9793
|
+
canonicalText: z.string().describe("The evidence statement."),
|
|
9794
|
+
text: z.string().optional().describe("Canonical evidence text alias used by newer callers."),
|
|
9795
|
+
topicId: z.string().optional().describe("Topic scope hint."),
|
|
9796
|
+
sourceUrl: z.string().optional().describe("URL of the source material."),
|
|
9797
|
+
targetNodeId: z.string().describe("The belief this evidence bears on."),
|
|
9798
|
+
weight: z.number().optional().describe("Support weight from -1.0 to +1.0."),
|
|
9799
|
+
reasoning: z.string().describe("Why this evidence is relevant to the target belief."),
|
|
9800
|
+
title: z.string().optional().describe("Optional short title."),
|
|
9801
|
+
content: z.string().optional().describe("Optional long-form evidence content."),
|
|
9802
|
+
contentType: z.string().optional().describe("Content format or MIME hint."),
|
|
9803
|
+
metadata: jsonRecordSchema4.optional().describe("Optional metadata merged into the evidence node.")
|
|
9804
|
+
});
|
|
9548
9805
|
var evidenceIdInput = (input) => compactRecord4({
|
|
9549
9806
|
evidenceId: input.evidenceId,
|
|
9550
9807
|
insightId: input.insightId,
|
|
@@ -9619,7 +9876,8 @@ var evidenceContracts = [
|
|
|
9619
9876
|
functionName: "create",
|
|
9620
9877
|
kind: "mutation",
|
|
9621
9878
|
inputProjection: createEvidenceInput
|
|
9622
|
-
}
|
|
9879
|
+
},
|
|
9880
|
+
args: createEvidenceArgs
|
|
9623
9881
|
}),
|
|
9624
9882
|
surfaceContract({
|
|
9625
9883
|
name: "add_evidence",
|
|
@@ -9655,7 +9913,8 @@ var evidenceContracts = [
|
|
|
9655
9913
|
context
|
|
9656
9914
|
);
|
|
9657
9915
|
}
|
|
9658
|
-
}
|
|
9916
|
+
},
|
|
9917
|
+
args: addEvidenceArgs
|
|
9659
9918
|
}),
|
|
9660
9919
|
surfaceContract({
|
|
9661
9920
|
name: "get_evidence",
|
|
@@ -9762,8 +10021,91 @@ var evidenceContracts = [
|
|
|
9762
10021
|
}
|
|
9763
10022
|
})
|
|
9764
10023
|
];
|
|
9765
|
-
|
|
9766
|
-
|
|
10024
|
+
var jsonRecordSchema5 = z.record(z.unknown());
|
|
10025
|
+
var questionPrioritySchema = z.enum(["urgent", "high", "medium", "low"]);
|
|
10026
|
+
var kernelQuestionPrioritySchema = z.enum([
|
|
10027
|
+
"critical",
|
|
10028
|
+
"high",
|
|
10029
|
+
"medium",
|
|
10030
|
+
"low"
|
|
10031
|
+
]);
|
|
10032
|
+
var questionTypeSchema = z.enum([
|
|
10033
|
+
"validation",
|
|
10034
|
+
"falsification",
|
|
10035
|
+
"assumption_probe",
|
|
10036
|
+
"prediction_test",
|
|
10037
|
+
"counterfactual",
|
|
10038
|
+
"discovery",
|
|
10039
|
+
"clarification",
|
|
10040
|
+
"comparison",
|
|
10041
|
+
"causal",
|
|
10042
|
+
"mechanism",
|
|
10043
|
+
"general"
|
|
10044
|
+
]);
|
|
10045
|
+
var createQuestionArgs = z.object({
|
|
10046
|
+
text: z.string().describe("The question text."),
|
|
10047
|
+
question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
|
|
10048
|
+
topicId: z.string().optional().describe("Topic scope hint."),
|
|
10049
|
+
priority: questionPrioritySchema.optional().describe("Human-facing question priority."),
|
|
10050
|
+
linkedBeliefId: z.string().optional().describe("Belief this question tests."),
|
|
10051
|
+
linkedBeliefNodeId: z.string().optional().describe("Belief node this question tests."),
|
|
10052
|
+
metadata: jsonRecordSchema5.optional().describe("Optional metadata merged into the question record."),
|
|
10053
|
+
category: z.string().optional().describe("Question category."),
|
|
10054
|
+
source: z.string().optional().describe("Question source."),
|
|
10055
|
+
testType: z.enum(["validates", "invalidates", "clarifies"]).optional().describe("How this question tests its linked belief."),
|
|
10056
|
+
importance: z.number().optional().describe("Numeric importance score."),
|
|
10057
|
+
epistemicUnlock: z.string().optional().describe("What this question unlocks if answered."),
|
|
10058
|
+
sourceQuestionIds: z.array(z.string()).optional().describe("Question IDs this question derives from."),
|
|
10059
|
+
linkedWorktreeId: z.string().optional().describe("Worktree this question belongs to."),
|
|
10060
|
+
questionType: questionTypeSchema.optional().describe("Question type."),
|
|
10061
|
+
questionPriority: kernelQuestionPrioritySchema.optional().describe("Kernel-native question priority.")
|
|
10062
|
+
});
|
|
10063
|
+
var refineQuestionArgs = z.object({
|
|
10064
|
+
id: z.string().describe("The question to refine."),
|
|
10065
|
+
text: z.string().describe("Updated question text."),
|
|
10066
|
+
question: z.string().optional().describe("Backend question text alias for kernel-native callers."),
|
|
10067
|
+
rationale: z.string().optional().describe("Why the question is refined."),
|
|
10068
|
+
category: z.string().optional().describe("Updated question category."),
|
|
10069
|
+
priority: questionPrioritySchema.optional().describe("Updated human-facing priority.")
|
|
10070
|
+
});
|
|
10071
|
+
var createAnswerArgs = z.object({
|
|
10072
|
+
questionNodeId: z.string().describe("The question node ID this answer responds to."),
|
|
10073
|
+
questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
|
|
10074
|
+
answerText: z.string().describe("The answer content."),
|
|
10075
|
+
topicId: z.string().optional().describe("Topic scope for the answer."),
|
|
10076
|
+
confidence: z.string().optional().describe("Answer confidence."),
|
|
10077
|
+
evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node IDs supporting the answer."),
|
|
10078
|
+
answerSource: z.string().optional().describe("How the answer was produced."),
|
|
10079
|
+
worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
|
|
10080
|
+
sprintId: z.string().optional().describe("Legacy sprint identifier.")
|
|
10081
|
+
});
|
|
10082
|
+
var answerQuestionArgs = z.object({
|
|
10083
|
+
id: z.string().describe("Canonical question ID."),
|
|
10084
|
+
topicId: z.string().describe("Topic scope for the answer."),
|
|
10085
|
+
text: z.string().describe("Answer text."),
|
|
10086
|
+
confidence: z.enum(["weak", "medium", "strong"]).optional().describe("Optional answer confidence."),
|
|
10087
|
+
evidenceIds: z.array(z.string()).optional().describe("Canonical evidence IDs supporting the answer."),
|
|
10088
|
+
rationale: z.string().optional().describe("Why this answer is credible."),
|
|
10089
|
+
questionId: z.string().optional().describe("Question ID alias accepted by the projection."),
|
|
10090
|
+
questionNodeId: z.string().optional().describe("Question node ID alias accepted by the projection."),
|
|
10091
|
+
answerText: z.string().optional().describe("Canonical answer text alias accepted by newer callers."),
|
|
10092
|
+
evidenceNodeIds: z.array(z.string()).optional().describe("Evidence node ID alias accepted by newer callers."),
|
|
10093
|
+
answerSource: z.string().optional().describe("How the answer was produced."),
|
|
10094
|
+
worktreeId: z.string().optional().describe("Worktree whose outcome produced this answer."),
|
|
10095
|
+
sprintId: z.string().optional().describe("Legacy sprint identifier.")
|
|
10096
|
+
});
|
|
10097
|
+
var missingQuestionsArgs = z.object({
|
|
10098
|
+
topicId: z.string().describe("Topic scope."),
|
|
10099
|
+
minConfidence: z.number().optional().describe("Minimum confidence threshold for missing-question checks."),
|
|
10100
|
+
status: z.string().optional().describe("Question status filter."),
|
|
10101
|
+
limit: z.number().optional().describe("Maximum questions to inspect.")
|
|
10102
|
+
});
|
|
10103
|
+
var falsificationQuestionsArgs = z.object({
|
|
10104
|
+
topicId: z.string().describe("Topic scope."),
|
|
10105
|
+
beliefIds: z.array(z.string()).optional().describe("Beliefs to generate falsification questions for."),
|
|
10106
|
+
status: z.string().optional().describe("Question status filter."),
|
|
10107
|
+
limit: z.number().optional().describe("Maximum questions to inspect.")
|
|
10108
|
+
});
|
|
9767
10109
|
var questionNodeInput = (input) => compactRecord4({
|
|
9768
10110
|
nodeId: input.nodeId ?? input.id ?? input.questionId,
|
|
9769
10111
|
questionId: input.questionId
|
|
@@ -9810,7 +10152,8 @@ var questionsContracts = [
|
|
|
9810
10152
|
functionName: "create",
|
|
9811
10153
|
kind: "mutation",
|
|
9812
10154
|
inputProjection: createQuestionInput
|
|
9813
|
-
}
|
|
10155
|
+
},
|
|
10156
|
+
args: createQuestionArgs
|
|
9814
10157
|
}),
|
|
9815
10158
|
surfaceContract({
|
|
9816
10159
|
name: "get_question",
|
|
@@ -9866,7 +10209,8 @@ var questionsContracts = [
|
|
|
9866
10209
|
category: input.category,
|
|
9867
10210
|
priority: input.priority
|
|
9868
10211
|
})
|
|
9869
|
-
}
|
|
10212
|
+
},
|
|
10213
|
+
args: refineQuestionArgs
|
|
9870
10214
|
}),
|
|
9871
10215
|
surfaceContract({
|
|
9872
10216
|
name: "update_question_status",
|
|
@@ -9942,7 +10286,8 @@ var questionsContracts = [
|
|
|
9942
10286
|
}),
|
|
9943
10287
|
context
|
|
9944
10288
|
)
|
|
9945
|
-
}
|
|
10289
|
+
},
|
|
10290
|
+
args: createAnswerArgs
|
|
9946
10291
|
}),
|
|
9947
10292
|
surfaceContract({
|
|
9948
10293
|
name: "answer_question",
|
|
@@ -9971,7 +10316,8 @@ var questionsContracts = [
|
|
|
9971
10316
|
}),
|
|
9972
10317
|
context
|
|
9973
10318
|
)
|
|
9974
|
-
}
|
|
10319
|
+
},
|
|
10320
|
+
args: answerQuestionArgs
|
|
9975
10321
|
}),
|
|
9976
10322
|
surfaceContract({
|
|
9977
10323
|
name: "get_answer",
|
|
@@ -10003,7 +10349,8 @@ var questionsContracts = [
|
|
|
10003
10349
|
functionName: "getByTopic",
|
|
10004
10350
|
kind: "query",
|
|
10005
10351
|
inputProjection: questionTopicInput
|
|
10006
|
-
}
|
|
10352
|
+
},
|
|
10353
|
+
args: missingQuestionsArgs
|
|
10007
10354
|
}),
|
|
10008
10355
|
surfaceContract({
|
|
10009
10356
|
name: "get_high_priority_questions",
|
|
@@ -10038,11 +10385,22 @@ var questionsContracts = [
|
|
|
10038
10385
|
functionName: "getByTopic",
|
|
10039
10386
|
kind: "query",
|
|
10040
10387
|
inputProjection: questionTopicInput
|
|
10041
|
-
}
|
|
10388
|
+
},
|
|
10389
|
+
args: falsificationQuestionsArgs
|
|
10042
10390
|
})
|
|
10043
10391
|
];
|
|
10044
|
-
|
|
10045
|
-
|
|
10392
|
+
var updateTopicArgs = z.object({
|
|
10393
|
+
id: z.string().describe("Topic ID."),
|
|
10394
|
+
topicId: z.string().optional().describe("Topic ID alias."),
|
|
10395
|
+
name: z.string().optional().describe("Topic name."),
|
|
10396
|
+
description: z.string().optional().describe("Topic description."),
|
|
10397
|
+
type: z.string().optional().describe("Topic type."),
|
|
10398
|
+
status: z.string().optional().describe("Topic status."),
|
|
10399
|
+
visibility: z.string().optional().describe("Topic visibility."),
|
|
10400
|
+
ontologyId: z.string().optional().describe("Ontology to bind."),
|
|
10401
|
+
clearOntologyId: z.boolean().optional().describe("Whether to clear the ontology binding."),
|
|
10402
|
+
metadata: z.record(z.unknown()).optional().describe("Topic metadata.")
|
|
10403
|
+
});
|
|
10046
10404
|
var topicIdInput = (input) => compactRecord4({
|
|
10047
10405
|
id: input.id ?? input.topicId
|
|
10048
10406
|
});
|
|
@@ -10123,7 +10481,8 @@ var topicsContracts = [
|
|
|
10123
10481
|
functionName: "update",
|
|
10124
10482
|
kind: "mutation",
|
|
10125
10483
|
inputProjection: updateTopicInput
|
|
10126
|
-
}
|
|
10484
|
+
},
|
|
10485
|
+
args: updateTopicArgs
|
|
10127
10486
|
}),
|
|
10128
10487
|
surfaceContract({
|
|
10129
10488
|
name: "get_topic_tree",
|
|
@@ -10142,8 +10501,27 @@ var topicsContracts = [
|
|
|
10142
10501
|
}
|
|
10143
10502
|
})
|
|
10144
10503
|
];
|
|
10145
|
-
|
|
10146
|
-
|
|
10504
|
+
var lensPerspectiveSchema = z.enum([
|
|
10505
|
+
"investigation",
|
|
10506
|
+
"monitoring",
|
|
10507
|
+
"analysis",
|
|
10508
|
+
"comparison",
|
|
10509
|
+
"taxonomy"
|
|
10510
|
+
]);
|
|
10511
|
+
var jsonRecordSchema6 = z.record(z.unknown());
|
|
10512
|
+
var createLensArgs = z.object({
|
|
10513
|
+
name: z.string().describe("Lens name."),
|
|
10514
|
+
workspaceId: z.string().optional().describe("Workspace scope for the lens."),
|
|
10515
|
+
topicId: z.string().optional().describe("Originating topic scope."),
|
|
10516
|
+
description: z.string().optional().describe("What this lens investigates or monitors."),
|
|
10517
|
+
perspectiveType: lensPerspectiveSchema.describe("Perspective type."),
|
|
10518
|
+
promptTemplates: z.array(jsonRecordSchema6).optional().describe("Prompt templates used through this lens."),
|
|
10519
|
+
workflowTemplates: z.array(jsonRecordSchema6).optional().describe("Guided workflow templates."),
|
|
10520
|
+
taskTemplates: z.array(jsonRecordSchema6).optional().describe("Default task templates."),
|
|
10521
|
+
questionTemplates: z.array(jsonRecordSchema6).optional().describe("Default question templates."),
|
|
10522
|
+
filterCriteria: jsonRecordSchema6.optional().describe("Belief/evidence filtering criteria."),
|
|
10523
|
+
metadata: jsonRecordSchema6.optional().describe("Additional lens metadata.")
|
|
10524
|
+
});
|
|
10147
10525
|
var createLensInput = (input, context) => compactRecord4({
|
|
10148
10526
|
name: input.name,
|
|
10149
10527
|
description: input.description,
|
|
@@ -10180,7 +10558,8 @@ var lensesContracts = [
|
|
|
10180
10558
|
functionName: "create",
|
|
10181
10559
|
kind: "mutation",
|
|
10182
10560
|
inputProjection: createLensInput
|
|
10183
|
-
}
|
|
10561
|
+
},
|
|
10562
|
+
args: createLensArgs
|
|
10184
10563
|
}),
|
|
10185
10564
|
surfaceContract({
|
|
10186
10565
|
name: "list_lenses",
|
|
@@ -10242,8 +10621,18 @@ var lensesContracts = [
|
|
|
10242
10621
|
}
|
|
10243
10622
|
})
|
|
10244
10623
|
];
|
|
10245
|
-
|
|
10246
|
-
|
|
10624
|
+
var updateOntologyArgs = z.object({
|
|
10625
|
+
id: z.string().describe("Ontology definition ID."),
|
|
10626
|
+
ontologyId: z.string().optional().describe("Ontology ID alias."),
|
|
10627
|
+
name: z.string().optional().describe("Ontology display name."),
|
|
10628
|
+
description: z.string().optional().describe("Ontology description."),
|
|
10629
|
+
status: z.string().optional().describe("Ontology lifecycle status.")
|
|
10630
|
+
});
|
|
10631
|
+
var ontologyVersionLifecycleArgs = z.object({
|
|
10632
|
+
id: z.string().describe("Ontology version ID."),
|
|
10633
|
+
versionId: z.string().optional().describe("Ontology version ID alias."),
|
|
10634
|
+
ontologyId: z.string().optional().describe("Ontology definition ID.")
|
|
10635
|
+
});
|
|
10247
10636
|
var ontologyIdInput = (input) => compactRecord4({
|
|
10248
10637
|
id: input.id ?? input.ontologyId
|
|
10249
10638
|
});
|
|
@@ -10322,11 +10711,11 @@ var ontologiesContracts = [
|
|
|
10322
10711
|
id: input.id ?? input.ontologyId,
|
|
10323
10712
|
name: input.name,
|
|
10324
10713
|
description: input.description,
|
|
10325
|
-
parentOntologyId: input.parentOntologyId,
|
|
10326
10714
|
status: input.status,
|
|
10327
10715
|
actorId: input.actorId
|
|
10328
10716
|
})
|
|
10329
|
-
}
|
|
10717
|
+
},
|
|
10718
|
+
args: updateOntologyArgs
|
|
10330
10719
|
}),
|
|
10331
10720
|
surfaceContract({
|
|
10332
10721
|
name: "archive_ontology",
|
|
@@ -10409,7 +10798,8 @@ var ontologiesContracts = [
|
|
|
10409
10798
|
functionName: "publishOntologyVersion",
|
|
10410
10799
|
kind: "mutation",
|
|
10411
10800
|
inputProjection: ontologyVersionIdInput
|
|
10412
|
-
}
|
|
10801
|
+
},
|
|
10802
|
+
args: ontologyVersionLifecycleArgs
|
|
10413
10803
|
}),
|
|
10414
10804
|
surfaceContract({
|
|
10415
10805
|
name: "deprecate_ontology_version",
|
|
@@ -10425,7 +10815,8 @@ var ontologiesContracts = [
|
|
|
10425
10815
|
functionName: "deprecateOntologyVersion",
|
|
10426
10816
|
kind: "mutation",
|
|
10427
10817
|
inputProjection: ontologyVersionIdInput
|
|
10428
|
-
}
|
|
10818
|
+
},
|
|
10819
|
+
args: ontologyVersionLifecycleArgs
|
|
10429
10820
|
}),
|
|
10430
10821
|
surfaceContract({
|
|
10431
10822
|
name: "resolve_effective_ontology",
|
|
@@ -10444,8 +10835,76 @@ var ontologiesContracts = [
|
|
|
10444
10835
|
}
|
|
10445
10836
|
})
|
|
10446
10837
|
];
|
|
10447
|
-
|
|
10448
|
-
|
|
10838
|
+
var autoFixPolicyInputSchema = z.object({
|
|
10839
|
+
enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
|
|
10840
|
+
mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
|
|
10841
|
+
maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
|
|
10842
|
+
reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
|
|
10843
|
+
maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
|
|
10844
|
+
permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
|
|
10845
|
+
requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
|
|
10846
|
+
escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
|
|
10847
|
+
}).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
|
|
10848
|
+
var worktreeKeyQuestionInputSchema = z.object({
|
|
10849
|
+
question: z.string().describe("Question the worktree must resolve."),
|
|
10850
|
+
status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
|
|
10851
|
+
answer: z.string().optional().describe("Captured answer when the key question is resolved."),
|
|
10852
|
+
answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
|
|
10853
|
+
linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
|
|
10854
|
+
}).passthrough().describe("Question contract embedded in the worktree plan.");
|
|
10855
|
+
var worktreeEvidenceSignalInputSchema = z.object({
|
|
10856
|
+
signal: z.string().describe("Evidence signal the worktree should collect."),
|
|
10857
|
+
collected: z.boolean().optional().describe("Whether the signal has already been collected."),
|
|
10858
|
+
progress: z.string().optional().describe("Collection progress note for the signal."),
|
|
10859
|
+
notes: z.string().optional().describe("Additional evidence collection notes.")
|
|
10860
|
+
}).passthrough().describe("Evidence signal embedded in the worktree plan.");
|
|
10861
|
+
var worktreeDecisionGateInputSchema = z.object({
|
|
10862
|
+
goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
|
|
10863
|
+
noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
|
|
10864
|
+
verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
|
|
10865
|
+
verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
|
|
10866
|
+
decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
|
|
10867
|
+
decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
|
|
10868
|
+
}).passthrough().describe("Decision gate contract for worktree activation or exit.");
|
|
10869
|
+
var addWorktreeArgs = z.object({
|
|
10870
|
+
title: z.string().optional().describe("Human-readable worktree name or objective."),
|
|
10871
|
+
name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
|
|
10872
|
+
topicId: z.string().describe("Primary topic scope for the worktree."),
|
|
10873
|
+
projectId: z.string().optional().describe("Legacy topicId alias."),
|
|
10874
|
+
branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
|
|
10875
|
+
objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
|
|
10876
|
+
hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
|
|
10877
|
+
rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
|
|
10878
|
+
worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
|
|
10879
|
+
gate: z.string().optional().describe("Exit gate for this worktree."),
|
|
10880
|
+
startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
|
|
10881
|
+
endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
|
|
10882
|
+
durationWeeks: z.number().optional().describe("Planned duration in weeks."),
|
|
10883
|
+
confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
|
|
10884
|
+
beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
|
|
10885
|
+
beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
|
|
10886
|
+
beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
|
|
10887
|
+
targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
|
|
10888
|
+
targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
|
|
10889
|
+
keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
|
|
10890
|
+
evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
|
|
10891
|
+
decisionGate: worktreeDecisionGateInputSchema.optional(),
|
|
10892
|
+
goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
|
|
10893
|
+
noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
|
|
10894
|
+
proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
|
|
10895
|
+
autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
|
|
10896
|
+
autoFixPolicy: autoFixPolicyInputSchema.optional(),
|
|
10897
|
+
domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
|
|
10898
|
+
campaign: z.number().optional().describe("Top-level pipeline campaign number."),
|
|
10899
|
+
lane: z.string().optional().describe("Campaign lane for the worktree."),
|
|
10900
|
+
laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
|
|
10901
|
+
orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
|
|
10902
|
+
dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
|
|
10903
|
+
blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
|
|
10904
|
+
staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
|
|
10905
|
+
lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
|
|
10906
|
+
lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
|
|
10907
|
+
});
|
|
10449
10908
|
var worktreeIdInput = (input) => compactRecord4({
|
|
10450
10909
|
worktreeId: input.worktreeId ?? input.id
|
|
10451
10910
|
});
|
|
@@ -10478,6 +10937,50 @@ var worktreeMetadataInput = (input) => compactRecord4({
|
|
|
10478
10937
|
autoFixPolicy: input.autoFixPolicy,
|
|
10479
10938
|
lastReconciledAt: input.lastReconciledAt
|
|
10480
10939
|
});
|
|
10940
|
+
var worktreeMetadataArgs = z.object({
|
|
10941
|
+
worktreeId: z.string().describe("The worktree to update."),
|
|
10942
|
+
id: z.string().optional().describe("Worktree ID alias."),
|
|
10943
|
+
topicId: z.string().optional().describe("Primary topic scope."),
|
|
10944
|
+
additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
|
|
10945
|
+
status: z.string().optional().describe("Worktree lifecycle status."),
|
|
10946
|
+
campaign: z.number().optional().describe("Top-level pipeline campaign."),
|
|
10947
|
+
lane: z.string().optional().describe("Campaign lane."),
|
|
10948
|
+
laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
|
|
10949
|
+
orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
|
|
10950
|
+
gate: z.string().optional().describe("Exit gate for this worktree."),
|
|
10951
|
+
hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
|
|
10952
|
+
objective: z.string().optional().describe("Reasoning objective for the worktree."),
|
|
10953
|
+
rationale: z.string().optional().describe("Why this worktree is sequenced here."),
|
|
10954
|
+
proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
|
|
10955
|
+
staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
|
|
10956
|
+
blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
|
|
10957
|
+
dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
|
|
10958
|
+
lensId: z.string().optional().describe("Lens that scopes this worktree."),
|
|
10959
|
+
autoFixPolicy: autoFixPolicyInputSchema.optional(),
|
|
10960
|
+
lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
|
|
10961
|
+
});
|
|
10962
|
+
var pushArgs = worktreeMetadataArgs.extend({
|
|
10963
|
+
targetContext: z.string().describe("Where to push merged findings."),
|
|
10964
|
+
beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
|
|
10965
|
+
});
|
|
10966
|
+
var openPullRequestArgs = worktreeMetadataArgs.extend({
|
|
10967
|
+
reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
|
|
10968
|
+
summary: z.string().describe("Summary of findings and why they are ready for review.")
|
|
10969
|
+
});
|
|
10970
|
+
var mergeKeyFindingsInput = (input) => {
|
|
10971
|
+
if (Array.isArray(input.keyFindings)) {
|
|
10972
|
+
return input.keyFindings;
|
|
10973
|
+
}
|
|
10974
|
+
if (Array.isArray(input.outcomes)) {
|
|
10975
|
+
const findings = input.outcomes.filter(
|
|
10976
|
+
(outcome) => typeof outcome === "string" && outcome.trim().length > 0
|
|
10977
|
+
);
|
|
10978
|
+
if (findings.length > 0) {
|
|
10979
|
+
return findings;
|
|
10980
|
+
}
|
|
10981
|
+
}
|
|
10982
|
+
return [input.summary ?? "Merged worktree"];
|
|
10983
|
+
};
|
|
10481
10984
|
var listAllWorktreesInput = (input) => compactRecord4({
|
|
10482
10985
|
status: input.status,
|
|
10483
10986
|
lane: input.lane,
|
|
@@ -10485,6 +10988,16 @@ var listAllWorktreesInput = (input) => compactRecord4({
|
|
|
10485
10988
|
limit: input.limit
|
|
10486
10989
|
});
|
|
10487
10990
|
var worktreesContracts = [
|
|
10991
|
+
surfaceContract({
|
|
10992
|
+
name: "begin_build_session",
|
|
10993
|
+
kind: "mutation",
|
|
10994
|
+
domain: "worktrees",
|
|
10995
|
+
surfaceClass: "platform_internal",
|
|
10996
|
+
path: "/mcp/build-session/begin",
|
|
10997
|
+
sdkNamespace: "worktrees",
|
|
10998
|
+
sdkMethod: "beginBuildSession",
|
|
10999
|
+
summary: "Begin a coding build session for a worktree."
|
|
11000
|
+
}),
|
|
10488
11001
|
surfaceContract({
|
|
10489
11002
|
name: "add_worktree",
|
|
10490
11003
|
kind: "mutation",
|
|
@@ -10501,13 +11014,12 @@ var worktreesContracts = [
|
|
|
10501
11014
|
inputProjection: (input, context) => withCreatedBy(
|
|
10502
11015
|
compactRecord4({
|
|
10503
11016
|
name: input.name ?? input.title,
|
|
10504
|
-
topicId: input.topicId,
|
|
11017
|
+
topicId: input.topicId ?? input.projectId,
|
|
10505
11018
|
worktreeType: input.worktreeType,
|
|
10506
11019
|
objective: input.objective,
|
|
10507
11020
|
gate: input.gate,
|
|
10508
11021
|
hypothesis: input.hypothesis,
|
|
10509
11022
|
rationale: input.rationale,
|
|
10510
|
-
signal: input.signal,
|
|
10511
11023
|
startDate: input.startDate,
|
|
10512
11024
|
endDate: input.endDate,
|
|
10513
11025
|
durationWeeks: input.durationWeeks,
|
|
@@ -10533,12 +11045,12 @@ var worktreesContracts = [
|
|
|
10533
11045
|
staffingHint: input.staffingHint,
|
|
10534
11046
|
domainPackId: input.domainPackId,
|
|
10535
11047
|
lensId: input.lensId,
|
|
10536
|
-
linkedQuestionId: input.linkedQuestionId,
|
|
10537
11048
|
lastReconciledAt: input.lastReconciledAt
|
|
10538
11049
|
}),
|
|
10539
11050
|
context
|
|
10540
11051
|
)
|
|
10541
|
-
}
|
|
11052
|
+
},
|
|
11053
|
+
args: addWorktreeArgs
|
|
10542
11054
|
}),
|
|
10543
11055
|
surfaceContract({
|
|
10544
11056
|
name: "activate_worktree",
|
|
@@ -10650,7 +11162,8 @@ var worktreesContracts = [
|
|
|
10650
11162
|
functionName: "updateMetadata",
|
|
10651
11163
|
kind: "mutation",
|
|
10652
11164
|
inputProjection: worktreeMetadataInput
|
|
10653
|
-
}
|
|
11165
|
+
},
|
|
11166
|
+
args: worktreeMetadataArgs
|
|
10654
11167
|
}),
|
|
10655
11168
|
surfaceContract({
|
|
10656
11169
|
name: "merge",
|
|
@@ -10668,9 +11181,7 @@ var worktreesContracts = [
|
|
|
10668
11181
|
inputProjection: (input, context) => withUserId(
|
|
10669
11182
|
{
|
|
10670
11183
|
...worktreeIdInput(input),
|
|
10671
|
-
keyFindings: input
|
|
10672
|
-
input.summary ?? "Merged worktree"
|
|
10673
|
-
],
|
|
11184
|
+
keyFindings: mergeKeyFindingsInput(input),
|
|
10674
11185
|
decisionsReached: input.decisionsReached ?? [],
|
|
10675
11186
|
nextSteps: input.nextSteps ?? []
|
|
10676
11187
|
},
|
|
@@ -10692,7 +11203,8 @@ var worktreesContracts = [
|
|
|
10692
11203
|
functionName: "updateMetadata",
|
|
10693
11204
|
kind: "mutation",
|
|
10694
11205
|
inputProjection: worktreeMetadataInput
|
|
10695
|
-
}
|
|
11206
|
+
},
|
|
11207
|
+
args: pushArgs
|
|
10696
11208
|
}),
|
|
10697
11209
|
surfaceContract({
|
|
10698
11210
|
name: "open_pull_request",
|
|
@@ -10708,7 +11220,8 @@ var worktreesContracts = [
|
|
|
10708
11220
|
functionName: "updateMetadata",
|
|
10709
11221
|
kind: "mutation",
|
|
10710
11222
|
inputProjection: worktreeMetadataInput
|
|
10711
|
-
}
|
|
11223
|
+
},
|
|
11224
|
+
args: openPullRequestArgs
|
|
10712
11225
|
})
|
|
10713
11226
|
];
|
|
10714
11227
|
|
|
@@ -10812,6 +11325,15 @@ var createEdgeArgs = z.object({
|
|
|
10812
11325
|
topicId: z.string().optional(),
|
|
10813
11326
|
trustedBypassAccessCheck: z.boolean().optional()
|
|
10814
11327
|
});
|
|
11328
|
+
var queryLineageArgs = z.object({
|
|
11329
|
+
nodeId: z.string().describe("Starting node to trace from."),
|
|
11330
|
+
startNode: z.string().optional().describe("Starting node alias accepted by traversal callers."),
|
|
11331
|
+
depth: z.number().optional().describe("Traversal depth alias."),
|
|
11332
|
+
maxDepth: z.number().optional().describe("Maximum traversal depth."),
|
|
11333
|
+
mode: z.string().optional().describe("Traversal mode."),
|
|
11334
|
+
minLayer: z.string().optional().describe("Minimum epistemic layer."),
|
|
11335
|
+
maxLayer: z.string().optional().describe("Maximum epistemic layer.")
|
|
11336
|
+
});
|
|
10815
11337
|
function graphRefNodeId(ref) {
|
|
10816
11338
|
if (ref.kind === "epistemic_node") {
|
|
10817
11339
|
return ref.nodeId;
|
|
@@ -10882,11 +11404,59 @@ var edgesContracts = [
|
|
|
10882
11404
|
minLayer: input.minLayer,
|
|
10883
11405
|
maxLayer: input.maxLayer
|
|
10884
11406
|
})
|
|
10885
|
-
}
|
|
11407
|
+
},
|
|
11408
|
+
args: queryLineageArgs
|
|
10886
11409
|
})
|
|
10887
11410
|
];
|
|
10888
|
-
|
|
10889
|
-
|
|
11411
|
+
var traversalLayerSchema = z.enum([
|
|
11412
|
+
"L4",
|
|
11413
|
+
"L3",
|
|
11414
|
+
"L2",
|
|
11415
|
+
"L1",
|
|
11416
|
+
"ontological",
|
|
11417
|
+
"organizational"
|
|
11418
|
+
]);
|
|
11419
|
+
var traversalModeSchema = z.enum(["low", "medium", "high", "extra_high"]);
|
|
11420
|
+
var lineageAliasArgs = z.object({
|
|
11421
|
+
nodeId: z.string().optional().describe("Starting node to traverse from."),
|
|
11422
|
+
startNode: z.string().optional().describe("Starting node alias for traversal callers."),
|
|
11423
|
+
entityId: z.string().optional().describe("Entity identifier alias for impact tracing."),
|
|
11424
|
+
depth: z.number().optional().describe("Traversal depth alias."),
|
|
11425
|
+
maxDepth: z.number().optional().describe("Maximum traversal depth."),
|
|
11426
|
+
mode: traversalModeSchema.optional().describe("Traversal mode."),
|
|
11427
|
+
minLayer: traversalLayerSchema.optional().describe("Minimum epistemic layer to include."),
|
|
11428
|
+
maxLayer: traversalLayerSchema.optional().describe("Maximum epistemic layer to include.")
|
|
11429
|
+
});
|
|
11430
|
+
var lineageArgs = lineageAliasArgs.extend({
|
|
11431
|
+
nodeId: z.string().describe("Starting node to traverse from.")
|
|
11432
|
+
});
|
|
11433
|
+
var traverseGraphArgs = lineageAliasArgs.extend({
|
|
11434
|
+
startNode: z.string().describe("Node to start traversal from."),
|
|
11435
|
+
direction: z.enum(["up", "down", "both"]).optional().describe("Traversal direction.")
|
|
11436
|
+
});
|
|
11437
|
+
var graphNeighborhoodArgs = z.object({
|
|
11438
|
+
globalId: z.string().optional().describe("Single root global ID."),
|
|
11439
|
+
globalIds: z.array(z.string()).optional().describe("Root global IDs for the neighborhood."),
|
|
11440
|
+
maxDepth: z.number().optional().describe("Maximum traversal depth."),
|
|
11441
|
+
topicId: z.string().optional().describe("Topic scope for edge lookup."),
|
|
11442
|
+
limit: z.number().optional().describe("Maximum edges to return.")
|
|
11443
|
+
});
|
|
11444
|
+
var flagContradictionArgs = z.object({
|
|
11445
|
+
beliefA: z.string().describe("First belief in tension."),
|
|
11446
|
+
beliefB: z.string().describe("Second belief in tension."),
|
|
11447
|
+
topicId: z.string().optional().describe("Topic scope for the contradiction."),
|
|
11448
|
+
description: z.string().optional().describe("Human-readable contradiction."),
|
|
11449
|
+
severity: z.enum(["critical", "high", "medium", "low"]).optional().describe("Contradiction severity."),
|
|
11450
|
+
defeatType: z.string().optional().describe("Defeat type annotation."),
|
|
11451
|
+
supportingInsightIds: z.array(z.string()).optional().describe("Evidence supporting the primary belief."),
|
|
11452
|
+
contradictingInsightIds: z.array(z.string()).optional().describe("Evidence or beliefs contradicting the primary belief.")
|
|
11453
|
+
});
|
|
11454
|
+
var discoverEntityConnectionsArgs = lineageAliasArgs.extend({
|
|
11455
|
+
nodeId: z.string().describe("Epistemic node ID to find entity connections for."),
|
|
11456
|
+
topicId: z.string().optional().describe("Topic scope override."),
|
|
11457
|
+
minScore: z.number().optional().describe("Minimum match score."),
|
|
11458
|
+
limit: z.number().optional().describe("Maximum candidates to return.")
|
|
11459
|
+
});
|
|
10890
11460
|
var contradictionSeverity = (value) => {
|
|
10891
11461
|
switch (value) {
|
|
10892
11462
|
case "critical":
|
|
@@ -10941,7 +11511,8 @@ var graphContracts = [
|
|
|
10941
11511
|
functionName: "getLineage",
|
|
10942
11512
|
kind: "query",
|
|
10943
11513
|
inputProjection: lineageInput
|
|
10944
|
-
}
|
|
11514
|
+
},
|
|
11515
|
+
args: traverseGraphArgs
|
|
10945
11516
|
}),
|
|
10946
11517
|
surfaceContract({
|
|
10947
11518
|
name: "get_graph_neighborhood",
|
|
@@ -10957,7 +11528,8 @@ var graphContracts = [
|
|
|
10957
11528
|
functionName: "getByTopic",
|
|
10958
11529
|
kind: "query",
|
|
10959
11530
|
inputProjection: topicEdgesInput
|
|
10960
|
-
}
|
|
11531
|
+
},
|
|
11532
|
+
args: graphNeighborhoodArgs
|
|
10961
11533
|
}),
|
|
10962
11534
|
surfaceContract({
|
|
10963
11535
|
name: "get_graph_structure_analysis",
|
|
@@ -11006,7 +11578,8 @@ var graphContracts = [
|
|
|
11006
11578
|
functionName: "create",
|
|
11007
11579
|
kind: "mutation",
|
|
11008
11580
|
inputProjection: flagContradictionInput
|
|
11009
|
-
}
|
|
11581
|
+
},
|
|
11582
|
+
args: flagContradictionArgs
|
|
11010
11583
|
}),
|
|
11011
11584
|
surfaceContract({
|
|
11012
11585
|
name: "detect_confirmation_bias",
|
|
@@ -11097,7 +11670,8 @@ var graphContracts = [
|
|
|
11097
11670
|
functionName: "getLineage",
|
|
11098
11671
|
kind: "query",
|
|
11099
11672
|
inputProjection: lineageInput
|
|
11100
|
-
}
|
|
11673
|
+
},
|
|
11674
|
+
args: discoverEntityConnectionsArgs
|
|
11101
11675
|
}),
|
|
11102
11676
|
surfaceContract({
|
|
11103
11677
|
name: "trigger_belief_review",
|
|
@@ -11128,7 +11702,8 @@ var graphContracts = [
|
|
|
11128
11702
|
functionName: "getLineage",
|
|
11129
11703
|
kind: "query",
|
|
11130
11704
|
inputProjection: lineageInput
|
|
11131
|
-
}
|
|
11705
|
+
},
|
|
11706
|
+
args: lineageArgs
|
|
11132
11707
|
})
|
|
11133
11708
|
];
|
|
11134
11709
|
|
|
@@ -11180,8 +11755,16 @@ var contractsContracts = [
|
|
|
11180
11755
|
}
|
|
11181
11756
|
})
|
|
11182
11757
|
];
|
|
11183
|
-
|
|
11184
|
-
|
|
11758
|
+
var auditTrailArgs = z.object({
|
|
11759
|
+
nodeId: z.string().describe("The node to audit."),
|
|
11760
|
+
id: z.string().optional().describe("Node ID alias."),
|
|
11761
|
+
limit: z.number().optional().describe("Maximum entries to return."),
|
|
11762
|
+
depth: z.number().optional().describe("Traversal depth alias."),
|
|
11763
|
+
maxDepth: z.number().optional().describe("Maximum lineage depth."),
|
|
11764
|
+
mode: z.string().optional().describe("Traversal mode."),
|
|
11765
|
+
minLayer: z.string().optional().describe("Minimum epistemic layer."),
|
|
11766
|
+
maxLayer: z.string().optional().describe("Maximum epistemic layer.")
|
|
11767
|
+
});
|
|
11185
11768
|
var judgmentsContracts = [
|
|
11186
11769
|
surfaceContract({
|
|
11187
11770
|
name: "record_judgment",
|
|
@@ -11236,7 +11819,8 @@ var judgmentsContracts = [
|
|
|
11236
11819
|
minLayer: input.minLayer,
|
|
11237
11820
|
maxLayer: input.maxLayer
|
|
11238
11821
|
})
|
|
11239
|
-
}
|
|
11822
|
+
},
|
|
11823
|
+
args: auditTrailArgs
|
|
11240
11824
|
})
|
|
11241
11825
|
];
|
|
11242
11826
|
|
|
@@ -11404,8 +11988,13 @@ var coordinationContracts = [
|
|
|
11404
11988
|
}
|
|
11405
11989
|
})
|
|
11406
11990
|
];
|
|
11407
|
-
|
|
11408
|
-
|
|
11991
|
+
var pipelineSnapshotArgs = z.object({
|
|
11992
|
+
topicId: z.string().describe("Topic scope ID."),
|
|
11993
|
+
status: z.string().optional().describe("Worktree status filter."),
|
|
11994
|
+
lane: z.string().optional().describe("Campaign lane filter."),
|
|
11995
|
+
campaign: z.number().optional().describe("Campaign number filter."),
|
|
11996
|
+
limit: z.number().optional().describe("Maximum worktrees to inspect.")
|
|
11997
|
+
});
|
|
11409
11998
|
var pipelineContracts = [
|
|
11410
11999
|
surfaceContract({
|
|
11411
12000
|
name: "pipeline_snapshot",
|
|
@@ -11426,7 +12015,8 @@ var pipelineContracts = [
|
|
|
11426
12015
|
campaign: input.campaign,
|
|
11427
12016
|
limit: input.limit
|
|
11428
12017
|
})
|
|
11429
|
-
}
|
|
12018
|
+
},
|
|
12019
|
+
args: pipelineSnapshotArgs
|
|
11430
12020
|
}),
|
|
11431
12021
|
surfaceContract({
|
|
11432
12022
|
name: "seed_belief_lattice",
|
|
@@ -11478,7 +12068,31 @@ var recordScopeLearningArgs = z.object({
|
|
|
11478
12068
|
rationale: z.string().optional().describe("Why this learning should enter the reasoning graph"),
|
|
11479
12069
|
createQuestionText: z.string().optional().describe("Optional follow-up question text"),
|
|
11480
12070
|
createBeliefText: z.string().optional().describe("Optional new belief text"),
|
|
11481
|
-
beliefType: z.string().optional().describe("Optional belief type for createBeliefText")
|
|
12071
|
+
beliefType: z.string().optional().describe("Optional belief type for createBeliefText"),
|
|
12072
|
+
text: z.string().optional().describe("Canonical learning text alias."),
|
|
12073
|
+
content: z.string().optional().describe("Canonical learning content alias."),
|
|
12074
|
+
kind: z.string().optional().describe("Evidence kind to store."),
|
|
12075
|
+
sourceType: z.string().optional().describe("Evidence source type."),
|
|
12076
|
+
externalSourceType: z.string().optional().describe("External source type alias."),
|
|
12077
|
+
metadata: z.record(z.unknown()).optional().describe("Learning metadata.")
|
|
12078
|
+
});
|
|
12079
|
+
var codeContextArgs = z.object({
|
|
12080
|
+
topicId: z.string().optional().describe("Topic scope."),
|
|
12081
|
+
filePath: z.string().optional().describe("File path anchor."),
|
|
12082
|
+
includeFailures: z.boolean().optional().describe("Whether to include failed attempts."),
|
|
12083
|
+
limit: z.number().optional().describe("Maximum records to return."),
|
|
12084
|
+
status: z.string().optional().describe("Evidence status filter.")
|
|
12085
|
+
});
|
|
12086
|
+
var recordAttemptArgs = z.object({
|
|
12087
|
+
topicId: z.string().optional().describe("Topic scope."),
|
|
12088
|
+
description: z.string().describe("Attempt description."),
|
|
12089
|
+
errorMessage: z.string().optional().describe("Failure or error message."),
|
|
12090
|
+
filePaths: z.array(z.string()).optional().describe("Files involved in the attempt."),
|
|
12091
|
+
filePath: z.string().optional().describe("Single file path alias."),
|
|
12092
|
+
linkedBeliefId: z.string().optional().describe("Linked belief ID."),
|
|
12093
|
+
metadata: z.record(z.unknown()).optional().describe("Attempt metadata."),
|
|
12094
|
+
rationale: z.string().optional().describe("Why this attempt should be recorded."),
|
|
12095
|
+
title: z.string().optional().describe("Attempt evidence title.")
|
|
11482
12096
|
});
|
|
11483
12097
|
var learningInput = (input, context) => {
|
|
11484
12098
|
const sourceKind = input.sourceKind ?? input.externalSourceType;
|
|
@@ -11595,7 +12209,8 @@ var codingContracts = [
|
|
|
11595
12209
|
status: input.status,
|
|
11596
12210
|
userId: input.userId
|
|
11597
12211
|
})
|
|
11598
|
-
}
|
|
12212
|
+
},
|
|
12213
|
+
args: codeContextArgs
|
|
11599
12214
|
}),
|
|
11600
12215
|
surfaceContract({
|
|
11601
12216
|
name: "get_change_history",
|
|
@@ -11632,7 +12247,8 @@ var codingContracts = [
|
|
|
11632
12247
|
functionName: "create",
|
|
11633
12248
|
kind: "mutation",
|
|
11634
12249
|
inputProjection: attemptInput
|
|
11635
|
-
}
|
|
12250
|
+
},
|
|
12251
|
+
args: recordAttemptArgs
|
|
11636
12252
|
}),
|
|
11637
12253
|
surfaceContract({
|
|
11638
12254
|
name: "get_failure_log",
|
|
@@ -11707,6 +12323,604 @@ new Map(
|
|
|
11707
12323
|
ALL_FUNCTION_CONTRACTS.map((contract) => [contract.name, contract])
|
|
11708
12324
|
);
|
|
11709
12325
|
|
|
12326
|
+
// ../contracts/src/tenant-bootstrap-seed.contract.ts
|
|
12327
|
+
function isCopyableSeedRequirement(entry) {
|
|
12328
|
+
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;
|
|
12329
|
+
}
|
|
12330
|
+
var TENANT_BOOTSTRAP_TABLE_REQUIREMENTS = [
|
|
12331
|
+
{
|
|
12332
|
+
component: "kernel",
|
|
12333
|
+
table: "agentMessages",
|
|
12334
|
+
prepopulation: "runtime_data",
|
|
12335
|
+
copyMode: "none",
|
|
12336
|
+
description: "Agent coordination messages are session data, not template data."
|
|
12337
|
+
},
|
|
12338
|
+
{
|
|
12339
|
+
component: "kernel",
|
|
12340
|
+
table: "agentSessions",
|
|
12341
|
+
prepopulation: "runtime_data",
|
|
12342
|
+
copyMode: "none",
|
|
12343
|
+
description: "Agent coordination sessions are created by active clients."
|
|
12344
|
+
},
|
|
12345
|
+
{
|
|
12346
|
+
component: "kernel",
|
|
12347
|
+
table: "autofixJobs",
|
|
12348
|
+
prepopulation: "runtime_queue",
|
|
12349
|
+
copyMode: "none",
|
|
12350
|
+
description: "Autofix work items are runtime queue rows."
|
|
12351
|
+
},
|
|
12352
|
+
{
|
|
12353
|
+
component: "kernel",
|
|
12354
|
+
table: "backgroundJobRuns",
|
|
12355
|
+
prepopulation: "runtime_log",
|
|
12356
|
+
copyMode: "none",
|
|
12357
|
+
description: "Background job executions are runtime logs."
|
|
12358
|
+
},
|
|
12359
|
+
{
|
|
12360
|
+
component: "kernel",
|
|
12361
|
+
table: "backgroundJobSettings",
|
|
12362
|
+
prepopulation: "required_template",
|
|
12363
|
+
copyMode: "template_global",
|
|
12364
|
+
scope: "global",
|
|
12365
|
+
uniqueKey: ["jobKey"],
|
|
12366
|
+
description: "Default job enablement settings must come from the K template."
|
|
12367
|
+
},
|
|
12368
|
+
{
|
|
12369
|
+
component: "kernel",
|
|
12370
|
+
table: "beliefConfidence",
|
|
12371
|
+
prepopulation: "runtime_data",
|
|
12372
|
+
copyMode: "none",
|
|
12373
|
+
description: "Belief confidence rows are created with tenant graph facts."
|
|
12374
|
+
},
|
|
12375
|
+
{
|
|
12376
|
+
component: "kernel",
|
|
12377
|
+
table: "beliefEvidenceLinks",
|
|
12378
|
+
prepopulation: "runtime_data",
|
|
12379
|
+
copyMode: "none",
|
|
12380
|
+
description: "Belief-to-evidence links are tenant graph data."
|
|
12381
|
+
},
|
|
12382
|
+
{
|
|
12383
|
+
component: "kernel",
|
|
12384
|
+
table: "beliefHistory",
|
|
12385
|
+
prepopulation: "runtime_data",
|
|
12386
|
+
copyMode: "none",
|
|
12387
|
+
description: "Belief history is append-only tenant graph data."
|
|
12388
|
+
},
|
|
12389
|
+
{
|
|
12390
|
+
component: "kernel",
|
|
12391
|
+
table: "beliefScenarios",
|
|
12392
|
+
prepopulation: "runtime_data",
|
|
12393
|
+
copyMode: "none",
|
|
12394
|
+
description: "Scenario rows are tenant-authored reasoning data."
|
|
12395
|
+
},
|
|
12396
|
+
{
|
|
12397
|
+
component: "kernel",
|
|
12398
|
+
table: "beliefVotes",
|
|
12399
|
+
prepopulation: "runtime_data",
|
|
12400
|
+
copyMode: "none",
|
|
12401
|
+
description: "Decision belief votes are tenant-authored data."
|
|
12402
|
+
},
|
|
12403
|
+
{
|
|
12404
|
+
component: "kernel",
|
|
12405
|
+
table: "calibrationScores",
|
|
12406
|
+
prepopulation: "runtime_derived",
|
|
12407
|
+
copyMode: "none",
|
|
12408
|
+
description: "Calibration scores are computed from tenant outcomes."
|
|
12409
|
+
},
|
|
12410
|
+
{
|
|
12411
|
+
component: "kernel",
|
|
12412
|
+
table: "contractEvaluations",
|
|
12413
|
+
prepopulation: "runtime_log",
|
|
12414
|
+
copyMode: "none",
|
|
12415
|
+
description: "Contract evaluation rows are runtime computation logs."
|
|
12416
|
+
},
|
|
12417
|
+
{
|
|
12418
|
+
component: "kernel",
|
|
12419
|
+
table: "contradictions",
|
|
12420
|
+
prepopulation: "runtime_data",
|
|
12421
|
+
copyMode: "none",
|
|
12422
|
+
description: "Contradictions are tenant graph facts."
|
|
12423
|
+
},
|
|
12424
|
+
{
|
|
12425
|
+
component: "kernel",
|
|
12426
|
+
table: "crossProjectConnections",
|
|
12427
|
+
prepopulation: "runtime_data",
|
|
12428
|
+
copyMode: "none",
|
|
12429
|
+
description: "Cross-topic connections are tenant graph facts."
|
|
12430
|
+
},
|
|
12431
|
+
{
|
|
12432
|
+
component: "kernel",
|
|
12433
|
+
table: "decisionComputedSummaries",
|
|
12434
|
+
prepopulation: "runtime_derived",
|
|
12435
|
+
copyMode: "none",
|
|
12436
|
+
description: "Decision summaries are derived tenant outputs."
|
|
12437
|
+
},
|
|
12438
|
+
{
|
|
12439
|
+
component: "kernel",
|
|
12440
|
+
table: "decisionEvents",
|
|
12441
|
+
prepopulation: "runtime_data",
|
|
12442
|
+
copyMode: "none",
|
|
12443
|
+
description: "Decision events are lifecycle data."
|
|
12444
|
+
},
|
|
12445
|
+
{
|
|
12446
|
+
component: "kernel",
|
|
12447
|
+
table: "decisionParticipants",
|
|
12448
|
+
prepopulation: "runtime_data",
|
|
12449
|
+
copyMode: "none",
|
|
12450
|
+
description: "Decision participants are tenant-selected actors."
|
|
12451
|
+
},
|
|
12452
|
+
{
|
|
12453
|
+
component: "kernel",
|
|
12454
|
+
table: "decisionRiskLedger",
|
|
12455
|
+
prepopulation: "runtime_data",
|
|
12456
|
+
copyMode: "none",
|
|
12457
|
+
description: "Decision risk rows are tenant decision data."
|
|
12458
|
+
},
|
|
12459
|
+
{
|
|
12460
|
+
component: "kernel",
|
|
12461
|
+
table: "decisionSnapshots",
|
|
12462
|
+
prepopulation: "runtime_derived",
|
|
12463
|
+
copyMode: "none",
|
|
12464
|
+
description: "Decision snapshots are derived from tenant state."
|
|
12465
|
+
},
|
|
12466
|
+
{
|
|
12467
|
+
component: "kernel",
|
|
12468
|
+
table: "deliberationContributions",
|
|
12469
|
+
prepopulation: "runtime_data",
|
|
12470
|
+
copyMode: "none",
|
|
12471
|
+
description: "Deliberation contributions are tenant-authored data."
|
|
12472
|
+
},
|
|
12473
|
+
{
|
|
12474
|
+
component: "kernel",
|
|
12475
|
+
table: "deliberationSessions",
|
|
12476
|
+
prepopulation: "runtime_data",
|
|
12477
|
+
copyMode: "none",
|
|
12478
|
+
description: "Deliberation sessions are created by tenant workflows."
|
|
12479
|
+
},
|
|
12480
|
+
{
|
|
12481
|
+
component: "kernel",
|
|
12482
|
+
table: "epistemicAudit",
|
|
12483
|
+
prepopulation: "runtime_log",
|
|
12484
|
+
copyMode: "none",
|
|
12485
|
+
description: "Epistemic audit rows are append-only runtime audit data."
|
|
12486
|
+
},
|
|
12487
|
+
{
|
|
12488
|
+
component: "kernel",
|
|
12489
|
+
table: "epistemicContracts",
|
|
12490
|
+
prepopulation: "runtime_data",
|
|
12491
|
+
copyMode: "none",
|
|
12492
|
+
description: "Epistemic contracts are tenant-authored governance data."
|
|
12493
|
+
},
|
|
12494
|
+
{
|
|
12495
|
+
component: "kernel",
|
|
12496
|
+
table: "epistemicEdges",
|
|
12497
|
+
prepopulation: "runtime_data",
|
|
12498
|
+
copyMode: "none",
|
|
12499
|
+
description: "Edges are tenant reasoning graph data."
|
|
12500
|
+
},
|
|
12501
|
+
{
|
|
12502
|
+
component: "kernel",
|
|
12503
|
+
table: "epistemicNodeEmbeddings",
|
|
12504
|
+
prepopulation: "runtime_derived",
|
|
12505
|
+
copyMode: "none",
|
|
12506
|
+
description: "Embeddings are derived from tenant graph nodes."
|
|
12507
|
+
},
|
|
12508
|
+
{
|
|
12509
|
+
component: "kernel",
|
|
12510
|
+
table: "epistemicNodes",
|
|
12511
|
+
prepopulation: "runtime_data",
|
|
12512
|
+
copyMode: "none",
|
|
12513
|
+
description: "Nodes are tenant reasoning graph data."
|
|
12514
|
+
},
|
|
12515
|
+
{
|
|
12516
|
+
component: "kernel",
|
|
12517
|
+
table: "graphAnalysisCache",
|
|
12518
|
+
prepopulation: "runtime_derived",
|
|
12519
|
+
copyMode: "none",
|
|
12520
|
+
description: "Graph analysis cache rows are derived from tenant graph state."
|
|
12521
|
+
},
|
|
12522
|
+
{
|
|
12523
|
+
component: "kernel",
|
|
12524
|
+
table: "graphAnalysisResults",
|
|
12525
|
+
prepopulation: "runtime_derived",
|
|
12526
|
+
copyMode: "none",
|
|
12527
|
+
description: "Graph analysis result rows are derived tenant outputs."
|
|
12528
|
+
},
|
|
12529
|
+
{
|
|
12530
|
+
component: "kernel",
|
|
12531
|
+
table: "graphSuggestions",
|
|
12532
|
+
prepopulation: "runtime_derived",
|
|
12533
|
+
copyMode: "none",
|
|
12534
|
+
description: "Graph suggestions are derived recommendations."
|
|
12535
|
+
},
|
|
12536
|
+
{
|
|
12537
|
+
component: "kernel",
|
|
12538
|
+
table: "harnessReplays",
|
|
12539
|
+
prepopulation: "runtime_log",
|
|
12540
|
+
copyMode: "none",
|
|
12541
|
+
description: "Harness replay rows are runtime verification logs."
|
|
12542
|
+
},
|
|
12543
|
+
{
|
|
12544
|
+
component: "kernel",
|
|
12545
|
+
table: "harnessRuns",
|
|
12546
|
+
prepopulation: "runtime_log",
|
|
12547
|
+
copyMode: "none",
|
|
12548
|
+
description: "Harness run rows are runtime verification logs."
|
|
12549
|
+
},
|
|
12550
|
+
{
|
|
12551
|
+
component: "kernel",
|
|
12552
|
+
table: "idempotencyTokens",
|
|
12553
|
+
prepopulation: "runtime_log",
|
|
12554
|
+
copyMode: "none",
|
|
12555
|
+
description: "Idempotency tokens are request-scoped runtime guards."
|
|
12556
|
+
},
|
|
12557
|
+
{
|
|
12558
|
+
component: "kernel",
|
|
12559
|
+
table: "lenses",
|
|
12560
|
+
prepopulation: "optional_template",
|
|
12561
|
+
copyMode: "none",
|
|
12562
|
+
description: "Reusable lens templates may live in K templates, but workspace-specific copies are not required for core SDK boot."
|
|
12563
|
+
},
|
|
12564
|
+
{
|
|
12565
|
+
component: "kernel",
|
|
12566
|
+
table: "lensTopicBindings",
|
|
12567
|
+
prepopulation: "runtime_data",
|
|
12568
|
+
copyMode: "none",
|
|
12569
|
+
description: "Lens bindings attach runtime topics to runtime/workspace lenses."
|
|
12570
|
+
},
|
|
12571
|
+
{
|
|
12572
|
+
component: "kernel",
|
|
12573
|
+
table: "neo4jSyncQueue",
|
|
12574
|
+
prepopulation: "runtime_queue",
|
|
12575
|
+
copyMode: "none",
|
|
12576
|
+
description: "Neo4j sync queue rows are runtime work items."
|
|
12577
|
+
},
|
|
12578
|
+
{
|
|
12579
|
+
component: "kernel",
|
|
12580
|
+
table: "ontologyDefinitions",
|
|
12581
|
+
prepopulation: "required_template",
|
|
12582
|
+
copyMode: "template_global",
|
|
12583
|
+
scope: "global",
|
|
12584
|
+
uniqueKey: ["ontologyKey"],
|
|
12585
|
+
description: "Platform ontology definitions power taxonomy reads and effective ontology resolution."
|
|
12586
|
+
},
|
|
12587
|
+
{
|
|
12588
|
+
component: "kernel",
|
|
12589
|
+
table: "ontologyVersions",
|
|
12590
|
+
prepopulation: "required_template",
|
|
12591
|
+
copyMode: "template_reference_remap",
|
|
12592
|
+
scope: "global",
|
|
12593
|
+
uniqueKey: ["ontologyKey", "version"],
|
|
12594
|
+
dependsOn: ["ontologyDefinitions"],
|
|
12595
|
+
description: "Ontology versions must be copied with ontologyDefinition ID remapping."
|
|
12596
|
+
},
|
|
12597
|
+
{
|
|
12598
|
+
component: "kernel",
|
|
12599
|
+
table: "platformAgentRunPolicyDecisions",
|
|
12600
|
+
prepopulation: "runtime_log",
|
|
12601
|
+
copyMode: "none",
|
|
12602
|
+
description: "Agent-run policy decisions are audit logs."
|
|
12603
|
+
},
|
|
12604
|
+
{
|
|
12605
|
+
component: "kernel",
|
|
12606
|
+
table: "platformAgentRunPromptResolutions",
|
|
12607
|
+
prepopulation: "runtime_log",
|
|
12608
|
+
copyMode: "none",
|
|
12609
|
+
description: "Agent-run prompt resolution rows are runtime logs."
|
|
12610
|
+
},
|
|
12611
|
+
{
|
|
12612
|
+
component: "kernel",
|
|
12613
|
+
table: "platformAgentRuns",
|
|
12614
|
+
prepopulation: "runtime_log",
|
|
12615
|
+
copyMode: "none",
|
|
12616
|
+
description: "Agent runs are runtime execution records."
|
|
12617
|
+
},
|
|
12618
|
+
{
|
|
12619
|
+
component: "kernel",
|
|
12620
|
+
table: "platformAgentRunToolCalls",
|
|
12621
|
+
prepopulation: "runtime_log",
|
|
12622
|
+
copyMode: "none",
|
|
12623
|
+
description: "Agent-run tool calls are runtime execution records."
|
|
12624
|
+
},
|
|
12625
|
+
{
|
|
12626
|
+
component: "kernel",
|
|
12627
|
+
table: "platformHarnessShadowAudit",
|
|
12628
|
+
prepopulation: "runtime_log",
|
|
12629
|
+
copyMode: "none",
|
|
12630
|
+
description: "Harness shadow audit rows are runtime audit records."
|
|
12631
|
+
},
|
|
12632
|
+
{
|
|
12633
|
+
component: "kernel",
|
|
12634
|
+
table: "publicationRules",
|
|
12635
|
+
prepopulation: "required_template",
|
|
12636
|
+
copyMode: "template_tenant_rewrite",
|
|
12637
|
+
scope: "tenant",
|
|
12638
|
+
uniqueKey: ["tenantId", "workspaceId", "name"],
|
|
12639
|
+
description: "Default publication policy rules are rewritten into each tenant."
|
|
12640
|
+
},
|
|
12641
|
+
{
|
|
12642
|
+
component: "kernel",
|
|
12643
|
+
table: "questionEvidenceLinks",
|
|
12644
|
+
prepopulation: "runtime_data",
|
|
12645
|
+
copyMode: "none",
|
|
12646
|
+
description: "Question-to-evidence links are tenant graph data."
|
|
12647
|
+
},
|
|
12648
|
+
{
|
|
12649
|
+
component: "kernel",
|
|
12650
|
+
table: "researchJobs",
|
|
12651
|
+
prepopulation: "runtime_queue",
|
|
12652
|
+
copyMode: "none",
|
|
12653
|
+
description: "Research job rows are runtime queue items."
|
|
12654
|
+
},
|
|
12655
|
+
{
|
|
12656
|
+
component: "kernel",
|
|
12657
|
+
table: "schemaEnumConfig",
|
|
12658
|
+
prepopulation: "required_template",
|
|
12659
|
+
copyMode: "template_global",
|
|
12660
|
+
scope: "global",
|
|
12661
|
+
uniqueKey: ["category", "value"],
|
|
12662
|
+
description: "Runtime-extensible enum defaults required by SDK graph APIs."
|
|
12663
|
+
},
|
|
12664
|
+
{
|
|
12665
|
+
component: "kernel",
|
|
12666
|
+
table: "stakeholderGroups",
|
|
12667
|
+
prepopulation: "runtime_data",
|
|
12668
|
+
copyMode: "none",
|
|
12669
|
+
description: "Stakeholder groups are tenant decision data."
|
|
12670
|
+
},
|
|
12671
|
+
{
|
|
12672
|
+
component: "kernel",
|
|
12673
|
+
table: "systemLogs",
|
|
12674
|
+
prepopulation: "runtime_log",
|
|
12675
|
+
copyMode: "none",
|
|
12676
|
+
description: "System logs are runtime telemetry."
|
|
12677
|
+
},
|
|
12678
|
+
{
|
|
12679
|
+
component: "kernel",
|
|
12680
|
+
table: "tasks",
|
|
12681
|
+
prepopulation: "runtime_data",
|
|
12682
|
+
copyMode: "none",
|
|
12683
|
+
description: "Tasks are tenant-authored work items."
|
|
12684
|
+
},
|
|
12685
|
+
{
|
|
12686
|
+
component: "kernel",
|
|
12687
|
+
table: "topics",
|
|
12688
|
+
prepopulation: "runtime_bootstrap",
|
|
12689
|
+
copyMode: "none",
|
|
12690
|
+
description: "Default topics are created by tenant provisioning, not copied from templates."
|
|
12691
|
+
},
|
|
12692
|
+
{
|
|
12693
|
+
component: "kernel",
|
|
12694
|
+
table: "workflowDefinitions",
|
|
12695
|
+
prepopulation: "optional_template",
|
|
12696
|
+
copyMode: "none",
|
|
12697
|
+
description: "Table-driven workflow definitions can be template data after the workflow engine leaves legacy mode."
|
|
12698
|
+
},
|
|
12699
|
+
{
|
|
12700
|
+
component: "kernel",
|
|
12701
|
+
table: "workflowPullRequests",
|
|
12702
|
+
prepopulation: "runtime_data",
|
|
12703
|
+
copyMode: "none",
|
|
12704
|
+
description: "Workflow pull requests are tenant workflow data."
|
|
12705
|
+
},
|
|
12706
|
+
{
|
|
12707
|
+
component: "kernel",
|
|
12708
|
+
table: "workflowStages",
|
|
12709
|
+
prepopulation: "optional_template",
|
|
12710
|
+
copyMode: "none",
|
|
12711
|
+
dependsOn: ["workflowDefinitions"],
|
|
12712
|
+
description: "Workflow stages can be template data after workflowDefinitions are enabled for bootstrap copying."
|
|
12713
|
+
},
|
|
12714
|
+
{
|
|
12715
|
+
component: "kernel",
|
|
12716
|
+
table: "worktreeBeliefCluster",
|
|
12717
|
+
prepopulation: "runtime_data",
|
|
12718
|
+
copyMode: "none",
|
|
12719
|
+
description: "Worktree cluster rows link runtime worktrees to runtime beliefs."
|
|
12720
|
+
},
|
|
12721
|
+
{
|
|
12722
|
+
component: "kernel",
|
|
12723
|
+
table: "worktrees",
|
|
12724
|
+
prepopulation: "runtime_data",
|
|
12725
|
+
copyMode: "none",
|
|
12726
|
+
description: "Worktrees are tenant/runtime planning data."
|
|
12727
|
+
},
|
|
12728
|
+
{
|
|
12729
|
+
component: "identity",
|
|
12730
|
+
table: "agents",
|
|
12731
|
+
prepopulation: "runtime_bootstrap",
|
|
12732
|
+
copyMode: "none",
|
|
12733
|
+
description: "Service agents are provisioned per tenant or service, not copied."
|
|
12734
|
+
},
|
|
12735
|
+
{
|
|
12736
|
+
component: "identity",
|
|
12737
|
+
table: "mcpWritePolicy",
|
|
12738
|
+
prepopulation: "required_template",
|
|
12739
|
+
copyMode: "template_global",
|
|
12740
|
+
scope: "global",
|
|
12741
|
+
uniqueKey: ["topicId", "role", "toolCategory"],
|
|
12742
|
+
description: "Global write policy defaults govern service and interactive MCP writes."
|
|
12743
|
+
},
|
|
12744
|
+
{
|
|
12745
|
+
component: "identity",
|
|
12746
|
+
table: "modelCallLogs",
|
|
12747
|
+
prepopulation: "runtime_log",
|
|
12748
|
+
copyMode: "none",
|
|
12749
|
+
description: "Model call logs are runtime telemetry."
|
|
12750
|
+
},
|
|
12751
|
+
{
|
|
12752
|
+
component: "identity",
|
|
12753
|
+
table: "modelFunctionSlots",
|
|
12754
|
+
prepopulation: "required_template",
|
|
12755
|
+
copyMode: "template_global",
|
|
12756
|
+
scope: "global",
|
|
12757
|
+
uniqueKey: ["slot"],
|
|
12758
|
+
description: "Function-to-model slots are required by model runtime resolution."
|
|
12759
|
+
},
|
|
12760
|
+
{
|
|
12761
|
+
component: "identity",
|
|
12762
|
+
table: "modelRegistry",
|
|
12763
|
+
prepopulation: "required_template",
|
|
12764
|
+
copyMode: "template_global",
|
|
12765
|
+
scope: "global",
|
|
12766
|
+
uniqueKey: ["key"],
|
|
12767
|
+
description: "Model catalog defaults are required by model runtime clients."
|
|
12768
|
+
},
|
|
12769
|
+
{
|
|
12770
|
+
component: "identity",
|
|
12771
|
+
table: "modelSlotConfigs",
|
|
12772
|
+
prepopulation: "required_template",
|
|
12773
|
+
copyMode: "template_global",
|
|
12774
|
+
scope: "global",
|
|
12775
|
+
uniqueKey: ["slot"],
|
|
12776
|
+
description: "Slot-level defaults are required before tenant overrides exist."
|
|
12777
|
+
},
|
|
12778
|
+
{
|
|
12779
|
+
component: "identity",
|
|
12780
|
+
table: "platformAudienceGrants",
|
|
12781
|
+
prepopulation: "runtime_data",
|
|
12782
|
+
copyMode: "none",
|
|
12783
|
+
description: "Audience grants are principal/group-specific access rows."
|
|
12784
|
+
},
|
|
12785
|
+
{
|
|
12786
|
+
component: "identity",
|
|
12787
|
+
table: "platformAudiences",
|
|
12788
|
+
prepopulation: "required_template",
|
|
12789
|
+
copyMode: "template_tenant_rewrite",
|
|
12790
|
+
scope: "tenant",
|
|
12791
|
+
uniqueKey: ["tenantId", "workspaceId", "audienceKey"],
|
|
12792
|
+
description: "Default tenant audience taxonomy rows are rewritten into each tenant."
|
|
12793
|
+
},
|
|
12794
|
+
{
|
|
12795
|
+
component: "identity",
|
|
12796
|
+
table: "platformPolicyDecisionLogs",
|
|
12797
|
+
prepopulation: "runtime_log",
|
|
12798
|
+
copyMode: "none",
|
|
12799
|
+
description: "Policy decisions are runtime audit logs."
|
|
12800
|
+
},
|
|
12801
|
+
{
|
|
12802
|
+
component: "identity",
|
|
12803
|
+
table: "projectGrants",
|
|
12804
|
+
prepopulation: "runtime_data",
|
|
12805
|
+
copyMode: "none",
|
|
12806
|
+
description: "Project/topic grants are principal or group-specific access rows."
|
|
12807
|
+
},
|
|
12808
|
+
{
|
|
12809
|
+
component: "identity",
|
|
12810
|
+
table: "reasoningPermissions",
|
|
12811
|
+
prepopulation: "runtime_data",
|
|
12812
|
+
copyMode: "none",
|
|
12813
|
+
description: "Reasoning permissions are principal-specific policy rows."
|
|
12814
|
+
},
|
|
12815
|
+
{
|
|
12816
|
+
component: "identity",
|
|
12817
|
+
table: "tenantApiKeys",
|
|
12818
|
+
prepopulation: "runtime_secret",
|
|
12819
|
+
copyMode: "none",
|
|
12820
|
+
description: "API keys are tenant credentials and must never be copied."
|
|
12821
|
+
},
|
|
12822
|
+
{
|
|
12823
|
+
component: "identity",
|
|
12824
|
+
table: "tenantConfig",
|
|
12825
|
+
prepopulation: "required_template",
|
|
12826
|
+
copyMode: "template_tenant_rewrite",
|
|
12827
|
+
scope: "tenant",
|
|
12828
|
+
uniqueKey: ["tenantId"],
|
|
12829
|
+
description: "Tenant-local config defaults are rewritten during bootstrap."
|
|
12830
|
+
},
|
|
12831
|
+
{
|
|
12832
|
+
component: "identity",
|
|
12833
|
+
table: "tenantIntegrations",
|
|
12834
|
+
prepopulation: "required_template",
|
|
12835
|
+
copyMode: "template_tenant_rewrite",
|
|
12836
|
+
scope: "tenant",
|
|
12837
|
+
uniqueKey: ["tenantId", "integrationKey"],
|
|
12838
|
+
description: "Non-secret integration descriptors are rewritten into each tenant."
|
|
12839
|
+
},
|
|
12840
|
+
{
|
|
12841
|
+
component: "identity",
|
|
12842
|
+
table: "tenantModelSlotBindings",
|
|
12843
|
+
prepopulation: "runtime_secret",
|
|
12844
|
+
copyMode: "none",
|
|
12845
|
+
description: "Tenant model slot bindings reference provider secrets and are runtime-only."
|
|
12846
|
+
},
|
|
12847
|
+
{
|
|
12848
|
+
component: "identity",
|
|
12849
|
+
table: "tenantPolicies",
|
|
12850
|
+
prepopulation: "required_template",
|
|
12851
|
+
copyMode: "template_tenant_rewrite",
|
|
12852
|
+
scope: "tenant",
|
|
12853
|
+
uniqueKey: ["tenantId", "workspaceId", "roleName"],
|
|
12854
|
+
description: "Default tenant policy roles are rewritten during bootstrap."
|
|
12855
|
+
},
|
|
12856
|
+
{
|
|
12857
|
+
component: "identity",
|
|
12858
|
+
table: "tenantProviderSecrets",
|
|
12859
|
+
prepopulation: "runtime_secret",
|
|
12860
|
+
copyMode: "none",
|
|
12861
|
+
description: "Provider secrets are credentials and must never be copied."
|
|
12862
|
+
},
|
|
12863
|
+
{
|
|
12864
|
+
component: "identity",
|
|
12865
|
+
table: "tenantProxyGatewayUsage",
|
|
12866
|
+
prepopulation: "runtime_log",
|
|
12867
|
+
copyMode: "none",
|
|
12868
|
+
description: "Proxy gateway usage rows are runtime telemetry."
|
|
12869
|
+
},
|
|
12870
|
+
{
|
|
12871
|
+
component: "identity",
|
|
12872
|
+
table: "tenantProxyTokenMints",
|
|
12873
|
+
prepopulation: "runtime_secret",
|
|
12874
|
+
copyMode: "none",
|
|
12875
|
+
description: "Proxy token mints are ephemeral secret-bearing runtime rows."
|
|
12876
|
+
},
|
|
12877
|
+
{
|
|
12878
|
+
component: "identity",
|
|
12879
|
+
table: "tenantSandboxAuditEvents",
|
|
12880
|
+
prepopulation: "runtime_log",
|
|
12881
|
+
copyMode: "none",
|
|
12882
|
+
description: "Sandbox audit rows are runtime security logs."
|
|
12883
|
+
},
|
|
12884
|
+
{
|
|
12885
|
+
component: "identity",
|
|
12886
|
+
table: "tenantSecrets",
|
|
12887
|
+
prepopulation: "runtime_secret",
|
|
12888
|
+
copyMode: "none",
|
|
12889
|
+
description: "Tenant secrets are credentials and must never be copied."
|
|
12890
|
+
},
|
|
12891
|
+
{
|
|
12892
|
+
component: "identity",
|
|
12893
|
+
table: "toolAcls",
|
|
12894
|
+
prepopulation: "required_template",
|
|
12895
|
+
copyMode: "template_global",
|
|
12896
|
+
scope: "global",
|
|
12897
|
+
uniqueKey: ["role", "toolName"],
|
|
12898
|
+
description: "Default role-to-tool grants are required for SDK/MCP tool access."
|
|
12899
|
+
},
|
|
12900
|
+
{
|
|
12901
|
+
component: "identity",
|
|
12902
|
+
table: "toolRegistry",
|
|
12903
|
+
prepopulation: "required_template",
|
|
12904
|
+
copyMode: "template_global",
|
|
12905
|
+
scope: "global",
|
|
12906
|
+
uniqueKey: ["toolName"],
|
|
12907
|
+
description: "Core tool catalog rows are required before pack or tenant tools exist."
|
|
12908
|
+
},
|
|
12909
|
+
{
|
|
12910
|
+
component: "identity",
|
|
12911
|
+
table: "users",
|
|
12912
|
+
prepopulation: "runtime_bootstrap",
|
|
12913
|
+
copyMode: "none",
|
|
12914
|
+
description: "Users are created from Clerk/MC principal resolution, not copied."
|
|
12915
|
+
}
|
|
12916
|
+
];
|
|
12917
|
+
TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
|
|
12918
|
+
isCopyableSeedRequirement
|
|
12919
|
+
);
|
|
12920
|
+
TENANT_BOOTSTRAP_TABLE_REQUIREMENTS.filter(
|
|
12921
|
+
(entry) => !isCopyableSeedRequirement(entry)
|
|
12922
|
+
).map((entry) => entry.table);
|
|
12923
|
+
|
|
11710
12924
|
// ../contracts/src/v1/topics/v1.ts
|
|
11711
12925
|
var ROOT_TOPIC_ID = "n17tm38rwet7wqgzrmwahyt1z582590y";
|
|
11712
12926
|
|
|
@@ -11721,6 +12935,12 @@ function getMcpRuntimeContext() {
|
|
|
11721
12935
|
// ../../apps/mcp-server/src/scope.ts
|
|
11722
12936
|
var defaultTopicId = null;
|
|
11723
12937
|
var PUBLIC_TOPIC_PREFIX = "top_";
|
|
12938
|
+
function encodePublicTopicId(topicId) {
|
|
12939
|
+
if (!isNonEmptyString(topicId)) {
|
|
12940
|
+
return void 0;
|
|
12941
|
+
}
|
|
12942
|
+
return topicId.startsWith(PUBLIC_TOPIC_PREFIX) ? topicId : `${PUBLIC_TOPIC_PREFIX}${topicId}`;
|
|
12943
|
+
}
|
|
11724
12944
|
function decodePublicTopicId(topicId) {
|
|
11725
12945
|
if (!isNonEmptyString(topicId)) {
|
|
11726
12946
|
return void 0;
|
|
@@ -11746,6 +12966,27 @@ function readLucernJson() {
|
|
|
11746
12966
|
return null;
|
|
11747
12967
|
}
|
|
11748
12968
|
}
|
|
12969
|
+
function writeLucernJson(context) {
|
|
12970
|
+
try {
|
|
12971
|
+
const previous = readLucernJson() ?? {};
|
|
12972
|
+
const topicId = encodePublicTopicId(context.topicId ?? previous.topicId);
|
|
12973
|
+
const topicName = context.topicName ?? previous.topicName;
|
|
12974
|
+
const normalized = {
|
|
12975
|
+
...previous,
|
|
12976
|
+
...context,
|
|
12977
|
+
...topicId ? { topicId, projectId: topicId } : {},
|
|
12978
|
+
...topicName ? { topicName, projectName: topicName } : {},
|
|
12979
|
+
lastUpdated: context.lastUpdated ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
12980
|
+
};
|
|
12981
|
+
fs.writeFileSync(
|
|
12982
|
+
LUCERN_JSON_PATH,
|
|
12983
|
+
`${JSON.stringify(normalized, null, 2)}
|
|
12984
|
+
`,
|
|
12985
|
+
"utf-8"
|
|
12986
|
+
);
|
|
12987
|
+
} catch {
|
|
12988
|
+
}
|
|
12989
|
+
}
|
|
11749
12990
|
function isNonEmptyString(value) {
|
|
11750
12991
|
return typeof value === "string" && value.trim().length > 0;
|
|
11751
12992
|
}
|
|
@@ -12035,6 +13276,37 @@ var beliefHandlers = {
|
|
|
12035
13276
|
};
|
|
12036
13277
|
|
|
12037
13278
|
// ../../apps/mcp-server/src/handlers/bootstrap.ts
|
|
13279
|
+
function readString2(value) {
|
|
13280
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
13281
|
+
}
|
|
13282
|
+
function readNullableNumber(value) {
|
|
13283
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
13284
|
+
}
|
|
13285
|
+
function refreshLucernContextFromBuildSession(payload, args) {
|
|
13286
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
|
|
13287
|
+
return;
|
|
13288
|
+
}
|
|
13289
|
+
const record = payload;
|
|
13290
|
+
const topicId = readString2(record.topicId);
|
|
13291
|
+
const worktreeId = readString2(record.worktreeId) ?? readString2(args.worktreeId);
|
|
13292
|
+
if (!topicId || !worktreeId) {
|
|
13293
|
+
return;
|
|
13294
|
+
}
|
|
13295
|
+
writeLucernJson({
|
|
13296
|
+
topicId,
|
|
13297
|
+
topicName: readString2(record.topicName),
|
|
13298
|
+
activeWorktree: {
|
|
13299
|
+
worktreeId,
|
|
13300
|
+
title: readString2(record.worktreeName) ?? readString2(record.title) ?? readString2(record.name) ?? worktreeId,
|
|
13301
|
+
status: readString2(record.status) ?? "unknown",
|
|
13302
|
+
campaign: readNullableNumber(record.campaign),
|
|
13303
|
+
lane: readString2(record.lane) ?? null,
|
|
13304
|
+
orderInLane: readNullableNumber(record.orderInLane),
|
|
13305
|
+
gate: readString2(record.gate) ?? null,
|
|
13306
|
+
branch: readString2(record.branch) ?? readString2(args.branch) ?? null
|
|
13307
|
+
}
|
|
13308
|
+
});
|
|
13309
|
+
}
|
|
12038
13310
|
var bootstrapHandlers = {
|
|
12039
13311
|
async generate_session_handoff(args, ctx) {
|
|
12040
13312
|
return formatSdkResult(
|
|
@@ -12042,9 +13314,11 @@ var bootstrapHandlers = {
|
|
|
12042
13314
|
);
|
|
12043
13315
|
},
|
|
12044
13316
|
async begin_build_session(args, ctx) {
|
|
12045
|
-
|
|
13317
|
+
const payload = formatSdkResult(
|
|
12046
13318
|
await getSdkClient(ctx).mcp.beginBuildSession(args)
|
|
12047
13319
|
);
|
|
13320
|
+
refreshLucernContextFromBuildSession(payload, args);
|
|
13321
|
+
return payload;
|
|
12048
13322
|
}
|
|
12049
13323
|
};
|
|
12050
13324
|
|
|
@@ -12587,6 +13861,14 @@ var generatedFunctionSurfaceHandlers = {
|
|
|
12587
13861
|
)
|
|
12588
13862
|
);
|
|
12589
13863
|
},
|
|
13864
|
+
async begin_build_session(args, ctx) {
|
|
13865
|
+
return formatSdkResult(
|
|
13866
|
+
await getSdkClient(ctx).raw.functionSurface.beginBuildSession(
|
|
13867
|
+
stripInternalArgs(args),
|
|
13868
|
+
idempotencyKeyFrom(args)
|
|
13869
|
+
)
|
|
13870
|
+
);
|
|
13871
|
+
},
|
|
12590
13872
|
async bisect_confidence(args, ctx) {
|
|
12591
13873
|
return formatSdkResult(
|
|
12592
13874
|
await getSdkClient(ctx).raw.functionSurface.bisectConfidence(
|
|
@@ -13455,7 +14737,7 @@ function getConvex(ctx) {
|
|
|
13455
14737
|
}
|
|
13456
14738
|
return requireMcpConvex(ctx, "topic-resolver");
|
|
13457
14739
|
}
|
|
13458
|
-
function
|
|
14740
|
+
function readString3(value) {
|
|
13459
14741
|
if (typeof value !== "string") {
|
|
13460
14742
|
return void 0;
|
|
13461
14743
|
}
|
|
@@ -13466,13 +14748,13 @@ function readStringArray2(value) {
|
|
|
13466
14748
|
if (!Array.isArray(value)) {
|
|
13467
14749
|
return [];
|
|
13468
14750
|
}
|
|
13469
|
-
return value.map((entry) =>
|
|
14751
|
+
return value.map((entry) => readString3(entry)).filter((entry) => Boolean(entry));
|
|
13470
14752
|
}
|
|
13471
14753
|
function asRecord2(value) {
|
|
13472
14754
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
13473
14755
|
}
|
|
13474
14756
|
function normalizeTopicId(value) {
|
|
13475
|
-
const normalized =
|
|
14757
|
+
const normalized = readString3(value);
|
|
13476
14758
|
if (!normalized) {
|
|
13477
14759
|
return void 0;
|
|
13478
14760
|
}
|
|
@@ -13484,7 +14766,7 @@ function normalizeTopicId(value) {
|
|
|
13484
14766
|
}
|
|
13485
14767
|
}
|
|
13486
14768
|
function normalizeExternalId(value, prefix) {
|
|
13487
|
-
const normalized =
|
|
14769
|
+
const normalized = readString3(value);
|
|
13488
14770
|
if (!normalized) {
|
|
13489
14771
|
return void 0;
|
|
13490
14772
|
}
|
|
@@ -13506,7 +14788,7 @@ function normalizeToken(value) {
|
|
|
13506
14788
|
return normalized;
|
|
13507
14789
|
}
|
|
13508
14790
|
function tokenize(value) {
|
|
13509
|
-
const normalized =
|
|
14791
|
+
const normalized = readString3(value);
|
|
13510
14792
|
if (!normalized) {
|
|
13511
14793
|
return [];
|
|
13512
14794
|
}
|
|
@@ -13621,22 +14903,22 @@ function scoreTopicMatch(topic, input) {
|
|
|
13621
14903
|
}
|
|
13622
14904
|
function normalizeTopicCandidate(value) {
|
|
13623
14905
|
const record = asRecord2(value);
|
|
13624
|
-
const rawId =
|
|
13625
|
-
const name =
|
|
14906
|
+
const rawId = readString3(record._id) ?? readString3(record.id) ?? normalizeTopicId(readString3(record.topicId)) ?? normalizeTopicId(readString3(record.projectId));
|
|
14907
|
+
const name = readString3(record.name);
|
|
13626
14908
|
if (!rawId || !name) {
|
|
13627
14909
|
return null;
|
|
13628
14910
|
}
|
|
13629
14911
|
return {
|
|
13630
14912
|
rawId,
|
|
13631
14913
|
name,
|
|
13632
|
-
description:
|
|
13633
|
-
type:
|
|
13634
|
-
parentTopicId: normalizeTopicId(
|
|
13635
|
-
tenantId:
|
|
13636
|
-
workspaceId:
|
|
13637
|
-
status:
|
|
14914
|
+
description: readString3(record.description),
|
|
14915
|
+
type: readString3(record.type),
|
|
14916
|
+
parentTopicId: normalizeTopicId(readString3(record.parentTopicId)) ?? null,
|
|
14917
|
+
tenantId: readString3(record.tenantId),
|
|
14918
|
+
workspaceId: readString3(record.workspaceId),
|
|
14919
|
+
status: readString3(record.status),
|
|
13638
14920
|
metadata: asRecord2(record.metadata),
|
|
13639
|
-
globalId:
|
|
14921
|
+
globalId: readString3(record.globalId)
|
|
13640
14922
|
};
|
|
13641
14923
|
}
|
|
13642
14924
|
function topicMatchesScope(topic, tenantId, workspaceId) {
|
|
@@ -13664,7 +14946,7 @@ async function fetchTopicById(ctx, topicId) {
|
|
|
13664
14946
|
function readRecordTopicId(value) {
|
|
13665
14947
|
const record = asRecord2(value);
|
|
13666
14948
|
return normalizeTopicId(
|
|
13667
|
-
|
|
14949
|
+
readString3(record.topicId) ?? readString3(record.projectId) ?? readString3(asRecord2(record.metadata).topicId)
|
|
13668
14950
|
);
|
|
13669
14951
|
}
|
|
13670
14952
|
async function fetchRecordTopicId(ctx, reference, args) {
|
|
@@ -13683,7 +14965,7 @@ async function resolveBeliefTopicId(ctx, beliefId) {
|
|
|
13683
14965
|
}
|
|
13684
14966
|
async function resolveCommonBeliefTopicId(ctx, beliefIds) {
|
|
13685
14967
|
const normalizedBeliefIds = (beliefIds ?? []).filter(
|
|
13686
|
-
(beliefId) => Boolean(
|
|
14968
|
+
(beliefId) => Boolean(readString3(beliefId))
|
|
13687
14969
|
);
|
|
13688
14970
|
if (normalizedBeliefIds.length === 0) {
|
|
13689
14971
|
return void 0;
|
|
@@ -13745,7 +15027,7 @@ function compactWhitespace(value) {
|
|
|
13745
15027
|
return value.replace(/\s+/g, " ").trim();
|
|
13746
15028
|
}
|
|
13747
15029
|
function deriveTopicName(input, parentTopic) {
|
|
13748
|
-
const textualHint =
|
|
15030
|
+
const textualHint = readString3(input.topicHint);
|
|
13749
15031
|
if (textualHint && tokenize(textualHint).length > 0) {
|
|
13750
15032
|
return titleCase(compactWhitespace(textualHint)).slice(0, 60);
|
|
13751
15033
|
}
|
|
@@ -13761,7 +15043,7 @@ function deriveTopicName(input, parentTopic) {
|
|
|
13761
15043
|
if (summary.length > 0) {
|
|
13762
15044
|
return titleCase(summary.slice(0, 60));
|
|
13763
15045
|
}
|
|
13764
|
-
const sourceRef =
|
|
15046
|
+
const sourceRef = readString3(input.sourceRef);
|
|
13765
15047
|
if (sourceRef) {
|
|
13766
15048
|
return titleCase(compactWhitespace(sourceRef.replace(/[-_:/]+/g, " "))).slice(0, 60);
|
|
13767
15049
|
}
|
|
@@ -13770,7 +15052,7 @@ function deriveTopicName(input, parentTopic) {
|
|
|
13770
15052
|
async function createChildTopic(ctx, parentTopic, input) {
|
|
13771
15053
|
const convex = getConvex(ctx);
|
|
13772
15054
|
const desiredTenantId = ctx.tenantId;
|
|
13773
|
-
const desiredWorkspaceId =
|
|
15055
|
+
const desiredWorkspaceId = readString3(input.workspaceId) ?? ctx.workspaceId;
|
|
13774
15056
|
const createdBy = ctx.principalId ?? ctx.userId;
|
|
13775
15057
|
const created = await convex.mutation(api.topics.create, {
|
|
13776
15058
|
name: deriveTopicName(input, parentTopic),
|
|
@@ -13790,7 +15072,7 @@ async function createChildTopic(ctx, parentTopic, input) {
|
|
|
13790
15072
|
}
|
|
13791
15073
|
});
|
|
13792
15074
|
const createdRecord = asRecord2(created);
|
|
13793
|
-
const createdId =
|
|
15075
|
+
const createdId = readString3(createdRecord.id) ?? readString3(createdRecord.topicId) ?? readString3(createdRecord._id);
|
|
13794
15076
|
const hydrated = await fetchTopicById(ctx, createdId);
|
|
13795
15077
|
if (!hydrated) {
|
|
13796
15078
|
throw new Error("[topic-resolver] Auto-created topic could not be reloaded.");
|
|
@@ -13810,11 +15092,32 @@ function pushTrace(trace, topic, score) {
|
|
|
13810
15092
|
score
|
|
13811
15093
|
});
|
|
13812
15094
|
}
|
|
15095
|
+
function pickBestTopic(topics2, input) {
|
|
15096
|
+
const ranked = topics2.filter((topic) => topic.status !== "archived").map((topic) => ({
|
|
15097
|
+
topic,
|
|
15098
|
+
score: scoreTopicMatch(topic, input)
|
|
15099
|
+
})).sort((left, right) => {
|
|
15100
|
+
if (right.score !== left.score) {
|
|
15101
|
+
return right.score - left.score;
|
|
15102
|
+
}
|
|
15103
|
+
const leftName = left.topic.name.trim().toLowerCase();
|
|
15104
|
+
const rightName = right.topic.name.trim().toLowerCase();
|
|
15105
|
+
return leftName.localeCompare(rightName);
|
|
15106
|
+
});
|
|
15107
|
+
return ranked[0]?.topic ?? null;
|
|
15108
|
+
}
|
|
15109
|
+
function pickFallbackRootTopic(topics2, input) {
|
|
15110
|
+
const parentless = topics2.filter((topic) => !topic.parentTopicId);
|
|
15111
|
+
return pickBestTopic(parentless, input) ?? pickBestTopic(topics2, input);
|
|
15112
|
+
}
|
|
13813
15113
|
async function loadTopicUniverse(ctx, input) {
|
|
13814
15114
|
const desiredTenantId = ctx.tenantId;
|
|
13815
|
-
const desiredWorkspaceId =
|
|
15115
|
+
const desiredWorkspaceId = readString3(input.workspaceId) ?? ctx.workspaceId;
|
|
13816
15116
|
const rawTopics = await fetchTopicTree(ctx);
|
|
13817
|
-
const
|
|
15117
|
+
const scopedTopics = rawTopics.filter(
|
|
15118
|
+
(topic) => topicMatchesScope(topic, desiredTenantId, desiredWorkspaceId)
|
|
15119
|
+
);
|
|
15120
|
+
const root = rawTopics.find((topic) => topic.rawId === ROOT_TOPIC_ID) ?? await fetchTopicById(ctx, ROOT_TOPIC_ID) ?? pickFallbackRootTopic(scopedTopics, input) ?? null;
|
|
13818
15121
|
if (!root) {
|
|
13819
15122
|
throw new Error("[topic-resolver] Root topic not found.");
|
|
13820
15123
|
}
|
|
@@ -14657,7 +15960,13 @@ var scopeContextHandlers = {
|
|
|
14657
15960
|
packWeightOverrides: Array.isArray(args.packWeightOverrides) ? args.packWeightOverrides : void 0
|
|
14658
15961
|
})
|
|
14659
15962
|
);
|
|
14660
|
-
|
|
15963
|
+
const publicContext = toPublicCompiledContext(compiled);
|
|
15964
|
+
writeLucernJson({
|
|
15965
|
+
topicId: publicContext.topicId ?? topicId,
|
|
15966
|
+
topicName: publicContext.topicName,
|
|
15967
|
+
activeWorktree: null
|
|
15968
|
+
});
|
|
15969
|
+
return publicContext;
|
|
14661
15970
|
},
|
|
14662
15971
|
async record_scope_learning(args, ctx) {
|
|
14663
15972
|
const explicitTopicId = readString(readTopicIdArg(args));
|
|
@@ -14852,20 +16161,27 @@ var worktreeHandlers = {
|
|
|
14852
16161
|
},
|
|
14853
16162
|
async merge(args, ctx) {
|
|
14854
16163
|
const record = asRecord(args);
|
|
14855
|
-
const outcomes = Array.isArray(record.outcomes) ? record.outcomes
|
|
16164
|
+
const outcomes = Array.isArray(record.outcomes) ? record.outcomes.map((entry) => {
|
|
16165
|
+
const finding = readString(entry);
|
|
16166
|
+
if (finding) {
|
|
16167
|
+
return finding;
|
|
16168
|
+
}
|
|
16169
|
+
const row = asRecord(entry);
|
|
16170
|
+
if (!Object.keys(row).length) {
|
|
16171
|
+
return null;
|
|
16172
|
+
}
|
|
16173
|
+
return {
|
|
16174
|
+
beliefId: readString(row.beliefId) ?? "",
|
|
16175
|
+
confidence: readNumber(row.confidence) ?? Number.NaN,
|
|
16176
|
+
rationale: readString(row.rationale) ?? ""
|
|
16177
|
+
};
|
|
16178
|
+
}).filter((entry) => entry !== null) : [];
|
|
14856
16179
|
return formatSdkResult(
|
|
14857
16180
|
await getSdkClient(ctx).worktrees.merge(
|
|
14858
16181
|
readString(record.worktreeId ?? record.id) ?? "",
|
|
14859
16182
|
{
|
|
14860
16183
|
summary: readString(record.summary),
|
|
14861
|
-
outcomes
|
|
14862
|
-
const row = asRecord(entry);
|
|
14863
|
-
return {
|
|
14864
|
-
beliefId: readString(row.beliefId) ?? "",
|
|
14865
|
-
confidence: readNumber(row.confidence) ?? Number.NaN,
|
|
14866
|
-
rationale: readString(row.rationale) ?? ""
|
|
14867
|
-
};
|
|
14868
|
-
})
|
|
16184
|
+
outcomes
|
|
14869
16185
|
}
|
|
14870
16186
|
)
|
|
14871
16187
|
);
|