owlmem 0.9.24 → 0.9.25
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 +2 -0
- package/owlmem.mjs +20 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@ npx -y owlmem wake disable # also done by npx -y owlmem uninstall
|
|
|
43
43
|
|
|
44
44
|
- **Pairing.** `wake enable` prints a link: open it, check the code matches, and pick which AI each app on this
|
|
45
45
|
computer is. Until then nothing starts. The computer is identified by its device key (next to `config.json`).
|
|
46
|
+
已登录时配对自动批准:if this computer is already logged in (`owlmem login`), pairing is approved automatically
|
|
47
|
+
and the apps are matched to your AIs by their app names — no console step.
|
|
46
48
|
- **Runs as you.** A systemd user service (Linux), a LaunchAgent (macOS) or a logon task (Windows) — this user
|
|
47
49
|
only, no admin rights. `--boot` (Linux) turns on lingering so it runs from boot, not just from login.
|
|
48
50
|
- **One program per computer** for every paired AI. One task at a time per AI, at most 2 at once (`--max`),
|
package/owlmem.mjs
CHANGED
|
@@ -44,7 +44,7 @@ import { fileURLToPath } from "node:url";
|
|
|
44
44
|
import { spawn, spawnSync } from "node:child_process";
|
|
45
45
|
import { createConnection } from "node:net";
|
|
46
46
|
|
|
47
|
-
export const VERSION = "0.9.
|
|
47
|
+
export const VERSION = "0.9.25";
|
|
48
48
|
const BASE = (process.env.OWLMEM_URL || "https://owlmem.com").replace(/\/$/, "");
|
|
49
49
|
const DIR = process.env.OWLMEM_HOME || join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "owlmem");
|
|
50
50
|
const enc = new TextEncoder(), dec = new TextDecoder();
|
|
@@ -180,6 +180,8 @@ function token() {
|
|
|
180
180
|
if (!t) throw new Fail("No token. Create one for this agent in the console (AI agents & tokens), then run: owlmem login");
|
|
181
181
|
return t;
|
|
182
182
|
}
|
|
183
|
+
// wake enable 用的 AI 令牌:环境变量没有就读 config.json(owlmem login 存的),都没有回 null,不抛错。
|
|
184
|
+
export function wakeAiToken() { return process.env.OWLMEM_TOKEN || cfg().token || null; }
|
|
183
185
|
function spaceKey(space) {
|
|
184
186
|
const p = join(DIR, "keys", space + ".key");
|
|
185
187
|
if (!existsSync(p)) throw new Fail("This machine doesn't have the space key yet. Run: owlmem vault unlock");
|
|
@@ -1714,12 +1716,12 @@ export function wakeRestart(o = {}) {
|
|
|
1714
1716
|
}
|
|
1715
1717
|
|
|
1716
1718
|
function wakeApi() {
|
|
1717
|
-
return async (sub, body) => {
|
|
1719
|
+
return async (sub, body, extra) => {
|
|
1718
1720
|
const url = BASE + "/v1/wake/" + sub;
|
|
1719
1721
|
let r;
|
|
1720
1722
|
try {
|
|
1721
1723
|
const sh = await signHeaders("POST", url, "other");
|
|
1722
|
-
r = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", "User-Agent": "owlmem-cli/" + VERSION, ...sh },
|
|
1724
|
+
r = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", "User-Agent": "owlmem-cli/" + VERSION, ...sh, ...(extra || {}) },
|
|
1723
1725
|
body: JSON.stringify(body || {}), signal: AbortSignal.timeout(90000) });
|
|
1724
1726
|
} catch (e) { return { status: 0, data: { detail: e.message } }; }
|
|
1725
1727
|
return { status: r.status, data: await r.json().catch(() => ({})) };
|
|
@@ -2145,17 +2147,20 @@ async function wakeEnable(args = []) {
|
|
|
2145
2147
|
if (h === true) say("Let Hermes report back to OwlMem when nobody is watching (entries under command_allowlist in ~/.hermes/config.yaml).");
|
|
2146
2148
|
else if (h === "manual") say("Hermes treats OwlMem as untrusted: add mcp:<server>/kb_task_update, mcp:<server>/kb_inbox and mcp:<server>/kb_send to command_allowlist in ~/.hermes/config.yaml, or it can't report back when nobody is watching.");
|
|
2147
2149
|
}
|
|
2148
|
-
const
|
|
2150
|
+
const wakeCfg = { v: 1, ...WAKE_DEFAULTS, ...old, machine: process.env.OWLMEM_DEVICE_NAME || hostname(), clients, ...(max ? { max_parallel: max } : {}), ...(timeout ? { timeout_min: timeout } : {}), boot: boot || !!old.boot };
|
|
2149
2151
|
// OwlMem knows these app names; a command you add yourself to wake.json goes under "gemini" or "custom"
|
|
2150
|
-
|
|
2152
|
+
// 本机已登录(owlmem login 存了 AI 令牌)就带上:服务端自动批准配对,不用去控制台(令牌只放 Authorization 头,不写日志)
|
|
2153
|
+
const aiToken = wakeAiToken();
|
|
2154
|
+
const r = await wakeApi()("pair", { clients: Object.keys(clients).filter((c) => WAKE_APP_IDS.includes(c)), force: again },
|
|
2155
|
+
aiToken ? { Authorization: "Bearer " + aiToken } : undefined);
|
|
2151
2156
|
if (r.status !== 200) throw new Fail("OwlMem didn't accept the pairing: " + (r.data.detail || r.data.error || "HTTP " + r.status));
|
|
2152
2157
|
mkdirSync(wakeDir(), { recursive: true });
|
|
2153
2158
|
copyFileSync(fileURLToPath(import.meta.url), join(wakeDir(), "owlmem.mjs")); // the service runs this copy (npx's cache can be cleaned out)
|
|
2154
|
-
if (r.data.status === "pending")
|
|
2155
|
-
saveWake(DIR,
|
|
2156
|
-
const a = installAutostart(autostartOpts(DIR, { boot:
|
|
2159
|
+
if (r.data.status === "pending") wakeCfg.pair_url = r.data.url; else delete wakeCfg.pair_url;
|
|
2160
|
+
saveWake(DIR, wakeCfg);
|
|
2161
|
+
const a = installAutostart(autostartOpts(DIR, { boot: wakeCfg.boot }));
|
|
2157
2162
|
say("Auto-wake is installed (" + a.kind + ": " + tilde(a.file) + ").");
|
|
2158
|
-
say("Apps it can start here: " + Object.keys(clients).map((c) => WAKE_CLIENTS[c]?.name || c).join(", ") + ". At most " +
|
|
2163
|
+
say("Apps it can start here: " + Object.keys(clients).map((c) => WAKE_CLIENTS[c]?.name || c).join(", ") + ". At most " + wakeCfg.max_parallel + " at once, " + wakeCfg.timeout_min + " minutes per task.");
|
|
2159
2164
|
if (r.data.status === "pending") {
|
|
2160
2165
|
say("\nApprove this computer in the OwlMem console and pick which AI each app is:\n\n " + r.data.url + "\n\nCheck that the console shows this code: " + r.data.code + "\nUntil then auto-wake waits and starts nothing." +
|
|
2161
2166
|
"\n(If you're an AI agent running this: send the link and the code to the person who turned auto-wake on, with kb_send.)");
|
|
@@ -2176,11 +2181,16 @@ function wakeDisable(quiet = false) {
|
|
|
2176
2181
|
});
|
|
2177
2182
|
}
|
|
2178
2183
|
|
|
2184
|
+
// wake status 的「Apps:」那行(0.9.25):只报额度的应用没有 command,写「usage only」,不碰 command。
|
|
2185
|
+
export function wakeAppsLine(clients) {
|
|
2186
|
+
return Object.entries(clients || {}).map(([k, v]) => k + " → " + ((v?.quotaOnly || WAKE_CLIENTS[k]?.quotaOnly) ? "usage only" : (v?.command || []).join(" "))).join("; ");
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2179
2189
|
async function wakeStatus() {
|
|
2180
2190
|
const cfg = loadWake(), a = autostart(autostartOpts());
|
|
2181
2191
|
if (!cfg) { say("Auto-wake isn't set up on this computer. Turn it on: npx -y owlmem wake enable"); return; }
|
|
2182
2192
|
say("Autostart: " + (existsSync(a.file) ? a.kind + " (" + tilde(a.file) + ")" : "missing"));
|
|
2183
|
-
say("Apps: " +
|
|
2193
|
+
say("Apps: " + wakeAppsLine(cfg.clients || {}));
|
|
2184
2194
|
say("At most " + cfg.max_parallel + " at once, " + cfg.timeout_min + " minutes per task. Log: " + tilde(join(wakeDir(), "wake.log")));
|
|
2185
2195
|
const r = await wakeApi()("poll", { wait: 0, slots: 0 });
|
|
2186
2196
|
if (r.status === 401) say("OwlMem: this computer isn't paired any more. Pair it again: npx -y owlmem wake enable --again");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "owlmem",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.25",
|
|
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" },
|