ai_co_discuss 0.5.3 → 0.5.4

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.
Files changed (41) hide show
  1. package/.agents/skills/discuss-participant/references/interactive-html.md +59 -23
  2. package/backend/free_room.py +25 -4
  3. package/backend/schema.sql +6 -0
  4. package/backend/server.py +58 -1
  5. package/docs/en/guide/admin.md +4 -3
  6. package/docs/en/guide/faq.md +6 -5
  7. package/docs/en/guide/rooms.md +6 -4
  8. package/docs/en/guide/working.md +4 -4
  9. package/docs/guide/admin.md +4 -3
  10. package/docs/guide/faq.md +6 -5
  11. package/docs/guide/rooms.md +6 -4
  12. package/docs/guide/working.md +4 -4
  13. package/frontend/locales/en/admin.json +33 -2
  14. package/frontend/locales/en/app.json +72 -16
  15. package/frontend/locales/en/backend.json +4 -1
  16. package/frontend/locales/en/core.json +6 -2
  17. package/frontend/locales/en/discussion.json +6 -1
  18. package/frontend/locales/en/settings.json +5 -0
  19. package/gateway/gateway.mjs +11 -0
  20. package/package.json +1 -1
  21. package/runner/adapters/profiles.mjs +4 -0
  22. package/runner/admin_cli.mjs +21 -5
  23. package/runner/admin_panel.mjs +64 -19
  24. package/runner/discussion_local.mjs +2 -1
  25. package/runner/discussion_service.mjs +15 -7
  26. package/runner/discussion_skills.mjs +8 -0
  27. package/runner/files.mjs +17 -2
  28. package/runner/i18n_en.mjs +37 -1
  29. package/runner/instance_recovery.mjs +78 -0
  30. package/runner/os_users.mjs +6 -1
  31. package/runner/relay_channel.mjs +121 -30
  32. package/runner/relay_health.mjs +100 -0
  33. package/runner/relay_health_text.mjs +44 -0
  34. package/runner/remote_launch.mjs +24 -14
  35. package/web/admin.css +1 -1
  36. package/web/admin.js +3 -3
  37. package/web/app.js +349 -82
  38. package/web/backup.js +1 -1
  39. package/web/i18n.js +3 -3
  40. package/web/modern.css +1 -1
  41. package/web/modern.js +73 -58
@@ -335,6 +335,7 @@
335
335
  "手动专家需在其原会话中触发。复制通知不表示送达,实际联系后再确认已通知。": "Trigger manual experts in their own sessions. Copying a notification does not deliver it. Mark notified after actual contact.",
336
336
  "话题资料已保存": "Topic details saved",
337
337
  "正在回复 #{value1} · {value2}": "Replying to #{value1} · {value2}",
338
+ "撤回的消息里有附件或引用未能放回输入框:{value1}": "Some files or the reply of the retracted message could not be put back in the input: {value1}",
338
339
  "重命名频道": "Rename channel",
339
340
  "永久删除「{value1}」及其 {value2} 条消息、共识和发言安排。无法撤销。": "Permanently delete “{value1}” and its {value2} messages, consensus and speaking assignments. This cannot be undone.",
340
341
  "存档「{value1}」后移入已存档列表,保留记录并暂停未收束的讨论。": "Archive “{value1}” to move it to the archive list, keep its records and pause any unfinished discussion.",
@@ -343,7 +344,7 @@
343
344
  "永久删除": "Delete permanently",
344
345
  "提到我": "Mentioning me",
345
346
  "仍未连接:{value1}": "Still disconnected: {value1}",
346
- "「{name}」已空闲": "\"{name}\" is now idle",
347
+ "房间「{name}」的工作已结束": "Work in room \"{name}\" has ended",
347
348
  "正在备份…": "Creating backup…",
348
349
  "已生成备份({value1} 条消息),请查看浏览器下载。": "Backup created ({value1} messages). Check your browser downloads.",
349
350
  "备份当前讨论": "Back up current discussion",
@@ -400,12 +401,7 @@
400
401
  "未能确认这条排队消息的状态,内容已保留在输入框,请确认未发出后再发送": "Couldn't confirm this queued message's status. Its text is kept in the composer. Check that it wasn't sent before sending it again.",
401
402
  "请先登录": "Please sign in",
402
403
  "分享为网页…": "Share as web page…",
403
- "分享「{name}」为网页": "Share “{name}” as a web page",
404
- "生成一个只读网页,发给没装共议的人也能打开看。": "Creates a read-only web page that anyone can open, even without AI CoDiscuss installed.",
405
- "包含:消息、卡片、执行时间线与过程说明,冻结在生成这一刻。": "Included: messages, cards, the run timeline and progress notes, as they are at this moment.",
406
- "把你已有的 Claude Code、Codex、Gemini 和模型 API 拉进同一个房间协作,免费开源,数据留在你自己的电脑上。": "Bring the Claude Code, Codex, Gemini and model APIs you already use into one room to work together. Free and open source; your data stays on your own computer.",
407
404
  "用自己的 AI 开一个房间": "Start a room with your own AIs",
408
- "AI CoDiscuss:让多个 AI 在同一个房间协作": "AI CoDiscuss: several AIs working together in one room",
409
405
  "{title} · AI CoDiscuss": "{title} · AI CoDiscuss",
410
406
  "这是只读的分享页面,不能修改房间": "This is a read-only shared page; the room cannot be changed here",
411
407
  "分享页面不包含这部分内容": "This shared page does not include this content",
@@ -414,17 +410,10 @@
414
410
  "已生成分享网页,请查看浏览器下载;发出前请打开核对一遍内容。": "Shared page created; see your browser's downloads. Open it and check the content before sending it.",
415
411
  "生成分享网页失败:{value1}": "Could not create the shared page: {value1}",
416
412
  "只读分享 · 生成于 {time}": "Read-only share · created {time}",
417
- "{where}:…{text}…": "{where}: …{text}…",
418
413
  "执行 #{id} 的过程说明": "progress notes of run #{id}",
419
414
  "房间与执行信息": "room and run details",
420
- "不包含:私聊、事件记录、调度决策、被拒操作、排队消息、附件、本机路径、会话编号与凭据;失败原因只写“执行失败”,文件改动只列文件名,执行中的命令输出不带。": "Left out: private chats, the event log, scheduling decisions, refused actions, queued messages, attachments, paths on this computer, session IDs and credentials. Failure reasons read only “Run failed”, file changes list only file names, and command output from runs is not included.",
421
- "消息正文会原样公开。下面列出的是程序找到的疑似密钥、本机目录或联系方式,查不全,发出前请自己打开核对一遍。": "Message text is shared as written. Listed below is what looks like a key, a folder on this computer or contact details; not everything can be caught, so open the file and check it before sending it.",
422
- "没有找到疑似密钥、本机目录或联系方式。": "Nothing found that looks like a key, a folder on this computer or contact details.",
423
- "找到 {count} 处需要核对:": "{count} places to check:",
424
- "……其余 {count} 处请在生成的网页里查找": "…and {count} more; look for them in the created page",
425
415
  "项目目录": "project folder",
426
416
  "未公开": "not shown",
427
- "“下载网页文件”得到一个 .html 文件,发出去后无法过期或撤回;“发布链接”放到分享站,到期自动删除,可随时撤销。两者都只能阅读,不能操作。": "“Download web page” gives you an .html file that cannot expire or be taken back once sent; “Publish link” puts it on the share site, where it is deleted when it expires and can be revoked at any time. Either way it can only be read, not changed.",
428
417
  "{count} 天后过期": "Expires in {count} days",
429
418
  "复制分享链接": "Copy share link",
430
419
  "撤销分享链接": "Revoke share link",
@@ -438,10 +427,77 @@
438
427
  "撤销链接": "Revoke link",
439
428
  "分享站拒绝了这次请求({status})": "The share site refused this request ({status})",
440
429
  "这个房间整理后有 {size},超过分享链接 5 MB 的上限;请改用“下载网页文件”。": "This room comes to {size}, over the 5 MB limit for share links; use “Download web page” instead.",
441
- "分享链接已复制,{time} 前有效:{url}": "Share link copied, valid until {time}: {url}",
442
- "分享链接 {time} 前有效:{url}": "Share link valid until {time}: {url}",
443
430
  "发布分享链接失败:{value1}": "Could not publish the share link: {value1}",
444
431
  "分享链接已撤销,打开它的人会看到“分享不存在”。": "Share link revoked; anyone opening it will see “Share not found”.",
445
432
  "撤销分享链接失败:{value1}": "Could not revoke the share link: {value1}",
446
- "“发布链接”会把内容上传到 AI CoDiscuss 运营的分享站:运营方和内容审核 AI 能读到全文,违规会被下架;撤销后链接立即失效,但边缘缓存里的副本最长保留到原定过期时间才清除。": "“Publish link” uploads the content to the share site run by AI CoDiscuss: its operators and the reviewing AI can read all of it, and anything breaking the rules is taken down. Revoking stops the link at once, but a copy in the edge cache is kept until the original expiry before it is cleared."
433
+ "分享「{name}」": "Share “{name}”",
434
+ "生成只读网页,没装共议的人也能打开看。": "Make a read-only web page anyone can open, even without AI CoDiscuss.",
435
+ "分享的内容": "What is shared",
436
+ "消息、卡片、执行时间线与过程说明,停在此刻;读者只能看,不能操作。": "Messages, cards, the run timeline and progress notes, as they are now. Readers can look but not change anything.",
437
+ "不含私聊、事件记录、调度决策、排队消息、会话与凭据;本机用户目录写作 ~,项目目录写成相对路径,失败原因只写“执行失败”。": "Private chats, the event log, scheduling decisions, queued messages, sessions and credentials are left out; home folders are written as ~, project folders as paths inside the project, and failure reasons read only “Run failed”.",
438
+ "包含附件({count} 个,共 {size})": "Include attachments ({count}, {size} in all)",
439
+ "附件原样公开。文本类附件已一并检查;图片、视频和其他文件的内容程序查不了,请自己核对。": "Attachments are published as they are. Text attachments were checked too; the contents of images, videos and other files cannot be checked, so look through them yourself.",
440
+ "不包含时,消息里的附件标记显示为“未包含在分享中”。": "Without them, attachment tags in messages read “not included in the share”.",
441
+ "这个房间连同附件整理后有 {size},超过分享链接 5 MB 的上限;请取消“包含附件”,或改用“下载网页文件”。": "This room with its attachments comes to {size}, over the 5 MB limit for share links; untick “Include attachments” or use “Download web page” instead.",
442
+ "#{id} 的附件 {name}": "Attachment {name} of #{id}",
443
+ "分享页面不包含这个附件": "This shared page does not include this attachment",
444
+ "分享时未包含附件": "Attachments were not included when this was shared",
445
+ "[图片 #{number} · 未包含在分享中]": "[Image #{number} · not included in the share]",
446
+ "[文件 #{number} · 未包含在分享中]": "[File #{number} · not included in the share]",
447
+ "发出前请核对({count} 处)": "Check before sending ({count})",
448
+ "发出前请核对": "Check before sending",
449
+ "没有找到疑似密钥、令牌或联系方式。正文会原样公开,程序查不全,仍请自己看一遍。": "Nothing found that looks like a key, a token or contact details. Message text is shared as written and not everything can be caught, so look it over yourself.",
450
+ "疑似密钥、令牌、邮箱或手机号,正文会原样公开:": "What looks like a key, a token, an email or a phone number; message text is shared as written:",
451
+ "{count} 处": "{count} found",
452
+ "另有 {count} 个位置,请在生成的网页里查找。": "{count} more places; look for them in the page you make.",
453
+ "得到一个 .html 文件,发出后无法过期或撤回。": "Gives you an .html file; once sent, it cannot expire or be taken back.",
454
+ "上传到 AI CoDiscuss 分享站,运营方与审核 AI 能读到全文;到期自动删除,可随时撤销,撤销后缓存副本留到原定到期时才清除。": "Uploads to the AI CoDiscuss share site, where its operators and the reviewing AI can read all of it. Deleted when it expires and can be revoked any time; after revoking, a cached copy stays until the original expiry.",
455
+ "分享链接已发布": "Share link published",
456
+ "正在整理房间:读取消息与执行记录,去掉本机信息…": "Preparing the room: reading messages and runs and removing details of this computer…",
457
+ "分享链接": "Share link",
458
+ "已更新原链接的内容,{time} 前有效。": "The existing link now shows the new content, valid until {time}.",
459
+ "{time} 前有效,到期自动删除。": "Valid until {time}, then deleted automatically.",
460
+ "链接已复制到剪贴板。": " The link has been copied to the clipboard.",
461
+ "正在上传…": "Uploading…",
462
+ "分享卡": "Share card",
463
+ "这个浏览器不能复制图片,请用“保存图片”。": "This browser cannot copy images; use “Save image” instead.",
464
+ "分享卡:{name}": "Share card: {name}",
465
+ "复制图片": "Copy image",
466
+ "保存图片": "Save image",
467
+ "共议 AI CoDiscuss": "AI CoDiscuss",
468
+ "多个 AI 在同一个房间协作": "Several AIs working in one room",
469
+ "问题": "Question",
470
+ "成果": "Outcome",
471
+ "扫码阅读完整协作记录": "Scan to read the whole session",
472
+ "生成分享卡图片失败": "Could not make the share card image",
473
+ "{members} 位 AI · {messages} 条消息 · {runs} 次执行": "{members} AIs · {messages} messages · {runs} runs",
474
+ "{time} 前有效": "Valid until {time}",
475
+ "等 {count} 位": "{count} in all",
476
+ "继续回放": "Resume replay",
477
+ "回放协作过程": "Replay the session",
478
+ "这是只读分享,不能在这里发消息": "This is a read-only share; messages cannot be sent here",
479
+ "在自己的房间里,可以单独和某个 AI 私聊,看它这次执行的每一步,不打扰其他成员。分享页不包含私聊。": "In a room of your own you can chat privately with one AI and see every step of its run without disturbing the others. Shares leave private chats out.",
480
+ "房间设置": "Room settings",
481
+ "在自己的房间里,这里管理成员、模型、强度、项目权限和主持人权限。分享页只能阅读。": "In a room of your own, this is where you manage members, models, effort, project access and host permissions. A share can only be read.",
482
+ "在自己的房间里,这里浏览项目目录、预览成员改动过的文件。分享页不包含项目文件。": "In a room of your own, this is where you browse the project folder and preview files members changed. Shares leave project files out.",
483
+ "{days} 天 {hours} 小时后过期": "Expires in {days} d {hours} h",
484
+ "{hours} 小时后过期": "Expires in {hours} h",
485
+ "已分享": "Shared",
486
+ "已分享的房间": "Shared rooms",
487
+ "链接已发布,但没能保存到房间,之后无法在这里续期或撤销:{value1}": "The link is published, but it could not be saved with the room, so it cannot be renewed or revoked here later: {value1}",
488
+ "这个房间没有可续期的分享链接": "This room has no share link to renew",
489
+ "已续期,{time} 前有效。": "Renewed, valid until {time}.",
490
+ "续期失败:{value1}": "Could not renew: {value1}",
491
+ "之后在左侧“已分享”里可以复制、续期或撤销,已配对的手机和平板也能操作。": "Later, copy, renew or revoke it under \u201cShared\u201d on the left, from paired phones and tablets too.",
492
+ "到期自动删除。续期只延长时间,内容不变;要换成最新内容,在房间菜单里重新分享。": "Deleted when they expire. Renewing only extends the time and keeps the content; to show the latest content, share again from the room’s menu.",
493
+ "复制「{name}」的分享链接": "Copy the share link of “{name}”",
494
+ "打开分享页": "Open the shared page",
495
+ "打开「{name}」的分享页": "Open the shared page of “{name}”",
496
+ "续期「{name}」的分享链接": "Renew the share link of “{name}”",
497
+ "从现在起 {count} 天(到 {time})": "{count} days from now (until {time})",
498
+ "分享卡上的问题": "Question on the share card",
499
+ "分享卡上的成果": "Outcome on the share card",
500
+ "卡片上的问题": "Question on the card",
501
+ "可留空": "Optional",
502
+ "卡片上的成果": "Outcome on the card"
447
503
  }
@@ -1,4 +1,6 @@
1
1
  {
2
+ "尚未绑定线上网站": "No online site is bound yet",
3
+ "请先启动共议服务,再重连中转": "Start the CoDiscuss service before reconnecting the relay",
2
4
  "会话上下文压缩失败({reason}),下次执行将改用新会话;请缩短输入或拆分任务后重试": "Context compaction failed ({reason}). The next run will use a new session; shorten the input or split the task before retrying",
3
5
  "{name} 的上下文压缩失败,处理 {messages} 的执行失败(执行 #{execution_id}):{reason}。请缩短输入或拆分任务后再决定是否重试;程序不自动重试。": "{name}'s context compaction failed while handling {messages} (run #{execution_id}): {reason}. Shorten the input or split the task before deciding whether to retry; there is no automatic retry.",
4
6
  "{name} 因安全策略拒绝,处理 {messages} 的执行失败(执行 #{execution_id}):{reason}。请核对请求内容与服务许可要求,不要原样重试;程序不自动重试。": "{name} was blocked by a safety policy while handling {messages} (run #{execution_id}): {reason}. Review the request and service access requirements; do not retry it unchanged. There is no automatic retry.",
@@ -836,5 +838,6 @@
836
838
  "只有房间控制凭据能代其他房间的主持人发言": "Only the room's control credential can speak for another room's host",
837
839
  "只有互相关联的房间之间才能代主持人发言": "Only linked rooms can speak for each other's host",
838
840
  "两个房间的主持人自用户上次发言后已互传 {count} 条消息,达到上限;请等用户在任一房间发言后再继续": "The two rooms' hosts have passed {count} messages since the owner last spoke, which is the limit; wait for the owner to speak in either room before continuing",
839
- "relay.limit 须为 0–100 的整数,0 表示不限": "relay.limit must be an integer from 0 to 100; 0 means no limit"
841
+ "relay.limit 须为 0–100 的整数,0 表示不限": "relay.limit must be an integer from 0 to 100; 0 means no limit",
842
+ "分享链接格式不正确": "The share link is not in the expected format"
840
843
  }
@@ -479,8 +479,12 @@
479
479
  "小": "Small",
480
480
  "中": "Medium",
481
481
  "大": "Large",
482
- "调整消息卡片里正文的字号,只对本设备生效。": "Sets the text size inside message cards. Saved on this device only.",
483
- "宽松:超过 1.2 屏才折叠,折后保留半屏;标准:超过 0.7 屏折叠;紧凑:超过半屏就折叠,只留开头。按当前屏幕高度计算,只对本设备生效。": "Relaxed folds answers taller than 1.2 screens and keeps half a screen; Standard folds past 0.7 of a screen; Eager folds past half a screen and keeps only the opening. Measured against this screen's height, and saved on this device only.",
482
+ "阅读": "Reading",
483
+ "宽松:超过 1.2 屏才折叠;标准:超过 0.7 屏折叠;紧凑:超过半屏就折叠。按当前屏幕高度计算,只对本设备生效。": "Relaxed folds answers taller than 1.2 screens; Standard folds past 0.7 of a screen; Eager folds past half a screen. Measured against this screen's height, and saved on this device only.",
484
+ "折叠后显示": "Lines shown when folded",
485
+ "少": "Fewer",
486
+ "多": "More",
487
+ "折叠后的回答保留开头一段:少约 0.15 屏、中约 0.3 屏、多约半屏。按当前屏幕高度换算成行数,手机、平板、电脑各自不同,只对本设备生效。": "A folded answer keeps its opening: Fewer about 0.15 of a screen, Medium about 0.3, More about half. Converted to lines from this screen's height, so phones, tablets and computers each differ. Saved on this device only.",
484
488
  "关联房间互传上限": "Linked-room message limit",
485
489
  "关联房间互传条数": "Messages between linked rooms",
486
490
  "条": "messages",
@@ -2,6 +2,10 @@
2
2
  "已跳过": "Skipped",
3
3
  "等待中": "Waiting",
4
4
  "等待中:等当前执行结束": "Waiting for the current run to finish",
5
+ "排队中:等当前执行结束": "Queued: waiting for the current run to finish",
6
+ "排队中:等上一轮结束": "Queued: waiting for the previous round to finish",
7
+ "正在唤醒": "Waking up",
8
+ "已等 {value1}": "Waited {value1}",
5
9
  "在 #{id} 一并回答": "Answered together in #{id}",
6
10
  "查看回答 #{id}": "View answer #{id}",
7
11
  "额度已用尽,请等待重置或改派其他成员。": "Usage limit reached. Wait for it to reset or assign another member.",
@@ -317,5 +321,6 @@
317
321
  "在消息内展开 {name}": "Expand {name} in message",
318
322
  "收起 {name} 的预览": "Collapse preview of {name}",
319
323
  "HTML 附件超过 2 MiB,请在预览窗口查看源码。": "This HTML attachment is over 2 MiB. Open the preview window to view its source.",
320
- "打开预览窗口": "Open preview window"
324
+ "打开预览窗口": "Open preview window",
325
+ "放大": "Open larger preview"
321
326
  }
@@ -9,6 +9,9 @@
9
9
  "未运行": "Not running",
10
10
  "未安装": "Not installed",
11
11
  "跟随通用": "Use general voice",
12
+ "各 AI": "Per AI",
13
+ "已单独设置 {value1} 个": "{value1} set individually",
14
+ "全部跟随通用": "All use the general voice",
12
15
  "正在试听:{value1}。听不到声音时,请检查这台设备的音量和声音输出(耳机或音箱)": "Playing preview: {value1}. If you cannot hear it, check this device's volume and audio output (headphones or speakers).",
13
16
  "语音": "Speech",
14
17
  "朗读与语音输入": "Read aloud and voice input",
@@ -559,6 +562,8 @@
559
562
  "做什么": "Action",
560
563
  "主持人在这里做什么": "What the host does here",
561
564
  "删除主持人节点": "Delete host node",
565
+ "再点一次删除主持人节点": "Press again to delete the host node",
566
+ "再点一次,从画布移除子工作流节点": "Press again to remove the sub-workflow node from the canvas",
562
567
  "子工作流": "Sub-workflow",
563
568
  "{value1} 位成员": "{value1} members",
564
569
  "进入这个子工作流(也可双击)": "Open this sub-workflow (or double-click)",
@@ -18,6 +18,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
18
18
  import { parseArgs } from 'node:util';
19
19
 
20
20
  import { ENTRY_KEY_PATTERN, verified_connection } from '../runner/entry_client.mjs';
21
+ import { clear_instance_flag, read_os_users } from '../runner/os_users.mjs';
21
22
  import { create_direct } from './direct.mjs';
22
23
  import { login_page } from './login_page.mjs';
23
24
 
@@ -106,6 +107,13 @@ export function read_accounts(data) {
106
107
  return existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : {};
107
108
  }
108
109
 
110
+ /** Remember an explicit start or stop for hosted instances that run as the owner. */
111
+ export function set_instance_wanted(data, name, wanted) {
112
+ const accounts = read_accounts(data), account = accounts[name];
113
+ if (!account || account.instance_wanted === wanted) return;
114
+ write_json(accounts_path(data), { ...accounts, [name]: { ...account, instance_wanted: wanted } });
115
+ }
116
+
109
117
  function write_json(path, value) {
110
118
  mkdirSync(dirname(path), { recursive: true });
111
119
  const draft = `${path}.${process.pid}.tmp`;
@@ -492,6 +500,9 @@ export function create_gateway({ data, now = Date.now }) {
492
500
  /** Run `codiscuss local start|stop` against one account's service directory and wait for it. */
493
501
  function run_instance(data, name, command) {
494
502
  if (!read_accounts(data)[name]) throw new Error(`账号不存在:${name}`);
503
+ if (read_os_users(data)[name]) {
504
+ if (command === 'stop') clear_instance_flag(name);
505
+ } else set_instance_wanted(data, name, command === 'start');
495
506
  const child = spawn(process.execPath, [LOCAL_SCRIPT, command, '--json'], { stdio: 'inherit', windowsHide: true,
496
507
  env: { ...process.env, DISCUSS_SERVICE_HOME: instance_home(data, name) } });
497
508
  return new Promise((done, fail) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -119,6 +119,10 @@ export const ADAPTER_PROFILES = {
119
119
  windows_command: 'codiscuss',
120
120
  // Confined by --restricted --safe-mode --tools and dontAsk (claude_lockdown); a taken-over manual member keeps its own window.
121
121
  capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true, resume: true, images: true, capture: FINAL_REMARK, tool_lockdown: true },
122
+ // The card shows only Claude's text between tool calls, not its thinking; without this rule it wrote one line per
123
+ // five to fourteen calls, often in English (2026-11-21 session record).
124
+ task_rules: () => '多步任务中,转入新的一段工作时(如读完代码开始修改、改完开始验证)先用一句话说明再继续:'
125
+ + '用户等待时网页卡片只显示这些话,看不到你的思考。用请求者的语言写,即使代码和工具输出是英文;一句即可,不打断手头的工作。',
122
126
  },
123
127
  antigravity_cli: {
124
128
  platform: 'Antigravity', label: 'Antigravity CLI', kind: 'cli', location: 'executable', fields: ['project_id', 'project_name'],
@@ -20,6 +20,7 @@ import { fileURLToPath } from 'node:url';
20
20
  import { parseArgs } from 'node:util';
21
21
  import { data_home, entry_settings, entry_status, stop_entry } from '../gateway/gateway.mjs';
22
22
  import { local_status } from './discussion_local.mjs';
23
+ import { relay_health_text } from './relay_health_text.mjs';
23
24
  import { stop_tunnel } from './hosting_tunnel.mjs';
24
25
  import { launcher_path } from './launcher.mjs';
25
26
  import { running_elevated } from './os_users.mjs';
@@ -43,7 +44,7 @@ export const HELP = t(`用法:codiscuss admin <命令> [参数](与管理面
43
44
  update [check] 检查更新;不带 check 时安装最新版(面板未运行时先启动)并等待每一步结果
44
45
 
45
46
  本机
46
- status [--full] 概览:服务、版本、开机自启、登录入口、托管账号;--full 输出面板的完整状态
47
+ status [--full] 概览:服务、中转状态、版本、开机自启、登录入口、托管账号;--full 输出面板的完整状态
47
48
  service start|stop|restart 只启停共议服务(网站与讨论服务)
48
49
  autostart on|off 登录 Windows 时自动启动
49
50
 
@@ -51,6 +52,7 @@ export const HELP = t(`用法:codiscuss admin <命令> [参数](与管理面
51
52
  site status 本地网页与线上网站的地址
52
53
  site connect <接入码|站点> [绑定令牌] 绑定线上网站(管理员外出、邀请外部专家用);在部署该网站的电脑上只填站点即可
53
54
  site disconnect 解绑线上网站,已配对的设备不能再连到这台电脑
55
+ site reconnect 立即重连已绑定网站的中转
54
56
 
55
57
  登录入口与访问方式(需打开托管管理)
56
58
  entry start|stop 启动或停止登录入口
@@ -80,7 +82,7 @@ API 密钥、技能、工作流、系统提示词(目标同上)
80
82
  key list <目标> / key add <目标> --base-url <地址> --key <密钥> / key remove <目标> <编号>
81
83
  skill library / skill import <文件夹或.zip> / skill delete <名>
82
84
  skill list <目标> / skill install <目标> <名>... / skill remove <目标> <名>...
83
- workflow list <目标> / workflow install <目标>
85
+ workflow list <目标> / workflow install <目标> / workflow update <目标>
84
86
  prompt get <目标> / prompt set <目标> --file <文件> [--group <键>] 管理员的提示词按组保存(见 prompt get)
85
87
  prompt default get / prompt default set --file <文件> 新托管账号的默认系统提示词
86
88
 
@@ -232,6 +234,7 @@ async function workflow_command(call, [action, who]) {
232
234
  const base = is_owner(need(who, t('目标'))) ? 'owner/workflows' : `accounts/${who}/workflows`;
233
235
  if (action === 'list') return call(base);
234
236
  if (action === 'install') return call(`${base}/install`, {});
237
+ if (action === 'update') return call(`${base}/update`, {});
235
238
  throw new Error(HELP);
236
239
  }
237
240
 
@@ -349,6 +352,7 @@ async function site_command(call, [action, first, second]) {
349
352
  }
350
353
  if (action === 'connect') return call('site/connect', { site: need(first, t('站点')), setup_key: second || '' });
351
354
  if (action === 'disconnect') return call('site/disconnect', {});
355
+ if (action === 'reconnect') return call('site/reconnect', {});
352
356
  throw new Error(HELP);
353
357
  }
354
358
 
@@ -370,11 +374,11 @@ function summary(state) {
370
374
  const tunnel = entry?.tunnel ? (entry.tunnel.connected ? t('已连接') : entry.tunnel.running ? t('连接中') : t('未运行')) : undefined;
371
375
  return { hosting: state.hosting, version: state.version, autostart: state.autostart,
372
376
  service: { running: service.running, url: service.url, version: service.version, error: service.error || undefined },
373
- online_site: state.online_site || undefined,
377
+ online_site: state.online_site || undefined, relay_health: state.relay_health || undefined,
374
378
  ...(state.hosting ? {
375
379
  entry: entry && { running: entry.running, relay_enabled: entry.relay_enabled, tunnel_enabled: entry.tunnel_enabled, address: entry.address || undefined, tunnel, problem: entry.relay?.problem || undefined },
376
380
  runtime: state.clis,
377
- accounts: state.accounts.map(item => ({ name: item.name, isolated: Boolean(item.os_user), protected: item.protected, running: item.running, disabled: item.disabled })),
381
+ accounts: state.accounts.map(item => ({ name: item.name, isolated: Boolean(item.os_user), protected: item.protected, running: item.running, disabled: item.disabled, last_restart: item.last_restart })),
378
382
  } : {}) };
379
383
  }
380
384
 
@@ -415,8 +419,20 @@ export async function admin_cli(args, { client = panel_client, print = text => p
415
419
  const commands = {
416
420
  status: async () => {
417
421
  const { login_methods: _methods, providers: _providers, ...state } = await call('state');
422
+ if (state.online_site) {
423
+ const { label, detail } = relay_health_text(state.online_site, state.relay_health, t);
424
+ state.relay_health = { state: 'unknown', ...state.relay_health, label, detail };
425
+ }
418
426
  // The state leaves out the entry's checks over the network; they are asked apart.
419
- if (state.hosting) state.entry = await call('entry');
427
+ if (state.hosting) {
428
+ state.entry = await call('entry');
429
+ for (const account of state.accounts) {
430
+ const restart = account.last_restart;
431
+ if (restart) account.last_restart = { at: new Date(restart.at).toISOString(), result: restart.result,
432
+ reason: t(restart.reason.template, restart.reason.params), blocked: restart.blocked,
433
+ error: restart.error && t(restart.error.template, restart.error.params) };
434
+ }
435
+ }
420
436
  return values.full ? state : summary(state);
421
437
  },
422
438
  service: () => call(`service/${need(rest[0], 'start|stop|restart')}`, {}),
@@ -18,17 +18,19 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
18
18
  import { parseArgs } from 'node:util';
19
19
 
20
20
  import { account_home, add_account, data_home, entry_settings, entry_status, instance_home as plain_instance_home, read_accounts, remove_account, reset_password, save_entry_settings,
21
- instance_key, set_account_disabled, set_account_protected, start_entry, stop_entry, ENTRY_WAYS } from '../gateway/gateway.mjs';
21
+ instance_key, set_account_disabled, set_account_protected, set_instance_wanted, start_entry, stop_entry, ENTRY_WAYS } from '../gateway/gateway.mjs';
22
22
  import { signed_site_url, verified_connection } from './entry_client.mjs';
23
23
  import { API_PROVIDERS, save_api_key } from './discussion_api.mjs';
24
24
  import { STT_PROVIDERS, TTS_PROVIDERS } from './tts_providers.mjs';
25
25
  import { ensure_tunnel, start_tunnel_setup, tunnel_setup_state, tunnel_status } from './hosting_tunnel.mjs';
26
26
  import { machine_links } from './remote_launch.mjs';
27
+ import { read_relay_health, request_relay_reconnect } from './relay_health.mjs';
28
+ import { instance_recovery } from './instance_recovery.mjs';
27
29
  import { DIRECT_ACCOUNTS_FILE } from '../gateway/direct.mjs';
28
30
  import { apply_login, cancel_login, LOGIN_METHODS, login_progress, login_status, logout, start_login, submit_login } from './cli_login.mjs';
29
- import { clear_instance_flag, create_os_user, install_shared_runtime, restrict_other_drives, instance_key_file, place_instance_key, read_os_users, remove_os_user, run_as_user, shared_cli_state, shared_executables, shared_paths,
31
+ import { clear_instance_flag, create_os_user, install_shared_runtime, restrict_other_drives, instance_flag_set, instance_key_file, place_instance_key, read_os_users, remove_os_user, run_as_user, shared_cli_state, shared_executables, shared_paths,
30
32
  start_instance_as_user } from './os_users.mjs';
31
- import { install_workflows, shipped_workflows } from './discussion_skills.mjs';
33
+ import { install_workflows, outdated_workflows, shipped_workflows } from './discussion_skills.mjs';
32
34
  import { list_workflows, workflows_home } from './workflows.mjs';
33
35
  import { hosted_prompt, import_skill, library_root, list_library, remove_library_skill, save_hosted_prompt } from './skill_library.mjs';
34
36
  import { local_status, save_site_connection } from './discussion_local.mjs';
@@ -100,7 +102,7 @@ const HELP = t(`用法:codiscuss panel [run|start|open|stop] [--port {value1}]
100
102
  function service_overview(data) {
101
103
  const status = local_status(data);
102
104
  return { running: Boolean(status.running), website: Boolean(status.website_running), url: status.url || '', version: status.version || '',
103
- home: data, error: status.service_error || '' };
105
+ home: data, pid: status.service_pid, error: status.service_error || '' };
104
106
  }
105
107
 
106
108
  let latest = { at: 0, version: '' };
@@ -521,13 +523,14 @@ export function save_owner_prompt(key, text, original, home = homedir()) {
521
523
  }
522
524
 
523
525
  /**
524
- * The workflows in a service home's library, and the shipped workflows it lacks:
525
- * { workflows: [{ id, label, description, cards, disabled?, error? }], missing: [id] }.
526
+ * The workflows in a service home's library, the shipped workflows it lacks, and the shipped ones whose copy differs
527
+ * from the shipped version: { workflows: [{ id, label, description, cards, disabled?, error? }], missing: [id], outdated: [id] }.
526
528
  */
527
529
  export function account_workflows(home) {
528
530
  const workflows = existsSync(workflows_home(home)) ? list_workflows(home).map(({ directory: _directory, unavailable: _unavailable, ...item }) => item) : [];
529
531
  const installed = new Set(workflows.map(item => item.id));
530
- return { workflows, missing: shipped_workflows().map(item => item.name).filter(name => !installed.has(name)) };
532
+ return { workflows, missing: shipped_workflows().map(item => item.name).filter(name => !installed.has(name)),
533
+ outdated: installed.size ? outdated_workflows(home) : [] };
531
534
  }
532
535
 
533
536
  function owner_skills(data, { install = [], remove = [] } = {}) {
@@ -587,7 +590,8 @@ function run_instance(data, name, command) {
587
590
  return start_instance_as_user(data, name, service, local_script, process.execPath, { key_file });
588
591
  }
589
592
  // An isolated instance runs as a scheduled task that comes back when the computer starts unless it was stopped here.
590
- if (command === 'stop' && read_os_users(data)[name]) clear_instance_flag(name);
593
+ if (read_os_users(data)[name]) clear_instance_flag(name);
594
+ else set_instance_wanted(data, name, command === 'start');
591
595
  const { DISCUSS_ENTRY_KEY_FILE: _inherited, ...environment } = process.env;
592
596
  const child = spawn(process.execPath, [LOCAL_SCRIPT, command, '--json'], { stdio: 'ignore', windowsHide: true,
593
597
  env: { ...environment, DISCUSS_SERVICE_HOME: service, ...(key_file ? { DISCUSS_ENTRY_KEY_FILE: key_file } : {}) } });
@@ -664,6 +668,21 @@ function cookie(request, name) {
664
668
  return String(request.headers.cookie || '').split(';').map(part => part.trim().split('=')).find(([key]) => key === name)?.[1] || '';
665
669
  }
666
670
 
671
+ /** The instance port to watch when the owner wants the account running. */
672
+ function wanted_port(data, name, flag_set) {
673
+ if (!hosting_enabled(data)) return;
674
+ const job = update_job(data);
675
+ if (job && job.status !== 'done' && Date.now() - job.started_at < UPDATE_STALE_MS) return;
676
+ const account = read_accounts(data)[name];
677
+ if (!account || account.disabled) return;
678
+ if (read_os_users(data)[name]) return flag_set(name) ? account.port : undefined;
679
+ if (account.instance_wanted === undefined && local_status(instance_home(data, name)).website_running) {
680
+ set_instance_wanted(data, name, true);
681
+ return account.port;
682
+ }
683
+ return account.instance_wanted ? account.port : undefined;
684
+ }
685
+
667
686
  /**
668
687
  * The panel's request handler.
669
688
  *
@@ -679,6 +698,9 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
679
698
  save_api_key, list_keys, remove_key, use_shared_programs, service_overview, run_owner_service, latest_version, check_package, begin_update,
680
699
  set_account_external, reconcile_external, autostart_enabled, set_autostart, entry_overview, start_entry, stop_entry, keep_tunnel, start_tunnel_setup, set_entry_way, set_relay_url, connect_site, make_access_code, join_relay, protect_account, start_verified, hand_over: () => {}, ...ops };
681
700
  const hosts = new Set([`127.0.0.1:${port}`, `localhost:${port}`]);
701
+ const recovery = instance_recovery(data, { wanted: name => wanted_port(data, name, ops.instance_flag_set || instance_flag_set),
702
+ probe: ops.instance_state || instance_state, start: name => op.start_verified(data, name), now: ops.now,
703
+ on_block(name) { if (read_os_users(data)[name]) (ops.clear_instance_flag || clear_instance_flag)(name); } });
682
704
 
683
705
  async function api(method, path, body) {
684
706
  const parts = path.split('/').filter(Boolean).slice(1);
@@ -689,9 +711,12 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
689
711
  const hosting = hosting_enabled(data);
690
712
  if (method === 'GET' && section === 'state') {
691
713
  const windows = process.platform === 'win32';
692
- return { hosting, version: VERSION, service: op.service_overview(data), online_site: bound_site(data)?.site || '', platform: process.platform,
714
+ const service = op.service_overview(data), bound = bound_site(data);
715
+ const restarts = hosting ? recovery.status() : {};
716
+ return { hosting, version: VERSION, service, online_site: bound?.site || '', platform: process.platform,
717
+ relay_health: read_relay_health(data, bound, service.running && service.pid),
693
718
  launcher: windows && existsSync(launcher_path(data)), autostart: windows && op.autostart_enabled(), login_methods: LOGIN_METHODS, providers: API_PROVIDERS,
694
- ...(hosting ? { accounts: await op.list_accounts(data), clis: op.shared_cli_state(), entry: await op.entry_overview(data, { reach: false }) }
719
+ ...(hosting ? { accounts: (await op.list_accounts(data)).map(item => ({ ...item, last_restart: restarts[item.name] })), clis: op.shared_cli_state(), entry: await op.entry_overview(data, { reach: false }) }
695
720
  : { accounts: [], clis: {}, entry: null }) };
696
721
  }
697
722
  // The entry with what needs the network (the relay's reach, the tunnel's connection), asked apart so the state is quick.
@@ -739,6 +764,8 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
739
764
  if (method === 'GET' && name === 'workflows') return op.account_workflows(data);
740
765
  // Only the shipped workflows the owner's library lacks: an existing one, edited or not, is kept.
741
766
  if (method === 'POST' && name === 'workflows' && action === 'install') { install_workflows(data, op.account_workflows(data).missing); return op.account_workflows(data); }
767
+ // Replace the ones that differ from the shipped version; each old copy is backed up first (as setup --workflows).
768
+ if (method === 'POST' && name === 'workflows' && action === 'update') { install_workflows(data, outdated_workflows(data)); return op.account_workflows(data); }
742
769
  if (method === 'GET' && name === 'keys') return op.list_keys(data);
743
770
  if (method === 'POST' && name === 'keys' && action === 'remove') { op.remove_key(data, String(body.ref || '')); return { ok: true }; }
744
771
  if (method === 'POST' && name === 'keys') return op.save_api_key(data, { base_url: body.base_url, api_key: body.api_key });
@@ -753,6 +780,13 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
753
780
  // The owner's own online site: bound, checked and left here whether or not this computer hosts accounts.
754
781
  if (method === 'POST' && section === 'site' && name === 'connect') { const bound = await bind_online_site(data, body, op.connect_site); after_change(); return bound; }
755
782
  if (method === 'POST' && section === 'site' && name === 'disconnect') { const left = await disconnect_site(data); after_change(); return left; }
783
+ if (method === 'POST' && section === 'site' && name === 'reconnect') {
784
+ const bound = bound_site(data), service = op.service_overview(data);
785
+ if (!bound) throw panel_error('尚未绑定线上网站');
786
+ if (!service.pid) throw panel_error('请先启动共议服务,再重连中转');
787
+ request_relay_reconnect(data, bound, service.pid);
788
+ return { requested: true, site: bound.site };
789
+ }
756
790
  // Hosting: only once the owner turned it on in setup.
757
791
  if (!hosting) throw panel_error('托管管理未打开:运行 codiscuss setup 勾选“托管管理(管理面板)”');
758
792
  if (method === 'POST' && section === 'clis' && name === 'install') return op.install_runtime(data);
@@ -794,24 +828,24 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
794
828
  if (method === 'POST' && !name) { const added = await op.add_account(data, String(body.name || '').trim()); after_change(); return added; }
795
829
  account();
796
830
  if (method === 'POST' && action === 'password') return { password: op.reset_password(data, name) };
797
- if (method === 'POST' && action === 'protect') return op.protect_account(data, name, body.on !== false);
831
+ if (method === 'POST' && action === 'protect') return recovery.manage(name, action, () => op.protect_account(data, name, body.on !== false));
798
832
  if (method === 'POST' && (action === 'disable' || action === 'enable')) { op.set_account_disabled(data, name, action === 'disable'); return { disabled: action === 'disable' }; }
799
833
  // The instance stops first: its port goes to the next new account, which must not reach this one's instance.
800
- if (method === 'POST' && action === 'remove') {
834
+ if (method === 'POST' && action === 'remove') return recovery.manage(name, action, async () => {
801
835
  await op.run_instance(data, name, 'stop');
802
836
  // Its online-site binding goes first, or the owner could never unbind the computer afterwards.
803
837
  await change_external(data, name, false, { removing: true }).catch(() => {});
804
838
  op.remove_account(data, name);
805
839
  return { removed: name, kept: account_home(data, name) };
806
- }
840
+ });
807
841
  // A start is reported only once the instance serves as the account is set (protected or not).
808
- if (method === 'POST' && action === 'start') { await op.start_verified(data, name); return { ok: true }; }
809
- if (method === 'POST' && action === 'stop') { await op.run_instance(data, name, action); return { ok: true }; }
842
+ if (method === 'POST' && action === 'start') { await recovery.manage(name, action, () => op.start_verified(data, name)); return { ok: true }; }
843
+ if (method === 'POST' && action === 'stop') { await recovery.manage(name, action, () => op.run_instance(data, name, action)); return { ok: true }; }
810
844
  // Its identity file is sealed for whichever Windows user wrote it: it goes before that user changes, and is made
811
845
  // again for the new one by the next reconcile (#5660).
812
846
  // Taken down first and for real: a failure stops the change, or the new user could never open what is left (#5666).
813
847
  if (method === 'POST' && action === 'os-user') await change_external(data, name, false);
814
- if (method === 'POST' && action === 'os-user' && extra === 'remove') { op.remove_os_user(data, name); after_change(); return { ok: true }; }
848
+ if (method === 'POST' && action === 'os-user' && extra === 'remove') { set_instance_wanted(data, name, false); op.remove_os_user(data, name); after_change(); return { ok: true }; }
815
849
  if (method === 'POST' && action === 'os-user') {
816
850
  const result = op.create_os_user(data, name, account_home(data, name));
817
851
  op.use_shared_programs(data, name);
@@ -827,6 +861,7 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
827
861
  if (method === 'GET' && action === 'workflows') return op.account_workflows(service);
828
862
  // Set up again (safe to repeat): it installs the shipped workflows the account lacks and keeps the rest.
829
863
  if (method === 'POST' && action === 'workflows' && extra === 'install') { await op.prepare_account(data, name); return op.account_workflows(service); }
864
+ if (method === 'POST' && action === 'workflows' && extra === 'update') { install_workflows(service, outdated_workflows(service)); return op.account_workflows(service); }
830
865
  if (method === 'GET' && action === 'keys') return op.list_keys(service);
831
866
  if (method === 'POST' && action === 'keys' && extra === 'remove') { op.remove_key(service, String(body.ref || '')); return { ok: true }; }
832
867
  if (method === 'POST' && action === 'keys') return op.save_api_key(service, { base_url: body.base_url, api_key: body.api_key, managed: true });
@@ -882,6 +917,9 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
882
917
  });
883
918
  // The same operations without HTTP, for `codiscuss admin` run elevated (the steps that need administrator rights).
884
919
  server.api = api;
920
+ server.recover_instances = async () => {
921
+ if (hosting_enabled(data)) await Promise.all(Object.keys(read_accounts(data)).map(name => recovery.check(name)));
922
+ };
885
923
  return server;
886
924
  }
887
925
 
@@ -1445,10 +1483,14 @@ function installed_script(name) {
1445
1483
  * instances are separate processes and are left alone.
1446
1484
  */
1447
1485
  function run_owner_service(data, command) {
1448
- const child = spawn(process.execPath, [installed_script('discussion_local.mjs'), command], { stdio: 'ignore', windowsHide: true, env: { ...process.env, DISCUSS_SERVICE_HOME: data } });
1486
+ const child = spawn(process.execPath, [installed_script('discussion_local.mjs'), command], { stdio: ['ignore', 'ignore', 'pipe'], windowsHide: true, env: { ...process.env, DISCUSS_SERVICE_HOME: data } });
1487
+ // Keep the reason it prints (the last lines of stderr) so the failure says why, not just its exit code.
1488
+ let errors = '';
1489
+ child.stderr.on('data', chunk => { errors = (errors + chunk).slice(-4000); });
1449
1490
  return new Promise((done, fail) => {
1450
1491
  child.on('error', fail);
1451
- child.on('exit', code => code === 0 ? done() : fail(panel_error('codiscuss local {value1} 失败(退出码 {value2})', { value1: command, value2: code })));
1492
+ child.on('exit', code => code === 0 ? done() : fail(panel_error('{value1} {value2} 失败(退出码 {value3}):{value4}',
1493
+ { value1: 'codiscuss local', value2: command, value3: code, value4: errors.trim().split(/\r?\n/).slice(-3).join(' ') })));
1452
1494
  });
1453
1495
  }
1454
1496
 
@@ -1485,8 +1527,11 @@ function run_panel(data, port) {
1485
1527
  `, { value1: error.message })));
1486
1528
  // The entry's outside address runs on its own; the panel keeps it as set now and every minute (restarted if it stopped
1487
1529
  // or its settings changed, stopped when the entry is off).
1488
- const keep = () => keep_tunnel(data).catch(error => process.stderr.write(t(`隧道:{value1}
1530
+ const keep = () => {
1531
+ server.recover_instances().catch(error => process.stderr.write(t('托管实例巡检失败:{reason}\n', { reason: error.message })));
1532
+ keep_tunnel(data).catch(error => process.stderr.write(t(`隧道:{value1}
1489
1533
  `, { value1: error.message }))).then(() => reconcile_external(data)).catch(() => {});
1534
+ };
1490
1535
  keep();
1491
1536
  const keeper = setInterval(keep, TUNNEL_CHECK_MS);
1492
1537
  // Hosted accounts' failures reach the owner's Weixin; one pass at a time.
@@ -21,7 +21,8 @@ const SCRIPT = fileURLToPath(import.meta.url);
21
21
  const SERVER = fileURLToPath(new URL('../server.py', import.meta.url));
22
22
  const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
23
23
  const START_WAIT_MS = 15000;
24
- const STOP_WAIT_MS = 25000;
24
+ // Longer than the discussion service's own stop wait (60 s), which the supervisor waits for while exiting.
25
+ const STOP_WAIT_MS = 70000;
25
26
  const POLL_MS = 200;
26
27
  // A service that exited without `service stop` (e.g. an old one adopted during an upgrade) is restarted at most this often.
27
28
  const SERVICE_REVIVE_MS = 10_000;