@lelouchhe/webagent 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -15
- package/config.toml +7 -27
- package/dist/index.html +21 -5
- package/dist/js/app.INIQQEGD.js +5 -0
- package/dist/js/chunk.3CLGCUHW.js +1 -0
- package/dist/js/{chunk.CT5WBNGZ.js → chunk.7WADDFJZ.js} +50 -49
- package/dist/js/chunk.AOTG3PL7.js +20 -0
- package/dist/js/{login.2WA6DTGM.js → login.WMURU4NI.js} +1 -1
- package/dist/js/viewer.RHZMFYWJ.js +1 -0
- package/dist/login.html +2 -2
- package/dist/share-viewer.html +6 -6
- package/dist/{styles.00etlpgs.css → styles.01aj0l37.css} +186 -4
- package/dist/sw.js +6 -6
- package/lib/agent-key.js +6 -0
- package/lib/attachment-dispatch.js +60 -31
- package/lib/attachment-interceptor.js +7 -7
- package/lib/attachment-labels.js +1 -1
- package/lib/attachments.js +69 -7
- package/lib/auth-middleware.js +11 -4
- package/lib/auth.js +2 -2
- package/lib/bridge.js +209 -90
- package/lib/client-registry.js +12 -12
- package/lib/config.js +2 -31
- package/lib/event-handler.js +166 -85
- package/lib/files/limits.js +15 -0
- package/lib/files/paths.js +155 -0
- package/lib/files/routes.js +232 -0
- package/lib/home-path.js +35 -0
- package/lib/http-status.js +1 -0
- package/lib/mcp/capability.js +74 -0
- package/lib/mcp/server.js +148 -0
- package/lib/mcp/task-history.js +245 -0
- package/lib/mcp/task-host.js +253 -0
- package/lib/mcp/tools.js +168 -0
- package/lib/mode-bucket.js +1 -1
- package/lib/push-service.js +33 -35
- package/lib/routes.js +1022 -475
- package/lib/server.js +84 -34
- package/lib/share/routes.js +97 -85
- package/lib/shared/task-reference.js +20 -0
- package/lib/sse-manager.js +8 -8
- package/lib/store.js +992 -284
- package/lib/task-collaboration.js +15 -0
- package/lib/task-manager.js +1409 -0
- package/lib/task-path.js +131 -0
- package/lib/{session-state.js → task-state.js} +90 -38
- package/lib/task-tree-lock.js +74 -0
- package/lib/{sessions-anchor.js → tasks-anchor.js} +8 -7
- package/lib/tokens.js +1 -1
- package/lib/types.js +2 -2
- package/package.json +8 -1
- package/dist/js/app.XBFXH37R.js +0 -2
- package/dist/js/chunk.UMQMOGWO.js +0 -1
- package/dist/js/viewer.CVWXSKJM.js +0 -1
- package/lib/session-manager.js +0 -613
- package/lib/title-service.js +0 -95
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Quote one task/path word for the shell-style task command grammar. */
|
|
2
|
+
export function quoteShellWord(word) {
|
|
3
|
+
if (/[\s"'\\]/.test(word) || word === "") {
|
|
4
|
+
return `"${word.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
5
|
+
}
|
|
6
|
+
return word;
|
|
7
|
+
}
|
|
8
|
+
/** Format a task title as a stable, shell-parseable @ reference. */
|
|
9
|
+
export function formatTaskReference(title) {
|
|
10
|
+
return `@${quoteShellWord(title)}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Format tree path segments as the absolute `@`-prefixed path the input grammar
|
|
14
|
+
* and the UI completion use. The caller decides which segments are root-relative
|
|
15
|
+
* (see `Store.getTaskPath`); this only renders them, shell-quoting as needed so
|
|
16
|
+
* the result can be pasted straight into the input.
|
|
17
|
+
*/
|
|
18
|
+
export function formatTaskPath(segments) {
|
|
19
|
+
return `@/${segments.map(quoteShellWord).join("/")}`;
|
|
20
|
+
}
|
package/lib/sse-manager.js
CHANGED
|
@@ -5,7 +5,7 @@ import { log } from "./log.js";
|
|
|
5
5
|
const slog = log.scope("sse");
|
|
6
6
|
/**
|
|
7
7
|
* SSE heartbeat frame — a NAMED event so the frontend can hook
|
|
8
|
-
* `es.addEventListener("heartbeat", ...)` and refresh its per-
|
|
8
|
+
* `es.addEventListener("heartbeat", ...)` and refresh its per-task
|
|
9
9
|
* visibility record on the server. Comment-line form (`: heartbeat\n\n`)
|
|
10
10
|
* is silently discarded by EventSource — no `onmessage` fires — which is
|
|
11
11
|
* why we use a named event instead. Riding the SSE connection's natural
|
|
@@ -41,7 +41,7 @@ export class SseManager {
|
|
|
41
41
|
/**
|
|
42
42
|
* Wire a label-map provider to enrich attachment uuid paths with
|
|
43
43
|
* user-friendly labels at egress (CLAUDE.md "Attachment label
|
|
44
|
-
* egress rewrite"). Applied per-event-
|
|
44
|
+
* egress rewrite"). Applied per-event-task inside `sendEvent`,
|
|
45
45
|
* so both `broadcast()` and direct `sendEvent()` callers (e.g.
|
|
46
46
|
* SSE Last-Event-ID replay) get enriched output. DB still stores
|
|
47
47
|
* raw events.
|
|
@@ -95,7 +95,7 @@ export class SseManager {
|
|
|
95
95
|
this.clients.set(client.id, client);
|
|
96
96
|
slog.info("connected", {
|
|
97
97
|
clientId: client.id,
|
|
98
|
-
|
|
98
|
+
taskId: client.taskId ?? "*",
|
|
99
99
|
clients: this.clients.size,
|
|
100
100
|
});
|
|
101
101
|
client.res.on("close", () => {
|
|
@@ -134,7 +134,7 @@ export class SseManager {
|
|
|
134
134
|
return;
|
|
135
135
|
let outEvent = event;
|
|
136
136
|
if (this.getLabelMap) {
|
|
137
|
-
const sid = event.
|
|
137
|
+
const sid = event.taskId;
|
|
138
138
|
if (sid) {
|
|
139
139
|
const map = this.getLabelMap(sid);
|
|
140
140
|
if (map.size > 0)
|
|
@@ -161,20 +161,20 @@ export class SseManager {
|
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Broadcast an event to all connected SSE clients.
|
|
164
|
-
* Global clients get all events. Per-
|
|
164
|
+
* Global clients get all events. Per-task clients only get events for their task.
|
|
165
165
|
*/
|
|
166
166
|
broadcast(event) {
|
|
167
|
-
const
|
|
167
|
+
const taskId = event.taskId;
|
|
168
168
|
const snapshot = [...this.clients.values()];
|
|
169
169
|
for (const client of snapshot) {
|
|
170
170
|
if (client.res.writableEnded)
|
|
171
171
|
continue;
|
|
172
|
-
if (client.
|
|
172
|
+
if (client.taskId && client.taskId !== taskId)
|
|
173
173
|
continue;
|
|
174
174
|
this.sendEvent(client, event);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
/** Broadcast global application state regardless of a client's
|
|
177
|
+
/** Broadcast global application state regardless of a client's task filter. */
|
|
178
178
|
broadcastGlobal(event) {
|
|
179
179
|
const snapshot = [...this.clients.values()];
|
|
180
180
|
for (const client of snapshot) {
|