claw-subagent-service 0.0.52 → 0.0.53

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claw-subagent-service",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "description": "虾说智能助手",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -331,9 +331,7 @@ class OpenClawClient {
331
331
 
332
332
  const quoteArg = (s) => `"${s}"`;
333
333
  const cmdParts = ['openclaw', 'agent', '-m', quoteArg(escapedMessage), '--session-id', quoteArg(sessionId)];
334
- if (gatewayToken) {
335
- cmdParts.push('--token', quoteArg(gatewayToken));
336
- }
334
+ // 注意:openclaw agent CLI 不支持 --token 参数,token 通过环境变量传递
337
335
  const command = cmdParts.join(' ');
338
336
 
339
337
  this.log?.info(`[OpenClawClient] 执行: ${command}`);
@@ -345,10 +343,16 @@ class OpenClawClient {
345
343
 
346
344
  // 关键:不设置 OPENCLAW_GATEWAY_URL,避免触发 "gateway url override requires explicit credentials"
347
345
  // 让 openclaw agent 通过默认方式自动发现本地 gateway
346
+ const env = getOpenClawEnv();
347
+ // 将 gateway token 通过环境变量传递(openclaw agent 不支持 --token CLI 参数)
348
+ if (gatewayToken) {
349
+ env.OPENCLAW_API_KEY = gatewayToken;
350
+ env.OPENCLAW_TOKEN = gatewayToken;
351
+ }
348
352
  const child = spawn(command, {
349
353
  shell: true,
350
354
  windowsHide: true,
351
- env: getOpenClawEnv(),
355
+ env,
352
356
  });
353
357
 
354
358
  this.log?.info(`[OpenClawClient] CLI 子进程 PID=${child.pid}`);