@productbrain/mcp 0.0.1-beta.2831 → 0.0.1-beta.2856

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.
@@ -46,7 +46,7 @@ import {
46
46
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
47
47
 
48
48
  // src/tools/entries.ts
49
- import { z as z5 } from "zod/v3";
49
+ import { z as z6 } from "zod/v3";
50
50
 
51
51
  // src/envelope.ts
52
52
  import { z } from "zod/v3";
@@ -4083,6 +4083,69 @@ async function handleVerifyEntry({ entryId }) {
4083
4083
  return successResult(message, message, result2);
4084
4084
  }
4085
4085
 
4086
+ // src/tools/entry-move.ts
4087
+ import { z as z5 } from "zod/v3";
4088
+ var moveEntrySchema = z5.object({
4089
+ entryId: z5.string().describe("Entry ID to move, e.g. '<PREFIX>-<n>'"),
4090
+ toCollection: z5.string().describe("Target collection slug, e.g. 'decisions', 'architecture'")
4091
+ });
4092
+ async function handleMoveEntry(entryId, toCollection) {
4093
+ try {
4094
+ const sessionId = getAgentSessionId();
4095
+ const result2 = await kernelMutation("chain.moveToCollection", {
4096
+ entryId,
4097
+ toCollectionSlug: toCollection,
4098
+ changedBy: sessionId ? `agent:${sessionId}` : void 0
4099
+ });
4100
+ if (result2.outcome === "refused") {
4101
+ const recovery = result2.refusal.requiredAction ?? "Ask the record owner or relevant Team Lead for the required authority change.";
4102
+ return failureResult(
4103
+ `Move refused for **${entryId}**.
4104
+
4105
+ ${result2.refusal.reason}
4106
+
4107
+ ${recovery}`,
4108
+ "AUTHORITY_REFUSED",
4109
+ result2.refusal.reason,
4110
+ recovery,
4111
+ void 0,
4112
+ { entryId, toCollection, refusal: result2.refusal }
4113
+ );
4114
+ }
4115
+ const lines = [
4116
+ `## Move Result`,
4117
+ "",
4118
+ `Moved **${result2.entryId}** from \`${result2.fromCollection}\` \u2192 \`${result2.toCollection}\``
4119
+ ];
4120
+ if (result2.workflowStatusReset) {
4121
+ lines.push(``, `\u26A0\uFE0F Workflow status \`${result2.previousWorkflowStatus}\` was reset (incompatible with target collection).`);
4122
+ }
4123
+ return {
4124
+ content: [{ type: "text", text: lines.join("\n") }],
4125
+ structuredContent: success(
4126
+ `Moved ${result2.entryId} from ${result2.fromCollection} to ${result2.toCollection}.`,
4127
+ result2,
4128
+ [
4129
+ { tool: "entries", description: "View updated entry", parameters: { action: "get", entryId } },
4130
+ { tool: "quality", description: "Re-check quality", parameters: { action: "check", entryId } }
4131
+ ]
4132
+ )
4133
+ };
4134
+ } catch (error) {
4135
+ const msg = error instanceof Error ? error.message : String(error);
4136
+ if (msg.includes("not found")) {
4137
+ return notFoundResult(entryId, `Could not move entry: ${msg}`);
4138
+ }
4139
+ return failureResult(
4140
+ `Could not move **${entryId}** to \`${toCollection}\`: ${msg}`,
4141
+ "MOVE_FAILED",
4142
+ msg,
4143
+ "Check the entry ID and target collection slug, then retry.",
4144
+ [{ tool: "entries", description: "Search for entry", parameters: { action: "search", query: entryId } }]
4145
+ );
4146
+ }
4147
+ }
4148
+
4086
4149
  // src/tools/entries.ts
4087
4150
  function sanitizeEntryData(data) {
4088
4151
  if (!data || typeof data !== "object") return void 0;
@@ -4135,89 +4198,89 @@ var ENTRIES_ACTIONS = [
4135
4198
  "move",
4136
4199
  "verify"
4137
4200
  ];
4138
- var coherencyAcknowledgementFlatSchema = z5.object({
4139
- response: z5.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
4140
- entryId: z5.string().max(200).optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
4141
- reason: z5.string().max(2e3).optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
4201
+ var coherencyAcknowledgementFlatSchema = z6.object({
4202
+ response: z6.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
4203
+ entryId: z6.string().max(200).optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
4204
+ reason: z6.string().max(2e3).optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
4142
4205
  });
4143
- var entriesSchema = z5.object({
4144
- action: z5.enum(ENTRIES_ACTIONS).describe(
4206
+ var entriesSchema = z6.object({
4207
+ action: z6.enum(ENTRIES_ACTIONS).describe(
4145
4208
  "'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': reclassify an entry to a different collection. 'verify': mark an entry as verified (lightweight \u2014 no codebase scan; see `quality action=verify-chain` for the codebase-scanning check)."
4146
4209
  ),
4147
- entryId: z5.string().max(200).optional().describe(
4210
+ entryId: z6.string().max(200).optional().describe(
4148
4211
  "Entry ID, e.g. '<PREFIX>-<n>'. Required for: get, update, commit, history, move, verify."
4149
4212
  ),
4150
- entryIds: z5.array(z5.string().max(200)).min(1).max(20).optional().describe("Entry IDs for 'batch', e.g. ['TYPE-strategy', 'STR-jljeg7']"),
4151
- collection: z5.string().max(200).optional().describe("Collection slug \u2014 for 'list'/'search': scope filter, e.g. 'glossary', 'tracking-events'."),
4152
- status: z5.string().max(200).optional().describe(
4213
+ entryIds: z6.array(z6.string().max(200)).min(1).max(20).optional().describe("Entry IDs for 'batch', e.g. ['TYPE-strategy', 'STR-jljeg7']"),
4214
+ collection: z6.string().max(200).optional().describe("Collection slug \u2014 for 'list'/'search': scope filter, e.g. 'glossary', 'tracking-events'."),
4215
+ status: z6.string().max(200).optional().describe(
4153
4216
  "For 'list'/'search': filter string (draft | active | deprecated | archived). For 'update': lifecycle value to set (draft | active | deprecated | archived \u2014 legacy workflow values still route through here with a deprecation warning until 2026-09-03; use `workflowStatus` instead)."
4154
4217
  ),
4155
- tag: z5.string().max(200).optional().describe("For 'list': filter by internal tag."),
4156
- label: z5.string().max(200).optional().describe("For 'list': filter by label slug \u2014 matches entries across all collections."),
4157
- query: z5.string().min(2).max(500).optional().describe("For 'search': search text (min 2 characters)."),
4158
- name: z5.string().max(500).optional().describe("For 'update': new display name."),
4159
- workflowStatus: z5.string().max(200).optional().describe(
4218
+ tag: z6.string().max(200).optional().describe("For 'list': filter by internal tag."),
4219
+ label: z6.string().max(200).optional().describe("For 'list': filter by label slug \u2014 matches entries across all collections."),
4220
+ query: z6.string().min(2).max(500).optional().describe("For 'search': search text (min 2 characters)."),
4221
+ name: z6.string().max(500).optional().describe("For 'update': new display name."),
4222
+ workflowStatus: z6.string().max(200).optional().describe(
4160
4223
  "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."
4161
4224
  ),
4162
- data: z5.record(z5.unknown()).optional().describe("For 'update': fields to update (merged with existing data)."),
4163
- order: z5.number().optional().describe("For 'update': new sort order."),
4164
- canonicalKey: z5.string().max(200).optional().describe(
4225
+ data: z6.record(z6.unknown()).optional().describe("For 'update': fields to update (merged with existing data)."),
4226
+ order: z6.number().optional().describe("For 'update': new sort order."),
4227
+ canonicalKey: z6.string().max(200).optional().describe(
4165
4228
  "For 'update': semantic type (e.g. 'decision', 'tension'). Only changeable on draft/uncommitted entries."
4166
4229
  ),
4167
- autoPublish: z5.boolean().optional().default(false).describe(
4230
+ autoPublish: z6.boolean().optional().default(false).describe(
4168
4231
  "For 'update': only true when the user explicitly asks to publish. Default false = draft."
4169
4232
  ),
4170
- changeNote: z5.string().max(2e3).optional().describe(
4233
+ changeNote: z6.string().max(2e3).optional().describe(
4171
4234
  "For 'update': short human-readable rationale for WHY this change was made. Surfaces in activity feed."
4172
4235
  ),
4173
- sourceRef: z5.string().max(2e3).optional().describe(
4236
+ sourceRef: z6.string().max(2e3).optional().describe(
4174
4237
  "For 'update': URI or path of the source document backing this entry. Write-once."
4175
4238
  ),
4176
- sourceExcerpt: z5.string().max(5e3).optional().describe(
4239
+ sourceExcerpt: z6.string().max(5e3).optional().describe(
4177
4240
  "For 'update': verbatim excerpt from the source backing this entry's claims. Write-once."
4178
4241
  ),
4179
- steeringOverrideReason: z5.string().max(2e3).optional().describe(
4242
+ steeringOverrideReason: z6.string().max(2e3).optional().describe(
4180
4243
  "For 'update'/'commit': typed override (\u226512 chars) that clears a steering coherency block."
4181
4244
  ),
4182
4245
  coherencyAcknowledgement: coherencyAcknowledgementFlatSchema.optional().describe(
4183
4246
  "For 'update'/'commit': explicit response to a coherency challenge (standard/strict workspace modes)."
4184
4247
  ),
4185
- preview: z5.boolean().optional().describe(
4248
+ preview: z6.boolean().optional().describe(
4186
4249
  "For 'commit': if true, validates the accept without writing \u2014 returns what would happen."
4187
4250
  ),
4188
- toCollection: z5.string().max(200).optional().describe("For 'move': target collection slug, e.g. 'decisions', 'architecture'.")
4251
+ toCollection: z6.string().max(200).optional().describe("For 'move': target collection slug, e.g. 'decisions', 'architecture'.")
4189
4252
  });
4190
- var entriesListVariant = z5.object({
4191
- action: z5.literal("list"),
4192
- collection: z5.string().max(200).optional(),
4193
- status: z5.string().max(200).optional(),
4194
- tag: z5.string().max(200).optional(),
4195
- label: z5.string().max(200).optional()
4253
+ var entriesListVariant = z6.object({
4254
+ action: z6.literal("list"),
4255
+ collection: z6.string().max(200).optional(),
4256
+ status: z6.string().max(200).optional(),
4257
+ tag: z6.string().max(200).optional(),
4258
+ label: z6.string().max(200).optional()
4196
4259
  });
4197
- var entriesGetVariant = z5.object({
4198
- action: z5.literal("get"),
4199
- entryId: z5.string().max(200)
4260
+ var entriesGetVariant = z6.object({
4261
+ action: z6.literal("get"),
4262
+ entryId: z6.string().max(200)
4200
4263
  });
4201
- var entriesBatchVariant = z5.object({
4202
- action: z5.literal("batch"),
4203
- entryIds: z5.array(z5.string().max(200)).min(1).max(20)
4264
+ var entriesBatchVariant = z6.object({
4265
+ action: z6.literal("batch"),
4266
+ entryIds: z6.array(z6.string().max(200)).min(1).max(20)
4204
4267
  });
4205
- var entriesSearchVariant = z5.object({
4206
- action: z5.literal("search"),
4207
- query: z5.string().min(2).max(500),
4208
- collection: z5.string().max(200).optional(),
4209
- status: z5.string().max(200).optional()
4268
+ var entriesSearchVariant = z6.object({
4269
+ action: z6.literal("search"),
4270
+ query: z6.string().min(2).max(500),
4271
+ collection: z6.string().max(200).optional(),
4272
+ status: z6.string().max(200).optional()
4210
4273
  });
4211
- var entriesUpdateVariant = updateEntrySchema.extend({ action: z5.literal("update") });
4212
- var entriesCommitVariant = commitEntrySchema.extend({ action: z5.literal("commit") });
4213
- var entriesHistoryVariant = getHistorySchema.extend({ action: z5.literal("history") });
4214
- var entriesMoveVariant = z5.object({
4215
- action: z5.literal("move"),
4216
- entryId: z5.string().max(200),
4217
- toCollection: z5.string().max(200)
4274
+ var entriesUpdateVariant = updateEntrySchema.extend({ action: z6.literal("update") });
4275
+ var entriesCommitVariant = commitEntrySchema.extend({ action: z6.literal("commit") });
4276
+ var entriesHistoryVariant = getHistorySchema.extend({ action: z6.literal("history") });
4277
+ var entriesMoveVariant = z6.object({
4278
+ action: z6.literal("move"),
4279
+ entryId: z6.string().max(200),
4280
+ toCollection: z6.string().max(200)
4218
4281
  });
4219
- var entriesVerifyVariant = verifyEntrySchema.extend({ action: z5.literal("verify") });
4220
- var entriesActionUnion = z5.discriminatedUnion("action", [
4282
+ var entriesVerifyVariant = verifyEntrySchema.extend({ action: z6.literal("verify") });
4283
+ var entriesActionUnion = z6.discriminatedUnion("action", [
4221
4284
  entriesListVariant,
4222
4285
  entriesGetVariant,
4223
4286
  entriesBatchVariant,
@@ -4239,19 +4302,15 @@ var ENTRIES_ACTION_SPECS = {
4239
4302
  move: { params: ["entryId", "toCollection"], description: "Both entryId and toCollection are required." },
4240
4303
  verify: { params: ["entryId"], description: "entryId is required." }
4241
4304
  };
4242
- var moveEntrySchema = z5.object({
4243
- entryId: z5.string().describe("Entry ID to move, e.g. '<PREFIX>-<n>'"),
4244
- toCollection: z5.string().describe("Target collection slug, e.g. 'decisions', 'architecture'")
4245
- });
4246
- var entriesGetOutputSchema = z5.object({
4247
- entryId: z5.string(),
4248
- name: z5.string(),
4249
- collection: z5.string(),
4250
- status: z5.string(),
4251
- capturedAt: z5.number().optional(),
4252
- origin: z5.string().optional(),
4253
- originDetail: z5.string().optional(),
4254
- verificationStatus: z5.string().optional(),
4305
+ var entriesGetOutputSchema = z6.object({
4306
+ entryId: z6.string(),
4307
+ name: z6.string(),
4308
+ collection: z6.string(),
4309
+ status: z6.string(),
4310
+ capturedAt: z6.number().optional(),
4311
+ origin: z6.string().optional(),
4312
+ originDetail: z6.string().optional(),
4313
+ verificationStatus: z6.string().optional(),
4255
4314
  // Attestation-model finding (PR #341 review): the server's honest verifier label and
4256
4315
  // derived attestation strength/basis — connectors NEVER re-derive strength (spec §5),
4257
4316
  // they only render what chain.getEntry ships. Mirrors packages/cli EntryFromApi.
@@ -4260,72 +4319,72 @@ var entriesGetOutputSchema = z5.object({
4260
4319
  // attestation.ts's AttestationStrength SSOT (allowlisted in Check D —
4261
4320
  // scripts/check-collection-ssot.mjs's CHECK_D_ALLOWLIST — with the full
4262
4321
  // reasoning for why this can't just import that module). Update both together.
4263
- verifiedBy: z5.string().optional(),
4264
- attestation: z5.object({
4265
- strength: z5.enum(["human-direct", "delegated", "system", "unattested"]),
4266
- basis: z5.string().optional()
4322
+ verifiedBy: z6.string().optional(),
4323
+ attestation: z6.object({
4324
+ strength: z6.enum(["human-direct", "delegated", "system", "unattested"]),
4325
+ basis: z6.string().optional()
4267
4326
  }).optional(),
4268
- sourceRef: z5.string().optional(),
4269
- sourceExcerpt: z5.string().optional(),
4270
- why: z5.string().optional(),
4327
+ sourceRef: z6.string().optional(),
4328
+ sourceExcerpt: z6.string().optional(),
4329
+ why: z6.string().optional(),
4271
4330
  // TEN-2191: quality of the captured WHY — 'rationale' | 'missing' | 'restated'.
4272
- whyQuality: z5.enum(["rationale", "missing", "restated"]).optional(),
4273
- data: z5.record(z5.unknown()).optional(),
4274
- relations: z5.array(z5.object({
4275
- entryId: z5.string().optional(),
4276
- name: z5.string(),
4277
- type: z5.string(),
4278
- direction: z5.string()
4331
+ whyQuality: z6.enum(["rationale", "missing", "restated"]).optional(),
4332
+ data: z6.record(z6.unknown()).optional(),
4333
+ relations: z6.array(z6.object({
4334
+ entryId: z6.string().optional(),
4335
+ name: z6.string(),
4336
+ type: z6.string(),
4337
+ direction: z6.string()
4279
4338
  })).optional(),
4280
- labels: z5.array(z5.string()).optional()
4339
+ labels: z6.array(z6.string()).optional()
4281
4340
  }).passthrough();
4282
- var entriesListOutputSchema = z5.object({
4283
- entries: z5.array(z5.object({
4284
- entryId: z5.string(),
4285
- name: z5.string(),
4286
- collection: z5.string(),
4287
- status: z5.string()
4341
+ var entriesListOutputSchema = z6.object({
4342
+ entries: z6.array(z6.object({
4343
+ entryId: z6.string(),
4344
+ name: z6.string(),
4345
+ collection: z6.string(),
4346
+ status: z6.string()
4288
4347
  })),
4289
- total: z5.number()
4348
+ total: z6.number()
4290
4349
  });
4291
- var entriesSearchOutputSchema = z5.object({
4292
- results: z5.array(z5.object({
4293
- entryId: z5.string(),
4294
- name: z5.string(),
4295
- collection: z5.string(),
4296
- status: z5.string(),
4297
- score: z5.number().optional()
4350
+ var entriesSearchOutputSchema = z6.object({
4351
+ results: z6.array(z6.object({
4352
+ entryId: z6.string(),
4353
+ name: z6.string(),
4354
+ collection: z6.string(),
4355
+ status: z6.string(),
4356
+ score: z6.number().optional()
4298
4357
  })),
4299
- total: z5.number(),
4300
- query: z5.string()
4358
+ total: z6.number(),
4359
+ query: z6.string()
4301
4360
  });
4302
- var entriesBatchOutputSchema = z5.object({
4303
- entries: z5.array(z5.object({
4304
- entryId: z5.string(),
4305
- name: z5.string(),
4306
- collection: z5.string(),
4307
- status: z5.string(),
4308
- capturedAt: z5.number().optional(),
4309
- origin: z5.string().optional(),
4310
- originDetail: z5.string().optional(),
4311
- verificationStatus: z5.string().optional(),
4361
+ var entriesBatchOutputSchema = z6.object({
4362
+ entries: z6.array(z6.object({
4363
+ entryId: z6.string(),
4364
+ name: z6.string(),
4365
+ collection: z6.string(),
4366
+ status: z6.string(),
4367
+ capturedAt: z6.number().optional(),
4368
+ origin: z6.string().optional(),
4369
+ originDetail: z6.string().optional(),
4370
+ verificationStatus: z6.string().optional(),
4312
4371
  // Attestation-model finding (PR #341 review): mirror entriesGetOutputSchema — batch
4313
4372
  // entries now carry the same honest verifiedBy/attestation fields. Literal set is
4314
4373
  // the same hand-kept SSOT mirror — see entriesGetOutputSchema's attestation
4315
4374
  // comment above for the full Check D / kernel-import reasoning.
4316
- verifiedBy: z5.string().optional(),
4317
- attestation: z5.object({
4318
- strength: z5.enum(["human-direct", "delegated", "system", "unattested"]),
4319
- basis: z5.string().optional()
4375
+ verifiedBy: z6.string().optional(),
4376
+ attestation: z6.object({
4377
+ strength: z6.enum(["human-direct", "delegated", "system", "unattested"]),
4378
+ basis: z6.string().optional()
4320
4379
  }).optional(),
4321
- sourceRef: z5.string().optional(),
4322
- sourceExcerpt: z5.string().optional(),
4380
+ sourceRef: z6.string().optional(),
4381
+ sourceExcerpt: z6.string().optional(),
4323
4382
  // TEN-2191: mirror entriesGetOutputSchema — batch entries now carry why/whyQuality.
4324
- why: z5.string().optional(),
4325
- whyQuality: z5.enum(["rationale", "missing", "restated"]).optional(),
4326
- data: z5.record(z5.unknown()).optional()
4383
+ why: z6.string().optional(),
4384
+ whyQuality: z6.enum(["rationale", "missing", "restated"]).optional(),
4385
+ data: z6.record(z6.unknown()).optional()
4327
4386
  }).passthrough()),
4328
- total: z5.number()
4387
+ total: z6.number()
4329
4388
  });
4330
4389
  function registerEntriesTools(server) {
4331
4390
  const entriesHandlers = {
@@ -4338,7 +4397,7 @@ function registerEntriesTools(server) {
4338
4397
  update: (data) => handleUpdateEntry(data, "entries"),
4339
4398
  commit: (data) => handleCommitEntry(data, "entries"),
4340
4399
  history: (data) => handleGetHistory(data),
4341
- move: (data) => handleMove(data.entryId, data.toCollection),
4400
+ move: (data) => handleMoveEntry(data.entryId, data.toCollection),
4342
4401
  verify: (data) => handleVerifyEntry(data)
4343
4402
  };
4344
4403
  server.registerTool(
@@ -4626,49 +4685,6 @@ ${formatted}` }],
4626
4685
  structuredContent: success(`Found ${total} entries${scope}.`, { entries: structuredEntries, total })
4627
4686
  };
4628
4687
  }
4629
- async function handleMove(entryId, toCollection) {
4630
- try {
4631
- const result2 = await kernelMutation("chain.moveToCollection", {
4632
- entryId,
4633
- toCollectionSlug: toCollection,
4634
- // Finding #11: without an identity, moveToCollection's requirePermission call
4635
- // resolves to { agentSessionId: undefined } and permissions.ts's write pre-check
4636
- // denies EVERY call — this action always failed live. Sibling write actions
4637
- // (knowledge.ts:137) all thread this same changedBy shape.
4638
- changedBy: getAgentSessionId() ? `agent:${getAgentSessionId()}` : void 0
4639
- });
4640
- const lines = [
4641
- `## Move Result`,
4642
- "",
4643
- `Moved **${result2.entryId}** from \`${result2.fromCollection}\` \u2192 \`${result2.toCollection}\``
4644
- ];
4645
- if (result2.workflowStatusReset) {
4646
- lines.push(``, `\u26A0\uFE0F Workflow status \`${result2.previousWorkflowStatus}\` was reset (incompatible with target collection).`);
4647
- }
4648
- return {
4649
- content: [{ type: "text", text: lines.join("\n") }],
4650
- structuredContent: success(
4651
- `Moved ${result2.entryId} from ${result2.fromCollection} to ${result2.toCollection}.`,
4652
- result2,
4653
- [
4654
- { tool: "entries", description: "View updated entry", parameters: { action: "get", entryId } },
4655
- { tool: "quality", description: "Re-check quality", parameters: { action: "check", entryId } }
4656
- ]
4657
- )
4658
- };
4659
- } catch (error) {
4660
- const msg = error instanceof Error ? error.message : String(error);
4661
- const isNotFound = msg.includes("not found");
4662
- if (isNotFound) return notFoundResult(entryId, `Could not move entry: ${msg}`);
4663
- return failureResult(
4664
- `Could not move **${entryId}** to \`${toCollection}\`: ${msg}`,
4665
- "MOVE_FAILED",
4666
- msg,
4667
- "Check the entry ID and target collection slug, then retry.",
4668
- [{ tool: "entries", description: "Search for entry", parameters: { action: "search", query: entryId } }]
4669
- );
4670
- }
4671
- }
4672
4688
  async function handleSearch(server, query, collection, status2) {
4673
4689
  const scope = collection ? ` in \`${collection}\`` : "";
4674
4690
  await server.sendLoggingMessage({
@@ -4760,41 +4776,41 @@ ${footer}` }],
4760
4776
  }
4761
4777
 
4762
4778
  // src/tools/relations.ts
4763
- import { z as z7 } from "zod/v3";
4779
+ import { z as z8 } from "zod/v3";
4764
4780
 
4765
4781
  // src/tools/graph.ts
4766
- import { z as z6 } from "zod/v3";
4782
+ import { z as z7 } from "zod/v3";
4767
4783
  var GRAPH_ACTIONS = ["find", "suggest"];
4768
- var graphSchema = z6.object({
4769
- action: z6.enum(GRAPH_ACTIONS).describe(
4784
+ var graphSchema = z7.object({
4785
+ action: z7.enum(GRAPH_ACTIONS).describe(
4770
4786
  "'find': traverse relations from an entry (graph walk). 'suggest': discover potential connections for an entry."
4771
4787
  ),
4772
- entryId: z6.string().max(200).describe("Entry ID, e.g. '<PREFIX>-<n>'"),
4773
- direction: z6.enum(["incoming", "outgoing", "both"]).default("both").optional().describe("For find: 'incoming' = what references this, 'outgoing' = what this references"),
4774
- limit: z6.number().min(1).max(20).default(10).optional().describe("For suggest: max suggestions to return"),
4775
- depth: z6.number().min(1).max(3).default(2).optional().describe("For suggest: graph traversal depth")
4788
+ entryId: z7.string().max(200).describe("Entry ID, e.g. '<PREFIX>-<n>'"),
4789
+ direction: z7.enum(["incoming", "outgoing", "both"]).default("both").optional().describe("For find: 'incoming' = what references this, 'outgoing' = what this references"),
4790
+ limit: z7.number().min(1).max(20).default(10).optional().describe("For suggest: max suggestions to return"),
4791
+ depth: z7.number().min(1).max(3).default(2).optional().describe("For suggest: graph traversal depth")
4776
4792
  });
4777
- var graphFindOutputSchema = z6.object({
4778
- entryId: z6.string(),
4779
- relations: z6.array(z6.object({
4780
- entryId: z6.string().optional(),
4781
- name: z6.string(),
4782
- type: z6.string(),
4783
- direction: z6.enum(["outgoing", "incoming"])
4793
+ var graphFindOutputSchema = z7.object({
4794
+ entryId: z7.string(),
4795
+ relations: z7.array(z7.object({
4796
+ entryId: z7.string().optional(),
4797
+ name: z7.string(),
4798
+ type: z7.string(),
4799
+ direction: z7.enum(["outgoing", "incoming"])
4784
4800
  })),
4785
- total: z6.number()
4801
+ total: z7.number()
4786
4802
  });
4787
- var graphSuggestOutputSchema = z6.object({
4788
- entryId: z6.string(),
4789
- suggestions: z6.array(z6.object({
4790
- targetEntryId: z6.string().optional(),
4791
- targetName: z6.string(),
4792
- relationType: z6.string(),
4793
- direction: z6.string(),
4794
- confidence: z6.number(),
4795
- reason: z6.string()
4803
+ var graphSuggestOutputSchema = z7.object({
4804
+ entryId: z7.string(),
4805
+ suggestions: z7.array(z7.object({
4806
+ targetEntryId: z7.string().optional(),
4807
+ targetName: z7.string(),
4808
+ relationType: z7.string(),
4809
+ direction: z7.string(),
4810
+ confidence: z7.number(),
4811
+ reason: z7.string()
4796
4812
  })),
4797
- total: z6.number()
4813
+ total: z7.number()
4798
4814
  });
4799
4815
  async function handleFind(entryId, direction) {
4800
4816
  const relations = await kernelQuery("chain.listEntryRelations", { entryId });
@@ -4985,64 +5001,64 @@ async function handleSuggest(entryId, limit, depth) {
4985
5001
 
4986
5002
  // src/tools/relations.ts
4987
5003
  var RELATIONS_ACTIONS = ["create", "batch-create", "dismiss", "delete", "find", "suggest"];
4988
- var relationItemSchema = z7.object({
4989
- from: z7.string().max(200),
4990
- to: z7.string().max(200),
4991
- type: z7.string().max(200)
5004
+ var relationItemSchema = z8.object({
5005
+ from: z8.string().max(200),
5006
+ to: z8.string().max(200),
5007
+ type: z8.string().max(200)
4992
5008
  });
4993
- var relationsSchema = z7.object({
4994
- action: z7.enum(RELATIONS_ACTIONS).describe(
5009
+ var relationsSchema = z8.object({
5010
+ action: z8.enum(RELATIONS_ACTIONS).describe(
4995
5011
  "'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)."
4996
5012
  ),
4997
- from: z7.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': source entry ID."),
4998
- to: z7.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': target entry ID."),
4999
- type: z7.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': relation type."),
5000
- score: z7.number().optional().describe("For 'dismiss': suggestion score from action=suggest."),
5001
- relations: z7.array(relationItemSchema).min(1).max(20).optional().describe("For 'batch-create': array of {from, to, type}."),
5013
+ from: z8.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': source entry ID."),
5014
+ to: z8.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': target entry ID."),
5015
+ type: z8.string().max(200).optional().describe("For 'create'/'dismiss'/'delete': relation type."),
5016
+ score: z8.number().optional().describe("For 'dismiss': suggestion score from action=suggest."),
5017
+ relations: z8.array(relationItemSchema).min(1).max(20).optional().describe("For 'batch-create': array of {from, to, type}."),
5002
5018
  // WP-316 S3: Preview gate — dry-run mode for action=create.
5003
- preview: z7.boolean().optional().describe("For 'create': if true, validates the relation without writing. Returns what would happen. Default false."),
5004
- entryId: z7.string().max(200).optional().describe("For 'find'/'suggest': entry ID, e.g. '<PREFIX>-<n>'."),
5005
- direction: z7.enum(["incoming", "outgoing", "both"]).optional().describe("For 'find': 'incoming' = what references this, 'outgoing' = what this references. Default 'both'."),
5006
- limit: z7.number().min(1).max(20).optional().describe("For 'suggest': max suggestions to return. Default 10."),
5007
- depth: z7.number().min(1).max(3).optional().describe("For 'suggest': graph traversal depth. Default 2.")
5019
+ preview: z8.boolean().optional().describe("For 'create': if true, validates the relation without writing. Returns what would happen. Default false."),
5020
+ entryId: z8.string().max(200).optional().describe("For 'find'/'suggest': entry ID, e.g. '<PREFIX>-<n>'."),
5021
+ direction: z8.enum(["incoming", "outgoing", "both"]).optional().describe("For 'find': 'incoming' = what references this, 'outgoing' = what this references. Default 'both'."),
5022
+ limit: z8.number().min(1).max(20).optional().describe("For 'suggest': max suggestions to return. Default 10."),
5023
+ depth: z8.number().min(1).max(3).optional().describe("For 'suggest': graph traversal depth. Default 2.")
5008
5024
  });
5009
- var relationsCreateVariant = z7.object({
5010
- action: z7.literal("create"),
5011
- from: z7.string().max(200),
5012
- to: z7.string().max(200),
5013
- type: z7.string().max(200),
5014
- score: z7.number().optional(),
5015
- preview: z7.boolean().optional()
5025
+ var relationsCreateVariant = z8.object({
5026
+ action: z8.literal("create"),
5027
+ from: z8.string().max(200),
5028
+ to: z8.string().max(200),
5029
+ type: z8.string().max(200),
5030
+ score: z8.number().optional(),
5031
+ preview: z8.boolean().optional()
5016
5032
  });
5017
- var relationsBatchCreateVariant = z7.object({
5018
- action: z7.literal("batch-create"),
5019
- relations: z7.array(relationItemSchema).min(1).max(20)
5033
+ var relationsBatchCreateVariant = z8.object({
5034
+ action: z8.literal("batch-create"),
5035
+ relations: z8.array(relationItemSchema).min(1).max(20)
5020
5036
  });
5021
- var relationsDismissVariant = z7.object({
5022
- action: z7.literal("dismiss"),
5023
- from: z7.string().max(200),
5024
- to: z7.string().max(200),
5025
- type: z7.string().max(200).optional(),
5026
- score: z7.number().optional()
5037
+ var relationsDismissVariant = z8.object({
5038
+ action: z8.literal("dismiss"),
5039
+ from: z8.string().max(200),
5040
+ to: z8.string().max(200),
5041
+ type: z8.string().max(200).optional(),
5042
+ score: z8.number().optional()
5027
5043
  });
5028
- var relationsDeleteVariant = z7.object({
5029
- action: z7.literal("delete"),
5030
- from: z7.string().max(200),
5031
- to: z7.string().max(200),
5032
- type: z7.string().max(200)
5044
+ var relationsDeleteVariant = z8.object({
5045
+ action: z8.literal("delete"),
5046
+ from: z8.string().max(200),
5047
+ to: z8.string().max(200),
5048
+ type: z8.string().max(200)
5033
5049
  });
5034
- var relationsFindVariant = z7.object({
5035
- action: z7.literal("find"),
5036
- entryId: z7.string().max(200),
5037
- direction: z7.enum(["incoming", "outgoing", "both"]).optional().default("both")
5050
+ var relationsFindVariant = z8.object({
5051
+ action: z8.literal("find"),
5052
+ entryId: z8.string().max(200),
5053
+ direction: z8.enum(["incoming", "outgoing", "both"]).optional().default("both")
5038
5054
  });
5039
- var relationsSuggestVariant = z7.object({
5040
- action: z7.literal("suggest"),
5041
- entryId: z7.string().max(200),
5042
- limit: z7.number().min(1).max(20).optional().default(10),
5043
- depth: z7.number().min(1).max(3).optional().default(2)
5055
+ var relationsSuggestVariant = z8.object({
5056
+ action: z8.literal("suggest"),
5057
+ entryId: z8.string().max(200),
5058
+ limit: z8.number().min(1).max(20).optional().default(10),
5059
+ depth: z8.number().min(1).max(3).optional().default(2)
5044
5060
  });
5045
- var relationsActionUnion = z7.discriminatedUnion("action", [
5061
+ var relationsActionUnion = z8.discriminatedUnion("action", [
5046
5062
  relationsCreateVariant,
5047
5063
  relationsBatchCreateVariant,
5048
5064
  relationsDismissVariant,
@@ -5326,19 +5342,19 @@ async function handleDelete(from, to, type) {
5326
5342
  }
5327
5343
 
5328
5344
  // src/tools/context.ts
5329
- import { z as z9 } from "zod/v3";
5345
+ import { z as z10 } from "zod/v3";
5330
5346
 
5331
5347
  // src/tools/documents.ts
5332
- import { z as z8 } from "zod/v3";
5348
+ import { z as z9 } from "zod/v3";
5333
5349
  var DOCUMENTS_ACTIONS = ["get-last-verified-brief"];
5334
- var documentsSchema = z8.object({
5335
- action: z8.enum(DOCUMENTS_ACTIONS).describe(
5350
+ var documentsSchema = z9.object({
5351
+ action: z9.enum(DOCUMENTS_ACTIONS).describe(
5336
5352
  "'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')."
5337
5353
  ),
5338
- templateId: z8.string().max(200).describe(
5354
+ templateId: z9.string().max(200).describe(
5339
5355
  "Brief template identifier \u2014 currently 'steering-brief' is the only registered template."
5340
5356
  ),
5341
- scopeKey: z8.string().max(200).describe(
5357
+ scopeKey: z9.string().max(200).describe(
5342
5358
  "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."
5343
5359
  )
5344
5360
  });
@@ -5418,89 +5434,89 @@ function epistemicCollectionHint(collectionName) {
5418
5434
  return "";
5419
5435
  }
5420
5436
  var CONTEXT_ACTIONS = ["gather", "build", "neighborhood", "changes", "chain", "cross-cut", "incremental", "brief", "last-verified-brief"];
5421
- var contextSchema = z9.object({
5437
+ var contextSchema = z10.object({
5422
5438
  // provenance: neighborhood BET-142; changes/chain/cross-cut/incremental/brief BET-239 (E4, E6)
5423
- action: z9.enum(CONTEXT_ACTIONS).describe(
5439
+ action: z10.enum(CONTEXT_ACTIONS).describe(
5424
5440
  "'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."
5425
5441
  ),
5426
- entryId: z9.string().max(200).optional().describe("For 'build'/'neighborhood'/'chain': entry ID, e.g. '<PREFIX>-<n>'. For 'gather': optional entry ID for entry-graph mode."),
5427
- mapEntryId: z9.string().max(200).optional().describe(
5442
+ entryId: z10.string().max(200).optional().describe("For 'build'/'neighborhood'/'chain': entry ID, e.g. '<PREFIX>-<n>'. For 'gather': optional entry ID for entry-graph mode."),
5443
+ mapEntryId: z10.string().max(200).optional().describe(
5428
5444
  "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>'."
5429
5445
  ),
5430
- task: z9.string().max(2e3).optional().describe("For 'gather': natural-language task description for loading task-relevant governance, binding constraints, and supporting context."),
5431
- since: z9.string().max(200).optional().describe(
5446
+ task: z10.string().max(2e3).optional().describe("For 'gather': natural-language task description for loading task-relevant governance, binding constraints, and supporting context."),
5447
+ since: z10.string().max(200).optional().describe(
5432
5448
  "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'."
5433
5449
  ),
5434
- direction: z9.enum(["outgoing", "incoming"]).default("outgoing").optional().describe("For 'chain' action: traversal direction. 'outgoing' follows relations from source, 'incoming' follows relations to source. Default: outgoing."),
5435
- relationType: z9.string().max(200).optional().describe(
5450
+ direction: z10.enum(["outgoing", "incoming"]).default("outgoing").optional().describe("For 'chain' action: traversal direction. 'outgoing' follows relations from source, 'incoming' follows relations to source. Default: outgoing."),
5451
+ relationType: z10.string().max(200).optional().describe(
5436
5452
  "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'."
5437
5453
  ),
5438
- mode: z9.enum(["search", "graph"]).default("search").optional().describe("For gather: 'search' (default) or 'graph' (enhanced with provenance paths). Ignored when mapEntryId is provided."),
5439
- maxHops: z9.number().min(1).max(4).default(2).describe("Relation traversal depth (1=direct only, 2=default, 3=wide net, 4=deep chain walk)"),
5440
- maxResults: z9.number().min(1).max(25).default(10).optional().describe("Max entries to return in gather task mode (default 10)"),
5441
- strategy: z9.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."),
5442
- skill: z9.string().max(200).optional().describe(
5454
+ mode: z10.enum(["search", "graph"]).default("search").optional().describe("For gather: 'search' (default) or 'graph' (enhanced with provenance paths). Ignored when mapEntryId is provided."),
5455
+ maxHops: z10.number().min(1).max(4).default(2).describe("Relation traversal depth (1=direct only, 2=default, 3=wide net, 4=deep chain walk)"),
5456
+ maxResults: z10.number().min(1).max(25).default(10).optional().describe("Max entries to return in gather task mode (default 10)"),
5457
+ strategy: z10.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."),
5458
+ skill: z10.string().max(200).optional().describe(
5443
5459
  "Skill name for 'incremental' action \u2014 identifies which skill's brief history to compare against. Examples: 'preflight', 'shaping', 'review'. Required when action is 'incremental'."
5444
5460
  ),
5445
- briefType: z9.enum(["steering", "confidence", "delta"]).optional().describe(
5461
+ briefType: z10.enum(["steering", "confidence", "delta"]).optional().describe(
5446
5462
  "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'."
5447
5463
  ),
5448
- templateId: z9.string().max(200).optional().describe(
5464
+ templateId: z10.string().max(200).optional().describe(
5449
5465
  "For 'last-verified-brief': brief template identifier \u2014 currently 'steering-brief' is the only registered template."
5450
5466
  ),
5451
- scopeKey: z9.string().max(200).optional().describe(
5467
+ scopeKey: z10.string().max(200).optional().describe(
5452
5468
  "For 'last-verified-brief': canonical scope key \u2014 'workspace:<workspaceId>' or 'initiative:<INI-ID>'."
5453
5469
  )
5454
5470
  });
5455
- var contextGatherVariant = z9.object({
5456
- action: z9.literal("gather"),
5457
- entryId: z9.string().max(200).optional(),
5458
- mapEntryId: z9.string().max(200).optional(),
5459
- task: z9.string().max(2e3).optional(),
5460
- mode: z9.enum(["search", "graph"]).optional().default("search"),
5461
- maxHops: z9.number().min(1).max(4).optional().default(2),
5462
- maxResults: z9.number().min(1).max(25).optional().default(10),
5463
- strategy: z9.enum(["hybrid", "keyword"]).optional().default("keyword")
5471
+ var contextGatherVariant = z10.object({
5472
+ action: z10.literal("gather"),
5473
+ entryId: z10.string().max(200).optional(),
5474
+ mapEntryId: z10.string().max(200).optional(),
5475
+ task: z10.string().max(2e3).optional(),
5476
+ mode: z10.enum(["search", "graph"]).optional().default("search"),
5477
+ maxHops: z10.number().min(1).max(4).optional().default(2),
5478
+ maxResults: z10.number().min(1).max(25).optional().default(10),
5479
+ strategy: z10.enum(["hybrid", "keyword"]).optional().default("keyword")
5464
5480
  });
5465
- var contextBuildVariant = z9.object({
5466
- action: z9.literal("build"),
5467
- entryId: z9.string().max(200),
5468
- maxHops: z9.number().min(1).max(4).optional().default(2)
5481
+ var contextBuildVariant = z10.object({
5482
+ action: z10.literal("build"),
5483
+ entryId: z10.string().max(200),
5484
+ maxHops: z10.number().min(1).max(4).optional().default(2)
5469
5485
  });
5470
- var contextNeighborhoodVariant = z9.object({
5471
- action: z9.literal("neighborhood"),
5472
- entryId: z9.string().max(200)
5486
+ var contextNeighborhoodVariant = z10.object({
5487
+ action: z10.literal("neighborhood"),
5488
+ entryId: z10.string().max(200)
5473
5489
  });
5474
- var contextChangesVariant = z9.object({
5475
- action: z9.literal("changes"),
5476
- since: z9.string().max(200)
5490
+ var contextChangesVariant = z10.object({
5491
+ action: z10.literal("changes"),
5492
+ since: z10.string().max(200)
5477
5493
  });
5478
- var contextChainVariant = z9.object({
5479
- action: z9.literal("chain"),
5480
- entryId: z9.string().max(200),
5481
- direction: z9.enum(["outgoing", "incoming"]).optional().default("outgoing"),
5482
- maxHops: z9.number().min(1).max(4).optional().default(2),
5483
- relationType: z9.string().max(200).optional()
5494
+ var contextChainVariant = z10.object({
5495
+ action: z10.literal("chain"),
5496
+ entryId: z10.string().max(200),
5497
+ direction: z10.enum(["outgoing", "incoming"]).optional().default("outgoing"),
5498
+ maxHops: z10.number().min(1).max(4).optional().default(2),
5499
+ relationType: z10.string().max(200).optional()
5484
5500
  });
5485
- var contextCrossCutVariant = z9.object({
5486
- action: z9.literal("cross-cut"),
5487
- relationType: z9.string().max(200)
5501
+ var contextCrossCutVariant = z10.object({
5502
+ action: z10.literal("cross-cut"),
5503
+ relationType: z10.string().max(200)
5488
5504
  });
5489
- var contextIncrementalVariant = z9.object({
5490
- action: z9.literal("incremental"),
5491
- skill: z9.string().max(200)
5505
+ var contextIncrementalVariant = z10.object({
5506
+ action: z10.literal("incremental"),
5507
+ skill: z10.string().max(200)
5492
5508
  });
5493
- var contextBriefVariant = z9.object({
5494
- action: z9.literal("brief"),
5495
- briefType: z9.enum(["steering", "confidence", "delta"]),
5496
- since: z9.string().max(200).optional()
5509
+ var contextBriefVariant = z10.object({
5510
+ action: z10.literal("brief"),
5511
+ briefType: z10.enum(["steering", "confidence", "delta"]),
5512
+ since: z10.string().max(200).optional()
5497
5513
  });
5498
- var contextLastVerifiedBriefVariant = z9.object({
5499
- action: z9.literal("last-verified-brief"),
5500
- templateId: z9.string().max(200),
5501
- scopeKey: z9.string().max(200)
5514
+ var contextLastVerifiedBriefVariant = z10.object({
5515
+ action: z10.literal("last-verified-brief"),
5516
+ templateId: z10.string().max(200),
5517
+ scopeKey: z10.string().max(200)
5502
5518
  });
5503
- var contextActionUnion = z9.discriminatedUnion("action", [
5519
+ var contextActionUnion = z10.discriminatedUnion("action", [
5504
5520
  contextGatherVariant,
5505
5521
  contextBuildVariant,
5506
5522
  contextNeighborhoodVariant,
@@ -6541,20 +6557,20 @@ function formatTimeAgo(ms) {
6541
6557
  }
6542
6558
 
6543
6559
  // src/tools/collections.ts
6544
- import { z as z11 } from "zod/v3";
6560
+ import { z as z12 } from "zod/v3";
6545
6561
 
6546
6562
  // src/tools/labels.ts
6547
- import { z as z10 } from "zod/v3";
6548
- var labelsSchema = z10.object({
6549
- action: z10.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"),
6550
- slug: z10.string().max(200).optional().describe("Label slug (required for create/update/delete/apply/remove)"),
6551
- name: z10.string().max(500).optional().describe("Display name (required for create)"),
6552
- color: z10.string().max(50).optional().describe("Hex color, e.g. '#ef4444'"),
6553
- description: z10.string().max(2e3).optional().describe("What this label means"),
6554
- parentSlug: z10.string().max(200).optional().describe("Parent group slug for label hierarchy"),
6555
- isGroup: z10.boolean().optional().describe("True if this is a group container, not a taggable label"),
6556
- order: z10.number().optional().describe("Sort order within its group"),
6557
- entryId: z10.string().max(200).optional().describe("Entry ID for apply/remove actions")
6563
+ import { z as z11 } from "zod/v3";
6564
+ var labelsSchema = z11.object({
6565
+ action: z11.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"),
6566
+ slug: z11.string().max(200).optional().describe("Label slug (required for create/update/delete/apply/remove)"),
6567
+ name: z11.string().max(500).optional().describe("Display name (required for create)"),
6568
+ color: z11.string().max(50).optional().describe("Hex color, e.g. '#ef4444'"),
6569
+ description: z11.string().max(2e3).optional().describe("What this label means"),
6570
+ parentSlug: z11.string().max(200).optional().describe("Parent group slug for label hierarchy"),
6571
+ isGroup: z11.boolean().optional().describe("True if this is a group container, not a taggable label"),
6572
+ order: z11.number().optional().describe("Sort order within its group"),
6573
+ entryId: z11.string().max(200).optional().describe("Entry ID for apply/remove actions")
6558
6574
  });
6559
6575
  async function handleLabelsList() {
6560
6576
  const labels = await kernelQuery("chain.listLabels");
@@ -6659,128 +6675,128 @@ var COLLECTIONS_ACTIONS = [
6659
6675
  "label-apply",
6660
6676
  "label-remove"
6661
6677
  ];
6662
- var qualityCriterionSchema = z11.object({
6663
- field: z11.string().max(200).describe("Entry data field key this criterion applies to, e.g. 'description', 'owner'"),
6678
+ var qualityCriterionSchema = z12.object({
6679
+ field: z12.string().max(200).describe("Entry data field key this criterion applies to, e.g. 'description', 'owner'"),
6664
6680
  // WP-480 S1: `max_length` — must mirror the Convex rule union, or the tool rejects a
6665
6681
  // valid criterion before the request ever reaches the server.
6666
- rule: z11.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)."),
6667
- value: z11.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'.")
6682
+ rule: z12.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)."),
6683
+ value: z12.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'.")
6668
6684
  });
6669
- var fieldSchema = z11.object({
6670
- key: z11.string().max(200).describe("Field key, e.g. 'description', 'severity', 'status'"),
6671
- label: z11.string().max(200).describe("Display label, e.g. 'Description', 'Severity'"),
6672
- type: z11.string().max(50).describe("Field type: 'string', 'select', 'array', 'number', 'boolean'"),
6673
- required: z11.boolean().optional().describe("Whether this field is required"),
6674
- options: z11.array(z11.string().max(200)).max(200).optional().describe("Options for 'select' type fields"),
6675
- searchable: z11.boolean().optional().describe("Whether this field is included in full-text search"),
6676
- displayHint: z11.enum(["hero", "badge", "meta", "section", "hidden", "inline-meta"]).optional().describe("V2 rendering hint: how the field should be displayed in Cortex"),
6677
- zone: z11.enum(["header", "body", "meta"]).optional().describe("V2 layout zone: where the field appears in the entry view"),
6678
- colorMap: z11.record(z11.string().max(50)).optional().describe("V2 value-to-semantic-color mapping, e.g. { critical: 'danger', low: 'success' }"),
6685
+ var fieldSchema = z12.object({
6686
+ key: z12.string().max(200).describe("Field key, e.g. 'description', 'severity', 'status'"),
6687
+ label: z12.string().max(200).describe("Display label, e.g. 'Description', 'Severity'"),
6688
+ type: z12.string().max(50).describe("Field type: 'string', 'select', 'array', 'number', 'boolean'"),
6689
+ required: z12.boolean().optional().describe("Whether this field is required"),
6690
+ options: z12.array(z12.string().max(200)).max(200).optional().describe("Options for 'select' type fields"),
6691
+ searchable: z12.boolean().optional().describe("Whether this field is included in full-text search"),
6692
+ displayHint: z12.enum(["hero", "badge", "meta", "section", "hidden", "inline-meta"]).optional().describe("V2 rendering hint: how the field should be displayed in Cortex"),
6693
+ zone: z12.enum(["header", "body", "meta"]).optional().describe("V2 layout zone: where the field appears in the entry view"),
6694
+ colorMap: z12.record(z12.string().max(50)).optional().describe("V2 value-to-semantic-color mapping, e.g. { critical: 'danger', low: 'success' }"),
6679
6695
  // ENT-61
6680
- accentSource: z11.boolean().optional().describe("When true, this field's colorMap value drives the card-level accent styling"),
6696
+ accentSource: z12.boolean().optional().describe("When true, this field's colorMap value drives the card-level accent styling"),
6681
6697
  // ENT-61
6682
- iconMap: z11.record(z11.string(), z11.string().max(50)).optional().describe("Maps field values to icons (emoji/symbol), prepended to badge text"),
6683
- helpText: z11.string().max(2e3).optional().describe("Help text shown in editors and describe output"),
6684
- optionDescriptions: z11.record(z11.string().max(500)).optional().describe("Per-option guidance for select fields"),
6698
+ iconMap: z12.record(z12.string(), z12.string().max(50)).optional().describe("Maps field values to icons (emoji/symbol), prepended to badge text"),
6699
+ helpText: z12.string().max(2e3).optional().describe("Help text shown in editors and describe output"),
6700
+ optionDescriptions: z12.record(z12.string().max(500)).optional().describe("Per-option guidance for select fields"),
6685
6701
  // BET-136
6686
- semanticRole: z11.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"),
6702
+ semanticRole: z12.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"),
6687
6703
  // BET-196
6688
- maxLength: z11.number().optional().describe("Maximum character length for field values. Three-tier resolution: explicit > displayHint > type fallback."),
6704
+ maxLength: z12.number().optional().describe("Maximum character length for field values. Three-tier resolution: explicit > displayHint > type fallback."),
6689
6705
  // BET-196
6690
- minLength: z11.number().optional().describe("Minimum character length for field values. Only explicit \u2014 no defaults.")
6706
+ minLength: z12.number().optional().describe("Minimum character length for field values. Only explicit \u2014 no defaults.")
6691
6707
  });
6692
- var collectionsSchema = z11.object({
6693
- action: z11.enum(COLLECTIONS_ACTIONS).describe(
6708
+ var collectionsSchema = z12.object({
6709
+ action: z12.enum(COLLECTIONS_ACTIONS).describe(
6694
6710
  "'list': browse all collections. 'create': create a new collection. '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)."
6695
6711
  ),
6696
- slug: z11.string().max(200).optional().describe("URL-safe identifier for create/update, e.g. 'glossary', 'tech-debt'. For label-*: label slug."),
6697
- name: z11.string().max(500).optional().describe("Display name for create, or new name for update. For label-create: label display name."),
6698
- description: z11.string().max(2e4).optional().describe("What this collection is for. For label-create/label-update: what the label means."),
6699
- purpose: z11.string().max(2e3).optional().describe("Why this collection exists \u2014 strategic reason"),
6700
- icon: z11.string().max(50).optional().describe("Emoji icon for the collection"),
6701
- navGroup: z11.enum(["daily", "strategic", "governance", "reference", "collections"]).optional().describe("Sidebar placement: 'daily', 'strategic', 'governance', 'reference', 'collections'"),
6702
- fields: z11.array(fieldSchema).max(200).optional().describe("Field definitions for create, or replacement schema for update (replaces all fields)"),
6712
+ slug: z12.string().max(200).optional().describe("URL-safe identifier for create/update, e.g. 'glossary', 'tech-debt'. For label-*: label slug."),
6713
+ name: z12.string().max(500).optional().describe("Display name for create, or new name for update. For label-create: label display name."),
6714
+ description: z12.string().max(2e4).optional().describe("What this collection is for. For label-create/label-update: what the label means."),
6715
+ purpose: z12.string().max(2e3).optional().describe("Why this collection exists \u2014 strategic reason"),
6716
+ icon: z12.string().max(50).optional().describe("Emoji icon for the collection"),
6717
+ navGroup: z12.enum(["daily", "strategic", "governance", "reference", "collections"]).optional().describe("Sidebar placement: 'daily', 'strategic', 'governance', 'reference', 'collections'"),
6718
+ fields: z12.array(fieldSchema).max(200).optional().describe("Field definitions for create, or replacement schema for update (replaces all fields)"),
6703
6719
  // ENT-62
6704
- defaultCanonicalKey: z11.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."),
6720
+ defaultCanonicalKey: z12.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."),
6705
6721
  // ENT-67
6706
- defaultWorkflowStatus: z11.string().max(200).optional().describe("Default workflowStatus for new entries. Must be in validWorkflowStatuses when set (e.g. 'hypothesis' for insights)."),
6722
+ defaultWorkflowStatus: z12.string().max(200).optional().describe("Default workflowStatus for new entries. Must be in validWorkflowStatuses when set (e.g. 'hypothesis' for insights)."),
6707
6723
  // ENT-65
6708
- validWorkflowStatuses: z11.array(z11.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."),
6724
+ validWorkflowStatuses: z12.array(z12.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."),
6709
6725
  // ENT-65, FEAT-200
6710
- classificationCheck: z11.string().max(500).optional().describe("LLM decision-tree check for this collection (3\u2013500 chars). Guides the classifier in routing entries here."),
6726
+ classificationCheck: z12.string().max(500).optional().describe("LLM decision-tree check for this collection (3\u2013500 chars). Guides the classifier in routing entries here."),
6711
6727
  // ENT-65, FEAT-200
6712
- classificationPriority: z11.number().optional().describe("Classifier priority (1\u20139, lower = higher priority). Used with classificationCheck to order the decision tree."),
6728
+ classificationPriority: z12.number().optional().describe("Classifier priority (1\u20139, lower = higher priority). Used with classificationCheck to order the decision tree."),
6713
6729
  // FEAT-301 Slice 2: quality gate criteria and usage guidance.
6714
6730
  // FEAT-257
6715
- qualityCriteria: z11.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."),
6716
- usageGuidance: z11.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."),
6731
+ qualityCriteria: z12.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."),
6732
+ usageGuidance: z12.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."),
6717
6733
  // For label-*
6718
- color: z11.string().max(50).optional().describe("For label-create/label-update: hex color, e.g. '#ef4444'."),
6719
- parentSlug: z11.string().max(200).optional().describe("For label-create: parent group slug for label hierarchy."),
6720
- isGroup: z11.boolean().optional().describe("For label-create/label-update: true if this is a group container, not a taggable label."),
6721
- order: z11.number().optional().describe("For label-create/label-update: sort order within its group."),
6722
- entryId: z11.string().max(200).optional().describe("For label-apply/label-remove: entry ID.")
6734
+ color: z12.string().max(50).optional().describe("For label-create/label-update: hex color, e.g. '#ef4444'."),
6735
+ parentSlug: z12.string().max(200).optional().describe("For label-create: parent group slug for label hierarchy."),
6736
+ isGroup: z12.boolean().optional().describe("For label-create/label-update: true if this is a group container, not a taggable label."),
6737
+ order: z12.number().optional().describe("For label-create/label-update: sort order within its group."),
6738
+ entryId: z12.string().max(200).optional().describe("For label-apply/label-remove: entry ID.")
6723
6739
  });
6724
- var collectionsListVariant = z11.object({ action: z11.literal("list") });
6725
- var collectionsDescribeVariant = z11.object({ action: z11.literal("describe"), slug: z11.string().max(200) });
6726
- var collectionsCreateVariant = z11.object({
6727
- action: z11.literal("create"),
6728
- slug: z11.string().max(200),
6729
- name: z11.string().max(500),
6730
- description: z11.string().max(2e4).optional(),
6731
- purpose: z11.string().max(2e3).optional(),
6732
- icon: z11.string().max(50).optional(),
6733
- navGroup: z11.enum(["daily", "strategic", "governance", "reference", "collections"]).optional(),
6734
- fields: z11.array(fieldSchema).min(1),
6735
- defaultCanonicalKey: z11.string().max(200).optional(),
6736
- defaultWorkflowStatus: z11.string().max(200).optional(),
6737
- validWorkflowStatuses: z11.array(z11.string().max(200)).optional(),
6738
- classificationCheck: z11.string().max(500).optional(),
6739
- classificationPriority: z11.number().optional()
6740
+ var collectionsListVariant = z12.object({ action: z12.literal("list") });
6741
+ var collectionsDescribeVariant = z12.object({ action: z12.literal("describe"), slug: z12.string().max(200) });
6742
+ var collectionsCreateVariant = z12.object({
6743
+ action: z12.literal("create"),
6744
+ slug: z12.string().max(200),
6745
+ name: z12.string().max(500),
6746
+ description: z12.string().max(2e4).optional(),
6747
+ purpose: z12.string().max(2e3).optional(),
6748
+ icon: z12.string().max(50).optional(),
6749
+ navGroup: z12.enum(["daily", "strategic", "governance", "reference", "collections"]).optional(),
6750
+ fields: z12.array(fieldSchema).min(1),
6751
+ defaultCanonicalKey: z12.string().max(200).optional(),
6752
+ defaultWorkflowStatus: z12.string().max(200).optional(),
6753
+ validWorkflowStatuses: z12.array(z12.string().max(200)).optional(),
6754
+ classificationCheck: z12.string().max(500).optional(),
6755
+ classificationPriority: z12.number().optional()
6740
6756
  });
6741
- var collectionsUpdateVariant = z11.object({
6742
- action: z11.literal("update"),
6743
- slug: z11.string().max(200),
6744
- name: z11.string().max(500).optional(),
6745
- description: z11.string().max(2e4).optional(),
6746
- purpose: z11.string().max(2e3).optional(),
6747
- icon: z11.string().max(50).optional(),
6748
- navGroup: z11.enum(["daily", "strategic", "governance", "reference", "collections"]).optional(),
6749
- fields: z11.array(fieldSchema).optional(),
6750
- defaultCanonicalKey: z11.string().max(200).optional(),
6751
- defaultWorkflowStatus: z11.string().max(200).optional(),
6752
- validWorkflowStatuses: z11.array(z11.string().max(200)).optional(),
6753
- classificationCheck: z11.string().max(500).optional(),
6754
- classificationPriority: z11.number().optional(),
6755
- qualityCriteria: z11.array(qualityCriterionSchema).optional(),
6756
- usageGuidance: z11.string().max(2e4).optional()
6757
+ var collectionsUpdateVariant = z12.object({
6758
+ action: z12.literal("update"),
6759
+ slug: z12.string().max(200),
6760
+ name: z12.string().max(500).optional(),
6761
+ description: z12.string().max(2e4).optional(),
6762
+ purpose: z12.string().max(2e3).optional(),
6763
+ icon: z12.string().max(50).optional(),
6764
+ navGroup: z12.enum(["daily", "strategic", "governance", "reference", "collections"]).optional(),
6765
+ fields: z12.array(fieldSchema).optional(),
6766
+ defaultCanonicalKey: z12.string().max(200).optional(),
6767
+ defaultWorkflowStatus: z12.string().max(200).optional(),
6768
+ validWorkflowStatuses: z12.array(z12.string().max(200)).optional(),
6769
+ classificationCheck: z12.string().max(500).optional(),
6770
+ classificationPriority: z12.number().optional(),
6771
+ qualityCriteria: z12.array(qualityCriterionSchema).optional(),
6772
+ usageGuidance: z12.string().max(2e4).optional()
6757
6773
  });
6758
- var collectionsAuditVariant = z11.object({ action: z11.literal("audit") });
6759
- var collectionsExportVariant = z11.object({ action: z11.literal("export") });
6760
- var collectionsLabelListVariant = z11.object({ action: z11.literal("label-list") });
6761
- var collectionsLabelCreateVariant = z11.object({
6762
- action: z11.literal("label-create"),
6763
- slug: z11.string().max(200),
6764
- name: z11.string().max(500),
6765
- color: z11.string().max(50).optional(),
6766
- description: z11.string().max(2e3).optional(),
6767
- parentSlug: z11.string().max(200).optional(),
6768
- isGroup: z11.boolean().optional(),
6769
- order: z11.number().optional()
6774
+ var collectionsAuditVariant = z12.object({ action: z12.literal("audit") });
6775
+ var collectionsExportVariant = z12.object({ action: z12.literal("export") });
6776
+ var collectionsLabelListVariant = z12.object({ action: z12.literal("label-list") });
6777
+ var collectionsLabelCreateVariant = z12.object({
6778
+ action: z12.literal("label-create"),
6779
+ slug: z12.string().max(200),
6780
+ name: z12.string().max(500),
6781
+ color: z12.string().max(50).optional(),
6782
+ description: z12.string().max(2e3).optional(),
6783
+ parentSlug: z12.string().max(200).optional(),
6784
+ isGroup: z12.boolean().optional(),
6785
+ order: z12.number().optional()
6770
6786
  });
6771
- var collectionsLabelUpdateVariant = z11.object({
6772
- action: z11.literal("label-update"),
6773
- slug: z11.string().max(200),
6774
- name: z11.string().max(500).optional(),
6775
- color: z11.string().max(50).optional(),
6776
- description: z11.string().max(2e3).optional(),
6777
- isGroup: z11.boolean().optional(),
6778
- order: z11.number().optional()
6787
+ var collectionsLabelUpdateVariant = z12.object({
6788
+ action: z12.literal("label-update"),
6789
+ slug: z12.string().max(200),
6790
+ name: z12.string().max(500).optional(),
6791
+ color: z12.string().max(50).optional(),
6792
+ description: z12.string().max(2e3).optional(),
6793
+ isGroup: z12.boolean().optional(),
6794
+ order: z12.number().optional()
6779
6795
  });
6780
- var collectionsLabelDeleteVariant = z11.object({ action: z11.literal("label-delete"), slug: z11.string().max(200) });
6781
- var collectionsLabelApplyVariant = z11.object({ action: z11.literal("label-apply"), slug: z11.string().max(200), entryId: z11.string().max(200) });
6782
- var collectionsLabelRemoveVariant = z11.object({ action: z11.literal("label-remove"), slug: z11.string().max(200), entryId: z11.string().max(200) });
6783
- var collectionsActionUnion = z11.discriminatedUnion("action", [
6796
+ var collectionsLabelDeleteVariant = z12.object({ action: z12.literal("label-delete"), slug: z12.string().max(200) });
6797
+ var collectionsLabelApplyVariant = z12.object({ action: z12.literal("label-apply"), slug: z12.string().max(200), entryId: z12.string().max(200) });
6798
+ var collectionsLabelRemoveVariant = z12.object({ action: z12.literal("label-remove"), slug: z12.string().max(200), entryId: z12.string().max(200) });
6799
+ var collectionsActionUnion = z12.discriminatedUnion("action", [
6784
6800
  collectionsListVariant,
6785
6801
  collectionsDescribeVariant,
6786
6802
  collectionsCreateVariant,
@@ -7165,7 +7181,7 @@ async function handleExport() {
7165
7181
  }
7166
7182
 
7167
7183
  // src/tools/orient.ts
7168
- import { z as z15 } from "zod/v3";
7184
+ import { z as z16 } from "zod/v3";
7169
7185
 
7170
7186
  // src/tools/planned-work.ts
7171
7187
  function buildPlannedWork(allEntries) {
@@ -8079,12 +8095,12 @@ function replaceVocabTokens(body, workspaceCtx, collectionCtxMap) {
8079
8095
  }
8080
8096
 
8081
8097
  // src/tools/start_pb.ts
8082
- import { z as z13 } from "zod/v3";
8098
+ import { z as z14 } from "zod/v3";
8083
8099
 
8084
8100
  // src/tools/skills.ts
8085
- import { z as z12 } from "zod/v3";
8086
- var skillsSchema = z12.object({
8087
- entryId: z12.string().min(1).describe(
8101
+ import { z as z13 } from "zod/v3";
8102
+ var skillsSchema = z13.object({
8103
+ entryId: z13.string().min(1).describe(
8088
8104
  "Workspace-scoped skill entry id (e.g. 'SKILL-pb-setup'). The tool refuses non-skill entries (canonicalKey !== 'skill') with INVALID_KIND."
8089
8105
  )
8090
8106
  });
@@ -8097,8 +8113,8 @@ async function loadSkillBody(entryId) {
8097
8113
  }
8098
8114
 
8099
8115
  // src/tools/start_pb.ts
8100
- var startPbSchema = z13.object({
8101
- task: z13.string().max(2e3).optional().describe(
8116
+ var startPbSchema = z14.object({
8117
+ task: z14.string().max(2e3).optional().describe(
8102
8118
  "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)."
8103
8119
  )
8104
8120
  // TEN-2431: no `scope` param. start_pb's governance matches orient's RENDERED governance,
@@ -8450,15 +8466,15 @@ ${FEEDBACK_HINT}` }],
8450
8466
  }
8451
8467
 
8452
8468
  // src/tools/record_activation.ts
8453
- import { z as z14 } from "zod/v3";
8454
- var recordActivationSchema = z14.object({
8455
- confirmedEntryCount: z14.number().int().min(0).describe(
8469
+ import { z as z15 } from "zod/v3";
8470
+ var recordActivationSchema = z15.object({
8471
+ confirmedEntryCount: z15.number().int().min(0).describe(
8456
8472
  "Confirmed-entry count from the Phase 4 capture loop. The mutation enforces >=10."
8457
8473
  ),
8458
- entriesAcrossCollections: z14.number().int().min(0).describe(
8474
+ entriesAcrossCollections: z15.number().int().min(0).describe(
8459
8475
  "Number of distinct collections those entries span. The mutation enforces >=2 (diversity soft-gate)."
8460
8476
  ),
8461
- retrievalDemoConfirmed: z14.boolean().describe(
8477
+ retrievalDemoConfirmed: z15.boolean().describe(
8462
8478
  "True if the retrieval round-trip ran successfully in Phase 4. The mutation rejects false."
8463
8479
  )
8464
8480
  });
@@ -8549,68 +8565,68 @@ async function markOrientedWithSnapshotFallback(agentSessionId, coherenceSnapsho
8549
8565
  }
8550
8566
  }
8551
8567
  var ORIENT_ACTIONS = ["start", "task", "record-activation"];
8552
- var orientSchema = z15.object({
8553
- action: z15.enum(ORIENT_ACTIONS).optional().default("task").describe(
8568
+ var orientSchema = z16.object({
8569
+ action: z16.enum(ORIENT_ACTIONS).optional().default("task").describe(
8554
8570
  "'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)."
8555
8571
  ),
8556
- mode: z15.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."),
8557
- tier: z15.enum(["summary", "standard", "full"]).optional().describe(
8572
+ mode: z16.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."),
8573
+ tier: z16.enum(["summary", "standard", "full"]).optional().describe(
8558
8574
  "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."
8559
8575
  ),
8560
- task: z15.string().max(2e3).optional().describe(
8576
+ task: z16.string().max(2e3).optional().describe(
8561
8577
  "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."
8562
8578
  ),
8563
- scope: z15.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."),
8579
+ scope: z16.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."),
8564
8580
  // WP-486 Slice 1 (FEAT-1371, TEN-2724): the startup-signal envelope `resolveStartupDomain`
8565
8581
  // already consumes (`convex/agentKnowledge/startupResolver.ts:344-379`) but this tool never
8566
8582
  // sent. Nested to match the server's `StartupResolutionSignals` shape exactly (not a flat
8567
8583
  // field set) — the caller (the agent, which may have its own git/session context from prior
8568
8584
  // tool calls) supplies whichever fields it knows; every field is optional and independently
8569
8585
  // sanitized server-side (`convex/agentKnowledge/startupResolutionSignals.ts`).
8570
- startupSignals: z15.object({
8571
- changedPaths: z15.array(z15.string()).max(25).optional().describe("Paths changed in the current working tree, if known (e.g. from a prior git status/diff tool call)."),
8572
- reviewedArtifactRefs: z15.array(z15.string()).max(25).optional().describe("Chain entry IDs the caller has already reviewed this session, if tracked."),
8573
- branchName: z15.string().max(120).optional().describe("Current git branch name, if known."),
8574
- worktreeName: z15.string().max(120).optional().describe("Current worktree/directory name, if known.")
8586
+ startupSignals: z16.object({
8587
+ changedPaths: z16.array(z16.string()).max(25).optional().describe("Paths changed in the current working tree, if known (e.g. from a prior git status/diff tool call)."),
8588
+ reviewedArtifactRefs: z16.array(z16.string()).max(25).optional().describe("Chain entry IDs the caller has already reviewed this session, if tracked."),
8589
+ branchName: z16.string().max(120).optional().describe("Current git branch name, if known."),
8590
+ worktreeName: z16.string().max(120).optional().describe("Current worktree/directory name, if known.")
8575
8591
  }).optional().describe("For 'task': best-effort startup signals for domain resolution \u2014 changedPaths/reviewedArtifactRefs/branchName/worktreeName. All optional; omit fields you don't know."),
8576
- invocationPath: z15.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."),
8577
- confirmedEntryCount: z15.number().int().min(0).optional().describe(
8592
+ invocationPath: z16.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."),
8593
+ confirmedEntryCount: z16.number().int().min(0).optional().describe(
8578
8594
  "For 'record-activation': confirmed-entry count from the Phase 4 capture loop. The mutation enforces >=10."
8579
8595
  ),
8580
- entriesAcrossCollections: z15.number().int().min(0).optional().describe(
8596
+ entriesAcrossCollections: z16.number().int().min(0).optional().describe(
8581
8597
  "For 'record-activation': number of distinct collections those entries span. The mutation enforces >=2 (diversity soft-gate)."
8582
8598
  ),
8583
- retrievalDemoConfirmed: z15.boolean().optional().describe(
8599
+ retrievalDemoConfirmed: z16.boolean().optional().describe(
8584
8600
  "For 'record-activation': true if the retrieval round-trip ran successfully in Phase 4. The mutation rejects false."
8585
8601
  )
8586
8602
  });
8587
- var orientStartVariant = z15.object({
8588
- action: z15.literal("start"),
8589
- task: z15.string().max(2e3).optional()
8603
+ var orientStartVariant = z16.object({
8604
+ action: z16.literal("start"),
8605
+ task: z16.string().max(2e3).optional()
8590
8606
  });
8591
- var orientTaskVariant = z15.object({
8592
- action: z15.literal("task"),
8593
- mode: z15.enum(["full", "brief"]).optional().default("full"),
8594
- tier: z15.enum(["summary", "standard", "full"]).optional(),
8595
- task: z15.string().max(2e3).optional(),
8596
- scope: z15.string().max(200).optional(),
8607
+ var orientTaskVariant = z16.object({
8608
+ action: z16.literal("task"),
8609
+ mode: z16.enum(["full", "brief"]).optional().default("full"),
8610
+ tier: z16.enum(["summary", "standard", "full"]).optional(),
8611
+ task: z16.string().max(2e3).optional(),
8612
+ scope: z16.string().max(200).optional(),
8597
8613
  // WP-486 Slice 1 (FEAT-1371) — mirrors orientSchema's top-level declaration above; see its
8598
8614
  // doc comment for the shape rationale.
8599
- startupSignals: z15.object({
8600
- changedPaths: z15.array(z15.string()).max(25).optional(),
8601
- reviewedArtifactRefs: z15.array(z15.string()).max(25).optional(),
8602
- branchName: z15.string().max(120).optional(),
8603
- worktreeName: z15.string().max(120).optional()
8615
+ startupSignals: z16.object({
8616
+ changedPaths: z16.array(z16.string()).max(25).optional(),
8617
+ reviewedArtifactRefs: z16.array(z16.string()).max(25).optional(),
8618
+ branchName: z16.string().max(120).optional(),
8619
+ worktreeName: z16.string().max(120).optional()
8604
8620
  }).optional(),
8605
- invocationPath: z15.enum(["session-start", "session-close", "manual-orient", "handshake", "unknown"]).optional()
8621
+ invocationPath: z16.enum(["session-start", "session-close", "manual-orient", "handshake", "unknown"]).optional()
8606
8622
  });
8607
- var orientRecordActivationVariant = z15.object({
8608
- action: z15.literal("record-activation"),
8609
- confirmedEntryCount: z15.number().int().min(0),
8610
- entriesAcrossCollections: z15.number().int().min(0),
8611
- retrievalDemoConfirmed: z15.boolean()
8623
+ var orientRecordActivationVariant = z16.object({
8624
+ action: z16.literal("record-activation"),
8625
+ confirmedEntryCount: z16.number().int().min(0),
8626
+ entriesAcrossCollections: z16.number().int().min(0),
8627
+ retrievalDemoConfirmed: z16.boolean()
8612
8628
  });
8613
- var orientActionUnion = z15.discriminatedUnion("action", [
8629
+ var orientActionUnion = z16.discriminatedUnion("action", [
8614
8630
  orientStartVariant,
8615
8631
  orientTaskVariant,
8616
8632
  orientRecordActivationVariant
@@ -9438,7 +9454,7 @@ async function _handleOrient({ mode = "full", tier, task, scope, startupSignals,
9438
9454
  }
9439
9455
 
9440
9456
  // src/tools/workflows.ts
9441
- import { z as z16 } from "zod/v3";
9457
+ import { z as z17 } from "zod/v3";
9442
9458
 
9443
9459
  // src/workflows/descriptor.ts
9444
9460
  function cloneWorkflowQuestion(question) {
@@ -10278,72 +10294,72 @@ function workflowRunOutputToText(output) {
10278
10294
 
10279
10295
  // src/tools/workflows.ts
10280
10296
  var WORKFLOWS_ACTIONS = ["list", "start", "checkpoint", "get-run", "load-skill"];
10281
- var jsonValueSchema = z16.lazy(
10282
- () => z16.union([
10283
- z16.string(),
10284
- z16.number(),
10285
- z16.boolean(),
10286
- z16.null(),
10287
- z16.array(jsonValueSchema),
10288
- z16.record(jsonValueSchema)
10297
+ var jsonValueSchema = z17.lazy(
10298
+ () => z17.union([
10299
+ z17.string(),
10300
+ z17.number(),
10301
+ z17.boolean(),
10302
+ z17.null(),
10303
+ z17.array(jsonValueSchema),
10304
+ z17.record(jsonValueSchema)
10289
10305
  ])
10290
10306
  );
10291
- var workflowRunOutputInputSchema = z16.union([
10292
- z16.object({
10293
- format: z16.literal("freetext"),
10294
- value: z16.string()
10307
+ var workflowRunOutputInputSchema = z17.union([
10308
+ z17.object({
10309
+ format: z17.literal("freetext"),
10310
+ value: z17.string()
10295
10311
  }),
10296
- z16.object({
10297
- format: z16.literal("list"),
10298
- value: z16.array(z16.string())
10312
+ z17.object({
10313
+ format: z17.literal("list"),
10314
+ value: z17.array(z17.string())
10299
10315
  }),
10300
- z16.object({
10301
- format: z16.literal("choice"),
10302
- value: z16.union([z16.string(), z16.array(z16.string())])
10316
+ z17.object({
10317
+ format: z17.literal("choice"),
10318
+ value: z17.union([z17.string(), z17.array(z17.string())])
10303
10319
  }),
10304
- z16.object({
10305
- format: z16.literal("structured"),
10320
+ z17.object({
10321
+ format: z17.literal("structured"),
10306
10322
  value: jsonValueSchema
10307
10323
  })
10308
10324
  ]);
10309
- var workflowsSchema = z16.object({
10310
- action: z16.enum(WORKFLOWS_ACTIONS).describe(
10325
+ var workflowsSchema = z17.object({
10326
+ action: z17.enum(WORKFLOWS_ACTIONS).describe(
10311
10327
  "'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."
10312
10328
  ),
10313
- workflowId: z16.string().max(200).optional().describe("Workflow ID for start, checkpoint, or get-run, e.g. 'retro', 'implementation-review'"),
10314
- runId: z16.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)."),
10315
- roundId: z16.string().max(200).optional().describe("Round ID for checkpoint, e.g. 'what-went-well'"),
10316
- output: z16.union([z16.string(), workflowRunOutputInputSchema]).optional().describe(
10329
+ workflowId: z17.string().max(200).optional().describe("Workflow ID for start, checkpoint, or get-run, e.g. 'retro', 'implementation-review'"),
10330
+ runId: z17.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)."),
10331
+ roundId: z17.string().max(200).optional().describe("Round ID for checkpoint, e.g. 'what-went-well'"),
10332
+ output: z17.union([z17.string(), workflowRunOutputInputSchema]).optional().describe(
10317
10333
  "The round's output \u2014 either legacy synthesized text or a typed workflow run payload."
10318
10334
  ),
10319
- isFinal: z16.boolean().optional().describe("If true, finalize an existing durable workflow run from its terminal round and create the summary chain entry."),
10320
- restart: z16.boolean().optional().describe("If true, start a new durable run from the workflow's first round in the current session."),
10321
- summaryName: z16.string().max(500).optional().describe("Optional name for final chain entry. If omitted, the workflow summary template is used."),
10322
- summaryDescription: z16.string().max(2e4).optional().describe("Optional override for the final chain entry description. Defaults to the final round output text."),
10323
- summaryEntryId: z16.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."),
10324
- entryId: z16.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.")
10335
+ isFinal: z17.boolean().optional().describe("If true, finalize an existing durable workflow run from its terminal round and create the summary chain entry."),
10336
+ restart: z17.boolean().optional().describe("If true, start a new durable run from the workflow's first round in the current session."),
10337
+ summaryName: z17.string().max(500).optional().describe("Optional name for final chain entry. If omitted, the workflow summary template is used."),
10338
+ summaryDescription: z17.string().max(2e4).optional().describe("Optional override for the final chain entry description. Defaults to the final round output text."),
10339
+ summaryEntryId: z17.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."),
10340
+ entryId: z17.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.")
10325
10341
  });
10326
- var workflowsListVariant = z16.object({ action: z16.literal("list") });
10327
- var workflowsGetRunVariant = z16.object({
10328
- action: z16.literal("get-run"),
10329
- runId: z16.string().max(200).optional(),
10330
- workflowId: z16.string().max(200).optional()
10342
+ var workflowsListVariant = z17.object({ action: z17.literal("list") });
10343
+ var workflowsGetRunVariant = z17.object({
10344
+ action: z17.literal("get-run"),
10345
+ runId: z17.string().max(200).optional(),
10346
+ workflowId: z17.string().max(200).optional()
10331
10347
  });
10332
- var workflowsStartVariant = z16.object({ action: z16.literal("start"), workflowId: z16.string().max(200) });
10333
- var workflowsCheckpointVariant = z16.object({
10334
- action: z16.literal("checkpoint"),
10335
- workflowId: z16.string().max(200),
10336
- roundId: z16.string().max(200),
10337
- output: z16.union([z16.string(), workflowRunOutputInputSchema]),
10338
- isFinal: z16.boolean().optional(),
10339
- restart: z16.boolean().optional(),
10340
- summaryName: z16.string().max(500).optional(),
10341
- summaryDescription: z16.string().max(2e4).optional(),
10342
- summaryEntryId: z16.string().max(200).optional(),
10343
- runId: z16.string().max(200).optional()
10348
+ var workflowsStartVariant = z17.object({ action: z17.literal("start"), workflowId: z17.string().max(200) });
10349
+ var workflowsCheckpointVariant = z17.object({
10350
+ action: z17.literal("checkpoint"),
10351
+ workflowId: z17.string().max(200),
10352
+ roundId: z17.string().max(200),
10353
+ output: z17.union([z17.string(), workflowRunOutputInputSchema]),
10354
+ isFinal: z17.boolean().optional(),
10355
+ restart: z17.boolean().optional(),
10356
+ summaryName: z17.string().max(500).optional(),
10357
+ summaryDescription: z17.string().max(2e4).optional(),
10358
+ summaryEntryId: z17.string().max(200).optional(),
10359
+ runId: z17.string().max(200).optional()
10344
10360
  });
10345
- var workflowsLoadSkillVariant = z16.object({ action: z16.literal("load-skill"), entryId: z16.string().max(200).min(1) });
10346
- var workflowsActionUnion = z16.discriminatedUnion("action", [
10361
+ var workflowsLoadSkillVariant = z17.object({ action: z17.literal("load-skill"), entryId: z17.string().max(200).min(1) });
10362
+ var workflowsActionUnion = z17.discriminatedUnion("action", [
10347
10363
  workflowsListVariant,
10348
10364
  workflowsGetRunVariant,
10349
10365
  workflowsStartVariant,
@@ -11078,10 +11094,10 @@ function parseListOutput(output) {
11078
11094
  }
11079
11095
 
11080
11096
  // src/tools/quality.ts
11081
- import { z as z18 } from "zod/v3";
11097
+ import { z as z19 } from "zod/v3";
11082
11098
 
11083
11099
  // src/tools/audit.ts
11084
- import { z as z17 } from "zod/v3";
11100
+ import { z as z18 } from "zod/v3";
11085
11101
  var VOCAB_TTL_MS = 5 * 60 * 1e3;
11086
11102
  var MAX_VOCAB_KEYS = 100;
11087
11103
  var vocabCache = /* @__PURE__ */ new Map();
@@ -11111,12 +11127,12 @@ function evictVocabIfFull() {
11111
11127
  }
11112
11128
  }
11113
11129
  var AUDIT_ACTIONS = ["run"];
11114
- var auditSchema = z17.object({
11115
- action: z17.enum(AUDIT_ACTIONS).describe(
11130
+ var auditSchema = z18.object({
11131
+ action: z18.enum(AUDIT_ACTIONS).describe(
11116
11132
  "'run': run the hygiene audit for a bet entry."
11117
11133
  ),
11118
- entryId: z17.string().describe("Bet entry ID to audit, e.g. '<PREFIX>-<n>'"),
11119
- phase: z17.enum(["shaping", "handoff"]).default("shaping").optional().describe(
11134
+ entryId: z18.string().describe("Bet entry ID to audit, e.g. '<PREFIX>-<n>'"),
11135
+ phase: z18.enum(["shaping", "handoff"]).default("shaping").optional().describe(
11120
11136
  "'shaping': check shaping-phase fields only. 'handoff': check all required fields including buildContract/buildSequence/exclusions/risks. Default: shaping."
11121
11137
  )
11122
11138
  });
@@ -11232,35 +11248,35 @@ async function handleAuditRun(entryId, phase) {
11232
11248
 
11233
11249
  // src/tools/quality.ts
11234
11250
  var QUALITY_ACTIONS = ["check", "re-evaluate", "verify-chain", "audit"];
11235
- var qualitySchema = z18.object({
11236
- action: z18.enum(QUALITY_ACTIONS).describe(
11251
+ var qualitySchema = z19.object({
11252
+ action: z19.enum(QUALITY_ACTIONS).describe(
11237
11253
  "'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 bet entry \u2014 absorbs `audit`."
11238
11254
  ),
11239
- entryId: z18.string().max(200).optional().describe("For 'check'/'re-evaluate'/'audit': entry ID, e.g. 'TEN-graph-db', '<PREFIX>-<n>'."),
11240
- context: z18.enum(["capture", "commit", "review"]).default("review").optional().describe("For re-evaluate: evaluation context"),
11241
- collection: z18.string().max(200).optional().describe("For 'verify-chain': collection slug to verify (default: glossary)."),
11242
- mode: z18.enum(["report", "fix"]).optional().describe("For 'verify-chain': 'report' = read-only trust report (default). 'fix' = also update drifted codeMapping statuses."),
11243
- phase: z18.enum(["shaping", "handoff"]).optional().describe(
11255
+ entryId: z19.string().max(200).optional().describe("For 'check'/'re-evaluate'/'audit': entry ID, e.g. 'TEN-graph-db', '<PREFIX>-<n>'."),
11256
+ context: z19.enum(["capture", "commit", "review"]).default("review").optional().describe("For re-evaluate: evaluation context"),
11257
+ collection: z19.string().max(200).optional().describe("For 'verify-chain': collection slug to verify (default: glossary)."),
11258
+ mode: z19.enum(["report", "fix"]).optional().describe("For 'verify-chain': 'report' = read-only trust report (default). 'fix' = also update drifted codeMapping statuses."),
11259
+ phase: z19.enum(["shaping", "handoff"]).optional().describe(
11244
11260
  "For 'audit': 'shaping' checks shaping-phase fields only (default). 'handoff' checks all required fields including buildContract/buildSequence/exclusions/risks."
11245
11261
  )
11246
11262
  });
11247
- var qualityCheckVariant = z18.object({ action: z18.literal("check"), entryId: z18.string().max(200) });
11248
- var qualityReEvaluateVariant = z18.object({
11249
- action: z18.literal("re-evaluate"),
11250
- entryId: z18.string().max(200),
11251
- context: z18.enum(["capture", "commit", "review"]).optional().default("review")
11263
+ var qualityCheckVariant = z19.object({ action: z19.literal("check"), entryId: z19.string().max(200) });
11264
+ var qualityReEvaluateVariant = z19.object({
11265
+ action: z19.literal("re-evaluate"),
11266
+ entryId: z19.string().max(200),
11267
+ context: z19.enum(["capture", "commit", "review"]).optional().default("review")
11252
11268
  });
11253
- var qualityVerifyChainVariant = z18.object({
11254
- action: z18.literal("verify-chain"),
11255
- collection: z18.string().max(200).optional().default("glossary"),
11256
- mode: z18.enum(["report", "fix"]).optional().default("report")
11269
+ var qualityVerifyChainVariant = z19.object({
11270
+ action: z19.literal("verify-chain"),
11271
+ collection: z19.string().max(200).optional().default("glossary"),
11272
+ mode: z19.enum(["report", "fix"]).optional().default("report")
11257
11273
  });
11258
- var qualityAuditVariant = z18.object({
11259
- action: z18.literal("audit"),
11260
- entryId: z18.string().max(200),
11261
- phase: z18.enum(["shaping", "handoff"]).optional().default("shaping")
11274
+ var qualityAuditVariant = z19.object({
11275
+ action: z19.literal("audit"),
11276
+ entryId: z19.string().max(200),
11277
+ phase: z19.enum(["shaping", "handoff"]).optional().default("shaping")
11262
11278
  });
11263
- var qualityActionUnion = z18.discriminatedUnion("action", [
11279
+ var qualityActionUnion = z19.discriminatedUnion("action", [
11264
11280
  qualityCheckVariant,
11265
11281
  qualityReEvaluateVariant,
11266
11282
  qualityVerifyChainVariant,
@@ -11272,27 +11288,27 @@ var QUALITY_ACTION_SPECS = {
11272
11288
  "verify-chain": { params: ["collection", "mode"], description: "All params optional; collection defaults to 'glossary'." },
11273
11289
  audit: { params: ["entryId", "phase"], description: "entryId is required." }
11274
11290
  };
11275
- var qualityCheckOutputSchema = z18.object({
11276
- entryId: z18.string(),
11291
+ var qualityCheckOutputSchema = z19.object({
11292
+ entryId: z19.string(),
11277
11293
  /** WP-480 S1: false = the ID does not resolve to an entry (typo/deleted) — distinct from "no verdict yet". */
11278
- entryFound: z18.boolean().optional(),
11279
- hasVerdict: z18.boolean(),
11294
+ entryFound: z19.boolean().optional(),
11295
+ hasVerdict: z19.boolean(),
11280
11296
  /** WP-480 S1: the verdict was judged against content the entry no longer has — re-evaluate for a current one. */
11281
- stale: z18.boolean().optional(),
11282
- tier: z18.string().optional(),
11283
- passed: z18.boolean().optional(),
11284
- criteria: z18.array(z18.object({
11285
- id: z18.string(),
11286
- passed: z18.boolean(),
11287
- hint: z18.string().optional()
11297
+ stale: z19.boolean().optional(),
11298
+ tier: z19.string().optional(),
11299
+ passed: z19.boolean().optional(),
11300
+ criteria: z19.array(z19.object({
11301
+ id: z19.string(),
11302
+ passed: z19.boolean(),
11303
+ hint: z19.string().optional()
11288
11304
  }))
11289
11305
  });
11290
- var qualityReevaluateOutputSchema = z18.object({
11291
- entryId: z18.string(),
11292
- context: z18.string(),
11293
- score: z18.number(),
11294
- maxScore: z18.number(),
11295
- improved: z18.boolean()
11306
+ var qualityReevaluateOutputSchema = z19.object({
11307
+ entryId: z19.string(),
11308
+ context: z19.string(),
11309
+ score: z19.number(),
11310
+ maxScore: z19.number(),
11311
+ improved: z19.boolean()
11296
11312
  });
11297
11313
  function registerQualityTools(server) {
11298
11314
  const qualityHandlers = {
@@ -11473,10 +11489,10 @@ async function handleReEvaluate(entryId, context) {
11473
11489
  }
11474
11490
 
11475
11491
  // src/tools/session.ts
11476
- import { z as z21 } from "zod/v3";
11492
+ import { z as z22 } from "zod/v3";
11477
11493
 
11478
11494
  // src/tools/wrapup.ts
11479
- import { z as z19 } from "zod/v3";
11495
+ import { z as z20 } from "zod/v3";
11480
11496
 
11481
11497
  // src/lib/compose-wrapup-view.ts
11482
11498
  function toComposed(e) {
@@ -11929,8 +11945,8 @@ async function runWrapupCommitAll(data, cachedSuggestions) {
11929
11945
  overflowUnscanned
11930
11946
  };
11931
11947
  }
11932
- var wrapupSchema = z19.object({
11933
- action: z19.enum(["review", "commit-all"]).optional().describe(
11948
+ var wrapupSchema = z20.object({
11949
+ action: z20.enum(["review", "commit-all"]).optional().describe(
11934
11950
  "Action to perform. 'review' (default) shows the wrapup summary. 'commit-all' accepts all uncommitted drafts and creates suggested links."
11935
11951
  )
11936
11952
  });
@@ -12031,26 +12047,26 @@ ${text}` : text;
12031
12047
  }
12032
12048
 
12033
12049
  // src/tools/facilitate.ts
12034
- import { z as z20 } from "zod/v3";
12050
+ import { z as z21 } from "zod/v3";
12035
12051
  var FACILITATE_ACTIONS = ["resume", "commit-constellation"];
12036
- var coherencyAcknowledgementSchema = z20.object({
12037
- response: z20.string().max(200).describe("Acknowledgement response per offender: 'linked' | 'accepted-fix' | 'diverged'."),
12038
- entryId: z20.string().max(200).optional().describe("Entry the acknowledgement links to (e.g. the strategic spine entry)."),
12039
- reason: z20.string().max(2e3).optional().describe("Free-text justification, required for a 'diverged' response."),
12040
- subjectEntryId: z20.string().max(200).optional().describe("The refused entry this acknowledgement answers.")
12052
+ var coherencyAcknowledgementSchema = z21.object({
12053
+ response: z21.string().max(200).describe("Acknowledgement response per offender: 'linked' | 'accepted-fix' | 'diverged'."),
12054
+ entryId: z21.string().max(200).optional().describe("Entry the acknowledgement links to (e.g. the strategic spine entry)."),
12055
+ reason: z21.string().max(2e3).optional().describe("Free-text justification, required for a 'diverged' response."),
12056
+ subjectEntryId: z21.string().max(200).optional().describe("The refused entry this acknowledgement answers.")
12041
12057
  });
12042
- var facilitateSchema = z20.object({
12043
- action: z20.enum(FACILITATE_ACTIONS).describe(
12058
+ var facilitateSchema = z21.object({
12059
+ action: z21.enum(FACILITATE_ACTIONS).describe(
12044
12060
  "'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."
12045
12061
  ),
12046
- betEntryId: z20.string().max(200).optional().describe("Bet entry ID. Required for both actions."),
12047
- operationId: z20.string().max(200).optional().describe("Optional idempotency key for commit-constellation retries."),
12062
+ betEntryId: z21.string().max(200).optional().describe("Bet entry ID. Required for both actions."),
12063
+ operationId: z21.string().max(200).optional().describe("Optional idempotency key for commit-constellation retries."),
12048
12064
  // WP-465 slice ⑤: coherency retry controls for a COHERENCY_REFUSED constellation hold.
12049
12065
  // Forwarded verbatim to agentKnowledge.facilitateEnvelope (validation lives at the gate).
12050
- coherencyAcknowledgements: z20.array(coherencyAcknowledgementSchema).max(20).optional().describe(
12066
+ coherencyAcknowledgements: z21.array(coherencyAcknowledgementSchema).max(20).optional().describe(
12051
12067
  "Per-offender acknowledgements to retry a constellation held under standard/strict coherency mode. Each: {subjectEntryId, response: 'linked' | 'accepted-fix' | 'diverged', entryId?, reason?}."
12052
12068
  ),
12053
- steeringOverrideReason: z20.string().max(2e3).optional().describe(
12069
+ steeringOverrideReason: z21.string().max(2e3).optional().describe(
12054
12070
  "Typed override reason (>= 12 chars) to push a constellation past a coherency hold instead of acknowledging."
12055
12071
  )
12056
12072
  });
@@ -12303,33 +12319,33 @@ var SESSION_ACTIONS = [
12303
12319
  "resume",
12304
12320
  "commit-constellation"
12305
12321
  ];
12306
- var coherencyAcknowledgementFlatSchema2 = z21.object({
12307
- response: z21.string().max(200).describe("Acknowledgement response per offender: 'linked' | 'accepted-fix' | 'diverged'."),
12308
- entryId: z21.string().max(200).optional().describe("Entry the acknowledgement links to."),
12309
- reason: z21.string().max(2e3).optional().describe("Free-text justification, required for a 'diverged' response."),
12310
- subjectEntryId: z21.string().max(200).optional().describe("The refused entry this acknowledgement answers.")
12322
+ var coherencyAcknowledgementFlatSchema2 = z22.object({
12323
+ response: z22.string().max(200).describe("Acknowledgement response per offender: 'linked' | 'accepted-fix' | 'diverged'."),
12324
+ entryId: z22.string().max(200).optional().describe("Entry the acknowledgement links to."),
12325
+ reason: z22.string().max(2e3).optional().describe("Free-text justification, required for a 'diverged' response."),
12326
+ subjectEntryId: z22.string().max(200).optional().describe("The refused entry this acknowledgement answers.")
12311
12327
  });
12312
- var sessionSchema = z21.object({
12313
- action: z21.enum(SESSION_ACTIONS).describe(
12328
+ var sessionSchema = z22.object({
12329
+ action: z22.enum(SESSION_ACTIONS).describe(
12314
12330
  "'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)."
12315
12331
  ),
12316
- betEntryId: z21.string().max(200).optional().describe("For 'resume'/'commit-constellation': bet entry ID. Required for both."),
12317
- operationId: z21.string().max(200).optional().describe("For 'commit-constellation': optional idempotency key for retries."),
12318
- coherencyAcknowledgements: z21.array(coherencyAcknowledgementFlatSchema2).max(20).optional().describe(
12332
+ betEntryId: z22.string().max(200).optional().describe("For 'resume'/'commit-constellation': bet entry ID. Required for both."),
12333
+ operationId: z22.string().max(200).optional().describe("For 'commit-constellation': optional idempotency key for retries."),
12334
+ coherencyAcknowledgements: z22.array(coherencyAcknowledgementFlatSchema2).max(20).optional().describe(
12319
12335
  "For 'commit-constellation': per-offender acknowledgements to retry a constellation held under standard/strict coherency mode."
12320
12336
  ),
12321
- steeringOverrideReason: z21.string().max(2e3).optional().describe(
12337
+ steeringOverrideReason: z22.string().max(2e3).optional().describe(
12322
12338
  "For 'commit-constellation': typed override reason (>= 12 chars) to push past a coherency hold instead of acknowledging."
12323
12339
  )
12324
12340
  });
12325
- var sessionStartVariant = z21.object({ action: z21.literal("start") });
12326
- var sessionCloseVariant = z21.object({ action: z21.literal("close") });
12327
- var sessionStatusVariant = z21.object({ action: z21.literal("status") });
12328
- var sessionWrapupReviewVariant = z21.object({ action: z21.literal("wrapup-review") });
12329
- var sessionWrapupCommitVariant = z21.object({ action: z21.literal("wrapup-commit") });
12330
- var sessionResumeVariant = facilitateSchema.omit({ action: true }).extend({ action: z21.literal("resume") });
12331
- var sessionCommitConstellationVariant = facilitateSchema.omit({ action: true }).extend({ action: z21.literal("commit-constellation") });
12332
- var sessionActionUnion = z21.discriminatedUnion("action", [
12341
+ var sessionStartVariant = z22.object({ action: z22.literal("start") });
12342
+ var sessionCloseVariant = z22.object({ action: z22.literal("close") });
12343
+ var sessionStatusVariant = z22.object({ action: z22.literal("status") });
12344
+ var sessionWrapupReviewVariant = z22.object({ action: z22.literal("wrapup-review") });
12345
+ var sessionWrapupCommitVariant = z22.object({ action: z22.literal("wrapup-commit") });
12346
+ var sessionResumeVariant = facilitateSchema.omit({ action: true }).extend({ action: z22.literal("resume") });
12347
+ var sessionCommitConstellationVariant = facilitateSchema.omit({ action: true }).extend({ action: z22.literal("commit-constellation") });
12348
+ var sessionActionUnion = z22.discriminatedUnion("action", [
12333
12349
  sessionStartVariant,
12334
12350
  sessionCloseVariant,
12335
12351
  sessionStatusVariant,
@@ -12553,7 +12569,7 @@ async function handleStatus() {
12553
12569
  }
12554
12570
 
12555
12571
  // src/tools/gitchain.ts
12556
- import { z as z22 } from "zod/v3";
12572
+ import { z as z23 } from "zod/v3";
12557
12573
 
12558
12574
  // src/lib/versionDisplay.ts
12559
12575
  function toVersionDisplay(version) {
@@ -12562,48 +12578,48 @@ function toVersionDisplay(version) {
12562
12578
  }
12563
12579
 
12564
12580
  // src/tools/gitchain.ts
12565
- var chainSchema = z22.object({
12566
- action: z22.enum(["create", "get", "list", "edit"]).describe("Action: create a process, get process details, list all processes, or edit a process link"),
12567
- chainEntryId: z22.string().max(200).optional().describe("Chain entry ID (required for get/edit)"),
12568
- title: z22.string().max(500).optional().describe("Process title (required for create)"),
12569
- chainTypeId: z22.string().max(200).optional().default("strategy-coherence").describe("Process template slug for create: 'strategy-coherence', 'idm-proposal', or any custom template slug"),
12570
- description: z22.string().max(2e4).optional().describe("Description (for create)"),
12571
- linkId: z22.string().max(200).optional().describe("Link to edit (for edit action): problem, insight, choice, action, outcome"),
12572
- content: z22.string().max(5e4).optional().describe("New content for the link (for edit action)"),
12573
- status: z22.string().max(200).optional().describe("Filter by status for list: 'draft' or 'active'"),
12574
- author: z22.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12581
+ var chainSchema = z23.object({
12582
+ action: z23.enum(["create", "get", "list", "edit"]).describe("Action: create a process, get process details, list all processes, or edit a process link"),
12583
+ chainEntryId: z23.string().max(200).optional().describe("Chain entry ID (required for get/edit)"),
12584
+ title: z23.string().max(500).optional().describe("Process title (required for create)"),
12585
+ chainTypeId: z23.string().max(200).optional().default("strategy-coherence").describe("Process template slug for create: 'strategy-coherence', 'idm-proposal', or any custom template slug"),
12586
+ description: z23.string().max(2e4).optional().describe("Description (for create)"),
12587
+ linkId: z23.string().max(200).optional().describe("Link to edit (for edit action): problem, insight, choice, action, outcome"),
12588
+ content: z23.string().max(5e4).optional().describe("New content for the link (for edit action)"),
12589
+ status: z23.string().max(200).optional().describe("Filter by status for list: 'draft' or 'active'"),
12590
+ author: z23.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12575
12591
  });
12576
- var chainVersionSchema = z22.object({
12577
- action: z22.enum(["commit", "list", "diff", "revert", "history"]).describe("Action: commit a snapshot, list commits, diff two versions, revert to a version, or view history"),
12578
- chainEntryId: z22.string().max(200).describe("The chain's entry ID"),
12579
- commitMessage: z22.string().max(2e3).optional().describe("Commit message (required for commit). Convention: type(link): description"),
12580
- versionA: z22.number().optional().describe("Earlier version for diff"),
12581
- versionB: z22.number().optional().describe("Later version for diff"),
12582
- toVersion: z22.number().optional().describe("Version number to revert to"),
12583
- author: z22.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12592
+ var chainVersionSchema = z23.object({
12593
+ action: z23.enum(["commit", "list", "diff", "revert", "history"]).describe("Action: commit a snapshot, list commits, diff two versions, revert to a version, or view history"),
12594
+ chainEntryId: z23.string().max(200).describe("The chain's entry ID"),
12595
+ commitMessage: z23.string().max(2e3).optional().describe("Commit message (required for commit). Convention: type(link): description"),
12596
+ versionA: z23.number().optional().describe("Earlier version for diff"),
12597
+ versionB: z23.number().optional().describe("Later version for diff"),
12598
+ toVersion: z23.number().optional().describe("Version number to revert to"),
12599
+ author: z23.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12584
12600
  });
12585
- var chainBranchSchema = z22.object({
12586
- action: z22.enum(["create", "list", "merge", "conflicts"]).describe("Action: create a branch, list branches, merge a branch, or check for conflicts"),
12587
- chainEntryId: z22.string().max(200).describe("The chain's entry ID"),
12588
- branchName: z22.string().max(200).optional().describe("Branch name (required for merge/conflicts, optional for create)"),
12589
- strategy: z22.enum(["merge_commit", "squash"]).optional().describe("Merge strategy: 'merge_commit' (default) or 'squash'"),
12590
- author: z22.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12601
+ var chainBranchSchema = z23.object({
12602
+ action: z23.enum(["create", "list", "merge", "conflicts"]).describe("Action: create a branch, list branches, merge a branch, or check for conflicts"),
12603
+ chainEntryId: z23.string().max(200).describe("The chain's entry ID"),
12604
+ branchName: z23.string().max(200).optional().describe("Branch name (required for merge/conflicts, optional for create)"),
12605
+ strategy: z23.enum(["merge_commit", "squash"]).optional().describe("Merge strategy: 'merge_commit' (default) or 'squash'"),
12606
+ author: z23.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12591
12607
  });
12592
- var chainReviewSchema = z22.object({
12593
- action: z22.enum(["gate", "comment", "resolve-comment", "list-comments"]).describe("Action: run coherence gate, add a comment, resolve a comment, or list comments"),
12608
+ var chainReviewSchema = z23.object({
12609
+ action: z23.enum(["gate", "comment", "resolve-comment", "list-comments"]).describe("Action: run coherence gate, add a comment, resolve a comment, or list comments"),
12594
12610
  // Finding #12: optional at the base (mirrors chainSchema's chainEntryId pattern at
12595
12611
  // line ~690) — resolve-comment resolves purely by commentId (handleChainReview never
12596
12612
  // reads chainEntryId in that branch) and the compound-tool's advertised schema
12597
12613
  // (chainReviewCompoundSchema below) already documents it as optional for that action.
12598
12614
  // Per-action variants that DO need it (gate/comment/list-comments) re-require it below,
12599
12615
  // same pattern as chainGetVariant/chainEditVariant re-requiring over chainSchema's base.
12600
- chainEntryId: z22.string().max(200).optional().describe("The chain's entry ID. Required for every action except 'resolve-comment'."),
12601
- commitMessage: z22.string().max(2e3).optional().describe("Commit message to lint (for gate action)"),
12602
- versionNumber: z22.number().optional().describe("Version to comment on or list comments for"),
12603
- linkId: z22.string().max(200).optional().describe("Link this comment targets (optional for comment)"),
12604
- body: z22.string().max(2e4).optional().describe("Comment text (required for comment action)"),
12605
- commentId: z22.string().max(200).optional().describe("Comment ID (required for resolve-comment)"),
12606
- author: z22.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12616
+ chainEntryId: z23.string().max(200).optional().describe("The chain's entry ID. Required for every action except 'resolve-comment'."),
12617
+ commitMessage: z23.string().max(2e3).optional().describe("Commit message to lint (for gate action)"),
12618
+ versionNumber: z23.number().optional().describe("Version to comment on or list comments for"),
12619
+ linkId: z23.string().max(200).optional().describe("Link this comment targets (optional for comment)"),
12620
+ body: z23.string().max(2e4).optional().describe("Comment text (required for comment action)"),
12621
+ commentId: z23.string().max(200).optional().describe("Comment ID (required for resolve-comment)"),
12622
+ author: z23.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
12607
12623
  });
12608
12624
  function linkSummary(links) {
12609
12625
  return Object.entries(links).map(([id, content]) => {
@@ -13108,54 +13124,54 @@ var CHAIN_REVIEW_ACTIONS = [
13108
13124
  "branch.merge",
13109
13125
  "branch.conflicts"
13110
13126
  ];
13111
- var chainCompoundSchema = z22.object({
13112
- action: z22.enum(CHAIN_ACTIONS).describe(
13127
+ var chainCompoundSchema = z23.object({
13128
+ action: z23.enum(CHAIN_ACTIONS).describe(
13113
13129
  "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."
13114
13130
  ),
13115
- chainEntryId: z22.string().max(200).optional().describe("Chain entry ID. Required for get/edit and all version.* actions."),
13116
- title: z22.string().max(500).optional().describe("For 'create': process title (required)."),
13117
- chainTypeId: z22.string().max(200).optional().default("strategy-coherence").describe("For 'create'/'list': process template slug."),
13118
- description: z22.string().max(2e4).optional().describe("For 'create': description."),
13119
- linkId: z22.string().max(200).optional().describe("For 'edit': link to edit (required)."),
13120
- content: z22.string().max(5e4).optional().describe("For 'edit': new content for the link (required)."),
13121
- status: z22.string().max(200).optional().describe("For 'list': filter by status."),
13122
- author: z22.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'."),
13123
- commitMessage: z22.string().max(2e3).optional().describe("For 'version.commit': commit message (required)."),
13124
- versionA: z22.number().optional().describe("For 'version.diff': earlier version (required)."),
13125
- versionB: z22.number().optional().describe("For 'version.diff': later version (required)."),
13126
- toVersion: z22.number().optional().describe("For 'version.revert': version number to revert to (required).")
13131
+ chainEntryId: z23.string().max(200).optional().describe("Chain entry ID. Required for get/edit and all version.* actions."),
13132
+ title: z23.string().max(500).optional().describe("For 'create': process title (required)."),
13133
+ chainTypeId: z23.string().max(200).optional().default("strategy-coherence").describe("For 'create'/'list': process template slug."),
13134
+ description: z23.string().max(2e4).optional().describe("For 'create': description."),
13135
+ linkId: z23.string().max(200).optional().describe("For 'edit': link to edit (required)."),
13136
+ content: z23.string().max(5e4).optional().describe("For 'edit': new content for the link (required)."),
13137
+ status: z23.string().max(200).optional().describe("For 'list': filter by status."),
13138
+ author: z23.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'."),
13139
+ commitMessage: z23.string().max(2e3).optional().describe("For 'version.commit': commit message (required)."),
13140
+ versionA: z23.number().optional().describe("For 'version.diff': earlier version (required)."),
13141
+ versionB: z23.number().optional().describe("For 'version.diff': later version (required)."),
13142
+ toVersion: z23.number().optional().describe("For 'version.revert': version number to revert to (required).")
13127
13143
  });
13128
- var chainReviewCompoundSchema = z22.object({
13129
- action: z22.enum(CHAIN_REVIEW_ACTIONS).describe(
13144
+ var chainReviewCompoundSchema = z23.object({
13145
+ action: z23.enum(CHAIN_REVIEW_ACTIONS).describe(
13130
13146
  "'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."
13131
13147
  ),
13132
- chainEntryId: z22.string().max(200).optional().describe("Chain entry ID. Required for every action except 'resolve-comment'."),
13133
- commitMessage: z22.string().max(2e3).optional().describe("For 'gate': commit message to lint."),
13134
- versionNumber: z22.number().optional().describe("For 'comment'/'list-comments': version to comment on or list comments for."),
13135
- linkId: z22.string().max(200).optional().describe("For 'comment': optional link this comment targets."),
13136
- body: z22.string().max(2e4).optional().describe("For 'comment': comment text (required)."),
13137
- commentId: z22.string().max(200).optional().describe("For 'resolve-comment': comment ID (required)."),
13138
- branchName: z22.string().max(200).optional().describe("For 'branch.merge'/'branch.conflicts': required. For 'branch.create': optional."),
13139
- strategy: z22.enum(["merge_commit", "squash"]).optional().describe("For 'branch.merge': merge strategy. Default 'merge_commit'."),
13140
- author: z22.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
13148
+ chainEntryId: z23.string().max(200).optional().describe("Chain entry ID. Required for every action except 'resolve-comment'."),
13149
+ commitMessage: z23.string().max(2e3).optional().describe("For 'gate': commit message to lint."),
13150
+ versionNumber: z23.number().optional().describe("For 'comment'/'list-comments': version to comment on or list comments for."),
13151
+ linkId: z23.string().max(200).optional().describe("For 'comment': optional link this comment targets."),
13152
+ body: z23.string().max(2e4).optional().describe("For 'comment': comment text (required)."),
13153
+ commentId: z23.string().max(200).optional().describe("For 'resolve-comment': comment ID (required)."),
13154
+ branchName: z23.string().max(200).optional().describe("For 'branch.merge'/'branch.conflicts': required. For 'branch.create': optional."),
13155
+ strategy: z23.enum(["merge_commit", "squash"]).optional().describe("For 'branch.merge': merge strategy. Default 'merge_commit'."),
13156
+ author: z23.string().max(200).optional().describe("Who is performing the action. Defaults to 'mcp'.")
13141
13157
  });
13142
- var chainCreateVariant = chainSchema.omit({ action: true }).extend({ action: z22.literal("create") });
13143
- var chainGetVariant = z22.object({ action: z22.literal("get"), chainEntryId: z22.string().max(200) });
13144
- var chainListVariant = z22.object({ action: z22.literal("list"), chainTypeId: z22.string().max(200).optional(), status: z22.string().max(200).optional() });
13145
- var chainEditVariant = z22.object({
13146
- action: z22.literal("edit"),
13147
- chainEntryId: z22.string().max(200),
13148
- linkId: z22.string().max(200),
13149
- content: z22.string().max(5e4),
13150
- author: z22.string().max(200).optional()
13158
+ var chainCreateVariant = chainSchema.omit({ action: true }).extend({ action: z23.literal("create") });
13159
+ var chainGetVariant = z23.object({ action: z23.literal("get"), chainEntryId: z23.string().max(200) });
13160
+ var chainListVariant = z23.object({ action: z23.literal("list"), chainTypeId: z23.string().max(200).optional(), status: z23.string().max(200).optional() });
13161
+ var chainEditVariant = z23.object({
13162
+ action: z23.literal("edit"),
13163
+ chainEntryId: z23.string().max(200),
13164
+ linkId: z23.string().max(200),
13165
+ content: z23.string().max(5e4),
13166
+ author: z23.string().max(200).optional()
13151
13167
  });
13152
13168
  var versionBase = chainVersionSchema.omit({ action: true });
13153
- var chainVersionCommitVariant = versionBase.extend({ action: z22.literal("version.commit"), commitMessage: z22.string().max(2e3) });
13154
- var chainVersionListVariant = versionBase.extend({ action: z22.literal("version.list") });
13155
- var chainVersionDiffVariant = versionBase.extend({ action: z22.literal("version.diff"), versionA: z22.number(), versionB: z22.number() });
13156
- var chainVersionRevertVariant = versionBase.extend({ action: z22.literal("version.revert"), toVersion: z22.number() });
13157
- var chainVersionHistoryVariant = versionBase.extend({ action: z22.literal("version.history") });
13158
- var chainActionUnion = z22.discriminatedUnion("action", [
13169
+ var chainVersionCommitVariant = versionBase.extend({ action: z23.literal("version.commit"), commitMessage: z23.string().max(2e3) });
13170
+ var chainVersionListVariant = versionBase.extend({ action: z23.literal("version.list") });
13171
+ var chainVersionDiffVariant = versionBase.extend({ action: z23.literal("version.diff"), versionA: z23.number(), versionB: z23.number() });
13172
+ var chainVersionRevertVariant = versionBase.extend({ action: z23.literal("version.revert"), toVersion: z23.number() });
13173
+ var chainVersionHistoryVariant = versionBase.extend({ action: z23.literal("version.history") });
13174
+ var chainActionUnion = z23.discriminatedUnion("action", [
13159
13175
  chainCreateVariant,
13160
13176
  chainGetVariant,
13161
13177
  chainListVariant,
@@ -13167,16 +13183,16 @@ var chainActionUnion = z22.discriminatedUnion("action", [
13167
13183
  chainVersionHistoryVariant
13168
13184
  ]);
13169
13185
  var reviewBase = chainReviewSchema.omit({ action: true });
13170
- var chainReviewGateVariant = reviewBase.extend({ action: z22.literal("gate"), chainEntryId: z22.string().max(200) });
13171
- var chainReviewCommentVariant = reviewBase.extend({ action: z22.literal("comment"), chainEntryId: z22.string().max(200), versionNumber: z22.number(), body: z22.string().max(2e4) });
13172
- var chainReviewResolveCommentVariant = reviewBase.extend({ action: z22.literal("resolve-comment"), commentId: z22.string().max(200) });
13173
- var chainReviewListCommentsVariant = reviewBase.extend({ action: z22.literal("list-comments"), chainEntryId: z22.string().max(200) });
13186
+ var chainReviewGateVariant = reviewBase.extend({ action: z23.literal("gate"), chainEntryId: z23.string().max(200) });
13187
+ var chainReviewCommentVariant = reviewBase.extend({ action: z23.literal("comment"), chainEntryId: z23.string().max(200), versionNumber: z23.number(), body: z23.string().max(2e4) });
13188
+ var chainReviewResolveCommentVariant = reviewBase.extend({ action: z23.literal("resolve-comment"), commentId: z23.string().max(200) });
13189
+ var chainReviewListCommentsVariant = reviewBase.extend({ action: z23.literal("list-comments"), chainEntryId: z23.string().max(200) });
13174
13190
  var branchBase = chainBranchSchema.omit({ action: true });
13175
- var chainBranchCreateVariant = branchBase.extend({ action: z22.literal("branch.create") });
13176
- var chainBranchListVariant = branchBase.extend({ action: z22.literal("branch.list") });
13177
- var chainBranchMergeVariant = branchBase.extend({ action: z22.literal("branch.merge"), branchName: z22.string().max(200) });
13178
- var chainBranchConflictsVariant = branchBase.extend({ action: z22.literal("branch.conflicts"), branchName: z22.string().max(200) });
13179
- var chainReviewActionUnion = z22.discriminatedUnion("action", [
13191
+ var chainBranchCreateVariant = branchBase.extend({ action: z23.literal("branch.create") });
13192
+ var chainBranchListVariant = branchBase.extend({ action: z23.literal("branch.list") });
13193
+ var chainBranchMergeVariant = branchBase.extend({ action: z23.literal("branch.merge"), branchName: z23.string().max(200) });
13194
+ var chainBranchConflictsVariant = branchBase.extend({ action: z23.literal("branch.conflicts"), branchName: z23.string().max(200) });
13195
+ var chainReviewActionUnion = z23.discriminatedUnion("action", [
13180
13196
  chainReviewGateVariant,
13181
13197
  chainReviewCommentVariant,
13182
13198
  chainReviewResolveCommentVariant,
@@ -13268,38 +13284,38 @@ function registerGitChainTools(server) {
13268
13284
  }
13269
13285
 
13270
13286
  // src/tools/maps.ts
13271
- import { z as z23 } from "zod/v3";
13272
- var createAudienceMapSetSchema = z23.object({
13273
- audienceEntryId: z23.string().max(200).describe("Entry ID of the audience (e.g. STR-fb7hje)")
13287
+ import { z as z24 } from "zod/v3";
13288
+ var createAudienceMapSetSchema = z24.object({
13289
+ audienceEntryId: z24.string().max(200).describe("Entry ID of the audience (e.g. STR-fb7hje)")
13274
13290
  });
13275
- var mapSchema = z23.object({
13276
- action: z23.enum(["create", "get", "list"]).describe("Action: create a map, get map details, or list all maps"),
13277
- mapEntryId: z23.string().max(200).optional().describe("Map entry ID (for get)"),
13278
- title: z23.string().max(500).optional().describe("Map title (for create)"),
13279
- templateId: z23.string().max(200).optional().default("lean-canvas").describe("Template slug for create: 'lean-canvas' or any composed template"),
13280
- description: z23.string().max(2e4).optional().describe("Description (for create)"),
13281
- slotIds: z23.array(z23.string().max(200)).max(200).optional().describe("Slot IDs to initialize (for create; auto-populated from template if omitted)"),
13282
- status: z23.string().max(200).optional().describe("Filter by status for list")
13291
+ var mapSchema = z24.object({
13292
+ action: z24.enum(["create", "get", "list"]).describe("Action: create a map, get map details, or list all maps"),
13293
+ mapEntryId: z24.string().max(200).optional().describe("Map entry ID (for get)"),
13294
+ title: z24.string().max(500).optional().describe("Map title (for create)"),
13295
+ templateId: z24.string().max(200).optional().default("lean-canvas").describe("Template slug for create: 'lean-canvas' or any composed template"),
13296
+ description: z24.string().max(2e4).optional().describe("Description (for create)"),
13297
+ slotIds: z24.array(z24.string().max(200)).max(200).optional().describe("Slot IDs to initialize (for create; auto-populated from template if omitted)"),
13298
+ status: z24.string().max(200).optional().describe("Filter by status for list")
13283
13299
  });
13284
- var mapSlotSchema = z23.object({
13285
- action: z23.enum(["add", "remove", "replace", "list"]).describe("Action: add/remove/replace an ingredient in a slot, or list slot contents"),
13286
- mapEntryId: z23.string().max(200).describe("Map entry ID"),
13287
- slotId: z23.string().max(200).optional().describe("Slot ID (e.g. 'problem', 'customer-segments')"),
13288
- ingredientEntryId: z23.string().max(200).optional().describe("Ingredient entry ID to add/remove"),
13289
- newIngredientEntryId: z23.string().max(200).optional().describe("New ingredient entry ID (for replace)"),
13290
- label: z23.string().max(500).optional().describe("Display label override"),
13291
- author: z23.string().max(200).optional().describe("Who is performing the action")
13300
+ var mapSlotSchema = z24.object({
13301
+ action: z24.enum(["add", "remove", "replace", "list"]).describe("Action: add/remove/replace an ingredient in a slot, or list slot contents"),
13302
+ mapEntryId: z24.string().max(200).describe("Map entry ID"),
13303
+ slotId: z24.string().max(200).optional().describe("Slot ID (e.g. 'problem', 'customer-segments')"),
13304
+ ingredientEntryId: z24.string().max(200).optional().describe("Ingredient entry ID to add/remove"),
13305
+ newIngredientEntryId: z24.string().max(200).optional().describe("New ingredient entry ID (for replace)"),
13306
+ label: z24.string().max(500).optional().describe("Display label override"),
13307
+ author: z24.string().max(200).optional().describe("Who is performing the action")
13292
13308
  });
13293
- var mapVersionSchema = z23.object({
13294
- action: z23.enum(["commit", "list", "history"]).describe("Action: commit the map, list commits, or view commit history"),
13295
- mapEntryId: z23.string().max(200).describe("Map entry ID"),
13296
- commitMessage: z23.string().max(2e3).optional().describe("Commit message (for commit action)"),
13297
- author: z23.string().max(200).optional().describe("Who is committing")
13309
+ var mapVersionSchema = z24.object({
13310
+ action: z24.enum(["commit", "list", "history"]).describe("Action: commit the map, list commits, or view commit history"),
13311
+ mapEntryId: z24.string().max(200).describe("Map entry ID"),
13312
+ commitMessage: z24.string().max(2e3).optional().describe("Commit message (for commit action)"),
13313
+ author: z24.string().max(200).optional().describe("Who is committing")
13298
13314
  });
13299
- var mapSuggestSchema = z23.object({
13300
- mapEntryId: z23.string().max(200).describe("Map entry ID to suggest ingredients for"),
13301
- slotId: z23.string().max(200).optional().describe("Specific slot to find ingredients for (or all empty slots)"),
13302
- query: z23.string().max(500).optional().describe("Optional search query to narrow ingredient suggestions")
13315
+ var mapSuggestSchema = z24.object({
13316
+ mapEntryId: z24.string().max(200).describe("Map entry ID to suggest ingredients for"),
13317
+ slotId: z24.string().max(200).optional().describe("Specific slot to find ingredients for (or all empty slots)"),
13318
+ query: z24.string().max(500).optional().describe("Optional search query to narrow ingredient suggestions")
13303
13319
  });
13304
13320
  function slotSummary(slots) {
13305
13321
  return Object.entries(slots).map(([id, refs]) => {
@@ -13679,40 +13695,40 @@ var MAP_ACTIONS = [
13679
13695
  "suggest",
13680
13696
  "create-audience-set"
13681
13697
  ];
13682
- var mapCompoundSchema = z23.object({
13683
- action: z23.enum(MAP_ACTIONS).describe(
13698
+ var mapCompoundSchema = z24.object({
13699
+ action: z24.enum(MAP_ACTIONS).describe(
13684
13700
  "Unnamespaced: 'create'/'get'/'list' \u2014 map CRUD (the original `map` tool). 'slot.*' (add/remove/replace/list) \u2014 ingredient slot management, absorbs `map-slot`. 'version.*' (commit/list/history) \u2014 versioning, absorbs `map-version`. 'suggest' \u2014 find ingredients to fill empty slots, absorbs `map-suggest`. 'create-audience-set' \u2014 create all three audience intelligence maps at once, absorbs `create-audience-map-set`."
13685
13701
  ),
13686
- mapEntryId: z23.string().max(200).optional().describe("Map entry ID. Required for get and all slot.*/version.*/suggest actions."),
13687
- title: z23.string().max(500).optional().describe("For 'create': map title (required)."),
13688
- templateId: z23.string().max(200).optional().default("lean-canvas").describe("For 'create': template slug."),
13689
- description: z23.string().max(2e4).optional().describe("For 'create': description."),
13690
- slotIds: z23.array(z23.string().max(200)).max(200).optional().describe("For 'create': slot IDs to initialize."),
13691
- status: z23.string().max(200).optional().describe("For 'list': filter by status."),
13692
- slotId: z23.string().max(200).optional().describe("For 'slot.add'/'slot.remove'/'slot.replace': slot ID (required). For 'suggest': specific slot (optional)."),
13693
- ingredientEntryId: z23.string().max(200).optional().describe("For 'slot.add'/'slot.remove'/'slot.replace': ingredient entry ID to add/remove (required)."),
13694
- newIngredientEntryId: z23.string().max(200).optional().describe("For 'slot.replace': new ingredient entry ID (required)."),
13695
- label: z23.string().max(500).optional().describe("For 'slot.add'/'slot.replace': display label override."),
13696
- author: z23.string().max(200).optional().describe("Who is performing the action."),
13697
- commitMessage: z23.string().max(2e3).optional().describe("For 'version.commit': commit message."),
13698
- query: z23.string().max(500).optional().describe("For 'suggest': search query to narrow ingredient suggestions."),
13699
- audienceEntryId: z23.string().max(200).optional().describe("For 'create-audience-set': audience entry ID (required).")
13702
+ mapEntryId: z24.string().max(200).optional().describe("Map entry ID. Required for get and all slot.*/version.*/suggest actions."),
13703
+ title: z24.string().max(500).optional().describe("For 'create': map title (required)."),
13704
+ templateId: z24.string().max(200).optional().default("lean-canvas").describe("For 'create': template slug."),
13705
+ description: z24.string().max(2e4).optional().describe("For 'create': description."),
13706
+ slotIds: z24.array(z24.string().max(200)).max(200).optional().describe("For 'create': slot IDs to initialize."),
13707
+ status: z24.string().max(200).optional().describe("For 'list': filter by status."),
13708
+ slotId: z24.string().max(200).optional().describe("For 'slot.add'/'slot.remove'/'slot.replace': slot ID (required). For 'suggest': specific slot (optional)."),
13709
+ ingredientEntryId: z24.string().max(200).optional().describe("For 'slot.add'/'slot.remove'/'slot.replace': ingredient entry ID to add/remove (required)."),
13710
+ newIngredientEntryId: z24.string().max(200).optional().describe("For 'slot.replace': new ingredient entry ID (required)."),
13711
+ label: z24.string().max(500).optional().describe("For 'slot.add'/'slot.replace': display label override."),
13712
+ author: z24.string().max(200).optional().describe("Who is performing the action."),
13713
+ commitMessage: z24.string().max(2e3).optional().describe("For 'version.commit': commit message."),
13714
+ query: z24.string().max(500).optional().describe("For 'suggest': search query to narrow ingredient suggestions."),
13715
+ audienceEntryId: z24.string().max(200).optional().describe("For 'create-audience-set': audience entry ID (required).")
13700
13716
  });
13701
- var mapCreateVariant = mapSchema.omit({ action: true }).extend({ action: z23.literal("create") });
13702
- var mapGetVariant = z23.object({ action: z23.literal("get"), mapEntryId: z23.string().max(200) });
13703
- var mapListVariant = z23.object({ action: z23.literal("list"), templateId: z23.string().max(200).optional(), status: z23.string().max(200).optional() });
13717
+ var mapCreateVariant = mapSchema.omit({ action: true }).extend({ action: z24.literal("create") });
13718
+ var mapGetVariant = z24.object({ action: z24.literal("get"), mapEntryId: z24.string().max(200) });
13719
+ var mapListVariant = z24.object({ action: z24.literal("list"), templateId: z24.string().max(200).optional(), status: z24.string().max(200).optional() });
13704
13720
  var slotBase = mapSlotSchema.omit({ action: true });
13705
- var mapSlotAddVariant = slotBase.extend({ action: z23.literal("slot.add"), slotId: z23.string().max(200), ingredientEntryId: z23.string().max(200) });
13706
- var mapSlotRemoveVariant = slotBase.extend({ action: z23.literal("slot.remove"), slotId: z23.string().max(200), ingredientEntryId: z23.string().max(200) });
13707
- var mapSlotReplaceVariant = slotBase.extend({ action: z23.literal("slot.replace"), slotId: z23.string().max(200), ingredientEntryId: z23.string().max(200), newIngredientEntryId: z23.string().max(200) });
13708
- var mapSlotListVariant = slotBase.extend({ action: z23.literal("slot.list") });
13721
+ var mapSlotAddVariant = slotBase.extend({ action: z24.literal("slot.add"), slotId: z24.string().max(200), ingredientEntryId: z24.string().max(200) });
13722
+ var mapSlotRemoveVariant = slotBase.extend({ action: z24.literal("slot.remove"), slotId: z24.string().max(200), ingredientEntryId: z24.string().max(200) });
13723
+ var mapSlotReplaceVariant = slotBase.extend({ action: z24.literal("slot.replace"), slotId: z24.string().max(200), ingredientEntryId: z24.string().max(200), newIngredientEntryId: z24.string().max(200) });
13724
+ var mapSlotListVariant = slotBase.extend({ action: z24.literal("slot.list") });
13709
13725
  var versionBase2 = mapVersionSchema.omit({ action: true });
13710
- var mapVersionCommitVariant = versionBase2.extend({ action: z23.literal("version.commit") });
13711
- var mapVersionListVariant = versionBase2.extend({ action: z23.literal("version.list") });
13712
- var mapVersionHistoryVariant = versionBase2.extend({ action: z23.literal("version.history") });
13713
- var mapSuggestVariant = mapSuggestSchema.extend({ action: z23.literal("suggest") });
13714
- var mapCreateAudienceSetVariant = createAudienceMapSetSchema.extend({ action: z23.literal("create-audience-set") });
13715
- var mapActionUnion = z23.discriminatedUnion("action", [
13726
+ var mapVersionCommitVariant = versionBase2.extend({ action: z24.literal("version.commit") });
13727
+ var mapVersionListVariant = versionBase2.extend({ action: z24.literal("version.list") });
13728
+ var mapVersionHistoryVariant = versionBase2.extend({ action: z24.literal("version.history") });
13729
+ var mapSuggestVariant = mapSuggestSchema.extend({ action: z24.literal("suggest") });
13730
+ var mapCreateAudienceSetVariant = createAudienceMapSetSchema.extend({ action: z24.literal("create-audience-set") });
13731
+ var mapActionUnion = z24.discriminatedUnion("action", [
13716
13732
  mapCreateVariant,
13717
13733
  mapGetVariant,
13718
13734
  mapListVariant,
@@ -13776,10 +13792,10 @@ function registerMapTools(server) {
13776
13792
  }
13777
13793
 
13778
13794
  // src/tools/workspace.ts
13779
- import { z as z26 } from "zod/v3";
13795
+ import { z as z27 } from "zod/v3";
13780
13796
 
13781
13797
  // src/tools/health.ts
13782
- import { z as z24 } from "zod/v3";
13798
+ import { z as z25 } from "zod/v3";
13783
13799
  var CALL_CATEGORIES = {
13784
13800
  "chain.getEntry": "read",
13785
13801
  "chain.batchGetEntries": "read",
@@ -14124,65 +14140,65 @@ ${logLines.join("\n")}` }],
14124
14140
  };
14125
14141
  }
14126
14142
  var HEALTH_ACTIONS = ["check", "whoami", "status", "audit", "self-test"];
14127
- var healthSchema = z24.object({
14128
- action: z24.enum(HEALTH_ACTIONS).describe(
14143
+ var healthSchema = z25.object({
14144
+ action: z25.enum(HEALTH_ACTIONS).describe(
14129
14145
  "'check': connectivity and workspace stats. 'whoami': session identity. 'status': workspace readiness. 'audit': session audit log. 'self-test': validate all tool schemas."
14130
14146
  ),
14131
- limit: z24.number().min(1).max(50).default(20).optional().describe("For audit: how many recent calls to show (max 50)")
14147
+ limit: z25.number().min(1).max(50).default(20).optional().describe("For audit: how many recent calls to show (max 50)")
14132
14148
  });
14133
- var healthCheckOutputSchema = z24.object({
14134
- healthy: z24.boolean(),
14135
- collections: z24.number(),
14136
- entries: z24.number(),
14137
- latencyMs: z24.number(),
14138
- workspace: z24.string()
14149
+ var healthCheckOutputSchema = z25.object({
14150
+ healthy: z25.boolean(),
14151
+ collections: z25.number(),
14152
+ entries: z25.number(),
14153
+ latencyMs: z25.number(),
14154
+ workspace: z25.string()
14139
14155
  });
14140
- var organisationHealthSchema = z24.object({
14141
- reviewed: z24.number(),
14142
- agreements: z24.number(),
14143
- disagreements: z24.number(),
14144
- abstentions: z24.number(),
14145
- agreementRate: z24.number(),
14146
- flags: z24.array(z24.object({
14147
- collection: z24.string(),
14148
- count: z24.number(),
14149
- suggestedCollection: z24.string()
14156
+ var organisationHealthSchema = z25.object({
14157
+ reviewed: z25.number(),
14158
+ agreements: z25.number(),
14159
+ disagreements: z25.number(),
14160
+ abstentions: z25.number(),
14161
+ agreementRate: z25.number(),
14162
+ flags: z25.array(z25.object({
14163
+ collection: z25.string(),
14164
+ count: z25.number(),
14165
+ suggestedCollection: z25.string()
14150
14166
  }))
14151
14167
  });
14152
- var healthStatusOutputSchema = z24.object({
14153
- stage: z24.enum(["blank", "seeded", "grounded", "connected"]).optional().default("seeded"),
14154
- scoringVersion: z24.enum(["v1", "v2"]).optional().default("v1"),
14155
- readinessScore: z24.number(),
14156
- activeEntries: z24.number(),
14157
- totalRelations: z24.number(),
14158
- orphanedEntries: z24.number(),
14159
- gaps: z24.array(z24.object({ id: z24.string(), label: z24.string(), guidance: z24.string() })),
14168
+ var healthStatusOutputSchema = z25.object({
14169
+ stage: z25.enum(["blank", "seeded", "grounded", "connected"]).optional().default("seeded"),
14170
+ scoringVersion: z25.enum(["v1", "v2"]).optional().default("v1"),
14171
+ readinessScore: z25.number(),
14172
+ activeEntries: z25.number(),
14173
+ totalRelations: z25.number(),
14174
+ orphanedEntries: z25.number(),
14175
+ gaps: z25.array(z25.object({ id: z25.string(), label: z25.string(), guidance: z25.string() })),
14160
14176
  organisationHealth: organisationHealthSchema.optional()
14161
14177
  });
14162
- var healthAuditOutputSchema = z24.object({
14163
- totalCalls: z24.number(),
14164
- calls: z24.array(z24.object({
14165
- tool: z24.string(),
14166
- action: z24.string().optional(),
14167
- timestamp: z24.string(),
14168
- durationMs: z24.number().optional()
14178
+ var healthAuditOutputSchema = z25.object({
14179
+ totalCalls: z25.number(),
14180
+ calls: z25.array(z25.object({
14181
+ tool: z25.string(),
14182
+ action: z25.string().optional(),
14183
+ timestamp: z25.string(),
14184
+ durationMs: z25.number().optional()
14169
14185
  }))
14170
14186
  });
14171
- var healthWhoamiOutputSchema = z24.object({
14172
- workspaceId: z24.string(),
14173
- workspaceName: z24.string(),
14174
- scope: z24.string(),
14175
- sessionId: z24.union([z24.string(), z24.null()]),
14176
- oriented: z24.boolean()
14187
+ var healthWhoamiOutputSchema = z25.object({
14188
+ workspaceId: z25.string(),
14189
+ workspaceName: z25.string(),
14190
+ scope: z25.string(),
14191
+ sessionId: z25.union([z25.string(), z25.null()]),
14192
+ oriented: z25.boolean()
14177
14193
  });
14178
- var selfTestOutputSchema = z24.object({
14179
- passed: z24.number(),
14180
- failed: z24.number(),
14181
- total: z24.number(),
14182
- results: z24.array(z24.object({
14183
- tool: z24.string(),
14184
- valid: z24.boolean(),
14185
- error: z24.string().optional()
14194
+ var selfTestOutputSchema = z25.object({
14195
+ passed: z25.number(),
14196
+ failed: z25.number(),
14197
+ total: z25.number(),
14198
+ results: z25.array(z25.object({
14199
+ tool: z25.string(),
14200
+ valid: z25.boolean(),
14201
+ error: z25.string().optional()
14186
14202
  }))
14187
14203
  });
14188
14204
  function handleSelfTest(server) {
@@ -14233,9 +14249,9 @@ function handleSelfTest(server) {
14233
14249
  }
14234
14250
 
14235
14251
  // src/tools/usage.ts
14236
- import { z as z25 } from "zod/v3";
14237
- var usageSummarySchema = z25.object({
14238
- periodDays: z25.number().min(1).max(90).optional().describe("Number of days to look back (default 30, max 90)")
14252
+ import { z as z26 } from "zod/v3";
14253
+ var usageSummarySchema = z26.object({
14254
+ periodDays: z26.number().min(1).max(90).optional().describe("Number of days to look back (default 30, max 90)")
14239
14255
  });
14240
14256
  async function handleUsageSummary(periodDays) {
14241
14257
  const ws = await getWorkspaceContext();
@@ -14407,35 +14423,35 @@ var WORKSPACE_ACTIONS = [
14407
14423
  "proposals-respond",
14408
14424
  "proposals-count"
14409
14425
  ];
14410
- var workspaceSchema = z26.object({
14411
- action: z26.enum(WORKSPACE_ACTIONS).describe(
14426
+ var workspaceSchema = z27.object({
14427
+ action: z27.enum(WORKSPACE_ACTIONS).describe(
14412
14428
  "'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)."
14413
14429
  ),
14414
- limit: z26.number().min(1).max(50).optional().describe("For 'audit': how many recent calls to show (max 50, default 20)."),
14415
- periodDays: z26.number().min(1).max(90).optional().describe("For 'usage': number of days to look back (default 30, max 90)."),
14416
- status: z26.enum(["open", "approved", "objected", "expired"]).optional().describe("For 'proposals-list': filter by status (default: open)."),
14417
- proposalId: z26.string().max(200).optional().describe("For 'proposals-respond': proposal ID."),
14418
- verdict: z26.enum(["approve", "reject"]).optional().describe("For 'proposals-respond': approve or reject."),
14419
- reason: z26.string().max(2e3).optional().describe("For 'proposals-respond': reason for the verdict (required when rejecting).")
14430
+ limit: z27.number().min(1).max(50).optional().describe("For 'audit': how many recent calls to show (max 50, default 20)."),
14431
+ periodDays: z27.number().min(1).max(90).optional().describe("For 'usage': number of days to look back (default 30, max 90)."),
14432
+ status: z27.enum(["open", "approved", "objected", "expired"]).optional().describe("For 'proposals-list': filter by status (default: open)."),
14433
+ proposalId: z27.string().max(200).optional().describe("For 'proposals-respond': proposal ID."),
14434
+ verdict: z27.enum(["approve", "reject"]).optional().describe("For 'proposals-respond': approve or reject."),
14435
+ reason: z27.string().max(2e3).optional().describe("For 'proposals-respond': reason for the verdict (required when rejecting).")
14420
14436
  });
14421
- var workspaceCheckVariant = z26.object({ action: z26.literal("check") });
14422
- var workspaceWhoamiVariant = z26.object({ action: z26.literal("whoami") });
14423
- var workspaceStatusVariant = z26.object({ action: z26.literal("status") });
14424
- var workspaceAuditVariant = z26.object({ action: z26.literal("audit"), limit: z26.number().min(1).max(50).optional().default(20) });
14425
- var workspaceSelfTestVariant = z26.object({ action: z26.literal("self-test") });
14426
- var workspaceUsageVariant = z26.object({ action: z26.literal("usage"), periodDays: z26.number().min(1).max(90).optional() });
14427
- var workspaceProposalsListVariant = z26.object({
14428
- action: z26.literal("proposals-list"),
14429
- status: z26.enum(["open", "approved", "objected", "expired"]).optional()
14437
+ var workspaceCheckVariant = z27.object({ action: z27.literal("check") });
14438
+ var workspaceWhoamiVariant = z27.object({ action: z27.literal("whoami") });
14439
+ var workspaceStatusVariant = z27.object({ action: z27.literal("status") });
14440
+ var workspaceAuditVariant = z27.object({ action: z27.literal("audit"), limit: z27.number().min(1).max(50).optional().default(20) });
14441
+ var workspaceSelfTestVariant = z27.object({ action: z27.literal("self-test") });
14442
+ var workspaceUsageVariant = z27.object({ action: z27.literal("usage"), periodDays: z27.number().min(1).max(90).optional() });
14443
+ var workspaceProposalsListVariant = z27.object({
14444
+ action: z27.literal("proposals-list"),
14445
+ status: z27.enum(["open", "approved", "objected", "expired"]).optional()
14430
14446
  });
14431
- var workspaceProposalsRespondVariant = z26.object({
14432
- action: z26.literal("proposals-respond"),
14433
- proposalId: z26.string().max(200),
14434
- verdict: z26.enum(["approve", "reject"]),
14435
- reason: z26.string().max(2e3).optional()
14447
+ var workspaceProposalsRespondVariant = z27.object({
14448
+ action: z27.literal("proposals-respond"),
14449
+ proposalId: z27.string().max(200),
14450
+ verdict: z27.enum(["approve", "reject"]),
14451
+ reason: z27.string().max(2e3).optional()
14436
14452
  });
14437
- var workspaceProposalsCountVariant = z26.object({ action: z26.literal("proposals-count") });
14438
- var workspaceActionUnion = z26.discriminatedUnion("action", [
14453
+ var workspaceProposalsCountVariant = z27.object({ action: z27.literal("proposals-count") });
14454
+ var workspaceActionUnion = z27.discriminatedUnion("action", [
14439
14455
  workspaceCheckVariant,
14440
14456
  workspaceWhoamiVariant,
14441
14457
  workspaceStatusVariant,
@@ -14491,7 +14507,7 @@ function registerWorkspaceTools(server) {
14491
14507
  }
14492
14508
 
14493
14509
  // src/tools/feedback.ts
14494
- import { z as z27 } from "zod/v3";
14510
+ import { z as z28 } from "zod/v3";
14495
14511
 
14496
14512
  // src/lib/productFeedbackConstants.ts
14497
14513
  var PRODUCT_FEEDBACK_CATEGORIES = ["bug", "friction", "idea", "praise", "other"];
@@ -14502,9 +14518,9 @@ var VENDOR_SETTABLE_STATUSES = PRODUCT_FEEDBACK_STATUSES.filter(
14502
14518
 
14503
14519
  // src/tools/feedback.ts
14504
14520
  var actions = ["submit", "list", "queue", "note", "group", "status"];
14505
- var category = z27.enum(PRODUCT_FEEDBACK_CATEGORIES);
14506
- var status = z27.enum(PRODUCT_FEEDBACK_STATUSES);
14507
- var vendorStatus = z27.enum(VENDOR_SETTABLE_STATUSES);
14521
+ var category = z28.enum(PRODUCT_FEEDBACK_CATEGORIES);
14522
+ var status = z28.enum(PRODUCT_FEEDBACK_STATUSES);
14523
+ var vendorStatus = z28.enum(VENDOR_SETTABLE_STATUSES);
14508
14524
  var GATEWAY_MAX_STRING_BYTES = 10240;
14509
14525
  var utf8Bytes = (value) => new TextEncoder().encode(value).length;
14510
14526
  var fitsGatewayBytes = (value) => utf8Bytes(value) <= GATEWAY_MAX_STRING_BYTES;
@@ -14513,32 +14529,32 @@ var byteLimitMessage = (field) => ({
14513
14529
  });
14514
14530
  var MESSAGE_DISPLAY_LIMIT = 1e3;
14515
14531
  var FULL_MESSAGE_MAX_LIMIT = 5;
14516
- var feedbackSchema = z27.object({
14517
- action: z27.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."),
14518
- message: z27.string().max(1e4).optional().describe("Required for submit: the product feedback text (max 10,000 chars and 10,240 UTF-8 bytes)."),
14532
+ var feedbackSchema = z28.object({
14533
+ action: z28.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."),
14534
+ message: z28.string().max(1e4).optional().describe("Required for submit: the product feedback text (max 10,000 chars and 10,240 UTF-8 bytes)."),
14519
14535
  category: category.optional().describe("Submit/queue category; submit defaults to other."),
14520
- command: z27.string().max(1e3).optional().describe("Optional submit command context; argument values are scrubbed server-side."),
14521
- route: z27.string().max(500).optional().describe("Optional submit route context."),
14522
- client: z27.string().max(100).optional().describe("Optional submit client label."),
14523
- feedbackId: z27.string().max(200).optional().describe("Required for note/status: target feedback ID."),
14524
- feedbackIds: z27.array(z27.string().max(200)).max(100).optional().describe("Required for group: 1\u2013100 target feedback IDs."),
14525
- note: z27.string().max(4e3).optional().describe("Required for note: replacement triage note (max 10,240 UTF-8 bytes)."),
14536
+ command: z28.string().max(1e3).optional().describe("Optional submit command context; argument values are scrubbed server-side."),
14537
+ route: z28.string().max(500).optional().describe("Optional submit route context."),
14538
+ client: z28.string().max(100).optional().describe("Optional submit client label."),
14539
+ feedbackId: z28.string().max(200).optional().describe("Required for note/status: target feedback ID."),
14540
+ feedbackIds: z28.array(z28.string().max(200)).max(100).optional().describe("Required for group: 1\u2013100 target feedback IDs."),
14541
+ note: z28.string().max(4e3).optional().describe("Required for note: replacement triage note (max 10,240 UTF-8 bytes)."),
14526
14542
  status: status.optional().describe("list/queue filter (any status, including 'screening'); the status action's required target value excludes 'screening' (system-only)."),
14527
- groupId: z27.string().min(1).max(200).nullable().optional().describe("Group filter, or required group destination; null explicitly clears grouping."),
14528
- workspaceId: z27.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."),
14529
- since: z27.number().optional().describe("Queue-only lower createdAt window bound (inclusive) in epoch milliseconds."),
14530
- before: z27.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."),
14531
- limit: z27.number().int().min(1).max(100).optional().describe("list/queue row limit, default 50, maximum 100."),
14532
- cursor: z27.string().max(2e3).optional().describe("Opaque pagination cursor from a previous list/queue response (continueCursor); omit for the first page."),
14533
- full: z27.boolean().optional().describe(`list/queue only: return untruncated messages; allowed only when limit <= ${FULL_MESSAGE_MAX_LIMIT}.`)
14543
+ groupId: z28.string().min(1).max(200).nullable().optional().describe("Group filter, or required group destination; null explicitly clears grouping."),
14544
+ workspaceId: z28.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."),
14545
+ since: z28.number().optional().describe("Queue-only lower createdAt window bound (inclusive) in epoch milliseconds."),
14546
+ before: z28.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."),
14547
+ limit: z28.number().int().min(1).max(100).optional().describe("list/queue row limit, default 50, maximum 100."),
14548
+ cursor: z28.string().max(2e3).optional().describe("Opaque pagination cursor from a previous list/queue response (continueCursor); omit for the first page."),
14549
+ full: z28.boolean().optional().describe(`list/queue only: return untruncated messages; allowed only when limit <= ${FULL_MESSAGE_MAX_LIMIT}.`)
14534
14550
  });
14535
- var union = z27.discriminatedUnion("action", [
14536
- z27.object({ action: z27.literal("submit"), message: z27.string().min(1).max(1e4).refine(fitsGatewayBytes, byteLimitMessage("message")), category: category.optional(), command: z27.string().max(1e3).optional(), route: z27.string().max(500).optional(), client: z27.string().max(100).optional() }),
14537
- z27.object({ action: z27.literal("list"), status: status.optional(), limit: z27.number().int().min(1).max(100).optional(), cursor: z27.string().max(2e3).optional(), full: z27.boolean().optional() }),
14538
- z27.object({ action: z27.literal("queue"), status: status.optional(), category: category.optional(), groupId: z27.string().min(1).max(200).optional(), workspaceId: z27.string().max(200).optional(), since: z27.number().optional(), before: z27.number().optional(), limit: z27.number().int().min(1).max(100).optional(), cursor: z27.string().max(2e3).optional(), full: z27.boolean().optional() }),
14539
- z27.object({ action: z27.literal("note"), feedbackId: z27.string().min(1).max(200), note: z27.string().max(4e3).refine(fitsGatewayBytes, byteLimitMessage("note")) }),
14540
- z27.object({ action: z27.literal("group"), feedbackIds: z27.array(z27.string().min(1).max(200)).min(1).max(100), groupId: z27.string().min(1).max(200).nullable() }),
14541
- z27.object({ action: z27.literal("status"), feedbackId: z27.string().min(1).max(200), status: vendorStatus })
14551
+ var union = z28.discriminatedUnion("action", [
14552
+ z28.object({ action: z28.literal("submit"), message: z28.string().min(1).max(1e4).refine(fitsGatewayBytes, byteLimitMessage("message")), category: category.optional(), command: z28.string().max(1e3).optional(), route: z28.string().max(500).optional(), client: z28.string().max(100).optional() }),
14553
+ z28.object({ action: z28.literal("list"), status: status.optional(), limit: z28.number().int().min(1).max(100).optional(), cursor: z28.string().max(2e3).optional(), full: z28.boolean().optional() }),
14554
+ z28.object({ action: z28.literal("queue"), status: status.optional(), category: category.optional(), groupId: z28.string().min(1).max(200).optional(), workspaceId: z28.string().max(200).optional(), since: z28.number().optional(), before: z28.number().optional(), limit: z28.number().int().min(1).max(100).optional(), cursor: z28.string().max(2e3).optional(), full: z28.boolean().optional() }),
14555
+ z28.object({ action: z28.literal("note"), feedbackId: z28.string().min(1).max(200), note: z28.string().max(4e3).refine(fitsGatewayBytes, byteLimitMessage("note")) }),
14556
+ z28.object({ action: z28.literal("group"), feedbackIds: z28.array(z28.string().min(1).max(200)).min(1).max(100), groupId: z28.string().min(1).max(200).nullable() }),
14557
+ z28.object({ action: z28.literal("status"), feedbackId: z28.string().min(1).max(200), status: vendorStatus })
14542
14558
  ]);
14543
14559
  var specs = {
14544
14560
  submit: { params: ["message", "category", "command", "route", "client"], description: "message is required; category defaults to other." },
@@ -15184,12 +15200,12 @@ ${entry.labels.map((l) => `- ${l.name ?? l.slug}`).join("\n")}`);
15184
15200
  }
15185
15201
 
15186
15202
  // src/prompts/index.ts
15187
- import { z as z28 } from "zod/v3";
15203
+ import { z as z29 } from "zod/v3";
15188
15204
  function registerPrompts(server) {
15189
15205
  server.prompt(
15190
15206
  "review-against-rules",
15191
15207
  "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.",
15192
- { domain: z28.string().describe("Business rule domain (e.g. 'Identity & Access', 'Governance & Decision-Making')") },
15208
+ { domain: z29.string().describe("Business rule domain (e.g. 'Identity & Access', 'Governance & Decision-Making')") },
15193
15209
  async ({ domain }) => {
15194
15210
  const entries = await kernelQuery("chain.listEntries", { collectionSlug: "business-rules" });
15195
15211
  const rules = entries.filter((e) => e.data?.domain === domain);
@@ -15242,7 +15258,7 @@ Provide a structured review with a compliance status for each rule (COMPLIANT /
15242
15258
  server.prompt(
15243
15259
  "name-check",
15244
15260
  "Check variable names, field names, or API names against the glossary for terminology alignment. Flags drift from canonical terms.",
15245
- { names: z28.string().describe("Comma-separated list of names to check (e.g. 'vendor_id, compliance_level, formulator_type')") },
15261
+ { names: z29.string().describe("Comma-separated list of names to check (e.g. 'vendor_id, compliance_level, formulator_type')") },
15246
15262
  async ({ names }) => {
15247
15263
  const terms = await kernelQuery("chain.listEntries", { collectionSlug: "glossary" });
15248
15264
  const glossaryContext = terms.map(
@@ -15278,7 +15294,7 @@ Format as a table: Name | Status | Canonical Form | Action Needed`
15278
15294
  server.prompt(
15279
15295
  "draft-decision-record",
15280
15296
  "Draft a structured decision record from a description of what was decided. Includes context from recent decisions and relevant rules.",
15281
- { context: z28.string().describe("Description of the decision (e.g. 'We decided to use MRSL v3.1 as the conformance baseline because...')") },
15297
+ { context: z29.string().describe("Description of the decision (e.g. 'We decided to use MRSL v3.1 as the conformance baseline because...')") },
15282
15298
  async ({ context }) => {
15283
15299
  const recentDecisions = await kernelQuery("chain.listEntries", { collectionSlug: "decisions" });
15284
15300
  const sorted = [...recentDecisions].sort((a, b) => (b.data?.date ?? "") > (a.data?.date ?? "") ? 1 : -1).slice(0, 5);
@@ -15316,8 +15332,8 @@ After drafting, I can log it using the capture tool with collection "decisions".
15316
15332
  "draft-rule-from-context",
15317
15333
  "Draft a new business rule from an observation or discovery made while coding. Fetches existing rules for the domain to ensure consistency.",
15318
15334
  {
15319
- observation: z28.string().describe("What you observed or discovered (e.g. 'Suppliers can have multiple org types in Gateway')"),
15320
- domain: z28.string().describe("Which domain this rule belongs to (e.g. 'Governance & Decision-Making')")
15335
+ observation: z29.string().describe("What you observed or discovered (e.g. 'Suppliers can have multiple org types in Gateway')"),
15336
+ domain: z29.string().describe("Which domain this rule belongs to (e.g. 'Governance & Decision-Making')")
15321
15337
  },
15322
15338
  async ({ observation, domain }) => {
15323
15339
  const allRules = await kernelQuery("chain.listEntries", { collectionSlug: "business-rules" });
@@ -15592,4 +15608,4 @@ export {
15592
15608
  createProductBrainServer,
15593
15609
  initFeatureFlags
15594
15610
  };
15595
- //# sourceMappingURL=chunk-VVC5Z5E5.js.map
15611
+ //# sourceMappingURL=chunk-O4XY2W5W.js.map