claw-subagent-service 0.0.149 → 0.0.151

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.149",
3
+ "version": "0.0.151",
4
4
  "description": "虾说智能助手",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -81,6 +81,8 @@ async function getOrCreateGatewaySession(fallbackSessionId) {
81
81
  if (response.status === 200) {
82
82
  console.log(`[CHAT-DEBUG] Fallback session exists: ${fallbackSessionId}`);
83
83
  return fallbackSessionId;
84
+ } else {
85
+ console.log(`[CHAT-DEBUG] Fallback session not found (status: ${response.status}): ${fallbackSessionId}`);
84
86
  }
85
87
  } catch (e) {
86
88
  console.log(`[CHAT-DEBUG] Fallback session check failed: ${e.message}`);
@@ -89,6 +91,7 @@ async function getOrCreateGatewaySession(fallbackSessionId) {
89
91
 
90
92
  // 如果 fallback 无效,创建新 session
91
93
  try {
94
+ console.log(`[CHAT-DEBUG] Creating new session...`);
92
95
  const response = await axios.post(
93
96
  `${GATEWAY_URL}/session`,
94
97
  { title: 'Chat session' },
@@ -101,14 +104,13 @@ async function getOrCreateGatewaySession(fallbackSessionId) {
101
104
  }
102
105
  } catch (e) {
103
106
  console.log(`[CHAT-DEBUG] Failed to create session: ${e.message}`);
107
+ if (e.response) {
108
+ console.log(`[CHAT-DEBUG] Create session response status: ${e.response.status}`);
109
+ console.log(`[CHAT-DEBUG] Create session response data: ${JSON.stringify(e.response.data)}`);
110
+ }
104
111
  }
105
112
 
106
- // 最后尝试使用 fallback(即使验证失败)
107
- if (fallbackSessionId) {
108
- console.log(`[CHAT-DEBUG] Using fallback session (without validation): ${fallbackSessionId}`);
109
- return fallbackSessionId;
110
- }
111
-
113
+ // 如果创建也失败,抛出错误
112
114
  throw new Error('无法获取或创建有效的 session ID');
113
115
  }
114
116
 
@@ -165,10 +167,10 @@ async function forwardChatMessage(sessionId, content, onDelta, logFn, timeoutMs
165
167
  log('DEBUG', `请求超时: ${timeoutMs}ms`);
166
168
 
167
169
  // 构建请求体,包含 system 和 model 参数
168
- // model 字段是必需的,告诉 Gateway 使用哪个 AI 提供商和模型
170
+ // model 字段格式: { providerID: "provider-name", modelID: "model-id" }
169
171
  const requestBody = {
170
172
  system: SYSTEM_PROMPT,
171
- model: { providerID: 'opencode', modelID: 'default' },
173
+ model: { providerID: 'kimi-coding', modelID: 'kimi-k2.6' },
172
174
  parts: [{ type: 'text', text: content }]
173
175
  };
174
176