@greenpandastudios/aug-cli 0.19.0 → 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.
Files changed (628) hide show
  1. package/README.md +9 -6
  2. package/THIRD_PARTY_NOTICES.md +4 -0
  3. package/bin/aug.mjs +12 -2
  4. package/docs/about.md +27 -0
  5. package/docs/api/crypto.md +103 -69
  6. package/docs/api/io.md +35 -33
  7. package/docs/api/json.md +3 -3
  8. package/docs/api/memory.md +23 -19
  9. package/docs/api/time.md +10 -9
  10. package/docs/api/web.md +33 -38
  11. package/docs/assets/benchmarks/execution.svg +774 -637
  12. package/docs/assets/benchmarks/http.svg +278 -249
  13. package/docs/assets/benchmarks/improvements.svg +66 -66
  14. package/docs/assets/benchmarks/kernels-mobile.svg +1 -0
  15. package/docs/assets/benchmarks/kernels.svg +1 -0
  16. package/docs/assets/benchmarks/memory.svg +153 -153
  17. package/docs/benchmark-results.json +227089 -90363
  18. package/docs/compatibility.md +8 -8
  19. package/docs/contributing-benchmarks.md +68 -0
  20. package/docs/dev-containers.md +88 -0
  21. package/docs/dgx-consumers.json +122 -0
  22. package/docs/dgx-gyms.json +784 -0
  23. package/docs/dgx-kernels.json +1170 -0
  24. package/docs/dgx-performance.json +227849 -0
  25. package/docs/dgx-spark.md +64 -0
  26. package/docs/diagnostics.md +15 -5
  27. package/docs/docker.md +173 -12
  28. package/docs/editor.md +35 -0
  29. package/docs/example-projects.json +238 -24
  30. package/docs/examples/approved-design/counters.md +34 -126
  31. package/docs/examples/approved-design/dependencies/august/0.21.0/io/contracts.md +178 -0
  32. package/docs/examples/approved-design/domain/app.md +13 -77
  33. package/docs/examples/approved-design/domain/export.md +5 -19
  34. package/docs/examples/approved-design/domain/models.md +4 -23
  35. package/docs/examples/approved-design/domain/numbers.md +24 -114
  36. package/docs/examples/approved-design/index.md +16 -7
  37. package/docs/examples/approved-design/main.md +19 -96
  38. package/docs/examples/benchmark/index.md +6 -5
  39. package/docs/examples/benchmark/main.md +7 -35
  40. package/docs/examples/calls-benchmark/index.md +36 -0
  41. package/docs/examples/calls-benchmark/main.md +78 -0
  42. package/docs/examples/calls-benchmark/operations.md +60 -0
  43. package/docs/examples/cli-args/index.md +6 -5
  44. package/docs/examples/cli-args/main.md +6 -31
  45. package/docs/examples/collections/index.md +6 -5
  46. package/docs/examples/collections/main.md +7 -35
  47. package/docs/examples/collections-benchmark/index.md +6 -5
  48. package/docs/examples/collections-benchmark/main.md +7 -35
  49. package/docs/examples/cpu-benchmark/index.md +6 -5
  50. package/docs/examples/cpu-benchmark/main.md +5 -24
  51. package/docs/examples/developer-workflow/calculator.md +39 -186
  52. package/docs/examples/developer-workflow/dependencies/august/0.21.0/io/contracts.md +178 -0
  53. package/docs/examples/developer-workflow/index.md +16 -7
  54. package/docs/examples/developer-workflow/logging/console.md +10 -56
  55. package/docs/examples/developer-workflow/logging/export.md +4 -14
  56. package/docs/examples/developer-workflow/logging/logger.md +7 -43
  57. package/docs/examples/developer-workflow/main.md +17 -69
  58. package/docs/examples/drop/index.md +6 -5
  59. package/docs/examples/drop/main.md +7 -27
  60. package/docs/examples/drop/resource.md +7 -30
  61. package/docs/examples/errors/errors.md +7 -27
  62. package/docs/examples/errors/index.md +6 -5
  63. package/docs/examples/errors/main.md +7 -28
  64. package/docs/examples/errors-benchmark/index.md +36 -0
  65. package/docs/examples/errors-benchmark/main.md +92 -0
  66. package/docs/examples/errors-benchmark/operations.md +65 -0
  67. package/docs/examples/ffi/index.md +6 -5
  68. package/docs/examples/ffi/main.md +6 -20
  69. package/docs/examples/ffi/native.md +8 -34
  70. package/docs/examples/float-benchmark/index.md +35 -0
  71. package/docs/examples/float-benchmark/main.md +75 -0
  72. package/docs/examples/generic-di/dependencies/august/0.21.0/io/contracts.md +178 -0
  73. package/docs/examples/generic-di/index.md +6 -5
  74. package/docs/examples/generic-di/main.md +9 -39
  75. package/docs/examples/generic-di/types.md +23 -92
  76. package/docs/examples/generics/index.md +6 -5
  77. package/docs/examples/generics/main.md +10 -47
  78. package/docs/examples/generics/types.md +25 -100
  79. package/docs/examples/hello/app/export.md +4 -12
  80. package/docs/examples/hello/app/greeter.md +13 -91
  81. package/docs/examples/hello/dependencies/august/0.21.0/io/contracts.md +178 -0
  82. package/docs/examples/hello/index.md +17 -6
  83. package/docs/examples/hello/logging/console.md +10 -54
  84. package/docs/examples/hello/logging/export.md +4 -14
  85. package/docs/examples/hello/logging/logger.md +7 -45
  86. package/docs/examples/hello/main.md +9 -39
  87. package/docs/examples/http-benchmark/index.md +6 -5
  88. package/docs/examples/http-benchmark/main.md +6 -20
  89. package/docs/examples/http-benchmark/routes.md +9 -31
  90. package/docs/examples/index.md +63 -29
  91. package/docs/examples/interceptors/app.md +20 -139
  92. package/docs/examples/interceptors/dependencies/august/0.21.0/io/contracts.md +178 -0
  93. package/docs/examples/interceptors/index.md +6 -5
  94. package/docs/examples/interceptors/interceptors.md +24 -148
  95. package/docs/examples/interceptors/logging.md +13 -76
  96. package/docs/examples/interceptors/main.md +10 -65
  97. package/docs/examples/json-benchmark/data.md +4 -20
  98. package/docs/examples/json-benchmark/dependencies/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +67 -0
  99. package/docs/examples/json-benchmark/index.md +7 -5
  100. package/docs/examples/json-benchmark/main-yaml.md +20 -0
  101. package/docs/examples/json-benchmark/main.md +10 -49
  102. package/docs/examples/list-benchmark/index.md +35 -0
  103. package/docs/examples/list-benchmark/main.md +78 -0
  104. package/docs/examples/map-churn-benchmark/index.md +35 -0
  105. package/docs/examples/map-churn-benchmark/main.md +106 -0
  106. package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/api.md +104 -0
  107. package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.md +54 -0
  108. package/docs/examples/native-blake3/dependencies/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi-json.md +48 -0
  109. package/docs/examples/native-blake3/hashing.md +93 -0
  110. package/docs/examples/native-blake3/index.md +38 -0
  111. package/docs/examples/native-blake3/main.md +73 -0
  112. package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/api.md +406 -0
  113. package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.md +51 -0
  114. package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.md +63 -0
  115. package/docs/examples/native-pytorch/dependencies/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi-json.md +161 -0
  116. package/docs/examples/native-pytorch/index.md +38 -0
  117. package/docs/examples/native-pytorch/main.md +73 -0
  118. package/docs/examples/native-pytorch/tensors.md +123 -0
  119. package/docs/examples/native-sqlite/database.md +116 -0
  120. package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/api.md +284 -0
  121. package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.md +51 -0
  122. package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.md +75 -0
  123. package/docs/examples/native-sqlite/dependencies/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi-json.md +119 -0
  124. package/docs/examples/native-sqlite/index.md +38 -0
  125. package/docs/examples/native-sqlite/main.md +73 -0
  126. package/docs/examples/native-zlib/compression.md +99 -0
  127. package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/api.md +153 -0
  128. package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.md +54 -0
  129. package/docs/examples/native-zlib/dependencies/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi-json.md +76 -0
  130. package/docs/examples/native-zlib/index.md +38 -0
  131. package/docs/examples/native-zlib/main.md +78 -0
  132. package/docs/examples/new-syntax/console.md +10 -52
  133. package/docs/examples/new-syntax/dependencies/august/0.21.0/io/contracts.md +178 -0
  134. package/docs/examples/new-syntax/greeter.md +13 -71
  135. package/docs/examples/new-syntax/index.md +6 -5
  136. package/docs/examples/new-syntax/logger.md +7 -43
  137. package/docs/examples/new-syntax/main.md +10 -53
  138. package/docs/examples/new-syntax/math.md +6 -24
  139. package/docs/examples/oidc-login/client/contracts.md +10 -61
  140. package/docs/examples/oidc-login/client/endpoints.md +32 -154
  141. package/docs/examples/oidc-login/client/export.md +5 -23
  142. package/docs/examples/oidc-login/client/login.md +234 -344
  143. package/docs/examples/oidc-login/client/logout.md +38 -143
  144. package/docs/examples/oidc-login/client/protocol.md +183 -304
  145. package/docs/examples/oidc-login/client/session.md +41 -149
  146. package/docs/examples/oidc-login/client/views.md +13 -58
  147. package/docs/examples/oidc-login/common/export.md +6 -26
  148. package/docs/examples/oidc-login/common/headers.md +42 -72
  149. package/docs/examples/oidc-login/common/keys.md +40 -164
  150. package/docs/examples/oidc-login/common/settings.md +24 -40
  151. package/docs/examples/oidc-login/common/views.md +7 -28
  152. package/docs/examples/oidc-login/dependencies/packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/store.md +205 -0
  153. package/docs/examples/oidc-login/dependencies/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +67 -0
  154. package/docs/examples/oidc-login/dependencies/packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +267 -0
  155. package/docs/examples/oidc-login/dependencies/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/contracts.md +415 -0
  156. package/docs/examples/oidc-login/dependencies/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/jose.md +271 -0
  157. package/docs/examples/oidc-login/dependencies/packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.md +89 -0
  158. package/docs/examples/oidc-login/index.md +8 -7
  159. package/docs/examples/oidc-login/main-yaml.md +7 -0
  160. package/docs/examples/oidc-login/main.md +26 -153
  161. package/docs/examples/oidc-login/provider/authorization.md +232 -275
  162. package/docs/examples/oidc-login/provider/contracts.md +24 -146
  163. package/docs/examples/oidc-login/provider/credentials.md +24 -57
  164. package/docs/examples/oidc-login/provider/discovery.md +48 -122
  165. package/docs/examples/oidc-login/provider/export.md +11 -37
  166. package/docs/examples/oidc-login/provider/token.md +159 -237
  167. package/docs/examples/oidc-login/provider/userinfo.md +47 -102
  168. package/docs/examples/oidc-login/provider/views.md +13 -53
  169. package/docs/examples/ownership/counter.md +17 -63
  170. package/docs/examples/ownership/index.md +6 -5
  171. package/docs/examples/ownership/main.md +7 -30
  172. package/docs/examples/ownership-transfer/dependencies/august/0.21.0/io/contracts.md +178 -0
  173. package/docs/examples/ownership-transfer/index.md +6 -5
  174. package/docs/examples/ownership-transfer/main.md +10 -52
  175. package/docs/examples/ownership-transfer/resource.md +15 -67
  176. package/docs/examples/packages-app/dependencies/packages/@example/aug-math/0.1.0/arithmetic.md +12 -50
  177. package/docs/examples/packages-app/index.md +7 -6
  178. package/docs/examples/packages-app/main.md +7 -25
  179. package/docs/examples/packages-math/aug-package-json.md +1 -1
  180. package/docs/examples/packages-math/index.md +7 -6
  181. package/docs/examples/packages-math/src/arithmetic.md +12 -50
  182. package/docs/examples/packages-math/src/export.md +4 -12
  183. package/docs/examples/records-benchmark/data.md +55 -0
  184. package/docs/examples/records-benchmark/index.md +36 -0
  185. package/docs/examples/records-benchmark/main.md +85 -0
  186. package/docs/examples/startup-benchmark/index.md +6 -5
  187. package/docs/examples/startup-benchmark/main.md +5 -17
  188. package/docs/examples/strings-benchmark/index.md +35 -0
  189. package/docs/examples/strings-benchmark/main.md +76 -0
  190. package/docs/examples/tasks-benchmark/index.md +36 -0
  191. package/docs/examples/tasks-benchmark/main.md +89 -0
  192. package/docs/examples/tasks-benchmark/operations.md +58 -0
  193. package/docs/examples/visibility/counter.md +19 -67
  194. package/docs/examples/visibility/index.md +6 -5
  195. package/docs/examples/visibility/main.md +7 -31
  196. package/docs/examples/weather-api/forecasts.md +168 -0
  197. package/docs/examples/weather-api/index.md +42 -0
  198. package/docs/examples/weather-api/main-yaml.md +21 -0
  199. package/docs/examples/weather-api/main.md +65 -0
  200. package/docs/examples.json +10 -0
  201. package/docs/getting-started.md +105 -2
  202. package/docs/grammar.md +7 -5
  203. package/docs/guides/change-a-module.md +64 -0
  204. package/docs/guides/index.md +27 -0
  205. package/docs/gym-results.json +784 -0
  206. package/docs/implementation-map.md +6 -0
  207. package/docs/index.md +51 -29
  208. package/docs/kernel-results.json +1170 -0
  209. package/docs/language-conformance.md +7 -1
  210. package/docs/language-constructs.md +30 -22
  211. package/docs/language-design-audit.md +1 -1
  212. package/docs/learn/data-and-errors.md +77 -0
  213. package/docs/learn/index.md +30 -0
  214. package/docs/learn/modules-and-dependencies.md +73 -0
  215. package/docs/learn/state-and-tests.md +71 -0
  216. package/docs/learn/values-and-functions.md +62 -0
  217. package/docs/lesson-failures.json +8 -0
  218. package/docs/maintaining-docs.md +16 -4
  219. package/docs/native-implementation.md +276 -0
  220. package/docs/native-interop-llvm-plan.md +342 -0
  221. package/docs/native-package-examples.md +684 -0
  222. package/docs/native-packages.md +179 -0
  223. package/docs/packages.md +72 -126
  224. package/docs/performance.md +61 -68
  225. package/docs/production-readiness.md +16 -5
  226. package/docs/public/downloads/approved-design.zip +0 -0
  227. package/docs/public/downloads/benchmark.zip +0 -0
  228. package/docs/public/downloads/calls-benchmark.zip +0 -0
  229. package/docs/public/downloads/cli-args.zip +0 -0
  230. package/docs/public/downloads/collections-benchmark.zip +0 -0
  231. package/docs/public/downloads/collections.zip +0 -0
  232. package/docs/public/downloads/cpu-benchmark.zip +0 -0
  233. package/docs/public/downloads/developer-workflow.zip +0 -0
  234. package/docs/public/downloads/drop.zip +0 -0
  235. package/docs/public/downloads/errors-benchmark.zip +0 -0
  236. package/docs/public/downloads/errors.zip +0 -0
  237. package/docs/public/downloads/ffi.zip +0 -0
  238. package/docs/public/downloads/float-benchmark.zip +0 -0
  239. package/docs/public/downloads/generic-di.zip +0 -0
  240. package/docs/public/downloads/generics.zip +0 -0
  241. package/docs/public/downloads/hello.zip +0 -0
  242. package/docs/public/downloads/http-benchmark.zip +0 -0
  243. package/docs/public/downloads/interceptors.zip +0 -0
  244. package/docs/public/downloads/json-benchmark.zip +0 -0
  245. package/docs/public/downloads/list-benchmark.zip +0 -0
  246. package/docs/public/downloads/map-churn-benchmark.zip +0 -0
  247. package/docs/public/downloads/native-blake3.zip +0 -0
  248. package/docs/public/downloads/native-pytorch.zip +0 -0
  249. package/docs/public/downloads/native-sqlite.zip +0 -0
  250. package/docs/public/downloads/native-zlib.zip +0 -0
  251. package/docs/public/downloads/new-syntax.zip +0 -0
  252. package/docs/public/downloads/oidc-login.zip +0 -0
  253. package/docs/public/downloads/ownership-transfer.zip +0 -0
  254. package/docs/public/downloads/ownership.zip +0 -0
  255. package/docs/public/downloads/packages-app.zip +0 -0
  256. package/docs/public/downloads/packages-math.zip +0 -0
  257. package/docs/public/downloads/records-benchmark.zip +0 -0
  258. package/docs/public/downloads/startup-benchmark.zip +0 -0
  259. package/docs/public/downloads/strings-benchmark.zip +0 -0
  260. package/docs/public/downloads/tasks-benchmark.zip +0 -0
  261. package/docs/public/downloads/visibility.zip +0 -0
  262. package/docs/public/downloads/weather-api.zip +0 -0
  263. package/docs/qualification-results.md +66 -0
  264. package/docs/reference.md +47 -17
  265. package/docs/releasing.md +105 -16
  266. package/docs/research/code-to-natural-language.md +108 -0
  267. package/docs/research/ecosystem-workflow.md +41 -0
  268. package/docs/research/libtorch-native-qualification.md +115 -0
  269. package/docs/research/native-interop-llvm.md +197 -0
  270. package/docs/research/qualification-methods.md +15 -0
  271. package/docs/research/wiki-editorial-design.md +71 -0
  272. package/docs/roadmap.md +2 -1
  273. package/docs/safety-gyms.md +41 -0
  274. package/docs/specifications.md +27 -11
  275. package/docs/testing.md +19 -5
  276. package/docs/tooling.md +36 -22
  277. package/docs/weather-api.md +65 -0
  278. package/docs/web-library-gaps.md +1 -1
  279. package/docs/web.md +54 -18
  280. package/docs/writing-docs.md +49 -0
  281. package/examples/{hello/.aug-spec/august/0.19.0 → approved-design/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
  282. package/examples/approved-design/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
  283. package/examples/approved-design/.aug-spec/manifest.json +3 -3
  284. package/examples/approved-design/counters.aug +5 -4
  285. package/examples/approved-design/counters.aug.md +25 -132
  286. package/examples/approved-design/domain/app.aug +2 -1
  287. package/examples/approved-design/domain/app.aug.md +10 -80
  288. package/examples/approved-design/domain/export.aug +1 -0
  289. package/examples/approved-design/domain/export.aug.md +4 -20
  290. package/examples/approved-design/domain/models.aug +1 -0
  291. package/examples/approved-design/domain/models.aug.md +3 -25
  292. package/examples/approved-design/domain/numbers.aug +3 -2
  293. package/examples/approved-design/domain/numbers.aug.md +19 -116
  294. package/examples/approved-design/main.aug +1 -0
  295. package/examples/approved-design/main.aug.md +12 -95
  296. package/examples/benchmark/.aug-spec/manifest.json +1 -1
  297. package/examples/benchmark/main.aug +1 -0
  298. package/examples/benchmark/main.aug.md +6 -36
  299. package/examples/cli-args/.aug-spec/manifest.json +1 -1
  300. package/examples/cli-args/main.aug +1 -0
  301. package/examples/cli-args/main.aug.md +5 -32
  302. package/examples/collections/.aug-spec/manifest.json +1 -1
  303. package/examples/collections/main.aug +1 -0
  304. package/examples/collections/main.aug.md +6 -36
  305. package/examples/{generic-di/.aug-spec/august/0.19.0 → developer-workflow/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
  306. package/examples/developer-workflow/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
  307. package/examples/developer-workflow/.aug-spec/manifest.json +3 -3
  308. package/examples/developer-workflow/calculator.aug +3 -2
  309. package/examples/developer-workflow/calculator.aug.md +28 -189
  310. package/examples/developer-workflow/logging/console.aug +2 -1
  311. package/examples/developer-workflow/logging/console.aug.md +7 -57
  312. package/examples/developer-workflow/logging/export.aug +1 -0
  313. package/examples/developer-workflow/logging/export.aug.md +3 -15
  314. package/examples/developer-workflow/logging/logger.aug +1 -0
  315. package/examples/developer-workflow/logging/logger.aug.md +6 -46
  316. package/examples/developer-workflow/main.aug +1 -0
  317. package/examples/developer-workflow/main.aug.md +10 -68
  318. package/examples/drop/.aug-spec/manifest.json +1 -1
  319. package/examples/drop/main.aug +1 -0
  320. package/examples/drop/main.aug.md +6 -28
  321. package/examples/drop/resource.aug +1 -0
  322. package/examples/drop/resource.aug.md +6 -34
  323. package/examples/errors/.aug-spec/manifest.json +1 -1
  324. package/examples/errors/errors.aug +2 -1
  325. package/examples/errors/errors.aug.md +4 -27
  326. package/examples/errors/main.aug +1 -0
  327. package/examples/errors/main.aug.md +6 -29
  328. package/examples/ffi/.aug-spec/manifest.json +1 -1
  329. package/examples/ffi/main.aug +1 -0
  330. package/examples/ffi/main.aug.md +5 -21
  331. package/examples/ffi/native.aug +2 -1
  332. package/examples/ffi/native.aug.md +5 -35
  333. package/examples/{approved-design/.aug-spec/august/0.19.0 → generic-di/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
  334. package/examples/generic-di/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
  335. package/examples/generic-di/.aug-spec/manifest.json +3 -3
  336. package/examples/generic-di/main.aug +1 -0
  337. package/examples/generic-di/main.aug.md +8 -40
  338. package/examples/generic-di/types.aug +3 -2
  339. package/examples/generic-di/types.aug.md +18 -97
  340. package/examples/generics/.aug-spec/manifest.json +1 -1
  341. package/examples/generics/main.aug +1 -0
  342. package/examples/generics/main.aug.md +9 -48
  343. package/examples/generics/types.aug +4 -3
  344. package/examples/generics/types.aug.md +18 -104
  345. package/examples/{developer-workflow/.aug-spec/august/0.19.0 → hello/.aug-spec/august/0.21.0}/io/contracts.aug +4 -3
  346. package/examples/hello/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
  347. package/examples/hello/.aug-spec/manifest.json +3 -3
  348. package/examples/hello/app/export.aug +1 -0
  349. package/examples/hello/app/export.aug.md +3 -13
  350. package/examples/hello/app/greeter.aug +2 -1
  351. package/examples/hello/app/greeter.aug.md +10 -94
  352. package/examples/hello/logging/console.aug +2 -1
  353. package/examples/hello/logging/console.aug.md +7 -55
  354. package/examples/hello/logging/export.aug +1 -0
  355. package/examples/hello/logging/export.aug.md +3 -15
  356. package/examples/hello/logging/logger.aug +1 -0
  357. package/examples/hello/logging/logger.aug.md +6 -48
  358. package/examples/hello/main.aug +1 -0
  359. package/examples/hello/main.aug.md +8 -40
  360. package/examples/interceptors/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
  361. package/examples/interceptors/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
  362. package/examples/interceptors/.aug-spec/manifest.json +3 -3
  363. package/examples/interceptors/app.aug +3 -2
  364. package/examples/interceptors/app.aug.md +15 -141
  365. package/examples/interceptors/interceptors.aug +3 -2
  366. package/examples/interceptors/interceptors.aug.md +19 -152
  367. package/examples/interceptors/logging.aug +2 -1
  368. package/examples/interceptors/logging.aug.md +10 -79
  369. package/examples/interceptors/main.aug +1 -0
  370. package/examples/interceptors/main.aug.md +9 -66
  371. package/examples/native-blake3/.aug-spec/manifest.json +16 -0
  372. package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.1/native.abi.json +29 -0
  373. package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug +14 -0
  374. package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/api.aug.md +34 -0
  375. package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug +4 -0
  376. package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/contracts.aug.md +8 -0
  377. package/examples/native-blake3/.aug-spec/packages/@greenpandastudios/aug-blake3/0.1.3/native.abi.json +29 -0
  378. package/examples/native-blake3/AGENTS.md +5 -0
  379. package/examples/native-blake3/aug.lock.json +253 -0
  380. package/examples/native-blake3/hashing.aug +11 -0
  381. package/examples/native-blake3/hashing.aug.md +25 -0
  382. package/examples/native-blake3/main.aug +8 -0
  383. package/examples/native-blake3/main.aug.md +13 -0
  384. package/examples/native-pytorch/.aug-spec/manifest.json +18 -0
  385. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.1/native.abi.json +142 -0
  386. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.3/native.abi.json +142 -0
  387. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug +101 -0
  388. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/api.aug.md +160 -0
  389. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug +3 -0
  390. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/bindings.aug.md +8 -0
  391. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug +6 -0
  392. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/contracts.aug.md +13 -0
  393. package/examples/native-pytorch/.aug-spec/packages/@greenpandastudios/aug-pytorch/0.1.4/native.abi.json +142 -0
  394. package/examples/native-pytorch/AGENTS.md +5 -0
  395. package/examples/native-pytorch/aug.lock.json +309 -0
  396. package/examples/native-pytorch/main.aug +8 -0
  397. package/examples/native-pytorch/main.aug.md +13 -0
  398. package/examples/native-pytorch/tensors.aug +23 -0
  399. package/examples/native-pytorch/tensors.aug.md +35 -0
  400. package/examples/native-sqlite/.aug-spec/manifest.json +18 -0
  401. package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.2/native.abi.json +100 -0
  402. package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug +48 -0
  403. package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/api.aug.md +91 -0
  404. package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug +3 -0
  405. package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/bindings.aug.md +8 -0
  406. package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug +8 -0
  407. package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/contracts.aug.md +22 -0
  408. package/examples/native-sqlite/.aug-spec/packages/@greenpandastudios/aug-sqlite/0.1.3/native.abi.json +100 -0
  409. package/examples/native-sqlite/AGENTS.md +5 -0
  410. package/examples/native-sqlite/aug.lock.json +236 -0
  411. package/examples/native-sqlite/database.aug +15 -0
  412. package/examples/native-sqlite/database.aug.md +27 -0
  413. package/examples/native-sqlite/main.aug +8 -0
  414. package/examples/native-sqlite/main.aug.md +13 -0
  415. package/examples/native-zlib/.aug-spec/manifest.json +16 -0
  416. package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.1/native.abi.json +57 -0
  417. package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug +29 -0
  418. package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/api.aug.md +54 -0
  419. package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug +4 -0
  420. package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/contracts.aug.md +8 -0
  421. package/examples/native-zlib/.aug-spec/packages/@greenpandastudios/aug-zlib/0.1.3/native.abi.json +57 -0
  422. package/examples/native-zlib/AGENTS.md +5 -0
  423. package/examples/native-zlib/aug.lock.json +236 -0
  424. package/examples/native-zlib/compression.aug +15 -0
  425. package/examples/native-zlib/compression.aug.md +27 -0
  426. package/examples/native-zlib/main.aug +10 -0
  427. package/examples/native-zlib/main.aug.md +13 -0
  428. package/examples/new-syntax/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
  429. package/examples/new-syntax/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
  430. package/examples/new-syntax/.aug-spec/manifest.json +3 -3
  431. package/examples/new-syntax/console.aug +2 -1
  432. package/examples/new-syntax/console.aug.md +7 -53
  433. package/examples/new-syntax/greeter.aug +2 -1
  434. package/examples/new-syntax/greeter.aug.md +10 -74
  435. package/examples/new-syntax/logger.aug +1 -0
  436. package/examples/new-syntax/logger.aug.md +6 -46
  437. package/examples/new-syntax/main.aug +1 -0
  438. package/examples/new-syntax/main.aug.md +9 -54
  439. package/examples/new-syntax/math.aug +2 -1
  440. package/examples/new-syntax/math.aug.md +3 -24
  441. package/examples/oidc-login/.aug-spec/manifest.json +13 -13
  442. package/examples/oidc-login/.aug-spec/packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/store.aug.md +71 -0
  443. package/examples/oidc-login/.aug-spec/packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +17 -0
  444. package/examples/oidc-login/.aug-spec/packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +125 -0
  445. package/examples/oidc-login/.aug-spec/{august/0.19.0/crypto → packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40}/contracts.aug +12 -11
  446. package/examples/oidc-login/.aug-spec/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/contracts.aug.md +244 -0
  447. package/examples/oidc-login/.aug-spec/{august/0.19.0/crypto → packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40}/jose.aug +6 -5
  448. package/examples/oidc-login/.aug-spec/packages/@git/url_9ef654c66d34ab8f5527/0.0.0-git.b14a0f9aa41f1ce58bd51133bcdc424033e40d40/jose.aug.md +71 -0
  449. package/examples/oidc-login/.aug-spec/packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301/contracts.aug.md +30 -0
  450. package/examples/oidc-login/aug.lock.json +100 -0
  451. package/examples/oidc-login/client/contracts.aug +1 -0
  452. package/examples/oidc-login/client/contracts.aug.md +9 -66
  453. package/examples/oidc-login/client/endpoints.aug +6 -5
  454. package/examples/oidc-login/client/endpoints.aug.md +13 -145
  455. package/examples/oidc-login/client/export.aug +1 -0
  456. package/examples/oidc-login/client/export.aug.md +4 -24
  457. package/examples/oidc-login/client/login.aug +7 -6
  458. package/examples/oidc-login/client/login.aug.md +25 -303
  459. package/examples/oidc-login/client/logout.aug +5 -4
  460. package/examples/oidc-login/client/logout.aug.md +13 -135
  461. package/examples/oidc-login/client/protocol.aug +7 -6
  462. package/examples/oidc-login/client/protocol.aug.md +36 -283
  463. package/examples/oidc-login/client/session.aug +5 -4
  464. package/examples/oidc-login/client/session.aug.md +12 -139
  465. package/examples/oidc-login/client/views.aug +3 -2
  466. package/examples/oidc-login/client/views.aug.md +8 -57
  467. package/examples/oidc-login/common/export.aug +1 -0
  468. package/examples/oidc-login/common/export.aug.md +5 -27
  469. package/examples/oidc-login/common/headers.aug +4 -3
  470. package/examples/oidc-login/common/headers.aug.md +9 -67
  471. package/examples/oidc-login/common/keys.aug +6 -5
  472. package/examples/oidc-login/common/keys.aug.md +29 -165
  473. package/examples/oidc-login/common/settings.aug +2 -1
  474. package/examples/oidc-login/common/settings.aug.md +5 -39
  475. package/examples/oidc-login/common/views.aug +2 -1
  476. package/examples/oidc-login/common/views.aug.md +4 -28
  477. package/examples/oidc-login/main.aug +6 -16
  478. package/examples/oidc-login/main.aug.md +17 -146
  479. package/examples/oidc-login/main.yaml +7 -0
  480. package/examples/oidc-login/provider/authorization.aug +7 -6
  481. package/examples/oidc-login/provider/authorization.aug.md +23 -238
  482. package/examples/oidc-login/provider/contracts.aug +1 -0
  483. package/examples/oidc-login/provider/contracts.aug.md +23 -158
  484. package/examples/oidc-login/provider/credentials.aug +3 -2
  485. package/examples/oidc-login/provider/credentials.aug.md +9 -53
  486. package/examples/oidc-login/provider/discovery.aug +4 -3
  487. package/examples/oidc-login/provider/discovery.aug.md +11 -118
  488. package/examples/oidc-login/provider/export.aug +1 -0
  489. package/examples/oidc-login/provider/export.aug.md +6 -34
  490. package/examples/oidc-login/provider/token.aug +6 -5
  491. package/examples/oidc-login/provider/token.aug.md +16 -204
  492. package/examples/oidc-login/provider/userinfo.aug +4 -3
  493. package/examples/oidc-login/provider/userinfo.aug.md +10 -92
  494. package/examples/oidc-login/provider/views.aug +3 -2
  495. package/examples/oidc-login/provider/views.aug.md +8 -52
  496. package/examples/ownership/.aug-spec/manifest.json +1 -1
  497. package/examples/ownership/counter.aug +3 -2
  498. package/examples/ownership/counter.aug.md +12 -66
  499. package/examples/ownership/main.aug +1 -0
  500. package/examples/ownership/main.aug.md +6 -31
  501. package/examples/ownership-transfer/.aug-spec/august/0.21.0/io/contracts.aug +37 -0
  502. package/examples/ownership-transfer/.aug-spec/august/0.21.0/io/contracts.aug.md +82 -0
  503. package/examples/ownership-transfer/.aug-spec/manifest.json +3 -3
  504. package/examples/ownership-transfer/main.aug +1 -0
  505. package/examples/ownership-transfer/main.aug.md +9 -53
  506. package/examples/ownership-transfer/resource.aug +2 -1
  507. package/examples/ownership-transfer/resource.aug.md +12 -71
  508. package/examples/packages/app/.aug-spec/manifest.json +1 -1
  509. package/examples/packages/app/.aug-spec/packages/@example/aug-math/0.1.0/arithmetic.aug +2 -1
  510. package/examples/packages/app/.aug-spec/packages/@example/aug-math/0.1.0/arithmetic.aug.md +9 -51
  511. package/examples/packages/app/main.aug +1 -0
  512. package/examples/packages/app/main.aug.md +6 -26
  513. package/examples/packages/math/.aug-spec/manifest.json +1 -1
  514. package/examples/packages/math/aug-package.json +1 -1
  515. package/examples/packages/math/src/arithmetic.aug +2 -1
  516. package/examples/packages/math/src/arithmetic.aug.md +9 -51
  517. package/examples/packages/math/src/export.aug +1 -0
  518. package/examples/packages/math/src/export.aug.md +3 -13
  519. package/examples/visibility/.aug-spec/manifest.json +1 -1
  520. package/examples/visibility/counter.aug +4 -3
  521. package/examples/visibility/counter.aug.md +12 -68
  522. package/examples/visibility/main.aug +1 -0
  523. package/examples/visibility/main.aug.md +6 -32
  524. package/examples/weather-api/.aug-spec/manifest.json +8 -0
  525. package/examples/weather-api/AGENTS.md +17 -0
  526. package/examples/weather-api/README.md +19 -0
  527. package/examples/weather-api/forecasts.aug +47 -0
  528. package/examples/weather-api/forecasts.aug.md +32 -0
  529. package/examples/weather-api/main.aug +4 -0
  530. package/examples/weather-api/main.aug.md +15 -0
  531. package/examples/weather-api/main.yaml +5 -0
  532. package/examples/weather-api/weather.http +5 -0
  533. package/native/compiler-packs.json +43 -0
  534. package/package.json +4 -4
  535. package/runtime/aug_http.c +48 -21
  536. package/runtime/aug_http_ir.c +30 -0
  537. package/runtime/aug_http_ir.h +18 -0
  538. package/runtime/aug_ir.c +209 -0
  539. package/runtime/aug_ir.h +89 -0
  540. package/runtime/aug_json.c +6 -1
  541. package/runtime/aug_runtime.c +82 -16
  542. package/runtime/aug_runtime.h +16 -2
  543. package/runtime/aug_tasks.c +38 -7
  544. package/runtime/aug_values.c +12 -6
  545. package/scripts/bootstrap-native.mjs +184 -106
  546. package/scripts/native-setup.mjs +98 -0
  547. package/scripts/native-toolchain.mjs +28 -0
  548. package/src/ast.js +1 -1
  549. package/src/builtins.js +1 -1
  550. package/src/checker.js +369 -100
  551. package/src/cli.js +198 -26
  552. package/src/codegen.js +32 -7
  553. package/src/compiler-packs.js +66 -0
  554. package/src/config.js +3 -3
  555. package/src/contracts.js +10 -0
  556. package/src/editor.js +86 -22
  557. package/src/fixes.js +90 -2
  558. package/src/formatter.js +23 -10
  559. package/src/git-http.js +137 -0
  560. package/src/git-packages.js +118 -0
  561. package/src/help.js +33 -24
  562. package/src/http-contracts.js +14 -0
  563. package/src/http-policies.js +5 -5
  564. package/src/ir-types.js +5 -0
  565. package/src/ir-verify.js +277 -0
  566. package/src/ir.js +962 -0
  567. package/src/libraries.js +1 -1
  568. package/src/llvm-debug.js +101 -0
  569. package/src/llvm-native.js +152 -0
  570. package/src/llvm-platform.js +20 -0
  571. package/src/llvm.js +781 -0
  572. package/src/lsp.js +14 -5
  573. package/src/native-artifacts.js +207 -0
  574. package/src/native-bindings.js +189 -0
  575. package/src/native-contracts.js +295 -0
  576. package/src/native-declarations.js +68 -0
  577. package/src/native-facts.js +63 -0
  578. package/src/native.js +19 -13
  579. package/src/navigation.js +4 -2
  580. package/src/openapi.js +5 -4
  581. package/src/package-locking.js +88 -0
  582. package/src/package-manager.js +267 -68
  583. package/src/parser.js +32 -6
  584. package/src/policies.js +3 -3
  585. package/src/project-init.js +78 -4
  586. package/src/project.js +11 -9
  587. package/src/runtime-abi.js +23 -0
  588. package/src/runtime-adapters.js +18 -0
  589. package/src/schemas.js +24 -17
  590. package/src/semantic.js +54 -5
  591. package/src/snippets.js +60 -0
  592. package/src/spec-hints.js +56 -0
  593. package/src/spec-tree.js +241 -0
  594. package/src/spec.js +669 -305
  595. package/docs/examples/approved-design/dependencies/august/0.19.0/io/contracts.md +0 -395
  596. package/docs/examples/developer-workflow/dependencies/august/0.19.0/io/contracts.md +0 -395
  597. package/docs/examples/generic-di/dependencies/august/0.19.0/io/contracts.md +0 -395
  598. package/docs/examples/hello/dependencies/august/0.19.0/io/contracts.md +0 -395
  599. package/docs/examples/interceptors/dependencies/august/0.19.0/io/contracts.md +0 -395
  600. package/docs/examples/json-benchmark/dependencies/august/0.19.0/json/contracts.md +0 -103
  601. package/docs/examples/new-syntax/dependencies/august/0.19.0/io/contracts.md +0 -395
  602. package/docs/examples/oidc-login/dependencies/august/0.19.0/crypto/contracts.md +0 -925
  603. package/docs/examples/oidc-login/dependencies/august/0.19.0/crypto/jose.md +0 -434
  604. package/docs/examples/oidc-login/dependencies/august/0.19.0/json/contracts.md +0 -103
  605. package/docs/examples/oidc-login/dependencies/august/0.19.0/memory/store.md +0 -374
  606. package/docs/examples/oidc-login/dependencies/august/0.19.0/time/contracts.md +0 -150
  607. package/docs/examples/oidc-login/dependencies/august/0.19.0/web/contracts.md +0 -532
  608. package/docs/examples/ownership-transfer/dependencies/august/0.19.0/io/contracts.md +0 -395
  609. package/examples/approved-design/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
  610. package/examples/developer-workflow/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
  611. package/examples/generic-di/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
  612. package/examples/hello/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
  613. package/examples/interceptors/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
  614. package/examples/interceptors/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
  615. package/examples/new-syntax/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
  616. package/examples/new-syntax/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
  617. package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/contracts.aug.md +0 -791
  618. package/examples/oidc-login/.aug-spec/august/0.19.0/crypto/jose.aug.md +0 -266
  619. package/examples/oidc-login/.aug-spec/august/0.19.0/json/contracts.aug.md +0 -55
  620. package/examples/oidc-login/.aug-spec/august/0.19.0/memory/store.aug.md +0 -250
  621. package/examples/oidc-login/.aug-spec/august/0.19.0/time/contracts.aug.md +0 -96
  622. package/examples/oidc-login/.aug-spec/august/0.19.0/web/contracts.aug.md +0 -420
  623. package/examples/ownership-transfer/.aug-spec/august/0.19.0/io/contracts.aug +0 -36
  624. package/examples/ownership-transfer/.aug-spec/august/0.19.0/io/contracts.aug.md +0 -316
  625. /package/examples/oidc-login/.aug-spec/{august/0.19.0/memory → packages/@git/url_0eb7c89453c87681ed15/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/store.aug +0 -0
  626. /package/examples/oidc-login/.aug-spec/{august/0.19.0/json → packages/@git/url_2d3c37c690c0fa115be1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
  627. /package/examples/oidc-login/.aug-spec/{august/0.19.0/web → packages/@git/url_897efafd565158fc4908/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
  628. /package/examples/oidc-login/.aug-spec/{august/0.19.0/time → packages/@git/url_c092cd151499c4e1d8a1/0.0.0-git.a39fc582565d4fca40be4f75fa304d71adc69301}/contracts.aug +0 -0
@@ -0,0 +1,118 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
3
+ import { homedir } from 'node:os';
4
+ import { dirname, join, resolve } from 'node:path';
5
+ import { spawnSync } from 'node:child_process';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { withPackageLock } from "./package-locking.js";
8
+ export const isGitSource = (value) => /^(?:https:\/\/|git\+(?:https|file):\/\/)/.test(value);
9
+ export const sourceAlias = (value) => 'url_' + createHash('sha256').update(value).digest('hex').slice(0, 20);
10
+ export const importSource = (parts) => (isGitSource(parts[0]) ? JSON.stringify(parts[0]) : parts[0]) + parts.slice(1).map(part => '.' + part).join('');
11
+ /** A repository URL can select a tag and, on GitHub, a folder within the repository. */
12
+ export function gitReference(request) {
13
+ try {
14
+ if (decodeURIComponent(request.split('#')[0]).split(/[\\/]/).some(part => part === '.' || part === '..'))
15
+ throw new Error('Repository URLs cannot contain path traversal.');
16
+ }
17
+ catch {
18
+ throw new Error('Invalid repository URL or path traversal.');
19
+ }
20
+ let url;
21
+ try {
22
+ url = new URL(request.replace(/^git\+/, ''));
23
+ }
24
+ catch {
25
+ throw new Error(`Invalid package repository URL: ${request}`);
26
+ }
27
+ if (!['https:', 'file:'].includes(url.protocol) || url.username || url.password || url.search ||
28
+ url.protocol === 'file:' && !request.startsWith('git+file:'))
29
+ throw new Error('Use a public HTTPS repository URL without credentials, or git+file:///PATH for a local Git repository.');
30
+ const revision = decodeURIComponent(url.hash.slice(1)) || 'HEAD';
31
+ url.hash = '';
32
+ let folder = '', ref = revision;
33
+ if (url.hostname === 'github.com') {
34
+ const parts = url.pathname.split('/').filter(Boolean).map(decodeURIComponent);
35
+ if (parts.length < 2)
36
+ throw new Error('A GitHub package URL needs an owner and repository.');
37
+ if (parts[2] === 'tree') {
38
+ if (!parts[3] || revision !== 'HEAD')
39
+ throw new Error('Choose the revision with /tree/TAG/FOLDER or #TAG, not both.');
40
+ ref = parts[3];
41
+ folder = parts.slice(4).join('/');
42
+ }
43
+ else
44
+ folder = parts.slice(2).join('/');
45
+ url.pathname = '/' + parts.slice(0, 2).join('/').replace(/\.git$/, '') + '.git';
46
+ }
47
+ if (!/^[A-Za-z0-9][A-Za-z0-9._/+-]*$/.test(ref) || ref.includes('..') || ref.endsWith('/'))
48
+ throw new Error('Package revision must be a commit, tag, or branch name.');
49
+ if (folder.split('/').some(part => part === '..' || part === '.' || part.startsWith('_')) || folder.includes('\\'))
50
+ throw new Error('Package folders must stay inside the repository and cannot be private.');
51
+ return { request, repository: url.href, revision: ref, folder };
52
+ }
53
+ function git(args, cwd) {
54
+ const result = spawnSync(process.env.AUG_GIT ?? 'git', ['-c', 'core.hooksPath=/dev/null', ...args], {
55
+ cwd, timeout: 120000, maxBuffer: 32 * 1024 * 1024, env: { ...process.env, GIT_TERMINAL_PROMPT: '0' }
56
+ });
57
+ if (result.error)
58
+ throw new Error(`Cannot read a Git package: ${result.error.message}. Install Git or set AUG_GIT to its executable.`);
59
+ if (result.status !== 0)
60
+ throw new Error(`Cannot read a Git package: ${result.stderr.toString().trim()}. Check the repository URL and revision; private repositories are outside this workflow.`);
61
+ return result.stdout;
62
+ }
63
+ /** Read source blobs without checking out files, executing hooks, or following repository symlinks. */
64
+ export function materializeGit(request, destination, offline, locked) {
65
+ const reference = gitReference(request);
66
+ if (locked && (locked.repository !== reference.repository || locked.folder !== reference.folder || locked.revision !== reference.revision ||
67
+ !/^[a-f0-9]{40,64}$/.test(locked.commit)))
68
+ throw new Error('Git package lock has an invalid repository, folder, or commit.');
69
+ if (new URL(reference.repository).hostname === 'github.com' && !process.env.AUG_GIT) {
70
+ const transport = new URL(import.meta.url.endsWith('.ts') ? './git-http.ts' : './git-http.js', import.meta.url);
71
+ const result = spawnSync(process.execPath, [fileURLToPath(transport), '--materialize', JSON.stringify({ request, destination, offline, locked })], { encoding: 'utf8', timeout: 180000, maxBuffer: 4 * 1024 * 1024 });
72
+ if (result.status !== 0)
73
+ throw new Error(result.stderr.trim() || result.error?.message || 'GitHub source installation failed');
74
+ return JSON.parse(result.stdout);
75
+ }
76
+ const cache = resolve(process.env.AUG_PACKAGE_CACHE ?? join(homedir(), '.cache', 'augscript', 'packages'));
77
+ const repository = join(cache, sourceAlias(reference.repository));
78
+ mkdirSync(cache, { recursive: true });
79
+ return withPackageLock(repository + '.lock', () => {
80
+ if (!existsSync(repository)) {
81
+ if (offline)
82
+ throw new Error(`Git package is not cached: ${request}. Run aug run online once before using --offline.`);
83
+ git(['init', '--bare', repository]);
84
+ }
85
+ let commit = locked?.commit;
86
+ const objectExists = commit && spawnSync(process.env.AUG_GIT ?? 'git', ['--git-dir', repository, 'cat-file', '-e', commit + '^{commit}']).status === 0;
87
+ if (!objectExists) {
88
+ if (offline)
89
+ throw new Error(`Git revision is not cached: ${commit ?? request}. Restore the package cache or run aug run online.`);
90
+ git(['--git-dir', repository, 'fetch', '--no-tags', '--depth=1', '--', reference.repository, commit ?? reference.revision]);
91
+ commit = git(['--git-dir', repository, 'rev-parse', 'FETCH_HEAD^{commit}']).toString().trim();
92
+ }
93
+ const result = { ...reference, commit: commit };
94
+ const prefix = reference.folder ? reference.folder + '/' : '';
95
+ const listing = git(['--git-dir', repository, 'ls-tree', '-rz', '--full-tree', result.commit, '--', prefix || '.']).toString();
96
+ let bytes = 0, count = 0;
97
+ for (const entry of listing.split('\0').filter(Boolean)) {
98
+ const match = /^(\d+) blob ([a-f0-9]+)\t([\s\S]+)$/.exec(entry);
99
+ if (!match || !match[3].startsWith(prefix))
100
+ continue;
101
+ const file = match[3].slice(prefix.length);
102
+ if (!file.endsWith('.aug') && !['aug-package.json', 'package.json', 'main.yaml', 'README.md', 'LICENSE', 'native.abi.json', 'THIRD_PARTY_NOTICES.md'].includes(file))
103
+ continue;
104
+ if (!['100644', '100755'].includes(match[1]) || file.includes('\\') || file.split('/').some(part => !part || part === '..' || part.startsWith('.')))
105
+ throw new Error(`Git package source must be regular files inside its folder: ${file}`);
106
+ const contents = git(['--git-dir', repository, 'cat-file', 'blob', match[2]]);
107
+ bytes += contents.length;
108
+ if (++count > 10000 || bytes > 32 * 1024 * 1024)
109
+ throw new Error('Git source package exceeds 10,000 files or 32 MiB.');
110
+ const path = join(destination, file);
111
+ mkdirSync(dirname(path), { recursive: true });
112
+ writeFileSync(path, contents);
113
+ }
114
+ if (!count)
115
+ throw new Error(`No August source at ${request}. Choose the folder containing export.aug or aug-package.json.`);
116
+ return result;
117
+ });
118
+ }
package/src/help.js CHANGED
@@ -4,9 +4,10 @@ const type = (detail, documentation) => ({ detail, documentation, category: 'typ
4
4
  const fn = (detail, documentation) => ({ detail, documentation, category: 'function' });
5
5
  const operator = (detail, documentation) => ({ detail, documentation, category: 'operator' });
6
6
  export const languageHelp = {
7
- RequireLogin: { category: 'tag', detail: '[RequireLogin(authentication=auth)]', documentation: 'Verify credentials before typed body decoding. Map auth to an explicit resolve Authentication parameter and declare uses auth.authenticate. null produces 401; the adapter validates the credential. HTTP policies precede custom parameter interceptors.' },
7
+ resource: keyword('extern C resource Tensor', 'Declare an opaque native object with a descriptor-checked release operation. Store acquired objects in own bindings; their scope releases them exactly once. Resource declarations belong to native packages, outside main.aug.'),
8
+ RequireLogin: { category: 'tag', detail: '[RequireLogin(authentication=auth)]', documentation: 'Verify credentials before typed body decoding. Map auth to an explicit resolve Authentication parameter and infer its authenticate operation. null produces 401; the adapter validates the credential. HTTP policies precede custom parameter interceptors.' },
8
9
  RequirePermission: { category: 'tag', detail: '[RequirePermission(authentication=auth, authorization=permissions, permission="users.read")]', documentation: 'Authenticate the request and authorize one literal permission before decoding. Both dependencies are explicit resolve parameters; declare their authenticate and authorize effects. Missing credentials produce 401 and a denied permission produces 403.' },
9
- LogRequest: { category: 'tag', detail: '[LogRequest(logger=logger)]', documentation: 'Map a resolve RequestLogger parameter and declare uses logger.complete. Observe the final status and monotonic duration after output finishes, or status 499 on disconnect. Layers complete in reverse written order.' },
10
+ LogRequest: { category: 'tag', detail: '[LogRequest(logger=logger)]', documentation: 'Map a resolve RequestLogger parameter and infer its complete operation. Observe the final status and monotonic duration after output finishes, or status 499 on disconnect. Layers complete in reverse written order.' },
10
11
  RateLimit: { category: 'tag', detail: '[RateLimit(requests=100, seconds=60)]', documentation: 'A bounded per-endpoint, per-peer fixed-window request limit. Uses the transport peer address, never an untrusted forwarding header. Rejected requests return 429 before body decoding. The table has 2048 entries and rejects new identities when full.' },
11
12
  Timeout: { category: 'tag', detail: '[Timeout(milliseconds=5000)]', documentation: 'Bound the request and its streaming producer with a monotonic deadline. Before output, return 504. After headers, terminate the stream. Cancellation joins children and runs always cleanup; native C operations finish before cancellation can be observed.' },
12
13
  Cors: { category: 'tag', detail: '[Cors(origins=["https://example.test"], headers=["content-type"], credentials=true)]', documentation: 'Allow exact literal HTTP(S) origins and explicit request header names. OPTIONS preflight checks the selected method and headers. Wildcard origins cannot use credentials. Valid responses include CORS and Vary headers; disallowed origins return 403.' },
@@ -38,15 +39,15 @@ export const languageHelp = {
38
39
  Task: type('Task<T>', 'A child computation owned by a scope. wait for reads its result; the scope joins children before releasing dependencies.'),
39
40
  Shared: type('Shared<T>', 'Synchronized mutable state. Construction takes a fresh or owned value. Read and mutate the value only through lock shared as state. A child borrowing an owned Shared<T> pins the wrapper until it finishes; the parent cannot move it into another owner while the child uses it.'),
40
41
  Bytes: type('Bytes', 'Immutable length-aware binary data. text() validates UTF-8; base64url() emits canonical unpadded URL-safe base64.'),
41
- Json: type('Json', 'Immutable JSON data. Parse with august.json, decode concrete records with decode<T>(), and stringify with lossless integer handling.'),
42
+ Json: type('Json', 'Immutable JSON data. Import parse from the JSON source package, decode concrete records with decode<T>(), and stringify with lossless integer handling.'),
42
43
  Html: type('Html', 'Checked server markup produced with JSX elements and components. Interpolated text and attributes are escaped automatically.'),
43
44
  HttpAction: type('HttpAction', 'An immutable deferred HTTP call created with handle endpoint(...). Bind it to a form onSubmit or button onClick. The browser sends the request; endpoint dependencies and application logic run on the server.'),
44
45
  ServerEvent: type('ServerEvent<T>', 'One SSE event containing concrete JSON data, plus optional id, event, and retry milliseconds. CR, LF and NUL are rejected in metadata. The endpoint streams ServerEvent<T> and yields each event under transport backpressure.'),
45
46
  Headers: type('Headers', 'Immutable HTTP fields. with adds a checked field; get and all read case-insensitively. Duplicate Set-Cookie values remain separate.'),
46
47
  HttpRequest: type('HttpRequest', 'A request supplied through from request. Its method, path, headers and bounded body are explicit. form<T>() allows protocol-specific form errors.'),
47
48
  HttpResponse: type('HttpResponse<T>', 'A typed HTTP body with explicit status and headers. HttpResponse(body=value, status=201, headers=headers) constructs a response. Status literals range from 200 to 599; a dynamic status requires handling or declaring HttpError.'),
48
- record: keyword('record Point(int x, int y)', 'Declare deeply immutable data with labeled construction and structural equality/hashing. Records contain primitives, tuples and other records. An initialize block validates inputs; declare rejected inputs with unless ErrorType.'),
49
- initialize: keyword('initialize: ...', 'Run constructor work once after header inputs and local fields are initialized, before returning the class or record. Put this block inside the declaration, before class methods. Construction stays pure. Records can validate inputs and raise declared unless errors, but cannot replace immutable fields.'),
49
+ record: keyword('record Point(int x, int y)', 'Declare deeply immutable data with labeled construction and structural equality/hashing. Records contain primitives, tuples and other records. An initialize block validates inputs; validation infers rejected inputs; an explicit unless ErrorType limits permitted failures.'),
50
+ initialize: keyword('initialize: ...', 'Run constructor work once after header inputs and local fields are initialized, before returning the class or record. Put this block inside the declaration, before class methods. Construction stays pure. Classes declare checked constructor failures with unless before implements; failed construction releases transferred owned fields. Records can infer validation failures but cannot replace immutable fields.'),
50
51
  fixture: keyword('fixture example() returns Data: ...', 'Declare reusable test data through an ordinary checked function. Other files must import the fixture explicitly. Its dependencies and capabilities follow the same header contract rules as other functions.'),
51
52
  for: keyword('for item in items: ...', 'Traverse a List, Set, homogeneous Tuple, or Map. Map entries are tuples, so for (key, value) in map unpacks them. Iteration snapshots the collection in insertion order and gives elements read-only access.'),
52
53
  match: keyword('match value: when ...', 'Choose a checked case. Cover true and false for bool, null and some for nullable values, or add else. Concrete class cases narrow the named value. Duplicate and unreachable cases are rejected.'),
@@ -57,14 +58,14 @@ export const languageHelp = {
57
58
  scope: keyword('scope: ...', 'Create a local DI and child-task lifetime. Children join before dependencies are reclaimed; unhandled failures cancel siblings. Scoped references cannot escape. Nested scopes have independent caches.'),
58
59
  composition: keyword('composition Services: implement Logger with Adapter', 'Group static bindings behind an explicitly imported module declaration. Include the composition in main before executable statements; its own file must import every referenced contract and implementation.'),
59
60
  include: keyword('include Services', 'Expand an explicitly imported composition into the application root. Duplicate bindings and dependency cycles are checked after all includes are collected.'),
60
- IndexError: type('IndexError implements Error', 'Checked failure for an invalid List.get position. Catch it, declare unless IndexError, or use List.at for a nullable lookup.'),
61
+ IndexError: type('IndexError implements Error', 'Checked failure for an invalid List.get position. Catch it or let it propagate. List.at returns a value or null instead.'),
61
62
  ArithmeticError: type('ArithmeticError implements Error', 'Checked failure for division by zero. int arithmetic otherwise wraps in the signed 64-bit range.'),
62
- ConversionError: type('ConversionError implements Error', 'Checked failure when c_int(value=number) cannot fit the signed 32-bit C int range. Catch it or declare unless ConversionError.'),
63
+ ConversionError: type('ConversionError implements Error', 'Checked failure when c_int(value=number) cannot fit the signed 32-bit C int range. Catch it or let it propagate.'),
63
64
  c_int: type('c_int', 'Signed 32-bit C int. Convert explicitly with c_int(value=number), which raises ConversionError on overflow. It widens to int without loss. AugScript int maps to int64_t at the C boundary.'),
64
65
  interceptor: keyword('interceptor Name<T>(resolve Dependency dependency) { around(...) returns T { ... } }', 'Declare a reusable wrapper for functions, methods, or class construction. Apply it with `[Name]` or `[Name(y=x)]`. Inputs match target labels automatically; explicit mappings rename them. Tags enter in written order and results unwind in reverse. Each layer creates a fresh instance; dependencies are forwarded from the target header. Effective contracts include every layer\u2019s changes, capabilities, errors, and dependencies. Generic types are inferred from the target. Interceptors follow normal imports, exports, and underscore privacy.'),
65
- around: fn('around(Type input) returns Type { return next(); }', 'The required entry point of an interceptor. Its parameters select target arguments, and its result must fit the target return type. Omit `returns` for void. It may validate, override mapped arguments, inspect the result, throw a checked error, or return early. Declare generic parameters on the interceptor header. Helper methods can be declared alongside around.'),
66
+ around: fn('around(Type input) returns Type { return next(); }', 'The required entry point of an interceptor. Its parameters select target arguments, and its result must fit the target return type. A forwarding body can omit returns and inherit the target result. It may validate, override mapped arguments, inspect the result, throw a checked error, or return early. Declare generic parameters on the interceptor header. Helper methods can be declared alongside around.'),
66
67
  next: fn('next(mappedLabel=value) returns TargetResult', 'Continue to the next interceptor layer or the original function/constructor. Available only inside an interceptor around body. `next()` forwards original arguments unchanged; optional labeled overrides use the interceptor parameter names and map back to the target. Unselected arguments are forwarded automatically. The compiler requires at most one next call on each execution path. Target errors propagate through the chain; additional errors declared by around become checked errors of the tagged callable.'),
67
- import: keyword('import Logger and ConsoleLogger from logging', 'Bring public declarations into this file. Use `and` for several names, or `import everything from logging` for all public sibling declarations or folder exports. Imported dependencies are never re-exported implicitly. Names or modules starting with `_` stay private. A sibling module uses its filename without `.aug`; a folder exposes only names listed in `export.aug`.'),
68
+ import: keyword('import Logger and ConsoleLogger from logging', 'Bring public declarations into this file. Use `and` for several names, or `import everything from logging` for all public sibling declarations or folder exports. Imported dependencies are never re-exported implicitly. Names or modules starting with `_` stay private. A sibling module uses its filename without `.aug`; a folder exposes only names listed in `export.aug`. A quoted public repository URL declares a source dependency; `aug run` installs it and locks its commit. Use `aug add URL --as NAME` for a shorter import alias.'),
68
69
  and: keyword('left and right', 'Logical AND on bool values. Skip the right operand when the left operand is false. Also join named imports, checked errors, contracts, and grouped task waits. Comparisons and not bind before and; and binds before or.'),
69
70
  or: keyword('left or right', 'Logical OR on bool values. Skip the right operand when the left operand is true. This is the lowest-precedence boolean operator. Symbolic || is rejected.'),
70
71
  not: keyword('not count == 0', 'Negate a bool expression. Comparisons bind before not, so not count == 0 means not (count == 0). not binds before and and or. Use parentheses to negate only one comparison operand. Symbolic ! is rejected; != remains inequality.'),
@@ -75,10 +76,10 @@ export const languageHelp = {
75
76
  pass: keyword('pass', 'An empty body. Use it inside an indented interface, class, function, or statement block. It performs no operation. Empty braced blocks may use {} instead.'),
76
77
  in: keyword('interface Consumer<in T>', 'Declare a contravariant interface type parameter. It may occur only in checked input positions. User-defined types are otherwise invariant. The same word is used by for iteration.'),
77
78
  out: keyword('interface Producer<out T>', 'Declare a covariant interface type parameter. It may occur only in checked output positions. Mutable containers are invariant; classes and interceptors cannot declare variance.'),
78
- changes: keyword('increment() changes self', 'Declare observable mutation of self or a borrowed input. Callers must provide mutable access. Ordinary functions and methods are pure by default; changing a local variable or a fresh local object does not change caller-owned state.'),
79
- uses: keyword('save(resolve FileWriter files, string path) uses files.write unless FileError', 'Declare the external capability operations this callable may use. Interfaces, public standalone functions, default methods and interceptor around methods keep explicit contracts. Class implementations and private helpers infer uses when omitted; hover, explain and API docs show the result. An explicit uses clause remains an upper bound. Effects are checked through calls and interceptor layers; implementations cannot exceed their interface contract. changes and unless remain explicit, and construction stays pure.'),
80
- mutable: keyword('Counter(mutable int initial to _count)', 'Declare mutable class storage. Header fields are otherwise read-only after construction. An explicit public argument label can initialize private storage with Type label to _field. Mutating methods declare changes self and callers provide mutable access.'),
81
- capability: keyword('capability Console { write(string value) uses Console.write }', 'Declare an interface for an external effect. Import the standard Console, FileReader, FileWriter and Arguments contracts from august.io, select adapters in main, and receive them through resolve parameters. Operations remain visible in uses clauses and can be replaced in tests.'),
79
+ changes: keyword('increment() changes self', 'Describe observable mutation of self or a borrowed input. Bodies infer changes when omitted; callers still need mutable access. Bodyless interface contracts declare permitted mutation. Local variables and fresh local objects do not change caller-owned state. An explicit clause limits the body.'),
80
+ uses: keyword('save(resolve FileWriter files, string path)', 'Bodies infer external capability operations when uses is omitted, including public functions, default methods and interceptor around methods. The editor shows non-editable inline hints; hover, explain, API docs and compiled specs expose checked contracts. Bodyless interfaces and extern declarations keep explicit contracts. An explicit uses clause remains an upper bound. Implementations cannot exceed their interface contract; construction and cleanup stay pure.'),
81
+ mutable: keyword('Counter(mutable int initial to _count)', 'Declare mutable class storage. Header fields are otherwise read-only after construction. An explicit public argument label can initialize private storage with Type label to _field. Bodies infer changes self; callers provide mutable access.'),
82
+ capability: keyword('capability Console { write(string value) uses Console.write }', 'Declare an interface for an external effect. Import the standard Console, FileReader, FileWriter and Arguments contracts from august.io, select adapters in main, and receive them through resolve parameters. Operations stay visible in inferred hints, hover and specs and can be replaced in tests.'),
82
83
  from: keyword('import Name from module;', 'Names the source of an import or export. Dotted paths cross folders; each crossed folder must expose the next one with `export folder child;`. A module starting with `_` is private.'),
83
84
  export: keyword('export Name from sibling;', 'Expose a public sibling declaration to other folders. Names, modules, and folders starting with `_` are private and cannot be exported. Export declarations belong only in `export.aug`.\n\n```aug\nexport Logger from logger;\n```'),
84
85
  folder: keyword('export folder child;', 'Expose a public child folder through the current folder’s `export.aug`. A folder starting with `_` cannot be exported.'),
@@ -91,12 +92,12 @@ export const languageHelp = {
91
92
  interface: keyword('interface Name extends Parent { ... }', 'Declare a contract. Interfaces may extend several interfaces and may provide default method bodies. A class must implement every method without a default. Method signatures start with their name, for example `log(string message);`.'),
92
93
  implements: keyword('Name() implements Interface { ... }', 'Marks a declaration as a class and lists the interfaces it satisfies. Every class needs at least one interface. Method signatures must match. Conflicting default implementations require an override. Put constructor work in an initialize block inside the class.'),
93
94
  extends: keyword('interface Child extends Parent, Other { ... }', 'Inherit methods from one or more interfaces. Class inheritance is not supported.'),
94
- function: keyword('No function keyword', 'Functions and methods start with their name: `greet(string name) { ... }` or `greet(string name) returns string;`. Remove the old `function` prefix. Parameters use `Type name` order and callers use labels. Omit `returns` for a `void` result.'),
95
- returns: keyword('name() returns Type', 'Specify a function or method return type. Without this clause, the result is `void`; the body may end without `return` or use `return;`. Returning a value requires a declared return type. `returns own Type` transfers ownership to the caller.'),
95
+ function: keyword('No function keyword', 'Functions and methods start with their name: greet(string name) { ... }. Remove the old function prefix. Parameters use Type name order and callers use labels. Bodies infer omitted returns, changes, uses and unless clauses; declarations without a body keep explicit contracts.'),
96
+ returns: keyword('name() returns Type', 'Bodies infer their result from return expressions or their implemented interface when this clause is omitted. No returned value means void. Bodyless signatures still need non-void result types. Explicit result types are checked assertions; returns own Type explicitly transfers ownership. Recursive or ambiguous results may require a type anchor.'),
96
97
  return: keyword('return expression;', 'Finish the current function or method and give its result to the caller. A `void` function can use `return;`.'),
97
- unless: keyword('load(bool fail) returns string unless FileError', 'Declare checked failures a function may raise instead of returning its result. Callers must catch the failures or declare them with unless too. Separate several types with `and` or commas; `unless Error` accepts any error type. The statement that raises an error remains `throw`.'),
98
+ unless: keyword('load(bool fail) unless FileError', 'Describe checked failures that escape a call. Bodies infer uncaught errors when unless is omitted; catch blocks remove handled errors. Main must handle escaping errors. Bodyless interfaces declare permitted failures. Explicit unless remains an upper bound; unless Error accepts any error type. Record validation can infer its failures too.'),
98
99
  throws: keyword('Use unless', 'This old error-contract spelling is rejected. Replace `throws FileError` with `unless FileError`. Javadoc `@throws` remains supported.'),
99
- throw: keyword('throw error;', 'Raise a value whose class implements `Error`. The enclosing function must declare the error or the call must be handled by a matching `catch`.'),
100
+ throw: keyword('throw error;', 'Raise a value whose class implements `Error`. An executable body infers uncaught errors; main must handle them with a matching catch.'),
100
101
  try: keyword('try { ... } catch Error error { ... }', 'Run statements that may throw checked errors. Add a `catch` for each error, or use `catch Error` for any throwable error.'),
101
102
  catch: keyword('catch Error error { ... }', 'Handle a thrown error from the preceding `try` block. The caught value is available under the name after its type.'),
102
103
  if: keyword('if condition: ...', 'Run a block when its condition is bool. Use braces or a trailing colon and an indented body. Tabs or spaces are accepted; mixed indentation prefixes are rejected.'),
@@ -105,7 +106,7 @@ export const languageHelp = {
105
106
  own: keyword('own Type name to expression;', 'Give a value exclusive ownership and deterministic cleanup at scope exit. Owned values cannot be copied; they can move into `own` parameters, fields, or returns. `=` is also accepted.\n\n```aug\nown Resource resource to Resource();\n```'),
106
107
  borrow: keyword('borrow value { ... }', 'Take exclusive mutable access for the duration of this block. Ordinary reads need no borrow. Managed List, Set, and Map mutations require one. Starting a child that reads the value suspends this mutation right until wait for the child.\n\n```aug\nborrow items { items.append(value=1) }\n```'),
107
108
  unsafe: keyword('unsafe { ... }', 'Permit calls to declared `extern C` functions within this block. The compiler does not verify the safety of foreign code.'),
108
- extern: keyword('extern C name(Type arg) returns Type', 'Declare a C function. Calls require unsafe and external callables declare uses C.name. int maps to int64_t, c_int to signed 32-bit int, float to double, bool to C bool, and string to a temporary UTF-8 const char pointer. Foreign code must respect the declared ABI and cannot retain managed pointers.'),
109
+ extern: keyword('extern C name(Type arg) returns Type', 'Declare a C function. Calls require unsafe and executable callers infer uses C.name. int maps to int64_t, c_int to signed 32-bit int, float to double, bool to C bool, and string to a temporary UTF-8 const char pointer. Foreign code must respect the declared ABI and cannot retain managed pointers.'),
109
110
  C: keyword('extern C name(...);', 'Selects C as the foreign function interface for an `extern` declaration.'),
110
111
  true: keyword('true', 'Boolean true. Conditions and logical operators require `bool`.'),
111
112
  false: keyword('false', 'Boolean false. and and or evaluate the right side only when needed. Conditions require bool values.'),
@@ -116,7 +117,7 @@ export const languageHelp = {
116
117
  string: type('string', 'Immutable valid Unicode encoded as UTF-8, without embedded NUL. Invalid literals are compile errors and invalid text files raise FileError. The + operator joins strings. C string pointers live only for the unsafe call.'),
117
118
  void: type('void', 'No return value. A function can omit `returns void`.'),
118
119
  Error: type('Error', 'Root throwable interface. User defined error classes implement `Error`; `catch Error` handles any throwable type.'),
119
- FileError: type('FileError', 'Built in checked error from text file operations. Catch it or declare `unless FileError`.'),
120
+ FileError: type('FileError', 'Checked failure from text file operations. Catch it or let it propagate.'),
120
121
  List: type('List<T>', 'Ordered collection: `[1, 2]` infers List<int>. A typed declaration supplies empty or nested literal types: `List<int> numbers = []`. `List<T>(...)` also accepts positional elements. `append(value=...)` requires mutable access; `get(index=...)` reads; `length()` returns its size.'),
121
122
  Set: type('Set<T>', 'Hash set of unique values: `{1, 2, 1}` infers Set<int> with two items. Use `Set<int> numbers = {}` or `Set<int>()` for an empty set. `add(value=...)` requires mutable access; `contains(value=...)` and `length()` read. Primitive values and immutable tuples use value equality; other objects use identity.'),
122
123
  Tuple: type('Tuple<T1, T2, ...>', 'Fixed immutable positions: `(1, 2)` infers Tuple<int, int>, `(1, "apple")` infers Tuple<int, string>. `(1)` is grouping, `(1,)` is a singleton tuple, and `()` is empty. `get(index=0)` requires a constant index so its result type is known. `length()` reads its size. Tuples compare by their items; contained objects remain managed references.'),
@@ -169,10 +170,17 @@ for (const operation of builtinFunctions)
169
170
  languageHelp[operation.name] = fn(`${operation.name}(${operation.parameters.map(param => `${param.label}=${param.type}`).join(', ')}) returns ${operation.returns}` +
170
171
  (operation.errors?.length ? ` unless ${operation.errors.join(' and ')}` : ''), operation.documentation);
171
172
  export const diagnosticHelp = {
173
+ NATIVE_HEADER: 'The native maintainer header does not match its reviewed ownership descriptor. Check fixed-width types, pointer constness, outputs, release signatures and the error record layout. aug bind header uses an explicitly selected Clang only; package consumers do not need Clang. Header checks do not prove allocator pairing, retention or thread promises.',
174
+ NATIVE_ABI: 'Keep the August declarations and native.abi.json in the same package. Parameter labels, types, resource ownership, checked errors and effects must match. Different packages cannot supply the same physical native symbol.',
175
+ NATIVE_INTEGRITY: 'The source or native archive differs from its pinned digest. Reinstall the exact package version or ask its maintainer to publish a new version. Installation never runs package build scripts.',
176
+ NATIVE_TARGET: 'This native package has no compatible prebuilt artifact for your OS, architecture, libc version or C++ runtime. LLVM builds target macOS 14+ ARM64 and Debian/Ubuntu GNU/Linux x86-64 or ARM64 with glibc 2.36+. Linux artifacts must declare their glibc floor. Musl and cross compilation are unsupported. Use one of the listed targets; missing artifacts do not trigger a source build.',
177
+ NATIVE_LOCK: 'Run aug install to record the verified source and native target. Commit aug.lock.json. Frozen builds reject changed selections; offline builds require an already verified cache.',
178
+ BACKEND_UNSUPPORTED: 'LLVM cannot compile this construct or legacy link setting. Use package-declared native bindings and link inputs. An explicit --backend c can compile migration fixtures without native ABI packages and requires a C toolchain. No automatic backend fallback occurs.',
179
+ IR_INVALID: 'The compiler produced execution IR that failed structural or ABI verification before LLVM emission. Report this source location and the compiler version. Source typing and ownership checks still run before lowering.',
172
180
  SYNTAX: 'Use word boolean operators, initialize blocks, optional Type, implement with, and resolve Key to name. The editor migration fix or aug migrate --write upgrades rejected legacy spellings while preserving grouping.',
173
- NATIVE: 'The native C toolchain reported an error at this AugScript source location. Check the external C declaration, linker configuration, and generated .aug-build/program.c; debug builds retain source line mapping.',
181
+ NATIVE: 'The C compiler reported an error at this August location. Check the external C declaration and main.yaml libraries/library_paths. Native commands prepare required pinned libraries automatically. Missing system tools include installation help. If valid August code fails without an external C boundary, report the compiler output and generated .aug-build/program.c.',
174
182
  CONFIG: 'main.yaml uses the documented scalar settings and list settings. Duplicate keys, unsupported values, and unknown lint rules are errors during check.',
175
- PACKAGE: 'Declare an import alias in main.yaml packages (or aug-package.json dependencies for a library), then run aug install. Commit aug.lock.json; use --frozen in CI. Imports cross only export.aug boundaries. Installed sources and compiler versions must match the lock; build/check never fetch packages.',
183
+ PACKAGE: 'Import directly from a quoted public repository URL, or use aug add URL --as NAME to declare an alias in main.yaml. aug run prepares declared application packages; aug install prepares them explicitly. Commit aug.lock.json and use aug install --frozen in CI. Changed installed sources require an explicit reinstall. Imports cross only export.aug boundaries. Installed sources and compiler versions must match the lock; build/check never fetch source packages.',
176
184
  MODULE: 'Keep imports acyclic and follow main.yaml module_dependencies. strict_modules also requires sibling public imports to appear in export.aug.',
177
185
  LINT: 'Optional project policies point out hidden dependencies, discarded errors, and growing public surfaces. Enable individual rules in main.yaml lint.',
178
186
  DOC: 'Javadoc @param names use public input labels. @return requires a value-returning callable; @throws names an unless error. Enable public_docs for missing-documentation warnings.',
@@ -182,15 +190,16 @@ export const diagnosticHelp = {
182
190
  ITERATION: 'for traverses a List, Set, Map, or homogeneous Tuple. Use tuple destructuring for map entries and heterogeneous tuples.',
183
191
  NUMBER: 'int is signed 64-bit with defined wrapping arithmetic. Integer literal spelling is exact. Float literals must be finite.',
184
192
  TEXT: 'Strings contain valid Unicode encoded as UTF-8, without NUL. Binary data needs an explicit unsafe adapter.',
185
- EFFECT: 'Public function and interface contracts explicitly declare uses capability.operation. Implementations and private helpers infer omitted uses, while explicit clauses remain upper bounds. Declare changes for mutation and unless for errors. Receive dependencies in resolve header parameters; constructors and cleanup remain pure. Inferred effects cannot exceed an implemented interface or hold a lock during I/O.',
186
- MUTABILITY: 'Class storage is read-only after construction unless marked mutable. Managed function inputs grant reading; use a borrow parameter and a changes contract to mutate them. Public read-only fields do not grant mutable access through aliases.',
193
+ EFFECT: 'Bodies infer capability use and mutation. Bodyless interfaces declare permitted effects; explicit clauses remain upper bounds. Receive dependencies in resolve header parameters. Inferred effects cannot exceed an implemented interface, grant mutation of managed inputs, add constructor I/O, or hold a lock during I/O.',
194
+ INFERENCE: 'Add a result or effect type anchor when recursion has no evidence or keeps expanding generic types. Bodies infer omitted contracts; bodyless and foreign declarations describe them explicitly.',
195
+ MUTABILITY: 'Class storage is read-only after construction unless marked mutable. Managed function inputs grant reading; use a borrow parameter to mutate them; bodies infer the changes contract. Public read-only fields do not grant mutable access through aliases.',
187
196
  GENERIC: 'Type arguments must be concrete at a call and consistent across labeled inputs. Mutable and user-defined types are invariant by default. Supply explicit type arguments when inputs do not determine them.',
188
197
  INDENT: 'Put the body after a trailing colon on the next line. Indent beyond its header, keep each block level consistent, and use tabs or spaces without mixing them in a prefix. Dedent to an enclosing level; use pass for an empty body.',
189
198
  COLLECTION: 'Use compatible item types or a declared collection type. Empty [] and {} need a contextual type. A tuple may contain different types; tuple.get needs a constant index.',
190
199
  TEST: 'Place the suite beside its declaration. Class tests initialize their named subject; test endpoint NAME client supplies an HTTP pipeline client. Put when bindings and setup before it cases and assert a bool in every case. Run aug test --group NAME to select a group.',
191
200
  HTTP: 'Declare endpoint inputs with from path/query/header/body/cookie/form/request and dependencies with resolve. Select endpoints in main with serve. HTTP policies use literal options and explicit capability mappings; put them before custom parameter interceptors.',
192
201
  JSON: 'Expose concrete immutable data records and collections. Decode<T>() requires a concrete JSON data type; freeze existing mutable collection aliases before storing them in a record.',
193
- CONCURRENCY: 'Use scope for child-task lifetimes, start a labeled call, and wait for its result before mutating or moving any object the child captured. This includes writes inside an existing borrow block. A start inside a loop can create several children; use a scope inside the loop to join each iteration. Use Shared<T> and a short lock block for shared mutation; release the lock before I/O, waits, or starting tasks.',
202
+ CONCURRENCY: 'Use scope for child-task lifetimes, start a labeled call, and wait for its result before mutating or moving any object the child captured. This includes writes inside an existing borrow block. A task may consume owned inputs, but cannot return an owned value; release resources inside it and return immutable data. A start inside a loop can create several children; use a scope inside the loop to join each iteration. Use Shared<T> and a short lock block for shared mutation; release the lock before I/O, waits, or starting tasks.',
194
203
  INTERCEPTOR: 'Declare an interceptor with one around body. Map its selected inputs to target labels, preserve the target result and ownership, and supply constructor dependencies through resolve.',
195
204
  NEXT: 'Use next only inside around, with optional labeled overrides. Each execution path may call it at most once; loops and catch paths can repeat a call.',
196
205
  LEX: 'Check quotes, comment terminators, and supported characters.',
@@ -0,0 +1,14 @@
1
+ import { parse } from "./parser.js";
2
+ // These declarations describe the native policy ABI. Package names do not determine compatibility.
3
+ // Keep this schema aligned with the capabilities exported by the web library.
4
+ const source = `record Principal(string subject, List<string> permissions)
5
+ capability Authentication:
6
+ authenticate(HttpRequest request) returns optional Principal uses Authentication.authenticate unless HttpError
7
+ capability Authorization:
8
+ authorize(Principal identity, string permission) returns bool uses Authorization.authorize unless HttpError
9
+ capability RequestLogger:
10
+ complete(string method, string path, int status, int milliseconds) uses RequestLogger.complete
11
+ `;
12
+ export const nativeHttpContracts = new Map(parse('<native-http-contracts>', source).file.items
13
+ .filter(item => item.kind === 'interface' || item.kind === 'class')
14
+ .map(item => [item.name, item]));
@@ -10,10 +10,10 @@ export const httpPolicyOptions = {
10
10
  Cors: { origins: 'strings', headers: 'optional strings', credentials: 'optional bool' }, Compress: {},
11
11
  };
12
12
  export const httpPolicyOptionHelp = {
13
- authentication: 'Map an explicit resolve Authentication input. Declare uses input.authenticate. Missing identity returns 401 before wire decoding.',
14
- authorization: 'Map an explicit resolve Authorization input. Declare uses input.authorize. Denied permission returns 403.',
13
+ authentication: 'Map an explicit resolve Authentication input. The compiler infers input.authenticate. Missing identity returns 401 before wire decoding.',
14
+ authorization: 'Map an explicit resolve Authorization input. The compiler infers input.authorize. Denied permission returns 403.',
15
15
  permission: 'Literal nonempty permission checked by the authorization adapter.',
16
- logger: 'Map an explicit resolve RequestLogger input. Declare uses input.complete. The logger runs after completion or disconnect; put LogRequest first to observe rejected requests.',
16
+ logger: 'Map an explicit resolve RequestLogger input. The compiler infers input.complete. The logger runs after completion or disconnect; put LogRequest first to observe rejected requests.',
17
17
  requests: 'Literal request count per trusted transport peer and endpoint, from 1 to 1000000. Excess returns 429.',
18
18
  seconds: 'Literal fixed-window duration, from 1 to 86400 seconds.',
19
19
  milliseconds: 'Literal deadline from 1 to 3600000 milliseconds, covering handler, child tasks and response transport. Before output it returns 504; after output it closes the stream.',
@@ -44,10 +44,10 @@ export function checkHttpPolicy(annotation, fn, diagnostics, canonical) {
44
44
  if (entry.value || !param?.injected || param.type.name !== type || param.type.nullable || param.type.optional)
45
45
  report(`${name}.${entry.name} maps an explicit resolve ${type} endpoint parameter`);
46
46
  else if (!canonical(param, type))
47
- report(`${name}.${entry.name} requires the august.web ${type} capability`);
47
+ report(`${name}.${entry.name} requires a compatible ${type} capability from the web library`);
48
48
  else {
49
49
  dependencies[Object.keys(specs[name]).filter(key => specs[name][key].startsWith('dependency:')).indexOf(entry.name)] = index;
50
- if (!fn.uses?.some(effect => effect.source === param.name && effect.operation === operation))
50
+ if (fn.uses?.length && !fn.uses.some(effect => effect.source === param.name && effect.operation === operation))
51
51
  report(`Declare uses ${param.name}.${operation} for ${name}`);
52
52
  }
53
53
  continue;
@@ -0,0 +1,5 @@
1
+ /** These cells can never retain a managed pointer after checked execution. */
2
+ export function isIRScalar(type) {
3
+ return !type.nullable && !type.optional && !type.args.length &&
4
+ ['int', 'c_int', 'float', 'bool'].includes(type.name) && type.id === 'builtin:' + type.name;
5
+ }