mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5092] [MERGED] feat(capability-packages): contributions.assets — general package asset delivery (Capability API 1.10) #6625
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6625
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5092
Author: @kolacheee
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @kolacheee
Base:
staging← Head:feat/5091-package-asset-paths📝 Commits (7)
b094fdafeat(capability-packages): contributions.assets — general package asset delivery (Capability API 1.10, #5091)30394abMerge branch 'staging' into feat/5091-package-asset-pathsfe0efd4fix(capability-packages): apply CodeRabbit review to #50922a7b9e5Merge remote-tracking branch 'origin/feat/5091-package-asset-paths' into feat/5091-package-asset-paths15ee1f2fix(capability-packages): drop immutable asset caching; hash-verify every served body8f34188fix(capability-packages): drop unused stat import left by the verification-cache removalee41cb5Merge branch 'staging' into feat/5091-package-asset-paths📊 Changes
8 files changed (+445 additions, -164 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/development/optional-agent-packages.md(+36 -5)📝
packages/client/src/components/capabilities/CapabilityElement.tsx(+6 -1)📝
packages/server/src/routes/capability-packages.routes.ts(+22 -28)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+75 -86)📝
packages/shared/src/schemas/capability-package.schema.ts(+108 -9)📝
scripts/regressions/capability-package-cache.regression.ts(+123 -20)📝
scripts/regressions/capability-package-lifecycle.regression.ts(+73 -15)📄 Description
Closes #5091
Why
An installed Agent package can serve at most two images over HTTP, and only by declaring the
home-browser-tabslot —contributions.homeBrowserTab.iconPathsis the only allowlist the asset route consults. A package that needs real art or data files (the driving case: agame-surfaceExperience shipping a tileset, sprite atlas, and tilemap JSON) cannot ship them at all; the workarounds are inlining art asdata:URIs into a bundle that must already be a single file, or abusing unrelated upload routes.What changed
Capability API 1.10 —
contributions.assets(packages/shared/src/schemas/capability-package.schema.ts):assets.paths— up to 256 relative paths, image extensions (png/webp/gif/jpeg) plus.jsonfor tilemap/atlas metadata. No SVG/HTML/scripts — active documents stay off this same-origin route.files[](superRefine, fails at install with a clear message). The pre-existing icon-paths ⊆files[]check is hoisted out of thehome-browser-tabslot branch so it now applies whenevericonPathsis present — previously a manifest could carry unvalidated icon paths by omitting the slot.contributions.assetsis gated onschemaVersion 2+capabilityApi ≥ 1.10, so authors get the versioned compatibility message instead of a cryptic strict-schema error on older Engines.supportedCapabilityApibumps to{1, 10}.Serving (
package-manager.service.ts,capability-packages.routes.ts):browserTabAssetis generalized topackageAsset: the allowlist becomes the union oficonPathsandassets.paths; nothing else in the verification chain moves (path containment,files[]membership, content-type allowlist, hash + TOCTOU re-verification on every read)..jsonjoins the content-type map;manifest.jsonis explicitly refused.?v=<installed version>is servedpublic, max-age=31536000, immutable— a shipped tileset costs one download per version.Forward compatibility (review-found blocker): catalog parsing was all-or-nothing over strict schemas, so the first published package using any future manifest key would have bricked the entire Agents browser (and install/update paths) on every older Engine. New
parseCapabilityCatalogWithCompatparses the envelope, validates entries individually, and drops+logs entries this Engine can't understand — pinned by a new lifecycle-regression case. Publishing note: an assets-declaring package should still wait until 1.10 Engines are widely installed, since only Engines with this PR have tolerant catalog parsing.Install hardening (review-found): duplicate-file detection is now case-folded — on NTFS/APFS,
Tiles.PNG+tiles.pngextract onto one file and the losing declaration's hash could never verify; such manifests are now rejected at install.Client (
CapabilityElement.tsx): every capability element now receivescapabilityProps.packageIdandcapabilityProps.packageVersion, giving packages a supported way to build the version-pinned URL (previously the documented immutable path was unreachable without re-fetching/installedor scrapingimport.meta.url).Docs + release notes:
docs/development/optional-agent-packages.mdgains the Capability API 1.10 section;CHANGELOG.mdgains entries for 1.10 assets and (previously missed) the #5082 caching change.Regressions: the cache/serving lane now covers declared nested image + JSON serving (content types, ETag, immutable-when-pinned), undeclared/secret files staying 404,
manifest.jsonrefusal, dot-segment behavior at both the HTTP layer (framework collapses to the declared path) and the resolver layer (direct unit calls return null), the 1.10 gate (v2-with-old-API and v1 manifests rejected), SVG rejection, and unpinned-path rejection. The lifecycle lane covers the mixed-generation catalog and the 1.10 version pins.Validation
pnpm checkpnpm regression:capability-cachepnpm regression:docspnpm version:check(no version fields touched)contributions.assetsserves its files and shows them cachedimmutableon a?v=-pinned request.Known considerations, deliberately out of scope: the serve path buffers whole files (pre-existing primitive shared with icons; per-file size is already capped by
files[].bytes); the installed-registry parse is still all-or-nothing on Engine downgrade (same tolerant-parse pattern could apply later); internal helper names (verifyBrowserTabAsset) keep their old names to keep this diff reviewable.Docs note: the
docs/development/optional-agent-packages.mdedit needs a docs-i18n mirror — intended to be batched with the pending round-8 catch-up.Summary by CodeRabbit
304 Not Modifiedresponses for unchanged assets.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.