feat(pbs): support quoted project imports and installed authoring contracts

This commit is contained in:
2026-11-10 15:19:53 +00:00
parent ea1cc26fe3
commit b351f2e582
159 changed files with 11368 additions and 50 deletions
@@ -104,6 +104,27 @@ Rules:
- Module path segments are directory-style segments separated by `/`.
- The syntax is Java-like in organization and JavaScript-like in import surface.
The project segment accepts an identifier or ordinary quoted string, as defined
in specification 3. `@game:state` and `@"game":state` resolve to the same canonical
module; `@"zelda-1":state` represents the exact manifest name `zelda-1`.
The decoded string MUST match the existing resolved project name exactly. There
is no trimming, case folding, slug conversion or path interpretation. Empty or
blank names are source errors. The quoted representation works for the owning
project and ordinary dependencies, including a dependency referencing its own
modules. It does not discover dependencies or change their declared graph.
`@app` is an ordinary project name, not a universal self alias.
Reserved-space checks use the decoded name: `@"sdk":gfx` and `@"core":color`
still resolve exclusively against the selected stdlib. Quoting cannot bypass
visibility, canonical-origin collisions or reserved-space rules. Source producers
MUST quote and escape names that are not legal non-keyword PBS identifiers.
Well-formed but unavailable project/module names fail resolution; malformed
literals fail lexical/syntax analysis. A frontend supporting this additive
syntax is required to consume new quoted sources. Existing sources, the common
manifest name contract, stdlib major, ABI and PBX remain unchanged.
Examples:
- `@game:player/state`
@@ -199,12 +220,18 @@ Rules:
Example:
```pbs
import { Gfx, color } from @sdk:gfx;
import { Gfx } from @sdk:gfx;
import { Color } from @core:color;
let c: color = color.red;
Gfx.draw_pixel(1, 1, c);
[Frame] fn frame() -> void {
Gfx.fill_rect(1, 1, 8, 8, Color.rgb(255, 0, 0));
}
```
This Game source belongs to a module with `pub fn frame() -> void;` in its
`mod.barrel`. The complete manifest and module are installed in the production
Gfx example, indexed through `pbs:example:game:1:production/GUIDE.md`.
Rules:
- `Gfx` is not implicitly in scope.
@@ -371,7 +398,8 @@ Rules:
### 9.4 Example interface module
Illustrative stdlib interface module:
Illustrative stdlib interface module (hypothetical metadata example, not the
distributed Game SDK API; use the actual Gfx/Color imports above for game code):
```pbs
declare enum color(red, green, blue);