arcane-os 0.89.0 → 0.91.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/docs/reference/ai/browser-decisions.md +45 -18
- package/docs/reference/core-native-packaging.md +5 -0
- package/docs/reference/core-repositories.md +58 -6
- package/docs/reference/git-text-snapshot.md +16 -1
- package/docs/reference/inventory/package-api.json +17 -17
- package/docs/reference/local-ai.md +22 -6
- package/docs/reference/model-assets.md +63 -24
- package/docs/reference/native-decisions.md +19 -4
- package/docs/reference/sdk-api.md +111 -22
- package/package.json +1 -1
- package/src/browser-decisions-distribution.mjs +95 -0
- package/src/core/repositories.mjs +7 -6
- package/src/core/services/model-assets.mjs +256 -76
- package/src/git-text-snapshot.mjs +4 -2
- package/src/packager/core.mjs +29 -2
- package/src/repository.mjs +33 -8
- package/src/workspace-runtime.mjs +1 -79
|
@@ -179,10 +179,25 @@ create a fresh projection from the stored originals before loading again.
|
|
|
179
179
|
## Existing upstream preparation
|
|
180
180
|
|
|
181
181
|
`model` selects the upstream Hugging Face repository and `revision` its
|
|
182
|
-
revision.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
revision. On explicit `load()`, the existing model-assets owner reuses complete
|
|
183
|
+
native acquisitions under the selected `workingDirectory/model-assets/`, or
|
|
184
|
+
fetches the complete selected members concurrently when absent. Complete
|
|
185
|
+
acquisitions survive unload, disposal and application restart. Reuse matches
|
|
186
|
+
the entire ordered original path/URL selection; it never substitutes another
|
|
187
|
+
model, revision, precision or device. Supplied projections and caller-owned
|
|
188
|
+
`paths` retain their existing precedence and lifecycle.
|
|
189
|
+
|
|
190
|
+
Ordinary preparation reuses the selected URLs without checking whether mutable
|
|
191
|
+
upstream content changed. Explicit reacquisition is available through native
|
|
192
|
+
[`modelAssets.prepare({refresh:true,...})`](model-assets.md#native-ownership),
|
|
193
|
+
whose ready projection can be supplied through the existing
|
|
194
|
+
`assetProjectionId`/`resourcePaths` contract. It preserves earlier complete
|
|
195
|
+
acquisitions and active native retains. Incomplete attempts are not reused or
|
|
196
|
+
resumed; separate processes may perform duplicate acquisitions in disjoint
|
|
197
|
+
directories. The shared model-assets owner handles storage without an
|
|
198
|
+
application-local cache copy or a second model store.
|
|
199
|
+
|
|
200
|
+
The approved `@huggingface/tokenizers@0.2.0` dependency reads the
|
|
186
201
|
selected tokenizer files in its Worker. No Transformers or second ONNX runtime
|
|
187
202
|
is loaded by this API.
|
|
188
203
|
|
|
@@ -1044,6 +1044,25 @@ ordinary browser output remain unchanged. See
|
|
|
1044
1044
|
[native-module package output](protocols.md#native-module-package-output)
|
|
1045
1045
|
for resource handling and the static transformation boundary.
|
|
1046
1046
|
|
|
1047
|
+
`browserDecisions` defaults to `false`. Explicit `browserDecisions: true`
|
|
1048
|
+
acquires the bundled Transformers.js 4.3.0 entry, matching ONNX Runtime
|
|
1049
|
+
1.31.0-dev.20260914-8d85527a0 asyncify module/WASM and both licenses into
|
|
1050
|
+
the package stage beside the selected SDK `ai/browser-decisions.mjs`, under
|
|
1051
|
+
`decisions-runtime/`. Installed-package routes retain their configured
|
|
1052
|
+
dependency path, including aliases; source and installed dependencies remain
|
|
1053
|
+
unchanged, with no workspace-root `arcane/` projection. The selected SDK decision
|
|
1054
|
+
module must be included in the package. Acquisition happens after native-module
|
|
1055
|
+
and asset rewriting, preserving upstream content unchanged in both module
|
|
1056
|
+
formats. The distribution joins the returned and release-manifest inventories
|
|
1057
|
+
and any enabled PWA's ordinary offline selection. The default and dry runs
|
|
1058
|
+
perform no optional acquisition; dry runs report selected inputs. Repeat this
|
|
1059
|
+
option on each package build that should acquire the closure. Cancellation and
|
|
1060
|
+
HTTP or observer failures abort/join acquisition before stage cleanup and
|
|
1061
|
+
preserve previous output. The existing `workspace.decisions.started` and
|
|
1062
|
+
`workspace.decisions.progress` events report file progress. See the
|
|
1063
|
+
[extension-local decision guide](ai/browser-decisions.md#extension-local-executables-manifest-v3)
|
|
1064
|
+
for `runtime.local: true`, upstream versions and complete error details.
|
|
1065
|
+
|
|
1047
1066
|
An operation may override `outputDirectory` without changing the saved app
|
|
1048
1067
|
configuration. For example, package a complete application beneath an
|
|
1049
1068
|
application-owned extension manifest and launcher:
|
|
@@ -1875,6 +1894,11 @@ module/WASM and license files from their upstream distributions into
|
|
|
1875
1894
|
`transformersVersion`, `onnxRuntimeVersion` and `files` under
|
|
1876
1895
|
`workspaceRuntime.browserDecisions`. The default `false` performs no optional
|
|
1877
1896
|
acquisition. Select this option on each refresh that should retain those files.
|
|
1897
|
+
For applications with installed-package routes, use
|
|
1898
|
+
`packageApp({workspaceRoot, appId, browserDecisions: true})` to place the
|
|
1899
|
+
distribution beside the actual deployed SDK module. This physical materializer
|
|
1900
|
+
continues to own only the separate `arcane/` projection; it does not populate or
|
|
1901
|
+
modify `node_modules`.
|
|
1878
1902
|
The [extension-local decision guide](ai/browser-decisions.md#extension-local-executables-manifest-v3)
|
|
1879
1903
|
describes `runtime.local: true`, complete resource ownership and MV3 usage.
|
|
1880
1904
|
|
|
@@ -3831,12 +3855,21 @@ async repositoryPull({ workspaceRoot=process.cwd(), target, signal, onEvent, run
|
|
|
3831
3855
|
|
|
3832
3856
|
Import it from `arcane-os`. The signature above states whether settlement is synchronous or promise-based. The overview and owning group define result authority, side effects, callbacks, events, cancellation, and lifecycle.
|
|
3833
3857
|
|
|
3834
|
-
Optional `target:{remote,ref}` captures exact nonempty
|
|
3835
|
-
strings before any wait and selects
|
|
3858
|
+
Optional `target:{remote,ref,remoteBase?}` captures the exact nonempty
|
|
3859
|
+
native-representable `remote` and `ref` strings before any wait and selects
|
|
3860
|
+
`git pull --ff-only -- <remote> <ref>:`.
|
|
3836
3861
|
The current clean branch receives a fast-forward-only integration; the SDK
|
|
3837
3862
|
never switches branches, resets or changes configuration. Without a target,
|
|
3838
3863
|
the existing configured pull and result remain unchanged. Targeted results
|
|
3839
3864
|
add `target`, complete `stdout` and `stderr` to the existing pull result.
|
|
3865
|
+
|
|
3866
|
+
Supplying `target.remoteBase` explicitly selects a local filesystem locator:
|
|
3867
|
+
only the Git remote argument becomes `path.resolve(remoteBase, remote)`, captured
|
|
3868
|
+
once at acceptance before status work. Relative bases, including `''`, use the
|
|
3869
|
+
working directory at that moment. The returned target retains the original
|
|
3870
|
+
`remote`, `ref` and supplied base text. Omission preserves Git remote names,
|
|
3871
|
+
URLs, SCP-like addresses and remote-helper strings without guessed parsing.
|
|
3872
|
+
Unrepresentable base text reports `TypeError` without transformation.
|
|
3840
3873
|
See [checkout configuration and selected targets](core-repositories.md#existing-checkout-configuration-and-selected-targets).
|
|
3841
3874
|
|
|
3842
3875
|
### Availability and normalization
|
|
@@ -3877,20 +3910,29 @@ detached HEAD, then, without `target`, runs plain `git push`; the repository's c
|
|
|
3877
3910
|
configured upstream/remote, Git credentials, hooks, and server policy remain
|
|
3878
3911
|
authoritative. Unlike `repositoryPull()`, this function does **not** require a
|
|
3879
3912
|
clean worktree. It does not create a commit or choose an application destination.
|
|
3880
|
-
Optional `target:{remote,ref}` captures the original nonempty
|
|
3881
|
-
native-representable strings before any wait and runs
|
|
3913
|
+
Optional `target:{remote,ref,remoteBase?}` captures the original nonempty
|
|
3914
|
+
native-representable `remote` and `ref` strings before any wait and runs
|
|
3882
3915
|
`git push --no-follow-tags -- <remote> HEAD:<ref>`. This publishes current HEAD
|
|
3883
3916
|
to the caller-selected ref without force or implicit configured tag following.
|
|
3884
3917
|
It changes no branch or Git configuration; credentials, URL interpretation,
|
|
3885
3918
|
hooks and remote rejection remain Git-owned.
|
|
3886
3919
|
|
|
3920
|
+
Supplying `target.remoteBase` explicitly selects a local filesystem locator:
|
|
3921
|
+
only the Git remote argument becomes `path.resolve(remoteBase, remote)`, captured
|
|
3922
|
+
once at acceptance before status work. Relative bases, including `''`, use the
|
|
3923
|
+
working directory at that moment. Later directory or target-object changes do
|
|
3924
|
+
not redirect accepted work. Omission preserves Git remote names, URLs, SCP-like
|
|
3925
|
+
addresses and remote-helper strings without guessed parsing. Unrepresentable
|
|
3926
|
+
base text reports `TypeError` without transformation.
|
|
3927
|
+
|
|
3887
3928
|
The promise resolves to
|
|
3888
3929
|
`{action:'push', repositoryRoot, branch, output}`. `output` is trimmed stdout,
|
|
3889
3930
|
or trimmed stderr when stdout is empty. A missing Git executable, failed status
|
|
3890
3931
|
probe, rejected/nonzero push, cancellation, or event-callback failure rejects
|
|
3891
3932
|
with the normalized process error. Cancellation stops the local process tree;
|
|
3892
3933
|
it cannot prove that a remote accepted no objects before the interruption.
|
|
3893
|
-
Targeted results also contain the captured `target
|
|
3934
|
+
Targeted results also contain the captured `target`, retaining original
|
|
3935
|
+
`remote`, `ref` and any supplied `remoteBase`, and complete
|
|
3894
3936
|
`stdout`/`stderr`; omitting the target preserves the existing result shape.
|
|
3895
3937
|
See [checkout configuration and selected targets](core-repositories.md#existing-checkout-configuration-and-selected-targets).
|
|
3896
3938
|
|
|
@@ -5367,7 +5409,7 @@ a dedicated bare Git cache. It does not create or alter a working checkout.
|
|
|
5367
5409
|
### Signature, lifecycle, and result
|
|
5368
5410
|
|
|
5369
5411
|
```text
|
|
5370
|
-
createGitTextSnapshot({cacheDirectory,remote,ref,selectPath,gitIdentity,onEvent,run=runProcess}={})
|
|
5412
|
+
createGitTextSnapshot({cacheDirectory,remote,remoteBase,ref,selectPath,gitIdentity,onEvent,run=runProcess}={})
|
|
5371
5413
|
```
|
|
5372
5414
|
|
|
5373
5415
|
Import from `arcane-os`. The application owns the cache location, remote, ref,
|
|
@@ -5379,6 +5421,16 @@ await accepted refresh/process cleanup. Errors remain observable instead of
|
|
|
5379
5421
|
returning stale or partial success. See [Git text snapshots](git-text-snapshot.md)
|
|
5380
5422
|
for complete inputs, text semantics, errors, events and Core service composition.
|
|
5381
5423
|
|
|
5424
|
+
Optional `remoteBase` explicitly selects `remote` as a local filesystem locator.
|
|
5425
|
+
Only its Git fetch argument is derived using `path.resolve(remoteBase, remote)`,
|
|
5426
|
+
once at construction, independently of the cache location and later changes to
|
|
5427
|
+
the working directory. Relative bases, including `''`, use the construction-time
|
|
5428
|
+
working directory. Original locator/options remain unchanged. Omission preserves
|
|
5429
|
+
Git remote names, URLs, SCP-like addresses and remote-helper strings without
|
|
5430
|
+
guessed parsing. Unrepresentable base text reports `TypeError` without
|
|
5431
|
+
transformation; actual Git failures retain their existing error behavior.
|
|
5432
|
+
See [relative local repository locators](core-repositories.md#relative-local-repository-locators).
|
|
5433
|
+
|
|
5382
5434
|
Optional `gitIdentity:{name?,email?,username?}` captures a child-process-only
|
|
5383
5435
|
selection for init/fetch and subsequent Git commands, preserving shared refresh
|
|
5384
5436
|
cancellation and complete content. See [Git identity configuration](core-repositories.md#git-identity-configuration)
|
|
@@ -8348,7 +8400,7 @@ explicit existing path. The application owns the remote, branch and Core API.
|
|
|
8348
8400
|
### Signature and result
|
|
8349
8401
|
|
|
8350
8402
|
```text
|
|
8351
|
-
createRepositoryWorkspace({name,directory,dataRoot,remote,branch,longPaths,cloneIdentity,gitIdentity,onEvent,run=runProcess}={})
|
|
8403
|
+
createRepositoryWorkspace({name,directory,dataRoot,remote,remoteBase,branch,longPaths,cloneIdentity,gitIdentity,onEvent,run=runProcess}={})
|
|
8352
8404
|
```
|
|
8353
8405
|
|
|
8354
8406
|
Returns `{directory,open,status,configuration,pull,push,write,close,drain,dispose}`. Construction does
|
|
@@ -8359,6 +8411,16 @@ work and preserves the checkout. No CLI cwd, launch state, preference, snapshot
|
|
|
8359
8411
|
cache or existing user-data location changes. See the [complete inputs, results,
|
|
8360
8412
|
errors and lifecycle](core-repositories.md#one-connected-working-checkout).
|
|
8361
8413
|
|
|
8414
|
+
Optional factory `remoteBase` explicitly selects the initial-clone `remote` as
|
|
8415
|
+
a local filesystem locator. Only its Git argument is derived through the host's
|
|
8416
|
+
native `path.resolve(remoteBase, remote)`, once at construction. Relative bases,
|
|
8417
|
+
including `''`, use the construction-time working directory. The caller's
|
|
8418
|
+
original locator remains unchanged; Git clone may save the derived argument as
|
|
8419
|
+
its ordinary origin setting. Omission preserves Git remote names, URLs, SCP-like
|
|
8420
|
+
addresses and remote-helper strings without guessed parsing. Unrepresentable
|
|
8421
|
+
base text reports `TypeError` without transformation.
|
|
8422
|
+
See [relative local repository locators](core-repositories.md#relative-local-repository-locators).
|
|
8423
|
+
|
|
8362
8424
|
Optional `longPaths` captures a boolean for new Windows clones. Explicit true
|
|
8363
8425
|
or false supplies clone-local `core.longpaths` before the first checkout and
|
|
8364
8426
|
persists it only in the new repository. Omission preserves inherited/template
|
|
@@ -8394,11 +8456,15 @@ reports `ARCANE_GIT_CONFIGURATION_NOT_TEXT` with full diagnostics.
|
|
|
8394
8456
|
|
|
8395
8457
|
`pull({target,signal})`, `push({target,signal})` and
|
|
8396
8458
|
`write({files:[{path,content}],message,target,signal})` accept optional
|
|
8397
|
-
`target:{remote,ref}`, captured as original strings at acceptance. The target
|
|
8459
|
+
`target:{remote,ref,remoteBase?}`, captured as original strings at acceptance. The target
|
|
8398
8460
|
selects a fast-forward-only pull into the current branch or a non-force push
|
|
8399
8461
|
of current HEAD to the selected ref, without switching branches or changing
|
|
8400
|
-
configuration.
|
|
8401
|
-
|
|
8462
|
+
configuration. An operation's own `remoteBase` declares local-path intent and
|
|
8463
|
+
captures the native absolute Git argument once at acceptance, before queueing.
|
|
8464
|
+
It is independent of initial-clone `remote`/`remoteBase`/`branch`; omission of
|
|
8465
|
+
`target` preserves ordinary configured behavior. Targeted pull/push results and
|
|
8466
|
+
writer results/failure outcomes retain original `remote`, `ref` and any supplied
|
|
8467
|
+
`remoteBase`, including relative or empty base text. See the [complete configuration and
|
|
8402
8468
|
target contract](core-repositories.md#existing-checkout-configuration-and-selected-targets).
|
|
8403
8469
|
|
|
8404
8470
|
`write` snapshots the exact selected
|
|
@@ -8970,14 +9036,22 @@ directory and complete member files.
|
|
|
8970
9036
|
|
|
8971
9037
|
`current()` returns `{closing,projections}`. `retain(id)` accepts a completed
|
|
8972
9038
|
projection and returns `{id,directory,members,release}` for a native owner.
|
|
8973
|
-
Native `prepare({id,workingDirectory,members,signal,onProgress})`
|
|
8974
|
-
ordered `{path,url}` members and returns their ready projection.
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
9039
|
+
Native `prepare({id,workingDirectory,members,signal,onProgress,refresh=false})`
|
|
9040
|
+
accepts ordered `{path,url}` members and returns their ready projection.
|
|
9041
|
+
Complete native acquisitions persist beneath `workingDirectory/model-assets/`
|
|
9042
|
+
through unload, disposal and restart; ordinary calls reuse the exact complete
|
|
9043
|
+
ordered source selection without a network freshness check. Explicit
|
|
9044
|
+
`refresh:true` acquires a separate complete set without replacing active files.
|
|
9045
|
+
Independent members transfer concurrently and progress reports phases and
|
|
9046
|
+
completed files. Matching same-process preparations share acquisition with
|
|
9047
|
+
independent callbacks and cancellation; the last interested cancellation joins
|
|
9048
|
+
unfinished I/O and removes only that attempt. Separate processes may acquire
|
|
9049
|
+
the same selection independently. Startup downloads nothing.
|
|
9050
|
+
`release(id)` relinquishes live preparation ownership. Native retains continue
|
|
9051
|
+
through actual engine release; completed native acquisitions remain stored.
|
|
9052
|
+
Browser `open/write/complete` projections retain their temporary lifetime and
|
|
9053
|
+
are removed only after all native uses end. See
|
|
9054
|
+
[native preparation](model-assets.md#native-ownership).
|
|
8981
9055
|
`dispose()` releases preparation ownership and joins file writes, closes and
|
|
8982
9056
|
all native retain lifetimes before cleanup. The native owner releases its
|
|
8983
9057
|
handle only after its actual context/worker use ends. Original stored model
|
|
@@ -9003,7 +9077,7 @@ import createLocalAIService from 'arcane-os/core/local-ai';
|
|
|
9003
9077
|
|
|
9004
9078
|
### Overview
|
|
9005
9079
|
|
|
9006
|
-
Reuses matching managed runtimes or installs complete selected
|
|
9080
|
+
Reuses matching managed runtimes or installs complete selected
|
|
9007
9081
|
llama.cpp/Ollama/ONNX/image distributions or NeMo libraries in an explicitly supplied directory.
|
|
9008
9082
|
|
|
9009
9083
|
### Signature and result
|
|
@@ -9016,14 +9090,22 @@ Import it from `arcane-os/local-ai`. Runtime requirements accept IDs or
|
|
|
9016
9090
|
`{id,version?,url?}` records. The result is an array of absolute
|
|
9017
9091
|
`{id,version,platform,architecture,root}` records, with `executable` for servers,
|
|
9018
9092
|
`modulePath` for ONNX, image `libraryPath`/`bindingModulePath`/`variants`/`models`,
|
|
9019
|
-
or NeMo library directories.
|
|
9093
|
+
or NeMo library directories. The SDK-selected Windows x64 ONNX `1.30.0`
|
|
9094
|
+
distribution also returns `nativeDistributionRevision: '1.30.0-directml-reshape-1'`.
|
|
9095
|
+
With no explicit `url`, an omitted ONNX version or explicit `1.30.0` selects
|
|
9096
|
+
the corrected native archive from the installed SDK's numeric release.
|
|
9097
|
+
Other ONNX versions, platforms/architectures and explicit URLs retain their
|
|
9098
|
+
upstream package path. Reuse requires the selected revision; older installation
|
|
9099
|
+
trees remain intact while a fresh installation is prepared. See
|
|
9100
|
+
[ONNX runtime preparation](local-ai.md#development).
|
|
9101
|
+
Image requirements also accept `backend` and
|
|
9020
9102
|
`models`; their pinned default runtime, CPU/Metal selection and separate model
|
|
9021
9103
|
preparation are described in [local image generation](local-image-generation.md).
|
|
9022
9104
|
Matching concurrent
|
|
9023
9105
|
installs share their work. Downloads retain runtime libraries and surface
|
|
9024
9106
|
network/archive failures; cancellation and operation events remain observable.
|
|
9025
9107
|
Installation changes no global PATH or system service and loads no model.
|
|
9026
|
-
Supported assets belong to the selected
|
|
9108
|
+
Supported assets belong to the selected distribution; see
|
|
9027
9109
|
[platform and archive requirements](local-ai.md#native-bundling).
|
|
9028
9110
|
|
|
9029
9111
|
```javascript
|
|
@@ -9057,6 +9139,11 @@ contains the complete emitted inventory. Existing runtime destinations are
|
|
|
9057
9139
|
preserved and reported as a conflict. Copying settles all started work and
|
|
9058
9140
|
reports failures/cancellation without executing app services or models.
|
|
9059
9141
|
|
|
9142
|
+
The corrected Windows x64 ONNX selection retains its
|
|
9143
|
+
`nativeDistributionRevision` and complete native libraries. Its `modulePath`
|
|
9144
|
+
is relocated with the other runtime paths; bundling introduces no separate
|
|
9145
|
+
runtime selection. See [ONNX runtime preparation](local-ai.md#development).
|
|
9146
|
+
|
|
9060
9147
|
Image records relocate the complete library, binding and variant paths. Model
|
|
9061
9148
|
URL descriptors retain their original acquisition metadata for preparation
|
|
9062
9149
|
after launch. Runtime-contained native model paths become artifact-relative;
|
|
@@ -10091,7 +10178,9 @@ Cancellation terminates that client's Worker and rejects its in-flight work.
|
|
|
10091
10178
|
No decisions are inserted into chat history or durable storage.
|
|
10092
10179
|
|
|
10093
10180
|
For explicitly selected extension-local execution, supply `runtime: {local:
|
|
10094
|
-
true}` after
|
|
10181
|
+
true}` after `packageApp({workspaceRoot, appId, browserDecisions: true})` for
|
|
10182
|
+
installed-package routes, or after opting into the existing physical runtime
|
|
10183
|
+
materializer. The SDK directly
|
|
10095
10184
|
imports its deployment-local `decisions-runtime/transformers.min.js` and
|
|
10096
10185
|
matched asyncify module/WASM. Explicit `runtime.moduleUrl` and
|
|
10097
10186
|
`runtime.wasmPaths: {mjs, wasm}` may select other compatible files in that same
|
package/package.json
CHANGED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import Is from 'strong-type';
|
|
2
|
+
import {mkdir, writeFile} from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
const is = new Is(false);
|
|
6
|
+
|
|
7
|
+
function throwIfAborted(signal) {
|
|
8
|
+
if (!signal?.aborted) return;
|
|
9
|
+
const error = signal.reason instanceof Error ? signal.reason : new Error('Operation cancelled.');
|
|
10
|
+
error.code = error.code || 'ARCANE_CANCELLED';
|
|
11
|
+
throw error;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function emit(onEvent, event) {
|
|
15
|
+
if (is.function(onEvent)) await onEvent(event);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function materializeBrowserDecisions(destination, signal, onEvent) {
|
|
19
|
+
const transformers = 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0/';
|
|
20
|
+
const onnx = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/';
|
|
21
|
+
const files = [
|
|
22
|
+
{name: 'transformers.min.js', url: `${transformers}dist/transformers.min.js`},
|
|
23
|
+
{name: 'ort-wasm-simd-threaded.asyncify.mjs', url: `${onnx}dist/ort-wasm-simd-threaded.asyncify.mjs`},
|
|
24
|
+
{name: 'ort-wasm-simd-threaded.asyncify.wasm', url: `${onnx}dist/ort-wasm-simd-threaded.asyncify.wasm`},
|
|
25
|
+
{name: 'TRANSFORMERS-LICENSE', url: `${transformers}LICENSE`},
|
|
26
|
+
{name: 'ONNX-RUNTIME-LICENSE', url: `${onnx}LICENSE`}
|
|
27
|
+
];
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
function cancelDistribution() {
|
|
30
|
+
controller.abort(signal.reason);
|
|
31
|
+
}
|
|
32
|
+
signal?.addEventListener('abort', cancelDistribution, {once: true});
|
|
33
|
+
if (signal?.aborted) cancelDistribution();
|
|
34
|
+
let completed = 0;
|
|
35
|
+
try {
|
|
36
|
+
throwIfAborted(controller.signal);
|
|
37
|
+
await emit(
|
|
38
|
+
onEvent,
|
|
39
|
+
{type: 'workspace.decisions.started', completed, total: files.length}
|
|
40
|
+
);
|
|
41
|
+
throwIfAborted(controller.signal);
|
|
42
|
+
await mkdir(destination, {recursive: true});
|
|
43
|
+
async function acquireDistributionFile(file) {
|
|
44
|
+
try {
|
|
45
|
+
throwIfAborted(controller.signal);
|
|
46
|
+
const response = await fetch(file.url, {signal: controller.signal});
|
|
47
|
+
const content = new Uint8Array(await response.arrayBuffer());
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
const error = new Error(`Browser decision distribution returned HTTP ${response.status} ${response.statusText}.`);
|
|
50
|
+
error.code = 'ARCANE_DECISION_DISTRIBUTION_DOWNLOAD_FAILED';
|
|
51
|
+
error.response = {
|
|
52
|
+
url: response.url,
|
|
53
|
+
status: response.status,
|
|
54
|
+
statusText: response.statusText,
|
|
55
|
+
headers: [...response.headers],
|
|
56
|
+
content
|
|
57
|
+
};
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
throwIfAborted(controller.signal);
|
|
61
|
+
// Upstream distribution content is opaque, including its own
|
|
62
|
+
// imports and license text. No SDK source rewriting applies.
|
|
63
|
+
await writeFile(path.join(destination, file.name), content);
|
|
64
|
+
throwIfAborted(controller.signal);
|
|
65
|
+
completed += 1;
|
|
66
|
+
await emit(
|
|
67
|
+
onEvent,
|
|
68
|
+
{type: 'workspace.decisions.progress', file: file.name, url: file.url, completed, total: files.length}
|
|
69
|
+
);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
controller.abort(error);
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// One fixed distribution, acquired once for the selected projection or
|
|
76
|
+
// package; no model/app/architecture multiplier or installation script.
|
|
77
|
+
const outcomes = await Promise.allSettled(files.map(acquireDistributionFile));
|
|
78
|
+
const failures = new Set();
|
|
79
|
+
for (const outcome of outcomes) {
|
|
80
|
+
if (outcome.status === 'rejected') failures.add(outcome.reason);
|
|
81
|
+
}
|
|
82
|
+
if (failures.size === 1) throw [...failures][0];
|
|
83
|
+
if (failures.size > 1) {
|
|
84
|
+
throw new AggregateError([...failures], 'Browser decision distribution acquisition failed.');
|
|
85
|
+
}
|
|
86
|
+
throwIfAborted(controller.signal);
|
|
87
|
+
} finally {
|
|
88
|
+
signal?.removeEventListener('abort', cancelDistribution);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
transformersVersion: '4.3.0',
|
|
92
|
+
onnxRuntimeVersion: '1.31.0-dev.20260914-8d85527a0',
|
|
93
|
+
files: files.map(function distributionFilename(file) { return file.name; })
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import Is from 'strong-type';
|
|
5
5
|
import {ArcaneError, throwIfAborted} from '../errors.mjs';
|
|
6
6
|
import {runProcess} from '../process.mjs';
|
|
7
|
-
import {captureRepositoryTarget, repositoryConfiguration,
|
|
7
|
+
import {captureRepositoryRemote, captureRepositoryTarget, repositoryConfiguration, pullRepositoryTarget, pushRepositoryTarget,
|
|
8
8
|
repositoryPushArguments, repositoryStatus} from '../repository.mjs';
|
|
9
9
|
import {createGitIdentityRunner} from '../git-identity.mjs';
|
|
10
10
|
|
|
@@ -45,7 +45,7 @@ export function resolveArcaneDataPaths({dataRoot} = {}) {
|
|
|
45
45
|
|
|
46
46
|
/** One connected checkout, composed into an application's own Core service. */
|
|
47
47
|
export function createRepositoryWorkspace(
|
|
48
|
-
{name, directory, dataRoot, remote, branch, longPaths, cloneIdentity = {}, gitIdentity, onEvent, run = runProcess} = {}
|
|
48
|
+
{name, directory, dataRoot, remote, remoteBase, branch, longPaths, cloneIdentity = {}, gitIdentity, onEvent, run = runProcess} = {}
|
|
49
49
|
) {
|
|
50
50
|
let selected = directory;
|
|
51
51
|
if (selected === undefined) {
|
|
@@ -57,6 +57,7 @@ export function createRepositoryWorkspace(
|
|
|
57
57
|
}
|
|
58
58
|
requireString(selected, 'directory');
|
|
59
59
|
if (remote !== undefined) requireString(remote, 'remote');
|
|
60
|
+
const remoteArgument = captureRepositoryRemote(remote, remoteBase);
|
|
60
61
|
if (branch !== undefined) requireString(branch, 'branch');
|
|
61
62
|
if (longPaths !== undefined && !is.boolean(longPaths)) {
|
|
62
63
|
throw new TypeError('longPaths must be a boolean when supplied.');
|
|
@@ -119,7 +120,7 @@ export function createRepositoryWorkspace(
|
|
|
119
120
|
}
|
|
120
121
|
arguments_.push(...cloneConfiguration);
|
|
121
122
|
if (branch !== undefined) arguments_.push('--branch', branch);
|
|
122
|
-
arguments_.push('--',
|
|
123
|
+
arguments_.push('--', remoteArgument, repositoryDirectory);
|
|
123
124
|
const result = await prepareRun(
|
|
124
125
|
'git',
|
|
125
126
|
arguments_,
|
|
@@ -187,7 +188,7 @@ export function createRepositoryWorkspace(
|
|
|
187
188
|
return accept(
|
|
188
189
|
async function pullRepository() {
|
|
189
190
|
await prepare(signal);
|
|
190
|
-
return
|
|
191
|
+
return pullRepositoryTarget(selectedTarget, {workspaceRoot: repositoryDirectory, signal, onEvent, run: execute});
|
|
191
192
|
},
|
|
192
193
|
signal
|
|
193
194
|
);
|
|
@@ -200,7 +201,7 @@ export function createRepositoryWorkspace(
|
|
|
200
201
|
return accept(
|
|
201
202
|
async function pushRepository() {
|
|
202
203
|
await prepare(signal);
|
|
203
|
-
return
|
|
204
|
+
return pushRepositoryTarget(selectedTarget, {workspaceRoot: repositoryDirectory, signal, onEvent, run: execute});
|
|
204
205
|
},
|
|
205
206
|
signal
|
|
206
207
|
);
|
|
@@ -246,7 +247,7 @@ export function createRepositoryWorkspace(
|
|
|
246
247
|
async function writeRepositoryFiles() {
|
|
247
248
|
const outcome = {
|
|
248
249
|
directory: repositoryDirectory,
|
|
249
|
-
...(selectedTarget === undefined ? {} : {target: {...selectedTarget}}),
|
|
250
|
+
...(selectedTarget === undefined ? {} : {target: {...selectedTarget.target}}),
|
|
250
251
|
state: 'local',
|
|
251
252
|
stage: 'prepare',
|
|
252
253
|
paths: selectedFiles.map(function selectedPath(file) { return file.path; }),
|