@ai-setting/roy-plugin-task-show 0.1.0 → 0.3.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
@@ -8,12 +8,10 @@
8
8
 
9
9
  When loaded into a `roy-agent` host, this plugin:
10
10
 
11
- 1. Listens to the `tool:after.execute` and `task:after.update` hook points.
11
+ 1. Listens to the `tool:after.execute`, `task:after.complete` (preferred) and `task:after.update` (legacy fallback) hook points.
12
12
  2. Records every tool invocation (tool name, args, result preview, duration,
13
13
  success flag, timestamp) into an in-memory collector keyed by task id.
14
- 3. When a task transitions to a terminal status (`completed` / `failed` /
15
- `cancelled`), mutates the **last** tool result to append a markdown link to
16
- the visualization page.
14
+ 3. When a task transitions to a terminal status (`completed` / `failed` / `timeout` / `cancelled` / `timeout`), mutates the **last** tool result to append a markdown link to the visualization page. (Status filtering is done internally — no plugin-author filtering required.)
17
15
  4. Serves the visualization on a local HTTP server (default
18
16
  `http://127.0.0.1:7788/`).
19
17
 
@@ -122,9 +120,14 @@ await taskShow.dispose();
122
120
 
123
121
  The plugin registers hooks for:
124
122
 
125
- - `tool:after.execute` — collects every tool call (priority 50).
126
- - `task:after.update` — freezes the session and (optionally) injects the
127
- visualization URL into the last tool result (priority 60).
123
+ - `tool:after.execute` — collects every tool call (priority 50).
124
+ - `task:after.complete` PREFERRED — freezes the session and injects
125
+ the visualization URL on terminal status transition. Available on
126
+ `roy-agent` versions >= 2026-07-10 (priority 60).
127
+ - `task:after.update` — LEGACY fallback for hosts predating the new
128
+ hook point. The handler also dedupes against any `task:after.complete`
129
+ that fires simultaneously, so on a modern host the URL is injected
130
+ exactly once (priority 60).
128
131
 
129
132
  ## Configuration
130
133
 
@@ -229,17 +232,36 @@ It also recognizes (in priority order):
229
232
  If no task id can be recovered, the call lands in a synthetic session so
230
233
  the visualization still works.
231
234
 
232
- ### `task:after.update` (consumed)
235
+ ### `task:after.complete` (preferred, consumed)
233
236
 
234
- The plugin accepts the standard `TaskUpdateContext`:
237
+ The plugin accepts the standard `TaskCompleteResultContext`:
235
238
 
236
239
  ```ts
237
- { data: { task: { id: number, status: string, title?: string } } }
240
+ {
241
+ task: { id: number, status: 'completed' | 'failed' | 'cancelled' | 'timeout', title?: string },
242
+ terminalStatus: 'completed' | 'failed' | 'cancelled' | 'timeout',
243
+ changes: Partial<UpdateTaskOptions>,
244
+ sessionId: string,
245
+ tagService: TagService,
246
+ }
247
+ ```
248
+
249
+ Because the host pre-filters to terminal transitions, no plugin-side status
250
+ filtering is needed. The plugin dedupes by `taskId` against the legacy hook
251
+ below.
252
+
253
+ ### `task:after.update` (legacy fallback, consumed)
254
+
255
+ On hosts predating the `AFTER_COMPLETE` hook point, the plugin also subscribes
256
+ to `TaskUpdateResultContext`:
257
+
258
+ ```ts
259
+ { data: { task: { id: number, status: string, title?: string }, changes, tagService } }
238
260
  ```
239
261
 
240
- as well as duck-typed variants like `{ taskId, status, title }`. The plugin
241
- only injects the URL when `status` is one of `completed`, `failed`,
242
- `cancelled` intermediate statuses are ignored.
262
+ The handler filters for terminal status (`completed` / `failed` / `cancelled` /
263
+ `timeout`) and dedupes if `AFTER_COMPLETE` also fires (it can, on a host
264
+ that supports both hooks), the URL is injected exactly once.
243
265
 
244
266
  ## Limitations & follow-ups
245
267
 
package/dist/plugin.d.ts CHANGED
@@ -49,6 +49,24 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
49
49
  private disposed;
50
50
  /** Last successful `tool:after.execute` result, used to inject the URL on task completion. */
51
51
  private lastResultByTask;
52
+ /**
53
+ * `tool:before.execute` → `tool:after.execute` start-time buffer.
54
+ * Keyed by a fingerprint derived from (taskId, toolName, argsHash) so
55
+ * that interleaved tool calls in the same task don't collide. The
56
+ * matching `after` consume + delete the entry.
57
+ *
58
+ * This buffer lets the plugin compute `durationMs` end-to-end itself
59
+ * (without requiring the host to propagate a `start_ts` through the
60
+ * tool's result envelope).
61
+ */
62
+ private pendingStarts;
63
+ /**
64
+ * Per-instance dedup set — guards against the same task reaching this
65
+ * handler from both `task:after.complete` AND `task:after.update`
66
+ * (which can happen on newer hosts where both hook points fire on
67
+ * completion). Cleared on dispose().
68
+ */
69
+ private injectedTaskIds;
52
70
  /** cached list of hook points we registered, so dispose() can be defensive even if the env lacks unregister. */
53
71
  private registered;
54
72
  constructor(config?: Partial<TaskShowConfig>);
@@ -65,6 +83,16 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
65
83
  getServerPort(): number | null;
66
84
  getCollector(): ToolCallCollector;
67
85
  getConfig(): TaskShowConfig;
86
+ /**
87
+ * Public function exposed so unit tests can simulate the
88
+ * `tool:before.execute` payload (without going through the global hook
89
+ * manager). Used to record a per-call start timestamp so the matching
90
+ * `tool:after.execute` can compute a real `durationMs`.
91
+ *
92
+ * Host contracts vary: some pass an explicit `ctx.start_ts` or a
93
+ * `metadata.start_ts`, others do not. We accept all three.
94
+ */
95
+ onToolBeforeExecute(ctx: any, metadata?: Record<string, unknown>): Promise<void>;
68
96
  /**
69
97
  * Public function exposed so unit tests can simulate the
70
98
  * `tool:after.execute` payload without going through the global hook
@@ -75,6 +103,25 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
75
103
  * Public function exposed for tests; mirrors the `task:after.update`
76
104
  * payload.
77
105
  */
106
+ /**
107
+ * Public function exposed for tests; mirrors BOTH the preferred
108
+ * `task:after.complete` payload (added in roy-agent 2026-07-10) AND
109
+ * the legacy `task:after.update` payload. Both hook points reach this
110
+ * handler; an internal dedup set guarantees at most one URL injection
111
+ * per task.
112
+ *
113
+ * - Preferred (roy-agent 2026-07-10+): `task:after.complete`
114
+ * - `data.terminalStatus` is explicit; no status filtering needed.
115
+ * - Legacy fallback (pre-2026-07-10 roy-agent): `task:after.update`
116
+ * - only `data.task` is provided; we filter for terminal statuses
117
+ * the same way the previous implementation did.
118
+ */
119
+ onTaskAfterComplete(ctx: any): Promise<void>;
120
+ /**
121
+ * @deprecated Use {@link onTaskAfterComplete}. Kept as a thin alias for
122
+ * backward compatibility with the previous `task:after.update` API
123
+ * contract used in v0.1.0 unit tests. Will be removed in v2.0.
124
+ */
78
125
  onTaskAfterUpdate(ctx: any): Promise<void>;
79
126
  /**
80
127
  * Manual injection hook — useful when a custom caller has a known task
@@ -93,6 +140,21 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
93
140
  */
94
141
  private registerHooks;
95
142
  private registerViaGlobalManager;
143
+ /**
144
+ * Extract the resolved task id from a tool-hook context. Mirrors the
145
+ * resolution order used in `onToolAfterExecute` so the `before` and
146
+ * `after` handlers key into `pendingStarts` identically.
147
+ */
148
+ private extractTaskIdFromToolCtx;
149
+ /**
150
+ * Compute a deterministic fingerprint for a tool invocation, used to key
151
+ * the pendingStarts buffer. We deliberately use ONLY (taskId + toolName)
152
+ * — collisions from two consecutive identical calls in the same task are
153
+ * acceptable in practice (we over-write), and the buffer is wiped on
154
+ * matching `after` so long-lived ghost entries cannot accumulate.
155
+ */
156
+ private fingerprintToolCall;
157
+ private lookupPendingStart;
96
158
  }
97
159
  /**
98
160
  * Convenience factory — used when loaded as a bare ES module (the typical
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAEf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAgCnD;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,C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C;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAoBhC;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,kBAAkB;CAK3B;AA+BD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAErF;AAED;;;GAGG;AACH,eAAe,cAAc,CAAC"}
package/dist/plugin.js CHANGED
@@ -49,6 +49,24 @@ export class TaskShowPlugin {
49
49
  disposed = false;
50
50
  /** Last successful `tool:after.execute` result, used to inject the URL on task completion. */
51
51
  lastResultByTask = new Map();
52
+ /**
53
+ * `tool:before.execute` → `tool:after.execute` start-time buffer.
54
+ * Keyed by a fingerprint derived from (taskId, toolName, argsHash) so
55
+ * that interleaved tool calls in the same task don't collide. The
56
+ * matching `after` consume + delete the entry.
57
+ *
58
+ * This buffer lets the plugin compute `durationMs` end-to-end itself
59
+ * (without requiring the host to propagate a `start_ts` through the
60
+ * tool's result envelope).
61
+ */
62
+ pendingStarts = new Map();
63
+ /**
64
+ * Per-instance dedup set — guards against the same task reaching this
65
+ * handler from both `task:after.complete` AND `task:after.update`
66
+ * (which can happen on newer hosts where both hook points fire on
67
+ * completion). Cleared on dispose().
68
+ */
69
+ injectedTaskIds = new Set();
52
70
  /** cached list of hook points we registered, so dispose() can be defensive even if the env lacks unregister. */
53
71
  registered = [];
54
72
  constructor(config) {
@@ -107,6 +125,8 @@ export class TaskShowPlugin {
107
125
  }
108
126
  this.collector.clear();
109
127
  this.lastResultByTask.clear();
128
+ this.injectedTaskIds.clear();
129
+ this.pendingStarts.clear();
110
130
  this.env = null;
111
131
  this.registered = [];
112
132
  }
@@ -123,6 +143,26 @@ export class TaskShowPlugin {
123
143
  // ---------------------------------------------------------------------
124
144
  // Hook handlers (exposed for tests)
125
145
  // ---------------------------------------------------------------------
146
+ /**
147
+ * Public function exposed so unit tests can simulate the
148
+ * `tool:before.execute` payload (without going through the global hook
149
+ * manager). Used to record a per-call start timestamp so the matching
150
+ * `tool:after.execute` can compute a real `durationMs`.
151
+ *
152
+ * Host contracts vary: some pass an explicit `ctx.start_ts` or a
153
+ * `metadata.start_ts`, others do not. We accept all three.
154
+ */
155
+ async onToolBeforeExecute(ctx, metadata) {
156
+ if (this.disposed)
157
+ return;
158
+ if (!ctx)
159
+ return;
160
+ const toolName = ctx?.tool?.name ?? ctx?.toolName ?? "unknown";
161
+ const taskId = this.extractTaskIdFromToolCtx(ctx);
162
+ const ts = Number(metadata?.start_ts ?? ctx?.start_ts ?? Date.now());
163
+ const fp = this.fingerprintToolCall(taskId, toolName, ctx?.args ?? {});
164
+ this.pendingStarts.set(fp, ts);
165
+ }
126
166
  /**
127
167
  * Public function exposed so unit tests can simulate the
128
168
  * `tool:after.execute` payload without going through the global hook
@@ -139,10 +179,30 @@ export class TaskShowPlugin {
139
179
  const toolName = tool?.name ?? ctx.toolName ?? "unknown";
140
180
  const success = !result?.error && (result?.success ?? true);
141
181
  const error = result?.error;
142
- const startTs = metadata?.start_ts ?? ctx.start_ts ?? Date.now();
143
- const durationMs = typeof ctx.durationMs === "number"
144
- ? ctx.durationMs
145
- : Math.max(0, Date.now() - Number(startTs));
182
+ // Duration resolution order:
183
+ // 1. `metadata.durationMs` or `ctx.durationMs` if explicitly provided
184
+ // (host chose to compute it for us)
185
+ // 2. `metadata.start_ts` or `ctx.start_ts` (host gave us a wall-clock
186
+ // start, we measure elapsed time)
187
+ // 3. fingerprint hit against `pendingStarts` from the matching
188
+ // `tool:before.execute` (plugin-managed timing)
189
+ // 4. fallback: assume the call was instantaneous (`0`)
190
+ let durationMs;
191
+ if (typeof ctx.durationMs === "number") {
192
+ durationMs = ctx.durationMs;
193
+ }
194
+ else if (typeof metadata?.durationMs === "number") {
195
+ durationMs = metadata.durationMs;
196
+ }
197
+ else {
198
+ const startTs = metadata?.start_ts ?? ctx.start_ts ?? this.lookupPendingStart(toolName, ctx);
199
+ if (typeof startTs === "number") {
200
+ durationMs = Math.max(0, Date.now() - Number(startTs));
201
+ }
202
+ else {
203
+ durationMs = 0;
204
+ }
205
+ }
146
206
  const outputPreview = previewOutput(result?.output ?? "");
147
207
  const taskId = this.collector.recordToolCall({
148
208
  toolName,
@@ -160,38 +220,70 @@ export class TaskShowPlugin {
160
220
  if (result && typeof result === "object") {
161
221
  this.lastResultByTask.set(taskId, result);
162
222
  }
223
+ // Consume + drop the pending start entry for this fingerprint so the
224
+ // buffer doesn't grow unbounded.
225
+ const fp = this.fingerprintToolCall(taskId, toolName, args);
226
+ this.pendingStarts.delete(fp);
163
227
  }
164
228
  /**
165
229
  * Public function exposed for tests; mirrors the `task:after.update`
166
230
  * payload.
167
231
  */
168
- async onTaskAfterUpdate(ctx) {
232
+ /**
233
+ * Public function exposed for tests; mirrors BOTH the preferred
234
+ * `task:after.complete` payload (added in roy-agent 2026-07-10) AND
235
+ * the legacy `task:after.update` payload. Both hook points reach this
236
+ * handler; an internal dedup set guarantees at most one URL injection
237
+ * per task.
238
+ *
239
+ * - Preferred (roy-agent 2026-07-10+): `task:after.complete`
240
+ * - `data.terminalStatus` is explicit; no status filtering needed.
241
+ * - Legacy fallback (pre-2026-07-10 roy-agent): `task:after.update`
242
+ * - only `data.task` is provided; we filter for terminal statuses
243
+ * the same way the previous implementation did.
244
+ */
245
+ async onTaskAfterComplete(ctx) {
169
246
  if (this.disposed)
170
247
  return;
171
248
  if (!ctx)
172
249
  return;
173
- // The hook payload may be either the host's `TaskUpdateContext` OR a
174
- // duck-typed object. We try several shapes.
250
+ // The hook payload may be either the host's TaskCompleteResultContext /
251
+ // TaskUpdateResultContext OR a duck-typed object. We try several shapes.
175
252
  const data = (ctx.data ?? ctx);
253
+ // taskId — same for either shape.
176
254
  const taskId = data?.task?.id ?? data?.taskId ?? data?.id;
177
- const status = data?.task?.status ??
178
- data?.status ??
179
- "completed";
180
- const title = data?.task?.title ?? data?.title;
181
255
  if (typeof taskId !== "number")
182
256
  return;
183
- // Always finalize the session so the index page reflects the new state.
184
- const finalized = this.collector.finalizeOnTaskUpdate({
257
+ // Resolve the terminal status:
258
+ // - AFTER_COMPLETE context.data.terminalStatus (preferred)
259
+ // - AFTER_UPDATE → context.data.task.status (legacy fallback)
260
+ const terminalStatus = data?.terminalStatus ?? data?.task?.status ?? data?.status;
261
+ if (!terminalStatus)
262
+ return;
263
+ // Non-terminal update (e.g. status="active", progress=50): finalize the
264
+ // session under the new status, but skip URL injection.
265
+ if (!isTerminalStatus(terminalStatus)) {
266
+ this.collector.finalizeOnTaskUpdate({
267
+ taskId,
268
+ newStatus: terminalStatus,
269
+ title: data?.task?.title ?? data?.title,
270
+ timestamp: Date.now(),
271
+ });
272
+ return;
273
+ }
274
+ // Dedup: the same task may reach this handler from BOTH
275
+ // task:after.complete AND task:after.update when running on a newer
276
+ // host (both hooks fire on completion). We inject exactly once.
277
+ if (this.injectedTaskIds.has(taskId))
278
+ return;
279
+ this.injectedTaskIds.add(taskId);
280
+ // Finalize the session under the terminal status.
281
+ this.collector.finalizeOnTaskUpdate({
185
282
  taskId,
186
- newStatus: status,
187
- title,
283
+ newStatus: terminalStatus,
284
+ title: data?.task?.title ?? data?.title,
188
285
  timestamp: Date.now(),
189
286
  });
190
- if (!finalized)
191
- return;
192
- // Inject the URL ONLY when the task is terminal (not "running").
193
- if (!isTerminalStatus(status))
194
- return;
195
287
  const lastResult = this.lastResultByTask.get(taskId);
196
288
  if (!lastResult) {
197
289
  // Some tasks may complete without any tool call (e.g. pure response).
@@ -207,6 +299,14 @@ export class TaskShowPlugin {
207
299
  info(`injected visualization URL ${outcome.url} into last tool result for task ${taskId}`);
208
300
  }
209
301
  }
302
+ /**
303
+ * @deprecated Use {@link onTaskAfterComplete}. Kept as a thin alias for
304
+ * backward compatibility with the previous `task:after.update` API
305
+ * contract used in v0.1.0 unit tests. Will be removed in v2.0.
306
+ */
307
+ async onTaskAfterUpdate(ctx) {
308
+ return this.onTaskAfterComplete(ctx);
309
+ }
210
310
  /**
211
311
  * Manual injection hook — useful when a custom caller has a known task
212
312
  * id + ToolResult at hand (e.g. tests).
@@ -238,6 +338,17 @@ export class TaskShowPlugin {
238
338
  */
239
339
  registerHooks(env) {
240
340
  if (typeof env.registerHook === "function") {
341
+ // tool:before.execute — used to record per-call start time so
342
+ // tool:after.execute can compute an accurate durationMs without
343
+ // requiring the host to thread a `start_ts` through the tool result.
344
+ // Priority 40 = fires before tool:after (priority 50).
345
+ env.registerHook({
346
+ point: "tool:before.execute",
347
+ priority: 40,
348
+ name: `${this.name}:tool-before`,
349
+ handler: async (ctx) => this.onToolBeforeExecute(ctx),
350
+ });
351
+ this.registered.push({ point: "tool:before.execute", name: `${this.name}:tool-before` });
241
352
  env.registerHook({
242
353
  point: "tool:after.execute",
243
354
  priority: 50,
@@ -245,11 +356,25 @@ export class TaskShowPlugin {
245
356
  handler: async (ctx) => this.onToolAfterExecute(ctx),
246
357
  });
247
358
  this.registered.push({ point: "tool:after.execute", name: `${this.name}:tool-after` });
359
+ // Preferred hook point (added in roy-agent 2026-07-10).
360
+ // The handler dedupes internally, so even if the host also fires
361
+ // AFTER_UPDATE on completion (which it does on the new code path),
362
+ // the URL is injected exactly once.
363
+ env.registerHook({
364
+ point: "task:after.complete",
365
+ priority: 60,
366
+ name: `${this.name}:task-complete`,
367
+ handler: async (ctx) => this.onTaskAfterComplete(ctx),
368
+ });
369
+ this.registered.push({ point: "task:after.complete", name: `${this.name}:task-complete` });
370
+ // Legacy fallback for roy-agent hosts predating AFTER_COMPLETE.
371
+ // Old hosts only expose AFTER_UPDATE; the handler will filter
372
+ // for terminal status internally.
248
373
  env.registerHook({
249
374
  point: "task:after.update",
250
375
  priority: 60,
251
376
  name: `${this.name}:task-after`,
252
- handler: async (ctx) => this.onTaskAfterUpdate(ctx),
377
+ handler: async (ctx) => this.onTaskAfterComplete(ctx),
253
378
  });
254
379
  this.registered.push({ point: "task:after.update", name: `${this.name}:task-after` });
255
380
  return;
@@ -276,19 +401,75 @@ export class TaskShowPlugin {
276
401
  warn("@ai-setting/roy-agent-core does not export globalHookManager — skipping");
277
402
  return;
278
403
  }
404
+ globalHookManager.register("tool:before.execute", {
405
+ name: `${this.name}:tool-before`,
406
+ priority: 40,
407
+ execute: async (ctx) => this.onToolBeforeExecute(ctx),
408
+ });
409
+ this.registered.push({ point: "tool:before.execute", name: `${this.name}:tool-before` });
279
410
  globalHookManager.register("tool:after.execute", {
280
411
  name: `${this.name}:tool-after`,
281
412
  priority: 50,
282
413
  execute: async (ctx) => this.onToolAfterExecute(ctx),
283
414
  });
284
415
  this.registered.push({ point: "tool:after.execute", name: `${this.name}:tool-after` });
416
+ globalHookManager.register("task:after.complete", {
417
+ name: `${this.name}:task-complete`,
418
+ priority: 60,
419
+ execute: async (ctx) => this.onTaskAfterComplete(ctx),
420
+ });
421
+ this.registered.push({ point: "task:after.complete", name: `${this.name}:task-complete` });
285
422
  globalHookManager.register("task:after.update", {
286
423
  name: `${this.name}:task-after`,
287
424
  priority: 60,
288
- execute: async (ctx) => this.onTaskAfterUpdate(ctx),
425
+ execute: async (ctx) => this.onTaskAfterComplete(ctx),
289
426
  });
290
427
  this.registered.push({ point: "task:after.update", name: `${this.name}:task-after` });
291
428
  }
429
+ // ---------------------------------------------------------------------
430
+ // Internal helpers
431
+ // ---------------------------------------------------------------------
432
+ /**
433
+ * Extract the resolved task id from a tool-hook context. Mirrors the
434
+ * resolution order used in `onToolAfterExecute` so the `before` and
435
+ * `after` handlers key into `pendingStarts` identically.
436
+ */
437
+ extractTaskIdFromToolCtx(ctx) {
438
+ if (!ctx)
439
+ return -1;
440
+ const md = ctx.result?.metadata ??
441
+ ctx.metadata ??
442
+ undefined;
443
+ const candidates = [
444
+ ctx.currentTaskId,
445
+ ctx.context?.taskId,
446
+ ctx.context?.current_task_id,
447
+ md?.current_task_id,
448
+ ctx.taskId,
449
+ ];
450
+ for (const c of candidates) {
451
+ if (typeof c === "number")
452
+ return c;
453
+ if (typeof c === "string" && /^-?\d+$/.test(c))
454
+ return Number(c);
455
+ }
456
+ return -1;
457
+ }
458
+ /**
459
+ * Compute a deterministic fingerprint for a tool invocation, used to key
460
+ * the pendingStarts buffer. We deliberately use ONLY (taskId + toolName)
461
+ * — collisions from two consecutive identical calls in the same task are
462
+ * acceptable in practice (we over-write), and the buffer is wiped on
463
+ * matching `after` so long-lived ghost entries cannot accumulate.
464
+ */
465
+ fingerprintToolCall(taskId, toolName, _args) {
466
+ return `${taskId}:${toolName}`;
467
+ }
468
+ lookupPendingStart(toolName, ctx) {
469
+ const taskId = this.extractTaskIdFromToolCtx(ctx);
470
+ const fp = this.fingerprintToolCall(taskId, toolName, ctx?.args ?? {});
471
+ return this.pendingStarts.get(fp);
472
+ }
292
473
  }
293
474
  // ============================================================================
294
475
  // Helpers
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,MAAM,GAAG,GAAG,sBAAsB,CAAC;AAEnC,SAAS,IAAI,CAAC,GAAW;IACvB,IAAI,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,CAAC;QACjC,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AACD,SAAS,IAAI,CAAC,GAAW;IACvB,sCAAsC;IACtC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;AAClC,CAAC;AACD,SAAS,KAAK,CAAC,GAAW;IACxB,sCAAs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CACF;AAED,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,MAAM,iBAAiB,GAAuC,IAAI,GAAG,CAAwB;IAC3F,WAAW;IACX,QAAQ;IACR,WAAW;CACZ,CAAC,CAAC;AAEH,SAAS,gBAAgB,CAAC,MAA6B;IACrD,OAAO,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,MAAc;IACnC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAG,GAAG,CAAC;IAChB,IAAI,MAAM,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,MAAM,CAAC;IACxC,8BAA8B;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACpC,OAAO,GAAG,IAAI,iBAAiB,MAAM,CAAC,MAAM,GAAG,GAAG,aAAa,IAAI,EAAE,CAAC;AACxE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAgC;IACnE,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,eAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-plugin-task-show",
3
- "version": "0.1.0",
3
+ "version": "0.3.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",
@@ -20,8 +20,10 @@
20
20
  "verify": "bun run scripts/verify-service.ts",
21
21
  "publish:local": "bun run scripts/publish.ts --dry-run --verify",
22
22
  "publish:dry": "bun run scripts/publish.ts --dry-run",
23
- "publish": "bun run scripts/publish.ts --tag latest",
24
- "publish:verify": "bun run scripts/publish.ts --tag latest --verify"
23
+ "release": "bun run scripts/publish.ts --tag latest",
24
+ "release:verify": "bun run scripts/publish.ts --tag latest --verify",
25
+ "verify:installed": "bun run scripts/verify-installed.ts",
26
+ "verify:published": "bun run scripts/verify-installed.ts registry @ai-setting/roy-plugin-task-show@latest"
25
27
  },
26
28
  "keywords": [
27
29
  "roy-agent",
package/plugin.json CHANGED
@@ -1,17 +1,25 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-plugin-task-show",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "type": "tool-plugin",
5
- "description": "Visualize the tool call chain of a task on a local web service and inject the URL into tool results",
5
+ "description": "Visualize the tool call chain of a task on a local web service and inject the URL into tool results. Subscribes to tool:before.execute (for self-managed timing), tool:after.execute, task:after.complete (preferred, 2026-07-10+) and task:after.update (legacy fallback).",
6
6
  "main": "dist/index.js",
7
7
  "hooks": [
8
+ {
9
+ "point": "tool:before.execute",
10
+ "purpose": "Records a per-call start timestamp so tool:after.execute can compute an accurate durationMs without requiring the host to thread a `start_ts` through the tool result envelope. Plugin-managed timing (v0.3.0+)."
11
+ },
8
12
  {
9
13
  "point": "tool:after.execute",
10
14
  "purpose": "Collect every tool invocation: tool name, args, result, timing, success"
11
15
  },
16
+ {
17
+ "point": "task:after.complete",
18
+ "purpose": "PREFERRED hook point (roy-agent 2026-07-10+). When a task transitions to a terminal status (completed/failed/cancelled/timeout), finalize the session and inject the visualization URL into the last tool result. terminalStatus field is explicit \u2014 no status filtering required."
19
+ },
12
20
  {
13
21
  "point": "task:after.update",
14
- "purpose": "When a task transitions to a terminal status (completed/failed), mark the session and emit the visualization URL"
22
+ "purpose": "LEGACY fallback. Hosts predating the AFTER_COMPLETE hook point only expose AFTER_UPDATE; the plugin filters for terminal status internally and dedupes against any AFTER_COMPLETE that might also fire on the new code path."
15
23
  }
16
24
  ],
17
25
  "commands": [
@@ -53,7 +61,7 @@
53
61
  }
54
62
  },
55
63
  "roy-agent": {
56
- "minVersion": "0.6.0",
64
+ "minVersion": "1.6.0",
57
65
  "extends": "BasePlugin",
58
66
  "registerAs": "task-show"
59
67
  },