coze_lab 0.1.6 → 0.1.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.
Files changed (2) hide show
  1. package/index.js +29 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4192,7 +4192,29 @@ function validateArgs(args) {
4192
4192
  if (args['refresh']) return { refresh: true };
4193
4193
  if (args['verify']) return { verify: true, pairCode: args['pair-code'] };
4194
4194
 
4195
- // 优先 --agent-id:读 ~/.coze/agents/<id>/config.json 的 framework 自动路由。
4195
+ // --cloud + --agent-id:云端 sandbox 没有本地 coze-bridge 的 ~/.coze/agents/<id>/config.json
4196
+ // framework 必须由命令行 --agent 显式传(前端拼命令时已知 agent.framework)。不读本地 config。
4197
+ if (args['cloud'] && args['agent-id']) {
4198
+ if (!args['agent'] || !VALID_AGENTS.includes(args['agent'])) {
4199
+ errorBox([
4200
+ 'ERROR: --cloud --agent-id=<id> 必须同时显式指定 --agent=<type>',
4201
+ '',
4202
+ '云端 sandbox 无本地 config.json,无法自动推断 framework。',
4203
+ `请拼成:npx coze_lab --cloud --agent-id=${args['agent-id']} --agent=claude-code|codex|openclaw`,
4204
+ ]);
4205
+ }
4206
+ return {
4207
+ agent: args['agent'],
4208
+ agentId: args['agent-id'],
4209
+ // 云端 claude-code 配置写进 agent workspace,缺省按约定路径推断(见 main)。
4210
+ workspace: args['workspace'] || '',
4211
+ 'codex-home': args['codex-home'],
4212
+ pairCode: args['pair-code'],
4213
+ cloud: true,
4214
+ };
4215
+ }
4216
+
4217
+ // 本地 --agent-id:读 ~/.coze/agents/<id>/config.json 的 framework 自动路由。
4196
4218
  if (args['agent-id']) {
4197
4219
  const resolved = resolveAgent(args['agent-id']);
4198
4220
  return {
@@ -5123,7 +5145,12 @@ async function main() {
5123
5145
  // 云端模式:开启结构化输出 + errorBox 抛异常(而非 exit)。
5124
5146
  CLOUD_MODE = !!args.cloud;
5125
5147
  // per-agent 路由时 agent 的 workspace(claude-code 用它做配置根目录)。
5126
- const agentWorkspace = args.workspace || '';
5148
+ // per-agent 路由时 agent 的 workspace(claude-code 用它做配置根目录)。
5149
+ // 云端 claude-code 未显式传 workspace 时,按约定路径 ~/.coze/agents/<id>/workspace 推断。
5150
+ let agentWorkspace = args.workspace || '';
5151
+ if (args.cloud && args.agentId && agent === 'claude-code' && !agentWorkspace) {
5152
+ agentWorkspace = path.join(os.homedir(), '.coze', 'agents', args.agentId, 'workspace');
5153
+ }
5127
5154
  if (args.agentId) {
5128
5155
  info(`目标 agent: ${args.agentId} (framework=${agent}, workspace=${agentWorkspace || 'N/A'})`);
5129
5156
  console.log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coze_lab",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Configure local AI agents (Claude Code, Codex, OpenClaw) to report traces to CozeLoop",
5
5
  "keywords": [
6
6
  "cozeloop",