@orkestrel/scaffold 0.0.119 → 0.0.120

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.
Files changed (49) hide show
  1. package/dist/bin/main.js +15 -15
  2. package/dist/bin/main.js.map +1 -1
  3. package/dist/host/agents/skills/orkestrel-journey/references/layer.md +10 -10
  4. package/dist/host/agents/skills/orkestrel-journey/references/statechart.md +1 -1
  5. package/dist/host/agents/skills/orkestrel-journey/references/styles.md +3 -3
  6. package/dist/host/claude/agents/orkestrel.md +27 -26
  7. package/dist/host/claude/rules/tests.md +2 -2
  8. package/dist/host/claude/rules/typescript.md +2 -3
  9. package/dist/host/guides/abort.md +0 -4
  10. package/dist/host/guides/budget.md +1 -5
  11. package/dist/host/guides/codec.md +18 -3
  12. package/dist/host/guides/contract.md +23 -44
  13. package/dist/host/guides/csv.md +86 -93
  14. package/dist/host/guides/database.md +0 -4
  15. package/dist/host/guides/emitter.md +0 -2
  16. package/dist/host/guides/form.md +26 -47
  17. package/dist/host/guides/html.md +3 -7
  18. package/dist/host/guides/indexeddb.md +28 -32
  19. package/dist/host/guides/jsonrpc.md +187 -0
  20. package/dist/host/guides/markdown.md +132 -141
  21. package/dist/host/guides/msg.md +47 -63
  22. package/dist/host/guides/ndjson.md +0 -4
  23. package/dist/host/guides/pool.md +0 -4
  24. package/dist/host/guides/process.md +71 -79
  25. package/dist/host/guides/reason.md +30 -36
  26. package/dist/host/guides/router.md +11 -18
  27. package/dist/host/guides/scaffold.md +136 -136
  28. package/dist/host/guides/sqlite.md +0 -4
  29. package/dist/host/guides/sse.md +6 -10
  30. package/dist/host/guides/table.md +481 -493
  31. package/dist/host/guides/template.md +0 -4
  32. package/dist/host/guides/test.md +46 -66
  33. package/dist/host/guides/timeout.md +0 -6
  34. package/dist/host/guides/tool.md +2 -6
  35. package/dist/host/guides/websocket.md +0 -4
  36. package/dist/host/manifest.json +39 -464
  37. package/dist/src/core/index.cjs +162 -177
  38. package/dist/src/core/index.cjs.map +1 -1
  39. package/dist/src/core/index.d.cts +213 -213
  40. package/dist/src/core/index.d.ts +213 -213
  41. package/dist/src/core/index.js +151 -166
  42. package/dist/src/core/index.js.map +1 -1
  43. package/dist/src/server/index.cjs +25 -25
  44. package/dist/src/server/index.cjs.map +1 -1
  45. package/dist/src/server/index.d.cts +50 -50
  46. package/dist/src/server/index.d.ts +50 -50
  47. package/dist/src/server/index.js +26 -26
  48. package/dist/src/server/index.js.map +1 -1
  49. package/package.json +9 -9
@@ -1,10 +1,10 @@
1
+ import type { ArtifactGroup } from '@orkestrel/scaffold';
1
2
  import type { Audit } from '@orkestrel/scaffold';
2
3
  import type { CatalogEntry } from '@orkestrel/scaffold';
3
4
  import type { Dependency } from '@orkestrel/scaffold';
4
5
  import type { EmitterErrorHandler } from '@orkestrel/emitter';
5
6
  import type { EmitterHooks } from '@orkestrel/emitter';
6
7
  import type { EmitterInterface } from '@orkestrel/emitter';
7
- import type { Group } from '@orkestrel/scaffold';
8
8
  import type { Guard } from '@orkestrel/contract';
9
9
  import type { HostFile } from '@orkestrel/scaffold';
10
10
  import type { Lookup } from '@orkestrel/scaffold';
@@ -165,7 +165,7 @@ export declare function computeFileDigest(path: string): string | undefined;
165
165
  * computeManifestDigest([], [], []) // the digest of the empty membership
166
166
  * ```
167
167
  */
168
- export declare function computeManifestDigest(entries: readonly ManifestEntry[], roots: readonly string[], surface: readonly SurfaceCollision[]): string;
168
+ export declare function computeManifestDigest(entries: readonly HostManifestEntry[], roots: readonly string[], surface: readonly SurfaceCollision[]): string;
169
169
 
170
170
  /**
171
171
  * Decodes exact bytes stated in hexadecimal as strict UTF-8 text.
@@ -356,12 +356,27 @@ export declare interface HostInventory {
356
356
  * contract.
357
357
  */
358
358
  export declare interface HostManifest {
359
- readonly entries: readonly ManifestEntry[];
359
+ readonly entries: readonly HostManifestEntry[];
360
360
  readonly roots: readonly string[];
361
361
  readonly surface: readonly SurfaceCollision[];
362
362
  readonly digest: string;
363
363
  }
364
364
 
365
+ /**
366
+ * Represents one file record of the vendored host's manifest.
367
+ *
368
+ * @remarks
369
+ * `digest` is the SHA-256 of the file's exact bytes. A live read compares it
370
+ * against the target's copy, and verifies host-supplied bytes against it before
371
+ * treating them as that entry.
372
+ */
373
+ export declare interface HostManifestEntry {
374
+ readonly storage: string;
375
+ readonly destination: string;
376
+ readonly executable: boolean;
377
+ readonly digest: string;
378
+ }
379
+
365
380
  /**
366
381
  * Configures the committed inventory baseline and staging reports.
367
382
  *
@@ -557,6 +572,29 @@ export declare const isHost: Guard<Host>;
557
572
  */
558
573
  export declare const isHostManifest: Guard<HostManifest>;
559
574
 
575
+ /**
576
+ * Narrows a value to one {@link HostManifestEntry}.
577
+ *
578
+ * @remarks
579
+ * Both paths are measured by the core path law, because a vendored host's
580
+ * storage name and the destination it maps to are each a path inside a
581
+ * workspace. That is what stops a hand-edited manifest from mapping a vendored
582
+ * file to a destination outside the target.
583
+ *
584
+ * @example
585
+ * ```ts
586
+ * import { isHostManifestEntry } from '@orkestrel/scaffold/server'
587
+ *
588
+ * isHostManifestEntry({
589
+ * storage: 'AGENTS.md',
590
+ * destination: 'AGENTS.md',
591
+ * executable: false,
592
+ * digest: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
593
+ * }) // true
594
+ * ```
595
+ */
596
+ export declare const isHostManifestEntry: Guard<HostManifestEntry>;
597
+
560
598
  /**
561
599
  * Narrows a value to a working-tree inventory within the limit one target may report.
562
600
  *
@@ -582,29 +620,6 @@ export declare const isHostManifest: Guard<HostManifest>;
582
620
  */
583
621
  export declare function isInventory(value: unknown): value is readonly unknown[];
584
622
 
585
- /**
586
- * Narrows a value to one {@link ManifestEntry}.
587
- *
588
- * @remarks
589
- * Both paths are measured by the core path law, because a vendored host's
590
- * storage name and the destination it maps to are each a path inside a
591
- * workspace. That is what stops a hand-edited manifest from mapping a vendored
592
- * file to a destination outside the target.
593
- *
594
- * @example
595
- * ```ts
596
- * import { isManifestEntry } from '@orkestrel/scaffold/server'
597
- *
598
- * isManifestEntry({
599
- * storage: 'AGENTS.md',
600
- * destination: 'AGENTS.md',
601
- * executable: false,
602
- * digest: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
603
- * }) // true
604
- * ```
605
- */
606
- export declare const isManifestEntry: Guard<ManifestEntry>;
607
-
608
623
  /**
609
624
  * Narrows a value to one {@link ManifestRegionSet}.
610
625
  *
@@ -871,7 +886,7 @@ export declare function listAncestors(path: string, limit?: number): readonly st
871
886
  * listCanonPaths('vacant', ['orchestration']) // []
872
887
  * ```
873
888
  */
874
- export declare function listCanonPaths(target: string, groups: readonly Group[]): readonly string[];
889
+ export declare function listCanonPaths(target: string, groups: readonly ArtifactGroup[]): readonly string[];
875
890
 
876
891
  /**
877
892
  * Lists a directory's descendant directories as sorted root-relative paths.
@@ -945,21 +960,6 @@ export declare function listFiles(root: string): readonly string[];
945
960
  */
946
961
  export declare const MANIFEST_NAME = "manifest.json";
947
962
 
948
- /**
949
- * Represents one file record of the vendored host's manifest.
950
- *
951
- * @remarks
952
- * `digest` is the SHA-256 of the file's exact bytes. A live read compares it
953
- * against the target's copy, and verifies host-supplied bytes against it before
954
- * treating them as that entry.
955
- */
956
- export declare interface ManifestEntry {
957
- readonly storage: string;
958
- readonly destination: string;
959
- readonly executable: boolean;
960
- readonly digest: string;
961
- }
962
-
963
963
  /**
964
964
  * Tests whether a path still holds the captured directory identity.
965
965
  *
@@ -1296,7 +1296,7 @@ export declare class Materializer implements MaterializerInterface {
1296
1296
  * match the ones the audit carried for every path the plan owns; anything else
1297
1297
  * means the target moved, and the whole call is refused. The audit is checked
1298
1298
  * for agreement rather than for plausibility, so a verdict the comparison could
1299
- * not have produced — a birth-owned path reported stale, which the `Finding`
1299
+ * not have produced — a birth-owned path reported stale, which the `ArtifactFinding`
1300
1300
  * shape admits — disagrees with the derived one and is refused. A missing
1301
1301
  * destination is restored whatever its ownership; a stale one is replaced only
1302
1302
  * where the artifact claims its bytes, which is what leaves a presence-owned
@@ -1491,7 +1491,7 @@ export declare class Materializer implements MaterializerInterface {
1491
1491
  * @remarks
1492
1492
  * The audit is checked for agreement rather than for plausibility, so a verdict
1493
1493
  * the comparison could not have produced — a birth-owned path reported stale,
1494
- * which the `Finding` shape admits — disagrees with the derived one and is
1494
+ * which the `ArtifactFinding` shape admits — disagrees with the derived one and is
1495
1495
  * refused.
1496
1496
  *
1497
1497
  * The whole audit is guarded before any of it is read, so an audit produced by
@@ -1974,13 +1974,13 @@ export declare class Materializer implements MaterializerInterface {
1974
1974
  *
1975
1975
  * @example
1976
1976
  * ```ts
1977
- * import { readManifestEntry } from '@orkestrel/scaffold/server'
1977
+ * import { readHostManifestEntry } from '@orkestrel/scaffold/server'
1978
1978
  *
1979
- * readManifestEntry('.gitignore', '/tmp/checkout/.gitignore')
1979
+ * readHostManifestEntry('.gitignore', '/tmp/checkout/.gitignore')
1980
1980
  * // { storage: 'dotfiles/gitignore', destination: '.gitignore', executable: false, digest: '...' }
1981
1981
  * ```
1982
1982
  */
1983
- export declare function readManifestEntry(destination: string, source: string): ManifestEntry | undefined;
1983
+ export declare function readHostManifestEntry(destination: string, source: string): HostManifestEntry | undefined;
1984
1984
 
1985
1985
  /**
1986
1986
  * Reads a target's current bytes at the paths a plan claims.
@@ -2315,7 +2315,7 @@ export declare class Materializer implements MaterializerInterface {
2315
2315
  * // [{ storage: 'scripts/codex.sh', destination: 'scripts/codex.sh', executable: true, digest: '…' }]
2316
2316
  * ```
2317
2317
  */
2318
- export declare function stageBytes(host: Host, root: string, destinations: readonly string[]): readonly ManifestEntry[];
2318
+ export declare function stageBytes(host: Host, root: string, destinations: readonly string[]): readonly HostManifestEntry[];
2319
2319
 
2320
2320
  /**
2321
2321
  * Stages a vendored host root from a real checkout.
@@ -2387,10 +2387,10 @@ export declare class Materializer implements MaterializerInterface {
2387
2387
  * ```ts
2388
2388
  * import { stageHost } from '@orkestrel/scaffold/server'
2389
2389
  *
2390
- * stageHost(process.cwd(), 'dist/host') // one ManifestEntry per file staged
2390
+ * stageHost(process.cwd(), 'dist/host') // one HostManifestEntry per file staged
2391
2391
  * ```
2392
2392
  */
2393
- export declare function stageHost(checkout: string, host: string, options?: HostStageOptions): readonly ManifestEntry[];
2393
+ export declare function stageHost(checkout: string, host: string, options?: HostStageOptions): readonly HostManifestEntry[];
2394
2394
 
2395
2395
  /**
2396
2396
  * Stages the committed inventory of the files a vendored host carries.
@@ -1,10 +1,10 @@
1
+ import type { ArtifactGroup } from '@orkestrel/scaffold';
1
2
  import type { Audit } from '@orkestrel/scaffold';
2
3
  import type { CatalogEntry } from '@orkestrel/scaffold';
3
4
  import type { Dependency } from '@orkestrel/scaffold';
4
5
  import type { EmitterErrorHandler } from '@orkestrel/emitter';
5
6
  import type { EmitterHooks } from '@orkestrel/emitter';
6
7
  import type { EmitterInterface } from '@orkestrel/emitter';
7
- import type { Group } from '@orkestrel/scaffold';
8
8
  import type { Guard } from '@orkestrel/contract';
9
9
  import type { HostFile } from '@orkestrel/scaffold';
10
10
  import type { Lookup } from '@orkestrel/scaffold';
@@ -165,7 +165,7 @@ export declare function computeFileDigest(path: string): string | undefined;
165
165
  * computeManifestDigest([], [], []) // the digest of the empty membership
166
166
  * ```
167
167
  */
168
- export declare function computeManifestDigest(entries: readonly ManifestEntry[], roots: readonly string[], surface: readonly SurfaceCollision[]): string;
168
+ export declare function computeManifestDigest(entries: readonly HostManifestEntry[], roots: readonly string[], surface: readonly SurfaceCollision[]): string;
169
169
 
170
170
  /**
171
171
  * Decodes exact bytes stated in hexadecimal as strict UTF-8 text.
@@ -356,12 +356,27 @@ export declare interface HostInventory {
356
356
  * contract.
357
357
  */
358
358
  export declare interface HostManifest {
359
- readonly entries: readonly ManifestEntry[];
359
+ readonly entries: readonly HostManifestEntry[];
360
360
  readonly roots: readonly string[];
361
361
  readonly surface: readonly SurfaceCollision[];
362
362
  readonly digest: string;
363
363
  }
364
364
 
365
+ /**
366
+ * Represents one file record of the vendored host's manifest.
367
+ *
368
+ * @remarks
369
+ * `digest` is the SHA-256 of the file's exact bytes. A live read compares it
370
+ * against the target's copy, and verifies host-supplied bytes against it before
371
+ * treating them as that entry.
372
+ */
373
+ export declare interface HostManifestEntry {
374
+ readonly storage: string;
375
+ readonly destination: string;
376
+ readonly executable: boolean;
377
+ readonly digest: string;
378
+ }
379
+
365
380
  /**
366
381
  * Configures the committed inventory baseline and staging reports.
367
382
  *
@@ -557,6 +572,29 @@ export declare const isHost: Guard<Host>;
557
572
  */
558
573
  export declare const isHostManifest: Guard<HostManifest>;
559
574
 
575
+ /**
576
+ * Narrows a value to one {@link HostManifestEntry}.
577
+ *
578
+ * @remarks
579
+ * Both paths are measured by the core path law, because a vendored host's
580
+ * storage name and the destination it maps to are each a path inside a
581
+ * workspace. That is what stops a hand-edited manifest from mapping a vendored
582
+ * file to a destination outside the target.
583
+ *
584
+ * @example
585
+ * ```ts
586
+ * import { isHostManifestEntry } from '@orkestrel/scaffold/server'
587
+ *
588
+ * isHostManifestEntry({
589
+ * storage: 'AGENTS.md',
590
+ * destination: 'AGENTS.md',
591
+ * executable: false,
592
+ * digest: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
593
+ * }) // true
594
+ * ```
595
+ */
596
+ export declare const isHostManifestEntry: Guard<HostManifestEntry>;
597
+
560
598
  /**
561
599
  * Narrows a value to a working-tree inventory within the limit one target may report.
562
600
  *
@@ -582,29 +620,6 @@ export declare const isHostManifest: Guard<HostManifest>;
582
620
  */
583
621
  export declare function isInventory(value: unknown): value is readonly unknown[];
584
622
 
585
- /**
586
- * Narrows a value to one {@link ManifestEntry}.
587
- *
588
- * @remarks
589
- * Both paths are measured by the core path law, because a vendored host's
590
- * storage name and the destination it maps to are each a path inside a
591
- * workspace. That is what stops a hand-edited manifest from mapping a vendored
592
- * file to a destination outside the target.
593
- *
594
- * @example
595
- * ```ts
596
- * import { isManifestEntry } from '@orkestrel/scaffold/server'
597
- *
598
- * isManifestEntry({
599
- * storage: 'AGENTS.md',
600
- * destination: 'AGENTS.md',
601
- * executable: false,
602
- * digest: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
603
- * }) // true
604
- * ```
605
- */
606
- export declare const isManifestEntry: Guard<ManifestEntry>;
607
-
608
623
  /**
609
624
  * Narrows a value to one {@link ManifestRegionSet}.
610
625
  *
@@ -871,7 +886,7 @@ export declare function listAncestors(path: string, limit?: number): readonly st
871
886
  * listCanonPaths('vacant', ['orchestration']) // []
872
887
  * ```
873
888
  */
874
- export declare function listCanonPaths(target: string, groups: readonly Group[]): readonly string[];
889
+ export declare function listCanonPaths(target: string, groups: readonly ArtifactGroup[]): readonly string[];
875
890
 
876
891
  /**
877
892
  * Lists a directory's descendant directories as sorted root-relative paths.
@@ -945,21 +960,6 @@ export declare function listFiles(root: string): readonly string[];
945
960
  */
946
961
  export declare const MANIFEST_NAME = "manifest.json";
947
962
 
948
- /**
949
- * Represents one file record of the vendored host's manifest.
950
- *
951
- * @remarks
952
- * `digest` is the SHA-256 of the file's exact bytes. A live read compares it
953
- * against the target's copy, and verifies host-supplied bytes against it before
954
- * treating them as that entry.
955
- */
956
- export declare interface ManifestEntry {
957
- readonly storage: string;
958
- readonly destination: string;
959
- readonly executable: boolean;
960
- readonly digest: string;
961
- }
962
-
963
963
  /**
964
964
  * Tests whether a path still holds the captured directory identity.
965
965
  *
@@ -1296,7 +1296,7 @@ export declare class Materializer implements MaterializerInterface {
1296
1296
  * match the ones the audit carried for every path the plan owns; anything else
1297
1297
  * means the target moved, and the whole call is refused. The audit is checked
1298
1298
  * for agreement rather than for plausibility, so a verdict the comparison could
1299
- * not have produced — a birth-owned path reported stale, which the `Finding`
1299
+ * not have produced — a birth-owned path reported stale, which the `ArtifactFinding`
1300
1300
  * shape admits — disagrees with the derived one and is refused. A missing
1301
1301
  * destination is restored whatever its ownership; a stale one is replaced only
1302
1302
  * where the artifact claims its bytes, which is what leaves a presence-owned
@@ -1491,7 +1491,7 @@ export declare class Materializer implements MaterializerInterface {
1491
1491
  * @remarks
1492
1492
  * The audit is checked for agreement rather than for plausibility, so a verdict
1493
1493
  * the comparison could not have produced — a birth-owned path reported stale,
1494
- * which the `Finding` shape admits — disagrees with the derived one and is
1494
+ * which the `ArtifactFinding` shape admits — disagrees with the derived one and is
1495
1495
  * refused.
1496
1496
  *
1497
1497
  * The whole audit is guarded before any of it is read, so an audit produced by
@@ -1974,13 +1974,13 @@ export declare class Materializer implements MaterializerInterface {
1974
1974
  *
1975
1975
  * @example
1976
1976
  * ```ts
1977
- * import { readManifestEntry } from '@orkestrel/scaffold/server'
1977
+ * import { readHostManifestEntry } from '@orkestrel/scaffold/server'
1978
1978
  *
1979
- * readManifestEntry('.gitignore', '/tmp/checkout/.gitignore')
1979
+ * readHostManifestEntry('.gitignore', '/tmp/checkout/.gitignore')
1980
1980
  * // { storage: 'dotfiles/gitignore', destination: '.gitignore', executable: false, digest: '...' }
1981
1981
  * ```
1982
1982
  */
1983
- export declare function readManifestEntry(destination: string, source: string): ManifestEntry | undefined;
1983
+ export declare function readHostManifestEntry(destination: string, source: string): HostManifestEntry | undefined;
1984
1984
 
1985
1985
  /**
1986
1986
  * Reads a target's current bytes at the paths a plan claims.
@@ -2315,7 +2315,7 @@ export declare class Materializer implements MaterializerInterface {
2315
2315
  * // [{ storage: 'scripts/codex.sh', destination: 'scripts/codex.sh', executable: true, digest: '…' }]
2316
2316
  * ```
2317
2317
  */
2318
- export declare function stageBytes(host: Host, root: string, destinations: readonly string[]): readonly ManifestEntry[];
2318
+ export declare function stageBytes(host: Host, root: string, destinations: readonly string[]): readonly HostManifestEntry[];
2319
2319
 
2320
2320
  /**
2321
2321
  * Stages a vendored host root from a real checkout.
@@ -2387,10 +2387,10 @@ export declare class Materializer implements MaterializerInterface {
2387
2387
  * ```ts
2388
2388
  * import { stageHost } from '@orkestrel/scaffold/server'
2389
2389
  *
2390
- * stageHost(process.cwd(), 'dist/host') // one ManifestEntry per file staged
2390
+ * stageHost(process.cwd(), 'dist/host') // one HostManifestEntry per file staged
2391
2391
  * ```
2392
2392
  */
2393
- export declare function stageHost(checkout: string, host: string, options?: HostStageOptions): readonly ManifestEntry[];
2393
+ export declare function stageHost(checkout: string, host: string, options?: HostStageOptions): readonly HostManifestEntry[];
2394
2394
 
2395
2395
  /**
2396
2396
  * Stages the committed inventory of the files a vendored host carries.
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
- import { andOf, arrayOf, attempt, boundsOf, compareValues, compileGuard, holds, isArray, isBoolean, isDefined, isError, isFunction, isInteger, isNonNegativeInteger, isNumber, isObject, isRecord, isString, parseJSON, parseJSONAs, parseStringField, recordOf, recordShape, stringOf, stringShape, unionOf, whereOf } from "@orkestrel/contract";
3
- import { CANON_PATHS, CATALOG_AGENT_PATH, CATALOG_END_MARKER, CATALOG_START_MARKER, CONTROL_CHARACTER_PATTERN, DEPENDENCY_NAME_PATTERN, EXECUTABLE_PATHS, HOST_INVENTORY_PATH, HOST_PATHS, MAX_ARTIFACT_BYTES, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, REFERENCE_PATHS, SURFACE_TRANSFERS, ScaffoldError, bytesToHex, catalogToLayers, cloneValue, collectSurfaceCollisions, collectSurfaceConflicts, compareSurfaceCollisions, compareVersions, computeBytes, computeTotal, contentToHex, extractRangeMajor, extractVersion, inferGroup, insertManifestDependencies, isAudit, isCatalogEntry, isCollection, isDependency, isDependencyName, isFloorPath, isHex, isManifestScript, isMirror, isPath, isPlan, isRetainedPath, isSnapshot, iterateAnswers, manifestToName, matchesDriftReachability, matchesRange, nameToGuide, planToFindings, renderSkillPointer, replaceManifestOverrides, replaceManifestRanges, replaceManifestScripts } from "../core/index.js";
2
+ import { andOf, arrayOf, attempt, boundsOf, comparePrimitives, compileGuard, holds, isArray, isBoolean, isDefined, isError, isFunction, isInteger, isNonNegativeInteger, isNumber, isObject, isRecord, isString, parseJSON, parseJSONAs, parseStringField, recordOf, recordShape, stringOf, stringShape, unionOf, whereOf } from "@orkestrel/contract";
3
+ import { CANON_PATHS, CATALOG_AGENT_PATH, CATALOG_END_MARKER, CATALOG_START_MARKER, CONTROL_CHARACTER_PATTERN, DEPENDENCY_NAME_PATTERN, EXECUTABLE_PATHS, HOST_INVENTORY_PATH, HOST_PATHS, MAX_ARTIFACT_BYTES, MAX_COLLECTION_ITEMS, MAX_DEPENDENCY_NAME_LENGTH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, MAX_RANGE_LENGTH, MAX_REGISTRY_BYTES, MAX_TOTAL_ARTIFACT_BYTES, MAX_TOTAL_REGISTRY_BYTES, REFERENCE_PATHS, SURFACE_TRANSFERS, ScaffoldError, bytesToHex, catalogToLayers, collectSurfaceCollisions, collectSurfaceConflicts, compareSurfaceCollisions, compareVersions, computeBytes, computeTotal, contentToHex, extractRangeMajor, extractVersion, inferArtifactGroup, insertManifestDependencies, isAudit, isCatalogEntry, isCollection, isDependency, isDependencyName, isFloorPath, isHexContent, isManifestScript, isMirror, isPath, isPlan, isRetainedPath, isSnapshot, iterateAnswers, manifestToName, matchesArtifactDriftReachability, matchesRange, nameToGuide, parseOwnedJSONValue, planToArtifactFindings, renderSkillPointer, replaceManifestOverrides, replaceManifestRanges, replaceManifestScripts } from "../core/index.js";
4
4
  import { createHash, randomUUID } from "node:crypto";
5
5
  import { chmodSync, closeSync, constants, copyFileSync, fstatSync, linkSync, lstatSync, mkdirSync, mkdtempSync, openSync, opendirSync, readSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, rmdirSync, writeFileSync } from "node:fs";
6
6
  import { tmpdir } from "node:os";
@@ -364,7 +364,7 @@ function computeDigest(content) {
364
364
  * ```
365
365
  */
366
366
  function hexToDigest(hex) {
367
- if (!isHex(hex)) throw new ScaffoldError("INVALID", "Digest input is not exact hexadecimal bytes", { hex });
367
+ if (!isHexContent(hex)) throw new ScaffoldError("INVALID", "Digest input is not exact hexadecimal bytes", { hex });
368
368
  return createHash("sha256").update(Buffer.from(hex, "hex")).digest("hex");
369
369
  }
370
370
  /**
@@ -389,7 +389,7 @@ function hexToDigest(hex) {
389
389
  * ```
390
390
  */
391
391
  function decodeHexText(hex) {
392
- if (!isHex(hex)) throw new ScaffoldError("INVALID", "Decode input is not exact hexadecimal bytes", { hex });
392
+ if (!isHexContent(hex)) throw new ScaffoldError("INVALID", "Decode input is not exact hexadecimal bytes", { hex });
393
393
  const decoded = attempt(() => new TextDecoder("utf-8", { fatal: true }).decode(Buffer.from(hex, "hex")));
394
394
  return decoded.success ? decoded.value : void 0;
395
395
  }
@@ -1008,7 +1008,7 @@ function listCanonPaths(target, groups) {
1008
1008
  if (full === void 0) return [];
1009
1009
  if (isPhysicalFile(full)) return [member];
1010
1010
  return isPhysicalDirectory(full) ? listFiles(full).map((name) => `${member}/${name}`) : [];
1011
- }).filter((path) => groups.includes(inferGroup(path)));
1011
+ }).filter((path) => groups.includes(inferArtifactGroup(path)));
1012
1012
  }
1013
1013
  /**
1014
1014
  * Removes every directory one set of deletions emptied.
@@ -1041,7 +1041,7 @@ function listCanonPaths(target, groups) {
1041
1041
  * ```
1042
1042
  */
1043
1043
  function pruneEmptiedDirectories(target, removed) {
1044
- return [...new Set(Iterator.from(removed).flatMap((path) => listAncestors(path).slice(1, -1)).toArray())].sort((left, right) => compareValues(right.split("/").length, left.split("/").length) || compareValues(left, right)).flatMap((candidate) => {
1044
+ return [...new Set(Iterator.from(removed).flatMap((path) => listAncestors(path).slice(1, -1)).toArray())].sort((left, right) => comparePrimitives(right.split("/").length, left.split("/").length) || comparePrimitives(left, right)).flatMap((candidate) => {
1045
1045
  const directory = resolveContainedPath(target, candidate);
1046
1046
  if (directory === void 0 || !isPhysicalDirectory(directory)) return [];
1047
1047
  const entries = attempt(() => readdirSync(directory));
@@ -1326,13 +1326,13 @@ function readHostFloor(root) {
1326
1326
  *
1327
1327
  * @example
1328
1328
  * ```ts
1329
- * import { readManifestEntry } from '@orkestrel/scaffold/server'
1329
+ * import { readHostManifestEntry } from '@orkestrel/scaffold/server'
1330
1330
  *
1331
- * readManifestEntry('.gitignore', '/tmp/checkout/.gitignore')
1331
+ * readHostManifestEntry('.gitignore', '/tmp/checkout/.gitignore')
1332
1332
  * // { storage: 'dotfiles/gitignore', destination: '.gitignore', executable: false, digest: '...' }
1333
1333
  * ```
1334
1334
  */
1335
- function readManifestEntry(destination, source) {
1335
+ function readHostManifestEntry(destination, source) {
1336
1336
  const digest = computeFileDigest(source);
1337
1337
  if (digest === void 0) return void 0;
1338
1338
  return {
@@ -1547,7 +1547,7 @@ function stageBytes(host, root, destinations) {
1547
1547
  * ```ts
1548
1548
  * import { stageHost } from '@orkestrel/scaffold/server'
1549
1549
  *
1550
- * stageHost(process.cwd(), 'dist/host') // one ManifestEntry per file staged
1550
+ * stageHost(process.cwd(), 'dist/host') // one HostManifestEntry per file staged
1551
1551
  * ```
1552
1552
  */
1553
1553
  function stageHost(checkout, host, options) {
@@ -1612,7 +1612,7 @@ function stageHost(checkout, host, options) {
1612
1612
  checkout: source,
1613
1613
  path: destination
1614
1614
  });
1615
- const entry = readManifestEntry(destination, full);
1615
+ const entry = readHostManifestEntry(destination, full);
1616
1616
  if (entry === void 0) throw new ScaffoldError("TARGET", `Vendored path is not a plain file within the artifact ceiling at ${destination}`, {
1617
1617
  checkout: source,
1618
1618
  path: destination,
@@ -2426,7 +2426,7 @@ var isMirrors = andOf(isCollection, arrayOf(isMirror));
2426
2426
  /** Narrows a value to a bounded list of fleet catalog rows. */
2427
2427
  var isCatalogEntries = andOf(isCollection, arrayOf(isCatalogEntry));
2428
2428
  /**
2429
- * Narrows a value to one {@link ManifestEntry}.
2429
+ * Narrows a value to one {@link HostManifestEntry}.
2430
2430
  *
2431
2431
  * @remarks
2432
2432
  * Both paths are measured by the core path law, because a vendored host's
@@ -2436,9 +2436,9 @@ var isCatalogEntries = andOf(isCollection, arrayOf(isCatalogEntry));
2436
2436
  *
2437
2437
  * @example
2438
2438
  * ```ts
2439
- * import { isManifestEntry } from '@orkestrel/scaffold/server'
2439
+ * import { isHostManifestEntry } from '@orkestrel/scaffold/server'
2440
2440
  *
2441
- * isManifestEntry({
2441
+ * isHostManifestEntry({
2442
2442
  * storage: 'AGENTS.md',
2443
2443
  * destination: 'AGENTS.md',
2444
2444
  * executable: false,
@@ -2446,7 +2446,7 @@ var isCatalogEntries = andOf(isCollection, arrayOf(isCatalogEntry));
2446
2446
  * }) // true
2447
2447
  * ```
2448
2448
  */
2449
- var isManifestEntry = recordOf({
2449
+ var isHostManifestEntry = recordOf({
2450
2450
  storage: isPath,
2451
2451
  destination: isPath,
2452
2452
  executable: isBoolean,
@@ -2462,7 +2462,7 @@ var isManifestEntry = recordOf({
2462
2462
  * the syntax of the digest that authenticates that membership.
2463
2463
  */
2464
2464
  var isHostManifest = recordOf({
2465
- entries: andOf(isCollection, arrayOf(isManifestEntry)),
2465
+ entries: andOf(isCollection, arrayOf(isHostManifestEntry)),
2466
2466
  roots: andOf(isCollection, arrayOf(isPath)),
2467
2467
  surface: whereOf(arrayOf(recordOf({
2468
2468
  name: stringOf({ min: 1 }),
@@ -3303,7 +3303,7 @@ var Materializer = class {
3303
3303
  * match the ones the audit carried for every path the plan owns; anything else
3304
3304
  * means the target moved, and the whole call is refused. The audit is checked
3305
3305
  * for agreement rather than for plausibility, so a verdict the comparison could
3306
- * not have produced — a birth-owned path reported stale, which the `Finding`
3306
+ * not have produced — a birth-owned path reported stale, which the `ArtifactFinding`
3307
3307
  * shape admits — disagrees with the derived one and is refused. A missing
3308
3308
  * destination is restored whatever its ownership; a stale one is replaced only
3309
3309
  * where the artifact claims its bytes, which is what leaves a presence-owned
@@ -3370,7 +3370,7 @@ var Materializer = class {
3370
3370
  preconditions.push(this.#bind(directory, fetched.path, current === void 0));
3371
3371
  writes.push(fetched.lookup === "found" ? {
3372
3372
  path: fetched.path,
3373
- group: inferGroup(fetched.path),
3373
+ group: inferArtifactGroup(fetched.path),
3374
3374
  ownership: "content",
3375
3375
  origin: "computed",
3376
3376
  content: fetched.content
@@ -3521,7 +3521,7 @@ var Materializer = class {
3521
3521
  this.#emitter.destroy();
3522
3522
  }
3523
3523
  #own(host) {
3524
- const owned = cloneValue(host);
3524
+ const owned = parseOwnedJSONValue(host);
3525
3525
  if (isHost(owned)) return owned;
3526
3526
  throw this.#error("INVALID", "The host argument is not the exact shape this materializer accepts.", { field: "host" });
3527
3527
  }
@@ -3611,7 +3611,7 @@ var Materializer = class {
3611
3611
  }
3612
3612
  }
3613
3613
  return {
3614
- findings: planToFindings(hydrated, readSnapshot(target, [...paths])),
3614
+ findings: planToArtifactFindings(hydrated, readSnapshot(target, [...paths])),
3615
3615
  questions
3616
3616
  };
3617
3617
  }
@@ -3781,7 +3781,7 @@ var Materializer = class {
3781
3781
  path: finding.path
3782
3782
  });
3783
3783
  if (other.drift === finding.drift && other.observed === finding.observed) continue;
3784
- if (!matchesDriftReachability(finding.ownership, other)) throw this.#error("TARGET", `The path ${finding.path} carries an audit verdict this plan could not produce.`, {
3784
+ if (!matchesArtifactDriftReachability(finding.ownership, other)) throw this.#error("TARGET", `The path ${finding.path} carries an audit verdict this plan could not produce.`, {
3785
3785
  target,
3786
3786
  path: finding.path,
3787
3787
  ownership: finding.ownership,
@@ -3858,7 +3858,7 @@ var Materializer = class {
3858
3858
  });
3859
3859
  return this.#apply(target, [{
3860
3860
  path,
3861
- group: inferGroup(path),
3861
+ group: inferArtifactGroup(path),
3862
3862
  ownership: "content",
3863
3863
  origin: "computed",
3864
3864
  content
@@ -4037,7 +4037,7 @@ var Materializer = class {
4037
4037
  return result;
4038
4038
  }
4039
4039
  #accept(value, guard, field) {
4040
- const snapshot = cloneValue(value);
4040
+ const snapshot = parseOwnedJSONValue(value);
4041
4041
  if (guard(snapshot)) return snapshot;
4042
4042
  throw this.#error("INVALID", `The ${field} argument is not the exact shape this materializer accepts.`, { field });
4043
4043
  }
@@ -4501,7 +4501,7 @@ var Upstream = class {
4501
4501
  note: inventory.note,
4502
4502
  ...carried
4503
4503
  };
4504
- if (inferGroup(path) === "guides") return {
4504
+ if (inferArtifactGroup(path) === "guides") return {
4505
4505
  path,
4506
4506
  lookup: "missing",
4507
4507
  note: `${path} is a guide mirror the fleet serves`,
@@ -4833,7 +4833,7 @@ var Upstream = class {
4833
4833
  return produced;
4834
4834
  }
4835
4835
  #accept(value, guard, field) {
4836
- const snapshot = cloneValue(value);
4836
+ const snapshot = parseOwnedJSONValue(value);
4837
4837
  if (guard(snapshot)) return snapshot;
4838
4838
  throw this.#error("INVALID", `The ${field} argument is not the exact shape this upstream reader accepts.`, { field });
4839
4839
  }
@@ -4846,6 +4846,6 @@ var Upstream = class {
4846
4846
  return error;
4847
4847
  }
4848
4848
  };
4849
- export { BRANCH_PATTERN, DEFAULT_BRANCH, DEFAULT_REGISTRY_BASE, DEFAULT_REPOSITORY_BASE, DEFAULT_UPSTREAM_CONCURRENCY, DEFAULT_UPSTREAM_RETRIES, DEFAULT_UPSTREAM_TIMEOUT, DIGEST_PATTERN, DRIVE_PATTERN, INVALID_SEGMENT_CHARACTER_PATTERN, MANIFEST_NAME, MAX_BRANCH_LENGTH, MAX_ENDPOINT_LENGTH, MAX_INVENTORY_PATHS, MAX_PATH_DEPTH, MAX_PATH_SEGMENT_BYTES, MAX_UPSTREAM_CONCURRENCY, MAX_UPSTREAM_RETRIES, MAX_UPSTREAM_TIMEOUT, Materializer, ORKESTREL_SCOPE, PACKUMENT_MEDIA_TYPE, RESERVED_SEGMENT_PATTERN, ReadAllowance, SCAFFOLD_REPOSITORY, UNREADABLE_VERSION_NOTE, Upstream, WriteTransaction, climbRealPath, collectIndexed, computeDigest, computeFileDigest, computeManifestDigest, decodeHexText, filesToHost, hexToDigest, isBranch, isCatalogEntries, isDependencies, isDependencyNames, isDigest, isEndpoint, isExactCaseFile, isFilesystemPath, isHost, isHostManifest, isInventory, isManifestEntry, isManifestRegionSet, isMaterializerHooks, isMaterializerOptions, isMirrors, isPaths, isPhysicalDirectory, isPhysicalFile, isSurfaceModule, isTimeout, isUpstreamHooks, isUpstreamOptions, isVacant, isWorktree, listAncestors, listCanonPaths, listDirectories, listFiles, matchesAnchor, matchesExecutablePath, matchesExpectation, matchesGitPath, matchesMissingPath, matchesPrecondition, matchesProtectedPath, matchesSensitivePath, pathToStorage, pruneEmptiedDirectories, readAnchor, readExpectation, readFileHex, readFileText, readHostFloor, readHostManifest, readManifestEntry, readSnapshot, readSurfaceBaseline, readSurfaceCandidate, readSurfaceClaims, readSurfaceCollisions, readSurfaceFile, readSurfaceGuide, readSurfaceModule, readSurfaceRecord, resolveContainedPath, resolveHostRoot, resolveRealPath, stageBytes, stageHost, stageInventory };
4849
+ export { BRANCH_PATTERN, DEFAULT_BRANCH, DEFAULT_REGISTRY_BASE, DEFAULT_REPOSITORY_BASE, DEFAULT_UPSTREAM_CONCURRENCY, DEFAULT_UPSTREAM_RETRIES, DEFAULT_UPSTREAM_TIMEOUT, DIGEST_PATTERN, DRIVE_PATTERN, INVALID_SEGMENT_CHARACTER_PATTERN, MANIFEST_NAME, MAX_BRANCH_LENGTH, MAX_ENDPOINT_LENGTH, MAX_INVENTORY_PATHS, MAX_PATH_DEPTH, MAX_PATH_SEGMENT_BYTES, MAX_UPSTREAM_CONCURRENCY, MAX_UPSTREAM_RETRIES, MAX_UPSTREAM_TIMEOUT, Materializer, ORKESTREL_SCOPE, PACKUMENT_MEDIA_TYPE, RESERVED_SEGMENT_PATTERN, ReadAllowance, SCAFFOLD_REPOSITORY, UNREADABLE_VERSION_NOTE, Upstream, WriteTransaction, climbRealPath, collectIndexed, computeDigest, computeFileDigest, computeManifestDigest, decodeHexText, filesToHost, hexToDigest, isBranch, isCatalogEntries, isDependencies, isDependencyNames, isDigest, isEndpoint, isExactCaseFile, isFilesystemPath, isHost, isHostManifest, isHostManifestEntry, isInventory, isManifestRegionSet, isMaterializerHooks, isMaterializerOptions, isMirrors, isPaths, isPhysicalDirectory, isPhysicalFile, isSurfaceModule, isTimeout, isUpstreamHooks, isUpstreamOptions, isVacant, isWorktree, listAncestors, listCanonPaths, listDirectories, listFiles, matchesAnchor, matchesExecutablePath, matchesExpectation, matchesGitPath, matchesMissingPath, matchesPrecondition, matchesProtectedPath, matchesSensitivePath, pathToStorage, pruneEmptiedDirectories, readAnchor, readExpectation, readFileHex, readFileText, readHostFloor, readHostManifest, readHostManifestEntry, readSnapshot, readSurfaceBaseline, readSurfaceCandidate, readSurfaceClaims, readSurfaceCollisions, readSurfaceFile, readSurfaceGuide, readSurfaceModule, readSurfaceRecord, resolveContainedPath, resolveHostRoot, resolveRealPath, stageBytes, stageHost, stageInventory };
4850
4850
 
4851
4851
  //# sourceMappingURL=index.js.map