agent86-web 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,8 +6,8 @@
6
6
  <meta name="referrer" content="no-referrer" />
7
7
  <link rel="icon" type="image/png" href="/favicon.png" />
8
8
  <title>agent86 web</title>
9
- <script type="module" crossorigin src="/assets/index-BbdxbUpt.js"></script>
10
- <link rel="stylesheet" crossorigin href="/assets/index-DXmOOTke.css">
9
+ <script type="module" crossorigin src="/assets/index-Dk94cR-e.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/assets/index-DGossQ_s.css">
11
11
  </head>
12
12
  <body>
13
13
  <div id="root"></div>
package/dist/sessions.js CHANGED
@@ -2,6 +2,35 @@
2
2
  // The bridge never reads agent86's database itself (docs/adr/0003-standalone-bridge.md).
3
3
  import { spawn } from "node:child_process";
4
4
  import { needsShell } from "./agent86.js";
5
+ /**
6
+ * Whether agent86 knows the session's folder. An unknown one is marked in `_meta` with a stand-in
7
+ * `cwd`: since agent86 1.0.20 as `"com.maetek.agent86/cwdKnown": false`, before that (and for a
8
+ * while beside it) as `"agent86": {"cwdKnown": false}`. The namespaced key is read first.
9
+ */
10
+ export function cwdKnown(entry) {
11
+ const meta = entry?._meta;
12
+ if (typeof meta !== "object" || meta === null)
13
+ return true;
14
+ const record = meta;
15
+ const namespaced = record["com.maetek.agent86/cwdKnown"];
16
+ if (typeof namespaced === "boolean")
17
+ return namespaced;
18
+ const old = record.agent86;
19
+ return typeof old?.cwdKnown === "boolean" ? old.cwdKnown : true;
20
+ }
21
+ /**
22
+ * A workspace's sessions from agent86's answer: its folder is not known for a marked one, so it
23
+ * belongs to no workspace and is left out (agent86 docs/ACP.md, "Session list"). A filtered list
24
+ * from agent86 1.0.17 or later has none; this keeps it so if that changes.
25
+ */
26
+ export function workspaceSessions(sessions) {
27
+ if (!Array.isArray(sessions))
28
+ return [];
29
+ return sessions.filter((s) => typeof s === "object" &&
30
+ s !== null &&
31
+ typeof s.sessionId === "string" &&
32
+ cwdKnown(s));
33
+ }
5
34
  export async function listSessions(command, args, workspace, timeoutMs = 20_000) {
6
35
  const child = spawn(command, [...args, "acp"], {
7
36
  cwd: workspace,
@@ -47,7 +76,7 @@ export async function listSessions(command, args, workspace, timeoutMs = 20_000)
47
76
  if (message.error)
48
77
  reject(new Error(message.error.message ?? "agent86 refused to list sessions"));
49
78
  else
50
- resolve(message.result?.sessions ?? []);
79
+ resolve(workspaceSessions(message.result?.sessions));
51
80
  }
52
81
  });
53
82
  send({ jsonrpc: "2.0", id: 0, method: "initialize", params: { protocolVersion: 1 } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent86-web",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "A browser interface for agent86. Runs a local bridge between your browser and `agent86 acp`.",
5
5
  "license": "MIT",
6
6
  "author": "Maetek Technologies",