@oracle-agent/oracle 0.20.3 → 0.21.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.
- package/README.md +1 -1
- package/dist/assets/profiles/robinhood-agent/SOUL.md +79 -10
- package/dist/assets/profiles/robinhood-agent/memory.json +34 -0
- package/dist/bin/desk-server.mjs +16 -16
- package/dist/bin/oracle-data-mcp.mjs +5 -5
- package/dist/bin/oracle-public-server.mjs +4 -4
- package/dist/bin/oracle-route.mjs +22 -21
- package/dist/bin/oracle.mjs +19 -17
- package/dist/cli/commands/chain.mjs +13 -13
- package/dist/cli/commands/chat.mjs +46 -35
- package/dist/cli/commands/model.mjs +52 -41
- package/dist/cli/commands/update.mjs +27 -0
- package/dist/data/desk-data.mjs +13 -13
- package/dist/index.mjs +18 -18
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{execFile as k}from"node:child_process";import{existsSync as v,mkdirSync as $,readFileSync as f,realpathSync as b,writeFileSync as A}from"node:fs";import c from"node:path";import{promisify as S}from"node:util";import{fileURLToPath as m}from"node:url";var O=S(k),u="@oracle-agent/oracle",j="https://registry.npmjs.org",C=1440*60*1e3;function h(r=import.meta.url){try{let e=b(m(r)),n=`${c.sep}node_modules${c.sep}`,a=e.lastIndexOf(n);if(a>0)return{root:e.slice(0,a),managed:!0}}catch{}return{root:null,managed:!1}}function d(r=import.meta.url){try{let e=c.dirname(m(r));for(let n=0;n<8;n+=1){let a=c.join(e,"package.json");if(v(a)){let o=JSON.parse(f(a,"utf8"));if(o?.name===u&&o.version)return o.version}let s=c.dirname(e);if(s===e)break;e=s}}catch{return null}return null}function I(r,e){let n=o=>String(o).replace(/^v/,"").split("-")[0].split(".").map(t=>Number.parseInt(t,10)||0),a=n(r),s=n(e);for(let o=0;o<Math.max(a.length,s.length);o+=1){let t=a[o]??0,i=s[o]??0;if(t>i)return 1;if(t<i)return-1}return 0}function y(r){let e=r?.stateDir||c.join(process.env.HOME||".",".oracle");return c.join(e,"update-check.json")}function R(r){try{return JSON.parse(f(y(r),"utf8"))}catch{return null}}function L(r,e){try{let n=y(r);$(c.dirname(n),{recursive:!0}),A(n,`${JSON.stringify(e,null,2)}
|
|
2
|
+
`)}catch{}}async function U({timeoutMs:r=4e3}={}){try{let e=new AbortController,n=setTimeout(()=>e.abort(),r),a=await fetch(`${j}/${encodeURIComponent(u)}/latest`,{signal:e.signal});return clearTimeout(n),a.ok&&(await a.json())?.version||null}catch{return null}}async function g({paths:r,force:e=!1,timeoutMs:n=4e3}={}){let a=d(),s=e?null:R(r),t=s&&Date.now()-(s.checkedAt||0)<C?s.latest:null;return t||(t=await U({timeoutMs:n}),t&&L(r,{latest:t,checkedAt:Date.now()})),!a||!t?{current:a,latest:t,updateAvailable:!1,checked:!!t}:{current:a,latest:t,updateAvailable:I(t,a)>0,checked:!0}}async function w({version:r="latest",dryRun:e=!1}={}){let{root:n,managed:a}=h();if(!a||!n)return{ok:!1,reason:"unmanaged",message:`oracle is not running from a resolvable node_modules tree (source checkout or linked dev install).
|
|
3
|
+
Update it the same way you installed it \u2014 git pull, or npm install -g @oracle-agent/oracle@latest.`};let s=`${u}@${r}`,o=["install","--prefix",n,"--no-audit","--no-fund",s];if(e)return{ok:!0,dryRun:!0,root:n,command:`npm ${o.join(" ")}`};try{let{stdout:t,stderr:i}=await O("npm",o,{timeout:3e5,maxBuffer:16777216});return{ok:!0,root:n,stdout:t,stderr:i}}catch(t){return{ok:!1,reason:"npm-failed",root:n,message:t?.stderr||t?.message||"npm install failed"}}}var x=`oracle update \u2014 update the Oracle CLI
|
|
4
|
+
|
|
5
|
+
oracle update install the latest published version
|
|
6
|
+
oracle update --check report whether an update exists, install nothing
|
|
7
|
+
oracle update --dry-run print the exact npm command that would run
|
|
8
|
+
oracle update --version X install a specific version
|
|
9
|
+
|
|
10
|
+
Installs into the tree the running \`oracle\` binary actually resolves through,
|
|
11
|
+
not npm's configured global prefix \u2014 those are frequently different, and a
|
|
12
|
+
prefix mismatch is why a "successful" global install can leave the running
|
|
13
|
+
version unchanged.`;function E(r,e){let n=r.indexOf(e);if(n<0)return null;let a=r[n+1];if(!a||a.startsWith("--"))throw new Error(`${e} requires a value`);return a}async function F(r=[]){let e=process.stdout;if(r.includes("--help")||r.includes("-h"))return e.write(`${x}
|
|
14
|
+
`),0;let n=r.includes("--json"),a=r.includes("--check"),s=r.includes("--dry-run"),o=E(r,"--version")||"latest",t=await g({force:!0});if(a)return n?(e.write(`${JSON.stringify(t,null,2)}
|
|
15
|
+
`),0):t.current?t.checked?(t.updateAvailable?(e.write(`oracle ${t.current} \u2192 ${t.latest} available
|
|
16
|
+
`),e.write(`Run 'oracle update' to install.
|
|
17
|
+
`)):e.write(`oracle ${t.current} is up to date
|
|
18
|
+
`),0):(e.write(`oracle ${t.current} (could not reach the npm registry)
|
|
19
|
+
`),0):(e.write(`oracle: cannot determine the installed version
|
|
20
|
+
`),1);if(o==="latest"&&t.checked&&!t.updateAvailable&&!s)return e.write(`oracle ${t.current} is already up to date
|
|
21
|
+
`),0;let i=o==="latest"?t.latest||"latest":o;e.write(`\u2192 Updating oracle ${t.current||"?"} \u2192 ${i}
|
|
22
|
+
`);let l=await w({version:o,dryRun:s});if(!l.ok)return process.stderr.write(`oracle update failed: ${l.message}
|
|
23
|
+
`),1;if(s)return e.write(`${l.command}
|
|
24
|
+
`),0;let p=d();return e.write(`\u2713 oracle updated in ${l.root}
|
|
25
|
+
`),p&&e.write(` installed: ${p}
|
|
26
|
+
`),e.write(` Restart any running oracle processes to pick it up.
|
|
27
|
+
`),0}var D="update the Oracle CLI to the latest published version",H={name:"update",summary:"update the Oracle CLI to the latest published version",group:"read",usage:x,async run(r){return F(r.argv??[])}};export{H as default,D as help,h as resolveInstallRoot,F as run};
|