@codua/codeoutline-win32-x64 0.1.4 → 0.1.5

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/DISTRIBUTION.md CHANGED
@@ -133,8 +133,11 @@ Treat these overrides and the initial installation as trusted configuration.
133
133
  To publish, stage a fresh native package for each target with
134
134
  `UPDATE_SEQUENCE=N`; N must increase for every release (the 0.1.3 baseline is 3).
135
135
  Use `tools/update-release.lua` for a script-only change: it reuses the previous
136
- platform runtimes, replaces Lua scripts and native launchers, and produces signed
137
- complete bundles for all three platforms. Upload these as drafts before publishing
136
+ platform runtimes, replaces Lua scripts and native launchers, and with `KIND=scripts`
137
+ produces signed script bundles for all three platforms. Runtime binaries, native
138
+ libraries and their license files are omitted from downloads; their hashes are
139
+ signed as runtime references and checked before copying them from a compatible
140
+ local installation. Upload these as drafts before publishing
138
141
  the version to the desired channel. The updater
139
142
  checks signatures, file hashes, platform, version, sequence and runtime health
140
143
  before activating the directory. CI must produce each platform runtime; a Windows
@@ -171,19 +174,53 @@ applies the proxy to Git, GitHub CLI, npm, and XUpgate requests, including child
171
174
  upload/publish commands. It changes neither global Git/npm configuration nor the
172
175
  calling terminal's proxy environment.
173
176
 
174
- For script changes that only need XUpgate, use `MODE=update`. It reuses baseline
177
+ For script changes that only need XUpgate, use `MODE=update`. Unless `BASE` is
178
+ explicitly provided, it selects the newest locally available, published full CI
179
+ release with all three platforms and the current runtime commit. It reuses baseline
175
180
  runtimes, checks that their runtime commit matches the current submodule, and does
176
181
  not require GitHub CLI or npm publishing authentication:
177
182
 
178
183
  ```powershell
179
- .\bin\xnet.exe tools/release.lua MODE=update BASE=C:/release/0.1.3 LOG_STDERR=1 LOG_FILE=0
184
+ .\bin\xnet.exe tools/release.lua MODE=update LOG_STDERR=1 LOG_FILE=0
180
185
  ```
181
186
 
182
187
  This mode still commits/pushes the release version and tag; CI runs on the tag but
183
- the local tool does not wait for or publish its npm/GitHub artifacts. npm read
188
+ the local tool does not wait for or publish its npm/GitHub artifacts. It now sends
189
+ script-only bundles rather than embedding the reused executables. npm read
184
190
  access remains necessary for duplicate-version checks. The initial npm launcher
185
191
  is only upgraded by full npm publication, not an XUpgate script bundle.
186
192
 
193
+ For native runtime/executable updates without publishing npm, use `MODE=runtime`:
194
+
195
+ ```powershell
196
+ .\bin\xnet.exe tools/release.lua MODE=runtime PROXY=socks5://127.0.0.1:1080 LOG_STDERR=1 LOG_FILE=0
197
+ ```
198
+
199
+ This waits for all-platform CI and publishes complete signed XUpgate bundles,
200
+ including the new executables. It requires GitHub CLI but does not publish npm or
201
+ create a GitHub Release. `MODE=full` retains the complete npm/GitHub/XUpgate workflow.
202
+ Both full bundles and script bundles install into immutable version directories;
203
+ active executables are never overwritten. `serve` installs in the background and
204
+ the next launch selects the verified scripts and matching executable. Rollback
205
+ switches the complete local version, including the reused or downloaded runtime.
206
+
207
+ Script bundles use protocol updater version 2. Existing 0.1.4 initial bootstraps
208
+ only understand updater version 1 and safely reject script bundles. They need a
209
+ one-time upgrade of the initial bootstrap (npm or native initial installation)
210
+ before using script-only updates; merely receiving a full update through the old
211
+ bootstrap does not replace that bootstrap. After that upgrade, both script and
212
+ executable updates can be delivered solely through XUpgate. Full bundles retain
213
+ updater version 1 for compatibility. A script bundle whose exact runtime hashes
214
+ are unavailable locally is rejected, preserving the active version; distribute
215
+ a compatible full update first. When a script package includes a signed reference
216
+ to that published full release, clients missing its runtime automatically download
217
+ and verify the referenced full package, cache only the required runtime files,
218
+ and activate the new script version after its health check. This does not activate
219
+ the intermediate full version. The server rejects references to unpublished full
220
+ releases; withdrawals and disabled projects are respected. If no full artifact is
221
+ available locally when building a manual script bundle, only local runtime reuse
222
+ is possible and missing compatible runtimes still cause a safe rejection.
223
+
187
224
  Use `DRY_RUN=1` to exercise prompting and remote version checks without changing
188
225
  files, commits, tags or publications. An explicit `VERSION` is also accepted; a
189
226
  duplicate then stops instead of prompting. The default output is `C:/release/<version>`
@@ -196,6 +233,22 @@ versions are retained rather than reverted. Inspect the error before retrying;
196
233
  after a partial release, use the recorded version and existing artifacts with the
197
234
  individual upload/publish commands instead of rebuilding that version.
198
235
 
236
+ If a full release stops after CI downloads and signed bundles have been created,
237
+ resume the same artifacts with `RESUME=<version>`:
238
+
239
+ ```powershell
240
+ .\bin\xnet.exe tools/release.lua RESUME=0.1.4 PROXY=socks5://127.0.0.1:1080 LOG_STDERR=1 LOG_FILE=0
241
+ ```
242
+
243
+ Resume verifies the recorded commit, local/remote tag, CI checksums, signatures and
244
+ remote draft hashes. It does not create a new version, commit, tag or build.
245
+ Published npm packages are skipped only when their registry shasum matches the
246
+ local tarball. npm publishing inherits the terminal so required authentication
247
+ prompts remain usable. Fix npm publishing authentication before retrying; login
248
+ alone may not meet the package's 2FA policy. `DRY_RUN=1` validates resume without
249
+ publishing anything. Earlier failures that lack complete CI artifacts or bundles
250
+ still need the individual repair commands.
251
+
199
252
  Run from the repository root. `BASE` contains the extracted CI packages under
200
253
  `codeoutline-<target>/native/package`. `OUTPUT` must be a new directory.
201
254
  Python is not required. OpenSSL must be on PATH for offline private-key signing;
@@ -205,7 +258,7 @@ Manual bundles record the real source commit/dirty state and are not marked as C
205
258
  release builds. Review and test the staged files before uploading.
206
259
 
207
260
  ```powershell
208
- .\bin\xnet.exe tools/update-release.lua ACTION=build BASE=C:/release/0.1.3 OUTPUT=C:/release/0.1.4 VERSION=0.1.4 SEQUENCE=4 KEY=C:/private/codeoutline.private.pem LOG_STDERR=1 LOG_FILE=0
261
+ .\bin\xnet.exe tools/update-release.lua ACTION=build KIND=scripts BASE=C:/release/0.1.3 OUTPUT=C:/release/0.1.5 VERSION=0.1.5 SEQUENCE=5 KEY=C:/private/codeoutline.private.pem LOG_STDERR=1 LOG_FILE=0
209
262
  ```
210
263
 
211
264
  Native directories are written under `OUTPUT/native/<target>`. Uploadable signed
@@ -219,8 +272,8 @@ The upload step checks existing remote hashes, so an interrupted upload can be
219
272
  retried with the same artifacts. Do not rebuild or overwrite an uploaded version.
220
273
 
221
274
  ```powershell
222
- .\bin\xnet.exe tools/update-release.lua ACTION=upload OUTPUT=C:/release/0.1.4 VERSION=0.1.4 SEQUENCE=4 CREDENTIAL_FILE=C:/private/xupgate-admin.env LOG_STDERR=1 LOG_FILE=0
223
- .\bin\xnet.exe tools/update-release.lua ACTION=publish OUTPUT=C:/release/0.1.4 VERSION=0.1.4 SEQUENCE=4 CHANNEL=stable CREDENTIAL_FILE=C:/private/xupgate-admin.env LOG_STDERR=1 LOG_FILE=0
275
+ .\bin\xnet.exe tools/update-release.lua ACTION=upload OUTPUT=C:/release/0.1.5 VERSION=0.1.5 SEQUENCE=5 CREDENTIAL_FILE=C:/private/xupgate-admin.env LOG_STDERR=1 LOG_FILE=0
276
+ .\bin\xnet.exe tools/update-release.lua ACTION=publish OUTPUT=C:/release/0.1.5 VERSION=0.1.5 SEQUENCE=5 CHANNEL=stable CREDENTIAL_FILE=C:/private/xupgate-admin.env LOG_STDERR=1 LOG_FILE=0
224
277
  ```
225
278
 
226
279
  `ACTION=publish` verifies that all three matching platform releases exist before
@@ -228,6 +281,16 @@ switching the channel. Both network actions default to the packaged HTTPS server
228
281
  and pinned CA; `URL` and `CA_FILE` can override them for another deployment.
229
282
  Existing services keep running; an installed update applies on the next launch.
230
283
 
284
+ The Lua updater regression runs with `npm test` when OpenSSL is available. An
285
+ opt-in real HTTPS protocol regression uses only xnet Lua and an isolated project:
286
+
287
+ ```powershell
288
+ .\bin\xnet.exe tests/lua/update_http_spec.lua CREDENTIAL_FILE=C:/private/xupgate-admin.env LOG_STDERR=1 LOG_FILE=0
289
+ ```
290
+
291
+ It tests full/script downloads, signature rejection, rollback and withdrawal,
292
+ then disables its test project. It never publishes a production CodeOutline version.
293
+
231
294
  The opt-in deployed integration test needs Python, OpenSSL, a staged Windows
232
295
  package, and the sibling XUpgate release builder:
233
296
 
package/bin/xnet.exe CHANGED
Binary file
package/build-info.json CHANGED
@@ -1 +1 @@
1
- {"sha256":{"scripts/codeoutline/explore.lua":"d9e4e0d0179d00205df96ad0e7442e7bbc87e27481e6d27eb772ca302b5f35d3","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/lang/js.lua":"7a25a195356deeef7da3fdaf6e8a483b2a3a230cae3064e5dde2a3556fdcbda9","scripts/codeoutline/graph.lua":"1ef35f2e92e9db3bbe9b612bb0cb336a9b57b440c9a066e7ba3ef81574326834","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","scripts/codeoutline/lang/lua.lua":"33b038192425e4db29251674e30c73b7a1af849789c49ff6430ee409c062f812","scripts/codeoutline/update_worker.lua":"b067e2ca95e729cb6b392171a2ddd80d06f7c313f3ab0484978664940364eb68","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","scripts/codeoutline/lang/python.lua":"f7219c04914673ee6bae387c222b09acd433596c746237bdd6650a4f4087b17c","scripts/codeoutline/version.lua":"955291f8ce69995ab9b24f691bbc2b5bed4b768242c077ae15c1fcb270cb4791","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","scripts/codeoutline/lang/rust.lua":"f7c21751b1ab08512a406f45bd53546dddfa98ff680b1374d29a4152ae110023","scripts/codeoutline/xscan.lua":"508d1fdccee4e856e0f198992bec45d7c8a9a3c191e0a5f71717741db9e00325","codeoutline":"8d00b52027511d56136c8bd345666d2a14ad49591313c80a016d6032f708c02b","codeoutline.cmd":"6414f7fac4c7e384d5b8e9e5e8a89731f7950b48dbe08bcbe149c1a70dbc4407","scripts/codeoutline/main.lua":"0a340e38b5a86753091d72f07a379203656fc39feaa3b54e505a8e93a6deefb0","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","README.zh-CN.md":"4c2ff0fe0b73b3052f067926e45f9f9792571d9d529c731567b2c0d3b1d2c844","licenses/rpmalloc.txt":"f6c10eb9ec349900767c3dcb8bc71fe4fba2aefea329f05e2608827188016c0f","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","scripts/codeoutline/mcp.lua":"f14a2d0b9625544ad32309358121a5ff304839780f52d5c1c8ec548d56c5e901","README.md":"a1757e831f9d60d14cf318bd47cf8d9481a3e65b7bf99922064445d5d4913c89","scripts/codeoutline/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","scripts/xupgate/client.lua":"4bcefd14802f5d44c7c7e5b5aeda25247957212605f426da8c9dfb84ed7f9758","scripts/codeoutline/cli.lua":"ba996c3c3def65aab08ba60141a7a98a19dfcc1bbe004ab5d8ea14a7f9f9a08b","DISTRIBUTION.md":"3b5b1ee53e37873a9fc0c4c65e590f63c42bf989fbd3e2e2ebce5565cbc578af","scripts/codeoutline/parse.lua":"ccda7a087dc90109fce7a1e64ebe1de0d7c7036990b81b3423ff14b4299bf38f","THIRD_PARTY.md":"a70238f26ec05b7be4b813fa49c337cfb4d3cd64c36fcd27401d121e0e6e38df","scripts/codeoutline/lang/c.lua":"1251352bcfac6b6d3704460e00b06cf4f41232144748b41b89db04a5ab594073","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/xupgate/common.lua":"7eb979277887dfae16b325ffdab493673f01b96d00b9c1de11d8aca297368752","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","scripts/codeoutline/command.lua":"a2e6f938897407f99573779b71948968cd743e331ca2cd0076cc1a9170559c30","scripts/codeoutline/index.lua":"08c585a7cb264962ac04beb3bf5bc8a9dd22b4f85644b6fdd6a4e527843fbee9","scripts/codeoutline/update_sequence.lua":"cb35cf7e03925c2e901c14aee2deae88aaaff6922644b2f73b428dcba8020e90","scripts/codeoutline/lang/cpp.lua":"96aebcd8972d5272c11446257f37fe90c10f4130c3c1b5bb71c793d7c25456f4","scripts/codeoutline/lang/csharp.lua":"36ac648b8691c85b8c75d5bcb146fcdfc87992a278e4798f3eb194124e3df2bb","bin/xnet.exe":"20e40fbc28bc1496bb3f598c5776cb93a56cc74fccade4d6994c3f4e390580e0","scripts/codeoutline/service.lua":"597c435309abc0d8149b5e88095896c3bba6516146fd587d53b4b6fbf23a553c","scripts/codeoutline/control.lua":"1dfbea9f1397d9fb3c321c48a8d8ee7fc7928e864588226e55247bd548255bb4","scripts/codeoutline/common.lua":"ee775ed5b2f7ada7a02851f44b51bd4008bceacbf9700576a474e6732e3c03c2","scripts/codeoutline/index_worker.lua":"47f80807a458d5c706b1a54f60fb2200ae51f022b21d9039df44611035e9ac40","scripts/codeoutline/lang/go.lua":"f5717cbeabe6d30dad72c473fa445480d7fb6b5546bb262e5f4c46185f0959da","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/text.lua":"75f9af87ff5ce62def74f69d8972a6b11ff660723fc5cf515369ee3012ff0675","scripts/xupgate/http_client.lua":"a189506c3d0fcc454f5e001fdeecdd6349a1019ea0970d11ce2fbfdf035166d6","scripts/codeoutline/http.lua":"33802130445b348ce607e9891d4a9789d34b18338bf5d296f56e0b3c7b0c5493","scripts/codeoutline/updater.lua":"633348e78ca018afca33bfedd3f17340a6400462bd3b5aaa6c57e83919d76f2a","scripts/codeoutline/lang/java.lua":"435b6ddcd231679db9e705a604344a3fb6c00b84cc20b2ecd210423ee0b376a6"},"updateSequence":4,"runtimeCommit":"f2c3ddfcbd3f04d7dd71543d0878d06e033519a0","lua":"LuaJIT 2.1.1774896198","version":"0.1.4","sourceCommit":"23b74bb62f48d65049d60ae36eb3501b4f713f56","target":"win32-x64","releaseReady":true,"note":"Release build from a clean checkout","sourceDirty":false}
1
+ {"target":"win32-x64","note":"Release build from a clean checkout","runtimeCommit":"f2c3ddfcbd3f04d7dd71543d0878d06e033519a0","lua":"LuaJIT 2.1.1774896198","sourceCommit":"ad5fe39729d8dd62423ae2e4fa19230862984008","updateSequence":5,"sourceDirty":false,"releaseReady":true,"sha256":{"scripts/codeoutline/lang/java.lua":"435b6ddcd231679db9e705a604344a3fb6c00b84cc20b2ecd210423ee0b376a6","scripts/codeoutline/updater.lua":"45febd8caf44fa2b19783b2c5437205a7ae6edd2563dd30f008cf91e3604521b","scripts/codeoutline/graph.lua":"1ef35f2e92e9db3bbe9b612bb0cb336a9b57b440c9a066e7ba3ef81574326834","scripts/codeoutline/lang/js.lua":"7a25a195356deeef7da3fdaf6e8a483b2a3a230cae3064e5dde2a3556fdcbda9","scripts/codeoutline/update_sequence.lua":"4d6a3bd57b2f5e97abb44edf2aa8b2839a4e7eb8a4f767d6eda6fe410e309adf","scripts/codeoutline/http.lua":"33802130445b348ce607e9891d4a9789d34b18338bf5d296f56e0b3c7b0c5493","DISTRIBUTION.md":"d7aaa99ba470a41130dd97dca388ae41ac0aa8f2f6bd6c3c73d0eb69719b57a5","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/lang/lua.lua":"33b038192425e4db29251674e30c73b7a1af849789c49ff6430ee409c062f812","scripts/codeoutline/update_worker.lua":"b067e2ca95e729cb6b392171a2ddd80d06f7c313f3ab0484978664940364eb68","scripts/codeoutline/index.lua":"08c585a7cb264962ac04beb3bf5bc8a9dd22b4f85644b6fdd6a4e527843fbee9","licenses/rpmalloc.txt":"f6c10eb9ec349900767c3dcb8bc71fe4fba2aefea329f05e2608827188016c0f","scripts/codeoutline/lang/python.lua":"f7219c04914673ee6bae387c222b09acd433596c746237bdd6650a4f4087b17c","scripts/codeoutline/version.lua":"bc93f8bbcfe7e260f8912f633df427fe70d6f0f3ff847967481031b0af8112cb","scripts/codeoutline/index_worker.lua":"47f80807a458d5c706b1a54f60fb2200ae51f022b21d9039df44611035e9ac40","scripts/codeoutline/command.lua":"a2e6f938897407f99573779b71948968cd743e331ca2cd0076cc1a9170559c30","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","scripts/codeoutline/lang/rust.lua":"f7c21751b1ab08512a406f45bd53546dddfa98ff680b1374d29a4152ae110023","scripts/codeoutline/xscan.lua":"508d1fdccee4e856e0f198992bec45d7c8a9a3c191e0a5f71717741db9e00325","scripts/codeoutline/common.lua":"ee775ed5b2f7ada7a02851f44b51bd4008bceacbf9700576a474e6732e3c03c2","scripts/codeoutline/main.lua":"0a340e38b5a86753091d72f07a379203656fc39feaa3b54e505a8e93a6deefb0","codeoutline":"8d00b52027511d56136c8bd345666d2a14ad49591313c80a016d6032f708c02b","scripts/codeoutline/control.lua":"1dfbea9f1397d9fb3c321c48a8d8ee7fc7928e864588226e55247bd548255bb4","codeoutline.cmd":"6414f7fac4c7e384d5b8e9e5e8a89731f7950b48dbe08bcbe149c1a70dbc4407","scripts/codeoutline/mcp.lua":"f14a2d0b9625544ad32309358121a5ff304839780f52d5c1c8ec548d56c5e901","THIRD_PARTY.md":"a70238f26ec05b7be4b813fa49c337cfb4d3cd64c36fcd27401d121e0e6e38df","README.zh-CN.md":"4c2ff0fe0b73b3052f067926e45f9f9792571d9d529c731567b2c0d3b1d2c844","scripts/xupgate/client.lua":"39a574728852a47963469ed04b26c319966306c7173aee689949c975354d9745","README.md":"a1757e831f9d60d14cf318bd47cf8d9481a3e65b7bf99922064445d5d4913c89","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","scripts/codeoutline/parse.lua":"ccda7a087dc90109fce7a1e64ebe1de0d7c7036990b81b3423ff14b4299bf38f","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","scripts/xupgate/common.lua":"86267648c0dbbd3a05f90de4d6e1dbee53ba57bf4801783c2ae636224b1f228c","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","bin/xnet.exe":"be4fc213dd001e29c8962db699d63cb57476a169dc8a3476c13b82b4b14cbc4e","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","scripts/codeoutline/lang/csharp.lua":"36ac648b8691c85b8c75d5bcb146fcdfc87992a278e4798f3eb194124e3df2bb","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","scripts/codeoutline/service.lua":"597c435309abc0d8149b5e88095896c3bba6516146fd587d53b4b6fbf23a553c","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/xupgate/http_client.lua":"a189506c3d0fcc454f5e001fdeecdd6349a1019ea0970d11ce2fbfdf035166d6","scripts/codeoutline/lang/go.lua":"f5717cbeabe6d30dad72c473fa445480d7fb6b5546bb262e5f4c46185f0959da","scripts/codeoutline/cli.lua":"ba996c3c3def65aab08ba60141a7a98a19dfcc1bbe004ab5d8ea14a7f9f9a08b","scripts/codeoutline/text.lua":"75f9af87ff5ce62def74f69d8972a6b11ff660723fc5cf515369ee3012ff0675","scripts/codeoutline/explore.lua":"d9e4e0d0179d00205df96ad0e7442e7bbc87e27481e6d27eb772ca302b5f35d3","scripts/codeoutline/lang/cpp.lua":"96aebcd8972d5272c11446257f37fe90c10f4130c3c1b5bb71c793d7c25456f4","scripts/codeoutline/lang/c.lua":"1251352bcfac6b6d3704460e00b06cf4f41232144748b41b89db04a5ab594073"},"version":"0.1.5"}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","cpu":["x64","arm64"],"license":"BSD-2-Clause","repository":{"url":"git+https://github.com/1dao/codeoutline.git","type":"git"},"version":"0.1.4","name":"@codua/codeoutline-win32-x64","files":["bin/","lib/","keys/","scripts/","licenses/","LICENSE","codeoutline","codeoutline.cmd","build-info.json","*.md"],"os":["win32"]}
1
+ {"publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","cpu":["x64","arm64"],"license":"BSD-2-Clause","name":"@codua/codeoutline-win32-x64","repository":{"url":"git+https://github.com/1dao/codeoutline.git","type":"git"},"os":["win32"],"version":"0.1.5","files":["bin/","lib/","keys/","scripts/","licenses/","LICENSE","codeoutline","codeoutline.cmd","build-info.json","*.md"]}
@@ -1 +1 @@
1
- return 4
1
+ return 5
@@ -19,6 +19,7 @@ function M.config(options)
19
19
  directory=os.getenv('CODEOUTLINE_UPDATE_DIR') or assert(home,'set CODEOUTLINE_UPDATE_DIR') .. '/.codeoutline/updates',
20
20
  minimumSequence=tonumber(os.getenv('CODEOUTLINE_UPDATE_MIN_SEQUENCE')) or build.updateSequence or 0,
21
21
  http=require('xupgate.http_client'),
22
+ runtimeDirectory=install,
22
23
  }
23
24
  cfg.validate=function(root,m)
24
25
  local info=c.decode_json(c.read(root .. '/build-info.json'))
@@ -1 +1 @@
1
- return '0.1.4'
1
+ return '0.1.5'
@@ -51,6 +51,22 @@ function M.open(config)
51
51
  assert(m.project==config.project and m.platform==config.platform,'manifest target mismatch')
52
52
  return m
53
53
  end
54
+ function api.cache_runtime(envelope, data, scripts)
55
+ local full = verified(envelope)
56
+ local reference = assert(scripts.runtimeRelease, 'runtime release reference missing')
57
+ assert(scripts.kind == 'scripts' and full.kind ~= 'scripts' and full.version == reference.version
58
+ and full.sequence == reference.sequence and full.sha256 == reference.sha256, 'runtime release mismatch')
59
+ local source_files = {}
60
+ for _, file in ipairs(c.bundle(data, full)) do source_files[file.path] = file.data end
61
+ for path, hash in pairs(scripts.runtimeFiles) do
62
+ assert(source_files[path] and u.sha256_hex(source_files[path]) == hash, 'runtime release file mismatch')
63
+ end
64
+ return locked(function()
65
+ local directory = root .. '/runtime-cache/' .. reference.sha256 .. '/files'
66
+ for path in pairs(scripts.runtimeFiles) do c.write(directory .. '/' .. path, source_files[path]) end
67
+ return directory
68
+ end)
69
+ end
54
70
  function api.current()
55
71
  local s=state();if not s.current then return nil end
56
72
  local dir=root .. '/versions/' .. s.current
@@ -60,7 +76,10 @@ function M.open(config)
60
76
  assert(u.sha256_hex(envelope.payload)==s.current,'invalid active identity')
61
77
  local files=c.bundle(assert(c.read(dir .. '/bundle.json')),m)
62
78
  for _,f in ipairs(files)do assert(c.read(dir .. '/files/' .. f.path)==f.data,'installed file changed')end
63
- return {version=m.version,sequence=m.sequence,root=dir .. '/files',entry=m.entry,runtime=m.runtime,sha256=m.sha256}
79
+ for path, hash in pairs(m.runtimeFiles or {}) do
80
+ assert(u.sha256_hex(assert(c.read(dir .. '/files/' .. path), 'runtime file missing')) == hash, 'installed runtime changed')
81
+ end
82
+ return {version=m.version,sequence=m.sequence,root=dir .. '/files',entry=m.entry,runtime=m.runtime,sha256=m.sha256,kind=m.kind or 'full'}
64
83
  end
65
84
  function api.install(envelope,data)
66
85
  local m=verified(envelope);local files=c.bundle(data,m)
@@ -77,6 +96,30 @@ function M.open(config)
77
96
  c.write(dir .. '/files/' .. f.path,f.data)
78
97
  if f.executable and package.config:sub(1,1)~='\\' then assert(command_ok('chmod 755 ' .. shell_path(dir .. '/files/' .. f.path)),'chmod failed')end
79
98
  end
99
+ if m.kind == 'scripts' then
100
+ local candidates = { config.runtimeDirectory }
101
+ if s.current then candidates[#candidates + 1] = root .. '/versions/' .. s.current .. '/files' end
102
+ if s.previous then candidates[#candidates + 1] = root .. '/versions/' .. s.previous .. '/files' end
103
+ if m.runtimeRelease then candidates[#candidates + 1] = root .. '/runtime-cache/' .. m.runtimeRelease.sha256 .. '/files' end
104
+ local runtime_root
105
+ for _, candidate in ipairs(candidates) do
106
+ local matches = true
107
+ for path, hash in pairs(m.runtimeFiles) do
108
+ local bytes = c.read(candidate .. '/' .. path)
109
+ if not bytes or u.sha256_hex(bytes) ~= hash then matches = false; break end
110
+ end
111
+ if matches then runtime_root = candidate; break end
112
+ end
113
+ assert(runtime_root, 'compatible local runtime missing; install a full update first')
114
+ for path, hash in pairs(m.runtimeFiles) do
115
+ local bytes = assert(c.read(runtime_root .. '/' .. path))
116
+ assert(u.sha256_hex(bytes) == hash, 'runtime changed during installation')
117
+ c.write(dir .. '/files/' .. path, bytes)
118
+ if package.config:sub(1,1) ~= '\\' and (path == m.runtime or path:match('^bin/')) then
119
+ assert(command_ok('chmod 755 ' .. shell_path(dir .. '/files/' .. path)), 'chmod failed')
120
+ end
121
+ end
122
+ end
80
123
  c.write(dir .. '/bundle.json',data)
81
124
  c.write(dir .. '/manifest.json',assert(u.json_pack(envelope)))
82
125
  c.atomic(dir .. '/complete','1\n')
@@ -126,6 +169,33 @@ function M.open(config)
126
169
  if download_error then callback(download_error);return end
127
170
  if resp.status~=200 then callback('package HTTP ' .. resp.status);return end
128
171
  local ok,result=pcall(api.install,update.envelope,resp.body)
172
+ if not ok and update.manifest.runtimeRelease and tostring(result):find('compatible local runtime missing', 1, true) then
173
+ local scripts_data = resp.body
174
+ local reference = update.manifest.runtimeRelease
175
+ http.request({url=base .. '/api/v1/projects/' .. config.project .. '/releases/' .. reference.version .. '/' .. config.platform,
176
+ timeout_ms=15000,max_redirects=0,verify=true,ca_file=config.caFile},function(reference_error,reference_response)
177
+ if reference_error then callback(reference_error);return end
178
+ if reference_response.status~=200 then callback('runtime reference HTTP ' .. reference_response.status);return end
179
+ local valid, envelope = pcall(function()
180
+ local envelope = assert(c.decode_json(reference_response.body))
181
+ local full = verified(envelope)
182
+ assert(full.kind ~= 'scripts' and full.version == reference.version and full.sequence == reference.sequence
183
+ and full.sha256 == reference.sha256, 'runtime reference mismatch')
184
+ return envelope
185
+ end)
186
+ if not valid then callback(tostring(envelope));return end
187
+ http.request({url=base .. '/packages/' .. reference.sha256 .. '.json',timeout_ms=120000,max_redirects=0,
188
+ verify=true,ca_file=config.caFile,decompress=false},function(runtime_error,runtime_response)
189
+ if runtime_error then callback(runtime_error);return end
190
+ if runtime_response.status~=200 then callback('runtime package HTTP ' .. runtime_response.status);return end
191
+ local cached, failure = pcall(api.cache_runtime, envelope, runtime_response.body, update.manifest)
192
+ if not cached then callback(tostring(failure));return end
193
+ local installed, current = pcall(api.install, update.envelope, scripts_data)
194
+ callback(not installed and tostring(current) or nil, installed and current or nil)
195
+ end)
196
+ end)
197
+ return
198
+ end
129
199
  callback(not ok and tostring(result) or nil,ok and result or nil)
130
200
  end)
131
201
  end)
@@ -43,7 +43,24 @@ function M.manifest(envelope, public_key)
43
43
  assert(require('xupgate.signature').verify(public_key, envelope.payload, sig), 'manifest signature invalid')
44
44
  local m = assert(M.decode_json(envelope.payload), 'invalid manifest JSON')
45
45
  assert(m.schema == 1 and M.id(m.project) and M.version(m.version) and M.id(m.platform), 'invalid manifest identity')
46
- assert(m.minUpdater == 1, 'unsupported updater version')
46
+ assert(m.minUpdater == 1 or m.minUpdater == 2, 'unsupported updater version')
47
+ assert(m.kind == nil or m.kind == 'full' or m.kind == 'scripts', 'invalid package kind')
48
+ if m.kind == 'scripts' then
49
+ assert(m.minUpdater == 2 and type(m.runtimeFiles) == 'table' and M.path(m.runtime), 'script package requires updater 2 and runtime references')
50
+ local count, seen = 0, {}
51
+ for path, hash in pairs(m.runtimeFiles) do
52
+ assert(M.path(path) and type(hash) == 'string' and #hash == 64 and hash:match('^[0-9a-f]+$'), 'invalid runtime reference')
53
+ assert(not seen[path:lower()], 'duplicate runtime reference'); seen[path:lower()] = true
54
+ count = count + 1
55
+ end
56
+ assert(count > 0 and count <= 1000 and m.runtimeFiles[m.runtime], 'runtime reference missing')
57
+ if m.runtimeRelease then
58
+ local r = m.runtimeRelease
59
+ assert(type(r) == 'table' and M.version(r.version) and type(r.sequence) == 'number'
60
+ and r.sequence > 0 and r.sequence % 1 == 0 and r.sequence < m.sequence
61
+ and type(r.sha256) == 'string' and #r.sha256 == 64 and r.sha256:match('^[0-9a-f]+$'), 'invalid runtime release reference')
62
+ end
63
+ else assert(m.runtimeFiles == nil and m.runtimeRelease == nil, 'runtime references require a script package') end
47
64
  assert(type(m.sha256) == 'string' and #m.sha256 == 64 and m.sha256:match('^[0-9a-f]+$'), 'invalid package hash')
48
65
  assert(type(m.size) == 'number' and m.size > 0 and m.size <= 50331648 and m.size % 1 == 0, 'invalid package size')
49
66
  assert(type(m.sequence) == 'number' and m.sequence >= 1 and m.sequence % 1 == 0, 'invalid release sequence')
@@ -65,6 +82,11 @@ function M.bundle(data, manifest)
65
82
  decoded[#decoded+1] = { path = f.path, data = bytes, executable = f.executable == true }
66
83
  if f.path == manifest.entry then entry = true end
67
84
  end
85
+ if manifest.kind == 'scripts' then
86
+ for path in pairs(manifest.runtimeFiles) do
87
+ local key = path:lower(); assert(not seen[key], 'runtime/script file collision'); seen[key] = true
88
+ end
89
+ end
68
90
  for key in pairs(seen) do
69
91
  local prefix = key:match('^(.*)/[^/]+$')
70
92
  while prefix do assert(not seen[prefix], 'file/directory collision'); prefix = prefix:match('^(.*)/[^/]+$') end