openclacky 1.5.21 → 1.5.23

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +119 -0
  3. data/docs/secretary-prototype.md +286 -0
  4. data/lib/clacky/agent/session_serializer.rb +15 -11
  5. data/lib/clacky/agent.rb +58 -15
  6. data/lib/clacky/agent_config.rb +3 -1
  7. data/lib/clacky/agent_profile.rb +33 -6
  8. data/lib/clacky/billing/platform_billing.rb +9 -0
  9. data/lib/clacky/default_extensions/advisor/README.md +25 -0
  10. data/lib/clacky/default_extensions/advisor/README.zh.md +25 -0
  11. data/lib/clacky/default_extensions/advisor/ext.yml +1 -1
  12. data/lib/clacky/default_extensions/advisor/icon.svg +14 -0
  13. data/lib/clacky/default_extensions/coding/ext.yml +0 -1
  14. data/lib/clacky/default_extensions/computer-use/README.md +48 -0
  15. data/lib/clacky/default_extensions/computer-use/README.zh.md +48 -0
  16. data/lib/clacky/default_extensions/computer-use/ext.yml +1 -1
  17. data/lib/clacky/default_extensions/computer-use/icon.svg +16 -0
  18. data/lib/clacky/default_extensions/ext-studio/ext.yml +0 -1
  19. data/lib/clacky/default_extensions/general/ext.yml +0 -1
  20. data/lib/clacky/default_extensions/git/README.md +41 -0
  21. data/lib/clacky/default_extensions/git/README.zh.md +41 -0
  22. data/lib/clacky/default_extensions/git/ext.yml +1 -1
  23. data/lib/clacky/default_extensions/git/icon.svg +15 -0
  24. data/lib/clacky/default_extensions/git/panels/git/view.js +1960 -399
  25. data/lib/clacky/default_extensions/meeting/README.md +46 -0
  26. data/lib/clacky/default_extensions/meeting/README.zh.md +47 -0
  27. data/lib/clacky/default_extensions/meeting/ext.yml +1 -1
  28. data/lib/clacky/default_extensions/meeting/icon.svg +13 -0
  29. data/lib/clacky/default_extensions/preview/README.md +29 -0
  30. data/lib/clacky/default_extensions/preview/README.zh.md +29 -0
  31. data/lib/clacky/default_extensions/preview/ext.yml +1 -1
  32. data/lib/clacky/default_extensions/preview/icon.svg +13 -0
  33. data/lib/clacky/default_extensions/preview/panels/preview/view.js +199 -34
  34. data/lib/clacky/default_extensions/secretary/agents/secretary.md +41 -0
  35. data/lib/clacky/default_extensions/secretary/agents/worker.md +35 -0
  36. data/lib/clacky/default_extensions/secretary/api/handler.rb +8 -0
  37. data/lib/clacky/default_extensions/secretary/ext.yml +39 -0
  38. data/lib/clacky/default_extensions/secretary/panels/work/view.js +344 -0
  39. data/lib/clacky/default_extensions/secretary/tools/delegate_work.rb +37 -0
  40. data/lib/clacky/default_extensions/secretary/tools/manage_work.rb +22 -0
  41. data/lib/clacky/default_extensions/secretary/tools/yield_work.rb +35 -0
  42. data/lib/clacky/default_extensions/time_machine/README.md +32 -0
  43. data/lib/clacky/default_extensions/time_machine/README.zh.md +32 -0
  44. data/lib/clacky/default_extensions/time_machine/ext.yml +1 -1
  45. data/lib/clacky/default_extensions/time_machine/icon.svg +14 -0
  46. data/lib/clacky/default_skills/channel-manager/SKILL.md +79 -8
  47. data/lib/clacky/default_skills/channel-manager/discord_setup.rb +5 -1
  48. data/lib/clacky/default_skills/channel-manager/weixin_setup.rb +8 -1
  49. data/lib/clacky/default_skills/cron-task-creator/SKILL.md +183 -206
  50. data/lib/clacky/default_skills/cron-task-creator/evals/evals.json +45 -0
  51. data/lib/clacky/default_skills/media-gen/SKILL.md +17 -8
  52. data/lib/clacky/extension/api_extension.rb +10 -2
  53. data/lib/clacky/extension/loader.rb +2 -0
  54. data/lib/clacky/extension/verifier.rb +2 -2
  55. data/lib/clacky/locales/en.rb +14 -0
  56. data/lib/clacky/locales/zh.rb +14 -0
  57. data/lib/clacky/prompts/base.md +1 -1
  58. data/lib/clacky/providers.rb +68 -31
  59. data/lib/clacky/search_config.rb +33 -11
  60. data/lib/clacky/server/channel/adapters/base.rb +18 -0
  61. data/lib/clacky/server/channel/adapters/feishu/message_parser.rb +1 -0
  62. data/lib/clacky/server/channel/adapters/telegram/adapter.rb +1 -0
  63. data/lib/clacky/server/channel/channel_config.rb +185 -48
  64. data/lib/clacky/server/channel/channel_manager.rb +179 -66
  65. data/lib/clacky/server/git_panel.rb +362 -35
  66. data/lib/clacky/server/http_server.rb +530 -181
  67. data/lib/clacky/server/preview.rb +118 -17
  68. data/lib/clacky/server/scheduler.rb +211 -51
  69. data/lib/clacky/server/web_ui_controller.rb +35 -27
  70. data/lib/clacky/session_manager.rb +56 -6
  71. data/lib/clacky/tools/base.rb +7 -1
  72. data/lib/clacky/utils/file_processor.rb +20 -10
  73. data/lib/clacky/utils/mac_app_detector.rb +8 -7
  74. data/lib/clacky/utils/model_pricing.rb +60 -2
  75. data/lib/clacky/utils/windows_app_detector.rb +3 -1
  76. data/lib/clacky/version.rb +1 -1
  77. data/lib/clacky/web/app.css +1114 -205
  78. data/lib/clacky/web/app.js +143 -8
  79. data/lib/clacky/web/auth.js +1 -1
  80. data/lib/clacky/web/components/code-editor.js +73 -4
  81. data/lib/clacky/web/components/composer.js +107 -8
  82. data/lib/clacky/web/components/image-zoom.js +165 -0
  83. data/lib/clacky/web/components/model-picker.js +7 -5
  84. data/lib/clacky/web/components/notify.js +39 -12
  85. data/lib/clacky/web/components/onboard.js +1 -1
  86. data/lib/clacky/web/core/aside.js +60 -3
  87. data/lib/clacky/web/features/billing/view.js +2 -2
  88. data/lib/clacky/web/features/channels/store.js +19 -4
  89. data/lib/clacky/web/features/channels/view.js +92 -28
  90. data/lib/clacky/web/features/extensions/view.js +17 -10
  91. data/lib/clacky/web/features/new-session/store.js +79 -2
  92. data/lib/clacky/web/features/new-session/view.js +516 -75
  93. data/lib/clacky/web/features/skills/store.js +1 -1
  94. data/lib/clacky/web/features/tasks/store.js +5 -3
  95. data/lib/clacky/web/features/tasks/view.js +249 -66
  96. data/lib/clacky/web/features/workspace/store.js +13 -6
  97. data/lib/clacky/web/features/workspace/view.js +340 -214
  98. data/lib/clacky/web/i18n.js +366 -68
  99. data/lib/clacky/web/index.html +196 -165
  100. data/lib/clacky/web/projects.js +37 -4
  101. data/lib/clacky/web/sessions.js +263 -146
  102. data/lib/clacky/web/settings.js +241 -53
  103. data/lib/clacky/web/skills.js +2 -2
  104. data/lib/clacky/web/theme.js +17 -2
  105. data/lib/clacky/web/utils.js +234 -2
  106. data/lib/clacky/web/weixin-qr.html +2 -1
  107. data/lib/clacky/web/ws-dispatcher.js +14 -31
  108. data/lib/clacky/work/service.rb +542 -0
  109. data/lib/clacky/work/store.rb +57 -0
  110. metadata +31 -1
@@ -33,6 +33,51 @@
33
33
  "显示了变更前后的对比",
34
34
  "任务文件内容未被修改"
35
35
  ]
36
+ },
37
+ {
38
+ "id": 4,
39
+ "prompt": "当前是普通会话。帮我每天早上9点生成一份早报,在独立执行会话里查看。",
40
+ "expected_output": "使用原有 cron API 创建普通任务,不因早报名称而添加秘书归属。",
41
+ "assertions": [
42
+ "POST 不包含 owner_session_id",
43
+ "使用 cron 0 9 * * *",
44
+ "说明独立执行会话的结果位置,不承诺回到当前对话"
45
+ ]
46
+ },
47
+ {
48
+ "id": 5,
49
+ "prompt": "当前是秘书会话,CLACKY_SESSION_ID 是有效秘书会话。每天晚上8点汇总我的工作进展,并在这里告诉我。",
50
+ "expected_output": "通过同一个 cron skill/API 创建有秘书归属的计划。",
51
+ "assertions": [
52
+ "从环境读取实际 CLACKY_SESSION_ID 作为 owner_session_id",
53
+ "使用 cron 0 20 * * *",
54
+ "不调用 manage_work 创建计划",
55
+ "说明结果回到归属秘书会话",
56
+ "不要求 timezone 参数"
57
+ ]
58
+ },
59
+ {
60
+ "id": 6,
61
+ "prompt": "当前是秘书会话。把旧任务 daily_file_summary 改到每天18点。GET 显示该计划没有 target。",
62
+ "expected_output": "只 PATCH cron,保留普通任务执行方式。",
63
+ "assertions": [
64
+ "使用 PATCH 而非删除重建",
65
+ "只修改 cron 为 0 18 * * *",
66
+ "不添加 owner_session_id 或改变执行类型",
67
+ "不修改任务内容"
68
+ ]
69
+ },
70
+ {
71
+ "id": 7,
72
+ "prompt": "当前是普通会话。查看 morning_report 的结果并立刻运行一次。GET 显示该计划 target.type 为 secretary_work,归属会话为 secretary_a。",
73
+ "expected_output": "依据保存的秘书目标选择工作历史和运行结果目的地。",
74
+ "assertions": [
75
+ "通过归属会话的 work API 并按 schedule_name 查询工作记录",
76
+ "调用原 cron run API",
77
+ "说明结果仍回到 secretary_a,不回到当前会话",
78
+ "不将缺少 cron last_run 当作没有执行过",
79
+ "409 时不绕过限制创建普通任务"
80
+ ]
36
81
  }
37
82
  ]
38
83
  }
@@ -190,10 +190,19 @@ When the user gives a vague request like "给我配张图", ask one clarifying q
190
190
  - The user wants a **diagram / chart** with specific data — use a charting library (matplotlib, mermaid, etc.) instead; image gen is for illustrations, not data viz
191
191
  - The user asks for **screenshots** of real software — use the browser tool
192
192
 
193
- ## Generating video (Veo)
193
+ ## Generating video (Gemini Omni / Veo)
194
194
 
195
195
  The same `/api/media/` namespace serves video generation. The user must
196
- configure a `type=video` model in settings (recommended: `or-veo-3-1`).
196
+ configure a `type=video` model in settings (recommended: `or-gemini-omni-flash`).
197
+
198
+ | Model | Duration | Notes |
199
+ |------------------------|----------|-------|
200
+ | `or-gemini-omni-flash` | 3–15 s | Default. Newest, ~$0.07/s at 720p. |
201
+ | `or-veo-3-1` | 4–8 s | Best cinematic quality, ~$0.40/s. |
202
+ | `or-veo-3-1-fast` | 4–8 s | ~$0.10/s. |
203
+ | `or-veo-3-1-lite` | 4–8 s | Cheapest, ~$0.05/s. |
204
+
205
+ Out-of-range durations are clamped by the gateway, not rejected.
197
206
 
198
207
  ### Endpoint
199
208
 
@@ -231,7 +240,7 @@ curl -s -X POST http://${CLACKY_SERVER_HOST}:${CLACKY_SERVER_PORT}/api/media/vid
231
240
  |--------------------|----------|---------------------------------|-------|
232
241
  | `prompt` | yes | string | Same prompt-craft tips as images apply. |
233
242
  | `aspect_ratio` | no | `landscape` / `portrait` | Defaults to `landscape` (16:9). |
234
- | `duration_seconds` | no | 4–8 | Defaults to 8. |
243
+ | `duration_seconds` | no | 3–15 (Omni) / 4–8 (Veo) | Defaults to 8. |
235
244
  | `image` | no | `{ "b64_json": "...", "mime_type": "image/png" }` | Optional first frame for image-to-video. |
236
245
  | `output_dir` | no | absolute path | The exact directory the file is written to — nothing is appended. Use the directory the user asked for; otherwise `$(pwd)/assets/generated` as shown in the example. |
237
246
  | `session_id` | yes | string | Current Clacky session ID. Always pass the rendered value shown in the request example. |
@@ -262,10 +271,10 @@ Same shape and `error_type` values as image generation, but with `"video": null`
262
271
 
263
272
  ### Continuous / long video (last-frame chaining)
264
273
 
265
- A single Veo call maxes out at 8 seconds, and separate calls are visually
274
+ A single call maxes out at 15 seconds (Omni) or 8 seconds (Veo), and separate calls are visually
266
275
  **unrelated** (the character, lighting and framing jump between clips). To make
267
276
  several clips flow as one continuous shot, chain them: take the **last frame**
268
- of clip N and feed it as the `image` (first frame) of clip N+1. Veo's
277
+ of clip N and feed it as the `image` (first frame) of clip N+1. The model's
269
278
  image-to-video then continues from exactly where the previous clip ended, so
270
279
  the seam is smooth.
271
280
 
@@ -320,9 +329,9 @@ Rules & caveats:
320
329
  slower re-encode (and may letterbox). Use the same `aspect_ratio` everywhere.
321
330
  - **Cost adds up linearly** — N segments ≈ N × single-clip price. Confirm the
322
331
  number of segments and total length with the user before starting.
323
- - For >30s or a true single-take >8s with no seam at all, this client-side
324
- chaining is the practical option today; Veo's native server-side `extend`
325
- (148s) is not wired into this endpoint yet.
332
+ - For >30s or a true single-take longer than one clip with no seam at all,
333
+ this client-side chaining is the practical option today; the native
334
+ server-side `extend` (Veo / Omni) is not wired into this endpoint yet.
326
335
 
327
336
  ### Seedance — multimodal video
328
337
 
@@ -250,6 +250,10 @@ module Clacky
250
250
  self.class.meta["config"] || {}
251
251
  end
252
252
 
253
+ def work_service
254
+ @http_server&.work_service
255
+ end
256
+
253
257
  def session_manager
254
258
  @http_server&.instance_variable_get(:@session_manager)
255
259
  end
@@ -329,11 +333,13 @@ module Clacky
329
333
  end
330
334
 
331
335
  # Submit a prompt to an existing session for execution.
336
+ # prompt is model input; display_message overrides its visible text; reference_contexts
337
+ # supply both UI badges and model reference context.
332
338
  # Returns the session_id on success.
333
339
  # Raises Halt (409) if the session is already running and `interrupt: false`.
334
340
  # When `interrupt: true`, supersedes the current turn (raises AgentInterrupted
335
341
  # on the running thread, waits up to 2s for it to exit) then runs the new task.
336
- def submit_task(session_id, prompt, display_message: nil, interrupt: false)
342
+ def submit_task(session_id, prompt, display_message: nil, interrupt: false, reference_contexts: nil)
337
343
  reg = registry
338
344
  error!("server not ready", status: 503) unless reg
339
345
 
@@ -351,7 +357,9 @@ module Clacky
351
357
  old_thread&.join(2)
352
358
  end
353
359
 
354
- @http_server.send(:run_session_task, session_id, prompt, display_message: display_message)
360
+ options = { display_message: display_message }
361
+ options[:reference_contexts] = reference_contexts if reference_contexts
362
+ @http_server.send(:run_session_task, session_id, prompt, **options)
355
363
  session_id
356
364
  end
357
365
 
@@ -502,6 +502,8 @@ module Clacky
502
502
  "title_zh" => spec["title_zh"].to_s,
503
503
  "prompt" => spec["prompt"],
504
504
  "prompt_abs" => prompt_abs,
505
+ "base_agent" => spec["base_agent"],
506
+ "work_agent" => spec["work_agent"],
505
507
  "avatar" => avatar_rel,
506
508
  "avatar_abs" => avatar_abs,
507
509
  "description" => spec["description"].to_s,
@@ -16,13 +16,13 @@ module Clacky
16
16
  module ExtensionVerifier
17
17
  Issue = Struct.new(:ext, :unit, :level, :code, :message, :file, :hint, keyword_init: true)
18
18
 
19
- KNOWN_TOP_KEYS = %w[id name name_zh display_name display_name_zh title description description_zh emoji version origin author homepage license public license_required keywords enabled_by_default config contributes].freeze
19
+ KNOWN_TOP_KEYS = %w[id name name_zh display_name display_name_zh title description description_zh emoji icon version origin author homepage license public license_required keywords enabled_by_default config contributes].freeze
20
20
  KNOWN_CONTRIBUTES = %w[panels api skills agents channels patches hooks tools].freeze
21
21
 
22
22
  PANEL_KEYS = %w[id title title_zh description description_zh view order attach entry_points].freeze
23
23
  API_KEYS = %w[id handler].freeze
24
24
  SKILL_KEYS = %w[id dir protected].freeze
25
- AGENT_KEYS = %w[id title title_zh description description_zh order prompt panels skills disabled_skills avatar hidden tools].freeze
25
+ AGENT_KEYS = %w[id base_agent work_agent title title_zh description description_zh order prompt panels skills disabled_skills avatar hidden tools].freeze
26
26
  CHANNEL_KEYS = %w[id platform adapter].freeze
27
27
  PATCH_KEYS = %w[target file fingerprint on_mismatch].freeze
28
28
  HOOK_KEYS = %w[event file].freeze
@@ -3,6 +3,20 @@
3
3
  module Clacky
4
4
  module Locales
5
5
  EN = {
6
+ "work.delegating" => "Delegate: %<title>s",
7
+ "work.delegated" => "Created work item “%<title>s”, waiting to start. Follow its progress in the Work panel.",
8
+ "work.queued" => "Waiting to start",
9
+ "work.cancelled" => "Cancelled by you",
10
+ "work.paused" => "Paused; add instructions to continue",
11
+ "work.interrupted" => "Interrupted by a server restart. Review progress and add instructions to continue.",
12
+ "work.running" => "In progress",
13
+ "work.started" => "Starting: %<title>s",
14
+ "work.missing_result" => "Execution ended without a yield_work result. Review the execution history.",
15
+ "work.completed" => "Work completed: %<title>s",
16
+ "work.needs_user" => "Your decision needed: %<title>s",
17
+ "work.failed" => "Work needs attention: %<title>s",
18
+ "work.reply_received" => "Reply received; waiting to resume",
19
+
6
20
  "phase.skill_evolution" => "Reflecting on this task",
7
21
  "phase.memory_update" => "Updating long-term memory",
8
22
  "llm.error.insufficient_credit" => "Insufficient credit, please top up your account to continue",
@@ -3,6 +3,20 @@
3
3
  module Clacky
4
4
  module Locales
5
5
  ZH = {
6
+ "work.delegating" => "委派:%<title>s",
7
+ "work.delegated" => "已创建工作事项「%<title>s」,等待执行。可在工作事项面板跟进。",
8
+ "work.queued" => "等待执行",
9
+ "work.cancelled" => "用户已取消",
10
+ "work.paused" => "用户已暂停,补充要求后可继续",
11
+ "work.interrupted" => "执行因服务重启中断,请核实进展后补充要求以继续。",
12
+ "work.running" => "执行中",
13
+ "work.started" => "开始处理:%<title>s",
14
+ "work.missing_result" => "执行结束但没有调用 yield_work 交回结果,请检查执行记录。",
15
+ "work.completed" => "工作已完成:%<title>s",
16
+ "work.needs_user" => "需要你确认:%<title>s",
17
+ "work.failed" => "工作需要处理:%<title>s",
18
+ "work.reply_received" => "收到回复,等待继续执行",
19
+
6
20
  "phase.skill_evolution" => "正在复盘本次任务",
7
21
  "phase.memory_update" => "正在更新长期记忆",
8
22
  "llm.error.insufficient_credit" => "API Key 账户余额不足,请前往控制台充值后继续使用",
@@ -3,7 +3,7 @@
3
3
  - Ask clarifying questions if requirements are unclear.
4
4
  - Break down complex tasks into manageable steps.
5
5
  - **USE TOOLS to create/modify files** — don't just return content.
6
- - When the user asks to send/download a file or you generate one for them, append `[filename](file:///absolute/path/to/file)` at the end of your reply. Use the exact absolute path the write tool returned — don't rewrite or abbreviate it with `~` (keep non-ASCII characters and spaces literal); never URL-encode it.
6
+ - When the user asks to send/download a file or you generate one for them, append `[filename](file:///absolute/path/to/file)` at the end of your reply (for images use `![filename](file:///absolute/path/to/image)` so they show inline). Use the exact absolute path the write tool returned — don't rewrite or abbreviate it with `~` (keep non-ASCII characters and spaces literal); never URL-encode it.
7
7
 
8
8
  ## Tool Usage Rules
9
9
 
@@ -36,7 +36,7 @@ module Clacky
36
36
  "default_model" => "auto",
37
37
  "models" => [
38
38
  "auto",
39
- "dsk-deepseek-flash",
39
+ "dsk-deepseek-v4.1-flash",
40
40
  "dsk-deepseek-v4-pro",
41
41
  "oc-glm-5.3",
42
42
  "oc-kimi-k3",
@@ -69,32 +69,43 @@ module Clacky
69
69
  # only — the platform may dispatch to OpenRouter or Vertex AI
70
70
  # (Gemini Nano Banana family) depending on the model.
71
71
  "image_models" => [
72
+ "or-gemini-nano-banana-2-1",
72
73
  "or-gemini-3-pro-image",
73
74
  "or-gemini-3-1-flash-image",
75
+ "or-gemini-3-1-flash-lite-image",
76
+ "or-gpt-image-2-5",
77
+ "or-gpt-image-2-5-flare",
74
78
  "or-gpt-image-2"
75
79
  ],
76
80
  "image_model_aliases" => {
77
- "or-gemini-3-pro-image" => "Nano Banana Pro",
78
- "or-gemini-3-1-flash-image" => "Nano Banana 2",
79
- "or-gpt-image-2" => "GPT Image 2"
81
+ "or-gemini-nano-banana-2-1" => "Nano Banana 2.1",
82
+ "or-gemini-3-pro-image" => "Nano Banana Pro",
83
+ "or-gemini-3-1-flash-image" => "Nano Banana 2",
84
+ "or-gemini-3-1-flash-lite-image" => "Nano Banana 2 Lite",
85
+ "or-gpt-image-2-5" => "GPT Image 2.5",
86
+ "or-gpt-image-2-5-flare" => "GPT Image 2.5 Flare",
87
+ "or-gpt-image-2" => "GPT Image 2"
80
88
  },
81
- "default_image_model" => "or-gemini-3-1-flash-image",
82
- # Video generation models served by the openclacky gateway, which
83
- # routes them to Vertex AI Veo (async predictLongRunning under the
84
- # hood; the gateway hides the polling and returns the MP4 inline).
89
+ "default_image_model" => "or-gemini-nano-banana-2-1",
90
+ # Video generation models served by the openclacky gateway. Gemini
91
+ # Omni Flash rides Vertex's Interactions API (token-billed, 3–15s);
92
+ # the Veo 3.1 family uses async predictLongRunning (per-second, 4–8s).
93
+ # The gateway hides the polling and returns the MP4 inline for both.
94
+ # Veo 3 / Veo 3 Fast are still routable server-side for old configs
95
+ # but no longer offered: same price as 3.1 with older quality.
85
96
  "video_models" => [
97
+ "or-gemini-omni-flash",
86
98
  "or-veo-3-1",
87
99
  "or-veo-3-1-fast",
88
- "or-veo-3",
89
- "or-veo-3-fast"
100
+ "or-veo-3-1-lite"
90
101
  ],
91
102
  "video_model_aliases" => {
92
- "or-veo-3-1" => "Veo 3.1",
93
- "or-veo-3-1-fast" => "Veo 3.1 Fast",
94
- "or-veo-3" => "Veo 3",
95
- "or-veo-3-fast" => "Veo 3 Fast"
103
+ "or-gemini-omni-flash" => "Gemini Omni Flash",
104
+ "or-veo-3-1" => "Veo 3.1",
105
+ "or-veo-3-1-fast" => "Veo 3.1 Fast",
106
+ "or-veo-3-1-lite" => "Veo 3.1 Lite"
96
107
  },
97
- "default_video_model" => "or-veo-3-1",
108
+ "default_video_model" => "or-gemini-omni-flash",
98
109
  # Text-to-speech models served by the openclacky gateway, which
99
110
  # routes them to Vertex AI Gemini 2.5 (responseModalities=["AUDIO"]).
100
111
  # The gateway returns WAV inline as base64.
@@ -148,9 +159,11 @@ module Clacky
148
159
  # vision=true; oc-gpt-6.1-sol, oc-gpt-6-astra, oc-gpt-6-sol and
149
160
  # oc-gpt-6-luna do too.
150
161
  "model_capabilities" => {
151
- "dsk-deepseek-flash" => { "vision" => true }.freeze,
152
- "dsk-deepseek-v4-pro" => { "vision" => false }.freeze,
153
- "oc-glm-5.3" => { "vision" => false }.freeze
162
+ "dsk-deepseek-v4.1-flash" => { "vision" => true }.freeze,
163
+ # Legacy alias still sent by sessions created before the rename.
164
+ "dsk-deepseek-flash" => { "vision" => true }.freeze,
165
+ "dsk-deepseek-v4-pro" => { "vision" => false }.freeze,
166
+ "oc-glm-5.3" => { "vision" => false }.freeze
154
167
  }.freeze,
155
168
  # Bedrock GPT models (abs-gpt-*) are served through the OpenAI
156
169
  # Responses API — their Chat Completions endpoint rejects function
@@ -166,7 +179,7 @@ module Clacky
166
179
  # themselves, so they're intentionally not listed here as keys —
167
180
  # no injection happens when the default model is already lite-class.
168
181
  "lite_models" => {
169
- "auto" => "dsk-deepseek-flash",
182
+ "auto" => "dsk-deepseek-v4.1-flash",
170
183
  "abs-claude-fable-5-1" => "abs-claude-haiku-5-5",
171
184
  "abs-claude-fable-5" => "abs-claude-haiku-5-5",
172
185
  "abs-claude-opus-5-5" => "abs-claude-haiku-5-5",
@@ -180,7 +193,7 @@ module Clacky
180
193
  "abs-gpt-6-sol" => "abs-gpt-6-luna",
181
194
  "abs-gpt-5.6-sol" => "abs-gpt-5.6-luna",
182
195
  "abs-gpt-5.6-terra" => "abs-gpt-5.6-luna",
183
- "dsk-deepseek-v4-pro" => "dsk-deepseek-flash",
196
+ "dsk-deepseek-v4-pro" => "dsk-deepseek-v4.1-flash",
184
197
  "or-gemini-3-1-pro" => "or-gemini-3-8-flash"
185
198
  },
186
199
  # Fallback chain: if a model is unavailable, try the next one in order.
@@ -213,7 +226,7 @@ module Clacky
213
226
  "base_url" => "https://api.deepseek.com",
214
227
  "api" => "openai-completions",
215
228
  "default_model" => "deepseek-v4-pro",
216
- "lite_model" => "deepseek-flash",
229
+ "lite_model" => "deepseek-v4.1-flash",
217
230
  # Note: deepseek-chat and deepseek-reasoner are legacy aliases being
218
231
  # deprecated on 2026-07-24; they map to V4.1 Flash's non-thinking and
219
232
  # thinking modes respectively.
@@ -221,14 +234,21 @@ module Clacky
221
234
  # longer offered upstream, so they are out of this list: only their
222
235
  # pricing entries remain, to let already-billed history resolve.
223
236
  "models" => [
224
- "deepseek-flash",
237
+ "deepseek-v4.1-flash",
225
238
  "deepseek-v4-pro",
226
239
  ],
227
240
  # DeepSeek V4 API is text-only across all models, except V4.1 Flash
228
- # (deepseek-flash), which is natively multimodal.
241
+ # (deepseek-v4.1-flash), which is natively multimodal.
229
242
  "capabilities" => { "vision" => false }.freeze,
230
243
  "model_capabilities" => {
231
- "deepseek-flash" => { "vision" => true }.freeze
244
+ "deepseek-v4.1-flash" => { "vision" => true }.freeze,
245
+ # Legacy id kept for configs saved before the rename.
246
+ "deepseek-flash" => { "vision" => true }.freeze
247
+ }.freeze,
248
+ # The upstream API still exposes V4.1 Flash as "deepseek-flash"; the
249
+ # picker shows the generation name.
250
+ "api_model_aliases" => {
251
+ "deepseek-v4.1-flash" => "deepseek-flash"
232
252
  }.freeze,
233
253
  "deepseek_web_tools" => true,
234
254
  "website_url" => "https://platform.deepseek.com/api_keys"
@@ -271,8 +291,8 @@ module Clacky
271
291
  "name" => "Kimi (Moonshot)",
272
292
  "base_url" => "https://api.moonshot.cn/v1",
273
293
  "api" => "openai-completions",
274
- "default_model" => "kimi-k3",
275
- "models" => ["kimi-k3", "kimi-k2.7-code", "kimi-k2.7-code-highspeed", "kimi-k2.6"],
294
+ "default_model" => "kimi-k3.1-pro",
295
+ "models" => ["kimi-k3.1-pro", "kimi-k3.1-pro-highspeed", "kimi-k3", "kimi-k2.7-code", "kimi-k2.7-code-highspeed", "kimi-k2.6"],
276
296
  # Moonshot operates two regional endpoints with identical APIs & model
277
297
  # lineup — mainland China (.cn) and international (.ai). These are the
278
298
  # pay-as-you-go Open Platform endpoints; the subscription-billed
@@ -288,7 +308,7 @@ module Clacky
288
308
  { "label" => "Mainland China", "label_key" => "settings.models.baseurl.variant.mainland_cn", "base_url" => "https://api.moonshot.cn/v1", "region" => "cn" }.freeze,
289
309
  { "label" => "International", "label_key" => "settings.models.baseurl.variant.international", "base_url" => "https://api.moonshot.ai/v1", "region" => "intl" }.freeze
290
310
  ].freeze,
291
- # k3 / k2.7-code / k2.6 are multimodal; legacy k2 text-only models need model_capabilities override if added.
311
+ # k3.1-pro / k3 / k2.7-code / k2.6 are multimodal; legacy k2 text-only models need model_capabilities override if added.
292
312
  "capabilities" => { "vision" => true }.freeze,
293
313
  "default_ocr_model" => "kimi-k3",
294
314
  "website_url" => "https://platform.moonshot.cn/console/api-keys"
@@ -574,17 +594,20 @@ module Clacky
574
594
  "doubao-seed-evolving",
575
595
  "doubao-seed-2.1-pro",
576
596
  "doubao-seed-2.1-turbo",
597
+ "doubao-seed-2.1-lite",
577
598
  "doubao-seed-2.0-mini",
578
- "doubao-seed-2.0-lite",
579
599
  "minimax-m3",
580
- "kimi-k2.7-code",
600
+ "kimi-k3.1-pro",
581
601
  "kimi-k3",
602
+ "kimi-k2.7-code",
582
603
  # GLM-5.2 is delisted from Ark on 2026-08-31, so new setups only
583
604
  # offer GLM-5.3. It is available on the Coding/Agent Plan endpoints;
584
605
  # the pay-as-you-go endpoint does not carry it yet (no versioned id),
585
606
  # so no payg alias is registered for it.
586
607
  "glm-5.3",
587
608
  "glm-5.3-flash",
609
+ "deepseek-v4.1-flash",
610
+ "deepseek-v4.1-flash-economy",
588
611
  "deepseek-v4-pro",
589
612
  "deepseek-v4-flash"
590
613
  ],
@@ -605,14 +628,21 @@ module Clacky
605
628
  "glm-5.2" => "glm-5-2-260617",
606
629
  "deepseek-v4-pro" => "deepseek-v4-pro-260425",
607
630
  "deepseek-v4-flash" => "deepseek-v4-flash-260425",
631
+ "deepseek-v4.1-flash" => "deepseek-v4-1-flash-261017",
632
+ "deepseek-v4.1-flash-economy" => "deepseek-v4-1-flash-economy-261017",
633
+ "kimi-k3.1-pro" => "kimi-k3-1-pro-261024",
608
634
  "doubao-seed-2.1-pro" => "doubao-seed-2-1-pro-260628",
609
635
  "doubao-seed-2.1-turbo" => "doubao-seed-2-1-turbo-260628",
636
+ "doubao-seed-2.1-lite" => "doubao-seed-2-1-lite-260915",
610
637
  "doubao-seed-2.0-mini" => "doubao-seed-2-0-mini-260428",
638
+ # doubao-seed-2.0-lite is delisted in favor of 2.1-lite; the alias
639
+ # stays so existing configs keep working.
611
640
  "doubao-seed-2.0-lite" => "doubao-seed-2-0-lite-260428"
612
641
  }.freeze
613
642
  }.freeze,
614
643
  # Most Doubao/multimodal models accept image input; GLM-5.2/5.3 and
615
- # DeepSeek-V4 on Ark are text-only. GLM-5.3-Flash inherits vision=true.
644
+ # DeepSeek-V4 on Ark are text-only. GLM-5.3-Flash and DeepSeek-V4.1
645
+ # (incl. economy) inherit vision=true.
616
646
  "capabilities" => { "vision" => true }.freeze,
617
647
  "model_capabilities" => {
618
648
  "glm-5.3" => { "vision" => false }.freeze,
@@ -621,7 +651,7 @@ module Clacky
621
651
  "deepseek-v4-flash" => { "vision" => false }.freeze,
622
652
  "minimax-m2.7" => { "vision" => false }.freeze
623
653
  }.freeze,
624
- "default_ocr_model" => "doubao-seed-2.0-lite",
654
+ "default_ocr_model" => "doubao-seed-2.1-lite",
625
655
  "website_url" => "https://console.volcengine.com/ark/region:cn-beijing/overview"
626
656
  }.freeze,
627
657
 
@@ -1083,6 +1113,10 @@ module Clacky
1083
1113
  # Plan endpoints accept the short "doubao-seed-2.1-pro"). Users always see
1084
1114
  # and pick the short name; this swaps it just before the request goes out.
1085
1115
  #
1116
+ # The map comes in two shapes:
1117
+ # - grouped by endpoint variant: { "payg" => { short => real } }
1118
+ # - flat, endpoint-independent: { short => real } (e.g. DeepSeek)
1119
+ #
1086
1120
  # Returns the original model unchanged when no alias applies (unknown
1087
1121
  # provider, endpoint without an alias group, or model not in the map).
1088
1122
  #
@@ -1100,6 +1134,9 @@ module Clacky
1100
1134
  aliases = preset && preset["api_model_aliases"]
1101
1135
  return model unless aliases.is_a?(Hash)
1102
1136
 
1137
+ flat = aliases[model.to_s]
1138
+ return flat if flat.is_a?(String)
1139
+
1103
1140
  group = alias_group_for_base_url(preset, base_url)
1104
1141
  return model unless group
1105
1142
 
@@ -16,8 +16,9 @@ module Clacky
16
16
  # provider: tavily — "deepseek_web" for DeepSeek's hosted
17
17
  # search/fetch, blank for built-in engines only,
18
18
  # otherwise the basename of a script in ~/.clacky/searchers/
19
- # key: tvly-xxx — credential for the selected provider (optional for
20
- # deepseek_web, which can reuse a configured model key)
19
+ # keys: — credentials per provider, so switching providers never
20
+ # tavily: tvly-xxx hands one provider's key to another (optional for
21
+ # deepseek_web, which can reuse a configured model key)
21
22
  #
22
23
  # A missing file, or one without a `provider` key, means "never chosen" and
23
24
  # resolves to the free chain.
@@ -33,27 +34,43 @@ module Clacky
33
34
  DEEPSEEK_WEB = "deepseek_web"
34
35
 
35
36
  class << self
36
- # @return [Hash] { "provider" => String, "key" => String }
37
+ # @return [Hash] { "provider" => String, "keys" => { provider => String } }
37
38
  def load
38
39
  raw = File.exist?(CONFIG_PATH) ? YAML.load_file(CONFIG_PATH) : nil
39
40
  return default_config unless raw.is_a?(Hash)
40
41
 
41
- {
42
- "provider" => raw["provider"].to_s.strip,
43
- "key" => raw["key"].to_s.strip
44
- }
42
+ provider = raw["provider"].to_s.strip
43
+ keys = {}
44
+ (raw["keys"].is_a?(Hash) ? raw["keys"] : {}).each do |name, value|
45
+ value = value.to_s.strip
46
+ keys[name.to_s] = value unless value.empty?
47
+ end
48
+ # Files written before keys were split hold one key for the provider then selected.
49
+ legacy = raw["key"].to_s.strip
50
+ keys[provider] ||= legacy unless provider.empty? || legacy.empty?
51
+
52
+ { "provider" => provider, "keys" => keys }
45
53
  rescue StandardError
46
54
  default_config
47
55
  end
48
56
 
57
+ # The key is stored under the resulting provider; a blank key removes it.
49
58
  def save(provider: nil, key: nil)
50
59
  current = load
51
60
  new_provider = provider.nil? ? current["provider"] : provider.to_s.strip
52
- new_key = key.nil? ? current["key"] : key.to_s.strip
61
+ keys = current["keys"]
62
+ unless key.nil? || new_provider.empty?
63
+ key = key.to_s.strip
64
+ if key.empty?
65
+ keys.delete(new_provider)
66
+ else
67
+ keys[new_provider] = key
68
+ end
69
+ end
53
70
 
54
71
  payload = {
55
72
  "provider" => new_provider,
56
- "key" => new_key
73
+ "keys" => keys
57
74
  }
58
75
 
59
76
  FileUtils.mkdir_p(File.dirname(CONFIG_PATH))
@@ -70,7 +87,7 @@ module Clacky
70
87
  end
71
88
 
72
89
  private def default_config
73
- { "provider" => "", "key" => "" }
90
+ { "provider" => "", "keys" => {} }
74
91
  end
75
92
 
76
93
  # Absolute path of the configured searcher, or nil when unset/missing.
@@ -84,7 +101,12 @@ module Clacky
84
101
  end
85
102
 
86
103
  def key
87
- load["key"]
104
+ config = load
105
+ config["keys"][config["provider"]].to_s
106
+ end
107
+
108
+ def key_for(provider)
109
+ load["keys"][provider.to_s].to_s
88
110
  end
89
111
  end
90
112
  end
@@ -26,6 +26,24 @@ module Clacky
26
26
  # Base adapter interface for IM platforms.
27
27
  # Subclasses must implement every abstract method below.
28
28
  class Base
29
+ DEFAULT_INSTANCE_ID = "default"
30
+
31
+ attr_writer :instance_id, :instance_name
32
+
33
+ # Identifier of the configured instance this adapter serves. The first
34
+ # instance of a platform keeps the historical id "default".
35
+ # @return [String]
36
+ def instance_id
37
+ id = @instance_id.to_s
38
+ id.empty? ? DEFAULT_INSTANCE_ID : id
39
+ end
40
+
41
+ # Human-readable name of this instance (e.g. "Company Feishu").
42
+ # @return [String]
43
+ def instance_name
44
+ @instance_name.to_s
45
+ end
46
+
29
47
  # @return [Symbol] e.g. :feishu, :wecom
30
48
  def self.platform_id
31
49
  raise NotImplementedError, "#{self} must implement .platform_id"
@@ -112,6 +112,7 @@ module Clacky
112
112
  file_attachments: file_attachments,
113
113
  doc_urls: extract_doc_urls(text),
114
114
  message_id: message_id,
115
+ reply_to: message["parent_id"],
115
116
  timestamp: timestamp,
116
117
  chat_type: chat_type,
117
118
  mentioned_open_ids: Array(message["mentions"]).filter_map { |m| m.dig("id", "open_id") },
@@ -276,6 +276,7 @@ module Clacky
276
276
  text: text.strip,
277
277
  files: files,
278
278
  message_id: msg["message_id"].to_s,
279
+ reply_to: msg.dig("reply_to_message", "message_id")&.to_s,
279
280
  timestamp: msg["date"] ? Time.at(msg["date"]) : Time.now,
280
281
  chat_type: is_group ? :group : :direct,
281
282
  raw: msg