@astrale-os/cli 1.0.0-beta.2 → 1.0.0-beta.4

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/astrale.js CHANGED
@@ -9738,7 +9738,7 @@ var package_default;
9738
9738
  var init_package = __esm(() => {
9739
9739
  package_default = {
9740
9740
  name: "@astrale-os/cli",
9741
- version: "1.0.0-beta.2",
9741
+ version: "1.0.0-beta.4",
9742
9742
  description: "Astrale CLI — connect to existing Astrale kernels",
9743
9743
  keywords: [
9744
9744
  "astrale",
@@ -9793,7 +9793,7 @@ var init_package = __esm(() => {
9793
9793
  prepare: "husky",
9794
9794
  build: "bun scripts/build.ts",
9795
9795
  prepack: "pnpm run package:check",
9796
- "package:check": "pnpm run typecheck && pnpm run test && pnpm run build && node scripts/verify-public-exports.mjs && node scripts/verify-private-ports-boundary.mjs",
9796
+ "package:check": "pnpm run typecheck && pnpm run test && pnpm run build && node scripts/verify-public-exports.mjs && node scripts/verify-public-dependency-boundary.mjs",
9797
9797
  typecheck: "tsgo --noEmit && tsgo --noEmit -p tsconfig.tests.json && tsgo --noEmit -p viewer && tsgo --noEmit -p studio",
9798
9798
  lint: "oxlint .",
9799
9799
  "lint:fix": "oxlint --fix .",
@@ -9817,8 +9817,8 @@ var init_package = __esm(() => {
9817
9817
  devDependencies: {
9818
9818
  "@astrale-os/kernel-client": ">=0.6.0-beta.4 <1.0.0",
9819
9819
  "@astrale-os/kernel-protocol": ">=0.5.0-beta.3 <1.0.0",
9820
- "@astrale-os/ox": ">=0.1.0 <1.0.0",
9821
- "@astrale-os/sdk": ">=0.5.0-beta.4 <1.0.0",
9820
+ "@astrale-os/ox": ">=0.1.3 <1.0.0",
9821
+ "@astrale-os/sdk": ">=0.5.0-beta.9 <1.0.0",
9822
9822
  "@astrale-os/shell": ">=0.3.8-beta.2 <1.0.0",
9823
9823
  "@astrale/commitlint-config": "jsr:~2.0.1",
9824
9824
  "@commitlint/cli": "~20.3.1",
@@ -58886,7 +58886,7 @@ var init_dist2 = __esm(() => {
58886
58886
  init_issuer2();
58887
58887
  });
58888
58888
 
58889
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/auth/exchange.js
58889
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/auth/exchange.js
58890
58890
  var exports_exchange2 = {};
58891
58891
  __export(exports_exchange2, {
58892
58892
  MEDIA_TYPE: () => MEDIA_TYPE6,
@@ -58905,7 +58905,7 @@ var init_exchange2 = __esm(() => {
58905
58905
  acceptErrorResponse2 = exports_issuer2.exchange.acceptErrorResponse;
58906
58906
  });
58907
58907
 
58908
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/auth/index.js
58908
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/auth/index.js
58909
58909
  var init_auth2 = __esm(() => {
58910
58910
  init_exchange2();
58911
58911
  init_auth();
@@ -66445,7 +66445,7 @@ var init_log = __esm(() => {
66445
66445
  IS_CI = !!(process.env.CI || process.env.CONTINUOUS_INTEGRATION || process.env.NO_SPINNER);
66446
66446
  });
66447
66447
 
66448
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/capability/define.js
66448
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/capability/define.js
66449
66449
  function capability(input) {
66450
66450
  const definition3 = acceptRecord(input, "Capability definition");
66451
66451
  exactKeys(definition3, ["id", "operations"], "Capability definition");
@@ -66577,7 +66577,7 @@ var init_define2 = __esm(() => {
66577
66577
  defineCapability = Object.assign((input) => capability(input), { operation, implement });
66578
66578
  });
66579
66579
 
66580
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/capability/client.js
66580
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/capability/client.js
66581
66581
  function captureCapabilityRequirements(requirements) {
66582
66582
  const source2 = acceptMap(requirements, "Capability requirements");
66583
66583
  const names = ownStringKeys2(source2, "Capability requirements");
@@ -66611,7 +66611,7 @@ var init_client = __esm(() => {
66611
66611
  init_define2();
66612
66612
  });
66613
66613
 
66614
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/view/admission.js
66614
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/view/admission.js
66615
66615
  function isCapturedFrontendArtifact(input) {
66616
66616
  return admittedFrontendArtifacts.has(input);
66617
66617
  }
@@ -66619,7 +66619,7 @@ var admittedFrontendArtifacts;
66619
66619
  var init_admission15 = __esm(() => {
66620
66620
  admittedFrontendArtifacts = new WeakSet;
66621
66621
  });
66622
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/binding.js
66622
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/binding.js
66623
66623
  function isWorkflowBinding(input) {
66624
66624
  return input !== null && typeof input === "object" && input.kind === "workflow" && typeof input.workflow?.run === "function";
66625
66625
  }
@@ -66628,30 +66628,30 @@ function isTriggeredHandler(input) {
66628
66628
  }
66629
66629
  var init_binding2 = () => {};
66630
66630
 
66631
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/step/inline.js
66631
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/step/inline.js
66632
66632
  var init_inline = __esm(() => {
66633
66633
  init_value();
66634
66634
  });
66635
66635
 
66636
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/step/index.js
66636
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/step/index.js
66637
66637
  var init_step = __esm(() => {
66638
66638
  init_inline();
66639
66639
  });
66640
66640
 
66641
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/runner.js
66641
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/runner.js
66642
66642
  var DIRECT_ACTIVATION;
66643
66643
  var init_runner = __esm(() => {
66644
66644
  init_step();
66645
66645
  DIRECT_ACTIVATION = Object.freeze({ kind: "direct" });
66646
66646
  });
66647
66647
 
66648
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/index.js
66648
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/workflow/index.js
66649
66649
  var init_workflow = __esm(() => {
66650
66650
  init_binding2();
66651
66651
  init_runner();
66652
66652
  });
66653
66653
 
66654
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/domain/handlers.js
66654
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/domain/handlers.js
66655
66655
  function acceptDomainHandlers(domain3, input) {
66656
66656
  const registry2 = record6(input, "handlers");
66657
66657
  exactKeys2(registry2, ["functions", "classes", "interfaces"], "handlers");
@@ -66736,7 +66736,7 @@ var init_handlers = __esm(() => {
66736
66736
  init_workflow();
66737
66737
  });
66738
66738
 
66739
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/domain/requirements.js
66739
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/domain/requirements.js
66740
66740
  function compileRequirements(domain3, input) {
66741
66741
  if (input === undefined)
66742
66742
  return EmptyPublicationRequirements;
@@ -66827,7 +66827,7 @@ var init_requirements2 = __esm(() => {
66827
66827
  });
66828
66828
  });
66829
66829
 
66830
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/domain/define.js
66830
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/domain/define.js
66831
66831
  function defineDomain(input) {
66832
66832
  const config2 = record7(input, "defineDomain input");
66833
66833
  const hasCapabilities = Object.hasOwn(config2, "capabilities");
@@ -66950,7 +66950,7 @@ var init_dist3 = __esm(() => {
66950
66950
  init_auth();
66951
66951
  });
66952
66952
 
66953
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/domain/index.js
66953
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/domain/index.js
66954
66954
  var init_domain6 = __esm(() => {
66955
66955
  init_define3();
66956
66956
  init_requirements2();
@@ -67208,7 +67208,7 @@ function builtinIdpConfig(name, clientIdOverride, env2 = process.env) {
67208
67208
  };
67209
67209
  }
67210
67210
  function workosClientIdFromEnv(env2 = process.env) {
67211
- return WORKOS_CLIENT_ID_ENV_NAMES.map((name) => env2[name]?.trim()).find((value) => typeof value === "string" && value.length > 0);
67211
+ return WORKOS_CLIENT_ID_ENV_NAMES.map((name) => env2[name]?.trim()).find((value) => typeof value === "string" && value.length > 0) ?? DEFAULT_WORKOS_CLIENT_ID;
67212
67212
  }
67213
67213
  async function fetchOAuthAuthorizationServerMetadata(issuer) {
67214
67214
  const discoveryUrl = new URL("/.well-known/oauth-authorization-server", issuer);
@@ -67553,7 +67553,7 @@ async function fetchWorkosApplication(args) {
67553
67553
  function normalizeIssuer(value) {
67554
67554
  return value.replace(/\/+$/, "");
67555
67555
  }
67556
- var IdpAudienceMismatchError, OAuthTokenError, OidcMetadataSchema, IdpClientConfigSchema, IdpIndexEntrySchema, IdpStoreSchema, IdpSessionSchema, BUILTIN_WORKOS_IDP_NAME = "workos", DEFAULT_WORKOS_API_HOST = "https://api.workos.com", WORKOS_CLIENT_ID_ENV_NAMES;
67556
+ var IdpAudienceMismatchError, OAuthTokenError, OidcMetadataSchema, IdpClientConfigSchema, IdpIndexEntrySchema, IdpStoreSchema, IdpSessionSchema, BUILTIN_WORKOS_IDP_NAME = "workos", DEFAULT_WORKOS_API_HOST = "https://api.workos.com", DEFAULT_WORKOS_CLIENT_ID = "client_01KC29HET5F3QAQ8GNTPZ7F320", WORKOS_CLIENT_ID_ENV_NAMES;
67557
67557
  var init_idp = __esm(() => {
67558
67558
  init_webapi();
67559
67559
  init_zod2();
@@ -70047,12 +70047,12 @@ var init_dist4 = __esm(() => {
70047
70047
  init_auto();
70048
70048
  });
70049
70049
 
70050
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/node/index.js
70050
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/node/index.js
70051
70051
  var init_node4 = __esm(() => {
70052
70052
  init_node();
70053
70053
  });
70054
70054
 
70055
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/path/index.js
70055
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/path/index.js
70056
70056
  var init_path5 = __esm(() => {
70057
70057
  init_path4();
70058
70058
  });
@@ -70394,7 +70394,257 @@ var init_instance2 = __esm(() => {
70394
70394
  });
70395
70395
  });
70396
70396
 
70397
+ // src/lib/proc.ts
70398
+ import { spawn } from "node:child_process";
70399
+ function run(file2, args = [], opts = {}) {
70400
+ return new Promise((resolve3, reject) => {
70401
+ const child3 = spawn(file2, args, { cwd: opts.cwd, stdio: ["ignore", "pipe", "pipe"] });
70402
+ let stdout = "";
70403
+ let stderr = "";
70404
+ child3.stdout?.setEncoding("utf8");
70405
+ child3.stderr?.setEncoding("utf8");
70406
+ child3.stdout?.on("data", (chunk) => {
70407
+ stdout += chunk;
70408
+ });
70409
+ child3.stderr?.on("data", (chunk) => {
70410
+ stderr += chunk;
70411
+ });
70412
+ child3.on("error", reject);
70413
+ child3.on("close", (code) => resolve3({ code: code ?? -1, stdout, stderr }));
70414
+ });
70415
+ }
70416
+ function runInherit(file2, args = [], opts = {}) {
70417
+ return new Promise((resolve3, reject) => {
70418
+ const child3 = spawn(file2, args, { cwd: opts.cwd, stdio: "inherit" });
70419
+ child3.on("error", reject);
70420
+ child3.on("close", (code) => resolve3(code ?? -1));
70421
+ });
70422
+ }
70423
+ function spawnHandle(file2, args = [], opts = {}) {
70424
+ return spawn(file2, args, {
70425
+ cwd: opts.cwd,
70426
+ env: opts.env,
70427
+ detached: opts.detached,
70428
+ stdio: opts.stdio ?? ["ignore", "inherit", "inherit"]
70429
+ });
70430
+ }
70431
+ var init_proc = () => {};
70432
+
70433
+ // src/lib/update.ts
70434
+ import { createHash } from "node:crypto";
70435
+ import { chmod as chmod2, copyFile, mkdir as mkdir6, mkdtemp, readFile as readFile7, rename as rename2, rm, writeFile as writeFile2 } from "node:fs/promises";
70436
+ import { tmpdir } from "node:os";
70437
+ import { dirname as dirname6, join as join4 } from "node:path";
70438
+ function detectPlatform() {
70439
+ const os2 = process.platform;
70440
+ const arch = process.arch;
70441
+ if (os2 !== "darwin" && os2 !== "linux") {
70442
+ throw new AstraleError("UNSUPPORTED_PLATFORM", `Unsupported OS "${os2}" — Astrale update supports macOS and Linux.`);
70443
+ }
70444
+ if (arch !== "arm64" && arch !== "x64") {
70445
+ throw new AstraleError("UNSUPPORTED_PLATFORM", `Unsupported CPU architecture "${arch}" — Astrale update supports arm64 and x64.`);
70446
+ }
70447
+ return { os: os2, arch };
70448
+ }
70449
+ function platformKey(platform) {
70450
+ return `${platform.os}-${platform.arch}`;
70451
+ }
70452
+ function isStandaloneBinary() {
70453
+ return Boolean(process.versions.bun);
70454
+ }
70455
+ async function readInstallMetadata(path3 = INSTALL_PATH) {
70456
+ let raw2;
70457
+ try {
70458
+ raw2 = await readFile7(path3, "utf8");
70459
+ } catch {
70460
+ throw isStandaloneBinary() ? new AstraleError("UPDATE_NOT_SCRIPT_INSTALLED", "Astrale was not installed by the official install script.", "Reinstall with: curl -fsSL https://raw.githubusercontent.com/astrale-os/cli/main/install.sh | sh") : new AstraleError("UPDATE_PACKAGE_MANAGED", "This Astrale build is managed by your package manager.", "Update with: npm install -g @astrale-os/cli@latest (or pnpm/bun)");
70461
+ }
70462
+ const parsed = InstallMetadataSchema.safeParse(JSON.parse(raw2));
70463
+ if (!parsed.success) {
70464
+ throw new AstraleError("UPDATE_BAD_INSTALL_METADATA", `Invalid install metadata at ${path3}.`, "Reinstall with: curl -fsSL https://raw.githubusercontent.com/astrale-os/cli/main/install.sh | sh");
70465
+ }
70466
+ return parsed.data;
70467
+ }
70468
+ async function writeInstallMetadata(meta3, path3 = INSTALL_PATH) {
70469
+ await mkdir6(dirname6(path3), { recursive: true });
70470
+ await writeFile2(path3, JSON.stringify(meta3, null, 2) + `
70471
+ `);
70472
+ }
70473
+ function releaseBase(meta3, req) {
70474
+ if (process.env.ASTRALE_UPDATE_BASE)
70475
+ return process.env.ASTRALE_UPDATE_BASE.replace(/\/+$/, "");
70476
+ const repo = meta3.repo || DEFAULT_REPO;
70477
+ if (req.version) {
70478
+ const version2 = req.version.replace(/^cli\/v/, "").replace(/^v/, "");
70479
+ return `https://github.com/${repo}/releases/download/cli/v${version2}`;
70480
+ }
70481
+ return `https://github.com/${repo}/releases/download/${req.channel ?? meta3.channel ?? DEFAULT_UPDATE_CHANNEL}`;
70482
+ }
70483
+ async function fetchManifest(base2) {
70484
+ const raw2 = await readUrlText(`${base2}/manifest.json`);
70485
+ return UpdateManifestSchema.parse(JSON.parse(raw2));
70486
+ }
70487
+ function shouldUpdate(currentVersion, manifestVersion) {
70488
+ return currentVersion !== manifestVersion;
70489
+ }
70490
+ async function updateAstrale(req) {
70491
+ const meta3 = await readInstallMetadata(req.installPath);
70492
+ const currentVersion = meta3.version ?? req.currentVersion;
70493
+ const channel = req.channel ?? meta3.channel ?? DEFAULT_UPDATE_CHANNEL;
70494
+ const platform = req.platform ?? detectPlatform();
70495
+ const key = platformKey(platform);
70496
+ const base2 = releaseBase(meta3, { channel, version: req.version });
70497
+ const manifest = await fetchManifest(base2);
70498
+ const asset = manifest.assets[key];
70499
+ if (!asset) {
70500
+ throw new AstraleError("UPDATE_ASSET_NOT_FOUND", `No Astrale CLI release asset for ${key}.`, `Available platforms: ${Object.keys(manifest.assets).join(", ")}`);
70501
+ }
70502
+ if (!shouldUpdate(currentVersion, manifest.version)) {
70503
+ return {
70504
+ status: "up-to-date",
70505
+ currentVersion,
70506
+ latestVersion: manifest.version,
70507
+ channel: manifest.channel
70508
+ };
70509
+ }
70510
+ if (req.check) {
70511
+ return {
70512
+ status: "available",
70513
+ currentVersion,
70514
+ latestVersion: manifest.version,
70515
+ channel: manifest.channel
70516
+ };
70517
+ }
70518
+ const tmp = await mkdtemp(join4(tmpdir(), "astrale-update-"));
70519
+ try {
70520
+ const archive = join4(tmp, asset.name);
70521
+ await downloadToFile(`${base2}/${asset.name}`, archive);
70522
+ const manifestChecksum = "sha256" in asset ? asset.sha256 : undefined;
70523
+ const expected = manifestChecksum ?? await fetchChecksum(base2, asset.name);
70524
+ const actual = await sha256File(archive);
70525
+ if (actual !== expected.toLowerCase()) {
70526
+ throw new AstraleError("UPDATE_CHECKSUM_MISMATCH", `Checksum mismatch for ${asset.name}.`, `Expected ${expected}; got ${actual}.`);
70527
+ }
70528
+ await extractTarGz(archive, tmp);
70529
+ const nextBin = join4(tmp, "astrale");
70530
+ await chmod2(nextBin, 493);
70531
+ await smokeVersion(nextBin, manifest.binaryVersion ?? manifest.version);
70532
+ const previous = `${meta3.bin}.previous`;
70533
+ const staged = `${meta3.bin}.next`;
70534
+ await copyFile(meta3.bin, previous).catch(() => {
70535
+ return;
70536
+ });
70537
+ await copyFile(nextBin, staged);
70538
+ await chmod2(staged, 493);
70539
+ await rename2(staged, meta3.bin);
70540
+ await writeInstallMetadata({
70541
+ ...meta3,
70542
+ channel: manifest.channel,
70543
+ version: manifest.version,
70544
+ installedAt: new Date().toISOString()
70545
+ }, req.installPath);
70546
+ return {
70547
+ status: "updated",
70548
+ previousVersion: currentVersion,
70549
+ currentVersion: manifest.version,
70550
+ channel: manifest.channel,
70551
+ bin: meta3.bin
70552
+ };
70553
+ } finally {
70554
+ await rm(tmp, { recursive: true, force: true });
70555
+ }
70556
+ }
70557
+ async function readUrlText(url3) {
70558
+ if (url3.startsWith("file://")) {
70559
+ return readFile7(new URL(url3), "utf8");
70560
+ }
70561
+ const res = await fetch(url3);
70562
+ if (!res.ok)
70563
+ throw new Error(`GET ${url3} failed: HTTP ${res.status}`);
70564
+ return res.text();
70565
+ }
70566
+ async function downloadToFile(url3, path3) {
70567
+ if (url3.startsWith("file://")) {
70568
+ await copyFile(new URL(url3), path3);
70569
+ return;
70570
+ }
70571
+ const res = await fetch(url3);
70572
+ if (!res.ok)
70573
+ throw new Error(`GET ${url3} failed: HTTP ${res.status}`);
70574
+ const bytes = new Uint8Array(await res.arrayBuffer());
70575
+ await writeFile2(path3, bytes);
70576
+ }
70577
+ async function fetchChecksum(base2, assetName) {
70578
+ const raw2 = await readUrlText(`${base2}/sha256sums.txt`);
70579
+ for (const line of raw2.split(/\r?\n/)) {
70580
+ const [sha, file2] = line.trim().split(/\s+/, 2);
70581
+ if (!sha || !file2)
70582
+ continue;
70583
+ if (file2.replace(/^\*/, "") === assetName && /^[a-fA-F0-9]{64}$/.test(sha))
70584
+ return sha;
70585
+ }
70586
+ throw new AstraleError("UPDATE_CHECKSUM_NOT_FOUND", `Checksum entry not found for ${assetName}.`, `Release base: ${base2}`);
70587
+ }
70588
+ async function sha256File(path3) {
70589
+ const hash2 = createHash("sha256");
70590
+ hash2.update(await readFile7(path3));
70591
+ return hash2.digest("hex");
70592
+ }
70593
+ async function extractTarGz(archive, cwd) {
70594
+ const { code, stderr } = await run("tar", ["-xzf", archive, "-C", cwd]);
70595
+ if (code !== 0) {
70596
+ throw new Error(`Could not extract update archive: ${stderr.trim()}`);
70597
+ }
70598
+ }
70599
+ async function smokeVersion(bin, expectedVersion) {
70600
+ const { code, stdout, stderr } = await run(bin, ["--version"]);
70601
+ if (code !== 0)
70602
+ throw new Error(`Updated binary failed --version: ${stderr.trim()}`);
70603
+ const actual = stdout.trim();
70604
+ if (actual !== expectedVersion) {
70605
+ throw new Error(`Updated binary reported version ${actual}, expected ${expectedVersion}`);
70606
+ }
70607
+ }
70608
+ var DEFAULT_REPO = "astrale-os/cli", DEFAULT_UPDATE_CHANNEL = "beta", InstallMetadataSchema, ManifestAssetSchema, UpdateManifestSchema;
70609
+ var init_update = __esm(() => {
70610
+ init_zod2();
70611
+ init_errors2();
70612
+ init_state();
70613
+ init_proc();
70614
+ InstallMetadataSchema = exports_external2.object({
70615
+ method: exports_external2.literal("script"),
70616
+ channel: exports_external2.string().min(1).default(DEFAULT_UPDATE_CHANNEL),
70617
+ version: exports_external2.string().min(1).optional(),
70618
+ repo: exports_external2.string().min(1).default(DEFAULT_REPO),
70619
+ bin: exports_external2.string().min(1),
70620
+ installedAt: exports_external2.string().optional()
70621
+ });
70622
+ ManifestAssetSchema = exports_external2.object({
70623
+ name: exports_external2.string().min(1),
70624
+ sha256: exports_external2.string().regex(/^[a-fA-F0-9]{64}$/).optional()
70625
+ });
70626
+ UpdateManifestSchema = exports_external2.object({
70627
+ version: exports_external2.string().min(1),
70628
+ binaryVersion: exports_external2.string().min(1).optional(),
70629
+ channel: exports_external2.string().min(1),
70630
+ repo: exports_external2.string().min(1).optional(),
70631
+ assets: exports_external2.record(exports_external2.string(), exports_external2.union([
70632
+ ManifestAssetSchema,
70633
+ exports_external2.string().min(1).transform((name) => ({ name }))
70634
+ ]))
70635
+ });
70636
+ });
70637
+
70397
70638
  // src/lib/admin-target.ts
70639
+ function defaultAdminTargetForChannel(channel) {
70640
+ return channel === "stable" ? {
70641
+ url: "https://admin.eu.astrale.ai/api",
70642
+ domainIssuer: "https://admin.astrale.ai"
70643
+ } : {
70644
+ url: "https://admin.eu.beta.astrale.ai/api",
70645
+ domainIssuer: "https://admin.beta.astrale.ai"
70646
+ };
70647
+ }
70398
70648
  async function resolveAdminTarget(opts, config2, store) {
70399
70649
  return resolveAdminTargetFromStore(opts, config2, store ?? await readInstances());
70400
70650
  }
@@ -70486,12 +70736,16 @@ function requireDomainIssuer(value, label) {
70486
70736
  return value;
70487
70737
  throw new AstraleError("ADMIN_DOMAIN_ISSUER_MISSING", `${label} has no Domain issuer for token exchange.`, "Configure domainIssuer or pass --domain-issuer <url>; there is no legacy token fallback.");
70488
70738
  }
70489
- var DEFAULT_ADMIN_TARGET_NAME = "admin", DEFAULT_ADMIN_TARGET_URL = "https://admin.eu.astrale.ai/api", DEFAULT_ADMIN_DOMAIN_ISSUER = "https://admin.beta.astrale.ai", DEFAULT_ADMIN_TARGET_CONFIG, HttpUrlSchema, AdminTargetConfigSchema, ADMIN_TARGET_OPTIONS;
70739
+ var DEFAULT_ADMIN_TARGET_NAME = "admin", DEFAULT_ADMIN_TARGET, DEFAULT_ADMIN_TARGET_URL, DEFAULT_ADMIN_DOMAIN_ISSUER, DEFAULT_ADMIN_TARGET_CONFIG, HttpUrlSchema, AdminTargetConfigSchema, ADMIN_TARGET_OPTIONS;
70490
70740
  var init_admin_target = __esm(() => {
70491
70741
  init_zod2();
70492
70742
  init_errors2();
70493
70743
  init_instance2();
70744
+ init_update();
70494
70745
  init_validation2();
70746
+ DEFAULT_ADMIN_TARGET = defaultAdminTargetForChannel(DEFAULT_UPDATE_CHANNEL);
70747
+ DEFAULT_ADMIN_TARGET_URL = DEFAULT_ADMIN_TARGET.url;
70748
+ DEFAULT_ADMIN_DOMAIN_ISSUER = DEFAULT_ADMIN_TARGET.domainIssuer;
70495
70749
  DEFAULT_ADMIN_TARGET_CONFIG = {
70496
70750
  name: DEFAULT_ADMIN_TARGET_NAME,
70497
70751
  url: DEFAULT_ADMIN_TARGET_URL,
@@ -70553,11 +70807,11 @@ var init_admin_target = __esm(() => {
70553
70807
  });
70554
70808
 
70555
70809
  // src/lib/config.ts
70556
- import { readFile as readFile7, writeFile as writeFile2, mkdir as mkdir6 } from "node:fs/promises";
70557
- import { dirname as dirname6 } from "node:path";
70810
+ import { readFile as readFile8, writeFile as writeFile3, mkdir as mkdir7 } from "node:fs/promises";
70811
+ import { dirname as dirname7 } from "node:path";
70558
70812
  async function readConfig() {
70559
70813
  try {
70560
- const raw2 = await readFile7(CONFIG_PATH, "utf-8");
70814
+ const raw2 = await readFile8(CONFIG_PATH, "utf-8");
70561
70815
  return AstraleConfigSchema.parse(JSON.parse(raw2));
70562
70816
  } catch (e) {
70563
70817
  if (e instanceof exports_external2.ZodError || e instanceof SyntaxError) {
@@ -70567,8 +70821,8 @@ async function readConfig() {
70567
70821
  }
70568
70822
  }
70569
70823
  async function writeConfig(config2) {
70570
- await mkdir6(dirname6(CONFIG_PATH), { recursive: true });
70571
- await writeFile2(CONFIG_PATH, JSON.stringify(config2, null, 2) + `
70824
+ await mkdir7(dirname7(CONFIG_PATH), { recursive: true });
70825
+ await writeFile3(CONFIG_PATH, JSON.stringify(config2, null, 2) + `
70572
70826
  `);
70573
70827
  }
70574
70828
  var AstraleConfigSchema, DEFAULT_CONFIG;
@@ -70754,13 +71008,13 @@ function readline() {
70754
71008
  function withUpdates(fn2) {
70755
71009
  const wrapped = (...args) => {
70756
71010
  const store = getStore();
70757
- let shouldUpdate = false;
71011
+ let shouldUpdate2 = false;
70758
71012
  const oldHandleChange = store.handleChange;
70759
71013
  store.handleChange = () => {
70760
- shouldUpdate = true;
71014
+ shouldUpdate2 = true;
70761
71015
  };
70762
71016
  const returnValue = fn2(...args);
70763
- if (shouldUpdate) {
71017
+ if (shouldUpdate2) {
70764
71018
  oldHandleChange();
70765
71019
  }
70766
71020
  store.handleChange = oldHandleChange;
@@ -82156,7 +82410,7 @@ function parseEditorCommand(editor) {
82156
82410
  }
82157
82411
 
82158
82412
  // node_modules/.pnpm/@inquirer+external-editor@3.0.3_@types+node@22.20.0/node_modules/@inquirer/external-editor/dist/index.js
82159
- import { spawn, spawnSync } from "node:child_process";
82413
+ import { spawn as spawn2, spawnSync } from "node:child_process";
82160
82414
  import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
82161
82415
  import path4 from "node:path";
82162
82416
  import os2 from "node:os";
@@ -82204,7 +82458,7 @@ class ExternalEditor {
82204
82458
  this.createTempFile();
82205
82459
  const promise2 = new Promise((resolve3, reject) => {
82206
82460
  try {
82207
- const editorProcess = spawn(this.editor.bin, this.editorArgs(), {
82461
+ const editorProcess = spawn2(this.editor.bin, this.editorArgs(), {
82208
82462
  shell: false,
82209
82463
  stdio: "inherit"
82210
82464
  });
@@ -83544,51 +83798,15 @@ var init_admin = __esm(() => {
83544
83798
  };
83545
83799
  });
83546
83800
 
83547
- // src/lib/proc.ts
83548
- import { spawn as spawn2 } from "node:child_process";
83549
- function run(file2, args = [], opts = {}) {
83550
- return new Promise((resolve3, reject) => {
83551
- const child3 = spawn2(file2, args, { cwd: opts.cwd, stdio: ["ignore", "pipe", "pipe"] });
83552
- let stdout = "";
83553
- let stderr = "";
83554
- child3.stdout?.setEncoding("utf8");
83555
- child3.stderr?.setEncoding("utf8");
83556
- child3.stdout?.on("data", (chunk) => {
83557
- stdout += chunk;
83558
- });
83559
- child3.stderr?.on("data", (chunk) => {
83560
- stderr += chunk;
83561
- });
83562
- child3.on("error", reject);
83563
- child3.on("close", (code) => resolve3({ code: code ?? -1, stdout, stderr }));
83564
- });
83565
- }
83566
- function runInherit(file2, args = [], opts = {}) {
83567
- return new Promise((resolve3, reject) => {
83568
- const child3 = spawn2(file2, args, { cwd: opts.cwd, stdio: "inherit" });
83569
- child3.on("error", reject);
83570
- child3.on("close", (code) => resolve3(code ?? -1));
83571
- });
83572
- }
83573
- function spawnHandle(file2, args = [], opts = {}) {
83574
- return spawn2(file2, args, {
83575
- cwd: opts.cwd,
83576
- env: opts.env,
83577
- detached: opts.detached,
83578
- stdio: opts.stdio ?? ["ignore", "inherit", "inherit"]
83579
- });
83580
- }
83581
- var init_proc = () => {};
83582
-
83583
83801
  // src/lib/browser.ts
83584
- import { mkdir as mkdir7, readFile as readFile8, writeFile as writeFile3 } from "node:fs/promises";
83585
- import { join as join4 } from "node:path";
83802
+ import { mkdir as mkdir8, readFile as readFile9, writeFile as writeFile4 } from "node:fs/promises";
83803
+ import { join as join5 } from "node:path";
83586
83804
  function profileDirFor(host) {
83587
- return join4(BROWSER_DIR, host);
83805
+ return join5(BROWSER_DIR, host);
83588
83806
  }
83589
83807
  async function saveSession(session) {
83590
- await mkdir7(paths3.home, { recursive: true });
83591
- await writeFile3(BROWSER_SESSION_PATH, `${JSON.stringify(session, null, 2)}
83808
+ await mkdir8(paths3.home, { recursive: true });
83809
+ await writeFile4(BROWSER_SESSION_PATH, `${JSON.stringify(session, null, 2)}
83592
83810
  `);
83593
83811
  }
83594
83812
  async function findAgentBrowser() {
@@ -83638,15 +83856,15 @@ var BROWSER_DIR, BROWSER_SESSION_PATH, AGENT_BROWSER_REPO = "vercel-labs/agent-b
83638
83856
  var init_browser = __esm(() => {
83639
83857
  init_state();
83640
83858
  init_proc();
83641
- BROWSER_DIR = join4(paths3.home, "browser");
83642
- BROWSER_SESSION_PATH = join4(paths3.home, "browser.json");
83859
+ BROWSER_DIR = join5(paths3.home, "browser");
83860
+ BROWSER_SESSION_PATH = join5(paths3.home, "browser.json");
83643
83861
  AUTH_EVAL = "fetch('/auth/me',{credentials:'include'})" + ".then(r=>r.json())" + ".then(j=>({authed:!!j.authenticated,email:j.user&&j.user.email}))" + ".catch(()=>({authed:false}))";
83644
83862
  });
83645
83863
 
83646
83864
  // src/lib/skills.ts
83647
83865
  import { existsSync, lstatSync, mkdirSync, readlinkSync, symlinkSync } from "node:fs";
83648
83866
  import { homedir as homedir2 } from "node:os";
83649
- import { dirname as dirname7, join as join5 } from "node:path";
83867
+ import { dirname as dirname8, join as join6 } from "node:path";
83650
83868
  async function installSkills() {
83651
83869
  const { code, stdout, stderr } = await run("npx", [
83652
83870
  "skills",
@@ -83663,18 +83881,18 @@ function skillSearchDirs() {
83663
83881
  const dirs = [];
83664
83882
  let cur = process.cwd();
83665
83883
  for (;; ) {
83666
- dirs.push(join5(cur, ".claude", "skills"));
83667
- const parent = dirname7(cur);
83884
+ dirs.push(join6(cur, ".claude", "skills"));
83885
+ const parent = dirname8(cur);
83668
83886
  if (parent === cur)
83669
83887
  break;
83670
83888
  cur = parent;
83671
83889
  }
83672
- dirs.push(join5(homedir2(), ".claude", "skills"));
83890
+ dirs.push(join6(homedir2(), ".claude", "skills"));
83673
83891
  return dirs;
83674
83892
  }
83675
83893
  function detectSkill(name) {
83676
83894
  for (const dir of skillSearchDirs()) {
83677
- const file2 = join5(dir, name, "SKILL.md");
83895
+ const file2 = join6(dir, name, "SKILL.md");
83678
83896
  if (existsSync(file2))
83679
83897
  return { installed: true, location: file2 };
83680
83898
  }
@@ -83693,9 +83911,9 @@ function isSymlink(p) {
83693
83911
  function findAgentsSkillsRoot(fromDir) {
83694
83912
  let cur = fromDir;
83695
83913
  for (;; ) {
83696
- if (existsSync(join5(cur, ".agents", "skills")))
83914
+ if (existsSync(join6(cur, ".agents", "skills")))
83697
83915
  return cur;
83698
- const parent = dirname7(cur);
83916
+ const parent = dirname8(cur);
83699
83917
  if (parent === cur)
83700
83918
  return null;
83701
83919
  cur = parent;
@@ -83705,7 +83923,7 @@ function skillsBridgeStatus(fromDir = process.cwd()) {
83705
83923
  const root = findAgentsSkillsRoot(fromDir);
83706
83924
  if (!root)
83707
83925
  return { kind: "none" };
83708
- const link = join5(root, ".claude", "skills");
83926
+ const link = join6(root, ".claude", "skills");
83709
83927
  if (isSymlink(link)) {
83710
83928
  try {
83711
83929
  if (readlinkSync(link) === BRIDGE_TARGET)
@@ -83721,7 +83939,7 @@ function ensureSkillsBridge(fromDir = process.cwd()) {
83721
83939
  const status = skillsBridgeStatus(fromDir);
83722
83940
  if (status.kind !== "unbridged")
83723
83941
  return status;
83724
- mkdirSync(dirname7(status.link), { recursive: true });
83942
+ mkdirSync(dirname8(status.link), { recursive: true });
83725
83943
  symlinkSync(BRIDGE_TARGET, status.link);
83726
83944
  return { kind: "bridged", root: status.root };
83727
83945
  }
@@ -83730,7 +83948,7 @@ var init_skills = __esm(() => {
83730
83948
  init_browser();
83731
83949
  init_proc();
83732
83950
  SKILL_INSTALL_HINT = `npx skills add ${ASTRALE_CLI_SKILL_SOURCE} -g`;
83733
- BRIDGE_TARGET = join5("..", ".agents", "skills");
83951
+ BRIDGE_TARGET = join6("..", ".agents", "skills");
83734
83952
  });
83735
83953
 
83736
83954
  // src/setup/steps/agent-browser.ts
@@ -83973,9 +84191,9 @@ var init_auth3 = __esm(() => {
83973
84191
 
83974
84192
  // src/setup/steps/domain.ts
83975
84193
  import { existsSync as existsSync2 } from "node:fs";
83976
- import { join as join6 } from "node:path";
84194
+ import { join as join7 } from "node:path";
83977
84195
  function hasDomainProject() {
83978
- return existsSync2(join6(process.cwd(), "astrale.config.ts"));
84196
+ return existsSync2(join7(process.cwd(), "astrale.config.ts"));
83979
84197
  }
83980
84198
  var FIX4 = "npx create-astrale-domain <name> --instance <slug>", domainStep;
83981
84199
  var init_domain7 = __esm(() => {
@@ -85076,7 +85294,7 @@ var init_query3 = __esm(() => {
85076
85294
  init_reference3();
85077
85295
  });
85078
85296
 
85079
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/node.js
85297
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/node.js
85080
85298
  function compileNodeQuery(input) {
85081
85299
  if (!isRuntimeSelection(input))
85082
85300
  return input;
@@ -85127,14 +85345,14 @@ function selection2(definition3, builder, many, current = definitionClosure(defi
85127
85345
  throw new TypeError("Node Query linked requires an accepted rich to definition.");
85128
85346
  }
85129
85347
  const from2 = options?.from ?? inferSide(current, relation);
85130
- if (!overlaps(endpointsOf(relation)[from2].accepts, current)) {
85348
+ if (!overlaps(endpointOf(relation, from2).accepts, current)) {
85131
85349
  throw new TypeError(`Relation ${relation.key} does not accept the current selection at its ${from2} endpoint.`);
85132
85350
  }
85133
85351
  const expanded = builder.expand({
85134
85352
  via: [relation.schemaRef],
85135
85353
  direction: from2 === "source" ? "outgoing" : "incoming"
85136
85354
  }).filter({ satisfies: options.to.schemaRef });
85137
- const opposite = endpointsOf(relation)[from2 === "source" ? "target" : "source"];
85355
+ const opposite = endpointOf(relation, from2 === "source" ? "target" : "source");
85138
85356
  if (!overlaps(opposite.accepts, definitionClosure(options.to))) {
85139
85357
  throw new TypeError(`Relation ${relation.key} does not accept ${options.to.key} at its opposite endpoint.`);
85140
85358
  }
@@ -85147,8 +85365,8 @@ function selection2(definition3, builder, many, current = definitionClosure(defi
85147
85365
  return Object.freeze(value);
85148
85366
  }
85149
85367
  function inferSide(current, relation) {
85150
- const source2 = overlaps(endpointsOf(relation).source.accepts, current);
85151
- const target2 = overlaps(endpointsOf(relation).target.accepts, current);
85368
+ const source2 = overlaps(endpointOf(relation, "source").accepts, current);
85369
+ const target2 = overlaps(endpointOf(relation, "target").accepts, current);
85152
85370
  if (source2 === target2) {
85153
85371
  throw new TypeError(source2 ? `Relation ${relation.key} accepts the current selection at both endpoints; declare from.` : `Relation ${relation.key} does not accept the current selection.`);
85154
85372
  }
@@ -85178,21 +85396,25 @@ function sameRef(left, right) {
85178
85396
  return left.origin === right.origin && left.kind === right.kind && left.name === right.name;
85179
85397
  }
85180
85398
  function isSingular(relation, side) {
85181
- const count2 = endpointsOf(relation)[side].count;
85399
+ const count2 = endpointCount(endpointOf(relation, side));
85182
85400
  return count2 === "1" || count2 === "0..1";
85183
85401
  }
85184
- function endpointsOf(relation) {
85402
+ function endpointOf(relation, side) {
85185
85403
  const declaration2 = relation.definition;
85186
- if (declaration2.family !== "edge") {
85404
+ if (declaration2.endpoints === undefined) {
85187
85405
  throw new TypeError(`Relation ${relation.key} has no Edge endpoints.`);
85188
85406
  }
85189
- return declaration2.orientation === "directed" ? {
85190
- source: { ...declaration2.endpoints.source, count: declaration2.endpoints.source.outgoing },
85191
- target: { ...declaration2.endpoints.target, count: declaration2.endpoints.target.incoming }
85192
- } : {
85193
- source: { ...declaration2.endpoints[0], count: declaration2.endpoints[0].incident },
85194
- target: { ...declaration2.endpoints[1], count: declaration2.endpoints[1].incident }
85195
- };
85407
+ const contract = relation.definition;
85408
+ if (contract.orientation === "directed")
85409
+ return contract.endpoints[side];
85410
+ return contract.endpoints[side === "source" ? 0 : 1];
85411
+ }
85412
+ function endpointCount(endpoint3) {
85413
+ if ("outgoing" in endpoint3)
85414
+ return endpoint3.outgoing;
85415
+ if ("incoming" in endpoint3)
85416
+ return endpoint3.incoming;
85417
+ return endpoint3.incident;
85196
85418
  }
85197
85419
  function isRuntimeSelection(input) {
85198
85420
  return input !== null && typeof input === "object" && typeof input.compile === "function";
@@ -85212,7 +85434,7 @@ var init_node5 = __esm(() => {
85212
85434
  });
85213
85435
  });
85214
85436
 
85215
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/define.js
85437
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/define.js
85216
85438
  function single(definition3) {
85217
85439
  const build = definition3.build;
85218
85440
  return acceptDefinition({
@@ -85294,10 +85516,10 @@ var init_define4 = __esm(() => {
85294
85516
  defineQuery = Object.assign(single, { composite });
85295
85517
  });
85296
85518
 
85297
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/composite/errors.js
85519
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/composite/errors.js
85298
85520
  var init_errors10 = () => {};
85299
85521
 
85300
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/composite/plan.js
85522
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/composite/plan.js
85301
85523
  var PLAN, REFERENCE;
85302
85524
  var init_plan = __esm(() => {
85303
85525
  init_errors10();
@@ -85305,21 +85527,21 @@ var init_plan = __esm(() => {
85305
85527
  REFERENCE = Symbol("astrale.sdk.query.reference");
85306
85528
  });
85307
85529
 
85308
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/composite/index.js
85530
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/composite/index.js
85309
85531
  var init_composite = __esm(() => {
85310
85532
  init_errors10();
85311
85533
  init_plan();
85312
85534
  });
85313
85535
 
85314
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/errors.js
85536
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/errors.js
85315
85537
  var init_errors11 = () => {};
85316
85538
 
85317
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/selection.js
85539
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/selection.js
85318
85540
  var init_selection2 = __esm(() => {
85319
85541
  init_query3();
85320
85542
  });
85321
85543
 
85322
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/execute.js
85544
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/execute.js
85323
85545
  var init_execute = __esm(() => {
85324
85546
  init_composite();
85325
85547
  init_errors11();
@@ -85327,7 +85549,7 @@ var init_execute = __esm(() => {
85327
85549
  init_selection2();
85328
85550
  });
85329
85551
 
85330
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/result/projection.js
85552
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/result/projection.js
85331
85553
  function nodeValues(result, context) {
85332
85554
  if (result.kind === "graph")
85333
85555
  return graphNodes(result, context);
@@ -85431,12 +85653,12 @@ var init_projection3 = __esm(() => {
85431
85653
  });
85432
85654
  });
85433
85655
 
85434
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/result/index.js
85656
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/result/index.js
85435
85657
  var init_result5 = __esm(() => {
85436
85658
  init_projection3();
85437
85659
  });
85438
85660
 
85439
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/index.js
85661
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/query/index.js
85440
85662
  var init_query4 = __esm(() => {
85441
85663
  init_define4();
85442
85664
  init_execute();
@@ -85936,14 +86158,14 @@ async function boundedResponse(response2, maximum, signal) {
85936
86158
  signal.removeEventListener("abort", abort);
85937
86159
  reader.releaseLock();
85938
86160
  }
85939
- return join7(chunks, total);
86161
+ return join8(chunks, total);
85940
86162
  }
85941
86163
  function requireExactResponse(response2, expected, label) {
85942
86164
  if (response2.redirected || response2.url !== expected) {
85943
86165
  throw new ClientError(`${label} did not return the exact requested URL.`);
85944
86166
  }
85945
86167
  }
85946
- function join7(parts2, length) {
86168
+ function join8(parts2, length) {
85947
86169
  if (parts2.length === 1)
85948
86170
  return new Uint8Array(parts2[0]);
85949
86171
  const output3 = new Uint8Array(length);
@@ -86747,73 +86969,161 @@ var init_session2 = __esm(() => {
86747
86969
  init_session();
86748
86970
  });
86749
86971
 
86750
- // src/admin/binding.ts
86751
- async function bindAdmin(session) {
86752
- const snapshot2 = await session.snapshot();
86753
- if (snapshot2.publication.origin !== ADMIN_ORIGIN || snapshot2.bundle.root.origin !== ADMIN_ORIGIN) {
86754
- throw new TypeError("Configured Admin target does not serve the Admin Domain.");
86972
+ // node_modules/.pnpm/@astrale-os+kernel-client@0.6.0-beta.4_typescript@6.0.3/node_modules/@astrale-os/kernel-client/dist/domain/callable.js
86973
+ async function invokeRemote(session, target2, callable, input, options) {
86974
+ return dispatchCallable(session, target2, callable, undefined, input, options);
86975
+ }
86976
+ async function invokeRemoteMethod(session, target2, method, receiver, input, options) {
86977
+ return dispatchCallable(session, target2, method, receiver, input, options);
86978
+ }
86979
+ function bindRemoteMethod(session, target2) {
86980
+ return (method, receiver) => (input) => dispatchCallable(session, target2, method, Path.id(receiver.id), input);
86981
+ }
86982
+ function concreteRootCallables(domain3) {
86983
+ const result = new Map;
86984
+ for (const definition3 of domain3.$.definitions.values()) {
86985
+ if (definition3.kind === "function") {
86986
+ const callable = definition3;
86987
+ result.set(callable.key, callable);
86988
+ continue;
86989
+ }
86990
+ if (definition3.kind !== "class" && definition3.kind !== "interface" || definition3.family !== "node") {
86991
+ continue;
86992
+ }
86993
+ for (const method of definition3.methods.values()) {
86994
+ if (method.definition.inheritance !== "abstract") {
86995
+ const callable = method;
86996
+ result.set(callable.key, callable);
86997
+ }
86998
+ }
86755
86999
  }
86756
- const compatible = session;
86757
- const resolveInstallation = compatible.installation ?? compatible.installed;
86758
- if (resolveInstallation === undefined) {
86759
- throw new TypeError("Client Session cannot resolve an installed Admin Domain.");
86760
- }
86761
- const installation = await resolveInstallation.call(session, ADMIN_ORIGIN);
86762
- const domain3 = Domain.fromSchema(snapshot2.bundle.root);
86763
- const invoke = (callable, receiverOrInput, inputOrOptions, options) => {
86764
- const target2 = "on" in callable ? callable.on(Path.from(receiverOrInput)) : callable.path;
86765
- const reference3 = Object.freeze({
86766
- origin: ADMIN_ORIGIN,
86767
- revision: snapshot2.publication.schema.revision,
86768
- callable: callable.key,
86769
- target: target2,
86770
- outputMode: callable.definition.output.mode
86771
- });
86772
- return invokeCompatible(session, snapshot2, reference3, "on" in callable ? inputOrOptions : receiverOrInput, "on" in callable ? options : inputOrOptions);
86773
- };
86774
- return Object.freeze({
87000
+ return result;
87001
+ }
87002
+ async function dispatchCallable(session, target2, callable, receiver, input, controls = {}) {
87003
+ const bound = target2.callables.get(callable.key);
87004
+ if (bound === undefined) {
87005
+ throw new ClientError("Callable is not a concrete member of the bound Domain root.");
87006
+ }
87007
+ const path5 = receiver === undefined ? bound.path : bound.on(Path.from(receiver));
87008
+ const result = await dispatchBound(session, call(path5, input), target2.bound, controls);
87009
+ return requireOutput(bound, result);
87010
+ }
87011
+ function requireOutput(callable, result) {
87012
+ const mode = callable.definition.output.mode;
87013
+ switch (mode) {
87014
+ case "value":
87015
+ if (result.kind === "value")
87016
+ return result.value;
87017
+ break;
87018
+ case "stream":
87019
+ if (result.kind === "stream")
87020
+ return result.stream;
87021
+ break;
87022
+ case "binary":
87023
+ if (result.kind === "binary")
87024
+ return result.value;
87025
+ break;
87026
+ }
87027
+ return resultMismatch(mode, result);
87028
+ }
87029
+ function resultMismatch(expected, result) {
87030
+ if (result.kind === "stream") {
87031
+ result.stream.cancel(`Remote callable declared ${expected} output.`);
87032
+ }
87033
+ throw new ClientError(`Remote callable declared ${expected} output but returned ${result.kind}.`);
87034
+ }
87035
+ var init_callable4 = __esm(() => {
87036
+ init_path4();
87037
+ init_client3();
87038
+ init_errors7();
87039
+ init_session2();
87040
+ });
87041
+
87042
+ // node_modules/.pnpm/@astrale-os+kernel-client@0.6.0-beta.4_typescript@6.0.3/node_modules/@astrale-os/kernel-client/dist/domain/node.js
87043
+ function bindNode(domain3, methodBinder, definitionOrValue, value2) {
87044
+ return value2 === undefined ? domain3.$.wrap(definitionOrValue, methodBinder) : domain3.$.wrap(definitionOrValue, value2, methodBinder);
87045
+ }
87046
+
87047
+ // node_modules/.pnpm/@astrale-os+kernel-client@0.6.0-beta.4_typescript@6.0.3/node_modules/@astrale-os/kernel-client/dist/domain/binding.js
87048
+ function bind(session, schemaOrInstalled, maybeInstalled) {
87049
+ const installed = admitInstalled(maybeInstalled ?? schemaOrInstalled);
87050
+ const published = installed.source.kind === "remote" ? installed.source.publication : undefined;
87051
+ const root = maybeInstalled === undefined ? installed.bundle.root : schemaOrInstalled;
87052
+ if (published !== undefined)
87053
+ requireSchemaPublication(root, published);
87054
+ if (root.origin !== installed.bundle.root.origin || exports_schema.revision(root) !== exports_schema.revision(installed.bundle.root)) {
87055
+ throw new TypeError("Expected Domain schema does not match the installed schema Bundle.");
87056
+ }
87057
+ const domain3 = Domain.fromSchema(root);
87058
+ const invocationTarget = Object.freeze({
87059
+ callables: concreteRootCallables(domain3),
87060
+ bound: Object.freeze({
87061
+ schema: published === undefined ? Object.freeze({ target: installed.target }) : Object.freeze({ revision: exports_schema.revision(root) }),
87062
+ ...published === undefined ? {} : { publication: exports_publication.reference(published) }
87063
+ })
87064
+ });
87065
+ const methodBinder = bindRemoteMethod(session, invocationTarget);
87066
+ const invoke = (callable, receiverOrInput, inputOrOptions, options) => ("on" in callable) ? invokeRemoteMethod(session, invocationTarget, callable, receiverOrInput, inputOrOptions, options) : invokeRemote(session, invocationTarget, callable, receiverOrInput, inputOrOptions);
87067
+ const bind2 = (definitionOrValue, value2) => value2 === undefined ? bindNode(domain3, methodBinder, definitionOrValue) : bindNode(domain3, methodBinder, definitionOrValue, value2);
87068
+ const binding6 = {
86775
87069
  ...domain3,
86776
87070
  $: Object.freeze({
86777
87071
  ...domain3.$,
86778
- installation,
86779
- publication: snapshot2.publication,
86780
- invoke
87072
+ installed,
87073
+ ...published === undefined ? {} : { publication: published },
87074
+ invoke,
87075
+ bind: bind2
86781
87076
  })
86782
- });
87077
+ };
87078
+ return Object.freeze(binding6);
86783
87079
  }
86784
- async function invokeCompatible(session, snapshot2, reference3, input, options) {
86785
- const current = session;
86786
- if (current.invoke !== undefined)
86787
- return current.invoke(reference3, input, options);
86788
- const dispatchBound2 = dispatchBound;
86789
- if (dispatchBound2 === undefined) {
86790
- throw new TypeError("Client Session cannot invoke an exact Admin publication.");
87080
+ function admitInstalled(input) {
87081
+ if (input === null || typeof input !== "object" || Array.isArray(input)) {
87082
+ throw new TypeError("Installed Domain evidence is invalid.");
86791
87083
  }
86792
- const result = await dispatchBound2(session, call(reference3.target, input), {
86793
- schema: { revision: reference3.revision },
86794
- publication: {
86795
- origin: snapshot2.publication.origin,
86796
- identity: snapshot2.publication.identity,
86797
- revision: snapshot2.publication.schema.revision,
86798
- etag: snapshot2.publication.etag
86799
- }
86800
- }, options);
86801
- return requireOutput(reference3.outputMode, result);
87084
+ if (input.state !== "ready" || input.readiness === null) {
87085
+ throw new TypeError("Installed Domain is not ready.");
87086
+ }
87087
+ if (input.source.kind === "remote") {
87088
+ const published = exports_publication.accept(input.source.publication);
87089
+ const acceptedBundle = exports_publication.acceptBundle(published, input.bundle);
87090
+ return Object.freeze({
87091
+ ...input,
87092
+ source: Object.freeze({ kind: "remote", publication: published }),
87093
+ bundle: acceptedBundle
87094
+ });
87095
+ }
87096
+ return input;
86802
87097
  }
86803
- function requireOutput(expected, result) {
86804
- if (result.kind !== expected) {
86805
- if (result.kind === "stream")
86806
- result.stream.cancel(`Admin callable declared ${expected}.`);
86807
- throw new TypeError(`Admin callable declared ${expected} output but returned ${result.kind}.`);
87098
+ function requireSchemaPublication(domainSchema, published) {
87099
+ if (domainSchema.origin !== published.origin || exports_schema.revision(domainSchema) !== published.schema.revision) {
87100
+ throw new TypeError("Expected Domain schema does not match the target Publication revision.");
86808
87101
  }
86809
- return result.kind === "stream" ? result.stream : result.value;
86810
87102
  }
86811
- var ADMIN_ORIGIN = "admin.astrale.ai";
86812
87103
  var init_binding3 = __esm(() => {
86813
- init_dist4();
86814
- init_session2();
86815
- init_domain6();
86816
- init_path5();
87104
+ init_domain3();
87105
+ init_v1();
87106
+ init_dist2();
87107
+ init_callable4();
87108
+ });
87109
+
87110
+ // node_modules/.pnpm/@astrale-os+kernel-client@0.6.0-beta.4_typescript@6.0.3/node_modules/@astrale-os/kernel-client/dist/domain/index.js
87111
+ var init_domain8 = __esm(() => {
87112
+ init_binding3();
87113
+ });
87114
+
87115
+ // src/admin/binding.ts
87116
+ async function bindAdmin(session) {
87117
+ const installed = await session.installed(ADMIN_ORIGIN);
87118
+ const binding6 = bind(session, installed);
87119
+ if (binding6.$.publication?.origin !== ADMIN_ORIGIN || binding6.$.origin !== ADMIN_ORIGIN) {
87120
+ throw new TypeError("Configured Admin target does not serve the Admin Domain.");
87121
+ }
87122
+ return binding6;
87123
+ }
87124
+ var ADMIN_ORIGIN = "admin.astrale.ai";
87125
+ var init_binding4 = __esm(() => {
87126
+ init_domain8();
86817
87127
  });
86818
87128
 
86819
87129
  // src/admin/graph/nodes.ts
@@ -87036,7 +87346,7 @@ var ADMIN_ORIGIN2 = "admin.astrale.ai", PAGE_SIZE = 256, MAXIMUM_INSTANCES = 1e4
87036
87346
  var init_client4 = __esm(() => {
87037
87347
  init_path5();
87038
87348
  init_query4();
87039
- init_binding3();
87349
+ init_binding4();
87040
87350
  init_graph3();
87041
87351
  init_model6();
87042
87352
  MAXIMUM_PAGES2 = Math.ceil(MAXIMUM_INSTANCES / PAGE_SIZE) + 1;
@@ -89119,11 +89429,11 @@ var init_skills2 = __esm(() => {
89119
89429
 
89120
89430
  // src/setup/steps/skills-bridge.ts
89121
89431
  import { existsSync as existsSync3, readdirSync } from "node:fs";
89122
- import { join as join8 } from "node:path";
89432
+ import { join as join9 } from "node:path";
89123
89433
  function countStaged(root) {
89124
89434
  try {
89125
- const dir = join8(root, ".agents", "skills");
89126
- return readdirSync(dir).filter((e) => existsSync3(join8(dir, e, "SKILL.md"))).length;
89435
+ const dir = join9(root, ".agents", "skills");
89436
+ return readdirSync(dir).filter((e) => existsSync3(join9(dir, e, "SKILL.md"))).length;
89127
89437
  } catch {
89128
89438
  return 0;
89129
89439
  }
@@ -89161,7 +89471,7 @@ var init_skills_bridge = __esm(() => {
89161
89471
  }
89162
89472
  const after = ensureSkillsBridge();
89163
89473
  if (after.kind === "bridged") {
89164
- log.success(`Workspace skills bridged — ${join8(after.root, ".agents/skills")} → .claude/skills`);
89474
+ log.success(`Workspace skills bridged — ${join9(after.root, ".agents/skills")} → .claude/skills`);
89165
89475
  return "fixed";
89166
89476
  }
89167
89477
  log.warn("Could not create the skills bridge — create it manually: ln -s ../.agents/skills .claude/skills");
@@ -89623,18 +89933,18 @@ Examples:
89623
89933
 
89624
89934
  // src/lib/sdk-deps.ts
89625
89935
  import { existsSync as existsSync4 } from "node:fs";
89626
- import { join as join9 } from "node:path";
89936
+ import { join as join10 } from "node:path";
89627
89937
  function inDomainProject(cwd = process.cwd()) {
89628
- return existsSync4(join9(cwd, "astrale.config.ts"));
89938
+ return existsSync4(join10(cwd, "astrale.config.ts"));
89629
89939
  }
89630
89940
  function foreignPackageManager(cwd = process.cwd()) {
89631
- if (existsSync4(join9(cwd, "pnpm-lock.yaml")))
89941
+ if (existsSync4(join10(cwd, "pnpm-lock.yaml")))
89632
89942
  return null;
89633
- if (existsSync4(join9(cwd, "package-lock.json")))
89943
+ if (existsSync4(join10(cwd, "package-lock.json")))
89634
89944
  return "npm";
89635
- if (existsSync4(join9(cwd, "yarn.lock")))
89945
+ if (existsSync4(join10(cwd, "yarn.lock")))
89636
89946
  return "yarn";
89637
- if (existsSync4(join9(cwd, "bun.lockb")) || existsSync4(join9(cwd, "bun.lock")))
89947
+ if (existsSync4(join10(cwd, "bun.lockb")) || existsSync4(join10(cwd, "bun.lock")))
89638
89948
  return "bun";
89639
89949
  return null;
89640
89950
  }
@@ -89679,211 +89989,6 @@ var init_sdk_deps = __esm(() => {
89679
89989
  init_proc();
89680
89990
  });
89681
89991
 
89682
- // src/lib/update.ts
89683
- import { createHash } from "node:crypto";
89684
- import { chmod as chmod2, copyFile, mkdir as mkdir8, mkdtemp, readFile as readFile9, rename as rename2, rm, writeFile as writeFile4 } from "node:fs/promises";
89685
- import { tmpdir } from "node:os";
89686
- import { dirname as dirname8, join as join10 } from "node:path";
89687
- function detectPlatform() {
89688
- const os3 = process.platform;
89689
- const arch = process.arch;
89690
- if (os3 !== "darwin" && os3 !== "linux") {
89691
- throw new AstraleError("UNSUPPORTED_PLATFORM", `Unsupported OS "${os3}" — Astrale update supports macOS and Linux.`);
89692
- }
89693
- if (arch !== "arm64" && arch !== "x64") {
89694
- throw new AstraleError("UNSUPPORTED_PLATFORM", `Unsupported CPU architecture "${arch}" — Astrale update supports arm64 and x64.`);
89695
- }
89696
- return { os: os3, arch };
89697
- }
89698
- function platformKey(platform) {
89699
- return `${platform.os}-${platform.arch}`;
89700
- }
89701
- function isStandaloneBinary() {
89702
- return Boolean(process.versions.bun);
89703
- }
89704
- async function readInstallMetadata(path5 = INSTALL_PATH) {
89705
- let raw2;
89706
- try {
89707
- raw2 = await readFile9(path5, "utf8");
89708
- } catch {
89709
- throw isStandaloneBinary() ? new AstraleError("UPDATE_NOT_SCRIPT_INSTALLED", "Astrale was not installed by the official install script.", "Reinstall with: curl -fsSL https://raw.githubusercontent.com/astrale-os/cli/main/install.sh | sh") : new AstraleError("UPDATE_PACKAGE_MANAGED", "This Astrale build is managed by your package manager.", "Update with: npm install -g @astrale-os/cli@latest (or pnpm/bun)");
89710
- }
89711
- const parsed = InstallMetadataSchema.safeParse(JSON.parse(raw2));
89712
- if (!parsed.success) {
89713
- throw new AstraleError("UPDATE_BAD_INSTALL_METADATA", `Invalid install metadata at ${path5}.`, "Reinstall with: curl -fsSL https://raw.githubusercontent.com/astrale-os/cli/main/install.sh | sh");
89714
- }
89715
- return parsed.data;
89716
- }
89717
- async function writeInstallMetadata(meta3, path5 = INSTALL_PATH) {
89718
- await mkdir8(dirname8(path5), { recursive: true });
89719
- await writeFile4(path5, JSON.stringify(meta3, null, 2) + `
89720
- `);
89721
- }
89722
- function releaseBase(meta3, req) {
89723
- if (process.env.ASTRALE_UPDATE_BASE)
89724
- return process.env.ASTRALE_UPDATE_BASE.replace(/\/+$/, "");
89725
- const repo = meta3.repo || DEFAULT_REPO;
89726
- if (req.version) {
89727
- const version2 = req.version.replace(/^cli\/v/, "").replace(/^v/, "");
89728
- return `https://github.com/${repo}/releases/download/cli/v${version2}`;
89729
- }
89730
- return `https://github.com/${repo}/releases/download/${req.channel ?? meta3.channel ?? DEFAULT_UPDATE_CHANNEL}`;
89731
- }
89732
- async function fetchManifest(base2) {
89733
- const raw2 = await readUrlText(`${base2}/manifest.json`);
89734
- return UpdateManifestSchema.parse(JSON.parse(raw2));
89735
- }
89736
- function shouldUpdate(currentVersion, manifestVersion) {
89737
- return currentVersion !== manifestVersion;
89738
- }
89739
- async function updateAstrale(req) {
89740
- const meta3 = await readInstallMetadata(req.installPath);
89741
- const currentVersion = meta3.version ?? req.currentVersion;
89742
- const channel = req.channel ?? meta3.channel ?? DEFAULT_UPDATE_CHANNEL;
89743
- const platform = req.platform ?? detectPlatform();
89744
- const key = platformKey(platform);
89745
- const base2 = releaseBase(meta3, { channel, version: req.version });
89746
- const manifest = await fetchManifest(base2);
89747
- const asset = manifest.assets[key];
89748
- if (!asset) {
89749
- throw new AstraleError("UPDATE_ASSET_NOT_FOUND", `No Astrale CLI release asset for ${key}.`, `Available platforms: ${Object.keys(manifest.assets).join(", ")}`);
89750
- }
89751
- if (!shouldUpdate(currentVersion, manifest.version)) {
89752
- return {
89753
- status: "up-to-date",
89754
- currentVersion,
89755
- latestVersion: manifest.version,
89756
- channel: manifest.channel
89757
- };
89758
- }
89759
- if (req.check) {
89760
- return {
89761
- status: "available",
89762
- currentVersion,
89763
- latestVersion: manifest.version,
89764
- channel: manifest.channel
89765
- };
89766
- }
89767
- const tmp = await mkdtemp(join10(tmpdir(), "astrale-update-"));
89768
- try {
89769
- const archive = join10(tmp, asset.name);
89770
- await downloadToFile(`${base2}/${asset.name}`, archive);
89771
- const manifestChecksum = "sha256" in asset ? asset.sha256 : undefined;
89772
- const expected = manifestChecksum ?? await fetchChecksum(base2, asset.name);
89773
- const actual = await sha256File(archive);
89774
- if (actual !== expected.toLowerCase()) {
89775
- throw new AstraleError("UPDATE_CHECKSUM_MISMATCH", `Checksum mismatch for ${asset.name}.`, `Expected ${expected}; got ${actual}.`);
89776
- }
89777
- await extractTarGz(archive, tmp);
89778
- const nextBin = join10(tmp, "astrale");
89779
- await chmod2(nextBin, 493);
89780
- await smokeVersion(nextBin, manifest.binaryVersion ?? manifest.version);
89781
- const previous = `${meta3.bin}.previous`;
89782
- const staged = `${meta3.bin}.next`;
89783
- await copyFile(meta3.bin, previous).catch(() => {
89784
- return;
89785
- });
89786
- await copyFile(nextBin, staged);
89787
- await chmod2(staged, 493);
89788
- await rename2(staged, meta3.bin);
89789
- await writeInstallMetadata({
89790
- ...meta3,
89791
- channel: manifest.channel,
89792
- version: manifest.version,
89793
- installedAt: new Date().toISOString()
89794
- }, req.installPath);
89795
- return {
89796
- status: "updated",
89797
- previousVersion: currentVersion,
89798
- currentVersion: manifest.version,
89799
- channel: manifest.channel,
89800
- bin: meta3.bin
89801
- };
89802
- } finally {
89803
- await rm(tmp, { recursive: true, force: true });
89804
- }
89805
- }
89806
- async function readUrlText(url3) {
89807
- if (url3.startsWith("file://")) {
89808
- return readFile9(new URL(url3), "utf8");
89809
- }
89810
- const res = await fetch(url3);
89811
- if (!res.ok)
89812
- throw new Error(`GET ${url3} failed: HTTP ${res.status}`);
89813
- return res.text();
89814
- }
89815
- async function downloadToFile(url3, path5) {
89816
- if (url3.startsWith("file://")) {
89817
- await copyFile(new URL(url3), path5);
89818
- return;
89819
- }
89820
- const res = await fetch(url3);
89821
- if (!res.ok)
89822
- throw new Error(`GET ${url3} failed: HTTP ${res.status}`);
89823
- const bytes = new Uint8Array(await res.arrayBuffer());
89824
- await writeFile4(path5, bytes);
89825
- }
89826
- async function fetchChecksum(base2, assetName) {
89827
- const raw2 = await readUrlText(`${base2}/sha256sums.txt`);
89828
- for (const line of raw2.split(/\r?\n/)) {
89829
- const [sha, file2] = line.trim().split(/\s+/, 2);
89830
- if (!sha || !file2)
89831
- continue;
89832
- if (file2.replace(/^\*/, "") === assetName && /^[a-fA-F0-9]{64}$/.test(sha))
89833
- return sha;
89834
- }
89835
- throw new AstraleError("UPDATE_CHECKSUM_NOT_FOUND", `Checksum entry not found for ${assetName}.`, `Release base: ${base2}`);
89836
- }
89837
- async function sha256File(path5) {
89838
- const hash2 = createHash("sha256");
89839
- hash2.update(await readFile9(path5));
89840
- return hash2.digest("hex");
89841
- }
89842
- async function extractTarGz(archive, cwd) {
89843
- const { code, stderr } = await run("tar", ["-xzf", archive, "-C", cwd]);
89844
- if (code !== 0) {
89845
- throw new Error(`Could not extract update archive: ${stderr.trim()}`);
89846
- }
89847
- }
89848
- async function smokeVersion(bin, expectedVersion) {
89849
- const { code, stdout, stderr } = await run(bin, ["--version"]);
89850
- if (code !== 0)
89851
- throw new Error(`Updated binary failed --version: ${stderr.trim()}`);
89852
- const actual = stdout.trim();
89853
- if (actual !== expectedVersion) {
89854
- throw new Error(`Updated binary reported version ${actual}, expected ${expectedVersion}`);
89855
- }
89856
- }
89857
- var DEFAULT_REPO = "astrale-os/cli", DEFAULT_UPDATE_CHANNEL = "beta", InstallMetadataSchema, ManifestAssetSchema, UpdateManifestSchema;
89858
- var init_update = __esm(() => {
89859
- init_zod2();
89860
- init_errors2();
89861
- init_state();
89862
- init_proc();
89863
- InstallMetadataSchema = exports_external2.object({
89864
- method: exports_external2.literal("script"),
89865
- channel: exports_external2.string().min(1).default(DEFAULT_UPDATE_CHANNEL),
89866
- version: exports_external2.string().min(1).optional(),
89867
- repo: exports_external2.string().min(1).default(DEFAULT_REPO),
89868
- bin: exports_external2.string().min(1),
89869
- installedAt: exports_external2.string().optional()
89870
- });
89871
- ManifestAssetSchema = exports_external2.object({
89872
- name: exports_external2.string().min(1),
89873
- sha256: exports_external2.string().regex(/^[a-fA-F0-9]{64}$/).optional()
89874
- });
89875
- UpdateManifestSchema = exports_external2.object({
89876
- version: exports_external2.string().min(1),
89877
- binaryVersion: exports_external2.string().min(1).optional(),
89878
- channel: exports_external2.string().min(1),
89879
- repo: exports_external2.string().min(1).optional(),
89880
- assets: exports_external2.record(exports_external2.string(), exports_external2.union([
89881
- ManifestAssetSchema,
89882
- exports_external2.string().min(1).transform((name) => ({ name }))
89883
- ]))
89884
- });
89885
- });
89886
-
89887
89992
  // src/commands/update.ts
89888
89993
  var exports_update = {};
89889
89994
  __export(exports_update, {
@@ -90519,27 +90624,27 @@ Examples:
90519
90624
  }
90520
90625
  };
90521
90626
  });
90522
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/mutation/errors.js
90627
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/mutation/errors.js
90523
90628
  var UNKNOWN_OUTCOME_CODES;
90524
90629
  var init_errors14 = __esm(() => {
90525
90630
  UNKNOWN_OUTCOME_CODES = new Set(["MUTATION_OUTCOME_UNKNOWN"]);
90526
90631
  });
90527
90632
 
90528
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/mutation/rich.js
90633
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/mutation/rich.js
90529
90634
  var init_rich = __esm(() => {
90530
90635
  init_class();
90531
90636
  init_path4();
90532
90637
  init_v1();
90533
90638
  });
90534
90639
 
90535
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/mutation/execute.js
90640
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/mutation/execute.js
90536
90641
  var init_execute2 = __esm(() => {
90537
90642
  init_mutate();
90538
90643
  init_errors14();
90539
90644
  init_rich();
90540
90645
  });
90541
90646
 
90542
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/mutation/index.js
90647
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/mutation/index.js
90543
90648
  var init_mutation2 = __esm(() => {
90544
90649
  init_execute2();
90545
90650
  init_mutate();
@@ -91082,7 +91187,7 @@ Examples:
91082
91187
  };
91083
91188
  });
91084
91189
 
91085
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/schema/kernel/index.js
91190
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/schema/kernel/index.js
91086
91191
  var init_kernel2 = __esm(() => {
91087
91192
  init_schema7();
91088
91193
  });
@@ -93469,7 +93574,7 @@ var ADMIN_ORIGIN3 = "admin.astrale.ai", PAGE_SIZE2 = 256, MAXIMUM_DOMAINS = 1e4,
93469
93574
  var init_client5 = __esm(() => {
93470
93575
  init_path5();
93471
93576
  init_query4();
93472
- init_binding3();
93577
+ init_binding4();
93473
93578
  init_graph3();
93474
93579
  init_model7();
93475
93580
  MAXIMUM_PAGES3 = Math.ceil(MAXIMUM_DOMAINS / PAGE_SIZE2) + 1;
@@ -94413,17 +94518,17 @@ var init_create3 = __esm(() => {
94413
94518
  };
94414
94519
  });
94415
94520
 
94416
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/class/index.js
94521
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/class/index.js
94417
94522
  var init_class3 = __esm(() => {
94418
94523
  init_class();
94419
94524
  });
94420
94525
 
94421
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/model/index.js
94526
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/model/index.js
94422
94527
  var init_model8 = __esm(() => {
94423
94528
  init_graph2();
94424
94529
  });
94425
94530
 
94426
- // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.4_@astrale-os+ox@0.1.2_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/properties/index.js
94531
+ // node_modules/.pnpm/@astrale-os+sdk@0.5.0-beta.9_@astrale-os+ox@0.1.3_oxfmt@0.52.0_oxlint@1.79.0__msgpackr@1.12.1_oxlint@1.79.0/node_modules/@astrale-os/sdk/dist/graph/properties/index.js
94427
94532
  var init_properties2 = __esm(() => {
94428
94533
  init_properties();
94429
94534
  });