cli: add explicit package source modules

Link manifest-selected source graphs with module-local names, qualified
structs/enums/functions and task workers through ordinary AIR verification.
Keep source inputs bounded, reject source symlinks and preserve explicit
grants, diagnostics and deterministic canonical lowering.

Integrate spec 12/15, RFC 0021, source reference budgets, roadmap, examples
and CI coverage. Validate 579 conformance tests, unit tests, 76 source
constructs, hosted smoke, 36 package CLI checks and task schedule stress.
This commit is contained in:
dev committed 2026-10-06 18:51:54 +03:00
1 parent 618b4b95c1
commit c96199e7ec
81 files changed
+1419 -234

No files matched your search

+2
View File
@@ -100,3 +100,5 @@ RFC 0018 bounded operations (cl100k, relative to endian): Quick Reference 6,000
RFC 0019 text/encodings (cl100k, relative to bounded): Quick Reference 6,082 → 6,163 (+1.3%); other source docs 33,628 → 36,042 (+7.2%); full source docs excluding AIR 39,710 → 42,205 (+6.3%). The library page is 6,644 tokens. AIR remains unchanged. UTF-8, hex and canonical Base64 use existing primitives and fixed frame tables. Cumulative full source growth since the pre-stdlib baseline is +24.2%, above the 20% review line; RFC 0019 records the justification and owner-review scope. Future API references should be split/read selectively instead of expanding the front-door catalog.
RFC 0020 supplied-buffer decimal formatting (cl100k, relative to text): Quick Reference 6,163 → 6,220 (+0.9%); other source docs 36,042 → 37,128 (+3.0%); full source docs excluding AIR 42,205 → 43,348 (+2.7%). The library page is 7,730 tokens. AIR remains unchanged. Four scalar writers reuse ordinary source and one Copy enum; full contracts and explicit record composition stay on demand. Cumulative source growth from the pre-stdlib baseline is +27.6%, with the existing owner-review justification recorded in RFC 0020. No compression benefit is inferred from documentation or fixtures.
RFC 0021 package modules (cl100k, relative to formatting): Quick Reference 6,220 → 6,501 (+4.5%); other source docs 37,128 → 38,822 (+4.6%); full source docs excluding AIR 43,348 → 45,323 (+4.6%). New on-demand `language/modules.md` is 1,566 tokens, library/std.md and AIR remain unchanged. The front door has one checked module example; package input/name/loader contracts stay on demand. Cumulative source growth is +33.4%, documented for owner review; no compression benefit is claimed. Pure modules need no new AIR feature or verifier state.
+27
View File
@@ -360,3 +360,30 @@ The usual enum rules apply: missing arm `E7004`, wrong enum/payload `E7005`, unk
`std.utf8` validates bytes and decodes the next scalar with an explicit consumed count. `std.encoding.hex` and `std.encoding.base64` encode/decode into `mut` output slices; ordinary enum results expose malformed input and short capacity, leaving output unchanged on errors. Base64 accepts canonical padded standard encoding. Signatures and a checked example are in `/docs/library/std.md`.
`std.fmt.write_u64/i64/usize/isize` write decimal integers into supplied output slices; `WriteResult::ok(count)` / `short_output` expose capacity, with unchanged output on failure. Composition and signatures are in `/docs/library/std.md`.
## 11. Package modules
Declare package inputs explicitly in `aji.toml`:
```toml
[package]
entry = "main.aji"
[modules]
app.model = "model.aji"
```
`model.aji` declares `module app.model`. Import it directly; functions, structs and enums use full names. Short names stay local to their defining module; imports grant no authority or transitive name visibility.
```aji
module app.entry
import app.model;
fn main() -> u64
effects []
{
let pair = app.model.Pair { left: 20, right: 22 };
return app.model.total(pair);
}
```
Use `aji check|lower|report|run|explore --manifest aji.toml`; `run` and `explore` instantiate manifest grants. A file-only command does not discover packages. Qualified workers work in `task.spawn(s, app.work.run, args)` with ordinary `move`, borrow and join rules. Missing/direct-import names: `E7002`; cycles/header mismatch/duplicates: `E7006`. Read `/docs/language/modules.md` for limits and file-loading rules. `lower --stats` counts entry source against combined AIR, so it is not a whole-package size metric.
+5 -1
View File
@@ -9,7 +9,7 @@
> QUICK.md
docs/agent/quick-reference.md
docs/agent/source-notes.md :: ## 11. Where to read more
docs/agent/source-notes.md :: ## 12. Where to read more
> language/syntax.md
docs/reference/grammar.ebnf
@@ -21,6 +21,10 @@ docs/spec/15-source-language.md :: ## 6. Fallible operations and `match`
docs/spec/15-source-language.md :: ## 13. Built-in standard modules
> language/modules.md
docs/spec/15-source-language.md :: ## 14. Package source modules
docs/spec/12-packages-and-build.md :: ### 1.3 Package source mapping
> library/std.md
docs/spec/16-standard-library.md
docs/reference/std.md
+2 -1
View File
@@ -2,13 +2,14 @@
Text that exists only for the Source Reference Bundle (`source-bundle.txt`). Non-normative: it points at the normative files and states which source layers are implemented.
## 11. Where to read more
## 12. Where to read more
The other files in `/docs` hold the full rules. Open one only when this page is not enough.
| Need | Read |
|---|---|
| built-in bytes/math/UTF-8/hex/Base64/decimal integers, signatures and failure contracts | `/docs/library/std.md` |
| explicit package imports, qualified types, manifest file inputs | `/docs/language/modules.md` |
| exact syntax, every construct, `match` and outcomes | `/docs/language/syntax.md` |
| integer semantics, conversions, Copy/Send/Share, traps | `/docs/language/types.md` |
| borrows, scopes, frame storage, slices, initialization | `/docs/language/ownership.md` |