@ai-setting/roy-plugin-task-show 0.9.5 → 0.9.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-plugin-task-show",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "description": "roy-agent plugin: visualize task solving process via tool call flow on a local web service",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-plugin-task-show",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "type": "tool-plugin",
5
5
  "description": "Visualize the tool call chain of a task on a local web service with real-time SSE updates. v0.9.0: Session-scoped home page (only show tasks created after plugin load + their external ancestors), with per-row 「显示全部栏位」 toggle and lazy-loaded operations timeline; per-task Mermaid labels now correctly render CJK / mixed-Latin / emoji text (encoded as \\uXXXX before emission, decoded by the browser); detail page layout reordered to lifecycle → pipeline → stats → toolcalls → rawjson. v0.5.0+: page refreshes stream over GET /api/events (Server-Sent Events). Subscribes to tool:before.execute, tool:after.execute, task:before.create, task:after.create, task:after.complete (preferred, 2026-07-10+), and task:after.update (legacy fallback). v0.6.11: Mermaid re-rendering is delegated to a self-contained controller (public/mermaid-renderer.js) that prevents the SVG→raw-source regression on async updates and surfaces recoverable .mermaid-error states. v0.6.12: Task lifecycle pipeline (operations timeline) server now emits data-task-id on the pipeline section; client preserves it on swap, so the page actually fetches /api/tasks/<id>/operations and renders the 7-op timeline (previously silently bailed). v0.7.0: Home page redesigned as a hierarchical task tree (driven by `roy-agent tasks tree --json`); new /api/tasks/tree endpoint with status / priority / type / root-id filters, expand/collapse UI, search, and live 30s polling. v0.8.0: per-task page Mermaid area now renders the hierarchical 'Task lifecycle + tools' view — each operation record owns a subgraph that nests its tool calls, with click callbacks (`window.__toolClick`) that scroll-into-view + highlight + auto-expand the matching row in the tool-call table below. Operation record descriptions (`description` + `processDescription`) are now always rendered inline (no `<details>` collapse) so the user sees the lifecycle state at a glance; a fallback `<details>` kicks in only for descriptions longer than 600 chars. v0.8.1: hotfix for two pre-existing bugs in v0.8.0 (browser smoke test surfaced after merge). (a) Mermaid click directives were emitted as `click t1 __toolClick(1)` (missing `call` keyword) — Mermaid 10's parser rejects this with `got 'PS'`. Fixed to `click t1 call __toolClick(1)` (the v10 grammar requires `call` to invoke a callback with arguments). (b) `buildMermaidSource` lived inside the `attachTaskPageTimeline` IIFE but was also called from a listener in the `attachToolClickBridge` IIFE — sibling IIFEs cannot see each other's locals, so the listener threw `ReferenceError: buildMermaidSource is not defined` and the Mermaid diagram silently failed to re-render after `task-show:lifecycle-ops-loaded`. Fixed by hoisting the function (and its three helpers) to script top-level so both IIFEs can see it via the script-wide closure; the function is also exposed on `window.buildMermaidSource` for tests + tooling. v0.8.3: tree-display fix (Task #2426). The home page used to look like a flat list of root tasks because `autoExpandFirstLevels(..., 2)` only opened the first 2 levels — 30/47 roots were leaf nodes and the remaining 17 collapsed to one level so grandchildren were never visible. Default expand depth is now 3 (root + child + grandchild + great-grandchild are visible on first paint), the summary line now shows per-depth count pills (root / child / grandchild / great-grandchild / level-N), each `tree-row` carries a `data-depth` attribute so CSS can paint coloured left rails per level, and the duplicated 'Live tool-call sessions (legacy view)' panel that made the page look like both a flat table AND a tree is now hidden behind `#legacy-sessions[hidden]` (kept for future debug-toggle restoration). v0.8.10: bug-fix release (Task #2537 + Task #2534). (a) Heap-bounded plugin caches: OperationsCache and TasksTreeCache now enforce a hard maxEntries cap (default 256 / 64). Oldest stale entries are evicted before inserting a new one, so long-lived roy-agent sessions (BackgroundTaskManager + MemorySessionStore) no longer leak Map entries through the plugin's per-task caches — see Task #2537 for the heap-unbounded-state RED→GREEN repro. (b) Mermaid CJK font-family: server.ts renderTaskPage now configures mermaid.initialize({ themeVariables: { fontFamily: '\"PingFang SC\", \"Microsoft YaHei\", \"Noto Sans CJK SC\", \"Source Han Sans CN\", \"WenQuanYi Micro Hei\", sans-serif' } }) so Chinese node labels render correctly in browsers that have at least one of those fonts installed (see Task #2534).",
6
6
  "main": "dist/index.js",
package/public/app.js CHANGED
@@ -447,7 +447,12 @@ function sanitiseTitleForLabelClient(title) {
447
447
  cutAt = hashMatch.index + (hashMatch[0].startsWith(":") ? 1 : 0);
448
448
  }
449
449
  if (cutAt > 0) s = s.substring(0, cutAt);
450
- return escapeMermaid(s);
450
+ // v0.9.7 (fix/mermaid-chinese-render): use the CJK-safe encoder instead
451
+ // of `escapeMermaid`. The latter replaces every non-alphanumeric code
452
+ // point (including CJK) with `_`, which turns Chinese titles into
453
+ // `________`. `encodeMermaidLabelTextClient` only escapes characters that
454
+ // actually break the Mermaid parser and emits non-ASCII as `\uXXXX`.
455
+ return encodeMermaidLabelTextClient(s);
451
456
  }
452
457
 
453
458
  /**
@@ -467,7 +472,10 @@ function getPhaseLabel(op) {
467
472
  const meta = PHASE_LABELS_CLIENT[phaseId];
468
473
  return `${meta.emoji} Phase ${info.num}: ${meta.name}<br/>${meta.description}`;
469
474
  }
470
- return `\u2699\ufe0f Phase ${info.num}: ${escapeMermaid(info.name)}`;
475
+ // v0.9.7 (fix/mermaid-chinese-render): fall back to the CJK-safe encoder
476
+ // so Chinese phase names survive as `\uXXXX` escapes instead of being
477
+ // collapsed to underscores.
478
+ return `\u2699\ufe0f Phase ${info.num}: ${encodeMermaidLabelTextClient(info.name)}`;
471
479
  }
472
480
  // 2. Try matching the entire (short) title as a phase alias.
473
481
  if (title.length <= 60) {
@@ -502,7 +510,10 @@ function getPhaseLabel(op) {
502
510
  const sanitised = sanitiseTitleForLabelClient(title);
503
511
  if (sanitised) return `\u2699\ufe0f ${sanitised}`;
504
512
  // 5. Absolute fallback: milestoneType.
505
- return `\u2699\ufe0f ${escapeMermaid(milestoneType || "op")}`;
513
+ // v0.9.7 (fix/mermaid-chinese-render): use the CJK-safe encoder so a
514
+ // milestoneType like `custom-cjk-type` survives verbatim while any CJK
515
+ // characters inside it are emitted as `\uXXXX`.
516
+ return `\u2699\ufe0f ${encodeMermaidLabelTextClient(milestoneType || "op")}`;
506
517
  }
507
518
 
508
519
  // Expose for tests + any tooling that wants to render the Mermaid