@dexhq/canvas 0.14.0 → 0.15.0
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/CHANGELOG.md +36 -0
- package/README.md +5 -3
- package/app/canvas/activity.tsx +8 -15
- package/app/canvas/anchoring.ts +3 -5
- package/app/canvas/canvas-input.ts +151 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +5 -42
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +7 -3
- package/app/canvas/canvas-ui.ts +2 -1
- package/app/canvas/canvas.css +61 -26
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +204 -82
- package/app/canvas/element-picker.ts +200 -27
- package/app/canvas/engine/canvas-gestures.ts +72 -17
- package/app/canvas/engine/canvas-store.ts +17 -1
- package/app/canvas/engine/engine.css +6 -3
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +18 -2
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-node.tsx +9 -9
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +27 -0
- package/app/canvas/live-page.ts +142 -19
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/section-node.tsx +2 -0
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +34 -40
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/xray.ts +3 -12
- package/app/frame.tsx +5 -0
- package/app/i18n/locales/en/messages.po +88 -8
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +88 -8
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/glyphs.tsx +4 -0
- package/app/main.tsx +3 -0
- package/app/pages/canvas.tsx +27 -8
- package/app/pages/commands-settings.tsx +16 -2
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/dist/cli/banner.d.mts +4 -2
- package/dist/cli/banner.mjs +34 -11
- package/dist/cli/commands/app.mjs +19 -11
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/config/project-files.d.mts +6 -0
- package/dist/config/project-files.mjs +14 -2
- package/dist/config/renamed.d.mts +0 -2
- package/dist/config/renamed.mjs +1 -3
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/content.d.mts +3 -141
- package/dist/content/content.mjs +7 -62
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/prototype-summary.d.mts +3 -39
- package/dist/content/prototype-summary.mjs +2 -3
- package/dist/content/prototypes.mjs +1 -1
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +309 -0
- package/dist/content/thread-module.mjs +1 -1
- package/dist/content/threads.mjs +1 -1
- package/dist/paste/paste.mjs +1 -1
- package/dist/paths.d.mts +0 -2
- package/dist/paths.mjs +1 -3
- package/dist/server/agent-env.d.mts +5 -1
- package/dist/server/agent-env.mjs +7 -2
- package/dist/server/agent-session.d.mts +14 -1
- package/dist/server/agent-session.mjs +84 -19
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/channel.d.mts +13 -24
- package/dist/server/channel.mjs +55 -37
- package/dist/server/claimed-presence.d.mts +3 -2
- package/dist/server/claimed-presence.mjs +15 -7
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/comments/actions.d.mts +153 -0
- package/dist/server/comments/actions.mjs +154 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +88 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +27 -13
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +7 -8
- package/dist/server/me.d.mts +1 -1
- package/dist/server/open-page.d.mts +22 -0
- package/dist/server/open-page.mjs +20 -2
- package/dist/server/outcome.d.mts +22 -0
- package/dist/server/outcome.mjs +8 -0
- package/dist/server/own-copies.mjs +2 -2
- package/dist/server/people.d.mts +1 -1
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +33 -48
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +17 -3
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.mjs +2 -2
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/reading.mjs +13 -4
- package/dist/server/tools/show.d.mts +1 -1
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/thread-list.mjs +1 -1
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.mjs +2 -2
- package/dist/server/web-app.mjs +4 -7
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +67 -17
- package/dist/setup/design-system-checks.mjs +3 -12
- package/dist/setup/desktop-app-script.mjs +4 -3
- package/dist/setup/desktop-app-start.d.mts +8 -2
- package/dist/setup/desktop-app-start.mjs +64 -29
- package/dist/setup/desktop-app.d.mts +8 -0
- package/dist/setup/desktop-app.mjs +19 -3
- package/dist/setup/detect.d.mts +0 -2
- package/dist/setup/detect.mjs +1 -3
- package/dist/setup/doctor.mjs +1 -1
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/project.d.mts +6 -1
- package/dist/setup/project.mjs +9 -9
- package/dist/setup/starters.d.mts +2 -0
- package/dist/setup/starters.mjs +7 -1
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.mjs +1 -1
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +53 -0
- package/dist/shared/comments/routes.mjs +37 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/presence-core.d.mts +11 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +1 -1
- package/dist/shared/signup.d.mts +2 -5
- package/dist/shared/signup.mjs +2 -35
- package/dist/shared/studio-events.d.mts +0 -6
- package/dist/shared/studio-events.mjs +1 -5
- package/dist/shared/studio-files.d.mts +12 -0
- package/dist/shared/studio-files.mjs +6 -1
- package/dist/shared/studio-routes.d.mts +16 -62
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +2 -2
- package/dist/shared/threads-core.mjs +1 -1
- package/extension/dist/feedback.js +148 -138
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +146 -136
- package/package.json +2 -2
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/hook.ts +4 -1
- package/src/config/project-files.ts +21 -6
- package/src/config/renamed.ts +0 -3
- package/src/content/capture.ts +6 -12
- package/src/content/content.ts +7 -241
- package/src/content/flow-specs.ts +2 -1
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/text-replace.ts +449 -0
- package/src/paths.ts +0 -8
- package/src/server/agent-env.ts +12 -2
- package/src/server/agent-session.ts +124 -34
- package/src/server/channel.ts +94 -52
- package/src/server/claimed-presence.ts +26 -10
- package/src/server/comments/actions.ts +352 -0
- package/src/server/comments/routes.ts +176 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +36 -15
- package/src/server/file-lock.ts +205 -54
- package/src/server/mcp.ts +13 -14
- package/src/server/me.ts +2 -5
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +2 -1
- package/src/server/port.ts +94 -20
- package/src/server/presence.ts +11 -3
- package/src/server/requests.ts +60 -70
- package/src/server/studio-for.ts +26 -2
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/watch.ts +7 -7
- package/src/server/web-app.ts +11 -9
- package/src/setup/create.ts +91 -17
- package/src/setup/design-system-checks.ts +7 -15
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +23 -2
- package/src/setup/detect.ts +0 -4
- package/src/setup/project.ts +9 -8
- package/src/setup/starters.ts +8 -1
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +79 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/page-review.ts +11 -16
- package/src/shared/presence-core.ts +16 -2
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +2 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +14 -0
- package/src/shared/studio-routes.ts +21 -64
- package/src/shared/threads-core.ts +2 -2
- package/dist/server/tools/close-reply.d.mts +0 -6
- package/dist/server/tools/close-reply.mjs +0 -138
- package/dist/server/tools/comment.d.mts +0 -6
- package/dist/server/tools/comment.mjs +0 -49
- package/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
// side fails to type-check on the other.
|
|
7
7
|
//
|
|
8
8
|
// Bodies are not declared here, but for git's (StudioBodies): each handler
|
|
9
|
-
// checks the fields it relies on.
|
|
10
|
-
//
|
|
9
|
+
// checks the fields it relies on. A feature with a contract of its own
|
|
10
|
+
// declares its requests there, bodies and all, and its types are taken in
|
|
11
|
+
// here: the comments' (comments/routes.ts). The methods each request takes,
|
|
12
|
+
// as a list that runs, are the server's (testing/route-methods.ts).
|
|
13
|
+
// Types only, with no I/O, so the browser can use it too.
|
|
11
14
|
|
|
12
15
|
import type { Authored } from "./annotations-core.ts";
|
|
13
16
|
import type { AvatarFile } from "./avatar-file.ts";
|
|
@@ -17,6 +20,7 @@ import type {
|
|
|
17
20
|
CommandSwitch,
|
|
18
21
|
CommandsAnswer,
|
|
19
22
|
} from "./commands-core.ts";
|
|
23
|
+
import type { CommentAnswers, CommentBodies } from "./comments/routes.ts";
|
|
20
24
|
import type { Devices } from "./devices.ts";
|
|
21
25
|
import type {
|
|
22
26
|
GitAsk,
|
|
@@ -348,7 +352,7 @@ export type GitStepName = GitStepBody["step"];
|
|
|
348
352
|
* The bodies the contract declares, by request and method; the rest are
|
|
349
353
|
* unknown, checked by their handlers.
|
|
350
354
|
*/
|
|
351
|
-
export interface StudioBodies {
|
|
355
|
+
export interface StudioBodies extends CommentBodies {
|
|
352
356
|
"agent-launch": { POST: { agent: LaunchAgentId } };
|
|
353
357
|
/** An agent's Dex server on an older Dex, by its process. */
|
|
354
358
|
"agent-stop": { POST: { pid: number } };
|
|
@@ -393,7 +397,8 @@ export type StudioBodyOf<
|
|
|
393
397
|
* Each request, by name, and its answer to each method it takes. The query
|
|
394
398
|
* a request needs is in its comment.
|
|
395
399
|
*/
|
|
396
|
-
export interface StudioAnswers<Own extends OwnTypes = OwnTypes>
|
|
400
|
+
export interface StudioAnswers<Own extends OwnTypes = OwnTypes>
|
|
401
|
+
extends CommentAnswers {
|
|
397
402
|
/**
|
|
398
403
|
* Open an agent, or a plain terminal, where agents start: in a terminal
|
|
399
404
|
* window on this Mac (`opened`), else the command to run. Only from this
|
|
@@ -536,6 +541,18 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
536
541
|
GET: RemovedViewList;
|
|
537
542
|
POST: { dismissed: string[]; views: string[] };
|
|
538
543
|
};
|
|
544
|
+
/** A find and replace's changes, or what its undo put back. */
|
|
545
|
+
replace: {
|
|
546
|
+
POST:
|
|
547
|
+
| {
|
|
548
|
+
files: string[];
|
|
549
|
+
left?: number;
|
|
550
|
+
replaced: number;
|
|
551
|
+
skipped: number;
|
|
552
|
+
undo?: string;
|
|
553
|
+
}
|
|
554
|
+
| { kept: string[]; restored: string[] };
|
|
555
|
+
};
|
|
539
556
|
/**
|
|
540
557
|
* GET: how a restart goes, from this Dex or, while none answers, its
|
|
541
558
|
* supervisor; POST: the run Dex restarts from.
|
|
@@ -555,8 +572,6 @@ export interface StudioAnswers<Own extends OwnTypes = OwnTypes> {
|
|
|
555
572
|
"spec-suggestion": { POST: ThreadWithPrototype };
|
|
556
573
|
/** The file each changed. */
|
|
557
574
|
text: { POST: { file: string } };
|
|
558
|
-
/** ?slug= for one prototype's, or none for every one's. */
|
|
559
|
-
threads: { GET: ThreadWithPrototype[]; POST: ThreadWithPrototype };
|
|
560
575
|
trash: { DELETE: Done };
|
|
561
576
|
update: {
|
|
562
577
|
/**
|
|
@@ -610,64 +625,6 @@ export type StudioRouteName = keyof StudioAnswers;
|
|
|
610
625
|
export type StudioMethodOf<Name extends StudioRouteName> =
|
|
611
626
|
keyof StudioAnswers[Name] & StudioMethod;
|
|
612
627
|
|
|
613
|
-
/**
|
|
614
|
-
* The requests and the methods each takes, for what has to know them as it
|
|
615
|
-
* runs: the server's test that it serves each one as declared.
|
|
616
|
-
*/
|
|
617
|
-
export const STUDIO_ROUTES = {
|
|
618
|
-
canvas: ["GET", "PUT"],
|
|
619
|
-
annotations: ["GET", "PUT", "DELETE"],
|
|
620
|
-
events: ["GET"],
|
|
621
|
-
"removed-views": ["GET", "POST"],
|
|
622
|
-
reviews: ["POST"],
|
|
623
|
-
trash: ["DELETE"],
|
|
624
|
-
threads: ["GET", "POST"],
|
|
625
|
-
"spec-suggestion": ["POST"],
|
|
626
|
-
instructions: ["GET", "PUT"],
|
|
627
|
-
focus: ["PUT"],
|
|
628
|
-
me: ["GET"],
|
|
629
|
-
people: ["GET"],
|
|
630
|
-
prototypes: ["POST"],
|
|
631
|
-
paste: ["POST"],
|
|
632
|
-
frame: ["POST"],
|
|
633
|
-
show: ["POST"],
|
|
634
|
-
text: ["POST"],
|
|
635
|
-
props: ["POST"],
|
|
636
|
-
insert: ["POST"],
|
|
637
|
-
screenshot: ["POST"],
|
|
638
|
-
snapshot: ["POST"],
|
|
639
|
-
picture: ["POST"],
|
|
640
|
-
agents: ["GET"],
|
|
641
|
-
edited: ["GET"],
|
|
642
|
-
extension: ["GET"],
|
|
643
|
-
"agent-setup": ["GET", "POST"],
|
|
644
|
-
"agent-launch": ["POST"],
|
|
645
|
-
"agent-stop": ["POST"],
|
|
646
|
-
preferences: ["GET", "PUT"],
|
|
647
|
-
watch: ["GET", "POST"],
|
|
648
|
-
welcome: ["GET", "POST"],
|
|
649
|
-
update: ["GET", "POST"],
|
|
650
|
-
"machine-update": ["GET", "POST"],
|
|
651
|
-
"other-dexes": ["GET", "POST"],
|
|
652
|
-
restart: ["GET", "POST"],
|
|
653
|
-
"desktop-app": ["GET", "POST"],
|
|
654
|
-
devices: ["GET", "PUT"],
|
|
655
|
-
git: ["GET", "POST"],
|
|
656
|
-
"git-branches": ["GET"],
|
|
657
|
-
"git-sync": ["POST"],
|
|
658
|
-
"git-pull-base": ["POST"],
|
|
659
|
-
"git-saved": ["GET", "POST"],
|
|
660
|
-
"git-checks": ["POST"],
|
|
661
|
-
"git-settings": ["GET", "PUT"],
|
|
662
|
-
"build-settings": ["GET", "PUT"],
|
|
663
|
-
commands: ["GET", "POST", "PUT", "DELETE"],
|
|
664
|
-
"workspace-settings": ["GET", "PUT"],
|
|
665
|
-
"workspace-icon": ["GET", "PUT", "DELETE"],
|
|
666
|
-
avatar: ["PUT", "DELETE"],
|
|
667
|
-
} as const satisfies {
|
|
668
|
-
[Name in StudioRouteName]: readonly StudioMethodOf<Name>[];
|
|
669
|
-
};
|
|
670
|
-
|
|
671
628
|
/** The web app manifest `dex dev` serves. */
|
|
672
629
|
export const MANIFEST_FILE = "manifest.webmanifest";
|
|
673
630
|
|
|
@@ -114,8 +114,8 @@ export type ThreadTarget =
|
|
|
114
114
|
selector?: string;
|
|
115
115
|
/**
|
|
116
116
|
* The start of the element's text, or its label or placeholder when it
|
|
117
|
-
* has none, to help find it in code
|
|
118
|
-
*
|
|
117
|
+
* has none, to help find it in code, and on the page when it moves.
|
|
118
|
+
* Its pin stays in its place when the words change.
|
|
119
119
|
*/
|
|
120
120
|
text?: string;
|
|
121
121
|
/**
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ToolContext } from "./context.mjs";
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
//#region src/server/tools/close-reply.d.ts
|
|
4
|
-
/** Register `close` and `reply` on `server`. */
|
|
5
|
-
export declare function registerCloseAndReplyTools(server: McpServer, context: ToolContext): void;
|
|
6
|
-
//#endregion
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { onCopyIfAny, settleCopy } from "../own-copies.mjs";
|
|
2
|
-
import { RESPONSE_BUDGETS, cutText, fitting, sizeOf } from "../response-budget.mjs";
|
|
3
|
-
import { SHORT, shaped } from "../thread-forms.mjs";
|
|
4
|
-
import { describeAt, placeThreads } from "../thread-source.mjs";
|
|
5
|
-
import { errorsBeforeClose, filesChangedSincePickup } from "../close-check.mjs";
|
|
6
|
-
import { changePlaceFor } from "../thread-place.mjs";
|
|
7
|
-
import { someOf } from "./result.mjs";
|
|
8
|
-
import { ALWAYS_LOADED } from "./context.mjs";
|
|
9
|
-
import { describeChanged } from "./describe.mjs";
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
//#region src/server/tools/close-reply.ts
|
|
12
|
-
/** Room kept in `close`'s result for what says how many more it closed. */
|
|
13
|
-
const CLOSE_ROOM = 300;
|
|
14
|
-
/** The most characters of one problem a result gives. */
|
|
15
|
-
const MAX_PROBLEM = 400;
|
|
16
|
-
/** Act on a thread for this session: the thread as it is after, or why not. */
|
|
17
|
-
const answer = async (context, id, action) => {
|
|
18
|
-
const { ok, refuse, root, session } = context;
|
|
19
|
-
const result = await session.act(id, action);
|
|
20
|
-
if (!result) return refuse(`No thread ${id}. List them with \`threads\`.`);
|
|
21
|
-
if (!result.problems) await settleCopy(root, result.thread).catch(() => void 0);
|
|
22
|
-
return result.problems ? refuse(result.problems.join(" ")) : ok(await describeChanged(context, result.thread, RESPONSE_BUDGETS.reply));
|
|
23
|
-
};
|
|
24
|
-
/** The errors in the code a thread's change touched (close-check.ts). */
|
|
25
|
-
const errorsInChange = async ({ designSystem, from, root, threads }, id) => {
|
|
26
|
-
const thread = await threads.find(id);
|
|
27
|
-
return thread ? await errorsBeforeClose(root, await onCopyIfAny(root, thread), await designSystem(), from) : [];
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* What a resolution keeps of where a change landed: the files it touched,
|
|
31
|
-
* and the place the agent named, when that is on the canvas (else a line
|
|
32
|
-
* saying why not, and the files alone).
|
|
33
|
-
*/
|
|
34
|
-
const landingOf = async ({ root, threads }, id, where) => {
|
|
35
|
-
const thread = await threads.find(id);
|
|
36
|
-
if (!thread) return { files: [] };
|
|
37
|
-
const files = await filesChangedSincePickup(root, thread);
|
|
38
|
-
if (!where) return { files };
|
|
39
|
-
const found = await changePlaceFor(root, thread.slug, where);
|
|
40
|
-
return "place" in found ? {
|
|
41
|
-
files,
|
|
42
|
-
place: found.place
|
|
43
|
-
} : {
|
|
44
|
-
files,
|
|
45
|
-
unplaced: `\`where\` names no place on the canvas, so it was left out: ${found.problem}`
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Close one thread: resolved with a summary once its view passes the
|
|
50
|
-
* checks, keeping where its change landed; or dismissed. The thread as it
|
|
51
|
-
* is after, or why not.
|
|
52
|
-
*/
|
|
53
|
-
const closeOne = async (context, { id, summary, dismiss, where }) => {
|
|
54
|
-
const { inRoot, root, session } = context;
|
|
55
|
-
if (Boolean(summary) === Boolean(dismiss)) return `${id}: give a summary or dismiss, one of them.`;
|
|
56
|
-
const broken = summary ? await errorsInChange(context, id) : [];
|
|
57
|
-
if (broken.length > 0) return `${id}: not closed, the code it changed has errors: ${broken.join(" ")} Fix them, then close it.`;
|
|
58
|
-
const landed = summary ? await landingOf(context, id, where) : void 0;
|
|
59
|
-
const result = await session.act(id, summary ? {
|
|
60
|
-
action: "resolve",
|
|
61
|
-
note: summary,
|
|
62
|
-
files: landed?.files ?? [],
|
|
63
|
-
...landed?.place ? { where: landed.place } : {}
|
|
64
|
-
} : {
|
|
65
|
-
action: "dismiss",
|
|
66
|
-
note: dismiss
|
|
67
|
-
});
|
|
68
|
-
if (!result) return `No thread ${id}. List them with \`threads\`.`;
|
|
69
|
-
if (result.problems) return `${id}: ${result.problems.join(" ")}`;
|
|
70
|
-
const settled = await settleCopy(root, result.thread).catch(() => void 0);
|
|
71
|
-
const { messages: _, ...closed } = shaped(describeAt(result.thread, (await placeThreads(root, [result.thread])).get(id), inRoot), SHORT).thread;
|
|
72
|
-
return {
|
|
73
|
-
...closed,
|
|
74
|
-
...settled && "placed" in settled ? { copy: `Your copy's frame is under theirs: ${settled.placed}.` } : {},
|
|
75
|
-
...landed?.unplaced ? { unplaced: landed.unplaced } : {}
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
/** Register `close` and `reply` on `server`. */
|
|
79
|
-
function registerCloseAndReplyTools(server, context) {
|
|
80
|
-
const { okAboutCode, refuse } = context;
|
|
81
|
-
server.registerTool("close", {
|
|
82
|
-
_meta: ALWAYS_LOADED,
|
|
83
|
-
annotations: {
|
|
84
|
-
readOnlyHint: false,
|
|
85
|
-
destructiveHint: false,
|
|
86
|
-
idempotentHint: true
|
|
87
|
-
},
|
|
88
|
-
title: "Close threads",
|
|
89
|
-
description: "Close comments and requests, several at once: every thread you take ends here (or with `reply`); one you have not closed when your session ends goes back to waiting. The code each change touched is checked first (it parses, its stylesheet's braces close, it imports only what Dex allows): while it does not, the thread stays open and the result says why. Give each thread's `summary` as soon as its change is made, one short line on what changed (what people would look for, such as \"Header padding 24 to 12px; title now semibold\"): the thread gets ✅ and the line shows on it and as a note in the studio. Give `dismiss` instead to close one without acting on it (for example, the owner decided against it, or it is already so): it gets 🚫 with that line. A longer line is taken too, but Dex shows only its start until someone opens it, so keep it short. With a summary, give `where` too: the element your change landed on (a frame key or view, and a CSS selector, as `comment` takes them), above all when it is not the element the comment is on. People are taken there, and a pin marks it.",
|
|
90
|
-
inputSchema: { threads: z.array(z.object({
|
|
91
|
-
id: z.string(),
|
|
92
|
-
summary: z.string().min(1).optional().describe("What changed: the thread is resolved"),
|
|
93
|
-
dismiss: z.string().min(1).optional().describe("Why not: the thread is dismissed"),
|
|
94
|
-
where: z.object({
|
|
95
|
-
frame: z.string().optional().describe("A frame key from canvas.json: \"section/row/frame\"."),
|
|
96
|
-
view: z.string().optional().describe("A view name; the first frame showing it."),
|
|
97
|
-
selector: z.string().optional().describe("A CSS selector for the element you changed."),
|
|
98
|
-
text: z.string().optional().describe("The start of the element's text.")
|
|
99
|
-
}).optional().describe("Where the change landed: people are taken there, and a pin marks it")
|
|
100
|
-
})).min(1) }
|
|
101
|
-
}, async (input) => {
|
|
102
|
-
const closed = [];
|
|
103
|
-
const problems = [];
|
|
104
|
-
for (const request of input.threads) {
|
|
105
|
-
const outcome = await closeOne(context, request);
|
|
106
|
-
if (typeof outcome === "string") problems.push(outcome);
|
|
107
|
-
else closed.push(outcome);
|
|
108
|
-
}
|
|
109
|
-
const said = someOf(problems.map((problem) => cutText(problem, MAX_PROBLEM)));
|
|
110
|
-
if (closed.length === 0) return refuse(said.join(" "));
|
|
111
|
-
const room = RESPONSE_BUDGETS.close - sizeOf(said) - CLOSE_ROOM;
|
|
112
|
-
const { left, shown } = fitting(closed, room, (some) => sizeOf({ closed: some }));
|
|
113
|
-
return okAboutCode({
|
|
114
|
-
closed: shown,
|
|
115
|
-
...left > 0 ? { leftOut: `${left.toLocaleString("en")} more closed with these, ${closed.length.toLocaleString("en")} in all: \`threads\` with \`status\` "resolved" or "dismissed" lists them.` } : {},
|
|
116
|
-
...said.length > 0 ? { problems: said } : {}
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
server.registerTool("reply", {
|
|
120
|
-
annotations: {
|
|
121
|
-
readOnlyHint: false,
|
|
122
|
-
destructiveHint: false
|
|
123
|
-
},
|
|
124
|
-
title: "Write a message on a thread",
|
|
125
|
-
description: "Write a message on a thread, briefly. It hands the thread back to the person. Where someone @mentions you (the thread says \"asked\"), answer them. Anywhere else it fails unless ask is true, which is for a question about a request so ambiguous you cannot pick a sensible reading. That should be rare: when one reading is sensible, take it, do the work and close the thread with a summary (`close`).",
|
|
126
|
-
inputSchema: {
|
|
127
|
-
id: z.string(),
|
|
128
|
-
message: z.string().min(1),
|
|
129
|
-
ask: z.boolean().optional()
|
|
130
|
-
}
|
|
131
|
-
}, ({ id, message, ask }) => answer(context, id, {
|
|
132
|
-
action: "reply",
|
|
133
|
-
message,
|
|
134
|
-
ask
|
|
135
|
-
}));
|
|
136
|
-
}
|
|
137
|
-
//#endregion
|
|
138
|
-
export { registerCloseAndReplyTools };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ToolContext } from "./context.mjs";
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
//#region src/server/tools/comment.d.ts
|
|
4
|
-
/** Register `comment` on `server`. */
|
|
5
|
-
export declare function registerCommentTool(server: McpServer, context: ToolContext): void;
|
|
6
|
-
//#endregion
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { resolvePrototype } from "../../content/prototypes.mjs";
|
|
2
|
-
import { RESPONSE_BUDGETS } from "../response-budget.mjs";
|
|
3
|
-
import { targetFor } from "../thread-place.mjs";
|
|
4
|
-
import { describeChanged } from "./describe.mjs";
|
|
5
|
-
import { PROTOTYPE } from "./prototype-name.mjs";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/server/tools/comment.ts
|
|
8
|
-
/** Register `comment` on `server`. */
|
|
9
|
-
function registerCommentTool(server, context) {
|
|
10
|
-
const { agentName, ok, refuse, root, threads } = context;
|
|
11
|
-
server.registerTool("comment", {
|
|
12
|
-
annotations: {
|
|
13
|
-
readOnlyHint: false,
|
|
14
|
-
destructiveHint: false
|
|
15
|
-
},
|
|
16
|
-
title: "Leave a comment",
|
|
17
|
-
description: "Start a thread on a file, as people do in the studio: on an element (a frame or view plus a CSS selector, which pins the comment to that element), on a whole frame, on words in a spec (`spec` and `quote`; add `replace` to suggest new words for a person to accept), or on the file. Use it to show people what you found, for example each point of a critique where it applies, or to ask a question about a specific screen. \"for\": \"people\" (the default) is a note for people to read and answer; \"agent\" makes it a work item for an agent.",
|
|
18
|
-
inputSchema: {
|
|
19
|
-
prototype: PROTOTYPE,
|
|
20
|
-
message: z.string().min(1),
|
|
21
|
-
for: z.enum(["people", "agent"]).default("people"),
|
|
22
|
-
frame: z.string().optional().describe("A frame key from canvas.json: \"section/row/frame\"."),
|
|
23
|
-
view: z.string().optional().describe("A view name; the first frame showing it is used."),
|
|
24
|
-
doc: z.string().optional().describe("A document name, instead."),
|
|
25
|
-
selector: z.string().optional().describe("A CSS selector for the element, e.g. [data-slot=\"card\"]:nth-of-type(2) h3."),
|
|
26
|
-
text: z.string().optional().describe("The start of the element's text, to help people find it."),
|
|
27
|
-
spec: z.string().optional().describe("A spec's or a document's file from the file's folder: a spec frame's \"spec\", or \"docs/<name>.md\"."),
|
|
28
|
-
quote: z.string().optional().describe("With spec: the words the comment is about, as the spec's markdown has them, enough to appear once."),
|
|
29
|
-
replace: z.string().optional().describe("With spec and quote: a suggestion, the words to put in their place.")
|
|
30
|
-
}
|
|
31
|
-
}, async (input) => {
|
|
32
|
-
const found = resolvePrototype(root, input.prototype, { mustExist: true });
|
|
33
|
-
if (!found) return refuse(`No file ${input.prototype}.`);
|
|
34
|
-
const { slug } = found;
|
|
35
|
-
const place = await targetFor(root, slug, input);
|
|
36
|
-
if ("problem" in place) return refuse(place.problem);
|
|
37
|
-
const { thread, problems } = await threads.start({
|
|
38
|
-
prototype: input.prototype,
|
|
39
|
-
target: place.target,
|
|
40
|
-
body: input.message,
|
|
41
|
-
author: agentName(),
|
|
42
|
-
agent: true,
|
|
43
|
-
for: input.for
|
|
44
|
-
});
|
|
45
|
-
return problems ? refuse(problems.join(" ")) : ok(await describeChanged(context, thread, RESPONSE_BUDGETS.comment));
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
export { registerCommentTool };
|
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
// `close` and `reply`: how a thread an agent took ends. Closed,
|
|
2
|
-
// resolved with a line on what changed once the code it touched passes the
|
|
3
|
-
// checks, or dismissed; or handed back to the person with a message.
|
|
4
|
-
|
|
5
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import type { ChangePlace } from "../../shared/threads-core.ts";
|
|
8
|
-
import type { UnsignedAction } from "../agent-session.ts";
|
|
9
|
-
import { errorsBeforeClose, filesChangedSincePickup } from "../close-check.ts";
|
|
10
|
-
import { onCopyIfAny, settleCopy } from "../own-copies.ts";
|
|
11
|
-
import {
|
|
12
|
-
cutText,
|
|
13
|
-
fitting,
|
|
14
|
-
RESPONSE_BUDGETS,
|
|
15
|
-
sizeOf,
|
|
16
|
-
} from "../response-budget.ts";
|
|
17
|
-
import { SHORT, shaped } from "../thread-forms.ts";
|
|
18
|
-
import { type CanvasPlace, changePlaceFor } from "../thread-place.ts";
|
|
19
|
-
import { describeAt, placeThreads } from "../thread-source.ts";
|
|
20
|
-
import { ALWAYS_LOADED, type ToolContext } from "./context.ts";
|
|
21
|
-
import { describeChanged } from "./describe.ts";
|
|
22
|
-
import { someOf } from "./result.ts";
|
|
23
|
-
|
|
24
|
-
/** Room kept in `close`'s result for what says how many more it closed. */
|
|
25
|
-
const CLOSE_ROOM = 300;
|
|
26
|
-
/** The most characters of one problem a result gives. */
|
|
27
|
-
const MAX_PROBLEM = 400;
|
|
28
|
-
|
|
29
|
-
/** Act on a thread for this session: the thread as it is after, or why not. */
|
|
30
|
-
const answer = async (
|
|
31
|
-
context: ToolContext,
|
|
32
|
-
id: string,
|
|
33
|
-
action: UnsignedAction
|
|
34
|
-
) => {
|
|
35
|
-
const { ok, refuse, root, session } = context;
|
|
36
|
-
const result = await session.act(id, action);
|
|
37
|
-
if (!result) {
|
|
38
|
-
return refuse(`No thread ${id}. List them with \`threads\`.`);
|
|
39
|
-
}
|
|
40
|
-
if (!result.problems) {
|
|
41
|
-
// Only an answer: a copy of someone else's view made for it goes.
|
|
42
|
-
await settleCopy(root, result.thread).catch(() => undefined);
|
|
43
|
-
}
|
|
44
|
-
return result.problems
|
|
45
|
-
? refuse(result.problems.join(" "))
|
|
46
|
-
: ok(await describeChanged(context, result.thread, RESPONSE_BUDGETS.reply));
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/** The errors in the code a thread's change touched (close-check.ts). */
|
|
50
|
-
const errorsInChange = async (
|
|
51
|
-
{ designSystem, from, root, threads }: ToolContext,
|
|
52
|
-
id: string
|
|
53
|
-
): Promise<string[]> => {
|
|
54
|
-
const thread = await threads.find(id);
|
|
55
|
-
// On someone else's view, the change is in the person's copy.
|
|
56
|
-
return thread
|
|
57
|
-
? await errorsBeforeClose(
|
|
58
|
-
root,
|
|
59
|
-
await onCopyIfAny(root, thread),
|
|
60
|
-
await designSystem(),
|
|
61
|
-
from
|
|
62
|
-
)
|
|
63
|
-
: [];
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* What a resolution keeps of where a change landed: the files it touched,
|
|
68
|
-
* and the place the agent named, when that is on the canvas (else a line
|
|
69
|
-
* saying why not, and the files alone).
|
|
70
|
-
*/
|
|
71
|
-
const landingOf = async (
|
|
72
|
-
{ root, threads }: ToolContext,
|
|
73
|
-
id: string,
|
|
74
|
-
where: CanvasPlace | undefined
|
|
75
|
-
): Promise<{ files: string[]; place?: ChangePlace; unplaced?: string }> => {
|
|
76
|
-
const thread = await threads.find(id);
|
|
77
|
-
if (!thread) {
|
|
78
|
-
return { files: [] };
|
|
79
|
-
}
|
|
80
|
-
const files = await filesChangedSincePickup(root, thread);
|
|
81
|
-
if (!where) {
|
|
82
|
-
return { files };
|
|
83
|
-
}
|
|
84
|
-
const found = await changePlaceFor(root, thread.slug, where);
|
|
85
|
-
return "place" in found
|
|
86
|
-
? { files, place: found.place }
|
|
87
|
-
: {
|
|
88
|
-
files,
|
|
89
|
-
unplaced: `\`where\` names no place on the canvas, so it was left out: ${found.problem}`,
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Close one thread: resolved with a summary once its view passes the
|
|
95
|
-
* checks, keeping where its change landed; or dismissed. The thread as it
|
|
96
|
-
* is after, or why not.
|
|
97
|
-
*/
|
|
98
|
-
const closeOne = async (
|
|
99
|
-
context: ToolContext,
|
|
100
|
-
{
|
|
101
|
-
id,
|
|
102
|
-
summary,
|
|
103
|
-
dismiss,
|
|
104
|
-
where,
|
|
105
|
-
}: {
|
|
106
|
-
dismiss?: string;
|
|
107
|
-
id: string;
|
|
108
|
-
summary?: string;
|
|
109
|
-
where?: CanvasPlace;
|
|
110
|
-
}
|
|
111
|
-
): Promise<Record<string, unknown> | string> => {
|
|
112
|
-
const { inRoot, root, session } = context;
|
|
113
|
-
if (Boolean(summary) === Boolean(dismiss)) {
|
|
114
|
-
return `${id}: give a summary or dismiss, one of them.`;
|
|
115
|
-
}
|
|
116
|
-
const broken = summary ? await errorsInChange(context, id) : [];
|
|
117
|
-
if (broken.length > 0) {
|
|
118
|
-
return `${id}: not closed, the code it changed has errors: ${broken.join(" ")} Fix them, then close it.`;
|
|
119
|
-
}
|
|
120
|
-
const landed = summary ? await landingOf(context, id, where) : undefined;
|
|
121
|
-
const result = await session.act(
|
|
122
|
-
id,
|
|
123
|
-
summary
|
|
124
|
-
? {
|
|
125
|
-
action: "resolve",
|
|
126
|
-
note: summary,
|
|
127
|
-
files: landed?.files ?? [],
|
|
128
|
-
...(landed?.place ? { where: landed.place } : {}),
|
|
129
|
-
}
|
|
130
|
-
: { action: "dismiss", note: dismiss }
|
|
131
|
-
);
|
|
132
|
-
if (!result) {
|
|
133
|
-
return `No thread ${id}. List them with \`threads\`.`;
|
|
134
|
-
}
|
|
135
|
-
if (result.problems) {
|
|
136
|
-
return `${id}: ${result.problems.join(" ")}`;
|
|
137
|
-
}
|
|
138
|
-
const settled = await settleCopy(root, result.thread).catch(() => undefined);
|
|
139
|
-
// What a closed thread is now: which it was, where, and how it closed.
|
|
140
|
-
const { messages: _, ...closed } = shaped(
|
|
141
|
-
describeAt(
|
|
142
|
-
result.thread,
|
|
143
|
-
(await placeThreads(root, [result.thread])).get(id),
|
|
144
|
-
inRoot
|
|
145
|
-
),
|
|
146
|
-
SHORT
|
|
147
|
-
).thread;
|
|
148
|
-
return {
|
|
149
|
-
...closed,
|
|
150
|
-
...(settled && "placed" in settled
|
|
151
|
-
? { copy: `Your copy's frame is under theirs: ${settled.placed}.` }
|
|
152
|
-
: {}),
|
|
153
|
-
...(landed?.unplaced ? { unplaced: landed.unplaced } : {}),
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/** Register `close` and `reply` on `server`. */
|
|
158
|
-
export function registerCloseAndReplyTools(
|
|
159
|
-
server: McpServer,
|
|
160
|
-
context: ToolContext
|
|
161
|
-
): void {
|
|
162
|
-
const { okAboutCode, refuse } = context;
|
|
163
|
-
|
|
164
|
-
server.registerTool(
|
|
165
|
-
"close",
|
|
166
|
-
{
|
|
167
|
-
_meta: ALWAYS_LOADED,
|
|
168
|
-
annotations: {
|
|
169
|
-
readOnlyHint: false,
|
|
170
|
-
destructiveHint: false,
|
|
171
|
-
idempotentHint: true,
|
|
172
|
-
},
|
|
173
|
-
title: "Close threads",
|
|
174
|
-
description:
|
|
175
|
-
"Close comments and requests, several at once: every thread you take ends here (or with `reply`); one you have not closed when your session ends goes back to waiting. The code each change touched is checked first (it parses, its stylesheet's braces close, it imports only what Dex allows): while it does not, the thread stays open and the result says why. Give each thread's `summary` as soon as its change is made, one short line on what changed (what people would look for, such as \"Header padding 24 to 12px; title now semibold\"): the thread gets ✅ and the line shows on it and as a note in the studio. Give `dismiss` instead to close one without acting on it (for example, the owner decided against it, or it is already so): it gets 🚫 with that line. A longer line is taken too, but Dex shows only its start until someone opens it, so keep it short. With a summary, give `where` too: the element your change landed on (a frame key or view, and a CSS selector, as `comment` takes them), above all when it is not the element the comment is on. People are taken there, and a pin marks it.",
|
|
176
|
-
inputSchema: {
|
|
177
|
-
threads: z
|
|
178
|
-
.array(
|
|
179
|
-
z.object({
|
|
180
|
-
id: z.string(),
|
|
181
|
-
summary: z
|
|
182
|
-
.string()
|
|
183
|
-
.min(1)
|
|
184
|
-
.optional()
|
|
185
|
-
.describe("What changed: the thread is resolved"),
|
|
186
|
-
dismiss: z
|
|
187
|
-
.string()
|
|
188
|
-
.min(1)
|
|
189
|
-
.optional()
|
|
190
|
-
.describe("Why not: the thread is dismissed"),
|
|
191
|
-
where: z
|
|
192
|
-
.object({
|
|
193
|
-
frame: z
|
|
194
|
-
.string()
|
|
195
|
-
.optional()
|
|
196
|
-
.describe(
|
|
197
|
-
'A frame key from canvas.json: "section/row/frame".'
|
|
198
|
-
),
|
|
199
|
-
view: z
|
|
200
|
-
.string()
|
|
201
|
-
.optional()
|
|
202
|
-
.describe("A view name; the first frame showing it."),
|
|
203
|
-
selector: z
|
|
204
|
-
.string()
|
|
205
|
-
.optional()
|
|
206
|
-
.describe("A CSS selector for the element you changed."),
|
|
207
|
-
text: z
|
|
208
|
-
.string()
|
|
209
|
-
.optional()
|
|
210
|
-
.describe("The start of the element's text."),
|
|
211
|
-
})
|
|
212
|
-
.optional()
|
|
213
|
-
.describe(
|
|
214
|
-
"Where the change landed: people are taken there, and a pin marks it"
|
|
215
|
-
),
|
|
216
|
-
})
|
|
217
|
-
)
|
|
218
|
-
.min(1),
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
async (input) => {
|
|
222
|
-
const closed: Record<string, unknown>[] = [];
|
|
223
|
-
const problems: string[] = [];
|
|
224
|
-
for (const request of input.threads) {
|
|
225
|
-
const outcome = await closeOne(context, request);
|
|
226
|
-
if (typeof outcome === "string") {
|
|
227
|
-
problems.push(outcome);
|
|
228
|
-
} else {
|
|
229
|
-
closed.push(outcome);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
const said = someOf(
|
|
233
|
-
problems.map((problem) => cutText(problem, MAX_PROBLEM))
|
|
234
|
-
);
|
|
235
|
-
if (closed.length === 0) {
|
|
236
|
-
return refuse(said.join(" "));
|
|
237
|
-
}
|
|
238
|
-
const room = RESPONSE_BUDGETS.close - sizeOf(said) - CLOSE_ROOM;
|
|
239
|
-
// As they sit in the result: under `closed`.
|
|
240
|
-
const { left, shown } = fitting(closed, room, (some) =>
|
|
241
|
-
sizeOf({ closed: some })
|
|
242
|
-
);
|
|
243
|
-
return okAboutCode({
|
|
244
|
-
closed: shown,
|
|
245
|
-
...(left > 0
|
|
246
|
-
? {
|
|
247
|
-
leftOut: `${left.toLocaleString("en")} more closed with these, ${closed.length.toLocaleString("en")} in all: \`threads\` with \`status\` "resolved" or "dismissed" lists them.`,
|
|
248
|
-
}
|
|
249
|
-
: {}),
|
|
250
|
-
...(said.length > 0 ? { problems: said } : {}),
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
);
|
|
254
|
-
|
|
255
|
-
server.registerTool(
|
|
256
|
-
"reply",
|
|
257
|
-
{
|
|
258
|
-
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
259
|
-
title: "Write a message on a thread",
|
|
260
|
-
description:
|
|
261
|
-
'Write a message on a thread, briefly. It hands the thread back to the person. Where someone @mentions you (the thread says "asked"), answer them. Anywhere else it fails unless ask is true, which is for a question about a request so ambiguous you cannot pick a sensible reading. That should be rare: when one reading is sensible, take it, do the work and close the thread with a summary (`close`).',
|
|
262
|
-
inputSchema: {
|
|
263
|
-
id: z.string(),
|
|
264
|
-
message: z.string().min(1),
|
|
265
|
-
ask: z.boolean().optional(),
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
({ id, message, ask }) =>
|
|
269
|
-
answer(context, id, { action: "reply", message, ask })
|
|
270
|
-
);
|
|
271
|
-
}
|