@koinzhang/paseo-plugin-activity 0.3.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/CHANGELOG.md +25 -1
- package/README.md +6 -5
- package/client/attention-agents.test.ts +94 -0
- package/client/attention-agents.ts +67 -0
- package/client/attention-pill.tsx +254 -0
- package/client/attention-popover.tsx +161 -0
- package/client/attention-status-store.ts +47 -0
- package/client/global-surface.tsx +3 -1
- package/client/latest-user-message.test.ts +34 -0
- package/client/latest-user-message.ts +96 -0
- package/client/open-agent.ts +32 -0
- package/client/panel.tsx +2 -0
- package/client/use-agent-turn-end.ts +4 -1
- package/client/use-latest-user-message.ts +15 -0
- package/client/use-workspace-agent-statuses.ts +47 -0
- package/client/workspace/agent-live-status-sync.tsx +103 -0
- package/client/workspace/agent-row.tsx +49 -22
- package/client/workspace/agents-section.tsx +90 -22
- package/client/workspace/constants.test.ts +66 -0
- package/client/workspace/constants.ts +37 -1
- package/client/workspace/filters.test.ts +59 -0
- package/client/workspace/filters.ts +9 -0
- package/client/workspace/list-host-agents.test.ts +59 -1
- package/client/workspace/list-host-agents.ts +66 -9
- package/client/workspace/panel.tsx +39 -23
- package/client/workspace/status-cache.test.ts +5 -5
- package/client/workspace/status-cache.ts +5 -1
- package/index.client.tsx +7 -1
- package/package.json +2 -2
- package/shared/explorer-agent-display.ts +1 -1
- package/shared/usage.test.ts +8 -2
- package/shared/usage.ts +7 -0
|
@@ -6,10 +6,10 @@ import { agentStatusInfo, loadWorkspaceAgentStatuses, type HostAgentUpdate } fro
|
|
|
6
6
|
import { agentUpdatedAt } from "./constants.ts";
|
|
7
7
|
import type { AgentUsageItem } from "../../shared/usage.ts";
|
|
8
8
|
|
|
9
|
-
test("late poll cannot erase live permission or remove; cancellation preserves earlier pushes", async () => {
|
|
9
|
+
test("late poll cannot erase live permission or closed-on-remove; cancellation preserves earlier pushes", async () => {
|
|
10
10
|
const client = new QueryClient();
|
|
11
11
|
const key = ["activity", "workspace-agent-status", "w"];
|
|
12
|
-
const stale = { a: agentStatusInfo({ id: "a", workspaceId: "w" }), b: agentStatusInfo({ id: "b", workspaceId: "w" }) };
|
|
12
|
+
const stale = { a: agentStatusInfo({ id: "a", workspaceId: "w" }), b: agentStatusInfo({ id: "b", workspaceId: "w", status: "idle" }) };
|
|
13
13
|
client.setQueryData(key, stale);
|
|
14
14
|
let finish!: (value: typeof stale) => void;
|
|
15
15
|
const pending = client.fetchQuery({ queryKey: key, queryFn: () => new Promise<typeof stale>(resolve => { finish = resolve; }) });
|
|
@@ -20,7 +20,7 @@ test("late poll cannot erase live permission or remove; cancellation preserves e
|
|
|
20
20
|
await Promise.resolve();
|
|
21
21
|
const current = client.getQueryData<typeof stale>(key)!;
|
|
22
22
|
assert.equal(current.a.permissionCount, 1);
|
|
23
|
-
assert.equal(current.b,
|
|
23
|
+
assert.equal(current.b?.status, "closed");
|
|
24
24
|
assert.equal(client.getQueryState(key)?.status, "success");
|
|
25
25
|
assert.equal(client.getQueryState(key)?.fetchStatus, "idle");
|
|
26
26
|
client.clear();
|
|
@@ -37,11 +37,11 @@ test("first paginated load replays upserts and removes and releases its listener
|
|
|
37
37
|
if (pages === 1) return { entries: [{ agent: { id: "a", workspaceId: "w" } }], pageInfo: { hasMore: true, nextCursor: "next" } };
|
|
38
38
|
listener({ kind: "upsert", agent: { id: "a", workspaceId: "w", pendingPermissions: [{}] } });
|
|
39
39
|
listener({ kind: "remove", agentId: "b" });
|
|
40
|
-
return { entries: [{ agent: { id: "b", workspaceId: "w" } }], pageInfo: { hasMore: false, nextCursor: null } };
|
|
40
|
+
return { entries: [{ agent: { id: "b", workspaceId: "w", status: "idle" } }], pageInfo: { hasMore: false, nextCursor: null } };
|
|
41
41
|
},
|
|
42
42
|
} }, "w");
|
|
43
43
|
assert.equal(map.a?.permissionCount, 1);
|
|
44
|
-
assert.equal(map.b,
|
|
44
|
+
assert.equal(map.b?.status, "closed");
|
|
45
45
|
assert.equal(unsubscribed, true);
|
|
46
46
|
});
|
|
47
47
|
|
|
@@ -9,7 +9,11 @@ export function updateWorkspaceStatusCache(
|
|
|
9
9
|
const previous = queryClient.getQueryData<Record<string, AgentStatusInfo>>(queryKey);
|
|
10
10
|
if (!previous) return;
|
|
11
11
|
const id = update.kind === "remove" ? update.agentId : update.agent.id;
|
|
12
|
-
if (!(id in previous)
|
|
12
|
+
if (!(id in previous)) {
|
|
13
|
+
if (update.kind === "remove") return;
|
|
14
|
+
if (update.agent.workspaceId != null && update.agent.workspaceId !== workspaceId) return;
|
|
15
|
+
if (update.agent.workspaceId == null) return;
|
|
16
|
+
}
|
|
13
17
|
// cancelQueries cancels synchronously, even when the SDK ignores AbortSignal.
|
|
14
18
|
// Restore our captured latest cache after cancellation reverts the old fetch.
|
|
15
19
|
void queryClient.cancelQueries({ queryKey, exact: true });
|
package/index.client.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
2
|
import { GlobalUsageSurface } from "./client/global-surface.tsx";
|
|
3
3
|
import { UsagePanel } from "./client/panel.tsx";
|
|
4
|
+
import { contributeAttentionPills } from "./client/attention-pill.tsx";
|
|
4
5
|
import { contributePills } from "./client/pill.tsx";
|
|
5
6
|
import { WorkspaceActivityPanel } from "./client/workspace-panel.tsx";
|
|
6
7
|
|
|
@@ -65,5 +66,10 @@ export default function contribute(client: PluginClientContext) {
|
|
|
65
66
|
},
|
|
66
67
|
});
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
const stopUsagePills = contributePills(client);
|
|
70
|
+
const stopAttentionPills = contributeAttentionPills(client);
|
|
71
|
+
return () => {
|
|
72
|
+
stopUsagePills();
|
|
73
|
+
stopAttentionPills();
|
|
74
|
+
};
|
|
69
75
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koinzhang/paseo-plugin-activity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Local usage analytics and workspace agent ops for Paseo: tools, agents, messages, models, Explorer fleet list, and terminals.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"typecheck": "tsc --noEmit",
|
|
25
|
-
"test": "node --experimental-strip-types --test server/background-sync.test.ts server/handlers-query.test.ts client/pill-data-cache.test.ts client/pill-directory.test.ts client/hidden-pill-recheck.test.ts client/workspace/list-host-agents.test.ts client/workspace/status-cache.test.ts client/rank-color.test.ts client/provider-filter.test.ts client/workspace/terminal-preview.test.ts shared/activity.test.ts shared/insights.test.ts shared/classify.test.ts shared/usage.test.ts shared/format.test.ts shared/agent-title-search.test.ts shared/list-agent-pages.test.ts shared/agent-page-size.test.ts server/store.test.ts server/ingest.test.ts server/skill-path.test.ts server/mcp-servers.test.ts server/agents.test.ts server/migrate-data.test.ts server/messages.test.ts server/resolve-model.test.ts"
|
|
25
|
+
"test": "node --experimental-strip-types --test server/background-sync.test.ts server/handlers-query.test.ts client/attention-agents.test.ts client/latest-user-message.test.ts client/pill-data-cache.test.ts client/pill-directory.test.ts client/hidden-pill-recheck.test.ts client/workspace/list-host-agents.test.ts client/workspace/status-cache.test.ts client/workspace/constants.test.ts client/workspace/filters.test.ts client/rank-color.test.ts client/provider-filter.test.ts client/workspace/terminal-preview.test.ts shared/activity.test.ts shared/insights.test.ts shared/classify.test.ts shared/usage.test.ts shared/format.test.ts shared/agent-title-search.test.ts shared/list-agent-pages.test.ts shared/agent-page-size.test.ts server/store.test.ts server/ingest.test.ts server/skill-path.test.ts server/mcp-servers.test.ts server/agents.test.ts server/migrate-data.test.ts server/messages.test.ts server/resolve-model.test.ts"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@getpaseo/plugin": "0.8.0",
|
|
@@ -9,7 +9,7 @@ export const explorerAgentDisplaySettings = defineSettings({
|
|
|
9
9
|
schema: z.object({
|
|
10
10
|
sort: z.enum(["created", "updated", "name", "messages", "status"]).default("updated"),
|
|
11
11
|
group: z.enum(["none", "provider", "status"]).default("none"),
|
|
12
|
-
show: z.array(z.enum(["provider", "calls", "messages", "updated"])).default([]),
|
|
12
|
+
show: z.array(z.enum(["provider", "calls", "messages", "updated", "prompt"])).default([]),
|
|
13
13
|
status: z.array(z.enum(["active", "archived"])).default(["active"]),
|
|
14
14
|
lifecycle: z
|
|
15
15
|
.array(z.enum(["idle", "running", "error", "closed"]))
|
package/shared/usage.test.ts
CHANGED
|
@@ -870,6 +870,7 @@ describe("aggregateAgents (024)", () => {
|
|
|
870
870
|
createdAt: "2026-09-18T00:00:00.000Z",
|
|
871
871
|
},
|
|
872
872
|
{ agentId: "a3", provider: "codex", title: "Idle", createdAt: "2026-09-19T00:00:00.000Z", updatedAt: "2026-09-19T02:00:00.000Z", archivedAt: "2026-09-19T01:00:00.000Z" },
|
|
873
|
+
{ agentId: "a4", provider: "codex", title: "Child", createdAt: "2026-09-19T03:00:00.000Z", parentAgentId: "a1" },
|
|
873
874
|
],
|
|
874
875
|
[
|
|
875
876
|
{ agentId: "a1", provider: "claude/opus", ts: "2026-09-18T05:00:00.000Z" },
|
|
@@ -880,7 +881,7 @@ describe("aggregateAgents (024)", () => {
|
|
|
880
881
|
|
|
881
882
|
assert.deepEqual(
|
|
882
883
|
items.map((item) => item.agentId),
|
|
883
|
-
["a1", "a2", "a3"],
|
|
884
|
+
["a1", "a2", "a4", "a3"],
|
|
884
885
|
);
|
|
885
886
|
|
|
886
887
|
const a1 = items[0]!;
|
|
@@ -896,6 +897,7 @@ describe("aggregateAgents (024)", () => {
|
|
|
896
897
|
assert.equal(a1.messageCount, 2);
|
|
897
898
|
assert.equal(a1.archivedAt, null);
|
|
898
899
|
assert.equal(a1.updatedAt, null);
|
|
900
|
+
assert.equal(a1.parentAgentId, null);
|
|
899
901
|
assert.equal(a1.lastActivityAt, "2026-09-18T06:00:00.000Z");
|
|
900
902
|
|
|
901
903
|
const a2 = items[1]!;
|
|
@@ -904,7 +906,11 @@ describe("aggregateAgents (024)", () => {
|
|
|
904
906
|
assert.equal(a2.messageCount, 1);
|
|
905
907
|
assert.equal(a2.lastActivityAt, "2026-09-18T00:00:00.000Z");
|
|
906
908
|
|
|
907
|
-
const
|
|
909
|
+
const a4 = items[2]!;
|
|
910
|
+
assert.equal(a4.parentAgentId, "a1");
|
|
911
|
+
assert.equal(a4.title, "Child");
|
|
912
|
+
|
|
913
|
+
const a3 = items[3]!;
|
|
908
914
|
assert.equal(a3.callCount, 0);
|
|
909
915
|
assert.equal(a3.messageCount, 0);
|
|
910
916
|
assert.equal(a3.title, "Idle");
|
package/shared/usage.ts
CHANGED
|
@@ -227,6 +227,8 @@ export const AgentUsageItemSchema = z.object({
|
|
|
227
227
|
updatedAt: z.string().nullable(),
|
|
228
228
|
/** Registry archive time; null for active agents (025). */
|
|
229
229
|
archivedAt: z.string().nullable(),
|
|
230
|
+
/** Registry parent session; null for top-level agents (041). */
|
|
231
|
+
parentAgentId: z.string().nullable(),
|
|
230
232
|
/** Latest tool call / message time in the window. */
|
|
231
233
|
lastActivityAt: z.string().nullable(),
|
|
232
234
|
});
|
|
@@ -666,6 +668,7 @@ export function aggregateAgents(
|
|
|
666
668
|
createdAt?: string | null;
|
|
667
669
|
updatedAt?: string | null;
|
|
668
670
|
archivedAt?: string | null;
|
|
671
|
+
parentAgentId?: string | null;
|
|
669
672
|
}> = [],
|
|
670
673
|
messages: ReadonlyArray<{
|
|
671
674
|
agentId?: string;
|
|
@@ -694,6 +697,7 @@ export function aggregateAgents(
|
|
|
694
697
|
createdAt: null,
|
|
695
698
|
updatedAt: null,
|
|
696
699
|
archivedAt: null,
|
|
700
|
+
parentAgentId: null,
|
|
697
701
|
lastActivityAt: null,
|
|
698
702
|
};
|
|
699
703
|
map.set(agentId, acc);
|
|
@@ -726,6 +730,9 @@ export function aggregateAgents(
|
|
|
726
730
|
acc.createdAt = agent.createdAt ?? acc.createdAt;
|
|
727
731
|
acc.updatedAt = agent.updatedAt ?? acc.updatedAt;
|
|
728
732
|
acc.archivedAt = agent.archivedAt ?? acc.archivedAt;
|
|
733
|
+
if (agent.parentAgentId !== undefined) {
|
|
734
|
+
acc.parentAgentId = agent.parentAgentId?.trim() || null;
|
|
735
|
+
}
|
|
729
736
|
}
|
|
730
737
|
|
|
731
738
|
for (const message of messages) {
|