owlmem 0.9.15 → 0.9.16

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 +26 -3
  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.15";
46
+ export const VERSION = "0.9.16";
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();
@@ -1188,9 +1188,32 @@ Never put passwords, tokens, keys or other secrets in any message. You have ${mi
1188
1188
  `;
1189
1189
  }
1190
1190
 
1191
+ // Claude Code can message the other Claude Code sessions running on the same computer (ListAgents, SendMessage). When the
1192
+ // person is already working with this AI in a foreground session, a reply or a note belongs there: the woken run hands it
1193
+ // over and ends, instead of acting on it in a session nobody watches (站长 11-11「能不能唤醒前台会话?」——#904 的审查结果
1194
+ // 唤醒了一个后台会话,前台那个没收到). Only for work a person or the team's own AIs sent (trust full): what came from outside
1195
+ // is never relayed into a session that can do more than look.
1196
+ export function foregroundFirst(task) {
1197
+ if (task.client !== "claude-code" || task.trust !== TRUST_FULL || !(isReply(task) || isNote(task))) return "";
1198
+ const what = isReply(task) ? (task.zh ? `回信 #${task.id}(任务 #${task.task_id} 的结果)` : `reply #${task.id} (the result of task #${task.task_id})`)
1199
+ : (task.zh ? `留言 #${task.id}` : `note #${task.id}`);
1200
+ // antigravity #908 审:先转、转成功才标已读(先标已读而转失败,这封信就静默丢了);只在恰好一个本机会话时转(多个时分不清
1201
+ // 是哪个项目,转错会让别的项目的会话动手);只转述要点,不照抄原文(防带出密钥)
1202
+ if (task.zh) return `第一步:用 ListAgents 看这台电脑上有没有正在进行的其他 Claude Code 会话(前台会话,站长可能正在用)。
1203
+ - 恰好一个本机会话:用 SendMessage 把${what}转给它——开头写「奥麦自动唤醒转来:」,用你自己的话简述是谁、哪个任务、结论或要做的事,不要照抄原文,不要写任何密码、令牌、密钥。SendMessage 明确发送成功后,再用 kb_inbox 读这封信(会标成已读),然后结束:不要自己接着做,也不要再用 kb_send 发消息。
1204
+ - 没有、有好几个、ListAgents / SendMessage 用不了,或发送失败:不要标已读,照下面做。
1205
+
1206
+ `;
1207
+ return `First: call ListAgents to see whether another Claude Code session is running on this computer (a foreground session the person may be using).
1208
+ - If there is exactly one local session: pass ${what} to it with SendMessage. Start with "Forwarded by OwlMem auto-wake:" and say in your own words who, which task, and the result or what is asked; don't copy the original text and don't include any password, token or key. Only once SendMessage has clearly succeeded, read it with kb_inbox (that marks it read), then end: don't act on it yourself and don't send a kb_send message.
1209
+ - If there is none, there are several, ListAgents / SendMessage aren't available, or sending fails: don't mark it read; do as below.
1210
+
1211
+ `;
1212
+ }
1213
+
1191
1214
  export function wakePrompt(task, place, o = {}) {
1192
- if (isReply(task)) return (task.trust === TRUST_FULL ? "" : LIMITED_NOTE) + replyPrompt(task, o);
1193
- if (isNote(task)) return (task.trust === TRUST_FULL ? "" : LIMITED_NOTE) + notePrompt(task, place, o);
1215
+ if (isReply(task)) return (task.trust === TRUST_FULL ? "" : LIMITED_NOTE) + foregroundFirst(task) + replyPrompt(task, o);
1216
+ if (isNote(task)) return (task.trust === TRUST_FULL ? "" : LIMITED_NOTE) + foregroundFirst(task) + notePrompt(task, place, o);
1194
1217
  const id = task.id, mins = o.timeout_min || WAKE_DEFAULTS.timeout_min;
1195
1218
  const where = place.worktree
1196
1219
  ? `Work in ${place.cwd}. It is a separate git worktree of ${place.repo} on the branch ${place.branch}, made for this task so it doesn't collide with other work. Commit your changes on this branch only. Don't merge, rebase or push other branches, and don't touch ${place.repo} itself. Put the branch name in your result so a person can review and merge it.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owlmem",
3
- "version": "0.9.15",
3
+ "version": "0.9.16",
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" },