@astrale-os/cli 1.0.0-beta.44 → 1.0.0-beta.46

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
@@ -2578,7 +2578,7 @@ var package_default;
2578
2578
  var init_package = __esm(() => {
2579
2579
  package_default = {
2580
2580
  name: "@astrale-os/cli",
2581
- version: "1.0.0-beta.44",
2581
+ version: "1.0.0-beta.46",
2582
2582
  description: "Astrale CLI — connect to existing Astrale kernels",
2583
2583
  keywords: [
2584
2584
  "astrale",
@@ -70939,6 +70939,7 @@ async function checkAstraleSkills(overrides = {}) {
70939
70939
  const status = inspection.state === "current" ? "current" : inspection.state === "unhealthy" ? "repair-needed" : "update-available";
70940
70940
  return {
70941
70941
  status,
70942
+ installed: inspection.state !== "absent",
70942
70943
  ...status === "current" ? {
70943
70944
  source: {
70944
70945
  repository: ASTRALE_CLI_SKILL_SOURCE,
@@ -71054,26 +71055,148 @@ var init_sync = __esm(() => {
71054
71055
  SAFE_NAME = /^[a-z0-9][a-z0-9._-]*$/iu;
71055
71056
  });
71056
71057
 
71058
+ // src/lib/skills/onboarding.ts
71059
+ import { readFile as readFile8, rm as rm4 } from "node:fs/promises";
71060
+ import { join as join7 } from "node:path";
71061
+ function statePath(home) {
71062
+ return join7(home, "skills-onboarding.json");
71063
+ }
71064
+ function lockPath(home) {
71065
+ return join7(home, "locks", "skills-onboarding.lock");
71066
+ }
71067
+ function emptyState() {
71068
+ return { version: STATE_VERSION, updateDeclines: 0 };
71069
+ }
71070
+ function parseState(value) {
71071
+ if (!value || typeof value !== "object")
71072
+ return;
71073
+ const state2 = value;
71074
+ if (state2.version !== STATE_VERSION || !Number.isSafeInteger(state2.updateDeclines) || (state2.updateDeclines ?? -1) < 0 || (state2.updateDeclines ?? 0) > UPDATE_DECLINE_LIMIT || state2.reminderStage !== undefined && state2.reminderStage !== "next-day" && state2.reminderStage !== "seven-days" || state2.nextPromptAt !== undefined && (typeof state2.nextPromptAt !== "string" || !Number.isFinite(Date.parse(state2.nextPromptAt))) || state2.dismissed !== undefined && state2.dismissed !== true) {
71075
+ return;
71076
+ }
71077
+ if (state2.dismissed) {
71078
+ return {
71079
+ version: STATE_VERSION,
71080
+ updateDeclines: state2.updateDeclines ?? 0,
71081
+ dismissed: true
71082
+ };
71083
+ }
71084
+ if (state2.reminderStage === undefined !== (state2.nextPromptAt === undefined))
71085
+ return;
71086
+ return {
71087
+ version: STATE_VERSION,
71088
+ updateDeclines: state2.updateDeclines ?? 0,
71089
+ ...state2.reminderStage ? { reminderStage: state2.reminderStage } : {},
71090
+ ...state2.nextPromptAt ? { nextPromptAt: state2.nextPromptAt } : {}
71091
+ };
71092
+ }
71093
+ async function readSkillOnboardingState(options = {}) {
71094
+ try {
71095
+ const raw2 = await readFile8(statePath(options.home ?? paths2.home), "utf8");
71096
+ return parseState(JSON.parse(raw2)) ?? emptyState();
71097
+ } catch {
71098
+ return emptyState();
71099
+ }
71100
+ }
71101
+ async function transitionSkillOnboardingState(options, transition) {
71102
+ const home = options.home ?? paths2.home;
71103
+ return withFileLock(lockPath(home), async () => {
71104
+ const next = transition(await readSkillOnboardingState({ home }));
71105
+ await atomicWrite(statePath(home), `${JSON.stringify(next, null, 2)}
71106
+ `);
71107
+ return next;
71108
+ });
71109
+ }
71110
+ async function clearSkillOnboardingState(options = {}) {
71111
+ const home = options.home ?? paths2.home;
71112
+ await withFileLock(lockPath(home), () => rm4(statePath(home), { force: true }));
71113
+ }
71114
+ function skillInstallOfferDue(source2, state2, now = Date.now()) {
71115
+ if (state2.dismissed)
71116
+ return false;
71117
+ if (source2 !== "reminder")
71118
+ return true;
71119
+ if (!state2.nextPromptAt)
71120
+ return false;
71121
+ return Date.parse(state2.nextPromptAt) <= now;
71122
+ }
71123
+ async function recordSkillInstallDecline(source2, options = {}) {
71124
+ const now = options.now ?? Date.now();
71125
+ return transitionSkillOnboardingState(options, (state2) => {
71126
+ if (state2.dismissed)
71127
+ return state2;
71128
+ if (source2 === "reminder" && state2.reminderStage === "seven-days") {
71129
+ return { version: STATE_VERSION, updateDeclines: state2.updateDeclines, dismissed: true };
71130
+ }
71131
+ const updateDeclines = source2 === "update" ? Math.min(UPDATE_DECLINE_LIMIT, state2.updateDeclines + 1) : state2.updateDeclines;
71132
+ if (updateDeclines >= UPDATE_DECLINE_LIMIT) {
71133
+ return { version: STATE_VERSION, updateDeclines, dismissed: true };
71134
+ }
71135
+ const reminderStage = source2 === "reminder" ? "seven-days" : state2.reminderStage ?? "next-day";
71136
+ const delay = reminderStage === "next-day" ? DAY_MS : 7 * DAY_MS;
71137
+ return {
71138
+ version: STATE_VERSION,
71139
+ updateDeclines,
71140
+ reminderStage,
71141
+ nextPromptAt: new Date(now + delay).toISOString()
71142
+ };
71143
+ });
71144
+ }
71145
+ function defaultInteractive() {
71146
+ return process.stdin.isTTY === true && process.stdout.isTTY === true && !process.env.CI && !process.env.CONTINUOUS_INTEGRATION && !process.argv.includes("--ci") && !process.argv.includes("--no-prompt") && !process.argv.includes("--json") && !process.argv.includes("--raw");
71147
+ }
71148
+ async function defaultInstallPrompt() {
71149
+ return promptSelect("Install Astrale skills?", [
71150
+ { name: "Yes", value: "yes" },
71151
+ { name: "No", value: "no" }
71152
+ ]);
71153
+ }
71154
+ async function offerAstraleSkillInstallation(source2, options = {}) {
71155
+ const state2 = await readSkillOnboardingState(options);
71156
+ if (state2.dismissed)
71157
+ return { status: "suppressed" };
71158
+ if (!skillInstallOfferDue(source2, state2, options.now))
71159
+ return { status: "not-due" };
71160
+ if (!(options.interactive ?? defaultInteractive()))
71161
+ return { status: "not-interactive" };
71162
+ const answer = await (options.prompt ?? defaultInstallPrompt)();
71163
+ if (answer === undefined)
71164
+ return { status: "not-interactive" };
71165
+ if (answer === "yes")
71166
+ return { status: "accepted" };
71167
+ return {
71168
+ status: "declined",
71169
+ state: await recordSkillInstallDecline(source2, options)
71170
+ };
71171
+ }
71172
+ var STATE_VERSION = 1, DAY_MS, UPDATE_DECLINE_LIMIT = 2, SKILL_CONFIGURE_COMMAND = "astrale skills configure";
71173
+ var init_onboarding = __esm(() => {
71174
+ init_state();
71175
+ init_files();
71176
+ init_prompt();
71177
+ DAY_MS = 24 * 60 * 60 * 1000;
71178
+ });
71179
+
71057
71180
  // src/lib/skills.ts
71058
71181
  import { existsSync as existsSync2, lstatSync, mkdirSync as mkdirSync3, readlinkSync, symlinkSync } from "node:fs";
71059
71182
  import { homedir as homedir5 } from "node:os";
71060
- import { dirname as dirname7, join as join7 } from "node:path";
71183
+ import { dirname as dirname7, join as join8 } from "node:path";
71061
71184
  function skillSearchDirs() {
71062
71185
  const dirs = [];
71063
71186
  let cur = process.cwd();
71064
71187
  for (;; ) {
71065
- dirs.push(join7(cur, ".claude", "skills"));
71188
+ dirs.push(join8(cur, ".claude", "skills"));
71066
71189
  const parent = dirname7(cur);
71067
71190
  if (parent === cur)
71068
71191
  break;
71069
71192
  cur = parent;
71070
71193
  }
71071
- dirs.push(join7(homedir5(), ".claude", "skills"));
71194
+ dirs.push(join8(homedir5(), ".claude", "skills"));
71072
71195
  return dirs;
71073
71196
  }
71074
71197
  function detectSkill(name) {
71075
71198
  for (const dir of skillSearchDirs()) {
71076
- const file2 = join7(dir, name, "SKILL.md");
71199
+ const file2 = join8(dir, name, "SKILL.md");
71077
71200
  if (existsSync2(file2))
71078
71201
  return { installed: true, location: file2 };
71079
71202
  }
@@ -71092,7 +71215,7 @@ function isSymlink(p) {
71092
71215
  function findAgentsSkillsRoot(fromDir) {
71093
71216
  let cur = fromDir;
71094
71217
  for (;; ) {
71095
- if (existsSync2(join7(cur, ".agents", "skills")))
71218
+ if (existsSync2(join8(cur, ".agents", "skills")))
71096
71219
  return cur;
71097
71220
  const parent = dirname7(cur);
71098
71221
  if (parent === cur)
@@ -71104,7 +71227,7 @@ function skillsBridgeStatus(fromDir = process.cwd()) {
71104
71227
  const root = findAgentsSkillsRoot(fromDir);
71105
71228
  if (!root)
71106
71229
  return { kind: "none" };
71107
- const link = join7(root, ".claude", "skills");
71230
+ const link = join8(root, ".claude", "skills");
71108
71231
  if (isSymlink(link)) {
71109
71232
  try {
71110
71233
  if (readlinkSync(link) === BRIDGE_TARGET)
@@ -71128,7 +71251,8 @@ var AGENT_BROWSER_SKILL = "agent-browser", BRIDGE_TARGET;
71128
71251
  var init_skills = __esm(() => {
71129
71252
  init_browser();
71130
71253
  init_sync();
71131
- BRIDGE_TARGET = join7("..", ".agents", "skills");
71254
+ init_onboarding();
71255
+ BRIDGE_TARGET = join8("..", ".agents", "skills");
71132
71256
  });
71133
71257
 
71134
71258
  // src/lib/update.ts
@@ -71138,14 +71262,14 @@ import {
71138
71262
  copyFile,
71139
71263
  mkdir as mkdir7,
71140
71264
  mkdtemp as mkdtemp2,
71141
- readFile as readFile8,
71265
+ readFile as readFile9,
71142
71266
  realpath,
71143
71267
  rename as rename4,
71144
- rm as rm4,
71268
+ rm as rm5,
71145
71269
  writeFile as writeFile5
71146
71270
  } from "node:fs/promises";
71147
71271
  import { tmpdir } from "node:os";
71148
- import { dirname as dirname8, join as join8 } from "node:path";
71272
+ import { dirname as dirname8, join as join9 } from "node:path";
71149
71273
  function detectPlatform() {
71150
71274
  const os3 = process.platform;
71151
71275
  const arch = process.arch;
@@ -71181,7 +71305,7 @@ function packageManagedUpdateError(executable, command) {
71181
71305
  async function readInstallMetadata(path3 = INSTALL_PATH) {
71182
71306
  let raw2;
71183
71307
  try {
71184
- raw2 = await readFile8(path3, "utf8");
71308
+ raw2 = await readFile9(path3, "utf8");
71185
71309
  } catch (error52) {
71186
71310
  if (!isMissingFile(error52))
71187
71311
  throw error52;
@@ -71231,7 +71355,7 @@ async function realpathIfExists(path3) {
71231
71355
  async function writeInstallMetadata(meta3, path3 = INSTALL_PATH, filesystem = {
71232
71356
  mkdir: mkdir7,
71233
71357
  rename: rename4,
71234
- rm: rm4,
71358
+ rm: rm5,
71235
71359
  writeFile: writeFile5
71236
71360
  }) {
71237
71361
  const staged = `${path3}.next`;
@@ -71377,9 +71501,9 @@ async function updateAstrale(req, dependencies = {}) {
71377
71501
  channel: manifest.channel
71378
71502
  };
71379
71503
  }
71380
- const tmp = await mkdtemp2(join8(tmpdir(), "astrale-update-"));
71504
+ const tmp = await mkdtemp2(join9(tmpdir(), "astrale-update-"));
71381
71505
  try {
71382
- const archive2 = join8(tmp, asset.name);
71506
+ const archive2 = join9(tmp, asset.name);
71383
71507
  await downloadToFile(`${base2}/${asset.name}`, archive2);
71384
71508
  const manifestChecksum = "sha256" in asset ? asset.sha256 : undefined;
71385
71509
  const expected = manifestChecksum ?? await fetchChecksum(base2, asset.name);
@@ -71388,7 +71512,7 @@ async function updateAstrale(req, dependencies = {}) {
71388
71512
  throw new AstraleError("UPDATE_CHECKSUM_MISMATCH", `Checksum mismatch for ${asset.name}.`, `Expected ${expected}; got ${actual}.`);
71389
71513
  }
71390
71514
  await extractTarGz(archive2, tmp);
71391
- const nextBin = join8(tmp, "astrale");
71515
+ const nextBin = join9(tmp, "astrale");
71392
71516
  await chmod3(nextBin, 493);
71393
71517
  await smokeVersion(nextBin, manifest.binaryVersion ?? manifest.version);
71394
71518
  const replacement = await update.replaceStandaloneCohort(meta3.bin, nextBin);
@@ -71416,12 +71540,12 @@ async function updateAstrale(req, dependencies = {}) {
71416
71540
  bin: meta3.bin
71417
71541
  };
71418
71542
  } finally {
71419
- await rm4(tmp, { recursive: true, force: true });
71543
+ await rm5(tmp, { recursive: true, force: true });
71420
71544
  }
71421
71545
  }
71422
71546
  async function readUrlText(url2, signal) {
71423
71547
  if (url2.startsWith("file://")) {
71424
- return readFile8(new URL(url2), "utf8");
71548
+ return readFile9(new URL(url2), "utf8");
71425
71549
  }
71426
71550
  const res = await fetch(url2, { signal });
71427
71551
  if (!res.ok)
@@ -71452,7 +71576,7 @@ async function fetchChecksum(base2, assetName) {
71452
71576
  }
71453
71577
  async function sha256File(path3) {
71454
71578
  const hash2 = createHash2("sha256");
71455
- hash2.update(await readFile8(path3));
71579
+ hash2.update(await readFile9(path3));
71456
71580
  return hash2.digest("hex");
71457
71581
  }
71458
71582
  async function extractTarGz(archive2, cwd) {
@@ -71499,10 +71623,119 @@ var init_update = __esm(() => {
71499
71623
  ]))
71500
71624
  });
71501
71625
  admittedScriptInstall = Symbol("admittedScriptInstall");
71502
- defaultCohortFilesystem = { chmod: chmod3, copyFile, rename: rename4, rm: rm4 };
71626
+ defaultCohortFilesystem = { chmod: chmod3, copyFile, rename: rename4, rm: rm5 };
71503
71627
  defaultUpdateDependencies = Object.freeze({ replaceStandaloneCohort, writeInstallMetadata });
71504
71628
  });
71505
71629
 
71630
+ // src/commands/skills/configure.ts
71631
+ var exports_configure = {};
71632
+ __export(exports_configure, {
71633
+ astraleSkillAgentChoices: () => astraleSkillAgentChoices,
71634
+ chooseAstraleSkillAgents: () => chooseAstraleSkillAgents,
71635
+ configureAstraleSkills: () => configureAstraleSkills,
71636
+ default: () => configure_default,
71637
+ renderSkillConfigureOutcome: () => renderSkillConfigureOutcome
71638
+ });
71639
+ function astraleSkillAgentChoices(agents) {
71640
+ return [...agents].sort((left, right) => Number(right.configured || right.detected) - Number(left.configured || left.detected) || left.displayName.localeCompare(right.displayName)).map((agent) => ({
71641
+ name: `${agent.displayName}${agent.configured ? " (configured)" : agent.detected ? " (detected)" : ""}`,
71642
+ value: agent.name,
71643
+ checked: agent.configured,
71644
+ description: agent.globalSkillsDir
71645
+ }));
71646
+ }
71647
+ function canPrompt(opts) {
71648
+ return opts.interactive !== false && process.stdin.isTTY === true && process.stdout.isTTY === true && !opts.yes && !process.env.CI && !process.env.CONTINUOUS_INTEGRATION && !process.argv.includes("--no-prompt") && !process.argv.includes("--ci") && !process.argv.includes("--json") && !process.argv.includes("--raw");
71649
+ }
71650
+ async function chooseAstraleSkillAgents(opts = {}) {
71651
+ const agents = await astraleSkillAgents();
71652
+ if (opts.agent)
71653
+ return opts.agent;
71654
+ const configured = agents.filter((agent) => agent.configured).map((agent) => agent.name);
71655
+ if (!canPrompt(opts)) {
71656
+ return configured.length > 0 ? configured : agents.filter((agent) => agent.detected).map((agent) => agent.name);
71657
+ }
71658
+ return promptMultiSelect("Install Astrale skills for which global agents?", astraleSkillAgentChoices(agents));
71659
+ }
71660
+ async function configureAstraleSkills(opts = {}) {
71661
+ if (opts.source) {
71662
+ const skills = await checkAstraleSkills();
71663
+ if (skills.installed === undefined) {
71664
+ throw new Error(`Astrale skills could not be inspected${skills.error ? `: ${skills.error}` : ""}`);
71665
+ }
71666
+ if (!skills.installed) {
71667
+ const offer = opts.yes ? { status: "accepted" } : await offerAstraleSkillInstallation(opts.source, { interactive: canPrompt(opts) });
71668
+ if (offer.status !== "accepted")
71669
+ return offer;
71670
+ } else {
71671
+ const agents2 = (await astraleSkillAgents()).filter((agent) => agent.configured).map((agent) => agent.name);
71672
+ const result2 = await syncAstraleSkills();
71673
+ await clearSkillOnboardingState();
71674
+ return { status: "applied", result: result2, agents: agents2 };
71675
+ }
71676
+ }
71677
+ const agents = await chooseAstraleSkillAgents(opts);
71678
+ if (agents === undefined)
71679
+ return { status: "cancelled" };
71680
+ const result = await syncAstraleSkills({ agents, replaceAgentSelection: true });
71681
+ await clearSkillOnboardingState();
71682
+ return { status: "applied", result, agents };
71683
+ }
71684
+ function renderSkillConfigureOutcome(outcome) {
71685
+ if (outcome.status === "declined" || outcome.status === "not-interactive") {
71686
+ log.dim(` You can install them later with: ${SKILL_CONFIGURE_COMMAND}`);
71687
+ return;
71688
+ }
71689
+ if (outcome.status !== "applied")
71690
+ return;
71691
+ if (outcome.result.status === "unchanged")
71692
+ log.success("Astrale skills already up to date");
71693
+ else if (outcome.result.status === "installed")
71694
+ log.success("Astrale skills installed globally");
71695
+ else if (outcome.result.status === "updated")
71696
+ log.success("Astrale skills updated globally");
71697
+ else if (outcome.result.status === "repaired")
71698
+ log.success("Astrale skills repaired globally");
71699
+ if (outcome.agents.length === 0)
71700
+ log.dim(" canonical only: ~/.agents/skills");
71701
+ else
71702
+ log.dim(` agents: ${outcome.agents.join(", ")}`);
71703
+ }
71704
+ var configure_default;
71705
+ var init_configure = __esm(() => {
71706
+ init_log();
71707
+ init_output();
71708
+ init_prompt();
71709
+ init_skills();
71710
+ configure_default = {
71711
+ name: "configure",
71712
+ description: "Choose the global agents that receive Astrale skill links",
71713
+ options: [
71714
+ { flags: "--agent <name...>", description: "Select agents explicitly (repeat or list names)" },
71715
+ { flags: "--yes", description: "Use detected/already-configured agents without prompting" },
71716
+ {
71717
+ flags: "--source <source>",
71718
+ description: "Onboarding trigger",
71719
+ choices: ["install", "reminder", "update"],
71720
+ hidden: true
71721
+ },
71722
+ ...RAW_OUTPUT_OPTIONS
71723
+ ],
71724
+ action: async (opts) => {
71725
+ try {
71726
+ const outcome = await configureAstraleSkills(opts);
71727
+ if (isMachine(opts)) {
71728
+ output(outcome.status === "applied" ? { ...outcome.result, agents: outcome.agents, scope: "global" } : { status: outcome.status, scope: "global" }, opts);
71729
+ return;
71730
+ }
71731
+ renderSkillConfigureOutcome(outcome);
71732
+ } catch (error52) {
71733
+ fatal(error52, opts);
71734
+ }
71735
+ }
71736
+ };
71737
+ });
71738
+
71506
71739
  // node_modules/.pnpm/jose@6.2.9/node_modules/jose/dist/webapi/lib/buffer_utils.js
71507
71740
  function concat(...buffers) {
71508
71741
  const size = buffers.reduce((acc, { length }) => acc + length, 0);
@@ -73598,8 +73831,8 @@ var init_algorithm = __esm(() => {
73598
73831
 
73599
73832
  // src/keys/pair.ts
73600
73833
  import { randomUUID as randomUUID4 } from "node:crypto";
73601
- import { access, mkdir as mkdir8, readFile as readFile10, unlink as unlink3 } from "node:fs/promises";
73602
- import { dirname as dirname9, join as join10, resolve as resolve4 } from "node:path";
73834
+ import { access, mkdir as mkdir8, readFile as readFile11, unlink as unlink3 } from "node:fs/promises";
73835
+ import { dirname as dirname9, join as join11, resolve as resolve4 } from "node:path";
73603
73836
  function keypairPaths(subject, keysDir = KEYS_DIR) {
73604
73837
  if (subject.length === 0 || subject.includes("\x00") || subject.includes("/") || subject.includes("\\")) {
73605
73838
  throw invalidKeySubject(subject);
@@ -73611,7 +73844,7 @@ function keypairPaths(subject, keysDir = KEYS_DIR) {
73611
73844
  };
73612
73845
  }
73613
73846
  function confinedKeyPath(keysDir, filename, subject) {
73614
- const path3 = join10(keysDir, filename);
73847
+ const path3 = join11(keysDir, filename);
73615
73848
  if (dirname9(resolve4(path3)) !== resolve4(keysDir))
73616
73849
  throw invalidKeySubject(subject);
73617
73850
  return path3;
@@ -73688,8 +73921,8 @@ async function readKeypair(subject, keysDir = KEYS_DIR) {
73688
73921
  const { privatePath, publicPath } = keypairPaths(subject, keysDir);
73689
73922
  try {
73690
73923
  const [privateRaw, publicRaw] = await Promise.all([
73691
- readFile10(privatePath, "utf-8"),
73692
- readFile10(publicPath, "utf-8")
73924
+ readFile11(privatePath, "utf-8"),
73925
+ readFile11(publicPath, "utf-8")
73693
73926
  ]);
73694
73927
  return await acceptKeypair({
73695
73928
  privateJwk: JSON.parse(privateRaw),
@@ -73832,8 +74065,8 @@ var init_validation = __esm(() => {
73832
74065
  });
73833
74066
 
73834
74067
  // src/lib/idp.ts
73835
- import { mkdir as mkdir9, readFile as readFile11, readdir as readdir3, unlink as unlink4 } from "node:fs/promises";
73836
- import { dirname as dirname10, join as join11 } from "node:path";
74068
+ import { mkdir as mkdir9, readFile as readFile12, readdir as readdir3, unlink as unlink4 } from "node:fs/promises";
74069
+ import { dirname as dirname10, join as join12 } from "node:path";
73837
74070
  function classifyRefreshFailure(e) {
73838
74071
  if (e instanceof OAuthTokenError) {
73839
74072
  if (/not a member of the organization|organization not found/i.test(e.description ?? e.message)) {
@@ -73861,10 +74094,10 @@ function idpDir(name) {
73861
74094
  return paths2.idpDir(name);
73862
74095
  }
73863
74096
  function idpMetadataPath(name) {
73864
- return join11(idpDir(name), "metadata.json");
74097
+ return join12(idpDir(name), "metadata.json");
73865
74098
  }
73866
74099
  function idpClientPath(name) {
73867
- return join11(idpDir(name), "client.json");
74100
+ return join12(idpDir(name), "client.json");
73868
74101
  }
73869
74102
  function idpSessionPath(identityName) {
73870
74103
  validateName(identityName, "Identity");
@@ -73872,7 +74105,7 @@ function idpSessionPath(identityName) {
73872
74105
  }
73873
74106
  async function readIdpStore() {
73874
74107
  try {
73875
- const raw2 = await readFile11(IDPS_PATH, "utf-8");
74108
+ const raw2 = await readFile12(IDPS_PATH, "utf-8");
73876
74109
  return IdpStoreSchema.parse(JSON.parse(raw2));
73877
74110
  } catch (e) {
73878
74111
  if (e instanceof exports_external.ZodError) {
@@ -73895,8 +74128,8 @@ async function readIdpConfig(name) {
73895
74128
  if (!entry)
73896
74129
  throw new Error(`IdP "${name}" not found. Run: astrale idp add ${name} --issuer <url>`);
73897
74130
  const [metadataRaw, clientRaw] = await Promise.all([
73898
- readFile11(idpMetadataPath(name), "utf-8"),
73899
- readFile11(idpClientPath(name), "utf-8").catch((e) => {
74131
+ readFile12(idpMetadataPath(name), "utf-8"),
74132
+ readFile12(idpClientPath(name), "utf-8").catch((e) => {
73900
74133
  if (e.code === "ENOENT")
73901
74134
  return "{}";
73902
74135
  throw e;
@@ -74162,7 +74395,7 @@ async function saveIdpSession(session) {
74162
74395
  }
74163
74396
  async function readIdpSession(identityName) {
74164
74397
  try {
74165
- const raw2 = await readFile11(idpSessionPath(identityName), "utf-8");
74398
+ const raw2 = await readFile12(idpSessionPath(identityName), "utf-8");
74166
74399
  return IdpSessionSchema.parse(JSON.parse(raw2));
74167
74400
  } catch (e) {
74168
74401
  if (e.code === "ENOENT")
@@ -77315,7 +77548,7 @@ var require_filesystem = __commonJS(function(exports, module) {
77315
77548
  fs.close(fd, () => {});
77316
77549
  return buffer.subarray(0, bytesRead);
77317
77550
  };
77318
- var readFile12 = (path3) => new Promise((resolve5, reject) => {
77551
+ var readFile13 = (path3) => new Promise((resolve5, reject) => {
77319
77552
  fs.open(path3, "r", (err, fd) => {
77320
77553
  if (err) {
77321
77554
  reject(err);
@@ -77332,7 +77565,7 @@ var require_filesystem = __commonJS(function(exports, module) {
77332
77565
  LDD_PATH,
77333
77566
  SELF_PATH,
77334
77567
  readFileSync: readFileSync3,
77335
- readFile: readFile12
77568
+ readFile: readFile13
77336
77569
  };
77337
77570
  });
77338
77571
 
@@ -77374,7 +77607,7 @@ var require_elf = __commonJS(function(exports, module) {
77374
77607
  var require_detect_libc = __commonJS(function(exports, module) {
77375
77608
  var childProcess = __require("child_process");
77376
77609
  var { isLinux, getReport } = require_process();
77377
- var { LDD_PATH, SELF_PATH, readFile: readFile12, readFileSync: readFileSync3 } = require_filesystem();
77610
+ var { LDD_PATH, SELF_PATH, readFile: readFile13, readFileSync: readFileSync3 } = require_filesystem();
77378
77611
  var { interpreterPath } = require_elf();
77379
77612
  var cachedFamilyInterpreter;
77380
77613
  var cachedFamilyFilesystem;
@@ -77454,7 +77687,7 @@ var require_detect_libc = __commonJS(function(exports, module) {
77454
77687
  }
77455
77688
  cachedFamilyFilesystem = null;
77456
77689
  try {
77457
- const lddContent = await readFile12(LDD_PATH);
77690
+ const lddContent = await readFile13(LDD_PATH);
77458
77691
  cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
77459
77692
  } catch (e) {}
77460
77693
  return cachedFamilyFilesystem;
@@ -77476,7 +77709,7 @@ var require_detect_libc = __commonJS(function(exports, module) {
77476
77709
  }
77477
77710
  cachedFamilyInterpreter = null;
77478
77711
  try {
77479
- const selfContent = await readFile12(SELF_PATH);
77712
+ const selfContent = await readFile13(SELF_PATH);
77480
77713
  const path3 = interpreterPath(selfContent);
77481
77714
  cachedFamilyInterpreter = familyFromInterpreterPath(path3);
77482
77715
  } catch (e) {}
@@ -77536,7 +77769,7 @@ var require_detect_libc = __commonJS(function(exports, module) {
77536
77769
  }
77537
77770
  cachedVersionFilesystem = null;
77538
77771
  try {
77539
- const lddContent = await readFile12(LDD_PATH);
77772
+ const lddContent = await readFile13(LDD_PATH);
77540
77773
  const versionMatch = lddContent.match(RE_GLIBC_VERSION);
77541
77774
  if (versionMatch) {
77542
77775
  cachedVersionFilesystem = versionMatch[1];
@@ -83516,7 +83749,7 @@ var init_identity7 = __esm(() => {
83516
83749
  });
83517
83750
 
83518
83751
  // src/lib/instance.ts
83519
- import { readFile as readFile12, writeFile as writeFile6, mkdir as mkdir10 } from "node:fs/promises";
83752
+ import { readFile as readFile13, writeFile as writeFile6, mkdir as mkdir10 } from "node:fs/promises";
83520
83753
  import { dirname as dirname11 } from "node:path";
83521
83754
  function seed2() {
83522
83755
  return { active: "", instances: {} };
@@ -83557,7 +83790,7 @@ async function readInstances(_config, opts = {}) {
83557
83790
  return instancesMemo;
83558
83791
  let raw2;
83559
83792
  try {
83560
- raw2 = await readFile12(INSTANCES_PATH, "utf-8");
83793
+ raw2 = await readFile13(INSTANCES_PATH, "utf-8");
83561
83794
  } catch {
83562
83795
  instancesMemo = seed2();
83563
83796
  return instancesMemo;
@@ -83982,11 +84215,11 @@ var init_admin_target = __esm(() => {
83982
84215
  });
83983
84216
 
83984
84217
  // src/lib/config.ts
83985
- import { readFile as readFile13, writeFile as writeFile7, mkdir as mkdir11 } from "node:fs/promises";
84218
+ import { readFile as readFile14, writeFile as writeFile7, mkdir as mkdir11 } from "node:fs/promises";
83986
84219
  import { dirname as dirname12 } from "node:path";
83987
84220
  async function readConfig() {
83988
84221
  try {
83989
- const raw2 = await readFile13(CONFIG_PATH, "utf-8");
84222
+ const raw2 = await readFile14(CONFIG_PATH, "utf-8");
83990
84223
  return AstraleConfigSchema.parse(JSON.parse(raw2));
83991
84224
  } catch (e) {
83992
84225
  if (e instanceof exports_external.ZodError || e instanceof SyntaxError) {
@@ -84553,9 +84786,9 @@ var init_auth5 = __esm(() => {
84553
84786
 
84554
84787
  // src/setup/steps/domain.ts
84555
84788
  import { existsSync as existsSync3 } from "node:fs";
84556
- import { join as join12 } from "node:path";
84789
+ import { join as join13 } from "node:path";
84557
84790
  function hasDomainProject() {
84558
- return existsSync3(join12(process.cwd(), "astrale.config.ts"));
84791
+ return existsSync3(join13(process.cwd(), "astrale.config.ts"));
84559
84792
  }
84560
84793
  var FIX4 = "npx create-astrale-domain <name> --instance <slug>", domainStep;
84561
84794
  var init_domain2 = __esm(() => {
@@ -84614,6 +84847,28 @@ var init_query3 = __esm(() => {
84614
84847
  init_query();
84615
84848
  });
84616
84849
 
84850
+ // src/lib/idempotency.ts
84851
+ function idempotencyKey(...segments) {
84852
+ const value2 = segments.join(".");
84853
+ if (value2.length < 1 || value2.length > MAXIMUM_KEY_LENGTH || !URL_SAFE_KEY.test(value2)) {
84854
+ throw new TypeError("Idempotency key must contain 1-128 URL-safe ASCII characters.");
84855
+ }
84856
+ return value2;
84857
+ }
84858
+ function randomOperationId(...namespace) {
84859
+ return idempotencyKey(...namespace, globalThis.crypto.randomUUID());
84860
+ }
84861
+ async function derivedIdempotencyKey(namespace, material) {
84862
+ idempotencyKey(namespace);
84863
+ const digest3 = new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(material)));
84864
+ const hexadecimal = Array.from(digest3, (byte) => byte.toString(16).padStart(2, "0")).join("");
84865
+ return idempotencyKey(namespace, hexadecimal);
84866
+ }
84867
+ var MAXIMUM_KEY_LENGTH = 128, URL_SAFE_KEY;
84868
+ var init_idempotency2 = __esm(() => {
84869
+ URL_SAFE_KEY = /^[A-Za-z0-9._~-]+$/u;
84870
+ });
84871
+
84617
84872
  // node_modules/.pnpm/@astrale-os+kernel-dsl@0.2.0-beta.15/node_modules/@astrale-os/kernel-dsl/dist/v1/builder/schema/diagnostic.js
84618
84873
  function diagnostic(code, pointer, message2, ref) {
84619
84874
  return Object.freeze({ code, pointer, message: message2, ...ref === undefined ? {} : { ref } });
@@ -96425,13 +96680,13 @@ function pattern(input, patternIndex, path5) {
96425
96680
  invalid24("Pattern source", undefined, `${path5}/source`);
96426
96681
  const statesPath = `${path5}/states`;
96427
96682
  const states = array4(value2.states, "Pattern states", statesPath).map((item, stateIndex) => {
96428
- const statePath = `${statesPath}/${stateIndex}`;
96429
- const state2 = object2(item, "Pattern state", statePath);
96430
- exact9(state2, ["epsilon", "transitions"], "Pattern state", statePath, ["accepting"]);
96683
+ const statePath2 = `${statesPath}/${stateIndex}`;
96684
+ const state2 = object2(item, "Pattern state", statePath2);
96685
+ exact9(state2, ["epsilon", "transitions"], "Pattern state", statePath2, ["accepting"]);
96431
96686
  if (state2.accepting !== undefined && state2.accepting !== true)
96432
- invalid24("accepting", undefined, `${statePath}/accepting`);
96433
- const epsilonPath = `${statePath}/epsilon`;
96434
- const transitionsPath = `${statePath}/transitions`;
96687
+ invalid24("accepting", undefined, `${statePath2}/accepting`);
96688
+ const epsilonPath = `${statePath2}/epsilon`;
96689
+ const transitionsPath = `${statePath2}/transitions`;
96435
96690
  return {
96436
96691
  epsilon: array4(state2.epsilon, "epsilon", epsilonPath).map((target2, index2) => integer2(target2, "epsilon", `${epsilonPath}/${index2}`)),
96437
96692
  transitions: array4(state2.transitions, "transitions", transitionsPath).map((transitionValue, transitionIndex) => {
@@ -98831,6 +99086,7 @@ async function readAllNodes(graph, ast, options) {
98831
99086
  const cursors = new Set;
98832
99087
  let cursor;
98833
99088
  let pages = 0;
99089
+ let terminal2 = false;
98834
99090
  const pageSize = Math.min(options.maximum, 256);
98835
99091
  do {
98836
99092
  pages += 1;
@@ -98848,6 +99104,10 @@ async function readAllNodes(graph, ast, options) {
98848
99104
  throw new TypeError(`${options.label} omitted requested Node values.`);
98849
99105
  }
98850
99106
  const node4 = projection.value;
99107
+ if (options.orderedBoundary?.(node4) === true) {
99108
+ terminal2 = true;
99109
+ break;
99110
+ }
98851
99111
  if (ids.has(String(node4.id)))
98852
99112
  throw new TypeError(`${options.label} repeated a Node.`);
98853
99113
  ids.add(String(node4.id));
@@ -98856,7 +99116,7 @@ async function readAllNodes(graph, ast, options) {
98856
99116
  if (nodes.length > options.maximum) {
98857
99117
  throw new TypeError(`${options.label} exceeded its Node bound.`);
98858
99118
  }
98859
- cursor = response2.page.next;
99119
+ cursor = terminal2 ? undefined : response2.page.next;
98860
99120
  if (cursor !== undefined && cursors.has(cursor)) {
98861
99121
  throw new TypeError(`${options.label} repeated a cursor.`);
98862
99122
  }
@@ -98893,22 +99153,26 @@ async function connectAdminInstances(context, dependencies = {}) {
98893
99153
  const operationId = dependencies.operationId ?? defaultOperationId;
98894
99154
  const list3 = async () => {
98895
99155
  const Instance2 = AdminContract.classes.Instance;
99156
+ const property2 = AdminContract.properties.instance;
98896
99157
  const instances = Query.from({ nodes: [Instance2] }).filter({
98897
99158
  class: { equals: Instance2 }
98898
99159
  });
98899
99160
  const nodes = await readAllNodes(context.graph, instances.select({
98900
99161
  kind: "nodes",
98901
99162
  binding: instances.node,
98902
- projection: { kind: "value" }
99163
+ projection: { kind: "value" },
99164
+ order: { property: property2.state, direction: "desc", unranked: "last" }
98903
99165
  }), {
98904
99166
  label: "Admin Instance inventory",
98905
99167
  maximum: MAXIMUM_INSTANCES,
98906
- maximumPages: MAXIMUM_PAGES
99168
+ maximumPages: MAXIMUM_PAGES,
99169
+ orderedBoundary: (node4) => instanceFromNode(node4).state === "deleted"
98907
99170
  });
98908
99171
  return nodes.map(instanceFromNode);
98909
99172
  };
98910
99173
  const requireInstance = async (identifier) => {
98911
- const found = findOwnedInstance(await list3(), identifier);
99174
+ const direct = directNodePath(identifier);
99175
+ const found = direct === undefined ? findOwnedInstance(await list3(), identifier) : await readExactInstance(context.graph, direct);
98912
99176
  if (found === undefined)
98913
99177
  throw new AdminInstanceNotFoundError(identifier);
98914
99178
  return found;
@@ -98941,6 +99205,22 @@ async function connectAdminInstances(context, dependencies = {}) {
98941
99205
  }
98942
99206
  });
98943
99207
  }
99208
+ async function readExactInstance(graph, instance) {
99209
+ const Instance2 = AdminContract.classes.Instance;
99210
+ const selected = Query.from({ nodes: [instance] }).filter({ class: { equals: Instance2 } });
99211
+ const nodes = await readAllNodes(graph, selected.select({ kind: "nodes", binding: selected.node, projection: { kind: "value" } }), { label: "Admin Instance lookup", maximum: 1, maximumPages: 1 });
99212
+ if (nodes.length > 1)
99213
+ throw new TypeError("Admin Instance lookup returned more than one Node.");
99214
+ return nodes[0] === undefined ? undefined : instanceFromNode(nodes[0]);
99215
+ }
99216
+ function directNodePath(input) {
99217
+ try {
99218
+ const parsed = Path.parse(input);
99219
+ return parsed.ast.anchor.kind === "id" && parsed.ast.steps.length === 0 ? parsed : undefined;
99220
+ } catch {
99221
+ return;
99222
+ }
99223
+ }
98944
99224
  function instanceFromNode(node4) {
98945
99225
  const Instance2 = AdminContract.classes.Instance;
98946
99226
  if (node4.class !== ClassKey.of(Instance2)) {
@@ -99023,13 +99303,14 @@ function record7(input, label) {
99023
99303
  return input;
99024
99304
  }
99025
99305
  function defaultOperationId(kind) {
99026
- return `cli.instance.${kind}:${globalThis.crypto.randomUUID()}`;
99306
+ return randomOperationId("cli", "instance", kind);
99027
99307
  }
99028
99308
  var PAGE_SIZE = 256, MAXIMUM_INSTANCES = 1e4, MAXIMUM_PAGES;
99029
99309
  var init_client4 = __esm(() => {
99030
99310
  init_class();
99031
99311
  init_path3();
99032
99312
  init_query3();
99313
+ init_idempotency2();
99033
99314
  init_contract();
99034
99315
  init_graph5();
99035
99316
  init_model6();
@@ -101373,11 +101654,11 @@ function remainingSessionTime(operation) {
101373
101654
  throw new SessionError("Session operation timed out.", { failure: "timeout" });
101374
101655
  return remaining;
101375
101656
  }
101376
- function sessionTransportOptions(operation, idempotencyKey) {
101657
+ function sessionTransportOptions(operation, idempotencyKey2) {
101377
101658
  return Object.freeze({
101378
101659
  signal: operation.signal,
101379
101660
  timeoutMs: remainingSessionTime(operation),
101380
- ...idempotencyKey === undefined ? {} : { idempotencyKey }
101661
+ ...idempotencyKey2 === undefined ? {} : { idempotencyKey: idempotencyKey2 }
101381
101662
  });
101382
101663
  }
101383
101664
  async function runSessionOperation(operation, task) {
@@ -101597,14 +101878,14 @@ async function boundedResponse(response2, maximum, signal) {
101597
101878
  signal.removeEventListener("abort", abort);
101598
101879
  reader.releaseLock();
101599
101880
  }
101600
- return join13(chunks, total);
101881
+ return join14(chunks, total);
101601
101882
  }
101602
101883
  function requireExactResponse(response2, expected, label) {
101603
101884
  if (response2.redirected || response2.url !== expected) {
101604
101885
  throw new ClientError(`${label} did not return the exact requested URL.`);
101605
101886
  }
101606
101887
  }
101607
- function join13(parts, length) {
101888
+ function join14(parts, length) {
101608
101889
  if (parts.length === 1)
101609
101890
  return new Uint8Array(parts[0]);
101610
101891
  const output3 = new Uint8Array(length);
@@ -102604,10 +102885,10 @@ function admitRequestOptions2(input = {}) {
102604
102885
  if (fields.some((field) => !["signal", "timeoutMs", "idempotencyKey"].includes(String(field)))) {
102605
102886
  throw new TypeError("Session request options contain unsupported fields.");
102606
102887
  }
102607
- const idempotencyKey = input.idempotencyKey === undefined ? undefined : acceptIdempotencyKey(input.idempotencyKey, "request.idempotencyKey");
102888
+ const idempotencyKey2 = input.idempotencyKey === undefined ? undefined : acceptIdempotencyKey(input.idempotencyKey, "request.idempotencyKey");
102608
102889
  return Object.freeze({
102609
102890
  ...control,
102610
- ...idempotencyKey === undefined ? {} : { idempotencyKey }
102891
+ ...idempotencyKey2 === undefined ? {} : { idempotencyKey: idempotencyKey2 }
102611
102892
  });
102612
102893
  }
102613
102894
  function admitEnvelopeTransport(input) {
@@ -104239,67 +104520,6 @@ var init_instance3 = __esm(() => {
104239
104520
  };
104240
104521
  });
104241
104522
 
104242
- // src/commands/skills/configure.ts
104243
- var exports_configure = {};
104244
- __export(exports_configure, {
104245
- chooseAstraleSkillAgents: () => chooseAstraleSkillAgents,
104246
- default: () => configure_default
104247
- });
104248
- async function chooseAstraleSkillAgents(opts = {}) {
104249
- const agents = await astraleSkillAgents();
104250
- if (opts.agent)
104251
- return opts.agent;
104252
- const interactive = process.stdin.isTTY && process.stdout.isTTY && !process.env.CI && !process.argv.includes("--no-prompt") && !process.argv.includes("--ci");
104253
- const defaults = agents.filter((agent) => agent.configured || agent.detected).map((agent) => agent.name);
104254
- if (!interactive || opts.yes)
104255
- return defaults;
104256
- const ordered2 = [...agents].sort((left, right) => Number(right.configured || right.detected) - Number(left.configured || left.detected) || left.displayName.localeCompare(right.displayName));
104257
- return promptMultiSelect("Install Astrale skills for which global agents?", ordered2.map((agent) => ({
104258
- name: `${agent.displayName}${agent.configured ? " (configured)" : agent.detected ? " (detected)" : ""}`,
104259
- value: agent.name,
104260
- checked: agent.configured || agent.detected,
104261
- description: agent.globalSkillsDir
104262
- })));
104263
- }
104264
- var configure_default;
104265
- var init_configure = __esm(() => {
104266
- init_log();
104267
- init_output();
104268
- init_prompt();
104269
- init_skills();
104270
- configure_default = {
104271
- name: "configure",
104272
- description: "Choose the global agents that receive Astrale skill links",
104273
- options: [
104274
- { flags: "--agent <name...>", description: "Select agents explicitly (repeat or list names)" },
104275
- { flags: "--yes", description: "Use detected/already-configured agents without prompting" },
104276
- ...RAW_OUTPUT_OPTIONS
104277
- ],
104278
- action: async (opts) => {
104279
- try {
104280
- const selected = await chooseAstraleSkillAgents(opts);
104281
- if (selected === undefined)
104282
- return;
104283
- const result = await syncAstraleSkills({
104284
- agents: selected,
104285
- replaceAgentSelection: true
104286
- });
104287
- if (isMachine(opts)) {
104288
- output({ ...result, agents: selected, scope: "global" }, opts);
104289
- return;
104290
- }
104291
- log.success("Astrale skills configured globally");
104292
- if (selected.length === 0)
104293
- log.dim(" canonical only: ~/.agents/skills");
104294
- else
104295
- log.dim(` agents: ${selected.join(", ")}`);
104296
- } catch (error52) {
104297
- fatal(error52, opts);
104298
- }
104299
- }
104300
- };
104301
- });
104302
-
104303
104523
  // src/setup/steps/skills.ts
104304
104524
  var FIX5, skillsStep;
104305
104525
  var init_skills2 = __esm(() => {
@@ -104359,11 +104579,11 @@ var init_skills2 = __esm(() => {
104359
104579
 
104360
104580
  // src/setup/steps/skills-bridge.ts
104361
104581
  import { existsSync as existsSync4, readdirSync } from "node:fs";
104362
- import { join as join14 } from "node:path";
104582
+ import { join as join15 } from "node:path";
104363
104583
  function countStaged(root) {
104364
104584
  try {
104365
- const dir = join14(root, ".agents", "skills");
104366
- return readdirSync(dir).filter((e) => existsSync4(join14(dir, e, "SKILL.md"))).length;
104585
+ const dir = join15(root, ".agents", "skills");
104586
+ return readdirSync(dir).filter((e) => existsSync4(join15(dir, e, "SKILL.md"))).length;
104367
104587
  } catch {
104368
104588
  return 0;
104369
104589
  }
@@ -104401,7 +104621,7 @@ var init_skills_bridge = __esm(() => {
104401
104621
  }
104402
104622
  const after = ensureSkillsBridge();
104403
104623
  if (after.kind === "bridged") {
104404
- log.success(`Workspace skills bridged — ${join14(after.root, ".agents/skills")} → .claude/skills`);
104624
+ log.success(`Workspace skills bridged — ${join15(after.root, ".agents/skills")} → .claude/skills`);
104405
104625
  return "fixed";
104406
104626
  }
104407
104627
  log.warn("Could not create the skills bridge — create it manually: ln -s ../.agents/skills .claude/skills");
@@ -104869,18 +105089,18 @@ Examples:
104869
105089
 
104870
105090
  // src/lib/sdk-deps.ts
104871
105091
  import { existsSync as existsSync5 } from "node:fs";
104872
- import { join as join15 } from "node:path";
105092
+ import { join as join16 } from "node:path";
104873
105093
  function inDomainProject(cwd = process.cwd()) {
104874
- return existsSync5(join15(cwd, "astrale.config.ts"));
105094
+ return existsSync5(join16(cwd, "astrale.config.ts"));
104875
105095
  }
104876
105096
  function foreignPackageManager(cwd = process.cwd()) {
104877
- if (existsSync5(join15(cwd, "pnpm-lock.yaml")))
105097
+ if (existsSync5(join16(cwd, "pnpm-lock.yaml")))
104878
105098
  return null;
104879
- if (existsSync5(join15(cwd, "package-lock.json")))
105099
+ if (existsSync5(join16(cwd, "package-lock.json")))
104880
105100
  return "npm";
104881
- if (existsSync5(join15(cwd, "yarn.lock")))
105101
+ if (existsSync5(join16(cwd, "yarn.lock")))
104882
105102
  return "yarn";
104883
- if (existsSync5(join15(cwd, "bun.lockb")) || existsSync5(join15(cwd, "bun.lock")))
105103
+ if (existsSync5(join16(cwd, "bun.lockb")) || existsSync5(join16(cwd, "bun.lock")))
104884
105104
  return "bun";
104885
105105
  return null;
104886
105106
  }
@@ -104931,18 +105151,15 @@ __export(exports_update, {
104931
105151
  cliStale: () => cliStale,
104932
105152
  default: () => update_default
104933
105153
  });
104934
- async function refreshSkills() {
104935
- log.step("Ensuring Astrale agent skills are current and healthy");
104936
- const result = await syncAstraleSkills();
104937
- if (result.status === "unchanged")
104938
- log.success("Astrale skills already up to date");
104939
- else if (result.status === "installed")
104940
- log.success("Astrale skills installed");
104941
- else if (result.status === "updated")
104942
- log.success("Astrale skills updated");
104943
- else if (result.status === "repaired")
104944
- log.success("Astrale skills repaired and updated");
104945
- return result;
105154
+ async function refreshSkills(interactive, humanOutput) {
105155
+ if (humanOutput)
105156
+ log.step("Ensuring Astrale agent skills are current and healthy");
105157
+ const outcome = await configureAstraleSkills({ source: "update", interactive });
105158
+ if (humanOutput)
105159
+ renderSkillConfigureOutcome(outcome);
105160
+ }
105161
+ function skillInstallPromptAllowed(opts) {
105162
+ return opts.yes !== true && !isMachine(opts) && process.stdin.isTTY === true && process.stdout.isTTY === true && !process.env.CI && !process.env.CONTINUOUS_INTEGRATION && !process.argv.includes("--no-prompt");
104946
105163
  }
104947
105164
  function skillCheckStale(skills) {
104948
105165
  return skills.status === "update-available" || skills.status === "repair-needed";
@@ -105035,11 +105252,37 @@ async function cliStale(opts, dependencies = CLI_STALE_DEPENDENCIES) {
105035
105252
  };
105036
105253
  }
105037
105254
  }
105038
- async function refreshSkillsWithUpdatedBinary(bin) {
105039
- const result = await run(bin, ["skills", "update", "--json"]);
105040
- if (result.code === 0)
105255
+ async function refreshSkillsWithUpdatedBinary(bin, interactive) {
105256
+ if (interactive) {
105257
+ const code = await runInherit(bin, ["skills", "configure", "--source", "update"]);
105258
+ if (code === 0)
105259
+ return;
105260
+ throw new AstraleError("SKILL_UPDATE_FAILED", "The CLI was updated, but its embedded skills could not be applied.", `Retry with \`${bin} skills configure\`.`);
105261
+ }
105262
+ const result = await run(bin, [
105263
+ "--no-prompt",
105264
+ "skills",
105265
+ "configure",
105266
+ "--source",
105267
+ "update",
105268
+ "--json"
105269
+ ]);
105270
+ if (result.code === 0) {
105271
+ if (!isMachine()) {
105272
+ try {
105273
+ const outcome = JSON.parse(result.stdout);
105274
+ if (outcome.status === "not-interactive") {
105275
+ log.dim(` Skills are not installed. Run: ${SKILL_CONFIGURE_COMMAND}`);
105276
+ } else if (outcome.status === "unchanged") {
105277
+ log.success("Astrale skills already up to date");
105278
+ } else if (["installed", "updated", "repaired"].includes(outcome.status ?? "")) {
105279
+ log.success("Astrale skills updated");
105280
+ }
105281
+ } catch {}
105282
+ }
105041
105283
  return;
105042
- throw new AstraleError("SKILL_UPDATE_FAILED", "The CLI was updated, but its embedded skills could not be applied.", `Retry with \`${bin} skills update\`.${result.stderr.trim() ? ` ${result.stderr.trim()}` : ""}`);
105284
+ }
105285
+ throw new AstraleError("SKILL_UPDATE_FAILED", "The CLI was updated, but its embedded skills could not be applied.", `Retry with \`${bin} skills configure\`.${result.stderr.trim() ? ` ${result.stderr.trim()}` : ""}`);
105043
105286
  }
105044
105287
  async function sdkStale() {
105045
105288
  if (!inDomainProject() || foreignPackageManager()) {
@@ -105059,6 +105302,7 @@ var init_update2 = __esm(() => {
105059
105302
  init_sdk_deps();
105060
105303
  init_skills();
105061
105304
  init_update();
105305
+ init_configure();
105062
105306
  CLI_STALE_DEPENDENCIES = {
105063
105307
  update: updateAstrale
105064
105308
  };
@@ -105077,7 +105321,7 @@ var init_update2 = __esm(() => {
105077
105321
  { flags: "--no-deps", description: "Skip checking @astrale-os SDK dependency versions" },
105078
105322
  {
105079
105323
  flags: "--yes",
105080
- description: "Non-interactive: apply CLI + skills + SDK deps without prompts"
105324
+ description: "Non-interactive: apply updates without opting into a first skill install"
105081
105325
  },
105082
105326
  ...RAW_OUTPUT_OPTIONS
105083
105327
  ],
@@ -105086,10 +105330,9 @@ Behavior:
105086
105330
  Keeps three things current, in order. (1) The CLI distribution: updates official
105087
105331
  standalone installs with checksum verification; npm-owned installs report the
105088
105332
  exact npm command and never overwrite package-manager files. (2) The Astrale
105089
- agent skills: installs every skill embedded in that
105090
- exact CLI release, updates healthy older
105091
- installs, repairs inconsistent installs, and verifies the result before
105092
- reporting success. (3) SDK deps: inside a pnpm domain
105333
+ agent skills: aligns an existing cohort with the exact CLI release, repairs
105334
+ inconsistent installs, and verifies the result. If skills are absent, an
105335
+ interactive update offers to install them. (3) SDK deps: inside a pnpm domain
105093
105336
  project, proposes any @astrale-os/* dependency with a newer release and, on
105094
105337
  confirm, runs "pnpm update --latest --lockfile-only" (updates package.json AND
105095
105338
  the lockfile, honoring your registry + supply-chain age policy; run "pnpm
@@ -105098,9 +105341,10 @@ Behavior:
105098
105341
  The default release channel is beta; --channel overrides it for one run.
105099
105342
  --check is a dry run (binary + skills + SDK deps; exit 10 if anything is available) and
105100
105343
  never writes. With --json it emits a unified staleness report
105101
- ({ stale, cli, skills, sdk }) for tooling. --yes applies all three non-interactively and
105102
- without additional confirmation. A skill failure fails the command rather than
105103
- claiming a partial success. --no-skills / --no-deps explicitly skip those axes.
105344
+ ({ stale, cli, skills, sdk }) for tooling. --yes applies existing updates
105345
+ non-interactively but does not opt into a first skill installation. A skill
105346
+ failure fails the command rather than claiming a partial success. --no-skills
105347
+ / --no-deps explicitly skip those axes.
105104
105348
 
105105
105349
  Examples:
105106
105350
  $ astrale update
@@ -105153,17 +105397,19 @@ Examples:
105153
105397
  throw error52;
105154
105398
  }
105155
105399
  if (opts.skills !== false) {
105400
+ const interactiveSkills = skillInstallPromptAllowed(opts);
105401
+ const humanSkills = !isMachine(opts);
105156
105402
  if (opts.check) {
105157
105403
  const skills = await checkAstraleSkills();
105158
105404
  printSkillCheck(skills);
105159
105405
  if (skillCheckStale(skills))
105160
105406
  anyAvailable = true;
105161
105407
  } else if (result.status === "updated") {
105162
- log.step("Applying skills embedded in the updated CLI");
105163
- await refreshSkillsWithUpdatedBinary(result.bin);
105164
- log.success("Astrale skills updated");
105408
+ if (humanSkills)
105409
+ log.step("Applying skills embedded in the updated CLI");
105410
+ await refreshSkillsWithUpdatedBinary(result.bin, interactiveSkills);
105165
105411
  } else {
105166
- await refreshSkills();
105412
+ await refreshSkills(interactiveSkills, humanSkills);
105167
105413
  }
105168
105414
  } else if (!opts.check) {
105169
105415
  log.dim(" Astrale skills skipped (--no-skills)");
@@ -105734,7 +105980,7 @@ __export(exports_mutate, {
105734
105980
  default: () => mutate_default,
105735
105981
  mutateCommand: () => mutateCommand
105736
105982
  });
105737
- import { readFile as readFile14 } from "node:fs/promises";
105983
+ import { readFile as readFile15 } from "node:fs/promises";
105738
105984
  async function mutateCommand(opts) {
105739
105985
  let mutation;
105740
105986
  try {
@@ -105767,7 +106013,7 @@ async function readDocument(opts) {
105767
106013
  if (opts.file !== undefined) {
105768
106014
  let raw3;
105769
106015
  try {
105770
- raw3 = await readFile14(opts.file, "utf8");
106016
+ raw3 = await readFile15(opts.file, "utf8");
105771
106017
  } catch (error52) {
105772
106018
  throw new AstraleError("FILE_READ_FAILED", `Cannot read --file ${opts.file}.`, undefined, {
105773
106019
  cause: error52
@@ -105851,7 +106097,7 @@ __export(exports_query, {
105851
106097
  default: () => query_default,
105852
106098
  queryCommand: () => queryCommand
105853
106099
  });
105854
- import { readFile as readFile15 } from "node:fs/promises";
106100
+ import { readFile as readFile16 } from "node:fs/promises";
105855
106101
  async function queryCommand(sources2, opts) {
105856
106102
  let input;
105857
106103
  try {
@@ -105902,7 +106148,7 @@ async function readAst(opts) {
105902
106148
  return;
105903
106149
  let raw2;
105904
106150
  try {
105905
- raw2 = await readFile15(opts.file, "utf8");
106151
+ raw2 = await readFile16(opts.file, "utf8");
105906
106152
  } catch (error52) {
105907
106153
  throw new AstraleError("FILE_READ_FAILED", `Cannot read --file ${opts.file}.`, undefined, {
105908
106154
  cause: error52
@@ -106476,8 +106722,8 @@ var init_external_open_origins = __esm(() => {
106476
106722
 
106477
106723
  // src/lib/view/session.ts
106478
106724
  import { closeSync as closeSync2, fchmodSync, openSync as openSync2 } from "node:fs";
106479
- import { chmod as chmod4, mkdir as mkdir12, readdir as readdir4, readFile as readFile16, rm as rm6 } from "node:fs/promises";
106480
- import { join as join16 } from "node:path";
106725
+ import { chmod as chmod4, mkdir as mkdir12, readdir as readdir4, readFile as readFile17, rm as rm7 } from "node:fs/promises";
106726
+ import { join as join17 } from "node:path";
106481
106727
  async function ensureViewDirectory(directory = VIEW_DIR) {
106482
106728
  await mkdir12(directory, { recursive: true, mode: 448 });
106483
106729
  await chmod4(directory, 448);
@@ -106505,9 +106751,9 @@ async function openSessionLog(id, directory = VIEW_DIR) {
106505
106751
  }
106506
106752
  async function removeSessionFiles(id, directory = VIEW_DIR) {
106507
106753
  await Promise.all([
106508
- rm6(recordPath(id, directory), { force: true }),
106509
- rm6(configPath(id, directory), { force: true }),
106510
- rm6(logPath(id, directory), { force: true })
106754
+ rm7(recordPath(id, directory), { force: true }),
106755
+ rm7(configPath(id, directory), { force: true }),
106756
+ rm7(logPath(id, directory), { force: true })
106511
106757
  ]);
106512
106758
  }
106513
106759
  function isAlive(pid) {
@@ -106531,7 +106777,7 @@ async function listSessions() {
106531
106777
  continue;
106532
106778
  let record12;
106533
106779
  try {
106534
- record12 = JSON.parse(await readFile16(join16(VIEW_DIR, entry2), "utf8"));
106780
+ record12 = JSON.parse(await readFile17(join17(VIEW_DIR, entry2), "utf8"));
106535
106781
  } catch {
106536
106782
  continue;
106537
106783
  }
@@ -106559,22 +106805,22 @@ async function closeSession(record12) {
106559
106805
  }
106560
106806
  await removeSessionFiles(record12.id);
106561
106807
  }
106562
- var VIEW_DIR, recordPath = (id, directory = VIEW_DIR) => join16(directory, `${id}.json`), logPath = (id, directory = VIEW_DIR) => join16(directory, `${id}.log`), configPath = (id, directory = VIEW_DIR) => join16(directory, `${id}.config.json`), CLOSE_GRACE_MS = 2000;
106808
+ var VIEW_DIR, recordPath = (id, directory = VIEW_DIR) => join17(directory, `${id}.json`), logPath = (id, directory = VIEW_DIR) => join17(directory, `${id}.log`), configPath = (id, directory = VIEW_DIR) => join17(directory, `${id}.config.json`), CLOSE_GRACE_MS = 2000;
106563
106809
  var init_session5 = __esm(() => {
106564
106810
  init_state();
106565
- VIEW_DIR = join16(paths2.home, "view");
106811
+ VIEW_DIR = join17(paths2.home, "view");
106566
106812
  });
106567
106813
 
106568
106814
  // src/lib/view/port-allocation.ts
106569
- import { join as join17 } from "node:path";
106570
- function withViewPortAllocationLock(fn, lockPath = VIEW_PORT_LOCK) {
106571
- return withFileLock(lockPath, fn);
106815
+ import { join as join18 } from "node:path";
106816
+ function withViewPortAllocationLock(fn, lockPath2 = VIEW_PORT_LOCK) {
106817
+ return withFileLock(lockPath2, fn);
106572
106818
  }
106573
106819
  var VIEW_PORT_LOCK;
106574
106820
  var init_port_allocation = __esm(() => {
106575
106821
  init_state();
106576
106822
  init_session5();
106577
- VIEW_PORT_LOCK = join17(VIEW_DIR, "ports.lock");
106823
+ VIEW_PORT_LOCK = join18(VIEW_DIR, "ports.lock");
106578
106824
  });
106579
106825
 
106580
106826
  // src/lib/view/resolve.ts
@@ -106644,33 +106890,33 @@ var init_resolve2 = __esm(() => {
106644
106890
  // src/lib/view/assets.ts
106645
106891
  import { existsSync as existsSync6, statSync } from "node:fs";
106646
106892
  import { copyFile as copyFile2 } from "node:fs/promises";
106647
- import { dirname as dirname13, join as join18 } from "node:path";
106893
+ import { dirname as dirname13, join as join19 } from "node:path";
106648
106894
  import { fileURLToPath } from "node:url";
106649
106895
  function viewerDistDir(moduleUrl = import.meta.url, entry2 = process.argv[1] ?? ".") {
106650
106896
  const override = process.env.ASTRALE_VIEWER_DIR;
106651
106897
  if (override)
106652
106898
  return override;
106653
106899
  const moduleDirectory = dirname13(fileURLToPath(moduleUrl));
106654
- const published = join18(moduleDirectory, "..", "viewer", "dist");
106655
- const source2 = join18(moduleDirectory, "..", "..", "..", "viewer", "dist");
106656
- const legacy = join18(dirname13(entry2), "..", "viewer", "dist");
106900
+ const published = join19(moduleDirectory, "..", "viewer", "dist");
106901
+ const source2 = join19(moduleDirectory, "..", "..", "..", "viewer", "dist");
106902
+ const legacy = join19(dirname13(entry2), "..", "viewer", "dist");
106657
106903
  const standalone = entry2.startsWith("/$bunfs/") ? embeddedAssetDir("viewer") : undefined;
106658
106904
  const complete = [standalone, published, source2, legacy].find((candidate2) => candidate2 !== undefined && hasViewerBundle(candidate2));
106659
106905
  if (complete)
106660
106906
  return complete;
106661
- if (hasViewerSource(join18(source2, "..")))
106907
+ if (hasViewerSource(join19(source2, "..")))
106662
106908
  return source2;
106663
106909
  return published;
106664
106910
  }
106665
106911
  async function ensureViewerAssets(moduleUrl = import.meta.url, entry2 = process.argv[1] ?? ".") {
106666
106912
  const dist = viewerDistDir(moduleUrl, entry2);
106667
- const srcDir = join18(dist, "..");
106913
+ const srcDir = join19(dist, "..");
106668
106914
  if (hasViewerBundle(dist) && !viewerSourceIsNewer(srcDir, dist))
106669
106915
  return dist;
106670
106916
  const bun = globalThis.Bun;
106671
106917
  if (bun && hasViewerSource(srcDir)) {
106672
106918
  const result = await bun.build({
106673
- entrypoints: [join18(srcDir, "main.ts")],
106919
+ entrypoints: [join19(srcDir, "main.ts")],
106674
106920
  outdir: dist,
106675
106921
  target: "browser",
106676
106922
  minify: false
@@ -106678,24 +106924,24 @@ async function ensureViewerAssets(moduleUrl = import.meta.url, entry2 = process.
106678
106924
  if (!result.success)
106679
106925
  throw new Error(`viewer build failed: ${result.logs.join(`
106680
106926
  `)}`);
106681
- await copyFile2(join18(srcDir, "index.html"), join18(dist, "index.html"));
106927
+ await copyFile2(join19(srcDir, "index.html"), join19(dist, "index.html"));
106682
106928
  return dist;
106683
106929
  }
106684
106930
  return materializeEmbeddedAssets("viewer");
106685
106931
  }
106686
106932
  function hasViewerBundle(directory) {
106687
- return existsSync6(join18(directory, "main.js")) && existsSync6(join18(directory, "index.html"));
106933
+ return existsSync6(join19(directory, "main.js")) && existsSync6(join19(directory, "index.html"));
106688
106934
  }
106689
106935
  function hasViewerSource(directory) {
106690
- return existsSync6(join18(directory, "main.ts")) && existsSync6(join18(directory, "index.html"));
106936
+ return existsSync6(join19(directory, "main.ts")) && existsSync6(join19(directory, "index.html"));
106691
106937
  }
106692
106938
  function viewerSourceIsNewer(source2, dist) {
106693
106939
  if (!hasViewerSource(source2))
106694
106940
  return false;
106695
106941
  if (!hasViewerBundle(dist))
106696
106942
  return true;
106697
- const newestSource = Math.max(statSync(join18(source2, "main.ts")).mtimeMs, statSync(join18(source2, "index.html")).mtimeMs);
106698
- const oldestOutput = Math.min(statSync(join18(dist, "main.js")).mtimeMs, statSync(join18(dist, "index.html")).mtimeMs);
106943
+ const newestSource = Math.max(statSync(join19(source2, "main.ts")).mtimeMs, statSync(join19(source2, "index.html")).mtimeMs);
106944
+ const oldestOutput = Math.min(statSync(join19(dist, "main.js")).mtimeMs, statSync(join19(dist, "index.html")).mtimeMs);
106699
106945
  return newestSource > oldestOutput;
106700
106946
  }
106701
106947
  var init_assets = __esm(() => {
@@ -106703,9 +106949,9 @@ var init_assets = __esm(() => {
106703
106949
  });
106704
106950
 
106705
106951
  // src/lib/view/server.ts
106706
- import { readFile as readFile17 } from "node:fs/promises";
106952
+ import { readFile as readFile18 } from "node:fs/promises";
106707
106953
  import { createServer } from "node:http";
106708
- import { join as join19 } from "node:path";
106954
+ import { join as join20 } from "node:path";
106709
106955
  import { Readable } from "node:stream";
106710
106956
  function startViewServer(config2) {
106711
106957
  const { session: session3, proxy } = config2;
@@ -106753,11 +106999,11 @@ function startViewServer(config2) {
106753
106999
  return;
106754
107000
  }
106755
107001
  if (sub === "/" || sub === "/index.html") {
106756
- await serveAsset(res, join19(hostDir, "index.html"), "text/html; charset=utf-8");
107002
+ await serveAsset(res, join20(hostDir, "index.html"), "text/html; charset=utf-8");
106757
107003
  return;
106758
107004
  }
106759
107005
  if (sub === "/main.js") {
106760
- await serveAsset(res, join19(hostDir, "main.js"), "text/javascript; charset=utf-8");
107006
+ await serveAsset(res, join20(hostDir, "main.js"), "text/javascript; charset=utf-8");
106761
107007
  return;
106762
107008
  }
106763
107009
  if (sub === "/config.json" && req.method === "GET") {
@@ -106877,7 +107123,7 @@ function json3(res, code, body) {
106877
107123
  }
106878
107124
  async function serveAsset(res, file2, contentType) {
106879
107125
  try {
106880
- const content = await readFile17(file2);
107126
+ const content = await readFile18(file2);
106881
107127
  res.writeHead(200, { "content-type": contentType, "cache-control": "no-store" });
106882
107128
  res.end(content);
106883
107129
  } catch {
@@ -106993,8 +107239,8 @@ __export(exports_view3, {
106993
107239
  });
106994
107240
  import { randomBytes } from "node:crypto";
106995
107241
  import { closeSync as closeSync3, existsSync as existsSync7, statSync as statSync2 } from "node:fs";
106996
- import { readdir as readdir5, readFile as readFile18 } from "node:fs/promises";
106997
- import { dirname as dirname14, join as join20 } from "node:path";
107242
+ import { readdir as readdir5, readFile as readFile19 } from "node:fs/promises";
107243
+ import { dirname as dirname14, join as join21 } from "node:path";
106998
107244
  async function resolveSession(spec, opts) {
106999
107245
  rejectUnrepresentableOverrides(opts);
107000
107246
  const parsed = parseViewSpec(spec);
@@ -107051,7 +107297,7 @@ async function resolveServeRuntime(environment = {}) {
107051
107297
  if (node4 && entry2?.endsWith(".js") && exists(entry2))
107052
107298
  return { file: node4, args: [entry2] };
107053
107299
  if (node4 && entry2?.endsWith(".ts")) {
107054
- const dist = join20(dirname14(entry2), "..", "dist", "astrale.js");
107300
+ const dist = join21(dirname14(entry2), "..", "dist", "astrale.js");
107055
107301
  await ensureDevDist(entry2, dist);
107056
107302
  if (exists(dist))
107057
107303
  return { file: node4, args: [dist] };
@@ -107077,8 +107323,8 @@ async function findOnPath(name) {
107077
107323
  async function ensureDevDist(entry2, dist) {
107078
107324
  if (!await devDistIsStale(entry2, dist))
107079
107325
  return;
107080
- const projectDir = join20(dirname14(entry2), "..");
107081
- const buildScript = join20(projectDir, "scripts", "build.ts");
107326
+ const projectDir = join21(dirname14(entry2), "..");
107327
+ const buildScript = join21(projectDir, "scripts", "build.ts");
107082
107328
  const bun = await findOnPath("bun");
107083
107329
  if (!bun || !existsSync7(buildScript))
107084
107330
  return;
@@ -107094,13 +107340,13 @@ async function ensureDevDist(entry2, dist) {
107094
107340
  async function devDistIsStale(entry2, dist) {
107095
107341
  if (!existsSync7(dist))
107096
107342
  return true;
107097
- const projectDir = join20(dirname14(entry2), "..");
107343
+ const projectDir = join21(dirname14(entry2), "..");
107098
107344
  const builtAt = statSync2(dist).mtimeMs;
107099
- const directories = [join20(projectDir, "src"), join20(projectDir, "bin"), join20(projectDir, "vendor")];
107345
+ const directories = [join21(projectDir, "src"), join21(projectDir, "bin"), join21(projectDir, "vendor")];
107100
107346
  const files = [
107101
- join20(projectDir, "scripts", "build.ts"),
107102
- join20(projectDir, "package.json"),
107103
- join20(projectDir, "pnpm-lock.yaml")
107347
+ join21(projectDir, "scripts", "build.ts"),
107348
+ join21(projectDir, "package.json"),
107349
+ join21(projectDir, "pnpm-lock.yaml")
107104
107350
  ];
107105
107351
  for (const directory of directories) {
107106
107352
  if (existsSync7(directory) && await newerThan(directory, builtAt))
@@ -107113,7 +107359,7 @@ async function newerThan(dir, mtimeMs) {
107113
107359
  for (const item of entries) {
107114
107360
  if (!item.isFile())
107115
107361
  continue;
107116
- if (statSync2(join20(item.parentPath, item.name)).mtimeMs > mtimeMs)
107362
+ if (statSync2(join21(item.parentPath, item.name)).mtimeMs > mtimeMs)
107117
107363
  return true;
107118
107364
  }
107119
107365
  return false;
@@ -107191,7 +107437,7 @@ async function startSessionLocked(view2, opts, kernelTarget, activeInstance, def
107191
107437
  break;
107192
107438
  await sleep2(POLL_MS2);
107193
107439
  }
107194
- const tail = await readFile18(logPath(id), "utf8").catch(() => "");
107440
+ const tail = await readFile19(logPath(id), "utf8").catch(() => "");
107195
107441
  await closeSession(live);
107196
107442
  throw new Error(`View session server did not come up.${tail ? `
107197
107443
  --- server log ---
@@ -107465,7 +107711,7 @@ Examples:
107465
107711
  if (state2?.state === "failed") {
107466
107712
  await reportOpened(record12, state2, mode, opts);
107467
107713
  if (opts.debug) {
107468
- const tail = await readFile18(logPath(record12.id), "utf8").catch(() => "");
107714
+ const tail = await readFile19(logPath(record12.id), "utf8").catch(() => "");
107469
107715
  if (tail)
107470
107716
  console.error(`--- server log ---
107471
107717
  ${tail.slice(-3000)}`);
@@ -107538,8 +107784,8 @@ var init_status = __esm(() => {
107538
107784
 
107539
107785
  // src/lib/browser-retention.ts
107540
107786
  import { readlinkSync as readlinkSync2 } from "node:fs";
107541
- import { readdir as readdir6, rm as rm7, stat as stat3 } from "node:fs/promises";
107542
- import { join as join21 } from "node:path";
107787
+ import { readdir as readdir6, rm as rm8, stat as stat3 } from "node:fs/promises";
107788
+ import { join as join22 } from "node:path";
107543
107789
  function firstPositive(candidates) {
107544
107790
  for (const candidate2 of candidates) {
107545
107791
  if (candidate2 === undefined)
@@ -107567,7 +107813,7 @@ function isLive(pid) {
107567
107813
  function heldByLiveBrowser(profileDir) {
107568
107814
  let target2;
107569
107815
  try {
107570
- target2 = readlinkSync2(join21(profileDir, "SingletonLock"));
107816
+ target2 = readlinkSync2(join22(profileDir, "SingletonLock"));
107571
107817
  } catch {
107572
107818
  return false;
107573
107819
  }
@@ -107583,7 +107829,7 @@ async function directoryBytes(dir) {
107583
107829
  }
107584
107830
  let total = 0;
107585
107831
  for (const entry2 of entries) {
107586
- const path5 = join21(dir, entry2.name);
107832
+ const path5 = join22(dir, entry2.name);
107587
107833
  if (entry2.isDirectory()) {
107588
107834
  total += await directoryBytes(path5);
107589
107835
  } else if (entry2.isFile()) {
@@ -107597,13 +107843,13 @@ async function directoryBytes(dir) {
107597
107843
  async function profileCacheBytes(profileDir) {
107598
107844
  let total = 0;
107599
107845
  for (const relative2 of CACHE_PATHS)
107600
- total += await directoryBytes(join21(profileDir, relative2));
107846
+ total += await directoryBytes(join22(profileDir, relative2));
107601
107847
  return total;
107602
107848
  }
107603
107849
  async function purgeCache(profileDir) {
107604
107850
  const before = await profileCacheBytes(profileDir);
107605
107851
  for (const relative2 of CACHE_PATHS) {
107606
- await rm7(join21(profileDir, relative2), { recursive: true, force: true }).catch(() => {});
107852
+ await rm8(join22(profileDir, relative2), { recursive: true, force: true }).catch(() => {});
107607
107853
  }
107608
107854
  return before - await profileCacheBytes(profileDir);
107609
107855
  }
@@ -107621,7 +107867,7 @@ async function sweepBrowserProfiles(options = {}) {
107621
107867
  const now = options.now ?? Date.now();
107622
107868
  const result = { removed: [], purged: [], skipped: [], bytesFreed: 0 };
107623
107869
  for (const name of names) {
107624
- const profileDir = join21(dir, name);
107870
+ const profileDir = join22(dir, name);
107625
107871
  if (heldByLiveBrowser(profileDir)) {
107626
107872
  result.skipped.push(name);
107627
107873
  continue;
@@ -107630,7 +107876,7 @@ async function sweepBrowserProfiles(options = {}) {
107630
107876
  const idleMs = now - (await stat3(profileDir)).mtime.getTime();
107631
107877
  if (idleMs > budget.maxProfileAgeMs) {
107632
107878
  result.bytesFreed += await directoryBytes(profileDir);
107633
- await rm7(profileDir, { recursive: true, force: true });
107879
+ await rm8(profileDir, { recursive: true, force: true });
107634
107880
  result.removed.push(name);
107635
107881
  continue;
107636
107882
  }
@@ -107848,7 +108094,7 @@ var exports_view_serve = {};
107848
108094
  __export(exports_view_serve, {
107849
108095
  default: () => view_serve_default
107850
108096
  });
107851
- import { readFile as readFile19 } from "node:fs/promises";
108097
+ import { readFile as readFile20 } from "node:fs/promises";
107852
108098
  var view_serve_default;
107853
108099
  var init_view_serve = __esm(() => {
107854
108100
  init_server();
@@ -107860,7 +108106,7 @@ var init_view_serve = __esm(() => {
107860
108106
  action: async (opts) => {
107861
108107
  if (!opts.config)
107862
108108
  throw new Error("--config is required");
107863
- const config2 = JSON.parse(await readFile19(opts.config, "utf8"));
108109
+ const config2 = JSON.parse(await readFile20(opts.config, "utf8"));
107864
108110
  startViewServer(config2);
107865
108111
  console.log(`view session ${config2.session.id} listening on ${config2.session.pageUrl}`);
107866
108112
  await new Promise(() => {});
@@ -107883,7 +108129,7 @@ __export(exports_studio, {
107883
108129
  encodeStudioCliDescriptor: () => encodeStudioCliDescriptor
107884
108130
  });
107885
108131
  import { existsSync as existsSync10, realpathSync } from "node:fs";
107886
- import { dirname as dirname15, join as join22, resolve as resolve8 } from "node:path";
108132
+ import { dirname as dirname15, join as join23, resolve as resolve8 } from "node:path";
107887
108133
  function encodeStudioCliDescriptor(executable = process.execPath, entry2 = process.argv[1]) {
107888
108134
  const args = entry2 && entry2 !== executable && !entry2.startsWith("/$bunfs") && existsSync10(entry2) ? [realpathSync(entry2)] : [];
107889
108135
  return JSON.stringify({ version: 1, executable, args });
@@ -107894,21 +108140,21 @@ function resolveStudioDir() {
107894
108140
  candidates.push(process.env.ASTRALE_STUDIO_DIR);
107895
108141
  try {
107896
108142
  const entryDir = dirname15(realpathSync(process.argv[1] ?? ""));
107897
- candidates.push(join22(entryDir, "..", "studio"), join22(entryDir, "studio"));
108143
+ candidates.push(join23(entryDir, "..", "studio"), join23(entryDir, "studio"));
107898
108144
  } catch {}
107899
108145
  for (const c2 of candidates) {
107900
- if (existsSync10(join22(c2, "server", "index.ts")))
108146
+ if (existsSync10(join23(c2, "server", "index.ts")))
107901
108147
  return resolve8(c2);
107902
108148
  }
107903
108149
  throw new Error(`Domain Studio assets not found (looked in: ${candidates.join(", ") || "<none>"}). ` + `Reinstall the astrale CLI, or set ASTRALE_STUDIO_DIR to a studio checkout.`);
107904
108150
  }
107905
108151
  function isDevSource(studioDir) {
107906
- return existsSync10(join22(studioDir, "vite.config.ts")) && existsSync10(join22(studioDir, "client", "src"));
108152
+ return existsSync10(join23(studioDir, "vite.config.ts")) && existsSync10(join23(studioDir, "client", "src"));
107907
108153
  }
107908
108154
  function resolveViteBin(studioDir) {
107909
108155
  for (const c2 of [
107910
- join22(studioDir, "node_modules", ".bin", "vite"),
107911
- join22(studioDir, "..", "..", "node_modules", ".bin", "vite")
108156
+ join23(studioDir, "node_modules", ".bin", "vite"),
108157
+ join23(studioDir, "..", "..", "node_modules", ".bin", "vite")
107912
108158
  ]) {
107913
108159
  if (existsSync10(c2))
107914
108160
  return c2;
@@ -108267,7 +108513,7 @@ var init_model7 = __esm(() => {
108267
108513
 
108268
108514
  // src/ui/lock.ts
108269
108515
  import { createHash as createHash3 } from "node:crypto";
108270
- import { readFile as readFile20 } from "node:fs/promises";
108516
+ import { readFile as readFile21 } from "node:fs/promises";
108271
108517
  function digest5(value3) {
108272
108518
  return createHash3("sha256").update(value3).digest("hex");
108273
108519
  }
@@ -108305,7 +108551,7 @@ function pathIsAbsolute(value3) {
108305
108551
  }
108306
108552
  async function readUiLock(target2) {
108307
108553
  try {
108308
- return parseUiLock(JSON.parse(await readFile20(target2, "utf8")));
108554
+ return parseUiLock(JSON.parse(await readFile21(target2, "utf8")));
108309
108555
  } catch (cause) {
108310
108556
  if (cause instanceof UiError)
108311
108557
  throw cause;
@@ -108705,7 +108951,7 @@ var require_util = __commonJS(function(exports, module) {
108705
108951
  var require_parse = __commonJS(function(exports, module) {
108706
108952
  var util = require_util();
108707
108953
  var source2;
108708
- var parseState;
108954
+ var parseState2;
108709
108955
  var stack;
108710
108956
  var pos;
108711
108957
  var line;
@@ -108715,7 +108961,7 @@ var require_parse = __commonJS(function(exports, module) {
108715
108961
  var root;
108716
108962
  module.exports = function parse6(text13, reviver) {
108717
108963
  source2 = String(text13);
108718
- parseState = "start";
108964
+ parseState2 = "start";
108719
108965
  stack = [];
108720
108966
  pos = 0;
108721
108967
  line = 1;
@@ -108725,7 +108971,7 @@ var require_parse = __commonJS(function(exports, module) {
108725
108971
  root = undefined;
108726
108972
  do {
108727
108973
  token = lex();
108728
- parseStates[parseState]();
108974
+ parseStates[parseState2]();
108729
108975
  } while (token.type !== "eof");
108730
108976
  if (typeof reviver === "function") {
108731
108977
  return internalize({ "": root }, "", reviver);
@@ -108835,7 +109081,7 @@ var require_parse = __commonJS(function(exports, module) {
108835
109081
  read2();
108836
109082
  return;
108837
109083
  }
108838
- return lexStates[parseState]();
109084
+ return lexStates[parseState2]();
108839
109085
  },
108840
109086
  comment() {
108841
109087
  switch (c2) {
@@ -109383,7 +109629,7 @@ var require_parse = __commonJS(function(exports, module) {
109383
109629
  case "identifier":
109384
109630
  case "string":
109385
109631
  key = token.value;
109386
- parseState = "afterPropertyName";
109632
+ parseState2 = "afterPropertyName";
109387
109633
  return;
109388
109634
  case "punctuator":
109389
109635
  pop();
@@ -109396,7 +109642,7 @@ var require_parse = __commonJS(function(exports, module) {
109396
109642
  if (token.type === "eof") {
109397
109643
  throw invalidEOF();
109398
109644
  }
109399
- parseState = "beforePropertyValue";
109645
+ parseState2 = "beforePropertyValue";
109400
109646
  },
109401
109647
  beforePropertyValue() {
109402
109648
  if (token.type === "eof") {
@@ -109420,7 +109666,7 @@ var require_parse = __commonJS(function(exports, module) {
109420
109666
  }
109421
109667
  switch (token.value) {
109422
109668
  case ",":
109423
- parseState = "beforePropertyName";
109669
+ parseState2 = "beforePropertyName";
109424
109670
  return;
109425
109671
  case "}":
109426
109672
  pop();
@@ -109432,7 +109678,7 @@ var require_parse = __commonJS(function(exports, module) {
109432
109678
  }
109433
109679
  switch (token.value) {
109434
109680
  case ",":
109435
- parseState = "beforeArrayValue";
109681
+ parseState2 = "beforeArrayValue";
109436
109682
  return;
109437
109683
  case "]":
109438
109684
  pop();
@@ -109478,18 +109724,18 @@ var require_parse = __commonJS(function(exports, module) {
109478
109724
  if (value3 !== null && typeof value3 === "object") {
109479
109725
  stack.push(value3);
109480
109726
  if (Array.isArray(value3)) {
109481
- parseState = "beforeArrayValue";
109727
+ parseState2 = "beforeArrayValue";
109482
109728
  } else {
109483
- parseState = "beforePropertyName";
109729
+ parseState2 = "beforePropertyName";
109484
109730
  }
109485
109731
  } else {
109486
109732
  const current = stack[stack.length - 1];
109487
109733
  if (current == null) {
109488
- parseState = "end";
109734
+ parseState2 = "end";
109489
109735
  } else if (Array.isArray(current)) {
109490
- parseState = "afterArrayValue";
109736
+ parseState2 = "afterArrayValue";
109491
109737
  } else {
109492
- parseState = "afterPropertyValue";
109738
+ parseState2 = "afterPropertyValue";
109493
109739
  }
109494
109740
  }
109495
109741
  }
@@ -109497,11 +109743,11 @@ var require_parse = __commonJS(function(exports, module) {
109497
109743
  stack.pop();
109498
109744
  const current = stack[stack.length - 1];
109499
109745
  if (current == null) {
109500
- parseState = "end";
109746
+ parseState2 = "end";
109501
109747
  } else if (Array.isArray(current)) {
109502
- parseState = "afterArrayValue";
109748
+ parseState2 = "afterArrayValue";
109503
109749
  } else {
109504
- parseState = "afterPropertyValue";
109750
+ parseState2 = "afterPropertyValue";
109505
109751
  }
109506
109752
  }
109507
109753
  function invalidChar(c3) {
@@ -110336,14 +110582,14 @@ var require_lib5 = __commonJS(function(exports) {
110336
110582
  });
110337
110583
 
110338
110584
  // src/ui/project.ts
110339
- import { access as access2, lstat as lstat3, readFile as readFile21, realpath as realpath2 } from "node:fs/promises";
110585
+ import { access as access2, lstat as lstat3, readFile as readFile22, realpath as realpath2 } from "node:fs/promises";
110340
110586
  import path5 from "node:path";
110341
110587
  async function exists(target2) {
110342
110588
  return access2(target2).then(() => true, () => false);
110343
110589
  }
110344
110590
  async function readManifest(target2) {
110345
110591
  try {
110346
- return JSON.parse(await readFile21(target2, "utf8"));
110592
+ return JSON.parse(await readFile22(target2, "utf8"));
110347
110593
  } catch (cause) {
110348
110594
  throw new UiError("UI_PROJECT_UNSUPPORTED", "package.json is not valid JSON.", undefined, {
110349
110595
  cause
@@ -110413,7 +110659,7 @@ async function resolveAlias(project2, candidate2) {
110413
110659
  async function resolveUiRegistryTarget(project2, declaredTarget) {
110414
110660
  if (!declaredTarget.startsWith("components/"))
110415
110661
  return declaredTarget;
110416
- const components = await readFile21(project2.componentsPath, "utf8").then((value3) => JSON.parse(value3)).catch(() => {
110662
+ const components = await readFile22(project2.componentsPath, "utf8").then((value3) => JSON.parse(value3)).catch(() => {
110417
110663
  return;
110418
110664
  });
110419
110665
  const componentsAlias = components?.aliases?.components;
@@ -110483,30 +110729,30 @@ async function discoverUiProject(input = process.cwd()) {
110483
110729
  const packageJsonPath = path5.join(root, "package.json");
110484
110730
  const packageJson = await readManifest(packageJsonPath);
110485
110731
  let manager = "npm";
110486
- let lockPath;
110732
+ let lockPath2;
110487
110733
  for (const [file2, candidate2] of MANAGERS) {
110488
110734
  const target2 = path5.join(root, file2);
110489
110735
  if (await exists(target2)) {
110490
110736
  manager = candidate2;
110491
- lockPath = target2;
110737
+ lockPath2 = target2;
110492
110738
  break;
110493
110739
  }
110494
110740
  }
110495
110741
  const declared = packageJson.packageManager;
110496
- if (!lockPath && typeof declared === "string") {
110742
+ if (!lockPath2 && typeof declared === "string") {
110497
110743
  const candidate2 = declared.split("@")[0];
110498
110744
  if (candidate2 === "pnpm" || candidate2 === "npm" || candidate2 === "yarn" || candidate2 === "bun") {
110499
110745
  manager = candidate2;
110500
110746
  }
110501
110747
  }
110502
- if (!lockPath) {
110748
+ if (!lockPath2) {
110503
110749
  const expectedLock = {
110504
110750
  pnpm: "pnpm-lock.yaml",
110505
110751
  npm: "package-lock.json",
110506
110752
  yarn: "yarn.lock",
110507
110753
  bun: "bun.lock"
110508
110754
  }[manager];
110509
- lockPath = path5.join(root, expectedLock);
110755
+ lockPath2 = path5.join(root, expectedLock);
110510
110756
  }
110511
110757
  const rootCssCandidates = ["src/index.css", "src/app.css", "app/globals.css", "src/styles.css"];
110512
110758
  const frontendCssCandidates = [
@@ -110515,7 +110761,7 @@ async function discoverUiProject(input = process.cwd()) {
110515
110761
  "frontend/src/styles.css"
110516
110762
  ];
110517
110763
  const componentsPath = path5.join(root, "components.json");
110518
- const configuredCss = await readFile21(componentsPath, "utf8").then((value3) => {
110764
+ const configuredCss = await readFile22(componentsPath, "utf8").then((value3) => {
110519
110765
  const components = JSON.parse(value3);
110520
110766
  const css = components.tailwind?.css;
110521
110767
  if (typeof css !== "string" || css.length === 0)
@@ -110541,7 +110787,7 @@ async function discoverUiProject(input = process.cwd()) {
110541
110787
  packageJsonPath,
110542
110788
  packageJson,
110543
110789
  manager,
110544
- lockPath,
110790
+ lockPath: lockPath2,
110545
110791
  cssPath: path5.join(root, cssRelative),
110546
110792
  componentsPath,
110547
110793
  uiLockPath: path5.join(root, "astrale-ui.lock.json"),
@@ -110826,13 +111072,13 @@ var init_runner = __esm(() => {
110826
111072
  });
110827
111073
 
110828
111074
  // src/ui/operations.ts
110829
- import { access as access3, lstat as lstat4, mkdir as mkdir13, readFile as readFile22, realpath as realpath3, rm as rm8, writeFile as writeFile9 } from "node:fs/promises";
111075
+ import { access as access3, lstat as lstat4, mkdir as mkdir13, readFile as readFile23, realpath as realpath3, rm as rm9, writeFile as writeFile9 } from "node:fs/promises";
110830
111076
  import path6 from "node:path";
110831
111077
  async function exists2(target2) {
110832
111078
  return access3(target2).then(() => true, () => false);
110833
111079
  }
110834
111080
  async function readOptional(target2) {
110835
- return readFile22(target2, "utf8").catch(() => {
111081
+ return readFile23(target2, "utf8").catch(() => {
110836
111082
  return;
110837
111083
  });
110838
111084
  }
@@ -110946,7 +111192,7 @@ async function appendPnpmWorkspace(project2, workspace) {
110946
111192
  async function hasDomainRegistryWorkspace(project2) {
110947
111193
  if (!project2.isAstraleDomain || !await exists2(domainRegistryPackagePath(project2)))
110948
111194
  return false;
110949
- const registryManifest = JSON.parse(await readFile22(domainRegistryPackagePath(project2), "utf8"));
111195
+ const registryManifest = JSON.parse(await readFile23(domainRegistryPackagePath(project2), "utf8"));
110950
111196
  if (registryManifest.private !== true || typeof registryManifest.name !== "string" || registryManifest.name === UI_PACKAGE || registryManifest.name === project2.packageJson.name) {
110951
111197
  return false;
110952
111198
  }
@@ -111126,13 +111372,13 @@ async function initUi(options, dependencies = {}) {
111126
111372
  if (value3 !== undefined)
111127
111373
  await writeFile9(target2, value3, "utf8");
111128
111374
  else
111129
- await rm8(target2, { force: true });
111375
+ await rm9(target2, { force: true });
111130
111376
  }
111131
111377
  throw error52;
111132
111378
  }
111133
111379
  }
111134
111380
  async function pinUiDependency(project2, version2, section, runner) {
111135
- const manifest = JSON.parse(await readFile22(project2.packageJsonPath, "utf8"));
111381
+ const manifest = JSON.parse(await readFile23(project2.packageJsonPath, "utf8"));
111136
111382
  const current = manifestDependencies(manifest, section)[UI_PACKAGE];
111137
111383
  const other = section === "dependencies" ? "devDependencies" : "dependencies";
111138
111384
  if (current === version2 && manifestDependencies(manifest, other)[UI_PACKAGE] === undefined)
@@ -111170,7 +111416,7 @@ async function addLocalTheme(address, project2, options) {
111170
111416
  if (!THEME_SLUG.test(slug)) {
111171
111417
  throw new UiError("UI_ITEM_CONFLICT", "Local theme filename must be a kebab-case theme name.", "Rename it to a name such as observatory.css.");
111172
111418
  }
111173
- const source2 = await readFile22(sourcePath, "utf8");
111419
+ const source2 = await readFile23(sourcePath, "utf8");
111174
111420
  admitLocalThemeCss(source2, slug);
111175
111421
  return installThemeCss(slug, source2, digest5(source2), address, project2, options);
111176
111422
  }
@@ -111219,7 +111465,7 @@ async function installThemeCss(slug, source2, sourceDigest, sourceLabel, project
111219
111465
  } catch (error52) {
111220
111466
  for (const [mutation, previous] of snapshots) {
111221
111467
  if (previous === undefined)
111222
- await rm8(mutation, { force: true });
111468
+ await rm9(mutation, { force: true });
111223
111469
  else
111224
111470
  await writeFile9(mutation, previous, "utf8");
111225
111471
  }
@@ -111314,7 +111560,7 @@ async function addUi(addresses, options, dependencies = {}) {
111314
111560
  } catch (error52) {
111315
111561
  for (const [target2, previous] of snapshots) {
111316
111562
  if (previous === undefined)
111317
- await rm8(target2, { force: true });
111563
+ await rm9(target2, { force: true });
111318
111564
  else
111319
111565
  await writeFile9(target2, previous, "utf8");
111320
111566
  }
@@ -111345,7 +111591,7 @@ async function addUi(addresses, options, dependencies = {}) {
111345
111591
  if (!file2.target)
111346
111592
  continue;
111347
111593
  const target2 = await safeTarget(project2, resolvedTargets.get(file2.target));
111348
- files[projectRelative(project2, target2)] = digest5(await readFile22(target2));
111594
+ files[projectRelative(project2, target2)] = digest5(await readFile23(target2));
111349
111595
  }
111350
111596
  lock.items[item.meta.canonicalAddress] = {
111351
111597
  address: item.meta.canonicalAddress,
@@ -111357,7 +111603,7 @@ async function addUi(addresses, options, dependencies = {}) {
111357
111603
  } catch (error52) {
111358
111604
  for (const [target2, previous] of snapshots) {
111359
111605
  if (previous === undefined)
111360
- await rm8(target2, { force: true });
111606
+ await rm9(target2, { force: true });
111361
111607
  else
111362
111608
  await writeFile9(target2, previous, "utf8");
111363
111609
  }
@@ -111377,7 +111623,7 @@ async function doctorUi(input) {
111377
111623
  const checks3 = [];
111378
111624
  let lock;
111379
111625
  try {
111380
- lock = parseUiLock(JSON.parse(await readFile22(project2.uiLockPath, "utf8")));
111626
+ lock = parseUiLock(JSON.parse(await readFile23(project2.uiLockPath, "utf8")));
111381
111627
  checks3.push({ check: "lock", ok: true });
111382
111628
  } catch (error52) {
111383
111629
  checks3.push({
@@ -111405,7 +111651,7 @@ async function doctorUi(input) {
111405
111651
  if (lock) {
111406
111652
  for (const item of Object.values(lock.items)) {
111407
111653
  for (const [file2, expected] of Object.entries(item.files)) {
111408
- const actual = await readFile22(path6.join(project2.root, file2)).then(digest5).catch(() => "");
111654
+ const actual = await readFile23(path6.join(project2.root, file2)).then(digest5).catch(() => "");
111409
111655
  checks3.push({ check: "item:" + item.address + ":" + file2, ok: actual === expected });
111410
111656
  }
111411
111657
  }
@@ -111458,7 +111704,7 @@ async function rejectLocalChanges(project2, lock, items, overwrite) {
111458
111704
  if (!installed)
111459
111705
  continue;
111460
111706
  for (const [file2, expected] of Object.entries(installed.files)) {
111461
- const actual = await readFile22(path6.join(project2.root, file2)).then(digest5).catch(() => "");
111707
+ const actual = await readFile23(path6.join(project2.root, file2)).then(digest5).catch(() => "");
111462
111708
  if (actual !== expected) {
111463
111709
  throw new UiError("UI_LOCAL_CHANGES", "Installed UI file has local changes: " + file2, "Review the file, then repeat add with explicit --overwrite --yes.");
111464
111710
  }
@@ -111758,7 +112004,7 @@ var init_model8 = __esm(() => {
111758
112004
 
111759
112005
  // src/ui/search/artifacts.ts
111760
112006
  import { createHash as createHash5 } from "node:crypto";
111761
- import { readFile as readFile23 } from "node:fs/promises";
112007
+ import { readFile as readFile24 } from "node:fs/promises";
111762
112008
  import { homedir as homedir6 } from "node:os";
111763
112009
  import path7 from "node:path";
111764
112010
  function cacheBase(commit, configured) {
@@ -111815,14 +112061,14 @@ function verify3(bytes, file2) {
111815
112061
  return bytes.byteLength === file2.bytes && createHash5("sha256").update(bytes).digest("hex") === file2.sha256;
111816
112062
  }
111817
112063
  async function readVerifiedCache(target2, file2) {
111818
- const bytes = await readFile23(target2).catch(() => {
112064
+ const bytes = await readFile24(target2).catch(() => {
111819
112065
  return;
111820
112066
  });
111821
112067
  return bytes && verify3(bytes, file2) ? bytes : undefined;
111822
112068
  }
111823
112069
  async function readManifestCache(target2) {
111824
112070
  try {
111825
- return acceptSearchManifest(JSON.parse(await readFile23(target2, "utf8")));
112071
+ return acceptSearchManifest(JSON.parse(await readFile24(target2, "utf8")));
111826
112072
  } catch {
111827
112073
  return;
111828
112074
  }
@@ -113155,12 +113401,13 @@ function record13(input, label) {
113155
113401
  return input;
113156
113402
  }
113157
113403
  function defaultOperationId2(kind) {
113158
- return `cli.domain.${kind}:${globalThis.crypto.randomUUID()}`;
113404
+ return randomOperationId("cli", "domain", kind);
113159
113405
  }
113160
113406
  var PAGE_SIZE2 = 256, MAXIMUM_DOMAINS = 1e4, MAXIMUM_PAGES2;
113161
113407
  var init_client5 = __esm(() => {
113162
113408
  init_path3();
113163
113409
  init_query3();
113410
+ init_idempotency2();
113164
113411
  init_contract();
113165
113412
  init_graph5();
113166
113413
  init_model9();
@@ -114156,9 +114403,9 @@ __export(exports_register, {
114156
114403
  formatIdentityRegistration: () => formatIdentityRegistration,
114157
114404
  prepareIdentityProvision: () => prepareIdentityProvision
114158
114405
  });
114159
- import { readFile as readFile24 } from "node:fs/promises";
114406
+ import { readFile as readFile25 } from "node:fs/promises";
114160
114407
  async function readJwk(path9) {
114161
- return JSON.parse(await readFile24(path9, "utf8"));
114408
+ return JSON.parse(await readFile25(path9, "utf8"));
114162
114409
  }
114163
114410
  function formatIdentityRegistration(result, format3, machine) {
114164
114411
  output(result, format3);
@@ -114173,9 +114420,9 @@ async function prepareIdentityProvision(input) {
114173
114420
  builder.createNode({ as: binding6, class: input.classPath, props: input.properties });
114174
114421
  return;
114175
114422
  });
114176
- const idempotencyKey = `identity-register:${input.name}`;
114423
+ const registrationKey = await derivedIdempotencyKey("identity-register", input.name);
114177
114424
  const unsigned = exports_provision.accept({
114178
- idempotencyKey,
114425
+ idempotencyKey: registrationKey,
114179
114426
  mutation,
114180
114427
  identities: [
114181
114428
  {
@@ -114193,7 +114440,7 @@ async function prepareIdentityProvision(input) {
114193
114440
  binding: binding6,
114194
114441
  authentication: Object.freeze({ iss: issuer, sub: "self" }),
114195
114442
  request: exports_provision.accept({
114196
- idempotencyKey,
114443
+ idempotencyKey: registrationKey,
114197
114444
  mutation,
114198
114445
  identities: [
114199
114446
  {
@@ -114220,6 +114467,7 @@ var init_register = __esm(() => {
114220
114467
  init_graph6();
114221
114468
  init_identity7();
114222
114469
  init_keys();
114470
+ init_idempotency2();
114223
114471
  init_log();
114224
114472
  init_output();
114225
114473
  register_default = {
@@ -114565,7 +114813,7 @@ var exports_import = {};
114565
114813
  __export(exports_import, {
114566
114814
  default: () => import_default
114567
114815
  });
114568
- import { readFile as readFile25 } from "node:fs/promises";
114816
+ import { readFile as readFile26 } from "node:fs/promises";
114569
114817
  var import_default;
114570
114818
  var init_import2 = __esm(() => {
114571
114819
  init_identity7();
@@ -114593,7 +114841,7 @@ var init_import2 = __esm(() => {
114593
114841
  ],
114594
114842
  action: async (path9, opts) => {
114595
114843
  try {
114596
- const raw2 = await readFile25(path9, "utf-8");
114844
+ const raw2 = await readFile26(path9, "utf-8");
114597
114845
  const passphrase = isEncryptedIdentityExport(raw2) ? await readPassphrase("Passphrase: ") : undefined;
114598
114846
  const envelope = await decodeIdentityExport(raw2, passphrase);
114599
114847
  const name = opts.name ?? envelope.subject;
@@ -114948,21 +115196,21 @@ var init_status5 = __esm(() => {
114948
115196
 
114949
115197
  // src/telemetry/store.ts
114950
115198
  import { existsSync as existsSync11, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
114951
- import { join as join23 } from "node:path";
115199
+ import { join as join24 } from "node:path";
114952
115200
  function sessionsRoot() {
114953
- return join23(createPaths().home, "sessions");
115201
+ return join24(createPaths().home, "sessions");
114954
115202
  }
114955
115203
  function sessionDir(id) {
114956
- return join23(sessionsRoot(), id);
115204
+ return join24(sessionsRoot(), id);
114957
115205
  }
114958
115206
  function eventsPath(id) {
114959
- return join23(sessionDir(id), "events.jsonl");
115207
+ return join24(sessionDir(id), "events.jsonl");
114960
115208
  }
114961
115209
  function metaPath(id) {
114962
- return join23(sessionDir(id), "meta.json");
115210
+ return join24(sessionDir(id), "meta.json");
114963
115211
  }
114964
115212
  function markerPath(id) {
114965
- return join23(sessionDir(id), ".analyzed");
115213
+ return join24(sessionDir(id), ".analyzed");
114966
115214
  }
114967
115215
  function sessionIds() {
114968
115216
  try {
@@ -114994,7 +115242,7 @@ function directoryBytes2(dir) {
114994
115242
  }
114995
115243
  let total = 0;
114996
115244
  for (const entry2 of entries) {
114997
- const path9 = join23(dir, entry2.name);
115245
+ const path9 = join24(dir, entry2.name);
114998
115246
  if (entry2.isDirectory()) {
114999
115247
  total += directoryBytes2(path9);
115000
115248
  } else if (entry2.isFile()) {
@@ -115084,12 +115332,12 @@ var init_list4 = __esm(() => {
115084
115332
  // src/telemetry/adapters/claude-code.ts
115085
115333
  import { existsSync as existsSync12, readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
115086
115334
  import { homedir as homedir7 } from "node:os";
115087
- import { join as join24 } from "node:path";
115335
+ import { join as join25 } from "node:path";
115088
115336
  function mungeCwd(cwd) {
115089
115337
  return cwd.replace(/[^a-zA-Z0-9]/g, "-");
115090
115338
  }
115091
- function claudeCodeAdapter(base2 = join24(homedir7(), ".claude")) {
115092
- const projectsDir = join24(base2, "projects");
115339
+ function claudeCodeAdapter(base2 = join25(homedir7(), ".claude")) {
115340
+ const projectsDir = join25(base2, "projects");
115093
115341
  function detect2() {
115094
115342
  try {
115095
115343
  return existsSync12(projectsDir);
@@ -115113,7 +115361,7 @@ function claudeCodeAdapter(base2 = join24(homedir7(), ".claude")) {
115113
115361
  for (const dir of dirs) {
115114
115362
  if (dir !== munged && !dir.startsWith(prefix))
115115
115363
  continue;
115116
- const projectPath = join24(projectsDir, dir);
115364
+ const projectPath = join25(projectsDir, dir);
115117
115365
  let files;
115118
115366
  try {
115119
115367
  files = readdirSync3(projectPath);
@@ -115123,7 +115371,7 @@ function claudeCodeAdapter(base2 = join24(homedir7(), ".claude")) {
115123
115371
  for (const file2 of files) {
115124
115372
  if (!file2.endsWith(".jsonl"))
115125
115373
  continue;
115126
- const transcriptPath = join24(projectPath, file2);
115374
+ const transcriptPath = join25(projectPath, file2);
115127
115375
  try {
115128
115376
  const st = statSync4(transcriptPath);
115129
115377
  const mtimeMs = st.mtime.getTime();
@@ -115159,7 +115407,7 @@ var init_claude_code = __esm(() => {
115159
115407
  import { existsSync as existsSync13, openSync as openSync3, readdirSync as readdirSync4, readSync, statSync as statSync5 } from "node:fs";
115160
115408
  import { closeSync as closeSync4 } from "node:fs";
115161
115409
  import { homedir as homedir8 } from "node:os";
115162
- import { join as join25 } from "node:path";
115410
+ import { join as join26 } from "node:path";
115163
115411
  function readFirstLine(path9) {
115164
115412
  let fd = null;
115165
115413
  try {
@@ -115199,8 +115447,8 @@ function numericDirs(path9) {
115199
115447
  return [];
115200
115448
  }
115201
115449
  }
115202
- function codexAdapter(base2 = join25(homedir8(), ".codex")) {
115203
- const sessionsDir = join25(base2, "sessions");
115450
+ function codexAdapter(base2 = join26(homedir8(), ".codex")) {
115451
+ const sessionsDir = join26(base2, "sessions");
115204
115452
  function detect2() {
115205
115453
  try {
115206
115454
  return existsSync13(sessionsDir);
@@ -115213,14 +115461,14 @@ function codexAdapter(base2 = join25(homedir8(), ".codex")) {
115213
115461
  try {
115214
115462
  const startMs = window2.start.getTime();
115215
115463
  const endMs = window2.end.getTime();
115216
- const lowerMs = startMs - DAY_MS;
115464
+ const lowerMs = startMs - DAY_MS2;
115217
115465
  for (const yyyy of numericDirs(sessionsDir)) {
115218
- for (const mm of numericDirs(join25(sessionsDir, yyyy))) {
115219
- for (const dd of numericDirs(join25(sessionsDir, yyyy, mm))) {
115466
+ for (const mm of numericDirs(join26(sessionsDir, yyyy))) {
115467
+ for (const dd of numericDirs(join26(sessionsDir, yyyy, mm))) {
115220
115468
  const dayStart = Date.UTC(Number(yyyy), Number(mm) - 1, Number(dd));
115221
- if (dayStart > endMs + DAY_MS || dayStart + DAY_MS <= lowerMs)
115469
+ if (dayStart > endMs + DAY_MS2 || dayStart + DAY_MS2 <= lowerMs)
115222
115470
  continue;
115223
- scanDay(join25(sessionsDir, yyyy, mm, dd), root, startMs, endMs, sessions);
115471
+ scanDay(join26(sessionsDir, yyyy, mm, dd), root, startMs, endMs, sessions);
115224
115472
  }
115225
115473
  }
115226
115474
  }
@@ -115242,7 +115490,7 @@ function scanDay(dayPath, root, startMs, endMs, out) {
115242
115490
  for (const file2 of files) {
115243
115491
  if (!file2.startsWith("rollout-") || !file2.endsWith(".jsonl"))
115244
115492
  continue;
115245
- const transcriptPath = join25(dayPath, file2);
115493
+ const transcriptPath = join26(dayPath, file2);
115246
115494
  try {
115247
115495
  const st = statSync5(transcriptPath);
115248
115496
  const mtimeMs = st.mtime.getTime();
@@ -115279,9 +115527,9 @@ function scanDay(dayPath, root, startMs, endMs, out) {
115279
115527
  } catch {}
115280
115528
  }
115281
115529
  }
115282
- var DAY_MS, HEAD_CHUNK, MAX_HEAD_BYTES, READING_GUIDE2;
115530
+ var DAY_MS2, HEAD_CHUNK, MAX_HEAD_BYTES, READING_GUIDE2;
115283
115531
  var init_codex = __esm(() => {
115284
- DAY_MS = 24 * 60 * 60 * 1000;
115532
+ DAY_MS2 = 24 * 60 * 60 * 1000;
115285
115533
  HEAD_CHUNK = 64 * 1024;
115286
115534
  MAX_HEAD_BYTES = 512 * 1024;
115287
115535
  READING_GUIDE2 = "This is a Codex rollout: one JSON object per line (JSONL). Line 1 is `session_meta` (session_id, " + "timestamp, cwd, cli_version). Later lines are either `response_item` — payload.type of message, " + "function_call, function_call_output, or reasoning (reasoning is a short summary, not verbatim chain " + "of thought) — or `event_msg` carrying task_started, task_complete, token_count, agent_message, and " + "user_message. Files can be large, so grep for function_call names, outputs, or error strings and " + "sample around them rather than reading the whole rollout.";
@@ -115428,7 +115676,7 @@ var init_settings = __esm(() => {
115428
115676
 
115429
115677
  // src/telemetry/retention.ts
115430
115678
  import { readdirSync as readdirSync5, rmSync as rmSync2 } from "node:fs";
115431
- import { join as join26 } from "node:path";
115679
+ import { join as join27 } from "node:path";
115432
115680
  function tidySession(id, options = {}) {
115433
115681
  const dir = sessionDir(id);
115434
115682
  let entries;
@@ -115444,7 +115692,7 @@ function tidySession(id, options = {}) {
115444
115692
  if (entry2.name === ANALYZER_PROMPT && options.keepPrompt === true)
115445
115693
  continue;
115446
115694
  try {
115447
- rmSync2(join26(dir, entry2.name), { recursive: true, force: true });
115695
+ rmSync2(join27(dir, entry2.name), { recursive: true, force: true });
115448
115696
  removed.push(entry2.name);
115449
115697
  } catch {}
115450
115698
  }
@@ -115520,7 +115768,7 @@ var init_retention = __esm(() => {
115520
115768
  // src/telemetry/analyze.ts
115521
115769
  import { spawn as spawn3 } from "node:child_process";
115522
115770
  import { writeFileSync as writeFileSync3 } from "node:fs";
115523
- import { join as join27 } from "node:path";
115771
+ import { join as join28 } from "node:path";
115524
115772
  function writeMarker(id, marker) {
115525
115773
  writeFileSync3(markerPath(id), JSON.stringify(marker, null, 2) + `
115526
115774
  `);
@@ -115627,7 +115875,7 @@ async function analyzeSession(id, opts = {}) {
115627
115875
  const guides = new Map(adapters.map((a) => [a.name, a.readingGuide]));
115628
115876
  const prompt = buildPrompt({ id, root, signals: signals2, guides, file: opts.file ?? false });
115629
115877
  const dir = sessionDir(id);
115630
- writeFileSync3(join27(dir, "analyzer-prompt.md"), prompt);
115878
+ writeFileSync3(join28(dir, "analyzer-prompt.md"), prompt);
115631
115879
  const outcome = await runClaude(prompt, dir, opts);
115632
115880
  const marker = {
115633
115881
  analyzedAt: new Date().toISOString(),
@@ -115636,7 +115884,7 @@ async function analyzeSession(id, opts = {}) {
115636
115884
  };
115637
115885
  writeMarker(id, marker);
115638
115886
  tidySession(id, { keepPrompt: marker.outcome === "error" });
115639
- return { ...marker, reportPath: join27(dir, "report.md") };
115887
+ return { ...marker, reportPath: join28(dir, "report.md") };
115640
115888
  }
115641
115889
  function runClaude(prompt, cwd, opts) {
115642
115890
  return new Promise((resolve9) => {
@@ -115666,7 +115914,7 @@ function runClaude(prompt, cwd, opts) {
115666
115914
  child3.on("close", (code) => {
115667
115915
  clearTimeout(timer);
115668
115916
  try {
115669
- writeFileSync3(join27(cwd, "analyzer.log"), clampLog(out + (err ? `
115917
+ writeFileSync3(join28(cwd, "analyzer.log"), clampLog(out + (err ? `
115670
115918
  --- stderr ---
115671
115919
  ${err}` : "")));
115672
115920
  } catch {}
@@ -115699,18 +115947,18 @@ var init_analyze = __esm(() => {
115699
115947
 
115700
115948
  // src/telemetry/trigger.ts
115701
115949
  import { existsSync as existsSync14, mkdirSync as mkdirSync4, readFileSync as readFileSync7, unlinkSync as unlinkSync3, writeFileSync as writeFileSync4 } from "node:fs";
115702
- import { join as join28 } from "node:path";
115703
- function lockPath() {
115704
- return join28(sessionsRoot(), ".analyzer.lock");
115950
+ import { join as join29 } from "node:path";
115951
+ function lockPath2() {
115952
+ return join29(sessionsRoot(), ".analyzer.lock");
115705
115953
  }
115706
115954
  function releaseLock() {
115707
115955
  try {
115708
- unlinkSync3(lockPath());
115956
+ unlinkSync3(lockPath2());
115709
115957
  } catch {}
115710
115958
  }
115711
115959
  function restampLock() {
115712
115960
  try {
115713
- writeFileSync4(lockPath(), JSON.stringify({ pid: process.pid, at: Date.now() }));
115961
+ writeFileSync4(lockPath2(), JSON.stringify({ pid: process.pid, at: Date.now() }));
115714
115962
  } catch {}
115715
115963
  }
115716
115964
  var LOCK_STALE_MS;
@@ -115797,7 +116045,7 @@ var exports_add2 = {};
115797
116045
  __export(exports_add2, {
115798
116046
  default: () => add_default2
115799
116047
  });
115800
- import { readFile as readFile26 } from "node:fs/promises";
116048
+ import { readFile as readFile27 } from "node:fs/promises";
115801
116049
  function isString(value3) {
115802
116050
  return typeof value3 === "string";
115803
116051
  }
@@ -115859,7 +116107,7 @@ Security:
115859
116107
  if (!opts.issuer && !opts.metadata && !opts.workosAuthkit) {
115860
116108
  throw new Error("Either --issuer, --metadata, or --workos-authkit is required");
115861
116109
  }
115862
- let metadata = opts.workosAuthkit ? workosAuthKitMetadata(opts.workosApiHostname, opts.clientId) : opts.metadata ? OidcMetadataSchema.parse(JSON.parse(await readFile26(opts.metadata, "utf-8"))) : await fetchOidcMetadata(opts.issuer);
116110
+ let metadata = opts.workosAuthkit ? workosAuthKitMetadata(opts.workosApiHostname, opts.clientId) : opts.metadata ? OidcMetadataSchema.parse(JSON.parse(await readFile27(opts.metadata, "utf-8"))) : await fetchOidcMetadata(opts.issuer);
115863
116111
  if (opts.issuer) {
115864
116112
  validateUrl(opts.issuer);
115865
116113
  if (normalizeIssuer2(metadata.issuer) !== normalizeIssuer2(opts.issuer)) {
@@ -116235,9 +116483,9 @@ import {
116235
116483
  rmSync as rmSync3,
116236
116484
  writeFileSync as writeFileSync7
116237
116485
  } from "node:fs";
116238
- import { dirname as dirname17, join as join32, relative as relative2, resolve as resolve9, sep } from "node:path";
116486
+ import { dirname as dirname17, join as join33, relative as relative2, resolve as resolve9, sep } from "node:path";
116239
116487
  function dotDir(domainRoot) {
116240
- return join32(domainRoot, DOT);
116488
+ return join33(domainRoot, DOT);
116241
116489
  }
116242
116490
  function assertInsideDot(domainRoot, target2) {
116243
116491
  const abs = resolve9(target2);
@@ -116257,7 +116505,7 @@ function assertInsideDot(domainRoot, target2) {
116257
116505
  let prefix = root;
116258
116506
  for (const part of ["", ...parts]) {
116259
116507
  if (part)
116260
- prefix = join32(prefix, part);
116508
+ prefix = join33(prefix, part);
116261
116509
  try {
116262
116510
  lstatSync2(prefix);
116263
116511
  } catch (error52) {
@@ -116279,13 +116527,13 @@ function assertInsideDot(domainRoot, target2) {
116279
116527
  return abs;
116280
116528
  }
116281
116529
  function ensureDir(domainRoot, subpath = "") {
116282
- const target2 = subpath ? join32(dotDir(domainRoot), subpath) : dotDir(domainRoot);
116530
+ const target2 = subpath ? join33(dotDir(domainRoot), subpath) : dotDir(domainRoot);
116283
116531
  assertInsideDot(domainRoot, target2);
116284
116532
  mkdirSync7(target2, { recursive: true });
116285
116533
  return target2;
116286
116534
  }
116287
116535
  function writeState(domainRoot, subpath, contents) {
116288
- const target2 = join32(dotDir(domainRoot), subpath);
116536
+ const target2 = join33(dotDir(domainRoot), subpath);
116289
116537
  const abs = assertInsideDot(domainRoot, target2);
116290
116538
  mkdirSync7(dirname17(abs), { recursive: true });
116291
116539
  writeFileSync7(abs, contents);
@@ -116294,16 +116542,16 @@ function writeJson2(domainRoot, subpath, value3) {
116294
116542
  writeState(domainRoot, subpath, JSON.stringify(value3, null, 2));
116295
116543
  }
116296
116544
  function writeStateBuffer(domainRoot, subpath, data4) {
116297
- const target2 = join32(dotDir(domainRoot), subpath);
116545
+ const target2 = join33(dotDir(domainRoot), subpath);
116298
116546
  const abs = assertInsideDot(domainRoot, target2);
116299
116547
  mkdirSync7(dirname17(abs), { recursive: true });
116300
116548
  writeFileSync7(abs, data4);
116301
116549
  }
116302
- function statePath(domainRoot, subpath) {
116303
- return assertInsideDot(domainRoot, join32(dotDir(domainRoot), subpath));
116550
+ function statePath2(domainRoot, subpath) {
116551
+ return assertInsideDot(domainRoot, join33(dotDir(domainRoot), subpath));
116304
116552
  }
116305
116553
  function readState(domainRoot, subpath) {
116306
- const target2 = assertInsideDot(domainRoot, join32(dotDir(domainRoot), subpath));
116554
+ const target2 = assertInsideDot(domainRoot, join33(dotDir(domainRoot), subpath));
116307
116555
  if (!existsSync18(target2))
116308
116556
  return null;
116309
116557
  return readFileSync10(target2, "utf8");
@@ -116318,19 +116566,19 @@ function readJson2(domainRoot, subpath, decode12, fallback) {
116318
116566
  return decode12(parsed) ?? fallback;
116319
116567
  }
116320
116568
  function listState(domainRoot, subpath) {
116321
- const target2 = assertInsideDot(domainRoot, join32(dotDir(domainRoot), subpath));
116569
+ const target2 = assertInsideDot(domainRoot, join33(dotDir(domainRoot), subpath));
116322
116570
  if (!existsSync18(target2))
116323
116571
  return [];
116324
116572
  return readdirSync7(target2);
116325
116573
  }
116326
116574
  function removeState(domainRoot, subpath) {
116327
- const target2 = join32(dotDir(domainRoot), subpath);
116575
+ const target2 = join33(dotDir(domainRoot), subpath);
116328
116576
  const abs = assertInsideDot(domainRoot, target2);
116329
116577
  if (existsSync18(abs))
116330
116578
  rmSync3(abs, { recursive: true, force: true });
116331
116579
  }
116332
116580
  function stateExists(domainRoot, subpath) {
116333
- return existsSync18(assertInsideDot(domainRoot, join32(dotDir(domainRoot), subpath)));
116581
+ return existsSync18(assertInsideDot(domainRoot, join33(dotDir(domainRoot), subpath)));
116334
116582
  }
116335
116583
  function initDotDir(domainRoot) {
116336
116584
  ensureDir(domainRoot);
@@ -116819,7 +117067,7 @@ var init_routes2 = __esm(() => {
116819
117067
  // studio/server/agent/bridge/grant.ts
116820
117068
  import { randomUUID as randomUUID5 } from "node:crypto";
116821
117069
  import { chmodSync as chmodSync2 } from "node:fs";
116822
- import { join as join33 } from "node:path";
117070
+ import { join as join34 } from "node:path";
116823
117071
  function setBridgePort(port) {
116824
117072
  studioPort = port;
116825
117073
  }
@@ -116830,7 +117078,7 @@ function startBridge(handle, notify) {
116830
117078
  const base2 = `http://127.0.0.1:${studioPort}/api/domain/${encodeURIComponent(handle.id)}/agent/bridge`;
116831
117079
  const bridgeRel = `.cache/agent/bridge-${fileId}.json`;
116832
117080
  writeJson2(handle.root, bridgeRel, { base: base2, token });
116833
- const bridgeConfigPath = statePath(handle.root, bridgeRel);
117081
+ const bridgeConfigPath = statePath2(handle.root, bridgeRel);
116834
117082
  chmodSync2(bridgeConfigPath, 384);
116835
117083
  let bridgeCommand;
116836
117084
  try {
@@ -116887,7 +117135,7 @@ var init_grant2 = __esm(() => {
116887
117135
  raise_question: "raise_question"
116888
117136
  };
116889
117137
  studioPort = Number(process.env.PORT) || 4319;
116890
- MCP_SERVER = join33(import.meta.dir, "stdio.ts");
117138
+ MCP_SERVER = join34(import.meta.dir, "stdio.ts");
116891
117139
  });
116892
117140
 
116893
117141
  // studio/shared/schema/identity.ts
@@ -116927,7 +117175,7 @@ var init_types = __esm(() => {
116927
117175
 
116928
117176
  // studio/server/client-package.ts
116929
117177
  import { existsSync as existsSync19, readFileSync as readFileSync11, statSync as statSync7 } from "node:fs";
116930
- import { isAbsolute as isAbsolute2, join as join34, relative as relative3, resolve as resolve10 } from "node:path";
117178
+ import { isAbsolute as isAbsolute2, join as join35, relative as relative3, resolve as resolve10 } from "node:path";
116931
117179
  async function resolveClientPackage(root, force = false) {
116932
117180
  const projectDir = resolve10(root);
116933
117181
  const inputs = discoverInputs(projectDir);
@@ -116950,7 +117198,7 @@ function invalidateClientPackage(root) {
116950
117198
  cache2.delete(resolve10(root));
116951
117199
  }
116952
117200
  function discoverInputs(projectDir) {
116953
- const rootPackageFile = join34(projectDir, "package.json");
117201
+ const rootPackageFile = join35(projectDir, "package.json");
116954
117202
  let rootPackage;
116955
117203
  try {
116956
117204
  if (existsSync19(rootPackageFile))
@@ -116971,7 +117219,7 @@ function discoverInputs(projectDir) {
116971
117219
  }
116972
117220
  }
116973
117221
  function resolveDiscovery(projectDir, rootPackage, inspectedFiles) {
116974
- const rootPackageFile = join34(projectDir, "package.json");
117222
+ const rootPackageFile = join35(projectDir, "package.json");
116975
117223
  const candidates = [];
116976
117224
  for (const packageFile of inspectedFiles) {
116977
117225
  if (packageFile === rootPackageFile)
@@ -117012,7 +117260,7 @@ function resolveDiscovery(projectDir, rootPackage, inspectedFiles) {
117012
117260
  return unavailable3("This domain has no package that defines a dev:hmr script.");
117013
117261
  }
117014
117262
  function discoverPackageFiles(projectDir, rootPackage) {
117015
- const workspaceFile = join34(projectDir, "pnpm-workspace.yaml");
117263
+ const workspaceFile = join35(projectDir, "pnpm-workspace.yaml");
117016
117264
  const patterns2 = [...packageWorkspacePatterns(rootPackage)];
117017
117265
  if (existsSync19(workspaceFile)) {
117018
117266
  const workspace2 = $parse(readFileSync11(workspaceFile, "utf8"));
@@ -117098,7 +117346,7 @@ function inside(root, file2) {
117098
117346
  function inputFingerprint(projectDir, packageFiles) {
117099
117347
  return [
117100
117348
  fileFingerprint(projectDir),
117101
- fileFingerprint(join34(projectDir, "pnpm-workspace.yaml")),
117349
+ fileFingerprint(join35(projectDir, "pnpm-workspace.yaml")),
117102
117350
  ...packageFiles.map(fileFingerprint)
117103
117351
  ].join("|");
117104
117352
  }
@@ -125182,7 +125430,7 @@ ${lanes.join(`
125182
125430
  writeOutputIsTTY() {
125183
125431
  return process.stdout.isTTY;
125184
125432
  },
125185
- readFile: readFile27,
125433
+ readFile: readFile28,
125186
125434
  writeFile: writeFile22,
125187
125435
  watchFile: watchFile2,
125188
125436
  watchDirectory,
@@ -125375,7 +125623,7 @@ ${lanes.join(`
125375
125623
  function fsWatchWorker(fileOrDirectory, recursive, callback) {
125376
125624
  return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ? { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
125377
125625
  }
125378
- function readFile27(fileName, _encoding) {
125626
+ function readFile28(fileName, _encoding) {
125379
125627
  let buffer;
125380
125628
  try {
125381
125629
  buffer = _fs.readFileSync(fileName);
@@ -156004,7 +156252,7 @@ ${lanes.join(`
156004
156252
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
156005
156253
  return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node5, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node5, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
156006
156254
  }
156007
- function parseCommandLineWorker(diagnostics, commandLine, readFile27) {
156255
+ function parseCommandLineWorker(diagnostics, commandLine, readFile28) {
156008
156256
  const options = {};
156009
156257
  let watchOptions;
156010
156258
  const fileNames = [];
@@ -156042,7 +156290,7 @@ ${lanes.join(`
156042
156290
  }
156043
156291
  }
156044
156292
  function parseResponseFile(fileName) {
156045
- const text13 = tryReadFile(fileName, readFile27 || ((fileName2) => sys.readFile(fileName2)));
156293
+ const text13 = tryReadFile(fileName, readFile28 || ((fileName2) => sys.readFile(fileName2)));
156046
156294
  if (!isString2(text13)) {
156047
156295
  errors7.push(text13);
156048
156296
  return;
@@ -156145,8 +156393,8 @@ ${lanes.join(`
156145
156393
  unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
156146
156394
  optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
156147
156395
  };
156148
- function parseCommandLine(commandLine, readFile27) {
156149
- return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile27);
156396
+ function parseCommandLine(commandLine, readFile28) {
156397
+ return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile28);
156150
156398
  }
156151
156399
  function getOptionFromName(optionName, allowShort) {
156152
156400
  return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
@@ -156214,8 +156462,8 @@ ${lanes.join(`
156214
156462
  result.originalFileName = result.fileName;
156215
156463
  return parseJsonSourceFileConfigFileContent(result, host, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd), optionsToExtend, getNormalizedAbsolutePath(configFileName, cwd), undefined, extraFileExtensions, extendedConfigCache, watchOptionsToExtend);
156216
156464
  }
156217
- function readConfigFile(fileName, readFile27) {
156218
- const textOrDiagnostic = tryReadFile(fileName, readFile27);
156465
+ function readConfigFile(fileName, readFile28) {
156466
+ const textOrDiagnostic = tryReadFile(fileName, readFile28);
156219
156467
  return isString2(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
156220
156468
  }
156221
156469
  function parseConfigFileTextToJson(fileName, jsonText) {
@@ -156225,14 +156473,14 @@ ${lanes.join(`
156225
156473
  error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined
156226
156474
  };
156227
156475
  }
156228
- function readJsonConfigFile(fileName, readFile27) {
156229
- const textOrDiagnostic = tryReadFile(fileName, readFile27);
156476
+ function readJsonConfigFile(fileName, readFile28) {
156477
+ const textOrDiagnostic = tryReadFile(fileName, readFile28);
156230
156478
  return isString2(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
156231
156479
  }
156232
- function tryReadFile(fileName, readFile27) {
156480
+ function tryReadFile(fileName, readFile28) {
156233
156481
  let text13;
156234
156482
  try {
156235
- text13 = readFile27(fileName);
156483
+ text13 = readFile28(fileName);
156236
156484
  } catch (e) {
156237
156485
  return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
156238
156486
  }
@@ -222988,12 +223236,12 @@ ${lanes.join(`
222988
223236
  function createCompilerHost(options, setParentNodes) {
222989
223237
  return createCompilerHostWorker(options, setParentNodes);
222990
223238
  }
222991
- function createGetSourceFile(readFile27, setParentNodes) {
223239
+ function createGetSourceFile(readFile28, setParentNodes) {
222992
223240
  return (fileName, languageVersionOrOptions, onError) => {
222993
223241
  let text13;
222994
223242
  try {
222995
223243
  mark("beforeIORead");
222996
- text13 = readFile27(fileName);
223244
+ text13 = readFile28(fileName);
222997
223245
  mark("afterIORead");
222998
223246
  measure("I/O Read", "beforeIORead", "afterIORead");
222999
223247
  } catch (e) {
@@ -223819,7 +224067,7 @@ ${lanes.join(`
223819
224067
  getSourceOfProjectReferenceRedirect,
223820
224068
  forEachResolvedProjectReference: forEachResolvedProjectReference2
223821
224069
  });
223822
- const readFile27 = host.readFile.bind(host);
224070
+ const readFile28 = host.readFile.bind(host);
223823
224071
  (_e = tracing) == null || _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
223824
224072
  const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
223825
224073
  (_f = tracing) == null || _f.pop();
@@ -223995,7 +224243,7 @@ ${lanes.join(`
223995
224243
  shouldTransformImportCall,
223996
224244
  emitBuildInfo,
223997
224245
  fileExists: fileExists2,
223998
- readFile: readFile27,
224246
+ readFile: readFile28,
223999
224247
  directoryExists: directoryExists2,
224000
224248
  getSymlinkCache,
224001
224249
  realpath: (_o = host.realpath) == null ? undefined : _o.bind(host),
@@ -292094,7 +292342,7 @@ var require_path_browserify = __commonJS(function(exports, module) {
292094
292342
  assertPath(path9);
292095
292343
  return path9.length > 0 && path9.charCodeAt(0) === 47;
292096
292344
  },
292097
- join: function join35() {
292345
+ join: function join36() {
292098
292346
  if (arguments.length === 0)
292099
292347
  return ".";
292100
292348
  var joined;
@@ -348023,16 +348271,16 @@ Node text: ${this.#forgottenText}`;
348023
348271
 
348024
348272
  // studio/server/domain.ts
348025
348273
  import { existsSync as existsSync20, readFileSync as readFileSync12, statSync as statSync8 } from "node:fs";
348026
- import { basename, dirname as dirname18, extname, isAbsolute as isAbsolute3, join as join35, relative as relative4, resolve as resolve11 } from "node:path";
348274
+ import { basename, dirname as dirname18, extname, isAbsolute as isAbsolute3, join as join36, relative as relative4, resolve as resolve11 } from "node:path";
348027
348275
  function makeId(root) {
348028
348276
  return basename(resolve11(root)).replace(/[^a-zA-Z0-9_-]/g, "-") || "domain";
348029
348277
  }
348030
348278
  function resolveApplicationEntry(root) {
348031
348279
  const project2 = resolve11(root);
348032
- const conventional = join35(project2, "application.ts");
348280
+ const conventional = join36(project2, "application.ts");
348033
348281
  if (existsSync20(conventional))
348034
348282
  return conventional;
348035
- const config2 = join35(project2, "astrale.config.ts");
348283
+ const config2 = join36(project2, "astrale.config.ts");
348036
348284
  if (!existsSync20(config2))
348037
348285
  return null;
348038
348286
  let source2;
@@ -348074,7 +348322,7 @@ function resolveSchemaEntry(root, applicationFile) {
348074
348322
  }
348075
348323
  function isDomainDir(root) {
348076
348324
  const project2 = resolve11(root);
348077
- if (!existsSync20(join35(project2, "astrale.config.ts")))
348325
+ if (!existsSync20(join36(project2, "astrale.config.ts")))
348078
348326
  return false;
348079
348327
  const application = resolveApplicationEntry(project2);
348080
348328
  return application !== null && resolveSchemaEntry(project2, application) !== null;
@@ -348082,7 +348330,7 @@ function isDomainDir(root) {
348082
348330
  function registerDomain(root) {
348083
348331
  const project2 = resolve11(root);
348084
348332
  const applicationFile = resolveApplicationEntry(project2);
348085
- if (applicationFile === null || !existsSync20(join35(project2, "astrale.config.ts")))
348333
+ if (applicationFile === null || !existsSync20(join36(project2, "astrale.config.ts")))
348086
348334
  return null;
348087
348335
  const schemaIndex = resolveSchemaEntry(project2, applicationFile);
348088
348336
  if (schemaIndex === null)
@@ -348091,7 +348339,7 @@ function registerDomain(root) {
348091
348339
  const handle = {
348092
348340
  id: makeId(project2),
348093
348341
  root: project2,
348094
- configFile: join35(project2, "astrale.config.ts"),
348342
+ configFile: join36(project2, "astrale.config.ts"),
348095
348343
  applicationFile,
348096
348344
  schemaDirName: relative4(project2, schemaDir).replaceAll("\\", "/") || ".",
348097
348345
  schemaDir,
@@ -348114,7 +348362,7 @@ function allDomains() {
348114
348362
  return [...registry2.values()];
348115
348363
  }
348116
348364
  function depsInstalled(root) {
348117
- if (existsSync20(join35(root, "node_modules", "@astrale-os", "sdk")))
348365
+ if (existsSync20(join36(root, "node_modules", "@astrale-os", "sdk")))
348118
348366
  return true;
348119
348367
  try {
348120
348368
  Bun.resolveSync("@astrale-os/sdk/schema", root);
@@ -348240,8 +348488,8 @@ function sourceCandidates(file2) {
348240
348488
  `${sourceBase}.tsx`,
348241
348489
  `${sourceBase}.mts`,
348242
348490
  `${sourceBase}.cts`,
348243
- join35(file2, "index.ts"),
348244
- join35(file2, "index.tsx")
348491
+ join36(file2, "index.ts"),
348492
+ join36(file2, "index.tsx")
348245
348493
  ];
348246
348494
  }
348247
348495
  function isFile(file2) {
@@ -348336,7 +348584,7 @@ var init_settings2 = __esm(() => {
348336
348584
 
348337
348585
  // studio/server/introspect/anatomy/source.ts
348338
348586
  import { existsSync as existsSync21, readFileSync as readFileSync13, readdirSync as readdirSync8, statSync as statSync9 } from "node:fs";
348339
- import { join as join36 } from "node:path";
348587
+ import { join as join37 } from "node:path";
348340
348588
  function readTextSafe(file2) {
348341
348589
  try {
348342
348590
  return existsSync21(file2) ? readFileSync13(file2, "utf8") : "";
@@ -348348,7 +348596,7 @@ function listFiles(dir) {
348348
348596
  try {
348349
348597
  return readdirSync8(dir).filter((e) => {
348350
348598
  try {
348351
- return statSync9(join36(dir, e)).isFile();
348599
+ return statSync9(join37(dir, e)).isFile();
348352
348600
  } catch {
348353
348601
  return false;
348354
348602
  }
@@ -348361,7 +348609,7 @@ function listDirs(dir) {
348361
348609
  try {
348362
348610
  return readdirSync8(dir).filter((e) => {
348363
348611
  try {
348364
- return statSync9(join36(dir, e)).isDirectory();
348612
+ return statSync9(join37(dir, e)).isDirectory();
348365
348613
  } catch {
348366
348614
  return false;
348367
348615
  }
@@ -348382,7 +348630,7 @@ function listSourceFiles(dir) {
348382
348630
  for (const entry2 of entries) {
348383
348631
  if (SKIP_SOURCE_DIRS.has(entry2))
348384
348632
  continue;
348385
- const file2 = join36(current, entry2);
348633
+ const file2 = join37(current, entry2);
348386
348634
  let stat4;
348387
348635
  try {
348388
348636
  stat4 = statSync9(file2);
@@ -348498,15 +348746,15 @@ var init_source2 = __esm(() => {
348498
348746
 
348499
348747
  // studio/server/introspect/anatomy/client-tree.ts
348500
348748
  import { existsSync as existsSync22 } from "node:fs";
348501
- import { join as join37 } from "node:path";
348502
- function buildClientTree(root, clientDir = join37(root, "client")) {
348503
- const srcDir = clientDir ? join37(clientDir, "src") : existsSync22(join37(root, "ui")) ? join37(root, "ui") : "";
348749
+ import { join as join38 } from "node:path";
348750
+ function buildClientTree(root, clientDir = join38(root, "client")) {
348751
+ const srcDir = clientDir ? join38(clientDir, "src") : existsSync22(join38(root, "ui")) ? join38(root, "ui") : "";
348504
348752
  if (!existsSync22(srcDir)) {
348505
348753
  return { shell: [], features: [], routes: {}, present: false };
348506
348754
  }
348507
- const shell = listFiles(join37(srcDir, "shell"));
348508
- const features = listDirs(srcDir).filter((d) => !RESERVED_CLIENT_DIRS.has(d)).map((name) => ({ name, files: listFiles(join37(srcDir, name)) }));
348509
- const routes = parseRoutes(listFiles(srcDir).filter((file2) => /\.[cm]?[jt]sx?$/.test(file2)).map((file2) => join37(srcDir, file2)));
348755
+ const shell = listFiles(join38(srcDir, "shell"));
348756
+ const features = listDirs(srcDir).filter((d) => !RESERVED_CLIENT_DIRS.has(d)).map((name) => ({ name, files: listFiles(join38(srcDir, name)) }));
348757
+ const routes = parseRoutes(listFiles(srcDir).filter((file2) => /\.[cm]?[jt]sx?$/.test(file2)).map((file2) => join38(srcDir, file2)));
348510
348758
  return { shell, features, routes, present: true };
348511
348759
  }
348512
348760
  function parseRoutes(files) {
@@ -348529,7 +348777,7 @@ var init_client_tree = __esm(() => {
348529
348777
 
348530
348778
  // studio/server/introspect/anatomy/env-fields.ts
348531
348779
  import { existsSync as existsSync23 } from "node:fs";
348532
- import { join as join38 } from "node:path";
348780
+ import { join as join39 } from "node:path";
348533
348781
  function cleanDoc(raw2) {
348534
348782
  if (!raw2)
348535
348783
  return;
@@ -348539,7 +348787,7 @@ function cleanDoc(raw2) {
348539
348787
  return text13.length ? text13 : undefined;
348540
348788
  }
348541
348789
  function buildEnvFields(root) {
348542
- const envFile = join38(root, "env.ts");
348790
+ const envFile = join39(root, "env.ts");
348543
348791
  if (!existsSync23(envFile))
348544
348792
  return [];
348545
348793
  let project2;
@@ -348581,10 +348829,10 @@ var init_env_fields = __esm(() => {
348581
348829
  });
348582
348830
 
348583
348831
  // studio/server/introspect/anatomy/schema-definition.ts
348584
- import { join as join39 } from "node:path";
348832
+ import { join as join40 } from "node:path";
348585
348833
  function schemaProject(root, schemaDirName) {
348586
348834
  const project2 = makeProject();
348587
- return listSourceFiles(join39(root, schemaDirName)).map((file2) => addSource(project2, file2)).filter((source2) => source2 !== null);
348835
+ return listSourceFiles(join40(root, schemaDirName)).map((file2) => addSource(project2, file2)).filter((source2) => source2 !== null);
348588
348836
  }
348589
348837
  function defineSchemaCalls(source2) {
348590
348838
  return source2.getDescendantsOfKind(import_ts_morph4.SyntaxKind.CallExpression).filter((call3) => {
@@ -348615,7 +348863,7 @@ var init_schema_definition = __esm(() => {
348615
348863
  });
348616
348864
 
348617
348865
  // studio/server/introspect/anatomy/views/routes.ts
348618
- import { join as join40, relative as relative5 } from "node:path";
348866
+ import { join as join41, relative as relative5 } from "node:path";
348619
348867
  function buildSchemaViewSources(root, schemaDirName) {
348620
348868
  const sources2 = new Map;
348621
348869
  for (const source2 of schemaProject(root, schemaDirName)) {
@@ -348651,7 +348899,7 @@ function buildFrontendViews(root, canonicalViewNames) {
348651
348899
  const project2 = makeProject();
348652
348900
  const application = resolveApplicationEntry(root);
348653
348901
  const applicationFiles = application === null ? [] : [application];
348654
- const sources2 = [...new Set([...listSourceFiles(join40(root, "views")), ...applicationFiles])].map((file2) => addSource(project2, file2)).filter((source2) => source2 !== null);
348902
+ const sources2 = [...new Set([...listSourceFiles(join41(root, "views")), ...applicationFiles])].map((file2) => addSource(project2, file2)).filter((source2) => source2 !== null);
348655
348903
  const views = [];
348656
348904
  for (const source2 of sources2) {
348657
348905
  for (const call3 of source2.getDescendantsOfKind(import_ts_morph5.SyntaxKind.CallExpression)) {
@@ -348751,7 +348999,7 @@ var init_anatomy_extras = __esm(() => {
348751
348999
 
348752
349000
  // studio/server/introspect/config-preview.ts
348753
349001
  import { readFileSync as readFileSync14 } from "node:fs";
348754
- import { join as join41 } from "node:path";
349002
+ import { join as join42 } from "node:path";
348755
349003
  function withoutComments(source2) {
348756
349004
  let output3 = "";
348757
349005
  let quote = null;
@@ -348848,7 +349096,7 @@ function parseConfigPreview(source2) {
348848
349096
  }
348849
349097
  function readConfigPreview(root) {
348850
349098
  try {
348851
- return parseConfigPreview(readFileSync14(join41(root, "astrale.config.ts"), "utf8"));
349099
+ return parseConfigPreview(readFileSync14(join42(root, "astrale.config.ts"), "utf8"));
348852
349100
  } catch {
348853
349101
  return { adapter: "unknown", configuredSecretFiles: [] };
348854
349102
  }
@@ -348857,7 +349105,7 @@ var init_config_preview = () => {};
348857
349105
 
348858
349106
  // studio/server/introspect/anatomy.ts
348859
349107
  import { existsSync as existsSync24, readFileSync as readFileSync15, readdirSync as readdirSync9, statSync as statSync10 } from "node:fs";
348860
- import { join as join42, relative as relative6 } from "node:path";
349108
+ import { join as join43, relative as relative6 } from "node:path";
348861
349109
  function buildAnatomy({
348862
349110
  root,
348863
349111
  schemaDirName,
@@ -348865,7 +349113,7 @@ function buildAnatomy({
348865
349113
  canonicalViews
348866
349114
  }) {
348867
349115
  const schema2 = findSchemaDefinition(root, schemaDirName);
348868
- const authoredClientDir = clientDir ?? (existsSync24(join42(root, "ui")) ? join42(root, "ui") : undefined);
349116
+ const authoredClientDir = clientDir ?? (existsSync24(join43(root, "ui")) ? join43(root, "ui") : undefined);
348869
349117
  return {
348870
349118
  overview: buildOverview(root, schemaDirName, authoredClientDir, schema2?.origin),
348871
349119
  views: buildViews(root, schemaDirName, canonicalViews),
@@ -348875,7 +349123,7 @@ function buildAnatomy({
348875
349123
  };
348876
349124
  }
348877
349125
  function buildOverview(root, schemaDirName, clientDir, schemaOrigin) {
348878
- const pkg = readPackageJsonSafe(join42(root, "package.json"));
349126
+ const pkg = readPackageJsonSafe(join43(root, "package.json"));
348879
349127
  const astraleDeps = {};
348880
349128
  for (const [k, v] of Object.entries({
348881
349129
  ...pkg?.dependencies ?? {},
@@ -348887,7 +349135,7 @@ function buildOverview(root, schemaDirName, clientDir, schemaOrigin) {
348887
349135
  const config2 = readConfigPreview(root);
348888
349136
  const application = resolveApplicationEntry(root);
348889
349137
  const applicationSrc = application === null ? "" : readTextSafe2(application);
348890
- const origin2 = schemaOrigin ?? applicationSrc.match(/defineSchema\(\s*['"]([^'"]+)['"]/)?.[1] ?? readTextSafe2(join42(root, schemaDirName, "index.ts")).match(/defineSchema\(\s*['"]([^'"]+)['"]/)?.[1] ?? "";
349138
+ const origin2 = schemaOrigin ?? applicationSrc.match(/defineSchema\(\s*['"]([^'"]+)['"]/)?.[1] ?? readTextSafe2(join43(root, schemaDirName, "index.ts")).match(/defineSchema\(\s*['"]([^'"]+)['"]/)?.[1] ?? "";
348891
349139
  return {
348892
349140
  origin: origin2,
348893
349141
  applicationFile: application === null ? undefined : relative6(root, application).replaceAll("\\", "/"),
@@ -348903,13 +349151,13 @@ function buildOverview(root, schemaDirName, clientDir, schemaOrigin) {
348903
349151
  };
348904
349152
  }
348905
349153
  function detectIntegrations(root) {
348906
- const dir = join42(root, readSettings(root).integrationsDir);
349154
+ const dir = join43(root, readSettings(root).integrationsDir);
348907
349155
  if (!existsSync24(dir))
348908
349156
  return [];
348909
349157
  try {
348910
349158
  return readdirSync9(dir).filter((e) => {
348911
349159
  try {
348912
- return statSync10(join42(dir, e)).isDirectory();
349160
+ return statSync10(join43(dir, e)).isDirectory();
348913
349161
  } catch {
348914
349162
  return false;
348915
349163
  }
@@ -349224,7 +349472,7 @@ var init_project4 = __esm(() => {
349224
349472
 
349225
349473
  // studio/server/introspect/source-overlay/handlers.ts
349226
349474
  import { readdirSync as readdirSync10 } from "node:fs";
349227
- import { join as join43 } from "node:path";
349475
+ import { join as join44 } from "node:path";
349228
349476
  function authoredTypeScriptFiles(root) {
349229
349477
  const files = [];
349230
349478
  const visit4 = (directory) => {
@@ -349237,7 +349485,7 @@ function authoredTypeScriptFiles(root) {
349237
349485
  for (const entry2 of entries) {
349238
349486
  if (entry2.isSymbolicLink())
349239
349487
  continue;
349240
- const path9 = join43(directory, entry2.name);
349488
+ const path9 = join44(directory, entry2.name);
349241
349489
  if (entry2.isDirectory()) {
349242
349490
  if (!IGNORED_DIRECTORIES.has(entry2.name))
349243
349491
  visit4(path9);
@@ -350369,7 +350617,7 @@ function structuralStatusOf(changes) {
350369
350617
  // studio/server/state/baseline.ts
350370
350618
  import { createHash as createHash8 } from "node:crypto";
350371
350619
  import { existsSync as existsSync27, readFileSync as readFileSync17, readdirSync as readdirSync11, statSync as statSync11 } from "node:fs";
350372
- import { join as join44, relative as relative8, resolve as resolve12 } from "node:path";
350620
+ import { join as join45, relative as relative8, resolve as resolve12 } from "node:path";
350373
350621
  function sha2562(buf) {
350374
350622
  return createHash8("sha256").update(buf).digest("hex");
350375
350623
  }
@@ -350383,7 +350631,7 @@ function walkFiles(dir, out) {
350383
350631
  for (const e of entries) {
350384
350632
  if (SKIP_DIRS.has(e))
350385
350633
  continue;
350386
- const full = join44(dir, e);
350634
+ const full = join45(dir, e);
350387
350635
  let st;
350388
350636
  try {
350389
350637
  st = statSync11(full);
@@ -350400,7 +350648,7 @@ function hashAnatomyFiles(root, schemaDirName, applicationFile) {
350400
350648
  const r = resolve12(root);
350401
350649
  const absFiles = [];
350402
350650
  for (const d of [schemaDirName, ...ANATOMY_GLOBS.dirs]) {
350403
- const abs = join44(r, d);
350651
+ const abs = join45(r, d);
350404
350652
  if (existsSync27(abs)) {
350405
350653
  let st;
350406
350654
  try {
@@ -350415,7 +350663,7 @@ function hashAnatomyFiles(root, schemaDirName, applicationFile) {
350415
350663
  }
350416
350664
  }
350417
350665
  for (const f of ANATOMY_GLOBS.files) {
350418
- const abs = join44(r, f);
350666
+ const abs = join45(r, f);
350419
350667
  if (existsSync27(abs)) {
350420
350668
  try {
350421
350669
  if (statSync11(abs).isFile())
@@ -350610,7 +350858,7 @@ var init_baseline = __esm(() => {
350610
350858
  // studio/server/cache.ts
350611
350859
  import { createHash as createHash9 } from "node:crypto";
350612
350860
  import { existsSync as existsSync28, readFileSync as readFileSync18 } from "node:fs";
350613
- import { join as join45, relative as relative9 } from "node:path";
350861
+ import { join as join46, relative as relative9 } from "node:path";
350614
350862
  function isHandlerLink(value3) {
350615
350863
  const record14 = asJsonRecord(value3);
350616
350864
  return typeof record14?.owner === "string" && ["class", "function"].includes(String(record14.ownerKind)) && ["action", "workflow"].includes(String(record14.kind)) && typeof record14.method === "string" && typeof record14.static === "boolean" && typeof record14.implemented === "boolean";
@@ -350701,10 +350949,10 @@ function bundleCacheKey(root, schemaDirName, applicationFile) {
350701
350949
  hash2.update(`${file2}\x00${digest7}\x00`);
350702
350950
  }
350703
350951
  for (const file2 of LOCKFILES)
350704
- hashFileIfPresent(hash2, file2, join45(root, file2));
350952
+ hashFileIfPresent(hash2, file2, join46(root, file2));
350705
350953
  const serverRoot = import.meta.dir;
350706
350954
  for (const file2 of TOOL_INPUTS) {
350707
- const abs = join45(serverRoot, file2);
350955
+ const abs = join46(serverRoot, file2);
350708
350956
  hashFileIfPresent(hash2, `tool:${relative9(serverRoot, abs)}`, abs);
350709
350957
  }
350710
350958
  return hash2.digest("hex");
@@ -351147,7 +351395,7 @@ var init_token3 = __esm(() => {
351147
351395
  // studio/server/agent/harness/gateway/config.ts
351148
351396
  import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as mkdirSync8, readFileSync as readFileSync19, rmSync as rmSync4, writeFileSync as writeFileSync8 } from "node:fs";
351149
351397
  import { homedir as homedir9 } from "node:os";
351150
- import { dirname as dirname20, join as join46 } from "node:path";
351398
+ import { dirname as dirname20, join as join47 } from "node:path";
351151
351399
  function normalizeAuth(input) {
351152
351400
  const record14 = asJsonRecord(input);
351153
351401
  if (record14?.mode === "token" || record14?.token != null && record14?.mode == null)
@@ -351231,7 +351479,7 @@ function setHarnessGateway(root, input) {
351231
351479
  removeState(root, LOCAL_FILE);
351232
351480
  } else {
351233
351481
  writeJson2(root, LOCAL_FILE, cfg);
351234
- chmodSync3(statePath(root, LOCAL_FILE), 384);
351482
+ chmodSync3(statePath2(root, LOCAL_FILE), 384);
351235
351483
  }
351236
351484
  return getHarnessGatewayState(root);
351237
351485
  }
@@ -351290,13 +351538,13 @@ var LOCAL_FILE = "harness-gateway.json", GLOBAL_FILE;
351290
351538
  var init_config2 = __esm(() => {
351291
351539
  init_store2();
351292
351540
  init_token3();
351293
- GLOBAL_FILE = join46(homedir9(), ".domain-studio", "harness-gateway.json");
351541
+ GLOBAL_FILE = join47(homedir9(), ".domain-studio", "harness-gateway.json");
351294
351542
  });
351295
351543
 
351296
351544
  // studio/server/agent/harness/skills.ts
351297
351545
  import { existsSync as existsSync30, readdirSync as readdirSync12, readFileSync as readFileSync20 } from "node:fs";
351298
351546
  import { homedir as homedir10 } from "node:os";
351299
- import { dirname as dirname21, join as join47 } from "node:path";
351547
+ import { dirname as dirname21, join as join48 } from "node:path";
351300
351548
  function readSkillMeta(skillMd) {
351301
351549
  let text13;
351302
351550
  try {
@@ -351329,7 +351577,7 @@ function scanSkillDir(dir, source2, plugin, commandPrefix, loaded, out, seen) {
351329
351577
  return;
351330
351578
  }
351331
351579
  for (const entry2 of entries) {
351332
- const skillMd = join47(dir, entry2, "SKILL.md");
351580
+ const skillMd = join48(dir, entry2, "SKILL.md");
351333
351581
  if (!existsSync30(skillMd))
351334
351582
  continue;
351335
351583
  const command = commandPrefix + entry2;
@@ -351353,7 +351601,7 @@ function scanAncestors(root, dirs, out, seen) {
351353
351601
  let current = root;
351354
351602
  for (let i = 0;i < 12 && current !== home; i++) {
351355
351603
  for (const dir of dirs)
351356
- scanSkillDir(join47(current, dir), "project", undefined, "", true, out, seen);
351604
+ scanSkillDir(join48(current, dir), "project", undefined, "", true, out, seen);
351357
351605
  const parent = dirname21(current);
351358
351606
  if (parent === current)
351359
351607
  break;
@@ -351604,7 +351852,7 @@ function writeClaudeMcpConfig(root, servers) {
351604
351852
  ]))
351605
351853
  });
351606
351854
  return {
351607
- path: statePath(root, rel),
351855
+ path: statePath2(root, rel),
351608
351856
  dispose: () => {
351609
351857
  try {
351610
351858
  removeState(root, rel);
@@ -351826,9 +352074,9 @@ var init_events = __esm(() => {
351826
352074
  // studio/server/agent/harness/claude/skills.ts
351827
352075
  import { readFileSync as readFileSync21 } from "node:fs";
351828
352076
  import { homedir as homedir11 } from "node:os";
351829
- import { join as join48 } from "node:path";
352077
+ import { join as join49 } from "node:path";
351830
352078
  function installedPluginDirs() {
351831
- const file2 = join48(homedir11(), ".claude", "plugins", "installed_plugins.json");
352079
+ const file2 = join49(homedir11(), ".claude", "plugins", "installed_plugins.json");
351832
352080
  let parsed;
351833
352081
  try {
351834
352082
  parsed = JSON.parse(readFileSync21(file2, "utf8"));
@@ -351854,10 +352102,10 @@ function scanClaudeSkills(root) {
351854
352102
  const seen = new Set;
351855
352103
  const home = homedir11();
351856
352104
  scanAncestors(root, [".claude/skills", ".agents/skills"], out, seen);
351857
- scanSkillDir(join48(home, ".claude", "skills"), "user", undefined, "", true, out, seen);
351858
- scanSkillDir(join48(home, ".agents", "skills"), "user", undefined, "", true, out, seen);
352105
+ scanSkillDir(join49(home, ".claude", "skills"), "user", undefined, "", true, out, seen);
352106
+ scanSkillDir(join49(home, ".agents", "skills"), "user", undefined, "", true, out, seen);
351859
352107
  for (const { plugin, installPath } of installedPluginDirs())
351860
- scanSkillDir(join48(installPath, "skills"), "plugin", plugin, `${plugin}:`, true, out, seen);
352108
+ scanSkillDir(join49(installPath, "skills"), "plugin", plugin, `${plugin}:`, true, out, seen);
351861
352109
  return out;
351862
352110
  }
351863
352111
  var init_skills4 = __esm(() => {
@@ -352620,16 +352868,16 @@ var init_models = __esm(() => {
352620
352868
 
352621
352869
  // studio/server/agent/harness/codex/skills.ts
352622
352870
  import { homedir as homedir12 } from "node:os";
352623
- import { join as join49 } from "node:path";
352871
+ import { join as join50 } from "node:path";
352624
352872
  function scanCodexSkills(root, plugins) {
352625
352873
  const out = [];
352626
352874
  const seen = new Set;
352627
352875
  const home = homedir12();
352628
352876
  scanAncestors(root, [".agents/skills", ".codex/skills"], out, seen);
352629
- scanSkillDir(join49(home, ".agents", "skills"), "user", undefined, "", true, out, seen);
352630
- scanSkillDir(join49(home, ".codex", "skills"), "user", undefined, "", true, out, seen);
352877
+ scanSkillDir(join50(home, ".agents", "skills"), "user", undefined, "", true, out, seen);
352878
+ scanSkillDir(join50(home, ".codex", "skills"), "user", undefined, "", true, out, seen);
352631
352879
  for (const plugin of plugins)
352632
- scanSkillDir(join49(plugin.path, "skills"), "plugin", plugin.name, `${plugin.name}:`, plugin.enabled, out, seen);
352880
+ scanSkillDir(join50(plugin.path, "skills"), "plugin", plugin.name, `${plugin.name}:`, plugin.enabled, out, seen);
352633
352881
  return out;
352634
352882
  }
352635
352883
  var init_skills5 = __esm(() => {
@@ -352773,7 +353021,7 @@ var init_adapter2 = __esm(() => {
352773
353021
 
352774
353022
  // studio/server/agent/harness/mock/domain-edit.ts
352775
353023
  import { existsSync as existsSync31, readFileSync as readFileSync22, readdirSync as readdirSync13, writeFileSync as writeFileSync9 } from "node:fs";
352776
- import { join as join50 } from "node:path";
353024
+ import { join as join51 } from "node:path";
352777
353025
  function identifier(text14, fallback) {
352778
353026
  const words = text14.toLowerCase().replace(/[^a-z0-9 ]+/g, " ").trim().split(/\s+/).filter(Boolean).slice(0, 3);
352779
353027
  if (words.length === 0)
@@ -352781,13 +353029,13 @@ function identifier(text14, fallback) {
352781
353029
  return words.map((word, index3) => index3 === 0 ? word : word[0].toUpperCase() + word.slice(1)).join("");
352782
353030
  }
352783
353031
  function applyMockDomainEdit(root, instruction) {
352784
- const schemaDir = join50(root, "schema");
353032
+ const schemaDir = join51(root, "schema");
352785
353033
  if (!existsSync31(schemaDir))
352786
353034
  return null;
352787
353035
  const files = readdirSync13(schemaDir).filter((file2) => file2.endsWith(".ts") && file2 !== "index.ts");
352788
353036
  const propName = identifier(instruction, "agentNote");
352789
353037
  for (const file2 of files) {
352790
- const absolute = join50(schemaDir, file2);
353038
+ const absolute = join51(schemaDir, file2);
352791
353039
  const source2 = readFileSync22(absolute, "utf8");
352792
353040
  const props4 = source2.indexOf("props: {");
352793
353041
  if (props4 < 0)
@@ -354068,7 +354316,7 @@ function uniqueStoredPath(root, docs, name) {
354068
354316
  const taken = new Set(docs.map((doc2) => doc2.stored));
354069
354317
  for (let attempt = 0;; attempt++) {
354070
354318
  const candidate2 = `${DIR}/${slug}${attempt === 0 ? "" : `-${attempt + 1}`}${extension}`;
354071
- if (!taken.has(candidate2) && !existsSync33(statePath(root, candidate2)))
354319
+ if (!taken.has(candidate2) && !existsSync33(statePath2(root, candidate2)))
354072
354320
  return candidate2;
354073
354321
  }
354074
354322
  }
@@ -354080,7 +354328,7 @@ function migrateDocuments(root) {
354080
354328
  for (const doc2 of docs) {
354081
354329
  if (!doc2.stored.startsWith(`${LEGACY_DIR}/`))
354082
354330
  continue;
354083
- const from2 = statePath(root, doc2.stored);
354331
+ const from2 = statePath2(root, doc2.stored);
354084
354332
  if (!existsSync33(from2))
354085
354333
  continue;
354086
354334
  const next = uniqueStoredPath(root, docs, doc2.name);
@@ -354165,7 +354413,7 @@ function readDocument2(root, id) {
354165
354413
  const doc2 = listDocuments(root).find((d) => d.id === id);
354166
354414
  if (!doc2)
354167
354415
  return null;
354168
- const abs = statePath(root, doc2.stored);
354416
+ const abs = statePath2(root, doc2.stored);
354169
354417
  if (!existsSync33(abs))
354170
354418
  return null;
354171
354419
  return { meta: doc2, abs };
@@ -355094,10 +355342,10 @@ var init_deploy_record = __esm(() => {
355094
355342
 
355095
355343
  // studio/server/instances/deploy.ts
355096
355344
  import { readFileSync as readFileSync24 } from "node:fs";
355097
- import { join as join51 } from "node:path";
355345
+ import { join as join52 } from "node:path";
355098
355346
  function hasProdScript(root) {
355099
355347
  try {
355100
- const pkg = JSON.parse(readFileSync24(join51(root, "package.json"), "utf8"));
355348
+ const pkg = JSON.parse(readFileSync24(join52(root, "package.json"), "utf8"));
355101
355349
  return typeof pkg?.scripts?.prod === "string";
355102
355350
  } catch {
355103
355351
  return false;
@@ -355429,10 +355677,10 @@ function parseDotenvPreview(contents) {
355429
355677
 
355430
355678
  // studio/server/environment/files.ts
355431
355679
  import { existsSync as existsSync34, readFileSync as readFileSync25, writeFileSync as writeFileSync10 } from "node:fs";
355432
- import { join as join52, resolve as resolve14 } from "node:path";
355680
+ import { join as join53, resolve as resolve14 } from "node:path";
355433
355681
  function readEnvModel(root, env2) {
355434
355682
  const file2 = envFileName(env2);
355435
- const abs = join52(root, file2);
355683
+ const abs = join53(root, file2);
355436
355684
  const exists4 = existsSync34(abs);
355437
355685
  const values = exists4 ? parseDotenvPreview(readFileSync25(abs, "utf8")) : {};
355438
355686
  const declared = buildEnvFields(root).filter((f) => f.secret);
@@ -355500,7 +355748,7 @@ function applyUpdates2(contents, updates) {
355500
355748
  `);
355501
355749
  }
355502
355750
  function writeEnvUpdates(root, env2, updates) {
355503
- const abs = join52(root, envFileName(env2));
355751
+ const abs = join53(root, envFileName(env2));
355504
355752
  if (!resolve14(abs).startsWith(resolve14(root)))
355505
355753
  throw new Error("refused: path escapes the domain root");
355506
355754
  const prior = existsSync34(abs) ? readFileSync25(abs, "utf8") : SCAFFOLD_HEADER(env2);
@@ -357832,7 +358080,7 @@ var init_sse = __esm(() => {
357832
358080
  });
357833
358081
 
357834
358082
  // studio/server/watch.ts
357835
- import { join as join55, relative as relative13 } from "node:path";
358083
+ import { join as join56, relative as relative13 } from "node:path";
357836
358084
  function ignored(p) {
357837
358085
  return p.includes("node_modules") || p.includes(".domain-studio") || p.includes(".astrale") || p.includes(".dist");
357838
358086
  }
@@ -357846,7 +358094,7 @@ function watchDomain(handle) {
357846
358094
  ignoreInitial: true,
357847
358095
  ignored
357848
358096
  });
357849
- const anatomyW = esm_default.watch(ANATOMY_PATHS.map((p) => join55(handle.root, p)), { ignoreInitial: true, ignored });
358097
+ const anatomyW = esm_default.watch(ANATOMY_PATHS.map((p) => join56(handle.root, p)), { ignoreInitial: true, ignored });
357850
358098
  let st;
357851
358099
  let at;
357852
358100
  schemaW.on("all", () => {
@@ -357935,7 +358183,7 @@ var init_workspace_state = __esm(() => {
357935
358183
 
357936
358184
  // studio/server/workspace/create.ts
357937
358185
  import { existsSync as existsSync35, readFileSync as readFileSync26, writeFileSync as writeFileSync11 } from "node:fs";
357938
- import { join as join56 } from "node:path";
358186
+ import { join as join57 } from "node:path";
357939
358187
  async function run2(cmd, args, cwd) {
357940
358188
  try {
357941
358189
  const proc = Bun.spawn([cmd, ...args], {
@@ -357967,7 +358215,7 @@ async function createDomain2(rawName, instance) {
357967
358215
  const root = workspaceRoot();
357968
358216
  if (!root)
357969
358217
  return { ok: false, error: "No workspace root is configured.", output: "" };
357970
- const dir = join56(root, name);
358218
+ const dir = join57(root, name);
357971
358219
  if (existsSync35(dir)) {
357972
358220
  return {
357973
358221
  ok: false,
@@ -358132,7 +358380,7 @@ var init_api2 = __esm(() => {
358132
358380
 
358133
358381
  // studio/server/detect.ts
358134
358382
  import { existsSync as existsSync36, lstatSync as lstatSync3, readdirSync as readdirSync14 } from "node:fs";
358135
- import { dirname as dirname25, join as join57, resolve as resolve17 } from "node:path";
358383
+ import { dirname as dirname25, join as join58, resolve as resolve17 } from "node:path";
358136
358384
  function resolveTarget2(target2) {
358137
358385
  const abs = resolve17(target2);
358138
358386
  if (abs.endsWith("astrale.config.ts")) {
@@ -358166,7 +358414,7 @@ function scanWorkspace(workspace2, maxDepth = 4) {
358166
358414
  for (const e of entries) {
358167
358415
  if (IGNORE.has(e) || e.startsWith("."))
358168
358416
  continue;
358169
- const full = join57(dir, e);
358417
+ const full = join58(dir, e);
358170
358418
  let st;
358171
358419
  try {
358172
358420
  st = lstatSync3(full);
@@ -358298,16 +358546,16 @@ var init_workspace_watch = __esm(() => {
358298
358546
  // studio/server/index.ts
358299
358547
  var exports_server = {};
358300
358548
  import { existsSync as existsSync37, statSync as statSync12 } from "node:fs";
358301
- import { dirname as dirname26, join as join58, resolve as resolve18 } from "node:path";
358549
+ import { dirname as dirname26, join as join59, resolve as resolve18 } from "node:path";
358302
358550
  function serveStatic(pathname) {
358303
358551
  const rel = pathname === "/" ? "index.html" : pathname.replace(/^\//, "");
358304
- const file2 = join58(DIST, rel);
358552
+ const file2 = join59(DIST, rel);
358305
358553
  if (existsSync37(file2) && !file2.endsWith("/") && rel !== "index.html") {
358306
358554
  return new Response(Bun.file(file2), {
358307
358555
  headers: { "cache-control": "public, max-age=31536000, immutable" }
358308
358556
  });
358309
358557
  }
358310
- const index3 = join58(DIST, "index.html");
358558
+ const index3 = join59(DIST, "index.html");
358311
358559
  if (existsSync37(index3))
358312
358560
  return new Response(Bun.file(index3), {
358313
358561
  headers: { "content-type": "text/html", "cache-control": "no-store" }
@@ -358369,7 +358617,7 @@ var init_server2 = __esm(async () => {
358369
358617
  initWorkspaceState(watchRoot);
358370
358618
  if (existsSync37(watchRoot) && statSync12(watchRoot).isDirectory())
358371
358619
  watchWorkspace(watchRoot, stoppers);
358372
- DIST = process.env.DOMAIN_STUDIO_DIST || join58(import.meta.dir, "..", "client", "dist");
358620
+ DIST = process.env.DOMAIN_STUDIO_DIST || join59(import.meta.dir, "..", "client", "dist");
358373
358621
  DEV = process.env.DOMAIN_STUDIO_DEV === "1";
358374
358622
  VITE = process.env.VITE_URL || "http://localhost:5173";
358375
358623
  HOST = process.env.DOMAIN_STUDIO_HOST || "127.0.0.1";
@@ -358418,22 +358666,22 @@ var init_server2 = __esm(async () => {
358418
358666
  // studio/server/introspect/extractor.ts
358419
358667
  var exports_extractor = {};
358420
358668
  import { existsSync as existsSync38 } from "node:fs";
358421
- import { mkdtemp as mkdtemp3, readFile as readFile27, rm as rm9, writeFile as writeFile10 } from "node:fs/promises";
358669
+ import { mkdtemp as mkdtemp3, readFile as readFile28, rm as rm10, writeFile as writeFile10 } from "node:fs/promises";
358422
358670
  import { createRequire as createRequire2 } from "node:module";
358423
358671
  import { tmpdir as tmpdir2 } from "node:os";
358424
- import { dirname as dirname27, join as join59 } from "node:path";
358672
+ import { dirname as dirname27, join as join60 } from "node:path";
358425
358673
  import { pathToFileURL } from "node:url";
358426
358674
  async function installedSdkSchema(root) {
358427
358675
  let directory = root;
358428
358676
  for (;; ) {
358429
- const packageRoot = join59(directory, "node_modules", "@astrale-os", "sdk");
358430
- const manifestPath = join59(packageRoot, "package.json");
358677
+ const packageRoot = join60(directory, "node_modules", "@astrale-os", "sdk");
358678
+ const manifestPath = join60(packageRoot, "package.json");
358431
358679
  if (existsSync38(manifestPath)) {
358432
- const manifest = JSON.parse(await readFile27(manifestPath, "utf8"));
358680
+ const manifest = JSON.parse(await readFile28(manifestPath, "utf8"));
358433
358681
  const exported = manifest.exports?.["./schema"];
358434
358682
  const target3 = typeof exported === "string" ? exported : exported?.import ?? exported?.default ?? exported?.types;
358435
358683
  if (target3)
358436
- return join59(packageRoot, target3);
358684
+ return join60(packageRoot, target3);
358437
358685
  throw new Error(`${manifestPath} does not export @astrale-os/sdk/schema`);
358438
358686
  }
358439
358687
  const parent = dirname27(directory);
@@ -358457,10 +358705,10 @@ function buildFailure(cause) {
358457
358705
  async function main() {
358458
358706
  if (!schemaPath)
358459
358707
  throw new Error("extractor: missing <schemaPath>");
358460
- const temporary = await mkdtemp3(join59(tmpdir2(), "astrale-studio-extractor-"));
358708
+ const temporary = await mkdtemp3(join60(tmpdir2(), "astrale-studio-extractor-"));
358461
358709
  try {
358462
358710
  const sdkPath = await installedSdkSchema(projectRoot);
358463
- const wrapper = join59(temporary, "entry.ts");
358711
+ const wrapper = join60(temporary, "entry.ts");
358464
358712
  await writeFile10(wrapper, `import * as authored from ${JSON.stringify(schemaPath)};
358465
358713
  ` + `import * as sdk from ${JSON.stringify(sdkPath)};
358466
358714
  ` + `export { authored, sdk };
@@ -358488,7 +358736,7 @@ async function main() {
358488
358736
  throw new Error("schema bundle produced no entrypoint");
358489
358737
  const source2 = await output3.text();
358490
358738
  const module = { exports: {} };
358491
- const require2 = createRequire2(pathToFileURL(join59(projectRoot, "package.json")));
358739
+ const require2 = createRequire2(pathToFileURL(join60(projectRoot, "package.json")));
358492
358740
  const factory = new Function(`return (
358493
358741
  ${source2}
358494
358742
  );`)();
@@ -358509,7 +358757,7 @@ ${source2}
358509
358757
  revision: extraction.revision
358510
358758
  }));
358511
358759
  } finally {
358512
- await rm9(temporary, { recursive: true, force: true });
358760
+ await rm10(temporary, { recursive: true, force: true });
358513
358761
  }
358514
358762
  }
358515
358763
  var schemaPath, projectRoot;
@@ -358900,14 +359148,14 @@ init_proc();
358900
359148
  init_prompt();
358901
359149
  init_skills();
358902
359150
  init_update();
358903
- import { readFile as readFile9, rm as rm5 } from "node:fs/promises";
358904
- import { join as join9 } from "node:path";
359151
+ import { readFile as readFile10, rm as rm6 } from "node:fs/promises";
359152
+ import { join as join10 } from "node:path";
358905
359153
  var CACHE_VERSION = 1;
358906
359154
  var CACHE_TTL_MS = 24 * 60 * 60 * 1000;
358907
359155
  var CHECK_TIMEOUT_MS = 4000;
358908
359156
  var REEXEC_ENV = "ASTRALE_UPDATE_REEXEC";
358909
359157
  function cachePath() {
358910
- return join9(paths2.home, "update-notice.json");
359158
+ return join10(paths2.home, "update-notice.json");
358911
359159
  }
358912
359160
  function parseCache(value) {
358913
359161
  if (!value || typeof value !== "object")
@@ -358920,7 +359168,7 @@ function parseCache(value) {
358920
359168
  }
358921
359169
  async function readCache() {
358922
359170
  try {
358923
- return parseCache(JSON.parse(await readFile9(cachePath(), "utf8")));
359171
+ return parseCache(JSON.parse(await readFile10(cachePath(), "utf8")));
358924
359172
  } catch {
358925
359173
  return;
358926
359174
  }
@@ -359015,14 +359263,14 @@ async function updateAndReexec(release, argv) {
359015
359263
  return false;
359016
359264
  log.step(`Updating Astrale ${release.currentVersion} → ${release.latestVersion}`);
359017
359265
  const environment = { ...process.env, [REEXEC_ENV]: "1" };
359018
- const updated = await runInherit(execution.executable, ["update", "--yes", "--no-deps"], {
359266
+ const updated = await runInherit(execution.executable, ["update", "--no-deps"], {
359019
359267
  env: environment
359020
359268
  });
359021
359269
  if (updated !== 0) {
359022
359270
  log.warn("Automatic update did not complete; continuing with the current command.");
359023
359271
  return false;
359024
359272
  }
359025
- await rm5(cachePath(), { force: true }).catch(() => {
359273
+ await rm6(cachePath(), { force: true }).catch(() => {
359026
359274
  return;
359027
359275
  });
359028
359276
  const resumed = await runInherit(execution.executable, argv.slice(2), { env: environment });
@@ -359051,6 +359299,15 @@ async function offerReleaseUpdate(argv) {
359051
359299
  }
359052
359300
  async function offerSkillMaintenance() {
359053
359301
  const state2 = await checkAstraleSkills();
359302
+ if (state2.installed === false) {
359303
+ const { configureAstraleSkills: configureAstraleSkills2, renderSkillConfigureOutcome: renderSkillConfigureOutcome2 } = await Promise.resolve().then(() => (init_configure(), exports_configure));
359304
+ try {
359305
+ renderSkillConfigureOutcome2(await configureAstraleSkills2({ source: "reminder" }));
359306
+ } catch (error52) {
359307
+ log.warn(`Skill configuration could not be offered; run \`astrale skills configure\`. ${error52 instanceof Error ? error52.message : String(error52)}`);
359308
+ }
359309
+ return;
359310
+ }
359054
359311
  if (state2.status !== "update-available" && state2.status !== "repair-needed")
359055
359312
  return;
359056
359313
  const label = state2.status === "repair-needed" ? "need repair" : "have an update available";
@@ -359146,7 +359403,15 @@ function registerCommand(parent, def) {
359146
359403
  }
359147
359404
  if (def.options) {
359148
359405
  for (const opt of def.options) {
359149
- if (opt.choices) {
359406
+ if (opt.hidden) {
359407
+ const o = new Option2(opt.flags, opt.description);
359408
+ if (opt.choices)
359409
+ o.choices(opt.choices);
359410
+ if (opt.default !== undefined)
359411
+ o.default(opt.default);
359412
+ o.hideHelp();
359413
+ cmd.addOption(o);
359414
+ } else if (opt.choices) {
359150
359415
  const o = new Option2(opt.flags, opt.description);
359151
359416
  o.choices(opt.choices);
359152
359417
  if (opt.default !== undefined)
@@ -359409,12 +359674,12 @@ function redactArgv(argv) {
359409
359674
  init_store();
359410
359675
  import { createHash as createHash6 } from "node:crypto";
359411
359676
  import { existsSync as existsSync15, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "node:fs";
359412
- import { dirname as dirname16, join as join29 } from "node:path";
359677
+ import { dirname as dirname16, join as join30 } from "node:path";
359413
359678
  var MAX_ID_LEN = 64;
359414
359679
  function findGitRoot(start) {
359415
359680
  let dir = start;
359416
359681
  for (;; ) {
359417
- if (existsSync15(join29(dir, ".git")))
359682
+ if (existsSync15(join30(dir, ".git")))
359418
359683
  return dir;
359419
359684
  const parent = dirname16(dir);
359420
359685
  if (parent === dir)
@@ -359524,19 +359789,19 @@ function beginInvocation(argv, sessions) {
359524
359789
  // src/telemetry/store.ts
359525
359790
  init_state();
359526
359791
  import { existsSync as existsSync16, readdirSync as readdirSync6, readFileSync as readFileSync8, statSync as statSync6 } from "node:fs";
359527
- import { join as join30 } from "node:path";
359792
+ import { join as join31 } from "node:path";
359528
359793
  var IDLE_WINDOW_MS2 = 30 * 60 * 1000;
359529
359794
  function sessionsRoot2() {
359530
- return join30(createPaths().home, "sessions");
359795
+ return join31(createPaths().home, "sessions");
359531
359796
  }
359532
359797
  function sessionDir2(id) {
359533
- return join30(sessionsRoot2(), id);
359798
+ return join31(sessionsRoot2(), id);
359534
359799
  }
359535
359800
  function eventsPath2(id) {
359536
- return join30(sessionDir2(id), "events.jsonl");
359801
+ return join31(sessionDir2(id), "events.jsonl");
359537
359802
  }
359538
359803
  function markerPath2(id) {
359539
- return join30(sessionDir2(id), ".analyzed");
359804
+ return join31(sessionDir2(id), ".analyzed");
359540
359805
  }
359541
359806
  function sessionIds2() {
359542
359807
  try {
@@ -359566,13 +359831,13 @@ init_settings();
359566
359831
  init_store();
359567
359832
  import { spawn as spawn4 } from "node:child_process";
359568
359833
  import { existsSync as existsSync17, mkdirSync as mkdirSync6, readFileSync as readFileSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "node:fs";
359569
- import { join as join31 } from "node:path";
359834
+ import { join as join32 } from "node:path";
359570
359835
  var LOCK_STALE_MS2 = 30 * 60 * 1000;
359571
- function lockPath2() {
359572
- return join31(sessionsRoot(), ".analyzer.lock");
359836
+ function lockPath3() {
359837
+ return join32(sessionsRoot(), ".analyzer.lock");
359573
359838
  }
359574
359839
  function claimLock() {
359575
- const path9 = lockPath2();
359840
+ const path9 = lockPath3();
359576
359841
  try {
359577
359842
  if (existsSync17(path9)) {
359578
359843
  const lock = JSON.parse(readFileSync9(path9, "utf-8"));