mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-15 18:49:31 +08:00
Compare commits
26 Commits
memory-wik
...
codex/refa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af826ae7fc | ||
|
|
f33b5426aa | ||
|
|
df1a008584 | ||
|
|
cc7cbc0580 | ||
|
|
2dc0ea95d7 | ||
|
|
224f195709 | ||
|
|
c422f10aef | ||
|
|
619da391ab | ||
|
|
2d886f03a7 | ||
|
|
6a53001e2f | ||
|
|
0843ad5ad1 | ||
|
|
960a631b25 | ||
|
|
607d341451 | ||
|
|
b6da5443fc | ||
|
|
a84858d315 | ||
|
|
23549694f7 | ||
|
|
4a5fe2e0e7 | ||
|
|
32ae0eba54 | ||
|
|
24f76d04eb | ||
|
|
5b53ddcc5f | ||
|
|
51ff658586 | ||
|
|
be85d9aaec | ||
|
|
fd1b355f84 | ||
|
|
b9a9290dfc | ||
|
|
b141da4ca9 | ||
|
|
4857f9d0c2 |
@@ -17,7 +17,6 @@ Use this skill for Parallels guest workflows and smoke interpretation. Do not lo
|
||||
- Per-phase logs land under `/tmp/openclaw-parallels-*`.
|
||||
- Do not run local and gateway agent turns in parallel on the same fresh workspace or session.
|
||||
- If `main` is moving under active multi-agent work, prefer a detached worktree pinned to one commit for long Parallels suites. The smoke scripts now verify the packed tgz commit instead of live `git rev-parse HEAD`, but a pinned worktree still avoids noisy rebuild/version drift during reruns.
|
||||
- For `openclaw update --channel dev` lanes, remember the guest clones GitHub `main`, not your local worktree. If a local fix exists but the rerun still fails inside the cloned dev checkout, do not treat that as disproof of the fix until the branch has been pushed.
|
||||
- For `prlctl exec`, pass the VM name before `--current-user` (`prlctl exec "$VM" --current-user ...`), not the other way around.
|
||||
- If the workflow installs OpenClaw from a repo checkout instead of the site installer/npm release, finish by installing a real guest CLI shim and verifying it in a fresh guest shell. `pnpm openclaw ...` inside the repo is not enough for handoff parity.
|
||||
- On macOS guests, prefer a user-global install plus a stable PATH-visible shim:
|
||||
@@ -46,12 +45,6 @@ Use this skill for Parallels guest workflows and smoke interpretation. Do not lo
|
||||
## macOS flow
|
||||
|
||||
- Preferred entrypoint: `pnpm test:parallels:macos`
|
||||
- Default upgrade coverage on macOS should now include: fresh snapshot -> site installer pinned to the latest stable tag -> `openclaw update --channel dev` on the guest. Treat this as part of the default Tahoe regression plan, not an optional side quest.
|
||||
- `parallels-macos-smoke.sh --mode upgrade` should run that release-to-dev lane by default. Keep the older host-tgz upgrade path only when the caller explicitly passes `--target-package-spec`.
|
||||
- Because the default upgrade lane no longer needs a host tgz, skip `npm pack` + host HTTP server startup for `--mode upgrade` unless `--target-package-spec` is set. Keep the pack/server path for `fresh` and `both`.
|
||||
- If that release-to-dev lane fails with `reason=preflight-no-good-commit` and repeated `sh: pnpm: command not found` tails from `preflight build`, treat it as an updater regression first. The fix belongs in the git/dev updater bootstrap path, not in Parallels retry logic.
|
||||
- Until the public stable train includes that updater bootstrap fix, the macOS release-to-dev lane may seed a temporary guest-local `pnpm` shim immediately before `openclaw update --channel dev`. Keep that workaround scoped to the smoke harness and remove it once the latest stable no longer needs it.
|
||||
- In Tahoe `prlctl exec --current-user` runs, prefer explicit `node .../openclaw.mjs ...` invocations for the release->dev handoff itself and for post-update verification. The shebanged global `openclaw` wrapper can fail with `env: node: No such file or directory`, and self-updating through the wrapper is a weaker lane than invoking the entrypoint under a fixed `node`.
|
||||
- Default to the snapshot closest to `macOS 26.3.1 latest`.
|
||||
- On Peter's Tahoe VM, `fresh-latest-march-2026` can hang in `prlctl snapshot-switch`; if restore times out there, rerun with `--snapshot-hint 'macOS 26.3.1 latest'` before blaming auth or the harness.
|
||||
- `parallels-macos-smoke.sh` now retries `snapshot-switch` once after force-stopping a stuck running/suspended guest. If Tahoe still times out after that recovery path, then treat it as a real Parallels/host issue and rerun manually.
|
||||
@@ -68,23 +61,14 @@ Use this skill for Parallels guest workflows and smoke interpretation. Do not lo
|
||||
|
||||
- Preferred entrypoint: `pnpm test:parallels:windows`
|
||||
- Use the snapshot closest to `pre-openclaw-native-e2e-2026-03-12`.
|
||||
- Default upgrade coverage on Windows should now include: fresh snapshot -> site installer pinned to the requested stable tag -> `openclaw update --channel dev` on the guest. Keep the older host-tgz upgrade path only when the caller explicitly passes `--target-package-spec`.
|
||||
- Optional exact npm-tag baseline on Windows: `bash scripts/e2e/parallels-windows-smoke.sh --mode upgrade --target-package-spec openclaw@<tag> --json`. That lane installs the published npm tarball as baseline, then runs `openclaw update --channel dev`.
|
||||
- Optional forward-fix Windows validation: `bash scripts/e2e/parallels-windows-smoke.sh --mode upgrade --upgrade-from-packed-main --json`. That lane installs the packed current-main npm tgz as baseline, then runs `openclaw update --channel dev`.
|
||||
- Always use `prlctl exec --current-user`; plain `prlctl exec` lands in `NT AUTHORITY\\SYSTEM`.
|
||||
- Prefer explicit `npm.cmd` and `openclaw.cmd`.
|
||||
- Use PowerShell only as the transport with `-ExecutionPolicy Bypass`, then call the `.cmd` shims from inside it.
|
||||
- Current Windows Node installs expose `corepack` as a `.cmd` shim. If a release-to-dev lane sees `corepack` on PATH but `openclaw update --channel dev` still behaves as if corepack is missing, treat that as an exec-shim regression first.
|
||||
- If an exact published-tag Windows lane fails during preflight with `npm run build` and `'pnpm' is not recognized`, remember that the guest is still executing the old published updater. Validate the fix with `--upgrade-from-packed-main`, then wait for the next tagged npm release before expecting the historical tag lane to pass.
|
||||
- Multi-word `openclaw agent --message ...` checks should call `& $openclaw ...` inside PowerShell, not `Start-Process ... -ArgumentList` against `openclaw.cmd`, or Commander can see split argv and throw `too many arguments for 'agent'`.
|
||||
- Windows installer/tgz phases now retry once after guest-ready recheck; keep new Windows smoke steps idempotent so a transport-flake retry is safe.
|
||||
- If a Windows retry sees the VM become `suspended` or `stopped`, resume/start it before the next `prlctl exec`; otherwise the second attempt just repeats the same `rc=255`.
|
||||
- Windows global `npm install -g` phases can stay quiet for a minute or more even when healthy; inspect the phase log before calling it hung, and only treat it as a regression once the retry wrapper or timeout trips.
|
||||
- When those Windows global installs stay quiet, the useful progress often lives in the guest npm debug log, not the helper phase log. The smoke script now streams incremental `npm-cache/_logs/*-debug-0.log` deltas into the phase log during long baseline/package installs; read those lines before assuming the lane is stalled.
|
||||
- The Windows baseline-package helpers now auto-dump the latest guest `npm-cache/_logs/*-debug-0.log` tail on timeout or nonzero completion. Read that tail in the phase log before opening a second guest shell.
|
||||
- The same incremental npm-debug streaming also applies to `--upgrade-from-packed-main` / packaged-install baseline phases. A phase log that still says only `install.start`, `install.download-tgz`, `install.install-tgz` can still be healthy if the streamed npm-debug section shows registry fetches or bundled-plugin postinstall work.
|
||||
- Fresh Windows tgz install phases should also use the background PowerShell runner plus done-file/log-drain pattern; do not rely on one long-lived `prlctl exec ... powershell ... npm install -g` transport for package installs.
|
||||
- Windows release-to-dev helpers should log `where pnpm` before and after the update and require `where pnpm` to succeed post-update. That proves the updater installed or enabled `pnpm` itself instead of depending on a smoke-only bootstrap.
|
||||
- Fresh Windows ref-mode onboard should use the same background PowerShell runner plus done-file/log-drain pattern as the npm-update helper, including startup materialization checks, host-side timeouts on short poll `prlctl exec` calls, and retry-on-poll-failure behavior for transient transport flakes.
|
||||
- Fresh Windows daemon-health reachability should use a hello-only gateway probe and a longer per-probe timeout than the default local attach path; full health RPCs are too eager during initial startup on current main.
|
||||
- Fresh Windows ref-mode agent verification should set `OPENAI_API_KEY` in the PowerShell environment before invoking `openclaw.cmd agent`, for the same pairing-required fallback reason as macOS.
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
---
|
||||
name: openclaw-qa-testing
|
||||
description: Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
|
||||
---
|
||||
|
||||
# OpenClaw QA Testing
|
||||
|
||||
Use this skill for `qa-lab` / `qa-channel` work. Repo-local QA only.
|
||||
|
||||
## Read first
|
||||
|
||||
- `docs/concepts/qa-e2e-automation.md`
|
||||
- `docs/help/testing.md`
|
||||
- `docs/channels/qa-channel.md`
|
||||
- `qa/QA_KICKOFF_TASK.md`
|
||||
- `qa/seed-scenarios.json`
|
||||
- `extensions/qa-lab/src/suite.ts`
|
||||
|
||||
## Model policy
|
||||
|
||||
- Live OpenAI lane: `openai/gpt-5.4`
|
||||
- Fast mode: on
|
||||
- Do not use:
|
||||
- `openai/gpt-5.4-pro`
|
||||
- `openai/gpt-5.4-mini`
|
||||
- Only change model policy if the user explicitly asks.
|
||||
|
||||
## Default workflow
|
||||
|
||||
1. Read the seed plan and current suite implementation.
|
||||
2. Decide lane:
|
||||
- mock/dev: `mock-openai`
|
||||
- real validation: `live-openai`
|
||||
3. For live OpenAI, use:
|
||||
|
||||
```bash
|
||||
OPENCLAW_LIVE_OPENAI_KEY="${OPENAI_API_KEY}" \
|
||||
pnpm openclaw qa suite \
|
||||
--provider-mode live-openai \
|
||||
--model openai/gpt-5.4 \
|
||||
--alt-model openai/gpt-5.4 \
|
||||
--output-dir .artifacts/qa-e2e/run-all-live-openai-<tag>
|
||||
```
|
||||
|
||||
4. Watch outputs:
|
||||
- summary: `.artifacts/qa-e2e/run-all-live-openai-<tag>/qa-suite-summary.json`
|
||||
- report: `.artifacts/qa-e2e/run-all-live-openai-<tag>/qa-suite-report.md`
|
||||
5. If the user wants to watch the live UI, find the current `openclaw-qa` listen port and report `http://127.0.0.1:<port>`.
|
||||
6. If a scenario fails, fix the product or harness root cause, then rerun the full lane.
|
||||
|
||||
## Repo facts
|
||||
|
||||
- Seed scenarios live in `qa/`.
|
||||
- Main live runner: `extensions/qa-lab/src/suite.ts`
|
||||
- QA lab server: `extensions/qa-lab/src/lab-server.ts`
|
||||
- Child gateway harness: `extensions/qa-lab/src/gateway-child.ts`
|
||||
- Synthetic channel: `extensions/qa-channel/`
|
||||
|
||||
## What “done” looks like
|
||||
|
||||
- Full suite green for the requested lane.
|
||||
- User gets:
|
||||
- watch URL if applicable
|
||||
- pass/fail counts
|
||||
- artifact paths
|
||||
- concise note on what was fixed
|
||||
|
||||
## Common failure patterns
|
||||
|
||||
- Live timeout too short:
|
||||
- widen live waits in `extensions/qa-lab/src/suite.ts`
|
||||
- Discovery cannot find repo files:
|
||||
- point prompts at `repo/...` inside seeded workspace
|
||||
- Subagent proof too brittle:
|
||||
- prefer stable final reply evidence over transient child-session listing
|
||||
- Harness “rebuild” delay:
|
||||
- dirty tree can trigger a pre-run build; expect that before ports appear
|
||||
|
||||
## When adding scenarios
|
||||
|
||||
- Add scenario metadata to `qa/seed-scenarios.json`
|
||||
- Keep kickoff expectations in `qa/QA_KICKOFF_TASK.md` aligned
|
||||
- Add executable coverage in `extensions/qa-lab/src/suite.ts`
|
||||
- Prefer end-to-end assertions over mock-only checks
|
||||
- Save outputs under `.artifacts/qa-e2e/`
|
||||
@@ -1,4 +0,0 @@
|
||||
interface:
|
||||
display_name: "QA Test OpenClaw"
|
||||
short_description: "Run and debug qa-lab and qa-channel scenarios"
|
||||
default_prompt: "Use $openclaw-qa-testing to run or extend the OpenClaw QA suite with qa-lab and qa-channel, using regular openai/gpt-5.4 in fast mode for live OpenAI runs."
|
||||
12
.github/labeler.yml
vendored
12
.github/labeler.yml
vendored
@@ -233,18 +233,10 @@
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "extensions/memory-lancedb/**"
|
||||
"extensions: memory-wiki":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "extensions/memory-wiki/**"
|
||||
"extensions: open-prose":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "extensions/open-prose/**"
|
||||
"extensions: webhooks":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "extensions/webhooks/**"
|
||||
"extensions: device-pair":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
@@ -257,10 +249,6 @@
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "extensions/acpx/**"
|
||||
"extensions: arcee":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "extensions/arcee/**"
|
||||
"extensions: byteplus":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 86 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 44 KiB |
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@@ -1,5 +1,7 @@
|
||||
name: CI
|
||||
|
||||
# Keep PR CI synchronized on branch updates.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
@@ -46,7 +48,6 @@ jobs:
|
||||
run_check_additional: ${{ steps.manifest.outputs.run_check_additional }}
|
||||
run_build_smoke: ${{ steps.manifest.outputs.run_build_smoke }}
|
||||
run_check_docs: ${{ steps.manifest.outputs.run_check_docs }}
|
||||
run_control_ui_i18n: ${{ steps.manifest.outputs.run_control_ui_i18n }}
|
||||
run_checks_windows: ${{ steps.manifest.outputs.run_checks_windows }}
|
||||
checks_windows_matrix: ${{ steps.manifest.outputs.checks_windows_matrix }}
|
||||
run_macos_node: ${{ steps.manifest.outputs.run_macos_node }}
|
||||
@@ -129,7 +130,6 @@ jobs:
|
||||
OPENCLAW_CI_RUN_ANDROID: ${{ steps.changed_scope.outputs.run_android || 'false' }}
|
||||
OPENCLAW_CI_RUN_WINDOWS: ${{ steps.changed_scope.outputs.run_windows || 'false' }}
|
||||
OPENCLAW_CI_RUN_SKILLS_PYTHON: ${{ steps.changed_scope.outputs.run_skills_python || 'false' }}
|
||||
OPENCLAW_CI_RUN_CONTROL_UI_I18N: ${{ steps.changed_scope.outputs.run_control_ui_i18n || 'false' }}
|
||||
OPENCLAW_CI_HAS_CHANGED_EXTENSIONS: ${{ steps.changed_extensions.outputs.has_changed_extensions || 'false' }}
|
||||
OPENCLAW_CI_CHANGED_EXTENSIONS_MATRIX: ${{ steps.changed_extensions.outputs.changed_extensions_matrix || '{"include":[]}' }}
|
||||
run: |
|
||||
@@ -167,8 +167,6 @@ jobs:
|
||||
const runAndroid = parseBoolean(process.env.OPENCLAW_CI_RUN_ANDROID) && !docsOnly;
|
||||
const runWindows = parseBoolean(process.env.OPENCLAW_CI_RUN_WINDOWS) && !docsOnly;
|
||||
const runSkillsPython = parseBoolean(process.env.OPENCLAW_CI_RUN_SKILLS_PYTHON) && !docsOnly;
|
||||
const runControlUiI18n =
|
||||
parseBoolean(process.env.OPENCLAW_CI_RUN_CONTROL_UI_I18N) && !docsOnly;
|
||||
const hasChangedExtensions =
|
||||
parseBoolean(process.env.OPENCLAW_CI_HAS_CHANGED_EXTENSIONS) && !docsOnly;
|
||||
const changedExtensionsMatrix = hasChangedExtensions
|
||||
@@ -245,7 +243,6 @@ jobs:
|
||||
run_check_additional: runNode,
|
||||
run_build_smoke: runNode,
|
||||
run_check_docs: docsChanged,
|
||||
run_control_ui_i18n: runControlUiI18n,
|
||||
run_skills_python_job: runSkillsPython,
|
||||
run_checks_windows: runWindows,
|
||||
checks_windows_matrix: createMatrix(
|
||||
@@ -743,16 +740,6 @@ jobs:
|
||||
continue-on-error: true
|
||||
run: pnpm run lint:extensions:no-relative-outside-package
|
||||
|
||||
- name: Run extension channel lint
|
||||
id: extension_channel_lint
|
||||
continue-on-error: true
|
||||
run: pnpm run lint:extensions:channels
|
||||
|
||||
- name: Run bundled extension lint
|
||||
id: extension_bundled_lint
|
||||
continue-on-error: true
|
||||
run: pnpm run lint:extensions:bundled
|
||||
|
||||
- name: Enforce safe external URL opening policy
|
||||
id: no_raw_window_open
|
||||
continue-on-error: true
|
||||
@@ -760,7 +747,6 @@ jobs:
|
||||
|
||||
- name: Check control UI locale sync
|
||||
id: control_ui_i18n
|
||||
if: needs.preflight.outputs.run_control_ui_i18n == 'true'
|
||||
continue-on-error: true
|
||||
run: pnpm ui:i18n:check
|
||||
|
||||
@@ -795,10 +781,8 @@ jobs:
|
||||
EXTENSION_SRC_OUTSIDE_PLUGIN_SDK_BOUNDARY_OUTCOME: ${{ steps.extension_src_outside_plugin_sdk_boundary.outcome }}
|
||||
EXTENSION_PLUGIN_SDK_INTERNAL_BOUNDARY_OUTCOME: ${{ steps.extension_plugin_sdk_internal_boundary.outcome }}
|
||||
EXTENSION_RELATIVE_OUTSIDE_PACKAGE_BOUNDARY_OUTCOME: ${{ steps.extension_relative_outside_package_boundary.outcome }}
|
||||
EXTENSION_CHANNEL_LINT_OUTCOME: ${{ steps.extension_channel_lint.outcome }}
|
||||
EXTENSION_BUNDLED_LINT_OUTCOME: ${{ steps.extension_bundled_lint.outcome }}
|
||||
NO_RAW_WINDOW_OPEN_OUTCOME: ${{ steps.no_raw_window_open.outcome }}
|
||||
CONTROL_UI_I18N_OUTCOME: ${{ steps.control_ui_i18n.outcome == 'skipped' && 'success' || steps.control_ui_i18n.outcome }}
|
||||
CONTROL_UI_I18N_OUTCOME: ${{ steps.control_ui_i18n.outcome }}
|
||||
GATEWAY_WATCH_REGRESSION_OUTCOME: ${{ steps.gateway_watch_regression.outcome }}
|
||||
run: |
|
||||
failures=0
|
||||
@@ -818,8 +802,6 @@ jobs:
|
||||
"extension-src-outside-plugin-sdk-boundary|$EXTENSION_SRC_OUTSIDE_PLUGIN_SDK_BOUNDARY_OUTCOME" \
|
||||
"extension-plugin-sdk-internal-boundary|$EXTENSION_PLUGIN_SDK_INTERNAL_BOUNDARY_OUTCOME" \
|
||||
"extension-relative-outside-package-boundary|$EXTENSION_RELATIVE_OUTSIDE_PACKAGE_BOUNDARY_OUTCOME" \
|
||||
"lint:extensions:channels|$EXTENSION_CHANNEL_LINT_OUTCOME" \
|
||||
"lint:extensions:bundled|$EXTENSION_BUNDLED_LINT_OUTCOME" \
|
||||
"lint:ui:no-raw-window-open|$NO_RAW_WINDOW_OPEN_OUTCOME" \
|
||||
"ui:i18n:check|$CONTROL_UI_I18N_OUTCOME" \
|
||||
"gateway-watch-regression|$GATEWAY_WATCH_REGRESSION_OUTCOME"; do
|
||||
|
||||
@@ -156,11 +156,11 @@ jobs:
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add -A ui/src/i18n
|
||||
git commit --no-verify -m "chore(ui): refresh ${LOCALE} control ui locale"
|
||||
FAST_COMMIT=1 git commit -m "chore(ui): refresh ${LOCALE} control ui locale"
|
||||
|
||||
for attempt in 1 2 3 4 5; do
|
||||
git fetch origin "${TARGET_BRANCH}"
|
||||
git rebase --autostash "origin/${TARGET_BRANCH}"
|
||||
git rebase "origin/${TARGET_BRANCH}"
|
||||
if git push origin HEAD:"${TARGET_BRANCH}"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
2
.github/workflows/openclaw-npm-release.yml
vendored
2
.github/workflows/openclaw-npm-release.yml
vendored
@@ -78,7 +78,7 @@ jobs:
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
pnpm-version: ${{ env.PNPM_VERSION }}
|
||||
install-bun: "true"
|
||||
install-bun: "false"
|
||||
use-sticky-disk: "false"
|
||||
|
||||
- name: Ensure version is not already published
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
"ignorePatterns": [
|
||||
"assets/",
|
||||
"dist/",
|
||||
"dist-runtime/",
|
||||
"docs/_layouts/",
|
||||
"extensions/",
|
||||
"node_modules/",
|
||||
"patches/",
|
||||
"pnpm-lock.yaml",
|
||||
@@ -34,36 +34,6 @@
|
||||
"src/auto-reply/reply/export-html/template.js",
|
||||
"src/canvas-host/a2ui/a2ui.bundle.js",
|
||||
"Swabble/",
|
||||
"vendor/",
|
||||
"**/.cache/**",
|
||||
"**/build/**",
|
||||
"**/coverage/**",
|
||||
"**/dist/**",
|
||||
"**/dist-runtime/**",
|
||||
"**/node_modules/**"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"**/*.e2e.test.ts",
|
||||
"**/*.live.test.ts",
|
||||
"**/*test-harness.ts",
|
||||
"**/*test-helpers.ts",
|
||||
"**/*test-support.ts"
|
||||
],
|
||||
"rules": {
|
||||
"typescript/await-thenable": "off",
|
||||
"typescript/no-base-to-string": "off",
|
||||
"typescript/no-explicit-any": "off",
|
||||
"typescript/no-floating-promises": "off",
|
||||
"typescript/no-misused-spread": "off",
|
||||
"typescript/no-redundant-type-constituents": "off",
|
||||
"typescript/no-unnecessary-template-expression": "off",
|
||||
"typescript/unbound-method": "off",
|
||||
"eslint/no-unsafe-optional-chaining": "off"
|
||||
}
|
||||
}
|
||||
"vendor/"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
- Type-check/build: `pnpm build`
|
||||
- TypeScript checks: `pnpm tsgo`
|
||||
- Lint/format: `pnpm check`
|
||||
- Local agent/dev shells default to host-aware `OPENCLAW_LOCAL_CHECK=1` behavior for `pnpm tsgo` and `pnpm lint`; set `OPENCLAW_LOCAL_CHECK_MODE=throttled` to force the lower-memory profile, `OPENCLAW_LOCAL_CHECK_MODE=full` to keep lock-only behavior, or `OPENCLAW_LOCAL_CHECK=0` in CI/shared runs.
|
||||
- Local agent/dev shells default to lower-memory `OPENCLAW_LOCAL_CHECK=1` behavior for `pnpm tsgo` and `pnpm lint`; set `OPENCLAW_LOCAL_CHECK=0` in CI/shared runs.
|
||||
- Format check: `pnpm format` (oxfmt --check)
|
||||
- Format fix: `pnpm format:fix` (oxfmt --write)
|
||||
- Terminology:
|
||||
@@ -296,7 +296,7 @@
|
||||
|
||||
- When working on a GitHub Issue or PR, print the full URL at the end of the task.
|
||||
- When answering questions, respond with high-confidence answers only: verify in code; do not guess.
|
||||
- Carbon: prefer latest published beta over stable when possible; do not switch to stable casually.
|
||||
- Never update the Carbon dependency.
|
||||
- Any dependency with `pnpm.patchedDependencies` must use an exact version (no `^`/`~`).
|
||||
- Patching dependencies (pnpm patches, overrides, or vendored changes) requires explicit approval; do not do this by default.
|
||||
- **Multi-agent safety:** do **not** create/apply/drop `git stash` entries unless explicitly requested (this includes `git pull --rebase --autostash`). Assume other agents may be working; keep unrelated WIP untouched and avoid cross-cutting state changes.
|
||||
|
||||
229
CHANGELOG.md
229
CHANGELOG.md
@@ -4,138 +4,43 @@ Docs: https://docs.openclaw.ai
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Changes
|
||||
|
||||
- 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.
|
||||
- Tools/media generation: preserve intent across auth-backed image, music, and video provider fallback, remap size, aspect ratio, resolution, and duration hints to the closest supported option, and surface explicit provider capabilities plus mode-aware video-to-video support.
|
||||
- Memory/wiki: restore the bundled `memory-wiki` stack with plugin, CLI, sync/query/apply tooling, and memory-host integration for wiki-backed memory workflows.
|
||||
- Providers/Arcee AI: add a bundled Arcee AI provider plugin with Trinity catalog entries, OpenRouter support, and updated onboarding/auth guidance. (#62068) Thanks @arthurbr11.
|
||||
- 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.
|
||||
- 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.
|
||||
- ACP/ACPX plugin: bump the bundled `acpx` pin to `0.5.1` so plugin-local installs and strict version checks pick up the latest published runtime release. (#62148) Thanks @onutc.
|
||||
- Tools/media generation: auto-fallback across auth-backed image, music, and video providers by default, and remap fallback size, aspect ratio, resolution, and duration hints to the closest supported option instead of dropping intent on provider switches.
|
||||
- Tools/media generation: report applied fallback geometry and duration settings consistently in tool results, add a shared normalization contract for image/music/video runtimes, and simplify the bundled image-generation-core runtime test to only verify the plugin-sdk re-export seam.
|
||||
- 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.
|
||||
- Providers/Ollama: detect vision capability from the `/api/show` response and set image input on models that support it so Ollama vision models accept image attachments. (#62193) Thanks @BruceMacD.
|
||||
- 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.
|
||||
- Plugins/memory: add a public memory-artifact export seam to the unified memory capability so companion plugins like `memory-wiki` can bridge the active memory plugin without reaching into `memory-core` internals. Thanks @vincentkoc.
|
||||
- Memory/wiki: add structured claim/evidence fields plus compiled agent digest artifacts so `memory-wiki` behaves more like a persistent knowledge layer and less like markdown-only page storage. Thanks @vincentkoc.
|
||||
- Memory/wiki: add claim-health linting, contradiction clustering, staleness-aware dashboards, and freshness-weighted wiki search so `memory-wiki` can act more like a maintained belief layer than a passive markdown dump. Thanks @vincentkoc.
|
||||
- Memory/wiki: use compiled digest artifacts as the first-pass wiki index for search/get flows, and resolve claim ids back to owning pages so agents can retrieve knowledge by belief identity instead of only by file path. Thanks @vincentkoc.
|
||||
- Memory/wiki: add an opt-in `context.includeCompiledDigestPrompt` flag so memory prompt supplements can append a compact compiled wiki snapshot for legacy prompt assembly and context engines that explicitly consume memory prompt sections. Thanks @vincentkoc.
|
||||
- Memory/wiki: add task-backed `wiki import` with automatic local-file and markdown-vault detection so existing note stores can be backfilled into source pages with shared task progress instead of ad hoc one-off ingest flows. Thanks @vincentkoc.
|
||||
- Memory/wiki: keep imported Obsidian and Logseq notes readable by preserving markdown note bodies plus imported tags, aliases, and link hints instead of flattening every vault note into a fenced text blob. Thanks @vincentkoc.
|
||||
- Memory/wiki: use imported vault tags, aliases, and link hints in the compiled digest and wiki search ranking so imported Obsidian and Logseq notes are easier to recall by their original note metadata. Thanks @vincentkoc.
|
||||
- Memory/wiki: use imported vault aliases and link hints when building `## Related` backlinks so imported Obsidian and Logseq notes can reconnect their note graph after import. Thanks @vincentkoc.
|
||||
- Memory/wiki: let `wiki_get` and metadata updates resolve imported vault titles and aliases directly, so imported notes stay addressable by their original note names instead of only generated paths. Thanks @vincentkoc.
|
||||
- Memory/wiki: upgrade `reports/import-review.md` to flag duplicate imported titles and aliases plus obviously low-signal notes, so large vault imports are easier to triage before promotion or synthesis work. Thanks @vincentkoc.
|
||||
- Memory/wiki: add duplicate-body clustering to `reports/import-review.md` so large vault imports can surface copied or renamed notes even when titles and aliases differ. Thanks @vincentkoc.
|
||||
- Memory/wiki: preserve imported markdown vault relative paths in digest, lookup, and related-link reconstruction so imported note identity survives search and `wiki_get`. Thanks @vincentkoc.
|
||||
- Memory/wiki: auto-detect and import ChatGPT export JSON files as conversation source pages instead of misclassifying them as generic local files. Thanks @vincentkoc.
|
||||
- Plugin SDK/context engines: pass `availableTools` and `citationsMode` into `assemble()`, and expose `buildMemorySystemPromptAddition(...)` so non-legacy context engines can adopt the active memory prompt path without reimplementing it. Thanks @vincentkoc.
|
||||
|
||||
### Fixes
|
||||
|
||||
- Plugins/media: when `plugins.allow` is set, capability fallback now merges bundled capability plugin ids into the allowlist (not only `plugins.entries`), so media understanding providers such as OpenAI-compatible STT load for voice transcription without requiring `openai` in `plugins.allow`. (#62205) Thanks @neeravmakwana.
|
||||
- Auth/OpenAI Codex OAuth: reload fresh on-disk credentials inside the locked refresh path and retry once after `refresh_token_reused` rotates only the stored refresh token, so relogin/restart recovery stops getting stuck on stale cached auth state. Thanks @owen-ever.
|
||||
- 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 `final_answer` text only. (#61729, #61747, #61829, #61855, #61954) Thanks @100yenadmin, @afurm, and @openperf.
|
||||
- Plugins/channels: keep bundled channel artifact and secret-contract loading stable under lazy loading, preserve plugin-schema defaults during install, and fix Windows `file://` plus native-Jiti plugin loader paths so onboarding, doctor, `openclaw secret`, and bundled plugin installs work again. (#61832, #61836, #61853, #61856) Thanks @Zeesejo and @SuperMarioYL.
|
||||
- Auto-reply/media: allow managed generated-media `MEDIA:` 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.
|
||||
- Runtime event trust: mark background `notifyOnExit` 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 `System:` text. (#62003)
|
||||
- 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 `service_tier` injection on OAuth-authenticated stream wrapper requests so Claude OAuth streaming stops failing with HTTP 401. (#60356, #61793)
|
||||
- Control UI: show `/tts` audio replies in webchat, detect mistaken `?token=` auth links with the correct `#token=` hint, and keep Copy, Canvas, and mobile exec-approval UI from covering chat content on narrow screens. (#54842, #61514, #61598) Thanks @neeravmakwana.
|
||||
- TUI: route `/status` 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, @MoerAI, @jwchmodx, and @100yenadmin.
|
||||
- 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.
|
||||
- Memory/wiki: follow `current_node` when importing ChatGPT export mapping trees so imported conversation transcripts stop pulling in stale alternate branches. Thanks @vincentkoc.
|
||||
- Memory/wiki: extract readable text from object-shaped ChatGPT export message parts so imported conversation transcripts stop dropping rich content blocks. Thanks @vincentkoc.
|
||||
- Memory/wiki: preserve conversation turn order for ChatGPT imports when timestamps are missing or tied, so imported transcripts stop scrambling equal-time messages and current-branch lineage. Thanks @vincentkoc.
|
||||
- Memory/wiki: skip hidden and tool-role ChatGPT export messages during import so conversation source pages stop filling up with export-only scaffolding. Thanks @vincentkoc.
|
||||
- Memory/wiki: skip ChatGPT export conversations that end up with no readable visible turns, so imports stop generating empty placeholder source pages from hidden/tool-only records. Thanks @vincentkoc.
|
||||
- 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.
|
||||
- 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.
|
||||
- Agents/exec: preserve explicit `host=node` routing under elevated defaults when `tools.exec.host=auto`, fail loud on invalid elevated cross-host overrides, and keep `strictInlineEval` commands blocked after approval timeouts instead of falling through to automatic execution. (#61739) Thanks @obviyus.
|
||||
- Providers/Ollama: honor the selected provider's `baseUrl` during streaming so multi-Ollama setups stop routing every stream to the first configured Ollama endpoint. (#61678)
|
||||
- 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.
|
||||
- Gateway/status and containers: auto-bind to `0.0.0.0` inside Docker and Podman environments, and probe local TLS gateways over `wss://` with self-signed fingerprint forwarding so container startup and loopback TLS status checks work again. (#61818, #61935) Thanks @openperf and @ThanhNguyxn07.
|
||||
- macOS/gateway version: strip trailing commit metadata from CLI version output before semver parsing so the Mac app recognizes installed gateway versions like `OpenClaw 2026.4.2 (d74a122)` again. (#61111) Thanks @oliviareid-svg.
|
||||
- Discord: recover forwarded referenced message text and attachments when snapshots are missing, use `ws://` 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 @wit-oc.
|
||||
- Slack/threading: keep legacy thread stickiness for real replies when older callers omit `isThreadReply`, while still honoring `replyToMode` for Slack's auto-created top-level `thread_ts`. (#61835) Thanks @kaonash.
|
||||
- Providers/xAI: recognize `api.grok.x.ai` as an xAI-native endpoint again and keep legacy `x_search` auth resolution working so older xAI web-search configs continue to load. (#61377) Thanks @jjjojoj.
|
||||
- Memory/vector recall: surface explicit warnings when `sqlite-vec` 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.
|
||||
- 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.
|
||||
- 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)
|
||||
- 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.
|
||||
- Tools/web_fetch and web_search: fix `TypeError: fetch failed` caused by undici 8.0 enabling HTTP/2 by default; pinned SSRF-guard dispatchers now explicitly set `allowH2: false` to restore HTTP/1.1 behavior and keep the custom DNS-pinning lookup compatible. (#61738, #61777) Thanks @zozo123.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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)
|
||||
- Exec/runtime events: mark background `notifyOnExit` summaries and ACP parent-stream relays as untrusted system events so lower-trust runtime output no longer re-enters later turns as trusted `System:` text.
|
||||
- Hooks/wake: queue direct and mapped wake-hook payloads as untrusted system events so external wake content no longer enters the main session as trusted input. (#62003)
|
||||
- Slack/thread mentions: add `channels.slack.thread.requireExplicitMention` so Slack channels that already require mentions can also require explicit `@bot` mentions inside bot-participated threads. (#58276) Thanks @praktika-engineer.
|
||||
- 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.
|
||||
- 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.
|
||||
- Telegram/doctor: keep top-level access-control fallback in place during multi-account normalization while still promoting legacy default auth into `accounts.default`, so existing named bots keep inherited allowlists without dropping the legacy default bot. (#62263) Thanks @obviyus.
|
||||
- Agents/subagents: honor `sessions_spawn(lightContext: true)` 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.
|
||||
- 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.
|
||||
- Docker/plugins: stop forcing bundled plugin discovery to `/app/extensions` in runtime images so packaged installs use compiled `dist/extensions` artifacts again and Node 24 containers do not boot through source-only plugin entry paths. Fixes #62044. (#62316) Thanks @gumadeiras.
|
||||
- Cron: load `jobId` into `id` when the on-disk store omits `id`, matching doctor migration and fixing `unknown cron job id` for hand-edited `jobs.json`. (#62246) Thanks @neeravmakwana.
|
||||
- Agents/model fallback: classify minimal HTTP 404 API errors (for example `404 status code (no body)`) as `model_not_found` so assistant failures throw into the fallback chain instead of stopping at the first fallback candidate. (#62119) Thanks @neeravmakwana.
|
||||
- Providers/Mistral: send `reasoning_effort` for `mistral/mistral-small-latest` (Mistral Small 4) with thinking-level mapping, and mark the catalog entry as reasoning-capable so adjustable reasoning matches Mistral’s Chat Completions API. (#62162) Thanks @neeravmakwana.
|
||||
- OpenAI TTS/Groq: send `wav` to Groq-compatible speech endpoints, honor explicit `responseFormat` overrides on OpenAI-compatible paths, and only mark voice-note output as voice-compatible when the actual format is `opus`. (#62233) Thanks @neeravmakwana.
|
||||
|
||||
## 2026.4.5
|
||||
|
||||
### Breaking
|
||||
|
||||
- Config: remove legacy public config aliases such as `talk.voiceId` / `talk.apiKey`, `agents.*.sandbox.perSession`, `browser.ssrfPolicy.allowPrivateNetwork`, `hooks.internal.handlers`, and channel/group/room `allow` toggles in favor of the canonical public paths and `enabled`, while keeping load-time compatibility and `openclaw doctor --fix` migration support for existing configs. (#60726) Thanks @vincentkoc.
|
||||
|
||||
### Changes
|
||||
|
||||
- Agents/video generation: add the built-in `video_generate` tool so agents can create videos through configured providers and return the generated media directly in the reply.
|
||||
- Agents/music generation: ignore unsupported optional hints such as `durationSeconds` with a warning instead of hard-failing requests on providers like Google Lyria.
|
||||
- Providers/Arcee AI: add a bundled Arcee AI provider plugin with `ARCEEAI_API_KEY` onboarding, Trinity model catalog (mini, large-preview, large-thinking), OpenAI-compatible API support, and OpenRouter as an alternative auth path. (#62068) Thanks @arthurbr11.
|
||||
- Providers/ComfyUI: add a bundled `comfy` workflow media plugin for local ComfyUI and Comfy Cloud workflows, including shared `image_generate`, `video_generate`, and workflow-backed `music_generate` support, with prompt injection, optional reference-image upload, live tests, and output download.
|
||||
- Tools/music generation: add the built-in `music_generate` tool with bundled Google (Lyria) and MiniMax providers plus workflow-backed Comfy support, including async task tracking and follow-up delivery of finished audio.
|
||||
- Providers: add bundled Qwen, Fireworks AI, and StepFun providers, plus MiniMax TTS, Ollama Web Search, and MiniMax Search integrations for chat, speech, and search workflows. (#60032, #55921, #59318, #54648)
|
||||
- Providers/Amazon Bedrock: add bundled Mantle support plus inference-profile discovery and automatic request-region injection so Bedrock-hosted Claude, GPT-OSS, Qwen, Kimi, GLM, and similar routes work with less manual setup. (#61296, #61299) Thanks @wirjo.
|
||||
- Control UI/multilingual: add localized control UI support for Simplified Chinese, Traditional Chinese, Brazilian Portuguese, German, Spanish, Japanese, Korean, French, Turkish, Indonesian, Polish, and Ukrainian. Thanks @vincentkoc.
|
||||
- Plugins: add plugin-config TUI prompts to guided onboarding/setup flows, and add `openclaw plugins install --force` so existing plugin and hook-pack targets can be replaced without using the dangerous-code override flag. (#60590, #60544)
|
||||
- Control UI/skills: add ClawHub search, detail, and install flows directly in the Skills panel. (#60134) Thanks @samzong.
|
||||
- iOS/exec approvals: add generic APNs approval notifications that open an in-app exec approval modal, fetch command details only after authenticated operator reconnect, and clear stale notification state when the approval resolves. (#60239) Thanks @ngutman.
|
||||
- Matrix/exec approvals: add Matrix-native exec approval prompts with account-scoped approvers, channel-or-DM delivery, and room-thread aware resolution handling. (#58635) Thanks @gumadeiras.
|
||||
- Channels/context visibility: add configurable `contextVisibility` per channel (`all`, `allowlist`, `allowlist_quote`) so supplemental quote, thread, and fetched history context can be filtered by sender allowlists instead of always passing through as received.
|
||||
- Providers/request overrides: add shared model and media request transport overrides across OpenAI-, Anthropic-, Google-, and compatible provider paths, including headers, auth, proxy, and TLS controls. (#60200)
|
||||
- Providers/OpenAI: add forward-compat `openai-codex/gpt-5.4-mini`, an opt-in GPT personality, and provider-owned GPT-5 prompt contributions so Codex/GPT runs stay cache-stable and compatible with bundled catalog lag.
|
||||
- Agents/Claude CLI: expose OpenClaw tools to background Claude CLI runs through a loopback MCP bridge and switch bundled runs to stdin + `stream-json` partial-message streaming so prompts stop riding argv, long replies show live progress, and final session/usage metadata still land cleanly. (#35676) Thanks @mylukin.
|
||||
- ACPX/runtime: embed the ACP runtime directly in the bundled `acpx` plugin, remove the extra external ACP CLI hop, harden live ACP session binding and reuse, and add a generic `reply_dispatch` hook so bundled plugins like ACPX can own reply interception without hardcoded ACP paths in core auto-reply routing. (#61319)
|
||||
- Agents/progress: add experimental structured plan updates and structured execution item events so compatible UIs can show clearer step-by-step progress during long-running runs.
|
||||
- Providers/Anthropic: remove the Claude CLI backend and setup-token from new onboarding, keep existing configured legacy profiles runnable, and have `openclaw doctor` repair or remove stale `anthropic:claude-cli` state during migration.
|
||||
- Tools/video generation: add bundled xAI (`grok-imagine-video`), Alibaba Model Studio Wan, and Runway video providers, plus live-test/default model wiring for all three.
|
||||
- Memory/search: add Amazon Bedrock embeddings for Titan, Cohere, Nova, and TwelveLabs models, with AWS credential-chain auto-detection for `provider: "auto"` and provider-specific dimension controls. Thanks @wirjo.
|
||||
- Providers/Amazon Bedrock Mantle: generate bearer tokens from the AWS credential chain so Mantle auto-discovery can use IAM auth without manually exporting `AWS_BEARER_TOKEN_BEDROCK`. Thanks @wirjo.
|
||||
- Memory/dreaming (experimental): add weighted short-term recall promotion, a `/dreaming` command, Dreams UI, multilingual conceptual tagging, and doctor/status repair support, while refactoring dreaming from competing modes into three cooperative phases (light, deep, REM) with independent schedules and recovery behavior so durable memory promotion can run in the background with less manual setup. (#60569, #60697) Thanks @vignesh07.
|
||||
- Memory/dreaming: add configurable aging controls (`recencyHalfLifeDays`, `maxAgeDays`) plus optional verbose logging so operators can tune recall decay and inspect promotion decisions more easily.
|
||||
- Memory/dreaming: add REM preview tooling (`openclaw memory rem-harness`, `promote-explain`), surface possible lasting truths during REM staging, and make deep promotion replay-safe so reruns reconcile instead of duplicating `MEMORY.md` entries.
|
||||
- Memory/dreaming: write dreaming trail content to top-level `dreams.md` instead of daily memory notes, update `/dreaming` help text to point there, and keep `dreams.md` available for explicit reads without pulling it into default recall. Thanks @davemorin.
|
||||
- Memory/dreaming: add the Dream Diary surface in Dreams, simplify user-facing dreaming config to `enabled` plus optional `frequency`, treat phases as implementation detail in docs/UI, and keep the lobster animation visible above diary content. Thanks @vignesh07.
|
||||
- Agents/video generation: add the built-in `video_generate` tool so agents can create videos through configured providers and return the generated media directly in the reply.
|
||||
- Control UI/multilingual: add localized control UI support for Simplified Chinese, Traditional Chinese, Brazilian Portuguese, German, Spanish, Japanese, Korean, French, Turkish, Indonesian, Polish, and Ukrainian. Thanks @vincentkoc.
|
||||
- iOS/exec approvals: add generic APNs approval notifications that open an in-app exec approval modal, fetch command details only after authenticated operator reconnect, and clear stale notification state when the approval resolves. (#60239) Thanks @ngutman.
|
||||
- Matrix/exec approvals: add Matrix-native exec approval prompts with account-scoped approvers, channel-or-DM delivery, and room-thread aware resolution handling. (#58635) Thanks @gumadeiras.
|
||||
- Control UI/skills: add ClawHub search, detail, and install flows directly in the Skills panel. (#60134) Thanks @samzong.
|
||||
- Plugins: add plugin-config TUI prompts to guided onboarding/setup flows, and add `openclaw plugins install --force` so existing plugin and hook-pack targets can be replaced without using the dangerous-code override flag. (#60590, #60544)
|
||||
- Channels/context visibility: add configurable `contextVisibility` per channel (`all`, `allowlist`, `allowlist_quote`) so supplemental quote, thread, and fetched history context can be filtered by sender allowlists instead of always passing through as received.
|
||||
- Providers: add bundled Qwen, Fireworks AI, and StepFun providers, plus MiniMax TTS, Ollama Web Search, and MiniMax Search integrations for chat, speech, and search workflows. (#60032, #55921, #59318, #54648)
|
||||
- Providers/Amazon Bedrock: add bundled Mantle support plus inference-profile discovery and automatic request-region injection so Bedrock-hosted Claude, GPT-OSS, Qwen, Kimi, GLM, and similar routes work with less manual setup. (#61296, #61299) Thanks @wirjo.
|
||||
- Providers/request overrides: add shared model and media request transport overrides across OpenAI-, Anthropic-, Google-, and compatible provider paths, including headers, auth, proxy, and TLS controls. (#60200)
|
||||
- Prompt caching: keep prompt prefixes more reusable across transport fallback, deterministic MCP tool ordering, compaction, embedded image history, normalized system-prompt fingerprints, `openclaw status --verbose` cache diagnostics, and the removal of duplicate in-band tool inventories from agent system prompts so follow-up turns hit cache more reliably. (#58036, #58037, #58038, #59054, #60603, #60691) Thanks @bcherny and @vincentkoc.
|
||||
- Providers/OpenAI: add forward-compat `openai-codex/gpt-5.4-mini`, an opt-in GPT personality, and provider-owned GPT-5 prompt contributions so Codex/GPT runs stay cache-stable and compatible with bundled catalog lag.
|
||||
- Providers/Anthropic: remove the Claude CLI backend and setup-token from new onboarding, keep existing configured legacy profiles runnable, and have `openclaw doctor` repair or remove stale `anthropic:claude-cli` state during migration.
|
||||
- Agents/progress: add experimental structured plan updates and structured execution item events so compatible UIs can show clearer step-by-step progress during long-running runs.
|
||||
- Agents/Claude CLI: expose OpenClaw tools to background Claude CLI runs through a loopback MCP bridge and switch bundled runs to stdin + `stream-json` partial-message streaming so prompts stop riding argv, long replies show live progress, and final session/usage metadata still land cleanly. (#35676) Thanks @mylukin.
|
||||
- ACPX/runtime: embed the ACP runtime directly in the bundled `acpx` plugin, remove the extra external ACP CLI hop, harden live ACP session binding and reuse, and add a generic `reply_dispatch` hook so bundled plugins like ACPX can own reply interception without hardcoded ACP paths in core auto-reply routing. (#61319)
|
||||
- Config/schema: enrich the exported `openclaw config schema` JSON Schema with field titles and descriptions so editors, agents, and other schema consumers receive the same config help metadata. (#60067) Thanks @solavrc.
|
||||
- Agents/cache: diagnostics: add prompt-cache break diagnostics, trace live cache scenarios through embedded runner paths, and show cache reuse explicitly in `openclaw status --verbose`. Thanks @vincentkoc.
|
||||
- Agents/cache: stabilize cache-relevant system prompt fingerprints by normalizing equivalent structured prompt whitespace, line endings, hook-added system context, and runtime capability ordering so semantically unchanged prompts reuse KV/cache more reliably. Thanks @vincentkoc.
|
||||
- Agents/tool prompts: remove the duplicate in-band tool inventory from agent system prompts so tool-calling models rely on the structured tool definitions as the single source of truth, improving prompt stability and reducing stale tool guidance.
|
||||
- Config/schema: enrich the exported `openclaw config schema` JSON Schema with field titles and descriptions so editors, agents, and other schema consumers receive the same config help metadata. (#60067) Thanks @solavrc.
|
||||
- Tools/video generation: add bundled xAI (`grok-imagine-video`) and Alibaba Model Studio Wan video providers, plus live-test/default model wiring for both.
|
||||
- Providers/CLI: remove bundled CLI text-provider backends and the `agents.defaults.cliBackends` surface, while keeping ACP harness sessions and Gemini media understanding on the native bundled providers.
|
||||
- Matrix/exec approvals: clarify unavailable-approval replies so Matrix no longer claims chat approvals are unsupported when native exec approvals are merely unconfigured. (#61424) Thanks @gumadeiras.
|
||||
- Providers/OpenAI Codex: add forward-compat `openai-codex/gpt-5.4-mini` synthesis across provider runtime, model catalog, and model listing so Codex mini works before bundled Pi catalog updates land.
|
||||
- Providers/OpenAI: add an opt-in GPT personality and move GPT-5 prompt tuning onto provider-owned system-prompt contributions so cache-stable guidance stays above the prompt cache boundary and embedded runner paths reuse the same provider-specific prompt behavior.
|
||||
- Docs/IRC: replace public IRC hostname examples with `irc.example.com` and recommend private servers for bot coordination while listing common public networks for intentional use.
|
||||
- Memory/dreaming: group nearby daily-note lines into short coherent chunks before staging them for dreaming, so one-off context from recent notes reaches REM/deep with better evidence and less line-level noise.
|
||||
- Memory/dreaming: drop generic date/day headings from daily-note chunk prefixes while keeping meaningful section labels, so staged snippets stay cleaner and more reusable. (#61597) Thanks @mbelinky.
|
||||
- Plugins/Lobster: run bundled Lobster workflows in process instead of spawning the external CLI, reducing transport overhead and unblocking native runtime integration. (#61523) Thanks @mbelinky.
|
||||
- Plugins/Lobster: harden managed resume validation so invalid TaskFlow resume calls fail earlier, and memoize embedded runtime loading per runner while keeping failed loads retryable. (#61566) Thanks @mbelinky.
|
||||
- Agents/bootstrap: add opt-in `agents.defaults.contextInjection: "continuation-skip"` so safe continuation turns can skip workspace bootstrap re-injection, while heartbeat runs and post-compaction retries still rebuild context when needed. Fixes #9157. Thanks @cgdusek.
|
||||
- Memory/dreaming: write dreaming trail content to top-level `DREAMS.md` instead of daily memory notes, update `/dreaming` help text to point there, and keep `DREAMS.md` available for explicit reads without pulling it into default recall. Thanks @davemorin.
|
||||
|
||||
### Fixes
|
||||
|
||||
- Control UI/chat: show `/tts` and other local audio-only slash replies in webchat by embedding local audio in the assistant message and rendering `<audio>` controls instead of dropping empty-text finals. Fixes #61564. (#61598) Thanks @neeravmakwana.
|
||||
- Security: preserve restrictive plugin-only tool allowlists, require owner access for `/allowlist add` and `/allowlist remove`, fail closed when `before_tool_call` hooks crash, block browser SSRF redirect bypasses earlier, and keep non-interactive auth-choice inference scoped to bundled and already-trusted plugins. (#58476, #59836, #59822, #58771, #59120) Thanks @eleqtrizit and @pgondhi987.
|
||||
- Providers/OpenAI: make GPT-5 and Codex runs act sooner with lower-verbosity defaults, visible progress during tool work, and a one-shot retry when a turn only narrates the plan instead of taking action.
|
||||
- Providers/OpenAI and reply delivery: preserve native `reasoning.effort: "none"` and strict schemas where supported, add GPT-5.4 assistant `phase` metadata across replay and the Gateway `/v1/responses` layer, and keep commentary buffered until `final_answer` so web chat, session previews, embedded replies, and Telegram partials stop leaking planning text. Fixes #59150, #59643, #61282.
|
||||
@@ -143,8 +48,6 @@ Docs: https://docs.openclaw.ai
|
||||
- Telegram: restore DM voice-note preflight transcription so direct-message audio stops arriving as raw `<media:audio>` placeholders. (#61008) Thanks @manueltarouca.
|
||||
- Telegram/reasoning: only create a Telegram reasoning preview lane when the session is explicitly `reasoning:stream`, so hidden `<think>` traces from streamed replies stop surfacing as chat previews on normal sessions. Thanks @vincentkoc.
|
||||
- Telegram/native command menu: trim long menu descriptions before dropping commands so sub-100 command sets can still fit Telegram's payload budget and keep more `/` entries visible. (#61129) Thanks @neeravmakwana.
|
||||
- Telegram/startup: bound `deleteWebhook`, `getMe`, and `setWebhook` startup requests while keeping the longer `getUpdates` poll timeout, so wedged Telegram control-plane calls stop hanging startup indefinitely. (#61601) Thanks @neeravmakwana.
|
||||
- Agents/failover: classify Anthropic "extra usage" exhaustion as billing so same-turn model fallback still triggers when Claude blocks long-context requests on usage limits. (#61608) Thanks @neeravmakwana.
|
||||
- Discord: keep REST, webhook, and monitor traffic on the configured proxy, preserve component-only media sends, honor `@everyone` and `@here` mention gates, keep ACK reactions on the active account, and split voice connect/playback timeouts so auto-join is more reliable. (#57465, #60361, #60345) Thanks @geekhuashan.
|
||||
- Discord/reply tags: strip leaked `[[reply_to_current]]` control tags from preview text and honor explicit reply-tag threading during final delivery, so Discord replies stay attached to the triggering message instead of printing reply metadata into chat.
|
||||
- Discord/replies: replace the unshipped `replyToOnlyWhenBatched` flag with `replyToMode: "batched"` so native reply references only attach on debounced multi-message turns while explicit reply tags still work.
|
||||
@@ -175,7 +78,6 @@ Docs: https://docs.openclaw.ai
|
||||
- Windows/restart: fall back to the installed Startup-entry launcher when the scheduled task was never registered, so `/restart` can relaunch the gateway on Windows setups where `schtasks` install fell back during onboarding. (#58943) Thanks @imechZhangLY.
|
||||
- Windows/restart: clean up stale gateway listeners before Windows self-restart and treat listener and argv probe failures as inconclusive, so scheduled-task relaunch no longer falls into an `EADDRINUSE` retry loop. (#60480) Thanks @arifahmedjoy.
|
||||
- Update/npm: prefer the npm binary that owns the installed global OpenClaw prefix so mixed Homebrew-plus-nvm setups update the right install. (#60153) Thanks @jayeshp19.
|
||||
- Agents/music and video generation: add `tools.media.asyncCompletion.directSend` as an opt-in direct-delivery path for finished async media tasks, while keeping the legacy requester-session wake/model-delivery flow as the default.
|
||||
- CLI/skills JSON: route `skills list --json`, `skills info --json`, and `skills check --json` output to stdout instead of stderr so machine-readable consumers receive JSON on the expected stream again. (#60914; fixes #57599; landed from contributor PR #57611 by @Aftabbs) Thanks @Aftabbs.
|
||||
- CLI/Commander: preserve Commander-computed exit codes for argument and help-error paths, and cover the user-argv parse mode in the regression tests so invalid CLI invocations no longer report success when exits are intercepted. (#60923) Thanks @Linux2010.
|
||||
- Cron: replay interrupted recurring jobs on the first gateway restart instead of waiting for a second restart. (#60583) Thanks @joelnishanth.
|
||||
@@ -209,7 +111,6 @@ Docs: https://docs.openclaw.ai
|
||||
- Config/All Settings: keep the raw config view intact when sensitive fields are blank instead of corrupting or dropping the rendered snapshot. (#28214) Thanks @solodmd.
|
||||
- Plugin SDK/facades: back-fill bundled plugin facade sentinels before plugin-id tracking re-enters config loading, so CLI/provider startup no longer crashes with `shouldNormalizeGoogleProviderConfig is not a function` or other empty-facade reads during bundled plugin re-entry. Thanks @adam91holt.
|
||||
- Plugins/facades: back-fill facade sentinels before tracked-plugin resolution re-enters config loading, so facade exports stay defined during circular provider normalization. (#61180) Thanks @adam91holt.
|
||||
- QA lab: restore typed mock OpenAI gateway config wiring so QA-lab config helpers compile cleanly again and `pnpm check` / `pnpm build` stay green.
|
||||
- Discord/image generation: include the real generated `MEDIA:` paths in tool output and avoid duplicate plain-output media requeueing so Discord image replies stop pointing at missing local files.
|
||||
- Slack: route live DM replies back to the concrete inbound DM channel while keeping persisted routing metadata user-scoped, so normal assistant replies stop disappearing when pairing and system messages still arrive. (#59030) Thanks @afurm.
|
||||
- Discord/reply tags: strip leaked `[[reply_to_current]]` control tags from preview text and honor explicit reply-tag threading during final delivery, so Discord replies stay attached to the triggering message instead of printing reply metadata into chat.
|
||||
@@ -221,8 +122,6 @@ Docs: https://docs.openclaw.ai
|
||||
- Discord: keep REST, webhook, and monitor traffic on the configured proxy, preserve component-only media sends, honor `@everyone` and `@here` mention gates, keep ACK reactions on the active account, and split voice connect/playback timeouts so auto-join is more reliable. (#57465, #60361, #60345) Thanks @geekhuashan.
|
||||
- WhatsApp: restore `channels.whatsapp.blockStreaming` and reset watchdog timeouts after reconnect so quiet chats stop falling into reconnect loops. (#60007, #60069) Thanks @MonkeyLeeT and @mcaxtr.
|
||||
- Memory: keep `memory-core` builtin embedding registration on the already-registered path so selecting `memory-core` no longer recurses through plugin discovery and crashes during startup. (#61402) Thanks @ngutman.
|
||||
- Agents/tool results: keep large `read` outputs visible longer, preserve the latest `read` output when older tool output can absorb the overflow budget, and fall back to Pi's normal overflow compaction/retry path before replacing a fresh `read` with a compacted stub. Thanks @vincentkoc.
|
||||
- Memory/QMD: prefer modern `qmd collection add --glob`, accept newer single-line JSON hit metadata while keeping legacy line fields, refresh QMD docs/doctor install guidance and model-override guidance, and keep older QMD releases working. Thanks @vincentkoc.
|
||||
- MS Teams: download inline DM images via Graph API and preserve channel reply threading in proactive fallback. (#52212, #55198) Thanks @Ted-developer and @hyojin.
|
||||
- MS Teams: replace the deprecated Teams SDK HttpPlugin stub with `httpServerAdapter` so recurring gateway deprecation warnings stop firing and the Express 5 compatibility workaround stays on the supported SDK path. (#60939) Thanks @coolramukaka-sys.
|
||||
- Matrix/exec approvals: anchor seeded approval reactions to the primary Matrix prompt event, resolve them from event metadata instead of prompt text, and clean up chunked approval prompts correctly. (#60931) Thanks @gumadeiras.
|
||||
@@ -321,95 +220,6 @@ Docs: https://docs.openclaw.ai
|
||||
- Plugins: suppress trust-warning noise during non-activating snapshot and CLI metadata loads. (#61427) Thanks @gumadeiras.
|
||||
- Agents/video generation: accept `agents.defaults.videoGenerationModel` in strict config validation and `openclaw config set/get`, so gateways using `video_generate` no longer fail to boot after enabling a video model.
|
||||
- Matrix/streaming: add a quiet preview mode for streamed Matrix replies, keep legacy `partial` preview-first behavior, and finalize quiet media captions correctly so previews stop notifying early without dropping final text semantics. (#61450) Thanks @gumadeiras.
|
||||
- Agents/compaction: skip redundant partial summarization when no messages were oversized, so the same transcript is not summarized twice after a full summarization failure. Fixes #61465. (#61603) Thanks @neeravmakwana.
|
||||
- Gateway/shutdown: bound websocket-server shutdown even when no tracked clients remain, so gateway restarts stop hanging until the watchdog kills the process. (#61565) Thanks @mbelinky.
|
||||
- Control UI/multilingual: localize the remaining shared channel, instances, nodes, and gateway-confirmation strings so the dashboard stops mixing translated UI with hardcoded English labels. Thanks @vincentkoc.
|
||||
- Discord/media: raise the default inbound and outbound media cap to `100MB` so Discord matches Telegram more closely and larger attachments stop failing on the old low default.
|
||||
- Matrix: keep direct transport requests on the pinned dispatcher by routing them through undici runtime fetch, so Matrix clients resume syncing on newer runtimes without dropping the validated address binding. (#61595) Thanks @gumadeiras.
|
||||
- Plugins/facades: resolve globally installed bundled-plugin runtime facades from registry roots so bundled channels like LINE still boot when the winning plugin install lives under the global extensions directory with an encoded scoped folder name. (#61297) Thanks @openperf.
|
||||
- Matrix: avoid failing startup when token auth already knows the user ID but still needs optional device metadata, retry transient auth bootstrap requests, and backfill missing device IDs after startup while keeping unknown-device storage reuse conservative until metadata is repaired. (#61383) Thanks @gumadeiras.
|
||||
- Agents/exec: stop streaming `tool_execution_update` events after an exec session backgrounds, preventing delayed background output from hitting a stale listener and crashing the gateway while keeping the output available through `process poll/log`. (#61627) Thanks @openperf.
|
||||
- Matrix: pass configured `deviceId` through health probes and keep probe-only client setup out of durable Matrix storage, so health checks preserve the correct device identity without rewriting `storage-meta.json` or related probe state on disk. (#61581) Thanks @MoerAI.
|
||||
||||||| parent of b4694a4ac7 (Telegram: add outbound chunker regression coverage)
|
||||
- Image generation/build: write stable runtime alias files into `dist/` and route provider-auth runtime lookups through those aliases so image-generation providers keep resolving auth/runtime modules after rebuilds instead of crashing on missing hashed chunk files.
|
||||
- Config/runtime: pin the first successful config load in memory for the running process and refresh that snapshot on successful writes/reloads, so hot paths stop reparsing `openclaw.json` between watcher-driven swaps.
|
||||
- Config/legacy cleanup: stop probing obsolete alternate legacy config names and service labels during local config/service detection, while keeping the active `~/.openclaw/openclaw.json` path canonical.
|
||||
- ACP/sessions_spawn: register ACP child runs for completion tracking and lifecycle cleanup, and make registration-failure cleanup explicitly best-effort so callers do not assume an already-started ACP turn was fully aborted. (#40885) Thanks @xaeon2026 and @vincentkoc.
|
||||
- ACP/tasks: mark cleanly exited ACP runs as blocked when they end on deterministic write or authorization blockers, and wake the parent session with a follow-up instead of falsely reporting success.
|
||||
- ACPX/runtime: derive the bundled ACPX expected version from the extension package metadata instead of hardcoding a separate literal, so plugin-local ACPX installs stop drifting out of health-check parity after version bumps. (#49089) Thanks @jiejiesks and @vincentkoc.
|
||||
- Gateway/auth: make local-direct `trusted-proxy` fallback require the configured shared token instead of silently authenticating same-host callers, while keeping same-host reverse proxy identity-header flows on the normal trusted-proxy path. Thanks @zhangning-agent and @vincentkoc.
|
||||
- Memory/QMD: send MCP `query` collection filters as the upstream `collections` array instead of the legacy singular `collection` field, so mcporter-backed QMD 1.1+ searches still scope correctly after the unified `query` tool migration. (#54728) Thanks @armanddp and @vincentkoc.
|
||||
- Memory/QMD: keep `qmd embed` active in `search` mode too, so BM25-first setups still build a complete index for later vector and hybrid retrieval. (#54509) Thanks @hnshah and @vincentkoc.
|
||||
- Memory/QMD: point `QMD_CONFIG_DIR` at the nested `xdg-config/qmd` directory so per-agent collection config resolves correctly. (#39078) Thanks @smart-tinker and @vincentkoc.
|
||||
- Memory/QMD: include deduplicated default plus per-agent `memorySearch.extraPaths` when building QMD custom collections, so shared and agent-specific extra roots both get indexed consistently. (#57315) Thanks @Vitalcheffe and @vincentkoc.
|
||||
- Memory/session indexer: include `.jsonl.reset.*` and `.jsonl.deleted.*` transcripts in the memory host session scan while still excluding `.jsonl.bak.*` compaction backups and lock files, so memory search sees archived session history without duplicating stale snapshots. Thanks @hclsys and @vincentkoc.
|
||||
- Agents/sandbox: honor `tools.sandbox.tools.alsoAllow`, let explicit sandbox re-allows remove matching built-in default-deny tools, and keep sandbox explain/error guidance aligned with the effective sandbox tool policy. (#54492) Thanks @ngutman.
|
||||
- LINE/ACP: add current-conversation binding and inbound binding-routing parity so `/acp spawn ... --thread here`, configured ACP bindings, and active conversation-bound ACP sessions work on LINE like the other conversation channels.
|
||||
- LINE/markdown: preserve underscores inside Latin, Cyrillic, and CJK words when stripping markdown, while still removing standalone `_italic_` markers on the shared text-runtime path used by LINE and TTS. (#47465) Thanks @jackjin1997.
|
||||
- TTS/Microsoft: auto-switch the default Edge voice to Chinese for CJK-dominant text without overriding explicitly selected Microsoft voices. (#52355) Thanks @extrasmall0.
|
||||
- Agents/context pruning: count supplementary-plane CJK characters with the shared code-point-aware estimator so context pruning stops underestimating Japanese and Chinese text that uses Extension B ideographs. (#39985) Thanks @Edward-Qiang-2024.
|
||||
- Slack/status reactions: add a reaction lifecycle for queued, thinking, tool, done, and error phases in Slack monitors, with safer cleanup so queued ack reactions stay correct across silent runs, pre-reply failures, and delayed transitions. (#56430) Thanks @hsiaoa.
|
||||
- macOS/local gateway: stop OpenClaw.app from killing healthy local gateway listeners after startup by recognizing the current `openclaw-gateway` process title and using the current `openclaw gateway` launch shape.
|
||||
- Gateway/OpenAI compatibility: accept flat Responses API function tool definitions on `/v1/responses` and preserve `strict` when normalizing hosted tools into the embedded runner, so spec-compliant clients like Codex no longer fail validation or silently lose strict tool enforcement. Thanks @malaiwah and @vincentkoc.
|
||||
- Memory/QMD: resolve slugified `memory_search` file hints back to the indexed filesystem path before returning search hits, so `memory_get` works again for mixed-case and spaced paths. (#50313) Thanks @erra9x.
|
||||
- OpenAI/Codex fast mode: map `/fast` to priority processing on native OpenAI and Codex Responses endpoints instead of rewriting reasoning settings, and document the exact endpoint and override behavior.
|
||||
- Memory/QMD: weight CJK-heavy text correctly when estimating chunk sizes, preserve surrogate-pair characters during fine splits, and keep long Latin lines on the old chunk boundaries so memory indexing produces better-sized chunks for CJK notes. (#40271) Thanks @AaronLuo00.
|
||||
- Security/LINE: make webhook signature validation run the timing-safe compare even when the supplied signature length is wrong, closing a small timing side-channel. (#55663) Thanks @gavyngong.
|
||||
- LINE/status: stop `openclaw status` from warning about missing credentials when sanitized LINE snapshots are already configured, while still surfacing whether the missing field is the token or secret. (#45701) Thanks @tamaosamu.
|
||||
- Gateway/health: carry webhook-vs-polling account mode from channel descriptors into runtime snapshots so passive channels like LINE and BlueBubbles skip false stale-socket health failures. (#47488) Thanks @karesansui-u.
|
||||
- Agents/MCP: reuse bundled MCP runtimes across turns in the same session, while recreating them when MCP config changes and disposing stale runtimes cleanly on session rollover. (#55090) Thanks @allan0509.
|
||||
- Memory/QMD: honor `memory.qmd.update.embedInterval` even when regular QMD update cadence is disabled or slower by arming a dedicated embed-cadence maintenance timer, while avoiding redundant timers when regular updates are already frequent enough. (#37326) Thanks @barronlroth.
|
||||
- Memory/QMD: add `memory.qmd.searchTool` as an exact mcporter tool override, so custom QMD MCP tools such as `hybrid_search` can be used without weakening the validated `searchMode` config surface. (#27801) Thanks @keramblock.
|
||||
- Memory/QMD: keep reset and deleted session transcripts in QMD session export so daily session resets do not silently drop most historical recall from `memory_search`. (#30220) Thanks @pushkarsingh32.
|
||||
- Memory/QMD: rebind collections when QMD reports a changed pattern but omits path metadata, so config pattern changes stop being silently ignored on restart. (#49897) Thanks @Madruru.
|
||||
- Memory/QMD: warn explicitly when `memory.backend=qmd` is configured but the `qmd` binary is missing, so doctor and runtime fallback no longer fail as a silent builtin downgrade. (#50439) Thanks @Jimmy-xuzimo and @vincentkoc.
|
||||
- Memory/QMD: pass a direct-session key on `openclaw memory search` so CLI QMD searches no longer get denied as `session=<none>` under direct-only scope defaults. (#43517) Thanks @waynecc-at and @vincentkoc.
|
||||
- Memory/QMD: keep `memory_search` session-hit paths roundtrip-safe when exported session markdown lives under the workspace `qmd/` directory, so `memory_get` can read the exact returned path instead of failing on the generic `qmd/sessions/...` alias. (#43519) Thanks @holgergruenhagen and @vincentkoc.
|
||||
- Agents/memory flush: keep daily memory flush files append-only during embedded attempts so compaction writes do not overwrite earlier notes. (#53725) Thanks @HPluseven.
|
||||
- Web UI/markdown: stop bare auto-links from swallowing adjacent CJK text while preserving valid mixed-script path and query characters in rendered links. (#48410) Thanks @jnuyao.
|
||||
- BlueBubbles/iMessage: coalesce URL-only inbound messages with their link-preview balloon again so sharing a bare link no longer drops the URL from agent context. Thanks @vincentkoc.
|
||||
- Sandbox/browser: install `fonts-noto-cjk` in the sandbox browser image so screenshots render Chinese, Japanese, and Korean text correctly instead of tofu boxes. Fixes #35597. Thanks @carrotRakko and @vincentkoc.
|
||||
- Memory/FTS: add configurable trigram tokenization plus short-CJK substring fallback so memory search can find Chinese, Japanese, and Korean text without breaking mixed long-and-short queries. Thanks @carrotRakko.
|
||||
- Hooks/config: accept runtime channel plugin ids in `hooks.mappings[].channel` (for example `feishu`) instead of rejecting non-core channels during config validation. (#56226) Thanks @AiKrai001.
|
||||
- TUI/chat: keep optimistic outbound user messages visible during active runs by deferring local-run binding until the first gateway chat event reveals the real run id, preventing premature history reloads from wiping pending local sends. (#54722) Thanks @seanturner001.
|
||||
- TUI/model picker: keep searchable `/model` and `/models` input mode from hijacking `j`/`k` as navigation keys, and harden width bounds under `m`-filtered model lists so search no longer crashes on long rows. (#30156) Thanks @briannicholls.
|
||||
- Agents/Kimi: preserve already-valid Anthropic-compatible tool call argument objects while still clearing cached repairs when later trailing junk exceeds the repair allowance. (#54491) Thanks @yuanaichi.
|
||||
- Docker/setup: force BuildKit for local image builds (including sandbox image builds) so `./docker-setup.sh` no longer fails on `RUN --mount=...` when hosts default to Docker's legacy builder. (#56681) Thanks @zhanghui-china.
|
||||
- Control UI/agents: auto-load agent workspace files on initial Files panel open, and populate overview model/workspace/fallbacks from effective runtime agent metadata so defaulted models no longer show as `Not set`. (#56637) Thanks @dxsx84.
|
||||
- Control UI/slash commands: make `/steer` and `/redirect` work from the chat command palette with visible pending state for active-run `/steer`, correct redirected-run tracking, and a single canonical `/steer` entry in the command menu. (#54625) Thanks @fuller-stack-dev.
|
||||
- Exec/runtime: default implicit exec to `host=auto`, resolve that target to sandbox only when a sandbox runtime exists, keep explicit `host=sandbox` fail-closed without sandbox, and show `/exec` effective host state in runtime status/docs.
|
||||
- Exec: fail closed when the implicit sandbox host has no sandbox runtime, and stop denied async approval followups from reusing prior command output from the same session. (#56800) Thanks @scoootscooob.
|
||||
- Exec/approvals: infer Discord and Telegram exec approvers from existing owner config when `execApprovals.approvers` is unset, extend the default approval window to 30 minutes, and clarify approval-unavailable guidance so approvals do not appear to silently disappear.
|
||||
- Exec/node: stop gateway-side workdir fallback from rewriting explicit `host=node` cwd values to the gateway filesystem, so remote node exec approval and runs keep using the intended node-local directory. (#50961) Thanks @openperf.
|
||||
- Plugins/ClawHub: sanitize temporary archive filenames for scoped package names and slash-containing skill slugs so `openclaw plugins install @scope/name` no longer fails with `ENOENT` during archive download. (#56452) Thanks @soimy.
|
||||
- Telegram/polling: keep the watchdog from aborting long-running reply delivery by treating recent non-polling API activity as bounded liveness instead of a hard stall. (#56343) Thanks @openperf.
|
||||
- Memory/FTS: keep provider-less keyword hits visible at the default memory-search threshold, so FTS-only recall works without requiring `--min-score 0`. (#56473) Thanks @opriz.
|
||||
- Memory/LanceDB: resolve runtime dependency manifest lookup from the bundled `extensions/memory-lancedb` path (including flattened dist chunks) so startup no longer fails with a missing `@lancedb/lancedb` dependency error. (#56623) Thanks @LUKSOAgent.
|
||||
- Tools/web_search: localize the shared search cache to module scope so same-process global symbol lookups can no longer inspect or mutate cached web-search responses. Thanks @vincentkoc.
|
||||
- Agents/silent turns: fail closed on silent memory-flush runs so narrated `NO_REPLY` self-talk cannot stream or finalize into external replies even when block streaming is enabled. (#52593)
|
||||
- Browser/plugins: auto-enable the bundled browser plugin when browser config or browser tool policy already references it, and show a clearer CLI error when `plugins.allow` excludes `browser`.
|
||||
- Matrix/plugin loading: ship and source-load the crypto bootstrap runtime sidecar correctly so current `main` stops warning about failed Matrix bootstrap loads and `matrix/index` plugin-id mismatches on every invocation. (#53298) thanks @keithce.
|
||||
- iOS/Live Activities: mark the `ActivityKit` import in `LiveActivityManager.swift` as `@preconcurrency` so Xcode 26.4 / Swift 6 builds stop failing on strict concurrency checks. (#57180) Thanks @ngutman.
|
||||
- Plugins/Matrix: mirror the Matrix crypto WASM runtime dependency into the root packaged install and enforce root/plugin dependency parity so bundled Matrix E2EE crypto resolves correctly in shipped builds. (#57163) Thanks @gumadeiras.
|
||||
- Plugins/CLI: add descriptor-backed lazy plugin CLI registration so Matrix can keep its CLI module lazy-loaded without dropping `openclaw matrix ...` from parse-time command registration. (#57165) Thanks @gumadeiras.
|
||||
- Plugins/CLI: collect root-help plugin descriptors through a dedicated non-activating CLI metadata path so enabled plugins keep validated config semantics without triggering runtime-only plugin registration work, while preserving runtime CLI command registration for legacy channel plugins that still wire commands from full registration. (#57294) thanks @gumadeiras.
|
||||
- Anthropic/OAuth: inject `/fast` `service_tier` hints for direct `sk-ant-oat-*` requests so OAuth-authenticated Anthropic runs stop missing the same overload-routing signal as API-key traffic. Fixes #55758. Thanks @Cypherm and @vincentkoc.
|
||||
- Anthropic/service tiers: support explicit `serviceTier` model params for direct Anthropic requests and let them override `/fast` defaults when both are set. (#45453) Thanks @vincentkoc.
|
||||
- Auto-reply/fast: accept `/fast status` on the directive-only path, align help/status text with the documented `status|on|off` syntax, and keep current-state replies consistent across command surfaces. Fixes #46095. Thanks @weissfl and @vincentkoc.
|
||||
- Telegram/native commands: prefix native command menu callback payloads and preserve `CommandSource: "native"` when Telegram replays them through callback queries, so `/fast` and other native command menus keep working even when text-command routing is disabled. Thanks @vincentkoc.
|
||||
- Docs/anchors: fix broken English docs links and make Mint anchor audits run against the English-source docs tree. (#57039) thanks @velvet-shark.
|
||||
- Cron/announce: preserve all deliverable text payloads for announce mode instead of collapsing to the last chunk, so multi-line cron reports deliver in full to Telegram forum topics.
|
||||
- Harden async approval followup delivery in webchat-only sessions (#57359) Thanks @joshavant.
|
||||
- Status: fix cache hit rate exceeding 100% by deriving denominator from prompt-side token fields instead of potentially undersized totalTokens. Fixes #26643.
|
||||
- Config/update: stop `openclaw doctor` write-backs from persisting plugin-injected channel defaults, so `openclaw update` no longer seeds config keys that later break service refresh validation. (#56834) Thanks @openperf.
|
||||
- Agents/Anthropic failover: treat Anthropic `api_error` payloads with `An unexpected error occurred while processing the response` as transient so retry/fallback can engage instead of surfacing a terminal failure. (#57441) Thanks @zijiess and @vincentkoc.
|
||||
- Agents/compaction: keep late compaction-retry rejections handled after the aggregate timeout path wins without swallowing real pre-timeout wait failures, so timed-out retries no longer surface an unhandled rejection on later unsubscribe. (#57451) Thanks @mpz4life and @vincentkoc.
|
||||
- Matrix/delivery recovery: treat Synapse `User not in room` replay failures as permanent during startup recovery so poisoned queued messages move to `failed/` instead of crash-looping Matrix after restart. (#57426) thanks @dlardo.
|
||||
- Plugins/facades: guard bundled plugin facade loads with a cache-first sentinel so circular re-entry stops crashing `xai`, `sglang`, and `vllm` during gateway plugin startup. (#57508) Thanks @openperf.
|
||||
- Agents/MCP: dispose bundled MCP runtimes after one-shot `openclaw agent --local` runs finish, while preserving bundled MCP state across in-run retries so local JSON runs exit cleanly without restarting stateful MCP tools mid-run.
|
||||
- Gateway/OpenAI HTTP: restore default operator scopes for bearer-authenticated requests that omit `x-openclaw-scopes`, so headless `/v1/chat/completions` and session-history callers work again after the recent method-scope hardening. (#57596) Thanks @openperf.
|
||||
- Gateway/attachments: offload large inbound images without leaking `media://` markers into text-only runs, preserve mixed attachment order for model input/transcripts, and fail closed when model image capability cannot be resolved. (#55513) Thanks @Syysean.
|
||||
- Telegram/outbound chunking: use static markdown chunking when Telegram runtime state is unavailable so long outbound Telegram messages still split correctly after cold starts. (#57816) Thanks @ForestDengHK.
|
||||
|
||||
## 2026.4.2
|
||||
|
||||
@@ -975,7 +785,6 @@ Docs: https://docs.openclaw.ai
|
||||
- Security/path resolution: prefer non-user-writable absolute helper binaries for OpenClaw CLI, ffmpeg, and OpenSSL resolution so PATH hijacks cannot replace trusted helpers with attacker-controlled executables.
|
||||
- Security/gateway command scopes: require `operator.admin` before Telegram target writeback and Talk Voice `/voice set` config writes persist through gateway message flows.
|
||||
- Security/OpenShell mirror: exclude workspace `hooks/` from mirror sync so untrusted sandbox files cannot become trusted host hooks on gateway startup.
|
||||
- Exec env policy: block Mercurial config redirects, Rust compiler wrappers, and GNU make flag env vars in host exec sanitization so inherited env and request-scoped overrides cannot redirect build-tool execution.
|
||||
|
||||
## 2026.3.24-beta.2
|
||||
|
||||
|
||||
21
Dockerfile
21
Dockerfile
@@ -62,10 +62,9 @@ RUN corepack enable
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
||||
COPY openclaw.mjs ./
|
||||
COPY ui/package.json ./ui/package.json
|
||||
COPY patches ./patches
|
||||
COPY scripts/postinstall-bundled-plugins.mjs scripts/npm-runner.mjs scripts/windows-cmd-helpers.mjs ./scripts/
|
||||
COPY scripts/postinstall-bundled-plugins.mjs scripts/npm-runner.mjs ./scripts/
|
||||
|
||||
COPY --from=ext-deps /out/ ./${OPENCLAW_BUNDLED_PLUGIN_DIR}/
|
||||
|
||||
@@ -103,19 +102,7 @@ RUN pnpm qa:lab:build
|
||||
# Prune dev dependencies and strip build-only metadata before copying
|
||||
# runtime assets into the final image.
|
||||
FROM build AS runtime-assets
|
||||
ARG OPENCLAW_EXTENSIONS
|
||||
ARG OPENCLAW_BUNDLED_PLUGIN_DIR
|
||||
# Keep the install layer frozen, but allow prune to run against the full copied
|
||||
# workspace tree subset used during `pnpm install`. The build stage only copied
|
||||
# the root, `ui`, and opted-in plugin manifests into the install layer, so
|
||||
# prune must not rediscover unrelated workspaces from the later full source
|
||||
# copy.
|
||||
RUN printf 'packages:\n - .\n - ui\n' > /tmp/pnpm-workspace.runtime.yaml && \
|
||||
for ext in $OPENCLAW_EXTENSIONS; do \
|
||||
printf ' - %s/%s\n' "$OPENCLAW_BUNDLED_PLUGIN_DIR" "$ext" >> /tmp/pnpm-workspace.runtime.yaml; \
|
||||
done && \
|
||||
cp /tmp/pnpm-workspace.runtime.yaml pnpm-workspace.yaml && \
|
||||
CI=true NPM_CONFIG_FROZEN_LOCKFILE=false pnpm prune --prod && \
|
||||
RUN CI=true pnpm prune --prod && \
|
||||
find dist -type f \( -name '*.d.ts' -o -name '*.d.mts' -o -name '*.d.cts' -o -name '*.map' \) -delete
|
||||
|
||||
# ── Runtime base images ─────────────────────────────────────────
|
||||
@@ -172,6 +159,10 @@ COPY --from=runtime-assets --chown=node:node /app/skills ./skills
|
||||
COPY --from=runtime-assets --chown=node:node /app/docs ./docs
|
||||
COPY --from=runtime-assets --chown=node:node /app/qa ./qa
|
||||
|
||||
# In npm-installed Docker images, prefer the copied source extension tree for
|
||||
# bundled discovery so package metadata that points at source entries stays valid.
|
||||
ENV OPENCLAW_BUNDLED_PLUGINS_DIR=/app/${OPENCLAW_BUNDLED_PLUGIN_DIR}
|
||||
|
||||
# Keep pnpm available in the runtime image for container-local workflows.
|
||||
# Use a shared Corepack home so the non-root `node` user does not need a
|
||||
# first-run network fetch when invoking pnpm.
|
||||
|
||||
@@ -89,7 +89,7 @@ New install? Start here: [Getting started](https://docs.openclaw.ai/start/gettin
|
||||
|
||||
- **[OpenAI](https://openai.com/)** (ChatGPT/Codex)
|
||||
|
||||
Model note: while many providers and models are supported, prefer a current flagship model from the provider you trust and already use. See [Onboarding](https://docs.openclaw.ai/start/onboarding).
|
||||
Model note: while many providers/models are supported, for the best experience and lower prompt-injection risk use the strongest latest-generation model available to you. See [Onboarding](https://docs.openclaw.ai/start/onboarding).
|
||||
|
||||
## Models (selection + auth)
|
||||
|
||||
@@ -371,7 +371,7 @@ Minimal `~/.openclaw/openclaw.json` (model + defaults):
|
||||
```json5
|
||||
{
|
||||
agent: {
|
||||
model: "<provider>/<model-id>",
|
||||
model: "anthropic/claude-opus-4-6",
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
366
appcast.xml
366
appcast.xml
@@ -2,254 +2,6 @@
|
||||
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
|
||||
<channel>
|
||||
<title>OpenClaw</title>
|
||||
<item>
|
||||
<title>2026.4.5</title>
|
||||
<pubDate>Mon, 06 Apr 2026 04:55:17 +0100</pubDate>
|
||||
<link>https://raw.githubusercontent.com/openclaw/openclaw/main/appcast.xml</link>
|
||||
<sparkle:version>2026040590</sparkle:version>
|
||||
<sparkle:shortVersionString>2026.4.5</sparkle:shortVersionString>
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
<description><![CDATA[<h2>OpenClaw 2026.4.5</h2>
|
||||
<h3>Breaking</h3>
|
||||
<ul>
|
||||
<li>Config: remove legacy public config aliases such as <code>talk.voiceId</code> / <code>talk.apiKey</code>, <code>agents.*.sandbox.perSession</code>, <code>browser.ssrfPolicy.allowPrivateNetwork</code>, <code>hooks.internal.handlers</code>, and channel/group/room <code>allow</code> toggles in favor of the canonical public paths and <code>enabled</code>, while keeping load-time compatibility and <code>openclaw doctor --fix</code> migration support for existing configs. (#60726) Thanks @vincentkoc.</li>
|
||||
</ul>
|
||||
<h3>Changes</h3>
|
||||
<ul>
|
||||
<li>Agents/video generation: add the built-in <code>video_generate</code> tool so agents can create videos through configured providers and return the generated media directly in the reply.</li>
|
||||
<li>Agents/music generation: ignore unsupported optional hints such as <code>durationSeconds</code> with a warning instead of hard-failing requests on providers like Google Lyria.</li>
|
||||
<li>Providers/ComfyUI: add a bundled <code>comfy</code> workflow media plugin for local ComfyUI and Comfy Cloud workflows, including shared <code>image_generate</code>, <code>video_generate</code>, and workflow-backed <code>music_generate</code> support, with prompt injection, optional reference-image upload, live tests, and output download.</li>
|
||||
<li>Tools/music generation: add the built-in <code>music_generate</code> tool with bundled Google (Lyria) and MiniMax providers plus workflow-backed Comfy support, including async task tracking and follow-up delivery of finished audio.</li>
|
||||
<li>Providers: add bundled Qwen, Fireworks AI, and StepFun providers, plus MiniMax TTS, Ollama Web Search, and MiniMax Search integrations for chat, speech, and search workflows. (#60032, #55921, #59318, #54648)</li>
|
||||
<li>Providers/Amazon Bedrock: add bundled Mantle support plus inference-profile discovery and automatic request-region injection so Bedrock-hosted Claude, GPT-OSS, Qwen, Kimi, GLM, and similar routes work with less manual setup. (#61296, #61299) Thanks @wirjo.</li>
|
||||
<li>Control UI/multilingual: add localized control UI support for Simplified Chinese, Traditional Chinese, Brazilian Portuguese, German, Spanish, Japanese, Korean, French, Turkish, Indonesian, Polish, and Ukrainian. Thanks @vincentkoc.</li>
|
||||
<li>Plugins: add plugin-config TUI prompts to guided onboarding/setup flows, and add <code>openclaw plugins install --force</code> so existing plugin and hook-pack targets can be replaced without using the dangerous-code override flag. (#60590, #60544)</li>
|
||||
<li>Control UI/skills: add ClawHub search, detail, and install flows directly in the Skills panel. (#60134) Thanks @samzong.</li>
|
||||
<li>iOS/exec approvals: add generic APNs approval notifications that open an in-app exec approval modal, fetch command details only after authenticated operator reconnect, and clear stale notification state when the approval resolves. (#60239) Thanks @ngutman.</li>
|
||||
<li>Matrix/exec approvals: add Matrix-native exec approval prompts with account-scoped approvers, channel-or-DM delivery, and room-thread aware resolution handling. (#58635) Thanks @gumadeiras.</li>
|
||||
<li>Channels/context visibility: add configurable <code>contextVisibility</code> per channel (<code>all</code>, <code>allowlist</code>, <code>allowlist_quote</code>) so supplemental quote, thread, and fetched history context can be filtered by sender allowlists instead of always passing through as received.</li>
|
||||
<li>Providers/request overrides: add shared model and media request transport overrides across OpenAI-, Anthropic-, Google-, and compatible provider paths, including headers, auth, proxy, and TLS controls. (#60200)</li>
|
||||
<li>Providers/OpenAI: add forward-compat <code>openai-codex/gpt-5.4-mini</code>, an opt-in GPT personality, and provider-owned GPT-5 prompt contributions so Codex/GPT runs stay cache-stable and compatible with bundled catalog lag.</li>
|
||||
<li>Agents/Claude CLI: expose OpenClaw tools to background Claude CLI runs through a loopback MCP bridge and switch bundled runs to stdin + <code>stream-json</code> partial-message streaming so prompts stop riding argv, long replies show live progress, and final session/usage metadata still land cleanly. (#35676) Thanks @mylukin.</li>
|
||||
<li>ACPX/runtime: embed the ACP runtime directly in the bundled <code>acpx</code> plugin, remove the extra external ACP CLI hop, harden live ACP session binding and reuse, and add a generic <code>reply_dispatch</code> hook so bundled plugins like ACPX can own reply interception without hardcoded ACP paths in core auto-reply routing. (#61319)</li>
|
||||
<li>Agents/progress: add experimental structured plan updates and structured execution item events so compatible UIs can show clearer step-by-step progress during long-running runs.</li>
|
||||
<li>Providers/Anthropic: remove the Claude CLI backend and setup-token from new onboarding, keep existing configured legacy profiles runnable, and have <code>openclaw doctor</code> repair or remove stale <code>anthropic:claude-cli</code> state during migration.</li>
|
||||
<li>Tools/video generation: add bundled xAI (<code>grok-imagine-video</code>), Alibaba Model Studio Wan, and Runway video providers, plus live-test/default model wiring for all three.</li>
|
||||
<li>Memory/search: add Amazon Bedrock embeddings for Titan, Cohere, Nova, and TwelveLabs models, with AWS credential-chain auto-detection for <code>provider: "auto"</code> and provider-specific dimension controls. Thanks @wirjo.</li>
|
||||
<li>Providers/Amazon Bedrock Mantle: generate bearer tokens from the AWS credential chain so Mantle auto-discovery can use IAM auth without manually exporting <code>AWS_BEARER_TOKEN_BEDROCK</code>. Thanks @wirjo.</li>
|
||||
<li>Memory/dreaming (experimental): add weighted short-term recall promotion, a <code>/dreaming</code> command, Dreams UI, multilingual conceptual tagging, and doctor/status repair support, while refactoring dreaming from competing modes into three cooperative phases (light, deep, REM) with independent schedules and recovery behavior so durable memory promotion can run in the background with less manual setup. (#60569, #60697) Thanks @vignesh07.</li>
|
||||
<li>Memory/dreaming: add configurable aging controls (<code>recencyHalfLifeDays</code>, <code>maxAgeDays</code>) plus optional verbose logging so operators can tune recall decay and inspect promotion decisions more easily.</li>
|
||||
<li>Memory/dreaming: add REM preview tooling (<code>openclaw memory rem-harness</code>, <code>promote-explain</code>), surface possible lasting truths during REM staging, and make deep promotion replay-safe so reruns reconcile instead of duplicating <code>MEMORY.md</code> entries.</li>
|
||||
<li>Memory/dreaming: write dreaming trail content to top-level <code>dreams.md</code> instead of daily memory notes, update <code>/dreaming</code> help text to point there, and keep <code>dreams.md</code> available for explicit reads without pulling it into default recall. Thanks @davemorin.</li>
|
||||
<li>Memory/dreaming: add the Dream Diary surface in Dreams, simplify user-facing dreaming config to <code>enabled</code> plus optional <code>frequency</code>, treat phases as implementation detail in docs/UI, and keep the lobster animation visible above diary content. Thanks @vignesh07.</li>
|
||||
<li>Prompt caching: keep prompt prefixes more reusable across transport fallback, deterministic MCP tool ordering, compaction, embedded image history, normalized system-prompt fingerprints, <code>openclaw status --verbose</code> cache diagnostics, and the removal of duplicate in-band tool inventories from agent system prompts so follow-up turns hit cache more reliably. (#58036, #58037, #58038, #59054, #60603, #60691) Thanks @bcherny and @vincentkoc.</li>
|
||||
<li>Agents/cache: diagnostics: add prompt-cache break diagnostics, trace live cache scenarios through embedded runner paths, and show cache reuse explicitly in <code>openclaw status --verbose</code>. Thanks @vincentkoc.</li>
|
||||
<li>Agents/cache: stabilize cache-relevant system prompt fingerprints by normalizing equivalent structured prompt whitespace, line endings, hook-added system context, and runtime capability ordering so semantically unchanged prompts reuse KV/cache more reliably. Thanks @vincentkoc.</li>
|
||||
<li>Agents/tool prompts: remove the duplicate in-band tool inventory from agent system prompts so tool-calling models rely on the structured tool definitions as the single source of truth, improving prompt stability and reducing stale tool guidance.</li>
|
||||
<li>Config/schema: enrich the exported <code>openclaw config schema</code> JSON Schema with field titles and descriptions so editors, agents, and other schema consumers receive the same config help metadata. (#60067) Thanks @solavrc.</li>
|
||||
<li>Providers/CLI: remove bundled CLI text-provider backends and the <code>agents.defaults.cliBackends</code> surface, while keeping ACP harness sessions and Gemini media understanding on the native bundled providers.</li>
|
||||
<li>Matrix/exec approvals: clarify unavailable-approval replies so Matrix no longer claims chat approvals are unsupported when native exec approvals are merely unconfigured. (#61424) Thanks @gumadeiras.</li>
|
||||
<li>Docs/IRC: replace public IRC hostname examples with <code>irc.example.com</code> and recommend private servers for bot coordination while listing common public networks for intentional use.</li>
|
||||
<li>Memory/dreaming: group nearby daily-note lines into short coherent chunks before staging them for dreaming, so one-off context from recent notes reaches REM/deep with better evidence and less line-level noise.</li>
|
||||
<li>Memory/dreaming: drop generic date/day headings from daily-note chunk prefixes while keeping meaningful section labels, so staged snippets stay cleaner and more reusable. (#61597) Thanks @mbelinky.</li>
|
||||
<li>Plugins/Lobster: run bundled Lobster workflows in process instead of spawning the external CLI, reducing transport overhead and unblocking native runtime integration. (#61523) Thanks @mbelinky.</li>
|
||||
<li>Plugins/Lobster: harden managed resume validation so invalid TaskFlow resume calls fail earlier, and memoize embedded runtime loading per runner while keeping failed loads retryable. (#61566) Thanks @mbelinky.</li>
|
||||
</ul>
|
||||
<h3>Fixes</h3>
|
||||
<ul>
|
||||
<li>Security: preserve restrictive plugin-only tool allowlists, require owner access for <code>/allowlist add</code> and <code>/allowlist remove</code>, fail closed when <code>before_tool_call</code> hooks crash, block browser SSRF redirect bypasses earlier, and keep non-interactive auth-choice inference scoped to bundled and already-trusted plugins. (#58476, #59836, #59822, #58771, #59120) Thanks @eleqtrizit and @pgondhi987.</li>
|
||||
<li>Providers/OpenAI: make GPT-5 and Codex runs act sooner with lower-verbosity defaults, visible progress during tool work, and a one-shot retry when a turn only narrates the plan instead of taking action.</li>
|
||||
<li>Providers/OpenAI and reply delivery: preserve native <code>reasoning.effort: "none"</code> and strict schemas where supported, add GPT-5.4 assistant <code>phase</code> metadata across replay and the Gateway <code>/v1/responses</code> layer, and keep commentary buffered until <code>final_answer</code> so web chat, session previews, embedded replies, and Telegram partials stop leaking planning text. Fixes #59150, #59643, #61282.</li>
|
||||
<li>Telegram: fix current-model checks in the model picker, HTML-format non-default <code>/model</code> confirmations, explicit topic replies, persisted reaction ownership across restarts, caption-media placeholder and <code>file_id</code> preservation on download failure, and upgraded-install inbound image reads. (#60384, #60042, #59634, #59207, #59948, #59971) Thanks @sfuminya, @GitZhangChi, @dashhuang, @samzong, @v1p0r, and @neeravmakwana.</li>
|
||||
<li>Telegram: restore DM voice-note preflight transcription so direct-message audio stops arriving as raw <code><media:audio></code> placeholders. (#61008) Thanks @manueltarouca.</li>
|
||||
<li>Telegram/reasoning: only create a Telegram reasoning preview lane when the session is explicitly <code>reasoning:stream</code>, so hidden <code><think></code> traces from streamed replies stop surfacing as chat previews on normal sessions. Thanks @vincentkoc.</li>
|
||||
<li>Telegram/native command menu: trim long menu descriptions before dropping commands so sub-100 command sets can still fit Telegram's payload budget and keep more <code>/</code> entries visible. (#61129) Thanks @neeravmakwana.</li>
|
||||
<li>Discord: keep REST, webhook, and monitor traffic on the configured proxy, preserve component-only media sends, honor <code>@everyone</code> and <code>@here</code> mention gates, keep ACK reactions on the active account, and split voice connect/playback timeouts so auto-join is more reliable. (#57465, #60361, #60345) Thanks @geekhuashan.</li>
|
||||
<li>Discord/reply tags: strip leaked <code>[[reply_to_current]]</code> control tags from preview text and honor explicit reply-tag threading during final delivery, so Discord replies stay attached to the triggering message instead of printing reply metadata into chat.</li>
|
||||
<li>Discord/replies: replace the unshipped <code>replyToOnlyWhenBatched</code> flag with <code>replyToMode: "batched"</code> so native reply references only attach on debounced multi-message turns while explicit reply tags still work.</li>
|
||||
<li>Discord/image generation: include the real generated <code>MEDIA:</code> paths in tool output, avoid duplicate plain-output media requeueing, and persist volatile workspace-generated media into durable outbound media before final reply delivery so generated image replies stop pointing at missing local files.</li>
|
||||
<li>Slack: route live DM replies back to the concrete inbound DM channel while keeping persisted routing metadata user-scoped, so normal assistant replies stop disappearing when pairing and system messages still arrive. (#59030) Thanks @afurm.</li>
|
||||
<li>WhatsApp: restore <code>channels.whatsapp.blockStreaming</code> and reset watchdog timeouts after reconnect so quiet chats stop falling into reconnect loops. (#60007, #60069) Thanks @MonkeyLeeT and @mcaxtr.</li>
|
||||
<li>Android/Talk Mode: cancel in-flight <code>talk.speak</code> playback when speech is explicitly stopped, and restore spoken replies on both node-scoped and gateway-backed sessions by keeping reply routing and embedded transport overrides aligned with the current playback path. (#60306, #61164, #61214)</li>
|
||||
<li>Voice-call/OpenAI: pass full plugin config into realtime transcription provider resolution so streaming calls can discover the bundled OpenAI realtime transcription provider again. Fixes #60936. Thanks @sliekens and @vincentkoc.</li>
|
||||
<li>Matrix/exec approvals: anchor seeded approval reactions to the primary Matrix prompt event, resolve them from event metadata instead of prompt text, and clean up chunked approval prompts correctly. (#60931) Thanks @gumadeiras.</li>
|
||||
<li>Matrix: recover more reliably when secret storage or recovery keys are missing by recreating secret storage during repair and backup reset, hold crypto snapshot locks during persistence, and surface explicit too-large attachment markers. (#59846, #59851, #60599, #60289) Thanks @al3mart, @emonty, and @efe-arv.</li>
|
||||
<li>Matrix/DM sessions: add <code>channels.matrix.dm.sessionScope</code>, shared-session collision notices, and aligned outbound session reuse so separate Matrix DM rooms can keep distinct context when configured. (#61373) Thanks @gumadeiras.</li>
|
||||
<li>Matrix: move legacy top-level <code>avatarUrl</code> into the default account during multi-account promotion and keep env-backed account setup avatar config persisted. (#61437) Thanks @gumadeiras.</li>
|
||||
<li>MS Teams: download inline DM images via Graph API and preserve channel reply threading in proactive fallback. (#52212, #55198) Thanks @Ted-developer and @hyojin.</li>
|
||||
<li>MS Teams: replace the deprecated Teams SDK HttpPlugin stub with <code>httpServerAdapter</code> so recurring gateway deprecation warnings stop firing and the Express 5 compatibility workaround stays on the supported SDK path. (#60939) Thanks @coolramukaka-sys.</li>
|
||||
<li>Control UI/chat: add a per-session thinking-level picker in the chat header and mobile chat settings, and keep the browser bundle on UI-local thinking/session-key helpers so Safari no longer crashes on Node-only imports before rendering chat controls.</li>
|
||||
<li>Sandbox/SSH: reject hardlinked files during cross-device rename fallback so EXDEV file copies preserve the same pinned file-boundary checks as direct reads.</li>
|
||||
<li>Control UI: keep Stop visible during tool-only execution, preserve pending-send busy state, and clear stale ClawHub search results as soon as the query changes. (#54528, #59800, #60267) Thanks @chziyue and @frankekn.</li>
|
||||
<li>Control UI/avatar: honor <code>ui.assistant.avatar</code> when serving <code>/avatar/:agentId</code> so Appearance UI avatar paths stop falling back to initials placeholders. (#60778) Thanks @hannasdev.</li>
|
||||
<li>Control UI/cron: highlight the Cron refresh button while refresh is in flight so the page's loading state stays visible even when prior data remains on screen. (#60394) Thanks @coder-zhuzm.</li>
|
||||
<li>Control UI/Overview: prevent gateway access token/password visibility toggle buttons from overlapping their inputs at narrow widths. (#56924) Thanks @bbddbb1.</li>
|
||||
<li>Auto-reply: unify reply lifecycle ownership across preflight compaction, session rotation, CLI-backed runs, and gateway restart handling so <code>/stop</code> and same-session overlap checks target the right active turn and restart-interrupted turns return the restart notice instead of being silently dropped. (#61267) Thanks @dutifulbob.</li>
|
||||
<li>Reply delivery: prevent duplicate block replies on <code>text_end</code> channels so providers that emit explicit text-end boundaries no longer double-send the same final message. (#61530)</li>
|
||||
<li>Gateway/startup: default <code>gateway.mode</code> to <code>local</code> when unset, detect PID recycling in gateway lock files on Windows and macOS, and show startup progress so healthy restarts stop getting blocked by stale locks. (#54801, #60085, #59843) Thanks @BradGroux and @TonyDerek-dot.</li>
|
||||
<li>Gateway/macOS: let launchd <code>KeepAlive</code> own in-process gateway restarts again, adding a short supervised-exit delay so rapid restarts avoid launchd crash-loop unloads while <code>openclaw gateway restart</code> still reports real LaunchAgent errors synchronously.</li>
|
||||
<li>Gateway/macOS: re-bootstrap the LaunchAgent if <code>launchctl kickstart -k</code> unloads it during restart so failed restarts do not leave the gateway unmanaged until manual repair.</li>
|
||||
<li>Gateway/macOS: recover installed-but-unloaded LaunchAgents during <code>openclaw gateway start</code> and <code>restart</code>, while still preferring live unmanaged gateways during restart recovery. (#43766) Thanks @HenryC-3.</li>
|
||||
<li>Gateway/Windows scheduled tasks: preserve Task Scheduler settings on reinstall, fail loudly when <code>/Run</code> does not start, and report fast failed restarts accurately instead of pretending they timed out after 60 seconds. (#59335) Thanks @tmimmanuel.</li>
|
||||
<li>Windows/restart: fall back to the installed Startup-entry launcher when the scheduled task was never registered, so <code>/restart</code> can relaunch the gateway on Windows setups where <code>schtasks</code> install fell back during onboarding. (#58943) Thanks @imechZhangLY.</li>
|
||||
<li>Windows/restart: clean up stale gateway listeners before Windows self-restart and treat listener and argv probe failures as inconclusive, so scheduled-task relaunch no longer falls into an <code>EADDRINUSE</code> retry loop. (#60480) Thanks @arifahmedjoy.</li>
|
||||
<li>Update/npm: prefer the npm binary that owns the installed global OpenClaw prefix so mixed Homebrew-plus-nvm setups update the right install. (#60153) Thanks @jayeshp19.</li>
|
||||
<li>Agents/music and video generation: add <code>tools.media.asyncCompletion.directSend</code> as an opt-in direct-delivery path for finished async media tasks, while keeping the legacy requester-session wake/model-delivery flow as the default.</li>
|
||||
<li>CLI/skills JSON: route <code>skills list --json</code>, <code>skills info --json</code>, and <code>skills check --json</code> output to stdout instead of stderr so machine-readable consumers receive JSON on the expected stream again. (#60914; fixes #57599; landed from contributor PR #57611 by @Aftabbs) Thanks @Aftabbs.</li>
|
||||
<li>CLI/Commander: preserve Commander-computed exit codes for argument and help-error paths, and cover the user-argv parse mode in the regression tests so invalid CLI invocations no longer report success when exits are intercepted. (#60923) Thanks @Linux2010.</li>
|
||||
<li>Cron: replay interrupted recurring jobs on the first gateway restart instead of waiting for a second restart. (#60583) Thanks @joelnishanth.</li>
|
||||
<li>Cron: send failure notifications through the job's primary delivery channel using the same session context as successful delivery when no explicit <code>failureDestination</code> is configured. (#60622) Thanks @artwalker.</li>
|
||||
<li>Exec/remote skills: stop advertising <code>exec host=node</code> when the current exec policy cannot route to a node, and clarify blocked exec-host override errors with both the requested host and allowed config path.</li>
|
||||
<li>Agents/Claude CLI/security: clear inherited Claude Code config-root and plugin-root env overrides like <code>CLAUDE_CONFIG_DIR</code> and <code>CLAUDE_CODE_PLUGIN_*</code>, so OpenClaw-launched Claude CLI runs cannot be silently pointed at an alternate Claude config/plugin tree with different hooks, plugins, or auth context. Thanks @vincentkoc.</li>
|
||||
<li>Agents/Claude CLI/security: clear inherited Claude Code provider-routing and managed-auth env overrides, and mark OpenClaw-launched Claude CLI runs as host-managed, so Claude CLI backdoor sessions cannot be silently redirected to proxy, Bedrock, Vertex, Foundry, or parent-managed token contexts. Thanks @vincentkoc.</li>
|
||||
<li>Agents/Claude CLI/security: force host-managed Claude CLI backdoor runs to <code>--setting-sources user</code>, even under custom backend arg overrides, so repo-local <code>.claude</code> project/local settings, hooks, and plugin discovery do not silently execute inside non-interactive OpenClaw sessions. Thanks @vincentkoc.</li>
|
||||
<li>Agents/Claude CLI: treat malformed bare <code>--permission-mode</code> backend overrides as missing and fail safe back to <code>bypassPermissions</code>, so custom <code>cliBackends.claude-cli.args</code> security config cannot accidentally consume the next flag as a bogus permission mode. Thanks @vincentkoc.</li>
|
||||
<li>Gateway/device pairing: require non-admin paired-device sessions to manage only their own device for token rotate/revoke and paired-device removal, blocking cross-device token theft inside pairing-scoped sessions. (#50627) Thanks @coygeek.</li>
|
||||
<li>Gateway/plugin routes: keep gateway-auth plugin runtime routes on write-only fallback scopes unless a trusted-proxy caller explicitly declares narrower <code>x-openclaw-scopes</code>, so plugin HTTP handlers no longer mint admin-level runtime scopes on missing or untrusted HTTP scope headers. (#59815) Thanks @pgondhi987.</li>
|
||||
<li>Build/types: fix the Node <code>createRequire(...)</code> helper typing so provider-runtime lazy loads compile cleanly again and <code>pnpm build</code> no longer fails in the Pi embedded provider error-pattern path.</li>
|
||||
<li>Gateway/security: scope loopback browser-origin auth throttling by normalized origin so one localhost Control UI tab cannot lock out a different localhost browser origin after repeated auth failures.</li>
|
||||
<li>Gateway/auth: serialize async shared-secret auth attempts per client so concurrent Tailscale-capable failures cannot overrun the intended auth rate-limit budget. Thanks @Telecaster2147.</li>
|
||||
<li>Device pairing/security: keep non-operator device scope checks bound to the requested role prefix so bootstrap verification cannot redeem <code>operator.*</code> scopes through <code>node</code> auth. (#57258) Thanks @jlapenna.</li>
|
||||
<li>Device pairing: reject rotating device tokens into roles that were never approved during pairing, and keep reconnect role checks bounded to the paired device's approved role set. (#60462) Thanks @eleqtrizit.</li>
|
||||
<li>Gateway/device auth: reuse cached device-token scopes only for cached-token reconnects, while keeping explicit <code>deviceToken</code> scope requests and empty-cache fallbacks intact so reconnects preserve <code>operator.read</code> without breaking explicit auth flows. (#46032) Thanks @caicongyang.</li>
|
||||
<li>Mobile pairing/security: fail closed for internal <code>/pair</code> setup-code issuance, cleanup, and approval paths when gateway pairing scopes are missing, and keep approval-time requested-scope enforcement on the internal command path. (#55996) Thanks @coygeek.</li>
|
||||
<li>Mobile pairing/bootstrap: keep QR bootstrap handoff tokens bounded to the mobile-safe contract so node handoff stays unscoped and operator handoff drops mixed <code>node.*</code>, <code>operator.admin</code>, and <code>operator.pairing</code> scopes.</li>
|
||||
<li>Mobile pairing/Android: tighten secure endpoint handling so Tailscale and public remote setup reject cleartext endpoints, private LAN pairing still works, merged-role approvals mint both node and operator device tokens, and bootstrap tokens survive node auto-pair until operator approval finishes. (#60128, #60208, #60221) Thanks @obviyus.</li>
|
||||
<li>Android/canvas security: require exact normalized A2UI URL matches before forwarding canvas bridge actions, rejecting query mismatches and descendant paths while still allowing fragment-only A2UI navigation.</li>
|
||||
<li>Synology Chat/security: default low-level HTTPS helper TLS verification to on so helper/API defaults match the shipped safe account default, and only explicit <code>allowInsecureSsl: true</code> opts out.</li>
|
||||
<li>Synology Chat/security: route webhook token comparison through the shared constant-time secret helper for consistency with other bundled plugins.</li>
|
||||
<li>Plugins/marketplace: block remote marketplace symlink escapes without breaking ordinary local marketplace install paths. (#60556) Thanks @eleqtrizit.</li>
|
||||
<li>Telegram/local Bot API: honor <code>channels.telegram.apiRoot</code> for buffered media downloads, add <code>channels.telegram.network.dangerouslyAllowPrivateNetwork</code> for trusted fake-IP setups, and require <code>channels.telegram.trustedLocalFileRoots</code> before reading absolute Bot API <code>file_path</code> values. (#59544, #60705) Thanks @SARAMALI15792 and @obviyus.</li>
|
||||
<li>Outbound/sanitizer: strip leaked <code><tool_call></code>, <code><function_calls></code>, and model special tokens from shared user-visible assistant text, including truncated tool-call streams, so internal scaffolding no longer bleeds into replies across surfaces. (#60619) Thanks @oliviareid-svg.</li>
|
||||
<li>Agents/errors: surface an explicit disk-full message when local session or transcript writes fail with <code>ENOSPC</code>/<code>disk full</code>, so those runs stop degrading into opaque <code>NO_REPLY</code>-style failures. Thanks @vincentkoc.</li>
|
||||
<li>Exec approvals: remove heuristic command-obfuscation gating from host exec so gateway and node runs rely on explicit policy, allowlist, and strict inline-eval rules only.</li>
|
||||
<li>Agents/tool results: cap live tool-result persistence and overflow-recovery truncation at 40k characters so oversized tool output stays bounded without discarding recent context entirely.</li>
|
||||
<li>Discord/video replies: split text-plus-video deliveries into a text reply followed by a media-only send, and let live provider auth checks honor manifest-declared API key env vars like <code>MODELSTUDIO_API_KEY</code>.</li>
|
||||
<li>Config/All Settings: keep the raw config view intact when sensitive fields are blank instead of corrupting or dropping the rendered snapshot. (#28214) Thanks @solodmd.</li>
|
||||
<li>Plugin SDK/facades: back-fill bundled plugin facade sentinels before plugin-id tracking re-enters config loading, so CLI/provider startup no longer crashes with <code>shouldNormalizeGoogleProviderConfig is not a function</code> or other empty-facade reads during bundled plugin re-entry. Thanks @adam91holt.</li>
|
||||
<li>Plugins/facades: back-fill facade sentinels before tracked-plugin resolution re-enters config loading, so facade exports stay defined during circular provider normalization. (#61180) Thanks @adam91holt.</li>
|
||||
<li>QA lab: restore typed mock OpenAI gateway config wiring so QA-lab config helpers compile cleanly again and <code>pnpm check</code> / <code>pnpm build</code> stay green.</li>
|
||||
<li>Discord/image generation: include the real generated <code>MEDIA:</code> paths in tool output and avoid duplicate plain-output media requeueing so Discord image replies stop pointing at missing local files.</li>
|
||||
<li>Slack: route live DM replies back to the concrete inbound DM channel while keeping persisted routing metadata user-scoped, so normal assistant replies stop disappearing when pairing and system messages still arrive. (#59030) Thanks @afurm.</li>
|
||||
<li>Discord/reply tags: strip leaked <code>[[reply_to_current]]</code> control tags from preview text and honor explicit reply-tag threading during final delivery, so Discord replies stay attached to the triggering message instead of printing reply metadata into chat.</li>
|
||||
<li>Telegram: fix current-model checks in the model picker, HTML-format non-default <code>/model</code> confirmations, explicit topic replies, persisted reaction ownership across restarts, caption-media placeholder and <code>file_id</code> preservation on download failure, and upgraded-install inbound image reads. (#60384, #60042, #59634, #59207, #59948, #59971) Thanks @sfuminya, @GitZhangChi, @dashhuang, @samzong, @v1p0r, and @neeravmakwana.</li>
|
||||
<li>Telegram: restore DM voice-note preflight transcription so direct-message audio stops arriving as raw <code><media:audio></code> placeholders. (#61008) Thanks @manueltarouca.</li>
|
||||
<li>Telegram/reasoning: only create a Telegram reasoning preview lane when the session is explicitly <code>reasoning:stream</code>, so hidden <code><think></code> traces from streamed replies stop surfacing as chat previews on normal sessions. Thanks @vincentkoc.</li>
|
||||
<li>Telegram/native command menu: trim long menu descriptions before dropping commands so sub-100 command sets can still fit Telegram's payload budget and keep more <code>/</code> entries visible. (#61129) Thanks @neeravmakwana.</li>
|
||||
<li>Feishu/reasoning: only expose streamed reasoning previews when the session is explicitly <code>reasoning:stream</code>, so hidden reasoning traces do not surface on normal streaming sessions. Thanks @vincentkoc.</li>
|
||||
<li>Discord: keep REST, webhook, and monitor traffic on the configured proxy, preserve component-only media sends, honor <code>@everyone</code> and <code>@here</code> mention gates, keep ACK reactions on the active account, and split voice connect/playback timeouts so auto-join is more reliable. (#57465, #60361, #60345) Thanks @geekhuashan.</li>
|
||||
<li>WhatsApp: restore <code>channels.whatsapp.blockStreaming</code> and reset watchdog timeouts after reconnect so quiet chats stop falling into reconnect loops. (#60007, #60069) Thanks @MonkeyLeeT and @mcaxtr.</li>
|
||||
<li>Memory: keep <code>memory-core</code> builtin embedding registration on the already-registered path so selecting <code>memory-core</code> no longer recurses through plugin discovery and crashes during startup. (#61402) Thanks @ngutman.</li>
|
||||
<li>Agents/tool results: keep large <code>read</code> outputs visible longer, preserve the latest <code>read</code> output when older tool output can absorb the overflow budget, and fall back to Pi's normal overflow compaction/retry path before replacing a fresh <code>read</code> with a compacted stub. Thanks @vincentkoc.</li>
|
||||
<li>Memory/QMD: prefer modern <code>qmd collection add --glob</code>, accept newer single-line JSON hit metadata while keeping legacy line fields, refresh QMD docs/doctor install guidance and model-override guidance, and keep older QMD releases working. Thanks @vincentkoc.</li>
|
||||
<li>MS Teams: download inline DM images via Graph API and preserve channel reply threading in proactive fallback. (#52212, #55198) Thanks @Ted-developer and @hyojin.</li>
|
||||
<li>MS Teams: replace the deprecated Teams SDK HttpPlugin stub with <code>httpServerAdapter</code> so recurring gateway deprecation warnings stop firing and the Express 5 compatibility workaround stays on the supported SDK path. (#60939) Thanks @coolramukaka-sys.</li>
|
||||
<li>Matrix/exec approvals: anchor seeded approval reactions to the primary Matrix prompt event, resolve them from event metadata instead of prompt text, and clean up chunked approval prompts correctly. (#60931) Thanks @gumadeiras.</li>
|
||||
<li>Matrix: recover more reliably when secret storage or recovery keys are missing by recreating secret storage during repair and backup reset, hold crypto snapshot locks during persistence, and surface explicit too-large attachment markers. (#59846, #59851, #60599, #60289) Thanks @al3mart, @emonty, and @efe-arv.</li>
|
||||
<li>Android/Talk Mode: cancel in-flight <code>talk.speak</code> playback when speech is explicitly stopped, so stale replies stop starting after barge-in or manual stop. (#61164) Thanks @obviyus.</li>
|
||||
<li>Android/Talk Mode: restore spoken assistant replies on node-scoped sessions by keeping reply routing synced to the resolved node session key and pausing mic capture during reply playback. (#60306) Thanks @MKV21.</li>
|
||||
<li>Android/Talk Mode: restore voice replies on gateway-backed talk mode sessions by updating embedded runner transport overrides to the current agent transport API. (#61214) Thanks @obviyus.</li>
|
||||
<li>Voice-call/OpenAI: pass full plugin config into realtime transcription provider resolution so streaming calls can discover the bundled OpenAI realtime transcription provider again. Fixes #60936. Thanks @sliekens and @vincentkoc.</li>
|
||||
<li>Control UI/chat: add a per-session thinking-level picker in the chat header and mobile chat settings, and keep the browser bundle on UI-local thinking/session-key helpers so Safari no longer crashes on Node-only imports before rendering chat controls.</li>
|
||||
<li>Control UI: keep Stop visible during tool-only execution, preserve pending-send busy state, and clear stale ClawHub search results as soon as the query changes. (#54528, #59800, #60267) Thanks @chziyue and @frankekn.</li>
|
||||
<li>Control UI/avatar: honor <code>ui.assistant.avatar</code> when serving <code>/avatar/:agentId</code> so Appearance UI avatar paths stop falling back to initials placeholders. (#60778) Thanks @hannasdev.</li>
|
||||
<li>Control UI/cron: highlight the Cron refresh button while refresh is in flight so the page's loading state stays visible even when prior data remains on screen. (#60394) Thanks @coder-zhuzm.</li>
|
||||
<li>Control UI/Overview: prevent gateway access token/password visibility toggle buttons from overlapping their inputs at narrow widths. (#56924) Thanks @bbddbb1.</li>
|
||||
<li>CLI/skills JSON: route <code>skills list --json</code>, <code>skills info --json</code>, and <code>skills check --json</code> output to stdout instead of stderr so machine-readable consumers receive JSON on the expected stream again. (#60914; fixes #57599; landed from contributor PR #57611 by @Aftabbs) Thanks @Aftabbs.</li>
|
||||
<li>CLI/Commander: preserve Commander-computed exit codes for argument and help-error paths, and cover the user-argv parse mode in the regression tests so invalid CLI invocations no longer report success when exits are intercepted. (#60923) Thanks @Linux2010.</li>
|
||||
<li>Cron: replay interrupted recurring jobs on the first gateway restart instead of waiting for a second restart. (#60583) Thanks @joelnishanth.</li>
|
||||
<li>Cron: send failure notifications through the job's primary delivery channel using the same session context as successful delivery when no explicit <code>failureDestination</code> is configured. (#60622) Thanks @artwalker.</li>
|
||||
<li>Live model switching: only treat explicit user-driven model changes as pending live switches, so fallback rotation, heartbeat overrides, and compaction no longer trip <code>LiveSessionModelSwitchError</code> before making an API call. (#60266) Thanks @kiranvk-2011.</li>
|
||||
<li>Exec approvals: reuse durable exact-command <code>allow-always</code> approvals in allowlist mode so identical reruns stop prompting, and tighten Windows interpreter/path approval handling so wrapper and malformed-path cases fail closed more consistently. (#59880, #59780, #58040, #59182) Thanks @luoyanglang, @SnowSky1, and @pgondhi987.</li>
|
||||
<li>Node exec approvals: keep node-host <code>system.run</code> approvals bound to the prepared execution plan across async forwarding, so mutable script operands still get approval-time binding and drift revalidation instead of dropping back to unbound execution.</li>
|
||||
<li>Agents/exec approvals: let <code>exec-approvals.json</code> agent security override stricter gateway tool defaults so approved subagents can use <code>security: “full”</code> without falling back to allowlist enforcement again. (#60310) Thanks @lml2468.</li>
|
||||
<li>Agents/exec: restore <code>host=node</code> routing for node-pinned and <code>host=auto</code> sessions, while still blocking sandboxed <code>auto</code> sessions from jumping to gateway. (#60788) Thanks @openperf.</li>
|
||||
<li>Exec/heartbeat: use the canonical <code>exec-event</code> wake reason for <code>notifyOnExit</code> so background exec completions still trigger follow-up turns when <code>HEARTBEAT.md</code> is empty or comments-only. (#41479) Thanks @rstar327.</li>
|
||||
<li>Heartbeat: skip wake delivery when the target session lane is already busy so the pending event is retried instead of getting drained too early. (#40526) Thanks @lucky7323.</li>
|
||||
<li>Group chats/agent prompts: tell models to minimize empty lines and use normal chat-style spacing so group replies avoid document-style blank-line formatting.</li>
|
||||
<li>Providers/OpenAI GPT: treat short approval turns like <code>ok do it</code> and <code>go ahead</code> as immediate action turns, and trim overly memo-like GPT-5 chat confirmations so OpenAI replies stay shorter and more conversational by default.</li>
|
||||
<li>Providers/OpenAI Codex: split native <code>contextWindow</code> from runtime <code>contextTokens</code>, keep the default effective cap at <code>272000</code>, and expose a per-model <code>contextTokens</code> override on <code>models.providers.*.models[]</code>.</li>
|
||||
<li>Providers/OpenAI-compatible WS: compute fallback token totals from normalized usage when providers omit or zero <code>total_tokens</code>, so DashScope-compatible sessions stop storing zero totals after alias normalization. (#54940) Thanks @lyfuci.</li>
|
||||
<li>Agents/OpenAI: mark Claude-compatible file tool schemas as <code>additionalProperties: false</code> so direct OpenAI GPT-5 routes stop rejecting the <code>read</code> tool with invalid strict-schema errors.</li>
|
||||
<li>Agents/OpenAI: fall back to <code>strict: false</code> for native OpenAI tool calls when a tool schema is not strict-compatible, and normalize empty-object tool schemas to include <code>required: []</code>, so direct GPT-5 routes stop failing with invalid strict-schema errors like missing <code>path</code> in <code>required</code>.</li>
|
||||
<li>Agents/GPT: add explicit work-item lifecycle events for embedded runs, use them to surface real progress more reliably, and stop counting tool-started turns as planning-only retries.</li>
|
||||
<li>Plugins/OpenAI: enable <code>gpt-image-1</code> reference-image edits through <code>/images/edits</code> multipart uploads, and stop inferring unsupported resolution overrides when no explicit <code>size</code> or <code>resolution</code> is provided.</li>
|
||||
<li>Agents/replay: remove the malformed assistant-content canonicalization repair from replay history sanitization instead of extending that legacy repair path into replay validation.</li>
|
||||
<li>Plugins/OpenAI: tune the OpenAI prompt overlay for live-chat cadence so GPT replies stay shorter, more human, and less wall-of-text by default.</li>
|
||||
<li>Providers/compat: stop forcing OpenAI-only defaults on proxy and custom OpenAI-compatible routes, preserve native vendor-specific reasoning/tool/streaming behavior across Anthropic-compatible, Moonshot, Mistral, ModelStudio, OpenRouter, xAI, and Z.ai endpoints, and route GitHub Copilot Claude models through Anthropic Messages instead of OpenAI Responses.</li>
|
||||
<li>Providers/GitHub Copilot: send IDE identity headers on runtime model requests and GitHub token exchange so IDE-authenticated Copilot runs stop failing with missing <code>Editor-Version</code>. (#60641) Thanks @VACInc and @vincentkoc.</li>
|
||||
<li>Providers/OpenRouter failover: classify <code>403 “Key limit exceeded”</code> spending-limit responses as billing so model fallback continues instead of stopping on generic auth. (#59892) Thanks @rockcent.</li>
|
||||
<li>Providers/Anthropic: keep <code>claude-cli/*</code> auth on live Claude CLI credentials at runtime, avoid persisting stale bearer-token profiles, and suppress macOS Keychain prompts during non-interactive Claude CLI setup. (#61234) Thanks @darkamenosa.</li>
|
||||
<li>Providers/Anthropic: when Claude CLI auth becomes the default, write a real <code>claude-cli</code> auth profile so local and gateway agent runs can use Claude CLI immediately without missing-API-key failures. Thanks @vincentkoc.</li>
|
||||
<li>Providers/Anthropic Vertex: honor <code>cacheRetention: “long”</code> with the real 1-hour prompt-cache TTL on Vertex AI endpoints, and default <code>anthropic-vertex</code> cache retention like direct Anthropic. (#60888) Thanks @affsantos.</li>
|
||||
<li>Agents/Anthropic: preserve native <code>toolu_*</code> replay ids on direct Anthropic and Anthropic Vertex paths so cache-sensitive history stops rewriting known-valid Anthropic tool-use ids. (#52612)</li>
|
||||
<li>Providers/Google: add model-level <code>cacheRetention</code> support for direct Gemini system prompts by creating, reusing, and refreshing <code>cachedContents</code> automatically on Google AI Studio runs. (#51372) Thanks @rafaelmariano-glitch.</li>
|
||||
<li>Google Gemini CLI auth: detect bundled npm installs by scanning packaged bundle files for the Gemini OAuth client config, so <code>npm install -g @google/gemini-cli</code> layouts work again. (#60486) Thanks @wzfmini01.</li>
|
||||
<li>Google Gemini CLI auth: detect personal OAuth mode from local Gemini settings and skip Code Assist project discovery for those logins, so personal Google accounts stop failing with <code>loadCodeAssist 400 Bad Request</code>. (#49226) Thanks @bobworrall.</li>
|
||||
<li>Google Gemini CLI auth: improve OAuth credential discovery across Windows nvm and Homebrew libexec installs, and align Code Assist metadata so Gemini login stops failing on packaged CLI layouts. (#40729) Thanks @hughcube.</li>
|
||||
<li>Google Gemini CLI models: add forward-compat support for stable <code>gemini-2.5-*</code> model ids by letting the bundled CLI provider clone them from Google templates, so <code>gemini-2.5-flash-lite</code> and related configured models stop showing up as missing. (#35274) Thanks @mySebbe.</li>
|
||||
<li>Google image generation: disable pinned DNS for Gemini image requests and honor explicit <code>pinDns</code> overrides in shared provider HTTP helpers so proxy-backed image generation works again. (#59873) Thanks @luoyanglang.</li>
|
||||
<li>Providers/Microsoft Foundry: preserve explicit image capability on normalized Foundry deployments, repair stale GPT/o-series text-only model metadata across gateway and runtime paths, and keep unknown fallback models from borrowing unrelated image support.</li>
|
||||
<li>Providers/Model Studio: preserve native streaming usage reporting for DashScope-compatible endpoints even when they are configured under a generic provider key, so streamed token totals stop sticking at zero. (#52395) Thanks @IVY-AI-gif.</li>
|
||||
<li>Providers/Z.AI: preserve explicitly registered <code>glm-5-*</code> variants like <code>glm-5-turbo</code> instead of intercepting them with the generic GLM-5 forward-compat shim. (#48185) Thanks @haoyu-haoyu.</li>
|
||||
<li>Amazon Bedrock/aws-sdk auth: stop injecting the fake <code>AWS_PROFILE</code> apiKey marker when no AWS auth env vars exist, so instance-role and other default-chain setups keep working without poisoning provider config. (#61194) Thanks @wirjo.</li>
|
||||
<li>Agents/Kimi tool-call repair: preserve tool arguments that were already present on streamed tool calls when later malformed deltas fail reevaluation, while still dropping stale repair-only state before <code>toolcall_end</code>.</li>
|
||||
<li>Plugins/Kimi Coding: parse tagged tool calls and keep Anthropic-native tool payloads so Kimi coding endpoints execute tools instead of echoing raw markup. (#60051, #60391) Thanks @obviyus and @Eric-Guo.</li>
|
||||
<li>Media understanding: auto-register image-capable config providers for vision routing, so custom GLM-style provider ids with image models stop failing with “no media-understanding provider registered”. (#51418) Thanks @xydt-610.</li>
|
||||
<li>Plugins/media understanding: enable bundled Groq and Deepgram providers by default so configured transcription models work without extra plugin activation config. (#59982) Thanks @yxjsxy.</li>
|
||||
<li>MiniMax/pricing: keep bundled MiniMax highspeed pricing distinct in provider catalogs and preserve the lower M2.5 cache-read pricing when onboarding older MiniMax models. (#54214) Thanks @octo-patch.</li>
|
||||
<li>MiniMax: advertise image input on bundled <code>MiniMax-M2.7</code> and <code>MiniMax-M2.7-highspeed</code> model definitions so image-capable flows can route through the M2.7 family correctly. (#54843) Thanks @MerlinMiao88888888.</li>
|
||||
<li>Models/MiniMax: honor <code>MINIMAX_API_HOST</code> for implicit bundled MiniMax provider catalogs so China-hosted API-key setups pick <code>api.minimaxi.com/anthropic</code> without manual provider config. (#34524) Thanks @caiqinghua.</li>
|
||||
<li>Usage/MiniMax: invert remaining-style <code>usage_percent</code> fields when MiniMax reports only remaining percentage data, so usage bars stop showing nearly-full remaining quota as nearly-exhausted usage. (#60254) Thanks @jwchmodx.</li>
|
||||
<li>Usage/MiniMax: let usage snapshots treat <code>minimax-portal</code> and MiniMax CN aliases as the same MiniMax quota surface, and prefer stored MiniMax OAuth before falling back to Coding Plan keys.</li>
|
||||
<li>Usage/MiniMax: prefer the chat-model <code>model_remains</code> entry and derive Coding Plan window labels from MiniMax interval timestamps so MiniMax usage snapshots stop picking zero-budget media rows and misreporting 4h windows as <code>5h</code>. (#52349) Thanks @IVY-AI-gif.</li>
|
||||
<li>Model picker/providers: treat bundled BytePlus and Volcengine plan aliases as their native providers during setup, and expose their bundled standard/coding catalogs before auth so setup can suggest the right models. (#58819) Thanks @Luckymingxuan.</li>
|
||||
<li>Tools/web_search (Kimi): when <code>tools.web.search.kimi.baseUrl</code> is unset, inherit native Moonshot chat <code>baseUrl</code> (<code>.ai</code> / <code>.cn</code>) so China console keys authenticate on the same host as chat. Fixes #44851. (#56769) Thanks @tonga54.</li>
|
||||
<li>Agents/Claude CLI: keep non-interactive <code>--permission-mode bypassPermissions</code> when custom <code>cliBackends.claude-cli.args</code> override defaults, including fallback resolution before the runtime plugin registry is active, so cron and heartbeat Claude CLI runs do not regress to interactive approval mode. (#61114) Thanks @cathrynlavery and @thewilloftheshadow.</li>
|
||||
<li>Agents/Claude CLI: persist explicit <code>openclaw agent --session-id</code> runs under a stable session key so follow-ups can reuse the stored CLI binding and resume the same underlying Claude session.</li>
|
||||
<li>Agents/Claude CLI: persist routed Claude session bindings, rotate them on <code>/new</code> and <code>/reset</code>, and keep live Claude CLI model switches moving across the configured Claude family so resumed sessions follow the real active thread and model. Thanks @vincentkoc.</li>
|
||||
<li>Agents/CLI backends: invalidate stored CLI session reuse when local CLI login state or the selected auth profile credential changes, so relogin and token rotation stop resuming stale sessions.</li>
|
||||
<li>Agents/Claude CLI/images: reuse stable hydrated image file paths and preserve shared media extensions like HEIC when passing image refs to local CLI runs, so Claude CLI image prompts stop thrashing KV cache prefixes and oddball image formats do not fall back to <code>.bin</code>. Thanks @vincentkoc.</li>
|
||||
<li>Agents/compaction: keep assistant tool calls and displaced tool results in the same compaction chunk so strict summarization providers stop rejecting orphaned tool pairs. (#58849) Thanks @openperf.</li>
|
||||
<li>Agents/failover: scope Anthropic <code>An unknown error occurred</code> failover matching by provider so generic internal unknown-error text no longer triggers retryable timeout fallback. (#59325) Thanks @aaron-he-zhu.</li>
|
||||
<li>Agents/subagents: honor allowlist validation, auth-profile handoff, and session override state when a subagent retries after <code>LiveSessionModelSwitchError</code>. (#58178) Thanks @openperf.</li>
|
||||
<li>Agents/runtime: make default subagent allowlists, inherited skills/workspaces, and duplicate session-id resolution behave more predictably, and include value-shape hints in missing-parameter tool errors. (#59944, #59992, #59858, #55317) Thanks @hclsys, @gumadeiras, @joelnishanth, and @priyansh19.</li>
|
||||
<li>Agents/pairing: merge completion announce delivery context with the requester session fallback so missing <code>to</code> still reaches the original channel, and include <code>operator.talk.secrets</code> in CLI default operator scopes for node-role device pairing approvals. (#56481) Thanks @maxpetrusenko.</li>
|
||||
<li>Agents/scheduling: steer background-now work toward automatic completion wake and treat <code>process</code> polling as on-demand inspection or intervention instead of default completion handling. (#60877) Thanks @vincentkoc.</li>
|
||||
<li>Agents/skills: skip <code>.git</code> and <code>node_modules</code> when mirroring skills into sandbox workspaces so read-only sandboxes do not copy repo history or dependency trees. (#61090) Thanks @joelnishanth.</li>
|
||||
<li>ACP/agents: inherit the target agent workspace for cross-agent ACP spawns and fall back safely when the inherited workspace no longer exists. (#58438) Thanks @zssggle-rgb.</li>
|
||||
<li>ACPX/Windows: preserve backslashes and absolute <code>.exe</code> paths in Claude CLI parsing, and fail fast on wrapper-script targets with guidance to use <code>cmd.exe /c</code>, <code>powershell.exe -File</code>, or <code>node <script></code>. (#60689) Thanks @steipete.</li>
|
||||
<li>Auth/failover: persist selected fallback overrides before retrying, shorten <code>auth_permanent</code> lockouts, and refresh websocket/shared-auth sessions only when real auth changes occur so retries and secret rotations behave predictably. (#60404, #60323, #60387) Thanks @extrasmall0 and @mappel-nv.</li>
|
||||
<li>Gateway/channels: pin the initial startup channel registry before later plugin-registry churn so configured channels stay visible and <code>channels.status</code> stops falling back to empty <code>channelOrder</code> / <code>channels</code> payloads after runtime plugin loads.</li>
|
||||
<li>Prompt caching: order stable workspace project-context files before <code>HEARTBEAT.md</code> and keep <code>HEARTBEAT.md</code> below the system-prompt cache boundary so heartbeat churn does not invalidate the stable project-context prefix. (#58979) Thanks @yozu and @vincentkoc.</li>
|
||||
<li>Prompt caching: route Codex Responses and Anthropic Vertex through boundary-aware cache shaping, and report the actual outbound system prompt in cache traces so cache reuse and misses line up with what providers really receive. Thanks @vincentkoc.</li>
|
||||
<li>Agents/cache: preserve the full 3-turn prompt-cache image window across tool loops, keep colliding bundled MCP tool definitions deterministic, and reapply Anthropic Vertex cache shaping after payload hook replacements so KV/cache reuse stays stable. Thanks @vincentkoc.</li>
|
||||
<li>Status/cache: restore <code>cacheRead</code> and <code>cacheWrite</code> in transcript fallback so <code>/status</code> keeps showing cache hit percentages when session logs are the only complete usage source. (#59247) Thanks @stuartsy.</li>
|
||||
<li>Status/usage: let <code>/status</code> and <code>session_status</code> fall back to transcript token totals when the session meta store stayed at zero, so LM Studio, Ollama, DashScope, and similar OpenAI-compatible providers stop showing <code>Context: 0/...</code>. (#55041) Thanks @jjjojoj.</li>
|
||||
<li>Mattermost/config schema: accept <code>groups.*.requireMention</code> again so existing Mattermost configs no longer fail strict validation after upgrade. (#58271) Thanks @MoerAI.</li>
|
||||
<li>Doctor/config: compare normalized <code>talk</code> configs by deep structural equality instead of key-order-sensitive serialization so <code>openclaw doctor --fix</code> stops repeatedly reporting/applying no-op <code>talk.provider/providers</code> normalization. (#59911) Thanks @ejames-dev.</li>
|
||||
<li>Anthropic CLI onboarding: rewrite migrated fallback model refs during non-interactive Claude CLI setup too, so onboarding and scripted setup no longer keep stale <code>anthropic/*</code> fallbacks after switching the primary model to <code>claude-cli/*</code>. Thanks @vincentkoc.</li>
|
||||
<li>Models/Anthropic CLI auth: replace migrated <code>agents.defaults.models</code> allowlists when <code>openclaw models auth login --provider anthropic --method cli --set-default</code> switches to <code>claude-cli/*</code>, so stale <code>anthropic/*</code> entries do not linger beside the migrated Claude CLI defaults. Thanks @vincentkoc.</li>
|
||||
<li>Doctor/Claude CLI: add dedicated Claude CLI health checks so <code>openclaw doctor</code> can spot missing local installs or broken auth before agent runs fail. Thanks @vincentkoc.</li>
|
||||
<li>Plugins/auth-choice: apply provider-owned auth config patches without recursively preserving replaced default-model maps, so Anthropic Claude CLI and similar migrations can intentionally swap model allowlists during onboarding and setup instead of accumulating stale entries. Thanks @vincentkoc.</li>
|
||||
<li>Plugins/onboarding: write dotted plugin uiHint paths like Brave <code>webSearch.mode</code> as nested plugin config so <code>llm-context</code> setup stops failing validation. (#61159) Thanks @obviyus.</li>
|
||||
<li>Plugins/install: preserve unsafe override flags across linked plugin and hook-pack probes so local <code>--link</code> installs honor the documented override behavior. (#60624) Thanks @JerrettDavis.</li>
|
||||
<li>Plugins/cache: inherit the active gateway workspace for provider, web-search, and web-fetch snapshot loads when callers omit <code>workspaceDir</code>, so compatible plugin registries and snapshot caches stop missing on gateway-owned runtime paths. (#61138) Thanks @jzakirov.</li>
|
||||
<li>Plugin SDK/context engines: export the missing context-engine result and subagent lifecycle types from <code>openclaw/plugin-sdk</code> so context engine plugins can type <code>ContextEngine</code> implementations without local workarounds. (#61251) Thanks @DaevMithran.</li>
|
||||
<li>Tasks/maintenance: reconcile stale cron and chat-backed CLI task rows against live cron-job and agent-run ownership instead of treating any persisted session key as proof that the task is still running. (#60310) Thanks @lml2468.</li>
|
||||
<li>Plugins: suppress trust-warning noise during non-activating snapshot and CLI metadata loads. (#61427) Thanks @gumadeiras.</li>
|
||||
<li>Agents/video generation: accept <code>agents.defaults.videoGenerationModel</code> in strict config validation and <code>openclaw config set/get</code>, so gateways using <code>video_generate</code> no longer fail to boot after enabling a video model.</li>
|
||||
<li>Matrix/streaming: add a quiet preview mode for streamed Matrix replies, keep legacy <code>partial</code> preview-first behavior, and finalize quiet media captions correctly so previews stop notifying early without dropping final text semantics. (#61450) Thanks @gumadeiras.</li>
|
||||
<li>Gateway/shutdown: bound websocket-server shutdown even when no tracked clients remain, so gateway restarts stop hanging until the watchdog kills the process. (#61565) Thanks @mbelinky.</li>
|
||||
<li>Control UI/multilingual: localize the remaining shared channel, instances, nodes, and gateway-confirmation strings so the dashboard stops mixing translated UI with hardcoded English labels. Thanks @vincentkoc.</li>
|
||||
<li>Discord/media: raise the default inbound and outbound media cap to <code>100MB</code> so Discord matches Telegram more closely and larger attachments stop failing on the old low default.</li>
|
||||
<li>Matrix: keep direct transport requests on the pinned dispatcher by routing them through undici runtime fetch, so Matrix clients resume syncing on newer runtimes without dropping the validated address binding. (#61595) Thanks @gumadeiras.</li>
|
||||
<li>Plugins/facades: resolve globally installed bundled-plugin runtime facades from registry roots so bundled channels like LINE still boot when the winning plugin install lives under the global extensions directory with an encoded scoped folder name. (#61297) Thanks @openperf.</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.5/OpenClaw-2026.4.5.zip" length="25050620" type="application/octet-stream" sparkle:edSignature="gVbB/73byllY0utwGIi3P5t0FyvLldeR0Uq2pAa6LTBr8VyZlwNCZ2xPlt2zDFshSUBFKxicYzohOmfJ28ACBg=="/>
|
||||
</item>
|
||||
<item>
|
||||
<title>2026.4.2</title>
|
||||
<pubDate>Thu, 02 Apr 2026 18:57:54 +0000</pubDate>
|
||||
@@ -435,5 +187,121 @@
|
||||
]]></description>
|
||||
<enclosure url="https://github.com/openclaw/openclaw/releases/download/v2026.4.1/OpenClaw-2026.4.1.zip" length="25841903" type="application/octet-stream" sparkle:edSignature="0TPiyshScmwDbgs626JU08NOUUFJmIsVFa5g0xmizfl64Fr+IoT4l/dkXarFqbZAJidtj5WN7Bff7fG8ye/7AA=="/>
|
||||
</item>
|
||||
<item>
|
||||
<title>2026.3.31</title>
|
||||
<pubDate>Tue, 31 Mar 2026 21:47:15 +0000</pubDate>
|
||||
<link>https://raw.githubusercontent.com/openclaw/openclaw/main/appcast.xml</link>
|
||||
<sparkle:version>2026033190</sparkle:version>
|
||||
<sparkle:shortVersionString>2026.3.31</sparkle:shortVersionString>
|
||||
<sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>
|
||||
<description><![CDATA[<h2>OpenClaw 2026.3.31</h2>
|
||||
<h3>Breaking</h3>
|
||||
<ul>
|
||||
<li>Nodes/exec: remove the duplicated <code>nodes.run</code> shell wrapper from the CLI and agent <code>nodes</code> tool so node shell execution always goes through <code>exec host=node</code>, keeping node-specific capabilities on <code>nodes invoke</code> and the dedicated media/location/notify actions.</li>
|
||||
<li>Plugin SDK: deprecate the legacy provider compat subpaths plus the older bundled provider setup and channel-runtime compatibility shims, emit migration warnings, and keep the current documented <code>openclaw/plugin-sdk/*</code> entrypoints plus local <code>api.ts</code> / <code>runtime-api.ts</code> barrels as the forward path ahead of a future major-release removal.</li>
|
||||
<li>Skills/install and Plugins/install: built-in dangerous-code <code>critical</code> findings and install-time scan failures now fail closed by default, so plugin installs and gateway-backed skill dependency installs that previously succeeded may now require an explicit dangerous override such as <code>--dangerously-force-unsafe-install</code> to proceed.</li>
|
||||
<li>Gateway/auth: <code>trusted-proxy</code> now rejects mixed shared-token configs, and local-direct fallback requires the configured token instead of implicitly authenticating same-host callers. Thanks @zhangning-agent, @jacobtomlinson, and @vincentkoc.</li>
|
||||
<li>Gateway/node commands: node commands now stay disabled until node pairing is approved, so device pairing alone is no longer enough to expose declared node commands. (#57777) Thanks @jacobtomlinson.</li>
|
||||
<li>Gateway/node events: node-originated runs now stay on a reduced trusted surface, so notification-driven or node-triggered flows that previously relied on broader host/session tool access may need adjustment. (#57691) Thanks @jacobtomlinson.</li>
|
||||
</ul>
|
||||
<h3>Changes</h3>
|
||||
<ul>
|
||||
<li>ACP/plugins: add an explicit default-off ACPX plugin-tools MCP bridge config, document the trust boundary, and harden the built-in bridge packaging/logging path so global installs and stdio MCP sessions work reliably. (#56867) Thanks @joe2643.</li>
|
||||
<li>Agents/LLM: add a configurable idle-stream timeout for embedded runner requests so stalled model streams abort cleanly instead of hanging until the broader run timeout fires. (#55072) Thanks @liuy.</li>
|
||||
<li>Agents/MCP: materialize bundle MCP tools with provider-safe names (<code>serverName__toolName</code>), support optional <code>streamable-http</code> transport selection plus per-server connection timeouts, and preserve real tool results from aborted/error turns unless truncation explicitly drops them. (#49505) Thanks @ziomancer.</li>
|
||||
<li>Android/notifications: add notification-forwarding controls with package filtering, quiet hours, rate limiting, and safer picker behavior for forwarded notification events. (#40175) Thanks @nimbleenigma.</li>
|
||||
<li>Background tasks: turn tasks into a real shared background-run control plane instead of ACP-only bookkeeping by unifying ACP, subagent, cron, and background CLI execution under one SQLite-backed ledger, routing detached lifecycle updates through the executor seam, adding audit/maintenance/status visibility, tightening auto-cleanup and lost-run recovery, improving task awareness in internal status/tool surfaces, and clarifying the split between heartbeat/main-session automation and detached scheduled runs. Thanks @mbelinky and @vincentkoc.</li>
|
||||
<li>Background tasks: add the first linear task flow control surface with <code>openclaw flows list|show|cancel</code>, keep manual multi-task flows separate from one-task auto-sync flows, and surface doctor recovery hints for obviously orphaned or broken flow/task linkage. Thanks @mbelinky and @vincentkoc.</li>
|
||||
<li>Channels/QQ Bot: add QQ Bot as a bundled channel plugin with multi-account setup, SecretRef-aware credentials, slash commands, reminders, and media send/receive support. (#52986) Thanks @sliverp.</li>
|
||||
<li>Diffs: skip unused viewer-versus-file SSR preload work so <code>diffs</code> view-only and file-only runs do less render work while keeping mode outputs aligned. (#57909) thanks @gumadeiras.</li>
|
||||
<li>Tasks: add a minimal SQLite-backed task flow registry plus task-to-flow linkage scaffolding, so orchestrated work can start gaining a first-class parent record without changing current task delivery behavior. Thanks @mbelinky and @vincentkoc.</li>
|
||||
<li>Tasks: persist blocked state on one-task task flows and let the same flow reopen cleanly on retry, so blocked detached work can carry a parent-level reason and continue without fragmenting into a new job. Thanks @mbelinky and @vincentkoc.</li>
|
||||
<li>Tasks: route one-task ACP and subagent updates through a parent task-flow owner context, so detached work can emerge back through the intended parent thread/session instead of speaking only as a raw child task. Thanks @mbelinky and @vincentkoc.</li>
|
||||
<li>LINE/outbound media: add LINE image, video, and audio outbound sends on the LINE-specific delivery path, including explicit preview/tracking handling for videos while keeping generic media sends on the existing image-only route. (#45826) Thanks @masatohoshino.</li>
|
||||
<li>Matrix/history: add optional room history context for Matrix group triggers via <code>channels.matrix.historyLimit</code>, with per-agent watermarks and retry-safe snapshots so failed trigger retries do not drift into newer room messages. (#57022) thanks @chain710.</li>
|
||||
<li>Matrix/network: add explicit <code>channels.matrix.proxy</code> config for routing Matrix traffic through an HTTP(S) proxy, including account-level overrides and matching probe/runtime behavior. (#56931) thanks @patrick-yingxi-pan.</li>
|
||||
<li>Matrix/streaming: add draft streaming so partial Matrix replies update the same message in place instead of sending a new message for each chunk. (#56387) Thanks @jrusz.</li>
|
||||
<li>Matrix/threads: add per-DM <code>threadReplies</code> overrides and keep thread session isolation aligned with the effective room or DM thread policy from the triggering message onward. (#57995) thanks @teconomix.</li>
|
||||
<li>MCP: add remote HTTP/SSE server support for <code>mcp.servers</code> URL configs, including auth headers and safer config redaction for MCP credentials. (#50396) Thanks @dhananjai1729.</li>
|
||||
<li>Memory/QMD: add per-agent <code>memorySearch.qmd.extraCollections</code> so agents can opt into cross-agent session search without flattening every transcript collection into one shared QMD namespace. Thanks @vincentkoc.</li>
|
||||
<li>Microsoft Teams/member info: add a Graph-backed member info action so Teams automations and tools can resolve channel member details directly from Microsoft Graph. (#57528) Thanks @sudie-codes.</li>
|
||||
<li>Nostr/inbound DMs: verify inbound event signatures before pairing or sender-authorization side effects, so forged DM events no longer create pairing requests or trigger reply attempts. Thanks @smaeljaish771 and @vincentkoc.</li>
|
||||
<li>OpenAI/Responses: forward configured <code>text.verbosity</code> across Responses HTTP and WebSocket transports, surface it in <code>/status</code>, and keep per-agent verbosity precedence aligned with runtime behavior. (#47106) Thanks @merc1305 and @vincentkoc.</li>
|
||||
<li>Pi/Codex: add native Codex web search support for embedded Pi runs, including config/docs/wizard coverage and managed-tool suppression when native Codex search is active. (#46579) Thanks @Evizero.</li>
|
||||
<li>Slack/exec approvals: add native Slack approval routing and approver authorization so exec approval prompts can stay in Slack instead of falling back to the Web UI or terminal. Thanks @vincentkoc.</li>
|
||||
<li>TTS: Add structured provider diagnostics and fallback attempt analytics. (#57954) Thanks @joshavant.</li>
|
||||
<li>WhatsApp/reactions: agents can now react with emoji on incoming WhatsApp messages, enabling more natural conversational interactions like acknowledging a photo with ❤️ instead of typing a reply. Thanks @mcaxtr.</li>
|
||||
<li>Agents/BTW: force <code>/btw</code> side questions to disable provider reasoning so Anthropic adaptive-thinking sessions stop failing with <code>No BTW response generated</code>. Fixes #55376. Thanks @Catteres and @vincentkoc.</li>
|
||||
<li>CLI/onboarding: reset the remote gateway URL prompt to the safe loopback default after declining a discovered endpoint, so onboarding does not keep a previously rejected remote URL. (#57828)</li>
|
||||
<li>Agents/exec defaults: honor per-agent <code>tools.exec</code> defaults when no inline directive or session override is present, so configured exec host, security, ask, and node settings actually apply. (#57689)</li>
|
||||
<li>Sandbox/networking: sanitize SSH subprocess env vars through the shared sandbox policy and route marketplace archive downloads plus Ollama discovery, auth, and pull requests through the guarded fetch path so sandboxed execution and remote fetches follow the repo's trust boundaries. (#57848, #57850)</li>
|
||||
</ul>
|
||||
<h3>Fixes</h3>
|
||||
<ul>
|
||||
<li>Slack: stop retry-driven duplicate replies when draft-finalization edits fail ambiguously, and log configured allowlisted users/channels by readable name instead of raw IDs.</li>
|
||||
<li>Agents/OpenAI Responses: normalize raw bundled MCP tool schemas on the WebSocket/Responses path so bare-object, object-ish, and top-level union MCP tools no longer get rejected by OpenAI during tool registration. (#58299) Thanks @yelog.</li>
|
||||
<li>ACP/security: replace ACP's dangerous-tool name override with semantic approval classes, so only narrow readonly reads/searches can auto-approve while indirect exec-capable and control-plane tools always require explicit prompt approval. Thanks @vincentkoc.</li>
|
||||
<li>ACP/sessions_spawn: register ACP child runs for completion tracking and lifecycle cleanup, and make registration-failure cleanup explicitly best-effort so callers do not assume an already-started ACP turn was fully aborted. (#40885) Thanks @xaeon2026 and @vincentkoc.</li>
|
||||
<li>ACP/tasks: mark cleanly exited ACP runs as blocked when they end on deterministic write or authorization blockers, and wake the parent session with a follow-up instead of falsely reporting success.</li>
|
||||
<li>ACPX/runtime: derive the bundled ACPX expected version from the extension package metadata instead of hardcoding a separate literal, so plugin-local ACPX installs stop drifting out of health-check parity after version bumps. (#49089) Thanks @jiejiesks and @vincentkoc.</li>
|
||||
<li>Agents/Anthropic failover: treat Anthropic <code>api_error</code> payloads with <code>An unexpected error occurred while processing the response</code> as transient so retry/fallback can engage instead of surfacing a terminal failure. (#57441) Thanks @zijiess and @vincentkoc.</li>
|
||||
<li>Agents/compaction: keep late compaction-retry completions from double-resolving finished compaction futures, so interrupted or timed-out compactions stop surfacing spurious second-completion races. (#57796) Thanks @joshavant.</li>
|
||||
<li>Agents/disabled providers: make disabled providers disappear from default model selection and embedded provider fallback, while letting explicitly pinned disabled providers fail with a clear config error instead of silently taking traffic. (#57735) Thanks @rileybrown-dev and @vincentkoc.</li>
|
||||
<li>Agents/OAuth output: force exec-host OAuth output readers through the gateway fs policy so embedded gateway runs stop crashing when provider auth writes land outside the current sandbox workspace. (#58249) Thanks @joshavant.</li>
|
||||
<li>Agents/system prompt: fix <code>agent.name</code> interpolation in the embedded runtime system prompt and make provider/model fallback text reflect the effective runtime selection after start. (#57625) Thanks @StllrSvr and @vincentkoc.</li>
|
||||
<li>Android/device info: read the app's version metadata from the package manager instead of hidden APIs so Android 15+ onboarding and device info no longer fail to compile or report placeholder values. (#58126) Thanks @L3ER0Y.</li>
|
||||
<li>Android/pairing: stop appending duplicate push receiver entries to <code>gateway-service.conf</code> on repeated QR pairing and keep push registration bounded to the current successful pairing, so Android push delivery stays healthy across re-pair and token rotation. (#58256) Thanks @surrealroad.</li>
|
||||
<li>App install smoke: pin the latest-release lookup to <code>latest</code>, cache the first stable install version across the rerun, and relax prerelease package assertions so the Parallels smoke lane can validate stable-to-main upgrades even when <code>beta</code> moves ahead or the guest starts from an older stable. (#58177) Thanks @vincentkoc.</li>
|
||||
<li>Auth/profiles: keep the last successful config load in memory for the running process and refresh that snapshot on successful writes/reloads, so hot paths stop reparsing <code>openclaw.json</code> between watcher-driven swaps.</li>
|
||||
<li>Config/SecretRef + Control UI: harden SecretRef redaction round-trip restore, block unsafe raw fallback (force Form mode when raw is unavailable), and preflight submitted-config SecretRefs before config write RPC persistence. (#58044) Thanks @joshavant.</li>
|
||||
<li>Config/Telegram: migrate removed <code>channels.telegram.groupMentionsOnly</code> into <code>channels.telegram.groups[\"*\"].requireMention</code> on load so legacy configs no longer crash at startup. (#55336) thanks @jameslcowan.</li>
|
||||
<li>Config/update: stop <code>openclaw doctor</code> write-backs from persisting plugin-injected channel defaults, so <code>openclaw update</code> no longer seeds config keys that later break service refresh validation. (#56834) Thanks @openperf.</li>
|
||||
<li>Control UI/agents: auto-load agent workspace files on initial Files panel open, and populate overview model/workspace/fallbacks from effective runtime agent metadata so defaulted models no longer show as <code>Not set</code>. (#56637) Thanks @dxsx84.</li>
|
||||
<li>Control UI/slash commands: make <code>/steer</code> and <code>/redirect</code> work from the chat command palette with visible pending state for active-run <code>/steer</code>, correct redirected-run tracking, and a single canonical <code>/steer</code> entry in the command menu. (#54625) Thanks @fuller-stack-dev.</li>
|
||||
<li>Cron/announce: preserve all deliverable text payloads for announce mode instead of collapsing to the last chunk, so multi-line cron reports deliver in full to Telegram forum topics.</li>
|
||||
<li>Cron/isolated sessions: carry the full live-session provider, model, and auth-profile selection across retry restarts so cron jobs with model overrides no longer fail or loop on mid-run model-switch requests. (#57972) Thanks @issaba1.</li>
|
||||
<li>Diffs/config: preserve schema-shaped plugin config parsing from <code>diffsPluginConfigSchema.safeParse()</code>, so direct callers keep <code>defaults</code> and <code>security</code> sections instead of receiving flattened tool defaults. (#57904) Thanks @gumadeiras.</li>
|
||||
<li>Diffs: fall back to plain text when <code>lang</code> hints are invalid during diff render and viewer hydration, so bad or stale language values no longer break the diff viewer. (#57902) Thanks @gumadeiras.</li>
|
||||
<li>Discord/voice: enforce the same guild channel and member allowlist checks on spoken voice ingress before transcription, so joined voice channels no longer accept speech from users outside the configured Discord access policy. Thanks @cyjhhh and @vincentkoc.</li>
|
||||
<li>Docker/setup: force BuildKit for local image builds (including sandbox image builds) so <code>./docker-setup.sh</code> no longer fails on <code>RUN --mount=...</code> when hosts default to Docker's legacy builder. (#56681) Thanks @zhanghui-china.</li>
|
||||
<li>Docs/anchors: fix broken English docs links and make Mint anchor audits run against the English-source docs tree. (#57039) thanks @velvet-shark.</li>
|
||||
<li>Doctor/plugins: skip false Matrix legacy-helper warnings when no migration plans exist, and keep bundled <code>enabledByDefault</code> plugins in the gateway startup set. (#57931) Thanks @dinakars777.</li>
|
||||
<li>Exec approvals/macOS: unwrap <code>arch</code> and <code>xcrun</code> before deriving shell payloads and allow-always patterns, so wrapper approvals stay bound to the carried command instead of the outer carrier. Thanks @tdjackey and @vincentkoc.</li>
|
||||
<li>Exec approvals: unwrap <code>caffeinate</code> and <code>sandbox-exec</code> before persisting allow-always trust so later shell payload changes still require a fresh approval. Thanks @tdjackey and @vincentkoc.</li>
|
||||
<li>Exec/approvals: infer Discord and Telegram exec approvers from existing owner config when <code>execApprovals.approvers</code> is unset, extend the default approval window to 30 minutes, and clarify approval-unavailable guidance so approvals do not appear to silently disappear.</li>
|
||||
<li>Pi/TUI: flush message-boundary replies at <code>message_end</code> so turns stop looking stuck until the next nudge when the final reply was already ready. Thanks @vincentkoc.</li>
|
||||
<li>Exec/approvals: keep <code>awk</code> and <code>sed</code> family binaries out of the low-risk <code>safeBins</code> fast path, and stop doctor profile scaffolding from treating them like ordinary custom filters. Thanks @vincentkoc.</li>
|
||||
<li>Exec/env: block proxy, TLS, and Docker endpoint env overrides in host execution so request-scoped commands cannot silently reroute outbound traffic or trust attacker-supplied certificate settings. Thanks @AntAISecurityLab.</li>
|
||||
<li>Exec/env: block Python package index override variables from request-scoped host exec environment sanitization so package fetches cannot be redirected through a caller-supplied index. Thanks @nexrin and @vincentkoc.</li>
|
||||
<li>Exec/node: stop gateway-side workdir fallback from rewriting explicit <code>host=node</code> cwd values to the gateway filesystem, so remote node exec approval and runs keep using the intended node-local directory. (#50961) Thanks @openperf.</li>
|
||||
<li>Exec/runtime: default implicit exec to <code>host=auto</code>, resolve that target to sandbox only when a sandbox runtime exists, keep explicit <code>host=sandbox</code> fail-closed without sandbox, and show <code>/exec</code> effective host state in runtime status/docs.</li>
|
||||
<li>Exec: fail closed when the implicit sandbox host has no sandbox runtime, and stop denied async approval followups from reusing prior command output from the same session. (#56800) Thanks @scoootscooob.</li>
|
||||
<li>Feishu/groups: keep quoted replies and topic bootstrap context aligned with group sender allowlists so only allowlisted thread messages seed agent context. Thanks @AntAISecurityLab and @vincentkoc.</li>
|
||||
<li>Gateway/attachments: offload large inbound images without leaking <code>media://</code> markers into text-only runs, preserve mixed attachment order for model input/transcripts, and fail closed when model image capability cannot be resolved. (#55513) Thanks @Syysean.</li>
|
||||
<li>Gateway/auth: keep shared-auth rate limiting active during WebSocket handshake attempts even when callers also send device-token candidates, so bogus device-token fields no longer suppress shared-secret brute-force tracking. Thanks @kexinoh and @vincentkoc.</li>
|
||||
<li>Gateway/auth: reject mismatched browser <code>Origin</code> headers on trusted-proxy HTTP operator requests while keeping origin-less headless proxy clients working. Thanks @AntAISecurityLab and @vincentkoc.</li>
|
||||
<li>Gateway/device tokens: disconnect active device sessions after token rotation so newly rotated credentials revoke existing live connections immediately instead of waiting for those sockets to close naturally. Thanks @zsxsoft and @vincentkoc.</li>
|
||||
<li>Gateway/health: carry webhook-vs-polling account mode from channel descriptors into runtime snapshots so passive channels like LINE and BlueBubbles skip false stale-socket health failures. (#47488) Thanks @karesansui-u.</li>
|
||||
<li>Gateway/pairing: restore QR bootstrap onboarding handoff so fresh <code>/pair qr</code> iPhone setup can auto-approve the initial node pairing, receive a reusable node device token, and stop retrying with spent bootstrap auth. (#58382) Thanks @ngutman.</li>
|
||||
<li>Gateway/OpenAI compatibility: accept flat Responses API function tool definitions on <code>/v1/responses</code> and preserve <code>strict</code> when normalizing hosted tools into the embedded runner, so spec-compliant clients like Codex no longer fail validation or silently lose strict tool enforcement. Thanks @malaiwah and @vincentkoc.</li>
|
||||
<li>Gateway/OpenAI HTTP: restore default operator scopes for bearer-authenticated requests that omit <code>x-openclaw-scopes</code>, so headless <code>/v1/chat/completions</code> and session-history callers work again after the recent method-scope hardening. (#57596) Thanks @openperf.</li>
|
||||
<li>Gateway/plugins: scope plugin-auth HTTP route runtime clients to read-only access and keep gateway-authenticated plugin routes on write scope, so plugin-owned webhook handlers do not inherit write-capable runtime access by default. Thanks @davidluzsilva and @vincentkoc.</li>
|
||||
<li>Gateway/SecretRef: resolve restart token drift checks with merged service/runtime env sources and hard-fail unsupported mutable SecretRef plus OAuth-profile combinations so restart warnings and policy enforcement match runtime behavior. (#58141) Thanks @joshavant.</li>
|
||||
<li>Gateway/tools HTTP: tighten HTTP tool-invoke authorization so owner-only tools stay off HTTP invoke paths. (#57773) Thanks @jacobtomlinson.</li>
|
||||
<li>Harden async approval followup delivery in webchat-only sessions (#57359) Thanks @joshavant.</li>
|
||||
<li>Heartbeat/auth: prevent exec-event heartbeat runs from inheriting owner-only tool access from the session delivery target, so node exec output stays on the non-owner tool surface even when the target session belongs to the owner. Thanks @AntAISecurityLab and @vincentkoc.</li>
|
||||
<li>Hooks/config: accept runtime channel plugin ids in <code>hooks.mappings[].channel</code> (for example <code>feishu</code>) instead of rejecting non-core channels during config validation. (#56226) Thanks @AiKrai001.</li>
|
||||
<li>Hooks/session routing: rebind hook-triggered <code>agent:</code> session keys to the actual target agent before isolated dispatch so dedicated hook agents keep their own session-scoped tool and plugin identity. Thanks @kexinoh and @vincentkoc.</li>
|
||||
<li>Host exec/env: block additional request-scoped env overrides that can redirect Docker endpoints, trust roots, compiler include paths, package resolution, or Python environment roots during approved host runs. Thanks @tdjackey and @vincentkoc.</li>
|
||||
<li>Image generation/build: write stable runtime alias files into <code>dist/</code> and route provider-auth runtime lookups through those aliases so image-generation providers keep resolving auth/runtime modules after rebuilds instead of crashing on missing hashed chunk files.</li>
|
||||
<li>iOS/Live Activities: mark the <code>ActivityKit</code> import in <code>LiveActivityManager.swift</code> as <code>@preconcurrency</code> so Xcode 26.4 / Swift 6 builds stop failing on strict concurrency checks. (#57180) Thanks @ngutman.</li>
|
||||
<li>LINE/ACP: add current-conversation binding and inbound binding-routing parity so <code>/acp spawn ... --thread here</code>, configured ACP bindings, and active conversation-bound ACP sessions work on LINE like the other conversation channels.</li>
|
||||
<li>LINE/markdown: preserve underscores inside Latin, Cyrillic, and CJK words when stripping markdown, while still removing standalone <code>_italic_</code> markers on the shared text-runtime path used by LINE and TTS. (#47465) Thanks @jackjin1997.</li>
|
||||
<li>Agents/failover: make overloaded same-provider retry count and retry delay configurable via <code>auth.cooldowns</code>, default to one retry with no delay, and document the model-fallback behavior.</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.3.31/OpenClaw-2026.3.31.zip" length="25820093" type="application/octet-stream" sparkle:edSignature="NjpuH/j7OaNASEatBTpQ4uQy6+oUNq/lIwjrY69rJfkgGSk3/kU8vgxo9osjSgx034m7TpuZvWyulu57OBsQCg=="/>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
</rss>
|
||||
@@ -65,8 +65,8 @@ android {
|
||||
applicationId = "ai.openclaw.app"
|
||||
minSdk = 31
|
||||
targetSdk = 36
|
||||
versionCode = 2026040601
|
||||
versionName = "2026.4.6"
|
||||
versionCode = 2026040501
|
||||
versionName = "2026.4.5"
|
||||
ndk {
|
||||
// Support all major ABIs — native libs are tiny (~47 KB per ABI)
|
||||
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
||||
|
||||
@@ -3,23 +3,19 @@
|
||||
|
||||
OPENCLAW_IOS_DEFAULT_TEAM = Y5PE65HELJ
|
||||
OPENCLAW_IOS_SELECTED_TEAM = $(OPENCLAW_IOS_DEFAULT_TEAM)
|
||||
OPENCLAW_DEVELOPMENT_TEAM = $(OPENCLAW_IOS_SELECTED_TEAM)
|
||||
OPENCLAW_CODE_SIGN_STYLE = Automatic
|
||||
OPENCLAW_APP_BUNDLE_ID = ai.openclaw.client
|
||||
OPENCLAW_WATCH_APP_BUNDLE_ID = ai.openclaw.client.watchkitapp
|
||||
OPENCLAW_WATCH_EXTENSION_BUNDLE_ID = ai.openclaw.client.watchkitapp.extension
|
||||
OPENCLAW_ACTIVITY_WIDGET_BUNDLE_ID = ai.openclaw.client.activitywidget
|
||||
OPENCLAW_WATCH_APP_PROFILE =
|
||||
OPENCLAW_WATCH_EXTENSION_PROFILE =
|
||||
|
||||
// Local contributors can override this by running scripts/ios-configure-signing.sh.
|
||||
// Keep include after defaults: xcconfig is evaluated top-to-bottom.
|
||||
#include? "../.local-signing.xcconfig"
|
||||
#include? "../LocalSigning.xcconfig"
|
||||
|
||||
CODE_SIGN_STYLE = $(OPENCLAW_CODE_SIGN_STYLE)
|
||||
CODE_SIGN_STYLE = Automatic
|
||||
CODE_SIGN_IDENTITY = Apple Development
|
||||
DEVELOPMENT_TEAM = $(OPENCLAW_DEVELOPMENT_TEAM)
|
||||
DEVELOPMENT_TEAM = $(OPENCLAW_IOS_SELECTED_TEAM)
|
||||
|
||||
// Let Xcode manage provisioning for the selected local team unless a local override pins one.
|
||||
// Let Xcode manage provisioning for the selected local team.
|
||||
PROVISIONING_PROFILE_SPECIFIER =
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Shared iOS version defaults.
|
||||
// Generated overrides live in build/Version.xcconfig (git-ignored).
|
||||
|
||||
OPENCLAW_GATEWAY_VERSION = 2026.4.6
|
||||
OPENCLAW_MARKETING_VERSION = 2026.4.6
|
||||
OPENCLAW_BUILD_VERSION = 2026040601
|
||||
OPENCLAW_GATEWAY_VERSION = 2026.4.5
|
||||
OPENCLAW_MARKETING_VERSION = 2026.4.5
|
||||
OPENCLAW_BUILD_VERSION = 2026040501
|
||||
|
||||
#include? "../build/Version.xcconfig"
|
||||
|
||||
@@ -13,5 +13,3 @@ OPENCLAW_WATCH_EXTENSION_BUNDLE_ID = ai.openclaw.client.watchkitapp.extension
|
||||
// Leave empty with automatic signing.
|
||||
OPENCLAW_APP_PROFILE =
|
||||
OPENCLAW_SHARE_PROFILE =
|
||||
OPENCLAW_WATCH_APP_PROFILE =
|
||||
OPENCLAW_WATCH_EXTENSION_PROFILE =
|
||||
|
||||
@@ -148,9 +148,6 @@ pnpm ios:beta
|
||||
- Local/manual builds default to `OpenClawPushTransport=direct` and `OpenClawPushDistribution=local`.
|
||||
- Your selected team/profile must support Push Notifications for the app bundle ID you are signing.
|
||||
- If push capability or provisioning is wrong, APNs registration fails at runtime (check Xcode logs for `APNs registration failed`).
|
||||
- The gateway host also needs direct APNs auth configured separately with `OPENCLAW_APNS_TEAM_ID`, `OPENCLAW_APNS_KEY_ID`, and either `OPENCLAW_APNS_PRIVATE_KEY_P8` or `OPENCLAW_APNS_PRIVATE_KEY_PATH`.
|
||||
- Recommended gateway-host storage for the APNs `.p8` file is `~/.openclaw/credentials/apns/AuthKey_<KEYID>.p8` with restrictive permissions, then point `OPENCLAW_APNS_PRIVATE_KEY_PATH` at that file.
|
||||
- `apps/ios/fastlane/.env` only covers App Store Connect / Fastlane auth; it does not provide gateway APNs credentials for local direct-push testing.
|
||||
- Debug builds default to `OpenClawPushAPNsEnvironment=sandbox`; Release builds default to `production`.
|
||||
|
||||
## APNs Expectations For Official Builds
|
||||
|
||||
@@ -61,10 +61,9 @@ final class NodeAppModel {
|
||||
let request: AgentDeepLink
|
||||
}
|
||||
|
||||
struct ExecApprovalPrompt: Identifiable, Equatable, Codable, Sendable {
|
||||
struct ExecApprovalPrompt: Identifiable, Equatable {
|
||||
let id: String
|
||||
let commandText: String
|
||||
let commandPreview: String?
|
||||
let allowedDecisions: [String]
|
||||
let host: String?
|
||||
let nodeId: String?
|
||||
@@ -83,17 +82,11 @@ final class NodeAppModel {
|
||||
case failed(message: String)
|
||||
}
|
||||
|
||||
private struct PersistedWatchExecApprovalBridgeState: Codable {
|
||||
var approvals: [ExecApprovalPrompt]
|
||||
var pendingApprovalIDs: [String]?
|
||||
}
|
||||
|
||||
private let deepLinkLogger = Logger(subsystem: "ai.openclaw.ios", category: "DeepLink")
|
||||
private let pushWakeLogger = Logger(subsystem: "ai.openclaw.ios", category: "PushWake")
|
||||
private let pendingActionLogger = Logger(subsystem: "ai.openclaw.ios", category: "PendingAction")
|
||||
private let locationWakeLogger = Logger(subsystem: "ai.openclaw.ios", category: "LocationWake")
|
||||
private let watchReplyLogger = Logger(subsystem: "ai.openclaw.ios", category: "WatchReply")
|
||||
private let watchExecApprovalLogger = Logger(subsystem: "ai.openclaw.ios", category: "WatchExecApproval")
|
||||
private let execApprovalNotificationLogger = Logger(
|
||||
subsystem: "ai.openclaw.ios",
|
||||
category: "ExecApprovalNotification")
|
||||
@@ -173,8 +166,6 @@ final class NodeAppModel {
|
||||
private var backgroundReconnectLeaseUntil: Date?
|
||||
private var lastSignificantLocationWakeAt: Date?
|
||||
@ObservationIgnored private let watchReplyCoordinator = WatchReplyCoordinator()
|
||||
private var watchExecApprovalPromptsByID: [String: ExecApprovalPrompt] = [:]
|
||||
private var pendingWatchExecApprovalRecoveryIDs: [String] = []
|
||||
private var pendingForegroundActionDrainInFlight = false
|
||||
|
||||
private var gatewayConnected = false
|
||||
@@ -188,8 +179,6 @@ final class NodeAppModel {
|
||||
var operatorSession: GatewayNodeSession { self.operatorGateway }
|
||||
private(set) var activeGatewayConnectConfig: GatewayConnectConfig?
|
||||
|
||||
private static let watchExecApprovalBridgeStateKey = "watch.execApproval.bridge.state.v1"
|
||||
|
||||
var cameraHUDText: String?
|
||||
var cameraHUDKind: CameraHUDKind?
|
||||
var cameraFlashNonce: Int = 0
|
||||
@@ -224,40 +213,12 @@ final class NodeAppModel {
|
||||
self.watchMessagingService = watchMessagingService
|
||||
self.talkMode = talkMode
|
||||
self.apnsDeviceTokenHex = UserDefaults.standard.string(forKey: Self.apnsDeviceTokenUserDefaultsKey)
|
||||
self.restorePersistedWatchExecApprovalBridgeState()
|
||||
GatewayDiagnostics.bootstrap()
|
||||
GatewayDiagnostics.log("node app model: init start")
|
||||
self.watchMessagingService.setStatusHandler { [weak self] status in
|
||||
Task { @MainActor in
|
||||
GatewayDiagnostics.log(
|
||||
"node app model: watch status callback reachable=\(status.reachable) activation=\(status.activationState) backgrounded=\(self?.isBackgrounded ?? false)")
|
||||
await self?.handleWatchMessagingStatusChanged(status)
|
||||
}
|
||||
}
|
||||
self.watchMessagingService.setReplyHandler { [weak self] event in
|
||||
Task { @MainActor in
|
||||
await self?.handleWatchQuickReply(event)
|
||||
}
|
||||
}
|
||||
self.watchMessagingService.setExecApprovalResolveHandler { [weak self] event in
|
||||
Task { @MainActor in
|
||||
await self?.handleWatchExecApprovalResolve(event)
|
||||
}
|
||||
}
|
||||
self.watchMessagingService.setExecApprovalSnapshotRequestHandler { [weak self] event in
|
||||
Task { @MainActor in
|
||||
guard let self else { return }
|
||||
GatewayDiagnostics.log(
|
||||
"node app model: watch snapshot request id=\(event.requestId) backgrounded=\(self.isBackgrounded)")
|
||||
guard self.isBackgrounded else {
|
||||
self.watchExecApprovalLogger.debug(
|
||||
"watch exec approval snapshot skipped reason=watch_request_foreground")
|
||||
GatewayDiagnostics.log("node app model: watch snapshot request skipped in foreground")
|
||||
return
|
||||
}
|
||||
await self.refreshWatchExecApprovalSnapshotOnDemand(reason: "watch_request")
|
||||
}
|
||||
}
|
||||
|
||||
self.voiceWake.configure { [weak self] cmd in
|
||||
guard let self else { return }
|
||||
@@ -374,7 +335,6 @@ final class NodeAppModel {
|
||||
|
||||
func setScenePhase(_ phase: ScenePhase) {
|
||||
let keepTalkActive = UserDefaults.standard.bool(forKey: "talk.background.enabled")
|
||||
GatewayDiagnostics.log("node app model: scene phase=\(String(describing: phase))")
|
||||
switch phase {
|
||||
case .background:
|
||||
self.isBackgrounded = true
|
||||
@@ -2516,7 +2476,6 @@ extension NodeAppModel {
|
||||
func onNodeGatewayConnected() async {
|
||||
await self.registerAPNsTokenIfNeeded()
|
||||
await self.flushQueuedWatchRepliesIfConnected()
|
||||
await self.syncWatchExecApprovalSnapshot(reason: "node_connected")
|
||||
await self.resumePendingForegroundNodeActionsIfNeeded(trigger: "node_connected")
|
||||
}
|
||||
|
||||
@@ -2663,378 +2622,6 @@ extension NodeAppModel {
|
||||
return lines.joined(separator: "\n")
|
||||
}
|
||||
|
||||
private func restorePersistedWatchExecApprovalBridgeState() {
|
||||
guard let data = UserDefaults.standard.data(forKey: Self.watchExecApprovalBridgeStateKey),
|
||||
let state = try? JSONDecoder().decode(PersistedWatchExecApprovalBridgeState.self, from: data)
|
||||
else {
|
||||
return
|
||||
}
|
||||
self.watchExecApprovalPromptsByID = Dictionary(
|
||||
uniqueKeysWithValues: state.approvals.map { ($0.id, $0) })
|
||||
self.pendingWatchExecApprovalRecoveryIDs = (state.pendingApprovalIDs ?? [])
|
||||
.map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
|
||||
.filter { !$0.isEmpty }
|
||||
.sorted()
|
||||
self.pruneExpiredWatchExecApprovalPrompts()
|
||||
}
|
||||
|
||||
private func persistWatchExecApprovalBridgeState() {
|
||||
self.pruneExpiredWatchExecApprovalPrompts()
|
||||
let approvals = self.watchExecApprovalPromptsByID.values.sorted { lhs, rhs in
|
||||
let lhsExpires = lhs.expiresAtMs ?? Int.max
|
||||
let rhsExpires = rhs.expiresAtMs ?? Int.max
|
||||
if lhsExpires != rhsExpires {
|
||||
return lhsExpires < rhsExpires
|
||||
}
|
||||
return lhs.id < rhs.id
|
||||
}
|
||||
let pendingApprovalIDs = self.pendingWatchExecApprovalRecoveryIDs
|
||||
.map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
|
||||
.filter { !$0.isEmpty }
|
||||
.sorted()
|
||||
guard let data = try? JSONEncoder().encode(
|
||||
PersistedWatchExecApprovalBridgeState(
|
||||
approvals: approvals,
|
||||
pendingApprovalIDs: pendingApprovalIDs))
|
||||
else {
|
||||
return
|
||||
}
|
||||
UserDefaults.standard.set(data, forKey: Self.watchExecApprovalBridgeStateKey)
|
||||
}
|
||||
|
||||
private func pruneExpiredWatchExecApprovalPrompts(nowMs: Int? = nil) {
|
||||
let currentNowMs = nowMs ?? Int(Date().timeIntervalSince1970 * 1000)
|
||||
self.watchExecApprovalPromptsByID = self.watchExecApprovalPromptsByID.filter { _, prompt in
|
||||
guard let expiresAtMs = prompt.expiresAtMs else { return true }
|
||||
return expiresAtMs > currentNowMs
|
||||
}
|
||||
}
|
||||
|
||||
private func handleWatchMessagingStatusChanged(_ status: WatchMessagingStatus) async {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: status changed reachable=\(status.reachable) activation=\(status.activationState) backgrounded=\(self.isBackgrounded)")
|
||||
guard self.isBackgrounded else { return }
|
||||
guard status.supported, status.paired, status.appInstalled else { return }
|
||||
guard status.reachable || status.activationState == "activated" else { return }
|
||||
let reason = status.reachable ? "watch_reachable" : "watch_activated"
|
||||
await self.syncWatchExecApprovalSnapshot(reason: reason)
|
||||
}
|
||||
|
||||
private func appendPendingWatchExecApprovalRecoveryID(_ approvalId: String) {
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return }
|
||||
guard !self.pendingWatchExecApprovalRecoveryIDs.contains(normalizedApprovalID) else { return }
|
||||
self.pendingWatchExecApprovalRecoveryIDs.append(normalizedApprovalID)
|
||||
self.pendingWatchExecApprovalRecoveryIDs.sort()
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: queued recovery id=\(normalizedApprovalID) pendingCount=\(self.pendingWatchExecApprovalRecoveryIDs.count)")
|
||||
self.persistWatchExecApprovalBridgeState()
|
||||
}
|
||||
|
||||
private func removePendingWatchExecApprovalRecoveryID(_ approvalId: String) {
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return }
|
||||
let originalCount = self.pendingWatchExecApprovalRecoveryIDs.count
|
||||
self.pendingWatchExecApprovalRecoveryIDs.removeAll { $0 == normalizedApprovalID }
|
||||
guard self.pendingWatchExecApprovalRecoveryIDs.count != originalCount else { return }
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: cleared recovery id=\(normalizedApprovalID) pendingCount=\(self.pendingWatchExecApprovalRecoveryIDs.count)")
|
||||
self.persistWatchExecApprovalBridgeState()
|
||||
}
|
||||
|
||||
private func upsertWatchExecApprovalPrompt(_ prompt: ExecApprovalPrompt) {
|
||||
self.watchExecApprovalPromptsByID[prompt.id] = prompt
|
||||
self.removePendingWatchExecApprovalRecoveryID(prompt.id)
|
||||
self.persistWatchExecApprovalBridgeState()
|
||||
}
|
||||
|
||||
private func removeWatchExecApprovalPrompt(_ approvalId: String) {
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return }
|
||||
self.watchExecApprovalPromptsByID.removeValue(forKey: normalizedApprovalID)
|
||||
self.removePendingWatchExecApprovalRecoveryID(normalizedApprovalID)
|
||||
self.persistWatchExecApprovalBridgeState()
|
||||
}
|
||||
|
||||
private static func makeWatchExecApprovalItem(from prompt: ExecApprovalPrompt) -> OpenClawWatchExecApprovalItem {
|
||||
let decisions = prompt.allowedDecisions.compactMap { decision in
|
||||
let normalizedDecision = decision.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
return OpenClawWatchExecApprovalDecision(rawValue: normalizedDecision)
|
||||
}
|
||||
let preview = Self.trimmedOrNil(prompt.commandPreview) ?? Self.trimmedOrNil(prompt.commandText)
|
||||
return OpenClawWatchExecApprovalItem(
|
||||
id: prompt.id,
|
||||
commandText: prompt.commandText,
|
||||
commandPreview: preview,
|
||||
host: Self.trimmedOrNil(prompt.host),
|
||||
nodeId: Self.trimmedOrNil(prompt.nodeId),
|
||||
agentId: Self.trimmedOrNil(prompt.agentId),
|
||||
expiresAtMs: prompt.expiresAtMs,
|
||||
allowedDecisions: decisions,
|
||||
// Prefer the watch's neutral/default presentation until exec.approval.get
|
||||
// carries an explicit risk signal for exec approvals.
|
||||
risk: nil)
|
||||
}
|
||||
|
||||
nonisolated private static func shouldResetWatchExecApprovalResolvingStateOnPrompt(
|
||||
reason: String) -> Bool
|
||||
{
|
||||
reason == "resolve_retry"
|
||||
}
|
||||
|
||||
private func publishWatchExecApprovalPrompt(_ prompt: ExecApprovalPrompt, reason: String) async {
|
||||
let message = OpenClawWatchExecApprovalPromptMessage(
|
||||
approval: Self.makeWatchExecApprovalItem(from: prompt),
|
||||
sentAtMs: Int(Date().timeIntervalSince1970 * 1000),
|
||||
deliveryId: UUID().uuidString,
|
||||
resetResolvingState: Self.shouldResetWatchExecApprovalResolvingStateOnPrompt(reason: reason))
|
||||
do {
|
||||
_ = try await self.watchMessagingService.sendExecApprovalPrompt(message)
|
||||
self.watchExecApprovalLogger.debug(
|
||||
"watch exec approval prompt sent id=\(prompt.id, privacy: .public) reason=\(reason, privacy: .public)")
|
||||
} catch {
|
||||
self.watchExecApprovalLogger.error(
|
||||
"watch exec approval prompt failed id=\(prompt.id, privacy: .public) reason=\(reason, privacy: .public) error=\(error.localizedDescription, privacy: .public)")
|
||||
}
|
||||
await self.syncWatchExecApprovalSnapshot(reason: "\(reason)_snapshot")
|
||||
}
|
||||
|
||||
private func publishWatchExecApprovalResolved(
|
||||
approvalId: String,
|
||||
decision: OpenClawWatchExecApprovalDecision?,
|
||||
source: String) async
|
||||
{
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return }
|
||||
self.removeWatchExecApprovalPrompt(normalizedApprovalID)
|
||||
let message = OpenClawWatchExecApprovalResolvedMessage(
|
||||
approvalId: normalizedApprovalID,
|
||||
decision: decision,
|
||||
resolvedAtMs: Int(Date().timeIntervalSince1970 * 1000),
|
||||
source: source)
|
||||
do {
|
||||
_ = try await self.watchMessagingService.sendExecApprovalResolved(message)
|
||||
} catch {
|
||||
self.watchExecApprovalLogger.error(
|
||||
"watch exec approval resolved update failed id=\(normalizedApprovalID, privacy: .public) error=\(error.localizedDescription, privacy: .public)")
|
||||
}
|
||||
await self.syncWatchExecApprovalSnapshot(reason: "resolved_snapshot")
|
||||
}
|
||||
|
||||
private func publishWatchExecApprovalExpired(
|
||||
approvalId: String,
|
||||
reason: OpenClawWatchExecApprovalCloseReason) async
|
||||
{
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return }
|
||||
self.removeWatchExecApprovalPrompt(normalizedApprovalID)
|
||||
let message = OpenClawWatchExecApprovalExpiredMessage(
|
||||
approvalId: normalizedApprovalID,
|
||||
reason: reason,
|
||||
expiredAtMs: Int(Date().timeIntervalSince1970 * 1000))
|
||||
do {
|
||||
_ = try await self.watchMessagingService.sendExecApprovalExpired(message)
|
||||
} catch {
|
||||
self.watchExecApprovalLogger.error(
|
||||
"watch exec approval expiry update failed id=\(normalizedApprovalID, privacy: .public) error=\(error.localizedDescription, privacy: .public)")
|
||||
}
|
||||
await self.syncWatchExecApprovalSnapshot(reason: "expired_\(reason.rawValue)")
|
||||
}
|
||||
|
||||
private func syncWatchExecApprovalSnapshot(reason: String) async {
|
||||
self.pruneExpiredWatchExecApprovalPrompts()
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: sync snapshot start reason=\(reason) cacheCount=\(self.watchExecApprovalPromptsByID.count) backgrounded=\(self.isBackgrounded)")
|
||||
let approvals = self.watchExecApprovalPromptsByID.values
|
||||
.sorted { lhs, rhs in
|
||||
let lhsExpires = lhs.expiresAtMs ?? Int.max
|
||||
let rhsExpires = rhs.expiresAtMs ?? Int.max
|
||||
if lhsExpires != rhsExpires {
|
||||
return lhsExpires < rhsExpires
|
||||
}
|
||||
return lhs.id < rhs.id
|
||||
}
|
||||
.map(Self.makeWatchExecApprovalItem)
|
||||
let message = OpenClawWatchExecApprovalSnapshotMessage(
|
||||
approvals: approvals,
|
||||
sentAtMs: Int(Date().timeIntervalSince1970 * 1000),
|
||||
snapshotId: UUID().uuidString)
|
||||
do {
|
||||
_ = try await self.watchMessagingService.syncExecApprovalSnapshot(message)
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: sync snapshot sent reason=\(reason) count=\(approvals.count)")
|
||||
self.watchExecApprovalLogger.debug(
|
||||
"watch exec approval snapshot sent reason=\(reason, privacy: .public) count=\(approvals.count, privacy: .public)")
|
||||
} catch {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: sync snapshot failed reason=\(reason) error=\(error.localizedDescription)")
|
||||
self.watchExecApprovalLogger.error(
|
||||
"watch exec approval snapshot failed reason=\(reason, privacy: .public) error=\(error.localizedDescription, privacy: .public)")
|
||||
}
|
||||
}
|
||||
|
||||
private func refreshWatchExecApprovalSnapshotOnDemand(reason: String) async {
|
||||
GatewayDiagnostics.log("watch exec approval: refresh on demand start reason=\(reason)")
|
||||
await self.hydrateWatchExecApprovalCacheIfNeeded(reason: reason)
|
||||
await self.syncWatchExecApprovalSnapshot(reason: reason)
|
||||
GatewayDiagnostics.log("watch exec approval: refresh on demand end reason=\(reason)")
|
||||
}
|
||||
|
||||
nonisolated private static func watchExecApprovalIDsNeedingFetch(
|
||||
candidateIDs: [String],
|
||||
cachedApprovalIDs: [String]) -> [String]
|
||||
{
|
||||
let cachedIDs = Set(cachedApprovalIDs.compactMap { id -> String? in
|
||||
let normalizedID = id.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
return normalizedID.isEmpty ? nil : normalizedID
|
||||
})
|
||||
var idsToFetch: [String] = []
|
||||
var seen = Set<String>()
|
||||
for rawID in candidateIDs {
|
||||
let normalizedID = rawID.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedID.isEmpty else { continue }
|
||||
guard seen.insert(normalizedID).inserted else { continue }
|
||||
guard !cachedIDs.contains(normalizedID) else { continue }
|
||||
idsToFetch.append(normalizedID)
|
||||
}
|
||||
return idsToFetch
|
||||
}
|
||||
|
||||
private func hydrateWatchExecApprovalCacheIfNeeded(reason: String) async {
|
||||
self.pruneExpiredWatchExecApprovalPrompts()
|
||||
|
||||
let approvalIDs = await self.pendingExecApprovalIDsForWatchRecovery()
|
||||
let missingApprovalIDs = Self.watchExecApprovalIDsNeedingFetch(
|
||||
candidateIDs: approvalIDs,
|
||||
cachedApprovalIDs: Array(self.watchExecApprovalPromptsByID.keys))
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: hydrate candidates reason=\(reason) ids=\(approvalIDs.joined(separator: ",")) missing=\(missingApprovalIDs.joined(separator: ",")) cached=\(self.watchExecApprovalPromptsByID.count)")
|
||||
guard !missingApprovalIDs.isEmpty else {
|
||||
self.watchExecApprovalLogger.debug(
|
||||
"watch exec approval hydrate skipped reason=\(reason, privacy: .public): no missing approval ids")
|
||||
return
|
||||
}
|
||||
|
||||
for approvalId in missingApprovalIDs {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: hydrate fetch start id=\(approvalId) reason=\(reason)")
|
||||
let outcome = await self.fetchExecApprovalPrompt(
|
||||
approvalId: approvalId,
|
||||
sourceReason: reason)
|
||||
switch outcome {
|
||||
case let .loaded(prompt):
|
||||
GatewayDiagnostics.log("watch exec approval: hydrate fetch loaded id=\(approvalId)")
|
||||
self.upsertWatchExecApprovalPrompt(prompt)
|
||||
case .stale:
|
||||
GatewayDiagnostics.log("watch exec approval: hydrate fetch stale id=\(approvalId)")
|
||||
self.removePendingWatchExecApprovalRecoveryID(approvalId)
|
||||
await ExecApprovalNotificationBridge.removeNotifications(
|
||||
forApprovalID: approvalId,
|
||||
notificationCenter: self.notificationCenter)
|
||||
case let .failed(message):
|
||||
self.watchExecApprovalLogger.error(
|
||||
"watch exec approval hydrate failed id=\(approvalId, privacy: .public) reason=\(reason, privacy: .public) error=\(message, privacy: .public)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func pendingExecApprovalIDsForWatchRecovery() async -> [String] {
|
||||
var ids: [String] = []
|
||||
var seen = Set<String>()
|
||||
|
||||
func append(_ rawID: String?) {
|
||||
let approvalId = rawID?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
guard !approvalId.isEmpty, seen.insert(approvalId).inserted else { return }
|
||||
ids.append(approvalId)
|
||||
}
|
||||
|
||||
append(self.pendingExecApprovalPrompt?.id)
|
||||
for approvalId in self.pendingWatchExecApprovalRecoveryIDs {
|
||||
append(approvalId)
|
||||
}
|
||||
for approvalId in self.watchExecApprovalPromptsByID.keys.sorted() {
|
||||
append(approvalId)
|
||||
}
|
||||
|
||||
let delivered = await self.notificationCenter.deliveredNotifications()
|
||||
GatewayDiagnostics.log("watch exec approval: delivered notifications count=\(delivered.count)")
|
||||
for snapshot in delivered {
|
||||
guard ExecApprovalNotificationBridge.payloadKind(userInfo: snapshot.userInfo)
|
||||
== ExecApprovalNotificationBridge.requestedKind
|
||||
else {
|
||||
continue
|
||||
}
|
||||
append(ExecApprovalNotificationBridge.approvalID(from: snapshot.userInfo))
|
||||
}
|
||||
|
||||
return ids
|
||||
}
|
||||
|
||||
private func handleWatchExecApprovalResolve(_ event: WatchExecApprovalResolveEvent) async {
|
||||
let normalizedApprovalID = event.approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return }
|
||||
if self.pendingExecApprovalPrompt?.id == normalizedApprovalID {
|
||||
self.pendingExecApprovalPromptResolving = true
|
||||
self.pendingExecApprovalPromptErrorText = nil
|
||||
}
|
||||
let outcome = await self.resolveExecApprovalNotificationDecision(
|
||||
approvalId: normalizedApprovalID,
|
||||
decision: event.decision.rawValue,
|
||||
sourceReason: "watch_resolve")
|
||||
if case let .failed(message) = outcome {
|
||||
if self.pendingExecApprovalPrompt?.id == normalizedApprovalID {
|
||||
self.pendingExecApprovalPromptResolving = false
|
||||
self.pendingExecApprovalPromptErrorText = message
|
||||
}
|
||||
if let prompt = self.watchExecApprovalPromptsByID[normalizedApprovalID] {
|
||||
await self.publishWatchExecApprovalPrompt(prompt, reason: "resolve_retry")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func handleExecApprovalRequestedRemotePush(approvalId: String) async -> Bool {
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return false }
|
||||
self.appendPendingWatchExecApprovalRecoveryID(normalizedApprovalID)
|
||||
let fetchedPrompt = await self.fetchExecApprovalPrompt(
|
||||
approvalId: normalizedApprovalID,
|
||||
sourceReason: "push_request")
|
||||
switch fetchedPrompt {
|
||||
case let .loaded(prompt):
|
||||
self.upsertWatchExecApprovalPrompt(prompt)
|
||||
await self.publishWatchExecApprovalPrompt(prompt, reason: "push_request")
|
||||
return true
|
||||
case .stale:
|
||||
await ExecApprovalNotificationBridge.removeNotifications(
|
||||
forApprovalID: normalizedApprovalID,
|
||||
notificationCenter: self.notificationCenter)
|
||||
self.clearPendingExecApprovalPromptIfMatches(normalizedApprovalID)
|
||||
await self.publishWatchExecApprovalExpired(
|
||||
approvalId: normalizedApprovalID,
|
||||
reason: .notFound)
|
||||
return true
|
||||
case let .failed(message):
|
||||
self.watchExecApprovalLogger.error(
|
||||
"watch exec approval push fetch failed id=\(normalizedApprovalID, privacy: .public) error=\(message, privacy: .public)")
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func handleExecApprovalResolvedRemotePush(approvalId: String) async {
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return }
|
||||
|
||||
let hadWatchPrompt = self.watchExecApprovalPromptsByID[normalizedApprovalID] != nil
|
||||
let hadPendingPrompt = self.pendingExecApprovalPrompt?.id == normalizedApprovalID
|
||||
let hadPendingRecoveryID = self.pendingWatchExecApprovalRecoveryIDs.contains(normalizedApprovalID)
|
||||
guard hadWatchPrompt || hadPendingPrompt || hadPendingRecoveryID else {
|
||||
return
|
||||
}
|
||||
|
||||
await self.publishWatchExecApprovalExpired(approvalId: normalizedApprovalID, reason: .resolved)
|
||||
self.clearPendingExecApprovalPromptIfMatches(normalizedApprovalID)
|
||||
}
|
||||
|
||||
func handleSilentPushWake(_ userInfo: [AnyHashable: Any]) async -> Bool {
|
||||
let wakeId = Self.makePushWakeAttemptID()
|
||||
guard Self.isSilentPushPayload(userInfo) else {
|
||||
@@ -3054,24 +2641,13 @@ extension NodeAppModel {
|
||||
notificationCenter: self.notificationCenter)
|
||||
{
|
||||
if let approvalId = ExecApprovalNotificationBridge.approvalID(from: userInfo) {
|
||||
await self.handleExecApprovalResolvedRemotePush(approvalId: approvalId)
|
||||
self.clearPendingExecApprovalPromptIfMatches(approvalId)
|
||||
}
|
||||
self.execApprovalNotificationLogger.info(
|
||||
"Handled exec approval cleanup push wakeId=\(wakeId, privacy: .public)")
|
||||
return true
|
||||
}
|
||||
|
||||
if ExecApprovalNotificationBridge.payloadKind(userInfo: userInfo) == ExecApprovalNotificationBridge.requestedKind,
|
||||
let approvalId = ExecApprovalNotificationBridge.approvalID(from: userInfo)
|
||||
{
|
||||
let handled = await self.handleExecApprovalRequestedRemotePush(approvalId: approvalId)
|
||||
if handled {
|
||||
self.execApprovalNotificationLogger.info(
|
||||
"Handled exec approval request push wakeId=\(wakeId, privacy: .public) id=\(approvalId, privacy: .public)")
|
||||
}
|
||||
return handled
|
||||
}
|
||||
|
||||
let result = await self.reconnectGatewaySessionsForSilentPushIfNeeded(wakeId: wakeId)
|
||||
let outcomeMessage =
|
||||
"Silent push outcome wakeId=\(wakeId) "
|
||||
@@ -3256,7 +2832,6 @@ extension NodeAppModel {
|
||||
private struct ExecApprovalGetResponse: Decodable {
|
||||
var id: String
|
||||
var commandText: String
|
||||
var commandPreview: String?
|
||||
var allowedDecisions: [String]
|
||||
var host: String?
|
||||
var nodeId: String?
|
||||
@@ -3286,7 +2861,6 @@ extension NodeAppModel {
|
||||
forApprovalID: approvalId,
|
||||
notificationCenter: self.notificationCenter)
|
||||
self.clearPendingExecApprovalPromptIfMatches(approvalId)
|
||||
await self.publishWatchExecApprovalExpired(approvalId: approvalId, reason: .notFound)
|
||||
case let .failed(message):
|
||||
self.execApprovalNotificationLogger.error(
|
||||
"Exec approval prompt fetch failed id=\(approvalId, privacy: .public) reason=\(message, privacy: .public)")
|
||||
@@ -3303,10 +2877,6 @@ extension NodeAppModel {
|
||||
self.pendingExecApprovalPrompt = prompt
|
||||
self.pendingExecApprovalPromptResolving = false
|
||||
self.pendingExecApprovalPromptErrorText = nil
|
||||
self.upsertWatchExecApprovalPrompt(prompt)
|
||||
Task { @MainActor [weak self] in
|
||||
await self?.publishWatchExecApprovalPrompt(prompt, reason: "present_prompt")
|
||||
}
|
||||
}
|
||||
|
||||
private static func makeExecApprovalPrompt(from details: ExecApprovalGetResponse) -> ExecApprovalPrompt? {
|
||||
@@ -3316,7 +2886,6 @@ extension NodeAppModel {
|
||||
return ExecApprovalPrompt(
|
||||
id: approvalId,
|
||||
commandText: commandText,
|
||||
commandPreview: details.commandPreview?.trimmingCharacters(in: .whitespacesAndNewlines),
|
||||
allowedDecisions: details.allowedDecisions.compactMap { decision in
|
||||
let trimmed = decision.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
return trimmed.isEmpty ? nil : trimmed
|
||||
@@ -3327,46 +2896,9 @@ extension NodeAppModel {
|
||||
expiresAtMs: details.expiresAtMs)
|
||||
}
|
||||
|
||||
nonisolated private static func shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: String,
|
||||
isBackgrounded: Bool) -> Bool
|
||||
{
|
||||
guard isBackgrounded else { return false }
|
||||
switch sourceReason {
|
||||
case "watch_request", "push_request", "watch_resolve", "notification_action":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
private func fetchExecApprovalPrompt(
|
||||
approvalId: String,
|
||||
sourceReason: String? = nil) async -> ExecApprovalPromptFetchOutcome
|
||||
{
|
||||
let normalizedSourceReason = sourceReason?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let fetchReason: String
|
||||
if let normalizedSourceReason, !normalizedSourceReason.isEmpty {
|
||||
fetchReason = normalizedSourceReason
|
||||
} else {
|
||||
fetchReason = "direct"
|
||||
}
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: fetch prompt start id=\(approvalId) reason=\(fetchReason)")
|
||||
let connected: Bool
|
||||
if Self.shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: fetchReason,
|
||||
isBackgrounded: self.isBackgrounded)
|
||||
{
|
||||
connected = await self.ensureOperatorApprovalConnectionForWatchReview(
|
||||
timeoutMs: 12_000,
|
||||
reason: fetchReason)
|
||||
} else {
|
||||
connected = await self.ensureOperatorApprovalConnection(timeoutMs: 12_000)
|
||||
}
|
||||
private func fetchExecApprovalPrompt(approvalId: String) async -> ExecApprovalPromptFetchOutcome {
|
||||
let connected = await self.ensureOperatorApprovalConnection(timeoutMs: 12_000)
|
||||
guard connected else {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: fetch prompt operator not connected id=\(approvalId) reason=\(fetchReason)")
|
||||
return .failed(message: "operator_not_connected")
|
||||
}
|
||||
|
||||
@@ -3378,21 +2910,13 @@ extension NodeAppModel {
|
||||
timeoutSeconds: 12)
|
||||
let details = try JSONDecoder().decode(ExecApprovalGetResponse.self, from: response)
|
||||
guard let prompt = Self.makeExecApprovalPrompt(from: details) else {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: fetch prompt invalid payload id=\(approvalId) reason=\(fetchReason)")
|
||||
return .failed(message: "invalid_prompt_payload")
|
||||
}
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: fetch prompt loaded id=\(approvalId) reason=\(fetchReason)")
|
||||
return .loaded(prompt)
|
||||
} catch {
|
||||
if Self.isApprovalNotificationStaleError(error) {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: fetch prompt stale id=\(approvalId) reason=\(fetchReason)")
|
||||
return .stale
|
||||
}
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: fetch prompt failed id=\(approvalId) reason=\(fetchReason) error=\(error.localizedDescription)")
|
||||
return .failed(message: error.localizedDescription)
|
||||
}
|
||||
}
|
||||
@@ -3426,56 +2950,17 @@ extension NodeAppModel {
|
||||
}
|
||||
}
|
||||
|
||||
func handleExecApprovalNotificationDecision(
|
||||
approvalId: String,
|
||||
decision: String
|
||||
) async {
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedApprovalID.isEmpty else { return }
|
||||
|
||||
if self.pendingExecApprovalPrompt?.id == normalizedApprovalID {
|
||||
self.pendingExecApprovalPromptResolving = true
|
||||
self.pendingExecApprovalPromptErrorText = nil
|
||||
}
|
||||
|
||||
let outcome = await self.resolveExecApprovalNotificationDecision(
|
||||
approvalId: normalizedApprovalID,
|
||||
decision: decision)
|
||||
switch outcome {
|
||||
case .resolved, .stale, .unavailable:
|
||||
break
|
||||
case let .failed(message):
|
||||
if self.pendingExecApprovalPrompt?.id == normalizedApprovalID {
|
||||
self.pendingExecApprovalPromptResolving = false
|
||||
self.pendingExecApprovalPromptErrorText = message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func resolveExecApprovalNotificationDecision(
|
||||
approvalId: String,
|
||||
decision: String,
|
||||
sourceReason: String? = nil
|
||||
decision: String
|
||||
) async -> ExecApprovalResolutionOutcome {
|
||||
let normalizedApprovalID = approvalId.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let normalizedDecision = decision.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let normalizedSourceReason = sourceReason?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let resolutionReason = (normalizedSourceReason?.isEmpty == false) ? normalizedSourceReason! : "direct"
|
||||
guard !normalizedApprovalID.isEmpty, !normalizedDecision.isEmpty else {
|
||||
return .failed(message: "Invalid approval request.")
|
||||
}
|
||||
|
||||
let connected: Bool
|
||||
if Self.shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: resolutionReason,
|
||||
isBackgrounded: self.isBackgrounded)
|
||||
{
|
||||
connected = await self.ensureOperatorApprovalConnectionForWatchReview(
|
||||
timeoutMs: 12_000,
|
||||
reason: resolutionReason)
|
||||
} else {
|
||||
connected = await self.ensureOperatorApprovalConnection(timeoutMs: 12_000)
|
||||
}
|
||||
let connected = await self.ensureOperatorApprovalConnection(timeoutMs: 12_000)
|
||||
guard connected else {
|
||||
self.execApprovalNotificationLogger.error(
|
||||
"Exec approval action failed id=\(normalizedApprovalID, privacy: .public): operator not connected")
|
||||
@@ -3493,10 +2978,6 @@ extension NodeAppModel {
|
||||
forApprovalID: normalizedApprovalID,
|
||||
notificationCenter: self.notificationCenter)
|
||||
self.clearPendingExecApprovalPromptIfMatches(normalizedApprovalID)
|
||||
await self.publishWatchExecApprovalResolved(
|
||||
approvalId: normalizedApprovalID,
|
||||
decision: OpenClawWatchExecApprovalDecision(rawValue: normalizedDecision),
|
||||
source: "iphone")
|
||||
return .resolved
|
||||
} catch {
|
||||
if Self.isApprovalNotificationStaleError(error) {
|
||||
@@ -3504,7 +2985,6 @@ extension NodeAppModel {
|
||||
forApprovalID: normalizedApprovalID,
|
||||
notificationCenter: self.notificationCenter)
|
||||
self.clearPendingExecApprovalPromptIfMatches(normalizedApprovalID)
|
||||
await self.publishWatchExecApprovalExpired(approvalId: normalizedApprovalID, reason: .notFound)
|
||||
return .stale
|
||||
}
|
||||
if Self.isApprovalNotificationUnavailableError(error) {
|
||||
@@ -3512,7 +2992,6 @@ extension NodeAppModel {
|
||||
forApprovalID: normalizedApprovalID,
|
||||
notificationCenter: self.notificationCenter)
|
||||
self.clearPendingExecApprovalPromptIfMatches(normalizedApprovalID)
|
||||
await self.publishWatchExecApprovalExpired(approvalId: normalizedApprovalID, reason: .unavailable)
|
||||
return .unavailable
|
||||
}
|
||||
let logMessage =
|
||||
@@ -3617,96 +3096,6 @@ extension NodeAppModel {
|
||||
sessionBox: sessionBox)
|
||||
}
|
||||
|
||||
private func ensureOperatorApprovalConnectionForWatchReview(timeoutMs: Int, reason: String) async -> Bool {
|
||||
let normalizedReason = reason.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let reconnectReason = normalizedReason.isEmpty ? "watch_request" : normalizedReason
|
||||
if await self.isOperatorConnected() {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_connected reason=\(reconnectReason) phase=already_connected")
|
||||
return true
|
||||
}
|
||||
|
||||
guard self.isBackgrounded else {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_begin reason=\(reconnectReason) backgrounded=false strategy=default")
|
||||
let connected = await self.ensureOperatorApprovalConnection(timeoutMs: timeoutMs)
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_\(connected ? "connected" : "timeout") reason=\(reconnectReason) phase=foreground_delegate")
|
||||
return connected
|
||||
}
|
||||
|
||||
guard self.gatewayAutoReconnectEnabled else {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_timeout reason=\(reconnectReason) phase=auto_reconnect_disabled")
|
||||
return false
|
||||
}
|
||||
|
||||
guard let cfg = self.activeGatewayConnectConfig else {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_timeout reason=\(reconnectReason) phase=no_active_gateway_config")
|
||||
return false
|
||||
}
|
||||
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_begin reason=\(reconnectReason) backgrounded=true")
|
||||
let leaseSeconds = min(45.0, max(15.0, Double(max(timeoutMs, 1_000)) / 1000.0 + 8.0))
|
||||
self.grantBackgroundReconnectLease(seconds: leaseSeconds, reason: "watch_review_\(reconnectReason)")
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_lease_granted reason=\(reconnectReason) seconds=\(leaseSeconds)")
|
||||
|
||||
let hadReconnectLoop = self.operatorGatewayTask != nil
|
||||
let canStartReconnectLoop = hadReconnectLoop || self.shouldStartOperatorGatewayLoop(
|
||||
token: cfg.token,
|
||||
bootstrapToken: cfg.bootstrapToken,
|
||||
password: cfg.password,
|
||||
stableID: cfg.effectiveStableID)
|
||||
guard canStartReconnectLoop else {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_timeout reason=\(reconnectReason) phase=no_operator_reconnect_auth")
|
||||
return false
|
||||
}
|
||||
|
||||
self.ensureOperatorReconnectLoopIfNeeded()
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_loop_\(hadReconnectLoop ? "reused" : "started") reason=\(reconnectReason)")
|
||||
|
||||
let initialWaitMs = min(2_500, max(750, timeoutMs / 4))
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_wait reason=\(reconnectReason) phase=initial timeoutMs=\(initialWaitMs)")
|
||||
if await self.waitForOperatorConnection(timeoutMs: initialWaitMs, pollMs: 200) {
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_connected reason=\(reconnectReason) phase=initial")
|
||||
return true
|
||||
}
|
||||
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_restart reason=\(reconnectReason)")
|
||||
self.operatorGatewayTask?.cancel()
|
||||
self.operatorGatewayTask = nil
|
||||
await self.operatorGateway.disconnect()
|
||||
self.operatorConnected = false
|
||||
self.talkMode.updateGatewayConnected(false)
|
||||
self.stopGatewayHealthMonitor()
|
||||
|
||||
let sessionBox = cfg.tls.map { WebSocketSessionBox(session: GatewayTLSPinningSession(params: $0)) }
|
||||
self.startOperatorGatewayLoop(
|
||||
url: cfg.url,
|
||||
stableID: cfg.effectiveStableID,
|
||||
token: cfg.token,
|
||||
bootstrapToken: cfg.bootstrapToken,
|
||||
password: cfg.password,
|
||||
nodeOptions: cfg.nodeOptions,
|
||||
sessionBox: sessionBox)
|
||||
|
||||
let remainingWaitMs = max(250, timeoutMs - initialWaitMs)
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_wait reason=\(reconnectReason) phase=restart timeoutMs=\(remainingWaitMs)")
|
||||
let connected = await self.waitForOperatorConnection(timeoutMs: remainingWaitMs, pollMs: 200)
|
||||
GatewayDiagnostics.log(
|
||||
"watch exec approval: watch_request_reconnect_\(connected ? "connected" : "timeout") reason=\(reconnectReason) phase=restart")
|
||||
return connected
|
||||
}
|
||||
|
||||
private func ensureOperatorApprovalConnection(timeoutMs: Int) async -> Bool {
|
||||
if await self.isOperatorConnected() {
|
||||
return true
|
||||
@@ -4137,18 +3526,6 @@ extension NodeAppModel {
|
||||
self.pendingExecApprovalPrompt
|
||||
}
|
||||
|
||||
func _test_recordPendingWatchExecApprovalRecoveryID(_ approvalId: String) {
|
||||
self.appendPendingWatchExecApprovalRecoveryID(approvalId)
|
||||
}
|
||||
|
||||
func _test_pendingWatchExecApprovalRecoveryIDs() -> [String] {
|
||||
self.pendingWatchExecApprovalRecoveryIDs
|
||||
}
|
||||
|
||||
func _test_pendingExecApprovalIDsForWatchRecovery() async -> [String] {
|
||||
await self.pendingExecApprovalIDsForWatchRecovery()
|
||||
}
|
||||
|
||||
nonisolated static func _test_isApprovalNotificationStaleError(_ error: Error) -> Bool {
|
||||
self.isApprovalNotificationStaleError(error)
|
||||
}
|
||||
@@ -4157,30 +3534,6 @@ extension NodeAppModel {
|
||||
self.isApprovalNotificationUnavailableError(error)
|
||||
}
|
||||
|
||||
nonisolated static func _test_shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: String,
|
||||
isBackgrounded: Bool) -> Bool
|
||||
{
|
||||
self.shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: sourceReason,
|
||||
isBackgrounded: isBackgrounded)
|
||||
}
|
||||
|
||||
nonisolated static func _test_watchExecApprovalIDsNeedingFetch(
|
||||
candidateIDs: [String],
|
||||
cachedApprovalIDs: [String]) -> [String]
|
||||
{
|
||||
self.watchExecApprovalIDsNeedingFetch(
|
||||
candidateIDs: candidateIDs,
|
||||
cachedApprovalIDs: cachedApprovalIDs)
|
||||
}
|
||||
|
||||
nonisolated static func _test_shouldResetWatchExecApprovalResolvingStateOnPrompt(
|
||||
reason: String) -> Bool
|
||||
{
|
||||
self.shouldResetWatchExecApprovalResolvingStateOnPrompt(reason: reason)
|
||||
}
|
||||
|
||||
static func _test_makeExecApprovalPrompt(
|
||||
id: String,
|
||||
commandText: String,
|
||||
@@ -4194,7 +3547,6 @@ extension NodeAppModel {
|
||||
from: ExecApprovalGetResponse(
|
||||
id: id,
|
||||
commandText: commandText,
|
||||
commandPreview: nil,
|
||||
allowedDecisions: allowedDecisions,
|
||||
host: host,
|
||||
nodeId: nodeId,
|
||||
@@ -4206,10 +3558,6 @@ extension NodeAppModel {
|
||||
self.expectedDeepLinkKey()
|
||||
}
|
||||
|
||||
static func _test_resetPersistedWatchExecApprovalBridgeState() {
|
||||
UserDefaults.standard.removeObject(forKey: self.watchExecApprovalBridgeStateKey)
|
||||
}
|
||||
|
||||
nonisolated static func _test_shouldStartOperatorGatewayLoop(
|
||||
token: String?,
|
||||
bootstrapToken: String?,
|
||||
|
||||
@@ -15,11 +15,6 @@ private struct PendingWatchPromptAction {
|
||||
|
||||
private typealias PendingExecApprovalPrompt = ExecApprovalNotificationPrompt
|
||||
|
||||
@MainActor
|
||||
enum OpenClawAppModelRegistry {
|
||||
static var appModel: NodeAppModel?
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class OpenClawAppDelegate: NSObject, UIApplicationDelegate, @preconcurrency UNUserNotificationCenterDelegate {
|
||||
private let logger = Logger(subsystem: "ai.openclaw.ios", category: "Push")
|
||||
@@ -29,12 +24,10 @@ final class OpenClawAppDelegate: NSObject, UIApplicationDelegate, @preconcurrenc
|
||||
private var pendingAPNsDeviceToken: Data?
|
||||
private var pendingWatchPromptActions: [PendingWatchPromptAction] = []
|
||||
private var pendingExecApprovalPrompts: [PendingExecApprovalPrompt] = []
|
||||
private var pendingExecApprovalRequestedPushIDs: [String] = []
|
||||
private var pendingExecApprovalResolvedPushIDs: [String] = []
|
||||
|
||||
weak var appModel: NodeAppModel? {
|
||||
didSet {
|
||||
guard let model = self.resolvedAppModel() else { return }
|
||||
guard let model = self.appModel else { return }
|
||||
if let token = self.pendingAPNsDeviceToken {
|
||||
self.pendingAPNsDeviceToken = nil
|
||||
Task { @MainActor in
|
||||
@@ -63,56 +56,22 @@ final class OpenClawAppDelegate: NSObject, UIApplicationDelegate, @preconcurrenc
|
||||
}
|
||||
}
|
||||
}
|
||||
if !self.pendingExecApprovalRequestedPushIDs.isEmpty {
|
||||
let pending = self.pendingExecApprovalRequestedPushIDs
|
||||
self.pendingExecApprovalRequestedPushIDs.removeAll()
|
||||
Task { @MainActor in
|
||||
for approvalId in pending {
|
||||
_ = await model.handleExecApprovalRequestedRemotePush(approvalId: approvalId)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !self.pendingExecApprovalResolvedPushIDs.isEmpty {
|
||||
let pending = self.pendingExecApprovalResolvedPushIDs
|
||||
self.pendingExecApprovalResolvedPushIDs.removeAll()
|
||||
Task { @MainActor in
|
||||
for approvalId in pending {
|
||||
await model.handleExecApprovalResolvedRemotePush(approvalId: approvalId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func resolvedAppModel() -> NodeAppModel? {
|
||||
self.appModel ?? OpenClawAppModelRegistry.appModel
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
func _test_resolvedAppModel() -> NodeAppModel? {
|
||||
self.resolvedAppModel()
|
||||
}
|
||||
#endif
|
||||
|
||||
func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
|
||||
) -> Bool
|
||||
{
|
||||
GatewayDiagnostics.log("app delegate: didFinishLaunching")
|
||||
if self.appModel == nil {
|
||||
self.appModel = OpenClawAppModelRegistry.appModel
|
||||
}
|
||||
self.registerBackgroundWakeRefreshTask()
|
||||
let notificationCenter = UNUserNotificationCenter.current()
|
||||
notificationCenter.delegate = self
|
||||
ExecApprovalNotificationBridge.registerCategory(center: notificationCenter)
|
||||
UNUserNotificationCenter.current().delegate = self
|
||||
application.registerForRemoteNotifications()
|
||||
return true
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
||||
if let appModel = self.resolvedAppModel() {
|
||||
if let appModel = self.appModel {
|
||||
Task { @MainActor in
|
||||
appModel.updateAPNsDeviceToken(deviceToken)
|
||||
}
|
||||
@@ -139,22 +98,12 @@ final class OpenClawAppDelegate: NSObject, UIApplicationDelegate, @preconcurrenc
|
||||
notificationCenter: notificationCenter)
|
||||
{
|
||||
if let approvalId = ExecApprovalNotificationBridge.approvalID(from: userInfo) {
|
||||
if let appModel = self.resolvedAppModel() {
|
||||
await appModel.handleExecApprovalResolvedRemotePush(approvalId: approvalId)
|
||||
} else {
|
||||
self.pendingExecApprovalResolvedPushIDs.append(approvalId)
|
||||
}
|
||||
self.appModel?.dismissPendingExecApprovalPrompt(approvalId: approvalId)
|
||||
}
|
||||
completionHandler(.newData)
|
||||
return
|
||||
}
|
||||
guard let appModel = self.resolvedAppModel() else {
|
||||
if ExecApprovalNotificationBridge.payloadKind(userInfo: userInfo)
|
||||
== ExecApprovalNotificationBridge.requestedKind,
|
||||
let approvalId = ExecApprovalNotificationBridge.approvalID(from: userInfo)
|
||||
{
|
||||
self.pendingExecApprovalRequestedPushIDs.append(approvalId)
|
||||
}
|
||||
guard let appModel = self.appModel else {
|
||||
self.logger.info("APNs wake skipped: appModel unavailable")
|
||||
self.scheduleBackgroundWakeRefresh(afterSeconds: 90, reason: "silent_push_no_model")
|
||||
completionHandler(.noData)
|
||||
@@ -170,7 +119,6 @@ final class OpenClawAppDelegate: NSObject, UIApplicationDelegate, @preconcurrenc
|
||||
}
|
||||
|
||||
func scenePhaseChanged(_ phase: ScenePhase) {
|
||||
GatewayDiagnostics.log("app delegate: scene phase changed=\(String(describing: phase))")
|
||||
if phase == .background {
|
||||
self.scheduleBackgroundWakeRefresh(afterSeconds: 120, reason: "scene_background")
|
||||
}
|
||||
@@ -215,7 +163,7 @@ final class OpenClawAppDelegate: NSObject, UIApplicationDelegate, @preconcurrenc
|
||||
self.backgroundWakeTask?.cancel()
|
||||
|
||||
let wakeTask = Task { @MainActor [weak self] in
|
||||
guard let self, let appModel = self.resolvedAppModel() else { return false }
|
||||
guard let self, let appModel = self.appModel else { return false }
|
||||
return await appModel.handleBackgroundRefreshWake(trigger: "bg_app_refresh")
|
||||
}
|
||||
self.backgroundWakeTask = wakeTask
|
||||
@@ -300,7 +248,7 @@ final class OpenClawAppDelegate: NSObject, UIApplicationDelegate, @preconcurrenc
|
||||
}
|
||||
|
||||
private func routeWatchPromptAction(_ action: PendingWatchPromptAction) async {
|
||||
guard let appModel = self.resolvedAppModel() else {
|
||||
guard let appModel = self.appModel else {
|
||||
self.pendingWatchPromptActions.append(action)
|
||||
return
|
||||
}
|
||||
@@ -313,7 +261,7 @@ final class OpenClawAppDelegate: NSObject, UIApplicationDelegate, @preconcurrenc
|
||||
}
|
||||
|
||||
private func routeExecApprovalPrompt(_ prompt: PendingExecApprovalPrompt) {
|
||||
guard let appModel = self.resolvedAppModel() else {
|
||||
guard let appModel = self.appModel else {
|
||||
self.pendingExecApprovalPrompts.append(prompt)
|
||||
return
|
||||
}
|
||||
@@ -613,7 +561,6 @@ struct OpenClawApp: App {
|
||||
Self.installUncaughtExceptionLogger()
|
||||
GatewaySettingsStore.bootstrapPersistence()
|
||||
let appModel = NodeAppModel()
|
||||
OpenClawAppModelRegistry.appModel = appModel
|
||||
_appModel = State(initialValue: appModel)
|
||||
_gatewayController = State(initialValue: GatewayConnectionController(appModel: appModel))
|
||||
}
|
||||
|
||||
@@ -8,30 +8,9 @@ struct ExecApprovalNotificationPrompt: Sendable, Equatable {
|
||||
enum ExecApprovalNotificationBridge {
|
||||
static let requestedKind = "exec.approval.requested"
|
||||
static let resolvedKind = "exec.approval.resolved"
|
||||
static let categoryIdentifier = "openclaw.exec-approval"
|
||||
static let reviewActionIdentifier = "openclaw.exec-approval.review"
|
||||
|
||||
private static let localRequestPrefix = "exec.approval."
|
||||
|
||||
static func registerCategory(center: UNUserNotificationCenter = .current()) {
|
||||
let category = UNNotificationCategory(
|
||||
identifier: self.categoryIdentifier,
|
||||
actions: [
|
||||
UNNotificationAction(
|
||||
identifier: self.reviewActionIdentifier,
|
||||
title: "Review",
|
||||
options: [.foreground]),
|
||||
],
|
||||
intentIdentifiers: [],
|
||||
options: [])
|
||||
|
||||
center.getNotificationCategories { categories in
|
||||
var updated = categories
|
||||
updated.update(with: category)
|
||||
center.setNotificationCategories(updated)
|
||||
}
|
||||
}
|
||||
|
||||
static func shouldPresentNotification(userInfo: [AnyHashable: Any]) -> Bool {
|
||||
self.payloadKind(userInfo: userInfo) == self.requestedKind
|
||||
}
|
||||
@@ -41,11 +20,7 @@ enum ExecApprovalNotificationBridge {
|
||||
userInfo: [AnyHashable: Any]
|
||||
) -> ExecApprovalNotificationPrompt?
|
||||
{
|
||||
guard actionIdentifier == UNNotificationDefaultActionIdentifier
|
||||
|| actionIdentifier == self.reviewActionIdentifier
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
guard actionIdentifier == UNNotificationDefaultActionIdentifier else { return nil }
|
||||
guard self.payloadKind(userInfo: userInfo) == self.requestedKind else { return nil }
|
||||
guard let approvalId = self.approvalID(from: userInfo) else { return nil }
|
||||
return ExecApprovalNotificationPrompt(approvalId: approvalId)
|
||||
@@ -96,7 +71,7 @@ enum ExecApprovalNotificationBridge {
|
||||
"\(self.localRequestPrefix)\(approvalId)"
|
||||
}
|
||||
|
||||
static func payloadKind(userInfo: [AnyHashable: Any]) -> String {
|
||||
private static func payloadKind(userInfo: [AnyHashable: Any]) -> String {
|
||||
let raw = self.openClawPayload(userInfo: userInfo)?["kind"] as? String
|
||||
let trimmed = raw?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
return trimmed.isEmpty ? "unknown" : trimmed
|
||||
|
||||
@@ -88,20 +88,6 @@ struct WatchQuickReplyEvent: Sendable, Equatable {
|
||||
var transport: String
|
||||
}
|
||||
|
||||
struct WatchExecApprovalResolveEvent: Sendable, Equatable {
|
||||
var replyId: String
|
||||
var approvalId: String
|
||||
var decision: OpenClawWatchExecApprovalDecision
|
||||
var sentAtMs: Int?
|
||||
var transport: String
|
||||
}
|
||||
|
||||
struct WatchExecApprovalSnapshotRequestEvent: Sendable, Equatable {
|
||||
var requestId: String
|
||||
var sentAtMs: Int?
|
||||
var transport: String
|
||||
}
|
||||
|
||||
struct WatchNotificationSendResult: Sendable, Equatable {
|
||||
var deliveredImmediately: Bool
|
||||
var queuedForDelivery: Bool
|
||||
@@ -110,22 +96,10 @@ struct WatchNotificationSendResult: Sendable, Equatable {
|
||||
|
||||
protocol WatchMessagingServicing: AnyObject, Sendable {
|
||||
func status() async -> WatchMessagingStatus
|
||||
func setStatusHandler(_ handler: (@Sendable (WatchMessagingStatus) -> Void)?)
|
||||
func setReplyHandler(_ handler: (@Sendable (WatchQuickReplyEvent) -> Void)?)
|
||||
func setExecApprovalResolveHandler(_ handler: (@Sendable (WatchExecApprovalResolveEvent) -> Void)?)
|
||||
func setExecApprovalSnapshotRequestHandler(
|
||||
_ handler: (@Sendable (WatchExecApprovalSnapshotRequestEvent) -> Void)?)
|
||||
func sendNotification(
|
||||
id: String,
|
||||
params: OpenClawWatchNotifyParams) async throws -> WatchNotificationSendResult
|
||||
func sendExecApprovalPrompt(
|
||||
_ message: OpenClawWatchExecApprovalPromptMessage) async throws -> WatchNotificationSendResult
|
||||
func sendExecApprovalResolved(
|
||||
_ message: OpenClawWatchExecApprovalResolvedMessage) async throws -> WatchNotificationSendResult
|
||||
func sendExecApprovalExpired(
|
||||
_ message: OpenClawWatchExecApprovalExpiredMessage) async throws -> WatchNotificationSendResult
|
||||
func syncExecApprovalSnapshot(
|
||||
_ message: OpenClawWatchExecApprovalSnapshotMessage) async throws -> WatchNotificationSendResult
|
||||
}
|
||||
|
||||
extension CameraController: CameraServicing {}
|
||||
|
||||
@@ -1,363 +0,0 @@
|
||||
import Foundation
|
||||
import OSLog
|
||||
@preconcurrency import WatchConnectivity
|
||||
|
||||
private struct WatchConnectivityTransportCallbacks {
|
||||
var statusUpdateHandler: (@Sendable (WatchMessagingStatus) -> Void)?
|
||||
var replyHandler: (@Sendable (WatchQuickReplyEvent) -> Void)?
|
||||
var execApprovalResolveHandler: (@Sendable (WatchExecApprovalResolveEvent) -> Void)?
|
||||
var execApprovalSnapshotRequestHandler: (@Sendable (WatchExecApprovalSnapshotRequestEvent) -> Void)?
|
||||
}
|
||||
|
||||
private func sendReachableWatchMessage(_ payload: [String: Any], with session: WCSession) async throws {
|
||||
// WatchConnectivity replies arrive on its own queue. Keep this continuation explicitly
|
||||
// nonisolated so Swift 6 does not inherit a caller actor (for example MainActor) into the
|
||||
// Objective-C callback boundary and trap on the reply callback executor check.
|
||||
try await withCheckedThrowingContinuation(isolation: nil) {
|
||||
(continuation: CheckedContinuation<Void, Error>) in
|
||||
session.sendMessage(
|
||||
payload,
|
||||
replyHandler: { _ in
|
||||
continuation.resume(returning: ())
|
||||
},
|
||||
errorHandler: { error in
|
||||
continuation.resume(throwing: error)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
final class WatchConnectivityTransport: NSObject, @unchecked Sendable {
|
||||
nonisolated private static let logger = Logger(subsystem: "ai.openclaw", category: "watch.messaging")
|
||||
|
||||
private let session: WCSession?
|
||||
private let callbacksLock = NSLock()
|
||||
private var callbacks = WatchConnectivityTransportCallbacks()
|
||||
|
||||
override init() {
|
||||
if WCSession.isSupported() {
|
||||
self.session = WCSession.default
|
||||
} else {
|
||||
self.session = nil
|
||||
}
|
||||
super.init()
|
||||
if let session = self.session {
|
||||
session.delegate = self
|
||||
session.activate()
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated static func isSupportedOnDevice() -> Bool {
|
||||
WCSession.isSupported()
|
||||
}
|
||||
|
||||
nonisolated static func currentStatusSnapshot() -> WatchMessagingStatus {
|
||||
guard WCSession.isSupported() else {
|
||||
return WatchMessagingStatus(
|
||||
supported: false,
|
||||
paired: false,
|
||||
appInstalled: false,
|
||||
reachable: false,
|
||||
activationState: "unsupported")
|
||||
}
|
||||
return self.status(for: WCSession.default)
|
||||
}
|
||||
|
||||
func status() async -> WatchMessagingStatus {
|
||||
await self.ensureActivated()
|
||||
return self.currentStatusSnapshot()
|
||||
}
|
||||
|
||||
func currentStatusSnapshot() -> WatchMessagingStatus {
|
||||
guard let session = self.session else {
|
||||
return WatchMessagingStatus(
|
||||
supported: false,
|
||||
paired: false,
|
||||
appInstalled: false,
|
||||
reachable: false,
|
||||
activationState: "unsupported")
|
||||
}
|
||||
return Self.status(for: session)
|
||||
}
|
||||
|
||||
func setStatusUpdateHandler(_ handler: (@Sendable (WatchMessagingStatus) -> Void)?) {
|
||||
self.updateCallbacks { $0.statusUpdateHandler = handler }
|
||||
}
|
||||
|
||||
func setReplyHandler(_ handler: (@Sendable (WatchQuickReplyEvent) -> Void)?) {
|
||||
self.updateCallbacks { $0.replyHandler = handler }
|
||||
}
|
||||
|
||||
func setExecApprovalResolveHandler(_ handler: (@Sendable (WatchExecApprovalResolveEvent) -> Void)?) {
|
||||
self.updateCallbacks { $0.execApprovalResolveHandler = handler }
|
||||
}
|
||||
|
||||
func setExecApprovalSnapshotRequestHandler(
|
||||
_ handler: (@Sendable (WatchExecApprovalSnapshotRequestEvent) -> Void)?)
|
||||
{
|
||||
self.updateCallbacks { $0.execApprovalSnapshotRequestHandler = handler }
|
||||
}
|
||||
|
||||
func sendPayload(_ payload: [String: Any]) async throws -> WatchNotificationSendResult {
|
||||
await self.ensureActivated()
|
||||
let session = try self.requireReadySession()
|
||||
if session.isReachable {
|
||||
do {
|
||||
try await sendReachableWatchMessage(payload, with: session)
|
||||
return WatchNotificationSendResult(
|
||||
deliveredImmediately: true,
|
||||
queuedForDelivery: false,
|
||||
transport: "sendMessage")
|
||||
} catch {
|
||||
Self.logger.error("watch sendMessage failed: \(error.localizedDescription, privacy: .public)")
|
||||
}
|
||||
}
|
||||
|
||||
_ = session.transferUserInfo(payload)
|
||||
return WatchNotificationSendResult(
|
||||
deliveredImmediately: false,
|
||||
queuedForDelivery: true,
|
||||
transport: "transferUserInfo")
|
||||
}
|
||||
|
||||
func sendSnapshotPayload(_ payload: [String: Any]) async throws -> WatchNotificationSendResult {
|
||||
await self.ensureActivated()
|
||||
let session = try self.requireReadySession()
|
||||
if session.isReachable {
|
||||
do {
|
||||
try await sendReachableWatchMessage(payload, with: session)
|
||||
return WatchNotificationSendResult(
|
||||
deliveredImmediately: true,
|
||||
queuedForDelivery: false,
|
||||
transport: "sendMessage")
|
||||
} catch {
|
||||
Self.logger.error(
|
||||
"watch snapshot sendMessage failed: \(error.localizedDescription, privacy: .public)")
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
try session.updateApplicationContext(payload)
|
||||
return WatchNotificationSendResult(
|
||||
deliveredImmediately: false,
|
||||
queuedForDelivery: true,
|
||||
transport: "applicationContext")
|
||||
} catch {
|
||||
Self.logger.error(
|
||||
"watch updateApplicationContext failed: \(error.localizedDescription, privacy: .public)")
|
||||
_ = session.transferUserInfo(payload)
|
||||
return WatchNotificationSendResult(
|
||||
deliveredImmediately: false,
|
||||
queuedForDelivery: true,
|
||||
transport: "transferUserInfo")
|
||||
}
|
||||
}
|
||||
|
||||
private func updateCallbacks(_ update: (inout WatchConnectivityTransportCallbacks) -> Void) {
|
||||
self.callbacksLock.lock()
|
||||
defer { self.callbacksLock.unlock() }
|
||||
update(&self.callbacks)
|
||||
}
|
||||
|
||||
private func callbacksSnapshot() -> WatchConnectivityTransportCallbacks {
|
||||
self.callbacksLock.lock()
|
||||
defer { self.callbacksLock.unlock() }
|
||||
return self.callbacks
|
||||
}
|
||||
|
||||
private func requireReadySession() throws -> WCSession {
|
||||
guard let session = self.session else {
|
||||
throw WatchMessagingError.unsupported
|
||||
}
|
||||
let snapshot = Self.status(for: session)
|
||||
guard snapshot.paired else {
|
||||
throw WatchMessagingError.notPaired
|
||||
}
|
||||
guard snapshot.appInstalled else {
|
||||
throw WatchMessagingError.watchAppNotInstalled
|
||||
}
|
||||
return session
|
||||
}
|
||||
|
||||
private func ensureActivated() async {
|
||||
guard let session = self.session else { return }
|
||||
if session.activationState == .activated {
|
||||
return
|
||||
}
|
||||
session.activate()
|
||||
for _ in 0..<8 {
|
||||
if session.activationState == .activated {
|
||||
return
|
||||
}
|
||||
try? await Task.sleep(nanoseconds: 100_000_000)
|
||||
}
|
||||
}
|
||||
|
||||
private func emitStatusUpdate(_ snapshot: WatchMessagingStatus) {
|
||||
guard let handler = self.callbacksSnapshot().statusUpdateHandler else {
|
||||
return
|
||||
}
|
||||
Task { @MainActor in
|
||||
handler(snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
private func emitReply(_ event: WatchQuickReplyEvent) {
|
||||
guard let handler = self.callbacksSnapshot().replyHandler else {
|
||||
return
|
||||
}
|
||||
Task { @MainActor in
|
||||
handler(event)
|
||||
}
|
||||
}
|
||||
|
||||
private func emitExecApprovalResolve(_ event: WatchExecApprovalResolveEvent) {
|
||||
guard let handler = self.callbacksSnapshot().execApprovalResolveHandler else {
|
||||
return
|
||||
}
|
||||
Task { @MainActor in
|
||||
handler(event)
|
||||
}
|
||||
}
|
||||
|
||||
private func emitExecApprovalSnapshotRequest(_ event: WatchExecApprovalSnapshotRequestEvent) {
|
||||
guard let handler = self.callbacksSnapshot().execApprovalSnapshotRequestHandler else {
|
||||
return
|
||||
}
|
||||
Task { @MainActor in
|
||||
handler(event)
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated private static func status(for session: WCSession) -> WatchMessagingStatus {
|
||||
WatchMessagingStatus(
|
||||
supported: true,
|
||||
paired: session.isPaired,
|
||||
appInstalled: session.isWatchAppInstalled,
|
||||
reachable: session.isReachable,
|
||||
activationState: self.activationStateLabel(session.activationState))
|
||||
}
|
||||
|
||||
nonisolated private static func activationStateLabel(_ state: WCSessionActivationState) -> String {
|
||||
switch state {
|
||||
case .notActivated:
|
||||
"notActivated"
|
||||
case .inactive:
|
||||
"inactive"
|
||||
case .activated:
|
||||
"activated"
|
||||
@unknown default:
|
||||
"unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension WatchConnectivityTransport: WCSessionDelegate {
|
||||
func session(
|
||||
_ session: WCSession,
|
||||
activationDidCompleteWith activationState: WCSessionActivationState,
|
||||
error: (any Error)?)
|
||||
{
|
||||
GatewayDiagnostics.log(
|
||||
"watch messaging: activation complete state=\(Self.activationStateLabel(activationState)) error=\(error?.localizedDescription ?? "none")")
|
||||
if let error {
|
||||
Self.logger.error("watch activation failed: \(error.localizedDescription, privacy: .public)")
|
||||
} else {
|
||||
Self.logger.debug(
|
||||
"watch activation state=\(Self.activationStateLabel(activationState), privacy: .public)")
|
||||
}
|
||||
self.emitStatusUpdate(Self.status(for: session))
|
||||
}
|
||||
|
||||
func sessionDidBecomeInactive(_: WCSession) {}
|
||||
|
||||
func sessionDidDeactivate(_ session: WCSession) {
|
||||
GatewayDiagnostics.log("watch messaging: session did deactivate; reactivating")
|
||||
session.activate()
|
||||
self.emitStatusUpdate(Self.status(for: session))
|
||||
}
|
||||
|
||||
func session(_: WCSession, didReceiveMessage message: [String: Any]) {
|
||||
let type = (message["type"] as? String) ?? "unknown"
|
||||
GatewayDiagnostics.log("watch messaging: didReceiveMessage type=\(type)")
|
||||
if let event = WatchMessagingPayloadCodec.parseQuickReplyPayload(message, transport: "sendMessage") {
|
||||
self.emitReply(event)
|
||||
return
|
||||
}
|
||||
if let event = WatchMessagingPayloadCodec.parseExecApprovalResolvePayload(
|
||||
message,
|
||||
transport: "sendMessage")
|
||||
{
|
||||
self.emitExecApprovalResolve(event)
|
||||
return
|
||||
}
|
||||
if let event = WatchMessagingPayloadCodec.parseExecApprovalSnapshotRequestPayload(
|
||||
message,
|
||||
transport: "sendMessage")
|
||||
{
|
||||
self.emitExecApprovalSnapshotRequest(event)
|
||||
}
|
||||
}
|
||||
|
||||
func session(
|
||||
_: WCSession,
|
||||
didReceiveMessage message: [String: Any],
|
||||
replyHandler: @escaping ([String: Any]) -> Void)
|
||||
{
|
||||
let type = (message["type"] as? String) ?? "unknown"
|
||||
GatewayDiagnostics.log("watch messaging: didReceiveMessageWithReply type=\(type)")
|
||||
if let event = WatchMessagingPayloadCodec.parseQuickReplyPayload(message, transport: "sendMessage") {
|
||||
replyHandler(["ok": true])
|
||||
self.emitReply(event)
|
||||
return
|
||||
}
|
||||
if let event = WatchMessagingPayloadCodec.parseExecApprovalResolvePayload(
|
||||
message,
|
||||
transport: "sendMessage")
|
||||
{
|
||||
replyHandler(["ok": true])
|
||||
self.emitExecApprovalResolve(event)
|
||||
return
|
||||
}
|
||||
if let event = WatchMessagingPayloadCodec.parseExecApprovalSnapshotRequestPayload(
|
||||
message,
|
||||
transport: "sendMessage")
|
||||
{
|
||||
replyHandler(["ok": true])
|
||||
self.emitExecApprovalSnapshotRequest(event)
|
||||
return
|
||||
}
|
||||
replyHandler(["ok": false, "error": "unsupported_payload"])
|
||||
}
|
||||
|
||||
func session(_: WCSession, didReceiveUserInfo userInfo: [String: Any]) {
|
||||
let type = (userInfo["type"] as? String) ?? "unknown"
|
||||
GatewayDiagnostics.log("watch messaging: didReceiveUserInfo type=\(type)")
|
||||
if let event = WatchMessagingPayloadCodec.parseQuickReplyPayload(
|
||||
userInfo,
|
||||
transport: "transferUserInfo")
|
||||
{
|
||||
self.emitReply(event)
|
||||
return
|
||||
}
|
||||
if let event = WatchMessagingPayloadCodec.parseExecApprovalResolvePayload(
|
||||
userInfo,
|
||||
transport: "transferUserInfo")
|
||||
{
|
||||
self.emitExecApprovalResolve(event)
|
||||
return
|
||||
}
|
||||
if let event = WatchMessagingPayloadCodec.parseExecApprovalSnapshotRequestPayload(
|
||||
userInfo,
|
||||
transport: "transferUserInfo")
|
||||
{
|
||||
self.emitExecApprovalSnapshotRequest(event)
|
||||
}
|
||||
}
|
||||
|
||||
func sessionReachabilityDidChange(_ session: WCSession) {
|
||||
GatewayDiagnostics.log(
|
||||
"watch messaging: reachability changed reachable=\(session.isReachable) paired=\(session.isPaired) installed=\(session.isWatchAppInstalled)")
|
||||
self.emitStatusUpdate(Self.status(for: session))
|
||||
}
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
import Foundation
|
||||
import OpenClawKit
|
||||
|
||||
enum WatchMessagingPayloadCodec {
|
||||
static func nowMs() -> Int {
|
||||
Int(Date().timeIntervalSince1970 * 1000)
|
||||
}
|
||||
|
||||
static func nonEmpty(_ value: String?) -> String? {
|
||||
let trimmed = value?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
return trimmed.isEmpty ? nil : trimmed
|
||||
}
|
||||
|
||||
static func encodeNotificationPayload(
|
||||
id: String,
|
||||
params: OpenClawWatchNotifyParams) -> [String: Any]
|
||||
{
|
||||
var payload: [String: Any] = [
|
||||
"type": OpenClawWatchPayloadType.notify.rawValue,
|
||||
"id": id,
|
||||
"title": params.title,
|
||||
"body": params.body,
|
||||
"priority": params.priority?.rawValue ?? OpenClawNotificationPriority.active.rawValue,
|
||||
"sentAtMs": nowMs(),
|
||||
]
|
||||
if let promptId = nonEmpty(params.promptId) {
|
||||
payload["promptId"] = promptId
|
||||
}
|
||||
if let sessionKey = nonEmpty(params.sessionKey) {
|
||||
payload["sessionKey"] = sessionKey
|
||||
}
|
||||
if let kind = nonEmpty(params.kind) {
|
||||
payload["kind"] = kind
|
||||
}
|
||||
if let details = nonEmpty(params.details) {
|
||||
payload["details"] = details
|
||||
}
|
||||
if let expiresAtMs = params.expiresAtMs {
|
||||
payload["expiresAtMs"] = expiresAtMs
|
||||
}
|
||||
if let risk = params.risk {
|
||||
payload["risk"] = risk.rawValue
|
||||
}
|
||||
if let actions = params.actions, !actions.isEmpty {
|
||||
payload["actions"] = actions.map { action in
|
||||
var encoded: [String: Any] = [
|
||||
"id": action.id,
|
||||
"label": action.label,
|
||||
]
|
||||
if let style = nonEmpty(action.style) {
|
||||
encoded["style"] = style
|
||||
}
|
||||
return encoded
|
||||
}
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
static func encodeExecApprovalItem(_ item: OpenClawWatchExecApprovalItem) -> [String: Any] {
|
||||
var payload: [String: Any] = [
|
||||
"id": item.id,
|
||||
"commandText": item.commandText,
|
||||
"allowedDecisions": item.allowedDecisions.map(\.rawValue),
|
||||
]
|
||||
if let commandPreview = nonEmpty(item.commandPreview) {
|
||||
payload["commandPreview"] = commandPreview
|
||||
}
|
||||
if let host = nonEmpty(item.host) {
|
||||
payload["host"] = host
|
||||
}
|
||||
if let nodeId = nonEmpty(item.nodeId) {
|
||||
payload["nodeId"] = nodeId
|
||||
}
|
||||
if let agentId = nonEmpty(item.agentId) {
|
||||
payload["agentId"] = agentId
|
||||
}
|
||||
if let expiresAtMs = item.expiresAtMs {
|
||||
payload["expiresAtMs"] = expiresAtMs
|
||||
}
|
||||
if let risk = item.risk {
|
||||
payload["risk"] = risk.rawValue
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
static func encodeExecApprovalPromptPayload(
|
||||
_ message: OpenClawWatchExecApprovalPromptMessage) -> [String: Any]
|
||||
{
|
||||
var payload: [String: Any] = [
|
||||
"type": OpenClawWatchPayloadType.execApprovalPrompt.rawValue,
|
||||
"approval": encodeExecApprovalItem(message.approval),
|
||||
]
|
||||
if let sentAtMs = message.sentAtMs {
|
||||
payload["sentAtMs"] = sentAtMs
|
||||
}
|
||||
if let deliveryId = nonEmpty(message.deliveryId) {
|
||||
payload["deliveryId"] = deliveryId
|
||||
}
|
||||
if message.resetResolvingState == true {
|
||||
payload["resetResolvingState"] = true
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
static func encodeExecApprovalResolvedPayload(
|
||||
_ message: OpenClawWatchExecApprovalResolvedMessage) -> [String: Any]
|
||||
{
|
||||
var payload: [String: Any] = [
|
||||
"type": OpenClawWatchPayloadType.execApprovalResolved.rawValue,
|
||||
"approvalId": message.approvalId,
|
||||
]
|
||||
if let decision = message.decision {
|
||||
payload["decision"] = decision.rawValue
|
||||
}
|
||||
if let resolvedAtMs = message.resolvedAtMs {
|
||||
payload["resolvedAtMs"] = resolvedAtMs
|
||||
}
|
||||
if let source = nonEmpty(message.source) {
|
||||
payload["source"] = source
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
static func encodeExecApprovalExpiredPayload(
|
||||
_ message: OpenClawWatchExecApprovalExpiredMessage) -> [String: Any]
|
||||
{
|
||||
var payload: [String: Any] = [
|
||||
"type": OpenClawWatchPayloadType.execApprovalExpired.rawValue,
|
||||
"approvalId": message.approvalId,
|
||||
"reason": message.reason.rawValue,
|
||||
]
|
||||
if let expiredAtMs = message.expiredAtMs {
|
||||
payload["expiredAtMs"] = expiredAtMs
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
static func encodeExecApprovalSnapshotPayload(
|
||||
_ message: OpenClawWatchExecApprovalSnapshotMessage) -> [String: Any]
|
||||
{
|
||||
var payload: [String: Any] = [
|
||||
"type": OpenClawWatchPayloadType.execApprovalSnapshot.rawValue,
|
||||
"approvals": message.approvals.map(encodeExecApprovalItem),
|
||||
]
|
||||
if let sentAtMs = message.sentAtMs {
|
||||
payload["sentAtMs"] = sentAtMs
|
||||
}
|
||||
if let snapshotId = nonEmpty(message.snapshotId) {
|
||||
payload["snapshotId"] = snapshotId
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
static func parseQuickReplyPayload(
|
||||
_ payload: [String: Any],
|
||||
transport: String) -> WatchQuickReplyEvent?
|
||||
{
|
||||
guard (payload["type"] as? String) == OpenClawWatchPayloadType.reply.rawValue else {
|
||||
return nil
|
||||
}
|
||||
guard let actionId = nonEmpty(payload["actionId"] as? String) else {
|
||||
return nil
|
||||
}
|
||||
let promptId = nonEmpty(payload["promptId"] as? String) ?? "unknown"
|
||||
let replyId = nonEmpty(payload["replyId"] as? String) ?? UUID().uuidString
|
||||
let actionLabel = nonEmpty(payload["actionLabel"] as? String)
|
||||
let sessionKey = nonEmpty(payload["sessionKey"] as? String)
|
||||
let note = nonEmpty(payload["note"] as? String)
|
||||
let sentAtMs = (payload["sentAtMs"] as? Int) ?? (payload["sentAtMs"] as? NSNumber)?.intValue
|
||||
|
||||
return WatchQuickReplyEvent(
|
||||
replyId: replyId,
|
||||
promptId: promptId,
|
||||
actionId: actionId,
|
||||
actionLabel: actionLabel,
|
||||
sessionKey: sessionKey,
|
||||
note: note,
|
||||
sentAtMs: sentAtMs,
|
||||
transport: transport)
|
||||
}
|
||||
|
||||
static func parseExecApprovalResolvePayload(
|
||||
_ payload: [String: Any],
|
||||
transport: String) -> WatchExecApprovalResolveEvent?
|
||||
{
|
||||
guard (payload["type"] as? String) == OpenClawWatchPayloadType.execApprovalResolve.rawValue else {
|
||||
return nil
|
||||
}
|
||||
guard let approvalId = nonEmpty(payload["approvalId"] as? String),
|
||||
let rawDecision = nonEmpty(payload["decision"] as? String),
|
||||
let decision = OpenClawWatchExecApprovalDecision(rawValue: rawDecision)
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
let replyId = nonEmpty(payload["replyId"] as? String) ?? UUID().uuidString
|
||||
let sentAtMs = (payload["sentAtMs"] as? Int) ?? (payload["sentAtMs"] as? NSNumber)?.intValue
|
||||
return WatchExecApprovalResolveEvent(
|
||||
replyId: replyId,
|
||||
approvalId: approvalId,
|
||||
decision: decision,
|
||||
sentAtMs: sentAtMs,
|
||||
transport: transport)
|
||||
}
|
||||
|
||||
static func parseExecApprovalSnapshotRequestPayload(
|
||||
_ payload: [String: Any],
|
||||
transport: String) -> WatchExecApprovalSnapshotRequestEvent?
|
||||
{
|
||||
guard (payload["type"] as? String) == OpenClawWatchPayloadType.execApprovalSnapshotRequest.rawValue else {
|
||||
return nil
|
||||
}
|
||||
let requestId = nonEmpty(payload["requestId"] as? String) ?? UUID().uuidString
|
||||
let sentAtMs = (payload["sentAtMs"] as? Int) ?? (payload["sentAtMs"] as? NSNumber)?.intValue
|
||||
return WatchExecApprovalSnapshotRequestEvent(
|
||||
requestId: requestId,
|
||||
sentAtMs: sentAtMs,
|
||||
transport: transport)
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import Foundation
|
||||
import OpenClawKit
|
||||
import OSLog
|
||||
@preconcurrency import WatchConnectivity
|
||||
|
||||
enum WatchMessagingError: LocalizedError {
|
||||
case unsupported
|
||||
@@ -19,136 +21,272 @@ enum WatchMessagingError: LocalizedError {
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class WatchMessagingService: @preconcurrency WatchMessagingServicing {
|
||||
private let transport: WatchConnectivityTransport
|
||||
private var statusHandler: (@Sendable (WatchMessagingStatus) -> Void)?
|
||||
private var lastEmittedStatus: WatchMessagingStatus?
|
||||
final class WatchMessagingService: NSObject, @preconcurrency WatchMessagingServicing {
|
||||
nonisolated private static let logger = Logger(subsystem: "ai.openclaw", category: "watch.messaging")
|
||||
private let session: WCSession?
|
||||
private var pendingActivationContinuations: [CheckedContinuation<Void, Never>] = []
|
||||
private var replyHandler: (@Sendable (WatchQuickReplyEvent) -> Void)?
|
||||
private var execApprovalResolveHandler: (@Sendable (WatchExecApprovalResolveEvent) -> Void)?
|
||||
private var execApprovalSnapshotRequestHandler: (
|
||||
@Sendable (WatchExecApprovalSnapshotRequestEvent) -> Void)?
|
||||
|
||||
init(transport: WatchConnectivityTransport = WatchConnectivityTransport()) {
|
||||
self.transport = transport
|
||||
self.transport.setStatusUpdateHandler { [weak self] snapshot in
|
||||
Task { @MainActor [weak self] in
|
||||
self?.emitStatusIfChanged(snapshot)
|
||||
}
|
||||
override init() {
|
||||
if WCSession.isSupported() {
|
||||
self.session = WCSession.default
|
||||
} else {
|
||||
self.session = nil
|
||||
}
|
||||
self.transport.setReplyHandler { [weak self] event in
|
||||
Task { @MainActor [weak self] in
|
||||
self?.emitReply(event)
|
||||
}
|
||||
}
|
||||
self.transport.setExecApprovalResolveHandler { [weak self] event in
|
||||
Task { @MainActor [weak self] in
|
||||
self?.emitExecApprovalResolve(event)
|
||||
}
|
||||
}
|
||||
self.transport.setExecApprovalSnapshotRequestHandler { [weak self] event in
|
||||
Task { @MainActor [weak self] in
|
||||
self?.emitExecApprovalSnapshotRequest(event)
|
||||
}
|
||||
super.init()
|
||||
if let session = self.session {
|
||||
session.delegate = self
|
||||
session.activate()
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated static func isSupportedOnDevice() -> Bool {
|
||||
WatchConnectivityTransport.isSupportedOnDevice()
|
||||
WCSession.isSupported()
|
||||
}
|
||||
|
||||
nonisolated static func currentStatusSnapshot() -> WatchMessagingStatus {
|
||||
WatchConnectivityTransport.currentStatusSnapshot()
|
||||
guard WCSession.isSupported() else {
|
||||
return WatchMessagingStatus(
|
||||
supported: false,
|
||||
paired: false,
|
||||
appInstalled: false,
|
||||
reachable: false,
|
||||
activationState: "unsupported")
|
||||
}
|
||||
let session = WCSession.default
|
||||
return status(for: session)
|
||||
}
|
||||
|
||||
func status() async -> WatchMessagingStatus {
|
||||
await self.transport.status()
|
||||
}
|
||||
|
||||
func setStatusHandler(_ handler: (@Sendable (WatchMessagingStatus) -> Void)?) {
|
||||
self.statusHandler = handler
|
||||
guard let handler else {
|
||||
self.lastEmittedStatus = nil
|
||||
GatewayDiagnostics.log("watch messaging: cleared status handler")
|
||||
return
|
||||
await self.ensureActivated()
|
||||
guard let session = self.session else {
|
||||
return WatchMessagingStatus(
|
||||
supported: false,
|
||||
paired: false,
|
||||
appInstalled: false,
|
||||
reachable: false,
|
||||
activationState: "unsupported")
|
||||
}
|
||||
let snapshot = self.transport.currentStatusSnapshot()
|
||||
self.lastEmittedStatus = snapshot
|
||||
GatewayDiagnostics.log(
|
||||
"watch messaging: set status handler supported=\(snapshot.supported) paired=\(snapshot.paired) appInstalled=\(snapshot.appInstalled) reachable=\(snapshot.reachable) activation=\(snapshot.activationState)")
|
||||
handler(snapshot)
|
||||
return Self.status(for: session)
|
||||
}
|
||||
|
||||
func setReplyHandler(_ handler: (@Sendable (WatchQuickReplyEvent) -> Void)?) {
|
||||
self.replyHandler = handler
|
||||
}
|
||||
|
||||
func setExecApprovalResolveHandler(_ handler: (@Sendable (WatchExecApprovalResolveEvent) -> Void)?) {
|
||||
self.execApprovalResolveHandler = handler
|
||||
}
|
||||
|
||||
func setExecApprovalSnapshotRequestHandler(
|
||||
_ handler: (@Sendable (WatchExecApprovalSnapshotRequestEvent) -> Void)?)
|
||||
{
|
||||
self.execApprovalSnapshotRequestHandler = handler
|
||||
}
|
||||
|
||||
func sendNotification(
|
||||
id: String,
|
||||
params: OpenClawWatchNotifyParams) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
let payload = WatchMessagingPayloadCodec.encodeNotificationPayload(id: id, params: params)
|
||||
return try await self.transport.sendPayload(payload)
|
||||
}
|
||||
|
||||
func sendExecApprovalPrompt(
|
||||
_ message: OpenClawWatchExecApprovalPromptMessage) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
try await self.transport.sendPayload(
|
||||
WatchMessagingPayloadCodec.encodeExecApprovalPromptPayload(message))
|
||||
}
|
||||
|
||||
func sendExecApprovalResolved(
|
||||
_ message: OpenClawWatchExecApprovalResolvedMessage) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
try await self.transport.sendPayload(
|
||||
WatchMessagingPayloadCodec.encodeExecApprovalResolvedPayload(message))
|
||||
}
|
||||
|
||||
func sendExecApprovalExpired(
|
||||
_ message: OpenClawWatchExecApprovalExpiredMessage) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
try await self.transport.sendPayload(
|
||||
WatchMessagingPayloadCodec.encodeExecApprovalExpiredPayload(message))
|
||||
}
|
||||
|
||||
func syncExecApprovalSnapshot(
|
||||
_ message: OpenClawWatchExecApprovalSnapshotMessage) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
try await self.transport.sendSnapshotPayload(
|
||||
WatchMessagingPayloadCodec.encodeExecApprovalSnapshotPayload(message))
|
||||
}
|
||||
|
||||
private func emitStatusIfChanged(_ snapshot: WatchMessagingStatus) {
|
||||
guard snapshot != self.lastEmittedStatus else {
|
||||
return
|
||||
await self.ensureActivated()
|
||||
guard let session = self.session else {
|
||||
throw WatchMessagingError.unsupported
|
||||
}
|
||||
|
||||
let snapshot = Self.status(for: session)
|
||||
guard snapshot.paired else { throw WatchMessagingError.notPaired }
|
||||
guard snapshot.appInstalled else { throw WatchMessagingError.watchAppNotInstalled }
|
||||
|
||||
var payload: [String: Any] = [
|
||||
"type": "watch.notify",
|
||||
"id": id,
|
||||
"title": params.title,
|
||||
"body": params.body,
|
||||
"priority": params.priority?.rawValue ?? OpenClawNotificationPriority.active.rawValue,
|
||||
"sentAtMs": Int(Date().timeIntervalSince1970 * 1000),
|
||||
]
|
||||
if let promptId = Self.nonEmpty(params.promptId) {
|
||||
payload["promptId"] = promptId
|
||||
}
|
||||
if let sessionKey = Self.nonEmpty(params.sessionKey) {
|
||||
payload["sessionKey"] = sessionKey
|
||||
}
|
||||
if let kind = Self.nonEmpty(params.kind) {
|
||||
payload["kind"] = kind
|
||||
}
|
||||
if let details = Self.nonEmpty(params.details) {
|
||||
payload["details"] = details
|
||||
}
|
||||
if let expiresAtMs = params.expiresAtMs {
|
||||
payload["expiresAtMs"] = expiresAtMs
|
||||
}
|
||||
if let risk = params.risk {
|
||||
payload["risk"] = risk.rawValue
|
||||
}
|
||||
if let actions = params.actions, !actions.isEmpty {
|
||||
payload["actions"] = actions.map { action in
|
||||
var encoded: [String: Any] = [
|
||||
"id": action.id,
|
||||
"label": action.label,
|
||||
]
|
||||
if let style = Self.nonEmpty(action.style) {
|
||||
encoded["style"] = style
|
||||
}
|
||||
return encoded
|
||||
}
|
||||
}
|
||||
|
||||
if snapshot.reachable {
|
||||
do {
|
||||
try await self.sendReachableMessage(payload, with: session)
|
||||
return WatchNotificationSendResult(
|
||||
deliveredImmediately: true,
|
||||
queuedForDelivery: false,
|
||||
transport: "sendMessage")
|
||||
} catch {
|
||||
Self.logger.error("watch sendMessage failed: \(error.localizedDescription, privacy: .public)")
|
||||
}
|
||||
}
|
||||
|
||||
_ = session.transferUserInfo(payload)
|
||||
return WatchNotificationSendResult(
|
||||
deliveredImmediately: false,
|
||||
queuedForDelivery: true,
|
||||
transport: "transferUserInfo")
|
||||
}
|
||||
|
||||
private func sendReachableMessage(_ payload: [String: Any], with session: WCSession) async throws {
|
||||
try await withCheckedThrowingContinuation { continuation in
|
||||
session.sendMessage(
|
||||
payload,
|
||||
replyHandler: { _ in
|
||||
continuation.resume()
|
||||
},
|
||||
errorHandler: { error in
|
||||
continuation.resume(throwing: error)
|
||||
}
|
||||
)
|
||||
}
|
||||
self.lastEmittedStatus = snapshot
|
||||
GatewayDiagnostics.log(
|
||||
"watch messaging: status supported=\(snapshot.supported) paired=\(snapshot.paired) appInstalled=\(snapshot.appInstalled) reachable=\(snapshot.reachable) activation=\(snapshot.activationState)")
|
||||
self.statusHandler?(snapshot)
|
||||
}
|
||||
|
||||
private func emitReply(_ event: WatchQuickReplyEvent) {
|
||||
self.replyHandler?(event)
|
||||
}
|
||||
|
||||
private func emitExecApprovalResolve(_ event: WatchExecApprovalResolveEvent) {
|
||||
self.execApprovalResolveHandler?(event)
|
||||
nonisolated private static func nonEmpty(_ value: String?) -> String? {
|
||||
let trimmed = value?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
return trimmed.isEmpty ? nil : trimmed
|
||||
}
|
||||
|
||||
private func emitExecApprovalSnapshotRequest(_ event: WatchExecApprovalSnapshotRequestEvent) {
|
||||
GatewayDiagnostics.log(
|
||||
"watch messaging: snapshot request id=\(event.requestId) transport=\(event.transport) sentAtMs=\(event.sentAtMs ?? -1)")
|
||||
self.execApprovalSnapshotRequestHandler?(event)
|
||||
nonisolated private static func parseQuickReplyPayload(
|
||||
_ payload: [String: Any],
|
||||
transport: String) -> WatchQuickReplyEvent?
|
||||
{
|
||||
guard (payload["type"] as? String) == "watch.reply" else {
|
||||
return nil
|
||||
}
|
||||
guard let actionId = nonEmpty(payload["actionId"] as? String) else {
|
||||
return nil
|
||||
}
|
||||
let promptId = nonEmpty(payload["promptId"] as? String) ?? "unknown"
|
||||
let replyId = nonEmpty(payload["replyId"] as? String) ?? UUID().uuidString
|
||||
let actionLabel = nonEmpty(payload["actionLabel"] as? String)
|
||||
let sessionKey = nonEmpty(payload["sessionKey"] as? String)
|
||||
let note = nonEmpty(payload["note"] as? String)
|
||||
let sentAtMs = (payload["sentAtMs"] as? Int) ?? (payload["sentAtMs"] as? NSNumber)?.intValue
|
||||
|
||||
return WatchQuickReplyEvent(
|
||||
replyId: replyId,
|
||||
promptId: promptId,
|
||||
actionId: actionId,
|
||||
actionLabel: actionLabel,
|
||||
sessionKey: sessionKey,
|
||||
note: note,
|
||||
sentAtMs: sentAtMs,
|
||||
transport: transport)
|
||||
}
|
||||
|
||||
private func ensureActivated() async {
|
||||
guard let session = self.session else { return }
|
||||
if session.activationState == .activated { return }
|
||||
session.activate()
|
||||
await withCheckedContinuation { continuation in
|
||||
self.pendingActivationContinuations.append(continuation)
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated private static func status(for session: WCSession) -> WatchMessagingStatus {
|
||||
WatchMessagingStatus(
|
||||
supported: true,
|
||||
paired: session.isPaired,
|
||||
appInstalled: session.isWatchAppInstalled,
|
||||
reachable: session.isReachable,
|
||||
activationState: activationStateLabel(session.activationState))
|
||||
}
|
||||
|
||||
nonisolated private static func activationStateLabel(_ state: WCSessionActivationState) -> String {
|
||||
switch state {
|
||||
case .notActivated:
|
||||
"notActivated"
|
||||
case .inactive:
|
||||
"inactive"
|
||||
case .activated:
|
||||
"activated"
|
||||
@unknown default:
|
||||
"unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension WatchMessagingService: WCSessionDelegate {
|
||||
nonisolated func session(
|
||||
_ session: WCSession,
|
||||
activationDidCompleteWith activationState: WCSessionActivationState,
|
||||
error: (any Error)?)
|
||||
{
|
||||
if let error {
|
||||
Self.logger.error("watch activation failed: \(error.localizedDescription, privacy: .public)")
|
||||
} else {
|
||||
Self.logger.debug("watch activation state=\(Self.activationStateLabel(activationState), privacy: .public)")
|
||||
}
|
||||
// Always resume all waiters so callers never hang, even on error.
|
||||
Task { @MainActor in
|
||||
let waiters = self.pendingActivationContinuations
|
||||
self.pendingActivationContinuations.removeAll()
|
||||
for continuation in waiters {
|
||||
continuation.resume()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated func sessionDidBecomeInactive(_ session: WCSession) {}
|
||||
|
||||
nonisolated func sessionDidDeactivate(_ session: WCSession) {
|
||||
session.activate()
|
||||
}
|
||||
|
||||
nonisolated func session(_: WCSession, didReceiveMessage message: [String: Any]) {
|
||||
guard let event = Self.parseQuickReplyPayload(message, transport: "sendMessage") else {
|
||||
return
|
||||
}
|
||||
Task { @MainActor in
|
||||
self.emitReply(event)
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated func session(
|
||||
_: WCSession,
|
||||
didReceiveMessage message: [String: Any],
|
||||
replyHandler: @escaping ([String: Any]) -> Void)
|
||||
{
|
||||
guard let event = Self.parseQuickReplyPayload(message, transport: "sendMessage") else {
|
||||
replyHandler(["ok": false, "error": "unsupported_payload"])
|
||||
return
|
||||
}
|
||||
replyHandler(["ok": true])
|
||||
Task { @MainActor in
|
||||
self.emitReply(event)
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated func session(_: WCSession, didReceiveUserInfo userInfo: [String: Any]) {
|
||||
guard let event = Self.parseQuickReplyPayload(userInfo, transport: "transferUserInfo") else {
|
||||
return
|
||||
}
|
||||
Task { @MainActor in
|
||||
self.emitReply(event)
|
||||
}
|
||||
}
|
||||
|
||||
nonisolated func sessionReachabilityDidChange(_ session: WCSession) {}
|
||||
}
|
||||
|
||||
@@ -49,32 +49,6 @@ private final class MockNotificationCenter: NotificationCentering, @unchecked Se
|
||||
#expect(prompt == ExecApprovalNotificationPrompt(approvalId: "approval-123"))
|
||||
}
|
||||
|
||||
@Test func parsePromptMapsReviewAction() {
|
||||
let prompt = ExecApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: ExecApprovalNotificationBridge.reviewActionIdentifier,
|
||||
userInfo: [
|
||||
"openclaw": [
|
||||
"kind": ExecApprovalNotificationBridge.requestedKind,
|
||||
"approvalId": "approval-456",
|
||||
],
|
||||
])
|
||||
|
||||
#expect(prompt == ExecApprovalNotificationPrompt(approvalId: "approval-456"))
|
||||
}
|
||||
|
||||
@Test func parsePromptIgnoresUnexpectedActionIdentifiers() {
|
||||
let prompt = ExecApprovalNotificationBridge.parsePrompt(
|
||||
actionIdentifier: "openclaw.exec-approval.allow-once",
|
||||
userInfo: [
|
||||
"openclaw": [
|
||||
"kind": ExecApprovalNotificationBridge.requestedKind,
|
||||
"approvalId": "approval-789",
|
||||
],
|
||||
])
|
||||
|
||||
#expect(prompt == nil)
|
||||
}
|
||||
|
||||
@Test @MainActor func handleResolvedPushRemovesMatchingNotifications() async {
|
||||
let center = MockNotificationCenter()
|
||||
center.delivered = [
|
||||
|
||||
@@ -46,37 +46,16 @@ private final class MockWatchMessagingService: @preconcurrency WatchMessagingSer
|
||||
transport: "sendMessage")
|
||||
var sendError: Error?
|
||||
var lastSent: (id: String, params: OpenClawWatchNotifyParams)?
|
||||
var lastSentExecApprovalPrompt: OpenClawWatchExecApprovalPromptMessage?
|
||||
var lastSentExecApprovalResolved: OpenClawWatchExecApprovalResolvedMessage?
|
||||
var lastSentExecApprovalExpired: OpenClawWatchExecApprovalExpiredMessage?
|
||||
var lastSentExecApprovalSnapshot: OpenClawWatchExecApprovalSnapshotMessage?
|
||||
private var statusHandler: (@Sendable (WatchMessagingStatus) -> Void)?
|
||||
private var replyHandler: (@Sendable (WatchQuickReplyEvent) -> Void)?
|
||||
private var execApprovalResolveHandler: (@Sendable (WatchExecApprovalResolveEvent) -> Void)?
|
||||
private var execApprovalSnapshotRequestHandler: (@Sendable (WatchExecApprovalSnapshotRequestEvent) -> Void)?
|
||||
|
||||
func status() async -> WatchMessagingStatus {
|
||||
self.currentStatus
|
||||
}
|
||||
|
||||
func setStatusHandler(_ handler: (@Sendable (WatchMessagingStatus) -> Void)?) {
|
||||
self.statusHandler = handler
|
||||
}
|
||||
|
||||
func setReplyHandler(_ handler: (@Sendable (WatchQuickReplyEvent) -> Void)?) {
|
||||
self.replyHandler = handler
|
||||
}
|
||||
|
||||
func setExecApprovalResolveHandler(_ handler: (@Sendable (WatchExecApprovalResolveEvent) -> Void)?) {
|
||||
self.execApprovalResolveHandler = handler
|
||||
}
|
||||
|
||||
func setExecApprovalSnapshotRequestHandler(
|
||||
_ handler: (@Sendable (WatchExecApprovalSnapshotRequestEvent) -> Void)?)
|
||||
{
|
||||
self.execApprovalSnapshotRequestHandler = handler
|
||||
}
|
||||
|
||||
func sendNotification(id: String, params: OpenClawWatchNotifyParams) async throws -> WatchNotificationSendResult {
|
||||
self.lastSent = (id: id, params: params)
|
||||
if let sendError = self.sendError {
|
||||
@@ -85,57 +64,9 @@ private final class MockWatchMessagingService: @preconcurrency WatchMessagingSer
|
||||
return self.nextSendResult
|
||||
}
|
||||
|
||||
func sendExecApprovalPrompt(
|
||||
_ message: OpenClawWatchExecApprovalPromptMessage) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
self.lastSentExecApprovalPrompt = message
|
||||
if let sendError = self.sendError {
|
||||
throw sendError
|
||||
}
|
||||
return self.nextSendResult
|
||||
}
|
||||
|
||||
func sendExecApprovalResolved(
|
||||
_ message: OpenClawWatchExecApprovalResolvedMessage) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
self.lastSentExecApprovalResolved = message
|
||||
if let sendError = self.sendError {
|
||||
throw sendError
|
||||
}
|
||||
return self.nextSendResult
|
||||
}
|
||||
|
||||
func sendExecApprovalExpired(
|
||||
_ message: OpenClawWatchExecApprovalExpiredMessage) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
self.lastSentExecApprovalExpired = message
|
||||
if let sendError = self.sendError {
|
||||
throw sendError
|
||||
}
|
||||
return self.nextSendResult
|
||||
}
|
||||
|
||||
func syncExecApprovalSnapshot(
|
||||
_ message: OpenClawWatchExecApprovalSnapshotMessage) async throws -> WatchNotificationSendResult
|
||||
{
|
||||
self.lastSentExecApprovalSnapshot = message
|
||||
if let sendError = self.sendError {
|
||||
throw sendError
|
||||
}
|
||||
return self.nextSendResult
|
||||
}
|
||||
|
||||
func emitReply(_ event: WatchQuickReplyEvent) {
|
||||
self.replyHandler?(event)
|
||||
}
|
||||
|
||||
func emitExecApprovalResolve(_ event: WatchExecApprovalResolveEvent) {
|
||||
self.execApprovalResolveHandler?(event)
|
||||
}
|
||||
|
||||
func emitExecApprovalSnapshotRequest(_ event: WatchExecApprovalSnapshotRequestEvent) {
|
||||
self.execApprovalSnapshotRequestHandler?(event)
|
||||
}
|
||||
}
|
||||
|
||||
private final class MockBootstrapNotificationCenter: NotificationCentering, @unchecked Sendable {
|
||||
@@ -253,118 +184,6 @@ private final class MockBootstrapNotificationCenter: NotificationCentering, @unc
|
||||
#expect(prompt.id == "approval-active")
|
||||
}
|
||||
|
||||
@Test @MainActor func presentingExecApprovalPromptSyncsWatchPrompt() async throws {
|
||||
let watchService = MockWatchMessagingService()
|
||||
let appModel = NodeAppModel(watchMessagingService: watchService)
|
||||
let prompt = try #require(
|
||||
NodeAppModel._test_makeExecApprovalPrompt(
|
||||
id: "approval-watch-sync",
|
||||
commandText: "npm publish",
|
||||
allowedDecisions: ["allow-once", "deny"],
|
||||
host: "gateway",
|
||||
nodeId: "node-1",
|
||||
agentId: "main",
|
||||
expiresAtMs: 1234))
|
||||
|
||||
appModel._test_presentExecApprovalPrompt(prompt)
|
||||
await Task.yield()
|
||||
|
||||
let sent = try #require(watchService.lastSentExecApprovalPrompt)
|
||||
#expect(sent.approval.id == "approval-watch-sync")
|
||||
#expect(sent.approval.allowedDecisions == [.allowOnce, .deny])
|
||||
#expect(sent.approval.host == "gateway")
|
||||
#expect(sent.approval.risk == nil)
|
||||
#expect(sent.resetResolvingState != true)
|
||||
}
|
||||
|
||||
@Test @MainActor func watchExecApprovalSnapshotRequestPublishesCachedApprovalsInBackground() async throws {
|
||||
let watchService = MockWatchMessagingService()
|
||||
let appModel = NodeAppModel(watchMessagingService: watchService)
|
||||
let futureExpiryMs = Int(Date().timeIntervalSince1970 * 1000) + 60_000
|
||||
appModel._test_presentExecApprovalPrompt(
|
||||
try #require(
|
||||
NodeAppModel._test_makeExecApprovalPrompt(
|
||||
id: "approval-watch-snapshot",
|
||||
commandText: "echo from watch",
|
||||
allowedDecisions: ["allow-once", "deny"],
|
||||
host: "gateway",
|
||||
nodeId: nil,
|
||||
agentId: nil,
|
||||
expiresAtMs: futureExpiryMs)))
|
||||
await Task.yield()
|
||||
|
||||
appModel.setScenePhase(.background)
|
||||
watchService.emitExecApprovalSnapshotRequest(
|
||||
WatchExecApprovalSnapshotRequestEvent(
|
||||
requestId: "snapshot-1",
|
||||
sentAtMs: 111,
|
||||
transport: "sendMessage"))
|
||||
await Task.yield()
|
||||
|
||||
let snapshot = try #require(watchService.lastSentExecApprovalSnapshot)
|
||||
#expect(snapshot.approvals.map(\.id) == ["approval-watch-snapshot"])
|
||||
}
|
||||
|
||||
@Test @MainActor func watchExecApprovalSnapshotRequestSkipsForegroundRecovery() async throws {
|
||||
let watchService = MockWatchMessagingService()
|
||||
let appModel = NodeAppModel(watchMessagingService: watchService)
|
||||
let futureExpiryMs = Int(Date().timeIntervalSince1970 * 1000) + 60_000
|
||||
appModel._test_presentExecApprovalPrompt(
|
||||
try #require(
|
||||
NodeAppModel._test_makeExecApprovalPrompt(
|
||||
id: "approval-watch-foreground-skip",
|
||||
commandText: "echo foreground",
|
||||
allowedDecisions: ["allow-once", "deny"],
|
||||
host: "gateway",
|
||||
nodeId: nil,
|
||||
agentId: nil,
|
||||
expiresAtMs: futureExpiryMs)))
|
||||
await Task.yield()
|
||||
watchService.lastSentExecApprovalSnapshot = nil
|
||||
|
||||
watchService.emitExecApprovalSnapshotRequest(
|
||||
WatchExecApprovalSnapshotRequestEvent(
|
||||
requestId: "snapshot-foreground",
|
||||
sentAtMs: 222,
|
||||
transport: "sendMessage"))
|
||||
await Task.yield()
|
||||
|
||||
#expect(watchService.lastSentExecApprovalSnapshot == nil)
|
||||
}
|
||||
|
||||
@Test @MainActor func pendingWatchRecoveryIDsAreIncludedWithoutDeliveredNotifications() async {
|
||||
NodeAppModel._test_resetPersistedWatchExecApprovalBridgeState()
|
||||
defer { NodeAppModel._test_resetPersistedWatchExecApprovalBridgeState() }
|
||||
|
||||
let appModel = NodeAppModel(notificationCenter: MockBootstrapNotificationCenter())
|
||||
appModel._test_recordPendingWatchExecApprovalRecoveryID("approval-watch-recovery")
|
||||
|
||||
let ids = await appModel._test_pendingExecApprovalIDsForWatchRecovery()
|
||||
#expect(ids == ["approval-watch-recovery"])
|
||||
}
|
||||
|
||||
@Test @MainActor func presentingExecApprovalPromptClearsPendingWatchRecoveryID() throws {
|
||||
NodeAppModel._test_resetPersistedWatchExecApprovalBridgeState()
|
||||
defer { NodeAppModel._test_resetPersistedWatchExecApprovalBridgeState() }
|
||||
|
||||
let appModel = NodeAppModel(notificationCenter: MockBootstrapNotificationCenter())
|
||||
appModel._test_recordPendingWatchExecApprovalRecoveryID("approval-watch-clear")
|
||||
#expect(appModel._test_pendingWatchExecApprovalRecoveryIDs() == ["approval-watch-clear"])
|
||||
|
||||
appModel._test_presentExecApprovalPrompt(
|
||||
try #require(
|
||||
NodeAppModel._test_makeExecApprovalPrompt(
|
||||
id: "approval-watch-clear",
|
||||
commandText: "echo clear",
|
||||
allowedDecisions: ["allow-once", "deny"],
|
||||
host: "gateway",
|
||||
nodeId: nil,
|
||||
agentId: nil,
|
||||
expiresAtMs: Int(Date().timeIntervalSince1970 * 1000) + 60_000)))
|
||||
|
||||
#expect(appModel._test_pendingWatchExecApprovalRecoveryIDs().isEmpty)
|
||||
}
|
||||
|
||||
@Test func approvalNotificationErrorClassificationPrefersStructuredDetails() {
|
||||
let staleError = GatewayResponseError(
|
||||
method: "exec.approval.get",
|
||||
@@ -381,48 +200,6 @@ private final class MockBootstrapNotificationCenter: NotificationCentering, @unc
|
||||
#expect(NodeAppModel._test_isApprovalNotificationUnavailableError(unavailableError))
|
||||
}
|
||||
|
||||
@Test func backgroundAwareExecApprovalReconnectCoversWatchAndPushPaths() {
|
||||
#expect(
|
||||
NodeAppModel._test_shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: "watch_request",
|
||||
isBackgrounded: true)
|
||||
)
|
||||
#expect(
|
||||
NodeAppModel._test_shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: "push_request",
|
||||
isBackgrounded: true)
|
||||
)
|
||||
#expect(
|
||||
NodeAppModel._test_shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: "watch_resolve",
|
||||
isBackgrounded: true)
|
||||
)
|
||||
#expect(
|
||||
!NodeAppModel._test_shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: "direct",
|
||||
isBackgrounded: true)
|
||||
)
|
||||
#expect(
|
||||
!NodeAppModel._test_shouldUseBackgroundAwareExecApprovalReconnect(
|
||||
sourceReason: "watch_request",
|
||||
isBackgrounded: false)
|
||||
)
|
||||
}
|
||||
|
||||
@Test func watchExecApprovalHydrateFetchesOnlyMissingIDs() {
|
||||
let idsToFetch = NodeAppModel._test_watchExecApprovalIDsNeedingFetch(
|
||||
candidateIDs: ["cached", "pending", "cached", "other", "", " pending "],
|
||||
cachedApprovalIDs: ["cached", "also-cached"])
|
||||
|
||||
#expect(idsToFetch == ["pending", "other"])
|
||||
}
|
||||
|
||||
@Test func watchExecApprovalRetryPromptResetsResolvingStateOnlyForRetryReason() {
|
||||
#expect(NodeAppModel._test_shouldResetWatchExecApprovalResolvingStateOnPrompt(reason: "resolve_retry"))
|
||||
#expect(!NodeAppModel._test_shouldResetWatchExecApprovalResolvingStateOnPrompt(reason: "push_request"))
|
||||
#expect(!NodeAppModel._test_shouldResetWatchExecApprovalResolvingStateOnPrompt(reason: "present_prompt"))
|
||||
}
|
||||
|
||||
@Test func operatorLoopWaitsForBootstrapHandoffBeforeUsingStoredToken() {
|
||||
#expect(
|
||||
!NodeAppModel._test_shouldStartOperatorGatewayLoop(
|
||||
@@ -813,7 +590,6 @@ private final class MockBootstrapNotificationCenter: NotificationCentering, @unc
|
||||
note: nil,
|
||||
sentAtMs: 1234,
|
||||
transport: "transferUserInfo"))
|
||||
await Task.yield()
|
||||
#expect(appModel._test_queuedWatchReplyCount() == 1)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
@Suite(.serialized) struct OpenClawAppDelegateTests {
|
||||
@Test @MainActor func resolvesRegistryModelBeforeViewTaskAssignsDelegateModel() {
|
||||
let registryModel = NodeAppModel()
|
||||
OpenClawAppModelRegistry.appModel = registryModel
|
||||
defer { OpenClawAppModelRegistry.appModel = nil }
|
||||
|
||||
let delegate = OpenClawAppDelegate()
|
||||
|
||||
#expect(delegate._test_resolvedAppModel() === registryModel)
|
||||
}
|
||||
|
||||
@Test @MainActor func prefersExplicitDelegateModelOverRegistryFallback() {
|
||||
let registryModel = NodeAppModel()
|
||||
let explicitModel = NodeAppModel()
|
||||
OpenClawAppModelRegistry.appModel = registryModel
|
||||
defer { OpenClawAppModelRegistry.appModel = nil }
|
||||
|
||||
let delegate = OpenClawAppDelegate()
|
||||
delegate.appModel = explicitModel
|
||||
|
||||
#expect(delegate._test_resolvedAppModel() === explicitModel)
|
||||
}
|
||||
}
|
||||
@@ -2,79 +2,27 @@ import SwiftUI
|
||||
|
||||
@main
|
||||
struct OpenClawWatchApp: App {
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
@State private var inboxStore = WatchInboxStore()
|
||||
@State private var receiver: WatchConnectivityReceiver?
|
||||
@State private var execApprovalRefreshTask: Task<Void, Never>?
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
WatchInboxView(
|
||||
store: self.inboxStore,
|
||||
onAction: { action in
|
||||
guard let receiver = self.receiver else { return }
|
||||
let draft = self.inboxStore.makeReplyDraft(action: action)
|
||||
self.inboxStore.markReplySending(actionLabel: action.label)
|
||||
Task { @MainActor in
|
||||
let result = await receiver.sendReply(draft)
|
||||
self.inboxStore.markReplyResult(result, actionLabel: action.label)
|
||||
}
|
||||
},
|
||||
onExecApprovalDecision: { approvalId, decision in
|
||||
guard let receiver = self.receiver else { return }
|
||||
self.inboxStore.markExecApprovalSending(approvalId: approvalId, decision: decision)
|
||||
Task { @MainActor in
|
||||
let result = await receiver.sendExecApprovalResolve(
|
||||
approvalId: approvalId,
|
||||
decision: decision)
|
||||
self.inboxStore.markExecApprovalSendResult(
|
||||
approvalId: approvalId,
|
||||
decision: decision,
|
||||
result: result)
|
||||
}
|
||||
},
|
||||
onRefreshExecApprovalReview: {
|
||||
self.refreshExecApprovalReview(force: true)
|
||||
})
|
||||
WatchInboxView(store: self.inboxStore) { action in
|
||||
guard let receiver = self.receiver else { return }
|
||||
let draft = self.inboxStore.makeReplyDraft(action: action)
|
||||
self.inboxStore.markReplySending(actionLabel: action.label)
|
||||
Task { @MainActor in
|
||||
let result = await receiver.sendReply(draft)
|
||||
self.inboxStore.markReplyResult(result, actionLabel: action.label)
|
||||
}
|
||||
}
|
||||
.task {
|
||||
if self.receiver == nil {
|
||||
let receiver = WatchConnectivityReceiver(store: self.inboxStore)
|
||||
receiver.activate()
|
||||
self.receiver = receiver
|
||||
}
|
||||
self.refreshExecApprovalReview()
|
||||
}
|
||||
.onChange(of: self.scenePhase) { _, newPhase in
|
||||
guard newPhase == .active else { return }
|
||||
self.refreshExecApprovalReview()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func refreshExecApprovalReview(force: Bool = false) {
|
||||
guard let receiver = self.receiver else { return }
|
||||
guard force || self.inboxStore.shouldAutoRequestExecApprovalSnapshot else { return }
|
||||
|
||||
self.execApprovalRefreshTask?.cancel()
|
||||
self.execApprovalRefreshTask = Task { @MainActor in
|
||||
self.inboxStore.beginExecApprovalReviewLoading()
|
||||
for attempt in 0..<5 {
|
||||
if Task.isCancelled { return }
|
||||
await receiver.requestExecApprovalSnapshot()
|
||||
if !self.inboxStore.execApprovals.isEmpty
|
||||
|| self.inboxStore.hasCompletedExecApprovalSnapshotRefresh
|
||||
{
|
||||
self.inboxStore.markExecApprovalReviewLoaded()
|
||||
return
|
||||
}
|
||||
if attempt < 4 {
|
||||
try? await Task.sleep(nanoseconds: 700_000_000)
|
||||
}
|
||||
}
|
||||
if self.inboxStore.execApprovals.isEmpty {
|
||||
self.inboxStore.markExecApprovalReviewUnavailable(
|
||||
"Couldn't load approval from your iPhone yet.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,31 +52,6 @@ final class WatchConnectivityReceiver: NSObject, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
func requestExecApprovalSnapshot() async {
|
||||
await self.ensureActivated()
|
||||
guard let session = self.session else { return }
|
||||
let request = WatchExecApprovalSnapshotRequestMessage(
|
||||
requestId: UUID().uuidString,
|
||||
sentAtMs: Self.nowMs())
|
||||
let payload = Self.encodeSnapshotRequestPayload(request)
|
||||
if session.isReachable {
|
||||
do {
|
||||
try await withCheckedThrowingContinuation(isolation: nil) {
|
||||
(continuation: CheckedContinuation<Void, Error>) in
|
||||
session.sendMessage(payload, replyHandler: { _ in
|
||||
continuation.resume(returning: ())
|
||||
}, errorHandler: { error in
|
||||
continuation.resume(throwing: error)
|
||||
})
|
||||
}
|
||||
return
|
||||
} catch {
|
||||
// Fall through to queued delivery.
|
||||
}
|
||||
}
|
||||
_ = session.transferUserInfo(payload)
|
||||
}
|
||||
|
||||
func sendReply(_ draft: WatchReplyDraft) async -> WatchReplySendResult {
|
||||
await self.ensureActivated()
|
||||
guard let session = self.session else {
|
||||
@@ -88,7 +63,7 @@ final class WatchConnectivityReceiver: NSObject, @unchecked Sendable {
|
||||
}
|
||||
|
||||
var payload: [String: Any] = [
|
||||
"type": WatchPayloadType.reply.rawValue,
|
||||
"type": "watch.reply",
|
||||
"replyId": draft.replyId,
|
||||
"promptId": draft.promptId,
|
||||
"actionId": draft.actionId,
|
||||
@@ -108,38 +83,11 @@ final class WatchConnectivityReceiver: NSObject, @unchecked Sendable {
|
||||
payload["note"] = note
|
||||
}
|
||||
|
||||
return await self.sendPayload(payload, session: session)
|
||||
}
|
||||
|
||||
func sendExecApprovalResolve(
|
||||
approvalId: String,
|
||||
decision: WatchExecApprovalDecision) async -> WatchReplySendResult
|
||||
{
|
||||
await self.ensureActivated()
|
||||
guard let session = self.session else {
|
||||
return WatchReplySendResult(
|
||||
deliveredImmediately: false,
|
||||
queuedForDelivery: false,
|
||||
transport: "none",
|
||||
errorMessage: "watch session unavailable")
|
||||
}
|
||||
|
||||
let payload = Self.encodeExecApprovalResolvePayload(
|
||||
WatchExecApprovalResolveMessage(
|
||||
approvalId: approvalId,
|
||||
decision: decision,
|
||||
replyId: UUID().uuidString,
|
||||
sentAtMs: Self.nowMs()))
|
||||
return await self.sendPayload(payload, session: session)
|
||||
}
|
||||
|
||||
private func sendPayload(_ payload: [String: Any], session: WCSession) async -> WatchReplySendResult {
|
||||
if session.isReachable {
|
||||
do {
|
||||
try await withCheckedThrowingContinuation(isolation: nil) {
|
||||
(continuation: CheckedContinuation<Void, Error>) in
|
||||
try await withCheckedThrowingContinuation { continuation in
|
||||
session.sendMessage(payload, replyHandler: { _ in
|
||||
continuation.resume(returning: ())
|
||||
continuation.resume()
|
||||
}, errorHandler: { error in
|
||||
continuation.resume(throwing: error)
|
||||
})
|
||||
@@ -162,10 +110,6 @@ final class WatchConnectivityReceiver: NSObject, @unchecked Sendable {
|
||||
errorMessage: nil)
|
||||
}
|
||||
|
||||
private static func nowMs() -> Int {
|
||||
Int(Date().timeIntervalSince1970 * 1000)
|
||||
}
|
||||
|
||||
private static func normalizeObject(_ value: Any) -> [String: Any]? {
|
||||
if let object = value as? [String: Any] {
|
||||
return object
|
||||
@@ -203,9 +147,7 @@ final class WatchConnectivityReceiver: NSObject, @unchecked Sendable {
|
||||
}
|
||||
|
||||
private static func parseNotificationPayload(_ payload: [String: Any]) -> WatchNotifyMessage? {
|
||||
guard let type = payload["type"] as? String,
|
||||
type == WatchPayloadType.notify.rawValue
|
||||
else {
|
||||
guard let type = payload["type"] as? String, type == "watch.notify" else {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -247,153 +189,6 @@ final class WatchConnectivityReceiver: NSObject, @unchecked Sendable {
|
||||
risk: risk,
|
||||
actions: actions)
|
||||
}
|
||||
|
||||
private static func parseExecApprovalDecision(_ value: Any?) -> WatchExecApprovalDecision? {
|
||||
let raw = (value as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
return WatchExecApprovalDecision(rawValue: raw)
|
||||
}
|
||||
|
||||
private static func parseExecApprovalItem(_ value: Any?) -> WatchExecApprovalItem? {
|
||||
guard let payload = value.flatMap(Self.normalizeObject) else {
|
||||
return nil
|
||||
}
|
||||
let id = (payload["id"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
let commandText = (payload["commandText"] as? String)?
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
guard !id.isEmpty, !commandText.isEmpty else {
|
||||
return nil
|
||||
}
|
||||
let commandPreview = (payload["commandPreview"] as? String)?
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let host = (payload["host"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let nodeId = (payload["nodeId"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let agentId = (payload["agentId"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let expiresAtMs = (payload["expiresAtMs"] as? Int) ?? (payload["expiresAtMs"] as? NSNumber)?.intValue
|
||||
let riskRaw = (payload["risk"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
let risk = WatchRiskLevel(rawValue: riskRaw)
|
||||
let allowedDecisions = (payload["allowedDecisions"] as? [Any] ?? []).compactMap {
|
||||
Self.parseExecApprovalDecision($0)
|
||||
}
|
||||
return WatchExecApprovalItem(
|
||||
id: id,
|
||||
commandText: commandText,
|
||||
commandPreview: commandPreview,
|
||||
host: host,
|
||||
nodeId: nodeId,
|
||||
agentId: agentId,
|
||||
expiresAtMs: expiresAtMs,
|
||||
allowedDecisions: allowedDecisions,
|
||||
risk: risk)
|
||||
}
|
||||
|
||||
private static func parseExecApprovalPromptPayload(
|
||||
_ payload: [String: Any]) -> WatchExecApprovalPromptMessage?
|
||||
{
|
||||
guard let type = payload["type"] as? String,
|
||||
type == WatchPayloadType.execApprovalPrompt.rawValue,
|
||||
let approval = Self.parseExecApprovalItem(payload["approval"])
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
let sentAtMs = (payload["sentAtMs"] as? Int) ?? (payload["sentAtMs"] as? NSNumber)?.intValue
|
||||
let deliveryId = (payload["deliveryId"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
let resetResolvingState = payload["resetResolvingState"] as? Bool
|
||||
return WatchExecApprovalPromptMessage(
|
||||
approval: approval,
|
||||
sentAtMs: sentAtMs,
|
||||
deliveryId: deliveryId,
|
||||
resetResolvingState: resetResolvingState)
|
||||
}
|
||||
|
||||
private static func parseExecApprovalResolvedPayload(
|
||||
_ payload: [String: Any]) -> WatchExecApprovalResolvedMessage?
|
||||
{
|
||||
guard let type = payload["type"] as? String,
|
||||
type == WatchPayloadType.execApprovalResolved.rawValue
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
let approvalId = (payload["approvalId"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
guard !approvalId.isEmpty else { return nil }
|
||||
let decision = Self.parseExecApprovalDecision(payload["decision"])
|
||||
let resolvedAtMs = (payload["resolvedAtMs"] as? Int)
|
||||
?? (payload["resolvedAtMs"] as? NSNumber)?.intValue
|
||||
let source = (payload["source"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
return WatchExecApprovalResolvedMessage(
|
||||
approvalId: approvalId,
|
||||
decision: decision,
|
||||
resolvedAtMs: resolvedAtMs,
|
||||
source: source)
|
||||
}
|
||||
|
||||
private static func parseExecApprovalExpiredPayload(
|
||||
_ payload: [String: Any]) -> WatchExecApprovalExpiredMessage?
|
||||
{
|
||||
guard let type = payload["type"] as? String,
|
||||
type == WatchPayloadType.execApprovalExpired.rawValue
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
let approvalId = (payload["approvalId"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
let rawReason = (payload["reason"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
guard !approvalId.isEmpty,
|
||||
let reason = WatchExecApprovalCloseReason(rawValue: rawReason)
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
let expiredAtMs = (payload["expiredAtMs"] as? Int) ?? (payload["expiredAtMs"] as? NSNumber)?.intValue
|
||||
return WatchExecApprovalExpiredMessage(
|
||||
approvalId: approvalId,
|
||||
reason: reason,
|
||||
expiredAtMs: expiredAtMs)
|
||||
}
|
||||
|
||||
private static func parseExecApprovalSnapshotPayload(
|
||||
_ payload: [String: Any]) -> WatchExecApprovalSnapshotMessage?
|
||||
{
|
||||
guard let type = payload["type"] as? String,
|
||||
type == WatchPayloadType.execApprovalSnapshot.rawValue
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
let approvals = (payload["approvals"] as? [Any] ?? []).compactMap { item in
|
||||
Self.parseExecApprovalItem(item)
|
||||
}
|
||||
let sentAtMs = (payload["sentAtMs"] as? Int) ?? (payload["sentAtMs"] as? NSNumber)?.intValue
|
||||
let snapshotId = (payload["snapshotId"] as? String)?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
return WatchExecApprovalSnapshotMessage(
|
||||
approvals: approvals,
|
||||
sentAtMs: sentAtMs,
|
||||
snapshotId: snapshotId)
|
||||
}
|
||||
|
||||
private static func encodeSnapshotRequestPayload(
|
||||
_ request: WatchExecApprovalSnapshotRequestMessage) -> [String: Any]
|
||||
{
|
||||
var payload: [String: Any] = [
|
||||
"type": WatchPayloadType.execApprovalSnapshotRequest.rawValue,
|
||||
"requestId": request.requestId,
|
||||
]
|
||||
if let sentAtMs = request.sentAtMs {
|
||||
payload["sentAtMs"] = sentAtMs
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
private static func encodeExecApprovalResolvePayload(
|
||||
_ message: WatchExecApprovalResolveMessage) -> [String: Any]
|
||||
{
|
||||
var payload: [String: Any] = [
|
||||
"type": WatchPayloadType.execApprovalResolve.rawValue,
|
||||
"approvalId": message.approvalId,
|
||||
"decision": message.decision.rawValue,
|
||||
"replyId": message.replyId,
|
||||
]
|
||||
if let sentAtMs = message.sentAtMs {
|
||||
payload["sentAtMs"] = sentAtMs
|
||||
}
|
||||
return payload
|
||||
}
|
||||
}
|
||||
|
||||
extension WatchConnectivityReceiver: WCSessionDelegate {
|
||||
@@ -401,14 +196,13 @@ extension WatchConnectivityReceiver: WCSessionDelegate {
|
||||
_: WCSession,
|
||||
activationDidCompleteWith _: WCSessionActivationState,
|
||||
error _: (any Error)?)
|
||||
{
|
||||
Task {
|
||||
await self.requestExecApprovalSnapshot()
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
func session(_: WCSession, didReceiveMessage message: [String: Any]) {
|
||||
self.consumeIncomingPayload(message, transport: "sendMessage")
|
||||
guard let incoming = Self.parseNotificationPayload(message) else { return }
|
||||
Task { @MainActor in
|
||||
self.store.consume(message: incoming, transport: "sendMessage")
|
||||
}
|
||||
}
|
||||
|
||||
func session(
|
||||
@@ -416,47 +210,27 @@ extension WatchConnectivityReceiver: WCSessionDelegate {
|
||||
didReceiveMessage message: [String: Any],
|
||||
replyHandler: @escaping ([String: Any]) -> Void)
|
||||
{
|
||||
guard let incoming = Self.parseNotificationPayload(message) else {
|
||||
replyHandler(["ok": false])
|
||||
return
|
||||
}
|
||||
replyHandler(["ok": true])
|
||||
self.consumeIncomingPayload(message, transport: "sendMessage")
|
||||
Task { @MainActor in
|
||||
self.store.consume(message: incoming, transport: "sendMessage")
|
||||
}
|
||||
}
|
||||
|
||||
func session(_: WCSession, didReceiveUserInfo userInfo: [String: Any]) {
|
||||
self.consumeIncomingPayload(userInfo, transport: "transferUserInfo")
|
||||
guard let incoming = Self.parseNotificationPayload(userInfo) else { return }
|
||||
Task { @MainActor in
|
||||
self.store.consume(message: incoming, transport: "transferUserInfo")
|
||||
}
|
||||
}
|
||||
|
||||
func session(_: WCSession, didReceiveApplicationContext applicationContext: [String: Any]) {
|
||||
self.consumeIncomingPayload(applicationContext, transport: "applicationContext")
|
||||
}
|
||||
|
||||
private func consumeIncomingPayload(_ payload: [String: Any], transport: String) {
|
||||
if let incoming = Self.parseNotificationPayload(payload) {
|
||||
Task { @MainActor in
|
||||
self.store.consume(message: incoming, transport: transport)
|
||||
}
|
||||
return
|
||||
}
|
||||
if let prompt = Self.parseExecApprovalPromptPayload(payload) {
|
||||
Task { @MainActor in
|
||||
self.store.consume(execApprovalPrompt: prompt, transport: transport)
|
||||
}
|
||||
return
|
||||
}
|
||||
if let resolved = Self.parseExecApprovalResolvedPayload(payload) {
|
||||
Task { @MainActor in
|
||||
self.store.consume(execApprovalResolved: resolved)
|
||||
}
|
||||
return
|
||||
}
|
||||
if let expired = Self.parseExecApprovalExpiredPayload(payload) {
|
||||
Task { @MainActor in
|
||||
self.store.consume(execApprovalExpired: expired)
|
||||
}
|
||||
return
|
||||
}
|
||||
if let snapshot = Self.parseExecApprovalSnapshotPayload(payload) {
|
||||
Task { @MainActor in
|
||||
self.store.consume(execApprovalSnapshot: snapshot, transport: transport)
|
||||
}
|
||||
guard let incoming = Self.parseNotificationPayload(applicationContext) else { return }
|
||||
Task { @MainActor in
|
||||
self.store.consume(message: incoming, transport: "applicationContext")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,86 +3,6 @@ import Observation
|
||||
import UserNotifications
|
||||
import WatchKit
|
||||
|
||||
enum WatchPayloadType: String, Codable, Sendable, Equatable {
|
||||
case notify = "watch.notify"
|
||||
case reply = "watch.reply"
|
||||
case execApprovalPrompt = "watch.execApproval.prompt"
|
||||
case execApprovalResolve = "watch.execApproval.resolve"
|
||||
case execApprovalResolved = "watch.execApproval.resolved"
|
||||
case execApprovalExpired = "watch.execApproval.expired"
|
||||
case execApprovalSnapshot = "watch.execApproval.snapshot"
|
||||
case execApprovalSnapshotRequest = "watch.execApproval.snapshotRequest"
|
||||
}
|
||||
|
||||
enum WatchRiskLevel: String, Codable, Sendable, Equatable {
|
||||
case low
|
||||
case medium
|
||||
case high
|
||||
}
|
||||
|
||||
enum WatchExecApprovalDecision: String, Codable, Sendable, Equatable {
|
||||
case allowOnce = "allow-once"
|
||||
case deny
|
||||
}
|
||||
|
||||
enum WatchExecApprovalCloseReason: String, Codable, Sendable, Equatable {
|
||||
case expired
|
||||
case notFound = "not-found"
|
||||
case unavailable
|
||||
case replaced
|
||||
case resolved
|
||||
}
|
||||
|
||||
struct WatchExecApprovalItem: Codable, Sendable, Equatable, Identifiable {
|
||||
var id: String
|
||||
var commandText: String
|
||||
var commandPreview: String?
|
||||
var host: String?
|
||||
var nodeId: String?
|
||||
var agentId: String?
|
||||
var expiresAtMs: Int?
|
||||
var allowedDecisions: [WatchExecApprovalDecision]
|
||||
var risk: WatchRiskLevel?
|
||||
}
|
||||
|
||||
struct WatchExecApprovalPromptMessage: Codable, Sendable, Equatable {
|
||||
var approval: WatchExecApprovalItem
|
||||
var sentAtMs: Int?
|
||||
var deliveryId: String?
|
||||
var resetResolvingState: Bool?
|
||||
}
|
||||
|
||||
struct WatchExecApprovalResolvedMessage: Codable, Sendable, Equatable {
|
||||
var approvalId: String
|
||||
var decision: WatchExecApprovalDecision?
|
||||
var resolvedAtMs: Int?
|
||||
var source: String?
|
||||
}
|
||||
|
||||
struct WatchExecApprovalExpiredMessage: Codable, Sendable, Equatable {
|
||||
var approvalId: String
|
||||
var reason: WatchExecApprovalCloseReason
|
||||
var expiredAtMs: Int?
|
||||
}
|
||||
|
||||
struct WatchExecApprovalSnapshotMessage: Codable, Sendable, Equatable {
|
||||
var approvals: [WatchExecApprovalItem]
|
||||
var sentAtMs: Int?
|
||||
var snapshotId: String?
|
||||
}
|
||||
|
||||
struct WatchExecApprovalSnapshotRequestMessage: Codable, Sendable, Equatable {
|
||||
var requestId: String
|
||||
var sentAtMs: Int?
|
||||
}
|
||||
|
||||
struct WatchExecApprovalResolveMessage: Codable, Sendable, Equatable {
|
||||
var approvalId: String
|
||||
var decision: WatchExecApprovalDecision
|
||||
var replyId: String
|
||||
var sentAtMs: Int?
|
||||
}
|
||||
|
||||
struct WatchPromptAction: Codable, Sendable, Equatable, Identifiable {
|
||||
var id: String
|
||||
var label: String
|
||||
@@ -103,18 +23,6 @@ struct WatchNotifyMessage: Sendable {
|
||||
var actions: [WatchPromptAction]
|
||||
}
|
||||
|
||||
struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
var approval: WatchExecApprovalItem
|
||||
var transport: String
|
||||
var updatedAt: Date
|
||||
var isResolving: Bool
|
||||
var pendingDecision: WatchExecApprovalDecision?
|
||||
var statusText: String?
|
||||
var statusAt: Date?
|
||||
|
||||
var id: String { self.approval.id }
|
||||
}
|
||||
|
||||
@MainActor @Observable final class WatchInboxStore {
|
||||
private struct PersistedState: Codable {
|
||||
var title: String
|
||||
@@ -131,20 +39,13 @@ struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
var actions: [WatchPromptAction]?
|
||||
var replyStatusText: String?
|
||||
var replyStatusAt: Date?
|
||||
var execApprovals: [WatchExecApprovalRecord]
|
||||
var selectedExecApprovalID: String?
|
||||
var lastExecApprovalSnapshotID: String?
|
||||
var lastExecApprovalOutcomeText: String?
|
||||
var lastExecApprovalOutcomeAt: Date?
|
||||
}
|
||||
|
||||
private static let persistedStateKey = "watch.inbox.state.v2"
|
||||
private static let defaultTitle = "OpenClaw"
|
||||
private static let defaultBody = "Waiting for messages from your iPhone."
|
||||
private static let persistedStateKey = "watch.inbox.state.v1"
|
||||
private let defaults: UserDefaults
|
||||
|
||||
var title = WatchInboxStore.defaultTitle
|
||||
var body = WatchInboxStore.defaultBody
|
||||
var title = "OpenClaw"
|
||||
var body = "Waiting for messages from your iPhone."
|
||||
var transport = "none"
|
||||
var updatedAt: Date?
|
||||
var promptId: String?
|
||||
@@ -157,88 +58,16 @@ struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
var replyStatusText: String?
|
||||
var replyStatusAt: Date?
|
||||
var isReplySending = false
|
||||
var execApprovals: [WatchExecApprovalRecord] = []
|
||||
var selectedExecApprovalID: String?
|
||||
var lastExecApprovalOutcomeText: String?
|
||||
var lastExecApprovalOutcomeAt: Date?
|
||||
var isExecApprovalReviewLoading = false
|
||||
var execApprovalReviewStatusText: String?
|
||||
var execApprovalReviewStatusAt: Date?
|
||||
private var lastExecApprovalSnapshotID: String?
|
||||
private var hasCompletedExecApprovalSnapshotRefreshInSession = false
|
||||
private var lastDeliveryKey: String?
|
||||
|
||||
init(defaults: UserDefaults = .standard) {
|
||||
self.defaults = defaults
|
||||
self.restorePersistedState()
|
||||
self.pruneExpiredExecApprovals(nowMs: Self.nowMs())
|
||||
Task {
|
||||
await self.ensureNotificationAuthorization()
|
||||
}
|
||||
}
|
||||
|
||||
var sortedExecApprovals: [WatchExecApprovalRecord] {
|
||||
self.execApprovals.sorted { lhs, rhs in
|
||||
let lhsExpires = lhs.approval.expiresAtMs ?? Int.max
|
||||
let rhsExpires = rhs.approval.expiresAtMs ?? Int.max
|
||||
if lhsExpires != rhsExpires {
|
||||
return lhsExpires < rhsExpires
|
||||
}
|
||||
return lhs.updatedAt > rhs.updatedAt
|
||||
}
|
||||
}
|
||||
|
||||
var activeExecApproval: WatchExecApprovalRecord? {
|
||||
if let selectedExecApprovalID,
|
||||
let selected = self.execApprovals.first(where: { $0.id == selectedExecApprovalID })
|
||||
{
|
||||
return selected
|
||||
}
|
||||
return self.sortedExecApprovals.first
|
||||
}
|
||||
|
||||
var shouldAutoRequestExecApprovalSnapshot: Bool {
|
||||
self.execApprovals.isEmpty
|
||||
&& self.actions.isEmpty
|
||||
&& self.title == Self.defaultTitle
|
||||
&& self.body == Self.defaultBody
|
||||
&& !self.hasCompletedExecApprovalSnapshotRefreshInSession
|
||||
}
|
||||
|
||||
var hasCompletedExecApprovalSnapshotRefresh: Bool {
|
||||
self.hasCompletedExecApprovalSnapshotRefreshInSession
|
||||
}
|
||||
|
||||
var shouldShowExecApprovalReviewStatus: Bool {
|
||||
self.execApprovals.isEmpty && !(self.execApprovalReviewStatusText?.isEmpty ?? true)
|
||||
}
|
||||
|
||||
func beginExecApprovalReviewLoading() {
|
||||
guard self.execApprovals.isEmpty else {
|
||||
self.markExecApprovalReviewLoaded()
|
||||
return
|
||||
}
|
||||
self.isExecApprovalReviewLoading = true
|
||||
self.execApprovalReviewStatusText = "Loading approval from iPhone…"
|
||||
self.execApprovalReviewStatusAt = Date()
|
||||
}
|
||||
|
||||
func markExecApprovalReviewLoaded() {
|
||||
self.isExecApprovalReviewLoading = false
|
||||
self.execApprovalReviewStatusText = nil
|
||||
self.execApprovalReviewStatusAt = nil
|
||||
}
|
||||
|
||||
func markExecApprovalReviewUnavailable(_ message: String) {
|
||||
guard self.execApprovals.isEmpty else {
|
||||
self.markExecApprovalReviewLoaded()
|
||||
return
|
||||
}
|
||||
self.isExecApprovalReviewLoading = false
|
||||
self.execApprovalReviewStatusText = message
|
||||
self.execApprovalReviewStatusAt = Date()
|
||||
}
|
||||
|
||||
func consume(message: WatchNotifyMessage, transport: String) {
|
||||
let messageID = message.id?
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
@@ -253,7 +82,6 @@ struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
self.title = normalizedTitle
|
||||
self.body = message.body
|
||||
self.transport = transport
|
||||
self.markExecApprovalReviewLoaded()
|
||||
self.updatedAt = Date()
|
||||
self.promptId = message.promptId
|
||||
self.sessionKey = message.sessionKey
|
||||
@@ -277,209 +105,6 @@ struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
}
|
||||
}
|
||||
|
||||
func consume(
|
||||
execApprovalPrompt message: WatchExecApprovalPromptMessage,
|
||||
transport: String)
|
||||
{
|
||||
self.pruneExpiredExecApprovals(nowMs: Self.nowMs())
|
||||
self.upsertExecApproval(
|
||||
message.approval,
|
||||
transport: transport,
|
||||
keepSelectionIfPossible: true,
|
||||
resetResolvingState: message.resetResolvingState == true)
|
||||
self.markExecApprovalReviewLoaded()
|
||||
self.lastExecApprovalOutcomeText = nil
|
||||
self.lastExecApprovalOutcomeAt = nil
|
||||
|
||||
Task {
|
||||
await self.postLocalNotification(
|
||||
identifier: "watch.execApproval.\(message.approval.id)",
|
||||
title: "Exec approval required",
|
||||
body: message.approval.commandPreview ?? message.approval.commandText,
|
||||
risk: message.approval.risk?.rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
func consume(
|
||||
execApprovalSnapshot message: WatchExecApprovalSnapshotMessage,
|
||||
transport: String)
|
||||
{
|
||||
let snapshotID = message.snapshotId?.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
if let snapshotID, !snapshotID.isEmpty, snapshotID == self.lastExecApprovalSnapshotID {
|
||||
return
|
||||
}
|
||||
|
||||
let existingRecordsByID = Dictionary(
|
||||
uniqueKeysWithValues: self.execApprovals.map { ($0.id, $0) })
|
||||
self.execApprovals = message.approvals.map { approval in
|
||||
self.mergedExecApprovalRecord(
|
||||
approval: approval,
|
||||
transport: transport,
|
||||
existingRecord: existingRecordsByID[approval.id])
|
||||
}
|
||||
self.lastExecApprovalSnapshotID = snapshotID
|
||||
self.hasCompletedExecApprovalSnapshotRefreshInSession = true
|
||||
if let selectedExecApprovalID,
|
||||
!self.execApprovals.contains(where: { $0.id == selectedExecApprovalID })
|
||||
{
|
||||
self.selectedExecApprovalID = self.sortedExecApprovals.first?.id
|
||||
} else if self.selectedExecApprovalID == nil {
|
||||
self.selectedExecApprovalID = self.sortedExecApprovals.first?.id
|
||||
}
|
||||
self.pruneExpiredExecApprovals(nowMs: Self.nowMs())
|
||||
self.markExecApprovalReviewLoaded()
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
func consume(execApprovalResolved message: WatchExecApprovalResolvedMessage) {
|
||||
self.removeExecApproval(id: message.approvalId)
|
||||
let statusText: String
|
||||
switch message.decision {
|
||||
case .allowOnce:
|
||||
statusText = "Allowed once"
|
||||
case .deny:
|
||||
statusText = "Denied"
|
||||
case nil:
|
||||
statusText = "Approval resolved"
|
||||
}
|
||||
self.lastExecApprovalOutcomeText = statusText
|
||||
self.lastExecApprovalOutcomeAt = Date()
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
func consume(execApprovalExpired message: WatchExecApprovalExpiredMessage) {
|
||||
self.removeExecApproval(id: message.approvalId)
|
||||
let statusText: String
|
||||
switch message.reason {
|
||||
case .expired:
|
||||
statusText = "Approval expired"
|
||||
case .notFound:
|
||||
statusText = "Approval no longer available"
|
||||
case .resolved:
|
||||
statusText = "Approval resolved elsewhere"
|
||||
case .replaced:
|
||||
statusText = "Approval replaced"
|
||||
case .unavailable:
|
||||
statusText = "Approval unavailable"
|
||||
}
|
||||
self.lastExecApprovalOutcomeText = statusText
|
||||
self.lastExecApprovalOutcomeAt = Date()
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
func selectExecApproval(id: String) {
|
||||
let normalizedID = id.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedID.isEmpty else { return }
|
||||
guard self.execApprovals.contains(where: { $0.id == normalizedID }) else { return }
|
||||
self.selectedExecApprovalID = normalizedID
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
func markExecApprovalSending(approvalId: String, decision: WatchExecApprovalDecision) {
|
||||
guard let index = self.execApprovals.firstIndex(where: { $0.id == approvalId }) else { return }
|
||||
self.execApprovals[index].isResolving = true
|
||||
self.execApprovals[index].pendingDecision = decision
|
||||
self.execApprovals[index].statusText = "Sending \(Self.decisionLabel(decision))…"
|
||||
self.execApprovals[index].statusAt = Date()
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
func markExecApprovalSendResult(
|
||||
approvalId: String,
|
||||
decision: WatchExecApprovalDecision,
|
||||
result: WatchReplySendResult)
|
||||
{
|
||||
guard let index = self.execApprovals.firstIndex(where: { $0.id == approvalId }) else { return }
|
||||
if let errorMessage = result.errorMessage, !errorMessage.isEmpty {
|
||||
self.execApprovals[index].isResolving = false
|
||||
self.execApprovals[index].statusText = "Failed: \(errorMessage)"
|
||||
} else if result.deliveredImmediately {
|
||||
self.execApprovals[index].isResolving = true
|
||||
self.execApprovals[index].statusText = "\(Self.decisionLabel(decision)): sent"
|
||||
} else if result.queuedForDelivery {
|
||||
self.execApprovals[index].isResolving = true
|
||||
self.execApprovals[index].statusText = "\(Self.decisionLabel(decision)): queued"
|
||||
} else {
|
||||
self.execApprovals[index].isResolving = true
|
||||
self.execApprovals[index].statusText = "\(Self.decisionLabel(decision)): sent"
|
||||
}
|
||||
self.execApprovals[index].pendingDecision = result.errorMessage == nil ? decision : nil
|
||||
self.execApprovals[index].statusAt = Date()
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
private func upsertExecApproval(
|
||||
_ approval: WatchExecApprovalItem,
|
||||
transport: String,
|
||||
keepSelectionIfPossible: Bool,
|
||||
resetResolvingState: Bool = false)
|
||||
{
|
||||
if let index = self.execApprovals.firstIndex(where: { $0.id == approval.id }) {
|
||||
self.execApprovals[index] = self.mergedExecApprovalRecord(
|
||||
approval: approval,
|
||||
transport: transport,
|
||||
existingRecord: self.execApprovals[index],
|
||||
resetResolvingState: resetResolvingState)
|
||||
} else {
|
||||
self.execApprovals.append(
|
||||
self.mergedExecApprovalRecord(
|
||||
approval: approval,
|
||||
transport: transport,
|
||||
existingRecord: nil,
|
||||
resetResolvingState: resetResolvingState))
|
||||
}
|
||||
if !keepSelectionIfPossible || self.selectedExecApprovalID == nil {
|
||||
self.selectedExecApprovalID = approval.id
|
||||
}
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
private func mergedExecApprovalRecord(
|
||||
approval: WatchExecApprovalItem,
|
||||
transport: String,
|
||||
existingRecord: WatchExecApprovalRecord?,
|
||||
resetResolvingState: Bool = false) -> WatchExecApprovalRecord
|
||||
{
|
||||
// Preserve in-flight state across ordinary snapshot/prompt refreshes so duplicate
|
||||
// submissions stay disabled, but clear it when the iPhone explicitly republishes a
|
||||
// prompt after a failed resolve so the watch can retry.
|
||||
let isResolving = resetResolvingState ? false : (existingRecord?.isResolving ?? false)
|
||||
let pendingDecision = resetResolvingState ? nil : existingRecord?.pendingDecision
|
||||
let statusText = resetResolvingState ? nil : existingRecord?.statusText
|
||||
let statusAt = resetResolvingState ? nil : existingRecord?.statusAt
|
||||
return WatchExecApprovalRecord(
|
||||
approval: approval,
|
||||
transport: transport,
|
||||
updatedAt: Date(),
|
||||
isResolving: isResolving,
|
||||
pendingDecision: pendingDecision,
|
||||
statusText: statusText,
|
||||
statusAt: statusAt)
|
||||
}
|
||||
|
||||
private func removeExecApproval(id: String) {
|
||||
let normalizedID = id.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard !normalizedID.isEmpty else { return }
|
||||
self.execApprovals.removeAll { $0.id == normalizedID }
|
||||
if self.selectedExecApprovalID == normalizedID {
|
||||
self.selectedExecApprovalID = self.sortedExecApprovals.first?.id
|
||||
}
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
private func pruneExpiredExecApprovals(nowMs: Int) {
|
||||
self.execApprovals.removeAll { record in
|
||||
guard let expiresAtMs = record.approval.expiresAtMs else { return false }
|
||||
return expiresAtMs <= nowMs
|
||||
}
|
||||
if let selectedExecApprovalID,
|
||||
!self.execApprovals.contains(where: { $0.id == selectedExecApprovalID })
|
||||
{
|
||||
self.selectedExecApprovalID = self.sortedExecApprovals.first?.id
|
||||
}
|
||||
self.persistState()
|
||||
}
|
||||
|
||||
private func restorePersistedState() {
|
||||
guard let data = self.defaults.data(forKey: Self.persistedStateKey),
|
||||
let state = try? JSONDecoder().decode(PersistedState.self, from: data)
|
||||
@@ -501,15 +126,10 @@ struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
self.actions = state.actions ?? []
|
||||
self.replyStatusText = state.replyStatusText
|
||||
self.replyStatusAt = state.replyStatusAt
|
||||
self.execApprovals = state.execApprovals
|
||||
self.selectedExecApprovalID = state.selectedExecApprovalID
|
||||
self.lastExecApprovalSnapshotID = state.lastExecApprovalSnapshotID
|
||||
self.lastExecApprovalOutcomeText = state.lastExecApprovalOutcomeText
|
||||
self.lastExecApprovalOutcomeAt = state.lastExecApprovalOutcomeAt
|
||||
}
|
||||
|
||||
private func persistState() {
|
||||
let updatedAt = self.updatedAt ?? self.lastExecApprovalOutcomeAt ?? Date()
|
||||
guard let updatedAt = self.updatedAt else { return }
|
||||
let state = PersistedState(
|
||||
title: self.title,
|
||||
body: self.body,
|
||||
@@ -524,12 +144,7 @@ struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
risk: self.risk,
|
||||
actions: self.actions,
|
||||
replyStatusText: self.replyStatusText,
|
||||
replyStatusAt: self.replyStatusAt,
|
||||
execApprovals: self.execApprovals,
|
||||
selectedExecApprovalID: self.selectedExecApprovalID,
|
||||
lastExecApprovalSnapshotID: self.lastExecApprovalSnapshotID,
|
||||
lastExecApprovalOutcomeText: self.lastExecApprovalOutcomeText,
|
||||
lastExecApprovalOutcomeAt: self.lastExecApprovalOutcomeAt)
|
||||
replyStatusAt: self.replyStatusAt)
|
||||
guard let data = try? JSONEncoder().encode(state) else { return }
|
||||
self.defaults.set(data, forKey: Self.persistedStateKey)
|
||||
}
|
||||
@@ -572,7 +187,7 @@ struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
actionLabel: action.label,
|
||||
sessionKey: self.sessionKey,
|
||||
note: nil,
|
||||
sentAtMs: Self.nowMs())
|
||||
sentAtMs: Int(Date().timeIntervalSince1970 * 1000))
|
||||
}
|
||||
|
||||
func markReplySending(actionLabel: String) {
|
||||
@@ -612,17 +227,4 @@ struct WatchExecApprovalRecord: Codable, Sendable, Equatable, Identifiable {
|
||||
_ = try? await UNUserNotificationCenter.current().add(request)
|
||||
WKInterfaceDevice.current().play(self.mapHapticRisk(risk))
|
||||
}
|
||||
|
||||
private static func decisionLabel(_ decision: WatchExecApprovalDecision) -> String {
|
||||
switch decision {
|
||||
case .allowOnce:
|
||||
"Allow Once"
|
||||
case .deny:
|
||||
"Deny"
|
||||
}
|
||||
}
|
||||
|
||||
private static func nowMs() -> Int {
|
||||
Int(Date().timeIntervalSince1970 * 1000)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,246 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct WatchInboxView: View {
|
||||
var store: WatchInboxStore
|
||||
var onAction: ((WatchPromptAction) -> Void)?
|
||||
var onExecApprovalDecision: ((String, WatchExecApprovalDecision) -> Void)?
|
||||
var onRefreshExecApprovalReview: (() -> Void)?
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
if self.store.sortedExecApprovals.count == 1,
|
||||
let record = self.store.activeExecApproval
|
||||
{
|
||||
WatchExecApprovalDetailView(
|
||||
store: self.store,
|
||||
record: record,
|
||||
onDecision: self.onExecApprovalDecision)
|
||||
} else if !self.store.sortedExecApprovals.isEmpty {
|
||||
WatchExecApprovalListView(
|
||||
store: self.store,
|
||||
onDecision: self.onExecApprovalDecision)
|
||||
} else if self.store.shouldShowExecApprovalReviewStatus {
|
||||
WatchExecApprovalLoadingView(
|
||||
store: self.store,
|
||||
onRetry: self.onRefreshExecApprovalReview)
|
||||
} else {
|
||||
WatchGenericInboxView(store: self.store, onAction: self.onAction)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct WatchExecApprovalLoadingView: View {
|
||||
var store: WatchInboxStore
|
||||
var onRetry: (() -> Void)?
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
Text("Exec approval")
|
||||
.font(.headline)
|
||||
|
||||
if self.store.isExecApprovalReviewLoading {
|
||||
ProgressView()
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
|
||||
if let statusText = self.store.execApprovalReviewStatusText, !statusText.isEmpty {
|
||||
Text(statusText)
|
||||
.font(.body)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
|
||||
if !self.store.isExecApprovalReviewLoading {
|
||||
Button("Retry") {
|
||||
self.onRetry?()
|
||||
}
|
||||
}
|
||||
|
||||
Text("Keep your iPhone nearby and unlocked if review details take a moment to appear.")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding()
|
||||
}
|
||||
.navigationTitle("Exec approval")
|
||||
}
|
||||
}
|
||||
|
||||
private struct WatchExecApprovalListView: View {
|
||||
var store: WatchInboxStore
|
||||
var onDecision: ((String, WatchExecApprovalDecision) -> Void)?
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
Section("Exec approvals") {
|
||||
ForEach(self.store.sortedExecApprovals) { record in
|
||||
NavigationLink {
|
||||
WatchExecApprovalDetailView(
|
||||
store: self.store,
|
||||
record: record,
|
||||
onDecision: self.onDecision)
|
||||
} label: {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(record.approval.commandPreview ?? record.approval.commandText)
|
||||
.font(.headline)
|
||||
.lineLimit(2)
|
||||
Text(self.metadataLine(for: record))
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(2)
|
||||
if let statusText = record.statusText, !statusText.isEmpty {
|
||||
Text(statusText)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(record.isResolving ? Color.secondary : Color.red)
|
||||
.lineLimit(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let outcome = self.store.lastExecApprovalOutcomeText, !outcome.isEmpty {
|
||||
Section("Last result") {
|
||||
Text(outcome)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Approvals")
|
||||
}
|
||||
|
||||
private func metadataLine(for record: WatchExecApprovalRecord) -> String {
|
||||
var parts: [String] = []
|
||||
if let host = record.approval.host, !host.isEmpty {
|
||||
parts.append(host)
|
||||
}
|
||||
if let nodeId = record.approval.nodeId, !nodeId.isEmpty {
|
||||
parts.append(nodeId)
|
||||
}
|
||||
if let expiresText = Self.expiresText(record.approval.expiresAtMs) {
|
||||
parts.append(expiresText)
|
||||
}
|
||||
return parts.isEmpty ? "Pending review" : parts.joined(separator: " · ")
|
||||
}
|
||||
|
||||
private static func expiresText(_ expiresAtMs: Int?) -> String? {
|
||||
guard let expiresAtMs else { return nil }
|
||||
let deltaSeconds = max(0, (expiresAtMs - Int(Date().timeIntervalSince1970 * 1000)) / 1000)
|
||||
if deltaSeconds < 60 {
|
||||
return "Expires in <1m"
|
||||
}
|
||||
return "Expires in \(deltaSeconds / 60)m"
|
||||
}
|
||||
}
|
||||
|
||||
private struct WatchExecApprovalDetailView: View {
|
||||
var store: WatchInboxStore
|
||||
let record: WatchExecApprovalRecord
|
||||
var onDecision: ((String, WatchExecApprovalDecision) -> Void)?
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 10) {
|
||||
Text(self.record.approval.commandText)
|
||||
.font(.headline)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
if let host = self.record.approval.host, !host.isEmpty {
|
||||
self.metadataRow(label: "Host", value: host)
|
||||
}
|
||||
if let nodeId = self.record.approval.nodeId, !nodeId.isEmpty {
|
||||
self.metadataRow(label: "Node", value: nodeId)
|
||||
}
|
||||
if let agentId = self.record.approval.agentId, !agentId.isEmpty {
|
||||
self.metadataRow(label: "Agent", value: agentId)
|
||||
}
|
||||
if let expiresText = Self.expiresText(self.record.approval.expiresAtMs) {
|
||||
self.metadataRow(label: "Expires", value: expiresText)
|
||||
}
|
||||
if let riskText = self.riskText(self.record.approval.risk) {
|
||||
self.metadataRow(label: "Risk", value: riskText)
|
||||
}
|
||||
|
||||
if let statusText = self.currentRecord?.statusText, !statusText.isEmpty {
|
||||
Text(statusText)
|
||||
.font(.footnote)
|
||||
.foregroundStyle((self.currentRecord?.isResolving ?? false) ? Color.secondary : Color.red)
|
||||
}
|
||||
|
||||
if let currentRecord,
|
||||
currentRecord.approval.allowedDecisions.contains(.allowOnce)
|
||||
{
|
||||
Button("Allow Once") {
|
||||
self.onDecision?(currentRecord.id, .allowOnce)
|
||||
}
|
||||
.disabled(currentRecord.isResolving)
|
||||
}
|
||||
|
||||
if let currentRecord,
|
||||
currentRecord.approval.allowedDecisions.contains(.deny)
|
||||
{
|
||||
Button(role: .destructive) {
|
||||
self.onDecision?(currentRecord.id, .deny)
|
||||
} label: {
|
||||
Text("Deny")
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.disabled(currentRecord.isResolving)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding()
|
||||
}
|
||||
.navigationTitle("Exec approval")
|
||||
.onAppear {
|
||||
self.store.selectExecApproval(id: self.record.id)
|
||||
}
|
||||
}
|
||||
|
||||
private var currentRecord: WatchExecApprovalRecord? {
|
||||
self.store.execApprovals.first(where: { $0.id == self.record.id })
|
||||
}
|
||||
|
||||
private func metadataRow(label: String, value: String) -> some View {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(label)
|
||||
.font(.caption2)
|
||||
.foregroundStyle(.secondary)
|
||||
Text(value)
|
||||
.font(.footnote)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
}
|
||||
|
||||
private func riskText(_ risk: WatchRiskLevel?) -> String? {
|
||||
switch risk {
|
||||
case .high:
|
||||
return "High"
|
||||
case .medium:
|
||||
return "Medium"
|
||||
case .low:
|
||||
return "Low"
|
||||
case nil:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
private static func expiresText(_ expiresAtMs: Int?) -> String? {
|
||||
guard let expiresAtMs else { return nil }
|
||||
let deltaSeconds = max(0, (expiresAtMs - Int(Date().timeIntervalSince1970 * 1000)) / 1000)
|
||||
if deltaSeconds < 60 {
|
||||
return "<1 minute"
|
||||
}
|
||||
return "\(deltaSeconds / 60) minutes"
|
||||
}
|
||||
}
|
||||
|
||||
private struct WatchGenericInboxView: View {
|
||||
var store: WatchInboxStore
|
||||
@Bindable var store: WatchInboxStore
|
||||
var onAction: ((WatchPromptAction) -> Void)?
|
||||
|
||||
private func role(for action: WatchPromptAction) -> ButtonRole? {
|
||||
@@ -257,46 +18,40 @@ private struct WatchGenericInboxView: View {
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text(self.store.title)
|
||||
Text(store.title)
|
||||
.font(.headline)
|
||||
.lineLimit(2)
|
||||
|
||||
Text(self.store.body)
|
||||
Text(store.body)
|
||||
.font(.body)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
if let details = self.store.details, !details.isEmpty {
|
||||
if let details = store.details, !details.isEmpty {
|
||||
Text(details)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
|
||||
if let outcome = self.store.lastExecApprovalOutcomeText, !outcome.isEmpty {
|
||||
Text(outcome)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
if !self.store.actions.isEmpty {
|
||||
ForEach(self.store.actions) { action in
|
||||
if !store.actions.isEmpty {
|
||||
ForEach(store.actions) { action in
|
||||
Button(role: self.role(for: action)) {
|
||||
self.onAction?(action)
|
||||
} label: {
|
||||
Text(action.label)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.disabled(self.store.isReplySending)
|
||||
.disabled(store.isReplySending)
|
||||
}
|
||||
}
|
||||
|
||||
if let replyStatusText = self.store.replyStatusText, !replyStatusText.isEmpty {
|
||||
if let replyStatusText = store.replyStatusText, !replyStatusText.isEmpty {
|
||||
Text(replyStatusText)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
if let updatedAt = self.store.updatedAt {
|
||||
if let updatedAt = store.updatedAt {
|
||||
Text("Updated \(updatedAt.formatted(date: .omitted, time: .shortened))")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
@@ -305,6 +60,5 @@ private struct WatchGenericInboxView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding()
|
||||
}
|
||||
.navigationTitle("OpenClaw")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ ASC_KEYCHAIN_SERVICE=openclaw-asc-key
|
||||
ASC_KEYCHAIN_ACCOUNT=YOUR_MAC_USERNAME
|
||||
```
|
||||
|
||||
Important: `apps/ios/fastlane/.env` is only for Fastlane/App Store Connect auth and optional beta-archive settings. It does **not** configure gateway-side direct APNs push delivery for local iOS builds.
|
||||
|
||||
Optional app targeting variables (helpful if Fastlane cannot auto-resolve app by bundle):
|
||||
|
||||
```bash
|
||||
@@ -55,8 +53,6 @@ IOS_DEVELOPMENT_TEAM=YOUR_TEAM_ID
|
||||
|
||||
Tip: run `scripts/ios-team-id.sh` from repo root to print a Team ID for `.env`. The helper prefers the canonical OpenClaw team (`Y5PE65HELJ`) when present locally; otherwise it prefers the first non-personal team from your Xcode account (then personal team if needed). Fastlane uses this helper automatically if `IOS_DEVELOPMENT_TEAM` is missing.
|
||||
|
||||
For local/manual iOS builds that stay on direct APNs, configure the gateway host separately with `OPENCLAW_APNS_TEAM_ID`, `OPENCLAW_APNS_KEY_ID`, and either `OPENCLAW_APNS_PRIVATE_KEY_P8` or `OPENCLAW_APNS_PRIVATE_KEY_PATH`. Those gateway runtime env vars are separate from Fastlane's `.env`.
|
||||
|
||||
Validate auth:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -237,19 +237,12 @@ targets:
|
||||
configFiles:
|
||||
Debug: Config/Signing.xcconfig
|
||||
Release: Config/Signing.xcconfig
|
||||
attributes:
|
||||
DevelopmentTeam: "$(OPENCLAW_DEVELOPMENT_TEAM)"
|
||||
ProvisioningStyle: "$(OPENCLAW_CODE_SIGN_STYLE)"
|
||||
settings:
|
||||
base:
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
|
||||
CODE_SIGN_IDENTITY: "Apple Development"
|
||||
CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
|
||||
DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
|
||||
ENABLE_APPINTENTS_METADATA: NO
|
||||
ENABLE_APP_INTENTS_METADATA_GENERATION: NO
|
||||
PRODUCT_BUNDLE_IDENTIFIER: "$(OPENCLAW_WATCH_APP_BUNDLE_ID)"
|
||||
PROVISIONING_PROFILE_SPECIFIER: "$(OPENCLAW_WATCH_APP_PROFILE)"
|
||||
info:
|
||||
path: WatchApp/Info.plist
|
||||
properties:
|
||||
@@ -272,16 +265,9 @@ targets:
|
||||
configFiles:
|
||||
Debug: Config/Signing.xcconfig
|
||||
Release: Config/Signing.xcconfig
|
||||
attributes:
|
||||
DevelopmentTeam: "$(OPENCLAW_DEVELOPMENT_TEAM)"
|
||||
ProvisioningStyle: "$(OPENCLAW_CODE_SIGN_STYLE)"
|
||||
settings:
|
||||
base:
|
||||
CODE_SIGN_IDENTITY: "Apple Development"
|
||||
CODE_SIGN_STYLE: "$(OPENCLAW_CODE_SIGN_STYLE)"
|
||||
DEVELOPMENT_TEAM: "$(OPENCLAW_DEVELOPMENT_TEAM)"
|
||||
PRODUCT_BUNDLE_IDENTIFIER: "$(OPENCLAW_WATCH_EXTENSION_BUNDLE_ID)"
|
||||
PROVISIONING_PROFILE_SPECIFIER: "$(OPENCLAW_WATCH_EXTENSION_PROFILE)"
|
||||
info:
|
||||
path: WatchExtension/Info.plist
|
||||
properties:
|
||||
|
||||
@@ -299,10 +299,6 @@ enum GatewayEnvironment {
|
||||
if normalized.lowercased().hasPrefix("openclaw ") {
|
||||
normalized = String(normalized.dropFirst("openclaw ".count))
|
||||
}
|
||||
// Strip trailing commit metadata, e.g. "2026.4.2 (d74a122)" → "2026.4.2"
|
||||
if let parenRange = normalized.range(of: #"\s*\([0-9a-fA-F]+\)\s*$"#, options: .regularExpression) {
|
||||
normalized = String(normalized[normalized.startIndex..<parenRange.lowerBound])
|
||||
}
|
||||
return normalized
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ enum HostEnvSecurityPolicy {
|
||||
"CC",
|
||||
"CXX",
|
||||
"CARGO_BUILD_RUSTC",
|
||||
"CARGO_BUILD_RUSTC_WRAPPER",
|
||||
"RUSTC_WRAPPER",
|
||||
"CMAKE_C_COMPILER",
|
||||
"CMAKE_CXX_COMPILER",
|
||||
"SHELL",
|
||||
@@ -46,12 +44,9 @@ enum HostEnvSecurityPolicy {
|
||||
"DOTNET_ADDITIONAL_DEPS",
|
||||
"GLIBC_TUNABLES",
|
||||
"MAVEN_OPTS",
|
||||
"MAKEFLAGS",
|
||||
"MFLAGS",
|
||||
"SBT_OPTS",
|
||||
"GRADLE_OPTS",
|
||||
"ANT_OPTS",
|
||||
"HGRCPATH"
|
||||
"ANT_OPTS"
|
||||
]
|
||||
|
||||
static let blockedOverrideKeys: Set<String> = [
|
||||
@@ -88,8 +83,6 @@ enum HostEnvSecurityPolicy {
|
||||
"CGO_CFLAGS",
|
||||
"CGO_LDFLAGS",
|
||||
"GOFLAGS",
|
||||
"MAKEFLAGS",
|
||||
"MFLAGS",
|
||||
"CORECLR_PROFILER_PATH",
|
||||
"PHPRC",
|
||||
"PHP_INI_SCAN_DIR",
|
||||
@@ -141,9 +134,7 @@ enum HostEnvSecurityPolicy {
|
||||
"GOPRIVATE",
|
||||
"GOENV",
|
||||
"GOPATH",
|
||||
"HGRCPATH",
|
||||
"PYTHONUSERBASE",
|
||||
"RUSTC_WRAPPER",
|
||||
"VIRTUAL_ENV",
|
||||
"LUA_PATH",
|
||||
"LUA_CPATH",
|
||||
@@ -151,7 +142,6 @@ enum HostEnvSecurityPolicy {
|
||||
"GEM_PATH",
|
||||
"BUNDLE_GEMFILE",
|
||||
"COMPOSER_HOME",
|
||||
"CARGO_BUILD_RUSTC_WRAPPER",
|
||||
"XDG_CONFIG_HOME",
|
||||
"AWS_CONFIG_FILE"
|
||||
]
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2026.4.6</string>
|
||||
<string>2026.4.5</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2026040601</string>
|
||||
<string>2026040501</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>OpenClaw</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
||||
@@ -1327,236 +1327,6 @@ public struct SessionsResolveParams: Codable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionCompactionCheckpoint: Codable, Sendable {
|
||||
public let checkpointid: String
|
||||
public let sessionkey: String
|
||||
public let sessionid: String
|
||||
public let createdat: Int
|
||||
public let reason: AnyCodable
|
||||
public let tokensbefore: Int?
|
||||
public let tokensafter: Int?
|
||||
public let summary: String?
|
||||
public let firstkeptentryid: String?
|
||||
public let precompaction: [String: AnyCodable]
|
||||
public let postcompaction: [String: AnyCodable]
|
||||
|
||||
public init(
|
||||
checkpointid: String,
|
||||
sessionkey: String,
|
||||
sessionid: String,
|
||||
createdat: Int,
|
||||
reason: AnyCodable,
|
||||
tokensbefore: Int?,
|
||||
tokensafter: Int?,
|
||||
summary: String?,
|
||||
firstkeptentryid: String?,
|
||||
precompaction: [String: AnyCodable],
|
||||
postcompaction: [String: AnyCodable])
|
||||
{
|
||||
self.checkpointid = checkpointid
|
||||
self.sessionkey = sessionkey
|
||||
self.sessionid = sessionid
|
||||
self.createdat = createdat
|
||||
self.reason = reason
|
||||
self.tokensbefore = tokensbefore
|
||||
self.tokensafter = tokensafter
|
||||
self.summary = summary
|
||||
self.firstkeptentryid = firstkeptentryid
|
||||
self.precompaction = precompaction
|
||||
self.postcompaction = postcompaction
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case checkpointid = "checkpointId"
|
||||
case sessionkey = "sessionKey"
|
||||
case sessionid = "sessionId"
|
||||
case createdat = "createdAt"
|
||||
case reason
|
||||
case tokensbefore = "tokensBefore"
|
||||
case tokensafter = "tokensAfter"
|
||||
case summary
|
||||
case firstkeptentryid = "firstKeptEntryId"
|
||||
case precompaction = "preCompaction"
|
||||
case postcompaction = "postCompaction"
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionListParams: Codable, Sendable {
|
||||
public let key: String
|
||||
|
||||
public init(
|
||||
key: String)
|
||||
{
|
||||
self.key = key
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case key
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionGetParams: Codable, Sendable {
|
||||
public let key: String
|
||||
public let checkpointid: String
|
||||
|
||||
public init(
|
||||
key: String,
|
||||
checkpointid: String)
|
||||
{
|
||||
self.key = key
|
||||
self.checkpointid = checkpointid
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case key
|
||||
case checkpointid = "checkpointId"
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionBranchParams: Codable, Sendable {
|
||||
public let key: String
|
||||
public let checkpointid: String
|
||||
|
||||
public init(
|
||||
key: String,
|
||||
checkpointid: String)
|
||||
{
|
||||
self.key = key
|
||||
self.checkpointid = checkpointid
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case key
|
||||
case checkpointid = "checkpointId"
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionRestoreParams: Codable, Sendable {
|
||||
public let key: String
|
||||
public let checkpointid: String
|
||||
|
||||
public init(
|
||||
key: String,
|
||||
checkpointid: String)
|
||||
{
|
||||
self.key = key
|
||||
self.checkpointid = checkpointid
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case key
|
||||
case checkpointid = "checkpointId"
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionListResult: Codable, Sendable {
|
||||
public let ok: Bool
|
||||
public let key: String
|
||||
public let checkpoints: [SessionCompactionCheckpoint]
|
||||
|
||||
public init(
|
||||
ok: Bool,
|
||||
key: String,
|
||||
checkpoints: [SessionCompactionCheckpoint])
|
||||
{
|
||||
self.ok = ok
|
||||
self.key = key
|
||||
self.checkpoints = checkpoints
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case ok
|
||||
case key
|
||||
case checkpoints
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionGetResult: Codable, Sendable {
|
||||
public let ok: Bool
|
||||
public let key: String
|
||||
public let checkpoint: SessionCompactionCheckpoint
|
||||
|
||||
public init(
|
||||
ok: Bool,
|
||||
key: String,
|
||||
checkpoint: SessionCompactionCheckpoint)
|
||||
{
|
||||
self.ok = ok
|
||||
self.key = key
|
||||
self.checkpoint = checkpoint
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case ok
|
||||
case key
|
||||
case checkpoint
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionBranchResult: Codable, Sendable {
|
||||
public let ok: Bool
|
||||
public let sourcekey: String
|
||||
public let key: String
|
||||
public let sessionid: String
|
||||
public let checkpoint: SessionCompactionCheckpoint
|
||||
public let entry: [String: AnyCodable]
|
||||
|
||||
public init(
|
||||
ok: Bool,
|
||||
sourcekey: String,
|
||||
key: String,
|
||||
sessionid: String,
|
||||
checkpoint: SessionCompactionCheckpoint,
|
||||
entry: [String: AnyCodable])
|
||||
{
|
||||
self.ok = ok
|
||||
self.sourcekey = sourcekey
|
||||
self.key = key
|
||||
self.sessionid = sessionid
|
||||
self.checkpoint = checkpoint
|
||||
self.entry = entry
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case ok
|
||||
case sourcekey = "sourceKey"
|
||||
case key
|
||||
case sessionid = "sessionId"
|
||||
case checkpoint
|
||||
case entry
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionRestoreResult: Codable, Sendable {
|
||||
public let ok: Bool
|
||||
public let key: String
|
||||
public let sessionid: String
|
||||
public let checkpoint: SessionCompactionCheckpoint
|
||||
public let entry: [String: AnyCodable]
|
||||
|
||||
public init(
|
||||
ok: Bool,
|
||||
key: String,
|
||||
sessionid: String,
|
||||
checkpoint: SessionCompactionCheckpoint,
|
||||
entry: [String: AnyCodable])
|
||||
{
|
||||
self.ok = ok
|
||||
self.key = key
|
||||
self.sessionid = sessionid
|
||||
self.checkpoint = checkpoint
|
||||
self.entry = entry
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case ok
|
||||
case key
|
||||
case sessionid = "sessionId"
|
||||
case checkpoint
|
||||
case entry
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCreateParams: Codable, Sendable {
|
||||
public let key: String?
|
||||
public let agentid: String?
|
||||
@@ -3649,20 +3419,6 @@ public struct ExecApprovalsSnapshot: Codable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct ExecApprovalGetParams: Codable, Sendable {
|
||||
public let id: String
|
||||
|
||||
public init(
|
||||
id: String)
|
||||
{
|
||||
self.id = id
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
}
|
||||
}
|
||||
|
||||
public struct ExecApprovalRequestParams: Codable, Sendable {
|
||||
public let id: String?
|
||||
public let command: String?
|
||||
|
||||
@@ -30,17 +30,6 @@ struct GatewayEnvironmentTests {
|
||||
#expect(Semver.parse(normalized) == Semver(major: 2026, minor: 3, patch: 23))
|
||||
}
|
||||
|
||||
@Test func `gateway version output strips trailing commit hash`() {
|
||||
let normalized = GatewayEnvironment.normalizeGatewayVersionOutput("OpenClaw 2026.4.2 (d74a122)")
|
||||
#expect(normalized == "2026.4.2")
|
||||
#expect(Semver.parse(normalized) == Semver(major: 2026, minor: 4, patch: 2))
|
||||
|
||||
// Pre-release suffix + commit hash combined
|
||||
let normalized2 = GatewayEnvironment.normalizeGatewayVersionOutput("OpenClaw 2026.4.2-1 (d74a122)")
|
||||
#expect(normalized2 == "2026.4.2-1")
|
||||
#expect(Semver.parse(normalized2) == Semver(major: 2026, minor: 4, patch: 2))
|
||||
}
|
||||
|
||||
@Test func `semver compatibility requires same major and not older`() {
|
||||
let required = Semver(major: 2, minor: 1, patch: 0)
|
||||
#expect(Semver(major: 2, minor: 1, patch: 0).compatible(with: required))
|
||||
|
||||
@@ -1030,29 +1030,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"music_generate": {
|
||||
"emoji": "🎵",
|
||||
"title": "Music Generation",
|
||||
"actions": {
|
||||
"generate": {
|
||||
"label": "generate",
|
||||
"detailKeys": [
|
||||
"prompt",
|
||||
"model",
|
||||
"durationSeconds",
|
||||
"format",
|
||||
"instrumental"
|
||||
]
|
||||
},
|
||||
"list": {
|
||||
"label": "list",
|
||||
"detailKeys": [
|
||||
"provider",
|
||||
"model"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"video_generate": {
|
||||
"emoji": "🎬",
|
||||
"title": "Video Generation",
|
||||
|
||||
@@ -5,36 +5,12 @@ public enum OpenClawWatchCommand: String, Codable, Sendable {
|
||||
case notify = "watch.notify"
|
||||
}
|
||||
|
||||
public enum OpenClawWatchPayloadType: String, Codable, Sendable, Equatable {
|
||||
case notify = "watch.notify"
|
||||
case reply = "watch.reply"
|
||||
case execApprovalPrompt = "watch.execApproval.prompt"
|
||||
case execApprovalResolve = "watch.execApproval.resolve"
|
||||
case execApprovalResolved = "watch.execApproval.resolved"
|
||||
case execApprovalExpired = "watch.execApproval.expired"
|
||||
case execApprovalSnapshot = "watch.execApproval.snapshot"
|
||||
case execApprovalSnapshotRequest = "watch.execApproval.snapshotRequest"
|
||||
}
|
||||
|
||||
public enum OpenClawWatchRisk: String, Codable, Sendable, Equatable {
|
||||
case low
|
||||
case medium
|
||||
case high
|
||||
}
|
||||
|
||||
public enum OpenClawWatchExecApprovalDecision: String, Codable, Sendable, Equatable {
|
||||
case allowOnce = "allow-once"
|
||||
case deny
|
||||
}
|
||||
|
||||
public enum OpenClawWatchExecApprovalCloseReason: String, Codable, Sendable, Equatable {
|
||||
case expired
|
||||
case notFound = "not-found"
|
||||
case unavailable
|
||||
case replaced
|
||||
case resolved
|
||||
}
|
||||
|
||||
public struct OpenClawWatchAction: Codable, Sendable, Equatable {
|
||||
public var id: String
|
||||
public var label: String
|
||||
@@ -47,151 +23,6 @@ public struct OpenClawWatchAction: Codable, Sendable, Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct OpenClawWatchExecApprovalItem: Codable, Sendable, Equatable, Identifiable {
|
||||
public var id: String
|
||||
public var commandText: String
|
||||
public var commandPreview: String?
|
||||
public var host: String?
|
||||
public var nodeId: String?
|
||||
public var agentId: String?
|
||||
public var expiresAtMs: Int?
|
||||
public var allowedDecisions: [OpenClawWatchExecApprovalDecision]
|
||||
public var risk: OpenClawWatchRisk?
|
||||
|
||||
public init(
|
||||
id: String,
|
||||
commandText: String,
|
||||
commandPreview: String? = nil,
|
||||
host: String? = nil,
|
||||
nodeId: String? = nil,
|
||||
agentId: String? = nil,
|
||||
expiresAtMs: Int? = nil,
|
||||
allowedDecisions: [OpenClawWatchExecApprovalDecision] = [],
|
||||
risk: OpenClawWatchRisk? = nil)
|
||||
{
|
||||
self.id = id
|
||||
self.commandText = commandText
|
||||
self.commandPreview = commandPreview
|
||||
self.host = host
|
||||
self.nodeId = nodeId
|
||||
self.agentId = agentId
|
||||
self.expiresAtMs = expiresAtMs
|
||||
self.allowedDecisions = allowedDecisions
|
||||
self.risk = risk
|
||||
}
|
||||
}
|
||||
|
||||
public struct OpenClawWatchExecApprovalPromptMessage: Codable, Sendable, Equatable {
|
||||
public var type: OpenClawWatchPayloadType
|
||||
public var approval: OpenClawWatchExecApprovalItem
|
||||
public var sentAtMs: Int?
|
||||
public var deliveryId: String?
|
||||
public var resetResolvingState: Bool?
|
||||
|
||||
public init(
|
||||
approval: OpenClawWatchExecApprovalItem,
|
||||
sentAtMs: Int? = nil,
|
||||
deliveryId: String? = nil,
|
||||
resetResolvingState: Bool? = nil)
|
||||
{
|
||||
self.type = .execApprovalPrompt
|
||||
self.approval = approval
|
||||
self.sentAtMs = sentAtMs
|
||||
self.deliveryId = deliveryId
|
||||
self.resetResolvingState = resetResolvingState
|
||||
}
|
||||
}
|
||||
|
||||
public struct OpenClawWatchExecApprovalResolveMessage: Codable, Sendable, Equatable {
|
||||
public var type: OpenClawWatchPayloadType
|
||||
public var approvalId: String
|
||||
public var decision: OpenClawWatchExecApprovalDecision
|
||||
public var replyId: String
|
||||
public var sentAtMs: Int?
|
||||
|
||||
public init(
|
||||
approvalId: String,
|
||||
decision: OpenClawWatchExecApprovalDecision,
|
||||
replyId: String,
|
||||
sentAtMs: Int? = nil)
|
||||
{
|
||||
self.type = .execApprovalResolve
|
||||
self.approvalId = approvalId
|
||||
self.decision = decision
|
||||
self.replyId = replyId
|
||||
self.sentAtMs = sentAtMs
|
||||
}
|
||||
}
|
||||
|
||||
public struct OpenClawWatchExecApprovalResolvedMessage: Codable, Sendable, Equatable {
|
||||
public var type: OpenClawWatchPayloadType
|
||||
public var approvalId: String
|
||||
public var decision: OpenClawWatchExecApprovalDecision?
|
||||
public var resolvedAtMs: Int?
|
||||
public var source: String?
|
||||
|
||||
public init(
|
||||
approvalId: String,
|
||||
decision: OpenClawWatchExecApprovalDecision? = nil,
|
||||
resolvedAtMs: Int? = nil,
|
||||
source: String? = nil)
|
||||
{
|
||||
self.type = .execApprovalResolved
|
||||
self.approvalId = approvalId
|
||||
self.decision = decision
|
||||
self.resolvedAtMs = resolvedAtMs
|
||||
self.source = source
|
||||
}
|
||||
}
|
||||
|
||||
public struct OpenClawWatchExecApprovalExpiredMessage: Codable, Sendable, Equatable {
|
||||
public var type: OpenClawWatchPayloadType
|
||||
public var approvalId: String
|
||||
public var reason: OpenClawWatchExecApprovalCloseReason
|
||||
public var expiredAtMs: Int?
|
||||
|
||||
public init(
|
||||
approvalId: String,
|
||||
reason: OpenClawWatchExecApprovalCloseReason,
|
||||
expiredAtMs: Int? = nil)
|
||||
{
|
||||
self.type = .execApprovalExpired
|
||||
self.approvalId = approvalId
|
||||
self.reason = reason
|
||||
self.expiredAtMs = expiredAtMs
|
||||
}
|
||||
}
|
||||
|
||||
public struct OpenClawWatchExecApprovalSnapshotMessage: Codable, Sendable, Equatable {
|
||||
public var type: OpenClawWatchPayloadType
|
||||
public var approvals: [OpenClawWatchExecApprovalItem]
|
||||
public var sentAtMs: Int?
|
||||
public var snapshotId: String?
|
||||
|
||||
public init(
|
||||
approvals: [OpenClawWatchExecApprovalItem],
|
||||
sentAtMs: Int? = nil,
|
||||
snapshotId: String? = nil)
|
||||
{
|
||||
self.type = .execApprovalSnapshot
|
||||
self.approvals = approvals
|
||||
self.sentAtMs = sentAtMs
|
||||
self.snapshotId = snapshotId
|
||||
}
|
||||
}
|
||||
|
||||
public struct OpenClawWatchExecApprovalSnapshotRequestMessage: Codable, Sendable, Equatable {
|
||||
public var type: OpenClawWatchPayloadType
|
||||
public var requestId: String
|
||||
public var sentAtMs: Int?
|
||||
|
||||
public init(requestId: String, sentAtMs: Int? = nil) {
|
||||
self.type = .execApprovalSnapshotRequest
|
||||
self.requestId = requestId
|
||||
self.sentAtMs = sentAtMs
|
||||
}
|
||||
}
|
||||
|
||||
public struct OpenClawWatchStatusPayload: Codable, Sendable, Equatable {
|
||||
public var supported: Bool
|
||||
public var paired: Bool
|
||||
|
||||
@@ -1327,236 +1327,6 @@ public struct SessionsResolveParams: Codable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionCompactionCheckpoint: Codable, Sendable {
|
||||
public let checkpointid: String
|
||||
public let sessionkey: String
|
||||
public let sessionid: String
|
||||
public let createdat: Int
|
||||
public let reason: AnyCodable
|
||||
public let tokensbefore: Int?
|
||||
public let tokensafter: Int?
|
||||
public let summary: String?
|
||||
public let firstkeptentryid: String?
|
||||
public let precompaction: [String: AnyCodable]
|
||||
public let postcompaction: [String: AnyCodable]
|
||||
|
||||
public init(
|
||||
checkpointid: String,
|
||||
sessionkey: String,
|
||||
sessionid: String,
|
||||
createdat: Int,
|
||||
reason: AnyCodable,
|
||||
tokensbefore: Int?,
|
||||
tokensafter: Int?,
|
||||
summary: String?,
|
||||
firstkeptentryid: String?,
|
||||
precompaction: [String: AnyCodable],
|
||||
postcompaction: [String: AnyCodable])
|
||||
{
|
||||
self.checkpointid = checkpointid
|
||||
self.sessionkey = sessionkey
|
||||
self.sessionid = sessionid
|
||||
self.createdat = createdat
|
||||
self.reason = reason
|
||||
self.tokensbefore = tokensbefore
|
||||
self.tokensafter = tokensafter
|
||||
self.summary = summary
|
||||
self.firstkeptentryid = firstkeptentryid
|
||||
self.precompaction = precompaction
|
||||
self.postcompaction = postcompaction
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case checkpointid = "checkpointId"
|
||||
case sessionkey = "sessionKey"
|
||||
case sessionid = "sessionId"
|
||||
case createdat = "createdAt"
|
||||
case reason
|
||||
case tokensbefore = "tokensBefore"
|
||||
case tokensafter = "tokensAfter"
|
||||
case summary
|
||||
case firstkeptentryid = "firstKeptEntryId"
|
||||
case precompaction = "preCompaction"
|
||||
case postcompaction = "postCompaction"
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionListParams: Codable, Sendable {
|
||||
public let key: String
|
||||
|
||||
public init(
|
||||
key: String)
|
||||
{
|
||||
self.key = key
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case key
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionGetParams: Codable, Sendable {
|
||||
public let key: String
|
||||
public let checkpointid: String
|
||||
|
||||
public init(
|
||||
key: String,
|
||||
checkpointid: String)
|
||||
{
|
||||
self.key = key
|
||||
self.checkpointid = checkpointid
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case key
|
||||
case checkpointid = "checkpointId"
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionBranchParams: Codable, Sendable {
|
||||
public let key: String
|
||||
public let checkpointid: String
|
||||
|
||||
public init(
|
||||
key: String,
|
||||
checkpointid: String)
|
||||
{
|
||||
self.key = key
|
||||
self.checkpointid = checkpointid
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case key
|
||||
case checkpointid = "checkpointId"
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionRestoreParams: Codable, Sendable {
|
||||
public let key: String
|
||||
public let checkpointid: String
|
||||
|
||||
public init(
|
||||
key: String,
|
||||
checkpointid: String)
|
||||
{
|
||||
self.key = key
|
||||
self.checkpointid = checkpointid
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case key
|
||||
case checkpointid = "checkpointId"
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionListResult: Codable, Sendable {
|
||||
public let ok: Bool
|
||||
public let key: String
|
||||
public let checkpoints: [SessionCompactionCheckpoint]
|
||||
|
||||
public init(
|
||||
ok: Bool,
|
||||
key: String,
|
||||
checkpoints: [SessionCompactionCheckpoint])
|
||||
{
|
||||
self.ok = ok
|
||||
self.key = key
|
||||
self.checkpoints = checkpoints
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case ok
|
||||
case key
|
||||
case checkpoints
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionGetResult: Codable, Sendable {
|
||||
public let ok: Bool
|
||||
public let key: String
|
||||
public let checkpoint: SessionCompactionCheckpoint
|
||||
|
||||
public init(
|
||||
ok: Bool,
|
||||
key: String,
|
||||
checkpoint: SessionCompactionCheckpoint)
|
||||
{
|
||||
self.ok = ok
|
||||
self.key = key
|
||||
self.checkpoint = checkpoint
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case ok
|
||||
case key
|
||||
case checkpoint
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionBranchResult: Codable, Sendable {
|
||||
public let ok: Bool
|
||||
public let sourcekey: String
|
||||
public let key: String
|
||||
public let sessionid: String
|
||||
public let checkpoint: SessionCompactionCheckpoint
|
||||
public let entry: [String: AnyCodable]
|
||||
|
||||
public init(
|
||||
ok: Bool,
|
||||
sourcekey: String,
|
||||
key: String,
|
||||
sessionid: String,
|
||||
checkpoint: SessionCompactionCheckpoint,
|
||||
entry: [String: AnyCodable])
|
||||
{
|
||||
self.ok = ok
|
||||
self.sourcekey = sourcekey
|
||||
self.key = key
|
||||
self.sessionid = sessionid
|
||||
self.checkpoint = checkpoint
|
||||
self.entry = entry
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case ok
|
||||
case sourcekey = "sourceKey"
|
||||
case key
|
||||
case sessionid = "sessionId"
|
||||
case checkpoint
|
||||
case entry
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCompactionRestoreResult: Codable, Sendable {
|
||||
public let ok: Bool
|
||||
public let key: String
|
||||
public let sessionid: String
|
||||
public let checkpoint: SessionCompactionCheckpoint
|
||||
public let entry: [String: AnyCodable]
|
||||
|
||||
public init(
|
||||
ok: Bool,
|
||||
key: String,
|
||||
sessionid: String,
|
||||
checkpoint: SessionCompactionCheckpoint,
|
||||
entry: [String: AnyCodable])
|
||||
{
|
||||
self.ok = ok
|
||||
self.key = key
|
||||
self.sessionid = sessionid
|
||||
self.checkpoint = checkpoint
|
||||
self.entry = entry
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case ok
|
||||
case key
|
||||
case sessionid = "sessionId"
|
||||
case checkpoint
|
||||
case entry
|
||||
}
|
||||
}
|
||||
|
||||
public struct SessionsCreateParams: Codable, Sendable {
|
||||
public let key: String?
|
||||
public let agentid: String?
|
||||
@@ -3649,20 +3419,6 @@ public struct ExecApprovalsSnapshot: Codable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
public struct ExecApprovalGetParams: Codable, Sendable {
|
||||
public let id: String
|
||||
|
||||
public init(
|
||||
id: String)
|
||||
{
|
||||
self.id = id
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
}
|
||||
}
|
||||
|
||||
public struct ExecApprovalRequestParams: Codable, Sendable {
|
||||
public let id: String?
|
||||
public let command: String?
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
64ff922efc6146d867f3858141772094a8a72cba99a8fd61878551175dd8c822 config-baseline.json
|
||||
5d0ce975352ff2b03077f6d71e9fe99ab0f0b118da0f72d47dc989c83f13d668 config-baseline.core.json
|
||||
d22f4414b79ee03d896e58d875c80523bcc12303cbacb1700261e6ec73945187 config-baseline.channel.json
|
||||
1891bcb68d80ab8b7546a2946b5a9d82b18c3e92ffd2c834d15928e73fa11564 config-baseline.plugin.json
|
||||
0135fa04d71f209a54b076f41a3f6cb9795c9169fa631364fb3561eb5ff89891 config-baseline.json
|
||||
0e93c22a45545e13c74647f4945e9d8540d359640ed8c364b0f2514c9dc7a66c config-baseline.core.json
|
||||
ae67508350baf891b902348d55fada6c17e9c053adf53aaf3a8b92cd364ef3f1 config-baseline.channel.json
|
||||
d972a11d0f86080a722bddfe48990dd1b8fa16eb8e157e83f49bd46a5941c512 config-baseline.plugin.json
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
3d483bffbe5abb831df3b1efdf40e1ae0d22d644853a7629ecdaa6d535386ee6 plugin-sdk-api-baseline.json
|
||||
eebeff7cc3ca490d3cae268ea97c5968f37f50fe1a9c7eabeeab85a4ae66a9d9 plugin-sdk-api-baseline.jsonl
|
||||
97509287d728c8f5d1736f7ea07521451ada4b9d7ef56555dbe860a89e1b6e08 plugin-sdk-api-baseline.json
|
||||
a22b3d427953cc8394b28c87ef7a992d2eb4f2c9f6a76fa58b33079e2306661b plugin-sdk-api-baseline.jsonl
|
||||
|
||||
@@ -77,14 +77,9 @@ openclaw tasks flow cancel <lookup>
|
||||
| Subagent orchestration | `subagent` | Spawning a subagent via `sessions_spawn` | `done_only` |
|
||||
| Cron jobs (all types) | `cron` | Every cron execution (main-session and isolated) | `silent` |
|
||||
| CLI operations | `cli` | `openclaw agent` commands that run through the gateway | `silent` |
|
||||
| Agent media jobs | `cli` | Session-backed `video_generate` runs | `silent` |
|
||||
|
||||
Main-session cron tasks use `silent` notify policy by default — they create records for tracking but do not generate notifications. Isolated cron tasks also default to `silent` but are more visible because they run in their own session.
|
||||
|
||||
Session-backed `video_generate` runs also use `silent` notify policy. They still create task records, but completion is handed back to the original agent session as an internal wake so the agent can write the follow-up message and attach the finished video itself. If you opt into `tools.media.asyncCompletion.directSend`, async `music_generate` and `video_generate` completions try direct channel delivery first before falling back to the requester-session wake path.
|
||||
|
||||
While a session-backed `video_generate` task is still active, the tool also acts as a guardrail: repeated `video_generate` calls in that same session return the active task status instead of starting a second concurrent generation. Use `action: "status"` when you want an explicit progress/status lookup from the agent side.
|
||||
|
||||
**What does not create tasks:**
|
||||
|
||||
- Heartbeat turns — main-session; see [Heartbeat](/gateway/heartbeat)
|
||||
|
||||
@@ -1237,7 +1237,7 @@ High-signal Discord fields:
|
||||
- delivery: `textChunkLimit`, `chunkMode`, `maxLinesPerMessage`
|
||||
- streaming: `streaming` (legacy alias: `streamMode`), `draftChunk`, `blockStreaming`, `blockStreamingCoalesce`
|
||||
- media/retry: `mediaMaxMb`, `retry`
|
||||
- `mediaMaxMb` caps outbound Discord uploads (default: `100MB`)
|
||||
- `mediaMaxMb` caps outbound Discord uploads (default: `8MB`)
|
||||
- actions: `actions.*`
|
||||
- presence: `activity`, `status`, `activityType`, `activityUrl`
|
||||
- UI: `ui.components.accentColor`
|
||||
|
||||
@@ -190,8 +190,8 @@ Control how group/room messages are handled per channel:
|
||||
groupPolicy: "allowlist",
|
||||
groupAllowFrom: ["@owner:example.org"],
|
||||
groups: {
|
||||
"!roomId:example.org": { enabled: true },
|
||||
"#alias:example.org": { enabled: true },
|
||||
"!roomId:example.org": { allow: true },
|
||||
"#alias:example.org": { allow: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -227,10 +227,7 @@ Quick mental model (evaluation order for group messages):
|
||||
|
||||
Group messages require a mention unless overridden per group. Defaults live per subsystem under `*.groups."*"`.
|
||||
|
||||
Replying to a bot message counts as an implicit mention when the channel
|
||||
supports reply metadata. Quoting a bot message can also count as an implicit
|
||||
mention on channels that expose quote metadata. Current built-in cases include
|
||||
Telegram, WhatsApp, Slack, Discord, Microsoft Teams, and ZaloUser.
|
||||
Replying to a bot message counts as an implicit mention (when the channel supports reply metadata). This applies to Telegram, WhatsApp, Slack, Discord, and Microsoft Teams.
|
||||
|
||||
```json5
|
||||
{
|
||||
|
||||
@@ -44,7 +44,6 @@ See [Plugins](/tools/plugin) for plugin behavior and install rules.
|
||||
- `homeserver` + `userId` + `password`.
|
||||
4. Restart the gateway.
|
||||
5. Start a DM with the bot or invite it to a room.
|
||||
- Fresh Matrix invites only work when `channels.matrix.autoJoin` allows them.
|
||||
|
||||
Interactive setup paths:
|
||||
|
||||
@@ -61,60 +60,16 @@ What the Matrix wizard actually asks for:
|
||||
- optional device name
|
||||
- whether to enable E2EE
|
||||
- whether to configure Matrix room access now
|
||||
- whether to configure Matrix invite auto-join now
|
||||
- when invite auto-join is enabled, whether it should be `allowlist`, `always`, or `off`
|
||||
|
||||
Wizard behavior that matters:
|
||||
|
||||
- If Matrix auth env vars already exist for the selected account, and that account does not already have auth saved in config, the wizard offers an env shortcut so setup can keep auth in env vars instead of copying secrets into config.
|
||||
- If Matrix auth env vars already exist for the selected account, and that account does not already have auth saved in config, the wizard offers an env shortcut and only writes `enabled: true` for that account.
|
||||
- When you add another Matrix account interactively, the entered account name is normalized into the account ID used in config and env vars. For example, `Ops Bot` becomes `ops-bot`.
|
||||
- DM allowlist prompts accept full `@user:server` values immediately. Display names only work when live directory lookup finds one exact match; otherwise the wizard asks you to retry with a full Matrix ID.
|
||||
- Room allowlist prompts accept room IDs and aliases directly. They can also resolve joined-room names live, but unresolved names are only kept as typed during setup and are ignored later by runtime allowlist resolution. Prefer `!room:server` or `#alias:server`.
|
||||
- The wizard now shows an explicit warning before the invite auto-join step because `channels.matrix.autoJoin` defaults to `off`; agents will not join invited rooms or fresh DM-style invites unless you set it.
|
||||
- In invite auto-join allowlist mode, use only stable invite targets: `!roomId:server`, `#alias:server`, or `*`. Plain room names are rejected.
|
||||
- Runtime room/session identity uses the stable Matrix room ID. Room-declared aliases are only used as lookup inputs, not as the long-term session key or stable group identity.
|
||||
- To resolve room names before saving them, use `openclaw channels resolve --channel matrix "Project Room"`.
|
||||
|
||||
<Warning>
|
||||
`channels.matrix.autoJoin` defaults to `off`.
|
||||
|
||||
If you leave it unset, the bot will not join invited rooms or fresh DM-style invites, so it will not appear in new groups or invited DMs unless you join manually first.
|
||||
|
||||
Set `autoJoin: "allowlist"` together with `autoJoinAllowlist` to restrict which invites it accepts, or set `autoJoin: "always"` if you want it to join every invite.
|
||||
|
||||
In `allowlist` mode, `autoJoinAllowlist` only accepts `!roomId:server`, `#alias:server`, or `*`.
|
||||
</Warning>
|
||||
|
||||
Allowlist example:
|
||||
|
||||
```json5
|
||||
{
|
||||
channels: {
|
||||
matrix: {
|
||||
autoJoin: "allowlist",
|
||||
autoJoinAllowlist: ["!ops:example.org", "#support:example.org"],
|
||||
groups: {
|
||||
"!ops:example.org": {
|
||||
requireMention: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Join every invite:
|
||||
|
||||
```json5
|
||||
{
|
||||
channels: {
|
||||
matrix: {
|
||||
autoJoin: "always",
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Minimal token-based setup:
|
||||
|
||||
```json5
|
||||
@@ -148,7 +103,6 @@ Password-based setup (token is cached after login):
|
||||
|
||||
Matrix stores cached credentials in `~/.openclaw/credentials/matrix/`.
|
||||
The default account uses `credentials.json`; named accounts use `credentials-<account>.json`.
|
||||
When cached credentials exist there, OpenClaw treats Matrix as configured for setup, doctor, and channel-status discovery even if current auth is not set directly in config.
|
||||
|
||||
Environment variable equivalents (used when the config key is not set):
|
||||
|
||||
@@ -220,13 +174,6 @@ This is a practical baseline config with DM pairing, room allowlist, and E2EE en
|
||||
}
|
||||
```
|
||||
|
||||
`autoJoin` applies to Matrix invites in general, not only room/group invites.
|
||||
That includes fresh DM-style invites. At invite time, OpenClaw does not reliably know whether the
|
||||
invited room will end up being treated as a DM or a group, so all invites go through the same
|
||||
`autoJoin` decision first. `dm.policy` still applies after the bot has joined and the room is
|
||||
classified as a DM, so `autoJoin` controls join behavior while `dm.policy` controls reply/access
|
||||
behavior.
|
||||
|
||||
## Streaming previews
|
||||
|
||||
Matrix reply streaming is opt-in.
|
||||
@@ -333,7 +280,7 @@ OpenClaw marks finalized text-only preview edits with:
|
||||
|
||||
```bash
|
||||
curl -sS -X PUT \
|
||||
"https://matrix.example.org/_matrix/client/v3/pushrules/global/override/openclaw-finalized-preview-botname" \
|
||||
"https://matrix.example.org/_matrix/client/v3/pushrules/global/override/openclaw-finalized-preview" \
|
||||
-H "Authorization: Bearer $USER_ACCESS_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{
|
||||
@@ -363,15 +310,8 @@ Replace these values before you run the command:
|
||||
|
||||
- `https://matrix.example.org`: your homeserver base URL
|
||||
- `$USER_ACCESS_TOKEN`: the receiving user's access token
|
||||
- `openclaw-finalized-preview-botname`: a rule ID unique to this bot for this receiving user
|
||||
- `@bot:example.org`: your OpenClaw Matrix bot MXID, not the receiving user's MXID
|
||||
|
||||
Important for multi-bot setups:
|
||||
|
||||
- Push rules are keyed by `ruleId`. Re-running `PUT` against the same rule ID updates that one rule.
|
||||
- If one receiving user should notify for multiple OpenClaw Matrix bot accounts, create one rule per bot with a unique rule ID for each sender match.
|
||||
- A simple pattern is `openclaw-finalized-preview-<botname>`, such as `openclaw-finalized-preview-ops` or `openclaw-finalized-preview-support`.
|
||||
|
||||
The rule is evaluated against the event sender:
|
||||
|
||||
- authenticate with the receiving user's token
|
||||
@@ -382,20 +322,12 @@ The rule is evaluated against the event sender:
|
||||
```bash
|
||||
curl -sS \
|
||||
-H "Authorization: Bearer $USER_ACCESS_TOKEN" \
|
||||
"https://matrix.example.org/_matrix/client/v3/pushrules/global/override/openclaw-finalized-preview-botname"
|
||||
"https://matrix.example.org/_matrix/client/v3/pushrules/global/override/openclaw-finalized-preview"
|
||||
```
|
||||
|
||||
7. Test a streamed reply. In quiet mode, the room should show a quiet draft preview and the final
|
||||
in-place edit should notify once the block or turn finishes.
|
||||
|
||||
If you need to remove the rule later, delete that same rule ID with the receiving user's token:
|
||||
|
||||
```bash
|
||||
curl -sS -X DELETE \
|
||||
-H "Authorization: Bearer $USER_ACCESS_TOKEN" \
|
||||
"https://matrix.example.org/_matrix/client/v3/pushrules/global/override/openclaw-finalized-preview-botname"
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- Create the rule with the receiving user's access token, not the bot's.
|
||||
@@ -825,7 +757,7 @@ Current behavior:
|
||||
## History context
|
||||
|
||||
- `channels.matrix.historyLimit` controls how many recent room messages are included as `InboundHistory` when a Matrix room message triggers the agent.
|
||||
- It falls back to `messages.groupChat.historyLimit`. If both are unset, the effective default is `0`, so mention-gated room messages are not buffered. Set `0` to disable.
|
||||
- It falls back to `messages.groupChat.historyLimit`. Set `0` to disable.
|
||||
- Matrix room history is room-only. DMs keep using normal session history.
|
||||
- Matrix room history is pending-only: OpenClaw buffers room messages that did not trigger a reply yet, then snapshots that window when a mention or other trigger arrives.
|
||||
- The current trigger message is not included in `InboundHistory`; it stays in the main inbound body for that turn.
|
||||
@@ -965,16 +897,14 @@ By default, OpenClaw blocks private/internal Matrix homeservers for SSRF protect
|
||||
explicitly opt in per account.
|
||||
|
||||
If your homeserver runs on localhost, a LAN/Tailscale IP, or an internal hostname, enable
|
||||
`network.dangerouslyAllowPrivateNetwork` for that Matrix account:
|
||||
`allowPrivateNetwork` for that Matrix account:
|
||||
|
||||
```json5
|
||||
{
|
||||
channels: {
|
||||
matrix: {
|
||||
homeserver: "http://matrix-synapse:8008",
|
||||
network: {
|
||||
dangerouslyAllowPrivateNetwork: true,
|
||||
},
|
||||
allowPrivateNetwork: true,
|
||||
accessToken: "syt_internal_xxx",
|
||||
},
|
||||
},
|
||||
@@ -1033,7 +963,7 @@ Live directory lookup uses the logged-in Matrix account:
|
||||
- `name`: optional label for the account.
|
||||
- `defaultAccount`: preferred account ID when multiple Matrix accounts are configured.
|
||||
- `homeserver`: homeserver URL, for example `https://matrix.example.org`.
|
||||
- `network.dangerouslyAllowPrivateNetwork`: allow this Matrix account to connect to private/internal homeservers. Enable this when the homeserver resolves to `localhost`, a LAN/Tailscale IP, or an internal host such as `matrix-synapse`.
|
||||
- `allowPrivateNetwork`: allow this Matrix account to connect to private/internal homeservers. Enable this when the homeserver resolves to `localhost`, a LAN/Tailscale IP, or an internal host such as `matrix-synapse`.
|
||||
- `proxy`: optional HTTP(S) proxy URL for Matrix traffic. Named accounts can override the top-level default with their own `proxy`.
|
||||
- `userId`: full Matrix user ID, for example `@bot:example.org`.
|
||||
- `accessToken`: access token for token-based auth. Plaintext values and SecretRef values are supported for `channels.matrix.accessToken` and `channels.matrix.accounts.<id>.accessToken` across env/file/exec providers. See [Secrets Management](/gateway/secrets).
|
||||
@@ -1049,8 +979,8 @@ Live directory lookup uses the logged-in Matrix account:
|
||||
- `contextVisibility`: supplemental room-context visibility mode (`all`, `allowlist`, `allowlist_quote`).
|
||||
- `groupAllowFrom`: allowlist of user IDs for room traffic.
|
||||
- `groupAllowFrom` entries should be full Matrix user IDs. Unresolved names are ignored at runtime.
|
||||
- `historyLimit`: max room messages to include as group history context. Falls back to `messages.groupChat.historyLimit`; if both are unset, the effective default is `0`. Set `0` to disable.
|
||||
- `replyToMode`: `off`, `first`, `all`, or `batched`.
|
||||
- `historyLimit`: max room messages to include as group history context. Falls back to `messages.groupChat.historyLimit`. Set `0` to disable.
|
||||
- `replyToMode`: `off`, `first`, or `all`.
|
||||
- `markdown`: optional Markdown rendering configuration for outbound Matrix text.
|
||||
- `streaming`: `off` (default), `partial`, `quiet`, `true`, or `false`. `partial` and `true` enable preview-first draft updates with normal Matrix text messages. `quiet` uses non-notifying preview notices for self-hosted push-rule setups.
|
||||
- `blockStreaming`: `true` enables separate progress messages for completed assistant blocks while draft preview streaming is active.
|
||||
@@ -1065,10 +995,9 @@ Live directory lookup uses the logged-in Matrix account:
|
||||
- `ackReactionScope`: optional ack reaction scope override (`group-mentions`, `group-all`, `direct`, `all`, `none`, `off`).
|
||||
- `reactionNotifications`: inbound reaction notification mode (`own`, `off`).
|
||||
- `mediaMaxMb`: media size cap in MB for Matrix media handling. It applies to outbound sends and inbound media processing.
|
||||
- `autoJoin`: invite auto-join policy (`always`, `allowlist`, `off`). Default: `off`. This applies to Matrix invites in general, including DM-style invites, not only room/group invites. OpenClaw makes this decision at invite time, before it can reliably classify the joined room as a DM or a group.
|
||||
- `autoJoin`: invite auto-join policy (`always`, `allowlist`, `off`). Default: `off`.
|
||||
- `autoJoinAllowlist`: rooms/aliases allowed when `autoJoin` is `allowlist`. Alias entries are resolved to room IDs during invite handling; OpenClaw does not trust alias state claimed by the invited room.
|
||||
- `dm`: DM policy block (`enabled`, `policy`, `allowFrom`, `sessionScope`, `threadReplies`).
|
||||
- `dm.policy`: controls DM access after OpenClaw has joined the room and classified it as a DM. It does not change whether an invite is auto-joined.
|
||||
- `dm.allowFrom` entries should be full Matrix user IDs unless you already resolved them through live directory lookup.
|
||||
- `dm.sessionScope`: `per-user` (default) or `per-room`. Use `per-room` when you want each Matrix DM room to keep separate context even if the peer is the same.
|
||||
- `dm.threadReplies`: DM-only thread policy override (`off`, `inbound`, `always`). It overrides the top-level `threadReplies` setting for both reply placement and session isolation in DMs.
|
||||
|
||||
@@ -75,13 +75,10 @@ self-check, and writes a Markdown report under `.artifacts/qa-e2e/`.
|
||||
Private debugger UI:
|
||||
|
||||
```bash
|
||||
pnpm qa:lab:up
|
||||
pnpm qa:lab:build
|
||||
pnpm openclaw qa ui
|
||||
```
|
||||
|
||||
That one command builds the QA site, starts the Docker-backed gateway + QA Lab
|
||||
stack, and prints the QA Lab URL. From that site you can pick scenarios, choose
|
||||
the model lane, launch individual runs, and watch results live.
|
||||
|
||||
Full repo-backed QA suite:
|
||||
|
||||
```bash
|
||||
@@ -99,10 +96,10 @@ Current scope is intentionally narrow:
|
||||
- threaded routing grammar
|
||||
- channel-owned message actions
|
||||
- Markdown reporting
|
||||
- Docker-backed QA site with run controls
|
||||
|
||||
Follow-up work will add:
|
||||
|
||||
- Dockerized OpenClaw orchestration
|
||||
- provider/model matrix execution
|
||||
- richer scenario discovery
|
||||
- OpenClaw-native orchestration later
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
summary: "Slack setup and runtime behavior (Socket Mode + HTTP Request URLs)"
|
||||
summary: "Slack setup and runtime behavior (Socket Mode + HTTP Events API)"
|
||||
read_when:
|
||||
- Setting up Slack or debugging Slack socket/HTTP mode
|
||||
title: "Slack"
|
||||
@@ -7,7 +7,7 @@ title: "Slack"
|
||||
|
||||
# Slack
|
||||
|
||||
Status: production-ready for DMs + channels via Slack app integrations. Default mode is Socket Mode; HTTP Request URLs are also supported.
|
||||
Status: production-ready for DMs + channels via Slack app integrations. Default mode is Socket Mode; HTTP Events API mode is also supported.
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Pairing" icon="link" href="/channels/pairing">
|
||||
@@ -26,13 +26,12 @@ Status: production-ready for DMs + channels via Slack app integrations. Default
|
||||
<Tabs>
|
||||
<Tab title="Socket Mode (default)">
|
||||
<Steps>
|
||||
<Step title="Create a new Slack app">
|
||||
In Slack app settings press the **[Create New App](https://api.slack.com/apps/new)** button:
|
||||
<Step title="Create Slack app and tokens">
|
||||
In Slack app settings:
|
||||
|
||||
- choose **from a manifest** and select a workspace for your app
|
||||
- paste the [example manifest](#manifest-and-scope-checklist) from below and continue to create
|
||||
- generate an **App-Level Token** (`xapp-...`) with `connections:write`
|
||||
- install app and copy the **Bot Token** (`xoxb-...`) shown
|
||||
- enable **Socket Mode**
|
||||
- create **App Token** (`xapp-...`) with `connections:write`
|
||||
- install app and copy **Bot Token** (`xoxb-...`)
|
||||
</Step>
|
||||
|
||||
<Step title="Configure OpenClaw">
|
||||
@@ -59,6 +58,19 @@ SLACK_BOT_TOKEN=xoxb-...
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Subscribe app events">
|
||||
Subscribe bot events for:
|
||||
|
||||
- `app_mention`
|
||||
- `message.channels`, `message.groups`, `message.im`, `message.mpim`
|
||||
- `reaction_added`, `reaction_removed`
|
||||
- `member_joined_channel`, `member_left_channel`
|
||||
- `channel_rename`
|
||||
- `pin_added`, `pin_removed`
|
||||
|
||||
Also enable App Home **Messages Tab** for DMs.
|
||||
</Step>
|
||||
|
||||
<Step title="Start gateway">
|
||||
|
||||
```bash
|
||||
@@ -70,19 +82,17 @@ openclaw gateway
|
||||
|
||||
</Tab>
|
||||
|
||||
<Tab title="HTTP Request URLs">
|
||||
<Tab title="HTTP Events API mode">
|
||||
<Steps>
|
||||
<Step title="Create a new Slack app">
|
||||
In Slack app settings press the **[Create New App](https://api.slack.com/apps/new)** button:
|
||||
<Step title="Configure Slack app for HTTP">
|
||||
|
||||
- choose **from a manifest** and select a workspace for your app
|
||||
- paste the [example manifest](#manifest-and-scope-checklist) and update the URLs before create
|
||||
- save the **Signing Secret** for request verification
|
||||
- install app and copy the **Bot Token** (`xoxb-...`) shown
|
||||
- set mode to HTTP (`channels.slack.mode="http"`)
|
||||
- copy Slack **Signing Secret**
|
||||
- set Event Subscriptions + Interactivity + Slash command Request URL to the same webhook path (default `/slack/events`)
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Configure OpenClaw">
|
||||
<Step title="Configure OpenClaw HTTP mode">
|
||||
|
||||
```json5
|
||||
{
|
||||
@@ -98,20 +108,12 @@ openclaw gateway
|
||||
}
|
||||
```
|
||||
|
||||
<Note>
|
||||
Use unique webhook paths for multi-account HTTP
|
||||
|
||||
Give each account a distinct `webhookPath` (default `/slack/events`) so registrations do not collide.
|
||||
</Note>
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Start gateway">
|
||||
|
||||
```bash
|
||||
openclaw gateway
|
||||
```
|
||||
<Step title="Use unique webhook paths for multi-account HTTP">
|
||||
Per-account HTTP mode is supported.
|
||||
|
||||
Give each account a distinct `webhookPath` so registrations do not collide.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
@@ -120,8 +122,8 @@ openclaw gateway
|
||||
|
||||
## Manifest and scope checklist
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Socket Mode (default)">
|
||||
<AccordionGroup>
|
||||
<Accordion title="Slack app manifest example" defaultOpen>
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -196,99 +198,8 @@ openclaw gateway
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
|
||||
<Tab title="HTTP Request URLs">
|
||||
|
||||
```json
|
||||
{
|
||||
"display_information": {
|
||||
"name": "OpenClaw",
|
||||
"description": "Slack connector for OpenClaw"
|
||||
},
|
||||
"features": {
|
||||
"bot_user": {
|
||||
"display_name": "OpenClaw",
|
||||
"always_online": true
|
||||
},
|
||||
"app_home": {
|
||||
"messages_tab_enabled": true,
|
||||
"messages_tab_read_only_enabled": false
|
||||
},
|
||||
"slash_commands": [
|
||||
{
|
||||
"command": "/openclaw",
|
||||
"description": "Send a message to OpenClaw",
|
||||
"should_escape": false,
|
||||
"url": "https://gateway-host.example.com/slack/events"
|
||||
}
|
||||
]
|
||||
},
|
||||
"oauth_config": {
|
||||
"scopes": {
|
||||
"bot": [
|
||||
"app_mentions:read",
|
||||
"assistant:write",
|
||||
"channels:history",
|
||||
"channels:read",
|
||||
"chat:write",
|
||||
"commands",
|
||||
"emoji:read",
|
||||
"files:read",
|
||||
"files:write",
|
||||
"groups:history",
|
||||
"groups:read",
|
||||
"im:history",
|
||||
"im:read",
|
||||
"im:write",
|
||||
"mpim:history",
|
||||
"mpim:read",
|
||||
"mpim:write",
|
||||
"pins:read",
|
||||
"pins:write",
|
||||
"reactions:read",
|
||||
"reactions:write",
|
||||
"users:read"
|
||||
]
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"event_subscriptions": {
|
||||
"request_url": "https://gateway-host.example.com/slack/events",
|
||||
"bot_events": [
|
||||
"app_mention",
|
||||
"channel_rename",
|
||||
"member_joined_channel",
|
||||
"member_left_channel",
|
||||
"message.channels",
|
||||
"message.groups",
|
||||
"message.im",
|
||||
"message.mpim",
|
||||
"pin_added",
|
||||
"pin_removed",
|
||||
"reaction_added",
|
||||
"reaction_removed"
|
||||
]
|
||||
},
|
||||
"interactivity": {
|
||||
"is_enabled": true,
|
||||
"request_url": "https://gateway-host.example.com/slack/events",
|
||||
"message_menu_options_url": "https://gateway-host.example.com/slack/events"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Optional authorship scopes (write operations)">
|
||||
Add the `chat:write.customize` bot scope if you want outgoing messages to use the active agent identity (custom username and icon) instead of the default Slack app identity.
|
||||
|
||||
If you use an emoji icon, Slack expects `:emoji_name:` syntax.
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Optional user-token scopes (read operations)">
|
||||
If you configure `channels.slack.userToken`, typical read scopes are:
|
||||
|
||||
@@ -312,6 +223,7 @@ openclaw gateway
|
||||
- Config tokens override env fallback.
|
||||
- `SLACK_BOT_TOKEN` / `SLACK_APP_TOKEN` env fallback applies only to the default account.
|
||||
- `userToken` (`xoxp-...`) is config-only (no env fallback) and defaults to read-only behavior (`userTokenReadOnly: true`).
|
||||
- Optional: add `chat:write.customize` if you want outgoing messages to use the active agent identity (custom `username` and icon). `icon_emoji` uses `:emoji_name:` syntax.
|
||||
|
||||
Status snapshot behavior:
|
||||
|
||||
@@ -399,7 +311,7 @@ Current Slack message actions include `send`, `upload-file`, `download-file`, `r
|
||||
|
||||
- explicit app mention (`<@botId>`)
|
||||
- mention regex patterns (`agents.list[].groupChat.mentionPatterns`, fallback `messages.groupChat.mentionPatterns`)
|
||||
- implicit reply-to-bot thread behavior (disabled when `thread.requireExplicitMention` is `true`)
|
||||
- implicit reply-to-bot thread behavior
|
||||
|
||||
Per-channel controls (`channels.slack.channels.<id>`; names only via startup resolution or `dangerouslyAllowNameMatching`):
|
||||
|
||||
@@ -423,7 +335,6 @@ Current Slack message actions include `send`, `upload-file`, `download-file`, `r
|
||||
- Thread replies can create thread session suffixes (`:thread:<threadTs>`) when applicable.
|
||||
- `channels.slack.thread.historyScope` default is `thread`; `thread.inheritParent` default is `false`.
|
||||
- `channels.slack.thread.initialHistoryLimit` controls how many existing thread messages are fetched when a new thread session starts (default `20`; set `0` to disable).
|
||||
- `channels.slack.thread.requireExplicitMention` (default `false`): when `true`, suppress implicit thread mentions so the bot only responds to explicit `@bot` mentions inside threads, even when the bot already participated in the thread. Without this, replies in a bot-participated thread bypass `requireMention` gating.
|
||||
|
||||
Reply threading controls:
|
||||
|
||||
|
||||
@@ -145,7 +145,6 @@ OpenClaw recommends running WhatsApp on a separate number when possible. (The ch
|
||||
- Status and broadcast chats are ignored (`@status`, `@broadcast`).
|
||||
- Direct chats use DM session rules (`session.dmScope`; default `main` collapses DMs to the agent main session).
|
||||
- Group sessions are isolated (`agent:<agentId>:whatsapp:group:<jid>`).
|
||||
- WhatsApp Web transport honors standard proxy environment variables on the gateway host (`HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY` / lowercase variants). Prefer host-level proxy config over channel-specific WhatsApp proxy settings.
|
||||
|
||||
## Access control and activation
|
||||
|
||||
|
||||
@@ -124,7 +124,6 @@ Example:
|
||||
- `channels.zalouser.groups.<group>.requireMention` controls whether group replies require a mention.
|
||||
- Resolution order: exact group id/name -> normalized group slug -> `*` -> default (`true`).
|
||||
- This applies both to allowlisted groups and open group mode.
|
||||
- Quoting a bot message counts as an implicit mention for group activation.
|
||||
- Authorized control commands (for example `/new`) can bypass mention gating.
|
||||
- When a group message is skipped because mention is required, OpenClaw stores it as pending group history and includes it on the next processed group message.
|
||||
- Group history limit defaults to `messages.groupChat.historyLimit` (fallback `50`). You can override per account with `channels.zalouser.historyLimit`.
|
||||
|
||||
@@ -57,7 +57,6 @@ Notes:
|
||||
- `--reset`: reset dev config + credentials + sessions + workspace (requires `--dev`).
|
||||
- `--force`: kill any existing listener on the selected port before starting.
|
||||
- `--verbose`: verbose logs.
|
||||
- `--cli-backend-logs`: only show CLI backend logs in the console (and enable stdout/stderr).
|
||||
- `--ws-log <auto|full|compact>`: websocket log style (default `auto`).
|
||||
- `--compact`: alias for `--ws-log compact`.
|
||||
- `--raw-stream`: log raw model stream events to jsonl.
|
||||
|
||||
@@ -501,7 +501,7 @@ Options:
|
||||
`openrouter-api-key`, `kilocode-api-key`, `litellm-api-key`, `ai-gateway-api-key`,
|
||||
`cloudflare-ai-gateway-api-key`, `moonshot-api-key`, `moonshot-api-key-cn`,
|
||||
`kimi-code-api-key`, `synthetic-api-key`, `venice-api-key`, `together-api-key`,
|
||||
`huggingface-api-key`, `apiKey`, `gemini-api-key`, `google-gemini-cli`, `zai-api-key`,
|
||||
`huggingface-api-key`, `apiKey`, `gemini-api-key`, `zai-api-key`,
|
||||
`zai-coding-global`, `zai-coding-cn`, `zai-global`, `zai-cn`, `xiaomi-api-key`,
|
||||
`minimax-global-oauth`, `minimax-global-api`, `minimax-cn-oauth`, `minimax-cn-api`,
|
||||
`opencode-zen`, `opencode-go`, `github-copilot`, `copilot-proxy`, `xai-api-key`,
|
||||
@@ -1353,7 +1353,6 @@ Options:
|
||||
- `--reset` (reset dev config + credentials + sessions + workspace)
|
||||
- `--force` (kill existing listener on port)
|
||||
- `--verbose`
|
||||
- `--cli-backend-logs`
|
||||
- `--ws-log <auto|full|compact>`
|
||||
- `--compact` (alias for `--ws-log compact`)
|
||||
- `--raw-stream`
|
||||
@@ -1478,14 +1477,20 @@ Tip: the owner-only `gateway` runtime tool still refuses to rewrite `tools.exec.
|
||||
|
||||
See [/concepts/models](/concepts/models) for fallback behavior and scanning strategy.
|
||||
|
||||
Anthropic note: Anthropic staff told us OpenClaw-style Claude CLI usage is
|
||||
allowed again, so OpenClaw treats Claude CLI reuse and `claude -p` usage as
|
||||
sanctioned for this integration unless Anthropic publishes a new policy. For
|
||||
production, prefer an Anthropic API key or another supported
|
||||
subscription-style provider such as OpenAI Codex, Alibaba Cloud Model Studio
|
||||
Coding Plan, MiniMax Coding Plan, or Z.AI / GLM Coding Plan.
|
||||
Billing note: for Anthropic in OpenClaw, the practical split is **API key** or
|
||||
**Claude subscription with Extra Usage**. Anthropic notified OpenClaw users on
|
||||
**April 4, 2026 at 12:00 PM PT / 8:00 PM BST** that the **OpenClaw**
|
||||
Claude-login path counts as third-party harness usage and requires
|
||||
**Extra Usage** billed separately from the subscription. Our local repros also
|
||||
show the OpenClaw-identifying prompt string does not reproduce on the
|
||||
Anthropic SDK + API-key path. For production, prefer an Anthropic API key or
|
||||
another supported subscription-style provider such as OpenAI Codex, Alibaba
|
||||
Cloud Model Studio Coding Plan, MiniMax Coding Plan, or Z.AI / GLM Coding
|
||||
Plan.
|
||||
|
||||
Anthropic setup-token remains available as a supported token-auth path, but OpenClaw now prefers Claude CLI reuse and `claude -p` when available.
|
||||
Anthropic setup-token is available again as a legacy/manual auth path.
|
||||
Use it only with the expectation that Anthropic told OpenClaw users the
|
||||
OpenClaw-managed Anthropic subscription path requires **Extra Usage**.
|
||||
|
||||
### `models` (root)
|
||||
|
||||
@@ -1595,7 +1600,7 @@ Notes:
|
||||
- `setup-token` and `paste-token` are generic token commands for providers that expose token auth methods.
|
||||
- `setup-token` requires an interactive TTY and runs the provider's token-auth method.
|
||||
- `paste-token` prompts for the token value and defaults to auth profile id `<provider>:manual` when `--profile-id` is omitted.
|
||||
- Anthropic `setup-token` / `paste-token` remain available as a supported OpenClaw token path, but OpenClaw now prefers Claude CLI reuse and `claude -p` when available.
|
||||
- Anthropic `setup-token` / `paste-token` are available again as a legacy/manual OpenClaw path. Anthropic told OpenClaw users this path requires **Extra Usage** on the Claude account.
|
||||
|
||||
### `models auth order get|set|clear`
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
summary: "CLI reference for `openclaw memory` (status/index/search/promote/promote-explain/rem-harness)"
|
||||
summary: "CLI reference for `openclaw memory` (status/index/search/promote)"
|
||||
read_when:
|
||||
- You want to index or search semantic memory
|
||||
- You’re debugging memory availability or indexing
|
||||
@@ -29,10 +29,6 @@ openclaw memory search --query "deployment" --max-results 20
|
||||
openclaw memory promote --limit 10 --min-score 0.75
|
||||
openclaw memory promote --apply
|
||||
openclaw memory promote --json --min-recall-count 0 --min-unique-queries 0
|
||||
openclaw memory promote-explain "router vlan"
|
||||
openclaw memory promote-explain "router vlan" --json
|
||||
openclaw memory rem-harness
|
||||
openclaw memory rem-harness --json
|
||||
openclaw memory status --json
|
||||
openclaw memory status --deep --index
|
||||
openclaw memory status --deep --index --verbose
|
||||
@@ -82,9 +78,9 @@ openclaw memory promote [--apply] [--limit <n>] [--include-promoted]
|
||||
|
||||
Full options:
|
||||
|
||||
- Ranks short-term candidates from `memory/YYYY-MM-DD.md` using weighted promotion signals (`frequency`, `relevance`, `query diversity`, `recency`, `consolidation`, `conceptual richness`).
|
||||
- Uses short-term signals from both memory recalls and daily-ingestion passes, plus light/REM phase reinforcement signals.
|
||||
- When dreaming is enabled, `memory-core` auto-manages one cron job that runs a full sweep (`light -> REM -> deep`) in the background (no manual `openclaw cron add` required).
|
||||
- Ranks short-term candidates from `memory/YYYY-MM-DD.md` using weighted recall signals (`frequency`, `relevance`, `query diversity`, `recency`).
|
||||
- Uses recall events captured when `memory_search` returns daily-memory hits.
|
||||
- When dreaming is enabled, `memory-core` auto-manages a cron job for the deep phase that triggers promotion in the background (no manual `openclaw cron add` required).
|
||||
- `--agent <id>`: scope to a single agent (default: the default agent).
|
||||
- `--limit <n>`: max candidates to return/apply.
|
||||
- `--min-score <n>`: minimum weighted promotion score.
|
||||
@@ -94,51 +90,27 @@ Full options:
|
||||
- `--include-promoted`: include already promoted candidates in output.
|
||||
- `--json`: print JSON output.
|
||||
|
||||
`memory promote-explain`:
|
||||
|
||||
Explain a specific promotion candidate and its score breakdown.
|
||||
|
||||
```bash
|
||||
openclaw memory promote-explain <selector> [--agent <id>] [--include-promoted] [--json]
|
||||
```
|
||||
|
||||
- `<selector>`: candidate key, path fragment, or snippet fragment to look up.
|
||||
- `--agent <id>`: scope to a single agent (default: the default agent).
|
||||
- `--include-promoted`: include already promoted candidates.
|
||||
- `--json`: print JSON output.
|
||||
|
||||
`memory rem-harness`:
|
||||
|
||||
Preview REM reflections, candidate truths, and deep promotion output without writing anything.
|
||||
|
||||
```bash
|
||||
openclaw memory rem-harness [--agent <id>] [--include-promoted] [--json]
|
||||
```
|
||||
|
||||
- `--agent <id>`: scope to a single agent (default: the default agent).
|
||||
- `--include-promoted`: include already promoted deep candidates.
|
||||
- `--json`: print JSON output.
|
||||
|
||||
## Dreaming (experimental)
|
||||
|
||||
Dreaming is the background memory consolidation system with three cooperative
|
||||
phases: **light** (sort/stage short-term material), **deep** (promote durable
|
||||
facts into `MEMORY.md`), and **REM** (reflect and surface themes).
|
||||
phases: **light** (organize into `DREAMS.md` in inline mode), **deep**
|
||||
(promote into `MEMORY.md`), and **REM** (reflect and find patterns in
|
||||
`DREAMS.md` in inline mode).
|
||||
|
||||
- Enable with `plugins.entries.memory-core.config.dreaming.enabled: true`.
|
||||
- Toggle from chat with `/dreaming on|off` (or inspect with `/dreaming status`).
|
||||
- Dreaming runs on one managed sweep schedule (`dreaming.frequency`) and executes phases in order: light, REM, deep.
|
||||
- Only the deep phase writes durable memory to `MEMORY.md`.
|
||||
- Human-readable phase output and diary entries are written to `DREAMS.md` (or existing `dreams.md`), with optional per-phase reports in `memory/dreaming/<phase>/YYYY-MM-DD.md`.
|
||||
- Toggle from chat with `/dreaming on|off` or `/dreaming enable|disable light|deep|rem`.
|
||||
- Each phase runs on its own cron schedule, managed automatically by `memory-core`.
|
||||
- Only the deep phase writes durable memory to `MEMORY.md`. With default inline storage, Light and REM write to `DREAMS.md`.
|
||||
- Ranking uses weighted signals: recall frequency, retrieval relevance, query diversity, temporal recency, cross-day consolidation, and derived concept richness.
|
||||
- Promotion re-reads the live daily note before writing to `MEMORY.md`, so edited or deleted short-term snippets do not get promoted from stale recall-store snapshots.
|
||||
- Scheduled and manual `memory promote` runs share the same deep phase defaults unless you pass CLI threshold overrides.
|
||||
- Automatic runs fan out across configured memory workspaces.
|
||||
|
||||
Default scheduling:
|
||||
Default phase schedules:
|
||||
|
||||
- **Sweep cadence**: `dreaming.frequency = 0 3 * * *`
|
||||
- **Deep thresholds**: `minScore=0.8`, `minRecallCount=3`, `minUniqueQueries=3`, `recencyHalfLifeDays=14`, `maxAgeDays=30`
|
||||
- **Light**: every 6 hours (`0 */6 * * *`), `lookbackDays=2`, `limit=100`
|
||||
- **Deep**: daily at 3 AM (`0 3 * * *`), `limit=10`, `minScore=0.8`, `minRecallCount=3`, `minUniqueQueries=3`, `recencyHalfLifeDays=14`
|
||||
- **REM**: weekly, Sunday 5 AM (`0 5 * * 0`), `lookbackDays=7`, `limit=10`
|
||||
|
||||
Example:
|
||||
|
||||
@@ -164,5 +136,6 @@ Notes:
|
||||
- `memory status` includes any extra paths configured via `memorySearch.extraPaths`.
|
||||
- If effectively active memory remote API key fields are configured as SecretRefs, the command resolves those values from the active gateway snapshot. If gateway is unavailable, the command fails fast.
|
||||
- Gateway version skew note: this command path requires a gateway that supports `secrets.resolve`; older gateways return an unknown-method error.
|
||||
- Tune scheduled sweep cadence with `dreaming.frequency`. Deep promotion policy is otherwise internal; use CLI flags on `memory promote` when you need one-off manual overrides.
|
||||
- Override each phase schedule with `phases.<phase>.cron` and fine-tune deep promotion with `phases.deep.minScore`, `phases.deep.minRecallCount`, `phases.deep.minUniqueQueries`, `phases.deep.recencyHalfLifeDays`, and `phases.deep.maxAgeDays`.
|
||||
- Set `plugins.entries.memory-core.config.dreaming.verboseLogging` to `true` to emit per-run candidate and apply details into the normal gateway logs while tuning the feature.
|
||||
- See [Dreaming](/concepts/dreaming) for full phase descriptions and configuration reference.
|
||||
|
||||
@@ -130,5 +130,5 @@ Notes:
|
||||
`--profile-id`.
|
||||
- `paste-token --expires-in <duration>` stores an absolute token expiry from a
|
||||
relative duration such as `365d` or `12h`.
|
||||
- Anthropic note: Anthropic staff told us OpenClaw-style Claude CLI usage is allowed again, so OpenClaw treats Claude CLI reuse and `claude -p` usage as sanctioned for this integration unless Anthropic publishes a new policy.
|
||||
- Anthropic `setup-token` / `paste-token` remain available as a supported OpenClaw token path, but OpenClaw now prefers Claude CLI reuse and `claude -p` when available.
|
||||
- Anthropic billing note: for Anthropic in OpenClaw, the practical split is **API key** or **Claude subscription with Extra Usage**. Anthropic notified OpenClaw users on **April 4, 2026 at 12:00 PM PT / 8:00 PM BST** that the **OpenClaw** Claude-login path counts as third-party harness usage and requires **Extra Usage** billed separately from the subscription. Our local repros also show the OpenClaw-identifying prompt string does not reproduce on the Anthropic SDK + API-key path.
|
||||
- Anthropic `setup-token` / `paste-token` are available again as a legacy/manual OpenClaw path. Use them with the expectation that Anthropic told OpenClaw users this path requires **Extra Usage**.
|
||||
|
||||
@@ -96,13 +96,11 @@ High-level:
|
||||
3. Fetches upstream (dev only).
|
||||
4. Dev only: preflight lint + TypeScript build in a temp worktree; if the tip fails, walks back up to 10 commits to find the newest clean build.
|
||||
5. Rebases onto the selected commit (dev only).
|
||||
6. Installs deps with the repo package manager. For pnpm checkouts, the updater bootstraps `pnpm` on demand (via `corepack` first, then a temporary `npm install pnpm@10` fallback) instead of running `npm run build` inside a pnpm workspace.
|
||||
6. Installs deps (pnpm preferred; npm fallback; bun remains available as a secondary compatibility fallback).
|
||||
7. Builds + builds the Control UI.
|
||||
8. Runs `openclaw doctor` as the final “safe update” check.
|
||||
9. Syncs plugins to the active channel (dev uses bundled extensions; stable/beta uses npm) and updates npm-installed plugins.
|
||||
|
||||
If pnpm bootstrap still fails, the updater now stops early with a package-manager-specific error instead of trying `npm run build` inside the checkout.
|
||||
|
||||
## `--update` shorthand
|
||||
|
||||
`openclaw --update` rewrites to `openclaw update` (useful for shells and launcher scripts).
|
||||
|
||||
@@ -115,8 +115,6 @@ engine is used automatically.
|
||||
A plugin can register a context engine using the plugin API:
|
||||
|
||||
```ts
|
||||
import { buildMemorySystemPromptAddition } from "openclaw/plugin-sdk/core";
|
||||
|
||||
export default function register(api) {
|
||||
api.registerContextEngine("my-engine", () => ({
|
||||
info: {
|
||||
@@ -130,15 +128,12 @@ export default function register(api) {
|
||||
return { ingested: true };
|
||||
},
|
||||
|
||||
async assemble({ sessionId, messages, tokenBudget, availableTools, citationsMode }) {
|
||||
async assemble({ sessionId, messages, tokenBudget }) {
|
||||
// Return messages that fit the budget
|
||||
return {
|
||||
messages: buildContext(messages, tokenBudget),
|
||||
estimatedTokens: countTokens(messages),
|
||||
systemPromptAddition: buildMemorySystemPromptAddition({
|
||||
availableTools: availableTools ?? new Set(),
|
||||
citationsMode,
|
||||
}),
|
||||
systemPromptAddition: "Use lcm_grep to search history...",
|
||||
};
|
||||
},
|
||||
|
||||
@@ -253,13 +248,7 @@ OpenClaw resolves when it needs a context engine.
|
||||
- **Memory plugins** (`plugins.slots.memory`) are separate from context engines.
|
||||
Memory plugins provide search/retrieval; context engines control what the
|
||||
model sees. They can work together — a context engine might use memory
|
||||
plugin data during assembly. Plugin engines that want the active memory
|
||||
prompt path should prefer `buildMemorySystemPromptAddition(...)` from
|
||||
`openclaw/plugin-sdk/core`, which converts the active memory prompt sections
|
||||
into a ready-to-prepend `systemPromptAddition`. If an engine needs lower-level
|
||||
control, it can still pull raw lines from
|
||||
`openclaw/plugin-sdk/memory-host-core` via
|
||||
`buildActiveMemoryPromptSection(...)`.
|
||||
plugin data during assembly.
|
||||
- **Session pruning** (trimming old tool results in-memory) still runs
|
||||
regardless of which context engine is active.
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ pluggable interface, lifecycle hooks, and configuration.
|
||||
`/context` prefers the latest **run-built** system prompt report when available:
|
||||
|
||||
- `System prompt (run)` = captured from the last embedded (tool-capable) run and persisted in the session store.
|
||||
- `System prompt (estimate)` = computed on the fly when no run report exists (or when running via a CLI backend that doesn’t generate the report).
|
||||
- `System prompt (estimate)` = computed on the fly when no run report exists yet.
|
||||
|
||||
Either way, it reports sizes and top contributors; it does **not** dump the full system prompt or tool schemas.
|
||||
|
||||
|
||||
@@ -1,109 +1,64 @@
|
||||
---
|
||||
title: "Dreaming (experimental)"
|
||||
summary: "Background memory consolidation with light, deep, and REM phases plus a Dream Diary"
|
||||
summary: "Background memory consolidation with three cooperative phases: light, deep, and REM"
|
||||
read_when:
|
||||
- You want memory promotion to run automatically
|
||||
- You want to understand what each dreaming phase does
|
||||
- You want to understand the three dreaming phases
|
||||
- You want to tune consolidation without polluting MEMORY.md
|
||||
---
|
||||
|
||||
# Dreaming (experimental)
|
||||
|
||||
Dreaming is the background memory consolidation system in `memory-core`.
|
||||
It helps OpenClaw move strong short-term signals into durable memory while
|
||||
keeping the process explainable and reviewable.
|
||||
Dreaming is the background memory consolidation system in `memory-core`. It
|
||||
revisits what came up during conversations and decides what is worth keeping as
|
||||
durable context.
|
||||
|
||||
Dreaming is **opt-in** and disabled by default.
|
||||
Dreaming uses three cooperative **phases**, not competing modes. Each phase has
|
||||
a distinct job, writes to a distinct target, and runs on its own schedule.
|
||||
|
||||
## What dreaming writes
|
||||
## The three phases
|
||||
|
||||
Dreaming keeps two kinds of output:
|
||||
### Light
|
||||
|
||||
- **Machine state** in `memory/.dreams/` (recall store, phase signals, ingestion checkpoints, locks).
|
||||
- **Human-readable output** in `DREAMS.md` (or existing `dreams.md`) and optional phase report files under `memory/dreaming/<phase>/YYYY-MM-DD.md`.
|
||||
Light dreaming sorts the recent mess. It scans recent memory traces, dedupes
|
||||
them by Jaccard similarity, clusters related entries, and stages candidate
|
||||
memories into the shared dreaming trail file (`DREAMS.md`) when inline storage
|
||||
is enabled.
|
||||
|
||||
Long-term promotion still writes only to `MEMORY.md`.
|
||||
Light does **not** write anything into `MEMORY.md`. It only organizes and
|
||||
stages. Think: "what from today might matter later?"
|
||||
|
||||
## Phase model
|
||||
### Deep
|
||||
|
||||
Dreaming uses three cooperative phases:
|
||||
Deep dreaming decides what becomes durable memory. It runs the real promotion
|
||||
logic: weighted scoring across six signals, threshold gates, recall count,
|
||||
unique query diversity, recency decay, and max age filtering.
|
||||
|
||||
| Phase | Purpose | Durable write |
|
||||
| ----- | ----------------------------------------- | ----------------- |
|
||||
| Light | Sort and stage recent short-term material | No |
|
||||
| Deep | Score and promote durable candidates | Yes (`MEMORY.md`) |
|
||||
| REM | Reflect on themes and recurring ideas | No |
|
||||
Deep is the **only** phase allowed to write durable facts into `MEMORY.md`.
|
||||
It also owns recovery when memory is thin (health drops below a configured
|
||||
threshold). Think: "what is true enough to keep?"
|
||||
|
||||
These phases are internal implementation details, not separate user-configured
|
||||
"modes."
|
||||
### REM
|
||||
|
||||
### Light phase
|
||||
REM dreaming looks for patterns and reflection. It examines recent material,
|
||||
identifies recurring themes through concept tag clustering, and writes
|
||||
higher-order notes and reflections into `DREAMS.md` when inline storage is
|
||||
enabled.
|
||||
|
||||
Light phase ingests recent daily memory signals and recall traces, dedupes them,
|
||||
and stages candidate lines.
|
||||
REM writes to `DREAMS.md` in inline mode, **not** `MEMORY.md`.
|
||||
Its output is interpretive, not canonical. Think: "what pattern am I noticing?"
|
||||
|
||||
- Reads from short-term recall state and recent daily memory files.
|
||||
- Writes a managed `## Light Sleep` block when storage includes inline output.
|
||||
- Records reinforcement signals for later deep ranking.
|
||||
- Never writes to `MEMORY.md`.
|
||||
## Hard boundaries
|
||||
|
||||
### Deep phase
|
||||
|
||||
Deep phase decides what becomes long-term memory.
|
||||
|
||||
- Ranks candidates using weighted scoring and threshold gates.
|
||||
- Requires `minScore`, `minRecallCount`, and `minUniqueQueries` to pass.
|
||||
- Rehydrates snippets from live daily files before writing, so stale/deleted snippets are skipped.
|
||||
- Appends promoted entries to `MEMORY.md`.
|
||||
- Writes a `## Deep Sleep` summary into `DREAMS.md` and optionally writes `memory/dreaming/deep/YYYY-MM-DD.md`.
|
||||
|
||||
### REM phase
|
||||
|
||||
REM phase extracts patterns and reflective signals.
|
||||
|
||||
- Builds theme and reflection summaries from recent short-term traces.
|
||||
- Writes a managed `## REM Sleep` block when storage includes inline output.
|
||||
- Records REM reinforcement signals used by deep ranking.
|
||||
- Never writes to `MEMORY.md`.
|
||||
|
||||
## Dream Diary
|
||||
|
||||
Dreaming also keeps a narrative **Dream Diary** in `DREAMS.md`.
|
||||
After each phase has enough material, `memory-core` runs a best-effort background
|
||||
subagent turn (using the default runtime model) and appends a short diary entry.
|
||||
|
||||
This diary is for human reading in the Dreams UI, not a promotion source.
|
||||
|
||||
## Deep ranking signals
|
||||
|
||||
Deep ranking uses six weighted base signals plus phase reinforcement:
|
||||
|
||||
| Signal | Weight | Description |
|
||||
| ------------------- | ------ | ------------------------------------------------- |
|
||||
| Frequency | 0.24 | How many short-term signals the entry accumulated |
|
||||
| Relevance | 0.30 | Average retrieval quality for the entry |
|
||||
| Query diversity | 0.15 | Distinct query/day contexts that surfaced it |
|
||||
| Recency | 0.15 | Time-decayed freshness score |
|
||||
| Consolidation | 0.10 | Multi-day recurrence strength |
|
||||
| Conceptual richness | 0.06 | Concept-tag density from snippet/path |
|
||||
|
||||
Light and REM phase hits add a small recency-decayed boost from
|
||||
`memory/.dreams/phase-signals.json`.
|
||||
|
||||
## Scheduling
|
||||
|
||||
When enabled, `memory-core` auto-manages one cron job for a full dreaming
|
||||
sweep. Each sweep runs phases in order: light -> REM -> deep.
|
||||
|
||||
Default cadence behavior:
|
||||
|
||||
| Setting | Default |
|
||||
| -------------------- | ----------- |
|
||||
| `dreaming.frequency` | `0 3 * * *` |
|
||||
| Phase | Job | Writes to | Does NOT write to |
|
||||
| ----- | --------- | ------------------------- | ----------------- |
|
||||
| Light | Organize | `DREAMS.md` (inline mode) | MEMORY.md |
|
||||
| Deep | Preserve | MEMORY.md | -- |
|
||||
| REM | Interpret | `DREAMS.md` (inline mode) | MEMORY.md |
|
||||
|
||||
## Quick start
|
||||
|
||||
Enable dreaming:
|
||||
Enable all three phases (recommended):
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -121,7 +76,7 @@ Enable dreaming:
|
||||
}
|
||||
```
|
||||
|
||||
Enable dreaming with a custom sweep cadence:
|
||||
Enable only deep promotion:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -131,8 +86,11 @@ Enable dreaming with a custom sweep cadence:
|
||||
"config": {
|
||||
"dreaming": {
|
||||
"enabled": true,
|
||||
"timezone": "America/Los_Angeles",
|
||||
"frequency": "0 */6 * * *"
|
||||
"phases": {
|
||||
"light": { "enabled": false },
|
||||
"deep": { "enabled": true },
|
||||
"rem": { "enabled": false }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,72 +99,191 @@ Enable dreaming with a custom sweep cadence:
|
||||
}
|
||||
```
|
||||
|
||||
## Slash command
|
||||
## Configuration
|
||||
|
||||
All dreaming settings live under `plugins.entries.memory-core.config.dreaming`
|
||||
in `openclaw.json`. See [Memory configuration reference](/reference/memory-config#dreaming-experimental)
|
||||
for the full key list.
|
||||
|
||||
### Global settings
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| ---------------- | --------- | ---------- | ------------------------------------------------------------ |
|
||||
| `enabled` | `boolean` | `true` | Master switch for all phases |
|
||||
| `timezone` | `string` | unset | Timezone for schedule evaluation and dreaming date bucketing |
|
||||
| `verboseLogging` | `boolean` | `false` | Emit detailed per-run dreaming logs |
|
||||
| `storage.mode` | `string` | `"inline"` | Inline `DREAMS.md`, separate reports, or both |
|
||||
|
||||
### Light phase config
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| ------------------ | ---------- | ------------------------------- | --------------------------------- |
|
||||
| `enabled` | `boolean` | `true` | Enable light phase |
|
||||
| `cron` | `string` | `0 */6 * * *` | Schedule (default: every 6 hours) |
|
||||
| `lookbackDays` | `number` | `2` | How many days of traces to scan |
|
||||
| `limit` | `number` | `100` | Max candidates to stage per run |
|
||||
| `dedupeSimilarity` | `number` | `0.9` | Jaccard threshold for dedup |
|
||||
| `sources` | `string[]` | `["daily","sessions","recall"]` | Data sources to scan |
|
||||
|
||||
### Deep phase config
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| --------------------- | ---------- | ----------------------------------------------- | ------------------------------------ |
|
||||
| `enabled` | `boolean` | `true` | Enable deep phase |
|
||||
| `cron` | `string` | `0 3 * * *` | Schedule (default: daily at 3 AM) |
|
||||
| `limit` | `number` | `10` | Max candidates to promote per cycle |
|
||||
| `minScore` | `number` | `0.8` | Minimum weighted score for promotion |
|
||||
| `minRecallCount` | `number` | `3` | Minimum recall count threshold |
|
||||
| `minUniqueQueries` | `number` | `3` | Minimum distinct query count |
|
||||
| `recencyHalfLifeDays` | `number` | `14` | Days for recency score to halve |
|
||||
| `maxAgeDays` | `number` | `30` | Max daily-note age for promotion |
|
||||
| `sources` | `string[]` | `["daily","memory","sessions","logs","recall"]` | Data sources |
|
||||
|
||||
### Deep recovery config
|
||||
|
||||
Recovery kicks in when long-term memory health drops below a threshold.
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| --------------------------------- | --------- | ------- | ------------------------------------------ |
|
||||
| `recovery.enabled` | `boolean` | `true` | Enable automatic recovery |
|
||||
| `recovery.triggerBelowHealth` | `number` | `0.35` | Health score threshold to trigger recovery |
|
||||
| `recovery.lookbackDays` | `number` | `30` | How far back to look for recovery material |
|
||||
| `recovery.maxRecoveredCandidates` | `number` | `20` | Max candidates to recover per run |
|
||||
| `recovery.minRecoveryConfidence` | `number` | `0.9` | Minimum confidence for recovery candidates |
|
||||
| `recovery.autoWriteMinConfidence` | `number` | `0.97` | Auto-write threshold (skip manual review) |
|
||||
|
||||
### REM phase config
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| -------------------- | ---------- | --------------------------- | --------------------------------------- |
|
||||
| `enabled` | `boolean` | `true` | Enable REM phase |
|
||||
| `cron` | `string` | `0 5 * * 0` | Schedule (default: weekly, Sunday 5 AM) |
|
||||
| `lookbackDays` | `number` | `7` | How many days of material to reflect on |
|
||||
| `limit` | `number` | `10` | Max patterns or themes to write |
|
||||
| `minPatternStrength` | `number` | `0.75` | Minimum tag co-occurrence strength |
|
||||
| `sources` | `string[]` | `["memory","daily","deep"]` | Data sources for reflection |
|
||||
|
||||
### Execution overrides
|
||||
|
||||
Each phase accepts an `execution` block to override global defaults:
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| ----------------- | -------- | ------------ | ------------------------------ |
|
||||
| `speed` | `string` | `"balanced"` | `fast`, `balanced`, or `slow` |
|
||||
| `thinking` | `string` | `"medium"` | `low`, `medium`, or `high` |
|
||||
| `budget` | `string` | `"medium"` | `cheap`, `medium`, `expensive` |
|
||||
| `model` | `string` | unset | Override model for this phase |
|
||||
| `maxOutputTokens` | `number` | unset | Cap output tokens |
|
||||
| `temperature` | `number` | unset | Sampling temperature (0-2) |
|
||||
| `timeoutMs` | `number` | unset | Phase timeout in milliseconds |
|
||||
|
||||
## Promotion signals (deep phase)
|
||||
|
||||
Deep dreaming combines six weighted signals. Promotion requires all configured
|
||||
threshold gates to pass simultaneously.
|
||||
|
||||
| Signal | Weight | Description |
|
||||
| ------------------- | ------ | -------------------------------------------------- |
|
||||
| Frequency | 0.24 | How often the same entry was recalled |
|
||||
| Relevance | 0.30 | Average recall scores when retrieved |
|
||||
| Query diversity | 0.15 | Count of distinct query intents that surfaced it |
|
||||
| Recency | 0.15 | Temporal decay (`recencyHalfLifeDays`, default 14) |
|
||||
| Consolidation | 0.10 | Reward recalls repeated across multiple days |
|
||||
| Conceptual richness | 0.06 | Reward entries with richer derived concept tags |
|
||||
|
||||
## Chat commands
|
||||
|
||||
```
|
||||
/dreaming status
|
||||
/dreaming on
|
||||
/dreaming off
|
||||
/dreaming help
|
||||
/dreaming status # Show phase config and cadence
|
||||
/dreaming on # Enable all phases
|
||||
/dreaming off # Disable all phases
|
||||
/dreaming enable light|deep|rem # Enable a specific phase
|
||||
/dreaming disable light|deep|rem # Disable a specific phase
|
||||
/dreaming help # Show usage guide
|
||||
```
|
||||
|
||||
## CLI workflow
|
||||
## CLI commands
|
||||
|
||||
Use CLI promotion for preview or manual apply:
|
||||
Preview and apply deep promotions from the command line:
|
||||
|
||||
```bash
|
||||
# Preview promotion candidates
|
||||
openclaw memory promote
|
||||
|
||||
# Apply promotions to MEMORY.md
|
||||
openclaw memory promote --apply
|
||||
|
||||
# Limit preview count
|
||||
openclaw memory promote --limit 5
|
||||
|
||||
# Include already-promoted entries
|
||||
openclaw memory promote --include-promoted
|
||||
|
||||
# Check dreaming status
|
||||
openclaw memory status --deep
|
||||
```
|
||||
|
||||
Manual `memory promote` uses deep-phase thresholds by default unless overridden
|
||||
with CLI flags.
|
||||
See [memory CLI](/cli/memory) for the full flag reference.
|
||||
|
||||
Explain why a specific candidate would or would not promote:
|
||||
## How it works
|
||||
|
||||
```bash
|
||||
openclaw memory promote-explain "router vlan"
|
||||
openclaw memory promote-explain "router vlan" --json
|
||||
```
|
||||
### Light phase pipeline
|
||||
|
||||
Preview REM reflections, candidate truths, and deep promotion output without
|
||||
writing anything:
|
||||
1. Read short-term recall entries from `memory/.dreams/short-term-recall.json`.
|
||||
2. Filter entries within `lookbackDays` of the current time.
|
||||
3. Deduplicate by Jaccard similarity (configurable threshold).
|
||||
4. Sort by average recall score, take up to `limit` entries.
|
||||
5. Write staged candidates into `DREAMS.md` under a `## Light Sleep` block when
|
||||
inline storage is enabled.
|
||||
|
||||
```bash
|
||||
openclaw memory rem-harness
|
||||
openclaw memory rem-harness --json
|
||||
```
|
||||
### Deep phase pipeline
|
||||
|
||||
## Key defaults
|
||||
1. Read and rank short-term recall candidates using weighted signals.
|
||||
2. Apply threshold gates: `minScore`, `minRecallCount`, `minUniqueQueries`.
|
||||
3. Filter by `maxAgeDays` and apply recency decay.
|
||||
4. Fan out across configured memory workspaces.
|
||||
5. Re-read the live daily note before writing (skip stale or deleted snippets).
|
||||
6. Append qualifying entries to `MEMORY.md` with promoted timestamps.
|
||||
7. Mark promoted entries to exclude them from future cycles.
|
||||
8. If health is below `recovery.triggerBelowHealth`, run the recovery pass.
|
||||
|
||||
All settings live under `plugins.entries.memory-core.config.dreaming`.
|
||||
### REM phase pipeline
|
||||
|
||||
| Key | Default |
|
||||
| ----------- | ----------- |
|
||||
| `enabled` | `false` |
|
||||
| `frequency` | `0 3 * * *` |
|
||||
1. Read recent memory traces within `lookbackDays`.
|
||||
2. Cluster concept tags by co-occurrence.
|
||||
3. Filter patterns by `minPatternStrength`.
|
||||
4. Write themes and reflections into `DREAMS.md` under a `## REM Sleep` block
|
||||
when inline storage is enabled.
|
||||
|
||||
Phase policy, thresholds, and storage behavior are internal implementation
|
||||
details (not user-facing config).
|
||||
## Scheduling
|
||||
|
||||
See [Memory configuration reference](/reference/memory-config#dreaming-experimental)
|
||||
for the full key list.
|
||||
Each phase manages its own cron job automatically. When dreaming is enabled,
|
||||
`memory-core` reconciles managed cron jobs on gateway startup. You do not need
|
||||
to manually create cron entries.
|
||||
|
||||
| Phase | Default schedule | Description |
|
||||
| ----- | ---------------- | ------------------- |
|
||||
| Light | `0 */6 * * *` | Every 6 hours |
|
||||
| Deep | `0 3 * * *` | Daily at 3 AM |
|
||||
| REM | `0 5 * * 0` | Weekly, Sunday 5 AM |
|
||||
|
||||
Override any schedule with the phase `cron` key. All schedules honor the global
|
||||
`timezone` setting.
|
||||
|
||||
## Dreams UI
|
||||
|
||||
When enabled, the Gateway **Dreams** tab shows:
|
||||
When dreaming is enabled, the Gateway sidebar shows a **Dreams** tab with
|
||||
memory stats (short-term count, long-term count, promoted count) and the next
|
||||
scheduled cycle time. Daily counters honor `dreaming.timezone` when set and
|
||||
otherwise fall back to the configured user timezone.
|
||||
|
||||
- current dreaming enabled state
|
||||
- phase-level status and managed-sweep presence
|
||||
- short-term, long-term, and promoted-today counts
|
||||
- next scheduled run timing
|
||||
- an expandable Dream Diary reader backed by `doctor.memory.dreamDiary`
|
||||
Manual `openclaw memory promote` runs use the same deep phase thresholds by
|
||||
default, so scheduled and on-demand promotion stay aligned unless you pass CLI
|
||||
overrides.
|
||||
|
||||
## Related
|
||||
|
||||
- [Memory](/concepts/memory)
|
||||
- [Memory Search](/concepts/memory-search)
|
||||
- [memory CLI](/cli/memory)
|
||||
- [Memory configuration reference](/reference/memory-config)
|
||||
- [memory CLI](/cli/memory)
|
||||
|
||||
@@ -25,7 +25,7 @@ binary, and can index content beyond your workspace memory files.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Install QMD: `npm install -g @tobilu/qmd` or `bun install -g @tobilu/qmd`
|
||||
- Install QMD: `bun install -g @tobilu/qmd`
|
||||
- SQLite build that allows extensions (`brew install sqlite` on macOS).
|
||||
- QMD must be on the gateway's `PATH`.
|
||||
- macOS and Linux work out of the box. Windows is best supported via WSL2.
|
||||
@@ -43,8 +43,6 @@ binary, and can index content beyond your workspace memory files.
|
||||
OpenClaw creates a self-contained QMD home under
|
||||
`~/.openclaw/agents/<agentId>/qmd/` and manages the sidecar lifecycle
|
||||
automatically -- collections, updates, and embedding runs are handled for you.
|
||||
It prefers current QMD collection and MCP query shapes, but still falls back to
|
||||
legacy `--mask` collection flags and older MCP tool names when needed.
|
||||
|
||||
## How the sidecar works
|
||||
|
||||
@@ -61,20 +59,6 @@ The first search may be slow -- QMD auto-downloads GGUF models (~2 GB) for
|
||||
reranking and query expansion on the first `qmd query` run.
|
||||
</Info>
|
||||
|
||||
## Model overrides
|
||||
|
||||
QMD model environment variables pass through unchanged from the gateway
|
||||
process, so you can tune QMD globally without adding new OpenClaw config:
|
||||
|
||||
```bash
|
||||
export QMD_EMBED_MODEL="hf:Qwen/Qwen3-Embedding-0.6B-GGUF/Qwen3-Embedding-0.6B-Q8_0.gguf"
|
||||
export QMD_RERANK_MODEL="/absolute/path/to/reranker.gguf"
|
||||
export QMD_GENERATE_MODEL="/absolute/path/to/generator.gguf"
|
||||
```
|
||||
|
||||
After changing the embedding model, rerun embeddings so the index matches the
|
||||
new vector space.
|
||||
|
||||
## Indexing extra paths
|
||||
|
||||
Point QMD at additional directories to make them searchable:
|
||||
|
||||
@@ -35,15 +35,14 @@ node-llama-cpp).
|
||||
|
||||
## Supported providers
|
||||
|
||||
| Provider | ID | Needs API key | Notes |
|
||||
| -------- | --------- | ------------- | ---------------------------------------------------- |
|
||||
| OpenAI | `openai` | Yes | Auto-detected, fast |
|
||||
| Gemini | `gemini` | Yes | Supports image/audio indexing |
|
||||
| Voyage | `voyage` | Yes | Auto-detected |
|
||||
| Mistral | `mistral` | Yes | Auto-detected |
|
||||
| Bedrock | `bedrock` | No | Auto-detected when the AWS credential chain resolves |
|
||||
| Ollama | `ollama` | No | Local, must set explicitly |
|
||||
| Local | `local` | No | GGUF model, ~0.6 GB download |
|
||||
| Provider | ID | Needs API key | Notes |
|
||||
| -------- | --------- | ------------- | ----------------------------- |
|
||||
| OpenAI | `openai` | Yes | Auto-detected, fast |
|
||||
| Gemini | `gemini` | Yes | Supports image/audio indexing |
|
||||
| Voyage | `voyage` | Yes | Auto-detected |
|
||||
| Mistral | `mistral` | Yes | Auto-detected |
|
||||
| Ollama | `ollama` | No | Local, must set explicitly |
|
||||
| Local | `local` | No | GGUF model, ~0.6 GB download |
|
||||
|
||||
## How search works
|
||||
|
||||
|
||||
@@ -14,14 +14,12 @@ hidden state.
|
||||
|
||||
## How it works
|
||||
|
||||
Your agent has three memory-related files:
|
||||
Your agent has two places to store memories:
|
||||
|
||||
- **`MEMORY.md`** -- long-term memory. Durable facts, preferences, and
|
||||
decisions. Loaded at the start of every DM session.
|
||||
- **`memory/YYYY-MM-DD.md`** -- daily notes. Running context and observations.
|
||||
Today and yesterday's notes are loaded automatically.
|
||||
- **`DREAMS.md`** (experimental, optional) -- Dream Diary and dreaming sweep
|
||||
summaries for human review.
|
||||
|
||||
These files live in the agent workspace (default `~/.openclaw/workspace`).
|
||||
|
||||
@@ -87,22 +85,20 @@ will be saved automatically before the summary happens.
|
||||
|
||||
## Dreaming (experimental)
|
||||
|
||||
Dreaming is an optional background consolidation pass for memory. It collects
|
||||
short-term signals, scores candidates, and promotes only qualified items into
|
||||
long-term memory (`MEMORY.md`).
|
||||
Dreaming is an optional background consolidation pass for memory. It revisits
|
||||
short-term recalls from daily files (`memory/YYYY-MM-DD.md`), scores them, and
|
||||
promotes only qualified items into long-term memory (`MEMORY.md`).
|
||||
|
||||
It is designed to keep long-term memory high signal:
|
||||
|
||||
- **Opt-in**: disabled by default.
|
||||
- **Scheduled**: when enabled, `memory-core` auto-manages one recurring cron job
|
||||
for a full dreaming sweep.
|
||||
- **Scheduled**: when enabled, `memory-core` manages the recurring task
|
||||
automatically.
|
||||
- **Thresholded**: promotions must pass score, recall frequency, and query
|
||||
diversity gates.
|
||||
- **Reviewable**: phase summaries and diary entries are written to `DREAMS.md`
|
||||
for human review.
|
||||
|
||||
For phase behavior, scoring signals, and Dream Diary details, see
|
||||
[Dreaming (experimental)](/concepts/dreaming).
|
||||
For mode behavior (`off`, `core`, `rem`, `deep`), scoring signals, and tuning
|
||||
knobs, see [Dreaming (experimental)](/concepts/dreaming).
|
||||
|
||||
## CLI
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ happened while the attempt was running.
|
||||
OpenClaw uses **auth profiles** for both API keys and OAuth tokens.
|
||||
|
||||
- Secrets live in `~/.openclaw/agents/<agentId>/agent/auth-profiles.json` (legacy: `~/.openclaw/agent/auth-profiles.json`).
|
||||
- Runtime auth-routing state lives in `~/.openclaw/agents/<agentId>/agent/auth-state.json`.
|
||||
- Config `auth.profiles` / `auth.order` are **metadata + routing only** (no secrets).
|
||||
- Legacy import-only OAuth file: `~/.openclaw/credentials/oauth.json` (imported into `auth-profiles.json` on first use).
|
||||
|
||||
@@ -156,7 +155,7 @@ Cooldowns use exponential backoff:
|
||||
- 25 minutes
|
||||
- 1 hour (cap)
|
||||
|
||||
State is stored in `auth-state.json` under `usageStats`:
|
||||
State is stored in `auth-profiles.json` under `usageStats`:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -185,7 +184,7 @@ limit reached, resets tomorrow`, or `organization spending limit exceeded`).
|
||||
Those stay on the short cooldown/failover path instead of the long
|
||||
billing-disable path.
|
||||
|
||||
State is stored in `auth-state.json`:
|
||||
State is stored in `auth-profiles.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -165,13 +165,11 @@ Current bundled examples:
|
||||
wrappers, provider-family metadata, bundled image-generation provider
|
||||
registration for `gpt-image-1`, and bundled video-generation provider
|
||||
registration for `sora-2`
|
||||
- `google` and `google-gemini-cli`: Gemini 3.1 forward-compat fallback,
|
||||
native Gemini replay validation, bootstrap replay sanitation, tagged
|
||||
reasoning-output mode, modern-model matching, bundled image-generation
|
||||
provider registration for Gemini image-preview models, and bundled
|
||||
video-generation provider registration for Veo models; Gemini CLI OAuth also
|
||||
owns auth-profile token formatting, usage-token parsing, and quota endpoint
|
||||
fetching for usage surfaces
|
||||
- `google`: Gemini 3.1 forward-compat fallback, native Gemini replay
|
||||
validation, bootstrap replay sanitation, tagged reasoning-output mode,
|
||||
modern-model matching, bundled image-generation provider registration for
|
||||
Gemini image-preview models, and bundled video-generation provider
|
||||
registration for Veo models
|
||||
- `moonshot`: shared transport, plugin-owned thinking payload normalization
|
||||
- `kilocode`: shared transport, plugin-owned request headers, reasoning payload
|
||||
normalization, proxy-Gemini thought-signature sanitation, and cache-TTL
|
||||
@@ -200,8 +198,6 @@ Current bundled examples:
|
||||
media-understanding and video-generation provider registrations for its
|
||||
multimodal surfaces; Qwen video generation uses the Standard DashScope video
|
||||
endpoints with bundled Wan models such as `wan2.6-t2v` and `wan2.7-r2v`
|
||||
- `runway`: plugin-owned video-generation provider registration for native
|
||||
Runway task-based models such as `gen4.5`
|
||||
- `minimax`: plugin-owned catalogs, bundled video-generation provider
|
||||
registration for Hailuo video models, bundled image-generation provider
|
||||
registration for `image-01`, hybrid Anthropic/OpenAI replay-policy
|
||||
@@ -273,8 +269,8 @@ OpenClaw ships with the pi‑ai catalog. These providers require **no**
|
||||
- Example model: `anthropic/claude-opus-4-6`
|
||||
- CLI: `openclaw onboard --auth-choice apiKey`
|
||||
- Direct public Anthropic requests support the shared `/fast` toggle and `params.fastMode`, including API-key and OAuth-authenticated traffic sent to `api.anthropic.com`; OpenClaw maps that to Anthropic `service_tier` (`auto` vs `standard_only`)
|
||||
- Anthropic note: Anthropic staff told us OpenClaw-style Claude CLI usage is allowed again, so OpenClaw treats Claude CLI reuse and `claude -p` usage as sanctioned for this integration unless Anthropic publishes a new policy.
|
||||
- Anthropic setup-token remains available as a supported OpenClaw token path, but OpenClaw now prefers Claude CLI reuse and `claude -p` when available.
|
||||
- Billing note: for Anthropic in OpenClaw, the practical split is **API key** or **Claude subscription with Extra Usage**. Anthropic notified OpenClaw users on **April 4, 2026 at 12:00 PM PT / 8:00 PM BST** that the **OpenClaw** Claude-login path counts as third-party harness usage and requires **Extra Usage** billed separately from the subscription. Our local repros also show the OpenClaw-identifying prompt string does not reproduce on the Anthropic SDK + API-key path.
|
||||
- Anthropic setup-token is available again as a legacy/manual OpenClaw path. Use it with the expectation that Anthropic told OpenClaw users this path requires **Extra Usage**.
|
||||
|
||||
```json5
|
||||
{
|
||||
@@ -349,21 +345,10 @@ OpenClaw ships with the pi‑ai catalog. These providers require **no**
|
||||
(or legacy `cached_content`) to forward a provider-native
|
||||
`cachedContents/...` handle; Gemini cache hits surface as OpenClaw `cacheRead`
|
||||
|
||||
### Google Vertex and Gemini CLI
|
||||
### Google Vertex
|
||||
|
||||
- Providers: `google-vertex`, `google-gemini-cli`
|
||||
- Auth: Vertex uses gcloud ADC; Gemini CLI uses its OAuth flow
|
||||
- Caution: Gemini CLI OAuth in OpenClaw is an unofficial integration. Some users have reported Google account restrictions after using third-party clients. Review Google terms and use a non-critical account if you choose to proceed.
|
||||
- Gemini CLI OAuth is shipped as part of the bundled `google` plugin.
|
||||
- Install Gemini CLI first:
|
||||
- `brew install gemini-cli`
|
||||
- or `npm install -g @google/gemini-cli`
|
||||
- Enable: `openclaw plugins enable google`
|
||||
- Login: `openclaw models auth login --provider google-gemini-cli --set-default`
|
||||
- Default model: `google-gemini-cli/gemini-3.1-pro-preview`
|
||||
- Note: you do **not** paste a client id or secret into `openclaw.json`. The CLI login flow stores
|
||||
tokens in auth profiles on the gateway host.
|
||||
- If requests fail after login, set `GOOGLE_CLOUD_PROJECT` or `GOOGLE_CLOUD_PROJECT_ID` on the gateway host.
|
||||
- Provider: `google-vertex`
|
||||
- Auth: gcloud ADC
|
||||
- Gemini CLI JSON replies are parsed from `response`; usage falls back to
|
||||
`stats`, with `stats.cached` normalized into OpenClaw `cacheRead`.
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ Related:
|
||||
falls back to `agents.defaults.imageModel`, then the resolved session/default
|
||||
model.
|
||||
- `agents.defaults.imageGenerationModel` is used by the shared image-generation capability. If omitted, `image_generate` can still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered image-generation providers in provider-id order. If you set a specific provider/model, also configure that provider's auth/API key.
|
||||
- `agents.defaults.musicGenerationModel` is used by the shared music-generation capability. If omitted, `music_generate` can still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered music-generation providers in provider-id order. If you set a specific provider/model, also configure that provider's auth/API key.
|
||||
- `agents.defaults.videoGenerationModel` is used by the shared video-generation capability. If omitted, `video_generate` can still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered video-generation providers in provider-id order. If you set a specific provider/model, also configure that provider's auth/API key.
|
||||
- Per-agent defaults can override `agents.defaults.model` via `agents.list[].model` plus bindings (see [/concepts/multi-agent](/concepts/multi-agent)).
|
||||
|
||||
@@ -254,6 +253,5 @@ This applies whenever OpenClaw regenerates `models.json`, including command-driv
|
||||
- [Model Providers](/concepts/model-providers) — provider routing and auth
|
||||
- [Model Failover](/concepts/model-failover) — fallback chains
|
||||
- [Image Generation](/tools/image-generation) — image model configuration
|
||||
- [Music Generation](/tools/music-generation) — music model configuration
|
||||
- [Video Generation](/tools/video-generation) — video model configuration
|
||||
- [Configuration Reference](/gateway/configuration-reference#agent-defaults) — model config keys
|
||||
|
||||
@@ -15,8 +15,9 @@ OpenClaw supports “subscription auth” via OAuth for providers that offer it
|
||||
is now:
|
||||
|
||||
- **Anthropic API key**: normal Anthropic API billing
|
||||
- **Anthropic Claude CLI / subscription auth inside OpenClaw**: Anthropic staff
|
||||
told us this usage is allowed again
|
||||
- **Anthropic subscription auth inside OpenClaw**: Anthropic notified OpenClaw
|
||||
users on **April 4, 2026 at 12:00 PM PT / 8:00 PM BST** that this now
|
||||
requires **Extra Usage**
|
||||
|
||||
OpenAI Codex OAuth is explicitly supported for use in external tools like
|
||||
OpenClaw. This page explains:
|
||||
@@ -70,10 +71,12 @@ For static secret refs and runtime snapshot activation behavior, see [Secrets Ma
|
||||
|
||||
<Warning>
|
||||
Anthropic's public Claude Code docs say direct Claude Code use stays within
|
||||
Claude subscription limits, and Anthropic staff told us OpenClaw-style Claude
|
||||
CLI usage is allowed again. OpenClaw therefore treats Claude CLI reuse and
|
||||
`claude -p` usage as sanctioned for this integration unless Anthropic
|
||||
publishes a new policy.
|
||||
Claude subscription limits. Separately, Anthropic told OpenClaw users on
|
||||
**April 4, 2026 at 12:00 PM PT / 8:00 PM BST** that **OpenClaw counts as a
|
||||
third-party harness**. Existing Anthropic token profiles remain technically
|
||||
usable in OpenClaw, but Anthropic says the OpenClaw path now requires **Extra
|
||||
Usage** (pay-as-you-go billed separately from the subscription) for that
|
||||
traffic.
|
||||
|
||||
For Anthropic's current direct-Claude-Code plan docs, see [Using Claude Code
|
||||
with your Pro or Max
|
||||
@@ -87,12 +90,17 @@ Plan](/providers/qwen), [MiniMax Coding Plan](/providers/minimax),
|
||||
and [Z.AI / GLM Coding Plan](/providers/glm).
|
||||
</Warning>
|
||||
|
||||
OpenClaw also exposes Anthropic setup-token as a supported token-auth path, but it now prefers Claude CLI reuse and `claude -p` when available.
|
||||
OpenClaw now exposes Anthropic setup-token again as a legacy/manual path.
|
||||
Anthropic's OpenClaw-specific billing notice still applies to that path, so
|
||||
use it with the expectation that Anthropic requires **Extra Usage** for
|
||||
OpenClaw-driven Claude-login traffic.
|
||||
|
||||
## Anthropic Claude CLI migration
|
||||
|
||||
OpenClaw supports Anthropic Claude CLI reuse again. If you already have a local
|
||||
Claude login on the host, onboarding/configure can reuse it directly.
|
||||
Anthropic no longer has a supported local Claude CLI migration path in
|
||||
OpenClaw. Use Anthropic API keys for Anthropic traffic, or keep legacy
|
||||
token-based auth only where it is already configured and with the expectation
|
||||
that Anthropic treats that OpenClaw path as **Extra Usage**.
|
||||
|
||||
## OAuth exchange (how login works)
|
||||
|
||||
|
||||
@@ -21,36 +21,13 @@ Current pieces:
|
||||
- `qa/`: repo-backed seed assets for the kickoff task and baseline QA
|
||||
scenarios.
|
||||
|
||||
The current QA operator flow is a two-pane QA site:
|
||||
The long-term goal is a two-pane QA site:
|
||||
|
||||
- Left: Gateway dashboard (Control UI) with the agent.
|
||||
- Right: QA Lab, showing the Slack-ish transcript and scenario plan.
|
||||
|
||||
Run it with:
|
||||
|
||||
```bash
|
||||
pnpm qa:lab:up
|
||||
```
|
||||
|
||||
That builds the QA site, starts the Docker-backed gateway lane, and exposes the
|
||||
QA Lab page where an operator or automation loop can give the agent a QA
|
||||
mission, observe real channel behavior, and record what worked, failed, or
|
||||
stayed blocked.
|
||||
|
||||
For faster QA Lab UI iteration without rebuilding the Docker image each time,
|
||||
start the stack with a bind-mounted QA Lab bundle:
|
||||
|
||||
```bash
|
||||
pnpm openclaw qa docker-build-image
|
||||
pnpm qa:lab:build
|
||||
pnpm qa:lab:up:fast
|
||||
pnpm qa:lab:watch
|
||||
```
|
||||
|
||||
`qa:lab:up:fast` keeps the Docker services on a prebuilt image and bind-mounts
|
||||
`extensions/qa-lab/web/dist` into the `qa-lab` container. `qa:lab:watch`
|
||||
rebuilds that bundle on change, and the browser auto-reloads when the QA Lab
|
||||
asset hash changes.
|
||||
That lets an operator or automation loop give the agent a QA mission, observe
|
||||
real channel behavior, and record what worked, failed, or stayed blocked.
|
||||
|
||||
## Repo-backed seeds
|
||||
|
||||
|
||||
@@ -124,6 +124,14 @@
|
||||
"source": "/context",
|
||||
"destination": "/concepts/context"
|
||||
},
|
||||
{
|
||||
"source": "/zh-CN",
|
||||
"destination": "/zh-CN/index"
|
||||
},
|
||||
{
|
||||
"source": "/zh-CN/",
|
||||
"destination": "/zh-CN/index"
|
||||
},
|
||||
{
|
||||
"source": "/compaction",
|
||||
"destination": "/concepts/compaction"
|
||||
@@ -1108,7 +1116,6 @@
|
||||
"tools/plugin",
|
||||
"plugins/community",
|
||||
"plugins/bundles",
|
||||
"plugins/webhooks",
|
||||
"plugins/voice-call",
|
||||
{
|
||||
"group": "Building Plugins",
|
||||
@@ -1158,7 +1165,6 @@
|
||||
{
|
||||
"group": "Tools",
|
||||
"pages": [
|
||||
"tools/media-overview",
|
||||
"tools/apply-patch",
|
||||
{
|
||||
"group": "Web Browser",
|
||||
@@ -1194,14 +1200,12 @@
|
||||
"tools/exec",
|
||||
"tools/exec-approvals",
|
||||
"tools/image-generation",
|
||||
"tools/music-generation",
|
||||
"tools/llm-task",
|
||||
"tools/lobster",
|
||||
"tools/loop-detection",
|
||||
"tools/pdf",
|
||||
"tools/reactions",
|
||||
"tools/thinking",
|
||||
"tools/video-generation"
|
||||
"tools/thinking"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1229,18 +1233,14 @@
|
||||
{
|
||||
"group": "Providers",
|
||||
"pages": [
|
||||
"providers/alibaba",
|
||||
"providers/anthropic",
|
||||
"providers/arcee",
|
||||
"providers/bedrock",
|
||||
"providers/bedrock-mantle",
|
||||
"providers/chutes",
|
||||
"providers/comfy",
|
||||
"providers/claude-max-api-proxy",
|
||||
"providers/cloudflare-ai-gateway",
|
||||
"providers/deepgram",
|
||||
"providers/deepseek",
|
||||
"providers/fal",
|
||||
"providers/github-copilot",
|
||||
"providers/glm",
|
||||
"providers/google",
|
||||
@@ -1260,14 +1260,12 @@
|
||||
"providers/perplexity-provider",
|
||||
"providers/qianfan",
|
||||
"providers/qwen",
|
||||
"providers/runway",
|
||||
"providers/sglang",
|
||||
"providers/stepfun",
|
||||
"providers/synthetic",
|
||||
"providers/together",
|
||||
"providers/venice",
|
||||
"providers/vercel-ai-gateway",
|
||||
"providers/vydra",
|
||||
"providers/vllm",
|
||||
"providers/volcengine",
|
||||
"providers/xai",
|
||||
@@ -1361,7 +1359,6 @@
|
||||
"gateway/openai-http-api",
|
||||
"gateway/openresponses-http-api",
|
||||
"gateway/tools-invoke-http-api",
|
||||
"gateway/cli-backends",
|
||||
"gateway/local-models"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
summary: "Model authentication: OAuth, API keys, Claude CLI reuse, and Anthropic setup-token"
|
||||
summary: "Model authentication: OAuth, API keys, and legacy Anthropic setup-token"
|
||||
read_when:
|
||||
- Debugging model auth or OAuth expiry
|
||||
- Documenting authentication or credential storage
|
||||
@@ -9,7 +9,7 @@ title: "Authentication"
|
||||
# Authentication (Model Providers)
|
||||
|
||||
<Note>
|
||||
This page covers **model provider** authentication (API keys, OAuth, Claude CLI reuse, and Anthropic setup-token). For **gateway connection** authentication (token, password, trusted-proxy), see [Configuration](/gateway/configuration) and [Trusted Proxy Auth](/gateway/trusted-proxy-auth).
|
||||
This page covers **model provider** authentication (API keys, OAuth, and legacy Anthropic setup-token). For **gateway connection** authentication (token, password, trusted-proxy), see [Configuration](/gateway/configuration) and [Trusted Proxy Auth](/gateway/trusted-proxy-auth).
|
||||
</Note>
|
||||
|
||||
OpenClaw supports OAuth and API keys for model providers. For always-on gateway
|
||||
@@ -26,8 +26,9 @@ For credential eligibility/reason-code rules used by `models status --probe`, se
|
||||
|
||||
If you’re running a long-lived gateway, start with an API key for your chosen
|
||||
provider.
|
||||
For Anthropic specifically, API key auth is still the most predictable server
|
||||
setup, but OpenClaw also supports reusing a local Claude CLI login.
|
||||
For Anthropic specifically, API key auth is the safe path. Anthropic
|
||||
subscription-style auth inside OpenClaw is the legacy setup-token path and
|
||||
should be treated as an **Extra Usage** path, not a plan-limits path.
|
||||
|
||||
1. Create an API key in your provider console.
|
||||
2. Put it on the **gateway host** (the machine running `openclaw gateway`).
|
||||
@@ -59,17 +60,18 @@ API keys for daemon use: `openclaw onboard`.
|
||||
See [Help](/help) for details on env inheritance (`env.shellEnv`,
|
||||
`~/.openclaw/.env`, systemd/launchd).
|
||||
|
||||
## Anthropic: Claude CLI and token compatibility
|
||||
## Anthropic: legacy token compatibility
|
||||
|
||||
Anthropic setup-token auth is still available in OpenClaw as a supported token
|
||||
path. Anthropic staff has since told us that OpenClaw-style Claude CLI usage is
|
||||
allowed again, so OpenClaw treats Claude CLI reuse and `claude -p` usage as
|
||||
sanctioned for this integration unless Anthropic publishes a new policy. When
|
||||
Claude CLI reuse is available on the host, that is now the preferred path.
|
||||
Anthropic setup-token auth is still available in OpenClaw as a
|
||||
legacy/manual path. Anthropic's public Claude Code docs still cover direct
|
||||
Claude Code terminal use under Claude plans, but Anthropic separately told
|
||||
OpenClaw users that the **OpenClaw** Claude-login path counts as third-party
|
||||
harness usage and requires **Extra Usage** billed separately from the
|
||||
subscription.
|
||||
|
||||
For long-lived gateway hosts, an Anthropic API key is still the most predictable
|
||||
setup. If you want to reuse an existing Claude login on the same host, use the
|
||||
Anthropic Claude CLI path in onboarding/configure.
|
||||
For the clearest setup path, use an Anthropic API key. If you must keep a
|
||||
subscription-style Anthropic path in OpenClaw, use the legacy setup-token path
|
||||
with the expectation that Anthropic treats it as **Extra Usage**.
|
||||
|
||||
Manual token entry (any provider; writes `auth-profiles.json` + updates config):
|
||||
|
||||
@@ -110,13 +112,15 @@ Optional ops scripts (systemd/Termux) are documented here:
|
||||
|
||||
## Anthropic note
|
||||
|
||||
The Anthropic `claude-cli` backend is supported again.
|
||||
The Anthropic `claude-cli` backend was removed.
|
||||
|
||||
- Anthropic staff told us this OpenClaw integration path is allowed again.
|
||||
- OpenClaw therefore treats Claude CLI reuse and `claude -p` usage as sanctioned
|
||||
for Anthropic-backed runs unless Anthropic publishes a new policy.
|
||||
- Anthropic API keys remain the most predictable choice for long-lived gateway
|
||||
hosts and explicit server-side billing control.
|
||||
- Use Anthropic API keys for Anthropic traffic in OpenClaw.
|
||||
- Anthropic setup-token remains a legacy/manual path and should be used with
|
||||
the Extra Usage billing expectation Anthropic communicated to OpenClaw users.
|
||||
- `openclaw doctor` now detects stale removed Anthropic Claude CLI state. If
|
||||
stored credential bytes still exist, doctor converts them back into
|
||||
Anthropic token/OAuth profiles. If not, doctor removes the stale Claude CLI
|
||||
config and points you to API key or setup-token recovery.
|
||||
|
||||
## Checking model auth status
|
||||
|
||||
@@ -154,7 +158,7 @@ Use `/model` (or `/model list`) for a compact picker; use `/model status` for th
|
||||
|
||||
### Per-agent (CLI override)
|
||||
|
||||
Set an explicit auth profile order override for an agent (stored in that agent’s `auth-state.json`):
|
||||
Set an explicit auth profile order override for an agent (stored in that agent’s `auth-profiles.json`):
|
||||
|
||||
```bash
|
||||
openclaw models auth order get --provider anthropic
|
||||
@@ -173,7 +177,7 @@ to one model id rather than the whole provider profile.
|
||||
### "No credentials found"
|
||||
|
||||
If the Anthropic profile is missing, configure an Anthropic API key on the
|
||||
**gateway host** or set up the Anthropic setup-token path, then re-check:
|
||||
**gateway host** or set up the legacy Anthropic setup-token path, then re-check:
|
||||
|
||||
```bash
|
||||
openclaw models status
|
||||
@@ -181,6 +185,17 @@ openclaw models status
|
||||
|
||||
### Token expiring/expired
|
||||
|
||||
Run `openclaw models status` to confirm which profile is expiring. If an
|
||||
Run `openclaw models status` to confirm which profile is expiring. If a legacy
|
||||
Anthropic token profile is missing or expired, refresh that setup via
|
||||
setup-token or migrate to an Anthropic API key.
|
||||
|
||||
If the machine still has stale removed Anthropic Claude CLI state from older
|
||||
builds, run:
|
||||
|
||||
```bash
|
||||
openclaw doctor --yes
|
||||
```
|
||||
|
||||
Doctor converts `anthropic:claude-cli` back to Anthropic token/OAuth when the
|
||||
stored credential bytes still exist. Otherwise it removes stale Claude CLI
|
||||
profile/config/model refs and leaves the next-step guidance.
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
---
|
||||
summary: "CLI backends: local AI CLI fallback with optional MCP tool bridge"
|
||||
read_when:
|
||||
- You want a reliable fallback when API providers fail
|
||||
- You are running Codex CLI or other local AI CLIs and want to reuse them
|
||||
- You want to understand the MCP loopback bridge for CLI backend tool access
|
||||
title: "CLI Backends"
|
||||
---
|
||||
|
||||
# CLI backends (fallback runtime)
|
||||
|
||||
OpenClaw can run **local AI CLIs** as a **text-only fallback** when API providers are down,
|
||||
rate-limited, or temporarily misbehaving. This is intentionally conservative:
|
||||
|
||||
- **OpenClaw tools are not injected directly**, but backends with `bundleMcp: true`
|
||||
can receive gateway tools via a loopback MCP bridge.
|
||||
- **JSONL streaming** for CLIs that support it.
|
||||
- **Sessions are supported** (so follow-up turns stay coherent).
|
||||
- **Images can be passed through** if the CLI accepts image paths.
|
||||
|
||||
This is designed as a **safety net** rather than a primary path. Use it when you
|
||||
want “always works” text responses without relying on external APIs.
|
||||
|
||||
If you want a full harness runtime with ACP session controls, background tasks,
|
||||
thread/conversation binding, and persistent external coding sessions, use
|
||||
[ACP Agents](/tools/acp-agents) instead. CLI backends are not ACP.
|
||||
|
||||
## Beginner-friendly quick start
|
||||
|
||||
You can use Codex CLI **without any config** (the bundled OpenAI plugin
|
||||
registers a default backend):
|
||||
|
||||
```bash
|
||||
openclaw agent --message "hi" --model codex-cli/gpt-5.4
|
||||
```
|
||||
|
||||
If your gateway runs under launchd/systemd and PATH is minimal, add just the
|
||||
command path:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
cliBackends: {
|
||||
"codex-cli": {
|
||||
command: "/opt/homebrew/bin/codex",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
That’s it. No keys, no extra auth config needed beyond the CLI itself.
|
||||
|
||||
If you use a bundled CLI backend as the **primary message provider** on a
|
||||
gateway host, OpenClaw now auto-loads the owning bundled plugin when your config
|
||||
explicitly references that backend in a model ref or under
|
||||
`agents.defaults.cliBackends`.
|
||||
|
||||
## Using it as a fallback
|
||||
|
||||
Add a CLI backend to your fallback list so it only runs when primary models fail:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
model: {
|
||||
primary: "anthropic/claude-opus-4-6",
|
||||
fallbacks: ["codex-cli/gpt-5.4"],
|
||||
},
|
||||
models: {
|
||||
"anthropic/claude-opus-4-6": { alias: "Opus" },
|
||||
"codex-cli/gpt-5.4": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- If you use `agents.defaults.models` (allowlist), you must include your CLI backend models there too.
|
||||
- If the primary provider fails (auth, rate limits, timeouts), OpenClaw will
|
||||
try the CLI backend next.
|
||||
|
||||
## Configuration overview
|
||||
|
||||
All CLI backends live under:
|
||||
|
||||
```
|
||||
agents.defaults.cliBackends
|
||||
```
|
||||
|
||||
Each entry is keyed by a **provider id** (e.g. `codex-cli`, `my-cli`).
|
||||
The provider id becomes the left side of your model ref:
|
||||
|
||||
```
|
||||
<provider>/<model>
|
||||
```
|
||||
|
||||
### Example configuration
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
cliBackends: {
|
||||
"codex-cli": {
|
||||
command: "/opt/homebrew/bin/codex",
|
||||
},
|
||||
"my-cli": {
|
||||
command: "my-cli",
|
||||
args: ["--json"],
|
||||
output: "json",
|
||||
input: "arg",
|
||||
modelArg: "--model",
|
||||
modelAliases: {
|
||||
"claude-opus-4-6": "opus",
|
||||
"claude-sonnet-4-6": "sonnet",
|
||||
},
|
||||
sessionArg: "--session",
|
||||
sessionMode: "existing",
|
||||
sessionIdFields: ["session_id", "conversation_id"],
|
||||
systemPromptArg: "--system",
|
||||
systemPromptWhen: "first",
|
||||
imageArg: "--image",
|
||||
imageMode: "repeat",
|
||||
serialize: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## How it works
|
||||
|
||||
1. **Selects a backend** based on the provider prefix (`codex-cli/...`).
|
||||
2. **Builds a system prompt** using the same OpenClaw prompt + workspace context.
|
||||
3. **Executes the CLI** with a session id (if supported) so history stays consistent.
|
||||
4. **Parses output** (JSON or plain text) and returns the final text.
|
||||
5. **Persists session ids** per backend, so follow-ups reuse the same CLI session.
|
||||
|
||||
<Note>
|
||||
The bundled Anthropic `claude-cli` backend is supported again. Anthropic staff
|
||||
told us OpenClaw-style Claude CLI usage is allowed again, so OpenClaw treats
|
||||
`claude -p` usage as sanctioned for this integration unless Anthropic publishes
|
||||
a new policy.
|
||||
</Note>
|
||||
|
||||
## Sessions
|
||||
|
||||
- If the CLI supports sessions, set `sessionArg` (e.g. `--session-id`) or
|
||||
`sessionArgs` (placeholder `{sessionId}`) when the ID needs to be inserted
|
||||
into multiple flags.
|
||||
- If the CLI uses a **resume subcommand** with different flags, set
|
||||
`resumeArgs` (replaces `args` when resuming) and optionally `resumeOutput`
|
||||
(for non-JSON resumes).
|
||||
- `sessionMode`:
|
||||
- `always`: always send a session id (new UUID if none stored).
|
||||
- `existing`: only send a session id if one was stored before.
|
||||
- `none`: never send a session id.
|
||||
|
||||
Serialization notes:
|
||||
|
||||
- `serialize: true` keeps same-lane runs ordered.
|
||||
- Most CLIs serialize on one provider lane.
|
||||
- OpenClaw drops stored CLI session reuse when the backend auth state changes, including relogin, token rotation, or a changed auth profile credential.
|
||||
|
||||
## Images (pass-through)
|
||||
|
||||
If your CLI accepts image paths, set `imageArg`:
|
||||
|
||||
```json5
|
||||
imageArg: "--image",
|
||||
imageMode: "repeat"
|
||||
```
|
||||
|
||||
OpenClaw will write base64 images to temp files. If `imageArg` is set, those
|
||||
paths are passed as CLI args. If `imageArg` is missing, OpenClaw appends the
|
||||
file paths to the prompt (path injection), which is enough for CLIs that auto-
|
||||
load local files from plain paths.
|
||||
|
||||
## Inputs / outputs
|
||||
|
||||
- `output: "json"` (default) tries to parse JSON and extract text + session id.
|
||||
- For Gemini CLI JSON output, OpenClaw reads reply text from `response` and
|
||||
usage from `stats` when `usage` is missing or empty.
|
||||
- `output: "jsonl"` parses JSONL streams (for example Codex CLI `--json`) and extracts the final agent message plus session
|
||||
identifiers when present.
|
||||
- `output: "text"` treats stdout as the final response.
|
||||
|
||||
Input modes:
|
||||
|
||||
- `input: "arg"` (default) passes the prompt as the last CLI arg.
|
||||
- `input: "stdin"` sends the prompt via stdin.
|
||||
- If the prompt is very long and `maxPromptArgChars` is set, stdin is used.
|
||||
|
||||
## Defaults (plugin-owned)
|
||||
|
||||
The bundled OpenAI plugin also registers a default for `codex-cli`:
|
||||
|
||||
- `command: "codex"`
|
||||
- `args: ["exec","--json","--color","never","--sandbox","workspace-write","--skip-git-repo-check"]`
|
||||
- `resumeArgs: ["exec","resume","{sessionId}","--color","never","--sandbox","workspace-write","--skip-git-repo-check"]`
|
||||
- `output: "jsonl"`
|
||||
- `resumeOutput: "text"`
|
||||
- `modelArg: "--model"`
|
||||
- `imageArg: "--image"`
|
||||
- `sessionMode: "existing"`
|
||||
|
||||
The bundled Google plugin also registers a default for `google-gemini-cli`:
|
||||
|
||||
- `command: "gemini"`
|
||||
- `args: ["--prompt", "--output-format", "json"]`
|
||||
- `resumeArgs: ["--resume", "{sessionId}", "--prompt", "--output-format", "json"]`
|
||||
- `modelArg: "--model"`
|
||||
- `sessionMode: "existing"`
|
||||
- `sessionIdFields: ["session_id", "sessionId"]`
|
||||
|
||||
Prerequisite: the local Gemini CLI must be installed and available as
|
||||
`gemini` on `PATH` (`brew install gemini-cli` or
|
||||
`npm install -g @google/gemini-cli`).
|
||||
|
||||
Gemini CLI JSON notes:
|
||||
|
||||
- Reply text is read from the JSON `response` field.
|
||||
- Usage falls back to `stats` when `usage` is absent or empty.
|
||||
- `stats.cached` is normalized into OpenClaw `cacheRead`.
|
||||
- If `stats.input` is missing, OpenClaw derives input tokens from
|
||||
`stats.input_tokens - stats.cached`.
|
||||
|
||||
Override only if needed (common: absolute `command` path).
|
||||
|
||||
## Plugin-owned defaults
|
||||
|
||||
CLI backend defaults are now part of the plugin surface:
|
||||
|
||||
- Plugins register them with `api.registerCliBackend(...)`.
|
||||
- The backend `id` becomes the provider prefix in model refs.
|
||||
- User config in `agents.defaults.cliBackends.<id>` still overrides the plugin default.
|
||||
- Backend-specific config cleanup stays plugin-owned through the optional
|
||||
`normalizeConfig` hook.
|
||||
|
||||
## Bundle MCP overlays
|
||||
|
||||
CLI backends do **not** receive OpenClaw tool calls directly, but a backend can
|
||||
opt into a generated MCP config overlay with `bundleMcp: true`.
|
||||
|
||||
Current bundled behavior:
|
||||
|
||||
- `codex-cli`: no bundle MCP overlay
|
||||
- `google-gemini-cli`: no bundle MCP overlay
|
||||
|
||||
When bundle MCP is enabled, OpenClaw:
|
||||
|
||||
- spawns a loopback HTTP MCP server that exposes gateway tools to the CLI process
|
||||
- authenticates the bridge with a per-session token (`OPENCLAW_MCP_TOKEN`)
|
||||
- scopes tool access to the current session, account, and channel context
|
||||
- loads enabled bundle-MCP servers for the current workspace
|
||||
- merges them with any existing backend `--mcp-config`
|
||||
- rewrites the CLI args to pass `--strict-mcp-config --mcp-config <generated-file>`
|
||||
|
||||
If no MCP servers are enabled, OpenClaw still injects a strict config when a
|
||||
backend opts into bundle MCP so background runs stay isolated.
|
||||
|
||||
## Limitations
|
||||
|
||||
- **No direct OpenClaw tool calls.** OpenClaw does not inject tool calls into
|
||||
the CLI backend protocol. Backends only see gateway tools when they opt into
|
||||
`bundleMcp: true`.
|
||||
- **Streaming is backend-specific.** Some backends stream JSONL; others buffer
|
||||
until exit.
|
||||
- **Structured outputs** depend on the CLI’s JSON format.
|
||||
- **Codex CLI sessions** resume via text output (no JSONL), which is less
|
||||
structured than the initial `--json` run. OpenClaw sessions still work
|
||||
normally.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **CLI not found**: set `command` to a full path.
|
||||
- **Wrong model name**: use `modelAliases` to map `provider/model` → CLI model.
|
||||
- **No session continuity**: ensure `sessionArg` is set and `sessionMode` is not
|
||||
`none` (Codex CLI currently cannot resume with JSON output).
|
||||
- **Images ignored**: set `imageArg` (and verify CLI supports file paths).
|
||||
@@ -220,7 +220,7 @@ WhatsApp runs through the gateway's web channel (Baileys Web). It starts automat
|
||||
discord: {
|
||||
enabled: true,
|
||||
token: "your-bot-token",
|
||||
mediaMaxMb: 100,
|
||||
mediaMaxMb: 8,
|
||||
allowBots: false,
|
||||
actions: {
|
||||
reactions: true,
|
||||
@@ -646,9 +646,8 @@ Matrix is extension-backed and configured under `channels.matrix`.
|
||||
|
||||
- Token auth uses `accessToken`; password auth uses `userId` + `password`.
|
||||
- `channels.matrix.proxy` routes Matrix HTTP traffic through an explicit HTTP(S) proxy. Named accounts can override it with `channels.matrix.accounts.<id>.proxy`.
|
||||
- `channels.matrix.network.dangerouslyAllowPrivateNetwork` allows private/internal homeservers. `proxy` and this network opt-in are independent controls.
|
||||
- `channels.matrix.allowPrivateNetwork` allows private/internal homeservers. `proxy` and `allowPrivateNetwork` are independent controls.
|
||||
- `channels.matrix.defaultAccount` selects the preferred account in multi-account setups.
|
||||
- `channels.matrix.autoJoin` defaults to `off`, so invited rooms and fresh DM-style invites are ignored until you set `autoJoin: "allowlist"` with `autoJoinAllowlist` or `autoJoin: "always"`.
|
||||
- `channels.matrix.execApprovals`: Matrix-native exec approval delivery and approver authorization.
|
||||
- `enabled`: `true`, `false`, or `"auto"` (default). In auto mode, exec approvals activate when approvers can be resolved from `approvers` or `commands.ownerAllowFrom`.
|
||||
- `approvers`: Matrix user IDs (e.g. `@owner:example.org`) allowed to approve exec requests.
|
||||
@@ -902,18 +901,6 @@ Disables automatic creation of workspace bootstrap files (`AGENTS.md`, `SOUL.md`
|
||||
}
|
||||
```
|
||||
|
||||
### `agents.defaults.contextInjection`
|
||||
|
||||
Controls when workspace bootstrap files are injected into the system prompt. Default: `"always"`.
|
||||
|
||||
- `"continuation-skip"`: safe continuation turns (after a completed assistant response) skip workspace bootstrap re-injection, reducing prompt size. Heartbeat runs and post-compaction retries still rebuild context.
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: { defaults: { contextInjection: "continuation-skip" } },
|
||||
}
|
||||
```
|
||||
|
||||
### `agents.defaults.bootstrapMaxChars`
|
||||
|
||||
Max characters per workspace bootstrap file before truncation. Default: `20000`.
|
||||
@@ -1039,11 +1026,6 @@ Time format in system prompt. Default: `auto` (OS preference).
|
||||
- Typical values: `google/gemini-3.1-flash-image-preview` for native Gemini image generation, `fal/fal-ai/flux/dev` for fal, or `openai/gpt-image-1` for OpenAI Images.
|
||||
- If you select a provider/model directly, configure the matching provider auth/API key too (for example `GEMINI_API_KEY` or `GOOGLE_API_KEY` for `google/*`, `OPENAI_API_KEY` for `openai/*`, `FAL_KEY` for `fal/*`).
|
||||
- If omitted, `image_generate` can still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered image-generation providers in provider-id order.
|
||||
- `musicGenerationModel`: accepts either a string (`"provider/model"`) or an object (`{ primary, fallbacks }`).
|
||||
- Used by the shared music-generation capability and the built-in `music_generate` tool.
|
||||
- Typical values: `google/lyria-3-clip-preview`, `google/lyria-3-pro-preview`, or `minimax/music-2.5+`.
|
||||
- If omitted, `music_generate` can still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered music-generation providers in provider-id order.
|
||||
- If you select a provider/model directly, configure the matching provider auth/API key too.
|
||||
- `videoGenerationModel`: accepts either a string (`"provider/model"`) or an object (`{ primary, fallbacks }`).
|
||||
- Used by the shared video-generation capability and the built-in `video_generate` tool.
|
||||
- Typical values: `qwen/wan2.6-t2v`, `qwen/wan2.6-i2v`, `qwen/wan2.6-r2v`, `qwen/wan2.6-r2v-flash`, or `qwen/wan2.7-r2v`.
|
||||
@@ -1083,37 +1065,6 @@ Z.AI GLM-4.x models automatically enable thinking mode unless you set `--thinkin
|
||||
Z.AI models enable `tool_stream` by default for tool call streaming. Set `agents.defaults.models["zai/<model>"].params.tool_stream` to `false` to disable it.
|
||||
Anthropic Claude 4.6 models default to `adaptive` thinking when no explicit thinking level is set.
|
||||
|
||||
### `agents.defaults.cliBackends`
|
||||
|
||||
Optional CLI backends for text-only fallback runs (no tool calls). Useful as a backup when API providers fail.
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
cliBackends: {
|
||||
"codex-cli": {
|
||||
command: "/opt/homebrew/bin/codex",
|
||||
},
|
||||
"my-cli": {
|
||||
command: "my-cli",
|
||||
args: ["--json"],
|
||||
output: "json",
|
||||
modelArg: "--model",
|
||||
sessionArg: "--session",
|
||||
sessionMode: "existing",
|
||||
systemPromptArg: "--system",
|
||||
systemPromptWhen: "first",
|
||||
imageArg: "--image",
|
||||
imageMode: "repeat",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
- CLI backends are text-first; tools are always disabled.
|
||||
- Sessions supported when `sessionArg` is set.
|
||||
- Image pass-through supported when `imageArg` accepts file paths.
|
||||
|
||||
@@ -2119,9 +2070,6 @@ Configures inbound media understanding (image/audio/video):
|
||||
tools: {
|
||||
media: {
|
||||
concurrency: 2,
|
||||
asyncCompletion: {
|
||||
directSend: false, // opt-in: send finished async music/video directly to the channel
|
||||
},
|
||||
audio: {
|
||||
enabled: true,
|
||||
maxBytes: 20971520,
|
||||
@@ -2165,12 +2113,6 @@ Configures inbound media understanding (image/audio/video):
|
||||
|
||||
Provider auth follows standard order: `auth-profiles.json` → env vars → `models.providers.*.apiKey`.
|
||||
|
||||
**Async completion fields:**
|
||||
|
||||
- `asyncCompletion.directSend`: when `true`, completed async `music_generate`
|
||||
and `video_generate` tasks try direct channel delivery first. Default: `false`
|
||||
(legacy requester-session wake/model-delivery path).
|
||||
|
||||
</Accordion>
|
||||
|
||||
### `tools.agentToAgent`
|
||||
@@ -2669,10 +2611,17 @@ See [Local Models](/gateway/local-models). TL;DR: run a large local model via LM
|
||||
- `plugins.entries.xai.config.xSearch`: xAI X Search (Grok web search) settings.
|
||||
- `enabled`: enable the X Search provider.
|
||||
- `model`: Grok model to use for search (e.g. `"grok-4-1-fast"`).
|
||||
- `plugins.entries.memory-core.config.dreaming`: memory dreaming (experimental) settings. See [Dreaming](/concepts/dreaming) for phases and thresholds.
|
||||
- `enabled`: master dreaming switch (default `false`).
|
||||
- `frequency`: cron cadence for each full dreaming sweep (`"0 3 * * *"` by default).
|
||||
- phase policy and thresholds are implementation details (not user-facing config keys).
|
||||
- `plugins.entries.memory-core.config.dreaming`: memory dreaming (experimental) settings. See [Dreaming](/concepts/dreaming) for modes and thresholds.
|
||||
- `mode`: dreaming cadence preset (`"off"`, `"core"`, `"rem"`, `"deep"`). Default: `"off"`.
|
||||
- `cron`: optional cron expression override for the dreaming schedule.
|
||||
- `timezone`: timezone for schedule evaluation (falls back to `agents.defaults.userTimezone`).
|
||||
- `limit`: maximum candidates to promote per cycle.
|
||||
- `minScore`: minimum weighted score threshold for promotion.
|
||||
- `minRecallCount`: minimum recall count threshold.
|
||||
- `minUniqueQueries`: minimum distinct query count threshold.
|
||||
- `recencyHalfLifeDays`: days for the recency score to decay by half. Default: `14`.
|
||||
- `maxAgeDays`: optional maximum daily-note age in days allowed for promotion.
|
||||
- `verboseLogging`: emit detailed per-run dreaming logs into the normal gateway log stream.
|
||||
- Enabled Claude bundle plugins can also contribute embedded Pi defaults from `settings.json`; OpenClaw applies those as sanitized agent settings, not as raw OpenClaw config patches.
|
||||
- `plugins.slots.memory`: pick the active memory plugin id, or `"none"` to disable memory plugins.
|
||||
- `plugins.slots.contextEngine`: pick the active context engine plugin id; defaults to `"legacy"` unless you install and select another engine.
|
||||
|
||||
@@ -307,11 +307,18 @@ Doctor checks:
|
||||
|
||||
Doctor inspects OAuth profiles in the auth store, warns when tokens are
|
||||
expiring/expired, and can refresh them when safe. If the Anthropic
|
||||
OAuth/token profile is stale, it suggests an Anthropic API key or the
|
||||
OAuth/token profile is stale, it suggests an Anthropic API key or the legacy
|
||||
Anthropic setup-token path.
|
||||
Refresh prompts only appear when running interactively (TTY); `--non-interactive`
|
||||
skips refresh attempts.
|
||||
|
||||
Doctor also detects stale removed Anthropic Claude CLI state. If old
|
||||
`anthropic:claude-cli` credential bytes still exist in `auth-profiles.json`,
|
||||
doctor converts them back into Anthropic token/OAuth profiles and rewrites
|
||||
stale `claude-cli/...` model refs.
|
||||
If the bytes are gone, doctor removes the stale config and prints recovery
|
||||
commands instead.
|
||||
|
||||
Doctor also reports auth profiles that are temporarily unusable due to:
|
||||
|
||||
- short cooldowns (rate limits/timeouts/auth failures)
|
||||
|
||||
@@ -173,7 +173,7 @@ Fallback: SSH tunnel.
|
||||
ssh -N -L 18789:127.0.0.1:18789 user@host
|
||||
```
|
||||
|
||||
Then connect clients locally to `ws://127.0.0.1:18789`.
|
||||
Then connect clients to `ws://127.0.0.1:18789` locally.
|
||||
|
||||
<Warning>
|
||||
SSH tunnels do not bypass gateway auth. For shared-secret auth, clients still
|
||||
|
||||
@@ -50,7 +50,7 @@ Look for:
|
||||
Fix options:
|
||||
|
||||
1. Disable `context1m` for that model to fall back to the normal context window.
|
||||
2. Use an Anthropic credential that is eligible for long-context requests, or switch to an Anthropic API key.
|
||||
2. Use an Anthropic API key with billing, or enable Anthropic Extra Usage on the Anthropic OAuth/subscription account.
|
||||
3. Configure fallback models so runs continue when Anthropic long-context requests are rejected.
|
||||
|
||||
Related:
|
||||
|
||||
127
docs/help/faq.md
127
docs/help/faq.md
@@ -565,7 +565,7 @@ Quick answers plus deeper troubleshooting for real-world setups (local dev, VPS,
|
||||
<Accordion title="What does onboarding actually do?">
|
||||
`openclaw onboard` is the recommended setup path. In **local mode** it walks you through:
|
||||
|
||||
- **Model/auth setup** (provider OAuth, API keys, Anthropic setup-token, plus local model options such as LM Studio)
|
||||
- **Model/auth setup** (provider OAuth, API keys, Anthropic legacy setup-token, plus local model options such as LM Studio)
|
||||
- **Workspace** location + bootstrap files
|
||||
- **Gateway settings** (bind/port/auth/tailscale)
|
||||
- **Channels** (WhatsApp, Telegram, Discord, Mattermost, Signal, iMessage, plus bundled channel plugins like QQ Bot)
|
||||
@@ -584,14 +584,15 @@ Quick answers plus deeper troubleshooting for real-world setups (local dev, VPS,
|
||||
For Anthropic in OpenClaw, the practical split is:
|
||||
|
||||
- **Anthropic API key**: normal Anthropic API billing
|
||||
- **Claude CLI / Claude subscription auth in OpenClaw**: Anthropic staff
|
||||
told us this usage is allowed again, and OpenClaw is treating `claude -p`
|
||||
usage as sanctioned for this integration unless Anthropic publishes a new
|
||||
policy
|
||||
- **Claude subscription auth in OpenClaw**: Anthropic told OpenClaw users on
|
||||
**April 4, 2026 at 12:00 PM PT / 8:00 PM BST** that this requires
|
||||
**Extra Usage** billed separately from the subscription
|
||||
|
||||
For long-lived gateway hosts, Anthropic API keys are still the more
|
||||
predictable setup. OpenAI Codex OAuth is explicitly supported for external
|
||||
tools like OpenClaw.
|
||||
Our local repros also show that `claude -p --append-system-prompt ...` can
|
||||
hit the same Extra Usage guard when the appended prompt identifies
|
||||
OpenClaw, while the same prompt string does **not** reproduce that block on
|
||||
the Anthropic SDK + API-key path. OpenAI Codex OAuth is explicitly
|
||||
supported for external tools like OpenClaw.
|
||||
|
||||
OpenClaw also supports other hosted subscription-style options including
|
||||
**Qwen Cloud Coding Plan**, **MiniMax Coding Plan**, and
|
||||
@@ -605,28 +606,33 @@ Quick answers plus deeper troubleshooting for real-world setups (local dev, VPS,
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Can I use Claude Max subscription without an API key?">
|
||||
Yes.
|
||||
Yes, but treat it as **Claude subscription auth with Extra Usage**.
|
||||
|
||||
Anthropic staff told us OpenClaw-style Claude CLI usage is allowed again, so
|
||||
OpenClaw treats Claude subscription auth and `claude -p` usage as sanctioned
|
||||
for this integration unless Anthropic publishes a new policy. If you want
|
||||
the most predictable server-side setup, use an Anthropic API key instead.
|
||||
Claude Pro/Max subscriptions do not include an API key. In OpenClaw, that
|
||||
means Anthropic's OpenClaw-specific billing notice applies: subscription
|
||||
traffic requires **Extra Usage**. If you want Anthropic traffic without
|
||||
that Extra Usage path, use an Anthropic API key instead.
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Do you support Claude subscription auth (Claude Pro or Max)?">
|
||||
Yes.
|
||||
Yes, but the supported interpretation is now:
|
||||
|
||||
Anthropic staff told us this usage is allowed again, so OpenClaw treats
|
||||
Claude CLI reuse and `claude -p` usage as sanctioned for this integration
|
||||
unless Anthropic publishes a new policy.
|
||||
- Anthropic in OpenClaw with a subscription means **Extra Usage**
|
||||
- Anthropic in OpenClaw without that path means **API key**
|
||||
|
||||
Anthropic setup-token is still available as a supported OpenClaw token path, but OpenClaw now prefers Claude CLI reuse and `claude -p` when available.
|
||||
For production or multi-user workloads, Anthropic API key auth is still the
|
||||
safer, more predictable choice. If you want other subscription-style hosted
|
||||
Anthropic setup-token is still available as a legacy/manual OpenClaw path,
|
||||
and Anthropic's OpenClaw-specific billing notice still applies there. We
|
||||
also reproduced the same billing guard locally with direct
|
||||
`claude -p --append-system-prompt ...` usage when the appended prompt
|
||||
identifies OpenClaw, while the same prompt string did **not** reproduce on
|
||||
the Anthropic SDK + API-key path.
|
||||
|
||||
For production or multi-user workloads, Anthropic API key auth is the
|
||||
safer, recommended choice. If you want other subscription-style hosted
|
||||
options in OpenClaw, see [OpenAI](/providers/openai), [Qwen / Model
|
||||
Cloud](/providers/qwen), [MiniMax](/providers/minimax), and [GLM
|
||||
Models](/providers/glm).
|
||||
Cloud](/providers/qwen), [MiniMax](/providers/minimax), and
|
||||
[GLM Models](/providers/glm).
|
||||
|
||||
</Accordion>
|
||||
|
||||
@@ -657,31 +663,6 @@ for usage/billing and raise limits as needed.
|
||||
OpenClaw supports **OpenAI Code (Codex)** via OAuth (ChatGPT sign-in). Onboarding can run the OAuth flow and will set the default model to `openai-codex/gpt-5.4` when appropriate. See [Model providers](/concepts/model-providers) and [Onboarding (CLI)](/start/wizard).
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Why does ChatGPT GPT-5.4 not unlock openai/gpt-5.4 in OpenClaw?">
|
||||
OpenClaw treats the two routes separately:
|
||||
|
||||
- `openai-codex/gpt-5.4` = ChatGPT/Codex OAuth
|
||||
- `openai/gpt-5.4` = direct OpenAI Platform API
|
||||
|
||||
In OpenClaw, ChatGPT/Codex sign-in is wired to the `openai-codex/*` route,
|
||||
not the direct `openai/*` route. If you want the direct API path in
|
||||
OpenClaw, set `OPENAI_API_KEY` (or the equivalent OpenAI provider config).
|
||||
If you want ChatGPT/Codex sign-in in OpenClaw, use `openai-codex/*`.
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Why can Codex OAuth limits differ from ChatGPT web?">
|
||||
`openai-codex/*` uses the Codex OAuth route, and its usable quota windows are
|
||||
OpenAI-managed and plan-dependent. In practice, those limits can differ from
|
||||
the ChatGPT website/app experience, even when both are tied to the same account.
|
||||
|
||||
OpenClaw can show the currently visible provider usage/quota windows in
|
||||
`openclaw models status`, but it does not invent or normalize ChatGPT-web
|
||||
entitlements into direct API access. If you want the direct OpenAI Platform
|
||||
billing/limit path, use `openai/*` with an API key.
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Do you support OpenAI subscription auth (Codex OAuth)?">
|
||||
Yes. OpenClaw fully supports **OpenAI Code (Codex) subscription OAuth**.
|
||||
OpenAI explicitly allows subscription OAuth usage in external tools/workflows
|
||||
@@ -694,17 +675,11 @@ for usage/billing and raise limits as needed.
|
||||
<Accordion title="How do I set up Gemini CLI OAuth?">
|
||||
Gemini CLI uses a **plugin auth flow**, not a client id or secret in `openclaw.json`.
|
||||
|
||||
Steps:
|
||||
Use the Gemini API provider instead:
|
||||
|
||||
1. Install Gemini CLI locally so `gemini` is on `PATH`
|
||||
- Homebrew: `brew install gemini-cli`
|
||||
- npm: `npm install -g @google/gemini-cli`
|
||||
2. Enable the plugin: `openclaw plugins enable google`
|
||||
3. Login: `openclaw models auth login --provider google-gemini-cli --set-default`
|
||||
4. Default model after login: `google-gemini-cli/gemini-3.1-pro-preview`
|
||||
5. If requests fail, set `GOOGLE_CLOUD_PROJECT` or `GOOGLE_CLOUD_PROJECT_ID` on the gateway host
|
||||
|
||||
This stores OAuth tokens in auth profiles on the gateway host. Details: [Model providers](/concepts/model-providers).
|
||||
1. Enable the plugin: `openclaw plugins enable google`
|
||||
2. Run `openclaw onboard --auth-choice gemini-api-key`
|
||||
3. Set a Google model such as `google/gemini-3.1-pro-preview`
|
||||
|
||||
</Accordion>
|
||||
|
||||
@@ -2338,42 +2313,6 @@ for usage/billing and raise limits as needed.
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="How do I configure fast mode for GPT 5.4?">
|
||||
Use either a session toggle or a config default:
|
||||
|
||||
- **Per session:** send `/fast on` while the session is using `openai/gpt-5.4` or `openai-codex/gpt-5.4`.
|
||||
- **Per model default:** set `agents.defaults.models["openai/gpt-5.4"].params.fastMode` to `true`.
|
||||
- **Codex OAuth too:** if you also use `openai-codex/gpt-5.4`, set the same flag there.
|
||||
|
||||
Example:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
models: {
|
||||
"openai/gpt-5.4": {
|
||||
params: {
|
||||
fastMode: true,
|
||||
},
|
||||
},
|
||||
"openai-codex/gpt-5.4": {
|
||||
params: {
|
||||
fastMode: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
For OpenAI, fast mode maps to `service_tier = "priority"` on supported native Responses requests. Session `/fast` overrides beat config defaults.
|
||||
|
||||
See [Thinking and fast mode](/tools/thinking) and [OpenAI fast mode](/providers/openai#openai-fast-mode).
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title='Why do I see "Model ... is not allowed" and then no reply?'>
|
||||
If `agents.defaults.models` is set, it becomes the **allowlist** for `/model` and any
|
||||
session overrides. Choosing a model that isn't in that list returns:
|
||||
@@ -2670,7 +2609,7 @@ Related: [/concepts/oauth](/concepts/oauth) (OAuth flows, token storage, multi-a
|
||||
for one model can still be usable for a sibling model on the same provider,
|
||||
while billing/disabled windows still block the whole profile.
|
||||
|
||||
You can also set a **per-agent** order override (stored in that agent's `auth-state.json`) via the CLI:
|
||||
You can also set a **per-agent** order override (stored in that agent's `auth-profiles.json`) via the CLI:
|
||||
|
||||
```bash
|
||||
# Defaults to the configured default agent (omit --agent)
|
||||
|
||||
@@ -24,9 +24,8 @@ Most days:
|
||||
|
||||
- Full gate (expected before push): `pnpm build && pnpm check && pnpm test`
|
||||
- Faster local full-suite run on a roomy machine: `pnpm test:max`
|
||||
- Direct Vitest watch loop: `pnpm test:watch`
|
||||
- Direct Vitest watch loop (modern projects config): `pnpm test:watch`
|
||||
- Direct file targeting now routes extension/channel paths too: `pnpm test extensions/discord/src/monitor/message-handler.preflight.test.ts`
|
||||
- Docker-backed QA site: `pnpm qa:lab:up`
|
||||
|
||||
When you touch tests or want extra confidence:
|
||||
|
||||
@@ -47,7 +46,7 @@ Think of the suites as “increasing realism” (and increasing flakiness/cost):
|
||||
### Unit / integration (default)
|
||||
|
||||
- Command: `pnpm test`
|
||||
- Config: ten sequential shard runs (`vitest.full-*.config.ts`) over the existing scoped Vitest projects
|
||||
- Config: native Vitest `projects` via `vitest.config.ts`
|
||||
- Files: core/unit inventories under `src/**/*.test.ts`, `packages/**/*.test.ts`, `test/**/*.test.ts`, and the whitelisted `ui` node tests covered by `vitest.unit.config.ts`
|
||||
- Scope:
|
||||
- Pure unit tests
|
||||
@@ -58,13 +57,8 @@ Think of the suites as “increasing realism” (and increasing flakiness/cost):
|
||||
- No real keys required
|
||||
- Should be fast and stable
|
||||
- Projects note:
|
||||
- Untargeted `pnpm test` now runs eleven smaller shard configs (`core-unit-src`, `core-unit-security`, `core-unit-ui`, `core-unit-support`, `core-support-boundary`, `core-contracts`, `core-bundled`, `core-runtime`, `agentic`, `auto-reply`, `extensions`) instead of one giant native root-project process. This cuts peak RSS on loaded machines and avoids auto-reply/extension work starving unrelated suites.
|
||||
- `pnpm test --watch` still uses the native root `vitest.config.ts` project graph, because a multi-shard watch loop is not practical.
|
||||
- `pnpm test`, `pnpm test:watch`, and `pnpm test:perf:imports` route explicit file/directory targets through scoped lanes first, so `pnpm test extensions/discord/src/monitor/message-handler.preflight.test.ts` avoids paying the full root project startup tax.
|
||||
- `pnpm test:changed` expands changed git paths into the same scoped lanes when the diff only touches routable source/test files; config/setup edits still fall back to the broad root-project rerun.
|
||||
- Selected `plugin-sdk` and `commands` tests also route through dedicated light lanes that skip `test/setup-openclaw-runtime.ts`; stateful/runtime-heavy files stay on the existing lanes.
|
||||
- Selected `plugin-sdk` and `commands` helper source files also map changed-mode runs to explicit sibling tests in those light lanes, so helper edits avoid rerunning the full heavy suite for that directory.
|
||||
- `auto-reply` now has three dedicated buckets: top-level core helpers, top-level `reply.*` integration tests, and the `src/auto-reply/reply/**` subtree. This keeps the heaviest reply harness work off the cheap status/chunk/token tests.
|
||||
- `pnpm test`, `pnpm test:watch`, and `pnpm test:changed` all use the same native Vitest root `projects` config now.
|
||||
- Direct file filters route natively through the root project graph, so `pnpm test extensions/discord/src/monitor/message-handler.preflight.test.ts` works without a custom wrapper.
|
||||
- Embedded runner note:
|
||||
- When you change message-tool discovery inputs or compaction runtime context,
|
||||
keep both levels of coverage.
|
||||
@@ -80,19 +74,17 @@ Think of the suites as “increasing realism” (and increasing flakiness/cost):
|
||||
- Base Vitest config now defaults to `threads`.
|
||||
- The shared Vitest config also fixes `isolate: false` and uses the non-isolated runner across the root projects, e2e, and live configs.
|
||||
- The root UI lane keeps its `jsdom` setup and optimizer, but now runs on the shared non-isolated runner too.
|
||||
- Each `pnpm test` shard inherits the same `threads` + `isolate: false` defaults from the shared Vitest config.
|
||||
- `pnpm test` inherits the same `threads` + `isolate: false` defaults from the root `vitest.config.ts` projects config.
|
||||
- The shared `scripts/run-vitest.mjs` launcher now also adds `--no-maglev` for Vitest child Node processes by default to reduce V8 compile churn during big local runs. Set `OPENCLAW_VITEST_ENABLE_MAGLEV=1` if you need to compare against stock V8 behavior.
|
||||
- Fast-local iteration note:
|
||||
- `pnpm test:changed` routes through scoped lanes when the changed paths map cleanly to a smaller suite.
|
||||
- `pnpm test:max` and `pnpm test:changed:max` keep the same routing behavior, just with a higher worker cap.
|
||||
- `pnpm test:changed` runs the native projects config with `--changed origin/main`.
|
||||
- `pnpm test:max` and `pnpm test:changed:max` keep the same native projects config, just with a higher worker cap.
|
||||
- Local worker auto-scaling is intentionally conservative now and also backs off when the host load average is already high, so multiple concurrent Vitest runs do less damage by default.
|
||||
- The base Vitest config marks the projects/config files as `forceRerunTriggers` so changed-mode reruns stay correct when test wiring changes.
|
||||
- The config keeps `OPENCLAW_VITEST_FS_MODULE_CACHE` enabled on supported hosts; set `OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/abs/path` if you want one explicit cache location for direct profiling.
|
||||
- Perf-debug note:
|
||||
- `pnpm test:perf:imports` enables Vitest import-duration reporting plus import-breakdown output.
|
||||
- `pnpm test:perf:imports:changed` scopes the same profiling view to files changed since `origin/main`.
|
||||
- `pnpm test:perf:changed:bench -- --ref <git-ref>` compares routed `test:changed` against the native root-project path for that committed diff and prints wall time plus macOS max RSS.
|
||||
- `pnpm test:perf:changed:bench -- --worktree` benchmarks the current dirty tree by routing the changed file list through `scripts/test-projects.mjs` and the root Vitest config.
|
||||
- `pnpm test:perf:profile:main` writes a main-thread CPU profile for Vitest/Vite startup and transform overhead.
|
||||
- `pnpm test:perf:profile:runner` writes runner CPU+heap profiles for the unit suite with file parallelism disabled.
|
||||
|
||||
@@ -204,7 +196,7 @@ Live tests are split into two layers so we can isolate failures:
|
||||
- `OPENCLAW_LIVE_MODELS=all` is an alias for the modern allowlist
|
||||
- or `OPENCLAW_LIVE_MODELS="openai/gpt-5.4,anthropic/claude-opus-4-6,..."` (comma allowlist)
|
||||
- How to select providers:
|
||||
- `OPENCLAW_LIVE_PROVIDERS="google,google-antigravity,google-gemini-cli"` (comma allowlist)
|
||||
- `OPENCLAW_LIVE_PROVIDERS="google,google-antigravity"` (comma allowlist)
|
||||
- Where keys come from:
|
||||
- By default: profile store and env fallbacks
|
||||
- Set `OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS=1` to enforce **profile store** only
|
||||
@@ -235,7 +227,7 @@ Live tests are split into two layers so we can isolate failures:
|
||||
- `OPENCLAW_LIVE_GATEWAY_MODELS=all` is an alias for the modern allowlist
|
||||
- Or set `OPENCLAW_LIVE_GATEWAY_MODELS="provider/model"` (or comma list) to narrow
|
||||
- How to select providers (avoid “OpenRouter everything”):
|
||||
- `OPENCLAW_LIVE_GATEWAY_PROVIDERS="google,google-antigravity,google-gemini-cli,openai,anthropic,zai,minimax"` (comma allowlist)
|
||||
- `OPENCLAW_LIVE_GATEWAY_PROVIDERS="google,google-antigravity,openai,anthropic,zai,minimax"` (comma allowlist)
|
||||
- Tool + image probes are always on in this live test:
|
||||
- `read` probe + `exec+read` probe (tool stress)
|
||||
- image probe runs when the model advertises image input support
|
||||
@@ -253,54 +245,6 @@ openclaw models list
|
||||
openclaw models list --json
|
||||
```
|
||||
|
||||
## Live: CLI backend smoke (Claude, Codex, Gemini, or other local CLIs)
|
||||
|
||||
- Test: `src/gateway/gateway-cli-backend.live.test.ts`
|
||||
- Goal: validate the Gateway + agent pipeline using a local CLI backend, without touching your default config.
|
||||
- Backend-specific smoke defaults live with the owning extension's `cli-backend.ts` definition.
|
||||
- Enable:
|
||||
- `pnpm test:live` (or `OPENCLAW_LIVE_TEST=1` if invoking Vitest directly)
|
||||
- `OPENCLAW_LIVE_CLI_BACKEND=1`
|
||||
- Defaults:
|
||||
- Default provider/model: `claude-cli/claude-sonnet-4-6`
|
||||
- Command/args/image behavior come from the owning CLI backend plugin metadata.
|
||||
- Overrides (optional):
|
||||
- `OPENCLAW_LIVE_CLI_BACKEND_MODEL="codex-cli/gpt-5.4"`
|
||||
- `OPENCLAW_LIVE_CLI_BACKEND_COMMAND="/full/path/to/codex"`
|
||||
- `OPENCLAW_LIVE_CLI_BACKEND_ARGS='["exec","--json","--color","never","--sandbox","read-only","--skip-git-repo-check"]'`
|
||||
- `OPENCLAW_LIVE_CLI_BACKEND_IMAGE_PROBE=1` to send a real image attachment (paths are injected into the prompt).
|
||||
- `OPENCLAW_LIVE_CLI_BACKEND_IMAGE_ARG="--image"` to pass image file paths as CLI args instead of prompt injection.
|
||||
- `OPENCLAW_LIVE_CLI_BACKEND_IMAGE_MODE="repeat"` (or `"list"`) to control how image args are passed when `IMAGE_ARG` is set.
|
||||
- `OPENCLAW_LIVE_CLI_BACKEND_RESUME_PROBE=1` to send a second turn and validate resume flow.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
OPENCLAW_LIVE_CLI_BACKEND=1 \
|
||||
OPENCLAW_LIVE_CLI_BACKEND_MODEL="codex-cli/gpt-5.4" \
|
||||
pnpm test:live src/gateway/gateway-cli-backend.live.test.ts
|
||||
```
|
||||
|
||||
Docker recipe:
|
||||
|
||||
```bash
|
||||
pnpm test:docker:live-cli-backend
|
||||
```
|
||||
|
||||
Single-provider Docker recipes:
|
||||
|
||||
```bash
|
||||
pnpm test:docker:live-cli-backend:claude
|
||||
pnpm test:docker:live-cli-backend:codex
|
||||
pnpm test:docker:live-cli-backend:gemini
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- The Docker runner lives at `scripts/test-live-cli-backend-docker.sh`.
|
||||
- It runs the live CLI-backend smoke inside the repo Docker image as the non-root `node` user.
|
||||
- It resolves CLI smoke metadata from the owning extension, then installs the matching Linux CLI package (`@anthropic-ai/claude-code`, `@openai/codex`, or `@google/gemini-cli`) into a cached writable prefix at `OPENCLAW_DOCKER_CLI_TOOLS_DIR` (default: `~/.cache/openclaw/docker-cli-tools`).
|
||||
|
||||
## Live: ACP bind smoke (`/acp spawn ... --bind here`)
|
||||
|
||||
- Test: `src/gateway/gateway-acp-bind.live.test.ts`
|
||||
@@ -313,15 +257,12 @@ Notes:
|
||||
- `pnpm test:live src/gateway/gateway-acp-bind.live.test.ts`
|
||||
- `OPENCLAW_LIVE_ACP_BIND=1`
|
||||
- Defaults:
|
||||
- ACP agents in Docker: `claude,codex,gemini`
|
||||
- ACP agent for direct `pnpm test:live ...`: `claude`
|
||||
- ACP agent: `claude`
|
||||
- Synthetic channel: Slack DM-style conversation context
|
||||
- ACP backend: `acpx`
|
||||
- Overrides:
|
||||
- `OPENCLAW_LIVE_ACP_BIND_AGENT=claude`
|
||||
- `OPENCLAW_LIVE_ACP_BIND_AGENT=codex`
|
||||
- `OPENCLAW_LIVE_ACP_BIND_AGENT=gemini`
|
||||
- `OPENCLAW_LIVE_ACP_BIND_AGENTS=claude,codex,gemini`
|
||||
- `OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND='npx -y @agentclientprotocol/claude-agent-acp@<version>'`
|
||||
- Notes:
|
||||
- This lane uses the gateway `chat.send` surface with admin-only synthetic originating-route fields so tests can attach message-channel context without pretending to deliver externally.
|
||||
@@ -341,20 +282,10 @@ Docker recipe:
|
||||
pnpm test:docker:live-acp-bind
|
||||
```
|
||||
|
||||
Single-agent Docker recipes:
|
||||
|
||||
```bash
|
||||
pnpm test:docker:live-acp-bind:claude
|
||||
pnpm test:docker:live-acp-bind:codex
|
||||
pnpm test:docker:live-acp-bind:gemini
|
||||
```
|
||||
|
||||
Docker notes:
|
||||
|
||||
- The Docker runner lives at `scripts/test-live-acp-bind-docker.sh`.
|
||||
- By default, it runs the ACP bind smoke against all supported live CLI agents in sequence: `claude`, `codex`, then `gemini`.
|
||||
- Use `OPENCLAW_LIVE_ACP_BIND_AGENTS=claude`, `OPENCLAW_LIVE_ACP_BIND_AGENTS=codex`, or `OPENCLAW_LIVE_ACP_BIND_AGENTS=gemini` to narrow the matrix.
|
||||
- It sources `~/.profile`, stages the matching CLI auth material into the container, installs `acpx` into a writable npm prefix, then installs the requested live CLI (`@anthropic-ai/claude-code`, `@openai/codex`, or `@google/gemini-cli`) if missing.
|
||||
- It sources `~/.profile`, stages the matching CLI auth material into the container, installs `acpx` into a writable npm prefix, then installs the requested live CLI (`@anthropic-ai/claude-code` or `@openai/codex`) if missing.
|
||||
- Inside Docker, the runner sets `OPENCLAW_LIVE_ACP_BIND_ACPX_COMMAND=$HOME/.npm-global/bin/acpx` so acpx keeps provider env vars from the sourced profile available to the child harness CLI.
|
||||
|
||||
### Recommended live recipes
|
||||
@@ -378,10 +309,6 @@ Notes:
|
||||
|
||||
- `google/...` uses the Gemini API (API key).
|
||||
- `google-antigravity/...` uses the Antigravity OAuth bridge (Cloud Code Assist-style agent endpoint).
|
||||
- `google-gemini-cli/...` uses the local Gemini CLI on your machine (separate auth + tooling quirks).
|
||||
- Gemini API vs Gemini CLI:
|
||||
- API: OpenClaw calls Google’s hosted Gemini API over HTTP (API key / profile auth); this is what most users mean by “Gemini”.
|
||||
- CLI: OpenClaw shells out to a local `gemini` binary; it has its own auth and can behave differently (streaming/tool support/version skew).
|
||||
|
||||
## Live: model matrix (what we cover)
|
||||
|
||||
@@ -432,7 +359,7 @@ If you have keys enabled, we also support testing via:
|
||||
|
||||
More providers you can include in the live matrix (if you have creds/config):
|
||||
|
||||
- Built-in: `openai`, `openai-codex`, `anthropic`, `google`, `google-vertex`, `google-antigravity`, `google-gemini-cli`, `zai`, `openrouter`, `opencode`, `opencode-go`, `xai`, `groq`, `cerebras`, `mistral`, `github-copilot`
|
||||
- Built-in: `openai`, `openai-codex`, `anthropic`, `google`, `google-vertex`, `google-antigravity`, `zai`, `openrouter`, `opencode`, `opencode-go`, `xai`, `groq`, `cerebras`, `mistral`, `github-copilot`
|
||||
- Via `models.providers` (custom endpoints): `minimax` (cloud/API), plus any OpenAI/Anthropic-compatible proxy (LM Studio, vLLM, LiteLLM, etc.)
|
||||
|
||||
Tip: don’t try to hardcode “all models” in docs. The authoritative list is whatever `discoverModels(...)` returns on your machine + whatever keys are available.
|
||||
@@ -462,20 +389,10 @@ If you want to rely on env keys (e.g. exported in your `~/.profile`), run local
|
||||
- Enable: `BYTEPLUS_API_KEY=... BYTEPLUS_LIVE_TEST=1 pnpm test:live src/agents/byteplus.live.test.ts`
|
||||
- Optional model override: `BYTEPLUS_CODING_MODEL=ark-code-latest`
|
||||
|
||||
## ComfyUI workflow media live
|
||||
|
||||
- Test: `extensions/comfy/comfy.live.test.ts`
|
||||
- Enable: `OPENCLAW_LIVE_TEST=1 COMFY_LIVE_TEST=1 pnpm test:live -- extensions/comfy/comfy.live.test.ts`
|
||||
- Scope:
|
||||
- Exercises the bundled comfy image, video, and `music_generate` paths
|
||||
- Skips each capability unless `models.providers.comfy.<capability>` is configured
|
||||
- Useful after changing comfy workflow submission, polling, downloads, or plugin registration
|
||||
|
||||
## Image generation live
|
||||
|
||||
- Test: `src/image-generation/runtime.live.test.ts`
|
||||
- Command: `pnpm test:live src/image-generation/runtime.live.test.ts`
|
||||
- Harness: `pnpm test:live:media image`
|
||||
- Scope:
|
||||
- Enumerates every registered image-generation provider plugin
|
||||
- Loads missing provider env vars from your login shell (`~/.profile`) before probing
|
||||
@@ -496,75 +413,6 @@ If you want to rely on env keys (e.g. exported in your `~/.profile`), run local
|
||||
- Optional auth behavior:
|
||||
- `OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS=1` to force profile-store auth and ignore env-only overrides
|
||||
|
||||
## Music generation live
|
||||
|
||||
- Test: `extensions/music-generation-providers.live.test.ts`
|
||||
- Enable: `OPENCLAW_LIVE_TEST=1 pnpm test:live -- extensions/music-generation-providers.live.test.ts`
|
||||
- Harness: `pnpm test:live:media music`
|
||||
- Scope:
|
||||
- Exercises the shared bundled music-generation provider path
|
||||
- Currently covers Google and MiniMax
|
||||
- Loads provider env vars from your login shell (`~/.profile`) before probing
|
||||
- Uses live/env API keys ahead of stored auth profiles by default, so stale test keys in `auth-profiles.json` do not mask real shell credentials
|
||||
- Skips providers with no usable auth/profile/model
|
||||
- Runs both declared runtime modes when available:
|
||||
- `generate` with prompt-only input
|
||||
- `edit` when the provider declares `capabilities.edit.enabled`
|
||||
- Current shared-lane coverage:
|
||||
- `google`: `generate`, `edit`
|
||||
- `minimax`: `generate`
|
||||
- `comfy`: separate Comfy live file, not this shared sweep
|
||||
- Optional narrowing:
|
||||
- `OPENCLAW_LIVE_MUSIC_GENERATION_PROVIDERS="google,minimax"`
|
||||
- `OPENCLAW_LIVE_MUSIC_GENERATION_MODELS="google/lyria-3-clip-preview,minimax/music-2.5+"`
|
||||
- Optional auth behavior:
|
||||
- `OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS=1` to force profile-store auth and ignore env-only overrides
|
||||
|
||||
## Video generation live
|
||||
|
||||
- Test: `extensions/video-generation-providers.live.test.ts`
|
||||
- Enable: `OPENCLAW_LIVE_TEST=1 pnpm test:live -- extensions/video-generation-providers.live.test.ts`
|
||||
- Harness: `pnpm test:live:media video`
|
||||
- Scope:
|
||||
- Exercises the shared bundled video-generation provider path
|
||||
- Loads provider env vars from your login shell (`~/.profile`) before probing
|
||||
- Uses live/env API keys ahead of stored auth profiles by default, so stale test keys in `auth-profiles.json` do not mask real shell credentials
|
||||
- Skips providers with no usable auth/profile/model
|
||||
- Runs both declared runtime modes when available:
|
||||
- `generate` with prompt-only input
|
||||
- `imageToVideo` when the provider declares `capabilities.imageToVideo.enabled` and the selected provider/model accepts buffer-backed local image input in the shared sweep
|
||||
- `videoToVideo` when the provider declares `capabilities.videoToVideo.enabled` and the selected provider/model accepts buffer-backed local video input in the shared sweep
|
||||
- Current declared-but-skipped `imageToVideo` providers in the shared sweep:
|
||||
- `vydra` because bundled `veo3` is text-only and bundled `kling` requires a remote image URL
|
||||
- Provider-specific Vydra coverage:
|
||||
- `OPENCLAW_LIVE_TEST=1 OPENCLAW_LIVE_VYDRA_VIDEO=1 pnpm test:live -- extensions/vydra/vydra.live.test.ts`
|
||||
- that file runs `veo3` text-to-video plus a `kling` lane that uses a remote image URL fixture by default
|
||||
- Current `videoToVideo` live coverage:
|
||||
- `runway` only when the selected model is `runway/gen4_aleph`
|
||||
- Current declared-but-skipped `videoToVideo` providers in the shared sweep:
|
||||
- `alibaba`, `qwen`, `xai` because those paths currently require remote `http(s)` / MP4 reference URLs
|
||||
- `google` because the current shared Gemini/Veo lane uses local buffer-backed input and that path is not accepted in the shared sweep
|
||||
- `openai` because the current shared lane lacks org-specific video inpaint/remix access guarantees
|
||||
- Optional narrowing:
|
||||
- `OPENCLAW_LIVE_VIDEO_GENERATION_PROVIDERS="google,openai,runway"`
|
||||
- `OPENCLAW_LIVE_VIDEO_GENERATION_MODELS="google/veo-3.1-fast-generate-preview,openai/sora-2,runway/gen4_aleph"`
|
||||
- Optional auth behavior:
|
||||
- `OPENCLAW_LIVE_REQUIRE_PROFILE_KEYS=1` to force profile-store auth and ignore env-only overrides
|
||||
|
||||
## Media live harness
|
||||
|
||||
- Command: `pnpm test:live:media`
|
||||
- Purpose:
|
||||
- Runs the shared image, music, and video live suites through one repo-native entrypoint
|
||||
- Auto-loads missing provider env vars from `~/.profile`
|
||||
- Auto-narrows each suite to providers that currently have usable auth by default
|
||||
- Reuses `scripts/test-live.mjs`, so heartbeat and quiet-mode behavior stay consistent
|
||||
- Examples:
|
||||
- `pnpm test:live:media`
|
||||
- `pnpm test:live:media image video --providers openai,google,minimax`
|
||||
- `pnpm test:live:media video --video-providers openai,runway --all-providers`
|
||||
- `pnpm test:live:media music --quiet`
|
||||
|
||||
## Docker runners (optional "works in Linux" checks)
|
||||
|
||||
These Docker runners split into two buckets:
|
||||
@@ -584,7 +432,6 @@ The live-model Docker runners also bind-mount only the needed CLI auth homes (or
|
||||
|
||||
- Direct models: `pnpm test:docker:live-models` (script: `scripts/test-live-models-docker.sh`)
|
||||
- ACP bind smoke: `pnpm test:docker:live-acp-bind` (script: `scripts/test-live-acp-bind-docker.sh`)
|
||||
- CLI backend smoke: `pnpm test:docker:live-cli-backend` (script: `scripts/test-live-cli-backend-docker.sh`)
|
||||
- Gateway + dev agent: `pnpm test:docker:live-gateway` (script: `scripts/test-live-gateway-models-docker.sh`)
|
||||
- Open WebUI live smoke: `pnpm test:docker:openwebui` (script: `scripts/e2e/openwebui-docker.sh`)
|
||||
- Onboarding wizard (TTY, full scaffolding): `pnpm test:docker:onboard` (script: `scripts/e2e/onboard-docker.sh`)
|
||||
|
||||
@@ -132,7 +132,6 @@ To return to latest: `git checkout main && git pull`.
|
||||
## If you are stuck
|
||||
|
||||
- Run `openclaw doctor` again and read the output carefully.
|
||||
- For `openclaw update --channel dev` on source checkouts, the updater auto-bootstraps `pnpm` when needed. If you see a pnpm/corepack bootstrap error, install `pnpm` manually (or re-enable `corepack`) and rerun the update.
|
||||
- Check: [Troubleshooting](/gateway/troubleshooting)
|
||||
- Ask in Discord: [https://discord.gg/clawd](https://discord.gg/clawd)
|
||||
|
||||
|
||||
@@ -1,580 +0,0 @@
|
||||
---
|
||||
title: "refactor: Make plugin-sdk a real workspace package incrementally"
|
||||
type: refactor
|
||||
status: active
|
||||
date: 2026-04-05
|
||||
---
|
||||
|
||||
# refactor: Make plugin-sdk a real workspace package incrementally
|
||||
|
||||
## Overview
|
||||
|
||||
This plan introduces a real workspace package for the plugin SDK at
|
||||
`packages/plugin-sdk` and uses it to opt in a small first wave of extensions to
|
||||
compiler-enforced package boundaries. The goal is to make illegal relative
|
||||
imports fail under normal `tsc` for a selected set of bundled provider
|
||||
extensions, without forcing a repo-wide migration or a giant merge-conflict
|
||||
surface.
|
||||
|
||||
The key incremental move is to run two modes in parallel for a while:
|
||||
|
||||
| Mode | Import shape | Who uses it | Enforcement |
|
||||
| ----------- | ------------------------ | ------------------------------------ | -------------------------------------------- |
|
||||
| Legacy mode | `openclaw/plugin-sdk/*` | all existing non-opted-in extensions | current permissive behavior remains |
|
||||
| Opt-in mode | `@openclaw/plugin-sdk/*` | first-wave extensions only | package-local `rootDir` + project references |
|
||||
|
||||
## Problem Frame
|
||||
|
||||
The current repo exports a large public plugin SDK surface, but it is not a real
|
||||
workspace package. Instead:
|
||||
|
||||
- root `tsconfig.json` maps `openclaw/plugin-sdk/*` directly to
|
||||
`src/plugin-sdk/*.ts`
|
||||
- extensions that were not opted into the previous experiment still share that
|
||||
global source-alias behavior
|
||||
- adding `rootDir` only works when allowed SDK imports stop resolving into raw
|
||||
repo source
|
||||
|
||||
That means the repo can describe the desired boundary policy, but TypeScript
|
||||
does not enforce it cleanly for most extensions.
|
||||
|
||||
You want an incremental path that:
|
||||
|
||||
- makes `plugin-sdk` real
|
||||
- moves the SDK toward a workspace package named `@openclaw/plugin-sdk`
|
||||
- changes only about 10 extensions in the first PR
|
||||
- leaves the rest of the extension tree on the old scheme until later cleanup
|
||||
- avoids the `tsconfig.plugin-sdk.dts.json` + postinstall-generated declaration
|
||||
workflow as the primary mechanism for the first-wave rollout
|
||||
|
||||
## Requirements Trace
|
||||
|
||||
- R1. Create a real workspace package for the plugin SDK under `packages/`.
|
||||
- R2. Name the new package `@openclaw/plugin-sdk`.
|
||||
- R3. Give the new SDK package its own `package.json` and `tsconfig.json`.
|
||||
- R4. Keep legacy `openclaw/plugin-sdk/*` imports working for non-opted-in
|
||||
extensions during the migration window.
|
||||
- R5. Opt in only a small first wave of extensions in the first PR.
|
||||
- R6. The first-wave extensions must fail closed for relative imports that leave
|
||||
their package root.
|
||||
- R7. The first-wave extensions must consume the SDK through a package
|
||||
dependency and a TS project reference, not through root `paths` aliases.
|
||||
- R8. The plan must avoid a repo-wide mandatory postinstall generation step for
|
||||
editor correctness.
|
||||
- R9. The first-wave rollout must be reviewable and mergeable as a moderate PR,
|
||||
not a repo-wide 300+ file refactor.
|
||||
|
||||
## Scope Boundaries
|
||||
|
||||
- No full migration of all bundled extensions in the first PR.
|
||||
- No requirement to delete `src/plugin-sdk` in the first PR.
|
||||
- No requirement to rewire every root build or test path to use the new package
|
||||
immediately.
|
||||
- No attempt to force VS Code squiggles for every non-opted-in extension.
|
||||
- No broad lint cleanup for the rest of the extension tree.
|
||||
- No large runtime behavior changes beyond import resolution, package ownership,
|
||||
and boundary enforcement for the opted-in extensions.
|
||||
|
||||
## Context & Research
|
||||
|
||||
### Relevant Code and Patterns
|
||||
|
||||
- `pnpm-workspace.yaml` already includes `packages/*` and `extensions/*`, so a
|
||||
new workspace package under `packages/plugin-sdk` fits the existing repo
|
||||
layout.
|
||||
- Existing workspace packages such as `packages/memory-host-sdk/package.json`
|
||||
and `packages/plugin-package-contract/package.json` already use package-local
|
||||
`exports` maps rooted in `src/*.ts`.
|
||||
- Root `package.json` currently publishes the SDK surface through `./plugin-sdk`
|
||||
and `./plugin-sdk/*` exports backed by `dist/plugin-sdk/*.js` and
|
||||
`dist/plugin-sdk/*.d.ts`.
|
||||
- `src/plugin-sdk/entrypoints.ts` and `scripts/lib/plugin-sdk-entrypoints.json`
|
||||
already act as the canonical entrypoint inventory for the SDK surface.
|
||||
- Root `tsconfig.json` currently maps:
|
||||
- `openclaw/plugin-sdk` -> `src/plugin-sdk/index.ts`
|
||||
- `openclaw/plugin-sdk/*` -> `src/plugin-sdk/*.ts`
|
||||
- The previous boundary experiment showed that package-local `rootDir` works for
|
||||
illegal relative imports only after allowed SDK imports stop resolving to raw
|
||||
source outside the extension package.
|
||||
|
||||
### First-Wave Extension Set
|
||||
|
||||
This plan assumes the first wave is the provider-heavy set that is least likely
|
||||
to drag in complex channel-runtime edge cases:
|
||||
|
||||
- `extensions/anthropic`
|
||||
- `extensions/exa`
|
||||
- `extensions/firecrawl`
|
||||
- `extensions/groq`
|
||||
- `extensions/mistral`
|
||||
- `extensions/openai`
|
||||
- `extensions/perplexity`
|
||||
- `extensions/tavily`
|
||||
- `extensions/together`
|
||||
- `extensions/xai`
|
||||
|
||||
### First-Wave SDK Surface Inventory
|
||||
|
||||
The first-wave extensions currently import a manageable subset of SDK subpaths.
|
||||
The initial `@openclaw/plugin-sdk` package only needs to cover these:
|
||||
|
||||
- `agent-runtime`
|
||||
- `cli-runtime`
|
||||
- `config-runtime`
|
||||
- `core`
|
||||
- `image-generation`
|
||||
- `media-runtime`
|
||||
- `media-understanding`
|
||||
- `plugin-entry`
|
||||
- `plugin-runtime`
|
||||
- `provider-auth`
|
||||
- `provider-auth-api-key`
|
||||
- `provider-auth-login`
|
||||
- `provider-auth-runtime`
|
||||
- `provider-catalog-shared`
|
||||
- `provider-entry`
|
||||
- `provider-http`
|
||||
- `provider-model-shared`
|
||||
- `provider-onboard`
|
||||
- `provider-stream-family`
|
||||
- `provider-stream-shared`
|
||||
- `provider-tools`
|
||||
- `provider-usage`
|
||||
- `provider-web-fetch`
|
||||
- `provider-web-search`
|
||||
- `realtime-transcription`
|
||||
- `realtime-voice`
|
||||
- `runtime-env`
|
||||
- `secret-input`
|
||||
- `security-runtime`
|
||||
- `speech`
|
||||
- `testing`
|
||||
|
||||
### Institutional Learnings
|
||||
|
||||
- No relevant `docs/solutions/` entries were present in this worktree.
|
||||
|
||||
### External References
|
||||
|
||||
- No external research was needed for this plan. The repo already contains the
|
||||
relevant workspace-package and SDK-export patterns.
|
||||
|
||||
## Key Technical Decisions
|
||||
|
||||
- Introduce `@openclaw/plugin-sdk` as a new workspace package while keeping the
|
||||
legacy root `openclaw/plugin-sdk/*` surface alive during migration.
|
||||
Rationale: this lets a first-wave extension set move onto real package
|
||||
resolution without forcing every extension and every root build path to change
|
||||
at once.
|
||||
|
||||
- Use a dedicated opt-in boundary base config such as
|
||||
`extensions/tsconfig.package-boundary.base.json` instead of replacing the
|
||||
existing extension base for everyone.
|
||||
Rationale: the repo needs to support both legacy and opt-in extension modes
|
||||
simultaneously during migration.
|
||||
|
||||
- Use TS project references from first-wave extensions to
|
||||
`packages/plugin-sdk/tsconfig.json` and set
|
||||
`disableSourceOfProjectReferenceRedirect` for the opt-in boundary mode.
|
||||
Rationale: this gives `tsc` a real package graph while discouraging editor and
|
||||
compiler fallback to raw source traversal.
|
||||
|
||||
- Keep `@openclaw/plugin-sdk` private in the first wave.
|
||||
Rationale: the immediate goal is internal boundary enforcement and migration
|
||||
safety, not publishing a second external SDK contract before the surface is
|
||||
stable.
|
||||
|
||||
- Move only the first-wave SDK subpaths in the first implementation slice, and
|
||||
keep compatibility bridges for the rest.
|
||||
Rationale: physically moving all 315 `src/plugin-sdk/*.ts` files in one PR is
|
||||
exactly the merge-conflict surface this plan is trying to avoid.
|
||||
|
||||
- Do not rely on `scripts/postinstall-bundled-plugins.mjs` to build SDK
|
||||
declarations for the first wave.
|
||||
Rationale: explicit build/reference flows are easier to reason about and keep
|
||||
repo behavior more predictable.
|
||||
|
||||
## Open Questions
|
||||
|
||||
### Resolved During Planning
|
||||
|
||||
- Which extensions should be in the first wave?
|
||||
Use the 10 provider/web-search extensions listed above because they are more
|
||||
structurally isolated than the heavier channel packages.
|
||||
|
||||
- Should the first PR replace the entire extension tree?
|
||||
No. The first PR should support two modes in parallel and only opt in the
|
||||
first wave.
|
||||
|
||||
- Should the first wave require a postinstall declaration build?
|
||||
No. The package/reference graph should be explicit, and CI should run the
|
||||
relevant package-local typecheck intentionally.
|
||||
|
||||
### Deferred to Implementation
|
||||
|
||||
- Whether the first-wave package can point directly at package-local `src/*.ts`
|
||||
via project references alone, or whether a small declaration-emission step is
|
||||
still required for the `@openclaw/plugin-sdk` package.
|
||||
This is an implementation-owned TS graph validation question.
|
||||
|
||||
- Whether the root `openclaw` package should proxy first-wave SDK subpaths to
|
||||
`packages/plugin-sdk` outputs immediately or continue using generated
|
||||
compatibility shims under `src/plugin-sdk`.
|
||||
This is a compatibility and build-shape detail that depends on the minimal
|
||||
implementation path that keeps CI green.
|
||||
|
||||
## High-Level Technical Design
|
||||
|
||||
> This illustrates the intended approach and is directional guidance for review, not implementation specification. The implementing agent should treat it as context, not code to reproduce.
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph Legacy["Legacy extensions (unchanged)"]
|
||||
L1["extensions/*\nopenclaw/plugin-sdk/*"]
|
||||
L2["root tsconfig paths"]
|
||||
L1 --> L2
|
||||
L2 --> L3["src/plugin-sdk/*"]
|
||||
end
|
||||
|
||||
subgraph OptIn["First-wave extensions"]
|
||||
O1["10 opted-in extensions"]
|
||||
O2["extensions/tsconfig.package-boundary.base.json"]
|
||||
O3["rootDir = '.'\nproject reference"]
|
||||
O4["@openclaw/plugin-sdk"]
|
||||
O1 --> O2
|
||||
O2 --> O3
|
||||
O3 --> O4
|
||||
end
|
||||
|
||||
subgraph SDK["New workspace package"]
|
||||
P1["packages/plugin-sdk/package.json"]
|
||||
P2["packages/plugin-sdk/tsconfig.json"]
|
||||
P3["packages/plugin-sdk/src/<first-wave-subpaths>.ts"]
|
||||
P1 --> P2
|
||||
P2 --> P3
|
||||
end
|
||||
|
||||
O4 --> SDK
|
||||
```
|
||||
|
||||
## Implementation Units
|
||||
|
||||
- [ ] **Unit 1: Introduce the real `@openclaw/plugin-sdk` workspace package**
|
||||
|
||||
**Goal:** Create a real workspace package for the SDK that can own the
|
||||
first-wave subpath surface without forcing a repo-wide migration.
|
||||
|
||||
**Requirements:** R1, R2, R3, R8, R9
|
||||
|
||||
**Dependencies:** None
|
||||
|
||||
**Files:**
|
||||
|
||||
- Create: `packages/plugin-sdk/package.json`
|
||||
- Create: `packages/plugin-sdk/tsconfig.json`
|
||||
- Create: `packages/plugin-sdk/src/index.ts`
|
||||
- Create: `packages/plugin-sdk/src/*.ts` for the first-wave SDK subpaths
|
||||
- Modify: `pnpm-workspace.yaml` only if package-glob adjustments are needed
|
||||
- Modify: `package.json`
|
||||
- Modify: `src/plugin-sdk/entrypoints.ts`
|
||||
- Modify: `scripts/lib/plugin-sdk-entrypoints.json`
|
||||
- Test: `src/plugins/contracts/plugin-sdk-workspace-package.contract.test.ts`
|
||||
|
||||
**Approach:**
|
||||
|
||||
- Add a new workspace package named `@openclaw/plugin-sdk`.
|
||||
- Start with the first-wave SDK subpaths only, not the entire 315-file tree.
|
||||
- If directly moving a first-wave entrypoint would create an oversized diff, the
|
||||
first PR may introduce that subpath in `packages/plugin-sdk/src` as a thin
|
||||
package wrapper first and then flip the source of truth to the package in a
|
||||
follow-up PR for that subpath cluster.
|
||||
- Reuse the existing entrypoint inventory machinery so the first-wave package
|
||||
surface is declared in one canonical place.
|
||||
- Keep the root package exports alive for legacy users while the workspace
|
||||
package becomes the new opt-in contract.
|
||||
|
||||
**Patterns to follow:**
|
||||
|
||||
- `packages/memory-host-sdk/package.json`
|
||||
- `packages/plugin-package-contract/package.json`
|
||||
- `src/plugin-sdk/entrypoints.ts`
|
||||
|
||||
**Test scenarios:**
|
||||
|
||||
- Happy path: the workspace package exports every first-wave subpath listed in
|
||||
the plan and no required first-wave export is missing.
|
||||
- Edge case: package export metadata remains stable when the first-wave entry
|
||||
list is re-generated or compared against the canonical inventory.
|
||||
- Integration: root package legacy SDK exports remain present after introducing
|
||||
the new workspace package.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- The repo contains a valid `@openclaw/plugin-sdk` workspace package with a
|
||||
stable first-wave export map and no legacy export regression in root
|
||||
`package.json`.
|
||||
|
||||
- [ ] **Unit 2: Add an opt-in TS boundary mode for package-enforced extensions**
|
||||
|
||||
**Goal:** Define the TS configuration mode that opted-in extensions will use,
|
||||
while leaving the existing extension TS behavior unchanged for everyone else.
|
||||
|
||||
**Requirements:** R4, R6, R7, R8, R9
|
||||
|
||||
**Dependencies:** Unit 1
|
||||
|
||||
**Files:**
|
||||
|
||||
- Create: `extensions/tsconfig.package-boundary.base.json`
|
||||
- Create: `tsconfig.boundary-optin.json`
|
||||
- Modify: `extensions/xai/tsconfig.json`
|
||||
- Modify: `extensions/openai/tsconfig.json`
|
||||
- Modify: `extensions/anthropic/tsconfig.json`
|
||||
- Modify: `extensions/mistral/tsconfig.json`
|
||||
- Modify: `extensions/groq/tsconfig.json`
|
||||
- Modify: `extensions/together/tsconfig.json`
|
||||
- Modify: `extensions/perplexity/tsconfig.json`
|
||||
- Modify: `extensions/tavily/tsconfig.json`
|
||||
- Modify: `extensions/exa/tsconfig.json`
|
||||
- Modify: `extensions/firecrawl/tsconfig.json`
|
||||
- Test: `src/plugins/contracts/extension-package-project-boundaries.test.ts`
|
||||
- Test: `test/extension-package-tsc-boundary.test.ts`
|
||||
|
||||
**Approach:**
|
||||
|
||||
- Leave `extensions/tsconfig.base.json` in place for legacy extensions.
|
||||
- Add a new opt-in base config that:
|
||||
- sets `rootDir: "."`
|
||||
- references `packages/plugin-sdk`
|
||||
- enables `composite`
|
||||
- disables project-reference source redirect when needed
|
||||
- Add a dedicated solution config for the first-wave typecheck graph instead of
|
||||
reshaping the root repo TS project in the same PR.
|
||||
|
||||
**Execution note:** Start with a failing package-local canary typecheck for one
|
||||
opted-in extension before applying the pattern to all 10.
|
||||
|
||||
**Patterns to follow:**
|
||||
|
||||
- Existing package-local extension `tsconfig.json` pattern from the prior
|
||||
boundary work
|
||||
- Workspace package pattern from `packages/memory-host-sdk`
|
||||
|
||||
**Test scenarios:**
|
||||
|
||||
- Happy path: each opted-in extension typechecks successfully through the
|
||||
package-boundary TS config.
|
||||
- Error path: a canary relative import from `../../src/cli/acp-cli.ts` fails
|
||||
with `TS6059` for an opted-in extension.
|
||||
- Integration: non-opted-in extensions remain untouched and do not need to
|
||||
participate in the new solution config.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- There is a dedicated typecheck graph for the 10 opted-in extensions, and bad
|
||||
relative imports from one of them fail through normal `tsc`.
|
||||
|
||||
- [ ] **Unit 3: Migrate the first-wave extensions onto `@openclaw/plugin-sdk`**
|
||||
|
||||
**Goal:** Change the first-wave extensions to consume the real SDK package
|
||||
through dependency metadata, project references, and package-name imports.
|
||||
|
||||
**Requirements:** R5, R6, R7, R9
|
||||
|
||||
**Dependencies:** Unit 2
|
||||
|
||||
**Files:**
|
||||
|
||||
- Modify: `extensions/anthropic/package.json`
|
||||
- Modify: `extensions/exa/package.json`
|
||||
- Modify: `extensions/firecrawl/package.json`
|
||||
- Modify: `extensions/groq/package.json`
|
||||
- Modify: `extensions/mistral/package.json`
|
||||
- Modify: `extensions/openai/package.json`
|
||||
- Modify: `extensions/perplexity/package.json`
|
||||
- Modify: `extensions/tavily/package.json`
|
||||
- Modify: `extensions/together/package.json`
|
||||
- Modify: `extensions/xai/package.json`
|
||||
- Modify: production and test imports under each of the 10 extension roots that
|
||||
currently reference `openclaw/plugin-sdk/*`
|
||||
|
||||
**Approach:**
|
||||
|
||||
- Add `@openclaw/plugin-sdk: workspace:*` to the first-wave extension
|
||||
`devDependencies`.
|
||||
- Replace `openclaw/plugin-sdk/*` imports in those packages with
|
||||
`@openclaw/plugin-sdk/*`.
|
||||
- Keep local extension-internal imports on local barrels such as `./api.ts` and
|
||||
`./runtime-api.ts`.
|
||||
- Do not change non-opted-in extensions in this PR.
|
||||
|
||||
**Patterns to follow:**
|
||||
|
||||
- Existing extension-local import barrels (`api.ts`, `runtime-api.ts`)
|
||||
- Package dependency shape used by other `@openclaw/*` workspace packages
|
||||
|
||||
**Test scenarios:**
|
||||
|
||||
- Happy path: each migrated extension still registers/loads through its existing
|
||||
plugin tests after the import rewrite.
|
||||
- Edge case: test-only SDK imports in the opted-in extension set still resolve
|
||||
correctly through the new package.
|
||||
- Integration: migrated extensions do not require root `openclaw/plugin-sdk/*`
|
||||
aliases for typechecking.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- The first-wave extensions build and test against `@openclaw/plugin-sdk`
|
||||
without needing the legacy root SDK alias path.
|
||||
|
||||
- [ ] **Unit 4: Preserve legacy compatibility while the migration is partial**
|
||||
|
||||
**Goal:** Keep the rest of the repo working while the SDK exists in both legacy
|
||||
and new-package forms during migration.
|
||||
|
||||
**Requirements:** R4, R8, R9
|
||||
|
||||
**Dependencies:** Units 1-3
|
||||
|
||||
**Files:**
|
||||
|
||||
- Modify: `src/plugin-sdk/*.ts` for first-wave compatibility shims as needed
|
||||
- Modify: `package.json`
|
||||
- Modify: build or export plumbing that assembles SDK artifacts
|
||||
- Test: `src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts`
|
||||
- Test: `src/plugins/contracts/plugin-sdk-index.bundle.test.ts`
|
||||
|
||||
**Approach:**
|
||||
|
||||
- Keep root `openclaw/plugin-sdk/*` as the compatibility surface for legacy
|
||||
extensions and for external consumers that are not moving yet.
|
||||
- Use either generated shims or root-export proxy wiring for the first-wave
|
||||
subpaths that have moved into `packages/plugin-sdk`.
|
||||
- Do not attempt to retire the root SDK surface in this phase.
|
||||
|
||||
**Patterns to follow:**
|
||||
|
||||
- Existing root SDK export generation via `src/plugin-sdk/entrypoints.ts`
|
||||
- Existing package export compatibility in root `package.json`
|
||||
|
||||
**Test scenarios:**
|
||||
|
||||
- Happy path: a legacy root SDK import still resolves for a non-opted-in
|
||||
extension after the new package exists.
|
||||
- Edge case: a first-wave subpath works through both the legacy root surface and
|
||||
the new package surface during the migration window.
|
||||
- Integration: plugin-sdk index/bundle contract tests continue to see a coherent
|
||||
public surface.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- The repo supports both legacy and opt-in SDK consumption modes without
|
||||
breaking unchanged extensions.
|
||||
|
||||
- [ ] **Unit 5: Add scoped enforcement and document the migration contract**
|
||||
|
||||
**Goal:** Land CI and contributor guidance that enforce the new behavior for the
|
||||
first wave without pretending the entire extension tree is migrated.
|
||||
|
||||
**Requirements:** R5, R6, R8, R9
|
||||
|
||||
**Dependencies:** Units 1-4
|
||||
|
||||
**Files:**
|
||||
|
||||
- Modify: `package.json`
|
||||
- Modify: CI workflow files that should run the opt-in boundary typecheck
|
||||
- Modify: `AGENTS.md`
|
||||
- Modify: `docs/plugins/sdk-overview.md`
|
||||
- Modify: `docs/plugins/sdk-entrypoints.md`
|
||||
- Modify: `docs/plans/2026-04-05-001-refactor-extension-package-resolution-boundary-plan.md`
|
||||
|
||||
**Approach:**
|
||||
|
||||
- Add an explicit first-wave gate, such as a dedicated `tsc -b` solution run for
|
||||
`packages/plugin-sdk` plus the 10 opted-in extensions.
|
||||
- Document that the repo now supports both legacy and opt-in extension modes,
|
||||
and that new extension boundary work should prefer the new package route.
|
||||
- Record the next-wave migration rule so later PRs can add more extensions
|
||||
without re-litigating the architecture.
|
||||
|
||||
**Patterns to follow:**
|
||||
|
||||
- Existing contract tests under `src/plugins/contracts/`
|
||||
- Existing docs updates that explain staged migrations
|
||||
|
||||
**Test scenarios:**
|
||||
|
||||
- Happy path: the new first-wave typecheck gate passes for the workspace package
|
||||
and the opted-in extensions.
|
||||
- Error path: introducing a new illegal relative import in an opted-in
|
||||
extension fails the scoped typecheck gate.
|
||||
- Integration: CI does not require non-opted-in extensions to satisfy the new
|
||||
package-boundary mode yet.
|
||||
|
||||
**Verification:**
|
||||
|
||||
- The first-wave enforcement path is documented, tested, and runnable without
|
||||
forcing the entire extension tree to migrate.
|
||||
|
||||
## System-Wide Impact
|
||||
|
||||
- **Interaction graph:** this work touches the SDK source-of-truth, root package
|
||||
exports, extension package metadata, TS graph layout, and CI verification.
|
||||
- **Error propagation:** the main intended failure mode becomes compile-time TS
|
||||
errors (`TS6059`) in opted-in extensions instead of custom script-only
|
||||
failures.
|
||||
- **State lifecycle risks:** dual-surface migration introduces drift risk between
|
||||
root compatibility exports and the new workspace package.
|
||||
- **API surface parity:** first-wave subpaths must remain semantically identical
|
||||
through both `openclaw/plugin-sdk/*` and `@openclaw/plugin-sdk/*` during the
|
||||
transition.
|
||||
- **Integration coverage:** unit tests are not enough; scoped package-graph
|
||||
typechecks are required to prove the boundary.
|
||||
- **Unchanged invariants:** non-opted-in extensions keep their current behavior
|
||||
in PR 1. This plan does not claim repo-wide import-boundary enforcement.
|
||||
|
||||
## Risks & Dependencies
|
||||
|
||||
| Risk | Mitigation |
|
||||
| ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
||||
| The first-wave package still resolves back into raw source and `rootDir` does not actually fail closed | Make the first implementation step a package-reference canary on one opted-in extension before widening to the full set |
|
||||
| Moving too much SDK source at once recreates the original merge-conflict problem | Move only the first-wave subpaths in the first PR and keep root compatibility bridges |
|
||||
| Legacy and new SDK surfaces drift semantically | Keep a single entrypoint inventory, add compatibility contract tests, and make dual-surface parity explicit |
|
||||
| Root repo build/test paths accidentally start depending on the new package in uncontrolled ways | Use a dedicated opt-in solution config and keep root-wide TS topology changes out of the first PR |
|
||||
|
||||
## Phased Delivery
|
||||
|
||||
### Phase 1
|
||||
|
||||
- Introduce `@openclaw/plugin-sdk`
|
||||
- Define the first-wave subpath surface
|
||||
- Prove one opted-in extension can fail closed through `rootDir`
|
||||
|
||||
### Phase 2
|
||||
|
||||
- Opt in the 10 first-wave extensions
|
||||
- Keep root compatibility alive for everyone else
|
||||
|
||||
### Phase 3
|
||||
|
||||
- Add more extensions in later PRs
|
||||
- Move more SDK subpaths into the workspace package
|
||||
- Retire root compatibility only after the legacy extension set is gone
|
||||
|
||||
## Documentation / Operational Notes
|
||||
|
||||
- The first PR should explicitly describe itself as a dual-mode migration, not a
|
||||
repo-wide enforcement completion.
|
||||
- The migration guide should make it easy for later PRs to add more extensions
|
||||
by following the same package/dependency/reference pattern.
|
||||
|
||||
## Sources & References
|
||||
|
||||
- Prior plan: `docs/plans/2026-04-05-001-refactor-extension-package-resolution-boundary-plan.md`
|
||||
- Workspace config: `pnpm-workspace.yaml`
|
||||
- Existing SDK entrypoint inventory: `src/plugin-sdk/entrypoints.ts`
|
||||
- Existing root SDK exports: `package.json`
|
||||
- Existing workspace package patterns:
|
||||
- `packages/memory-host-sdk/package.json`
|
||||
- `packages/plugin-package-contract/package.json`
|
||||
@@ -161,22 +161,6 @@ export OPENCLAW_APNS_KEY_ID="KEYID"
|
||||
export OPENCLAW_APNS_PRIVATE_KEY_P8="$(cat /path/to/AuthKey_KEYID.p8)"
|
||||
```
|
||||
|
||||
These are gateway-host runtime env vars, not Fastlane settings. `apps/ios/fastlane/.env` only stores
|
||||
App Store Connect / TestFlight auth such as `ASC_KEY_ID` and `ASC_ISSUER_ID`; it does not configure
|
||||
direct APNs delivery for local iOS builds.
|
||||
|
||||
Recommended gateway-host storage:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.openclaw/credentials/apns
|
||||
chmod 700 ~/.openclaw/credentials/apns
|
||||
mv /path/to/AuthKey_KEYID.p8 ~/.openclaw/credentials/apns/AuthKey_KEYID.p8
|
||||
chmod 600 ~/.openclaw/credentials/apns/AuthKey_KEYID.p8
|
||||
export OPENCLAW_APNS_PRIVATE_KEY_PATH="$HOME/.openclaw/credentials/apns/AuthKey_KEYID.p8"
|
||||
```
|
||||
|
||||
Do not commit the `.p8` file or place it under the repo checkout.
|
||||
|
||||
## Discovery paths
|
||||
|
||||
### Bonjour (LAN)
|
||||
|
||||
@@ -30,13 +30,11 @@ native OpenClaw plugin registers against one or more capability types:
|
||||
| Capability | Registration method | Example plugins |
|
||||
| ---------------------- | ------------------------------------------------ | ------------------------------------ |
|
||||
| Text inference | `api.registerProvider(...)` | `openai`, `anthropic` |
|
||||
| CLI inference backend | `api.registerCliBackend(...)` | `openai`, `anthropic` |
|
||||
| Speech | `api.registerSpeechProvider(...)` | `elevenlabs`, `microsoft` |
|
||||
| Realtime transcription | `api.registerRealtimeTranscriptionProvider(...)` | `openai` |
|
||||
| Realtime voice | `api.registerRealtimeVoiceProvider(...)` | `openai` |
|
||||
| Media understanding | `api.registerMediaUnderstandingProvider(...)` | `openai`, `google` |
|
||||
| Image generation | `api.registerImageGenerationProvider(...)` | `openai`, `google`, `fal`, `minimax` |
|
||||
| Music generation | `api.registerMusicGenerationProvider(...)` | `google`, `minimax` |
|
||||
| Video generation | `api.registerVideoGenerationProvider(...)` | `qwen` |
|
||||
| Web fetch | `api.registerWebFetchProvider(...)` | `firecrawl` |
|
||||
| Web search | `api.registerWebSearchProvider(...)` | `google` |
|
||||
@@ -609,16 +607,14 @@ conversation, and it runs after core approval handling finishes.
|
||||
|
||||
Provider plugins now have two layers:
|
||||
|
||||
- manifest metadata: `providerAuthEnvVars` for cheap provider env-auth lookup
|
||||
before runtime load, `channelEnvVars` for cheap channel env/setup lookup
|
||||
before runtime load, plus `providerAuthChoices` for cheap onboarding/auth-choice
|
||||
- manifest metadata: `providerAuthEnvVars` for cheap env-auth lookup before
|
||||
runtime load, plus `providerAuthChoices` for cheap onboarding/auth-choice
|
||||
labels and CLI flag metadata before runtime load
|
||||
- config-time hooks: `catalog` / legacy `discovery` plus `applyConfigDefaults`
|
||||
- runtime hooks: `normalizeModelId`, `normalizeTransport`,
|
||||
`normalizeConfig`,
|
||||
`applyNativeStreamingUsageCompat`, `resolveConfigApiKey`,
|
||||
`resolveSyntheticAuth`, `resolveExternalAuthProfiles`,
|
||||
`shouldDeferSyntheticProfileAuth`,
|
||||
`resolveSyntheticAuth`, `shouldDeferSyntheticProfileAuth`,
|
||||
`resolveDynamicModel`, `prepareDynamicModel`, `normalizeResolvedModel`,
|
||||
`contributeResolvedModelCompat`, `capabilities`,
|
||||
`normalizeToolSchemas`, `inspectToolSchemas`,
|
||||
@@ -646,62 +642,57 @@ one-flag auth wiring without loading provider runtime. Keep provider runtime
|
||||
`envVars` for operator-facing hints such as onboarding labels or OAuth
|
||||
client-id/client-secret setup vars.
|
||||
|
||||
Use manifest `channelEnvVars` when a channel has env-driven auth or setup that
|
||||
generic shell-env fallback, config/status checks, or setup prompts should see
|
||||
without loading channel runtime.
|
||||
|
||||
### Hook order and usage
|
||||
|
||||
For model/provider plugins, OpenClaw calls hooks in this rough order.
|
||||
The "When to use" column is the quick decision guide.
|
||||
|
||||
| # | Hook | What it does | When to use |
|
||||
| --- | --------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 1 | `catalog` | Publish provider config into `models.providers` during `models.json` generation | Provider owns a catalog or base URL defaults |
|
||||
| 2 | `applyConfigDefaults` | Apply provider-owned global config defaults during config materialization | Defaults depend on auth mode, env, or provider model-family semantics |
|
||||
| -- | _(built-in model lookup)_ | OpenClaw tries the normal registry/catalog path first | _(not a plugin hook)_ |
|
||||
| 3 | `normalizeModelId` | Normalize legacy or preview model-id aliases before lookup | Provider owns alias cleanup before canonical model resolution |
|
||||
| 4 | `normalizeTransport` | Normalize provider-family `api` / `baseUrl` before generic model assembly | Provider owns transport cleanup for custom provider ids in the same transport family |
|
||||
| 5 | `normalizeConfig` | Normalize `models.providers.<id>` before runtime/provider resolution | Provider needs config cleanup that should live with the plugin; bundled Google-family helpers also backstop supported Google config entries |
|
||||
| 6 | `applyNativeStreamingUsageCompat` | Apply native streaming-usage compat rewrites to config providers | Provider needs endpoint-driven native streaming usage metadata fixes |
|
||||
| 7 | `resolveConfigApiKey` | Resolve env-marker auth for config providers before runtime auth loading | Provider has provider-owned env-marker API-key resolution; `amazon-bedrock` also has a built-in AWS env-marker resolver here |
|
||||
| 8 | `resolveSyntheticAuth` | Surface local/self-hosted or config-backed auth without persisting plaintext | Provider can operate with a synthetic/local credential marker |
|
||||
| 9 | `resolveExternalAuthProfiles` | Overlay provider-owned external auth profiles; default `persistence` is `runtime-only` for CLI/app-owned creds | Provider reuses external auth credentials without persisting copied refresh tokens |
|
||||
| 10 | `shouldDeferSyntheticProfileAuth` | Lower stored synthetic profile placeholders behind env/config-backed auth | Provider stores synthetic placeholder profiles that should not win precedence |
|
||||
| 11 | `resolveDynamicModel` | Sync fallback for provider-owned model ids not in the local registry yet | Provider accepts arbitrary upstream model ids |
|
||||
| 12 | `prepareDynamicModel` | Async warm-up, then `resolveDynamicModel` runs again | Provider needs network metadata before resolving unknown ids |
|
||||
| 13 | `normalizeResolvedModel` | Final rewrite before the embedded runner uses the resolved model | Provider needs transport rewrites but still uses a core transport |
|
||||
| 14 | `contributeResolvedModelCompat` | Contribute compat flags for vendor models behind another compatible transport | Provider recognizes its own models on proxy transports without taking over the provider |
|
||||
| 15 | `capabilities` | Provider-owned transcript/tooling metadata used by shared core logic | Provider needs transcript/provider-family quirks |
|
||||
| 16 | `normalizeToolSchemas` | Normalize tool schemas before the embedded runner sees them | Provider needs transport-family schema cleanup |
|
||||
| 17 | `inspectToolSchemas` | Surface provider-owned schema diagnostics after normalization | Provider wants keyword warnings without teaching core provider-specific rules |
|
||||
| 18 | `resolveReasoningOutputMode` | Select native vs tagged reasoning-output contract | Provider needs tagged reasoning/final output instead of native fields |
|
||||
| 19 | `prepareExtraParams` | Request-param normalization before generic stream option wrappers | Provider needs default request params or per-provider param cleanup |
|
||||
| 20 | `createStreamFn` | Fully replace the normal stream path with a custom transport | Provider needs a custom wire protocol, not just a wrapper |
|
||||
| 21 | `wrapStreamFn` | Stream wrapper after generic wrappers are applied | Provider needs request headers/body/model compat wrappers without a custom transport |
|
||||
| 22 | `resolveTransportTurnState` | Attach native per-turn transport headers or metadata | Provider wants generic transports to send provider-native turn identity |
|
||||
| 23 | `resolveWebSocketSessionPolicy` | Attach native WebSocket headers or session cool-down policy | Provider wants generic WS transports to tune session headers or fallback policy |
|
||||
| 24 | `formatApiKey` | Auth-profile formatter: stored profile becomes the runtime `apiKey` string | Provider stores extra auth metadata and needs a custom runtime token shape |
|
||||
| 25 | `refreshOAuth` | OAuth refresh override for custom refresh endpoints or refresh-failure policy | Provider does not fit the shared `pi-ai` refreshers |
|
||||
| 26 | `buildAuthDoctorHint` | Repair hint appended when OAuth refresh fails | Provider needs provider-owned auth repair guidance after refresh failure |
|
||||
| 27 | `matchesContextOverflowError` | Provider-owned context-window overflow matcher | Provider has raw overflow errors generic heuristics would miss |
|
||||
| 28 | `classifyFailoverReason` | Provider-owned failover reason classification | Provider can map raw API/transport errors to rate-limit/overload/etc |
|
||||
| 29 | `isCacheTtlEligible` | Prompt-cache policy for proxy/backhaul providers | Provider needs proxy-specific cache TTL gating |
|
||||
| 30 | `buildMissingAuthMessage` | Replacement for the generic missing-auth recovery message | Provider needs a provider-specific missing-auth recovery hint |
|
||||
| 31 | `suppressBuiltInModel` | Stale upstream model suppression plus optional user-facing error hint | Provider needs to hide stale upstream rows or replace them with a vendor hint |
|
||||
| 32 | `augmentModelCatalog` | Synthetic/final catalog rows appended after discovery | Provider needs synthetic forward-compat rows in `models list` and pickers |
|
||||
| 33 | `isBinaryThinking` | On/off reasoning toggle for binary-thinking providers | Provider exposes only binary thinking on/off |
|
||||
| 34 | `supportsXHighThinking` | `xhigh` reasoning support for selected models | Provider wants `xhigh` on only a subset of models |
|
||||
| 35 | `resolveDefaultThinkingLevel` | Default `/think` level for a specific model family | Provider owns default `/think` policy for a model family |
|
||||
| 36 | `isModernModelRef` | Modern-model matcher for live profile filters and smoke selection | Provider owns live/smoke preferred-model matching |
|
||||
| 37 | `prepareRuntimeAuth` | Exchange a configured credential into the actual runtime token/key just before inference | Provider needs a token exchange or short-lived request credential |
|
||||
| 38 | `resolveUsageAuth` | Resolve usage/billing credentials for `/usage` and related status surfaces | Provider needs custom usage/quota token parsing or a different usage credential |
|
||||
| 39 | `fetchUsageSnapshot` | Fetch and normalize provider-specific usage/quota snapshots after auth is resolved | Provider needs a provider-specific usage endpoint or payload parser |
|
||||
| 40 | `createEmbeddingProvider` | Build a provider-owned embedding adapter for memory/search | Memory embedding behavior belongs with the provider plugin |
|
||||
| 41 | `buildReplayPolicy` | Return a replay policy controlling transcript handling for the provider | Provider needs custom transcript policy (for example, thinking-block stripping) |
|
||||
| 42 | `sanitizeReplayHistory` | Rewrite replay history after generic transcript cleanup | Provider needs provider-specific replay rewrites beyond shared compaction helpers |
|
||||
| 43 | `validateReplayTurns` | Final replay-turn validation or reshaping before the embedded runner | Provider transport needs stricter turn validation after generic sanitation |
|
||||
| 44 | `onModelSelected` | Run provider-owned post-selection side effects | Provider needs telemetry or provider-owned state when a model becomes active |
|
||||
| # | Hook | What it does | When to use |
|
||||
| --- | --------------------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 1 | `catalog` | Publish provider config into `models.providers` during `models.json` generation | Provider owns a catalog or base URL defaults |
|
||||
| 2 | `applyConfigDefaults` | Apply provider-owned global config defaults during config materialization | Defaults depend on auth mode, env, or provider model-family semantics |
|
||||
| -- | _(built-in model lookup)_ | OpenClaw tries the normal registry/catalog path first | _(not a plugin hook)_ |
|
||||
| 3 | `normalizeModelId` | Normalize legacy or preview model-id aliases before lookup | Provider owns alias cleanup before canonical model resolution |
|
||||
| 4 | `normalizeTransport` | Normalize provider-family `api` / `baseUrl` before generic model assembly | Provider owns transport cleanup for custom provider ids in the same transport family |
|
||||
| 5 | `normalizeConfig` | Normalize `models.providers.<id>` before runtime/provider resolution | Provider needs config cleanup that should live with the plugin; bundled Google-family helpers also backstop supported Google config entries |
|
||||
| 6 | `applyNativeStreamingUsageCompat` | Apply native streaming-usage compat rewrites to config providers | Provider needs endpoint-driven native streaming usage metadata fixes |
|
||||
| 7 | `resolveConfigApiKey` | Resolve env-marker auth for config providers before runtime auth loading | Provider has provider-owned env-marker API-key resolution; `amazon-bedrock` also has a built-in AWS env-marker resolver here |
|
||||
| 8 | `resolveSyntheticAuth` | Surface local/self-hosted or config-backed auth without persisting plaintext | Provider can operate with a synthetic/local credential marker |
|
||||
| 9 | `shouldDeferSyntheticProfileAuth` | Lower stored synthetic profile placeholders behind env/config-backed auth | Provider stores synthetic placeholder profiles that should not win precedence |
|
||||
| 10 | `resolveDynamicModel` | Sync fallback for provider-owned model ids not in the local registry yet | Provider accepts arbitrary upstream model ids |
|
||||
| 11 | `prepareDynamicModel` | Async warm-up, then `resolveDynamicModel` runs again | Provider needs network metadata before resolving unknown ids |
|
||||
| 12 | `normalizeResolvedModel` | Final rewrite before the embedded runner uses the resolved model | Provider needs transport rewrites but still uses a core transport |
|
||||
| 13 | `contributeResolvedModelCompat` | Contribute compat flags for vendor models behind another compatible transport | Provider recognizes its own models on proxy transports without taking over the provider |
|
||||
| 14 | `capabilities` | Provider-owned transcript/tooling metadata used by shared core logic | Provider needs transcript/provider-family quirks |
|
||||
| 15 | `normalizeToolSchemas` | Normalize tool schemas before the embedded runner sees them | Provider needs transport-family schema cleanup |
|
||||
| 16 | `inspectToolSchemas` | Surface provider-owned schema diagnostics after normalization | Provider wants keyword warnings without teaching core provider-specific rules |
|
||||
| 17 | `resolveReasoningOutputMode` | Select native vs tagged reasoning-output contract | Provider needs tagged reasoning/final output instead of native fields |
|
||||
| 18 | `prepareExtraParams` | Request-param normalization before generic stream option wrappers | Provider needs default request params or per-provider param cleanup |
|
||||
| 19 | `createStreamFn` | Fully replace the normal stream path with a custom transport | Provider needs a custom wire protocol, not just a wrapper |
|
||||
| 20 | `wrapStreamFn` | Stream wrapper after generic wrappers are applied | Provider needs request headers/body/model compat wrappers without a custom transport |
|
||||
| 21 | `resolveTransportTurnState` | Attach native per-turn transport headers or metadata | Provider wants generic transports to send provider-native turn identity |
|
||||
| 22 | `resolveWebSocketSessionPolicy` | Attach native WebSocket headers or session cool-down policy | Provider wants generic WS transports to tune session headers or fallback policy |
|
||||
| 23 | `formatApiKey` | Auth-profile formatter: stored profile becomes the runtime `apiKey` string | Provider stores extra auth metadata and needs a custom runtime token shape |
|
||||
| 24 | `refreshOAuth` | OAuth refresh override for custom refresh endpoints or refresh-failure policy | Provider does not fit the shared `pi-ai` refreshers |
|
||||
| 25 | `buildAuthDoctorHint` | Repair hint appended when OAuth refresh fails | Provider needs provider-owned auth repair guidance after refresh failure |
|
||||
| 26 | `matchesContextOverflowError` | Provider-owned context-window overflow matcher | Provider has raw overflow errors generic heuristics would miss |
|
||||
| 27 | `classifyFailoverReason` | Provider-owned failover reason classification | Provider can map raw API/transport errors to rate-limit/overload/etc |
|
||||
| 28 | `isCacheTtlEligible` | Prompt-cache policy for proxy/backhaul providers | Provider needs proxy-specific cache TTL gating |
|
||||
| 29 | `buildMissingAuthMessage` | Replacement for the generic missing-auth recovery message | Provider needs a provider-specific missing-auth recovery hint |
|
||||
| 30 | `suppressBuiltInModel` | Stale upstream model suppression plus optional user-facing error hint | Provider needs to hide stale upstream rows or replace them with a vendor hint |
|
||||
| 31 | `augmentModelCatalog` | Synthetic/final catalog rows appended after discovery | Provider needs synthetic forward-compat rows in `models list` and pickers |
|
||||
| 32 | `isBinaryThinking` | On/off reasoning toggle for binary-thinking providers | Provider exposes only binary thinking on/off |
|
||||
| 33 | `supportsXHighThinking` | `xhigh` reasoning support for selected models | Provider wants `xhigh` on only a subset of models |
|
||||
| 34 | `resolveDefaultThinkingLevel` | Default `/think` level for a specific model family | Provider owns default `/think` policy for a model family |
|
||||
| 35 | `isModernModelRef` | Modern-model matcher for live profile filters and smoke selection | Provider owns live/smoke preferred-model matching |
|
||||
| 36 | `prepareRuntimeAuth` | Exchange a configured credential into the actual runtime token/key just before inference | Provider needs a token exchange or short-lived request credential |
|
||||
| 37 | `resolveUsageAuth` | Resolve usage/billing credentials for `/usage` and related status surfaces | Provider needs custom usage/quota token parsing or a different usage credential |
|
||||
| 38 | `fetchUsageSnapshot` | Fetch and normalize provider-specific usage/quota snapshots after auth is resolved | Provider needs a provider-specific usage endpoint or payload parser |
|
||||
| 39 | `createEmbeddingProvider` | Build a provider-owned embedding adapter for memory/search | Memory embedding behavior belongs with the provider plugin |
|
||||
| 40 | `buildReplayPolicy` | Return a replay policy controlling transcript handling for the provider | Provider needs custom transcript policy (for example, thinking-block stripping) |
|
||||
| 41 | `sanitizeReplayHistory` | Rewrite replay history after generic transcript cleanup | Provider needs provider-specific replay rewrites beyond shared compaction helpers |
|
||||
| 42 | `validateReplayTurns` | Final replay-turn validation or reshaping before the embedded runner | Provider transport needs stricter turn validation after generic sanitation |
|
||||
| 43 | `onModelSelected` | Run provider-owned post-selection side effects | Provider needs telemetry or provider-owned state when a model becomes active |
|
||||
|
||||
`normalizeModelId`, `normalizeTransport`, and `normalizeConfig` first check the
|
||||
matched provider plugin, then fall through other hook-capable provider plugins
|
||||
@@ -1120,8 +1111,7 @@ authoring plugins:
|
||||
`openclaw/plugin-sdk/secret-input`, and
|
||||
`openclaw/plugin-sdk/webhook-ingress` for shared setup/auth/reply/webhook
|
||||
wiring. `channel-inbound` is the shared home for debounce, mention matching,
|
||||
inbound mention-policy helpers, envelope formatting, and inbound envelope
|
||||
context helpers.
|
||||
envelope formatting, and inbound envelope context helpers.
|
||||
`channel-setup` is the narrow optional-install setup seam.
|
||||
`setup-runtime` is the runtime-safe setup surface used by `setupEntry` /
|
||||
deferred startup, including the import-safe setup patch adapters.
|
||||
@@ -1494,23 +1484,14 @@ Use this when your plugin needs to replace or extend the default context
|
||||
pipeline rather than just add memory search or hooks.
|
||||
|
||||
```ts
|
||||
import { buildMemorySystemPromptAddition } from "openclaw/plugin-sdk/core";
|
||||
|
||||
export default function (api) {
|
||||
api.registerContextEngine("lossless-claw", () => ({
|
||||
info: { id: "lossless-claw", name: "Lossless Claw", ownsCompaction: true },
|
||||
async ingest() {
|
||||
return { ingested: true };
|
||||
},
|
||||
async assemble({ messages, availableTools, citationsMode }) {
|
||||
return {
|
||||
messages,
|
||||
estimatedTokens: 0,
|
||||
systemPromptAddition: buildMemorySystemPromptAddition({
|
||||
availableTools: availableTools ?? new Set(),
|
||||
citationsMode,
|
||||
}),
|
||||
};
|
||||
async assemble({ messages }) {
|
||||
return { messages, estimatedTokens: 0 };
|
||||
},
|
||||
async compact() {
|
||||
return { ok: true, compacted: false };
|
||||
@@ -1523,10 +1504,7 @@ If your engine does **not** own the compaction algorithm, keep `compact()`
|
||||
implemented and delegate it explicitly:
|
||||
|
||||
```ts
|
||||
import {
|
||||
buildMemorySystemPromptAddition,
|
||||
delegateCompactionToRuntime,
|
||||
} from "openclaw/plugin-sdk/core";
|
||||
import { delegateCompactionToRuntime } from "openclaw/plugin-sdk/core";
|
||||
|
||||
export default function (api) {
|
||||
api.registerContextEngine("my-memory-engine", () => ({
|
||||
@@ -1538,15 +1516,8 @@ export default function (api) {
|
||||
async ingest() {
|
||||
return { ingested: true };
|
||||
},
|
||||
async assemble({ messages, availableTools, citationsMode }) {
|
||||
return {
|
||||
messages,
|
||||
estimatedTokens: 0,
|
||||
systemPromptAddition: buildMemorySystemPromptAddition({
|
||||
availableTools: availableTools ?? new Set(),
|
||||
citationsMode,
|
||||
}),
|
||||
};
|
||||
async assemble({ messages }) {
|
||||
return { messages, estimatedTokens: 0 };
|
||||
},
|
||||
async compact(params) {
|
||||
return await delegateCompactionToRuntime(params);
|
||||
|
||||
@@ -151,14 +151,12 @@ A single plugin can register any number of capabilities via the `api` object:
|
||||
| Capability | Registration method | Detailed guide |
|
||||
| ---------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------- |
|
||||
| Text inference (LLM) | `api.registerProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins) |
|
||||
| CLI inference backend | `api.registerCliBackend(...)` | [CLI Backends](/gateway/cli-backends) |
|
||||
| Channel / messaging | `api.registerChannel(...)` | [Channel Plugins](/plugins/sdk-channel-plugins) |
|
||||
| Speech (TTS/STT) | `api.registerSpeechProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
| Realtime transcription | `api.registerRealtimeTranscriptionProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
| Realtime voice | `api.registerRealtimeVoiceProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
| Media understanding | `api.registerMediaUnderstandingProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
| Image generation | `api.registerImageGenerationProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
| Music generation | `api.registerMusicGenerationProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
| Video generation | `api.registerVideoGenerationProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
| Web fetch | `api.registerWebFetchProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
| Web search | `api.registerWebSearchProvider(...)` | [Provider Plugins](/plugins/sdk-provider-plugins#step-5-add-extra-capabilities) |
|
||||
@@ -182,6 +180,7 @@ Hook guard semantics to keep in mind:
|
||||
- `before_tool_call`: `{ requireApproval: true }` pauses agent execution and prompts the user for approval via the exec approval overlay, Telegram buttons, Discord interactions, or the `/approve` command on any channel.
|
||||
- `before_install`: `{ block: true }` is terminal and stops lower-priority handlers.
|
||||
- `before_install`: `{ block: false }` is treated as no decision.
|
||||
- `tool_result_persist`: must stay synchronous because it runs in the transcript persistence path; return an updated tool result payload or `undefined` to keep the original.
|
||||
- `message_sending`: `{ cancel: true }` is terminal and stops lower-priority handlers.
|
||||
- `message_sending`: `{ cancel: false }` is treated as no decision.
|
||||
|
||||
|
||||
@@ -89,13 +89,9 @@ Those belong in your plugin code and `package.json`.
|
||||
"modelSupport": {
|
||||
"modelPrefixes": ["router-"]
|
||||
},
|
||||
"cliBackends": ["openrouter-cli"],
|
||||
"providerAuthEnvVars": {
|
||||
"openrouter": ["OPENROUTER_API_KEY"]
|
||||
},
|
||||
"channelEnvVars": {
|
||||
"openrouter-chatops": ["OPENROUTER_CHATOPS_TOKEN"]
|
||||
},
|
||||
"providerAuthChoices": [
|
||||
{
|
||||
"provider": "openrouter",
|
||||
@@ -132,28 +128,26 @@ Those belong in your plugin code and `package.json`.
|
||||
|
||||
## Top-level field reference
|
||||
|
||||
| Field | Required | Type | What it means |
|
||||
| ----------------------------------- | -------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `id` | Yes | `string` | Canonical plugin id. This is the id used in `plugins.entries.<id>`. |
|
||||
| `configSchema` | Yes | `object` | Inline JSON Schema for this plugin's config. |
|
||||
| `enabledByDefault` | No | `true` | Marks a bundled plugin as enabled by default. Omit it, or set any non-`true` value, to leave the plugin disabled by default. |
|
||||
| `legacyPluginIds` | No | `string[]` | Legacy ids that normalize to this canonical plugin id. |
|
||||
| `autoEnableWhenConfiguredProviders` | No | `string[]` | Provider ids that should auto-enable this plugin when auth, config, or model refs mention them. |
|
||||
| `kind` | No | `"memory"` \| `"context-engine"` | Declares an exclusive plugin kind used by `plugins.slots.*`. |
|
||||
| `channels` | No | `string[]` | Channel ids owned by this plugin. Used for discovery and config validation. |
|
||||
| `providers` | No | `string[]` | Provider ids owned by this plugin. |
|
||||
| `modelSupport` | No | `object` | Manifest-owned shorthand model-family metadata used to auto-load the plugin before runtime. |
|
||||
| `cliBackends` | No | `string[]` | CLI inference backend ids owned by this plugin. Used for startup auto-activation from explicit config refs. |
|
||||
| `providerAuthEnvVars` | No | `Record<string, string[]>` | Cheap provider-auth env metadata that OpenClaw can inspect without loading plugin code. |
|
||||
| `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. |
|
||||
| `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. |
|
||||
| `name` | No | `string` | Human-readable plugin name. |
|
||||
| `description` | No | `string` | Short summary shown in plugin surfaces. |
|
||||
| `version` | No | `string` | Informational plugin version. |
|
||||
| `uiHints` | No | `Record<string, object>` | UI labels, placeholders, and sensitivity hints for config fields. |
|
||||
| Field | Required | Type | What it means |
|
||||
| ----------------------------------- | -------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `id` | Yes | `string` | Canonical plugin id. This is the id used in `plugins.entries.<id>`. |
|
||||
| `configSchema` | Yes | `object` | Inline JSON Schema for this plugin's config. |
|
||||
| `enabledByDefault` | No | `true` | Marks a bundled plugin as enabled by default. Omit it, or set any non-`true` value, to leave the plugin disabled by default. |
|
||||
| `legacyPluginIds` | No | `string[]` | Legacy ids that normalize to this canonical plugin id. |
|
||||
| `autoEnableWhenConfiguredProviders` | No | `string[]` | Provider ids that should auto-enable this plugin when auth, config, or model refs mention them. |
|
||||
| `kind` | No | `"memory"` \| `"context-engine"` | Declares an exclusive plugin kind used by `plugins.slots.*`. |
|
||||
| `channels` | No | `string[]` | Channel ids owned by this plugin. Used for discovery and config validation. |
|
||||
| `providers` | No | `string[]` | Provider ids owned by this plugin. |
|
||||
| `modelSupport` | No | `object` | Manifest-owned shorthand model-family metadata used to auto-load the plugin before runtime. |
|
||||
| `providerAuthEnvVars` | No | `Record<string, string[]>` | Cheap provider-auth env metadata that OpenClaw can inspect without loading plugin code. |
|
||||
| `providerAuthChoices` | No | `object[]` | Cheap auth-choice metadata for onboarding pickers, preferred-provider resolution, and simple CLI flag wiring. |
|
||||
| `contracts` | No | `object` | Static bundled capability snapshot for speech, realtime transcription, realtime voice, media-understanding, image-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. |
|
||||
| `name` | No | `string` | Human-readable plugin name. |
|
||||
| `description` | No | `string` | Short summary shown in plugin surfaces. |
|
||||
| `version` | No | `string` | Informational plugin version. |
|
||||
| `uiHints` | No | `Record<string, object>` | UI labels, placeholders, and sensitivity hints for config fields. |
|
||||
|
||||
## providerAuthChoices reference
|
||||
|
||||
@@ -341,18 +335,16 @@ Some pre-runtime plugin metadata intentionally lives in `package.json` under the
|
||||
|
||||
Important examples:
|
||||
|
||||
| Field | What it means |
|
||||
| ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `openclaw.extensions` | Declares native plugin entrypoints. |
|
||||
| `openclaw.setupEntry` | Lightweight setup-only entrypoint used during onboarding and deferred channel startup. |
|
||||
| `openclaw.channel` | Cheap channel catalog metadata like labels, docs paths, aliases, and selection copy. |
|
||||
| `openclaw.channel.configuredState` | Lightweight configured-state checker metadata that can answer "does env-only setup already exist?" without loading the full channel runtime. |
|
||||
| `openclaw.channel.persistedAuthState` | Lightweight persisted-auth checker metadata that can answer "is anything already signed in?" without loading the full channel runtime. |
|
||||
| `openclaw.install.npmSpec` / `openclaw.install.localPath` | Install/update hints for bundled and externally published plugins. |
|
||||
| `openclaw.install.defaultChoice` | Preferred install path when multiple install sources are available. |
|
||||
| `openclaw.install.minHostVersion` | Minimum supported OpenClaw host version, using a semver floor like `>=2026.3.22`. |
|
||||
| `openclaw.install.allowInvalidConfigRecovery` | Allows a narrow bundled-plugin reinstall recovery path when config is invalid. |
|
||||
| `openclaw.startup.deferConfiguredChannelFullLoadUntilAfterListen` | Lets setup-only channel surfaces load before the full channel plugin during startup. |
|
||||
| Field | What it means |
|
||||
| ----------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||
| `openclaw.extensions` | Declares native plugin entrypoints. |
|
||||
| `openclaw.setupEntry` | Lightweight setup-only entrypoint used during onboarding and deferred channel startup. |
|
||||
| `openclaw.channel` | Cheap channel catalog metadata like labels, docs paths, aliases, and selection copy. |
|
||||
| `openclaw.install.npmSpec` / `openclaw.install.localPath` | Install/update hints for bundled and externally published plugins. |
|
||||
| `openclaw.install.defaultChoice` | Preferred install path when multiple install sources are available. |
|
||||
| `openclaw.install.minHostVersion` | Minimum supported OpenClaw host version, using a semver floor like `>=2026.3.22`. |
|
||||
| `openclaw.install.allowInvalidConfigRecovery` | Allows a narrow bundled-plugin reinstall recovery path when config is invalid. |
|
||||
| `openclaw.startup.deferConfiguredChannelFullLoadUntilAfterListen` | Lets setup-only channel surfaces load before the full channel plugin during startup. |
|
||||
|
||||
`openclaw.install.minHostVersion` is enforced during install and manifest
|
||||
registry loading. Invalid values are rejected; newer-but-valid values skip the
|
||||
@@ -365,50 +357,6 @@ missing bundled plugin path or a stale `channels.<id>` entry for that same
|
||||
bundled plugin. Unrelated config errors still block install and send operators
|
||||
to `openclaw doctor --fix`.
|
||||
|
||||
`openclaw.channel.persistedAuthState` is package metadata for a tiny checker
|
||||
module:
|
||||
|
||||
```json
|
||||
{
|
||||
"openclaw": {
|
||||
"channel": {
|
||||
"id": "whatsapp",
|
||||
"persistedAuthState": {
|
||||
"specifier": "./auth-presence",
|
||||
"exportName": "hasAnyWhatsAppAuth"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use it when setup, doctor, or configured-state flows need a cheap yes/no auth
|
||||
probe before the full channel plugin loads. The target export should be a small
|
||||
function that reads persisted state only; do not route it through the full
|
||||
channel runtime barrel.
|
||||
|
||||
`openclaw.channel.configuredState` follows the same shape for cheap env-only
|
||||
configured checks:
|
||||
|
||||
```json
|
||||
{
|
||||
"openclaw": {
|
||||
"channel": {
|
||||
"id": "telegram",
|
||||
"configuredState": {
|
||||
"specifier": "./configured-state",
|
||||
"exportName": "hasTelegramConfiguredState"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use it when a channel can answer configured-state from env or other tiny
|
||||
non-runtime inputs. If the check needs full config resolution or the real
|
||||
channel runtime, keep that logic in the plugin `config.hasConfiguredState`
|
||||
hook instead.
|
||||
|
||||
## JSON Schema requirements
|
||||
|
||||
- **Every plugin must ship a JSON Schema**, even if it accepts no config.
|
||||
@@ -440,9 +388,6 @@ See [Configuration reference](/gateway/configuration) for the full `plugins.*` s
|
||||
- `providerAuthEnvVars` is the cheap metadata path for auth probes, env-marker
|
||||
validation, and similar provider-auth surfaces that should not boot plugin
|
||||
runtime just to inspect env names.
|
||||
- `channelEnvVars` is the cheap metadata path for shell-env fallback, setup
|
||||
prompts, and similar channel surfaces that should not boot plugin runtime
|
||||
just to inspect env names.
|
||||
- `providerAuthChoices` is the cheap metadata path for auth-choice pickers,
|
||||
`--auth-choice` resolution, preferred-provider mapping, and simple onboarding
|
||||
CLI flag registration before provider runtime loads. For runtime wizard
|
||||
@@ -452,7 +397,7 @@ See [Configuration reference](/gateway/configuration) for the full `plugins.*` s
|
||||
- `kind: "memory"` is selected by `plugins.slots.memory`.
|
||||
- `kind: "context-engine"` is selected by `plugins.slots.contextEngine`
|
||||
(default: built-in `legacy`).
|
||||
- `channels`, `providers`, `cliBackends`, and `skills` can be omitted when a
|
||||
- `channels`, `providers`, and `skills` can be omitted when a
|
||||
plugin does not need them.
|
||||
- If your plugin depends on native modules, document the build steps and any
|
||||
package-manager allowlist requirements (for example, pnpm `allow-build-scripts`
|
||||
|
||||
@@ -108,15 +108,9 @@ For setup specifically:
|
||||
- `openclaw/plugin-sdk/channel-setup` covers the optional-install setup
|
||||
builders plus a few setup-safe primitives:
|
||||
`createOptionalChannelSetupSurface`, `createOptionalChannelSetupAdapter`,
|
||||
|
||||
If your channel supports env-driven setup or auth and generic startup/config
|
||||
flows should know those env names before runtime loads, declare them in the
|
||||
plugin manifest with `channelEnvVars`. Keep channel runtime `envVars` or local
|
||||
constants for operator-facing copy only.
|
||||
`createOptionalChannelSetupWizard`, `DEFAULT_ACCOUNT_ID`,
|
||||
`createTopLevelChannelDmPolicy`, `setSetupChannelEnabled`, and
|
||||
`splitSetupEntries`
|
||||
|
||||
`createOptionalChannelSetupWizard`, `DEFAULT_ACCOUNT_ID`,
|
||||
`createTopLevelChannelDmPolicy`, `setSetupChannelEnabled`, and
|
||||
`splitSetupEntries`
|
||||
- use the broader `openclaw/plugin-sdk/setup` seam only when you also need the
|
||||
heavier shared setup/config helpers such as
|
||||
`moveSingleAccountChannelSectionToDefaultAccount(...)`
|
||||
@@ -152,87 +146,6 @@ surfaces:
|
||||
|
||||
Auth-only channels can usually stop at the default path: core handles approvals and the plugin just exposes outbound/auth capabilities. Native approval channels such as Matrix, Slack, Telegram, and custom chat transports should use the shared native helpers instead of rolling their own approval lifecycle.
|
||||
|
||||
## Inbound mention policy
|
||||
|
||||
Keep inbound mention handling split in two layers:
|
||||
|
||||
- plugin-owned evidence gathering
|
||||
- shared policy evaluation
|
||||
|
||||
Use `openclaw/plugin-sdk/channel-inbound` for the shared layer.
|
||||
|
||||
Good fit for plugin-local logic:
|
||||
|
||||
- reply-to-bot detection
|
||||
- quoted-bot detection
|
||||
- thread-participation checks
|
||||
- service/system-message exclusions
|
||||
- platform-native caches needed to prove bot participation
|
||||
|
||||
Good fit for the shared helper:
|
||||
|
||||
- `requireMention`
|
||||
- explicit mention result
|
||||
- implicit mention allowlist
|
||||
- command bypass
|
||||
- final skip decision
|
||||
|
||||
Preferred flow:
|
||||
|
||||
1. Compute local mention facts.
|
||||
2. Pass those facts into `resolveInboundMentionDecision({ facts, policy })`.
|
||||
3. Use `decision.effectiveWasMentioned`, `decision.shouldBypassMention`, and `decision.shouldSkip` in your inbound gate.
|
||||
|
||||
```typescript
|
||||
import {
|
||||
implicitMentionKindWhen,
|
||||
matchesMentionWithExplicit,
|
||||
resolveInboundMentionDecision,
|
||||
} from "openclaw/plugin-sdk/channel-inbound";
|
||||
|
||||
const mentionMatch = matchesMentionWithExplicit(text, {
|
||||
mentionRegexes,
|
||||
mentionPatterns,
|
||||
});
|
||||
|
||||
const facts = {
|
||||
canDetectMention: true,
|
||||
wasMentioned: mentionMatch.matched,
|
||||
hasAnyMention: mentionMatch.hasExplicitMention,
|
||||
implicitMentionKinds: [
|
||||
...implicitMentionKindWhen("reply_to_bot", isReplyToBot),
|
||||
...implicitMentionKindWhen("quoted_bot", isQuoteOfBot),
|
||||
],
|
||||
};
|
||||
|
||||
const decision = resolveInboundMentionDecision({
|
||||
facts,
|
||||
policy: {
|
||||
isGroup,
|
||||
requireMention,
|
||||
allowedImplicitMentionKinds: requireExplicitMention ? [] : ["reply_to_bot", "quoted_bot"],
|
||||
allowTextCommands,
|
||||
hasControlCommand,
|
||||
commandAuthorized,
|
||||
},
|
||||
});
|
||||
|
||||
if (decision.shouldSkip) return;
|
||||
```
|
||||
|
||||
`api.runtime.channel.mentions` exposes the same shared mention helpers for
|
||||
bundled channel plugins that already depend on runtime injection:
|
||||
|
||||
- `buildMentionRegexes`
|
||||
- `matchesMentionPatterns`
|
||||
- `matchesMentionWithExplicit`
|
||||
- `implicitMentionKindWhen`
|
||||
- `resolveInboundMentionDecision`
|
||||
|
||||
The older `resolveMentionGating*` helpers remain on
|
||||
`openclaw/plugin-sdk/channel-inbound` as compatibility exports only. New code
|
||||
should use `resolveInboundMentionDecision({ facts, policy })`.
|
||||
|
||||
## Walkthrough
|
||||
|
||||
<Steps>
|
||||
|
||||
@@ -249,14 +249,12 @@ Current bundled provider examples:
|
||||
| `plugin-sdk/provider-onboard` | Provider onboarding patches | Onboarding config helpers |
|
||||
| `plugin-sdk/provider-http` | Provider HTTP helpers | Generic provider HTTP/endpoint capability helpers |
|
||||
| `plugin-sdk/provider-web-fetch` | Provider web-fetch helpers | Web-fetch provider registration/cache helpers |
|
||||
| `plugin-sdk/provider-web-search-contract` | Provider web-search contract helpers | Narrow web-search config/credential contract helpers such as `enablePluginInConfig`, `resolveProviderWebSearchPluginConfig`, and scoped credential setters/getters |
|
||||
| `plugin-sdk/provider-web-search` | Provider web-search helpers | Web-search provider registration/cache/runtime helpers |
|
||||
| `plugin-sdk/provider-web-search` | Provider web-search helpers | Web-search provider registration/cache/config helpers |
|
||||
| `plugin-sdk/provider-tools` | Provider tool/schema compat helpers | `ProviderToolCompatFamily`, `buildProviderToolCompatFamilyHooks`, Gemini schema cleanup + diagnostics, and xAI compat helpers such as `resolveXaiModelCompatPatch` / `applyXaiModelCompat` |
|
||||
| `plugin-sdk/provider-usage` | Provider usage helpers | `fetchClaudeUsage`, `fetchGeminiUsage`, `fetchGithubCopilotUsage`, and other provider usage helpers |
|
||||
| `plugin-sdk/provider-stream` | Provider stream wrapper helpers | `ProviderStreamFamily`, `buildProviderStreamFamilyHooks`, `composeProviderStreamWrappers`, stream wrapper types, and shared Anthropic/Bedrock/Google/Kilocode/Moonshot/OpenAI/OpenRouter/Z.A.I/MiniMax/Copilot wrapper helpers |
|
||||
| `plugin-sdk/keyed-async-queue` | Ordered async queue | `KeyedAsyncQueue` |
|
||||
| `plugin-sdk/media-runtime` | Shared media helpers | Media fetch/transform/store helpers plus media payload builders |
|
||||
| `plugin-sdk/media-generation-runtime` | Shared media-generation helpers | Shared failover helpers, candidate selection, and missing-model messaging for image/video/music generation |
|
||||
| `plugin-sdk/media-understanding` | Media-understanding helpers | Media understanding provider types plus provider-facing image/audio helper exports |
|
||||
| `plugin-sdk/text-runtime` | Shared text helpers | Assistant-visible-text stripping, markdown render/chunking/table helpers, redaction helpers, directive-tag helpers, safe-text utilities, and related text/logging helpers |
|
||||
| `plugin-sdk/text-chunking` | Text chunking helpers | Outbound text chunking helper |
|
||||
@@ -265,8 +263,6 @@ Current bundled provider examples:
|
||||
| `plugin-sdk/realtime-transcription` | Realtime transcription helpers | Provider types and registry helpers |
|
||||
| `plugin-sdk/realtime-voice` | Realtime voice helpers | Provider types and registry helpers |
|
||||
| `plugin-sdk/image-generation-core` | Shared image-generation core | Image-generation types, failover, auth, and registry helpers |
|
||||
| `plugin-sdk/music-generation` | Music-generation helpers | Music-generation provider/request/result types |
|
||||
| `plugin-sdk/music-generation-core` | Shared music-generation core | Music-generation types, failover helpers, provider lookup, and model-ref parsing |
|
||||
| `plugin-sdk/video-generation` | Video-generation helpers | Video-generation provider/request/result types |
|
||||
| `plugin-sdk/video-generation-core` | Shared video-generation core | Video-generation types, failover helpers, provider lookup, and model-ref parsing |
|
||||
| `plugin-sdk/interactive-runtime` | Interactive reply helpers | Interactive reply payload normalization/reduction |
|
||||
@@ -277,7 +273,7 @@ Current bundled provider examples:
|
||||
| `plugin-sdk/allowlist-config-edit` | Allowlist config helpers | Allowlist config edit/read helpers |
|
||||
| `plugin-sdk/group-access` | Group access helpers | Shared group-access decision helpers |
|
||||
| `plugin-sdk/direct-dm` | Direct-DM helpers | Shared direct-DM auth/guard helpers |
|
||||
| `plugin-sdk/extension-shared` | Shared extension helpers | Passive-channel/status and ambient proxy helper primitives |
|
||||
| `plugin-sdk/extension-shared` | Shared extension helpers | Passive-channel/status helper primitives |
|
||||
| `plugin-sdk/webhook-targets` | Webhook target helpers | Webhook target registry and route-install helpers |
|
||||
| `plugin-sdk/webhook-path` | Webhook path helpers | Webhook path normalization helpers |
|
||||
| `plugin-sdk/web-media` | Shared web media helpers | Remote/local media loading helpers |
|
||||
@@ -291,17 +287,10 @@ Current bundled provider examples:
|
||||
| `plugin-sdk/memory-core-host-multimodal` | Memory host multimodal helpers | Memory host multimodal helpers |
|
||||
| `plugin-sdk/memory-core-host-query` | Memory host query helpers | Memory host query helpers |
|
||||
| `plugin-sdk/memory-core-host-secret` | Memory host secret helpers | Memory host secret helpers |
|
||||
| `plugin-sdk/memory-core-host-events` | Memory host event journal helpers | Memory host event journal helpers |
|
||||
| `plugin-sdk/memory-core-host-status` | Memory host status helpers | Memory host status helpers |
|
||||
| `plugin-sdk/memory-core-host-runtime-cli` | Memory host CLI runtime | Memory host CLI runtime helpers |
|
||||
| `plugin-sdk/memory-core-host-runtime-core` | Memory host core runtime | Memory host core runtime helpers |
|
||||
| `plugin-sdk/memory-core-host-runtime-files` | Memory host file/runtime helpers | Memory host file/runtime helpers |
|
||||
| `plugin-sdk/memory-host-core` | Memory host core runtime alias | Vendor-neutral alias for memory host core runtime helpers |
|
||||
| `plugin-sdk/memory-host-events` | Memory host event journal alias | Vendor-neutral alias for memory host event journal helpers |
|
||||
| `plugin-sdk/memory-host-files` | Memory host file/runtime alias | Vendor-neutral alias for memory host file/runtime helpers |
|
||||
| `plugin-sdk/memory-host-markdown` | Managed markdown helpers | Shared managed-markdown helpers for memory-adjacent plugins |
|
||||
| `plugin-sdk/memory-host-search` | Active memory search facade | Lazy active-memory search-manager runtime facade |
|
||||
| `plugin-sdk/memory-host-status` | Memory host status alias | Vendor-neutral alias for memory host status helpers |
|
||||
| `plugin-sdk/memory-lancedb` | Bundled memory-lancedb helpers | Memory-lancedb helper surface |
|
||||
| `plugin-sdk/testing` | Test utilities | Test helpers and mocks |
|
||||
</Accordion>
|
||||
|
||||
@@ -108,13 +108,12 @@ explicitly promotes one as public.
|
||||
| `plugin-sdk/group-access` | Shared group-access decision helpers |
|
||||
| `plugin-sdk/direct-dm` | Shared direct-DM auth/guard helpers |
|
||||
| `plugin-sdk/interactive-runtime` | Interactive reply payload normalization/reduction helpers |
|
||||
| `plugin-sdk/channel-inbound` | Inbound debounce, mention matching, mention-policy helpers, and envelope helpers |
|
||||
| `plugin-sdk/channel-inbound` | Debounce, mention matching, envelope helpers |
|
||||
| `plugin-sdk/channel-send-result` | Reply result types |
|
||||
| `plugin-sdk/channel-actions` | `createMessageToolButtonsSchema`, `createMessageToolCardSchema` |
|
||||
| `plugin-sdk/channel-targets` | Target parsing/matching helpers |
|
||||
| `plugin-sdk/channel-contract` | Channel contract types |
|
||||
| `plugin-sdk/channel-feedback` | Feedback/reaction wiring |
|
||||
| `plugin-sdk/channel-secret-runtime` | Narrow secret-contract helpers such as `collectSimpleChannelFieldAssignments`, `getChannelSurface`, `pushAssignment`, and secret target types |
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Provider subpaths">
|
||||
@@ -123,20 +122,17 @@ explicitly promotes one as public.
|
||||
| `plugin-sdk/provider-entry` | `defineSingleProviderPluginEntry` |
|
||||
| `plugin-sdk/provider-setup` | Curated local/self-hosted provider setup helpers |
|
||||
| `plugin-sdk/self-hosted-provider-setup` | Focused OpenAI-compatible self-hosted provider setup helpers |
|
||||
| `plugin-sdk/cli-backend` | CLI backend defaults + watchdog constants |
|
||||
| `plugin-sdk/provider-auth-runtime` | Runtime API-key resolution helpers for provider plugins |
|
||||
| `plugin-sdk/provider-auth-api-key` | API-key onboarding/profile-write helpers such as `upsertApiKeyProfile` |
|
||||
| `plugin-sdk/provider-auth-api-key` | API-key onboarding/profile-write helpers |
|
||||
| `plugin-sdk/provider-auth-result` | Standard OAuth auth-result builder |
|
||||
| `plugin-sdk/provider-auth-login` | Shared interactive login helpers for provider plugins |
|
||||
| `plugin-sdk/provider-env-vars` | Provider auth env-var lookup helpers |
|
||||
| `plugin-sdk/provider-auth` | `createProviderApiKeyAuthMethod`, `ensureApiKeyFromOptionEnvOrPrompt`, `upsertAuthProfile`, `upsertApiKeyProfile`, `writeOAuthCredentials` |
|
||||
| `plugin-sdk/provider-auth` | `createProviderApiKeyAuthMethod`, `ensureApiKeyFromOptionEnvOrPrompt`, `upsertAuthProfile` |
|
||||
| `plugin-sdk/provider-model-shared` | `ProviderReplayFamily`, `buildProviderReplayFamilyHooks`, `normalizeModelCompat`, shared replay-policy builders, provider-endpoint helpers, and model-id normalization helpers such as `normalizeNativeXaiModelId` |
|
||||
| `plugin-sdk/provider-catalog-shared` | `findCatalogTemplate`, `buildSingleProviderApiKeyCatalog`, `supportsNativeStreamingUsageCompat`, `applyProviderNativeStreamingUsageCompat` |
|
||||
| `plugin-sdk/provider-http` | Generic provider HTTP/endpoint capability helpers |
|
||||
| `plugin-sdk/provider-web-fetch-contract` | Narrow web-fetch config/selection contract helpers such as `enablePluginInConfig` and `WebFetchProviderPlugin` |
|
||||
| `plugin-sdk/provider-web-fetch` | Web-fetch provider registration/cache helpers |
|
||||
| `plugin-sdk/provider-web-search-contract` | Narrow web-search config/credential contract helpers such as `enablePluginInConfig`, `resolveProviderWebSearchPluginConfig`, and scoped credential setters/getters |
|
||||
| `plugin-sdk/provider-web-search` | Web-search provider registration/cache/runtime helpers |
|
||||
| `plugin-sdk/provider-web-search` | Web-search provider registration/cache/config helpers |
|
||||
| `plugin-sdk/provider-tools` | `ProviderToolCompatFamily`, `buildProviderToolCompatFamilyHooks`, Gemini schema cleanup + diagnostics, and xAI compat helpers such as `resolveXaiModelCompatPatch` / `applyXaiModelCompat` |
|
||||
| `plugin-sdk/provider-usage` | `fetchClaudeUsage` and similar |
|
||||
| `plugin-sdk/provider-stream` | `ProviderStreamFamily`, `buildProviderStreamFamilyHooks`, `composeProviderStreamWrappers`, stream wrapper types, and shared Anthropic/Bedrock/Google/Kilocode/Moonshot/OpenAI/OpenRouter/Z.A.I/MiniMax/Copilot wrapper helpers |
|
||||
@@ -157,8 +153,6 @@ explicitly promotes one as public.
|
||||
| `plugin-sdk/command-detection` | Shared command detection helpers |
|
||||
| `plugin-sdk/command-surface` | Command-body normalization and command-surface helpers |
|
||||
| `plugin-sdk/allow-from` | `formatAllowFromLowercase` |
|
||||
| `plugin-sdk/channel-secret-runtime` | Narrow secret-contract collection helpers for channel/plugin secret surfaces |
|
||||
| `plugin-sdk/secret-ref-runtime` | Narrow `coerceSecretRef` and SecretRef typing helpers for secret-contract/config parsing |
|
||||
| `plugin-sdk/security-runtime` | Shared trust, DM gating, external-content, and secret-collection helpers |
|
||||
| `plugin-sdk/ssrf-policy` | Host allowlist and private-network SSRF policy helpers |
|
||||
| `plugin-sdk/ssrf-runtime` | Pinned-dispatcher, SSRF-guarded fetch, and SSRF policy helpers |
|
||||
@@ -208,7 +202,7 @@ explicitly promotes one as public.
|
||||
| `plugin-sdk/boolean-param` | Loose boolean param reader |
|
||||
| `plugin-sdk/dangerous-name-runtime` | Dangerous-name matching resolution helpers |
|
||||
| `plugin-sdk/device-bootstrap` | Device bootstrap and pairing token helpers |
|
||||
| `plugin-sdk/extension-shared` | Shared passive-channel, status, and ambient proxy helper primitives |
|
||||
| `plugin-sdk/extension-shared` | Shared passive-channel and status helper primitives |
|
||||
| `plugin-sdk/models-provider-runtime` | `/models` command/provider reply helpers |
|
||||
| `plugin-sdk/skill-commands-runtime` | Skill command listing helpers |
|
||||
| `plugin-sdk/native-command-registry` | Native command registry/build/serialize helpers |
|
||||
@@ -229,7 +223,6 @@ explicitly promotes one as public.
|
||||
| Subpath | Key exports |
|
||||
| --- | --- |
|
||||
| `plugin-sdk/media-runtime` | Shared media fetch/transform/store helpers plus media payload builders |
|
||||
| `plugin-sdk/media-generation-runtime` | Shared media-generation failover helpers, candidate selection, and missing-model messaging |
|
||||
| `plugin-sdk/media-understanding` | Media understanding provider types plus provider-facing image/audio helper exports |
|
||||
| `plugin-sdk/text-runtime` | Shared text/markdown/logging helpers such as assistant-visible-text stripping, markdown render/chunking/table helpers, redaction helpers, directive-tag helpers, and safe-text utilities |
|
||||
| `plugin-sdk/text-chunking` | Outbound text chunking helper |
|
||||
@@ -239,8 +232,6 @@ explicitly promotes one as public.
|
||||
| `plugin-sdk/realtime-voice` | Realtime voice provider types and registry helpers |
|
||||
| `plugin-sdk/image-generation` | Image generation provider types |
|
||||
| `plugin-sdk/image-generation-core` | Shared image-generation types, failover, auth, and registry helpers |
|
||||
| `plugin-sdk/music-generation` | Music generation provider/request/result types |
|
||||
| `plugin-sdk/music-generation-core` | Shared music-generation types, failover helpers, provider lookup, and model-ref parsing |
|
||||
| `plugin-sdk/video-generation` | Video generation provider/request/result types |
|
||||
| `plugin-sdk/video-generation-core` | Shared video-generation types, failover helpers, provider lookup, and model-ref parsing |
|
||||
| `plugin-sdk/webhook-targets` | Webhook target registry and route-install helpers |
|
||||
@@ -262,17 +253,10 @@ explicitly promotes one as public.
|
||||
| `plugin-sdk/memory-core-host-multimodal` | Memory host multimodal helpers |
|
||||
| `plugin-sdk/memory-core-host-query` | Memory host query helpers |
|
||||
| `plugin-sdk/memory-core-host-secret` | Memory host secret helpers |
|
||||
| `plugin-sdk/memory-core-host-events` | Memory host event journal helpers |
|
||||
| `plugin-sdk/memory-core-host-status` | Memory host status helpers |
|
||||
| `plugin-sdk/memory-core-host-runtime-cli` | Memory host CLI runtime helpers |
|
||||
| `plugin-sdk/memory-core-host-runtime-core` | Memory host core runtime helpers |
|
||||
| `plugin-sdk/memory-core-host-runtime-files` | Memory host file/runtime helpers |
|
||||
| `plugin-sdk/memory-host-core` | Vendor-neutral alias for memory host core runtime helpers |
|
||||
| `plugin-sdk/memory-host-events` | Vendor-neutral alias for memory host event journal helpers |
|
||||
| `plugin-sdk/memory-host-files` | Vendor-neutral alias for memory host file/runtime helpers |
|
||||
| `plugin-sdk/memory-host-markdown` | Shared managed-markdown helpers for memory-adjacent plugins |
|
||||
| `plugin-sdk/memory-host-search` | Active memory runtime facade for search-manager access |
|
||||
| `plugin-sdk/memory-host-status` | Vendor-neutral alias for memory host status helpers |
|
||||
| `plugin-sdk/memory-lancedb` | Bundled memory-lancedb helper surface |
|
||||
</Accordion>
|
||||
|
||||
@@ -298,14 +282,12 @@ methods:
|
||||
| Method | What it registers |
|
||||
| ------------------------------------------------ | -------------------------------- |
|
||||
| `api.registerProvider(...)` | Text inference (LLM) |
|
||||
| `api.registerCliBackend(...)` | Local CLI inference backend |
|
||||
| `api.registerChannel(...)` | Messaging channel |
|
||||
| `api.registerSpeechProvider(...)` | Text-to-speech / STT synthesis |
|
||||
| `api.registerRealtimeTranscriptionProvider(...)` | Streaming realtime transcription |
|
||||
| `api.registerRealtimeVoiceProvider(...)` | Duplex realtime voice sessions |
|
||||
| `api.registerMediaUnderstandingProvider(...)` | Image/audio/video analysis |
|
||||
| `api.registerImageGenerationProvider(...)` | Image generation |
|
||||
| `api.registerMusicGenerationProvider(...)` | Music generation |
|
||||
| `api.registerVideoGenerationProvider(...)` | Video generation |
|
||||
| `api.registerWebFetchProvider(...)` | Web fetch / scrape provider |
|
||||
| `api.registerWebSearchProvider(...)` | Web search |
|
||||
@@ -319,16 +301,14 @@ methods:
|
||||
|
||||
### Infrastructure
|
||||
|
||||
| Method | What it registers |
|
||||
| ---------------------------------------------- | --------------------------------------- |
|
||||
| `api.registerHook(events, handler, opts?)` | Event hook |
|
||||
| `api.registerHttpRoute(params)` | Gateway HTTP endpoint |
|
||||
| `api.registerGatewayMethod(name, handler)` | Gateway RPC method |
|
||||
| `api.registerCli(registrar, opts?)` | CLI subcommand |
|
||||
| `api.registerService(service)` | Background service |
|
||||
| `api.registerInteractiveHandler(registration)` | Interactive handler |
|
||||
| `api.registerMemoryPromptSupplement(builder)` | Additive memory-adjacent prompt section |
|
||||
| `api.registerMemoryCorpusSupplement(adapter)` | Additive memory search/read corpus |
|
||||
| Method | What it registers |
|
||||
| ---------------------------------------------- | --------------------- |
|
||||
| `api.registerHook(events, handler, opts?)` | Event hook |
|
||||
| `api.registerHttpRoute(params)` | Gateway HTTP endpoint |
|
||||
| `api.registerGatewayMethod(name, handler)` | Gateway RPC method |
|
||||
| `api.registerCli(registrar, opts?)` | CLI subcommand |
|
||||
| `api.registerService(service)` | Background service |
|
||||
| `api.registerInteractiveHandler(registration)` | Interactive handler |
|
||||
|
||||
Reserved core admin namespaces (`config.*`, `exec.approvals.*`, `wizard.*`,
|
||||
`update.*`) always stay `operator.admin`, even if a plugin tries to assign a
|
||||
@@ -369,24 +349,11 @@ Use `commands` by itself only when you do not need lazy root CLI registration.
|
||||
That eager compatibility path remains supported, but it does not install
|
||||
descriptor-backed placeholders for parse-time lazy loading.
|
||||
|
||||
### CLI backend registration
|
||||
|
||||
`api.registerCliBackend(...)` lets a plugin own the default config for a local
|
||||
AI CLI backend such as `codex-cli`.
|
||||
|
||||
- The backend `id` becomes the provider prefix in model refs like `codex-cli/gpt-5`.
|
||||
- The backend `config` uses the same shape as `agents.defaults.cliBackends.<id>`.
|
||||
- User config still wins. OpenClaw merges `agents.defaults.cliBackends.<id>` over the
|
||||
plugin default before running the CLI.
|
||||
- Use `normalizeConfig` when a backend needs compatibility rewrites after merge
|
||||
(for example normalizing old flag shapes).
|
||||
|
||||
### Exclusive slots
|
||||
|
||||
| Method | What it registers |
|
||||
| ------------------------------------------ | ------------------------------------- |
|
||||
| `api.registerContextEngine(id, factory)` | Context engine (one active at a time) |
|
||||
| `api.registerMemoryCapability(capability)` | Unified memory capability |
|
||||
| `api.registerMemoryPromptSection(builder)` | Memory prompt section builder |
|
||||
| `api.registerMemoryFlushPlan(resolver)` | Memory flush plan resolver |
|
||||
| `api.registerMemoryRuntime(runtime)` | Memory runtime adapter |
|
||||
@@ -397,13 +364,8 @@ AI CLI backend such as `codex-cli`.
|
||||
| ---------------------------------------------- | ---------------------------------------------- |
|
||||
| `api.registerMemoryEmbeddingProvider(adapter)` | Memory embedding adapter for the active plugin |
|
||||
|
||||
- `registerMemoryCapability` is the preferred exclusive memory-plugin API.
|
||||
- `registerMemoryCapability` may also expose `publicArtifacts.listArtifacts(...)`
|
||||
so companion plugins can consume exported memory artifacts through
|
||||
`openclaw/plugin-sdk/memory-host-core` instead of reaching into a specific
|
||||
memory plugin's private layout.
|
||||
- `registerMemoryPromptSection`, `registerMemoryFlushPlan`, and
|
||||
`registerMemoryRuntime` are legacy-compatible exclusive memory-plugin APIs.
|
||||
`registerMemoryRuntime` are exclusive to memory plugins.
|
||||
- `registerMemoryEmbeddingProvider` lets the active memory plugin register one
|
||||
or more embedding adapter ids (for example `openai`, `gemini`, or a custom
|
||||
plugin-defined id).
|
||||
|
||||
@@ -283,7 +283,7 @@ API key auth, and dynamic model resolution.
|
||||
|
||||
Real bundled examples:
|
||||
|
||||
- `google` and `google-gemini-cli`: `google-gemini`
|
||||
- `google`: `google-gemini`
|
||||
- `openrouter`, `kilocode`, `opencode`, and `opencode-go`: `passthrough-gemini`
|
||||
- `amazon-bedrock` and `anthropic-vertex`: `anthropic-by-model`
|
||||
- `minimax`: `hybrid-anthropic-openai`
|
||||
@@ -303,7 +303,7 @@ API key auth, and dynamic model resolution.
|
||||
|
||||
Real bundled examples:
|
||||
|
||||
- `google` and `google-gemini-cli`: `google-thinking`
|
||||
- `google`: `google-thinking`
|
||||
- `kilocode`: `kilocode-thinking`
|
||||
- `moonshot`: `moonshot-thinking`
|
||||
- `minimax` and `minimax-portal`: `minimax-fast-mode`
|
||||
@@ -592,20 +592,9 @@ API key auth, and dynamic model resolution.
|
||||
id: "acme-ai",
|
||||
label: "Acme Video",
|
||||
capabilities: {
|
||||
generate: {
|
||||
maxVideos: 1,
|
||||
maxDurationSeconds: 10,
|
||||
supportsResolution: true,
|
||||
},
|
||||
imageToVideo: {
|
||||
enabled: true,
|
||||
maxVideos: 1,
|
||||
maxInputImages: 1,
|
||||
maxDurationSeconds: 5,
|
||||
},
|
||||
videoToVideo: {
|
||||
enabled: false,
|
||||
},
|
||||
maxVideos: 1,
|
||||
maxDurationSeconds: 10,
|
||||
supportsResolution: true,
|
||||
},
|
||||
generateVideo: async (req) => ({ videos: [] }),
|
||||
});
|
||||
@@ -642,17 +631,6 @@ API key auth, and dynamic model resolution.
|
||||
recommended pattern for company plugins (one plugin per vendor). See
|
||||
[Internals: Capability Ownership](/plugins/architecture#capability-ownership-model).
|
||||
|
||||
For video generation, prefer the mode-aware capability shape shown above:
|
||||
`generate`, `imageToVideo`, and `videoToVideo`. Flat aggregate fields such
|
||||
as `maxInputImages`, `maxInputVideos`, and `maxDurationSeconds` are not
|
||||
enough to advertise transform-mode support or disabled modes cleanly.
|
||||
|
||||
Music-generation providers should follow the same pattern:
|
||||
`generate` for prompt-only generation and `edit` for reference-image-based
|
||||
generation. Flat aggregate fields such as `maxInputImages`,
|
||||
`supportsLyrics`, and `supportsFormat` are not enough to advertise edit
|
||||
support; explicit `generate` / `edit` blocks are the expected contract.
|
||||
|
||||
</Step>
|
||||
|
||||
<Step title="Test">
|
||||
|
||||
@@ -330,46 +330,6 @@ api.runtime.tools.registerMemoryCli(/* ... */);
|
||||
|
||||
Channel-specific runtime helpers (available when a channel plugin is loaded).
|
||||
|
||||
`api.runtime.channel.mentions` is the shared inbound mention-policy surface for
|
||||
bundled channel plugins that use runtime injection:
|
||||
|
||||
```typescript
|
||||
const mentionMatch = api.runtime.channel.mentions.matchesMentionWithExplicit(text, {
|
||||
mentionRegexes,
|
||||
mentionPatterns,
|
||||
});
|
||||
|
||||
const decision = api.runtime.channel.mentions.resolveInboundMentionDecision({
|
||||
facts: {
|
||||
canDetectMention: true,
|
||||
wasMentioned: mentionMatch.matched,
|
||||
implicitMentionKinds: api.runtime.channel.mentions.implicitMentionKindWhen(
|
||||
"reply_to_bot",
|
||||
isReplyToBot,
|
||||
),
|
||||
},
|
||||
policy: {
|
||||
isGroup,
|
||||
requireMention,
|
||||
allowTextCommands,
|
||||
hasControlCommand,
|
||||
commandAuthorized,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
Available mention helpers:
|
||||
|
||||
- `buildMentionRegexes`
|
||||
- `matchesMentionPatterns`
|
||||
- `matchesMentionWithExplicit`
|
||||
- `implicitMentionKindWhen`
|
||||
- `resolveInboundMentionDecision`
|
||||
|
||||
`api.runtime.channel.mentions` intentionally does not expose the older
|
||||
`resolveMentionGating*` compatibility helpers. Prefer the normalized
|
||||
`{ facts, policy }` path.
|
||||
|
||||
## Storing runtime references
|
||||
|
||||
Use `createPluginRuntimeStore` to store the runtime reference for use outside
|
||||
|
||||
@@ -1,194 +0,0 @@
|
||||
---
|
||||
summary: "Webhooks plugin: authenticated TaskFlow ingress for trusted external automation"
|
||||
read_when:
|
||||
- You want to trigger or drive TaskFlows from an external system
|
||||
- You are configuring the bundled webhooks plugin
|
||||
title: "Webhooks Plugin"
|
||||
---
|
||||
|
||||
# Webhooks (plugin)
|
||||
|
||||
The Webhooks plugin adds authenticated HTTP routes that bind external
|
||||
automation to OpenClaw TaskFlows.
|
||||
|
||||
Use it when you want a trusted system such as Zapier, n8n, a CI job, or an
|
||||
internal service to create and drive managed TaskFlows without writing a custom
|
||||
plugin first.
|
||||
|
||||
## Where it runs
|
||||
|
||||
The Webhooks plugin runs inside the Gateway process.
|
||||
|
||||
If your Gateway runs on another machine, install and configure the plugin on
|
||||
that Gateway host, then restart the Gateway.
|
||||
|
||||
## Configure routes
|
||||
|
||||
Set config under `plugins.entries.webhooks.config`:
|
||||
|
||||
```json5
|
||||
{
|
||||
plugins: {
|
||||
entries: {
|
||||
webhooks: {
|
||||
enabled: true,
|
||||
config: {
|
||||
routes: {
|
||||
zapier: {
|
||||
path: "/plugins/webhooks/zapier",
|
||||
sessionKey: "agent:main:main",
|
||||
secret: {
|
||||
source: "env",
|
||||
provider: "default",
|
||||
id: "OPENCLAW_WEBHOOK_SECRET",
|
||||
},
|
||||
controllerId: "webhooks/zapier",
|
||||
description: "Zapier TaskFlow bridge",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Route fields:
|
||||
|
||||
- `enabled`: optional, defaults to `true`
|
||||
- `path`: optional, defaults to `/plugins/webhooks/<routeId>`
|
||||
- `sessionKey`: required session that owns the bound TaskFlows
|
||||
- `secret`: required shared secret or SecretRef
|
||||
- `controllerId`: optional controller id for created managed flows
|
||||
- `description`: optional operator note
|
||||
|
||||
Supported `secret` inputs:
|
||||
|
||||
- Plain string
|
||||
- SecretRef with `source: "env" | "file" | "exec"`
|
||||
|
||||
If a secret-backed route cannot resolve its secret at startup, the plugin skips
|
||||
that route and logs a warning instead of exposing a broken endpoint.
|
||||
|
||||
## Security model
|
||||
|
||||
Each route is trusted to act with the TaskFlow authority of its configured
|
||||
`sessionKey`.
|
||||
|
||||
This means the route can inspect and mutate TaskFlows owned by that session, so
|
||||
you should:
|
||||
|
||||
- Use a strong unique secret per route
|
||||
- Prefer secret references over inline plaintext secrets
|
||||
- Bind routes to the narrowest session that fits the workflow
|
||||
- Expose only the specific webhook path you need
|
||||
|
||||
The plugin applies:
|
||||
|
||||
- Shared-secret authentication
|
||||
- Request body size and timeout guards
|
||||
- Fixed-window rate limiting
|
||||
- In-flight request limiting
|
||||
- Owner-bound TaskFlow access through `api.runtime.taskFlow.bindSession(...)`
|
||||
|
||||
## Request format
|
||||
|
||||
Send `POST` requests with:
|
||||
|
||||
- `Content-Type: application/json`
|
||||
- `Authorization: Bearer <secret>` or `x-openclaw-webhook-secret: <secret>`
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
curl -X POST https://gateway.example.com/plugins/webhooks/zapier \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer YOUR_SHARED_SECRET' \
|
||||
-d '{"action":"create_flow","goal":"Review inbound queue"}'
|
||||
```
|
||||
|
||||
## Supported actions
|
||||
|
||||
The plugin currently accepts these JSON `action` values:
|
||||
|
||||
- `create_flow`
|
||||
- `get_flow`
|
||||
- `list_flows`
|
||||
- `find_latest_flow`
|
||||
- `resolve_flow`
|
||||
- `get_task_summary`
|
||||
- `set_waiting`
|
||||
- `resume_flow`
|
||||
- `finish_flow`
|
||||
- `fail_flow`
|
||||
- `request_cancel`
|
||||
- `cancel_flow`
|
||||
- `run_task`
|
||||
|
||||
### `create_flow`
|
||||
|
||||
Creates a managed TaskFlow for the route's bound session.
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"action": "create_flow",
|
||||
"goal": "Review inbound queue",
|
||||
"status": "queued",
|
||||
"notifyPolicy": "done_only"
|
||||
}
|
||||
```
|
||||
|
||||
### `run_task`
|
||||
|
||||
Creates a managed child task inside an existing managed TaskFlow.
|
||||
|
||||
Allowed runtimes are:
|
||||
|
||||
- `subagent`
|
||||
- `acp`
|
||||
|
||||
Example:
|
||||
|
||||
```json
|
||||
{
|
||||
"action": "run_task",
|
||||
"flowId": "flow_123",
|
||||
"runtime": "acp",
|
||||
"childSessionKey": "agent:main:acp:worker",
|
||||
"task": "Inspect the next message batch"
|
||||
}
|
||||
```
|
||||
|
||||
## Response shape
|
||||
|
||||
Successful responses return:
|
||||
|
||||
```json
|
||||
{
|
||||
"ok": true,
|
||||
"routeId": "zapier",
|
||||
"result": {}
|
||||
}
|
||||
```
|
||||
|
||||
Rejected requests return:
|
||||
|
||||
```json
|
||||
{
|
||||
"ok": false,
|
||||
"routeId": "zapier",
|
||||
"code": "not_found",
|
||||
"error": "TaskFlow not found.",
|
||||
"result": {}
|
||||
}
|
||||
```
|
||||
|
||||
The plugin intentionally scrubs owner/session metadata from webhook responses.
|
||||
|
||||
## Related docs
|
||||
|
||||
- [Plugin runtime SDK](/plugins/sdk-runtime)
|
||||
- [Hooks and webhooks overview](/automation/hooks)
|
||||
- [CLI webhooks](/cli/webhooks)
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
summary: "Use Anthropic Claude via API keys or Claude CLI in OpenClaw"
|
||||
summary: "Use Anthropic Claude via API keys in OpenClaw"
|
||||
read_when:
|
||||
- You want to use Anthropic models in OpenClaw
|
||||
title: "Anthropic"
|
||||
@@ -7,19 +7,31 @@ title: "Anthropic"
|
||||
|
||||
# Anthropic (Claude)
|
||||
|
||||
Anthropic builds the **Claude** model family and provides access via an API and
|
||||
Claude CLI. In OpenClaw, Anthropic API keys and Claude CLI reuse are both
|
||||
supported. Existing legacy Anthropic token profiles are still honored at
|
||||
runtime if they are already configured.
|
||||
Anthropic builds the **Claude** model family and provides access via an API.
|
||||
In OpenClaw, new Anthropic setup should use an API key. Existing legacy
|
||||
Anthropic token profiles are still honored at runtime if they are already
|
||||
configured.
|
||||
|
||||
<Warning>
|
||||
Anthropic staff told us OpenClaw-style Claude CLI usage is allowed again, so
|
||||
OpenClaw treats Claude CLI reuse and `claude -p` usage as sanctioned for this
|
||||
integration unless Anthropic publishes a new policy.
|
||||
For Anthropic in OpenClaw, the billing split is:
|
||||
|
||||
For long-lived gateway hosts, Anthropic API keys are still the clearest and
|
||||
most predictable production path. If you already use Claude CLI on the host,
|
||||
OpenClaw can reuse that login directly.
|
||||
- **Anthropic API key**: normal Anthropic API billing.
|
||||
- **Claude subscription auth inside OpenClaw**: Anthropic told OpenClaw users on
|
||||
**April 4, 2026 at 12:00 PM PT / 8:00 PM BST** that this counts as
|
||||
third-party harness usage and requires **Extra Usage** (pay-as-you-go,
|
||||
billed separately from the subscription).
|
||||
|
||||
Our local repros match that split:
|
||||
|
||||
- direct `claude -p` may still work
|
||||
- `claude -p --append-system-prompt ...` can trip the Extra Usage guard when
|
||||
the prompt identifies OpenClaw
|
||||
- the same OpenClaw-like system prompt does **not** reproduce the block on the
|
||||
Anthropic SDK + `ANTHROPIC_API_KEY` path
|
||||
|
||||
So the practical rule is: **Anthropic API key, or Claude subscription with
|
||||
Extra Usage**. If you want the clearest production path, use an Anthropic API
|
||||
key.
|
||||
|
||||
Anthropic's current public docs:
|
||||
|
||||
@@ -190,7 +202,10 @@ requests.
|
||||
This only activates when `params.context1m` is explicitly set to `true` for
|
||||
that model.
|
||||
|
||||
Requirement: Anthropic must allow long-context usage on that credential.
|
||||
Requirement: Anthropic must allow long-context usage on that credential
|
||||
(typically API key billing, or OpenClaw's Claude-login path / legacy token auth
|
||||
with Extra Usage enabled). Otherwise Anthropic returns:
|
||||
`HTTP 429: rate_limit_error: Extra usage is required for long context requests`.
|
||||
|
||||
Note: Anthropic currently rejects `context-1m-*` beta requests when using
|
||||
legacy Anthropic token auth (`sk-ant-oat-*`). If you configure
|
||||
@@ -198,31 +213,38 @@ legacy Anthropic token auth (`sk-ant-oat-*`). If you configure
|
||||
falls back to the standard context window by skipping the context1m beta
|
||||
header while keeping the required OAuth betas.
|
||||
|
||||
## Claude CLI backend
|
||||
## Removed: Claude CLI backend
|
||||
|
||||
The bundled Anthropic `claude-cli` backend is supported in OpenClaw.
|
||||
The bundled Anthropic `claude-cli` backend was removed.
|
||||
|
||||
- Anthropic staff told us this usage is allowed again.
|
||||
- OpenClaw therefore treats Claude CLI reuse and `claude -p` usage as
|
||||
sanctioned for this integration unless Anthropic publishes a new policy.
|
||||
- Anthropic API keys remain the clearest production path for always-on gateway
|
||||
hosts and explicit server-side billing control.
|
||||
- Setup and runtime details are in [/gateway/cli-backends](/gateway/cli-backends).
|
||||
- Anthropic's April 4, 2026 notice says OpenClaw-driven Claude-login traffic is
|
||||
third-party harness usage and requires **Extra Usage**.
|
||||
- Our local repros also show that direct
|
||||
`claude -p --append-system-prompt ...` can hit the same guard when the
|
||||
appended prompt identifies OpenClaw.
|
||||
- The same OpenClaw-like system prompt does not hit that guard on the
|
||||
Anthropic SDK + `ANTHROPIC_API_KEY` path.
|
||||
- Use Anthropic API keys for Anthropic traffic in OpenClaw.
|
||||
|
||||
## Notes
|
||||
|
||||
- Anthropic's public Claude Code docs still document direct CLI usage such as
|
||||
`claude -p`, and Anthropic staff told us OpenClaw-style Claude CLI usage is
|
||||
allowed again. We are treating that guidance as settled unless Anthropic
|
||||
publishes a new policy change.
|
||||
- Anthropic setup-token remains available in OpenClaw as a supported token-auth path, but OpenClaw now prefers Claude CLI reuse and `claude -p` when available.
|
||||
`claude -p`, but Anthropic's separate notice to OpenClaw users says the
|
||||
**OpenClaw** Claude-login path is third-party harness usage and requires
|
||||
**Extra Usage** (pay-as-you-go billed separately from the subscription).
|
||||
Our local repros also show that direct
|
||||
`claude -p --append-system-prompt ...` can hit the same guard when the
|
||||
appended prompt identifies OpenClaw, while the same prompt shape does not
|
||||
reproduce on the Anthropic SDK + `ANTHROPIC_API_KEY` path. For production, we
|
||||
recommend Anthropic API keys instead.
|
||||
- Anthropic setup-token is available again in OpenClaw as a legacy/manual path. Anthropic's OpenClaw-specific billing notice still applies, so use it with the expectation that Anthropic requires **Extra Usage** for this path.
|
||||
- Auth details + reuse rules are in [/concepts/oauth](/concepts/oauth).
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**401 errors / token suddenly invalid**
|
||||
|
||||
- Anthropic token auth can expire or be revoked.
|
||||
- Legacy Anthropic token auth can expire or be revoked.
|
||||
- For new setup, migrate to an Anthropic API key.
|
||||
|
||||
**No API key found for provider "anthropic"**
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
---
|
||||
title: "Arcee AI"
|
||||
summary: "Arcee AI setup (auth + model selection)"
|
||||
read_when:
|
||||
- You want to use Arcee AI with OpenClaw
|
||||
- You need the API key env var or CLI auth choice
|
||||
---
|
||||
|
||||
# Arcee AI
|
||||
|
||||
[Arcee AI](https://arcee.ai) provides access to the Trinity family of mixture-of-experts models through an OpenAI-compatible API. All Trinity models are Apache 2.0 licensed.
|
||||
|
||||
Arcee AI models can be accessed directly via the Arcee platform or through [OpenRouter](/providers/openrouter).
|
||||
|
||||
- Provider: `arcee`
|
||||
- Auth: `ARCEEAI_API_KEY` (direct) or `OPENROUTER_API_KEY` (via OpenRouter)
|
||||
- API: OpenAI-compatible
|
||||
- Base URL: `https://api.arcee.ai/api/v1` (direct) or `https://openrouter.ai/api/v1` (OpenRouter)
|
||||
|
||||
## Quick start
|
||||
|
||||
1. Get an API key from [Arcee AI](https://chat.arcee.ai/) or [OpenRouter](https://openrouter.ai/keys).
|
||||
|
||||
2. Set the API key (recommended: store it for the Gateway):
|
||||
|
||||
```bash
|
||||
# Direct (Arcee platform)
|
||||
openclaw onboard --auth-choice arceeai-api-key
|
||||
|
||||
# Via OpenRouter
|
||||
openclaw onboard --auth-choice arceeai-openrouter
|
||||
```
|
||||
|
||||
3. Set a default model:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
model: { primary: "arcee/trinity-large-thinking" },
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Non-interactive example
|
||||
|
||||
```bash
|
||||
# Direct (Arcee platform)
|
||||
openclaw onboard --non-interactive \
|
||||
--mode local \
|
||||
--auth-choice arceeai-api-key \
|
||||
--arceeai-api-key "$ARCEEAI_API_KEY"
|
||||
|
||||
# Via OpenRouter
|
||||
openclaw onboard --non-interactive \
|
||||
--mode local \
|
||||
--auth-choice arceeai-openrouter \
|
||||
--openrouter-api-key "$OPENROUTER_API_KEY"
|
||||
```
|
||||
|
||||
## Environment note
|
||||
|
||||
If the Gateway runs as a daemon (launchd/systemd), make sure `ARCEEAI_API_KEY`
|
||||
(or `OPENROUTER_API_KEY`) is available to that process (for example, in
|
||||
`~/.openclaw/.env` or via `env.shellEnv`).
|
||||
|
||||
## Built-in catalog
|
||||
|
||||
OpenClaw currently ships this bundled Arcee catalog:
|
||||
|
||||
| Model ref | Name | Input | Context | Cost (in/out per 1M) | Notes |
|
||||
| ------------------------------ | ---------------------- | ----- | ------- | -------------------- | ----------------------------------------- |
|
||||
| `arcee/trinity-large-thinking` | Trinity Large Thinking | text | 256K | $0.25 / $0.90 | Default model; reasoning enabled |
|
||||
| `arcee/trinity-large-preview` | Trinity Large Preview | text | 128K | $0.25 / $1.00 | General-purpose; 400B params, 13B active |
|
||||
| `arcee/trinity-mini` | Trinity Mini 26B | text | 128K | $0.045 / $0.15 | Fast and cost-efficient; function calling |
|
||||
|
||||
The same model refs work for both direct and OpenRouter setups (for example `arcee/trinity-large-thinking`).
|
||||
|
||||
The onboarding preset sets `arcee/trinity-large-thinking` as the default model.
|
||||
|
||||
## Supported features
|
||||
|
||||
- Streaming
|
||||
- Tool use / function calling
|
||||
- Structured output (JSON mode and JSON schema)
|
||||
- Extended thinking (Trinity Large Thinking)
|
||||
@@ -17,17 +17,14 @@ third-party models (GPT-OSS, Qwen, Kimi, GLM, and similar) through a standard
|
||||
|
||||
- Provider: `amazon-bedrock-mantle`
|
||||
- API: `openai-completions` (OpenAI-compatible)
|
||||
- Auth: explicit `AWS_BEARER_TOKEN_BEDROCK` or IAM credential-chain bearer-token generation
|
||||
- Auth: bearer token via `AWS_BEARER_TOKEN_BEDROCK`
|
||||
- Region: `AWS_REGION` or `AWS_DEFAULT_REGION` (default: `us-east-1`)
|
||||
|
||||
## Automatic model discovery
|
||||
|
||||
When `AWS_BEARER_TOKEN_BEDROCK` is set, OpenClaw uses it directly. Otherwise,
|
||||
OpenClaw attempts to generate a Mantle bearer token from the AWS default
|
||||
credential chain, including shared credentials/config profiles, SSO, web
|
||||
identity, and instance or task roles. It then discovers available Mantle
|
||||
models by querying the region's `/v1/models` endpoint. Discovery results are
|
||||
cached for 1 hour, and IAM-derived bearer tokens are refreshed hourly.
|
||||
When `AWS_BEARER_TOKEN_BEDROCK` is set, OpenClaw automatically discovers
|
||||
available Mantle models by querying the region's `/v1/models` endpoint.
|
||||
Discovery results are cached for 1 hour.
|
||||
|
||||
Supported regions: `us-east-1`, `us-east-2`, `us-west-2`, `ap-northeast-1`,
|
||||
`ap-south-1`, `ap-southeast-3`, `eu-central-1`, `eu-west-1`, `eu-west-2`,
|
||||
@@ -35,9 +32,7 @@ Supported regions: `us-east-1`, `us-east-2`, `us-west-2`, `ap-northeast-1`,
|
||||
|
||||
## Onboarding
|
||||
|
||||
1. Choose one auth path on the **gateway host**:
|
||||
|
||||
Explicit bearer token:
|
||||
1. Set the bearer token on the **gateway host**:
|
||||
|
||||
```bash
|
||||
export AWS_BEARER_TOKEN_BEDROCK="..."
|
||||
@@ -45,14 +40,6 @@ export AWS_BEARER_TOKEN_BEDROCK="..."
|
||||
export AWS_REGION="us-west-2"
|
||||
```
|
||||
|
||||
IAM credentials:
|
||||
|
||||
```bash
|
||||
# Any AWS SDK-compatible auth source works here, for example:
|
||||
export AWS_PROFILE="default"
|
||||
export AWS_REGION="us-west-2"
|
||||
```
|
||||
|
||||
2. Verify models are discovered:
|
||||
|
||||
```bash
|
||||
@@ -94,8 +81,8 @@ If you prefer explicit config instead of auto-discovery:
|
||||
|
||||
## Notes
|
||||
|
||||
- OpenClaw can mint the Mantle bearer token for you from AWS SDK-compatible
|
||||
IAM credentials when `AWS_BEARER_TOKEN_BEDROCK` is not set.
|
||||
- Mantle requires a bearer token today. Plain IAM credentials (instance roles,
|
||||
SSO, access keys) are not sufficient without a token.
|
||||
- The bearer token is the same `AWS_BEARER_TOKEN_BEDROCK` used by the standard
|
||||
[Amazon Bedrock](/providers/bedrock) provider.
|
||||
- Reasoning support is inferred from model IDs containing patterns like
|
||||
|
||||
@@ -271,32 +271,3 @@ grounding checks.
|
||||
|
||||
The IAM principal used by the gateway must have the `bedrock:ApplyGuardrail`
|
||||
permission in addition to the standard invoke permissions.
|
||||
|
||||
## Embeddings for memory search
|
||||
|
||||
Bedrock can also serve as the embedding provider for
|
||||
[memory search](/concepts/memory-search). This is configured separately from the
|
||||
inference provider — set `agents.defaults.memorySearch.provider` to `"bedrock"`:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
memorySearch: {
|
||||
provider: "bedrock",
|
||||
model: "amazon.titan-embed-text-v2:0", // default
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Bedrock embeddings use the same AWS SDK credential chain as inference (instance
|
||||
roles, SSO, access keys, shared config, and web identity). No API key is
|
||||
needed. When `provider` is `"auto"`, Bedrock is auto-detected if that
|
||||
credential chain resolves successfully.
|
||||
|
||||
Supported embedding models include Amazon Titan Embed (v1, v2), Amazon Nova
|
||||
Embed, Cohere Embed (v3, v4), and TwelveLabs Marengo. See
|
||||
[Memory configuration reference — Bedrock](/reference/memory-config#bedrock-embedding-config)
|
||||
for the full model list and dimension options.
|
||||
|
||||
@@ -1,201 +0,0 @@
|
||||
---
|
||||
title: "ComfyUI"
|
||||
summary: "ComfyUI workflow image, video, and music generation setup in OpenClaw"
|
||||
read_when:
|
||||
- You want to use local ComfyUI workflows with OpenClaw
|
||||
- You want to use Comfy Cloud with image, video, or music workflows
|
||||
- You need the bundled comfy plugin config keys
|
||||
---
|
||||
|
||||
# ComfyUI
|
||||
|
||||
OpenClaw ships a bundled `comfy` plugin for workflow-driven ComfyUI runs.
|
||||
|
||||
- Provider: `comfy`
|
||||
- Models: `comfy/workflow`
|
||||
- Shared surfaces: `image_generate`, `video_generate`, `music_generate`
|
||||
- Auth: none for local ComfyUI; `COMFY_API_KEY` or `COMFY_CLOUD_API_KEY` for Comfy Cloud
|
||||
- API: ComfyUI `/prompt` / `/history` / `/view` and Comfy Cloud `/api/*`
|
||||
|
||||
## What it supports
|
||||
|
||||
- Image generation from a workflow JSON
|
||||
- Image editing with 1 uploaded reference image
|
||||
- Video generation from a workflow JSON
|
||||
- Video generation with 1 uploaded reference image
|
||||
- Music or audio generation through the shared `music_generate` tool
|
||||
- Output download from a configured node or all matching output nodes
|
||||
|
||||
The bundled plugin is workflow-driven, so OpenClaw does not try to map generic
|
||||
`size`, `aspectRatio`, `resolution`, `durationSeconds`, or TTS-style controls
|
||||
onto your graph.
|
||||
|
||||
## Config layout
|
||||
|
||||
Comfy supports shared top-level connection settings plus per-capability workflow
|
||||
sections:
|
||||
|
||||
```json5
|
||||
{
|
||||
models: {
|
||||
providers: {
|
||||
comfy: {
|
||||
mode: "local",
|
||||
baseUrl: "http://127.0.0.1:8188",
|
||||
image: {
|
||||
workflowPath: "./workflows/flux-api.json",
|
||||
promptNodeId: "6",
|
||||
outputNodeId: "9",
|
||||
},
|
||||
video: {
|
||||
workflowPath: "./workflows/video-api.json",
|
||||
promptNodeId: "12",
|
||||
outputNodeId: "21",
|
||||
},
|
||||
music: {
|
||||
workflowPath: "./workflows/music-api.json",
|
||||
promptNodeId: "3",
|
||||
outputNodeId: "18",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Shared keys:
|
||||
|
||||
- `mode`: `local` or `cloud`
|
||||
- `baseUrl`: defaults to `http://127.0.0.1:8188` for local or `https://cloud.comfy.org` for cloud
|
||||
- `apiKey`: optional inline key alternative to env vars
|
||||
- `allowPrivateNetwork`: allow a private/LAN `baseUrl` in cloud mode
|
||||
|
||||
Per-capability keys under `image`, `video`, or `music`:
|
||||
|
||||
- `workflow` or `workflowPath`: required
|
||||
- `promptNodeId`: required
|
||||
- `promptInputName`: defaults to `text`
|
||||
- `outputNodeId`: optional
|
||||
- `pollIntervalMs`: optional
|
||||
- `timeoutMs`: optional
|
||||
|
||||
Image and video sections also support:
|
||||
|
||||
- `inputImageNodeId`: required when you pass a reference image
|
||||
- `inputImageInputName`: defaults to `image`
|
||||
|
||||
## Backward compatibility
|
||||
|
||||
Existing top-level image config still works:
|
||||
|
||||
```json5
|
||||
{
|
||||
models: {
|
||||
providers: {
|
||||
comfy: {
|
||||
workflowPath: "./workflows/flux-api.json",
|
||||
promptNodeId: "6",
|
||||
outputNodeId: "9",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
OpenClaw treats that legacy shape as the image workflow config.
|
||||
|
||||
## Image workflows
|
||||
|
||||
Set the default image model:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
imageGenerationModel: {
|
||||
primary: "comfy/workflow",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Reference-image editing example:
|
||||
|
||||
```json5
|
||||
{
|
||||
models: {
|
||||
providers: {
|
||||
comfy: {
|
||||
image: {
|
||||
workflowPath: "./workflows/edit-api.json",
|
||||
promptNodeId: "6",
|
||||
inputImageNodeId: "7",
|
||||
inputImageInputName: "image",
|
||||
outputNodeId: "9",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
## Video workflows
|
||||
|
||||
Set the default video model:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
videoGenerationModel: {
|
||||
primary: "comfy/workflow",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Comfy video workflows currently support text-to-video and image-to-video through
|
||||
the configured graph. OpenClaw does not pass input videos into Comfy workflows.
|
||||
|
||||
## Music workflows
|
||||
|
||||
The bundled plugin registers a music-generation provider for workflow-defined
|
||||
audio or music outputs, surfaced through the shared `music_generate` tool:
|
||||
|
||||
```text
|
||||
/tool music_generate prompt="Warm ambient synth loop with soft tape texture"
|
||||
```
|
||||
|
||||
Use the `music` config section to point at your audio workflow JSON and output
|
||||
node.
|
||||
|
||||
## Comfy Cloud
|
||||
|
||||
Use `mode: "cloud"` plus one of:
|
||||
|
||||
- `COMFY_API_KEY`
|
||||
- `COMFY_CLOUD_API_KEY`
|
||||
- `models.providers.comfy.apiKey`
|
||||
|
||||
Cloud mode still uses the same `image`, `video`, and `music` workflow sections.
|
||||
|
||||
## Live tests
|
||||
|
||||
Opt-in live coverage exists for the bundled plugin:
|
||||
|
||||
```bash
|
||||
OPENCLAW_LIVE_TEST=1 COMFY_LIVE_TEST=1 pnpm test:live -- extensions/comfy/comfy.live.test.ts
|
||||
```
|
||||
|
||||
The live test skips individual image, video, or music cases unless the matching
|
||||
Comfy workflow section is configured.
|
||||
|
||||
## Related
|
||||
|
||||
- [Image Generation](/tools/image-generation)
|
||||
- [Video Generation](/tools/video-generation)
|
||||
- [Music Generation](/tools/music-generation)
|
||||
- [Provider Directory](/providers/index)
|
||||
- [Configuration Reference](/gateway/configuration-reference#agent-defaults)
|
||||
@@ -12,7 +12,7 @@ read_when:
|
||||
OpenClaw ships a bundled `fal` provider for hosted image and video generation.
|
||||
|
||||
- Provider: `fal`
|
||||
- Auth: `FAL_KEY` (canonical; `FAL_API_KEY` also works as a fallback)
|
||||
- Auth: `FAL_KEY`
|
||||
- API: fal model endpoints
|
||||
|
||||
## Quick start
|
||||
@@ -68,7 +68,6 @@ The bundled `fal` video-generation provider defaults to
|
||||
`fal/fal-ai/minimax/video-01-live`.
|
||||
|
||||
- Modes: text-to-video and single-image reference flows
|
||||
- Runtime: queue-backed submit/status/result flow for long-running jobs
|
||||
|
||||
To use fal as the default video provider:
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: "Google (Gemini)"
|
||||
summary: "Google Gemini setup (API key + OAuth, image generation, media understanding, web search)"
|
||||
summary: "Google Gemini setup (API key, image generation, media understanding, web search)"
|
||||
read_when:
|
||||
- You want to use Google Gemini models with OpenClaw
|
||||
- You need the API key or OAuth auth flow
|
||||
- You need the API key auth flow
|
||||
---
|
||||
|
||||
# Google (Gemini)
|
||||
@@ -15,7 +15,6 @@ Gemini Grounding.
|
||||
- Provider: `google`
|
||||
- Auth: `GEMINI_API_KEY` or `GOOGLE_API_KEY`
|
||||
- API: Google Gemini API
|
||||
- Alternative provider: `google-gemini-cli` (OAuth)
|
||||
|
||||
## Quick start
|
||||
|
||||
@@ -46,53 +45,12 @@ openclaw onboard --non-interactive \
|
||||
--gemini-api-key "$GEMINI_API_KEY"
|
||||
```
|
||||
|
||||
## OAuth (Gemini CLI)
|
||||
|
||||
An alternative provider `google-gemini-cli` uses PKCE OAuth instead of an API
|
||||
key. This is an unofficial integration; some users report account
|
||||
restrictions. Use at your own risk.
|
||||
|
||||
- Default model: `google-gemini-cli/gemini-3.1-pro-preview`
|
||||
- Alias: `gemini-cli`
|
||||
- Install prerequisite: local Gemini CLI available as `gemini`
|
||||
- Homebrew: `brew install gemini-cli`
|
||||
- npm: `npm install -g @google/gemini-cli`
|
||||
- Login:
|
||||
|
||||
```bash
|
||||
openclaw models auth login --provider google-gemini-cli --set-default
|
||||
```
|
||||
|
||||
Environment variables:
|
||||
|
||||
- `OPENCLAW_GEMINI_OAUTH_CLIENT_ID`
|
||||
- `OPENCLAW_GEMINI_OAUTH_CLIENT_SECRET`
|
||||
|
||||
(Or the `GEMINI_CLI_*` variants.)
|
||||
|
||||
If Gemini CLI OAuth requests fail after login, set
|
||||
`GOOGLE_CLOUD_PROJECT` or `GOOGLE_CLOUD_PROJECT_ID` on the gateway host and
|
||||
retry.
|
||||
|
||||
If login fails before the browser flow starts, make sure the local `gemini`
|
||||
command is installed and on `PATH`. OpenClaw supports both Homebrew installs
|
||||
and global npm installs, including common Windows/npm layouts.
|
||||
|
||||
Gemini CLI JSON usage notes:
|
||||
|
||||
- Reply text comes from the CLI JSON `response` field.
|
||||
- Usage falls back to `stats` when the CLI leaves `usage` empty.
|
||||
- `stats.cached` is normalized into OpenClaw `cacheRead`.
|
||||
- If `stats.input` is missing, OpenClaw derives input tokens from
|
||||
`stats.input_tokens - stats.cached`.
|
||||
|
||||
## Capabilities
|
||||
|
||||
| Capability | Supported |
|
||||
| ---------------------- | ----------------- |
|
||||
| Chat completions | Yes |
|
||||
| Image generation | Yes |
|
||||
| Music generation | Yes |
|
||||
| Image understanding | Yes |
|
||||
| Audio transcription | Yes |
|
||||
| Video understanding | Yes |
|
||||
@@ -139,9 +97,8 @@ The bundled `google` image-generation provider defaults to
|
||||
- Edit mode: enabled, up to 5 input images
|
||||
- Geometry controls: `size`, `aspectRatio`, and `resolution`
|
||||
|
||||
The OAuth-only `google-gemini-cli` provider is a separate text-inference
|
||||
surface. Image generation, media understanding, and Gemini Grounding stay on
|
||||
the `google` provider id.
|
||||
Image generation, media understanding, and Gemini Grounding all stay on the
|
||||
`google` provider id.
|
||||
|
||||
To use Google as the default image provider:
|
||||
|
||||
@@ -187,35 +144,6 @@ To use Google as the default video provider:
|
||||
See [Video Generation](/tools/video-generation) for the shared tool
|
||||
parameters, provider selection, and failover behavior.
|
||||
|
||||
## Music generation
|
||||
|
||||
The bundled `google` plugin also registers music generation through the shared
|
||||
`music_generate` tool.
|
||||
|
||||
- Default music model: `google/lyria-3-clip-preview`
|
||||
- Also supports `google/lyria-3-pro-preview`
|
||||
- Prompt controls: `lyrics` and `instrumental`
|
||||
- Output format: `mp3` by default, plus `wav` on `google/lyria-3-pro-preview`
|
||||
- Reference inputs: up to 10 images
|
||||
- Session-backed runs detach through the shared task/status flow, including `action: "status"`
|
||||
|
||||
To use Google as the default music provider:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
musicGenerationModel: {
|
||||
primary: "google/lyria-3-clip-preview",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
See [Music Generation](/tools/music-generation) for the shared tool
|
||||
parameters, provider selection, and failover behavior.
|
||||
|
||||
## Environment note
|
||||
|
||||
If the Gateway runs as a daemon (launchd/systemd), make sure `GEMINI_API_KEY`
|
||||
|
||||
@@ -29,10 +29,8 @@ Looking for chat channel docs (WhatsApp/Telegram/Discord/Slack/Mattermost (plugi
|
||||
- [Alibaba Model Studio](/providers/alibaba)
|
||||
- [Amazon Bedrock](/providers/bedrock)
|
||||
- [Anthropic (API + Claude CLI)](/providers/anthropic)
|
||||
- [Arcee AI (Trinity models)](/providers/arcee)
|
||||
- [BytePlus (International)](/concepts/model-providers#byteplus-international)
|
||||
- [Chutes](/providers/chutes)
|
||||
- [ComfyUI](/providers/comfy)
|
||||
- [Cloudflare AI Gateway](/providers/cloudflare-ai-gateway)
|
||||
- [DeepSeek](/providers/deepseek)
|
||||
- [fal](/providers/fal)
|
||||
@@ -56,14 +54,12 @@ Looking for chat channel docs (WhatsApp/Telegram/Discord/Slack/Mattermost (plugi
|
||||
- [Perplexity (web search)](/providers/perplexity-provider)
|
||||
- [Qianfan](/providers/qianfan)
|
||||
- [Qwen Cloud](/providers/qwen)
|
||||
- [Runway](/providers/runway)
|
||||
- [SGLang (local models)](/providers/sglang)
|
||||
- [StepFun](/providers/stepfun)
|
||||
- [Synthetic](/providers/synthetic)
|
||||
- [Together AI](/providers/together)
|
||||
- [Venice (Venice AI, privacy-focused)](/providers/venice)
|
||||
- [Vercel AI Gateway](/providers/vercel-ai-gateway)
|
||||
- [Vydra](/providers/vydra)
|
||||
- [vLLM (local models)](/providers/vllm)
|
||||
- [Volcengine (Doubao)](/providers/volcengine)
|
||||
- [xAI](/providers/xai)
|
||||
@@ -74,7 +70,6 @@ Looking for chat channel docs (WhatsApp/Telegram/Discord/Slack/Mattermost (plugi
|
||||
|
||||
- [Additional bundled variants](/providers/models#additional-bundled-provider-variants) - Anthropic Vertex, Copilot Proxy, and Gemini CLI OAuth
|
||||
- [Image Generation](/tools/image-generation) - Shared `image_generate` tool, provider selection, and failover
|
||||
- [Music Generation](/tools/music-generation) - Shared `music_generate` tool, provider selection, and failover
|
||||
- [Video Generation](/tools/video-generation) - Shared `video_generate` tool, provider selection, and failover
|
||||
|
||||
## Transcription providers
|
||||
|
||||
@@ -14,7 +14,6 @@ MiniMax also provides:
|
||||
|
||||
- bundled speech synthesis via T2A v2
|
||||
- bundled image understanding via `MiniMax-VL-01`
|
||||
- bundled music generation via `music-2.5+`
|
||||
- bundled `web_search` through the MiniMax Coding Plan search API
|
||||
|
||||
Provider split:
|
||||
@@ -67,34 +66,6 @@ through the plugin-owned `MiniMax-VL-01` media provider.
|
||||
See [Image Generation](/tools/image-generation) for the shared tool
|
||||
parameters, provider selection, and failover behavior.
|
||||
|
||||
## Music generation
|
||||
|
||||
The bundled `minimax` plugin also registers music generation through the shared
|
||||
`music_generate` tool.
|
||||
|
||||
- Default music model: `minimax/music-2.5+`
|
||||
- Also supports `minimax/music-2.5` and `minimax/music-2.0`
|
||||
- Prompt controls: `lyrics`, `instrumental`, `durationSeconds`
|
||||
- Output format: `mp3`
|
||||
- Session-backed runs detach through the shared task/status flow, including `action: "status"`
|
||||
|
||||
To use MiniMax as the default music provider:
|
||||
|
||||
```json5
|
||||
{
|
||||
agents: {
|
||||
defaults: {
|
||||
musicGenerationModel: {
|
||||
primary: "minimax/music-2.5+",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
See [Music Generation](/tools/music-generation) for the shared tool
|
||||
parameters, provider selection, and failover behavior.
|
||||
|
||||
## Video generation
|
||||
|
||||
The bundled `minimax` plugin also registers video generation through the shared
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user