@productbrain/mcp 0.0.1-beta.12225 → 0.0.1-beta.12232
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.
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
|
|
45
45
|
// src/server.ts
|
|
46
46
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
47
|
-
import { z as
|
|
47
|
+
import { z as z36 } from "zod/v3";
|
|
48
48
|
|
|
49
49
|
// src/lib/mcpGatewayClientMessages.ts
|
|
50
50
|
function agentSessionNotActiveMessage(status2) {
|
|
@@ -341,7 +341,7 @@ async function listEntriesWithCut(args, next = LIST_COUNTS_OF_ROWS_READ) {
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
// src/tools/entries.ts
|
|
344
|
-
import { z as
|
|
344
|
+
import { z as z13 } from "zod/v3";
|
|
345
345
|
|
|
346
346
|
// src/tools/knowledge-helpers.ts
|
|
347
347
|
import { z as z2 } from "zod/v3";
|
|
@@ -2410,15 +2410,37 @@ async function handleStillTrueEntry({ entryId }) {
|
|
|
2410
2410
|
return successResult(message, message, result2);
|
|
2411
2411
|
}
|
|
2412
2412
|
|
|
2413
|
-
// src/tools/
|
|
2413
|
+
// src/tools/replace.ts
|
|
2414
2414
|
import { z as z10 } from "zod/v3";
|
|
2415
|
-
var
|
|
2416
|
-
entryId: z10.string().describe("
|
|
2417
|
-
|
|
2415
|
+
var replaceEntrySchema = z10.object({
|
|
2416
|
+
entryId: z10.string().max(200).describe("Human entry ID of the entry being replaced (e.g. '<PREFIX>-<n>')."),
|
|
2417
|
+
newEntryId: z10.string().max(200).describe("Human entry ID of the accepted entry of the same kind that replaces it."),
|
|
2418
|
+
reason: z10.string().max(2e3).optional().describe("Why it is replaced, one line (required; the kernel refuses without one).")
|
|
2419
|
+
});
|
|
2420
|
+
async function handleReplaceEntry({ entryId, newEntryId, reason }) {
|
|
2421
|
+
requireWriteAccess();
|
|
2422
|
+
const agentSessionId = getAgentSessionId();
|
|
2423
|
+
const result2 = await kernelMutation(
|
|
2424
|
+
"chain.replaceEntry",
|
|
2425
|
+
{ oldEntryId: entryId, newEntryId, ...reason !== void 0 ? { reason } : {}, ...agentSessionId ? { sessionId: agentSessionId } : {} }
|
|
2426
|
+
);
|
|
2427
|
+
const message = [
|
|
2428
|
+
`${sanitizeSingleLineField(result2.name)} (${sanitizeSingleLineField(result2.entryId)})`,
|
|
2429
|
+
sanitizeSingleLineField(result2.line),
|
|
2430
|
+
...result2.movedLine ? [sanitizeSingleLineField(result2.movedLine)] : []
|
|
2431
|
+
].join("\n");
|
|
2432
|
+
return successResult(message, message, result2);
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
// src/tools/entry-move.ts
|
|
2436
|
+
import { z as z11 } from "zod/v3";
|
|
2437
|
+
var moveEntrySchema = z11.object({
|
|
2438
|
+
entryId: z11.string().describe("Entry ID to move, e.g. '<PREFIX>-<n>'"),
|
|
2439
|
+
toCollection: z11.string().describe("Target collection slug, e.g. 'decisions', 'architecture'"),
|
|
2418
2440
|
// WP-707 S2 (TASK-146): optional atomic move+RETYPE — validates and persists the entry's NEW
|
|
2419
2441
|
// canonicalKey and its destination collection in the SAME write (convex/agentKnowledge/
|
|
2420
2442
|
// moveToCollectionOperation.ts round 3, DEC-1622). Omit for a plain same-kind relocation.
|
|
2421
|
-
canonicalKey:
|
|
2443
|
+
canonicalKey: z11.string().optional().describe(
|
|
2422
2444
|
"Optional: also reclassify the entry to this canonical key atomically with the move (e.g. 'decision', 'objective'). Omit for a plain relocation."
|
|
2423
2445
|
)
|
|
2424
2446
|
});
|
|
@@ -2512,100 +2534,106 @@ function platformSearchLines(platform) {
|
|
|
2512
2534
|
}
|
|
2513
2535
|
|
|
2514
2536
|
// src/tools/entriesContract.ts
|
|
2515
|
-
import { z as
|
|
2537
|
+
import { z as z12 } from "zod/v3";
|
|
2516
2538
|
var ENTRIES_ACTIONS = [
|
|
2517
2539
|
"update",
|
|
2518
2540
|
"accept",
|
|
2519
2541
|
"move",
|
|
2520
2542
|
"verify",
|
|
2521
|
-
"still-true"
|
|
2543
|
+
"still-true",
|
|
2544
|
+
"replace"
|
|
2522
2545
|
];
|
|
2523
|
-
var coherencyAcknowledgementFlatSchema =
|
|
2524
|
-
response:
|
|
2525
|
-
entryId:
|
|
2526
|
-
reason:
|
|
2546
|
+
var coherencyAcknowledgementFlatSchema = z12.object({
|
|
2547
|
+
response: z12.enum(["linked", "accepted-fix", "diverged"]).describe("Explicit response to an acknowledge-required coherency challenge."),
|
|
2548
|
+
entryId: z12.string().max(200).optional().describe("Authorizing entry being linked/accepted (required for 'linked' and 'accepted-fix')."),
|
|
2549
|
+
reason: z12.string().max(2e3).optional().describe("Divergence rationale (required for 'diverged', \u226512 chars).")
|
|
2527
2550
|
});
|
|
2528
2551
|
var ENTRIES_MOVED = {
|
|
2529
2552
|
preflight: "entries only writes. Check a collection's requirements with the read-only context tool: context action=preflight collection=...",
|
|
2530
2553
|
commit: "commit was renamed accept. Next: entries action=accept entryId=..."
|
|
2531
2554
|
};
|
|
2532
|
-
var entriesSchema =
|
|
2555
|
+
var entriesSchema = z12.object({
|
|
2533
2556
|
action: actionEnum(ENTRIES_ACTIONS, ENTRIES_MOVED).describe(
|
|
2534
|
-
"'update': change fields on an existing entry (draft by default). 'accept': accept a draft entry onto the Chain. 'move': relocate an entry to a different collection (pass `canonicalKey` too for an atomic move+retype). 'verify': mark an entry as verified (lightweight \u2014 no codebase scan; see `quality action=verify-chain` for that). 'still-true': confirm accuracy (the holder of the owning role, else the nearest seated Team Lead) \u2014 distinct from 'verify'; no content, version, or updatedAt change."
|
|
2557
|
+
"'update': change fields on an existing entry (draft by default). 'accept': accept a draft entry onto the Chain. 'move': relocate an entry to a different collection (pass `canonicalKey` too for an atomic move+retype). 'verify': mark an entry as verified (lightweight \u2014 no codebase scan; see `quality action=verify-chain` for that). 'still-true': confirm accuracy (the holder of the owning role, else the nearest seated Team Lead) \u2014 distinct from 'verify'; no content, version, or updatedAt change. 'replace': replace accepted entryId with accepted newEntryId of its kind, with a one-line reason; the old entry reads Replaced by the new one (judged by your acting role)."
|
|
2535
2558
|
),
|
|
2536
|
-
entryId:
|
|
2537
|
-
"Entry ID, e.g. '<PREFIX>-<n>'. Required for: update, accept, move, verify, still-true."
|
|
2559
|
+
entryId: z12.string().max(200).optional().describe(
|
|
2560
|
+
"Entry ID, e.g. '<PREFIX>-<n>'. Required for: update, accept, move, verify, still-true, replace (the entry being replaced)."
|
|
2538
2561
|
),
|
|
2539
|
-
|
|
2562
|
+
newEntryId: z12.string().max(200).optional().describe("For 'replace': the accepted entry that replaces entryId (required)."),
|
|
2563
|
+
// TASK-885
|
|
2564
|
+
status: z12.string().max(200).optional().describe(
|
|
2540
2565
|
"For 'update': draft|archived ONLY \u2014 'accepted' is set via 'accept', never 'update'; 'active'/'deprecated' are legacy read-only words, refused on write. Workflow values use `workflowStatus` instead."
|
|
2541
2566
|
),
|
|
2542
|
-
name:
|
|
2543
|
-
workflowStatus:
|
|
2567
|
+
name: z12.string().max(ENTRY_NAME_MAX_CHARS).optional().describe("For 'update': new display name."),
|
|
2568
|
+
workflowStatus: z12.string().max(200).optional().describe(
|
|
2544
2569
|
"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."
|
|
2545
2570
|
),
|
|
2546
|
-
data:
|
|
2547
|
-
order:
|
|
2548
|
-
canonicalKey:
|
|
2571
|
+
data: z12.record(z12.unknown()).optional().describe("For 'update': fields to update (merged with existing data)."),
|
|
2572
|
+
order: z12.number().optional().describe("For 'update': new sort order."),
|
|
2573
|
+
canonicalKey: z12.string().max(200).optional().describe(
|
|
2549
2574
|
"For 'update': semantic type (e.g. 'decision', 'tension'); only changeable on draft entries. For 'move': optional atomic move+retype target."
|
|
2550
2575
|
),
|
|
2551
2576
|
// DEC-1716: draft vs. published is decided by the entry's own accepted/active status, never this flag.
|
|
2552
|
-
autoPublish:
|
|
2577
|
+
autoPublish: z12.boolean().optional().default(false).describe(
|
|
2553
2578
|
"For 'update': accepted for backward compatibility but IGNORED \u2014 draft vs. published is decided by the entry's own accepted/active status, never by this flag."
|
|
2554
2579
|
),
|
|
2555
|
-
changeReason:
|
|
2580
|
+
changeReason: z12.string().max(2e3).optional().describe(
|
|
2556
2581
|
"For 'update': Change reason \u2014 required when the update changes a promise field of an accepted entry. Recorded on the history event and the version."
|
|
2557
2582
|
),
|
|
2558
|
-
changeNote:
|
|
2583
|
+
changeNote: z12.string().max(2e3).optional().describe(
|
|
2559
2584
|
"For 'update': short human-readable rationale for WHY this change was made. Surfaces in activity feed."
|
|
2560
2585
|
),
|
|
2561
|
-
sourceRef:
|
|
2586
|
+
sourceRef: z12.string().max(2e3).optional().describe(
|
|
2562
2587
|
"For 'update': URI or path of the source document backing this entry. Write-once."
|
|
2563
2588
|
),
|
|
2564
|
-
sourceExcerpt:
|
|
2589
|
+
sourceExcerpt: z12.string().max(SOURCE_EXCERPT_MAX_CHARS).optional().describe(
|
|
2565
2590
|
"For 'update': verbatim excerpt from the source backing this entry's claims. Write-once."
|
|
2566
2591
|
),
|
|
2567
|
-
steeringOverrideReason:
|
|
2592
|
+
steeringOverrideReason: z12.string().max(2e3).optional().describe(
|
|
2568
2593
|
"For 'update'/'accept': typed override (\u226512 chars) that clears a steering coherency block."
|
|
2569
2594
|
),
|
|
2570
|
-
qualityOverrideReason:
|
|
2595
|
+
qualityOverrideReason: z12.string().max(2e3).optional().describe(
|
|
2571
2596
|
"For 'update'/'accept': why (\u226512 chars) to keep a spine text its quality checklist failed; recorded as an override with who wrote it."
|
|
2572
2597
|
),
|
|
2573
2598
|
coherencyAcknowledgement: coherencyAcknowledgementFlatSchema.optional().describe(
|
|
2574
2599
|
"For 'update'/'accept': explicit response to a coherency challenge (standard/strict workspace modes)."
|
|
2575
2600
|
),
|
|
2576
|
-
preview:
|
|
2601
|
+
preview: z12.boolean().optional().describe(
|
|
2577
2602
|
"For 'accept': if true, validates the accept without writing \u2014 returns what would happen."
|
|
2578
2603
|
),
|
|
2579
|
-
replaces:
|
|
2604
|
+
replaces: z12.string().max(200).optional().describe("For 'accept': the accepted entry of the same kind this one replaces; it is archived."),
|
|
2580
2605
|
// TASK-1030
|
|
2581
|
-
reason:
|
|
2606
|
+
reason: z12.string().max(2e3).optional().describe("For 'accept' with replaces, and for 'replace': why, one line (required)."),
|
|
2582
2607
|
// DEC-2006
|
|
2583
|
-
toCollection:
|
|
2608
|
+
toCollection: z12.string().max(200).optional().describe("For 'move': target collection slug, e.g. 'decisions', 'architecture'.")
|
|
2584
2609
|
});
|
|
2585
|
-
var entriesUpdateVariant = updateEntrySchema.extend({ action:
|
|
2586
|
-
var entriesAcceptVariant = commitEntrySchema.extend({ action:
|
|
2587
|
-
var entriesMoveVariant =
|
|
2588
|
-
action:
|
|
2589
|
-
entryId:
|
|
2590
|
-
toCollection:
|
|
2591
|
-
canonicalKey:
|
|
2610
|
+
var entriesUpdateVariant = updateEntrySchema.extend({ action: z12.literal("update") });
|
|
2611
|
+
var entriesAcceptVariant = commitEntrySchema.extend({ action: z12.literal("accept") });
|
|
2612
|
+
var entriesMoveVariant = z12.object({
|
|
2613
|
+
action: z12.literal("move"),
|
|
2614
|
+
entryId: z12.string().max(200),
|
|
2615
|
+
toCollection: z12.string().max(200),
|
|
2616
|
+
canonicalKey: z12.string().max(200).optional()
|
|
2592
2617
|
// WP-707 S2: optional atomic move+RETYPE.
|
|
2593
2618
|
});
|
|
2594
|
-
var entriesVerifyVariant = verifyEntrySchema.extend({ action:
|
|
2595
|
-
var entriesStillTrueVariant = stillTrueEntrySchema.extend({ action:
|
|
2596
|
-
var
|
|
2619
|
+
var entriesVerifyVariant = verifyEntrySchema.extend({ action: z12.literal("verify") });
|
|
2620
|
+
var entriesStillTrueVariant = stillTrueEntrySchema.extend({ action: z12.literal("still-true") });
|
|
2621
|
+
var entriesReplaceVariant = replaceEntrySchema.extend({ action: z12.literal("replace") });
|
|
2622
|
+
var entriesActionUnion = z12.discriminatedUnion("action", [
|
|
2597
2623
|
entriesUpdateVariant,
|
|
2598
2624
|
entriesAcceptVariant,
|
|
2599
2625
|
entriesMoveVariant,
|
|
2600
2626
|
entriesVerifyVariant,
|
|
2601
|
-
entriesStillTrueVariant
|
|
2627
|
+
entriesStillTrueVariant,
|
|
2628
|
+
entriesReplaceVariant
|
|
2602
2629
|
]);
|
|
2603
2630
|
var ENTRIES_ACTION_SPECS = {
|
|
2604
2631
|
update: { params: ["entryId", "name", "status", "workflowStatus", "data", "order", "canonicalKey", "autoPublish", "changeNote", "changeReason", "sourceRef", "sourceExcerpt", "steeringOverrideReason", "qualityOverrideReason", "coherencyAcknowledgement"], description: "entryId is required; every other field is optional." },
|
|
2605
2632
|
accept: { params: ["entryId", "preview", "steeringOverrideReason", "qualityOverrideReason", "coherencyAcknowledgement", "replaces", "reason"], description: "entryId is required." },
|
|
2606
2633
|
move: { params: ["entryId", "toCollection", "canonicalKey"], description: "entryId and toCollection are required; canonicalKey is optional (atomic move+retype)." },
|
|
2607
2634
|
verify: { params: ["entryId"], description: "entryId is required." },
|
|
2608
|
-
"still-true": { params: ["entryId"], description: "entryId is required. Allowed for the holder of the owning role; if that role is empty, the nearest seated Team Lead up the team tree." }
|
|
2635
|
+
"still-true": { params: ["entryId"], description: "entryId is required. Allowed for the holder of the owning role; if that role is empty, the nearest seated Team Lead up the team tree." },
|
|
2636
|
+
replace: { params: ["entryId", "newEntryId", "reason"], description: "entryId (the entry being replaced), newEntryId and reason are required. Judged by the role this session acts as." }
|
|
2609
2637
|
};
|
|
2610
2638
|
|
|
2611
2639
|
// src/tools/entries.ts
|
|
@@ -2662,16 +2690,16 @@ function renderVerificationLine(e) {
|
|
|
2662
2690
|
}
|
|
2663
2691
|
return `**Verification:** ${String(e.verificationStatus)}${who}`;
|
|
2664
2692
|
}
|
|
2665
|
-
var wqSchema =
|
|
2666
|
-
var entriesGetOutputSchema =
|
|
2667
|
-
entryId:
|
|
2668
|
-
name:
|
|
2669
|
-
collection:
|
|
2670
|
-
status:
|
|
2671
|
-
capturedAt:
|
|
2672
|
-
origin:
|
|
2673
|
-
originDetail:
|
|
2674
|
-
verificationStatus:
|
|
2693
|
+
var wqSchema = z13.enum(["rationale", "missing", "restated"]);
|
|
2694
|
+
var entriesGetOutputSchema = z13.object({
|
|
2695
|
+
entryId: z13.string(),
|
|
2696
|
+
name: z13.string(),
|
|
2697
|
+
collection: z13.string(),
|
|
2698
|
+
status: z13.string(),
|
|
2699
|
+
capturedAt: z13.number().optional(),
|
|
2700
|
+
origin: z13.string().optional(),
|
|
2701
|
+
originDetail: z13.string().optional(),
|
|
2702
|
+
verificationStatus: z13.string().optional(),
|
|
2675
2703
|
// Attestation-model finding (PR #341 review): the server's honest verifier label and
|
|
2676
2704
|
// derived attestation strength/basis — connectors NEVER re-derive strength (spec §5),
|
|
2677
2705
|
// they only render what chain.getEntry ships. Mirrors packages/cli EntryFromApi.
|
|
@@ -2680,73 +2708,73 @@ var entriesGetOutputSchema = z12.object({
|
|
|
2680
2708
|
// attestation.ts's AttestationStrength SSOT (allowlisted in Check D —
|
|
2681
2709
|
// scripts/check-collection-ssot.mjs's CHECK_D_ALLOWLIST — with the full
|
|
2682
2710
|
// reasoning for why this can't just import that module). Update both together.
|
|
2683
|
-
verifiedBy:
|
|
2684
|
-
attestation:
|
|
2685
|
-
strength:
|
|
2686
|
-
basis:
|
|
2711
|
+
verifiedBy: z13.string().optional(),
|
|
2712
|
+
attestation: z13.object({
|
|
2713
|
+
strength: z13.enum(["human-direct", "delegated", "system", "unattested"]),
|
|
2714
|
+
basis: z13.string().optional()
|
|
2687
2715
|
}).optional(),
|
|
2688
|
-
sourceRef:
|
|
2689
|
-
sourceExcerpt:
|
|
2690
|
-
why:
|
|
2716
|
+
sourceRef: z13.string().optional(),
|
|
2717
|
+
sourceExcerpt: z13.string().optional(),
|
|
2718
|
+
why: z13.string().optional(),
|
|
2691
2719
|
whyQuality: wqSchema.optional(),
|
|
2692
|
-
data:
|
|
2693
|
-
relations:
|
|
2694
|
-
entryId:
|
|
2695
|
-
name:
|
|
2696
|
-
type:
|
|
2697
|
-
direction:
|
|
2698
|
-
status:
|
|
2720
|
+
data: z13.record(z13.unknown()).optional(),
|
|
2721
|
+
relations: z13.array(z13.object({
|
|
2722
|
+
entryId: z13.string().optional(),
|
|
2723
|
+
name: z13.string(),
|
|
2724
|
+
type: z13.string(),
|
|
2725
|
+
direction: z13.string(),
|
|
2726
|
+
status: z13.string().optional()
|
|
2699
2727
|
})).optional(),
|
|
2700
|
-
labels:
|
|
2728
|
+
labels: z13.array(z13.string()).optional(),
|
|
2701
2729
|
owner: ownerOutputShape.optional()
|
|
2702
2730
|
}).passthrough();
|
|
2703
|
-
var entriesListOutputSchema =
|
|
2704
|
-
entries:
|
|
2705
|
-
entryId:
|
|
2706
|
-
name:
|
|
2707
|
-
collection:
|
|
2708
|
-
status:
|
|
2731
|
+
var entriesListOutputSchema = z13.object({
|
|
2732
|
+
entries: z13.array(z13.object({
|
|
2733
|
+
entryId: z13.string(),
|
|
2734
|
+
name: z13.string(),
|
|
2735
|
+
collection: z13.string(),
|
|
2736
|
+
status: z13.string()
|
|
2709
2737
|
})),
|
|
2710
|
-
total:
|
|
2738
|
+
total: z13.number()
|
|
2711
2739
|
});
|
|
2712
|
-
var entriesSearchOutputSchema =
|
|
2713
|
-
results:
|
|
2714
|
-
entryId:
|
|
2715
|
-
name:
|
|
2716
|
-
collection:
|
|
2717
|
-
status:
|
|
2718
|
-
score:
|
|
2740
|
+
var entriesSearchOutputSchema = z13.object({
|
|
2741
|
+
results: z13.array(z13.object({
|
|
2742
|
+
entryId: z13.string(),
|
|
2743
|
+
name: z13.string(),
|
|
2744
|
+
collection: z13.string(),
|
|
2745
|
+
status: z13.string(),
|
|
2746
|
+
score: z13.number().optional()
|
|
2719
2747
|
})),
|
|
2720
|
-
total:
|
|
2721
|
-
query:
|
|
2748
|
+
total: z13.number(),
|
|
2749
|
+
query: z13.string()
|
|
2722
2750
|
});
|
|
2723
|
-
var entriesBatchOutputSchema =
|
|
2724
|
-
entries:
|
|
2725
|
-
entryId:
|
|
2726
|
-
name:
|
|
2727
|
-
collection:
|
|
2728
|
-
status:
|
|
2729
|
-
capturedAt:
|
|
2730
|
-
origin:
|
|
2731
|
-
originDetail:
|
|
2732
|
-
verificationStatus:
|
|
2751
|
+
var entriesBatchOutputSchema = z13.object({
|
|
2752
|
+
entries: z13.array(z13.object({
|
|
2753
|
+
entryId: z13.string(),
|
|
2754
|
+
name: z13.string(),
|
|
2755
|
+
collection: z13.string(),
|
|
2756
|
+
status: z13.string(),
|
|
2757
|
+
capturedAt: z13.number().optional(),
|
|
2758
|
+
origin: z13.string().optional(),
|
|
2759
|
+
originDetail: z13.string().optional(),
|
|
2760
|
+
verificationStatus: z13.string().optional(),
|
|
2733
2761
|
// Attestation-model finding (PR #341 review): mirror entriesGetOutputSchema — batch
|
|
2734
2762
|
// entries now carry the same honest verifiedBy/attestation fields. Literal set is
|
|
2735
2763
|
// the same hand-kept SSOT mirror — see entriesGetOutputSchema's attestation
|
|
2736
2764
|
// comment above for the full Check D / kernel-import reasoning.
|
|
2737
|
-
verifiedBy:
|
|
2738
|
-
attestation:
|
|
2739
|
-
strength:
|
|
2740
|
-
basis:
|
|
2765
|
+
verifiedBy: z13.string().optional(),
|
|
2766
|
+
attestation: z13.object({
|
|
2767
|
+
strength: z13.enum(["human-direct", "delegated", "system", "unattested"]),
|
|
2768
|
+
basis: z13.string().optional()
|
|
2741
2769
|
}).optional(),
|
|
2742
|
-
sourceRef:
|
|
2743
|
-
sourceExcerpt:
|
|
2744
|
-
why:
|
|
2770
|
+
sourceRef: z13.string().optional(),
|
|
2771
|
+
sourceExcerpt: z13.string().optional(),
|
|
2772
|
+
why: z13.string().optional(),
|
|
2745
2773
|
// TEN-2191: mirrors entriesGetOutputSchema
|
|
2746
2774
|
whyQuality: wqSchema.optional(),
|
|
2747
|
-
data:
|
|
2775
|
+
data: z13.record(z13.unknown()).optional()
|
|
2748
2776
|
}).passthrough()),
|
|
2749
|
-
total:
|
|
2777
|
+
total: z13.number()
|
|
2750
2778
|
});
|
|
2751
2779
|
function registerEntriesTools(server) {
|
|
2752
2780
|
const entriesHandlers = {
|
|
@@ -2756,7 +2784,8 @@ function registerEntriesTools(server) {
|
|
|
2756
2784
|
accept: (data) => handleCommitEntry(data, "entries"),
|
|
2757
2785
|
move: (data) => handleMoveEntry(data.entryId, data.toCollection, data.canonicalKey),
|
|
2758
2786
|
verify: (data) => handleVerifyEntry(data),
|
|
2759
|
-
"still-true": (data) => handleStillTrueEntry(data)
|
|
2787
|
+
"still-true": (data) => handleStillTrueEntry(data),
|
|
2788
|
+
replace: (data) => handleReplaceEntry(data)
|
|
2760
2789
|
};
|
|
2761
2790
|
server.registerTool(
|
|
2762
2791
|
"entries",
|
|
@@ -2768,6 +2797,7 @@ function registerEntriesTools(server) {
|
|
|
2768
2797
|
- **accept**: Accept a draft entry onto the Chain. Runs the contradiction preflight first.
|
|
2769
2798
|
- **move**: Relocate an entry to a different collection; pass canonicalKey too for an atomic move+retype.
|
|
2770
2799
|
- **verify**: Mark verified (lightweight, no scan \u2014 see \`quality action=verify-chain\`).
|
|
2800
|
+
- **replace**: one accepted entry replaces another of its kind, with a reason.
|
|
2771
2801
|
- **still-true**: confirm accuracy (the holder of the owning role; if that role is empty, the nearest seated Team Lead up the team tree).
|
|
2772
2802
|
|
|
2773
2803
|
Read entries with the read-only \`context\` tool: \`context action=get entryId="..."\`, \`context action=search query="..."\`, \`context action=preflight\`.`,
|
|
@@ -3121,7 +3151,7 @@ ${footer}` }],
|
|
|
3121
3151
|
}
|
|
3122
3152
|
|
|
3123
3153
|
// src/tools/relations.ts
|
|
3124
|
-
import { z as
|
|
3154
|
+
import { z as z14 } from "zod/v3";
|
|
3125
3155
|
|
|
3126
3156
|
// src/lib/relationTypes.ts
|
|
3127
3157
|
var ALLOWED_RELATION_TYPES_LIST = [
|
|
@@ -3186,45 +3216,45 @@ var WHOLE_READ_RELATION_TYPES = Object.keys(RESTS_ON_DIRECTION);
|
|
|
3186
3216
|
|
|
3187
3217
|
// src/tools/relations.ts
|
|
3188
3218
|
var RELATIONS_ACTIONS = ["create", "batch-create", "delete"];
|
|
3189
|
-
var relationType =
|
|
3190
|
-
var relationItemSchema =
|
|
3191
|
-
from:
|
|
3192
|
-
to:
|
|
3219
|
+
var relationType = z14.enum(ALLOWED_RELATION_TYPES_LIST);
|
|
3220
|
+
var relationItemSchema = z14.object({
|
|
3221
|
+
from: z14.string().max(200),
|
|
3222
|
+
to: z14.string().max(200),
|
|
3193
3223
|
type: relationType
|
|
3194
3224
|
});
|
|
3195
|
-
var relationsSchema =
|
|
3196
|
-
action:
|
|
3225
|
+
var relationsSchema = z14.object({
|
|
3226
|
+
action: z14.enum(RELATIONS_ACTIONS).describe(
|
|
3197
3227
|
"'create': link two entries. 'batch-create': create multiple relations (validates every item before writing any). 'delete': remove a relation."
|
|
3198
3228
|
),
|
|
3199
|
-
from:
|
|
3200
|
-
to:
|
|
3229
|
+
from: z14.string().max(200).optional().describe("For 'create'/'delete': source entry ID."),
|
|
3230
|
+
to: z14.string().max(200).optional().describe("For 'create'/'delete': target entry ID."),
|
|
3201
3231
|
// TASK-1026: the batch item's type is served as a $ref to this one, so the description holds for both; a second enum instance costs 590 bytes of the 64 KB budget (DEC-1981).
|
|
3202
3232
|
type: relationType.optional().describe("Relation type, for create, delete and each batch-create item."),
|
|
3203
|
-
relations:
|
|
3233
|
+
relations: z14.array(relationItemSchema).min(1).max(RELATION_BATCH_MAX).optional().describe("For 'batch-create': array of {from, to, type}."),
|
|
3204
3234
|
// WP-316 S3: Preview gate — dry-run mode for action=create.
|
|
3205
|
-
preview:
|
|
3206
|
-
move:
|
|
3235
|
+
preview: z14.boolean().optional().describe("For 'create': if true, checks the relation and writes nothing."),
|
|
3236
|
+
move: z14.boolean().optional().describe("For 'create' with part_of: move the entry off the parent it already hangs on, in one write.")
|
|
3207
3237
|
});
|
|
3208
|
-
var relationsCreateVariant =
|
|
3209
|
-
action:
|
|
3210
|
-
from:
|
|
3211
|
-
to:
|
|
3238
|
+
var relationsCreateVariant = z14.object({
|
|
3239
|
+
action: z14.literal("create"),
|
|
3240
|
+
from: z14.string().max(200),
|
|
3241
|
+
to: z14.string().max(200),
|
|
3212
3242
|
type: relationType,
|
|
3213
|
-
preview:
|
|
3214
|
-
move:
|
|
3243
|
+
preview: z14.boolean().optional(),
|
|
3244
|
+
move: z14.boolean().optional()
|
|
3215
3245
|
// TASK-1164 (DEC-2295 addendum)
|
|
3216
3246
|
});
|
|
3217
|
-
var relationsBatchCreateVariant =
|
|
3218
|
-
action:
|
|
3219
|
-
relations:
|
|
3247
|
+
var relationsBatchCreateVariant = z14.object({
|
|
3248
|
+
action: z14.literal("batch-create"),
|
|
3249
|
+
relations: z14.array(relationItemSchema).min(1).max(RELATION_BATCH_MAX)
|
|
3220
3250
|
});
|
|
3221
|
-
var relationsDeleteVariant =
|
|
3222
|
-
action:
|
|
3223
|
-
from:
|
|
3224
|
-
to:
|
|
3251
|
+
var relationsDeleteVariant = z14.object({
|
|
3252
|
+
action: z14.literal("delete"),
|
|
3253
|
+
from: z14.string().max(200),
|
|
3254
|
+
to: z14.string().max(200),
|
|
3225
3255
|
type: relationType
|
|
3226
3256
|
});
|
|
3227
|
-
var relationsActionUnion =
|
|
3257
|
+
var relationsActionUnion = z14.discriminatedUnion("action", [
|
|
3228
3258
|
relationsCreateVariant,
|
|
3229
3259
|
relationsBatchCreateVariant,
|
|
3230
3260
|
relationsDeleteVariant
|
|
@@ -3453,22 +3483,22 @@ async function handleDelete(from, to, type) {
|
|
|
3453
3483
|
}
|
|
3454
3484
|
|
|
3455
3485
|
// src/tools/context.ts
|
|
3456
|
-
import { z as
|
|
3486
|
+
import { z as z21 } from "zod/v3";
|
|
3457
3487
|
|
|
3458
3488
|
// src/lib/readinessNotices.ts
|
|
3459
3489
|
var READINESS_PROVISIONAL_LINE = `The sample is incomplete: it left out ${TRUST_STATUS_LABELS.current.toLowerCase()} entries. Counts are lower bounds, apparent gaps may already be covered.`;
|
|
3460
3490
|
|
|
3461
3491
|
// src/tools/documents.ts
|
|
3462
|
-
import { z as
|
|
3492
|
+
import { z as z15 } from "zod/v3";
|
|
3463
3493
|
var DOCUMENTS_ACTIONS = ["get-last-verified-brief"];
|
|
3464
|
-
var documentsSchema =
|
|
3465
|
-
action:
|
|
3494
|
+
var documentsSchema = z15.object({
|
|
3495
|
+
action: z15.enum(DOCUMENTS_ACTIONS).describe(
|
|
3466
3496
|
"'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')."
|
|
3467
3497
|
),
|
|
3468
|
-
templateId:
|
|
3498
|
+
templateId: z15.string().max(200).describe(
|
|
3469
3499
|
"Brief template identifier \u2014 currently 'steering-brief' is the only registered template."
|
|
3470
3500
|
),
|
|
3471
|
-
scopeKey:
|
|
3501
|
+
scopeKey: z15.string().max(200).describe(
|
|
3472
3502
|
"Scope key: 'workspace:<workspaceId>' for the whole workspace brief, or 'initiative:<INI-ID>' for one initiative. Any other value finds no brief."
|
|
3473
3503
|
)
|
|
3474
3504
|
});
|
|
@@ -3537,27 +3567,27 @@ This row pre-dates snapshot capture (legacy backfill), so no summary is availabl
|
|
|
3537
3567
|
}
|
|
3538
3568
|
|
|
3539
3569
|
// src/tools/contextLookups.ts
|
|
3540
|
-
import { z as
|
|
3570
|
+
import { z as z20 } from "zod/v3";
|
|
3541
3571
|
|
|
3542
3572
|
// src/tools/graph.ts
|
|
3543
|
-
import { z as
|
|
3573
|
+
import { z as z16 } from "zod/v3";
|
|
3544
3574
|
var GRAPH_ACTIONS = ["find"];
|
|
3545
|
-
var graphSchema =
|
|
3546
|
-
action:
|
|
3575
|
+
var graphSchema = z16.object({
|
|
3576
|
+
action: z16.enum(GRAPH_ACTIONS).describe(
|
|
3547
3577
|
"'find': traverse relations from an entry (graph walk)."
|
|
3548
3578
|
),
|
|
3549
|
-
entryId:
|
|
3550
|
-
direction:
|
|
3579
|
+
entryId: z16.string().max(200).describe("Entry ID, e.g. '<PREFIX>-<n>'"),
|
|
3580
|
+
direction: z16.enum(["incoming", "outgoing", "both"]).default("both").optional().describe("For find: 'incoming' = what references this, 'outgoing' = what this references")
|
|
3551
3581
|
});
|
|
3552
|
-
var graphFindOutputSchema =
|
|
3553
|
-
entryId:
|
|
3554
|
-
relations:
|
|
3555
|
-
entryId:
|
|
3556
|
-
name:
|
|
3557
|
-
type:
|
|
3558
|
-
direction:
|
|
3582
|
+
var graphFindOutputSchema = z16.object({
|
|
3583
|
+
entryId: z16.string(),
|
|
3584
|
+
relations: z16.array(z16.object({
|
|
3585
|
+
entryId: z16.string().optional(),
|
|
3586
|
+
name: z16.string(),
|
|
3587
|
+
type: z16.string(),
|
|
3588
|
+
direction: z16.enum(["outgoing", "incoming"])
|
|
3559
3589
|
})),
|
|
3560
|
-
total:
|
|
3590
|
+
total: z16.number()
|
|
3561
3591
|
});
|
|
3562
3592
|
async function handleFind(entryId, direction) {
|
|
3563
3593
|
const relations = await kernelQuery("chain.listEntryRelations", { entryId });
|
|
@@ -3658,29 +3688,29 @@ async function handleFind(entryId, direction) {
|
|
|
3658
3688
|
}
|
|
3659
3689
|
|
|
3660
3690
|
// src/tools/people.ts
|
|
3661
|
-
import { z as
|
|
3691
|
+
import { z as z17 } from "zod/v3";
|
|
3662
3692
|
var PEOPLE_ACTIONS = ["invite", "remove"];
|
|
3663
|
-
var peopleSchema =
|
|
3664
|
-
action:
|
|
3665
|
-
email:
|
|
3666
|
-
person:
|
|
3693
|
+
var peopleSchema = z17.object({
|
|
3694
|
+
action: z17.enum(PEOPLE_ACTIONS).describe("'invite': send a login link by email. 'remove': take a person out of a team."),
|
|
3695
|
+
email: z17.string().max(320).optional().describe("'invite': where the login link goes. Required for 'invite'."),
|
|
3696
|
+
person: z17.string().max(320).optional().describe(
|
|
3667
3697
|
"'invite': a placeholder's person id, instead of newPersonName. 'remove': the person, by person id or exact email."
|
|
3668
3698
|
),
|
|
3669
|
-
newPersonName:
|
|
3670
|
-
teamId:
|
|
3699
|
+
newPersonName: z17.string().max(120).optional().describe("'invite': the name of a new person to invite, instead of person."),
|
|
3700
|
+
teamId: z17.string().max(200).optional().describe("'remove': the team, by chain id or entry id. Required for 'remove'.")
|
|
3671
3701
|
});
|
|
3672
|
-
var inviteVariant =
|
|
3673
|
-
action:
|
|
3674
|
-
email:
|
|
3675
|
-
person:
|
|
3676
|
-
newPersonName:
|
|
3702
|
+
var inviteVariant = z17.object({
|
|
3703
|
+
action: z17.literal("invite"),
|
|
3704
|
+
email: z17.string().max(320),
|
|
3705
|
+
person: z17.string().max(320).optional(),
|
|
3706
|
+
newPersonName: z17.string().max(120).optional()
|
|
3677
3707
|
});
|
|
3678
|
-
var removeVariant =
|
|
3679
|
-
action:
|
|
3680
|
-
person:
|
|
3681
|
-
teamId:
|
|
3708
|
+
var removeVariant = z17.object({
|
|
3709
|
+
action: z17.literal("remove"),
|
|
3710
|
+
person: z17.string().max(320),
|
|
3711
|
+
teamId: z17.string().max(200)
|
|
3682
3712
|
});
|
|
3683
|
-
var peopleActionUnion =
|
|
3713
|
+
var peopleActionUnion = z17.discriminatedUnion("action", [inviteVariant, removeVariant]);
|
|
3684
3714
|
var PEOPLE_ACTION_SPECS = {
|
|
3685
3715
|
invite: { params: ["email", "person", "newPersonName"], description: "email is required, plus exactly one of person (a placeholder's id) or newPersonName." },
|
|
3686
3716
|
remove: { params: ["person", "teamId"], description: "person and teamId are required." }
|
|
@@ -3790,7 +3820,7 @@ function registerPeopleTools(server) {
|
|
|
3790
3820
|
}
|
|
3791
3821
|
|
|
3792
3822
|
// src/tools/outcome.ts
|
|
3793
|
-
import { z as
|
|
3823
|
+
import { z as z18 } from "zod/v3";
|
|
3794
3824
|
|
|
3795
3825
|
// src/lib/outcomeObjectiveLines.ts
|
|
3796
3826
|
var LOOKUP_LINE = {
|
|
@@ -3819,39 +3849,39 @@ function formatOutcomeObjectiveLines(view, clean) {
|
|
|
3819
3849
|
var OUTCOME_ACTIONS = ["record"];
|
|
3820
3850
|
var OUTCOME_READS_MOVED = "outcome only records readings. Read with the read-only context tool: context action=outcome entryId=... (the derived view, its objective and sibling key results) or context action=readings entryId=... (the readings, newest first).";
|
|
3821
3851
|
var READING_KINDS = ["measurement", "estimate", "correction"];
|
|
3822
|
-
var outcomeSchema =
|
|
3852
|
+
var outcomeSchema = z18.object({
|
|
3823
3853
|
action: actionEnum(OUTCOME_ACTIONS, { list: OUTCOME_READS_MOVED, show: OUTCOME_READS_MOVED }).describe(
|
|
3824
3854
|
"'record': record a reading (evidence, not a verdict). Reads live on context: action=outcome and action=readings."
|
|
3825
3855
|
),
|
|
3826
|
-
entryId:
|
|
3856
|
+
entryId: z18.string().max(200).optional().describe("The key result (or other outcome-bearing) entry, by its chain id. Required."),
|
|
3827
3857
|
// PR #858 review round 3 (Codex P2, PRRT_kwDORS4ils6gXHj9): a JSON number that overflows to
|
|
3828
3858
|
// `Infinity` (e.g. `1e400`) parses fine in JS and passes a plain `z.number()`, but
|
|
3829
3859
|
// `callGateway()` serializes it with `JSON.stringify`, which turns `Infinity` into `null` —
|
|
3830
3860
|
// the backend's `v.number()` validator then rejects a call this tool's own schema accepted.
|
|
3831
3861
|
// `.finite()` rejects it here, matching the explicit finite-value checks the CLI/other outcome
|
|
3832
3862
|
// entry surfaces already use.
|
|
3833
|
-
value:
|
|
3834
|
-
valueText:
|
|
3835
|
-
asOf:
|
|
3836
|
-
kind:
|
|
3837
|
-
correctsReadingId:
|
|
3838
|
-
recordedByRoleId:
|
|
3839
|
-
note:
|
|
3840
|
-
source:
|
|
3863
|
+
value: z18.number().finite().optional().describe("'record': the measured value. Required for 'record'."),
|
|
3864
|
+
valueText: z18.string().max(500).optional().describe("'record': verbatim as-reported form when the source was not clean, e.g. '~62%'. Display only."),
|
|
3865
|
+
asOf: z18.string().max(64).optional().describe("'record': when the world was in this state, as a parseable date (default: now). Back-dating a backfill is legitimate \u2014 it shows up as asOf earlier than recordedAt."),
|
|
3866
|
+
kind: z18.enum(READING_KINDS).optional().describe("'record': measurement | estimate | correction (default: measurement)."),
|
|
3867
|
+
correctsReadingId: z18.string().max(200).optional().describe("'record': required with kind='correction' \u2014 the reading id this replaces. Refused if that row is already superseded."),
|
|
3868
|
+
recordedByRoleId: z18.string().max(200).optional().describe("'record': the accountable role (default: the entry's reporterRoleId, then its owning role)."),
|
|
3869
|
+
note: z18.string().max(2e3).optional().describe("'record': free-text note recorded with the reading."),
|
|
3870
|
+
source: z18.string().max(500).optional().describe("'record': where the number came from \u2014 a dashboard name, a query, a URL.")
|
|
3841
3871
|
});
|
|
3842
|
-
var recordVariant =
|
|
3843
|
-
action:
|
|
3844
|
-
entryId:
|
|
3845
|
-
value:
|
|
3846
|
-
valueText:
|
|
3847
|
-
asOf:
|
|
3848
|
-
kind:
|
|
3849
|
-
correctsReadingId:
|
|
3850
|
-
recordedByRoleId:
|
|
3851
|
-
note:
|
|
3852
|
-
source:
|
|
3872
|
+
var recordVariant = z18.object({
|
|
3873
|
+
action: z18.literal("record"),
|
|
3874
|
+
entryId: z18.string().max(200),
|
|
3875
|
+
value: z18.number().finite(),
|
|
3876
|
+
valueText: z18.string().max(500).optional(),
|
|
3877
|
+
asOf: z18.string().max(64).optional(),
|
|
3878
|
+
kind: z18.enum(READING_KINDS).optional(),
|
|
3879
|
+
correctsReadingId: z18.string().max(200).optional(),
|
|
3880
|
+
recordedByRoleId: z18.string().max(200).optional(),
|
|
3881
|
+
note: z18.string().max(2e3).optional(),
|
|
3882
|
+
source: z18.string().max(500).optional()
|
|
3853
3883
|
});
|
|
3854
|
-
var outcomeActionUnion =
|
|
3884
|
+
var outcomeActionUnion = z18.discriminatedUnion("action", [recordVariant]);
|
|
3855
3885
|
var OUTCOME_ACTION_SPECS = {
|
|
3856
3886
|
record: {
|
|
3857
3887
|
params: ["entryId", "value", "valueText", "asOf", "kind", "correctsReadingId", "recordedByRoleId", "note", "source"],
|
|
@@ -4047,60 +4077,60 @@ function registerOutcomeTools(server) {
|
|
|
4047
4077
|
}
|
|
4048
4078
|
|
|
4049
4079
|
// src/tools/role.ts
|
|
4050
|
-
import { z as
|
|
4080
|
+
import { z as z19 } from "zod/v3";
|
|
4051
4081
|
var ROLE_ACTIONS = ["seat", "unseat", "release_move", "accept_move", "refuse_move", "move_work"];
|
|
4052
4082
|
var ROLE_READS_MOVED = {
|
|
4053
4083
|
accountable: "role only writes. Read what a role owns and who holds it with the read-only context tool: context action=accountable roleId=..."
|
|
4054
4084
|
};
|
|
4055
|
-
var roleSchema =
|
|
4085
|
+
var roleSchema = z19.object({
|
|
4056
4086
|
action: actionEnum(ROLE_ACTIONS, ROLE_READS_MOVED).describe(
|
|
4057
4087
|
"'seat': put a person in this role. 'unseat': take this role from a person. 'release_move' / 'accept_move' / 'refuse_move': move a role or team to a team with another Team Lead. 'move_work': move every open item a role owns to another role."
|
|
4058
4088
|
),
|
|
4059
|
-
roleId:
|
|
4060
|
-
person:
|
|
4089
|
+
roleId: z19.string().max(200).optional().describe("The role, by the human chain id `chain.getEntry` or `pb get` would print for it, or a raw entry id."),
|
|
4090
|
+
person: z19.string().max(200).optional().describe(
|
|
4061
4091
|
"'seat' / 'unseat': an existing person, by person id or exact email. For 'seat', give this or newPersonName, not both."
|
|
4062
4092
|
),
|
|
4063
|
-
newPersonName:
|
|
4093
|
+
newPersonName: z19.string().max(120).optional().describe(
|
|
4064
4094
|
"'seat': the name of a person who has no login yet; a placeholder person is created once and reused for the same exact name. Refused when the name belongs to someone with an account."
|
|
4065
4095
|
),
|
|
4066
|
-
teamId:
|
|
4096
|
+
teamId: z19.string().max(200).optional().describe(
|
|
4067
4097
|
"'seat' / 'unseat': the team, by chain id or entry id. Only needed for Team Lead, which lives in every team; any other role is seated in its home team. 'release_move': the team it moves to."
|
|
4068
4098
|
),
|
|
4069
|
-
onMyAuthority:
|
|
4099
|
+
onMyAuthority: z19.boolean().optional().describe(
|
|
4070
4100
|
"'seat', Team Lead only: as the team's Team Lead, seat a second Team Lead who holds the seat on your authority until you unseat them."
|
|
4071
4101
|
),
|
|
4072
|
-
childId:
|
|
4073
|
-
why:
|
|
4074
|
-
fromRoleId:
|
|
4075
|
-
toRoleId:
|
|
4076
|
-
dryRun:
|
|
4077
|
-
page:
|
|
4102
|
+
childId: z19.string().max(200).optional().describe("'release_move' / 'accept_move' / 'refuse_move': the role or team that moves, by chain id or entry id."),
|
|
4103
|
+
why: z19.string().max(1e3).optional().describe("'refuse_move': why the move is refused; it becomes a tension for the old team's Team Lead."),
|
|
4104
|
+
fromRoleId: z19.string().max(200).optional().describe("'move_work': the role whose open work moves, by chain id or entry id."),
|
|
4105
|
+
toRoleId: z19.string().max(200).optional().describe("'move_work': the receiving role; without it, the nearest Team Lead of the old role's home team."),
|
|
4106
|
+
dryRun: z19.boolean().optional().describe("'move_work': list the role's open items, 200 a page with how many are listed, and change nothing."),
|
|
4107
|
+
page: z19.number().int().min(1).optional().describe("'move_work' with dryRun: the page to list, from 1.")
|
|
4078
4108
|
});
|
|
4079
|
-
var seatVariant =
|
|
4080
|
-
action:
|
|
4081
|
-
roleId:
|
|
4082
|
-
person:
|
|
4083
|
-
newPersonName:
|
|
4084
|
-
teamId:
|
|
4085
|
-
onMyAuthority:
|
|
4109
|
+
var seatVariant = z19.object({
|
|
4110
|
+
action: z19.literal("seat"),
|
|
4111
|
+
roleId: z19.string().max(200),
|
|
4112
|
+
person: z19.string().max(200).optional(),
|
|
4113
|
+
newPersonName: z19.string().max(120).optional(),
|
|
4114
|
+
teamId: z19.string().max(200).optional(),
|
|
4115
|
+
onMyAuthority: z19.boolean().optional()
|
|
4086
4116
|
});
|
|
4087
|
-
var unseatVariant =
|
|
4088
|
-
action:
|
|
4089
|
-
roleId:
|
|
4090
|
-
person:
|
|
4091
|
-
teamId:
|
|
4117
|
+
var unseatVariant = z19.object({
|
|
4118
|
+
action: z19.literal("unseat"),
|
|
4119
|
+
roleId: z19.string().max(200),
|
|
4120
|
+
person: z19.string().max(200),
|
|
4121
|
+
teamId: z19.string().max(200).optional()
|
|
4092
4122
|
});
|
|
4093
|
-
var releaseMoveVariant =
|
|
4094
|
-
var acceptMoveVariant =
|
|
4095
|
-
var refuseMoveVariant =
|
|
4096
|
-
var moveWorkVariant =
|
|
4097
|
-
action:
|
|
4098
|
-
fromRoleId:
|
|
4099
|
-
toRoleId:
|
|
4100
|
-
dryRun:
|
|
4101
|
-
page:
|
|
4123
|
+
var releaseMoveVariant = z19.object({ action: z19.literal("release_move"), childId: z19.string().max(200), teamId: z19.string().max(200) });
|
|
4124
|
+
var acceptMoveVariant = z19.object({ action: z19.literal("accept_move"), childId: z19.string().max(200) });
|
|
4125
|
+
var refuseMoveVariant = z19.object({ action: z19.literal("refuse_move"), childId: z19.string().max(200), why: z19.string().max(1e3) });
|
|
4126
|
+
var moveWorkVariant = z19.object({
|
|
4127
|
+
action: z19.literal("move_work"),
|
|
4128
|
+
fromRoleId: z19.string().max(200),
|
|
4129
|
+
toRoleId: z19.string().max(200).optional(),
|
|
4130
|
+
dryRun: z19.boolean().optional(),
|
|
4131
|
+
page: z19.number().int().min(1).optional()
|
|
4102
4132
|
});
|
|
4103
|
-
var roleActionUnion =
|
|
4133
|
+
var roleActionUnion = z19.discriminatedUnion("action", [
|
|
4104
4134
|
seatVariant,
|
|
4105
4135
|
unseatVariant,
|
|
4106
4136
|
releaseMoveVariant,
|
|
@@ -4285,63 +4315,63 @@ function registerRoleTools(server) {
|
|
|
4285
4315
|
|
|
4286
4316
|
// src/tools/contextLookups.ts
|
|
4287
4317
|
var LOOKUP_ACTIONS = ["get", "batch", "history", "list", "search", "find", "people", "outcome", "readings", "accountable", "preflight"];
|
|
4288
|
-
var statusFilterSchema =
|
|
4289
|
-
var preflightLinks =
|
|
4318
|
+
var statusFilterSchema = z20.union([z20.string().max(200), z20.array(z20.enum(ENTRY_STATUS_READ_WORDS)).max(5)]);
|
|
4319
|
+
var preflightLinks = z20.array(z20.object({ type: z20.string().max(200), entryId: z20.string().max(200) })).max(50).optional();
|
|
4290
4320
|
var LOOKUP_ACTION_DESCRIBE = `'get': one entry in full by ID. 'batch': up to 20 entries by ID. 'history': audit trail for an entry. 'list': browse entries with filters (${TRUST_STATUS_LABELS.current.toLowerCase()} entries by default). 'search': full-text search across entries. 'find': an entry's direct relations (direction: incoming|outgoing|both, default both). 'people': the workspace's members with name, email and status. 'outcome': a key result's derived view, its objective and sibling key results. 'readings': its readings, newest first. 'accountable': what a role owns and who holds it. 'preflight': a collection's requirements. `;
|
|
4291
4321
|
var LOOKUP_TOOL_LINES = "- **get**: Fetch a single entry by ID \u2014 full record with data, labels, relations, history.\n- **batch**: Fetch multiple entries (max 20) in one call. Same shape as get per entry.\n- **history**: Audit trail for an entry.\n- **list**: Browse entries with optional filters (collection, status, tag, label). Use collections action=list first to discover slugs.\n- **search**: Full-text search across entries. Scope by collection or filter by status.\n- **find**: An entry's direct relations, incoming and outgoing. NOT full-text search (use search).\n- **people**: The workspace's members: name, email, status, role. Max 200.\n- **outcome**: A key result's derived view (current, progress, pace, staleness, recorded completion) with its objective and up to 5 sibling key results.\n- **readings**: A key result's readings, newest first; superseded rows are marked with their replacement. Record one with `outcome action=record`.\n- **accountable**: What a role owns, reports on, and who holds it.\n- **preflight**: What an entry in a collection needs before you compose it. Saves nothing.\n";
|
|
4292
4322
|
var lookupParams = {
|
|
4293
|
-
entryIds:
|
|
4294
|
-
collection:
|
|
4295
|
-
query:
|
|
4323
|
+
entryIds: z20.array(z20.string().max(200)).min(1).max(20).optional().describe("For 'batch': entry IDs, e.g. ['TYPE-strategy', 'STR-jljeg7']"),
|
|
4324
|
+
collection: z20.string().max(200).optional().describe("For 'list'/'search': collection slug, e.g. 'glossary', 'tracking-events'. Required for 'preflight'."),
|
|
4325
|
+
query: z20.string().min(2).max(500).optional().describe("For 'search': search text (min 2 characters)."),
|
|
4296
4326
|
// 'active'/'accepted'/'current' are the same trust level (DEC-1575/DEC-1788) — all enumerated, never one substituted.
|
|
4297
4327
|
status: statusFilterSchema.optional().describe(
|
|
4298
4328
|
`For 'list': defaults to ${TRUST_STATUS_LABELS.current.toLowerCase()} entries (active/accepted/current); use status='draft' to discover drafts. One lifecycle or category value (${ENTRY_STATUS_READ_WORDS.join("|")}). For 'search': one value OR an array of up to 5 (e.g. ['active','accepted']).`
|
|
4299
4329
|
),
|
|
4300
|
-
tag:
|
|
4301
|
-
label:
|
|
4302
|
-
limit:
|
|
4303
|
-
roleId:
|
|
4304
|
-
canonicalKey:
|
|
4305
|
-
cursor:
|
|
4330
|
+
tag: z20.string().max(200).optional().describe("For 'list': filter by internal tag."),
|
|
4331
|
+
label: z20.string().max(200).optional().describe("For 'list': filter by label slug \u2014 matches entries across all collections."),
|
|
4332
|
+
limit: z20.number().int().positive().max(200).optional().describe("For 'readings'/'accountable': max rows (default and maximum 200)."),
|
|
4333
|
+
roleId: z20.string().max(200).optional().describe("For 'accountable': the role's id (required)."),
|
|
4334
|
+
canonicalKey: z20.string().max(200).optional().describe("For 'accountable'/'preflight': one kind, e.g. tension."),
|
|
4335
|
+
cursor: z20.number().optional().describe("For 'accountable': nextCursor of an earlier page."),
|
|
4306
4336
|
links: preflightLinks.describe("For 'preflight': proposed links.")
|
|
4307
4337
|
};
|
|
4308
4338
|
var lookupVariants = [
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
action:
|
|
4314
|
-
collection:
|
|
4315
|
-
status:
|
|
4339
|
+
z20.object({ action: z20.literal("get"), entryId: z20.string().max(200) }),
|
|
4340
|
+
z20.object({ action: z20.literal("batch"), entryIds: z20.array(z20.string().max(200)).min(1).max(20) }),
|
|
4341
|
+
z20.object({ action: z20.literal("history"), entryId: z20.string().max(200) }),
|
|
4342
|
+
z20.object({
|
|
4343
|
+
action: z20.literal("list"),
|
|
4344
|
+
collection: z20.string().max(200).optional(),
|
|
4345
|
+
status: z20.string().max(200).optional(),
|
|
4316
4346
|
// one status word; the flat union serves search
|
|
4317
|
-
tag:
|
|
4318
|
-
label:
|
|
4347
|
+
tag: z20.string().max(200).optional(),
|
|
4348
|
+
label: z20.string().max(200).optional()
|
|
4319
4349
|
}),
|
|
4320
|
-
|
|
4321
|
-
action:
|
|
4322
|
-
query:
|
|
4323
|
-
collection:
|
|
4350
|
+
z20.object({
|
|
4351
|
+
action: z20.literal("search"),
|
|
4352
|
+
query: z20.string().min(2).max(500),
|
|
4353
|
+
collection: z20.string().max(200).optional(),
|
|
4324
4354
|
status: statusFilterSchema.optional()
|
|
4325
4355
|
}),
|
|
4326
|
-
|
|
4327
|
-
action:
|
|
4328
|
-
entryId:
|
|
4329
|
-
direction:
|
|
4356
|
+
z20.object({
|
|
4357
|
+
action: z20.literal("find"),
|
|
4358
|
+
entryId: z20.string().max(200),
|
|
4359
|
+
direction: z20.enum(["incoming", "outgoing", "both"]).optional().default("both")
|
|
4330
4360
|
}),
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
action:
|
|
4336
|
-
roleId:
|
|
4337
|
-
canonicalKey:
|
|
4338
|
-
limit:
|
|
4339
|
-
cursor:
|
|
4361
|
+
z20.object({ action: z20.literal("people") }),
|
|
4362
|
+
z20.object({ action: z20.literal("outcome"), entryId: z20.string().max(200) }),
|
|
4363
|
+
z20.object({ action: z20.literal("readings"), entryId: z20.string().max(200), limit: z20.number().int().positive().max(200).optional() }),
|
|
4364
|
+
z20.object({
|
|
4365
|
+
action: z20.literal("accountable"),
|
|
4366
|
+
roleId: z20.string().max(200),
|
|
4367
|
+
canonicalKey: z20.string().max(200).optional(),
|
|
4368
|
+
limit: z20.number().int().positive().max(200).optional(),
|
|
4369
|
+
cursor: z20.number().optional()
|
|
4340
4370
|
}),
|
|
4341
|
-
|
|
4342
|
-
action:
|
|
4343
|
-
collection:
|
|
4344
|
-
canonicalKey:
|
|
4371
|
+
z20.object({
|
|
4372
|
+
action: z20.literal("preflight"),
|
|
4373
|
+
collection: z20.string().max(200),
|
|
4374
|
+
canonicalKey: z20.string().max(200).optional(),
|
|
4345
4375
|
links: preflightLinks
|
|
4346
4376
|
})
|
|
4347
4377
|
];
|
|
@@ -4392,90 +4422,90 @@ function epistemicCollectionHint(collectionName) {
|
|
|
4392
4422
|
return "";
|
|
4393
4423
|
}
|
|
4394
4424
|
var CONTEXT_ACTIONS = [...LOOKUP_ACTIONS, "gather", "build", "neighborhood", "changes", "chain", "cross-cut", "incremental", "brief", "last-verified-brief"];
|
|
4395
|
-
var contextSchema =
|
|
4425
|
+
var contextSchema = z21.object({
|
|
4396
4426
|
// provenance: neighborhood BET-142; changes/chain/cross-cut/incremental/brief BET-239 (E4, E6)
|
|
4397
|
-
action:
|
|
4427
|
+
action: z21.enum(CONTEXT_ACTIONS).describe(
|
|
4398
4428
|
LOOKUP_ACTION_DESCRIBE + "'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 \u2014 use the pb CLI's `tensions list` for 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. Requires templateId and scopeKey."
|
|
4399
4429
|
),
|
|
4400
|
-
entryId:
|
|
4430
|
+
entryId: z21.string().max(200).optional().describe("For 'get'/'history'/'find'/'outcome'/'readings'/'build'/'neighborhood'/'chain': entry ID. For 'gather': optional (entry-graph mode)."),
|
|
4401
4431
|
...lookupParams,
|
|
4402
|
-
mapEntryId:
|
|
4432
|
+
mapEntryId: z21.string().max(200).optional().describe(
|
|
4403
4433
|
"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>'."
|
|
4404
4434
|
),
|
|
4405
|
-
task:
|
|
4406
|
-
since:
|
|
4435
|
+
task: z21.string().max(2e3).optional().describe("For 'gather': natural-language task description for loading task-relevant governance, binding constraints, and supporting context."),
|
|
4436
|
+
since: z21.string().max(200).optional().describe(
|
|
4407
4437
|
"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'."
|
|
4408
4438
|
),
|
|
4409
|
-
direction:
|
|
4410
|
-
relationType:
|
|
4439
|
+
direction: z21.enum(["outgoing", "incoming", "both"]).optional().describe("For 'chain': 'outgoing' follows relations from source, 'incoming' to source (default outgoing). For 'find': incoming|outgoing|both (default both)."),
|
|
4440
|
+
relationType: z21.string().max(200).optional().describe(
|
|
4411
4441
|
"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', 'depends_on'."
|
|
4412
4442
|
),
|
|
4413
|
-
mode:
|
|
4414
|
-
maxHops:
|
|
4415
|
-
maxResults:
|
|
4416
|
-
strategy:
|
|
4417
|
-
skill:
|
|
4443
|
+
mode: z21.enum(["search", "graph"]).default("search").optional().describe("For gather: 'search' (default) or 'graph' (enhanced with provenance paths). Ignored when mapEntryId is provided."),
|
|
4444
|
+
maxHops: z21.number().min(1).max(4).default(2).describe("Relation traversal depth (1=direct only, 2=default, 3=wide net, 4=deep chain walk)"),
|
|
4445
|
+
maxResults: z21.number().min(1).max(25).default(10).optional().describe("Max entries to return in gather task mode (default 10)"),
|
|
4446
|
+
strategy: z21.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."),
|
|
4447
|
+
skill: z21.string().max(200).optional().describe(
|
|
4418
4448
|
"Skill name for 'incremental' action \u2014 identifies which skill's brief history to compare against. Examples: 'preflight', 'shaping', 'review'. Required when action is 'incremental'."
|
|
4419
4449
|
),
|
|
4420
|
-
briefType:
|
|
4450
|
+
briefType: z21.enum(["steering", "confidence", "delta"]).optional().describe(
|
|
4421
4451
|
"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 (tensions: use the pb CLI's `tensions list`, not this action). 'delta': changes + relations since a custom timestamp (use 'since' param). Required when action is 'brief'."
|
|
4422
4452
|
),
|
|
4423
|
-
templateId:
|
|
4453
|
+
templateId: z21.string().max(200).optional().describe(
|
|
4424
4454
|
"For 'last-verified-brief': brief template identifier \u2014 currently 'steering-brief' is the only registered template."
|
|
4425
4455
|
),
|
|
4426
|
-
scopeKey:
|
|
4456
|
+
scopeKey: z21.string().max(200).optional().describe(
|
|
4427
4457
|
"For 'last-verified-brief': canonical scope key \u2014 'workspace:<workspaceId>' or 'initiative:<INI-ID>'."
|
|
4428
4458
|
)
|
|
4429
4459
|
});
|
|
4430
|
-
var contextGatherVariant =
|
|
4431
|
-
action:
|
|
4432
|
-
entryId:
|
|
4433
|
-
mapEntryId:
|
|
4434
|
-
task:
|
|
4435
|
-
mode:
|
|
4436
|
-
maxHops:
|
|
4437
|
-
maxResults:
|
|
4438
|
-
strategy:
|
|
4460
|
+
var contextGatherVariant = z21.object({
|
|
4461
|
+
action: z21.literal("gather"),
|
|
4462
|
+
entryId: z21.string().max(200).optional(),
|
|
4463
|
+
mapEntryId: z21.string().max(200).optional(),
|
|
4464
|
+
task: z21.string().max(2e3).optional(),
|
|
4465
|
+
mode: z21.enum(["search", "graph"]).optional().default("search"),
|
|
4466
|
+
maxHops: z21.number().min(1).max(4).optional().default(2),
|
|
4467
|
+
maxResults: z21.number().min(1).max(25).optional().default(10),
|
|
4468
|
+
strategy: z21.enum(["hybrid", "keyword"]).optional().default("keyword")
|
|
4439
4469
|
});
|
|
4440
|
-
var contextBuildVariant =
|
|
4441
|
-
action:
|
|
4442
|
-
entryId:
|
|
4443
|
-
maxHops:
|
|
4470
|
+
var contextBuildVariant = z21.object({
|
|
4471
|
+
action: z21.literal("build"),
|
|
4472
|
+
entryId: z21.string().max(200),
|
|
4473
|
+
maxHops: z21.number().min(1).max(4).optional().default(2)
|
|
4444
4474
|
});
|
|
4445
|
-
var contextNeighborhoodVariant =
|
|
4446
|
-
action:
|
|
4447
|
-
entryId:
|
|
4475
|
+
var contextNeighborhoodVariant = z21.object({
|
|
4476
|
+
action: z21.literal("neighborhood"),
|
|
4477
|
+
entryId: z21.string().max(200)
|
|
4448
4478
|
});
|
|
4449
|
-
var contextChangesVariant =
|
|
4450
|
-
action:
|
|
4451
|
-
since:
|
|
4479
|
+
var contextChangesVariant = z21.object({
|
|
4480
|
+
action: z21.literal("changes"),
|
|
4481
|
+
since: z21.string().max(200)
|
|
4452
4482
|
});
|
|
4453
|
-
var contextChainVariant =
|
|
4454
|
-
action:
|
|
4455
|
-
entryId:
|
|
4456
|
-
direction:
|
|
4457
|
-
maxHops:
|
|
4458
|
-
relationType:
|
|
4483
|
+
var contextChainVariant = z21.object({
|
|
4484
|
+
action: z21.literal("chain"),
|
|
4485
|
+
entryId: z21.string().max(200),
|
|
4486
|
+
direction: z21.enum(["outgoing", "incoming"]).optional().default("outgoing"),
|
|
4487
|
+
maxHops: z21.number().min(1).max(4).optional().default(2),
|
|
4488
|
+
relationType: z21.string().max(200).optional()
|
|
4459
4489
|
});
|
|
4460
|
-
var contextCrossCutVariant =
|
|
4461
|
-
action:
|
|
4462
|
-
relationType:
|
|
4490
|
+
var contextCrossCutVariant = z21.object({
|
|
4491
|
+
action: z21.literal("cross-cut"),
|
|
4492
|
+
relationType: z21.string().max(200)
|
|
4463
4493
|
});
|
|
4464
|
-
var contextIncrementalVariant =
|
|
4465
|
-
action:
|
|
4466
|
-
skill:
|
|
4494
|
+
var contextIncrementalVariant = z21.object({
|
|
4495
|
+
action: z21.literal("incremental"),
|
|
4496
|
+
skill: z21.string().max(200)
|
|
4467
4497
|
});
|
|
4468
|
-
var contextBriefVariant =
|
|
4469
|
-
action:
|
|
4470
|
-
briefType:
|
|
4471
|
-
since:
|
|
4498
|
+
var contextBriefVariant = z21.object({
|
|
4499
|
+
action: z21.literal("brief"),
|
|
4500
|
+
briefType: z21.enum(["steering", "confidence", "delta"]),
|
|
4501
|
+
since: z21.string().max(200).optional()
|
|
4472
4502
|
});
|
|
4473
|
-
var contextLastVerifiedBriefVariant =
|
|
4474
|
-
action:
|
|
4475
|
-
templateId:
|
|
4476
|
-
scopeKey:
|
|
4503
|
+
var contextLastVerifiedBriefVariant = z21.object({
|
|
4504
|
+
action: z21.literal("last-verified-brief"),
|
|
4505
|
+
templateId: z21.string().max(200),
|
|
4506
|
+
scopeKey: z21.string().max(200)
|
|
4477
4507
|
});
|
|
4478
|
-
var contextActionUnion =
|
|
4508
|
+
var contextActionUnion = z21.discriminatedUnion("action", [
|
|
4479
4509
|
...lookupVariants,
|
|
4480
4510
|
contextGatherVariant,
|
|
4481
4511
|
contextBuildVariant,
|
|
@@ -5461,7 +5491,7 @@ function formatTimeAgo(ms) {
|
|
|
5461
5491
|
}
|
|
5462
5492
|
|
|
5463
5493
|
// src/tools/collections.ts
|
|
5464
|
-
import { z as
|
|
5494
|
+
import { z as z23 } from "zod/v3";
|
|
5465
5495
|
|
|
5466
5496
|
// src/lib/scopedCache.ts
|
|
5467
5497
|
var ScopedCache = class {
|
|
@@ -5523,17 +5553,17 @@ ${entry.guidance}`).join("\n\n");
|
|
|
5523
5553
|
}
|
|
5524
5554
|
|
|
5525
5555
|
// src/tools/labels.ts
|
|
5526
|
-
import { z as
|
|
5527
|
-
var labelsSchema =
|
|
5528
|
-
action:
|
|
5529
|
-
slug:
|
|
5530
|
-
name:
|
|
5531
|
-
color:
|
|
5532
|
-
description:
|
|
5533
|
-
parentSlug:
|
|
5534
|
-
isGroup:
|
|
5535
|
-
order:
|
|
5536
|
-
entryId:
|
|
5556
|
+
import { z as z22 } from "zod/v3";
|
|
5557
|
+
var labelsSchema = z22.object({
|
|
5558
|
+
action: z22.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"),
|
|
5559
|
+
slug: z22.string().max(200).optional().describe("Label slug (required for create/update/delete/apply/remove)"),
|
|
5560
|
+
name: z22.string().max(ENTRY_NAME_MAX_CHARS).optional().describe("Display name (required for create)"),
|
|
5561
|
+
color: z22.string().max(50).optional().describe("Hex color, e.g. '#ef4444'"),
|
|
5562
|
+
description: z22.string().max(LABEL_DESCRIPTION_MAX_CHARS).optional().describe("What this label means"),
|
|
5563
|
+
parentSlug: z22.string().max(200).optional().describe("Parent group slug for label hierarchy"),
|
|
5564
|
+
isGroup: z22.boolean().optional().describe("True if this is a group container, not a taggable label"),
|
|
5565
|
+
order: z22.number().optional().describe("Sort order within its group"),
|
|
5566
|
+
entryId: z22.string().max(200).optional().describe("Entry ID for apply/remove actions")
|
|
5537
5567
|
});
|
|
5538
5568
|
async function handleLabelsList() {
|
|
5539
5569
|
const labels = await kernelQuery("chain.listLabels");
|
|
@@ -5638,108 +5668,108 @@ var COLLECTIONS_ACTIONS = [
|
|
|
5638
5668
|
"label-remove"
|
|
5639
5669
|
];
|
|
5640
5670
|
var STATUS_CATEGORIES2 = ["draft", "current", "past", "discarded"];
|
|
5641
|
-
var statusListEntrySchema =
|
|
5642
|
-
var qualityCriterionSchema =
|
|
5643
|
-
field:
|
|
5671
|
+
var statusListEntrySchema = z23.object({ label: z23.string().max(200), category: z23.enum(STATUS_CATEGORIES2), archiveDefault: z23.boolean().optional(), resolveDefault: z23.boolean().optional() });
|
|
5672
|
+
var qualityCriterionSchema = z23.object({
|
|
5673
|
+
field: z23.string().max(200).describe("Entry data field key this criterion applies to, e.g. 'description', 'owner'"),
|
|
5644
5674
|
// WP-480 S1: `max_length` — must mirror the Convex rule union, or the tool rejects a
|
|
5645
5675
|
// valid criterion before the request ever reaches the server.
|
|
5646
|
-
rule:
|
|
5647
|
-
value:
|
|
5676
|
+
rule: z23.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)."),
|
|
5677
|
+
value: z23.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'.")
|
|
5648
5678
|
});
|
|
5649
|
-
var fieldSchema =
|
|
5650
|
-
key:
|
|
5651
|
-
label:
|
|
5652
|
-
type:
|
|
5653
|
-
required:
|
|
5654
|
-
options:
|
|
5655
|
-
searchable:
|
|
5656
|
-
displayHint:
|
|
5657
|
-
zone:
|
|
5658
|
-
colorMap:
|
|
5659
|
-
accentSource:
|
|
5660
|
-
iconMap:
|
|
5661
|
-
helpText:
|
|
5662
|
-
optionDescriptions:
|
|
5663
|
-
semanticRole:
|
|
5664
|
-
maxLength:
|
|
5665
|
-
minLength:
|
|
5679
|
+
var fieldSchema = z23.object({
|
|
5680
|
+
key: z23.string().max(200).describe("Field key, e.g. 'description', 'severity', 'status'"),
|
|
5681
|
+
label: z23.string().max(200).describe("Display label, e.g. 'Description', 'Severity'"),
|
|
5682
|
+
type: z23.string().max(50).describe("Field type: 'string', 'select', 'array', 'number', 'boolean'"),
|
|
5683
|
+
required: z23.boolean().optional().describe("Whether this field is required"),
|
|
5684
|
+
options: z23.array(z23.string().max(200)).max(200).optional().describe("Options for 'select' type fields"),
|
|
5685
|
+
searchable: z23.boolean().optional().describe("Whether this field is included in full-text search"),
|
|
5686
|
+
displayHint: z23.enum(["hero", "badge", "meta", "section", "hidden", "inline-meta"]).optional().describe("V2 rendering hint: how the field should be displayed in Cortex"),
|
|
5687
|
+
zone: z23.enum(["header", "body", "meta"]).optional().describe("V2 layout zone: where the field appears in the entry view"),
|
|
5688
|
+
colorMap: z23.record(z23.string().max(50)).optional().describe("V2 value-to-semantic-color mapping, e.g. { critical: 'danger', low: 'success' }"),
|
|
5689
|
+
accentSource: z23.boolean().optional().describe("When true, this field's colorMap value drives the card-level accent styling"),
|
|
5690
|
+
iconMap: z23.record(z23.string(), z23.string().max(50)).optional().describe("Maps field values to icons (emoji/symbol), prepended to badge text"),
|
|
5691
|
+
helpText: z23.string().max(2e3).optional().describe("Help text shown in admin field editors"),
|
|
5692
|
+
optionDescriptions: z23.record(z23.string().max(500)).optional().describe("Per-option guidance for select fields"),
|
|
5693
|
+
semanticRole: z23.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"),
|
|
5694
|
+
maxLength: z23.number().optional().describe("Maximum character length for field values. Three-tier resolution: explicit > displayHint > type fallback."),
|
|
5695
|
+
minLength: z23.number().optional().describe("Minimum character length for field values. Only explicit \u2014 no defaults.")
|
|
5666
5696
|
});
|
|
5667
|
-
var collectionsSchema =
|
|
5668
|
-
action:
|
|
5697
|
+
var collectionsSchema = z23.object({
|
|
5698
|
+
action: z23.enum(COLLECTIONS_ACTIONS).describe(
|
|
5669
5699
|
"'list': browse all collections. 'update': update an existing collection. 'describe': full documentation for one collection \u2014 fields, option guides, usage guidance, examples. 'audit': health report for all collections \u2014 missing classification, displayHint coverage, and field schema gaps. 'export': full system_collection_definitions export with classification metadata (thinkingLayer, classificationPriority, classificationCheck, classificationSignals, governanceRole, governanceFunction, timelineRole, canBeElementOf, descriptionFieldKey). Admin only. 'label-list'/'label-create'/'label-update'/'label-delete'/'label-apply'/'label-remove': manage workspace labels (absorbs the `labels` tool). Creating a new collection is not offered here \u2014 ask a platform admin to provision it, or enable the module ontology pack that owns the drawer."
|
|
5670
5700
|
),
|
|
5671
|
-
slug:
|
|
5672
|
-
name:
|
|
5673
|
-
description:
|
|
5674
|
-
purpose:
|
|
5675
|
-
icon:
|
|
5676
|
-
navGroup:
|
|
5677
|
-
fields:
|
|
5678
|
-
axis:
|
|
5679
|
-
stageLabelMap:
|
|
5680
|
-
defaultCanonicalKey:
|
|
5681
|
-
defaultWorkflowStatus:
|
|
5682
|
-
validWorkflowStatuses:
|
|
5701
|
+
slug: z23.string().max(200).optional().describe("URL-safe identifier for create/update, e.g. 'glossary', 'tech-debt'. For label-*: label slug."),
|
|
5702
|
+
name: z23.string().max(ENTRY_NAME_MAX_CHARS).optional().describe("For label-*: the label's name. For update: refused (the catalog's)."),
|
|
5703
|
+
description: z23.string().max(2e4).optional().describe("For label-*: what the label means (max 2,000 chars). For update: refused (the catalog's)."),
|
|
5704
|
+
purpose: z23.string().max(2e3).optional().describe("Why this collection exists \u2014 strategic reason"),
|
|
5705
|
+
icon: z23.string().max(50).optional().describe("For update: always refused \u2014 a collection's icon comes from the platform catalog."),
|
|
5706
|
+
navGroup: z23.enum(["daily", "strategic", "governance", "reference", "collections"]).optional().describe("Sidebar placement: 'daily', 'strategic', 'governance', 'reference', 'collections'"),
|
|
5707
|
+
fields: z23.array(fieldSchema).max(200).optional().describe("Field definitions for create, or replacement schema for update (replaces all fields)"),
|
|
5708
|
+
axis: z23.enum(["work", "none", "pending"]).optional().describe("REQUIRED for create: 'work' (needs stageLabelMap + validWorkflowStatuses), 'none', or 'pending'. For update: always refused \u2014 a collection's axis comes from the platform catalog."),
|
|
5709
|
+
stageLabelMap: z23.record(z23.string(), z23.enum(["open", "in_progress", "done", "stopped", "tag"])).optional().describe("Required when axis is 'work': maps each valid workflowStatus to a canonical stage."),
|
|
5710
|
+
defaultCanonicalKey: z23.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."),
|
|
5711
|
+
defaultWorkflowStatus: z23.string().max(200).optional().describe("Default workflowStatus for new entries. For update: always refused \u2014 the status words come from the platform catalog."),
|
|
5712
|
+
validWorkflowStatuses: z23.array(z23.string().max(200)).max(50).optional().describe("The allowed workflowStatus values for entries in this collection. For update: always refused \u2014 the status words come from the platform catalog."),
|
|
5683
5713
|
// ENT-65, FEAT-200
|
|
5684
|
-
classificationCheck:
|
|
5685
|
-
classificationPriority:
|
|
5686
|
-
qualityCriteria:
|
|
5687
|
-
statusList:
|
|
5714
|
+
classificationCheck: z23.string().max(500).optional().describe("LLM decision-tree check for this collection (3\u2013500 chars). Guides the classifier in routing entries here."),
|
|
5715
|
+
classificationPriority: z23.number().optional().describe("Classifier priority (1\u20139, lower = higher priority). Used with classificationCheck to order the decision tree."),
|
|
5716
|
+
qualityCriteria: z23.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."),
|
|
5717
|
+
statusList: z23.array(statusListEntrySchema).max(50).optional().describe("Ordered status vocabulary: {label, category, archiveDefault?}[]. For update: always refused \u2014 the status words come from the platform catalog."),
|
|
5688
5718
|
// For label-*
|
|
5689
|
-
color:
|
|
5690
|
-
parentSlug:
|
|
5691
|
-
isGroup:
|
|
5692
|
-
order:
|
|
5693
|
-
entryId:
|
|
5719
|
+
color: z23.string().max(50).optional().describe("For label-create/label-update: hex color, e.g. '#ef4444'."),
|
|
5720
|
+
parentSlug: z23.string().max(200).optional().describe("For label-create: parent group slug for label hierarchy."),
|
|
5721
|
+
isGroup: z23.boolean().optional().describe("For label-create/label-update: true if this is a group container, not a taggable label."),
|
|
5722
|
+
order: z23.number().optional().describe("For label-create/label-update: sort order within its group."),
|
|
5723
|
+
entryId: z23.string().max(200).optional().describe("For label-apply/label-remove: entry ID.")
|
|
5694
5724
|
});
|
|
5695
|
-
var collectionsListVariant =
|
|
5696
|
-
var collectionsDescribeVariant =
|
|
5697
|
-
var collectionsUpdateVariant =
|
|
5698
|
-
action:
|
|
5699
|
-
slug:
|
|
5700
|
-
name:
|
|
5701
|
-
description:
|
|
5702
|
-
purpose:
|
|
5703
|
-
icon:
|
|
5704
|
-
navGroup:
|
|
5705
|
-
fields:
|
|
5706
|
-
axis:
|
|
5707
|
-
stageLabelMap:
|
|
5725
|
+
var collectionsListVariant = z23.object({ action: z23.literal("list") });
|
|
5726
|
+
var collectionsDescribeVariant = z23.object({ action: z23.literal("describe"), slug: z23.string().max(200) });
|
|
5727
|
+
var collectionsUpdateVariant = z23.object({
|
|
5728
|
+
action: z23.literal("update"),
|
|
5729
|
+
slug: z23.string().max(200),
|
|
5730
|
+
name: z23.string().max(ENTRY_NAME_MAX_CHARS).optional(),
|
|
5731
|
+
description: z23.string().max(2e4).optional(),
|
|
5732
|
+
purpose: z23.string().max(2e3).optional(),
|
|
5733
|
+
icon: z23.string().max(50).optional(),
|
|
5734
|
+
navGroup: z23.enum(["daily", "strategic", "governance", "reference", "collections"]).optional(),
|
|
5735
|
+
fields: z23.array(fieldSchema).optional(),
|
|
5736
|
+
axis: z23.enum(["work", "none", "pending"]).optional(),
|
|
5737
|
+
stageLabelMap: z23.record(z23.string(), z23.enum(["open", "in_progress", "done", "stopped", "tag"])).optional(),
|
|
5708
5738
|
// WP-640 SWEEP (P1): axis/stageLabelMap repair legacy custom collections — see collections.ts's updateCollection.
|
|
5709
|
-
defaultCanonicalKey:
|
|
5710
|
-
defaultWorkflowStatus:
|
|
5711
|
-
validWorkflowStatuses:
|
|
5712
|
-
classificationCheck:
|
|
5713
|
-
classificationPriority:
|
|
5714
|
-
qualityCriteria:
|
|
5715
|
-
statusList:
|
|
5739
|
+
defaultCanonicalKey: z23.string().max(200).optional(),
|
|
5740
|
+
defaultWorkflowStatus: z23.string().max(200).optional(),
|
|
5741
|
+
validWorkflowStatuses: z23.array(z23.string().max(200)).optional(),
|
|
5742
|
+
classificationCheck: z23.string().max(500).optional(),
|
|
5743
|
+
classificationPriority: z23.number().optional(),
|
|
5744
|
+
qualityCriteria: z23.array(qualityCriterionSchema).optional(),
|
|
5745
|
+
statusList: z23.array(statusListEntrySchema).optional()
|
|
5716
5746
|
});
|
|
5717
|
-
var collectionsAuditVariant =
|
|
5718
|
-
var collectionsExportVariant =
|
|
5719
|
-
var collectionsLabelListVariant =
|
|
5720
|
-
var collectionsLabelCreateVariant =
|
|
5721
|
-
action:
|
|
5722
|
-
slug:
|
|
5723
|
-
name:
|
|
5724
|
-
color:
|
|
5725
|
-
description:
|
|
5726
|
-
parentSlug:
|
|
5727
|
-
isGroup:
|
|
5728
|
-
order:
|
|
5747
|
+
var collectionsAuditVariant = z23.object({ action: z23.literal("audit") });
|
|
5748
|
+
var collectionsExportVariant = z23.object({ action: z23.literal("export") });
|
|
5749
|
+
var collectionsLabelListVariant = z23.object({ action: z23.literal("label-list") });
|
|
5750
|
+
var collectionsLabelCreateVariant = z23.object({
|
|
5751
|
+
action: z23.literal("label-create"),
|
|
5752
|
+
slug: z23.string().max(200),
|
|
5753
|
+
name: z23.string().max(ENTRY_NAME_MAX_CHARS),
|
|
5754
|
+
color: z23.string().max(50).optional(),
|
|
5755
|
+
description: z23.string().max(LABEL_DESCRIPTION_MAX_CHARS).optional(),
|
|
5756
|
+
parentSlug: z23.string().max(200).optional(),
|
|
5757
|
+
isGroup: z23.boolean().optional(),
|
|
5758
|
+
order: z23.number().optional()
|
|
5729
5759
|
});
|
|
5730
|
-
var collectionsLabelUpdateVariant =
|
|
5731
|
-
action:
|
|
5732
|
-
slug:
|
|
5733
|
-
name:
|
|
5734
|
-
color:
|
|
5735
|
-
description:
|
|
5736
|
-
isGroup:
|
|
5737
|
-
order:
|
|
5760
|
+
var collectionsLabelUpdateVariant = z23.object({
|
|
5761
|
+
action: z23.literal("label-update"),
|
|
5762
|
+
slug: z23.string().max(200),
|
|
5763
|
+
name: z23.string().max(ENTRY_NAME_MAX_CHARS).optional(),
|
|
5764
|
+
color: z23.string().max(50).optional(),
|
|
5765
|
+
description: z23.string().max(LABEL_DESCRIPTION_MAX_CHARS).optional(),
|
|
5766
|
+
isGroup: z23.boolean().optional(),
|
|
5767
|
+
order: z23.number().optional()
|
|
5738
5768
|
});
|
|
5739
|
-
var collectionsLabelDeleteVariant =
|
|
5740
|
-
var collectionsLabelApplyVariant =
|
|
5741
|
-
var collectionsLabelRemoveVariant =
|
|
5742
|
-
var collectionsActionUnion =
|
|
5769
|
+
var collectionsLabelDeleteVariant = z23.object({ action: z23.literal("label-delete"), slug: z23.string().max(200) });
|
|
5770
|
+
var collectionsLabelApplyVariant = z23.object({ action: z23.literal("label-apply"), slug: z23.string().max(200), entryId: z23.string().max(200) });
|
|
5771
|
+
var collectionsLabelRemoveVariant = z23.object({ action: z23.literal("label-remove"), slug: z23.string().max(200), entryId: z23.string().max(200) });
|
|
5772
|
+
var collectionsActionUnion = z23.discriminatedUnion("action", [
|
|
5743
5773
|
collectionsListVariant,
|
|
5744
5774
|
collectionsDescribeVariant,
|
|
5745
5775
|
collectionsUpdateVariant,
|
|
@@ -6046,7 +6076,7 @@ async function handleExport() {
|
|
|
6046
6076
|
}
|
|
6047
6077
|
|
|
6048
6078
|
// src/tools/orient.ts
|
|
6049
|
-
import { z as
|
|
6079
|
+
import { z as z24 } from "zod/v3";
|
|
6050
6080
|
|
|
6051
6081
|
// src/tools/planned-work.ts
|
|
6052
6082
|
var MORE_DRAFTS_LINE = "_More drafts exist than shown. `context action=list status=draft` lists more, but that list is capped as well; page with limit/cursor once context list supports it._";
|
|
@@ -6946,25 +6976,25 @@ async function markOrientedWithSnapshotFallback(agentSessionId, coherenceSnapsho
|
|
|
6946
6976
|
}
|
|
6947
6977
|
}
|
|
6948
6978
|
var ORIENT_ACTIONS = ["task"];
|
|
6949
|
-
var orientSchema =
|
|
6950
|
-
action:
|
|
6979
|
+
var orientSchema = z24.object({
|
|
6980
|
+
action: z24.enum(ORIENT_ACTIONS).optional().default("task").describe(
|
|
6951
6981
|
"'task': task-grounded context loader, the only action."
|
|
6952
6982
|
),
|
|
6953
|
-
mode:
|
|
6954
|
-
tier:
|
|
6983
|
+
mode: z24.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."),
|
|
6984
|
+
tier: z24.enum(["summary", "standard", "full"]).optional().describe(
|
|
6955
6985
|
"For 'task': payload depth. Defaults to standard (~256 KB), with or without a task. Pass summary, standard, or full to override."
|
|
6956
6986
|
),
|
|
6957
|
-
task:
|
|
6987
|
+
task: z24.string().max(2e3).optional().describe(
|
|
6958
6988
|
"For 'task': natural-language task description for task-scoped context. When provided, orient returns scored, relevant entries for the task."
|
|
6959
6989
|
),
|
|
6960
6990
|
// D1d (WP-754/TASK-204): matches the server's StartupResolutionSignals shape; domain resolution (original purpose) is deleted, sole survivor is `context.served` telemetry.
|
|
6961
|
-
startupSignals:
|
|
6962
|
-
changedPaths:
|
|
6963
|
-
reviewedArtifactRefs:
|
|
6964
|
-
branchName:
|
|
6965
|
-
worktreeName:
|
|
6991
|
+
startupSignals: z24.object({
|
|
6992
|
+
changedPaths: z24.array(z24.string()).max(25).optional().describe("Paths changed in the current working tree, if known (e.g. from a prior git status/diff tool call)."),
|
|
6993
|
+
reviewedArtifactRefs: z24.array(z24.string()).max(25).optional().describe("Chain entry IDs the caller has already reviewed this session, if tracked."),
|
|
6994
|
+
branchName: z24.string().max(120).optional().describe("Current git branch name, if known."),
|
|
6995
|
+
worktreeName: z24.string().max(120).optional().describe("Current worktree/directory name, if known.")
|
|
6966
6996
|
}).optional().describe("For 'task': best-effort startup signals \u2014 changedPaths/reviewedArtifactRefs/branchName/worktreeName. All optional; omit fields you don't know."),
|
|
6967
|
-
invocationPath:
|
|
6997
|
+
invocationPath: z24.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.")
|
|
6968
6998
|
});
|
|
6969
6999
|
function taskGroundingWarningLines(task, hasTaskGrounding = false) {
|
|
6970
7000
|
if (hasTaskGrounding) return [];
|
|
@@ -7616,7 +7646,7 @@ async function _handleOrient({ mode: mode2 = "full", tier, task, startupSignals,
|
|
|
7616
7646
|
}
|
|
7617
7647
|
|
|
7618
7648
|
// src/tools/workflows.ts
|
|
7619
|
-
import { z as
|
|
7649
|
+
import { z as z25 } from "zod/v3";
|
|
7620
7650
|
|
|
7621
7651
|
// src/lib/resolveCollection.ts
|
|
7622
7652
|
async function resolveCollection(params) {
|
|
@@ -8475,73 +8505,73 @@ function workflowRunOutputToText(output) {
|
|
|
8475
8505
|
|
|
8476
8506
|
// src/tools/workflows.ts
|
|
8477
8507
|
var WORKFLOWS_ACTIONS = ["list", "start", "checkpoint", "get-run"];
|
|
8478
|
-
var jsonValueSchema =
|
|
8479
|
-
() =>
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8508
|
+
var jsonValueSchema = z25.lazy(
|
|
8509
|
+
() => z25.union([
|
|
8510
|
+
z25.string(),
|
|
8511
|
+
z25.number(),
|
|
8512
|
+
z25.boolean(),
|
|
8513
|
+
z25.null(),
|
|
8514
|
+
z25.array(jsonValueSchema),
|
|
8515
|
+
z25.record(jsonValueSchema)
|
|
8486
8516
|
])
|
|
8487
8517
|
);
|
|
8488
|
-
var workflowRunOutputInputSchema =
|
|
8489
|
-
|
|
8490
|
-
format:
|
|
8491
|
-
value:
|
|
8518
|
+
var workflowRunOutputInputSchema = z25.union([
|
|
8519
|
+
z25.object({
|
|
8520
|
+
format: z25.literal("freetext"),
|
|
8521
|
+
value: z25.string()
|
|
8492
8522
|
}),
|
|
8493
|
-
|
|
8494
|
-
format:
|
|
8495
|
-
value:
|
|
8523
|
+
z25.object({
|
|
8524
|
+
format: z25.literal("list"),
|
|
8525
|
+
value: z25.array(z25.string())
|
|
8496
8526
|
}),
|
|
8497
|
-
|
|
8498
|
-
format:
|
|
8499
|
-
value:
|
|
8527
|
+
z25.object({
|
|
8528
|
+
format: z25.literal("choice"),
|
|
8529
|
+
value: z25.union([z25.string(), z25.array(z25.string())])
|
|
8500
8530
|
}),
|
|
8501
|
-
|
|
8502
|
-
format:
|
|
8531
|
+
z25.object({
|
|
8532
|
+
format: z25.literal("structured"),
|
|
8503
8533
|
value: jsonValueSchema
|
|
8504
8534
|
})
|
|
8505
8535
|
]);
|
|
8506
|
-
var workflowsSchema =
|
|
8507
|
-
action:
|
|
8536
|
+
var workflowsSchema = z25.object({
|
|
8537
|
+
action: z25.enum(WORKFLOWS_ACTIONS).describe(
|
|
8508
8538
|
"'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."
|
|
8509
8539
|
),
|
|
8510
|
-
workflowId:
|
|
8511
|
-
runId:
|
|
8512
|
-
roundId:
|
|
8513
|
-
output:
|
|
8514
|
-
isFinal:
|
|
8515
|
-
restart:
|
|
8516
|
-
summaryName:
|
|
8517
|
-
summaryDescription:
|
|
8518
|
-
summaryEntryId:
|
|
8540
|
+
workflowId: z25.string().max(200).optional().describe("Workflow ID for start, checkpoint, or get-run, e.g. 'retro', 'implementation-review'"),
|
|
8541
|
+
runId: z25.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)."),
|
|
8542
|
+
roundId: z25.string().max(200).optional().describe("Round ID for checkpoint, e.g. 'what-went-well'"),
|
|
8543
|
+
output: z25.union([z25.string(), workflowRunOutputInputSchema]).optional().describe("The round's output \u2014 either legacy synthesized text or a typed workflow run payload."),
|
|
8544
|
+
isFinal: z25.boolean().optional().describe("If true, finalize an existing durable workflow run from its terminal round and create the summary chain entry."),
|
|
8545
|
+
restart: z25.boolean().optional().describe("If true, start a new durable run from the workflow's first round in the current session."),
|
|
8546
|
+
summaryName: z25.string().max(ENTRY_NAME_MAX_CHARS).optional().describe("Optional name for final chain entry. If omitted, the workflow summary template is used."),
|
|
8547
|
+
summaryDescription: z25.string().max(ENTRY_BODY_MAX_CHARS).optional().describe("Optional override for the final chain entry description. Defaults to the final round output text."),
|
|
8548
|
+
summaryEntryId: z25.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."),
|
|
8519
8549
|
// WP-513: team+role to create the finalize summary AS OWNER of (rung 2 only).
|
|
8520
|
-
ownerTeamEntryId:
|
|
8521
|
-
ownerRoleEntryId:
|
|
8550
|
+
ownerTeamEntryId: z25.string().max(200).optional().describe("For 'checkpoint' (isFinal): owning team (rung-2)."),
|
|
8551
|
+
ownerRoleEntryId: z25.string().max(200).optional().describe("For 'checkpoint' (isFinal): owning role (rung-2).")
|
|
8522
8552
|
});
|
|
8523
|
-
var workflowsListVariant =
|
|
8524
|
-
var workflowsGetRunVariant =
|
|
8525
|
-
action:
|
|
8526
|
-
runId:
|
|
8527
|
-
workflowId:
|
|
8553
|
+
var workflowsListVariant = z25.object({ action: z25.literal("list") });
|
|
8554
|
+
var workflowsGetRunVariant = z25.object({
|
|
8555
|
+
action: z25.literal("get-run"),
|
|
8556
|
+
runId: z25.string().max(200).optional(),
|
|
8557
|
+
workflowId: z25.string().max(200).optional()
|
|
8528
8558
|
});
|
|
8529
|
-
var workflowsStartVariant =
|
|
8530
|
-
var workflowsCheckpointVariant =
|
|
8531
|
-
action:
|
|
8532
|
-
workflowId:
|
|
8533
|
-
roundId:
|
|
8534
|
-
output:
|
|
8535
|
-
isFinal:
|
|
8536
|
-
restart:
|
|
8537
|
-
summaryName:
|
|
8538
|
-
summaryDescription:
|
|
8539
|
-
summaryEntryId:
|
|
8540
|
-
runId:
|
|
8541
|
-
ownerTeamEntryId:
|
|
8542
|
-
ownerRoleEntryId:
|
|
8559
|
+
var workflowsStartVariant = z25.object({ action: z25.literal("start"), workflowId: z25.string().max(200) });
|
|
8560
|
+
var workflowsCheckpointVariant = z25.object({
|
|
8561
|
+
action: z25.literal("checkpoint"),
|
|
8562
|
+
workflowId: z25.string().max(200),
|
|
8563
|
+
roundId: z25.string().max(200),
|
|
8564
|
+
output: z25.union([z25.string(), workflowRunOutputInputSchema]),
|
|
8565
|
+
isFinal: z25.boolean().optional(),
|
|
8566
|
+
restart: z25.boolean().optional(),
|
|
8567
|
+
summaryName: z25.string().max(ENTRY_NAME_MAX_CHARS).optional(),
|
|
8568
|
+
summaryDescription: z25.string().max(ENTRY_BODY_MAX_CHARS).optional(),
|
|
8569
|
+
summaryEntryId: z25.string().max(200).optional(),
|
|
8570
|
+
runId: z25.string().max(200).optional(),
|
|
8571
|
+
ownerTeamEntryId: z25.string().max(200).optional(),
|
|
8572
|
+
ownerRoleEntryId: z25.string().max(200).optional()
|
|
8543
8573
|
});
|
|
8544
|
-
var workflowsActionUnion =
|
|
8574
|
+
var workflowsActionUnion = z25.discriminatedUnion("action", [
|
|
8545
8575
|
workflowsListVariant,
|
|
8546
8576
|
workflowsGetRunVariant,
|
|
8547
8577
|
workflowsStartVariant,
|
|
@@ -9270,7 +9300,7 @@ function parseListOutput(output) {
|
|
|
9270
9300
|
}
|
|
9271
9301
|
|
|
9272
9302
|
// src/tools/quality.ts
|
|
9273
|
-
import { z as
|
|
9303
|
+
import { z as z26 } from "zod/v3";
|
|
9274
9304
|
|
|
9275
9305
|
// src/lib/spineVerdictRead.ts
|
|
9276
9306
|
function isRecord(value) {
|
|
@@ -9437,36 +9467,36 @@ async function handleSpineCheck(story, refresh = false) {
|
|
|
9437
9467
|
|
|
9438
9468
|
// src/tools/quality.ts
|
|
9439
9469
|
var QUALITY_ACTIONS = ["check", "re-evaluate", "verify-chain", "spine-check"];
|
|
9440
|
-
var qualitySchema =
|
|
9441
|
-
action:
|
|
9470
|
+
var qualitySchema = z26.object({
|
|
9471
|
+
action: z26.enum(QUALITY_ACTIONS).describe(
|
|
9442
9472
|
"'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`. 'spine-check': structural completeness of the purpose+vision+strategy spine \u2014 story:true also runs the on-demand one-story judgment."
|
|
9443
9473
|
),
|
|
9444
|
-
entryId:
|
|
9445
|
-
context:
|
|
9446
|
-
collection:
|
|
9447
|
-
mode:
|
|
9448
|
-
story:
|
|
9449
|
-
refresh:
|
|
9474
|
+
entryId: z26.string().max(200).optional().describe("For 'check'/'re-evaluate': entry ID, e.g. 'TEN-graph-db', '<PREFIX>-<n>'."),
|
|
9475
|
+
context: z26.enum(["capture", "commit", "review"]).default("review").optional().describe("For re-evaluate: evaluation context"),
|
|
9476
|
+
collection: z26.string().max(200).optional().describe("For 'verify-chain': collection slug to verify (default: glossary)."),
|
|
9477
|
+
mode: z26.enum(["report", "fix"]).optional().describe("For 'verify-chain': 'report' = read-only trust report (default). 'fix' = also update drifted codeMapping statuses."),
|
|
9478
|
+
story: z26.boolean().optional().describe("For 'spine-check': also run the on-demand one-story LLM judgment (never scheduled; result labelled [unvalidated])."),
|
|
9479
|
+
refresh: z26.boolean().optional().describe(
|
|
9450
9480
|
"For 'spine-check': force a new run even if a fresh verdict already exists. Default false \u2014 a plain call NEVER re-triggers work just to read the last result; it auto-schedules only when no run is already in flight AND the stored verdict is absent/stale/missing the requested story pass."
|
|
9451
9481
|
)
|
|
9452
9482
|
});
|
|
9453
|
-
var qualityCheckVariant =
|
|
9454
|
-
var qualityReEvaluateVariant =
|
|
9455
|
-
action:
|
|
9456
|
-
entryId:
|
|
9457
|
-
context:
|
|
9483
|
+
var qualityCheckVariant = z26.object({ action: z26.literal("check"), entryId: z26.string().max(200) });
|
|
9484
|
+
var qualityReEvaluateVariant = z26.object({
|
|
9485
|
+
action: z26.literal("re-evaluate"),
|
|
9486
|
+
entryId: z26.string().max(200),
|
|
9487
|
+
context: z26.enum(["capture", "commit", "review"]).optional().default("review")
|
|
9458
9488
|
});
|
|
9459
|
-
var qualityVerifyChainVariant =
|
|
9460
|
-
action:
|
|
9461
|
-
collection:
|
|
9462
|
-
mode:
|
|
9489
|
+
var qualityVerifyChainVariant = z26.object({
|
|
9490
|
+
action: z26.literal("verify-chain"),
|
|
9491
|
+
collection: z26.string().max(200).optional().default("glossary"),
|
|
9492
|
+
mode: z26.enum(["report", "fix"]).optional().default("report")
|
|
9463
9493
|
});
|
|
9464
|
-
var qualitySpineCheckVariant =
|
|
9465
|
-
action:
|
|
9466
|
-
story:
|
|
9467
|
-
refresh:
|
|
9494
|
+
var qualitySpineCheckVariant = z26.object({
|
|
9495
|
+
action: z26.literal("spine-check"),
|
|
9496
|
+
story: z26.boolean().optional().default(false),
|
|
9497
|
+
refresh: z26.boolean().optional().default(false)
|
|
9468
9498
|
});
|
|
9469
|
-
var qualityActionUnion =
|
|
9499
|
+
var qualityActionUnion = z26.discriminatedUnion("action", [
|
|
9470
9500
|
qualityCheckVariant,
|
|
9471
9501
|
qualityReEvaluateVariant,
|
|
9472
9502
|
qualityVerifyChainVariant,
|
|
@@ -9478,43 +9508,43 @@ var QUALITY_ACTION_SPECS = {
|
|
|
9478
9508
|
"verify-chain": { params: ["collection", "mode"], description: "All params optional; collection defaults to 'glossary'." },
|
|
9479
9509
|
"spine-check": { params: ["story", "refresh"], description: "All params optional; story and refresh default to false \u2014 a plain call never re-triggers work, it just reads back the latest verdict (auto-refreshing only when stale/absent)." }
|
|
9480
9510
|
};
|
|
9481
|
-
var qualityCheckOutputSchema =
|
|
9482
|
-
entryId:
|
|
9511
|
+
var qualityCheckOutputSchema = z26.object({
|
|
9512
|
+
entryId: z26.string(),
|
|
9483
9513
|
/** WP-480 S1: false = the ID does not resolve to an entry (typo/deleted) — distinct from "no verdict yet". */
|
|
9484
|
-
entryFound:
|
|
9485
|
-
hasVerdict:
|
|
9514
|
+
entryFound: z26.boolean().optional(),
|
|
9515
|
+
hasVerdict: z26.boolean(),
|
|
9486
9516
|
/** WP-480 S1: the verdict was judged against content the entry no longer has — re-evaluate for a current one. */
|
|
9487
|
-
stale:
|
|
9488
|
-
tier:
|
|
9489
|
-
passed:
|
|
9490
|
-
criteria:
|
|
9491
|
-
id:
|
|
9492
|
-
passed:
|
|
9493
|
-
hint:
|
|
9517
|
+
stale: z26.boolean().optional(),
|
|
9518
|
+
tier: z26.string().optional(),
|
|
9519
|
+
passed: z26.boolean().optional(),
|
|
9520
|
+
criteria: z26.array(z26.object({
|
|
9521
|
+
id: z26.string(),
|
|
9522
|
+
passed: z26.boolean(),
|
|
9523
|
+
hint: z26.string().optional()
|
|
9494
9524
|
}))
|
|
9495
9525
|
});
|
|
9496
|
-
var qualityReevaluateOutputSchema =
|
|
9497
|
-
entryId:
|
|
9498
|
-
context:
|
|
9499
|
-
score:
|
|
9500
|
-
maxScore:
|
|
9501
|
-
improved:
|
|
9526
|
+
var qualityReevaluateOutputSchema = z26.object({
|
|
9527
|
+
entryId: z26.string(),
|
|
9528
|
+
context: z26.string(),
|
|
9529
|
+
score: z26.number(),
|
|
9530
|
+
maxScore: z26.number(),
|
|
9531
|
+
improved: z26.boolean()
|
|
9502
9532
|
});
|
|
9503
|
-
var qualitySpineCheckOutputSchema =
|
|
9504
|
-
hasVerdict:
|
|
9505
|
-
noSpineEntries:
|
|
9506
|
-
structuralPassed:
|
|
9507
|
-
storyPassed:
|
|
9508
|
-
stale:
|
|
9533
|
+
var qualitySpineCheckOutputSchema = z26.object({
|
|
9534
|
+
hasVerdict: z26.boolean(),
|
|
9535
|
+
noSpineEntries: z26.boolean().optional(),
|
|
9536
|
+
structuralPassed: z26.boolean().optional(),
|
|
9537
|
+
storyPassed: z26.boolean().nullable().optional(),
|
|
9538
|
+
stale: z26.boolean().optional(),
|
|
9509
9539
|
// TASK-156: a capped membership scan must stay distinguishable from a complete one, and a
|
|
9510
9540
|
// malformed verdict needs its own discriminator — both were silently stripped before this.
|
|
9511
|
-
staleMemberIds:
|
|
9512
|
-
membershipTruncated:
|
|
9541
|
+
staleMemberIds: z26.array(z26.string()).optional(),
|
|
9542
|
+
membershipTruncated: z26.boolean().optional(),
|
|
9513
9543
|
// PRRT_kwDORS4ils6i_PVS: a KNOWN relations-fingerprint mismatch, distinct from "unknown" —
|
|
9514
9544
|
// without this, a detected topology change and an unverifiable legacy fingerprint were
|
|
9515
9545
|
// indistinguishable in structured output.
|
|
9516
|
-
relationsChanged:
|
|
9517
|
-
malformed:
|
|
9546
|
+
relationsChanged: z26.boolean().optional(),
|
|
9547
|
+
malformed: z26.boolean().optional()
|
|
9518
9548
|
});
|
|
9519
9549
|
function registerQualityTools(server) {
|
|
9520
9550
|
const qualityHandlers = {
|
|
@@ -9641,7 +9671,7 @@ async function handleReEvaluate(entryId, context) {
|
|
|
9641
9671
|
}
|
|
9642
9672
|
|
|
9643
9673
|
// src/tools/session.ts
|
|
9644
|
-
import { z as
|
|
9674
|
+
import { z as z28 } from "zod/v3";
|
|
9645
9675
|
|
|
9646
9676
|
// src/lib/compose-wrapup-view.ts
|
|
9647
9677
|
function toComposed(e) {
|
|
@@ -9899,9 +9929,9 @@ ${text}` : text;
|
|
|
9899
9929
|
}
|
|
9900
9930
|
|
|
9901
9931
|
// src/tools/facilitate.ts
|
|
9902
|
-
import { z as
|
|
9903
|
-
var facilitateSchema =
|
|
9904
|
-
betEntryId:
|
|
9932
|
+
import { z as z27 } from "zod/v3";
|
|
9933
|
+
var facilitateSchema = z27.object({
|
|
9934
|
+
betEntryId: z27.string().max(200).optional().describe("Work package entry ID. Required.")
|
|
9905
9935
|
});
|
|
9906
9936
|
function buildCortexUrl(workspaceSlug, entryId) {
|
|
9907
9937
|
return `${appUrl()}/w/${workspaceSlug}/chain?entry=${encodeURIComponent(entryId)}&railTab=context`;
|
|
@@ -10040,33 +10070,33 @@ var SESSION_MOVED = {
|
|
|
10040
10070
|
"commit-constellation": "commit-constellation was removed. Next: session action=wrapup-review, then entries action=accept entryId=... for each draft."
|
|
10041
10071
|
};
|
|
10042
10072
|
var TEAM_PARAM_DESCRIPTION = "For 'start': the team the role is held in, by its 'TEAM-<n>' id \u2014 only needed with role, when you hold that role in more than one team; a refusal that names the way in prints it.";
|
|
10043
|
-
var sessionSchema =
|
|
10073
|
+
var sessionSchema = z28.object({
|
|
10044
10074
|
action: actionEnum(SESSION_ACTIONS, SESSION_MOVED).describe(
|
|
10045
10075
|
"'start': begin a tracked session. 'close': end the session and record activity. 'status': check current session state. 'wrapup-review': list this session's drafts before closing. 'resume': load session state from an existing work package entry."
|
|
10046
10076
|
),
|
|
10047
|
-
betEntryId:
|
|
10077
|
+
betEntryId: z28.string().max(200).optional().describe("For 'resume': work package entry ID. Required."),
|
|
10048
10078
|
// DEC-1715 (WP-753 O1a)
|
|
10049
|
-
role:
|
|
10079
|
+
role: z28.string().max(200).optional().describe(
|
|
10050
10080
|
"For 'start': role to act as this session, by the '<PREFIX>-<n>' id a start reply prints beside the role name \u2014 only needed if you hold more than one; the error lists your roles if omitted."
|
|
10051
10081
|
),
|
|
10052
|
-
team:
|
|
10082
|
+
team: z28.string().max(200).optional().describe(TEAM_PARAM_DESCRIPTION)
|
|
10053
10083
|
// TASK-801
|
|
10054
10084
|
});
|
|
10055
|
-
var sessionStartVariant =
|
|
10056
|
-
action:
|
|
10085
|
+
var sessionStartVariant = z28.object({
|
|
10086
|
+
action: z28.literal("start"),
|
|
10057
10087
|
// DEC-1715 (WP-753 O1a): the role to act as this session — only needed when the person holds
|
|
10058
10088
|
// more than one role; the server refuses and lists the choices when it's required and omitted.
|
|
10059
|
-
role:
|
|
10089
|
+
role: z28.string().max(200).optional().describe(
|
|
10060
10090
|
"Role to act as this session, by the '<PREFIX>-<n>' id a start reply prints beside the role name \u2014 only needed if you hold more than one; the error lists your roles if omitted."
|
|
10061
10091
|
),
|
|
10062
|
-
team:
|
|
10092
|
+
team: z28.string().max(200).optional().describe(TEAM_PARAM_DESCRIPTION)
|
|
10063
10093
|
// TASK-801
|
|
10064
10094
|
});
|
|
10065
|
-
var sessionCloseVariant =
|
|
10066
|
-
var sessionStatusVariant =
|
|
10067
|
-
var sessionWrapupReviewVariant =
|
|
10068
|
-
var sessionResumeVariant = facilitateSchema.extend({ action:
|
|
10069
|
-
var sessionActionUnion =
|
|
10095
|
+
var sessionCloseVariant = z28.object({ action: z28.literal("close") });
|
|
10096
|
+
var sessionStatusVariant = z28.object({ action: z28.literal("status") });
|
|
10097
|
+
var sessionWrapupReviewVariant = z28.object({ action: z28.literal("wrapup-review") });
|
|
10098
|
+
var sessionResumeVariant = facilitateSchema.extend({ action: z28.literal("resume") });
|
|
10099
|
+
var sessionActionUnion = z28.discriminatedUnion("action", [
|
|
10070
10100
|
sessionStartVariant,
|
|
10071
10101
|
sessionCloseVariant,
|
|
10072
10102
|
sessionStatusVariant,
|
|
@@ -10314,10 +10344,10 @@ async function handleStatus() {
|
|
|
10314
10344
|
}
|
|
10315
10345
|
|
|
10316
10346
|
// src/tools/workspace.ts
|
|
10317
|
-
import { z as
|
|
10347
|
+
import { z as z31 } from "zod/v3";
|
|
10318
10348
|
|
|
10319
10349
|
// src/tools/health.ts
|
|
10320
|
-
import { z as
|
|
10350
|
+
import { z as z29 } from "zod/v3";
|
|
10321
10351
|
|
|
10322
10352
|
// src/lib/auditView.ts
|
|
10323
10353
|
async function buildTenantAuditView(limit) {
|
|
@@ -10662,60 +10692,60 @@ ${logLines.join("\n")}${seamSummaryText}` }],
|
|
|
10662
10692
|
};
|
|
10663
10693
|
}
|
|
10664
10694
|
var HEALTH_ACTIONS = ["check", "whoami", "status", "audit", "self-test"];
|
|
10665
|
-
var healthSchema =
|
|
10666
|
-
action:
|
|
10695
|
+
var healthSchema = z29.object({
|
|
10696
|
+
action: z29.enum(HEALTH_ACTIONS).describe(
|
|
10667
10697
|
"'check': connectivity and workspace stats. 'whoami': session identity. 'status': workspace readiness. 'audit': session audit log. 'self-test': validate all tool schemas."
|
|
10668
10698
|
),
|
|
10669
|
-
limit:
|
|
10699
|
+
limit: z29.number().min(1).max(50).default(20).optional().describe("For audit: how many recent calls to show (max 50)")
|
|
10670
10700
|
});
|
|
10671
|
-
var healthCheckOutputSchema =
|
|
10672
|
-
healthy:
|
|
10673
|
-
collections:
|
|
10674
|
-
entries:
|
|
10675
|
-
latencyMs:
|
|
10676
|
-
workspace:
|
|
10701
|
+
var healthCheckOutputSchema = z29.object({
|
|
10702
|
+
healthy: z29.boolean(),
|
|
10703
|
+
collections: z29.number(),
|
|
10704
|
+
entries: z29.number(),
|
|
10705
|
+
latencyMs: z29.number(),
|
|
10706
|
+
workspace: z29.string()
|
|
10677
10707
|
});
|
|
10678
|
-
var organisationHealthSchema =
|
|
10679
|
-
reviewed:
|
|
10680
|
-
agreements:
|
|
10681
|
-
disagreements:
|
|
10682
|
-
abstentions:
|
|
10683
|
-
agreementRate:
|
|
10684
|
-
flags:
|
|
10708
|
+
var organisationHealthSchema = z29.object({
|
|
10709
|
+
reviewed: z29.number(),
|
|
10710
|
+
agreements: z29.number(),
|
|
10711
|
+
disagreements: z29.number(),
|
|
10712
|
+
abstentions: z29.number(),
|
|
10713
|
+
agreementRate: z29.number(),
|
|
10714
|
+
flags: z29.array(z29.object({ collection: z29.string(), count: z29.number(), suggestedCollection: z29.string() }))
|
|
10685
10715
|
});
|
|
10686
|
-
var healthStatusOutputSchema =
|
|
10687
|
-
sampleTruncated:
|
|
10688
|
-
activeEntries:
|
|
10689
|
-
totalRelations:
|
|
10690
|
-
orphanedEntries:
|
|
10691
|
-
checks:
|
|
10692
|
-
gaps:
|
|
10716
|
+
var healthStatusOutputSchema = z29.object({
|
|
10717
|
+
sampleTruncated: z29.boolean().nullable().optional(),
|
|
10718
|
+
activeEntries: z29.number(),
|
|
10719
|
+
totalRelations: z29.number(),
|
|
10720
|
+
orphanedEntries: z29.number(),
|
|
10721
|
+
checks: z29.array(z29.object({ label: z29.string(), passed: z29.boolean(), current: z29.number(), required: z29.number() })),
|
|
10722
|
+
gaps: z29.array(z29.object({ id: z29.string(), label: z29.string(), guidance: z29.string() })),
|
|
10693
10723
|
organisationHealth: organisationHealthSchema.optional()
|
|
10694
10724
|
});
|
|
10695
|
-
var healthAuditOutputSchema =
|
|
10696
|
-
totalCalls:
|
|
10697
|
-
calls:
|
|
10698
|
-
tool:
|
|
10699
|
-
action:
|
|
10700
|
-
timestamp:
|
|
10701
|
-
durationMs:
|
|
10725
|
+
var healthAuditOutputSchema = z29.object({
|
|
10726
|
+
totalCalls: z29.number(),
|
|
10727
|
+
calls: z29.array(z29.object({
|
|
10728
|
+
tool: z29.string(),
|
|
10729
|
+
action: z29.string().optional(),
|
|
10730
|
+
timestamp: z29.string(),
|
|
10731
|
+
durationMs: z29.number().optional()
|
|
10702
10732
|
}))
|
|
10703
10733
|
});
|
|
10704
|
-
var healthWhoamiOutputSchema =
|
|
10705
|
-
workspaceId:
|
|
10706
|
-
workspaceName:
|
|
10707
|
-
scope:
|
|
10708
|
-
sessionId:
|
|
10709
|
-
oriented:
|
|
10734
|
+
var healthWhoamiOutputSchema = z29.object({
|
|
10735
|
+
workspaceId: z29.string(),
|
|
10736
|
+
workspaceName: z29.string(),
|
|
10737
|
+
scope: z29.string(),
|
|
10738
|
+
sessionId: z29.union([z29.string(), z29.null()]),
|
|
10739
|
+
oriented: z29.boolean()
|
|
10710
10740
|
});
|
|
10711
|
-
var selfTestOutputSchema =
|
|
10712
|
-
passed:
|
|
10713
|
-
failed:
|
|
10714
|
-
total:
|
|
10715
|
-
results:
|
|
10716
|
-
tool:
|
|
10717
|
-
valid:
|
|
10718
|
-
error:
|
|
10741
|
+
var selfTestOutputSchema = z29.object({
|
|
10742
|
+
passed: z29.number(),
|
|
10743
|
+
failed: z29.number(),
|
|
10744
|
+
total: z29.number(),
|
|
10745
|
+
results: z29.array(z29.object({
|
|
10746
|
+
tool: z29.string(),
|
|
10747
|
+
valid: z29.boolean(),
|
|
10748
|
+
error: z29.string().optional()
|
|
10719
10749
|
}))
|
|
10720
10750
|
});
|
|
10721
10751
|
function handleSelfTest(server) {
|
|
@@ -10766,9 +10796,9 @@ function handleSelfTest(server) {
|
|
|
10766
10796
|
}
|
|
10767
10797
|
|
|
10768
10798
|
// src/tools/usage.ts
|
|
10769
|
-
import { z as
|
|
10770
|
-
var usageSummarySchema =
|
|
10771
|
-
periodDays:
|
|
10799
|
+
import { z as z30 } from "zod/v3";
|
|
10800
|
+
var usageSummarySchema = z30.object({
|
|
10801
|
+
periodDays: z30.number().min(1).max(90).optional().describe("Number of days to look back (default 30, max 90)")
|
|
10772
10802
|
});
|
|
10773
10803
|
async function handleUsageSummary(periodDays) {
|
|
10774
10804
|
const ws = await getWorkspaceContext();
|
|
@@ -10841,20 +10871,20 @@ var WORKSPACE_ACTIONS = [
|
|
|
10841
10871
|
"self-test",
|
|
10842
10872
|
"usage"
|
|
10843
10873
|
];
|
|
10844
|
-
var workspaceSchema =
|
|
10845
|
-
action:
|
|
10874
|
+
var workspaceSchema = z31.object({
|
|
10875
|
+
action: z31.enum(WORKSPACE_ACTIONS).describe(
|
|
10846
10876
|
"'check': connectivity and workspace stats. 'whoami': session identity. 'status': workspace readiness. 'audit': session audit log. 'self-test': validate all tool schemas. 'usage': LLM usage and cost summary."
|
|
10847
10877
|
),
|
|
10848
|
-
limit:
|
|
10849
|
-
periodDays:
|
|
10878
|
+
limit: z31.number().min(1).max(50).optional().describe("For 'audit': how many recent calls to show (max 50, default 20)."),
|
|
10879
|
+
periodDays: z31.number().min(1).max(90).optional().describe("For 'usage': number of days to look back (default 30, max 90).")
|
|
10850
10880
|
});
|
|
10851
|
-
var workspaceCheckVariant =
|
|
10852
|
-
var workspaceWhoamiVariant =
|
|
10853
|
-
var workspaceStatusVariant =
|
|
10854
|
-
var workspaceAuditVariant =
|
|
10855
|
-
var workspaceSelfTestVariant =
|
|
10856
|
-
var workspaceUsageVariant =
|
|
10857
|
-
var workspaceActionUnion =
|
|
10881
|
+
var workspaceCheckVariant = z31.object({ action: z31.literal("check") });
|
|
10882
|
+
var workspaceWhoamiVariant = z31.object({ action: z31.literal("whoami") });
|
|
10883
|
+
var workspaceStatusVariant = z31.object({ action: z31.literal("status") });
|
|
10884
|
+
var workspaceAuditVariant = z31.object({ action: z31.literal("audit"), limit: z31.number().min(1).max(50).optional().default(20) });
|
|
10885
|
+
var workspaceSelfTestVariant = z31.object({ action: z31.literal("self-test") });
|
|
10886
|
+
var workspaceUsageVariant = z31.object({ action: z31.literal("usage"), periodDays: z31.number().min(1).max(90).optional() });
|
|
10887
|
+
var workspaceActionUnion = z31.discriminatedUnion("action", [
|
|
10858
10888
|
workspaceCheckVariant,
|
|
10859
10889
|
workspaceWhoamiVariant,
|
|
10860
10890
|
workspaceStatusVariant,
|
|
@@ -10900,7 +10930,7 @@ function registerWorkspaceTools(server) {
|
|
|
10900
10930
|
}
|
|
10901
10931
|
|
|
10902
10932
|
// src/tools/feedback.ts
|
|
10903
|
-
import { z as
|
|
10933
|
+
import { z as z32 } from "zod/v3";
|
|
10904
10934
|
|
|
10905
10935
|
// src/lib/productFeedbackConstants.ts
|
|
10906
10936
|
var PRODUCT_FEEDBACK_CATEGORIES = ["bug", "friction", "idea", "praise", "other"];
|
|
@@ -10913,41 +10943,41 @@ var MAX_FEEDBACK_ANSWER_LENGTH = 240;
|
|
|
10913
10943
|
|
|
10914
10944
|
// src/tools/feedback.ts
|
|
10915
10945
|
var actions = ["submit", "list", "queue", "note", "group", "status"];
|
|
10916
|
-
var category =
|
|
10917
|
-
var status =
|
|
10918
|
-
var vendorStatus =
|
|
10919
|
-
var tensionId =
|
|
10920
|
-
var answer =
|
|
10946
|
+
var category = z32.enum(PRODUCT_FEEDBACK_CATEGORIES);
|
|
10947
|
+
var status = z32.enum(PRODUCT_FEEDBACK_STATUSES);
|
|
10948
|
+
var vendorStatus = z32.enum(VENDOR_SETTABLE_STATUSES);
|
|
10949
|
+
var tensionId = z32.string().regex(FEEDBACK_TENSION_ID_PATTERN);
|
|
10950
|
+
var answer = z32.string().trim().min(1).max(MAX_FEEDBACK_ANSWER_LENGTH);
|
|
10921
10951
|
var MESSAGE_DISPLAY_LIMIT = 1e3;
|
|
10922
10952
|
var FULL_MESSAGE_MAX_LIMIT = 5;
|
|
10923
|
-
var feedbackSchema =
|
|
10924
|
-
action:
|
|
10925
|
-
message:
|
|
10953
|
+
var feedbackSchema = z32.object({
|
|
10954
|
+
action: z32.enum(actions).describe("submit requires message; list returns your own workspace's feedback (all statuses); queue is the vendor triage queue (system admins only) and accepts filters; note requires feedbackId+note; group requires feedbackIds+groupId (null clears); status requires feedbackId+status and may carry tensionId and answer."),
|
|
10955
|
+
message: z32.string().max(1e4).optional().describe("Required for submit: the product feedback text (max 10,000 characters)."),
|
|
10926
10956
|
category: category.optional().describe("Submit/queue category; submit defaults to other."),
|
|
10927
|
-
command:
|
|
10928
|
-
route:
|
|
10929
|
-
client:
|
|
10930
|
-
feedbackId:
|
|
10931
|
-
feedbackIds:
|
|
10932
|
-
note:
|
|
10957
|
+
command: z32.string().max(1e3).optional().describe("Optional submit command context; argument values are scrubbed server-side."),
|
|
10958
|
+
route: z32.string().max(500).optional().describe("Optional submit route context."),
|
|
10959
|
+
client: z32.string().max(100).optional().describe("Optional submit client label."),
|
|
10960
|
+
feedbackId: z32.string().max(200).optional().describe("Required for note/status: target feedback ID."),
|
|
10961
|
+
feedbackIds: z32.array(z32.string().max(200)).max(100).optional().describe("Required for group: 1\u2013100 target feedback IDs."),
|
|
10962
|
+
note: z32.string().max(4e3).optional().describe("Required for note: replacement triage note (max 4,000 characters)."),
|
|
10933
10963
|
status: status.optional().describe("list/queue filter (any status, including 'screening'); the status action's required target value excludes 'screening' (system-only)."),
|
|
10934
10964
|
tensionId: tensionId.optional().describe("status only: the tension the report joined, its display id TEN- and a number (vendor-only, never shown to the reporter)."),
|
|
10935
10965
|
answer: answer.optional().describe(`status only: the one sentence the reporter reads under their report, dated (max ${MAX_FEEDBACK_ANSWER_LENGTH} characters).`),
|
|
10936
|
-
groupId:
|
|
10937
|
-
workspaceId:
|
|
10938
|
-
since:
|
|
10939
|
-
before:
|
|
10940
|
-
limit:
|
|
10941
|
-
cursor:
|
|
10942
|
-
full:
|
|
10966
|
+
groupId: z32.string().min(1).max(200).nullable().optional().describe("Group filter, or required group destination; null explicitly clears grouping."),
|
|
10967
|
+
workspaceId: z32.string().max(200).optional().describe("Queue-only filter (vendor cross-workspace triage); omitted means all workspaces. Has no effect on list \u2014 your own workspace is always injected server-side."),
|
|
10968
|
+
since: z32.number().optional().describe("Queue-only lower createdAt window bound (inclusive) in epoch milliseconds."),
|
|
10969
|
+
before: z32.number().optional().describe("Queue-only upper createdAt window bound (exclusive) in epoch milliseconds. A time-window FILTER, not the pager \u2014 use cursor to page."),
|
|
10970
|
+
limit: z32.number().int().min(1).max(100).optional().describe("list/queue row limit, default 50, maximum 100."),
|
|
10971
|
+
cursor: z32.string().max(2e3).optional().describe("Opaque pagination cursor from a previous list/queue response (continueCursor); omit for the first page."),
|
|
10972
|
+
full: z32.boolean().optional().describe(`list/queue only: return untruncated messages; allowed only when limit <= ${FULL_MESSAGE_MAX_LIMIT}.`)
|
|
10943
10973
|
});
|
|
10944
|
-
var union =
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10974
|
+
var union = z32.discriminatedUnion("action", [
|
|
10975
|
+
z32.object({ action: z32.literal("submit"), message: z32.string().min(1).max(1e4), category: category.optional(), command: z32.string().max(1e3).optional(), route: z32.string().max(500).optional(), client: z32.string().max(100).optional() }),
|
|
10976
|
+
z32.object({ action: z32.literal("list"), status: status.optional(), limit: z32.number().int().min(1).max(100).optional(), cursor: z32.string().max(2e3).optional(), full: z32.boolean().optional() }),
|
|
10977
|
+
z32.object({ action: z32.literal("queue"), status: status.optional(), category: category.optional(), groupId: z32.string().min(1).max(200).optional(), workspaceId: z32.string().max(200).optional(), since: z32.number().optional(), before: z32.number().optional(), limit: z32.number().int().min(1).max(100).optional(), cursor: z32.string().max(2e3).optional(), full: z32.boolean().optional() }),
|
|
10978
|
+
z32.object({ action: z32.literal("note"), feedbackId: z32.string().min(1).max(200), note: z32.string().max(4e3) }),
|
|
10979
|
+
z32.object({ action: z32.literal("group"), feedbackIds: z32.array(z32.string().min(1).max(200)).min(1).max(100), groupId: z32.string().min(1).max(200).nullable() }),
|
|
10980
|
+
z32.object({ action: z32.literal("status"), feedbackId: z32.string().min(1).max(200), status: vendorStatus, tensionId: tensionId.optional(), answer: answer.optional() })
|
|
10951
10981
|
]);
|
|
10952
10982
|
var specs = {
|
|
10953
10983
|
submit: { params: ["message", "category", "command", "route", "client"], description: "message is required; category defaults to other." },
|
|
@@ -11076,19 +11106,19 @@ function registerFeedbackTool(server) {
|
|
|
11076
11106
|
}
|
|
11077
11107
|
|
|
11078
11108
|
// src/tools/conflicts.ts
|
|
11079
|
-
import { z as
|
|
11109
|
+
import { z as z33 } from "zod/v3";
|
|
11080
11110
|
var ACTIONS = ["list", "resolve"];
|
|
11081
|
-
var mode =
|
|
11082
|
-
var verdict =
|
|
11083
|
-
var conflictsSchema =
|
|
11084
|
-
action:
|
|
11111
|
+
var mode = z33.enum(["actionable", "all"]);
|
|
11112
|
+
var verdict = z33.enum(["real", "noise"]);
|
|
11113
|
+
var conflictsSchema = z33.object({
|
|
11114
|
+
action: z33.enum(ACTIONS),
|
|
11085
11115
|
mode: mode.optional().describe("list: all adds judged and snoozed rows."),
|
|
11086
|
-
issueId:
|
|
11116
|
+
issueId: z33.string().max(200).optional().describe("resolve: an id from list."),
|
|
11087
11117
|
verdict: verdict.optional().describe("resolve: real keeps the row open; noise closes it.")
|
|
11088
11118
|
});
|
|
11089
|
-
var conflictsActionUnion =
|
|
11090
|
-
|
|
11091
|
-
|
|
11119
|
+
var conflictsActionUnion = z33.discriminatedUnion("action", [
|
|
11120
|
+
z33.object({ action: z33.literal("list"), mode: mode.optional() }),
|
|
11121
|
+
z33.object({ action: z33.literal("resolve"), issueId: z33.string().min(1).max(200), verdict })
|
|
11092
11122
|
]);
|
|
11093
11123
|
var CONFLICTS_ACTION_SPECS = {
|
|
11094
11124
|
list: { params: ["mode"], description: "mode defaults to actionable." },
|
|
@@ -11132,26 +11162,26 @@ function registerConflictsTool(server) {
|
|
|
11132
11162
|
}
|
|
11133
11163
|
|
|
11134
11164
|
// src/tools/question.ts
|
|
11135
|
-
import { z as
|
|
11165
|
+
import { z as z34 } from "zod/v3";
|
|
11136
11166
|
var QUESTION_ACTIONS = ["create", "assign", "answer", "force-close", "list"];
|
|
11137
|
-
var questionSchema =
|
|
11138
|
-
action:
|
|
11167
|
+
var questionSchema = z34.object({
|
|
11168
|
+
action: z34.enum(QUESTION_ACTIONS).describe(
|
|
11139
11169
|
"'create': create a new routed question from text \u2014 the dedicated birth action; every question is born escalated to the team lead (generic entry creation and move-and-retype also pair a routing facet). 'assign': reassign ownership to a role (toRole required \u2014 no bare self-confirm, no toPerson). 'answer': close the loop \u2014 writes the answer on the question and moves it to answered; --entry links an existing decision instead. 'force-close': Team-Lead-only escape hatch \u2014 reason required. 'list': the ack-gate read model \u2014 what you owe (or, with mine:true, every question you asked, including closed ones)."
|
|
11140
11170
|
),
|
|
11141
|
-
entryId:
|
|
11142
|
-
text:
|
|
11143
|
-
blocks:
|
|
11144
|
-
toRole:
|
|
11145
|
-
reason:
|
|
11146
|
-
answerEntryId:
|
|
11147
|
-
mine:
|
|
11171
|
+
entryId: z34.string().max(200).optional().describe("Target question's id (human TEN-nnn form or a raw entry id). Required for every action except 'create'/'list'."),
|
|
11172
|
+
text: z34.string().max(5e3).optional().describe("'create': the question text. 'answer': the answer text (mutually exclusive with answerEntryId, max 2000 chars)."),
|
|
11173
|
+
blocks: z34.array(z34.string().max(200)).max(50).optional().describe("'create': entry ids this question is blocking (repeatable)."),
|
|
11174
|
+
toRole: z34.string().max(200).optional().describe("'assign': reassign to this role (human ROL-nnn form or a raw entry id) \u2014 required."),
|
|
11175
|
+
reason: z34.string().max(2e3).optional().describe("'force-close': required reason."),
|
|
11176
|
+
answerEntryId: z34.string().max(200).optional().describe("'answer': point at an already-written entry instead of supplying text (mutually exclusive with text)."),
|
|
11177
|
+
mine: z34.boolean().optional().describe("'list': true for arm C (every question YOU asked, every status). Omit/false for the ack-gate view (what you owe).")
|
|
11148
11178
|
});
|
|
11149
|
-
var createVariant =
|
|
11150
|
-
var assignVariant =
|
|
11151
|
-
var answerVariant =
|
|
11152
|
-
var forceCloseVariant =
|
|
11153
|
-
var listVariant =
|
|
11154
|
-
var questionActionUnion =
|
|
11179
|
+
var createVariant = z34.object({ action: z34.literal("create"), text: z34.string().min(1).max(5e3), blocks: z34.array(z34.string().max(200)).max(50).optional() });
|
|
11180
|
+
var assignVariant = z34.object({ action: z34.literal("assign"), entryId: z34.string().max(200), toRole: z34.string().max(200).min(1) });
|
|
11181
|
+
var answerVariant = z34.object({ action: z34.literal("answer"), entryId: z34.string().max(200), text: z34.string().max(2e3).optional(), answerEntryId: z34.string().max(200).optional() });
|
|
11182
|
+
var forceCloseVariant = z34.object({ action: z34.literal("force-close"), entryId: z34.string().max(200), reason: z34.string().min(1).max(2e3) });
|
|
11183
|
+
var listVariant = z34.object({ action: z34.literal("list"), mine: z34.boolean().optional() });
|
|
11184
|
+
var questionActionUnion = z34.discriminatedUnion("action", [
|
|
11155
11185
|
createVariant,
|
|
11156
11186
|
assignVariant,
|
|
11157
11187
|
answerVariant,
|
|
@@ -11635,7 +11665,7 @@ ${entry.labels.map((l) => `- ${l.name ?? l.slug}`).join("\n")}`);
|
|
|
11635
11665
|
}
|
|
11636
11666
|
|
|
11637
11667
|
// src/prompts/index.ts
|
|
11638
|
-
import { z as
|
|
11668
|
+
import { z as z35 } from "zod/v3";
|
|
11639
11669
|
async function buildReviewAgainstRulesPrompt(domain) {
|
|
11640
11670
|
const { rows: entries, cutLine } = await listEntriesWithCut({ collectionSlug: "rules" });
|
|
11641
11671
|
const rules = entries.slice(0, 50);
|
|
@@ -11721,27 +11751,27 @@ function registerPrompts(server) {
|
|
|
11721
11751
|
server.prompt(
|
|
11722
11752
|
"review-against-rules",
|
|
11723
11753
|
"Review code or a design decision against the rules, focused on a given area. Fetches the rules and asks you to do a structured compliance review.",
|
|
11724
|
-
{ domain:
|
|
11754
|
+
{ domain: z35.string().describe("Business rule domain (e.g. 'Identity & Access', 'Governance & Decision-Making')") },
|
|
11725
11755
|
async ({ domain }) => buildReviewAgainstRulesPrompt(domain)
|
|
11726
11756
|
);
|
|
11727
11757
|
server.prompt(
|
|
11728
11758
|
"name-check",
|
|
11729
11759
|
"Check variable names, field names, or API names against the glossary for terminology alignment. Flags drift from canonical terms.",
|
|
11730
|
-
{ names:
|
|
11760
|
+
{ names: z35.string().describe("Comma-separated list of names to check (e.g. 'user_id, workspace_id, entry_status')") },
|
|
11731
11761
|
async ({ names }) => buildNameCheckPrompt(names)
|
|
11732
11762
|
);
|
|
11733
11763
|
server.prompt(
|
|
11734
11764
|
"draft-decision-record",
|
|
11735
11765
|
"Draft a structured decision record from a description of what was decided. Includes context from recent decisions and relevant rules.",
|
|
11736
|
-
{ context:
|
|
11766
|
+
{ context: z35.string().describe("Description of the decision (e.g. 'We decided to keep one body field per entry because...')") },
|
|
11737
11767
|
async ({ context }) => buildDraftDecisionRecordPrompt(context)
|
|
11738
11768
|
);
|
|
11739
11769
|
server.prompt(
|
|
11740
11770
|
"draft-rule-from-context",
|
|
11741
11771
|
"Draft a new business rule from an observation or discovery made while coding. Fetches existing rules for the domain to ensure consistency.",
|
|
11742
11772
|
{
|
|
11743
|
-
observation:
|
|
11744
|
-
domain:
|
|
11773
|
+
observation: z35.string().describe("What you observed or discovered (e.g. 'A workspace can have more than one owner role')"),
|
|
11774
|
+
domain: z35.string().describe("Which domain this rule belongs to (e.g. 'Governance & Decision-Making')")
|
|
11745
11775
|
},
|
|
11746
11776
|
async ({ observation, domain }) => buildDraftRuleFromContextPrompt(observation, domain)
|
|
11747
11777
|
);
|
|
@@ -11843,7 +11873,7 @@ var INSTRUCTIONS = [
|
|
|
11843
11873
|
"Finish with `session action=wrapup-review`, then `session action=close`.",
|
|
11844
11874
|
"If the work falls outside the active work packages, name the gap and ask the user before designing it."
|
|
11845
11875
|
].join("\n");
|
|
11846
|
-
var sessionIdArg =
|
|
11876
|
+
var sessionIdArg = z36.string().max(200).optional().describe(
|
|
11847
11877
|
"The sessionId `session action=start` returned. Pass it on every write: the connection does not remember your session between calls."
|
|
11848
11878
|
);
|
|
11849
11879
|
function acceptSessionIdOnEveryTool(server) {
|
|
@@ -11912,4 +11942,4 @@ export {
|
|
|
11912
11942
|
SERVER_VERSION,
|
|
11913
11943
|
createProductBrainServer
|
|
11914
11944
|
};
|
|
11915
|
-
//# sourceMappingURL=chunk-
|
|
11945
|
+
//# sourceMappingURL=chunk-5OQ7KOPB.js.map
|