arcane-os 0.1.0-dev.5 → 0.1.1
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/NOTICE +10 -0
- package/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json +162 -0
- package/browser-runtime/ai/ARCANE_AI_BROWSER_WASM_COMPONENTS.json +69 -0
- package/browser-runtime/ai/browser-wasm-llm-provider.mjs +1151 -0
- package/browser-runtime/ai/browser-wasm.mjs +44 -0
- package/browser-runtime/ai/browser-wllama-runtime.mjs +390 -0
- package/browser-runtime/ai/internal/sha256.mjs +166 -0
- package/browser-runtime/ai/model-controller.mjs +581 -0
- package/browser-runtime/ai/wllama/LICENCE +21 -0
- package/browser-runtime/ai/wllama/index.mjs +3494 -0
- package/browser-runtime/ai/wllama/llama.cpp-LICENSE +21 -0
- package/browser-runtime/ai/wllama/wllama.wasm +0 -0
- package/browser-runtime/dependencies/event-pubsub/index.js +141 -0
- package/browser-runtime/dependencies/event-pubsub/licence +21 -0
- package/browser-runtime/dependencies/event-pubsub/package.json +59 -0
- package/browser-runtime/dependencies/strong-type/index.js +1151 -0
- package/browser-runtime/dependencies/strong-type/licence +21 -0
- package/browser-runtime/dependencies/strong-type/package.json +61 -0
- package/browser-runtime/dom-event-instrumentation.mjs +594 -0
- package/browser-runtime/event-manager.mjs +1342 -0
- package/docs/publishing.md +65 -67
- package/docs/reference/README.md +2 -1
- package/docs/reference/cli.md +86 -3
- package/docs/reference/event-manager.md +20 -11
- package/docs/reference/inventory/package-api.json +1 -1
- package/docs/reference/protocols.md +112 -14
- package/docs/reference/sdk-api.md +40 -11
- package/docs/work-amplification.md +4 -3
- package/package.json +15 -8
- package/runtime/ARCANE_RUNTIME_RELEASE.json +1 -1
- package/schemas/arcane-lock.schema.json +97 -1
- package/src/cli/main.mjs +5 -0
- package/src/dev-server.mjs +78 -34
- package/src/doctor.mjs +77 -3
- package/src/import-map.mjs +2352 -0
- package/src/packager/core.mjs +607 -29
- package/src/scaffold.mjs +122 -5
- package/src/sdk-browser-runtime.mjs +702 -0
- package/src/targets/index.mjs +31 -4
- package/src/templates/workspace-template.mjs +141 -23
- package/src/toolchain.mjs +288 -55
- package/src/workspace-operation-lock.mjs +716 -0
- package/src/workspace-runtime.mjs +841 -0
- package/src/workspace.mjs +292 -37
|
@@ -50,9 +50,10 @@ format, or signing loop and does not produce app output.
|
|
|
50
50
|
|
|
51
51
|
- Scaffold: approximately 15-25 files, less than 100 KiB, target under one
|
|
52
52
|
second before an optional dependency installation.
|
|
53
|
-
- Shared browser payload:
|
|
54
|
-
155-file / 3,320,994-byte
|
|
55
|
-
/
|
|
53
|
+
- Shared browser payload: 166 files / 3,478,345 bytes, comprising the exact
|
|
54
|
+
155-file / 3,320,994-byte Arcane-upstream runtime receipt, the separate
|
|
55
|
+
8-file / 118,385-byte SDK browser-runtime receipt, and three SDK licensing
|
|
56
|
+
files / 38,966 bytes, verified once per exact SDK installation state.
|
|
56
57
|
- Small browser package: app bytes plus the shared runtime, copied and inventoried
|
|
57
58
|
once into an atomic staging directory.
|
|
58
59
|
- Portable build: one explicitly selected app and one host platform request. In
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arcane-os",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Arcane OS
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Arcane OS JavaScript SDK, project-local CLI, browser runtime, and repository-portable application packager.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.mjs",
|
|
7
7
|
"bin": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"./toolchain": "./src/toolchain.mjs",
|
|
14
14
|
"./events": "./src/events.mjs",
|
|
15
15
|
"./event-manager": "./src/event-manager.mjs",
|
|
16
|
+
"./ai/browser-wasm": "./browser-runtime/ai/browser-wasm.mjs",
|
|
16
17
|
"./testing": "./src/testing.mjs",
|
|
17
18
|
"./targets": "./src/targets/index.mjs",
|
|
18
19
|
"./native": "./src/native-plan.mjs",
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
},
|
|
34
35
|
"files": [
|
|
35
36
|
"bin/",
|
|
37
|
+
"browser-runtime/",
|
|
36
38
|
"src/",
|
|
37
39
|
"runtime/",
|
|
38
40
|
"schemas/",
|
|
@@ -45,11 +47,13 @@
|
|
|
45
47
|
],
|
|
46
48
|
"scripts": {
|
|
47
49
|
"test": "npm run test:unit && npm run test:functional && npm run test:integration && npm run test:regression",
|
|
48
|
-
"test:
|
|
49
|
-
"test:
|
|
50
|
-
"test:
|
|
50
|
+
"test:release": "node ./bin/arcane-test.mjs test/npm-release.test.mjs",
|
|
51
|
+
"test:unit": "node ./bin/arcane-test.mjs test/app-descriptor.test.mjs test/app-schema.test.mjs test/contracts.test.mjs test/doctor.test.mjs test/targets.test.mjs test/workspace-operation-lock.test.mjs",
|
|
52
|
+
"test:functional": "node ./bin/arcane-test.mjs test/cli.test.mjs test/dev-server.test.mjs test/dom-event-instrumentation.test.mjs test/event-manager.test.mjs test/events.test.mjs test/import-map.test.mjs test/packaging.test.mjs test/reference-completeness.test.mjs test/runtime-api-behavior.test.mjs test/runtime-sync.test.mjs test/runtime.test.mjs test/scaffold.test.mjs test/site.test.mjs test/update-check.test.mjs",
|
|
53
|
+
"test:integration": "node ./bin/arcane-test.mjs test/integrated-shared.test.mjs test/integrated-workspace.test.mjs test/native-plan.test.mjs test/native-provider-loader.test.mjs test/npm-release.test.mjs test/release-bundle.test.mjs test/release-capability-smoke.test.mjs test/shared-payload-batch.test.mjs test/tarball.test.mjs",
|
|
51
54
|
"test:regression": "node ./bin/arcane-test.mjs test/channel-workflows.test.mjs test/native-provider-generation.test.mjs test/testing.test.mjs test/test-sets.test.mjs",
|
|
52
|
-
"check": "node tools/check-source.mjs && node tools/runtime-manifest.mjs --verify && npm test",
|
|
55
|
+
"check": "node tools/check-source.mjs && node tools/runtime-manifest.mjs --verify && node tools/sdk-browser-runtime-manifest.mjs --verify && npm test",
|
|
56
|
+
"check:release": "node tools/check-source.mjs --package-only && node tools/runtime-manifest.mjs --verify && node tools/sdk-browser-runtime-manifest.mjs --verify && npm run test:release",
|
|
53
57
|
"runtime:verify": "node tools/runtime-manifest.mjs --verify",
|
|
54
58
|
"runtime:sync": "node tools/sync-runtime.mjs",
|
|
55
59
|
"pack:local": "npm pack --ignore-scripts",
|
|
@@ -81,7 +85,7 @@
|
|
|
81
85
|
"publishConfig": {
|
|
82
86
|
"access": "public",
|
|
83
87
|
"registry": "https://registry.npmjs.org/",
|
|
84
|
-
"tag": "
|
|
88
|
+
"tag": "latest"
|
|
85
89
|
},
|
|
86
90
|
"dependencies": {
|
|
87
91
|
"event-pubsub": "6.1.0",
|
|
@@ -91,5 +95,8 @@
|
|
|
91
95
|
"bundleDependencies": [
|
|
92
96
|
"event-pubsub",
|
|
93
97
|
"strong-type"
|
|
94
|
-
]
|
|
98
|
+
],
|
|
99
|
+
"devDependencies": {
|
|
100
|
+
"@wllama/wllama": "3.6.0"
|
|
101
|
+
}
|
|
95
102
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"schemaVersion",
|
|
10
10
|
"sdk",
|
|
11
11
|
"runtime",
|
|
12
|
+
"sdkBrowserRuntime",
|
|
12
13
|
"protocols"
|
|
13
14
|
],
|
|
14
15
|
"properties": {
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"const": "arcane-os"
|
|
28
29
|
},
|
|
29
30
|
"version": {
|
|
30
|
-
"const": "0.1.
|
|
31
|
+
"const": "0.1.1"
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
},
|
|
@@ -52,6 +53,101 @@
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
},
|
|
56
|
+
"sdkBrowserRuntime": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"required": [
|
|
60
|
+
"manifest",
|
|
61
|
+
"manifestSha256",
|
|
62
|
+
"contentSha256",
|
|
63
|
+
"builder",
|
|
64
|
+
"sdkVersion",
|
|
65
|
+
"source"
|
|
66
|
+
],
|
|
67
|
+
"properties": {
|
|
68
|
+
"manifest": {
|
|
69
|
+
"const": "node_modules/arcane-os/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json"
|
|
70
|
+
},
|
|
71
|
+
"manifestSha256": {
|
|
72
|
+
"const": "33396b3d35322b784929270e7ca0a2a8b31d899c6e77bcb227edc95b37d0ae7d"
|
|
73
|
+
},
|
|
74
|
+
"contentSha256": {
|
|
75
|
+
"const": "5e03f45a732db51cb5a2b2193cc79ecda34501d07a9b2e82e794e5fa37d55d00"
|
|
76
|
+
},
|
|
77
|
+
"builder": {
|
|
78
|
+
"const": "arcane-sdk-browser-runtime-v1"
|
|
79
|
+
},
|
|
80
|
+
"sdkVersion": {
|
|
81
|
+
"const": "0.1.1"
|
|
82
|
+
},
|
|
83
|
+
"source": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"additionalProperties": false,
|
|
86
|
+
"required": [
|
|
87
|
+
"authority",
|
|
88
|
+
"repository",
|
|
89
|
+
"protocol",
|
|
90
|
+
"browserEntry",
|
|
91
|
+
"dependencies"
|
|
92
|
+
],
|
|
93
|
+
"properties": {
|
|
94
|
+
"authority": {
|
|
95
|
+
"const": "arcane-os-sdk"
|
|
96
|
+
},
|
|
97
|
+
"repository": {
|
|
98
|
+
"const": "https://github.com/TheWizardNexus/arcane-os-sdk.git"
|
|
99
|
+
},
|
|
100
|
+
"protocol": {
|
|
101
|
+
"const": "arcane-sdk-browser-runtime/1"
|
|
102
|
+
},
|
|
103
|
+
"browserEntry": {
|
|
104
|
+
"const": "arcane-os/event-manager"
|
|
105
|
+
},
|
|
106
|
+
"dependencies": {
|
|
107
|
+
"type": "array",
|
|
108
|
+
"minItems": 3,
|
|
109
|
+
"maxItems": 3,
|
|
110
|
+
"prefixItems": [
|
|
111
|
+
{
|
|
112
|
+
"type": "object",
|
|
113
|
+
"additionalProperties": false,
|
|
114
|
+
"required": ["name", "version", "resolved", "integrity"],
|
|
115
|
+
"properties": {
|
|
116
|
+
"name": {"const": "event-pubsub"},
|
|
117
|
+
"version": {"const": "6.1.0"},
|
|
118
|
+
"resolved": {"const": "https://registry.npmjs.org/event-pubsub/-/event-pubsub-6.1.0.tgz"},
|
|
119
|
+
"integrity": {"const": "sha512-FEMlhTxwqGM0hztTixG6FhVFXqp7Eq1ltk5mSreK6Mhy3xWWpLAzEUR6OMvMdNqT3jgSxA8JDhnhyAG3X4Xy7Q=="}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "object",
|
|
124
|
+
"additionalProperties": false,
|
|
125
|
+
"required": ["name", "version", "resolved", "integrity"],
|
|
126
|
+
"properties": {
|
|
127
|
+
"name": {"const": "strong-type"},
|
|
128
|
+
"version": {"const": "2.0.0"},
|
|
129
|
+
"resolved": {"const": "https://registry.npmjs.org/strong-type/-/strong-type-2.0.0.tgz"},
|
|
130
|
+
"integrity": {"const": "sha512-HHrY9qYC7yn+5mlewiI3k9RQM9gZqGQsqbomZcd10Ks0h4RlX01nnkWbCe4AsVPCI6KaFvpkWm1nHMD+Ykup6g=="}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "object",
|
|
135
|
+
"additionalProperties": false,
|
|
136
|
+
"required": ["name", "version", "resolved", "integrity"],
|
|
137
|
+
"properties": {
|
|
138
|
+
"name": {"const": "@wllama/wllama"},
|
|
139
|
+
"version": {"const": "3.6.0"},
|
|
140
|
+
"resolved": {"const": "https://registry.npmjs.org/@wllama/wllama/-/wllama-3.6.0.tgz"},
|
|
141
|
+
"integrity": {"const": "sha512-NN3ZBXqaaUwGXTQubkNvsCaLPjN2XVa0bVS40OYCE8zquYmRc2W3oHYEgwvuSWWDB8aUqTLyMioySCXNkcnD1w=="}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"items": false
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
55
151
|
"protocols": {
|
|
56
152
|
"type": "object",
|
|
57
153
|
"additionalProperties": false,
|
package/src/cli/main.mjs
CHANGED
|
@@ -39,6 +39,7 @@ Usage:
|
|
|
39
39
|
${CLI_NAME} new <id> [--path <directory>] [--display-name <name>] [--target <target>] [--git]
|
|
40
40
|
${CLI_NAME} init [id] [--workspace <directory>] [--display-name <name>] [--target <target>]
|
|
41
41
|
${CLI_NAME} doctor [--workspace <directory>] [--arcane-root <directory>]
|
|
42
|
+
${CLI_NAME} import-map [--workspace <directory>] [--app <id>]
|
|
42
43
|
${CLI_NAME} dev [--app <id>] [--host 127.0.0.1] [--port 8000]
|
|
43
44
|
${CLI_NAME} test [--app <id>] [--scope app]
|
|
44
45
|
${CLI_NAME} test --scope shared --test-file <repo-relative.test.mjs>
|
|
@@ -220,6 +221,10 @@ function operationOptions(command,parsed,cwd){
|
|
|
220
221
|
requireLocalAI:flags.has('require-local-ai')
|
|
221
222
|
};
|
|
222
223
|
}
|
|
224
|
+
if(command==='import-map'){
|
|
225
|
+
noExtraPositionals(command,positionals);
|
|
226
|
+
return common;
|
|
227
|
+
}
|
|
223
228
|
if(command==='dev'){
|
|
224
229
|
noExtraPositionals(command,positionals);
|
|
225
230
|
return {
|
package/src/dev-server.mjs
CHANGED
|
@@ -9,10 +9,12 @@ import {
|
|
|
9
9
|
RELEASE_MANIFEST_NAME
|
|
10
10
|
} from './packager/core.mjs';
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from './runtime.mjs';
|
|
12
|
+
authenticateWorkspaceRuntimeReceipt,
|
|
13
|
+
readVerifiedWorkspaceRuntimeFile,
|
|
14
|
+
verifyWorkspaceRuntime
|
|
15
|
+
} from './workspace-runtime.mjs';
|
|
16
|
+
import {verifyRuntime} from './runtime.mjs';
|
|
17
|
+
import {verifySdkBrowserRuntime} from './sdk-browser-runtime.mjs';
|
|
16
18
|
import {resolveWorkspace} from './workspace.mjs';
|
|
17
19
|
import {createEventQueue} from './event-queue.mjs';
|
|
18
20
|
|
|
@@ -147,6 +149,31 @@ function identityMap(identities,prefix=''){
|
|
|
147
149
|
return result;
|
|
148
150
|
}
|
|
149
151
|
|
|
152
|
+
function routePrefixKey(prefix){
|
|
153
|
+
return prefix.map(segment=>segment.normalize('NFC').toLowerCase()).join('/');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function deterministicMappings(mappings){
|
|
157
|
+
const seen=new Map();
|
|
158
|
+
for(const mapping of mappings){
|
|
159
|
+
const key=routePrefixKey(mapping.prefix);
|
|
160
|
+
const prior=seen.get(key);
|
|
161
|
+
if(prior){
|
|
162
|
+
fail(
|
|
163
|
+
`Development server routes collide after case/NFC normalization: `
|
|
164
|
+
+`/${prior.prefix.join('/')} and /${mapping.prefix.join('/')}.`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
seen.set(key,mapping);
|
|
168
|
+
}
|
|
169
|
+
return [...mappings].sort((left,right)=>{
|
|
170
|
+
if(left.prefix.length!==right.prefix.length)return right.prefix.length-left.prefix.length;
|
|
171
|
+
const leftKey=routePrefixKey(left.prefix);
|
|
172
|
+
const rightKey=routePrefixKey(right.prefix);
|
|
173
|
+
return leftKey<rightKey?-1:leftKey>rightKey?1:0;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
150
177
|
function createFileWorkLimiter(){
|
|
151
178
|
let active=0;
|
|
152
179
|
const pending=[];
|
|
@@ -318,7 +345,7 @@ function sharedPathAllowed(relative,route){
|
|
|
318
345
|
});
|
|
319
346
|
}
|
|
320
347
|
|
|
321
|
-
async function sourceRoutes(workspaceRoot,appId,{
|
|
348
|
+
async function sourceRoutes(workspaceRoot,appId,{workspaceRuntimeReceipt,signal}){
|
|
322
349
|
const resolved=await resolveWorkspace({workspaceRoot,appId});
|
|
323
350
|
if(resolved.config.workspaceMode==='integrated'){
|
|
324
351
|
return {
|
|
@@ -340,16 +367,43 @@ async function sourceRoutes(workspaceRoot,appId,{runtimeReceipt,signal,onEvent})
|
|
|
340
367
|
]
|
|
341
368
|
};
|
|
342
369
|
}
|
|
343
|
-
const runtimeRoot=path.join(
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
370
|
+
const runtimeRoot=path.join(resolved.workspaceRoot,'arcane');
|
|
371
|
+
let verified=workspaceRuntimeReceipt;
|
|
372
|
+
if(!verified){
|
|
373
|
+
const sdkRuntimeRoot=path.join(
|
|
374
|
+
resolved.workspaceRoot,
|
|
375
|
+
'node_modules',
|
|
376
|
+
'arcane-os',
|
|
377
|
+
'runtime'
|
|
378
|
+
);
|
|
379
|
+
const sdkRuntimeReceipt=await verifyRuntime({
|
|
380
|
+
runtimeRoot:sdkRuntimeRoot,
|
|
381
|
+
signal
|
|
382
|
+
});
|
|
383
|
+
const sdkBrowserRuntimeRoot=path.join(
|
|
384
|
+
resolved.workspaceRoot,
|
|
385
|
+
'node_modules',
|
|
386
|
+
'arcane-os',
|
|
387
|
+
'browser-runtime'
|
|
388
|
+
);
|
|
389
|
+
const sdkBrowserRuntimeReceipt=await verifySdkBrowserRuntime({
|
|
390
|
+
browserRuntimeRoot:sdkBrowserRuntimeRoot,
|
|
391
|
+
signal
|
|
392
|
+
});
|
|
393
|
+
verified=await verifyWorkspaceRuntime({
|
|
394
|
+
workspaceRoot:resolved.workspaceRoot,
|
|
395
|
+
runtimeRoot:sdkRuntimeRoot,
|
|
396
|
+
runtimeReceipt:sdkRuntimeReceipt,
|
|
397
|
+
browserRuntimeRoot:sdkBrowserRuntimeRoot,
|
|
398
|
+
sdkBrowserRuntimeReceipt,
|
|
399
|
+
signal
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
verified=await authenticateWorkspaceRuntimeReceipt(verified,{
|
|
403
|
+
workspaceRoot:resolved.workspaceRoot,
|
|
404
|
+
signal
|
|
405
|
+
});
|
|
406
|
+
const arcaneIdentities=identityMap(verified.identities);
|
|
353
407
|
return {
|
|
354
408
|
workspaceRoot:resolved.workspaceRoot,
|
|
355
409
|
workspaceMode:'external',
|
|
@@ -363,25 +417,14 @@ async function sourceRoutes(workspaceRoot,appId,{runtimeReceipt,signal,onEvent})
|
|
|
363
417
|
},
|
|
364
418
|
{
|
|
365
419
|
prefix:['arcane'],
|
|
366
|
-
root:
|
|
420
|
+
root:runtimeRoot,
|
|
367
421
|
identities:arcaneIdentities,
|
|
368
|
-
read:relative=>
|
|
369
|
-
|
|
370
|
-
relativePath
|
|
422
|
+
read:relative=>readVerifiedWorkspaceRuntimeFile(verified,{
|
|
423
|
+
workspaceRoot:resolved.workspaceRoot,
|
|
424
|
+
relativePath:relative.join('/'),
|
|
371
425
|
signal
|
|
372
426
|
}),
|
|
373
427
|
allow:relative=>arcaneIdentities.has(inventoryKey(relative.join('/')))
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
prefix:['node_modules','strong-type'],
|
|
377
|
-
root:path.join(runtimeRoot,'strong-type'),
|
|
378
|
-
identities:strongTypeIdentities,
|
|
379
|
-
read:relative=>readVerifiedRuntimeFile(verified,{
|
|
380
|
-
runtimeRoot,
|
|
381
|
-
relativePath:`strong-type/${relative.join('/')}`,
|
|
382
|
-
signal
|
|
383
|
-
}),
|
|
384
|
-
allow:relative=>strongTypeIdentities.has(inventoryKey(relative.join('/')))
|
|
385
428
|
}
|
|
386
429
|
]
|
|
387
430
|
};
|
|
@@ -461,7 +504,7 @@ async function startOwnedDevServer({
|
|
|
461
504
|
host='127.0.0.1',
|
|
462
505
|
port=0,
|
|
463
506
|
signal,
|
|
464
|
-
|
|
507
|
+
workspaceRuntimeReceipt,
|
|
465
508
|
releaseReceipt
|
|
466
509
|
}={},events,releaseSignal){
|
|
467
510
|
throwIfAborted(signal);
|
|
@@ -473,12 +516,13 @@ async function startOwnedDevServer({
|
|
|
473
516
|
await events.send({type:'server.starting',mode,host,port,appId});
|
|
474
517
|
const routeSet=mode==='source'
|
|
475
518
|
?await sourceRoutes(workspaceRoot,appId,{
|
|
476
|
-
|
|
519
|
+
workspaceRuntimeReceipt,
|
|
477
520
|
signal,
|
|
478
521
|
onEvent:event=>events.send(event)
|
|
479
522
|
})
|
|
480
523
|
:await packagedRoutes(releaseRoot,releaseReceipt,{signal});
|
|
481
|
-
|
|
524
|
+
const mappings=deterministicMappings(routeSet.mappings);
|
|
525
|
+
for(const mapping of mappings){
|
|
482
526
|
const info=await lstat(mapping.root);
|
|
483
527
|
if(info.isSymbolicLink()||!info.isDirectory())fail(`Server route root must be a real directory: ${mapping.root}.`);
|
|
484
528
|
mapping.root=await realpath(mapping.root);
|
|
@@ -533,7 +577,7 @@ async function startOwnedDevServer({
|
|
|
533
577
|
response.end();
|
|
534
578
|
return;
|
|
535
579
|
}
|
|
536
|
-
const mapping=
|
|
580
|
+
const mapping=mappings.find(route=>
|
|
537
581
|
route.prefix.every((segment,index)=>segments[index]===segment)
|
|
538
582
|
);
|
|
539
583
|
if(!mapping){deny(response,404,'Not found.');return;}
|
package/src/doctor.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import {access} from 'node:fs/promises';
|
|
3
3
|
import {verifyRuntime} from './runtime.mjs';
|
|
4
|
+
import {verifySdkBrowserRuntime} from './sdk-browser-runtime.mjs';
|
|
5
|
+
import {verifyWorkspaceRuntime} from './workspace-runtime.mjs';
|
|
4
6
|
import {validateWorkspace} from './workspace.mjs';
|
|
5
7
|
import {runProcess} from './process.mjs';
|
|
6
8
|
import {ARCANE_PROTOCOL,SDK_VERSION} from './constants.mjs';
|
|
@@ -248,9 +250,16 @@ export async function runDoctor({
|
|
|
248
250
|
checks.push(await commandCheck('git','git',['--version'],{signal,onEvent,run}));
|
|
249
251
|
|
|
250
252
|
try{
|
|
251
|
-
const receipt=await
|
|
253
|
+
const [receipt,browserReceipt]=await Promise.all([
|
|
254
|
+
verifyRuntime({signal,onEvent}),
|
|
255
|
+
verifySdkBrowserRuntime({signal,onEvent})
|
|
256
|
+
]);
|
|
252
257
|
checks.push(check('sdk-runtime','pass','The packaged Arcane runtime inventory is verified.',{
|
|
253
|
-
details:{
|
|
258
|
+
details:{
|
|
259
|
+
sdkVersion:SDK_VERSION,
|
|
260
|
+
contentSha256:receipt.contentSha256,
|
|
261
|
+
browserContentSha256:browserReceipt.contentSha256
|
|
262
|
+
}
|
|
254
263
|
}));
|
|
255
264
|
}catch(error){
|
|
256
265
|
checks.push(check('sdk-runtime','fail',`The packaged Arcane runtime failed verification: ${error.message}`));
|
|
@@ -258,8 +267,9 @@ export async function runDoctor({
|
|
|
258
267
|
|
|
259
268
|
const resolvedWorkspace=path.resolve(workspaceRoot??process.cwd());
|
|
260
269
|
if(await exists(path.join(resolvedWorkspace,'arcane-packager.json'))){
|
|
270
|
+
let result=null;
|
|
261
271
|
try{
|
|
262
|
-
|
|
272
|
+
result=await validateWorkspace({
|
|
263
273
|
workspaceRoot:resolvedWorkspace,
|
|
264
274
|
appId,
|
|
265
275
|
signal,
|
|
@@ -271,6 +281,64 @@ export async function runDoctor({
|
|
|
271
281
|
}catch(error){
|
|
272
282
|
checks.push(check('workspace','fail',`The Arcane app workspace is invalid: ${error.message}`));
|
|
273
283
|
}
|
|
284
|
+
if(result===null){
|
|
285
|
+
checks.push(check(
|
|
286
|
+
'workspace-runtime',
|
|
287
|
+
'skipped',
|
|
288
|
+
'The physical workspace runtime was not checked because workspace admission failed.',
|
|
289
|
+
{required:false,details:{workspaceRoot:resolvedWorkspace}}
|
|
290
|
+
));
|
|
291
|
+
}else if(result.workspaceMode==='external'){
|
|
292
|
+
try{
|
|
293
|
+
const installedRoot=path.join(result.workspaceRoot,'node_modules','arcane-os');
|
|
294
|
+
const runtimeRoot=path.join(installedRoot,'runtime');
|
|
295
|
+
const browserRuntimeRoot=path.join(installedRoot,'browser-runtime');
|
|
296
|
+
const runtimeReceipt=await verifyRuntime({runtimeRoot,signal,onEvent});
|
|
297
|
+
const sdkBrowserRuntimeReceipt=await verifySdkBrowserRuntime({
|
|
298
|
+
browserRuntimeRoot,
|
|
299
|
+
signal,
|
|
300
|
+
onEvent
|
|
301
|
+
});
|
|
302
|
+
const projected=await verifyWorkspaceRuntime({
|
|
303
|
+
workspaceRoot:result.workspaceRoot,
|
|
304
|
+
runtimeRoot,
|
|
305
|
+
runtimeReceipt,
|
|
306
|
+
browserRuntimeRoot,
|
|
307
|
+
sdkBrowserRuntimeReceipt,
|
|
308
|
+
signal,
|
|
309
|
+
onEvent
|
|
310
|
+
});
|
|
311
|
+
checks.push(check(
|
|
312
|
+
'workspace-runtime',
|
|
313
|
+
'pass',
|
|
314
|
+
'The composed physical Arcane and SDK browser runtime is verified.',
|
|
315
|
+
{details:{
|
|
316
|
+
contentSha256:projected.contentSha256,
|
|
317
|
+
fileCount:projected.fileCount,
|
|
318
|
+
runtimeManifestSha256:projected.sourceManifestSha256,
|
|
319
|
+
runtimeContentSha256:projected.sourceContentSha256,
|
|
320
|
+
browserManifestSha256:projected.sourceBrowserManifestSha256,
|
|
321
|
+
browserContentSha256:projected.sourceBrowserContentSha256
|
|
322
|
+
}}
|
|
323
|
+
));
|
|
324
|
+
}catch(error){
|
|
325
|
+
checks.push(check(
|
|
326
|
+
'workspace-runtime',
|
|
327
|
+
'fail',
|
|
328
|
+
`The composed physical workspace runtime is invalid: ${error.message}`
|
|
329
|
+
));
|
|
330
|
+
}
|
|
331
|
+
}else if(result.workspaceMode==='integrated'){
|
|
332
|
+
const layout=result.config.browserRuntimeLayout;
|
|
333
|
+
checks.push(check(
|
|
334
|
+
'workspace-runtime',
|
|
335
|
+
'pass',
|
|
336
|
+
layout==='integrated-legacy'
|
|
337
|
+
?'The legacy integrated Arcane runtime routes are valid.'
|
|
338
|
+
:'The integrated physical browser-runtime routes are valid.',
|
|
339
|
+
{details:{layout}}
|
|
340
|
+
));
|
|
341
|
+
}
|
|
274
342
|
}else{
|
|
275
343
|
checks.push(check(
|
|
276
344
|
'workspace',
|
|
@@ -278,6 +346,12 @@ export async function runDoctor({
|
|
|
278
346
|
'No arcane-packager.json was found at the selected workspace.',
|
|
279
347
|
{required:false,details:{workspaceRoot:resolvedWorkspace}}
|
|
280
348
|
));
|
|
349
|
+
checks.push(check(
|
|
350
|
+
'workspace-runtime',
|
|
351
|
+
'skipped',
|
|
352
|
+
'No workspace runtime was selected for verification.',
|
|
353
|
+
{required:false,details:{workspaceRoot:resolvedWorkspace}}
|
|
354
|
+
));
|
|
281
355
|
}
|
|
282
356
|
|
|
283
357
|
if(arcaneRoot){
|