Commit Graph

110 Commits

Author SHA1 Message Date
Peter Steinberger b653d94918 chore(lint): enable no-useless-assignment 2026-05-31 22:40:48 +01:00
Peter Steinberger 304e2c83c0 chore(lint): enable stricter oxlint rules 2026-05-31 18:59:02 +01:00
Peter Steinberger 00d8d7ead0 refactor: extract normalization core package
Extract shared normalization/coercion helpers into private @openclaw/normalization-core workspace package while preserving existing plugin SDK helper subpaths.\n\nAlso keeps direct normalization-core imports internal, wires UI/build/loader resolution, and replaces the slow PR network CodeQL lane with a fast added-line boundary scan while retaining full CodeQL for scheduled/manual runs.\n\nVerification: local moved tests, plugin SDK boundary tests, extension loader tests, agents-support shard, UI build/test, build artifacts, lint, workflow guards, autoreview, and GitHub CI passed on PR head 963d893715.
2026-05-31 01:33:00 +01:00
scotthuang 7920af0c9e refactor: route browser screenshot vision through shared media understanding
* feat(browser): add optional vision understanding to screenshot tool

* fix(browser): wrap vision output as external content, enforce maxBytes, forward auth profiles

* fix(browser): remove no-op scope/attachments config, drop profile pass-through lacking runtime support

* feat(media-understanding): add profile/preferredProfile to DescribeImageFileWithModelParams and forward to describeImage

* style(browser): add curly braces to satisfy eslint curly rule

* fix(browser): correct tools.browser.enabled help text to match actual behavior

* fix(browser): thread agentDir/workspaceDir from plugin tool context into browser vision

* refactor(browser): move vision config from tools.browser to browser.models

The browser plugin's vision configuration now lives on the top-level
`browser` config namespace (browser.models, browser.visionEnabled,
browser.visionPrompt, etc.) instead of `tools.browser`. This aligns
with the plugin's existing config location and avoids confusion between
tool-level and plugin-level settings.

- Remove tools.browser from ToolsSchema and ToolsConfig
- Add models/vision* fields to BrowserConfig and its zod schema
- Update getBrowserVisionConfig to read from cfg.browser
- Update schema help, labels, and quality test
- Update vision.test.ts to use new config shape

* docs(browser): add screenshot vision configuration section

Document the new browser.models config for automatic screenshot
description via vision models, enabling text-only main models to
reason about web page content.

* fix(browser): remove deliverable media markers from vision result, drop unused import

P1: Vision-success path no longer exposes the raw screenshot as
deliverable media (removes MEDIA: line and details.media.mediaUrl).
This prevents channel delivery from auto-sending sensitive page content
when the intended output is a text description.

P2: Remove unused ToolsMediaUnderstandingSchema import that would fail
noUnusedLocals typecheck.

* fix(browser): add command/args fields to browser models schema

The browser vision model schema uses .strict(), so CLI-type entries
with command/args were rejected by TypeScript. Add these fields to
align with MediaUnderstandingModelSchema.

* chore(browser): remove debug console.log statements

* fix(browser): harden screenshot vision result against MEDIA: directive injection and restore image sanitization on failure fallback

ClawSweeper #84247 review round 2:

P1 (security, high): neutralize line-start MEDIA: directives in vision descriptions
before wrapping with wrapExternalContent. The agent media extractor scans every
browser tool-result text block via splitMediaFromOutput which treats line-start
MEDIA: as a trusted local-media delivery directive, and browser is on the
trusted-media allowlist. Without neutralization, page or vision-provider output
containing 'MEDIA:/tmp/secret.png' could synthesize a channel-deliverable media
artifact from untrusted content. wrapExternalContent itself does not strip
line-start directives. Introduce neutralizeMediaDirectives in vision.ts that
prepends '[neutralized] ' to any line whose trimStart() begins with MEDIA:
(case-insensitive), defanging the parser anchor while keeping the original
text human-readable.

P2 (compatibility): pass resolveRuntimeImageSanitization() to imageResultFromFile
in the vision-failure catch fallback. The non-vision screenshot path already
forwards this option (d5cc0d53b7) so configured agents.defaults.imageMaxDimensionPx
takes effect. Without this fix, any provider timeout/error silently bypasses the
sanitization guard and returns a raw full-resolution screenshot.

Regression coverage:
- vision.test.ts: 6 unit cases for neutralizeMediaDirectives (no-op fast path,
  mid-line MEDIA: untouched, line-start defanged, leading-whitespace defanged,
  case-insensitive, multiple directives per blob).
- browser-tool.test.ts: 2 integration cases that drive the full screenshot
  tool execute path:
    - 'neutralizes MEDIA: directives in vision text and does not attach media'
      asserts no line matches /^\s*MEDIA:/i in returned text, secret path text
      is preserved verbatim, details.media is absent, and imageResultFromFile
      is not called on the success path.
    - 'preserves screenshot image sanitization on vision failure fallback'
      mocks describeImageFileWithModel to reject and asserts the fallback
      imageResultFromFile call receives imageSanitization: {maxDimensionPx:1600}
      plus the 'browser screenshot vision failed' extraText.

* fix(browser): apply clawsweeper fallback media fix from PR #84247

* refactor: reuse media image understanding for browser screenshots

* refactor: use structured media delivery

* test: update music completion media instruction expectation

* fix: trim buffered reply directive padding

* test: refresh codex prompt snapshots for message media aliases

---------

Co-authored-by: scotthuang <scotthuang@tencent.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-05-31 00:00:19 +01:00
Peter Steinberger de1dfab03e refactor: move terminal core into package (#88279)
* refactor: move terminal core into package

* refactor: move terminal module files

* fix: clean terminal package CI followups

* test: update lint suppression allowlist

* fix: ship terminal core runtime aliases
2026-05-30 11:07:45 +02:00
Peter Steinberger b1117d9862 refactor: extract gateway client package (#87797)
* refactor: extract gateway client package

* chore: drop generated gateway package artifacts

* refactor: move gateway protocol package

* refactor: remove old gateway protocol tree

* test: keep auth compat split in run mode

* test: expose gateway wrapper options for internals

* fix: watch moved gateway package sources

* test: normalize slash command import guard

* chore: teach knip gateway package entries

* ci: route gateway client package checks

* fix: reuse ipaddr for gateway client hosts

* fix: sync gateway protocol usage schema
2026-05-29 02:23:42 +01:00
Peter Steinberger c95d348bb5 fix(cli): reject loose numeric options 2026-05-27 03:52:40 -04:00
Peter Steinberger d2d5010aec fix: reject partial numeric CLI options 2026-05-27 03:34:44 -04:00
Peter Steinberger abb85ccc86 fix(cli): validate timeout and banner TTY state
Fixes two CLI edge cases found by clawpatch.

- `emitCliBanner` now honors injected TTY state before writing to stdout.
- Nodes RPC timeout handling now rejects malformed `--timeout` values with the existing timeout parser instead of forwarding `NaN` into gateway transport calls.

Proof:
- `node scripts/run-vitest.mjs src/cli/banner.test.ts src/cli/nodes-cli/register.invoke.approval-transport-timeout.test.ts`
- `pnpm exec oxfmt --check --threads=1 src/cli/banner.ts src/cli/banner.test.ts src/cli/nodes-cli/rpc.runtime.ts src/cli/nodes-cli/register.invoke.approval-transport-timeout.test.ts`
- `.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main`
- Real CLI proof: `pnpm openclaw nodes list --timeout nope --json` exits 1 with `Invalid --timeout`.
- Runtime banner proof: injected `isTty:false` with `stdout.isTTY=true` produced `writes=0`, `emitted=false`.
2026-05-26 21:08:11 +01:00
Peter Steinberger 0ec29289c6 fix: tighten CLI utility failure handling (#86918)
* fix: tighten cli utility failure handling

* fix: preserve completion install error cause

* fix: keep update completion refresh best effort
2026-05-26 18:08:44 +01:00
Gio Della-Libera ee9813f478 fix(cli): keep nodes json stdout clean (#84423)
Co-authored-by: Gio Della-Libera <giodl@microsoft.com>
2026-05-21 18:05:11 -07:00
clawsweeper[bot] b3ec4f08d1 Route JSON-mode plugin registration logs to stderr (#84741)
Summary:
- The PR extracts JSON-mode console-to-stderr routing into a shared CLI helper, wraps root and `nodes` lazy plugin registration, adds nodes registration coverage, and adds a changelog entry.
- Reproducibility: yes. for source-level reproduction: the linked report shows `openclaw nodes list --json 2>  ... ssing the existing JSON stderr guard. I did not run the live Helm/container repro in this read-only review.

Automerge notes:
- PR branch already contained follow-up commit before automerge: Route JSON-mode plugin registration logs to stderr

Validation:
- ClawSweeper review passed for head c9d0867db0.
- Required merge gates passed before the squash merge.

Prepared head SHA: c9d0867db0
Review: https://github.com/openclaw/openclaw/pull/84741#issuecomment-4503741078

Co-authored-by: Andy Ye <35905412+TurboTheTurtle@users.noreply.github.com>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
Approved-by: takhoffman
Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
2026-05-21 00:35:40 +00:00
Josh Avant e1c1c57242 Fix node approval scope requests (#84392)
* fix(cli): request node approval scopes

* docs(changelog): note node approval scope fix
2026-05-19 21:47:10 -05:00
Peter Steinberger 0dbe2e9e12 test: dedupe nodes approval timeout mock reads 2026-05-12 19:57:38 +01:00
Peter Steinberger 00d0d4bd19 test: guard nodes approval mock calls 2026-05-12 07:53:20 +01:00
Vincent Koc e45b9d7a74 fix(cli): clarify remaining required options 2026-05-09 09:24:59 +08:00
Peter Steinberger 330ba1fa31 refactor: move canvas to plugin surfaces 2026-05-07 09:07:18 +01:00
Peter Steinberger 59fb9e5ca7 refactor: unify lazy import loaders 2026-05-02 10:55:59 +01:00
Peter Steinberger 811d90778f refactor: trim unused nodes cli type export 2026-05-02 06:29:53 +01:00
Peter Steinberger 7fb2a356e8 fix(nodes): allow removing stale paired nodes 2026-04-27 13:20:52 +01:00
Vincent Koc a50edbdc60 fix(cli): keep nodes list aligned with nodes status (#72619)
* fix(cli): keep nodes list aligned with nodes status

* fix(clownfish): address review for ghcrawl-156588-autonomous-smoke (1)

* fix(cli): keep nodes list aligned with nodes status
2026-04-27 02:39:33 -07:00
Vincent Koc 0f7d9c9570 fix(runtime): split approval and gateway client seams 2026-04-11 18:36:48 +01:00
Peter Steinberger 1fb2e18f47 refactor: simplify cli conversions 2026-04-11 01:27:48 +01:00
Peter Steinberger c05107adcb refactor: simplify nodes notify inputs 2026-04-11 00:36:42 +01:00
Peter Steinberger 594a84cfa4 refactor: simplify nodes invoke option values 2026-04-10 23:26:29 +01:00
Peter Steinberger 1e72b11825 refactor: remove redundant canvas option conversions 2026-04-10 22:59:08 +01:00
Peter Steinberger 7c37de2d41 refactor: remove redundant location option conversions 2026-04-10 22:58:10 +01:00
Peter Steinberger 3a2dd52cf9 refactor: remove redundant screen option conversions 2026-04-10 22:56:41 +01:00
Peter Steinberger 9470b616c9 refactor: remove redundant camera CLI conversions 2026-04-10 21:53:47 +01:00
Peter Steinberger df91db906f refactor: dedupe cli cron trimmed readers 2026-04-08 01:36:38 +01:00
Peter Steinberger 1a3f141215 refactor: dedupe cli lowercase helpers 2026-04-07 17:50:38 +01:00
Peter Steinberger 978a0a720e refactor: dedupe cli lowercase helpers 2026-04-07 13:01:23 +01:00
Peter Steinberger 74ea9de6f2 refactor: dedupe reply lowercase helpers 2026-04-07 10:37:39 +01:00
Peter Steinberger 02c08b3929 refactor: dedupe shared normalizer readers 2026-04-07 08:40:35 +01:00
Peter Steinberger 679a393f6d refactor: dedupe metadata readers 2026-04-07 07:36:11 +01:00
Peter Steinberger 8a40cd7ed4 refactor: dedupe core helper error formatting 2026-04-07 02:03:34 +01:00
Shakker 36c8282795 refactor: lazy load cli gateway helper runtimes 2026-04-04 01:07:28 +09:00
Peter Steinberger f6317fb747 fix(gateway): stop pinning node commands to pairing state 2026-04-01 18:27:06 +09:00
Peter Steinberger db0cea5689 refactor(gateway): extract node pairing reconciliation 2026-04-01 18:02:31 +09:00
Peter Steinberger 3f1d6fe147 test: speed up cli and command suites 2026-03-31 02:25:02 +01:00
Peter Steinberger 193f781fad fix: stabilize ci and serial test gate 2026-03-30 00:43:01 +01:00
Peter Steinberger 2255e04b07 test(nodes): update coverage after exec consolidation 2026-03-30 00:41:06 +01:00
Peter Steinberger 5dae663ea4 refactor(nodes): remove nodes.run execution path 2026-03-30 00:41:06 +01:00
Peter Steinberger f16c176a4c fix: disambiguate legacy mac node identities 2026-03-29 22:47:15 +01:00
Peter Steinberger 4ee41cc6f3 refactor(cli): separate json payload output from logging 2026-03-22 23:19:17 +00:00
Peter Steinberger f806b07208 refactor: share cli install helpers 2026-03-14 00:30:14 +00:00
Vincent Koc 04e103d10e fix(terminal): stabilize skills table width across Terminal.app and iTerm (#42849)
* Terminal: measure grapheme display width

* Tests: cover grapheme terminal width

* Terminal: wrap table cells by grapheme width

* Tests: cover emoji table alignment

* Terminal: refine table wrapping and width handling

* Terminal: stop shrinking CLI tables by one column

* Skills: use Terminal-safe emoji in list output

* Changelog: note terminal skills table fixes

* Skills: normalize emoji presentation across outputs

* Terminal: consume unsupported escape bytes in tables
2026-03-11 09:13:10 -04:00
Peter Steinberger 68c674d37c refactor(security): simplify system.run approval model 2026-03-11 01:43:06 +00:00
Peter Steinberger c6575891c7 fix(exec): inherit ask from exec-approvals.json when tools.exec.ask unset
Landed from contributor PR #29187 by @Bartok9.

Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com>
2026-03-08 00:35:50 +00:00
Peter Steinberger 3c71e2bd48 refactor(core): extract shared dedup helpers 2026-03-07 10:41:05 +00:00