a4phone 1.4.1 → 1.4.2

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.
@@ -106,6 +106,8 @@ export async function handleAskUserQuestion(exec) {
106
106
  ? `(也可直接向话题 ${cfg.topic}-response 发送文字作答)`
107
107
  : `(选项较多,请回复编号如「3」,或直接向话题 ${cfg.topic}-response 发送文字作答)`
108
108
  );
109
+ // 浏览器兜底:未订阅响应话题的用户可打开网页版直接回复(自由作答/编号回复都需要)
110
+ lines.push(`(如未订阅响应话题,可浏览器打开 ${cfg.server}/${cfg.topic}-response 直接回复)`);
109
111
  if (!useActions && options.length > 3) {
110
112
  process.stderr.write(`[dsh-hook] 选项 ${options.length} 个超 ntfy 按钮上限(3),已降级为文字作答\n`);
111
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "a4phone",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Claude Code / Codex / DSH 远程手机交互:任务完成通知(含 AI 最后输出)、提问/权限请求手机点选或文字作答、远程续聊(ntfy.sh,含 DSH 会话续聊)",
5
5
  "type": "module",
6
6
  "bin": {
package/src/asku.mjs CHANGED
@@ -61,6 +61,8 @@ export async function handleAskUserQuestion(input, agentName, agent = 'claude')
61
61
  ? `(也可直接向话题 ${config.topic}-response 发送文字作答)`
62
62
  : `(选项较多,请回复编号如「3」,或直接向话题 ${config.topic}-response 发送文字作答)`
63
63
  );
64
+ // 浏览器兜底:未订阅响应话题的用户可打开网页版直接回复(自由作答/编号回复都需要)
65
+ lines.push(`(如未订阅响应话题,可浏览器打开 ${config.server}/${config.topic}-response 直接回复)`);
64
66
  const sent = await sendNotification({
65
67
  ...config,
66
68
  title: `${agentName}: ${q.header || 'Question'}`,
@@ -119,7 +119,10 @@ export async function checkForUpdate({
119
119
 
120
120
  const cache = loadCache(cachePath);
121
121
  const intervalMs = minIntervalMs ?? (cfg.updateIntervalHours ?? DEFAULT_INTERVAL_HOURS) * 3600 * 1000;
122
- if (now - (cache.lastCheck || 0) < intervalMs) {
122
+ // 本地版本升级后忽略限频:旧版本时代的 lastCheck 不应推迟新版本的首次检查
123
+ // (否则用户升级后要等一整个间隔才能收到新版本提醒)
124
+ const versionChanged = cache.version !== localVersion;
125
+ if (!versionChanged && now - (cache.lastCheck || 0) < intervalMs) {
123
126
  // 未到期:限频跳过(不访问网络)
124
127
  return { checked: false, hasUpdate: false, local: localVersion, latest: cache.knownLatest || null, notified: false };
125
128
  }
@@ -139,12 +142,12 @@ export async function checkForUpdate({
139
142
  } catch (error) {
140
143
  onLog(`更新提醒发送失败(将在下次检查重试): ${String(error?.message ?? error)}`);
141
144
  // 提醒失败:不更新 knownLatest,下次检查会重试;只记录检查时间
142
- saveCache({ lastCheck: now, knownLatest: cache.knownLatest }, cachePath);
145
+ saveCache({ lastCheck: now, knownLatest: cache.knownLatest, version: localVersion }, cachePath);
143
146
  return { checked: true, hasUpdate, local: localVersion, latest, notified: false };
144
147
  }
145
148
  }
146
149
 
147
- saveCache({ lastCheck: now, knownLatest: hasUpdate ? latest : cache.knownLatest }, cachePath);
150
+ saveCache({ lastCheck: now, knownLatest: hasUpdate ? latest : cache.knownLatest, version: localVersion }, cachePath);
148
151
  return { checked: true, hasUpdate, local: localVersion, latest, notified: isNewVersion };
149
152
  }
150
153