8.7 KiB
| id | ticket | title | status | created | completed | tags | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PLN-0004 | pbs-low-level-asset-manager-surface | Implement DEC-0004 PBS Low-Level Asset Manager Surface | done | 2026-03-27 | 2026-03-27 |
|
Objective
Propagate DEC-0004 into PBS normative docs, stdlib interface resources, and compiler-facing tests so the workspace exposes a canonical low-level LowAssets host surface aligned with the current runtime asset ABI.
Background
DEC-0004 locked the v1 low-level PBS asset surface to:
declare host LowAssets- runtime module
asset - capability
asset - raw
intparameters and returns forasset_id,slot,handle, and status values - runtime syscall identities:
asset.load(asset_id, slot) -> (status, handle)asset.status(handle) -> statusasset.commit(handle) -> statusasset.cancel(handle) -> status
The repository already ships comparable SDK interface modules for:
@sdk:log@sdk:gfx@sdk:input
The repository does not yet ship @sdk:asset, and current PBS specs do not yet normatively pin LowAssets as the canonical low-level asset host owner.
Scope
Included
- Update PBS specs to include the low-level
LowAssetsasset host surface and its runtime alignment. - Add a new stdlib interface module for
@sdk:asset. - Add compiler and stdlib-loading tests that pin the new interface module, reserved metadata, and import resolution behavior.
- Verify that the declared host ABI matches the runtime contract from
../runtime.
Excluded
- Any author-facing
Assetsfacade orAddressablelowering design fromDSC-0006. - Nominal wrapper types such as
AssetId,Handle, orSlotIndex. - Enumized status surfaces for asset operations.
bank.infoandbank.slot_infosurfaces.- Runtime changes in
../runtime.
Execution Steps
Step 1 - Propagate The Decision Into PBS Specs
What:
Update the normative PBS documentation so the low-level asset host surface is described explicitly and consistently with DEC-0004.
How: Add or revise sections that state:
- the canonical owner name is
LowAssets; - the host bindings use
module = "asset"andCapability(name = "asset"); - the required members are
load,status,commit, andcancel; loadusesasset_idandslot, notasset_nameorbank_type;- the v1 surface uses raw
intvalues; - any future symbolic surface lowers into this low-level contract.
Prioritize the spec surfaces that already define host ABI, stdlib packaging, and runtime capability mapping.
File(s):
docs/specs/compiler-languages/pbs/6.2. Host ABI Binding and Loader Resolution Specification.mddocs/specs/compiler-languages/pbs/8. Stdlib Environment Packaging and Loading Specification.mddocs/specs/compiler-languages/pbs/7. Cartridge Manifest and Runtime Capabilities Specification.md- optional cross-reference if needed:
docs/specs/compiler/18. Standard Library Surface Specification.md
Step 2 - Add The @sdk:asset Interface Module
What: Create the stdlib interface resources for the new low-level asset surface.
How:
Add a new directory under the existing stdlib SDK layout mirroring the established log and gfx pattern:
main.pbsdeclaresLowAssets;mod.barrelexports the low-level host owner;- all members use canonical reserved metadata;
- signatures match the runtime ABI exactly:
fn load(asset_id: int, slot: int) -> (status: int, loading_handle: int);fn status(loading_handle: int) -> int;fn commit(loading_handle: int) -> int;fn cancel(loading_handle: int) -> int;
Do not introduce a declare service Assets wrapper in this plan.
File(s):
prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/stdlib/1/sdk/asset/main.pbsprometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/stdlib/1/sdk/asset/mod.barrel
Step 3 - Pin Interface Semantics And Metadata Extraction
What: Extend frontend tests so the reserved metadata and interface-module semantics recognize the new asset surface.
How: Add or update tests to cover:
- parsing and semantic acceptance of
LowAssetsinSourceKind.SDK_INTERFACE; - extraction of
[Host(...)]and[Capability(...)]metadata for the new members; - ABI slot counts for
load/status/commit/cancel; - rejection of incorrect legacy asset ABI shapes if they are declared as canonical.
Reuse the same testing style already used for LowLog and LowGfx.
File(s):
prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/semantics/PbsInterfaceModuleSemanticsTest.javaprometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/PbsFrontendCompilerTest.javaprometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/PbsGateUSdkInterfaceConformanceTest.java
Step 4 - Pin Stdlib Loading And Import Resolution
What:
Verify that the compiler stdlib environment exposes @sdk:asset and that programs can import the surface through the normal interface-module loader path.
How: Add or update tests that:
- resolve
@sdk:assetthrough the stdlib loader; - import
LowAssetsfrom@sdk:asset; - ensure the imported surface compiles under the same reserved-host rules used by existing SDK modules;
- confirm capability and host identities survive the loading pipeline.
File(s):
prometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/stdlib/InterfaceModuleLoaderTest.javaprometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/pbs/PbsGateUStdlibCompileTest.javaprometeu-compiler/frontends/prometeu-frontend-pbs/src/test/java/p/studio/compiler/services/PBSFrontendPhaseServiceTest.java
Step 5 - Cross-Check Runtime ABI Alignment
What:
Validate that the PBS declarations and tests remain aligned with the runtime ABI actually published by ../runtime.
How: Before closing implementation, verify against the runtime sources currently present in the sibling workspace:
module = "asset"Capability(name = "asset")loadusesarg_slots = 2,ret_slots = 2status,commit, andcancelusearg_slots = 1,ret_slots = 1
If the runtime changes again before implementation lands, update the PBS work in the same change or stop and reopen the decision if the semantic contract changed.
File(s):
../runtime/crates/console/prometeu-hal/src/syscalls/domains/asset.rs../runtime/docs/specs/runtime/15-asset-management.md../runtime/docs/specs/runtime/16-host-abi-and-syscalls.md
Test Requirements
Unit Tests
- Interface-module semantics tests for
LowAssetsreserved metadata and signature acceptance. - Frontend compiler tests for metadata extraction and ABI slot shape.
- Stdlib loader tests for
@sdk:assetmodule discovery and barrel export resolution.
Integration Tests
- Frontend phase tests that compile a small source importing
LowAssetsfrom@sdk:asset. - Conformance-style tests that assert the canonical host identities and capability spelling survive compile-time validation.
Manual Verification
- Inspect generated stdlib resource files for exact
HostandCapabilityspellings. - Re-run the targeted PBS frontend test suite covering stdlib loading, interface semantics, and reserved host metadata.
- Re-check the sibling runtime contract immediately before merge if implementation does not happen in the same working session.
Acceptance Criteria
- PBS specs state that the canonical low-level asset owner is
LowAssets. - PBS specs state that capability spelling is
asset, notassets. - PBS specs state that
asset.loadusesasset_idandslot, notasset_nameorbank_type. - The stdlib environment exposes
@sdk:assetwithdeclare host LowAssets. LowAssets.load/status/commit/cancelsignatures match the runtime ABI from../runtime.- Compiler tests pin the reserved metadata, signature shapes, and import path for the new surface.
- No new higher-level
Assetsfacade is introduced as part of this plan.
Dependencies
DEC-0004-pbs-low-level-asset-manager-surface- Current runtime ABI as published in
../runtime - Existing stdlib interface loader and SDK resource layout in
prometeu-compiler/frontends/prometeu-frontend-pbs
Risks
- The sibling runtime may continue evolving, causing PBS docs or tests to drift if implementation is delayed.
- Introducing
@sdk:assetmay reveal hidden assumptions in stdlib packaging or SDK import tests that currently only coverlog,gfx, andinput. - Because v1 keeps raw
int, the first implementation may encourage accidental misuse ofasset_id,slot, andhandlein user-facing code if a higher-level wrapper is added too quickly later.