teamsmith 0.4.6 → 0.4.8

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 (91) hide show
  1. package/README.md +6 -6
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +35 -0
  4. package/skills/teamsmith/SKILL.md +43 -30
  5. package/skills/teamsmith/extension/team-bg.ts +5 -3
  6. package/skills/teamsmith/extension/team-inbox-watch.ts +14 -3
  7. package/skills/teamsmith/extension/team-notify.ts +20 -13
  8. package/skills/teamsmith/extension/team-remind.ts +189 -0
  9. package/skills/teamsmith/extension/team-reply.ts +4 -7
  10. package/skills/teamsmith/references/config.md +11 -12
  11. package/skills/teamsmith/references/migration.md +101 -0
  12. package/skills/teamsmith/references/openspec.md +43 -27
  13. package/skills/teamsmith/references/protocol.md +26 -15
  14. package/skills/teamsmith/references/reminders.md +153 -161
  15. package/skills/teamsmith/references/troubleshooting.md +12 -7
  16. package/skills/teamsmith/references/workflows.md +84 -31
  17. package/skills/teamsmith/scripts/lib/cmd-agents.sh +10 -4
  18. package/skills/teamsmith/scripts/lib/cmd-project.sh +88 -6
  19. package/skills/teamsmith/scripts/lib/cmd-remind.sh +88 -2
  20. package/skills/teamsmith/scripts/lib/cmd-review.sh +61 -35
  21. package/skills/teamsmith/scripts/lib/cmd-watch.sh +48 -11
  22. package/skills/teamsmith/scripts/lib/common.sh +83 -13
  23. package/skills/teamsmith/scripts/panel/README.md +35 -33
  24. package/skills/teamsmith/scripts/panel/panel.js +217 -199
  25. package/skills/teamsmith/scripts/panel/src/App.tsx +221 -66
  26. package/skills/teamsmith/scripts/panel/src/data.ts +71 -15
  27. package/skills/teamsmith/scripts/panel/src/layout.ts +159 -310
  28. package/skills/teamsmith/scripts/panel/src/main.tsx +83 -21
  29. package/skills/teamsmith/scripts/panel/src/project-settings.ts +46 -0
  30. package/skills/teamsmith/scripts/panel/src/strings/en.ts +71 -205
  31. package/skills/teamsmith/scripts/panel/src/strings/index.ts +3 -5
  32. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +72 -204
  33. package/skills/teamsmith/scripts/panel/src/types.ts +23 -4
  34. package/skills/teamsmith/scripts/remind-capability.mjs +261 -0
  35. package/skills/teamsmith/scripts/remind-store.mjs +55 -24
  36. package/skills/teamsmith/scripts/remind-tick.mjs +5 -2
  37. package/skills/teamsmith/scripts/reply-capture.mjs +8 -9
  38. package/skills/teamsmith/scripts/state-authority.mjs +72 -6
  39. package/skills/teamsmith/scripts/strings/commands.tsv +1 -1
  40. package/skills/teamsmith/scripts/team +1 -0
  41. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +18 -8
  42. package/skills/teamsmith/templates/DECISIONS.md.tmpl +2 -2
  43. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +3 -3
  44. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +19 -14
  45. package/skills/teamsmith/templates/memory-seed.md.tmpl +2 -2
  46. package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -25
  47. package/skills/teamsmith/templates/report.md.tmpl +33 -0
  48. package/skills/teamsmith/tests/bg-ledger-harness.mjs +217 -33
  49. package/skills/teamsmith/tests/bg-ledger.sh +24 -10
  50. package/skills/teamsmith/tests/checkout-shape-probe.sh +7 -6
  51. package/skills/teamsmith/tests/fixtures/remind-adversarial-delay.ts +27 -0
  52. package/skills/teamsmith/tests/fixtures/remind-tool-provider.ts +65 -0
  53. package/skills/teamsmith/tests/help-surface.sh +78 -12
  54. package/skills/teamsmith/tests/install-shape.sh +7 -7
  55. package/skills/teamsmith/tests/isolation-ledger.sh +6 -2
  56. package/skills/teamsmith/tests/key-replies-ui.sh +64 -5
  57. package/skills/teamsmith/tests/key-replies.sh +307 -106
  58. package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +2 -0
  59. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +255 -90
  60. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +181 -61
  61. package/skills/teamsmith/tests/lib/model-routing-roles.sh +125 -67
  62. package/skills/teamsmith/tests/lib/reply-fixture.sh +14 -9
  63. package/skills/teamsmith/tests/lib/routes-pages.sh +243 -0
  64. package/skills/teamsmith/tests/lib/tmp-root.sh +1 -1
  65. package/skills/teamsmith/tests/loop-inventory.tsv +3 -0
  66. package/skills/teamsmith/tests/panel-b2.sh +91 -31
  67. package/skills/teamsmith/tests/panel-b3-stub.sh +9 -2
  68. package/skills/teamsmith/tests/panel-p21.sh +607 -1162
  69. package/skills/teamsmith/tests/panel-strings.mjs +21 -113
  70. package/skills/teamsmith/tests/remind-adversarial-faults.mjs +190 -0
  71. package/skills/teamsmith/tests/remind-adversarial-faults.sh +78 -0
  72. package/skills/teamsmith/tests/remind-adversarial-real.sh +28 -0
  73. package/skills/teamsmith/tests/remind-cli.sh +108 -3
  74. package/skills/teamsmith/tests/remind-delivery-node.mjs +13 -0
  75. package/skills/teamsmith/tests/remind-delivery.sh +123 -35
  76. package/skills/teamsmith/tests/remind-lifecycle.sh +197 -0
  77. package/skills/teamsmith/tests/remind-pulse.sh +199 -0
  78. package/skills/teamsmith/tests/remind-recovery-real.sh +5 -0
  79. package/skills/teamsmith/tests/remind-recovery-unit.sh +118 -0
  80. package/skills/teamsmith/tests/remind-tool-node.mjs +159 -0
  81. package/skills/teamsmith/tests/remind-tool-real.mjs +801 -0
  82. package/skills/teamsmith/tests/remind-tool-real.sh +180 -0
  83. package/skills/teamsmith/tests/reply-capture-real.mjs +93 -2
  84. package/skills/teamsmith/tests/routes.sh +213 -293
  85. package/skills/teamsmith/tests/section-paths.tsv +19 -17
  86. package/skills/teamsmith/tests/smoke.sh +583 -133
  87. package/skills/teamsmith/tests/state-authority.sh +152 -8
  88. package/skills/teamsmith/tests/task-model-routing.sh +57 -26
  89. package/skills/teamsmith/tests/tmp-hygiene.sh +1 -1
  90. package/skills/teamsmith-init/SKILL.md +5 -5
  91. package/skills/teamsmith/tests/fixtures/delivery-truth-real/__pycache__/judge-second.cpython-313.pyc +0 -0
@@ -176,75 +176,73 @@ export const zh = {
176
176
  prefProjectSettings: '项目设置',
177
177
  prefNavArrow: '›',
178
178
  settingsViewTitle: '项目设置',
179
- // P30/D2:分组按 schema 行的第 10 列(`group_<token>`),不再是类分组——三个类分组标签已删。
180
- group_identity: '身份与账本布局',
181
- group_branch: '分支与 forge',
182
- group_policy: '权限与依赖',
183
- group_roster: '名册、模型解析与适配器',
184
- 'group_task-model': '任务类别与 PM 模型',
185
- group_workflow: '工作流与门禁',
186
- group_delivery: '容量与投递通知',
187
- group_panel: '巡检与面板',
188
- group_patrol: '巡检',
189
- 'group_pm-lifecycle': 'PM 生命周期',
190
- group_session: '活着的会话',
191
- group_meeting: '跨项目会议',
192
- settingsGroupUngrouped: '未分组',
193
- settingsGroupCategories: '下一次派任务会用的模型',
194
- settingsGroupAssignments: '正在运行的任务实际使用的模型',
195
- settingsBadgeApply: '立即生效',
196
- settingsBadgeRestart: '需重启',
197
- settingsBadgeRefuse: '不可改',
198
- settingsUnknownBadge: '不认识',
199
- settingsUnset: '未设 · 默认 {value}',
200
- settingsKeyHint: '↑/↓ 行 · Enter 编辑 · / 筛选 · Esc 返回',
179
+ settingsChecks: '自动检查',
180
+ settingsCommands: '项目命令',
181
+ settingsRecords: '模型记录',
182
+ settingsNewTasks: '新任务生效',
183
+ settingsAfterPmRestart: '重新启动PM后生效',
184
+ settingsAfterPulseRestart: '重新启动Pulse后生效',
185
+ settingsNoRecovery: '不自动恢复',
186
+ settingsUnfilled: '未填写',
187
+ settingsEntries: '{n}项',
188
+ settingsRuleModel: '适用模型',
189
+ settingsRuleCount: '同时运行数量',
190
+ settingsRuleUnlimited: '此项不限制',
191
+ settingsRuleAdd: '添加限制',
192
+ settingsRuleDelete: '删除限制',
193
+ settingsRuleEdit: '编辑限制',
194
+ settingsSave: '保存',
195
+ settingsRuleOther: '其它适用模型',
196
+ settingsRuleCountInvalid: '请输入非负整数',
197
+ settingsOld: '原值',
198
+ settingsNew: '新值',
199
+ settingsFieldHint: 'Enter 完成 · Esc 返回',
200
+ settingsConfirmHint: 'Enter 保存 · Esc 取消',
201
+ settingsEditHint: 'Enter 继续 · Esc 取消',
202
+ settingsSeconds: '秒',
203
+ settingsSecondsEditHint: '输入秒数 · Enter 继续 · Esc 取消',
204
+ keySettingsBack: 'Esc 返回',
205
+ settingsKeepEmpty: '保持未设置',
206
+ settingsRecordTask: '任务',
207
+ settingsRecordCategory: '类别',
208
+ settingsRecordModel: '模型',
209
+ settingsRecordSid: '会话编号',
210
+ settingsRecordSelected: '模型选择来源',
211
+ settingsRecordLaunch: '本次启动方式',
212
+ settingsRecordTime: '时间',
213
+ settingsRecordWindow: '窗口',
214
+ settingsRecordMode: '启动方式',
215
+ settingsGroupCategories: '模型',
201
216
  keyFilter: '/ 筛选',
202
217
  settingFilterTitle: '筛选设置',
203
- settingConfirm: '确认:{key} {old} → {next} · {timing}(再按 Enter 写入)',
204
- settingTimingApply: '下一个读取它的进程生效',
205
- settingTimingRestart: '需要重启才生效',
206
- settingDanger: '危险:{reason}(再按一次 Enter 确认)',
207
- settingRejected: '✗ 被拒:{line}',
208
- settingWritten: '✓ 已写入 {key} = {value} · {timing}',
209
- settingRefused: '✗ 这个值要在项目配置文件里改:{line}',
210
- settingInvalid: '✗ 值不合法:{line}',
211
- settingConflict: '! 契约在编辑器打开后变过(指纹不符)—— 什么都没写;已重读',
212
- settingWriteError: '✗ 写入失败(原文件未动):{line}',
213
- settingsRefusedRoute: '这个值要改项目配置文件 .pi/team/config.sh,界面不能改',
214
- settingsCategoryHint: '类别 {category}:team config set-task-model {category} <model> —— 只影响以后派的新任务;已经派出去的任务继续用它当时的模型(这一行不组合映射)',
215
- settingsCategoryRow: '类别 {category}',
216
- settingsCategoryModel: '模型 {model}',
217
- settingsCategoryBadge: '新任务',
218
- settingsCategoryPickerTitle: '选择类别 {category} 的模型',
219
- settingsCategoryPickerHint: '↑/↓ 选择 · Enter 直接写入该值 ·「自由输入」才进编辑器 · Esc 返回(只影响以后派的新任务;已经派出去的任务继续用它当时的模型,没有进程被重启)',
220
- settingsCategoryMapHint: '类别块就是这一行的编辑器(命令:team config set-task-model <category> <model>)—— 映射在面板里绝不被组合',
221
- settingsCategoryMapEmpty: '类别块就是这一行的编辑器(命令:team config set-task-model <category> <model>)—— 当前映射为空,先用 CLI 添加一个类别',
222
- settingsAssignmentHint: '任务派出去以后就固定用它当时的模型,不跟着上面的设置变',
223
- settingsAssignmentNote: '任务 {task} · 类别 {category} · 会话 {sid} · 来源 {selected}/{launch}',
224
- settingsAssignmentNone: '这个席位还没有派过任务',
225
- settingsAssignmentUnreadable: '这个席位派过任务,但它的记录读不出来,面板不显示它在用的模型',
226
- settingsReadOnlyBadge: '不可改',
227
- settingsPmLaunchLabel: 'PM 上次启动',
228
- settingsPmLaunchNote: '窗口 {window} · {mode} · {time}',
229
- settingsPmLaunchHint: 'PM 上一次启动时用的模型,这里不能改',
230
- settingsDiagnosisHeading: '旧设置需要升级',
231
- settingsCliHint: '命令行:team config set {key} <新值>',
232
- settingsRefusedHint: '这个值要改项目配置文件 .pi/team/config.sh,界面不能改',
233
- settingsUnknownHint: '{key}:这个设置在文件里,工具不认识它,面板不能改',
234
- settingsChoiceTitle: '选择 {label} 的值 · {key}',
235
- settingsChoiceHint: '↑/↓ 选择 · Enter 直接写入该值(危险值再按一次确认)· 「自由输入」才进编辑器 · Esc 返回',
218
+ settingConfirm: '{key}\n原值 {old}\n新值 {next}\n{timing}',
219
+ settingDanger: '危险:{reason} · Enter 确认',
220
+ settingWritten: '已保存{key} · {timing}',
221
+ settingRefused: '无法编辑:{line}',
222
+ settingInvalid: '数值无效:{line}',
223
+ settingConflict: '设置已被修改,未保存',
224
+ settingWriteError: '保存失败:{line}',
225
+ settingsRefusedRoute: '请修改 .pi/team/config.sh',
226
+ settingsCategoryRow: '{category}',
227
+ settingsCategoryPickerHint: '新任务生效',
228
+ settingsAssignmentNone: '尚无派单记录',
229
+ settingsAssignmentUnreadable: '记录读取失败',
230
+ settingsPmLaunchLabel: 'PM上次启动',
231
+ settingsDiagnosisHeading: '配置需要更新',
232
+ settingsLaunchFresh: '全新启动',
233
+ settingsLaunchContinued: '延续上次会话',
234
+ settingsChoiceHint: '↑/↓ 选择 · Enter 保存 · Esc 取消',
236
235
  settingsChoiceCurrent: '当前',
237
236
  settingsChoiceDefault: '默认',
238
- settingsChoiceKeepUnset: '保持未设(取消,什么都不写)',
239
- settingsChoiceClear: '清空(写入空值)',
240
- settingsChoiceFree: '…(自由输入)',
241
- settingsChoiceInterval: '接受区间 {min}–{max}(空 = 无界)',
242
- settingsChoiceNoChoice: '{kind} 这种 kind 没有选项集;写入仍由命令校验(Enter 打开自由输入)',
243
- settingCategoryConfirm: '确认类别 {category}:{old} → {next} · 只影响以后派的新任务;已经派出去的任务继续用它当时的模型(再按 Enter 写入)',
244
- settingCategoryWritten: '✓ 已写入类别 {category} = {value} · 只影响以后派的新任务;已经派出去的任务继续用它当时的模型;没有重启任何进程',
245
- settingPmWritten: '✓ 已写入 PM 模型 = {value} · 换模型要用 team up --fresh-pm 重开一场对话;没有重启任何进程',
246
- settingsBoolOn: '开(1)',
247
- settingsBoolOff: '关(0)',
237
+ settingsChoiceKeepUnset: '保持默认值',
238
+ settingsChoiceClear: '清空',
239
+ settingsChoiceFree: '输入其它值',
240
+ settingsChoiceInterval: '{min}–{max}',
241
+ settingCategoryConfirm: '{category}\n原值 {old}\n新值 {next}\n新任务生效',
242
+ settingCategoryWritten: '已保存{category}模型 · 新任务生效',
243
+ settingPmWritten: '已保存PM模型 · 重新启动PM后生效 · team up --fresh-pm',
244
+ settingsBoolOn: '开',
245
+ settingsBoolOff: '关',
248
246
  settingsPathExists: '存在',
249
247
  settingsPathMissing: '不存在',
250
248
  settingsPathNotExec: '不是可执行文件',
@@ -252,147 +250,17 @@ export const zh = {
252
250
  seatSourceExplicit: '派单时指定',
253
251
  seatSourcePolicy: '按类别设置',
254
252
  seatSourceAssignment: '沿用原记录',
253
+ seatSourceRecord: '按派单记录',
255
254
 
256
- // 契约键的人话标签(M49):`lib/cmd-config.sh` 的 schema 每个键一条,行的主文本用它,
257
- // 裸 TEAM_* 只留在与 CLI 对齐的地方(编辑器标题、确认行、视图底部的命令行提示)。
258
- // schema 不认识的键没有标签 → 回退显示原始键(`keyLabel()`)。完整性由
259
- // tests/panel-strings.mjs 断言(schema ↔ 两张表,两个方向都查)。顺序与 schema 一致。
260
- // —— 身份与账本布局(只读)
261
- label_TEAM_PROJECT: '项目名',
262
- label_TEAM_SESSION: '会话名',
263
- label_TEAM_PM_WINDOW: 'PM 窗口',
264
- label_TEAM_AGENTS: '名册',
265
- label_TEAM_DOCS_DIR: '账本目录',
266
- label_TEAM_WORKTREES_DIR: '工作树目录',
267
- label_TEAM_STATE_DIR: '状态目录',
268
- label_TEAM_MEETINGS_DIR: '会议目录',
269
- label_TEAM_SPEC_DIR: '规格目录',
270
- label_TEAM_ROOT: '项目根',
271
- label_TEAM_MAIN_ROOT: '主检出根',
272
- label_TEAM_TMP_ROOT: '临时根目录',
273
- label_TEAM_CONFIG_FILE: '契约文件',
274
- // —— 分支与托管平台(只读)
275
- label_TEAM_BRANCH_MODE: '分支命名模式',
276
- label_TEAM_TASK_BRANCH_PREFIX: '任务分支前缀',
277
- label_TEAM_AGENT_BRANCH_PREFIX: '席位分支前缀',
278
- label_TEAM_PROTECTED_BRANCH: '保护分支',
279
- label_TEAM_REMOTE: '远端',
280
- label_TEAM_VCS: '托管平台',
281
- label_TEAM_TOKEN_FILE: '凭据文件',
282
- label_TEAM_GITLAB_HOST: 'GitLab 主机',
283
- label_TEAM_GITLAB_PROJECT: 'GitLab 项目',
284
- label_TEAM_GITLAB_TOKEN_FILE: 'GitLab 凭据文件',
285
- label_TEAM_MERGE_PREFER_THEIRS: '冲突默认取分支侧',
286
- // —— 权限与依赖(不可改)
287
- label_TEAM_CONFIRM_WRITES: '写入前确认',
288
- label_TEAM_ALLOW_FOREIGN_IDENTITY: '放行外部身份',
289
- label_TEAM_ALLOW_FOREIGN_SESSION: '放行外部会话',
290
- label_TEAM_GUARD_FOREIGN_TARGET: '拦截外部目标',
291
- label_TEAM_REPLACE_FOREIGN_PM: '可替换外部 PM',
292
- label_TEAM_ALLOW_DESTRUCTIVE_TMUX: '放行破坏性操作',
293
- label_TEAM_ASSUME_YES: '默认全部确认',
294
- label_TEAM_REQUIRE_JS: '必需 JS 运行时',
295
- label_TEAM_REQUIRE_OPENSPEC: '必需 OpenSpec',
296
- label_TEAM_REQUIRE_MAGIC_CONTEXT: '必需 Magic Context',
297
- label_TEAM_PI_AGENT_DIR: 'Pi 配置目录',
298
- label_TEAM_PI_SETTINGS_FILE: 'Pi 设置文件',
299
- label_TEAM_MEMINFO_FILE: '内存信息文件',
300
- label_TEAM_DISK_STATS_FILE: '磁盘读数夹具',
301
- label_TEAM_SMOKE_FAST: '冒烟快模式',
302
- // —— 名册、模型解析与适配器
303
- label_TEAM_MODEL_LIMITS: '模型并发上限',
304
- label_TEAM_MODEL_WINDOWS: '显式上下文窗口',
305
- label_TEAM_SESSION_WARN_TOKENS: '上下文告警阈值',
306
- label_TEAM_EXTRA_PI_ARGS: '席位附加参数',
307
- label_TEAM_AGENT_CMD: '席位启动命令',
308
- label_TEAM_AGENT_NOTIFY_CMD: '收工通知命令',
309
- label_TEAM_AGENT_LOG_GLOB: '席位日志路径',
310
- label_TEAM_PI_BIN: 'pi 可执行文件',
311
- label_TEAM_AGENT_BIN: '席位可执行文件',
312
- label_TEAM_OPENSPEC_BIN: 'openspec 可执行文件',
313
- label_TEAM_JS_BIN: 'JS 运行时',
314
- // —— 任务类别与 PM 模型(apply/restart)
315
- label_TEAM_TASK_MODELS: '任务类别模型',
316
- label_TEAM_PM_MODEL: 'PM 模型',
317
- label_TEAM_CONFIG_VERSION: '配置形状号',
318
- // —— 工作流与门禁
319
- label_TEAM_UPDATE_CHECK: '启动时提示新版本',
320
- label_TEAM_GATES: '门禁命令',
255
+ // Labels only for selected settings; the complete CLI schema is unchanged.
256
+ label_TEAM_MODEL_LIMITS: '模型同时运行任务数',
257
+ label_TEAM_PM_MODEL: 'PM模型',
258
+ label_TEAM_UPDATE_CHECK: '启动时检查新版本',
259
+ label_TEAM_GATES: '验收命令',
321
260
  label_TEAM_INSTALL_CMD: '安装命令',
322
- label_TEAM_TASK_BRANCH_RESET: '派单时重置分支',
323
- label_TEAM_DISPATCH_VERIFY_SEC: '派单检查等待',
324
- label_TEAM_DISPATCH_ALIVE_SEC: '存活判定等待',
325
- label_TEAM_SQUASH_LOOKBACK: 'squash 回看条数',
326
- label_TEAM_REVIEW_TIMEOUT: '复验超时',
327
- label_TEAM_REVIEW_TIMEOUT_GRACE: '超时宽限',
328
- label_TEAM_REVIEW_ALLOW_DIRTY: '复验放行脏工作树',
329
- label_TEAM_REVIEW_ALLOW_IGNORED: '复验放行忽略文件',
330
- label_TEAM_REVIEW_ALLOW_UNRESOLVED_BRANCH: '放行未解析分支',
331
- label_TEAM_REVIEW_ANY_DIR: '复验跳过目录校验',
332
- label_TEAM_BOARD_DONE_FORCE: '强制标记 done',
333
- label_TEAM_BOARD_DONE_REASON: '强制放行理由',
334
- // —— 容量与投递
335
- label_TEAM_MIN_FREE_SWAP_MB: 'swap 底线',
336
- label_TEAM_MIN_TOTAL_MB: '内存硬底线',
337
- label_TEAM_MIN_AVAIL_MB: '可用内存底线',
338
- label_TEAM_TMP_MIN_FREE_MB: '临时根空间底线',
339
- label_TEAM_TMP_MIN_FREE_INODES: '临时根 inode 底线',
340
- label_TEAM_WARN_AVAIL_MB: '可用内存告警线',
341
- label_TEAM_ZRAM_WARN_PCT: 'zram 告警比例',
342
- label_TEAM_AGENT_MEM_MB: '席位内存上限',
343
- label_TEAM_NOTIFY_TMUX: '走 tmux 投递',
344
- label_TEAM_NOTIFY_DEDUP_SEC: '通知去重窗口',
345
- label_TEAM_INBOX_MAX_CHARS: '预览字数',
346
- label_TEAM_NOTIFY_LOG: '通知调试日志',
347
- label_TEAM_NOTIFY_DETAIL_MAX: '通知明细条数上限',
348
- label_TEAM_DEFER_TTL: '排队过期时间',
349
- label_TEAM_OUTBOX_MAX: '发件箱条数上限',
350
- label_TEAM_PANEL_DETAIL_CAP: '详情文件读取上限',
351
- label_TEAM_ORPHAN_WARN_MB: '孤儿内存提示阈值',
352
- label_TEAM_ORPHAN_SCAN: '扫描孤儿席位进程',
353
- label_TEAM_ORPHAN_PROC_ROOT: '普查 /proc 接缝',
354
- // —— 巡检与面板(需重启)
355
- label_TEAM_PULSE_INTERVAL: '巡检周期',
356
- label_TEAM_MONITOR_REFRESH: '面板刷新周期',
357
- label_TEAM_MONITOR_EVENTS: '事件初始条数',
358
- label_TEAM_MONITOR_UI: '面板渲染器',
359
- label_TEAM_MONITOR_ACTIVITY: '活动列',
360
- label_TEAM_AGENT_LOG_TAIL_BYTES: '日志尾部读取上限',
361
- label_TEAM_PULSE_WINDOW: '巡检窗口名',
362
- // —— 巡检策略
363
- label_TEAM_PULSE_NUDGE_GAP: '重复提醒间隔',
364
- label_TEAM_PULSE_PENDING_BOARD: '看板待办也唤醒',
365
- label_TEAM_PULSE_REBUILD_TMUX: '自愈重建 server',
366
- label_TEAM_PULSE_MAX_RESTARTS: '自动拉起次数上限',
367
- // —— PM 生命周期(需重启)
368
- label_TEAM_PM_SESSION_ID: 'PM 会话 ID',
369
- label_TEAM_PM_CMD: 'PM 启动命令',
370
- label_TEAM_PM_BIN: 'PM 可执行文件',
371
- label_TEAM_PM_EXTRA_PI_ARGS: 'PM 附加参数',
372
- label_TEAM_PM_RESUME_ARGS: 'PM 续跑参数',
373
- label_TEAM_PM_START_WAIT: 'PM 启动等待',
374
- // —— 活着的会话(需重启)
375
- label_TEAM_INBOX_WATCH_MAX_BYTES: 'watcher 读取上限',
376
- label_TEAM_INBOX_WATCH_PREVIEW: '预览行数',
377
- label_TEAM_INBOX_WATCH_REPLAY_MAX: '重放条数上限',
378
- label_TEAM_INBOX_WATCH_SEEN_MAX: '已见记录上限',
379
- label_TEAM_INBOX_WATCH_STALE: '过期判定秒数',
380
- label_TEAM_INBOX_WATCH_STALE_SEC: '唤醒行新鲜度',
381
- label_TEAM_INBOX_WATCH_FORCE_FAIL: '强制注册失败(测试)',
382
- label_TEAM_IW_REQUIRE_WATCH: '门禁严格模式(测试)',
383
- label_TEAM_INBOX_WATCH_POLL_MS: '轮询间隔',
384
- label_TEAM_INBOX_WATCH_HEARTBEAT_MS: '心跳间隔',
385
- label_TEAM_INBOX_WATCH_TARGET: '投递目标',
386
- label_TEAM_BG_LOG_MAX_BYTES: '后台日志上限',
387
- // —— 信号纪律(P159)
388
- label_TEAM_SIGNAL_CALLS_LOG: '信号调用审计',
389
- label_TEAM_SIGNAL_REAL: '信号真身',
390
- label_TEAM_BG_STOP_GRACE: '作业停止宽限',
391
- // —— 跨项目会议
392
- label_TEAM_MEETING_TTL_HOURS: '会议有效期',
393
- label_TEAM_MEETING_MAX_TURNS: '会议轮次上限',
394
- label_TEAM_MEETING_KNOCK: '允许敲门',
395
- label_TEAM_MEETING_ALLOW_USER_ID: '可敲门用户',
261
+ label_TEAM_REVIEW_TIMEOUT: '验收最长时间',
262
+ label_TEAM_PULSE_INTERVAL: '检查间隔',
263
+ label_TEAM_PULSE_MAX_RESTARTS: 'PM每小时自动恢复次数',
396
264
 
397
265
  // 关键回复(pulse-key-replies)
398
266
  replyHeading: '关键回复',
@@ -314,15 +314,15 @@ export interface SettingsKey {
314
314
  route?: string
315
315
  /**
316
316
  * The key's schema-derived choice set (M55), verbatim from `team config list --json`. The
317
- * console reads its options from here and from nowhere else: a key or a value added to the
318
- * command's schema appears without rebuilding the bundle. Absent against an older command.
317
+ * console reads its selected operations' options from here: a choice added to a retained key
318
+ * appears without rebuilding the bundle. Absent against an older command.
319
319
  */
320
320
  choices?: SettingsChoices
321
321
  /**
322
322
  * The key's functional domain (P30): the schema row's tenth column, verbatim from `team config
323
323
  * list --json` ('' for a key the schema does not know, and for a schema row that declares none).
324
- * The view's headings are looked up by this token (`group_<token>`); the bundle keeps no
325
- * key→group table. Absent against an older command.
324
+ * Retained as complete CLI metadata; console purpose headings do not use it.
325
+ * Absent against an older command.
326
326
  */
327
327
  group?: string
328
328
  /** False for a key in the file the schema does not know (read-only row). */
@@ -345,6 +345,16 @@ export interface SettingsChoices {
345
345
  note: string
346
346
  }
347
347
 
348
+ export type SettingsPage = 'main' | 'commands' | 'records' | 'limits' | 'rule'
349
+ export interface LimitsDraft {
350
+ original: string
351
+ tokens: string[]
352
+ changed: boolean
353
+ rule: number
354
+ target: { row: number; key: string; value: string; cls: string; fingerprint: string; kind?: string; choices?: SettingsKey['choices'] }
355
+ confirm?: { danger: boolean }
356
+ }
357
+
348
358
  /** One drawn entry of the choice picker (M55). */
349
359
  export interface SettingsChoiceEntry {
350
360
  /** The value the entry carries ('' for keep-unset/clear/free). */
@@ -377,6 +387,9 @@ export interface SettingsChoicePicker {
377
387
  * the accept writes `team config set-task-model <category> <model>` — never a pair list.
378
388
  */
379
389
  category?: boolean
390
+ ruleField?: boolean
391
+ /** Opening read, not a later background refresh. */
392
+ target?: { row: number; key: string; value: string; cls: string; fingerprint: string; category?: string; kind?: string; choices?: SettingsKey['choices'] }
380
393
  }
381
394
 
382
395
  /** One future task-category policy row as `team config list --json` reports it (P232). */
@@ -729,6 +742,7 @@ export interface DetailWindow {
729
742
 
730
743
  /** The project-settings view's row window as the frame rendered it (P22/B2). */
731
744
  export interface SettingsWindow {
745
+ width?: number
732
746
  /** The focused focusable row (an index into the filtered row list). */
733
747
  focus: number
734
748
  /** The first drawn focusable row. */
@@ -821,7 +835,12 @@ export interface ViewState {
821
835
  detailScroll?: number
822
836
  /** True while the project-settings view replaces the page's blocks (P22/B2). */
823
837
  settings?: boolean
838
+ /** The setting/filter editor supplies its own current-key hint instead of the view's key band. */
839
+ settingsEditing?: boolean
824
840
  /** The focused row in the filtered project-settings row list. */
841
+ settingsPage?: SettingsPage
842
+ limitsDraft?: LimitsDraft | null
843
+ settingsDetails?: string[] | null
825
844
  settingsFocus?: number
826
845
  /** The filter text (`''` = no filter). */
827
846
  settingsFilter?: string
@@ -0,0 +1,261 @@
1
+ // PM-only Reminder tool identity, authority invocation and live capability evidence (P442).
2
+ // Reminder data itself stays in state-authority.mjs: this file never reads or writes reminders/state.json.
3
+ // Invalid identities fail before runReminderAuthority is called. The separate evidence file is only a
4
+ // freshness-bounded report from this extension instance; it is not proof of model visibility or tool use.
5
+ import { closeSync, constants as C, fstatSync, fsyncSync, lstatSync, openSync, readFileSync, realpathSync, renameSync, unlinkSync, writeFileSync } from 'node:fs'
6
+ import { spawn, spawnSync } from 'node:child_process'
7
+ import { createHash, randomUUID } from 'node:crypto'
8
+ import { join } from 'node:path'
9
+ import { isDeepStrictEqual } from 'node:util'
10
+ import { ancestor, processIdentity, proofPid, readRegular, resolvePMIdentity, safeDirectory, tmuxEvidence } from './reply-capture.mjs'
11
+
12
+ export const REMIND_CAPABILITY_TTL_MS = 20000
13
+ export const remindCapabilitySourceFiles = ['extension/team-remind.ts', 'scripts/remind-capability.mjs', 'scripts/reply-capture.mjs', 'scripts/replies.mjs']
14
+ const digest = value => createHash('sha256').update(value).digest('hex')
15
+ export const remindCapabilityFingerprint = hashes => digest(JSON.stringify(remindCapabilitySourceFiles.map(file => [file, hashes[file]])))
16
+ export function remindCapabilityDiskFingerprint(skill) {
17
+ const hashes = Object.fromEntries(remindCapabilitySourceFiles.map(file => [file, digest(readFileSync(join(skill, file)))]))
18
+ return remindCapabilityFingerprint(hashes)
19
+ }
20
+
21
+ function regular(path, flags, mode = 0o600) {
22
+ const fd = openSync(path, flags | C.O_NOFOLLOW | C.O_NONBLOCK, mode)
23
+ const st = fstatSync(fd)
24
+ const unsafe = !st.isFile() ? 'is not a regular file' : st.uid !== process.getuid() ? 'is not owned by this process' : ''
25
+ if (unsafe) { closeSync(fd); throw new Error(`unsafe regular file: ${path} ${unsafe}`) }
26
+ return fd
27
+ }
28
+
29
+ export function configValue(text, key) {
30
+ const match = new RegExp(`^\\s*(?:export\\s+)?${key}=(.*)\\s*$`, 'm').exec(text)
31
+ if (!match) return null
32
+ const raw = match[1].trim()
33
+ const quoted = /^(["'])(.*)\1(?:[ \t]+#.*)?$/.exec(raw)
34
+ if (quoted) return quoted[2]
35
+ return raw.replace(/[ \t]+#.*$/, '').trimEnd()
36
+ }
37
+
38
+ function verifyConfiguration(identity) {
39
+ const text = readRegular(identity.config)
40
+ for (const [key, expected] of [['TEAM_SESSION', identity.tmux.session], ['TEAM_PM_WINDOW', identity.tmux.window]]) {
41
+ const actual = configValue(text, key)
42
+ if (actual !== expected) throw new Error(`PM config ${key} does not match the directed launch`)
43
+ }
44
+ for (const key of ['TEAM_PM_CMD', 'TEAM_PM_BIN']) {
45
+ const value = configValue(text, key)
46
+ if (value !== null && value !== '') throw new Error(`custom PM adapter has no team_remind contract (${key})`)
47
+ }
48
+ }
49
+
50
+ function launchRecord(identity, required = false) {
51
+ const path = join(identity.state, 'pm-launch.env')
52
+ let text
53
+ try { text = readRegular(path) } catch (e) {
54
+ if (e.code === 'ENOENT' && !required) return { nonce: null, time: null }
55
+ throw e
56
+ }
57
+ const record = {}
58
+ for (const line of text.split('\n')) {
59
+ if (!line) continue
60
+ const match = /^([a-z_]+)=(.*)$/.exec(line)
61
+ if (!match || Object.hasOwn(record, match[1])) throw new Error('invalid PM launch record')
62
+ record[match[1]] = match[2]
63
+ }
64
+ if (record.metadata_version !== '1' || record.project !== identity.root || record.window !== identity.tmux.window ||
65
+ !/^[A-Za-z0-9._-]+$/.test(record.nonce ?? '') || !Number.isFinite(Date.parse(record.time)) ||
66
+ !['fresh', 'continued'].includes(record.mode) || typeof record.resume_key !== 'string' || !record.resume_key) {
67
+ throw new Error('PM launch record does not belong to this project/window or is unreadable')
68
+ }
69
+ // The record is published after Pi starts. It cannot predate this process by more than the same
70
+ // one-second floor used by the PM spawn proof; an older record belongs to an earlier PM launch.
71
+ const stat = readFileSync(`/proc/${identity.pid}/stat`, 'utf8')
72
+ const fields = stat.slice(stat.lastIndexOf(')') + 2).trim().split(/\s+/)
73
+ const btime = /^btime (\d+)$/m.exec(readFileSync('/proc/stat', 'utf8'))?.[1]
74
+ const ticksResult = spawnSync('getconf', ['CLK_TCK'], { encoding: 'utf8' })
75
+ if (ticksResult.error || ticksResult.status !== 0) throw new Error('process clock evidence unavailable')
76
+ const started = (Number(btime) + Number(fields[19]) / Number(ticksResult.stdout.trim())) * 1000
77
+ if (lstatSync(path).mtimeMs + 1000 < started) throw new Error('PM launch record predates this process')
78
+ return { nonce: record.nonce, time: record.time }
79
+ }
80
+
81
+ /** Current directed PM proof plus the late-published launch nonce (which may be absent at session_start). */
82
+ export function resolveRemindIdentity(context, env = process.env, { requireLaunch = false, checkConfiguration = true } = {}) {
83
+ const identity = resolvePMIdentity(context, env)
84
+ if (checkConfiguration) verifyConfiguration(identity)
85
+ const launch = launchRecord(identity, requireLaunch)
86
+ return { ...identity, launchNonce: launch.nonce, launchTime: launch.time }
87
+ }
88
+
89
+ export function sameRemindIdentity(a, b) {
90
+ return isDeepStrictEqual(
91
+ [a.root, a.state, a.config, a.sessionId, a.sessionFile, a.pid, a.starttime, a.tmux, a.launchNonce],
92
+ [b.root, b.state, b.config, b.sessionId, b.sessionFile, b.pid, b.starttime, b.tmux, b.launchNonce],
93
+ )
94
+ }
95
+
96
+ function currentLaunchProof(identity) {
97
+ if (proofPid(join(identity.state, 'pm.pid.spawn'), identity.pid, identity.root)) return true
98
+ return proofPid(join(identity.state, 'pm.pid'), identity.pid, identity.root) &&
99
+ /^(argv|spawn)$/.test(readRegular(join(identity.state, 'pm.pid.proof')).trim())
100
+ }
101
+
102
+ /** Fixed-lock atomic evidence update. A delayed shutdown may remove only its own generation. */
103
+ export function updateRemindCapability(identity, change, { create = true } = {}) {
104
+ safeDirectory(identity.root)
105
+ safeDirectory(identity.state)
106
+ const directory = join(identity.state, 'remind-tool')
107
+ safeDirectory(directory, create)
108
+ const dir = openSync(directory, C.O_RDONLY | C.O_DIRECTORY | C.O_NOFOLLOW)
109
+ const expected = fstatSync(dir)
110
+ const at = name => `/proc/self/fd/${dir}/${name}`
111
+ let lock, temp
112
+ try {
113
+ lock = regular(at('capability.lock'), C.O_RDWR | C.O_CREAT)
114
+ const held = spawnSync('flock', ['-x', '3'], { stdio: ['ignore', 'ignore', 'ignore', lock] })
115
+ if (held.error || held.status !== 0) throw new Error('capability flock unavailable')
116
+ let current = null
117
+ try { const fd = regular(at('current.json'), C.O_RDONLY); try { current = JSON.parse(readFileSync(fd, 'utf8')) } finally { closeSync(fd) } }
118
+ catch (e) { if (e.code !== 'ENOENT') throw e }
119
+ const next = change(current)
120
+ if (next === undefined) return
121
+ if (next === null) {
122
+ try { unlinkSync(at('current.json')) } catch (e) { if (e.code !== 'ENOENT') throw e }
123
+ } else {
124
+ temp = `.current-${randomUUID()}`
125
+ const fd = regular(at(temp), C.O_WRONLY | C.O_CREAT | C.O_EXCL)
126
+ try { writeFileSync(fd, JSON.stringify(next) + '\n'); fsyncSync(fd) } finally { closeSync(fd) }
127
+ renameSync(at(temp), at('current.json')); temp = null
128
+ }
129
+ safeDirectory(directory)
130
+ const actual = lstatSync(directory)
131
+ if (actual.dev !== expected.dev || actual.ino !== expected.ino) throw new Error('capability directory replaced')
132
+ fsyncSync(dir)
133
+ } finally {
134
+ if (temp) unlinkSync(at(temp))
135
+ if (lock !== undefined) closeSync(lock)
136
+ closeSync(dir)
137
+ }
138
+ }
139
+
140
+ export function publishRemindCapability(identity, { generation, extensionVersion, status, exposure, reason = null }) {
141
+ const record = {
142
+ version: 1,
143
+ at: new Date().toISOString(),
144
+ status,
145
+ exposure,
146
+ reason,
147
+ generation,
148
+ extensionVersion,
149
+ root: identity.root,
150
+ state: identity.state,
151
+ config: identity.config,
152
+ sessionId: identity.sessionId,
153
+ sessionFile: identity.sessionFile,
154
+ pid: identity.pid,
155
+ starttime: identity.starttime,
156
+ cwd: identity.cwd,
157
+ launchNonce: identity.launchNonce,
158
+ launchTime: identity.launchTime,
159
+ tmux: identity.tmux,
160
+ }
161
+ updateRemindCapability(identity, () => record)
162
+ }
163
+
164
+ export function removeRemindCapability(identity, generation) {
165
+ updateRemindCapability(identity, current => current?.generation === generation ? null : undefined, { create: false })
166
+ }
167
+
168
+ /** Doctor reads only this evidence plus live process/tmux/launch proof, never the Reminder snapshot. */
169
+ export function inspectRemindCapability({ root, state, config, session, window, skill }) {
170
+ let disk
171
+ try { disk = remindCapabilityDiskFingerprint(skill) } catch (e) { return { state: 'unknown', reason: `disk:${e.code ?? e.name}` } }
172
+ let runtime
173
+ try { runtime = JSON.parse(readRegular(join(state, 'remind-tool/current.json'))) }
174
+ catch (e) { return { disk, state: 'unknown', reason: `evidence:${e.code ?? e.name}` } }
175
+ const base = { disk, loaded: runtime.extensionVersion, generation: runtime.generation, sessionId: runtime.sessionId, at: runtime.at }
176
+ try {
177
+ if (runtime.version !== 1 || !['registered', 'error', 'hidden'].includes(runtime.status) ||
178
+ runtime.root !== realpathSync(root) || runtime.state !== realpathSync(state) || runtime.config !== realpathSync(config)) {
179
+ throw new Error('mismatched evidence')
180
+ }
181
+ const age = Date.now() - Date.parse(runtime.at)
182
+ if (!Number.isFinite(age) || age < -1000 || age > REMIND_CAPABILITY_TTL_MS) throw new Error('stale evidence')
183
+ if (runtime.extensionVersion !== disk) throw new Error('loaded source differs from disk')
184
+ const life = processIdentity(runtime.pid)
185
+ if (life.dead || life.zombie || !life.starttime || life.starttime !== runtime.starttime || realpathSync(`/proc/${runtime.pid}/cwd`) !== runtime.cwd) {
186
+ throw new Error('dead/reused/foreign process')
187
+ }
188
+ const actual = tmuxEvidence(runtime.tmux.socket, runtime.tmux.pane)
189
+ // A config mismatch makes the generated session/window differ from the live pane by definition.
190
+ // Error evidence still requires the same live process/pane; ready/hidden evidence also matches current config names.
191
+ if (!isDeepStrictEqual(actual, runtime.tmux) || !ancestor(actual.panePid, runtime.pid) ||
192
+ (runtime.status !== 'error' && (actual.session !== session || actual.window !== window))) {
193
+ throw new Error('pane/session changed')
194
+ }
195
+ if (!currentLaunchProof(runtime)) throw new Error('current PM launch proof missing')
196
+ const launch = launchRecord(runtime, true)
197
+ // Pi can publish its first capability record before team up publishes the launch nonce. A null value
198
+ // is adopted only with this same live process/launch proof; a later conflicting nonce is not.
199
+ if (runtime.launchNonce !== null && launch.nonce !== runtime.launchNonce) throw new Error('PM launch nonce changed')
200
+ if (runtime.status === 'error') return { ...base, state: 'error', reason: runtime.reason ?? 'extension bootstrap failed' }
201
+ if (runtime.status === 'hidden') return { ...base, state: 'unknown', reason: runtime.reason ?? 'tool is hidden in the current session' }
202
+ if (runtime.status === 'registered' && runtime.exposure === 'direct') {
203
+ return { ...base, state: 'ready', reason: `extension reported registered/active at ${runtime.at}` }
204
+ }
205
+ return { ...base, state: 'unknown', reason: 'evidence does not report direct registration' }
206
+ } catch (e) { return { ...base, state: 'unknown', reason: e.message } }
207
+ }
208
+
209
+ function authorityArgs(action, params) {
210
+ const args = []
211
+ if (action === 'add') {
212
+ args.push('remind-add', '--source', 'pm-tool')
213
+ if (params.at !== undefined) args.push('--at', String(params.at))
214
+ if (params.after !== undefined) args.push('--after', String(params.after))
215
+ if (params.key !== undefined) args.push('--key', String(params.key))
216
+ if (params.task !== undefined) args.push('--task', String(params.task))
217
+ } else if (action === 'list') {
218
+ args.push('remind-list')
219
+ if (params.all === true) args.push('--all')
220
+ } else if (action === 'show' || action === 'cancel') {
221
+ args.push(`remind-${action}`, '--id', String(params.id ?? ''))
222
+ } else throw new Error(`team_remind: unknown action ${action}`)
223
+ args.push('--json')
224
+ return args
225
+ }
226
+
227
+ /** Invoke the one existing authority; no project/owner/state/recipient field crosses the tool schema. */
228
+ export async function runReminderAuthority({ identity, skill, action, params, signal }) {
229
+ if (!identity || !skill) throw new Error('team_remind: verified PM identity is required')
230
+ let input = Buffer.alloc(0)
231
+ if (action === 'add') {
232
+ if (typeof params.message !== 'string') throw new Error('team_remind: message must be a string')
233
+ input = Buffer.from(params.message, 'utf8')
234
+ if (input.toString('utf8') !== params.message) throw new Error('team_remind: message is not valid UTF-8')
235
+ }
236
+ const script = join(skill, 'scripts/state-authority.mjs')
237
+ const args = [script, '--cli', identity.root, identity.state, ...authorityArgs(action, params)]
238
+ const env = { ...process.env, TEAM_ROOT: identity.root, TEAM_MAIN_ROOT: identity.root,
239
+ TEAM_STATE_DIR: identity.state, TEAM_CONFIG_FILE: identity.config }
240
+ const child = spawn(process.execPath, args, { cwd: identity.root, env, stdio: ['pipe', 'pipe', 'pipe'] })
241
+ const stdout = [], stderr = []
242
+ child.stdout.on('data', chunk => stdout.push(chunk))
243
+ child.stderr.on('data', chunk => stderr.push(chunk))
244
+ const onAbort = () => child.kill('SIGTERM')
245
+ try {
246
+ signal?.addEventListener('abort', onAbort, { once: true })
247
+ child.stdin.end(input)
248
+ const code = await new Promise((resolve, reject) => {
249
+ child.once('error', reject)
250
+ child.once('close', resolve)
251
+ })
252
+ const out = Buffer.concat(stdout).toString('utf8')
253
+ const err = Buffer.concat(stderr).toString('utf8')
254
+ let result
255
+ try { result = JSON.parse(out) } catch { throw new Error(`team_remind authority failed (rc=${code}): ${err || out || 'no result'}`) }
256
+ if (code !== 0 && result.ok !== false) throw new Error(`team_remind authority failed (rc=${code}): ${err || 'no refusal result'}`)
257
+ return result
258
+ } finally {
259
+ signal?.removeEventListener('abort', onAbort)
260
+ }
261
+ }