@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
@@ -365,7 +365,7 @@ function computeDigest(content) {
365
365
  * ```
366
366
  */
367
367
  function hexToDigest(hex) {
368
- if (!(0, _src_core.isHex)(hex)) throw new _src_core.ScaffoldError("INVALID", "Digest input is not exact hexadecimal bytes", { hex });
368
+ if (!(0, _src_core.isHexContent)(hex)) throw new _src_core.ScaffoldError("INVALID", "Digest input is not exact hexadecimal bytes", { hex });
369
369
  return (0, node_crypto.createHash)("sha256").update(Buffer.from(hex, "hex")).digest("hex");
370
370
  }
371
371
  /**
@@ -390,7 +390,7 @@ function hexToDigest(hex) {
390
390
  * ```
391
391
  */
392
392
  function decodeHexText(hex) {
393
- if (!(0, _src_core.isHex)(hex)) throw new _src_core.ScaffoldError("INVALID", "Decode input is not exact hexadecimal bytes", { hex });
393
+ if (!(0, _src_core.isHexContent)(hex)) throw new _src_core.ScaffoldError("INVALID", "Decode input is not exact hexadecimal bytes", { hex });
394
394
  const decoded = (0, _orkestrel_contract.attempt)(() => new TextDecoder("utf-8", { fatal: true }).decode(Buffer.from(hex, "hex")));
395
395
  return decoded.success ? decoded.value : void 0;
396
396
  }
@@ -1009,7 +1009,7 @@ function listCanonPaths(target, groups) {
1009
1009
  if (full === void 0) return [];
1010
1010
  if (isPhysicalFile(full)) return [member];
1011
1011
  return isPhysicalDirectory(full) ? listFiles(full).map((name) => `${member}/${name}`) : [];
1012
- }).filter((path) => groups.includes((0, _src_core.inferGroup)(path)));
1012
+ }).filter((path) => groups.includes((0, _src_core.inferArtifactGroup)(path)));
1013
1013
  }
1014
1014
  /**
1015
1015
  * Removes every directory one set of deletions emptied.
@@ -1042,7 +1042,7 @@ function listCanonPaths(target, groups) {
1042
1042
  * ```
1043
1043
  */
1044
1044
  function pruneEmptiedDirectories(target, removed) {
1045
- return [...new Set(Iterator.from(removed).flatMap((path) => listAncestors(path).slice(1, -1)).toArray())].sort((left, right) => (0, _orkestrel_contract.compareValues)(right.split("/").length, left.split("/").length) || (0, _orkestrel_contract.compareValues)(left, right)).flatMap((candidate) => {
1045
+ return [...new Set(Iterator.from(removed).flatMap((path) => listAncestors(path).slice(1, -1)).toArray())].sort((left, right) => (0, _orkestrel_contract.comparePrimitives)(right.split("/").length, left.split("/").length) || (0, _orkestrel_contract.comparePrimitives)(left, right)).flatMap((candidate) => {
1046
1046
  const directory = resolveContainedPath(target, candidate);
1047
1047
  if (directory === void 0 || !isPhysicalDirectory(directory)) return [];
1048
1048
  const entries = (0, _orkestrel_contract.attempt)(() => (0, node_fs.readdirSync)(directory));
@@ -1327,13 +1327,13 @@ function readHostFloor(root) {
1327
1327
  *
1328
1328
  * @example
1329
1329
  * ```ts
1330
- * import { readManifestEntry } from '@orkestrel/scaffold/server'
1330
+ * import { readHostManifestEntry } from '@orkestrel/scaffold/server'
1331
1331
  *
1332
- * readManifestEntry('.gitignore', '/tmp/checkout/.gitignore')
1332
+ * readHostManifestEntry('.gitignore', '/tmp/checkout/.gitignore')
1333
1333
  * // { storage: 'dotfiles/gitignore', destination: '.gitignore', executable: false, digest: '...' }
1334
1334
  * ```
1335
1335
  */
1336
- function readManifestEntry(destination, source) {
1336
+ function readHostManifestEntry(destination, source) {
1337
1337
  const digest = computeFileDigest(source);
1338
1338
  if (digest === void 0) return void 0;
1339
1339
  return {
@@ -1548,7 +1548,7 @@ function stageBytes(host, root, destinations) {
1548
1548
  * ```ts
1549
1549
  * import { stageHost } from '@orkestrel/scaffold/server'
1550
1550
  *
1551
- * stageHost(process.cwd(), 'dist/host') // one ManifestEntry per file staged
1551
+ * stageHost(process.cwd(), 'dist/host') // one HostManifestEntry per file staged
1552
1552
  * ```
1553
1553
  */
1554
1554
  function stageHost(checkout, host, options) {
@@ -1613,7 +1613,7 @@ function stageHost(checkout, host, options) {
1613
1613
  checkout: source,
1614
1614
  path: destination
1615
1615
  });
1616
- const entry = readManifestEntry(destination, full);
1616
+ const entry = readHostManifestEntry(destination, full);
1617
1617
  if (entry === void 0) throw new _src_core.ScaffoldError("TARGET", `Vendored path is not a plain file within the artifact ceiling at ${destination}`, {
1618
1618
  checkout: source,
1619
1619
  path: destination,
@@ -2427,7 +2427,7 @@ var isMirrors = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orke
2427
2427
  /** Narrows a value to a bounded list of fleet catalog rows. */
2428
2428
  var isCatalogEntries = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(_src_core.isCatalogEntry));
2429
2429
  /**
2430
- * Narrows a value to one {@link ManifestEntry}.
2430
+ * Narrows a value to one {@link HostManifestEntry}.
2431
2431
  *
2432
2432
  * @remarks
2433
2433
  * Both paths are measured by the core path law, because a vendored host's
@@ -2437,9 +2437,9 @@ var isCatalogEntries = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0
2437
2437
  *
2438
2438
  * @example
2439
2439
  * ```ts
2440
- * import { isManifestEntry } from '@orkestrel/scaffold/server'
2440
+ * import { isHostManifestEntry } from '@orkestrel/scaffold/server'
2441
2441
  *
2442
- * isManifestEntry({
2442
+ * isHostManifestEntry({
2443
2443
  * storage: 'AGENTS.md',
2444
2444
  * destination: 'AGENTS.md',
2445
2445
  * executable: false,
@@ -2447,7 +2447,7 @@ var isCatalogEntries = (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0
2447
2447
  * }) // true
2448
2448
  * ```
2449
2449
  */
2450
- var isManifestEntry = (0, _orkestrel_contract.recordOf)({
2450
+ var isHostManifestEntry = (0, _orkestrel_contract.recordOf)({
2451
2451
  storage: _src_core.isPath,
2452
2452
  destination: _src_core.isPath,
2453
2453
  executable: _orkestrel_contract.isBoolean,
@@ -2463,7 +2463,7 @@ var isManifestEntry = (0, _orkestrel_contract.recordOf)({
2463
2463
  * the syntax of the digest that authenticates that membership.
2464
2464
  */
2465
2465
  var isHostManifest = (0, _orkestrel_contract.recordOf)({
2466
- entries: (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(isManifestEntry)),
2466
+ entries: (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(isHostManifestEntry)),
2467
2467
  roots: (0, _orkestrel_contract.andOf)(_src_core.isCollection, (0, _orkestrel_contract.arrayOf)(_src_core.isPath)),
2468
2468
  surface: (0, _orkestrel_contract.whereOf)((0, _orkestrel_contract.arrayOf)((0, _orkestrel_contract.recordOf)({
2469
2469
  name: (0, _orkestrel_contract.stringOf)({ min: 1 }),
@@ -3304,7 +3304,7 @@ var Materializer = class {
3304
3304
  * match the ones the audit carried for every path the plan owns; anything else
3305
3305
  * means the target moved, and the whole call is refused. The audit is checked
3306
3306
  * for agreement rather than for plausibility, so a verdict the comparison could
3307
- * not have produced — a birth-owned path reported stale, which the `Finding`
3307
+ * not have produced — a birth-owned path reported stale, which the `ArtifactFinding`
3308
3308
  * shape admits — disagrees with the derived one and is refused. A missing
3309
3309
  * destination is restored whatever its ownership; a stale one is replaced only
3310
3310
  * where the artifact claims its bytes, which is what leaves a presence-owned
@@ -3371,7 +3371,7 @@ var Materializer = class {
3371
3371
  preconditions.push(this.#bind(directory, fetched.path, current === void 0));
3372
3372
  writes.push(fetched.lookup === "found" ? {
3373
3373
  path: fetched.path,
3374
- group: (0, _src_core.inferGroup)(fetched.path),
3374
+ group: (0, _src_core.inferArtifactGroup)(fetched.path),
3375
3375
  ownership: "content",
3376
3376
  origin: "computed",
3377
3377
  content: fetched.content
@@ -3522,7 +3522,7 @@ var Materializer = class {
3522
3522
  this.#emitter.destroy();
3523
3523
  }
3524
3524
  #own(host) {
3525
- const owned = (0, _src_core.cloneValue)(host);
3525
+ const owned = (0, _src_core.parseOwnedJSONValue)(host);
3526
3526
  if (isHost(owned)) return owned;
3527
3527
  throw this.#error("INVALID", "The host argument is not the exact shape this materializer accepts.", { field: "host" });
3528
3528
  }
@@ -3612,7 +3612,7 @@ var Materializer = class {
3612
3612
  }
3613
3613
  }
3614
3614
  return {
3615
- findings: (0, _src_core.planToFindings)(hydrated, readSnapshot(target, [...paths])),
3615
+ findings: (0, _src_core.planToArtifactFindings)(hydrated, readSnapshot(target, [...paths])),
3616
3616
  questions
3617
3617
  };
3618
3618
  }
@@ -3782,7 +3782,7 @@ var Materializer = class {
3782
3782
  path: finding.path
3783
3783
  });
3784
3784
  if (other.drift === finding.drift && other.observed === finding.observed) continue;
3785
- if (!(0, _src_core.matchesDriftReachability)(finding.ownership, other)) throw this.#error("TARGET", `The path ${finding.path} carries an audit verdict this plan could not produce.`, {
3785
+ if (!(0, _src_core.matchesArtifactDriftReachability)(finding.ownership, other)) throw this.#error("TARGET", `The path ${finding.path} carries an audit verdict this plan could not produce.`, {
3786
3786
  target,
3787
3787
  path: finding.path,
3788
3788
  ownership: finding.ownership,
@@ -3859,7 +3859,7 @@ var Materializer = class {
3859
3859
  });
3860
3860
  return this.#apply(target, [{
3861
3861
  path,
3862
- group: (0, _src_core.inferGroup)(path),
3862
+ group: (0, _src_core.inferArtifactGroup)(path),
3863
3863
  ownership: "content",
3864
3864
  origin: "computed",
3865
3865
  content
@@ -4038,7 +4038,7 @@ var Materializer = class {
4038
4038
  return result;
4039
4039
  }
4040
4040
  #accept(value, guard, field) {
4041
- const snapshot = (0, _src_core.cloneValue)(value);
4041
+ const snapshot = (0, _src_core.parseOwnedJSONValue)(value);
4042
4042
  if (guard(snapshot)) return snapshot;
4043
4043
  throw this.#error("INVALID", `The ${field} argument is not the exact shape this materializer accepts.`, { field });
4044
4044
  }
@@ -4502,7 +4502,7 @@ var Upstream = class {
4502
4502
  note: inventory.note,
4503
4503
  ...carried
4504
4504
  };
4505
- if ((0, _src_core.inferGroup)(path) === "guides") return {
4505
+ if ((0, _src_core.inferArtifactGroup)(path) === "guides") return {
4506
4506
  path,
4507
4507
  lookup: "missing",
4508
4508
  note: `${path} is a guide mirror the fleet serves`,
@@ -4834,7 +4834,7 @@ var Upstream = class {
4834
4834
  return produced;
4835
4835
  }
4836
4836
  #accept(value, guard, field) {
4837
- const snapshot = (0, _src_core.cloneValue)(value);
4837
+ const snapshot = (0, _src_core.parseOwnedJSONValue)(value);
4838
4838
  if (guard(snapshot)) return snapshot;
4839
4839
  throw this.#error("INVALID", `The ${field} argument is not the exact shape this upstream reader accepts.`, { field });
4840
4840
  }
@@ -4893,8 +4893,8 @@ exports.isExactCaseFile = isExactCaseFile;
4893
4893
  exports.isFilesystemPath = isFilesystemPath;
4894
4894
  exports.isHost = isHost;
4895
4895
  exports.isHostManifest = isHostManifest;
4896
+ exports.isHostManifestEntry = isHostManifestEntry;
4896
4897
  exports.isInventory = isInventory;
4897
- exports.isManifestEntry = isManifestEntry;
4898
4898
  exports.isManifestRegionSet = isManifestRegionSet;
4899
4899
  exports.isMaterializerHooks = isMaterializerHooks;
4900
4900
  exports.isMaterializerOptions = isMaterializerOptions;
@@ -4928,7 +4928,7 @@ exports.readFileHex = readFileHex;
4928
4928
  exports.readFileText = readFileText;
4929
4929
  exports.readHostFloor = readHostFloor;
4930
4930
  exports.readHostManifest = readHostManifest;
4931
- exports.readManifestEntry = readManifestEntry;
4931
+ exports.readHostManifestEntry = readHostManifestEntry;
4932
4932
  exports.readSnapshot = readSnapshot;
4933
4933
  exports.readSurfaceBaseline = readSurfaceBaseline;
4934
4934
  exports.readSurfaceCandidate = readSurfaceCandidate;