arcane-os 0.29.0 → 0.29.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.29.1
4
+
5
+ - Preserve complete long and non-ASCII filenames in application release bundles
6
+ through standard per-file PAX path extensions. Public bundle creation and
7
+ verification retain logical payload paths and complete file content without
8
+ application-side renaming. Ordinary USTAR representation remains supported,
9
+ and the existing SDK-version metadata contract is unchanged. Bundles using
10
+ extended paths require the updated SDK reader or another PAX-capable reader.
11
+ - Preserve application-authored resource URL queries, including `v`, encoded
12
+ and repeated fields, empty query segments, and fragments. Import-map refresh,
13
+ serving, packaging, and PWA delivery now change only SDK-owned `arcaneVersion`
14
+ fields through the existing shared transformer.
15
+
3
16
  ## 0.29.0
4
17
 
5
18
  - Add `legacyAppPaths: false` to `arcane-packager.json` for root applications
package/README.md CHANGED
@@ -19,7 +19,7 @@ version-locked SDK runtime, while an integrated Arcane checkout uses its live
19
19
  `arcane/` runtime. Both profiles preserve the same app URLs, theme, packaging,
20
20
  event, cancellation, and browser run contracts.
21
21
 
22
- This checkout defines the `0.29.0` SDK contract. Applications pin one exact npm
22
+ This checkout defines the `0.29.1` SDK contract. Applications pin one exact npm
23
23
  version and lockfile; registry state is deliberately not baked into application
24
24
  artifacts.
25
25
 
@@ -604,9 +604,13 @@ prior file until the replacement is complete. Cancellation or failure before
604
604
  commit restores the prior output when that can be done without overwriting a
605
605
  concurrent change. A conflicting or uncertain path is preserved for inspection.
606
606
 
607
- The archive uses the documented USTAR+gzip structure and publishes its v1 JSON
608
- contract at `arcane-os/schemas/arcane-app-bundle.json`. When the user explicitly
609
- selects bundle verification, it rejects malformed archives, links, devices,
607
+ The archive uses USTAR+gzip with per-file PAX path extensions for long or
608
+ non-ASCII filenames and publishes its v1 JSON contract at
609
+ `arcane-os/schemas/arcane-app-bundle.json`. Logical filenames and content remain
610
+ complete; ordinary USTAR paths retain their existing representation, and bundle
611
+ metadata keeps its existing SDK-version matching contract. Readers must support
612
+ PAX path extensions to consume bundles that need them. When the
613
+ user explicitly selects bundle verification, it rejects malformed archives, links, devices,
610
614
  unsafe or colliding paths, unsupported archive members, trailing data, and
611
615
  inconsistent descriptor or inventory structure. These checks reject corrupt
612
616
  selected artifacts; they do not impose byte-count, hash, provenance, or
@@ -273,16 +273,31 @@ External repository delivery adds a distinct schema-1
273
273
  `arcane-app-release-bundle` envelope. Bundle creation uses an authored schema-2
274
274
  `arcane-app.json`; a synthesized package or registry projection remains valid for integrated
275
275
  packaging but is not used for an external bundle. The
276
- archive contains exactly `ARCANE_APP_BUNDLE.json`, canonical `arcane-app.json`,
276
+ logical file inventory contains exactly `ARCANE_APP_BUNDLE.json`, canonical `arcane-app.json`,
277
277
  `payload/ARCANE_APP_RELEASE.json`, and the release inventory beneath `payload/`
278
278
  in that order. The envelope adds no repository-only source or build tooling
279
279
  beyond that selected release inventory. Individual apps remain responsible for
280
280
  their authored source policy.
281
281
 
282
- The bundle contract uses the documented USTAR+gzip structure. Explicit bundle
283
- verification parses the selected archive without extraction and rejects
284
- genuinely malformed structures, unsafe or colliding paths, unsupported members,
285
- trailing data, and incompatible bundle generations. These corrupt-artifact
282
+ The bundle contract retains schema 1 and the `ustar+gzip` format identifier.
283
+ Ordinary representable ASCII paths use the existing USTAR headers. Long paths
284
+ and non-ASCII names use a [POSIX PAX](https://docs.oracle.com/cd/E86824_01/html/E54763/pax-1.html)
285
+ per-file `x` header containing the complete
286
+ UTF-8 `path`, immediately before that file's regular header and content. This
287
+ transport framing is not a payload member and never appears in the logical
288
+ inventory or `readFile()` results. Path spelling and file content remain unchanged;
289
+ the existing portable-path rules still apply. The public
290
+ `createCanonicalUstarHeader()` helper remains a single USTAR header and retains
291
+ its format-local field limits; complete bundles use `createAppReleaseBundle()`.
292
+
293
+ The bundle reader consumes these `path` extensions for the following file only,
294
+ as well as ordinary USTAR entries. Other PAX attributes and archive member
295
+ types remain outside this bundle profile. Older SDK readers without PAX support
296
+ cannot read bundles that require these extensions; update the consuming SDK
297
+ before importing one. The existing same-SDK-version bundle condition is unchanged.
298
+ Explicit bundle verification parses the selected archive without extraction and
299
+ rejects genuinely malformed structures, unsafe or colliding paths, unsupported
300
+ members, and incompatible bundle generations. These corrupt-artifact
286
301
  checks do not create byte-count, content-hash, provenance, or admission gates
287
302
  for ordinary development, packaging, serving, or running.
288
303
 
@@ -3,7 +3,7 @@
3
3
  Applications that enable [PWA delivery](pwa.md) use clean local resource URLs.
4
4
  Their generated offline manifest and service worker own the selected application
5
5
  and SDK release information. In that mode, the delivery transformer removes
6
- both `v` and `arcaneVersion`, preserving other query fields and fragments.
6
+ only the SDK-owned `arcaneVersion` field, preserving authored query fields and fragments.
7
7
  The behavior below continues to apply when PWA delivery is disabled and to native
8
8
  packages. Workspace runtime materialization remains usable by either target;
9
9
  the selected browser delivery applies its PWA URL policy.
@@ -15,11 +15,12 @@ SDK package metadata, not a timestamp, content measurement, or application
15
15
  constant.
16
16
 
17
17
  For example, an existing `./arcane/modules/HTMLImport.js?v=6#module` reference
18
- becomes `./arcane/modules/HTMLImport.js?arcaneVersion=${version}#module`.
19
- `arcaneVersion` is the sole resource version field: transformation removes `v`,
20
- updates the first existing `arcaneVersion`, and removes duplicate version fields.
21
- Regenerating for another SDK release replaces that version value. Unrelated
22
- query fields, their spelling, and fragments remain intact.
18
+ becomes `./arcane/modules/HTMLImport.js?v=6&arcaneVersion=${version}#module`.
19
+ `arcaneVersion` is the SDK's resource version field: transformation updates its
20
+ first existing value and removes duplicate `arcaneVersion` fields, or appends it
21
+ when absent. Regenerating for another SDK release replaces only that SDK value.
22
+ Authored fields, including `v`, encoded keys and values, repeated or empty query
23
+ segments, their source spelling, and fragments remain intact.
23
24
 
24
25
  ## Public tooling
25
26
 
@@ -464,14 +464,14 @@
464
464
  "name": "createAppReleaseBundle",
465
465
  "displayName": "createAppReleaseBundle()",
466
466
  "kind": "function",
467
- "signature": "async createAppReleaseBundle({ receipt, releaseRoot, outputPath, overwrite=false, signal, onEvent }={})",
467
+ "signature": "async createAppReleaseBundle({releaseRoot, appDescriptor, outputPath, overwrite=false, signal, onEvent}={})",
468
468
  "entrypoints": [
469
469
  "arcane-os",
470
470
  "arcane-os/release-bundle"
471
471
  ],
472
472
  "primaryImport": "arcane-os",
473
473
  "group": "Packaging and release bundles",
474
- "summary": "Writes one deterministic USTAR+gzip external application bundle from the selected authored release state.",
474
+ "summary": "Writes one deterministic USTAR+gzip external application bundle, using per-file POSIX PAX path extensions for complete long or non-ASCII filenames.",
475
475
  "availability": "Node",
476
476
  "protocol": "SDK packager and deterministic bundle contract",
477
477
  "normalization": "Normalized SDK validation with complete canonical archive and release content"
@@ -2164,7 +2164,7 @@
2164
2164
  ],
2165
2165
  "primaryImport": "arcane-os",
2166
2166
  "group": "Packaging and release bundles",
2167
- "summary": "Parses and authenticates one deterministic app bundle without extraction.",
2167
+ "summary": "Parses one deterministic app bundle without extraction, supporting ordinary USTAR entries and complete per-file POSIX PAX paths within the existing same-SDK-version contract.",
2168
2168
  "availability": "Node",
2169
2169
  "protocol": "SDK packager and deterministic bundle contract",
2170
2170
  "normalization": "Normalized SDK validation with complete canonical archive and release content"
@@ -150,9 +150,10 @@ The same bootstrap starts one initially hidden `pwa-install.html` component with
150
150
  the generated manifest's app name. Component loading and worker registration
151
151
  proceed independently.
152
152
 
153
- The selected PWA browser delivery removes `v` and `arcaneVersion` from actual
154
- local resource references, including the managed import map. Other query fields,
155
- fragments, source spelling and unrelated payloads are preserved. The offline
153
+ The selected PWA browser delivery removes only SDK-owned `arcaneVersion` fields
154
+ from actual local resource references, including the managed import map. Authored
155
+ fields such as `v`, encoded and repeated fields, empty query segments, fragments,
156
+ source spelling and unrelated payloads are preserved. The offline
156
157
  manifest now carries release information. Non-PWA and native delivery retain
157
158
  the [existing asset version contract](asset-versioning.md).
158
159
 
@@ -629,12 +629,17 @@ async function previewNextPrerelease(workspaceRoot) {
629
629
 
630
630
  ### Overview
631
631
 
632
- Writes one deterministic USTAR+gzip external application bundle from the selected authored release state.
632
+ Writes one deterministic USTAR+gzip external application bundle from the selected
633
+ authored release state. Long or non-ASCII filenames use per-file POSIX PAX `path`
634
+ extensions, preserving their complete UTF-8 spelling and file content. Ordinary
635
+ USTAR entries remain unchanged. Metadata framing is excluded from the manifest's
636
+ logical file inventory. Existing portable-path rules, schema 1, and the
637
+ `ustar+gzip` format identifier remain unchanged.
633
638
 
634
639
  ### Signature and result
635
640
 
636
641
  ```text
637
- async createAppReleaseBundle({ receipt, releaseRoot, outputPath, overwrite=false, signal, onEvent }={})
642
+ async createAppReleaseBundle({releaseRoot, appDescriptor, outputPath, overwrite=false, signal, onEvent}={})
638
643
  ```
639
644
 
640
645
  Import it from `arcane-os` or `arcane-os/release-bundle`. 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.
@@ -658,6 +663,9 @@ async function usecreateAppReleaseBundle(...arguments_) {
658
663
  ### Overview
659
664
 
660
665
  Builds the exact 512-byte canonical USTAR header for one validated bundle entry.
666
+ This low-level helper remains a single regular-file header with the USTAR field
667
+ limits. Use `createAppReleaseBundle()` to encode complete long or Unicode paths;
668
+ the bundle writer supplies PAX framing where needed.
661
669
 
662
670
  ### Signature and result
663
671
 
@@ -1104,7 +1112,14 @@ async function useverifyApp(...arguments_) {
1104
1112
 
1105
1113
  ### Overview
1106
1114
 
1107
- Parses and authenticates one deterministic app bundle without extraction.
1115
+ Parses one deterministic app bundle without extraction and checks its structural
1116
+ manifest and complete logical file inventory. It supports ordinary USTAR entries
1117
+ and per-file POSIX PAX `path` extensions. The complete extended path is used by
1118
+ `files` and `readFile()`; the metadata and regular-header placeholder are not
1119
+ payload files. Malformed or orphaned PAX records produce `ARCANE_BUNDLE_INVALID`.
1120
+ Other PAX attributes and archive member types remain unsupported. The existing
1121
+ same-SDK-version condition remains unchanged. An older reader without PAX support
1122
+ must be updated before importing a bundle that requires these path extensions.
1108
1123
 
1109
1124
  ### Signature and result
1110
1125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcane-os",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
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",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://github.com/TheWizardNexus/arcane-os-sdk/schemas/arcane-app-bundle.schema.json",
4
4
  "title": "Arcane external application release bundle",
5
- "description": "Structural manifest for one complete USTAR+gzip application bundle.",
5
+ "description": "Structural manifest for one complete USTAR+gzip application bundle, with per-file POSIX PAX path extensions for long or non-ASCII filenames. PAX framing is excluded from the logical file inventory.",
6
6
  "type": "object",
7
7
  "required": [
8
8
  "schemaVersion",
@@ -847,7 +847,7 @@ function assetUrlVersionEdits(value,version){
847
847
  let decodedKey=key;
848
848
  try{decodedKey=decodeURIComponent(key.replaceAll('+',' '));}
849
849
  catch{decodedKey=key;}
850
- const remove=decodedKey==='v'||(decodedKey==='arcaneVersion'&&(clean||versionFound));
850
+ const remove=decodedKey==='arcaneVersion'&&(clean||versionFound);
851
851
  parameters.push({start:offset,end:offset+parameter.length,remove});
852
852
  if(decodedKey==='arcaneVersion'&&!versionFound&&!clean){
853
853
  versionFound=true;
@@ -859,10 +859,10 @@ function assetUrlVersionEdits(value,version){
859
859
  }
860
860
  offset+=parameter.length+1;
861
861
  }
862
- if(clean&&!parameters.some(function hasRemainingField(parameter){
863
- return !parameter.remove&&parameter.end>parameter.start;
862
+ if(clean&&parameters.every(function removesSdkField(parameter){
863
+ return parameter.remove;
864
864
  }))return [{start:queryStart,end:address.length,value:''}];
865
- // Remove adjacent obsolete fields together, including only their separator.
865
+ // Remove adjacent SDK version fields together, including only their separator.
866
866
  // Other field spelling and source-level escapes remain untouched.
867
867
  for(let index=0;index<parameters.length;index+=1){
868
868
  if(!parameters[index].remove)continue;
@@ -874,13 +874,10 @@ function assetUrlVersionEdits(value,version){
874
874
  value:''
875
875
  });
876
876
  }
877
- const lastRetained=parameters.findLast(function retainedParameter(parameter){
878
- return !parameter.remove;
879
- });
880
877
  if(!clean&&!versionFound)edits.push({
881
878
  start:address.length,
882
879
  end:address.length,
883
- value:`${lastRetained&&lastRetained.end>lastRetained.start?'&':''}arcaneVersion=${versionValue}`
880
+ value:`&arcaneVersion=${versionValue}`
884
881
  });
885
882
  return edits;
886
883
  }
@@ -93,7 +93,7 @@ function splitUstarPath(archivePath){
93
93
  return {name,prefix};
94
94
  }
95
95
  }
96
- fail(`Archive path cannot be represented by ustar: ${normalized}.`);
96
+ return null;
97
97
  }
98
98
 
99
99
  function writeTextField(header,offset,length,value,label){
@@ -112,8 +112,10 @@ function writeOctalField(header,offset,length,value,label,{trailingSpace=false}=
112
112
  header.write(rendered,offset,length,'ascii');
113
113
  }
114
114
 
115
- export function createCanonicalUstarHeader(archivePath,size){
116
- const {name,prefix}=splitUstarPath(archivePath);
115
+ function createTarHeader(archivePath,size,type){
116
+ const fields=splitUstarPath(archivePath);
117
+ if(!fields)fail(`Archive path cannot be represented by ustar: ${archivePath}.`);
118
+ const {name,prefix}=fields;
117
119
  const header=Buffer.alloc(TAR_BLOCK_SIZE);
118
120
  writeTextField(header,0,100,name,'ustar name');
119
121
  writeOctalField(header,100,8,ARCHIVE_MODE,'ustar mode');
@@ -122,7 +124,7 @@ export function createCanonicalUstarHeader(archivePath,size){
122
124
  writeOctalField(header,124,12,size,'ustar size');
123
125
  writeOctalField(header,136,12,0,'ustar mtime');
124
126
  header.fill(0x20,148,156);
125
- header[156]=0x30;
127
+ header[156]=type;
126
128
  header.write('ustar\0',257,6,'ascii');
127
129
  header.write('00',263,2,'ascii');
128
130
  writeTextField(header,265,32,'root','ustar owner');
@@ -134,13 +136,45 @@ export function createCanonicalUstarHeader(archivePath,size){
134
136
  return header;
135
137
  }
136
138
 
137
- function tarEntry(archivePath,content){
138
- const header=createCanonicalUstarHeader(archivePath,content.length);
139
+ export function createCanonicalUstarHeader(archivePath,size){
140
+ return createTarHeader(archivePath,size,0x30);
141
+ }
142
+
143
+ function tarRecord(archivePath,content,type=0x30){
144
+ const header=createTarHeader(archivePath,content.length,type);
139
145
  const remainder=content.length%TAR_BLOCK_SIZE;
140
146
  const padding=remainder===0?Buffer.alloc(0):Buffer.alloc(TAR_BLOCK_SIZE-remainder);
141
147
  return Buffer.concat([header,content,padding]);
142
148
  }
143
149
 
150
+ function paxPathRecord(archivePath) {
151
+ const value = Buffer.from(` path=${archivePath}\n`, 'utf8');
152
+ // POSIX PAX framing includes the decimal prefix itself in the record length.
153
+ let length = value.length + 1;
154
+ while(String(length).length + value.length !== length) {
155
+ length = String(length).length + value.length;
156
+ }
157
+ const prefix = Buffer.from(String(length), 'ascii');
158
+ return Buffer.concat(
159
+ [prefix, value]
160
+ );
161
+ }
162
+
163
+ function tarEntry(archivePath, content) {
164
+ const fields = splitUstarPath(archivePath);
165
+ if(fields && !/[^\u0000-\u007f]/u.test(archivePath)) {
166
+ return tarRecord(archivePath, content);
167
+ }
168
+ // The following regular header is only a placeholder; PAX owns the complete path.
169
+ const extendedPath = paxPathRecord(archivePath);
170
+ return Buffer.concat(
171
+ [
172
+ tarRecord('PaxHeaders/entry', extendedPath, 0x78),
173
+ tarRecord('PaxPayload/entry', content)
174
+ ]
175
+ );
176
+ }
177
+
144
178
  async function realDirectory(location,label){
145
179
  const requested=path.resolve(location);
146
180
  let info;
@@ -308,9 +342,53 @@ function readOctalField(header,offset,length,label){
308
342
  return value;
309
343
  }
310
344
 
345
+ function readPaxPath(content) {
346
+ let offset = 0;
347
+ let archivePath;
348
+ while(offset < content.length) {
349
+ const separator = content.indexOf(0x20, offset);
350
+ if(separator < 0) {
351
+ fail('Bundle contains malformed PAX record framing.');
352
+ }
353
+ const lengthText = content.subarray(offset, separator).toString('latin1');
354
+ if(!/^[1-9][0-9]*$/u.test(lengthText)) {
355
+ fail('Bundle contains malformed PAX record framing.');
356
+ }
357
+ const length = Number(lengthText);
358
+ const end = offset + length;
359
+ if(!is.safeInteger(length) || end > content.length || end <= separator + 1
360
+ || content[end - 1] !== 0x0a) {
361
+ fail('Bundle contains an incomplete or malformed PAX record.');
362
+ }
363
+ const assignment = content.indexOf(0x3d, separator + 1);
364
+ if(assignment <= separator + 1 || assignment >= end - 1) {
365
+ fail('Bundle contains a malformed PAX assignment.');
366
+ }
367
+ const keyword = content.subarray(separator + 1, assignment).toString('utf8');
368
+ if(keyword !== 'path') {
369
+ fail(`Bundle contains an unsupported PAX field: ${keyword}.`);
370
+ }
371
+ try {
372
+ const decoder = new TextDecoder(
373
+ 'utf-8',
374
+ {fatal: true, ignoreBOM: true}
375
+ );
376
+ archivePath = decoder.decode(content.subarray(assignment + 1, end - 1));
377
+ } catch (error) {
378
+ fail(`Bundle PAX path is not valid UTF-8: ${error.message}.`);
379
+ }
380
+ offset = end;
381
+ }
382
+ if(archivePath === undefined) {
383
+ fail('Bundle PAX header is missing its path.');
384
+ }
385
+ return archivePath;
386
+ }
387
+
311
388
  function readTarEntries(archive){
312
389
  const entries=new Map();
313
390
  let offset=0;
391
+ let pendingPath;
314
392
  while(offset+TAR_BLOCK_SIZE<=archive.length){
315
393
  const header=archive.subarray(offset,offset+TAR_BLOCK_SIZE);
316
394
  if(header.every(value=>value===0))break;
@@ -321,21 +399,31 @@ function readTarEntries(archive){
321
399
  let actualChecksum=0;
322
400
  for(const value of checksumHeader)actualChecksum+=value;
323
401
  if(actualChecksum!==expectedChecksum)fail('Bundle contains a malformed ustar header.');
324
- if(header[156]!==0&&header[156]!==0x30)fail('Bundle contains a non-file archive entry.');
402
+ const type=header[156];
403
+ if(type!==0&&type!==0x30&&type!==0x78)fail('Bundle contains a non-file archive entry.');
325
404
  const name=readStringField(header,0,100);
326
405
  const prefix=readStringField(header,345,155);
327
- const archivePath=validateAppBundlePath(prefix?`${prefix}/${name}`:name,'archive path');
328
- if(entries.has(pathKey(archivePath)))fail(`Bundle contains a duplicate path: ${archivePath}.`);
406
+ const headerPath=prefix?`${prefix}/${name}`:name;
329
407
  const size=readOctalField(header,124,12,'ustar size');
330
408
  const contentStart=offset+TAR_BLOCK_SIZE;
331
409
  const contentEnd=contentStart+size;
332
- if(contentEnd>archive.length)fail(`Bundle entry is incomplete: ${archivePath}.`);
410
+ if(contentEnd>archive.length)fail(`Bundle entry is incomplete: ${pendingPath??headerPath}.`);
411
+ const content=archive.subarray(contentStart,contentEnd);
412
+ offset=contentStart+Math.ceil(size/TAR_BLOCK_SIZE)*TAR_BLOCK_SIZE;
413
+ if(type===0x78){
414
+ if(pendingPath!==undefined)fail('Bundle PAX path is missing its following file.');
415
+ pendingPath=readPaxPath(content);
416
+ continue;
417
+ }
418
+ const archivePath=validateAppBundlePath(pendingPath??headerPath,'archive path');
419
+ pendingPath=undefined;
420
+ if(entries.has(pathKey(archivePath)))fail(`Bundle contains a duplicate path: ${archivePath}.`);
333
421
  entries.set(pathKey(archivePath),{
334
422
  path:archivePath,
335
- content:Buffer.from(archive.subarray(contentStart,contentEnd))
423
+ content:Buffer.from(content)
336
424
  });
337
- offset=contentStart+Math.ceil(size/TAR_BLOCK_SIZE)*TAR_BLOCK_SIZE;
338
425
  }
426
+ if(pendingPath!==undefined)fail('Bundle PAX path is missing its following file.');
339
427
  return entries;
340
428
  }
341
429