goatchain-cli 0.0.2-beta.10
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 +368 -0
- package/dist/args-B4NUWmzz.js +2 -0
- package/dist/chunk-B_5Rb6Gi.js +1 -0
- package/dist/cli.mjs +4 -0
- package/dist/index.js +145 -0
- package/dist/openai-BOGzt3st.js +1 -0
- package/dist/openai-Ba5c3VJv.js +16 -0
- package/dist/repl-RiteZLua.js +76 -0
- package/dist/src-BD_MMztG.js +284 -0
- package/dist/src-Dpj3VSps.js +1 -0
- package/dist/theme-4Sto2Osm.js +1 -0
- package/dist/theme-DvHvtqNs.js +1 -0
- package/dist/ui-B9ajujL6.js +1 -0
- package/dist/ui-D4n45LUU.js +2 -0
- package/package.json +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./openai-Ba5c3VJv.js";import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,V as g,_,a as v,b as y,c as b,d as x,f as S,g as C,h as w,i as T,j as E,k as D,l as O,m as k,n as A,o as j,p as M,r as N,s as P,t as F,u as I,v as L,w as R,x as z,y as B,z as V}from"./src-BD_MMztG.js";export{L as Agent,l as AgentAbortError,u as AgentMaxIterationsError,M as AskUserTool,S as AstGrepReplaceTool,x as AstGrepSearchTool,E as BaseHook,s as BaseSession,a as BaseSessionManager,k as BaseTool,I as BashTool,O as EditTool,y as FileStateStore,b as GlobTool,P as GrepTool,e as HookManager,i as InMemoryModelHealth,B as InMemoryStateStore,r as ModelError,j as ReadTool,h as RetryPolicy,m as Session,t as StateKeys,z as StateStore,v as TodoWriteTool,F as ToolRegistry,T as WebSearchTool,N as WriteTool,D as compose,c as compressSessionManually,p as createContextCompressionMiddleware,d as createInitialLoopState,R as createModel,n as createOpenAIAdapter,A as createPlanModeMiddleware,f as ensureNotAborted,w as errorContent,g as fromLoopCheckpoint,C as imageContent,V as injectSystemReminderToLastUserMessage,_ as textContent,o as toLoopCheckpoint};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./ui-D4n45LUU.js";function t(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function n(e){let t=String(e??``).trim();return t?{bold:`bold`,underline:`underline`,dim:`dim`,gray:`gray`,red:`red`,green:`green`,yellow:`yellow`,blue:`blue`,magenta:`magenta`,cyan:`cyan`,inverse:`inverse`,header:`header`,highlight:`highlight`}[t]??null:null}function r(e){if(typeof e==`string`){let t=n(e);return t?[t]:null}if(Array.isArray(e)){let t=[];for(let r of e){let e=n(r);e&&t.push(e)}return t}return null}function i(){return{assistant:{label:`assistant`,prefix:`[`,suffix:`]`,style:`cyan`,icon:`🤖`},user:{label:`user`,prefix:`[`,suffix:`]`,style:`green`,icon:`👤`},tool:{label:`tool`,prefix:`[`,suffix:`]`,style:`magenta`,icon:`🛠️`},system:{label:`system`,prefix:`[`,suffix:`]`,style:`gray`,icon:`📌`}}}function a(){return{name:`dark`,ansi:{styles:{bold:[`bold`],underline:[`underline`],dim:[`dim`],gray:[`gray`],red:[`red`],green:[`green`],yellow:[`yellow`],blue:[`blue`],magenta:[`magenta`],cyan:[`cyan`],inverse:[`inverse`],header:[`header`],highlight:[`highlight`]}},roles:i()}}function o(){let e=a();return e.name=`mono`,e.ansi.styles={bold:[`bold`],underline:[`underline`],dim:[`dim`],gray:[],red:[],green:[],yellow:[],blue:[],magenta:[],cyan:[],inverse:[`inverse`],header:[`inverse`,`bold`],highlight:[`inverse`]},e}function s(){let e=a();return e.name=`light`,e.ansi.styles.gray=[`dim`],e.ansi.styles.header=[`bold`],e.ansi.styles.highlight=[`underline`,`bold`],e.roles={assistant:{label:`assistant`,prefix:`[`,suffix:`]`,style:`blue`,icon:`🤖`},user:{label:`user`,prefix:`[`,suffix:`]`,style:`magenta`,icon:`👤`},tool:{label:`tool`,prefix:`[`,suffix:`]`,style:`cyan`,icon:`🛠️`},system:{label:`system`,prefix:`[`,suffix:`]`,style:`dim`,icon:`📌`}},e}function c(e){let t=String(e??``).trim().toLowerCase();return t===`default`||t===`dark`||t===`cyberpunk`?a():t===`light`||t===`plain`?s():t===`mono`||t===`monochrome`?o():a()}function l(e,i){let a={name:typeof i.name==`string`&&i.name.trim()?i.name.trim():e.name,ansi:{styles:{...e.ansi.styles}},roles:{...e.roles}};if(t(i.ansi)&&t(i.ansi.styles))for(let e of Object.keys(i.ansi.styles)){let t=n(e);if(!t)continue;let o=r(i.ansi.styles[e]);o&&(a.ansi.styles[t]=o)}if(t(i.roles))for(let e of Object.keys(i.roles)){let r=e;if(r!==`assistant`&&r!==`user`&&r!==`tool`&&r!==`system`)continue;let o=i.roles[e];if(!t(o))continue;let s={...a.roles[r]};if(typeof o.label==`string`&&(s.label=o.label),typeof o.prefix==`string`&&(s.prefix=o.prefix),typeof o.suffix==`string`&&(s.suffix=o.suffix),typeof o.icon==`string`&&(s.icon=o.icon),typeof o.style==`string`){let e=n(o.style);e&&(s.style=e)}a.roles[r]=s}return a}function u(t,n){let r=String(n??``),i=Array.isArray(t)?t:[];if(i.length===0)return r;let a=r;for(let t of i){let n=e[t];typeof n==`function`&&(a=n(a))}return a}function d(e){let n;n=typeof e==`string`?c(e):t(e)?l(c(typeof e.name==`string`?e.name:``),e):a();let r={bold:e=>u(n.ansi.styles.bold,e),underline:e=>u(n.ansi.styles.underline,e),dim:e=>u(n.ansi.styles.dim,e),gray:e=>u(n.ansi.styles.gray,e),red:e=>u(n.ansi.styles.red,e),green:e=>u(n.ansi.styles.green,e),yellow:e=>u(n.ansi.styles.yellow,e),blue:e=>u(n.ansi.styles.blue,e),magenta:e=>u(n.ansi.styles.magenta,e),cyan:e=>u(n.ansi.styles.cyan,e),inverse:e=>u(n.ansi.styles.inverse,e),header:e=>u(n.ansi.styles.header,e),highlight:e=>u(n.ansi.styles.highlight,e)},i=(e,t={})=>{let i=n.roles[e],a=t.emoji&&process.stdout.isTTY&&process.env.TERM!==`dumb`&&i.icon?`${i.icon} `:``,o=`${i.prefix}${i.label}${i.suffix}`;return`${a}${r[i.style](o)}`};return{name:n.name,ansi:r,roleHeader:i,roleTag:(e,t={})=>i(e,t),config:n}}export{d as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./ui-D4n45LUU.js";import{t as e}from"./theme-4Sto2Osm.js";export{e as createUiTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./ui-D4n45LUU.js";export{s as ansi,r as clearScreen,a as deriveSessionSummary,n as deriveSessionTitle,e as formatOneLine,i as formatWhen,o as messageToTextPreview,t as printHistory};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as e}from"node:module";const t=e(import.meta.url),n={enabled:!1,bold:e=>e,underline:e=>e,dim:e=>e,gray:e=>e,grey:e=>e,red:e=>e,green:e=>e,yellow:e=>e,blue:e=>e,magenta:e=>e,cyan:e=>e,inverse:e=>e,bgYellow:e=>e,black:e=>e};let r=n;try{let e=t(`ansi-colors`);r=e?.default??e}catch{r=n}function i(e,t){let n=String(e??``).replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,Math.max(0,t-1))}…`}function a(){return!(!process.stdout.isTTY||process.env.TERM===`dumb`||`NO_COLOR`in process.env)}try{r.enabled=a()}catch{}const o={bold:e=>r.bold(String(e??``)),underline:e=>(r.underline??(e=>e))(String(e??``)),dim:e=>r.dim(String(e??``)),gray:e=>(r.gray??r.grey??(e=>e))(String(e??``)),red:e=>r.red(String(e??``)),green:e=>r.green(String(e??``)),yellow:e=>r.yellow(String(e??``)),blue:e=>r.blue(String(e??``)),magenta:e=>r.magenta(String(e??``)),cyan:e=>r.cyan(String(e??``)),inverse:e=>r.inverse(String(e??``)),header:e=>r.bold(r.inverse(String(e??``))),highlight:e=>{let t=String(e??``),n=r.bgYellow?r.bgYellow(t):t;return r.black?r.black(n):n}};function s(e){if(!e||typeof e!=`object`)return``;let t=e.content;if(typeof t==`string`)return t;try{return JSON.stringify(t)}catch{return String(t)}}function c(e){let t=Array.isArray(e)?e.find(e=>e&&typeof e==`object`&&e.role===`user`&&i(s(e),999).length>0):void 0;return i((t?s(t):``)||`New session`,60)||`New session`}function l(e){let t=Array.isArray(e)?e:[],n=t.find(e=>e&&typeof e==`object`&&e.role===`user`),r=[...t].reverse().find(e=>e&&typeof e==`object`&&e.role===`user`),a=[...t].reverse().find(e=>e&&typeof e==`object`&&e.role===`assistant`),o=i(n?s(n):``,80),c=i(r?s(r):``,80),l=i(a?s(a):``,80);return i([o?`first: ${o}`:``,c&&c!==o?`last user: ${c}`:``,l?`last assistant: ${l}`:``].filter(Boolean).join(` | `),160)}function u(e){if(typeof e!=`number`||!Number.isFinite(e))return``;try{let t=new Date(e),n=e=>String(e).padStart(2,`0`),r=t.getFullYear(),i=n(t.getMonth()+1),a=n(t.getDate()),o=n(t.getHours()),s=n(t.getMinutes());return r===new Date().getFullYear()?`${i}-${a} ${o}:${s}`:`${r}-${i}-${a} ${o}:${s}`}catch{return``}}function d(e,t={}){let n=t.ansi??o,r=Array.isArray(e)?e:[],a=typeof t.maxMessages==`number`?t.maxMessages:12,c=typeof t.maxCharsPerMessage==`number`?t.maxCharsPerMessage:600,l=!!t.emoji&&process.stdout.isTTY&&process.env.TERM!==`dumb`,u=r.filter(e=>e&&typeof e==`object`&&e.role!==`system`);if(u.length===0){process.stdout.write(`[no history]
|
|
2
|
+
`);return}let d=Math.max(0,u.length-a),f=u.slice(d),p=d;p>0&&process.stdout.write(n.dim(`[... ${p} earlier messages omitted ...]\n`));for(let e of f){let r=typeof e.role==`string`?e.role:`unknown`,a=typeof t.formatRoleHeader==`function`?t.formatRoleHeader(r,{emoji:l}):(()=>{let e=r===`assistant`?`assistant`:r===`user`?`user`:r,t=l?`${l?e===`assistant`?`🤖`:e===`user`?`👤`:e===`tool`?`🛠️`:`📌`:``} ${e}`:e;return`[${e===`assistant`?n.cyan(t):e===`user`?n.green(t):n.gray(e)}]`})(),o=i(s(e),c);process.stdout.write(`${a} ${o}\n`)}}function f(){process.stdout.isTTY&&process.stdout.write(`\x1B[2J\x1B[H`)}export{i as a,d as c,c as i,f as n,u as o,l as r,s,o as t};
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "goatchain-cli",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.2-beta.10",
|
|
5
|
+
"description": "GoatChain CLI",
|
|
6
|
+
"author": "Simon He",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/zjywill/GoatChain.git",
|
|
11
|
+
"directory": "packages/cli"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"ai",
|
|
15
|
+
"agent",
|
|
16
|
+
"cli",
|
|
17
|
+
"goatchain"
|
|
18
|
+
],
|
|
19
|
+
"bin": {
|
|
20
|
+
"goatchain-cli": "./dist/cli.mjs"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/**/*"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@inquirer/prompts": "^7.8.6",
|
|
30
|
+
"ansi-colors": "^4.1.3",
|
|
31
|
+
"commander": "^12.1.0",
|
|
32
|
+
"picomatch": "^4.0.3",
|
|
33
|
+
"goatchain": "^0.0.2"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsdown && node scripts/postbuild.mjs",
|
|
37
|
+
"cli": "pnpm -s build && node dist/cli.mjs",
|
|
38
|
+
"smoke": "pnpm -s build && node dist/cli.mjs --help",
|
|
39
|
+
"lint": "eslint src/**/*.ts",
|
|
40
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
41
|
+
"release": "bumpp --commit --no-tag --no-push && pnpm build && pnpm publish"
|
|
42
|
+
}
|
|
43
|
+
}
|