@workclaw/cli 1.0.16 → 1.0.17

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.
@@ -90,7 +90,12 @@ function createHttpClient() {
90
90
  }
91
91
  async function httpPost(url, data, config) {
92
92
  const client = createHttpClient();
93
+ debugLog(`[HTTP POST] 请求地址: ${url}`);
94
+ debugLog(`[HTTP POST] 请求参数: ${JSON.stringify(data)}`);
95
+ debugLog(`[HTTP POST] 请求头: ${JSON.stringify(config?.headers || {})}`);
93
96
  const response = await client.post(url, data, config);
97
+ debugLog(`[HTTP POST] 响应状态: ${response.status}`);
98
+ debugLog(`[HTTP POST] 响应内容: ${JSON.stringify(response.data)}`);
94
99
  return {
95
100
  status: response.status,
96
101
  data: response.data
@@ -99,19 +104,29 @@ async function httpPost(url, data, config) {
99
104
  async function login(phone, password, env) {
100
105
  const config = getConfig(env);
101
106
  const url = `${config.API.TUZAI_BASE_URL}/user/login/pass`;
107
+ debugLog("[登录] 开始登录...");
108
+ debugLog(`[登录] 请求地址: ${url}`);
109
+ debugLog(`[登录] 请求参数: phone=${phone}, password=***`);
102
110
  const response = await httpPost(url, {
103
111
  phone,
104
112
  userPass: password
105
113
  });
106
114
  const data = response.data;
115
+ debugLog(`[登录] 响应数据: ${JSON.stringify(data)}`);
107
116
  if (data.code === 200 && data.data?.token) {
117
+ debugLog("[登录] 登录成功,获取到 token");
108
118
  return data.data.token;
109
119
  }
120
+ debugLog("[登录] 登录失败");
110
121
  throw new AppError$1(ERROR_CODES$1.LOGIN_FAILED, data.message || "登录失败");
111
122
  }
112
123
  async function fetchBoundConfig(token, phone, env) {
113
124
  const config = getConfig(env);
114
125
  const url = `${config.API.TUZAI_BASE_URL}/work-bot/local/bound/init`;
126
+ debugLog("[获取绑定配置] 开始获取绑定配置...");
127
+ debugLog(`[获取绑定配置] 请求地址: ${url}`);
128
+ debugLog(`[获取绑定配置] 请求参数: phone=${phone}, localCode=001`);
129
+ debugLog(`[获取绑定配置] 请求头: Authorization=${token.substring(0, 20)}...`);
115
130
  const response = await httpPost(url, {
116
131
  phone,
117
132
  localCode: "001"
@@ -121,6 +136,7 @@ async function fetchBoundConfig(token, phone, env) {
121
136
  }
122
137
  });
123
138
  const data = response.data;
139
+ debugLog(`[获取绑定配置] 响应数据: ${JSON.stringify(data)}`);
124
140
  if (data.code === 200 && data.data) {
125
141
  const boundConfig = {
126
142
  appKey: data.data.app_key,
@@ -130,11 +146,20 @@ async function fetchBoundConfig(token, phone, env) {
130
146
  modelApiKey: data.data.model_api_key,
131
147
  modelApiBaseUrl: data.data.model_api_base_url
132
148
  };
149
+ debugLog("[获取绑定配置] 获取绑定配置成功");
150
+ debugLog(`[获取绑定配置] appKey: ${boundConfig.appKey}`);
151
+ debugLog(`[获取绑定配置] appSecret: ${boundConfig.appSecret ? "***" : "undefined"}`);
152
+ debugLog(`[获取绑定配置] userId: ${boundConfig.userId}`);
153
+ debugLog(`[获取绑定配置] agentId: ${boundConfig.agentId}`);
154
+ debugLog(`[获取绑定配置] modelApiKey: ${boundConfig.modelApiKey || "undefined"}`);
155
+ debugLog(`[获取绑定配置] modelApiBaseUrl: ${boundConfig.modelApiBaseUrl || "undefined"}`);
133
156
  if (!boundConfig.appKey || !boundConfig.appSecret || !boundConfig.agentId) {
157
+ debugLog("[获取绑定配置] 缺少必要字段");
134
158
  throw new AppError$1(ERROR_CODES$1.GET_BOUND_CONFIG_FAILED, "获取绑定配置失败:缺少必要字段");
135
159
  }
136
160
  return boundConfig;
137
161
  }
162
+ debugLog("[获取绑定配置] 获取绑定配置失败");
138
163
  throw new AppError$1(ERROR_CODES$1.GET_BOUND_CONFIG_FAILED, data.message || data.msg || "获取绑定配置失败");
139
164
  }
140
165
  var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import("./index-RP7oF6iQ.js").then((cli) => {
2
+ import("./index-39c6v1yS.js").then((cli) => {
3
3
  cli.default();
4
4
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@workclaw/cli",
3
3
  "type": "module",
4
- "version": "1.0.16",
4
+ "version": "1.0.17",
5
5
  "description": "WorkClaw CLI 工具 - 用于初始化和配置 WorkClaw 插件",
6
6
  "license": "MIT",
7
7
  "keywords": [