Compare commits

...

285 Commits

Author SHA1 Message Date
Peter Steinberger
769908ec3f chore(release): prepare 2026.4.11 2026-04-12 01:05:56 +01:00
Vincent Koc
329a0f00ce fix(canvas): refresh a2ui bundle hash 2026-04-12 00:37:14 +01:00
Peter Steinberger
65267c14d4 chore(release): refresh generated baselines 2026-04-12 00:22:32 +01:00
Peter Steinberger
1bdd8166b6 chore(config): refresh bundled channel metadata 2026-04-12 00:22:32 +01:00
Peter Steinberger
e08f4c12da test(parallels): stop windows gateway before update 2026-04-12 00:22:32 +01:00
Peter Steinberger
247705b59c test(parallels): bound macos dashboard curl 2026-04-12 00:22:32 +01:00
Peter Steinberger
270a3999e2 test(parallels): recover macos update gateway start 2026-04-12 00:22:32 +01:00
Peter Steinberger
e20464935a test(parallels): avoid host Safari substitution 2026-04-12 00:22:32 +01:00
Peter Steinberger
0e3f9657da fix(plugins): preserve bundled host compatibility floor 2026-04-12 00:22:32 +01:00
Peter Steinberger
ada95aefa9 test(parallels): stop gateway listener before npm update 2026-04-12 00:22:32 +01:00
Peter Steinberger
6debabb002 test(parallels): retry killed Windows fresh install 2026-04-12 00:22:32 +01:00
Peter Steinberger
7740c4d530 fix(agents): narrow debug proxy URL override 2026-04-12 00:22:32 +01:00
Peter Steinberger
a60ff003fb test(parallels): stop gateway before npm update 2026-04-12 00:22:32 +01:00
Peter Steinberger
66be8cdc57 test(parallels): stop stale gateway after npm update 2026-04-12 00:22:32 +01:00
Peter Steinberger
e26edee39e fix(context-engine): bundle legacy runtime registration 2026-04-12 00:22:32 +01:00
Vincent Koc
9aa9c3ff62 fix(auto-reply): stop mention-only inline status turns 2026-04-12 00:19:16 +01:00
Vincent Koc
44e95065c4 fix(agents): split preemptive compaction route types 2026-04-12 00:13:11 +01:00
Vincent Koc
3059b36306 fix(config): split command flag helpers 2026-04-12 00:05:01 +01:00
Vincent Koc
09a41b2da4 fix(plugin-sdk): untangle tts runtime facade types 2026-04-11 23:58:44 +01:00
Josh Lehman
29142a9d47 fix: preserve Telegram topic routing for exec completions (#64580)
* clawdbot-a2c: pin exec completion delivery context

Regeneration-Prompt: |
  Fix a Telegram forum topic misroute where delayed exec completion or similar async completion text could be delivered into the wrong topic after the session's stored route drifted. Keep the patch surgical. Preserve immutable origin deliveryContext when background exec completion events are queued, thread that context from the exec tool's ambient channel/session defaults into the process session, and ensure the queued system event carries it instead of relying on later heartbeat fallback to mutable session lastTo/lastThreadId data. Add one focused unit assertion that notifyOnExit events keep the original Telegram topic delivery context and one heartbeat regression that proves work started in topic 47 still delivers back to topic 47 even if the session store later points at topic 2175.

* fix: note Telegram exec topic routing

Regeneration-Prompt: |
  Prepare PR #64580 after review-pr with no blocking findings. The only required prep change was the workflow-mandated changelog entry under CHANGELOG.md -> Unreleased -> Fixes. Preserve the review conclusion that the code change is already acceptable, do not widen scope beyond the changelog, and include the PR number plus thanks attribution in the changelog line for the Telegram exec forum-topic completion routing fix.
2026-04-11 15:47:53 -07:00
Vincent Koc
a948e28244 fix(cycles): narrow provider runtime error hook types 2026-04-11 23:42:50 +01:00
Vincent Koc
d9357f9f39 fix(cycles): split command detection runtime types 2026-04-11 23:38:35 +01:00
Vincent Koc
876fc4e43c fix(cycles): narrow plugin auto enable imports 2026-04-11 23:33:41 +01:00
Vincent Koc
10f2e81c04 fix(cycles): split abort runtime resolver types 2026-04-11 23:27:32 +01:00
Vincent Koc
5cd9c2d2de fix(cycles): bypass context engine and config barrels 2026-04-11 23:12:24 +01:00
Vincent Koc
0e8225c4a6 fix(cycles): narrow channel registry imports 2026-04-11 22:59:39 +01:00
Vincent Koc
8470dc8e06 fix(cycles): split reply config runtime seams 2026-04-11 22:52:51 +01:00
Vincent Koc
61da711b1a fix(cycles): split provider runtime model types 2026-04-11 22:50:45 +01:00
Vincent Koc
53fde90dc2 fix(cycles): use loaded channel prompt hints 2026-04-11 22:32:43 +01:00
Vincent Koc
8ec838a0d4 fix(cycles): split session hook event types 2026-04-11 22:25:33 +01:00
Vincent Koc
a88fbf0f64 fix(cycles): split reply payload and option contracts 2026-04-11 22:24:55 +01:00
Vincent Koc
25665dd335 fix(runtime): bypass get-reply barrel exports 2026-04-11 21:56:48 +01:00
Vincent Koc
b1290e61fd fix(plugin-sdk): narrow reply payload type surface 2026-04-11 21:52:31 +01:00
Vincent Koc
8a9ead6211 fix(reply): bypass heavy error helper imports 2026-04-11 21:47:40 +01:00
Vincent Koc
35664d5447 fix(agents): extract user-facing text sanitizer 2026-04-11 21:47:21 +01:00
Vincent Koc
3607cea991 fix(plugins): split setup registry runtime types 2026-04-11 21:36:07 +01:00
Peter Steinberger
057fe786bd style: apply formatter drift 2026-04-11 21:25:24 +01:00
Peter Steinberger
b41091ac7f fix: quiet extension unresolved import warnings 2026-04-11 21:25:24 +01:00
Vincent Koc
0f6f80004f Update INCIDENT_RESPONSE.md 2026-04-11 21:22:40 +01:00
Vincent Koc
7808d3f08f fix(pairing): export channel type from store seam 2026-04-11 21:21:10 +01:00
Vincent Koc
d7fcd23091 fix(runtime): split cli provider and abort seams 2026-04-11 21:16:50 +01:00
Vincent Koc
dc469a3db5 fix(gateway): preserve channel plugin identity in cache 2026-04-11 21:15:32 +01:00
Vincent Koc
cde21de828 fix(pairing): bypass store and channel barrels 2026-04-11 21:09:59 +01:00
Vincent Koc
8e952eba75 fix(core): align channel runtime and inventory types 2026-04-11 21:03:44 +01:00
Vincent Koc
05db7299f5 fix(agents): split messaging send types 2026-04-11 20:42:19 +01:00
Vincent Koc
1300f8e077 fix(plugins): narrow memory runtime imports 2026-04-11 20:29:59 +01:00
Vincent Koc
7d1bd0c98c fix(tts): split shared tts config types 2026-04-11 20:25:02 +01:00
Vincent Koc
44f02dbbc6 fix(agents): split effective tool inventory types 2026-04-11 20:24:20 +01:00
Vincent Koc
f1c4e2f11d fix(agents): split queued embedded compaction wrapper 2026-04-11 20:23:46 +01:00
Vincent Koc
9d717176d3 fix(plugins): split pairing runtime store types 2026-04-11 20:22:57 +01:00
Vincent Koc
0c4a19d060 fix(plugins): narrow runtime channel registry state 2026-04-11 20:01:32 +01:00
Vincent Koc
b1caec142f fix(logging): avoid message channel registry back-edge 2026-04-11 19:52:03 +01:00
RyanLee
415578c4dc fix(minimax): add missing api and authHeader to portal OAuth configPatch (#64964)
Merged via squash.

Prepared head SHA: 39bc34f9f9
Co-authored-by: ryanlee666 <33855278+ryanlee666@users.noreply.github.com>
Co-authored-by: odysseus0 <8635094+odysseus0@users.noreply.github.com>
Reviewed-by: @odysseus0
2026-04-11 11:50:43 -07:00
Vincent Koc
462d8e3bc0 fix(cycles): narrow channel runtime surface 2026-04-11 19:30:33 +01:00
HDYA
26f633b604 feat(msteams): add federated credential support (certificate + managed identity) (#53615)
* feat(msteams): add federated authentication support (certificate + managed identity + workload identity)

* msteams: fix vitest 4.1.2 compat, type errors, and regenerate config baseline

* msteams: fix lint errors, update fetch allowlist, regenerate protocol Swift

* fix(msteams): gate secret-only delegated auth flows

* fix(ci): unblock gateway watch and install smoke

* fix(ci): restore mergeability for pr 53615

* fix(ci): restore channel registry helper typing

* fix(ci): refresh raw fetch guard allowlist

---------

Co-authored-by: Chudi Huang <Chudi.Huang@microsoft.com>
Co-authored-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
2026-04-11 13:29:22 -05:00
stain lu
acd3697162 fix(agents): prevent cross-provider error context leak in fallback chain (#62907)
Merged via squash.

Prepared head SHA: 06a3a82816
Co-authored-by: stainlu <109842185+stainlu@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
2026-04-11 19:15:26 +01:00
Vincent Koc
97b60b992c fix(channels): narrow runtime channel registry caching 2026-04-11 19:12:36 +01:00
Vincent Koc
1ce87cda52 fix(skills): bypass config and skills barrel imports 2026-04-11 18:58:31 +01:00
Vincent Koc
04ca103090 fix(channels): bypass public channel meta types 2026-04-11 18:53:11 +01:00
Nimrod Gutman
8923e9bcba fix(auto-reply): preserve image attachment notes (#64918)
* fix(auto-reply): preserve image attachment notes

* fix(auto-reply): harden media note rendering

* fix: preserve image attachment notes (#64918) (thanks @ngutman)
2026-04-11 20:49:36 +03:00
Vincent Koc
6738e9abdf fix(gateway): bypass sessions barrel types 2026-04-11 18:46:43 +01:00
sudie-codes
ba1b8424f4 fix(msteams): wire CLI --media path into pending upload store (#49784) (#64646)
* fix(msteams): wire CLI --media path into FS-backed pending upload store (#49784)

* test(msteams): clean up temp dirs in pending-uploads-fs.test.ts

* test(msteams): satisfy pending upload fs lint

---------

Co-authored-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
2026-04-11 12:45:14 -05:00
Vincent Koc
abd5e34104 fix(config): bypass control ui origins barrel 2026-04-11 18:36:48 +01:00
Vincent Koc
0f7d9c9570 fix(runtime): split approval and gateway client seams 2026-04-11 18:36:48 +01:00
Tak Hoffman
958c34e82c feat(qa-lab): Add proxy capture stack and QA Lab inspector (#64895)
* Add proxy capture core and CLI

* Expand transport capture coverage

* Add QA Lab capture backend

* Refine QA Lab capture UI

* Fix proxy capture review feedback

* Fix proxy run cleanup and TTS capture

* Fix proxy capture transport follow-ups

* Fix debug proxy CONNECT target parsing

* Harden QA Lab asset path containment
2026-04-11 12:34:57 -05:00
Nimrod Gutman
f04e045815 fix(context-engine): restore bundled legacy engine loading (#64936) 2026-04-11 20:31:49 +03:00
Vincent Koc
7f5a5a34db fix(plugins): split hook contract types 2026-04-11 18:06:18 +01:00
Vincent Koc
4a799e77d7 fix(runtime): split reply dispatcher type surface 2026-04-11 17:46:58 +01:00
Vincent Koc
e03db28ba7 fix(plugins): split hook runner registry types 2026-04-11 17:46:58 +01:00
Tak Hoffman
49b42b4a45 fix(release): handle nested default-wrapped bundled channel entries 2026-04-11 11:36:44 -05:00
Vincent Koc
f3f1ab0a3f fix(plugin-sdk): use outbound adapter leaf types 2026-04-11 17:32:36 +01:00
Vincent Koc
f630e8d440 fix(utils): bypass delivery context wrapper for shared consumers 2026-04-11 17:26:38 +01:00
Peter Steinberger
e1b2ae235a docs: clarify strict-agentic and codex modes 2026-04-11 17:13:40 +01:00
Vincent Koc
899a1b7565 fix(runtime): drop media stt type back-edge 2026-04-11 17:08:24 +01:00
Josh Lehman
77a0ee7f9d fix: canonicalize topic session transcript fallback (#64869)
* fix: canonicalize topic session transcript fallback

When initSessionState has a topic-scoped SessionKey but no MessageThreadId, fallback transcript selection should still land on the topic-qualified JSONL path instead of the bare session file. Match the existing transcript resolver by parsing the thread id from the session key, and cover the regression with a session init test that loads the Telegram session-conversation grammar.

Regeneration-Prompt: |
  Investigate why a Telegram topic session could alternate between <session-id>.jsonl and <session-id>-topic-<n>.jsonl for the same logical session. The fix should be in OpenClaw's session initialization path, not in lossless-claw. Keep behavior unchanged when MessageThreadId is present, but when the inbound turn only carries a topic-scoped SessionKey, derive the same topic-specific transcript path that the canonical transcript resolver would use. Add a regression test that proves initSessionState chooses the topic-qualified file even without MessageThreadId, and make the test load the session-conversation registry needed to parse Telegram :topic: grammar.

* fix: preserve topic session transcript history
2026-04-11 09:06:49 -07:00
Peter Steinberger
b66b8562eb test: wait for VMs before update phase 2026-04-11 17:05:44 +01:00
Vincent Koc
2028fd53f0 fix(utils): split delivery context shared types 2026-04-11 17:03:38 +01:00
Marcus Castro
00a7439f64 scripts: require gh api auth in worktree setup 2026-04-11 13:02:52 -03:00
Vincent Koc
1f1b504980 fix(commands): split chat command listing surface 2026-04-11 16:58:43 +01:00
Peter Steinberger
da127a3a29 test: extend Windows update poll timeout 2026-04-11 16:52:42 +01:00
Vincent Koc
796d4dfc49 fix(reply): split dispatcher shared types 2026-04-11 16:52:18 +01:00
Peter Steinberger
bbc3849e24 test: allow npm qa compat sidecars 2026-04-11 16:49:44 +01:00
Vincent Koc
9656ae649c fix(channels): bypass public channel types in registry 2026-04-11 16:42:35 +01:00
Vincent Koc
9ae27f9297 fix(gateway): avoid duplicate channel runtime snapshot export 2026-04-11 16:38:43 +01:00
Vincent Koc
382ffcf9ab fix(cycles): split embedded subscribe shared types 2026-04-11 16:35:07 +01:00
Vincent Koc
c37aaf0b60 fix(cycles): bypass session binding service type import 2026-04-11 16:26:40 +01:00
Vincent Koc
7157244708 fix(cycles): bypass channel public session type import 2026-04-11 16:17:08 +01:00
Vincent Koc
6e74d77a42 fix(cycles): split media understanding runtime contracts 2026-04-11 16:17:08 +01:00
Peter Steinberger
0f77fdf4a0 test: tolerate Windows gateway restart timeout 2026-04-11 16:14:46 +01:00
Peter Steinberger
45586058e4 chore(release): refresh plugin sdk api hash 2026-04-11 16:10:13 +01:00
Peter Steinberger
788c37a6c2 chore(release): prepare 2026.4.11-beta.1 2026-04-11 16:10:13 +01:00
Vincent Koc
37bde69c17 fix(cycles): bypass media runtime sdk barrel 2026-04-11 15:57:54 +01:00
Vincent Koc
747b26ea0f fix(context-engine): lazy-load legacy engine registration 2026-04-11 15:45:19 +01:00
Vincent Koc
463190ed95 fix(tasks): lazy-load control runtime without static back-edge 2026-04-11 15:39:32 +01:00
Vincent Koc
97d1b88e3f fix(cycles): split plugin runtime contract leaf types 2026-04-11 15:39:32 +01:00
Marcus Castro
aaae1aeb8f fix(whatsapp): route react through gateway (#64638)
* fix(whatsapp): route react through gateway

* fix(gateway): accept full message action tool context
2026-04-11 11:38:10 -03:00
Peter Steinberger
545490c592 fix: handle codex app-server interrupt shutdown 2026-04-11 15:20:52 +01:00
Peter Steinberger
b489c8f55b test: resolve Parallels npm update Python 2026-04-11 14:57:59 +01:00
Vincent Koc
8a7ad8f0e0 fix(msteams): remove reaction handler type cycle 2026-04-11 14:55:25 +01:00
Vincent Koc
b9a0052dd0 fix(cycles): split embedded runner and setup leaf types 2026-04-11 14:49:48 +01:00
Peter Steinberger
24a5ba732f fix: harden docker smoke packaging 2026-04-11 14:40:01 +01:00
Peter Steinberger
ccfc97c235 test(channel-setup): mock channel metadata source 2026-04-11 14:31:00 +01:00
Peter Steinberger
e1b674cbf1 build: stabilize a2ui bundle hash 2026-04-11 14:29:02 +01:00
Peter Steinberger
0dd4958bc8 test(install): harden docker tgz smoke flow 2026-04-11 14:27:34 +01:00
Peter Steinberger
b7cc064961 fix(update): exclude private QA sidecars from package verify 2026-04-11 14:27:33 +01:00
Peter Steinberger
1f69790bed docs: note GPT-5.4 parity harness landing 2026-04-11 14:22:48 +01:00
Eva
108e5c89de qa-lab: scope parity metrics and harden fake-success detector
- scope computeQaAgenticParityMetrics to QA_AGENTIC_PARITY_SCENARIO_TITLES
  in buildQaAgenticParityComparison so extra non-parity lanes in a full
  qa-suite-summary.json cannot influence completion / unintended-stop /
  valid-tool / fake-success rates
- filter coverageMismatch by !parityTitleSet.has(name) so each required
  parity scenario fails the gate exactly once (from requiredScenarioCoverage)
  instead of being double-reported as a coverage mismatch too
- drop the bare /\\berror\\b/i rule from SUSPICIOUS_PASS_PATTERNS — it was
  false-flagging legitimate passes that narrate "Error budget: 0" or
  "no errors found" — and replace it with targeted /error occurred/i and
  /an error was/i phrases that indicate a real mid-turn error
- add regressions: error-budget/no-errors-observed passes yield
  fakeSuccessCount === 0, genuine error-occurred narration still flags,
  each missing required scenario fires exactly one failure line, and
  non-parity lanes do not perturb scoped metrics
- isolate the baseline suspicious-pass test by padding it to the full
  first-wave scenario set so it asserts the isolated fake-success path
  via toEqual([...]) rather than toContain
2026-04-11 14:22:48 +01:00
Eva
95f8ad215f Treat skipped parity scenarios as uncovered 2026-04-11 14:22:48 +01:00
Eva
17252df122 Tighten parity proof heuristics 2026-04-11 14:22:48 +01:00
Eva
fd45ea2bf1 test(qa): add compaction retry parity scenario 2026-04-11 14:22:48 +01:00
Eva
3211aa2540 fix(qa): surface missing required scenarios in parity report 2026-04-11 14:22:48 +01:00
Eva
55df6f11a4 fix: harden parity gate review findings 2026-04-11 14:22:48 +01:00
Eva
c73d005c7a docs: clarify parity verdict interpretation 2026-04-11 14:22:48 +01:00
Eva
db09edacfc qa-lab: gate parity on shared scenario coverage 2026-04-11 14:22:48 +01:00
Eva
67fdd3b4df benchmarks: add agentic parity report gate 2026-04-11 14:22:48 +01:00
Eva
79f539d9ce docs: clarify GPT-5.4 parity harness and review flow 2026-04-11 14:22:48 +01:00
Eva
d9c7ddb099 test: add agentic parity scenario pack 2026-04-11 14:22:48 +01:00
Peter Steinberger
0d733a28e1 build(canvas): refresh a2ui input hash 2026-04-11 14:19:51 +01:00
Peter Steinberger
a8284e39de build(canvas): stabilize a2ui bundle inputs 2026-04-11 14:19:25 +01:00
Peter Steinberger
9bde608f38 build: keep a2ui bundle generated 2026-04-11 14:18:04 +01:00
Peter Steinberger
0ed512bbdf build: refresh a2ui bundle 2026-04-11 14:18:04 +01:00
Vincent Koc
935bd6de7f fix(gateway): split credential secret input runtime 2026-04-11 14:15:42 +01:00
Peter Steinberger
85fa33d9d7 style: apply formatter drift 2026-04-11 14:08:55 +01:00
Peter Steinberger
2ffc19720b fix: restore channel auto-enable metadata 2026-04-11 14:08:55 +01:00
Peter Steinberger
40beb68fb0 chore: remove legacy shim packages 2026-04-11 14:07:29 +01:00
Peter Steinberger
419ab38ea2 test(msteams): stabilize oauth expiry assertion 2026-04-11 14:07:21 +01:00
Peter Steinberger
eb7bdbf980 docs: remove extension changelogs 2026-04-11 14:05:07 +01:00
Peter Steinberger
b646655a2d fix(ci): preserve channel auto-enable metadata 2026-04-11 14:03:08 +01:00
Peter Steinberger
564f64666b docs: remove plugin version-only changelog entries 2026-04-11 14:01:40 +01:00
Vincent Koc
759b5aa764 fix(cycles): narrow config type imports 2026-04-11 14:01:09 +01:00
Peter Steinberger
88be9b525c docs: update 2026.4.11 changelog 2026-04-11 14:00:42 +01:00
Peter Steinberger
9a8647cef7 fix: remove duplicate channel runtime export 2026-04-11 13:56:37 +01:00
Peter Steinberger
a82d8f04fb fix: clear rebase lint issues 2026-04-11 13:55:08 +01:00
Peter Steinberger
bf82a7c46e fix: keep browser cdp range wide for high ports 2026-04-11 13:55:08 +01:00
Peter Steinberger
4ca458b182 fix: preserve googlechat doctor semantics 2026-04-11 13:55:08 +01:00
Peter Steinberger
627ab39b6d perf: stabilize agent lane hotspots 2026-04-11 13:55:08 +01:00
Peter Steinberger
30e646ffab test: finish import performance cleanup 2026-04-11 13:55:08 +01:00
Peter Steinberger
ff7a842509 perf: reduce command and gateway test imports 2026-04-11 13:55:08 +01:00
Peter Steinberger
8ddd9b8aac perf: narrow plugin config test surfaces 2026-04-11 13:55:08 +01:00
Peter Steinberger
bb0bfabec8 perf: trim agent test runtime imports 2026-04-11 13:55:07 +01:00
Peter Steinberger
5915d7cb6b perf: optimize messaging plugin tests 2026-04-11 13:55:07 +01:00
Peter Steinberger
c7f18d9278 test: dedupe media provider tests 2026-04-11 13:55:07 +01:00
Peter Steinberger
baeec2f4b2 fix(ci): clean up rebased registry types 2026-04-11 13:54:07 +01:00
Peter Steinberger
684ce920fd fix(ci): restore channel public type exports 2026-04-11 13:54:07 +01:00
Vincent Koc
3b4de1ac14 fix(cycles): split reply and gateway leaf seams 2026-04-11 13:53:20 +01:00
Peter Steinberger
370efaa4a0 build(canvas): refresh a2ui bundle 2026-04-11 13:49:04 +01:00
Peter Steinberger
aa092045c0 fix(ui): remove stale preview assertion 2026-04-11 13:49:04 +01:00
Peter Steinberger
3e013342de fix(build): repair rebase export surfaces 2026-04-11 13:49:03 +01:00
Vincent Koc
81535d394d fix(cycles): repair broken type surfaces 2026-04-11 13:42:17 +01:00
sudie-codes
355794c24a msteams: add reaction support with delegated auth and pagination helper (#51646)
* msteams: add reaction support (inbound handlers + outbound Graph API)

* msteams: address PR #51646 review feedback

* msteams: remove react from advertised actions (requires Delegated auth)

* msteams: address PR #51646 remaining review feedback (dmPolicy, groupPolicy, reactions auth)

- Fix 1: DM reaction authorization now uses resolveDmGroupAccessWithLists to enforce
  dmPolicy modes (open/disabled/allowlist/pairing), matching the message handler.
- Fix 2: Group policy in reaction handler already uses resolveDefaultGroupPolicy
  for global defaults; moved declaration earlier to share with DM path.
- Fix 3: Restore read-only "reactions" (list) action with listReactionsMSTeams,
  which uses GET and works with Application auth. Keep "react" (write) gated
  behind delegated-auth.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: add shared Graph pagination helper (fetchAllGraphPages)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: add OAuth2 delegated auth flow (PKCE + authorization code)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: integrate delegated auth (config, token storage, react enablement)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: fix critical bugs found in architect review

- Fix fetchGraphJson→postGraphJson for setReaction/unsetReaction (was sending GET instead of POST)
- Fix CSRF bypass in OAuth parseCallbackInput (missing state no longer falls back silently)
- Remove stale delegated-auth warning logs (delegated auth is now implemented)
- Add CSRF test case for parseCallbackInput

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* msteams: fix 6 PR #51646 review blockers (PKCE/state separation, CSRF, imports, routing, delegated auth bootstrap)

* msteams: fix channel.runtime.ts duplicate imports + graph.ts test mock compat

* msteams: fix lint/boundary blockers revealed by CI after rebase

- token.ts/graph.test.ts: add curly braces around single-statement ifs
  (eslint/curly).
- oauth.flow.ts: rename unused parseCallbackInput param to _expectedState.
- reaction-handler.test.ts: rename unused buildDeps param to _runtime.
- send.reactions.ts: drop unnecessary non-null assertions on tuple entries.
- setup-surface.ts: drop empty-object spread fallback flagged by
  unicorn/no-useless-fallback-in-spread.
- graph.ts: move GraphPagedResponse/PaginatedResult type defs below
  requestGraph so the raw fetch() stays on line 47 to match the existing
  no-raw-channel-fetch allowlist entry.
- oauth.token.ts: route the Azure AD token exchange and refresh calls
  through fetchWithSsrFGuard (matches the pattern in sdk.ts), removing
  the unguarded raw fetch() callsites flagged by
  lint:tmp:no-raw-channel-fetch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(msteams): restore absolute Graph pagination helper

* fix(msteams): satisfy reaction handler lint

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
2026-04-11 07:41:47 -05:00
Vincent Koc
7c5b42e4f5 docs(changelog): note acp relay leak fix 2026-04-11 13:36:20 +01:00
Vincent Koc
7315914ee5 fix(acp): suppress commentary relay leakage 2026-04-11 13:36:20 +01:00
Ayaan Zaidi
43bd5545f8 fix: scope pinDns override to multipart audio (#64766) (thanks @GodsBoy) 2026-04-11 18:05:37 +05:30
GodsBoy
c159d22b34 fix(ssrf): validate hostname even when pinDns is disabled
When pinDns=false was set to avoid undici dispatcher corruption of
FormData bodies, resolvePinnedHostnameWithPolicy was skipped entirely,
removing SSRF hostname/private-IP validation.

Now the pinDns=false path runs hostname validation as a preflight
before creating the non-pinned dispatcher, preserving defense-in-depth.

Also renames a stale test description per Greptile review feedback.
2026-04-11 18:05:37 +05:30
GodsBoy
ed356d740d fix(media): disable pinned DNS dispatcher for FormData transcription requests
The SSRF guard's pinned DNS dispatcher (undici) corrupts FormData
multipart bodies, causing audio transcription to fail with HTTP 400
on OpenAI-compatible providers. Always set pinDns: false in
postTranscriptionRequest so native fetch handles FormData correctly.

SSRF hostname validation is preserved via resolvePinnedHostnameWithPolicy.
2026-04-11 18:05:37 +05:30
Tak Hoffman
d9812b85c4 fix(ui): preserve interleaved tool card pairing
(cherry picked from commit 5553d610e8)
2026-04-11 07:34:45 -05:00
Tak Hoffman
cc5c691f00 feat(ui): render assistant directives and add embed tag (#64104)
* Add embed rendering for Control UI assistant output

* Add changelog entry for embed rendering

* Harden canvas path resolution and stage isolation

* Secure assistant media route and preserve UI avatar override

* Fix chat media and history regressions

* Harden embed iframe URL handling

* Fix embed follow-up review regressions

* Restore offloaded chat attachment persistence

* Harden hook and media routing

* Fix embed review follow-ups

* feat(ui): add configurable embed sandbox mode

* fix(gateway): harden assistant media and auth rotation

* fix(gateway): restore websocket pairing handshake flows

* fix(gateway): restore ws hello policy details

* Restore dropped control UI shell wiring

* Fix control UI reconnect cleanup regressions

* fix(gateway): restore media root and auth getter compatibility

* feat(ui): rename public canvas tag to embed

* fix(ui): address remaining media and gateway review issues

* fix(ui): address remaining embed and attachment review findings

* fix(ui): restore stop control and tool card inputs

* fix(ui): address history and attachment review findings

* fix(ui): restore prompt contribution wiring

* fix(ui): address latest history and directive reviews

* fix(ui): forward password auth for assistant media

* fix(ui): suppress silent transcript tokens with media

* feat(ui): add granular embed sandbox modes

* fix(ui): preserve relative media directives in history

* docs(ui): document embed sandbox modes

* fix(gateway): restrict canvas history hoisting to tool entries

* fix(gateway): tighten embed follow-up review fixes

* fix(ci): repair merged branch type drift

* fix(prompt): restore stable runtime prompt rendering

* fix(ui): harden local attachment preview checks

* fix(prompt): restore channel-aware approval guidance

* fix(gateway): enforce auth rotation and media cleanup

* feat(ui): gate external embed urls behind config

* fix(ci): repair rebased branch drift

* fix(ci): resolve remaining branch check failures
2026-04-11 07:32:53 -05:00
Peter Steinberger
d83a85c70d fix(ci): harden plugin registry test seams 2026-04-11 13:31:11 +01:00
Luke
3da58226bf Ollama: cache model show metadata (#64753)
Merged via squash.

Prepared head SHA: de56dfb916
Co-authored-by: ImLukeF <92253590+ImLukeF@users.noreply.github.com>
Co-authored-by: ImLukeF <92253590+ImLukeF@users.noreply.github.com>
Reviewed-by: @ImLukeF
2026-04-11 22:30:24 +10:00
Vincent Koc
af428d9b8a fix(cycles): split runtime taskflow type surface 2026-04-11 13:26:50 +01:00
Vincent Koc
543c14a4ed fix(cycles): split runtime delivery and registry seams 2026-04-11 13:26:50 +01:00
Vincent Koc
41ab0f7d5c fix(gateway): add shared request handler types 2026-04-11 13:26:50 +01:00
Vincent Koc
74e7b8d47b fix(cycles): bulk extract leaf type surfaces 2026-04-11 13:26:50 +01:00
Vincent Koc
1167093773 test(qa): drop rebase conflict marker 2026-04-11 13:24:45 +01:00
Vincent Koc
afbc4a2ed5 docs(changelog): note codex qa leak fix 2026-04-11 13:23:26 +01:00
Vincent Koc
d21573d3a1 fix(qa): catch leaked harness meta replies 2026-04-11 13:23:26 +01:00
Peter Steinberger
d72fb7efb9 fix: harden QA scenario matcher validation 2026-04-11 13:19:13 +01:00
Peter Steinberger
f9331fbe68 test(install): add docker tgz update smoke flow 2026-04-11 13:13:11 +01:00
Peter Steinberger
cd89892b1f fix(release): keep private QA bundles out of npm pack 2026-04-11 13:13:11 +01:00
Peter Steinberger
a733e92c45 test: exercise real updater in Parallels npm flow 2026-04-11 13:04:14 +01:00
Peter Steinberger
48ac72f0ee perf: prefilter extension boundary parsing 2026-04-11 13:02:56 +01:00
Peter Steinberger
850182b502 test: combine extension import boundary checks 2026-04-11 12:59:53 +01:00
Peter Steinberger
d5f199adaf perf: cache parsed guard sources 2026-04-11 12:57:09 +01:00
Vincent Koc
4c5573653d docs(changelog): note qa packaging release fix 2026-04-11 12:55:13 +01:00
Peter Steinberger
53dea1d9c7 test: narrow web provider artifact invariants 2026-04-11 12:54:00 +01:00
Vincent Koc
636fe1c2db fix(qa): ship scenario pack and isolate completion cache 2026-04-11 12:53:56 +01:00
Peter Steinberger
8a8fdc971c perf: share web boundary source scans 2026-04-11 12:50:45 +01:00
Peter Steinberger
893a0f469a test: combine web provider boundary checks 2026-04-11 12:46:49 +01:00
Peter Steinberger
5f162973cf test: move send-keys validation to helper 2026-04-11 12:43:16 +01:00
Peter Steinberger
f770206311 test: combine task boundary scans 2026-04-11 12:38:18 +01:00
Peter Steinberger
1851aa7944 test: stage live external plugins 2026-04-11 12:36:09 +01:00
Vincent Koc
79c3dbecd1 feat(plugins): add manifest activation and setup descriptors (#64780) 2026-04-11 12:35:59 +01:00
Luke
d7479dc61a Agents: log proxy route summary (#64754)
Merged via squash.

Prepared head SHA: 3a668e9ba8
Co-authored-by: ImLukeF <92253590+ImLukeF@users.noreply.github.com>
Co-authored-by: ImLukeF <92253590+ImLukeF@users.noreply.github.com>
Reviewed-by: @ImLukeF
2026-04-11 21:30:58 +10:00
Vincent Koc
68fcd85bff fix(tasks): narrow control runtime override type 2026-04-11 12:03:16 +01:00
Vincent Koc
a866c51b9d test(video): narrow buffered live asset helper 2026-04-11 12:03:16 +01:00
Vincent Koc
d6fa67701e test(config): refresh generated base schema 2026-04-11 12:03:16 +01:00
Vincent Koc
75d7325e32 test(tasks): add control runtime override seam 2026-04-11 12:03:16 +01:00
Vincent Koc
8b29736b9c fix(tasks): shard test state by vitest worker 2026-04-11 12:03:16 +01:00
Vincent Koc
2d4209c1bf test(ci): align node shard check names 2026-04-11 12:03:16 +01:00
Vincent Koc
7899f5c5ce fix(dev): throttle local tsgo by default 2026-04-11 11:56:23 +01:00
Vincent Koc
571483a13d fix(test): narrow live video asset buffers 2026-04-11 11:19:46 +01:00
Vincent Koc
25c47231bb ci(checks): shorten node shard names 2026-04-11 11:12:33 +01:00
qiziAI
e339038cc0 Fix: Sync asyncCompletion config in zod-schema.ts to resolve "Unrecog… (#63618)
Merged via squash.

Prepared head SHA: dcce839c07
Co-authored-by: qiziAI <17017936+qiziAI@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
2026-04-11 11:12:09 +01:00
xieyongliang
e0a2c568b2 video_generate: support url-only delivery (#61988) (thanks @xieyongliang) (#61988)
Co-authored-by: George Zhang <georgezhangtj97@gmail.com>
2026-04-11 03:08:30 -07:00
Vincent Koc
52800131d2 fix(video): restore generation runtime params 2026-04-11 11:01:07 +01:00
Vincent Koc
08ba5a72f7 fix(cycles): add remaining seam files 2026-04-11 10:43:22 +01:00
Vincent Koc
7308e72fac fix(cycles): continue seam extraction 2026-04-11 10:43:22 +01:00
Vincent Koc
688327311c test(gateway): harden tools invoke cron regression harness 2026-04-11 10:39:56 +01:00
wittam-01
ebb72baba3 feat(feishu): improve document comment session, rich parsing, and typing feedback (#63785)
* Feishu: upgrade comment session, context parsing, and typing reaction

* test(feishu): align comment prompt assertions
2026-04-11 17:26:21 +08:00
xieyongliang
2c57ec7b5f video_generate: add providerOptions, inputAudios, and imageRoles (#61987)
* video_generate: add providerOptions, inputAudios, and imageRoles

- VideoGenerationSourceAsset gains an optional `role` field (e.g.
  "first_frame", "last_frame"); core treats it as opaque and forwards it
  to the provider unchanged.

- VideoGenerationRequest gains `inputAudios` (reference audio assets,
  e.g. background music) and `providerOptions` (arbitrary
  provider-specific key/value pairs forwarded as-is).

- VideoGenerationProviderCapabilities gains `maxInputAudios`.

- video_generate tool schema adds:
  - `imageRoles` array (parallel to `images`, sets role per asset)
  - `audioRef` / `audioRefs` (single/multi reference audio inputs)
  - `providerOptions` (JSON object passed through to the provider)
  - `MAX_INPUT_IMAGES` bumped 5 → 9; `MAX_INPUT_AUDIOS` = 3

- Capability validation extended to gate on `maxInputAudios`.

- runtime.ts threads `inputAudios` and `providerOptions` through to
  `provider.generateVideo`.

- Docs and runtime tests updated.

Made-with: Cursor

* docs: fix BytePlus Seedance capability table — split 1.5 and 2.0 rows

1.5 Pro supports at most 2 input images (first_frame + last_frame);
2.0 supports up to 9 reference images, 3 videos, and 3 audios.
Provider notes section updated accordingly.

Made-with: Cursor

* docs: list all Seedance 1.0 models in video-generation provider table

- Default model updated to seedance-1-0-pro-250528 (was the T2V lite)
- Provider notes now enumerate all five 1.0 model IDs with T2V/I2V capability notes

Made-with: Cursor

* video_generate: address review feedback (P1/P2)

P1: Add "adaptive" to SUPPORTED_ASPECT_RATIOS so provider-specific ratio
passthrough (used by Seedance 1.5/2.0) is accepted instead of throwing.
Update error message to include "adaptive" in the allowed list.

P1: Fix audio input capability default — when a provider does not declare
maxInputAudios, default to 0 (no audio support) instead of MAX_INPUT_AUDIOS.
Providers must explicitly opt in via maxInputAudios to accept audio inputs.

P2: Remove unnecessary type cast in imageRoles assignment; VideoGenerationSourceAsset
already declares role?: string so a non-null assertion suffices.

P2: Add videoRoles and audioRoles tool parameters, parallel to imageRoles,
so callers can assign semantic role hints to reference video and audio assets
(e.g. "reference_video", "reference_audio" for Seedance 2.0).

Made-with: Cursor

* video_generate: fix check-docs formatting and snake_case param reading

Made-with: Cursor

* video_generate: clarify *Roles are parallel to combined input list (P2)

Made-with: Cursor

* video_generate: add missing duration import; fix corrupted docs section

Made-with: Cursor

* video_generate: pass mode inputs to duration resolver; note plugin requirement (P2)

Made-with: Cursor

* plugin-sdk: sync new video-gen fields — role, inputAudios, providerOptions, maxInputAudios

Add fields introduced by core in the PR1 batch to the public plugin-sdk
mirror so TypeScript provider plugins can declare and consume them
without type assertions:
- VideoGenerationSourceAsset.role?: string
- VideoGenerationRequest.inputAudios and .providerOptions
- VideoGenerationModeCapabilities.maxInputAudios

The AssertAssignable bidirectional checks still pass because all new
fields are optional; this change makes the SDK surface complete.

Made-with: Cursor

* video-gen runtime: skip failover candidates lacking audio capability

Made-with: Cursor

* video-gen: fall back to flat capabilities.maxInputAudios in failover and tool validation

Made-with: Cursor

* video-gen: defer audio-count check to runtime, enabling fallback for audio-capable candidates

Made-with: Cursor

* video-gen: defer maxDurationSeconds check to runtime, enabling fallback for higher-cap candidates

Made-with: Cursor

* video-gen: add VideoGenerationAssetRole union and typed providerOptions capability

Introduces a canonical VideoGenerationAssetRole union (first_frame,
last_frame, reference_image, reference_video, reference_audio) for the
source-asset role hint, and a VideoGenerationProviderOptionType tag
('number' | 'boolean' | 'string') plus a new capabilities.providerOptions
schema that providers use to declare which opaque providerOptions keys
they accept and with what primitive type.

Types are additive and backwards compatible. The role field accepts both
canonical union values and arbitrary provider-specific strings via a
`VideoGenerationAssetRole | (string & {})` union, so autocomplete works
for the common case without blocking provider-specific extensions.

Runtime enforcement of providerOptions (skip-in-fallback, unknown key
and type mismatch) lands in a follow-up commit.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* video-gen: enforce typed providerOptions schema via skip-in-fallback

Adds `validateProviderOptionsAgainstDeclaration` in the video-generation
runtime and wires it into the `generateVideo` candidate loop alongside
the existing audio-count and duration-cap skip guards.

Behavior:
  - Candidates with no declared `capabilities.providerOptions` skip any
    non-empty providerOptions payload with a clear skip reason, so a
    provider that would ignore `{seed: 42}` and succeed without the
    caller's intent never gets reached.
  - Candidates that declare a schema reject unknown keys with the list
    of accepted keys in the error.
  - Candidates that declare a schema reject type mismatches (expected
    number/boolean/string) with the declared type in the error.
  - All skip reasons push into `attempts` so the aggregated failure
    message at the end of the fallback chain explains exactly why each
    candidate was rejected.

Also hardens the tool boundary: `providerOptions` that is not a plain
JSON object (including bogus arrays like `["seed", 42]`) now throws a
`ToolInputError` up front instead of being cast to `Record` and
forwarded with numeric-string keys.

Consistent with the audio/duration skip-in-fallback pattern introduced
by yongliang.xie in earlier commits on this branch.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* video-gen: harden *Roles parity + document canonical role values

Replaces the inline `parseRolesArg` lambda with a dedicated
`parseRoleArray` helper that throws a ToolInputError when the caller
supplies more roles than assets. Off-by-one alignment mistakes in
`imageRoles` / `videoRoles` / `audioRoles` now fail loudly at the tool
boundary instead of silently dropping trailing roles.

Also tightens the schema descriptions to document the canonical
VideoGenerationAssetRole values (first_frame, last_frame, reference_*)
and the skip-in-fallback contract on providerOptions, and rejects
non-array inputs to any `*Roles` field early rather than coercing them
to an empty list.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* video-gen: surface dropped aspectRatio sentinels in ignoredOverrides

"adaptive" and other provider-specific sentinel aspect ratios are
unparseable as numeric ratios, so when the active provider does not
declare the sentinel in caps.aspectRatios, `resolveClosestAspectRatio`
returns undefined and the previous code silently nulled out
`aspectRatio` without surfacing a warning.

Push the dropped value into `ignoredOverrides` so the tool result
warning path ("Ignored unsupported overrides for …") picks it up, and
the caller gets visible feedback that the request was dropped instead
of a silent no-op. Also corrects the tool-side comment on
SUPPORTED_ASPECT_RATIOS to describe actual behavior.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* video-gen: surface declared providerOptions + maxInputAudios in action=list

`video_generate action=list` now includes the declared providerOptions
schema (key:type) per provider, so agents can discover which opaque
keys each provider accepts without trial and error. Both mode-level and
flat-provider providerOptions declarations are merged, matching the
runtime lookup order in `generateVideo`.

Also surfaces `maxInputAudios` alongside the other max-input counts for
completeness — previously the list output did not expose the audio cap
at all, even though the tool validates against it.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* video-gen: warn once per request when runtime skips a fallback candidate

The skip-in-fallback guards (audio cap, duration cap, providerOptions)
all logged at debug level, which meant operators had no visible signal
when the primary provider was silently passed over in favor of a
fallback. Add a first-skip log.warn in the runtime loop so the reason
for the first rejection is surfaced once per request, and leave the
rest of the skip events at debug to avoid flooding on long chains.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* video-gen: cover new tool-level behavior with regression tests

Adds regression tests for:
  - providerOptions shape rejection (arrays, strings)
  - providerOptions happy-path forwarding to runtime
  - imageRoles length-parity guard
  - *Roles non-array rejection
  - positional role attachment to loaded reference images
  - audio data: URL templated rejection branch
  - aspectRatio='adaptive' acceptance and forwarding
  - unsupported aspectRatio rejection (mentions 'adaptive' in the error)

All eight new cases run in the existing video-generate-tool suite and
use the same provider-mock pattern already established in the file.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* video-gen: cover runtime providerOptions skip-in-fallback branches

Adds runtime regression tests for the new typed-providerOptions guard:
  - candidates without a declared providerOptions schema are skipped
    when any providerOptions is supplied (prevents silent drop)
  - candidates that declare a schema skip on unknown keys with the
    accepted-key list surfaced in the error
  - candidates that declare a schema skip on type mismatches with the
    declared type surfaced in the error
  - end-to-end fallback: openai (no providerOptions) is skipped and
    byteplus (declared schema) accepts the same request, with an
    attempt entry recording the first skip reason

Also updates the existing 'forwards providerOptions to the provider
unchanged' case so the destination provider declares the matching
typed schema, and wires a `warn` stub into the hoisted logger mock
so the new first-skip log.warn call path does not blow up.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* changelog: note video_generate providerOptions / inputAudios / role hints

Adds an Unreleased Changes entry describing the user-visible surface
expansion for video_generate: typed providerOptions capability,
inputAudios reference audio, per-asset role hints via the canonical
VideoGenerationAssetRole union, the 'adaptive' aspect-ratio sentinel,
maxInputAudios capability, and the relaxed 9-image cap.

Credits the original PR author.

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>

* byteplus: declare providerOptions schema (seed, draft, camerafixed) and forward to API

Made-with: Cursor

* byteplus: fix camera_fixed body field (API uses underscore, not camerafixed)

Made-with: Cursor

* fix(byteplus): normalize resolution to lowercase before API call

The Seedance API rejects resolution values with uppercase letters —
"480P", "720P" etc return InvalidParameter, while "480p", "720p"
are accepted. This was breaking the video generation live test
(resolveLiveVideoResolution returns "480P").

Normalize req.resolution to lowercase at the provider layer before
setting body.resolution, so any caller-supplied casing is corrected
without requiring changes to the VideoGenerationResolution type or
live-test helpers.

Verified via direct API call:
  body.resolution = "480P" → HTTP 400 InvalidParameter
  body.resolution = "480p" → task created successfully
  body.resolution = "720p" → task created successfully (t2v, i2v, 1.5-pro)
  body.resolution = "1080p" → task created successfully

Made-with: Cursor

* video-gen/byteplus: auto-select i2v model when input images provided with t2v model

Seedance 1.0 uses separate model IDs for T2V (seedance-1-0-lite-t2v-250428)
and I2V (seedance-1-0-lite-i2v-250428). When the caller requests a T2V model
but also provides inputImages, the API rejects with task_type i2v not supported
on t2v model.

Fix: when inputImages are present and the requested model contains "-t2v-",
auto-substitute "-i2v-" so the API receives the correct model. Seedance 1.5 Pro
uses a single model ID for both modes and is unaffected by this substitution.

Verified via live test: both mode=generate and mode=imageToVideo pass for
byteplus/seedance-1-0-lite-t2v-250428 with no failures.

Co-authored-by: odysseus0 <odysseus0@example.com>
Made-with: Cursor

* video-gen: fix duration rounding + align BytePlus (1.0) docs (P2)

Made-with: Cursor

* video-gen: relax providerOptions gate for undeclared-schema providers (P1)

Distinguish undefined (not declared = backward-compat pass-through) from
{} (explicitly declared empty = no options accepted) in
validateProviderOptionsAgainstDeclaration. Providers without a declared
schema receive providerOptions as-is; providers with an explicit empty
schema still skip. Typed schemas continue to validate key names and types.

Also: restore camera_fixed (underscore) in BytePlus provider schema and
body key (regression from earlier rebase), remove duplicate local
readBooleanToolParam definition now imported from media-tool-shared,
update tests and docs accordingly.

Made-with: Cursor

* video_generate: add landing follow-up coverage

* video_generate: finalize plugin-sdk baseline (#61987) (thanks @xieyongliang)

---------

Co-authored-by: yongliang.xie <yongliang.xie@bytedance.com>
Co-authored-by: George Zhang <georgezhangtj97@gmail.com>
Co-authored-by: odysseus0 <odysseus0@example.com>
2026-04-11 02:23:14 -07:00
Radek Sienkiewicz
f2a4a5ac21 fix(google): omit unsupported numberOfVideos in Veo requests (#64723)
Merged via squash.

Prepared head SHA: dadfd3351f
Co-authored-by: velvet-shark <126378+velvet-shark@users.noreply.github.com>
Co-authored-by: velvet-shark <126378+velvet-shark@users.noreply.github.com>
Reviewed-by: @velvet-shark
2026-04-11 11:17:01 +02:00
fuller-stack-dev
58708e6f88 fix: preserve Codex OAuth scopes (#64713) (thanks @fuller-stack-dev)
* fix(auth): preserve upstream Codex OAuth scopes

* test(auth): drop stale Codex OAuth helper test

* test(auth): colocate codex oauth coverage

* fix: preserve Codex OAuth scopes (#64713) (thanks @fuller-stack-dev)

* fix: place Codex OAuth changelog entry in Unreleased (#64713) (thanks @fuller-stack-dev)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-04-11 14:38:19 +05:30
Gustavo Garcia
bb543f71d9 fix(talk): fix ensure permissions on first execution of Talk Mode in MacOS (#62459)
* fix(talk): fix ensure permissions on first execution of Talk Mode in MacOS

* macos: fix talk mode formatting

* test: fix CI shard regressions

* docs: add talk mode changelog

---------

Co-authored-by: ImLukeF <92253590+ImLukeF@users.noreply.github.com>
2026-04-11 18:08:45 +10:00
Peter Steinberger
2681bbd9e7 test: move plugin list formatting to pure tests 2026-04-11 08:22:36 +01:00
Peter Steinberger
e2477ff726 test: move node pairing authz to pure coverage 2026-04-11 08:18:35 +01:00
Peter Steinberger
367043d1d1 test: fold sessions timeout checks into pure coverage 2026-04-11 08:15:19 +01:00
Peter Steinberger
7e66a8fcfe test: move plugin uninstall selection to pure tests 2026-04-11 08:12:34 +01:00
Peter Steinberger
5ca92b0498 test: move plugin update selection to pure tests 2026-04-11 08:08:41 +01:00
Peter Steinberger
10dcd57846 perf: keep queue and group parsing pure 2026-04-11 08:05:05 +01:00
Peter Steinberger
2cfd1459ef perf: split command body normalization 2026-04-11 08:00:26 +01:00
Peter Steinberger
66a081442f test: consolidate directive coverage 2026-04-11 07:54:50 +01:00
Peter Steinberger
7273cae36b test: move spawn and doctor coverage to owners 2026-04-11 07:54:19 +01:00
Peter Steinberger
32b252cabf test: move inline directive stripping coverage 2026-04-11 07:42:01 +01:00
Peter Steinberger
2b1d154533 test: narrow model override directive check 2026-04-11 07:37:52 +01:00
Peter Steinberger
36c412d81e test: move reserved help alias coverage 2026-04-11 07:33:55 +01:00
Peter Steinberger
8fb482268f perf: import queue settings directly 2026-04-11 07:33:54 +01:00
BitToby
c50d7183d6 fix: Fix webchat TTS tool audio delivery (#63514)
Merged via squash.

Prepared head SHA: ba92cbbd7c
Co-authored-by: bittoby <218712309+bittoby@users.noreply.github.com>
Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com>
Reviewed-by: @mukhtharcm
2026-04-11 12:02:07 +05:30
Peter Steinberger
be9b70c815 perf: short-circuit exact reply suppression targets 2026-04-11 07:26:19 +01:00
Peter Steinberger
9d45866038 test: mock telegram reply suppression fallback 2026-04-11 07:26:19 +01:00
ImLukeF
7f2814fc4a agents: honor explicit run timeout for LLM idle watchdog 2026-04-11 16:25:41 +10:00
Peter Steinberger
5605c89cb3 test: mock channel plugin lookup in media read policy 2026-04-11 07:20:06 +01:00
Peter Steinberger
01060d283d test: install task flow owner memory store after reset 2026-04-11 07:17:31 +01:00
Peter Steinberger
61ee69e110 test: isolate task flow owner registry 2026-04-11 07:15:36 +01:00
Peter Steinberger
b25c735684 test: make fuzzy model directive checks pure 2026-04-11 07:08:23 +01:00
Peter Steinberger
e2d93fb5bc perf: short-circuit static doctor channel capabilities 2026-04-11 07:03:48 +01:00
Peter Steinberger
9e3f4ed22f test: narrow elevated and queue directive checks 2026-04-11 07:00:06 +01:00
Peter Steinberger
7b29cb6ef6 test: narrow queue directive validation checks 2026-04-11 06:52:04 +01:00
Peter Steinberger
455535a4f9 perf: avoid plugin index for target normalization 2026-04-11 06:49:08 +01:00
ImLukeF
ddefce3c18 Config: align LLM idle timeout defaults 2026-04-11 15:48:58 +10:00
Peter Steinberger
3edc8d3028 test: mock message action aliases in normalization 2026-04-11 06:45:53 +01:00
Peter Steinberger
28291eba62 perf: avoid plugin registry in reply threading 2026-04-11 06:42:35 +01:00
Peter Steinberger
7a1cc53b18 test: mock message action channel aliases 2026-04-11 06:41:41 +01:00
Peter Steinberger
2721245848 perf: avoid reply payload barrel in followups 2026-04-11 06:36:48 +01:00
Peter Steinberger
e34e714c76 test: narrow think status directive checks 2026-04-11 06:33:45 +01:00
Peter Steinberger
d35bd8d264 test: narrow standalone directive checks 2026-04-11 06:30:58 +01:00
Peter Steinberger
e4e6f42192 test: narrow directive status checks 2026-04-11 06:28:44 +01:00
Peter Steinberger
f9afdf0a07 perf: avoid signal approval plugin lookup 2026-04-11 06:22:21 +01:00
Peter Steinberger
d86377acfd test: narrow doctor legacy config aliases 2026-04-11 06:19:17 +01:00
Peter Steinberger
279cbfc61c fix: restore memory wiki and dreaming checks 2026-04-11 06:15:21 +01:00
Ayaan Zaidi
6aafca5b5e fix: avoid qa scenario pack reads during packaged CLI startup (#64648) 2026-04-11 10:41:19 +05:30
Ayaan Zaidi
d8ab47d6af refactor: remove qa cli pass-through wrapper 2026-04-11 10:41:19 +05:30
Ayaan Zaidi
478a2e15c5 fix: narrow qa cli facade startup path 2026-04-11 10:41:19 +05:30
Peter Steinberger
788f0c625e test: shrink oversized image fixture 2026-04-11 06:10:01 +01:00
Peter Steinberger
850cdc3201 test: mock open-policy channel modes 2026-04-11 06:08:11 +01:00
Peter Steinberger
2e0ec2324c test: complete directive hook-runner mock 2026-04-11 06:06:09 +01:00
Mariano
64693d2e96 [codex] Dreaming: surface memory wiki imports and palace (#64505)
Merged via squash.

Prepared head SHA: 12d5e37222
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
2026-04-11 07:04:08 +02:00
Peter Steinberger
6492cc7428 test: isolate doctor repair sequencing 2026-04-11 06:01:40 +01:00
Peter Steinberger
cb01b0072d test: narrow doctor shared channel mocks 2026-04-11 05:58:47 +01:00
Peter Steinberger
c836fd22d0 test: narrow plugin auto-enable manifest coverage 2026-04-11 05:54:36 +01:00
Peter Steinberger
8ab84bceb3 test: make talk and compaction config checks pure 2026-04-11 05:52:03 +01:00
Peter Steinberger
d72cb14f78 test: make compaction config checks pure 2026-04-11 05:49:37 +01:00
Peter Steinberger
7591d01bdb perf: defer bundled channel metadata lookups 2026-04-11 05:44:40 +01:00
Peter Steinberger
2d6519dcb9 perf: defer bundled channel presence lookups 2026-04-11 05:42:01 +01:00
Peter Steinberger
70c0a64595 test: mock channel configured state seams 2026-04-11 05:37:03 +01:00
Peter Steinberger
9f5e476d27 test: avoid channel contract imports in config policy tests 2026-04-11 05:34:31 +01:00
Peter Steinberger
f25fd327c3 test: reduce config validation imports 2026-04-11 05:32:20 +01:00
Peter Steinberger
3d9792b6d0 test: make imessage legacy config checks pure 2026-04-11 05:27:38 +01:00
Peter Steinberger
12e11342cb test: use discord schema in config tests 2026-04-11 05:20:29 +01:00
Peter Steinberger
97c9a362f7 test: use channel schemas for webhook validation 2026-04-11 05:16:51 +01:00
Peter Steinberger
feef387a75 test: narrow config defaults regressions 2026-04-11 05:11:47 +01:00
Peter Steinberger
fcf31eef64 test: narrow whatsapp auto-enable validation 2026-04-11 05:07:01 +01:00
Tak Hoffman
bf544bc9e9 docs: fix active memory gateway command 2026-04-10 23:02:13 -05:00
Peter Steinberger
40975ec9f1 test: use channel schemas in config regressions 2026-04-11 05:01:14 +01:00
Peter Steinberger
ad7ad62632 test: narrow allowed-values validation coverage 2026-04-11 04:57:11 +01:00
Peter Steinberger
c38d4438c6 test: use provider schemas for config policy checks 2026-04-11 04:53:23 +01:00
Peter Steinberger
1ab6e5dbf0 chore(release): bump version to 2026.4.11 2026-04-11 04:51:17 +01:00
Peter Steinberger
af41acc8a6 chore(release): update macOS appcast for v2026.4.10 2026-04-11 04:32:55 +01:00
Peter Steinberger
dfd4e9f8a1 fix(release): write npm auth for latest promotion 2026-04-11 04:29:25 +01:00
Yonatan
38cd7f72b6 fix(whatsapp): resolve configured default account in single-arg setActiveWebListener overload (#53918)
Merged via squash.

Prepared head SHA: ad9be63835
Co-authored-by: yhyatt <10474956+yhyatt@users.noreply.github.com>
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Reviewed-by: @mcaxtr
2026-04-11 00:25:16 -03:00
Ayaan Zaidi
959b1472dc test(qa-lab): include telegram mentioned-message scenario 2026-04-11 08:48:42 +05:30
Ayaan Zaidi
b0b0fb308d feat(qa-lab): add telegram mentioned-message scenario 2026-04-11 08:48:42 +05:30
Ayaan Zaidi
a0b5c7b0c4 test(qa-lab): cover telegram command demo scenarios 2026-04-11 08:48:42 +05:30
Ayaan Zaidi
7c14d8b0f4 feat(qa-lab): add telegram command demo scenarios 2026-04-11 08:48:42 +05:30
Ayaan Zaidi
f9a03f0f4b test(qa-lab): cover telegram mention-gating 2026-04-11 08:48:42 +05:30
Ayaan Zaidi
355690a72c feat(qa-lab): add telegram mention-gating scenario 2026-04-11 08:48:42 +05:30
Peter Steinberger
d515009c53 fix(ci): stabilize auto-reply CI tests 2026-04-11 04:09:10 +01:00
Peter Steinberger
44e5b62c27 fix(macos): harden shell executor timeouts 2026-04-11 03:58:20 +01:00
George Zhang
9a4a9a5993 Heartbeat: spread interval runs across stable phases (#64560)
Merged via squash.

Prepared head SHA: 774ede6408
Co-authored-by: odysseus0 <8635094+odysseus0@users.noreply.github.com>
Co-authored-by: odysseus0 <8635094+odysseus0@users.noreply.github.com>
Reviewed-by: @odysseus0
2026-04-10 19:40:21 -07:00
Peter Steinberger
e11d902b7d fix(ci): stop telegram debounce media leak 2026-04-11 03:36:48 +01:00
Peter Steinberger
df7e61b546 fix(ci): align compact count assertion 2026-04-11 03:32:03 +01:00
Peter Steinberger
5b2888e1fd test(install): pin smoke docker platform 2026-04-11 03:31:47 +01:00
Peter Steinberger
421338f585 test(install): quiet smoke npm output 2026-04-11 03:31:47 +01:00
Peter Steinberger
05659cfbc3 test: harden macOS Parallels permission check 2026-04-11 03:30:01 +01:00
Peter Steinberger
896eb888a8 fix(ci): align target session alias fixture 2026-04-11 03:27:20 +01:00
Peter Steinberger
05521242cd fix(ci): stabilize agentic compact tests 2026-04-11 03:25:32 +01:00
1726 changed files with 67183 additions and 17331 deletions

View File

@@ -29,7 +29,13 @@ Use this skill for Parallels guest workflows and smoke interpretation. Do not lo
## npm install then update
- Preferred entrypoint: `pnpm test:parallels:npm-update`
- Flow: fresh snapshot -> install npm package baseline -> smoke -> install current main tgz on the same guest -> smoke again.
- Required coverage: every release/update regression run must include both lanes:
- fresh snapshot -> install requested package/baseline -> smoke
- same guest baseline -> run the guest's installed `openclaw update ...` command -> smoke again
- The update lane must exercise OpenClaw's internal updater. Do not count a direct `npm install -g <tgz-or-spec>` or harness-side package swap as update-flow coverage; those are install smokes only.
- For published targets, install the old baseline package first (for example `openclaw@2026.4.9`), then run the installed guest CLI with the intended channel/tag (for example `openclaw update --channel beta --yes --json`) and verify `openclaw --version`, `openclaw update status --json`, gateway RPC, and an agent turn after the command.
- For unpublished targets, pack the candidate on the host, serve the `.tgz` over the harness HTTP server, and point the guest updater at that served package. Prefer `openclaw update --tag http://<host-ip>:<port>/openclaw-<version>.tgz --yes --json`; when channel persistence also matters, pass `--channel <stable|beta>` and set `OPENCLAW_UPDATE_PACKAGE_SPEC` to the same served URL in the guest update environment. The command under test must still be `openclaw update`, not direct npm.
- For unpublished local-fix validation, remember the old baseline updater code still controls the first hop. A fix that lives only in the new updater code cannot change that already-running old process; the served candidate must either keep package/plugin metadata compatible with the baseline host or the baseline itself must include the updater fix.
- For beta/stable verification, resolve the tag immediately before the run (`npm view openclaw@beta version dist.tarball` or `npm view openclaw@latest ...`). Tags can move while a long VM matrix is already running; restart the matrix when the intended prerelease appears after an earlier registry 404/tag-lag check.
- Source Peter's profile in the host shell (`set -a; source "$HOME/.profile"; set +a`) before OpenAI/Anthropic lanes. Do not print profile contents or env dumps; pass provider secrets through the guest exec environment.
- Same-guest update verification should set the default model explicitly to `openai/gpt-5.4` before the agent turn and use a fresh explicit `--session-id` so old session model state does not leak into the check.

View File

@@ -694,7 +694,7 @@ jobs:
EOF
checks-node-core-test:
name: checks-node-core-test
name: checks-node-core
needs: [preflight, checks-node-core-test-shard]
if: always() && needs.preflight.outputs.run_checks == 'true'
runs-on: blacksmith-16vcpu-ubuntu-2404

View File

@@ -194,6 +194,13 @@ jobs:
push: false
provenance: false
- name: Setup Node environment for local pack smoke
uses: ./.github/actions/setup-node-env
with:
install-bun: "false"
install-deps: "true"
use-sticky-disk: "false"
- name: Run installer docker tests
env:
OPENCLAW_INSTALL_URL: https://openclaw.ai/install.sh

View File

@@ -493,6 +493,7 @@ jobs:
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
run: |
set -euo pipefail
printf '//registry.npmjs.org/:_authToken=%s\n' "${NODE_AUTH_TOKEN}" > "${HOME}/.npmrc"
npm whoami >/dev/null
npm dist-tag add "openclaw@${RELEASE_VERSION}" latest
promoted_latest="$(npm view openclaw dist-tags.latest)"

View File

@@ -20,6 +20,7 @@
"pnpm-lock.yaml/",
"src/gateway/server-methods/CLAUDE.md",
"src/auto-reply/reply/export-html/",
"src/canvas-host/a2ui/a2ui.bundle.js",
"Swabble/",
"vendor/",
],

View File

@@ -17,6 +17,5 @@
"typescript.preferences.importModuleSpecifierEnding": "js",
"typescript.reportStyleChecksAsWarnings": false,
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.experimental.useTsgo": true
"typescript.tsdk": "node_modules/typescript/lib"
}

View File

@@ -8,6 +8,39 @@ Docs: https://docs.openclaw.ai
### Fixes
## 2026.4.11
### Changes
- Dreaming/memory-wiki: add ChatGPT import ingestion plus new `Imported Insights` and `Memory Palace` diary subtabs so Dreaming can inspect imported source chats, compiled wiki pages, and full source pages directly from the UI. (#64505)
- Control UI/webchat: render assistant media/reply/voice directives as structured chat bubbles, add the `[embed ...]` rich output tag, and gate external embed URLs behind config. (#64104)
- Tools/video_generate: add URL-only generated asset delivery, typed `providerOptions`, reference audio inputs, per-asset role hints, `adaptive` aspect-ratio support, and a higher image-input cap so video providers can expose richer generation modes without forcing large files into memory. (#61987, #61988) Thanks @xieyongliang.
- Feishu: improve document comment sessions with richer context parsing, comment reactions, and typing feedback so document-thread conversations behave more like chat conversations. (#63785)
- Microsoft Teams: add reaction support, reaction listing, Graph pagination, and delegated OAuth setup for sending reactions while preserving application-auth read paths. (#51646)
- Plugins: allow plugin manifests to declare activation and setup descriptors so plugin setup flows can describe required auth, pairing, and configuration steps without hardcoded core special cases. (#64780)
- Ollama: cache `/api/show` context-window and capability metadata during model discovery so repeated picker refreshes stop refetching unchanged models, while still retrying after empty responses and invalidating on digest changes. (#64753) Thanks @ImLukeF.
- Models/providers: surface how configured OpenAI-compatible endpoints are classified in embedded-agent debug logs, so local and proxy routing issues are easier to diagnose. (#64754) Thanks @ImLukeF.
- QA/parity: add the GPT-5.4 vs Opus 4.6 agentic parity report gate with shared scenario coverage checks, stricter evidence heuristics, and skipped-scenario accounting for maintainer review. (#64441) Thanks @100yenadmin.
### Fixes
- OpenAI/Codex OAuth: stop rewriting the upstream authorize URL scopes so new Codex sign-ins do not fail with `invalid_scope` before returning an authorization code. (#64713) Thanks @fuller-stack-dev.
- Audio transcription: disable pinned DNS only for OpenAI-compatible multipart requests, while still validating hostnames, so OpenAI, Groq, and Mistral transcription works again without weakening other request paths. (#64766) Thanks @GodsBoy.
- macOS/Talk Mode: after granting microphone permission on first enable, continue starting Talk Mode instead of requiring a second toggle. (#62459) Thanks @ggarber.
- Control UI/webchat: persist agent-run TTS audio replies into webchat history and preserve interleaved tool card pairing so generated audio and mixed tool output stay attached to the right messages. (#63514) Thanks @bittoby.
- WhatsApp: honor the configured default account when the active listener helper is used without an explicit account id, so named default accounts do not get registered under `default`. (#53918) Thanks @yhyatt.
- ACP/agents: suppress commentary-phase child assistant relay text in ACP parent stream updates, so spawned child runs stop leaking internal progress chatter into the parent session. Thanks @vincentkoc.
- Agents/timeouts: honor explicit run timeouts in the LLM idle watchdog and align default timeout config so slow models can keep working until the configured limit instead of using the wrong idle window.
- Config: include `asyncCompletion` in the generated zod schema so documented async completion config no longer fails with an unrecognized-key error. (#63618)
- Google/Veo: stop sending the unsupported `numberOfVideos` request field so Gemini Developer API Veo runs do not fail before OpenClaw can complete the intended Google video generation path. (#64723) Thanks @velvet-shark.
- QA/packaging: stop packaged CLI startup and completion cache generation from reading repo-only QA scenario markdown, ship the bundled QA scenario pack in npm releases, and keep `openclaw completion --write-state` working even if QA setup is broken. (#64648) Thanks @obviyus.
- Codex/QA: keep Codex app-server coordination chatter out of visible replies, add a live QA leak scenario, and classify leaked harness meta text as a QA failure instead of a successful reply. Thanks @vincentkoc.
- WhatsApp: route `message react` through the gateway-owned action path so reactions use the live WhatsApp listener in both DM and group chats, matching `message send` and `message poll`. Thanks @mcaxtr.
- Auto-reply/WhatsApp: preserve inbound image attachment notes after media understanding so image edits keep the real saved media path instead of hallucinating a missing local path. (#64918) Thanks @ngutman.
- Telegram/sessions: keep topic-scoped session initialization on the canonical topic transcript path when inbound turns omit `MessageThreadId`, so one topic session no longer alternates between bare and topic-qualified transcript files. (#64869) Thanks @jalehman.
- Agents/failover: scope assistant-side fallback classification and surfaced provider errors to the current attempt instead of stale session history, so cross-provider fallback runs stop inheriting the previous provider's failure. (#62907) Thanks @stainlu.
- MiniMax/OAuth: write `api: "anthropic-messages"` and `authHeader: true` into the `minimax-portal` config patch during `openclaw configure`, so re-authenticated portal setups keep Bearer auth routing working. (#64964) Thanks @ryanlee666.
## 2026.4.10
### Changes
@@ -24,11 +57,14 @@ Docs: https://docs.openclaw.ai
- Gateway: add a `commands.list` RPC so remote gateway clients can discover runtime-native, text, skill, and plugin commands with surface-aware naming and serialized argument metadata. (#62656) Thanks @samzong.
- Models/providers: add per-provider `models.providers.*.request.allowPrivateNetwork` for trusted self-hosted OpenAI-compatible endpoints, keep the opt-in scoped to model request surfaces, and refresh cached WebSocket managers when request transport overrides change. (#63671) Thanks @qas.
- Feishu: standardize request user agents and register the bot as an AI agent so Feishu deployments identify OpenClaw consistently. (#63835) Thanks @evandance.
- Docs i18n: chunk raw doc translation, reject truncated tagged outputs, avoid ambiguous body-only wrapper unwrapping, and recover from terminated Pi translation sessions without changing the default `openai/gpt-5.4` path. (#62969, #63808) Thanks @hxy91819.
- Gateway: split startup and runtime seams so gateway lifecycle sequencing, reload state, and shutdown behavior stay easier to maintain without changing observed behavior. (#63975) Thanks @gumadeiras.
- Control UI/webchat: normalize assistant `MEDIA:`/reply/voice directives into structured bubble rendering, rename the unreleased rich web shortcode to `[embed ...]`, and surface session runtime roots so hosted web content is written to the correct document path instead of guessed local files.
- Matrix/partial streaming: add MSC4357 live markers to draft preview sends and edits so supporting Matrix clients can render a live/typewriter animation and stop it when the final edit lands. (#63513) Thanks @TigerInYourDream.
- Control UI/dreaming: simplify the Scene and Diary surfaces, preserve unknown phase state for partial status payloads, and stabilize waiting-entry recency ordering so Dreaming status and review lists stay clear and deterministic. (#64035) Thanks @davemorin.
- Agents: add an opt-in strict-agentic embedded Pi execution contract for GPT-5-family runs so plan-only or filler turns keep acting until they hit a real blocker. (#64241) Thanks @100yenadmin.
- Agents/OpenAI: add provider-owned OpenAI/Codex tool schema compatibility and surface embedded-run replay/liveness state for long-running runs. (#64300) Thanks @100yenadmin.
- Docs i18n: chunk raw doc translation, reject truncated tagged outputs, avoid ambiguous body-only wrapper unwrapping, and recover from terminated Pi translation sessions without changing the default `openai/gpt-5.4` path. (#62969, #63808) Thanks @hxy91819.
- Dreaming/memory-wiki: add ChatGPT import ingestion plus new `Imported Insights` and `Memory Palace` diary subtabs so Dreaming can inspect imported source chats, compiled wiki pages, and full source pages directly from the UI. (#64505)
### Fixes
@@ -115,12 +151,20 @@ Docs: https://docs.openclaw.ai
- Daemon/gateway: prevent systemd restart storms on configuration errors by exiting with `EX_CONFIG` and adding generated unit restart-prevention guards. (#63913) Thanks @neo1027144-creator.
- Agents/exec: prevent gateway crash ("Agent listener invoked outside active run") when a subagent exec tool produces stdout/stderr after the agent run has ended or been aborted. (#62821) Thanks @openperf.
- Gateway/OpenAI compat: return real `usage` for non-stream `/v1/chat/completions` responses, emit the final usage chunk when `stream_options.include_usage=true`, and bound usage-gated stream finalization after lifecycle end. (#62986) Thanks @Lellansin.
- Matrix/migration: keep packaged warning-only crypto migrations from being misclassified as actionable when only helper chunks are present, so startup and doctor stay on the warning-only path instead of creating unnecessary migration snapshots. (#64373) Thanks @gumadeiras.
- Matrix/ACP thread bindings: preserve canonical room casing and parent conversation routing during ACP session spawn so mixed-case room ids bind correctly from top-level rooms and existing Matrix threads. (#64343) Thanks @gumadeiras.
- Agents/subagents: deduplicate delivered completion announces so retry or re-entry cleanup does not inject duplicate internal-context completion turns into the parent session. (#61525) Thanks @100yenadmin.
- Agents/exec: keep sandboxed `tools.exec.host=auto` sessions from honoring per-call `host=node` or `host=gateway` overrides while a sandbox runtime is active, and stop advertising node routing in that state so exec stays on the sandbox host. (#63880)
- Agents/subagents: preserve archived delete-mode runs until `sessions.delete` succeeds and prevent overlapping archive sweeps from duplicating in-flight cleanup attempts. (#61801) Thanks @100yenadmin.
- Cron/isolated agent: run scheduled agent turns as non-owner senders so owner-only tools stay unavailable during cron execution. (#63878)
- Discord/sandbox: include `image` in sandbox media param normalization so Discord event cover images cannot bypass sandbox path rewriting. (#64377) Thanks @mmaps.
- Agents/exec: extend exec completion detection to cover local background exec formats so the owner-downgrade fires correctly for all exec paths. (#64376) Thanks @mmaps.
- Security/dependencies: pin axios to 1.15.0 and add a plugin install dependency denylist that blocks known malicious packages before install. (#63891) Thanks @mmaps.
- Browser/security: apply three-phase interaction navigation guard to pressKey and type(submit) so delayed JS redirects from keypress cannot bypass SSRF policy. (#63889) Thanks @mmaps.
- Browser/security: guard existing-session Chrome MCP interaction routes with SSRF post-checks so delayed navigation from click, type, press, and evaluate cannot bypass the configured policy. (#64370) Thanks @eleqtrizit.
- Browser/security: default browser SSRF policy to strict mode so unconfigured installs block private-network navigation, and align external-content marker span mapping so ZWS-injected boundary spoofs are fully sanitized. (#63885) Thanks @eleqtrizit.
- Browser/security: apply SSRF navigation policy to subframe document navigations so iframe-targeted private-network hops are blocked without quarantining the parent page. (#64371) Thanks @eleqtrizit.
- Hooks/security: mark agent hook system events as untrusted and sanitize hook display names before cron metadata reuse. (#64372) Thanks @eleqtrizit.
- Daemon/launchd: keep `openclaw gateway stop` persistent without uninstalling the macOS LaunchAgent, re-enable it on explicit restart or repair, and harden launchd label handling. (#64447) Thanks @ngutman.
- Plugins/context engines: preserve `plugins.slots.contextEngine` through normalization and keep explicitly selected workspace context-engine plugins enabled, so loader diagnostics and plugin activation stop dropping that slot selection. (#64192) Thanks @hclsys.
@@ -131,6 +175,9 @@ Docs: https://docs.openclaw.ai
- Media/security: honor sender-scoped `toolsBySender` policy for outbound host-media reads so denied senders cannot trigger host file disclosure via attachment hydration. (#64459) Thanks @eleqtrizit.
- Browser/security: reject strict-policy hostname navigation unless the hostname is an explicit allowlist exception or IP literal, and route CDP HTTP discovery through the pinned SSRF fetch path. (#64367) Thanks @eleqtrizit.
- Models/vLLM: ignore empty `tool_calls` arrays from reasoning-model OpenAI-compatible replies, reset false `toolUse` stop reasons when no actual tool calls were parsed, and stop sending `tool_choice` unless tools are present so vLLM reasoning responses no longer hang indefinitely. (#61197, #61534) Thanks @balajisiva.
- Heartbeat/scheduling: spread interval heartbeats across stable per-agent phases derived from gateway identity, so provider traffic is distributed more uniformly across the configured interval instead of clustering around startup-relative times. (#64560) Thanks @odysseus0.
- Config/media: accept `tools.media.asyncCompletion.directSend` in strict config validation so gateways no longer reject the generated-schema-backed async media completion setting at startup. (#63618) Thanks @qiziAI.
- Telegram/exec: preserve delayed exec completion routing for forum topics by pinning background exec completions to the topic where the run started even if the session route later drifts. (#64580) thanks @jalehman.
## 2026.4.9
@@ -141,6 +188,7 @@ Docs: https://docs.openclaw.ai
- QA/lab: add character-vibes evaluation reports with model selection and parallel runs so live QA can compare candidate behavior faster.
- Plugins/provider-auth: let provider manifests declare `providerAuthAliases` so provider variants can share env vars, auth profiles, config-backed auth, and API-key onboarding choices without core-specific wiring.
- iOS: pin release versioning to an explicit CalVer in `apps/ios/version.json`, keep TestFlight iteration on the same short version until maintainers intentionally promote the next gateway version, and add the documented `pnpm ios:version:pin -- --from-gateway` workflow for release trains. (#63001) Thanks @ngutman.
- Tools/video_generate: extend the tool and the Plugin SDK with `providerOptions` (vendor-specific options forwarded as a JSON object), `inputAudios` / `audioRef` / `audioRefs` reference audio inputs, per-asset semantic role hints (`imageRoles` / `videoRoles` / `audioRoles`) using a typed `VideoGenerationAssetRole` union, a new `"adaptive"` aspect-ratio sentinel, and `maxInputAudios` provider capability declarations. Providers opt into `providerOptions` by declaring a typed `capabilities.providerOptions` schema (`{ seed: "number", draft: "boolean", ... }`); unknown keys and type mismatches cause the runtime fallback loop to skip the candidate with a visible warning and an `attempts` entry, so vendor-specific options never silently reach the wrong provider. Also raises the in-tool image input cap to 9 and updates the docs table to list all new parameters. (#61987) Thanks @xieyongliang.
### Fixes

View File

@@ -6,7 +6,6 @@ We monitor security signals from:
- GitHub Security Advisories (GHSA) and private vulnerability reports.
- Public GitHub issues/discussions when reports are not sensitive.
- Official plublic discussion groups and channels (i.e. Discord and X).
- Automated signals (for example Dependabot, CodeQL, npm advisories, and secret scanning).
Initial triage:

View File

@@ -2,6 +2,150 @@
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
<channel>
<title>OpenClaw</title>
<item>
<title>2026.4.10</title>
<pubDate>Sat, 11 Apr 2026 03:17:02 +0000</pubDate>
<link>https://raw.githubusercontent.com/openclaw/openclaw/main/appcast.xml</link>
<sparkle:version>2026041090</sparkle:version>
<sparkle:shortVersionString>2026.4.10</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
<description><![CDATA[<h2>OpenClaw 2026.4.10</h2>
<h3>Changes</h3>
<ul>
<li>Models/Codex: add the bundled Codex provider and plugin-owned app-server harness so <code>codex/gpt-*</code> models use Codex-managed auth, native threads, model discovery, and compaction while <code>openai/gpt-*</code> stays on the normal OpenAI provider path. (#64298)</li>
<li>Memory/Active Memory: add a new optional Active Memory plugin that gives OpenClaw a dedicated memory sub-agent right before the main reply, so ongoing chats can automatically pull in relevant preferences, context, and past details without making users remember to manually say "remember this" or "search memory" first. Includes configurable message/recent/full context modes, live <code>/verbose</code> inspection, advanced prompt/thinking overrides for tuning, and opt-in transcript persistence for debugging. Docs: https://docs.openclaw.ai/concepts/active-memory. (#63286) Thanks @Takhoffman.</li>
<li>macOS/Talk: add an experimental local MLX speech provider for Talk Mode, with explicit provider selection, local utterance playback, interruption handling, and system-voice fallback. (#63539) Thanks @ImLukeF.</li>
<li>Tools/video generation: add Seedance 2.0 model refs to the bundled fal provider and submit the provider-specific duration, resolution, audio, and seed metadata fields needed for live Seedance 2.0 runs.</li>
<li>Microsoft Teams: add message actions for pin, unpin, read, react, and listing reactions. (#53432) Thanks @sudie-codes.</li>
<li>QA/Matrix: add a live <code>openclaw qa matrix</code> lane backed by a disposable Matrix homeserver, shared live-transport seams, and Matrix-specific transport coverage for threading, reactions, restart, and allowlist behavior. (#64489) Thanks @gumadeiras.</li>
<li>QA/Telegram: add a live <code>openclaw qa telegram</code> lane for private-group bot-to-bot checks, harden its artifact handling, and preserve native Telegram command reply threading for QA verification. (#64303) Thanks @obviyus.</li>
<li>QA/testing: add a <code>--runner multipass</code> lane for <code>openclaw qa suite</code> so repo-backed QA scenarios can run inside a disposable Linux VM and write back the usual report, summary, and VM logs. (#63426) Thanks @shakkernerd.</li>
<li>CLI/exec policy: add a local <code>openclaw exec-policy</code> command with <code>show</code>, <code>preset</code>, and <code>set</code> subcommands for synchronizing requested <code>tools.exec.*</code> config with the local exec approvals file, plus follow-up hardening for node-host rejection, rollback safety, and sync conflict detection. (#64050)</li>
<li>Gateway: add a <code>commands.list</code> RPC so remote gateway clients can discover runtime-native, text, skill, and plugin commands with surface-aware naming and serialized argument metadata. (#62656) Thanks @samzong.</li>
<li>Models/providers: add per-provider <code>models.providers.*.request.allowPrivateNetwork</code> for trusted self-hosted OpenAI-compatible endpoints, keep the opt-in scoped to model request surfaces, and refresh cached WebSocket managers when request transport overrides change. (#63671) Thanks @qas.</li>
<li>Feishu: standardize request user agents and register the bot as an AI agent so Feishu deployments identify OpenClaw consistently. (#63835) Thanks @evandance.</li>
<li>Matrix/partial streaming: add MSC4357 live markers to draft preview sends and edits so supporting Matrix clients can render a live/typewriter animation and stop it when the final edit lands. (#63513) Thanks @TigerInYourDream.</li>
<li>Control UI/dreaming: simplify the Scene and Diary surfaces, preserve unknown phase state for partial status payloads, and stabilize waiting-entry recency ordering so Dreaming status and review lists stay clear and deterministic. (#64035) Thanks @davemorin.</li>
<li>Agents: add an opt-in strict-agentic embedded Pi execution contract for GPT-5-family runs so plan-only or filler turns keep acting until they hit a real blocker. (#64241) Thanks @100yenadmin.</li>
<li>Agents/OpenAI: add provider-owned OpenAI/Codex tool schema compatibility and surface embedded-run replay/liveness state for long-running runs. (#64300) Thanks @100yenadmin.</li>
<li>Docs i18n: chunk raw doc translation, reject truncated tagged outputs, avoid ambiguous body-only wrapper unwrapping, and recover from terminated Pi translation sessions without changing the default <code>openai/gpt-5.4</code> path. (#62969, #63808) Thanks @hxy91819.</li>
</ul>
<h3>Fixes</h3>
<ul>
<li>Browser/security: tighten browser and sandbox navigation defenses across strict SSRF defaults, hostname allowlists, interaction-driven redirects, subframes, CDP discovery, existing sessions, tab actions, noVNC, marker-span sanitization, and Docker CDP source-range enforcement. (#61404, #63332, #63882, #63885, #63889, #64367, #64370, #64371)</li>
<li>Security/tools: harden exec preflight reads, host env denylisting, node output boundaries, outbound host-media reads, profile-mutation authorization, plugin install dependency scanning, ACPX tool hooks, Gmail watcher token redaction, and oversized realtime WebSocket frame handling. (#62333, #62661, #62662, #63277, #63551, #63553, #63886, #63890, #63891, #64459)</li>
<li>OpenAI/Codex: add required Codex OAuth scopes, classify provider/runtime failures more clearly, stop suggesting <code>/elevated full</code> when auto-approved host exec is unavailable, add OpenAI/Codex tool-schema compatibility, and preserve embedded-run replay/liveness truth across compaction retries and mutating side effects. (#64300, #64439) Thanks @100yenadmin.</li>
<li>CLI/WhatsApp media sends: route gateway-mode outbound sends with <code>--media</code> through the channel <code>sendMedia</code> path and preserve media access context, so WhatsApp document and attachment sends stop silently dropping the file while still delivering the caption. (#64478, #64492) Thanks @ShionEria.</li>
<li>Microsoft Teams: restore media downloads for personal DMs, Bot Framework <code>a:</code> conversations, OneDrive/SharePoint shared files, and Graph-backed chat IDs; accept Bot Framework audience tokens; prevent feedback-learning filename collisions; keep long tool chains alive with typing indicators; add SSO sign-in callbacks; inject parent context for thread replies; and deliver cron announcements to Teams conversation IDs. (#54932, #55383, #55386, #58001, #58249, #58774, #59731, #60956, #62219, #62674, #63063, #63942, #63945, #63949, #63951, #63953, #64087, #64088, #64089)</li>
<li>Gateway/tailscale: start Tailscale exposure and the gateway update check before awaiting channel and plugin sidecar startup so remote operators are not locked out when startup sidecars stall.</li>
<li>Gateway/startup: keep WebSocket RPC available while channels and plugin sidecars start, hold <code>chat.history</code> unavailable until startup sidecars finish so synchronous history reads cannot stall startup (reported in #63450), refresh advertised gateway methods after deferred plugin reloads, and enforce the pre-auth WebSocket upgrade budget before the no-handler 503 path so upgrade floods cannot bypass connection limits during that window. (#63480) Thanks @neeravmakwana.</li>
<li>WhatsApp: keep inbound replies, media, composing indicators, and queued outbound deliveries attached to the current socket across reconnect gaps, including fresh retry-eligible sends after the listener comes back. (#30806, #46299, #62892, #63916) Thanks @mcaxtr.</li>
<li>Gateway/thread routing: preserve Slack, Telegram, Mattermost, Matrix, ACP, restart-sentinel, and agent announce delivery targets so subagent, cron, stream-relay, session fallback, and restart messages land back in the originating thread, topic, or room casing. (#54840, #57056, #63143, #63228, #63506, #64343, #64391)</li>
<li>Models/fallback: preserve <code>/models</code> selection across transient primary-model failures and config reloads, allow timeout cooldown probes, classify OpenRouter no-endpoints responses, detect llama.cpp context overflows, and keep provider/runtime context metadata stable through reloads. (#61472, #64196, #64471)</li>
<li>Agents/BTW: keep <code>/btw</code> side questions working after tool-use turns by stripping replayed tool blocks, hidden reasoning, and malformed image payloads, omitting empty tool arrays, allowing Bedrock <code>auth: "aws-sdk"</code>, and routing Feishu <code>/btw</code> plus <code>/stop</code> through bounded out-of-band lanes. (#64218, #64219, #64225, #64324) Thanks @ngutman.</li>
<li>Control UI/BTW: render <code>/btw</code> side results as dismissible ephemeral cards in the browser, send <code>/btw</code> immediately during active runs, and clear stale BTW cards on reset flows so webchat matches the intended detached side-question behavior. (#64290) Thanks @ngutman.</li>
<li>Commands/targeting: use the selected agent or session for command output, send policy, usage/cost, context reports, model lists, bash sandbox hints, BTW/compact working directories, plugin commands, and session exports so multi-agent commands describe and mutate the intended target instead of the requester.</li>
<li>Conversation bindings: normalize focused/current conversation ids, preserve binding metadata on account and Discord rebinds, avoid stale Discord lifecycle windows, and keep generic activity touches persisted so reply routing survives rebinds and restarts.</li>
<li>iMessage/self-chat: distinguish normal DM outbound rows from true self-chat using <code>destination_caller_id</code> plus chat participants, preserve multi-handle self-chat aliases, drop ambiguous reflected echoes, and strip wrapped imsg RPC text fields. (#61619, #63868, #63980, #63989, #64000) Thanks @neeravmakwana.</li>
<li>Matrix: keep multi-account room scoping consistent, keep packaged crypto migrations warning-only when appropriate, preserve ordered block streaming, add explicit Matrix block-streaming opt-in, and resolve verification/bootstrap from the packaged runtime entry. (#58449, #59249, #59266, #64373) Thanks @gumadeiras.</li>
<li>Telegram/security: tighten Telegram <code>allowFrom</code> sender validation and keep <code>/whoami</code> allowlist reporting in sync with command auth checks.</li>
<li>Agents/timeouts: extend the default LLM idle window to 120s and keep silent no-token idle timeouts on recovery paths, so slow models can retry or fall back before users see an error.</li>
<li>Gateway/agents: preserve configured model selection and richer <code>IDENTITY.md</code> content across agent create/update flows and workspace moves, and fail safely instead of silently overwriting unreadable identity files. (#61577) Thanks @samzong.</li>
<li>Skills/TaskFlow: restore valid frontmatter fences for the bundled <code>taskflow</code> and <code>taskflow-inbox-triage</code> skills and copy bundled <code>SKILL.md</code> files as hard dist-runtime copies so skills stay discoverable and loadable after updates. (#64166, #64469) Thanks @extrasmall0.</li>
<li>Skills: respect overridden home directories when loading personal skills so service, test, and custom launch environments read the intended user skill directory instead of the process home.</li>
<li>Windows/exec: settle supervisor waits from child exit state after stdout and stderr drain even when <code>close</code> never arrives, so CLI commands stop hanging or dying with forced <code>SIGKILL</code> on Windows. (#64072) Thanks @obviyus.</li>
<li>Browser/sandbox: prevent sandbox browser CDP startup hangs by recreating containers when the browser security hash changes and by waiting on the correct sandbox browser lifecycle. (#62873) Thanks @Syysean.</li>
<li>QQBot/streaming: make block streaming configurable per QQ bot account via <code>streaming.mode</code> (<code>"partial"</code> | <code>"off"</code>, default <code>"partial"</code>) instead of hardcoding it off, so responses can be delivered incrementally. (#63746)</li>
<li>QQBot/config: allow extra fields in <code>channels.qqbot</code> and <code>channels.qqbot.accounts.*</code> so extended qqbot builds can add new config options without gateway startup failing on schema validation. (#64075) Thanks @WideLee.</li>
<li>Dreaming/gateway: require <code>operator.admin</code> for persistent <code>/dreaming on|off</code> changes and treat missing gateway client scopes as unprivileged instead of silently allowing config writes. (#63872) Thanks @mbelinky.</li>
<li>Gateway/pairing: prefer explicit QR bootstrap auth over earlier Tailscale auth classification so iOS <code>/pair qr</code> silent bootstrap pairing does not fall through to <code>pairing required</code>. (#59232) Thanks @ngutman.</li>
<li>Browser/control: auto-generate browser-control auth tokens for <code>none</code> and <code>trusted-proxy</code> modes, and route browser auth/profile/doctor helpers through the public browser plugin facades. (#63280, #63957) Thanks @pgondhi987.</li>
<li>Browser/act: centralize <code>/act</code> request normalization and execution dispatch while adding stable machine-readable route-level error codes for invalid requests, selector misuse, evaluate-disabled gating, target mismatch, and existing-session unsupported actions. (#63977) Thanks @joshavant.</li>
<li>Security/QQBot: enforce media storage boundaries for all outbound local file paths and route image-size probes through SSRF-guarded media fetching instead of raw <code>fetch()</code>. (#63271, #63495) Thanks @pgondhi987.</li>
<li>Channel setup: ignore workspace plugin shadows when resolving trusted channel setup catalog entries so onboarding and setup flows keep using the bundled, trusted setup contract.</li>
<li>Gateway/memory startup: load the explicitly selected memory-slot plugin during gateway startup, while keeping restrictive allowlists and implicit default memory slots from auto-starting unrelated memory plugins. (#64423) Thanks @EronFan.</li>
<li>Config/plugins: let config writes keep disabled plugin entries without forcing required plugin config schemas or crashing raw plugin validation, and avoid re-activating plugin registry state during schema checks. (#54971, #63296) Thanks @fuller-stack-dev.</li>
<li>Config validation: surface the actual offending field for strict-schema union failures in bindings, including top-level unexpected keys on the matching ACP branch. (#40841) Thanks @Hollychou924.</li>
<li>Wizard/plugin config: coerce integer-typed plugin config fields from interactive text input so integer schema values persist as numbers instead of failing validation. (#63346) Thanks @jalehman.</li>
<li>Daemon/gateway install: preserve safe custom service env vars on forced reinstall, merge prior custom PATH segments behind the managed service PATH, and stop removed managed env keys from persisting as custom carryover. (#63136) Thanks @WarrenJones.</li>
<li>Cron/scheduling: treat <code>nextRunAtMs <= 0</code> as invalid across cron update, maintenance, timer, and stale-delivery paths so corrupted zero timestamps self-heal instead of causing immediate runs or skipped deliveries. (#63507) Thanks @WarrenJones.</li>
<li>Cron/auth: resolve auth profiles consistently for isolated cron jobs so scheduled runs use the same configured provider credentials as interactive sessions. (#62797) Thanks @neeravmakwana.</li>
<li>Tasks: let <code>openclaw tasks cancel</code> cancel stuck background tasks that never reached a normal terminal state. (#62506) Thanks @neeravmakwana.</li>
<li>Sessions/model selection: preserve catalog-backed session model labels, provider-qualified context limits, and already-qualified session model refs when catalog metadata is unavailable, so model selection and memory/context budgets survive reloads without bogus provider prefixes. (#61382, #62493) Thanks @Mule-ME.</li>
<li>Status: show configured fallback models in <code>/status</code> and shared session status cards so per-agent fallback configuration is visible before a live failover happens. (#33111) Thanks @AnCoSONG.</li>
<li><code>/context detail</code> now compares the tracked prompt estimate with cached context usage and surfaces untracked provider/runtime overhead when present. (#28391) Thanks @ImLukeF.</li>
<li>Gateway/sessions: scope bare <code>sessions.create</code> aliases like <code>main</code> to the requested agent while preserving the canonical <code>global</code> and <code>unknown</code> sentinel keys. (#58207) Thanks @jalehman.</li>
<li>Gateway/session reset: emit the typed <code>before_reset</code> hook for gateway <code>/new</code> and <code>/reset</code>, preserving reset-hook behavior even when the previous transcript has already been archived. (#53872) Thanks @VACInc.</li>
<li>Plugins/commands: pass the active host <code>sessionKey</code> into plugin command contexts, and include <code>sessionId</code> when it is already available from the active session entry, so bundled and third-party commands can resolve the current conversation reliably. (#59044) Thanks @jalehman.</li>
<li>Agents/auth: honor <code>models.providers.*.authHeader</code> for pi embedded runner model requests by injecting <code>Authorization: Bearer <apiKey></code> when requested. (#54390) Thanks @lndyzwdxhs.</li>
<li>Claude CLI: clear inherited Anthropic auth/header environment aliases before spawning Claude Code and add sanitized CLI backend auth-env diagnostics for debugging gateway-run provider selection.</li>
<li>Agents/failover: classify AbortError and stream-abort messages as timeout so Ollama NDJSON stream aborts stop showing <code>reason=unknown</code> in model fallback logs. (#58324) Thanks @yelog.</li>
<li>Fireworks/FirePass: disable Kimi K2.5 Turbo reasoning output by forcing thinking off on the FirePass path and hardening the provider wrapper so hidden reasoning no longer leaks into visible replies. (#63607) Thanks @frankekn.</li>
<li>Discord: update Carbon to v0.15.0. Thanks @thewilloftheshadow.</li>
<li>Config/Discord: coerce safe integer numeric Discord IDs to strings during config validation, keep unsafe or precision-losing numeric snowflakes rejected, and align <code>openclaw doctor</code> repair guidance with the same fail-closed behavior. (#45125) Thanks @moliendocode.</li>
<li>BlueBubbles/config: accept <code>enrichGroupParticipantsFromContacts</code> in the core strict config schema so gateways no longer fail validation or startup when the BlueBubbles plugin writes that field. (#56889) Thanks @zqchris.</li>
<li>Feishu/webhooks: read webhook bodies through the pre-auth guard so unauthenticated webhook traffic stays under the same body budget as other protected channel ingress paths.</li>
<li>Tools/web_fetch: add an opt-in <code>tools.web.fetch.ssrfPolicy.allowRfc2544BenchmarkRange</code> config so fake-IP proxy environments that resolve public sites into <code>198.18.0.0/15</code> can use <code>web_fetch</code> without weakening the default SSRF block. (#61830) Thanks @xing-xing-coder.</li>
<li>Dreaming/cron: reconcile managed dreaming cron from startup config and runtime lifecycle changes, but only recover managed dreaming cron state during heartbeat-triggered dreaming checks so ordinary chat traffic does not recreate removed jobs. (#63873, #63929, #63938) Thanks @mbelinky.</li>
<li>Memory/lancedb: accept <code>dreaming</code> config when <code>memory-lancedb</code> owns the memory slot so Dreaming surfaces can read slot-owner settings without schema rejection. (#63874) Thanks @mbelinky.</li>
<li>Control UI/dreaming: keep the Dreaming trace area contained and scrollable so overlays no longer cover tabs or blow out the page layout. (#63875) Thanks @mbelinky.</li>
<li>Dreaming/narrative: harden request-scoped diary fallback so scheduled dreaming only falls back on the dedicated subagent-runtime error, stop trusting spoofable raw error-code objects, and avoid leaking workspace paths when local fallback writes fail. (#64156) Thanks @mbelinky.</li>
<li>Dreaming/diary: add idempotent narrative subagent runs, preserve restrictive <code>DREAMS.md</code> permissions during atomic writes, and surface temp cleanup failures so repeated sweeps do not double-run the same narrative request or silently weaken diary safety. (#63876) Thanks @mbelinky.</li>
<li>Heartbeats/sessions: remove stale accumulated isolated heartbeat session keys when the next tick converges them back to the canonical sibling, so repaired sessions stop showing orphaned <code>:heartbeat:heartbeat</code> variants in session listings. (#59606) Thanks @rogerdigital.</li>
<li>Gateway/run cleanup: fix stale run-context TTL cleanup so the new maintenance sweep resets orphaned run sequence state and prevents unbounded run-context growth. (#52731) Thanks @artwalker.</li>
<li>UI/compaction: keep the compaction indicator in a retry-pending state until the run actually finishes, so the UI does not show <code>Context compacted</code> before compaction actually finishes. (#55132) Thanks @mpz4life.</li>
<li>Cron/tool schemas: keep cron tool schemas strict-model-friendly while still preserving <code>failureAlert=false</code>, nullable <code>agentId</code>/<code>sessionKey</code>, and flattened add/update recovery for the newly exposed cron job fields. (#55043) Thanks @brunolorente.</li>
<li>Git metadata: read commit ids from packed refs as well as loose refs so version and status metadata stay accurate after repository maintenance. (#63943)</li>
<li>Gateway: keep <code>commands.list</code> skill entries categorized under tools and include provider-aware plugin <code>nativeName</code> metadata even when <code>scope=text</code>, so remote clients can group skills correctly and map text-surface plugin commands back to native aliases. (#64147)</li>
<li>TUI: reset footer activity to idle when switching sessions so a stale streaming indicator cannot persist after the selection changes. (#63988) Thanks @neeravmakwana.</li>
<li>Claude CLI: stop marking spawned Claude Code runs as host-managed so they keep using normal CLI subscription behavior. (#64023) Thanks @Alex-Alaniz.</li>
<li>Codex auth: brand Codex OAuth flows as OpenClaw in user-visible auth prompts and diagnostics.</li>
<li>Gateway/pairing: fail closed for paired device records that have no device tokens, and reject pairing approvals whose requested scopes do not match the requested device roles.</li>
<li>ACP/gateway chat: classify lifecycle errors before forwarding them to ACP clients so refusals use ACP's refusal stop reason while transient backend errors continue to finish as normal turns.</li>
<li>Claude CLI/skills: pass eligible OpenClaw skills into CLI runs, including native Claude Code skill resolution via a temporary plugin plus per-run skill env/API key injection. (#62686, #62723) Thanks @zomars.</li>
<li>Discord: keep generated auto-thread names working with reasoning models by giving title generation enough output budget for thinking plus visible title text. (#64172) Thanks @hanamizuki.</li>
<li>Heartbeat: ignore doc-only Markdown fence markers in the default <code>HEARTBEAT.md</code> template so comment-only heartbeat scaffolds skip API calls again. (#61690, #63434) Thanks @ravyg.</li>
<li>Reply/skills: keep resolved skill and memory secret config stable through embedded reply runs so raw SecretRefs in secondary skill settings no longer crash replies when the gateway already has the live env. (#64249) Thanks @mbelinky.</li>
<li>Dreaming/startup: keep plugin-registered startup hooks alive across workspace hook reloads and include dreaming startup owners in the gateway startup plugin scope, so managed Dreaming cron registration comes back reliably after gateway boot. (#62327, #64258) Thanks @mbelinky.</li>
<li>Plugins: treat duplicate <code>registerService</code> calls from the same plugin id as idempotent so snapshot and activation loads no longer emit spurious <code>service already registered</code> diagnostics. (#62033, #64128) Thanks @ly85206559.</li>
<li>Discord/TTS: route auto voice replies through the native voice-note path so Discord receives Opus voice messages instead of regular audio attachments. (#64096) Thanks @LiuHuaize.</li>
<li>Config/plugins: use plugin-owned command alias metadata when <code>plugins.allow</code> contains runtime command names like <code>dreaming</code>, and point users at the owning plugin instead of stale plugin-not-found guidance. (#64191, #64242) Thanks @feiskyer.</li>
<li>Agents/Gemini: strip orphaned <code>required</code> entries from Gemini tool schemas so provider validation no longer rejects tools after schema cleanup or union flattening. (#64284) Thanks @xxxxxmax.</li>
<li>Assistant text: strip Qwen-style XML tool call payloads from visible replies so web and channel messages no longer show raw <code><tool_call><function=...></code> output. (#63999, #64214) Thanks @MoerAI.</li>
<li>Daemon/gateway: prevent systemd restart storms on configuration errors by exiting with <code>EX_CONFIG</code> and adding generated unit restart-prevention guards. (#63913) Thanks @neo1027144-creator.</li>
<li>Agents/exec: prevent gateway crash ("Agent listener invoked outside active run") when a subagent exec tool produces stdout/stderr after the agent run has ended or been aborted. (#62821) Thanks @openperf.</li>
<li>Gateway/OpenAI compat: return real <code>usage</code> for non-stream <code>/v1/chat/completions</code> responses, emit the final usage chunk when <code>stream_options.include_usage=true</code>, and bound usage-gated stream finalization after lifecycle end. (#62986) Thanks @Lellansin.</li>
<li>Matrix/migration: keep packaged warning-only crypto migrations from being misclassified as actionable when only helper chunks are present, so startup and doctor stay on the warning-only path instead of creating unnecessary migration snapshots. (#64373) Thanks @gumadeiras.</li>
<li>Matrix/ACP thread bindings: preserve canonical room casing and parent conversation routing during ACP session spawn so mixed-case room ids bind correctly from top-level rooms and existing Matrix threads. (#64343) Thanks @gumadeiras.</li>
<li>Agents/subagents: deduplicate delivered completion announces so retry or re-entry cleanup does not inject duplicate internal-context completion turns into the parent session. (#61525) Thanks @100yenadmin.</li>
<li>Agents/exec: keep sandboxed <code>tools.exec.host=auto</code> sessions from honoring per-call <code>host=node</code> or <code>host=gateway</code> overrides while a sandbox runtime is active, and stop advertising node routing in that state so exec stays on the sandbox host. (#63880)</li>
<li>Agents/subagents: preserve archived delete-mode runs until <code>sessions.delete</code> succeeds and prevent overlapping archive sweeps from duplicating in-flight cleanup attempts. (#61801) Thanks @100yenadmin.</li>
<li>Cron/isolated agent: run scheduled agent turns as non-owner senders so owner-only tools stay unavailable during cron execution. (#63878)</li>
<li>Discord/sandbox: include <code>image</code> in sandbox media param normalization so Discord event cover images cannot bypass sandbox path rewriting. (#64377) Thanks @mmaps.</li>
<li>Agents/exec: extend exec completion detection to cover local background exec formats so the owner-downgrade fires correctly for all exec paths. (#64376) Thanks @mmaps.</li>
<li>Security/dependencies: pin axios to 1.15.0 and add a plugin install dependency denylist that blocks known malicious packages before install. (#63891) Thanks @mmaps.</li>
<li>Browser/security: apply three-phase interaction navigation guard to pressKey and type(submit) so delayed JS redirects from keypress cannot bypass SSRF policy. (#63889) Thanks @mmaps.</li>
</ul>
<ul>
<li>Browser/security: guard existing-session Chrome MCP interaction routes with SSRF post-checks so delayed navigation from click, type, press, and evaluate cannot bypass the configured policy. (#64370) Thanks @eleqtrizit.</li>
<li>Browser/security: default browser SSRF policy to strict mode so unconfigured installs block private-network navigation, and align external-content marker span mapping so ZWS-injected boundary spoofs are fully sanitized. (#63885) Thanks @eleqtrizit.</li>
<li>Browser/security: apply SSRF navigation policy to subframe document navigations so iframe-targeted private-network hops are blocked without quarantining the parent page. (#64371) Thanks @eleqtrizit.</li>
<li>Hooks/security: mark agent hook system events as untrusted and sanitize hook display names before cron metadata reuse. (#64372) Thanks @eleqtrizit.</li>
<li>Daemon/launchd: keep <code>openclaw gateway stop</code> persistent without uninstalling the macOS LaunchAgent, re-enable it on explicit restart or repair, and harden launchd label handling. (#64447) Thanks @ngutman.</li>
<li>Plugins/context engines: preserve <code>plugins.slots.contextEngine</code> through normalization and keep explicitly selected workspace context-engine plugins enabled, so loader diagnostics and plugin activation stop dropping that slot selection. (#64192) Thanks @hclsys.</li>
<li>Heartbeat: stop top-level <code>interval:</code> and <code>prompt:</code> fields outside the <code>tasks:</code> block from bleeding into the last parsed heartbeat task. (#64488) Thanks @Rahulkumar070.</li>
<li>Agents/OpenAI replay: preserve malformed function-call arguments in stored assistant history, avoid double-encoding preserved raw strings on replay, and coerce replayed string args back to objects at Anthropic and Google provider boundaries. (#61956) Thanks @100yenadmin.</li>
<li>Heartbeat/config: accept and honor <code>agents.defaults.heartbeat.timeoutSeconds</code> and per-agent heartbeat timeout overrides for heartbeat agent turns. (#64491) Thanks @cedillarack.</li>
<li>CLI/devices: make implicit <code>openclaw devices approve</code> selection preview-only and require approving the exact request ID, preventing latest-request races during device pairing. (#64160) Thanks @coygeek.</li>
<li>Media/security: honor sender-scoped <code>toolsBySender</code> policy for outbound host-media reads so denied senders cannot trigger host file disclosure via attachment hydration. (#64459) Thanks @eleqtrizit.</li>
<li>Browser/security: reject strict-policy hostname navigation unless the hostname is an explicit allowlist exception or IP literal, and route CDP HTTP discovery through the pinned SSRF fetch path. (#64367) Thanks @eleqtrizit.</li>
<li>Models/vLLM: ignore empty <code>tool_calls</code> arrays from reasoning-model OpenAI-compatible replies, reset false <code>toolUse</code> stop reasons when no actual tool calls were parsed, and stop sending <code>tool_choice</code> unless tools are present so vLLM reasoning responses no longer hang indefinitely. (#61197, #61534) Thanks @balajisiva.</li>
<li>Heartbeat/scheduling: spread interval heartbeats across stable per-agent phases derived from gateway identity, so provider traffic is distributed more uniformly across the configured interval instead of clustering around startup-relative times. (#64560) Thanks @odysseus0.</li>
</ul>
<p><a href="https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md">View full changelog</a></p>
]]></description>
<enclosure url="https://github.com/openclaw/openclaw/releases/download/v2026.4.10/OpenClaw-2026.4.10.zip" length="47259509" type="application/octet-stream" sparkle:edSignature="XY9FHxx09r2O9rlFs3t5UV9Zk2rGXSpWw5InazJhb661kgp6OKiOrrNTV631b2StWze5tnSEPXakkOCXq7O6DQ=="/>
</item>
<item>
<title>2026.4.9</title>
<pubDate>Thu, 09 Apr 2026 02:38:08 +0000</pubDate>
@@ -82,112 +226,5 @@
]]></description>
<enclosure url="https://github.com/openclaw/openclaw/releases/download/v2026.4.8/OpenClaw-2026.4.8.zip" length="25324810" type="application/octet-stream" sparkle:edSignature="aogl3hJf+FeRvQj0W4WDGMQnIRPpxXPQam50U7SBT3ljA1CeSbIGsnaj20aLF0Qc9DikPEXt5AEg7LMOen4+BQ=="/>
</item>
<item>
<title>2026.4.7</title>
<pubDate>Wed, 08 Apr 2026 02:54:26 +0000</pubDate>
<link>https://raw.githubusercontent.com/openclaw/openclaw/main/appcast.xml</link>
<sparkle:version>2026040790</sparkle:version>
<sparkle:shortVersionString>2026.4.7</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
<description><![CDATA[<h2>OpenClaw 2026.4.7</h2>
<h3>Changes</h3>
<ul>
<li>CLI/infer: add a first-class <code>openclaw infer ...</code> hub for provider-backed inference workflows across model, media, web, and embedding tasks. Thanks @Takhoffman.</li>
<li>Tools/media generation: auto-fallback across auth-backed image, music, and video providers by default, preserve intent during provider switches, remap size/aspect/resolution/duration hints to the closest supported option, and surface provider capabilities plus mode-aware video-to-video support.</li>
<li>Memory/wiki: restore the bundled <code>memory-wiki</code> stack with plugin, CLI, sync/query/apply tooling, memory-host integration, structured claim/evidence fields, compiled digest retrieval, claim-health linting, contradiction clustering, staleness dashboards, and freshness-weighted search. Thanks @vincentkoc.</li>
<li>Plugins/webhooks: add a bundled webhook ingress plugin so external automation can create and drive bound TaskFlows through per-route shared-secret endpoints. (#61892) Thanks @mbelinky.</li>
<li>Gateway/sessions: add persisted compaction checkpoints plus Sessions UI branch/restore actions so operators can inspect and recover pre-compaction session state. (#62146) Thanks @scoootscooob.</li>
<li>Compaction: add pluggable compaction provider registry so plugins can replace the built-in summarization pipeline. Configure via <code>agents.defaults.compaction.provider</code>; falls back to LLM summarization on provider failure. (#56224) Thanks @DhruvBhatia0.</li>
<li>Agents/system prompt: add <code>agents.defaults.systemPromptOverride</code> for controlled prompt experiments plus heartbeat prompt-section controls so heartbeat runtime behavior can stay enabled without injecting heartbeat instructions every turn.</li>
<li>Providers/Google: add Gemma 4 model support and keep Google fallback resolution on the requested provider path so native Google Gemma routes work again. (#61507) Thanks @eyjohn.</li>
<li>Providers/Google: preserve explicit thinking-off semantics for Gemma 4 while still enabling Gemma reasoning support in compatibility wrappers. (#62127) Thanks @romgenie.</li>
<li>Providers/Arcee AI: add a bundled Arcee AI provider plugin with Trinity catalog entries, OpenRouter support, and updated onboarding/auth guidance. (#62068) Thanks @arthurbr11.</li>
<li>Providers/Anthropic: restore Claude CLI as the preferred local Anthropic path in onboarding, model-auth guidance, doctor flows, and Docker Claude CLI live lanes again.</li>
<li>Providers/Ollama: detect vision capability from the <code>/api/show</code> response and set image input on models that support it so Ollama vision models accept image attachments. (#62193) Thanks @BruceMacD.</li>
<li>Memory/dreaming: ingest redacted session transcripts into the dreaming corpus with per-day session-corpus notes, cursor checkpointing, and promotion/doctor support. (#62227) Thanks @vignesh07.</li>
<li>Providers/inferrs: add string-content compatibility for stricter OpenAI-compatible chat backends, document <code>inferrs</code> setup with a full config example, and add troubleshooting guidance for local backends that pass direct probes but fail on full agent-runtime prompts.</li>
<li>Agents/context engine: expose prompt-cache runtime context to context engines and keep current-turn prompt-cache usage aligned with the active attempt instead of stale prior-turn assistant state. (#62179) Thanks @jalehman.</li>
<li>Plugin SDK/context engines: pass <code>availableTools</code> and <code>citationsMode</code> into <code>assemble()</code>, and expose memory-artifact and memory-prompt seams so companion plugins and non-legacy context engines can consume active memory state without reaching into internals. Thanks @vincentkoc.</li>
<li>ACP/ACPX plugin: bump the bundled <code>acpx</code> pin to <code>0.5.1</code> so plugin-local installs and strict version checks pick up the latest published runtime release. (#62148) Thanks @onutc.</li>
<li>Discord/events: allow <code>event-create</code> to accept a cover image URL or local file path, load and validate PNG/JPG/GIF event cover media, and pass the encoded image payload through Discord admin action/runtime paths. (#60883) Thanks @bittoby.</li>
</ul>
<h3>Fixes</h3>
<ul>
<li>CLI/infer: keep provider-backed infer behavior aligned with actual runtime execution by fixing explicit TTS override handling, profile-aware gateway TTS prefs resolution, per-request transcription <code>prompt</code>/<code>language</code> overrides, image output MIME/extension mismatches, configured web-search fallback behavior, and agent-vs-CLI web-search execution drift.</li>
<li>Plugins/media: when <code>plugins.allow</code> is set, capability fallback now merges bundled capability plugin ids into the allowlist (not only <code>plugins.entries</code>), so media understanding providers such as OpenAI-compatible STT load for voice transcription without requiring <code>openai</code> in <code>plugins.allow</code>. (#62205) Thanks @neeravmakwana.</li>
<li>Agents/history and replies: buffer phaseless OpenAI WS text until a real assistant phase arrives, keep replay and SSE history sequence tracking aligned, hide commentary and leaked tool XML from user-visible history, and keep history-based follow-up replies on <code>final_answer</code> text only. (#61729, #61747, #61829, #61855, #61954) Thanks @100yenadmin and contributors.</li>
<li>Control UI: show <code>/tts</code> audio replies in webchat, detect mistaken <code>?token=</code> auth links with the correct <code>#token=</code> hint, and keep Copy, Canvas, and mobile exec-approval UI from covering chat content on narrow screens. (#54842, #61514, #61598) Thanks @neeravmakwana.</li>
<li>iOS/gateway: replace string-matched connection error UI with structured gateway connection problems, preserve actionable pairing/auth failures over later generic disconnect noise, and surface reusable problem banners and details across onboarding, settings, and root status surfaces. (#62650) Thanks @ngutman.</li>
<li>TUI: route <code>/status</code> through the shared session-status command, keep commentary hidden in history, strip raw envelope metadata from async command notices, preserve fallback streaming before per-attempt failures finalize, and restore Kitty keyboard state on exit or fatal crashes. (#49130, #59985, #60043, #61463) Thanks @biefan and contributors.</li>
<li>iOS/Watch exec approvals: keep Apple Watch review and approval recovery working while the iPhone is locked or backgrounded, including reconnect recovery, pending approval persistence, notification cleanup, and APNs-backed watch refresh recovery. (#61757) Thanks @ngutman.</li>
<li>Agents/context overflow: combine oversized and aggregate tool-result recovery in one pass and restore a total-context overflow backstop so recoverable sessions retry instead of failing early. (#61651) Thanks @Takhoffman.</li>
<li>Auth/OpenAI Codex OAuth: reload fresh on-disk credentials inside the locked refresh path and retry once after <code>refresh_token_reused</code> rotates only the stored refresh token, so relogin/restart recovery stops getting stuck on stale cached auth state. Thanks @owen-ever.</li>
<li>Auth/OpenAI Codex OAuth: keep native <code>/model ...@profile</code> selections on the target session and honor explicit user-locked auth profiles even when per-agent auth order excludes them. (#62744) Thanks @jalehman.</li>
<li>Providers/Anthropic: preserve thinking blocks for Claude Opus 4.5+, Sonnet 4.5+, and newer Claude 4-family models so prompt-cache prefixes keep matching, and skip <code>service_tier</code> injection on OAuth-authenticated stream wrapper requests so Claude OAuth streaming stops failing with HTTP 401. (#60356, #61793)</li>
<li>Agents/Claude CLI: surface nested API error messages from structured CLI output so billing/auth/provider failures show the real provider error instead of an opaque CLI failure.</li>
<li>Agents/exec: preserve explicit <code>host=node</code> routing under elevated defaults when <code>tools.exec.host=auto</code>, fail loud on invalid elevated cross-host overrides, and keep <code>strictInlineEval</code> commands blocked after approval timeouts instead of falling through to automatic execution. (#61739) Thanks @obviyus.</li>
<li>Nodes/exec approvals: keep <code>host=node</code> POSIX transport shell wrappers (<code>/bin/sh -lc ...</code>) aligned with inner-command allowlist analysis so allowlisted scripts stop prompting unnecessarily, while Windows <code>cmd.exe</code> wrapper runs stay approval-gated. (#62401) Thanks @ngutman.</li>
<li>Nodes/exec approvals: keep Windows <code>cmd.exe /c</code> wrapper runs approval-gated even when <code>env</code> carriers, including env-assignment carriers, wrap the shell invocation. (#62439) Thanks @ngutman.</li>
<li>Gateway tool/exec config: block model-facing <code>gateway config.apply</code> and <code>config.patch</code> writes from changing exec approval paths such as <code>safeBins</code>, <code>safeBinProfiles</code>, <code>safeBinTrustedDirs</code>, and <code>strictInlineEval</code>, while still allowing unchanged structured values through. (#62001) Thanks @eleqtrizit.</li>
<li>Host exec/env sanitization: block dangerous Java, Rust, Cargo, Git, Kubernetes, cloud credential, config-path, and Helm env overrides so host-run tools cannot be redirected to attacker-chosen code, config, credentials, or repository state. (#59119, #62002, #62291) Thanks @eleqtrizit and contributors.</li>
<li>Commands/allowlist: require owner authorization for <code>/allowlist add</code> and <code>/allowlist remove</code> before channel resolution, so non-owner but command-authorized senders can no longer persistently rewrite allowlist policy state. (#62383) Thanks @pgondhi987.</li>
<li>Feishu/docx uploads: honor <code>tools.fs.workspaceOnly</code> for local <code>upload_file</code> and <code>upload_image</code> paths by forwarding workspace-constrained <code>localRoots</code> into the media loader, so docx uploads can no longer read host-local files outside the workspace when workspace-only mode is active. (#62369) Thanks @pgondhi987.</li>
<li>Network/fetch guard: drop request bodies and body-describing headers on cross-origin <code>307</code> and <code>308</code> redirects by default, so attacker-controlled redirect hops cannot receive secret-bearing POST payloads from SSRF-guarded fetch flows unless a caller explicitly opts in. (#62357) Thanks @pgondhi987.</li>
<li>Browser/SSRF: treat main-frame <code>document</code> redirect hops as navigations even when Playwright does not flag them as <code>isNavigationRequest()</code>, so strict private-network blocking still stops forbidden redirect pivots before the browser reaches the internal target. (#62355) Thanks @pgondhi987.</li>
<li>Browser/node invoke: block persistent browser profile create, reset, and delete mutations through <code>browser.proxy</code> on both gateway-forwarded <code>node.invoke</code> and the node-host proxy path, even when no profile allowlist is configured. (#60489)</li>
<li>Gateway/node pairing: require a fresh pairing request when a previously paired node reconnects with additional declared commands, and keep the live session pinned to the earlier approved command set until the upgrade is approved. (#62658) Thanks @eleqtrizit.</li>
<li>Gateway/auth: invalidate existing shared-token and password WebSocket sessions when the configured secret rotates, so stale authenticated sockets cannot stay attached after token or password changes. (#62350) Thanks @pgondhi987.</li>
<li>MS Teams/security: validate file-consent upload URLs against HTTPS, Microsoft/SharePoint host allowlists, and private-IP DNS checks before uploading attachments, blocking SSRF-style consent-upload abuse. (#23596)</li>
<li>Media/base64 decode guards: enforce byte limits before decoding missed base64-backed Teams, Signal, QQ Bot, and image-tool payloads so oversized inbound media and data URLs no longer bypass pre-decode size checks. (#62007) Thanks @eleqtrizit.</li>
<li>Runtime event trust: mark background <code>notifyOnExit</code> summaries, ACP parent-stream relays, and wake-hook payloads as untrusted system events so lower-trust runtime output no longer re-enters later turns as trusted <code>System:</code> text. (#62003)</li>
<li>Auto-reply/media: allow managed generated-media <code>MEDIA:</code> paths from normal reply text again while still blocking arbitrary host-local media and document paths, so generated media keep delivering without reopening host-path injection holes.</li>
<li>Gateway/status and containers: auto-bind to <code>0.0.0.0</code> inside Docker and Podman environments, and probe local TLS gateways over <code>wss://</code> with self-signed fingerprint forwarding so container startup and loopback TLS status checks work again. (#61818, #61935) Thanks @openperf and contributors.</li>
<li>Gateway/OpenAI-compatible HTTP: abort in-flight <code>/v1/chat/completions</code> and <code>/v1/responses</code> turns when clients disconnect so abandoned HTTP requests stop wasting agent runtime. (#54388) Thanks @Lellansin.</li>
<li>macOS/gateway version: strip trailing commit metadata from CLI version output before semver parsing so the Mac app recognizes installed gateway versions like <code>OpenClaw 2026.4.2 (d74a122)</code> again. (#61111) Thanks @oliviareid-svg.</li>
<li>Sessions/model selection: resolve the explicitly selected session model separately from runtime fallback resolution so session status and live model switching stay aligned with the chosen model.</li>
<li>Discord/ACP bindings: canonicalize DM conversation identity across inbound messages, component interactions, native commands, and current-conversation binding resolution so <code>--bind here</code> in Discord DMs keeps routing follow-up replies to the bound agent instead of falling back to the default agent.</li>
<li>Discord: recover forwarded referenced message text and attachments when snapshots are missing, use <code>ws://</code> again for gateway monitor sockets, stop forcing a hardcoded temperature for Codex-backed auto-thread titles, and harden voice receive recovery so rapid speaker restarts keep their next utterance. (#41536, #61670) Thanks @artwalker and contributors.</li>
<li>Slack/thread mentions: add <code>channels.slack.thread.requireExplicitMention</code> so Slack channels that already require mentions can also require explicit <code>@bot</code> mentions inside bot-participated threads. (#58276) Thanks @praktika-engineer.</li>
<li>Slack/threading: keep legacy thread stickiness for real replies when older callers omit <code>isThreadReply</code>, while still honoring <code>replyToMode</code> for Slack's auto-created top-level <code>thread_ts</code>. (#61835) Thanks @kaonash.</li>
<li>Slack/media: keep attachment downloads on the SSRF-guarded dispatcher path so Slack media fetching works on Node 22 without dropping pinned transport enforcement. (#62239) Thanks @openperf.</li>
<li>Matrix/onboarding: add an invite auto-join setup step with explicit off warnings and strict stable-target validation so new Matrix accounts stop silently ignoring invited rooms and fresh DM-style invites unless operators opt in. (#62168) Thanks @gumadeiras.</li>
<li>Matrix/formatting: preserve multi-paragraph and loose-list rendering in Element so numbered and bulleted Markdown keeps their content attached to the correct list item. (#60997) Thanks @gucasbrg.</li>
<li>Telegram/doctor: keep top-level access-control fallback in place during multi-account normalization while still promoting legacy default auth into <code>accounts.default</code>, so existing named bots keep inherited allowlists without dropping the legacy default bot. (#62263) Thanks @obviyus.</li>
<li>Plugins/loaders: centralize bundled <code>dist/**</code> Jiti native-load policy and keep channel, public-surface, facade, and config-metadata loader seams off native Jiti on Windows so onboarding and configure flows stop tripping <code>ERR_UNSUPPORTED_ESM_URL_SCHEME</code>. (#62286) Thanks @chen-zhang-cs-code.</li>
<li>Plugins/channels: keep bundled channel artifact and secret-contract loading stable under lazy loading, preserve plugin-schema defaults during install, and fix Windows <code>file://</code> plus native-Jiti plugin loader paths so onboarding, doctor, <code>openclaw secret</code>, and bundled plugin installs work again. (#61832, #61836, #61853, #61856) Thanks @Zeesejo and contributors.</li>
<li>Plugins/ClawHub: verify downloaded plugin archives against version metadata SHA-256, fail closed when archive integrity metadata is missing or malformed, and tighten fallback ZIP verification so plugin installs cannot proceed on mismatched or incomplete ClawHub package metadata. (#60517) Thanks @mappel-nv.</li>
<li>Plugins/provider hooks: stop recursive provider snapshot loads from overflowing the stack during plugin initialization, while still preserving cached nested provider-hook results. (#61922, #61938, #61946, #61951)</li>
<li>Docker/plugins: stop forcing bundled plugin discovery to <code>/app/extensions</code> in runtime images so packaged installs use compiled <code>dist/extensions</code> artifacts again and Node 24 containers do not boot through source-only plugin entry paths. Fixes #62044. (#62316) Thanks @gumadeiras.</li>
<li>Providers/Ollama: honor the selected provider's <code>baseUrl</code> during streaming so multi-Ollama setups stop routing every stream to the first configured Ollama endpoint. (#61678)</li>
<li>Providers/Ollama: stop warning that Ollama could not be reached when discovery only sees empty default local stubs, while still keeping real explicit Ollama overrides loud when the endpoint is unreachable.</li>
<li>Providers/xAI: recognize <code>api.grok.x.ai</code> as an xAI-native endpoint again and keep legacy <code>x_search</code> auth resolution working so older xAI web-search configs continue to load. (#61377) Thanks @jjjojoj.</li>
<li>Providers/Mistral: send <code>reasoning_effort</code> for <code>mistral/mistral-small-latest</code> (Mistral Small 4) with thinking-level mapping, and mark the catalog entry as reasoning-capable so adjustable reasoning matches Mistrals Chat Completions API. (#62162) Thanks @neeravmakwana.</li>
<li>OpenAI TTS/Groq: send <code>wav</code> to Groq-compatible speech endpoints, honor explicit <code>responseFormat</code> overrides on OpenAI-compatible paths, and only mark voice-note output as voice-compatible when the actual format is <code>opus</code>. (#62233) Thanks @neeravmakwana.</li>
<li>Tools/web_fetch and web_search: fix <code>TypeError: fetch failed</code> caused by undici 8.0 enabling HTTP/2 by default; pinned SSRF-guard dispatchers now explicitly set <code>allowH2: false</code> to restore HTTP/1.1 behavior and keep the custom DNS-pinning lookup compatible. (#61738, #61777) Thanks @zozo123.</li>
<li>Tools/web search/Exa: show Exa Search in onboarding and configure provider pickers again by marking the bundled Exa provider as setup-visible. Thanks @vincentkoc.</li>
<li>Memory/vector recall: surface explicit warnings when <code>sqlite-vec</code> is unavailable or vector writes are degraded, and strip managed Light Sleep and REM blocks before daily-note ingestion so memory indexing and dreaming stop reporting false-success or re-ingesting staged output. (#61720) Thanks @MonkeyLeeT.</li>
<li>Memory/dreaming: make Dreams config reads and writes respect the selected memory slot plugin instead of always targeting <code>memory-core</code>. (#62275) Thanks @SnowSky1.</li>
<li>QQ Bot/media: route gateway-side attachment and fallback downloads through guarded QQ/Tencent HTTPS fetches so QQ media handling no longer follows arbitrary remote hosts.</li>
<li>Browser/remote CDP: retry the DevTools websocket once after remote browser restarts so healthy remote browser profiles do not fail availability checks during CDP warm-up. (#57397) Thanks @ThanhNguyxn07.</li>
<li>UI/light mode: target both root and nested WebKit scrollbar thumbs in the light theme so page-level and container scrollbars stay visible on light backgrounds. (#61753) Thanks @chziyue.</li>
<li>Agents/subagents: honor <code>sessions_spawn(lightContext: true)</code> for spawned subagent runs by preserving lightweight bootstrap context through the gateway and embedded runner instead of silently falling back to full workspace bootstrap injection. (#62264) Thanks @theSamPadilla.</li>
<li>Cron: load <code>jobId</code> into <code>id</code> when the on-disk store omits <code>id</code>, matching doctor migration and fixing <code>unknown cron job id</code> for hand-edited <code>jobs.json</code>. (#62246) Thanks @neeravmakwana.</li>
<li>Agents/model fallback: classify minimal HTTP 404 API errors (for example <code>404 status code (no body)</code>) as <code>model_not_found</code> so assistant failures throw into the fallback chain instead of stopping at the first fallback candidate. (#62119) Thanks @neeravmakwana.</li>
<li>BlueBubbles/network: respect explicit private-network opt-out for loopback and private <code>serverUrl</code> values across account resolution, status probes, monitor startup, and attachment downloads, while keeping public-host attachment hostname pinning intact. (#59373) Thanks @jpreagan.</li>
<li>Agents/heartbeat: keep heartbeat runs pinned to the main session so active subagent transcripts are not overwritten by heartbeat status messages. (#61803) Thanks @100yenadmin.</li>
<li>Agents/heartbeat: respect disabled heartbeat prompt guidance so operators can suppress heartbeat prompt instructions without disabling heartbeat runtime behavior.</li>
<li>Agents/compaction: stop compaction-wait aborts from re-entering prompt failover and replaying completed tool turns. (#62600) Thanks @i-dentifier.</li>
<li>Approvals/runtime: move native approval lifecycle assembly into shared core bootstrap/runtime seams driven by channel capabilities and runtime contexts, and remove the legacy bundled approval fallback wiring. (#62135) Thanks @gumadeiras.</li>
<li>Security/fetch-guard: stop rejecting operator-configured proxy hostnames against the target-scoped hostname allowlist in SSRF-guarded fetches, restoring proxy-based media downloads for Telegram and other channels. (#62312) Thanks @ademczuk.</li>
<li>Logging: make <code>logging.level</code> and <code>logging.consoleLevel</code> honor the documented severity threshold ordering again, and keep child loggers inheriting the parent <code>minLevel</code>. (#44646) Thanks @zhumengzhu.</li>
<li>Agents/sessions_send: pass <code>threadId</code> through announce delivery so cross-session notifications land in the correct Telegram forum topic instead of the group's general thread. (#62758) Thanks @jalehman.</li>
<li>Daemon/systemd: keep sudo systemctl calls scoped to the invoking user when machine-scoped systemctl fails, while still avoiding machine fallback for permission-denied user bus errors. (#62337) Thanks @Aftabbs.</li>
<li>Docs/i18n: relocalize final localized-page links after translation and remove the zh-CN homepage redirect override so localized Mintlify pages resolve to the correct language roots again. (#61796) Thanks @hxy91819.</li>
<li>Agents/exec: keep timed-out shell-backgrounded commands on the failed path and point long-running jobs to exec background/yield sessions so process polling is only suggested for registered sessions.</li>
</ul>
<p><a href="https://github.com/openclaw/openclaw/blob/main/CHANGELOG.md">View full changelog</a></p>
]]></description>
<enclosure url="https://github.com/openclaw/openclaw/releases/download/v2026.4.7/OpenClaw-2026.4.7.zip" length="25324827" type="application/octet-stream" sparkle:edSignature="RyFWRz1trE/qvOiInD4vR6je9wx7fUTtHpZ94W8rMlZDByux9CyXOm/Anai96b9KyjTeQyC7YnJp5SRnYY3iCg=="/>
</item>
</channel>
</rss>

View File

@@ -65,8 +65,8 @@ android {
applicationId = "ai.openclaw.app"
minSdk = 31
targetSdk = 36
versionCode = 2026041001
versionName = "2026.4.10"
versionCode = 2026041101
versionName = "2026.4.11"
ndk {
// Support all major ABIs — native libs are tiny (~47 KB per ABI)
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")

View File

@@ -1,12 +1,8 @@
# OpenClaw iOS Changelog
## Unreleased
## 2026.4.11 - 2026-04-11
### Added
### Changed
### Fixed
Maintenance update for the current OpenClaw release.
## 2026.4.10 - 2026-04-10

View File

@@ -2,8 +2,8 @@
// Source of truth: apps/ios/version.json
// Generated by scripts/ios-sync-versioning.ts.
OPENCLAW_IOS_VERSION = 2026.4.10
OPENCLAW_MARKETING_VERSION = 2026.4.10
OPENCLAW_IOS_VERSION = 2026.4.11
OPENCLAW_MARKETING_VERSION = 2026.4.11
OPENCLAW_BUILD_VERSION = 1
#include? "../build/Version.xcconfig"

View File

@@ -1,3 +1,3 @@
{
"version": "2026.4.10"
"version": "2026.4.11"
}

View File

@@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2026.4.10</string>
<string>2026.4.11</string>
<key>CFBundleVersion</key>
<string>2026041001</string>
<string>2026041101</string>
<key>CFBundleIconFile</key>
<string>OpenClaw</string>
<key>CFBundleURLTypes</key>

View File

@@ -11,6 +11,40 @@ enum ShellExecutor {
var errorMessage: String?
}
private final class CompletionBox: @unchecked Sendable {
private let lock = NSLock()
private var finished = false
private let continuation: CheckedContinuation<ShellResult, Never>
init(continuation: CheckedContinuation<ShellResult, Never>) {
self.continuation = continuation
}
func finish(_ result: ShellResult) {
self.lock.lock()
defer { self.lock.unlock() }
guard !self.finished else { return }
self.finished = true
self.continuation.resume(returning: result)
}
}
private static func completedResult(
status: Int,
outTask: Task<Data, Never>,
errTask: Task<Data, Never>) async -> ShellResult
{
let out = await outTask.value
let err = await errTask.value
return ShellResult(
stdout: String(bytes: out, encoding: .utf8) ?? "",
stderr: String(bytes: err, encoding: .utf8) ?? "",
exitCode: status,
timedOut: false,
success: status == 0,
errorMessage: status == 0 ? nil : "exit \(status)")
}
static func runDetailed(
command: [String],
cwd: String?,
@@ -38,6 +72,53 @@ enum ShellExecutor {
process.standardOutput = stdoutPipe
process.standardError = stderrPipe
let outTask = Task { stdoutPipe.fileHandleForReading.readToEndSafely() }
let errTask = Task { stderrPipe.fileHandleForReading.readToEndSafely() }
if let timeout, timeout > 0 {
return await withCheckedContinuation { continuation in
let completion = CompletionBox(continuation: continuation)
process.terminationHandler = { terminatedProcess in
let status = Int(terminatedProcess.terminationStatus)
Task {
let result = await self.completedResult(
status: status,
outTask: outTask,
errTask: errTask)
completion.finish(result)
}
}
do {
try process.run()
} catch {
completion.finish(
ShellResult(
stdout: "",
stderr: "",
exitCode: nil,
timedOut: false,
success: false,
errorMessage: "failed to start: \(error.localizedDescription)"))
return
}
DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + timeout) {
guard process.isRunning else { return }
process.terminate()
completion.finish(
ShellResult(
stdout: "",
stderr: "",
exitCode: nil,
timedOut: true,
success: false,
errorMessage: "timeout"))
}
}
}
do {
try process.run()
} catch {
@@ -50,48 +131,11 @@ enum ShellExecutor {
errorMessage: "failed to start: \(error.localizedDescription)")
}
let outTask = Task { stdoutPipe.fileHandleForReading.readToEndSafely() }
let errTask = Task { stderrPipe.fileHandleForReading.readToEndSafely() }
let waitTask = Task { () -> ShellResult in
process.waitUntilExit()
let out = await outTask.value
let err = await errTask.value
let status = Int(process.terminationStatus)
return ShellResult(
stdout: String(bytes: out, encoding: .utf8) ?? "",
stderr: String(bytes: err, encoding: .utf8) ?? "",
exitCode: status,
timedOut: false,
success: status == 0,
errorMessage: status == 0 ? nil : "exit \(status)")
}
if let timeout, timeout > 0 {
let nanos = UInt64(timeout * 1_000_000_000)
return await withTaskGroup(of: ShellResult.self) { group in
group.addTask { await waitTask.value }
group.addTask {
try? await Task.sleep(nanoseconds: nanos)
guard process.isRunning else {
return await waitTask.value
}
process.terminate()
return ShellResult(
stdout: "",
stderr: "",
exitCode: nil,
timedOut: true,
success: false,
errorMessage: "timeout")
}
let first = await group.next()!
group.cancelAll()
return first
}
}
return await waitTask.value
process.waitUntilExit()
return await self.completedResult(
status: Int(process.terminationStatus),
outTask: outTask,
errTask: errTask)
}
static func run(command: [String], cwd: String?, env: [String: String]?, timeout: Double?) async -> Response {

View File

@@ -128,8 +128,9 @@ actor TalkModeRuntime {
private func start() async {
let gen = self.lifecycleGeneration
guard voiceWakeSupported else { return }
guard PermissionManager.voiceWakePermissionsGranted() else {
self.logger.debug("talk runtime not starting: permissions missing")
guard await PermissionManager.ensureVoiceWakePermissions(interactive: true) else {
self.logger.error("talk runtime not starting: permissions missing")
return
}
await self.reloadConfig()

View File

@@ -401,6 +401,60 @@ public struct AgentEvent: Codable, Sendable {
}
}
public struct MessageActionParams: Codable, Sendable {
public let channel: String
public let action: String
public let params: [String: AnyCodable]
public let accountid: String?
public let requestersenderid: String?
public let senderisowner: Bool?
public let sessionkey: String?
public let sessionid: String?
public let agentid: String?
public let toolcontext: [String: AnyCodable]?
public let idempotencykey: String
public init(
channel: String,
action: String,
params: [String: AnyCodable],
accountid: String?,
requestersenderid: String?,
senderisowner: Bool?,
sessionkey: String?,
sessionid: String?,
agentid: String?,
toolcontext: [String: AnyCodable]?,
idempotencykey: String)
{
self.channel = channel
self.action = action
self.params = params
self.accountid = accountid
self.requestersenderid = requestersenderid
self.senderisowner = senderisowner
self.sessionkey = sessionkey
self.sessionid = sessionid
self.agentid = agentid
self.toolcontext = toolcontext
self.idempotencykey = idempotencykey
}
private enum CodingKeys: String, CodingKey {
case channel
case action
case params
case accountid = "accountId"
case requestersenderid = "requesterSenderId"
case senderisowner = "senderIsOwner"
case sessionkey = "sessionKey"
case sessionid = "sessionId"
case agentid = "agentId"
case toolcontext = "toolContext"
case idempotencykey = "idempotencyKey"
}
}
public struct SendParams: Codable, Sendable {
public let to: String
public let message: String?

View File

@@ -401,6 +401,60 @@ public struct AgentEvent: Codable, Sendable {
}
}
public struct MessageActionParams: Codable, Sendable {
public let channel: String
public let action: String
public let params: [String: AnyCodable]
public let accountid: String?
public let requestersenderid: String?
public let senderisowner: Bool?
public let sessionkey: String?
public let sessionid: String?
public let agentid: String?
public let toolcontext: [String: AnyCodable]?
public let idempotencykey: String
public init(
channel: String,
action: String,
params: [String: AnyCodable],
accountid: String?,
requestersenderid: String?,
senderisowner: Bool?,
sessionkey: String?,
sessionid: String?,
agentid: String?,
toolcontext: [String: AnyCodable]?,
idempotencykey: String)
{
self.channel = channel
self.action = action
self.params = params
self.accountid = accountid
self.requestersenderid = requestersenderid
self.senderisowner = senderisowner
self.sessionkey = sessionkey
self.sessionid = sessionid
self.agentid = agentid
self.toolcontext = toolcontext
self.idempotencykey = idempotencykey
}
private enum CodingKeys: String, CodingKey {
case channel
case action
case params
case accountid = "accountId"
case requestersenderid = "requesterSenderId"
case senderisowner = "senderIsOwner"
case sessionkey = "sessionKey"
case sessionid = "sessionId"
case agentid = "agentId"
case toolcontext = "toolContext"
case idempotencykey = "idempotencyKey"
}
}
public struct SendParams: Codable, Sendable {
public let to: String
public let message: String?

View File

@@ -1,4 +1,4 @@
228031f16ad06580bfd137f092d70d03f2796515e723b8b6618ed69d285465fa config-baseline.json
bad0a5bb247a62b8fb9ed9fc2b2720eacf3e0913077ac351b5d26ae2723335ad config-baseline.core.json
e1f94346a8507ce3dec763b598e79f3bb89ff2e33189ce977cc87d3b05e71c1d config-baseline.channel.json
fce3cbf24274016e01324082ad8ffe81fe2fb41a6e6314aa6efcdbe6689fd628 config-baseline.json
fb6f0ef881fb591d2791d2adca43c7e88d48f8b562457683092ab6e767aece78 config-baseline.core.json
3bb312dc9c39a374ca92613abf21606c25dc571287a3941dac71ff57b2b5c519 config-baseline.channel.json
6c19997f1fb2aff4315f2cb9c7d9e299b403fbc0f9e78e3412cc7fe1c655f222 config-baseline.plugin.json

View File

@@ -1,2 +1,2 @@
ee16273fa5ad8c5408e9dad8d96fde86dfa666ef8eb44840b78135814ff97173 plugin-sdk-api-baseline.json
2bd0d5edf23e6a889d6bedb74d0d06411dd7750dac6ebf24971c789f8a69253a plugin-sdk-api-baseline.jsonl
f0d71b70eb54d67fdc35dde8a5051e527c8a910b7b981f5075d78a5160dd08fa plugin-sdk-api-baseline.json
e305bb63072efa680951babd1eb1f419e9965d8a4bdabfc9bf3cafe24a8551df plugin-sdk-api-baseline.jsonl

View File

@@ -9,7 +9,7 @@ title: "Microsoft Teams"
> "Abandon all hope, ye who enter here."
Updated: 2026-01-21
Updated: 2026-03-25
Status: text + DM attachments are supported; channel/group file sending requires `sharePointSiteId` + Graph permissions (see [Sending files in group chats](#sending-files-in-group-chats)). Polls are sent via Adaptive Cards. Message actions expose explicit `upload-file` for file-first sends.
@@ -43,7 +43,7 @@ Details: [Plugins](/tools/plugin)
4. Expose `/api/messages` (port 3978 by default) via a public URL or tunnel.
5. Install the Teams app package and start the gateway.
Minimal config:
Minimal config (client secret):
```json5
{
@@ -59,6 +59,8 @@ Minimal config:
}
```
For production deployments, consider using [federated authentication](#federated-authentication-certificate--managed-identity) (certificate or managed identity) instead of client secrets.
Note: group chats are blocked by default (`channels.msteams.groupPolicy: "allowlist"`). To allow group replies, set `channels.msteams.groupAllowFrom` (or use `groupPolicy: "open"` to allow any member, mention-gated).
## Goals
@@ -190,6 +192,148 @@ Before configuring OpenClaw, you need to create an Azure Bot resource.
2. Click **Microsoft Teams** → Configure → Save
3. Accept the Terms of Service
## Federated Authentication (Certificate + Managed Identity)
> Added in 2026.3.24
For production deployments, OpenClaw supports **federated authentication** as a more secure alternative to client secrets. Two methods are available:
### Option A: Certificate-based authentication
Use a PEM certificate registered with your Entra ID app registration.
**Setup:**
1. Generate or obtain a certificate (PEM format with private key).
2. In Entra ID → App Registration → **Certificates & secrets****Certificates** → Upload the public certificate.
**Config:**
```json5
{
channels: {
msteams: {
enabled: true,
appId: "<APP_ID>",
tenantId: "<TENANT_ID>",
authType: "federated",
certificatePath: "/path/to/cert.pem",
webhook: { port: 3978, path: "/api/messages" },
},
},
}
```
**Env vars:**
- `MSTEAMS_AUTH_TYPE=federated`
- `MSTEAMS_CERTIFICATE_PATH=/path/to/cert.pem`
### Option B: Azure Managed Identity
Use Azure Managed Identity for passwordless authentication. This is ideal for deployments on Azure infrastructure (AKS, App Service, Azure VMs) where a managed identity is available.
**How it works:**
1. The bot pod/VM has a managed identity (system-assigned or user-assigned).
2. A **federated identity credential** links the managed identity to the Entra ID app registration.
3. At runtime, OpenClaw uses `@azure/identity` to acquire tokens from the Azure IMDS endpoint (`169.254.169.254`).
4. The token is passed to the Teams SDK for bot authentication.
**Prerequisites:**
- Azure infrastructure with managed identity enabled (AKS workload identity, App Service, VM)
- Federated identity credential created on the Entra ID app registration
- Network access to IMDS (`169.254.169.254:80`) from the pod/VM
**Config (system-assigned managed identity):**
```json5
{
channels: {
msteams: {
enabled: true,
appId: "<APP_ID>",
tenantId: "<TENANT_ID>",
authType: "federated",
useManagedIdentity: true,
webhook: { port: 3978, path: "/api/messages" },
},
},
}
```
**Config (user-assigned managed identity):**
```json5
{
channels: {
msteams: {
enabled: true,
appId: "<APP_ID>",
tenantId: "<TENANT_ID>",
authType: "federated",
useManagedIdentity: true,
managedIdentityClientId: "<MI_CLIENT_ID>",
webhook: { port: 3978, path: "/api/messages" },
},
},
}
```
**Env vars:**
- `MSTEAMS_AUTH_TYPE=federated`
- `MSTEAMS_USE_MANAGED_IDENTITY=true`
- `MSTEAMS_MANAGED_IDENTITY_CLIENT_ID=<client-id>` (only for user-assigned)
### AKS Workload Identity Setup
For AKS deployments using workload identity:
1. **Enable workload identity** on your AKS cluster.
2. **Create a federated identity credential** on the Entra ID app registration:
```bash
az ad app federated-credential create --id <APP_OBJECT_ID> --parameters '{
"name": "my-bot-workload-identity",
"issuer": "<AKS_OIDC_ISSUER_URL>",
"subject": "system:serviceaccount:<NAMESPACE>:<SERVICE_ACCOUNT>",
"audiences": ["api://AzureADTokenExchange"]
}'
```
3. **Annotate the Kubernetes service account** with the app client ID:
```yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-bot-sa
annotations:
azure.workload.identity/client-id: "<APP_CLIENT_ID>"
```
4. **Label the pod** for workload identity injection:
```yaml
metadata:
labels:
azure.workload.identity/use: "true"
```
5. **Ensure network access** to IMDS (`169.254.169.254`) — if using NetworkPolicy, add an egress rule allowing traffic to `169.254.169.254/32` on port 80.
### Auth type comparison
| Method | Config | Pros | Cons |
| -------------------- | ---------------------------------------------- | ---------------------------------- | ------------------------------------- |
| **Client secret** | `appPassword` | Simple setup | Secret rotation required, less secure |
| **Certificate** | `authType: "federated"` + `certificatePath` | No shared secret over network | Certificate management overhead |
| **Managed Identity** | `authType: "federated"` + `useManagedIdentity` | Passwordless, no secrets to manage | Azure infrastructure required |
**Default behavior:** When `authType` is not set, OpenClaw defaults to client secret authentication. Existing configurations continue to work without changes.
## Local Development (Tunneling)
Teams can't reach `localhost`. Use a tunnel for local development:
@@ -279,6 +423,11 @@ This is often easier than hand-editing JSON manifests.
- `MSTEAMS_APP_ID`
- `MSTEAMS_APP_PASSWORD`
- `MSTEAMS_TENANT_ID`
- `MSTEAMS_AUTH_TYPE` (optional: `"secret"` or `"federated"`)
- `MSTEAMS_CERTIFICATE_PATH` (federated + certificate)
- `MSTEAMS_CERTIFICATE_THUMBPRINT` (optional, not required for auth)
- `MSTEAMS_USE_MANAGED_IDENTITY` (federated + managed identity)
- `MSTEAMS_MANAGED_IDENTITY_CLIENT_ID` (user-assigned MI only)
5. **Bot endpoint**
- Set the Azure Bot Messaging Endpoint to:
@@ -492,6 +641,11 @@ Key settings (see `/gateway/configuration` for shared channel patterns):
- `toolsBySender` keys should use explicit prefixes:
`id:`, `e164:`, `username:`, `name:` (legacy unprefixed keys still map to `id:` only).
- `channels.msteams.actions.memberInfo`: enable or disable the Graph-backed member info action (default: enabled when Graph credentials are available).
- `channels.msteams.authType`: authentication type — `"secret"` (default) or `"federated"`.
- `channels.msteams.certificatePath`: path to PEM certificate file (federated + certificate auth).
- `channels.msteams.certificateThumbprint`: certificate thumbprint (optional, not required for auth).
- `channels.msteams.useManagedIdentity`: enable managed identity auth (federated mode).
- `channels.msteams.managedIdentityClientId`: client ID for user-assigned managed identity.
- `channels.msteams.sharePointSiteId`: SharePoint site ID for file uploads in group chats/channels (see [Sending files in group chats](#sending-files-in-group-chats)).
## Routing & Sessions

View File

@@ -57,7 +57,7 @@ available.
After that, restart the gateway:
```bash
node scripts/run-node.mjs gateway --profile dev
openclaw gateway
```
To inspect it live in a conversation:
@@ -102,7 +102,7 @@ Start with this in `openclaw.json`:
Then restart the gateway:
```bash
node scripts/run-node.mjs gateway --profile dev
openclaw gateway
```
What this means:

View File

@@ -2895,6 +2895,8 @@ See [Plugins](/tools/plugin).
enabled: true,
basePath: "/openclaw",
// root: "dist/control-ui",
// embedSandbox: "scripts", // strict | scripts | trusted
// allowExternalEmbedUrls: false, // dangerous: allow absolute external http(s) embed URLs
// allowedOrigins: ["https://control.example.com"], // required for non-loopback Control UI
// dangerouslyAllowHostHeaderOriginFallback: false, // dangerous Host-header origin fallback mode
// allowInsecureAuth: false,

View File

@@ -0,0 +1,164 @@
# GPT-5.4 / Codex Parity Maintainer Notes
This note explains how to review the GPT-5.4 / Codex parity program as four merge units without losing the original six-contract architecture.
## Merge units
### PR A: strict-agentic execution
Owns:
- `executionContract`
- GPT-5-first same-turn follow-through
- `update_plan` as non-terminal progress tracking
- explicit blocked states instead of plan-only silent stops
Does not own:
- auth/runtime failure classification
- permission truthfulness
- replay/continuation redesign
- parity benchmarking
### PR B: runtime truthfulness
Owns:
- Codex OAuth scope correctness
- typed provider/runtime failure classification
- truthful `/elevated full` availability and blocked reasons
Does not own:
- tool schema normalization
- replay/liveness state
- benchmark gating
### PR C: execution correctness
Owns:
- provider-owned OpenAI/Codex tool compatibility
- parameter-free strict schema handling
- replay-invalid surfacing
- paused, blocked, and abandoned long-task state visibility
Does not own:
- self-elected continuation
- generic Codex dialect behavior outside provider hooks
- benchmark gating
### PR D: parity harness
Owns:
- first-wave GPT-5.4 vs Opus 4.6 scenario pack
- parity documentation
- parity report and release-gate mechanics
Does not own:
- runtime behavior changes outside QA-lab
- auth/proxy/DNS simulation inside the harness
## Mapping back to the original six contracts
| Original contract | Merge unit |
| ---------------------------------------- | ---------- |
| Provider transport/auth correctness | PR B |
| Tool contract/schema compatibility | PR C |
| Same-turn execution | PR A |
| Permission truthfulness | PR B |
| Replay/continuation/liveness correctness | PR C |
| Benchmark/release gate | PR D |
## Review order
1. PR A
2. PR B
3. PR C
4. PR D
PR D is the proof layer. It should not be the reason runtime-correctness PRs are delayed.
## What to look for
### PR A
- GPT-5 runs act or fail closed instead of stopping at commentary
- `update_plan` no longer looks like progress by itself
- behavior stays GPT-5-first and embedded-Pi scoped
### PR B
- auth/proxy/runtime failures stop collapsing into generic “model failed” handling
- `/elevated full` is only described as available when it is actually available
- blocked reasons are visible to both the model and the user-facing runtime
### PR C
- strict OpenAI/Codex tool registration behaves predictably
- parameter-free tools do not fail strict schema checks
- replay and compaction outcomes preserve truthful liveness state
### PR D
- the scenario pack is understandable and reproducible
- the pack includes a mutating replay-safety lane, not only read-only flows
- reports are readable by humans and automation
- parity claims are evidence-backed, not anecdotal
Expected artifacts from PR D:
- `qa-suite-report.md` / `qa-suite-summary.json` for each model run
- `qa-agentic-parity-report.md` with aggregate and scenario-level comparison
- `qa-agentic-parity-summary.json` with a machine-readable verdict
## Release gate
Do not claim GPT-5.4 parity or superiority over Opus 4.6 until:
- PR A, PR B, and PR C are merged
- PR D runs the first-wave parity pack cleanly
- runtime-truthfulness regression suites remain green
- the parity report shows no fake-success cases and no regression in stop behavior
```mermaid
flowchart LR
A["PR A-C merged"] --> B["Run GPT-5.4 parity pack"]
A --> C["Run Opus 4.6 parity pack"]
B --> D["qa-suite-summary.json"]
C --> E["qa-suite-summary.json"]
D --> F["qa parity-report"]
E --> F
F --> G["Markdown report + JSON verdict"]
G --> H{"Pass?"}
H -- "yes" --> I["Parity claim allowed"]
H -- "no" --> J["Keep runtime fixes / review loop open"]
```
The parity harness is not the only evidence source. Keep this split explicit in review:
- PR D owns the scenario-based GPT-5.4 vs Opus 4.6 comparison
- PR B deterministic suites still own auth/proxy/DNS and full-access truthfulness evidence
## Goal-to-evidence map
| Completion gate item | Primary owner | Review artifact |
| ---------------------------------------- | ------------- | ------------------------------------------------------------------- |
| No plan-only stalls | PR A | strict-agentic runtime tests and `approval-turn-tool-followthrough` |
| No fake progress or fake tool completion | PR A + PR D | parity fake-success count plus scenario-level report details |
| No false `/elevated full` guidance | PR B | deterministic runtime-truthfulness suites |
| Replay/liveness failures remain explicit | PR C + PR D | lifecycle/replay suites plus `compaction-retry-mutating-tool` |
| GPT-5.4 matches or beats Opus 4.6 | PR D | `qa-agentic-parity-report.md` and `qa-agentic-parity-summary.json` |
## Reviewer shorthand: before vs after
| User-visible problem before | Review signal after |
| ----------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| GPT-5.4 stopped after planning | PR A shows act-or-block behavior instead of commentary-only completion |
| Tool use felt brittle with strict OpenAI/Codex schemas | PR C keeps tool registration and parameter-free invocation predictable |
| `/elevated full` hints were sometimes misleading | PR B ties guidance to actual runtime capability and blocked reasons |
| Long tasks could disappear into replay/compaction ambiguity | PR C emits explicit paused, blocked, abandoned, and replay-invalid state |
| Parity claims were anecdotal | PR D produces a report plus JSON verdict with the same scenario coverage on both models |

View File

@@ -0,0 +1,219 @@
# GPT-5.4 / Codex Agentic Parity in OpenClaw
OpenClaw already worked well with tool-using frontier models, but GPT-5.4 and Codex-style models were still underperforming in a few practical ways:
- they could stop after planning instead of doing the work
- they could use strict OpenAI/Codex tool schemas incorrectly
- they could ask for `/elevated full` even when full access was impossible
- they could lose long-running task state during replay or compaction
- parity claims against Claude Opus 4.6 were based on anecdotes instead of repeatable scenarios
This parity program fixes those gaps in four reviewable slices.
## What changed
### PR A: strict-agentic execution
This slice adds an opt-in `strict-agentic` execution contract for embedded Pi GPT-5 runs.
When enabled, OpenClaw stops accepting plan-only turns as “good enough” completion. If the model only says what it intends to do and does not actually use tools or make progress, OpenClaw retries with an act-now steer and then fails closed with an explicit blocked state instead of silently ending the task.
This improves the GPT-5.4 experience most on:
- short “ok do it” follow-ups
- code tasks where the first step is obvious
- flows where `update_plan` should be progress tracking rather than filler text
### PR B: runtime truthfulness
This slice makes OpenClaw tell the truth about two things:
- why the provider/runtime call failed
- whether `/elevated full` is actually available
That means GPT-5.4 gets better runtime signals for missing scope, auth refresh failures, HTML 403 auth failures, proxy issues, DNS or timeout failures, and blocked full-access modes. The model is less likely to hallucinate the wrong remediation or keep asking for a permission mode the runtime cannot provide.
### PR C: execution correctness
This slice improves two kinds of correctness:
- provider-owned OpenAI/Codex tool-schema compatibility
- replay and long-task liveness surfacing
The tool-compat work reduces schema friction for strict OpenAI/Codex tool registration, especially around parameter-free tools and strict object-root expectations. The replay/liveness work makes long-running tasks more observable, so paused, blocked, and abandoned states are visible instead of disappearing into generic failure text.
### PR D: parity harness
This slice adds the first-wave QA-lab parity pack so GPT-5.4 and Opus 4.6 can be exercised through the same scenarios and compared using shared evidence.
The parity pack is the proof layer. It does not change runtime behavior by itself.
After you have two `qa-suite-summary.json` artifacts, generate the release-gate comparison with:
```bash
pnpm openclaw qa parity-report \
--repo-root . \
--candidate-summary .artifacts/qa-e2e/gpt54/qa-suite-summary.json \
--baseline-summary .artifacts/qa-e2e/opus46/qa-suite-summary.json \
--output-dir .artifacts/qa-e2e/parity
```
That command writes:
- a human-readable Markdown report
- a machine-readable JSON verdict
- an explicit `pass` / `fail` gate result
## Why this improves GPT-5.4 in practice
Before this work, GPT-5.4 on OpenClaw could feel less agentic than Opus in real coding sessions because the runtime tolerated behaviors that are especially harmful for GPT-5-style models:
- commentary-only turns
- schema friction around tools
- vague permission feedback
- silent replay or compaction breakage
The goal is not to make GPT-5.4 imitate Opus. The goal is to give GPT-5.4 a runtime contract that rewards real progress, supplies cleaner tool and permission semantics, and turns failure modes into explicit machine- and human-readable states.
That changes the user experience from:
- “the model had a good plan but stopped”
to:
- “the model either acted, or OpenClaw surfaced the exact reason it could not”
## Before vs after for GPT-5.4 users
| Before this program | After PR A-D |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| GPT-5.4 could stop after a reasonable plan without taking the next tool step | PR A turns “plan only” into “act now or surface a blocked state” |
| Strict tool schemas could reject parameter-free or OpenAI/Codex-shaped tools in confusing ways | PR C makes provider-owned tool registration and invocation more predictable |
| `/elevated full` guidance could be vague or wrong in blocked runtimes | PR B gives GPT-5.4 and the user truthful runtime and permission hints |
| Replay or compaction failures could feel like the task silently disappeared | PR C surfaces paused, blocked, abandoned, and replay-invalid outcomes explicitly |
| “GPT-5.4 feels worse than Opus” was mostly anecdotal | PR D turns that into the same scenario pack, the same metrics, and a hard pass/fail gate |
## Architecture
```mermaid
flowchart TD
A["User request"] --> B["Embedded Pi runtime"]
B --> C["Strict-agentic execution contract"]
B --> D["Provider-owned tool compatibility"]
B --> E["Runtime truthfulness"]
B --> F["Replay and liveness state"]
C --> G["Tool call or explicit blocked state"]
D --> G
E --> G
F --> G
G --> H["QA-lab parity pack"]
H --> I["Scenario report and parity gate"]
```
## Release flow
```mermaid
flowchart LR
A["Merged runtime slices (PR A-C)"] --> B["Run GPT-5.4 parity pack"]
A --> C["Run Opus 4.6 parity pack"]
B --> D["qa-suite-summary.json"]
C --> E["qa-suite-summary.json"]
D --> F["openclaw qa parity-report"]
E --> F
F --> G["qa-agentic-parity-report.md"]
F --> H["qa-agentic-parity-summary.json"]
H --> I{"Gate pass?"}
I -- "yes" --> J["Evidence-backed parity claim"]
I -- "no" --> K["Keep runtime/review loop open"]
```
## Scenario pack
The first-wave parity pack currently covers five scenarios:
### `approval-turn-tool-followthrough`
Checks that the model does not stop at “Ill do that” after a short approval. It should take the first concrete action in the same turn.
### `model-switch-tool-continuity`
Checks that tool-using work remains coherent across model/runtime switching boundaries instead of resetting into commentary or losing execution context.
### `source-docs-discovery-report`
Checks that the model can read source and docs, synthesize findings, and continue the task agentically rather than producing a thin summary and stopping early.
### `image-understanding-attachment`
Checks that mixed-mode tasks involving attachments remain actionable and do not collapse into vague narration.
### `compaction-retry-mutating-tool`
Checks that a task with a real mutating write keeps replay-unsafety explicit instead of quietly looking replay-safe if the run compacts, retries, or loses reply state under pressure.
## Scenario matrix
| Scenario | What it tests | Good GPT-5.4 behavior | Failure signal |
| ---------------------------------- | --------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
| `approval-turn-tool-followthrough` | Short approval turns after a plan | Starts the first concrete tool action immediately instead of restating intent | plan-only follow-up, no tool activity, or blocked turn without a real blocker |
| `model-switch-tool-continuity` | Runtime/model switching under tool use | Preserves task context and continues acting coherently | resets into commentary, loses tool context, or stops after switch |
| `source-docs-discovery-report` | Source reading + synthesis + action | Finds sources, uses tools, and produces a useful report without stalling | thin summary, missing tool work, or incomplete-turn stop |
| `image-understanding-attachment` | Attachment-driven agentic work | Interprets the attachment, connects it to tools, and continues the task | vague narration, attachment ignored, or no concrete next action |
| `compaction-retry-mutating-tool` | Mutating work under compaction pressure | Performs a real write and keeps replay-unsafety explicit after the side effect | mutating write happens but replay safety is implied, missing, or contradictory |
## Release gate
GPT-5.4 can only be considered at parity or better when the merged runtime passes the parity pack and the runtime-truthfulness regressions at the same time.
Required outcomes:
- no plan-only stall when the next tool action is clear
- no fake completion without real execution
- no incorrect `/elevated full` guidance
- no silent replay or compaction abandonment
- parity-pack metrics that are at least as strong as the agreed Opus 4.6 baseline
For the first-wave harness, the gate compares:
- completion rate
- unintended-stop rate
- valid-tool-call rate
- fake-success count
Parity evidence is intentionally split across two layers:
- PR D proves same-scenario GPT-5.4 vs Opus 4.6 behavior with QA-lab
- PR B deterministic suites prove auth, proxy, DNS, and `/elevated full` truthfulness outside the harness
## Goal-to-evidence matrix
| Completion gate item | Owning PR | Evidence source | Pass signal |
| -------------------------------------------------------- | ----------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| GPT-5.4 no longer stalls after planning | PR A | `approval-turn-tool-followthrough` plus PR A runtime suites | approval turns trigger real work or an explicit blocked state |
| GPT-5.4 no longer fakes progress or fake tool completion | PR A + PR D | parity report scenario outcomes and fake-success count | no suspicious pass results and no commentary-only completion |
| GPT-5.4 no longer gives false `/elevated full` guidance | PR B | deterministic truthfulness suites | blocked reasons and full-access hints stay runtime-accurate |
| Replay/liveness failures stay explicit | PR C + PR D | PR C lifecycle/replay suites plus `compaction-retry-mutating-tool` | mutating work keeps replay-unsafety explicit instead of silently disappearing |
| GPT-5.4 matches or beats Opus 4.6 on the agreed metrics | PR D | `qa-agentic-parity-report.md` and `qa-agentic-parity-summary.json` | same scenario coverage and no regression on completion, stop behavior, or valid tool use |
## How to read the parity verdict
Use the verdict in `qa-agentic-parity-summary.json` as the final machine-readable decision for the first-wave parity pack.
- `pass` means GPT-5.4 covered the same scenarios as Opus 4.6 and did not regress on the agreed aggregate metrics.
- `fail` means at least one hard gate tripped: weaker completion, worse unintended stops, weaker valid tool use, any fake-success case, or mismatched scenario coverage.
- “shared/base CI issue” is not itself a parity result. If CI noise outside PR D blocks a run, the verdict should wait for a clean merged-runtime execution instead of being inferred from branch-era logs.
- Auth, proxy, DNS, and `/elevated full` truthfulness still come from PR Bs deterministic suites, so the final release claim needs both: a passing PR D parity verdict and green PR B truthfulness coverage.
## Who should enable `strict-agentic`
Use `strict-agentic` when:
- the agent is expected to act immediately when a next step is obvious
- GPT-5.4 or Codex-family models are the primary runtime
- you prefer explicit blocked states over “helpful” recap-only replies
Keep the default contract when:
- you want the existing looser behavior
- you are not using GPT-5-family models
- you are testing prompts rather than runtime enforcement

View File

@@ -519,10 +519,15 @@ The manifest is the control-plane source of truth. OpenClaw uses it to:
- validate `plugins.entries.<id>.config`
- augment Control UI labels/placeholders
- show install/catalog metadata
- preserve cheap activation and setup descriptors without loading plugin runtime
For native plugins, the runtime module is the data-plane part. It registers
actual behavior such as hooks, tools, commands, or provider flows.
Optional manifest `activation` and `setup` blocks stay on the control plane.
They are metadata-only descriptors for activation planning and setup discovery;
they do not replace runtime registration, `register(...)`, or `setupEntry`.
### What the loader caches
OpenClaw keeps short in-process caches for:

View File

@@ -47,6 +47,10 @@ Use it for:
- config validation
- auth and onboarding metadata that should be available without booting plugin
runtime
- cheap activation hints that control-plane surfaces can inspect before runtime
loads
- cheap setup descriptors that setup/onboarding surfaces can inspect before
runtime loads
- alias and auto-enable metadata that should resolve before plugin runtime loads
- shorthand model-family ownership metadata that should auto-activate the
plugin before runtime loads
@@ -152,6 +156,8 @@ Those belong in your plugin code and `package.json`.
| `providerAuthAliases` | No | `Record<string, string>` | Provider ids that should reuse another provider id for auth lookup, for example a coding provider that shares the base provider API key and auth profiles. |
| `channelEnvVars` | No | `Record<string, string[]>` | Cheap channel env metadata that OpenClaw can inspect without loading plugin code. Use this for env-driven channel setup or auth surfaces that generic startup/config helpers should see. |
| `providerAuthChoices` | No | `object[]` | Cheap auth-choice metadata for onboarding pickers, preferred-provider resolution, and simple CLI flag wiring. |
| `activation` | No | `object` | Cheap activation hints for provider, command, channel, route, and capability-triggered loading. Metadata only; plugin runtime still owns actual behavior. |
| `setup` | No | `object` | Cheap setup/onboarding descriptors that discovery and setup surfaces can inspect without loading plugin runtime. |
| `contracts` | No | `object` | Static bundled capability snapshot for speech, realtime transcription, realtime voice, media-understanding, image-generation, music-generation, video-generation, web-fetch, web search, and tool ownership. |
| `channelConfigs` | No | `Record<string, object>` | Manifest-owned channel config metadata merged into discovery and validation surfaces before runtime loads. |
| `skills` | No | `string[]` | Skill directories to load, relative to the plugin root. |
@@ -208,6 +214,77 @@ uses this metadata for diagnostics without importing plugin runtime code.
| `kind` | No | `"runtime-slash"` | Marks the alias as a chat slash command rather than a root CLI command. |
| `cliCommand` | No | `string` | Related root CLI command to suggest for CLI operations, if one exists. |
## activation reference
Use `activation` when the plugin can cheaply declare which control-plane events
should activate it later.
This block is metadata only. It does not register runtime behavior, and it does
not replace `register(...)`, `setupEntry`, or other runtime/plugin entrypoints.
```json
{
"activation": {
"onProviders": ["openai"],
"onCommands": ["models"],
"onChannels": ["web"],
"onRoutes": ["gateway-webhook"],
"onCapabilities": ["provider", "tool"]
}
}
```
| Field | Required | Type | What it means |
| ---------------- | -------- | ---------------------------------------------------- | ----------------------------------------------------------------- |
| `onProviders` | No | `string[]` | Provider ids that should activate this plugin when requested. |
| `onCommands` | No | `string[]` | Command ids that should activate this plugin. |
| `onChannels` | No | `string[]` | Channel ids that should activate this plugin. |
| `onRoutes` | No | `string[]` | Route kinds that should activate this plugin. |
| `onCapabilities` | No | `Array<"provider" \| "channel" \| "tool" \| "hook">` | Broad capability hints used by control-plane activation planning. |
## setup reference
Use `setup` when setup and onboarding surfaces need cheap plugin-owned metadata
before runtime loads.
```json
{
"setup": {
"providers": [
{
"id": "openai",
"authMethods": ["api-key"],
"envVars": ["OPENAI_API_KEY"]
}
],
"cliBackends": ["openai-cli"],
"configMigrations": ["legacy-openai-auth"],
"requiresRuntime": false
}
}
```
Top-level `cliBackends` stays valid and continues to describe CLI inference
backends. `setup.cliBackends` is the setup-specific descriptor surface for
control-plane/setup flows that should stay metadata-only.
### setup.providers reference
| Field | Required | Type | What it means |
| ------------- | -------- | ---------- | ---------------------------------------------------------------------------------- |
| `id` | Yes | `string` | Provider id exposed during setup or onboarding. |
| `authMethods` | No | `string[]` | Setup/auth method ids this provider supports without loading full runtime. |
| `envVars` | No | `string[]` | Env vars that generic setup/status surfaces can check before plugin runtime loads. |
### setup fields
| Field | Required | Type | What it means |
| ------------------ | -------- | ---------- | --------------------------------------------------------------------------- |
| `providers` | No | `object[]` | Provider setup descriptors exposed during setup and onboarding. |
| `cliBackends` | No | `string[]` | Setup-time backend ids available without full runtime activation. |
| `configMigrations` | No | `string[]` | Config migration ids owned by this plugin's setup surface. |
| `requiresRuntime` | No | `boolean` | Whether setup still needs plugin runtime execution after descriptor lookup. |
## uiHints reference
`uiHints` is a map from config field names to small rendering hints.

View File

@@ -133,6 +133,25 @@ OpenClaw requires Codex app-server `0.118.0` or newer. The Codex plugin checks
the app-server initialize handshake and blocks older or unversioned servers so
OpenClaw only runs against the protocol surface it has been tested with.
### Native Codex harness mode
The bundled `codex` harness is the native Codex mode for embedded OpenClaw
agent turns. Enable the bundled `codex` plugin first, and include `codex` in
`plugins.allow` if your config uses a restrictive allowlist. It is different
from `openai-codex/*`:
- `openai-codex/*` uses ChatGPT/Codex OAuth through the normal OpenClaw provider
path.
- `codex/*` uses the bundled Codex provider and routes the turn through Codex
app-server.
When this mode runs, Codex owns the native thread id, resume behavior,
compaction, and app-server execution. OpenClaw still owns the chat channel,
visible transcript mirror, tool policy, approvals, media delivery, and session
selection. Use `embeddedHarness.runtime: "codex"` with
`embeddedHarness.fallback: "none"` when you need to prove that the Codex
app-server path is used and PI fallback is not hiding a broken native harness.
## Disable PI fallback
By default, OpenClaw runs embedded agents with `agents.defaults.embeddedHarness`

View File

@@ -3,6 +3,7 @@ summary: "Use OpenAI via API keys or Codex subscription in OpenClaw"
read_when:
- You want to use OpenAI models in OpenClaw
- You want Codex subscription auth instead of API keys
- You need stricter GPT-5 agent execution behavior
title: "OpenAI"
---
@@ -477,6 +478,33 @@ behavior, but it does not receive the hidden OpenAI/Codex attribution headers.
This preserves current native OpenAI Responses behavior without forcing older
OpenAI-compatible shims onto third-party `/v1` backends.
### Strict-agentic GPT mode
For `openai/*` and `openai-codex/*` GPT-5-family runs, OpenClaw can use a
stricter embedded Pi execution contract:
```json5
{
agents: {
defaults: {
embeddedPi: {
executionContract: "strict-agentic",
},
},
},
}
```
With `strict-agentic`, OpenClaw no longer treats a plan-only assistant turn as
successful progress when a concrete tool action is available. It retries the
turn with an act-now steer, auto-enables the structured `update_plan` tool for
substantial work, and surfaces an explicit blocked state if the model keeps
planning without acting.
The mode is scoped to OpenAI and OpenAI Codex GPT-5-family runs. Other providers
and older model families keep the default embedded Pi behavior unless you opt
them into other runtime settings.
### OpenAI Responses server-side compaction
For direct OpenAI Responses models (`openai/*` using `api: "openai-responses"` with

View File

@@ -0,0 +1,50 @@
# Rich Output Protocol
Assistant output can carry a small set of delivery/render directives:
- `MEDIA:` for attachment delivery
- `[[audio_as_voice]]` for audio presentation hints
- `[[reply_to_current]]` / `[[reply_to:<id>]]` for reply metadata
- `[embed ...]` for Control UI rich rendering
These directives are separate. `MEDIA:` and reply/voice tags remain delivery metadata; `[embed ...]` is the web-only rich render path.
## `[embed ...]`
`[embed ...]` is the only agent-facing rich render syntax for the Control UI.
Self-closing example:
```text
[embed ref="cv_123" title="Status" /]
```
Rules:
- `[view ...]` is no longer valid for new output.
- Embed shortcodes render in the assistant message surface only.
- Only URL-backed embeds are rendered. Use `ref="..."` or `url="..."`.
- Block-form inline HTML embed shortcodes are not rendered.
- The web UI strips the shortcode from visible text and renders the embed inline.
- `MEDIA:` is not an embed alias and should not be used for rich embed rendering.
## Stored Rendering Shape
The normalized/stored assistant content block is a structured `canvas` item:
```json
{
"type": "canvas",
"preview": {
"kind": "canvas",
"surface": "assistant_message",
"render": "url",
"viewId": "cv_123",
"url": "/__openclaw__/canvas/documents/cv_123/index.html",
"title": "Status",
"preferredHeight": 320
}
}
```
Stored/rendered rich blocks use this `canvas` shape directly. `present_view` is not recognized.

View File

@@ -1,5 +1,5 @@
---
summary: "Generate videos from text, images, or existing videos using 12 provider backends"
summary: "Generate videos from text, images, or existing videos using 14 provider backends"
read_when:
- Generating videos via the agent
- Configuring video generation providers and models
@@ -9,7 +9,7 @@ title: "Video Generation"
# Video Generation
OpenClaw agents can generate videos from text prompts, reference images, or existing videos. Twelve provider backends are supported, each with different model options, input modes, and feature sets. The agent picks the right provider automatically based on your configuration and available API keys.
OpenClaw agents can generate videos from text prompts, reference images, or existing videos. Fourteen provider backends are supported, each with different model options, input modes, and feature sets. The agent picks the right provider automatically based on your configuration and available API keys.
<Note>
The `video_generate` tool only appears when at least one video-generation provider is available. If you do not see it in your agent tools, set a provider API key or configure `agents.defaults.videoGenerationModel`.
@@ -78,20 +78,22 @@ Duplicate prevention: if a video task is already `queued` or `running` for the c
## Supported providers
| Provider | Default model | Text | Image ref | Video ref | API key |
| -------- | ------------------------------- | ---- | ----------------- | ---------------- | ---------------------------------------- |
| Alibaba | `wan2.6-t2v` | Yes | Yes (remote URL) | Yes (remote URL) | `MODELSTUDIO_API_KEY` |
| BytePlus | `seedance-1-0-lite-t2v-250428` | Yes | 1 image | No | `BYTEPLUS_API_KEY` |
| ComfyUI | `workflow` | Yes | 1 image | No | `COMFY_API_KEY` or `COMFY_CLOUD_API_KEY` |
| fal | `fal-ai/minimax/video-01-live` | Yes | 1 image | No | `FAL_KEY` |
| Google | `veo-3.1-fast-generate-preview` | Yes | 1 image | 1 video | `GEMINI_API_KEY` |
| MiniMax | `MiniMax-Hailuo-2.3` | Yes | 1 image | No | `MINIMAX_API_KEY` |
| OpenAI | `sora-2` | Yes | 1 image | 1 video | `OPENAI_API_KEY` |
| Qwen | `wan2.6-t2v` | Yes | Yes (remote URL) | Yes (remote URL) | `QWEN_API_KEY` |
| Runway | `gen4.5` | Yes | 1 image | 1 video | `RUNWAYML_API_SECRET` |
| Together | `Wan-AI/Wan2.2-T2V-A14B` | Yes | 1 image | No | `TOGETHER_API_KEY` |
| Vydra | `veo3` | Yes | 1 image (`kling`) | No | `VYDRA_API_KEY` |
| xAI | `grok-imagine-video` | Yes | 1 image | 1 video | `XAI_API_KEY` |
| Provider | Default model | Text | Image ref | Video ref | API key |
| --------------------- | ------------------------------- | ---- | ---------------------------------------------------- | ---------------- | ---------------------------------------- |
| Alibaba | `wan2.6-t2v` | Yes | Yes (remote URL) | Yes (remote URL) | `MODELSTUDIO_API_KEY` |
| BytePlus (1.0) | `seedance-1-0-pro-250528` | Yes | Up to 2 images (I2V models only; first + last frame) | No | `BYTEPLUS_API_KEY` |
| BytePlus Seedance 1.5 | `seedance-1-5-pro-251215` | Yes | Up to 2 images (first + last frame via role) | No | `BYTEPLUS_API_KEY` |
| BytePlus Seedance 2.0 | `dreamina-seedance-2-0-260128` | Yes | Up to 9 reference images | Up to 3 videos | `BYTEPLUS_API_KEY` |
| ComfyUI | `workflow` | Yes | 1 image | No | `COMFY_API_KEY` or `COMFY_CLOUD_API_KEY` |
| fal | `fal-ai/minimax/video-01-live` | Yes | 1 image | No | `FAL_KEY` |
| Google | `veo-3.1-fast-generate-preview` | Yes | 1 image | 1 video | `GEMINI_API_KEY` |
| MiniMax | `MiniMax-Hailuo-2.3` | Yes | 1 image | No | `MINIMAX_API_KEY` |
| OpenAI | `sora-2` | Yes | 1 image | 1 video | `OPENAI_API_KEY` |
| Qwen | `wan2.6-t2v` | Yes | Yes (remote URL) | Yes (remote URL) | `QWEN_API_KEY` |
| Runway | `gen4.5` | Yes | 1 image | 1 video | `RUNWAYML_API_SECRET` |
| Together | `Wan-AI/Wan2.2-T2V-A14B` | Yes | 1 image | No | `TOGETHER_API_KEY` |
| Vydra | `veo3` | Yes | 1 image (`kling`) | No | `VYDRA_API_KEY` |
| xAI | `grok-imagine-video` | Yes | 1 image | 1 video | `XAI_API_KEY` |
Some providers accept additional or alternate API key env vars. See individual [provider pages](#related) for details.
@@ -128,31 +130,49 @@ and the shared live sweep.
### Content inputs
| Parameter | Type | Description |
| --------- | -------- | ------------------------------------ |
| `image` | string | Single reference image (path or URL) |
| `images` | string[] | Multiple reference images (up to 5) |
| `video` | string | Single reference video (path or URL) |
| `videos` | string[] | Multiple reference videos (up to 4) |
| Parameter | Type | Description |
| ------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `image` | string | Single reference image (path or URL) |
| `images` | string[] | Multiple reference images (up to 9) |
| `imageRoles` | string[] | Optional per-position role hints parallel to the combined image list. Canonical values: `first_frame`, `last_frame`, `reference_image` |
| `video` | string | Single reference video (path or URL) |
| `videos` | string[] | Multiple reference videos (up to 4) |
| `videoRoles` | string[] | Optional per-position role hints parallel to the combined video list. Canonical value: `reference_video` |
| `audioRef` | string | Single reference audio (path or URL). Used for e.g. background music or voice reference when the provider supports audio inputs |
| `audioRefs` | string[] | Multiple reference audios (up to 3) |
| `audioRoles` | string[] | Optional per-position role hints parallel to the combined audio list. Canonical value: `reference_audio` |
Role hints are forwarded to the provider as-is. Canonical values come from
the `VideoGenerationAssetRole` union but providers may accept additional
role strings. `*Roles` arrays must not have more entries than the
corresponding reference list; off-by-one mistakes fail with a clear error.
Use an empty string to leave a slot unset.
### Style controls
| Parameter | Type | Description |
| ----------------- | ------- | ------------------------------------------------------------------------ |
| `aspectRatio` | string | `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9` |
| `resolution` | string | `480P`, `720P`, `768P`, or `1080P` |
| `durationSeconds` | number | Target duration in seconds (rounded to nearest provider-supported value) |
| `size` | string | Size hint when the provider supports it |
| `audio` | boolean | Enable generated audio when supported |
| `watermark` | boolean | Toggle provider watermarking when supported |
| Parameter | Type | Description |
| ----------------- | ------- | --------------------------------------------------------------------------------------- |
| `aspectRatio` | string | `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`, or `adaptive` |
| `resolution` | string | `480P`, `720P`, `768P`, or `1080P` |
| `durationSeconds` | number | Target duration in seconds (rounded to nearest provider-supported value) |
| `size` | string | Size hint when the provider supports it |
| `audio` | boolean | Enable generated audio in the output when supported. Distinct from `audioRef*` (inputs) |
| `watermark` | boolean | Toggle provider watermarking when supported |
`adaptive` is a provider-specific sentinel: it is forwarded as-is to
providers that declare `adaptive` in their capabilities (e.g. BytePlus
Seedance uses it to auto-detect the ratio from the input image
dimensions). Providers that do not declare it surface the value via
`details.ignoredOverrides` in the tool result so the drop is visible.
### Advanced
| Parameter | Type | Description |
| ---------- | ------ | ----------------------------------------------- |
| `action` | string | `"generate"` (default), `"status"`, or `"list"` |
| `model` | string | Provider/model override (e.g. `runway/gen4.5`) |
| `filename` | string | Output filename hint |
| Parameter | Type | Description |
| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action` | string | `"generate"` (default), `"status"`, or `"list"` |
| `model` | string | Provider/model override (e.g. `runway/gen4.5`) |
| `filename` | string | Output filename hint |
| `providerOptions` | object | Provider-specific options as a JSON object (e.g. `{"seed": 42, "draft": true}`). Providers that declare a typed schema validate the keys and types; unknown keys or mismatches skip the candidate during fallback. Providers without a declared schema receive the options as-is. Run `video_generate action=list` to see what each provider accepts |
Not all providers support all parameters. OpenClaw already normalizes duration to the closest provider-supported value, and it also remaps translated geometry hints such as size-to-aspect-ratio when a fallback provider exposes a different control surface. Truly unsupported overrides are ignored on a best-effort basis and reported as warnings in the tool result. Hard capability limits (such as too many reference inputs) fail before submission.
@@ -163,10 +183,37 @@ Reference inputs also select the runtime mode:
- No reference media: `generate`
- Any image reference: `imageToVideo`
- Any video reference: `videoToVideo`
- Reference audio inputs do not change the resolved mode; they apply on top of whatever mode the image/video references select, and only work with providers that declare `maxInputAudios`
Mixed image and video references are not a stable shared capability surface.
Prefer one reference type per request.
#### Fallback and typed options
Some capability checks are applied at the fallback layer rather than the
tool boundary so that a request that exceeds the primary provider's limits
can still run on a capable fallback:
- If the active candidate declares no `maxInputAudios` (or declares it as
`0`), it is skipped when the request contains audio references, and the
next candidate is tried.
- If the active candidate's `maxDurationSeconds` is below the requested
`durationSeconds` and the candidate does not declare a
`supportedDurationSeconds` list, it is skipped.
- If the request contains `providerOptions` and the active candidate
explicitly declares a typed `providerOptions` schema, the candidate is
skipped when the supplied keys are not in the schema or the value types do
not match. Providers that have not yet declared a schema receive the
options as-is (backward-compatible pass-through). A provider can
explicitly opt out of all provider options by declaring an empty schema
(`capabilities.providerOptions: {}`), which causes the same skip as a
type mismatch.
The first skip reason in a request is logged at `warn` so operators see
when their primary provider was passed over; subsequent skips log at
`debug` to keep long fallback chains quiet. If every candidate is skipped,
the aggregated error includes the skip reason for each.
## Actions
- **generate** (default) -- create a video from the given prompt and optional reference inputs.
@@ -201,50 +248,24 @@ entries.
}
```
HeyGen video-agent on fal can be pinned with:
```json5
{
agents: {
defaults: {
videoGenerationModel: {
primary: "fal/fal-ai/heygen/v2/video-agent",
},
},
},
}
```
Seedance 2.0 on fal can be pinned with:
```json5
{
agents: {
defaults: {
videoGenerationModel: {
primary: "fal/bytedance/seedance-2.0/fast/text-to-video",
},
},
},
}
```
## Provider notes
| Provider | Notes |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Alibaba | Uses DashScope/Model Studio async endpoint. Reference images and videos must be remote `http(s)` URLs. |
| BytePlus | Single image reference only. |
| ComfyUI | Workflow-driven local or cloud execution. Supports text-to-video and image-to-video through the configured graph. |
| fal | Uses queue-backed flow for long-running jobs. Single image reference only. Includes HeyGen video-agent and Seedance 2.0 text-to-video and image-to-video model refs. |
| Google | Uses Gemini/Veo. Supports one image or one video reference. |
| MiniMax | Single image reference only. |
| OpenAI | Only `size` override is forwarded. Other style overrides (`aspectRatio`, `resolution`, `audio`, `watermark`) are ignored with a warning. |
| Qwen | Same DashScope backend as Alibaba. Reference inputs must be remote `http(s)` URLs; local files are rejected upfront. |
| Runway | Supports local files via data URIs. Video-to-video requires `runway/gen4_aleph`. Text-only runs expose `16:9` and `9:16` aspect ratios. |
| Together | Single image reference only. |
| Vydra | Uses `https://www.vydra.ai/api/v1` directly to avoid auth-dropping redirects. `veo3` is bundled as text-to-video only; `kling` requires a remote image URL. |
| xAI | Supports text-to-video, image-to-video, and remote video edit/extend flows. |
| Provider | Notes |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Alibaba | Uses DashScope/Model Studio async endpoint. Reference images and videos must be remote `http(s)` URLs. |
| BytePlus (1.0) | Provider id `byteplus`. Models: `seedance-1-0-pro-250528` (default), `seedance-1-0-pro-t2v-250528`, `seedance-1-0-pro-fast-251015`, `seedance-1-0-lite-t2v-250428`, `seedance-1-0-lite-i2v-250428`. T2V models (`*-t2v-*`) do not accept image inputs; I2V models and general `*-pro-*` models support a single reference image (first frame). Pass the image positionally or set `role: "first_frame"`. T2V model IDs are automatically switched to the corresponding I2V variant when an image is provided. Supported `providerOptions` keys: `seed` (number), `draft` (boolean, forces 480p), `camera_fixed` (boolean). |
| BytePlus Seedance 1.5 | Requires the [`@openclaw/byteplus-modelark`](https://www.npmjs.com/package/@openclaw/byteplus-modelark) plugin. Provider id `byteplus-seedance15`. Model: `seedance-1-5-pro-251215`. Uses the unified `content[]` API. Supports at most 2 input images (first_frame + last_frame). All inputs must be remote `https://` URLs. Set `role: "first_frame"` / `"last_frame"` on each image, or pass images positionally. `aspectRatio: "adaptive"` auto-detects ratio from the input image. `audio: true` maps to `generate_audio`. `providerOptions.seed` (number) is forwarded. |
| BytePlus Seedance 2.0 | Requires the [`@openclaw/byteplus-modelark`](https://www.npmjs.com/package/@openclaw/byteplus-modelark) plugin. Provider id `byteplus-seedance2`. Models: `dreamina-seedance-2-0-260128`, `dreamina-seedance-2-0-fast-260128`. Uses the unified `content[]` API. Supports up to 9 reference images, 3 reference videos, and 3 reference audios. All inputs must be remote `https://` URLs. Set `role` on each asset — supported values: `"first_frame"`, `"last_frame"`, `"reference_image"`, `"reference_video"`, `"reference_audio"`. `aspectRatio: "adaptive"` auto-detects ratio from the input image. `audio: true` maps to `generate_audio`. `providerOptions.seed` (number) is forwarded. |
| ComfyUI | Workflow-driven local or cloud execution. Supports text-to-video and image-to-video through the configured graph. |
| fal | Uses queue-backed flow for long-running jobs. Single image reference only. |
| Google | Uses Gemini/Veo. Supports one image or one video reference. |
| MiniMax | Single image reference only. |
| OpenAI | Only `size` override is forwarded. Other style overrides (`aspectRatio`, `resolution`, `audio`, `watermark`) are ignored with a warning. |
| Qwen | Same DashScope backend as Alibaba. Reference inputs must be remote `http(s)` URLs; local files are rejected upfront. |
| Runway | Supports local files via data URIs. Video-to-video requires `runway/gen4_aleph`. Text-only runs expose `16:9` and `9:16` aspect ratios. |
| Together | Single image reference only. |
| Vydra | Uses `https://www.vydra.ai/api/v1` directly to avoid auth-dropping redirects. `veo3` is bundled as text-to-video only; `kling` requires a remote image URL. |
| xAI | Supports text-to-video, image-to-video, and remote video edit/extend flows. |
## Provider capability modes

View File

@@ -138,6 +138,38 @@ Cron jobs panel notes:
- Gateway persists aborted partial assistant text into transcript history when buffered output exists
- Persisted entries include abort metadata so transcript consumers can tell abort partials from normal completion output
## Hosted embeds
Assistant messages can render hosted web content inline with the `[embed ...]`
shortcode. The iframe sandbox policy is controlled by
`gateway.controlUi.embedSandbox`:
- `strict`: disables script execution inside hosted embeds
- `scripts`: allows interactive embeds while keeping origin isolation; this is
the default and is usually enough for self-contained browser games/widgets
- `trusted`: adds `allow-same-origin` on top of `allow-scripts` for same-site
documents that intentionally need stronger privileges
Example:
```json5
{
gateway: {
controlUi: {
embedSandbox: "scripts",
},
},
}
```
Use `trusted` only when the embedded document genuinely needs same-origin
behavior. For most agent-generated games and interactive canvases, `scripts` is
the safer choice.
Absolute external `http(s)` embed URLs stay blocked by default. If you
intentionally want `[embed url="https://..."]` to load third-party pages, set
`gateway.controlUi.allowExternalEmbedUrls: true`.
## Tailnet access (recommended)
### Integrated Tailscale Serve (preferred)

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/acpx",
"version": "2026.4.10",
"version": "2026.4.11",
"description": "OpenClaw ACP runtime backend",
"type": "module",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/alibaba-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Alibaba Model Studio video provider plugin",
"type": "module",

View File

@@ -4,6 +4,7 @@ import {
expectSuccessfulDashscopeVideoResult,
mockSuccessfulDashscopeVideoTask,
} from "../../test/helpers/media-generation/dashscope-video-provider.js";
import { expectExplicitVideoGenerationCapabilities } from "../../test/helpers/media-generation/provider-capability-assertions.js";
import {
getProviderHttpMocks,
installProviderHttpMockCleanup,
@@ -20,6 +21,10 @@ beforeAll(async () => {
installProviderHttpMockCleanup();
describe("alibaba video generation provider", () => {
it("declares explicit mode capabilities", () => {
expectExplicitVideoGenerationCapabilities(buildAlibabaVideoGenerationProvider());
});
it("submits async Wan generation, polls task status, and downloads the resulting video", async () => {
mockSuccessfulDashscopeVideoTask({ postJsonRequestMock, fetchWithTimeoutMock });

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/amazon-bedrock-mantle-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Amazon Bedrock Mantle (OpenAI-compatible) provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/amazon-bedrock-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Amazon Bedrock provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/anthropic-vertex-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Anthropic Vertex provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/anthropic-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Anthropic provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/arcee-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Arcee provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/bluebubbles",
"version": "2026.4.10",
"version": "2026.4.11",
"description": "OpenClaw BlueBubbles channel plugin",
"type": "module",
"devDependencies": {
@@ -8,7 +8,7 @@
"openclaw": "workspace:*"
},
"peerDependencies": {
"openclaw": ">=2026.4.10"
"openclaw": ">=2026.4.11"
},
"peerDependenciesMeta": {
"openclaw": {
@@ -43,10 +43,10 @@
"minHostVersion": ">=2026.4.10"
},
"compat": {
"pluginApi": ">=2026.4.10"
"pluginApi": ">=2026.4.11"
},
"build": {
"openclawVersion": "2026.4.10"
"openclawVersion": "2026.4.11"
},
"release": {
"publishToClawHub": true,

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/brave-plugin",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Brave plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/browser-plugin",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw browser tool plugin",
"type": "module",

View File

@@ -3,8 +3,8 @@ import {
normalizeLowercaseStringOrEmpty,
normalizeOptionalString,
} from "openclaw/plugin-sdk/text-runtime";
import type { OpenClawConfig } from "../config/config.js";
import { loadConfig, writeConfigFile } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import { resolveGatewayAuth } from "../gateway/auth.js";
import { ensureGatewayStartupAuth } from "../gateway/startup-auth.js";

View File

@@ -1,4 +1,5 @@
import { afterEach, beforeEach, vi } from "vitest";
import { deriveDefaultBrowserCdpPortRange } from "../config/port-defaults.js";
import type { MockFn } from "../test-utils/vitest-mock-fn.js";
import { installChromeUserDataDirHooks } from "./chrome-user-data-dir.test-harness.js";
import { getFreePort } from "./test-port.js";
@@ -375,9 +376,13 @@ function makeProc(pid = 123) {
const proc = makeProc();
function defaultBrowserCdpPortForState(testPort: number): number {
return deriveDefaultBrowserCdpPortRange(testPort).start;
}
function defaultProfilesForState(testPort: number): HarnessState["cfgProfiles"] {
return {
openclaw: { cdpPort: testPort + 9, color: "#FF4500" },
openclaw: { cdpPort: defaultBrowserCdpPortForState(testPort), color: "#FF4500" },
};
}
@@ -520,7 +525,7 @@ export async function resetBrowserControlServerTestContext(): Promise<void> {
mockClearAll(chromeMcpMocks);
state.testPort = await getFreePort();
state.cdpBaseUrl = `http://127.0.0.1:${state.testPort + 9}`;
state.cdpBaseUrl = `http://127.0.0.1:${defaultBrowserCdpPortForState(state.testPort)}`;
state.cfgProfiles = defaultProfilesForState(state.testPort);
state.prevGatewayPort = process.env.OPENCLAW_GATEWAY_PORT;
process.env.OPENCLAW_GATEWAY_PORT = String(state.testPort - 2);

View File

@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import { noteChromeMcpBrowserReadiness } from "./doctor-browser.js";
describe("doctor browser readiness", () => {
describe("browser doctor readiness", () => {
it("does nothing when Chrome MCP is not configured", async () => {
const noteFn = vi.fn();
await noteChromeMcpBrowserReadiness(

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/byteplus-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw BytePlus provider plugin",
"type": "module",

View File

@@ -1,4 +1,5 @@
import { beforeAll, describe, expect, it, vi } from "vitest";
import { expectExplicitVideoGenerationCapabilities } from "../../test/helpers/media-generation/provider-capability-assertions.js";
import {
getProviderHttpMocks,
installProviderHttpMockCleanup,
@@ -14,31 +15,39 @@ beforeAll(async () => {
installProviderHttpMockCleanup();
describe("byteplus video generation provider", () => {
it("creates a content-generation task, polls, and downloads the video", async () => {
postJsonRequestMock.mockResolvedValue({
response: {
json: async () => ({
id: "task_123",
}),
},
release: vi.fn(async () => {}),
function mockSuccessfulBytePlusTask(params?: { model?: string }) {
postJsonRequestMock.mockResolvedValue({
response: {
json: async () => ({
id: "task_123",
}),
},
release: vi.fn(async () => {}),
});
fetchWithTimeoutMock
.mockResolvedValueOnce({
json: async () => ({
id: "task_123",
status: "succeeded",
content: {
video_url: "https://example.com/byteplus.mp4",
},
model: params?.model ?? "seedance-1-0-lite-t2v-250428",
}),
})
.mockResolvedValueOnce({
headers: new Headers({ "content-type": "video/mp4" }),
arrayBuffer: async () => Buffer.from("mp4-bytes"),
});
fetchWithTimeoutMock
.mockResolvedValueOnce({
json: async () => ({
id: "task_123",
status: "succeeded",
content: {
video_url: "https://example.com/byteplus.mp4",
},
model: "seedance-1-0-lite-t2v-250428",
}),
})
.mockResolvedValueOnce({
headers: new Headers({ "content-type": "video/mp4" }),
arrayBuffer: async () => Buffer.from("mp4-bytes"),
});
}
describe("byteplus video generation provider", () => {
it("declares explicit mode capabilities", () => {
expectExplicitVideoGenerationCapabilities(buildBytePlusVideoGenerationProvider());
});
it("creates a content-generation task, polls, and downloads the video", async () => {
mockSuccessfulBytePlusTask();
const provider = buildBytePlusVideoGenerationProvider();
const result = await provider.generateVideo({
@@ -60,4 +69,57 @@ describe("byteplus video generation provider", () => {
}),
);
});
it("switches t2v image requests to i2v models and lowercases resolution", async () => {
mockSuccessfulBytePlusTask({ model: "seedance-1-0-lite-i2v-250428" });
const provider = buildBytePlusVideoGenerationProvider();
await provider.generateVideo({
provider: "byteplus",
model: "seedance-1-0-lite-t2v-250428",
prompt: "Animate this still image",
resolution: "720P",
inputImages: [{ url: "https://example.com/first-frame.png" }],
cfg: {},
});
const request = postJsonRequestMock.mock.calls[0]?.[0] as { body?: Record<string, unknown> };
expect(request.body).toMatchObject({
model: "seedance-1-0-lite-i2v-250428",
resolution: "720p",
content: [
{ type: "text", text: "Animate this still image" },
{
type: "image_url",
image_url: { url: "https://example.com/first-frame.png" },
role: "first_frame",
},
],
});
});
it("maps declared providerOptions into the request body", async () => {
mockSuccessfulBytePlusTask({ model: "seedance-1-0-pro-250528" });
const provider = buildBytePlusVideoGenerationProvider();
await provider.generateVideo({
provider: "byteplus",
model: "seedance-1-0-pro-250528",
prompt: "A cinematic lobster montage",
providerOptions: {
seed: 42,
draft: true,
camera_fixed: false,
},
cfg: {},
});
const request = postJsonRequestMock.mock.calls[0]?.[0] as { body?: Record<string, unknown> };
expect(request.body).toMatchObject({
model: "seedance-1-0-pro-250528",
seed: 42,
resolution: "480p",
camera_fixed: false,
});
});
});

View File

@@ -141,6 +141,11 @@ export function buildBytePlusVideoGenerationProvider(): VideoGenerationProvider
agentDir,
}),
capabilities: {
providerOptions: {
seed: "number",
draft: "boolean",
camera_fixed: "boolean",
},
generate: {
maxVideos: 1,
maxDurationSeconds: 12,
@@ -191,6 +196,17 @@ export function buildBytePlusVideoGenerationProvider(): VideoGenerationProvider
capability: "video",
transport: "http",
});
// Seedance 1.0 has separate T2V and I2V model IDs (e.g. seedance-1-0-lite-t2v-250428 vs
// seedance-1-0-lite-i2v-250428). When input images are provided with a T2V model, auto-
// switch to the corresponding I2V variant so the API does not reject with task_type mismatch.
// 1.5 Pro uses a single model ID for both modes and is unaffected by this substitution.
const hasInputImages = (req.inputImages?.length ?? 0) > 0;
const requestedModel = normalizeOptionalString(req.model) || DEFAULT_BYTEPLUS_VIDEO_MODEL;
const resolvedModel =
hasInputImages && requestedModel.includes("-t2v-")
? requestedModel.replace("-t2v-", "-i2v-")
: requestedModel;
const content: Array<Record<string, unknown>> = [{ type: "text", text: req.prompt }];
const imageUrl = resolveBytePlusImageUrl(req);
if (imageUrl) {
@@ -201,15 +217,18 @@ export function buildBytePlusVideoGenerationProvider(): VideoGenerationProvider
});
}
const body: Record<string, unknown> = {
model: normalizeOptionalString(req.model) || DEFAULT_BYTEPLUS_VIDEO_MODEL,
model: resolvedModel,
content,
};
const aspectRatio = normalizeOptionalString(req.aspectRatio);
if (aspectRatio) {
body.ratio = aspectRatio;
}
if (req.resolution) {
body.resolution = req.resolution;
// Seedance API requires lowercase resolution values (e.g. "480p", "720p"); uppercase
// variants like "480P" are rejected with InvalidParameter.
const resolution = normalizeOptionalString(req.resolution)?.toLowerCase();
if (resolution) {
body.resolution = resolution;
}
if (typeof req.durationSeconds === "number" && Number.isFinite(req.durationSeconds)) {
body.duration = Math.max(1, Math.round(req.durationSeconds));
@@ -221,6 +240,23 @@ export function buildBytePlusVideoGenerationProvider(): VideoGenerationProvider
body.watermark = req.watermark;
}
// Forward declared providerOptions: seed, draft, camerafixed.
// draft=true forces 480p resolution for faster generation.
const opts = req.providerOptions ?? {};
const seed = typeof opts.seed === "number" ? opts.seed : undefined;
const draft = opts.draft === true;
// Official JSON body field is camera_fixed (with underscore).
const cameraFixed = typeof opts.camera_fixed === "boolean" ? opts.camera_fixed : undefined;
if (seed != null) {
body.seed = seed;
}
if (draft && !body.resolution) {
body.resolution = "480p";
}
if (cameraFixed != null) {
body.camera_fixed = cameraFixed;
}
const { response, release } = await postJsonRequest({
url: `${baseUrl}/contents/generations/tasks`,
headers,
@@ -255,7 +291,7 @@ export function buildBytePlusVideoGenerationProvider(): VideoGenerationProvider
});
return {
videos: [video],
model: completed.model ?? req.model ?? DEFAULT_BYTEPLUS_VIDEO_MODEL,
model: completed.model ?? resolvedModel,
metadata: {
taskId,
status: completed.status,

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/chutes-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Chutes.ai provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/cloudflare-ai-gateway-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Cloudflare AI Gateway provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/codex",
"version": "2026.4.9",
"version": "2026.4.11",
"description": "OpenClaw Codex harness and model provider plugin",
"type": "module",
"dependencies": {

View File

@@ -79,7 +79,7 @@ describe("CodexAppServerEventProjector", () => {
});
expect(onAssistantMessageStart).toHaveBeenCalledTimes(1);
expect(onPartialReply).toHaveBeenLastCalledWith({ text: "hello" });
expect(onPartialReply).not.toHaveBeenCalled();
expect(result.assistantTexts).toEqual(["hello"]);
expect(result.messagesSnapshot.map((message) => message.role)).toEqual(["user", "assistant"]);
expect(result.lastAssistant?.content).toEqual([{ type: "text", text: "hello" }]);
@@ -87,6 +87,79 @@ describe("CodexAppServerEventProjector", () => {
expect(result.replayMetadata.replaySafe).toBe(true);
});
it("keeps intermediate agentMessage items out of the final visible reply", async () => {
const onAssistantMessageStart = vi.fn();
const onPartialReply = vi.fn();
const params = {
...createParams(),
onAssistantMessageStart,
onPartialReply,
};
const projector = new CodexAppServerEventProjector(params, "thread-1", "turn-1");
await projector.handleNotification({
method: "item/agentMessage/delta",
params: {
threadId: "thread-1",
turnId: "turn-1",
itemId: "msg-commentary",
delta: "checking thread context; then post a tight progress reply here.",
},
});
await projector.handleNotification({
method: "item/agentMessage/delta",
params: {
threadId: "thread-1",
turnId: "turn-1",
itemId: "msg-final",
delta: "release fixes first. please drop affected PRs, failing checks, and blockers here.",
},
});
await projector.handleNotification({
method: "turn/completed",
params: {
threadId: "thread-1",
turnId: "turn-1",
turn: {
id: "turn-1",
status: "completed",
items: [
{
type: "agentMessage",
id: "msg-commentary",
text: "checking thread context; then post a tight progress reply here.",
},
{
type: "agentMessage",
id: "msg-final",
text: "release fixes first. please drop affected PRs, failing checks, and blockers here.",
},
],
},
},
});
const result = projector.buildResult({
didSendViaMessagingTool: false,
messagingToolSentTexts: [],
messagingToolSentMediaUrls: [],
messagingToolSentTargets: [],
});
expect(onAssistantMessageStart).toHaveBeenCalledTimes(1);
expect(onPartialReply).not.toHaveBeenCalled();
expect(result.assistantTexts).toEqual([
"release fixes first. please drop affected PRs, failing checks, and blockers here.",
]);
expect(result.lastAssistant?.content).toEqual([
{
type: "text",
text: "release fixes first. please drop affected PRs, failing checks, and blockers here.",
},
]);
expect(JSON.stringify(result.messagesSnapshot)).not.toContain("checking thread context");
});
it("ignores notifications for other turns", async () => {
const params = createParams();
const projector = new CodexAppServerEventProjector(params, "thread-1", "turn-1");

View File

@@ -44,6 +44,7 @@ const ZERO_USAGE: Usage = {
export class CodexAppServerEventProjector {
private readonly assistantTextByItem = new Map<string, string>();
private readonly assistantItemOrder: string[] = [];
private readonly reasoningTextByItem = new Map<string, string>();
private readonly planTextByItem = new Map<string, string>();
private readonly activeItemIds = new Set<string>();
@@ -210,9 +211,12 @@ export class CodexAppServerEventProjector {
this.assistantStarted = true;
await this.params.onAssistantMessageStart?.();
}
this.rememberAssistantItem(itemId);
const text = `${this.assistantTextByItem.get(itemId) ?? ""}${delta}`;
this.assistantTextByItem.set(itemId, text);
await this.params.onPartialReply?.({ text });
// Codex app-server can emit multiple agentMessage items per turn, including
// intermediate coordination/progress prose. Keep those deltas internal until
// turn completion chooses the last assistant item as the user-visible reply.
}
private async handleReasoningDelta(params: JsonObject): Promise<void> {
@@ -291,6 +295,7 @@ export class CodexAppServerEventProjector {
this.completedItemIds.add(itemId);
}
if (item?.type === "agentMessage" && typeof item.text === "string" && item.text) {
this.rememberAssistantItem(item.id);
this.assistantTextByItem.set(item.id, item.text);
}
if (item?.type === "plan" && typeof item.text === "string" && item.text) {
@@ -348,6 +353,7 @@ export class CodexAppServerEventProjector {
}
for (const item of turn.items ?? []) {
if (item.type === "agentMessage" && typeof item.text === "string" && item.text) {
this.rememberAssistantItem(item.id);
this.assistantTextByItem.set(item.id, item.text);
}
if (item.type === "plan" && typeof item.text === "string" && item.text) {
@@ -425,7 +431,29 @@ export class CodexAppServerEventProjector {
}
private collectAssistantTexts(): string[] {
return [...this.assistantTextByItem.values()].filter((text) => text.trim().length > 0);
const finalText = this.resolveFinalAssistantText();
return finalText ? [finalText] : [];
}
private resolveFinalAssistantText(): string | undefined {
for (let i = this.assistantItemOrder.length - 1; i >= 0; i -= 1) {
const itemId = this.assistantItemOrder[i];
if (!itemId) {
continue;
}
const text = this.assistantTextByItem.get(itemId)?.trim();
if (text) {
return text;
}
}
return undefined;
}
private rememberAssistantItem(itemId: string): void {
if (!itemId || this.assistantItemOrder.includes(itemId)) {
return;
}
this.assistantItemOrder.push(itemId);
}
private createAssistantMessage(text: string): AssistantMessage {

View File

@@ -119,6 +119,56 @@ describe("runCodexAppServerAttempt", () => {
);
});
it("does not leak unhandled rejections when shutdown closes before interrupt", async () => {
const unhandledRejections: unknown[] = [];
const onUnhandledRejection = (reason: unknown) => {
unhandledRejections.push(reason);
};
process.on("unhandledRejection", onUnhandledRejection);
try {
const requests: Array<{ method: string; params: unknown }> = [];
const request = vi.fn(async (method: string, params?: unknown) => {
requests.push({ method, params });
if (method === "thread/start") {
return { thread: { id: "thread-1" }, model: "gpt-5.4-codex", modelProvider: "openai" };
}
if (method === "turn/start") {
return { turn: { id: "turn-1", status: "inProgress" } };
}
if (method === "turn/interrupt") {
throw new Error("codex app-server client is closed");
}
return {};
});
__testing.setCodexAppServerClientFactoryForTests(
async () =>
({
request,
addNotificationHandler: () => () => undefined,
addRequestHandler: () => () => undefined,
}) as never,
);
const abortController = new AbortController();
const params = createParams(
path.join(tempDir, "session.jsonl"),
path.join(tempDir, "workspace"),
);
params.abortSignal = abortController.signal;
const run = runCodexAppServerAttempt(params);
await vi.waitFor(() =>
expect(requests.some((entry) => entry.method === "turn/start")).toBe(true),
);
abortController.abort("shutdown");
await expect(run).resolves.toMatchObject({ aborted: true });
await new Promise((resolve) => setImmediate(resolve));
expect(unhandledRejections).toEqual([]);
} finally {
process.off("unhandledRejection", onUnhandledRejection);
}
});
it("forwards image attachments to the app-server turn input", async () => {
const requests: Array<{ method: string; params: unknown }> = [];
let notify: (notification: CodexServerNotification) => Promise<void> = async () => undefined;

View File

@@ -227,10 +227,14 @@ export async function runCodexAppServerAttempt(
);
const abortListener = () => {
void client.request("turn/interrupt", {
threadId: thread.threadId,
turnId: activeTurnId,
});
void client
.request("turn/interrupt", {
threadId: thread.threadId,
turnId: activeTurnId,
})
.catch((error: unknown) => {
embeddedAgentLog.debug("codex app-server turn interrupt failed during abort", { error });
});
resolveCompletion?.();
};
runAbortController.signal.addEventListener("abort", abortListener, { once: true });

View File

@@ -1,4 +1,5 @@
import { describe, expect, it, vi } from "vitest";
import { expectExplicitMusicGenerationCapabilities } from "../../test/helpers/media-generation/provider-capability-assertions.js";
import { buildComfyMusicGenerationProvider } from "./music-generation-provider.js";
import { _setComfyFetchGuardForTesting } from "./workflow-runtime.js";
@@ -12,7 +13,7 @@ describe("comfy music-generation provider", () => {
expect(provider.defaultModel).toBe("workflow");
expect(provider.models).toEqual(["workflow"]);
expect(provider.capabilities.edit?.maxInputImages).toBe(1);
expectExplicitMusicGenerationCapabilities(provider);
});
it("runs a music workflow and returns audio outputs", async () => {

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/comfy-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw ComfyUI provider plugin",
"type": "module",

View File

@@ -1,6 +1,7 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import * as providerAuth from "openclaw/plugin-sdk/provider-auth-runtime";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { expectExplicitVideoGenerationCapabilities } from "../../test/helpers/media-generation/provider-capability-assertions.js";
import {
_setComfyFetchGuardForTesting,
buildComfyVideoGenerationProvider,
@@ -36,6 +37,10 @@ describe("comfy video-generation provider", () => {
vi.restoreAllMocks();
});
it("declares explicit mode capabilities", () => {
expectExplicitVideoGenerationCapabilities(buildComfyVideoGenerationProvider());
});
it("treats local comfy video workflows as configured without an API key", () => {
const provider = buildComfyVideoGenerationProvider();
expect(

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/copilot-proxy",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Copilot Proxy provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/deepgram-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Deepgram media-understanding provider",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/deepseek-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw DeepSeek provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/diagnostics-otel",
"version": "2026.4.10",
"version": "2026.4.11",
"description": "OpenClaw diagnostics OpenTelemetry exporter",
"type": "module",
"dependencies": {
@@ -24,10 +24,10 @@
"./index.ts"
],
"compat": {
"pluginApi": ">=2026.4.10"
"pluginApi": ">=2026.4.11"
},
"build": {
"openclawVersion": "2026.4.10"
"openclawVersion": "2026.4.11"
},
"release": {
"publishToClawHub": true,

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/diffs",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw diff viewer plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/discord",
"version": "2026.4.10",
"version": "2026.4.11",
"description": "OpenClaw Discord channel plugin",
"type": "module",
"dependencies": {
@@ -16,7 +16,7 @@
"openclaw": "workspace:*"
},
"peerDependencies": {
"openclaw": ">=2026.4.10"
"openclaw": ">=2026.4.11"
},
"peerDependenciesMeta": {
"openclaw": {
@@ -52,10 +52,10 @@
"minHostVersion": ">=2026.4.10"
},
"compat": {
"pluginApi": ">=2026.4.10"
"pluginApi": ">=2026.4.11"
},
"build": {
"openclawVersion": "2026.4.10"
"openclawVersion": "2026.4.11"
},
"bundle": {
"stageRuntimeDependencies": true

View File

@@ -1,6 +1,7 @@
import { createLazyChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
import type { ChannelApprovalNativeRuntimeAdapter } from "openclaw/plugin-sdk/approval-handler-runtime";
import { resolveApprovalRequestSessionConversation } from "openclaw/plugin-sdk/approval-native-runtime";
import type { ChannelApprovalCapability } from "openclaw/plugin-sdk/channel-contract";
import type { DiscordExecApprovalConfig } from "openclaw/plugin-sdk/config-runtime";
import {
normalizeLowercaseStringOrEmpty,
@@ -172,7 +173,9 @@ export function createDiscordApprovalCapability(configOverride?: DiscordExecAppr
return createApproverRestrictedNativeApprovalCapability({
channel: "discord",
channelLabel: "Discord",
describeExecApprovalSetup: ({ accountId }) => {
describeExecApprovalSetup: ({
accountId,
}: Parameters<NonNullable<ChannelApprovalCapability["describeExecApprovalSetup"]>>[0]) => {
const prefix =
accountId && accountId !== "default"
? `channels.discord.accounts.${accountId}`

View File

@@ -96,6 +96,47 @@ describe("discord doctor", () => {
).toEqual(["Moved channels.discord.streamMode → channels.discord.streaming.mode (block)."]);
});
it("moves account voice.tts.edge into providers.microsoft", () => {
const normalize = discordDoctor.normalizeCompatibilityConfig;
expect(normalize).toBeDefined();
if (!normalize) {
return;
}
const result = normalize({
cfg: {
channels: {
discord: {
accounts: {
main: {
voice: {
tts: {
edge: {
voice: "en-US-JennyNeural",
},
},
},
},
},
},
},
} as never,
});
expect(result.changes).toContain(
"Moved channels.discord.accounts.main.voice.tts.edge → channels.discord.accounts.main.voice.tts.providers.microsoft.",
);
const mainTts = result.config.channels?.discord?.accounts?.main?.voice?.tts as
| Record<string, unknown>
| undefined;
expect(mainTts?.providers).toEqual({
microsoft: {
voice: "en-US-JennyNeural",
},
});
expect(mainTts?.edge).toBeUndefined();
});
it("finds numeric id entries across discord scopes", () => {
const cfg = {
channels: {

View File

@@ -1,8 +1,15 @@
import { randomUUID } from "node:crypto";
import * as carbonGateway from "@buape/carbon/gateway";
import type { APIGatewayBotInfo } from "discord-api-types/v10";
import * as httpsProxyAgent from "https-proxy-agent";
import type { DiscordAccountConfig } from "openclaw/plugin-sdk/config-runtime";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import {
captureHttpExchange,
captureWsEvent,
resolveEffectiveDebugProxyUrl,
resolveDebugProxySettings,
} from "openclaw/plugin-sdk/proxy-capture";
import { danger } from "openclaw/plugin-sdk/runtime-env";
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";
@@ -275,11 +282,50 @@ function createGatewayPlugin(params: {
if (!url) {
throw new Error("Gateway URL is required");
}
const wsFlowId = randomUUID();
// Avoid Node's undici-backed global WebSocket here. We have seen late
// close-path crashes during Discord gateway teardown; the ws transport is
// already our proxy path and behaves predictably for lifecycle cleanup.
const WebSocketCtor = params.testing?.webSocketCtor ?? ws.default;
const socket = new WebSocketCtor(url, params.wsAgent ? { agent: params.wsAgent } : undefined);
captureWsEvent({
url,
direction: "local",
kind: "ws-open",
flowId: wsFlowId,
meta: { subsystem: "discord-gateway" },
});
socket.on?.("message", (data: unknown) => {
captureWsEvent({
url,
direction: "inbound",
kind: "ws-frame",
flowId: wsFlowId,
payload: Buffer.isBuffer(data) ? data : Buffer.from(String(data)),
meta: { subsystem: "discord-gateway" },
});
});
socket.on?.("close", (code: number, reason: Buffer) => {
captureWsEvent({
url,
direction: "local",
kind: "ws-close",
flowId: wsFlowId,
closeCode: code,
payload: reason,
meta: { subsystem: "discord-gateway" },
});
});
socket.on?.("error", (error: Error) => {
captureWsEvent({
url,
direction: "local",
kind: "error",
flowId: wsFlowId,
errorText: error.message,
meta: { subsystem: "discord-gateway" },
});
});
if ("binaryType" in socket) {
try {
socket.binaryType = "arraybuffer";
@@ -309,7 +355,8 @@ export function createDiscordGatewayPlugin(params: {
};
}): carbonGateway.GatewayPlugin {
const intents = resolveDiscordGatewayIntents(params.discordConfig?.intents);
const proxy = params.discordConfig?.proxy?.trim();
const proxy = resolveEffectiveDebugProxyUrl(params.discordConfig?.proxy);
const debugProxySettings = resolveDebugProxySettings();
const options = {
reconnect: { maxAttempts: 50 },
intents,
@@ -319,7 +366,21 @@ export function createDiscordGatewayPlugin(params: {
if (!proxy) {
return createGatewayPlugin({
options,
fetchImpl: (input, init) => fetch(input, init as RequestInit),
fetchImpl: async (input, init) => {
const response = await fetch(input, init as RequestInit);
if (!debugProxySettings.enabled) {
captureHttpExchange({
url: input,
method: (init?.method as string | undefined) ?? "GET",
requestHeaders: init?.headers as Headers | Record<string, string> | undefined,
requestBody: (init as RequestInit & { body?: BodyInit | null })?.body ?? null,
response,
flowId: randomUUID(),
meta: { subsystem: "discord-gateway-metadata" },
});
}
return response;
},
runtime: params.runtime,
testing: params.__testing
? {
@@ -342,7 +403,22 @@ export function createDiscordGatewayPlugin(params: {
return createGatewayPlugin({
options,
fetchImpl: (input, init) => (params.__testing?.undiciFetch ?? undici.fetch)(input, init),
fetchImpl: async (input, init) => {
const response = (await (params.__testing?.undiciFetch ?? undici.fetch)(
input,
init,
)) as unknown as Response;
captureHttpExchange({
url: input,
method: (init?.method as string | undefined) ?? "GET",
requestHeaders: init?.headers as Headers | Record<string, string> | undefined,
requestBody: (init as RequestInit & { body?: BodyInit | null })?.body ?? null,
response,
flowId: randomUUID(),
meta: { subsystem: "discord-gateway-metadata" },
});
return response;
},
fetchInit: { dispatcher: fetchAgent },
wsAgent,
runtime: params.runtime,

View File

@@ -3,11 +3,14 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const {
GatewayIntents,
baseRegisterClientSpy,
captureHttpExchangeSpy,
captureWsEventSpy,
GatewayPlugin,
globalFetchMock,
HttpsProxyAgent,
getLastAgent,
restProxyAgentSpy,
resolveDebugProxySettingsMock,
undiciFetchMock,
undiciProxyAgentSpy,
resetLastAgent,
@@ -21,6 +24,9 @@ const {
const globalFetchMock = vi.fn();
const baseRegisterClientSpy = vi.fn();
const webSocketSpy = vi.fn();
const captureHttpExchangeSpy = vi.fn();
const captureWsEventSpy = vi.fn();
const resolveDebugProxySettingsMock = vi.fn(() => ({ enabled: false }));
const GatewayIntents = {
Guilds: 1 << 0,
@@ -66,6 +72,9 @@ const {
HttpsProxyAgent,
getLastAgent: () => HttpsProxyAgent.lastCreated,
restProxyAgentSpy,
captureHttpExchangeSpy,
captureWsEventSpy,
resolveDebugProxySettingsMock,
undiciFetchMock,
undiciProxyAgentSpy,
resetLastAgent: () => {
@@ -106,6 +115,14 @@ vi.mock("ws", () => ({
},
}));
vi.mock("openclaw/plugin-sdk/proxy-capture", () => ({
captureHttpExchange: captureHttpExchangeSpy,
captureWsEvent: captureWsEventSpy,
resolveEffectiveDebugProxyUrl: (configuredProxyUrl?: string) =>
configuredProxyUrl?.trim() || process.env.OPENCLAW_DEBUG_PROXY_URL,
resolveDebugProxySettings: resolveDebugProxySettingsMock,
}));
describe("createDiscordGatewayPlugin", () => {
let createDiscordGatewayPlugin: typeof import("./gateway-plugin.js").createDiscordGatewayPlugin;
@@ -213,6 +230,9 @@ describe("createDiscordGatewayPlugin", () => {
undiciProxyAgentSpy.mockClear();
wsProxyAgentSpy.mockClear();
webSocketSpy.mockClear();
captureHttpExchangeSpy.mockClear();
captureWsEventSpy.mockClear();
resolveDebugProxySettingsMock.mockReset().mockReturnValue({ enabled: false });
resetLastAgent();
});
@@ -249,6 +269,23 @@ describe("createDiscordGatewayPlugin", () => {
expect(wsProxyAgentSpy).not.toHaveBeenCalled();
});
it("allocates a fresh websocket flow id for each gateway socket", () => {
const runtime = createRuntime();
const plugin = createDiscordGatewayPlugin({
discordConfig: {},
runtime,
});
const createWebSocket = (plugin as unknown as { createWebSocket: (url: string) => unknown })
.createWebSocket;
createWebSocket("wss://gateway.discord.gg/?attempt=1");
createWebSocket("wss://gateway.discord.gg/?attempt=2");
const openCalls = captureWsEventSpy.mock.calls.filter(([event]) => event?.kind === "ws-open");
expect(openCalls).toHaveLength(2);
expect(openCalls[0]?.[0]?.flowId).not.toBe(openCalls[1]?.[0]?.flowId);
});
it("maps plain-text Discord 503 responses to fetch failed", async () => {
await expectGatewayRegisterFallback({
ok: false,
@@ -324,6 +361,19 @@ describe("createDiscordGatewayPlugin", () => {
expect(baseRegisterClientSpy).toHaveBeenCalledTimes(1);
});
it("does not double-capture gateway metadata fetches when global fetch patching is enabled", async () => {
resolveDebugProxySettingsMock.mockReturnValue({ enabled: true });
const runtime = createRuntime();
const plugin = createDiscordGatewayPlugin({
discordConfig: {},
runtime,
});
await registerGatewayClientWithMetadata({ plugin, fetchMock: globalFetchMock });
expect(captureHttpExchangeSpy).not.toHaveBeenCalled();
});
it("accepts IPv6 loopback proxy URLs for gateway metadata and websocket setup", async () => {
const runtime = createRuntime();
const plugin = createDiscordGatewayPlugin({

View File

@@ -30,6 +30,7 @@ describe("resolveDiscordRestFetch", () => {
});
beforeEach(() => {
vi.unstubAllEnvs();
undiciFetchMock.mockReset();
proxyAgentSpy.mockReset();
});
@@ -100,4 +101,21 @@ describe("resolveDiscordRestFetch", () => {
expect(proxyAgentSpy).toHaveBeenCalledWith("http://[::1]:8080");
expect(runtime.error).not.toHaveBeenCalled();
});
it("uses debug proxy env when no discord proxy URL is configured", async () => {
vi.stubEnv("OPENCLAW_DEBUG_PROXY_ENABLED", "1");
vi.stubEnv("OPENCLAW_DEBUG_PROXY_URL", "http://127.0.0.1:7777");
const runtime = {
log: vi.fn(),
error: vi.fn(),
exit: vi.fn(),
} as const;
undiciFetchMock.mockResolvedValue(new Response("ok", { status: 200 }));
const fetcher = resolveDiscordRestFetch(undefined, runtime);
await fetcher("https://discord.com/api/v10/oauth2/applications/@me");
expect(proxyAgentSpy).toHaveBeenCalledWith("http://127.0.0.1:7777");
expect(runtime.log).toHaveBeenCalledWith("discord: rest proxy enabled");
});
});

View File

@@ -9,6 +9,7 @@ import {
import { GatewayCloseCodes, type GatewayPlugin } from "@buape/carbon/gateway";
import { Routes } from "discord-api-types/v10";
import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
import type { ChannelRuntimeSurface } from "openclaw/plugin-sdk/channel-contract";
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
import {
listNativeCommandSpecsForConfig,
@@ -95,7 +96,7 @@ export type MonitorDiscordOpts = {
accountId?: string;
config?: OpenClawConfig;
runtime?: RuntimeEnv;
channelRuntime?: import("openclaw/plugin-sdk/channel-core").PluginRuntime["channel"];
channelRuntime?: ChannelRuntimeSurface;
abortSignal?: AbortSignal;
mediaMaxMb?: number;
historyLimit?: number;

View File

@@ -1,4 +1,10 @@
import { randomUUID } from "node:crypto";
import { wrapFetchWithAbortSignal } from "openclaw/plugin-sdk/fetch-runtime";
import {
captureHttpExchange,
resolveEffectiveDebugProxyUrl,
} from "openclaw/plugin-sdk/proxy-capture";
import { resolveRequestUrl } from "openclaw/plugin-sdk/request-url";
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { ProxyAgent, fetch as undiciFetch } from "undici";
import { withValidatedDiscordProxy } from "../proxy-fetch.js";
@@ -7,15 +13,27 @@ export function resolveDiscordRestFetch(
proxyUrl: string | undefined,
runtime: RuntimeEnv,
): typeof fetch {
const fetcher = withValidatedDiscordProxy(proxyUrl, runtime, (proxy) => {
const effectiveProxyUrl = resolveEffectiveDebugProxyUrl(proxyUrl);
const fetcher = withValidatedDiscordProxy(effectiveProxyUrl, runtime, (proxy) => {
const agent = new ProxyAgent(proxy);
return wrapFetchWithAbortSignal(
((input: RequestInfo | URL, init?: RequestInit) =>
return wrapFetchWithAbortSignal(((input: RequestInfo | URL, init?: RequestInit) =>
(
undiciFetch(input as string | URL, {
...(init as Record<string, unknown>),
dispatcher: agent,
}) as unknown as Promise<Response>) as typeof fetch,
);
}) as unknown as Promise<Response>
).then((response) => {
captureHttpExchange({
url: resolveRequestUrl(input),
method: init?.method ?? "GET",
requestHeaders: init?.headers as Headers | Record<string, string> | undefined,
requestBody: (init as RequestInit & { body?: BodyInit | null })?.body ?? null,
response,
flowId: randomUUID(),
meta: { subsystem: "discord-rest" },
});
return response;
})) as typeof fetch);
});
if (!fetcher) {
return fetch;

View File

@@ -407,9 +407,7 @@ describe("DiscordVoiceManager", () => {
await manager.join({ guildId: "g1", channelId: "1001" });
const entry = (manager as unknown as { sessions: Map<string, unknown> }).sessions.get(
"g1",
) as
const entry = (manager as unknown as { sessions: Map<string, unknown> }).sessions.get("g1") as
| {
guildId: string;
channelId: string;

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/duckduckgo-plugin",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw DuckDuckGo plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/elevenlabs-speech",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw ElevenLabs speech plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/exa-plugin",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Exa plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/fal-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw fal provider plugin",
"type": "module",

View File

@@ -1 +1,2 @@
export { buildFalImageGenerationProvider } from "./image-generation-provider.js";
export { buildFalVideoGenerationProvider } from "./video-generation-provider.js";

View File

@@ -1,6 +1,7 @@
import * as providerAuth from "openclaw/plugin-sdk/provider-auth-runtime";
import * as providerHttp from "openclaw/plugin-sdk/provider-http";
import { afterEach, describe, expect, it, vi } from "vitest";
import { expectExplicitVideoGenerationCapabilities } from "../../test/helpers/media-generation/provider-capability-assertions.js";
import {
_setFalVideoFetchGuardForTesting,
buildFalVideoGenerationProvider,
@@ -18,6 +19,10 @@ describe("fal video generation provider", () => {
_setFalVideoFetchGuardForTesting(null);
});
it("declares explicit mode capabilities", () => {
expectExplicitVideoGenerationCapabilities(buildFalVideoGenerationProvider());
});
it("submits fal video jobs through the queue API and downloads the completed result", async () => {
vi.spyOn(providerAuth, "resolveApiKeyForProvider").mockResolvedValue({
apiKey: "fal-key",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/feishu",
"version": "2026.4.10",
"version": "2026.4.11",
"description": "OpenClaw Feishu/Lark channel plugin (community maintained by @m1heng)",
"type": "module",
"dependencies": {
@@ -12,7 +12,7 @@
"openclaw": "workspace:*"
},
"peerDependencies": {
"openclaw": ">=2026.4.10"
"openclaw": ">=2026.4.11"
},
"peerDependenciesMeta": {
"openclaw": {
@@ -43,10 +43,10 @@
"minHostVersion": ">=2026.4.10"
},
"compat": {
"pluginApi": ">=2026.4.10"
"pluginApi": ">=2026.4.11"
},
"build": {
"openclawVersion": "2026.4.10"
"openclawVersion": "2026.4.11"
},
"bundle": {
"stageRuntimeDependencies": true

View File

@@ -0,0 +1,160 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
const resolveFeishuRuntimeAccountMock = vi.hoisted(() => vi.fn());
const createFeishuClientMock = vi.hoisted(() => vi.fn());
const createReplyPrefixContextMock = vi.hoisted(() => vi.fn());
const createCommentTypingReactionLifecycleMock = vi.hoisted(() => vi.fn());
const deliverCommentThreadTextMock = vi.hoisted(() => vi.fn());
const createReplyDispatcherWithTypingMock = vi.hoisted(() => vi.fn());
const getFeishuRuntimeMock = vi.hoisted(() => vi.fn());
vi.mock("./accounts.js", () => ({
resolveFeishuRuntimeAccount: resolveFeishuRuntimeAccountMock,
}));
vi.mock("./client.js", () => ({
createFeishuClient: createFeishuClientMock,
}));
vi.mock("./comment-dispatcher-runtime-api.js", () => ({
createReplyPrefixContext: createReplyPrefixContextMock,
}));
vi.mock("./comment-reaction.js", () => ({
createCommentTypingReactionLifecycle: createCommentTypingReactionLifecycleMock,
}));
vi.mock("./drive.js", () => ({
deliverCommentThreadText: deliverCommentThreadTextMock,
}));
vi.mock("./runtime.js", () => ({
getFeishuRuntime: getFeishuRuntimeMock,
}));
import { createFeishuCommentReplyDispatcher } from "./comment-dispatcher.js";
describe("createFeishuCommentReplyDispatcher", () => {
beforeEach(() => {
vi.clearAllMocks();
resolveFeishuRuntimeAccountMock.mockReturnValue({
accountId: "main",
appId: "app_id",
appSecret: "app_secret",
domain: "feishu",
config: {},
});
createFeishuClientMock.mockReturnValue({});
createReplyPrefixContextMock.mockReturnValue({
responsePrefix: undefined,
responsePrefixContextProvider: undefined,
});
deliverCommentThreadTextMock.mockResolvedValue({
delivery_mode: "reply_comment",
reply_id: "reply_1",
});
createCommentTypingReactionLifecycleMock.mockReturnValue({
start: vi.fn(async () => {}),
cleanup: vi.fn(async () => {}),
});
createReplyDispatcherWithTypingMock.mockImplementation(() => ({
dispatcher: {
markComplete: vi.fn(),
waitForIdle: vi.fn(async () => {}),
},
replyOptions: {},
markDispatchIdle: vi.fn(),
markRunComplete: vi.fn(),
}));
getFeishuRuntimeMock.mockReturnValue({
channel: {
text: {
resolveTextChunkLimit: vi.fn(() => 4000),
resolveChunkMode: vi.fn(() => "line"),
chunkTextWithMode: vi.fn((text: string) => [text]),
},
reply: {
createReplyDispatcherWithTyping: createReplyDispatcherWithTypingMock,
resolveHumanDelayConfig: vi.fn(() => undefined),
},
},
});
});
it("sends final comment text without waiting for typing cleanup", async () => {
let resolveCleanup: (() => void) | undefined;
const cleanup = vi.fn(
() =>
new Promise<void>((resolve) => {
resolveCleanup = resolve;
}),
);
createCommentTypingReactionLifecycleMock.mockReturnValue({
start: vi.fn(async () => {}),
cleanup,
});
createFeishuCommentReplyDispatcher({
cfg: {} as never,
agentId: "main",
runtime: { log: vi.fn(), error: vi.fn() } as never,
accountId: "main",
fileToken: "doc_token_1",
fileType: "docx",
commentId: "comment_1",
replyId: "reply_1",
isWholeComment: false,
});
const options = createReplyDispatcherWithTypingMock.mock.calls.at(-1)?.[0];
const deliverPromise = options.deliver({ text: "hello world" }, { kind: "final" });
const status = await Promise.race([
deliverPromise.then(() => "done"),
new Promise<string>((resolve) => setTimeout(() => resolve("pending"), 0)),
]);
expect(status).toBe("done");
expect(deliverCommentThreadTextMock).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
file_token: "doc_token_1",
file_type: "docx",
comment_id: "comment_1",
content: "hello world",
is_whole_comment: false,
}),
);
expect(cleanup).not.toHaveBeenCalled();
options.onCleanup?.();
expect(cleanup).toHaveBeenCalledTimes(1);
resolveCleanup?.();
await deliverPromise;
});
it("starts the typing reaction from dispatcher onReplyStart", async () => {
const start = vi.fn(async () => {});
createCommentTypingReactionLifecycleMock.mockReturnValue({
start,
cleanup: vi.fn(async () => {}),
});
createFeishuCommentReplyDispatcher({
cfg: {} as never,
agentId: "main",
runtime: { log: vi.fn(), error: vi.fn() } as never,
accountId: "main",
fileToken: "doc_token_1",
fileType: "docx",
commentId: "comment_1",
replyId: "reply_1",
isWholeComment: false,
});
const options = createReplyDispatcherWithTypingMock.mock.calls.at(-1)?.[0];
await options.onReplyStart?.();
expect(start).toHaveBeenCalledTimes(1);
});
});

View File

@@ -7,6 +7,7 @@ import {
type ReplyPayload,
type RuntimeEnv,
} from "./comment-dispatcher-runtime-api.js";
import { createCommentTypingReactionLifecycle } from "./comment-reaction.js";
import type { CommentFileType } from "./comment-target.js";
import { deliverCommentThreadText } from "./drive.js";
import { getFeishuRuntime } from "./runtime.js";
@@ -19,6 +20,7 @@ export type CreateFeishuCommentReplyDispatcherParams = {
fileToken: string;
fileType: CommentFileType;
commentId: string;
replyId?: string;
isWholeComment?: boolean;
};
@@ -43,12 +45,23 @@ export function createFeishuCommentReplyDispatcher(
},
);
const chunkMode = core.channel.text.resolveChunkMode(params.cfg, "feishu");
const typingReaction = createCommentTypingReactionLifecycle({
cfg: params.cfg,
fileToken: params.fileToken,
fileType: params.fileType,
replyId: params.replyId,
accountId: params.accountId,
runtime: params.runtime,
});
const { dispatcher, replyOptions, markDispatchIdle } =
const { dispatcher, replyOptions, markDispatchIdle, markRunComplete } =
core.channel.reply.createReplyDispatcherWithTyping({
responsePrefix: prefixContext.responsePrefix,
responsePrefixContextProvider: prefixContext.responsePrefixContextProvider,
humanDelay: core.channel.reply.resolveHumanDelayConfig(params.cfg, params.agentId),
onReplyStart: async () => {
await typingReaction.start();
},
deliver: async (payload: ReplyPayload, info) => {
if (info.kind !== "final") {
return;
@@ -78,7 +91,17 @@ export function createFeishuCommentReplyDispatcher(
`feishu[${params.accountId ?? "default"}]: comment dispatcher failed kind=${info.kind} comment=${params.commentId}: ${String(err)}`,
);
},
onCleanup: () => {
void typingReaction.cleanup();
},
});
return { dispatcher, replyOptions, markDispatchIdle };
return {
dispatcher,
replyOptions,
markDispatchIdle,
markRunComplete,
startTypingReaction: typingReaction.start,
cleanupTypingReaction: typingReaction.cleanup,
};
}

View File

@@ -164,6 +164,9 @@ describe("handleFeishuCommentEvent", () => {
},
replyOptions: {},
markDispatchIdle: vi.fn(),
markRunComplete: vi.fn(),
startTypingReaction: vi.fn(async () => {}),
cleanupTypingReaction: vi.fn(async () => {}),
});
});
@@ -198,9 +201,15 @@ describe("handleFeishuCommentEvent", () => {
OriginatingChannel: "feishu",
OriginatingTo: "comment:docx:doc_token_1:comment_1",
MessageSid: "drive-comment:evt_1",
MessageThreadId: "reply_1",
}),
);
expect(recordInboundSession).toHaveBeenCalledTimes(1);
expect(recordInboundSession).toHaveBeenCalledWith(
expect.objectContaining({
sessionKey: "agent:main:feishu:direct:comment-doc:docx:doc_token_1",
}),
);
expect(dispatchReplyFromConfig).toHaveBeenCalledTimes(1);
});
@@ -309,8 +318,124 @@ describe("handleFeishuCommentEvent", () => {
commentId: "comment_whole",
fileToken: "doc_token_1",
fileType: "docx",
replyId: "reply_whole",
isWholeComment: true,
}),
);
});
it("always finalizes comment typing cleanup even when dispatch fails", async () => {
const dispatchReplyFromConfig = vi.fn(async () => {
throw new Error("dispatch failed");
});
const runtime = createTestRuntime({ dispatchReplyFromConfig });
setFeishuRuntime(runtime);
const markRunComplete = vi.fn();
const markDispatchIdle = vi.fn();
const cleanupTypingReaction = vi.fn(async () => {});
createFeishuCommentReplyDispatcherMock.mockReturnValue({
dispatcher: {
markComplete: vi.fn(),
waitForIdle: vi.fn(async () => {}),
},
replyOptions: {},
markDispatchIdle,
markRunComplete,
startTypingReaction: vi.fn(async () => {}),
cleanupTypingReaction,
});
await expect(
handleFeishuCommentEvent({
cfg: buildConfig(),
accountId: "default",
event: { event_id: "evt_1" },
botOpenId: "ou_bot",
runtime: {
log: vi.fn(),
error: vi.fn(),
} as never,
}),
).rejects.toThrow("dispatch failed");
expect(markRunComplete).toHaveBeenCalledTimes(1);
expect(markDispatchIdle).toHaveBeenCalledTimes(1);
expect(cleanupTypingReaction).toHaveBeenCalledTimes(1);
});
it("does not wait for comment typing cleanup before returning", async () => {
let resolveCleanup: (() => void) | undefined;
const cleanupTypingReaction = vi.fn(
() =>
new Promise<void>((resolve) => {
resolveCleanup = resolve;
}),
);
createFeishuCommentReplyDispatcherMock.mockReturnValue({
dispatcher: {
markComplete: vi.fn(),
waitForIdle: vi.fn(async () => {}),
},
replyOptions: {},
markDispatchIdle: vi.fn(),
markRunComplete: vi.fn(),
startTypingReaction: vi.fn(async () => {}),
cleanupTypingReaction,
});
const eventPromise = handleFeishuCommentEvent({
cfg: buildConfig(),
accountId: "default",
event: { event_id: "evt_1" },
botOpenId: "ou_bot",
runtime: {
log: vi.fn(),
error: vi.fn(),
} as never,
});
const status = await Promise.race([
eventPromise.then(() => "done"),
new Promise<string>((resolve) => setTimeout(() => resolve("pending"), 0)),
]);
expect(status).toBe("done");
expect(cleanupTypingReaction).toHaveBeenCalledTimes(1);
resolveCleanup?.();
await eventPromise;
});
it("does not start comment typing reaction before dispatch begins", async () => {
const startTypingReaction = vi.fn(async () => {});
createFeishuCommentReplyDispatcherMock.mockReturnValue({
dispatcher: {
markComplete: vi.fn(),
waitForIdle: vi.fn(async () => {}),
},
replyOptions: {},
markDispatchIdle: vi.fn(),
markRunComplete: vi.fn(),
startTypingReaction,
cleanupTypingReaction: vi.fn(async () => {}),
});
await handleFeishuCommentEvent({
cfg: buildConfig(),
accountId: "default",
event: { event_id: "evt_1" },
botOpenId: "ou_bot",
runtime: {
log: vi.fn(),
error: vi.fn(),
} as never,
});
expect(startTypingReaction).not.toHaveBeenCalled();
const runtime = (await import("./runtime.js")).getFeishuRuntime();
const dispatchReplyFromConfig = runtime.channel.reply.dispatchReplyFromConfig as ReturnType<
typeof vi.fn
>;
expect(dispatchReplyFromConfig).toHaveBeenCalledTimes(1);
});
});

View File

@@ -29,7 +29,8 @@ type HandleFeishuCommentEventParams = {
function buildCommentSessionKey(params: {
core: ReturnType<typeof getFeishuRuntime>;
route: ResolvedAgentRoute;
commentTarget: string;
fileType: string;
fileToken: string;
}): string {
return params.core.channel.routing.buildAgentSessionKey({
agentId: params.route.agentId,
@@ -37,7 +38,7 @@ function buildCommentSessionKey(params: {
accountId: params.route.accountId,
peer: {
kind: "direct",
id: params.commentTarget,
id: `comment-doc:${params.fileType}:${params.fileToken}`,
},
dmScope: "per-account-channel-peer",
});
@@ -172,7 +173,8 @@ export async function handleFeishuCommentEvent(
const commentSessionKey = buildCommentSessionKey({
core,
route,
commentTarget,
fileType: turn.fileType,
fileToken: turn.fileToken,
});
const bodyForAgent = `[message_id: ${turn.messageId}]\n${turn.prompt}`;
const ctxPayload = core.channel.reply.finalizeInboundContext({
@@ -193,6 +195,9 @@ export async function handleFeishuCommentEvent(
Provider: "feishu",
Surface: "feishu-comment",
MessageSid: turn.messageId,
// For Feishu comment turns, MessageThreadId carries the inbound reply_id so
// comment-aware tools can clean typing reaction before sending visible output.
MessageThreadId: turn.replyId,
Timestamp: parseTimestampMs(turn.timestamp),
WasMentioned: turn.isMentioned,
CommandAuthorized: false,
@@ -214,36 +219,41 @@ export async function handleFeishuCommentEvent(
},
});
const { dispatcher, replyOptions, markDispatchIdle } = createFeishuCommentReplyDispatcher({
cfg: effectiveCfg,
agentId: route.agentId,
runtime,
accountId: account.accountId,
fileToken: turn.fileToken,
fileType: turn.fileType,
commentId: turn.commentId,
isWholeComment: turn.isWholeComment,
});
const { dispatcher, replyOptions, markDispatchIdle, markRunComplete, cleanupTypingReaction } =
createFeishuCommentReplyDispatcher({
cfg: effectiveCfg,
agentId: route.agentId,
runtime,
accountId: account.accountId,
fileToken: turn.fileToken,
fileType: turn.fileType,
commentId: turn.commentId,
replyId: turn.replyId,
isWholeComment: turn.isWholeComment,
});
log(
`feishu[${account.accountId}]: dispatching drive comment to agent ` +
`(session=${commentSessionKey} comment=${turn.commentId} type=${turn.noticeType})`,
);
const { queuedFinal, counts } = await core.channel.reply.withReplyDispatcher({
dispatcher,
onSettled: () => {
markDispatchIdle();
},
run: () =>
core.channel.reply.dispatchReplyFromConfig({
ctx: ctxPayload,
cfg: effectiveCfg,
dispatcher,
replyOptions,
}),
});
log(
`feishu[${account.accountId}]: drive comment dispatch complete ` +
`(queuedFinal=${queuedFinal}, replies=${counts.final}, session=${commentSessionKey})`,
);
try {
log(
`feishu[${account.accountId}]: dispatching drive comment to agent ` +
`(session=${commentSessionKey} comment=${turn.commentId} type=${turn.noticeType})`,
);
const { queuedFinal, counts } = await core.channel.reply.withReplyDispatcher({
dispatcher,
run: () =>
core.channel.reply.dispatchReplyFromConfig({
ctx: ctxPayload,
cfg: effectiveCfg,
dispatcher,
replyOptions,
}),
});
log(
`feishu[${account.accountId}]: drive comment dispatch complete ` +
`(queuedFinal=${queuedFinal}, replies=${counts.final}, session=${commentSessionKey})`,
);
} finally {
markRunComplete();
markDispatchIdle();
void cleanupTypingReaction();
}
}

View File

@@ -0,0 +1,190 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../runtime-api.js";
import {
cleanupAmbientCommentTypingReaction,
createCommentTypingReactionLifecycle,
} from "./comment-reaction.js";
const resolveFeishuRuntimeAccountMock = vi.hoisted(() => vi.fn());
const createFeishuClientMock = vi.hoisted(() => vi.fn());
vi.mock("./accounts.js", () => ({
resolveFeishuRuntimeAccount: resolveFeishuRuntimeAccountMock,
}));
vi.mock("./client.js", () => ({
createFeishuClient: createFeishuClientMock,
}));
describe("createCommentTypingReactionLifecycle", () => {
const request = vi.fn();
beforeEach(() => {
vi.clearAllMocks();
resolveFeishuRuntimeAccountMock.mockReturnValue({
accountId: "default",
configured: true,
config: {
typingIndicator: true,
},
});
createFeishuClientMock.mockReturnValue({
request,
});
request.mockResolvedValue({
code: 0,
data: {},
});
});
it("adds and removes a comment typing reaction using reply_id", async () => {
const lifecycle = createCommentTypingReactionLifecycle({
cfg: {} as ClawdbotConfig,
fileToken: "doc_token_1",
fileType: "docx",
replyId: "reply_1",
runtime: {
log: vi.fn(),
} as never,
});
await lifecycle.start();
await lifecycle.cleanup();
expect(request).toHaveBeenNthCalledWith(
1,
expect.objectContaining({
method: "POST",
url: "/open-apis/drive/v2/files/doc_token_1/comments/reaction?file_type=docx",
data: {
action: "add",
reply_id: "reply_1",
reaction_type: "Typing",
},
}),
);
expect(request).toHaveBeenNthCalledWith(
2,
expect.objectContaining({
method: "POST",
url: "/open-apis/drive/v2/files/doc_token_1/comments/reaction?file_type=docx",
data: {
action: "delete",
reply_id: "reply_1",
reaction_type: "Typing",
},
}),
);
});
it("skips requests when reply_id is missing", async () => {
const lifecycle = createCommentTypingReactionLifecycle({
cfg: {} as ClawdbotConfig,
fileToken: "doc_token_1",
fileType: "docx",
replyId: undefined,
runtime: {
log: vi.fn(),
} as never,
});
await lifecycle.start();
await lifecycle.cleanup();
expect(request).not.toHaveBeenCalled();
});
it("shares cleanup state so ambient cleanup and finally cleanup do not delete twice", async () => {
const lifecycle = createCommentTypingReactionLifecycle({
cfg: {} as ClawdbotConfig,
fileToken: "doc_token_1",
fileType: "docx",
replyId: "reply_1",
runtime: {
log: vi.fn(),
} as never,
});
await lifecycle.start();
await cleanupAmbientCommentTypingReaction({
client: { request } as never,
deliveryContext: {
channel: "feishu",
to: "comment:docx:doc_token_1:comment_1",
threadId: "reply_1",
},
});
await lifecycle.cleanup();
expect(request).toHaveBeenCalledTimes(2);
expect(request).toHaveBeenNthCalledWith(
2,
expect.objectContaining({
data: {
action: "delete",
reply_id: "reply_1",
reaction_type: "Typing",
},
}),
);
});
it("retries delete during later cleanup after an ambient delete failure", async () => {
request
.mockResolvedValueOnce({
code: 0,
data: {},
})
.mockResolvedValueOnce({
code: 5001,
msg: "temporary failure",
})
.mockResolvedValueOnce({
code: 0,
data: {},
});
const lifecycle = createCommentTypingReactionLifecycle({
cfg: {} as ClawdbotConfig,
fileToken: "doc_token_1",
fileType: "docx",
replyId: "reply_1",
runtime: {
log: vi.fn(),
} as never,
});
await lifecycle.start();
await cleanupAmbientCommentTypingReaction({
client: { request } as never,
deliveryContext: {
channel: "feishu",
to: "comment:docx:doc_token_1:comment_1",
threadId: "reply_1",
},
});
await lifecycle.cleanup();
expect(request).toHaveBeenCalledTimes(3);
expect(request).toHaveBeenNthCalledWith(
2,
expect.objectContaining({
data: {
action: "delete",
reply_id: "reply_1",
reaction_type: "Typing",
},
}),
);
expect(request).toHaveBeenNthCalledWith(
3,
expect.objectContaining({
data: {
action: "delete",
reply_id: "reply_1",
reaction_type: "Typing",
},
}),
);
});
});

View File

@@ -0,0 +1,281 @@
import type { ClawdbotConfig, RuntimeEnv } from "../runtime-api.js";
import { resolveFeishuRuntimeAccount } from "./accounts.js";
import { createFeishuClient } from "./client.js";
import { encodeQuery, isRecord, readString } from "./comment-shared.js";
import { parseFeishuCommentTarget, type CommentFileType } from "./comment-target.js";
const COMMENT_TYPING_REACTION_TYPE = "Typing";
const COMMENT_REACTION_TIMEOUT_MS = 30_000;
const commentTypingReactionState = new Map<
string,
{
active: boolean;
cleaned: boolean;
cleanupPromise?: Promise<boolean>;
}
>();
type FeishuCommentReactionClient = ReturnType<typeof createFeishuClient> & {
request(params: {
method: "POST";
url: string;
data: unknown;
timeout: number;
}): Promise<unknown>;
};
function buildCommentTypingReactionKey(params: {
fileToken: string;
fileType: CommentFileType;
replyId: string;
}): string {
return `${params.fileType}:${params.fileToken}:${params.replyId}`;
}
function ensureCommentTypingReactionState(key: string) {
const existing = commentTypingReactionState.get(key);
if (existing) {
return existing;
}
const created = {
active: false,
cleaned: false,
cleanupPromise: undefined,
};
commentTypingReactionState.set(key, created);
return created;
}
async function requestCommentTypingReactionWithClient(params: {
client: FeishuCommentReactionClient;
fileToken: string;
fileType: CommentFileType;
replyId: string;
action: "add" | "delete";
runtime?: RuntimeEnv;
logPrefix?: string;
}): Promise<boolean> {
try {
const response = (await params.client.request({
method: "POST",
url:
`/open-apis/drive/v2/files/${encodeURIComponent(params.fileToken)}/comments/reaction` +
encodeQuery({
file_type: params.fileType,
}),
data: {
action: params.action,
reply_id: params.replyId,
reaction_type: COMMENT_TYPING_REACTION_TYPE,
},
timeout: COMMENT_REACTION_TIMEOUT_MS,
})) as {
code?: number;
msg?: string;
log_id?: string;
error?: { log_id?: string };
};
if (response.code === 0) {
return true;
}
params.runtime?.log?.(
`${params.logPrefix ?? "[feishu]"}: comment typing reaction ${params.action} failed ` +
`reply=${params.replyId} file=${params.fileType}:${params.fileToken} ` +
`code=${response.code ?? "unknown"} msg=${response.msg ?? "unknown"} ` +
`log_id=${response.log_id ?? response.error?.log_id ?? "unknown"}`,
);
} catch (error) {
params.runtime?.log?.(
`${params.logPrefix ?? "[feishu]"}: comment typing reaction ${params.action} threw ` +
`reply=${params.replyId} file=${params.fileType}:${params.fileToken} ` +
`error=${formatCommentReactionFailure(error)}`,
);
}
return false;
}
function formatCommentReactionFailure(error: unknown): string {
if (!isRecord(error)) {
return typeof error === "string" ? error : JSON.stringify(error);
}
const response = isRecord(error.response) ? error.response : undefined;
const responseData = isRecord(response?.data) ? response?.data : undefined;
return JSON.stringify({
message:
typeof error.message === "string"
? error.message
: typeof error === "string"
? error
: JSON.stringify(error),
code: readString(error.code),
method: readString(isRecord(error.config) ? error.config.method : undefined),
url: readString(isRecord(error.config) ? error.config.url : undefined),
http_status: typeof response?.status === "number" ? response.status : undefined,
feishu_code:
typeof responseData?.code === "number" ? responseData.code : readString(responseData?.code),
feishu_msg: readString(responseData?.msg),
feishu_log_id:
readString(responseData?.log_id) ||
readString(isRecord(responseData?.error) ? responseData.error.log_id : undefined),
});
}
async function requestCommentTypingReaction(params: {
cfg: ClawdbotConfig;
fileToken: string;
fileType: CommentFileType;
replyId: string;
action: "add" | "delete";
accountId?: string;
runtime?: RuntimeEnv;
}): Promise<boolean> {
const account = resolveFeishuRuntimeAccount({ cfg: params.cfg, accountId: params.accountId });
if (!account.configured || !(account.config.typingIndicator ?? true)) {
return false;
}
const client = createFeishuClient(account) as FeishuCommentReactionClient;
return requestCommentTypingReactionWithClient({
client,
fileToken: params.fileToken,
fileType: params.fileType,
replyId: params.replyId,
action: params.action,
runtime: params.runtime,
logPrefix: `feishu[${account.accountId}]`,
});
}
async function cleanupCommentTypingReactionByKey(params: {
key: string;
performDelete: () => Promise<boolean>;
}): Promise<boolean> {
const state = ensureCommentTypingReactionState(params.key);
if (state.cleaned) {
return false;
}
if (state.cleanupPromise) {
return await state.cleanupPromise;
}
const cleanupPromise = (async (): Promise<boolean> => {
if (!state.active) {
state.cleaned = true;
return false;
}
const deleted = await params.performDelete();
if (deleted) {
state.cleaned = true;
state.active = false;
}
return deleted;
})();
state.cleanupPromise = cleanupPromise;
try {
return await cleanupPromise;
} finally {
state.cleanupPromise = undefined;
if (state.cleaned) {
state.active = false;
commentTypingReactionState.delete(params.key);
}
}
}
export async function cleanupAmbientCommentTypingReaction(params: {
client: FeishuCommentReactionClient;
deliveryContext?: {
channel?: string;
to?: string;
threadId?: string | number;
};
runtime?: RuntimeEnv;
}): Promise<boolean> {
const deliveryContext = params.deliveryContext;
if (
deliveryContext?.channel &&
deliveryContext.channel !== "feishu" &&
deliveryContext.channel !== "feishu-comment"
) {
return false;
}
const target = parseFeishuCommentTarget(deliveryContext?.to);
const replyId =
typeof deliveryContext?.threadId === "string" || typeof deliveryContext?.threadId === "number"
? String(deliveryContext.threadId).trim()
: "";
if (!target || !replyId) {
return false;
}
const key = buildCommentTypingReactionKey({
fileToken: target.fileToken,
fileType: target.fileType,
replyId,
});
return cleanupCommentTypingReactionByKey({
key,
performDelete: () =>
requestCommentTypingReactionWithClient({
client: params.client,
fileToken: target.fileToken,
fileType: target.fileType,
replyId,
action: "delete",
runtime: params.runtime,
logPrefix: "[feishu]",
}),
});
}
export function createCommentTypingReactionLifecycle(params: {
cfg: ClawdbotConfig;
fileToken: string;
fileType: CommentFileType;
replyId?: string;
accountId?: string;
runtime?: RuntimeEnv;
}) {
const key = params.replyId?.trim()
? buildCommentTypingReactionKey({
fileToken: params.fileToken,
fileType: params.fileType,
replyId: params.replyId.trim(),
})
: undefined;
const state = key ? ensureCommentTypingReactionState(key) : undefined;
return {
start: async (): Promise<void> => {
const replyId = params.replyId?.trim();
if (!state || state.cleaned || state.active || !replyId) {
return;
}
state.active = await requestCommentTypingReaction({
cfg: params.cfg,
fileToken: params.fileToken,
fileType: params.fileType,
replyId,
action: "add",
accountId: params.accountId,
runtime: params.runtime,
});
},
cleanup: async (): Promise<void> => {
const replyId = params.replyId?.trim();
if (!key || !replyId) {
return;
}
await cleanupCommentTypingReactionByKey({
key,
performDelete: () =>
requestCommentTypingReaction({
cfg: params.cfg,
fileToken: params.fileToken,
fileType: params.fileType,
replyId,
action: "delete",
accountId: params.accountId,
runtime: params.runtime,
}),
});
},
};
}

View File

@@ -0,0 +1,182 @@
import { describe, expect, it } from "vitest";
import {
parseCommentContentElements,
resolveCommentLinkedDocumentFromUrl,
} from "./comment-shared.js";
const VALID_TOKEN_22 = "ABCDEFGHIJKLMNOPQRSTUV";
const VALID_TOKEN_27 = "ZsJfdxrBFo0RwuxteOLc1Ekvneb";
describe("resolveCommentLinkedDocumentFromUrl", () => {
it.each([
{
label: "doc",
url: `https://example.test/doc/${VALID_TOKEN_22}`,
expectedKind: "doc",
expectedResolvedType: "doc",
expectedToken: VALID_TOKEN_22,
},
{
label: "docs",
url: `https://example.test/docs/${VALID_TOKEN_22}`,
expectedKind: "doc",
expectedResolvedType: "doc",
expectedToken: VALID_TOKEN_22,
},
{
label: "space/doc",
url: `https://example.test/space/doc/${VALID_TOKEN_22}`,
expectedKind: "doc",
expectedResolvedType: "doc",
expectedToken: VALID_TOKEN_22,
},
{
label: "sheet",
url: `https://example.test/sheet/${VALID_TOKEN_22}`,
expectedKind: "sheet",
expectedResolvedType: "sheet",
expectedToken: VALID_TOKEN_22,
},
{
label: "sheets",
url: `https://example.test/sheets/${VALID_TOKEN_22}`,
expectedKind: "sheet",
expectedResolvedType: "sheet",
expectedToken: VALID_TOKEN_22,
},
{
label: "space/sheet",
url: `https://example.test/space/sheet/${VALID_TOKEN_22}`,
expectedKind: "sheet",
expectedResolvedType: "sheet",
expectedToken: VALID_TOKEN_22,
},
{
label: "docx with hash",
url: `https://bytedance.larkoffice.com/docx/${VALID_TOKEN_27}#share-Huggdiqveo5N7NxyA01ck4gLnHh`,
expectedKind: "docx",
expectedResolvedType: "docx",
expectedToken: VALID_TOKEN_27,
},
{
label: "mindnote",
url: `https://example.test/mindnote/${VALID_TOKEN_22}`,
expectedKind: "mindnote",
expectedResolvedType: "mindnote",
expectedToken: VALID_TOKEN_22,
},
{
label: "mindnotes",
url: `https://example.test/mindnotes/${VALID_TOKEN_22}`,
expectedKind: "mindnote",
expectedResolvedType: "mindnote",
expectedToken: VALID_TOKEN_22,
},
{
label: "space/mindnote",
url: `https://example.test/space/mindnote/${VALID_TOKEN_22}`,
expectedKind: "mindnote",
expectedResolvedType: "mindnote",
expectedToken: VALID_TOKEN_22,
},
{
label: "bitable",
url: `https://example.test/bitable/${VALID_TOKEN_22}?table=tbl_123`,
expectedKind: "bitable",
expectedResolvedType: "bitable",
expectedToken: VALID_TOKEN_22,
},
{
label: "base",
url: `https://example.test/base/${VALID_TOKEN_22}`,
expectedKind: "base",
expectedResolvedType: "base",
expectedToken: VALID_TOKEN_22,
},
{
label: "space/bitable",
url: `https://example.test/space/bitable/${VALID_TOKEN_22}`,
expectedKind: "bitable",
expectedResolvedType: "bitable",
expectedToken: VALID_TOKEN_22,
},
{
label: "file",
url: `https://example.test/file/${VALID_TOKEN_22}`,
expectedKind: "file",
expectedResolvedType: "file",
expectedToken: VALID_TOKEN_22,
},
{
label: "space/file",
url: `https://example.test/space/file/${VALID_TOKEN_22}`,
expectedKind: "file",
expectedResolvedType: "file",
expectedToken: VALID_TOKEN_22,
},
{
label: "wiki",
url: `https://example.test/wiki/${VALID_TOKEN_22}`,
expectedKind: "wiki",
expectedResolvedType: undefined,
expectedToken: VALID_TOKEN_22,
},
{
label: "space/wiki",
url: `https://example.test/space/wiki/${VALID_TOKEN_22}`,
expectedKind: "wiki",
expectedResolvedType: undefined,
expectedToken: VALID_TOKEN_22,
},
])("$label", ({ url, expectedKind, expectedResolvedType, expectedToken }) => {
const linked = resolveCommentLinkedDocumentFromUrl({ rawUrl: url });
expect(linked.urlKind).toBe(expectedKind);
expect(linked.resolvedObjType).toBe(expectedResolvedType);
expect(linked.resolvedObjToken ?? linked.wikiNodeToken).toBe(expectedToken);
});
it("does not resolve doc-like paths with short tokens", () => {
expect(
resolveCommentLinkedDocumentFromUrl({
rawUrl: "https://www.baidu.com/docx/guide",
}),
).toEqual({
rawUrl: "https://www.baidu.com/docx/guide",
urlKind: "unknown",
});
});
});
describe("parseCommentContentElements", () => {
it("keeps raw external urls in text but excludes unresolved links from structured references", () => {
const parsed = parseCommentContentElements({
elements: [
{
type: "docs_link",
docs_link: { url: `https://bytedance.larkoffice.com/docx/${VALID_TOKEN_27}` },
},
{
type: "text_run",
text_run: { text: " 和 " },
},
{
type: "docs_link",
docs_link: { url: "https://www.baidu.com/docx/guide" },
},
],
});
expect(parsed.plainText).toBe(
`https://bytedance.larkoffice.com/docx/${VALID_TOKEN_27} 和 https://www.baidu.com/docx/guide`,
);
expect(parsed.linkedDocuments).toEqual([
expect.objectContaining({
rawUrl: `https://bytedance.larkoffice.com/docx/${VALID_TOKEN_27}`,
urlKind: "docx",
resolvedObjType: "docx",
resolvedObjToken: VALID_TOKEN_27,
}),
]);
});
});

View File

@@ -5,6 +5,7 @@ import {
normalizeOptionalString,
readStringValue,
} from "openclaw/plugin-sdk/text-runtime";
import { FEISHU_COMMENT_FILE_TYPES, type CommentFileType } from "./comment-target.js";
export function encodeQuery(params: Record<string, string | undefined>): string {
const query = new URLSearchParams();
@@ -28,51 +29,309 @@ export const asRecord = asOptionalRecord;
export const hasNonEmptyString = sharedHasNonEmptyString;
export function extractCommentElementText(element: unknown): string | undefined {
if (!isRecord(element)) {
return undefined;
}
const type = normalizeString(element.type);
if (type === "text_run" && isRecord(element.text_run)) {
return normalizeString(element.text_run.content) || normalizeString(element.text_run.text);
}
if (type === "mention") {
const mention = isRecord(element.mention) ? element.mention : undefined;
const mentionName =
normalizeString(mention?.name) ||
normalizeString(mention?.display_name) ||
normalizeString(element.name);
return mentionName ? `@${mentionName}` : "@mention";
}
if (type === "docs_link") {
const docsLink = isRecord(element.docs_link) ? element.docs_link : undefined;
return (
normalizeString(docsLink?.text) ||
normalizeString(docsLink?.url) ||
normalizeString(element.text) ||
normalizeString(element.url) ||
undefined
);
}
export type ParsedCommentDocumentRef = {
fileType?: CommentFileType;
fileToken?: string;
};
export type ParsedCommentMention = {
userId: string;
displayText: string;
isBotMention: boolean;
};
export type ParsedCommentLinkedDocumentKind =
| CommentFileType
| "wiki"
| "mindnote"
| "bitable"
| "base"
| "unknown";
export type ParsedCommentResolvedDocumentType = Exclude<
ParsedCommentLinkedDocumentKind,
"wiki" | "unknown"
>;
export type ParsedCommentLinkedDocument = {
rawUrl: string;
urlKind: ParsedCommentLinkedDocumentKind;
wikiNodeToken?: string;
resolvedObjType?: ParsedCommentResolvedDocumentType;
resolvedObjToken?: string;
isCurrentDocument?: boolean;
};
export type ParsedCommentContent = {
plainText?: string;
semanticText?: string;
mentions: ParsedCommentMention[];
linkedDocuments: ParsedCommentLinkedDocument[];
botMentioned: boolean;
};
function readDocsLinkUrl(element: Record<string, unknown>): string | undefined {
const docsLink = isRecord(element.docs_link) ? element.docs_link : undefined;
return (
normalizeString(element.text) ||
normalizeString(element.content) ||
normalizeString(element.name) ||
normalizeString(docsLink?.url) ||
normalizeString(docsLink?.link) ||
normalizeString(element.url) ||
normalizeString(element.link) ||
undefined
);
}
function readMentionUserId(element: Record<string, unknown>): string | undefined {
const mention = isRecord(element.mention) ? element.mention : undefined;
const person = isRecord(element.person) ? element.person : undefined;
return (
normalizeString(person?.user_id) ||
normalizeString(mention?.user_id) ||
normalizeString(mention?.open_id) ||
normalizeString(element.mention_user) ||
normalizeString(element.user_id) ||
undefined
);
}
function readMentionDisplayText(element: Record<string, unknown>, userId: string): string {
const mention = isRecord(element.mention) ? element.mention : undefined;
const mentionName =
normalizeString(mention?.name) ||
normalizeString(mention?.display_name) ||
normalizeString(element.name);
return mentionName ? `@${mentionName}` : `@${userId}`;
}
function normalizeCommentText(parts: string[]): string | undefined {
const text = parts.join("").trim();
return text || undefined;
}
function normalizeCommentSemanticText(parts: string[]): string | undefined {
const text = parts.join("").replace(/\s+/g, " ").trim();
return text || undefined;
}
function readElementTextPreservingWhitespace(element: Record<string, unknown>): string | undefined {
return (
(isRecord(element.text_run)
? readString(element.text_run.content) || readString(element.text_run.text)
: undefined) ||
readString(element.text) ||
readString(element.content) ||
readString(element.name) ||
undefined
);
}
const FEISHU_LINK_TOKEN_MIN_LENGTH = 22;
const FEISHU_LINK_TOKEN_MAX_LENGTH = 28;
const COMMENT_LINK_KIND_ALIASES = new Map<string, ParsedCommentResolvedDocumentType | "wiki">([
["doc", "doc"],
["docs", "doc"],
["docx", "docx"],
["sheet", "sheet"],
["sheets", "sheet"],
["slide", "slides"],
["slides", "slides"],
["file", "file"],
["files", "file"],
["wiki", "wiki"],
["mindnote", "mindnote"],
["mindnotes", "mindnote"],
["bitable", "bitable"],
["base", "base"],
]);
function isCommentFileType(
value: ParsedCommentResolvedDocumentType | "wiki" | undefined,
): value is CommentFileType {
return (
typeof value === "string" && (FEISHU_COMMENT_FILE_TYPES as readonly string[]).includes(value)
);
}
function isReasonableFeishuLinkToken(token: string | undefined): token is string {
return (
typeof token === "string" &&
token.length >= FEISHU_LINK_TOKEN_MIN_LENGTH &&
token.length <= FEISHU_LINK_TOKEN_MAX_LENGTH
);
}
function parseCommentLinkedDocumentPath(pathname: string): {
urlKind: ParsedCommentResolvedDocumentType | "wiki";
token: string;
} | null {
const segments = pathname
.split("/")
.map((segment) => segment.trim())
.filter(Boolean);
const offset = segments[0]?.toLowerCase() === "space" ? 1 : 0;
const kind = COMMENT_LINK_KIND_ALIASES.get(segments[offset]?.toLowerCase() ?? "");
const token = normalizeString(segments[offset + 1]);
if (!kind || !isReasonableFeishuLinkToken(token)) {
return null;
}
return { urlKind: kind, token };
}
function hasResolvedLinkedDocumentReference(link: ParsedCommentLinkedDocument): boolean {
return (
link.urlKind !== "unknown" && (Boolean(link.resolvedObjToken) || Boolean(link.wikiNodeToken))
);
}
export function resolveCommentLinkedDocumentFromUrl(params: {
rawUrl: string;
currentDocument?: ParsedCommentDocumentRef;
}): ParsedCommentLinkedDocument {
const link: ParsedCommentLinkedDocument = {
rawUrl: params.rawUrl,
urlKind: "unknown",
};
try {
const parsed = new URL(params.rawUrl);
const parsedPath = parseCommentLinkedDocumentPath(parsed.pathname);
if (!parsedPath) {
return link;
}
const { urlKind, token } = parsedPath;
link.urlKind = urlKind;
if (urlKind === "wiki") {
link.urlKind = "wiki";
link.wikiNodeToken = token;
} else {
link.resolvedObjType = urlKind;
link.resolvedObjToken = token;
}
if (
link.resolvedObjType &&
link.resolvedObjToken &&
isCommentFileType(link.resolvedObjType) &&
params.currentDocument?.fileType === link.resolvedObjType &&
params.currentDocument.fileToken === link.resolvedObjToken
) {
link.isCurrentDocument = true;
} else if (
link.resolvedObjType &&
link.resolvedObjToken &&
isCommentFileType(link.resolvedObjType)
) {
link.isCurrentDocument = false;
}
} catch {
return link;
}
return link;
}
export function parseCommentContentElements(params: {
elements?: unknown[];
botOpenIds?: Iterable<string | undefined>;
currentDocument?: ParsedCommentDocumentRef;
}): ParsedCommentContent {
const elements = Array.isArray(params.elements) ? params.elements : [];
const plainTextParts: string[] = [];
const semanticTextParts: string[] = [];
const mentions: ParsedCommentMention[] = [];
const linkedDocuments: ParsedCommentLinkedDocument[] = [];
const botIds = new Set(
Array.from(params.botOpenIds ?? [])
.map((value) => normalizeString(value))
.filter((value): value is string => Boolean(value)),
);
const linkedDocumentKeys = new Set<string>();
let botMentioned = false;
for (const rawElement of elements) {
if (!isRecord(rawElement)) {
continue;
}
const element = rawElement;
const type = normalizeString(element.type);
const text =
(type === "text_run" ? readElementTextPreservingWhitespace(element) : undefined) ||
(type === "text" ? readElementTextPreservingWhitespace(element) : undefined) ||
(type === "docs_link" || type === "link" ? readDocsLinkUrl(element) : undefined) ||
(type === "mention" || type === "mention_user" || type === "person"
? (() => {
const userId = readMentionUserId(element);
return userId ? readMentionDisplayText(element, userId) : undefined;
})()
: undefined) ||
readElementTextPreservingWhitespace(element) ||
undefined;
if (type === "mention" || type === "mention_user" || type === "person") {
const userId = readMentionUserId(element);
if (userId) {
const displayText = readMentionDisplayText(element, userId);
const isBotMention = botIds.has(userId);
mentions.push({ userId, displayText, isBotMention });
plainTextParts.push(displayText);
if (!isBotMention) {
semanticTextParts.push(displayText);
} else {
botMentioned = true;
}
continue;
}
}
if (type === "docs_link" || type === "link") {
const rawUrl = readDocsLinkUrl(element);
if (rawUrl) {
plainTextParts.push(rawUrl);
semanticTextParts.push(rawUrl);
const linkedDocument = resolveCommentLinkedDocumentFromUrl({
rawUrl,
currentDocument: params.currentDocument,
});
if (hasResolvedLinkedDocumentReference(linkedDocument)) {
const key = [
linkedDocument.rawUrl,
linkedDocument.urlKind,
linkedDocument.resolvedObjType,
linkedDocument.resolvedObjToken,
linkedDocument.wikiNodeToken,
].join(":");
if (!linkedDocumentKeys.has(key)) {
linkedDocumentKeys.add(key);
linkedDocuments.push(linkedDocument);
}
}
continue;
}
}
if (text) {
plainTextParts.push(text);
semanticTextParts.push(text);
}
}
return {
plainText: normalizeCommentText(plainTextParts),
semanticText: normalizeCommentSemanticText(semanticTextParts),
mentions,
linkedDocuments,
botMentioned,
};
}
export function extractCommentElementText(element: unknown): string | undefined {
return parseCommentContentElements({ elements: [element] }).plainText;
}
export function extractReplyText(
reply: { content?: { elements?: unknown[] } } | undefined,
): string | undefined {
if (!reply || !isRecord(reply.content)) {
return undefined;
}
const elements = Array.isArray(reply.content.elements) ? reply.content.elements : [];
const text = elements
.map(extractCommentElementText)
.filter((part): part is string => Boolean(part && part.trim()))
.join("")
.trim();
return text || undefined;
return parseCommentContentElements({
elements: Array.isArray(reply.content.elements) ? reply.content.elements : [],
}).plainText;
}

View File

@@ -4,12 +4,17 @@ import type { OpenClawPluginApi, PluginRuntime } from "../runtime-api.js";
const createFeishuToolClientMock = vi.hoisted(() => vi.fn());
const resolveAnyEnabledFeishuToolsConfigMock = vi.hoisted(() => vi.fn());
const cleanupAmbientCommentTypingReactionMock = vi.hoisted(() => vi.fn(async () => false));
vi.mock("./tool-account.js", () => ({
createFeishuToolClient: createFeishuToolClientMock,
resolveAnyEnabledFeishuToolsConfig: resolveAnyEnabledFeishuToolsConfigMock,
}));
vi.mock("./comment-reaction.js", () => ({
cleanupAmbientCommentTypingReaction: cleanupAmbientCommentTypingReactionMock,
}));
let registerFeishuDriveTools: typeof import("./drive.js").registerFeishuDriveTools;
function createFeishuToolRuntime(): PluginRuntime {
@@ -51,6 +56,7 @@ describe("registerFeishuDriveTools", () => {
createFeishuToolClientMock.mockReturnValue({
request: requestMock,
});
cleanupAmbientCommentTypingReactionMock.mockResolvedValue(false);
});
it("registers feishu_drive and handles comment actions", async () => {
@@ -491,7 +497,7 @@ describe("registerFeishuDriveTools", () => {
);
});
it("defaults reply_comment target fields from the ambient Feishu comment delivery context", async () => {
it("does not wait for ambient typing cleanup before reply_comment sends visible output", async () => {
const registerTool = vi.fn();
registerFeishuDriveTools(
createDriveToolApi({
@@ -515,6 +521,7 @@ describe("registerFeishuDriveTools", () => {
deliveryContext: {
channel: "feishu",
to: "comment:docx:doc_1:c1",
threadId: "reply_ambient_1",
},
});
@@ -530,11 +537,24 @@ describe("registerFeishuDriveTools", () => {
data: { reply_id: "r6" },
});
const replyCommentResult = await tool.execute("call-ambient", {
let resolveCleanup: ((value: boolean) => void) | undefined;
cleanupAmbientCommentTypingReactionMock.mockImplementationOnce(
() =>
new Promise<boolean>((resolve) => {
resolveCleanup = resolve;
}),
);
const replyCommentPromise = tool.execute("call-ambient", {
action: "reply_comment",
content: "ambient success",
});
const status = await Promise.race([
replyCommentPromise.then(() => "done"),
new Promise<string>((resolve) => setTimeout(() => resolve("pending"), 0)),
]);
expect(status).toBe("done");
expect(requestMock).toHaveBeenNthCalledWith(
1,
expect.objectContaining({
@@ -565,9 +585,97 @@ describe("registerFeishuDriveTools", () => {
},
}),
);
expect(cleanupAmbientCommentTypingReactionMock).toHaveBeenCalledWith({
client: expect.anything(),
deliveryContext: {
channel: "feishu",
to: "comment:docx:doc_1:c1",
threadId: "reply_ambient_1",
},
});
const replyCommentResult = await replyCommentPromise;
expect(replyCommentResult.details).toEqual(
expect.objectContaining({ success: true, reply_id: "r6" }),
);
resolveCleanup?.(false);
});
it("does not wait for ambient typing cleanup before add_comment sends visible output", async () => {
const registerTool = vi.fn();
registerFeishuDriveTools(
createDriveToolApi({
config: {
channels: {
feishu: {
enabled: true,
appId: "app_id",
appSecret: "app_secret", // pragma: allowlist secret
tools: { drive: true },
},
},
},
registerTool,
}),
);
const toolFactory = registerTool.mock.calls[0]?.[0];
const tool = toolFactory?.({
agentAccountId: undefined,
deliveryContext: {
channel: "feishu",
to: "comment:docx:doc_1:c1",
threadId: "reply_ambient_1",
},
});
requestMock.mockResolvedValueOnce({
code: 0,
data: { comment_id: "c_add" },
});
let resolveCleanup: ((value: boolean) => void) | undefined;
cleanupAmbientCommentTypingReactionMock.mockImplementationOnce(
() =>
new Promise<boolean>((resolve) => {
resolveCleanup = resolve;
}),
);
const addCommentPromise = tool.execute("call-add-ambient", {
action: "add_comment",
content: "ambient top-level comment",
});
const status = await Promise.race([
addCommentPromise.then(() => "done"),
new Promise<string>((resolve) => setTimeout(() => resolve("pending"), 0)),
]);
expect(status).toBe("done");
expect(requestMock).toHaveBeenCalledWith(
expect.objectContaining({
method: "POST",
url: "/open-apis/drive/v1/files/doc_1/new_comments",
data: {
file_type: "docx",
reply_elements: [{ type: "text", text: "ambient top-level comment" }],
},
}),
);
expect(cleanupAmbientCommentTypingReactionMock).toHaveBeenCalledWith({
client: expect.anything(),
deliveryContext: {
channel: "feishu",
to: "comment:docx:doc_1:c1",
threadId: "reply_ambient_1",
},
});
const addCommentResult = await addCommentPromise;
expect(addCommentResult.details).toEqual(
expect.objectContaining({ success: true, comment_id: "c_add" }),
);
resolveCleanup?.(false);
});
it("does not inherit non-doc ambient file types for add_comment", async () => {

View File

@@ -2,6 +2,7 @@ import type * as Lark from "@larksuiteoapi/node-sdk";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import type { OpenClawPluginApi } from "../runtime-api.js";
import { listEnabledFeishuAccounts } from "./accounts.js";
import { cleanupAmbientCommentTypingReaction } from "./comment-reaction.js";
import { encodeQuery, extractReplyText, isRecord, readString } from "./comment-shared.js";
import { parseFeishuCommentTarget, type CommentFileType } from "./comment-target.js";
import { FeishuDriveSchema, type FeishuDriveParams } from "./drive-schema.js";
@@ -104,6 +105,7 @@ type FeishuDriveToolContext = {
deliveryContext?: {
channel?: string;
to?: string;
threadId?: string | number;
};
};
@@ -808,14 +810,28 @@ export function registerFeishuDriveTools(api: OpenClawPluginApi) {
}
case "add_comment": {
const resolved = applyAddCommentDefaults(applyAddCommentAmbientDefaults(p, ctx));
return jsonToolResult(await addComment(client, resolved));
try {
return jsonToolResult(await addComment(client, resolved));
} finally {
void cleanupAmbientCommentTypingReaction({
client: getDriveInternalClient(client),
deliveryContext: ctx.deliveryContext,
});
}
}
case "reply_comment": {
const resolved = applyCommentFileTypeDefault(
applyAmbientCommentDefaults(p, ctx),
"reply_comment",
);
return jsonToolResult(await deliverCommentThreadText(client, resolved));
try {
return jsonToolResult(await deliverCommentThreadText(client, resolved));
} finally {
void cleanupAmbientCommentTypingReaction({
client: getDriveInternalClient(client),
deliveryContext: ctx.deliveryContext,
});
}
}
default:
return unknownToolActionResult((p as { action?: unknown }).action);

View File

@@ -292,6 +292,16 @@ function parseFeishuCardActionEventPayload(value: unknown): FeishuCardActionEven
};
}
function buildCommentNoticeQueueKey(event: {
notice_meta?: {
file_type?: string;
file_token?: string;
};
}): string {
const fileType = event.notice_meta?.file_type?.trim() || "unknown";
const fileToken = event.notice_meta?.file_token?.trim() || "unknown";
return `comment-doc:${fileType}:${fileToken}`;
}
function mergeFeishuDebounceMentions(
entries: FeishuMessageEvent[],
): FeishuMessageEvent["message"]["mentions"] | undefined {
@@ -619,12 +629,14 @@ function registerEventHandlers(
`mentioned=${event.is_mentioned === true ? "yes" : "no"}`,
);
try {
await handleFeishuCommentEvent({
cfg,
accountId,
event,
botOpenId: botOpenIds.get(accountId),
runtime,
await enqueue(buildCommentNoticeQueueKey(event), async () => {
await handleFeishuCommentEvent({
cfg,
accountId,
event,
botOpenId: botOpenIds.get(accountId),
runtime,
});
});
if (syntheticMessageId) {
await recordProcessedFeishuMessage(syntheticMessageId, accountId, log);

View File

@@ -23,7 +23,8 @@ const monitorWebhookMock = vi.hoisted(() => vi.fn(async () => {}));
const createFeishuThreadBindingManagerMock = vi.hoisted(() => vi.fn(() => ({ stop: vi.fn() })));
let handlers: Record<string, (data: unknown) => Promise<void>> = {};
const TEST_DOC_TOKEN = "doxxxxxxx";
const TEST_DOC_TOKEN = "ZsJfdxrBFo0RwuxteOLc1Ekvneb";
const TEST_WIKI_TOKEN = "OtYpd5pKOoMeQzxrzkocv9KIn4H";
vi.mock("./client.js", () => ({
createEventDispatcher: createEventDispatcherMock,
@@ -287,19 +288,127 @@ describe("resolveDriveCommentEventTurn", () => {
expect(turn?.messageId).toBe("drive-comment:10d9d60b990db39f96a4c2fd357fb877");
expect(turn?.fileType).toBe("docx");
expect(turn?.fileToken).toBe(TEST_DOC_TOKEN);
expect(turn?.prompt).toContain('The user added a comment in "Comment event handling request".');
expect(turn?.prompt).toContain(
'The user added a comment in "Comment event handling request": Also send it to the agent after receiving the comment event',
'Current user comment text: "Also send it to the agent after receiving the comment event"',
);
expect(turn?.prompt).toContain(
"This is a Feishu document comment-thread event, not a Feishu IM conversation.",
);
expect(turn?.prompt).toContain("Prefer plain text suitable for a comment thread.");
expect(turn?.prompt).toContain("Do not include internal reasoning");
expect(turn?.prompt).toContain("Do not narrate your plan or execution process");
expect(turn?.prompt).toContain("reply only with the user-facing result itself");
expect(turn?.prompt).toContain("Current comment card timeline (primary context");
expect(turn?.prompt).toContain("This is a Feishu document comment thread.");
expect(turn?.prompt).toContain("It is not a Feishu IM chat.");
expect(turn?.prompt).toContain("Use plain text only.");
expect(turn?.prompt).toContain("Do not show reasoning.");
expect(turn?.prompt).toContain("Do not describe your plan.");
expect(turn?.prompt).toContain("Output only the final user-facing reply.");
expect(turn?.prompt).toContain("comment_id: 7623358762119646411");
expect(turn?.prompt).toContain("reply_id: 7623358762136374451");
expect(turn?.prompt).toContain("The system will automatically reply with your final answer");
expect(turn?.prompt).toContain(
"Your final text reply will be posted to the current comment thread automatically.",
);
});
it("parses bot mentions plus current and referenced document links from comment content", async () => {
const wikiGetNode = vi.fn(async () => ({
code: 0,
data: {
node: {
obj_type: "docx",
obj_token: "doc_ref_1",
},
},
}));
const client = {
request: vi.fn(async (request: { method: "GET" | "POST"; url: string; data: unknown }) => {
if (request.url === "/open-apis/drive/v1/metas/batch_query") {
return {
code: 0,
data: {
metas: [
{
doc_token: TEST_DOC_TOKEN,
title: "Comment event handling request",
url: `https://www.larksuite.com/docx/${TEST_DOC_TOKEN}`,
},
],
},
};
}
if (request.url.includes("/comments/batch_query")) {
return {
code: 0,
data: {
items: [
{
comment_id: "7623358762119646411",
is_whole: false,
reply_list: {
replies: [
{
reply_id: "7623358762136374451",
user_id: "ou_509d4d7ace4a9addec2312676ffcba9b",
content: {
elements: [
{ type: "text_run", text_run: { text: "请 " } },
{ type: "person", person: { user_id: "ou_bot" } },
{ type: "text_run", text_run: { text: " 总结下 " } },
{
type: "docs_link",
docs_link: {
url: `https://www.larksuite.com/docx/${TEST_DOC_TOKEN}`,
},
},
{ type: "text_run", text_run: { text: " 和 " } },
{
type: "docs_link",
docs_link: {
url: `https://www.larksuite.com/wiki/${TEST_WIKI_TOKEN}`,
},
},
],
},
},
],
},
},
],
},
};
}
throw new Error(`unexpected request: ${request.method} ${request.url}`);
}),
wiki: {
space: {
getNode: wikiGetNode,
},
},
};
const turn = await resolveDriveCommentEventTurn({
cfg: buildMonitorConfig(),
accountId: "default",
event: makeDriveCommentEvent(),
botOpenId: "ou_bot",
createClient: () => client as never,
});
expect(turn?.targetReplyText).toBe(
`请 总结下 https://www.larksuite.com/docx/${TEST_DOC_TOKEN} 和 https://www.larksuite.com/wiki/${TEST_WIKI_TOKEN}`,
);
expect(turn?.prompt).toContain("Bot routing mention detected in the current user comment.");
expect(turn?.prompt).toContain("Referenced documents from current user comment:");
expect(turn?.prompt).toContain(
`raw_url=https://www.larksuite.com/docx/${TEST_DOC_TOKEN} url_kind=docx`,
);
expect(turn?.prompt).toContain("same_as_current_document=yes");
expect(turn?.prompt).toContain(
`raw_url=https://www.larksuite.com/wiki/${TEST_WIKI_TOKEN} url_kind=wiki ` +
`wiki_node_token=${TEST_WIKI_TOKEN} resolved_type=docx ` +
"resolved_token=doc_ref_1 same_as_current_document=no",
);
expect(wikiGetNode).toHaveBeenCalledWith({
params: {
token: TEST_WIKI_TOKEN,
},
});
});
it("preserves whole-document comment metadata for downstream delivery mode selection", async () => {
@@ -321,6 +430,277 @@ describe("resolveDriveCommentEventTurn", () => {
expect(turn?.prompt).toContain("Whole-document comments do not support direct replies.");
});
it("builds a whole-comment timeline and highlights the nearest bot-authored follow-up", async () => {
const client = {
request: vi.fn(async (request: { method: "GET" | "POST"; url: string; data: unknown }) => {
if (request.url === "/open-apis/drive/v1/metas/batch_query") {
return {
code: 0,
data: {
metas: [
{
doc_token: TEST_DOC_TOKEN,
title: "Comment event handling request",
url: `https://www.larksuite.com/docx/${TEST_DOC_TOKEN}`,
},
],
},
};
}
if (request.url.includes("/comments/batch_query")) {
return {
code: 0,
data: {
items: [
{
comment_id: "7623358762119646411",
is_whole: true,
reply_list: {
replies: [
{
reply_id: "7623358762136374451",
user_id: "ou_509d4d7ace4a9addec2312676ffcba9b",
create_time: 1775531531,
content: {
elements: [
{
type: "text_run",
text_run: {
text: "请帮我总结这个文档",
},
},
],
},
},
],
},
},
],
},
};
}
if (request.url.includes("/comments?file_type=docx&is_whole=true")) {
return {
code: 0,
data: {
has_more: false,
items: [
{
comment_id: "7623358762119646411",
create_time: 1775531531,
user_id: "ou_509d4d7ace4a9addec2312676ffcba9b",
is_whole: true,
reply_list: {
replies: [
{
reply_id: "reply_a",
user_id: "ou_509d4d7ace4a9addec2312676ffcba9b",
create_time: 1775531531,
content: {
elements: [
{
type: "text_run",
text_run: {
text: "请帮我总结这个文档",
},
},
],
},
},
],
},
},
{
comment_id: "comment_bot_followup",
create_time: 1775531540,
user_id: "ou_bot",
is_whole: true,
reply_list: {
replies: [
{
reply_id: "reply_b",
user_id: "ou_bot",
create_time: 1775531540,
content: {
elements: [
{
type: "text_run",
text_run: {
text: "这是刚才的总结结果",
},
},
],
},
},
],
},
},
{
comment_id: "comment_other_user",
create_time: 1775531550,
user_id: "ou_other",
is_whole: true,
reply_list: {
replies: [
{
reply_id: "reply_c",
user_id: "ou_other",
create_time: 1775531550,
content: {
elements: [
{
type: "text_run",
text_run: {
text: "另一个 whole comment",
},
},
],
},
},
],
},
},
],
},
};
}
throw new Error(`unexpected request: ${request.method} ${request.url}`);
}),
wiki: {
space: {
getNode: vi.fn(async () => ({ code: 0, data: { node: {} } })),
},
},
};
const turn = await resolveDriveCommentEventTurn({
cfg: buildMonitorConfig(),
accountId: "default",
event: makeDriveCommentEvent(),
botOpenId: "ou_bot",
createClient: () => client as never,
});
expect(turn?.isWholeComment).toBe(true);
expect(turn?.prompt).toContain(
"Whole-document comment timeline (primary context for whole-comment follow-ups):",
);
expect(turn?.prompt).toContain("comment_id=7623358762119646411");
expect(turn?.prompt).toContain("comment_id=comment_bot_followup");
expect(turn?.prompt).toContain(
'Nearest bot-authored whole-comment after the current comment: comment_id=comment_bot_followup text="这是刚才的总结结果"',
);
expect(turn?.prompt).toContain("Document-level session history is auxiliary background only.");
});
it("treats replies with missing user_id as user-authored even when bot id hints are missing", async () => {
const client = {
request: vi.fn(async (request: { method: "GET" | "POST"; url: string; data: unknown }) => {
if (request.url === "/open-apis/drive/v1/metas/batch_query") {
return {
code: 0,
data: {
metas: [
{
doc_token: TEST_DOC_TOKEN,
title: "Comment event handling request",
url: `https://www.larksuite.com/docx/${TEST_DOC_TOKEN}`,
},
],
},
};
}
if (request.url.includes("/comments/batch_query")) {
return {
code: 0,
data: {
items: [
{
comment_id: "7623358762119646411",
is_whole: true,
reply_list: {
replies: [
{
reply_id: "reply_missing_user",
create_time: 1775531531,
content: {
elements: [
{
type: "text_run",
text_run: {
text: "reply without user id",
},
},
],
},
},
],
},
},
],
},
};
}
if (request.url.includes("/comments?file_type=docx&is_whole=true")) {
return {
code: 0,
data: {
has_more: false,
items: [
{
comment_id: "7623358762119646411",
create_time: 1775531531,
is_whole: true,
reply_list: {
replies: [
{
reply_id: "reply_missing_user",
create_time: 1775531531,
content: {
elements: [
{
type: "text_run",
text_run: {
text: "reply without user id",
},
},
],
},
},
],
},
},
],
},
};
}
throw new Error(`unexpected request: ${request.method} ${request.url}`);
}),
wiki: {
space: {
getNode: vi.fn(async () => ({ code: 0, data: { node: {} } })),
},
},
};
const turn = await resolveDriveCommentEventTurn({
cfg: buildMonitorConfig(),
accountId: "default",
event: makeDriveCommentEvent({
reply_id: "reply_missing_user",
}),
botOpenId: "ou_bot",
createClient: () => client as never,
});
expect(turn?.prompt).toContain(
"comment_id=7623358762119646411 author=user user_id=UNKNOWN current_comment=yes",
);
expect(turn?.prompt).not.toContain(
"author=assistant user_id=UNKNOWN reply_id=reply_missing_user",
);
});
it("does not trust whole-comment metadata from a mismatched batch_query item", async () => {
const client = makeOpenApiClient({
includeTargetReplyInBatch: true,
@@ -383,11 +763,10 @@ describe("resolveDriveCommentEventTurn", () => {
createClient: () => client as never,
});
expect(turn?.prompt).toContain('The user added a reply in "Comment event handling request".');
expect(turn?.prompt).toContain('Current user comment text: "Please follow up on this comment"');
expect(turn?.prompt).toContain(
'The user added a reply in "Comment event handling request": Please follow up on this comment',
);
expect(turn?.prompt).toContain(
"Original comment: Also send it to the agent after receiving the comment event",
'Original comment text: "Also send it to the agent after receiving the comment event"',
);
expect(turn?.prompt).toContain(`file_token: ${TEST_DOC_TOKEN}`);
expect(turn?.prompt).toContain("Event type: add_reply");
@@ -525,6 +904,52 @@ describe("drive.notice.comment_add_v1 monitor handler", () => {
);
});
it("serializes same-document comment notices before invoking handleFeishuCommentEvent", async () => {
const onComment = await setupCommentMonitorHandler();
let resolveFirst: (() => void) | undefined;
handleFeishuCommentEventMock
.mockImplementationOnce(
() =>
new Promise<void>((resolve) => {
resolveFirst = resolve;
}),
)
.mockImplementationOnce(async () => {});
await onComment(
makeDriveCommentEvent({
event_id: "evt_1",
reply_id: "reply_1",
}),
);
await new Promise((resolve) => setTimeout(resolve, 0));
await onComment(
makeDriveCommentEvent({
event_id: "evt_2",
reply_id: "reply_2",
}),
);
await new Promise((resolve) => setTimeout(resolve, 0));
expect(handleFeishuCommentEventMock).toHaveBeenCalledTimes(1);
resolveFirst?.();
await new Promise((resolve) => setTimeout(resolve, 0));
expect(handleFeishuCommentEventMock).toHaveBeenCalledTimes(2);
const firstCallArgs = handleFeishuCommentEventMock.mock.calls.at(0) as
| [{ event?: { event_id?: string } }]
| undefined;
const secondCallArgs = handleFeishuCommentEventMock.mock.calls.at(1) as
| [{ event?: { event_id?: string } }]
| undefined;
const firstCall = firstCallArgs?.[0];
const secondCall = secondCallArgs?.[0];
expect(firstCall?.event?.event_id).toBe("evt_1");
expect(secondCall?.event?.event_id).toBe("evt_2");
});
it("drops duplicate comment events before dispatch", async () => {
vi.spyOn(dedup, "hasProcessedFeishuMessage").mockResolvedValue(true);
const onComment = await setupCommentMonitorHandler();

View File

@@ -8,16 +8,24 @@ import {
extractReplyText,
isRecord,
normalizeString,
parseCommentContentElements,
type ParsedCommentContent,
type ParsedCommentLinkedDocument,
readString,
} from "./comment-shared.js";
import { normalizeCommentFileType, type CommentFileType } from "./comment-target.js";
import type { ResolvedFeishuAccount } from "./types.js";
const FEISHU_COMMENT_VERIFY_TIMEOUT_MS = 3_000;
const FEISHU_COMMENT_LIST_PAGE_SIZE = 100;
const FEISHU_COMMENT_LIST_PAGE_LIMIT = 5;
const FEISHU_COMMENT_REPLY_PAGE_SIZE = 100;
const FEISHU_COMMENT_REPLY_PAGE_LIMIT = 5;
const FEISHU_COMMENT_REPLY_MISS_RETRY_DELAY_MS = 1_000;
const FEISHU_COMMENT_REPLY_MISS_RETRY_LIMIT = 6;
const FEISHU_COMMENT_THREAD_PROMPT_LIMIT = 20;
const FEISHU_WHOLE_COMMENT_PROMPT_LIMIT = 12;
const FEISHU_PROMPT_TEXT_LIMIT = 220;
type FeishuDriveCommentUserId = {
open_id?: string;
@@ -100,6 +108,9 @@ type FeishuDriveMetaBatchQueryResponse = FeishuOpenApiResponse<{
type FeishuDriveCommentReply = {
reply_id?: string;
user_id?: string;
create_time?: number;
update_time?: number;
content?: {
elements?: unknown[];
};
@@ -107,7 +118,12 @@ type FeishuDriveCommentReply = {
type FeishuDriveCommentCard = {
comment_id?: string;
user_id?: string;
create_time?: number;
update_time?: number;
is_whole?: boolean;
has_more?: boolean;
page_token?: string;
quote?: string;
reply_list?: {
replies?: FeishuDriveCommentReply[];
@@ -118,12 +134,35 @@ type FeishuDriveCommentBatchQueryResponse = FeishuOpenApiResponse<{
items?: FeishuDriveCommentCard[];
}>;
type FeishuDriveCommentListResponse = FeishuOpenApiResponse<{
has_more?: boolean;
items?: FeishuDriveCommentCard[];
page_token?: string;
}>;
type FeishuDriveCommentRepliesListResponse = FeishuOpenApiResponse<{
has_more?: boolean;
items?: FeishuDriveCommentReply[];
page_token?: string;
}>;
type ResolvedCommentReplyContext = {
replyId?: string;
userId?: string;
createTime?: number;
isBotAuthored: boolean;
content: ParsedCommentContent;
};
type ResolvedWholeCommentTimelineEntry = {
commentId: string;
userId?: string;
createTime?: number;
isCurrentComment: boolean;
isBotAuthored: boolean;
content: ParsedCommentContent;
};
function readBoolean(value: unknown): boolean | undefined {
return typeof value === "boolean" ? value : undefined;
}
@@ -138,6 +177,96 @@ function safeJsonStringify(value: unknown): string {
}
}
function truncatePromptText(
text: string | undefined,
maxLength = FEISHU_PROMPT_TEXT_LIMIT,
): string {
const normalized = normalizeString(text);
if (!normalized) {
return "";
}
return normalized.length > maxLength ? `${normalized.slice(0, maxLength - 1)}` : normalized;
}
function formatPromptTextValue(text: string | undefined): string {
return safeJsonStringify(truncatePromptText(text) || "");
}
function formatPromptBoolean(value: boolean | undefined): string {
return value === true ? "yes" : "no";
}
function buildDriveCommentsListUrl(params: {
fileToken: string;
fileType: CommentFileType;
pageToken?: string;
isWholeOnly?: boolean;
}): string {
return (
`/open-apis/drive/v1/files/${encodeURIComponent(params.fileToken)}/comments` +
encodeQuery({
file_type: params.fileType,
is_whole: params.isWholeOnly === true ? "true" : undefined,
page_size: String(FEISHU_COMMENT_LIST_PAGE_SIZE),
page_token: params.pageToken,
user_id_type: "open_id",
})
);
}
function compareCommentTimelineEntries(
left: { createTime?: number; stableId?: string },
right: { createTime?: number; stableId?: string },
): number {
const leftTime = left.createTime ?? Number.MAX_SAFE_INTEGER;
const rightTime = right.createTime ?? Number.MAX_SAFE_INTEGER;
if (leftTime !== rightTime) {
return leftTime - rightTime;
}
return (left.stableId ?? "").localeCompare(right.stableId ?? "");
}
function formatLinkedDocumentInline(link: ParsedCommentLinkedDocument): string {
const parts = [
`raw_url=${link.rawUrl}`,
`url_kind=${link.urlKind}`,
link.wikiNodeToken ? `wiki_node_token=${link.wikiNodeToken}` : null,
`resolved_type=${link.resolvedObjType ?? "UNKNOWN"}`,
`resolved_token=${link.resolvedObjToken ?? "UNKNOWN"}`,
`same_as_current_document=${formatPromptBoolean(link.isCurrentDocument)}`,
].filter((part): part is string => Boolean(part));
return parts.join(" ");
}
function formatLinkedDocumentsPromptLines(params: {
title: string;
linkedDocuments: ParsedCommentLinkedDocument[];
}): string[] {
if (params.linkedDocuments.length === 0) {
return [];
}
return [
params.title,
...params.linkedDocuments.map(
(link, index) => `- [${index + 1}] ${formatLinkedDocumentInline(link)}`,
),
];
}
function formatLinkedDocumentsInlineSummary(
linkedDocuments: ParsedCommentLinkedDocument[],
): string {
if (linkedDocuments.length === 0) {
return "none";
}
return linkedDocuments
.map(
(link) =>
`${link.resolvedObjType ?? link.urlKind}:${link.resolvedObjToken ?? link.wikiNodeToken ?? "UNKNOWN"}`,
)
.join(",");
}
function summarizeCommentRepliesForLog(replies: FeishuDriveCommentReply[]): string {
return safeJsonStringify(
replies.map((reply) => ({
@@ -147,6 +276,93 @@ function summarizeCommentRepliesForLog(replies: FeishuDriveCommentReply[]): stri
);
}
async function resolveParsedCommentContent(params: {
elements?: unknown[];
botOpenIds?: Iterable<string | undefined>;
currentDocument: {
fileType: CommentFileType;
fileToken: string;
};
client: FeishuRequestClient;
wikiCache: Map<
string,
Promise<{
resolvedObjType?: CommentFileType;
resolvedObjToken?: string;
} | null>
>;
logger?: (message: string) => void;
accountId: string;
}): Promise<ParsedCommentContent> {
const parsed = parseCommentContentElements({
elements: params.elements,
botOpenIds: params.botOpenIds,
currentDocument: params.currentDocument,
});
if (!parsed.linkedDocuments.some((link) => link.urlKind === "wiki" && link.wikiNodeToken)) {
return parsed;
}
const resolvedLinkedDocuments = await Promise.all(
parsed.linkedDocuments.map(async (link) => {
if (link.urlKind !== "wiki" || !link.wikiNodeToken) {
return link;
}
let pending = params.wikiCache.get(link.wikiNodeToken);
if (!pending) {
pending = params.client.wiki.space
.getNode({
params: {
token: link.wikiNodeToken,
},
})
.then((response) => {
if (response.code !== 0) {
params.logger?.(
`feishu[${params.accountId}]: wiki link resolution failed token=${link.wikiNodeToken} ` +
`code=${response.code ?? "unknown"} msg=${response.msg ?? "unknown"}`,
);
return null;
}
const objType = normalizeCommentFileType(response.data?.node?.obj_type);
const objToken = normalizeString(response.data?.node?.obj_token);
if (!objType || !objToken) {
return null;
}
return {
resolvedObjType: objType,
resolvedObjToken: objToken,
};
})
.catch((error) => {
params.logger?.(
`feishu[${params.accountId}]: wiki link resolution threw token=${link.wikiNodeToken} error=${formatErrorMessage(error)}`,
);
return null;
});
params.wikiCache.set(link.wikiNodeToken, pending);
}
const resolved = await pending;
if (!resolved) {
return link;
}
return {
...link,
resolvedObjType: resolved.resolvedObjType,
resolvedObjToken: resolved.resolvedObjToken,
isCurrentDocument:
resolved.resolvedObjType === params.currentDocument.fileType &&
resolved.resolvedObjToken === params.currentDocument.fileToken,
};
}),
);
return {
...parsed,
linkedDocuments: resolvedLinkedDocuments,
};
}
async function delayMs(ms: number): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, ms));
}
@@ -183,6 +399,49 @@ function buildDriveCommentRepliesUrl(params: {
);
}
async function fetchDriveComments(params: {
client: FeishuRequestClient;
fileToken: string;
fileType: CommentFileType;
isWholeOnly?: boolean;
timeoutMs: number;
logger?: (message: string) => void;
accountId: string;
}): Promise<FeishuDriveCommentCard[]> {
const comments: FeishuDriveCommentCard[] = [];
let pageToken: string | undefined;
for (let page = 0; page < FEISHU_COMMENT_LIST_PAGE_LIMIT; page += 1) {
const response = await requestFeishuOpenApi<FeishuDriveCommentListResponse>({
client: params.client,
method: "GET",
url: buildDriveCommentsListUrl({
fileToken: params.fileToken,
fileType: params.fileType,
isWholeOnly: params.isWholeOnly,
pageToken,
}),
timeoutMs: params.timeoutMs,
logger: params.logger,
errorLabel: `feishu[${params.accountId}]: failed to list drive comments for ${params.fileToken}`,
});
if (response?.code !== 0) {
if (response) {
params.logger?.(
`feishu[${params.accountId}]: failed to list drive comments for ${params.fileToken}: ` +
`${response.msg ?? "unknown error"} log_id=${response.log_id?.trim() || "unknown"}`,
);
}
break;
}
comments.push(...(response.data?.items ?? []));
if (response.data?.has_more !== true || !response.data.page_token?.trim()) {
break;
}
pageToken = response.data.page_token.trim();
}
return comments;
}
async function requestFeishuOpenApi<T>(params: {
client: FeishuRequestClient;
method: "GET" | "POST";
@@ -285,12 +544,189 @@ async function fetchDriveCommentReplies(params: {
return { replies, logIds };
}
async function resolveCommentReplyContext(params: {
reply: FeishuDriveCommentReply;
botOpenIds?: Iterable<string | undefined>;
currentDocument: {
fileType: CommentFileType;
fileToken: string;
};
client: FeishuRequestClient;
wikiCache: Map<
string,
Promise<{
resolvedObjType?: CommentFileType;
resolvedObjToken?: string;
} | null>
>;
logger?: (message: string) => void;
accountId: string;
}): Promise<ResolvedCommentReplyContext> {
const userId = normalizeString(params.reply.user_id);
const normalizedBotOpenIds = new Set(
Array.from(params.botOpenIds ?? [])
.map((botId) => normalizeString(botId))
.filter((botId): botId is string => Boolean(botId)),
);
return {
replyId: normalizeString(params.reply.reply_id),
userId,
createTime: typeof params.reply.create_time === "number" ? params.reply.create_time : undefined,
isBotAuthored: typeof userId === "string" && normalizedBotOpenIds.has(userId),
content: await resolveParsedCommentContent({
elements: isRecord(params.reply.content) ? params.reply.content.elements : undefined,
botOpenIds: params.botOpenIds,
currentDocument: params.currentDocument,
client: params.client,
wikiCache: params.wikiCache,
logger: params.logger,
accountId: params.accountId,
}),
};
}
function selectCommentThreadPromptReplies(
replies: ResolvedCommentReplyContext[],
targetReplyId?: string,
): ResolvedCommentReplyContext[] {
if (replies.length <= FEISHU_COMMENT_THREAD_PROMPT_LIMIT) {
return replies;
}
const targetIndex = replies.findIndex((reply) => reply.replyId === targetReplyId);
const currentIndex = targetIndex >= 0 ? targetIndex : replies.length - 1;
const selected = new Set<number>([0, currentIndex, replies.length - 1]);
for (let radius = 1; selected.size < FEISHU_COMMENT_THREAD_PROMPT_LIMIT; radius += 1) {
const before = currentIndex - radius;
const after = currentIndex + radius;
if (before >= 0) {
selected.add(before);
}
if (selected.size >= FEISHU_COMMENT_THREAD_PROMPT_LIMIT) {
break;
}
if (after < replies.length) {
selected.add(after);
}
if (before < 0 && after >= replies.length) {
break;
}
}
return [...selected]
.toSorted((left, right) => left - right)
.map((index) => replies[index])
.filter((reply): reply is ResolvedCommentReplyContext => Boolean(reply));
}
function formatCommentThreadPromptLines(params: {
replies: ResolvedCommentReplyContext[];
targetReplyId?: string;
}): string[] {
const promptReplies = selectCommentThreadPromptReplies(params.replies, params.targetReplyId);
return promptReplies.map((reply, index) => {
const text = reply.content.semanticText ?? reply.content.plainText;
return (
`- [${index + 1}] author=${reply.isBotAuthored ? "assistant" : "user"} ` +
`user_id=${reply.userId ?? "UNKNOWN"} ` +
`reply_id=${reply.replyId ?? "UNKNOWN"} ` +
`current_event=${reply.replyId === params.targetReplyId ? "yes" : "no"} ` +
`text=${formatPromptTextValue(text)} ` +
`referenced_docs=${formatLinkedDocumentsInlineSummary(reply.content.linkedDocuments)}`
);
});
}
function findNearestBotTimelineEntry(params: {
entries: ResolvedWholeCommentTimelineEntry[];
currentIndex: number;
direction: "before" | "after";
}): ResolvedWholeCommentTimelineEntry | undefined {
const step = params.direction === "after" ? 1 : -1;
for (
let index = params.currentIndex + step;
index >= 0 && index < params.entries.length;
index += step
) {
const candidate = params.entries[index];
if (candidate?.isBotAuthored) {
return candidate;
}
}
return undefined;
}
function selectWholeCommentTimelineEntries(params: {
entries: ResolvedWholeCommentTimelineEntry[];
currentCommentId: string;
}): ResolvedWholeCommentTimelineEntry[] {
if (params.entries.length <= FEISHU_WHOLE_COMMENT_PROMPT_LIMIT) {
return params.entries;
}
const currentIndex = params.entries.findIndex(
(entry) => entry.commentId === params.currentCommentId,
);
if (currentIndex < 0) {
return params.entries.slice(-FEISHU_WHOLE_COMMENT_PROMPT_LIMIT);
}
const selected = new Set<number>([currentIndex]);
const nearestBotAfter = params.entries.findIndex(
(entry, index) => index > currentIndex && entry.isBotAuthored,
);
if (nearestBotAfter >= 0) {
selected.add(nearestBotAfter);
}
for (let index = currentIndex - 1; index >= 0; index -= 1) {
if (params.entries[index]?.isBotAuthored) {
selected.add(index);
break;
}
}
for (let radius = 1; selected.size < FEISHU_WHOLE_COMMENT_PROMPT_LIMIT; radius += 1) {
const before = currentIndex - radius;
const after = currentIndex + radius;
if (before >= 0) {
selected.add(before);
}
if (selected.size >= FEISHU_WHOLE_COMMENT_PROMPT_LIMIT) {
break;
}
if (after < params.entries.length) {
selected.add(after);
}
if (before < 0 && after >= params.entries.length) {
break;
}
}
return [...selected]
.toSorted((left, right) => left - right)
.map((index) => params.entries[index])
.filter((entry): entry is ResolvedWholeCommentTimelineEntry => Boolean(entry));
}
function formatWholeCommentTimelinePromptLines(params: {
entries: ResolvedWholeCommentTimelineEntry[];
currentCommentId: string;
}): string[] {
return selectWholeCommentTimelineEntries(params).map((entry, index) => {
const text = entry.content.semanticText ?? entry.content.plainText;
return (
`- [${index + 1}] create_time=${entry.createTime ?? "UNKNOWN"} ` +
`comment_id=${entry.commentId} ` +
`author=${entry.isBotAuthored ? "assistant" : "user"} ` +
`user_id=${entry.userId ?? "UNKNOWN"} ` +
`current_comment=${entry.commentId === params.currentCommentId ? "yes" : "no"} ` +
`text=${formatPromptTextValue(text)} ` +
`referenced_docs=${formatLinkedDocumentsInlineSummary(entry.content.linkedDocuments)}`
);
});
}
async function fetchDriveCommentContext(params: {
client: FeishuRequestClient;
fileToken: string;
fileType: CommentFileType;
commentId: string;
replyId?: string;
botOpenIds?: Iterable<string | undefined>;
timeoutMs: number;
logger?: (message: string) => void;
accountId: string;
@@ -302,6 +738,12 @@ async function fetchDriveCommentContext(params: {
quoteText?: string;
rootCommentText?: string;
targetReplyText?: string;
rootCommentContent?: ParsedCommentContent;
targetReplyContent?: ParsedCommentContent;
currentCommentThreadReplies: ResolvedCommentReplyContext[];
wholeCommentTimeline: ResolvedWholeCommentTimelineEntry[];
nearestBotWholeCommentAfter?: ResolvedWholeCommentTimelineEntry;
nearestBotWholeCommentBefore?: ResolvedWholeCommentTimelineEntry;
}> {
const [metaResponse, commentResponse] = await Promise.all([
requestFeishuOpenApi<FeishuDriveMetaBatchQueryResponse>({
@@ -331,6 +773,13 @@ async function fetchDriveCommentContext(params: {
errorLabel: `feishu[${params.accountId}]: failed to fetch drive comment ${params.commentId}`,
}),
]);
const wikiCache = new Map<
string,
Promise<{
resolvedObjType?: CommentFileType;
resolvedObjToken?: string;
} | null>
>();
const commentCard =
commentResponse?.code === 0
@@ -351,12 +800,15 @@ async function fetchDriveCommentContext(params: {
let fetchedMatchedReply = params.replyId
? replies.find((reply) => reply.reply_id?.trim() === params.replyId?.trim())
: undefined;
if (!embeddedTargetReply || replies.length === 0) {
const needsExtraReplies =
!embeddedTargetReply || replies.length === 0 || commentCard?.has_more === true;
if (needsExtraReplies) {
params.logger?.(
`feishu[${params.accountId}]: fetching extra comment replies comment=${params.commentId} ` +
`requested_reply=${params.replyId ?? "none"} ` +
`embedded_count=${embeddedReplies.length} ` +
`embedded_hit=${embeddedTargetReply ? "yes" : "no"}`,
`embedded_hit=${embeddedTargetReply ? "yes" : "no"} ` +
`embedded_has_more=${commentCard?.has_more === true ? "yes" : "no"}`,
);
const fetched = await fetchDriveCommentReplies(params);
if (fetched.replies.length > 0) {
@@ -419,14 +871,137 @@ async function fetchDriveCommentContext(params: {
`target=${safeJsonStringify({ reply_id: targetReply?.reply_id, text_len: extractReplyText(targetReply)?.length ?? 0 })}`,
);
const meta = metaResponse?.code === 0 ? metaResponse.data?.metas?.[0] : undefined;
const currentDocument = {
fileType: params.fileType,
fileToken: params.fileToken,
};
const resolvedReplies = await Promise.all(
replies.map((reply) =>
resolveCommentReplyContext({
reply,
botOpenIds: params.botOpenIds,
currentDocument,
client: params.client,
wikiCache,
logger: params.logger,
accountId: params.accountId,
}),
),
);
resolvedReplies.sort((left, right) =>
compareCommentTimelineEntries(
{
createTime: left.createTime,
stableId: left.replyId,
},
{
createTime: right.createTime,
stableId: right.replyId,
},
),
);
const rootReplyContext =
resolvedReplies.find((reply) => reply.replyId === normalizeString(rootReply?.reply_id)) ??
resolvedReplies[0];
const targetReplyContext =
resolvedReplies.find((reply) => reply.replyId === normalizeString(targetReply?.reply_id)) ??
(params.replyId ? undefined : (resolvedReplies.at(-1) ?? rootReplyContext));
let wholeCommentTimeline: ResolvedWholeCommentTimelineEntry[] = [];
if (commentCard?.is_whole === true) {
const allComments = await fetchDriveComments({
client: params.client,
fileToken: params.fileToken,
fileType: params.fileType,
isWholeOnly: true,
timeoutMs: params.timeoutMs,
logger: params.logger,
accountId: params.accountId,
});
const wholeComments = allComments.filter((comment) => comment.is_whole === true);
wholeCommentTimeline = await Promise.all(
wholeComments.map(async (comment) => {
const rootWholeReply = comment.reply_list?.replies?.[0];
const normalizedBotOpenIds = new Set(
Array.from(params.botOpenIds ?? [])
.map((botId) => normalizeString(botId))
.filter((botId): botId is string => Boolean(botId)),
);
const content = await resolveParsedCommentContent({
elements: isRecord(rootWholeReply?.content) ? rootWholeReply.content.elements : undefined,
botOpenIds: params.botOpenIds,
currentDocument,
client: params.client,
wikiCache,
logger: params.logger,
accountId: params.accountId,
});
const commentUserId =
normalizeString(rootWholeReply?.user_id) || normalizeString(comment.user_id);
return {
commentId: normalizeString(comment.comment_id) ?? "",
userId: commentUserId,
createTime:
typeof comment.create_time === "number"
? comment.create_time
: typeof rootWholeReply?.create_time === "number"
? rootWholeReply.create_time
: undefined,
isCurrentComment: normalizeString(comment.comment_id) === params.commentId,
isBotAuthored:
typeof commentUserId === "string" && normalizedBotOpenIds.has(commentUserId),
content,
};
}),
);
wholeCommentTimeline = wholeCommentTimeline
.filter((entry) => Boolean(entry.commentId))
.toSorted((left, right) =>
compareCommentTimelineEntries(
{
createTime: left.createTime,
stableId: left.commentId,
},
{
createTime: right.createTime,
stableId: right.commentId,
},
),
);
}
const currentWholeCommentIndex = wholeCommentTimeline.findIndex(
(entry) => entry.commentId === params.commentId,
);
return {
documentTitle: normalizeString(meta?.title),
documentUrl: normalizeString(meta?.url),
isWholeComment: commentCard?.is_whole,
quoteText: normalizeString(commentCard?.quote),
rootCommentText: extractReplyText(rootReply),
targetReplyText: extractReplyText(targetReply),
rootCommentText: rootReplyContext?.content.semanticText ?? rootReplyContext?.content.plainText,
targetReplyText:
targetReplyContext?.content.semanticText ?? targetReplyContext?.content.plainText,
rootCommentContent: rootReplyContext?.content,
targetReplyContent: targetReplyContext?.content,
currentCommentThreadReplies: resolvedReplies,
wholeCommentTimeline,
nearestBotWholeCommentAfter:
currentWholeCommentIndex >= 0
? findNearestBotTimelineEntry({
entries: wholeCommentTimeline,
currentIndex: currentWholeCommentIndex,
direction: "after",
})
: undefined,
nearestBotWholeCommentBefore:
currentWholeCommentIndex >= 0
? findNearestBotTimelineEntry({
entries: wholeCommentTimeline,
currentIndex: currentWholeCommentIndex,
direction: "before",
})
: undefined,
};
}
@@ -443,24 +1018,31 @@ function buildDriveCommentSurfacePrompt(params: {
quoteText?: string;
rootCommentText?: string;
targetReplyText?: string;
rootCommentContent?: ParsedCommentContent;
targetReplyContent?: ParsedCommentContent;
currentCommentThreadReplies: ResolvedCommentReplyContext[];
wholeCommentTimeline: ResolvedWholeCommentTimelineEntry[];
nearestBotWholeCommentAfter?: ResolvedWholeCommentTimelineEntry;
nearestBotWholeCommentBefore?: ResolvedWholeCommentTimelineEntry;
}): string {
const documentLabel = params.documentTitle
? `"${params.documentTitle}"`
: `${params.fileType} document ${params.fileToken}`;
const actionLabel = params.noticeType === "add_reply" ? "reply" : "comment";
const firstLine = params.targetReplyText
? `The user added a ${actionLabel} in ${documentLabel}: ${params.targetReplyText}`
: `The user added a ${actionLabel} in ${documentLabel}.`;
const firstLine = `The user added a ${actionLabel} in ${documentLabel}.`;
const lines = [firstLine];
if (params.targetReplyText) {
lines.push(`Current user comment text: ${formatPromptTextValue(params.targetReplyText)}`);
}
if (
params.noticeType === "add_reply" &&
params.rootCommentText &&
params.rootCommentText !== params.targetReplyText
) {
lines.push(`Original comment: ${params.rootCommentText}`);
lines.push(`Original comment text: ${formatPromptTextValue(params.rootCommentText)}`);
}
if (params.quoteText) {
lines.push(`Quoted content: ${params.quoteText}`);
lines.push(`Quoted content: ${formatPromptTextValue(params.quoteText)}`);
}
if (params.isMentioned === true) {
lines.push("This comment mentioned you.");
@@ -468,6 +1050,17 @@ function buildDriveCommentSurfacePrompt(params: {
if (params.documentUrl) {
lines.push(`Document link: ${params.documentUrl}`);
}
lines.push(
"Current commented document:",
`- file_type=${params.fileType}`,
`- file_token=${params.fileToken}`,
);
if (params.documentTitle) {
lines.push(`- title=${params.documentTitle}`);
}
if (params.documentUrl) {
lines.push(`- url=${params.documentUrl}`);
}
lines.push(
`Event type: ${params.noticeType}`,
`file_token: ${params.fileToken}`,
@@ -480,29 +1073,124 @@ function buildDriveCommentSurfacePrompt(params: {
if (params.replyId?.trim()) {
lines.push(`reply_id: ${params.replyId.trim()}`);
}
if (params.targetReplyContent?.semanticText) {
lines.push(
`Current user comment semantic text: ${formatPromptTextValue(
params.targetReplyContent.semanticText,
)}`,
);
}
if (params.targetReplyContent?.botMentioned) {
lines.push(
"Bot routing mention detected in the current user comment. Treat that mention as routing only, not task content.",
);
}
const nonBotMentions = (params.targetReplyContent?.mentions ?? [])
.filter((mention) => !mention.isBotMention)
.map((mention) => mention.displayText);
if (nonBotMentions.length > 0) {
lines.push(`Other mentioned users in current comment: ${nonBotMentions.join(", ")}`);
}
lines.push(
"This is a Feishu document comment-thread event, not a Feishu IM conversation. Your final text reply will be posted automatically to the current comment thread and will not be sent as an instant message.",
"If you need to inspect or handle the comment thread, prefer the feishu_drive tools: use list_comments / list_comment_replies to inspect comments, and use reply_comment/add_comment to notify the user after modifying the document.",
"Whole-document comments do not support direct replies. When the current comment is whole-document, use feishu_drive.add_comment for any user-visible follow-up instead of reply_comment.",
'If the comment asks you to modify document content, such as adding, inserting, replacing, or deleting text, tables, or headings, you must first use feishu_doc to actually modify the document. Do not reply with only "done", "I\'ll handle it", or a restated plan without calling tools.',
'If the comment quotes document content, that quoted text is usually the edit anchor. For requests like "insert xxx below this content", first locate the position around the quoted content, then use feishu_doc to make the change.',
'If the comment asks you to summarize, explain, rewrite, translate, refine, continue, or review the document content "below", "above", "this paragraph", "this section", or the quoted content, you must also treat the quoted content as the primary target anchor instead of defaulting to the whole document.',
'For requests like "summarize the content below", "explain this section", or "continue writing from here", first locate the relevant document fragment based on the comment\'s quoted content. If the quote is not sufficient to support the answer, then use feishu_doc.read or feishu_doc.list_blocks to read nearby context.',
"Do not guess document content based only on the comment text, and do not output a vague summary before reading enough context. Unless the user explicitly asks to summarize the entire document, default to handling only the local scope related to the quoted content.",
"When document edits are involved, first use feishu_doc.read or feishu_doc.list_blocks to confirm the context, then use feishu_doc writing or updating capabilities to complete the change. After the edit succeeds, notify the user through feishu_drive.reply_comment.",
"If the document edit fails or you cannot locate the anchor, do not pretend it succeeded. Reply clearly in the comment thread with the reason for failure or the missing information.",
"If this is a reading-comprehension task, such as summarization, explanation, or extraction, you may directly output the final answer text after confirming the context. The system will automatically reply with that answer in the current comment thread.",
"Prefer plain text suitable for a comment thread. Unless the user explicitly asks for Markdown, do not use Markdown headings, bullet lists, numbered lists, tables, blockquotes, or fenced code blocks in the final reply.",
"If source content was read in Markdown form, rewrite it into normal plain-text prose before replying in the comment thread instead of copying Markdown syntax through.",
'Do not include internal reasoning, analysis, chain-of-thought, scratch work, or any "Reasoning:" / "Thinking:" section in a user-visible reply. Output only the final answer meant for the user, or NO_REPLY when appropriate.',
'Do not narrate your plan or execution process in the user-visible reply. Avoid meta lead-ins such as "I will...", "Ill first...", "I need to...", "The user wants...", "I have updated...", or "I am going to...".',
"When the task is complete, reply only with the user-facing result itself, such as the final answer or a concise completion confirmation. Do not include preambles about what you plan to do next.",
"When you produce a user-visible reply, keep it in the same language as the user's original comment or reply unless they explicitly ask for another language.",
"If you have already completed the user-visible action through feishu_drive.reply_comment or feishu_drive.add_comment, output NO_REPLY at the end to avoid duplicate sending.",
"If the user directly asks a question in the comment and a plain text answer is sufficient, output the answer text directly. The system will automatically reply with your final answer in the current comment thread.",
"If you determine that the current comment does not require any user-visible action, output NO_REPLY at the end.",
...formatLinkedDocumentsPromptLines({
title: "Referenced documents from current user comment:",
linkedDocuments: params.targetReplyContent?.linkedDocuments ?? [],
}),
);
if (!params.isWholeComment && params.currentCommentThreadReplies.length > 0) {
lines.push(
"Current comment card timeline (primary context for follow-ups on this comment card):",
...formatCommentThreadPromptLines({
replies: params.currentCommentThreadReplies,
targetReplyId: params.replyId,
}),
"For this non-whole comment, use the current comment card timeline above as the primary source for phrases like 'above', 'previous result', 'that summary', or 'insert it'.",
"Document-level session history is auxiliary background only. Do not use another comment card's recent output as the primary referent.",
);
}
if (params.isWholeComment && params.wholeCommentTimeline.length > 0) {
lines.push(
"Whole-document comment timeline (primary context for whole-comment follow-ups):",
...formatWholeCommentTimelinePromptLines({
entries: params.wholeCommentTimeline,
currentCommentId: params.commentId,
}),
);
if (params.nearestBotWholeCommentAfter) {
lines.push(
`Nearest bot-authored whole-comment after the current comment: comment_id=${params.nearestBotWholeCommentAfter.commentId} text=${formatPromptTextValue(
params.nearestBotWholeCommentAfter.content.semanticText ??
params.nearestBotWholeCommentAfter.content.plainText,
)}`,
);
}
if (params.nearestBotWholeCommentBefore) {
lines.push(
`Nearest bot-authored whole-comment before the current comment: comment_id=${params.nearestBotWholeCommentBefore.commentId} text=${formatPromptTextValue(
params.nearestBotWholeCommentBefore.content.semanticText ??
params.nearestBotWholeCommentBefore.content.plainText,
)}`,
);
}
lines.push(
"For this whole-document comment, use the whole-comment timeline above as the primary source for phrases like 'just now', 'previous result', 'that summary', or 'write it back'.",
"Document-level session history is auxiliary background only. Do not resolve whole-comment follow-ups by blindly using the most recent document-session output.",
);
}
lines.push(
"This is a Feishu document comment thread.",
"It is not a Feishu IM chat.",
"Your final text reply will be posted to the current comment thread automatically.",
"Use the thread timeline above as the main context for follow-up requests.",
"Do not use another comment card or document-session output as the main reference.",
"If you need comment thread context, use feishu_drive.list_comments or feishu_drive.list_comment_replies.",
"If you modify the document, post a user-visible follow-up in the comment thread.",
"Use feishu_drive.reply_comment or feishu_drive.add_comment for that follow-up.",
"Whole-document comments do not support direct replies.",
"For whole-document comments, use feishu_drive.add_comment.",
'Only treat URLs listed under "Referenced documents from current user comment" as structured Feishu document references.',
"URLs that appear only in comment text are plain links unless you verify them.",
"If the user asks about a linked Feishu document or wiki page, treat that linked document as the read target.",
"If the user asks you to use a linked document as guidance, treat the linked document as the reference source and the current commented document as the edit target.",
"If a referenced document resolves to the same file_token and file_type as the current commented document, treat it as the current document.",
"If the user asks you to modify document content, you must use feishu_doc to make the change.",
'Do not reply with only "done", "I\'ll handle it", or a restated plan without calling tools.',
"If the comment quotes document content, treat the quoted content as the main anchor.",
'For requests like "insert xxx below this content", locate the quoted content first, then edit the document.',
'For requests like "summarize the content below", "explain this section", or "continue writing from here", use the quoted content as the main target.',
"If the quote is not enough, use feishu_doc.read or feishu_doc.list_blocks to read nearby context.",
"Do not guess document content from the comment alone.",
"Do not give a vague answer before reading enough context.",
"Unless the user asks for the whole document, handle only the local content around the quoted anchor.",
"If document edits are involved, read the anchor first, then edit.",
"If the edit fails or the anchor cannot be found, say so clearly.",
"If this is a reading task, such as summarization, explanation, or extraction, you may output the final answer directly after confirming the context.",
"Use the same language as the user's comment or reply, unless the user asks for another language.",
"Use plain text only.",
"Do not use Markdown.",
"Do not use headings.",
"Do not use bullet lists.",
"Do not use numbered lists.",
"Do not use tables.",
"Do not use blockquotes.",
"Do not use code blocks.",
"Do not show reasoning.",
"Do not show analysis.",
"Do not show chain-of-thought.",
"Do not show scratch work.",
"Do not describe your plan.",
"Do not describe your steps.",
"Do not describe tool use.",
'Do not start with phrases like "I will", "Ill first", "I need to", "The user wants", or "I have updated".',
"Output only the final user-facing reply.",
"If you already sent the user-visible reply with feishu_drive.reply_comment or feishu_drive.add_comment, output exactly NO_REPLY.",
"If no user-visible reply is needed, output exactly NO_REPLY.",
"Be concise.",
"Do not omit requested content.",
);
lines.push(
"Choose one outcome: output the final plain-text reply, edit the document and then post a user-visible follow-up in the comment thread, or output exactly NO_REPLY.",
);
lines.push(`Decide what to do next based on this document ${actionLabel} event.`);
return lines.join("\n");
}
@@ -524,6 +1212,12 @@ async function resolveDriveCommentEventCore(params: ResolveDriveCommentEventPara
quoteText?: string;
rootCommentText?: string;
targetReplyText?: string;
rootCommentContent?: ParsedCommentContent;
targetReplyContent?: ParsedCommentContent;
currentCommentThreadReplies: ResolvedCommentReplyContext[];
wholeCommentTimeline: ResolvedWholeCommentTimelineEntry[];
nearestBotWholeCommentAfter?: ResolvedWholeCommentTimelineEntry;
nearestBotWholeCommentBefore?: ResolvedWholeCommentTimelineEntry;
};
} | null> {
const {
@@ -576,6 +1270,7 @@ async function resolveDriveCommentEventCore(params: ResolveDriveCommentEventPara
fileType,
commentId,
replyId,
botOpenIds: [botOpenId, event.notice_meta?.to_user_id?.open_id],
timeoutMs: verificationTimeoutMs,
logger,
accountId,
@@ -655,6 +1350,12 @@ export async function resolveDriveCommentEventTurn(
quoteText: resolved.context.quoteText,
rootCommentText: resolved.context.rootCommentText,
targetReplyText: resolved.context.targetReplyText,
rootCommentContent: resolved.context.rootCommentContent,
targetReplyContent: resolved.context.targetReplyContent,
currentCommentThreadReplies: resolved.context.currentCommentThreadReplies,
wholeCommentTimeline: resolved.context.wholeCommentTimeline,
nearestBotWholeCommentAfter: resolved.context.nearestBotWholeCommentAfter,
nearestBotWholeCommentBefore: resolved.context.nearestBotWholeCommentBefore,
});
const preview = prompt.replace(/\s+/g, " ").slice(0, 160);
return {

View File

@@ -8,7 +8,8 @@ const sendMediaFeishuMock = vi.hoisted(() => vi.fn());
const sendMessageFeishuMock = vi.hoisted(() => vi.fn());
const sendMarkdownCardFeishuMock = vi.hoisted(() => vi.fn());
const sendStructuredCardFeishuMock = vi.hoisted(() => vi.fn());
const replyCommentMock = vi.hoisted(() => vi.fn());
const deliverCommentThreadTextMock = vi.hoisted(() => vi.fn());
const cleanupAmbientCommentTypingReactionMock = vi.hoisted(() => vi.fn(async () => false));
vi.mock("./media.js", () => ({
sendMediaFeishu: sendMediaFeishuMock,
@@ -35,7 +36,11 @@ vi.mock("./client.js", () => ({
}));
vi.mock("./drive.js", () => ({
replyComment: replyCommentMock,
deliverCommentThreadText: deliverCommentThreadTextMock,
}));
vi.mock("./comment-reaction.js", () => ({
cleanupAmbientCommentTypingReaction: cleanupAmbientCommentTypingReactionMock,
}));
import { feishuOutbound } from "./outbound.js";
@@ -55,7 +60,11 @@ function resetOutboundMocks() {
sendMarkdownCardFeishuMock.mockResolvedValue({ messageId: "card_msg" });
sendStructuredCardFeishuMock.mockResolvedValue({ messageId: "card_msg" });
sendMediaFeishuMock.mockResolvedValue({ messageId: "media_msg" });
replyCommentMock.mockResolvedValue({ reply_id: "reply_msg" });
deliverCommentThreadTextMock.mockResolvedValue({
delivery_mode: "reply_comment",
reply_id: "reply_msg",
});
cleanupAmbientCommentTypingReactionMock.mockResolvedValue(false);
}
describe("feishuOutbound.sendText local-image auto-convert", () => {
@@ -214,7 +223,7 @@ describe("feishuOutbound comment-thread routing", () => {
resetOutboundMocks();
});
it("routes comment-thread text through replyComment", async () => {
it("routes comment-thread text through deliverCommentThreadText", async () => {
const result = await sendText({
cfg: emptyConfig,
to: "comment:docx:doxcn123:7623358762119646411",
@@ -222,7 +231,7 @@ describe("feishuOutbound comment-thread routing", () => {
accountId: "main",
});
expect(replyCommentMock).toHaveBeenCalledWith(
expect(deliverCommentThreadTextMock).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
file_token: "doxcn123",
@@ -235,7 +244,7 @@ describe("feishuOutbound comment-thread routing", () => {
expect(result).toEqual(expect.objectContaining({ channel: "feishu", messageId: "reply_msg" }));
});
it("routes comment-thread code-block replies through replyComment instead of IM cards", async () => {
it("routes comment-thread code-block replies through deliverCommentThreadText instead of IM cards", async () => {
const result = await sendText({
cfg: emptyConfig,
to: "comment:docx:doxcn123:7623358762119646411",
@@ -243,7 +252,7 @@ describe("feishuOutbound comment-thread routing", () => {
accountId: "main",
});
expect(replyCommentMock).toHaveBeenCalledWith(
expect(deliverCommentThreadTextMock).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
file_token: "doxcn123",
@@ -257,7 +266,7 @@ describe("feishuOutbound comment-thread routing", () => {
expect(result).toEqual(expect.objectContaining({ channel: "feishu", messageId: "reply_msg" }));
});
it("routes comment-thread replies through replyComment even when renderMode=card", async () => {
it("routes comment-thread replies through deliverCommentThreadText even when renderMode=card", async () => {
const result = await sendText({
cfg: cardRenderConfig,
to: "comment:docx:doxcn123:7623358762119646411",
@@ -265,7 +274,7 @@ describe("feishuOutbound comment-thread routing", () => {
accountId: "main",
});
expect(replyCommentMock).toHaveBeenCalledWith(
expect(deliverCommentThreadTextMock).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
file_token: "doxcn123",
@@ -288,7 +297,7 @@ describe("feishuOutbound comment-thread routing", () => {
accountId: "main",
});
expect(replyCommentMock).toHaveBeenCalledWith(
expect(deliverCommentThreadTextMock).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
content: "see attachment\n\nhttps://example.com/file.png",
@@ -297,6 +306,74 @@ describe("feishuOutbound comment-thread routing", () => {
expect(sendMediaFeishuMock).not.toHaveBeenCalled();
expect(result).toEqual(expect.objectContaining({ channel: "feishu", messageId: "reply_msg" }));
});
it("preserves comment-thread routing when deliverCommentThreadText falls back to add_comment", async () => {
deliverCommentThreadTextMock.mockResolvedValueOnce({
delivery_mode: "add_comment",
comment_id: "comment_msg",
reply_id: "reply_from_add_comment",
});
const result = await sendText({
cfg: emptyConfig,
to: "comment:docx:doxcn123:7623358762119646411",
text: "whole-comment follow-up",
accountId: "main",
});
expect(deliverCommentThreadTextMock).toHaveBeenCalledWith(
expect.anything(),
expect.objectContaining({
file_token: "doxcn123",
file_type: "docx",
comment_id: "7623358762119646411",
content: "whole-comment follow-up",
}),
);
expect(result).toEqual(
expect.objectContaining({
channel: "feishu",
messageId: "reply_from_add_comment",
}),
);
});
it("does not wait for ambient comment typing cleanup before sending comment-thread replies", async () => {
let resolveCleanup: ((value: boolean) => void) | undefined;
cleanupAmbientCommentTypingReactionMock.mockImplementationOnce(
() =>
new Promise<boolean>((resolve) => {
resolveCleanup = resolve;
}),
);
const sendPromise = sendText({
cfg: emptyConfig,
to: "comment:docx:doxcn123:7623358762119646411",
text: "handled in thread",
replyToId: "reply_ambient_1",
accountId: "main",
});
const status = await Promise.race([
sendPromise.then(() => "done"),
new Promise<string>((resolve) => setTimeout(() => resolve("pending"), 0)),
]);
expect(status).toBe("done");
expect(deliverCommentThreadTextMock).toHaveBeenCalled();
expect(cleanupAmbientCommentTypingReactionMock).toHaveBeenCalledWith({
client: expect.anything(),
deliveryContext: {
channel: "feishu",
to: "comment:docx:doxcn123:7623358762119646411",
threadId: "reply_ambient_1",
},
});
resolveCleanup?.(false);
await sendPromise;
});
});
describe("feishuOutbound.sendText replyToId forwarding", () => {

View File

@@ -4,8 +4,9 @@ import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";
import { resolveFeishuAccount } from "./accounts.js";
import { createFeishuClient } from "./client.js";
import { cleanupAmbientCommentTypingReaction } from "./comment-reaction.js";
import { parseFeishuCommentTarget } from "./comment-target.js";
import { replyComment } from "./drive.js";
import { deliverCommentThreadText } from "./drive.js";
import { sendMediaFeishu } from "./media.js";
import { chunkTextForOutbound, type ChannelOutboundAdapter } from "./outbound-runtime-api.js";
import { sendMarkdownCardFeishu, sendMessageFeishu, sendStructuredCardFeishu } from "./send.js";
@@ -80,6 +81,7 @@ async function sendCommentThreadReply(params: {
cfg: Parameters<typeof sendMessageFeishu>[0]["cfg"];
to: string;
text: string;
replyId?: string;
accountId?: string;
}) {
const target = parseFeishuCommentTarget(params.to);
@@ -88,17 +90,34 @@ async function sendCommentThreadReply(params: {
}
const account = resolveFeishuAccount({ cfg: params.cfg, accountId: params.accountId });
const client = createFeishuClient(account);
const result = await replyComment(client, {
file_token: target.fileToken,
file_type: target.fileType,
comment_id: target.commentId,
content: params.text,
});
return {
messageId: typeof result.reply_id === "string" ? result.reply_id : "",
chatId: target.commentId,
result,
};
const replyId = params.replyId?.trim();
try {
const result = await deliverCommentThreadText(client, {
file_token: target.fileToken,
file_type: target.fileType,
comment_id: target.commentId,
content: params.text,
});
return {
messageId:
(typeof result.reply_id === "string" && result.reply_id) ||
(typeof result.comment_id === "string" && result.comment_id) ||
"",
chatId: target.commentId,
result,
};
} finally {
if (replyId) {
void cleanupAmbientCommentTypingReaction({
client,
deliveryContext: {
channel: "feishu",
to: params.to,
threadId: replyId,
},
});
}
}
}
async function sendOutboundText(params: {
@@ -113,6 +132,7 @@ async function sendOutboundText(params: {
cfg,
to,
text,
replyId: replyToMessageId,
accountId,
});
if (commentResult) {

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/firecrawl-plugin",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Firecrawl plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/fireworks-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Fireworks provider plugin",
"type": "module",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/github-copilot-provider",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw GitHub Copilot provider plugin",
"type": "module",

View File

@@ -17,6 +17,7 @@ vi.mock("@google/genai", () => ({
}));
import * as providerAuthRuntime from "openclaw/plugin-sdk/provider-auth-runtime";
import { expectExplicitMusicGenerationCapabilities } from "../../test/helpers/media-generation/provider-capability-assertions.js";
import { buildGoogleMusicGenerationProvider } from "./music-generation-provider.js";
describe("google music generation provider", () => {
@@ -26,6 +27,10 @@ describe("google music generation provider", () => {
GoogleGenAIMock.mockClear();
});
it("declares explicit mode capabilities", () => {
expectExplicitMusicGenerationCapabilities(buildGoogleMusicGenerationProvider());
});
it("submits generation and returns inline audio bytes plus lyrics", async () => {
vi.spyOn(providerAuthRuntime, "resolveApiKeyForProvider").mockResolvedValue({
apiKey: "google-key",

View File

@@ -1,6 +1,6 @@
{
"name": "@openclaw/google-plugin",
"version": "2026.4.10",
"version": "2026.4.11",
"private": true,
"description": "OpenClaw Google plugin",
"type": "module",

Some files were not shown because too many files have changed in this diff Show More