litepaseo 0.6.11 → 0.7.1
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 +13 -0
- package/README.md +1 -0
- package/dist/server/cli.mjs +2 -2
- package/dist/server/{worker-Cr1CPgsj.mjs → worker-D0RLqegD.mjs} +420 -25
- package/dist/web/assets/{ChangesPanel-BMHHX0IU.js → ChangesPanel-xkaPn0UT.js} +1 -1
- package/dist/web/assets/ChangesPanel-xkaPn0UT.js.br +0 -0
- package/dist/web/assets/ChangesPanel-xkaPn0UT.js.gz +0 -0
- package/dist/web/assets/{CodeBlockNode-CsZHjfQP.js → CodeBlockNode-D-C0Wdq8.js} +1 -1
- package/dist/web/assets/CodeBlockNode-D-C0Wdq8.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-D-C0Wdq8.js.gz +0 -0
- package/dist/web/assets/{ConversationSearch-DyipljhZ.js → ConversationSearch-B5fxeknk.js} +1 -1
- package/dist/web/assets/ConversationSearch-B5fxeknk.js.br +0 -0
- package/dist/web/assets/ConversationSearch-B5fxeknk.js.gz +0 -0
- package/dist/web/assets/FileViewer-C7G0PwDK.js +2 -0
- package/dist/web/assets/FileViewer-C7G0PwDK.js.br +0 -0
- package/dist/web/assets/FileViewer-C7G0PwDK.js.gz +0 -0
- package/dist/web/assets/{FilesPanel-iIcT4LLK.js → FilesPanel-PMjZr-lK.js} +1 -1
- package/dist/web/assets/FilesPanel-PMjZr-lK.js.br +0 -0
- package/dist/web/assets/FilesPanel-PMjZr-lK.js.gz +0 -0
- package/dist/web/assets/{HostSettings-CSJhktwr.js → HostSettings-BbvHhHOp.js} +1 -1
- package/dist/web/assets/HostSettings-BbvHhHOp.js.br +0 -0
- package/dist/web/assets/HostSettings-BbvHhHOp.js.gz +0 -0
- package/dist/web/assets/{MarkdownMessage-CJwc_khY.js → MarkdownMessage-DL7ivRRz.js} +5 -5
- package/dist/web/assets/MarkdownMessage-DL7ivRRz.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-DL7ivRRz.js.gz +0 -0
- package/dist/web/assets/{PreCodeBlock-BULxugDB.js → PreCodeBlock-Djm3_lH9.js} +1 -1
- package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-WJGZ1LmY.js → PreCodeBlock.vue_vue_type_style_index_0_lang-ByZvd99V.js} +1 -1
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-ByZvd99V.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-ByZvd99V.js.gz +0 -0
- package/dist/web/assets/SubagentsPanel-C96Vz-pq.js +1 -0
- package/dist/web/assets/SubagentsPanel-C96Vz-pq.js.br +0 -0
- package/dist/web/assets/SubagentsPanel-C96Vz-pq.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-CJ-Et7Wo.js +3 -0
- package/dist/web/assets/TerminalPanel-CJ-Et7Wo.js.br +0 -0
- package/dist/web/assets/TerminalPanel-CJ-Et7Wo.js.gz +0 -0
- package/dist/web/assets/{Tooltip-CJqOWFUg.js → Tooltip-xPcI_D96.js} +1 -1
- package/dist/web/assets/Tooltip-xPcI_D96.js.br +0 -0
- package/dist/web/assets/Tooltip-xPcI_D96.js.gz +0 -0
- package/dist/web/assets/index-Cvdm4aqm.js +35 -0
- package/dist/web/assets/index-Cvdm4aqm.js.br +0 -0
- package/dist/web/assets/index-Cvdm4aqm.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/{index10-BaGk3BFa.js → index10-DnZvNMb8.js} +1 -1
- package/dist/web/assets/index10-DnZvNMb8.js.br +0 -0
- package/dist/web/assets/index10-DnZvNMb8.js.gz +0 -0
- package/dist/web/assets/index3-CwzZEbu8.js +1 -0
- package/dist/web/assets/index4-Bp733T0R.js +1 -0
- package/dist/web/assets/{index5-DaYk2etP.js → index5-BAwtAVGW.js} +1 -1
- package/dist/web/assets/index5-BAwtAVGW.js.br +0 -0
- package/dist/web/assets/index5-BAwtAVGW.js.gz +0 -0
- package/dist/web/assets/{index6-CBBXqEn5.js → index6-BuLnsch9.js} +1 -1
- package/dist/web/assets/index6-BuLnsch9.js.br +0 -0
- package/dist/web/assets/index6-BuLnsch9.js.gz +0 -0
- package/dist/web/assets/{index7-CfuF1ZyY.js → index7-QpBt4KWV.js} +1 -1
- package/dist/web/assets/index7-QpBt4KWV.js.br +0 -0
- package/dist/web/assets/index7-QpBt4KWV.js.gz +0 -0
- package/dist/web/assets/{index8-BWw889CZ.js → index8-fK98mTuC.js} +1 -1
- package/dist/web/assets/index8-fK98mTuC.js.br +0 -0
- package/dist/web/assets/index8-fK98mTuC.js.gz +0 -0
- package/dist/web/assets/{index9-ChbLkDiH.js → index9-CHbo7uvN.js} +1 -1
- package/dist/web/assets/index9-CHbo7uvN.js.br +0 -0
- package/dist/web/assets/index9-CHbo7uvN.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-BMHHX0IU.js.br +0 -0
- package/dist/web/assets/ChangesPanel-BMHHX0IU.js.gz +0 -0
- package/dist/web/assets/CodeBlockNode-CsZHjfQP.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-CsZHjfQP.js.gz +0 -0
- package/dist/web/assets/ConversationSearch-DyipljhZ.js.br +0 -0
- package/dist/web/assets/ConversationSearch-DyipljhZ.js.gz +0 -0
- package/dist/web/assets/FileViewer-BeA4Fqes.js +0 -2
- package/dist/web/assets/FileViewer-BeA4Fqes.js.br +0 -0
- package/dist/web/assets/FileViewer-BeA4Fqes.js.gz +0 -0
- package/dist/web/assets/FilesPanel-iIcT4LLK.js.br +0 -0
- package/dist/web/assets/FilesPanel-iIcT4LLK.js.gz +0 -0
- package/dist/web/assets/HostSettings-CSJhktwr.js.br +0 -0
- package/dist/web/assets/HostSettings-CSJhktwr.js.gz +0 -0
- package/dist/web/assets/MarkdownMessage-CJwc_khY.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-CJwc_khY.js.gz +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-WJGZ1LmY.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-WJGZ1LmY.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-Ccp6x4gf.js +0 -3
- package/dist/web/assets/TerminalPanel-Ccp6x4gf.js.br +0 -0
- package/dist/web/assets/TerminalPanel-Ccp6x4gf.js.gz +0 -0
- package/dist/web/assets/Tooltip-CJqOWFUg.js.br +0 -0
- package/dist/web/assets/Tooltip-CJqOWFUg.js.gz +0 -0
- package/dist/web/assets/index-B3tNn7nG.js +0 -35
- package/dist/web/assets/index-B3tNn7nG.js.br +0 -0
- package/dist/web/assets/index-B3tNn7nG.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/index10-BaGk3BFa.js.br +0 -0
- package/dist/web/assets/index10-BaGk3BFa.js.gz +0 -0
- package/dist/web/assets/index3-DfB32Q2j.js +0 -1
- package/dist/web/assets/index4-CCHuyh-G.js +0 -1
- package/dist/web/assets/index5-DaYk2etP.js.br +0 -0
- package/dist/web/assets/index5-DaYk2etP.js.gz +0 -0
- package/dist/web/assets/index6-CBBXqEn5.js.br +0 -0
- package/dist/web/assets/index6-CBBXqEn5.js.gz +0 -0
- package/dist/web/assets/index7-CfuF1ZyY.js.br +0 -0
- package/dist/web/assets/index7-CfuF1ZyY.js.gz +0 -0
- package/dist/web/assets/index8-BWw889CZ.js.br +0 -0
- package/dist/web/assets/index8-BWw889CZ.js.gz +0 -0
- package/dist/web/assets/index9-ChbLkDiH.js.br +0 -0
- package/dist/web/assets/index9-ChbLkDiH.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
- Recover in seconds when a host's connection goes silent: after a laptop sleeps, Wi-Fi changes or a network drops the connection without closing it, a conversation could load for up to about 50 seconds with no error until the Paseo SDK noticed. When a conversation is still loading after 2 seconds, LitePaseo now pings the host and reopens the connection if it does not answer within 3 seconds. In a test with a deliberately silenced connection, opening took 8 seconds instead of 49.
|
|
6
|
+
- Log every slow conversation open, including a browser joining a conversation that was already loading and one that gives up waiting (for example by reloading the page), as `timeline_wait`. Hosts that stop answering are logged as `host_unresponsive`, recoveries as `host_reconnected`. Diagnostic log lines now carry the time.
|
|
7
|
+
- Start each live stream response at once, so a slow open shows whether the wait was in LitePaseo, the network in between, or the host.
|
|
8
|
+
|
|
9
|
+
## 0.7.0
|
|
10
|
+
|
|
11
|
+
- 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.
|
|
12
|
+
- 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.
|
|
13
|
+
- Open a delegated agent from the panel; its header links back to the parent agent. The sidebar is unchanged.
|
|
14
|
+
- 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.
|
|
15
|
+
|
|
3
16
|
## 0.6.11
|
|
4
17
|
|
|
5
18
|
- 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.
|
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.1";
|
|
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-D0RLqegD.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. */
|
|
@@ -676,6 +679,10 @@ var TimelineView = class {
|
|
|
676
679
|
get watcherCount() {
|
|
677
680
|
return this.watchers.size;
|
|
678
681
|
}
|
|
682
|
+
/** Where the view stands, for diagnosing a viewer that waits. */
|
|
683
|
+
get status() {
|
|
684
|
+
return this.state;
|
|
685
|
+
}
|
|
679
686
|
start() {
|
|
680
687
|
const token = ++this.token;
|
|
681
688
|
this.state = "loading";
|
|
@@ -982,7 +989,7 @@ var TimelineView = class {
|
|
|
982
989
|
}
|
|
983
990
|
scheduleFlush() {
|
|
984
991
|
if (this.flushTimer || !this.watchers.size) return;
|
|
985
|
-
this.flushTimer = setTimeout(() => this.flush(), FLUSH_MS);
|
|
992
|
+
this.flushTimer = setTimeout(() => this.flush(), FLUSH_MS$1);
|
|
986
993
|
}
|
|
987
994
|
flush() {
|
|
988
995
|
clearTimeout(this.flushTimer);
|
|
@@ -1054,6 +1061,297 @@ var TimelineView = class {
|
|
|
1054
1061
|
for (const watcher of this.watchers) watcher(ops);
|
|
1055
1062
|
}
|
|
1056
1063
|
};
|
|
1064
|
+
// src/server/subagents.ts
|
|
1065
|
+
const UPDATE = "agent.provider_subagents.update";
|
|
1066
|
+
/** Released this long after the last watcher leaves, so switching conversations keeps it. */
|
|
1067
|
+
const GRACE_MS = 3e4;
|
|
1068
|
+
/** Status changes are batched like timeline renders. */
|
|
1069
|
+
const FLUSH_MS = 500;
|
|
1070
|
+
const LIST_TIMEOUT_MS = 15e3;
|
|
1071
|
+
const publish = (d) => ({
|
|
1072
|
+
id: d.id,
|
|
1073
|
+
parentSubagentId: d.parentSubagentId ?? null,
|
|
1074
|
+
provider: d.provider,
|
|
1075
|
+
title: d.title,
|
|
1076
|
+
description: d.description,
|
|
1077
|
+
subtitle: d.subtitle ?? null,
|
|
1078
|
+
status: d.status,
|
|
1079
|
+
createdAt: d.createdAt,
|
|
1080
|
+
updatedAt: d.updatedAt,
|
|
1081
|
+
toolCallId: d.toolCallId
|
|
1082
|
+
});
|
|
1083
|
+
/**
|
|
1084
|
+
* The subagents providers run inside agents of one host (Claude Task, Codex, pi-subagents…),
|
|
1085
|
+
* as Paseo's daemon tracks them. One event subscription per host serves every watched parent
|
|
1086
|
+
* and every open subagent conversation; it is held only while someone watches.
|
|
1087
|
+
*/
|
|
1088
|
+
var HostSubagents = class {
|
|
1089
|
+
parents = /* @__PURE__ */ new Map();
|
|
1090
|
+
timelines = /* @__PURE__ */ new Map();
|
|
1091
|
+
events = null;
|
|
1092
|
+
stopEvents = null;
|
|
1093
|
+
snapshots = 0;
|
|
1094
|
+
users = 0;
|
|
1095
|
+
idle;
|
|
1096
|
+
driver;
|
|
1097
|
+
constructor(driver) {
|
|
1098
|
+
this.driver = driver;
|
|
1099
|
+
}
|
|
1100
|
+
/** Calls `listener` with the parent's subagents once known and on every change. */
|
|
1101
|
+
watch(parentAgentId, listener) {
|
|
1102
|
+
this.acquire();
|
|
1103
|
+
let parent = this.parents.get(parentAgentId);
|
|
1104
|
+
if (!parent) {
|
|
1105
|
+
parent = {
|
|
1106
|
+
subagents: /* @__PURE__ */ new Map(),
|
|
1107
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
1108
|
+
during: null,
|
|
1109
|
+
token: 0
|
|
1110
|
+
};
|
|
1111
|
+
this.parents.set(parentAgentId, parent);
|
|
1112
|
+
parent.listeners.add(listener);
|
|
1113
|
+
this.load(parentAgentId, parent);
|
|
1114
|
+
} else {
|
|
1115
|
+
parent.listeners.add(listener);
|
|
1116
|
+
if (!parent.during) listener(this.list(parent));
|
|
1117
|
+
}
|
|
1118
|
+
const current = parent;
|
|
1119
|
+
let stopped = false;
|
|
1120
|
+
return () => {
|
|
1121
|
+
if (stopped) return;
|
|
1122
|
+
stopped = true;
|
|
1123
|
+
current.listeners.delete(listener);
|
|
1124
|
+
if (!current.listeners.size && this.parents.get(parentAgentId) === current) {
|
|
1125
|
+
clearTimeout(current.timer);
|
|
1126
|
+
current.token++;
|
|
1127
|
+
this.parents.delete(parentAgentId);
|
|
1128
|
+
}
|
|
1129
|
+
this.releaseUse();
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
/** A TimelineView driver for one subagent conversation. */
|
|
1133
|
+
timelineDriver(parentAgentId, subagentId) {
|
|
1134
|
+
const key = `${parentAgentId}\0${subagentId}`;
|
|
1135
|
+
return {
|
|
1136
|
+
subscribeAgentTimeline: (_agentId, handler) => {
|
|
1137
|
+
this.acquire();
|
|
1138
|
+
let handlers = this.timelines.get(key);
|
|
1139
|
+
if (!handlers) this.timelines.set(key, handlers = /* @__PURE__ */ new Set());
|
|
1140
|
+
handlers.add(handler);
|
|
1141
|
+
let released = false;
|
|
1142
|
+
const release = async () => {
|
|
1143
|
+
if (released) return;
|
|
1144
|
+
released = true;
|
|
1145
|
+
handlers.delete(handler);
|
|
1146
|
+
if (!handlers.size && this.timelines.get(key) === handlers) this.timelines.delete(key);
|
|
1147
|
+
this.releaseUse();
|
|
1148
|
+
};
|
|
1149
|
+
const ready = this.events.ready.then(() => void 0);
|
|
1150
|
+
return Object.assign(() => void release(), {
|
|
1151
|
+
ready,
|
|
1152
|
+
release
|
|
1153
|
+
});
|
|
1154
|
+
},
|
|
1155
|
+
fetchAgentTimeline: async (_agentId, options) => {
|
|
1156
|
+
const page = await this.driver.fetchProviderSubagentTimeline(parentAgentId, subagentId, {
|
|
1157
|
+
direction: options.direction,
|
|
1158
|
+
...options.cursor ? { cursor: options.cursor } : {},
|
|
1159
|
+
...typeof options.limit === "number" ? { limit: options.limit } : {},
|
|
1160
|
+
timeout: LIST_TIMEOUT_MS
|
|
1161
|
+
});
|
|
1162
|
+
return {
|
|
1163
|
+
epoch: page.epoch,
|
|
1164
|
+
reset: page.reset,
|
|
1165
|
+
window: page.window,
|
|
1166
|
+
startCursor: page.startCursor ?? null,
|
|
1167
|
+
endCursor: page.endCursor ?? null,
|
|
1168
|
+
hasOlder: page.hasOlder,
|
|
1169
|
+
hasNewer: page.hasNewer,
|
|
1170
|
+
entries: page.rows.map((row) => ({
|
|
1171
|
+
provider: page.provider ?? "",
|
|
1172
|
+
item: row.item,
|
|
1173
|
+
timestamp: row.timestamp,
|
|
1174
|
+
seqStart: row.seqStart ?? row.seq,
|
|
1175
|
+
seqEnd: row.seqEnd ?? row.seq
|
|
1176
|
+
}))
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
async dispose() {
|
|
1182
|
+
clearTimeout(this.idle);
|
|
1183
|
+
for (const parent of this.parents.values()) clearTimeout(parent.timer);
|
|
1184
|
+
this.parents.clear();
|
|
1185
|
+
this.timelines.clear();
|
|
1186
|
+
await this.close();
|
|
1187
|
+
}
|
|
1188
|
+
acquire() {
|
|
1189
|
+
if (!this.events) this.subscribe();
|
|
1190
|
+
this.users++;
|
|
1191
|
+
clearTimeout(this.idle);
|
|
1192
|
+
this.idle = void 0;
|
|
1193
|
+
}
|
|
1194
|
+
subscribe() {
|
|
1195
|
+
this.snapshots = 0;
|
|
1196
|
+
this.stopEvents = this.driver.on(UPDATE, (message) => this.receive(message.payload));
|
|
1197
|
+
const events = this.events = this.driver.observeEvents([UPDATE]);
|
|
1198
|
+
events.subscribe({
|
|
1199
|
+
snapshot: () => {
|
|
1200
|
+
if (this.events === events && this.snapshots++ > 0) this.restored();
|
|
1201
|
+
},
|
|
1202
|
+
update() {},
|
|
1203
|
+
error() {}
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
releaseUse() {
|
|
1207
|
+
if (--this.users > 0) return;
|
|
1208
|
+
this.users = 0;
|
|
1209
|
+
clearTimeout(this.idle);
|
|
1210
|
+
this.idle = setTimeout(() => {
|
|
1211
|
+
if (!this.users) this.close();
|
|
1212
|
+
}, GRACE_MS);
|
|
1213
|
+
this.idle.unref?.();
|
|
1214
|
+
}
|
|
1215
|
+
async close() {
|
|
1216
|
+
this.stopEvents?.();
|
|
1217
|
+
this.stopEvents = null;
|
|
1218
|
+
const events = this.events;
|
|
1219
|
+
this.events = null;
|
|
1220
|
+
await events?.release().catch(() => {});
|
|
1221
|
+
}
|
|
1222
|
+
restored() {
|
|
1223
|
+
for (const [id, parent] of this.parents) this.load(id, parent);
|
|
1224
|
+
for (const handlers of this.timelines.values()) for (const handler of handlers) handler({ type: "agent.timeline.subscription_restored" });
|
|
1225
|
+
}
|
|
1226
|
+
async load(parentAgentId, parent) {
|
|
1227
|
+
const token = ++parent.token;
|
|
1228
|
+
parent.during = /* @__PURE__ */ new Map();
|
|
1229
|
+
let listed = [];
|
|
1230
|
+
try {
|
|
1231
|
+
listed = (await this.driver.listProviderSubagents(parentAgentId, { timeout: LIST_TIMEOUT_MS })).subagents;
|
|
1232
|
+
} catch {
|
|
1233
|
+
if (token !== parent.token) return;
|
|
1234
|
+
listed = [...parent.subagents.values()];
|
|
1235
|
+
}
|
|
1236
|
+
if (token !== parent.token || this.parents.get(parentAgentId) !== parent) return;
|
|
1237
|
+
const next = new Map(listed.map((d) => [d.id, d]));
|
|
1238
|
+
for (const [id, change] of parent.during) if (change === null) next.delete(id);
|
|
1239
|
+
else if ((next.get(id)?.updatedAt ?? "") <= change.updatedAt) next.set(id, change);
|
|
1240
|
+
parent.subagents = next;
|
|
1241
|
+
parent.during = null;
|
|
1242
|
+
this.flush(parent);
|
|
1243
|
+
}
|
|
1244
|
+
receive(payload) {
|
|
1245
|
+
if (payload.kind === "timeline") {
|
|
1246
|
+
const handlers = this.timelines.get(`${payload.parentAgentId}\0${payload.subagentId}`);
|
|
1247
|
+
if (!handlers) return;
|
|
1248
|
+
const message = {
|
|
1249
|
+
type: "agent_stream",
|
|
1250
|
+
payload: {
|
|
1251
|
+
agentId: payload.subagentId,
|
|
1252
|
+
event: {
|
|
1253
|
+
type: "timeline",
|
|
1254
|
+
provider: payload.provider,
|
|
1255
|
+
item: payload.item
|
|
1256
|
+
},
|
|
1257
|
+
timestamp: payload.timestamp,
|
|
1258
|
+
seq: payload.seq,
|
|
1259
|
+
epoch: payload.epoch
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
for (const handler of handlers) handler(message);
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
const parentId = payload.kind === "upsert" ? payload.subagent.parentAgentId : payload.parentAgentId;
|
|
1266
|
+
const parent = this.parents.get(parentId);
|
|
1267
|
+
if (!parent) return;
|
|
1268
|
+
if (payload.kind === "upsert") {
|
|
1269
|
+
parent.subagents.set(payload.subagent.id, payload.subagent);
|
|
1270
|
+
parent.during?.set(payload.subagent.id, payload.subagent);
|
|
1271
|
+
} else {
|
|
1272
|
+
parent.subagents.delete(payload.subagentId);
|
|
1273
|
+
parent.during?.set(payload.subagentId, null);
|
|
1274
|
+
}
|
|
1275
|
+
if (parent.during || parent.timer) return;
|
|
1276
|
+
parent.timer = setTimeout(() => this.flush(parent), FLUSH_MS);
|
|
1277
|
+
parent.timer.unref?.();
|
|
1278
|
+
}
|
|
1279
|
+
flush(parent) {
|
|
1280
|
+
clearTimeout(parent.timer);
|
|
1281
|
+
parent.timer = void 0;
|
|
1282
|
+
const list = this.list(parent);
|
|
1283
|
+
for (const listener of parent.listeners) listener(list);
|
|
1284
|
+
}
|
|
1285
|
+
list(parent) {
|
|
1286
|
+
return [...parent.subagents.values()].sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id)).map(publish);
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
// src/server/log-event.ts
|
|
1290
|
+
/**
|
|
1291
|
+
* One diagnostic event as a JSON line in the service log, with the time it happened: the log
|
|
1292
|
+
* has no timestamps of its own, and events are only useful when they can be lined up.
|
|
1293
|
+
*/
|
|
1294
|
+
function logEvent(event, fields, sink = console.warn) {
|
|
1295
|
+
sink(JSON.stringify({
|
|
1296
|
+
time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1297
|
+
event,
|
|
1298
|
+
...fields
|
|
1299
|
+
}));
|
|
1300
|
+
}
|
|
1301
|
+
// src/server/host-liveness.ts
|
|
1302
|
+
const PING_TIMEOUT_MS = 3e3;
|
|
1303
|
+
/** One check per host at most this often: a struggling host is not pinged in a loop. */
|
|
1304
|
+
const MIN_INTERVAL_MS = 1e4;
|
|
1305
|
+
/**
|
|
1306
|
+
* A daemon connection can stay open while nothing reaches the daemon any more (a laptop that
|
|
1307
|
+
* slept, a Wi-Fi change, a NAT that dropped the connection). The SDK only notices after two
|
|
1308
|
+
* failed heartbeats, up to about 50 seconds, and until then a conversation open waits with no
|
|
1309
|
+
* error. When a viewer waits, this asks the daemon to answer at once and, if it stays silent,
|
|
1310
|
+
* reopens the connection right away.
|
|
1311
|
+
*/
|
|
1312
|
+
var HostLiveness = class {
|
|
1313
|
+
checking = null;
|
|
1314
|
+
lastAt = Number.NEGATIVE_INFINITY;
|
|
1315
|
+
driver;
|
|
1316
|
+
hostId;
|
|
1317
|
+
reconnect;
|
|
1318
|
+
now;
|
|
1319
|
+
constructor(driver, hostId, reconnect, now = Date.now) {
|
|
1320
|
+
this.driver = driver;
|
|
1321
|
+
this.hostId = hostId;
|
|
1322
|
+
this.reconnect = reconnect;
|
|
1323
|
+
this.now = now;
|
|
1324
|
+
}
|
|
1325
|
+
/** Resolves false when the daemon did not answer and the connection is being reopened. */
|
|
1326
|
+
check(reason) {
|
|
1327
|
+
if (this.checking) return this.checking;
|
|
1328
|
+
if (this.driver.getConnectionState().status !== "connected") return Promise.resolve(true);
|
|
1329
|
+
if (this.now() - this.lastAt < MIN_INTERVAL_MS) return Promise.resolve(true);
|
|
1330
|
+
this.lastAt = this.now();
|
|
1331
|
+
const started = this.now();
|
|
1332
|
+
this.checking = this.driver.ping({ timeoutMs: PING_TIMEOUT_MS }).then(() => true, () => {
|
|
1333
|
+
if (this.driver.getConnectionState().status !== "connected") return false;
|
|
1334
|
+
logEvent("host_unresponsive", {
|
|
1335
|
+
hostId: this.hostId,
|
|
1336
|
+
reason,
|
|
1337
|
+
waitedMs: this.now() - started
|
|
1338
|
+
});
|
|
1339
|
+
this.reconnect();
|
|
1340
|
+
return false;
|
|
1341
|
+
}).finally(() => this.checking = null);
|
|
1342
|
+
return this.checking;
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
/**
|
|
1346
|
+
* Reopens a DaemonClient connection through the SDK's own liveness-timeout path, so its
|
|
1347
|
+
* subscriptions restore as after any reconnect. The SDK has no public call for this yet.
|
|
1348
|
+
*/
|
|
1349
|
+
function forceReconnect(driver) {
|
|
1350
|
+
const d = driver;
|
|
1351
|
+
if (typeof d.recordLivenessFailure !== "function") return;
|
|
1352
|
+
const error = /* @__PURE__ */ new Error("Host stopped responding");
|
|
1353
|
+
for (let i = 0; i < 2 && d.getConnectionState().status === "connected"; i++) d.recordLivenessFailure(error);
|
|
1354
|
+
}
|
|
1057
1355
|
// src/server/hosts.ts
|
|
1058
1356
|
var UnknownHostError = class extends Error {
|
|
1059
1357
|
constructor() {
|
|
@@ -1064,6 +1362,8 @@ var UnknownHostError = class extends Error {
|
|
|
1064
1362
|
const TIMELINE_GRACE_MS = 3e4;
|
|
1065
1363
|
/** Conversation opens slower than this are logged with a per-layer breakdown. */
|
|
1066
1364
|
const SLOW_TIMELINE_MS = 3e3;
|
|
1365
|
+
/** A viewer still without rows after this long has the daemon checked for a silent connection. */
|
|
1366
|
+
const LIVENESS_CHECK_MS = 2e3;
|
|
1067
1367
|
var Hosts = class {
|
|
1068
1368
|
agents = new VersionedCollection();
|
|
1069
1369
|
workspaces = new VersionedCollection();
|
|
@@ -1103,8 +1403,13 @@ var Hosts = class {
|
|
|
1103
1403
|
const workspaces = new HostWorkspaces(hostId, driver, this.workspaces, () => this.emit(this.agentListeners));
|
|
1104
1404
|
const update = (state) => {
|
|
1105
1405
|
const previous = this.diagnostics.get(hostId) ?? {};
|
|
1106
|
-
if (state.status === "connected")
|
|
1107
|
-
|
|
1406
|
+
if (state.status === "connected") {
|
|
1407
|
+
if (previous.error) logEvent("host_reconnected", {
|
|
1408
|
+
hostId,
|
|
1409
|
+
after: previous.error.code
|
|
1410
|
+
});
|
|
1411
|
+
this.diagnostics.set(hostId, { lastConnectedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
1412
|
+
} else if (state.status === "connecting") this.diagnostics.set(hostId, {
|
|
1108
1413
|
...previous,
|
|
1109
1414
|
nextRetryAt: void 0,
|
|
1110
1415
|
attempt: state.attempt
|
|
@@ -1121,11 +1426,15 @@ var Hosts = class {
|
|
|
1121
1426
|
};
|
|
1122
1427
|
const stopStatus = driver.subscribeConnectionStatus(update);
|
|
1123
1428
|
update(driver.getConnectionState());
|
|
1429
|
+
const subagents = new HostSubagents(driver);
|
|
1430
|
+
const liveness = typeof driver.ping === "function" ? new HostLiveness(driver, hostId, () => forceReconnect(driver)) : void 0;
|
|
1124
1431
|
this.clients.set(hostId, {
|
|
1125
1432
|
driver,
|
|
1126
1433
|
api,
|
|
1127
1434
|
directory,
|
|
1128
1435
|
workspaces,
|
|
1436
|
+
subagents,
|
|
1437
|
+
liveness,
|
|
1129
1438
|
stopStatus
|
|
1130
1439
|
});
|
|
1131
1440
|
directory.start();
|
|
@@ -1143,11 +1452,10 @@ var Hosts = class {
|
|
|
1143
1452
|
noteFailure(id, failure) {
|
|
1144
1453
|
const error = connectionProblem(failure);
|
|
1145
1454
|
const previous = this.diagnostics.get(id) ?? {};
|
|
1146
|
-
if (previous.error?.code !== error.code)
|
|
1147
|
-
event: "host_connection_failed",
|
|
1455
|
+
if (previous.error?.code !== error.code) logEvent("host_connection_failed", {
|
|
1148
1456
|
hostId: id,
|
|
1149
1457
|
code: error.code
|
|
1150
|
-
})
|
|
1458
|
+
});
|
|
1151
1459
|
this.diagnostics.set(id, {
|
|
1152
1460
|
...previous,
|
|
1153
1461
|
error
|
|
@@ -1169,7 +1477,8 @@ var Hosts = class {
|
|
|
1169
1477
|
await Promise.all([
|
|
1170
1478
|
...releases,
|
|
1171
1479
|
c.directory.dispose(),
|
|
1172
|
-
c.workspaces.dispose()
|
|
1480
|
+
c.workspaces.dispose(),
|
|
1481
|
+
c.subagents.dispose()
|
|
1173
1482
|
]);
|
|
1174
1483
|
c.stopStatus();
|
|
1175
1484
|
await c.api.dispose();
|
|
@@ -1205,35 +1514,75 @@ var Hosts = class {
|
|
|
1205
1514
|
this.hostListeners.add(listener);
|
|
1206
1515
|
return () => this.hostListeners.delete(listener);
|
|
1207
1516
|
}
|
|
1208
|
-
/**
|
|
1209
|
-
|
|
1517
|
+
/** The provider subagents of one agent, as they change. */
|
|
1518
|
+
watchSubagents(hostId, agentId, listener) {
|
|
1519
|
+
return this.get(hostId).subagents.watch(agentId, listener);
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Shares one live timeline per agent across all watching browsers. With `subagentId`, the
|
|
1523
|
+
* conversation of one of the agent's provider subagents.
|
|
1524
|
+
*/
|
|
1525
|
+
watchTimeline(hostId, agentId, watcher, subagentId) {
|
|
1210
1526
|
const client = this.get(hostId);
|
|
1211
|
-
const key = `${hostId}:${agentId}`;
|
|
1527
|
+
const key = subagentId ? `${hostId}:${agentId}:subagent:${subagentId}` : `${hostId}:${agentId}`;
|
|
1212
1528
|
let entry = this.timelines.get(key);
|
|
1213
1529
|
if (!entry) {
|
|
1214
1530
|
const connection = client.driver.getConnectionState().status;
|
|
1215
|
-
const view = new TimelineView(client.driver, agentId, (report) => {
|
|
1531
|
+
const view = new TimelineView(subagentId ? client.subagents.timelineDriver(agentId, subagentId) : client.driver, agentId, (report) => {
|
|
1216
1532
|
if (report.totalMs < SLOW_TIMELINE_MS) return;
|
|
1217
|
-
|
|
1218
|
-
event: "timeline_slow",
|
|
1533
|
+
logEvent("timeline_slow", {
|
|
1219
1534
|
hostId,
|
|
1220
1535
|
agentId,
|
|
1536
|
+
...subagentId ? { subagentId } : {},
|
|
1221
1537
|
connectionAtStart: connection ?? null,
|
|
1222
1538
|
...report
|
|
1223
|
-
})
|
|
1539
|
+
});
|
|
1224
1540
|
});
|
|
1225
1541
|
entry = {
|
|
1226
1542
|
view,
|
|
1227
|
-
hostId
|
|
1543
|
+
hostId,
|
|
1544
|
+
fresh: true
|
|
1228
1545
|
};
|
|
1229
1546
|
this.timelines.set(key, entry);
|
|
1230
1547
|
view.start();
|
|
1231
1548
|
}
|
|
1232
1549
|
clearTimeout(entry.idle);
|
|
1233
1550
|
entry.idle = void 0;
|
|
1234
|
-
const
|
|
1551
|
+
const joinedAt = performance.now();
|
|
1552
|
+
const joined = {
|
|
1553
|
+
state: entry.view.status,
|
|
1554
|
+
fresh: entry.fresh,
|
|
1555
|
+
others: entry.view.watcherCount
|
|
1556
|
+
};
|
|
1557
|
+
entry.fresh = false;
|
|
1558
|
+
let waiting = true;
|
|
1559
|
+
const finishWait = (left) => {
|
|
1560
|
+
if (!waiting) return;
|
|
1561
|
+
waiting = false;
|
|
1562
|
+
clearTimeout(check);
|
|
1563
|
+
const waitMs = Math.round(performance.now() - joinedAt);
|
|
1564
|
+
if (waitMs < SLOW_TIMELINE_MS) return;
|
|
1565
|
+
logEvent("timeline_wait", {
|
|
1566
|
+
hostId,
|
|
1567
|
+
agentId,
|
|
1568
|
+
...subagentId ? { subagentId } : {},
|
|
1569
|
+
waitMs,
|
|
1570
|
+
left,
|
|
1571
|
+
joinedState: joined.state,
|
|
1572
|
+
freshView: joined.fresh,
|
|
1573
|
+
otherViewers: joined.others,
|
|
1574
|
+
connection: client.driver.getConnectionState().status
|
|
1575
|
+
});
|
|
1576
|
+
};
|
|
1577
|
+
const check = setTimeout(() => void client.liveness?.check("timeline_wait"), LIVENESS_CHECK_MS);
|
|
1578
|
+
check.unref?.();
|
|
1579
|
+
const stop = entry.view.watch((ops) => {
|
|
1580
|
+
if (waiting && ops.some((op) => op.type === "reset")) finishWait(false);
|
|
1581
|
+
watcher(ops);
|
|
1582
|
+
});
|
|
1235
1583
|
const current = entry;
|
|
1236
1584
|
return () => {
|
|
1585
|
+
finishWait(true);
|
|
1237
1586
|
stop();
|
|
1238
1587
|
if (current.view.watcherCount || this.timelines.get(key) !== current) return;
|
|
1239
1588
|
current.idle = setTimeout(() => {
|
|
@@ -1983,6 +2332,7 @@ function eventStream(signal, open, valid = () => true) {
|
|
|
1983
2332
|
controller.close();
|
|
1984
2333
|
} catch {}
|
|
1985
2334
|
}, HEARTBEAT_MS);
|
|
2335
|
+
write(": open\n\n");
|
|
1986
2336
|
const close = open((data) => write(`data: ${JSON.stringify(data)}\n\n`));
|
|
1987
2337
|
cleanup = () => {
|
|
1988
2338
|
clearInterval(heartbeat);
|
|
@@ -3815,6 +4165,7 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3815
4165
|
const failure = error;
|
|
3816
4166
|
const cause = failure.cause instanceof Error ? failure.cause : null;
|
|
3817
4167
|
console.error(JSON.stringify({
|
|
4168
|
+
time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3818
4169
|
event: "api_operation_failed",
|
|
3819
4170
|
requestId,
|
|
3820
4171
|
method: c.req.method,
|
|
@@ -3956,7 +4307,7 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3956
4307
|
app.post("/api/diagnostics/timeline-slow", async (c) => {
|
|
3957
4308
|
const ms = z.number().int().nonnegative().max(36e5).nullable();
|
|
3958
4309
|
const long = z.number().int().nonnegative().max(7776e6).nullable();
|
|
3959
|
-
|
|
4310
|
+
logEvent("timeline_slow_client", z.object({
|
|
3960
4311
|
hostId: z.string().min(1).max(200),
|
|
3961
4312
|
agentId: z.string().min(1).max(200),
|
|
3962
4313
|
totalMs: ms,
|
|
@@ -3969,11 +4320,7 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3969
4320
|
backgroundMs: long.optional(),
|
|
3970
4321
|
visibleForMs: ms.optional(),
|
|
3971
4322
|
version: z.string().max(40).optional()
|
|
3972
|
-
}).strict().parse(await c.req.json());
|
|
3973
|
-
console.warn(JSON.stringify({
|
|
3974
|
-
event: "timeline_slow_client",
|
|
3975
|
-
...input
|
|
3976
|
-
}));
|
|
4323
|
+
}).strict().parse(await c.req.json()));
|
|
3977
4324
|
return c.json({ ok: true });
|
|
3978
4325
|
});
|
|
3979
4326
|
app.get("/api/instance", (c) => c.json({ name: instanceName() }));
|
|
@@ -4127,7 +4474,7 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
4127
4474
|
app.get("/api/hosts/:host/agents/:agent/timeline/stream", (c) => {
|
|
4128
4475
|
hosts.get(c.req.param("host"));
|
|
4129
4476
|
return eventStream(c.req.raw.signal, (send) => {
|
|
4130
|
-
|
|
4477
|
+
const stop = hosts.watchTimeline(c.req.param("host"), c.req.param("agent"), (ops) => send({
|
|
4131
4478
|
type: "ops",
|
|
4132
4479
|
ops: ops.map((op) => {
|
|
4133
4480
|
const enrich = (row) => ({
|
|
@@ -4143,8 +4490,56 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
4143
4490
|
} : op;
|
|
4144
4491
|
})
|
|
4145
4492
|
}));
|
|
4493
|
+
let sent = "";
|
|
4494
|
+
let stopSubagents = () => {};
|
|
4495
|
+
try {
|
|
4496
|
+
stopSubagents = hosts.watchSubagents(c.req.param("host"), c.req.param("agent"), (subagents) => {
|
|
4497
|
+
const text = JSON.stringify(subagents);
|
|
4498
|
+
if (text === sent) return;
|
|
4499
|
+
sent = text;
|
|
4500
|
+
send({
|
|
4501
|
+
type: "subagents",
|
|
4502
|
+
subagents
|
|
4503
|
+
});
|
|
4504
|
+
});
|
|
4505
|
+
} catch {}
|
|
4506
|
+
return () => {
|
|
4507
|
+
stop();
|
|
4508
|
+
stopSubagents();
|
|
4509
|
+
};
|
|
4146
4510
|
}, streamValidity(c));
|
|
4147
4511
|
});
|
|
4512
|
+
/** One provider subagent's conversation, read-only, live like an agent's. */
|
|
4513
|
+
app.get("/api/hosts/:host/agents/:agent/subagents/:subagent/timeline/stream", (c) => {
|
|
4514
|
+
hosts.get(c.req.param("host"));
|
|
4515
|
+
return eventStream(c.req.raw.signal, (send) => hosts.watchTimeline(c.req.param("host"), c.req.param("agent"), (ops) => send({
|
|
4516
|
+
type: "ops",
|
|
4517
|
+
ops
|
|
4518
|
+
}), c.req.param("subagent")), streamValidity(c));
|
|
4519
|
+
});
|
|
4520
|
+
app.get("/api/hosts/:host/agents/:agent/subagents/:subagent/timeline", async (c) => {
|
|
4521
|
+
const cursor = z.object({
|
|
4522
|
+
epoch: z.string().min(1),
|
|
4523
|
+
seq: z.number().int().nonnegative()
|
|
4524
|
+
}).parse(parseJson(c.req.query("cursor")));
|
|
4525
|
+
const page = await hosts.get(c.req.param("host")).subagents.timelineDriver(c.req.param("agent"), c.req.param("subagent")).fetchAgentTimeline(c.req.param("agent"), {
|
|
4526
|
+
direction: "before",
|
|
4527
|
+
cursor,
|
|
4528
|
+
limit: 100
|
|
4529
|
+
});
|
|
4530
|
+
return c.json({
|
|
4531
|
+
epoch: page.epoch,
|
|
4532
|
+
hasOlder: page.hasOlder,
|
|
4533
|
+
startCursor: page.startCursor,
|
|
4534
|
+
rows: page.entries.map((e) => ({
|
|
4535
|
+
seqStart: e.seqStart,
|
|
4536
|
+
seqEnd: e.seqEnd,
|
|
4537
|
+
timestamp: e.timestamp,
|
|
4538
|
+
provider: e.provider,
|
|
4539
|
+
item: e.item
|
|
4540
|
+
}))
|
|
4541
|
+
});
|
|
4542
|
+
});
|
|
4148
4543
|
app.get("/api/hosts/:host/agents/:agent/message-images/:message/:index", (c) => {
|
|
4149
4544
|
const index = c.req.param("index");
|
|
4150
4545
|
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-Cvdm4aqm.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
|