@orkestrel/scaffold 0.0.66 → 0.0.68

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 (74) hide show
  1. package/dist/bin/main.js +67 -44
  2. package/dist/bin/main.js.map +1 -1
  3. package/dist/host/agents/templates/brief.md +9 -0
  4. package/dist/host/claude/agents/orkestrel.md +8 -8
  5. package/dist/host/claude/rules/names.md +15 -0
  6. package/dist/host/claude/rules/tests.md +33 -4
  7. package/dist/host/claude/rules/workspace.md +14 -2
  8. package/dist/host/dotfiles/prettierignore +3 -0
  9. package/dist/host/guides/README.md +65 -0
  10. package/dist/host/guides/abort.md +169 -0
  11. package/dist/host/guides/agent.md +1509 -0
  12. package/dist/host/guides/brief.md +1266 -0
  13. package/dist/host/guides/browser.md +2200 -0
  14. package/dist/host/guides/budget.md +196 -0
  15. package/dist/host/guides/codec.md +519 -0
  16. package/dist/host/guides/console.md +785 -0
  17. package/dist/host/guides/contract.md +1193 -0
  18. package/dist/host/guides/csv.md +541 -0
  19. package/dist/host/guides/database.md +2518 -0
  20. package/dist/host/guides/emitter.md +233 -0
  21. package/dist/host/guides/form.md +1791 -0
  22. package/dist/host/guides/html.md +717 -0
  23. package/dist/host/guides/indexeddb.md +505 -0
  24. package/dist/host/guides/interpret.md +1029 -0
  25. package/dist/host/guides/lsp.md +515 -0
  26. package/dist/host/guides/markdown.md +964 -0
  27. package/dist/host/guides/mcp.md +5554 -0
  28. package/dist/host/guides/middleware.md +927 -0
  29. package/dist/host/guides/msg.md +440 -0
  30. package/dist/host/guides/ndjson.md +120 -0
  31. package/dist/host/guides/ollama.md +380 -0
  32. package/dist/host/guides/pool.md +280 -0
  33. package/dist/host/guides/probe.md +1210 -0
  34. package/dist/host/guides/process.md +1620 -0
  35. package/dist/host/guides/program.md +1110 -0
  36. package/dist/host/guides/qualifier.md +854 -0
  37. package/dist/host/guides/queue.md +370 -0
  38. package/dist/host/guides/rater.md +330 -0
  39. package/dist/host/guides/reason.md +1122 -0
  40. package/dist/host/guides/relation.md +373 -0
  41. package/dist/host/guides/router.md +753 -0
  42. package/dist/host/guides/scaffold.md +192 -31
  43. package/dist/host/guides/sea.md +383 -0
  44. package/dist/host/guides/server.md +752 -0
  45. package/dist/host/guides/sqlite.md +330 -0
  46. package/dist/host/guides/sse.md +187 -0
  47. package/dist/host/guides/supervisor.md +4890 -0
  48. package/dist/host/guides/table.md +1556 -0
  49. package/dist/host/guides/template.md +280 -0
  50. package/dist/host/guides/terminal.md +1145 -0
  51. package/dist/host/guides/test.md +2969 -0
  52. package/dist/host/guides/timeout.md +252 -0
  53. package/dist/host/guides/tool.md +311 -0
  54. package/dist/host/guides/toolbox.md +1038 -0
  55. package/dist/host/guides/websocket.md +282 -0
  56. package/dist/host/guides/worker.md +615 -0
  57. package/dist/host/guides/workflow.md +1507 -0
  58. package/dist/host/guides/workspace.md +595 -0
  59. package/dist/host/manifest.json +1218 -10
  60. package/dist/host/tests/policy.test.ts +279 -2
  61. package/dist/host/tests/setupPolicy.ts +437 -6
  62. package/dist/src/core/index.cjs +44 -22
  63. package/dist/src/core/index.cjs.map +1 -1
  64. package/dist/src/core/index.d.cts +33 -9
  65. package/dist/src/core/index.d.ts +33 -9
  66. package/dist/src/core/index.js +43 -23
  67. package/dist/src/core/index.js.map +1 -1
  68. package/dist/src/server/index.cjs +1750 -1567
  69. package/dist/src/server/index.cjs.map +1 -1
  70. package/dist/src/server/index.d.cts +106 -24
  71. package/dist/src/server/index.d.ts +106 -24
  72. package/dist/src/server/index.js +1751 -1570
  73. package/dist/src/server/index.js.map +1 -1
  74. package/package.json +9 -9
package/dist/bin/main.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { align, renderTable, strip, stripControls, width } from "@orkestrel/console";
3
3
  import { attempt, isError, isRecord, isString, parseJSON } from "@orkestrel/contract";
4
4
  import { BIN_ENTRY_PATH, CATALOG_AGENT_PATH, CONFORMANCE_TEST_PATH, Compiler, DEPENDENCY_NAME_PATTERN, ENVIRONMENTS, GLOBAL_SETUP_PATH, GROUPS, GUIDES_TEST_PATH, HOST_PATHS, INTEGRATION_TEST_PATH, MAX_MANIFEST_BYTES, MAX_PATH_LENGTH, SERVICE_SETUP_PATH, SHOWCASE_CONFIG_PATH, ScaffoldError, blueprintToDevDependencies, blueprintToRootVite, blueprintToScripts, blueprintToTestArtifacts, blueprintToWritableScripts, compareVersions, createBlueprint, extractRangeMajor, extractVersion, isFloorPath, isScaffoldError, manifestToDependencies, manifestToName, nameToGuide, replaceManifestScripts, replacePlanRanges } from "../src/core/index.js";
5
- import { MAX_INVENTORY_PATHS, Materializer, Upstream, filesToHost, isExactCaseFile, isPhysicalDirectory, isWorktree, listFiles, readFileText, readHostFloor, readSnapshot, resolveContainedPath } from "../src/server/index.js";
5
+ import { MAX_INVENTORY_PATHS, Materializer, Upstream, filesToHost, isExactCaseFile, isPhysicalDirectory, isWorktree, listFiles, readFileText, readHostFloor, readHostManifest, readSnapshot, resolveContainedPath } from "../src/server/index.js";
6
6
  import { createMarkdown, flattenText, isTableNode } from "@orkestrel/markdown";
7
7
  import { createSession } from "@orkestrel/process/server";
8
8
  import { parseArgs } from "node:util";
@@ -1005,7 +1005,7 @@ function targetToEnvironments(target, axis) {
1005
1005
  /**
1006
1006
  * Reads the packages a target's catalog table listed before this run.
1007
1007
  *
1008
- * @param target - The target directory holding the catalog agent file.
1008
+ * @param target - The target or raw checkout directory, or a verified value host.
1009
1009
  * @returns The package names the table's first column carries, in table order,
1010
1010
  * and no names when the file is absent.
1011
1011
  *
@@ -1021,7 +1021,8 @@ function targetToEnvironments(target, axis) {
1021
1021
  * ```
1022
1022
  */
1023
1023
  function catalogToNames(target) {
1024
- const text = readFileText(target, CATALOG_AGENT_PATH);
1024
+ const hex = isString(target) ? void 0 : target.bytes[CATALOG_AGENT_PATH];
1025
+ const text = isString(target) ? readFileText(target, CATALOG_AGENT_PATH) : hex === void 0 ? void 0 : Buffer.from(hex, "hex").toString("utf8");
1025
1026
  if (text === void 0) return [];
1026
1027
  const names = [];
1027
1028
  for (const table of createMarkdown(text).filter(isTableNode)) for (const row of table.rows) {
@@ -1473,41 +1474,52 @@ var CLI = class {
1473
1474
  const [host, ...extra] = command.from ?? [];
1474
1475
  if (extra.length > 0) this.#warn(`Read the data root from ${String(host)}. The other ${String(extra.length)} local root${extra.length === 1 ? "" : "s"} named by --from reach nothing this run does.`);
1475
1476
  const previous = catalogToNames(target);
1476
- const fetched = await this.#fetch(target, command.all === true);
1477
- const declarations = manifestToDependencies(this.#manifest(target));
1478
- const writable = {
1479
- runtime: dependenciesToFleet(declarations.runtime),
1480
- development: dependenciesToFleet(declarations.development)
1481
- };
1482
- const releases = entriesToReleases([...writable.runtime, ...writable.development], fetched.entries);
1483
- const pins = releasesToPins(releases, writable);
1484
- const refusal = fetchToRefusal(fetched.entries, fetched.mirrors);
1485
- if (refusal !== void 0) throw refusal;
1486
- const guides = fetched.mirrors.length === 0 ? void 0 : fetched.mirrors.some((mirror) => mirror.lookup !== "found") ? "floor" : "live";
1487
- const materializer = new Materializer({ host: host ?? readHostFloor() });
1488
- let result;
1477
+ const floor = host === void 0 ? readHostFloor() : readHostManifest(host) === void 0 ? host : readHostFloor(host);
1478
+ const materializer = new Materializer({ host: floor });
1479
+ let outcome;
1489
1480
  try {
1490
- result = mergeResults(this.#publish(materializer, target, fetched.entries, fetched.mirrors), materializer.declare({
1491
- pins,
1492
- scripts: []
1493
- }, target));
1481
+ const fetched = await this.#fetch(target, command.all === true, floor);
1482
+ const guides = fetched.mirrors.length === 0 ? void 0 : fetched.mirrors.some((mirror) => mirror.lookup !== "found") ? "floor" : "live";
1483
+ if (fetched.entries === void 0) outcome = {
1484
+ ...materializer.mirror(fetched.mirrors, target),
1485
+ mirrors: fetched.mirrors,
1486
+ provenance: { ...guides === void 0 ? {} : { guides } },
1487
+ ...fetched.note === void 0 ? {} : { note: fetched.note }
1488
+ };
1489
+ else {
1490
+ const entries = fetched.entries;
1491
+ const declarations = manifestToDependencies(this.#manifest(target));
1492
+ const writable = {
1493
+ runtime: dependenciesToFleet(declarations.runtime),
1494
+ development: dependenciesToFleet(declarations.development)
1495
+ };
1496
+ const releases = entriesToReleases([...writable.runtime, ...writable.development], fetched.entries);
1497
+ const pins = releasesToPins(releases, writable);
1498
+ const refusal = fetchToRefusal(fetched.entries, fetched.mirrors);
1499
+ if (refusal !== void 0) throw refusal;
1500
+ outcome = {
1501
+ ...mergeResults(this.#publish(materializer, target, fetched.entries, fetched.mirrors), materializer.declare({
1502
+ pins,
1503
+ scripts: []
1504
+ }, target)),
1505
+ membership: {
1506
+ entries,
1507
+ dropped: previous.filter((name) => !entries.some((entry) => entry.name === name)),
1508
+ releases
1509
+ },
1510
+ mirrors: fetched.mirrors,
1511
+ provenance: {
1512
+ versions: "live",
1513
+ ...guides === void 0 ? {} : { guides }
1514
+ }
1515
+ };
1516
+ }
1494
1517
  } finally {
1495
1518
  materializer.destroy();
1496
1519
  }
1497
- const outcome = {
1498
- ...result,
1499
- entries: fetched.entries,
1500
- mirrors: fetched.mirrors,
1501
- dropped: previous.filter((name) => !fetched.entries.some((entry) => entry.name === name)),
1502
- releases,
1503
- provenance: {
1504
- versions: "live",
1505
- ...guides === void 0 ? {} : { guides }
1506
- }
1507
- };
1508
1520
  if (command.json === true) this.#report(outcome);
1509
1521
  else this.#recount(outcome);
1510
- return guides === "floor" ? 1 : 0;
1522
+ return outcome.membership === void 0 || outcome.provenance.guides === "floor" ? 1 : 0;
1511
1523
  }
1512
1524
  async #replace(command) {
1513
1525
  const target = command.target ?? ".";
@@ -1568,9 +1580,7 @@ var CLI = class {
1568
1580
  pins: versions.pins,
1569
1581
  scripts: declared.scripts
1570
1582
  }, target),
1571
- entries: [],
1572
1583
  mirrors: [],
1573
- dropped: [],
1574
1584
  releases: versions.releases,
1575
1585
  provenance: {
1576
1586
  ...versions.baseline === void 0 ? {} : { versions: versions.baseline },
@@ -1593,6 +1603,8 @@ var CLI = class {
1593
1603
  const refused = versionsToRefusal(versions);
1594
1604
  if (refused !== void 0) throw refused;
1595
1605
  const fetched = await this.#fetch(target, false);
1606
+ if (fetched.entries === void 0) throw new ScaffoldError("FETCH", fetched.note ?? "The catalog membership read did not complete.");
1607
+ const entries = fetched.entries;
1596
1608
  const incomplete = fetchToRefusal(fetched.entries, fetched.mirrors);
1597
1609
  if (incomplete !== void 0) throw incomplete;
1598
1610
  const guides = fetched.mirrors.length === 0 ? void 0 : fetched.mirrors.some((mirror) => mirror.lookup === "failed") ? "floor" : "live";
@@ -1611,9 +1623,12 @@ var CLI = class {
1611
1623
  if (guides === "floor") floors.push("guides");
1612
1624
  return {
1613
1625
  ...written,
1614
- entries: fetched.entries,
1626
+ membership: {
1627
+ entries,
1628
+ dropped: previous.filter((name) => !entries.some((entry) => entry.name === name)),
1629
+ releases: entriesToReleases([...dependenciesToFleet(declared.pins.runtime), ...dependenciesToFleet(declared.pins.development)], entries)
1630
+ },
1615
1631
  mirrors: fetched.mirrors,
1616
- dropped: previous.filter((name) => !fetched.entries.some((entry) => entry.name === name)),
1617
1632
  releases,
1618
1633
  provenance,
1619
1634
  ...floors.length === 0 ? {} : { note: `The ${floors.join(", ")} step used the distributed floor after its upstream read did not complete.` }
@@ -1624,9 +1639,7 @@ var CLI = class {
1624
1639
  written: [],
1625
1640
  skipped: [],
1626
1641
  removed: [],
1627
- entries: [],
1628
1642
  mirrors: [],
1629
- dropped: [],
1630
1643
  releases,
1631
1644
  provenance,
1632
1645
  note: `The catalog step did not complete: ${errorToEnvelope(error).error.message}`
@@ -1765,7 +1778,7 @@ var CLI = class {
1765
1778
  upstream.destroy();
1766
1779
  }
1767
1780
  }
1768
- async #fetch(target, all) {
1781
+ async #fetch(target, all, floor) {
1769
1782
  const manifest = this.#manifest(target);
1770
1783
  const own = manifestToName(manifest);
1771
1784
  const dependencies = manifestToDependencies(manifest);
@@ -1776,11 +1789,20 @@ var CLI = class {
1776
1789
  ].map((dependency) => dependency.name))];
1777
1790
  const upstream = new Upstream(this.#upstream);
1778
1791
  try {
1779
- const entries = await upstream.catalog();
1780
- const names = (all ? entries.map((entry) => entry.name) : declared).filter((name) => name !== own);
1792
+ let entries;
1793
+ let note;
1794
+ try {
1795
+ entries = await upstream.catalog();
1796
+ } catch (error) {
1797
+ if (floor === void 0) throw error;
1798
+ note = `The catalog membership read did not complete; performed a guide-only refresh: ${errorToEnvelope(error).error.message}`;
1799
+ }
1800
+ const names = (all ? entries === void 0 ? catalogToNames(floor ?? target) : entries.map((entry) => entry.name) : declared).filter((name) => name !== own);
1801
+ const mirrors = await upstream.fetch(names, readSnapshot(target, names.map(nameToGuide)));
1781
1802
  return {
1782
- entries,
1783
- mirrors: await upstream.fetch(names, readSnapshot(target, names.map(nameToGuide)))
1803
+ ...entries === void 0 ? {} : { entries },
1804
+ mirrors,
1805
+ ...note === void 0 ? {} : { note }
1784
1806
  };
1785
1807
  } finally {
1786
1808
  upstream.destroy();
@@ -2112,7 +2134,8 @@ var CLI = class {
2112
2134
  }
2113
2135
  #recount(result) {
2114
2136
  this.#say(resultToTally(result));
2115
- this.#say(`${String(result.entries.length)} published, ${String(result.mirrors.filter((mirror) => mirror.lookup === "found").length)} guide${result.mirrors.length === 1 ? "" : "s"} fetched, ${String(result.dropped.length)} no longer listed.`);
2137
+ if (result.membership !== void 0) this.#say(`${String(result.membership.entries.length)} published, ${String(result.mirrors.filter((mirror) => mirror.lookup === "found").length)} guide${result.mirrors.length === 1 ? "" : "s"} fetched, ${String(result.membership.dropped.length)} no longer listed.`);
2138
+ if (result.note !== void 0) this.#warn(result.note);
2116
2139
  for (const mirror of result.mirrors) if (mirror.lookup !== "found") this.#warn(`${mirror.name}: ${mirror.note}`);
2117
2140
  }
2118
2141
  #report(value) {