@tokenbuddy/tokenbuddy 1.0.38 → 1.0.40

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.
@@ -37,7 +37,10 @@ function isClawtipPayWalletAuthOutput(args, output) {
37
37
  || output.includes("MEDIA:")
38
38
  || lower.includes("clawtipid")
39
39
  || lower.includes("qrcode")
40
- || lower.includes("扫码");
40
+ || lower.includes("扫码")
41
+ || output.includes("人工授权")
42
+ || output.includes("付款凭证缺失")
43
+ || output.includes("首次使用");
41
44
  }
42
45
  export function resolveNpxCommand(options = {}) {
43
46
  const platform = options.platform ?? process.platform;
@@ -198,12 +201,20 @@ function findClawtipFailureMessage(output) {
198
201
  }
199
202
  const returnedMessage = trimmed.match(/^返回消息[::]\s*(.+)$/);
200
203
  const returnedText = returnedMessage?.[1]?.trim();
204
+ if (returnedText && isClawtipManualAuthorizationMessage(returnedText)) {
205
+ continue;
206
+ }
201
207
  if (returnedText && !returnedText.includes("成功")) {
202
208
  return sanitizeClawtipOutput(trimmed);
203
209
  }
204
210
  }
205
211
  return undefined;
206
212
  }
213
+ function isClawtipManualAuthorizationMessage(message) {
214
+ return message.includes("人工授权")
215
+ || message.includes("付款凭证缺失")
216
+ || message.includes("首次使用");
217
+ }
207
218
  function decodeClawtipValue(value) {
208
219
  try {
209
220
  return decodeURIComponent(value);
@@ -273,7 +284,10 @@ export function parseClawtipCliOutput(output) {
273
284
  || lower.includes("authurl")
274
285
  || lower.includes("qrcode")
275
286
  || lower.includes("scan")
276
- || lower.includes("扫码")),
287
+ || lower.includes("扫码")
288
+ || output.includes("人工授权")
289
+ || output.includes("付款凭证缺失")
290
+ || output.includes("首次使用")),
277
291
  walletReady: lower.includes("register success")
278
292
  || lower.includes("注册成功")
279
293
  || lower.includes("tokeninfo")
@@ -19,6 +19,7 @@ export interface SingleModelProviderRuntimeConfig {
19
19
  selectionKind: "single-model";
20
20
  protocolPreference?: ProtocolPreference;
21
21
  defaultModel: string;
22
+ availableModelsByProtocol?: Partial<Record<ProtocolPreference, string[]>>;
22
23
  }
23
24
  /**
24
25
  * Claude Code role 绑定:把 buyer 端的 `haiku/sonnet/opus` 角色映射到具体上游模型。
@@ -155,6 +156,8 @@ export declare function applyProviderInstall(options: ProviderInstallOptions, st
155
156
  /**
156
157
  * 回滚 provider 安装。
157
158
  * 从 `store` 读取安装前的快照,恢复原文件(如果快照里有原始内容)。
159
+ * 恢复后仍会执行 provider cleanup,确保 repeated apply 或旧 TokenBuddy
160
+ * 配置升级后的 disconnect 语义是移除 TokenBuddy,而不是恢复旧 TokenBuddy。
158
161
  * 没有快照的 provider 标记为 `missing_snapshot`。
159
162
  *
160
163
  * @param options 回滚选项