litepaseo 0.6.10 → 0.7.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 +12 -0
- package/README.md +1 -0
- package/dist/server/cli.mjs +2 -2
- package/dist/server/{worker-Me9ldg6T.mjs → worker-BukTqbku.mjs} +378 -34
- package/dist/web/assets/{ChangesPanel-D3XpN436.js → ChangesPanel-WZtdWFbk.js} +1 -1
- package/dist/web/assets/ChangesPanel-WZtdWFbk.js.br +0 -0
- package/dist/web/assets/ChangesPanel-WZtdWFbk.js.gz +0 -0
- package/dist/web/assets/{CodeBlockNode-D8F6zQgk.js → CodeBlockNode-rKqd-WqK.js} +1 -1
- package/dist/web/assets/CodeBlockNode-rKqd-WqK.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-rKqd-WqK.js.gz +0 -0
- package/dist/web/assets/{ConversationSearch-BMNiCtSS.js → ConversationSearch-CbqYssuv.js} +1 -1
- package/dist/web/assets/ConversationSearch-CbqYssuv.js.br +0 -0
- package/dist/web/assets/ConversationSearch-CbqYssuv.js.gz +0 -0
- package/dist/web/assets/FileViewer-D6YYBJZ0.js +2 -0
- package/dist/web/assets/FileViewer-D6YYBJZ0.js.br +0 -0
- package/dist/web/assets/FileViewer-D6YYBJZ0.js.gz +0 -0
- package/dist/web/assets/{FilesPanel-CNJecYXl.js → FilesPanel-DMX94r00.js} +1 -1
- package/dist/web/assets/FilesPanel-DMX94r00.js.br +0 -0
- package/dist/web/assets/FilesPanel-DMX94r00.js.gz +0 -0
- package/dist/web/assets/{HostSettings-CjknY2nh.js → HostSettings-Bc3eD3s-.js} +1 -1
- package/dist/web/assets/HostSettings-Bc3eD3s-.js.br +0 -0
- package/dist/web/assets/HostSettings-Bc3eD3s-.js.gz +0 -0
- package/dist/web/assets/{MarkdownMessage-BTnRPXEx.js → MarkdownMessage-DGcQKbep.js} +5 -5
- package/dist/web/assets/MarkdownMessage-DGcQKbep.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-DGcQKbep.js.gz +0 -0
- package/dist/web/assets/{PreCodeBlock-Cd0F6YiY.js → PreCodeBlock-xTjom-kH.js} +1 -1
- package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-Du6tIbu2.js → PreCodeBlock.vue_vue_type_style_index_0_lang-Dzttv6iZ.js} +1 -1
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-Dzttv6iZ.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-Dzttv6iZ.js.gz +0 -0
- package/dist/web/assets/SubagentsPanel-DTcCI_DQ.js +1 -0
- package/dist/web/assets/SubagentsPanel-DTcCI_DQ.js.br +0 -0
- package/dist/web/assets/SubagentsPanel-DTcCI_DQ.js.gz +0 -0
- package/dist/web/assets/SubagentsPanel-iAwY_tlt.css +1 -0
- package/dist/web/assets/SubagentsPanel-iAwY_tlt.css.br +0 -0
- package/dist/web/assets/SubagentsPanel-iAwY_tlt.css.gz +0 -0
- package/dist/web/assets/TerminalPanel-BNdtJ-y_.js +3 -0
- package/dist/web/assets/TerminalPanel-BNdtJ-y_.js.br +0 -0
- package/dist/web/assets/TerminalPanel-BNdtJ-y_.js.gz +0 -0
- package/dist/web/assets/{Tooltip-B-DtbdU1.js → Tooltip-BeNCcixK.js} +1 -1
- package/dist/web/assets/Tooltip-BeNCcixK.js.br +0 -0
- package/dist/web/assets/Tooltip-BeNCcixK.js.gz +0 -0
- package/dist/web/assets/index-CwWokVo4.css +1 -0
- package/dist/web/assets/index-CwWokVo4.css.br +0 -0
- package/dist/web/assets/index-CwWokVo4.css.gz +0 -0
- package/dist/web/assets/index-nfa24YSg.js +35 -0
- package/dist/web/assets/index-nfa24YSg.js.br +0 -0
- package/dist/web/assets/index-nfa24YSg.js.gz +0 -0
- package/dist/web/assets/{index10-DRVKIMQH.js → index10-BpCRUSr5.js} +1 -1
- package/dist/web/assets/index10-BpCRUSr5.js.br +0 -0
- package/dist/web/assets/index10-BpCRUSr5.js.gz +0 -0
- package/dist/web/assets/index3-DAA5Yfzv.js +1 -0
- package/dist/web/assets/index4-CSII86qY.js +1 -0
- package/dist/web/assets/{index5-DDmDNhzo.js → index5-Dn6SW1w1.js} +1 -1
- package/dist/web/assets/index5-Dn6SW1w1.js.br +0 -0
- package/dist/web/assets/index5-Dn6SW1w1.js.gz +0 -0
- package/dist/web/assets/{index6-DnWy7x4q.js → index6-D7kP2B_r.js} +1 -1
- package/dist/web/assets/index6-D7kP2B_r.js.br +0 -0
- package/dist/web/assets/index6-D7kP2B_r.js.gz +0 -0
- package/dist/web/assets/{index7-DRc4OYpN.js → index7-DCUfGg3z.js} +1 -1
- package/dist/web/assets/index7-DCUfGg3z.js.br +0 -0
- package/dist/web/assets/index7-DCUfGg3z.js.gz +0 -0
- package/dist/web/assets/{index8-C6iteoBo.js → index8-BQD8uBPh.js} +1 -1
- package/dist/web/assets/index8-BQD8uBPh.js.br +0 -0
- package/dist/web/assets/index8-BQD8uBPh.js.gz +0 -0
- package/dist/web/assets/{index9-IjfVbxVZ.js → index9-Cdnig-PT.js} +1 -1
- package/dist/web/assets/index9-Cdnig-PT.js.br +0 -0
- package/dist/web/assets/index9-Cdnig-PT.js.gz +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/package.json +1 -1
- package/dist/web/assets/ChangesPanel-D3XpN436.js.br +0 -0
- package/dist/web/assets/ChangesPanel-D3XpN436.js.gz +0 -0
- package/dist/web/assets/CodeBlockNode-D8F6zQgk.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-D8F6zQgk.js.gz +0 -0
- package/dist/web/assets/ConversationSearch-BMNiCtSS.js.br +0 -0
- package/dist/web/assets/ConversationSearch-BMNiCtSS.js.gz +0 -0
- package/dist/web/assets/FileViewer-C6hkUeY1.js +0 -2
- package/dist/web/assets/FileViewer-C6hkUeY1.js.br +0 -0
- package/dist/web/assets/FileViewer-C6hkUeY1.js.gz +0 -0
- package/dist/web/assets/FilesPanel-CNJecYXl.js.br +0 -0
- package/dist/web/assets/FilesPanel-CNJecYXl.js.gz +0 -0
- package/dist/web/assets/HostSettings-CjknY2nh.js.br +0 -0
- package/dist/web/assets/HostSettings-CjknY2nh.js.gz +0 -0
- package/dist/web/assets/MarkdownMessage-BTnRPXEx.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-BTnRPXEx.js.gz +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-Du6tIbu2.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-Du6tIbu2.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-CDi8FolM.js +0 -3
- package/dist/web/assets/TerminalPanel-CDi8FolM.js.br +0 -0
- package/dist/web/assets/TerminalPanel-CDi8FolM.js.gz +0 -0
- package/dist/web/assets/Tooltip-B-DtbdU1.js.br +0 -0
- package/dist/web/assets/Tooltip-B-DtbdU1.js.gz +0 -0
- package/dist/web/assets/index-CHx1Vepn.css +0 -1
- package/dist/web/assets/index-CHx1Vepn.css.br +0 -0
- package/dist/web/assets/index-CHx1Vepn.css.gz +0 -0
- package/dist/web/assets/index-qGA8AH70.js +0 -35
- package/dist/web/assets/index-qGA8AH70.js.br +0 -0
- package/dist/web/assets/index-qGA8AH70.js.gz +0 -0
- package/dist/web/assets/index10-DRVKIMQH.js.br +0 -0
- package/dist/web/assets/index10-DRVKIMQH.js.gz +0 -0
- package/dist/web/assets/index3-D8Ye4CZN.js +0 -1
- package/dist/web/assets/index4-CztXd0ac.js +0 -1
- package/dist/web/assets/index5-DDmDNhzo.js.br +0 -0
- package/dist/web/assets/index5-DDmDNhzo.js.gz +0 -0
- package/dist/web/assets/index6-DnWy7x4q.js.br +0 -0
- package/dist/web/assets/index6-DnWy7x4q.js.gz +0 -0
- package/dist/web/assets/index7-DRc4OYpN.js.br +0 -0
- package/dist/web/assets/index7-DRc4OYpN.js.gz +0 -0
- package/dist/web/assets/index8-C6iteoBo.js.br +0 -0
- package/dist/web/assets/index8-C6iteoBo.js.gz +0 -0
- package/dist/web/assets/index9-IjfVbxVZ.js.br +0 -0
- package/dist/web/assets/index9-IjfVbxVZ.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
- Show an agent's subagents in its conversation, as the official Paseo app does. A header button sums them up (for example "3 subagents", "1 working", "1 needs input") and opens a Subagents panel that lists agents it delegated through Paseo and subagents its provider runs (Claude Task, Codex, pi-subagents and others), with live status.
|
|
6
|
+
- Open a provider subagent's conversation in the panel, read-only and live, with earlier messages on request. A subagent tool call in the conversation also gets an Open button.
|
|
7
|
+
- Open a delegated agent from the panel; its header links back to the parent agent. The sidebar is unchanged.
|
|
8
|
+
- The subagent list travels on the conversation's existing stream, so opening a chat needs no extra connection. LitePaseo follows the daemon's subagent events only while a conversation is open, plus 30 seconds.
|
|
9
|
+
|
|
10
|
+
## 0.6.11
|
|
11
|
+
|
|
12
|
+
- Hold pushes briefly while you are using LitePaseo on another device: a finished turn waits 45 seconds, an input request or failure 20 seconds, and a conversation you open in that time is not pushed to your other devices. A browser counts as in use while it is in the foreground with keyboard, pointer or touch input in the last 2 minutes; with nobody at a device, pushes go out at once as before.
|
|
13
|
+
- A conversation opened only briefly, then left, also counts as seen for later pushes.
|
|
14
|
+
|
|
3
15
|
## 0.6.10
|
|
4
16
|
|
|
5
17
|
- Merge push notifications per project on the server, so iPhones benefit too: 0.6.9 merged them in the service worker, which iOS does not support. Finished turns send at most one push per project every 2 minutes; turns finishing during that time go out together when it ends (for example "repo · 3 finished", newest first). Input requests and failed turns still notify immediately, listing the project's other unseen updates too.
|
package/README.md
CHANGED
|
@@ -52,6 +52,7 @@ package, with no separate database service to deploy.
|
|
|
52
52
|
interrupt; rewind a conversation (and, where the provider supports it, its files)
|
|
53
53
|
to an earlier message.
|
|
54
54
|
- Review workspace uncommitted changes in a read-only diff panel, including file paths and addition/deletion counts.
|
|
55
|
+
- See an agent's subagents from its conversation: agents it delegated through Paseo, and subagents its provider runs (Claude Task, Codex, pi-subagents and others), with live status and their conversations, read-only. A delegated agent links back to its parent.
|
|
55
56
|
- Click file links in agent messages to open the file in a tab, scrolled to the linked lines; directory links open the Files panel. Paths LitePaseo cannot open are copied instead of leading to a missing page.
|
|
56
57
|
- Search user and agent messages across the full conversation history and jump to matches.
|
|
57
58
|
- Pause, resume and reorder queued messages; check uncertain delivery without resending. Sidebar queue indicators stay synchronized across devices.
|
package/dist/server/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
// src/server/version.ts
|
|
11
|
-
const VERSION = "0.
|
|
11
|
+
const VERSION = "0.7.0";
|
|
12
12
|
// src/server/rotating-log.ts
|
|
13
13
|
/** One writer (the supervisor); bounded active file plus numbered archives. */
|
|
14
14
|
var RotatingLog = class {
|
|
@@ -1715,7 +1715,7 @@ async function run() {
|
|
|
1715
1715
|
if (name === "--help" || name === "-h") return console.log(mainHelp(VERSION, displayDirectory(), out));
|
|
1716
1716
|
if (name === "worker") {
|
|
1717
1717
|
const paths = await dataDirectory();
|
|
1718
|
-
const { runWorker } = await import("./worker-
|
|
1718
|
+
const { runWorker } = await import("./worker-BukTqbku.mjs");
|
|
1719
1719
|
return runWorker(paths.directory, fileURLToPath(new URL("../web/", import.meta.url)));
|
|
1720
1720
|
}
|
|
1721
1721
|
const command = findCommand(name);
|
|
@@ -7,6 +7,7 @@ import { serve } from "@hono/node-server";
|
|
|
7
7
|
import { createHostClient, parseHostTarget } from "@getpaseo/client/node";
|
|
8
8
|
import { createPaseoApi } from "@getpaseo/client";
|
|
9
9
|
import { deriveAgentStateBucket } from "@getpaseo/protocol/agent-state-bucket";
|
|
10
|
+
import { getParentAgentIdFromLabels } from "@getpaseo/protocol/agent-labels";
|
|
10
11
|
import { timelineItemIdentity } from "@getpaseo/protocol/timeline-identity";
|
|
11
12
|
import { z } from "zod";
|
|
12
13
|
import { AgentPermissionResponseSchema, AgentSkillSelectionSchema, MutableDaemonConfigPatchSchema } from "@getpaseo/protocol/messages";
|
|
@@ -415,6 +416,7 @@ function summarize(hostId, agent, project, activity = time(agent.updatedAt)) {
|
|
|
415
416
|
});
|
|
416
417
|
const state = agent.status === "initializing" && bucket === "done" ? "running" : bucket === "attention" ? "unread" : bucket;
|
|
417
418
|
const turnActive = isRunning(agent) || agent.status === "initializing";
|
|
419
|
+
const parentAgentId = getParentAgentIdFromLabels(agent.labels);
|
|
418
420
|
return {
|
|
419
421
|
key: `${hostId}:${agent.id}`,
|
|
420
422
|
hostId,
|
|
@@ -440,7 +442,8 @@ function summarize(hostId, agent, project, activity = time(agent.updatedAt)) {
|
|
|
440
442
|
modeId: agent.currentModeId ?? null,
|
|
441
443
|
contextUsed: agent.lastUsage?.contextWindowUsedTokens ?? null,
|
|
442
444
|
contextMax: agent.lastUsage?.contextWindowMaxTokens ?? null,
|
|
443
|
-
rewind: rewindModes(agent.capabilities)
|
|
445
|
+
rewind: rewindModes(agent.capabilities),
|
|
446
|
+
...parentAgentId ? { parentAgentId } : {}
|
|
444
447
|
};
|
|
445
448
|
}
|
|
446
449
|
/** The rewind modes a provider supports, in Paseo's menu order. */
|
|
@@ -605,7 +608,7 @@ const KEEP_ROWS = 500;
|
|
|
605
608
|
/** Rows sent to a client that (re)joins; older ones load on demand. */
|
|
606
609
|
const RESET_ROWS = 200;
|
|
607
610
|
const MAX_BUFFER = 5e3;
|
|
608
|
-
const FLUSH_MS = 500;
|
|
611
|
+
const FLUSH_MS$1 = 500;
|
|
609
612
|
const RETRY_MS = 2e3;
|
|
610
613
|
const now = () => performance.now();
|
|
611
614
|
/** Same fold the daemon's TimelineProjection applies when a tool call reports again. */
|
|
@@ -982,7 +985,7 @@ var TimelineView = class {
|
|
|
982
985
|
}
|
|
983
986
|
scheduleFlush() {
|
|
984
987
|
if (this.flushTimer || !this.watchers.size) return;
|
|
985
|
-
this.flushTimer = setTimeout(() => this.flush(), FLUSH_MS);
|
|
988
|
+
this.flushTimer = setTimeout(() => this.flush(), FLUSH_MS$1);
|
|
986
989
|
}
|
|
987
990
|
flush() {
|
|
988
991
|
clearTimeout(this.flushTimer);
|
|
@@ -1054,6 +1057,231 @@ var TimelineView = class {
|
|
|
1054
1057
|
for (const watcher of this.watchers) watcher(ops);
|
|
1055
1058
|
}
|
|
1056
1059
|
};
|
|
1060
|
+
// src/server/subagents.ts
|
|
1061
|
+
const UPDATE = "agent.provider_subagents.update";
|
|
1062
|
+
/** Released this long after the last watcher leaves, so switching conversations keeps it. */
|
|
1063
|
+
const GRACE_MS = 3e4;
|
|
1064
|
+
/** Status changes are batched like timeline renders. */
|
|
1065
|
+
const FLUSH_MS = 500;
|
|
1066
|
+
const LIST_TIMEOUT_MS = 15e3;
|
|
1067
|
+
const publish = (d) => ({
|
|
1068
|
+
id: d.id,
|
|
1069
|
+
parentSubagentId: d.parentSubagentId ?? null,
|
|
1070
|
+
provider: d.provider,
|
|
1071
|
+
title: d.title,
|
|
1072
|
+
description: d.description,
|
|
1073
|
+
subtitle: d.subtitle ?? null,
|
|
1074
|
+
status: d.status,
|
|
1075
|
+
createdAt: d.createdAt,
|
|
1076
|
+
updatedAt: d.updatedAt,
|
|
1077
|
+
toolCallId: d.toolCallId
|
|
1078
|
+
});
|
|
1079
|
+
/**
|
|
1080
|
+
* The subagents providers run inside agents of one host (Claude Task, Codex, pi-subagents…),
|
|
1081
|
+
* as Paseo's daemon tracks them. One event subscription per host serves every watched parent
|
|
1082
|
+
* and every open subagent conversation; it is held only while someone watches.
|
|
1083
|
+
*/
|
|
1084
|
+
var HostSubagents = class {
|
|
1085
|
+
parents = /* @__PURE__ */ new Map();
|
|
1086
|
+
timelines = /* @__PURE__ */ new Map();
|
|
1087
|
+
events = null;
|
|
1088
|
+
stopEvents = null;
|
|
1089
|
+
snapshots = 0;
|
|
1090
|
+
users = 0;
|
|
1091
|
+
idle;
|
|
1092
|
+
driver;
|
|
1093
|
+
constructor(driver) {
|
|
1094
|
+
this.driver = driver;
|
|
1095
|
+
}
|
|
1096
|
+
/** Calls `listener` with the parent's subagents once known and on every change. */
|
|
1097
|
+
watch(parentAgentId, listener) {
|
|
1098
|
+
this.acquire();
|
|
1099
|
+
let parent = this.parents.get(parentAgentId);
|
|
1100
|
+
if (!parent) {
|
|
1101
|
+
parent = {
|
|
1102
|
+
subagents: /* @__PURE__ */ new Map(),
|
|
1103
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
1104
|
+
during: null,
|
|
1105
|
+
token: 0
|
|
1106
|
+
};
|
|
1107
|
+
this.parents.set(parentAgentId, parent);
|
|
1108
|
+
parent.listeners.add(listener);
|
|
1109
|
+
this.load(parentAgentId, parent);
|
|
1110
|
+
} else {
|
|
1111
|
+
parent.listeners.add(listener);
|
|
1112
|
+
if (!parent.during) listener(this.list(parent));
|
|
1113
|
+
}
|
|
1114
|
+
const current = parent;
|
|
1115
|
+
let stopped = false;
|
|
1116
|
+
return () => {
|
|
1117
|
+
if (stopped) return;
|
|
1118
|
+
stopped = true;
|
|
1119
|
+
current.listeners.delete(listener);
|
|
1120
|
+
if (!current.listeners.size && this.parents.get(parentAgentId) === current) {
|
|
1121
|
+
clearTimeout(current.timer);
|
|
1122
|
+
current.token++;
|
|
1123
|
+
this.parents.delete(parentAgentId);
|
|
1124
|
+
}
|
|
1125
|
+
this.releaseUse();
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
/** A TimelineView driver for one subagent conversation. */
|
|
1129
|
+
timelineDriver(parentAgentId, subagentId) {
|
|
1130
|
+
const key = `${parentAgentId}\0${subagentId}`;
|
|
1131
|
+
return {
|
|
1132
|
+
subscribeAgentTimeline: (_agentId, handler) => {
|
|
1133
|
+
this.acquire();
|
|
1134
|
+
let handlers = this.timelines.get(key);
|
|
1135
|
+
if (!handlers) this.timelines.set(key, handlers = /* @__PURE__ */ new Set());
|
|
1136
|
+
handlers.add(handler);
|
|
1137
|
+
let released = false;
|
|
1138
|
+
const release = async () => {
|
|
1139
|
+
if (released) return;
|
|
1140
|
+
released = true;
|
|
1141
|
+
handlers.delete(handler);
|
|
1142
|
+
if (!handlers.size && this.timelines.get(key) === handlers) this.timelines.delete(key);
|
|
1143
|
+
this.releaseUse();
|
|
1144
|
+
};
|
|
1145
|
+
const ready = this.events.ready.then(() => void 0);
|
|
1146
|
+
return Object.assign(() => void release(), {
|
|
1147
|
+
ready,
|
|
1148
|
+
release
|
|
1149
|
+
});
|
|
1150
|
+
},
|
|
1151
|
+
fetchAgentTimeline: async (_agentId, options) => {
|
|
1152
|
+
const page = await this.driver.fetchProviderSubagentTimeline(parentAgentId, subagentId, {
|
|
1153
|
+
direction: options.direction,
|
|
1154
|
+
...options.cursor ? { cursor: options.cursor } : {},
|
|
1155
|
+
...typeof options.limit === "number" ? { limit: options.limit } : {},
|
|
1156
|
+
timeout: LIST_TIMEOUT_MS
|
|
1157
|
+
});
|
|
1158
|
+
return {
|
|
1159
|
+
epoch: page.epoch,
|
|
1160
|
+
reset: page.reset,
|
|
1161
|
+
window: page.window,
|
|
1162
|
+
startCursor: page.startCursor ?? null,
|
|
1163
|
+
endCursor: page.endCursor ?? null,
|
|
1164
|
+
hasOlder: page.hasOlder,
|
|
1165
|
+
hasNewer: page.hasNewer,
|
|
1166
|
+
entries: page.rows.map((row) => ({
|
|
1167
|
+
provider: page.provider ?? "",
|
|
1168
|
+
item: row.item,
|
|
1169
|
+
timestamp: row.timestamp,
|
|
1170
|
+
seqStart: row.seqStart ?? row.seq,
|
|
1171
|
+
seqEnd: row.seqEnd ?? row.seq
|
|
1172
|
+
}))
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
async dispose() {
|
|
1178
|
+
clearTimeout(this.idle);
|
|
1179
|
+
for (const parent of this.parents.values()) clearTimeout(parent.timer);
|
|
1180
|
+
this.parents.clear();
|
|
1181
|
+
this.timelines.clear();
|
|
1182
|
+
await this.close();
|
|
1183
|
+
}
|
|
1184
|
+
acquire() {
|
|
1185
|
+
if (!this.events) this.subscribe();
|
|
1186
|
+
this.users++;
|
|
1187
|
+
clearTimeout(this.idle);
|
|
1188
|
+
this.idle = void 0;
|
|
1189
|
+
}
|
|
1190
|
+
subscribe() {
|
|
1191
|
+
this.snapshots = 0;
|
|
1192
|
+
this.stopEvents = this.driver.on(UPDATE, (message) => this.receive(message.payload));
|
|
1193
|
+
const events = this.events = this.driver.observeEvents([UPDATE]);
|
|
1194
|
+
events.subscribe({
|
|
1195
|
+
snapshot: () => {
|
|
1196
|
+
if (this.events === events && this.snapshots++ > 0) this.restored();
|
|
1197
|
+
},
|
|
1198
|
+
update() {},
|
|
1199
|
+
error() {}
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
releaseUse() {
|
|
1203
|
+
if (--this.users > 0) return;
|
|
1204
|
+
this.users = 0;
|
|
1205
|
+
clearTimeout(this.idle);
|
|
1206
|
+
this.idle = setTimeout(() => {
|
|
1207
|
+
if (!this.users) this.close();
|
|
1208
|
+
}, GRACE_MS);
|
|
1209
|
+
this.idle.unref?.();
|
|
1210
|
+
}
|
|
1211
|
+
async close() {
|
|
1212
|
+
this.stopEvents?.();
|
|
1213
|
+
this.stopEvents = null;
|
|
1214
|
+
const events = this.events;
|
|
1215
|
+
this.events = null;
|
|
1216
|
+
await events?.release().catch(() => {});
|
|
1217
|
+
}
|
|
1218
|
+
restored() {
|
|
1219
|
+
for (const [id, parent] of this.parents) this.load(id, parent);
|
|
1220
|
+
for (const handlers of this.timelines.values()) for (const handler of handlers) handler({ type: "agent.timeline.subscription_restored" });
|
|
1221
|
+
}
|
|
1222
|
+
async load(parentAgentId, parent) {
|
|
1223
|
+
const token = ++parent.token;
|
|
1224
|
+
parent.during = /* @__PURE__ */ new Map();
|
|
1225
|
+
let listed = [];
|
|
1226
|
+
try {
|
|
1227
|
+
listed = (await this.driver.listProviderSubagents(parentAgentId, { timeout: LIST_TIMEOUT_MS })).subagents;
|
|
1228
|
+
} catch {
|
|
1229
|
+
if (token !== parent.token) return;
|
|
1230
|
+
listed = [...parent.subagents.values()];
|
|
1231
|
+
}
|
|
1232
|
+
if (token !== parent.token || this.parents.get(parentAgentId) !== parent) return;
|
|
1233
|
+
const next = new Map(listed.map((d) => [d.id, d]));
|
|
1234
|
+
for (const [id, change] of parent.during) if (change === null) next.delete(id);
|
|
1235
|
+
else if ((next.get(id)?.updatedAt ?? "") <= change.updatedAt) next.set(id, change);
|
|
1236
|
+
parent.subagents = next;
|
|
1237
|
+
parent.during = null;
|
|
1238
|
+
this.flush(parent);
|
|
1239
|
+
}
|
|
1240
|
+
receive(payload) {
|
|
1241
|
+
if (payload.kind === "timeline") {
|
|
1242
|
+
const handlers = this.timelines.get(`${payload.parentAgentId}\0${payload.subagentId}`);
|
|
1243
|
+
if (!handlers) return;
|
|
1244
|
+
const message = {
|
|
1245
|
+
type: "agent_stream",
|
|
1246
|
+
payload: {
|
|
1247
|
+
agentId: payload.subagentId,
|
|
1248
|
+
event: {
|
|
1249
|
+
type: "timeline",
|
|
1250
|
+
provider: payload.provider,
|
|
1251
|
+
item: payload.item
|
|
1252
|
+
},
|
|
1253
|
+
timestamp: payload.timestamp,
|
|
1254
|
+
seq: payload.seq,
|
|
1255
|
+
epoch: payload.epoch
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
for (const handler of handlers) handler(message);
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
const parentId = payload.kind === "upsert" ? payload.subagent.parentAgentId : payload.parentAgentId;
|
|
1262
|
+
const parent = this.parents.get(parentId);
|
|
1263
|
+
if (!parent) return;
|
|
1264
|
+
if (payload.kind === "upsert") {
|
|
1265
|
+
parent.subagents.set(payload.subagent.id, payload.subagent);
|
|
1266
|
+
parent.during?.set(payload.subagent.id, payload.subagent);
|
|
1267
|
+
} else {
|
|
1268
|
+
parent.subagents.delete(payload.subagentId);
|
|
1269
|
+
parent.during?.set(payload.subagentId, null);
|
|
1270
|
+
}
|
|
1271
|
+
if (parent.during || parent.timer) return;
|
|
1272
|
+
parent.timer = setTimeout(() => this.flush(parent), FLUSH_MS);
|
|
1273
|
+
parent.timer.unref?.();
|
|
1274
|
+
}
|
|
1275
|
+
flush(parent) {
|
|
1276
|
+
clearTimeout(parent.timer);
|
|
1277
|
+
parent.timer = void 0;
|
|
1278
|
+
const list = this.list(parent);
|
|
1279
|
+
for (const listener of parent.listeners) listener(list);
|
|
1280
|
+
}
|
|
1281
|
+
list(parent) {
|
|
1282
|
+
return [...parent.subagents.values()].sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id)).map(publish);
|
|
1283
|
+
}
|
|
1284
|
+
};
|
|
1057
1285
|
// src/server/hosts.ts
|
|
1058
1286
|
var UnknownHostError = class extends Error {
|
|
1059
1287
|
constructor() {
|
|
@@ -1121,11 +1349,13 @@ var Hosts = class {
|
|
|
1121
1349
|
};
|
|
1122
1350
|
const stopStatus = driver.subscribeConnectionStatus(update);
|
|
1123
1351
|
update(driver.getConnectionState());
|
|
1352
|
+
const subagents = new HostSubagents(driver);
|
|
1124
1353
|
this.clients.set(hostId, {
|
|
1125
1354
|
driver,
|
|
1126
1355
|
api,
|
|
1127
1356
|
directory,
|
|
1128
1357
|
workspaces,
|
|
1358
|
+
subagents,
|
|
1129
1359
|
stopStatus
|
|
1130
1360
|
});
|
|
1131
1361
|
directory.start();
|
|
@@ -1169,7 +1399,8 @@ var Hosts = class {
|
|
|
1169
1399
|
await Promise.all([
|
|
1170
1400
|
...releases,
|
|
1171
1401
|
c.directory.dispose(),
|
|
1172
|
-
c.workspaces.dispose()
|
|
1402
|
+
c.workspaces.dispose(),
|
|
1403
|
+
c.subagents.dispose()
|
|
1173
1404
|
]);
|
|
1174
1405
|
c.stopStatus();
|
|
1175
1406
|
await c.api.dispose();
|
|
@@ -1205,19 +1436,27 @@ var Hosts = class {
|
|
|
1205
1436
|
this.hostListeners.add(listener);
|
|
1206
1437
|
return () => this.hostListeners.delete(listener);
|
|
1207
1438
|
}
|
|
1208
|
-
/**
|
|
1209
|
-
|
|
1439
|
+
/** The provider subagents of one agent, as they change. */
|
|
1440
|
+
watchSubagents(hostId, agentId, listener) {
|
|
1441
|
+
return this.get(hostId).subagents.watch(agentId, listener);
|
|
1442
|
+
}
|
|
1443
|
+
/**
|
|
1444
|
+
* Shares one live timeline per agent across all watching browsers. With `subagentId`, the
|
|
1445
|
+
* conversation of one of the agent's provider subagents.
|
|
1446
|
+
*/
|
|
1447
|
+
watchTimeline(hostId, agentId, watcher, subagentId) {
|
|
1210
1448
|
const client = this.get(hostId);
|
|
1211
|
-
const key = `${hostId}:${agentId}`;
|
|
1449
|
+
const key = subagentId ? `${hostId}:${agentId}:subagent:${subagentId}` : `${hostId}:${agentId}`;
|
|
1212
1450
|
let entry = this.timelines.get(key);
|
|
1213
1451
|
if (!entry) {
|
|
1214
1452
|
const connection = client.driver.getConnectionState().status;
|
|
1215
|
-
const view = new TimelineView(client.driver, agentId, (report) => {
|
|
1453
|
+
const view = new TimelineView(subagentId ? client.subagents.timelineDriver(agentId, subagentId) : client.driver, agentId, (report) => {
|
|
1216
1454
|
if (report.totalMs < SLOW_TIMELINE_MS) return;
|
|
1217
1455
|
console.warn(JSON.stringify({
|
|
1218
1456
|
event: "timeline_slow",
|
|
1219
1457
|
hostId,
|
|
1220
1458
|
agentId,
|
|
1459
|
+
...subagentId ? { subagentId } : {},
|
|
1221
1460
|
connectionAtStart: connection ?? null,
|
|
1222
1461
|
...report
|
|
1223
1462
|
}));
|
|
@@ -1249,32 +1488,62 @@ var Hosts = class {
|
|
|
1249
1488
|
}
|
|
1250
1489
|
};
|
|
1251
1490
|
// src/server/viewing-presence.ts
|
|
1252
|
-
/**
|
|
1491
|
+
/** How long a browser's report lasts without a heartbeat (it sends one every 15 s). */
|
|
1492
|
+
const LEASE_MS = 45e3;
|
|
1493
|
+
/** Last-viewed times older than this are forgotten; held notifications never wait that long. */
|
|
1494
|
+
const VIEWED_TTL_MS = 36e5;
|
|
1495
|
+
/**
|
|
1496
|
+
* Short browser leases, independent of timeline subscriptions and push enrollment. A browser
|
|
1497
|
+
* reports the conversation it shows (`key`) and whether someone is using it (`active`: in the
|
|
1498
|
+
* foreground with recent input), so pushes can wait while the user is at another device.
|
|
1499
|
+
*/
|
|
1253
1500
|
var ViewingPresence = class {
|
|
1254
1501
|
entries = /* @__PURE__ */ new Map();
|
|
1502
|
+
/** When each conversation was last on a foreground screen, for "seen since it finished". */
|
|
1503
|
+
viewed = /* @__PURE__ */ new Map();
|
|
1255
1504
|
validSession;
|
|
1256
1505
|
now;
|
|
1257
1506
|
constructor(validSession, now = Date.now) {
|
|
1258
1507
|
this.validSession = validSession;
|
|
1259
1508
|
this.now = now;
|
|
1260
1509
|
}
|
|
1261
|
-
update(session, tab, seq, key) {
|
|
1510
|
+
update(session, tab, seq, key, active = false) {
|
|
1262
1511
|
this.prune();
|
|
1263
1512
|
const id = `${session}:${tab}`, previous = this.entries.get(id);
|
|
1264
1513
|
if (previous && seq <= previous.seq) return;
|
|
1265
1514
|
this.entries.set(id, {
|
|
1266
1515
|
session,
|
|
1267
1516
|
key,
|
|
1517
|
+
active: active || key !== null,
|
|
1268
1518
|
seq,
|
|
1269
|
-
expires: this.now() +
|
|
1519
|
+
expires: this.now() + LEASE_MS
|
|
1270
1520
|
});
|
|
1521
|
+
if (key) {
|
|
1522
|
+
this.viewed.delete(key);
|
|
1523
|
+
this.viewed.set(key, this.now());
|
|
1524
|
+
}
|
|
1271
1525
|
}
|
|
1272
1526
|
isViewing(key) {
|
|
1273
1527
|
this.prune();
|
|
1274
1528
|
return [...this.entries.values()].some((entry) => entry.key === key);
|
|
1275
1529
|
}
|
|
1530
|
+
/** Someone is using LitePaseo on some device right now. */
|
|
1531
|
+
anyActive() {
|
|
1532
|
+
this.prune();
|
|
1533
|
+
return [...this.entries.values()].some((entry) => entry.active);
|
|
1534
|
+
}
|
|
1535
|
+
/** The conversation was on a foreground screen at or after `at`. */
|
|
1536
|
+
viewedSince(key, at) {
|
|
1537
|
+
if (this.isViewing(key)) return true;
|
|
1538
|
+
return (this.viewed.get(key) ?? -Infinity) >= at;
|
|
1539
|
+
}
|
|
1276
1540
|
prune() {
|
|
1277
|
-
|
|
1541
|
+
const now = this.now();
|
|
1542
|
+
for (const [id, entry] of this.entries) if (entry.expires <= now || !this.validSession(entry.session)) this.entries.delete(id);
|
|
1543
|
+
for (const [key, at] of this.viewed) {
|
|
1544
|
+
if (now - at <= VIEWED_TTL_MS) break;
|
|
1545
|
+
this.viewed.delete(key);
|
|
1546
|
+
}
|
|
1278
1547
|
}
|
|
1279
1548
|
};
|
|
1280
1549
|
// src/server/host-lifecycle.ts
|
|
@@ -2542,6 +2811,16 @@ const STALE_MS = 6e5;
|
|
|
2542
2811
|
* together when it ends. Input requests and failed turns are never held back.
|
|
2543
2812
|
*/
|
|
2544
2813
|
const PROJECT_COOLDOWN_MS = 12e4;
|
|
2814
|
+
/**
|
|
2815
|
+
* While someone is using LitePaseo on any device, pushes wait this long first: a conversation
|
|
2816
|
+
* opened in the meantime is not pushed to the other devices. Finished turns wait longer than
|
|
2817
|
+
* input requests and failures, which hold an agent up.
|
|
2818
|
+
*/
|
|
2819
|
+
const ACTIVE_GRACE_MS = {
|
|
2820
|
+
"turn-done": 45e3,
|
|
2821
|
+
attention: 2e4,
|
|
2822
|
+
"turn-failed": 2e4
|
|
2823
|
+
};
|
|
2545
2824
|
/** A project digest forgets events this old, even if the user never opened them. */
|
|
2546
2825
|
const DIGEST_TTL_MS = 36e5;
|
|
2547
2826
|
/** Lines in a merged notification; phones show about four. */
|
|
@@ -2588,6 +2867,8 @@ var Notifier = class {
|
|
|
2588
2867
|
store;
|
|
2589
2868
|
sender;
|
|
2590
2869
|
isViewing;
|
|
2870
|
+
deviceActive;
|
|
2871
|
+
viewedSince;
|
|
2591
2872
|
hostLabel;
|
|
2592
2873
|
waiting = /* @__PURE__ */ new Set();
|
|
2593
2874
|
recent = /* @__PURE__ */ new Map();
|
|
@@ -2599,6 +2880,8 @@ var Notifier = class {
|
|
|
2599
2880
|
this.store = options.store;
|
|
2600
2881
|
this.sender = options.sender;
|
|
2601
2882
|
this.isViewing = options.isViewing;
|
|
2883
|
+
this.deviceActive = options.deviceActive ?? (() => false);
|
|
2884
|
+
this.viewedSince = options.viewedSince ?? ((key) => options.isViewing(key));
|
|
2602
2885
|
this.hostLabel = options.hostLabel;
|
|
2603
2886
|
this.now = options.now ?? Date.now;
|
|
2604
2887
|
this.schedule = options.schedule ?? ((run, ms) => {
|
|
@@ -2684,42 +2967,52 @@ var Notifier = class {
|
|
|
2684
2967
|
entries: /* @__PURE__ */ new Map(),
|
|
2685
2968
|
lastSent: -Infinity
|
|
2686
2969
|
});
|
|
2970
|
+
const at = this.now();
|
|
2687
2971
|
digest.entries.delete(agent.key);
|
|
2688
2972
|
digest.entries.set(agent.key, {
|
|
2689
2973
|
kind,
|
|
2690
2974
|
agent,
|
|
2691
2975
|
detail: body,
|
|
2692
|
-
at
|
|
2976
|
+
at,
|
|
2977
|
+
due: this.deviceActive() ? at + ACTIVE_GRACE_MS[kind] : 0,
|
|
2693
2978
|
sent: false
|
|
2694
2979
|
});
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2980
|
+
this.flush(tag);
|
|
2981
|
+
}
|
|
2982
|
+
/** When an unsent entry may go out: after its grace and, for plain turn ends, the project cooldown. */
|
|
2983
|
+
releaseAt(digest, entry) {
|
|
2984
|
+
return entry.kind === "turn-done" ? Math.max(entry.due, digest.lastSent + PROJECT_COOLDOWN_MS) : entry.due;
|
|
2698
2985
|
}
|
|
2986
|
+
/** Sends what is due in a project, then waits for the next unsent entry. */
|
|
2699
2987
|
flush(tag) {
|
|
2700
2988
|
const digest = this.digests.get(tag);
|
|
2701
2989
|
if (!digest) return;
|
|
2702
2990
|
digest.cancel?.();
|
|
2703
2991
|
digest.cancel = void 0;
|
|
2704
2992
|
const now = this.now();
|
|
2705
|
-
for (const [key, entry] of digest.entries) if (now - entry.at > DIGEST_TTL_MS || this.
|
|
2993
|
+
for (const [key, entry] of digest.entries) if (now - entry.at > DIGEST_TTL_MS || this.viewedSince(key, entry.at)) digest.entries.delete(key);
|
|
2706
2994
|
const entries = [...digest.entries.values()].reverse();
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2995
|
+
const released = new Set(entries.filter((e) => !e.sent && this.releaseAt(digest, e) <= now));
|
|
2996
|
+
if (released.size) {
|
|
2997
|
+
const shown = entries.filter((e) => e.sent || released.has(e));
|
|
2998
|
+
digest.lastSent = now;
|
|
2999
|
+
const messages = /* @__PURE__ */ new Map();
|
|
3000
|
+
for (const subscription of this.store.pushSubscriptions()) {
|
|
3001
|
+
const prefs = `${subscription.prefs.attention}:${subscription.prefs.turns}`;
|
|
3002
|
+
if (!messages.has(prefs)) {
|
|
3003
|
+
const mine = shown.filter((e) => subscription.prefs[prefFor(e.kind)]);
|
|
3004
|
+
messages.set(prefs, mine.some((e) => released.has(e)) ? this.compose(tag, mine) : null);
|
|
3005
|
+
}
|
|
3006
|
+
const message = messages.get(prefs);
|
|
3007
|
+
if (message) this.deliver(subscription, message);
|
|
2718
3008
|
}
|
|
2719
|
-
const
|
|
2720
|
-
if (message) this.deliver(subscription, message);
|
|
3009
|
+
for (const entry of released) entry.sent = true;
|
|
2721
3010
|
}
|
|
2722
|
-
|
|
3011
|
+
const pending = entries.filter((e) => !e.sent);
|
|
3012
|
+
if (pending.length) {
|
|
3013
|
+
const next = Math.min(...pending.map((e) => this.releaseAt(digest, e)));
|
|
3014
|
+
digest.cancel = this.schedule(() => this.flush(tag), Math.max(0, next - now));
|
|
3015
|
+
} else if (!digest.entries.size) this.digests.delete(tag);
|
|
2723
3016
|
}
|
|
2724
3017
|
/** One notification for a project's unseen events, newest first. */
|
|
2725
3018
|
compose(tag, entries) {
|
|
@@ -3569,6 +3862,8 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3569
3862
|
store,
|
|
3570
3863
|
sender: options.pushSender ?? webPushSender(store, options.pushSubject ?? "mailto:litepaseo@example.com"),
|
|
3571
3864
|
isViewing: (key) => presence.isViewing(key),
|
|
3865
|
+
deviceActive: () => presence.anyActive(),
|
|
3866
|
+
viewedSince: (key, at) => presence.viewedSince(key, at),
|
|
3572
3867
|
replyPreview: (agent, previous) => notificationPreview(hosts.get(agent.hostId).driver, agent.id, previous.turnStartedAt, agent.attention ? void 0 : agent.activityAt),
|
|
3573
3868
|
hostLabel: (id) => hosts.label(id) || store.hosts().find((h) => h.id === id)?.label || ""
|
|
3574
3869
|
});
|
|
@@ -3887,9 +4182,10 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3887
4182
|
const input = z.object({
|
|
3888
4183
|
tab: z.string().uuid(),
|
|
3889
4184
|
seq: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
3890
|
-
key: z.string().min(1).max(1024).nullable()
|
|
4185
|
+
key: z.string().min(1).max(1024).nullable(),
|
|
4186
|
+
active: z.boolean().optional()
|
|
3891
4187
|
}).strict().parse(await c.req.json());
|
|
3892
|
-
presence.update(session.id, input.tab, input.seq, input.key);
|
|
4188
|
+
presence.update(session.id, input.tab, input.seq, input.key, input.active);
|
|
3893
4189
|
return c.json({ ok: true });
|
|
3894
4190
|
});
|
|
3895
4191
|
/**
|
|
@@ -4070,7 +4366,7 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
4070
4366
|
app.get("/api/hosts/:host/agents/:agent/timeline/stream", (c) => {
|
|
4071
4367
|
hosts.get(c.req.param("host"));
|
|
4072
4368
|
return eventStream(c.req.raw.signal, (send) => {
|
|
4073
|
-
|
|
4369
|
+
const stop = hosts.watchTimeline(c.req.param("host"), c.req.param("agent"), (ops) => send({
|
|
4074
4370
|
type: "ops",
|
|
4075
4371
|
ops: ops.map((op) => {
|
|
4076
4372
|
const enrich = (row) => ({
|
|
@@ -4086,8 +4382,56 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
4086
4382
|
} : op;
|
|
4087
4383
|
})
|
|
4088
4384
|
}));
|
|
4385
|
+
let sent = "";
|
|
4386
|
+
let stopSubagents = () => {};
|
|
4387
|
+
try {
|
|
4388
|
+
stopSubagents = hosts.watchSubagents(c.req.param("host"), c.req.param("agent"), (subagents) => {
|
|
4389
|
+
const text = JSON.stringify(subagents);
|
|
4390
|
+
if (text === sent) return;
|
|
4391
|
+
sent = text;
|
|
4392
|
+
send({
|
|
4393
|
+
type: "subagents",
|
|
4394
|
+
subagents
|
|
4395
|
+
});
|
|
4396
|
+
});
|
|
4397
|
+
} catch {}
|
|
4398
|
+
return () => {
|
|
4399
|
+
stop();
|
|
4400
|
+
stopSubagents();
|
|
4401
|
+
};
|
|
4089
4402
|
}, streamValidity(c));
|
|
4090
4403
|
});
|
|
4404
|
+
/** One provider subagent's conversation, read-only, live like an agent's. */
|
|
4405
|
+
app.get("/api/hosts/:host/agents/:agent/subagents/:subagent/timeline/stream", (c) => {
|
|
4406
|
+
hosts.get(c.req.param("host"));
|
|
4407
|
+
return eventStream(c.req.raw.signal, (send) => hosts.watchTimeline(c.req.param("host"), c.req.param("agent"), (ops) => send({
|
|
4408
|
+
type: "ops",
|
|
4409
|
+
ops
|
|
4410
|
+
}), c.req.param("subagent")), streamValidity(c));
|
|
4411
|
+
});
|
|
4412
|
+
app.get("/api/hosts/:host/agents/:agent/subagents/:subagent/timeline", async (c) => {
|
|
4413
|
+
const cursor = z.object({
|
|
4414
|
+
epoch: z.string().min(1),
|
|
4415
|
+
seq: z.number().int().nonnegative()
|
|
4416
|
+
}).parse(parseJson(c.req.query("cursor")));
|
|
4417
|
+
const page = await hosts.get(c.req.param("host")).subagents.timelineDriver(c.req.param("agent"), c.req.param("subagent")).fetchAgentTimeline(c.req.param("agent"), {
|
|
4418
|
+
direction: "before",
|
|
4419
|
+
cursor,
|
|
4420
|
+
limit: 100
|
|
4421
|
+
});
|
|
4422
|
+
return c.json({
|
|
4423
|
+
epoch: page.epoch,
|
|
4424
|
+
hasOlder: page.hasOlder,
|
|
4425
|
+
startCursor: page.startCursor,
|
|
4426
|
+
rows: page.entries.map((e) => ({
|
|
4427
|
+
seqStart: e.seqStart,
|
|
4428
|
+
seqEnd: e.seqEnd,
|
|
4429
|
+
timestamp: e.timestamp,
|
|
4430
|
+
provider: e.provider,
|
|
4431
|
+
item: e.item
|
|
4432
|
+
}))
|
|
4433
|
+
});
|
|
4434
|
+
});
|
|
4091
4435
|
app.get("/api/hosts/:host/agents/:agent/message-images/:message/:index", (c) => {
|
|
4092
4436
|
const index = c.req.param("index");
|
|
4093
4437
|
if (!/^[0-3]$/.test(index)) return c.notFound();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,G as t,I as n,P as r,S as i,T as a,f as o,g as s,ot as c,rt as l,v as u,y as d,z as f}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{
|
|
1
|
+
import{$ as e,G as t,I as n,P as r,S as i,T as a,f as o,g as s,ot as c,rt as l,v as u,y as d,z as f}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{d as p}from"./index-nfa24YSg.js";var m={class:`changes-panel`},h=[`disabled`],g={key:0,role:`alert`},_={key:1},v={key:2},y=[`onToggle`],b=[`onClick`],x={key:0},S={key:1},C={class:`hunk`},w=p(a({__name:`ChangesPanel`,props:{hostId:{},cwd:{},api:{type:Function}},setup(a){let p=a,w=e([]),T=e(``),E=e(!1),D=e(!1),O=0,k=e(new Set);r(()=>O++);async function A(){let e=++O;E.value=!0,T.value=``,w.value=[],D.value=!1,k.value=new Set;try{let t=await p.api(`/hosts/${encodeURIComponent(p.hostId)}/changes?cwd=${encodeURIComponent(p.cwd)}`);if(e!==O)return;w.value=t.files,D.value=!!t.diffTooLarge}catch(t){e===O&&(T.value=t.message)}finally{e===O&&(E.value=!1)}}async function j(e){try{await navigator.clipboard.writeText(e)}catch{T.value=`Could not copy path.`}}return t(()=>[p.hostId,p.cwd],()=>{w.value=[],A()},{immediate:!0}),(e,t)=>(n(),d(`section`,m,[t[0]||=s(`p`,null,`Workspace uncommitted changes · includes changes from all contributors.`,-1),s(`button`,{class:`btn`,disabled:E.value,onClick:A},c(E.value?`Loading…`:`Refresh changes`),9,h),T.value?(n(),d(`p`,g,c(T.value),1)):u(``,!0),D.value?(n(),d(`p`,_,`Diff exceeds the host limit; some changes are omitted.`)):u(``,!0),!E.value&&!T.value&&!w.value.length?(n(),d(`p`,v,`No uncommitted changes.`)):u(``,!0),(n(!0),d(o,null,f(w.value,e=>(n(),d(`details`,{key:e.path,onToggle:t=>t.target.open?k.value.add(e.path):k.value.delete(e.path)},[s(`summary`,null,[i(c(e.oldPath?e.oldPath+` → `:``)+c(e.path)+` `,1),s(`span`,null,`+`+c(e.additions)+` −`+c(e.deletions),1)]),s(`button`,{class:`btn btn-ghost`,onClick:t=>j(e.path)},`Copy path`,8,b),e.status===`binary`?(n(),d(`p`,x,`Binary file changed.`)):e.status===`too_large`?(n(),d(`p`,S,`File diff is too large to display.`)):u(``,!0),k.value.has(e.path)?(n(!0),d(o,{key:2},f(e.hunks,(e,t)=>(n(),d(`pre`,{key:t},[s(`code`,null,[s(`span`,C,`@@ −`+c(e.oldStart)+`,`+c(e.oldCount)+` +`+c(e.newStart)+`,`+c(e.newCount)+` @@
|
|
2
2
|
`,1),(n(!0),d(o,null,f(e.lines,(e,t)=>(n(),d(`span`,{key:t,class:l(e.type)},c(e.type===`add`?`+`:e.type===`remove`?`−`:` `)+c(e.content),3))),128))])]))),128)):u(``,!0)],40,y))),128))]))}}),[[`__scopeId`,`data-v-4de9f4ce`]]);export{w as default};
|
|
Binary file
|
|
Binary file
|