@oracle-agent/oracle 0.16.0 → 0.17.0

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.
@@ -1,43 +1,43 @@
1
- import l from"node:fs";import c from"node:path";import{spawnSync as D}from"node:child_process";import j from"node:os";import g from"node:path";import{fileURLToPath as k}from"node:url";var x=g.dirname(k(import.meta.url)),H=g.resolve(x,"../..");function y(){return process.env.ORACLE_FAKE_HOME||j.homedir()}function b(){return process.env.ORACLE_PUBLIC_DESKTOP==="1"}function $(){return b()?process.env.ORACLE_CONFIG_DIR||g.join(y(),".config","oracle"):g.join(y(),".config","oracle")}import a from"node:fs";import p from"node:path";var f="https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",E=/^[a-z0-9]+(?:[._-][a-z0-9]+)*(?:\.[a-z0-9]+(?:[._-][a-z0-9]+)*)*$/;function P(e){let t=[],r=[];if(!e||typeof e!="object"||Array.isArray(e))return t.push("plugin.json must be a JSON object"),{valid:!1,errors:t,warnings:r};e.$schema!==f&&(e.$schema?t.push(`unsupported $schema: ${e.$schema} (expected ${f})`):t.push("$schema is required \u2014 must be "+f)),!e.name||typeof e.name!="string"?t.push("name is required (string)"):E.test(e.name)||t.push(`name "${e.name}" must be kebab-case dot-separated (e.g. deployment.tools)`),(e.version===void 0||e.version===null||e.version==="")&&r.push("version is missing \u2014 semantic versioning recommended"),e.description!==void 0&&typeof e.description!="string"&&r.push("description must be a string"),e.author!==void 0&&(typeof e.author!="object"||Array.isArray(e.author))&&r.push("author must be an object with optional name, email, url"),e.keywords!==void 0&&(Array.isArray(e.keywords)||r.push("keywords must be an array")),e.license!==void 0&&typeof e.license!="string"&&r.push("license must be a string");let s=new Set(["$schema","name","version","description","author","homepage","repository","license","keywords","extensions"]);for(let n of Object.keys(e))s.has(n)||r.push(`unknown field "${n}" \u2014 will be ignored (use extensions.<namespace> for client data)`);return{valid:t.length===0,errors:t,warnings:r}}function A(e){let t=p.join(e,"skills"),r=[];if(!a.existsSync(t)||!a.statSync(t).isDirectory())return r;function s(n,i=""){for(let o of a.readdirSync(n,{withFileTypes:!0})){let u=p.join(n,o.name);if(o.isDirectory())s(u,i?`${i}/${o.name}`:o.name);else if(o.name.endsWith(".md")){let d=i?`${i}/${o.name.replace(/\.md$/,"")}`:o.name.replace(/\.md$/,"");r.push({name:d,path:u,relativePath:p.relative(t,u)})}}}return s(t),r}function C(e){let t=p.join(e,"mcp"),r=[];if(!a.existsSync(t)||!a.statSync(t).isDirectory())return r;for(let s of a.readdirSync(t,{withFileTypes:!0})){if(!s.isFile()||!s.name.endsWith(".json"))continue;let n=p.join(t,s.name);try{let i=JSON.parse(a.readFileSync(n,"utf8"));r.push({name:s.name.replace(/\.json$/,""),path:n,config:i})}catch(i){r.push({name:s.name.replace(/\.json$/,""),path:n,error:`invalid JSON: ${i.message}`})}}return r}function m(e){let t=p.resolve(e);if(!a.existsSync(t)||!a.statSync(t).isDirectory())return{ok:!1,error:`plugin directory not found: ${t}`};let r=p.join(t,"plugin.json");if(!a.existsSync(r))return{ok:!1,error:`missing plugin.json in ${t}`};let s;try{s=JSON.parse(a.readFileSync(r,"utf8"))}catch(u){return{ok:!1,error:`invalid plugin.json: ${u.message}`}}let n=P(s);if(!n.valid)return{ok:!1,error:"manifest validation failed",errors:n.errors};let i=A(t),o=C(t);return{ok:!0,plugin:{name:s.name,version:s.version||"0.0.0",description:s.description||"",author:s.author||{},license:s.license||"UNLICENSED",root:t,manifest:s,skills:i,mcpServers:o,warnings:[...n.warnings]}}}function S(e){let t=[];if(!a.existsSync(e))return t;for(let r of a.readdirSync(e,{withFileTypes:!0})){if(!r.isDirectory())continue;let s=p.join(e,r.name),n=m(s);n.ok&&t.push(n.plugin)}return t}var _=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;function h(){let e=c.join($(),"plugins");return l.existsSync(e)||l.mkdirSync(e,{recursive:!0}),e}function v(){return["oracle plugins \u2014 manage Agent Plugins (https://agent-plugins.org/)",""," oracle plugins install <path> install from a local directory"," oracle plugins install <git-url> clone a repo and install"," oracle plugins list show installed plugins"," oracle plugins remove <name> uninstall a plugin"," oracle plugins scan <path> validate without installing"," oracle plugins setup interactive setup wizard","","plugins are installed to ~/.config/oracle/plugins/<name>/",`schema: ${f}`].join(`
2
- `)}function w(e,{name:t}={}){let r=c.resolve(e);if(!l.existsSync(r)||!l.statSync(r).isDirectory())return process.stderr.write(`error: ${e} is not a directory
3
- `),1;let s=m(r);if(!s.ok){if(process.stderr.write(`error: invalid plugin at ${r}
4
- `),s.errors)for(let u of s.errors)process.stderr.write(` - ${u}
5
- `);return 1}let n=s.plugin,i=t||n.name.replace(/\//g,"-"),o=c.join(h(),i);if(l.existsSync(o))return process.stderr.write(`plugin "${i}" already installed. use oracle plugins remove first.
6
- `),1;if(l.cpSync(r,o,{recursive:!0}),process.stdout.write(`installed ${n.name} (v${n.version}) to ${o}
7
- `),process.stdout.write(` ${n.skills.length} skills, ${n.mcpServers.length} MCP servers
8
- `),n.warnings.length)for(let u of n.warnings)process.stdout.write(` warning: ${u}
9
- `);return 0}function R(e){let t=c.join(h(),".tmp-"+Date.now());try{let r=D("git",["clone","--depth","1",e,t],{stdio:"pipe",timeout:6e4});return r.status!==0?(process.stderr.write(`error: git clone failed: ${String(r.stderr).slice(0,200)}
10
- `),1):w(t)}finally{try{l.rmSync(t,{recursive:!0,force:!0})}catch{}}}function O(){let e=S(h());if(!e.length)return process.stdout.write(`no plugins installed
1
+ import a from"node:fs";import l from"node:path";import{spawnSync as I}from"node:child_process";import v from"node:fs";import R from"node:os";import g from"node:path";import{fileURLToPath as L}from"node:url";var x=g.dirname(L(import.meta.url)),V=g.resolve(x,"../..");function w(){return process.env.ORACLE_FAKE_HOME||R.homedir()}function C(){return process.env.ORACLE_PUBLIC_DESKTOP==="1"}function y(){return C()?process.env.ORACLE_CONFIG_DIR||g.join(w(),".config","oracle"):g.join(w(),".config","oracle")}function b(){return g.join(y(),"desk.json")}function D(){return g.join(y(),"env")}function d({force:e=!1}={}){if(d._done&&!e)return d._result||null;d._done=!0;let n={},t=(r,i)=>{if(i==null)return;let o=String(i).trim();o&&(process.env[r]!=null&&String(process.env[r]).trim()!==""||(process.env[r]=o,n[r]=o))};try{let r=D();if(v.existsSync(r))for(let i of v.readFileSync(r,"utf8").split(/\r?\n/)){let o=i.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*?)\s*$/);if(!o||o[2].startsWith("#"))continue;let c=o[2];(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),t(o[1],c)}}catch{}try{let r=b();if(v.existsSync(r)){let i=JSON.parse(v.readFileSync(r,"utf8"));i&&typeof i=="object"&&(t("ORACLE_DESK_URL",i.deskUrl||i.dataUrl||i.url),t("ORACLE_DATA_URL",i.dataUrl||i.deskUrl||i.url),t("ORACLE_API_URL",i.apiUrl||i.dataUrl||i.deskUrl),t("ORACLE_PUBLIC_URL",i.publicUrl||i.deskUrl||i.dataUrl),t("ORACLE_EXEC_URL",i.execUrl),t("MAD_DESK_URL",i.deskUrl||i.dataUrl))}}catch{}let s=process.env.ORACLE_DESK_URL||process.env.ORACLE_DATA_URL||"";return s&&(t("ORACLE_DESK_URL",s),t("ORACLE_DATA_URL",s),t("ORACLE_API_URL",s),t("ORACLE_PUBLIC_URL",s),t("MAD_DESK_URL",s)),d._result=Object.keys(n).length?n:null,d._result}try{d()}catch{}import u from"node:fs";import p from"node:path";var m="https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",O=/^[a-z0-9]+(?:[._-][a-z0-9]+)*(?:\.[a-z0-9]+(?:[._-][a-z0-9]+)*)*$/;function h(e){try{let n=u.lstatSync(e);return n.isDirectory()&&!n.isSymbolicLink()}catch{return!1}}function P(){return u.constants.O_NOFOLLOW||0}function k(e){try{let n=u.lstatSync(e);return n.isFile()&&!n.isSymbolicLink()}catch{return!1}}function j(e){if(!k(e))return null;let n=u.openSync(e,u.constants.O_RDONLY|P());try{return u.readFileSync(n,"utf8")}finally{u.closeSync(n)}}function U(e){let n=[],t=[];if(!e||typeof e!="object"||Array.isArray(e))return n.push("plugin.json must be a JSON object"),{valid:!1,errors:n,warnings:t};e.$schema!==m&&(e.$schema?n.push(`unsupported $schema: ${e.$schema} (expected ${m})`):n.push("$schema is required \u2014 must be "+m)),!e.name||typeof e.name!="string"?n.push("name is required (string)"):O.test(e.name)||n.push(`name "${e.name}" must be kebab-case dot-separated (e.g. deployment.tools)`),(e.version===void 0||e.version===null||e.version==="")&&t.push("version is missing \u2014 semantic versioning recommended"),e.description!==void 0&&typeof e.description!="string"&&t.push("description must be a string"),e.author!==void 0&&(typeof e.author!="object"||Array.isArray(e.author))&&t.push("author must be an object with optional name, email, url"),e.keywords!==void 0&&(Array.isArray(e.keywords)||t.push("keywords must be an array")),e.license!==void 0&&typeof e.license!="string"&&t.push("license must be a string");let s=new Set(["$schema","name","version","description","author","homepage","repository","license","keywords","extensions"]);for(let r of Object.keys(e))s.has(r)||t.push(`unknown field "${r}" \u2014 will be ignored (use extensions.<namespace> for client data)`);return{valid:n.length===0,errors:n,warnings:t}}function N(e){let n=p.join(e,"skills"),t=[];if(!h(n))return t;function s(r,i=""){for(let o of u.readdirSync(r,{withFileTypes:!0})){let c=p.join(r,o.name);if(o.isDirectory()){if(!h(c))continue;s(c,i?`${i}/${o.name}`:o.name)}else if(o.name.endsWith(".md")){if(!k(c))continue;let f=i?`${i}/${o.name.replace(/\.md$/,"")}`:o.name.replace(/\.md$/,"");t.push({name:f,path:c,relativePath:p.relative(n,c)})}}}return s(n),t}function F(e){let n=p.join(e,"mcp"),t=[];if(!h(n))return t;for(let s of u.readdirSync(n,{withFileTypes:!0})){if(!s.isFile()||!s.name.endsWith(".json"))continue;let r=p.join(n,s.name);if(k(r))try{let i=j(r);if(i===null)continue;let o=JSON.parse(i);t.push({name:s.name.replace(/\.json$/,""),path:r,config:o})}catch(i){t.push({name:s.name.replace(/\.json$/,""),path:r,error:`invalid JSON: ${i.message}`})}}return t}function $(e){let n=p.resolve(e);if(!h(n))return{ok:!1,error:`plugin directory not found: ${n}`};let t=p.join(n,"plugin.json");if(!u.existsSync(t))return{ok:!1,error:`missing plugin.json in ${n}`};let s;try{let c=j(t);if(c===null)return{ok:!1,error:`plugin.json must be a regular file in ${n}`};s=JSON.parse(c)}catch(c){return{ok:!1,error:`invalid plugin.json: ${c.message}`}}let r=U(s);if(!r.valid)return{ok:!1,error:"manifest validation failed",errors:r.errors};let i=N(n),o=F(n);return{ok:!0,plugin:{name:s.name,version:s.version||"0.0.0",description:s.description||"",author:s.author||{},license:s.license||"UNLICENSED",root:n,manifest:s,skills:i,mcpServers:o,warnings:[...r.warnings]}}}function A(e){let n=[];if(!h(e))return n;for(let t of u.readdirSync(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let s=p.join(e,t.name),r=$(s);r.ok&&n.push(r.plugin)}return n}var M=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;function S(){let e=l.join(y(),"plugins");return a.existsSync(e)||a.mkdirSync(e,{recursive:!0}),e}function _(){return["oracle plugins \u2014 manage Agent Plugins (https://agent-plugins.org/)",""," oracle plugins install <path> install from a local directory"," oracle plugins install <git-url> clone a repo and install"," oracle plugins list show installed plugins"," oracle plugins remove <name> uninstall a plugin"," oracle plugins scan <path> validate without installing"," oracle plugins setup interactive setup wizard","","plugins are installed to ~/.config/oracle/plugins/<name>/",`schema: ${m}`].join(`
2
+ `)}function E(e,{name:n}={}){let t=l.resolve(e);if(!a.existsSync(t)||!a.statSync(t).isDirectory())return process.stderr.write(`error: ${e} is not a directory
3
+ `),1;let s=$(t);if(!s.ok){if(process.stderr.write(`error: invalid plugin at ${t}
4
+ `),s.errors)for(let c of s.errors)process.stderr.write(` - ${c}
5
+ `);return 1}let r=s.plugin,i=n||r.name.replace(/\//g,"-"),o=l.join(S(),i);if(a.existsSync(o))return process.stderr.write(`plugin "${i}" already installed. use oracle plugins remove first.
6
+ `),1;if(a.cpSync(t,o,{recursive:!0}),process.stdout.write(`installed ${r.name} (v${r.version}) to ${o}
7
+ `),process.stdout.write(` ${r.skills.length} skills, ${r.mcpServers.length} MCP servers
8
+ `),r.warnings.length)for(let c of r.warnings)process.stdout.write(` warning: ${c}
9
+ `);return 0}function W(e){let n=l.join(S(),".tmp-"+Date.now());try{let t=I("git",["clone","--depth","1",e,n],{stdio:"pipe",timeout:6e4});return t.status!==0?(process.stderr.write(`error: git clone failed: ${String(t.stderr).slice(0,200)}
10
+ `),1):E(n)}finally{try{a.rmSync(n,{recursive:!0,force:!0})}catch{}}}function T(){let e=A(S());if(!e.length)return process.stdout.write(`no plugins installed
11
11
  `),process.stdout.write(`install with: oracle plugins install <path|url>
12
12
  `),0;process.stdout.write(`${e.length} plugin(s) installed
13
13
 
14
- `);for(let t of e){let r=c.basename(t.root);process.stdout.write(` ${t.name} (v${t.version})
15
- `),process.stdout.write(` path: ${t.root}
16
- `),t.description&&process.stdout.write(` desc: ${t.description}
17
- `),process.stdout.write(` ${t.skills.length} skills, ${t.mcpServers.length} MCP servers
18
- `),t.license!=="UNLICENSED"&&process.stdout.write(` license: ${t.license}
14
+ `);for(let n of e){let t=l.basename(n.root);process.stdout.write(` ${n.name} (v${n.version})
15
+ `),process.stdout.write(` path: ${n.root}
16
+ `),n.description&&process.stdout.write(` desc: ${n.description}
17
+ `),process.stdout.write(` ${n.skills.length} skills, ${n.mcpServers.length} MCP servers
18
+ `),n.license!=="UNLICENSED"&&process.stdout.write(` license: ${n.license}
19
19
  `),process.stdout.write(`
20
- `)}return 0}function M(e){if(!e)return process.stderr.write(`usage: oracle plugins remove <name>
21
- `),1;if(!_.test(e)||c.basename(e)!==e||c.isAbsolute(e))return process.stderr.write(`invalid plugin name "${e}"
22
- `),1;let t=h(),r=l.lstatSync(t);if(r.isSymbolicLink()||!r.isDirectory())return process.stderr.write(`refusing to remove plugin: plugin root is not a regular directory
23
- `),1;let s=c.resolve(t,e),n=c.relative(t,s);if(!n||n===".."||n.startsWith(`..${c.sep}`)||c.isAbsolute(n))return process.stderr.write(`invalid plugin name "${e}"
24
- `),1;if(!l.existsSync(s))return process.stderr.write(`plugin "${e}" not found
25
- `),1;let i=l.lstatSync(s);if(i.isSymbolicLink()||!i.isDirectory())return process.stderr.write(`refusing to remove plugin "${e}": path is not a regular plugin directory
26
- `),1;let o=l.realpathSync(t),u=l.realpathSync(s),d=c.relative(o,u);return!d||d===".."||d.startsWith(`..${c.sep}`)||c.isAbsolute(d)?(process.stderr.write(`refusing to remove plugin "${e}": path escapes the plugin directory
27
- `),1):(l.rmSync(s,{recursive:!0,force:!0}),process.stdout.write(`removed plugin "${e}"
28
- `),0)}function N(e){let t=c.resolve(e),r=m(t);if(!r.ok){if(process.stderr.write(`invalid plugin: ${r.error}
29
- `),r.errors)for(let n of r.errors)process.stderr.write(` error: ${n}
30
- `);return 1}let s=r.plugin;process.stdout.write(`valid plugin: ${s.name} (v${s.version})
20
+ `)}return 0}function H(e){if(!e)return process.stderr.write(`usage: oracle plugins remove <name>
21
+ `),1;if(!M.test(e)||l.basename(e)!==e||l.isAbsolute(e))return process.stderr.write(`invalid plugin name "${e}"
22
+ `),1;let n=S(),t=a.lstatSync(n);if(t.isSymbolicLink()||!t.isDirectory())return process.stderr.write(`refusing to remove plugin: plugin root is not a regular directory
23
+ `),1;let s=l.resolve(n,e),r=l.relative(n,s);if(!r||r===".."||r.startsWith(`..${l.sep}`)||l.isAbsolute(r))return process.stderr.write(`invalid plugin name "${e}"
24
+ `),1;if(!a.existsSync(s))return process.stderr.write(`plugin "${e}" not found
25
+ `),1;let i=a.lstatSync(s);if(i.isSymbolicLink()||!i.isDirectory())return process.stderr.write(`refusing to remove plugin "${e}": path is not a regular plugin directory
26
+ `),1;let o=a.realpathSync(n),c=a.realpathSync(s),f=l.relative(o,c);return!f||f===".."||f.startsWith(`..${l.sep}`)||l.isAbsolute(f)?(process.stderr.write(`refusing to remove plugin "${e}": path escapes the plugin directory
27
+ `),1):(a.rmSync(s,{recursive:!0,force:!0}),process.stdout.write(`removed plugin "${e}"
28
+ `),0)}function K(e){let n=l.resolve(e),t=$(n);if(!t.ok){if(process.stderr.write(`invalid plugin: ${t.error}
29
+ `),t.errors)for(let r of t.errors)process.stderr.write(` error: ${r}
30
+ `);return 1}let s=t.plugin;process.stdout.write(`valid plugin: ${s.name} (v${s.version})
31
31
  `),process.stdout.write(` schema: ${s.manifest.$schema}
32
32
  `),process.stdout.write(` skills: ${s.skills.length} found
33
- `);for(let n of s.skills)process.stdout.write(` - ${n.name} (${n.relativePath})
33
+ `);for(let r of s.skills)process.stdout.write(` - ${r.name} (${r.relativePath})
34
34
  `);process.stdout.write(` mcp servers: ${s.mcpServers.length} found
35
- `);for(let n of s.mcpServers){let i=n.error?`ERROR: ${n.error}`:"ok";process.stdout.write(` - ${n.name}: ${i}
35
+ `);for(let r of s.mcpServers){let i=r.error?`ERROR: ${r.error}`:"ok";process.stdout.write(` - ${r.name}: ${i}
36
36
  `)}if(s.warnings.length){process.stdout.write(` warnings:
37
- `);for(let n of s.warnings)process.stdout.write(` - ${n}
38
- `)}return 0}function L(){return process.stdout.write(["oracle plugins setup","","Agent Plugins (https://agent-plugins.org/) is an open standard for","portable AI agent tooling. Plugins ship skills and MCP servers in a","standard package format that works across compatible clients.","","To create a plugin:"," 1. Create a directory with a plugin.json manifest"," 2. Add skills as .md files in skills/"," 3. Add MCP server configs as .json files in mcp/"," 4. Validate: oracle plugins scan <dir>"," 5. Install: oracle plugins install <dir>","","To install an existing plugin:"," oracle plugins install <path> local directory"," oracle plugins install <git-url> git repository","",`schema: ${f}`,""].join(`
39
- `)),0}var Q={name:"plugins",summary:"manage Agent Plugins (open-standard portable agent tooling)",group:"read",usage:v(),async run(e){let t=[...e.argv],r=(t[0]||"help").toLowerCase(),s=t.slice(1);if(r==="-h"||r==="--help"||r==="help")return process.stdout.write(v()+`
40
- `),0;if(r==="list"||r==="ls")return O();if(r==="install"||r==="add"){let n=s[0];return n?n.startsWith("http://")||n.startsWith("https://")||n.startsWith("git@")?R(n):w(n):(process.stderr.write(`usage: oracle plugins install <path|url>
41
- `),1)}return r==="remove"||r==="rm"||r==="uninstall"?M(s[0]):r==="scan"||r==="validate"?N(s[0]||"."):r==="setup"?L():(process.stderr.write(`oracle plugins: unknown verb '${r}'
42
- ${v()}
43
- `),1)}};export{Q as default};
37
+ `);for(let r of s.warnings)process.stdout.write(` - ${r}
38
+ `)}return 0}function z(){return process.stdout.write(["oracle plugins setup","","Agent Plugins (https://agent-plugins.org/) is an open standard for","portable AI agent tooling. Plugins ship skills and MCP servers in a","standard package format that works across compatible clients.","","To create a plugin:"," 1. Create a directory with a plugin.json manifest"," 2. Add skills as .md files in skills/"," 3. Add MCP server configs as .json files in mcp/"," 4. Validate: oracle plugins scan <dir>"," 5. Install: oracle plugins install <dir>","","To install an existing plugin:"," oracle plugins install <path> local directory"," oracle plugins install <git-url> git repository","",`schema: ${m}`,""].join(`
39
+ `)),0}var ie={name:"plugins",summary:"manage Agent Plugins (open-standard portable agent tooling)",group:"read",usage:_(),async run(e){let n=[...e.argv],t=(n[0]||"help").toLowerCase(),s=n.slice(1);if(t==="-h"||t==="--help"||t==="help")return process.stdout.write(_()+`
40
+ `),0;if(t==="list"||t==="ls")return T();if(t==="install"||t==="add"){let r=s[0];return r?r.startsWith("http://")||r.startsWith("https://")||r.startsWith("git@")?W(r):E(r):(process.stderr.write(`usage: oracle plugins install <path|url>
41
+ `),1)}return t==="remove"||t==="rm"||t==="uninstall"?H(s[0]):t==="scan"||t==="validate"?K(s[0]||"."):t==="setup"?z():(process.stderr.write(`oracle plugins: unknown verb '${t}'
42
+ ${_()}
43
+ `),1)}};export{ie as default};
@@ -1,34 +1,34 @@
1
- import{spawnSync as we}from"node:child_process";import{stdin as m,stdout as J}from"node:process";var j=Object.freeze([{key:"telegram",name:"telegram",hermes:["gateway","setup"],required:["TELEGRAM_BOT_TOKEN"],optional:["TELEGRAM_ALLOWED_USERS","TELEGRAM_PROXY"],note:"dms \xB7 groups \xB7 topics"},{key:"discord",name:"discord",hermes:["gateway","setup"],required:["DISCORD_BOT_TOKEN"],optional:["DISCORD_ALLOWED_USERS"],note:"dms \xB7 channels \xB7 threads"},{key:"slack",name:"slack",hermes:["gateway","setup"],required:["SLACK_BOT_TOKEN","SLACK_APP_TOKEN"],optional:["SLACK_ALLOWED_USERS"],note:"socket mode"},{key:"whatsapp",name:"whatsapp",hermes:["whatsapp"],required:[],optional:["WHATSAPP_ALLOWED_USERS","WHATSAPP_MODE"],note:"qr bridge"},{key:"whatsapp-cloud",name:"whatsapp cloud",hermes:["whatsapp-cloud"],required:[],optional:[],note:"business cloud api"},{key:"signal",name:"signal",hermes:["gateway","setup"],required:["SIGNAL_HTTP_URL","SIGNAL_ACCOUNT"],optional:["SIGNAL_ALLOWED_USERS"],note:"signal-cli rest bridge"},{key:"matrix",name:"matrix",hermes:["gateway","setup"],required:["MATRIX_HOMESERVER","MATRIX_ACCESS_TOKEN","MATRIX_USER_ID"],optional:["MATRIX_ALLOWED_USERS"],note:"rooms \xB7 dms"},{key:"mattermost",name:"mattermost",hermes:["gateway","setup"],required:["MATTERMOST_URL","MATTERMOST_TOKEN"],optional:["MATTERMOST_ALLOWED_USERS"],note:"channels \xB7 dms"},{key:"email",name:"email",hermes:["gateway","setup"],required:["EMAIL_ADDRESS","EMAIL_PASSWORD","EMAIL_IMAP_HOST","EMAIL_SMTP_HOST"],optional:[],note:"imap/smtp mailbox"},{key:"bluebubbles",name:"bluebubbles",hermes:["gateway","setup"],required:[],optional:[],note:"imessage via bluebubbles"},{key:"photon",name:"photon",hermes:["photon"],required:["PHOTON_PROJECT_ID","PHOTON_PROJECT_SECRET"],optional:["PHOTON_ALLOWED_USERS","PHOTON_HOME_CHANNEL"],note:"imessage via spectrum (no mac)"},{key:"homeassistant",name:"homeassistant",hermes:["gateway","setup"],required:["HASS_URL","HASS_TOKEN"],optional:[],note:"smart home"},{key:"webhook",name:"webhook",hermes:["gateway","setup"],required:[],optional:[],note:"http ingress"},{key:"api-server",name:"api server",hermes:["gateway","setup"],required:[],optional:[],note:"local http api"},{key:"dingtalk",name:"dingtalk",hermes:["gateway","setup"],required:[],optional:[],note:"dingtalk bot"},{key:"feishu",name:"feishu",hermes:["gateway","setup"],required:[],optional:[],note:"feishu / lark"},{key:"wecom",name:"wecom",hermes:["gateway","setup"],required:[],optional:[],note:"wecom"},{key:"weixin",name:"weixin",hermes:["gateway","setup"],required:[],optional:[],note:"weixin"},{key:"qqbot",name:"qqbot",hermes:["gateway","setup"],required:[],optional:[],note:"qq bot"}]);function K(t){return String(t||"").trim().toLowerCase().replace(/^\/+/,"").replace(/\s+/g,"-")}function T(){return j.slice()}function v(t){let r=K(t);if(!r)return null;for(let e of j)if(e.key===r||K(e.name)===r)return e;return null}function W({profile:t="oracle",statuses:r={}}={}){let e=["oracle setup","","one oracle. many models. every connected channel.",`profile: ${t}`,"","messaging platforms:",""];for(let n of j){let s=r[n.key]||"unset";e.push(` ${n.key.padEnd(16)} ${String(s).padEnd(8)} ${n.note}`)}return e.push(""),e.push("commands:"),e.push(" oracle setup this menu"),e.push(" oracle setup messaging open hermes gateway setup"),e.push(" oracle setup telegram configure telegram bot token"),e.push(" oracle setup discord configure discord bot token"),e.push(" oracle setup status show configured platforms (no secrets)"),e.push(" oracle setup gateway start/status hermes gateway"),e.push(" /setup same menu inside chat"),e.push(""),e.push("notes:"),e.push(" tokens stay in the hermes profile .env on this machine"),e.push(" oracle never prints bot tokens or app secrets"),e.push(" after setup: hermes -p oracle gateway restart"),e.join(`
1
+ import{spawnSync as ve}from"node:child_process";import{stdin as h,stdout as Q}from"node:process";var j=Object.freeze([{key:"telegram",name:"telegram",hermes:["gateway","setup"],required:["TELEGRAM_BOT_TOKEN"],optional:["TELEGRAM_ALLOWED_USERS","TELEGRAM_PROXY"],note:"dms \xB7 groups \xB7 topics"},{key:"discord",name:"discord",hermes:["gateway","setup"],required:["DISCORD_BOT_TOKEN"],optional:["DISCORD_ALLOWED_USERS"],note:"dms \xB7 channels \xB7 threads"},{key:"slack",name:"slack",hermes:["gateway","setup"],required:["SLACK_BOT_TOKEN","SLACK_APP_TOKEN"],optional:["SLACK_ALLOWED_USERS"],note:"socket mode"},{key:"whatsapp",name:"whatsapp",hermes:["whatsapp"],required:[],optional:["WHATSAPP_ALLOWED_USERS","WHATSAPP_MODE"],note:"qr bridge"},{key:"whatsapp-cloud",name:"whatsapp cloud",hermes:["whatsapp-cloud"],required:[],optional:[],note:"business cloud api"},{key:"signal",name:"signal",hermes:["gateway","setup"],required:["SIGNAL_HTTP_URL","SIGNAL_ACCOUNT"],optional:["SIGNAL_ALLOWED_USERS"],note:"signal-cli rest bridge"},{key:"matrix",name:"matrix",hermes:["gateway","setup"],required:["MATRIX_HOMESERVER","MATRIX_ACCESS_TOKEN","MATRIX_USER_ID"],optional:["MATRIX_ALLOWED_USERS"],note:"rooms \xB7 dms"},{key:"mattermost",name:"mattermost",hermes:["gateway","setup"],required:["MATTERMOST_URL","MATTERMOST_TOKEN"],optional:["MATTERMOST_ALLOWED_USERS"],note:"channels \xB7 dms"},{key:"email",name:"email",hermes:["gateway","setup"],required:["EMAIL_ADDRESS","EMAIL_PASSWORD","EMAIL_IMAP_HOST","EMAIL_SMTP_HOST"],optional:[],note:"imap/smtp mailbox"},{key:"bluebubbles",name:"bluebubbles",hermes:["gateway","setup"],required:[],optional:[],note:"imessage via bluebubbles"},{key:"photon",name:"photon",hermes:["photon"],required:["PHOTON_PROJECT_ID","PHOTON_PROJECT_SECRET"],optional:["PHOTON_ALLOWED_USERS","PHOTON_HOME_CHANNEL"],note:"imessage via spectrum (no mac)"},{key:"homeassistant",name:"homeassistant",hermes:["gateway","setup"],required:["HASS_URL","HASS_TOKEN"],optional:[],note:"smart home"},{key:"webhook",name:"webhook",hermes:["gateway","setup"],required:[],optional:[],note:"http ingress"},{key:"api-server",name:"api server",hermes:["gateway","setup"],required:[],optional:[],note:"local http api"},{key:"dingtalk",name:"dingtalk",hermes:["gateway","setup"],required:[],optional:[],note:"dingtalk bot"},{key:"feishu",name:"feishu",hermes:["gateway","setup"],required:[],optional:[],note:"feishu / lark"},{key:"wecom",name:"wecom",hermes:["gateway","setup"],required:[],optional:[],note:"wecom"},{key:"weixin",name:"weixin",hermes:["gateway","setup"],required:[],optional:[],note:"weixin"},{key:"qqbot",name:"qqbot",hermes:["gateway","setup"],required:[],optional:[],note:"qq bot"}]);function B(r){return String(r||"").trim().toLowerCase().replace(/^\/+/,"").replace(/\s+/g,"-")}function L(){return j.slice()}function k(r){let t=B(r);if(!t)return null;for(let e of j)if(e.key===t||B(e.name)===t)return e;return null}function F({profile:r="oracle",statuses:t={}}={}){let e=["oracle setup","","one oracle. many models. every connected channel.",`profile: ${r}`,"","messaging platforms:",""];for(let n of j){let s=t[n.key]||"unset";e.push(` ${n.key.padEnd(16)} ${String(s).padEnd(8)} ${n.note}`)}return e.push(""),e.push("commands:"),e.push(" oracle setup this menu"),e.push(" oracle setup messaging open hermes gateway setup"),e.push(" oracle setup telegram configure telegram bot token"),e.push(" oracle setup discord configure discord bot token"),e.push(" oracle setup status show configured platforms (no secrets)"),e.push(" oracle setup gateway start/status hermes gateway"),e.push(" /setup same menu inside chat"),e.push(""),e.push("notes:"),e.push(" tokens stay in the hermes profile .env on this machine"),e.push(" oracle never prints bot tokens or app secrets"),e.push(" after setup: hermes -p oracle gateway restart"),e.join(`
2
2
  `)+`
3
- `}import f from"node:fs";import se from"node:os";import C from"node:path";import Q from"node:fs";import ee from"node:os";import y from"node:path";import{fileURLToPath as te}from"node:url";var re=y.dirname(te(import.meta.url)),Ae=y.resolve(re,"../..");function S(){return process.env.ORACLE_FAKE_HOME||ee.homedir()}function ne(){return process.env.ORACLE_PUBLIC_DESKTOP==="1"}function _(){return ne()?process.env.ORACLE_CONFIG_DIR||y.join(S(),".config","oracle"):y.join(S(),".config","oracle")}function k(){return process.env.HERMES_HOME?y.resolve(process.env.HERMES_HOME):y.join(S(),".hermes")}function h(t){return Q.mkdirSync(t,{recursive:!0}),t}var oe=/(TOKEN|SECRET|PASSWORD|KEY|AUTH|PRIVATE|MNEMONIC|SEED)/i;function b(t="oracle"){return C.join(k(),"profiles",t,".env")}function ie(t){let r={};for(let e of String(t||"").split(/\r?\n/)){let n=e.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s<=0)continue;let i=n.slice(0,s).trim(),o=n.slice(s+1).trim();(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),r[i]=o}return r}function ae(t="oracle"){let r=b(t);return f.existsSync(r)?ie(f.readFileSync(r,"utf8")):{}}function B(t,r,e){if(!r||oe.test(r)===!1&&/[^A-Z0-9_]/.test(r),!/^[A-Z][A-Z0-9_]*$/.test(r)){let c=new Error(`invalid env key '${r}'`);throw c.code="BAD_KEY",c}if(e==null||String(e).trim()===""){let c=new Error(`empty value for ${r}`);throw c.code="EMPTY",c}let n=b(t);h(C.dirname(n));let s=f.existsSync(n)?f.readFileSync(n,"utf8"):"",i=s?s.split(/\r?\n/):[],o=[],a=!1,u=`${r}=${String(e)}`;for(let c of i)c.startsWith(`${r}=`)?(o.push(u),a=!0):(c.length||o.length)&&o.push(c);for(a||(o.length&&o[o.length-1]!==""&&o.push(""),o.push(u));o.length&&o[o.length-1]==="";)o.pop();o.push(""),f.writeFileSync(n,o.join(`
4
- `),{mode:384});try{f.chmodSync(n,384)}catch{}return{path:n,key:r,set:!0}}function A(t="oracle"){let r=ae(t),e={};for(let n of T()){if(!n.required.length){e[n.key]="manual";continue}let s=n.required.filter(i=>!String(r[i]||"").trim());e[n.key]=s.length?"unset":"ready"}return{profile:t,statuses:e,envPath:b(t)}}function P(t="oracle"){let{statuses:r}=A(t);return W({profile:t,statuses:r})}function V(t,r,e,n={}){let s=v(r);if(!s){let o=new Error(`unknown platform '${r}'`);throw o.code="UNKNOWN_PLATFORM",o}if(!s.required.length){let o=new Error(`${s.key} uses hermes interactive setup (oracle setup messaging)`);throw o.code="NEEDS_INTERACTIVE",o}let i=s.required[0];B(t,i,e);for(let[o,a]of Object.entries(n||{}))a!=null&&String(a).trim()&&B(t,o,a);return{platform:s.key,set:s.required,profile:t,path:b(t)}}function ue(){return C.join(_(),"setup-state.json")}function R(t={}){h(_());let r=ue(),e={};if(f.existsSync(r))try{e=JSON.parse(f.readFileSync(r,"utf8"))}catch{e={}}let n={...e,...t,updatedAt:new Date().toISOString(),host:se.hostname()};return f.writeFileSync(r,JSON.stringify(n,null,2)+`
5
- `,{mode:384}),n}import l from"node:fs";import p from"node:path";import{createHash as ce}from"node:crypto";import{spawnSync as E}from"node:child_process";var pe="0.19.0",Y=`hermes-agent==${pe}`,D=[3,11],$=[3,14],x="3.13",M="0.12.1",N=Object.freeze({posix:Object.freeze({url:`https://github.com/astral-sh/uv/releases/download/${M}/uv-installer.sh`,sha256:"d3f5412d38c99f9d024901843bf98206f0d2c6dbe64df40d0b740e2751ca62c1"}),windows:Object.freeze({url:`https://github.com/astral-sh/uv/releases/download/${M}/uv-installer.ps1`,sha256:"b9ec035151bfbb11d616dbd69886498d885551489eddf095ea3c0ad59f640eb0"})});function le(t,{windows:r=process.platform==="win32"}={}){let e=Buffer.isBuffer(t)?t:Buffer.from(t),n=r?N.windows:N.posix,s=ce("sha256").update(e).digest("hex"),i=e.toString("utf8");return s===n.sha256&&i.length>=1e3&&i.includes(M)}function g(){return p.join(_(),"runtime")}function G(){return p.join(g(),"venv")}function U(t){let r=process.platform==="win32"?"Scripts":"bin",e=process.platform==="win32"?`${t}.exe`:t;return p.join(G(),r,e)}function L(){return U("hermes")}function fe(){let t=U("python3");return l.existsSync(t)?t:U("python")}function O(){return p.join(g(),"uv",process.platform==="win32"?"uv.exe":"uv")}function w(t){let r=process.platform==="win32"&&!p.extname(t)?["",".exe",".cmd",".bat"]:[""];for(let e of(process.env.PATH||"").split(p.delimiter))if(e)for(let n of r){let s=p.join(e,`${t}${n}`);try{if(l.existsSync(s))return s}catch{}}return null}function de(t){let r=/Python (\d+)\.(\d+)\.(\d+)/.exec(t||"");return r?[Number(r[1]),Number(r[2]),Number(r[3])]:null}function me(t){if(!t)return!1;let[r,e]=t;return!(r<D[0]||r===D[0]&&e<D[1]||r>$[0]||r===$[0]&&e>=$[1])}function he(){let t=[process.env.ORACLE_PYTHON,"python3.13","python3.12","python3.11","python3","python"].filter(Boolean);for(let r of t){let e=p.isAbsolute(r)?l.existsSync(r)?r:null:w(r);if(!e)continue;let n=E(e,["--version"],{encoding:"utf8",timeout:15e3}),s=de(`${n.stdout||""}${n.stderr||""}`);if(me(s))return{bin:e,version:s.join("."),source:"host"}}return null}function ge(){return process.env.ORACLE_UV_BIN||w("uv")||(l.existsSync(p.join(S(),".local","bin","uv"))?p.join(S(),".local","bin","uv"):null)||(l.existsSync(O())?O():null)}function ye(t,r){let e=["const fs=require('node:fs');","const [url,dest]=process.argv.slice(1);","fetch(url).then(r=>{if(!r.ok)throw new Error('http '+r.status);return r.arrayBuffer()})",".then(b=>fs.writeFileSync(dest,Buffer.from(b)))",".catch(e=>{console.error(e.message);process.exit(1)});"].join("");return E(process.execPath,["-e",e,t,r],{encoding:"utf8",timeout:2*6e4})}function Se({quiet:t=!1}={}){let r=ge();if(r)return{ok:!0,bin:r,reused:!0};h(g());let e=process.platform==="win32",n=p.join(g(),e?"uv-install.ps1":"uv-install.sh"),s=e?N.windows:N.posix,i=ye(s.url,n);if(i.status!==0)return{ok:!1,reason:`could not download the uv installer (${i.status})`,stderr:(i.stderr||"").slice(-800)};let o=l.readFileSync(n);if(!le(o,{windows:e}))return{ok:!1,reason:`uv ${M} installer checksum mismatch`};let a=p.dirname(O());h(a);let u=e?w("powershell.exe")||w("powershell"):w("sh")||"/bin/sh";if(!u)return{ok:!1,reason:e?"PowerShell not found":"sh not found"};let d=E(u,e?["-NoProfile","-ExecutionPolicy","Bypass","-File",n]:[n],{stdio:t?"pipe":"inherit",encoding:"utf8",timeout:5*6e4,env:{...process.env,UV_INSTALL_DIR:a,UV_NO_MODIFY_PATH:"1"}});return d.status!==0||!l.existsSync(O())?{ok:!1,reason:`uv install failed (${d.status})`,stderr:(d.stderr||"").slice(-800)}:{ok:!0,bin:O(),reused:!1}}function F({quiet:t=!1}={}){let r=Se({quiet:t});if(!r.ok)return r;let e=r.bin,n={...process.env,UV_PYTHON_INSTALL_DIR:p.join(g(),"python"),UV_CACHE_DIR:p.join(g(),"cache")},s=E(e,["python","install","--no-bin",x],{stdio:t?"pipe":"inherit",encoding:"utf8",timeout:15*6e4,env:n});if(s.status!==0)return{ok:!1,reason:`uv python install ${x} failed (${s.status})`,stderr:(s.stderr||"").slice(-800)};let i=E(e,["python","find",x],{encoding:"utf8",timeout:6e4,env:n}),o=(i.stdout||"").trim().split(/\r?\n/)[0];return i.status!==0||!o||!l.existsSync(o)?{ok:!1,reason:`uv could not locate python ${x}`}:{ok:!0,bin:o,version:x,source:"uv"}}function z(){if(process.env.ORACLE_HERMES_BIN)return{ok:!0,bin:process.env.ORACLE_HERMES_BIN,source:"env"};let t=w("hermes");if(t)return{ok:!0,bin:t,source:"path"};let r=L();return l.existsSync(r)?{ok:!0,bin:r,source:"managed"}:{ok:!1,bin:null,source:null}}function I(t,r,{quiet:e}){return E(t,r,{stdio:e?"pipe":"inherit",encoding:"utf8",timeout:20*6e4})}function X({quiet:t=!1,upgrade:r=!1}={}){let e=he();if(!e){let c=F({quiet:t});if(c.ok)e={bin:c.bin,version:c.version,source:"uv"};else return{ok:!1,reason:`no supported python found (need 3.11-3.13) and uv could not provide one: ${c.reason}. install uv (https://docs.astral.sh/uv) or python 3.13, then re-run 'oracle bootstrap'`}}h(g());let n=G();if(l.existsSync(L())&&!r)return{ok:!0,bin:L(),reused:!0};if(!l.existsSync(p.join(n,"pyvenv.cfg"))){let c=I(e.bin,["-m","venv",n],{quiet:t});if(c.status!==0&&e.source!=="uv"){l.rmSync(n,{recursive:!0,force:!0});let d=F({quiet:t});if(d.ok)e={bin:d.bin,version:d.version,source:"uv"},c=I(e.bin,["-m","venv",n],{quiet:t});else return{ok:!1,reason:`python -m venv failed (${c.status}) and uv fallback failed: ${d.reason}`,stderr:(c.stderr||"").slice(-800)}}if(c.status!==0)return{ok:!1,reason:`isolated python -m venv failed (${c.status})`,stderr:(c.stderr||"").slice(-800)}}let i=fe();if(!l.existsSync(i))return{ok:!1,reason:`venv python missing at ${i}`};let o=["-m","pip","install","--disable-pip-version-check"];r&&o.push("--upgrade"),o.push(Y);let a=I(i,o,{quiet:t});if(a.status!==0)return{ok:!1,reason:`pip install ${Y} failed (${a.status})`,stderr:(a.stderr||"").slice(-1200)};let u=L();return l.existsSync(u)?{ok:!0,bin:u,reused:!1,python:e.version}:{ok:!1,reason:`hermes entrypoint not found after install (${u})`}}function H(){return["oracle setup \u2014 wire messaging + local agent surface",""," oracle setup menu + platform status"," oracle setup status same, machine-friendly with --json"," oracle setup messaging open hermes gateway setup wizard"," oracle setup telegram set TELEGRAM_BOT_TOKEN for profile"," oracle setup discord set DISCORD_BOT_TOKEN for profile"," oracle setup slack set slack tokens"," oracle setup <platform> any supported hermes platform"," oracle setup gateway [status|restart|start|stop]"," oracle setup profile [name] default: oracle","","chat:"," /setup"," /setup telegram"," /setup status","","tokens stay local in ~/.hermes/profiles/<profile>/.env","oracle never prints secrets."].join(`
6
- `)}function Ee(t){let r=t.indexOf("--profile");if(r>=0&&t[r+1])return t[r+1];let e=t.indexOf("-p");return e>=0&&t[e+1]?t[e+1]:process.env.ORACLE_PROFILE||"oracle"}function ve(t){let r=[];for(let e=0;e<t.length;e++){if(t[e]==="--profile"||t[e]==="-p"){e+=1;continue}r.push(t[e])}return r}function q(t,{inherit:r=!0,env:e=process.env}={}){let n=z();if(!n.ok&&process.stdin.isTTY&&process.stdout.isTTY&&process.env.ORACLE_NO_BOOTSTRAP!=="1"){process.stdout.write(`setting up oracle's local messaging runtime (one time)
3
+ `}import f from"node:fs";import ae from"node:os";import N from"node:path";import O from"node:fs";import te from"node:os";import m from"node:path";import{fileURLToPath as re}from"node:url";var ne=m.dirname(re(import.meta.url)),be=m.resolve(ne,"../..");function _(){return process.env.ORACLE_FAKE_HOME||te.homedir()}function se(){return process.env.ORACLE_PUBLIC_DESKTOP==="1"}function g(){return se()?process.env.ORACLE_CONFIG_DIR||m.join(_(),".config","oracle"):m.join(_(),".config","oracle")}function oe(){return m.join(g(),"desk.json")}function ie(){return m.join(g(),"env")}function E({force:r=!1}={}){if(E._done&&!r)return E._result||null;E._done=!0;let t={},e=(s,o)=>{if(o==null)return;let i=String(o).trim();i&&(process.env[s]!=null&&String(process.env[s]).trim()!==""||(process.env[s]=i,t[s]=i))};try{let s=ie();if(O.existsSync(s))for(let o of O.readFileSync(s,"utf8").split(/\r?\n/)){let i=o.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*?)\s*$/);if(!i||i[2].startsWith("#"))continue;let a=i[2];(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),e(i[1],a)}}catch{}try{let s=oe();if(O.existsSync(s)){let o=JSON.parse(O.readFileSync(s,"utf8"));o&&typeof o=="object"&&(e("ORACLE_DESK_URL",o.deskUrl||o.dataUrl||o.url),e("ORACLE_DATA_URL",o.dataUrl||o.deskUrl||o.url),e("ORACLE_API_URL",o.apiUrl||o.dataUrl||o.deskUrl),e("ORACLE_PUBLIC_URL",o.publicUrl||o.deskUrl||o.dataUrl),e("ORACLE_EXEC_URL",o.execUrl),e("MAD_DESK_URL",o.deskUrl||o.dataUrl))}}catch{}let n=process.env.ORACLE_DESK_URL||process.env.ORACLE_DATA_URL||"";return n&&(e("ORACLE_DESK_URL",n),e("ORACLE_DATA_URL",n),e("ORACLE_API_URL",n),e("ORACLE_PUBLIC_URL",n),e("MAD_DESK_URL",n)),E._result=Object.keys(t).length?t:null,E._result}try{E()}catch{}function x(){return process.env.HERMES_HOME?m.resolve(process.env.HERMES_HOME):m.join(_(),".hermes")}function y(r){return O.mkdirSync(r,{recursive:!0}),r}var ue=/(TOKEN|SECRET|PASSWORD|KEY|AUTH|PRIVATE|MNEMONIC|SEED)/i;function T(r="oracle"){return N.join(x(),"profiles",r,".env")}function ce(r){let t={};for(let e of String(r||"").split(/\r?\n/)){let n=e.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s<=0)continue;let o=n.slice(0,s).trim(),i=n.slice(s+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),t[o]=i}return t}function le(r="oracle"){let t=T(r);return f.existsSync(t)?ce(f.readFileSync(t,"utf8")):{}}function V(r,t,e){if(!t||ue.test(t)===!1&&/[^A-Z0-9_]/.test(t),!/^[A-Z][A-Z0-9_]*$/.test(t)){let c=new Error(`invalid env key '${t}'`);throw c.code="BAD_KEY",c}if(e==null||String(e).trim()===""){let c=new Error(`empty value for ${t}`);throw c.code="EMPTY",c}let n=T(r);y(N.dirname(n));let s=f.existsSync(n)?f.readFileSync(n,"utf8"):"",o=s?s.split(/\r?\n/):[],i=[],a=!1,u=`${t}=${String(e)}`;for(let c of o)c.startsWith(`${t}=`)?(i.push(u),a=!0):(c.length||i.length)&&i.push(c);for(a||(i.length&&i[i.length-1]!==""&&i.push(""),i.push(u));i.length&&i[i.length-1]==="";)i.pop();i.push(""),f.writeFileSync(n,i.join(`
4
+ `),{mode:384});try{f.chmodSync(n,384)}catch{}return{path:n,key:t,set:!0}}function P(r="oracle"){let t=le(r),e={};for(let n of L()){if(!n.required.length){e[n.key]="manual";continue}let s=n.required.filter(o=>!String(t[o]||"").trim());e[n.key]=s.length?"unset":"ready"}return{profile:r,statuses:e,envPath:T(r)}}function b(r="oracle"){let{statuses:t}=P(r);return F({profile:r,statuses:t})}function Y(r,t,e,n={}){let s=k(t);if(!s){let i=new Error(`unknown platform '${t}'`);throw i.code="UNKNOWN_PLATFORM",i}if(!s.required.length){let i=new Error(`${s.key} uses hermes interactive setup (oracle setup messaging)`);throw i.code="NEEDS_INTERACTIVE",i}let o=s.required[0];V(r,o,e);for(let[i,a]of Object.entries(n||{}))a!=null&&String(a).trim()&&V(r,i,a);return{platform:s.key,set:s.required,profile:r,path:T(r)}}function pe(){return N.join(g(),"setup-state.json")}function U(r={}){y(g());let t=pe(),e={};if(f.existsSync(t))try{e=JSON.parse(f.readFileSync(t,"utf8"))}catch{e={}}let n={...e,...r,updatedAt:new Date().toISOString(),host:ae.hostname()};return f.writeFileSync(t,JSON.stringify(n,null,2)+`
5
+ `,{mode:384}),n}import p from"node:fs";import l from"node:path";import{createHash as fe}from"node:crypto";import{spawnSync as v}from"node:child_process";var de="0.19.0",G=`hermes-agent==${de}`,I=[3,11],$=[3,14],A="3.13",D="0.12.1",M=Object.freeze({posix:Object.freeze({url:`https://github.com/astral-sh/uv/releases/download/${D}/uv-installer.sh`,sha256:"d3f5412d38c99f9d024901843bf98206f0d2c6dbe64df40d0b740e2751ca62c1"}),windows:Object.freeze({url:`https://github.com/astral-sh/uv/releases/download/${D}/uv-installer.ps1`,sha256:"b9ec035151bfbb11d616dbd69886498d885551489eddf095ea3c0ad59f640eb0"})});function me(r,{windows:t=process.platform==="win32"}={}){let e=Buffer.isBuffer(r)?r:Buffer.from(r),n=t?M.windows:M.posix,s=fe("sha256").update(e).digest("hex"),o=e.toString("utf8");return s===n.sha256&&o.length>=1e3&&o.includes(D)}function S(){return l.join(g(),"runtime")}function X(){return l.join(S(),"venv")}function q(r){let t=process.platform==="win32"?"Scripts":"bin",e=process.platform==="win32"?`${r}.exe`:r;return l.join(X(),t,e)}function C(){return q("hermes")}function he(){let r=q("python3");return p.existsSync(r)?r:q("python")}function R(){return l.join(S(),"uv",process.platform==="win32"?"uv.exe":"uv")}function w(r){let t=process.platform==="win32"&&!l.extname(r)?["",".exe",".cmd",".bat"]:[""];for(let e of(process.env.PATH||"").split(l.delimiter))if(e)for(let n of t){let s=l.join(e,`${r}${n}`);try{if(p.existsSync(s))return s}catch{}}return null}function ge(r){let t=/Python (\d+)\.(\d+)\.(\d+)/.exec(r||"");return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function ye(r){if(!r)return!1;let[t,e]=r;return!(t<I[0]||t===I[0]&&e<I[1]||t>$[0]||t===$[0]&&e>=$[1])}function Se(){let r=[process.env.ORACLE_PYTHON,"python3.13","python3.12","python3.11","python3","python"].filter(Boolean);for(let t of r){let e=l.isAbsolute(t)?p.existsSync(t)?t:null:w(t);if(!e)continue;let n=v(e,["--version"],{encoding:"utf8",timeout:15e3}),s=ge(`${n.stdout||""}${n.stderr||""}`);if(ye(s))return{bin:e,version:s.join("."),source:"host"}}return null}function Ee(){return process.env.ORACLE_UV_BIN||w("uv")||(p.existsSync(l.join(_(),".local","bin","uv"))?l.join(_(),".local","bin","uv"):null)||(p.existsSync(R())?R():null)}function _e(r,t){let e=["const fs=require('node:fs');","const [url,dest]=process.argv.slice(1);","fetch(url).then(r=>{if(!r.ok)throw new Error('http '+r.status);return r.arrayBuffer()})",".then(b=>fs.writeFileSync(dest,Buffer.from(b)))",".catch(e=>{console.error(e.message);process.exit(1)});"].join("");return v(process.execPath,["-e",e,r,t],{encoding:"utf8",timeout:2*6e4})}function we({quiet:r=!1}={}){let t=Ee();if(t)return{ok:!0,bin:t,reused:!0};y(S());let e=process.platform==="win32",n=l.join(S(),e?"uv-install.ps1":"uv-install.sh"),s=e?M.windows:M.posix,o=_e(s.url,n);if(o.status!==0)return{ok:!1,reason:`could not download the uv installer (${o.status})`,stderr:(o.stderr||"").slice(-800)};let i=p.readFileSync(n);if(!me(i,{windows:e}))return{ok:!1,reason:`uv ${D} installer checksum mismatch`};let a=l.dirname(R());y(a);let u=e?w("powershell.exe")||w("powershell"):w("sh")||"/bin/sh";if(!u)return{ok:!1,reason:e?"PowerShell not found":"sh not found"};let d=v(u,e?["-NoProfile","-ExecutionPolicy","Bypass","-File",n]:[n],{stdio:r?"pipe":"inherit",encoding:"utf8",timeout:5*6e4,env:{...process.env,UV_INSTALL_DIR:a,UV_NO_MODIFY_PATH:"1"}});return d.status!==0||!p.existsSync(R())?{ok:!1,reason:`uv install failed (${d.status})`,stderr:(d.stderr||"").slice(-800)}:{ok:!0,bin:R(),reused:!1}}function J({quiet:r=!1}={}){let t=we({quiet:r});if(!t.ok)return t;let e=t.bin,n={...process.env,UV_PYTHON_INSTALL_DIR:l.join(S(),"python"),UV_CACHE_DIR:l.join(S(),"cache")},s=v(e,["python","install","--no-bin",A],{stdio:r?"pipe":"inherit",encoding:"utf8",timeout:15*6e4,env:n});if(s.status!==0)return{ok:!1,reason:`uv python install ${A} failed (${s.status})`,stderr:(s.stderr||"").slice(-800)};let o=v(e,["python","find",A],{encoding:"utf8",timeout:6e4,env:n}),i=(o.stdout||"").trim().split(/\r?\n/)[0];return o.status!==0||!i||!p.existsSync(i)?{ok:!1,reason:`uv could not locate python ${A}`}:{ok:!0,bin:i,version:A,source:"uv"}}function z(){if(process.env.ORACLE_HERMES_BIN)return{ok:!0,bin:process.env.ORACLE_HERMES_BIN,source:"env"};let r=w("hermes");if(r)return{ok:!0,bin:r,source:"path"};let t=C();return p.existsSync(t)?{ok:!0,bin:t,source:"managed"}:{ok:!1,bin:null,source:null}}function H(r,t,{quiet:e}){return v(r,t,{stdio:e?"pipe":"inherit",encoding:"utf8",timeout:20*6e4})}function Z({quiet:r=!1,upgrade:t=!1}={}){let e=Se();if(!e){let c=J({quiet:r});if(c.ok)e={bin:c.bin,version:c.version,source:"uv"};else return{ok:!1,reason:`no supported python found (need 3.11-3.13) and uv could not provide one: ${c.reason}. install uv (https://docs.astral.sh/uv) or python 3.13, then re-run 'oracle bootstrap'`}}y(S());let n=X();if(p.existsSync(C())&&!t)return{ok:!0,bin:C(),reused:!0};if(!p.existsSync(l.join(n,"pyvenv.cfg"))){let c=H(e.bin,["-m","venv",n],{quiet:r});if(c.status!==0&&e.source!=="uv"){p.rmSync(n,{recursive:!0,force:!0});let d=J({quiet:r});if(d.ok)e={bin:d.bin,version:d.version,source:"uv"},c=H(e.bin,["-m","venv",n],{quiet:r});else return{ok:!1,reason:`python -m venv failed (${c.status}) and uv fallback failed: ${d.reason}`,stderr:(c.stderr||"").slice(-800)}}if(c.status!==0)return{ok:!1,reason:`isolated python -m venv failed (${c.status})`,stderr:(c.stderr||"").slice(-800)}}let o=he();if(!p.existsSync(o))return{ok:!1,reason:`venv python missing at ${o}`};let i=["-m","pip","install","--disable-pip-version-check"];t&&i.push("--upgrade"),i.push(G);let a=H(o,i,{quiet:r});if(a.status!==0)return{ok:!1,reason:`pip install ${G} failed (${a.status})`,stderr:(a.stderr||"").slice(-1200)};let u=C();return p.existsSync(u)?{ok:!0,bin:u,reused:!1,python:e.version}:{ok:!1,reason:`hermes entrypoint not found after install (${u})`}}function K(){return["oracle setup \u2014 wire messaging + local agent surface",""," oracle setup menu + platform status"," oracle setup status same, machine-friendly with --json"," oracle setup messaging open hermes gateway setup wizard"," oracle setup telegram set TELEGRAM_BOT_TOKEN for profile"," oracle setup discord set DISCORD_BOT_TOKEN for profile"," oracle setup slack set slack tokens"," oracle setup <platform> any supported hermes platform"," oracle setup gateway [status|restart|start|stop]"," oracle setup profile [name] default: oracle","","chat:"," /setup"," /setup telegram"," /setup status","","tokens stay local in ~/.hermes/profiles/<profile>/.env","oracle never prints secrets."].join(`
6
+ `)}function ke(r){let t=r.indexOf("--profile");if(t>=0&&r[t+1])return r[t+1];let e=r.indexOf("-p");return e>=0&&r[e+1]?r[e+1]:process.env.ORACLE_PROFILE||"oracle"}function Oe(r){let t=[];for(let e=0;e<r.length;e++){if(r[e]==="--profile"||r[e]==="-p"){e+=1;continue}t.push(r[e])}return t}function W(r,{inherit:t=!0,env:e=process.env}={}){let n=z();if(!n.ok&&process.stdin.isTTY&&process.stdout.isTTY&&process.env.ORACLE_NO_BOOTSTRAP!=="1"){process.stdout.write(`setting up oracle's local messaging runtime (one time)
7
7
 
8
- `);let i=X();i.ok&&(n={ok:!0,bin:i.bin})}if(!n.ok)return process.stderr.write(`oracle setup needs the local runtime
8
+ `);let o=Z();o.ok&&(n={ok:!0,bin:o.bin})}if(!n.ok)return process.stderr.write(`oracle setup needs the local runtime
9
9
  run: oracle bootstrap
10
- `),1;let s=we(n.bin,t,{stdio:r?"inherit":"pipe",encoding:"utf8",env:e});return s.error?(process.stderr.write(`oracle setup: failed to run hermes: ${s.error.message}
11
- `),1):(r||(s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr)),typeof s.status=="number"?s.status:1)}async function Z(t){if(!m.isTTY||typeof m.setRawMode!="function"){let r=new Error("interactive token entry requires a tty");throw r.code="NO_TTY",r}return J.write(`${t}: `),new Promise((r,e)=>{let n="",s=()=>{m.off("data",i),m.setRawMode(!1),m.pause(),J.write(`
12
- `)},i=o=>{for(let a of String(o)){if(a==="\r"||a===`
13
- `){s(),r(n.trim());return}if(a===""){s(),e(new Error("cancelled"));return}a==="\x7F"||a==="\b"?n=n.slice(0,-1):n+=a}};m.setRawMode(!0),m.resume(),m.on("data",i)})}async function _e(t,r,e=[]){let n=v(r);if(!n)return process.stderr.write(`oracle setup: unknown platform '${r}'
14
- `),process.stderr.write(`known: ${T().map(u=>u.key).join(", ")}
10
+ `),1;let s=ve(n.bin,r,{stdio:t?"inherit":"pipe",encoding:"utf8",env:e});return s.error?(process.stderr.write(`oracle setup: failed to run hermes: ${s.error.message}
11
+ `),1):(t||(s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr)),typeof s.status=="number"?s.status:1)}async function ee(r){if(!h.isTTY||typeof h.setRawMode!="function"){let t=new Error("interactive token entry requires a tty");throw t.code="NO_TTY",t}return Q.write(`${r}: `),new Promise((t,e)=>{let n="",s=()=>{h.off("data",o),h.setRawMode(!1),h.pause(),Q.write(`
12
+ `)},o=i=>{for(let a of String(i)){if(a==="\r"||a===`
13
+ `){s(),t(n.trim());return}if(a===""){s(),e(new Error("cancelled"));return}a==="\x7F"||a==="\b"?n=n.slice(0,-1):n+=a}};h.setRawMode(!0),h.resume(),h.on("data",o)})}async function xe(r,t,e=[]){let n=k(t);if(!n)return process.stderr.write(`oracle setup: unknown platform '${t}'
14
+ `),process.stderr.write(`known: ${L().map(u=>u.key).join(", ")}
15
15
  `),1;if(!n.required.length)return process.stdout.write(`opening hermes setup for ${n.key} (interactive)
16
- `),R({lastPlatform:n.key,profile:t}),q(["-p",t,...n.hermes||["gateway","setup"]]);let s={},i=[];for(let u=0;u<e.length;u++){let c=e[u];if(c==="--token"&&e[u+1]){s.token=e[++u];continue}if(c==="--allowed-users"&&e[u+1]){s.allowedUsers=e[++u];continue}if(c==="--app-token"&&e[u+1]){s.appToken=e[++u];continue}if(c.startsWith("-"))return process.stderr.write(`oracle setup: unknown flag ${c}
17
- `),1;i.push(c)}let o=s.token||i[0]||"";if(!o)try{o=await Z(`${n.key} bot token`)}catch(u){if(u?.code==="NO_TTY")return process.stderr.write(`oracle setup ${n.key}: pass --token <value> in non-interactive mode
18
- `),1;throw u}if(!o)return process.stderr.write(`aborted: empty token
19
- `),1;let a={};if(s.allowedUsers&&(n.key==="telegram"&&(a.TELEGRAM_ALLOWED_USERS=s.allowedUsers),n.key==="discord"&&(a.DISCORD_ALLOWED_USERS=s.allowedUsers),n.key==="slack"&&(a.SLACK_ALLOWED_USERS=s.allowedUsers)),s.appToken&&n.key==="slack"&&(a.SLACK_APP_TOKEN=s.appToken),n.key==="slack"&&!a.SLACK_APP_TOKEN){let u=s.appToken||i[1]||"";if(!u&&process.stdin.isTTY&&(u=await Z("slack app token (xapp-...)")),!u)return process.stderr.write(`slack needs bot token + app token
20
- `),1;a.SLACK_APP_TOKEN=u}try{let u=V(t,n.key,o,a);return R({lastPlatform:n.key,profile:t,ready:!0}),process.stdout.write(`saved ${n.key} credentials for profile '${t}'
16
+ `),U({lastPlatform:n.key,profile:r}),W(["-p",r,...n.hermes||["gateway","setup"]]);let s={},o=[];for(let u=0;u<e.length;u++){let c=e[u];if(c==="--token"&&e[u+1]){s.token=e[++u];continue}if(c==="--allowed-users"&&e[u+1]){s.allowedUsers=e[++u];continue}if(c==="--app-token"&&e[u+1]){s.appToken=e[++u];continue}if(c.startsWith("-"))return process.stderr.write(`oracle setup: unknown flag ${c}
17
+ `),1;o.push(c)}let i=s.token||o[0]||"";if(!i)try{i=await ee(`${n.key} bot token`)}catch(u){if(u?.code==="NO_TTY")return process.stderr.write(`oracle setup ${n.key}: pass --token <value> in non-interactive mode
18
+ `),1;throw u}if(!i)return process.stderr.write(`aborted: empty token
19
+ `),1;let a={};if(s.allowedUsers&&(n.key==="telegram"&&(a.TELEGRAM_ALLOWED_USERS=s.allowedUsers),n.key==="discord"&&(a.DISCORD_ALLOWED_USERS=s.allowedUsers),n.key==="slack"&&(a.SLACK_ALLOWED_USERS=s.allowedUsers)),s.appToken&&n.key==="slack"&&(a.SLACK_APP_TOKEN=s.appToken),n.key==="slack"&&!a.SLACK_APP_TOKEN){let u=s.appToken||o[1]||"";if(!u&&process.stdin.isTTY&&(u=await ee("slack app token (xapp-...)")),!u)return process.stderr.write(`slack needs bot token + app token
20
+ `),1;a.SLACK_APP_TOKEN=u}try{let u=Y(r,n.key,i,a);return U({lastPlatform:n.key,profile:r,ready:!0}),process.stdout.write(`saved ${n.key} credentials for profile '${r}'
21
21
  path: ${u.path}
22
22
  next: oracle setup gateway restart
23
23
  `),0}catch(u){return process.stderr.write(`oracle setup: ${u.message}
24
- `),1}}var ze={name:"setup",summary:"configure telegram/discord/slack messaging platforms",group:"read",usage:H(),async run(t){let r=[...t.argv],e=r.includes("--json"),n=Ee(r),s=ve(r).filter(a=>a!=="--json"),i=(s[0]||"menu").toLowerCase(),o=s.slice(1);if(["-h","--help","help"].includes(i))return process.stdout.write(H()+`
25
- `),0;if(["menu","list","ls"].includes(i))return e?process.stdout.write(JSON.stringify(A(n),null,2)+`
26
- `):process.stdout.write(P(n)),0;if(["status","show"].includes(i)){let a=A(n);return e?process.stdout.write(JSON.stringify(a,null,2)+`
27
- `):(process.stdout.write(P(n)),process.stdout.write(`hermes root: ${k()}
28
- `)),0}if(["messaging","gateway-setup","platforms"].includes(i))return R({lastAction:"messaging",profile:n}),process.stdout.write(`opening hermes gateway setup wizard...
29
- `),q(["-p",n,"gateway","setup"]);if(i==="gateway"){let a=(o[0]||"status").toLowerCase();return["status","start","stop","restart","run","install"].includes(a)?q(["-p",n,"gateway",a]):(process.stderr.write(`usage: oracle setup gateway [status|start|stop|restart|run|install]
30
- `),1)}if(i==="profile"){let a=o[0]||n;return process.stdout.write(`profile: ${a}
31
- hermes: ${k()}/profiles/${a}
32
- `),process.stdout.write(P(a)),0}return v(i)?_e(n,i,o):(process.stderr.write(`oracle setup: unknown verb '${i}'
33
- ${H()}
34
- `),1)}};export{ze as default};
24
+ `),1}}var Ze={name:"setup",summary:"configure telegram/discord/slack messaging platforms",group:"read",usage:K(),async run(r){let t=[...r.argv],e=t.includes("--json"),n=ke(t),s=Oe(t).filter(a=>a!=="--json"),o=(s[0]||"menu").toLowerCase(),i=s.slice(1);if(["-h","--help","help"].includes(o))return process.stdout.write(K()+`
25
+ `),0;if(["menu","list","ls"].includes(o))return e?process.stdout.write(JSON.stringify(P(n),null,2)+`
26
+ `):process.stdout.write(b(n)),0;if(["status","show"].includes(o)){let a=P(n);return e?process.stdout.write(JSON.stringify(a,null,2)+`
27
+ `):(process.stdout.write(b(n)),process.stdout.write(`hermes root: ${x()}
28
+ `)),0}if(["messaging","gateway-setup","platforms"].includes(o))return U({lastAction:"messaging",profile:n}),process.stdout.write(`opening hermes gateway setup wizard...
29
+ `),W(["-p",n,"gateway","setup"]);if(o==="gateway"){let a=(i[0]||"status").toLowerCase();return["status","start","stop","restart","run","install"].includes(a)?W(["-p",n,"gateway",a]):(process.stderr.write(`usage: oracle setup gateway [status|start|stop|restart|run|install]
30
+ `),1)}if(o==="profile"){let a=i[0]||n;return process.stdout.write(`profile: ${a}
31
+ hermes: ${x()}/profiles/${a}
32
+ `),process.stdout.write(b(a)),0}return k(o)?xe(n,o,i):(process.stderr.write(`oracle setup: unknown verb '${o}'
33
+ ${K()}
34
+ `),1)}};export{Ze as default};
@@ -1,4 +1,21 @@
1
- var i={name:"sign",summary:"provision / check the local signer (opt-in)",group:"sign",usage:"oracle sign <init|doctor> ...",async run(r){let e=r.argv[0];return e==="init"?r.dispatchOperator("oracle-agentic-init",r.argv.slice(1),{appendHintOnError:!0}):e==="doctor"?r.dispatchOperator("oracle-agentic-doctor",r.argv.slice(1),{appendHintOnError:!0}):(process.stderr.write(`usage: oracle sign <init|doctor> ...
1
+ var A={name:"sign",summary:"provision / check / import local signer keys",group:"sign",usage:"oracle sign <init|doctor|import> ...",async run(e){let c=e.argv[0];if(c==="init")return e.dispatchOperator("oracle-agentic-init",e.argv.slice(1),{appendHintOnError:!0});if(c==="doctor")return e.dispatchOperator("oracle-agentic-doctor",e.argv.slice(1),{appendHintOnError:!0});if(c==="import"){let{createInterface:m}=await import("node:readline"),{writeFileSync:n,mkdirSync:u,existsSync:a,unlinkSync:v,readFileSync:k,statSync:w}=await import("node:fs"),{join:s,parse:S}=await import("node:path"),{homedir:E,platform:x}=await import("node:os"),l=process.env.ORACLE_CONFIG_DIR||s(E(),".config","oracle"),p=s(l,"keys"),r=s(p,"evm.json"),t=e.argv.includes("--keyfile")?e.argv[e.argv.indexOf("--keyfile")+1]:null;if(t){if(!a(t))return process.stderr.write(`oracle sign: ${t} not found
2
+ `),1;let i=k(t,"utf8").trim(),o=i.startsWith("{")&&JSON.parse(i).key||i;if(!o.startsWith("0x")||o.length<64)return process.stderr.write(`oracle sign: invalid private key in file
3
+ `),1;if(a(r))return process.stderr.write(`oracle sign: ${r} already exists
4
+ `),1;u(p,{recursive:!0,mode:448}),n(r,JSON.stringify({key:o},null,2)+`
5
+ `,{mode:384}),process.stderr.write(`Saved to ${r} (0600)
6
+ `);try{try{n(t,Buffer.alloc(w(t).size,0))}catch{}v(t)}catch{}let f=s(l,"exec.env");return n(f,`ORACLE_EXEC_ENABLED=1
7
+ `,"utf8"),process.stderr.write(`Armed: ${f}
8
+ `),0}let y=m({input:process.stdin,output:process.stderr}),h=i=>new Promise(o=>y.question(i,o));process.stderr.write(`
9
+ Your key stays local \u2014 Oracle never sends it anywhere.
10
+ `),process.stderr.write(`Paste your EVM private key (0x...):
11
+ > `);let O=await h("");y.close();let d=O.trim();if(!d.startsWith("0x")||d.length<64)return process.stderr.write(`oracle sign: invalid private key \u2014 must be 0x-prefixed hex
12
+ `),1;if(a(r))return process.stderr.write(`oracle sign: ${r} already exists \u2014 remove it first or use 'oracle sign doctor'
13
+ `),1;u(p,{recursive:!0,mode:448}),n(r,JSON.stringify({key:d},null,2)+`
14
+ `,{mode:384}),process.stderr.write(`Saved to ${r} (0600)
15
+ `);let g=s(l,"exec.env");return n(g,`ORACLE_EXEC_ENABLED=1
16
+ `,"utf8"),process.stderr.write(`Armed: ${g}
17
+ `),0}return process.stderr.write(`usage: oracle sign <init|doctor|import> ...
2
18
  oracle sign init provision keys + policy (interactive)
19
+ oracle sign import import an existing EVM private key
3
20
  oracle sign doctor check local signer readiness
4
- `),1)}};export{i as default};
21
+ `),1}};export{A as default};