openclacky 1.5.22 → 1.5.24

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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +104 -0
  3. data/docs/secretary-prototype.md +286 -0
  4. data/lib/clacky/agent/cost_tracker.rb +55 -36
  5. data/lib/clacky/agent/hook_manager.rb +4 -1
  6. data/lib/clacky/agent/llm_caller.rb +46 -12
  7. data/lib/clacky/agent/memory_injector.rb +209 -0
  8. data/lib/clacky/agent/memory_updater.rb +16 -0
  9. data/lib/clacky/agent/session_serializer.rb +15 -11
  10. data/lib/clacky/agent/skill_manager.rb +30 -8
  11. data/lib/clacky/agent.rb +124 -17
  12. data/lib/clacky/agent_config.rb +7 -3
  13. data/lib/clacky/agent_profile.rb +33 -6
  14. data/lib/clacky/anthropic_stream_aggregator.rb +11 -1
  15. data/lib/clacky/bedrock_stream_aggregator.rb +11 -1
  16. data/lib/clacky/billing/platform_billing.rb +7 -0
  17. data/lib/clacky/cli.rb +4 -3
  18. data/lib/clacky/client.rb +30 -25
  19. data/lib/clacky/default_extensions/advisor/README.md +25 -0
  20. data/lib/clacky/default_extensions/advisor/README.zh.md +25 -0
  21. data/lib/clacky/default_extensions/advisor/ext.yml +1 -1
  22. data/lib/clacky/default_extensions/advisor/icon.svg +14 -0
  23. data/lib/clacky/default_extensions/advisor/panels/advisor/view.js +7 -1
  24. data/lib/clacky/default_extensions/coding/ext.yml +0 -1
  25. data/lib/clacky/default_extensions/computer-use/README.md +48 -0
  26. data/lib/clacky/default_extensions/computer-use/README.zh.md +48 -0
  27. data/lib/clacky/default_extensions/computer-use/ext.yml +1 -1
  28. data/lib/clacky/default_extensions/computer-use/icon.svg +16 -0
  29. data/lib/clacky/default_extensions/ext-studio/ext.yml +0 -1
  30. data/lib/clacky/default_extensions/general/ext.yml +0 -1
  31. data/lib/clacky/default_extensions/git/README.md +41 -0
  32. data/lib/clacky/default_extensions/git/README.zh.md +41 -0
  33. data/lib/clacky/default_extensions/git/ext.yml +1 -1
  34. data/lib/clacky/default_extensions/git/icon.svg +15 -0
  35. data/lib/clacky/default_extensions/git/panels/git/view.js +106 -27
  36. data/lib/clacky/default_extensions/meeting/README.md +46 -0
  37. data/lib/clacky/default_extensions/meeting/README.zh.md +47 -0
  38. data/lib/clacky/default_extensions/meeting/ext.yml +1 -1
  39. data/lib/clacky/default_extensions/meeting/icon.svg +13 -0
  40. data/lib/clacky/default_extensions/preview/README.md +29 -0
  41. data/lib/clacky/default_extensions/preview/README.zh.md +29 -0
  42. data/lib/clacky/default_extensions/preview/ext.yml +1 -1
  43. data/lib/clacky/default_extensions/preview/icon.svg +13 -0
  44. data/lib/clacky/default_extensions/secretary/README.md +69 -0
  45. data/lib/clacky/default_extensions/secretary/README.zh.md +69 -0
  46. data/lib/clacky/default_extensions/secretary/agents/secretary.md +41 -0
  47. data/lib/clacky/default_extensions/secretary/agents/worker.md +35 -0
  48. data/lib/clacky/default_extensions/secretary/api/handler.rb +8 -0
  49. data/lib/clacky/default_extensions/secretary/ext.yml +42 -0
  50. data/lib/clacky/default_extensions/secretary/icon.svg +17 -0
  51. data/lib/clacky/default_extensions/secretary/panels/work/view.js +344 -0
  52. data/lib/clacky/default_extensions/secretary/tools/delegate_work.rb +37 -0
  53. data/lib/clacky/default_extensions/secretary/tools/manage_work.rb +22 -0
  54. data/lib/clacky/default_extensions/secretary/tools/yield_work.rb +35 -0
  55. data/lib/clacky/default_extensions/time_machine/README.md +32 -0
  56. data/lib/clacky/default_extensions/time_machine/README.zh.md +32 -0
  57. data/lib/clacky/default_extensions/time_machine/ext.yml +1 -1
  58. data/lib/clacky/default_extensions/time_machine/icon.svg +14 -0
  59. data/lib/clacky/default_skills/channel-manager/SKILL.md +103 -13
  60. data/lib/clacky/default_skills/channel-manager/dingtalk_setup.rb +4 -2
  61. data/lib/clacky/default_skills/channel-manager/discord_setup.rb +9 -2
  62. data/lib/clacky/default_skills/channel-manager/weixin_setup.rb +10 -1
  63. data/lib/clacky/default_skills/cron-task-creator/SKILL.md +183 -206
  64. data/lib/clacky/default_skills/cron-task-creator/evals/evals.json +45 -0
  65. data/lib/clacky/default_skills/media-gen/SKILL.md +31 -14
  66. data/lib/clacky/default_skills/onboard/SKILL.md +5 -7
  67. data/lib/clacky/default_skills/persist-memory/SKILL.md +15 -1
  68. data/lib/clacky/extension/api_extension.rb +23 -2
  69. data/lib/clacky/extension/loader.rb +2 -0
  70. data/lib/clacky/extension/verifier.rb +2 -2
  71. data/lib/clacky/json_ui_controller.rb +14 -1
  72. data/lib/clacky/locales/en.rb +14 -0
  73. data/lib/clacky/locales/i18n.rb +25 -3
  74. data/lib/clacky/locales/zh.rb +14 -0
  75. data/lib/clacky/message_history.rb +15 -2
  76. data/lib/clacky/openai_responses_stream_aggregator.rb +11 -1
  77. data/lib/clacky/openai_stream_aggregator.rb +11 -1
  78. data/lib/clacky/prompts/base.md +1 -1
  79. data/lib/clacky/providers.rb +32 -17
  80. data/lib/clacky/server/backup_manager.rb +98 -2
  81. data/lib/clacky/server/browser_manager.rb +10 -5
  82. data/lib/clacky/server/channel/adapters/base.rb +18 -0
  83. data/lib/clacky/server/channel/adapters/feishu/message_parser.rb +1 -0
  84. data/lib/clacky/server/channel/adapters/telegram/adapter.rb +1 -0
  85. data/lib/clacky/server/channel/channel_config.rb +185 -48
  86. data/lib/clacky/server/channel/channel_manager.rb +247 -110
  87. data/lib/clacky/server/git_panel.rb +2 -1
  88. data/lib/clacky/server/http_server.rb +517 -175
  89. data/lib/clacky/server/preview.rb +26 -5
  90. data/lib/clacky/server/scheduler.rb +166 -85
  91. data/lib/clacky/server/web_ui_controller.rb +12 -0
  92. data/lib/clacky/session_manager.rb +4 -1
  93. data/lib/clacky/skill.rb +1 -1
  94. data/lib/clacky/tools/base.rb +7 -1
  95. data/lib/clacky/ui_interface.rb +5 -0
  96. data/lib/clacky/utils/file_processor.rb +23 -11
  97. data/lib/clacky/utils/model_pricing.rb +19 -0
  98. data/lib/clacky/version.rb +1 -1
  99. data/lib/clacky/web/app.css +621 -52
  100. data/lib/clacky/web/app.js +103 -9
  101. data/lib/clacky/web/components/code-editor.js +73 -4
  102. data/lib/clacky/web/components/custom-select.js +7 -18
  103. data/lib/clacky/web/components/hint-tip.js +172 -0
  104. data/lib/clacky/web/components/model-picker.js +1 -1
  105. data/lib/clacky/web/components/notify.js +37 -10
  106. data/lib/clacky/web/components/onboard.js +1 -1
  107. data/lib/clacky/web/components/sidebar.js +70 -0
  108. data/lib/clacky/web/features/backup/store.js +64 -27
  109. data/lib/clacky/web/features/backup/view.js +42 -11
  110. data/lib/clacky/web/features/channels/store.js +19 -4
  111. data/lib/clacky/web/features/channels/view.js +94 -33
  112. data/lib/clacky/web/features/extensions/view.js +15 -8
  113. data/lib/clacky/web/features/new-session/view.js +33 -22
  114. data/lib/clacky/web/features/profile/view.js +4 -4
  115. data/lib/clacky/web/features/tasks/store.js +5 -3
  116. data/lib/clacky/web/features/tasks/view.js +99 -26
  117. data/lib/clacky/web/features/trash/view.js +4 -4
  118. data/lib/clacky/web/features/workspace/view.js +193 -57
  119. data/lib/clacky/web/i18n.js +189 -17
  120. data/lib/clacky/web/index.html +165 -53
  121. data/lib/clacky/web/projects.js +15 -2
  122. data/lib/clacky/web/sessions.js +316 -86
  123. data/lib/clacky/web/settings.js +304 -75
  124. data/lib/clacky/web/utils.js +261 -0
  125. data/lib/clacky/web/ws-dispatcher.js +24 -3
  126. data/lib/clacky/web/ws.js +16 -4
  127. data/lib/clacky/work/service.rb +544 -0
  128. data/lib/clacky/work/store.rb +57 -0
  129. data/lib/clacky.rb +1 -0
  130. metadata +35 -1
@@ -99,11 +99,11 @@
99
99
  style.id = "changes-panel-style";
100
100
  style.textContent = `
101
101
  .changes-root { container-type: inline-size; --cg-swatch-add: #6dcf90; --cg-swatch-del: #f28f95; display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--color-bg-primary); }
102
- .cg-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; height: 44px; border-bottom: 1px solid var(--color-border-primary); }
102
+ .cg-bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; height: 40px; border-bottom: 1px solid var(--color-border-primary); }
103
103
  .cg-bar-stats { display: flex; align-items: center; gap: 7px; min-width: 0; font-family: ui-monospace, monospace; font-size: 12px; font-weight: 600; }
104
104
  .cg-bar-add { color: var(--color-success, #2f9e44); }
105
105
  .cg-bar-del { color: var(--color-error, #c92a2a); }
106
- .cg-scope { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 9px 0 10px; border: 1px solid var(--color-border-primary); border-radius: var(--radius-pill); background: transparent; color: var(--color-text-secondary); font-family: inherit; font-size: 12.5px; cursor: pointer; }
106
+ .cg-scope { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px 0 10px; border: 1px solid var(--color-border-primary); border-radius: var(--radius-pill); background: transparent; color: var(--color-text-secondary); font-family: inherit; font-size: 12.5px; cursor: pointer; }
107
107
  .cg-scope:hover, .cg-scope.is-open { background: var(--color-bg-hover); color: var(--color-text-primary); }
108
108
  .cg-scope-label { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
109
109
  .cg-scope > .cg-caret { display: inline-flex; opacity: 0.65; }
@@ -114,17 +114,19 @@
114
114
  .cg-compare { flex: 0 1 auto; min-width: 0; font-size: 12.5px; }
115
115
  .cg-compare .cg-scope-head, .cg-compare .cg-scope-base { min-width: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
116
116
  .cg-compare .cg-compare-arrow { display: inline-flex; color: var(--color-text-tertiary); opacity: 0.8; }
117
- .cg-scope-menu { position: fixed; z-index: 80; min-width: 196px; padding: 7px; border: 1px solid var(--color-border-primary); border-radius: 12px; background: var(--color-bg-primary); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06); }
117
+ .cg-scope-menu { position: fixed; z-index: 1000; min-width: 196px; padding: 7px; border: 1px solid var(--color-border-primary); border-radius: 12px; background: var(--color-bg-primary); box-shadow: 0 14px 38px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06); }
118
118
  .cg-scope-item { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 7px; font-size: 13px; color: var(--color-text-primary); cursor: pointer; white-space: nowrap; }
119
119
  .cg-scope-item:hover, .cg-scope-item.is-open { background: var(--color-bg-hover); }
120
120
  .cg-scope-item .cg-scope-check { margin-left: auto; display: inline-flex; opacity: 0; color: var(--color-text-primary); }
121
121
  .cg-scope-item.is-checked .cg-scope-check { opacity: 1; }
122
122
  .cg-scope-item .cg-scope-arrow { margin-left: auto; display: inline-flex; color: var(--color-text-tertiary); }
123
123
  .cg-scope-sep { height: 1px; margin: 6px 8px; background: var(--color-border-secondary); }
124
- .cg-scope-sub { position: fixed; z-index: 81; width: 340px; max-height: 420px; display: flex; flex-direction: column; padding: 6px; border: 1px solid var(--color-border-primary); border-radius: 14px; background: var(--color-bg-primary); box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06); }
124
+ .cg-scope-sub { position: fixed; z-index: 1001; width: 340px; max-height: 420px; display: flex; flex-direction: column; padding: 6px; border: 1px solid var(--color-border-primary); border-radius: 14px; background: var(--color-bg-primary); box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06); }
125
125
  .cg-scope-search { flex: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; color: var(--color-text-tertiary); }
126
126
  .cg-scope-search input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--color-text-primary); font-family: inherit; font-size: 13px; outline: none; }
127
127
  .cg-scope-group { flex: none; padding: 8px 10px 6px; font-size: 11.5px; color: var(--color-text-tertiary); }
128
+ .cg-scope-sub.is-bare .cg-scope-search,
129
+ .cg-scope-sub.is-bare .cg-scope-group { display: none; }
128
130
  .cg-scope-list { flex: 1; min-height: 0; overflow: auto; }
129
131
  .cg-scope-branch { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 7px; font-size: 13px; color: var(--color-text-primary); cursor: pointer; }
130
132
  .cg-scope-branch:hover, .cg-scope-branch.is-active { background: var(--color-bg-hover); }
@@ -141,7 +143,7 @@
141
143
  .cg-scope-empty { padding: 10px; font-size: 12px; color: var(--color-text-tertiary); }
142
144
  /* Jump-to-file finder: a fixed panel under the toolbar button, sized so
143
145
  a long path still shows its basename before the directories. */
144
- .cg-find { position: fixed; z-index: 82; width: 420px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; padding: 6px; border: 1px solid var(--color-border-primary); border-radius: 14px; background: var(--color-bg-primary); box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06); }
146
+ .cg-find { position: fixed; z-index: 1000; width: 420px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; padding: 6px; border: 1px solid var(--color-border-primary); border-radius: 14px; background: var(--color-bg-primary); box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06); }
145
147
  .cg-find-search { flex: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; color: var(--color-text-tertiary); }
146
148
  .cg-find-search input { flex: 1; min-width: 0; border: none; background: transparent; color: var(--color-text-primary); font-family: inherit; font-size: 13px; outline: none; }
147
149
  .cg-find-list { flex: 1; min-height: 0; max-height: 320px; overflow: auto; }
@@ -151,7 +153,7 @@
151
153
  .cg-find-dir { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-tertiary); font-family: ui-monospace, monospace; font-size: 11.5px; }
152
154
  .cg-find-empty { padding: 10px; font-size: 12px; color: var(--color-text-tertiary); }
153
155
  .cg-bar-spacer { flex: 1; }
154
- .cg-tools { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 3px; border: 1px solid var(--color-border-primary); border-radius: var(--radius-pill); }
156
+ .cg-tools { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 2px; border: 1px solid var(--color-border-primary); border-radius: var(--radius-pill); }
155
157
  .cg-icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--color-text-tertiary); cursor: pointer; }
156
158
  .cg-icon-btn:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
157
159
  .cg-icon-btn.is-on { background: color-mix(in srgb, var(--color-text-primary) 8%, transparent); color: var(--color-text-primary); }
@@ -193,8 +195,12 @@
193
195
  .cg-file-stat .d { color: var(--color-error, #c92a2a); }
194
196
  .cg-main { flex: 1; min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; }
195
197
  .cg-stream { flex: 1; min-height: 0; overflow: auto; position: relative; }
196
- /* left:0 keeps the header pinned while a long line is scrolled sideways. */
197
- .cg-file-head { position: sticky; top: 0; left: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--color-bg-secondary, var(--color-bg-primary)); border-bottom: 1px solid var(--color-border-secondary); box-shadow: 0 -1px 0 var(--color-border-primary); cursor: pointer; }
198
+ /* A sticky box only travels inside its containing block, so the section
199
+ stretches to the full scroll width (same trick as .cg-line and
200
+ .cg-fold) while the header keeps one pane width. That slack is what
201
+ lets left:0 pin the header while a long line is scrolled sideways. */
202
+ .changes-root:not(.is-wrap) .cg-file { min-width: var(--cg-span-w, 0px); }
203
+ .cg-file-head { position: sticky; top: 0; left: 0; z-index: 2; box-sizing: border-box; width: var(--cg-pane-w, auto); display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--color-bg-secondary, var(--color-bg-primary)); border-bottom: 1px solid var(--color-border-secondary); box-shadow: 0 -1px 0 var(--color-border-primary); cursor: pointer; }
198
204
  /* The top rule is a shadow, not a border: a stuck header's rule must be
199
205
  clipped by the scroll box, otherwise it doubles with the toolbar's
200
206
  bottom border when the pane is scrolled to a file. */
@@ -227,10 +233,16 @@
227
233
  /* Side-by-side without wrapping keeps each pane at half the width and
228
234
  scrolls its own long lines sideways, the way an editor diff behaves. */
229
235
  .cg-cols { display: flex; align-items: stretch; }
230
- .cg-col { flex: 1 1 0; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
236
+ .cg-col { flex: 1 1 0; min-width: 0; overflow-x: auto; overflow-y: hidden; }
231
237
  .cg-col::-webkit-scrollbar { height: 6px; }
232
- .cg-col::-webkit-scrollbar-thumb { background: var(--color-border-strong, rgba(127, 127, 127, 0.45)); border-radius: 3px; }
238
+ .cg-col::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
239
+ .cg-file:hover .cg-col::-webkit-scrollbar-thumb { background: var(--color-border-strong, rgba(127, 127, 127, 0.45)); }
233
240
  .cg-col::-webkit-scrollbar-track { background: transparent; }
241
+ /* Chrome ignores the webkit pseudo-elements once scrollbar-width is set, so only Firefox gets it. */
242
+ @supports not selector(::-webkit-scrollbar) {
243
+ .cg-col { scrollbar-width: thin; scrollbar-color: transparent transparent; }
244
+ .cg-file:hover .cg-col { scrollbar-color: var(--color-border-strong, rgba(127, 127, 127, 0.45)) transparent; }
245
+ }
234
246
  .cg-col.old { border-right: 1px solid var(--color-border-secondary); }
235
247
  .cg-col > .cg-line { width: max-content; min-width: 100%; background-color: var(--color-bg-primary); }
236
248
  /* Sticky so the number stays put while long lines scroll under it. The
@@ -297,10 +309,9 @@
297
309
  }
298
310
  @container (max-width: 460px) {
299
311
  /* The bar wraps only when the pills and the tools no longer fit side
300
- by side; the tools then drop below, still right-aligned. */
312
+ by side. The spacer keeps its slot so the tools drop to the next
313
+ line flush left instead of being pushed to the right edge. */
301
314
  .cg-bar { height: auto; min-height: 38px; flex-wrap: wrap; padding-block: 6px; row-gap: 6px; }
302
- .cg-bar-spacer { display: none; }
303
- .cg-tools { margin-left: auto; }
304
315
  .cg-scope-subject { max-width: 180px; }
305
316
  .cg-compare .cg-scope-head, .cg-compare .cg-scope-base { max-width: 62px; }
306
317
  }
@@ -571,6 +582,25 @@
571
582
  return root;
572
583
  }
573
584
 
585
+ // The tree draws directories before files at every level, so a plain path
586
+ // sort would push `README.md` above `docs/` (byte order) and the stream could
587
+ // no longer be matched row by row against the tree. Flattening the tree in
588
+ // walk order keeps both panes on one definition of "sorted".
589
+ function sortFiles(files) {
590
+ const out = [];
591
+ const visit = (node) => {
592
+ Array.from(node.dirs.values())
593
+ .sort((a, b) => a.name.localeCompare(b.name))
594
+ .forEach(visit);
595
+ node.files
596
+ .slice()
597
+ .sort((a, b) => a.path.localeCompare(b.path))
598
+ .forEach((f) => out.push(f));
599
+ };
600
+ visit(buildTree(files));
601
+ return out;
602
+ }
603
+
574
604
  function matchesFilter(file) {
575
605
  return !state.filter || file.path.toLowerCase().includes(state.filter);
576
606
  }
@@ -650,11 +680,15 @@
650
680
  iconEl.innerHTML = icon;
651
681
  item.appendChild(iconEl);
652
682
  item.appendChild(el("span", { class: "session-actions-menu-label", text: label }));
653
- item.addEventListener("click", () => {
654
- if (disabled) return;
655
- closeFileMenu();
656
- run();
657
- });
683
+ // Rows that own a submenu (run === null) get their click handling from
684
+ // OpenWith.mount, which must also keep the menu open.
685
+ if (run) {
686
+ item.addEventListener("click", () => {
687
+ if (disabled) return;
688
+ closeFileMenu();
689
+ run();
690
+ });
691
+ }
658
692
  menu.appendChild(item);
659
693
  });
660
694
  menu.addEventListener("contextmenu", (e) => e.preventDefault());
@@ -685,6 +719,9 @@
685
719
  const items = [];
686
720
  if (!isDir) {
687
721
  items.push(["addtochat", ICON_ADD_TO_CHAT, t("workspace.addToChat", "添加到聊天"), () => addToChat(path)]);
722
+ // No click handler: the submenu opens on hover (and on click, handled by
723
+ // OpenWith), so the parent row must not dismiss the menu.
724
+ items.push(["openwith", ICON_OPEN_WITH, t("workspace.openWithMenu", "打开方式"), null]);
688
725
  }
689
726
  items.push(["reveal", ICON_FOLDER, t("workspace.revealInFinder", "打开所在文件夹"), () => revealInFinder(path)]);
690
727
  items.push(["copypath", ICON_COPY, t("workspace.copyPath", "复制路径"), () => copyAbsPath(path)]);
@@ -693,7 +730,12 @@
693
730
  items.push(["download", ICON_DOWNLOAD, t("workspace.download", "下载"), () => downloadPath(path)]);
694
731
  }
695
732
 
696
- placeMenu(buildMenu(items), ev.clientX, ev.clientY);
733
+ const menu = buildMenu(items);
734
+ if (!isDir) {
735
+ const row = menu.querySelector('[data-action="openwith"]');
736
+ if (row) OpenWith.mount(row, menuEntry(path), { menu: menu });
737
+ }
738
+ placeMenu(menu, ev.clientX, ev.clientY);
697
739
  }
698
740
 
699
741
  function openHeadMenu(anchor, file) {
@@ -990,6 +1032,7 @@
990
1032
  revert.innerHTML = ICON_REVERT;
991
1033
  revert.addEventListener("click", (e) => {
992
1034
  e.stopPropagation();
1035
+ closeFileMenu();
993
1036
  onRevertClick(revert, file.path);
994
1037
  });
995
1038
 
@@ -1090,6 +1133,7 @@
1090
1133
  function syncSpan() {
1091
1134
  const stream = state.els && state.els.stream;
1092
1135
  if (!stream) return;
1136
+ stream.style.setProperty("--cg-pane-w", stream.clientWidth + "px");
1093
1137
  const cols = stream.querySelectorAll(".cg-col");
1094
1138
  if (effectiveLayout() === "split") {
1095
1139
  stream.style.removeProperty("--cg-span-w");
@@ -1244,7 +1288,10 @@
1244
1288
  return;
1245
1289
  }
1246
1290
 
1247
- const limit = (full || record.loaded) ? MAX_RENDER_LINES : Math.min(MAX_RENDER_LINES, state.budget);
1291
+ // A body that already rendered once must survive a layout switch: reflow
1292
+ // runs after the stream budget has been spent, so consulting state.budget
1293
+ // again would turn every visible file back into a load-on-click placeholder.
1294
+ const limit = (full || record.loaded || record.shown) ? MAX_RENDER_LINES : Math.min(MAX_RENDER_LINES, state.budget);
1248
1295
  if (limit <= 0) {
1249
1296
  renderLazy(section, file);
1250
1297
  return;
@@ -1330,6 +1377,7 @@
1330
1377
  if (panes && oldCol && newCol) syncPaneScroll([oldCol, newCol]);
1331
1378
  scheduleSpan();
1332
1379
  if (!full && !record.loaded && !state.reflow) state.budget -= rendered;
1380
+ if (rendered > 0) record.shown = true;
1333
1381
  if (file.truncated || rendered >= limit) {
1334
1382
  lines.appendChild(el("div", { class: "cg-note", text: t("changes.diff.truncated", "差异过大,仅显示前 {{n}} 行").replace("{{n}}", String(limit)) }));
1335
1383
  }
@@ -1592,10 +1640,24 @@
1592
1640
  state.els.stream.replaceChildren(el("div", { class: cls, text: message }));
1593
1641
  }
1594
1642
 
1595
- async function refresh(sessionId, ctx) {
1643
+ async function refresh(sessionId, ctx, opts) {
1596
1644
  if (!state.els) return;
1597
1645
  closeScopeMenu();
1598
1646
  closeFinder();
1647
+ closeFileMenu();
1648
+ // The ref lists outlive one render, so a refresh has to forget them - the
1649
+ // "已提交" menu was showing commits that had already been pushed.
1650
+ const reload = !opts || opts.reload !== false;
1651
+ if (reload) {
1652
+ state.commits = null;
1653
+ state.branches = null;
1654
+ }
1655
+ // A pushed commit still has a diff, so drop the pick before asking for one
1656
+ // once it has left the unpushed list.
1657
+ if (reload && state.scope === "committed" && state.commit) {
1658
+ const commits = await loadCommits();
1659
+ if (!commits.some((c) => c.hash === state.commit)) state.commit = "";
1660
+ }
1599
1661
  let data;
1600
1662
  try {
1601
1663
  data = await api(sessionId, `review?${scopeQuery()}`);
@@ -1610,7 +1672,7 @@
1610
1672
  }
1611
1673
 
1612
1674
  state.sessionId = sessionId;
1613
- state.files = data.files || [];
1675
+ state.files = sortFiles(data.files || []);
1614
1676
  state.note = data.note || null;
1615
1677
  state.branch = data.branch || "";
1616
1678
  // A fresh "branch" scope has no pick yet: adopt the base the server
@@ -1653,6 +1715,13 @@
1653
1715
  branch: () => t("changes.scope.branch", "分支"),
1654
1716
  };
1655
1717
 
1718
+ // Only "上一轮" needs decoding: it reads like a Git range, but the files come
1719
+ // from the task snapshots Time Machine kept, not from history.
1720
+ const SCOPE_TOOLTIPS = {
1721
+ lastTurn: () => t("changes.scope.lastTurnTip",
1722
+ "只显示上一轮对话中改动的文件,来自任务快照,而非 Git 历史"),
1723
+ };
1724
+
1656
1725
  // The pill always names the scope; what it is compared against rides in the
1657
1726
  // muted subject (a commit) or in the separate compare pill (a branch).
1658
1727
  function scopeLabel() {
@@ -1797,6 +1866,11 @@
1797
1866
  }
1798
1867
  const row = el("div", { class: "cg-scope-item", "data-scope": item.scope });
1799
1868
  row.appendChild(el("span", { text: SCOPE_LABELS[item.scope]() }));
1869
+ const tip = SCOPE_TOOLTIPS[item.scope];
1870
+ if (tip) {
1871
+ row.setAttribute("data-tooltip", tip());
1872
+ row.setAttribute("data-tooltip-pos", "right");
1873
+ }
1800
1874
  if (item.submenu) {
1801
1875
  const arrow = el("span", { class: "cg-scope-arrow" });
1802
1876
  arrow.innerHTML = ICON_CHEVRON;
@@ -1853,10 +1927,11 @@
1853
1927
  // A dropdown list of refs: branches when choosing a comparison base, commits
1854
1928
  // when pinning "committed" to something other than the upstream. Both share
1855
1929
  // the search box and row styling; only the row content differs.
1856
- function renderRefList(listEl, kind, onPick) {
1930
+ function renderRefList(listEl, kind, onPick, sub) {
1857
1931
  listEl.replaceChildren();
1858
1932
  const q = refSearch.trim().toLowerCase();
1859
1933
  const all = kind === "branches" ? state.branches : state.commits;
1934
+ if (all && sub) sub.classList.toggle("is-bare", !all.length);
1860
1935
  if (!all) {
1861
1936
  const text = kind === "branches"
1862
1937
  ? t("changes.scope.loadingBranches", "正在读取分支…")
@@ -1948,9 +2023,9 @@
1948
2023
 
1949
2024
  input.addEventListener("input", () => {
1950
2025
  refSearch = input.value;
1951
- renderRefList(list, kind, onPick);
2026
+ renderRefList(list, kind, onPick, sub);
1952
2027
  });
1953
- renderRefList(list, kind, onPick);
2028
+ renderRefList(list, kind, onPick, sub);
1954
2029
  setTimeout(() => input.focus(), 0);
1955
2030
 
1956
2031
  const cached = kind === "branches" ? state.branches : state.commits;
@@ -1965,7 +2040,7 @@
1965
2040
  } else {
1966
2041
  await loadCommits();
1967
2042
  }
1968
- if (refMenuEl === sub) renderRefList(list, kind, onPick);
2043
+ if (refMenuEl === sub) renderRefList(list, kind, onPick, sub);
1969
2044
  }
1970
2045
  }
1971
2046
 
@@ -1975,7 +2050,8 @@
1975
2050
  else if (scope === "committed") state.commit = value || "";
1976
2051
  state.note = null;
1977
2052
  closeScopeMenu();
1978
- if (state.sessionId) refresh(state.sessionId, state.ctx);
2053
+ // Picking a scope does not change the repo, so the cached ref lists stay.
2054
+ if (state.sessionId) refresh(state.sessionId, state.ctx, { reload: false });
1979
2055
  }
1980
2056
 
1981
2057
  // ── mount ──────────────────────────────────────────────────────────────
@@ -2100,6 +2176,9 @@
2100
2176
  reflowBodies();
2101
2177
  return;
2102
2178
  }
2179
+ // Pane width and scroll width both change with the sidebar drag,
2180
+ // fullscreen and window resize; the pinned header needs both.
2181
+ scheduleSpan();
2103
2182
  });
2104
2183
  state.ro.observe(stream);
2105
2184
  }
@@ -0,0 +1,46 @@
1
+ # Meeting
2
+
3
+ Let the AI sit in on your meetings: live captions, ask questions by voice at any time, and get meeting notes automatically when you finish.
4
+
5
+ > This extension is **off by default**. After clicking **Enable** in Extensions, a **Meeting Assistant** tab appears in the side panel of the general assistant session.
6
+
7
+ ## Starting a meeting
8
+
9
+ 1. Open a general assistant session and switch to **Meeting Assistant** in the side panel.
10
+ 2. Click **Start Recording** and allow microphone access when the browser asks.
11
+ 3. Speech is transcribed into live captions in the panel.
12
+ 4. About every 2 minutes, the AI adds **annotations** — short highlights of what was discussed.
13
+
14
+ ## Asking the AI during the meeting
15
+
16
+ Say a wake phrase followed by your question, e.g. "Hey Clacky, what launch date did we just agree on?"
17
+
18
+ Supported wake phrases:
19
+
20
+ - "hey clacky", "@clacky"
21
+ - 「你好小克」「小克小克」「你好克拉奇」
22
+
23
+ The AI answers by voice. At any time you can click:
24
+
25
+ - **Stop Voice** to stop the current playback
26
+ - **Interrupt** to cancel the current answer
27
+
28
+ ## Ending the meeting
29
+
30
+ Click **Summarize Notes**. The AI builds structured notes from the full transcript:
31
+
32
+ - Key decisions
33
+ - Action items (with owners when identifiable)
34
+ - Discussion highlights
35
+ - Open questions
36
+
37
+ ## More
38
+
39
+ - **Mute / Unmute** temporarily turns the microphone off; nothing is recorded meanwhile.
40
+ - **Resume Recording** continues an unfinished meeting after a page reload (microphone access is requested again).
41
+ - **Meeting vocabulary**: add names, product names and jargon (press Enter after each), then click **Save** — this noticeably improves recognition accuracy.
42
+
43
+ ## Notes
44
+
45
+ - Speech recognition uses your configured model provider; make sure a working model is set up.
46
+ - Recording captures other people's speech — let participants know before you start.
@@ -0,0 +1,47 @@
1
+ # 会议助理
2
+
3
+ 开会时让 AI 旁听:实时显示字幕,随时语音提问,会议结束后自动生成会议纪要。
4
+
5
+ > 本扩展**默认关闭**。在扩展管理中点击「启用」后,会在通用助手会话的右侧面板出现 **「会议助理」** 标签页。
6
+
7
+ ## 开始一场会议
8
+
9
+ 1. 打开通用助手会话,在右侧面板切换到「会议助理」。
10
+ 2. 点击 **「开始记录」**,按浏览器提示允许使用麦克风。
11
+ 3. 发言内容会实时转成字幕显示在面板里。
12
+ 4. 会议过程中,AI 每隔约 2 分钟会自动整理一次「标注」(要点摘录)。
13
+
14
+ ## 会中向 AI 提问
15
+
16
+ 说出唤醒词,后面接你的问题即可,例如「你好小克,刚才说的上线时间是哪天?」
17
+
18
+ 支持的唤醒词:
19
+
20
+ - 「你好小克」「小克小克」
21
+ - 「你好克拉奇」
22
+ - 「hey clacky」「@clacky」
23
+
24
+ AI 会用语音回答。可以随时点击:
25
+
26
+ - **停止播报**:停止当前语音播放
27
+ - **打断**:取消当前回答
28
+
29
+ ## 结束会议
30
+
31
+ 点击 **「总结纪要」**,AI 会根据完整转写内容生成结构化纪要,包含:
32
+
33
+ - 关键决策
34
+ - 待办事项(能识别时附上负责人)
35
+ - 讨论要点
36
+ - 未决问题
37
+
38
+ ## 其他功能
39
+
40
+ - **静音 / 解除静音**:临时关闭麦克风,不记录这段时间的发言。
41
+ - **继续录音**:刷新页面或中断后,可以接着之前的会议继续记录(需要重新授权麦克风)。
42
+ - **会议词汇**:在「会议词汇(专有名词)」中输入人名、产品名、术语,回车添加后点「保存词汇」,能明显提高识别准确率。
43
+
44
+ ## 注意事项
45
+
46
+ - 语音识别使用当前配置的模型服务,请确保已配置可用的模型。
47
+ - 会议录音和转写涉及他人发言,使用前请告知与会者。
@@ -5,8 +5,8 @@ display_name_zh: 会议助理
5
5
  description: Real-time meeting transcription and AI assistant
6
6
  description_zh: 实时会议转录与 AI 助手
7
7
  version: "0.1.0"
8
+ icon: icon.svg
8
9
  author: OpenClacky
9
- homepage: https://www.openclacky.com
10
10
  license: MIT
11
11
  enabled_by_default: false
12
12
  contributes:
@@ -0,0 +1,13 @@
1
+ <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <linearGradient id="meeting-bg" x1="18" y1="0" x2="18" y2="36" gradientUnits="userSpaceOnUse">
4
+ <stop stop-color="#3B8BF5"/>
5
+ <stop offset="1" stop-color="#2563EB"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <rect width="36" height="36" fill="url(#meeting-bg)"/>
9
+ <g transform="translate(8 8) scale(0.8333)" stroke="#fff" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
10
+ <path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/>
11
+ <rect x="2" y="6" width="14" height="12" rx="2"/>
12
+ </g>
13
+ </svg>
@@ -0,0 +1,29 @@
1
+ # Preview
2
+
3
+ A built-in mini browser: view and interact with pages the AI built, or your local dev server, right next to the chat — no window switching.
4
+
5
+ ## Opening it
6
+
7
+ - **Easiest**: click an HTML file or a `localhost` link in the chat. The Preview panel opens and loads it automatically.
8
+ - **Manually**: switch to the **Preview** tab in the session's side panel, type an address and press Enter.
9
+
10
+ The address bar accepts:
11
+
12
+ - Workspace file paths, e.g. `index.html`, `dist/report.html`
13
+ - Local dev servers, e.g. `localhost:3000`, `http://127.0.0.1:5173`
14
+ - Regular URLs, e.g. `https://example.com`
15
+
16
+ ## Toolbar
17
+
18
+ | Button | What it does |
19
+ |---|---|
20
+ | ← / → | Back / forward |
21
+ | ⟳ | Reload (click after the AI changes code to see the result) |
22
+ | ↗ | Open in a new browser tab |
23
+ | More | Zoom in / zoom out / reset to 100% |
24
+
25
+ ## Tips
26
+
27
+ - Pages run in an isolated origin and cannot read Clacky's own data, while clicks, forms and logins in local Rails, React or Vue apps still work normally.
28
+ - If a file is missing or the server is not running, a friendly notice is shown instead of a blank page. Check the path or start your dev server.
29
+ - When you follow links inside the page, the address bar stays in sync.
@@ -0,0 +1,29 @@
1
+ # 预览
2
+
3
+ 内置的迷你浏览器:AI 做出来的网页、本地启动的开发服务,不用切换窗口,直接在会话右侧查看和操作。
4
+
5
+ ## 怎么打开
6
+
7
+ - **最简单**:在聊天里点击 AI 给出的 HTML 文件或 `localhost` 链接,预览面板会自动打开并加载。
8
+ - **手动**:在会话右侧面板切换到 **「预览」** 标签页,在地址栏输入地址后回车。
9
+
10
+ 地址栏支持:
11
+
12
+ - 工作区里的文件路径,例如 `index.html`、`dist/report.html`
13
+ - 本地开发服务,例如 `localhost:3000`、`http://127.0.0.1:5173`
14
+ - 普通网址,例如 `https://example.com`
15
+
16
+ ## 工具栏
17
+
18
+ | 按钮 | 作用 |
19
+ |---|---|
20
+ | ← / → | 后退 / 前进 |
21
+ | ⟳ | 刷新页面(AI 改完代码后点一下就能看到最新效果) |
22
+ | ↗ | 在浏览器新标签页中打开 |
23
+ | 更多 | 缩放:放大 / 缩小 / 重置为 100% |
24
+
25
+ ## 小贴士
26
+
27
+ - 页面在独立的安全环境中运行,无法读取 Clacky 自身的数据;本地 Rails、React、Vue 等应用的点击、表单、登录都能正常使用。
28
+ - 文件不存在或服务没启动时,会显示友好的提示页,而不是一片空白。请确认路径正确或开发服务已启动。
29
+ - 在页面里点链接跳转后,地址栏会自动同步到当前地址。
@@ -5,8 +5,8 @@ display_name_zh: 预览
5
5
  description: Live preview panel — click an HTML file or localhost URL in chat to open it
6
6
  description_zh: 预览面板 — 点击聊天里的 HTML 文件或 localhost 链接打开
7
7
  version: "0.1.0"
8
+ icon: icon.svg
8
9
  author: OpenClacky
9
- homepage: https://www.openclacky.com
10
10
  license: MIT
11
11
  contributes:
12
12
  panels:
@@ -0,0 +1,13 @@
1
+ <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <linearGradient id="preview-bg" x1="18" y1="0" x2="18" y2="36" gradientUnits="userSpaceOnUse">
4
+ <stop stop-color="#6E73F2"/>
5
+ <stop offset="1" stop-color="#4F46E5"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <rect width="36" height="36" fill="url(#preview-bg)"/>
9
+ <g transform="translate(8 8) scale(0.8333)" stroke="#fff" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
10
+ <path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/>
11
+ <circle cx="12" cy="12" r="3"/>
12
+ </g>
13
+ </svg>
@@ -0,0 +1,69 @@
1
+ # Secretary
2
+
3
+ An assistant you can hand work to: it answers simple questions on the spot, runs the slow parts in the background, and comes back when there is a result or a decision to make.
4
+
5
+ > This extension is **on by default**. Pick **Secretary** when starting a session and the **Work** tab appears in the side panel.
6
+
7
+ ## What suits it
8
+
9
+ - Research that needs reading docs, searching, or comparing options
10
+ - Execution that produces files, code changes, or cleaned-up data
11
+ - Work that has to wait for someone else's reply
12
+ - A routine summary at a fixed time each morning or evening
13
+
14
+ ## Using it
15
+
16
+ State the goal, what "done" looks like, and any known constraints, for example:
17
+
18
+ > Bring this project's README up to date — cover deployment and local development, don't touch the code.
19
+
20
+ The secretary decides whether the work needs a background run:
21
+
22
+ - **Simple questions** are answered directly and never show up in **Work**.
23
+ - **Longer work** becomes a work item handed to a background worker, and the conversation continues with you immediately.
24
+
25
+ ## The Work panel
26
+
27
+ Each item is a card with a title, status and creation time. The list stays in creation order, so status changes never move a card around.
28
+
29
+ Statuses:
30
+
31
+ | Status | Meaning |
32
+ | --- | --- |
33
+ | Waiting to start | Queued, not started yet |
34
+ | Your secretary is working on this | Running in the background |
35
+ | Waiting for an event or checkpoint | Awaiting an external reply, or a scheduled re-check |
36
+ | Needs input from your secretary | Needs information, a decision or authorization |
37
+ | Paused | You or the secretary paused it |
38
+ | Completed | A deliverable or interim result is ready |
39
+ | Something needs attention | Execution failed; review it with the secretary |
40
+ | Cancelled | Stopped for good |
41
+
42
+ Card actions:
43
+
44
+ - **Discuss with secretary** pre-fills "About “{title}”, I would like to add:" into the composer, so you can keep talking.
45
+ - **Open execution history** jumps to the worker session with the full run.
46
+ - **Details** expands the objective, constraints and change history.
47
+
48
+ The **Recurring plans** section below lists scheduled runs (daily / weekdays), the next run time and the plan text. To change one, click **Discuss with secretary** and describe the change in a sentence.
49
+
50
+ ## How background work runs
51
+
52
+ 1. The secretary writes the objective, background, authorization boundaries and acceptance criteria into a task and hands it to the worker.
53
+ 2. The worker executes in **its own session** using existing tools, under your current permissions and confirmation settings.
54
+ 3. When it reaches a checkpoint it reports back: completed, needs a decision, or waiting on an external event.
55
+ 4. The secretary relays the outcome to you; if a decision is required it asks first, then forwards your answer.
56
+
57
+ An existing item can take further requests in the same session — no need to start a new one.
58
+
59
+ ## Notes
60
+
61
+ - Background runs never block the conversation: interrupt, change requirements, or cancel at any time.
62
+ - The worker does not widen its own authorization. If a step needs new permission or falls outside scope, it comes back to ask.
63
+ - **Completed** means this round delivered a result, not that you accepted it — send feedback to keep refining.
64
+ - Recurring plans depend on the local service running; nothing fires while the machine or server is down.
65
+
66
+ ## Extension info
67
+
68
+ - Extension ID: `secretary`
69
+ - Contributes: the **Secretary** agent, the hidden **Secretary Worker** agent, the `delegate_work` / `manage_work` / `yield_work` tools, the **Work** panel, and `/api/ext/secretary/work`