@rallycry/conveyor-mcp 4.3.10 → 4.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConveyorConnection
4
- } from "./chunk-KOYKRWVY.js";
4
+ } from "./chunk-BKAHHT4Y.js";
5
5
 
6
6
  // src/cli.ts
7
7
  import { createRequire } from "module";
@@ -261,7 +261,728 @@ function registerProjectConfigTools(server2, conn2) {
261
261
  }
262
262
 
263
263
  // src/tools/tasks.ts
264
+ import { z as z5 } from "zod";
265
+
266
+ // ../shared/dist/tool-contracts/index.js
267
+ var f = {
268
+ string(opts) {
269
+ return { kind: "string", ...opts };
270
+ },
271
+ number(opts) {
272
+ return { kind: "number", ...opts };
273
+ },
274
+ boolean(opts) {
275
+ return { kind: "boolean", ...opts };
276
+ },
277
+ enum(values, opts) {
278
+ return { kind: "enum", values, ...opts };
279
+ },
280
+ array(item, opts) {
281
+ return { kind: "array", item, ...opts };
282
+ },
283
+ object(fields, opts) {
284
+ return { kind: "object", fields, ...opts };
285
+ },
286
+ optional(inner) {
287
+ return { kind: "optional", inner };
288
+ }
289
+ };
290
+ function compileString(z9, spec) {
291
+ let schema = z9.string();
292
+ if (spec.min !== void 0) schema = schema.min(spec.min);
293
+ if (spec.max !== void 0) schema = schema.max(spec.max);
294
+ return schema;
295
+ }
296
+ function compileNumber(z9, spec) {
297
+ let schema = z9.number();
298
+ if (spec.int) schema = schema.int();
299
+ if (spec.positive) schema = schema.positive();
300
+ if (spec.nonnegative) schema = schema.nonnegative();
301
+ if (spec.min !== void 0) schema = schema.min(spec.min);
302
+ if (spec.max !== void 0) schema = schema.max(spec.max);
303
+ return schema;
304
+ }
305
+ function compileArray(z9, spec) {
306
+ let schema = z9.array(compileField(z9, spec.item));
307
+ if (spec.min !== void 0) schema = schema.min(spec.min);
308
+ return schema;
309
+ }
310
+ function compileBase(z9, spec) {
311
+ switch (spec.kind) {
312
+ case "string":
313
+ return compileString(z9, spec);
314
+ case "number":
315
+ return compileNumber(z9, spec);
316
+ case "boolean":
317
+ return z9.boolean();
318
+ case "enum":
319
+ return z9.enum([...spec.values]);
320
+ case "array":
321
+ return compileArray(z9, spec);
322
+ case "object":
323
+ return z9.object(compileShape(z9, spec.fields));
324
+ }
325
+ }
326
+ function compileField(z9, spec) {
327
+ if (spec.kind === "optional") {
328
+ return compileField(z9, spec.inner).optional();
329
+ }
330
+ const schema = compileBase(z9, spec);
331
+ return spec.desc === void 0 ? schema : schema.describe(spec.desc);
332
+ }
333
+ function compileShape(z9, fields) {
334
+ const shape = {};
335
+ for (const [key, spec] of Object.entries(fields)) {
336
+ shape[key] = compileField(z9, spec);
337
+ }
338
+ return shape;
339
+ }
340
+ function defineToolContract(contract) {
341
+ return contract;
342
+ }
343
+ var mcpProjectId = f.optional(f.string({ desc: "Target Conveyor project ID" }));
344
+ var getTaskContract = defineToolContract({
345
+ name: "get_task",
346
+ agent: {
347
+ description: "Look up any task by slug or ID. Returns JSON with id, slug, title, description, plan, status, branch, githubPRNumber, githubPRUrl, storyPoints. For children use list_subtasks.",
348
+ fields: {
349
+ slug_or_id: f.string({ desc: "The task slug (e.g. 'my-task') or CUID" })
350
+ }
351
+ },
352
+ mcp: {
353
+ description: "Get full task details including plan, chat history, PR info, subtasks, and build status. Pass projectId to target a specific project; otherwise the configured default project is used.",
354
+ fields: {
355
+ projectId: mcpProjectId,
356
+ taskId: f.string({
357
+ desc: "The task ID or slug (the value in a card URL, /cards/<slug>)"
358
+ })
359
+ }
360
+ }
361
+ });
362
+ var postToChatContract = defineToolContract({
363
+ name: "post_to_chat",
364
+ agent: {
365
+ description: "Post a message to the task chat for the team to see. Your turn output is NOT shown in chat, so this is the only way the team sees your status, summaries, and questions. Omit task_id to post to the current task's chat; pass a child's ID to message its chat.",
366
+ fields: {
367
+ message: f.optional(f.string({ desc: "The message to post to the team" })),
368
+ content: f.optional(
369
+ f.string({
370
+ desc: "Alias of `message` (the external conveyor-mcp surface names this field `content`). Provide exactly one of the two."
371
+ })
372
+ ),
373
+ task_id: f.optional(
374
+ f.string({
375
+ desc: "Child task ID to post to. Omit to post to the current task's chat."
376
+ })
377
+ ),
378
+ milestone: f.optional(
379
+ f.enum(["plan_ready", "implementation_complete", "blocked"], {
380
+ desc: "Declare a narrative milestone instead of a routine update. Use SPARINGLY \u2014 only when the plan is ready, implementation is complete, or you are blocked. Milestones appear on the card's activity timeline and in Slack."
381
+ })
382
+ )
383
+ }
384
+ },
385
+ mcp: {
386
+ description: "Post a message to a task's chat. Pass projectId to target a specific project; otherwise the configured default project is used.",
387
+ fields: {
388
+ projectId: mcpProjectId,
389
+ taskId: f.string({ desc: "The task ID" }),
390
+ content: f.optional(f.string({ desc: "Message content" })),
391
+ message: f.optional(
392
+ f.string({
393
+ desc: "Alias of `content` (the in-pod agent surface names this field `message`). Provide exactly one of the two."
394
+ })
395
+ )
396
+ }
397
+ }
398
+ });
399
+ var readTaskChatContract = defineToolContract({
400
+ name: "read_task_chat",
401
+ agent: {
402
+ description: "Read recent human/user chat messages for a task. Omit task_id for the current task; pass a child ID for a child's chat. For agent logs use get_execution_logs.",
403
+ fields: {
404
+ limit: f.optional(f.number({ desc: "Number of recent messages to fetch (default 20)" })),
405
+ task_id: f.optional(
406
+ f.string({
407
+ desc: "Child task ID to read chat from. Omit to read the current task's chat."
408
+ })
409
+ )
410
+ }
411
+ },
412
+ mcp: {
413
+ description: "Read messages from a task's chat. Pass projectId to target a specific project; otherwise the configured default project is used. For agent execution logs use get_task_logs.",
414
+ fields: {
415
+ projectId: mcpProjectId,
416
+ taskId: f.string({ desc: "The task ID" }),
417
+ limit: f.optional(f.number({ desc: "Max messages to return (default 50)" }))
418
+ }
419
+ }
420
+ });
421
+ var listTagsContract = defineToolContract({
422
+ name: "list_tags",
423
+ agent: {
424
+ description: "List this project's tags (id, name, color). Use the ids with update_tag.",
425
+ fields: {}
426
+ },
427
+ mcp: {
428
+ description: "List all project tags with their names, IDs, and colors. Pass projectId to target a specific project; otherwise the configured default project is used.",
429
+ fields: {
430
+ projectId: mcpProjectId
431
+ }
432
+ }
433
+ });
434
+ var childTaskIdForMerge = f.string({
435
+ desc: "The child task ID whose PR should be approved and merged"
436
+ });
437
+ var approveAndMergePrContract = defineToolContract({
438
+ name: "approve_and_merge_pr",
439
+ agent: {
440
+ description: "Approve and merge a child task's PR. Preconditions: child in ReviewPR. Returns { merged }: true = merged (status\u2192ReviewDev); false = automerge queued, wait for ReviewDev.",
441
+ fields: {
442
+ childTaskId: childTaskIdForMerge
443
+ }
444
+ },
445
+ mcp: {
446
+ description: "Approve and merge a child task's pull request. Pass projectId to target a specific project; otherwise the configured default project is used. Only succeeds if all CI/CD checks are passing. The child task must be in ReviewPR status with a PR.",
447
+ fields: {
448
+ projectId: mcpProjectId,
449
+ childTaskId: childTaskIdForMerge
450
+ }
451
+ }
452
+ });
453
+ var tasksContracts = [
454
+ getTaskContract,
455
+ postToChatContract,
456
+ readTaskChatContract,
457
+ listTagsContract,
458
+ approveAndMergePrContract
459
+ ];
460
+ var mcpChecklistTaskId = f.string({ desc: "The task ID or slug" });
461
+ var testStatuses = f.optional(
462
+ f.array(f.enum(["open", "approved", "rejected"]), {
463
+ desc: "Filter tests by status: open | approved | rejected"
464
+ })
465
+ );
466
+ var setManualTestItems = f.array(
467
+ f.object({ title: f.string({ min: 1, desc: "A concise, actionable test step" }) }),
468
+ { min: 1, desc: "List of manual test steps to add" }
469
+ );
470
+ var titleToEdit = f.string({ min: 1, desc: "The current title of the manual test to edit" });
471
+ var newTitle = f.string({ min: 1, desc: "The new title for the manual test" });
472
+ var titleToRemove = f.string({ min: 1, desc: "The title of the manual test to remove" });
473
+ var titleToApprove = f.string({ min: 1, desc: "The title of the manual test to approve" });
474
+ var titleToReject = f.string({ min: 1, desc: "The title of the manual test to reject" });
475
+ var rejectReason = f.string({
476
+ min: 1,
477
+ max: 2e3,
478
+ desc: "Why the test failed \u2014 what went wrong, shown to the team"
479
+ });
480
+ var listManualTestsContract = defineToolContract({
481
+ name: "list_manual_tests",
482
+ agent: {
483
+ description: "List the manual test checklist items for the current task. Use to see what manual verification steps have already been recorded.",
484
+ fields: {}
485
+ },
486
+ mcp: {
487
+ description: "List the manual test checklist items for a task. Pass projectId to target a specific project; otherwise the configured default project is used. Use to see what manual verification steps have already been recorded.",
488
+ fields: {
489
+ projectId: mcpProjectId,
490
+ taskId: f.string({ desc: "The task ID or slug (the value in a card URL, /cards/<slug>)" })
491
+ }
492
+ }
493
+ });
494
+ var queryManualTestsContract = defineToolContract({
495
+ name: "query_manual_tests",
496
+ agent: {
497
+ description: "Query manual tests across many tasks in this project, grouped by task. Filter by card status (ReviewDev, ReviewLive, Complete, ...) and/or test status (open | approved | rejected). Use to answer 'show all OPEN manual tests in ReviewDev' or 'show all REJECTED manual tests with the failing reason'. With no filters it defaults to the needs-attention view: open+rejected tests on ReviewDev/ReviewLive cards.",
498
+ fields: {
499
+ cardStatuses: f.optional(
500
+ f.array(f.string(), {
501
+ desc: 'Filter tasks by card status, e.g. ["ReviewDev", "ReviewLive"]'
502
+ })
503
+ ),
504
+ testStatuses
505
+ }
506
+ },
507
+ mcp: {
508
+ description: "Query manual tests across many tasks in a project, grouped by task. Filter by card status (e.g. ReviewDev, ReviewLive, Complete) and/or test status (open | approved | rejected). Use to answer questions like 'show all OPEN manual tests in ReviewDev' or 'show all REJECTED manual tests in ReviewDev/ReviewLive with the failing reason'. With no filters it defaults to the needs-attention view: open+rejected tests on ReviewDev/ReviewLive cards. Pass projectId to target a specific project; otherwise the configured default project is used.",
509
+ fields: {
510
+ projectId: mcpProjectId,
511
+ cardStatuses: f.optional(
512
+ f.array(f.string(), {
513
+ desc: 'Filter tasks by card/column status, e.g. ["ReviewDev", "ReviewLive"]'
514
+ })
515
+ ),
516
+ testStatuses
517
+ }
518
+ }
519
+ });
520
+ var setManualTestsContract = defineToolContract({
521
+ name: "set_manual_tests",
522
+ agent: {
523
+ description: "Add manual test steps to the task checklist. Existing items with the same title are automatically skipped (deduplication). Use to record specific manual verification steps that reviewers should follow when testing this PR.",
524
+ fields: {
525
+ items: setManualTestItems
526
+ }
527
+ },
528
+ mcp: {
529
+ description: "Add manual test steps to a task's checklist. Pass projectId to target a specific project; otherwise the configured default project is used. Existing items with the same title are automatically skipped (deduplication). Use to record specific manual verification steps that reviewers should follow when testing the task's PR.",
530
+ fields: {
531
+ projectId: mcpProjectId,
532
+ taskId: mcpChecklistTaskId,
533
+ items: setManualTestItems
534
+ }
535
+ }
536
+ });
537
+ var editManualTestContract = defineToolContract({
538
+ name: "edit_manual_test",
539
+ agent: {
540
+ description: "Rename an existing manual test step. Identify the test by its current title (case-insensitive); pass the new title to replace it. Use to correct or refine a recorded manual verification step.",
541
+ fields: {
542
+ title: titleToEdit,
543
+ newTitle
544
+ }
545
+ },
546
+ mcp: {
547
+ description: "Rename an existing manual test step on a task. Pass projectId to target a specific project; otherwise the configured default project is used. Identify the test by its current title (case-insensitive) and pass the new title to replace it.",
548
+ fields: {
549
+ projectId: mcpProjectId,
550
+ taskId: mcpChecklistTaskId,
551
+ title: titleToEdit,
552
+ newTitle
553
+ }
554
+ }
555
+ });
556
+ var removeManualTestContract = defineToolContract({
557
+ name: "remove_manual_test",
558
+ agent: {
559
+ description: "Remove an existing manual test step from the task checklist. Identify the test by its title (case-insensitive). Use to delete a stale or incorrect manual verification step.",
560
+ fields: {
561
+ title: titleToRemove
562
+ }
563
+ },
564
+ mcp: {
565
+ description: "Remove an existing manual test step from a task's checklist. Pass projectId to target a specific project; otherwise the configured default project is used. Identify the test by its title (case-insensitive).",
566
+ fields: {
567
+ projectId: mcpProjectId,
568
+ taskId: mcpChecklistTaskId,
569
+ title: titleToRemove
570
+ }
571
+ }
572
+ });
573
+ var approveManualTestContract = defineToolContract({
574
+ name: "approve_manual_test",
575
+ agent: {
576
+ description: "Sign off on (approve) a manual test step on behalf of your authenticated user. Identify the test by its title (case-insensitive). Use after you have verified the step passes.",
577
+ fields: {
578
+ title: titleToApprove
579
+ }
580
+ },
581
+ mcp: {
582
+ description: "Sign off on (approve) a manual test step on a task on behalf of your authenticated user. Pass projectId to target a specific project; otherwise the configured default project is used. Identify the test by its title (case-insensitive). Use after you have verified the step passes.",
583
+ fields: {
584
+ projectId: mcpProjectId,
585
+ taskId: mcpChecklistTaskId,
586
+ title: titleToApprove
587
+ }
588
+ }
589
+ });
590
+ var rejectManualTestContract = defineToolContract({
591
+ name: "reject_manual_test",
592
+ agent: {
593
+ description: "Flag an issue with (reject) a manual test step on behalf of your authenticated user, recording the reason. Identify the test by its title (case-insensitive). Use when the step fails verification.",
594
+ fields: {
595
+ title: titleToReject,
596
+ reason: rejectReason
597
+ }
598
+ },
599
+ mcp: {
600
+ description: "Flag an issue with (reject) a manual test step on a task on behalf of your authenticated user, recording the reason. Pass projectId to target a specific project; otherwise the configured default project is used. Identify the test by its title (case-insensitive). Use when the step fails verification.",
601
+ fields: {
602
+ projectId: mcpProjectId,
603
+ taskId: mcpChecklistTaskId,
604
+ title: titleToReject,
605
+ reason: rejectReason
606
+ }
607
+ }
608
+ });
609
+ var checklistContracts = [
610
+ listManualTestsContract,
611
+ queryManualTestsContract,
612
+ setManualTestsContract,
613
+ editManualTestContract,
614
+ removeManualTestContract,
615
+ approveManualTestContract,
616
+ rejectManualTestContract
617
+ ];
618
+ var getDependenciesContract = defineToolContract({
619
+ name: "get_dependencies",
620
+ agent: {
621
+ description: "Get this task's dependencies and their met/unmet status (met = merged to dev). Use to confirm blockers merged, or see why a task cannot start. For task state use get_task.",
622
+ fields: {}
623
+ },
624
+ mcp: {
625
+ description: "Get a task's dependencies and their met/unmet status (met = merged to dev). Pass projectId to target a specific project; otherwise the configured default project is used. Use to confirm blockers merged, or see why a task cannot start. For task state use get_task.",
626
+ fields: {
627
+ projectId: mcpProjectId,
628
+ taskId: f.string({ desc: "The task ID" })
629
+ }
630
+ }
631
+ });
632
+ var addDependencyContract = defineToolContract({
633
+ name: "add_dependency",
634
+ agent: {
635
+ description: "Add a blocking dependency \u2014 this task cannot start until the named task is merged to dev. For post-task follow-ups use create_follow_up_task instead.",
636
+ fields: {
637
+ depends_on_slug_or_id: f.string({ desc: "Slug or ID of the task this task depends on" })
638
+ }
639
+ },
640
+ mcp: {
641
+ description: "Add a blocking dependency \u2014 this task cannot start until the named task is merged to dev. Pass projectId to target a specific project; otherwise the configured default project is used.",
642
+ fields: {
643
+ projectId: mcpProjectId,
644
+ taskId: f.string({ desc: "The task ID that will be blocked" }),
645
+ dependsOnSlugOrId: f.string({ desc: "Slug or ID of the task this one depends on" })
646
+ }
647
+ }
648
+ });
649
+ var removeDependencyContract = defineToolContract({
650
+ name: "remove_dependency",
651
+ agent: {
652
+ description: "Remove a previously added dependency from this task. When to use: the dependency was added in error or is no longer relevant. Returns: confirmation string.",
653
+ fields: {
654
+ depends_on_slug_or_id: f.string({ desc: "Slug or ID of the task to remove as dependency" })
655
+ }
656
+ },
657
+ mcp: {
658
+ description: "Remove a previously added dependency from a task. Pass projectId to target a specific project; otherwise the configured default project is used. The task is no longer blocked by the named task. Returns: confirmation string.",
659
+ fields: {
660
+ projectId: mcpProjectId,
661
+ taskId: f.string({ desc: "The task ID to unblock" }),
662
+ dependsOnSlugOrId: f.string({ desc: "Slug or ID of the dependency to remove" })
663
+ }
664
+ }
665
+ });
666
+ var dependenciesContracts = [
667
+ getDependenciesContract,
668
+ addDependencyContract,
669
+ removeDependencyContract
670
+ ];
671
+ var SP_DESCRIPTION = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
672
+ var AGENT_FOLLOW_PARENT_STATUS = "Child mirrors the parent task's status automatically \u2014 for subtasks that ship on the parent's branch/PR with no build or PR of their own. Manual status writes on a follower stick only until the parent's next transition.";
673
+ var MCP_FOLLOW_PARENT_STATUS = "When true, this subtask mirrors the parent task's status automatically \u2014 for children that ship on the parent's branch/PR and have no build or PR of their own. Manual status writes on a follower stick only until the parent's next transition.";
674
+ var AGENT_DEPENDS_ON = "Sibling subtask ids or slugs this subtask blocks on (it won't start until they merge to dev). Set explicit dependency metadata here instead of describing order in the plan text \u2014 the pack runner schedules children off these edges. Omit / leave empty for independent children so they run in parallel.";
675
+ var MCP_STATUS_ENUM = [
676
+ "Planning",
677
+ "Open",
678
+ "InProgress",
679
+ "ReviewPR",
680
+ "ReviewDev",
681
+ "ReviewLive",
682
+ "Complete",
683
+ "Cancelled"
684
+ ];
685
+ var createSubtaskContract = defineToolContract({
686
+ name: "create_subtask",
687
+ agent: {
688
+ description: "Create a subtask under the current parent task. Use when breaking a complex parent into smaller pieces during planning. For post-task follow-ups use create_follow_up_task.",
689
+ fields: {
690
+ title: f.string({ desc: "Subtask title" }),
691
+ description: f.optional(f.string({ desc: "Brief description" })),
692
+ plan: f.optional(f.string({ desc: "Implementation plan in markdown" })),
693
+ ordinal: f.optional(f.number({ desc: "Step/order number (0-based)" })),
694
+ storyPointValue: f.optional(f.number({ desc: SP_DESCRIPTION })),
695
+ followParentStatus: f.optional(f.boolean({ desc: AGENT_FOLLOW_PARENT_STATUS })),
696
+ dependsOn: f.optional(f.array(f.string(), { desc: AGENT_DEPENDS_ON }))
697
+ }
698
+ },
699
+ mcp: {
700
+ description: "Create a subtask under a parent task. Pass projectId to target a specific project; otherwise the configured default project is used. Subtasks break a larger task into independently buildable pieces. For children that instead ship on the parent's own branch/PR (e.g. per-theme tracking cards for one bundled PR), set followParentStatus so their status rides the parent's automatically.",
701
+ fields: {
702
+ projectId: mcpProjectId,
703
+ parentTaskId: f.string({ desc: "The parent task ID" }),
704
+ title: f.string({ desc: "Subtask title" }),
705
+ description: f.optional(f.string({ desc: "Subtask description" })),
706
+ plan: f.optional(f.string({ desc: "Subtask implementation plan (markdown)" })),
707
+ ordinal: f.optional(f.number({ desc: "Ordering position among siblings" })),
708
+ storyPointValue: f.optional(f.number({ desc: SP_DESCRIPTION })),
709
+ followParentStatus: f.optional(f.boolean({ desc: MCP_FOLLOW_PARENT_STATUS })),
710
+ dependsOn: f.optional(
711
+ f.array(f.string(), {
712
+ desc: "Sibling subtask ids or slugs this subtask blocks on (it won't start until they merge to dev). Set explicit dependency metadata here instead of describing order in the plan text. Omit / leave empty for independent children so they run in parallel."
713
+ })
714
+ )
715
+ }
716
+ }
717
+ });
718
+ var updateSubtaskContract = defineToolContract({
719
+ name: "update_subtask",
720
+ agent: {
721
+ description: "Update an existing subtask's fields (title, description, plan, ordinal, storyPointValue, dependsOn) \u2014 and the sanctioned path to make a child buildable: promote it to status Open, assign its agent (agentIdOrName), and set story points. Setting story points does NOT auto-promote; set status explicitly. For the current task use update_task_plan.",
722
+ fields: {
723
+ subtaskId: f.string({ desc: "The subtask ID to update" }),
724
+ title: f.optional(f.string()),
725
+ description: f.optional(f.string()),
726
+ plan: f.optional(f.string()),
727
+ status: f.optional(
728
+ f.enum(["Planning", "Open"], {
729
+ desc: 'Move the child between "Planning" and "Open". "Open" marks it ready to execute \u2014 required before start_child_cloud_build. Execution statuses transition automatically.'
730
+ })
731
+ ),
732
+ agentIdOrName: f.optional(
733
+ f.string({
734
+ desc: "Assign a project agent to the child (agent id or exact name from the Project Agents list). Required before start_child_cloud_build."
735
+ })
736
+ ),
737
+ ordinal: f.optional(f.number()),
738
+ storyPointValue: f.optional(f.number({ desc: SP_DESCRIPTION })),
739
+ followParentStatus: f.optional(f.boolean({ desc: AGENT_FOLLOW_PARENT_STATUS })),
740
+ dependsOn: f.optional(
741
+ f.array(f.string(), {
742
+ desc: `${AGENT_DEPENDS_ON} Replaces the full dependency set \u2014 pass [] to clear all, omit to leave unchanged.`
743
+ })
744
+ )
745
+ }
746
+ },
747
+ mcp: {
748
+ description: "Update a subtask's fields: title, description, plan, status, ordering, story points, or dependencies. Pass projectId to target a specific project; otherwise the configured default project is used. Moving a subtask beyond Planning auto-fills missing story points and agent assignment \u2014 don't spend turns on them.",
749
+ fields: {
750
+ projectId: mcpProjectId,
751
+ subtaskId: f.string({ desc: "The subtask ID" }),
752
+ title: f.optional(f.string({ desc: "New title" })),
753
+ description: f.optional(f.string({ desc: "New description" })),
754
+ plan: f.optional(f.string({ desc: "New plan (markdown)" })),
755
+ status: f.optional(f.enum(MCP_STATUS_ENUM, { desc: "New status" })),
756
+ ordinal: f.optional(f.number({ desc: "New ordering position among siblings" })),
757
+ storyPointValue: f.optional(f.number({ desc: SP_DESCRIPTION })),
758
+ followParentStatus: f.optional(f.boolean({ desc: MCP_FOLLOW_PARENT_STATUS })),
759
+ dependsOn: f.optional(
760
+ f.array(f.string(), {
761
+ desc: "Replace the sibling subtask ids/slugs this subtask blocks on (pass [] to clear). Omit to leave dependencies unchanged."
762
+ })
763
+ )
764
+ }
765
+ }
766
+ });
767
+ var deleteSubtaskContract = defineToolContract({
768
+ name: "delete_subtask",
769
+ agent: {
770
+ description: "Delete a subtask by id. When to use: a subtask was created in error or is no longer needed. Returns: confirmation string.",
771
+ fields: {
772
+ subtaskId: f.string({ desc: "The subtask ID to delete" })
773
+ }
774
+ },
775
+ mcp: {
776
+ description: "Delete a subtask by ID. Pass projectId to target a specific project; otherwise the configured default project is used. This is permanent \u2014 use update_subtask to set status to Cancelled if you only want to close it.",
777
+ fields: {
778
+ projectId: mcpProjectId,
779
+ subtaskId: f.string({ desc: "The subtask ID to delete" })
780
+ }
781
+ }
782
+ });
783
+ var listSubtasksContract = defineToolContract({
784
+ name: "list_subtasks",
785
+ agent: {
786
+ description: "List all subtasks under the current parent task. Default compact view returns per child: status, agent, story points, PR number/state, dependencies, and holdsBuildSlot \u2014 plus packSlots (in-flight environments vs the PACK_CHILD_LIMIT cap, and which children hold the slots). Use to coordinate child work; pass verbose:true only when you need full description/plan text (large). For non-child tasks use get_task.",
787
+ fields: {
788
+ verbose: f.optional(
789
+ f.boolean({
790
+ desc: "Return full task rows including description and plan text (large \u2014 can exceed tool result limits on big packs). Default: compact orchestration view."
791
+ })
792
+ )
793
+ }
794
+ },
795
+ mcp: {
796
+ description: "List all subtasks of a parent task with their status and ordering. Pass projectId to target a specific project; otherwise the configured default project is used.",
797
+ fields: {
798
+ projectId: mcpProjectId,
799
+ taskId: f.string({ desc: "The parent task ID" })
800
+ }
801
+ }
802
+ });
803
+ var subtasksContracts = [
804
+ createSubtaskContract,
805
+ updateSubtaskContract,
806
+ deleteSubtaskContract,
807
+ listSubtasksContract
808
+ ];
809
+ var mcpTaskIdOrSlug = f.string({ desc: "The task ID or slug" });
810
+ var listTaskFilesContract = defineToolContract({
811
+ name: "list_task_files",
812
+ agent: {
813
+ description: "List all files attached to this task with metadata. Use before fetching a specific file to see what is available and how large each is. For file contents use get_attachment.",
814
+ fields: {}
815
+ },
816
+ mcp: {
817
+ description: "List all files attached to a task with metadata (no contents \u2014 fast and small). Pass projectId to target a specific project; otherwise the configured default project is used. Use before fetching a specific file to see what is available and how large each is. For file contents use get_attachment.",
818
+ fields: {
819
+ projectId: mcpProjectId,
820
+ taskId: mcpTaskIdOrSlug
821
+ }
822
+ }
823
+ });
824
+ var getAttachmentContract = defineToolContract({
825
+ name: "get_attachment",
826
+ agent: {
827
+ description: "Fetch one task file's content plus metadata by file ID. Call list_task_files first to discover IDs and check sizes \u2014 large binaries may be truncated by the service's size limit.",
828
+ fields: {
829
+ fileId: f.string({ desc: "The file ID to retrieve" })
830
+ }
831
+ },
832
+ mcp: {
833
+ description: "Fetch one task file's content plus metadata by file ID (accepts task id or slug). Pass projectId to target a specific project; otherwise the configured default project is used. Images are returned as viewable image blocks. Large text files (logs, JSON) are returned in pages \u2014 use `offset`/`maxBytes` to read more, or fetch `downloadUrl` for the whole file. Call list_task_files first to discover IDs and sizes.",
834
+ fields: {
835
+ projectId: mcpProjectId,
836
+ taskId: mcpTaskIdOrSlug,
837
+ fileId: f.string({ desc: "The file ID to fetch" }),
838
+ offset: f.optional(
839
+ f.number({
840
+ int: true,
841
+ nonnegative: true,
842
+ desc: "Byte offset into text content (paging). Default 0."
843
+ })
844
+ ),
845
+ maxBytes: f.optional(
846
+ f.number({
847
+ int: true,
848
+ positive: true,
849
+ desc: "Max bytes of text content to return from offset."
850
+ })
851
+ )
852
+ }
853
+ }
854
+ });
855
+ var uploadAttachmentContract = defineToolContract({
856
+ name: "upload_attachment",
857
+ agent: {
858
+ description: "Upload an image file (e.g. a Playwright screenshot) as a task attachment AND post it to the task chat in one step \u2014 no follow-up post_to_chat call needed. Supports png/jpg/gif/webp.",
859
+ fields: {
860
+ path: f.string({
861
+ desc: "Path to the image file \u2014 absolute, or relative to the workspace root"
862
+ }),
863
+ title: f.optional(
864
+ f.string({ desc: "Short caption posted with the image (defaults to the file name)" })
865
+ )
866
+ }
867
+ },
868
+ mcp: {
869
+ description: "Upload a local file as a task attachment (any file type, up to 25MB). Pass projectId to target a specific project; otherwise the configured default project is used. The file appears under the task's Files. Pass `comment` to also post it to the task chat in the same step.",
870
+ fields: {
871
+ projectId: mcpProjectId,
872
+ taskId: mcpTaskIdOrSlug,
873
+ path: f.string({ desc: "Absolute path to the local file to upload" }),
874
+ comment: f.optional(
875
+ f.string({ desc: "When set, also posts the attachment to the task chat with this text" })
876
+ ),
877
+ mimeType: f.optional(
878
+ f.string({ desc: "Override the mime type inferred from the file extension" })
879
+ )
880
+ }
881
+ }
882
+ });
883
+ var attachmentsContracts = [
884
+ listTaskFilesContract,
885
+ getAttachmentContract,
886
+ uploadAttachmentContract
887
+ ];
888
+ var createSuggestionContract = defineToolContract({
889
+ name: "create_suggestion",
890
+ agent: {
891
+ description: "File a project suggestion (idea/improvement for maintainers to review). Duplicates are AI-deduped into an existing suggestion with an upvote. Returns the suggestion id.",
892
+ fields: {
893
+ title: f.string({ min: 1, desc: "Short title" }),
894
+ description: f.optional(f.string({ desc: "1-3 sentences: what should change and why" })),
895
+ tag_names: f.optional(f.array(f.string(), { desc: "Tag names to categorize" }))
896
+ }
897
+ },
898
+ mcp: {
899
+ description: "Suggest a feature, improvement, rule, or idea for the project. Pass projectId to target a specific project; otherwise the configured default project is used. Duplicates are deduped and your upvote is recorded.",
900
+ fields: {
901
+ projectId: mcpProjectId,
902
+ title: f.string({ desc: "Suggestion title" }),
903
+ description: f.optional(f.string({ desc: "Suggestion details (markdown)" })),
904
+ tagNames: f.optional(
905
+ f.array(f.string(), {
906
+ desc: 'Tag names to categorize the suggestion (e.g., ["agent-runner"])'
907
+ })
908
+ )
909
+ }
910
+ }
911
+ });
912
+ var suggestionsContracts = [createSuggestionContract];
913
+ var createPullRequestContract = defineToolContract({
914
+ name: "create_pull_request",
915
+ agent: {
916
+ description: "Create a GitHub PR for this task. Auto-stages, commits (commitMessage or title default), pushes to origin, then opens the PR. Always use this instead of gh CLI or raw git.",
917
+ fields: {
918
+ title: f.string({ desc: "The PR title" }),
919
+ body: f.string({ desc: "The PR description/body in markdown" }),
920
+ branch: f.optional(
921
+ f.string({
922
+ desc: "The head branch name for the PR. If the task doesn't have a branch set, this will be used. Defaults to the task's existing branch."
923
+ })
924
+ ),
925
+ baseBranch: f.optional(
926
+ f.string({
927
+ desc: "The base branch to target for the PR (e.g. 'main', 'develop'). Defaults to the project's configured dev branch."
928
+ })
929
+ ),
930
+ commitMessage: f.optional(
931
+ f.string({
932
+ desc: "Commit message for staging uncommitted changes. If not provided, a default message based on the PR title will be used."
933
+ })
934
+ ),
935
+ skipVerify: f.optional(
936
+ f.boolean({
937
+ desc: "Controls the local pre-push quality gate (lint/typecheck/test). Defaults to true (--no-verify): the push skips the local gate because you should run gates yourself before opening the PR and CI re-runs them on the resulting PR. Running the full gate synchronously during the push would block the agent's event loop long enough to drop the Conveyor socket connection. Pass false to force the local pre-push hook to run."
938
+ })
939
+ )
940
+ }
941
+ },
942
+ mcp: {
943
+ description: "Open a GitHub pull request for a task's existing branch (the branch must already be pushed to origin). Pass projectId to target a specific project; otherwise the configured default project is used. Moves the task to ReviewPR. Returns the PR number and URL.",
944
+ fields: {
945
+ projectId: mcpProjectId,
946
+ taskId: f.string({ desc: "The task ID whose branch should be opened as a PR" }),
947
+ title: f.string({ desc: "Pull request title" }),
948
+ body: f.string({ desc: "Pull request body (markdown)" }),
949
+ head: f.optional(
950
+ f.string({ desc: "Source branch for the PR (defaults to the task's branch)" })
951
+ ),
952
+ base: f.optional(
953
+ f.string({ desc: "Target branch for the PR (defaults to the repo default)" })
954
+ )
955
+ }
956
+ }
957
+ });
958
+ var pullRequestContracts = [createPullRequestContract];
959
+ var TOOL_CONTRACTS = Object.fromEntries(
960
+ [
961
+ ...tasksContracts,
962
+ ...checklistContracts,
963
+ ...dependenciesContracts,
964
+ ...subtasksContracts,
965
+ ...attachmentsContracts,
966
+ ...suggestionsContracts,
967
+ ...pullRequestContracts
968
+ ].map((contract) => [contract.name, contract])
969
+ );
970
+
971
+ // src/tools/contract-tool.ts
264
972
  import { z as z4 } from "zod";
973
+ function mcpShape(surface) {
974
+ return compileShape(z4, surface.fields);
975
+ }
976
+ function registerContractTool(server2, contract, handler) {
977
+ server2.tool(
978
+ contract.name,
979
+ contract.mcp.description,
980
+ mcpShape(contract.mcp),
981
+ handler
982
+ );
983
+ }
984
+
985
+ // src/tools/tasks.ts
265
986
  var CLI_EVENT_FORMATTERS = {
266
987
  thinking: (data) => String(data.message ?? ""),
267
988
  tool_use: (data) => `${data.tool}: ${String(data.input ?? "").slice(0, 1e3)}`,
@@ -331,10 +1052,10 @@ var STATUS_ENUM = [
331
1052
  ];
332
1053
  var CARD_TYPE_ENUM = ["task", "incident", "suggestion"];
333
1054
  var RISK_ENUM = ["critical", "high", "medium", "low"];
334
- var BOARD_FILTER = z4.string().nullable().optional().describe(
1055
+ var BOARD_FILTER = z5.string().nullable().optional().describe(
335
1056
  "Filter to a sub-project board. Omit to use the connection's default board (CONVEYOR_SUBPROJECT_ID) when set, else the whole project; pass null to force the whole project. Use list_accessible_subprojects to find board IDs."
336
1057
  );
337
- var BOARD_ASSIGN = z4.string().nullable().optional().describe(
1058
+ var BOARD_ASSIGN = z5.string().nullable().optional().describe(
338
1059
  "Assign the card to a sub-project board. Omit to use the connection's default board (CONVEYOR_SUBPROJECT_ID) when set, else the parent project; pass null to force the parent project. Use list_accessible_subprojects to find board IDs."
339
1060
  );
340
1061
  function registerListTasks(server2, conn2) {
@@ -342,15 +1063,15 @@ function registerListTasks(server2, conn2) {
342
1063
  "list_tasks",
343
1064
  "List project cards, optionally filtered by card type, status, or assignment (a specific assignee, or unassigned tasks). Defaults to type=task \u2014 pass typeFilters to list incidents/suggestions. Results are relevance-ordered: highest priority first then newest; suggestions-only queries rank by upvote score. Pass projectId to target a specific project; otherwise the configured default project is used. Returns summaries \u2014 plan omitted, description truncated; use get_task for full details.",
344
1065
  {
345
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
346
- status: z4.enum(STATUS_ENUM).optional().describe("Filter by task status"),
347
- typeFilters: z4.array(z4.enum(CARD_TYPE_ENUM)).optional().describe(
1066
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1067
+ status: z5.enum(STATUS_ENUM).optional().describe("Filter by task status"),
1068
+ typeFilters: z5.array(z5.enum(CARD_TYPE_ENUM)).optional().describe(
348
1069
  'Card types to include, e.g. ["incident"] or ["task", "incident"]. Omit for tasks only.'
349
1070
  ),
350
- assigneeId: z4.string().optional().describe("Filter by assigned user ID"),
351
- unassigned: z4.boolean().optional().describe("Only return tasks with no assignee (mutually exclusive with assigneeId)"),
1071
+ assigneeId: z5.string().optional().describe("Filter by assigned user ID"),
1072
+ unassigned: z5.boolean().optional().describe("Only return tasks with no assignee (mutually exclusive with assigneeId)"),
352
1073
  subProjectId: BOARD_FILTER,
353
- limit: z4.number().optional().describe("Max tasks to return (default 50)")
1074
+ limit: z5.number().optional().describe("Max tasks to return (default 50)")
354
1075
  },
355
1076
  async (params) => {
356
1077
  const tasks = await conn2.listTasks(params);
@@ -361,26 +1082,18 @@ function registerListTasks(server2, conn2) {
361
1082
  );
362
1083
  }
363
1084
  function registerGetTask(server2, conn2) {
364
- server2.tool(
365
- "get_task",
366
- "Get full task details including plan, chat history, PR info, subtasks, and build status. Pass projectId to target a specific project; otherwise the configured default project is used.",
367
- {
368
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
369
- taskId: z4.string().describe("The task ID or slug (the value in a card URL, /cards/<slug>)")
370
- },
371
- async (params) => {
372
- const task = await conn2.getTask(params.taskId, params.projectId);
373
- return { content: [{ type: "text", text: JSON.stringify(task, null, 2) }] };
374
- }
375
- );
1085
+ registerContractTool(server2, getTaskContract, async (params) => {
1086
+ const task = await conn2.getTask(params.taskId, params.projectId);
1087
+ return { content: [{ type: "text", text: JSON.stringify(task, null, 2) }] };
1088
+ });
376
1089
  }
377
1090
  function registerGetCardBySlug(server2, conn2) {
378
1091
  server2.tool(
379
1092
  "get_card_by_slug",
380
1093
  "Get full card details by the slug from a card URL (/cards/<slug>) instead of a task ID. Pass projectId to target a specific project; otherwise the configured default project is used.",
381
1094
  {
382
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
383
- slug: z4.string().describe("The card slug from a Conveyor card URL, e.g. 'ship-it'")
1095
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1096
+ slug: z5.string().describe("The card slug from a Conveyor card URL, e.g. 'ship-it'")
384
1097
  },
385
1098
  async (params) => {
386
1099
  const task = await conn2.getCardBySlug(params.slug, params.projectId);
@@ -393,11 +1106,11 @@ function registerCreateTask(server2, conn2) {
393
1106
  "create_task",
394
1107
  "Create a new task with title, description, and optional plan. Pass projectId to target a specific project; otherwise the configured default project is used. Icon, story points, and agent assignment are auto-filled when a task is created in (or later moved to) a status beyond Planning \u2014 don't spend turns on them.",
395
1108
  {
396
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
397
- title: z4.string().describe("Task title"),
398
- description: z4.string().optional().describe("Task description"),
399
- plan: z4.string().optional().describe("Task implementation plan (markdown)"),
400
- status: z4.enum(["Planning", "Open"]).optional().describe("Initial status (default: Planning)"),
1109
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1110
+ title: z5.string().describe("Task title"),
1111
+ description: z5.string().optional().describe("Task description"),
1112
+ plan: z5.string().optional().describe("Task implementation plan (markdown)"),
1113
+ status: z5.enum(["Planning", "Open"]).optional().describe("Initial status (default: Planning)"),
401
1114
  subProjectId: BOARD_ASSIGN
402
1115
  },
403
1116
  async (params) => {
@@ -418,17 +1131,17 @@ function registerUpdateTask(server2, conn2) {
418
1131
  "update_task",
419
1132
  "Update task fields: title, description, plan, status, risk, or assignment. Set status to claim a card (InProgress), triage it (Open), or cancel it (Cancelled); for review approvals prefer approve_task / request_changes, which guard against stale-state races. Pass projectId to target a specific project; otherwise the configured default project is used. Moving a task beyond Planning auto-fills any missing icon, story points, and agent assignment \u2014 don't spend turns on them.",
420
1133
  {
421
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
422
- taskId: z4.string().describe("The task ID"),
423
- title: z4.string().optional().describe("New title"),
424
- description: z4.string().optional().describe("New description"),
425
- plan: z4.string().optional().describe("New plan (markdown)"),
426
- status: z4.enum(STATUS_ENUM).optional().describe("New status"),
427
- risk: z4.enum(RISK_ENUM).nullable().optional().describe(
1134
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1135
+ taskId: z5.string().describe("The task ID"),
1136
+ title: z5.string().optional().describe("New title"),
1137
+ description: z5.string().optional().describe("New description"),
1138
+ plan: z5.string().optional().describe("New plan (markdown)"),
1139
+ status: z5.enum(STATUS_ENUM).optional().describe("New status"),
1140
+ risk: z5.enum(RISK_ENUM).nullable().optional().describe(
428
1141
  "Risk level \u2014 how much important surface the task touches (critical/high/medium/low). Pass null to clear."
429
1142
  ),
430
- assignedUserId: z4.string().nullable().optional().describe("User ID to assign, or null"),
431
- subProjectId: z4.string().nullable().optional().describe(
1143
+ assignedUserId: z5.string().nullable().optional().describe("User ID to assign, or null"),
1144
+ subProjectId: z5.string().nullable().optional().describe(
432
1145
  "Assign the task to a sub-project board; null moves it back to the parent board. Omit to leave unchanged."
433
1146
  )
434
1147
  },
@@ -445,9 +1158,9 @@ function registerMoveCard(server2, conn2) {
445
1158
  "move_card",
446
1159
  "Move an eligible Planning or Open task, incident, or suggestion card to another project. Cards with identification or automation in progress, active compute, pull requests, deployments, releases, reviews, or delivered reporter email cannot move. Project-specific metadata is cleared instead of mapped by name. Pass projectId for the source project; otherwise the configured default project is used.",
447
1160
  {
448
- projectId: z4.string().optional().describe("Source Conveyor project ID"),
449
- taskId: z4.string().describe("Card ID or slug"),
450
- destinationProjectId: z4.string().describe("Destination Conveyor project ID")
1161
+ projectId: z5.string().optional().describe("Source Conveyor project ID"),
1162
+ taskId: z5.string().describe("Card ID or slug"),
1163
+ destinationProjectId: z5.string().describe("Destination Conveyor project ID")
451
1164
  },
452
1165
  async (params) => {
453
1166
  const result = await conn2.moveCard(params);
@@ -464,44 +1177,37 @@ function registerMoveCard(server2, conn2) {
464
1177
  );
465
1178
  }
466
1179
  function registerChatTools(server2, conn2) {
467
- server2.tool(
468
- "read_task_chat",
469
- "Read messages from a task's chat. Pass projectId to target a specific project; otherwise the configured default project is used. For agent execution logs use get_task_logs.",
470
- {
471
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
472
- taskId: z4.string().describe("The task ID"),
473
- limit: z4.number().optional().describe("Max messages to return (default 50)")
474
- },
475
- async (params) => {
476
- const messages = await conn2.getTaskChat(params.taskId, params.limit, params.projectId);
477
- return { content: [{ type: "text", text: JSON.stringify(messages, null, 2) }] };
478
- }
479
- );
480
- server2.tool(
481
- "post_to_chat",
482
- "Post a message to a task's chat. Pass projectId to target a specific project; otherwise the configured default project is used.",
483
- {
484
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
485
- taskId: z4.string().describe("The task ID"),
486
- content: z4.string().describe("Message content")
487
- },
488
- async (params) => {
489
- await conn2.postToTaskChat(params.taskId, params.content, params.projectId);
490
- return { content: [{ type: "text", text: "Message posted" }] };
1180
+ registerContractTool(server2, readTaskChatContract, async (params) => {
1181
+ const messages = await conn2.getTaskChat(params.taskId, params.limit, params.projectId);
1182
+ return { content: [{ type: "text", text: JSON.stringify(messages, null, 2) }] };
1183
+ });
1184
+ registerContractTool(server2, postToChatContract, async (params) => {
1185
+ const text = params.content ?? params.message;
1186
+ if (text === void 0) {
1187
+ return {
1188
+ content: [
1189
+ {
1190
+ type: "text",
1191
+ text: "Nothing to post \u2014 provide `content` (or its alias `message`)."
1192
+ }
1193
+ ]
1194
+ };
491
1195
  }
492
- );
1196
+ await conn2.postToTaskChat(params.taskId, text, params.projectId);
1197
+ return { content: [{ type: "text", text: "Message posted" }] };
1198
+ });
493
1199
  }
494
1200
  function registerGetTaskCli(server2, conn2) {
495
1201
  server2.tool(
496
1202
  "get_task_logs",
497
1203
  "Read CLI execution logs from a task. Pass projectId to target a specific project; otherwise the configured default project is used. Returns agent reasoning, tool calls, setup output, and other execution events. For human chat use read_task_chat.",
498
1204
  {
499
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
500
- taskId: z4.string().describe("The task ID or slug"),
501
- source: z4.enum(["agent", "application"]).optional().describe(
1205
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1206
+ taskId: z5.string().describe("The task ID or slug"),
1207
+ source: z5.enum(["agent", "application"]).optional().describe(
502
1208
  "Filter by log source: 'agent' for reasoning/tool calls, 'application' for setup/dev-server output"
503
1209
  ),
504
- limit: z4.number().optional().describe("Max entries to return (default 50, max 500)")
1210
+ limit: z5.number().optional().describe("Max entries to return (default 50, max 500)")
505
1211
  },
506
1212
  async ({ taskId, source, limit, projectId: projectId2 }) => {
507
1213
  const effectiveLimit = Math.min(limit ?? 50, 500);
@@ -520,8 +1226,8 @@ function registerGetTaskSessions(server2, conn2) {
520
1226
  "get_task_sessions",
521
1227
  "Read compute-session state for a task: legacy CodespaceSession rows plus v3 workspaces, including purpose=review review workspaces. Shows pod identity, liveness, lifecycle, and code-review claim state. Use to diagnose stalled/dead agents or code-review runs. Pass projectId to target a specific project; otherwise the configured default project is used.",
522
1228
  {
523
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
524
- taskId: z4.string().describe("The task ID or slug")
1229
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1230
+ taskId: z5.string().describe("The task ID or slug")
525
1231
  },
526
1232
  async ({ taskId, projectId: projectId2 }) => {
527
1233
  const tasks = await conn2.getTaskSessions(taskId, projectId2);
@@ -539,17 +1245,17 @@ function registerSearchTasks(server2, conn2) {
539
1245
  "search_tasks",
540
1246
  "Search cards by tag name, text query, status, type, and/or assignment. Defaults to type=task \u2014 pass typeFilters to include incidents/suggestions. Results are relevance-ordered: highest priority first then newest; suggestions-only queries rank by upvote score. Pass projectId to target a specific project; otherwise the configured default project is used. Use tag names like 'agent-runner', not IDs. Returns summaries \u2014 plan omitted, description truncated; use get_task for full details.",
541
1247
  {
542
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
543
- tagNames: z4.array(z4.string()).optional().describe('Tag names to filter by (e.g., ["agent-runner", "chat"])'),
544
- searchQuery: z4.string().optional().describe("Text search on title and description"),
545
- statusFilters: z4.array(z4.enum(STATUS_ENUM)).optional().describe("Filter by one or more statuses"),
546
- typeFilters: z4.array(z4.enum(CARD_TYPE_ENUM)).optional().describe(
1248
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1249
+ tagNames: z5.array(z5.string()).optional().describe('Tag names to filter by (e.g., ["agent-runner", "chat"])'),
1250
+ searchQuery: z5.string().optional().describe("Text search on title and description"),
1251
+ statusFilters: z5.array(z5.enum(STATUS_ENUM)).optional().describe("Filter by one or more statuses"),
1252
+ typeFilters: z5.array(z5.enum(CARD_TYPE_ENUM)).optional().describe(
547
1253
  'Card types to include (default ["task"]). Pass e.g. ["incident"] or list several to search across types.'
548
1254
  ),
549
- assigneeId: z4.string().optional().describe("Filter by assigned user ID"),
550
- unassigned: z4.boolean().optional().describe("Only return tasks with no assignee (mutually exclusive with assigneeId)"),
1255
+ assigneeId: z5.string().optional().describe("Filter by assigned user ID"),
1256
+ unassigned: z5.boolean().optional().describe("Only return tasks with no assignee (mutually exclusive with assigneeId)"),
551
1257
  subProjectId: BOARD_FILTER,
552
- limit: z4.number().optional().describe("Max results to return (default 20)")
1258
+ limit: z5.number().optional().describe("Max results to return (default 20)")
553
1259
  },
554
1260
  async (params) => {
555
1261
  const tasks = await conn2.searchTasks(params);
@@ -560,26 +1266,19 @@ function registerSearchTasks(server2, conn2) {
560
1266
  );
561
1267
  }
562
1268
  function registerListTags(server2, conn2) {
563
- server2.tool(
564
- "list_tags",
565
- "List all project tags with their names, IDs, and colors. Pass projectId to target a specific project; otherwise the configured default project is used.",
566
- {
567
- projectId: z4.string().optional().describe("Target Conveyor project ID")
568
- },
569
- async (params) => {
570
- const tags = await conn2.listTags(params.projectId);
571
- return { content: [{ type: "text", text: JSON.stringify(tags, null, 2) }] };
572
- }
573
- );
1269
+ registerContractTool(server2, listTagsContract, async (params) => {
1270
+ const tags = await conn2.listTags(params.projectId);
1271
+ return { content: [{ type: "text", text: JSON.stringify(tags, null, 2) }] };
1272
+ });
574
1273
  }
575
1274
  function registerReviewTools(server2, conn2) {
576
1275
  server2.tool(
577
1276
  "approve_task",
578
1277
  "Move a task forward in the review flow (ReviewPR -> ReviewDev, or -> Complete). Pass projectId to target a specific project; otherwise the configured default project is used.",
579
1278
  {
580
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
581
- taskId: z4.string().describe("The task ID"),
582
- risk: z4.enum(RISK_ENUM).optional().describe("Optional risk level to record; defaults to a raise-only 'low' on approval.")
1279
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1280
+ taskId: z5.string().describe("The task ID"),
1281
+ risk: z5.enum(RISK_ENUM).optional().describe("Optional risk level to record; defaults to a raise-only 'low' on approval.")
583
1282
  },
584
1283
  async (params) => {
585
1284
  const result = await conn2.approveTask(params.taskId, params.projectId, params.risk);
@@ -588,33 +1287,25 @@ function registerReviewTools(server2, conn2) {
588
1287
  };
589
1288
  }
590
1289
  );
591
- server2.tool(
592
- "approve_and_merge_pr",
593
- "Approve and merge a child task's pull request. Pass projectId to target a specific project; otherwise the configured default project is used. Only succeeds if all CI/CD checks are passing. The child task must be in ReviewPR status with a PR.",
594
- {
595
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
596
- childTaskId: z4.string().describe("The child task ID whose PR should be approved and merged")
597
- },
598
- async (params) => {
599
- const result = await conn2.approveAndMergePR(params.childTaskId, params.projectId);
600
- return {
601
- content: [
602
- {
603
- type: "text",
604
- text: `PR #${result.prNumber} approved and merged for task ${result.childTaskId}`
605
- }
606
- ]
607
- };
608
- }
609
- );
1290
+ registerContractTool(server2, approveAndMergePrContract, async (params) => {
1291
+ const result = await conn2.approveAndMergePR(params.childTaskId, params.projectId);
1292
+ return {
1293
+ content: [
1294
+ {
1295
+ type: "text",
1296
+ text: `PR #${result.prNumber} approved and merged for task ${result.childTaskId}`
1297
+ }
1298
+ ]
1299
+ };
1300
+ });
610
1301
  server2.tool(
611
1302
  "request_changes",
612
1303
  "Post feedback and send task back to InProgress for more work. Pass projectId to target a specific project; otherwise the configured default project is used.",
613
1304
  {
614
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
615
- taskId: z4.string().describe("The task ID"),
616
- feedback: z4.string().describe("Feedback message describing requested changes"),
617
- risk: z4.enum(RISK_ENUM).optional().describe("Optional risk level to record; defaults to a raise-only 'medium' on changes.")
1305
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1306
+ taskId: z5.string().describe("The task ID"),
1307
+ feedback: z5.string().describe("Feedback message describing requested changes"),
1308
+ risk: z5.enum(RISK_ENUM).optional().describe("Optional risk level to record; defaults to a raise-only 'medium' on changes.")
618
1309
  },
619
1310
  async (params) => {
620
1311
  await conn2.requestChanges(params.taskId, params.feedback, params.projectId, params.risk);
@@ -631,9 +1322,9 @@ function registerReviewerTools(server2, conn2) {
631
1322
  "add_reviewer",
632
1323
  "Add a project member as a reviewer on a task. Pass projectId to target a specific project; otherwise the configured default project is used. Idempotent \u2014 adding an existing reviewer is a no-op.",
633
1324
  {
634
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
635
- taskId: z4.string().describe("The task ID or slug"),
636
- userId: z4.string().describe("User ID of the reviewer (use list_project_members to resolve a name or email)")
1325
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1326
+ taskId: z5.string().describe("The task ID or slug"),
1327
+ userId: z5.string().describe("User ID of the reviewer (use list_project_members to resolve a name or email)")
637
1328
  },
638
1329
  async (params) => {
639
1330
  const result = await conn2.addReviewer(params);
@@ -651,9 +1342,9 @@ function registerReviewerTools(server2, conn2) {
651
1342
  "remove_reviewer",
652
1343
  "Remove a reviewer from a task. Pass projectId to target a specific project; otherwise the configured default project is used. Idempotent \u2014 removing a non-reviewer is a no-op.",
653
1344
  {
654
- projectId: z4.string().optional().describe("Target Conveyor project ID"),
655
- taskId: z4.string().describe("The task ID or slug"),
656
- userId: z4.string().describe("User ID of the reviewer to remove")
1345
+ projectId: z5.string().optional().describe("Target Conveyor project ID"),
1346
+ taskId: z5.string().describe("The task ID or slug"),
1347
+ userId: z5.string().describe("User ID of the reviewer to remove")
657
1348
  },
658
1349
  async (params) => {
659
1350
  const result = await conn2.removeReviewer(params);
@@ -685,7 +1376,7 @@ function registerTaskTools(server2, conn2) {
685
1376
  }
686
1377
 
687
1378
  // src/tools/builds.ts
688
- import { z as z5 } from "zod";
1379
+ import { z as z6 } from "zod";
689
1380
  function textResult2(result) {
690
1381
  return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
691
1382
  }
@@ -694,8 +1385,8 @@ function registerTaskLifecycleTools(server2, conn2) {
694
1385
  "stop_task",
695
1386
  "Compatibility alias for the legacy stop path. stop_task now performs the same durable sleep behavior as sleep_task, preserving task Claudespace state while stopping compute. Pass projectId to target a specific project; otherwise the configured default project is used.",
696
1387
  {
697
- projectId: z5.string().optional().describe("Target Conveyor project ID"),
698
- taskId: z5.string().describe("The task ID")
1388
+ projectId: z6.string().optional().describe("Target Conveyor project ID"),
1389
+ taskId: z6.string().describe("The task ID")
699
1390
  },
700
1391
  async (params) => textResult2(await conn2.sleepTask(params.taskId, params.projectId))
701
1392
  );
@@ -703,8 +1394,8 @@ function registerTaskLifecycleTools(server2, conn2) {
703
1394
  "sleep_task",
704
1395
  "Sleep a task Claudespace, stopping compute while preserving durable state. Pass projectId to target a specific project; otherwise the configured default project is used.",
705
1396
  {
706
- projectId: z5.string().optional().describe("Target Conveyor project ID"),
707
- taskId: z5.string().describe("The task ID")
1397
+ projectId: z6.string().optional().describe("Target Conveyor project ID"),
1398
+ taskId: z6.string().describe("The task ID")
708
1399
  },
709
1400
  async (params) => textResult2(await conn2.sleepTask(params.taskId, params.projectId))
710
1401
  );
@@ -712,8 +1403,8 @@ function registerTaskLifecycleTools(server2, conn2) {
712
1403
  "resume_task",
713
1404
  "Resume a sleeping task Claudespace. Pass projectId to target a specific project; otherwise the configured default project is used.",
714
1405
  {
715
- projectId: z5.string().optional().describe("Target Conveyor project ID"),
716
- taskId: z5.string().describe("The task ID")
1406
+ projectId: z6.string().optional().describe("Target Conveyor project ID"),
1407
+ taskId: z6.string().describe("The task ID")
717
1408
  },
718
1409
  async (params) => textResult2(await conn2.resumeTask(params.taskId, params.projectId))
719
1410
  );
@@ -721,8 +1412,8 @@ function registerTaskLifecycleTools(server2, conn2) {
721
1412
  "delete_task_environment",
722
1413
  "Delete a task environment, including durable Claudespace state. Pass projectId to target a specific project; otherwise the configured default project is used.",
723
1414
  {
724
- projectId: z5.string().optional().describe("Target Conveyor project ID"),
725
- taskId: z5.string().describe("The task ID")
1415
+ projectId: z6.string().optional().describe("Target Conveyor project ID"),
1416
+ taskId: z6.string().describe("The task ID")
726
1417
  },
727
1418
  async (params) => textResult2(await conn2.deleteTaskEnvironment(params.taskId, params.projectId))
728
1419
  );
@@ -732,8 +1423,8 @@ function registerBuildTools(server2, conn2) {
732
1423
  "start_task",
733
1424
  "Start a cloud build (codespace) for a task. Pass projectId to target a specific project; otherwise the configured default project is used.",
734
1425
  {
735
- projectId: z5.string().optional().describe("Target Conveyor project ID"),
736
- taskId: z5.string().describe("The task ID")
1426
+ projectId: z6.string().optional().describe("Target Conveyor project ID"),
1427
+ taskId: z6.string().describe("The task ID")
737
1428
  },
738
1429
  async (params) => {
739
1430
  const result = await conn2.startBuild(params.taskId, params.projectId);
@@ -745,8 +1436,8 @@ function registerBuildTools(server2, conn2) {
745
1436
  "create_release",
746
1437
  "Create a release for the project \u2014 the same flow as the Release button in the web UI. Pass projectId to target a specific project; otherwise the configured default project is used. Creates a release task with a release/YYYY.MM.N branch and a PR from the dev branch to the default branch. Omit taskIds to release ALL cards currently in Review (Dev); pass a subset to cherry-pick \u2014 a cloud build agent then cherry-picks those changes and resolves conflicts. Fails if a release is already in progress or no cards are in Review (Dev).",
747
1438
  {
748
- projectId: z5.string().optional().describe("Target Conveyor project ID"),
749
- taskIds: z5.array(z5.string()).optional().describe(
1439
+ projectId: z6.string().optional().describe("Target Conveyor project ID"),
1440
+ taskIds: z6.array(z6.string()).optional().describe(
750
1441
  "Task IDs in Review (Dev) to cherry-pick into the release. Omit to release all of them."
751
1442
  )
752
1443
  },
@@ -759,8 +1450,8 @@ function registerBuildTools(server2, conn2) {
759
1450
  "get_build_status",
760
1451
  "Check codespace and agent status for a task. Pass projectId to target a specific project; otherwise the configured default project is used.",
761
1452
  {
762
- projectId: z5.string().optional().describe("Target Conveyor project ID"),
763
- taskId: z5.string().describe("The task ID")
1453
+ projectId: z6.string().optional().describe("Target Conveyor project ID"),
1454
+ taskId: z6.string().describe("The task ID")
764
1455
  },
765
1456
  async (params) => {
766
1457
  const status = await conn2.getBuildStatus(params.taskId, params.projectId);
@@ -772,7 +1463,6 @@ function registerBuildTools(server2, conn2) {
772
1463
  // src/tools/attachments.ts
773
1464
  import { readFile, stat } from "fs/promises";
774
1465
  import { basename, extname } from "path";
775
- import { z as z6 } from "zod";
776
1466
  var MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024;
777
1467
  var MIME_BY_EXT = {
778
1468
  ".png": "image/png",
@@ -805,18 +1495,10 @@ function inferMimeType(filePath, override) {
805
1495
  return MIME_BY_EXT[extname(filePath).toLowerCase()] ?? "application/octet-stream";
806
1496
  }
807
1497
  function registerListTaskFiles(server2, conn2) {
808
- server2.tool(
809
- "list_task_files",
810
- "List all files attached to a task with metadata (no contents \u2014 fast and small). Pass projectId to target a specific project; otherwise the configured default project is used. Use before fetching a specific file to see what is available and how large each is. For file contents use get_attachment.",
811
- {
812
- projectId: z6.string().optional().describe("Target Conveyor project ID"),
813
- taskId: z6.string().describe("The task ID or slug")
814
- },
815
- async (params) => {
816
- const files = await conn2.listTaskFiles(params.taskId, params.projectId);
817
- return { content: [{ type: "text", text: JSON.stringify(files, null, 2) }] };
818
- }
819
- );
1498
+ registerContractTool(server2, listTaskFilesContract, async (params) => {
1499
+ const files = await conn2.listTaskFiles(params.taskId, params.projectId);
1500
+ return { content: [{ type: "text", text: JSON.stringify(files, null, 2) }] };
1501
+ });
820
1502
  }
821
1503
  function buildTextContent(file, content) {
822
1504
  const start = file.contentByteOffset ?? 0;
@@ -848,90 +1530,68 @@ function buildAttachmentContent(file) {
848
1530
  return [{ type: "text", text: JSON.stringify(metadata, null, 2) }];
849
1531
  }
850
1532
  function registerGetAttachment(server2, conn2) {
851
- server2.tool(
852
- "get_attachment",
853
- "Fetch one task file's content plus metadata by file ID (accepts task id or slug). Pass projectId to target a specific project; otherwise the configured default project is used. Images are returned as viewable image blocks. Large text files (logs, JSON) are returned in pages \u2014 use `offset`/`maxBytes` to read more, or fetch `downloadUrl` for the whole file. Call list_task_files first to discover IDs and sizes.",
854
- {
855
- projectId: z6.string().optional().describe("Target Conveyor project ID"),
856
- taskId: z6.string().describe("The task ID or slug"),
857
- fileId: z6.string().describe("The file ID to fetch"),
858
- offset: z6.number().int().nonnegative().optional().describe("Byte offset into text content (paging). Default 0."),
859
- maxBytes: z6.number().int().positive().optional().describe("Max bytes of text content to return from offset.")
860
- },
861
- async (params) => {
862
- const file = await conn2.getAttachment(params.taskId, params.fileId, {
863
- offset: params.offset,
864
- maxBytes: params.maxBytes,
865
- projectId: params.projectId
866
- });
867
- return { content: buildAttachmentContent(file) };
868
- }
869
- );
1533
+ registerContractTool(server2, getAttachmentContract, async (params) => {
1534
+ const file = await conn2.getAttachment(params.taskId, params.fileId, {
1535
+ offset: params.offset,
1536
+ maxBytes: params.maxBytes,
1537
+ projectId: params.projectId
1538
+ });
1539
+ return { content: buildAttachmentContent(file) };
1540
+ });
870
1541
  }
871
1542
  function registerUploadAttachment(server2, conn2) {
872
- server2.tool(
873
- "upload_attachment",
874
- "Upload a local file as a task attachment (any file type, up to 25MB). Pass projectId to target a specific project; otherwise the configured default project is used. The file appears under the task's Files. Pass `comment` to also post it to the task chat in the same step.",
875
- {
876
- projectId: z6.string().optional().describe("Target Conveyor project ID"),
877
- taskId: z6.string().describe("The task ID or slug"),
878
- path: z6.string().describe("Absolute path to the local file to upload"),
879
- comment: z6.string().optional().describe("When set, also posts the attachment to the task chat with this text"),
880
- mimeType: z6.string().optional().describe("Override the mime type inferred from the file extension")
881
- },
882
- async (params) => {
883
- const info = await stat(params.path).catch(() => null);
884
- if (!info?.isFile()) {
885
- return { content: [{ type: "text", text: `File not found: ${params.path}` }] };
886
- }
887
- if (info.size > MAX_FILE_SIZE_BYTES) {
888
- return {
889
- content: [
890
- {
891
- type: "text",
892
- text: `File is ${info.size} bytes \u2014 exceeds the ${MAX_FILE_SIZE_BYTES} byte (25MB) upload limit.`
893
- }
894
- ]
895
- };
896
- }
897
- const fileName = basename(params.path);
898
- const mimeType = inferMimeType(params.path, params.mimeType);
899
- const { fileId, uploadUrl } = await conn2.requestFileUpload(params.taskId, {
900
- fileName,
901
- mimeType,
902
- fileSize: info.size,
903
- projectId: params.projectId
904
- });
905
- const body = await readFile(params.path);
906
- const res = await fetch(uploadUrl, {
907
- method: "PUT",
908
- headers: { "Content-Type": mimeType },
909
- body
910
- });
911
- if (!res.ok) {
912
- return {
913
- content: [
914
- {
915
- type: "text",
916
- text: `Upload to storage failed: HTTP ${res.status} ${await res.text().catch(() => "")}`
917
- }
918
- ]
919
- };
920
- }
921
- const result = await conn2.confirmFileUpload(
922
- params.taskId,
923
- fileId,
924
- params.comment,
925
- params.projectId
926
- );
927
- const lines = [
928
- `Uploaded ${result.fileName} (${info.size} bytes, ${mimeType}). File ID: ${result.fileId}`
929
- ];
930
- if (result.downloadUrl) lines.push(`downloadUrl: ${result.downloadUrl}`);
931
- if (result.messageId) lines.push("Posted to the task chat.");
932
- return { content: [{ type: "text", text: lines.join("\n") }] };
1543
+ registerContractTool(server2, uploadAttachmentContract, async (params) => {
1544
+ const info = await stat(params.path).catch(() => null);
1545
+ if (!info?.isFile()) {
1546
+ return { content: [{ type: "text", text: `File not found: ${params.path}` }] };
933
1547
  }
934
- );
1548
+ if (info.size > MAX_FILE_SIZE_BYTES) {
1549
+ return {
1550
+ content: [
1551
+ {
1552
+ type: "text",
1553
+ text: `File is ${info.size} bytes \u2014 exceeds the ${MAX_FILE_SIZE_BYTES} byte (25MB) upload limit.`
1554
+ }
1555
+ ]
1556
+ };
1557
+ }
1558
+ const fileName = basename(params.path);
1559
+ const mimeType = inferMimeType(params.path, params.mimeType);
1560
+ const { fileId, uploadUrl } = await conn2.requestFileUpload(params.taskId, {
1561
+ fileName,
1562
+ mimeType,
1563
+ fileSize: info.size,
1564
+ projectId: params.projectId
1565
+ });
1566
+ const body = await readFile(params.path);
1567
+ const res = await fetch(uploadUrl, {
1568
+ method: "PUT",
1569
+ headers: { "Content-Type": mimeType },
1570
+ body
1571
+ });
1572
+ if (!res.ok) {
1573
+ return {
1574
+ content: [
1575
+ {
1576
+ type: "text",
1577
+ text: `Upload to storage failed: HTTP ${res.status} ${await res.text().catch(() => "")}`
1578
+ }
1579
+ ]
1580
+ };
1581
+ }
1582
+ const result = await conn2.confirmFileUpload(
1583
+ params.taskId,
1584
+ fileId,
1585
+ params.comment,
1586
+ params.projectId
1587
+ );
1588
+ const lines = [
1589
+ `Uploaded ${result.fileName} (${info.size} bytes, ${mimeType}). File ID: ${result.fileId}`
1590
+ ];
1591
+ if (result.downloadUrl) lines.push(`downloadUrl: ${result.downloadUrl}`);
1592
+ if (result.messageId) lines.push("Posted to the task chat.");
1593
+ return { content: [{ type: "text", text: lines.join("\n") }] };
1594
+ });
935
1595
  }
936
1596
  function registerAttachmentTools(server2, conn2) {
937
1597
  registerListTaskFiles(server2, conn2);
@@ -940,126 +1600,45 @@ function registerAttachmentTools(server2, conn2) {
940
1600
  }
941
1601
 
942
1602
  // src/tools/pull-request.ts
943
- import { z as z7 } from "zod";
944
1603
  function registerPullRequestTools(server2, conn2) {
945
- server2.tool(
946
- "create_pull_request",
947
- "Open a GitHub pull request for a task's existing branch (the branch must already be pushed to origin). Pass projectId to target a specific project; otherwise the configured default project is used. Moves the task to ReviewPR. Returns the PR number and URL.",
948
- {
949
- projectId: z7.string().optional().describe("Target Conveyor project ID"),
950
- taskId: z7.string().describe("The task ID whose branch should be opened as a PR"),
951
- title: z7.string().describe("Pull request title"),
952
- body: z7.string().describe("Pull request body (markdown)"),
953
- head: z7.string().optional().describe("Source branch for the PR (defaults to the task's branch)"),
954
- base: z7.string().optional().describe("Target branch for the PR (defaults to the repo default)")
955
- },
956
- async (params) => {
957
- const result = await conn2.createPullRequest(params);
958
- return {
959
- content: [{ type: "text", text: `PR #${result.prNumber} opened: ${result.prUrl}` }]
960
- };
961
- }
962
- );
1604
+ registerContractTool(server2, createPullRequestContract, async (params) => {
1605
+ const result = await conn2.createPullRequest(params);
1606
+ return {
1607
+ content: [{ type: "text", text: `PR #${result.prNumber} opened: ${result.prUrl}` }]
1608
+ };
1609
+ });
963
1610
  }
964
1611
 
965
1612
  // src/tools/subtasks.ts
966
- import { z as z8 } from "zod";
967
- var STATUS_ENUM2 = [
968
- "Planning",
969
- "Open",
970
- "InProgress",
971
- "ReviewPR",
972
- "ReviewDev",
973
- "ReviewLive",
974
- "Complete",
975
- "Cancelled"
976
- ];
977
- var SP_DESCRIPTION = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
978
- var FOLLOW_PARENT_STATUS_DESCRIPTION = "When true, this subtask mirrors the parent task's status automatically \u2014 for children that ship on the parent's branch/PR and have no build or PR of their own. Manual status writes on a follower stick only until the parent's next transition.";
979
1613
  function registerCreateSubtask(server2, conn2) {
980
- server2.tool(
981
- "create_subtask",
982
- "Create a subtask under a parent task. Pass projectId to target a specific project; otherwise the configured default project is used. Subtasks break a larger task into independently buildable pieces. For children that instead ship on the parent's own branch/PR (e.g. per-theme tracking cards for one bundled PR), set followParentStatus so their status rides the parent's automatically.",
983
- {
984
- projectId: z8.string().optional().describe("Target Conveyor project ID"),
985
- parentTaskId: z8.string().describe("The parent task ID"),
986
- title: z8.string().describe("Subtask title"),
987
- description: z8.string().optional().describe("Subtask description"),
988
- plan: z8.string().optional().describe("Subtask implementation plan (markdown)"),
989
- ordinal: z8.number().optional().describe("Ordering position among siblings"),
990
- storyPointValue: z8.number().optional().describe(SP_DESCRIPTION),
991
- followParentStatus: z8.boolean().optional().describe(FOLLOW_PARENT_STATUS_DESCRIPTION),
992
- dependsOn: z8.array(z8.string()).optional().describe(
993
- "Sibling subtask ids or slugs this subtask blocks on (it won't start until they merge to dev). Set explicit dependency metadata here instead of describing order in the plan text. Omit / leave empty for independent children so they run in parallel."
994
- )
995
- },
996
- async (params) => {
997
- const subtask = await conn2.createSubtask(params);
998
- return {
999
- content: [{ type: "text", text: `Subtask created: ${subtask.id} (slug: ${subtask.slug})` }]
1000
- };
1001
- }
1002
- );
1614
+ registerContractTool(server2, createSubtaskContract, async (params) => {
1615
+ const subtask = await conn2.createSubtask(params);
1616
+ return {
1617
+ content: [{ type: "text", text: `Subtask created: ${subtask.id} (slug: ${subtask.slug})` }]
1618
+ };
1619
+ });
1003
1620
  }
1004
1621
  function registerUpdateSubtask(server2, conn2) {
1005
- server2.tool(
1006
- "update_subtask",
1007
- "Update a subtask's fields: title, description, plan, status, ordering, story points, or dependencies. Pass projectId to target a specific project; otherwise the configured default project is used. Moving a subtask beyond Planning auto-fills missing story points and agent assignment \u2014 don't spend turns on them.",
1008
- {
1009
- projectId: z8.string().optional().describe("Target Conveyor project ID"),
1010
- subtaskId: z8.string().describe("The subtask ID"),
1011
- title: z8.string().optional().describe("New title"),
1012
- description: z8.string().optional().describe("New description"),
1013
- plan: z8.string().optional().describe("New plan (markdown)"),
1014
- status: z8.enum(STATUS_ENUM2).optional().describe("New status"),
1015
- ordinal: z8.number().optional().describe("New ordering position among siblings"),
1016
- storyPointValue: z8.number().optional().describe(SP_DESCRIPTION),
1017
- followParentStatus: z8.boolean().optional().describe(FOLLOW_PARENT_STATUS_DESCRIPTION),
1018
- dependsOn: z8.array(z8.string()).optional().describe(
1019
- "Replace the sibling subtask ids/slugs this subtask blocks on (pass [] to clear). Omit to leave dependencies unchanged."
1020
- )
1021
- },
1022
- async (params) => {
1023
- const result = await conn2.updateSubtask(params);
1024
- return {
1025
- content: [
1026
- { type: "text", text: `Subtask ${result.id} updated (status: ${result.status})` }
1027
- ]
1028
- };
1029
- }
1030
- );
1622
+ registerContractTool(server2, updateSubtaskContract, async (params) => {
1623
+ const result = await conn2.updateSubtask(params);
1624
+ return {
1625
+ content: [{ type: "text", text: `Subtask ${result.id} updated (status: ${result.status})` }]
1626
+ };
1627
+ });
1031
1628
  }
1032
1629
  function registerListSubtasks(server2, conn2) {
1033
- server2.tool(
1034
- "list_subtasks",
1035
- "List all subtasks of a parent task with their status and ordering. Pass projectId to target a specific project; otherwise the configured default project is used.",
1036
- {
1037
- projectId: z8.string().optional().describe("Target Conveyor project ID"),
1038
- taskId: z8.string().describe("The parent task ID")
1039
- },
1040
- async (params) => {
1041
- const subtasks = await conn2.listSubtasks(params.taskId, params.projectId);
1042
- return { content: [{ type: "text", text: JSON.stringify(subtasks, null, 2) }] };
1043
- }
1044
- );
1630
+ registerContractTool(server2, listSubtasksContract, async (params) => {
1631
+ const subtasks = await conn2.listSubtasks(params.taskId, params.projectId);
1632
+ return { content: [{ type: "text", text: JSON.stringify(subtasks, null, 2) }] };
1633
+ });
1045
1634
  }
1046
1635
  function registerDeleteSubtask(server2, conn2) {
1047
- server2.tool(
1048
- "delete_subtask",
1049
- "Delete a subtask by ID. Pass projectId to target a specific project; otherwise the configured default project is used. This is permanent \u2014 use update_subtask to set status to Cancelled if you only want to close it.",
1050
- {
1051
- projectId: z8.string().optional().describe("Target Conveyor project ID"),
1052
- subtaskId: z8.string().describe("The subtask ID to delete")
1053
- },
1054
- async (params) => {
1055
- const result = await conn2.deleteSubtask(params.subtaskId, params.projectId);
1056
- return {
1057
- content: [
1058
- { type: "text", text: result.deleted ? "Subtask deleted" : "Subtask not deleted" }
1059
- ]
1060
- };
1061
- }
1062
- );
1636
+ registerContractTool(server2, deleteSubtaskContract, async (params) => {
1637
+ const result = await conn2.deleteSubtask(params.subtaskId, params.projectId);
1638
+ return {
1639
+ content: [{ type: "text", text: result.deleted ? "Subtask deleted" : "Subtask not deleted" }]
1640
+ };
1641
+ });
1063
1642
  }
1064
1643
  function registerSubtaskTools(server2, conn2) {
1065
1644
  registerCreateSubtask(server2, conn2);
@@ -1069,50 +1648,23 @@ function registerSubtaskTools(server2, conn2) {
1069
1648
  }
1070
1649
 
1071
1650
  // src/tools/dependencies.ts
1072
- import { z as z9 } from "zod";
1073
1651
  function registerGetDependencies(server2, conn2) {
1074
- server2.tool(
1075
- "get_dependencies",
1076
- "Get a task's dependencies and their met/unmet status (met = merged to dev). Pass projectId to target a specific project; otherwise the configured default project is used. Use to confirm blockers merged, or see why a task cannot start. For task state use get_task.",
1077
- {
1078
- projectId: z9.string().optional().describe("Target Conveyor project ID"),
1079
- taskId: z9.string().describe("The task ID")
1080
- },
1081
- async (params) => {
1082
- const deps = await conn2.getDependencies(params.taskId, params.projectId);
1083
- return { content: [{ type: "text", text: JSON.stringify(deps, null, 2) }] };
1084
- }
1085
- );
1652
+ registerContractTool(server2, getDependenciesContract, async (params) => {
1653
+ const deps = await conn2.getDependencies(params.taskId, params.projectId);
1654
+ return { content: [{ type: "text", text: JSON.stringify(deps, null, 2) }] };
1655
+ });
1086
1656
  }
1087
1657
  function registerAddDependency(server2, conn2) {
1088
- server2.tool(
1089
- "add_dependency",
1090
- "Add a blocking dependency \u2014 this task cannot start until the named task is merged to dev. Pass projectId to target a specific project; otherwise the configured default project is used.",
1091
- {
1092
- projectId: z9.string().optional().describe("Target Conveyor project ID"),
1093
- taskId: z9.string().describe("The task ID that will be blocked"),
1094
- dependsOnSlugOrId: z9.string().describe("Slug or ID of the task this one depends on")
1095
- },
1096
- async (params) => {
1097
- await conn2.addDependency(params);
1098
- return { content: [{ type: "text", text: "Dependency added" }] };
1099
- }
1100
- );
1658
+ registerContractTool(server2, addDependencyContract, async (params) => {
1659
+ await conn2.addDependency(params);
1660
+ return { content: [{ type: "text", text: "Dependency added" }] };
1661
+ });
1101
1662
  }
1102
1663
  function registerRemoveDependency(server2, conn2) {
1103
- server2.tool(
1104
- "remove_dependency",
1105
- "Remove a previously added dependency from a task. Pass projectId to target a specific project; otherwise the configured default project is used. The task is no longer blocked by the named task. Returns: confirmation string.",
1106
- {
1107
- projectId: z9.string().optional().describe("Target Conveyor project ID"),
1108
- taskId: z9.string().describe("The task ID to unblock"),
1109
- dependsOnSlugOrId: z9.string().describe("Slug or ID of the dependency to remove")
1110
- },
1111
- async (params) => {
1112
- await conn2.removeDependency(params);
1113
- return { content: [{ type: "text", text: "Dependency removed" }] };
1114
- }
1115
- );
1664
+ registerContractTool(server2, removeDependencyContract, async (params) => {
1665
+ await conn2.removeDependency(params);
1666
+ return { content: [{ type: "text", text: "Dependency removed" }] };
1667
+ });
1116
1668
  }
1117
1669
  function registerDependencyTools(server2, conn2) {
1118
1670
  registerGetDependencies(server2, conn2);
@@ -1121,27 +1673,15 @@ function registerDependencyTools(server2, conn2) {
1121
1673
  }
1122
1674
 
1123
1675
  // src/tools/suggestions.ts
1124
- import { z as z10 } from "zod";
1125
1676
  function registerSuggestionTools(server2, conn2) {
1126
- server2.tool(
1127
- "create_suggestion",
1128
- "Suggest a feature, improvement, rule, or idea for the project. Pass projectId to target a specific project; otherwise the configured default project is used. Duplicates are deduped and your upvote is recorded.",
1129
- {
1130
- projectId: z10.string().optional().describe("Target Conveyor project ID"),
1131
- title: z10.string().describe("Suggestion title"),
1132
- description: z10.string().optional().describe("Suggestion details (markdown)"),
1133
- tagNames: z10.array(z10.string()).optional().describe('Tag names to categorize the suggestion (e.g., ["agent-runner"])')
1134
- },
1135
- async (params) => {
1136
- const result = await conn2.createSuggestion(params);
1137
- const text = result.merged ? `Suggestion merged into existing suggestion ${result.mergedIntoId} (upvote recorded)` : `Suggestion created: ${result.id}`;
1138
- return { content: [{ type: "text", text }] };
1139
- }
1140
- );
1677
+ registerContractTool(server2, createSuggestionContract, async (params) => {
1678
+ const result = await conn2.createSuggestion(params);
1679
+ const text = result.merged ? `Suggestion merged into existing suggestion ${result.mergedIntoId} (upvote recorded)` : `Suggestion created: ${result.id}`;
1680
+ return { content: [{ type: "text", text }] };
1681
+ });
1141
1682
  }
1142
1683
 
1143
1684
  // src/tools/checklists.ts
1144
- import { z as z11 } from "zod";
1145
1685
  function renderManualTestGroups(groups) {
1146
1686
  const lines = [];
1147
1687
  for (const g of groups) {
@@ -1150,8 +1690,8 @@ function renderManualTestGroups(groups) {
1150
1690
  const mark = t.status === "approved" ? "\u2713" : t.status === "rejected" ? "\u2717" : "\u25CB";
1151
1691
  lines.push(` ${mark} ${t.title} \u2014 ${t.status}`);
1152
1692
  if (t.status === "rejected") {
1153
- for (const f of t.failures ?? []) {
1154
- lines.push(` \u26A0 ${f.userName ?? "Someone"}: ${f.reason ?? "(no message)"}`);
1693
+ for (const f2 of t.failures ?? []) {
1694
+ lines.push(` \u26A0 ${f2.userName ?? "Someone"}: ${f2.reason ?? "(no message)"}`);
1155
1695
  }
1156
1696
  }
1157
1697
  }
@@ -1160,139 +1700,75 @@ function renderManualTestGroups(groups) {
1160
1700
  return lines.join("\n").trimEnd();
1161
1701
  }
1162
1702
  function registerListManualTests(server2, conn2) {
1163
- server2.tool(
1164
- "list_manual_tests",
1165
- "List the manual test checklist items for a task. Pass projectId to target a specific project; otherwise the configured default project is used. Use to see what manual verification steps have already been recorded.",
1166
- {
1167
- projectId: z11.string().optional().describe("Target Conveyor project ID"),
1168
- taskId: z11.string().describe("The task ID or slug (the value in a card URL, /cards/<slug>)")
1169
- },
1170
- async (params) => {
1171
- const items = await conn2.listManualTests(params.taskId, params.projectId);
1172
- if (items.length === 0) {
1173
- return { content: [{ type: "text", text: "No manual tests recorded for this task." }] };
1174
- }
1175
- const lines = items.flatMap((item, i) => {
1176
- const checked = item.checked ? "[x]" : "[ ]";
1177
- const row = [`${i + 1}. ${checked} ${item.title}`];
1178
- for (const f of item.failures ?? []) {
1179
- const who = f.userName ?? "Someone";
1180
- const reason = f.reason ?? "(no message)";
1181
- row.push(` \u26A0 Failed (${who}): ${reason}`);
1182
- }
1183
- return row;
1184
- });
1185
- return { content: [{ type: "text", text: lines.join("\n") }] };
1703
+ registerContractTool(server2, listManualTestsContract, async (params) => {
1704
+ const items = await conn2.listManualTests(params.taskId, params.projectId);
1705
+ if (items.length === 0) {
1706
+ return { content: [{ type: "text", text: "No manual tests recorded for this task." }] };
1186
1707
  }
1187
- );
1708
+ const lines = items.flatMap((item, i) => {
1709
+ const checked = item.checked ? "[x]" : "[ ]";
1710
+ const row = [`${i + 1}. ${checked} ${item.title}`];
1711
+ for (const f2 of item.failures ?? []) {
1712
+ const who = f2.userName ?? "Someone";
1713
+ const reason = f2.reason ?? "(no message)";
1714
+ row.push(` \u26A0 Failed (${who}): ${reason}`);
1715
+ }
1716
+ return row;
1717
+ });
1718
+ return { content: [{ type: "text", text: lines.join("\n") }] };
1719
+ });
1188
1720
  }
1189
1721
  function registerSetManualTests(server2, conn2) {
1190
- server2.tool(
1191
- "set_manual_tests",
1192
- "Add manual test steps to a task's checklist. Pass projectId to target a specific project; otherwise the configured default project is used. Existing items with the same title are automatically skipped (deduplication). Use to record specific manual verification steps that reviewers should follow when testing the task's PR.",
1193
- {
1194
- projectId: z11.string().optional().describe("Target Conveyor project ID"),
1195
- taskId: z11.string().describe("The task ID or slug"),
1196
- items: z11.array(z11.object({ title: z11.string().min(1).describe("A concise, actionable test step") })).min(1).describe("List of manual test steps to add")
1197
- },
1198
- async (params) => {
1199
- const result = await conn2.setManualTests(params.taskId, params.items, params.projectId);
1200
- const parts = [`Created ${result.created} manual test item(s).`];
1201
- if (result.skipped > 0) parts.push(`Skipped ${result.skipped} duplicate(s).`);
1202
- return { content: [{ type: "text", text: parts.join(" ") }] };
1203
- }
1204
- );
1722
+ registerContractTool(server2, setManualTestsContract, async (params) => {
1723
+ const result = await conn2.setManualTests(params.taskId, params.items, params.projectId);
1724
+ const parts = [`Created ${result.created} manual test item(s).`];
1725
+ if (result.skipped > 0) parts.push(`Skipped ${result.skipped} duplicate(s).`);
1726
+ return { content: [{ type: "text", text: parts.join(" ") }] };
1727
+ });
1205
1728
  }
1206
1729
  function registerEditManualTest(server2, conn2) {
1207
- server2.tool(
1208
- "edit_manual_test",
1209
- "Rename an existing manual test step on a task. Pass projectId to target a specific project; otherwise the configured default project is used. Identify the test by its current title (case-insensitive) and pass the new title to replace it.",
1210
- {
1211
- projectId: z11.string().optional().describe("Target Conveyor project ID"),
1212
- taskId: z11.string().describe("The task ID or slug"),
1213
- title: z11.string().min(1).describe("The current title of the manual test to edit"),
1214
- newTitle: z11.string().min(1).describe("The new title for the manual test")
1215
- },
1216
- async (params) => {
1217
- await conn2.editManualTest(params.taskId, params.title, params.newTitle, params.projectId);
1218
- return { content: [{ type: "text", text: `Updated manual test to "${params.newTitle}".` }] };
1219
- }
1220
- );
1730
+ registerContractTool(server2, editManualTestContract, async (params) => {
1731
+ await conn2.editManualTest(params.taskId, params.title, params.newTitle, params.projectId);
1732
+ return { content: [{ type: "text", text: `Updated manual test to "${params.newTitle}".` }] };
1733
+ });
1221
1734
  }
1222
1735
  function registerRemoveManualTest(server2, conn2) {
1223
- server2.tool(
1224
- "remove_manual_test",
1225
- "Remove an existing manual test step from a task's checklist. Pass projectId to target a specific project; otherwise the configured default project is used. Identify the test by its title (case-insensitive).",
1226
- {
1227
- projectId: z11.string().optional().describe("Target Conveyor project ID"),
1228
- taskId: z11.string().describe("The task ID or slug"),
1229
- title: z11.string().min(1).describe("The title of the manual test to remove")
1230
- },
1231
- async (params) => {
1232
- await conn2.removeManualTest(params.taskId, params.title, params.projectId);
1233
- return { content: [{ type: "text", text: `Removed manual test "${params.title}".` }] };
1234
- }
1235
- );
1736
+ registerContractTool(server2, removeManualTestContract, async (params) => {
1737
+ await conn2.removeManualTest(params.taskId, params.title, params.projectId);
1738
+ return { content: [{ type: "text", text: `Removed manual test "${params.title}".` }] };
1739
+ });
1236
1740
  }
1237
1741
  function registerApproveManualTest(server2, conn2) {
1238
- server2.tool(
1239
- "approve_manual_test",
1240
- "Sign off on (approve) a manual test step on a task on behalf of your authenticated user. Pass projectId to target a specific project; otherwise the configured default project is used. Identify the test by its title (case-insensitive). Use after you have verified the step passes.",
1241
- {
1242
- projectId: z11.string().optional().describe("Target Conveyor project ID"),
1243
- taskId: z11.string().describe("The task ID or slug"),
1244
- title: z11.string().min(1).describe("The title of the manual test to approve")
1245
- },
1246
- async (params) => {
1247
- await conn2.approveManualTest(params.taskId, params.title, params.projectId);
1248
- return { content: [{ type: "text", text: `Approved manual test "${params.title}".` }] };
1249
- }
1250
- );
1742
+ registerContractTool(server2, approveManualTestContract, async (params) => {
1743
+ await conn2.approveManualTest(params.taskId, params.title, params.projectId);
1744
+ return { content: [{ type: "text", text: `Approved manual test "${params.title}".` }] };
1745
+ });
1251
1746
  }
1252
1747
  function registerRejectManualTest(server2, conn2) {
1253
- server2.tool(
1254
- "reject_manual_test",
1255
- "Flag an issue with (reject) a manual test step on a task on behalf of your authenticated user, recording the reason. Pass projectId to target a specific project; otherwise the configured default project is used. Identify the test by its title (case-insensitive). Use when the step fails verification.",
1256
- {
1257
- projectId: z11.string().optional().describe("Target Conveyor project ID"),
1258
- taskId: z11.string().describe("The task ID or slug"),
1259
- title: z11.string().min(1).describe("The title of the manual test to reject"),
1260
- reason: z11.string().min(1).max(2e3).describe("Why the test failed \u2014 what went wrong, shown to the team")
1261
- },
1262
- async (params) => {
1263
- await conn2.rejectManualTest(params.taskId, params.title, params.reason, params.projectId);
1264
- return {
1265
- content: [
1266
- {
1267
- type: "text",
1268
- text: `Flagged an issue with manual test "${params.title}": ${params.reason}`
1269
- }
1270
- ]
1271
- };
1272
- }
1273
- );
1748
+ registerContractTool(server2, rejectManualTestContract, async (params) => {
1749
+ await conn2.rejectManualTest(params.taskId, params.title, params.reason, params.projectId);
1750
+ return {
1751
+ content: [
1752
+ {
1753
+ type: "text",
1754
+ text: `Flagged an issue with manual test "${params.title}": ${params.reason}`
1755
+ }
1756
+ ]
1757
+ };
1758
+ });
1274
1759
  }
1275
1760
  function registerQueryManualTests(server2, conn2) {
1276
- server2.tool(
1277
- "query_manual_tests",
1278
- "Query manual tests across many tasks in a project, grouped by task. Filter by card status (e.g. ReviewDev, ReviewLive, Complete) and/or test status (open | approved | rejected). Use to answer questions like 'show all OPEN manual tests in ReviewDev' or 'show all REJECTED manual tests in ReviewDev/ReviewLive with the failing reason'. With no filters it defaults to the needs-attention view: open+rejected tests on ReviewDev/ReviewLive cards. Pass projectId to target a specific project; otherwise the configured default project is used.",
1279
- {
1280
- projectId: z11.string().optional().describe("Target Conveyor project ID"),
1281
- cardStatuses: z11.array(z11.string()).optional().describe('Filter tasks by card/column status, e.g. ["ReviewDev", "ReviewLive"]'),
1282
- testStatuses: z11.array(z11.enum(["open", "approved", "rejected"])).optional().describe("Filter tests by status: open | approved | rejected")
1283
- },
1284
- async (params) => {
1285
- const groups = await conn2.queryManualTests({
1286
- projectId: params.projectId,
1287
- cardStatuses: params.cardStatuses,
1288
- testStatuses: params.testStatuses
1289
- });
1290
- if (groups.length === 0) {
1291
- return { content: [{ type: "text", text: "No manual tests match those filters." }] };
1292
- }
1293
- return { content: [{ type: "text", text: renderManualTestGroups(groups) }] };
1761
+ registerContractTool(server2, queryManualTestsContract, async (params) => {
1762
+ const groups = await conn2.queryManualTests({
1763
+ projectId: params.projectId,
1764
+ cardStatuses: params.cardStatuses,
1765
+ testStatuses: params.testStatuses
1766
+ });
1767
+ if (groups.length === 0) {
1768
+ return { content: [{ type: "text", text: "No manual tests match those filters." }] };
1294
1769
  }
1295
- );
1770
+ return { content: [{ type: "text", text: renderManualTestGroups(groups) }] };
1771
+ });
1296
1772
  }
1297
1773
  function registerChecklistTools(server2, conn2) {
1298
1774
  registerListManualTests(server2, conn2);
@@ -1305,7 +1781,7 @@ function registerChecklistTools(server2, conn2) {
1305
1781
  }
1306
1782
 
1307
1783
  // src/tools/workspace.ts
1308
- import { z as z12 } from "zod";
1784
+ import { z as z7 } from "zod";
1309
1785
 
1310
1786
  // src/workspace-ssh-tunnel.ts
1311
1787
  import net from "net";
@@ -1425,8 +1901,8 @@ function registerAttachInfoTool(server2, conn2) {
1425
1901
  "workspace_attach_info",
1426
1902
  "Return SSH/SFTP attach metadata for a running task Claudespace, plus hosted preview URLs and configured preview ports. Optionally installs an OpenSSH public key for this attach session.",
1427
1903
  {
1428
- taskId: z12.string().describe("The task ID"),
1429
- sshPublicKey: z12.string().optional().describe("Optional OpenSSH public key to install into the workspace")
1904
+ taskId: z7.string().describe("The task ID"),
1905
+ sshPublicKey: z7.string().optional().describe("Optional OpenSSH public key to install into the workspace")
1430
1906
  },
1431
1907
  async ({ taskId, sshPublicKey }) => {
1432
1908
  const info = await conn2.getWorkspaceAttachInfo(taskId, sshPublicKey);
@@ -1439,7 +1915,7 @@ function registerPreviewUrlsTool(server2, conn2) {
1439
1915
  "workspace_preview_urls",
1440
1916
  "Return the hosted preview URLs and preview ports for a running task Claudespace. This mirrors the web UI preview link metadata.",
1441
1917
  {
1442
- taskId: z12.string().describe("The task ID")
1918
+ taskId: z7.string().describe("The task ID")
1443
1919
  },
1444
1920
  async ({ taskId }) => {
1445
1921
  const info = await conn2.getWorkspaceAttachInfo(taskId);
@@ -1468,10 +1944,10 @@ function registerStartTunnelTool(server2, conn2, startTunnel) {
1468
1944
  "workspace_start_tunnel",
1469
1945
  "Start a local loopback tunnel through the MCP server to a running task Claudespace port. Use port 2222 for SSH/SFTP, or one of previewPorts for app access.",
1470
1946
  {
1471
- taskId: z12.string().describe("The task ID"),
1472
- port: z12.number().optional().describe("Remote Claudespace port. Defaults to SSH port 2222."),
1473
- preferredLocalPort: z12.number().optional().describe("Preferred local loopback port. If omitted, the OS chooses one."),
1474
- sshPublicKey: z12.string().optional().describe("Optional OpenSSH public key to install before opening the tunnel")
1947
+ taskId: z7.string().describe("The task ID"),
1948
+ port: z7.number().optional().describe("Remote Claudespace port. Defaults to SSH port 2222."),
1949
+ preferredLocalPort: z7.number().optional().describe("Preferred local loopback port. If omitted, the OS chooses one."),
1950
+ sshPublicKey: z7.string().optional().describe("Optional OpenSSH public key to install before opening the tunnel")
1475
1951
  },
1476
1952
  async ({ taskId, port, preferredLocalPort, sshPublicKey }) => {
1477
1953
  const info = await conn2.getWorkspaceAttachInfo(taskId, sshPublicKey);
@@ -1524,7 +2000,7 @@ function registerStopTunnelTool(server2) {
1524
2000
  "workspace_stop_tunnel",
1525
2001
  "Stop a local workspace tunnel previously opened by workspace_start_tunnel.",
1526
2002
  {
1527
- tunnelId: z12.string().describe("Tunnel id returned by workspace_start_tunnel")
2003
+ tunnelId: z7.string().describe("Tunnel id returned by workspace_start_tunnel")
1528
2004
  },
1529
2005
  async ({ tunnelId }) => {
1530
2006
  const tunnel = activeTunnels.get(tunnelId);
@@ -1543,7 +2019,7 @@ function registerWorkspaceTools(server2, conn2, deps = {}) {
1543
2019
  }
1544
2020
 
1545
2021
  // src/tools/logs.ts
1546
- import { z as z13 } from "zod";
2022
+ import { z as z8 } from "zod";
1547
2023
  var SEVERITY_ENUM = [
1548
2024
  "DEBUG",
1549
2025
  "INFO",
@@ -1678,18 +2154,18 @@ function registerGrafanaLogTool(server2, conn2) {
1678
2154
  "query_grafana_logs",
1679
2155
  "Query the project's connected Grafana (Loki) logs \u2014 the application logs shipped to Grafana Cloud/Loki, complementing query_gcp_logs (GCP infrastructure logs). Start with structured filters (env, level=error, sinceMinutes=60, services), then narrow with search; pass raw LogQL via logql only when structured filters can't express the query (it REPLACES them). The response header echoes the composed LogQL \u2014 iterate on it. Returns compact lines: '<time> <SEVERITY> [<service>] <message>'.",
1680
2156
  {
1681
- projectId: z13.string().optional().describe("Target Conveyor project ID"),
1682
- env: z13.enum(["prod", "dev"]).optional().describe("Configured Grafana env mapping to scope by (default prod)"),
1683
- sinceMinutes: z13.number().int().min(1).max(10080).optional().describe(
2157
+ projectId: z8.string().optional().describe("Target Conveyor project ID"),
2158
+ env: z8.enum(["prod", "dev"]).optional().describe("Configured Grafana env mapping to scope by (default prod)"),
2159
+ sinceMinutes: z8.number().int().min(1).max(10080).optional().describe(
1684
2160
  "Relative time window ending now, in minutes (default 60). Ignored if startTime is set."
1685
2161
  ),
1686
- startTime: z13.string().optional().describe("ISO 8601 lower bound (overrides sinceMinutes)"),
1687
- endTime: z13.string().optional().describe("ISO 8601 upper bound (default now)"),
1688
- level: z13.enum(["debug", "info", "warn", "error", "fatal"]).optional().describe("Minimum severity, inclusive \u2014 error returns error and above"),
1689
- services: z13.array(z13.string()).optional().describe("Restrict to these service_name label values"),
1690
- search: z13.string().max(256).optional().describe("Substring line filter (exact substring, not regex)"),
1691
- logql: z13.string().max(2e3).optional().describe("Advanced: raw LogQL query \u2014 REPLACES env/services/level/search composition"),
1692
- limit: z13.number().int().min(1).max(200).optional().describe("Max entries (default 50)")
2162
+ startTime: z8.string().optional().describe("ISO 8601 lower bound (overrides sinceMinutes)"),
2163
+ endTime: z8.string().optional().describe("ISO 8601 upper bound (default now)"),
2164
+ level: z8.enum(["debug", "info", "warn", "error", "fatal"]).optional().describe("Minimum severity, inclusive \u2014 error returns error and above"),
2165
+ services: z8.array(z8.string()).optional().describe("Restrict to these service_name label values"),
2166
+ search: z8.string().max(256).optional().describe("Substring line filter (exact substring, not regex)"),
2167
+ logql: z8.string().max(2e3).optional().describe("Advanced: raw LogQL query \u2014 REPLACES env/services/level/search composition"),
2168
+ limit: z8.number().int().min(1).max(200).optional().describe("Max entries (default 50)")
1693
2169
  },
1694
2170
  async (params) => {
1695
2171
  const text = await runQueryGrafanaLogs(conn2, params);
@@ -1702,25 +2178,25 @@ function registerLogTools(server2, conn2) {
1702
2178
  "query_gcp_logs",
1703
2179
  "Query Google Cloud Logging for a project's linked GCP environments \u2014 use this to investigate production or dev issues directly ('something broke on prod'). Envs: 'prod' and 'dev' are the project's Cloud Run apps + Cloud SQL databases (scoped by default to the resources linked in project settings); 'claudespace' is the project's GKE agent-pod namespace. Start broad (severity=ERROR, sinceMinutes=60), then narrow with services/search. Returns compact lines: '<time> <SEVERITY> [<source>] <message> | key=value \u2026' (the key=value tail is the entry's structured payload \u2014 error details, service/method, actor and entity ids). When the response ends with a pageToken line, pass that token back as pageToken for the next page. Pass projectId to target a specific project; otherwise the configured default project is used.",
1704
2180
  {
1705
- projectId: z13.string().optional().describe("Target Conveyor project ID"),
1706
- env: z13.enum(["prod", "dev", "claudespace"]).optional().describe("GCP environment slot to query (default prod)"),
1707
- sinceMinutes: z13.number().int().min(1).max(10080).optional().describe(
2181
+ projectId: z8.string().optional().describe("Target Conveyor project ID"),
2182
+ env: z8.enum(["prod", "dev", "claudespace"]).optional().describe("GCP environment slot to query (default prod)"),
2183
+ sinceMinutes: z8.number().int().min(1).max(10080).optional().describe(
1708
2184
  "Relative time window ending now, in minutes (default 60). Ignored if startTime is set."
1709
2185
  ),
1710
- startTime: z13.string().optional().describe("ISO 8601 lower bound (overrides sinceMinutes)"),
1711
- endTime: z13.string().optional().describe("ISO 8601 upper bound (default now)"),
1712
- severity: z13.enum(SEVERITY_ENUM).optional().describe("Minimum severity, inclusive \u2014 ERROR returns ERROR and above"),
1713
- services: z13.array(z13.string()).optional().describe(
2186
+ startTime: z8.string().optional().describe("ISO 8601 lower bound (overrides sinceMinutes)"),
2187
+ endTime: z8.string().optional().describe("ISO 8601 upper bound (default now)"),
2188
+ severity: z8.enum(SEVERITY_ENUM).optional().describe("Minimum severity, inclusive \u2014 ERROR returns ERROR and above"),
2189
+ services: z8.array(z8.string()).optional().describe(
1714
2190
  "Restrict to these Cloud Run service names (prod/dev only). Defaults to all services linked in project settings."
1715
2191
  ),
1716
- sqlInstances: z13.array(z13.string()).optional().describe("Restrict to these Cloud SQL instance names (prod/dev only)"),
1717
- allServices: z13.boolean().optional().describe(
2192
+ sqlInstances: z8.array(z8.string()).optional().describe("Restrict to these Cloud SQL instance names (prod/dev only)"),
2193
+ allServices: z8.boolean().optional().describe(
1718
2194
  "Set true to search ALL logs in the GCP project, ignoring the linked-resource scope"
1719
2195
  ),
1720
- search: z13.string().max(256).optional().describe("Free-text search across all log fields (exact substring, not regex)"),
1721
- filter: z13.string().max(1e3).optional().describe("Advanced: raw Cloud Logging filter expression, ANDed with the scope"),
1722
- limit: z13.number().int().min(1).max(200).optional().describe("Max entries per page (default 50)"),
1723
- pageToken: z13.string().optional().describe("Opaque token from a previous response to fetch the next page")
2196
+ search: z8.string().max(256).optional().describe("Free-text search across all log fields (exact substring, not regex)"),
2197
+ filter: z8.string().max(1e3).optional().describe("Advanced: raw Cloud Logging filter expression, ANDed with the scope"),
2198
+ limit: z8.number().int().min(1).max(200).optional().describe("Max entries per page (default 50)"),
2199
+ pageToken: z8.string().optional().describe("Opaque token from a previous response to fetch the next page")
1724
2200
  },
1725
2201
  async (params) => {
1726
2202
  const text = await runQueryGcpLogs(conn2, params);