@codua/codeoutline-win32-x64 0.1.3 → 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
@@ -112,9 +112,10 @@ codeoutline update
112
112
  codeoutline update --rollback
113
113
  ```
114
114
 
115
- `serve` checks for updates before starting. A verified update applies to that new
116
- process; existing services keep running. Failed checks retain the local version.
117
- Other commands select a verified installed version without requesting the network.
115
+ Every command starts the newest verified installed version without requesting the
116
+ network. `serve` then checks for updates in a background thread, so an unreachable
117
+ update server never delays startup or requests; a verified update applies to the
118
+ next launch, and failed checks are reported on stderr.
118
119
  Set `CODEOUTLINE_AUTO_UPDATE=0` to disable automatic checks. Manual update still works.
119
120
  Rollback switches between the two installed versions; after the first update it
120
121
  returns to the initial installation. Accepted sequence numbers are retained, so a
@@ -131,15 +132,165 @@ Treat these overrides and the initial installation as trusted configuration.
131
132
 
132
133
  To publish, stage a fresh native package for each target with
133
134
  `UPDATE_SEQUENCE=N`; N must increase for every release (the 0.1.3 baseline is 3).
134
- Use XUpgate's `tools/release.py` with the same version and sequence,
135
- `--entry scripts/codeoutline/command.lua`, and
136
- `--runtime bin/xnet.exe` for Windows or `--runtime bin/xnet` otherwise.
137
- Sign the native directory with the project's offline private key, upload the signed
138
- artifact in XUpgate, then publish its version to the desired channel. The updater
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 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
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
141
144
  package cannot update a Linux or macOS installation.
142
145
 
146
+ ### Make an all-platform script update with xnet
147
+
148
+ For automatic releases, commit the feature changes and the release tools first,
149
+ then run one command from a clean `main` checkout:
150
+
151
+ ```powershell
152
+ .\bin\xnet.exe tools/release.lua LOG_STDERR=1 LOG_FILE=0
153
+ ```
154
+
155
+ The tool prompts for a new version and rejects versions already present in local
156
+ or remote tags, any XUpgate release (including drafts), npm, or the output folder.
157
+ It assigns the next unused update sequence, runs local tests, updates the source
158
+ version and sequence files, commits only those files as `release: <version>`, and
159
+ pushes the commit and tag atomically. Full mode waits for the tagged GitHub Actions
160
+ CI, downloads and verifies artifacts for that exact commit, signs and uploads all
161
+ three XUpgate drafts, publishes the three npm platform packages then the entry
162
+ package, creates the GitHub release, and finally switches XUpgate stable.
163
+
164
+ Full mode requires Git, Node/npm, OpenSSL and GitHub CLI (`gh`) on PATH, a signed-in
165
+ GitHub account (`gh auth login`), and npm credentials usable for publishing. npm
166
+ may still ask for account-required authentication; configure appropriate publishing
167
+ credentials before attempting unattended releases. Private key and administrator
168
+ credential defaults match the local development setup; `KEY`, `CREDENTIAL_FILE`,
169
+ `URL`, `CA_FILE`, and `RELEASE_DIR` override them.
170
+
171
+ Pass `PROXY=socks5://127.0.0.1:1080` (or set `CODEOUTLINE_RELEASE_PROXY`) when
172
+ GitHub access requires a proxy. The tool uses SOCKS remote DNS (`socks5h`) and
173
+ applies the proxy to Git, GitHub CLI, npm, and XUpgate requests, including child
174
+ upload/publish commands. It changes neither global Git/npm configuration nor the
175
+ calling terminal's proxy environment.
176
+
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
180
+ runtimes, checks that their runtime commit matches the current submodule, and does
181
+ not require GitHub CLI or npm publishing authentication:
182
+
183
+ ```powershell
184
+ .\bin\xnet.exe tools/release.lua MODE=update LOG_STDERR=1 LOG_FILE=0
185
+ ```
186
+
187
+ This mode still commits/pushes the release version and tag; CI runs on the tag but
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
190
+ access remains necessary for duplicate-version checks. The initial npm launcher
191
+ is only upgraded by full npm publication, not an XUpgate script bundle.
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
+
224
+ Use `DRY_RUN=1` to exercise prompting and remote version checks without changing
225
+ files, commits, tags or publications. An explicit `VERSION` is also accepted; a
226
+ duplicate then stops instead of prompting. The default output is `C:/release/<version>`
227
+ on Windows and `dist/releases/<version>` elsewhere. Signed bundles are under
228
+ `<output>/bundles/xupgate`. Full mode stores the downloaded CI artifacts under
229
+ `<output>/ci`. `release-state.json` records the chosen version, sequence and commit.
230
+
231
+ Failures stop the release. Already-created commits/tags, immutable uploads and npm
232
+ versions are retained rather than reverted. Inspect the error before retrying;
233
+ after a partial release, use the recorded version and existing artifacts with the
234
+ individual upload/publish commands instead of rebuilding that version.
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
+
252
+ Run from the repository root. `BASE` contains the extracted CI packages under
253
+ `codeoutline-<target>/native/package`. `OUTPUT` must be a new directory.
254
+ Python is not required. OpenSSL must be on PATH for offline private-key signing;
255
+ the tool verifies each signature against the bundled public key before saving it.
256
+ It verifies the base packages' recorded hashes and preserves their runtime commits.
257
+ Manual bundles record the real source commit/dirty state and are not marked as CI
258
+ release builds. Review and test the staged files before uploading.
259
+
260
+ ```powershell
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
262
+ ```
263
+
264
+ Native directories are written under `OUTPUT/native/<target>`. Uploadable signed
265
+ JSON files are under `OUTPUT/xupgate/<target>.json`. The private key is never
266
+ included. The version argument sets the staged version without editing the source
267
+ checkout; npm's Node launcher is outside these native bundles.
268
+
269
+ Use administrator credentials via `XUPGATE_PUBLISH_TOKEN` or an environment file
270
+ containing one `ADMIN_TOKEN=...` line. Credentials are read without printing them.
271
+ The upload step checks existing remote hashes, so an interrupted upload can be
272
+ retried with the same artifacts. Do not rebuild or overwrite an uploaded version.
273
+
274
+ ```powershell
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
277
+ ```
278
+
279
+ `ACTION=publish` verifies that all three matching platform releases exist before
280
+ switching the channel. Both network actions default to the packaged HTTPS server
281
+ and pinned CA; `URL` and `CA_FILE` can override them for another deployment.
282
+ Existing services keep running; an installed update applies on the next launch.
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
+
143
294
  The opt-in deployed integration test needs Python, OpenSSL, a staged Windows
144
295
  package, and the sibling XUpgate release builder:
145
296
 
package/bin/xnet.exe CHANGED
Binary file
package/build-info.json CHANGED
@@ -1 +1 @@
1
- {"sourceDirty":false,"releaseReady":true,"version":"0.1.3","sha256":{"scripts/codeoutline/lang/c.lua":"1251352bcfac6b6d3704460e00b06cf4f41232144748b41b89db04a5ab594073","scripts/codeoutline/version.lua":"635bc8cc8a89fcfedfe2a3eaafaa6a061f84f72f832b0e39f98f302ba997ffda","scripts/codeoutline/parse.lua":"ccda7a087dc90109fce7a1e64ebe1de0d7c7036990b81b3423ff14b4299bf38f","scripts/codeoutline/command.lua":"a2e6f938897407f99573779b71948968cd743e331ca2cd0076cc1a9170559c30","scripts/codeoutline/lang/cpp.lua":"96aebcd8972d5272c11446257f37fe90c10f4130c3c1b5bb71c793d7c25456f4","scripts/codeoutline/common.lua":"ee775ed5b2f7ada7a02851f44b51bd4008bceacbf9700576a474e6732e3c03c2","scripts/codeoutline/lang/csharp.lua":"36ac648b8691c85b8c75d5bcb146fcdfc87992a278e4798f3eb194124e3df2bb","codeoutline":"8d00b52027511d56136c8bd345666d2a14ad49591313c80a016d6032f708c02b","keys/update-public.pem":"7ff853339e19631b20ed3fa2cf221daa31c581e2e84d161b344b8f06de6562a8","scripts/codeoutline/control.lua":"1dfbea9f1397d9fb3c321c48a8d8ee7fc7928e864588226e55247bd548255bb4","keys/update-ca.crt":"d9b5ec3d4628de9c5559871f39841a5f84d47c53ded4d58d6e3bba2b4c669a02","scripts/codeoutline/lang/go.lua":"f5717cbeabe6d30dad72c473fa445480d7fb6b5546bb262e5f4c46185f0959da","scripts/xupgate/client.lua":"4bcefd14802f5d44c7c7e5b5aeda25247957212605f426da8c9dfb84ed7f9758","licenses/xnet2lua.txt":"1aa8af3df70f60f1ebf2d23e14c27af1606057ad9c32a9a0d15fd76cff257532","scripts/codeoutline/explore.lua":"d9e4e0d0179d00205df96ad0e7442e7bbc87e27481e6d27eb772ca302b5f35d3","licenses/libdeflate.txt":"41b60f2caab6bffdd5ba360687bd23ca653c0a1235c00380ecffc939b4cd8d75","scripts/codeoutline/lang/java.lua":"435b6ddcd231679db9e705a604344a3fb6c00b84cc20b2ecd210423ee0b376a6","scripts/xupgate/common.lua":"7eb979277887dfae16b325ffdab493673f01b96d00b9c1de11d8aca297368752","scripts/codeoutline/graph.lua":"1ef35f2e92e9db3bbe9b612bb0cb336a9b57b440c9a066e7ba3ef81574326834","scripts/codeoutline/lang/js.lua":"7a25a195356deeef7da3fdaf6e8a483b2a3a230cae3064e5dde2a3556fdcbda9","scripts/xupgate/http_client.lua":"a189506c3d0fcc454f5e001fdeecdd6349a1019ea0970d11ce2fbfdf035166d6","scripts/codeoutline/http.lua":"33802130445b348ce607e9891d4a9789d34b18338bf5d296f56e0b3c7b0c5493","codeoutline.cmd":"6414f7fac4c7e384d5b8e9e5e8a89731f7950b48dbe08bcbe149c1a70dbc4407","scripts/codeoutline/lang/lua.lua":"33b038192425e4db29251674e30c73b7a1af849789c49ff6430ee409c062f812","DISTRIBUTION.md":"da25de66601fe22f19ee35a61b5880a1bc65c4ca81bafefb9c46fdbbfb3436da","scripts/xupgate/http_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/index.lua":"08c585a7cb264962ac04beb3bf5bc8a9dd22b4f85644b6fdd6a4e527843fbee9","scripts/codeoutline/path.lua":"407bd960c1ad04e5006b321ce33263393bb40eee5dee5c123be9b36d3ad10937","README.md":"a1757e831f9d60d14cf318bd47cf8d9481a3e65b7bf99922064445d5d4913c89","scripts/codeoutline/lang/python.lua":"f7219c04914673ee6bae387c222b09acd433596c746237bdd6650a4f4087b17c","README.zh-CN.md":"4c2ff0fe0b73b3052f067926e45f9f9792571d9d529c731567b2c0d3b1d2c844","scripts/xupgate/proxy.lua":"5bf532e7005f44555d6a5277336e5ad395af060585c13a1cdc2441de50e0dcff","scripts/codeoutline/index_worker.lua":"47f80807a458d5c706b1a54f60fb2200ae51f022b21d9039df44611035e9ac40","scripts/codeoutline/service.lua":"597c435309abc0d8149b5e88095896c3bba6516146fd587d53b4b6fbf23a553c","THIRD_PARTY.md":"a70238f26ec05b7be4b813fa49c337cfb4d3cd64c36fcd27401d121e0e6e38df","scripts/codeoutline/lang/rust.lua":"f7c21751b1ab08512a406f45bd53546dddfa98ff680b1374d29a4152ae110023","licenses/mbedtls.txt":"9b405ef4c89342f5eae1dd828882f931747f71001cfba7d114801039b52ad09b","scripts/xupgate/signature.lua":"f07de8a4093d08cc69d3c1d8296d23318c5d81344ece788d4453a9b3b700f000","licenses/rpmalloc.txt":"f6c10eb9ec349900767c3dcb8bc71fe4fba2aefea329f05e2608827188016c0f","scripts/codeoutline/text.lua":"75f9af87ff5ce62def74f69d8972a6b11ff660723fc5cf515369ee3012ff0675","licenses/lua-cmsgpack.txt":"8edfdc5282278a1268d8a6ee52f9245f1a5fe3d1c8065be00330196b1de49873","scripts/codeoutline/main.lua":"287c48d3006bf94fcf84e5e14b9a0a7379857c450f05bd850e3cb29119615d90","licenses/luajit.txt":"1b10a02c9474cb908da2d87bc908edd8798f9ad28d9a8c53fbd05c13227f7394","LICENSE":"1b63179362acd482b4a9a07ca526b3fce6d9103dcded361de2159ade174568b6","lib/xhttp_codec.lua":"a5b0f127105ba6dbd4a518a214ca55e22c7510e6b2fc8c25c325898d8346ef8c","scripts/codeoutline/updater.lua":"772b097af670f2d61fb92e51b9862c2964f90cd911b7720c6b1ae6906082b7f0","scripts/codeoutline/cli.lua":"ba996c3c3def65aab08ba60141a7a98a19dfcc1bbe004ab5d8ea14a7f9f9a08b","scripts/codeoutline/mcp.lua":"f14a2d0b9625544ad32309358121a5ff304839780f52d5c1c8ec548d56c5e901","bin/xnet.exe":"33ecdb8cd80d3df1bf610dd3d0ba89c0010f408626860645c82620eb5db2e3fd","scripts/codeoutline/xscan.lua":"508d1fdccee4e856e0f198992bec45d7c8a9a3c191e0a5f71717741db9e00325"},"updateSequence":3,"note":"Release build from a clean checkout","target":"win32-x64","lua":"LuaJIT 2.1.1774896198","sourceCommit":"9a786639b6cfb46257bec1ff45fe038063270ed3","runtimeCommit":"f2c3ddfcbd3f04d7dd71543d0878d06e033519a0"}
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
- {"name":"@codua/codeoutline-win32-x64","publishConfig":{"access":"public"},"description":"CodeOutline native runtime and Lua implementation for win32-x64","cpu":["x64","arm64"],"license":"BSD-2-Clause","repository":{"type":"git","url":"git+https://github.com/1dao/codeoutline.git"},"files":["bin/","lib/","keys/","scripts/","licenses/","LICENSE","codeoutline","codeoutline.cmd","build-info.json","*.md"],"version":"0.1.3","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"]}
@@ -43,6 +43,7 @@ end
43
43
  local shared = assert(xshared.create('codeoutline_control', 65536, 256))
44
44
  local jobs, next_id, job_count, worker_ready = {}, 0, 0, false
45
45
  local endpoint, stdio, input = nil, nil, ''
46
+ local updating = false
46
47
  local startup = xtimer.now_ms()
47
48
 
48
49
  local function submit(req, done)
@@ -67,6 +68,10 @@ return {
67
68
  __init = function()
68
69
  assert(xnet.init())
69
70
  assert(xthread.create_thread(2, 'INDEX', scripts .. '/codeoutline/index_worker.lua'))
71
+ -- Launchers enable this for serve. Updating never delays or blocks requests.
72
+ if os.getenv('CODEOUTLINE_AUTO_UPDATE') == '1' then
73
+ updating = xthread.create_thread(3, 'UPDATE', scripts .. '/codeoutline/update_worker.lua') and true
74
+ end
70
75
  if options.STDIO == '1' then
71
76
  assert(xutils.read_stdin, 'Rebuild runtime for nonblocking stdin support')
72
77
  stdio = mcp.new(config, submit, cancel)
@@ -96,6 +101,10 @@ return {
96
101
  elseif op == 'worker_result' then
97
102
  local job = jobs[id]
98
103
  if job then jobs[id], job_count = nil, job_count - 1; job.done(ok, result) end
104
+ elseif op == 'update_result' then
105
+ -- Arguments: error, installed version (nil when already current).
106
+ if id then notice('update unavailable: ' .. tostring(id))
107
+ elseif ok then notice('update ' .. tostring(ok) .. ' installed; restart to use it') end
99
108
  end
100
109
  end,
101
110
  __update = function()
@@ -127,6 +136,7 @@ return {
127
136
  if stdio then stdio:close() end
128
137
  if endpoint then endpoint.close() end
129
138
  xthread.shutdown_thread(2)
139
+ if updating then xthread.shutdown_thread(3) end
130
140
  xnet.uninit()
131
141
  end,
132
142
  }
@@ -0,0 +1 @@
1
+ return 5
@@ -0,0 +1,20 @@
1
+ -- Background update thread: network, verification and installation stay off the
2
+ -- service thread. An installed update applies to the next launch.
3
+ local source = assert(xutils.realpath(debug.getinfo(1, 'S').source:sub(2))):gsub('\\', '/')
4
+ local scripts = assert(source:match('^(.*)/codeoutline/[^/]+$'))
5
+ package.path = scripts .. '/?.lua;' .. package.path
6
+ local updater = require('codeoutline.updater')
7
+
8
+ return {
9
+ __init = function()
10
+ assert(xnet.init()); xtimer.init(16)
11
+ local ok, err = pcall(function()
12
+ require('xupgate.client').open(updater.config()).update(function(update_error, result)
13
+ xthread.post(1, 'update_result', update_error, result and result.version)
14
+ end)
15
+ end)
16
+ if not ok then xthread.post(1, 'update_result', tostring(err)) end
17
+ end,
18
+ __uninit = function() xnet.uninit() end,
19
+ __thread_handle = function() end,
20
+ }
@@ -4,7 +4,7 @@ local install=assert(source:match('^(.*)/scripts/codeoutline/[^/]+$'))
4
4
  package.path=install .. '/scripts/?.lua;' .. package.path
5
5
  local c,u=require('xupgate.common'),require('xutils')
6
6
  local M={}
7
- local function config(options)
7
+ function M.config(options)
8
8
  options=options or {}
9
9
  local build=c.decode_json(c.read(install .. '/build-info.json')) or {}
10
10
  local home=os.getenv('USERPROFILE') or os.getenv('HOME')
@@ -19,6 +19,7 @@ local function 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'))
@@ -40,7 +41,7 @@ local function config(options)
40
41
  return cfg
41
42
  end
42
43
  function M.run(action,options)
43
- local api=require('xupgate.client').open(config(options))
44
+ local api=require('xupgate.client').open(M.config(options))
44
45
  local function selected()
45
46
  local ok,current=pcall(api.current)
46
47
  if not ok then io.stderr:write('codeoutline: installed update invalid; using initial version\n')end
@@ -48,7 +49,6 @@ function M.run(action,options)
48
49
  end
49
50
  local function finish(err,result)
50
51
  if action=='select' then
51
- if err then io.stderr:write('codeoutline: update unavailable; using local version\n')end
52
52
  io.write(selected(),'\n');io.stdout:flush();xthread.stop(0)
53
53
  else
54
54
  io.write(assert(u.json_pack({ok=not err,error=err,result=result})),'\n');io.stdout:flush();xthread.stop(err and 1 or 0)
@@ -56,7 +56,8 @@ function M.run(action,options)
56
56
  end
57
57
  return {__init=function()
58
58
  assert(xnet.init());xtimer.init(16)
59
- if action=='select' and os.getenv('CODEOUTLINE_AUTO_UPDATE')~='1' then finish(nil)
59
+ -- Selection is local only; serve updates in its background thread.
60
+ if action=='select' then finish(nil)
60
61
  elseif action=='rollback' then
61
62
  local ok,result=pcall(api.rollback)
62
63
  if not ok and tostring(result):find('no previous version',1,true)then ok,result=pcall(api.use_initial)end
@@ -1 +1 @@
1
- return '0.1.3'
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