agent86-web 0.0.0-stage → 0.2.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.
@@ -0,0 +1,70 @@
1
+ // A notice when a newer agent86 or agent86-web is out (docs/OPEN_QUESTIONS.md Q10). At most one
2
+ // check a day, against the npm registry, never blocking startup; any failure means no notice.
3
+ // Turned off with --no-update-check or AGENT86_WEB_NO_UPDATE_CHECK=1.
4
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
+ import { homedir } from "node:os";
6
+ import { join } from "node:path";
7
+ import { compareVersions } from "./agent86.js";
8
+ export const PACKAGES = { agent86: "agent86", agent86Web: "agent86-web" };
9
+ const DAY_MS = 24 * 60 * 60 * 1000;
10
+ const TIMEOUT_MS = 5_000;
11
+ /** Whether the environment turns the check off. */
12
+ export function updateCheckDisabled(env = process.env) {
13
+ const value = env.AGENT86_WEB_NO_UPDATE_CHECK?.trim().toLowerCase();
14
+ return !!value && value !== "0" && value !== "false";
15
+ }
16
+ async function npmLatest(pkg) {
17
+ try {
18
+ const res = await fetch(`https://registry.npmjs.org/${pkg}/latest`, {
19
+ signal: AbortSignal.timeout(TIMEOUT_MS),
20
+ headers: { accept: "application/json" },
21
+ });
22
+ if (!res.ok)
23
+ return undefined;
24
+ const version = (await res.json()).version;
25
+ return typeof version === "string" ? version : undefined;
26
+ }
27
+ catch {
28
+ return undefined;
29
+ }
30
+ }
31
+ /** The products with a newer release than the one running, by their latest version. */
32
+ export async function checkForUpdates(options) {
33
+ const now = (options.now ?? Date.now)();
34
+ const file = join(options.stateDir ?? join(homedir(), ".agent86-web"), "update-check.json");
35
+ let latest;
36
+ try {
37
+ const cache = JSON.parse(readFileSync(file, "utf8"));
38
+ if (now - cache.checkedAt < DAY_MS)
39
+ latest = cache.latest;
40
+ }
41
+ catch {
42
+ // No cache yet.
43
+ }
44
+ if (!latest) {
45
+ const lookup = options.latestVersion ?? npmLatest;
46
+ const [agent86, agent86Web] = await Promise.all([
47
+ lookup(PACKAGES.agent86),
48
+ lookup(PACKAGES.agent86Web),
49
+ ]);
50
+ latest = {};
51
+ if (agent86)
52
+ latest.agent86 = agent86;
53
+ if (agent86Web)
54
+ latest.agent86Web = agent86Web;
55
+ try {
56
+ mkdirSync(join(file, ".."), { recursive: true, mode: 0o700 });
57
+ writeFileSync(file, JSON.stringify({ checkedAt: now, latest }));
58
+ }
59
+ catch {
60
+ // Not cached; asked again next start.
61
+ }
62
+ }
63
+ const updates = {};
64
+ for (const product of Object.keys(PACKAGES)) {
65
+ const version = latest[product];
66
+ if (version && compareVersions(version, options.current[product]) > 0)
67
+ updates[product] = version;
68
+ }
69
+ return updates;
70
+ }
@@ -0,0 +1,24 @@
1
+ // The --root jail for workspaces (docs/SECURITY.md T7).
2
+ import { realpathSync } from "node:fs";
3
+ import { sep } from "node:path";
4
+ export function realpath(path) {
5
+ return realpathSync.native(path);
6
+ }
7
+ /** Whether `path` (already a real path) is `root` or inside it. */
8
+ export function within(path, root) {
9
+ if (path === root)
10
+ return true;
11
+ const prefix = root.endsWith(sep) ? root : root + sep;
12
+ return path.startsWith(prefix);
13
+ }
14
+ /** The real path of `requested` if it exists and lies inside one of `roots`, else undefined. */
15
+ export function resolveWorkspace(requested, roots) {
16
+ let real;
17
+ try {
18
+ real = realpath(requested);
19
+ }
20
+ catch {
21
+ return undefined;
22
+ }
23
+ return roots.some((root) => within(real, root)) ? real : undefined;
24
+ }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "agent86-web",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "A browser interface for agent86. Runs a local bridge between your browser and `agent86 acp`.",
5
+ "license": "MIT",
6
+ "author": "Maetek Technologies",
7
+ "type": "module",
8
+ "bin": {
9
+ "agent86-web": "./dist/cli.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "engines": {
17
+ "node": ">=20.19"
18
+ },
19
+ "keywords": [
20
+ "agent86",
21
+ "acp",
22
+ "agent-client-protocol",
23
+ "ai",
24
+ "agent"
25
+ ],
26
+ "homepage": "https://github.com/Maetek-Technologies/Agent86-web#readme",
27
+ "bugs": {
28
+ "url": "https://github.com/Maetek-Technologies/Agent86-web/issues"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/Maetek-Technologies/Agent86-web.git",
33
+ "directory": "packages/bridge"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public",
37
+ "provenance": true
38
+ },
39
+ "dependencies": {
40
+ "ws": "8.22.2"
41
+ },
42
+ "devDependencies": {
43
+ "@types/ws": "8.18.2",
44
+ "tsx": "4.23.15",
45
+ "@agent86-web/mock-agent": "0.0.0"
46
+ },
47
+ "scripts": {
48
+ "build": "node scripts/build.mjs",
49
+ "dev": "tsx watch src/cli.ts --port 8686 --dev-origin http://localhost:5173 --no-open",
50
+ "start": "node dist/cli.js",
51
+ "typecheck": "tsc --noEmit"
52
+ }
6
53
  }