ai_co_discuss 0.3.64 → 0.3.66

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/docs/runner.md CHANGED
@@ -41,7 +41,7 @@ codiscuss setup
41
41
 
42
42
  ### 浏览项目文件
43
43
 
44
- 房间设置了项目目录后,左栏“房间”下方的“文件”页可浏览电脑上的文件夹与文件,查看大小和修改时间。点击文件打开悬浮预览,支持文本、Markdown 渲染与 HTML 静态渲染,并可切换源码。可同时打开多个文件,以标签切换;标题栏的“收起”(手机上也可按住标签栏下拉,或正文在顶部时下拉)把预览缩成内容区左上角的悬浮按钮,切到其他频道后点它回到原处(打开的文件、模式和滚动位置都保留),关闭才清空。未设置项目目录时入口灰显。
44
+ 房间设置了项目目录后,左栏“房间”下方的“文件”页可浏览电脑上的文件夹与文件,查看大小和修改时间。点击文件打开悬浮预览,支持文本、Markdown 渲染与 HTML 静态渲染,并可切换源码。可同时打开多个文件,以标签切换;标题栏的“收起”(手机上也可按住标签栏下拉,或正文在顶部时下拉)把预览缩成内容区左上角的悬浮按钮,悬浮按钮可拖到左侧或右侧;切到其他频道或其他房间后点它回到原处(打开的文件、模式和滚动位置都保留),关闭才清空。未设置项目目录时入口灰显。
45
45
 
46
46
  在 Markdown 预览中选中文字后点“添加到对话”,可附一句批注(可选),这段文字随即作为摘录卡片放进消息输入框,并回到“消息”页;点卡片可查看原文、修改批注。发送时每段摘录以“文件路径 + 行号 + 引用原文 + 批注”附在正文之后,引用中的 @ 不会唤醒成员。
47
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.3.64",
3
+ "version": "0.3.66",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -260,20 +260,21 @@ function executable_stamp(profile) {
260
260
  * The model and effort a software runs with when the card leaves them empty. One read from its own settings is
261
261
  * cheap and always fresh; one that must run the CLI (agy) is kept for a day, because each run may refresh the
262
262
  * software's login and, when that refresh fails, it opens a browser sign-in. `refresh` reads it again.
263
+ * agy updates itself often, so the key leaves out the executable stamp; a failed run is recorded too and keeps the
264
+ * last good answer, so a run that cannot sign in is not repeated on every room read.
263
265
  */
264
266
  export async function cached_software_defaults(home, profile, { refresh = false, query = software_defaults } = {}) {
265
267
  if (!adapter_profile(profile.adapter)?.defaults_by_query) return query(profile);
266
268
  const path = join(home, 'model-catalogs.json');
267
- const key = JSON.stringify([profile.adapter, profile.executable || '', executable_stamp(profile), 'defaults']);
269
+ const key = JSON.stringify(['defaults', profile.adapter, profile.executable || '']);
268
270
  let cache = {};
269
271
  try { cache = JSON.parse(readFileSync(path, 'utf8')); } catch {}
270
272
  const entry = cache[key];
271
273
  if (!refresh && entry && Date.now() - entry.at < MODEL_CACHE_MS) return entry.result;
272
- const result = await query(profile);
273
- if (result?.model) {
274
- try { cache = JSON.parse(readFileSync(path, 'utf8')); } catch {}
275
- atomic_json(path, { ...cache, [key]: { at: Date.now(), result } });
276
- }
274
+ const answer = await query(profile);
275
+ const result = answer?.model ? answer : entry?.result || answer;
276
+ try { cache = JSON.parse(readFileSync(path, 'utf8')); } catch {}
277
+ atomic_json(path, { ...cache, [key]: { at: Date.now(), result } });
277
278
  return result;
278
279
  }
279
280