wyrm-mcp 9.2.2 → 9.2.3
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/activation.js +1 -1
- package/dist/agent-loop.js +2 -2
- package/dist/audit.js +2 -2
- package/dist/autoconfig.js +6 -6
- package/dist/backup-cli.js +6 -0
- package/dist/backup.js +1 -0
- package/dist/bridge.js +1 -1
- package/dist/buddy-runner.js +1 -1
- package/dist/buddy.js +4 -4
- package/dist/capabilities.js +1 -1
- package/dist/causality.js +3 -3
- package/dist/cloud/cli.js +3 -3
- package/dist/cloud/sync-daemon-entrypoint.js +1 -1
- package/dist/cloud/sync-engine.js +8 -7
- package/dist/cloud-backup.js +4 -4
- package/dist/cloud-sync-entrypoint.js +1 -1
- package/dist/cloud-sync.js +1 -1
- package/dist/connectors/ingest.js +2 -2
- package/dist/constellation.js +1 -1
- package/dist/context-build-budgeted.js +4 -4
- package/dist/context-ranking.js +1 -1
- package/dist/daemon-writer.js +1 -1
- package/dist/database.js +41 -23
- package/dist/design.js +1 -1
- package/dist/erasure-cli.js +3 -0
- package/dist/erasure-log.js +8 -0
- package/dist/erasure.js +1 -0
- package/dist/event-replication.js +1 -1
- package/dist/events.js +11 -11
- package/dist/failure-patterns.js +67 -44
- package/dist/federation.js +11 -10
- package/dist/governance.js +1 -0
- package/dist/handlers/agent.js +4 -4
- package/dist/handlers/alias-adapters.js +1 -1
- package/dist/handlers/audit.js +1 -1
- package/dist/handlers/boundary.js +1 -1
- package/dist/handlers/capture.js +54 -52
- package/dist/handlers/causality.js +2 -2
- package/dist/handlers/cloud.js +9 -9
- package/dist/handlers/companion.js +4 -4
- package/dist/handlers/entity.js +6 -6
- package/dist/handlers/events.js +4 -4
- package/dist/handlers/failure.js +15 -12
- package/dist/handlers/goals.js +2 -2
- package/dist/handlers/intelligence.js +81 -74
- package/dist/handlers/mcpclient.js +3 -3
- package/dist/handlers/presence.js +1 -1
- package/dist/handlers/prompts.js +2 -2
- package/dist/handlers/quest.js +11 -4
- package/dist/handlers/recall.js +10 -10
- package/dist/handlers/resources.js +1 -1
- package/dist/handlers/review.js +3 -3
- package/dist/handlers/run.js +3 -3
- package/dist/handlers/search.js +1 -1
- package/dist/handlers/session.js +27 -25
- package/dist/handlers/share.js +3 -3
- package/dist/handlers/skill.js +2 -2
- package/dist/handlers/symbols.js +5 -5
- package/dist/handlers/syncops.js +2 -2
- package/dist/harvest.js +5 -5
- package/dist/hours.js +1 -1
- package/dist/http-auth.js +2 -2
- package/dist/http-fast.js +17 -17
- package/dist/http-projects.js +4 -0
- package/dist/http-rate-limit.js +1 -0
- package/dist/index-health.js +52 -0
- package/dist/index.js +2 -2
- package/dist/indexer.js +4 -4
- package/dist/intelligence.js +36 -29
- package/dist/lane-provenance.js +39 -0
- package/dist/license.js +1 -1
- package/dist/lineage.js +15 -0
- package/dist/live-embedding-state.js +2 -2
- package/dist/maintenance.js +2 -2
- package/dist/mcp-integrity.js +2 -2
- package/dist/memory-artifacts.js +39 -37
- package/dist/metabolize.js +9 -7
- package/dist/metrics.js +1 -1
- package/dist/migrate-prompt.js +1 -1
- package/dist/migrations.js +236 -45
- package/dist/priority-embed.js +1 -1
- package/dist/providers/embedding-provider.js +1 -1
- package/dist/readonly-gate.js +1 -1
- package/dist/redact-backfill.js +1 -0
- package/dist/rehydration.js +30 -20
- package/dist/reindex.js +1 -1
- package/dist/render-target.js +6 -6
- package/dist/repl-guard.js +1 -1
- package/dist/replication-daemon-entrypoint.js +1 -1
- package/dist/replication-daemon.js +1 -1
- package/dist/retention.js +1 -0
- package/dist/reverse-bridge.js +6 -6
- package/dist/review-sample.js +31 -0
- package/dist/security.js +1 -1
- package/dist/self-maintenance.js +4 -4
- package/dist/served-records.js +8 -2
- package/dist/setup-wizard.js +1 -1
- package/dist/setup.js +1 -1
- package/dist/skill-author.js +2 -2
- package/dist/store-open.js +1 -0
- package/dist/store-readonly.js +1 -0
- package/dist/sub-agent.js +2 -2
- package/dist/tool-manifest-v2.json +1 -1
- package/dist/tool-manifest.json +1 -1
- package/dist/truth-freshness.js +8 -0
- package/dist/ui-dashboard.js +4 -4
- package/dist/vault.js +1 -1
- package/dist/vector-init.js +1 -1
- package/dist/vectors.js +4 -3
- package/dist/visibility.js +12 -12
- package/dist/write-guard.js +1 -0
- package/dist/wyrm-cli.js +108 -92
- package/dist/wyrm-guard.js +13 -12
- package/dist/wyrm-loop.js +3 -3
- package/dist/wyrm-manifest.json +1 -1
- package/dist/wyrm-memo.js +5 -5
- package/package.json +1 -1
- package/scripts/hooks/wyrm-session-capture.mjs +3 -0
package/dist/skill-author.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{existsSync as u,mkdirSync as h,writeFileSync as g,readFileSync as m,rmSync as k,statSync as y}from"fs";import{join as i}from"path";import{homedir as f}from"os";import{createHash as p}from"crypto";import{resolveUserPath as S,userPathRoots as $}from"./security.js";function a(){return process.env.WYRM_SKILLS_DIR||i(f(),".copilot","skills")}function l(t){return String(t).trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)}const v=6;function P(t){const r=[],e=[],n=l(t.name);(!n||!/^[a-z0-9][a-z0-9-]{1,48}$/.test(n))&&r.push(`name must slugify to kebab-case [a-z0-9-] (got "${t.name}" \u2192 "${n}")`);const s=(t.description||"").trim();s.length<12&&r.push("description too short (< 12 chars)
|
|
1
|
+
import{existsSync as u,mkdirSync as h,writeFileSync as g,readFileSync as m,rmSync as k,statSync as y}from"fs";import{join as i}from"path";import{homedir as f}from"os";import{createHash as p}from"crypto";import{resolveUserPath as S,userPathRoots as $}from"./security.js";function a(){return process.env.WYRM_SKILLS_DIR||i(f(),".copilot","skills")}function l(t){return String(t).trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)}const v=6;function P(t){const r=[],e=[],n=l(t.name);(!n||!/^[a-z0-9][a-z0-9-]{1,48}$/.test(n))&&r.push(`name must slugify to kebab-case [a-z0-9-] (got "${t.name}" \u2192 "${n}")`);const s=(t.description||"").trim();s.length<12&&r.push("description too short (< 12 chars); needed for discovery/recall"),s.length>280&&r.push("description too long (> 280 chars); keep it a one-liner for ranking");const o=(t.body||"").trim();o?/^#{1,2}\s+\S/m.test(o)||e.push("body has no markdown heading; add a clear title"):r.push("body is empty");const d=(o.match(/^##\s+\S/gm)||[]).length;return d>v&&e.push(`body has ${d} top-level sections: may not be atomic; consider splitting into smaller skills`),o.length>12e3&&e.push(`body is ${o.length} chars. Atomic skills are usually focused; consider trimming or splitting`),{ok:r.length===0,errors:r,warnings:e,slug:n}}function b(t){const e=["---",`name: ${l(t.name)}`,`description: ${c(t.description.trim())}`];return t.argumentHint&&e.push(`argument-hint: ${c(t.argumentHint)}`),t.userInvocable!==void 0&&e.push(`user-invocable: ${t.userInvocable?"true":"false"}`),t.category&&e.push(`category: ${c(t.category)}`),t.tags&&t.tags.length&&e.push(`tags: [${t.tags.map(n=>c(n)).join(", ")}]`),e.push("---"),`${e.join(`
|
|
2
2
|
`)}
|
|
3
3
|
|
|
4
4
|
${t.body.trim()}
|
|
5
|
-
`}function c(t){const r=String(t);return/^[\w][\w .,/()&'+-]*$/.test(r)&&!/^(true|false|null|yes|no|on|off)$/i.test(r)?r:JSON.stringify(r)}function _(t,r={}){const e=l(t.name);if(!e)throw new Error(`skill name "${t.name}" does not produce a valid slug`);const n=i(r.skillsDir??a(),e),s=i(n,"SKILL.md"),o=u(s);if(o&&!r.force)throw new Error(`skill "${e}" already exists at ${s} (pass force to overwrite)`);return h(n,{recursive:!0}),g(s,b(t),"utf-8"),{slug:e,path:s,action:o?"overwritten":"created"}}function z(t,r={}){const e=l(t);if(!e)return{slug:"",removed:!1};const n=i(r.skillsDir??a(),e);return u(i(n,"SKILL.md"))?(k(n,{recursive:!0,force:!0}),{slug:e,removed:!0}):{slug:e,removed:!1}}function
|
|
5
|
+
`}function c(t){const r=String(t);return/^[\w][\w .,/()&'+-]*$/.test(r)&&!/^(true|false|null|yes|no|on|off)$/i.test(r)?r:JSON.stringify(r)}function _(t,r={}){const e=l(t.name);if(!e)throw new Error(`skill name "${t.name}" does not produce a valid slug`);const n=i(r.skillsDir??a(),e),s=i(n,"SKILL.md"),o=u(s);if(o&&!r.force)throw new Error(`skill "${e}" already exists at ${s} (pass force to overwrite)`);return h(n,{recursive:!0}),g(s,b(t),"utf-8"),{slug:e,path:s,action:o?"overwritten":"created"}}function z(t,r={}){const e=l(t);if(!e)return{slug:"",removed:!1};const n=i(r.skillsDir??a(),e);return u(i(n,"SKILL.md"))?(k(n,{recursive:!0,force:!0}),{slug:e,removed:!0}):{slug:e,removed:!1}}function A(t,r={}){const e=i(r.skillsDir??a(),l(t),"SKILL.md");return u(e)?m(e,"utf-8"):null}function w(t){return p("sha256").update(t,"utf-8").digest("hex")}function F(t){const r=[];if(t.skillPath)try{const e=$([t.skillsDir??a(),i(f(),".claude","skills"),i(f(),".copilot","skills")]),n=S(t.skillPath,e,"skillPath");n.toLowerCase().endsWith(".md")&&r.push(n)}catch{}if(t.name){const e=l(t.name);e&&r.push(i(t.skillsDir??a(),e,"SKILL.md"))}for(const e of r)try{if(e&&u(e)&&x(e)){const n=m(e,"utf-8");return{content:n,sha256:w(n)}}}catch{}return null}function x(t){try{return y(t).isFile()}catch{return!1}}export{b as buildSkillMarkdown,_ as deploySkill,a as getSkillsDir,A as readSkill,F as readSkillContent,z as removeSkill,w as skillContentSha,l as slugify,P as validateAtomicSkill};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as f}from"node:fs";import{openDatabase as s}from"./storage/index.js";import{schemaSkew as n}from"./migrations.js";import{enforceReadOnlyOpen as p,newerStoreWritesAllowed as i,NewerStoreError as w}from"./store-readonly.js";function a(e,t=process.env){const r=n(e);r.storeIsNewer&&!i(t)&&p(e,r)}function S(e,t={},r=process.env){const o=s(e,t);try{a(o,r)}catch(c){throw o.close(),c}return o}function x(e,t=process.env){if(!f(e))return;const r=s(e,{readonly:!0,fileMustExist:!0});try{const o=n(r);if(o.storeIsNewer&&!i(t))throw new w(o.store,o.binary)}finally{r.close()}}export{x as assertStoreWritable,a as guardNewerStore,S as openStoreForWrite};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const h="WYRM_ALLOW_NEWER_STORE_WRITES",R="WYRM_STORE_NEWER";function x(e,t){return`This store is at schema v${e}, newer than this wyrm-mcp understands (v${t}), so it is open read-only: writing under older rules could undo what the newer version guarantees. Reads still work. Fix: upgrade wyrm-mcp on this machine (wyrm update, or npm install -g wyrm-mcp@latest). Emergency override, at your own risk: ${h}=1.`}class f extends Error{store;binary;code=R;constructor(t,s){super(x(t,s)),this.store=t,this.binary=s,this.name="NewerStoreError"}}function _(e=process.env){return/^(1|true|yes|on)$/i.test(e[h]??"")}const y=new WeakMap;let p=null;function v(e){return y.get(e)??null}function u(e){if(!e||typeof e!="object")return!1;const t=e;return t.code==="SQLITE_READONLY"||typeof t.message=="string"&&/attempt to write a readonly database/i.test(t.message)}const N=/^CREATE\s+(?:UNIQUE\s+)?(?:TEMP(?:ORARY)?\s+)?(?:VIRTUAL\s+)?(?:TABLE|INDEX|TRIGGER|VIEW)\s+IF\s+NOT\s+EXISTS\b/i;function m(e){const s=e.replace(/--[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\bBEGIN\b[\s\S]*?\bEND\b/gi,"").split(";").map(c=>c.trim()).filter(Boolean);return s.length>0&&s.every(c=>N.test(c))}function I(e,t){if(y.has(e))return;const s={store:t.store,binary:t.binary};y.set(e,s),p=s,e.pragma("query_only = ON");const c=e.prepare.bind(e),g=e.exec.bind(e),l=()=>new f(s.store,s.binary),b=(r,n)=>{const o=m(n),a={run:()=>({changes:0,lastInsertRowid:0}),get:()=>{},all:()=>[],iterate:()=>[][Symbol.iterator]()};for(const i of Object.keys(a)){const d=r[i];typeof d=="function"&&Object.defineProperty(r,i,{configurable:!0,writable:!0,value:(...O)=>{if(!o)throw l();try{return d.apply(r,O)}catch(w){if(u(w))return a[i]();throw w}}})}};Object.defineProperty(e,"prepare",{configurable:!0,writable:!0,value:(...r)=>{let n;try{n=c(...r)}catch(a){throw u(a)?l():a}const o=typeof r[0]=="string"?r[0]:"";return n.readonly===!1&&!/^\s*PRAGMA\b/i.test(o)&&b(n,o),n}}),Object.defineProperty(e,"exec",{configurable:!0,writable:!0,value:(...r)=>{const n=typeof r[0]=="string"?r[0]:"";try{return g(...r)}catch(o){if(!u(o))throw o;if(m(n))return e;throw l()}}});const S=e.transaction.bind(e),E=r=>(...n)=>{try{return r(...n)}catch(o){throw u(o)?l():o}};Object.defineProperty(e,"transaction",{configurable:!0,writable:!0,value:r=>{const n=S(r),o=E(n);for(const a of["default","deferred","immediate","exclusive"]){const i=n[a];typeof i=="function"&&(o[a]=E(i))}return"database"in n&&(o.database=n.database),o}})}function T(e){return e instanceof f||e&&typeof e=="object"&&e.code===R?e:p&&u(e)?new f(p.store,p.binary):null}function W(e){const t=T(e);return t?t.message:String(e)}export{R as NEWER_STORE_CODE,h as NEWER_STORE_OVERRIDE_ENV,f as NewerStoreError,T as asNewerStoreError,W as describeStoreError,I as enforceReadOnlyOpen,m as isEnsureSchemaOnly,x as newerStoreMessage,_ as newerStoreWritesAllowed,v as readOnlySkew};
|
package/dist/sub-agent.js
CHANGED
|
@@ -26,7 +26,7 @@ import{sanitizeFtsQuery as R}from"./security.js";const S="http://localhost:11434
|
|
|
26
26
|
WHERE resolved = 0 AND (project_id = ? OR project_id IS NULL)
|
|
27
27
|
ORDER BY occurrences DESC, last_seen DESC
|
|
28
28
|
LIMIT 5
|
|
29
|
-
`).all(n);for(const t of i){const o=`[failure#${t.id} avoid] ${t.scope}:${t.target}
|
|
29
|
+
`).all(n);for(const t of i){const o=`[failure#${t.id} avoid] ${t.scope}:${t.target}: ${t.description}${t.why_failed?` (${t.why_failed})`:""}`;if(!s("failure",o.slice(0,400)))break}}catch{}try{const i=`%${e.replace(/[%_]/g,"").slice(0,50)}%`,t=this.db.prepare(`
|
|
30
30
|
SELECT symbol, kind, language, file_path, line, signature
|
|
31
31
|
FROM symbol_index
|
|
32
32
|
WHERE symbol LIKE ?
|
|
@@ -40,5 +40,5 @@ import{sanitizeFtsQuery as R}from"./security.js";const S="http://localhost:11434
|
|
|
40
40
|
(query, project_id, context_summary, context_chars, response,
|
|
41
41
|
model, tokens_in, tokens_out, latency_ms, error_message)
|
|
42
42
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
43
|
-
`).run(e.query.slice(0,1e3),e.project_id??null,c,a,$.slice(0,4e3),h,d?.tokens_in??null,d?.tokens_out??null,w,k?"No LLM available
|
|
43
|
+
`).run(e.query.slice(0,1e3),e.project_id??null,c,a,$.slice(0,4e3),h,d?.tokens_in??null,d?.tokens_out??null,w,k?"No LLM available; degraded to context-only":null)}catch{}return{query:e.query,answer:$,model:h,context_summary:c,context_chars:a,latency_ms:w,tokens_in:d?.tokens_in,tokens_out:d?.tokens_out,degraded:k,error:k?v&&!E?'No LLM used: Ollama is unreachable and cloud backends are OPT-IN since 9.0.0, so your memory is not sent to a third party by accident. To allow it, set WYRM_ASK_ALLOW_CLOUD=1, or name a backend explicitly with model_override (e.g. "anthropic:claude-opus-4-8"). Returning raw context.':"No LLM available: Ollama is unreachable on "+f+" and no cloud backend is configured. Start Ollama, or set an API key and either WYRM_ASK_ALLOW_CLOUD=1 or model_override. Returning raw context.":void 0}}degradedAnswer(e,n){if(n.length===0)return`_No matching context found in Wyrm for "${e}". No LLM available to synthesize._`;const l=[];l.push(`_LLM not available; returning ${n.length} matched context pieces:_`),l.push("");for(const u of n)l.push(u.text);return l.join(`
|
|
44
44
|
`)}}export{W as SubAgent};
|
package/dist/tool-manifest.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{existsSync as E}from"fs";import{homedir as A}from"os";import{join as S}from"path";const v=30,$=14,R=90,x=180,L=365;function k(t=process.env){return!/^(0|false|no|off)$/i.test(t.WYRM_TRUTH_TTL_DEFAULTS??"")}const O=new Set(["version","versions","release","releases","released","latest","semver","npm","changelog"]),b=new Set(["status","state","progress","wip","pending","unreleased","blocked","blocker","blockers","todo","next","eta","deadline","sprint","current","live","deployed","rollout"]),N=new Set(["architecture","conventions","convention","constraint","constraints","constitution","security","brand","tech_stack","compliance","principles"]),w=new Set(["ops","operations","deployments","deployment","infrastructure","infra","benchmarks","performance","data-quality","releases","release","status"]);function W(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function C(t,e,n=process.env){if(!k(n))return null;const r=W(e);if(r.some(s=>b.has(s)))return $;if(r.some(s=>O.has(s)||/^v\d+$/.test(s)))return v;const o=t.trim().toLowerCase();return N.has(o)?L:w.has(o)?R:x}function g(t){if(!t)return NaN;const e=/[zZ]|[+-]\d\d:?\d\d$/.test(t)?t:`${t.replace(" ","T")}Z`;return Date.parse(e)}const m=864e5;function F(t,e=Date.now(),n=process.env){const r=g(t.created_at),o=g(t.last_verified_at??t.created_at),s=Number.isFinite(r),c=Number.isFinite(o),i=s?Math.max(0,Math.floor((e-r)/m)):0,l=c?Math.max(0,Math.floor((e-o)/m)):i,a=!c||!s||o-r<1e3,u=typeof t.ttl_days=="number"&&t.ttl_days>0?t.ttl_days:null,_=u===null?C(t.category,t.key,n):null,d=u??_,f=c?e-o:NaN,p=d!==null&&Number.isFinite(f)&&f>d*m;return{ageDays:i,verifiedDays:l,neverVerified:a,ttlDays:d,ttlIsDefault:u===null&&d!==null,stale:p}}function y(t){return t===0?"today":`${t}d ago`}function T(t){return t.neverVerified?`set ${y(t.ageDays)}, never verified`:`set ${y(t.ageDays)}, verified ${y(t.verifiedDays)}`}const M="[path missing]";function B(t,e={}){const r=e.stale??t.stale?`[STALE: ${T(t)}${t.ttlDays?`, TTL ${t.ttlDays}d`:""}]`:`[${T(t)}]`;return e.deadPath?`${r} ${M}`:r}const U=/(?:^|[\s("'`=,;[])((?:~|\/home|\/Users|\/opt|\/srv|\/mnt|\/var|\/etc|\/usr\/local)\/[^\s"'`),;\]]*)/g;function j(t,e){return t.startsWith("~/")?S(e,t.slice(2)):t}function H(t){return"/"+t.split("/").filter(Boolean).slice(0,2).join("/")}function V(t,e={}){const n=e.home??A(),r=e.exists??E,o=[];let s=0;if(!t)return{dead:o,unverifiable:s};const c=new Set;for(const i of t.matchAll(U)){const l=(i.index??0)+i[0].length-i[1].length;let a=i[1].replace(/[.:!?]+$/,"");if(a==="~"||a.length<3||c.has(a))continue;c.add(a);const u=j(a,n);if(r(u))continue;const _=t.slice(l+i[1].length).match(/^((?: [^\s"'`),;\]]+){1,3})/);if(_){const f=_[1].trim().split(" ");let p=!1;for(let h=1;h<=f.length&&!p;h++){const D=`${u} ${f.slice(0,h).join(" ")}`.replace(/[.:!?]+$/,"");r(D)&&(p=!0)}if(p)continue}const d=a.startsWith("~/")?n:H(u);if(!r(d)){s++;continue}o.push(a)}return{dead:o,unverifiable:s}}function q(t,e,n,r){try{return t.prepare(`
|
|
2
|
+
SELECT id, category FROM ground_truths
|
|
3
|
+
WHERE project_id = ? AND key = ? AND category <> ? AND is_current = 1
|
|
4
|
+
ORDER BY id
|
|
5
|
+
`).all(e,r.trim(),n)}catch{return[]}}function z(t,e){if(e.length===0)return"";const n=e.map(r=>`${r.category} (truth:${r.id})`).join(", ");return`key "${t.trim()}" is also current under ${n}; both stay current. If they answer the same question, keep one category and revoke the other.`}function Z(t){if(typeof t!="string")return[];const e=t.trim();if(!/^(?:truth|mem|quest):\d{1,9}(?:\s*,\s*(?:truth|mem|quest):\d{1,9})*$/i.test(e))return[];const n=[],r=new Set;for(const o of e.split(",")){const[s,c]=o.trim().toLowerCase().split(":"),i=s==="mem"?"artifact":s,l=Number(c),a=`${i}:${l}`;l>0&&!r.has(a)&&(r.add(a),n.push({kind:i,id:l}))}return n}function G(t,e,n=Date.now()){const r=t.prepare(`
|
|
6
|
+
SELECT id, project_id, category, key, ttl_days, created_at, last_verified_at
|
|
7
|
+
FROM ground_truths WHERE id = ? AND is_current = 1
|
|
8
|
+
`).get(e);if(!r)return null;const o=T(F(r,n));t.prepare("UPDATE ground_truths SET last_verified_at = datetime('now') WHERE id = ?").run(e);const s=t.prepare("SELECT last_verified_at FROM ground_truths WHERE id = ?").get(e);return{id:r.id,project_id:r.project_id,category:r.category,key:r.key,before:o,last_verified_at:s.last_verified_at}}export{M as DEAD_PATH_MARKER,x as TTL_DEFAULT_DAYS,L as TTL_DURABLE_DAYS,R as TTL_OPERATIONAL_DAYS,$ as TTL_STATUS_DAYS,v as TTL_VERSION_DAYS,T as ageLabel,B as briefTag,V as checkTruthPaths,q as crossCategoryKeys,z as crossCategoryWarning,C as defaultTtlDays,Z as explicitRefs,g as parseStoreTime,F as truthFreshness,k as ttlDefaultsEnabled,G as verifyTruth};
|
package/dist/ui-dashboard.js
CHANGED
|
@@ -245,12 +245,12 @@ main { padding: calc(var(--nav-h) + 24px) 24px 24px; max-width: 1200px; margin:
|
|
|
245
245
|
.wr-s-claim { --stage-c: var(--accent); }
|
|
246
246
|
.wr-s-fix { --stage-c: oklch(0.80 0.13 200); }
|
|
247
247
|
.wr-s-verify { --stage-c: var(--pos); }
|
|
248
|
-
/* Connectors carry a travelling pulse
|
|
248
|
+
/* Connectors carry a travelling pulse: work flowing down the pipe. */
|
|
249
249
|
.wr-conn { position: relative; align-self: center; width: 100%; min-width: 26px; height: 2px; background: var(--border); margin: 0 -1px; }
|
|
250
250
|
.wr-conn::after { content: ''; position: absolute; top: -1px; left: 0; width: 22px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, transparent, var(--pos), transparent); animation: wrFlow 2.6s linear infinite; }
|
|
251
251
|
@keyframes wrFlow { from { left: -22px; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { left: 100%; opacity: 0; } }
|
|
252
252
|
|
|
253
|
-
/* Presence board
|
|
253
|
+
/* Presence board: agent LEDs. */
|
|
254
254
|
.wr-presence { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
|
|
255
255
|
.wr-agent { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px 6px 10px; font-size: 12px; }
|
|
256
256
|
.wr-agent .led { width: 8px; height: 8px; border-radius: 50%; background: var(--neu); }
|
|
@@ -264,7 +264,7 @@ main { padding: calc(var(--nav-h) + 24px) 24px 24px; max-width: 1200px; margin:
|
|
|
264
264
|
.wr-metrics .m .mv { font-size: 20px; font-weight: 700; color: var(--pos); font-variant-numeric: tabular-nums; }
|
|
265
265
|
.wr-metrics .m .ml { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-top: 3px; }
|
|
266
266
|
|
|
267
|
-
/* Activity feed
|
|
267
|
+
/* Activity feed: type-coded left rail. */
|
|
268
268
|
.wr-feed { display: flex; flex-direction: column; gap: 10px; }
|
|
269
269
|
.wr-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--row-c, var(--neu)); border-radius: 10px; padding: 13px 16px; }
|
|
270
270
|
.wr-row .wr-badge { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--row-c, var(--neu)); border: 1px solid var(--row-c, var(--neu)); border-radius: 5px; padding: 3px 7px; align-self: start; white-space: nowrap; }
|
|
@@ -618,7 +618,7 @@ async function loadOverview() {
|
|
|
618
618
|
card.replaceChild(vEl, skel);
|
|
619
619
|
}
|
|
620
620
|
});
|
|
621
|
-
// Recent sessions
|
|
621
|
+
// Recent sessions: remove skeleton list, then insert real data
|
|
622
622
|
pane.querySelector('.list')?.remove();
|
|
623
623
|
const sl = el('div', 'sessions-list');
|
|
624
624
|
const sessions = data.recent_sessions || [];
|
package/dist/vault.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createCipheriv as Q,createDecipheriv as Z,randomBytes as d,scryptSync as
|
|
1
|
+
import{createCipheriv as Q,createDecipheriv as Z,randomBytes as d,scryptSync as R,timingSafeEqual as ee}from"node:crypto";import{existsSync as o,readFileSync as u,writeFileSync as L,mkdirSync as T,chmodSync as S,unlinkSync as w,statSync as te,copyFileSync as D,openSync as re,fsyncSync as ne,closeSync as ie,writeSync as oe}from"node:fs";import{execFileSync as l}from"node:child_process";import{homedir as se,platform as m}from"node:os";import{join as A}from"node:path";const M="aes-256-gcm",p=12,x=16,f="wyrm-vault",J="Wyrm Vault master key";function a(){return process.env.WYRM_VAULT_DIR||A(se(),".wyrm")}function i(){return A(a(),"vault.enc")}function y(){return A(a(),"vault.key")}function ae(){return A(a(),"vault.salt")}function P(){return A(a(),"vault.meta")}function Y(){const e=ae();if(o(e))return u(e);T(a(),{recursive:!0,mode:448});const t=o(i())?Buffer.from("wyrm-vault-v1"):d(16);L(e,t,{mode:384});try{S(e,384)}catch{}return t}function ce(){try{const e=JSON.parse(u(P(),"utf8"));if(e.backend==="keychain"||e.backend==="passphrase"||e.backend==="keyfile")return e.backend}catch{}return null}function U(e){try{T(a(),{recursive:!0,mode:448}),L(P(),JSON.stringify({backend:e,v:1}),{mode:384});try{S(P(),384)}catch{}}catch{}}function O(){return process.env.WYRM_VAULT_SECRETTOOL||"secret-tool"}function v(){return a()}function j(e){return!!e&&typeof e=="object"&&e.code==="ENOENT"}class H extends Error{detail;code="WYRM_KEYRING_UNAVAILABLE";constructor(t){super(`the OS keyring is locked or unavailable (${t}), so the vault master key cannot be read. Unlock your login keyring and retry, or set WYRM_VAULT_PASSPHRASE if this vault uses a passphrase.`),this.detail=t,this.name="KeyringUnavailableError"}}function ue(e,t){const r=e,n=String(r.stderr??"").trim();if(r.code==="ETIMEDOUT"||r.signal)throw new H(`lookup timed out${r.signal?` (${r.signal})`:""}`);if(t){if(r.status===44)return;throw new H(n||`security exited ${r.status??"abnormally"}`)}if(!(r.status===1&&n===""))throw new H(n||`secret-tool exited ${r.status??"abnormally"}`)}function V(){try{if(m()==="darwin"){const n=l("security",["find-generic-password","-s",f,"-a",v(),"-w"],{timeout:8e3,encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();return n?Buffer.from(n,"base64"):void 0}const t=l(O(),["lookup","service",f,"path",v()],{timeout:8e3,encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();return t?Buffer.from(t,"base64"):void 0}catch(e){if(j(e))throw new Error("OS keychain CLI not found (install libsecret/`secret-tool`), or use WYRM_VAULT_PASSPHRASE / `wyrm vault secure --backend passphrase`.");return ue(e,m()==="darwin")}}function K(e){const t=e.toString("base64");if(m()==="darwin"){l("security",["add-generic-password","-U","-s",f,"-a",v(),"-l",J,"-w",t],{timeout:8e3,stdio:["ignore","ignore","ignore"]});return}l(O(),["store","--label",J,"service",f,"path",v()],{timeout:8e3,input:t,stdio:["pipe","ignore","ignore"]})}function G(){try{m()==="darwin"?l("security",["delete-generic-password","-s",f,"-a",v()],{timeout:8e3,stdio:["ignore","ignore","ignore"]}):l(O(),["clear","service",f,"path",v()],{timeout:8e3,stdio:["ignore","ignore","ignore"]})}catch{}}function C(){try{return m()==="darwin"?(l("security",["find-generic-password","-s",f,"-a","__wyrm_probe__"],{timeout:8e3,stdio:["ignore","ignore","ignore"]}),!0):(l(O(),["lookup","service",f,"path","__wyrm_probe__"],{timeout:8e3,stdio:["ignore","ignore","ignore"]}),!0)}catch(e){if(j(e))return!1;const t=e.status;return t===1||m()==="darwin"&&t===44}}function le(){try{return V()!==void 0}catch{return!1}}function I(){if(process.env.WYRM_VAULT_PASSPHRASE)return"passphrase";const e=(process.env.WYRM_VAULT_BACKEND||"auto").toLowerCase();if(e==="passphrase"||e==="keychain"||e==="keyfile")return e;if(o(i())){const t=ce();if(t)return t}return le()?"keychain":o(y())?"keyfile":C()?"keychain":"keyfile"}function q(){const e=I(),t=o(i());if(e==="passphrase"){const n=process.env.WYRM_VAULT_PASSPHRASE;if(!n)throw new Error("passphrase backend selected but WYRM_VAULT_PASSPHRASE is not set.");return t||U("passphrase"),R(n,Y(),32)}if(e==="keychain"){let n=V();if(!n){if(t)throw new Error("vault.enc exists but its master key is not in the OS keychain (keyring locked/unavailable, or the key was cleared). Unlock your login keyring and retry, or set WYRM_VAULT_PASSPHRASE if this vault uses a passphrase. Refusing to mint a new key: it cannot decrypt your existing secrets and would orphan them.");n=d(32),K(n),U("keychain")}if(n.length!==32)throw new Error("keychain holds a malformed master key (expected 32 bytes).");return n}const r=y();if(!o(r)){if(t)throw new Error("vault.enc exists but vault.key is missing; this vault was likely created under a different backend (keychain/passphrase). Unlock your OS keyring or set WYRM_VAULT_PASSPHRASE. Refusing to mint a new keyfile: it cannot decrypt your existing secrets and would orphan them.");T(a(),{recursive:!0,mode:448});const n=d(32);L(r,n,{mode:384});try{S(r,384)}catch{}return U("keyfile"),n}return u(r)}function W(e,t){if(e.length<p+x)throw new Error("vault file is corrupt (too short)");const r=e.subarray(0,p),n=e.subarray(p,p+x),h=e.subarray(p+x),c=Z(M,t,r);c.setAuthTag(n);const N=Buffer.concat([c.update(h),c.final()]);return JSON.parse(N.toString("utf8"))}function fe(e,t){const r=d(p),n=Q(M,t,r),h=Buffer.concat([n.update(JSON.stringify(e),"utf8"),n.final()]),c=n.getAuthTag();return Buffer.concat([r,c,h])}function ye(e){const t=i();if(!o(t))return{};try{return W(u(t),e)}catch{throw new Error("vault decrypt failed: wrong key/passphrase, or the vault was tampered with.")}}function z(e,t){T(a(),{recursive:!0,mode:448}),L(i(),fe(e,t),{mode:384});try{S(i(),384)}catch{}}function b(){return o(i())?ye(q()):{}}function X(e){z(e,q())}const Ae={algorithm:M,ivLength:p,tagLength:x,keyLength:32};function be(e,t){return R(e,t,32)}function Ee(e,t){if(!e||!/^[\w.\-:/@]+$/.test(e))throw new Error("invalid secret name");const r=b();r[e]=t,X(r)}function _e(e){return b()[e]}function Re(e){return e in b()}function he(){return Object.keys(b()).sort()}function Le(e){const t=b();return e in t?(delete t[e],X(t),!0):!1}function Te(){try{w(i())}catch{}try{w(P())}catch{}}function de(e){try{const t=te(e).size,r=re(e,"r+");try{if(t>0){const n=d(t);oe(r,n,0,t,0),ne(r)}}finally{ie(r)}}catch{}try{w(e)}catch{}}function pe(){if(!o(i()))return{key:null,from:I()};const e=u(i()),t=[];o(y())&&t.push({from:"keyfile",key:u(y())});try{const r=V();r&&t.push({from:"keychain",key:r})}catch{}process.env.WYRM_VAULT_PASSPHRASE&&t.push({from:"passphrase",key:R(process.env.WYRM_VAULT_PASSPHRASE,Y(),32)});for(const r of t)try{return W(e,r.key),{key:r.key,from:r.from}}catch{}throw new Error("could not decrypt the current vault with any available key (keyfile / keychain / passphrase).")}function xe(e={}){const t=e.backend??"keychain",r=e.rotate??!0,{key:n,from:h}=pe(),c=n?W(u(i()),n):{},N=Object.keys(c).length;let s="";if(o(i())){s=i()+".bak."+new Date().toISOString().replace(/[:.]/g,"-"),D(i(),s);try{S(s,384)}catch{}}let g,E;if(t==="keychain"){if(!C())throw new Error("OS keychain not reachable; cannot migrate to keychain. Unlock your login keyring, or use `--backend passphrase`.");E=V(),g=r?d(32):E??d(32),K(g)}else{const k=process.env.WYRM_VAULT_PASSPHRASE;if(!k)throw new Error("migrate to passphrase requires WYRM_VAULT_PASSPHRASE to be set.");g=R(k,Y(),32)}const B=()=>{if(t==="keychain")if(E)try{K(E)}catch{}else G()};try{z(c,g);const k=W(u(i()),g),_=Buffer.from(JSON.stringify(k)),F=Buffer.from(JSON.stringify(c));if(_.length!==F.length||!ee(_,F))throw new Error("post-migration verification mismatch")}catch(k){if(s){try{D(s,i())}catch(_){throw B(),new Error(`CRITICAL: vault rollback failed; vault.enc may be partially written. Restore manually: cp "${s}" "${i()}" (${_.message})`)}try{w(s)}catch{}}throw B(),new Error("migration aborted (vault left unchanged): "+k.message)}U(t);let $=!1;if(o(y())&&(de(y()),$=!0),t==="passphrase"&&G(),s){try{w(s)}catch{}s=""}return{from:h,to:t,rotated:r,secrets:N,backup:s,keyfileShredded:$}}function ke(){const e=I();let t=0;try{t=he().length}catch{}const r=o(y()),n=e==="keychain"?!0:(()=>{try{return C()}catch{return!1}})(),h=(e==="keychain"||e==="passphrase")&&!r;return{dir:a(),vault:i(),key:y(),backend:e,mode:e,count:t,keyfileOnDisk:r,keychainAvailable:n,secure:h}}function Pe(){let e;try{e=ke()}catch{return[]}if(e.secure)return[];const t=[];return t.push(e.count>0?`\u26A0\uFE0F The credential vault holds ${e.count} secret(s) but the master key is a PLAINTEXT file (\`${e.key}\`) sitting beside the ciphertext; at-rest encryption is effectively defeated against anyone who can read \`${e.dir}\` (a backup, a synced dotfiles repo, an exfiltrated tarball).`:"\u26A0\uFE0F The credential vault's master key would be stored as a plaintext file beside the ciphertext."),t.push(e.keychainAvailable?'Fix in one step: run **`wyrm vault setup`** (moves the key into the OS keychain, rotates it, shreds the plaintext key). Then store secrets with `printf %s "$TOKEN" | wyrm vault set <name>` and use them via `wyrm vault exec <name> -- <cmd>` (never echoed).':"No OS keychain on this host; set `WYRM_VAULT_PASSPHRASE`, then run **`wyrm vault setup`** (derives the key from the passphrase; nothing on disk)."),t}export{H as KeyringUnavailableError,Ae as VAULT_CIPHER,be as deriveVaultKey,I as resolveBackend,Pe as vaultAdvisory,Te as vaultDestroy,_e as vaultGet,Re as vaultHas,he as vaultList,ke as vaultPaths,Le as vaultRemove,xe as vaultSecure,Ee as vaultSet};
|
package/dist/vector-init.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createVectorStore as
|
|
1
|
+
import{createVectorStore as i}from"./vectors.js";import{resolveEmbeddingState as s}from"./providers/embedding-provider.js";import{recordServerEmbeddingState as l}from"./live-embedding-state.js";import{IndexingPipeline as c,QUEUE_MAX_RETRIES as u}from"./indexer.js";import{artifactVectorText as p}from"./index-health.js";function m(t,a){return(o,r)=>{try{switch(o){case"session":{const e=t.getSession(r);return e&&[e.objectives,e.completed,e.notes,e.summary].filter(Boolean).join(" ")||null}case"quest":{const e=t.getDatabase().prepare("SELECT * FROM quests WHERE id = ?").get(r);return e&&[e.title,e.description].filter(Boolean).join(" ")||null}case"artifact":{const e=t.getDatabase().prepare("SELECT problem, validated_fix, needs_review, supersedes_id FROM memory_artifacts WHERE id = ?").get(r);return!e||e.needs_review!==0||e.supersedes_id!=null?null:p(e)}case"note":{const e=t.getDatabase().prepare("SELECT category, key, value FROM data_lake WHERE id = ?").all(r);if(!e.length)return null;const n=a.maybeDecrypt(e[0].value);return n.startsWith("ENCRYPTED:")?null:`${e[0].category} ${e[0].key} ${n}`}default:return null}}catch{return null}}}function R(t,a,o){let r=null,e=null;try{const n=process.env.WYRM_VECTOR_PROVIDER||"auto";l(t.getDatabase(),s(n)),s(n).resolved!=="none"&&(r=i({provider:n},t.getDatabase()),a.setVectorStore(r),e=new c(t.getDatabase(),r,m(t,o),{batchSize:20,maxRetries:u,intervalMs:1e4}),e.start())}catch(n){console.error("Wyrm: Failed to initialize vector store:",n)}return{vectorStore:r,indexingPipeline:e}}export{R as initVectorSearch,m as makeContentResolver};
|
package/dist/vectors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{setMeta as h}from"./events.js";import{redactCredentials as
|
|
1
|
+
import{setMeta as h}from"./events.js";import{redactCredentials as N}from"./security.js";import{createProvider as b,NoneProvider as E}from"./providers/embedding-provider.js";const f=new Set(["none","hash-384"]);class l{provider;db;constructor(e,t){this.provider=e,this.db=t||null,this.db&&this.ensureTable()}embedNoteAt=0;embedNoteState=null;noteEmbed(e){if(!this.db)return;const t=e==null?"ok":"error",o=Date.now();if(!(t===this.embedNoteState&&o-this.embedNoteAt<6e4)){this.embedNoteState=t,this.embedNoteAt=o;try{const r=new Date(o).toISOString();if(t==="ok")h(this.db,"embed_last_ok_at",r);else{h(this.db,"embed_last_error_at",r);const s=e instanceof Error?e.message:String(e);h(this.db,"embed_last_error",N(`${this.provider.model}: ${s}`).slice(0,400))}}catch{}}}ensureTable(){this.db&&this.db.exec(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS vectors (
|
|
3
3
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
4
|
project_id INTEGER,
|
|
@@ -14,11 +14,12 @@ import{setMeta as h}from"./events.js";import{redactCredentials as _}from"./secur
|
|
|
14
14
|
CREATE INDEX IF NOT EXISTS idx_vectors_project ON vectors(project_id);
|
|
15
15
|
CREATE INDEX IF NOT EXISTS idx_vectors_content ON vectors(content_type, content_id);
|
|
16
16
|
CREATE INDEX IF NOT EXISTS idx_vectors_hash ON vectors(content_hash);
|
|
17
|
-
|
|
17
|
+
CREATE INDEX IF NOT EXISTS idx_vectors_model_type_project ON vectors(model, content_type, project_id);
|
|
18
|
+
`)}hashContent(e){let t=0;for(let o=0;o<e.length;o++){const r=e.charCodeAt(o);t=(t<<5)-t+r,t=t&t}return Math.abs(t).toString(16)}async addVector(e,t,o,r){if(this.provider instanceof E)return null;const s=this.hashContent(e);if(this.db&&this.db.prepare("SELECT id FROM vectors WHERE content_type = ? AND content_id = ? AND model = ? AND content_hash = ?").get(t,o,this.provider.model,s))return s;let i;try{i=await this.provider.embed(e,"passage"),this.noteEmbed(null)}catch(n){return this.noteEmbed(n),null}return i.length===0?null:(this.db&&this.db.prepare(`
|
|
18
19
|
INSERT INTO vectors (project_id, content_type, content_id, content_hash, embedding, model, dimensions)
|
|
19
20
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
20
21
|
ON CONFLICT(content_type, content_id, model) DO UPDATE SET
|
|
21
22
|
content_hash = excluded.content_hash,
|
|
22
23
|
embedding = excluded.embedding,
|
|
23
24
|
created_at = datetime('now')
|
|
24
|
-
`).run(
|
|
25
|
+
`).run(r,t,o,s,Buffer.from(i.buffer),this.provider.model,this.provider.dimensions),s)}cosineSimilarity(e,t){if(e.length!==t.length)return 0;let o=0,r=0,s=0;for(let n=0;n<e.length;n++)o+=e[n]*t[n],r+=e[n]*e[n],s+=t[n]*t[n];const i=Math.sqrt(r)*Math.sqrt(s);return i>0?o/i:0}async search(e,t=10,o,r){if(this.provider instanceof E||!this.db)return[];let s;try{s=await this.provider.embed(e,"query"),this.noteEmbed(null)}catch(d){return this.noteEmbed(d),[]}if(s.length===0)return[];let i="SELECT id, content_type, content_id, project_id, content_hash, embedding, dimensions FROM vectors WHERE model = ?";const n=[this.provider.model];o!==void 0&&(i+=" AND project_id = ?",n.push(o)),r&&r.length>0&&(i+=` AND content_type IN (${r.map(()=>"?").join(",")})`,n.push(...r));const p=this.db.prepare(i).iterate(...n),a=[];for(const d of p){const c=new Float32Array(d.embedding.buffer,d.embedding.byteOffset,d.dimensions),u=this.cosineSimilarity(s,c);a.push({id:d.id,content_type:d.content_type,content_id:d.content_id,project_id:d.project_id,similarity:u,content_hash:d.content_hash})}const m=o===void 0&&!!r&&r.length>0;return a.sort((d,c)=>c.similarity-d.similarity||(m?d.content_type<c.content_type?-1:d.content_type>c.content_type?1:d.content_id-c.content_id:0)||d.id-c.id),a.slice(0,t).map(({id:d,...c})=>c)}removeVector(e,t){return this.db?this.db.prepare("DELETE FROM vectors WHERE content_type = ? AND content_id = ?").run(e,t).changes>0:!1}clearProjectVectors(e){return this.db?this.db.prepare("DELETE FROM vectors WHERE project_id = ?").run(e).changes:0}getStats(){const e={},t={};let o=0;if(this.db){const r=this.db.prepare("SELECT content_type, COUNT(*) as cnt FROM vectors GROUP BY content_type").all();for(const i of r)e[i.content_type]=i.cnt,o+=i.cnt;const s=this.db.prepare("SELECT project_id, COUNT(*) as cnt FROM vectors GROUP BY project_id").all();for(const i of s)t[i.project_id]=i.cnt}return{total:o,byType:e,byProject:t,provider:this.provider.name,model:this.provider.model}}getProvider(){return this.provider}static NON_EMBED_MODELS=f;coverageCache;indexCoverage(){const e=Date.now();if(this.coverageCache&&e-this.coverageCache.at<5e3)return this.coverageCache.value;const t=this.computeCoverage();return this.coverageCache={at:e,value:t},t}computeCoverage(){const e=this.provider.model,t={};let o=0;if(this.db){const i=this.db.prepare("SELECT model, COUNT(*) as cnt FROM vectors WHERE content_type = 'artifact' GROUP BY model").all();for(const n of i)n.model===e?o=n.cnt:t[n.model]=n.cnt}const r=Object.values(t).reduce((i,n)=>i+n,0),s=!l.NON_EMBED_MODELS.has(e)&&r>0&&o<r;return{activeModel:e,activeCount:o,otherModels:t,stale:s}}}function g(_,e){const t=b(_);return new l(t,e)}export{f as NON_EMBED_MODELS,l as VectorStore,g as createVectorStore};
|
package/dist/visibility.js
CHANGED
|
@@ -13,17 +13,17 @@ import{ICON as r}from"./icons.js";const m={today:{days:1,label:"today"},week:{da
|
|
|
13
13
|
GROUP BY p.id, p.name
|
|
14
14
|
ORDER BY MAX(s.date) DESC
|
|
15
15
|
LIMIT 10
|
|
16
|
-
`).all()}catch{return[]}})()}}function w(a){const{period:i,toolCalls:o,topTools:s,sessions:t,questsCompleted:n,questsAdded:u,failuresBlocked:l,truthsSet:h,referencesAdded:y,memoryArtifactsAdded:c,hoursLogged:p,projectsActive:f}=a,e=[];if(e.push(`# ${r.brand} What Wyrm did ${i.label}`),e.push(""),o===0&&t===0)return e.push("_Wyrm was idle
|
|
17
|
-
`);if(e.push("## The numbers"),e.push(""),t>0&&e.push(`- ${r.session} **${t}** session${t===1?"":"s"} tracked`),o>0&&e.push(`- ${r.toolCall} **${o}** Wyrm tool call${o===1?"":"s"} (your AI reached for Wyrm this many times)`),n>0&&e.push(`- ${r.questDone} **${n}** quest${n===1?"":"s"} completed`),u>0&&e.push(`- ${r.questOpen} **${u}** quest${u===1?"":"s"} added`),l>0&&e.push(`- ${r.blocked} **${l}** repeated-failure block${l===1?"":"s"}
|
|
16
|
+
`).all()}catch{return[]}})()}}function w(a){const{period:i,toolCalls:o,topTools:s,sessions:t,questsCompleted:n,questsAdded:u,failuresBlocked:l,truthsSet:h,referencesAdded:y,memoryArtifactsAdded:c,hoursLogged:p,projectsActive:f}=a,e=[];if(e.push(`# ${r.brand} What Wyrm did ${i.label}`),e.push(""),o===0&&t===0)return e.push("_Wyrm was idle: no recorded activity in this period._"),e.push(""),e.push(`If your AI helper is connected to Wyrm but you see nothing here, it means it hasn't been calling Wyrm's tools. Try asking it: *"summarize my current project using wyrm_session_prime"* or *"what failures has Wyrm recorded on this project?"*. That'll get the loop going.`),e.join(`
|
|
17
|
+
`);if(e.push("## The numbers"),e.push(""),t>0&&e.push(`- ${r.session} **${t}** session${t===1?"":"s"} tracked`),o>0&&e.push(`- ${r.toolCall} **${o}** Wyrm tool call${o===1?"":"s"} (your AI reached for Wyrm this many times)`),n>0&&e.push(`- ${r.questDone} **${n}** quest${n===1?"":"s"} completed`),u>0&&e.push(`- ${r.questOpen} **${u}** quest${u===1?"":"s"} added`),l>0&&e.push(`- ${r.blocked} **${l}** repeated-failure block${l===1?"":"s"}: Wyrm refused to suggest something that didn't work before`),h>0&&e.push(`- ${r.truth} **${h}** ground truth${h===1?"":"s"} set or re-verified`),c>0&&e.push(`- ${r.memory} **${c}** memory artifact${c===1?"":"s"} stored (patterns, lessons, anti-patterns)`),y>0&&e.push(`- ${r.reference} **${y}** design reference${y===1?"":"s"} clipped`),p>0&&e.push(`- ${r.bullet} **${p.toFixed(1)}h** logged across sessions`),s.length>0){e.push(""),e.push("## Wyrm tools your AI reached for most"),e.push("");for(const d of s)e.push(`- \`${d.name}\`: ${d.count}\xD7`)}if(f.length>0){e.push(""),e.push("## Projects Wyrm tracked"),e.push("");for(const d of f)e.push(`- ${d.name}`)}return e.push(""),e.push("---"),e.push("_If this is the first time you're seeing what Wyrm does, that's the point. It works in the background. Every quest you completed, every failed approach your AI didn't repeat, every ground truth it cited: Wyrm made that happen. Without Wyrm your AI would have re-explored the same ground every session._"),e.join(`
|
|
18
18
|
`)}function E(a){return`# ${r.brand} What is Wyrm?
|
|
19
19
|
|
|
20
|
-
You're running **Wyrm ${a}
|
|
20
|
+
You're running **Wyrm ${a}**, a memory system that makes your AI assistant *much* better at working on your stuff.
|
|
21
21
|
|
|
22
22
|
## The simplest explanation
|
|
23
23
|
|
|
24
24
|
Without Wyrm: every time you start a new conversation with Claude / Copilot / Cursor / Windsurf, the AI starts from nothing. It doesn't remember what you worked on yesterday, what decisions you made, what didn't work last time.
|
|
25
25
|
|
|
26
|
-
With Wyrm: your AI **remembers**. Across every session, every tool, every project. You don't have to re-explain. The AI picks up where you left off
|
|
26
|
+
With Wyrm: your AI **remembers**. Across every session, every tool, every project. You don't have to re-explain. The AI picks up where you left off, *with all the context*.
|
|
27
27
|
|
|
28
28
|
## What Wyrm specifically does
|
|
29
29
|
|
|
@@ -31,25 +31,25 @@ It's not just "memory" in the file-write sense. Wyrm solves four specific proble
|
|
|
31
31
|
|
|
32
32
|
**1. Amnesia.** Wyrm assembles a complete briefing at every session start. Your AI inherits the prior state instead of starting from zero.
|
|
33
33
|
|
|
34
|
-
**2. Repeated mistakes.** When an approach fails, Wyrm records it. Next time, your AI is *blocked* from suggesting the same failed thing again. Other memory tools learn only from success
|
|
34
|
+
**2. Repeated mistakes.** When an approach fails, Wyrm records it. Next time, your AI is *blocked* from suggesting the same failed thing again. Other memory tools learn only from success; Wyrm learns from failure too.
|
|
35
35
|
|
|
36
36
|
**3. Lost rationale.** When you make a decision ("we use Postgres, not Mongo"), Wyrm stores it as a *ground truth* linked to the reasoning. When something downstream changes, Wyrm cascades the impact so you don't accidentally violate decisions you forgot you made.
|
|
37
37
|
|
|
38
|
-
**4. Tool-call sprawl.** The agent loop turns goals into autonomous tool sequences. Say *"keep my dependencies up to date weekly"*
|
|
38
|
+
**4. Tool-call sprawl.** The agent loop turns goals into autonomous tool sequences. Say *"keep my dependencies up to date weekly"* and Wyrm's daemon does it.
|
|
39
39
|
|
|
40
40
|
## What to try first
|
|
41
41
|
|
|
42
42
|
If you've never used Wyrm directly, ask your AI:
|
|
43
43
|
|
|
44
|
-
- *"What's the state of this project?"
|
|
45
|
-
- *"What have we learned about [topic]?"
|
|
46
|
-
- *"Save this as a ground truth: [fact]"
|
|
47
|
-
- *"What did Wyrm do for me this week?"
|
|
48
|
-
- *"Show me everything Wyrm can do"
|
|
44
|
+
- *"What's the state of this project?"*: your AI will call \`wyrm_session_prime\` and brief you.
|
|
45
|
+
- *"What have we learned about [topic]?"*: your AI will search Wyrm's memory.
|
|
46
|
+
- *"Save this as a ground truth: [fact]"*: your AI will store it for future sessions.
|
|
47
|
+
- *"What did Wyrm do for me this week?"*: run \`wyrm_digest\` to see the work product.
|
|
48
|
+
- *"Show me everything Wyrm can do"*: call \`wyrm_capabilities\` to get the full tool catalogue.
|
|
49
49
|
|
|
50
50
|
## The 30-second pitch for skeptics
|
|
51
51
|
|
|
52
52
|
You know that feeling when your AI says *"Could you remind me what we decided about X?"* on session three of the same project? Wyrm exists so that never happens. It's the layer between you and AI amnesia.
|
|
53
53
|
|
|
54
|
-
If you've been using Claude Code / Cursor / Windsurf with Wyrm installed, **Wyrm has already been working
|
|
54
|
+
If you've been using Claude Code / Cursor / Windsurf with Wyrm installed, **Wyrm has already been working**, silently, in the background, every session. \`wyrm_digest\` shows you the receipts.
|
|
55
55
|
`}export{m as DIGEST_PRESETS,W as gatherDigest,w as renderDigest,E as renderIntro};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isWriteMethod as l}from"./readonly-gate.js";function i(n,r){const t=n[r];return Array.isArray(t)?t[0]:t}function s(n){const r=n.trim();if(!r||r==="null"||r==="*")return null;try{const t=new URL(r);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.origin}catch{return null}}const c=["http://localhost:3333","http://127.0.0.1:3333"];function h(n){if(!Array.isArray(n))return[];const r=n.filter(t=>typeof t=="string").map(t=>t.trim()).filter(t=>t!=="");return r[0]===c[0]&&r[1]===c[1]?r.slice(2):r}function d(n,r){if(!n)return[];const t=["127.0.0.1","localhost","[::1]"],e=(r??"").replace(/^::ffff:/,"");e&&t.push(e.includes(":")?`[${e}]`:e);const o=new Set;for(const f of t){const u=s(`http://${f}:${n}`);u&&o.add(u)}return[...o]}function p(n,r){if((i(n,"sec-fetch-site")??"").trim().toLowerCase()==="cross-site")return!0;const t=i(n,"origin");if(t===void 0)return!1;const e=s(t);if(e===null)return!0;for(const o of[...r.ownOrigins,...r.allowedOrigins])if(s(o)===e)return!1;return!0}function g(n,r,t){return l(n)?p(r,t)?{status:403,e:"cross-site request refused"}:(i(r,"content-type")??"").split(";")[0].trim().toLowerCase()!=="application/json"?{status:415,e:"Content-Type must be application/json"}:null:null}export{c as LEGACY_DEFAULT_ORIGINS,s as canonicalOrigin,h as configuredOrigins,p as isCrossSiteRequest,d as ownOrigins,g as refuseWrite};
|