@tempad-dev/mcp 0.9.0 → 0.10.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/README.md CHANGED
@@ -31,7 +31,7 @@ Supported tools/resources:
31
31
  available font families and exact native styles without reading file resources. `scope: "pages"`
32
32
  lists page IDs without scanning components; a resource call with `pageId` scans only that page's
33
33
  components while retaining file-wide variable, style, and shader definitions.
34
- - `begin_design`, `resume_design`, `set_design_anchor`, and `end_design`: Bind canvas writes to
34
+ - `manage_design_task` (`begin`, `resume`, `complete`, `cancel`) and `set_design_anchor`: Bind canvas writes to
35
35
  a design task, resume a paused task, place its status controls, and finish or cancel the task.
36
36
  Stop permanently fences the old task across reconnects. Native Codex App comments support Queue
37
37
  and Steer; confirmed admission clears submitted drafts before execution finishes. See the
@@ -52,8 +52,8 @@ Notes:
52
52
  - Tool responses use a shared `64 KiB` inline budget measured on the `CallToolResult` body. When a selection is too large for the `get_code` budget, TemPad Dev may return a shell response instead of failing. The shell keeps the current node wrapper and lists omitted direct child ids in an inline code comment so agents can request them one by one. The accompanying warning stays lightweight and only points agents to that comment.
53
53
  - `apply_canvas` is available whenever MCP access is enabled and the current Figma Design file is
54
54
  editable. Dev Mode and view-only files remain read-only.
55
- - MCP **0.9.0** pairs with extension **0.22.0** and Agent Plugin **0.2.1**. Update the extension
56
- and installed skills, replace any alpha-pinned MCP configuration with `@tempad-dev/mcp@latest`,
55
+ - MCP **0.10.0** pairs with extension **0.22.0** and Agent Plugin **0.3.0**. Extension 0.22.0
56
+ needs no update for this release. Update the plugin or installed skills, replace any alpha-pinned MCP configuration with `@tempad-dev/mcp@latest`,
57
57
  then reconnect the MCP client and start a new task. See the
58
58
  [upgrade guide](https://github.com/ecomfe/tempad-dev/tree/main/agent-plugin/src#upgrading).
59
59
  - Assets are ephemeral and tool-linked. Local stdio clients receive `asset.localPath` when the Hub
package/README.zh-Hans.md CHANGED
@@ -28,7 +28,7 @@ TemPad Dev 的 MCP server 将 coding agent 连接到浏览器中打开的 Figma
28
28
  有界定义。使用 `scope: "fonts"` 可查询当前可用字体家族和精确原生样式,不读取文件资源。
29
29
  `scope: "pages"` 无需扫描组件即可列出页面 ID;资源读取传入 `pageId` 时只扫描该页组件,
30
30
  变量、样式和 shader 定义仍按文件范围读取。
31
- - `begin_design`、`resume_design`、`set_design_anchor`、`end_design`:将画布写入绑定到设计任务,
31
+ - `manage_design_task`(`begin`、`resume`、`complete`、`cancel`)和 `set_design_anchor`:将画布写入绑定到设计任务,
32
32
  恢复暂停的任务、设置状态栏锚点,以及结束或取消任务。Stop 会永久禁止旧任务写入,重新连接也不会恢复。
33
33
  兼容 Codex App 的原生评论支持 Queue 和 Steer;确认接收后清空已提交草稿,无需等待执行完成。
34
34
  详细行为与宿主验证范围见[评论指南](https://github.com/ecomfe/tempad-dev/blob/main/agent-plugin/src/README.zh-Hans.md#使用)。
@@ -47,7 +47,7 @@ TemPad Dev 的 MCP server 将 coding agent 连接到浏览器中打开的 Figma
47
47
  - 工具响应共用 `64 KiB` 的 inline budget,按 `CallToolResult` 整体响应体积计算。若选区过大而超出 `get_code` 的预算,TemPad Dev 可能返回 shell response 而不是直接失败。shell 会保留当前节点的包裹结构,并在内联代码注释中列出被省略的直接子节点 id,方便 agent 逐个继续拉取;配套 warning 只保留最小化的提示信息,用来指向这条注释。
48
48
  - 启用 MCP access 且当前 Figma Design 文件可编辑时,`apply_canvas` 即可使用;Dev Mode 和
49
49
  只读文件仍不可写。
50
- - MCP **0.9.0** 应配套使用扩展 **0.22.0** 和 Agent Plugin **0.2.1**。请更新扩展和已安装的 skill,
50
+ - MCP **0.10.0** 应配套使用扩展 **0.22.0** 和 Agent Plugin **0.3.0**。扩展 0.22.0 无需为本次发布更新。请更新 plugin 或已安装的 skill,
51
51
  将固定 alpha 版本的 MCP 配置改为 `@tempad-dev/mcp@latest`,然后重新连接 MCP client 并新建任务。
52
52
  详见[升级指南](https://github.com/ecomfe/tempad-dev/blob/main/agent-plugin/src/README.zh-Hans.md#升级)。
53
53
  - 资源是临时且与工具调用关联的。本地 stdio client 在 Hub 持有字节时会收到
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as runtimeIdentity, c as RUNTIME_DIR, l as SOCK_PATH, o as LOCK_PATH, p as log, s as PACKAGE_VERSION, u as ensureDir } from "./shared-8rz2qWXn.mjs";
2
+ import { _ as runtimeIdentity, c as RUNTIME_DIR, l as SOCK_PATH, o as LOCK_PATH, p as log, s as PACKAGE_VERSION, u as ensureDir } from "./shared-Dh112Muy.mjs";
3
3
  import { spawn } from "node:child_process";
4
4
  import { connect } from "node:net";
5
5
  import { join } from "node:path";
package/dist/hub.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as SetDesignAnchorParametersSchema, A as GetDesignSystemParametersSchema, B as MCP_AUTO_ACTIVATE_GRACE_MS, C as DesignTaskIdSchema, D as GetAssetsParametersSchema, E as FigmaSessionSchema, F as LegacyMessageFromExtensionSchema, G as MCP_MAX_ASSET_STORE_BYTES, H as MCP_GET_CODE_TIMEOUT_MS, I as LegacyToolCallPayloadSchema, J as MCP_TOOL_INLINE_BUDGET_BYTES, K as MCP_MAX_PAYLOAD_BYTES, M as GetScreenshotParametersSchema, N as GetStructureParametersSchema, O as GetAssetsResultSchema, P as GetTokenDefsParametersSchema, Q as ResumeDesignParametersSchema, R as MCP_APPLY_CANVAS_TIMEOUT_MS, S as DesignAnchorSchema, T as EndDesignParametersSchema, U as MCP_GET_DESIGN_SYSTEM_TIMEOUT_MS, W as MCP_MAX_ASSET_BYTES, X as MessageFromExtensionSchema, Y as MCP_TOOL_TIMEOUT_MS, Z as RESUMABLE_DESIGN_TASK_STATUSES, a as HUB_RUNTIME_IDENTITY_PATH, at as buildApplyCanvasToolResult, b as ApplyCanvasResultSchema, c as RUNTIME_DIR, ct as buildGetDesignSystemToolResult, d as ensureFile, dt as buildGetTokenDefsToolResult, et as TEMPAD_MCP_BRIDGE_SUBPROTOCOL, f as getRecordProperty, ft as buildUploadAssetToolResult, g as clientDescriptor, h as bindRequestMetadata, ht as utf8Bytes, i as HUB_LOCK_UPDATE_MS, it as UploadAssetResultSchema, j as GetDesignSystemResultSchema, k as GetCodeParametersSchema, l as SOCK_PATH, lt as buildGetScreenshotToolResult, m as ClientEventSchema, mt as measureCallToolResultBytes, n as HUB_LOCK_PATH, nt as TEMPAD_MCP_ERROR_CODES, ot as buildGetAssetsToolResult, p as log, pt as formatDesignFeedback, q as MCP_PORT_CANDIDATES, r as HUB_LOCK_STALE_MS, rt as UploadAssetParametersSchema, s as PACKAGE_VERSION, st as buildGetCodeToolResult, t as ASSET_DIR, tt as TEMPAD_MCP_BRIDGE_SUPPORTED_PROTOCOL_VERSIONS, u as ensureDir, ut as buildGetStructureToolResult, v as AGENT_CLIENTS, w as DesignTaskSchema, x as BeginDesignParametersSchema, y as ApplyCanvasParametersSchema, z as MCP_ASSET_TTL_MS } from "./shared-8rz2qWXn.mjs";
1
+ import { $ as TEMPAD_MCP_BRIDGE_SUPPORTED_PROTOCOL_VERSIONS, A as GetScreenshotParametersSchema, B as MCP_GET_CODE_TIMEOUT_MS, C as DesignTaskSchema, D as GetCodeParametersSchema, E as GetAssetsResultSchema, G as MCP_PORT_CANDIDATES, H as MCP_MAX_ASSET_BYTES, I as MCP_APPLY_CANVAS_TIMEOUT_MS, J as ManageDesignTaskParametersSchema, K as MCP_TOOL_INLINE_BUDGET_BYTES, L as MCP_ASSET_TTL_MS, M as GetTokenDefsParametersSchema, N as LegacyMessageFromExtensionSchema, O as GetDesignSystemParametersSchema, P as LegacyToolCallPayloadSchema, Q as TEMPAD_MCP_BRIDGE_SUBPROTOCOL, R as MCP_AUTO_ACTIVATE_GRACE_MS, S as DesignTaskIdSchema, T as GetAssetsParametersSchema, U as MCP_MAX_ASSET_STORE_BYTES, V as MCP_GET_DESIGN_SYSTEM_TIMEOUT_MS, W as MCP_MAX_PAYLOAD_BYTES, X as RESUMABLE_DESIGN_TASK_STATUSES, Y as MessageFromExtensionSchema, Z as SetDesignAnchorParametersSchema, a as HUB_RUNTIME_IDENTITY_PATH, at as buildGetCodeToolResult, b as ApplyCanvasResultSchema, c as RUNTIME_DIR, ct as buildGetStructureToolResult, d as ensureFile, dt as formatDesignFeedback, et as TEMPAD_MCP_ERROR_CODES, f as getRecordProperty, ft as measureCallToolResultBytes, g as clientDescriptor, h as bindRequestMetadata, i as HUB_LOCK_UPDATE_MS, it as buildGetAssetsToolResult, j as GetStructureParametersSchema, k as GetDesignSystemResultSchema, l as SOCK_PATH, lt as buildGetTokenDefsToolResult, m as ClientEventSchema, n as HUB_LOCK_PATH, nt as UploadAssetResultSchema, ot as buildGetDesignSystemToolResult, p as log, pt as utf8Bytes, q as MCP_TOOL_TIMEOUT_MS, r as HUB_LOCK_STALE_MS, rt as buildApplyCanvasToolResult, s as PACKAGE_VERSION, st as buildGetScreenshotToolResult, t as ASSET_DIR, tt as UploadAssetParametersSchema, u as ensureDir, ut as buildUploadAssetToolResult, v as AGENT_CLIENTS, w as FigmaSessionSchema, x as DesignAnchorSchema, y as ApplyCanvasParametersSchema } from "./shared-Dh112Muy.mjs";
2
2
  import { execFile, spawn } from "node:child_process";
3
3
  import { connect, createServer } from "node:net";
4
4
  import { dirname, join, resolve } from "node:path";
@@ -2588,7 +2588,7 @@ var DesignTasks = class {
2588
2588
  if (!record) fail("DESIGN_TASK_INACTIVE", "Unknown or expired task. Begin a new design task and reread its target.");
2589
2589
  if (record.ownerId !== ownerId) fail("DESIGN_TASK_OWNER_MISMATCH", "This task belongs to another MCP caller. Begin your own task.");
2590
2590
  if (active && record.task.reviewClosed) fail("DESIGN_TASK_INACTIVE", "This review is closed. Begin a new task before writing.");
2591
- if (active && record.task.status !== "active") fail("DESIGN_TASK_INACTIVE", `Design task is ${record.task.status}. ${record.task.status === "cancelled" ? "Begin a new task with a fresh requestId before writing." : "Resume this task with resume_design and reread the target before writing; do not replay an old write."}`);
2591
+ if (active && record.task.status !== "active") fail("DESIGN_TASK_INACTIVE", `Design task is ${record.task.status}. ${record.task.status === "cancelled" ? "Begin a new task with a fresh requestId before writing." : "Use manage_design_task with action \"resume\" and reread the target before writing; do not replay an old write."}`);
2592
2592
  return record;
2593
2593
  }
2594
2594
  /** Runtime identity may reconnect the same conversation, never a focused/last caller. */
@@ -2606,7 +2606,7 @@ var DesignTasks = class {
2606
2606
  }
2607
2607
  assertEpoch(taskId, ownerId, epoch) {
2608
2608
  const record = this.owned(taskId, ownerId);
2609
- if ((epoch ?? 0) !== (record.task.epoch ?? 0)) fail("DESIGN_TASK_INACTIVE", "Stale task lease. Read get_design_task for the current epoch, resume_design if inactive, and reread the canvas before writing.");
2609
+ if ((epoch ?? 0) !== (record.task.epoch ?? 0)) fail("DESIGN_TASK_INACTIVE", "Stale task lease. Read get_design_task for the current epoch, use manage_design_task with action \"resume\" if inactive, and reread the canvas before writing.");
2610
2610
  return record;
2611
2611
  }
2612
2612
  resume(taskId, ownerId, epoch, session) {
@@ -3116,7 +3116,7 @@ function rawDataToBuffer(raw) {
3116
3116
  }
3117
3117
  //#endregion
3118
3118
  //#region src/instructions.md?raw
3119
- var instructions_default = "You are connected to Figma through TemPad Dev. An active MCP badge selects the default file;\nbrowser focus does not. When the target is unclear, call `list_design_sessions` and pass the exact\n`sessionId` to `begin_design` or an independent read. Task targets never follow browser focus;\ntask-bound reads stay on their task's session. Independent reads need no task. Run calls against\nthe same file sequentially, including reads.\n\nFor new design work, call `begin_design` before research or writing, then carry its `taskId`.\nChoose a known Frame with `set_design_anchor` once the region is clear; otherwise the first new\ntop-level Frame anchors automatically. Reads, selections, and later writes never change the anchor\nunless `set_design_anchor` does. Task identity survives turns. A pause or idle lease expiry releases\ncanvas ownership without cancelling the task;\nresume the same task with `resume_design`, carry its returned `epoch` as `taskEpoch`, and reread the\nbound canvas with `get_structure` or `get_code` before writing. Use `get_design_task` for recovery,\nnot routine polling. Never replay a stale write or queue a write against an occupied file.\n`end_design` is for a verified completed pass or explicit cancellation, not a wait for input.\nCompletion releases ownership but keeps the review and same task open for comments until the user\nclicks Done; resume that task for follow-up comments. Cancelled, closed, or replaced tasks cannot\nresume. The Figma Stop control permanently cancels the current task after its running operation\nsettles; do not resume or automatically replace it. If further work is necessary or requested,\nbegin a fresh task with a new requestId; no separate\nFigma unlock or user turn is required. No progress or heartbeat calls are needed.\n\nFeedback drafts contain individually numbered elements captured when saved. Reread each exact node\nbefore acting; do not substitute the current selection. Supported hosts deliver submitted feedback\nthrough native conversation messages. Do not poll, launch helpers, or configure a control endpoint.\n\nTreat tool outputs as file-scoped facts. Never invent node IDs, resource refs, library keys, token\norigins, or design-system intent. Tool descriptions give mechanical affordances; the applicable host\nskill governs workflow, representation, and design judgment. For Figma-to-code, use `get_code` as\nvisible implementation evidence. Use `get_structure` only for hierarchy, geometry, managed-key\nuncertainty, or targeted mask, IMAGE paint, layout-grid, and frame-guide read-back via\n`options.native`.\n\nFor canvas authoring, choose the native representation through the skill, then describe one desired\nresult with `apply_canvas`. Canvas HTML serializes ordinary layers; typed fields carry selected\nnative state, resources, and bindings. Never send raw Plugin API operations or arbitrary JavaScript.\n`get_design_system` is optional when existing-resource reuse is relevant and permitted; new local\nresources do not require it. `scope: \"fonts\"` independently reads environment availability.\nFor large files, `scope: \"pages\"` finds a relevant component page before `pageId`-scoped discovery;\nvariables, styles, and shaders remain file-wide. Use catalog CSS names or a call-scoped `theme` for\nvariable utilities and native text-style classes. Load skill references only after choosing a\nnative concept.\n\nWhen design evidence is limited to the current page or an independent system without reuse, stay\non the Direct path: do not discover resource catalogs, inspect other pages, or use catalog refs.\n`scope: \"fonts\"` remains available. Local variables and styles remain file-wide Figma resources,\nand the extension may still check file-wide identities internally for safe reconciliation.\n\nCreates add and automatically place one root. Updates use exact node identity: omission preserves\nlive state; explicit removal removes managed content. Read structural verification and resolve\nwarnings before claiming completion. Use `get_screenshot` when pixels affect a decision and open\nits image before claiming visual verification. Use `asset.localPath` when present, otherwise\n`asset.url`; native media hashes identify assets within one Figma file, not preview bytes. Never\nship `data-hint-*` attributes from read-tool output.\n";
3119
+ var instructions_default = "You are connected to Figma through TemPad Dev. An active MCP badge selects the default file;\nbrowser focus does not. When the target is unclear, call `list_design_sessions` and pass the exact\n`sessionId` to `manage_design_task` with action `begin` or an independent read. Task targets never follow browser focus;\ntask-bound reads stay on their task's session. Independent reads need no task. Run calls against\nthe same file sequentially, including reads.\n\nFor new design work, call `manage_design_task` with action `begin` before research or writing,\nthen carry its `taskId`.\nChoose a known Frame with `set_design_anchor` once the region is clear; otherwise the first new\ntop-level Frame anchors automatically. Reads, selections, and later writes never change the anchor\nunless `set_design_anchor` does. Task identity survives turns. A pause or idle lease expiry releases\ncanvas ownership without cancelling the task;\nuse action `resume` with the current `epoch`, carry its returned `epoch` as `taskEpoch`, and reread the\nbound canvas with `get_structure` or `get_code` before writing. Use `get_design_task` for recovery,\nnot routine polling. Never replay a stale write or queue a write against an occupied file.\nActions `complete` and `cancel` require the current `epoch` and end a verified pass or explicitly\nabandon it; they are not for a wait for input.\nCompletion releases ownership but keeps the review and same task open for comments until the user\nclicks Done; resume that task for follow-up comments. Cancelled, closed, or replaced tasks cannot\nresume. The Figma Stop control permanently cancels the current task after its running operation\nsettles; do not resume or automatically replace it. If further work is necessary or requested,\nuse action `begin` with a fresh requestId; no separate\nFigma unlock or user turn is required. No progress or heartbeat calls are needed.\n\nFeedback drafts contain individually numbered elements captured when saved. Reread each exact node\nbefore acting; do not substitute the current selection. Supported hosts deliver submitted feedback\nthrough native conversation messages. Do not poll, launch helpers, or configure a control endpoint.\n\nTreat tool outputs as file-scoped facts. Never invent node IDs, resource refs, library keys, token\norigins, or design-system intent. Tool descriptions give mechanical affordances; the applicable host\nskill governs workflow, representation, and design judgment. For Figma-to-code, use `get_code` as\nvisible implementation evidence. Use `get_structure` only for hierarchy, geometry, managed-key\nuncertainty, or targeted mask, IMAGE paint, layout-grid, and frame-guide read-back via\n`options.native`.\n\nFor canvas authoring, choose the native representation through the skill, then describe one desired\nresult with `apply_canvas`. Canvas HTML serializes ordinary layers; typed fields carry selected\nnative state, resources, and bindings. Never send raw Plugin API operations or arbitrary JavaScript.\n`get_design_system` is optional when existing-resource reuse is relevant and permitted; new local\nresources do not require it. `scope: \"fonts\"` independently reads environment availability.\nFor large files, `scope: \"pages\"` finds a relevant component page before `pageId`-scoped discovery;\nvariables, styles, and shaders remain file-wide. Use catalog CSS names or a call-scoped `theme` for\nvariable utilities and native text-style classes. Load skill references only after choosing a\nnative concept.\n\nWhen design evidence is limited to the current page or an independent system without reuse, stay\non the Direct path: do not discover resource catalogs, inspect other pages, or use catalog refs.\n`scope: \"fonts\"` remains available. Local variables and styles remain file-wide Figma resources,\nand the extension may still check file-wide identities internally for safe reconciliation.\n\nCreates add and automatically place one root. Updates use exact node identity: omission preserves\nlive state; explicit removal removes managed content. Read structural verification and resolve\nwarnings before claiming completion. Use `get_screenshot` when pixels affect a decision and open\nits image before claiming visual verification. Use `asset.localPath` when present, otherwise\n`asset.url`; native media hashes identify assets within one Figma file, not preview bytes. Never\nship `data-hint-*` attributes from read-tool output.\n";
3120
3120
  //#endregion
3121
3121
  //#region src/request.ts
3122
3122
  const pendingCalls = /* @__PURE__ */ new Map();
@@ -3323,26 +3323,10 @@ const TOOL_DEFS = [
3323
3323
  outputSchema: z.object({ sessions: z.array(FigmaSessionSchema) })
3324
3324
  }),
3325
3325
  hubTool({
3326
- name: "resume_design",
3327
- description: "Continue the current design task after pause, expiry, interruption, or completion awaiting review. Keep the same taskId and design region for follow-up comments until the user clicks Done. Cancelled, closed, or replaced tasks cannot resume. The original browser tab automatically rebinds after a page refresh; get_design_task returns its current epoch. Pass that epoch to resume. Pass the returned epoch as taskEpoch on subsequent calls, and read the bound canvas with get_structure or get_code before writing. Never replay an old write.",
3326
+ name: "manage_design_task",
3327
+ description: "Manage one design task. begin requires title and a fresh UUID requestId, optionally sessionId; reserve the file before research or writing, and reuse requestId only for the same begin retry. Beginning replaces the previous task for that file; idle ownership expires after five minutes. Other actions require taskId and current epoch. resume continues the same open review after pause, expiry, interruption, or completion; pass its returned epoch as taskEpoch on subsequent work and reread the bound canvas before writing. Cancelled, closed, or replaced tasks cannot resume. complete releases ownership after the outcome and verification, keeping the review open until the user clicks Done. cancel permanently abandons the task after any running operation settles; applied changes remain. summary is optional for complete/cancel. Waiting for input is a pause, not completion. No progress or heartbeat calls are needed.",
3328
3328
  annotations: ASSET_WRITE_ANNOTATIONS,
3329
- parameters: ResumeDesignParametersSchema,
3330
- target: "hub",
3331
- outputSchema: DesignTaskSchema
3332
- }),
3333
- hubTool({
3334
- name: "begin_design",
3335
- description: "Begin a new design task in the active Figma session before design research or writing. Returns a taskId bound to that file and session; pass it on subsequent task calls. No coordinates or progress reports are needed. Idle ownership expires after five minutes. Reuse requestId only when retrying this same begin. Stop a busy task in TemPad Dev before another task takes over. For follow-up comments on an open review, use resume_design on the same task, including after completion. Beginning a new task replaces the previous task for that file.",
3336
- annotations: ASSET_WRITE_ANNOTATIONS,
3337
- parameters: BeginDesignParametersSchema,
3338
- target: "hub",
3339
- outputSchema: DesignTaskSchema
3340
- }),
3341
- hubTool({
3342
- name: "end_design",
3343
- description: "Mark this design pass complete after the requested outcome and its verification. Releases file ownership and keeps the same task, design region, and review open for comments. Follow-up comments resume this task; only the user’s Done closes the review. Waiting for input before the outcome is ready or stopping a turn is a pause. Cancel when abandoning a task; already completed writes remain. Retrying within the same epoch is safe. Cancellation waits for a running operation to finish before handing over the file.",
3344
- annotations: ASSET_WRITE_ANNOTATIONS,
3345
- parameters: EndDesignParametersSchema,
3329
+ parameters: ManageDesignTaskParametersSchema,
3346
3330
  target: "hub",
3347
3331
  outputSchema: DesignTaskSchema
3348
3332
  }),
@@ -3556,9 +3540,7 @@ function getBudgetRetryGuidance(toolName) {
3556
3540
  switch (toolName) {
3557
3541
  case "get_design_task":
3558
3542
  case "list_design_sessions":
3559
- case "begin_design":
3560
- case "resume_design":
3561
- case "end_design":
3543
+ case "manage_design_task":
3562
3544
  case "set_design_anchor": return "Retry the same task lifecycle request without changing its identity.";
3563
3545
  case "apply_canvas": return "Submit a smaller desired subtree and retry.";
3564
3546
  case "get_code": return "Reduce selection size or request a smaller nodeId subtree and retry.";
@@ -3766,17 +3748,9 @@ function enrichToolDefinition(tool) {
3766
3748
  };
3767
3749
  }
3768
3750
  };
3769
- case "resume_design": return {
3770
- ...tool,
3771
- handler: handleResumeDesign
3772
- };
3773
- case "begin_design": return {
3751
+ case "manage_design_task": return {
3774
3752
  ...tool,
3775
- handler: handleBeginDesign
3776
- };
3777
- case "end_design": return {
3778
- ...tool,
3779
- handler: handleEndDesign
3753
+ handler: handleManageDesignTask
3780
3754
  };
3781
3755
  case "get_assets": return {
3782
3756
  ...tool,
@@ -3891,6 +3865,26 @@ function publishDesignTask({ task }) {
3891
3865
  function resolveDesignRoute(ownerId, taskId, active = true, explicitSessionId) {
3892
3866
  return resolveDesignTarget(designTasks, extensionRegistry.list(), extensionRegistry.getActiveId(), ownerId, taskId, active, explicitSessionId);
3893
3867
  }
3868
+ async function handleManageDesignTask(args, ownerId) {
3869
+ switch (args.action) {
3870
+ case "begin": return handleBeginDesign({
3871
+ title: args.title,
3872
+ requestId: args.requestId,
3873
+ sessionId: args.sessionId
3874
+ }, ownerId);
3875
+ case "resume": return handleResumeDesign({
3876
+ taskId: args.taskId,
3877
+ epoch: args.epoch
3878
+ }, ownerId);
3879
+ case "complete":
3880
+ case "cancel": return handleEndDesign({
3881
+ taskId: args.taskId,
3882
+ taskEpoch: args.epoch,
3883
+ outcome: args.action === "complete" ? "completed" : "cancelled",
3884
+ summary: args.summary
3885
+ }, ownerId);
3886
+ }
3887
+ }
3894
3888
  async function handleBeginDesign(args, ownerId) {
3895
3889
  let record = designTasks.retry(ownerId, args.requestId);
3896
3890
  if (record) {
@@ -4100,11 +4094,7 @@ function registerLocalTool(mcp, tool, ownerId) {
4100
4094
  try {
4101
4095
  const parsed = schema.parse(args);
4102
4096
  const taskId = getRecordProperty(parsed, "taskId");
4103
- if (![
4104
- "end_design",
4105
- "resume_design",
4106
- "get_design_task"
4107
- ].includes(tool.name) && typeof taskId === "string") {
4097
+ if (!["manage_design_task", "get_design_task"].includes(tool.name) && typeof taskId === "string") {
4108
4098
  designTasks.assertEpoch(taskId, ownerId, getRecordProperty(parsed, "taskEpoch"));
4109
4099
  designTasks.touch(taskId, ownerId);
4110
4100
  }