@oracle-agent/oracle 0.22.5 → 0.22.7
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/assets/profiles/oracle/SOUL.md +4 -3
- package/dist/bin/oracle.mjs +10 -9
- package/dist/cli/commands/bootstrap.mjs +3 -3
- package/dist/cli/commands/chat.mjs +61 -61
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/harness.mjs +7 -9
- package/dist/cli/commands/model.mjs +67 -67
- package/dist/cli/commands/setup.mjs +38 -38
- package/dist/index.mjs +20 -19
- package/dist/onboarding/harness-configs.mjs +5 -4
- package/package.json +1 -1
- package/public/agent-connect/app.js +54 -22
- package/public/agent-connect/index.html +8 -3
- package/public/oracle-splash/index.html +5 -0
|
@@ -120,6 +120,7 @@ evidence. When something failed, say what failed and what you tried.
|
|
|
120
120
|
## Self-host
|
|
121
121
|
|
|
122
122
|
Oracle ships its own agent runtime — direct OAuth to Claude, Codex, and Grok.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
Native standalone is the only default. Hermes is optional and never auto-selected:
|
|
124
|
+
`oracle harness detect` can show it on PATH, and you opt in only with
|
|
125
|
+
`ORACLE_CHAT_BACKEND=hermes`. Otherwise `oracle chat` runs the built-in agent
|
|
126
|
+
loop, tools, memory, skills, and cron scheduler.
|
package/dist/bin/oracle.mjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{realpathSync as U}from"node:fs";import{fileURLToPath as re}from"node:url";import h from"node:fs";import g from"node:path";import{pathToFileURL as Y}from"node:url";import d from"node:fs";import P from"node:os";import i from"node:path";import{fileURLToPath as D}from"node:url";var T=i.dirname(D(import.meta.url)),l=i.resolve(T,"../..");function u(){return process.env.ORACLE_FAKE_HOME||P.homedir()}function v(){return process.env.ORACLE_PUBLIC_DESKTOP==="1"}function f(){return v()?process.env.ORACLE_CONFIG_DIR||i.join(u(),".config","oracle"):i.join(u(),".config","oracle")}function $(){return i.join(f(),"exec.env")}function _(){return i.join(f(),"desk.json")}function A(){return i.join(f(),"env")}function p({force:e=!1}={}){if(p._done&&!e)return p._result||null;p._done=!0;let o={},r=(a,t)=>{if(t==null)return;let n=String(t).trim();n&&(process.env[a]!=null&&String(process.env[a]).trim()!==""||(process.env[a]=n,o[a]=n))};try{let a=A();if(d.existsSync(a))for(let t of d.readFileSync(a,"utf8").split(/\r?\n/)){let n=t.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*?)\s*$/);if(!n||n[2].startsWith("#"))continue;let c=n[2];(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),r(n[1],c)}}catch{}try{let a=_();if(d.existsSync(a)){let t=JSON.parse(d.readFileSync(a,"utf8"));t&&typeof t=="object"&&(r("ORACLE_DESK_URL",t.deskUrl||t.dataUrl||t.url),r("ORACLE_DATA_URL",t.dataUrl||t.deskUrl||t.url),r("ORACLE_API_URL",t.apiUrl||t.dataUrl||t.deskUrl),r("ORACLE_PUBLIC_URL",t.publicUrl||t.deskUrl||t.dataUrl),r("ORACLE_EXEC_URL",t.execUrl),r("MAD_DESK_URL",t.deskUrl||t.dataUrl))}}catch{}let s=process.env.ORACLE_DESK_URL||process.env.ORACLE_DATA_URL||"";return s&&(r("ORACLE_DESK_URL",s),r("ORACLE_DATA_URL",s),r("ORACLE_API_URL",s),r("ORACLE_PUBLIC_URL",s),r("MAD_DESK_URL",s)),p._result=Object.keys(o).length?o:null,p._result}try{p()}catch{}function H(){return process.env.HERMES_HOME?i.resolve(process.env.HERMES_HOME):i.join(u(),".hermes")}function I(){return i.join(u(),".claude.json")}function M(e=process.cwd()){return i.join(e,".mcp.json")}function F(){return process.platform==="darwin"?i.join(u(),"Library","Application Support","Claude","claude_desktop_config.json"):i.join(u(),".config","Claude","claude_desktop_config.json")}function N(){return i.join(u(),".codex","config.toml")}function C(){return i.join(f(),"connectors")}function q(){return i.join(C(),"chatgpt-openapi.json")}function K(){return i.join(f(),"active-chain.json")}function y(e){let o=[i.join(l,"bin",e),i.join(l,"dist","bin",e),i.join(l,"..","bin",e)];return o.find(r=>d.existsSync(r))||o[0]}function B(e){return d.mkdirSync(e,{recursive:!0}),e}var E={homeDir:u,isPublicDesktop:v,oracleConfigDir:f,oracleExecEnvPath:$,oracleDeskJsonPath:_,oracleEnvFilePath:A,loadDeskRouting:p,hermesRoot:H,activeChainPath:K,claudeCodeUserConfigPath:I,claudeCodeProjectMcpPath:M,claudeDesktopConfigPath:F,codexConfigPath:N,chatgptConnectorDir:C,chatgptOpenApiPath:q,packageBin:y,ensureDir:B,PACKAGE_ROOT:l};import{execFile as G}from"node:child_process";import{existsSync as de,mkdirSync as fe,readFileSync as V,realpathSync as me,writeFileSync as he}from"node:fs";import j from"node:path";import{promisify as J}from"node:util";var
|
|
2
|
+
import{realpathSync as U}from"node:fs";import{fileURLToPath as re}from"node:url";import h from"node:fs";import g from"node:path";import{pathToFileURL as Y}from"node:url";import d from"node:fs";import P from"node:os";import i from"node:path";import{fileURLToPath as D}from"node:url";var T=i.dirname(D(import.meta.url)),l=i.resolve(T,"../..");function u(){return process.env.ORACLE_FAKE_HOME||P.homedir()}function v(){return process.env.ORACLE_PUBLIC_DESKTOP==="1"}function f(){return v()?process.env.ORACLE_CONFIG_DIR||i.join(u(),".config","oracle"):i.join(u(),".config","oracle")}function $(){return i.join(f(),"exec.env")}function _(){return i.join(f(),"desk.json")}function A(){return i.join(f(),"env")}function p({force:e=!1}={}){if(p._done&&!e)return p._result||null;p._done=!0;let o={},r=(a,t)=>{if(t==null)return;let n=String(t).trim();n&&(process.env[a]!=null&&String(process.env[a]).trim()!==""||(process.env[a]=n,o[a]=n))};try{let a=A();if(d.existsSync(a))for(let t of d.readFileSync(a,"utf8").split(/\r?\n/)){let n=t.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*?)\s*$/);if(!n||n[2].startsWith("#"))continue;let c=n[2];(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),r(n[1],c)}}catch{}try{let a=_();if(d.existsSync(a)){let t=JSON.parse(d.readFileSync(a,"utf8"));t&&typeof t=="object"&&(r("ORACLE_DESK_URL",t.deskUrl||t.dataUrl||t.url),r("ORACLE_DATA_URL",t.dataUrl||t.deskUrl||t.url),r("ORACLE_API_URL",t.apiUrl||t.dataUrl||t.deskUrl),r("ORACLE_PUBLIC_URL",t.publicUrl||t.deskUrl||t.dataUrl),r("ORACLE_EXEC_URL",t.execUrl),r("MAD_DESK_URL",t.deskUrl||t.dataUrl))}}catch{}let s=process.env.ORACLE_DESK_URL||process.env.ORACLE_DATA_URL||"";return s&&(r("ORACLE_DESK_URL",s),r("ORACLE_DATA_URL",s),r("ORACLE_API_URL",s),r("ORACLE_PUBLIC_URL",s),r("MAD_DESK_URL",s)),p._result=Object.keys(o).length?o:null,p._result}try{p()}catch{}function H(){return process.env.HERMES_HOME?i.resolve(process.env.HERMES_HOME):i.join(u(),".hermes")}function I(){return i.join(u(),".claude.json")}function M(e=process.cwd()){return i.join(e,".mcp.json")}function F(){return process.platform==="darwin"?i.join(u(),"Library","Application Support","Claude","claude_desktop_config.json"):i.join(u(),".config","Claude","claude_desktop_config.json")}function N(){return i.join(u(),".codex","config.toml")}function C(){return i.join(f(),"connectors")}function q(){return i.join(C(),"chatgpt-openapi.json")}function K(){return i.join(f(),"active-chain.json")}function y(e){let o=[i.join(l,"bin",e),i.join(l,"dist","bin",e),i.join(l,"..","bin",e)];return o.find(r=>d.existsSync(r))||o[0]}function B(e){return d.mkdirSync(e,{recursive:!0}),e}var E={homeDir:u,isPublicDesktop:v,oracleConfigDir:f,oracleExecEnvPath:$,oracleDeskJsonPath:_,oracleEnvFilePath:A,loadDeskRouting:p,hermesRoot:H,activeChainPath:K,claudeCodeUserConfigPath:I,claudeCodeProjectMcpPath:M,claudeDesktopConfigPath:F,codexConfigPath:N,chatgptConnectorDir:C,chatgptOpenApiPath:q,packageBin:y,ensureDir:B,PACKAGE_ROOT:l};import{execFile as G}from"node:child_process";import{existsSync as de,mkdirSync as fe,readFileSync as V,realpathSync as me,writeFileSync as he}from"node:fs";import j from"node:path";import{promisify as J}from"node:util";var ke=J(G);var xe=1440*60*1e3;function R(e,o){let r=t=>String(t).replace(/^v/,"").split("-")[0].split(".").map(n=>Number.parseInt(n,10)||0),s=r(e),a=r(o);for(let t=0;t<Math.max(s.length,a.length);t+=1){let n=s[t]??0,c=a[t]??0;if(n>c)return 1;if(n<c)return-1}return 0}function W(e){let o=e?.stateDir||j.join(process.env.HOME||".",".oracle");return j.join(o,"update-check.json")}function b(e){try{return JSON.parse(V(W(e),"utf8"))}catch{return null}}var z="oracle \u2014 self-custody multichain agent control plane",Q=`READ / RESEARCH (no keys, this package)
|
|
3
3
|
oracle open the native Oracle chat (TTY)
|
|
4
|
-
oracle bootstrap optional
|
|
5
|
-
oracle init
|
|
4
|
+
oracle bootstrap optional Hermes install only (never required; never auto-selected)
|
|
5
|
+
oracle init optional Hermes lane install (dry-run by default)
|
|
6
6
|
oracle doctor check the read plane
|
|
7
7
|
oracle eval desk run desk harness eval (critical tests + parse smoke)
|
|
8
8
|
oracle chat premium boxed oracle chat (multi-model)
|
|
9
|
-
oracle model choose standalone
|
|
9
|
+
oracle model choose standalone provider and any compatible model
|
|
10
10
|
oracle auth Claude/Codex/Grok OAuth or securely stored provider API keys
|
|
11
11
|
oracle chain list/select working chains (hyperliquid, base, ...)
|
|
12
12
|
oracle setup model choose Claude/Codex/Grok standalone OAuth
|
|
13
|
-
oracle setup standalone model + messaging menu
|
|
13
|
+
oracle setup standalone model + optional Hermes messaging menu
|
|
14
|
+
oracle harness detect detect installed clients (capability only; no backend change)
|
|
14
15
|
oracle data serve|call|catalog|health
|
|
15
16
|
oracle data-mcp start the read-only MCP server
|
|
16
17
|
oracle scan chains|head|token|pools|risk|quote|sell
|
|
@@ -36,14 +37,14 @@ oracle <noun> --help for details. This package prepares unsigned actions and
|
|
|
36
37
|
never handles keys, signs, or broadcasts transactions.
|
|
37
38
|
`;function O(){try{return JSON.parse(h.readFileSync(g.join(l,"package.json"),"utf8")).version||"0.0.0"}catch{return"0.0.0"}}function X(){let e=g.join(l,"src","cli","commands");return h.existsSync(e)?e:g.join(l,"dist","cli","commands")}async function m(){let e=X(),o=new Map;if(!h.existsSync(e))return o;let r=h.readdirSync(e).filter(s=>s.endsWith(".mjs")).sort();for(let s of r){let a=g.join(e,s);try{let n=(await import(Y(a).href+`?t=${Date.now()}`)).default;if(!n||typeof n!="object"||typeof n.run!="function")continue;let c=n.name||s.replace(/\.mjs$/,"");o.set(c,{...n,name:c,__file:a})}catch(t){process.env.ORACLE_CLI_DEBUG&&console.error(`oracle: failed loading command ${s}: ${t.message}`)}}return o}function Z(e,o=b()){return!o?.latest||!e||R(o.latest,e)<=0?"":`
|
|
38
39
|
Update available: ${e} \u2192 ${o.latest}. Run 'oracle update'.
|
|
39
|
-
`}function
|
|
40
|
+
`}function k(e,o){let r=[];r.push(`${z} (v${e})`),r.push(""),r.push(Q.trimEnd());let s=[];for(let a of o.values()){if(["help","version"].includes(a.name))continue;!new Set(["init","doctor","chat","model","auth","chain","setup","data","data-mcp","scan","route","prepare","swap","farm","follow","equities","strategy","public","mcp","plugins","harness","upgrade","bootstrap","eval","fees"]).has(a.name)&&a.summary&&s.push(` oracle ${a.name.padEnd(20)} ${a.summary}`)}return s.length&&(r.push(""),r.push("ADDITIONAL"),r.push(...s)),r.join(`
|
|
40
41
|
`)+`
|
|
41
42
|
`+Z(e)}function w(e,o){let r=[...o.keys()].sort(),s=r.length?r.join(", "):"(none loaded yet)";return`oracle: unknown command '${e}'. Known: ${s}
|
|
42
43
|
Try: oracle --help
|
|
43
|
-
`}function
|
|
44
|
+
`}function x(e){return{argv:e,root:l,bin:y,paths:E}}async function S(e=[]){let o=O();if(e.includes("--version")||e.includes("-V"))return L();if(e[0]==="--help"||e[0]==="-h"){let n=await m();return process.stdout.write(k(o,n)),0}if(e.length===0){let n=await m();if(ee(e)){let c=n.get("chat");if(c)return c.run(x([]))}return process.stdout.write(k(o,n)),0}if(te(e[0])){let c=(await m()).get("chat");if(c)return c.run(x(e))}let r=e[0],s=e.slice(1);if(r==="version")return L();if(r==="help"){let n=await m();if(s[0]){let c=n.get(s[0]);return c?(process.stdout.write((c.usage||`oracle ${c.name}`)+`
|
|
44
45
|
`),c.summary&&process.stdout.write(c.summary+`
|
|
45
|
-
`),0):(process.stderr.write(w(s[0],n)),1)}return process.stdout.write(
|
|
46
|
+
`),0):(process.stderr.write(w(s[0],n)),1)}return process.stdout.write(k(o,n)),0}let a=await m(),t=a.get(r);if(t){if(s[0]==="--help"||s[0]==="-h")return process.stdout.write((t.usage||`oracle ${t.name}`)+`
|
|
46
47
|
`),t.summary&&process.stdout.write(t.summary+`
|
|
47
|
-
`),0;try{let n=await t.run(
|
|
48
|
+
`),0;try{let n=await t.run(x(s));return typeof n=="number"?n:0}catch(n){return process.stderr.write(`oracle ${r}: ${n?.message||n}
|
|
48
49
|
`),1}}return process.stderr.write(w(r,a)),1}async function L(){let e=O();return process.stdout.write(`oracle ${e}
|
|
49
50
|
`),0}function ee(e=[],o={stdin:process.stdin,stdout:process.stdout}){return e.length!==0?!1:process.env.ORACLE_FORCE_CHAT==="1"?!0:o.stdin?.isTTY===!0&&o.stdout?.isTTY===!0}function te(e){return["-m","--model","--provider","-q","--query","-Q","--quiet","-c","--continue","-r","--resume","-s","--skills","-t","--toolsets","--reasoning","--tui","--cli","--yolo","--checkpoints","--source","--max-turns"].includes(String(e||""))}var Oe=Object.freeze({data:"./desk-server.mjs",public:"./oracle-public-server.mjs","data-mcp":"./oracle-data-mcp.mjs",init:"./oracle-init.mjs",upgrade:"./oracle-upgrade.mjs",scan:"./oracle-scan.mjs",route:"./oracle-route.mjs",equities:"./oracle-equities.mjs"});function ne(){if(!process.argv[1])return!1;try{return U(re(import.meta.url))===U(process.argv[1])}catch{return!1}}async function oe(e=process.argv.slice(2)){return S(e)}if(ne()){let e=await oe();process.exit(typeof e=="number"?e:0)}export{Oe as COMMANDS,oe as main};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import a from"node:fs";import c from"node:path";import{createHash as Y}from"node:crypto";import{spawnSync as y}from"node:child_process";import x from"node:fs";import M from"node:os";import m from"node:path";import{fileURLToPath as B}from"node:url";var
|
|
1
|
+
import a from"node:fs";import c from"node:path";import{createHash as Y}from"node:crypto";import{spawnSync as y}from"node:child_process";import x from"node:fs";import M from"node:os";import m from"node:path";import{fileURLToPath as B}from"node:url";var T=m.dirname(B(import.meta.url)),oe=m.resolve(T,"../..");function _(){return process.env.ORACLE_FAKE_HOME||M.homedir()}function V(){return process.env.ORACLE_PUBLIC_DESKTOP==="1"}function S(){return V()?process.env.ORACLE_CONFIG_DIR||m.join(_(),".config","oracle"):m.join(_(),".config","oracle")}function F(){return m.join(S(),"desk.json")}function K(){return m.join(S(),"env")}function h({force:t=!1}={}){if(h._done&&!t)return h._result||null;h._done=!0;let n={},e=(s,r)=>{if(r==null)return;let i=String(r).trim();i&&(process.env[s]!=null&&String(process.env[s]).trim()!==""||(process.env[s]=i,n[s]=i))};try{let s=K();if(x.existsSync(s))for(let r of x.readFileSync(s,"utf8").split(/\r?\n/)){let i=r.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*?)\s*$/);if(!i||i[2].startsWith("#"))continue;let u=i[2];(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))&&(u=u.slice(1,-1)),e(i[1],u)}}catch{}try{let s=F();if(x.existsSync(s)){let r=JSON.parse(x.readFileSync(s,"utf8"));r&&typeof r=="object"&&(e("ORACLE_DESK_URL",r.deskUrl||r.dataUrl||r.url),e("ORACLE_DATA_URL",r.dataUrl||r.deskUrl||r.url),e("ORACLE_API_URL",r.apiUrl||r.dataUrl||r.deskUrl),e("ORACLE_PUBLIC_URL",r.publicUrl||r.deskUrl||r.dataUrl),e("ORACLE_EXEC_URL",r.execUrl),e("MAD_DESK_URL",r.deskUrl||r.dataUrl))}}catch{}let o=process.env.ORACLE_DESK_URL||process.env.ORACLE_DATA_URL||"";return o&&(e("ORACLE_DESK_URL",o),e("ORACLE_DATA_URL",o),e("ORACLE_API_URL",o),e("ORACLE_PUBLIC_URL",o),e("MAD_DESK_URL",o)),h._result=Object.keys(n).length?n:null,h._result}try{h()}catch{}function R(t){return x.mkdirSync(t,{recursive:!0}),t}var W="0.19.0",j=`hermes-agent==${W}`,U=[3,11],L=[3,14],g="3.13",A="0.12.1",k=Object.freeze({posix:Object.freeze({url:`https://github.com/astral-sh/uv/releases/download/${A}/uv-installer.sh`,sha256:"d3f5412d38c99f9d024901843bf98206f0d2c6dbe64df40d0b740e2751ca62c1"}),windows:Object.freeze({url:`https://github.com/astral-sh/uv/releases/download/${A}/uv-installer.ps1`,sha256:"b9ec035151bfbb11d616dbd69886498d885551489eddf095ea3c0ad59f640eb0"})});function z(t,{windows:n=process.platform==="win32"}={}){let e=Buffer.isBuffer(t)?t:Buffer.from(t),o=n?k.windows:k.posix,s=Y("sha256").update(e).digest("hex"),r=e.toString("utf8");return s===o.sha256&&r.length>=1e3&&r.includes(A)}function p(){return c.join(S(),"runtime")}function P(){return c.join(p(),"venv")}function C(t){let n=process.platform==="win32"?"Scripts":"bin",e=process.platform==="win32"?`${t}.exe`:t;return c.join(P(),n,e)}function b(){return C("hermes")}function J(){let t=C("python3");return a.existsSync(t)?t:C("python")}function E(){return c.join(p(),"uv",process.platform==="win32"?"uv.exe":"uv")}function v(t){let n=process.platform==="win32"&&!c.extname(t)?["",".exe",".cmd",".bat"]:[""];for(let e of(process.env.PATH||"").split(c.delimiter))if(e)for(let o of n){let s=c.join(e,`${t}${o}`);try{if(a.existsSync(s))return s}catch{}}return null}function X(t){let n=/Python (\d+)\.(\d+)\.(\d+)/.exec(t||"");return n?[Number(n[1]),Number(n[2]),Number(n[3])]:null}function G(t){if(!t)return!1;let[n,e]=t;return!(n<U[0]||n===U[0]&&e<U[1]||n>L[0]||n===L[0]&&e>=L[1])}function $(){let t=[process.env.ORACLE_PYTHON,"python3.13","python3.12","python3.11","python3","python"].filter(Boolean);for(let n of t){let e=c.isAbsolute(n)?a.existsSync(n)?n:null:v(n);if(!e)continue;let o=y(e,["--version"],{encoding:"utf8",timeout:15e3}),s=X(`${o.stdout||""}${o.stderr||""}`);if(G(s))return{bin:e,version:s.join("."),source:"host"}}return null}function D(){return process.env.ORACLE_UV_BIN||v("uv")||(a.existsSync(c.join(_(),".local","bin","uv"))?c.join(_(),".local","bin","uv"):null)||(a.existsSync(E())?E():null)}function Z(t,n){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 y(process.execPath,["-e",e,t,n],{encoding:"utf8",timeout:2*6e4})}function Q({quiet:t=!1}={}){let n=D();if(n)return{ok:!0,bin:n,reused:!0};R(p());let e=process.platform==="win32",o=c.join(p(),e?"uv-install.ps1":"uv-install.sh"),s=e?k.windows:k.posix,r=Z(s.url,o);if(r.status!==0)return{ok:!1,reason:`could not download the uv installer (${r.status})`,stderr:(r.stderr||"").slice(-800)};let i=a.readFileSync(o);if(!z(i,{windows:e}))return{ok:!1,reason:`uv ${A} installer checksum mismatch`};let u=c.dirname(E());R(u);let d=e?v("powershell.exe")||v("powershell"):v("sh")||"/bin/sh";if(!d)return{ok:!1,reason:e?"PowerShell not found":"sh not found"};let f=y(d,e?["-NoProfile","-ExecutionPolicy","Bypass","-File",o]:[o],{stdio:t?"pipe":"inherit",encoding:"utf8",timeout:5*6e4,env:{...process.env,UV_INSTALL_DIR:u,UV_NO_MODIFY_PATH:"1"}});return f.status!==0||!a.existsSync(E())?{ok:!1,reason:`uv install failed (${f.status})`,stderr:(f.stderr||"").slice(-800)}:{ok:!0,bin:E(),reused:!1}}function O({quiet:t=!1}={}){let n=Q({quiet:t});if(!n.ok)return n;let e=n.bin,o={...process.env,UV_PYTHON_INSTALL_DIR:c.join(p(),"python"),UV_CACHE_DIR:c.join(p(),"cache")},s=y(e,["python","install","--no-bin",g],{stdio:t?"pipe":"inherit",encoding:"utf8",timeout:15*6e4,env:o});if(s.status!==0)return{ok:!1,reason:`uv python install ${g} failed (${s.status})`,stderr:(s.stderr||"").slice(-800)};let r=y(e,["python","find",g],{encoding:"utf8",timeout:6e4,env:o}),i=(r.stdout||"").trim().split(/\r?\n/)[0];return r.status!==0||!i||!a.existsSync(i)?{ok:!1,reason:`uv could not locate python ${g}`}:{ok:!0,bin:i,version:g,source:"uv"}}function q(){if(process.env.ORACLE_HERMES_BIN)return{ok:!0,bin:process.env.ORACLE_HERMES_BIN,source:"env"};let t=v("hermes");if(t)return{ok:!0,bin:t,source:"path"};let n=b();return a.existsSync(n)?{ok:!0,bin:n,source:"managed"}:{ok:!1,bin:null,source:null}}function H(){let t=q(),n=$();return{hermes:t,managedVenv:P(),managedInstalled:a.existsSync(b()),hostPython:n,uv:D()}}function w(t,n,{quiet:e}){return y(t,n,{stdio:e?"pipe":"inherit",encoding:"utf8",timeout:20*6e4})}function I({quiet:t=!1,upgrade:n=!1}={}){let e=$();if(!e){let l=O({quiet:t});if(l.ok)e={bin:l.bin,version:l.version,source:"uv"};else return{ok:!1,reason:`no supported python found (need 3.11-3.13) and uv could not provide one: ${l.reason}. install uv (https://docs.astral.sh/uv) or python 3.13, then re-run 'oracle bootstrap'`}}R(p());let o=P();if(a.existsSync(b())&&!n)return{ok:!0,bin:b(),reused:!0};if(!a.existsSync(c.join(o,"pyvenv.cfg"))){let l=w(e.bin,["-m","venv",o],{quiet:t});if(l.status!==0&&e.source!=="uv"){a.rmSync(o,{recursive:!0,force:!0});let f=O({quiet:t});if(f.ok)e={bin:f.bin,version:f.version,source:"uv"},l=w(e.bin,["-m","venv",o],{quiet:t});else return{ok:!1,reason:`python -m venv failed (${l.status}) and uv fallback failed: ${f.reason}`,stderr:(l.stderr||"").slice(-800)}}if(l.status!==0)return{ok:!1,reason:`isolated python -m venv failed (${l.status})`,stderr:(l.stderr||"").slice(-800)}}let r=J();if(!a.existsSync(r))return{ok:!1,reason:`venv python missing at ${r}`};let i=["-m","pip","install","--disable-pip-version-check"];n&&i.push("--upgrade"),i.push(j);let u=w(r,i,{quiet:t});if(u.status!==0)return{ok:!1,reason:`pip install ${j} failed (${u.status})`,stderr:(u.stderr||"").slice(-1200)};let d=b();return a.existsSync(d)?{ok:!0,bin:d,reused:!1,python:e.version}:{ok:!1,reason:`hermes entrypoint not found after install (${d})`}}function N(){return["oracle bootstrap - optional Hermes install (never required for native Oracle)",""," oracle bootstrap install into ~/.config/oracle/runtime/venv"," oracle bootstrap --upgrade upgrade the managed Hermes runtime"," oracle bootstrap --status show detected Hermes (if any)"," oracle bootstrap --json machine-readable status","","notes:"," native chat/model/auth never need this"," detection never selects Hermes; opt in with ORACLE_CHAT_BACKEND=hermes"," a hermes on PATH wins over managed install; bootstrap never touches system python"," read/prepare commands (chain, scan, route, data) never need this"].join(`
|
|
2
2
|
`)}var de={name:"bootstrap",summary:"optionally install a Hermes compatibility runtime",group:"read",usage:N(),async run(t){let n=t.argv;if(n.includes("-h")||n.includes("--help"))return process.stdout.write(N()+`
|
|
3
|
-
`),0;let e=n.includes("--json"),o=
|
|
3
|
+
`),0;let e=n.includes("--json"),o=H();if(n.includes("--status")||e)return e?(process.stdout.write(JSON.stringify(o,null,2)+`
|
|
4
4
|
`),0):(process.stdout.write([`hermes: ${o.hermes.ok?`${o.hermes.bin} (${o.hermes.source})`:"not installed"}`,`managed venv: ${o.managedVenv}`,`managed built: ${o.managedInstalled?"yes":"no"}`,`host python: ${o.hostPython?`${o.hostPython.bin} (${o.hostPython.version})`:"none supported (need 3.11-3.13)"}`,`uv: ${o.uv||"not installed (oracle will install it locally)"}`,""].join(`
|
|
5
5
|
`)),0);let s=n.includes("--upgrade");if(o.hermes.ok&&o.hermes.source==="path"&&!s)return process.stdout.write(`hermes already on PATH: ${o.hermes.bin}
|
|
6
6
|
nothing to do. run: oracle
|
|
@@ -9,7 +9,7 @@ nothing to do. run: oracle
|
|
|
9
9
|
`:`provisioning an isolated python 3.13 with uv
|
|
10
10
|
`)+`this takes a few minutes on first run
|
|
11
11
|
|
|
12
|
-
`);let r=
|
|
12
|
+
`);let r=I({upgrade:s});return r.ok?(process.stdout.write(r.reused?`runtime already present: ${r.bin}
|
|
13
13
|
`:`
|
|
14
14
|
runtime ready: ${r.bin}
|
|
15
15
|
run: oracle
|