arcane-os 0.1.0-dev.5 → 0.1.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/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 verifyRuntime({signal,onEvent});
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:{sdkVersion:SDK_VERSION,contentSha256:receipt.contentSha256}
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
- const result=await validateWorkspace({
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){