wyrm-mcp 8.7.2 → 8.7.4

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/dist/cloud/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import{randomBytes as A}from"node:crypto";import{writeFileSync as O}from"node:fs";import{hostname as P}from"node:os";import{resolve as L,dirname as W,join as M}from"node:path";import{fileURLToPath as F}from"node:url";import{createInterface as B}from"node:readline";import{CloudClient as d,CloudError as w,DEFAULT_BASE as v,SESSION_FILE as $,loadSession as g,saveSession as C,clearSession as k}from"./client.js";import{getMasterKey as U,keyExists as S,keyFilePath as a,decrypt as j}from"./crypto.js";import{computeMachineFp as I,classifySession as G}from"./machine-id.js";import{runSync as H,CopiedSessionError as Y}from"./sync-engine.js";import{SovereignSyncManager as q,restartIntervalMinutes as K}from"./sync-daemon.js";import{initializeLicense as J,hasFeature as z,getTier as V}from"../license.js";function b(){J(),z("cloud_backup")||(console.error("\u{F115D} Wyrm Cloud sync requires a Pro license or higher."),console.error(` Current tier: ${V()}`),console.error(" Upgrade: https://ghosts.lk/wyrm"),console.error(" Already paid? Activate your license (wyrm_license tool, or place"),console.error(" the signed JSON at ~/.wyrm/license.json) and retry."),process.exit(1))}function _(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MiB`:`${(e/(1024*1024*1024)).toFixed(2)} GiB`}function E(e){return e?new Date(e).toISOString().replace("T"," ").slice(0,16)+" UTC":"\u2014"}async function ke(e){const r=e[0],n=e.slice(1);try{switch(r){case void 0:case"help":case"--help":case"-h":return Q();case"login":return await X(n);case"logout":return await Z();case"status":return await ee();case"doctor":return oe();case"devices":return await se(n);case"sync":return await ne(n);case"daemon":return await re(n);case"export":return await ce(n);case"delete":return await le(n);case"recovery":return await ie(n);default:console.error(`Unknown subcommand: wyrm cloud ${r}`),console.error("Try `wyrm cloud help`"),process.exit(1)}}catch(s){if(s instanceof Y&&process.exit(1),s instanceof w)s.status===401?console.error("\u2718 Not authenticated. Run `wyrm cloud login`."):s.status===403?console.error(`\u2718 Forbidden: ${s.message}`):s.status===0?(console.error(`\u2718 ${s.message}`),console.error(" Check your internet connection. If wyrm.ghosts.lk is unreachable, see status at https://www.cloudflarestatus.com")):s.status===501?console.error(`\u2718 Service not configured: ${s.message}`):console.error(`\u2718 ${s.message} (HTTP ${s.status})`);else if(s instanceof Error){const t=s.message;t.includes("Not logged in")?console.error("\u2718 Not logged in. Run `wyrm cloud login`."):t.includes("Wyrm Cloud key")?console.error(`\u2718 Encryption-key error: ${t}`):console.error(`\u2718 ${t}`)}else console.error("\u2718 Unexpected error:",s);process.exit(1)}}function Q(){console.log(`\u{F115D} wyrm cloud \u2014 sync your Wyrm memory across devices
1
+ import{randomBytes as A}from"node:crypto";import{writeFileSync as L}from"node:fs";import{hostname as O}from"node:os";import{resolve as P,dirname as W,join as M}from"node:path";import{fileURLToPath as F}from"node:url";import{createInterface as B}from"node:readline";import{CloudClient as u,CloudError as w,DEFAULT_BASE as v,SESSION_FILE as $,loadSession as g,saveSession as C,clearSession as k}from"./client.js";import{getMasterKey as U,keyExists as b,keyFilePath as d,decrypt as j}from"./crypto.js";import{computeMachineFp as D,classifySession as G}from"./machine-id.js";import{runSync as H,CopiedSessionError as Y}from"./sync-engine.js";import{SovereignSyncManager as q,restartIntervalMinutes as K}from"./sync-daemon.js";import{initializeLicense as J,hasFeature as z,getTier as V}from"../license.js";function S(){J(),z("cloud_backup")||(console.error("\u{F115D} Wyrm Cloud sync requires a Pro license or higher."),console.error(` Current tier: ${V()}`),console.error(" Upgrade: https://ghosts.lk/wyrm"),console.error(" Already paid? Activate your license (wyrm_license tool, or place"),console.error(" the signed JSON at ~/.wyrm/license.json) and retry."),process.exit(1))}function _(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MiB`:`${(e/(1024*1024*1024)).toFixed(2)} GiB`}function x(e){return e?new Date(e).toISOString().replace("T"," ").slice(0,16)+" UTC":"\u2014"}async function be(e){const r=e[0],s=e.slice(1);try{switch(r){case void 0:case"help":case"--help":case"-h":return Q();case"login":return await X(s);case"logout":return await Z();case"status":return await ee();case"doctor":return oe();case"devices":return await se(s);case"sync":return await te(s);case"daemon":return await ce(s);case"export":return await le(s);case"delete":return await ie(s);case"recovery":return await ae(s);default:console.error(`Unknown subcommand: wyrm cloud ${r}`),console.error("Try `wyrm cloud help`"),process.exit(1)}}catch(n){if(n instanceof Y&&process.exit(1),n instanceof w)n.status===401?console.error("\u2718 Not authenticated. Run `wyrm cloud login`."):n.status===403?console.error(`\u2718 Forbidden: ${n.message}`):n.status===0?(console.error(`\u2718 ${n.message}`),console.error(" Check your internet connection. If wyrm.ghosts.lk is unreachable, see status at https://www.cloudflarestatus.com")):n.status===501?console.error(`\u2718 Service not configured: ${n.message}`):console.error(`\u2718 ${n.message} (HTTP ${n.status})`);else if(n instanceof Error){const t=n.message;t.includes("Not logged in")?console.error("\u2718 Not logged in. Run `wyrm cloud login`."):t.includes("Wyrm Cloud key")?console.error(`\u2718 Encryption-key error: ${t}`):console.error(`\u2718 ${t}`)}else console.error("\u2718 Unexpected error:",n);process.exit(1)}}function Q(){console.log(`\u{F115D} wyrm cloud \u2014 sync your Wyrm memory across devices
2
2
 
3
3
  USAGE:
4
4
  wyrm cloud <subcommand> [args]
@@ -7,8 +7,9 @@ SUBCOMMANDS:
7
7
  login Authenticate via Google or GitHub. Opens a browser flow.
8
8
  logout Revoke this session (server-side and local).
9
9
  status Show account, tier, storage, and registered devices.
10
- devices List devices on this account.
11
- devices revoke <id> Revoke a specific device.
10
+ devices [--full] List devices on this account. --full prints whole ids.
11
+ devices revoke <id> Revoke a specific device. <id> may be a full uuid or any
12
+ unambiguous prefix, e.g. the 8-char form shown by list.
12
13
  sync [--dry-run] [--all] [--force]
13
14
  Push local cross-project rows + pull peer deltas.
14
15
  --all syncs every semantic table (ignores
@@ -36,6 +37,6 @@ CONSTITUTION:
36
37
 
37
38
  DOMAIN:
38
39
  https://wyrm.ghosts.lk
39
- `)}async function X(e){const r=g();if(r)try{await new d(r.base,r.session).me(),console.error("Already logged in. Run `wyrm cloud logout` first to switch accounts."),process.exit(1)}catch(c){c instanceof w&&c.status===401||(console.error("Already logged in. Run `wyrm cloud logout` first to switch accounts."),process.exit(1)),console.log("Previous session expired; starting a fresh login."),k()}const n=new d(v),s=A(32).toString("hex");let t;try{t=await n.cliInit(s)}catch(c){console.error(`\u2718 Could not start login: ${c instanceof Error?c.message:c}`),process.exit(1)}console.log(""),console.log("\u{F115D} Sign in to Wyrm Cloud"),console.log(""),console.log(" 1. Open this URL on any device:"),console.log(` ${t.browser_url}`),console.log(""),console.log(" 2. Type this code when prompted:"),console.log(` ${t.code}`),console.log(""),console.log(" 3. Sign in with Google or GitHub."),console.log(""),console.log(` Waiting (expires in ${Math.round(t.expires_in_sec/60)} min)\u2026`);const l=Date.now()+t.expires_in_sec*1e3;let i,u;for(;Date.now()<l;){await new Promise(c=>{setTimeout(c,3e3)});try{const c=await n.cliPoll(s);if(c.ready&&c.session){i=c.session,u=c.account_id;break}}catch(c){console.error(`
40
- \u2718 Login failed: ${c instanceof Error?c.message:c}`),process.exit(1)}}(!i||!u)&&(console.error("\n\u2718 Login timed out. Run `wyrm cloud login` again."),process.exit(1)),C({base:v,session:i,account_id:u,created_at:Date.now()});const y=new d(v,i);let p="";try{p=(await y.me()).account.email}catch{}const f=`${P()} (${process.platform})`;let m;try{m=(await y.registerDevice(f)).device.id;const h=g();h&&C({...h,email:p,device_id:m,device_name:f,machine_fp:I()})}catch(c){console.error(`
41
- \u26A0 Logged in but could not register device: ${c instanceof Error?c.message:c}`),console.error(" Re-run `wyrm cloud login` to retry.");return}console.log(""),console.log(`\u2713 Signed in as ${p}`),console.log(`\u2713 Device registered: ${f}`),console.log(`\u2713 Session saved to ${$}`);const R=!S();if(U(),R?(console.log(`\u2713 Encryption key generated at ${a()} (0600)`),console.log(""),console.log(" \u26A0 Back up the key file. Losing it means losing access to your synced data."),console.log(" The Wyrm Cloud server CANNOT recover it \u2014 that's the operator-owns-data"),console.log(" guarantee. Run `wyrm cloud recovery show` now to get a 24-word phrase,"),console.log(" or copy the key file to a password manager / encrypted backup.")):console.log(`\u2713 Encryption key reused from ${a()}`),m)try{const c=await y.syncStatus();if(c.deltas>0){const x=(await y.syncPull(m,0,1)).deltas[0];if(x){let T=!0;try{j(x.payload_b64)}catch{T=!1}T||(console.log(""),console.log(" \u26A0 THIS DEVICE CANNOT READ THE ACCOUNT'S DATA YET"),console.log(` Login succeeded, but the key at ${a()} cannot decrypt`),console.log(` the ${c.deltas} delta(s) already on this account. They were encrypted`),console.log(" with a different master key (e.g. this is an org account whose other"),console.log(" devices hold the shared key). Until the keys match, sync will move"),console.log(" 0 rows in BOTH directions \u2014 a connected pipe that carries nothing."),console.log(""),console.log(" Fix: adopt the account key on this device \u2014"),console.log(" wyrm cloud recovery restore (needs the account's 24-word phrase)"),console.log(` Heads-up: restore OVERWRITES ${a()}. If this device also has`),console.log(" its OWN separate cloud data, back that key up first, or run the org"),console.log(" sync under a separate WYRM home so both keys coexist."))}}}catch{}console.log(""),console.log("Next: `wyrm cloud sync` to push your memory.")}async function Z(){const e=g();if(!e){console.log("Not logged in.");return}try{await new d(e.base,e.session).logout(),console.log("\u2713 Session revoked server-side.")}catch(r){console.error(`\u26A0 Could not revoke server-side: ${r instanceof Error?r.message:r}`),console.error(" Local session cleared anyway.")}k(),console.log(`\u2713 Local session removed (${$}).`),console.log(" Note: ~/.wyrm/cloud.key kept. Delete manually if you want a clean slate.")}async function ee(){const e=g();if(!e){console.log("Not logged in. Run `wyrm cloud login`.");return}const r=new d(e.base,e.session);try{const n=await r.me(),s=await r.syncStatus();console.log(""),console.log(`\u{F115D} Wyrm Cloud \u2014 ${n.account.email}`),console.log(""),console.log(` Tier: ${s.tier}`),console.log(` Storage: ${_(s.storage.used_bytes)} / ${_(s.storage.limit_bytes)} (${s.storage.percent}%)`),console.log(` Deltas: ${s.deltas}`),console.log(` Devices: ${s.devices}`),console.log(` Providers:${n.identities.map(t=>" "+t.provider).join(",")}`),console.log(""),console.log(` This machine: ${e.device_name??"(not registered)"}`),console.log(` Device ID: ${e.device_id?e.device_id.slice(0,8)+"\u2026":"(none)"}`),console.log(` Session age: ${Math.round((Date.now()-e.created_at)/(1440*60*1e3))} day(s)`),D(e),console.log(""),S()?s.deltas>0&&(console.log(` Key: ${a()} (0600)`),console.log(` \u26A0 Back this file up. Losing it = losing access to your ${s.deltas} deltas.`),console.log("")):(console.log(" \u26A0 ENCRYPTION KEY MISSING"),console.log(` Expected at: ${a()}`),console.log(" Without this file, deltas already pushed cannot be decrypted."),console.log(" If you have a backup, restore it before running sync."),console.log(""))}catch(n){throw n instanceof w&&n.status===401&&(console.error("Session expired or invalid. Run `wyrm cloud login` again."),process.exit(1)),n}}function D(e){const r=G(e.machine_fp);r.state==="match"?console.log(" Identity: \u2713 machine fingerprint matches (not a copied session)"):r.state==="adopt"?console.log(" Identity: \u2014 no fingerprint yet (pre-7.0.3 session; adopted on next sync)"):(console.log(" Identity: \u26A0 FINGERPRINT MISMATCH \u2014 this session looks COPIED"),console.log(` stored ${r.stored.slice(0,12)}\u2026 vs this machine ${r.current.slice(0,12)}\u2026`),console.log(" device_id collision \u2192 cross-device pull returns 0 silently."),console.log(" Fix: rm ~/.wyrm/cloud.json ~/.wyrm/cloud-cursor.json (KEEP cloud.key),"),console.log(" then `wyrm cloud login`. (Or `wyrm cloud sync --force` if intended.)"))}function oe(){const e=g();if(console.log(""),console.log("\u{F115D} Wyrm Cloud \u2014 device identity doctor"),console.log(""),!e){console.log(" Not logged in. Run `wyrm cloud login`."),console.log("");return}console.log(` Account: ${e.email??e.account_id.slice(0,8)+"\u2026"}`),console.log(` Device ID: ${e.device_id?e.device_id.slice(0,8)+"\u2026":"(none \u2014 re-run `wyrm cloud login`)"}`),console.log(` Server: ${e.base}`),console.log(` Stored fp: ${e.machine_fp?e.machine_fp.slice(0,12)+"\u2026":"(none \u2014 pre-7.0.3 session)"}`),console.log(` This box fp: ${I().slice(0,12)}\u2026`),D(e),console.log(""),console.log(" Only ~/.wyrm/cloud.key is meant to be shared across your machines."),console.log(" cloud.json + cloud-cursor.json + machine-id are per-device."),console.log("")}async function se(e){const r=e[0],n=d.fromSession();if(r==="revoke"){const l=e[1];l||(console.error("Usage: wyrm cloud devices revoke <device-id>"),process.exit(1)),await n.revokeDevice(l),console.log(`\u2713 Device ${l.slice(0,8)}\u2026 revoked.`);return}const{devices:s}=await n.listDevices(),o=g()?.device_id;console.log(""),console.log(`\u{F115D} Devices (${s.length})`),console.log("");for(const l of s){const i=l.id===o?"\u2605":" ",u=l.revoked?"(revoked)":"";console.log(` ${i} ${l.id.slice(0,8)}\u2026 ${l.name.padEnd(30)} last_seen=${E(l.last_seen_at)} ${u}`)}console.log(""),console.log(" \u2605 = this machine"),console.log(" Revoke: wyrm cloud devices revoke <device-id>"),console.log("")}async function ne(e){b();const r=e.includes("--dry-run"),n=e.includes("--all"),s=e.includes("--force");S()||(console.error("\u26A0 Encryption key not found at",a()),console.error(" A new key will be generated, but it will NOT decrypt deltas"),console.error(" pushed by other devices using a different key. If you have a backup,"),console.error(" restore it to ~/.wyrm/cloud.key (0600) before running sync."),console.error(" Continuing in 5 seconds \u2014 press Ctrl+C to abort."),await new Promise(o=>{setTimeout(o,5e3)})),n&&(console.log("\u{1F310} --all mode: syncing every semantic table (ignoring visibility flags)."),console.log(" Skipped: per-device logs, FTS shadows, sync internals."),console.log(""));const t=await H({dryRun:r,all:n,force:s});if(console.log(""),console.log("\u{F115D} Sync complete"),console.log(""),console.log(` Pushed: ${t.pushed} row(s)${r?" (dry run)":""}`),console.log(` Pulled: ${t.pulled} row(s)`),console.log(` Deleted: ${t.deleted_local} row(s) (peer tombstones)`),t.quarantined&&t.quarantined>0&&console.log(` Quarantined: ${t.quarantined} undecryptable delta(s) set aside (see errors)`),t.errors.length>0){console.log(""),console.log(" Errors:");for(const o of t.errors)console.log(` - ${o}`)}console.log("")}function te(){const e=M(W(F(import.meta.url)),"sync-daemon-entrypoint.js");return new q(e)}async function re(e){b();const r=e[0]??"status",n=e.find(o=>o.startsWith("--interval="));let s;if(n){const o=Number(n.split("=")[1]);(!Number.isFinite(o)||o<=0)&&(console.error("\u2716 --interval= expects a positive number of minutes, got "+JSON.stringify(n)),process.exit(1)),s=o}const t=te();switch(r){case"start":{g()||(console.error("\u2718 Not logged in. Run `wyrm cloud login` first."),process.exit(1));const o=t.start({interval_minutes:s});o.ok||(console.error(`\u{F115D} sovereign-sync daemon: ${o.reason??"failed to start"}${o.pid?` (pid ${o.pid})`:""}`),process.exit(o.pid?0:1)),console.log(`\u{F115D} \u2713 sovereign-sync daemon started (pid ${o.pid}). Logs: ~/.wyrm/wyrm-sovereign-sync.log`);return}case"stop":{const o=t.stop();console.log(o.ok?"\u{F115D} \u2713 sovereign-sync daemon stopped":`\u{F115D} sovereign-sync daemon: ${o.reason??"failed to stop"}`);return}case"restart":{const o=K(s,t.status().state?.interval_ms);t.stop(),await new Promise(i=>{setTimeout(i,500)});const l=t.start({interval_minutes:o});console.log(l.ok?`\u{F115D} \u2713 sovereign-sync daemon restarted (pid ${l.pid}, every ${o} min)`:`\u{F115D} restart failed: ${l.reason??"unknown"}`);return}case"status":{const o=t.status();console.log("\u{F115D} Sovereign-sync daemon"),console.log(` Running: ${o.running?`\u2713 yes (pid ${o.pid})`:"\u2717 no"}`),o.state?.interval_ms&&console.log(` Interval: every ${o.state.interval_ms/6e4} min`),o.state?.started_ts&&console.log(` Started: ${E(o.state.started_ts)}`),o.state?.last_tick_ts&&(console.log(` Last tick: ${E(o.state.last_tick_ts)} (exit ${o.state.last_tick_exit??"\u2014"})`),o.state.last_tick_summary&&console.log(` Last result: ${o.state.last_tick_summary}`));return}default:console.error(`Unknown daemon action: ${r}. Use: start, stop, restart, status`),process.exit(1)}}async function ce(e){b();const r=d.fromSession(),n=e.find(l=>!l.startsWith("-")),s=L(n??`wyrm-cloud-export-${new Date().toISOString().slice(0,10)}.json`);console.log(" Fetching account export\u2026");const t=await r.accountExport(),o=JSON.stringify(t,null,2);O(s,o,{mode:384}),console.log(""),console.log(`\u2713 Exported to ${s}`),console.log(""),console.log(` Account: ${t.account.email} (${t.account.id.slice(0,8)}\u2026)`),console.log(` Devices: ${t.devices.length}`),console.log(` Identities: ${t.identities.length}`),console.log(` Orgs: ${t.orgs.length}`),console.log(` Deltas: ${t.deltas.length}`),console.log(` Size: ${_(o.length)}`),console.log(""),console.log(" Deltas are still AES-256-GCM ciphertext. To decrypt them you"),console.log(` need the key at ${a()}. Back that up alongside this file.`),console.log("")}async function le(e){e.includes("--confirm")||(console.error("\u2718 This permanently deletes your Wyrm Cloud account."),console.error(" Re-run with --confirm to proceed:"),console.error(" wyrm cloud delete --confirm"),process.exit(1));const n=g();n||(console.error("\u2718 Not logged in. Nothing to delete."),process.exit(1)),console.log(""),console.log("\u26A0 You are about to PERMANENTLY DELETE your Wyrm Cloud account."),console.log(""),console.log(` Account: ${n.email??n.account_id}`),console.log(` Server: ${n.base}`),console.log(""),console.log(" This wipes all encrypted blobs, devices, identities, and org"),console.log(" memberships you own. The local ~/.wyrm/cloud.key is kept so"),console.log(" any backups remain decryptable. This action CANNOT be undone."),console.log(""),(await N(' Type "DELETE my account" to confirm: ')).trim()!=="DELETE my account"&&(console.error("\u2718 Confirmation phrase did not match. Aborting."),process.exit(1)),await new d(n.base,n.session).accountDelete(),k(),console.log(""),console.log("\u2713 Account deleted on server."),console.log(`\u2713 Local session removed (${$}).`),console.log(` Kept: ${a()} (in case you need to decrypt an old export).`),console.log("")}function N(e){return new Promise(r=>{const n=B({input:process.stdin,output:process.stdout});n.question(e,s=>{n.close(),r(s)})})}async function ie(e){const r=e[0];if(r==="show"){const{keyToMnemonic:n}=await import("./recovery.js"),t=n().split(" ");console.log(""),console.log("\u{1F511} Wyrm Cloud recovery phrase (BIP39, 24 words)"),console.log("");for(let o=0;o<4;o++){const l=t.slice(o*6,o*6+6).map((i,u)=>`${String(o*6+u+1).padStart(2)}. ${i.padEnd(10)}`).join(" ");console.log(` ${l}`)}console.log(""),console.log(" Write these down on PAPER and keep them somewhere safe."),console.log(" Anyone with this phrase can decrypt your synced Wyrm memory."),console.log(" Wyrm Cloud has NO COPY of this. Lose it = lose your data."),console.log("");return}if(r==="restore"){const n=e.includes("--overwrite");console.log(""),console.log("\u{1F511} Restore master key from BIP39 recovery phrase"),console.log(""),console.log(" Enter your 24 words separated by spaces (case-insensitive)."),console.log(" Press Enter when done."),console.log("");const s=await N(" > "),{mnemonicToKey:t}=await import("./recovery.js"),{path:o,overwrote:l}=t(s,{overwrite:n});console.log(""),console.log(`\u2713 Master key restored to ${o} (0600)`),l&&console.log(" Replaced existing key (you passed --overwrite)."),console.log(" Run `wyrm cloud sync` to pull deltas with the restored key."),console.log("");return}console.error("Usage:"),console.error(" wyrm cloud recovery show"),console.error(" wyrm cloud recovery restore [--overwrite]"),process.exit(1)}export{ke as cmdCloud};
40
+ `)}async function X(e){const r=g();if(r)try{await new u(r.base,r.session).me(),console.error("Already logged in. Run `wyrm cloud logout` first to switch accounts."),process.exit(1)}catch(c){c instanceof w&&c.status===401||(console.error("Already logged in. Run `wyrm cloud logout` first to switch accounts."),process.exit(1)),console.log("Previous session expired; starting a fresh login."),k()}const s=new u(v),n=A(32).toString("hex");let t;try{t=await s.cliInit(n)}catch(c){console.error(`\u2718 Could not start login: ${c instanceof Error?c.message:c}`),process.exit(1)}console.log(""),console.log("\u{F115D} Sign in to Wyrm Cloud"),console.log(""),console.log(" 1. Open this URL on any device:"),console.log(` ${t.browser_url}`),console.log(""),console.log(" 2. Type this code when prompted:"),console.log(` ${t.code}`),console.log(""),console.log(" 3. Sign in with Google or GitHub."),console.log(""),console.log(` Waiting (expires in ${Math.round(t.expires_in_sec/60)} min)\u2026`);const l=Date.now()+t.expires_in_sec*1e3;let i,a;for(;Date.now()<l;){await new Promise(c=>{setTimeout(c,3e3)});try{const c=await s.cliPoll(n);if(c.ready&&c.session){i=c.session,a=c.account_id;break}}catch(c){console.error(`
41
+ \u2718 Login failed: ${c instanceof Error?c.message:c}`),process.exit(1)}}(!i||!a)&&(console.error("\n\u2718 Login timed out. Run `wyrm cloud login` again."),process.exit(1)),C({base:v,session:i,account_id:a,created_at:Date.now()});const y=new u(v,i);let m="";try{m=(await y.me()).account.email}catch{}const f=`${O()} (${process.platform})`;let p;try{p=(await y.registerDevice(f)).device.id;const h=g();h&&C({...h,email:m,device_id:p,device_name:f,machine_fp:D()})}catch(c){console.error(`
42
+ \u26A0 Logged in but could not register device: ${c instanceof Error?c.message:c}`),console.error(" Re-run `wyrm cloud login` to retry.");return}console.log(""),console.log(`\u2713 Signed in as ${m}`),console.log(`\u2713 Device registered: ${f}`),console.log(`\u2713 Session saved to ${$}`);const R=!b();if(U(),R?(console.log(`\u2713 Encryption key generated at ${d()} (0600)`),console.log(""),console.log(" \u26A0 Back up the key file. Losing it means losing access to your synced data."),console.log(" The Wyrm Cloud server CANNOT recover it \u2014 that's the operator-owns-data"),console.log(" guarantee. Run `wyrm cloud recovery show` now to get a 24-word phrase,"),console.log(" or copy the key file to a password manager / encrypted backup.")):console.log(`\u2713 Encryption key reused from ${d()}`),p)try{const c=await y.syncStatus();if(c.deltas>0){const E=(await y.syncPull(p,0,1)).deltas[0];if(E){let T=!0;try{j(E.payload_b64)}catch{T=!1}T||(console.log(""),console.log(" \u26A0 THIS DEVICE CANNOT READ THE ACCOUNT'S DATA YET"),console.log(` Login succeeded, but the key at ${d()} cannot decrypt`),console.log(` the ${c.deltas} delta(s) already on this account. They were encrypted`),console.log(" with a different master key (e.g. this is an org account whose other"),console.log(" devices hold the shared key). Until the keys match, sync will move"),console.log(" 0 rows in BOTH directions \u2014 a connected pipe that carries nothing."),console.log(""),console.log(" Fix: adopt the account key on this device \u2014"),console.log(" wyrm cloud recovery restore (needs the account's 24-word phrase)"),console.log(` Heads-up: restore OVERWRITES ${d()}. If this device also has`),console.log(" its OWN separate cloud data, back that key up first, or run the org"),console.log(" sync under a separate WYRM home so both keys coexist."))}}}catch{}console.log(""),console.log("Next: `wyrm cloud sync` to push your memory.")}async function Z(){const e=g();if(!e){console.log("Not logged in.");return}try{await new u(e.base,e.session).logout(),console.log("\u2713 Session revoked server-side.")}catch(r){console.error(`\u26A0 Could not revoke server-side: ${r instanceof Error?r.message:r}`),console.error(" Local session cleared anyway.")}k(),console.log(`\u2713 Local session removed (${$}).`),console.log(" Note: ~/.wyrm/cloud.key kept. Delete manually if you want a clean slate.")}async function ee(){const e=g();if(!e){console.log("Not logged in. Run `wyrm cloud login`.");return}const r=new u(e.base,e.session);try{const s=await r.me(),n=await r.syncStatus();console.log(""),console.log(`\u{F115D} Wyrm Cloud \u2014 ${s.account.email}`),console.log(""),console.log(` Tier: ${n.tier}`),console.log(` Storage: ${_(n.storage.used_bytes)} / ${_(n.storage.limit_bytes)} (${n.storage.percent}%)`),console.log(` Deltas: ${n.deltas}`),console.log(` Devices: ${n.devices}`),console.log(` Providers:${s.identities.map(t=>" "+t.provider).join(",")}`),console.log(""),console.log(` This machine: ${e.device_name??"(not registered)"}`),console.log(` Device ID: ${e.device_id?e.device_id.slice(0,8)+"\u2026":"(none)"}`),console.log(` Session age: ${Math.round((Date.now()-e.created_at)/(1440*60*1e3))} day(s)`),I(e),console.log(""),b()?n.deltas>0&&(console.log(` Key: ${d()} (0600)`),console.log(` \u26A0 Back this file up. Losing it = losing access to your ${n.deltas} deltas.`),console.log("")):(console.log(" \u26A0 ENCRYPTION KEY MISSING"),console.log(` Expected at: ${d()}`),console.log(" Without this file, deltas already pushed cannot be decrypted."),console.log(" If you have a backup, restore it before running sync."),console.log(""))}catch(s){throw s instanceof w&&s.status===401&&(console.error("Session expired or invalid. Run `wyrm cloud login` again."),process.exit(1)),s}}function I(e){const r=G(e.machine_fp);r.state==="match"?console.log(" Identity: \u2713 machine fingerprint matches (not a copied session)"):r.state==="adopt"?console.log(" Identity: \u2014 no fingerprint yet (pre-7.0.3 session; adopted on next sync)"):(console.log(" Identity: \u26A0 FINGERPRINT MISMATCH \u2014 this session looks COPIED"),console.log(` stored ${r.stored.slice(0,12)}\u2026 vs this machine ${r.current.slice(0,12)}\u2026`),console.log(" device_id collision \u2192 cross-device pull returns 0 silently."),console.log(" Fix: rm ~/.wyrm/cloud.json ~/.wyrm/cloud-cursor.json (KEEP cloud.key),"),console.log(" then `wyrm cloud login`. (Or `wyrm cloud sync --force` if intended.)"))}function oe(){const e=g();if(console.log(""),console.log("\u{F115D} Wyrm Cloud \u2014 device identity doctor"),console.log(""),!e){console.log(" Not logged in. Run `wyrm cloud login`."),console.log("");return}console.log(` Account: ${e.email??e.account_id.slice(0,8)+"\u2026"}`),console.log(` Device ID: ${e.device_id?e.device_id.slice(0,8)+"\u2026":"(none \u2014 re-run `wyrm cloud login`)"}`),console.log(` Server: ${e.base}`),console.log(` Stored fp: ${e.machine_fp?e.machine_fp.slice(0,12)+"\u2026":"(none \u2014 pre-7.0.3 session)"}`),console.log(` This box fp: ${D().slice(0,12)}\u2026`),I(e),console.log(""),console.log(" Only ~/.wyrm/cloud.key is meant to be shared across your machines."),console.log(" cloud.json + cloud-cursor.json + machine-id are per-device."),console.log("")}async function se(e){const r=e[0],s=u.fromSession();if(r==="revoke"){const i=e[1];i||(console.error("Usage: wyrm cloud devices revoke <device-id>"),process.exit(1));const a=await ne(s,i);await s.revokeDevice(a),console.log(`\u2713 Device ${a.slice(0,8)}\u2026 revoked.`);return}const n=e.includes("--full"),{devices:t}=await s.listDevices(),l=g()?.device_id;console.log(""),console.log(`\u{F115D} Devices (${t.length})`),console.log("");for(const i of t){const a=i.id===l?"\u2605":" ",y=i.revoked?"(revoked)":"",m=n?i.id:`${i.id.slice(0,8)}\u2026`;console.log(` ${a} ${m} ${i.name.padEnd(30)} last_seen=${x(i.last_seen_at)} ${y}`)}console.log(""),console.log(" \u2605 = this machine"),console.log(" Revoke: wyrm cloud devices revoke <device-id> (an id prefix as shown above is fine)"),n||console.log(" Full ids: wyrm cloud devices --full"),console.log("")}async function ne(e,r){const s=r.replace(/[….]+$/,"").trim().toLowerCase(),{devices:n}=await e.listDevices(),t=n.find(l=>l.id.toLowerCase()===s);if(t)return t.id;const o=n.filter(l=>l.id.toLowerCase().startsWith(s));if(o.length===1)return o[0].id;o.length===0&&(console.error(`\u2718 No device matches "${r}". List them with: wyrm cloud devices`),process.exit(1)),console.error(`\u2718 "${r}" is ambiguous \u2014 it matches ${o.length} devices:`);for(const l of o)console.error(` ${l.id} ${l.name}`);console.error(" Re-run with more characters, or the full id."),process.exit(1)}async function te(e){S();const r=e.includes("--dry-run"),s=e.includes("--all"),n=e.includes("--force");b()||(console.error("\u26A0 Encryption key not found at",d()),console.error(" A new key will be generated, but it will NOT decrypt deltas"),console.error(" pushed by other devices using a different key. If you have a backup,"),console.error(" restore it to ~/.wyrm/cloud.key (0600) before running sync."),console.error(" Continuing in 5 seconds \u2014 press Ctrl+C to abort."),await new Promise(o=>{setTimeout(o,5e3)})),s&&(console.log("\u{1F310} --all mode: syncing every semantic table (ignoring visibility flags)."),console.log(" Skipped: per-device logs, FTS shadows, sync internals."),console.log(""));const t=await H({dryRun:r,all:s,force:n});if(console.log(""),console.log("\u{F115D} Sync complete"),console.log(""),console.log(` Pushed: ${t.pushed} row(s)${r?" (dry run)":""}`),console.log(` Pulled: ${t.pulled} row(s)`),console.log(` Deleted: ${t.deleted_local} row(s) (peer tombstones)`),t.quarantined&&t.quarantined>0&&console.log(` Quarantined: ${t.quarantined} undecryptable delta(s) set aside (see errors)`),t.errors.length>0){console.log(""),console.log(" Errors:");for(const o of t.errors)console.log(` - ${o}`)}console.log("")}function re(){const e=M(W(F(import.meta.url)),"sync-daemon-entrypoint.js");return new q(e)}async function ce(e){S();const r=e[0]??"status",s=e.find(o=>o.startsWith("--interval="));let n;if(s){const o=Number(s.split("=")[1]);(!Number.isFinite(o)||o<=0)&&(console.error("\u2716 --interval= expects a positive number of minutes, got "+JSON.stringify(s)),process.exit(1)),n=o}const t=re();switch(r){case"start":{g()||(console.error("\u2718 Not logged in. Run `wyrm cloud login` first."),process.exit(1));const o=t.start({interval_minutes:n});o.ok||(console.error(`\u{F115D} sovereign-sync daemon: ${o.reason??"failed to start"}${o.pid?` (pid ${o.pid})`:""}`),process.exit(o.pid?0:1)),console.log(`\u{F115D} \u2713 sovereign-sync daemon started (pid ${o.pid}). Logs: ~/.wyrm/wyrm-sovereign-sync.log`);return}case"stop":{const o=t.stop();console.log(o.ok?"\u{F115D} \u2713 sovereign-sync daemon stopped":`\u{F115D} sovereign-sync daemon: ${o.reason??"failed to stop"}`);return}case"restart":{const o=K(n,t.status().state?.interval_ms);t.stop(),await new Promise(i=>{setTimeout(i,500)});const l=t.start({interval_minutes:o});console.log(l.ok?`\u{F115D} \u2713 sovereign-sync daemon restarted (pid ${l.pid}, every ${o} min)`:`\u{F115D} restart failed: ${l.reason??"unknown"}`);return}case"status":{const o=t.status();console.log("\u{F115D} Sovereign-sync daemon"),console.log(` Running: ${o.running?`\u2713 yes (pid ${o.pid})`:"\u2717 no"}`),o.state?.interval_ms&&console.log(` Interval: every ${o.state.interval_ms/6e4} min`),o.state?.started_ts&&console.log(` Started: ${x(o.state.started_ts)}`),o.state?.last_tick_ts&&(console.log(` Last tick: ${x(o.state.last_tick_ts)} (exit ${o.state.last_tick_exit??"\u2014"})`),o.state.last_tick_summary&&console.log(` Last result: ${o.state.last_tick_summary}`));return}default:console.error(`Unknown daemon action: ${r}. Use: start, stop, restart, status`),process.exit(1)}}async function le(e){S();const r=u.fromSession(),s=e.find(l=>!l.startsWith("-")),n=P(s??`wyrm-cloud-export-${new Date().toISOString().slice(0,10)}.json`);console.log(" Fetching account export\u2026");const t=await r.accountExport(),o=JSON.stringify(t,null,2);L(n,o,{mode:384}),console.log(""),console.log(`\u2713 Exported to ${n}`),console.log(""),console.log(` Account: ${t.account.email} (${t.account.id.slice(0,8)}\u2026)`),console.log(` Devices: ${t.devices.length}`),console.log(` Identities: ${t.identities.length}`),console.log(` Orgs: ${t.orgs.length}`),console.log(` Deltas: ${t.deltas.length}`),console.log(` Size: ${_(o.length)}`),console.log(""),console.log(" Deltas are still AES-256-GCM ciphertext. To decrypt them you"),console.log(` need the key at ${d()}. Back that up alongside this file.`),console.log("")}async function ie(e){e.includes("--confirm")||(console.error("\u2718 This permanently deletes your Wyrm Cloud account."),console.error(" Re-run with --confirm to proceed:"),console.error(" wyrm cloud delete --confirm"),process.exit(1));const s=g();s||(console.error("\u2718 Not logged in. Nothing to delete."),process.exit(1)),console.log(""),console.log("\u26A0 You are about to PERMANENTLY DELETE your Wyrm Cloud account."),console.log(""),console.log(` Account: ${s.email??s.account_id}`),console.log(` Server: ${s.base}`),console.log(""),console.log(" This wipes all encrypted blobs, devices, identities, and org"),console.log(" memberships you own. The local ~/.wyrm/cloud.key is kept so"),console.log(" any backups remain decryptable. This action CANNOT be undone."),console.log(""),(await N(' Type "DELETE my account" to confirm: ')).trim()!=="DELETE my account"&&(console.error("\u2718 Confirmation phrase did not match. Aborting."),process.exit(1)),await new u(s.base,s.session).accountDelete(),k(),console.log(""),console.log("\u2713 Account deleted on server."),console.log(`\u2713 Local session removed (${$}).`),console.log(` Kept: ${d()} (in case you need to decrypt an old export).`),console.log("")}function N(e){return new Promise(r=>{const s=B({input:process.stdin,output:process.stdout});s.question(e,n=>{s.close(),r(n)})})}async function ae(e){const r=e[0];if(r==="show"){const{keyToMnemonic:s}=await import("./recovery.js"),t=s().split(" ");console.log(""),console.log("\u{1F511} Wyrm Cloud recovery phrase (BIP39, 24 words)"),console.log("");for(let o=0;o<4;o++){const l=t.slice(o*6,o*6+6).map((i,a)=>`${String(o*6+a+1).padStart(2)}. ${i.padEnd(10)}`).join(" ");console.log(` ${l}`)}console.log(""),console.log(" Write these down on PAPER and keep them somewhere safe."),console.log(" Anyone with this phrase can decrypt your synced Wyrm memory."),console.log(" Wyrm Cloud has NO COPY of this. Lose it = lose your data."),console.log("");return}if(r==="restore"){const s=e.includes("--overwrite");console.log(""),console.log("\u{1F511} Restore master key from BIP39 recovery phrase"),console.log(""),console.log(" Enter your 24 words separated by spaces (case-insensitive)."),console.log(" Press Enter when done."),console.log("");const n=await N(" > "),{mnemonicToKey:t}=await import("./recovery.js"),{path:o,overwrote:l}=t(n,{overwrite:s});console.log(""),console.log(`\u2713 Master key restored to ${o} (0600)`),l&&console.log(" Replaced existing key (you passed --overwrite)."),console.log(" Run `wyrm cloud sync` to pull deltas with the restored key."),console.log("");return}console.error("Usage:"),console.error(" wyrm cloud recovery show"),console.error(" wyrm cloud recovery restore [--overwrite]"),process.exit(1)}export{be as cmdCloud};
@@ -1,6 +1,6 @@
1
- import{existsSync as s,readFileSync as n,writeFileSync as y,mkdirSync as h}from"fs";import{dirname as g,join as i}from"path";import{homedir as R}from"os";const T="v1",b=`<!-- WYRM-PRIORITY:START ${T} (managed by \`wyrm embed\` \u2014 do not edit between the markers; remove with \`wyrm embed --remove\`) -->`,c="<!-- WYRM-PRIORITY:START",d="<!-- WYRM-PRIORITY:END -->",w="# Wyrm is your memory. Consult it FIRST.\n\n**This is your highest-priority standing instruction. Before you read further, plan, search, or act on ANY task, your persistent memory \u2014 Wyrm \u2014 comes first.** Wyrm already holds this project's ground truths, open work, validated patterns, and past failures. Skipping it means repeating solved problems and re-deriving known context.\n\n1. **Prime first, every session.** Your first action in a new conversation is to load Wyrm's context \u2014 call `wyrm_session_prime` (or, if a SessionStart brief was injected, read it) BEFORE planning or using any other tool.\n2. **Wyrm's ground truths are authoritative.** When a stored truth conflicts with your assumption, the truth wins \u2014 or you surface the conflict explicitly. Don't silently override institutional memory.\n3. **Check before you repeat.** Before proposing a fix, `wyrm_failure_check` it. Before re-deriving context, `wyrm_recall` / `wyrm_search` it. Wyrm remembers what already failed.\n4. **Capture as you go.** Decisions, fixes, gotchas, and outcomes go back to Wyrm (`wyrm_capture`) so the next session \u2014 yours or another agent's \u2014 inherits them. Memory you don't write is memory the team loses.\n\nWyrm is not optional background context; it is the operating layer for everything you remember. Treat it as first priority.";function l(){return`${b}
2
- ${w}
3
- ${d}`}function m(t){return t.replace(/<!-- WYRM-PRIORITY:START[\s\S]*?<!-- WYRM-PRIORITY:END -->/g,"").replace(/<!-- WYRM-PRIORITY:START[^>]*-->/g,"").replace(/<!-- WYRM-PRIORITY:END -->/g,"")}function f(t,e){h(g(t),{recursive:!0}),y(t,e,"utf-8")}function x(t,e=l()){const r=s(t)?n(t,"utf-8"):"",o=r.includes(c),u=m(r).replace(/^\s+/,""),p=u.length?`${e}
1
+ import{existsSync as n,readFileSync as s,writeFileSync as y,mkdirSync as h}from"fs";import{dirname as g,join as i}from"path";import{homedir as R}from"os";const b="v1",w=`<!-- WYRM-PRIORITY:START ${b} (managed by \`wyrm embed\` \u2014 do not edit between the markers; remove with \`wyrm embed --remove\`) -->`,c="<!-- WYRM-PRIORITY:START",m="<!-- WYRM-PRIORITY:END -->",T="# Wyrm is your memory. Consult it FIRST.\n\n**This is your highest-priority standing instruction. Before you read further, plan, search, or act on ANY task, your persistent memory \u2014 Wyrm \u2014 comes first.** Wyrm already holds this project's ground truths, open work, validated patterns, and past failures. Skipping it means repeating solved problems and re-deriving known context.\n\n1. **Prime first, every session.** Your first action in a new conversation is to load Wyrm's context \u2014 call `wyrm_session_prime` (or, if a SessionStart brief was injected, read it) BEFORE planning or using any other tool.\n2. **Wyrm's ground truths are authoritative.** When a stored truth conflicts with your assumption, the truth wins \u2014 or you surface the conflict explicitly. Don't silently override institutional memory.\n3. **Check before you repeat.** Before proposing a fix, `wyrm_failure_check` it. Before re-deriving context, `wyrm_recall` / `wyrm_search` it. Wyrm remembers what already failed.\n4. **Capture as you go.** Decisions, fixes, gotchas, and outcomes go back to Wyrm (`wyrm_capture`) so the next session \u2014 yours or another agent's \u2014 inherits them. Memory you don't write is memory the team loses.\n\nWyrm is not optional background context; it is the operating layer for everything you remember. Treat it as first priority.";function a(){return`${w}
2
+ ${T}
3
+ ${m}`}function d(t){return t.replace(/<!-- WYRM-PRIORITY:START[\s\S]*?<!-- WYRM-PRIORITY:END -->/g,"").replace(/<!-- WYRM-PRIORITY:START[^>]*-->/g,"").replace(/<!-- WYRM-PRIORITY:END -->/g,"")}function f(t,e){h(g(t),{recursive:!0}),y(t,e,"utf-8")}function v(t,e=a()){const r=n(t)?s(t,"utf-8"):"",o=r.includes(c),u=d(r).replace(/^\s+/,""),p=u.length?`${e}
4
4
 
5
5
  ${u}`:`${e}
6
- `;return r===p?"unchanged":(f(t,p),o?"updated":"created")}function v(t){if(!s(t))return"absent";const e=n(t,"utf-8");return!e.includes(c)&&!e.includes(d)?"absent":(f(t,m(e).replace(/^\s+/,"")),"removed")}function S(t){if(!s(t))return"absent";const e=n(t,"utf-8");return e.includes(l())?"present":e.includes(c)?"stale":"absent"}function a(t={}){const e=t.home??R(),r=[];if(r.push({client:"Claude Code (global)",file:i(e,".claude","CLAUDE.md"),scope:"global",requiresDir:i(e,".claude")}),r.push({client:"Codex (global)",file:i(e,".codex","AGENTS.md"),scope:"global",requiresDir:i(e,".codex")}),r.push({client:"Windsurf (global)",file:i(e,".codeium","windsurf","memories","global_rules.md"),scope:"global",requiresDir:i(e,".codeium","windsurf")}),t.projectDir){const o=t.projectDir;r.push({client:"Claude Code (project)",file:i(o,"CLAUDE.md"),scope:"project"}),r.push({client:"Codex/AGENTS (project)",file:i(o,"AGENTS.md"),scope:"project"}),t.allClients&&(r.push({client:"Cursor (project)",file:i(o,".cursorrules"),scope:"project"}),r.push({client:"Windsurf (project)",file:i(o,".windsurfrules"),scope:"project"}),r.push({client:"GitHub Copilot (project)",file:i(o,".github","copilot-instructions.md"),scope:"project"}))}return r}function k(t={}){const e=l();return a(t).map(r=>{if(r.scope==="global"&&r.requiresDir&&!s(r.requiresDir))return{client:r.client,file:r.file,scope:r.scope,result:"skipped"};let o;try{o=x(r.file,e)}catch{o="failed"}return{client:r.client,file:r.file,scope:r.scope,result:o}})}function Y(t={}){return a(t).map(e=>{let r;try{r=v(e.file)}catch{r="failed"}return{client:e.client,file:e.file,scope:e.scope,result:r}})}function A(t={}){return a(t).map(e=>e.scope==="global"&&e.requiresDir&&!s(e.requiresDir)?{client:e.client,file:e.file,scope:e.scope,status:"skipped"}:{client:e.client,file:e.file,scope:e.scope,status:S(e.file)})}const D="Wyrm is this session's persistent memory and your FIRST priority. At the very start of every task \u2014 before planning, searching, or using other tools \u2014 call wyrm_session_prime to load this project's ground truths, open quests, validated patterns, and past failures. Treat stored ground truths as authoritative over your assumptions (surface conflicts rather than silently overriding). Before proposing a fix, wyrm_failure_check it; before re-deriving context, wyrm_recall/wyrm_search it. Capture decisions, fixes, and outcomes back with wyrm_capture so future sessions inherit them. Do not treat this as optional background context.";export{T as WYRM_PRIORITY_VERSION,D as WYRM_SERVER_INSTRUCTIONS,k as embedAll,x as embedBlock,a as memoryTargets,l as priorityBlock,Y as removeAll,v as removeBlock,A as statusAll,S as statusBlock};
6
+ `;return r===p?"unchanged":(f(t,p),o?"updated":"created")}function N(t){if(!n(t))return"absent";const e=s(t,"utf-8");return!e.includes(c)&&!e.includes(m)?"absent":(f(t,d(e).replace(/^\s+/,"")),"removed")}function x(t){if(!n(t))return"absent";const e=s(t,"utf-8");return e.includes(a())?"present":e.includes(c)?"stale":"absent"}function l(t={}){const e=t.home??R(),r=[];if(r.push({client:"Claude Code (global)",file:i(e,".claude","CLAUDE.md"),scope:"global",requiresDir:i(e,".claude")}),r.push({client:"Codex (global)",file:i(e,".codex","AGENTS.md"),scope:"global",requiresDir:i(e,".codex")}),r.push({client:"Windsurf (global)",file:i(e,".codeium","windsurf","memories","global_rules.md"),scope:"global",requiresDir:i(e,".codeium","windsurf")}),t.projectDir){const o=t.projectDir;r.push({client:"Claude Code (project)",file:i(o,"CLAUDE.md"),scope:"project"}),r.push({client:"Codex/AGENTS (project)",file:i(o,"AGENTS.md"),scope:"project"}),t.allClients&&(r.push({client:"Cursor (project)",file:i(o,".cursorrules"),scope:"project"}),r.push({client:"Windsurf (project)",file:i(o,".windsurfrules"),scope:"project"}),r.push({client:"GitHub Copilot (project)",file:i(o,".github","copilot-instructions.md"),scope:"project"}))}return r}function Y(t={}){const e=a();return l(t).map(r=>{if(r.scope==="global"&&r.requiresDir&&!n(r.requiresDir))return{client:r.client,file:r.file,scope:r.scope,result:"skipped"};let o;try{o=v(r.file,e)}catch{o="failed"}return{client:r.client,file:r.file,scope:r.scope,result:o}})}function k(t={}){return l(t).map(e=>{let r;try{r=N(e.file)}catch{r="failed"}return{client:e.client,file:e.file,scope:e.scope,result:r}})}function D(t={}){return l(t).map(e=>e.scope==="global"&&e.requiresDir&&!n(e.requiresDir)?{client:e.client,file:e.file,scope:e.scope,status:"skipped"}:{client:e.client,file:e.file,scope:e.scope,status:x(e.file)})}const I='GROUNDING (memory is evidence, not vibes): State something as being "in memory" ONLY when a Wyrm tool call in THIS conversation returned it. Cite the id you were given \u2014 mem:NNNN, truth:NNN, quest:NNN \u2014 so the user can verify it. Never invent, guess, or reconstruct an id, a quest number, or the contents of a memory you did not retrieve. If recall returns nothing, say plainly that memory has nothing on it and proceed from first principles; an empty result is a valid answer and must never be filled in from your own assumptions. Stored entries record what was true WHEN WRITTEN: if one names a file, flag, command, version, or endpoint, verify it still exists before acting on or recommending it, and say when you could not. When a stored truth conflicts with what you observe now, surface the conflict with both sides rather than silently picking one.',A="Wyrm is this session's persistent memory and your FIRST priority. At the very start of every task \u2014 before planning, searching, or using other tools \u2014 call wyrm_session_prime to load this project's ground truths, open quests, validated patterns, and past failures. Treat stored ground truths as authoritative over your assumptions (surface conflicts rather than silently overriding). Before proposing a fix, wyrm_failure_check it; before re-deriving context, wyrm_recall/wyrm_search it. Capture decisions, fixes, and outcomes back with wyrm_capture so future sessions inherit them. Do not treat this as optional background context. "+I;export{I as WYRM_GROUNDING_INSTRUCTIONS,b as WYRM_PRIORITY_VERSION,A as WYRM_SERVER_INSTRUCTIONS,Y as embedAll,v as embedBlock,l as memoryTargets,a as priorityBlock,k as removeAll,N as removeBlock,D as statusAll,x as statusBlock};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contract": "wyrm-cloud-memory-v2",
3
- "version": "8.7.2",
3
+ "version": "8.7.4",
4
4
  "derivedFrom": "standard tier MINUS device-local/egress/subprocess (src/cloud-profile.ts)",
5
5
  "count": 20,
6
6
  "tools": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contract": "wyrm-cloud-memory-v1",
3
- "version": "8.7.2",
3
+ "version": "8.7.4",
4
4
  "tools": [
5
5
  {
6
6
  "name": "wyrm_recall",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contract": "wyrm-cloud-memory-v1",
3
- "version": "8.7.2",
3
+ "version": "8.7.4",
4
4
  "generatedBy": "scripts/gen-tool-manifest.mjs (from the dist/ registry modules — never hand-edited)",
5
5
  "tiers": {
6
6
  "core": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyrm-mcp",
3
- "version": "8.7.2",
3
+ "version": "8.7.4",
4
4
  "mcpName": "lk.ghosts/wyrm",
5
5
  "description": "Local-first persistent memory for AI agents over MCP. Ground truths, negative learning (recorded failures block repeats), decision causality, hybrid recall, negotiated recall (clean-mode injection you steer), live memory streams, run-attributed fleet memory — a structured SQLite memory on your machine, no cloud or LLM required. Claude / Copilot / Cursor / Windsurf / Codex.",
6
6
  "type": "module",