Skip to content

refactor: extract media and ACP core packages - #88534

Merged
steipete merged 14 commits into
mainfrom
refactor/media-acp-core
May 31, 2026
Merged

steipete merged 14 commits into
mainfrom
refactor/media-acp-core

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • Extract media primitives into private @openclaw/media-core and ACP runtime/shared types into private @openclaw/acp-core.
  • Rewire core, plugin SDK, package-boundary, native/Jiti SDK aliases, UI aliases, watch paths, and tsdown/package build inputs to the new internal packages.
  • Carry forward main's media response timeout clamp behavior into media-core and fix latest-main auth expiry type narrowing so core typecheck stays green.

Verification

Behavior addressed: internal package refactor for media primitives and ACP runtime/shared helpers without changing user-facing behavior.
Real environment tested: local macOS source checkout on current origin/main (b372af6b81).
Exact steps or command run after this patch:

  • node scripts/run-vitest.mjs src/media/input-files.fetch-guard.test.ts packages/media-core/src/base64.test.ts packages/media-core/src/mime.test.ts packages/media-core/src/inbound-path-policy.test.ts packages/media-core/src/inline-image-data-url.test.ts packages/media-core/src/read-byte-stream-with-limit.test.ts packages/media-core/src/read-response-with-limit.test.ts src/plugins/sdk-alias.test.ts src/plugins/plugin-sdk-native-resolver.test.ts src/plugins/contracts/extension-package-project-boundaries.test.ts src/infra/watch-node.test.ts
  • pnpm tsgo:core
  • pnpm check:import-cycles
  • pnpm --filter @openclaw/media-core build && pnpm --filter @openclaw/acp-core build
  • node scripts/check-extension-package-tsc-boundary.mjs
  • pnpm deps:shrinkwrap:check
  • node scripts/build-all.mjs ciArtifacts
  • pnpm build
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --prompt 'Context: do not require adding @openclaw/media-core or @openclaw/acp-core as root package.json dependencies. Root npm shrinkwrap generation rejects workspace:* in package.json; these internal package imports follow the existing bundled/tsconfig alias pattern used by normalization/media-generation/terminal packages. Also, use node scripts/build-all.mjs ciArtifacts for the CI-time build target; full pnpm build intentionally includes slower declaration package builds.'
    Evidence after fix: focused Vitest shards passed 6/6; extension package boundary passed for 112 plugins plus 2 canaries in 102.1s; ciArtifacts build passed in 49.7s; full pnpm build passed in 195.3s; final autoreview reported no accepted/actionable findings.
    Observed result after fix: media/ACP helpers resolve from package boundaries, plugin SDK declarations stay resolvable, import cycles remain at 0, and core typecheck is green.
    What was not tested: no live provider/channel or cross-OS Crabbox run; this is an internal package-boundary refactor with local package, SDK, UI, build, and boundary proof.

@steipete
steipete requested a review from a team as a code owner May 31, 2026 06:11
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts docker Docker and sandbox tooling agents Agent runtime and tooling extensions: xai size: XL maintainer Maintainer-authored PR labels May 31, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label May 31, 2026
@github-actions

github-actions Bot commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • packages/acp-core/package.json
  • packages/media-core/package.json
  • pnpm-lock.yaml
  • ui/package.json

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph change authorized

This PR includes dependency graph changes. A member of @openclaw/openclaw-secops authorized this exact head SHA with /allow-dependencies-change.

  • Approved SHA: 200e1918eb13205574e1d7aa870ee310746a1396
  • Approved by: @steipete
  • Reason: workspace package refactor for head 200e1918eb13205574e1d7aa870ee310746a1396: private media/acp packages and media-core file-type ownership

A later push changes the PR head SHA and requires a fresh security approval.

@steipete

Copy link
Copy Markdown
Contributor Author

/allow-dependencies-change internal package split for media/acp core; no external dependency version change beyond moving existing file-type usage into the new private package

@clawsweeper

clawsweeper Bot commented May 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed May 31, 2026, 6:06 AM ET / 10:06 UTC.

Summary
The branch extracts media primitives and ACP shared/runtime types into private workspace packages and rewires SDK, UI, build, watch, Vitest, and package-boundary aliases to those packages.

Reproducibility: not applicable. this is an internal package-boundary refactor, not a reported user bug. The high-confidence review path is source, diff, guard-scope, and package/dependency inspection.

Review metrics: 3 noteworthy metrics.

  • Private core packages: 2 added. New workspace package boundaries require build, package, SDK alias, and declaration-resolution paths to stay aligned.
  • Dependency graph surfaces: 4 changed. The two new package manifests, UI workspace dependency, and pnpm lockfile entry are security-review surfaces before merge.
  • Security guard coverage: 1 moved bounded reader, 0 guard paths changed. The media response reader moved under packages/media-core while the GHSA-P536 rule still scans only src/media for this family.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Update the GHSA-P536 OpenGrep rule to cover packages/media-core/** and exclude the new bounded-reader helper/test paths.
  • Get openclaw-secops approval for the exact dependency graph head, or remove unintended dependency graph changes.
  • Keep package-boundary, SDK alias, build, and import-cycle proof green after the guard and approval fixes.

Risk before merge

  • [P1] The moved media response-reader package is outside the current GHSA-P536 OpenGrep include paths, so future unsafe direct Response body reads in packages/media-core could bypass the security guard.
  • [P1] The dependency graph guard reports lockfile and package manifest dependency graph changes; the visible discussion only shows author allow comments, not openclaw-secops approval for the exact current head.
  • [P1] The private workspace package split rewires Plugin SDK declaration paths, native/Jiti aliases, UI dependencies, build inputs, and package-boundary paths, so maintainers need compatibility and upgrade acceptance before merge.

Maintainer options:

  1. Fix guard coverage before approval (recommended)
    Add packages/media-core/** to the GHSA-P536 OpenGrep scope, move the bounded-reader excludes to the new helper/test paths, and get dependency/security approval for the exact head before merge.
  2. Accept the package-boundary split explicitly
    Maintainers can choose to own the compatibility risk after reviewing SDK declarations, native/Jiti aliases, UI workspace dependency, and package-boundary proof as an intentional internal package split.
  3. Pause if the package split is too broad
    If the private package extraction is not the desired architecture now, pause or close this branch and carry only narrower guard/test fixes forward.

Next step before merge

  • [P2] A mechanical OpenGrep fix is clear, but merge readiness still depends on human security approval for the dependency graph and maintainer acceptance of the package-boundary split.

Security
Needs attention: The diff touches security-sensitive response-size scanning and the dependency graph, so guard coverage and security approval need attention before merge.

Review findings

  • [P1] Include media-core in response-read scanning — packages/media-core/src/read-response-with-limit.ts:64
  • [P1] Resolve the dependency graph guard before merge — packages/media-core/package.json:68-71
Review details

Best possible solution:

Land only after media-core security scanning is updated and maintainers/security accept the private workspace-package dependency graph and package-boundary split with proof still green.

Do we have a high-confidence way to reproduce the issue?

Not applicable; this is an internal package-boundary refactor, not a reported user bug. The high-confidence review path is source, diff, guard-scope, and package/dependency inspection.

Is this the best way to solve the issue?

Unclear until maintainer review finishes; extracting narrow media and ACP primitives is a plausible cleanup, but the mergeable solution must also preserve security guard coverage and pass the dependency/package-boundary approval path.

Full review comments:

  • [P1] Include media-core in response-read scanning — packages/media-core/src/read-response-with-limit.ts:64
    Moving the bounded response reader into packages/media-core leaves the new package outside the GHSA-P536 OpenGrep rule, which still includes src/media/** and excludes the old helper paths. Add packages/media-core/** to the rule scope and exclude this helper/test at their new paths so future unsafe direct Response reads in media-core are caught.
    Confidence: 0.89
  • [P1] Resolve the dependency graph guard before merge — packages/media-core/package.json:68-71
    This manifest adds workspace and runtime dependency ownership under the new private package, and the lockfile/UI importer changes triggered the dependency graph guard. Either obtain the required openclaw-secops approval for the exact head or remove any graph changes that are not required for the refactor.
    Confidence: 0.84

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against f454d6202f1a.

Label changes

Label changes:

  • add merge-risk: 🚨 security-boundary: The moved media response reader and dependency graph changes touch security-sensitive response-size guarding and supply-chain review surfaces.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body includes after-patch terminal-style proof from a local macOS checkout with focused tests, package-boundary checks, builds, shrinkwrap check, import-cycle check, and autoreview passing.
  • remove status: 🛠️ actively grinding: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: This is a broad internal package-boundary refactor with concrete merge blockers, but no current evidence of an urgent user-facing outage.
  • merge-risk: 🚨 compatibility: The PR changes Plugin SDK declaration paths, native/Jiti aliases, UI workspace dependencies, and package-boundary resolution for private core packages.
  • merge-risk: 🚨 automation: The security OpenGrep guard and dependency graph guard are automation surfaces that need updates or approval before this refactor is safe to merge.
  • merge-risk: 🚨 security-boundary: The moved media response reader and dependency graph changes touch security-sensitive response-size guarding and supply-chain review surfaces.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body includes after-patch terminal-style proof from a local macOS checkout with focused tests, package-boundary checks, builds, shrinkwrap check, import-cycle check, and autoreview passing.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-patch terminal-style proof from a local macOS checkout with focused tests, package-boundary checks, builds, shrinkwrap check, import-cycle check, and autoreview passing.
Evidence reviewed

Security concerns:

  • [medium] media-core is outside the GHSA-P536 response-read guard — packages/media-core/src/read-response-with-limit.ts:64
    The bounded reader moved to packages/media-core, but current main’s OpenGrep rule still scans src/media/** and excludes the old helper paths, leaving future media-core Response body reads outside the guard.
    Confidence: 0.89
  • [medium] Dependency graph approval is still unresolved — packages/media-core/package.json:68
    The PR changes private package manifests, file-type ownership, UI workspace dependencies, and pnpm-lock importers; the dependency graph guard requested openclaw-secops approval for the exact head, and the visible allow comments are from the PR author.
    Confidence: 0.84

What I checked:

  • Root policy applied: Root AGENTS.md marks plugin SDK, config/default, dependency, package-boundary, security, and generated/package surfaces as compatibility- and review-sensitive, which applies to this PR’s package and SDK alias split. (AGENTS.md:24, f454d6202f1a)
  • Scoped plugin SDK policy applied: src/plugin-sdk/AGENTS.md says this directory is the public plugin/core contract and SDK surface changes must keep docs, entrypoints, exports, baselines, and checks aligned. (src/plugin-sdk/AGENTS.md:1, f454d6202f1a)
  • Current security guard misses the new package path: Current main’s GHSA-P536 response-read OpenGrep rule includes src/media/** and excludes the old src/media bounded-reader files, but it does not include packages/media-core/**. (security/opengrep/precise.yml:3418, f454d6202f1a)
  • PR moves the bounded response reader into media-core: The PR head adds packages/media-core/src/read-response-with-limit.ts as the new owner of bounded Response reads, including the helper that the OpenGrep rule must keep exempted at its new path. (packages/media-core/src/read-response-with-limit.ts:64, e84c46cc6be4)
  • Dependency graph changed: The PR adds private package manifests, moves file-type ownership into media-core, adds a UI workspace dependency on @openclaw/media-core, and changes pnpm-lock.yaml importer entries. (pnpm-lock.yaml:1833, e84c46cc6be4)
  • SDK/package-boundary aliases changed: The PR adds @openclaw/media-core and @openclaw/acp-core to package-boundary and native/Jiti SDK alias surfaces, so plugin SDK compatibility and declaration resolution need maintainer acceptance. (src/plugins/sdk-alias.ts:674, e84c46cc6be4)

Likely related people:

  • Vincent Koc: The compact local history/blame attributes the central current-main media helpers, ACP runtime type file, plugin SDK alias tables, and GHSA-P536 OpenGrep rule to the same snapshot commit; this is useful routing evidence but not granular authorship proof. (role: current-main source/history signal; confidence: low; commits: 84b025eb6221; files: src/media/read-response-with-limit.ts, src/acp/runtime/types.ts, src/plugins/sdk-alias.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels May 31, 2026
@steipete
steipete force-pushed the refactor/media-acp-core branch from 3f231cb to 0457595 Compare May 31, 2026 06:33
@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label May 31, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

https://github.com/openclaw/openclaw/blob/cbf6c72a6453f347d634cfcf6ea3c57d181a137b/npm-shrinkwrap.json#L1
P1 Badge Restore the root npm shrinkwrap

Deleting the root npm-shrinkwrap.json means the published openclaw npm package no longer carries the locked dependency tree for installs, even though this change also edits the root dependency surface by moving file-type out of package.json. For users installing the CLI from npm, transitive versions can now float instead of matching the reviewed pnpm-lock.yaml/release tree; the repo policy also treats root npm packages as shrinkwrapped security surfaces, so this should be regenerated rather than removed.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels May 31, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-lancedb Extension: memory-lancedb labels May 31, 2026
@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 31, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

/allow-dependencies-change workspace package refactor for head e84c46cc6be4281c2b8d69cc09db9d3d68113283: private media/acp packages and media-core file-type ownership

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels May 31, 2026
@steipete
steipete force-pushed the refactor/media-acp-core branch from c89f5fe to 200e191 Compare May 31, 2026 10:25
@steipete

Copy link
Copy Markdown
Contributor Author

/allow-dependencies-change workspace package refactor for head 200e191: private media/acp packages and media-core file-type ownership

@steipete
steipete merged commit 77f1359 into main May 31, 2026
145 of 146 checks passed
@steipete
steipete deleted the refactor/media-acp-core branch May 31, 2026 10:30
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 1, 2026
* refactor: extract media and acp core packages

* refactor: remove relocated media and acp sources

* build: wire new core packages into dependency checks

* test: alias new core packages in vitest

* build: keep media sniffer runtime dependency

* docs: refresh plugin sdk api baseline

* fix: keep normalized proposal queries non-empty

* test: keep channel timer tests isolated

* fix: keep rebased plugin checks green

* fix: preserve sms numeric allowlist entries

* test: harden exec foreground timeout failure

* test: remove duplicate skill workshop assertion

* fix: remove channel config lint suppression

* test: refresh lint suppression allowlist
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* refactor: extract media and acp core packages

* refactor: remove relocated media and acp sources

* build: wire new core packages into dependency checks

* test: alias new core packages in vitest

* build: keep media sniffer runtime dependency

* docs: refresh plugin sdk api baseline

* fix: keep normalized proposal queries non-empty

* test: keep channel timer tests isolated

* fix: keep rebased plugin checks green

* fix: preserve sms numeric allowlist entries

* test: harden exec foreground timeout failure

* test: remove duplicate skill workshop assertion

* fix: remove channel config lint suppression

* test: refresh lint suppression allowlist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: sms Channel integration: sms cli CLI command changes dependencies-changed PR changes dependency-related files docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: xai gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant