@greenpandastudios/aug-cli 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/docs/assets/benchmarks/execution.svg +774 -637
- package/docs/assets/benchmarks/http.svg +278 -249
- package/docs/assets/benchmarks/improvements.svg +66 -66
- package/docs/assets/benchmarks/kernels-mobile.svg +1 -0
- package/docs/assets/benchmarks/kernels.svg +1 -0
- package/docs/assets/benchmarks/memory.svg +153 -153
- package/docs/benchmark-results.json +227089 -90363
- package/docs/compatibility.md +6 -6
- package/docs/contributing-benchmarks.md +36 -6
- package/docs/dev-containers.md +8 -15
- package/docs/dgx-consumers.json +122 -0
- package/docs/dgx-gyms.json +784 -0
- package/docs/dgx-kernels.json +1170 -0
- package/docs/dgx-performance.json +227849 -0
- package/docs/dgx-spark.md +64 -0
- package/docs/diagnostics.md +1 -1
- package/docs/docker.md +16 -17
- package/docs/example-projects.json +32 -0
- package/docs/examples/approved-design/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/approved-design/domain/app.md +4 -4
- package/docs/examples/approved-design/main.md +2 -2
- package/docs/examples/calls-benchmark/index.md +36 -0
- package/docs/examples/calls-benchmark/main.md +78 -0
- package/docs/examples/calls-benchmark/operations.md +60 -0
- package/docs/examples/developer-workflow/calculator.md +5 -5
- package/docs/examples/developer-workflow/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/developer-workflow/logging/console.md +2 -2
- package/docs/examples/developer-workflow/logging/logger.md +2 -2
- package/docs/examples/developer-workflow/main.md +2 -2
- package/docs/examples/errors-benchmark/index.md +36 -0
- package/docs/examples/errors-benchmark/main.md +92 -0
- package/docs/examples/errors-benchmark/operations.md +65 -0
- package/docs/examples/float-benchmark/index.md +35 -0
- package/docs/examples/float-benchmark/main.md +75 -0
- package/docs/examples/generic-di/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/generic-di/main.md +2 -2
- package/docs/examples/generic-di/types.md +3 -3
- package/docs/examples/hello/app/greeter.md +3 -3
- package/docs/examples/hello/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/hello/logging/console.md +2 -2
- package/docs/examples/hello/logging/logger.md +2 -2
- package/docs/examples/hello/main.md +2 -2
- package/docs/examples/index.md +18 -1
- package/docs/examples/interceptors/app.md +5 -5
- package/docs/examples/interceptors/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/interceptors/interceptors.md +2 -2
- package/docs/examples/interceptors/logging.md +3 -3
- package/docs/examples/interceptors/main.md +2 -2
- package/docs/examples/list-benchmark/index.md +35 -0
- package/docs/examples/list-benchmark/main.md +78 -0
- package/docs/examples/map-churn-benchmark/index.md +35 -0
- package/docs/examples/map-churn-benchmark/main.md +106 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/api.md +104 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.md +54 -0
- package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi-json.md +48 -0
- package/docs/examples/native-blake3/hashing.md +93 -0
- package/docs/examples/native-blake3/index.md +38 -0
- package/docs/examples/native-blake3/main.md +73 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/api.md +406 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.md +51 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.md +63 -0
- package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi-json.md +161 -0
- package/docs/examples/native-pytorch/index.md +38 -0
- package/docs/examples/native-pytorch/main.md +73 -0
- package/docs/examples/native-pytorch/tensors.md +123 -0
- package/docs/examples/native-sqlite/database.md +116 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/api.md +284 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.md +51 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.md +75 -0
- package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi-json.md +119 -0
- package/docs/examples/native-sqlite/index.md +38 -0
- package/docs/examples/native-sqlite/main.md +73 -0
- package/docs/examples/native-zlib/compression.md +99 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/api.md +153 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.md +54 -0
- package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi-json.md +76 -0
- package/docs/examples/native-zlib/index.md +38 -0
- package/docs/examples/native-zlib/main.md +78 -0
- package/docs/examples/new-syntax/console.md +2 -2
- package/docs/examples/new-syntax/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/new-syntax/greeter.md +3 -3
- package/docs/examples/new-syntax/logger.md +2 -2
- package/docs/examples/new-syntax/main.md +2 -2
- package/docs/examples/ownership-transfer/dependencies/august/{0.20.1 → 0.21.0}/io/contracts.md +3 -3
- package/docs/examples/ownership-transfer/main.md +2 -2
- package/docs/examples/ownership-transfer/resource.md +2 -2
- package/docs/examples/packages-math/aug-package-json.md +1 -1
- package/docs/examples/records-benchmark/data.md +55 -0
- package/docs/examples/records-benchmark/index.md +36 -0
- package/docs/examples/records-benchmark/main.md +85 -0
- package/docs/examples/strings-benchmark/index.md +35 -0
- package/docs/examples/strings-benchmark/main.md +76 -0
- package/docs/examples/tasks-benchmark/index.md +36 -0
- package/docs/examples/tasks-benchmark/main.md +89 -0
- package/docs/examples/tasks-benchmark/operations.md +58 -0
- package/docs/getting-started.md +3 -3
- package/docs/grammar.md +2 -2
- package/docs/gym-results.json +784 -0
- package/docs/implementation-map.md +6 -0
- package/docs/index.md +1 -1
- package/docs/kernel-results.json +1170 -0
- package/docs/language-conformance.md +6 -0
- package/docs/language-constructs.md +9 -1
- package/docs/learn/index.md +1 -1
- package/docs/maintaining-docs.md +1 -1
- package/docs/native-implementation.md +276 -0
- package/docs/native-interop-llvm-plan.md +342 -0
- package/docs/native-package-examples.md +684 -0
- package/docs/native-packages.md +179 -0
- package/docs/packages.md +2 -2
- package/docs/performance.md +50 -29
- package/docs/production-readiness.md +11 -1
- package/docs/public/downloads/approved-design.zip +0 -0
- package/docs/public/downloads/calls-benchmark.zip +0 -0
- package/docs/public/downloads/developer-workflow.zip +0 -0
- package/docs/public/downloads/errors-benchmark.zip +0 -0
- package/docs/public/downloads/float-benchmark.zip +0 -0
- package/docs/public/downloads/generic-di.zip +0 -0
- package/docs/public/downloads/hello.zip +0 -0
- package/docs/public/downloads/interceptors.zip +0 -0
- package/docs/public/downloads/json-benchmark.zip +0 -0
- package/docs/public/downloads/list-benchmark.zip +0 -0
- package/docs/public/downloads/map-churn-benchmark.zip +0 -0
- package/docs/public/downloads/native-blake3.zip +0 -0
- package/docs/public/downloads/native-pytorch.zip +0 -0
- package/docs/public/downloads/native-sqlite.zip +0 -0
- package/docs/public/downloads/native-zlib.zip +0 -0
- package/docs/public/downloads/new-syntax.zip +0 -0
- package/docs/public/downloads/oidc-login.zip +0 -0
- package/docs/public/downloads/ownership-transfer.zip +0 -0
- package/docs/public/downloads/packages-app.zip +0 -0
- package/docs/public/downloads/packages-math.zip +0 -0
- package/docs/public/downloads/records-benchmark.zip +0 -0
- package/docs/public/downloads/strings-benchmark.zip +0 -0
- package/docs/public/downloads/tasks-benchmark.zip +0 -0
- package/docs/qualification-results.md +66 -0
- package/docs/reference.md +24 -0
- package/docs/releasing.md +81 -6
- package/docs/research/libtorch-native-qualification.md +115 -0
- package/docs/research/native-interop-llvm.md +197 -0
- package/docs/research/qualification-methods.md +15 -0
- package/docs/roadmap.md +1 -0
- package/docs/safety-gyms.md +41 -0
- package/docs/tooling.md +16 -15
- package/docs/web-library-gaps.md +1 -1
- package/docs/web.md +4 -0
- package/examples/approved-design/.aug-spec/manifest.json +3 -3
- package/examples/approved-design/domain/app.aug.md +4 -4
- package/examples/approved-design/main.aug.md +2 -2
- package/examples/developer-workflow/.aug-spec/manifest.json +3 -3
- package/examples/developer-workflow/calculator.aug.md +5 -5
- package/examples/developer-workflow/logging/console.aug.md +2 -2
- package/examples/developer-workflow/logging/logger.aug.md +2 -2
- package/examples/developer-workflow/main.aug.md +2 -2
- package/examples/generic-di/.aug-spec/manifest.json +3 -3
- package/examples/generic-di/main.aug.md +2 -2
- package/examples/generic-di/types.aug.md +3 -3
- package/examples/hello/.aug-spec/manifest.json +3 -3
- package/examples/hello/app/greeter.aug.md +3 -3
- package/examples/hello/logging/console.aug.md +2 -2
- package/examples/hello/logging/logger.aug.md +2 -2
- package/examples/hello/main.aug.md +2 -2
- package/examples/interceptors/.aug-spec/manifest.json +3 -3
- package/examples/interceptors/app.aug.md +5 -5
- package/examples/interceptors/interceptors.aug.md +2 -2
- package/examples/interceptors/logging.aug.md +3 -3
- package/examples/interceptors/main.aug.md +2 -2
- package/examples/native-blake3/.aug-spec/manifest.json +16 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.1/native.abi.json +29 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug +14 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug.md +34 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug +4 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug.md +8 -0
- package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi.json +29 -0
- package/examples/native-blake3/AGENTS.md +5 -0
- package/examples/native-blake3/aug.lock.json +253 -0
- package/examples/native-blake3/hashing.aug +11 -0
- package/examples/native-blake3/hashing.aug.md +25 -0
- package/examples/native-blake3/main.aug +8 -0
- package/examples/native-blake3/main.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/manifest.json +18 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.1/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.3/native.abi.json +142 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug +101 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug.md +160 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug +3 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug.md +8 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug +6 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug.md +13 -0
- package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi.json +142 -0
- package/examples/native-pytorch/AGENTS.md +5 -0
- package/examples/native-pytorch/aug.lock.json +309 -0
- package/examples/native-pytorch/main.aug +8 -0
- package/examples/native-pytorch/main.aug.md +13 -0
- package/examples/native-pytorch/tensors.aug +23 -0
- package/examples/native-pytorch/tensors.aug.md +35 -0
- package/examples/native-sqlite/.aug-spec/manifest.json +18 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.2/native.abi.json +100 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug +48 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug.md +91 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug +3 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug.md +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug +8 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug.md +22 -0
- package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi.json +100 -0
- package/examples/native-sqlite/AGENTS.md +5 -0
- package/examples/native-sqlite/aug.lock.json +236 -0
- package/examples/native-sqlite/database.aug +15 -0
- package/examples/native-sqlite/database.aug.md +27 -0
- package/examples/native-sqlite/main.aug +8 -0
- package/examples/native-sqlite/main.aug.md +13 -0
- package/examples/native-zlib/.aug-spec/manifest.json +16 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.1/native.abi.json +57 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug +29 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug.md +54 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug +4 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug.md +8 -0
- package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi.json +57 -0
- package/examples/native-zlib/AGENTS.md +5 -0
- package/examples/native-zlib/aug.lock.json +236 -0
- package/examples/native-zlib/compression.aug +15 -0
- package/examples/native-zlib/compression.aug.md +27 -0
- package/examples/native-zlib/main.aug +10 -0
- package/examples/native-zlib/main.aug.md +13 -0
- package/examples/new-syntax/.aug-spec/manifest.json +3 -3
- package/examples/new-syntax/console.aug.md +2 -2
- package/examples/new-syntax/greeter.aug.md +3 -3
- package/examples/new-syntax/logger.aug.md +2 -2
- package/examples/new-syntax/main.aug.md +2 -2
- package/examples/oidc-login/aug.lock.json +6 -6
- package/examples/ownership-transfer/.aug-spec/manifest.json +3 -3
- package/examples/ownership-transfer/main.aug.md +2 -2
- package/examples/ownership-transfer/resource.aug.md +2 -2
- package/examples/packages/math/aug-package.json +1 -1
- package/native/compiler-packs.json +43 -0
- package/package.json +3 -2
- package/runtime/aug_http.c +48 -21
- package/runtime/aug_http_ir.c +30 -0
- package/runtime/aug_http_ir.h +18 -0
- package/runtime/aug_ir.c +209 -0
- package/runtime/aug_ir.h +89 -0
- package/runtime/aug_json.c +6 -1
- package/runtime/aug_runtime.c +82 -16
- package/runtime/aug_runtime.h +16 -2
- package/runtime/aug_tasks.c +38 -7
- package/runtime/aug_values.c +12 -6
- package/scripts/bootstrap-native.mjs +4 -1
- package/src/ast.js +1 -1
- package/src/checker.js +110 -28
- package/src/cli.js +92 -14
- package/src/codegen.js +31 -6
- package/src/compiler-packs.js +66 -0
- package/src/config.js +2 -2
- package/src/editor.js +15 -6
- package/src/formatter.js +4 -2
- package/src/git-http.js +137 -0
- package/src/git-packages.js +9 -1
- package/src/help.js +10 -2
- package/src/ir-types.js +5 -0
- package/src/ir-verify.js +277 -0
- package/src/ir.js +962 -0
- package/src/llvm-debug.js +101 -0
- package/src/llvm-native.js +152 -0
- package/src/llvm-platform.js +20 -0
- package/src/llvm.js +781 -0
- package/src/native-artifacts.js +207 -0
- package/src/native-bindings.js +189 -0
- package/src/native-contracts.js +295 -0
- package/src/native-declarations.js +68 -0
- package/src/native-facts.js +63 -0
- package/src/package-locking.js +43 -0
- package/src/package-manager.js +23 -8
- package/src/parser.js +20 -2
- package/src/project.js +2 -2
- package/src/runtime-abi.js +23 -0
- package/src/runtime-adapters.js +18 -0
- package/src/schemas.js +24 -17
- package/src/semantic.js +8 -3
- package/src/snippets.js +1 -0
- package/src/spec.js +49 -8
- /package/examples/approved-design/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/approved-design/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/developer-workflow/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/developer-workflow/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/generic-di/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/generic-di/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/hello/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/hello/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/interceptors/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/interceptors/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/new-syntax/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/new-syntax/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
- /package/examples/ownership-transfer/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug +0 -0
- /package/examples/ownership-transfer/.aug-spec/august/{0.20.1 → 0.21.0}/io/contracts.aug.md +0 -0
|
@@ -0,0 +1,684 @@
|
|
|
1
|
+
# Native package design examples
|
|
2
|
+
|
|
3
|
+
This page records design examples from the [LLVM/native architecture plan](native-interop-llvm-plan.md). The four package repositories now exist and their real native adapters pass local LLVM qualification. Read [native packages](native-packages.md) for the implemented profile. The examples below include future binding-generation and library-output commands; these remain proposals. Placeholder digests and sizes are illustrative.
|
|
4
|
+
|
|
5
|
+
The implemented packages use LibTorch **2.14.1**, SQLite **3.53.4**, zlib **1.3.2**, and Rust `blake3` **1.8.7**, with LLVM **23.1.2**. Their public native archives have passed installed-CLI checks locally, on macOS 14 ARM64, and in clean Debian 12 x86-64/ARM64 consumers. Full supported-language parity is implemented; the updated default-backend gates and compiler publication remain pending. The [implementation record](native-implementation.md) tracks those limits. Complete source/spec examples are available for [PyTorch](examples/native-pytorch/index.md), [SQLite](examples/native-sqlite/index.md), [zlib](examples/native-zlib/index.md), and [BLAKE3](examples/native-blake3/index.md).
|
|
6
|
+
|
|
7
|
+
## Shared repository and artifact convention
|
|
8
|
+
|
|
9
|
+
Use the existing source-package layout with one additional binding descriptor. A consumer imports `src/export.aug`, not the native build directory:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
aug-LIBRARY/
|
|
13
|
+
aug-package.json
|
|
14
|
+
native.abi.json
|
|
15
|
+
src/
|
|
16
|
+
export.aug
|
|
17
|
+
bindings.aug # foreign declarations and resource identities
|
|
18
|
+
api.aug # safe August API and same-file tests
|
|
19
|
+
contracts.aug # errors/capabilities where needed
|
|
20
|
+
*.aug.md # compiler-produced explanations
|
|
21
|
+
native/
|
|
22
|
+
include/aug_LIBRARY.h
|
|
23
|
+
src/adapter.c|cpp|rs
|
|
24
|
+
tests/ # independently authored native clients
|
|
25
|
+
build.json # explicit maintainer recipe and locked inputs
|
|
26
|
+
sources.lock.json
|
|
27
|
+
Cargo.toml/Cargo.lock # Rust adapter only
|
|
28
|
+
rust-toolchain.toml # Rust adapter only
|
|
29
|
+
examples/smoke/
|
|
30
|
+
main.aug
|
|
31
|
+
main.yaml
|
|
32
|
+
.github/workflows/release.yml
|
|
33
|
+
README.md
|
|
34
|
+
LICENSE
|
|
35
|
+
THIRD_PARTY_NOTICES.md
|
|
36
|
+
AGENTS.md
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Native artifacts are GitHub Release assets, not Git-tracked binaries or `node_modules` installs. For milestone 1, use dynamic adapter libraries and a dynamic prebuilt August runtime on macOS; statically embed small upstream C/Rust implementations inside their adapters where appropriate. This keeps platform OS imports inside binaries produced by maintainers and limits consumer linker inputs. Later static app linking can be qualified separately. LibTorch remains a tested dynamic dependency closure.
|
|
40
|
+
|
|
41
|
+
An artifact contains a library, its runtime dependencies where permitted, an export/symbol manifest, file hashes, licenses/notices, an SBOM, and build provenance. It contains no consumer-executed install script. Public adapter headers and source remain reviewable in the repository. Archive extraction and runtime deployment follow the architecture plan's limits.
|
|
42
|
+
|
|
43
|
+
### Proposed manifest format 2
|
|
44
|
+
|
|
45
|
+
This is a complete **shape example**, with placeholders deliberately invalid as publishable hashes. Use the same schema for all four packages. The native metadata records facts that cannot be inferred from ordinary August source:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"format": 2,
|
|
50
|
+
"name": "@greenpandastudios/aug-pytorch",
|
|
51
|
+
"version": "0.1.0",
|
|
52
|
+
"compiler": "LLVM_PREVIEW_VERSION",
|
|
53
|
+
"source": "src",
|
|
54
|
+
"dependencies": {},
|
|
55
|
+
"native": {
|
|
56
|
+
"profile": "aug-native-abi-1",
|
|
57
|
+
"bindings": "native.abi.json",
|
|
58
|
+
"bindingsSha256": "REPLACE_WITH_64_HEX_DIGEST",
|
|
59
|
+
"upstream": {
|
|
60
|
+
"repository": "https://github.com/pytorch/pytorch",
|
|
61
|
+
"version": "2.14.1",
|
|
62
|
+
"sourceRevision": "REPLACE_WITH_VERIFIED_SOURCE_REVISION"
|
|
63
|
+
},
|
|
64
|
+
"artifacts": [
|
|
65
|
+
{
|
|
66
|
+
"id": "cpu-macos-arm64",
|
|
67
|
+
"target": {
|
|
68
|
+
"triple": "aarch64-apple-darwin",
|
|
69
|
+
"os": "macos",
|
|
70
|
+
"arch": "arm64",
|
|
71
|
+
"minimumOS": "14.0",
|
|
72
|
+
"cpuBaseline": "armv8-a",
|
|
73
|
+
"libc": "libSystem",
|
|
74
|
+
"cxxRuntime": "system-libc++",
|
|
75
|
+
"cxxABI": "apple-libc++",
|
|
76
|
+
"features": ["cpu", "float64"]
|
|
77
|
+
},
|
|
78
|
+
"url": "https://github.com/GreenPandaStudios/aug-pytorch/releases/download/v0.1.0/native-cpu-macos-arm64.tar.gz",
|
|
79
|
+
"sha256": "REPLACE_WITH_64_HEX_DIGEST",
|
|
80
|
+
"maximumDownloadBytes": "REPLACE_WITH_MEASURED_INTEGER",
|
|
81
|
+
"maximumUnpackedBytes": "REPLACE_WITH_MEASURED_INTEGER",
|
|
82
|
+
"link": {
|
|
83
|
+
"kind": "dynamic",
|
|
84
|
+
"libraries": ["lib/libaug_torch.1.dylib"]
|
|
85
|
+
},
|
|
86
|
+
"runtime": {
|
|
87
|
+
"files": ["lib/libaug_torch.1.dylib"],
|
|
88
|
+
"closureManifest": "runtime-files.json",
|
|
89
|
+
"relocation": "loader-relative"
|
|
90
|
+
},
|
|
91
|
+
"components": [
|
|
92
|
+
{
|
|
93
|
+
"id": "pytorch/libtorch",
|
|
94
|
+
"version": "2.14.1",
|
|
95
|
+
"compatibilityKey": "libtorch-process-runtime",
|
|
96
|
+
"linkage": "dynamic",
|
|
97
|
+
"required": true
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"fileManifest": "files.json",
|
|
101
|
+
"provenance": "provenance.json",
|
|
102
|
+
"notices": "THIRD_PARTY_NOTICES.md"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"sourceBuild": {
|
|
106
|
+
"recipe": "native/build.json",
|
|
107
|
+
"inputs": "native/sources.lock.json",
|
|
108
|
+
"tools": ["clang++", "cmake", "Apple macOS SDK"],
|
|
109
|
+
"automatic": false
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`runtime-files.json` is generated from the actual artifact inspection; it must list every redistributed dylib, its install name, hash, dependency edges, and OS floor. The example does **not** assume `libaug_torch` is LibTorch's entire closure. OS-provided libraries/frameworks are declared requirements and are not copied from an Apple SDK. Upstream archive digests, build tool versions, C++20 flags, exact feature choices, source inputs, and all transitive license identities belong in `sources.lock.json` and provenance.
|
|
116
|
+
|
|
117
|
+
Each other package uses the same required target/artifact fields with these substitutions:
|
|
118
|
+
|
|
119
|
+
| Package metadata | SQLite | zlib | Rust BLAKE3 |
|
|
120
|
+
| --- | --- | --- | --- |
|
|
121
|
+
| `name` | `@greenpandastudios/aug-sqlite` | `@greenpandastudios/aug-zlib` | `@greenpandastudios/aug-blake3` |
|
|
122
|
+
| Upstream source | SQLite 3.53.4 pinned amalgamation archive and upstream digest | `madler/zlib`, tag `v1.3.2`, pinned archive digest | `BLAKE3-team/BLAKE3`, crate `=1.8.7`, exact Cargo.lock |
|
|
123
|
+
| Release asset | `native-macos-arm64.tar.gz` in its own `v0.1.0` release | Same convention in its repository | Same convention in its repository |
|
|
124
|
+
| Adapter | `lib/libaug_sqlite.1.dylib` | `lib/libaug_zlib.1.dylib` | `lib/libaug_blake3.1.dylib` |
|
|
125
|
+
| Native components | SQLite version, compile options, serialized thread configuration | zlib version/configuration, embedded static linkage | Rust crate graph and licenses, Rust compiler version, `std`/`pure` features, `panic=unwind` |
|
|
126
|
+
| C++ requirement | none | none | none; Rust std's native/runtime requirements still declared |
|
|
127
|
+
| Maintainer tools | C compiler and licensed platform SDK | C compiler and licensed platform SDK | pinned Rust/Cargo and licensed platform linker/SDK inputs |
|
|
128
|
+
|
|
129
|
+
The Rust `pure` feature is explicitly an upstream testing feature with no stable-feature promise. Pin and qualify it; do not advertise it as a generally stable configuration or a performance result. Alternatively a later release can use the crate's default SIMD configuration while still exposing a Rust C-ABI adapter, provided its actual C/Rust build inputs are disclosed. [Tagged BLAKE3 features/build](https://github.com/BLAKE3-team/BLAKE3/blob/1.8.7/Cargo.toml).
|
|
130
|
+
|
|
131
|
+
### Proposed lock extension
|
|
132
|
+
|
|
133
|
+
This fragment illustrates the additional information, not a hand-authored lock. The existing source commit/digest/graph remains part of the full lock:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"format": 2,
|
|
138
|
+
"compiler": "LLVM_PREVIEW_VERSION",
|
|
139
|
+
"native": {
|
|
140
|
+
"targets": {
|
|
141
|
+
"aarch64-apple-darwin/macos14": {
|
|
142
|
+
"runtime": {
|
|
143
|
+
"abi": "compiler-private-runtime-v1",
|
|
144
|
+
"version": "LLVM_PREVIEW_VERSION",
|
|
145
|
+
"sha256": "REPLACE_WITH_RUNTIME_DIGEST"
|
|
146
|
+
},
|
|
147
|
+
"packages": [
|
|
148
|
+
{
|
|
149
|
+
"sourcePackage": "@greenpandastudios/aug-pytorch@0.1.0",
|
|
150
|
+
"sourceCommit": "REPLACE_WITH_LOCKED_COMMIT",
|
|
151
|
+
"contractSha256": "REPLACE_WITH_BINDING_DIGEST",
|
|
152
|
+
"artifact": "cpu-macos-arm64",
|
|
153
|
+
"artifactSha256": "REPLACE_WITH_ARCHIVE_DIGEST",
|
|
154
|
+
"upstreamVersions": {"pytorch/libtorch": "2.14.1"},
|
|
155
|
+
"dependencies": ["pytorch/libtorch@2.14.1"],
|
|
156
|
+
"linkage": "dynamic"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"hostTools": {
|
|
162
|
+
"darwin-arm64": {
|
|
163
|
+
"driverVersion": "LLVM_PREVIEW_VERSION",
|
|
164
|
+
"llvmVersion": "23.1.2",
|
|
165
|
+
"sha256": "REPLACE_WITH_HOST_TOOL_DIGEST"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The implementation must also retain URLs, full target/ABI constraints, closure/file hashes, source input identities, resolved component edges, and exact build/link evidence. An unrecorded target requires explicit lock expansion; frozen installs cannot invent it.
|
|
173
|
+
|
|
174
|
+
## Binding profile and native header
|
|
175
|
+
|
|
176
|
+
Use fixed-width C parameters and out-pointers. This **proposed header convention** avoids passing runtime structs across the interface. All pointer/length pairs state ownership and permitted lifetime in `native.abi.json`:
|
|
177
|
+
|
|
178
|
+
```c
|
|
179
|
+
#include <stdint.h>
|
|
180
|
+
|
|
181
|
+
typedef struct aug_native_error_v1 {
|
|
182
|
+
uint32_t code;
|
|
183
|
+
uint32_t message_length;
|
|
184
|
+
char message[512];
|
|
185
|
+
} aug_native_error_v1;
|
|
186
|
+
|
|
187
|
+
/* code 0 is success. Output pointers are null/zero on failure.
|
|
188
|
+
Error messages are bounded UTF-8; no exception crosses this ABI. */
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The struct is passed only through a pointer. Headers/probes verify its alignment, size, offsets, and truncation behavior per target. Count conversion must reject overflows before dereference/allocation. The adapter creates no managed August values and assumes no August runtime entry. Every package uses symbol prefixes and ABI version suffixes; its qualified export list rejects accidental C++/Rust implementation exports.
|
|
192
|
+
|
|
193
|
+
The new source form **`extern C resource NAME`** declares an opaque external resource, not a class. It has no accessible pointer or public constructor and must be acquired/owned through a checked native binding. Its release identity is mandatory in the descriptor. Public operations may be ordinary August functions; no marker class/interface is required solely to wrap an opaque C object. Behavioral August adapters still use ordinary interfaces/classes.
|
|
194
|
+
|
|
195
|
+
Marshalled `extern C` declarations below are **typed August views of descriptor-checked adapters**. Their logical list/string/resource types are converted to the actual C signature. They are not claims that C accepts an August List or checked exception. A descriptor explicitly maps each source declaration to a native symbol, conversion, output parameter, error status, and release function. Unmatched declarations and unsupported marshalling fail checking. Raw calls still require `unsafe` inside the library.
|
|
196
|
+
|
|
197
|
+
## Package 1: CPU PyTorch through LibTorch
|
|
198
|
+
|
|
199
|
+
Repository: **`GreenPandaStudios/aug-pytorch`**. Use the common layout with `native/src/adapter.cpp`, a pinned LibTorch download in `sources.lock.json`, and a CMake build that uses the selected distribution's configuration/flags and C++20. `native/tests/tensor.cpp` and the consumer test independently verify the values and ownership.
|
|
200
|
+
|
|
201
|
+
### Native implementation seam
|
|
202
|
+
|
|
203
|
+
The initial C ABI is a bounded tensor API:
|
|
204
|
+
|
|
205
|
+
```c
|
|
206
|
+
typedef struct aug_torch_tensor_v1 aug_torch_tensor_v1;
|
|
207
|
+
|
|
208
|
+
int32_t aug_torch_tensor_from_f64_v1(
|
|
209
|
+
const double *values, uint64_t count,
|
|
210
|
+
aug_torch_tensor_v1 **out, aug_native_error_v1 *error);
|
|
211
|
+
int32_t aug_torch_tensor_add_v1(
|
|
212
|
+
const aug_torch_tensor_v1 *left,
|
|
213
|
+
const aug_torch_tensor_v1 *right,
|
|
214
|
+
aug_torch_tensor_v1 **out, aug_native_error_v1 *error);
|
|
215
|
+
int32_t aug_torch_tensor_sum_v1(
|
|
216
|
+
const aug_torch_tensor_v1 *tensor,
|
|
217
|
+
double *out, aug_native_error_v1 *error);
|
|
218
|
+
int32_t aug_torch_tensor_values_v1(
|
|
219
|
+
const aug_torch_tensor_v1 *tensor,
|
|
220
|
+
double **out, uint64_t *count, aug_native_error_v1 *error);
|
|
221
|
+
void aug_torch_values_release_v1(double *values);
|
|
222
|
+
void aug_torch_tensor_release_v1(aug_torch_tensor_v1 *tensor);
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Each fallible export is implemented in C++ with `noexcept` and catches native exceptions. An opaque handle owns a real LibTorch tensor. Creation explicitly chooses CPU/float64 and copies the input into owned storage, for example by cloning a validated `from_blob` tensor. Addition and sum call LibTorch operations; `values` copies its result into adapter-owned storage. Release destroys the C++ tensor wrapper; the output array uses its own matching release export. No view outlives the input list and no GPU is selected implicitly.
|
|
226
|
+
|
|
227
|
+
Prefer LibTorch's supported stable tensor/operator API where the pinned version covers these operations, but pair the adapter with the exact qualified distribution in either case. A smaller upstream stable ABI is useful; it does not justify claiming the entire PyTorch API is binary-compatible. [LibTorch stable API scope](https://docs.pytorch.org/docs/main/notes/libtorch_stable_abi.html).
|
|
228
|
+
|
|
229
|
+
### August source
|
|
230
|
+
|
|
231
|
+
Proposed `src/bindings.aug` declares the public opaque resource:
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
extern C resource Tensor
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The private foreign calls live in `api.aug` alongside their safe callers. August does not allow importing another file's `_` declarations. The descriptor declares these operations logically pure (apart from internal allocation), call-duration reads, and blocking native work with no August callback. Those are audited author assertions. CPU LibTorch may use its own worker threads; those workers cannot enter the August runtime.
|
|
238
|
+
|
|
239
|
+
Proposed `src/contracts.aug` uses existing syntax:
|
|
240
|
+
|
|
241
|
+
```text
|
|
242
|
+
TensorError(int code, string message) implements Error:
|
|
243
|
+
pass
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Proposed `src/api.aug`, with imports kept local:
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
import Tensor from bindings
|
|
250
|
+
import TensorError from contracts
|
|
251
|
+
|
|
252
|
+
extern C _tensor(List<float> values) returns own Tensor unless TensorError
|
|
253
|
+
extern C _add(Tensor left, Tensor right) returns own Tensor unless TensorError
|
|
254
|
+
extern C _sum(Tensor tensor) returns float unless TensorError
|
|
255
|
+
extern C _values(Tensor tensor) returns List<float> unless TensorError
|
|
256
|
+
|
|
257
|
+
tensor(List<float> values) returns own Tensor unless TensorError:
|
|
258
|
+
unsafe:
|
|
259
|
+
return _tensor(values)
|
|
260
|
+
|
|
261
|
+
add(Tensor left, Tensor right) returns own Tensor unless TensorError:
|
|
262
|
+
unsafe:
|
|
263
|
+
return _add(left, right)
|
|
264
|
+
|
|
265
|
+
sum(Tensor tensor) returns float unless TensorError:
|
|
266
|
+
unsafe:
|
|
267
|
+
return _sum(tensor)
|
|
268
|
+
|
|
269
|
+
values(Tensor tensor) returns List<float> unless TensorError:
|
|
270
|
+
unsafe:
|
|
271
|
+
return _values(tensor)
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
The explicit own returns are necessary choices. Ordinary executable result/error inference still works where omitted; foreign declarations must retain checked contracts. Compiler/spec output explains effective contracts regardless of written inference clauses. The normal same-name call shorthand above already exists.
|
|
275
|
+
|
|
276
|
+
`src/export.aug` keeps the package narrow:
|
|
277
|
+
|
|
278
|
+
```text
|
|
279
|
+
export Tensor from bindings
|
|
280
|
+
export TensorError from contracts
|
|
281
|
+
export tensor from api
|
|
282
|
+
export add from api
|
|
283
|
+
export sum from api
|
|
284
|
+
export values from api
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
One descriptor entry demonstrates the **proposed** physical/logical mapping. The actual file includes every function and resolved declaration identity, plus target header/layout probes:
|
|
288
|
+
|
|
289
|
+
```json
|
|
290
|
+
{
|
|
291
|
+
"format": 1,
|
|
292
|
+
"profile": "aug-native-abi-1",
|
|
293
|
+
"resources": {
|
|
294
|
+
"Tensor": {
|
|
295
|
+
"declaration": "bindings.Tensor",
|
|
296
|
+
"provider": "@greenpandastudios/aug-pytorch:Tensor/v1",
|
|
297
|
+
"representation": "opaque-pointer",
|
|
298
|
+
"release": "aug_torch_tensor_release_v1",
|
|
299
|
+
"releaseCanFail": false,
|
|
300
|
+
"thread": "runtime-owner"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"functions": {
|
|
304
|
+
"api._tensor": {
|
|
305
|
+
"symbol": "aug_torch_tensor_from_f64_v1",
|
|
306
|
+
"callingConvention": "C",
|
|
307
|
+
"physicalParameters": ["ptr<f64>", "u64", "out<Tensor*>", "out<error-v1>"],
|
|
308
|
+
"physicalResult": "i32",
|
|
309
|
+
"input": {
|
|
310
|
+
"values": {"marshal": "copy-list-f64", "data": 0, "length": 1}
|
|
311
|
+
},
|
|
312
|
+
"result": {"marshal": "owned-resource", "type": "Tensor", "out": 2},
|
|
313
|
+
"failure": {"success": 0, "errorOut": 3, "type": "contracts.TensorError"},
|
|
314
|
+
"effects": {"pure": true, "changes": [], "uses": []},
|
|
315
|
+
"execution": {"blocking": true, "callbacks": false, "threads": "native-internal-only"}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
`copy-list-f64` is a closed compiler-supported conversion recipe, not package JavaScript. It validates sizes, creates contiguous doubles, calls once, and releases temporary storage on every result path. The values output recipe copies a native double array into an August List then calls `aug_torch_values_release_v1`, including if the conversion fails. Metadata never receives permission to run arbitrary generated code during installation.
|
|
322
|
+
|
|
323
|
+
### Consumer program
|
|
324
|
+
|
|
325
|
+
Direct repository import, proposed `tensor-demo/main.aug`:
|
|
326
|
+
|
|
327
|
+
```text
|
|
328
|
+
import Tensor and tensor and add and sum and values from "https://github.com/GreenPandaStudios/aug-pytorch#v0.1.0"
|
|
329
|
+
|
|
330
|
+
own Tensor left = tensor(values=[1.0, 2.0, 3.0])
|
|
331
|
+
own Tensor right = tensor(values=[4.0, 5.0, 6.0])
|
|
332
|
+
own Tensor result = add(left, right)
|
|
333
|
+
items = values(tensor=result)
|
|
334
|
+
|
|
335
|
+
assert(items.length() == 3)
|
|
336
|
+
assert(items.get(index=0) == 5.0)
|
|
337
|
+
assert(items.get(index=1) == 7.0)
|
|
338
|
+
assert(items.get(index=2) == 9.0)
|
|
339
|
+
assert(sum(tensor=result) == 21.0)
|
|
340
|
+
print(value="LibTorch: [5, 7, 9], sum 21")
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
The existing exact-name shorthand binds `left` and `right` to those parameter labels. Owned handles are released at exit or earlier failure. This verifies a real tensor operation and a copy out of native tensor storage; it does not call Python.
|
|
344
|
+
|
|
345
|
+
Existing command shapes, after a future release supplies this package/backend:
|
|
346
|
+
|
|
347
|
+
```sh
|
|
348
|
+
aug init tensor-demo
|
|
349
|
+
cd tensor-demo
|
|
350
|
+
# Replace main.aug with the proposed program above.
|
|
351
|
+
aug run --backend llvm
|
|
352
|
+
aug install --frozen
|
|
353
|
+
aug run --backend llvm --offline
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
`--backend llvm` is proposed. Direct import resolution and frozen/offline command shapes are existing features. The acceptance run saves the lock and verifies the artifact reported by the LLVM build.
|
|
357
|
+
|
|
358
|
+
## Package 2: SQLite
|
|
359
|
+
|
|
360
|
+
Repository: **`GreenPandaStudios/aug-sqlite`**. Use `native/src/adapter.c`, the pinned amalgamation, declared compile/thread options, and no dynamically loaded SQLite extensions. Build the selected SQLite into the adapter rather than using the host OS's different SQLite version. Independent C tests verify the SQL and failure paths.
|
|
361
|
+
|
|
362
|
+
### Native implementation seam
|
|
363
|
+
|
|
364
|
+
```c
|
|
365
|
+
typedef struct aug_sqlite_database_v1 aug_sqlite_database_v1;
|
|
366
|
+
|
|
367
|
+
int32_t aug_sqlite_open_v1(
|
|
368
|
+
const uint8_t *path, uint64_t path_length,
|
|
369
|
+
aug_sqlite_database_v1 **out, aug_native_error_v1 *error);
|
|
370
|
+
int32_t aug_sqlite_execute_v1(
|
|
371
|
+
aug_sqlite_database_v1 *database,
|
|
372
|
+
const uint8_t *sql, uint64_t sql_length,
|
|
373
|
+
const uint8_t *const *arguments, const uint64_t *lengths,
|
|
374
|
+
uint64_t argument_count, aug_native_error_v1 *error);
|
|
375
|
+
int32_t aug_sqlite_query_text_v1(
|
|
376
|
+
aug_sqlite_database_v1 *database,
|
|
377
|
+
const uint8_t *sql, uint64_t sql_length,
|
|
378
|
+
const uint8_t *const *arguments, const uint64_t *lengths,
|
|
379
|
+
uint64_t argument_count,
|
|
380
|
+
uint8_t **out, uint64_t *out_length, aug_native_error_v1 *error);
|
|
381
|
+
void aug_sqlite_text_release_v1(uint8_t *text);
|
|
382
|
+
void aug_sqlite_database_release_v1(aug_sqlite_database_v1 *database);
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
The wrapper calls real `sqlite3_open_v2`, `sqlite3_prepare_v2`, parameter binding, `sqlite3_step`, column extraction, `sqlite3_finalize`, and connection close. Use `SQLITE_TRANSIENT` for text bindings. Copy the returned text before advancing or finalizing. A failed open can still allocate a SQLite connection, so clean it up. Finalize each statement before returning, preserving its execution/finalize error before publishing a successful result. `queryText` requires exactly one non-null text value; no row, null, extra rows, or wrong shape yields `DatabaseError` in this deliberately small API. [SQLite binding/column lifetimes](https://www.sqlite.org/c3ref/bind_blob.html), [SQLite column API](https://www.sqlite.org/c3ref/column_blob.html).
|
|
386
|
+
|
|
387
|
+
No statement escapes these operations. The release contract finalizes no user-visible live children, performs **no implicit commit**, and releases the acquired connection through the selected tested close policy. Checked transaction/flush/close APIs precede exposing more complex transaction state. A later prepared-statement resource needs an owner/child lifetime contract, not a borrowed pointer disguised as an independent database.
|
|
388
|
+
|
|
389
|
+
Direct C binding is also checked: generate the physical declarations from the selected SQLite header, and expose a small readonly version query mapped directly to `sqlite3_libversion_number` with its C-int return width. Include that upstream symbol in the qualified artifact export list or a separately declared SQLite library. Its native probe verifies the selected upstream version. This demonstrates direct C lowering as well as the higher-level adapter.
|
|
390
|
+
|
|
391
|
+
### August source
|
|
392
|
+
|
|
393
|
+
Proposed `src/bindings.aug`:
|
|
394
|
+
|
|
395
|
+
```text
|
|
396
|
+
extern C resource Database
|
|
397
|
+
|
|
398
|
+
DatabaseError(int code, string message) implements Error:
|
|
399
|
+
pass
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
Proposed `src/contracts.aug` imports the resource and error. Keeping the resource in a file that does not import this capability prevents an import cycle:
|
|
403
|
+
|
|
404
|
+
```text
|
|
405
|
+
import Database and DatabaseError from bindings
|
|
406
|
+
capability Databases:
|
|
407
|
+
open(string path) returns own Database uses Databases.open unless DatabaseError
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Proposed `src/api.aug` contains the private foreign declarations and safe wrappers together:
|
|
411
|
+
|
|
412
|
+
```text
|
|
413
|
+
import Database and DatabaseError from bindings
|
|
414
|
+
import Databases from contracts
|
|
415
|
+
|
|
416
|
+
extern C _open(string path) returns own Database uses Databases.open unless DatabaseError
|
|
417
|
+
extern C _execute(borrow Database database, string sql, List<string> arguments) changes database unless DatabaseError
|
|
418
|
+
extern C _queryText(borrow Database database, string sql, List<string> arguments) returns string changes database unless DatabaseError
|
|
419
|
+
|
|
420
|
+
NativeDatabases() implements Databases:
|
|
421
|
+
open(string path) returns own Database:
|
|
422
|
+
unsafe:
|
|
423
|
+
return _open(path)
|
|
424
|
+
|
|
425
|
+
execute(borrow Database database, string sql, List<string> arguments):
|
|
426
|
+
unsafe:
|
|
427
|
+
_execute(database, sql, arguments)
|
|
428
|
+
|
|
429
|
+
queryText(borrow Database database, string sql, List<string> arguments):
|
|
430
|
+
unsafe:
|
|
431
|
+
return _queryText(database, sql, arguments)
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
The descriptor resolves `api._open`, `api._execute`, and `api._queryText`. These native contracts explicitly grant and describe access. Querying changes connection/statement state even when it does not change table rows. Metadata maps string lists to bounded pointer/length arrays, assigns each result allocator, and names database cleanup. Implementations infer their effects and errors from the checked calls.
|
|
435
|
+
|
|
436
|
+
Public exports:
|
|
437
|
+
|
|
438
|
+
```text
|
|
439
|
+
export Database from bindings
|
|
440
|
+
export DatabaseError from bindings
|
|
441
|
+
export Databases from contracts
|
|
442
|
+
export NativeDatabases from api
|
|
443
|
+
export execute from api
|
|
444
|
+
export queryText from api
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Consumer program
|
|
448
|
+
|
|
449
|
+
Alias workflow uses existing commands:
|
|
450
|
+
|
|
451
|
+
```sh
|
|
452
|
+
aug init database-demo
|
|
453
|
+
cd database-demo
|
|
454
|
+
aug add https://github.com/GreenPandaStudios/aug-sqlite#v0.1.0 --as sqlite
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Proposed `main.aug` after replacing the starter:
|
|
458
|
+
|
|
459
|
+
```text
|
|
460
|
+
import Database and Databases and NativeDatabases and execute and queryText from sqlite
|
|
461
|
+
|
|
462
|
+
implement Databases with NativeDatabases
|
|
463
|
+
resolve Databases to databases
|
|
464
|
+
own Database database = databases.open(path=":memory:")
|
|
465
|
+
|
|
466
|
+
borrow database:
|
|
467
|
+
execute(database, sql="CREATE TABLE people(id INTEGER PRIMARY KEY, name TEXT NOT NULL)", arguments=[])
|
|
468
|
+
execute(database, sql="INSERT INTO people(id, name) VALUES(1, ?)", arguments=["August"])
|
|
469
|
+
name = queryText(database, sql="SELECT name FROM people WHERE id = 1", arguments=[])
|
|
470
|
+
assert(name == "August")
|
|
471
|
+
|
|
472
|
+
print(value="SQLite: August")
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
This creates a real in-memory SQLite database, table, inserted row, and query. A separate acceptance program uses a temporary file, closes the first connection, opens another, and verifies persistence; memory-only evidence is insufficient for the file-backed contract. All operations are real SQLite calls. A repository-literal variant replaces `from sqlite` with `from "https://github.com/GreenPandaStudios/aug-sqlite#v0.1.0"` and removes the unused alias configuration.
|
|
476
|
+
|
|
477
|
+
```sh
|
|
478
|
+
aug run --backend llvm
|
|
479
|
+
aug build --backend llvm --bundle deployment
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
Both flags are proposed. The ordinary `main.yaml` alias written by `aug add` remains unchanged in shape.
|
|
483
|
+
|
|
484
|
+
## Package 3: zlib
|
|
485
|
+
|
|
486
|
+
Repository: **`GreenPandaStudios/aug-zlib`**. Use the common layout with `native/src/adapter.c`, exact zlib source/configuration, and a C build. `src/api.aug` contains private foreign declarations and safe functions **in the same file**. `src/contracts.aug` contains `CompressionError`.
|
|
487
|
+
|
|
488
|
+
### Native implementation seam
|
|
489
|
+
|
|
490
|
+
```c
|
|
491
|
+
int32_t aug_zlib_compress_v1(
|
|
492
|
+
const uint8_t *input, uint64_t input_length, int32_t level,
|
|
493
|
+
uint8_t **out, uint64_t *out_length, aug_native_error_v1 *error);
|
|
494
|
+
int32_t aug_zlib_decompress_v1(
|
|
495
|
+
const uint8_t *input, uint64_t input_length, uint64_t limit,
|
|
496
|
+
uint8_t **out, uint64_t *out_length, aug_native_error_v1 *error);
|
|
497
|
+
void aug_zlib_bytes_release_v1(uint8_t *bytes);
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Compression calls zlib, with checked conversions to the upstream width and `compressBound` allocation. Decompression enforces the caller's output limit and rejects invalid/truncated/trailing input according to a stated single-stream policy. If implemented with inflate internally, `inflateEnd` runs on every initialized path. Error results publish no output allocation; successful output is copied into August Bytes, then freed through the adapter. The limit is a resource policy, not a guessed decompressed size. [Pinned zlib API](https://github.com/madler/zlib/blob/v1.3.2/zlib.h).
|
|
501
|
+
|
|
502
|
+
Proposed `src/api.aug`:
|
|
503
|
+
|
|
504
|
+
```text
|
|
505
|
+
import CompressionError from contracts
|
|
506
|
+
|
|
507
|
+
extern C _compress(Bytes input, int level) returns Bytes unless CompressionError
|
|
508
|
+
extern C _decompress(Bytes input, int limit) returns Bytes unless CompressionError
|
|
509
|
+
|
|
510
|
+
compress(Bytes input, int level):
|
|
511
|
+
unsafe:
|
|
512
|
+
return _compress(input, level)
|
|
513
|
+
|
|
514
|
+
decompress(Bytes input, int limit):
|
|
515
|
+
unsafe:
|
|
516
|
+
return _decompress(input, limit)
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
The descriptor validates level 0–9 and positive bounded output limits before converting native widths, permits only call-duration immutable input reads, and maps nonzero zlib statuses to `CompressionError`. Author-facing source/native metadata makes these constraints discoverable. `src/export.aug` exports `compress`, `decompress`, and `CompressionError`, excluding the raw calls.
|
|
520
|
+
|
|
521
|
+
### Consumer program
|
|
522
|
+
|
|
523
|
+
Proposed `compression-demo/main.aug`:
|
|
524
|
+
|
|
525
|
+
```text
|
|
526
|
+
import compress and decompress from "https://github.com/GreenPandaStudios/aug-zlib#v0.1.0"
|
|
527
|
+
|
|
528
|
+
input = "August: apples, pears, and π".bytes()
|
|
529
|
+
compressed = compress(input, level=6)
|
|
530
|
+
restored = decompress(input=compressed, limit=4096)
|
|
531
|
+
|
|
532
|
+
assert(restored.length() == input.length())
|
|
533
|
+
assert(restored.base64url() == input.base64url())
|
|
534
|
+
print(value="zlib: round trip verified")
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
Comparing base64url compares full byte content using an existing builtin; it does not depend on reference equality. No assertion requires compressed short input to be smaller. The integration suite additionally round-trips NUL/high-byte buffers, empty input, repeated data, and corrupted/truncated streams through native fixture inputs and the real adapter. Do not treat text-only output as binary correctness coverage.
|
|
538
|
+
|
|
539
|
+
```sh
|
|
540
|
+
aug init compression-demo
|
|
541
|
+
cd compression-demo
|
|
542
|
+
# Replace main.aug with the proposed program.
|
|
543
|
+
aug run --backend llvm
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
The alias alternative is `aug add https://github.com/GreenPandaStudios/aug-zlib#v0.1.0 --as zlib`, followed by `import compress and decompress from zlib`.
|
|
547
|
+
|
|
548
|
+
## Package 4: Rust BLAKE3
|
|
549
|
+
|
|
550
|
+
Repository: **`GreenPandaStudios/aug-blake3`**. The native directory is a Rust adapter crate with a committed lock/toolchain file. This is wrapping a crate that does not itself promise the desired foreign interface; consuming an already C-compatible Rust library would instead import its verified header/contract directly.
|
|
551
|
+
|
|
552
|
+
Proposed `native/Cargo.toml`:
|
|
553
|
+
|
|
554
|
+
```toml
|
|
555
|
+
[package]
|
|
556
|
+
name = "aug-blake3-native"
|
|
557
|
+
version = "0.1.0"
|
|
558
|
+
edition = "2024"
|
|
559
|
+
|
|
560
|
+
[lib]
|
|
561
|
+
crate-type = ["cdylib"]
|
|
562
|
+
|
|
563
|
+
[dependencies]
|
|
564
|
+
blake3 = { version = "=1.8.7", default-features = false, features = ["std", "pure"] }
|
|
565
|
+
|
|
566
|
+
[profile.release]
|
|
567
|
+
panic = "unwind"
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
The release recipe commits an exact `rust-toolchain.toml` chosen and tested during artifact construction; this research did not qualify a Rust compiler version. Set `MACOSX_DEPLOYMENT_TARGET=14.0` in the builder. Use `cargo build --locked`, then offline reproduction with cached declared inputs. Record Rust's version, crate versions/features, native dependencies, and any actual build scripts in provenance. Cargo execution occurs in author CI or an explicitly selected source build, not a consumer `aug install`.
|
|
571
|
+
|
|
572
|
+
### Native export interface
|
|
573
|
+
|
|
574
|
+
```c
|
|
575
|
+
int32_t aug_blake3_digest_hex_v1(
|
|
576
|
+
const uint8_t *input, uint64_t input_length,
|
|
577
|
+
uint8_t **out, uint64_t *out_length, aug_native_error_v1 *error);
|
|
578
|
+
void aug_blake3_text_release_v1(uint8_t *text, uint64_t length);
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
The Rust export uses `#[unsafe(no_mangle)] pub extern "C" fn ...`, validates pointers/lengths, and encloses real `blake3::hash(input).to_hex()` work in `catch_unwind`. Zero-length input uses an empty slice without making a null Rust slice. Nonzero lengths must fit `isize::MAX` and the target allocation rules; Rust references/layout do not cross the interface.
|
|
582
|
+
|
|
583
|
+
Return the 64 ASCII bytes as a Rust-allocated boxed byte slice. The matching release reconstructs that exact boxed slice using the recorded pointer and length; August copies it before release. Do not reconstruct an arbitrary Vec with a guessed capacity. On failure, output stays null/zero and a bounded error is supplied. A destructor for bytes is infallible; panic payload disposal and error reporting must not introduce another unwind across the C export. OOM/abort panics remain process failures, not a guaranteed `DigestError` recovery.
|
|
584
|
+
|
|
585
|
+
The one-shot API exercises Rust execution, panic strategy, a call-duration byte loan, Rust allocation transfer, and Rust deallocation. A later streaming Hasher resource can test `Box<Hasher>` ownership and poisoned-state policy, but is not needed to make this initial package useful.
|
|
586
|
+
|
|
587
|
+
Proposed `src/api.aug`:
|
|
588
|
+
|
|
589
|
+
```text
|
|
590
|
+
import DigestError from contracts
|
|
591
|
+
|
|
592
|
+
extern C _digestHex(Bytes input) returns string unless DigestError
|
|
593
|
+
|
|
594
|
+
digestHex(Bytes input):
|
|
595
|
+
unsafe:
|
|
596
|
+
return _digestHex(input)
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
The descriptor specifies a Rust-owned UTF-8/ASCII output slice and `aug_blake3_text_release_v1`, with panic status mapped to `DigestError`. `src/export.aug` exports `digestHex` and `DigestError`. No Crypto capability is required for deterministic hashing; this API provides no randomness or secret-key operation.
|
|
600
|
+
|
|
601
|
+
### Consumer program
|
|
602
|
+
|
|
603
|
+
Proposed `digest-demo/main.aug`:
|
|
604
|
+
|
|
605
|
+
```text
|
|
606
|
+
import digestHex from "https://github.com/GreenPandaStudios/aug-blake3#v0.1.0"
|
|
607
|
+
|
|
608
|
+
actual = digestHex(input="".bytes())
|
|
609
|
+
expected = "af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262"
|
|
610
|
+
assert(actual == expected)
|
|
611
|
+
print(value="Rust BLAKE3: digest verified")
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
Use the pinned upstream test vectors for the acceptance suite and add nonempty inputs, rather than an oracle calculated by the same adapter under test. The exact empty-input vector above must be checked against that pinned fixture when the repository is created. [Upstream vectors](https://github.com/BLAKE3-team/BLAKE3/blob/1.8.7/test_vectors/test_vectors.json).
|
|
615
|
+
|
|
616
|
+
```sh
|
|
617
|
+
aug init digest-demo
|
|
618
|
+
cd digest-demo
|
|
619
|
+
# Replace main.aug with the proposed program.
|
|
620
|
+
aug run --backend llvm
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
The alias alternative is `aug add https://github.com/GreenPandaStudios/aug-blake3#v0.1.0 --as blake3`, then `import digestHex from blake3`.
|
|
624
|
+
|
|
625
|
+
## Author build and publish workflow
|
|
626
|
+
|
|
627
|
+
These are **proposed contributor commands**, not commands available in the published CLI. Native tools are expected on the maintainer machine. Example for the PyTorch repository; apply the same sequence to the other three with their headers/recipes:
|
|
628
|
+
|
|
629
|
+
```sh
|
|
630
|
+
aug package init aug-pytorch --name @greenpandastudios/aug-pytorch
|
|
631
|
+
cd aug-pytorch
|
|
632
|
+
# Add the planned sources, descriptor, wrapper, recipe and tests.
|
|
633
|
+
aug bind header native/include/aug_torch.h --target aarch64-apple-darwin --output native.abi.json
|
|
634
|
+
aug package native build --target aarch64-apple-darwin
|
|
635
|
+
aug package native verify --target aarch64-apple-darwin
|
|
636
|
+
aug check
|
|
637
|
+
aug test --backend llvm
|
|
638
|
+
aug spec
|
|
639
|
+
aug spec --check
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
`aug package init DIRECTORY --name NAME` is already implemented; `bind`, `package native`, and backend options are new proposals. `native verify` checks headers/layout, expected exports, artifact requirements, and independent test results. Any test that executes a library is an explicit verification command, not installation work.
|
|
643
|
+
|
|
644
|
+
After candidate artifacts pass, compute hashes and record metadata in release commit P while preserving the native source inputs built from S. Native provenance records S and the input subset digest. Publish `v0.1.0` in the **separate package repository**, attach the hash-matched native assets/notices/SBOM/provenance, and verify public installs of that exact tag. Changing the wrapper or upstream dependency creates a new package tag/artifact; never replace a released archive in place.
|
|
645
|
+
|
|
646
|
+
CI should run independent native tests on author toolchains, then the **installed August CLI** against the just-published candidate source/artifact in a consumer environment with no native toolchain. It checks direct URL and alias imports, exact lock restoration, actual computation, errors, resource release, and a moved deployment bundle. Compiler-owned runtime/tool artifacts must already be available before that package claims support for a compiler preview.
|
|
647
|
+
|
|
648
|
+
### Consuming without build tools
|
|
649
|
+
|
|
650
|
+
Once the planned preview is published, a consumer installs the CLI, adds a repository URL or uses one directly, and runs the program. No compiler checkout is needed:
|
|
651
|
+
|
|
652
|
+
```sh
|
|
653
|
+
npm install --global @greenpandastudios/aug-cli@LLVM_PREVIEW_VERSION
|
|
654
|
+
aug init tensor-demo
|
|
655
|
+
cd tensor-demo
|
|
656
|
+
aug add https://github.com/GreenPandaStudios/aug-pytorch#v0.1.0 --as pytorch
|
|
657
|
+
# Write the sample with `from pytorch`.
|
|
658
|
+
aug run --backend llvm
|
|
659
|
+
aug install --frozen
|
|
660
|
+
aug build --backend llvm --bundle deployment
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
The version and flags are proposals. Keep Node/npm as prerequisites; automatically obtain the compiler-owned LLVM/linker/runtime and the package's correct prebuilt artifacts. Commit the source lock. For a second target, explicitly add its selection with proposed `aug install --target TARGET`, then use frozen installation in CI. An optional source-build command reports required tools and never acts as an invisible fallback.
|
|
664
|
+
|
|
665
|
+
## Expected failure diagnostics
|
|
666
|
+
|
|
667
|
+
Codes and exact wording here are proposed. Each diagnostic is structured for the editor/agents as well as readable in the terminal:
|
|
668
|
+
|
|
669
|
+
| Failure | Proposed diagnostic and response |
|
|
670
|
+
| --- | --- |
|
|
671
|
+
| macOS too old | `NATIVE_TARGET: aug-pytorch requires macOS 14.0+ arm64; this host is macOS 13.6 arm64. Supported artifact: cpu-macos-arm64. Use a supported target; August did not start a source build.` |
|
|
672
|
+
| Wrong architecture/libc | `NATIVE_TARGET: requested aarch64-unknown-linux-musl, but this artifact is x86_64-unknown-linux-gnu with the declared glibc floor. No compatible prebuilt artifact is published.` |
|
|
673
|
+
| Missing asset | `NATIVE_ARTIFACT: aug-zlib@0.1.0 declares native-macos-arm64.tar.gz, but it could not be obtained at the locked URL. Retry if the release is still publishing, or select a published package version. The lock was preserved.` |
|
|
674
|
+
| Corrupt/changed bytes | `NATIVE_INTEGRITY: downloaded artifact SHA-256 differs from aug.lock.json. Rejected before extraction. Restore the expected release or choose a new version explicitly.` |
|
|
675
|
+
| Offline miss | `NATIVE_OFFLINE: the locked LibTorch artifact is not cached for this target. Run aug install --frozen online to prepare it, then retry --offline.` |
|
|
676
|
+
| Lock lacks target | `PACKAGE_TARGET: the frozen lock has no native selection for this target. Add it explicitly with aug install --target TARGET, review the lock, then retry frozen installation.` |
|
|
677
|
+
| Header/ABI mismatch | `NATIVE_ABI: api._tensor expects the recorded physical signature/layout, but the artifact contract differs. Rebuild the package adapter and descriptor together.` |
|
|
678
|
+
| Missing dylib at deployment | `NATIVE_LOAD: the deployment requires libtorch_cpu at its declared relative path; the bundle is incomplete. Deploy the complete aug build --bundle directory.` |
|
|
679
|
+
| Unsupported pointer/callback | `FFI_PROFILE: this declaration retains an input pointer or callback beyond the call. aug-native-abi-1 supports call-duration loans only; use a copied-input adapter or a separately supported lifetime profile.` |
|
|
680
|
+
| Ownership misuse | `OWNERSHIP: Tensor result was moved or released here and is used again here.` Both locations are reported. |
|
|
681
|
+
| LLVM feature not ported | `BACKEND_UNSUPPORTED: this checked August construct has not been lowered by the LLVM preview. The source location and profile are reported; no C fallback occurred.` |
|
|
682
|
+
| Source build requested without tools | `NATIVE_SOURCE_BUILD: this explicitly selected recipe needs clang++/CMake and a licensed macOS SDK. Install the maintainer prerequisites or use a supported prebuilt artifact.` |
|
|
683
|
+
|
|
684
|
+
Native computation errors remain ordinary checked August errors, such as `TensorError`, `DatabaseError`, `CompressionError`, and `DigestError`. Their messages contain copied bounded native details, rather than unstable pointers or C++/Rust stack unwinding. Application tests catch those failures using existing `try`/`catch`, and resource cleanup remains guaranteed on the supported paths.
|