Skip to content

feat: JSONL transcript archival with configurable retention#2

Closed
davidrudduck wants to merge 1078 commits intomainfrom
feat/jsonl-transcript-archival
Closed

feat: JSONL transcript archival with configurable retention#2
davidrudduck wants to merge 1078 commits intomainfrom
feat/jsonl-transcript-archival

Conversation

@davidrudduck
Copy link
Copy Markdown
Owner

@davidrudduck davidrudduck commented Mar 3, 2026

Summary

  • Adds archiveSessionTranscript() function for trimming old turns from JSONL session files
  • Atomic file replacement ensures no corruption on concurrent reads
  • Inserts archive marker with metadata about removed entries
  • Configurable via session.archival.enabled and session.archival.keepLastTurns

Motivation

Long-running sessions accumulate large JSONL files. This provides a lightweight alternative to full compaction — trim old turns while keeping the session file manageable. Extensions can call the archival function from their agent_end handler.

Changes

  • src/config/sessions/archival.tsNEW archival function with turn counting, atomic write
  • src/config/sessions/archival.test.tsNEW 5 tests covering skip, archive, marker format, missing file, atomicity
  • src/config/zod-schema.session.ts — Added archival config schema

Test plan

  • 5 unit tests pass (skip, archive, marker, missing file, atomicity)
  • Verify pnpm tsgo passes
  • Manual: create 50-turn JSONL, run archival with keepLastTurns=5, verify output

Config example

session:
  archival:
    enabled: true
    keepLastTurns: 15

Summary by CodeRabbit

  • New Features

    • Added optional Docker sandbox mode, health checks, OCI labels, and improved compose security defaults.
    • Improved gateway discovery with Tailscale fallback; streamlined local-network detection across apps.
    • Enhanced camera capture on iOS/macOS; smarter voice playback with automatic PCM→MP3 fallback.
    • Keychain-backed persistence for TLS pinning and last gateway settings; safer logging.
    • macOS UI polish: reusable dialogs, glass cards, selectable rows; more responsive overlays.
    • Android: new media permission; minor UI/behavior tweaks.
    • Version bump to 2026.3.2 across platforms.
  • Bug Fixes

    • More resilient Chrome extension reattach and relay handling.
    • Unified motion/audio focus permissions; sturdier notification serialization.
  • Documentation

    • Expanded channel guides (Discord, Telegram, Feishu, Tlon, Zalo), security notes, and discovery details.
    • CLI: new config file/validate commands; memory secrets resolution notes.

hclsys and others added 30 commits March 3, 2026 01:09
…allback

The cron delivery path short-circuits with an error when `toCandidate` is
falsy (line 151), before reaching `resolveOutboundTarget()` which provides
the `plugin.config.resolveDefaultTo()` fallback. The direct send path in
`targets.ts` already uses this fallback correctly.

Remove the early `!toCandidate` exit so that `resolveOutboundTarget()`
can attempt the plugin-provided default. Guard the WhatsApp allowFrom
override against falsy `toCandidate` to maintain existing behavior when
a target IS resolved.

Fixes openclaw#32355

Signed-off-by: HCL <[email protected]>
… at lifecycle start

When the Discord gateway completes its READY handshake before
`runDiscordGatewayLifecycle` registers its debug event listener, the
initial "WebSocket connection opened" event is missed. This leaves
`connected` as undefined in the channel runtime, causing the health
monitor to treat the channel as "stuck" and restart it every check
cycle.

Check `gateway.isConnected` immediately after registering the debug
listener and push the initial connected status if the gateway is
already connected.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
When abortSignal is already aborted at lifecycle start, onAbort() fires
synchronously and pushes connected: false. Without a lifecycleStopping
guard, the subsequent gateway.isConnected check could push a spurious
connected: true, contradicting the shutdown.

Adds !lifecycleStopping to the isConnected guard and a test verifying
no connected: true is emitted when the signal is pre-aborted.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ication spam (openclaw#31580)

* fix(feishu): skip typing indicator keepalive re-adds to prevent notification spam

The typing keepalive loop calls addTypingIndicator() every 3 seconds,
which creates a new messageReaction.create API call each time. Feishu
treats each re-add as a new reaction event and fires a push notification,
causing users to receive repeated notifications while waiting for a
response.

Unlike Telegram/Discord where typing status expires after a few seconds,
Feishu reactions persist until explicitly removed. Skip the keepalive
re-add when a reaction already exists (reactionId is set) since there
is no need to refresh it.

Closes openclaw#28660

* Changelog: note Feishu typing keepalive suppression

---------

Co-authored-by: yuxh1996 <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
- Pass gfm:true + breaks:true explicitly to marked.parse() so table
  support is guaranteed even if global setOptions() is bypassed or
  reset by a future refactor (defense-in-depth)
- Add display:block + overflow-x:auto to .chat-text table so wide
  multi-column tables scroll horizontally instead of being clipped
  by the parent overflow-x:hidden chat container
- Add regression tests for GFM table rendering in markdown.test.ts
Take the safe, tested subset from openclaw#32367:\n- per-channel startup connect grace in health monitor\n- tool-context channel-provider fallback for message actions\n\nCo-authored-by: Munem Hashmi <[email protected]>
…w#32360)

* Plugin SDK: add run and tool call fields to tool hooks

* Agents: propagate runId and toolCallId in before_tool_call

* Agents: thread runId through tool wrapper context

* Runner: pass runId into tool hook context

* Compaction: pass runId into tool hook context

* Agents: scope after_tool_call start data by run

* Tests: cover run and tool IDs in before_tool_call hooks

* Tests: add run-scoped after_tool_call collision coverage

* Hooks: scope adjusted tool params by run

* Tests: cover run-scoped adjusted param collisions

* Hooks: preserve active tool start metadata until end

* Changelog: add tool-hook correlation note
…gins

## Overview

This PR enables external channel plugins (loaded via Plugin SDK) to access
advanced runtime features like AI response dispatching, which were previously
only available to built-in channels.

## Changes

### src/gateway/server-channels.ts
- Import PluginRuntime type
- Add optional channelRuntime parameter to ChannelManagerOptions
- Pass channelRuntime to channel startAccount calls via conditional spread
- Ensures backward compatibility (field is optional)

### src/gateway/server.impl.ts
- Import createPluginRuntime from plugins/runtime
- Create and pass channelRuntime to channel manager

### src/channels/plugins/types.adapters.ts
- Import PluginRuntime type
- Add comprehensive documentation for channelRuntime field
- Document available features, use cases, and examples
- Improve type safety (use imported PluginRuntime type vs inline import)

## Benefits

External channel plugins can now:
- Generate AI-powered responses using dispatchReplyWithBufferedBlockDispatcher
- Access routing, text processing, and session management utilities
- Use command authorization and group policy resolution
- Maintain feature parity with built-in channels

## Backward Compatibility

- channelRuntime field is optional in ChannelGatewayContext
- Conditional spread ensures it's only passed when explicitly provided
- Existing channels without channelRuntime support continue to work unchanged
- No breaking changes to channel plugin API

## Testing

- Email channel plugin successfully uses channelRuntime for AI responses
- All existing built-in channels (slack, discord, telegram, etc.) work unchanged
- Gateway loads and runs without errors when channelRuntime is provided
* Feishu: cache failing probes

* Changelog: add Feishu probe failure backoff note

---------

Co-authored-by: bmendonca3 <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
jlwestsr and others added 24 commits March 3, 2026 08:11
…ng truncation (openclaw#20076)

Merged via squash.

Prepared head SHA: 6edebf2
Co-authored-by: jlwestsr <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: da2f8f6
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b99ad80
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 9917165
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
…law#33032)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f77e3d7
Co-authored-by: mbelinky <[email protected]>
Co-authored-by: mbelinky <[email protected]>
Reviewed-by: @mbelinky
…eaks (openclaw#33169)

* fix: stabilize telegram draft stream message boundaries

* fix: suppress NO_REPLY lead-fragment leaks

* fix: keep underscore guard for non-NO_REPLY prefixes

* fix: skip assistant-start rotation only after real lane rotation

* fix: preserve finalized state when pre-rotation does not force

* fix: reset finalized preview state on message-start boundary

* fix: document Telegram draft boundary + NO_REPLY reliability updates (openclaw#33169) (thanks @obviyus)
Adds an archival function that trims old turns from JSONL session files,
keeping the last N turns. Uses atomic file replacement (temp + rename)
and inserts an archive_marker with metadata about removed entries.

Configurable via session.archival.enabled and session.archival.keepLastTurns
(default 15, range 5-100). Disabled by default.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 3, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR adds sandboxed Docker deployment support, expands CI/CD workflows (Windows gating, caching controls), and introduces multiple shared utilities in OpenClawKit. It refactors camera capture (iOS/macOS), gateway discovery (adds Tailscale), persistence (Keychain migrations), UI components, and tests. Android and Chrome extension receive targeted logic updates. Docs are updated accordingly.

Changes

Cohort / File(s) Summary
CI/CD Workflows and Actions
.github/workflows/ci.yml, .github/workflows/docker-release.yml, .github/workflows/install-smoke.yml, .github/workflows/sandbox-common-smoke.yml, .github/workflows/stale.yml, .github/actionlint.yaml, .github/actions/setup-node-env/action.yml, .github/actions/setup-pnpm-store-cache/action.yml
Adds Windows scope/output and gating; introduces sticky-disk/conditional installs; switches to useblacksmith Docker actions; adds OCI labels; introduces stale triage workflow; extends cache controls and runner labels.
Docker Runtime and Compose
Dockerfile, docker-compose.yml, docker-setup.sh, .dockerignore
Adds OCI labels, optional Docker CLI install, and healthcheck; compose gets healthcheck, security caps, shared network, and env defaults; setup script adds sandbox mode with socket overlay, env sync, validation, and rollback; dockerignore includes A2UI/vendor paths.
Chrome Extension
assets/chrome-extension/background.js
Improves debugger reattach/backoff, separates relay error handling, updates badge states, and widens retry schedule with relay-aware behavior.
Developer Env / Ignore
.gitignore
Ignores Android Kotlin cache and entire .claude/ directory.
PI Extensions (TUI)
.pi/extensions/diff.ts, .pi/extensions/files.ts, .pi/extensions/prompt-url-widget.ts, .pi/extensions/ui/paged-select.ts
Replaces custom pickers with new paged select UI; centralizes prompt URL widget rendering/metadata; adds reusable paged list renderer.
Android: App and Permissions
apps/android/.../build.gradle.kts, AndroidManifest.xml, DeviceHandler.kt, MotionHandler.kt, OnboardingFlow.kt, SettingsSheet.kt
Bumps version; adds READ_MEDIA_VISUAL_USER_SELECTED; simplifies motion permission logic (API guards removed); streamlines unknown app sources intent via toUri; converts modifier helper to Modifier extension.
Android: Media and JSON Utils
CameraCaptureManager.kt, CanvasController.kt, PhotosHandler.kt, ScreenRecordManager.kt, NodeUtils.kt
Centralizes JSON parsing helpers; refactors bitmap scaling; replaces legacy parsing with shared helpers; adds suppressions for CameraX internals.
Android: Notifications & Contacts
DeviceNotificationListenerService.kt, NotificationsHandler.kt, ContactsHandler.kt
Adds JSON serializer for notification entries; delegates snapshot JSON to serializer; deduplicates contacts loading via generic query helper.
Android: Voice
TalkModeManager.kt
Unifies audio focus handling with AudioFocusRequest across SDKs.
Android: Tests
apps/android/app/src/test/...
Introduces Robolectric base class; refactors gateway session harness; consolidates helpers; adds tests for PCM format rejection; updates multiple tests to new scaffolding.
iOS: Camera Pipeline
apps/ios/Sources/Camera/CameraController.swift
Replaces ad-hoc capture flows with CameraCapturePipelineSupport; centralizes warm-up, capture, and error mapping; streamlines delegates and auth checks.
iOS: Gateway & TLS
GatewayConnectionController.swift, GatewayDiscoveryModel.swift, GatewayServiceResolver.swift, GatewaySettingsStore.swift, KeychainStore.swift
Locks state with OSAllocatedUnfairLock; delegates browser/resolver to support helpers; migrates last-connection to Keychain with UserDefaults migration; logs use ISO8601 and file protection.
iOS: Status & UI Builders
RootCanvas.swift, RootTabs.swift, Status/*
Introduces GatewayStatusBuilder, dialog/view modifiers; replaces inline status/activity logic; adopts glass card styling.
iOS: Voice & Permissions
Voice/TalkModeManager.swift, Voice/VoiceWakeManager.swift
Adds PCM rejection detection and fallback; centralizes streaming failure monitoring; refactors microphone permission messaging and teardown.
iOS: Location & Device
Location/LocationService.swift, Device/DeviceInfoHelper.swift, Device/DeviceStatusService.swift, Services/NodeServiceProtocols.swift
Adopts LocationServiceCommon/CurrentRequest; exposes manager/continuation; annotates main-actor types; adjusts implementations to shared helpers.
iOS: WebView Support
Screen/ScreenController.swift
Delegates JS/debug helpers to WebViewJavaScriptSupport; consolidates snapshot generation and local-network checks.
iOS: App & Onboarding
OpenClawApp.swift, Onboarding/*
Simplifies continuation error resumption; factors connection status sections; extracts manual connect button.
iOS: Version Bumps
apps/ios/*/Info.plist, apps/ios/project.yml
Bumps CFBundleShortVersionString to 2026.3.2; toggles App Intents metadata generation; adds device family and framework refs.
OpenClawKit: New Shared Utilities
OpenClawKit/*: CameraAuthorization.swift, CameraCapturePipelineSupport.swift, CameraSessionConfiguration.swift, CaptureRateLimits.swift, GenericPasswordKeychainStore.swift, GatewayDiscoveryBrowserSupport.swift, GatewayConnectChallengeSupport.swift, ThrowingContinuationSupport.swift, WebViewJavaScriptSupport.swift, LoopbackHost.swift, LocalNetworkURLSupport.swift, NetworkInterfaceIPv4.swift, NetworkInterfaces.swift, LocationCurrentRequest.swift, LocationServiceSupport.swift
Adds camera, capture rate, keychain, discovery, JS, loopback/local-network, networking, and location service helpers; updates existing code to consume them.
OpenClawKit: Models and Auth
OpenClawProtocol/GatewayModels.swift (both app and kit), DeviceAuthPayload.swift, GatewayChannel.swift, DeepLinks.swift, GatewayTLSPinning.swift
Adds secrets resolve models; renames ExecApproval field; centralizes device auth dict and connect nonce handling; moves loopback checks; migrates TLS pinning to Keychain with legacy migration.
macOS: Overlay and UI Components
OverlayPanelFactory.swift, SelectableRow.swift, MenuHeaderCard.swift, SettingsSidebarScroll.swift, SettingsSidebarCard.swift, StatusGlassCard.swift, MenuItemHighlightColors.swift
Introduces reusable overlay panel/animation factory and UI components for rows, headers, sidebars, and glass cards.
macOS: Menus and Settings
MenuContentView.swift, MenuBar.swift, MenuHighlightedHostView.swift, NodesMenu.swift, MenuSessionsHeaderView.swift, MenuUsageHeaderView.swift, SettingsRootView.swift, SessionsSettings.swift, InstancesSettings.swift, GeneralSettings.swift, ChannelsSettings+*.swift, SettingsRefreshButton.swift, ConfigSettings.swift, ChannelsSettings+View.swift
Refactors to new chrome/components; centralizes mic observer/refresh; standardizes colors; uses selection indicator; extracts refresh button; simplifies sidebars.
macOS: Discovery & Gateway
OpenClawDiscovery/* (DiscoveryModel, Tailscale*), GatewayDiscoverySelectionSupport.swift, GatewayEndpointStore.swift, GatewayDiscoveryMenu.swift, GatewayPushSubscription.swift, GatewayRemoteConfig.swift, GatewayLaunchAgentManager.swift
Adds Tailscale Serve discovery and refresh; centralizes selection application; consolidates push subscription management; normalizes host checks and JSON extraction.
macOS: File Watching & Tasks
SimpleFileWatcher.swift, SimpleFileWatcherOwner.swift, CanvasFileWatcher.swift, ConfigFileWatcher.swift, SimpleTaskSupport.swift, InstancesStore.swift, NodesStore.swift, ExecApprovalsGatewayPrompter.swift, VoiceWakeGlobalSettingsSync.swift, ControlChannel.swift, CronJobsStore.swift
Wraps/coalesces file watchers; standardizes task lifecycle and loops; adopts push subscription/task helpers across stores and prompters.
macOS: Permissions & Monitoring
PermissionMonitoringSupport.swift, PermissionManager.swift, SettingsRootView.swift, OnboardingView+Monitoring.swift
Centralizes permission monitor register/unregister; consolidates System Settings URL opening.
macOS: Overlays & HUD
HoverHUD.swift, NotifyOverlay.swift, TalkOverlay.swift, VoiceWakeOverlayController+Window.swift, WebChatSwiftUI.swift, TalkOverlayView.swift, ColorHexSupport.swift
Moves animations/panel mgmt to OverlayPanelFactory; centralizes hex color parsing; cleans global event monitors.
macOS: Voice Formatting & Debug
VoiceOverlayTextFormatting.swift, VoiceWakeRecognitionDebugSupport.swift, VoicePushToTalk.swift, VoiceWakeRuntime.swift, VoiceWakeTester.swift
Extracts transcript formatting and debug helpers; updates runtime/testers to shared utilities; refines logging criteria.
macOS: Config & Workspace
AgentWorkspaceConfig.swift, OpenClawConfigFile.swift, OnboardingView+Workspace.swift
Adds workspace getters/setters and delegates config file mutations; exposes hostKey access; updates onboarding workspace flows.
macOS: Exec/IPC/Logging
ExecEnvOptions.swift, ExecEnvInvocationUnwrapper.swift, ExecSystemRunCommandValidator.swift, ExecApprovals.swift, ExecApprovalsSocket.swift, NodeServiceManager.swift, OpenClawLogging.swift, JSONObjectExtractionSupport.swift, TextSummarySupport.swift
Introduces exec env options; refactors validators and socket line reads; enhances JSON/text extraction; adjusts logging protocol composition and metadata stringification.
macOS: Pairing Prompters
PairingAlertSupport.swift, DevicePairingApprovalPrompter.swift, NodePairingApprovalPrompter.swift
Centralizes pairing alert state, presentation, and push task management; replaces inline alerts with shared support.
macOS: Location Services
NodeMode/MacNodeLocationService.swift
Adopts LocationServiceCommon/CurrentRequest; exposes manager/continuation; refactors currentLocation with timeout helper.
macOS: Gateway CLI
OpenClawMacCLI/* (ConnectCommand.swift, WizardCommand.swift, CLIArgParsingSupport.swift)
Centralizes arg parsing; factors endpoint builder; delegates nonce extraction and signed device payload construction.
macOS: Misc UI/Logic
ContextMenuCardView.swift, CronJobEditor+Helpers.swift, CronSettings+Helpers.swift, WorkActivityStore.swift, PeekabooBridgeHostCoordinator.swift, Menu*LabelView.swift, Usage*View.swift
Adopts shared duration formatting; extracts current session updater; adds legacy socket symlinks; standardizes menu text colors and layout wrappers.
Android/iOS/macOS Tests
apps/*/Tests/..., apps/android/app/src/test/..., apps/shared/OpenClawKit/Tests/...
Large test refactors: shared helpers, factories, async wait utilities, WebSocket test harness; updates signatures, reduces boilerplate, and adds new coverage (Tailscale discovery, PCM rejection).
Docs
docs/**/*, apps/android/README.md, AGENTS.md, SECURITY.md, pi/prompts/landpr.md
Updates CI docs (Windows scope), channel docs (Discord presence, Feishu gating, Telegram drafts, Tlon, Zalo user), hooks/events, webhook status, Brave Search notes, CLI docs (config validate/file), security guidance, and PR landing strategy.
App Versioning
apps/ios/*/Info.plist, apps/macos/Sources/OpenClaw/Resources/Info.plist, apps/ios/project.yml, apps/android/app/build.gradle.kts
Increments app versions to 2026.3.2; project settings tweaks.
Minor Cleanups
apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift, various import/order/formatting changes
Formatting and import order adjustments; no functional changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as User
  participant App as macOS App (DiscoveryModel)
  participant Tailscale as Tailscale CLI
  participant Probe as WebSocket Probe
  participant Store as Model/State

  rect rgba(200,200,255,0.5)
    User->>App: Trigger remote fallback refresh
    App->>Tailscale: Run tailscale status --json
    Tailscale-->>App: JSON status (self/peers)
    App->>App: Build candidate gateways
    loop For each candidate (concurrent, timed)
      App->>Probe: Try wss connect, wait for connect.challenge
      Probe-->>App: Success/timeout
    end
    App->>Store: Map beacons -> DiscoveredGateways
    Store-->>User: Updated gateway list
  end
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/jsonl-transcript-archival

@davidrudduck
Copy link
Copy Markdown
Owner Author

Recreating — base branch was out of sync

@davidrudduck davidrudduck deleted the feat/jsonl-transcript-archival branch March 3, 2026 22:41
davidrudduck pushed a commit that referenced this pull request Mar 31, 2026
* feat: add QQ Bot channel extension

* fix(qqbot): add setupWizard to runtime plugin for onboard re-entry

* fix: fix review

* fix: fix review

* chore: sync lockfile and config-docs baseline for qqbot extension

* refactor: 移除图床服务器相关代码

* fix

* docs: 新增 QQ Bot 插件文档并修正链接路径

* refactor: remove credential backup functionality and update setup logic

- Deleted the credential backup module to streamline the codebase.
- Updated the setup surface to handle client secrets more robustly, allowing for configured secret inputs.
- Simplified slash commands by removing unused hot upgrade compatibility checks and related functions.
- Adjusted types to use SecretInput for client secrets in QQBot configuration.
- Modified bundled plugin metadata to allow additional properties in the config schema.

* feat: 添加本地媒体路径解析功能,修正 QQBot 媒体路径处理

* feat: 添加本地媒体路径解析功能,修正 QQBot 媒体路径处理

* feat: remove qqbot-media and qqbot-remind skills, add tests for config and setup

- Deleted the qqbot-media and qqbot-remind skills documentation files.
- Added unit tests for qqbot configuration and setup processes, ensuring proper handling of SecretRef-backed credentials and account configurations.
- Implemented tests for local media path remapping, verifying correct resolution of media file paths.
- Removed obsolete channel and remind tools, streamlining the codebase.

* feat: 更新 QQBot 配置模式,添加音频格式和账户定义

* feat: 添加 QQBot 频道管理和定时提醒技能,更新媒体路径解析功能

* fix

* feat: 添加 /bot-upgrade 指令以查看 QQBot 插件升级指引

* feat: update reminder and qq channel skills

* feat: 更新remind工具投递目标地址格式

* feat: Refactor QQBot payload handling and improve code documentation

- Simplified and clarified the structure of payload interfaces for Cron reminders and media messages.
- Enhanced the parsing function to provide clearer error messages and improved validation.
- Updated platform utility functions for better cross-platform compatibility and clearer documentation.
- Improved text parsing utilities for better readability and consistency in emoji representation.
- Optimized upload cache management with clearer comments and reduced redundancy.
- Integrated QQBot plugin into the bundled channel plugins and updated metadata for installation.

* OK apps/macos/Sources/OpenClaw/HostEnvSecurityPolicy.generated.swift

> [email protected] check:bundled-channel-config-metadata /Users/yuehuali/code/PR/openclaw
> node --import tsx scripts/generate-bundled-channel-config-metadata.ts --check

[bundled-channel-config-metadata] stale generated output at src/config/bundled-channel-config-metadata.generated.ts
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

* feat: 添加 QQBot 渠道配置及相关账户设置

* fix(qqbot): resolve 14 high-priority bugs from PR openclaw#52986 review

DM routing (7 fixes):
- #1: DM slash-command replies use sendDmMessage(guildId) instead of sendC2CMessage(senderId)
- #2: DM qualifiedTarget uses qqbot:dm:${guildId} instead of qqbot:c2c:${senderId}
- #3: sendTextChunks adds DM branch
- #4: sendMarkdownReply adds DM branch for text and Base64 images
- #5: parseAndSendMediaTags maps DM to targetType:dm + guildId
- #6: sendTextToTarget DM branch uses sendDmMessage; MessageTarget adds guildId field
- #7: handleImage/Audio/Video/FilePayload add DM branches

Other high-priority fixes:
- #8: Fix sendC2CVoiceMessage/sendGroupVoiceMessage parameter misalignment
- #9: broadcastMessage uses groupOpenid instead of member_openid for group users
- #10: Unify KnownUser storage - proactive.ts delegates to known-users.ts
- #11: Remove invalid recordKnownUser calls for guild/DM users
- #12: sendGroupMessage uses sendAndNotify to trigger onMessageSent hook
- #13: sendPhoto channel unsupported returns error field
- #14: sendTextAfterMedia adds channel and dm branches

Type fixes:
- DeliverEventContext adds guildId field
- MediaTargetContext.targetType adds dm variant
- sendPlainTextReply imgMediaTarget adds DM branch

* fix(qqbot): resolve 2 blockers + 7 medium-priority bugs from PR openclaw#52986 review

Blocker-1: Remove unused dmPolicy config knob
- dmPolicy was declared in schema/types/plugin.json but never consumed at runtime
- Removed from config-schema.ts, types.ts, and openclaw.plugin.json
- allowFrom remains active (already wired into framework command-auth)

Blocker-2: Gate sensitive slash commands with allowFrom authorization
- SlashCommand interface adds requireAuth?: boolean
- SlashCommandContext adds commandAuthorized: boolean
- /bot-logs set to requireAuth: true (reads local log files)
- matchSlashCommand rejects unauthorized senders for requireAuth commands
- trySlashCommandOrEnqueue computes commandAuthorized from allowFrom config

Medium-priority fixes:
- #15: Strip non-HTTP/non-local markdown image tags to prevent path leakage
- openclaw#16: applyQQBotAccountConfig clears clientSecret when setting clientSecretFile and vice versa
- openclaw#17: getAdminMarkerFile sanitizes accountId to prevent path traversal
- openclaw#18: URGENT_COMMANDS uses exact match instead of startsWith prefix match
- openclaw#19: isCronExpression validates each token starts with a cron-valid character
- openclaw#20: --token format validation rejects malformed input without colon separator
- openclaw#21: resolveDefaultQQBotAccountId checks QQBOT_APP_ID environment variable

* test(qqbot): add focused tests for slash command authorization path

- Unauthorized sender rejected for /bot-logs (requireAuth: true)
- Authorized sender allowed for /bot-logs
- Non-requireAuth commands (/bot-ping, /bot-help, /bot-version) work for all senders
- Unknown slash commands return null (passthrough)
- Non-slash messages return null
- Usage query (/bot-logs ?) also gated by auth check

* fix(qqbot): align global TTS fallback with framework config resolution

- Extract isGlobalTTSAvailable to utils/audio-convert.ts, mirroring core
  resolveTtsConfig logic: check auto !== 'off', fall back to legacy
  enabled boolean, default to off when neither is set.
- Add pre-check in reply-dispatcher before calling globalTextToSpeech to
  avoid unnecessary TTS calls and noisy error logs when TTS is not
  configured.
- Remove inline as any casts; use OpenClawConfig type throughout.
- Refactor handleAudioPayload into flat early-return structure with
  unified send path (plugin TTS → global fallback → send).

* fix(qqbot): break ESM circular dependency causing multi-account startup crash

The bundled gateway chunk had a circular static import on the channel
chunk (gateway -> outbound-deliver -> channel, while channel dynamically
imports gateway). When two accounts start concurrently via Promise.all,
the first dynamic import triggers module graph evaluation; the circular
reference causes api exports (including runDiagnostics) to resolve as
undefined before the module finishes evaluating.

Fix: extract chunkText and TEXT_CHUNK_LIMIT from channel.ts into a new
text-utils.ts leaf module. outbound-deliver.ts now imports from
text-utils.ts, breaking the cycle. channel.ts re-exports for backward
compatibility.

* fix(qqbot): serialize gateway module import to prevent multi-account startup race

When multiple accounts start concurrently via Promise.all, each calls
await import('./gateway.js') independently. Due to ESM circular
dependencies in the bundled output, the first import can resolve
transitive exports as undefined before module evaluation completes.

Fix: cache the dynamic import promise in a module-level variable so all
concurrent startAccount calls share the same import, ensuring the
gateway module is fully evaluated before any account uses it.

* refactor(qqbot): remove startup greeting logic

Remove getStartupGreetingPlan and related startup greeting delivery:
- Delete startup-greeting.ts (greeting plan, marker persistence)
- Delete admin-resolver.ts (admin resolution, greeting dispatch)
- Remove startup greeting calls from gateway READY/RESUMED handlers
- Remove isFirstReadyGlobal flag and adminCtx

* fix(qqbot): skip octal escape decoding for Windows local paths

Windows paths like C:\Users\1\file.txt contain backslash-digit sequences
that were incorrectly matched as octal escape sequences and decoded,
corrupting the file path. Detect Windows local paths (drive letter or UNC
prefix) and skip the octal decoding step for them.

* fix bot issue

* feat: 支持 TTS 自动开关并清理配置中的 clientSecretFile

* docs: 添加 QQBot 配置和消息处理的设计说明

* rebase

* fix(qqbot): align slash-command auth with shared command-auth model

Route requireAuth:true slash commands (e.g. /bot-logs) through the
framework's api.registerCommand() so resolveCommandAuthorization()
applies commands.allowFrom.qqbot precedence and qqbot: prefix
normalization before any handler runs.

- slash-commands.ts: registerCommand() now auto-routes by requireAuth
  into two maps (commands / frameworkCommands); getFrameworkCommands()
  exports the auth-required set for framework registration; bot-help
  lists both maps
- index.ts: registerFull() iterates getFrameworkCommands() and calls
  api.registerCommand() for each; handler derives msgType from ctx.from,
  sends file attachments via sendDocument, supports multi-account via
  ctx.accountId
- gateway.ts (inbound): replace raw allowFrom string comparison with
  qqbotPlugin.config.formatAllowFrom() to strip qqbot: prefix and
  uppercase before matching event.senderId
- gateway.ts (pre-dispatch): remove stale auth computation; commandAuthorized
  is true (requireAuth:true commands never reach matchSlashCommand)
- command-auth.test.ts: add regression tests for qqbot: prefix
  normalization in the inbound commandAuthorized computation
- slash-commands.test.ts: update /bot-logs tests to expect null
  (command routed to framework, not in local registry)

* rebase and solve conflict

* fix(qqbot): preserve mixed env setup credentials

---------

Co-authored-by: yuehuali <[email protected]>
Co-authored-by: walli <[email protected]>
Co-authored-by: WideLee <[email protected]>
Co-authored-by: Frank Yang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.