@ai-setting/roy-plugin-task-show 0.8.8 → 0.8.10
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/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/operations-cache.d.ts +21 -0
- package/dist/operations-cache.d.ts.map +1 -1
- package/dist/operations-cache.js +45 -0
- package/dist/operations-cache.js.map +1 -1
- package/dist/plugin.d.ts +14 -74
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +77 -173
- package/dist/plugin.js.map +1 -1
- package/dist/server.d.ts +0 -29
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +10 -164
- package/dist/server.js.map +1 -1
- package/dist/tasks-tree-cache.d.ts +17 -0
- package/dist/tasks-tree-cache.d.ts.map +1 -1
- package/dist/tasks-tree-cache.js +39 -0
- package/dist/tasks-tree-cache.js.map +1 -1
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -1
- package/package.json +5 -3
- package/plugin.json +2 -2
- package/dist/task-session-store.d.ts +0 -109
- package/dist/task-session-store.d.ts.map +0 -1
- package/dist/task-session-store.js +0 -193
- package/dist/task-session-store.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export type { TaskShowPluginInterface } from "./plugin.js";
|
|
|
11
11
|
export { DEFAULT_CONFIG, } from "./types.js";
|
|
12
12
|
export type { TaskShowConfig, PluginEnvLike, TaskSession, ToolCallRecord, TaskEvent, TaskEventType, TaskCreatedEventData, TaskUpdatedEventData, TaskCompletedEventData, ToolRecordedEventData, TypedTaskEvent, } from "./types.js";
|
|
13
13
|
export { ToolCallCollector, } from "./collector.js";
|
|
14
|
-
export { TaskSessionStore, makeCliTaskMetaFetcher, } from "./task-session-store.js";
|
|
15
|
-
export type { TaskMetaLike, TaskMetaFetcher, BuildAncestorChainOptions, } from "./task-session-store.js";
|
|
16
14
|
export { TaskShowServer, } from "./server.js";
|
|
17
15
|
export type { ServerInfo } from "./server.js";
|
|
18
16
|
export { EventBus, formatSSEFrame, writeSSEHeaders, } from "./event-bus.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,EACpB,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EACL,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,EAC3B,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EACL,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc,EACd,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,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,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,cAAc,MAAM,aAAa,CAAC;AACzC,eAAe,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
export { TaskShowPlugin, createTaskShowPlugin, printStartBanner, printStartBannerWithWarning, } from "./plugin.js";
|
|
10
10
|
export { DEFAULT_CONFIG, } from "./types.js";
|
|
11
11
|
export { ToolCallCollector, } from "./collector.js";
|
|
12
|
-
export { TaskSessionStore, makeCliTaskMetaFetcher, } from "./task-session-store.js";
|
|
13
12
|
export { TaskShowServer, } from "./server.js";
|
|
14
13
|
export { EventBus, formatSSEFrame, writeSSEHeaders, } from "./event-bus.js";
|
|
15
14
|
export { buildVisualizationUrl, buildIndexUrl, } 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,EACpB,gBAAgB,EAChB,2BAA2B,GAE5B,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,GACf,MAAM,YAAY,CAAC;AAepB,OAAO,EACL,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,GAE5B,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,GACf,MAAM,YAAY,CAAC;AAepB,OAAO,EACL,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,qBAAqB,EACrB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,cAAc,MAAM,aAAa,CAAC;AACzC,eAAe,cAAc,CAAC"}
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Errors from the source are NOT cached — a transient CLI failure
|
|
9
9
|
* shouldn't poison the entry for the rest of the TTL window.
|
|
10
|
+
*
|
|
11
|
+
* v0.8.10+: the cache now also enforces a hard `maxEntries` cap. When
|
|
12
|
+
* the cache exceeds the cap, the eviction sweep drops the *oldest*
|
|
13
|
+
* entries that are also past their TTL. This keeps the heap footprint
|
|
14
|
+
* bounded in long-lived hosts (see Task #2537 — roy-agent 4 GiB OOM).
|
|
10
15
|
*/
|
|
11
16
|
import type { CachedEnvelope, TaskOperationsEnvelope, TaskOperationsSource } from "./cli-tasks-adapter.js";
|
|
12
17
|
export interface OperationsCacheSource {
|
|
@@ -16,6 +21,13 @@ export interface OperationsCacheOptions {
|
|
|
16
21
|
source: OperationsCacheSource | TaskOperationsSource;
|
|
17
22
|
/** Time-to-live in milliseconds. Default 5000. */
|
|
18
23
|
ttlMs?: number;
|
|
24
|
+
/**
|
|
25
|
+
* v0.8.10+: hard cap on the number of cached entries. Past this limit,
|
|
26
|
+
* the cache sweeps the oldest entries that are *also* past their TTL
|
|
27
|
+
* before inserting a new one. Default 256. Set to `Infinity` to keep
|
|
28
|
+
* the unbounded behavior (not recommended in long-lived hosts).
|
|
29
|
+
*/
|
|
30
|
+
maxEntries?: number;
|
|
19
31
|
/** Optional: clock for tests. */
|
|
20
32
|
now?: () => number;
|
|
21
33
|
}
|
|
@@ -24,6 +36,7 @@ export declare class OperationsCache {
|
|
|
24
36
|
private readonly ttlMs;
|
|
25
37
|
private readonly source;
|
|
26
38
|
private readonly now;
|
|
39
|
+
private readonly maxEntries;
|
|
27
40
|
constructor(opts: OperationsCacheOptions);
|
|
28
41
|
/**
|
|
29
42
|
* Fetch (or read from cache). Concurrent calls for the same id coalesce.
|
|
@@ -39,6 +52,14 @@ export declare class OperationsCache {
|
|
|
39
52
|
clear(): void;
|
|
40
53
|
/** Number of cached entries (test introspection). */
|
|
41
54
|
size(): number;
|
|
55
|
+
/**
|
|
56
|
+
* Sweep entries that are past their TTL once we exceed `maxEntries`.
|
|
57
|
+
*
|
|
58
|
+
* Insertion order is preserved by `Map`, so the first keys we iterate
|
|
59
|
+
* are the oldest. We drop only stale entries — fresh ones survive even
|
|
60
|
+
* under heavy churn so a hot task id never loses its cache hit.
|
|
61
|
+
*/
|
|
62
|
+
private evictStale;
|
|
42
63
|
private refresh;
|
|
43
64
|
}
|
|
44
65
|
//# sourceMappingURL=operations-cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-cache.d.ts","sourceRoot":"","sources":["../src/operations-cache.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"operations-cache.d.ts","sourceRoot":"","sources":["../src/operations-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE3G,MAAM,WAAW,qBAAqB;IACpC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACnD;AAWD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,qBAAqB,GAAG,oBAAoB,CAAC;IACrD,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAC/C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,IAAI,EAAE,sBAAsB;IAqBxC;;;;OAIG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,cAAc,CAAC;IA8CvF,sCAAsC;IACtC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIhC,yBAAyB;IACzB,KAAK,IAAI,IAAI;IAIb,qDAAqD;IACrD,IAAI,IAAI,MAAM;IAId;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;YAuBJ,OAAO;CActB"}
|
package/dist/operations-cache.js
CHANGED
|
@@ -7,15 +7,25 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Errors from the source are NOT cached — a transient CLI failure
|
|
9
9
|
* shouldn't poison the entry for the rest of the TTL window.
|
|
10
|
+
*
|
|
11
|
+
* v0.8.10+: the cache now also enforces a hard `maxEntries` cap. When
|
|
12
|
+
* the cache exceeds the cap, the eviction sweep drops the *oldest*
|
|
13
|
+
* entries that are also past their TTL. This keeps the heap footprint
|
|
14
|
+
* bounded in long-lived hosts (see Task #2537 — roy-agent 4 GiB OOM).
|
|
10
15
|
*/
|
|
11
16
|
export class OperationsCache {
|
|
12
17
|
entries = new Map();
|
|
13
18
|
ttlMs;
|
|
14
19
|
source;
|
|
15
20
|
now;
|
|
21
|
+
maxEntries;
|
|
16
22
|
constructor(opts) {
|
|
17
23
|
this.ttlMs = opts.ttlMs ?? 5000;
|
|
18
24
|
this.now = opts.now ?? (() => Date.now());
|
|
25
|
+
this.maxEntries = opts.maxEntries ?? 256;
|
|
26
|
+
if (!Number.isFinite(this.maxEntries) || this.maxEntries < 1) {
|
|
27
|
+
throw new RangeError(`OperationsCache: maxEntries must be a positive finite number, got ${this.maxEntries}`);
|
|
28
|
+
}
|
|
19
29
|
// Normalize source: accept either a function or a { getTaskOperations }
|
|
20
30
|
// object so callers don't have to wrap manually.
|
|
21
31
|
const src = opts.source;
|
|
@@ -40,6 +50,7 @@ export class OperationsCache {
|
|
|
40
50
|
if (existing && now - existing.fetchedAtMs < this.ttlMs) {
|
|
41
51
|
// Fresh hit
|
|
42
52
|
existing.envelope.stale = false;
|
|
53
|
+
this.evictStale(now);
|
|
43
54
|
return existing.envelope;
|
|
44
55
|
}
|
|
45
56
|
if (existing && opts.allowStale) {
|
|
@@ -52,12 +63,14 @@ export class OperationsCache {
|
|
|
52
63
|
// Swallow background errors — they'll surface on the next call
|
|
53
64
|
existing.inflight.catch(() => { });
|
|
54
65
|
}
|
|
66
|
+
this.evictStale(now);
|
|
55
67
|
return existing.envelope;
|
|
56
68
|
}
|
|
57
69
|
// No fresh entry → fetch (with dedup of concurrent callers)
|
|
58
70
|
if (existing?.inflight) {
|
|
59
71
|
return existing.inflight;
|
|
60
72
|
}
|
|
73
|
+
this.evictStale(now);
|
|
61
74
|
const entry = existing ?? {
|
|
62
75
|
envelope: {
|
|
63
76
|
task: { id: taskId, title: "", status: "unknown", priority: "medium", type: "normal", createdAt: "", updatedAt: "", tags: [] },
|
|
@@ -85,6 +98,38 @@ export class OperationsCache {
|
|
|
85
98
|
size() {
|
|
86
99
|
return this.entries.size;
|
|
87
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Sweep entries that are past their TTL once we exceed `maxEntries`.
|
|
103
|
+
*
|
|
104
|
+
* Insertion order is preserved by `Map`, so the first keys we iterate
|
|
105
|
+
* are the oldest. We drop only stale entries — fresh ones survive even
|
|
106
|
+
* under heavy churn so a hot task id never loses its cache hit.
|
|
107
|
+
*/
|
|
108
|
+
evictStale(now) {
|
|
109
|
+
if (this.entries.size <= this.maxEntries)
|
|
110
|
+
return;
|
|
111
|
+
let overflow = this.entries.size - this.maxEntries;
|
|
112
|
+
for (const [key, entry] of this.entries) {
|
|
113
|
+
if (overflow <= 0)
|
|
114
|
+
break;
|
|
115
|
+
if (now - entry.fetchedAtMs >= this.ttlMs) {
|
|
116
|
+
this.entries.delete(key);
|
|
117
|
+
overflow -= 1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// If we still overflow after purging every stale entry (cache is full
|
|
121
|
+
// of fresh entries), drop the oldest fresh entries too so we never
|
|
122
|
+
// exceed the cap.
|
|
123
|
+
if (this.entries.size > this.maxEntries) {
|
|
124
|
+
overflow = this.entries.size - this.maxEntries;
|
|
125
|
+
for (const key of this.entries.keys()) {
|
|
126
|
+
if (overflow <= 0)
|
|
127
|
+
break;
|
|
128
|
+
this.entries.delete(key);
|
|
129
|
+
overflow -= 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
88
133
|
async refresh(taskId) {
|
|
89
134
|
const envelope = await this.source(taskId);
|
|
90
135
|
const now = this.now();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-cache.js","sourceRoot":"","sources":["../src/operations-cache.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"operations-cache.js","sourceRoot":"","sources":["../src/operations-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgCH,MAAM,OAAO,eAAe;IACT,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;IACnC,KAAK,CAAS;IACd,MAAM,CAAwB;IAC9B,GAAG,CAAe;IAClB,UAAU,CAAS;IAEpC,YAAY,IAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,IA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,EAAE,CAAC;YACxC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC;YAC/C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;gBACtC,IAAI,QAAQ,IAAI,CAAC;oBAAE,MAAM;gBACzB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACzB,QAAQ,IAAI,CAAC,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,MAAc;QAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,MAAM,GAAmB;YAC7B,GAAG,QAAQ;YACX,SAAS,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;YACtC,KAAK,EAAE,KAAK;SACb,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;YACvB,QAAQ,EAAE,MAAM;YAChB,WAAW,EAAE,GAAG;SACjB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -104,61 +104,6 @@ export declare function resolveToolName(ctx: any, logger?: ResolveToolNameLogger
|
|
|
104
104
|
* reach for it.
|
|
105
105
|
*/
|
|
106
106
|
export declare function __resetResolveToolNameWarnDedupForTests(): void;
|
|
107
|
-
/**
|
|
108
|
-
* Best-effort lookup of the `roy-agent` executable on the OS PATH.
|
|
109
|
-
*
|
|
110
|
-
* Implementation: shell out to the platform's native resolver:
|
|
111
|
-
* - POSIX (Linux / macOS): `which roy-agent`
|
|
112
|
-
* - Windows: `where roy-agent`
|
|
113
|
-
*
|
|
114
|
-
* We avoid hand-rolling a `node:fs` + `process.env.PATH` parser because
|
|
115
|
-
* Windows PATH uses `;` (not `:`), `.bat` / `.cmd` shims need to be
|
|
116
|
-
* resolved, and PowerShell vs cmd semantics differ. The shell utils
|
|
117
|
-
* handle those edge cases correctly for us.
|
|
118
|
-
*
|
|
119
|
-
* Returns the absolute path of the first match, or `null` if:
|
|
120
|
-
* - the binary is not installed
|
|
121
|
-
* - the resolver command (`which` / `where`) is unavailable
|
|
122
|
-
* - any unexpected error happens (caught silently — best-effort)
|
|
123
|
-
*
|
|
124
|
-
* v0.8.5+ — new export. Was previously inlined inside the class method.
|
|
125
|
-
*/
|
|
126
|
-
export declare function findRoyAgentOnPath(): string | null;
|
|
127
|
-
/**
|
|
128
|
-
* Resolve the `roy-agent` executable to use for the operations pipeline.
|
|
129
|
-
*
|
|
130
|
-
* v0.8.5+ priority order (changed from v0.8.4):
|
|
131
|
-
* 1. Explicit override (`cfg.royAgentCliPath`) — used as-is regardless
|
|
132
|
-
* of whether it exists on disk. The caller knows what they want.
|
|
133
|
-
* 2. `$ROY_AGENT_CLI` env var — same semantics: trust the operator.
|
|
134
|
-
* 3. **`roy-agent` on PATH** (the new priority-3 step). This is the
|
|
135
|
-
* preferred choice in production because it always tracks the
|
|
136
|
-
* latest globally-installed version, regardless of where the
|
|
137
|
-
* plugin itself lives on disk.
|
|
138
|
-
* 4. Sibling-repo `.js` script:
|
|
139
|
-
* `<cwd>/../roy-agent/packages/cli/dist/bin/roy-agent.js`
|
|
140
|
-
* (typical when both repos live side-by-side — dev layout)
|
|
141
|
-
* 5. Monorepo `.js` script:
|
|
142
|
-
* `<plugin>/../../../../packages/cli/dist/bin/roy-agent.js`
|
|
143
|
-
* (dev layout when the plugin is checked out from a monorepo)
|
|
144
|
-
* 6. Final fallback: the literal string `"roy-agent"`. The OS spawn
|
|
145
|
-
* will resolve it via PATH one more time as a last resort.
|
|
146
|
-
*
|
|
147
|
-
* **Why the priority changed in v0.8.5:**
|
|
148
|
-
* In v0.8.4 the function preferred the sibling-repo / monorepo `.js`
|
|
149
|
-
* scripts over the system PATH. That worked fine during local dev
|
|
150
|
-
* but, after publishing the plugin globally via npm, it meant:
|
|
151
|
-
* - The plugin would keep using the stale `.js` left in a sibling
|
|
152
|
-
* checkout (because `fs.existsSync` returned true even though
|
|
153
|
-
* `npm install -g @ai-setting/roy-agent-cli` had updated the
|
|
154
|
-
* canonical copy).
|
|
155
|
-
* - Users couldn't pick up CLI bug fixes without also reinstalling
|
|
156
|
-
* the plugin or cleaning up the stale `.js`.
|
|
157
|
-
* v0.8.5 flips the order: PATH first, `.js` files only as dev-time
|
|
158
|
-
* fallbacks. The result is that the globally-installed CLI is
|
|
159
|
-
* always the source of truth.
|
|
160
|
-
*/
|
|
161
|
-
export declare function resolveRoyAgentCliPath(override: string | undefined): string;
|
|
162
107
|
/**
|
|
163
108
|
* Public, friendly type used in README + tests.
|
|
164
109
|
*
|
|
@@ -192,8 +137,8 @@ export interface TaskShowPluginInterface {
|
|
|
192
137
|
*/
|
|
193
138
|
export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
194
139
|
readonly name = "roy-plugin-task-show";
|
|
195
|
-
readonly version = "0.
|
|
196
|
-
readonly description = "Visually trace a task's tool-call chain on a local HTTP service. v0.5.0+ uses Server-Sent Events for real-time page updates (no host NotificationChannel required).
|
|
140
|
+
readonly version = "0.6.10";
|
|
141
|
+
readonly description = "Visually trace a task's tool-call chain on a local HTTP service. v0.5.0+ uses Server-Sent Events for real-time page updates (no host NotificationChannel required).";
|
|
197
142
|
private readonly cfg;
|
|
198
143
|
private readonly collector;
|
|
199
144
|
private readonly server;
|
|
@@ -202,14 +147,6 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
|
202
147
|
private readonly operationsCache;
|
|
203
148
|
/** v0.8.0+: cache for parsed task tree envelopes (used by /api/tasks/tree). */
|
|
204
149
|
private readonly tasksTreeCache;
|
|
205
|
-
/** v0.8.7+: process-scoped registry of tasks observed via the
|
|
206
|
-
* `task:after.create` hook. Drives the home page's ancestor-chain
|
|
207
|
-
* view. */
|
|
208
|
-
private readonly taskSessionStore;
|
|
209
|
-
/** v0.8.7+: absolute path to the `roy-agent` CLI used for the
|
|
210
|
-
* ancestor-chain parent fetcher. Cached so we resolve once per
|
|
211
|
-
* plugin instance. */
|
|
212
|
-
private readonly cliPath;
|
|
213
150
|
private env;
|
|
214
151
|
private disposed;
|
|
215
152
|
/**
|
|
@@ -235,11 +172,12 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
|
235
172
|
constructor(config?: Partial<TaskShowConfig>);
|
|
236
173
|
/**
|
|
237
174
|
* Resolve the `roy-agent` executable to use for the operations pipeline.
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
175
|
+
* Resolution order:
|
|
176
|
+
* 1. Explicit override (`cfg.royAgentCliPath`) if it exists
|
|
177
|
+
* 2. `$ROY_AGENT_CLI` env var if it exists
|
|
178
|
+
* 3. `<cwd>/../roy-agent/packages/cli/dist/bin/roy-agent.js`
|
|
179
|
+
* (the typical layout when both repos live side-by-side)
|
|
180
|
+
* 4. The global `roy-agent` on PATH (best-effort)
|
|
243
181
|
*/
|
|
244
182
|
private resolveRoyAgentCliPath;
|
|
245
183
|
/**
|
|
@@ -267,6 +205,12 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
|
267
205
|
* `metadata.start_ts`, others do not. We accept all three.
|
|
268
206
|
*/
|
|
269
207
|
onToolBeforeExecute(ctx: any, metadata?: Record<string, unknown>): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Drop pendingStarts entries older than .
|
|
210
|
+
* Called from onToolBeforeExecute (sweep-before-insert) and onToolAfterExecute
|
|
211
|
+
* (to opportunistically prune leftovers from a previous burst).
|
|
212
|
+
*/
|
|
213
|
+
private sweepPendingStarts;
|
|
270
214
|
/**
|
|
271
215
|
* Public function exposed so unit tests can simulate the
|
|
272
216
|
* `tool:after.execute` payload without going through the global hook
|
|
@@ -287,10 +231,6 @@ export declare class TaskShowPlugin implements TaskShowPluginInterface {
|
|
|
287
231
|
*
|
|
288
232
|
* Hosts that only emit `task:after.create` (no before) are also
|
|
289
233
|
* supported — in that case the session is opened here.
|
|
290
|
-
*
|
|
291
|
-
* v0.8.7+: also records the task in {@link taskSessionStore} so the
|
|
292
|
-
* home page can render the ancestor chain. We capture the
|
|
293
|
-
* `parent_task_id` field if the host supplies it (newer hosts do).
|
|
294
234
|
*/
|
|
295
235
|
onTaskAfterCreate(ctx: any): Promise<void>;
|
|
296
236
|
/**
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EACV,aAAa,EAIb,cAAc,EAGf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EACV,aAAa,EAIb,cAAc,EAGf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAsC1C;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,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