@ai-setting/roy-plugin-task-show 1.1.0 → 2.0.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.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shared task metadata normalization and safe formatting.
3
+ *
4
+ * Task storage currently serializes `context` as a JSON string, while callers
5
+ * and test doubles may provide an already-parsed object. Keep that type
6
+ * compatibility at the adapter boundary instead of dropping the field in a
7
+ * summary DTO or coercing objects to "[object Object]" in the renderer.
8
+ */
9
+ export type TaskContextValue = Record<string, unknown> | unknown[] | string;
10
+ /**
11
+ * Normalize the task-store/CLI representations accepted by the plugin.
12
+ *
13
+ * - null/undefined/whitespace-only values become undefined;
14
+ * - JSON object/array strings become structured values;
15
+ * - malformed JSON and ordinary strings remain displayable strings;
16
+ * - parsed objects/arrays are preserved without lossy coercion.
17
+ */
18
+ export declare function normalizeTaskContext(value: unknown): TaskContextValue | undefined;
19
+ /** Format a metadata value for a preformatted, HTML-escaped text node. */
20
+ export declare function formatTaskMetadata(value: unknown, empty?: string): string;
21
+ //# sourceMappingURL=task-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-metadata.d.ts","sourceRoot":"","sources":["../src/task-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC;AAE5E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAqBjF;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAM,GAAG,MAAM,CAWtE"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Normalize the task-store/CLI representations accepted by the plugin.
3
+ *
4
+ * - null/undefined/whitespace-only values become undefined;
5
+ * - JSON object/array strings become structured values;
6
+ * - malformed JSON and ordinary strings remain displayable strings;
7
+ * - parsed objects/arrays are preserved without lossy coercion.
8
+ */
9
+ export function normalizeTaskContext(value) {
10
+ if (value === null || value === undefined)
11
+ return undefined;
12
+ if (typeof value === "string") {
13
+ const trimmed = value.trim();
14
+ if (!trimmed)
15
+ return undefined;
16
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
17
+ try {
18
+ const parsed = JSON.parse(trimmed);
19
+ if (parsed && typeof parsed === "object") {
20
+ return parsed;
21
+ }
22
+ }
23
+ catch {
24
+ // A malformed JSON string is still useful context; display it verbatim.
25
+ }
26
+ }
27
+ return value;
28
+ }
29
+ if (typeof value === "object") {
30
+ return value;
31
+ }
32
+ return String(value);
33
+ }
34
+ /** Format a metadata value for a preformatted, HTML-escaped text node. */
35
+ export function formatTaskMetadata(value, empty = "—") {
36
+ const normalized = normalizeTaskContext(value);
37
+ if (normalized === undefined)
38
+ return empty;
39
+ if (typeof normalized === "string")
40
+ return normalized;
41
+ try {
42
+ return JSON.stringify(normalized, null, 2) ?? empty;
43
+ }
44
+ catch {
45
+ // JSON values from the CLI should be serializable, but don't let a
46
+ // defensive renderer crash if a test/caller passes a cyclic object.
47
+ return String(normalized);
48
+ }
49
+ }
50
+ //# sourceMappingURL=task-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-metadata.js","sourceRoot":"","sources":["../src/task-metadata.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACvD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC5C,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;oBACzC,OAAO,MAA6C,CAAC;gBACvD,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,wEAAwE;YAC1E,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAA4C,CAAC;IACtD,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,kBAAkB,CAAC,KAAc,EAAE,KAAK,GAAG,GAAG;IAC5D,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,OAAO,UAAU,KAAK,QAAQ;QAAE,OAAO,UAAU,CAAC;IACtD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,mEAAmE;QACnE,oEAAoE;QACpE,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC"}
@@ -2,6 +2,7 @@
2
2
  * @fileoverview Session-scoped task forest for the v0.9.0 home page.
3
3
  */
4
4
  import type { TaskTreeNodeTask, TaskTreeNode } from "./cli-tasks-tree-adapter.js";
5
+ import { type TaskContextValue } from "./task-metadata.js";
5
6
  export interface SessionScopedTask {
6
7
  id: number;
7
8
  title: string;
@@ -16,7 +17,7 @@ export interface SessionScopedTask {
16
17
  tags: string[];
17
18
  project_path?: string;
18
19
  parent_task_id?: number;
19
- context?: string;
20
+ context?: TaskContextValue;
20
21
  goals_and_expected_deliverables?: string;
21
22
  }
22
23
  export type TaskFetcher = (id: number) => Promise<SessionScopedTask | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"task-session-store.d.ts","sourceRoot":"","sources":["../src/task-session-store.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGlF,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B,CAAC,EAAE,MAAM,CAAC;CAC1C;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;AAE5E,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC1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,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { TracedAs, withTraceSync } from "./tracing/decorator.js";
8
+ import { formatTaskMetadata } from "./task-metadata.js";
8
9
  export class TaskSessionStore {
9
10
  opts;
10
11
  latestLeafId = null;
@@ -116,7 +117,12 @@ __decorate([
116
117
  ], TaskSessionStore.prototype, "buildSessionForest", null);
117
118
  function esc(s) {
118
119
  const str = s === undefined || s === null ? "" : String(s);
119
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
120
+ return str
121
+ .replace(/&/g, "&amp;")
122
+ .replace(/</g, "&lt;")
123
+ .replace(/>/g, "&gt;")
124
+ .replace(/"/g, "&quot;")
125
+ .replace(/'/g, "&#39;");
120
126
  }
121
127
  export function renderSessionForestPage(args) {
122
128
  return withTraceSync("html.session-forest.render", () => _renderSessionForestPageImpl(args));
@@ -133,9 +139,9 @@ function _renderSessionForestPageImpl(args) {
133
139
  <summary>metadata</summary>
134
140
  <dl>
135
141
  <dt>project_path</dt><dd>${esc(t.project_path)}</dd>
136
- <dt>context</dt><dd><pre>${esc(t.context)}</pre></dd>
142
+ <dt>context</dt><dd><pre class="metadata-json">${esc(formatTaskMetadata(t.context))}</pre></dd>
137
143
  <dt>description</dt><dd>${esc(t.description)}</dd>
138
- <dt>goals</dt><dd>${esc(t.goals_and_expected_deliverables)}</dd>
144
+ <dt>goals</dt><dd><pre class="metadata-text">${esc(formatTaskMetadata(t.goals_and_expected_deliverables))}</pre></dd>
139
145
  <dt>tags</dt><dd>${esc((t.tags ?? []).join(", "))}</dd>
140
146
  <dt>createdAt</dt><dd>${esc(t.createdAt)}</dd>
141
147
  <dt>updatedAt</dt><dd>${esc(t.updatedAt)}</dd>
@@ -148,6 +154,24 @@ function _renderSessionForestPageImpl(args) {
148
154
  };
149
155
  for (const node of args.forest)
150
156
  walk(node, 0);
151
- return `<section class="session-forest" data-session-forest="1"><h2>本会话任务</h2><ul>${rows.join("")}</ul></section>`;
157
+ const forestHtml = `<section class="session-forest" data-session-forest="1"><h2>本会话任务</h2><ul>${rows.join("")}</ul></section>`;
158
+ return `<!DOCTYPE html>
159
+ <html lang="zh-CN">
160
+ <head>
161
+ <meta charset="utf-8">
162
+ <meta name="viewport" content="width=device-width, initial-scale=1">
163
+ <title>roy-plugin-task-show · session forest</title>
164
+ <link rel="stylesheet" href="/static/style.css">
165
+ </head>
166
+ <body data-live-refresh data-view="session-forest">
167
+ <header class="topbar">
168
+ <h1>🌳 roy-plugin-task-show · 本会话任务</h1>
169
+ <p class="meta">只显示插件加载后创建的任务及其必要祖先;展开每行可查看完整 metadata。</p>
170
+ </header>
171
+ ${forestHtml}
172
+ <script src="/static/task-operations.js"></script>
173
+ <script src="/static/session-forest.js"></script>
174
+ </body>
175
+ </html>`;
152
176
  }
153
177
  //# sourceMappingURL=task-session-store.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"task-session-store.js","sourceRoot":"","sources":["../src/task-session-store.ts"],"names":[],"mappings":";;;;;;AAIA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA6CjE,MAAM,OAAO,gBAAgB;IACV,IAAI,CAGnB;IACM,YAAY,GAAkB,IAAI,CAAC;IAE3C,YAAY,IAA+B;QACzC,IAAI,CAAC,IAAI,GAAG;YACV,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE;YACrC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC;SACpD,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,YAAY,IAAI,SAAS,CAAC;IACxC,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,MAAc;Q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;yBACtF,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;8BACzB,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;8BAChB,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;;;yDAGW,CAAC,CAAC,EAAE;MACvD,CAAC,CAAC;QACJ,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM;QAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,6EAA6E,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,iBAAiB,CAAC;IAC/H,OAAO;;;;;;;;;;;;;IAaL,UAAU;;;;QAIN,CAAC;AACT,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-plugin-task-show",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
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,8 +1,8 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-plugin-task-show",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "type": "tool-plugin",
5
- "description": "v1.1.0: Full Server-Sent Events realtime subscription across 3 event classes (task.created / operation.updated / tool.called) on both the home page and the per-task /task/<id> page. The per-task pipeline now subscribes to /api/events and patches the DOM in place on operation.updated — no more 5s-poll delay before the user sees a new milestone. The 'Task lifecycle pipeline' header badge is replaced by a 5-state SSE-aware badge (stale / connecting / live / reconnecting / error) so the user can tell at a glance whether real-time updates are flowing, the connection dropped, or 3+ consecutive errors triggered the polling fallback. Legacy boolean `stale` cache-TTL pill and `tool.recorded` event name are preserved for back-compat with v0.9.x / v1.0.0 clients. v1.0.0: First stable release. Replaces the v0.9.x fixture-based verify scripts (which built fake TaskOperationsEnvelope and never invoked the real `roy-agent` CLI, masking regressions in the public-schema `processDescription` field) with a real-CLI scenario test + verify (`test/process-description-real-scenario.test.ts` + `scripts/verify-v100-real-scenario.ts`) that spawns `roy-agent tasks get <id> --operations --json` via `defaultRunner` and asserts the API response carries `processDescription` end-to-end. The 0.9.9 processDescription fix is preserved verbatim — this release only swaps the verify surface. Visualize the tool call chain of a task on a local web service with real-time SSE updates. v0.9.9: Task lifecycle pipeline on /task/<id> now exposes BOTH the milestone badge AND the 「过程描述」 column at a glance — the server-side `/api/tasks/:id/operations` endpoint exposes `processDescription` on every operation (no longer stripped from the public schema), the client-side `renderPipelineHtml` mirrors the server's `.op-desc-block` + `.op-proc-block` block layout so SSR ↔ CSR stay in sync, and a long-standing CSS right-side text-truncation bug in the pipeline timeline (long CJK titles overflowing the panel edge) is fixed via `min-width: 0` on `.op-row1` + `overflow-wrap: anywhere` on `.op-title`. 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).",
5
+ "description": "v2.0.0: Major visual overhaul of the per-task detail page — VS Code-style tool-call browser powered by Monaco Editor + LCS-based diff + project file tree with mermaid-driven navigation. The detail page now renders a 2-column layout: a sticky left sidebar with the project's git-tracked file tree (chevron-toggle directories, `is-affected` highlight for files touched by the current task), and a main column with the existing Mermaid + stats + toolcalls table + a new dedicated `<section id=\"tool-call-detail-panel\">` that hosts the LCS diff body + Monaco container for the currently-selected tool call. The legacy inline `<details class=\"diff-panel\">` (naive split-and-filter, prone to mis-tagging context lines) is replaced by `<ol class=\"diff-body\">` with proper added/removed/context markers driven by a real LCS dynamic-programming table (`computeDiff()` in `src/tool-call-detail.ts`). Tool calls with a file path get a Monaco Editor placeholder (`<div class=\"monaco-editor\" data-file-path=\"...\" data-language=\"...\">`) which the client-side `public/tool-call-detail.js` lazy-loads from `cdn.jsdelivr.net/npm/monaco-editor@0.45.0` the first time the user clicks a tool row. The Mermaid `__toolClick(toolId)` callback now drives THREE things: (a) the existing row scroll + highlight (preserved from v1.x), (b) the dedicated detail panel re-renders with the matching call, (c) the file-tree sidebar highlights the corresponding file (when `data-file-path` is present). New `GET /api/task/:id/file-tree` endpoint serves the git-tracked file list (`{ files: string[] }`) with a 30-second in-memory TTL + 8-entry FIFO bound. New modules: `src/file-tree.ts` (pure data layer: `buildFileTree / extractAffectedPaths / findNodeByPath / collectAllPaths / gitLsFiles / parseLsFiles`), `src/tool-call-detail.ts` (SSR + LCS diff + HTML escaping), `public/file-tree.js` (vanilla JS hydrator with chevron toggle + keyboard navigation + scrollIntoView), `public/tool-call-detail.js` (Monaco AMD loader + `__toolClick` wrapper + file-content fetch). New tests: `test/file-tree.test.ts` (21 cases — empty/single/nested/dedup/sort/depth/parseLsFiles/gitLsFiles), `test/tool-call-detail.test.ts` (22 cases — LCS diff edges, HTML escape, path aliases, summary stats), `test/tool-call-detail-server-integration.test.ts` (7 cases — SSR HTML contracts + endpoint), `test/tool-call-detail-jsdom.test.ts` (7 cases — client-side hydrators). v1.2.0: CSS context & packaged release hotfix. The plugin's public assets (notably `public/style.css`) and runtime adapters now correctly resolve relative to the installed package directory even when consumed via the published npm tarball. The session-scoped `TaskSessionStore` now preserves the full host session context (parent-child task links, plugin-handle id, env scope) across render cycles — previously the session was collapsed to its `sessionId` on first load and never refreshed, so the home page lost the 「session ancestors」 chain and external tasks from outside the current session silently disappeared from the tree. Adds `src/task-metadata.ts` as the single source of truth for the public `Task` shape exposed by `/api/tasks` + `/api/tasks/:id`, including the v1.0.0+ `processDescription` field, and re-exports it through the CLI adapters (`cli-tasks-adapter.ts` + `cli-tasks-tree-adapter.ts`) so the home page tree + the per-task page render against the same metadata contract. Bundles 244-line regression test (`test/context-and-packed-release.test.ts`) that boots the plugin from the **npm-pack** directory (not the repo working tree), spawns `roy-agent tasks get <id> --json`, and asserts (a) `public/style.css` is present and ≥ 64 lines, (b) the `/api/events` SSE endpoint survives a reload, and (c) `task.session` survives a render cycle. v1.1.0: Full Server-Sent Events realtime subscription across 3 event classes (task.created / operation.updated / tool.called) on both the home page and the per-task /task/<id> page. The per-task pipeline now subscribes to /api/events and patches the DOM in place on operation.updated — no more 5s-poll delay before the user sees a new milestone. The 'Task lifecycle pipeline' header badge is replaced by a 5-state SSE-aware badge (stale / connecting / live / reconnecting / error) so the user can tell at a glance whether real-time updates are flowing, the connection dropped, or 3+ consecutive errors triggered the polling fallback. Legacy boolean `stale` cache-TTL pill and `tool.recorded` event name are preserved for back-compat with v0.9.x / v1.0.0 clients. v1.0.0: First stable release. Replaces the v0.9.x fixture-based verify scripts (which built fake TaskOperationsEnvelope and never invoked the real `roy-agent` CLI, masking regressions in the public-schema `processDescription` field) with a real-CLI scenario test + verify (`test/process-description-real-scenario.test.ts` + `scripts/verify-v100-real-scenario.ts`) that spawns `roy-agent tasks get <id> --operations --json` via `defaultRunner` and asserts the API response carries `processDescription` end-to-end. The 0.9.9 processDescription fix is preserved verbatim — this release only swaps the verify surface. Visualize the tool call chain of a task on a local web service with real-time SSE updates. v0.9.9: Task lifecycle pipeline on /task/<id> now exposes BOTH the milestone badge AND the 「过程描述」 column at a glance — the server-side `/api/tasks/:id/operations` endpoint exposes `processDescription` on every operation (no longer stripped from the public schema), the client-side `renderPipelineHtml` mirrors the server's `.op-desc-block` + `.op-proc-block` block layout so SSR ↔ CSR stay in sync, and a long-standing CSS right-side text-truncation bug in the pipeline timeline (long CJK titles overflowing the panel edge) is fixed via `min-width: 0` on `.op-row1` + `overflow-wrap: anywhere` on `.op-title`. 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",
7
7
  "hooks": [
8
8
  {
@@ -0,0 +1,210 @@
1
+ /* v2.0.0: file-tree sidebar hydrator.
2
+ *
3
+ * Loads the project file list from the data-files JSON attribute on the
4
+ * SSR-rendered `<ul id="file-tree">` and wires up:
5
+ * - chevron toggle (▶ / ▼) for directories
6
+ * - "expand all / collapse all" controls
7
+ * - click-to-highlight a file node (calls window.setActiveToolCallFile)
8
+ * - scrolling a node into view when window.__toolClick is fired
9
+ *
10
+ * Designed to be loaded AFTER app.js (so it can hook __toolClick) but
11
+ * BEFORE tool-call-detail.js (so that hydrator can call our
12
+ * setActiveToolCallFile when a Mermaid node is clicked).
13
+ *
14
+ * No dependencies — pure vanilla JS, no module loader, no JSX.
15
+ */
16
+
17
+ (function attachFileTreeHydrator() {
18
+ const SIDEBAR_SELECTOR = "#file-tree";
19
+
20
+ // -----------------------------------------------------------------------
21
+ // State
22
+ // -----------------------------------------------------------------------
23
+ /** @type {HTMLElement|null} */
24
+ let root = null;
25
+ /** @type {Set<string>} */
26
+ let affectedSet = new Set();
27
+ /** @type {string|null} */
28
+ let activePath = null;
29
+
30
+ // -----------------------------------------------------------------------
31
+ // Helpers
32
+ // -----------------------------------------------------------------------
33
+
34
+ /**
35
+ * Toggle visibility of a directory's children.
36
+ * @param {HTMLElement} li
37
+ */
38
+ function toggleDir(li) {
39
+ const isOpen = li.getAttribute("aria-expanded") === "true";
40
+ const next = !isOpen;
41
+ li.setAttribute("aria-expanded", String(next));
42
+ const chev = li.querySelector(".file-tree-chevron");
43
+ if (chev) chev.textContent = next ? "▼" : "▶";
44
+ // Update descendant visibility by toggling the `data-collapsed` flag on
45
+ // every sibling immediately under this directory.
46
+ const depth = Number(li.getAttribute("data-depth") || "0");
47
+ let sibling = li.nextElementSibling;
48
+ while (sibling) {
49
+ const sDepth = Number(sibling.getAttribute("data-depth") || "0");
50
+ if (sDepth <= depth) break;
51
+ if (!next) {
52
+ sibling.setAttribute("data-collapsed", "true");
53
+ } else {
54
+ sibling.removeAttribute("data-collapsed");
55
+ }
56
+ sibling = sibling.nextElementSibling;
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Set the active (highlighted) file path. Called by the tool-call
62
+ * detail hydrator when the user clicks a Mermaid tool node.
63
+ * @param {string|null} path
64
+ */
65
+ function setActive(path) {
66
+ if (!root) return;
67
+ if (activePath) {
68
+ const prev = root.querySelector(`[data-path="${cssEscape(activePath)}"]`);
69
+ if (prev) prev.classList.remove("is-active");
70
+ }
71
+ activePath = path;
72
+ if (path) {
73
+ const next = root.querySelector(`[data-path="${cssEscape(path)}"]`);
74
+ if (next) {
75
+ next.classList.add("is-active");
76
+ // Expand parent directories so the active node is visible.
77
+ expandAncestors(next);
78
+ // Scroll into view (block: 'center') — but only if it's not
79
+ // already on-screen so we don't fight the user mid-scroll.
80
+ try {
81
+ next.scrollIntoView({ behavior: "smooth", block: "center" });
82
+ } catch {
83
+ try {
84
+ next.scrollIntoView();
85
+ } catch (_) {
86
+ /* noop */
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Walk up the DOM expanding every ancestor directory so the given
95
+ * node becomes visible. Cheap because the tree is at most ~10 levels
96
+ * deep in practice.
97
+ * @param {HTMLElement} leaf
98
+ */
99
+ function expandAncestors(leaf) {
100
+ let cur = leaf.previousElementSibling;
101
+ let targetDepth = Number(leaf.getAttribute("data-depth") || "0");
102
+ while (cur) {
103
+ const d = Number(cur.getAttribute("data-depth") || "0");
104
+ if (d < targetDepth) {
105
+ if (cur.getAttribute("aria-expanded") === "false") {
106
+ toggleDir(cur);
107
+ }
108
+ targetDepth = d; // keep walking
109
+ }
110
+ cur = cur.previousElementSibling;
111
+ }
112
+ }
113
+
114
+ /**
115
+ * CSS.escape polyfill — older browsers / jsdom may lack it.
116
+ * @param {string} s
117
+ */
118
+ function cssEscape(s) {
119
+ if (typeof CSS !== "undefined" && typeof CSS.escape === "function") {
120
+ return CSS.escape(s);
121
+ }
122
+ return String(s).replace(/([^a-zA-Z0-9_-])/g, "\\$1");
123
+ }
124
+
125
+ // -----------------------------------------------------------------------
126
+ // Wiring
127
+ // -----------------------------------------------------------------------
128
+
129
+ /**
130
+ * Build the affected set from `[data-affected="true"]` nodes the SSR
131
+ * already flagged. Re-runs on each hydration so SSE-inserted nodes
132
+ * stay highlighted.
133
+ */
134
+ function rebuildAffectedSet() {
135
+ if (!root) return;
136
+ affectedSet = new Set();
137
+ root.querySelectorAll('[data-affected="true"]').forEach((el) => {
138
+ const p = el.getAttribute("data-path");
139
+ if (p) affectedSet.add(p);
140
+ });
141
+ }
142
+
143
+ /**
144
+ * Initial hydration: bind click handlers + collect the affected set.
145
+ * Idempotent — safe to call multiple times.
146
+ */
147
+ function hydrate() {
148
+ root = document.querySelector(SIDEBAR_SELECTOR);
149
+ if (!root) return;
150
+ rebuildAffectedSet();
151
+ root.addEventListener("click", (ev) => {
152
+ const target = ev.target;
153
+ // jsdom's eval'd scripts don't have `Element` in scope; use a
154
+ // duck-type check instead of `instanceof Element`.
155
+ if (!target || typeof target.getAttribute !== "function") return;
156
+ const li = target.closest && target.closest(".file-tree-node");
157
+ if (!li || typeof li.getAttribute !== "function") return;
158
+ const path = li.getAttribute("data-path") || null;
159
+ const type = li.getAttribute("data-type");
160
+ if (type === "directory") {
161
+ toggleDir(li);
162
+ // Suppress the subsequent active-path switch — directories
163
+ // aren't files, just containers.
164
+ return;
165
+ }
166
+ if (path) setActive(path);
167
+ });
168
+ // Auto-hydrate on DOMContentLoaded if the DOM is already ready.
169
+ if (document.readyState === "loading") {
170
+ document.addEventListener("DOMContentLoaded", hydrate, { once: true });
171
+ }
172
+ }
173
+ hydrate();
174
+
175
+ /**
176
+ * Expand every directory in the tree (used by the "expand all" button).
177
+ */
178
+ function expandAll() {
179
+ if (!root) return;
180
+ root.querySelectorAll('.file-tree-node[data-type="directory"]').forEach((li) => {
181
+ if (li.getAttribute("aria-expanded") === "false") toggleDir(li);
182
+ });
183
+ }
184
+
185
+ /**
186
+ * Collapse every directory (used by "collapse all").
187
+ */
188
+ function collapseAll() {
189
+ if (!root) return;
190
+ root.querySelectorAll('.file-tree-node[data-type="directory"]').forEach((li) => {
191
+ if (li.getAttribute("aria-expanded") === "true") toggleDir(li);
192
+ });
193
+ }
194
+
195
+ // Expose a tiny global API so other scripts (app.js, tool-call-detail.js)
196
+ // can drive the sidebar.
197
+ /** @type {any} */
198
+ const w = window;
199
+ w.__fileTree = {
200
+ setActive,
201
+ expandAll,
202
+ collapseAll,
203
+ /** Refresh affected-set from the current DOM (called by SSE handlers). */
204
+ refreshAffected: rebuildAffectedSet,
205
+ /** Return the currently-highlighted file path, or null. */
206
+ getActive() {
207
+ return activePath;
208
+ },
209
+ };
210
+ })();