@tokenbuddy/tokenbuddy 1.0.39 → 1.0.41

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")
@@ -154,11 +154,9 @@ export declare function previewProviderInstall(options: ProviderInstallOptions):
154
154
  */
155
155
  export declare function applyProviderInstall(options: ProviderInstallOptions, store: BuyerStore): ProviderApplyResult[];
156
156
  /**
157
- * 回滚 provider 安装。
158
- * 从 `store` 读取安装前的快照,恢复原文件(如果快照里有原始内容)。
159
- * 恢复后仍会执行 provider cleanup,确保 repeated apply 或旧 TokenBuddy
160
- * 配置升级后的 disconnect 语义是移除 TokenBuddy,而不是恢复旧 TokenBuddy。
161
- * 没有快照的 provider 标记为 `missing_snapshot`。
157
+ * 断开 provider 安装。
158
+ * 从 `store` 读取首次 connect 前的快照,精确恢复原文件或删除当次创建的文件。
159
+ * 没有快照时不猜测、不清理第三方配置,只返回 `missing_snapshot`。
162
160
  *
163
161
  * @param options 回滚选项
164
162
  * @param store buyer store