@lucern/contracts 0.3.0-alpha.2 → 0.3.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/component-boundary.contract.d.ts +14 -0
  2. package/dist/component-boundary.contract.js +155 -0
  3. package/dist/component-boundary.contract.js.map +1 -0
  4. package/dist/component-host-boundary.contract.d.ts +41 -0
  5. package/dist/component-host-boundary.contract.js +54 -0
  6. package/dist/component-host-boundary.contract.js.map +1 -0
  7. package/dist/function-registry/beliefs.d.ts +41 -41
  8. package/dist/function-registry/beliefs.js +202 -8
  9. package/dist/function-registry/beliefs.js.map +1 -1
  10. package/dist/function-registry/coding.js +187 -8
  11. package/dist/function-registry/coding.js.map +1 -1
  12. package/dist/function-registry/context.d.ts +13 -13
  13. package/dist/function-registry/context.js +187 -9
  14. package/dist/function-registry/context.js.map +1 -1
  15. package/dist/function-registry/contracts.js +158 -5
  16. package/dist/function-registry/contracts.js.map +1 -1
  17. package/dist/function-registry/coordination.js +158 -5
  18. package/dist/function-registry/coordination.js.map +1 -1
  19. package/dist/function-registry/edges.js +169 -6
  20. package/dist/function-registry/edges.js.map +1 -1
  21. package/dist/function-registry/evidence.d.ts +33 -33
  22. package/dist/function-registry/evidence.js +202 -9
  23. package/dist/function-registry/evidence.js.map +1 -1
  24. package/dist/function-registry/graph.d.ts +53 -53
  25. package/dist/function-registry/graph.js +217 -12
  26. package/dist/function-registry/graph.js.map +1 -1
  27. package/dist/function-registry/helpers.d.ts +1 -1
  28. package/dist/function-registry/helpers.js +158 -5
  29. package/dist/function-registry/helpers.js.map +1 -1
  30. package/dist/function-registry/identity.js +158 -5
  31. package/dist/function-registry/identity.js.map +1 -1
  32. package/dist/function-registry/index.d.ts +1 -1
  33. package/dist/function-registry/index.js +158 -5
  34. package/dist/function-registry/index.js.map +1 -1
  35. package/dist/function-registry/judgments.d.ts +9 -9
  36. package/dist/function-registry/judgments.js +170 -8
  37. package/dist/function-registry/judgments.js.map +1 -1
  38. package/dist/function-registry/legacy.js +158 -5
  39. package/dist/function-registry/legacy.js.map +1 -1
  40. package/dist/function-registry/lenses.d.ts +17 -17
  41. package/dist/function-registry/lenses.js +181 -8
  42. package/dist/function-registry/lenses.js.map +1 -1
  43. package/dist/function-registry/manifest.d.ts +3 -3
  44. package/dist/function-registry/manifest.js +1 -1
  45. package/dist/function-registry/manifest.js.map +1 -1
  46. package/dist/function-registry/ontologies.d.ts +45 -45
  47. package/dist/function-registry/ontologies.js +176 -11
  48. package/dist/function-registry/ontologies.js.map +1 -1
  49. package/dist/function-registry/pipeline.d.ts +13 -13
  50. package/dist/function-registry/pipeline.js +167 -8
  51. package/dist/function-registry/pipeline.js.map +1 -1
  52. package/dist/function-registry/questions.d.ts +49 -49
  53. package/dist/function-registry/questions.js +255 -13
  54. package/dist/function-registry/questions.js.map +1 -1
  55. package/dist/function-registry/tasks.js +158 -5
  56. package/dist/function-registry/tasks.js.map +1 -1
  57. package/dist/function-registry/topics.d.ts +21 -21
  58. package/dist/function-registry/topics.js +172 -8
  59. package/dist/function-registry/topics.js.map +1 -1
  60. package/dist/function-registry/types.d.ts +1 -1
  61. package/dist/function-registry/worktrees.d.ts +80 -41
  62. package/dist/function-registry/worktrees.js +292 -17
  63. package/dist/function-registry/worktrees.js.map +1 -1
  64. package/dist/function-registry-input-audit.d.ts +13 -0
  65. package/dist/function-registry-input-audit.js +164 -0
  66. package/dist/function-registry-input-audit.js.map +1 -0
  67. package/dist/gateway.contract.d.ts +2 -0
  68. package/dist/gateway.contract.js.map +1 -1
  69. package/dist/generated/convexSchemas.js +2 -1
  70. package/dist/generated/convexSchemas.js.map +1 -1
  71. package/dist/generated/schema-manifest.json +42 -3
  72. package/dist/generated/tableOwnership.d.ts +2 -1
  73. package/dist/generated/tableOwnership.js +2 -0
  74. package/dist/generated/tableOwnership.js.map +1 -1
  75. package/dist/generated/tier-expectations.json +4 -2
  76. package/dist/index.d.ts +445 -35
  77. package/dist/index.js +1987 -17
  78. package/dist/index.js.map +1 -1
  79. package/dist/infisical-runtime.contract.d.ts +174 -0
  80. package/dist/infisical-runtime.contract.js +192 -0
  81. package/dist/infisical-runtime.contract.js.map +1 -0
  82. package/dist/mcp-gateway-boundary.contract.d.ts +181 -0
  83. package/dist/mcp-gateway-boundary.contract.js +43 -0
  84. package/dist/mcp-gateway-boundary.contract.js.map +1 -0
  85. package/dist/schemas/component-table-manifest.d.ts +2 -2
  86. package/dist/schemas/index.js +38 -1
  87. package/dist/schemas/index.js.map +1 -1
  88. package/dist/schemas/manifest.d.ts +1050 -910
  89. package/dist/schemas/manifest.js +38 -1
  90. package/dist/schemas/manifest.js.map +1 -1
  91. package/dist/schemas/sl-opinion.d.ts +4 -4
  92. package/dist/schemas/tables/identity/platform.d.ts +10 -10
  93. package/dist/schemas/tables/kernel/epistemic.d.ts +6 -6
  94. package/dist/schemas/tables/kernel/infra.d.ts +4 -4
  95. package/dist/schemas/tables/kernel/intelligence.d.ts +10 -10
  96. package/dist/schemas/tables/kernel/lens.d.ts +4 -4
  97. package/dist/schemas/tables/kernel/platform.d.ts +12 -12
  98. package/dist/schemas/tables/kernel/spine.d.ts +2 -2
  99. package/dist/schemas/tables/kernel/task.d.ts +42 -42
  100. package/dist/schemas/tables/kernel/worktree.d.ts +62 -62
  101. package/dist/schemas/tables/mc/identity.d.ts +26 -3
  102. package/dist/schemas/tables/mc/identity.js +35 -1
  103. package/dist/schemas/tables/mc/identity.js.map +1 -1
  104. package/dist/schemas/tables/mc/pack.d.ts +20 -20
  105. package/dist/schemas/tables/mc/registry.d.ts +4 -4
  106. package/dist/schemas/tables/mc/workspace.d.ts +9 -3
  107. package/dist/schemas/tables/mc/workspace.js +3 -1
  108. package/dist/schemas/tables/mc/workspace.js.map +1 -1
  109. package/dist/sdk-methods.contract.d.ts +1 -1
  110. package/dist/{sdk-tools.contract-S4ia0TTo.d.ts → sdk-tools.contract-CD-N1Jf7.d.ts} +1 -1
  111. package/dist/sdk-tools.contract.d.ts +2 -2
  112. package/dist/sdk-tools.contract.js +157 -4
  113. package/dist/sdk-tools.contract.js.map +1 -1
  114. package/dist/tenant-bootstrap-seed.contract.d.ts +1097 -0
  115. package/dist/tenant-bootstrap-seed.contract.js +651 -0
  116. package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
  117. package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
  118. package/dist/tenant-bootstrap-seed.defaults.js +303 -0
  119. package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
  120. package/dist/tenant-client.contract.d.ts +266 -0
  121. package/dist/tenant-client.contract.js +404 -0
  122. package/dist/tenant-client.contract.js.map +1 -0
  123. package/dist/{tool-contracts-C92-9ueT.d.ts → tool-contracts-BcKz-VGj.d.ts} +4 -2
  124. package/dist/tool-contracts.d.ts +1 -1
  125. package/dist/tool-contracts.js +158 -5
  126. package/dist/tool-contracts.js.map +1 -1
  127. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { F as FunctionEffect } from '../defineFunction-DO97DKs4.js';
3
- import { M as McpToolContract } from '../tool-contracts-C92-9ueT.js';
3
+ import { M as McpToolContract } from '../tool-contracts-BcKz-VGj.js';
4
4
 
5
5
  type FunctionKind = "query" | "mutation" | "action";
6
6
  type FunctionIdempotency = boolean | "required";
@@ -1,4 +1,4 @@
1
- import * as zod from 'zod';
1
+ import { z } from 'zod';
2
2
 
3
3
  /**
4
4
  * MCP Tool Contract Definitions
@@ -115,10 +115,10 @@ declare const worktreesContracts: readonly [{
115
115
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
116
116
  };
117
117
  convex: FunctionConvexTarget | undefined;
118
- args: zod.ZodTypeAny;
119
- returns: zod.ZodTypeAny;
120
- input: zod.ZodTypeAny;
121
- output: zod.ZodTypeAny;
118
+ args: z.ZodTypeAny;
119
+ returns: z.ZodTypeAny;
120
+ input: z.ZodTypeAny;
121
+ output: z.ZodTypeAny;
122
122
  openapi: {
123
123
  summary: string;
124
124
  tags: string[];
@@ -154,10 +154,10 @@ declare const worktreesContracts: readonly [{
154
154
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
155
155
  };
156
156
  convex: FunctionConvexTarget | undefined;
157
- args: zod.ZodTypeAny;
158
- returns: zod.ZodTypeAny;
159
- input: zod.ZodTypeAny;
160
- output: zod.ZodTypeAny;
157
+ args: z.ZodTypeAny;
158
+ returns: z.ZodTypeAny;
159
+ input: z.ZodTypeAny;
160
+ output: z.ZodTypeAny;
161
161
  openapi: {
162
162
  summary: string;
163
163
  tags: string[];
@@ -193,10 +193,10 @@ declare const worktreesContracts: readonly [{
193
193
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
194
194
  };
195
195
  convex: FunctionConvexTarget | undefined;
196
- args: zod.ZodTypeAny;
197
- returns: zod.ZodTypeAny;
198
- input: zod.ZodTypeAny;
199
- output: zod.ZodTypeAny;
196
+ args: z.ZodTypeAny;
197
+ returns: z.ZodTypeAny;
198
+ input: z.ZodTypeAny;
199
+ output: z.ZodTypeAny;
200
200
  openapi: {
201
201
  summary: string;
202
202
  tags: string[];
@@ -232,10 +232,10 @@ declare const worktreesContracts: readonly [{
232
232
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
233
233
  };
234
234
  convex: FunctionConvexTarget | undefined;
235
- args: zod.ZodTypeAny;
236
- returns: zod.ZodTypeAny;
237
- input: zod.ZodTypeAny;
238
- output: zod.ZodTypeAny;
235
+ args: z.ZodTypeAny;
236
+ returns: z.ZodTypeAny;
237
+ input: z.ZodTypeAny;
238
+ output: z.ZodTypeAny;
239
239
  openapi: {
240
240
  summary: string;
241
241
  tags: string[];
@@ -271,10 +271,10 @@ declare const worktreesContracts: readonly [{
271
271
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
272
272
  };
273
273
  convex: FunctionConvexTarget | undefined;
274
- args: zod.ZodTypeAny;
275
- returns: zod.ZodTypeAny;
276
- input: zod.ZodTypeAny;
277
- output: zod.ZodTypeAny;
274
+ args: z.ZodTypeAny;
275
+ returns: z.ZodTypeAny;
276
+ input: z.ZodTypeAny;
277
+ output: z.ZodTypeAny;
278
278
  openapi: {
279
279
  summary: string;
280
280
  tags: string[];
@@ -310,10 +310,10 @@ declare const worktreesContracts: readonly [{
310
310
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
311
311
  };
312
312
  convex: FunctionConvexTarget | undefined;
313
- args: zod.ZodTypeAny;
314
- returns: zod.ZodTypeAny;
315
- input: zod.ZodTypeAny;
316
- output: zod.ZodTypeAny;
313
+ args: z.ZodTypeAny;
314
+ returns: z.ZodTypeAny;
315
+ input: z.ZodTypeAny;
316
+ output: z.ZodTypeAny;
317
317
  openapi: {
318
318
  summary: string;
319
319
  tags: string[];
@@ -349,10 +349,10 @@ declare const worktreesContracts: readonly [{
349
349
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
350
350
  };
351
351
  convex: FunctionConvexTarget | undefined;
352
- args: zod.ZodTypeAny;
353
- returns: zod.ZodTypeAny;
354
- input: zod.ZodTypeAny;
355
- output: zod.ZodTypeAny;
352
+ args: z.ZodTypeAny;
353
+ returns: z.ZodTypeAny;
354
+ input: z.ZodTypeAny;
355
+ output: z.ZodTypeAny;
356
356
  openapi: {
357
357
  summary: string;
358
358
  tags: string[];
@@ -388,10 +388,10 @@ declare const worktreesContracts: readonly [{
388
388
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
389
389
  };
390
390
  convex: FunctionConvexTarget | undefined;
391
- args: zod.ZodTypeAny;
392
- returns: zod.ZodTypeAny;
393
- input: zod.ZodTypeAny;
394
- output: zod.ZodTypeAny;
391
+ args: z.ZodTypeAny;
392
+ returns: z.ZodTypeAny;
393
+ input: z.ZodTypeAny;
394
+ output: z.ZodTypeAny;
395
395
  openapi: {
396
396
  summary: string;
397
397
  tags: string[];
@@ -427,10 +427,10 @@ declare const worktreesContracts: readonly [{
427
427
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
428
428
  };
429
429
  convex: FunctionConvexTarget | undefined;
430
- args: zod.ZodTypeAny;
431
- returns: zod.ZodTypeAny;
432
- input: zod.ZodTypeAny;
433
- output: zod.ZodTypeAny;
430
+ args: z.ZodTypeAny;
431
+ returns: z.ZodTypeAny;
432
+ input: z.ZodTypeAny;
433
+ output: z.ZodTypeAny;
434
434
  openapi: {
435
435
  summary: string;
436
436
  tags: string[];
@@ -466,10 +466,49 @@ declare const worktreesContracts: readonly [{
466
466
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
467
467
  };
468
468
  convex: FunctionConvexTarget | undefined;
469
- args: zod.ZodTypeAny;
470
- returns: zod.ZodTypeAny;
471
- input: zod.ZodTypeAny;
472
- output: zod.ZodTypeAny;
469
+ args: z.ZodTypeAny;
470
+ returns: z.ZodTypeAny;
471
+ input: z.ZodTypeAny;
472
+ output: z.ZodTypeAny;
473
+ openapi: {
474
+ summary: string;
475
+ tags: string[];
476
+ };
477
+ }, {
478
+ name: string;
479
+ kind: FunctionKind;
480
+ idempotent: FunctionIdempotency;
481
+ effects: readonly FunctionEffect[];
482
+ invariants: readonly string[] | undefined;
483
+ surfaceIntent: FunctionSurfaceIntent;
484
+ domain: string;
485
+ surfaceClass: SurfaceClass;
486
+ surfaces: FunctionSurfaceMap;
487
+ replacedBy: string | undefined;
488
+ rest: {
489
+ method: "GET" | "POST" | "PATCH" | "DELETE";
490
+ path: string;
491
+ };
492
+ sdk: {
493
+ namespace: string;
494
+ method: string;
495
+ };
496
+ mcp: {
497
+ exposed: boolean;
498
+ toolName: string;
499
+ } & McpToolContract & {
500
+ exposed: boolean;
501
+ toolName: string;
502
+ };
503
+ auth: {
504
+ scopes: string[];
505
+ allowedPrincipalTypes: ("user" | "service" | "agent")[];
506
+ };
507
+ convex: FunctionConvexTarget | undefined;
508
+ args: z.ZodTypeAny;
509
+ returns: z.ZodTypeAny;
510
+ input: z.ZodTypeAny;
511
+ output: z.ZodTypeAny;
473
512
  openapi: {
474
513
  summary: string;
475
514
  tags: string[];
@@ -422,6 +422,14 @@ var ADD_WORKTREE = {
422
422
  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.",
423
423
  parameters: {
424
424
  title: { type: "string", description: "Worktree name/objective" },
425
+ name: {
426
+ type: "string",
427
+ description: "Optional storage-name alias for callers that already use backend naming"
428
+ },
429
+ projectId: {
430
+ type: "string",
431
+ description: "Legacy topicId alias"
432
+ },
425
433
  topicId: { type: "string", description: "Optional topic scope hint" },
426
434
  branchId: {
427
435
  type: "string",
@@ -435,14 +443,87 @@ var ADD_WORKTREE = {
435
443
  type: "string",
436
444
  description: "The testable claim this worktree investigates"
437
445
  },
446
+ rationale: {
447
+ type: "string",
448
+ description: "Why this worktree exists and why it belongs in the campaign"
449
+ },
450
+ worktreeType: {
451
+ type: "string",
452
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
453
+ },
454
+ gate: {
455
+ type: "string",
456
+ description: "Exit gate name for this worktree"
457
+ },
458
+ startDate: {
459
+ type: "number",
460
+ description: "Planned start timestamp in milliseconds since epoch"
461
+ },
462
+ endDate: {
463
+ type: "number",
464
+ description: "Planned end timestamp in milliseconds since epoch"
465
+ },
466
+ durationWeeks: {
467
+ type: "number",
468
+ description: "Planned duration in weeks"
469
+ },
470
+ confidenceImpact: {
471
+ type: "string",
472
+ description: "Expected confidence impact if the worktree succeeds",
473
+ enum: ["high", "medium", "low"]
474
+ },
475
+ beliefFocus: {
476
+ type: "string",
477
+ description: "Natural-language focus spanning the target belief neighborhood"
478
+ },
438
479
  beliefIds: {
439
480
  type: "array",
440
- description: "Beliefs to test in this worktree"
481
+ description: "Legacy alias for targetBeliefIds"
482
+ },
483
+ beliefs: {
484
+ type: "array",
485
+ description: "Legacy alias for targetBeliefIds"
486
+ },
487
+ targetBeliefIds: {
488
+ type: "array",
489
+ description: "Belief node IDs this worktree is expected to test or update"
490
+ },
491
+ targetQuestionIds: {
492
+ type: "array",
493
+ description: "Question node IDs this worktree is expected to answer"
494
+ },
495
+ keyQuestions: {
496
+ type: "array",
497
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
498
+ },
499
+ evidenceSignals: {
500
+ type: "array",
501
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
502
+ },
503
+ decisionGate: {
504
+ type: "object",
505
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
506
+ },
507
+ goCriteria: {
508
+ type: "array",
509
+ description: "Shorthand go criteria used to build decisionGate"
510
+ },
511
+ noGoSignals: {
512
+ type: "array",
513
+ description: "Shorthand no-go signals used to build decisionGate"
514
+ },
515
+ proofArtifacts: {
516
+ type: "array",
517
+ description: "Expected proof artifacts required to close the worktree"
441
518
  },
442
519
  autoShape: {
443
520
  type: "boolean",
444
521
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
445
522
  },
523
+ autoFixPolicy: {
524
+ type: "object",
525
+ description: "Policy for permitted automatic remediation inside the worktree"
526
+ },
446
527
  domainPackId: {
447
528
  type: "string",
448
529
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
@@ -471,9 +552,17 @@ var ADD_WORKTREE = {
471
552
  type: "array",
472
553
  description: "Worktree IDs blocked by this worktree"
473
554
  },
474
- gate: {
555
+ staffingHint: {
475
556
  type: "string",
476
- description: "Exit gate name for this worktree"
557
+ description: "Suggested staffing or agent allocation note"
558
+ },
559
+ lensId: {
560
+ type: "string",
561
+ description: "Lens that scopes this worktree when applicable"
562
+ },
563
+ lastReconciledAt: {
564
+ type: "number",
565
+ description: "Timestamp when worktree metadata was last reconciled"
477
566
  }
478
567
  },
479
568
  required: ["title", "topicId"],
@@ -503,7 +592,7 @@ var MERGE = {
503
592
  worktreeId: { type: "string", description: "The worktree to merge" },
504
593
  outcomes: {
505
594
  type: "array",
506
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
595
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
507
596
  },
508
597
  summary: { type: "string", description: "Overall findings summary" }
509
598
  },
@@ -3522,6 +3611,69 @@ var GENERATE_SESSION_HANDOFF = {
3522
3611
  tier: "showcase",
3523
3612
  internal: true
3524
3613
  };
3614
+ var BEGIN_BUILD_SESSION = {
3615
+ name: "begin_build_session",
3616
+ 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.",
3617
+ parameters: {
3618
+ worktreeId: {
3619
+ type: "string",
3620
+ description: "The Lucern worktree ID to bootstrap."
3621
+ },
3622
+ branch: {
3623
+ type: "string",
3624
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
3625
+ },
3626
+ branchBase: {
3627
+ type: "string",
3628
+ description: 'Base branch for the feature branch. Default: "staging".'
3629
+ },
3630
+ prBase: {
3631
+ type: "string",
3632
+ description: 'Target branch for the PR. Default: "staging".'
3633
+ },
3634
+ sessionMode: {
3635
+ type: "string",
3636
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
3637
+ enum: ["async", "interactive"]
3638
+ },
3639
+ activateIfPlanning: {
3640
+ type: "boolean",
3641
+ description: "When true, automatically activate a planning worktree during bootstrap."
3642
+ }
3643
+ },
3644
+ required: ["worktreeId"],
3645
+ response: {
3646
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
3647
+ fields: {
3648
+ topicId: "string \u2014 canonical topic scope",
3649
+ topicName: "string \u2014 human-readable topic name",
3650
+ worktreeId: "string \u2014 worktree ID",
3651
+ worktreeName: "string \u2014 human-readable worktree name",
3652
+ branch: "string \u2014 git branch name",
3653
+ branchBase: "string \u2014 base branch",
3654
+ prBase: "string \u2014 PR target branch",
3655
+ campaign: "number | null \u2014 top-level pipeline campaign",
3656
+ lane: "string \u2014 campaign lane",
3657
+ gate: "string \u2014 exit gate",
3658
+ hypothesis: "string \u2014 worktree hypothesis",
3659
+ focus: "string \u2014 session focus",
3660
+ status: "string \u2014 worktree status after optional activation",
3661
+ sessionMode: "string \u2014 async | interactive",
3662
+ targetBeliefIds: "array \u2014 scoped belief IDs",
3663
+ targetQuestionIds: "array \u2014 scoped question IDs",
3664
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
3665
+ openQuestions: "array \u2014 open scoped questions",
3666
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
3667
+ dependencies: "array \u2014 upstream worktrees",
3668
+ unblocks: "array \u2014 downstream worktrees",
3669
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
3670
+ }
3671
+ },
3672
+ ownerModule: "bootstrap",
3673
+ ontologyPrimitive: "worktree",
3674
+ tier: "showcase",
3675
+ internal: true
3676
+ };
3525
3677
  var MCP_TOOL_CONTRACTS = {
3526
3678
  // Belief lifecycle (commit, amend, fork, archive)
3527
3679
  create_belief: CREATE_BELIEF,
@@ -3615,6 +3767,7 @@ var MCP_TOOL_CONTRACTS = {
3615
3767
  get_agent_inbox: GET_AGENT_INBOX,
3616
3768
  claim_files: CLAIM_FILES,
3617
3769
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
3770
+ begin_build_session: BEGIN_BUILD_SESSION,
3618
3771
  // Policy / ACL (workhorse)
3619
3772
  check_permission: CHECK_PERMISSION,
3620
3773
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -3828,6 +3981,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
3828
3981
  "get_change_history",
3829
3982
  "get_failure_log",
3830
3983
  "record_attempt",
3984
+ "begin_build_session",
3831
3985
  "push",
3832
3986
  "open_pull_request",
3833
3987
  "record_judgment",
@@ -3882,7 +4036,6 @@ var SDK_ONLY_OPERATION_NAMES = [
3882
4036
  "find_semantic_orphans"
3883
4037
  ];
3884
4038
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
3885
- "begin_build_session",
3886
4039
  "evaluate_engineering_contract",
3887
4040
  "evaluate_research_contract"
3888
4041
  ];
@@ -4249,8 +4402,76 @@ function surfaceContract(args) {
4249
4402
  }
4250
4403
  });
4251
4404
  }
4252
-
4253
- // src/function-registry/worktrees.ts
4405
+ var autoFixPolicyInputSchema = z.object({
4406
+ enabled: z.boolean().optional().describe("Whether automatic remediation is enabled."),
4407
+ mode: z.string().optional().describe("Automation mode for worktree auto-fixes."),
4408
+ maxAttempts: z.number().optional().describe("Maximum number of auto-fix attempts."),
4409
+ reviewer: z.string().optional().describe("Reviewer responsible for auto-fix oversight."),
4410
+ maxActionsPerRun: z.number().optional().describe("Maximum number of auto-fix actions per run."),
4411
+ permittedMutationTiers: z.array(z.enum(["read_only", "low_risk_write", "high_risk_write"])).optional().describe("Mutation tiers the auto-fix worker may execute."),
4412
+ requireAuditTrail: z.boolean().optional().describe("Whether auto-fix actions must write an audit trail."),
4413
+ escalationGate: z.string().optional().describe("Gate to trigger when auto-fix policy requires escalation.")
4414
+ }).passthrough().describe("Policy for permitted automatic remediation inside the worktree.");
4415
+ var worktreeKeyQuestionInputSchema = z.object({
4416
+ question: z.string().describe("Question the worktree must resolve."),
4417
+ status: z.enum(["open", "answered", "forked"]).optional().describe("Current disposition of the key question."),
4418
+ answer: z.string().optional().describe("Captured answer when the key question is resolved."),
4419
+ answerConfidence: z.enum(["high", "medium", "low"]).optional().describe("Confidence in the captured answer."),
4420
+ linkedQuestionId: z.string().optional().describe("Canonical question node linked to this key question.")
4421
+ }).passthrough().describe("Question contract embedded in the worktree plan.");
4422
+ var worktreeEvidenceSignalInputSchema = z.object({
4423
+ signal: z.string().describe("Evidence signal the worktree should collect."),
4424
+ collected: z.boolean().optional().describe("Whether the signal has already been collected."),
4425
+ progress: z.string().optional().describe("Collection progress note for the signal."),
4426
+ notes: z.string().optional().describe("Additional evidence collection notes.")
4427
+ }).passthrough().describe("Evidence signal embedded in the worktree plan.");
4428
+ var worktreeDecisionGateInputSchema = z.object({
4429
+ goCriteria: z.array(z.string()).describe("Criteria that must hold for the worktree to proceed."),
4430
+ noGoSignals: z.array(z.string()).describe("Signals that stop or redirect the worktree."),
4431
+ verdict: z.enum(["go", "no_go", "pivot", "pending"]).optional().describe("Current decision verdict for the worktree gate."),
4432
+ verdictRationale: z.string().optional().describe("Rationale supporting the current gate verdict."),
4433
+ decidedAt: z.number().optional().describe("Timestamp when the gate verdict was decided."),
4434
+ decidedBy: z.string().optional().describe("Actor that decided the gate verdict.")
4435
+ }).passthrough().describe("Decision gate contract for worktree activation or exit.");
4436
+ var addWorktreeArgs = z.object({
4437
+ title: z.string().optional().describe("Human-readable worktree name or objective."),
4438
+ name: z.string().optional().describe("Storage-name alias for callers that already use backend naming."),
4439
+ topicId: z.string().describe("Primary topic scope for the worktree."),
4440
+ projectId: z.string().optional().describe("Legacy topicId alias."),
4441
+ branchId: z.string().optional().describe("Legacy branch identifier for compatibility with workflow callers."),
4442
+ objective: z.string().optional().describe("Reasoning objective this worktree is intended to resolve."),
4443
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
4444
+ rationale: z.string().optional().describe("Why this worktree exists and why it belongs in the campaign."),
4445
+ worktreeType: z.string().optional().describe("Schema-enum worktree type used for kernel lifecycle behavior."),
4446
+ gate: z.string().optional().describe("Exit gate for this worktree."),
4447
+ startDate: z.number().optional().describe("Planned start timestamp in milliseconds since epoch."),
4448
+ endDate: z.number().optional().describe("Planned end timestamp in milliseconds since epoch."),
4449
+ durationWeeks: z.number().optional().describe("Planned duration in weeks."),
4450
+ confidenceImpact: z.enum(["high", "medium", "low"]).optional().describe("Expected confidence impact if this worktree succeeds."),
4451
+ beliefFocus: z.string().optional().describe("Natural-language focus spanning the target belief neighborhood."),
4452
+ beliefIds: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
4453
+ beliefs: z.array(z.string()).optional().describe("Legacy alias for targetBeliefIds."),
4454
+ targetBeliefIds: z.array(z.string()).optional().describe("Belief node IDs this worktree is expected to test or update."),
4455
+ targetQuestionIds: z.array(z.string()).optional().describe("Question node IDs this worktree is expected to answer."),
4456
+ keyQuestions: z.array(worktreeKeyQuestionInputSchema).optional().describe("Inline key questions captured as part of the worktree plan."),
4457
+ evidenceSignals: z.array(worktreeEvidenceSignalInputSchema).optional().describe("Evidence signals the worktree needs to collect or validate."),
4458
+ decisionGate: worktreeDecisionGateInputSchema.optional(),
4459
+ goCriteria: z.array(z.string()).optional().describe("Shorthand go criteria used to build decisionGate."),
4460
+ noGoSignals: z.array(z.string()).optional().describe("Shorthand no-go signals used to build decisionGate."),
4461
+ proofArtifacts: z.array(z.unknown()).optional().describe("Expected proof artifacts required to close the worktree."),
4462
+ autoShape: z.boolean().optional().describe("Whether to invoke inquiry auto-shaping during creation."),
4463
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
4464
+ domainPackId: z.string().optional().describe("Domain pack whose shaping hooks should influence the worktree."),
4465
+ campaign: z.number().optional().describe("Top-level pipeline campaign number."),
4466
+ lane: z.string().optional().describe("Campaign lane for the worktree."),
4467
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
4468
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
4469
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs that must complete before this worktree."),
4470
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
4471
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
4472
+ lensId: z.string().optional().describe("Lens that scopes this worktree when applicable."),
4473
+ lastReconciledAt: z.number().optional().describe("Timestamp when worktree metadata was last reconciled.")
4474
+ });
4254
4475
  var worktreeIdInput = (input) => compactRecord({
4255
4476
  worktreeId: input.worktreeId ?? input.id
4256
4477
  });
@@ -4283,6 +4504,50 @@ var worktreeMetadataInput = (input) => compactRecord({
4283
4504
  autoFixPolicy: input.autoFixPolicy,
4284
4505
  lastReconciledAt: input.lastReconciledAt
4285
4506
  });
4507
+ var worktreeMetadataArgs = z.object({
4508
+ worktreeId: z.string().describe("The worktree to update."),
4509
+ id: z.string().optional().describe("Worktree ID alias."),
4510
+ topicId: z.string().optional().describe("Primary topic scope."),
4511
+ additionalTopicIds: z.array(z.string()).optional().describe("Additional topic scopes associated with this worktree."),
4512
+ status: z.string().optional().describe("Worktree lifecycle status."),
4513
+ campaign: z.number().optional().describe("Top-level pipeline campaign."),
4514
+ lane: z.string().optional().describe("Campaign lane."),
4515
+ laneOrderInCampaign: z.number().optional().describe("Ordering for this lane within its campaign."),
4516
+ orderInLane: z.number().optional().describe("Position of this worktree inside its lane."),
4517
+ gate: z.string().optional().describe("Exit gate for this worktree."),
4518
+ hypothesis: z.string().optional().describe("Testable claim this worktree investigates."),
4519
+ objective: z.string().optional().describe("Reasoning objective for the worktree."),
4520
+ rationale: z.string().optional().describe("Why this worktree is sequenced here."),
4521
+ proofArtifacts: z.array(z.unknown()).optional().describe("Proof artifacts required to close the worktree."),
4522
+ staffingHint: z.string().optional().describe("Suggested staffing or agent allocation note."),
4523
+ blocks: z.array(z.string()).optional().describe("Worktree IDs blocked by this worktree."),
4524
+ dependsOn: z.array(z.string()).optional().describe("Worktree IDs this worktree depends on."),
4525
+ lensId: z.string().optional().describe("Lens that scopes this worktree."),
4526
+ autoFixPolicy: autoFixPolicyInputSchema.optional(),
4527
+ lastReconciledAt: z.number().optional().describe("Timestamp of the last deterministic reconciliation pass.")
4528
+ });
4529
+ var pushArgs = worktreeMetadataArgs.extend({
4530
+ targetContext: z.string().describe("Where to push merged findings."),
4531
+ beliefIds: z.array(z.string()).optional().describe("Optional subset of beliefs to push.")
4532
+ });
4533
+ var openPullRequestArgs = worktreeMetadataArgs.extend({
4534
+ reviewers: z.array(z.string()).optional().describe("User IDs of requested reviewers."),
4535
+ summary: z.string().describe("Summary of findings and why they are ready for review.")
4536
+ });
4537
+ var mergeKeyFindingsInput = (input) => {
4538
+ if (Array.isArray(input.keyFindings)) {
4539
+ return input.keyFindings;
4540
+ }
4541
+ if (Array.isArray(input.outcomes)) {
4542
+ const findings = input.outcomes.filter(
4543
+ (outcome) => typeof outcome === "string" && outcome.trim().length > 0
4544
+ );
4545
+ if (findings.length > 0) {
4546
+ return findings;
4547
+ }
4548
+ }
4549
+ return [input.summary ?? "Merged worktree"];
4550
+ };
4286
4551
  var listAllWorktreesInput = (input) => compactRecord({
4287
4552
  status: input.status,
4288
4553
  lane: input.lane,
@@ -4290,6 +4555,16 @@ var listAllWorktreesInput = (input) => compactRecord({
4290
4555
  limit: input.limit
4291
4556
  });
4292
4557
  var worktreesContracts = [
4558
+ surfaceContract({
4559
+ name: "begin_build_session",
4560
+ kind: "mutation",
4561
+ domain: "worktrees",
4562
+ surfaceClass: "platform_internal",
4563
+ path: "/mcp/build-session/begin",
4564
+ sdkNamespace: "worktrees",
4565
+ sdkMethod: "beginBuildSession",
4566
+ summary: "Begin a coding build session for a worktree."
4567
+ }),
4293
4568
  surfaceContract({
4294
4569
  name: "add_worktree",
4295
4570
  kind: "mutation",
@@ -4306,13 +4581,12 @@ var worktreesContracts = [
4306
4581
  inputProjection: (input, context) => withCreatedBy(
4307
4582
  compactRecord({
4308
4583
  name: input.name ?? input.title,
4309
- topicId: input.topicId,
4584
+ topicId: input.topicId ?? input.projectId,
4310
4585
  worktreeType: input.worktreeType,
4311
4586
  objective: input.objective,
4312
4587
  gate: input.gate,
4313
4588
  hypothesis: input.hypothesis,
4314
4589
  rationale: input.rationale,
4315
- signal: input.signal,
4316
4590
  startDate: input.startDate,
4317
4591
  endDate: input.endDate,
4318
4592
  durationWeeks: input.durationWeeks,
@@ -4338,12 +4612,12 @@ var worktreesContracts = [
4338
4612
  staffingHint: input.staffingHint,
4339
4613
  domainPackId: input.domainPackId,
4340
4614
  lensId: input.lensId,
4341
- linkedQuestionId: input.linkedQuestionId,
4342
4615
  lastReconciledAt: input.lastReconciledAt
4343
4616
  }),
4344
4617
  context
4345
4618
  )
4346
- }
4619
+ },
4620
+ args: addWorktreeArgs
4347
4621
  }),
4348
4622
  surfaceContract({
4349
4623
  name: "activate_worktree",
@@ -4455,7 +4729,8 @@ var worktreesContracts = [
4455
4729
  functionName: "updateMetadata",
4456
4730
  kind: "mutation",
4457
4731
  inputProjection: worktreeMetadataInput
4458
- }
4732
+ },
4733
+ args: worktreeMetadataArgs
4459
4734
  }),
4460
4735
  surfaceContract({
4461
4736
  name: "merge",
@@ -4473,9 +4748,7 @@ var worktreesContracts = [
4473
4748
  inputProjection: (input, context) => withUserId(
4474
4749
  {
4475
4750
  ...worktreeIdInput(input),
4476
- keyFindings: input.keyFindings ?? [
4477
- input.summary ?? "Merged worktree"
4478
- ],
4751
+ keyFindings: mergeKeyFindingsInput(input),
4479
4752
  decisionsReached: input.decisionsReached ?? [],
4480
4753
  nextSteps: input.nextSteps ?? []
4481
4754
  },
@@ -4497,7 +4770,8 @@ var worktreesContracts = [
4497
4770
  functionName: "updateMetadata",
4498
4771
  kind: "mutation",
4499
4772
  inputProjection: worktreeMetadataInput
4500
- }
4773
+ },
4774
+ args: pushArgs
4501
4775
  }),
4502
4776
  surfaceContract({
4503
4777
  name: "open_pull_request",
@@ -4513,7 +4787,8 @@ var worktreesContracts = [
4513
4787
  functionName: "updateMetadata",
4514
4788
  kind: "mutation",
4515
4789
  inputProjection: worktreeMetadataInput
4516
- }
4790
+ },
4791
+ args: openPullRequestArgs
4517
4792
  })
4518
4793
  ];
4519
4794