@simonyea/holysheep-cli 1.3.8 → 1.4.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/package.json +1 -1
- package/src/tools/openclaw.js +24 -8
package/package.json
CHANGED
package/src/tools/openclaw.js
CHANGED
|
@@ -43,7 +43,7 @@ function writeCorrectConfig(apiKey, baseUrl) {
|
|
|
43
43
|
const config = {
|
|
44
44
|
agents: {
|
|
45
45
|
defaults: {
|
|
46
|
-
model: { primary: '
|
|
46
|
+
model: { primary: 'claude-sonnet-4-6' }
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
gateway: {
|
|
@@ -99,19 +99,31 @@ module.exports = {
|
|
|
99
99
|
// 2. doctor --fix 修复任何兼容性问题
|
|
100
100
|
npx('doctor', '--fix')
|
|
101
101
|
|
|
102
|
+
// 读取写入的 token(用于生成带 token 的直接访问 URL)
|
|
103
|
+
let savedToken = ''
|
|
104
|
+
try {
|
|
105
|
+
const cfg = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'))
|
|
106
|
+
savedToken = cfg?.gateway?.auth?.token || ''
|
|
107
|
+
} catch {}
|
|
108
|
+
|
|
102
109
|
// 3. 启动 Gateway
|
|
103
110
|
console.log(chalk.gray(' → 正在启动 Gateway...'))
|
|
104
111
|
const ok = _startGateway()
|
|
105
112
|
|
|
106
113
|
if (ok) {
|
|
107
114
|
console.log(chalk.green(' ✓ OpenClaw Gateway 已启动'))
|
|
108
|
-
console.log(chalk.cyan(' → 浏览器打开: http://127.0.0.1:18789/'))
|
|
109
115
|
} else {
|
|
110
|
-
console.log(chalk.yellow(' ⚠️
|
|
111
|
-
console.log(chalk.cyan(isWin ? ' npx openclaw gateway' : ' openclaw gateway'))
|
|
116
|
+
console.log(chalk.yellow(' ⚠️ Gateway 正在启动,请稍等几秒...'))
|
|
112
117
|
}
|
|
113
118
|
|
|
114
|
-
|
|
119
|
+
// 打印带 token 的直接访问 URL(无需手动填 token)
|
|
120
|
+
const dashUrl = savedToken
|
|
121
|
+
? `http://127.0.0.1:18789/?token=${savedToken}`
|
|
122
|
+
: 'http://127.0.0.1:18789/'
|
|
123
|
+
console.log(chalk.cyan(`\n → 浏览器打开(已含 token,直接可用):`))
|
|
124
|
+
console.log(chalk.bold.cyan(` ${dashUrl}`))
|
|
125
|
+
|
|
126
|
+
return { file: CONFIG_FILE, hot: false, _dashUrl: dashUrl }
|
|
115
127
|
},
|
|
116
128
|
|
|
117
129
|
reset() {
|
|
@@ -122,9 +134,13 @@ module.exports = {
|
|
|
122
134
|
hint: 'Gateway 已启动,打开浏览器即可使用',
|
|
123
135
|
launchCmd: null,
|
|
124
136
|
get launchNote() {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
// 读取 token,生成带 token 的 URL
|
|
138
|
+
try {
|
|
139
|
+
const cfg = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'))
|
|
140
|
+
const token = cfg?.gateway?.auth?.token
|
|
141
|
+
if (token) return `🌐 浏览器打开(含 token): http://127.0.0.1:18789/?token=${token}`
|
|
142
|
+
} catch {}
|
|
143
|
+
return '🌐 打开浏览器: http://127.0.0.1:18789/'
|
|
128
144
|
},
|
|
129
145
|
installCmd: 'npm install -g openclaw@latest',
|
|
130
146
|
docsUrl: 'https://docs.openclaw.ai',
|