@ai-setting/roy-plugin-task-show 0.2.0 → 0.4.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 +199 -21
- package/dist/collector.d.ts +8 -3
- package/dist/collector.d.ts.map +1 -1
- package/dist/collector.js +27 -7
- package/dist/collector.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +80 -6
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +203 -28
- package/dist/plugin.js.map +1 -1
- package/dist/types.d.ts +59 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +22 -1
- package/dist/types.js.map +1 -1
- package/dist/url-injector.d.ts +18 -5
- package/dist/url-injector.d.ts.map +1 -1
- package/dist/url-injector.js +18 -5
- package/dist/url-injector.js.map +1 -1
- package/package.json +2 -1
- package/plugin.json +9 -5
package/README.md
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
# roy-plugin-task-show
|
|
2
2
|
|
|
3
3
|
> A [roy-agent](https://example/roy-agent) plugin that visualizes the tool-call
|
|
4
|
-
> chain of every task on a local web service and
|
|
5
|
-
>
|
|
4
|
+
> chain of every task on a local web service and **notifies** the visualization
|
|
5
|
+
> URL through the host's `env.notify` event-bus API.
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
9
9
|
When loaded into a `roy-agent` host, this plugin:
|
|
10
10
|
|
|
11
|
-
1. Listens to the `tool:
|
|
11
|
+
1. Listens to the `tool:before.execute`, `tool:after.execute`,
|
|
12
|
+
`task:after.complete` (preferred) and `task:after.update` (legacy fallback)
|
|
13
|
+
hook points.
|
|
12
14
|
2. Records every tool invocation (tool name, args, result preview, duration,
|
|
13
15
|
success flag, timestamp) into an in-memory collector keyed by task id.
|
|
14
|
-
3. When a task transitions to a terminal status (`completed` / `failed` /
|
|
16
|
+
3. When a task transitions to a terminal status (`completed` / `failed` /
|
|
17
|
+
`cancelled` / `timeout`), emits a **`visualization_ready` notification**
|
|
18
|
+
through `env.notify({ type: "visualization_ready", ... })`. The host's
|
|
19
|
+
`NotificationChannel` pipeline (default: `EventBusNotificationChannel`)
|
|
20
|
+
re-emits it on the env event bus as
|
|
21
|
+
`plugin.notification.visualization_ready`.
|
|
15
22
|
4. Serves the visualization on a local HTTP server (default
|
|
16
23
|
`http://127.0.0.1:7788/`).
|
|
17
24
|
|
|
18
25
|
The result: every task in the chat gets a 🔗 link the user can click to open
|
|
19
|
-
a mermaid-powered flow chart showing exactly how the agent solved it.
|
|
26
|
+
a mermaid-powered flow chart showing exactly how the agent solved it. The
|
|
27
|
+
link can be rendered by any subscriber to the env event bus (CLI / IM
|
|
28
|
+
adapter / custom webhook).
|
|
29
|
+
|
|
30
|
+
> **v0.4.0+** — the plugin no longer mutates tool result output. The
|
|
31
|
+
> visualization reach-out goes through `env.notify` instead. See
|
|
32
|
+
> [env.notify Migration (v0.4.0+)](#envnotify-migration-v040) for the
|
|
33
|
+
> migration guide.
|
|
20
34
|
|
|
21
35
|
## Repository layout
|
|
22
36
|
|
|
@@ -139,7 +153,7 @@ All config lives in `plugin.json` (and is overridable at construction time):
|
|
|
139
153
|
| `host` | string | `127.0.0.1` | HTTP host. Use `0.0.0.0` to allow LAN access. |
|
|
140
154
|
| `autoStart` | boolean | `true` | Start the HTTP server when `init()` is called. |
|
|
141
155
|
| `maxStoredTasks` | number | `50` | Max sessions kept in memory. Older ones are evicted. |
|
|
142
|
-
| `urlInjectEnabled` | boolean | `
|
|
156
|
+
| `urlInjectEnabled` | boolean | `false` | **DEPRECATED** in v0.4.0. Appends the visualization URL to the last tool result. Defaults to `false` — the plugin reaches out via `env.notify` instead. |
|
|
143
157
|
| `publicDir` | string | `public` | Directory holding the static frontend. |
|
|
144
158
|
|
|
145
159
|
Override at construction time:
|
|
@@ -164,33 +178,197 @@ createTaskShowPlugin({
|
|
|
164
178
|
If the configured `port` is already in use, the service falls back to an OS
|
|
165
179
|
assigned port and logs the actual URL to stderr.
|
|
166
180
|
|
|
167
|
-
##
|
|
181
|
+
## Architecture
|
|
182
|
+
|
|
183
|
+
The plugin runs as a peer of the host (`roy-agent`) and depends on three
|
|
184
|
+
host-side constructs:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
TaskShowPlugin (task:after.complete hook)
|
|
188
|
+
│
|
|
189
|
+
│ env.notify({type: "visualization_ready", title, content, metadata})
|
|
190
|
+
▼
|
|
191
|
+
PluginComponent.routeNotification()
|
|
192
|
+
│
|
|
193
|
+
▼
|
|
194
|
+
EventBusNotificationChannel (default)
|
|
195
|
+
│
|
|
196
|
+
│ env.pushEnvEvent({
|
|
197
|
+
│ type: "plugin.notification.visualization_ready",
|
|
198
|
+
│ metadata: { source: "plugin:roy-plugin-task-show", ...pluginMetadata },
|
|
199
|
+
│ payload: { title, content },
|
|
200
|
+
│ })
|
|
201
|
+
▼
|
|
202
|
+
Env-level Event Subscriber
|
|
203
|
+
│
|
|
204
|
+
├──► CLI adapter → print "📊 Task #X completed: http://..."
|
|
205
|
+
├──► IM adapter → lark-cli / webhook → 飞书消息
|
|
206
|
+
└──► custom sinks → log, metrics, etc.
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The plugin's own notification layer is intentionally minimal: it
|
|
210
|
+
formats the title + content for human display and packages structured
|
|
211
|
+
metadata for subscribers. Delivery, deduplication across subscribers,
|
|
212
|
+
and persistent retry logic all live in the host. This keeps the
|
|
213
|
+
plugin easy to test (we just assert `env.notify` was called with the
|
|
214
|
+
right payload) and lets each deployment pick the IM / CLI front-ends
|
|
215
|
+
that match its audience.
|
|
216
|
+
|
|
217
|
+
### Plugin ↔ host version correspondence
|
|
218
|
+
|
|
219
|
+
| Plugin version | Compatible host (`roy-agent`) | Notes |
|
|
220
|
+
| -------------- | ------------------------------------ | ------------------------------------------------------------------ |
|
|
221
|
+
| `0.1.0` | pre-2026-07-10 (`task:after.update`) | Mutates tool result. **Removed** in v0.4.0 plugin. |
|
|
222
|
+
| `0.2.0` | pre-2026-07-10 (`task:after.update`) | Same as 0.1.0; tiny refactors. |
|
|
223
|
+
| `0.3.0` | `>= 2026-07-10` | Adds `tool:before.execute` for self-managed timing. |
|
|
224
|
+
| `0.4.0` (this) | `>= 2026-07-10` (NotificationChannel) | Switches to `env.notify` consumer; no longer mutates output. |
|
|
225
|
+
|
|
226
|
+
The host's `PluginEnv.notify` method is **optional** for the plugin — it
|
|
227
|
+
degrades gracefully on older hosts (logs a one-shot warn, continues
|
|
228
|
+
serving the visualization page). The plugin therefore remains
|
|
229
|
+
installable on any host version, but newer features only fire on
|
|
230
|
+
hosts implementing the v0.4.0+ contract.
|
|
231
|
+
|
|
232
|
+
### Host design reference
|
|
233
|
+
|
|
234
|
+
The full host-side design — including the `NotificationChannel`
|
|
235
|
+
interface, `EventBusNotificationChannel` (default) and
|
|
236
|
+
`LarkCliNotificationChannel` (legacy, `@deprecated`) — is documented
|
|
237
|
+
in the host repository:
|
|
238
|
+
|
|
239
|
+
> **`roy-agent/docs/plugin-emit-notification.md`** — design doc,
|
|
240
|
+
> version: feature/plugin-emit-notification-v2
|
|
241
|
+
> (commits `f96508f4` → `9ec78817`)
|
|
242
|
+
|
|
243
|
+
If you're integrating the plugin with a custom host, that document is
|
|
244
|
+
the authoritative reference for the `NotificationOptions` contract
|
|
245
|
+
and the metadata merge semantics.
|
|
246
|
+
|
|
247
|
+
## Notification payload (v0.4.0+)
|
|
248
|
+
|
|
249
|
+
When a task reaches a terminal status, the plugin calls
|
|
250
|
+
`env.notify(...)` with a `visualization_ready` payload. The host's
|
|
251
|
+
`NotificationChannel` (default: `EventBusNotificationChannel`) re-emits
|
|
252
|
+
this on the env event bus as `plugin.notification.visualization_ready`.
|
|
253
|
+
|
|
254
|
+
The payload looks like:
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
{
|
|
258
|
+
type: "visualization_ready", // == NOTIFICATION_TYPE_VISUALIZATION_READY
|
|
259
|
+
title: "Task #1234 completed",
|
|
260
|
+
content: [
|
|
261
|
+
"Task: solve the bug",
|
|
262
|
+
"Status: completed",
|
|
263
|
+
"Visualization: http://127.0.0.1:7788/task/1234",
|
|
264
|
+
].join("\n"),
|
|
265
|
+
metadata: {
|
|
266
|
+
taskId: 1234,
|
|
267
|
+
terminalStatus: "completed",
|
|
268
|
+
url: "http://127.0.0.1:7788/task/1234",
|
|
269
|
+
taskTitle: "solve the bug", // when present in the hook payload
|
|
270
|
+
sessionId: "sess-xyz", // when present in the hook payload
|
|
271
|
+
pluginName: "roy-plugin-task-show",
|
|
272
|
+
pluginVersion: "0.4.0", // sync with host v2 (Task #N/A)
|
|
273
|
+
notificationTimestamp: 1718000000000, // captured at emit time (Date.now())
|
|
274
|
+
},
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
The `pluginName` / `pluginVersion` pair lets subscribers correlate the
|
|
279
|
+
event with the plugin that emitted it (useful when multiple versions
|
|
280
|
+
of the same plugin are installed in different workspaces). The
|
|
281
|
+
`notificationTimestamp` is captured at emit time and is distinct from
|
|
282
|
+
the host's `event.timestamp` (which the host stamps at
|
|
283
|
+
`pushEnvEvent` call time) — useful for measuring queue / delivery
|
|
284
|
+
latency downstream.
|
|
285
|
+
|
|
286
|
+
### Subscribing to the notification
|
|
287
|
+
|
|
288
|
+
The cleanest way to surface the URL to users is to subscribe to the
|
|
289
|
+
env event bus for `plugin.notification.visualization_ready`. Example
|
|
290
|
+
(in the host, e.g. `packages/cli`):
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import { NOTIFICATION_TYPE_VISUALIZATION_READY } from "@.../roy-plugin-task-show";
|
|
294
|
+
|
|
295
|
+
env.eventBus.on(
|
|
296
|
+
`plugin.notification.${NOTIFICATION_TYPE_VISUALIZATION_READY}`,
|
|
297
|
+
(event) => {
|
|
298
|
+
const { taskId, url, terminalStatus, taskTitle } = event.metadata;
|
|
299
|
+
// Render the URL in the chat / send a message / open the browser, etc.
|
|
300
|
+
console.log(`📊 Task #${taskId} ${terminalStatus}: ${url}`);
|
|
301
|
+
},
|
|
302
|
+
);
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
The plugin also exposes the URL directly via
|
|
306
|
+
`TaskShowPlugin.getVisualizationUrl(taskId)` for callers that need it
|
|
307
|
+
synchronously.
|
|
308
|
+
|
|
309
|
+
## env.notify Migration (v0.4.0+)
|
|
168
310
|
|
|
169
|
-
|
|
170
|
-
**last** tool result that was recorded for that task:
|
|
311
|
+
> **TL;DR**: stop mutating tool result output. Call `env.notify` instead.
|
|
171
312
|
|
|
172
|
-
|
|
173
|
-
…original tool output…
|
|
313
|
+
### Before (v0.3.0 and earlier)
|
|
174
314
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
(
|
|
315
|
+
```ts
|
|
316
|
+
// Plugin mutated ctx.result.output by appending a markdown banner.
|
|
317
|
+
await plugin.onTaskAfterComplete({
|
|
318
|
+
data: { task: { id: 1234, status: "completed", title: "demo" } },
|
|
319
|
+
});
|
|
320
|
+
// ctx.result.output now contains:
|
|
321
|
+
// "...original...\n---\n📊 可视化工具调用链路: <http://...>"
|
|
178
322
|
```
|
|
179
323
|
|
|
180
|
-
|
|
181
|
-
prefer structured fields can render the link from there.
|
|
324
|
+
### After (v0.4.0+)
|
|
182
325
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
the
|
|
326
|
+
```ts
|
|
327
|
+
// Plugin calls env.notify; the host's NotificationChannel pipeline
|
|
328
|
+
// re-emits it on the env event bus. ctx.result.output is preserved.
|
|
329
|
+
await plugin.onTaskAfterComplete({
|
|
330
|
+
data: {
|
|
331
|
+
task: { id: 1234, status: "completed", title: "demo" },
|
|
332
|
+
terminalStatus: "completed",
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
// env.notify was called with { type: "visualization_ready", ... }
|
|
336
|
+
// ctx.result.output is unchanged.
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Why we changed
|
|
340
|
+
|
|
341
|
+
1. **Decoupling**: tool result output is owned by the tool (and the
|
|
342
|
+
LLM that consumes it). Mutating it as a side effect of "the task is
|
|
343
|
+
done" is leaky — the visualization URL is not part of the tool's
|
|
344
|
+
output, it's a UI/notification concern.
|
|
345
|
+
2. **Multiple subscribers**: with `env.notify`, the env event bus fans
|
|
346
|
+
the URL out to every subscriber (CLI, IM, webhooks, custom loggers).
|
|
347
|
+
Mutating output only surfaces the URL in the LLM's next prompt.
|
|
348
|
+
3. **Pluggable delivery**: `EventBusNotificationChannel` is the default,
|
|
349
|
+
but hosts can register `LarkCliNotificationChannel` (legacy, sends a
|
|
350
|
+
Feishu message directly) or a custom `WebhookChannel` without
|
|
351
|
+
touching the plugin. The plugin just calls `env.notify` and walks
|
|
352
|
+
away.
|
|
353
|
+
|
|
354
|
+
### Backward compatibility
|
|
355
|
+
|
|
356
|
+
The legacy `injectVisualizationUrl()` helper in `src/url-injector.ts`
|
|
357
|
+
is marked `@deprecated` but is still exported. Set
|
|
358
|
+
`urlInjectEnabled: true` in the plugin config to opt back into the
|
|
359
|
+
mutation behavior — useful for test harnesses and very old hosts that
|
|
360
|
+
don't have the `NotificationChannel` abstraction.
|
|
186
361
|
|
|
187
362
|
## Development
|
|
188
363
|
|
|
189
364
|
```bash
|
|
190
|
-
# Type-check
|
|
365
|
+
# Type-check (no emit)
|
|
366
|
+
bun run typecheck
|
|
367
|
+
|
|
368
|
+
# Build (emit dist/)
|
|
191
369
|
bun run build
|
|
192
370
|
|
|
193
|
-
# Run unit tests (collector, url-injector, server, plugin)
|
|
371
|
+
# Run unit tests (collector, url-injector, server, plugin, plugin-notify)
|
|
194
372
|
bun test
|
|
195
373
|
|
|
196
374
|
# End-to-end check (boots the service, hits it, asserts response)
|
package/dist/collector.d.ts
CHANGED
|
@@ -66,9 +66,14 @@ export declare class ToolCallCollector {
|
|
|
66
66
|
* Mark a task as completed/failed and freeze its `endedAt`. Used by the
|
|
67
67
|
* `task:after.update` hook.
|
|
68
68
|
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
69
|
+
* If no session exists for the task yet (e.g. the task completed without
|
|
70
|
+
* any recorded tool calls — pure response tasks), we create a synthetic
|
|
71
|
+
* session on the fly so the visualization page can still render a
|
|
72
|
+
* meaningful "task finished" card. `startedAt` is set to one second
|
|
73
|
+
* before `endedAt` so the duration widget renders as ~1s rather than 0s.
|
|
74
|
+
*
|
|
75
|
+
* Returns the (possibly newly-created) session, or undefined only if
|
|
76
|
+
* taskId is invalid.
|
|
72
77
|
*/
|
|
73
78
|
finalizeOnTaskUpdate(opts: {
|
|
74
79
|
taskId: number;
|
package/dist/collector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../src/collector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,WAAW,EAEX,cAAc,EACf,MAAM,YAAY,CAAC;AA6DpB;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAiB;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAa;gBAGrC,GAAG,EAAE,cAAc,EACnB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IAOzD;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAMnD;;OAEG;IACH,YAAY,IAAI,WAAW,EAAE;IAM7B;;OAEG;IACH,IAAI,IAAI,MAAM;IAId;;;;;;;OAOG;IACH,cAAc,CAAC,IAAI,EAAE;QACnB,QAAQ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M,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,GAAG,CAAC,EAAE,GAAG,CAAC;QACV,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,MAAM;IA6CV;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAAC,IAAI,EAAE;QACzB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QACjC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,WAAW,GAAG,SAAS;IAiC3B;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAOjD;;OAEG;IACH,KAAK,IAAI,IAAI;IASb;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAoBrB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;CAGrB"}
|
package/dist/collector.js
CHANGED
|
@@ -153,16 +153,36 @@ export class ToolCallCollector {
|
|
|
153
153
|
* Mark a task as completed/failed and freeze its `endedAt`. Used by the
|
|
154
154
|
* `task:after.update` hook.
|
|
155
155
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
156
|
+
* If no session exists for the task yet (e.g. the task completed without
|
|
157
|
+
* any recorded tool calls — pure response tasks), we create a synthetic
|
|
158
|
+
* session on the fly so the visualization page can still render a
|
|
159
|
+
* meaningful "task finished" card. `startedAt` is set to one second
|
|
160
|
+
* before `endedAt` so the duration widget renders as ~1s rather than 0s.
|
|
161
|
+
*
|
|
162
|
+
* Returns the (possibly newly-created) session, or undefined only if
|
|
163
|
+
* taskId is invalid.
|
|
159
164
|
*/
|
|
160
165
|
finalizeOnTaskUpdate(opts) {
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
166
|
+
const now = opts.timestamp ?? Date.now();
|
|
167
|
+
let session = this.sessions.get(opts.taskId);
|
|
168
|
+
if (!session) {
|
|
169
|
+
// Synthetic session — task completed without any recorded tool call.
|
|
170
|
+
session = {
|
|
171
|
+
taskId: opts.taskId,
|
|
172
|
+
title: opts.title ?? "",
|
|
173
|
+
startedAt: now - 1000,
|
|
174
|
+
endedAt: now,
|
|
175
|
+
status: opts.newStatus,
|
|
176
|
+
toolCalls: [],
|
|
177
|
+
};
|
|
178
|
+
this.sessions.set(opts.taskId, session);
|
|
179
|
+
this.evictIfNeeded();
|
|
180
|
+
this.onChange?.();
|
|
181
|
+
this.logger.info(`Task ${opts.taskId} → ${opts.newStatus} (synthetic, no tool calls recorded)`);
|
|
182
|
+
return this.cloneSession(session);
|
|
183
|
+
}
|
|
164
184
|
session.status = opts.newStatus;
|
|
165
|
-
session.endedAt =
|
|
185
|
+
session.endedAt = now;
|
|
166
186
|
if (opts.title)
|
|
167
187
|
session.title = opts.title;
|
|
168
188
|
this.logger.info(`Task ${opts.taskId} → ${opts.newStatus} (${session.toolCalls.length} tool calls)`);
|
package/dist/collector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../src/collector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH;;;GAGG;AACH,MAAM,UAAU;IACe;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAC/C,IAAI,CAAC,GAAW;QACd,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,CAAC;YACnE,sCAAsC;YACtC,OAAO,CAA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,MAAM,CAAC,CAAC;YAC/B,OAAO,IAAI,CAAC,CAAC;QACf,CAAC;QACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,OAAO,oBAAoB,KAAK,GAAG,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACK,YAAY,CAAC,CAAc;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAgB,CAAC;IACtD,CAAC;CACF;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,IAA6B;IACrD,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,MAAM,GACT,IAAY,CAAC,SAAS;QACtB,IAAY,CAAC,IAAI;QACjB,IAAY,CAAC,IAAI;QACjB,IAAY,CAAC,cAAc,CAAC;IAC/B,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC7C,OAAO,kCAAkC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { TaskShowPlugin, createTaskShowPlugin, } from "./plugin.js";
|
|
10
10
|
export type { TaskShowPluginInterface } from "./plugin.js";
|
|
11
|
-
export { DEFAULT_CONFIG, } from "./types.js";
|
|
12
|
-
export type { TaskShowConfig, PluginEnvLike, TaskSession, ToolCallRecord, } from "./types.js";
|
|
11
|
+
export { DEFAULT_CONFIG, NOTIFICATION_TYPE_VISUALIZATION_READY, } from "./types.js";
|
|
12
|
+
export type { TaskShowConfig, PluginEnvLike, NotificationOptions, NotificationType, TaskSession, ToolCallRecord, } from "./types.js";
|
|
13
13
|
export { ToolCallCollector, } from "./collector.js";
|
|
14
14
|
export { TaskShowServer, } from "./server.js";
|
|
15
15
|
export type { ServerInfo } from "./server.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EACL,cAAc,EACd,qCAAqC,GACtC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,cAAc,MAAM,aAAa,CAAC;AACzC,eAAe,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* plugin.init(env);
|
|
8
8
|
*/
|
|
9
9
|
export { TaskShowPlugin, createTaskShowPlugin, } from "./plugin.js";
|
|
10
|
-
export { DEFAULT_CONFIG, } from "./types.js";
|
|
10
|
+
export { DEFAULT_CONFIG, NOTIFICATION_TYPE_VISUALIZATION_READY, } from "./types.js";
|
|
11
11
|
export { ToolCallCollector, } from "./collector.js";
|
|
12
12
|
export { TaskShowServer, } from "./server.js";
|
|
13
13
|
export { buildVisualizationUrl, buildIndexUrl, injectVisualizationUrl, appendVisualizationBanner, } from "./url-injector.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,EACd,qCAAqC,GACtC,MAAM,YAAY,CAAC;AAUpB,OAAO,EACL,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,cAAc,MAAM,aAAa,CAAC;AACzC,eAAe,cAAc,CAAC"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* `collector.ts`, `server.ts`, and `url-injector.ts`. That keeps this file
|
|
13
13
|
* readable and makes the surface area easy to test.
|
|
14
14
|
*/
|
|
15
|
-
import type { PluginEnvLike, TaskShowConfig } from "./types.js";
|
|
15
|
+
import type { PluginEnvLike, TaskShowConfig, TaskSession } from "./types.js";
|
|
16
16
|
import { ToolCallCollector } from "./collector.js";
|
|
17
17
|
/**
|
|
18
18
|
* Public, friendly type used in README + tests.
|
|
@@ -33,6 +33,17 @@ export interface TaskShowPluginInterface {
|
|
|
33
33
|
getCollector(): ToolCallCollector;
|
|
34
34
|
/** accessor for tests that want to bypass the hook manager entirely */
|
|
35
35
|
getConfig(): TaskShowConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Emit a `visualization_ready` notification through `env.notify`.
|
|
38
|
+
* Tests use this to verify payload shape directly; production code
|
|
39
|
+
* should let the hook handler drive it.
|
|
40
|
+
*/
|
|
41
|
+
emitVisualizationReady(opts: {
|
|
42
|
+
taskId: number;
|
|
43
|
+
terminalStatus: TaskSession["status"];
|
|
44
|
+
taskTitle?: string;
|
|
45
|
+
sessionId?: string;
|
|
46
|
+
}): Promise<void>;
|
|
36
47
|
}
|
|
37
48
|
/**
|
|
38
49
|
* Main plugin class. Decorated with the static `roy-agent` metadata block
|
|
@@ -40,15 +51,24 @@ export interface TaskShowPluginInterface {
|
|
|
40
51
|
*/
|
|
41
52
|
export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
42
53
|
readonly name = "roy-plugin-task-show";
|
|
43
|
-
readonly version = "0.
|
|
44
|
-
readonly description = "Visually trace a task's tool-call chain on a local HTTP service and
|
|
54
|
+
readonly version = "0.4.0";
|
|
55
|
+
readonly description = "Visually trace a task's tool-call chain on a local HTTP service and emit a `visualization_ready` notification through the host's `env.notify` API (v0.4.0+).";
|
|
45
56
|
private readonly cfg;
|
|
46
57
|
private readonly collector;
|
|
47
58
|
private readonly server;
|
|
48
59
|
private env;
|
|
49
60
|
private disposed;
|
|
50
|
-
/**
|
|
51
|
-
|
|
61
|
+
/**
|
|
62
|
+
* `tool:before.execute` → `tool:after.execute` start-time buffer.
|
|
63
|
+
* Keyed by a fingerprint derived from (taskId, toolName, argsHash) so
|
|
64
|
+
* that interleaved tool calls in the same task don't collide. The
|
|
65
|
+
* matching `after` consume + delete the entry.
|
|
66
|
+
*
|
|
67
|
+
* This buffer lets the plugin compute `durationMs` end-to-end itself
|
|
68
|
+
* (without requiring the host to propagate a `start_ts` through the
|
|
69
|
+
* tool's result envelope).
|
|
70
|
+
*/
|
|
71
|
+
private pendingStarts;
|
|
52
72
|
/**
|
|
53
73
|
* Per-instance dedup set — guards against the same task reaching this
|
|
54
74
|
* handler from both `task:after.complete` AND `task:after.update`
|
|
@@ -72,6 +92,16 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
|
72
92
|
getServerPort(): number | null;
|
|
73
93
|
getCollector(): ToolCallCollector;
|
|
74
94
|
getConfig(): TaskShowConfig;
|
|
95
|
+
/**
|
|
96
|
+
* Public function exposed so unit tests can simulate the
|
|
97
|
+
* `tool:before.execute` payload (without going through the global hook
|
|
98
|
+
* manager). Used to record a per-call start timestamp so the matching
|
|
99
|
+
* `tool:after.execute` can compute a real `durationMs`.
|
|
100
|
+
*
|
|
101
|
+
* Host contracts vary: some pass an explicit `ctx.start_ts` or a
|
|
102
|
+
* `metadata.start_ts`, others do not. We accept all three.
|
|
103
|
+
*/
|
|
104
|
+
onToolBeforeExecute(ctx: any, metadata?: Record<string, unknown>): Promise<void>;
|
|
75
105
|
/**
|
|
76
106
|
* Public function exposed so unit tests can simulate the
|
|
77
107
|
* `tool:after.execute` payload without going through the global hook
|
|
@@ -104,9 +134,38 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
|
104
134
|
onTaskAfterUpdate(ctx: any): Promise<void>;
|
|
105
135
|
/**
|
|
106
136
|
* Manual injection hook — useful when a custom caller has a known task
|
|
107
|
-
* id + ToolResult at hand (e.g. tests
|
|
137
|
+
* id + ToolResult at hand (e.g. tests, or hosts that pre-date the
|
|
138
|
+
* NotificationChannel abstraction).
|
|
139
|
+
*
|
|
140
|
+
* @deprecated Prefer letting the host call `env.notify` for you. This
|
|
141
|
+
* helper is kept as a thin wrapper around the (also deprecated)
|
|
142
|
+
* `injectVisualizationUrl` for callers that need to mutate a result
|
|
143
|
+
* directly. Will be removed in v2.0.
|
|
108
144
|
*/
|
|
109
145
|
injectFor(taskId: number, result: any): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Emit a `visualization_ready` notification through `env.notify` (when
|
|
148
|
+
* available) or fall back to a warn log. The host is expected to route
|
|
149
|
+
* the notification to its default `EventBusNotificationChannel`, which
|
|
150
|
+
* re-emits it as `plugin.notification.visualization_ready` on the env
|
|
151
|
+
* event bus.
|
|
152
|
+
*
|
|
153
|
+
* Failure handling:
|
|
154
|
+
* - If `env.notify` is undefined (older host that pre-dates
|
|
155
|
+
* NotificationChannel), we log a one-shot warning and continue
|
|
156
|
+
* silently. The plugin must not throw in that case.
|
|
157
|
+
* - If `env.notify` throws or rejects, the error is swallowed (we
|
|
158
|
+
* never let a notification failure abort the hook handler).
|
|
159
|
+
*
|
|
160
|
+
* The method is exposed for tests (so they can verify payload shape
|
|
161
|
+
* directly without going through `onTaskAfterComplete`).
|
|
162
|
+
*/
|
|
163
|
+
emitVisualizationReady(opts: {
|
|
164
|
+
taskId: number;
|
|
165
|
+
terminalStatus: TaskSession["status"];
|
|
166
|
+
taskTitle?: string;
|
|
167
|
+
sessionId?: string;
|
|
168
|
+
}): Promise<void>;
|
|
110
169
|
/**
|
|
111
170
|
* Compute the URL the page would be served at. Helpful in tests where
|
|
112
171
|
* `init()` was skipped.
|
|
@@ -119,6 +178,21 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
|
119
178
|
*/
|
|
120
179
|
private registerHooks;
|
|
121
180
|
private registerViaGlobalManager;
|
|
181
|
+
/**
|
|
182
|
+
* Extract the resolved task id from a tool-hook context. Mirrors the
|
|
183
|
+
* resolution order used in `onToolAfterExecute` so the `before` and
|
|
184
|
+
* `after` handlers key into `pendingStarts` identically.
|
|
185
|
+
*/
|
|
186
|
+
private extractTaskIdFromToolCtx;
|
|
187
|
+
/**
|
|
188
|
+
* Compute a deterministic fingerprint for a tool invocation, used to key
|
|
189
|
+
* the pendingStarts buffer. We deliberately use ONLY (taskId + toolName)
|
|
190
|
+
* — collisions from two consecutive identical calls in the same task are
|
|
191
|
+
* acceptable in practice (we over-write), and the buffer is wiped on
|
|
192
|
+
* matching `after` so long-lived ghost entries cannot accumulate.
|
|
193
|
+
*/
|
|
194
|
+
private fingerprintToolCall;
|
|
195
|
+
private lookupPendingStart;
|
|
122
196
|
}
|
|
123
197
|
/**
|
|
124
198
|
* Convenience factory — used when loaded as a bare ES module (the typical
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAGV,aAAa,EACb,cAAc,EACd,WAAW,EACZ,MAAM,YAAY,CAAC;AAKpB,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,CAAC,CAAC;IAChC,yCAAyC;IACzC,aAAa,IAAI,MAAM,GAAG,IAAI,CAAC;IAC/B,yCAAyC;IACzC,YAAY,IAAI,iBAAiB,CAAC;IAClC,uEAAuE;IACvE,SAAS,IAAI,cAAc,CAAC;IAC5B;;;;OAIG;IACH,sBAAsB,CAAC,IAAI,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,cAAc,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QACtC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,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CAAC;IAyDlD;;;;OAIG;IACG,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAGhD;;;;;;;;;OASG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;IAU/C;;;;;;;;;;;;;;;;OAgBG;IACG,sBAAsB,CAAC,IAAI,EAAE;QACjC,MAAM,EAAE,MAAM,CAAC;QACf,cAAc,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QACtC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiDjB;;;OAGG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAQ3C;;;;OAIG;IACH,OAAO,CAAC,aAAa;YAsDP,wBAAwB;IAiDtC;;;;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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* `collector.ts`, `server.ts`, and `url-injector.ts`. That keeps this file
|
|
13
13
|
* readable and makes the surface area easy to test.
|
|
14
14
|
*/
|
|
15
|
-
import { DEFAULT_CONFIG } from "./types.js";
|
|
15
|
+
import { DEFAULT_CONFIG, NOTIFICATION_TYPE_VISUALIZATION_READY, } from "./types.js";
|
|
16
16
|
import { ToolCallCollector } from "./collector.js";
|
|
17
17
|
import { TaskShowServer } from "./server.js";
|
|
18
18
|
import { buildVisualizationUrl, injectVisualizationUrl, } from "./url-injector.js";
|
|
@@ -40,15 +40,28 @@ function error(msg) {
|
|
|
40
40
|
*/
|
|
41
41
|
export class TaskShowPlugin {
|
|
42
42
|
name = "roy-plugin-task-show";
|
|
43
|
-
version = "0.
|
|
44
|
-
description = "Visually trace a task's tool-call chain on a local HTTP service and
|
|
43
|
+
version = "0.4.0";
|
|
44
|
+
description = "Visually trace a task's tool-call chain on a local HTTP service and emit a `visualization_ready` notification through the host's `env.notify` API (v0.4.0+).";
|
|
45
45
|
cfg;
|
|
46
46
|
collector;
|
|
47
47
|
server;
|
|
48
48
|
env = null;
|
|
49
49
|
disposed = false;
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
// NOTE: v0.4.0 removed the `lastResultByTask` map. URL injection no
|
|
51
|
+
// longer mutates `result.output`; instead we call `env.notify(...)` which
|
|
52
|
+
// the host routes through its `NotificationChannel` pipeline. The map
|
|
53
|
+
// is therefore not needed.
|
|
54
|
+
/**
|
|
55
|
+
* `tool:before.execute` → `tool:after.execute` start-time buffer.
|
|
56
|
+
* Keyed by a fingerprint derived from (taskId, toolName, argsHash) so
|
|
57
|
+
* that interleaved tool calls in the same task don't collide. The
|
|
58
|
+
* matching `after` consume + delete the entry.
|
|
59
|
+
*
|
|
60
|
+
* This buffer lets the plugin compute `durationMs` end-to-end itself
|
|
61
|
+
* (without requiring the host to propagate a `start_ts` through the
|
|
62
|
+
* tool's result envelope).
|
|
63
|
+
*/
|
|
64
|
+
pendingStarts = new Map();
|
|
52
65
|
/**
|
|
53
66
|
* Per-instance dedup set — guards against the same task reaching this
|
|
54
67
|
* handler from both `task:after.complete` AND `task:after.update`
|
|
@@ -113,8 +126,8 @@ export class TaskShowPlugin {
|
|
|
113
126
|
warn(`server.stop failed: ${err}`);
|
|
114
127
|
}
|
|
115
128
|
this.collector.clear();
|
|
116
|
-
this.lastResultByTask.clear();
|
|
117
129
|
this.injectedTaskIds.clear();
|
|
130
|
+
this.pendingStarts.clear();
|
|
118
131
|
this.env = null;
|
|
119
132
|
this.registered = [];
|
|
120
133
|
}
|
|
@@ -131,6 +144,26 @@ export class TaskShowPlugin {
|
|
|
131
144
|
// ---------------------------------------------------------------------
|
|
132
145
|
// Hook handlers (exposed for tests)
|
|
133
146
|
// ---------------------------------------------------------------------
|
|
147
|
+
/**
|
|
148
|
+
* Public function exposed so unit tests can simulate the
|
|
149
|
+
* `tool:before.execute` payload (without going through the global hook
|
|
150
|
+
* manager). Used to record a per-call start timestamp so the matching
|
|
151
|
+
* `tool:after.execute` can compute a real `durationMs`.
|
|
152
|
+
*
|
|
153
|
+
* Host contracts vary: some pass an explicit `ctx.start_ts` or a
|
|
154
|
+
* `metadata.start_ts`, others do not. We accept all three.
|
|
155
|
+
*/
|
|
156
|
+
async onToolBeforeExecute(ctx, metadata) {
|
|
157
|
+
if (this.disposed)
|
|
158
|
+
return;
|
|
159
|
+
if (!ctx)
|
|
160
|
+
return;
|
|
161
|
+
const toolName = ctx?.tool?.name ?? ctx?.toolName ?? "unknown";
|
|
162
|
+
const taskId = this.extractTaskIdFromToolCtx(ctx);
|
|
163
|
+
const ts = Number(metadata?.start_ts ?? ctx?.start_ts ?? Date.now());
|
|
164
|
+
const fp = this.fingerprintToolCall(taskId, toolName, ctx?.args ?? {});
|
|
165
|
+
this.pendingStarts.set(fp, ts);
|
|
166
|
+
}
|
|
134
167
|
/**
|
|
135
168
|
* Public function exposed so unit tests can simulate the
|
|
136
169
|
* `tool:after.execute` payload without going through the global hook
|
|
@@ -147,10 +180,30 @@ export class TaskShowPlugin {
|
|
|
147
180
|
const toolName = tool?.name ?? ctx.toolName ?? "unknown";
|
|
148
181
|
const success = !result?.error && (result?.success ?? true);
|
|
149
182
|
const error = result?.error;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
183
|
+
// Duration resolution order:
|
|
184
|
+
// 1. `metadata.durationMs` or `ctx.durationMs` if explicitly provided
|
|
185
|
+
// (host chose to compute it for us)
|
|
186
|
+
// 2. `metadata.start_ts` or `ctx.start_ts` (host gave us a wall-clock
|
|
187
|
+
// start, we measure elapsed time)
|
|
188
|
+
// 3. fingerprint hit against `pendingStarts` from the matching
|
|
189
|
+
// `tool:before.execute` (plugin-managed timing)
|
|
190
|
+
// 4. fallback: assume the call was instantaneous (`0`)
|
|
191
|
+
let durationMs;
|
|
192
|
+
if (typeof ctx.durationMs === "number") {
|
|
193
|
+
durationMs = ctx.durationMs;
|
|
194
|
+
}
|
|
195
|
+
else if (typeof metadata?.durationMs === "number") {
|
|
196
|
+
durationMs = metadata.durationMs;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
const startTs = metadata?.start_ts ?? ctx.start_ts ?? this.lookupPendingStart(toolName, ctx);
|
|
200
|
+
if (typeof startTs === "number") {
|
|
201
|
+
durationMs = Math.max(0, Date.now() - Number(startTs));
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
durationMs = 0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
154
207
|
const outputPreview = previewOutput(result?.output ?? "");
|
|
155
208
|
const taskId = this.collector.recordToolCall({
|
|
156
209
|
toolName,
|
|
@@ -164,10 +217,10 @@ export class TaskShowPlugin {
|
|
|
164
217
|
metadata: result?.metadata,
|
|
165
218
|
ctx,
|
|
166
219
|
});
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
220
|
+
// Consume + drop the pending start entry for this fingerprint so the
|
|
221
|
+
// buffer doesn't grow unbounded.
|
|
222
|
+
const fp = this.fingerprintToolCall(taskId, toolName, args);
|
|
223
|
+
this.pendingStarts.delete(fp);
|
|
171
224
|
}
|
|
172
225
|
/**
|
|
173
226
|
* Public function exposed for tests; mirrors the `task:after.update`
|
|
@@ -217,7 +270,7 @@ export class TaskShowPlugin {
|
|
|
217
270
|
}
|
|
218
271
|
// Dedup: the same task may reach this handler from BOTH
|
|
219
272
|
// task:after.complete AND task:after.update when running on a newer
|
|
220
|
-
// host (both hooks fire on completion). We
|
|
273
|
+
// host (both hooks fire on completion). We notify exactly once.
|
|
221
274
|
if (this.injectedTaskIds.has(taskId))
|
|
222
275
|
return;
|
|
223
276
|
this.injectedTaskIds.add(taskId);
|
|
@@ -228,20 +281,15 @@ export class TaskShowPlugin {
|
|
|
228
281
|
title: data?.task?.title ?? data?.title,
|
|
229
282
|
timestamp: Date.now(),
|
|
230
283
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
const outcome = injectVisualizationUrl({
|
|
238
|
-
ctx: { result: lastResult },
|
|
239
|
-
cfg: this.cfg,
|
|
284
|
+
// v0.4.0+: emit a `visualization_ready` notification through the host's
|
|
285
|
+
// NotificationChannel pipeline. This decouples the URL reach-out from
|
|
286
|
+
// tool result mutation.
|
|
287
|
+
await this.emitVisualizationReady({
|
|
240
288
|
taskId,
|
|
289
|
+
terminalStatus,
|
|
290
|
+
taskTitle: data?.task?.title ?? data?.title,
|
|
291
|
+
sessionId: data?.sessionId,
|
|
241
292
|
});
|
|
242
|
-
if (outcome.mutated) {
|
|
243
|
-
info(`injected visualization URL ${outcome.url} into last tool result for task ${taskId}`);
|
|
244
|
-
}
|
|
245
293
|
}
|
|
246
294
|
/**
|
|
247
295
|
* @deprecated Use {@link onTaskAfterComplete}. Kept as a thin alias for
|
|
@@ -253,7 +301,13 @@ export class TaskShowPlugin {
|
|
|
253
301
|
}
|
|
254
302
|
/**
|
|
255
303
|
* Manual injection hook — useful when a custom caller has a known task
|
|
256
|
-
* id + ToolResult at hand (e.g. tests
|
|
304
|
+
* id + ToolResult at hand (e.g. tests, or hosts that pre-date the
|
|
305
|
+
* NotificationChannel abstraction).
|
|
306
|
+
*
|
|
307
|
+
* @deprecated Prefer letting the host call `env.notify` for you. This
|
|
308
|
+
* helper is kept as a thin wrapper around the (also deprecated)
|
|
309
|
+
* `injectVisualizationUrl` for callers that need to mutate a result
|
|
310
|
+
* directly. Will be removed in v2.0.
|
|
257
311
|
*/
|
|
258
312
|
injectFor(taskId, result) {
|
|
259
313
|
if (!result || typeof result.output !== "string")
|
|
@@ -265,6 +319,66 @@ export class TaskShowPlugin {
|
|
|
265
319
|
});
|
|
266
320
|
return out.mutated;
|
|
267
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Emit a `visualization_ready` notification through `env.notify` (when
|
|
324
|
+
* available) or fall back to a warn log. The host is expected to route
|
|
325
|
+
* the notification to its default `EventBusNotificationChannel`, which
|
|
326
|
+
* re-emits it as `plugin.notification.visualization_ready` on the env
|
|
327
|
+
* event bus.
|
|
328
|
+
*
|
|
329
|
+
* Failure handling:
|
|
330
|
+
* - If `env.notify` is undefined (older host that pre-dates
|
|
331
|
+
* NotificationChannel), we log a one-shot warning and continue
|
|
332
|
+
* silently. The plugin must not throw in that case.
|
|
333
|
+
* - If `env.notify` throws or rejects, the error is swallowed (we
|
|
334
|
+
* never let a notification failure abort the hook handler).
|
|
335
|
+
*
|
|
336
|
+
* The method is exposed for tests (so they can verify payload shape
|
|
337
|
+
* directly without going through `onTaskAfterComplete`).
|
|
338
|
+
*/
|
|
339
|
+
async emitVisualizationReady(opts) {
|
|
340
|
+
const envNotify = this.env?.notify;
|
|
341
|
+
if (typeof envNotify !== "function") {
|
|
342
|
+
// Older host (no NotificationChannel). Emit a one-shot warn.
|
|
343
|
+
warn(`env.notify is unavailable on this host — visualization_ready ` +
|
|
344
|
+
`for task ${opts.taskId} is not delivered. ` +
|
|
345
|
+
`URL: ${this.getVisualizationUrl(opts.taskId)}`);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const url = this.getVisualizationUrl(opts.taskId);
|
|
349
|
+
const notificationType = NOTIFICATION_TYPE_VISUALIZATION_READY;
|
|
350
|
+
const notification = {
|
|
351
|
+
type: notificationType,
|
|
352
|
+
title: `Task #${opts.taskId} ${opts.terminalStatus}`,
|
|
353
|
+
content: [
|
|
354
|
+
opts.taskTitle ? `Task: ${opts.taskTitle}` : undefined,
|
|
355
|
+
`Status: ${opts.terminalStatus}`,
|
|
356
|
+
`Visualization: ${url}`,
|
|
357
|
+
]
|
|
358
|
+
.filter((line) => Boolean(line))
|
|
359
|
+
.join("\n"),
|
|
360
|
+
metadata: {
|
|
361
|
+
taskId: opts.taskId,
|
|
362
|
+
terminalStatus: opts.terminalStatus,
|
|
363
|
+
url,
|
|
364
|
+
// Sync with host v2 (Task #N/A): let receivers correlate the
|
|
365
|
+
// event with the plugin version that emitted it, and
|
|
366
|
+
// distinguish capture-time from host-side event-bus push time.
|
|
367
|
+
pluginName: this.name,
|
|
368
|
+
pluginVersion: this.version,
|
|
369
|
+
notificationTimestamp: Date.now(),
|
|
370
|
+
...(opts.taskTitle ? { taskTitle: opts.taskTitle } : {}),
|
|
371
|
+
...(opts.sessionId ? { sessionId: opts.sessionId } : {}),
|
|
372
|
+
},
|
|
373
|
+
};
|
|
374
|
+
try {
|
|
375
|
+
await Promise.resolve(envNotify(notification));
|
|
376
|
+
info(`notified visualization_ready for task ${opts.taskId}: ${url}`);
|
|
377
|
+
}
|
|
378
|
+
catch (err) {
|
|
379
|
+
warn(`env.notify failed for task ${opts.taskId}: ${err}`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
268
382
|
/**
|
|
269
383
|
* Compute the URL the page would be served at. Helpful in tests where
|
|
270
384
|
* `init()` was skipped.
|
|
@@ -282,6 +396,17 @@ export class TaskShowPlugin {
|
|
|
282
396
|
*/
|
|
283
397
|
registerHooks(env) {
|
|
284
398
|
if (typeof env.registerHook === "function") {
|
|
399
|
+
// tool:before.execute — used to record per-call start time so
|
|
400
|
+
// tool:after.execute can compute an accurate durationMs without
|
|
401
|
+
// requiring the host to thread a `start_ts` through the tool result.
|
|
402
|
+
// Priority 40 = fires before tool:after (priority 50).
|
|
403
|
+
env.registerHook({
|
|
404
|
+
point: "tool:before.execute",
|
|
405
|
+
priority: 40,
|
|
406
|
+
name: `${this.name}:tool-before`,
|
|
407
|
+
handler: async (ctx) => this.onToolBeforeExecute(ctx),
|
|
408
|
+
});
|
|
409
|
+
this.registered.push({ point: "tool:before.execute", name: `${this.name}:tool-before` });
|
|
285
410
|
env.registerHook({
|
|
286
411
|
point: "tool:after.execute",
|
|
287
412
|
priority: 50,
|
|
@@ -334,6 +459,12 @@ export class TaskShowPlugin {
|
|
|
334
459
|
warn("@ai-setting/roy-agent-core does not export globalHookManager — skipping");
|
|
335
460
|
return;
|
|
336
461
|
}
|
|
462
|
+
globalHookManager.register("tool:before.execute", {
|
|
463
|
+
name: `${this.name}:tool-before`,
|
|
464
|
+
priority: 40,
|
|
465
|
+
execute: async (ctx) => this.onToolBeforeExecute(ctx),
|
|
466
|
+
});
|
|
467
|
+
this.registered.push({ point: "tool:before.execute", name: `${this.name}:tool-before` });
|
|
337
468
|
globalHookManager.register("tool:after.execute", {
|
|
338
469
|
name: `${this.name}:tool-after`,
|
|
339
470
|
priority: 50,
|
|
@@ -353,6 +484,50 @@ export class TaskShowPlugin {
|
|
|
353
484
|
});
|
|
354
485
|
this.registered.push({ point: "task:after.update", name: `${this.name}:task-after` });
|
|
355
486
|
}
|
|
487
|
+
// ---------------------------------------------------------------------
|
|
488
|
+
// Internal helpers
|
|
489
|
+
// ---------------------------------------------------------------------
|
|
490
|
+
/**
|
|
491
|
+
* Extract the resolved task id from a tool-hook context. Mirrors the
|
|
492
|
+
* resolution order used in `onToolAfterExecute` so the `before` and
|
|
493
|
+
* `after` handlers key into `pendingStarts` identically.
|
|
494
|
+
*/
|
|
495
|
+
extractTaskIdFromToolCtx(ctx) {
|
|
496
|
+
if (!ctx)
|
|
497
|
+
return -1;
|
|
498
|
+
const md = ctx.result?.metadata ??
|
|
499
|
+
ctx.metadata ??
|
|
500
|
+
undefined;
|
|
501
|
+
const candidates = [
|
|
502
|
+
ctx.currentTaskId,
|
|
503
|
+
ctx.context?.taskId,
|
|
504
|
+
ctx.context?.current_task_id,
|
|
505
|
+
md?.current_task_id,
|
|
506
|
+
ctx.taskId,
|
|
507
|
+
];
|
|
508
|
+
for (const c of candidates) {
|
|
509
|
+
if (typeof c === "number")
|
|
510
|
+
return c;
|
|
511
|
+
if (typeof c === "string" && /^-?\d+$/.test(c))
|
|
512
|
+
return Number(c);
|
|
513
|
+
}
|
|
514
|
+
return -1;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Compute a deterministic fingerprint for a tool invocation, used to key
|
|
518
|
+
* the pendingStarts buffer. We deliberately use ONLY (taskId + toolName)
|
|
519
|
+
* — collisions from two consecutive identical calls in the same task are
|
|
520
|
+
* acceptable in practice (we over-write), and the buffer is wiped on
|
|
521
|
+
* matching `after` so long-lived ghost entries cannot accumulate.
|
|
522
|
+
*/
|
|
523
|
+
fingerprintToolCall(taskId, toolName, _args) {
|
|
524
|
+
return `${taskId}:${toolName}`;
|
|
525
|
+
}
|
|
526
|
+
lookupPendingStart(toolName, ctx) {
|
|
527
|
+
const taskId = this.extractTaskIdFromToolCtx(ctx);
|
|
528
|
+
const fp = this.fingerprintToolCall(taskId, toolName, ctx?.args ?? {});
|
|
529
|
+
return this.pendingStarts.get(fp);
|
|
530
|
+
}
|
|
356
531
|
}
|
|
357
532
|
// ============================================================================
|
|
358
533
|
// Helpers
|
package/dist/plugin.js.map
CHANGED
|
@@ -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;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AG,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/dist/types.d.ts
CHANGED
|
@@ -56,6 +56,46 @@ export interface TaskSession {
|
|
|
56
56
|
/** Cached URL the visualization page is served at. */
|
|
57
57
|
visualizationUrl?: string;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Notification payload (mirrors the host's `NotificationOptions`).
|
|
61
|
+
*
|
|
62
|
+
* The host's `PluginEnv.notify(options)` accepts an object with these
|
|
63
|
+
* fields. We re-declare the shape here (instead of importing the host
|
|
64
|
+
* type) so the plugin stays loosely coupled to `@ai-setting/roy-agent-core`.
|
|
65
|
+
*/
|
|
66
|
+
export interface NotificationOptions {
|
|
67
|
+
/** Notification type, e.g. `"visualization_ready"`. The host's
|
|
68
|
+
* default `EventBusNotificationChannel` re-emits it as
|
|
69
|
+
* `plugin.notification.<type>` on the env event bus. */
|
|
70
|
+
type: string;
|
|
71
|
+
/** Human-readable title (IM rendering). */
|
|
72
|
+
title: string;
|
|
73
|
+
/** Human-readable content (IM rendering, may include markdown). */
|
|
74
|
+
content: string;
|
|
75
|
+
/** Optional structured metadata, propagated to `event.metadata`. */
|
|
76
|
+
metadata?: Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Stable notification type this plugin emits.
|
|
80
|
+
*
|
|
81
|
+
* Exported so subscribers (host plugins, custom webhook adapters, etc.)
|
|
82
|
+
* can do `import { NOTIFICATION_TYPE_VISUALIZATION_READY } from "@.../roy-plugin-task-show"`
|
|
83
|
+
* instead of duplicating the literal `"visualization_ready"`. Keeps the
|
|
84
|
+
* type in lock-step with the host's `plugin.notification.visualization_ready`
|
|
85
|
+
* event namespace (host's `EventBusNotificationChannel` appends this value
|
|
86
|
+
* to the `plugin.notification.` prefix).
|
|
87
|
+
*
|
|
88
|
+
* Historical background: pre-v0.4.0 the plugin mutated tool result
|
|
89
|
+
* output rather than emit a notification; this constant was added when
|
|
90
|
+
* the env.notify migration landed.
|
|
91
|
+
*/
|
|
92
|
+
export declare const NOTIFICATION_TYPE_VISUALIZATION_READY = "visualization_ready";
|
|
93
|
+
/**
|
|
94
|
+
* Type-union of the notification types this plugin may emit. Today it
|
|
95
|
+
* has one member, but having a union ready makes it trivial to add new
|
|
96
|
+
* notification types in the future without breaking subscribers.
|
|
97
|
+
*/
|
|
98
|
+
export type NotificationType = typeof NOTIFICATION_TYPE_VISUALIZATION_READY;
|
|
59
99
|
/**
|
|
60
100
|
* Minimal PluginEnv surface we depend on.
|
|
61
101
|
*
|
|
@@ -71,6 +111,19 @@ export interface PluginEnvLike {
|
|
|
71
111
|
}) => void;
|
|
72
112
|
getComponent?: (name: string) => unknown;
|
|
73
113
|
getConfig?: (key: string) => unknown;
|
|
114
|
+
/**
|
|
115
|
+
* Send a notification through the host's `NotificationChannel` pipeline
|
|
116
|
+
* (default: `EventBusNotificationChannel`).
|
|
117
|
+
*
|
|
118
|
+
* Available on hosts implementing the v0.4.0+ plugin contract
|
|
119
|
+
* (roy-agent 2026-07-10+). Older hosts may omit this method — the
|
|
120
|
+
* plugin must tolerate the absence (warn + skip, never throw).
|
|
121
|
+
*
|
|
122
|
+
* The host's `notify` is **already** error-tolerant: channel-level
|
|
123
|
+
* exceptions are swallowed inside the host. Plugins may still `await`
|
|
124
|
+
* it for ordering, but should not let the call abort the hook handler.
|
|
125
|
+
*/
|
|
126
|
+
notify?: (options: NotificationOptions) => void | Promise<void>;
|
|
74
127
|
}
|
|
75
128
|
/**
|
|
76
129
|
* Configuration consumed by the plugin.
|
|
@@ -91,6 +144,12 @@ export interface TaskShowConfig {
|
|
|
91
144
|
/**
|
|
92
145
|
* Default configuration. Keeping these as a single source of truth simplifies
|
|
93
146
|
* the loader in plugin.json.
|
|
147
|
+
*
|
|
148
|
+
* v0.4.0+: `urlInjectEnabled` defaults to `false`. The plugin no longer
|
|
149
|
+
* mutates tool result output — reach-out is via `env.notify` instead. Set
|
|
150
|
+
* this to `true` only if you have a custom caller (e.g. test harness)
|
|
151
|
+
* that needs the legacy mutation behavior, or if you have an older host
|
|
152
|
+
* that pre-dates the `NotificationChannel` abstraction.
|
|
94
153
|
*/
|
|
95
154
|
export declare const DEFAULT_CONFIG: TaskShowConfig;
|
|
96
155
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,mFAAmF;IACnF,aAAa,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,uGAAuG;IACvG,aAAa,C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AW,aAAa;IAC5B,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACvD,KAAK,IAAI,CAAC;IACX,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACrC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,EAAE,cAO5B,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -5,16 +5,37 @@
|
|
|
5
5
|
* (a sequence of tool calls with metadata) and exposes helpers used by both
|
|
6
6
|
* the data collector, the HTTP server, and the visualization frontend.
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* Stable notification type this plugin emits.
|
|
10
|
+
*
|
|
11
|
+
* Exported so subscribers (host plugins, custom webhook adapters, etc.)
|
|
12
|
+
* can do `import { NOTIFICATION_TYPE_VISUALIZATION_READY } from "@.../roy-plugin-task-show"`
|
|
13
|
+
* instead of duplicating the literal `"visualization_ready"`. Keeps the
|
|
14
|
+
* type in lock-step with the host's `plugin.notification.visualization_ready`
|
|
15
|
+
* event namespace (host's `EventBusNotificationChannel` appends this value
|
|
16
|
+
* to the `plugin.notification.` prefix).
|
|
17
|
+
*
|
|
18
|
+
* Historical background: pre-v0.4.0 the plugin mutated tool result
|
|
19
|
+
* output rather than emit a notification; this constant was added when
|
|
20
|
+
* the env.notify migration landed.
|
|
21
|
+
*/
|
|
22
|
+
export const NOTIFICATION_TYPE_VISUALIZATION_READY = "visualization_ready";
|
|
8
23
|
/**
|
|
9
24
|
* Default configuration. Keeping these as a single source of truth simplifies
|
|
10
25
|
* the loader in plugin.json.
|
|
26
|
+
*
|
|
27
|
+
* v0.4.0+: `urlInjectEnabled` defaults to `false`. The plugin no longer
|
|
28
|
+
* mutates tool result output — reach-out is via `env.notify` instead. Set
|
|
29
|
+
* this to `true` only if you have a custom caller (e.g. test harness)
|
|
30
|
+
* that needs the legacy mutation behavior, or if you have an older host
|
|
31
|
+
* that pre-dates the `NotificationChannel` abstraction.
|
|
11
32
|
*/
|
|
12
33
|
export const DEFAULT_CONFIG = {
|
|
13
34
|
port: 7788,
|
|
14
35
|
host: "127.0.0.1",
|
|
15
36
|
autoStart: true,
|
|
16
37
|
maxStoredTasks: 50,
|
|
17
|
-
urlInjectEnabled:
|
|
38
|
+
urlInjectEnabled: false,
|
|
18
39
|
publicDir: "public",
|
|
19
40
|
};
|
|
20
41
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA2EH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,qBAAqB,CAAC;AAyD3E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,WAAW;IACjB,SAAS,EAAE,IAAI;IACf,cAAc,EAAE,EAAE;IAClB,gBAAgB,EAAE,KAAK;IACvB,SAAS,EAAE,QAAQ;CACpB,CAAC"}
|
package/dist/url-injector.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Mutates a ToolResult output to append a visualization URL.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* { success, output, error?, metadata? }
|
|
4
|
+
* ## ⚠️ DEPRECATED as of v0.4.0
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* `injectVisualizationUrl()` mutates `result.output` in-place by appending a
|
|
7
|
+
* markdown link. v0.4.0+ plugins should call `env.notify({type:"visualization_ready", ...})`
|
|
8
|
+
* instead — see `TaskShowPlugin.emitVisualizationReady()` in `src/plugin.ts`.
|
|
9
|
+
*
|
|
10
|
+
* The mutation path is kept as a fallback for callers (e.g. custom test
|
|
11
|
+
* harnesses or older hosts) that need to mutate a result directly. It will
|
|
12
|
+
* be removed in v2.0.
|
|
13
|
+
*
|
|
14
|
+
* The mutation itself is **non-destructive** — we never alter or trim the
|
|
15
|
+
* original content, only append after a divider so LLM agents can still
|
|
10
16
|
* parse the response.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated since v0.4.0 — use `env.notify` (host) or
|
|
19
|
+
* `TaskShowPlugin.emitVisualizationReady()` (plugin) instead.
|
|
11
20
|
*/
|
|
12
21
|
import type { TaskShowConfig } from "./types.js";
|
|
13
22
|
/**
|
|
@@ -39,6 +48,10 @@ export interface InjectionResult {
|
|
|
39
48
|
* - The hook context shape is intentionally permissive (any) because the
|
|
40
49
|
* ToolResult shape across versions can drift slightly. We only depend on
|
|
41
50
|
* a string `output`.
|
|
51
|
+
*
|
|
52
|
+
* @deprecated since v0.4.0 — use `env.notify` (host) or
|
|
53
|
+
* `TaskShowPlugin.emitVisualizationReady()` (plugin) instead. This
|
|
54
|
+
* function will be removed in v2.0.
|
|
42
55
|
*/
|
|
43
56
|
export declare function injectVisualizationUrl(opts: {
|
|
44
57
|
ctx?: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-injector.d.ts","sourceRoot":"","sources":["../src/url-injector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"url-injector.d.ts","sourceRoot":"","sources":["../src/url-injector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC,EAC1C,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,MAAM,CAIR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC,GACzC,MAAM,CAGR;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,eAAe,CAyBlB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAAC,EAC1C,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,UAAU,GAAE,MAAM,EAAO,GACxB,MAAM,CAMR"}
|
package/dist/url-injector.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Mutates a ToolResult output to append a visualization URL.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* { success, output, error?, metadata? }
|
|
4
|
+
* ## ⚠️ DEPRECATED as of v0.4.0
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* `injectVisualizationUrl()` mutates `result.output` in-place by appending a
|
|
7
|
+
* markdown link. v0.4.0+ plugins should call `env.notify({type:"visualization_ready", ...})`
|
|
8
|
+
* instead — see `TaskShowPlugin.emitVisualizationReady()` in `src/plugin.ts`.
|
|
9
|
+
*
|
|
10
|
+
* The mutation path is kept as a fallback for callers (e.g. custom test
|
|
11
|
+
* harnesses or older hosts) that need to mutate a result directly. It will
|
|
12
|
+
* be removed in v2.0.
|
|
13
|
+
*
|
|
14
|
+
* The mutation itself is **non-destructive** — we never alter or trim the
|
|
15
|
+
* original content, only append after a divider so LLM agents can still
|
|
10
16
|
* parse the response.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated since v0.4.0 — use `env.notify` (host) or
|
|
19
|
+
* `TaskShowPlugin.emitVisualizationReady()` (plugin) instead.
|
|
11
20
|
*/
|
|
12
21
|
/**
|
|
13
22
|
* Build the public URL the visualization lives at. Exposed so that unit tests
|
|
@@ -33,6 +42,10 @@ export function buildIndexUrl(cfg) {
|
|
|
33
42
|
* - The hook context shape is intentionally permissive (any) because the
|
|
34
43
|
* ToolResult shape across versions can drift slightly. We only depend on
|
|
35
44
|
* a string `output`.
|
|
45
|
+
*
|
|
46
|
+
* @deprecated since v0.4.0 — use `env.notify` (host) or
|
|
47
|
+
* `TaskShowPlugin.emitVisualizationReady()` (plugin) instead. This
|
|
48
|
+
* function will be removed in v2.0.
|
|
36
49
|
*/
|
|
37
50
|
export function injectVisualizationUrl(opts) {
|
|
38
51
|
const { ctx, cfg, taskId } = opts;
|
package/dist/url-injector.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-injector.js","sourceRoot":"","sources":["../src/url-injector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"url-injector.js","sourceRoot":"","sources":["../src/url-injector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAA0C,EAC1C,MAAuB;IAEvB,qDAAqD;IACrD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IAC7D,OAAO,UAAU,IAAI,IAAI,GAAG,CAAC,IAAI,SAAS,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,GAA0C;IAE1C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IAC7D,OAAO,UAAU,IAAI,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC;AACvC,CAAC;AAeD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAItC;IACC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAElC,IAAI,CAAC,GAAG,CAAC,gBAAgB;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACrD,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAEpC,MAAM,MAAM,GAAG,GAAG,EAAE,MAAM,IAAI,GAAG,EAAE,UA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"@ai-setting/roy-plugin-task-show",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc -p tsconfig.json",
|
|
17
17
|
"dev": "tsc -p tsconfig.json --watch",
|
|
18
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
18
19
|
"test": "bun test",
|
|
19
20
|
"start:demo": "bun run scripts/run-demo.ts",
|
|
20
21
|
"verify": "bun run scripts/verify-service.ts",
|
package/plugin.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-setting/roy-plugin-task-show",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "tool-plugin",
|
|
5
|
-
"description": "Visualize the tool call chain of a task on a local web service and
|
|
5
|
+
"description": "Visualize the tool call chain of a task on a local web service and notify via env.notify. v0.4.0+: env.notify({type:\"visualization_ready\"}) on terminal status (preferred). 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
|
},
|
|
12
16
|
{
|
|
13
17
|
"point": "task:after.complete",
|
|
14
|
-
"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
|
|
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 emit a `visualization_ready` notification via `env.notify`. terminalStatus field is explicit — no status filtering required. The URL is delivered through the host's NotificationChannel pipeline (default: EventBusNotificationChannel) instead of mutating tool result output."
|
|
15
19
|
},
|
|
16
20
|
{
|
|
17
21
|
"point": "task:after.update",
|
|
@@ -47,8 +51,8 @@
|
|
|
47
51
|
},
|
|
48
52
|
"urlInjectEnabled": {
|
|
49
53
|
"type": "boolean",
|
|
50
|
-
"default":
|
|
51
|
-
"description": "Append a
|
|
54
|
+
"default": false,
|
|
55
|
+
"description": "DEPRECATED (v0.4.0+). Append a 📊 visualization URL to the last tool result when a task completes. The plugin no longer mutates tool result output by default — use env.notify instead. Set to true only for legacy hosts that pre-date NotificationChannel."
|
|
52
56
|
},
|
|
53
57
|
"publicDir": {
|
|
54
58
|
"type": "string",
|