@productbrain/mcp 0.0.1-beta.5975 → 0.0.1-beta.5978

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.
@@ -95,7 +95,7 @@ function resolveEffectiveCollection(result2, preview, fallbackCollection) {
95
95
  }
96
96
 
97
97
  // src/tools/entries.ts
98
- import { z as z11 } from "zod/v3";
98
+ import { z as z12 } from "zod/v3";
99
99
 
100
100
  // src/envelope.ts
101
101
  import { z } from "zod/v3";
@@ -374,6 +374,19 @@ function thinWrapper(handler) {
374
374
  };
375
375
  }
376
376
 
377
+ // src/tools/knowledge-helpers.ts
378
+ import { z as z2 } from "zod/v3";
379
+
380
+ // src/lib/strip.ts
381
+ var ANSI_AND_CONTROL_RE = /\x1b\[[0-9;]*[A-Za-z]|\x1b\][^\x07]*\x07|\x1b[^[\]0-9;A-Za-z]?|[\x00-\x08\x0b-\x1f\x7f]/g;
382
+ function stripControlChars(str) {
383
+ if (!str) return str;
384
+ return str.replace(ANSI_AND_CONTROL_RE, "");
385
+ }
386
+ function sanitizeSingleLineField(str) {
387
+ return stripControlChars(str).replace(/\s+/g, " ").trim();
388
+ }
389
+
377
390
  // src/tools/knowledge-helpers.ts
378
391
  var EPISTEMIC_COLLECTIONS = /* @__PURE__ */ new Set(["insights", "assumptions"]);
379
392
  function deriveEpistemicStatus(entry) {
@@ -427,6 +440,36 @@ function toEpistemicInput(entry) {
427
440
  relations: Array.isArray(entry.relations) ? entry.relations.map((r) => ({ type: r.type, direction: r.direction })) : void 0
428
441
  };
429
442
  }
443
+ var ownerTeam = z2.object({ id: z2.string(), name: z2.string() });
444
+ var ownerRole = z2.object({ id: z2.string(), name: z2.string() });
445
+ var ownerOutputShape = z2.discriminatedUnion("kind", [
446
+ z2.object({ kind: z2.literal("one"), team: ownerTeam, role: ownerRole }),
447
+ z2.object({ kind: z2.literal("default"), team: ownerTeam }),
448
+ z2.object({ kind: z2.literal("unavailable") }),
449
+ // Review round 2: count is capped at OWNERSHIP_DISPLAY_CAP; truncated is true when a row past
450
+ // that cap exists, so 3+ duplicates are never silently reported as exactly 2.
451
+ z2.object({ kind: z2.literal("many"), count: z2.number(), truncated: z2.boolean() }),
452
+ z2.object({ kind: z2.literal("dangling"), teamId: z2.string(), roleId: z2.string() })
453
+ ]);
454
+ function parseOwnerOutput(raw) {
455
+ if (!raw) return void 0;
456
+ const result2 = ownerOutputShape.safeParse(raw);
457
+ return result2.success ? result2.data : void 0;
458
+ }
459
+ function formatOwnerLine(owner) {
460
+ switch (owner.kind) {
461
+ case "one":
462
+ return `**Owner:** ${sanitizeSingleLineField(owner.role.name)} in ${sanitizeSingleLineField(owner.team.name)}`;
463
+ case "default":
464
+ return `**Owner:** ${sanitizeSingleLineField(owner.team.name)} Team Lead (by default, no ownership row)`;
465
+ case "unavailable":
466
+ return "**Owner:** none \u2014 no Team Lead available";
467
+ case "many":
468
+ return `**Owner:** present but unresolvable: ${owner.count}${owner.truncated ? "+" : ""} ownership rows`;
469
+ case "dangling":
470
+ return `**Owner:** unresolved (team ${owner.teamId}, role ${owner.roleId})`;
471
+ }
472
+ }
430
473
  function extractPreview(data, maxLen) {
431
474
  if (!data || typeof data !== "object") return "";
432
475
  const d = data;
@@ -630,10 +673,10 @@ async function dispatchDiscriminated(toolName, union2, flatData, actionSpecs, ha
630
673
  }
631
674
 
632
675
  // src/tools/knowledge.ts
633
- import { z as z7 } from "zod/v3";
676
+ import { z as z8 } from "zod/v3";
634
677
 
635
678
  // src/tools/smart-capture.ts
636
- import { z as z5 } from "zod/v3";
679
+ import { z as z6 } from "zod/v3";
637
680
 
638
681
  // src/lib/captureTimeoutOutcome.ts
639
682
  function isGatewayTimeout(error) {
@@ -1014,18 +1057,18 @@ function tokenizeText(input) {
1014
1057
  }
1015
1058
 
1016
1059
  // src/lib/batchCaptureOutput.ts
1017
- import { z as z3 } from "zod/v3";
1060
+ import { z as z4 } from "zod/v3";
1018
1061
 
1019
1062
  // src/lib/batchTimeoutCohort.ts
1020
- import { z as z2 } from "zod/v3";
1021
- var unknownOutcomeEntrySchema = z2.object({
1022
- index: z2.number(),
1023
- collection: z2.string(),
1024
- name: z2.string(),
1025
- error: z2.string(),
1026
- mayHaveLanded: z2.boolean(),
1027
- budgetMs: z2.number(),
1028
- elapsedMs: z2.number()
1063
+ import { z as z3 } from "zod/v3";
1064
+ var unknownOutcomeEntrySchema = z3.object({
1065
+ index: z3.number(),
1066
+ collection: z3.string(),
1067
+ name: z3.string(),
1068
+ error: z3.string(),
1069
+ mayHaveLanded: z3.boolean(),
1070
+ budgetMs: z3.number(),
1071
+ elapsedMs: z3.number()
1029
1072
  });
1030
1073
  function deriveTimeoutOutcome(error) {
1031
1074
  return isGatewayTimeout(error) ? { mayHaveLanded: error.mayHaveLanded, budgetMs: error.budgetMs, elapsedMs: error.elapsedMs } : void 0;
@@ -1063,112 +1106,112 @@ function renderOutcomeUnknownSection(entries) {
1063
1106
  }
1064
1107
 
1065
1108
  // src/lib/batchCaptureOutput.ts
1066
- var batchCaptureRealOutputSchema = z3.object({
1067
- captured: z3.array(z3.object({
1068
- entryId: z3.string(),
1069
- collection: z3.string(),
1070
- name: z3.string(),
1109
+ var batchCaptureRealOutputSchema = z4.object({
1110
+ captured: z4.array(z4.object({
1111
+ entryId: z4.string(),
1112
+ collection: z4.string(),
1113
+ name: z4.string(),
1071
1114
  // "draft_on_failure" is the status emitted when an auto-commit is REFUSED/failed (the entry
1072
1115
  // stays a draft) — the same path that now also emits coherencyRefusal. The strict schema must
1073
1116
  // accept it or a refused response fails to validate on `status` (codex review, completing the
1074
1117
  // coherencyRefusal contract fix).
1075
- status: z3.enum(["draft", "committed", "proposed", "draft_on_failure", "draft_spine_floor"]),
1076
- spineFloor: z3.object({ relationType: z3.string(), parentKind: z3.string(), exempt: z3.boolean() }).optional(),
1077
- classifiedBy: z3.enum(["llm", "heuristic", "explicit"]).optional(),
1078
- confidence: z3.number().optional(),
1079
- confidenceTier: z3.enum(["high", "medium", "low"]).optional(),
1080
- warnings: z3.array(z3.string()).optional(),
1081
- normalization: z3.object({
1082
- remapped: z3.record(z3.string()).optional(),
1083
- rejected: z3.array(z3.string()).optional()
1118
+ status: z4.enum(["draft", "committed", "proposed", "draft_on_failure", "draft_spine_floor"]),
1119
+ spineFloor: z4.object({ relationType: z4.string(), parentKind: z4.string(), exempt: z4.boolean() }).optional(),
1120
+ classifiedBy: z4.enum(["llm", "heuristic", "explicit"]).optional(),
1121
+ confidence: z4.number().optional(),
1122
+ confidenceTier: z4.enum(["high", "medium", "low"]).optional(),
1123
+ warnings: z4.array(z4.string()).optional(),
1124
+ normalization: z4.object({
1125
+ remapped: z4.record(z4.string()).optional(),
1126
+ rejected: z4.array(z4.string()).optional()
1084
1127
  }).optional(),
1085
1128
  // TEN-2365: capture-time authority-domain proposal slug (PENDING ratification), when filed.
1086
- domain: z3.string().optional(),
1129
+ domain: z4.string().optional(),
1087
1130
  // WP-465 surface parity: structured coherency refusal for a gate-refused auto-commit (batch
1088
1131
  // shape). Loose record — same single-source rationale as captureSuccessOutputSchema.
1089
- coherencyRefusal: z3.record(z3.unknown()).optional(),
1132
+ coherencyRefusal: z4.record(z4.unknown()).optional(),
1090
1133
  // WP-485 Slice 2b round 4 (Codex P2, FEAT-1370): per-entry contradiction advisory, emitted
1091
1134
  // into structuredContent but previously undeclared here. Not `.strict()` so this one was
1092
1135
  // silently stripped rather than rejected — declared anyway so batch consumers actually see it.
1093
- contradictionAdvisory: z3.record(z3.unknown()).optional()
1136
+ contradictionAdvisory: z4.record(z4.unknown()).optional()
1094
1137
  })),
1095
- total: z3.number(),
1096
- failed: z3.number(),
1097
- committed: z3.number(),
1098
- proposed: z3.number(),
1099
- drafts: z3.number(),
1100
- spineFloored: z3.number().optional(),
1101
- classified: z3.number().optional(),
1102
- autoCommitApplied: z3.boolean(),
1103
- skippedLowConfidence: z3.array(z3.object({
1104
- index: z3.number(),
1105
- name: z3.string(),
1106
- suggestedCollection: z3.string().optional(),
1107
- confidence: z3.number().optional(),
1108
- alternatives: z3.array(z3.object({
1109
- collection: z3.string(),
1110
- confidence: z3.number()
1138
+ total: z4.number(),
1139
+ failed: z4.number(),
1140
+ committed: z4.number(),
1141
+ proposed: z4.number(),
1142
+ drafts: z4.number(),
1143
+ spineFloored: z4.number().optional(),
1144
+ classified: z4.number().optional(),
1145
+ autoCommitApplied: z4.boolean(),
1146
+ skippedLowConfidence: z4.array(z4.object({
1147
+ index: z4.number(),
1148
+ name: z4.string(),
1149
+ suggestedCollection: z4.string().optional(),
1150
+ confidence: z4.number().optional(),
1151
+ alternatives: z4.array(z4.object({
1152
+ collection: z4.string(),
1153
+ confidence: z4.number()
1111
1154
  })).optional()
1112
1155
  })).optional(),
1113
- failedEntries: z3.array(z3.object({
1114
- index: z3.number(),
1115
- collection: z3.string(),
1116
- name: z3.string(),
1117
- error: z3.string()
1156
+ failedEntries: z4.array(z4.object({
1157
+ index: z4.number(),
1158
+ collection: z4.string(),
1159
+ name: z4.string(),
1160
+ error: z4.string()
1118
1161
  })).optional(),
1119
1162
  // WP-575 review round (P1, TEN-1126): a DISTINCT cohort from `failedEntries` — additive,
1120
1163
  // never removes or retypes an existing field (repo's schema rule). See
1121
1164
  // lib/batchTimeoutCohort.ts's doc comment for why this must stay separate.
1122
- unknownOutcomeEntries: z3.array(unknownOutcomeEntrySchema).optional()
1165
+ unknownOutcomeEntries: z4.array(unknownOutcomeEntrySchema).optional()
1123
1166
  });
1124
- var batchCapturePreviewOutputSchema = z3.object({
1125
- outcome: z3.literal("preview"),
1126
- wouldCapture: z3.array(z3.object({
1167
+ var batchCapturePreviewOutputSchema = z4.object({
1168
+ outcome: z4.literal("preview"),
1169
+ wouldCapture: z4.array(z4.object({
1127
1170
  // Fix 1 (WP-577 review re-review, TEN-2918 follow-up): optional, not required — see
1128
1171
  // WouldCaptureEntry's doc comment. Absent exactly when `entryIdAssignedAtCapture` is true.
1129
- entryId: z3.string().optional(),
1130
- entryIdAssignedAtCapture: z3.literal(true).optional(),
1131
- preflight: z3.custom().optional(),
1132
- collection: z3.string(),
1133
- name: z3.string(),
1134
- classifiedBy: z3.string().optional(),
1135
- confidence: z3.number().optional(),
1136
- warnings: z3.array(z3.string()).optional()
1172
+ entryId: z4.string().optional(),
1173
+ entryIdAssignedAtCapture: z4.literal(true).optional(),
1174
+ preflight: z4.custom().optional(),
1175
+ collection: z4.string(),
1176
+ name: z4.string(),
1177
+ classifiedBy: z4.string().optional(),
1178
+ confidence: z4.number().optional(),
1179
+ warnings: z4.array(z4.string()).optional()
1137
1180
  })),
1138
1181
  // WP-577 review follow-up (P2, TEN-2918): entries the server's WHY/glossary gate says would
1139
1182
  // be BLOCKED on a real (non-preview) create — a distinct cohort from `wouldCapture` so the
1140
1183
  // structured response never claims a governance-refused capture would succeed. Optional/
1141
1184
  // additive: absent (or empty) on every response this route produced before this fix.
1142
- wouldBlock: z3.array(z3.object({
1143
- entryId: z3.string().optional(),
1144
- entryIdAssignedAtCapture: z3.literal(true).optional(),
1145
- preflight: z3.custom().optional(),
1146
- collection: z3.string(),
1147
- name: z3.string(),
1148
- blockingReason: z3.string().optional(),
1149
- warnings: z3.array(z3.string()).optional()
1185
+ wouldBlock: z4.array(z4.object({
1186
+ entryId: z4.string().optional(),
1187
+ entryIdAssignedAtCapture: z4.literal(true).optional(),
1188
+ preflight: z4.custom().optional(),
1189
+ collection: z4.string(),
1190
+ name: z4.string(),
1191
+ blockingReason: z4.string().optional(),
1192
+ warnings: z4.array(z4.string()).optional()
1150
1193
  })).optional(),
1151
- requested: z3.number(),
1152
- total: z3.number(),
1153
- failed: z3.number(),
1154
- skippedLowConfidence: z3.array(z3.object({
1155
- index: z3.number(),
1156
- name: z3.string(),
1157
- suggestedCollection: z3.string().optional(),
1158
- confidence: z3.number().optional()
1194
+ requested: z4.number(),
1195
+ total: z4.number(),
1196
+ failed: z4.number(),
1197
+ skippedLowConfidence: z4.array(z4.object({
1198
+ index: z4.number(),
1199
+ name: z4.string(),
1200
+ suggestedCollection: z4.string().optional(),
1201
+ confidence: z4.number().optional()
1159
1202
  })).optional(),
1160
- failedEntries: z3.array(z3.object({
1161
- index: z3.number(),
1162
- collection: z3.string(),
1163
- name: z3.string(),
1164
- error: z3.string()
1203
+ failedEntries: z4.array(z4.object({
1204
+ index: z4.number(),
1205
+ collection: z4.string(),
1206
+ name: z4.string(),
1207
+ error: z4.string()
1165
1208
  })).optional(),
1166
1209
  // WP-575 review round (P1, TEN-1126): sibling of the same field on
1167
1210
  // batchCaptureRealOutputSchema — preview batches reach the SAME unconditional
1168
1211
  // `chain.createEntry` catch a real batch does, so the discriminator exists here too.
1169
- unknownOutcomeEntries: z3.array(unknownOutcomeEntrySchema).optional()
1212
+ unknownOutcomeEntries: z4.array(unknownOutcomeEntrySchema).optional()
1170
1213
  });
1171
- var batchCaptureOutputSchema = z3.union([
1214
+ var batchCaptureOutputSchema = z4.union([
1172
1215
  batchCaptureRealOutputSchema,
1173
1216
  batchCapturePreviewOutputSchema
1174
1217
  ]);
@@ -1534,45 +1577,45 @@ function formatRubricVerdictSection(verdict) {
1534
1577
  }
1535
1578
 
1536
1579
  // src/lib/captureSinglePreviewOutput.ts
1537
- import { z as z4 } from "zod/v3";
1538
- var groundingRelatedEntrySchema = z4.object({
1539
- entryId: z4.string(),
1540
- name: z4.string(),
1541
- collectionSlug: z4.string(),
1542
- overlapRatio: z4.number(),
1543
- recommendedRelationType: z4.string(),
1544
- reasoning: z4.string()
1580
+ import { z as z5 } from "zod/v3";
1581
+ var groundingRelatedEntrySchema = z5.object({
1582
+ entryId: z5.string(),
1583
+ name: z5.string(),
1584
+ collectionSlug: z5.string(),
1585
+ overlapRatio: z5.number(),
1586
+ recommendedRelationType: z5.string(),
1587
+ reasoning: z5.string()
1545
1588
  });
1546
- var groundingDuplicateEntrySchema = z4.object({
1547
- entryId: z4.string(),
1548
- name: z4.string(),
1549
- collectionSlug: z4.string(),
1550
- matchType: z4.enum(["related", "possible_duplicate"]),
1551
- overlapRatio: z4.number()
1589
+ var groundingDuplicateEntrySchema = z5.object({
1590
+ entryId: z5.string(),
1591
+ name: z5.string(),
1592
+ collectionSlug: z5.string(),
1593
+ matchType: z5.enum(["related", "possible_duplicate"]),
1594
+ overlapRatio: z5.number()
1552
1595
  });
1553
- var groundingGovernanceEntrySchema = z4.object({
1554
- entryId: z4.string(),
1555
- name: z4.string(),
1556
- collectionSlug: z4.string()
1596
+ var groundingGovernanceEntrySchema = z5.object({
1597
+ entryId: z5.string(),
1598
+ name: z5.string(),
1599
+ collectionSlug: z5.string()
1557
1600
  });
1558
- var groundingReportSchema = z4.object({
1601
+ var groundingReportSchema = z5.object({
1559
1602
  // TASK-156: null preserves uncertainty for unavailable checks or an older server response.
1560
- scanTruncated: z4.boolean().nullable(),
1561
- related: z4.array(groundingRelatedEntrySchema),
1562
- duplicates: z4.array(groundingDuplicateEntrySchema),
1563
- governance: z4.array(groundingGovernanceEntrySchema)
1603
+ scanTruncated: z5.boolean().nullable(),
1604
+ related: z5.array(groundingRelatedEntrySchema),
1605
+ duplicates: z5.array(groundingDuplicateEntrySchema),
1606
+ governance: z5.array(groundingGovernanceEntrySchema)
1564
1607
  });
1565
- var taskAlignmentSchema = z4.record(z4.unknown());
1566
- var captureSinglePreviewOutputSchema = z4.object({
1567
- preflight: z4.custom().optional(),
1568
- entryId: z4.string(),
1569
- name: z4.string(),
1570
- collection: z4.string(),
1571
- outcome: z4.enum(["preview", "blocked"]),
1608
+ var taskAlignmentSchema = z5.record(z5.unknown());
1609
+ var captureSinglePreviewOutputSchema = z5.object({
1610
+ preflight: z5.custom().optional(),
1611
+ entryId: z5.string(),
1612
+ name: z5.string(),
1613
+ collection: z5.string(),
1614
+ outcome: z5.enum(["preview", "blocked"]),
1572
1615
  // Present only when `outcome: "blocked"` AND the server supplied a reason.
1573
- blockingReason: z4.string().optional(),
1616
+ blockingReason: z5.string().optional(),
1574
1617
  // Always present — `result.warnings ?? []`, never omitted.
1575
- warnings: z4.array(z4.string()),
1618
+ warnings: z5.array(z5.string()),
1576
1619
  groundingReport: groundingReportSchema,
1577
1620
  // TEN-2458: only present when the kernel computed a librarian verdict for this preview.
1578
1621
  taskAlignment: taskAlignmentSchema.optional()
@@ -1769,81 +1812,81 @@ var MAX_SUGGESTIONS = 5;
1769
1812
  var SPINE_FLOOR_SENTENCE = "kept as a draft; it can be accepted once its spine above is accepted \u2014 the promote door checks the whole spine and names the first missing rung.";
1770
1813
  var SPINE_FLOOR_EXEMPT_SENTENCE = "kept as a draft, though this workspace is not yet enforcing the spine above it \u2014 it can be accepted as-is.";
1771
1814
  var BR_STD_ENTRY_ID_REGEX = /^(BR|STD)-\d+$/;
1772
- var entryIdSchema = z5.string().regex(BR_STD_ENTRY_ID_REGEX).optional().describe("Only for business-rules and standards. Must match BR-NNN or STD-NNN. Omit for all other collections \u2014 IDs are auto-generated.");
1773
- var captureSchema = z5.object({
1774
- collection: z5.string().optional().describe("Collection slug, e.g. 'tensions', 'business-rules', 'glossary', 'decisions'. Optional \u2014 classifier auto-routes when omitted."),
1775
- name: z5.string().describe("Display name \u2014 be specific (e.g. 'Convex adjacency list won't scale for graph traversal')"),
1776
- description: z5.string().describe("Full context \u2014 what's happening, why it matters, what you observed"),
1777
- context: z5.string().optional().describe("Optional additional context (e.g. 'Observed during context gather calls taking 700ms+')"),
1815
+ var entryIdSchema = z6.string().regex(BR_STD_ENTRY_ID_REGEX).optional().describe("Only for business-rules and standards. Must match BR-NNN or STD-NNN. Omit for all other collections \u2014 IDs are auto-generated.");
1816
+ var captureSchema = z6.object({
1817
+ collection: z6.string().optional().describe("Collection slug, e.g. 'tensions', 'business-rules', 'glossary', 'decisions'. Optional \u2014 classifier auto-routes when omitted."),
1818
+ name: z6.string().describe("Display name \u2014 be specific (e.g. 'Convex adjacency list won't scale for graph traversal')"),
1819
+ description: z6.string().describe("Full context \u2014 what's happening, why it matters, what you observed"),
1820
+ context: z6.string().optional().describe("Optional additional context (e.g. 'Observed during context gather calls taking 700ms+')"),
1778
1821
  entryId: entryIdSchema,
1779
- canonicalKey: z5.string().optional().describe("Semantic type (e.g. 'decision', 'tension', 'vision'). Auto-assigned from collection if omitted."),
1780
- data: z5.record(z5.unknown()).optional().describe("Explicit field values when you know the schema (e.g. canonical_key, cardinality_rule, required_fields). Merged with inferred values; user-provided wins."),
1781
- links: z5.array(z5.object({
1782
- to: z5.string().describe("Target entry ID (e.g. '<PREFIX>-<n>')"),
1783
- type: z5.string().describe("Relation type (e.g. 'governs', 'related_to', 'informs')")
1822
+ canonicalKey: z6.string().optional().describe("Semantic type (e.g. 'decision', 'tension', 'vision'). Auto-assigned from collection if omitted."),
1823
+ data: z6.record(z6.unknown()).optional().describe("Explicit field values when you know the schema (e.g. canonical_key, cardinality_rule, required_fields). Merged with inferred values; user-provided wins."),
1824
+ links: z6.array(z6.object({
1825
+ to: z6.string().describe("Target entry ID (e.g. '<PREFIX>-<n>')"),
1826
+ type: z6.string().describe("Relation type (e.g. 'governs', 'related_to', 'informs')")
1784
1827
  })).optional().describe("Relations to create after capture. Skips auto-link discovery when provided."),
1785
- autoCommit: z5.boolean().optional().describe("If true, commits the entry immediately after capture + linking. If omitted, Open mode workspaces auto-commit by default and consensus/role modes stay draft-first."),
1786
- sourceRef: z5.string().optional().describe("URI or path of the source document backing this entry (e.g. 'meeting-2026-03-28.md', 'import://batch-5'). Stored as top-level entry field, not in data."),
1787
- sourceExcerpt: z5.string().optional().describe("Verbatim excerpt from the source that backs this entry's claims. Stored as top-level entry field, not in data."),
1828
+ autoCommit: z6.boolean().optional().describe("If true, commits the entry immediately after capture + linking. If omitted, Open mode workspaces auto-commit by default and consensus/role modes stay draft-first."),
1829
+ sourceRef: z6.string().optional().describe("URI or path of the source document backing this entry (e.g. 'meeting-2026-03-28.md', 'import://batch-5'). Stored as top-level entry field, not in data."),
1830
+ sourceExcerpt: z6.string().optional().describe("Verbatim excerpt from the source that backs this entry's claims. Stored as top-level entry field, not in data."),
1788
1831
  // WP-316 S3: Preview gate — dry-run mode. Returns what would happen, no DB writes.
1789
- preview: z5.boolean().optional().describe("If true, validates the capture without writing. Returns what would happen. Default false."),
1832
+ preview: z6.boolean().optional().describe("If true, validates the capture without writing. Returns what would happen. Default false."),
1790
1833
  // WP-318 S2: Pre-write grounding — run link suggestion before creating entry.
1791
- suggestOnly: z5.boolean().optional().describe("If true, runs pre-write grounding (suggestLinksForCapture) and returns a groundingReport WITHOUT creating any entry. Use to preview graph participation before accepting. Default false."),
1834
+ suggestOnly: z6.boolean().optional().describe("If true, runs pre-write grounding (suggestLinksForCapture) and returns a groundingReport WITHOUT creating any entry. Use to preview graph participation before accepting. Default false."),
1792
1835
  // WP-318 S2: Format for groundingReport in response.
1793
- format: z5.enum(["agent", "human"]).optional().describe("Response format for grounding data. 'agent' (default): full JSON groundingReport. 'human': compressed summary string appended to the capture summary."),
1836
+ format: z6.enum(["agent", "human"]).optional().describe("Response format for grounding data. 'agent' (default): full JSON groundingReport. 'human': compressed summary string appended to the capture summary."),
1794
1837
  // WP-513: team+role to create AS OWNER of (rung 2 only); no-op pre-rung-2.
1795
- ownerTeamEntryId: z5.string().max(200).optional().describe("Owning team entry ID/ref (rung 2)."),
1796
- ownerRoleEntryId: z5.string().max(200).optional().describe("Owning role entry ID/ref (rung 2).")
1838
+ ownerTeamEntryId: z6.string().max(200).optional().describe("Owning team entry ID/ref (rung 2)."),
1839
+ ownerRoleEntryId: z6.string().max(200).optional().describe("Owning role entry ID/ref (rung 2).")
1797
1840
  });
1798
- var batchCaptureRelationSchema = z5.object({
1799
- to: z5.string().max(200).describe("Target entry ID already on the Chain, e.g. '<PREFIX>-<n>'."),
1800
- type: z5.string().max(200).describe("Relation type, e.g. 'related_to', 'informed_by', 'governs'.")
1841
+ var batchCaptureRelationSchema = z6.object({
1842
+ to: z6.string().max(200).describe("Target entry ID already on the Chain, e.g. '<PREFIX>-<n>'."),
1843
+ type: z6.string().max(200).describe("Relation type, e.g. 'related_to', 'informed_by', 'governs'.")
1801
1844
  });
1802
- var batchCaptureSchema = z5.object({
1803
- entries: z5.array(z5.object({
1845
+ var batchCaptureSchema = z6.object({
1846
+ entries: z6.array(z6.object({
1804
1847
  // FEAT-160
1805
- collection: z5.string().max(200).optional().describe("Collection slug. Optional \u2014 auto-classified via LLM when omitted."),
1806
- name: z5.string().max(500).describe("Display name"),
1807
- description: z5.string().max(2e4).describe("Full context / definition"),
1848
+ collection: z6.string().max(200).optional().describe("Collection slug. Optional \u2014 auto-classified via LLM when omitted."),
1849
+ name: z6.string().max(500).describe("Display name"),
1850
+ description: z6.string().max(2e4).describe("Full context / definition"),
1808
1851
  entryId: entryIdSchema,
1809
- data: z5.record(z5.unknown()).optional().describe("Explicit field values (e.g. urgency, status, assignee). Merged with inferred values; user-provided wins."),
1810
- canonicalKey: z5.string().max(200).optional().describe("Semantic type (e.g. 'decision', 'tension', 'work_package'). Enables work-package redirect in createEntry when collection is 'chains'."),
1811
- sourceRef: z5.string().max(2e3).optional().describe("URI or path of the source document backing this entry (e.g. 'meeting-2026-03-28.md', 'import://batch-5'). Stored as top-level entry field, not in data."),
1812
- sourceExcerpt: z5.string().max(5e3).optional().describe("Verbatim excerpt from the source that backs this entry's claims. Stored as top-level entry field, not in data."),
1852
+ data: z6.record(z6.unknown()).optional().describe("Explicit field values (e.g. urgency, status, assignee). Merged with inferred values; user-provided wins."),
1853
+ canonicalKey: z6.string().max(200).optional().describe("Semantic type (e.g. 'decision', 'tension', 'work_package'). Enables work-package redirect in createEntry when collection is 'chains'."),
1854
+ sourceRef: z6.string().max(2e3).optional().describe("URI or path of the source document backing this entry (e.g. 'meeting-2026-03-28.md', 'import://batch-5'). Stored as top-level entry field, not in data."),
1855
+ sourceExcerpt: z6.string().max(5e3).optional().describe("Verbatim excerpt from the source that backs this entry's claims. Stored as top-level entry field, not in data."),
1813
1856
  // TEN-957 (WP-484 S2): relations to create right after this entry is captured.
1814
- relations: z5.array(batchCaptureRelationSchema).max(10).optional().describe("Relations to create right after this entry is captured \u2014 each {to, type} links the NEW entry to an existing Chain entry."),
1857
+ relations: z6.array(batchCaptureRelationSchema).max(10).optional().describe("Relations to create right after this entry is captured \u2014 each {to, type} links the NEW entry to an existing Chain entry."),
1815
1858
  // WP-513: team+role to create THIS entry AS OWNER of (rung 2 only).
1816
- ownerTeamEntryId: z5.string().max(200).optional().describe("Owning team entry ID/ref (rung 2)."),
1817
- ownerRoleEntryId: z5.string().max(200).optional().describe("Owning role entry ID/ref (rung 2).")
1859
+ ownerTeamEntryId: z6.string().max(200).optional().describe("Owning team entry ID/ref (rung 2)."),
1860
+ ownerRoleEntryId: z6.string().max(200).optional().describe("Owning role entry ID/ref (rung 2).")
1818
1861
  })).min(1).max(50).describe("Array of entries to capture"),
1819
- autoCommit: z5.boolean().optional().describe(
1862
+ autoCommit: z6.boolean().optional().describe(
1820
1863
  "If true, commits created entries immediately after linking. If omitted, Open mode workspaces commit by default and consensus/role modes stay draft-first."
1821
1864
  ),
1822
1865
  // WP-316 S3: Preview gate — dry-run mode. Returns what would happen, no DB writes.
1823
- preview: z5.boolean().optional().describe("If true, validates all captures without writing. Returns what would happen. Default false.")
1866
+ preview: z6.boolean().optional().describe("If true, validates all captures without writing. Returns what would happen. Default false.")
1824
1867
  });
1825
- var captureClassifierSchema = z5.object({
1826
- enabled: z5.boolean(),
1827
- autoRouted: z5.boolean(),
1828
- agrees: z5.boolean(),
1829
- abstained: z5.boolean(),
1830
- topConfidence: z5.number(),
1831
- confidence: z5.number(),
1832
- reasons: z5.array(z5.string()),
1833
- candidates: z5.array(
1834
- z5.object({
1835
- collection: z5.string(),
1836
- signalScore: z5.number().optional(),
1837
- confidence: z5.number(),
1868
+ var captureClassifierSchema = z6.object({
1869
+ enabled: z6.boolean(),
1870
+ autoRouted: z6.boolean(),
1871
+ agrees: z6.boolean(),
1872
+ abstained: z6.boolean(),
1873
+ topConfidence: z6.number(),
1874
+ confidence: z6.number(),
1875
+ reasons: z6.array(z6.string()),
1876
+ candidates: z6.array(
1877
+ z6.object({
1878
+ collection: z6.string(),
1879
+ signalScore: z6.number().optional(),
1880
+ confidence: z6.number(),
1838
1881
  /** WP-316 S2: required-field cost — how many fields the agent must supply for this collection. */
1839
- requiredFieldCount: z5.number().optional()
1882
+ requiredFieldCount: z6.number().optional()
1840
1883
  })
1841
1884
  ),
1842
- agentProvidedCollection: z5.string().optional(),
1843
- overrideCommand: z5.string().optional(),
1844
- classifiedBy: z5.enum(["llm", "heuristic", "explicit"]).optional(),
1845
- confidenceTier: z5.enum(["high", "medium", "low"]).optional(),
1846
- reasoning: z5.string().optional()
1885
+ agentProvidedCollection: z6.string().optional(),
1886
+ overrideCommand: z6.string().optional(),
1887
+ classifiedBy: z6.enum(["llm", "heuristic", "explicit"]).optional(),
1888
+ confidenceTier: z6.enum(["high", "medium", "low"]).optional(),
1889
+ reasoning: z6.string().optional()
1847
1890
  });
1848
1891
  function trackClassifierTelemetry(params) {
1849
1892
  const telemetry = {
@@ -2071,52 +2114,52 @@ async function resolveCaptureCollection(params) {
2071
2114
  classifierMeta
2072
2115
  };
2073
2116
  }
2074
- var captureSuccessOutputSchema = z5.object({
2075
- entryId: z5.string(),
2076
- collection: z5.string(),
2077
- name: z5.string(),
2117
+ var captureSuccessOutputSchema = z6.object({
2118
+ entryId: z6.string(),
2119
+ collection: z6.string(),
2120
+ name: z6.string(),
2078
2121
  // Single captures report the persisted draft; batch captures distinguish the draft reason.
2079
- status: z5.enum(["draft", "committed", "proposed", "draft_on_failure", "draft_spine_floor"]),
2122
+ status: z6.enum(["draft", "committed", "proposed", "draft_on_failure", "draft_spine_floor"]),
2080
2123
  // WP-480 S1: `qualityScore` (required, client N/10) deleted — a named, accepted
2081
2124
  // breaking output-contract change. The server verdict stays as `qualityVerdict`.
2082
- qualityVerdict: z5.record(z5.unknown()).optional(),
2083
- qualityHints: z5.array(z5.record(z5.unknown())).optional(),
2084
- relationSuggestions: z5.array(z5.record(z5.unknown())).optional(),
2125
+ qualityVerdict: z6.record(z6.unknown()).optional(),
2126
+ qualityHints: z6.array(z6.record(z6.unknown())).optional(),
2127
+ relationSuggestions: z6.array(z6.record(z6.unknown())).optional(),
2085
2128
  groundingReport: captureSinglePreviewOutputSchema.shape.groundingReport.optional(),
2086
2129
  classifier: captureClassifierSchema.optional(),
2087
- studioUrl: z5.string().optional(),
2088
- warnings: z5.array(z5.string()).optional(),
2089
- normalization: z5.object({
2090
- remapped: z5.record(z5.string()).optional(),
2091
- rejected: z5.array(z5.string()).optional()
2130
+ studioUrl: z6.string().optional(),
2131
+ warnings: z6.array(z6.string()).optional(),
2132
+ normalization: z6.object({
2133
+ remapped: z6.record(z6.string()).optional(),
2134
+ rejected: z6.array(z6.string()).optional()
2092
2135
  }).optional(),
2093
- expectedFields: z5.array(z5.object({
2094
- key: z5.string(),
2095
- type: z5.string(),
2096
- required: z5.boolean().optional()
2136
+ expectedFields: z6.array(z6.object({
2137
+ key: z6.string(),
2138
+ type: z6.string(),
2139
+ required: z6.boolean().optional()
2097
2140
  })).optional(),
2098
2141
  // TEN-2365: capture-time authority-domain proposal (PENDING ratification), when one was filed.
2099
- authorityDomain: z5.object({
2100
- slug: z5.string(),
2101
- status: z5.literal("proposal-pending")
2142
+ authorityDomain: z6.object({
2143
+ slug: z6.string(),
2144
+ status: z6.literal("proposal-pending")
2102
2145
  }).optional(),
2103
2146
  // TASK-160: the server's birth-floor verdict must survive the strict output contract.
2104
- spineFloor: z5.object({ relationType: z5.string(), parentKind: z5.string(), exempt: z5.boolean() }).optional(),
2147
+ spineFloor: z6.object({ relationType: z6.string(), parentKind: z6.string(), exempt: z6.boolean() }).optional(),
2105
2148
  // WP-465 surface parity: structured coherency refusal when an auto-commit is gate-refused.
2106
2149
  // Loose record — the CoherencyRefusal contract is authored in
2107
2150
  // convex/lib/gates/coherencyControls.ts; re-declaring it here would be a second SSOT.
2108
- coherencyRefusal: z5.record(z5.unknown()).optional(),
2151
+ coherencyRefusal: z6.record(z6.unknown()).optional(),
2109
2152
  // WP-485 Slice 2b round 4 (Codex P2, FEAT-1370): the server's contradiction advisory is emitted
2110
2153
  // into structuredContent but was missing here — since this schema is `.strict()`, a real capture
2111
2154
  // response carrying it failed validation with `unrecognized_keys`. Loose record, same rationale as coherencyRefusal above.
2112
- contradictionAdvisory: z5.record(z5.unknown()).optional(),
2113
- fallbackApplied: z5.boolean().optional()
2155
+ contradictionAdvisory: z6.record(z6.unknown()).optional(),
2156
+ fallbackApplied: z6.boolean().optional()
2114
2157
  // round 2 (PRRT_kwDORS4ils6cTNbF): classifier field above still names the original (pre-substitution) prediction
2115
2158
  }).strict();
2116
- var captureClassifierOnlyOutputSchema = z5.object({
2159
+ var captureClassifierOnlyOutputSchema = z6.object({
2117
2160
  classifier: captureClassifierSchema
2118
2161
  }).strict();
2119
- var captureOutputSchema = z5.union([
2162
+ var captureOutputSchema = z6.union([
2120
2163
  captureSuccessOutputSchema,
2121
2164
  captureSinglePreviewOutputSchema,
2122
2165
  captureClassifierOnlyOutputSchema
@@ -2138,40 +2181,40 @@ function buildDataFromFields(fields, descriptionField, descriptionValue) {
2138
2181
  }
2139
2182
  var CAPTURE_ACTIONS = ["capture", "batch"];
2140
2183
  var captureItemSchema = batchCaptureSchema.shape.entries.element;
2141
- var captureCompoundSchema = z5.object({
2142
- action: z5.enum(CAPTURE_ACTIONS).optional().default("capture").describe("'capture': create a single knowledge entry (the original capture behavior). 'batch': create multiple entries in one call via `items[]` (absorbs batch-capture; each item may carry inline `relations`)."),
2184
+ var captureCompoundSchema = z6.object({
2185
+ action: z6.enum(CAPTURE_ACTIONS).optional().default("capture").describe("'capture': create a single knowledge entry (the original capture behavior). 'batch': create multiple entries in one call via `items[]` (absorbs batch-capture; each item may carry inline `relations`)."),
2143
2186
  // For 'capture' — mirrors captureSchema, relaxed to optional (batch omits these).
2144
- collection: z5.string().max(200).optional().describe("For 'capture': collection slug, e.g. 'tensions', 'business-rules', 'glossary', 'decisions'. Optional \u2014 classifier auto-routes when omitted."),
2145
- name: z5.string().max(500).optional().describe("For 'capture': display name \u2014 required for this action."),
2146
- description: z5.string().max(2e4).optional().describe("For 'capture': full context \u2014 required for this action."),
2147
- context: z5.string().max(5e3).optional().describe("For 'capture': optional additional context."),
2187
+ collection: z6.string().max(200).optional().describe("For 'capture': collection slug, e.g. 'tensions', 'business-rules', 'glossary', 'decisions'. Optional \u2014 classifier auto-routes when omitted."),
2188
+ name: z6.string().max(500).optional().describe("For 'capture': display name \u2014 required for this action."),
2189
+ description: z6.string().max(2e4).optional().describe("For 'capture': full context \u2014 required for this action."),
2190
+ context: z6.string().max(5e3).optional().describe("For 'capture': optional additional context."),
2148
2191
  entryId: entryIdSchema,
2149
- canonicalKey: z5.string().max(200).optional().describe("For 'capture': semantic type (e.g. 'decision', 'tension', 'vision'). Auto-assigned from collection if omitted."),
2150
- data: z5.record(z5.unknown()).optional().describe("For 'capture': explicit field values. Merged with inferred values; user-provided wins."),
2151
- links: z5.array(z5.object({
2152
- to: z5.string().max(200).describe("Target entry ID (e.g. '<PREFIX>-<n>')"),
2153
- type: z5.string().max(200).describe("Relation type (e.g. 'governs', 'related_to', 'informs')")
2192
+ canonicalKey: z6.string().max(200).optional().describe("For 'capture': semantic type (e.g. 'decision', 'tension', 'vision'). Auto-assigned from collection if omitted."),
2193
+ data: z6.record(z6.unknown()).optional().describe("For 'capture': explicit field values. Merged with inferred values; user-provided wins."),
2194
+ links: z6.array(z6.object({
2195
+ to: z6.string().max(200).describe("Target entry ID (e.g. '<PREFIX>-<n>')"),
2196
+ type: z6.string().max(200).describe("Relation type (e.g. 'governs', 'related_to', 'informs')")
2154
2197
  })).max(20).optional().describe("For 'capture': relations to create after capture. Skips auto-link discovery when provided."),
2155
- autoCommit: z5.boolean().optional().describe("For 'capture'/'batch': if true, commits immediately after capture + linking."),
2156
- sourceRef: z5.string().max(2e3).optional().describe("For 'capture': URI or path of the source document backing this entry."),
2157
- sourceExcerpt: z5.string().max(5e3).optional().describe("For 'capture': verbatim excerpt from the source backing this entry's claims."),
2158
- preview: z5.boolean().optional().describe("For 'capture'/'batch': if true, validates without writing."),
2159
- suggestOnly: z5.boolean().optional().describe("For 'capture': if true, runs pre-write grounding and returns a groundingReport WITHOUT creating any entry."),
2160
- format: z5.enum(["agent", "human"]).optional().describe("For 'capture': response format for grounding data."),
2198
+ autoCommit: z6.boolean().optional().describe("For 'capture'/'batch': if true, commits immediately after capture + linking."),
2199
+ sourceRef: z6.string().max(2e3).optional().describe("For 'capture': URI or path of the source document backing this entry."),
2200
+ sourceExcerpt: z6.string().max(5e3).optional().describe("For 'capture': verbatim excerpt from the source backing this entry's claims."),
2201
+ preview: z6.boolean().optional().describe("For 'capture'/'batch': if true, validates without writing."),
2202
+ suggestOnly: z6.boolean().optional().describe("For 'capture': if true, runs pre-write grounding and returns a groundingReport WITHOUT creating any entry."),
2203
+ format: z6.enum(["agent", "human"]).optional().describe("For 'capture': response format for grounding data."),
2161
2204
  // For 'batch' — mirrors batchCaptureSchema's `entries`, renamed `items` per §3.
2162
- items: z5.array(captureItemSchema).min(1).max(50).optional().describe("For 'batch': array of entries to capture, each may carry inline `relations`."),
2205
+ items: z6.array(captureItemSchema).min(1).max(50).optional().describe("For 'batch': array of entries to capture, each may carry inline `relations`."),
2163
2206
  // WP-513: team+role to create AS OWNER of (rung 2 only).
2164
- ownerTeamEntryId: z5.string().max(200).optional().describe("For 'capture': owning team (rung-2)."),
2165
- ownerRoleEntryId: z5.string().max(200).optional().describe("For 'capture': owning role (rung-2).")
2207
+ ownerTeamEntryId: z6.string().max(200).optional().describe("For 'capture': owning team (rung-2)."),
2208
+ ownerRoleEntryId: z6.string().max(200).optional().describe("For 'capture': owning role (rung-2).")
2166
2209
  });
2167
- var captureSingleVariant = captureSchema.extend({ action: z5.literal("capture") });
2168
- var captureBatchVariant = z5.object({
2169
- action: z5.literal("batch"),
2170
- items: z5.array(captureItemSchema).min(1).max(50),
2171
- autoCommit: z5.boolean().optional(),
2172
- preview: z5.boolean().optional()
2210
+ var captureSingleVariant = captureSchema.extend({ action: z6.literal("capture") });
2211
+ var captureBatchVariant = z6.object({
2212
+ action: z6.literal("batch"),
2213
+ items: z6.array(captureItemSchema).min(1).max(50),
2214
+ autoCommit: z6.boolean().optional(),
2215
+ preview: z6.boolean().optional()
2173
2216
  });
2174
- var captureActionUnion = z5.discriminatedUnion("action", [
2217
+ var captureActionUnion = z6.discriminatedUnion("action", [
2175
2218
  captureSingleVariant,
2176
2219
  captureBatchVariant
2177
2220
  ]);
@@ -3985,9 +4028,9 @@ async function runConflictPreflight(name, description, collectionHint) {
3985
4028
  }
3986
4029
 
3987
4030
  // src/tools/knowledge/getHistory.ts
3988
- import { z as z6 } from "zod/v3";
3989
- var getHistorySchema = z6.object({
3990
- entryId: z6.string().describe("Entry ID, e.g. 'T-SUPPLIER', '<PREFIX>-<n>'")
4031
+ import { z as z7 } from "zod/v3";
4032
+ var getHistorySchema = z7.object({
4033
+ entryId: z7.string().describe("Entry ID, e.g. 'T-SUPPLIER', '<PREFIX>-<n>'")
3991
4034
  });
3992
4035
  async function handleGetHistory({ entryId }) {
3993
4036
  const history = await kernelQuery("chain.listEntryHistory", { entryId });
@@ -4017,38 +4060,38 @@ ${formatted}` }],
4017
4060
  }
4018
4061
 
4019
4062
  // src/tools/knowledge.ts
4020
- var updateEntrySchema = z7.object({
4021
- entryId: z7.string().describe("Entry ID to update, e.g. 'T-SUPPLIER', '<PREFIX>-<n>'"),
4022
- name: z7.string().optional().describe("New display name"),
4063
+ var updateEntrySchema = z8.object({
4064
+ entryId: z8.string().describe("Entry ID to update, e.g. 'T-SUPPLIER', '<PREFIX>-<n>'"),
4065
+ name: z8.string().optional().describe("New display name"),
4023
4066
  // Chain-ID-leak guard (check:chain-id-leaks): the retired legacy-shim ticket number stays in
4024
4067
  // the code comment above, never in this user-visible describe() string.
4025
- status: z7.enum(["draft", "active", "deprecated", "archived"]).optional().describe("Lifecycle status: draft | active | deprecated | archived. Use `workflowStatus` for collection-specific workflow values \u2014 those are no longer accepted via `status`."),
4026
- workflowStatus: z7.string().optional().describe("Collection workflow state. Valid values are collection-specific and server-owned \u2014 discover them via `collections action=describe` for the target collection. The server rejects invalid values and returns the valid set in the error."),
4027
- data: z7.record(z7.unknown()).optional().describe("Fields to update (merged with existing data)"),
4028
- order: z7.number().optional().describe("New sort order"),
4029
- canonicalKey: z7.string().optional().describe("Semantic type (e.g. 'decision', 'tension'). Only changeable on draft/uncommitted entries."),
4030
- autoPublish: z7.boolean().optional().default(false).describe("Only true when user explicitly asks to publish. Default false = draft. Never auto-publish without user confirmation."),
4031
- changeNote: z7.string().optional().describe("Strongly recommended: short human-readable rationale for WHY this change was made (e.g. 'Aligned description with F1-themed copy'). Surfaces in activity feed and pb get. If omitted, falls back to session purpose or auto-generated field summary."),
4032
- sourceRef: z7.string().optional().describe("URI or path of the source document backing this entry. Write-once: can only be set if currently empty."),
4033
- sourceExcerpt: z7.string().optional().describe("Verbatim excerpt from the source that backs this entry's claims. Write-once: can only be set if currently empty."),
4068
+ status: z8.enum(["draft", "active", "deprecated", "archived"]).optional().describe("Lifecycle status: draft | active | deprecated | archived. Use `workflowStatus` for collection-specific workflow values \u2014 those are no longer accepted via `status`."),
4069
+ workflowStatus: z8.string().optional().describe("Collection workflow state. Valid values are collection-specific and server-owned \u2014 discover them via `collections action=describe` for the target collection. The server rejects invalid values and returns the valid set in the error."),
4070
+ data: z8.record(z8.unknown()).optional().describe("Fields to update (merged with existing data)"),
4071
+ order: z8.number().optional().describe("New sort order"),
4072
+ canonicalKey: z8.string().optional().describe("Semantic type (e.g. 'decision', 'tension'). Only changeable on draft/uncommitted entries."),
4073
+ autoPublish: z8.boolean().optional().default(false).describe("Only true when user explicitly asks to publish. Default false = draft. Never auto-publish without user confirmation."),
4074
+ changeNote: z8.string().optional().describe("Strongly recommended: short human-readable rationale for WHY this change was made (e.g. 'Aligned description with F1-themed copy'). Surfaces in activity feed and pb get. If omitted, falls back to session purpose or auto-generated field summary."),
4075
+ sourceRef: z8.string().optional().describe("URI or path of the source document backing this entry. Write-once: can only be set if currently empty."),
4076
+ sourceExcerpt: z8.string().optional().describe("Verbatim excerpt from the source that backs this entry's claims. Write-once: can only be set if currently empty."),
4034
4077
  // WP-465 slice ⑤ — relay-only (TEN-2233): validation/min-length/recording live in Convex.
4035
- steeringOverrideReason: z7.string().optional().describe("Typed override (\u226512 chars) that clears a steering coherency block on a misaligned governance write \u2014 always recorded with author attribution."),
4036
- coherencyAcknowledgement: z7.object({
4037
- response: z7.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
4038
- entryId: z7.string().optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
4039
- reason: z7.string().optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
4078
+ steeringOverrideReason: z8.string().optional().describe("Typed override (\u226512 chars) that clears a steering coherency block on a misaligned governance write \u2014 always recorded with author attribution."),
4079
+ coherencyAcknowledgement: z8.object({
4080
+ response: z8.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
4081
+ entryId: z8.string().optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
4082
+ reason: z8.string().optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
4040
4083
  }).optional().describe("Explicit response to a coherency challenge (standard/strict workspace modes). One acknowledgement per challenge per entry per session.")
4041
4084
  });
4042
- var commitEntrySchema = z7.object({
4043
- entryId: z7.string().describe("Entry ID to accept, e.g. 'TEN-abc123', '<PREFIX>-<n>'"),
4085
+ var commitEntrySchema = z8.object({
4086
+ entryId: z8.string().describe("Entry ID to accept, e.g. 'TEN-abc123', '<PREFIX>-<n>'"),
4044
4087
  // WP-316 S3: Preview gate — dry-run mode. Returns would-succeed result, no DB writes.
4045
- preview: z7.boolean().optional().describe("If true, validates the accept without writing. Returns what would happen. Default false."),
4088
+ preview: z8.boolean().optional().describe("If true, validates the accept without writing. Returns what would happen. Default false."),
4046
4089
  // WP-465 slice ⑤ — relay-only (TEN-2233): validation/recording live in Convex.
4047
- steeringOverrideReason: z7.string().optional().describe("Typed override (\u226512 chars) that clears a steering coherency block at the publish chokepoint \u2014 always recorded with author attribution."),
4048
- coherencyAcknowledgement: z7.object({
4049
- response: z7.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
4050
- entryId: z7.string().optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
4051
- reason: z7.string().optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
4090
+ steeringOverrideReason: z8.string().optional().describe("Typed override (\u226512 chars) that clears a steering coherency block at the publish chokepoint \u2014 always recorded with author attribution."),
4091
+ coherencyAcknowledgement: z8.object({
4092
+ response: z8.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
4093
+ entryId: z8.string().optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
4094
+ reason: z8.string().optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
4052
4095
  }).optional().describe("Explicit response to a coherency challenge (standard/strict workspace modes).")
4053
4096
  });
4054
4097
  async function handleUpdateEntry({ entryId, name, status: rawStatus, workflowStatus: rawWorkflowStatus, data, order, canonicalKey, autoPublish, changeNote, sourceRef, sourceExcerpt, steeringOverrideReason, coherencyAcknowledgement }, toolName = "entries") {
@@ -4425,7 +4468,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
4425
4468
  // src/tools/verify.ts
4426
4469
  import { existsSync as existsSync2, readFileSync } from "fs";
4427
4470
  import { resolve as resolve2 } from "path";
4428
- import { z as z8 } from "zod/v3";
4471
+ import { z as z9 } from "zod/v3";
4429
4472
 
4430
4473
  // src/lib/resolve-project-root.ts
4431
4474
  import { existsSync } from "fs";
@@ -4577,12 +4620,12 @@ function formatTrustReport(collection, entryCount, mappings, refs, fixes, mode,
4577
4620
  lines.push("", "---", `_Schema: ${schemaTableCount} tables parsed from convex/schema.ts. Project root: ${projectRoot}_`);
4578
4621
  return lines.join("\n");
4579
4622
  }
4580
- var verifySchema = z8.object({
4581
- collection: z8.string().max(200).default("glossary").describe("Collection slug to verify (default: glossary)"),
4582
- mode: z8.enum(["report", "fix"]).default("report").describe("'report' = read-only trust report. 'fix' = also update drifted codeMapping statuses.")
4623
+ var verifySchema = z9.object({
4624
+ collection: z9.string().max(200).default("glossary").describe("Collection slug to verify (default: glossary)"),
4625
+ mode: z9.enum(["report", "fix"]).default("report").describe("'report' = read-only trust report. 'fix' = also update drifted codeMapping statuses.")
4583
4626
  });
4584
- var verifyEntrySchema = z8.object({
4585
- entryId: z8.string().max(200).describe("Human entry ID (e.g. '<PREFIX>-<n>') to mark as verified")
4627
+ var verifyEntrySchema = z9.object({
4628
+ entryId: z9.string().max(200).describe("Human entry ID (e.g. '<PREFIX>-<n>') to mark as verified")
4586
4629
  });
4587
4630
  async function handleVerifyChain(server, { collection, mode }) {
4588
4631
  const projectRoot = resolveProjectRoot();
@@ -4799,14 +4842,14 @@ async function handleVerifyEntry({ entryId }) {
4799
4842
  }
4800
4843
 
4801
4844
  // src/tools/entry-move.ts
4802
- import { z as z9 } from "zod/v3";
4803
- var moveEntrySchema = z9.object({
4804
- entryId: z9.string().describe("Entry ID to move, e.g. '<PREFIX>-<n>'"),
4805
- toCollection: z9.string().describe("Target collection slug, e.g. 'decisions', 'architecture'"),
4845
+ import { z as z10 } from "zod/v3";
4846
+ var moveEntrySchema = z10.object({
4847
+ entryId: z10.string().describe("Entry ID to move, e.g. '<PREFIX>-<n>'"),
4848
+ toCollection: z10.string().describe("Target collection slug, e.g. 'decisions', 'architecture'"),
4806
4849
  // WP-707 S2 (TASK-146): optional atomic move+RETYPE — validates and persists the entry's NEW
4807
4850
  // canonicalKey and its destination collection in the SAME write (convex/agentKnowledge/
4808
4851
  // moveToCollectionOperation.ts round 3, DEC-1622). Omit for a plain same-kind relocation.
4809
- canonicalKey: z9.string().optional().describe(
4852
+ canonicalKey: z10.string().optional().describe(
4810
4853
  "Optional: also reclassify the entry to this canonical key atomically with the move (e.g. 'decision', 'objective'). Omit for a plain relocation."
4811
4854
  )
4812
4855
  });
@@ -4869,7 +4912,7 @@ ${recovery}`,
4869
4912
  }
4870
4913
 
4871
4914
  // src/tools/entriesContract.ts
4872
- import { z as z10 } from "zod/v3";
4915
+ import { z as z11 } from "zod/v3";
4873
4916
  var ENTRIES_ACTIONS = [
4874
4917
  "list",
4875
4918
  "get",
@@ -4882,96 +4925,96 @@ var ENTRIES_ACTIONS = [
4882
4925
  "verify",
4883
4926
  "preflight"
4884
4927
  ];
4885
- var entriesStatusFilterSchema = z10.union([z10.string().max(200), z10.array(z10.enum(["draft", "active", "accepted", "deprecated", "archived"])).max(5)]);
4886
- var coherencyAcknowledgementFlatSchema = z10.object({
4887
- response: z10.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
4888
- entryId: z10.string().max(200).optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
4889
- reason: z10.string().max(2e3).optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
4928
+ var entriesStatusFilterSchema = z11.union([z11.string().max(200), z11.array(z11.enum(["draft", "active", "accepted", "deprecated", "archived"])).max(5)]);
4929
+ var coherencyAcknowledgementFlatSchema = z11.object({
4930
+ response: z11.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
4931
+ entryId: z11.string().max(200).optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
4932
+ reason: z11.string().max(2e3).optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
4890
4933
  });
4891
- var preflightLinks = z10.array(z10.object({ type: z10.string().max(200), entryId: z10.string().max(200) })).max(50).optional();
4892
- var entriesSchema = z10.object({
4934
+ var preflightLinks = z11.array(z11.object({ type: z11.string().max(200), entryId: z11.string().max(200) })).max(50).optional();
4935
+ var entriesSchema = z11.object({
4893
4936
  links: preflightLinks.describe("For preflight: proposed context links; saves nothing."),
4894
- action: z10.enum(ENTRIES_ACTIONS).describe(
4937
+ action: z11.enum(ENTRIES_ACTIONS).describe(
4895
4938
  "'preflight': inspect structural requirements before composing (requires collection). 'list': browse entries with filters. 'get': fetch one entry by ID. 'batch': fetch multiple entries. 'search': full-text search. 'update': change fields on an existing entry (draft by default). 'commit': accept a draft entry onto the Chain. 'history': audit trail for an entry. 'move': relocate an entry to a different collection (pass `canonicalKey` too for an atomic move+retype). 'verify': mark an entry as verified (lightweight \u2014 no codebase scan; see `quality action=verify-chain` for that)."
4896
4939
  ),
4897
- entryId: z10.string().max(200).optional().describe(
4940
+ entryId: z11.string().max(200).optional().describe(
4898
4941
  "Entry ID, e.g. '<PREFIX>-<n>'. Required for: get, update, commit, history, move, verify."
4899
4942
  ),
4900
- entryIds: z10.array(z10.string().max(200)).min(1).max(20).optional().describe("Entry IDs for 'batch', e.g. ['TYPE-strategy', 'STR-jljeg7']"),
4901
- collection: z10.string().max(200).optional().describe("Collection slug \u2014 for 'list'/'search': scope filter, e.g. 'glossary', 'tracking-events'. For 'preflight': the collection the entry would be composed into (required)."),
4943
+ entryIds: z11.array(z11.string().max(200)).min(1).max(20).optional().describe("Entry IDs for 'batch', e.g. ['TYPE-strategy', 'STR-jljeg7']"),
4944
+ collection: z11.string().max(200).optional().describe("Collection slug \u2014 for 'list'/'search': scope filter, e.g. 'glossary', 'tracking-events'. For 'preflight': the collection the entry would be composed into (required)."),
4902
4945
  status: entriesStatusFilterSchema.optional().describe(
4903
4946
  "For 'list': defaults to accepted entries (active/accepted); use status='draft' to discover drafts. One lifecycle value (draft|active|accepted|deprecated|archived). For 'search': one value OR an array of up to 5 (e.g. ['active','accepted']). For 'update': draft|active|deprecated|archived ONLY \u2014 'accepted' is set via 'commit', never 'update'. Workflow values use `workflowStatus` instead."
4904
4947
  ),
4905
- tag: z10.string().max(200).optional().describe("For 'list': filter by internal tag."),
4906
- label: z10.string().max(200).optional().describe("For 'list': filter by label slug \u2014 matches entries across all collections."),
4907
- query: z10.string().min(2).max(500).optional().describe("For 'search': search text (min 2 characters)."),
4908
- name: z10.string().max(500).optional().describe("For 'update': new display name."),
4909
- workflowStatus: z10.string().max(200).optional().describe(
4948
+ tag: z11.string().max(200).optional().describe("For 'list': filter by internal tag."),
4949
+ label: z11.string().max(200).optional().describe("For 'list': filter by label slug \u2014 matches entries across all collections."),
4950
+ query: z11.string().min(2).max(500).optional().describe("For 'search': search text (min 2 characters)."),
4951
+ name: z11.string().max(500).optional().describe("For 'update': new display name."),
4952
+ workflowStatus: z11.string().max(200).optional().describe(
4910
4953
  "For 'update': collection workflow state. Valid values are collection-specific and server-owned \u2014 discover via `collections action=describe`. Invalid values are rejected with the valid set."
4911
4954
  ),
4912
- data: z10.record(z10.unknown()).optional().describe("For 'update': fields to update (merged with existing data)."),
4913
- order: z10.number().optional().describe("For 'update': new sort order."),
4914
- canonicalKey: z10.string().max(200).optional().describe(
4955
+ data: z11.record(z11.unknown()).optional().describe("For 'update': fields to update (merged with existing data)."),
4956
+ order: z11.number().optional().describe("For 'update': new sort order."),
4957
+ canonicalKey: z11.string().max(200).optional().describe(
4915
4958
  "For 'update': semantic type (e.g. 'decision', 'tension'); only changeable on draft/uncommitted entries. For 'move': optional atomic move+retype target. For 'preflight': optional semantic type to check requirements for."
4916
4959
  ),
4917
- autoPublish: z10.boolean().optional().default(false).describe(
4960
+ autoPublish: z11.boolean().optional().default(false).describe(
4918
4961
  "For 'update': only true when the user explicitly asks to publish. Default false = draft."
4919
4962
  ),
4920
- changeNote: z10.string().max(2e3).optional().describe(
4963
+ changeNote: z11.string().max(2e3).optional().describe(
4921
4964
  "For 'update': short human-readable rationale for WHY this change was made. Surfaces in activity feed."
4922
4965
  ),
4923
- sourceRef: z10.string().max(2e3).optional().describe(
4966
+ sourceRef: z11.string().max(2e3).optional().describe(
4924
4967
  "For 'update': URI or path of the source document backing this entry. Write-once."
4925
4968
  ),
4926
- sourceExcerpt: z10.string().max(5e3).optional().describe(
4969
+ sourceExcerpt: z11.string().max(5e3).optional().describe(
4927
4970
  "For 'update': verbatim excerpt from the source backing this entry's claims. Write-once."
4928
4971
  ),
4929
- steeringOverrideReason: z10.string().max(2e3).optional().describe(
4972
+ steeringOverrideReason: z11.string().max(2e3).optional().describe(
4930
4973
  "For 'update'/'commit': typed override (\u226512 chars) that clears a steering coherency block."
4931
4974
  ),
4932
4975
  coherencyAcknowledgement: coherencyAcknowledgementFlatSchema.optional().describe(
4933
4976
  "For 'update'/'commit': explicit response to a coherency challenge (standard/strict workspace modes)."
4934
4977
  ),
4935
- preview: z10.boolean().optional().describe(
4978
+ preview: z11.boolean().optional().describe(
4936
4979
  "For 'commit': if true, validates the accept without writing \u2014 returns what would happen."
4937
4980
  ),
4938
- toCollection: z10.string().max(200).optional().describe("For 'move': target collection slug, e.g. 'decisions', 'architecture'.")
4981
+ toCollection: z11.string().max(200).optional().describe("For 'move': target collection slug, e.g. 'decisions', 'architecture'.")
4939
4982
  });
4940
- var entriesListVariant = z10.object({
4941
- action: z10.literal("list"),
4942
- collection: z10.string().max(200).optional(),
4943
- status: z10.string().max(200).optional(),
4944
- tag: z10.string().max(200).optional(),
4945
- label: z10.string().max(200).optional()
4983
+ var entriesListVariant = z11.object({
4984
+ action: z11.literal("list"),
4985
+ collection: z11.string().max(200).optional(),
4986
+ status: z11.string().max(200).optional(),
4987
+ tag: z11.string().max(200).optional(),
4988
+ label: z11.string().max(200).optional()
4946
4989
  });
4947
- var entriesGetVariant = z10.object({
4948
- action: z10.literal("get"),
4949
- entryId: z10.string().max(200)
4990
+ var entriesGetVariant = z11.object({
4991
+ action: z11.literal("get"),
4992
+ entryId: z11.string().max(200)
4950
4993
  });
4951
- var entriesBatchVariant = z10.object({
4952
- action: z10.literal("batch"),
4953
- entryIds: z10.array(z10.string().max(200)).min(1).max(20)
4994
+ var entriesBatchVariant = z11.object({
4995
+ action: z11.literal("batch"),
4996
+ entryIds: z11.array(z11.string().max(200)).min(1).max(20)
4954
4997
  });
4955
- var entriesSearchVariant = z10.object({
4956
- action: z10.literal("search"),
4957
- query: z10.string().min(2).max(500),
4958
- collection: z10.string().max(200).optional(),
4998
+ var entriesSearchVariant = z11.object({
4999
+ action: z11.literal("search"),
5000
+ query: z11.string().min(2).max(500),
5001
+ collection: z11.string().max(200).optional(),
4959
5002
  status: entriesStatusFilterSchema.optional()
4960
5003
  // PR #660 R1 Zqh1K: string|array.
4961
5004
  });
4962
- var entriesUpdateVariant = updateEntrySchema.extend({ action: z10.literal("update") });
4963
- var entriesCommitVariant = commitEntrySchema.extend({ action: z10.literal("commit") });
4964
- var entriesHistoryVariant = getHistorySchema.extend({ action: z10.literal("history") });
4965
- var entriesMoveVariant = z10.object({
4966
- action: z10.literal("move"),
4967
- entryId: z10.string().max(200),
4968
- toCollection: z10.string().max(200),
4969
- canonicalKey: z10.string().max(200).optional()
5005
+ var entriesUpdateVariant = updateEntrySchema.extend({ action: z11.literal("update") });
5006
+ var entriesCommitVariant = commitEntrySchema.extend({ action: z11.literal("commit") });
5007
+ var entriesHistoryVariant = getHistorySchema.extend({ action: z11.literal("history") });
5008
+ var entriesMoveVariant = z11.object({
5009
+ action: z11.literal("move"),
5010
+ entryId: z11.string().max(200),
5011
+ toCollection: z11.string().max(200),
5012
+ canonicalKey: z11.string().max(200).optional()
4970
5013
  // WP-707 S2: optional atomic move+RETYPE.
4971
5014
  });
4972
- var entriesVerifyVariant = verifyEntrySchema.extend({ action: z10.literal("verify") });
4973
- var entriesActionUnion = z10.discriminatedUnion("action", [
4974
- z10.object({ action: z10.literal("preflight"), collection: z10.string().max(200), canonicalKey: z10.string().max(200).optional(), links: preflightLinks }),
5015
+ var entriesVerifyVariant = verifyEntrySchema.extend({ action: z11.literal("verify") });
5016
+ var entriesActionUnion = z11.discriminatedUnion("action", [
5017
+ z11.object({ action: z11.literal("preflight"), collection: z11.string().max(200), canonicalKey: z11.string().max(200).optional(), links: preflightLinks }),
4975
5018
  entriesListVariant,
4976
5019
  entriesGetVariant,
4977
5020
  entriesBatchVariant,
@@ -5049,15 +5092,15 @@ function renderVerificationLine(e) {
5049
5092
  }
5050
5093
  return `**Verification:** ${String(e.verificationStatus)}${who}`;
5051
5094
  }
5052
- var entriesGetOutputSchema = z11.object({
5053
- entryId: z11.string(),
5054
- name: z11.string(),
5055
- collection: z11.string(),
5056
- status: z11.string(),
5057
- capturedAt: z11.number().optional(),
5058
- origin: z11.string().optional(),
5059
- originDetail: z11.string().optional(),
5060
- verificationStatus: z11.string().optional(),
5095
+ var entriesGetOutputSchema = z12.object({
5096
+ entryId: z12.string(),
5097
+ name: z12.string(),
5098
+ collection: z12.string(),
5099
+ status: z12.string(),
5100
+ capturedAt: z12.number().optional(),
5101
+ origin: z12.string().optional(),
5102
+ originDetail: z12.string().optional(),
5103
+ verificationStatus: z12.string().optional(),
5061
5104
  // Attestation-model finding (PR #341 review): the server's honest verifier label and
5062
5105
  // derived attestation strength/basis — connectors NEVER re-derive strength (spec §5),
5063
5106
  // they only render what chain.getEntry ships. Mirrors packages/cli EntryFromApi.
@@ -5066,73 +5109,74 @@ var entriesGetOutputSchema = z11.object({
5066
5109
  // attestation.ts's AttestationStrength SSOT (allowlisted in Check D —
5067
5110
  // scripts/check-collection-ssot.mjs's CHECK_D_ALLOWLIST — with the full
5068
5111
  // reasoning for why this can't just import that module). Update both together.
5069
- verifiedBy: z11.string().optional(),
5070
- attestation: z11.object({
5071
- strength: z11.enum(["human-direct", "delegated", "system", "unattested"]),
5072
- basis: z11.string().optional()
5112
+ verifiedBy: z12.string().optional(),
5113
+ attestation: z12.object({
5114
+ strength: z12.enum(["human-direct", "delegated", "system", "unattested"]),
5115
+ basis: z12.string().optional()
5073
5116
  }).optional(),
5074
- sourceRef: z11.string().optional(),
5075
- sourceExcerpt: z11.string().optional(),
5076
- why: z11.string().optional(),
5117
+ sourceRef: z12.string().optional(),
5118
+ sourceExcerpt: z12.string().optional(),
5119
+ why: z12.string().optional(),
5077
5120
  // TEN-2191: quality of the captured WHY — 'rationale' | 'missing' | 'restated'.
5078
- whyQuality: z11.enum(["rationale", "missing", "restated"]).optional(),
5079
- data: z11.record(z11.unknown()).optional(),
5080
- relations: z11.array(z11.object({
5081
- entryId: z11.string().optional(),
5082
- name: z11.string(),
5083
- type: z11.string(),
5084
- direction: z11.string(),
5085
- status: z11.string().optional()
5121
+ whyQuality: z12.enum(["rationale", "missing", "restated"]).optional(),
5122
+ data: z12.record(z12.unknown()).optional(),
5123
+ relations: z12.array(z12.object({
5124
+ entryId: z12.string().optional(),
5125
+ name: z12.string(),
5126
+ type: z12.string(),
5127
+ direction: z12.string(),
5128
+ status: z12.string().optional()
5086
5129
  })).optional(),
5087
- labels: z11.array(z11.string()).optional()
5130
+ labels: z12.array(z12.string()).optional(),
5131
+ owner: ownerOutputShape.optional()
5088
5132
  }).passthrough();
5089
- var entriesListOutputSchema = z11.object({
5090
- entries: z11.array(z11.object({
5091
- entryId: z11.string(),
5092
- name: z11.string(),
5093
- collection: z11.string(),
5094
- status: z11.string()
5133
+ var entriesListOutputSchema = z12.object({
5134
+ entries: z12.array(z12.object({
5135
+ entryId: z12.string(),
5136
+ name: z12.string(),
5137
+ collection: z12.string(),
5138
+ status: z12.string()
5095
5139
  })),
5096
- total: z11.number()
5140
+ total: z12.number()
5097
5141
  });
5098
- var entriesSearchOutputSchema = z11.object({
5099
- results: z11.array(z11.object({
5100
- entryId: z11.string(),
5101
- name: z11.string(),
5102
- collection: z11.string(),
5103
- status: z11.string(),
5104
- score: z11.number().optional()
5142
+ var entriesSearchOutputSchema = z12.object({
5143
+ results: z12.array(z12.object({
5144
+ entryId: z12.string(),
5145
+ name: z12.string(),
5146
+ collection: z12.string(),
5147
+ status: z12.string(),
5148
+ score: z12.number().optional()
5105
5149
  })),
5106
- total: z11.number(),
5107
- query: z11.string()
5150
+ total: z12.number(),
5151
+ query: z12.string()
5108
5152
  });
5109
- var entriesBatchOutputSchema = z11.object({
5110
- entries: z11.array(z11.object({
5111
- entryId: z11.string(),
5112
- name: z11.string(),
5113
- collection: z11.string(),
5114
- status: z11.string(),
5115
- capturedAt: z11.number().optional(),
5116
- origin: z11.string().optional(),
5117
- originDetail: z11.string().optional(),
5118
- verificationStatus: z11.string().optional(),
5153
+ var entriesBatchOutputSchema = z12.object({
5154
+ entries: z12.array(z12.object({
5155
+ entryId: z12.string(),
5156
+ name: z12.string(),
5157
+ collection: z12.string(),
5158
+ status: z12.string(),
5159
+ capturedAt: z12.number().optional(),
5160
+ origin: z12.string().optional(),
5161
+ originDetail: z12.string().optional(),
5162
+ verificationStatus: z12.string().optional(),
5119
5163
  // Attestation-model finding (PR #341 review): mirror entriesGetOutputSchema — batch
5120
5164
  // entries now carry the same honest verifiedBy/attestation fields. Literal set is
5121
5165
  // the same hand-kept SSOT mirror — see entriesGetOutputSchema's attestation
5122
5166
  // comment above for the full Check D / kernel-import reasoning.
5123
- verifiedBy: z11.string().optional(),
5124
- attestation: z11.object({
5125
- strength: z11.enum(["human-direct", "delegated", "system", "unattested"]),
5126
- basis: z11.string().optional()
5167
+ verifiedBy: z12.string().optional(),
5168
+ attestation: z12.object({
5169
+ strength: z12.enum(["human-direct", "delegated", "system", "unattested"]),
5170
+ basis: z12.string().optional()
5127
5171
  }).optional(),
5128
- sourceRef: z11.string().optional(),
5129
- sourceExcerpt: z11.string().optional(),
5172
+ sourceRef: z12.string().optional(),
5173
+ sourceExcerpt: z12.string().optional(),
5130
5174
  // TEN-2191: mirror entriesGetOutputSchema — batch entries now carry why/whyQuality.
5131
- why: z11.string().optional(),
5132
- whyQuality: z11.enum(["rationale", "missing", "restated"]).optional(),
5133
- data: z11.record(z11.unknown()).optional()
5175
+ why: z12.string().optional(),
5176
+ whyQuality: z12.enum(["rationale", "missing", "restated"]).optional(),
5177
+ data: z12.record(z12.unknown()).optional()
5134
5178
  }).passthrough()),
5135
- total: z11.number()
5179
+ total: z12.number()
5136
5180
  });
5137
5181
  function registerEntriesTools(server) {
5138
5182
  const entriesHandlers = {
@@ -5197,9 +5241,9 @@ async function handleGet(entryId) {
5197
5241
  if (verificationLine) lines.push(verificationLine);
5198
5242
  if (e.sourceRef) lines.push(`**Source ref:** ${e.sourceRef}`);
5199
5243
  if (e.sourceExcerpt) lines.push(`**Source excerpt:** ${e.sourceExcerpt}`);
5200
- if (epistemic) {
5201
- lines.push(formatEpistemicLine(epistemic));
5202
- }
5244
+ const parsedOwner = parseOwnerOutput(e.owner);
5245
+ if (parsedOwner) lines.push(formatOwnerLine(parsedOwner));
5246
+ if (epistemic) lines.push(formatEpistemicLine(epistemic));
5203
5247
  const { line: whyLine, why, whySourceKey } = renderWhyLine(e);
5204
5248
  if (whyLine !== null) lines.push(whyLine);
5205
5249
  const visibleData = sanitizeEntryData(e.data);
@@ -5249,6 +5293,7 @@ async function handleGet(entryId) {
5249
5293
  ...e.attestation && typeof e.attestation === "object" ? { attestation: e.attestation } : {},
5250
5294
  ...e.sourceRef ? { sourceRef: String(e.sourceRef) } : {},
5251
5295
  ...e.sourceExcerpt ? { sourceExcerpt: String(e.sourceExcerpt) } : {},
5296
+ ...parsedOwner ? { owner: parsedOwner } : {},
5252
5297
  // TEN-2191: surface the WHY and its quality in the structured payload too.
5253
5298
  ...why.length > 0 ? { why } : {},
5254
5299
  ...e.whyQuality ? { whyQuality: String(e.whyQuality) } : {},
@@ -5260,9 +5305,7 @@ async function handleGet(entryId) {
5260
5305
  // This restores true STD-218 text/structured parity and removes the duplication
5261
5306
  // that commit 8f3b1664 left in the structured payload. (Codex finding, TEN-2191.)
5262
5307
  ...filteredData ? { data: filteredData } : {},
5263
- ...Array.isArray(e.relations) && e.relations.length > 0 ? {
5264
- relations: projectEntryRelations(e.relations)
5265
- } : {},
5308
+ ...Array.isArray(e.relations) && e.relations.length > 0 ? { relations: projectEntryRelations(e.relations) } : {},
5266
5309
  ...Array.isArray(e.labels) && e.labels.length > 0 ? { labels: e.labels.map((l) => l.slug ?? l.name ?? "") } : {}
5267
5310
  };
5268
5311
  return {
@@ -5517,41 +5560,41 @@ ${footer}` }],
5517
5560
  }
5518
5561
 
5519
5562
  // src/tools/relations.ts
5520
- import { z as z13 } from "zod/v3";
5563
+ import { z as z14 } from "zod/v3";
5521
5564
 
5522
5565
  // src/tools/graph.ts
5523
- import { z as z12 } from "zod/v3";
5566
+ import { z as z13 } from "zod/v3";
5524
5567
  var GRAPH_ACTIONS = ["find", "suggest"];
5525
- var graphSchema = z12.object({
5526
- action: z12.enum(GRAPH_ACTIONS).describe(
5568
+ var graphSchema = z13.object({
5569
+ action: z13.enum(GRAPH_ACTIONS).describe(
5527
5570
  "'find': traverse relations from an entry (graph walk). 'suggest': discover potential connections for an entry."
5528
5571
  ),
5529
- entryId: z12.string().max(200).describe("Entry ID, e.g. '<PREFIX>-<n>'"),
5530
- direction: z12.enum(["incoming", "outgoing", "both"]).default("both").optional().describe("For find: 'incoming' = what references this, 'outgoing' = what this references"),
5531
- limit: z12.number().min(1).max(20).default(10).optional().describe("For suggest: max suggestions to return"),
5532
- depth: z12.number().min(1).max(3).default(2).optional().describe("For suggest: graph traversal depth")
5572
+ entryId: z13.string().max(200).describe("Entry ID, e.g. '<PREFIX>-<n>'"),
5573
+ direction: z13.enum(["incoming", "outgoing", "both"]).default("both").optional().describe("For find: 'incoming' = what references this, 'outgoing' = what this references"),
5574
+ limit: z13.number().min(1).max(20).default(10).optional().describe("For suggest: max suggestions to return"),
5575
+ depth: z13.number().min(1).max(3).default(2).optional().describe("For suggest: graph traversal depth")
5533
5576
  });
5534
- var graphFindOutputSchema = z12.object({
5535
- entryId: z12.string(),
5536
- relations: z12.array(z12.object({
5537
- entryId: z12.string().optional(),
5538
- name: z12.string(),
5539
- type: z12.string(),
5540
- direction: z12.enum(["outgoing", "incoming"])
5577
+ var graphFindOutputSchema = z13.object({
5578
+ entryId: z13.string(),
5579
+ relations: z13.array(z13.object({
5580
+ entryId: z13.string().optional(),
5581
+ name: z13.string(),
5582
+ type: z13.string(),
5583
+ direction: z13.enum(["outgoing", "incoming"])
5541
5584
  })),
5542
- total: z12.number()
5585
+ total: z13.number()
5543
5586
  });
5544
- var graphSuggestOutputSchema = z12.object({
5545
- entryId: z12.string(),
5546
- suggestions: z12.array(z12.object({
5547
- targetEntryId: z12.string().optional(),
5548
- targetName: z12.string(),
5549
- relationType: z12.string(),
5550
- direction: z12.string(),
5551
- confidence: z12.number(),
5552
- reason: z12.string()
5587
+ var graphSuggestOutputSchema = z13.object({
5588
+ entryId: z13.string(),
5589
+ suggestions: z13.array(z13.object({
5590
+ targetEntryId: z13.string().optional(),
5591
+ targetName: z13.string(),
5592
+ relationType: z13.string(),
5593
+ direction: z13.string(),
5594
+ confidence: z13.number(),
5595
+ reason: z13.string()
5553
5596
  })),
5554
- total: z12.number()
5597
+ total: z13.number()
5555
5598
  });
5556
5599
  async function handleFind(entryId, direction) {
5557
5600
  const relations = await kernelQuery("chain.listEntryRelations", { entryId });
@@ -5742,64 +5785,64 @@ async function handleSuggest(entryId, limit, depth) {
5742
5785
 
5743
5786
  // src/tools/relations.ts
5744
5787
  var RELATIONS_ACTIONS = ["create", "batch-create", "dismiss", "delete", "find", "suggest"];
5745
- var relationItemSchema = z13.object({
5746
- from: z13.string().max(200),
5747
- to: z13.string().max(200),
5748
- type: z13.string().max(200)
5788
+ var relationItemSchema = z14.object({
5789
+ from: z14.string().max(200),
5790
+ to: z14.string().max(200),
5791
+ type: z14.string().max(200)
5749
5792
  });
5750
- var relationsSchema = z13.object({
5751
- action: z13.enum(RELATIONS_ACTIONS).describe(
5793
+ var relationsSchema = z14.object({
5794
+ action: z14.enum(RELATIONS_ACTIONS).describe(
5752
5795
  "'create': link two entries. 'batch-create': create multiple relations (validates every item before writing any). 'dismiss': record that a suggestion was not relevant. 'delete': remove a relation. 'find': traverse relations from an entry (graph walk, absorbs graph action=find). 'suggest': discover potential connections for an entry (absorbs graph action=suggest)."
5753
5796
  ),
5754
- from: z13.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': source entry ID."),
5755
- to: z13.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': target entry ID."),
5756
- type: z13.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': relation type."),
5757
- score: z13.number().optional().describe("For 'dismiss': suggestion score from action=suggest."),
5758
- relations: z13.array(relationItemSchema).min(1).max(20).optional().describe("For 'batch-create': array of {from, to, type}."),
5797
+ from: z14.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': source entry ID."),
5798
+ to: z14.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': target entry ID."),
5799
+ type: z14.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': relation type."),
5800
+ score: z14.number().optional().describe("For 'dismiss': suggestion score from action=suggest."),
5801
+ relations: z14.array(relationItemSchema).min(1).max(20).optional().describe("For 'batch-create': array of {from, to, type}."),
5759
5802
  // WP-316 S3: Preview gate — dry-run mode for action=create.
5760
- preview: z13.boolean().optional().describe("For 'create': if true, validates the relation without writing. Returns what would happen. Default false."),
5761
- entryId: z13.string().max(200).optional().describe("For 'find'/'suggest': entry ID, e.g. '<PREFIX>-<n>'."),
5762
- direction: z13.enum(["incoming", "outgoing", "both"]).optional().describe("For 'find': 'incoming' = what references this, 'outgoing' = what this references. Default 'both'."),
5763
- limit: z13.number().min(1).max(20).optional().describe("For 'suggest': max suggestions to return. Default 10."),
5764
- depth: z13.number().min(1).max(3).optional().describe("For 'suggest': graph traversal depth. Default 2.")
5803
+ preview: z14.boolean().optional().describe("For 'create': if true, validates the relation without writing. Returns what would happen. Default false."),
5804
+ entryId: z14.string().max(200).optional().describe("For 'find'/'suggest': entry ID, e.g. '<PREFIX>-<n>'."),
5805
+ direction: z14.enum(["incoming", "outgoing", "both"]).optional().describe("For 'find': 'incoming' = what references this, 'outgoing' = what this references. Default 'both'."),
5806
+ limit: z14.number().min(1).max(20).optional().describe("For 'suggest': max suggestions to return. Default 10."),
5807
+ depth: z14.number().min(1).max(3).optional().describe("For 'suggest': graph traversal depth. Default 2.")
5765
5808
  });
5766
- var relationsCreateVariant = z13.object({
5767
- action: z13.literal("create"),
5768
- from: z13.string().max(200),
5769
- to: z13.string().max(200),
5770
- type: z13.string().max(200),
5771
- score: z13.number().optional(),
5772
- preview: z13.boolean().optional()
5809
+ var relationsCreateVariant = z14.object({
5810
+ action: z14.literal("create"),
5811
+ from: z14.string().max(200),
5812
+ to: z14.string().max(200),
5813
+ type: z14.string().max(200),
5814
+ score: z14.number().optional(),
5815
+ preview: z14.boolean().optional()
5773
5816
  });
5774
- var relationsBatchCreateVariant = z13.object({
5775
- action: z13.literal("batch-create"),
5776
- relations: z13.array(relationItemSchema).min(1).max(20)
5817
+ var relationsBatchCreateVariant = z14.object({
5818
+ action: z14.literal("batch-create"),
5819
+ relations: z14.array(relationItemSchema).min(1).max(20)
5777
5820
  });
5778
- var relationsDismissVariant = z13.object({
5779
- action: z13.literal("dismiss"),
5780
- from: z13.string().max(200),
5781
- to: z13.string().max(200),
5782
- type: z13.string().max(200).optional(),
5783
- score: z13.number().optional()
5821
+ var relationsDismissVariant = z14.object({
5822
+ action: z14.literal("dismiss"),
5823
+ from: z14.string().max(200),
5824
+ to: z14.string().max(200),
5825
+ type: z14.string().max(200).optional(),
5826
+ score: z14.number().optional()
5784
5827
  });
5785
- var relationsDeleteVariant = z13.object({
5786
- action: z13.literal("delete"),
5787
- from: z13.string().max(200),
5788
- to: z13.string().max(200),
5789
- type: z13.string().max(200)
5828
+ var relationsDeleteVariant = z14.object({
5829
+ action: z14.literal("delete"),
5830
+ from: z14.string().max(200),
5831
+ to: z14.string().max(200),
5832
+ type: z14.string().max(200)
5790
5833
  });
5791
- var relationsFindVariant = z13.object({
5792
- action: z13.literal("find"),
5793
- entryId: z13.string().max(200),
5794
- direction: z13.enum(["incoming", "outgoing", "both"]).optional().default("both")
5834
+ var relationsFindVariant = z14.object({
5835
+ action: z14.literal("find"),
5836
+ entryId: z14.string().max(200),
5837
+ direction: z14.enum(["incoming", "outgoing", "both"]).optional().default("both")
5795
5838
  });
5796
- var relationsSuggestVariant = z13.object({
5797
- action: z13.literal("suggest"),
5798
- entryId: z13.string().max(200),
5799
- limit: z13.number().min(1).max(20).optional().default(10),
5800
- depth: z13.number().min(1).max(3).optional().default(2)
5839
+ var relationsSuggestVariant = z14.object({
5840
+ action: z14.literal("suggest"),
5841
+ entryId: z14.string().max(200),
5842
+ limit: z14.number().min(1).max(20).optional().default(10),
5843
+ depth: z14.number().min(1).max(3).optional().default(2)
5801
5844
  });
5802
- var relationsActionUnion = z13.discriminatedUnion("action", [
5845
+ var relationsActionUnion = z14.discriminatedUnion("action", [
5803
5846
  relationsCreateVariant,
5804
5847
  relationsBatchCreateVariant,
5805
5848
  relationsDismissVariant,
@@ -6154,19 +6197,19 @@ async function handleDelete(from, to, type) {
6154
6197
  }
6155
6198
 
6156
6199
  // src/tools/context.ts
6157
- import { z as z15 } from "zod/v3";
6200
+ import { z as z16 } from "zod/v3";
6158
6201
 
6159
6202
  // src/tools/documents.ts
6160
- import { z as z14 } from "zod/v3";
6203
+ import { z as z15 } from "zod/v3";
6161
6204
  var DOCUMENTS_ACTIONS = ["get-last-verified-brief"];
6162
- var documentsSchema = z14.object({
6163
- action: z14.enum(DOCUMENTS_ACTIONS).describe(
6205
+ var documentsSchema = z15.object({
6206
+ action: z15.enum(DOCUMENTS_ACTIONS).describe(
6164
6207
  "'get-last-verified-brief': fetch the most recent verified brief snapshot for a (templateId, scopeKey) pair. Returns the verified summary so agents can build delta narratives ('since you last verified, X workstreams advanced')."
6165
6208
  ),
6166
- templateId: z14.string().max(200).describe(
6209
+ templateId: z15.string().max(200).describe(
6167
6210
  "Brief template identifier \u2014 currently 'steering-brief' is the only registered template."
6168
6211
  ),
6169
- scopeKey: z14.string().max(200).describe(
6212
+ scopeKey: z15.string().max(200).describe(
6170
6213
  "Canonical scope key. Use 'workspace:<workspaceId>' for the full workspace brief, or 'initiative:<INI-ID>' for an initiative-scoped brief. The same formula is applied at write time (chainwork/docKernel/scopeKey.ts), so passing the wrong shape returns exists:false."
6171
6214
  )
6172
6215
  });
@@ -6246,89 +6289,89 @@ function epistemicCollectionHint(collectionName) {
6246
6289
  return "";
6247
6290
  }
6248
6291
  var CONTEXT_ACTIONS = ["gather", "build", "neighborhood", "changes", "chain", "cross-cut", "incremental", "brief", "last-verified-brief"];
6249
- var contextSchema = z15.object({
6292
+ var contextSchema = z16.object({
6250
6293
  // provenance: neighborhood BET-142; changes/chain/cross-cut/incremental/brief BET-239 (E4, E6)
6251
- action: z15.enum(CONTEXT_ACTIONS).describe(
6294
+ action: z16.enum(CONTEXT_ACTIONS).describe(
6252
6295
  "'gather': assemble knowledge context (entry graph, task auto-load, journey mode, or graph mode). 'build': structured build spec for an entry. 'neighborhood': typed graph neighborhood for an entry \u2014 blocking chain, dependencies, parent context, tensions, staleness. 'changes': entries modified and relations created since a timestamp. Requires 'since' parameter. 'chain': directed traversal along one relation type to depth 4. Requires entryId. Optional: direction, relationType, maxHops (1-4). 'cross-cut': structural aggregation \u2014 all relations of a given type grouped by source collection. Requires 'relationType' parameter. 'incremental': delta since last brief run for a skill. Requires 'skill' parameter. Returns only entries changed since the skill's last brief. 'brief': compound intelligence query. Requires 'briefType' parameter: 'steering' (changes + structure + delta + readiness), 'confidence' (changes + active bets + tensions), or 'delta' (changes + relations since timestamp). Optional 'since' for delta type. 'last-verified-brief': fetch the most recent verified brief snapshot for a (templateId, scopeKey) pair (absorbs documents action=get-last-verified-brief). Requires templateId and scopeKey."
6253
6296
  ),
6254
- entryId: z15.string().max(200).optional().describe("For 'build'/'neighborhood'/'chain': entry ID, e.g. '<PREFIX>-<n>'. For 'gather': optional entry ID for entry-graph mode."),
6255
- mapEntryId: z15.string().max(200).optional().describe(
6297
+ entryId: z16.string().max(200).optional().describe("For 'build'/'neighborhood'/'chain': entry ID, e.g. '<PREFIX>-<n>'. For 'gather': optional entry ID for entry-graph mode."),
6298
+ mapEntryId: z16.string().max(200).optional().describe(
6256
6299
  "For 'gather': journey map entry ID for journey-aware context. Returns context organised by journey stage. Takes precedence over entryId when both are supplied. Example: '<PREFIX>-<n>'."
6257
6300
  ),
6258
- task: z15.string().max(2e3).optional().describe("For 'gather': natural-language task description for loading task-relevant governance, binding constraints, and supporting context."),
6259
- since: z15.string().max(200).optional().describe(
6301
+ task: z16.string().max(2e3).optional().describe("For 'gather': natural-language task description for loading task-relevant governance, binding constraints, and supporting context."),
6302
+ since: z16.string().max(200).optional().describe(
6260
6303
  "For 'changes': ISO 8601 timestamp \u2014 returns entries/relations modified since this time. For 'brief' briefType='delta': optional custom timestamp. Example: '2026-03-24T00:00:00Z'."
6261
6304
  ),
6262
- direction: z15.enum(["outgoing", "incoming"]).default("outgoing").optional().describe("For 'chain' action: traversal direction. 'outgoing' follows relations from source, 'incoming' follows relations to source. Default: outgoing."),
6263
- relationType: z15.string().max(200).optional().describe(
6305
+ direction: z16.enum(["outgoing", "incoming"]).default("outgoing").optional().describe("For 'chain' action: traversal direction. 'outgoing' follows relations from source, 'incoming' follows relations to source. Default: outgoing."),
6306
+ relationType: z16.string().max(200).optional().describe(
6264
6307
  "Relation type filter. For 'chain': optional filter to traverse only this relation type. For 'cross-cut': required \u2014 scans all relations of this type across the workspace. Examples: 'part_of', 'informs', 'governs', 'blocks', 'depends_on'."
6265
6308
  ),
6266
- mode: z15.enum(["search", "graph"]).default("search").optional().describe("For gather: 'search' (default) or 'graph' (enhanced with provenance paths). Ignored when mapEntryId is provided."),
6267
- maxHops: z15.number().min(1).max(4).default(2).describe("Relation traversal depth (1=direct only, 2=default, 3=wide net, 4=deep chain walk)"),
6268
- maxResults: z15.number().min(1).max(25).default(10).optional().describe("Max entries to return in gather task mode (default 10)"),
6269
- strategy: z15.enum(["hybrid", "keyword"]).default("keyword").optional().describe("Seed strategy for task-based gather: 'keyword' (FTS only, default) or 'hybrid' (vector + FTS). Only affects task mode."),
6270
- skill: z15.string().max(200).optional().describe(
6309
+ mode: z16.enum(["search", "graph"]).default("search").optional().describe("For gather: 'search' (default) or 'graph' (enhanced with provenance paths). Ignored when mapEntryId is provided."),
6310
+ maxHops: z16.number().min(1).max(4).default(2).describe("Relation traversal depth (1=direct only, 2=default, 3=wide net, 4=deep chain walk)"),
6311
+ maxResults: z16.number().min(1).max(25).default(10).optional().describe("Max entries to return in gather task mode (default 10)"),
6312
+ strategy: z16.enum(["hybrid", "keyword"]).default("keyword").optional().describe("Seed strategy for task-based gather: 'keyword' (FTS only, default) or 'hybrid' (vector + FTS). Only affects task mode."),
6313
+ skill: z16.string().max(200).optional().describe(
6271
6314
  "Skill name for 'incremental' action \u2014 identifies which skill's brief history to compare against. Examples: 'preflight', 'shaping', 'review'. Required when action is 'incremental'."
6272
6315
  ),
6273
- briefType: z15.enum(["steering", "confidence", "delta"]).optional().describe(
6316
+ briefType: z16.enum(["steering", "confidence", "delta"]).optional().describe(
6274
6317
  "Compound query type for 'brief' action. 'steering': 7d changes + structural aggregation (part_of, depends_on, constrains) + incremental delta + workspace readiness. 'confidence': 7d changes + active bets summary + active tensions breakdown. 'delta': changes + relations since a custom timestamp (use 'since' param). Required when action is 'brief'."
6275
6318
  ),
6276
- templateId: z15.string().max(200).optional().describe(
6319
+ templateId: z16.string().max(200).optional().describe(
6277
6320
  "For 'last-verified-brief': brief template identifier \u2014 currently 'steering-brief' is the only registered template."
6278
6321
  ),
6279
- scopeKey: z15.string().max(200).optional().describe(
6322
+ scopeKey: z16.string().max(200).optional().describe(
6280
6323
  "For 'last-verified-brief': canonical scope key \u2014 'workspace:<workspaceId>' or 'initiative:<INI-ID>'."
6281
6324
  )
6282
6325
  });
6283
- var contextGatherVariant = z15.object({
6284
- action: z15.literal("gather"),
6285
- entryId: z15.string().max(200).optional(),
6286
- mapEntryId: z15.string().max(200).optional(),
6287
- task: z15.string().max(2e3).optional(),
6288
- mode: z15.enum(["search", "graph"]).optional().default("search"),
6289
- maxHops: z15.number().min(1).max(4).optional().default(2),
6290
- maxResults: z15.number().min(1).max(25).optional().default(10),
6291
- strategy: z15.enum(["hybrid", "keyword"]).optional().default("keyword")
6326
+ var contextGatherVariant = z16.object({
6327
+ action: z16.literal("gather"),
6328
+ entryId: z16.string().max(200).optional(),
6329
+ mapEntryId: z16.string().max(200).optional(),
6330
+ task: z16.string().max(2e3).optional(),
6331
+ mode: z16.enum(["search", "graph"]).optional().default("search"),
6332
+ maxHops: z16.number().min(1).max(4).optional().default(2),
6333
+ maxResults: z16.number().min(1).max(25).optional().default(10),
6334
+ strategy: z16.enum(["hybrid", "keyword"]).optional().default("keyword")
6292
6335
  });
6293
- var contextBuildVariant = z15.object({
6294
- action: z15.literal("build"),
6295
- entryId: z15.string().max(200),
6296
- maxHops: z15.number().min(1).max(4).optional().default(2)
6336
+ var contextBuildVariant = z16.object({
6337
+ action: z16.literal("build"),
6338
+ entryId: z16.string().max(200),
6339
+ maxHops: z16.number().min(1).max(4).optional().default(2)
6297
6340
  });
6298
- var contextNeighborhoodVariant = z15.object({
6299
- action: z15.literal("neighborhood"),
6300
- entryId: z15.string().max(200)
6341
+ var contextNeighborhoodVariant = z16.object({
6342
+ action: z16.literal("neighborhood"),
6343
+ entryId: z16.string().max(200)
6301
6344
  });
6302
- var contextChangesVariant = z15.object({
6303
- action: z15.literal("changes"),
6304
- since: z15.string().max(200)
6345
+ var contextChangesVariant = z16.object({
6346
+ action: z16.literal("changes"),
6347
+ since: z16.string().max(200)
6305
6348
  });
6306
- var contextChainVariant = z15.object({
6307
- action: z15.literal("chain"),
6308
- entryId: z15.string().max(200),
6309
- direction: z15.enum(["outgoing", "incoming"]).optional().default("outgoing"),
6310
- maxHops: z15.number().min(1).max(4).optional().default(2),
6311
- relationType: z15.string().max(200).optional()
6349
+ var contextChainVariant = z16.object({
6350
+ action: z16.literal("chain"),
6351
+ entryId: z16.string().max(200),
6352
+ direction: z16.enum(["outgoing", "incoming"]).optional().default("outgoing"),
6353
+ maxHops: z16.number().min(1).max(4).optional().default(2),
6354
+ relationType: z16.string().max(200).optional()
6312
6355
  });
6313
- var contextCrossCutVariant = z15.object({
6314
- action: z15.literal("cross-cut"),
6315
- relationType: z15.string().max(200)
6356
+ var contextCrossCutVariant = z16.object({
6357
+ action: z16.literal("cross-cut"),
6358
+ relationType: z16.string().max(200)
6316
6359
  });
6317
- var contextIncrementalVariant = z15.object({
6318
- action: z15.literal("incremental"),
6319
- skill: z15.string().max(200)
6360
+ var contextIncrementalVariant = z16.object({
6361
+ action: z16.literal("incremental"),
6362
+ skill: z16.string().max(200)
6320
6363
  });
6321
- var contextBriefVariant = z15.object({
6322
- action: z15.literal("brief"),
6323
- briefType: z15.enum(["steering", "confidence", "delta"]),
6324
- since: z15.string().max(200).optional()
6364
+ var contextBriefVariant = z16.object({
6365
+ action: z16.literal("brief"),
6366
+ briefType: z16.enum(["steering", "confidence", "delta"]),
6367
+ since: z16.string().max(200).optional()
6325
6368
  });
6326
- var contextLastVerifiedBriefVariant = z15.object({
6327
- action: z15.literal("last-verified-brief"),
6328
- templateId: z15.string().max(200),
6329
- scopeKey: z15.string().max(200)
6369
+ var contextLastVerifiedBriefVariant = z16.object({
6370
+ action: z16.literal("last-verified-brief"),
6371
+ templateId: z16.string().max(200),
6372
+ scopeKey: z16.string().max(200)
6330
6373
  });
6331
- var contextActionUnion = z15.discriminatedUnion("action", [
6374
+ var contextActionUnion = z16.discriminatedUnion("action", [
6332
6375
  contextGatherVariant,
6333
6376
  contextBuildVariant,
6334
6377
  contextNeighborhoodVariant,
@@ -7371,20 +7414,20 @@ function formatTimeAgo(ms) {
7371
7414
  }
7372
7415
 
7373
7416
  // src/tools/collections.ts
7374
- import { z as z17 } from "zod/v3";
7417
+ import { z as z18 } from "zod/v3";
7375
7418
 
7376
7419
  // src/tools/labels.ts
7377
- import { z as z16 } from "zod/v3";
7378
- var labelsSchema = z16.object({
7379
- action: z16.enum(["list", "create", "update", "delete", "apply", "remove"]).describe("Action: list all labels, create/update/delete a label, or apply/remove a label on an entry"),
7380
- slug: z16.string().max(200).optional().describe("Label slug (required for create/update/delete/apply/remove)"),
7381
- name: z16.string().max(500).optional().describe("Display name (required for create)"),
7382
- color: z16.string().max(50).optional().describe("Hex color, e.g. '#ef4444'"),
7383
- description: z16.string().max(2e3).optional().describe("What this label means"),
7384
- parentSlug: z16.string().max(200).optional().describe("Parent group slug for label hierarchy"),
7385
- isGroup: z16.boolean().optional().describe("True if this is a group container, not a taggable label"),
7386
- order: z16.number().optional().describe("Sort order within its group"),
7387
- entryId: z16.string().max(200).optional().describe("Entry ID for apply/remove actions")
7420
+ import { z as z17 } from "zod/v3";
7421
+ var labelsSchema = z17.object({
7422
+ action: z17.enum(["list", "create", "update", "delete", "apply", "remove"]).describe("Action: list all labels, create/update/delete a label, or apply/remove a label on an entry"),
7423
+ slug: z17.string().max(200).optional().describe("Label slug (required for create/update/delete/apply/remove)"),
7424
+ name: z17.string().max(500).optional().describe("Display name (required for create)"),
7425
+ color: z17.string().max(50).optional().describe("Hex color, e.g. '#ef4444'"),
7426
+ description: z17.string().max(2e3).optional().describe("What this label means"),
7427
+ parentSlug: z17.string().max(200).optional().describe("Parent group slug for label hierarchy"),
7428
+ isGroup: z17.boolean().optional().describe("True if this is a group container, not a taggable label"),
7429
+ order: z17.number().optional().describe("Sort order within its group"),
7430
+ entryId: z17.string().max(200).optional().describe("Entry ID for apply/remove actions")
7388
7431
  });
7389
7432
  async function handleLabelsList() {
7390
7433
  const labels = await kernelQuery("chain.listLabels");
@@ -7488,118 +7531,118 @@ var COLLECTIONS_ACTIONS = [
7488
7531
  "label-apply",
7489
7532
  "label-remove"
7490
7533
  ];
7491
- var qualityCriterionSchema = z17.object({
7492
- field: z17.string().max(200).describe("Entry data field key this criterion applies to, e.g. 'description', 'owner'"),
7534
+ var qualityCriterionSchema = z18.object({
7535
+ field: z18.string().max(200).describe("Entry data field key this criterion applies to, e.g. 'description', 'owner'"),
7493
7536
  // WP-480 S1: `max_length` — must mirror the Convex rule union, or the tool rejects a
7494
7537
  // valid criterion before the request ever reaches the server.
7495
- rule: z17.enum(["required", "min_length", "max_length", "pattern"]).describe("'required': field must be non-empty (blocks accept). 'min_length': minimum string length (warns). 'max_length': maximum string length (warns). 'pattern': regex match (warns)."),
7496
- value: z17.string().max(500).optional().describe("For min_length/max_length: the length bound as a string integer. For pattern: the regex string. Unused for 'required'.")
7538
+ rule: z18.enum(["required", "min_length", "max_length", "pattern"]).describe("'required': field must be non-empty (blocks accept). 'min_length': minimum string length (warns). 'max_length': maximum string length (warns). 'pattern': regex match (warns)."),
7539
+ value: z18.string().max(500).optional().describe("For min_length/max_length: the length bound as a string integer. For pattern: the regex string. Unused for 'required'.")
7497
7540
  });
7498
- var fieldSchema = z17.object({
7499
- key: z17.string().max(200).describe("Field key, e.g. 'description', 'severity', 'status'"),
7500
- label: z17.string().max(200).describe("Display label, e.g. 'Description', 'Severity'"),
7501
- type: z17.string().max(50).describe("Field type: 'string', 'select', 'array', 'number', 'boolean'"),
7502
- required: z17.boolean().optional().describe("Whether this field is required"),
7503
- options: z17.array(z17.string().max(200)).max(200).optional().describe("Options for 'select' type fields"),
7504
- searchable: z17.boolean().optional().describe("Whether this field is included in full-text search"),
7505
- displayHint: z17.enum(["hero", "badge", "meta", "section", "hidden", "inline-meta"]).optional().describe("V2 rendering hint: how the field should be displayed in Cortex"),
7506
- zone: z17.enum(["header", "body", "meta"]).optional().describe("V2 layout zone: where the field appears in the entry view"),
7507
- colorMap: z17.record(z17.string().max(50)).optional().describe("V2 value-to-semantic-color mapping, e.g. { critical: 'danger', low: 'success' }"),
7541
+ var fieldSchema = z18.object({
7542
+ key: z18.string().max(200).describe("Field key, e.g. 'description', 'severity', 'status'"),
7543
+ label: z18.string().max(200).describe("Display label, e.g. 'Description', 'Severity'"),
7544
+ type: z18.string().max(50).describe("Field type: 'string', 'select', 'array', 'number', 'boolean'"),
7545
+ required: z18.boolean().optional().describe("Whether this field is required"),
7546
+ options: z18.array(z18.string().max(200)).max(200).optional().describe("Options for 'select' type fields"),
7547
+ searchable: z18.boolean().optional().describe("Whether this field is included in full-text search"),
7548
+ displayHint: z18.enum(["hero", "badge", "meta", "section", "hidden", "inline-meta"]).optional().describe("V2 rendering hint: how the field should be displayed in Cortex"),
7549
+ zone: z18.enum(["header", "body", "meta"]).optional().describe("V2 layout zone: where the field appears in the entry view"),
7550
+ colorMap: z18.record(z18.string().max(50)).optional().describe("V2 value-to-semantic-color mapping, e.g. { critical: 'danger', low: 'success' }"),
7508
7551
  // ENT-61
7509
- accentSource: z17.boolean().optional().describe("When true, this field's colorMap value drives the card-level accent styling"),
7552
+ accentSource: z18.boolean().optional().describe("When true, this field's colorMap value drives the card-level accent styling"),
7510
7553
  // ENT-61
7511
- iconMap: z17.record(z17.string(), z17.string().max(50)).optional().describe("Maps field values to icons (emoji/symbol), prepended to badge text"),
7512
- helpText: z17.string().max(2e3).optional().describe("Help text shown in editors and describe output"),
7513
- optionDescriptions: z17.record(z17.string().max(500)).optional().describe("Per-option guidance for select fields"),
7554
+ iconMap: z18.record(z18.string(), z18.string().max(50)).optional().describe("Maps field values to icons (emoji/symbol), prepended to badge text"),
7555
+ helpText: z18.string().max(2e3).optional().describe("Help text shown in editors and describe output"),
7556
+ optionDescriptions: z18.record(z18.string().max(500)).optional().describe("Per-option guidance for select fields"),
7514
7557
  // BET-136
7515
- semanticRole: z17.enum(["problem", "appetite", "elements", "architecture", "done_when", "risks", "exclusions"]).optional().describe("Semantic role for schema-driven consumers \u2014 enables field-key-independent validation and rendering"),
7558
+ semanticRole: z18.enum(["problem", "appetite", "elements", "architecture", "done_when", "risks", "exclusions"]).optional().describe("Semantic role for schema-driven consumers \u2014 enables field-key-independent validation and rendering"),
7516
7559
  // BET-196
7517
- maxLength: z17.number().optional().describe("Maximum character length for field values. Three-tier resolution: explicit > displayHint > type fallback."),
7560
+ maxLength: z18.number().optional().describe("Maximum character length for field values. Three-tier resolution: explicit > displayHint > type fallback."),
7518
7561
  // BET-196
7519
- minLength: z17.number().optional().describe("Minimum character length for field values. Only explicit \u2014 no defaults.")
7562
+ minLength: z18.number().optional().describe("Minimum character length for field values. Only explicit \u2014 no defaults.")
7520
7563
  });
7521
- var collectionsSchema = z17.object({
7522
- action: z17.enum(COLLECTIONS_ACTIONS).describe(
7564
+ var collectionsSchema = z18.object({
7565
+ action: z18.enum(COLLECTIONS_ACTIONS).describe(
7523
7566
  "'list': browse all collections. 'update': update an existing collection. 'describe': full documentation for one collection \u2014 fields, option guides, usage guidance, examples. 'audit': health report for all collections \u2014 missing classification, icon, displayHint coverage, and field schema gaps. 'export': full system_collection_definitions export with classification metadata (thinkingLayer, classificationPriority, classificationCheck, classificationSignals, governanceRole, governanceFunction, timelineRole, canBeElementOf, descriptionFieldKey). Admin only. 'label-list'/'label-create'/'label-update'/'label-delete'/'label-apply'/'label-remove': manage workspace labels (absorbs the `labels` tool). Creating a new collection is not offered here \u2014 ask a platform admin to provision it, or enable the module ontology pack that owns the drawer."
7524
7567
  ),
7525
- slug: z17.string().max(200).optional().describe("URL-safe identifier for create/update, e.g. 'glossary', 'tech-debt'. For label-*: label slug."),
7526
- name: z17.string().max(500).optional().describe("Display name for create, or new name for update. For label-create: label display name."),
7527
- description: z17.string().max(2e4).optional().describe("What this collection is for. For label-create/label-update: what the label means."),
7528
- purpose: z17.string().max(2e3).optional().describe("Why this collection exists \u2014 strategic reason"),
7529
- icon: z17.string().max(50).optional().describe("Emoji icon for the collection"),
7530
- navGroup: z17.enum(["daily", "strategic", "governance", "reference", "collections"]).optional().describe("Sidebar placement: 'daily', 'strategic', 'governance', 'reference', 'collections'"),
7531
- fields: z17.array(fieldSchema).max(200).optional().describe("Field definitions for create, or replacement schema for update (replaces all fields)"),
7532
- axis: z17.enum(["work", "none", "pending"]).optional().describe("REQUIRED for create: 'work' (needs stageLabelMap + validWorkflowStatuses), 'none', or 'pending'. For update: only settable on a non-system-stratum (custom) collection \u2014 the repair path for a legacy collection that predates the axis contract."),
7533
- stageLabelMap: z17.record(z17.string(), z17.enum(["open", "in_progress", "done", "stopped", "tag"])).optional().describe("Required when axis is 'work': maps each valid workflowStatus to a canonical stage."),
7568
+ slug: z18.string().max(200).optional().describe("URL-safe identifier for create/update, e.g. 'glossary', 'tech-debt'. For label-*: label slug."),
7569
+ name: z18.string().max(500).optional().describe("Display name for create, or new name for update. For label-create: label display name."),
7570
+ description: z18.string().max(2e4).optional().describe("What this collection is for. For label-create/label-update: what the label means."),
7571
+ purpose: z18.string().max(2e3).optional().describe("Why this collection exists \u2014 strategic reason"),
7572
+ icon: z18.string().max(50).optional().describe("Emoji icon for the collection"),
7573
+ navGroup: z18.enum(["daily", "strategic", "governance", "reference", "collections"]).optional().describe("Sidebar placement: 'daily', 'strategic', 'governance', 'reference', 'collections'"),
7574
+ fields: z18.array(fieldSchema).max(200).optional().describe("Field definitions for create, or replacement schema for update (replaces all fields)"),
7575
+ axis: z18.enum(["work", "none", "pending"]).optional().describe("REQUIRED for create: 'work' (needs stageLabelMap + validWorkflowStatuses), 'none', or 'pending'. For update: only settable on a non-system-stratum (custom) collection \u2014 the repair path for a legacy collection that predates the axis contract."),
7576
+ stageLabelMap: z18.record(z18.string(), z18.enum(["open", "in_progress", "done", "stopped", "tag"])).optional().describe("Required when axis is 'work': maps each valid workflowStatus to a canonical stage."),
7534
7577
  // ENT-62
7535
- defaultCanonicalKey: z17.string().max(200).optional().describe("The canonical_key entries in this collection default to (e.g. 'decision', 'insight'). Consumers read from collection doc; code map is fallback."),
7578
+ defaultCanonicalKey: z18.string().max(200).optional().describe("The canonical_key entries in this collection default to (e.g. 'decision', 'insight'). Consumers read from collection doc; code map is fallback."),
7536
7579
  // ENT-67
7537
- defaultWorkflowStatus: z17.string().max(200).optional().describe("Default workflowStatus for new entries. Must be in validWorkflowStatuses when set (e.g. 'hypothesis' for insights)."),
7580
+ defaultWorkflowStatus: z18.string().max(200).optional().describe("Default workflowStatus for new entries. Must be in validWorkflowStatuses when set (e.g. 'hypothesis' for insights)."),
7538
7581
  // ENT-65
7539
- validWorkflowStatuses: z17.array(z17.string().max(200)).max(50).optional().describe("The allowed workflowStatus values for entries in this collection. New entries are validated against this list. Empty array means no constraint."),
7582
+ validWorkflowStatuses: z18.array(z18.string().max(200)).max(50).optional().describe("The allowed workflowStatus values for entries in this collection. New entries are validated against this list. Empty array means no constraint."),
7540
7583
  // ENT-65, FEAT-200
7541
- classificationCheck: z17.string().max(500).optional().describe("LLM decision-tree check for this collection (3\u2013500 chars). Guides the classifier in routing entries here."),
7584
+ classificationCheck: z18.string().max(500).optional().describe("LLM decision-tree check for this collection (3\u2013500 chars). Guides the classifier in routing entries here."),
7542
7585
  // ENT-65, FEAT-200
7543
- classificationPriority: z17.number().optional().describe("Classifier priority (1\u20139, lower = higher priority). Used with classificationCheck to order the decision tree."),
7586
+ classificationPriority: z18.number().optional().describe("Classifier priority (1\u20139, lower = higher priority). Used with classificationCheck to order the decision tree."),
7544
7587
  // FEAT-301 Slice 2: quality gate criteria and usage guidance.
7545
7588
  // FEAT-257
7546
- qualityCriteria: z17.array(qualityCriterionSchema).max(50).optional().describe("Per-collection accept gate rules. 'required' rule hard-blocks accepts on empty fields; 'min_length'/'pattern' rules warn. Pass an empty array to clear all criteria."),
7547
- usageGuidance: z17.string().max(2e4).optional().describe("Plain-text guidance shown to agents and users: when to use this collection, when not to, and what makes a good entry."),
7589
+ qualityCriteria: z18.array(qualityCriterionSchema).max(50).optional().describe("Per-collection accept gate rules. 'required' rule hard-blocks accepts on empty fields; 'min_length'/'pattern' rules warn. Pass an empty array to clear all criteria."),
7590
+ usageGuidance: z18.string().max(2e4).optional().describe("Plain-text guidance shown to agents and users: when to use this collection, when not to, and what makes a good entry."),
7548
7591
  // For label-*
7549
- color: z17.string().max(50).optional().describe("For label-create/label-update: hex color, e.g. '#ef4444'."),
7550
- parentSlug: z17.string().max(200).optional().describe("For label-create: parent group slug for label hierarchy."),
7551
- isGroup: z17.boolean().optional().describe("For label-create/label-update: true if this is a group container, not a taggable label."),
7552
- order: z17.number().optional().describe("For label-create/label-update: sort order within its group."),
7553
- entryId: z17.string().max(200).optional().describe("For label-apply/label-remove: entry ID.")
7592
+ color: z18.string().max(50).optional().describe("For label-create/label-update: hex color, e.g. '#ef4444'."),
7593
+ parentSlug: z18.string().max(200).optional().describe("For label-create: parent group slug for label hierarchy."),
7594
+ isGroup: z18.boolean().optional().describe("For label-create/label-update: true if this is a group container, not a taggable label."),
7595
+ order: z18.number().optional().describe("For label-create/label-update: sort order within its group."),
7596
+ entryId: z18.string().max(200).optional().describe("For label-apply/label-remove: entry ID.")
7554
7597
  });
7555
- var collectionsListVariant = z17.object({ action: z17.literal("list") });
7556
- var collectionsDescribeVariant = z17.object({ action: z17.literal("describe"), slug: z17.string().max(200) });
7557
- var collectionsUpdateVariant = z17.object({
7558
- action: z17.literal("update"),
7559
- slug: z17.string().max(200),
7560
- name: z17.string().max(500).optional(),
7561
- description: z17.string().max(2e4).optional(),
7562
- purpose: z17.string().max(2e3).optional(),
7563
- icon: z17.string().max(50).optional(),
7564
- navGroup: z17.enum(["daily", "strategic", "governance", "reference", "collections"]).optional(),
7565
- fields: z17.array(fieldSchema).optional(),
7566
- axis: z17.enum(["work", "none", "pending"]).optional(),
7567
- stageLabelMap: z17.record(z17.string(), z17.enum(["open", "in_progress", "done", "stopped", "tag"])).optional(),
7598
+ var collectionsListVariant = z18.object({ action: z18.literal("list") });
7599
+ var collectionsDescribeVariant = z18.object({ action: z18.literal("describe"), slug: z18.string().max(200) });
7600
+ var collectionsUpdateVariant = z18.object({
7601
+ action: z18.literal("update"),
7602
+ slug: z18.string().max(200),
7603
+ name: z18.string().max(500).optional(),
7604
+ description: z18.string().max(2e4).optional(),
7605
+ purpose: z18.string().max(2e3).optional(),
7606
+ icon: z18.string().max(50).optional(),
7607
+ navGroup: z18.enum(["daily", "strategic", "governance", "reference", "collections"]).optional(),
7608
+ fields: z18.array(fieldSchema).optional(),
7609
+ axis: z18.enum(["work", "none", "pending"]).optional(),
7610
+ stageLabelMap: z18.record(z18.string(), z18.enum(["open", "in_progress", "done", "stopped", "tag"])).optional(),
7568
7611
  // WP-640 SWEEP (P1): axis/stageLabelMap repair legacy custom collections — see collections.ts's updateCollection.
7569
- defaultCanonicalKey: z17.string().max(200).optional(),
7570
- defaultWorkflowStatus: z17.string().max(200).optional(),
7571
- validWorkflowStatuses: z17.array(z17.string().max(200)).optional(),
7572
- classificationCheck: z17.string().max(500).optional(),
7573
- classificationPriority: z17.number().optional(),
7574
- qualityCriteria: z17.array(qualityCriterionSchema).optional(),
7575
- usageGuidance: z17.string().max(2e4).optional()
7612
+ defaultCanonicalKey: z18.string().max(200).optional(),
7613
+ defaultWorkflowStatus: z18.string().max(200).optional(),
7614
+ validWorkflowStatuses: z18.array(z18.string().max(200)).optional(),
7615
+ classificationCheck: z18.string().max(500).optional(),
7616
+ classificationPriority: z18.number().optional(),
7617
+ qualityCriteria: z18.array(qualityCriterionSchema).optional(),
7618
+ usageGuidance: z18.string().max(2e4).optional()
7576
7619
  });
7577
- var collectionsAuditVariant = z17.object({ action: z17.literal("audit") });
7578
- var collectionsExportVariant = z17.object({ action: z17.literal("export") });
7579
- var collectionsLabelListVariant = z17.object({ action: z17.literal("label-list") });
7580
- var collectionsLabelCreateVariant = z17.object({
7581
- action: z17.literal("label-create"),
7582
- slug: z17.string().max(200),
7583
- name: z17.string().max(500),
7584
- color: z17.string().max(50).optional(),
7585
- description: z17.string().max(2e3).optional(),
7586
- parentSlug: z17.string().max(200).optional(),
7587
- isGroup: z17.boolean().optional(),
7588
- order: z17.number().optional()
7620
+ var collectionsAuditVariant = z18.object({ action: z18.literal("audit") });
7621
+ var collectionsExportVariant = z18.object({ action: z18.literal("export") });
7622
+ var collectionsLabelListVariant = z18.object({ action: z18.literal("label-list") });
7623
+ var collectionsLabelCreateVariant = z18.object({
7624
+ action: z18.literal("label-create"),
7625
+ slug: z18.string().max(200),
7626
+ name: z18.string().max(500),
7627
+ color: z18.string().max(50).optional(),
7628
+ description: z18.string().max(2e3).optional(),
7629
+ parentSlug: z18.string().max(200).optional(),
7630
+ isGroup: z18.boolean().optional(),
7631
+ order: z18.number().optional()
7589
7632
  });
7590
- var collectionsLabelUpdateVariant = z17.object({
7591
- action: z17.literal("label-update"),
7592
- slug: z17.string().max(200),
7593
- name: z17.string().max(500).optional(),
7594
- color: z17.string().max(50).optional(),
7595
- description: z17.string().max(2e3).optional(),
7596
- isGroup: z17.boolean().optional(),
7597
- order: z17.number().optional()
7633
+ var collectionsLabelUpdateVariant = z18.object({
7634
+ action: z18.literal("label-update"),
7635
+ slug: z18.string().max(200),
7636
+ name: z18.string().max(500).optional(),
7637
+ color: z18.string().max(50).optional(),
7638
+ description: z18.string().max(2e3).optional(),
7639
+ isGroup: z18.boolean().optional(),
7640
+ order: z18.number().optional()
7598
7641
  });
7599
- var collectionsLabelDeleteVariant = z17.object({ action: z17.literal("label-delete"), slug: z17.string().max(200) });
7600
- var collectionsLabelApplyVariant = z17.object({ action: z17.literal("label-apply"), slug: z17.string().max(200), entryId: z17.string().max(200) });
7601
- var collectionsLabelRemoveVariant = z17.object({ action: z17.literal("label-remove"), slug: z17.string().max(200), entryId: z17.string().max(200) });
7602
- var collectionsActionUnion = z17.discriminatedUnion("action", [
7642
+ var collectionsLabelDeleteVariant = z18.object({ action: z18.literal("label-delete"), slug: z18.string().max(200) });
7643
+ var collectionsLabelApplyVariant = z18.object({ action: z18.literal("label-apply"), slug: z18.string().max(200), entryId: z18.string().max(200) });
7644
+ var collectionsLabelRemoveVariant = z18.object({ action: z18.literal("label-remove"), slug: z18.string().max(200), entryId: z18.string().max(200) });
7645
+ var collectionsActionUnion = z18.discriminatedUnion("action", [
7603
7646
  collectionsListVariant,
7604
7647
  collectionsDescribeVariant,
7605
7648
  collectionsUpdateVariant,
@@ -7901,7 +7944,7 @@ async function handleExport() {
7901
7944
  }
7902
7945
 
7903
7946
  // src/tools/orient.ts
7904
- import { z as z21 } from "zod/v3";
7947
+ import { z as z22 } from "zod/v3";
7905
7948
 
7906
7949
  // src/tools/planned-work.ts
7907
7950
  function buildPlannedWork(allEntries) {
@@ -8777,16 +8820,6 @@ function formatShapeAdvisorySummaryLine(sas) {
8777
8820
  return `Shape advisories (${sas.windowDays}d): ${sas.pendingCount} pending / ${sas.compoundTotal} compound${pendingRatePart} \u2014 precisionAgent ${agentPart}, precisionHuman ${humanPart}.${truncatedNote}${candidatePart}`;
8778
8821
  }
8779
8822
 
8780
- // src/lib/strip.ts
8781
- var ANSI_AND_CONTROL_RE = /\x1b\[[0-9;]*[A-Za-z]|\x1b\][^\x07]*\x07|\x1b[^[\]0-9;A-Za-z]?|[\x00-\x08\x0b-\x1f\x7f]/g;
8782
- function stripControlChars(str) {
8783
- if (!str) return str;
8784
- return str.replace(ANSI_AND_CONTROL_RE, "");
8785
- }
8786
- function sanitizeSingleLineField(str) {
8787
- return stripControlChars(str).replace(/\s+/g, " ").trim();
8788
- }
8789
-
8790
8823
  // src/tools/orient-rituals.ts
8791
8824
  var SPINE_UNAVAILABLE_LINE = "Spine check: unavailable \u2014 orient fetch failed, retry `orient`";
8792
8825
  function buildRitualsSurfaceLines(view, opts) {
@@ -8991,12 +9024,12 @@ function replaceVocabTokens(body, workspaceCtx, collectionCtxMap) {
8991
9024
  }
8992
9025
 
8993
9026
  // src/tools/start_pb.ts
8994
- import { z as z19 } from "zod/v3";
9027
+ import { z as z20 } from "zod/v3";
8995
9028
 
8996
9029
  // src/tools/skills.ts
8997
- import { z as z18 } from "zod/v3";
8998
- var skillsSchema = z18.object({
8999
- entryId: z18.string().min(1).describe(
9030
+ import { z as z19 } from "zod/v3";
9031
+ var skillsSchema = z19.object({
9032
+ entryId: z19.string().min(1).describe(
9000
9033
  "Workspace-scoped skill entry id (e.g. 'SKILL-pb-setup'). The tool refuses non-skill entries (canonicalKey !== 'skill') with INVALID_KIND."
9001
9034
  )
9002
9035
  });
@@ -9102,8 +9135,8 @@ function formatAdoptDiscoveryLine(display) {
9102
9135
  }
9103
9136
 
9104
9137
  // src/tools/start_pb.ts
9105
- var startPbSchema = z19.object({
9106
- task: z19.string().max(2e3).optional().describe(
9138
+ var startPbSchema = z20.object({
9139
+ task: z20.string().max(2e3).optional().describe(
9107
9140
  "What you're about to work on (e.g. 'implementing auth middleware'). Grounded/connected workspaces: filters governance to show relevant principles, standards, and business rules. Blank/seeded workspaces: ignored (setup flow takes over)."
9108
9141
  )
9109
9142
  // TEN-2431: no `scope` param — start_pb's governance matches orient's scope-BLIND RENDERED
@@ -9473,15 +9506,15 @@ ${FEEDBACK_SUBMIT_HINT}` }],
9473
9506
  }
9474
9507
 
9475
9508
  // src/tools/record_activation.ts
9476
- import { z as z20 } from "zod/v3";
9477
- var recordActivationSchema = z20.object({
9478
- confirmedEntryCount: z20.number().int().min(0).describe(
9509
+ import { z as z21 } from "zod/v3";
9510
+ var recordActivationSchema = z21.object({
9511
+ confirmedEntryCount: z21.number().int().min(0).describe(
9479
9512
  "Confirmed-entry count from the Phase 4 capture loop. The mutation enforces >=10."
9480
9513
  ),
9481
- entriesAcrossCollections: z20.number().int().min(0).describe(
9514
+ entriesAcrossCollections: z21.number().int().min(0).describe(
9482
9515
  "Number of distinct collections those entries span. The mutation enforces >=2 (diversity soft-gate)."
9483
9516
  ),
9484
- retrievalDemoConfirmed: z20.boolean().describe(
9517
+ retrievalDemoConfirmed: z21.boolean().describe(
9485
9518
  "True if the retrieval round-trip ran successfully in Phase 4. The mutation rejects false."
9486
9519
  )
9487
9520
  });
@@ -9554,65 +9587,65 @@ async function markOrientedWithSnapshotFallback(agentSessionId, coherenceSnapsho
9554
9587
  }
9555
9588
  }
9556
9589
  var ORIENT_ACTIONS = ["start", "task", "record-activation"];
9557
- var orientSchema = z21.object({
9558
- action: z21.enum(ORIENT_ACTIONS).optional().default("task").describe(
9590
+ var orientSchema = z22.object({
9591
+ action: z22.enum(ORIENT_ACTIONS).optional().default("task").describe(
9559
9592
  "'start': universal session opener (absorbs start_pb) \u2014 stage-aware setup skill or standup briefing. 'task': task-grounded context loader \u2014 the original orient behavior. 'record-activation': chat-only activation receipt writer (absorbs record_activation)."
9560
9593
  ),
9561
- mode: z21.enum(["full", "brief"]).optional().default("full").describe("For 'task': full = full context (default). brief = compact summary for mid-session re-orientation. Prefer using the `tier` param for depth control."),
9562
- tier: z21.enum(["summary", "standard", "full"]).optional().describe(
9594
+ mode: z22.enum(["full", "brief"]).optional().default("full").describe("For 'task': full = full context (default). brief = compact summary for mid-session re-orientation. Prefer using the `tier` param for depth control."),
9595
+ tier: z22.enum(["summary", "standard", "full"]).optional().describe(
9563
9596
  "For 'task': payload depth. Defaults to summary (~10 KB) when task is provided; standard (~256 KB) when task is absent. Pass summary, standard, or full to override."
9564
9597
  ),
9565
- task: z21.string().max(2e3).optional().describe(
9598
+ task: z22.string().max(2e3).optional().describe(
9566
9599
  "For 'task': natural-language task description for task-scoped context. For 'start': what you're about to work on. When provided to 'task', orient returns scored, relevant entries for the task."
9567
9600
  ),
9568
- scope: z21.string().max(200).optional().describe("For 'task': optional domain scope to filter governance to entries relevant for this domain. Forwarded to Convex for workspace-specific validation."),
9601
+ scope: z22.string().max(200).optional().describe("For 'task': optional domain scope to filter governance to entries relevant for this domain. Forwarded to Convex for workspace-specific validation."),
9569
9602
  // WP-486 Slice 1 (FEAT-1371, TEN-2724): the startup-signal envelope `resolveStartupDomain` already
9570
9603
  // consumes (`startupResolver.ts:344-379`) but this tool never sent. Nested to match the server's
9571
9604
  // `StartupResolutionSignals` shape exactly — every field optional, sanitized server-side.
9572
- startupSignals: z21.object({
9573
- changedPaths: z21.array(z21.string()).max(25).optional().describe("Paths changed in the current working tree, if known (e.g. from a prior git status/diff tool call)."),
9574
- reviewedArtifactRefs: z21.array(z21.string()).max(25).optional().describe("Chain entry IDs the caller has already reviewed this session, if tracked."),
9575
- branchName: z21.string().max(120).optional().describe("Current git branch name, if known."),
9576
- worktreeName: z21.string().max(120).optional().describe("Current worktree/directory name, if known.")
9605
+ startupSignals: z22.object({
9606
+ changedPaths: z22.array(z22.string()).max(25).optional().describe("Paths changed in the current working tree, if known (e.g. from a prior git status/diff tool call)."),
9607
+ reviewedArtifactRefs: z22.array(z22.string()).max(25).optional().describe("Chain entry IDs the caller has already reviewed this session, if tracked."),
9608
+ branchName: z22.string().max(120).optional().describe("Current git branch name, if known."),
9609
+ worktreeName: z22.string().max(120).optional().describe("Current worktree/directory name, if known.")
9577
9610
  }).optional().describe("For 'task': best-effort startup signals for domain resolution \u2014 changedPaths/reviewedArtifactRefs/branchName/worktreeName. All optional; omit fields you don't know."),
9578
- invocationPath: z21.enum(["session-start", "session-close", "manual-orient", "handshake", "unknown"]).optional().describe("For 'task': how this orient was invoked. Defaults to 'manual-orient' (the direct `orient task=...` call shape) when omitted."),
9579
- confirmedEntryCount: z21.number().int().min(0).optional().describe(
9611
+ invocationPath: z22.enum(["session-start", "session-close", "manual-orient", "handshake", "unknown"]).optional().describe("For 'task': how this orient was invoked. Defaults to 'manual-orient' (the direct `orient task=...` call shape) when omitted."),
9612
+ confirmedEntryCount: z22.number().int().min(0).optional().describe(
9580
9613
  "For 'record-activation': confirmed-entry count from the Phase 4 capture loop. The mutation enforces >=10."
9581
9614
  ),
9582
- entriesAcrossCollections: z21.number().int().min(0).optional().describe(
9615
+ entriesAcrossCollections: z22.number().int().min(0).optional().describe(
9583
9616
  "For 'record-activation': number of distinct collections those entries span. The mutation enforces >=2 (diversity soft-gate)."
9584
9617
  ),
9585
- retrievalDemoConfirmed: z21.boolean().optional().describe(
9618
+ retrievalDemoConfirmed: z22.boolean().optional().describe(
9586
9619
  "For 'record-activation': true if the retrieval round-trip ran successfully in Phase 4. The mutation rejects false."
9587
9620
  )
9588
9621
  });
9589
- var orientStartVariant = z21.object({
9590
- action: z21.literal("start"),
9591
- task: z21.string().max(2e3).optional()
9622
+ var orientStartVariant = z22.object({
9623
+ action: z22.literal("start"),
9624
+ task: z22.string().max(2e3).optional()
9592
9625
  });
9593
- var orientTaskVariant = z21.object({
9594
- action: z21.literal("task"),
9595
- mode: z21.enum(["full", "brief"]).optional().default("full"),
9596
- tier: z21.enum(["summary", "standard", "full"]).optional(),
9597
- task: z21.string().max(2e3).optional(),
9598
- scope: z21.string().max(200).optional(),
9626
+ var orientTaskVariant = z22.object({
9627
+ action: z22.literal("task"),
9628
+ mode: z22.enum(["full", "brief"]).optional().default("full"),
9629
+ tier: z22.enum(["summary", "standard", "full"]).optional(),
9630
+ task: z22.string().max(2e3).optional(),
9631
+ scope: z22.string().max(200).optional(),
9599
9632
  // WP-486 Slice 1 (FEAT-1371) — mirrors orientSchema's top-level declaration above; see its
9600
9633
  // doc comment for the shape rationale.
9601
- startupSignals: z21.object({
9602
- changedPaths: z21.array(z21.string()).max(25).optional(),
9603
- reviewedArtifactRefs: z21.array(z21.string()).max(25).optional(),
9604
- branchName: z21.string().max(120).optional(),
9605
- worktreeName: z21.string().max(120).optional()
9634
+ startupSignals: z22.object({
9635
+ changedPaths: z22.array(z22.string()).max(25).optional(),
9636
+ reviewedArtifactRefs: z22.array(z22.string()).max(25).optional(),
9637
+ branchName: z22.string().max(120).optional(),
9638
+ worktreeName: z22.string().max(120).optional()
9606
9639
  }).optional(),
9607
- invocationPath: z21.enum(["session-start", "session-close", "manual-orient", "handshake", "unknown"]).optional()
9640
+ invocationPath: z22.enum(["session-start", "session-close", "manual-orient", "handshake", "unknown"]).optional()
9608
9641
  });
9609
- var orientRecordActivationVariant = z21.object({
9610
- action: z21.literal("record-activation"),
9611
- confirmedEntryCount: z21.number().int().min(0),
9612
- entriesAcrossCollections: z21.number().int().min(0),
9613
- retrievalDemoConfirmed: z21.boolean()
9642
+ var orientRecordActivationVariant = z22.object({
9643
+ action: z22.literal("record-activation"),
9644
+ confirmedEntryCount: z22.number().int().min(0),
9645
+ entriesAcrossCollections: z22.number().int().min(0),
9646
+ retrievalDemoConfirmed: z22.boolean()
9614
9647
  });
9615
- var orientActionUnion = z21.discriminatedUnion("action", [
9648
+ var orientActionUnion = z22.discriminatedUnion("action", [
9616
9649
  orientStartVariant,
9617
9650
  orientTaskVariant,
9618
9651
  orientRecordActivationVariant
@@ -10460,7 +10493,7 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
10460
10493
  }
10461
10494
 
10462
10495
  // src/tools/workflows.ts
10463
- import { z as z22 } from "zod/v3";
10496
+ import { z as z23 } from "zod/v3";
10464
10497
 
10465
10498
  // src/workflows/descriptor.ts
10466
10499
  function cloneWorkflowQuestion(question) {
@@ -11301,75 +11334,75 @@ function workflowRunOutputToText(output) {
11301
11334
 
11302
11335
  // src/tools/workflows.ts
11303
11336
  var WORKFLOWS_ACTIONS = ["list", "start", "checkpoint", "get-run", "load-skill"];
11304
- var jsonValueSchema = z22.lazy(
11305
- () => z22.union([
11306
- z22.string(),
11307
- z22.number(),
11308
- z22.boolean(),
11309
- z22.null(),
11310
- z22.array(jsonValueSchema),
11311
- z22.record(jsonValueSchema)
11337
+ var jsonValueSchema = z23.lazy(
11338
+ () => z23.union([
11339
+ z23.string(),
11340
+ z23.number(),
11341
+ z23.boolean(),
11342
+ z23.null(),
11343
+ z23.array(jsonValueSchema),
11344
+ z23.record(jsonValueSchema)
11312
11345
  ])
11313
11346
  );
11314
- var workflowRunOutputInputSchema = z22.union([
11315
- z22.object({
11316
- format: z22.literal("freetext"),
11317
- value: z22.string()
11347
+ var workflowRunOutputInputSchema = z23.union([
11348
+ z23.object({
11349
+ format: z23.literal("freetext"),
11350
+ value: z23.string()
11318
11351
  }),
11319
- z22.object({
11320
- format: z22.literal("list"),
11321
- value: z22.array(z22.string())
11352
+ z23.object({
11353
+ format: z23.literal("list"),
11354
+ value: z23.array(z23.string())
11322
11355
  }),
11323
- z22.object({
11324
- format: z22.literal("choice"),
11325
- value: z22.union([z22.string(), z22.array(z22.string())])
11356
+ z23.object({
11357
+ format: z23.literal("choice"),
11358
+ value: z23.union([z23.string(), z23.array(z23.string())])
11326
11359
  }),
11327
- z22.object({
11328
- format: z22.literal("structured"),
11360
+ z23.object({
11361
+ format: z23.literal("structured"),
11329
11362
  value: jsonValueSchema
11330
11363
  })
11331
11364
  ]);
11332
- var workflowsSchema = z22.object({
11333
- action: z22.enum(WORKFLOWS_ACTIONS).describe(
11365
+ var workflowsSchema = z23.object({
11366
+ action: z23.enum(WORKFLOWS_ACTIONS).describe(
11334
11367
  "'list': browse available workflows. 'start': start or resume a workflow \u2014 returns first (or current) round and next-step checkpoint call. 'checkpoint': record round output or final summary. 'get-run': inspect a persisted workflow run. 'load-skill': load the markdown body of a SKILL-* entry from the workspace (absorbs the `skills` tool). Requires entryId."
11335
11368
  ),
11336
- workflowId: z22.string().max(200).optional().describe("Workflow ID for start, checkpoint, or get-run, e.g. 'retro', 'implementation-review'"),
11337
- runId: z22.string().max(200).optional().describe("Workflow run ID: for get-run, which run to load; for checkpoint, target this run (avoids session drift \u2014 pass runId from get-run)."),
11338
- roundId: z22.string().max(200).optional().describe("Round ID for checkpoint, e.g. 'what-went-well'"),
11339
- output: z22.union([z22.string(), workflowRunOutputInputSchema]).optional().describe("The round's output \u2014 either legacy synthesized text or a typed workflow run payload."),
11340
- isFinal: z22.boolean().optional().describe("If true, finalize an existing durable workflow run from its terminal round and create the summary chain entry."),
11341
- restart: z22.boolean().optional().describe("If true, start a new durable run from the workflow's first round in the current session."),
11342
- summaryName: z22.string().max(500).optional().describe("Optional name for final chain entry. If omitted, the workflow summary template is used."),
11343
- summaryDescription: z22.string().max(2e4).optional().describe("Optional override for the final chain entry description. Defaults to the final round output text."),
11344
- summaryEntryId: z22.string().max(200).optional().describe("Link an existing entry as the run's summary instead of creating one. Used by facilitated workflows (e.g. shape) where the primary record is created by the specialized tool."),
11345
- entryId: z22.string().max(200).optional().describe("For 'load-skill': workspace-scoped skill entry id (e.g. 'SKILL-pb-setup'). Refuses non-skill entries (canonicalKey !== 'skill') with INVALID_KIND."),
11369
+ workflowId: z23.string().max(200).optional().describe("Workflow ID for start, checkpoint, or get-run, e.g. 'retro', 'implementation-review'"),
11370
+ runId: z23.string().max(200).optional().describe("Workflow run ID: for get-run, which run to load; for checkpoint, target this run (avoids session drift \u2014 pass runId from get-run)."),
11371
+ roundId: z23.string().max(200).optional().describe("Round ID for checkpoint, e.g. 'what-went-well'"),
11372
+ output: z23.union([z23.string(), workflowRunOutputInputSchema]).optional().describe("The round's output \u2014 either legacy synthesized text or a typed workflow run payload."),
11373
+ isFinal: z23.boolean().optional().describe("If true, finalize an existing durable workflow run from its terminal round and create the summary chain entry."),
11374
+ restart: z23.boolean().optional().describe("If true, start a new durable run from the workflow's first round in the current session."),
11375
+ summaryName: z23.string().max(500).optional().describe("Optional name for final chain entry. If omitted, the workflow summary template is used."),
11376
+ summaryDescription: z23.string().max(2e4).optional().describe("Optional override for the final chain entry description. Defaults to the final round output text."),
11377
+ summaryEntryId: z23.string().max(200).optional().describe("Link an existing entry as the run's summary instead of creating one. Used by facilitated workflows (e.g. shape) where the primary record is created by the specialized tool."),
11378
+ entryId: z23.string().max(200).optional().describe("For 'load-skill': workspace-scoped skill entry id (e.g. 'SKILL-pb-setup'). Refuses non-skill entries (canonicalKey !== 'skill') with INVALID_KIND."),
11346
11379
  // WP-513: team+role to create the finalize summary AS OWNER of (rung 2 only).
11347
- ownerTeamEntryId: z22.string().max(200).optional().describe("For 'checkpoint' (isFinal): owning team (rung-2)."),
11348
- ownerRoleEntryId: z22.string().max(200).optional().describe("For 'checkpoint' (isFinal): owning role (rung-2).")
11380
+ ownerTeamEntryId: z23.string().max(200).optional().describe("For 'checkpoint' (isFinal): owning team (rung-2)."),
11381
+ ownerRoleEntryId: z23.string().max(200).optional().describe("For 'checkpoint' (isFinal): owning role (rung-2).")
11349
11382
  });
11350
- var workflowsListVariant = z22.object({ action: z22.literal("list") });
11351
- var workflowsGetRunVariant = z22.object({
11352
- action: z22.literal("get-run"),
11353
- runId: z22.string().max(200).optional(),
11354
- workflowId: z22.string().max(200).optional()
11383
+ var workflowsListVariant = z23.object({ action: z23.literal("list") });
11384
+ var workflowsGetRunVariant = z23.object({
11385
+ action: z23.literal("get-run"),
11386
+ runId: z23.string().max(200).optional(),
11387
+ workflowId: z23.string().max(200).optional()
11355
11388
  });
11356
- var workflowsStartVariant = z22.object({ action: z22.literal("start"), workflowId: z22.string().max(200) });
11357
- var workflowsCheckpointVariant = z22.object({
11358
- action: z22.literal("checkpoint"),
11359
- workflowId: z22.string().max(200),
11360
- roundId: z22.string().max(200),
11361
- output: z22.union([z22.string(), workflowRunOutputInputSchema]),
11362
- isFinal: z22.boolean().optional(),
11363
- restart: z22.boolean().optional(),
11364
- summaryName: z22.string().max(500).optional(),
11365
- summaryDescription: z22.string().max(2e4).optional(),
11366
- summaryEntryId: z22.string().max(200).optional(),
11367
- runId: z22.string().max(200).optional(),
11368
- ownerTeamEntryId: z22.string().max(200).optional(),
11369
- ownerRoleEntryId: z22.string().max(200).optional()
11389
+ var workflowsStartVariant = z23.object({ action: z23.literal("start"), workflowId: z23.string().max(200) });
11390
+ var workflowsCheckpointVariant = z23.object({
11391
+ action: z23.literal("checkpoint"),
11392
+ workflowId: z23.string().max(200),
11393
+ roundId: z23.string().max(200),
11394
+ output: z23.union([z23.string(), workflowRunOutputInputSchema]),
11395
+ isFinal: z23.boolean().optional(),
11396
+ restart: z23.boolean().optional(),
11397
+ summaryName: z23.string().max(500).optional(),
11398
+ summaryDescription: z23.string().max(2e4).optional(),
11399
+ summaryEntryId: z23.string().max(200).optional(),
11400
+ runId: z23.string().max(200).optional(),
11401
+ ownerTeamEntryId: z23.string().max(200).optional(),
11402
+ ownerRoleEntryId: z23.string().max(200).optional()
11370
11403
  });
11371
- var workflowsLoadSkillVariant = z22.object({ action: z22.literal("load-skill"), entryId: z22.string().max(200).min(1) });
11372
- var workflowsActionUnion = z22.discriminatedUnion("action", [
11404
+ var workflowsLoadSkillVariant = z23.object({ action: z23.literal("load-skill"), entryId: z23.string().max(200).min(1) });
11405
+ var workflowsActionUnion = z23.discriminatedUnion("action", [
11373
11406
  workflowsListVariant,
11374
11407
  workflowsGetRunVariant,
11375
11408
  workflowsStartVariant,
@@ -12109,10 +12142,10 @@ function parseListOutput(output) {
12109
12142
  }
12110
12143
 
12111
12144
  // src/tools/quality.ts
12112
- import { z as z24 } from "zod/v3";
12145
+ import { z as z25 } from "zod/v3";
12113
12146
 
12114
12147
  // src/tools/audit.ts
12115
- import { z as z23 } from "zod/v3";
12148
+ import { z as z24 } from "zod/v3";
12116
12149
  var VOCAB_TTL_MS = 5 * 60 * 1e3;
12117
12150
  var MAX_VOCAB_KEYS = 100;
12118
12151
  var vocabCache = /* @__PURE__ */ new Map();
@@ -12142,12 +12175,12 @@ function evictVocabIfFull() {
12142
12175
  }
12143
12176
  }
12144
12177
  var AUDIT_ACTIONS = ["run"];
12145
- var auditSchema = z23.object({
12146
- action: z23.enum(AUDIT_ACTIONS).describe(
12178
+ var auditSchema = z24.object({
12179
+ action: z24.enum(AUDIT_ACTIONS).describe(
12147
12180
  "'run': run the hygiene audit for a work package entry."
12148
12181
  ),
12149
- entryId: z23.string().describe("Work package entry ID to audit, e.g. '<PREFIX>-<n>'"),
12150
- phase: z23.enum(["shaping", "handoff"]).default("shaping").optional().describe(
12182
+ entryId: z24.string().describe("Work package entry ID to audit, e.g. '<PREFIX>-<n>'"),
12183
+ phase: z24.enum(["shaping", "handoff"]).default("shaping").optional().describe(
12151
12184
  "'shaping': check shaping-phase fields only. 'handoff': check all required fields including buildContract/buildSequence/exclusions/risks. Default: shaping."
12152
12185
  )
12153
12186
  });
@@ -12418,44 +12451,44 @@ async function handleSpineCheck(story, refresh = false) {
12418
12451
 
12419
12452
  // src/tools/quality.ts
12420
12453
  var QUALITY_ACTIONS = ["check", "re-evaluate", "verify-chain", "audit", "spine-check"];
12421
- var qualitySchema = z24.object({
12422
- action: z24.enum(QUALITY_ACTIONS).describe(
12454
+ var qualitySchema = z25.object({
12455
+ action: z25.enum(QUALITY_ACTIONS).describe(
12423
12456
  "'check': read the entry's server quality verdict (tier + criteria). 're-evaluate': trigger fresh evaluation. 'verify-chain': verify entries against the codebase (codeMapping drift, cross-references) \u2014 absorbs `verify`. 'audit': hygiene audit for a work package entry \u2014 absorbs `audit`. 'spine-check': structural completeness of the purpose+vision+strategy spine \u2014 story:true also runs the on-demand one-story judgment."
12424
12457
  ),
12425
- entryId: z24.string().max(200).optional().describe("For 'check'/'re-evaluate'/'audit': entry ID, e.g. 'TEN-graph-db', '<PREFIX>-<n>'."),
12426
- context: z24.enum(["capture", "commit", "review"]).default("review").optional().describe("For re-evaluate: evaluation context"),
12427
- collection: z24.string().max(200).optional().describe("For 'verify-chain': collection slug to verify (default: glossary)."),
12428
- mode: z24.enum(["report", "fix"]).optional().describe("For 'verify-chain': 'report' = read-only trust report (default). 'fix' = also update drifted codeMapping statuses."),
12429
- phase: z24.enum(["shaping", "handoff"]).optional().describe(
12458
+ entryId: z25.string().max(200).optional().describe("For 'check'/'re-evaluate'/'audit': entry ID, e.g. 'TEN-graph-db', '<PREFIX>-<n>'."),
12459
+ context: z25.enum(["capture", "commit", "review"]).default("review").optional().describe("For re-evaluate: evaluation context"),
12460
+ collection: z25.string().max(200).optional().describe("For 'verify-chain': collection slug to verify (default: glossary)."),
12461
+ mode: z25.enum(["report", "fix"]).optional().describe("For 'verify-chain': 'report' = read-only trust report (default). 'fix' = also update drifted codeMapping statuses."),
12462
+ phase: z25.enum(["shaping", "handoff"]).optional().describe(
12430
12463
  "For 'audit': 'shaping' checks shaping-phase fields only (default). 'handoff' checks all required fields including buildContract/buildSequence/exclusions/risks."
12431
12464
  ),
12432
- story: z24.boolean().optional().describe("For 'spine-check': also run the on-demand one-story LLM judgment (never scheduled; result labelled [unvalidated])."),
12433
- refresh: z24.boolean().optional().describe(
12465
+ story: z25.boolean().optional().describe("For 'spine-check': also run the on-demand one-story LLM judgment (never scheduled; result labelled [unvalidated])."),
12466
+ refresh: z25.boolean().optional().describe(
12434
12467
  "For 'spine-check': force a new run even if a fresh verdict already exists. Default false \u2014 a plain call NEVER re-triggers work just to read the last result; it auto-schedules only when no run is already in flight AND the stored verdict is absent/stale/missing the requested story pass."
12435
12468
  )
12436
12469
  });
12437
- var qualityCheckVariant = z24.object({ action: z24.literal("check"), entryId: z24.string().max(200) });
12438
- var qualityReEvaluateVariant = z24.object({
12439
- action: z24.literal("re-evaluate"),
12440
- entryId: z24.string().max(200),
12441
- context: z24.enum(["capture", "commit", "review"]).optional().default("review")
12470
+ var qualityCheckVariant = z25.object({ action: z25.literal("check"), entryId: z25.string().max(200) });
12471
+ var qualityReEvaluateVariant = z25.object({
12472
+ action: z25.literal("re-evaluate"),
12473
+ entryId: z25.string().max(200),
12474
+ context: z25.enum(["capture", "commit", "review"]).optional().default("review")
12442
12475
  });
12443
- var qualityVerifyChainVariant = z24.object({
12444
- action: z24.literal("verify-chain"),
12445
- collection: z24.string().max(200).optional().default("glossary"),
12446
- mode: z24.enum(["report", "fix"]).optional().default("report")
12476
+ var qualityVerifyChainVariant = z25.object({
12477
+ action: z25.literal("verify-chain"),
12478
+ collection: z25.string().max(200).optional().default("glossary"),
12479
+ mode: z25.enum(["report", "fix"]).optional().default("report")
12447
12480
  });
12448
- var qualityAuditVariant = z24.object({
12449
- action: z24.literal("audit"),
12450
- entryId: z24.string().max(200),
12451
- phase: z24.enum(["shaping", "handoff"]).optional().default("shaping")
12481
+ var qualityAuditVariant = z25.object({
12482
+ action: z25.literal("audit"),
12483
+ entryId: z25.string().max(200),
12484
+ phase: z25.enum(["shaping", "handoff"]).optional().default("shaping")
12452
12485
  });
12453
- var qualitySpineCheckVariant = z24.object({
12454
- action: z24.literal("spine-check"),
12455
- story: z24.boolean().optional().default(false),
12456
- refresh: z24.boolean().optional().default(false)
12486
+ var qualitySpineCheckVariant = z25.object({
12487
+ action: z25.literal("spine-check"),
12488
+ story: z25.boolean().optional().default(false),
12489
+ refresh: z25.boolean().optional().default(false)
12457
12490
  });
12458
- var qualityActionUnion = z24.discriminatedUnion("action", [
12491
+ var qualityActionUnion = z25.discriminatedUnion("action", [
12459
12492
  qualityCheckVariant,
12460
12493
  qualityReEvaluateVariant,
12461
12494
  qualityVerifyChainVariant,
@@ -12469,39 +12502,39 @@ var QUALITY_ACTION_SPECS = {
12469
12502
  audit: { params: ["entryId", "phase"], description: "entryId is required." },
12470
12503
  "spine-check": { params: ["story", "refresh"], description: "All params optional; story and refresh default to false \u2014 a plain call never re-triggers work, it just reads back the latest verdict (auto-refreshing only when stale/absent)." }
12471
12504
  };
12472
- var qualityCheckOutputSchema = z24.object({
12473
- entryId: z24.string(),
12505
+ var qualityCheckOutputSchema = z25.object({
12506
+ entryId: z25.string(),
12474
12507
  /** WP-480 S1: false = the ID does not resolve to an entry (typo/deleted) — distinct from "no verdict yet". */
12475
- entryFound: z24.boolean().optional(),
12476
- hasVerdict: z24.boolean(),
12508
+ entryFound: z25.boolean().optional(),
12509
+ hasVerdict: z25.boolean(),
12477
12510
  /** WP-480 S1: the verdict was judged against content the entry no longer has — re-evaluate for a current one. */
12478
- stale: z24.boolean().optional(),
12479
- tier: z24.string().optional(),
12480
- passed: z24.boolean().optional(),
12481
- criteria: z24.array(z24.object({
12482
- id: z24.string(),
12483
- passed: z24.boolean(),
12484
- hint: z24.string().optional()
12511
+ stale: z25.boolean().optional(),
12512
+ tier: z25.string().optional(),
12513
+ passed: z25.boolean().optional(),
12514
+ criteria: z25.array(z25.object({
12515
+ id: z25.string(),
12516
+ passed: z25.boolean(),
12517
+ hint: z25.string().optional()
12485
12518
  }))
12486
12519
  });
12487
- var qualityReevaluateOutputSchema = z24.object({
12488
- entryId: z24.string(),
12489
- context: z24.string(),
12490
- score: z24.number(),
12491
- maxScore: z24.number(),
12492
- improved: z24.boolean()
12520
+ var qualityReevaluateOutputSchema = z25.object({
12521
+ entryId: z25.string(),
12522
+ context: z25.string(),
12523
+ score: z25.number(),
12524
+ maxScore: z25.number(),
12525
+ improved: z25.boolean()
12493
12526
  });
12494
- var qualitySpineCheckOutputSchema = z24.object({
12495
- hasVerdict: z24.boolean(),
12496
- noSpineEntries: z24.boolean().optional(),
12497
- structuralPassed: z24.boolean().optional(),
12498
- storyPassed: z24.boolean().nullable().optional(),
12499
- stale: z24.boolean().optional(),
12527
+ var qualitySpineCheckOutputSchema = z25.object({
12528
+ hasVerdict: z25.boolean(),
12529
+ noSpineEntries: z25.boolean().optional(),
12530
+ structuralPassed: z25.boolean().optional(),
12531
+ storyPassed: z25.boolean().nullable().optional(),
12532
+ stale: z25.boolean().optional(),
12500
12533
  // TASK-156: a capped membership scan must stay distinguishable from a complete one, and a
12501
12534
  // malformed verdict needs its own discriminator — both were silently stripped before this.
12502
- staleMemberIds: z24.array(z24.string()).optional(),
12503
- membershipTruncated: z24.boolean().optional(),
12504
- malformed: z24.boolean().optional()
12535
+ staleMemberIds: z25.array(z25.string()).optional(),
12536
+ membershipTruncated: z25.boolean().optional(),
12537
+ malformed: z25.boolean().optional()
12505
12538
  });
12506
12539
  function registerQualityTools(server) {
12507
12540
  const qualityHandlers = {
@@ -12683,10 +12716,10 @@ async function handleReEvaluate(entryId, context) {
12683
12716
  }
12684
12717
 
12685
12718
  // src/tools/session.ts
12686
- import { z as z27 } from "zod/v3";
12719
+ import { z as z28 } from "zod/v3";
12687
12720
 
12688
12721
  // src/tools/wrapup.ts
12689
- import { z as z25 } from "zod/v3";
12722
+ import { z as z26 } from "zod/v3";
12690
12723
 
12691
12724
  // src/lib/compose-wrapup-view.ts
12692
12725
  function toComposed(e) {
@@ -13140,8 +13173,8 @@ async function runWrapupCommitAll(data, cachedSuggestions) {
13140
13173
  overflowUnscanned
13141
13174
  };
13142
13175
  }
13143
- var wrapupSchema = z25.object({
13144
- action: z25.enum(["review", "commit-all"]).optional().describe(
13176
+ var wrapupSchema = z26.object({
13177
+ action: z26.enum(["review", "commit-all"]).optional().describe(
13145
13178
  "Action to perform. 'review' (default) shows the wrapup summary. 'commit-all' accepts all uncommitted drafts and creates suggested links."
13146
13179
  )
13147
13180
  });
@@ -13242,26 +13275,26 @@ ${text}` : text;
13242
13275
  }
13243
13276
 
13244
13277
  // src/tools/facilitate.ts
13245
- import { z as z26 } from "zod/v3";
13278
+ import { z as z27 } from "zod/v3";
13246
13279
  var FACILITATE_ACTIONS = ["resume", "commit-constellation"];
13247
- var coherencyAcknowledgementSchema = z26.object({
13248
- response: z26.string().max(200).describe("Acknowledgement response per offender: 'linked' | 'accepted-fix' | 'diverged'."),
13249
- entryId: z26.string().max(200).optional().describe("Entry the acknowledgement links to (e.g. the strategic spine entry)."),
13250
- reason: z26.string().max(2e3).optional().describe("Free-text justification, required for a 'diverged' response."),
13251
- subjectEntryId: z26.string().max(200).optional().describe("The refused entry this acknowledgement answers.")
13280
+ var coherencyAcknowledgementSchema = z27.object({
13281
+ response: z27.string().max(200).describe("Acknowledgement response per offender: 'linked' | 'accepted-fix' | 'diverged'."),
13282
+ entryId: z27.string().max(200).optional().describe("Entry the acknowledgement links to (e.g. the strategic spine entry)."),
13283
+ reason: z27.string().max(2e3).optional().describe("Free-text justification, required for a 'diverged' response."),
13284
+ subjectEntryId: z27.string().max(200).optional().describe("The refused entry this acknowledgement answers.")
13252
13285
  });
13253
- var facilitateSchema = z26.object({
13254
- action: z26.enum(FACILITATE_ACTIONS).describe(
13286
+ var facilitateSchema = z27.object({
13287
+ action: z27.enum(FACILITATE_ACTIONS).describe(
13255
13288
  "'resume': load session state from an existing bet entry. 'commit-constellation': atomically accept a bet and all its linked draft entries in one call. Requires betEntryId."
13256
13289
  ),
13257
- betEntryId: z26.string().max(200).optional().describe("Bet entry ID. Required for both actions."),
13258
- operationId: z26.string().max(200).optional().describe("Optional idempotency key for commit-constellation retries."),
13290
+ betEntryId: z27.string().max(200).optional().describe("Bet entry ID. Required for both actions."),
13291
+ operationId: z27.string().max(200).optional().describe("Optional idempotency key for commit-constellation retries."),
13259
13292
  // WP-465 slice ⑤: coherency retry controls for a COHERENCY_REFUSED constellation hold.
13260
13293
  // Forwarded verbatim to agentKnowledge.facilitateEnvelope (validation lives at the gate).
13261
- coherencyAcknowledgements: z26.array(coherencyAcknowledgementSchema).max(20).optional().describe(
13294
+ coherencyAcknowledgements: z27.array(coherencyAcknowledgementSchema).max(20).optional().describe(
13262
13295
  "Per-offender acknowledgements to retry a constellation held under standard/strict coherency mode. Each: {subjectEntryId, response: 'linked' | 'accepted-fix' | 'diverged', entryId?, reason?}."
13263
13296
  ),
13264
- steeringOverrideReason: z26.string().max(2e3).optional().describe(
13297
+ steeringOverrideReason: z27.string().max(2e3).optional().describe(
13265
13298
  "Typed override reason (>= 12 chars) to push a constellation past a coherency hold instead of acknowledging."
13266
13299
  )
13267
13300
  });
@@ -13514,33 +13547,33 @@ var SESSION_ACTIONS = [
13514
13547
  "resume",
13515
13548
  "commit-constellation"
13516
13549
  ];
13517
- var coherencyAcknowledgementFlatSchema2 = z27.object({
13518
- response: z27.string().max(200).describe("Acknowledgement response per offender: 'linked' | 'accepted-fix' | 'diverged'."),
13519
- entryId: z27.string().max(200).optional().describe("Entry the acknowledgement links to."),
13520
- reason: z27.string().max(2e3).optional().describe("Free-text justification, required for a 'diverged' response."),
13521
- subjectEntryId: z27.string().max(200).optional().describe("The refused entry this acknowledgement answers.")
13550
+ var coherencyAcknowledgementFlatSchema2 = z28.object({
13551
+ response: z28.string().max(200).describe("Acknowledgement response per offender: 'linked' | 'accepted-fix' | 'diverged'."),
13552
+ entryId: z28.string().max(200).optional().describe("Entry the acknowledgement links to."),
13553
+ reason: z28.string().max(2e3).optional().describe("Free-text justification, required for a 'diverged' response."),
13554
+ subjectEntryId: z28.string().max(200).optional().describe("The refused entry this acknowledgement answers.")
13522
13555
  });
13523
- var sessionSchema = z27.object({
13524
- action: z27.enum(SESSION_ACTIONS).describe(
13556
+ var sessionSchema = z28.object({
13557
+ action: z28.enum(SESSION_ACTIONS).describe(
13525
13558
  "'start': begin a tracked session. 'close': end the session and record activity. 'status': check current session state. 'wrapup-review': review uncommitted drafts before closing (absorbs session-wrapup action=review). 'wrapup-commit': accept all uncommitted drafts (absorbs session-wrapup action=commit-all). 'resume': load session state from an existing bet entry (absorbs facilitate action=resume). 'commit-constellation': atomically accept a bet and its linked drafts (absorbs facilitate action=commit-constellation)."
13526
13559
  ),
13527
- betEntryId: z27.string().max(200).optional().describe("For 'resume'/'commit-constellation': bet entry ID. Required for both."),
13528
- operationId: z27.string().max(200).optional().describe("For 'commit-constellation': optional idempotency key for retries."),
13529
- coherencyAcknowledgements: z27.array(coherencyAcknowledgementFlatSchema2).max(20).optional().describe(
13560
+ betEntryId: z28.string().max(200).optional().describe("For 'resume'/'commit-constellation': bet entry ID. Required for both."),
13561
+ operationId: z28.string().max(200).optional().describe("For 'commit-constellation': optional idempotency key for retries."),
13562
+ coherencyAcknowledgements: z28.array(coherencyAcknowledgementFlatSchema2).max(20).optional().describe(
13530
13563
  "For 'commit-constellation': per-offender acknowledgements to retry a constellation held under standard/strict coherency mode."
13531
13564
  ),
13532
- steeringOverrideReason: z27.string().max(2e3).optional().describe(
13565
+ steeringOverrideReason: z28.string().max(2e3).optional().describe(
13533
13566
  "For 'commit-constellation': typed override reason (>= 12 chars) to push past a coherency hold instead of acknowledging."
13534
13567
  )
13535
13568
  });
13536
- var sessionStartVariant = z27.object({ action: z27.literal("start") });
13537
- var sessionCloseVariant = z27.object({ action: z27.literal("close") });
13538
- var sessionStatusVariant = z27.object({ action: z27.literal("status") });
13539
- var sessionWrapupReviewVariant = z27.object({ action: z27.literal("wrapup-review") });
13540
- var sessionWrapupCommitVariant = z27.object({ action: z27.literal("wrapup-commit") });
13541
- var sessionResumeVariant = facilitateSchema.omit({ action: true }).extend({ action: z27.literal("resume") });
13542
- var sessionCommitConstellationVariant = facilitateSchema.omit({ action: true }).extend({ action: z27.literal("commit-constellation") });
13543
- var sessionActionUnion = z27.discriminatedUnion("action", [
13569
+ var sessionStartVariant = z28.object({ action: z28.literal("start") });
13570
+ var sessionCloseVariant = z28.object({ action: z28.literal("close") });
13571
+ var sessionStatusVariant = z28.object({ action: z28.literal("status") });
13572
+ var sessionWrapupReviewVariant = z28.object({ action: z28.literal("wrapup-review") });
13573
+ var sessionWrapupCommitVariant = z28.object({ action: z28.literal("wrapup-commit") });
13574
+ var sessionResumeVariant = facilitateSchema.omit({ action: true }).extend({ action: z28.literal("resume") });
13575
+ var sessionCommitConstellationVariant = facilitateSchema.omit({ action: true }).extend({ action: z28.literal("commit-constellation") });
13576
+ var sessionActionUnion = z28.discriminatedUnion("action", [
13544
13577
  sessionStartVariant,
13545
13578
  sessionCloseVariant,
13546
13579
  sessionStatusVariant,
@@ -13779,7 +13812,7 @@ async function handleStatus() {
13779
13812
  }
13780
13813
 
13781
13814
  // src/tools/gitchain.ts
13782
- import { z as z28 } from "zod/v3";
13815
+ import { z as z29 } from "zod/v3";
13783
13816
 
13784
13817
  // src/lib/versionDisplay.ts
13785
13818
  function toVersionDisplay(version) {
@@ -13788,51 +13821,51 @@ function toVersionDisplay(version) {
13788
13821
  }
13789
13822
 
13790
13823
  // src/tools/gitchain.ts
13791
- var chainSchema = z28.object({
13792
- action: z28.enum(["create", "get", "list", "edit"]).describe("Action: create a process, get process details, list all processes, or edit a process link"),
13793
- chainEntryId: z28.string().max(200).optional().describe("Chain entry ID (required for get/edit)"),
13794
- title: z28.string().max(500).optional().describe("Process title (required for create)"),
13795
- chainTypeId: z28.string().max(200).optional().default("strategy-coherence").describe("Process template slug for create: 'strategy-coherence', 'idm-proposal', or any custom template slug"),
13796
- description: z28.string().max(2e4).optional().describe("Description (for create)"),
13797
- linkId: z28.string().max(200).optional().describe("Link to edit (for edit action): problem, insight, choice, action, outcome"),
13798
- content: z28.string().max(5e4).optional().describe("New content for the link (for edit action)"),
13799
- status: z28.string().max(200).optional().describe("Filter by status for list: 'draft' or 'active'"),
13800
- author: z28.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'."),
13824
+ var chainSchema = z29.object({
13825
+ action: z29.enum(["create", "get", "list", "edit"]).describe("Action: create a process, get process details, list all processes, or edit a process link"),
13826
+ chainEntryId: z29.string().max(200).optional().describe("Chain entry ID (required for get/edit)"),
13827
+ title: z29.string().max(500).optional().describe("Process title (required for create)"),
13828
+ chainTypeId: z29.string().max(200).optional().default("strategy-coherence").describe("Process template slug for create: 'strategy-coherence', 'idm-proposal', or any custom template slug"),
13829
+ description: z29.string().max(2e4).optional().describe("Description (for create)"),
13830
+ linkId: z29.string().max(200).optional().describe("Link to edit (for edit action): problem, insight, choice, action, outcome"),
13831
+ content: z29.string().max(5e4).optional().describe("New content for the link (for edit action)"),
13832
+ status: z29.string().max(200).optional().describe("Filter by status for list: 'draft' or 'active'"),
13833
+ author: z29.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'."),
13801
13834
  // WP-513 review round 3 (P1): team+role to create AS OWNER of (rung 2 only) — entry ID or entryId (e.g. "TEAM-1").
13802
- ownerTeamEntryId: z28.string().max(200).optional().describe("For 'create': owning team (rung-2 workspaces)."),
13803
- ownerRoleEntryId: z28.string().max(200).optional().describe("For 'create': owning role (rung-2 workspaces).")
13835
+ ownerTeamEntryId: z29.string().max(200).optional().describe("For 'create': owning team (rung-2 workspaces)."),
13836
+ ownerRoleEntryId: z29.string().max(200).optional().describe("For 'create': owning role (rung-2 workspaces).")
13804
13837
  });
13805
- var chainVersionSchema = z28.object({
13806
- action: z28.enum(["commit", "list", "diff", "revert", "history"]).describe("Action: commit a snapshot, list commits, diff two versions, revert to a version, or view history"),
13807
- chainEntryId: z28.string().max(200).describe("The chain's entry ID"),
13808
- commitMessage: z28.string().max(2e3).optional().describe("Commit message (required for commit). Convention: type(link): description"),
13809
- versionA: z28.number().optional().describe("Earlier version for diff"),
13810
- versionB: z28.number().optional().describe("Later version for diff"),
13811
- toVersion: z28.number().optional().describe("Version number to revert to"),
13812
- author: z28.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
13838
+ var chainVersionSchema = z29.object({
13839
+ action: z29.enum(["commit", "list", "diff", "revert", "history"]).describe("Action: commit a snapshot, list commits, diff two versions, revert to a version, or view history"),
13840
+ chainEntryId: z29.string().max(200).describe("The chain's entry ID"),
13841
+ commitMessage: z29.string().max(2e3).optional().describe("Commit message (required for commit). Convention: type(link): description"),
13842
+ versionA: z29.number().optional().describe("Earlier version for diff"),
13843
+ versionB: z29.number().optional().describe("Later version for diff"),
13844
+ toVersion: z29.number().optional().describe("Version number to revert to"),
13845
+ author: z29.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
13813
13846
  });
13814
- var chainBranchSchema = z28.object({
13815
- action: z28.enum(["create", "list", "merge", "conflicts"]).describe("Action: create a branch, list branches, merge a branch, or check for conflicts"),
13816
- chainEntryId: z28.string().max(200).describe("The chain's entry ID"),
13817
- branchName: z28.string().max(200).optional().describe("Branch name (required for merge/conflicts, optional for create)"),
13818
- strategy: z28.enum(["merge_commit", "squash"]).optional().describe("Merge strategy: 'merge_commit' (default) or 'squash'"),
13819
- author: z28.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
13847
+ var chainBranchSchema = z29.object({
13848
+ action: z29.enum(["create", "list", "merge", "conflicts"]).describe("Action: create a branch, list branches, merge a branch, or check for conflicts"),
13849
+ chainEntryId: z29.string().max(200).describe("The chain's entry ID"),
13850
+ branchName: z29.string().max(200).optional().describe("Branch name (required for merge/conflicts, optional for create)"),
13851
+ strategy: z29.enum(["merge_commit", "squash"]).optional().describe("Merge strategy: 'merge_commit' (default) or 'squash'"),
13852
+ author: z29.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
13820
13853
  });
13821
- var chainReviewSchema = z28.object({
13822
- action: z28.enum(["gate", "comment", "resolve-comment", "list-comments"]).describe("Action: run coherence gate, add a comment, resolve a comment, or list comments"),
13854
+ var chainReviewSchema = z29.object({
13855
+ action: z29.enum(["gate", "comment", "resolve-comment", "list-comments"]).describe("Action: run coherence gate, add a comment, resolve a comment, or list comments"),
13823
13856
  // Finding #12: optional at the base (mirrors chainSchema's chainEntryId pattern at
13824
13857
  // line ~690) — resolve-comment resolves purely by commentId (handleChainReview never
13825
13858
  // reads chainEntryId in that branch) and the compound-tool's advertised schema
13826
13859
  // (chainReviewCompoundSchema below) already documents it as optional for that action.
13827
13860
  // Per-action variants that DO need it (gate/comment/list-comments) re-require it below,
13828
13861
  // same pattern as chainGetVariant/chainEditVariant re-requiring over chainSchema's base.
13829
- chainEntryId: z28.string().max(200).optional().describe("The chain's entry ID. Required for every action except 'resolve-comment'."),
13830
- commitMessage: z28.string().max(2e3).optional().describe("Commit message to lint (for gate action)"),
13831
- versionNumber: z28.number().optional().describe("Version to comment on or list comments for"),
13832
- linkId: z28.string().max(200).optional().describe("Link this comment targets (optional for comment)"),
13833
- body: z28.string().max(2e4).optional().describe("Comment text (required for comment action)"),
13834
- commentId: z28.string().max(200).optional().describe("Comment ID (required for resolve-comment)"),
13835
- author: z28.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
13862
+ chainEntryId: z29.string().max(200).optional().describe("The chain's entry ID. Required for every action except 'resolve-comment'."),
13863
+ commitMessage: z29.string().max(2e3).optional().describe("Commit message to lint (for gate action)"),
13864
+ versionNumber: z29.number().optional().describe("Version to comment on or list comments for"),
13865
+ linkId: z29.string().max(200).optional().describe("Link this comment targets (optional for comment)"),
13866
+ body: z29.string().max(2e4).optional().describe("Comment text (required for comment action)"),
13867
+ commentId: z29.string().max(200).optional().describe("Comment ID (required for resolve-comment)"),
13868
+ author: z29.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
13836
13869
  });
13837
13870
  function linkSummary(links) {
13838
13871
  return Object.entries(links).map(([id, content]) => {
@@ -14340,57 +14373,57 @@ var CHAIN_REVIEW_ACTIONS = [
14340
14373
  "branch.merge",
14341
14374
  "branch.conflicts"
14342
14375
  ];
14343
- var chainCompoundSchema = z28.object({
14344
- action: z28.enum(CHAIN_ACTIONS).describe(
14376
+ var chainCompoundSchema = z29.object({
14377
+ action: z29.enum(CHAIN_ACTIONS).describe(
14345
14378
  "Unnamespaced: 'create'/'get'/'list'/'edit' \u2014 process CRUD (the original `chain` tool). 'version.*' (commit/list/diff/revert/history) \u2014 versioning, absorbs `chain-version`. Branching and review live on the sibling `chain-review` tool."
14346
14379
  ),
14347
- chainEntryId: z28.string().max(200).optional().describe("Chain entry ID. Required for get/edit and all version.* actions."),
14348
- title: z28.string().max(500).optional().describe("For 'create': process title (required)."),
14349
- chainTypeId: z28.string().max(200).optional().default("strategy-coherence").describe("For 'create'/'list': process template slug."),
14350
- description: z28.string().max(2e4).optional().describe("For 'create': description."),
14351
- linkId: z28.string().max(200).optional().describe("For 'edit': link to edit (required)."),
14352
- content: z28.string().max(5e4).optional().describe("For 'edit': new content for the link (required)."),
14353
- status: z28.string().max(200).optional().describe("For 'list': filter by status."),
14354
- author: z28.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'."),
14355
- commitMessage: z28.string().max(2e3).optional().describe("For 'version.commit': commit message (required)."),
14356
- versionA: z28.number().optional().describe("For 'version.diff': earlier version (required)."),
14357
- versionB: z28.number().optional().describe("For 'version.diff': later version (required)."),
14358
- toVersion: z28.number().optional().describe("For 'version.revert': version number to revert to (required)."),
14380
+ chainEntryId: z29.string().max(200).optional().describe("Chain entry ID. Required for get/edit and all version.* actions."),
14381
+ title: z29.string().max(500).optional().describe("For 'create': process title (required)."),
14382
+ chainTypeId: z29.string().max(200).optional().default("strategy-coherence").describe("For 'create'/'list': process template slug."),
14383
+ description: z29.string().max(2e4).optional().describe("For 'create': description."),
14384
+ linkId: z29.string().max(200).optional().describe("For 'edit': link to edit (required)."),
14385
+ content: z29.string().max(5e4).optional().describe("For 'edit': new content for the link (required)."),
14386
+ status: z29.string().max(200).optional().describe("For 'list': filter by status."),
14387
+ author: z29.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'."),
14388
+ commitMessage: z29.string().max(2e3).optional().describe("For 'version.commit': commit message (required)."),
14389
+ versionA: z29.number().optional().describe("For 'version.diff': earlier version (required)."),
14390
+ versionB: z29.number().optional().describe("For 'version.diff': later version (required)."),
14391
+ toVersion: z29.number().optional().describe("For 'version.revert': version number to revert to (required)."),
14359
14392
  // WP-513 review round 3 (P1): team+role to create AS OWNER of (rung 2 only).
14360
- ownerTeamEntryId: z28.string().max(200).optional().describe("For 'create': owning team (rung-2 workspaces)."),
14361
- ownerRoleEntryId: z28.string().max(200).optional().describe("For 'create': owning role (rung-2 workspaces).")
14393
+ ownerTeamEntryId: z29.string().max(200).optional().describe("For 'create': owning team (rung-2 workspaces)."),
14394
+ ownerRoleEntryId: z29.string().max(200).optional().describe("For 'create': owning role (rung-2 workspaces).")
14362
14395
  });
14363
- var chainReviewCompoundSchema = z28.object({
14364
- action: z28.enum(CHAIN_REVIEW_ACTIONS).describe(
14396
+ var chainReviewCompoundSchema = z29.object({
14397
+ action: z29.enum(CHAIN_REVIEW_ACTIONS).describe(
14365
14398
  "'gate'/'comment'/'resolve-comment'/'list-comments' \u2014 quality gate + comments (the original `chain-review` tool, unchanged call shape). 'branch.*' (create/list/merge/conflicts) \u2014 branching, absorbs `chain-branch`. Process CRUD and versioning live on the sibling `chain` tool."
14366
14399
  ),
14367
- chainEntryId: z28.string().max(200).optional().describe("Chain entry ID. Required for every action except 'resolve-comment'."),
14368
- commitMessage: z28.string().max(2e3).optional().describe("For 'gate': commit message to lint."),
14369
- versionNumber: z28.number().optional().describe("For 'comment'/'list-comments': version to comment on or list comments for."),
14370
- linkId: z28.string().max(200).optional().describe("For 'comment': optional link this comment targets."),
14371
- body: z28.string().max(2e4).optional().describe("For 'comment': comment text (required)."),
14372
- commentId: z28.string().max(200).optional().describe("For 'resolve-comment': comment ID (required)."),
14373
- branchName: z28.string().max(200).optional().describe("For 'branch.merge'/'branch.conflicts': required. For 'branch.create': optional."),
14374
- strategy: z28.enum(["merge_commit", "squash"]).optional().describe("For 'branch.merge': merge strategy. Default 'merge_commit'."),
14375
- author: z28.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
14400
+ chainEntryId: z29.string().max(200).optional().describe("Chain entry ID. Required for every action except 'resolve-comment'."),
14401
+ commitMessage: z29.string().max(2e3).optional().describe("For 'gate': commit message to lint."),
14402
+ versionNumber: z29.number().optional().describe("For 'comment'/'list-comments': version to comment on or list comments for."),
14403
+ linkId: z29.string().max(200).optional().describe("For 'comment': optional link this comment targets."),
14404
+ body: z29.string().max(2e4).optional().describe("For 'comment': comment text (required)."),
14405
+ commentId: z29.string().max(200).optional().describe("For 'resolve-comment': comment ID (required)."),
14406
+ branchName: z29.string().max(200).optional().describe("For 'branch.merge'/'branch.conflicts': required. For 'branch.create': optional."),
14407
+ strategy: z29.enum(["merge_commit", "squash"]).optional().describe("For 'branch.merge': merge strategy. Default 'merge_commit'."),
14408
+ author: z29.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
14376
14409
  });
14377
- var chainCreateVariant = chainSchema.omit({ action: true }).extend({ action: z28.literal("create") });
14378
- var chainGetVariant = z28.object({ action: z28.literal("get"), chainEntryId: z28.string().max(200) });
14379
- var chainListVariant = z28.object({ action: z28.literal("list"), chainTypeId: z28.string().max(200).optional(), status: z28.string().max(200).optional() });
14380
- var chainEditVariant = z28.object({
14381
- action: z28.literal("edit"),
14382
- chainEntryId: z28.string().max(200),
14383
- linkId: z28.string().max(200),
14384
- content: z28.string().max(5e4),
14385
- author: z28.string().max(200).optional()
14410
+ var chainCreateVariant = chainSchema.omit({ action: true }).extend({ action: z29.literal("create") });
14411
+ var chainGetVariant = z29.object({ action: z29.literal("get"), chainEntryId: z29.string().max(200) });
14412
+ var chainListVariant = z29.object({ action: z29.literal("list"), chainTypeId: z29.string().max(200).optional(), status: z29.string().max(200).optional() });
14413
+ var chainEditVariant = z29.object({
14414
+ action: z29.literal("edit"),
14415
+ chainEntryId: z29.string().max(200),
14416
+ linkId: z29.string().max(200),
14417
+ content: z29.string().max(5e4),
14418
+ author: z29.string().max(200).optional()
14386
14419
  });
14387
14420
  var versionBase = chainVersionSchema.omit({ action: true });
14388
- var chainVersionCommitVariant = versionBase.extend({ action: z28.literal("version.commit"), commitMessage: z28.string().max(2e3) });
14389
- var chainVersionListVariant = versionBase.extend({ action: z28.literal("version.list") });
14390
- var chainVersionDiffVariant = versionBase.extend({ action: z28.literal("version.diff"), versionA: z28.number(), versionB: z28.number() });
14391
- var chainVersionRevertVariant = versionBase.extend({ action: z28.literal("version.revert"), toVersion: z28.number() });
14392
- var chainVersionHistoryVariant = versionBase.extend({ action: z28.literal("version.history") });
14393
- var chainActionUnion = z28.discriminatedUnion("action", [
14421
+ var chainVersionCommitVariant = versionBase.extend({ action: z29.literal("version.commit"), commitMessage: z29.string().max(2e3) });
14422
+ var chainVersionListVariant = versionBase.extend({ action: z29.literal("version.list") });
14423
+ var chainVersionDiffVariant = versionBase.extend({ action: z29.literal("version.diff"), versionA: z29.number(), versionB: z29.number() });
14424
+ var chainVersionRevertVariant = versionBase.extend({ action: z29.literal("version.revert"), toVersion: z29.number() });
14425
+ var chainVersionHistoryVariant = versionBase.extend({ action: z29.literal("version.history") });
14426
+ var chainActionUnion = z29.discriminatedUnion("action", [
14394
14427
  chainCreateVariant,
14395
14428
  chainGetVariant,
14396
14429
  chainListVariant,
@@ -14402,16 +14435,16 @@ var chainActionUnion = z28.discriminatedUnion("action", [
14402
14435
  chainVersionHistoryVariant
14403
14436
  ]);
14404
14437
  var reviewBase = chainReviewSchema.omit({ action: true });
14405
- var chainReviewGateVariant = reviewBase.extend({ action: z28.literal("gate"), chainEntryId: z28.string().max(200) });
14406
- var chainReviewCommentVariant = reviewBase.extend({ action: z28.literal("comment"), chainEntryId: z28.string().max(200), versionNumber: z28.number(), body: z28.string().max(2e4) });
14407
- var chainReviewResolveCommentVariant = reviewBase.extend({ action: z28.literal("resolve-comment"), commentId: z28.string().max(200) });
14408
- var chainReviewListCommentsVariant = reviewBase.extend({ action: z28.literal("list-comments"), chainEntryId: z28.string().max(200) });
14438
+ var chainReviewGateVariant = reviewBase.extend({ action: z29.literal("gate"), chainEntryId: z29.string().max(200) });
14439
+ var chainReviewCommentVariant = reviewBase.extend({ action: z29.literal("comment"), chainEntryId: z29.string().max(200), versionNumber: z29.number(), body: z29.string().max(2e4) });
14440
+ var chainReviewResolveCommentVariant = reviewBase.extend({ action: z29.literal("resolve-comment"), commentId: z29.string().max(200) });
14441
+ var chainReviewListCommentsVariant = reviewBase.extend({ action: z29.literal("list-comments"), chainEntryId: z29.string().max(200) });
14409
14442
  var branchBase = chainBranchSchema.omit({ action: true });
14410
- var chainBranchCreateVariant = branchBase.extend({ action: z28.literal("branch.create") });
14411
- var chainBranchListVariant = branchBase.extend({ action: z28.literal("branch.list") });
14412
- var chainBranchMergeVariant = branchBase.extend({ action: z28.literal("branch.merge"), branchName: z28.string().max(200) });
14413
- var chainBranchConflictsVariant = branchBase.extend({ action: z28.literal("branch.conflicts"), branchName: z28.string().max(200) });
14414
- var chainReviewActionUnion = z28.discriminatedUnion("action", [
14443
+ var chainBranchCreateVariant = branchBase.extend({ action: z29.literal("branch.create") });
14444
+ var chainBranchListVariant = branchBase.extend({ action: z29.literal("branch.list") });
14445
+ var chainBranchMergeVariant = branchBase.extend({ action: z29.literal("branch.merge"), branchName: z29.string().max(200) });
14446
+ var chainBranchConflictsVariant = branchBase.extend({ action: z29.literal("branch.conflicts"), branchName: z29.string().max(200) });
14447
+ var chainReviewActionUnion = z29.discriminatedUnion("action", [
14415
14448
  chainReviewGateVariant,
14416
14449
  chainReviewCommentVariant,
14417
14450
  chainReviewResolveCommentVariant,
@@ -14503,10 +14536,10 @@ function registerGitChainTools(server) {
14503
14536
  }
14504
14537
 
14505
14538
  // src/tools/workspace.ts
14506
- import { z as z31 } from "zod/v3";
14539
+ import { z as z32 } from "zod/v3";
14507
14540
 
14508
14541
  // src/tools/health.ts
14509
- import { z as z29 } from "zod/v3";
14542
+ import { z as z30 } from "zod/v3";
14510
14543
 
14511
14544
  // src/lib/auditView.ts
14512
14545
  async function buildTenantAuditView(limit) {
@@ -14871,66 +14904,66 @@ ${logLines.join("\n")}${seamSummaryText}` }],
14871
14904
  };
14872
14905
  }
14873
14906
  var HEALTH_ACTIONS = ["check", "whoami", "status", "audit", "self-test"];
14874
- var healthSchema = z29.object({
14875
- action: z29.enum(HEALTH_ACTIONS).describe(
14907
+ var healthSchema = z30.object({
14908
+ action: z30.enum(HEALTH_ACTIONS).describe(
14876
14909
  "'check': connectivity and workspace stats. 'whoami': session identity. 'status': workspace readiness. 'audit': session audit log. 'self-test': validate all tool schemas."
14877
14910
  ),
14878
- limit: z29.number().min(1).max(50).default(20).optional().describe("For audit: how many recent calls to show (max 50)")
14911
+ limit: z30.number().min(1).max(50).default(20).optional().describe("For audit: how many recent calls to show (max 50)")
14879
14912
  });
14880
- var healthCheckOutputSchema = z29.object({
14881
- healthy: z29.boolean(),
14882
- collections: z29.number(),
14883
- entries: z29.number(),
14884
- latencyMs: z29.number(),
14885
- workspace: z29.string()
14913
+ var healthCheckOutputSchema = z30.object({
14914
+ healthy: z30.boolean(),
14915
+ collections: z30.number(),
14916
+ entries: z30.number(),
14917
+ latencyMs: z30.number(),
14918
+ workspace: z30.string()
14886
14919
  });
14887
- var organisationHealthSchema = z29.object({
14888
- reviewed: z29.number(),
14889
- agreements: z29.number(),
14890
- disagreements: z29.number(),
14891
- abstentions: z29.number(),
14892
- agreementRate: z29.number(),
14893
- flags: z29.array(z29.object({
14894
- collection: z29.string(),
14895
- count: z29.number(),
14896
- suggestedCollection: z29.string()
14920
+ var organisationHealthSchema = z30.object({
14921
+ reviewed: z30.number(),
14922
+ agreements: z30.number(),
14923
+ disagreements: z30.number(),
14924
+ abstentions: z30.number(),
14925
+ agreementRate: z30.number(),
14926
+ flags: z30.array(z30.object({
14927
+ collection: z30.string(),
14928
+ count: z30.number(),
14929
+ suggestedCollection: z30.string()
14897
14930
  }))
14898
14931
  });
14899
- var healthStatusOutputSchema = z29.object({
14900
- stage: z29.enum(["blank", "seeded", "grounded", "connected"]).optional().default("seeded"),
14901
- sampleTruncated: z29.boolean().nullable().optional(),
14902
- scoringVersion: z29.enum(["v1", "v2"]).optional().default("v1"),
14903
- readinessScore: z29.number(),
14904
- activeEntries: z29.number(),
14905
- totalRelations: z29.number(),
14906
- orphanedEntries: z29.number(),
14907
- gaps: z29.array(z29.object({ id: z29.string(), label: z29.string(), guidance: z29.string() })),
14932
+ var healthStatusOutputSchema = z30.object({
14933
+ stage: z30.enum(["blank", "seeded", "grounded", "connected"]).optional().default("seeded"),
14934
+ sampleTruncated: z30.boolean().nullable().optional(),
14935
+ scoringVersion: z30.enum(["v1", "v2"]).optional().default("v1"),
14936
+ readinessScore: z30.number(),
14937
+ activeEntries: z30.number(),
14938
+ totalRelations: z30.number(),
14939
+ orphanedEntries: z30.number(),
14940
+ gaps: z30.array(z30.object({ id: z30.string(), label: z30.string(), guidance: z30.string() })),
14908
14941
  organisationHealth: organisationHealthSchema.optional()
14909
14942
  });
14910
- var healthAuditOutputSchema = z29.object({
14911
- totalCalls: z29.number(),
14912
- calls: z29.array(z29.object({
14913
- tool: z29.string(),
14914
- action: z29.string().optional(),
14915
- timestamp: z29.string(),
14916
- durationMs: z29.number().optional()
14943
+ var healthAuditOutputSchema = z30.object({
14944
+ totalCalls: z30.number(),
14945
+ calls: z30.array(z30.object({
14946
+ tool: z30.string(),
14947
+ action: z30.string().optional(),
14948
+ timestamp: z30.string(),
14949
+ durationMs: z30.number().optional()
14917
14950
  }))
14918
14951
  });
14919
- var healthWhoamiOutputSchema = z29.object({
14920
- workspaceId: z29.string(),
14921
- workspaceName: z29.string(),
14922
- scope: z29.string(),
14923
- sessionId: z29.union([z29.string(), z29.null()]),
14924
- oriented: z29.boolean()
14952
+ var healthWhoamiOutputSchema = z30.object({
14953
+ workspaceId: z30.string(),
14954
+ workspaceName: z30.string(),
14955
+ scope: z30.string(),
14956
+ sessionId: z30.union([z30.string(), z30.null()]),
14957
+ oriented: z30.boolean()
14925
14958
  });
14926
- var selfTestOutputSchema = z29.object({
14927
- passed: z29.number(),
14928
- failed: z29.number(),
14929
- total: z29.number(),
14930
- results: z29.array(z29.object({
14931
- tool: z29.string(),
14932
- valid: z29.boolean(),
14933
- error: z29.string().optional()
14959
+ var selfTestOutputSchema = z30.object({
14960
+ passed: z30.number(),
14961
+ failed: z30.number(),
14962
+ total: z30.number(),
14963
+ results: z30.array(z30.object({
14964
+ tool: z30.string(),
14965
+ valid: z30.boolean(),
14966
+ error: z30.string().optional()
14934
14967
  }))
14935
14968
  });
14936
14969
  function handleSelfTest(server) {
@@ -14981,9 +15014,9 @@ function handleSelfTest(server) {
14981
15014
  }
14982
15015
 
14983
15016
  // src/tools/usage.ts
14984
- import { z as z30 } from "zod/v3";
14985
- var usageSummarySchema = z30.object({
14986
- periodDays: z30.number().min(1).max(90).optional().describe("Number of days to look back (default 30, max 90)")
15017
+ import { z as z31 } from "zod/v3";
15018
+ var usageSummarySchema = z31.object({
15019
+ periodDays: z31.number().min(1).max(90).optional().describe("Number of days to look back (default 30, max 90)")
14987
15020
  });
14988
15021
  async function handleUsageSummary(periodDays) {
14989
15022
  const ws = await getWorkspaceContext();
@@ -15155,35 +15188,35 @@ var WORKSPACE_ACTIONS = [
15155
15188
  "proposals-respond",
15156
15189
  "proposals-count"
15157
15190
  ];
15158
- var workspaceSchema = z31.object({
15159
- action: z31.enum(WORKSPACE_ACTIONS).describe(
15191
+ var workspaceSchema = z32.object({
15192
+ action: z32.enum(WORKSPACE_ACTIONS).describe(
15160
15193
  "'check': connectivity and workspace stats (absorbs health action=check). 'whoami': session identity (absorbs health action=whoami). 'status': workspace readiness (absorbs health action=status). 'audit': session audit log (absorbs health action=audit). 'self-test': validate all tool schemas (absorbs health action=self-test). 'usage': LLM usage and cost summary (absorbs get-usage-summary). 'proposals-list': list open consent proposals (absorbs governance-proposals action=list). 'proposals-respond': approve/reject a consent proposal (absorbs governance-proposals action=respond). 'proposals-count': count open consent proposals (absorbs governance-proposals action=count)."
15161
15194
  ),
15162
- limit: z31.number().min(1).max(50).optional().describe("For 'audit': how many recent calls to show (max 50, default 20)."),
15163
- periodDays: z31.number().min(1).max(90).optional().describe("For 'usage': number of days to look back (default 30, max 90)."),
15164
- status: z31.enum(["open", "approved", "objected", "expired"]).optional().describe("For 'proposals-list': filter by status (default: open)."),
15165
- proposalId: z31.string().max(200).optional().describe("For 'proposals-respond': proposal ID."),
15166
- verdict: z31.enum(["approve", "reject"]).optional().describe("For 'proposals-respond': approve or reject."),
15167
- reason: z31.string().max(2e3).optional().describe("For 'proposals-respond': reason for the verdict (required when rejecting).")
15195
+ limit: z32.number().min(1).max(50).optional().describe("For 'audit': how many recent calls to show (max 50, default 20)."),
15196
+ periodDays: z32.number().min(1).max(90).optional().describe("For 'usage': number of days to look back (default 30, max 90)."),
15197
+ status: z32.enum(["open", "approved", "objected", "expired"]).optional().describe("For 'proposals-list': filter by status (default: open)."),
15198
+ proposalId: z32.string().max(200).optional().describe("For 'proposals-respond': proposal ID."),
15199
+ verdict: z32.enum(["approve", "reject"]).optional().describe("For 'proposals-respond': approve or reject."),
15200
+ reason: z32.string().max(2e3).optional().describe("For 'proposals-respond': reason for the verdict (required when rejecting).")
15168
15201
  });
15169
- var workspaceCheckVariant = z31.object({ action: z31.literal("check") });
15170
- var workspaceWhoamiVariant = z31.object({ action: z31.literal("whoami") });
15171
- var workspaceStatusVariant = z31.object({ action: z31.literal("status") });
15172
- var workspaceAuditVariant = z31.object({ action: z31.literal("audit"), limit: z31.number().min(1).max(50).optional().default(20) });
15173
- var workspaceSelfTestVariant = z31.object({ action: z31.literal("self-test") });
15174
- var workspaceUsageVariant = z31.object({ action: z31.literal("usage"), periodDays: z31.number().min(1).max(90).optional() });
15175
- var workspaceProposalsListVariant = z31.object({
15176
- action: z31.literal("proposals-list"),
15177
- status: z31.enum(["open", "approved", "objected", "expired"]).optional()
15202
+ var workspaceCheckVariant = z32.object({ action: z32.literal("check") });
15203
+ var workspaceWhoamiVariant = z32.object({ action: z32.literal("whoami") });
15204
+ var workspaceStatusVariant = z32.object({ action: z32.literal("status") });
15205
+ var workspaceAuditVariant = z32.object({ action: z32.literal("audit"), limit: z32.number().min(1).max(50).optional().default(20) });
15206
+ var workspaceSelfTestVariant = z32.object({ action: z32.literal("self-test") });
15207
+ var workspaceUsageVariant = z32.object({ action: z32.literal("usage"), periodDays: z32.number().min(1).max(90).optional() });
15208
+ var workspaceProposalsListVariant = z32.object({
15209
+ action: z32.literal("proposals-list"),
15210
+ status: z32.enum(["open", "approved", "objected", "expired"]).optional()
15178
15211
  });
15179
- var workspaceProposalsRespondVariant = z31.object({
15180
- action: z31.literal("proposals-respond"),
15181
- proposalId: z31.string().max(200),
15182
- verdict: z31.enum(["approve", "reject"]),
15183
- reason: z31.string().max(2e3).optional()
15212
+ var workspaceProposalsRespondVariant = z32.object({
15213
+ action: z32.literal("proposals-respond"),
15214
+ proposalId: z32.string().max(200),
15215
+ verdict: z32.enum(["approve", "reject"]),
15216
+ reason: z32.string().max(2e3).optional()
15184
15217
  });
15185
- var workspaceProposalsCountVariant = z31.object({ action: z31.literal("proposals-count") });
15186
- var workspaceActionUnion = z31.discriminatedUnion("action", [
15218
+ var workspaceProposalsCountVariant = z32.object({ action: z32.literal("proposals-count") });
15219
+ var workspaceActionUnion = z32.discriminatedUnion("action", [
15187
15220
  workspaceCheckVariant,
15188
15221
  workspaceWhoamiVariant,
15189
15222
  workspaceStatusVariant,
@@ -15239,7 +15272,7 @@ function registerWorkspaceTools(server) {
15239
15272
  }
15240
15273
 
15241
15274
  // src/tools/feedback.ts
15242
- import { z as z32 } from "zod/v3";
15275
+ import { z as z33 } from "zod/v3";
15243
15276
 
15244
15277
  // src/lib/productFeedbackConstants.ts
15245
15278
  var PRODUCT_FEEDBACK_CATEGORIES = ["bug", "friction", "idea", "praise", "other"];
@@ -15250,9 +15283,9 @@ var VENDOR_SETTABLE_STATUSES = PRODUCT_FEEDBACK_STATUSES.filter(
15250
15283
 
15251
15284
  // src/tools/feedback.ts
15252
15285
  var actions = ["submit", "list", "queue", "note", "group", "status"];
15253
- var category = z32.enum(PRODUCT_FEEDBACK_CATEGORIES);
15254
- var status = z32.enum(PRODUCT_FEEDBACK_STATUSES);
15255
- var vendorStatus = z32.enum(VENDOR_SETTABLE_STATUSES);
15286
+ var category = z33.enum(PRODUCT_FEEDBACK_CATEGORIES);
15287
+ var status = z33.enum(PRODUCT_FEEDBACK_STATUSES);
15288
+ var vendorStatus = z33.enum(VENDOR_SETTABLE_STATUSES);
15256
15289
  var GATEWAY_MAX_STRING_BYTES = 10240;
15257
15290
  var utf8Bytes = (value) => new TextEncoder().encode(value).length;
15258
15291
  var fitsGatewayBytes = (value) => utf8Bytes(value) <= GATEWAY_MAX_STRING_BYTES;
@@ -15261,32 +15294,32 @@ var byteLimitMessage = (field) => ({
15261
15294
  });
15262
15295
  var MESSAGE_DISPLAY_LIMIT = 1e3;
15263
15296
  var FULL_MESSAGE_MAX_LIMIT = 5;
15264
- var feedbackSchema = z32.object({
15265
- action: z32.enum(actions).describe("submit requires message; list returns your own workspace's feedback (all statuses); queue is the vendor triage queue (system admins only) and accepts filters; note requires feedbackId+note; group requires feedbackIds+groupId (null clears); status requires feedbackId+status."),
15266
- message: z32.string().max(1e4).optional().describe("Required for submit: the product feedback text (max 10,000 chars and 10,240 UTF-8 bytes)."),
15297
+ var feedbackSchema = z33.object({
15298
+ action: z33.enum(actions).describe("submit requires message; list returns your own workspace's feedback (all statuses); queue is the vendor triage queue (system admins only) and accepts filters; note requires feedbackId+note; group requires feedbackIds+groupId (null clears); status requires feedbackId+status."),
15299
+ message: z33.string().max(1e4).optional().describe("Required for submit: the product feedback text (max 10,000 chars and 10,240 UTF-8 bytes)."),
15267
15300
  category: category.optional().describe("Submit/queue category; submit defaults to other."),
15268
- command: z32.string().max(1e3).optional().describe("Optional submit command context; argument values are scrubbed server-side."),
15269
- route: z32.string().max(500).optional().describe("Optional submit route context."),
15270
- client: z32.string().max(100).optional().describe("Optional submit client label."),
15271
- feedbackId: z32.string().max(200).optional().describe("Required for note/status: target feedback ID."),
15272
- feedbackIds: z32.array(z32.string().max(200)).max(100).optional().describe("Required for group: 1\u2013100 target feedback IDs."),
15273
- note: z32.string().max(4e3).optional().describe("Required for note: replacement triage note (max 10,240 UTF-8 bytes)."),
15301
+ command: z33.string().max(1e3).optional().describe("Optional submit command context; argument values are scrubbed server-side."),
15302
+ route: z33.string().max(500).optional().describe("Optional submit route context."),
15303
+ client: z33.string().max(100).optional().describe("Optional submit client label."),
15304
+ feedbackId: z33.string().max(200).optional().describe("Required for note/status: target feedback ID."),
15305
+ feedbackIds: z33.array(z33.string().max(200)).max(100).optional().describe("Required for group: 1\u2013100 target feedback IDs."),
15306
+ note: z33.string().max(4e3).optional().describe("Required for note: replacement triage note (max 10,240 UTF-8 bytes)."),
15274
15307
  status: status.optional().describe("list/queue filter (any status, including 'screening'); the status action's required target value excludes 'screening' (system-only)."),
15275
- groupId: z32.string().min(1).max(200).nullable().optional().describe("Group filter, or required group destination; null explicitly clears grouping."),
15276
- workspaceId: z32.string().max(200).optional().describe("Queue-only filter (vendor cross-workspace triage); omitted means all workspaces. Has no effect on list \u2014 your own workspace is always injected server-side."),
15277
- since: z32.number().optional().describe("Queue-only lower createdAt window bound (inclusive) in epoch milliseconds."),
15278
- before: z32.number().optional().describe("Queue-only upper createdAt window bound (exclusive) in epoch milliseconds. A time-window FILTER, not the pager \u2014 use cursor to page."),
15279
- limit: z32.number().int().min(1).max(100).optional().describe("list/queue row limit, default 50, maximum 100."),
15280
- cursor: z32.string().max(2e3).optional().describe("Opaque pagination cursor from a previous list/queue response (continueCursor); omit for the first page."),
15281
- full: z32.boolean().optional().describe(`list/queue only: return untruncated messages; allowed only when limit <= ${FULL_MESSAGE_MAX_LIMIT}.`)
15308
+ groupId: z33.string().min(1).max(200).nullable().optional().describe("Group filter, or required group destination; null explicitly clears grouping."),
15309
+ workspaceId: z33.string().max(200).optional().describe("Queue-only filter (vendor cross-workspace triage); omitted means all workspaces. Has no effect on list \u2014 your own workspace is always injected server-side."),
15310
+ since: z33.number().optional().describe("Queue-only lower createdAt window bound (inclusive) in epoch milliseconds."),
15311
+ before: z33.number().optional().describe("Queue-only upper createdAt window bound (exclusive) in epoch milliseconds. A time-window FILTER, not the pager \u2014 use cursor to page."),
15312
+ limit: z33.number().int().min(1).max(100).optional().describe("list/queue row limit, default 50, maximum 100."),
15313
+ cursor: z33.string().max(2e3).optional().describe("Opaque pagination cursor from a previous list/queue response (continueCursor); omit for the first page."),
15314
+ full: z33.boolean().optional().describe(`list/queue only: return untruncated messages; allowed only when limit <= ${FULL_MESSAGE_MAX_LIMIT}.`)
15282
15315
  });
15283
- var union = z32.discriminatedUnion("action", [
15284
- z32.object({ action: z32.literal("submit"), message: z32.string().min(1).max(1e4).refine(fitsGatewayBytes, byteLimitMessage("message")), category: category.optional(), command: z32.string().max(1e3).optional(), route: z32.string().max(500).optional(), client: z32.string().max(100).optional() }),
15285
- z32.object({ action: z32.literal("list"), status: status.optional(), limit: z32.number().int().min(1).max(100).optional(), cursor: z32.string().max(2e3).optional(), full: z32.boolean().optional() }),
15286
- z32.object({ action: z32.literal("queue"), status: status.optional(), category: category.optional(), groupId: z32.string().min(1).max(200).optional(), workspaceId: z32.string().max(200).optional(), since: z32.number().optional(), before: z32.number().optional(), limit: z32.number().int().min(1).max(100).optional(), cursor: z32.string().max(2e3).optional(), full: z32.boolean().optional() }),
15287
- z32.object({ action: z32.literal("note"), feedbackId: z32.string().min(1).max(200), note: z32.string().max(4e3).refine(fitsGatewayBytes, byteLimitMessage("note")) }),
15288
- z32.object({ action: z32.literal("group"), feedbackIds: z32.array(z32.string().min(1).max(200)).min(1).max(100), groupId: z32.string().min(1).max(200).nullable() }),
15289
- z32.object({ action: z32.literal("status"), feedbackId: z32.string().min(1).max(200), status: vendorStatus })
15316
+ var union = z33.discriminatedUnion("action", [
15317
+ z33.object({ action: z33.literal("submit"), message: z33.string().min(1).max(1e4).refine(fitsGatewayBytes, byteLimitMessage("message")), category: category.optional(), command: z33.string().max(1e3).optional(), route: z33.string().max(500).optional(), client: z33.string().max(100).optional() }),
15318
+ z33.object({ action: z33.literal("list"), status: status.optional(), limit: z33.number().int().min(1).max(100).optional(), cursor: z33.string().max(2e3).optional(), full: z33.boolean().optional() }),
15319
+ z33.object({ action: z33.literal("queue"), status: status.optional(), category: category.optional(), groupId: z33.string().min(1).max(200).optional(), workspaceId: z33.string().max(200).optional(), since: z33.number().optional(), before: z33.number().optional(), limit: z33.number().int().min(1).max(100).optional(), cursor: z33.string().max(2e3).optional(), full: z33.boolean().optional() }),
15320
+ z33.object({ action: z33.literal("note"), feedbackId: z33.string().min(1).max(200), note: z33.string().max(4e3).refine(fitsGatewayBytes, byteLimitMessage("note")) }),
15321
+ z33.object({ action: z33.literal("group"), feedbackIds: z33.array(z33.string().min(1).max(200)).min(1).max(100), groupId: z33.string().min(1).max(200).nullable() }),
15322
+ z33.object({ action: z33.literal("status"), feedbackId: z33.string().min(1).max(200), status: vendorStatus })
15290
15323
  ]);
15291
15324
  var specs = {
15292
15325
  submit: { params: ["message", "category", "command", "route", "client"], description: "message is required; category defaults to other." },
@@ -15413,34 +15446,34 @@ function registerFeedbackTool(server) {
15413
15446
  }
15414
15447
 
15415
15448
  // src/tools/shape.ts
15416
- import { z as z33 } from "zod/v3";
15449
+ import { z as z34 } from "zod/v3";
15417
15450
  var SHAPE_ACTIONS = ["list", "show", "agree", "dismiss"];
15418
15451
  var LIST_DISPOSITIONS = ["pending", "agreed", "dismissed", "expired"];
15419
15452
  var LIST_OUTCOMES = ["not_candidate", "atomic", "compound", "unavailable"];
15420
- var shapeSchema = z33.object({
15421
- action: z33.enum(SHAPE_ACTIONS).describe(
15453
+ var shapeSchema = z34.object({
15454
+ action: z34.enum(SHAPE_ACTIONS).describe(
15422
15455
  "'list': list shape advisories for this workspace, latest per subject. 'show': show one shape advisory by id. 'agree': agree with a compound advisory's split verdict. 'dismiss': dismiss a compound advisory's split verdict."
15423
15456
  ),
15424
- disposition: z33.enum(LIST_DISPOSITIONS).optional().describe(
15457
+ disposition: z34.enum(LIST_DISPOSITIONS).optional().describe(
15425
15458
  "For 'list': filter by disposition. Omitting both disposition and outcome defaults to the actionable set (disposition:pending, outcome:compound)."
15426
15459
  ),
15427
- outcome: z33.enum(LIST_OUTCOMES).optional().describe(
15460
+ outcome: z34.enum(LIST_OUTCOMES).optional().describe(
15428
15461
  "For 'list': filter by outcome. Omitting both disposition and outcome defaults to the actionable set (disposition:pending, outcome:compound)."
15429
15462
  ),
15430
- limit: z33.number().min(1).max(200).optional().describe("For 'list': max rows (default 50, max 200)."),
15431
- rowId: z33.string().max(200).optional().describe("For 'show'/'agree'/'dismiss': the advisory row id."),
15432
- reason: z33.string().max(1e3).optional().describe("For 'agree'/'dismiss': optional reason (capped at 1000 chars).")
15463
+ limit: z34.number().min(1).max(200).optional().describe("For 'list': max rows (default 50, max 200)."),
15464
+ rowId: z34.string().max(200).optional().describe("For 'show'/'agree'/'dismiss': the advisory row id."),
15465
+ reason: z34.string().max(1e3).optional().describe("For 'agree'/'dismiss': optional reason (capped at 1000 chars).")
15433
15466
  });
15434
- var shapeListVariant = z33.object({
15435
- action: z33.literal("list"),
15436
- disposition: z33.enum(LIST_DISPOSITIONS).optional(),
15437
- outcome: z33.enum(LIST_OUTCOMES).optional(),
15438
- limit: z33.number().min(1).max(200).optional()
15467
+ var shapeListVariant = z34.object({
15468
+ action: z34.literal("list"),
15469
+ disposition: z34.enum(LIST_DISPOSITIONS).optional(),
15470
+ outcome: z34.enum(LIST_OUTCOMES).optional(),
15471
+ limit: z34.number().min(1).max(200).optional()
15439
15472
  });
15440
- var shapeShowVariant = z33.object({ action: z33.literal("show"), rowId: z33.string().max(200) });
15441
- var shapeAgreeVariant = z33.object({ action: z33.literal("agree"), rowId: z33.string().max(200), reason: z33.string().max(1e3).optional() });
15442
- var shapeDismissVariant = z33.object({ action: z33.literal("dismiss"), rowId: z33.string().max(200), reason: z33.string().max(1e3).optional() });
15443
- var shapeActionUnion = z33.discriminatedUnion("action", [
15473
+ var shapeShowVariant = z34.object({ action: z34.literal("show"), rowId: z34.string().max(200) });
15474
+ var shapeAgreeVariant = z34.object({ action: z34.literal("agree"), rowId: z34.string().max(200), reason: z34.string().max(1e3).optional() });
15475
+ var shapeDismissVariant = z34.object({ action: z34.literal("dismiss"), rowId: z34.string().max(200), reason: z34.string().max(1e3).optional() });
15476
+ var shapeActionUnion = z34.discriminatedUnion("action", [
15444
15477
  shapeListVariant,
15445
15478
  shapeShowVariant,
15446
15479
  shapeAgreeVariant,
@@ -15587,31 +15620,31 @@ function registerShapeTools(server) {
15587
15620
  }
15588
15621
 
15589
15622
  // src/tools/question.ts
15590
- import { z as z34 } from "zod/v3";
15623
+ import { z as z35 } from "zod/v3";
15591
15624
  var QUESTION_ACTIONS = ["create", "adopt", "assign", "snooze", "decline", "answer", "force-close", "list"];
15592
- var questionSchema = z34.object({
15593
- action: z34.enum(QUESTION_ACTIONS).describe(
15625
+ var questionSchema = z35.object({
15626
+ action: z35.enum(QUESTION_ACTIONS).describe(
15594
15627
  "'create': create a new routed question from text (domains come from `pb question --help` / this tool's own refusal \u2014 never hardcode a slug). 'adopt': adopt attaches routing to an existing tension or repairs a facet-less question \u2014 create is the birth path (e.g. a tension captured via `pb capture \"TEN: ...\"`). Without adopt, a captured tension stays invisible to routing forever. 'assign': confirm ('take it', omit toRole/toPerson) or reassign (supply toRole and/or toPerson) ownership. 'snooze': defer a routed/escalated question (max 2, then it escalates). 'decline': pass on a suggested question, or (as owner/lead) decline an owned one \u2014 reason required. 'answer': close the loop \u2014 creates the answering entry itself unless --entry is given. 'force-close': Team-Lead-only escape hatch \u2014 reason required. 'list': the ack-gate read model \u2014 what you owe (or, with mine:true, every question you asked, including closed ones)."
15595
15628
  ),
15596
- entryId: z34.string().max(200).optional().describe("Target question's id (human TEN-nnn form or a raw entry id). Required for every action except 'create'/'list'."),
15597
- text: z34.string().max(5e3).optional().describe("'create': the question text. 'answer': the answer text (mutually exclusive with answerEntryId, max 2000 chars)."),
15598
- domain: z34.string().max(200).optional().describe("'create'/'adopt': the domain slug (see this tool's refusal for the live list)."),
15599
- blocks: z34.array(z34.string().max(200)).max(50).optional().describe("'create'/'adopt': entry ids this question is blocking (repeatable)."),
15600
- toRole: z34.string().max(200).optional().describe("'assign': reassign to this role (human ROL-nnn form or a raw entry id)."),
15601
- toPerson: z34.string().max(200).optional().describe("'assign': reassign to this person (a raw person id)."),
15602
- reason: z34.string().max(2e3).optional().describe("'decline'/'force-close': required reason."),
15603
- answerEntryId: z34.string().max(200).optional().describe("'answer': point at an already-written entry instead of supplying text (mutually exclusive with text)."),
15604
- mine: z34.boolean().optional().describe("'list': true for arm C (every question YOU asked, every status). Omit/false for the ack-gate view (what you owe).")
15629
+ entryId: z35.string().max(200).optional().describe("Target question's id (human TEN-nnn form or a raw entry id). Required for every action except 'create'/'list'."),
15630
+ text: z35.string().max(5e3).optional().describe("'create': the question text. 'answer': the answer text (mutually exclusive with answerEntryId, max 2000 chars)."),
15631
+ domain: z35.string().max(200).optional().describe("'create'/'adopt': the domain slug (see this tool's refusal for the live list)."),
15632
+ blocks: z35.array(z35.string().max(200)).max(50).optional().describe("'create'/'adopt': entry ids this question is blocking (repeatable)."),
15633
+ toRole: z35.string().max(200).optional().describe("'assign': reassign to this role (human ROL-nnn form or a raw entry id)."),
15634
+ toPerson: z35.string().max(200).optional().describe("'assign': reassign to this person (a raw person id)."),
15635
+ reason: z35.string().max(2e3).optional().describe("'decline'/'force-close': required reason."),
15636
+ answerEntryId: z35.string().max(200).optional().describe("'answer': point at an already-written entry instead of supplying text (mutually exclusive with text)."),
15637
+ mine: z35.boolean().optional().describe("'list': true for arm C (every question YOU asked, every status). Omit/false for the ack-gate view (what you owe).")
15605
15638
  });
15606
- var createVariant = z34.object({ action: z34.literal("create"), text: z34.string().min(1).max(5e3), domain: z34.string().max(200).optional(), blocks: z34.array(z34.string().max(200)).max(50).optional() });
15607
- var adoptVariant = z34.object({ action: z34.literal("adopt"), entryId: z34.string().max(200), domain: z34.string().max(200).optional(), blocks: z34.array(z34.string().max(200)).max(50).optional() });
15608
- var assignVariant = z34.object({ action: z34.literal("assign"), entryId: z34.string().max(200), toRole: z34.string().max(200).optional(), toPerson: z34.string().max(200).optional() });
15609
- var snoozeVariant = z34.object({ action: z34.literal("snooze"), entryId: z34.string().max(200) });
15610
- var declineVariant = z34.object({ action: z34.literal("decline"), entryId: z34.string().max(200), reason: z34.string().min(1).max(2e3) });
15611
- var answerVariant = z34.object({ action: z34.literal("answer"), entryId: z34.string().max(200), text: z34.string().max(2e3).optional(), answerEntryId: z34.string().max(200).optional() });
15612
- var forceCloseVariant = z34.object({ action: z34.literal("force-close"), entryId: z34.string().max(200), reason: z34.string().min(1).max(2e3) });
15613
- var listVariant = z34.object({ action: z34.literal("list"), mine: z34.boolean().optional() });
15614
- var questionActionUnion = z34.discriminatedUnion("action", [
15639
+ var createVariant = z35.object({ action: z35.literal("create"), text: z35.string().min(1).max(5e3), domain: z35.string().max(200).optional(), blocks: z35.array(z35.string().max(200)).max(50).optional() });
15640
+ var adoptVariant = z35.object({ action: z35.literal("adopt"), entryId: z35.string().max(200), domain: z35.string().max(200).optional(), blocks: z35.array(z35.string().max(200)).max(50).optional() });
15641
+ var assignVariant = z35.object({ action: z35.literal("assign"), entryId: z35.string().max(200), toRole: z35.string().max(200).optional(), toPerson: z35.string().max(200).optional() });
15642
+ var snoozeVariant = z35.object({ action: z35.literal("snooze"), entryId: z35.string().max(200) });
15643
+ var declineVariant = z35.object({ action: z35.literal("decline"), entryId: z35.string().max(200), reason: z35.string().min(1).max(2e3) });
15644
+ var answerVariant = z35.object({ action: z35.literal("answer"), entryId: z35.string().max(200), text: z35.string().max(2e3).optional(), answerEntryId: z35.string().max(200).optional() });
15645
+ var forceCloseVariant = z35.object({ action: z35.literal("force-close"), entryId: z35.string().max(200), reason: z35.string().min(1).max(2e3) });
15646
+ var listVariant = z35.object({ action: z35.literal("list"), mine: z35.boolean().optional() });
15647
+ var questionActionUnion = z35.discriminatedUnion("action", [
15615
15648
  createVariant,
15616
15649
  adoptVariant,
15617
15650
  assignVariant,
@@ -15854,23 +15887,23 @@ function registerQuestionTools(server) {
15854
15887
  }
15855
15888
 
15856
15889
  // src/tools/role.ts
15857
- import { z as z35 } from "zod/v3";
15890
+ import { z as z36 } from "zod/v3";
15858
15891
  var ROLE_ACTIONS = ["accountable"];
15859
- var roleSchema = z35.object({
15860
- action: z35.enum(ROLE_ACTIONS).describe("'accountable': what this role owns (explicit), reports on (reporting), and \u2014 not yet computed \u2014 inherits via Team-Lead vacancy coverage."),
15861
- roleId: z35.string().max(200).optional().describe("The role, by the human chain id `chain.getEntry` or `pb get` would print for it, or a raw entry id. Required for 'accountable'."),
15862
- canonicalKey: z35.string().max(200).optional().describe("'accountable': narrow to one kind (e.g. objective, key_result, tension)."),
15863
- limit: z35.number().int().positive().max(200).optional().describe("'accountable': max explicit-list rows per page (default and maximum 200)."),
15864
- cursor: z35.number().optional().describe("'accountable': continue the explicit list from an earlier truncated page's nextCursor.")
15892
+ var roleSchema = z36.object({
15893
+ action: z36.enum(ROLE_ACTIONS).describe("'accountable': what this role owns (explicit), reports on (reporting), and \u2014 not yet computed \u2014 inherits via Team-Lead vacancy coverage."),
15894
+ roleId: z36.string().max(200).optional().describe("The role, by the human chain id `chain.getEntry` or `pb get` would print for it, or a raw entry id. Required for 'accountable'."),
15895
+ canonicalKey: z36.string().max(200).optional().describe("'accountable': narrow to one kind (e.g. objective, key_result, tension)."),
15896
+ limit: z36.number().int().positive().max(200).optional().describe("'accountable': max explicit-list rows per page (default and maximum 200)."),
15897
+ cursor: z36.number().optional().describe("'accountable': continue the explicit list from an earlier truncated page's nextCursor.")
15865
15898
  });
15866
- var accountableVariant = z35.object({
15867
- action: z35.literal("accountable"),
15868
- roleId: z35.string().max(200),
15869
- canonicalKey: z35.string().max(200).optional(),
15870
- limit: z35.number().int().positive().max(200).optional(),
15871
- cursor: z35.number().optional()
15899
+ var accountableVariant = z36.object({
15900
+ action: z36.literal("accountable"),
15901
+ roleId: z36.string().max(200),
15902
+ canonicalKey: z36.string().max(200).optional(),
15903
+ limit: z36.number().int().positive().max(200).optional(),
15904
+ cursor: z36.number().optional()
15872
15905
  });
15873
- var roleActionUnion = z35.discriminatedUnion("action", [accountableVariant]);
15906
+ var roleActionUnion = z36.discriminatedUnion("action", [accountableVariant]);
15874
15907
  var ROLE_ACTION_SPECS = {
15875
15908
  accountable: { params: ["roleId", "canonicalKey", "limit", "cursor"], description: "roleId is required; canonicalKey/limit/cursor are optional." }
15876
15909
  };
@@ -15943,49 +15976,49 @@ function registerRoleTools(server) {
15943
15976
  }
15944
15977
 
15945
15978
  // src/tools/outcome.ts
15946
- import { z as z36 } from "zod/v3";
15979
+ import { z as z37 } from "zod/v3";
15947
15980
  var OUTCOME_ACTIONS = ["record", "list", "show"];
15948
15981
  var READING_KINDS = ["measurement", "estimate", "correction"];
15949
- var outcomeSchema = z36.object({
15950
- action: z36.enum(OUTCOME_ACTIONS).describe(
15982
+ var outcomeSchema = z37.object({
15983
+ action: z37.enum(OUTCOME_ACTIONS).describe(
15951
15984
  "'record': record a reading (evidence, not a verdict). 'list': list readings, newest first. 'show': the derived view \u2014 current, progress, pace, staleness, recorded completion."
15952
15985
  ),
15953
- entryId: z36.string().max(200).optional().describe("The key result (or other outcome-bearing) entry, by its chain id. Required for all three actions."),
15986
+ entryId: z37.string().max(200).optional().describe("The key result (or other outcome-bearing) entry, by its chain id. Required for all three actions."),
15954
15987
  // PR #858 review round 3 (Codex P2, PRRT_kwDORS4ils6gXHj9): a JSON number that overflows to
15955
15988
  // `Infinity` (e.g. `1e400`) parses fine in JS and passes a plain `z.number()`, but
15956
15989
  // `callGateway()` serializes it with `JSON.stringify`, which turns `Infinity` into `null` —
15957
15990
  // the backend's `v.number()` validator then rejects a call this tool's own schema accepted.
15958
15991
  // `.finite()` rejects it here, matching the explicit finite-value checks the CLI/other outcome
15959
15992
  // entry surfaces already use.
15960
- value: z36.number().finite().optional().describe("'record': the measured value. Required for 'record'."),
15961
- valueText: z36.string().max(500).optional().describe("'record': verbatim as-reported form when the source was not clean, e.g. '~62%'. Display only."),
15962
- asOf: z36.string().max(64).optional().describe("'record': when the world was in this state, as a parseable date (default: now). Back-dating a backfill is legitimate \u2014 it shows up as asOf earlier than recordedAt."),
15963
- kind: z36.enum(READING_KINDS).optional().describe("'record': measurement | estimate | correction (default: measurement)."),
15964
- correctsReadingId: z36.string().max(200).optional().describe("'record': required with kind='correction' \u2014 the reading id this replaces. Refused if that row is already superseded."),
15965
- recordedByRoleId: z36.string().max(200).optional().describe("'record': the accountable role (default: the entry's reporterRoleId, then ownerRoleId)."),
15966
- note: z36.string().max(2e3).optional().describe("'record': free-text note recorded with the reading."),
15967
- source: z36.string().max(500).optional().describe("'record': where the number came from \u2014 a dashboard name, a query, a URL."),
15968
- limit: z36.number().int().positive().max(200).optional().describe("'list': max rows to return (default and maximum 200).")
15993
+ value: z37.number().finite().optional().describe("'record': the measured value. Required for 'record'."),
15994
+ valueText: z37.string().max(500).optional().describe("'record': verbatim as-reported form when the source was not clean, e.g. '~62%'. Display only."),
15995
+ asOf: z37.string().max(64).optional().describe("'record': when the world was in this state, as a parseable date (default: now). Back-dating a backfill is legitimate \u2014 it shows up as asOf earlier than recordedAt."),
15996
+ kind: z37.enum(READING_KINDS).optional().describe("'record': measurement | estimate | correction (default: measurement)."),
15997
+ correctsReadingId: z37.string().max(200).optional().describe("'record': required with kind='correction' \u2014 the reading id this replaces. Refused if that row is already superseded."),
15998
+ recordedByRoleId: z37.string().max(200).optional().describe("'record': the accountable role (default: the entry's reporterRoleId, then ownerRoleId)."),
15999
+ note: z37.string().max(2e3).optional().describe("'record': free-text note recorded with the reading."),
16000
+ source: z37.string().max(500).optional().describe("'record': where the number came from \u2014 a dashboard name, a query, a URL."),
16001
+ limit: z37.number().int().positive().max(200).optional().describe("'list': max rows to return (default and maximum 200).")
15969
16002
  });
15970
- var recordVariant = z36.object({
15971
- action: z36.literal("record"),
15972
- entryId: z36.string().max(200),
15973
- value: z36.number().finite(),
15974
- valueText: z36.string().max(500).optional(),
15975
- asOf: z36.string().max(64).optional(),
15976
- kind: z36.enum(READING_KINDS).optional(),
15977
- correctsReadingId: z36.string().max(200).optional(),
15978
- recordedByRoleId: z36.string().max(200).optional(),
15979
- note: z36.string().max(2e3).optional(),
15980
- source: z36.string().max(500).optional()
16003
+ var recordVariant = z37.object({
16004
+ action: z37.literal("record"),
16005
+ entryId: z37.string().max(200),
16006
+ value: z37.number().finite(),
16007
+ valueText: z37.string().max(500).optional(),
16008
+ asOf: z37.string().max(64).optional(),
16009
+ kind: z37.enum(READING_KINDS).optional(),
16010
+ correctsReadingId: z37.string().max(200).optional(),
16011
+ recordedByRoleId: z37.string().max(200).optional(),
16012
+ note: z37.string().max(2e3).optional(),
16013
+ source: z37.string().max(500).optional()
15981
16014
  });
15982
- var listVariant2 = z36.object({
15983
- action: z36.literal("list"),
15984
- entryId: z36.string().max(200),
15985
- limit: z36.number().int().positive().max(200).optional()
16015
+ var listVariant2 = z37.object({
16016
+ action: z37.literal("list"),
16017
+ entryId: z37.string().max(200),
16018
+ limit: z37.number().int().positive().max(200).optional()
15986
16019
  });
15987
- var showVariant = z36.object({ action: z36.literal("show"), entryId: z36.string().max(200) });
15988
- var outcomeActionUnion = z36.discriminatedUnion("action", [recordVariant, listVariant2, showVariant]);
16020
+ var showVariant = z37.object({ action: z37.literal("show"), entryId: z37.string().max(200) });
16021
+ var outcomeActionUnion = z37.discriminatedUnion("action", [recordVariant, listVariant2, showVariant]);
15989
16022
  var OUTCOME_ACTION_SPECS = {
15990
16023
  record: {
15991
16024
  params: ["entryId", "value", "valueText", "asOf", "kind", "correctsReadingId", "recordedByRoleId", "note", "source"],
@@ -16697,12 +16730,12 @@ ${entry.labels.map((l) => `- ${l.name ?? l.slug}`).join("\n")}`);
16697
16730
  }
16698
16731
 
16699
16732
  // src/prompts/index.ts
16700
- import { z as z37 } from "zod/v3";
16733
+ import { z as z38 } from "zod/v3";
16701
16734
  function registerPrompts(server) {
16702
16735
  server.prompt(
16703
16736
  "review-against-rules",
16704
16737
  "Review code or a design decision against all business rules for a given domain. Fetches the rules and asks you to do a structured compliance review.",
16705
- { domain: z37.string().describe("Business rule domain (e.g. 'Identity & Access', 'Governance & Decision-Making')") },
16738
+ { domain: z38.string().describe("Business rule domain (e.g. 'Identity & Access', 'Governance & Decision-Making')") },
16706
16739
  async ({ domain }) => {
16707
16740
  const entries = await kernelQuery("chain.listEntries", { collectionSlug: "business-rules" });
16708
16741
  const rules = entries.filter((e) => e.data?.domain === domain);
@@ -16755,7 +16788,7 @@ Provide a structured review with a compliance status for each rule (COMPLIANT /
16755
16788
  server.prompt(
16756
16789
  "name-check",
16757
16790
  "Check variable names, field names, or API names against the glossary for terminology alignment. Flags drift from canonical terms.",
16758
- { names: z37.string().describe("Comma-separated list of names to check (e.g. 'vendor_id, compliance_level, formulator_type')") },
16791
+ { names: z38.string().describe("Comma-separated list of names to check (e.g. 'vendor_id, compliance_level, formulator_type')") },
16759
16792
  async ({ names }) => {
16760
16793
  const terms = await kernelQuery("chain.listEntries", { collectionSlug: "glossary" });
16761
16794
  const glossaryContext = terms.map(
@@ -16791,7 +16824,7 @@ Format as a table: Name | Status | Canonical Form | Action Needed`
16791
16824
  server.prompt(
16792
16825
  "draft-decision-record",
16793
16826
  "Draft a structured decision record from a description of what was decided. Includes context from recent decisions and relevant rules.",
16794
- { context: z37.string().describe("Description of the decision (e.g. 'We decided to use MRSL v3.1 as the conformance baseline because...')") },
16827
+ { context: z38.string().describe("Description of the decision (e.g. 'We decided to use MRSL v3.1 as the conformance baseline because...')") },
16795
16828
  async ({ context }) => {
16796
16829
  const recentDecisions = await kernelQuery("chain.listEntries", { collectionSlug: "decisions" });
16797
16830
  const sorted = [...recentDecisions].sort((a, b) => (b.data?.date ?? "") > (a.data?.date ?? "") ? 1 : -1).slice(0, 5);
@@ -16829,8 +16862,8 @@ After drafting, I can log it using the capture tool with collection "decisions".
16829
16862
  "draft-rule-from-context",
16830
16863
  "Draft a new business rule from an observation or discovery made while coding. Fetches existing rules for the domain to ensure consistency.",
16831
16864
  {
16832
- observation: z37.string().describe("What you observed or discovered (e.g. 'Suppliers can have multiple org types in Gateway')"),
16833
- domain: z37.string().describe("Which domain this rule belongs to (e.g. 'Governance & Decision-Making')")
16865
+ observation: z38.string().describe("What you observed or discovered (e.g. 'Suppliers can have multiple org types in Gateway')"),
16866
+ domain: z38.string().describe("Which domain this rule belongs to (e.g. 'Governance & Decision-Making')")
16834
16867
  },
16835
16868
  async ({ observation, domain }) => {
16836
16869
  const allRules = await kernelQuery("chain.listEntries", { collectionSlug: "business-rules" });
@@ -17096,4 +17129,4 @@ export {
17096
17129
  createProductBrainServer,
17097
17130
  initFeatureFlags
17098
17131
  };
17099
- //# sourceMappingURL=chunk-CX7V7DP4.js.map
17132
+ //# sourceMappingURL=chunk-NG2XM3QC.js.map