owlmem 0.9.12 → 0.9.14

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 (2) hide show
  1. package/owlmem.mjs +18 -4
  2. package/package.json +1 -1
package/owlmem.mjs CHANGED
@@ -43,7 +43,7 @@ import { join, dirname, basename, relative, isAbsolute } from "node:path";
43
43
  import { fileURLToPath } from "node:url";
44
44
  import { spawn, spawnSync } from "node:child_process";
45
45
 
46
- export const VERSION = "0.9.12";
46
+ export const VERSION = "0.9.14";
47
47
  const BASE = (process.env.OWLMEM_URL || "https://owlmem.com").replace(/\/$/, "");
48
48
  const DIR = process.env.OWLMEM_HOME || join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "owlmem");
49
49
  const enc = new TextEncoder(), dec = new TextDecoder();
@@ -830,8 +830,12 @@ export const WAKE_CLIENTS = {
830
830
  // DeepSeek Harness: the headless profile answers one task (from stdin) and exits. Its own profile needs OwlMem and a model,
831
831
  // copied from the web profile (see allowDsh). On NixOS dsh must run on the official Node build: use the dsh wrapper found here.
832
832
  dsh: { name: "DeepSeek Harness", bin: "dsh", command: ["dsh", "--profile", "headless"], prompt: "stdin", home: [[".local", "bin", "dsh"]] },
833
+ // opencode run answers one prompt (an argument) and exits (0.9.13, 站长 11-03「加」). It reads stdin until it ends, so runTask
834
+ // closes stdin. Full: --auto; limited: file edits, shell and web fetches denied through OPENCODE_CONFIG_CONTENT (wakeEnv).
835
+ // Tested 11-03 against a local OwlMem with opencode 1.19.5: full did the task; limited refused a shell command and declined.
836
+ opencode: { name: "opencode", bin: "opencode", command: ["opencode", "run"], prompt: "arg", home: [[".opencode", "bin", "opencode"]] },
833
837
  };
834
- export const WAKE_APP_IDS = ["claude-code", "codex", "antigravity", "hermes", "dsh", "gemini", "custom"];
838
+ export const WAKE_APP_IDS = ["claude-code", "codex", "antigravity", "hermes", "dsh", "opencode", "gemini", "custom"];
835
839
  // Where an app's command is: on PATH, or the first of its default install places that exists (path parts under your home
836
840
  // folder, or an absolute path), used by full path
837
841
  export function wakeBin(c, home_ = home(), exists = existsSync, path = onPath) {
@@ -1231,8 +1235,16 @@ export function wakeArgv(client, command, trust) {
1231
1235
  return cmd;
1232
1236
  }
1233
1237
  if (client === "antigravity" && cmd[1] === "-p" && full) return [...cmd, "--dangerously-skip-permissions"];
1238
+ if (client === "opencode" && cmd[1] === "run" && full && !cmd.includes("--auto")) return [...cmd, "--auto"];
1234
1239
  return cmd;
1235
1240
  }
1241
+ // Settings an app takes from the environment for one run. opencode, limited: no file edits, no shell, no web (its own
1242
+ // permission keys); the OwlMem tools stay allowed, so it can still read and report.
1243
+ export function wakeEnv(client, command, trust) {
1244
+ if (client === "opencode" && command[1] === "run" && trust !== TRUST_FULL)
1245
+ return { OPENCODE_CONFIG_CONTENT: JSON.stringify({ permission: { edit: "deny", bash: "deny", webfetch: "deny" } }) };
1246
+ return {};
1247
+ }
1236
1248
  const LIMITED_NOTE = `This task came from outside the team (an alert source, the external task API, or an AI relaying one), so this run may only look and report back: read files, search and use the OwlMem tools. Don't change files, run commands that change anything, or hand work to other agents. If something needs doing, describe it in the note so a person can decide.
1237
1249
 
1238
1250
  `;
@@ -1256,7 +1268,7 @@ export async function runTask(task, cfg, o = {}) {
1256
1268
  let ch, timedOut = false, killer = null;
1257
1269
  try {
1258
1270
  ch = spawn(argv[0], argv.slice(1), { cwd: place.cwd, stdio: ["pipe", fd, fd], detached: !win, shell: win, windowsHide: true,
1259
- env: { ...Object.fromEntries(Object.entries(process.env).filter(([k]) => !k.startsWith("OWLMEM_WAKE_"))), OWLMEM_NO_BROWSER: "1", [isReply(task) ? "OWLMEM_WAKE_REPLY" : isNote(task) ? "OWLMEM_WAKE_NOTE" : "OWLMEM_WAKE_TASK"]: String(task.id) } });
1271
+ env: { ...Object.fromEntries(Object.entries(process.env).filter(([k]) => !k.startsWith("OWLMEM_WAKE_"))), ...wakeEnv(task.client, cl.command, task.trust), OWLMEM_NO_BROWSER: "1", [isReply(task) ? "OWLMEM_WAKE_REPLY" : isNote(task) ? "OWLMEM_WAKE_NOTE" : "OWLMEM_WAKE_TASK"]: String(task.id) } });
1260
1272
  } catch (e) { res({ outcome: "error", detail: "couldn't start " + argv[0] + ": " + e.message }); return; }
1261
1273
  const kill = (sig) => { try { if (win) spawnSync("taskkill", ["/T", "/F", "/PID", String(ch.pid)]); else process.kill(-ch.pid, sig); } catch { try { ch.kill(sig); } catch {} } };
1262
1274
  const timer = setTimeout(() => { timedOut = true; kill("SIGTERM"); killer = setTimeout(() => kill("SIGKILL"), 10000); }, ms);
@@ -1313,7 +1325,9 @@ export async function wakeLoop(o) {
1313
1325
  let r;
1314
1326
  try { r = await api("poll", { busy: sched.busy(), slots: sched.slots(), timeout: (cfg.timeout_min || WAKE_DEFAULTS.timeout_min) * 60, wait: 50, version: VERSION }); }
1315
1327
  catch (e) { r = { status: 0, data: { detail: e?.message || String(e) } }; }
1316
- if (r.status === 401) {
1328
+ // Only "this computer is no longer paired" removes auto-wake. Any other 401 (a signature OwlMem didn't accept this time) is
1329
+ // retried like a network error: on 11-04 one replayed request made ori remove itself and no AI on it could be woken (0.9.14).
1330
+ if (r.status === 401 && (r.data?.error === "wake_revoked" || !r.data?.error)) {
1317
1331
  log("OwlMem no longer accepts this computer for auto-wake (" + (r.data?.detail || r.data?.error || "401") + "). Removing auto-wake from this computer.");
1318
1332
  if (cleanup) cleanup();
1319
1333
  return "revoked";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owlmem",
3
- "version": "0.9.12",
3
+ "version": "0.9.14",
4
4
  "description": "OwlMem command line: connect your AI apps to OwlMem in one command (npx -y owlmem install), an end-to-end encrypted vault for your AI agents, and a local MCP server.",
5
5
  "type": "module",
6
6
  "bin": { "owlmem": "owlmem.mjs" },