@m8t-stack/cli 0.2.110 → 0.2.111

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/dist/cli.js CHANGED
@@ -1454,7 +1454,7 @@ function installFoundryDnsShim() {
1454
1454
  }
1455
1455
 
1456
1456
  // src/lib/package-version.ts
1457
- var CLI_VERSION = "0.2.110";
1457
+ var CLI_VERSION = "0.2.111";
1458
1458
 
1459
1459
  // src/lib/render-error.ts
1460
1460
  init_errors();
@@ -24370,8 +24370,8 @@ var PlatformRequestUpdateCommand = class extends M8tCommand {
24370
24370
  description: "Ask this installation's updater to converge to a version, exactly as the in-app button does.",
24371
24371
  details: "Writes the update request the updater job claims on its next tick. This is the ONLY privilege the requester holds \u2014 it does not deploy anything itself; the install's own updater fetches the release, applies it, health-gates it and rolls back on failure. With --wait, follows the request to a terminal state and exits non-zero if it did not succeed.",
24372
24372
  examples: [
24373
- ["Request an update", "m8t platform request-update --version 0.7.4 --resource-group rg-m8t --subscription <id>"],
24374
- ["Request it and wait", "m8t platform request-update --version 0.7.4 --wait --resource-group rg-m8t --subscription <id>"]
24373
+ ["Request an update", "m8t platform request-update --version 0.7.5 --resource-group rg-m8t --subscription <id>"],
24374
+ ["Request it and wait", "m8t platform request-update --version 0.7.5 --wait --resource-group rg-m8t --subscription <id>"]
24375
24375
  ]
24376
24376
  });
24377
24377
  version = Option35.String("--version", { description: "The platform version to converge to." });
@@ -30078,14 +30078,73 @@ function renderDigestMarkdown(digest, opts) {
30078
30078
 
30079
30079
  // ../../packages/brain/engine/dist/esm/dream/digest-commit.js
30080
30080
  var DIGEST_DIR = "artifacts/dream-digest";
30081
+ var ISO_UTC = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?Z$/;
30081
30082
  function digestPaths(cycle) {
30082
30083
  return { json: `${DIGEST_DIR}/${cycle}.json`, md: `${DIGEST_DIR}/${cycle}.md` };
30083
30084
  }
30085
+ function normalizeCycleTimestamp(cycle) {
30086
+ const match = ISO_UTC.exec(cycle);
30087
+ if (!match)
30088
+ return null;
30089
+ const parsed = new Date(cycle);
30090
+ if (!Number.isFinite(parsed.getTime()))
30091
+ return null;
30092
+ const [, year, month, day, hour, minute, second] = match.map(Number);
30093
+ if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() + 1 !== month || parsed.getUTCDate() !== day || parsed.getUTCHours() !== hour || parsed.getUTCMinutes() !== minute || parsed.getUTCSeconds() !== second)
30094
+ return null;
30095
+ return parsed.toISOString();
30096
+ }
30097
+ function oneLine(value, max = 240) {
30098
+ const withoutControls = Array.from(value, (char) => {
30099
+ const code = char.codePointAt(0) ?? 0;
30100
+ return code < 32 || code >= 127 && code <= 159 || code === 8232 || code === 8233 ? " " : char;
30101
+ }).join("");
30102
+ const collapsed = withoutControls.replace(/\s+/g, " ").trim();
30103
+ return Array.from(collapsed).slice(0, max).join("");
30104
+ }
30105
+ function yamlScalar(value) {
30106
+ return JSON.stringify(value).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
30107
+ }
30108
+ function digestSources(digest) {
30109
+ const refs = /* @__PURE__ */ new Set();
30110
+ for (const entry of digest.entries) {
30111
+ const evidence = entry.evidence;
30112
+ if (!Array.isArray(evidence))
30113
+ continue;
30114
+ for (const ref of evidence)
30115
+ if (typeof ref === "string" && ref.length > 0)
30116
+ refs.add(ref);
30117
+ }
30118
+ return [...refs];
30119
+ }
30120
+ function renderDreamDigestArtifact(digest, timestamp2) {
30121
+ const worker = oneLine(digest.worker) || "worker";
30122
+ const lines = [
30123
+ "---",
30124
+ "type: artifact",
30125
+ `title: ${yamlScalar(`Dream digest \u2014 ${worker}`)}`,
30126
+ `created: ${timestamp2}`,
30127
+ `updated: ${timestamp2}`,
30128
+ "tags:",
30129
+ " - dream-digest",
30130
+ "origin: dream"
30131
+ ];
30132
+ const sources = digestSources(digest);
30133
+ if (sources.length > 0) {
30134
+ lines.push("source:", ...sources.map((source) => ` - ${yamlScalar(source)}`));
30135
+ }
30136
+ lines.push("---", "");
30137
+ return `${lines.join("\n")}${renderDigestMarkdown({ ...digest, worker })}`;
30138
+ }
30084
30139
  async function commitDreamDigest(digest, brain, deps) {
30085
- const { json, md } = digestPaths(digest.cycle);
30086
- const jsonContent = JSON.stringify(digest, null, 2) + "\n";
30087
- const mdContent = renderDigestMarkdown(digest);
30088
30140
  try {
30141
+ const timestamp2 = normalizeCycleTimestamp(digest.cycle);
30142
+ if (timestamp2 === null) {
30143
+ return { committed: false, reason: "error", reconstructible: digest };
30144
+ }
30145
+ const { json, md } = digestPaths(digest.cycle);
30146
+ const jsonContent = JSON.stringify(digest, null, 2) + "\n";
30147
+ const mdContent = renderDreamDigestArtifact(digest, timestamp2);
30089
30148
  const expectedOldSha = await deps.fetchTip();
30090
30149
  const res = await brain.commitBatch({
30091
30150
  expectedOldSha,
@@ -30251,8 +30310,8 @@ function boundedField(value, max) {
30251
30310
  const isLineOrControl = code < 32 || code >= 127 && code <= 159 || code === 8232 || code === 8233;
30252
30311
  return isLineOrControl ? " " : char;
30253
30312
  }).join("");
30254
- const oneLine = withoutControls.replace(/\s+/g, " ").trim();
30255
- return oneLine.length <= max ? oneLine : `${oneLine.slice(0, Math.max(0, max - 1))}\u2026`;
30313
+ const oneLine2 = withoutControls.replace(/\s+/g, " ").trim();
30314
+ return oneLine2.length <= max ? oneLine2 : `${oneLine2.slice(0, Math.max(0, max - 1))}\u2026`;
30256
30315
  }
30257
30316
  function renderIndexEntry(entry, memory) {
30258
30317
  const file2 = memory.files.find((candidate2) => candidate2.path === entry.path);
@@ -30501,8 +30560,8 @@ function indexField(value, max) {
30501
30560
  const isLineOrControl = code < 32 || code >= 127 && code <= 159 || code === 8232 || code === 8233;
30502
30561
  return isLineOrControl ? " " : char;
30503
30562
  }).join("");
30504
- const oneLine = withoutControls.replace(/\s+/g, " ").trim();
30505
- return oneLine.length <= max ? oneLine : `${oneLine.slice(0, Math.max(0, max - 1))}\u2026`;
30563
+ const oneLine2 = withoutControls.replace(/\s+/g, " ").trim();
30564
+ return oneLine2.length <= max ? oneLine2 : `${oneLine2.slice(0, Math.max(0, max - 1))}\u2026`;
30506
30565
  }
30507
30566
  function indexSummary(body, title) {
30508
30567
  const summary = indexField(body, MAX_INDEX_SUMMARY_CHARS);
@@ -32660,7 +32719,7 @@ ${colors.error("\u2717")} The GitHub App on disk is installed on ${colors.field(
32660
32719
  // src/commands/bootstrap/launch.ts
32661
32720
  var DEFAULT_RG = "rg-m8t-stack";
32662
32721
  var DEFAULT_INSTALLER = "ghcr.io/m8t-labs/m8t-installer";
32663
- var DEFAULT_INSTALLER_TAG = "v0.1.77";
32722
+ var DEFAULT_INSTALLER_TAG = "v0.1.78";
32664
32723
  var ACI_NAME = "m8t-installer";
32665
32724
  var MI_NAME = "m8t-installer-mi";
32666
32725
  var BootstrapLaunchCommand = class extends M8tCommand {