@lelouchhe/webagent 0.9.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.
Files changed (47) hide show
  1. package/README.md +39 -14
  2. package/config.toml +7 -27
  3. package/dist/index.html +4 -4
  4. package/dist/js/app.INIQQEGD.js +5 -0
  5. package/dist/js/{chunk.S5LRNRJI.js → chunk.7WADDFJZ.js} +27 -27
  6. package/dist/js/viewer.RHZMFYWJ.js +1 -0
  7. package/dist/login.html +1 -1
  8. package/dist/share-viewer.html +5 -5
  9. package/dist/{styles.00nlhhf3.css → styles.01aj0l37.css} +19 -2
  10. package/dist/sw.js +6 -6
  11. package/lib/attachment-dispatch.js +60 -31
  12. package/lib/attachment-interceptor.js +7 -7
  13. package/lib/attachment-labels.js +1 -1
  14. package/lib/attachments.js +25 -0
  15. package/lib/auth-middleware.js +2 -2
  16. package/lib/auth.js +2 -2
  17. package/lib/bridge.js +109 -83
  18. package/lib/client-registry.js +12 -12
  19. package/lib/config.js +2 -31
  20. package/lib/event-handler.js +143 -90
  21. package/lib/files/routes.js +1 -1
  22. package/lib/mcp/capability.js +74 -0
  23. package/lib/mcp/server.js +148 -0
  24. package/lib/mcp/task-history.js +245 -0
  25. package/lib/mcp/task-host.js +253 -0
  26. package/lib/mcp/tools.js +168 -0
  27. package/lib/mode-bucket.js +1 -1
  28. package/lib/push-service.js +33 -35
  29. package/lib/routes.js +947 -489
  30. package/lib/server.js +64 -16
  31. package/lib/share/routes.js +88 -88
  32. package/lib/shared/task-reference.js +20 -0
  33. package/lib/sse-manager.js +8 -8
  34. package/lib/store.js +941 -314
  35. package/lib/task-collaboration.js +15 -0
  36. package/lib/task-manager.js +1409 -0
  37. package/lib/task-path.js +131 -0
  38. package/lib/{session-state.js → task-state.js} +64 -41
  39. package/lib/task-tree-lock.js +74 -0
  40. package/lib/{sessions-anchor.js → tasks-anchor.js} +8 -7
  41. package/lib/tokens.js +1 -1
  42. package/lib/types.js +2 -2
  43. package/package.json +7 -1
  44. package/dist/js/app.QC7IRDTP.js +0 -5
  45. package/dist/js/viewer.GP5VXAUY.js +0 -1
  46. package/lib/session-manager.js +0 -638
  47. package/lib/title-service.js +0 -95
@@ -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-session
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-session inside `sendEvent`,
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
- sessionId: client.sessionId ?? "*",
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.sessionId;
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-session clients only get events for their session.
164
+ * Global clients get all events. Per-task clients only get events for their task.
165
165
  */
166
166
  broadcast(event) {
167
- const sessionId = event.sessionId;
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.sessionId && client.sessionId !== sessionId)
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 session filter. */
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) {