@astrale-os/cli 1.0.0-beta.45 → 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/CHANGELOG.md +8 -0
- package/dist/astrale.js +694 -448
- package/dist/types/admin/graph/nodes.d.ts +2 -0
- package/dist/types/lib/idempotency.d.ts +2 -0
- package/package.json +1 -1
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.
|
|
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
|
|
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(
|
|
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(
|
|
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 =
|
|
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(
|
|
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 =
|
|
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
|
-
|
|
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
|
|
71265
|
+
readFile as readFile9,
|
|
71142
71266
|
realpath,
|
|
71143
71267
|
rename as rename4,
|
|
71144
|
-
rm as
|
|
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
|
|
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
|
|
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:
|
|
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(
|
|
71504
|
+
const tmp = await mkdtemp2(join9(tmpdir(), "astrale-update-"));
|
|
71381
71505
|
try {
|
|
71382
|
-
const archive2 =
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
73602
|
-
import { dirname as dirname9, join as
|
|
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 =
|
|
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
|
-
|
|
73692
|
-
|
|
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
|
|
73836
|
-
import { dirname as dirname10, join as
|
|
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
|
|
74097
|
+
return join12(idpDir(name), "metadata.json");
|
|
73865
74098
|
}
|
|
73866
74099
|
function idpClientPath(name) {
|
|
73867
|
-
return
|
|
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
|
|
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
|
-
|
|
73899
|
-
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
84789
|
+
import { join as join13 } from "node:path";
|
|
84557
84790
|
function hasDomainProject() {
|
|
84558
|
-
return existsSync3(
|
|
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(() => {
|
|
@@ -84625,6 +84858,12 @@ function idempotencyKey(...segments) {
|
|
|
84625
84858
|
function randomOperationId(...namespace) {
|
|
84626
84859
|
return idempotencyKey(...namespace, globalThis.crypto.randomUUID());
|
|
84627
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
|
+
}
|
|
84628
84867
|
var MAXIMUM_KEY_LENGTH = 128, URL_SAFE_KEY;
|
|
84629
84868
|
var init_idempotency2 = __esm(() => {
|
|
84630
84869
|
URL_SAFE_KEY = /^[A-Za-z0-9._~-]+$/u;
|
|
@@ -96441,13 +96680,13 @@ function pattern(input, patternIndex, path5) {
|
|
|
96441
96680
|
invalid24("Pattern source", undefined, `${path5}/source`);
|
|
96442
96681
|
const statesPath = `${path5}/states`;
|
|
96443
96682
|
const states = array4(value2.states, "Pattern states", statesPath).map((item, stateIndex) => {
|
|
96444
|
-
const
|
|
96445
|
-
const state2 = object2(item, "Pattern state",
|
|
96446
|
-
exact9(state2, ["epsilon", "transitions"], "Pattern state",
|
|
96683
|
+
const statePath2 = `${statesPath}/${stateIndex}`;
|
|
96684
|
+
const state2 = object2(item, "Pattern state", statePath2);
|
|
96685
|
+
exact9(state2, ["epsilon", "transitions"], "Pattern state", statePath2, ["accepting"]);
|
|
96447
96686
|
if (state2.accepting !== undefined && state2.accepting !== true)
|
|
96448
|
-
invalid24("accepting", undefined, `${
|
|
96449
|
-
const epsilonPath = `${
|
|
96450
|
-
const transitionsPath = `${
|
|
96687
|
+
invalid24("accepting", undefined, `${statePath2}/accepting`);
|
|
96688
|
+
const epsilonPath = `${statePath2}/epsilon`;
|
|
96689
|
+
const transitionsPath = `${statePath2}/transitions`;
|
|
96451
96690
|
return {
|
|
96452
96691
|
epsilon: array4(state2.epsilon, "epsilon", epsilonPath).map((target2, index2) => integer2(target2, "epsilon", `${epsilonPath}/${index2}`)),
|
|
96453
96692
|
transitions: array4(state2.transitions, "transitions", transitionsPath).map((transitionValue, transitionIndex) => {
|
|
@@ -98847,6 +99086,7 @@ async function readAllNodes(graph, ast, options) {
|
|
|
98847
99086
|
const cursors = new Set;
|
|
98848
99087
|
let cursor;
|
|
98849
99088
|
let pages = 0;
|
|
99089
|
+
let terminal2 = false;
|
|
98850
99090
|
const pageSize = Math.min(options.maximum, 256);
|
|
98851
99091
|
do {
|
|
98852
99092
|
pages += 1;
|
|
@@ -98864,6 +99104,10 @@ async function readAllNodes(graph, ast, options) {
|
|
|
98864
99104
|
throw new TypeError(`${options.label} omitted requested Node values.`);
|
|
98865
99105
|
}
|
|
98866
99106
|
const node4 = projection.value;
|
|
99107
|
+
if (options.orderedBoundary?.(node4) === true) {
|
|
99108
|
+
terminal2 = true;
|
|
99109
|
+
break;
|
|
99110
|
+
}
|
|
98867
99111
|
if (ids.has(String(node4.id)))
|
|
98868
99112
|
throw new TypeError(`${options.label} repeated a Node.`);
|
|
98869
99113
|
ids.add(String(node4.id));
|
|
@@ -98872,7 +99116,7 @@ async function readAllNodes(graph, ast, options) {
|
|
|
98872
99116
|
if (nodes.length > options.maximum) {
|
|
98873
99117
|
throw new TypeError(`${options.label} exceeded its Node bound.`);
|
|
98874
99118
|
}
|
|
98875
|
-
cursor = response2.page.next;
|
|
99119
|
+
cursor = terminal2 ? undefined : response2.page.next;
|
|
98876
99120
|
if (cursor !== undefined && cursors.has(cursor)) {
|
|
98877
99121
|
throw new TypeError(`${options.label} repeated a cursor.`);
|
|
98878
99122
|
}
|
|
@@ -98909,22 +99153,26 @@ async function connectAdminInstances(context, dependencies = {}) {
|
|
|
98909
99153
|
const operationId = dependencies.operationId ?? defaultOperationId;
|
|
98910
99154
|
const list3 = async () => {
|
|
98911
99155
|
const Instance2 = AdminContract.classes.Instance;
|
|
99156
|
+
const property2 = AdminContract.properties.instance;
|
|
98912
99157
|
const instances = Query.from({ nodes: [Instance2] }).filter({
|
|
98913
99158
|
class: { equals: Instance2 }
|
|
98914
99159
|
});
|
|
98915
99160
|
const nodes = await readAllNodes(context.graph, instances.select({
|
|
98916
99161
|
kind: "nodes",
|
|
98917
99162
|
binding: instances.node,
|
|
98918
|
-
projection: { kind: "value" }
|
|
99163
|
+
projection: { kind: "value" },
|
|
99164
|
+
order: { property: property2.state, direction: "desc", unranked: "last" }
|
|
98919
99165
|
}), {
|
|
98920
99166
|
label: "Admin Instance inventory",
|
|
98921
99167
|
maximum: MAXIMUM_INSTANCES,
|
|
98922
|
-
maximumPages: MAXIMUM_PAGES
|
|
99168
|
+
maximumPages: MAXIMUM_PAGES,
|
|
99169
|
+
orderedBoundary: (node4) => instanceFromNode(node4).state === "deleted"
|
|
98923
99170
|
});
|
|
98924
|
-
return nodes.map(instanceFromNode)
|
|
99171
|
+
return nodes.map(instanceFromNode);
|
|
98925
99172
|
};
|
|
98926
99173
|
const requireInstance = async (identifier) => {
|
|
98927
|
-
const
|
|
99174
|
+
const direct = directNodePath(identifier);
|
|
99175
|
+
const found = direct === undefined ? findOwnedInstance(await list3(), identifier) : await readExactInstance(context.graph, direct);
|
|
98928
99176
|
if (found === undefined)
|
|
98929
99177
|
throw new AdminInstanceNotFoundError(identifier);
|
|
98930
99178
|
return found;
|
|
@@ -98957,6 +99205,22 @@ async function connectAdminInstances(context, dependencies = {}) {
|
|
|
98957
99205
|
}
|
|
98958
99206
|
});
|
|
98959
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
|
+
}
|
|
98960
99224
|
function instanceFromNode(node4) {
|
|
98961
99225
|
const Instance2 = AdminContract.classes.Instance;
|
|
98962
99226
|
if (node4.class !== ClassKey.of(Instance2)) {
|
|
@@ -101614,14 +101878,14 @@ async function boundedResponse(response2, maximum, signal) {
|
|
|
101614
101878
|
signal.removeEventListener("abort", abort);
|
|
101615
101879
|
reader.releaseLock();
|
|
101616
101880
|
}
|
|
101617
|
-
return
|
|
101881
|
+
return join14(chunks, total);
|
|
101618
101882
|
}
|
|
101619
101883
|
function requireExactResponse(response2, expected, label) {
|
|
101620
101884
|
if (response2.redirected || response2.url !== expected) {
|
|
101621
101885
|
throw new ClientError(`${label} did not return the exact requested URL.`);
|
|
101622
101886
|
}
|
|
101623
101887
|
}
|
|
101624
|
-
function
|
|
101888
|
+
function join14(parts, length) {
|
|
101625
101889
|
if (parts.length === 1)
|
|
101626
101890
|
return new Uint8Array(parts[0]);
|
|
101627
101891
|
const output3 = new Uint8Array(length);
|
|
@@ -104256,67 +104520,6 @@ var init_instance3 = __esm(() => {
|
|
|
104256
104520
|
};
|
|
104257
104521
|
});
|
|
104258
104522
|
|
|
104259
|
-
// src/commands/skills/configure.ts
|
|
104260
|
-
var exports_configure = {};
|
|
104261
|
-
__export(exports_configure, {
|
|
104262
|
-
chooseAstraleSkillAgents: () => chooseAstraleSkillAgents,
|
|
104263
|
-
default: () => configure_default
|
|
104264
|
-
});
|
|
104265
|
-
async function chooseAstraleSkillAgents(opts = {}) {
|
|
104266
|
-
const agents = await astraleSkillAgents();
|
|
104267
|
-
if (opts.agent)
|
|
104268
|
-
return opts.agent;
|
|
104269
|
-
const interactive = process.stdin.isTTY && process.stdout.isTTY && !process.env.CI && !process.argv.includes("--no-prompt") && !process.argv.includes("--ci");
|
|
104270
|
-
const defaults = agents.filter((agent) => agent.configured || agent.detected).map((agent) => agent.name);
|
|
104271
|
-
if (!interactive || opts.yes)
|
|
104272
|
-
return defaults;
|
|
104273
|
-
const ordered2 = [...agents].sort((left, right) => Number(right.configured || right.detected) - Number(left.configured || left.detected) || left.displayName.localeCompare(right.displayName));
|
|
104274
|
-
return promptMultiSelect("Install Astrale skills for which global agents?", ordered2.map((agent) => ({
|
|
104275
|
-
name: `${agent.displayName}${agent.configured ? " (configured)" : agent.detected ? " (detected)" : ""}`,
|
|
104276
|
-
value: agent.name,
|
|
104277
|
-
checked: agent.configured || agent.detected,
|
|
104278
|
-
description: agent.globalSkillsDir
|
|
104279
|
-
})));
|
|
104280
|
-
}
|
|
104281
|
-
var configure_default;
|
|
104282
|
-
var init_configure = __esm(() => {
|
|
104283
|
-
init_log();
|
|
104284
|
-
init_output();
|
|
104285
|
-
init_prompt();
|
|
104286
|
-
init_skills();
|
|
104287
|
-
configure_default = {
|
|
104288
|
-
name: "configure",
|
|
104289
|
-
description: "Choose the global agents that receive Astrale skill links",
|
|
104290
|
-
options: [
|
|
104291
|
-
{ flags: "--agent <name...>", description: "Select agents explicitly (repeat or list names)" },
|
|
104292
|
-
{ flags: "--yes", description: "Use detected/already-configured agents without prompting" },
|
|
104293
|
-
...RAW_OUTPUT_OPTIONS
|
|
104294
|
-
],
|
|
104295
|
-
action: async (opts) => {
|
|
104296
|
-
try {
|
|
104297
|
-
const selected = await chooseAstraleSkillAgents(opts);
|
|
104298
|
-
if (selected === undefined)
|
|
104299
|
-
return;
|
|
104300
|
-
const result = await syncAstraleSkills({
|
|
104301
|
-
agents: selected,
|
|
104302
|
-
replaceAgentSelection: true
|
|
104303
|
-
});
|
|
104304
|
-
if (isMachine(opts)) {
|
|
104305
|
-
output({ ...result, agents: selected, scope: "global" }, opts);
|
|
104306
|
-
return;
|
|
104307
|
-
}
|
|
104308
|
-
log.success("Astrale skills configured globally");
|
|
104309
|
-
if (selected.length === 0)
|
|
104310
|
-
log.dim(" canonical only: ~/.agents/skills");
|
|
104311
|
-
else
|
|
104312
|
-
log.dim(` agents: ${selected.join(", ")}`);
|
|
104313
|
-
} catch (error52) {
|
|
104314
|
-
fatal(error52, opts);
|
|
104315
|
-
}
|
|
104316
|
-
}
|
|
104317
|
-
};
|
|
104318
|
-
});
|
|
104319
|
-
|
|
104320
104523
|
// src/setup/steps/skills.ts
|
|
104321
104524
|
var FIX5, skillsStep;
|
|
104322
104525
|
var init_skills2 = __esm(() => {
|
|
@@ -104376,11 +104579,11 @@ var init_skills2 = __esm(() => {
|
|
|
104376
104579
|
|
|
104377
104580
|
// src/setup/steps/skills-bridge.ts
|
|
104378
104581
|
import { existsSync as existsSync4, readdirSync } from "node:fs";
|
|
104379
|
-
import { join as
|
|
104582
|
+
import { join as join15 } from "node:path";
|
|
104380
104583
|
function countStaged(root) {
|
|
104381
104584
|
try {
|
|
104382
|
-
const dir =
|
|
104383
|
-
return readdirSync(dir).filter((e) => existsSync4(
|
|
104585
|
+
const dir = join15(root, ".agents", "skills");
|
|
104586
|
+
return readdirSync(dir).filter((e) => existsSync4(join15(dir, e, "SKILL.md"))).length;
|
|
104384
104587
|
} catch {
|
|
104385
104588
|
return 0;
|
|
104386
104589
|
}
|
|
@@ -104418,7 +104621,7 @@ var init_skills_bridge = __esm(() => {
|
|
|
104418
104621
|
}
|
|
104419
104622
|
const after = ensureSkillsBridge();
|
|
104420
104623
|
if (after.kind === "bridged") {
|
|
104421
|
-
log.success(`Workspace skills bridged — ${
|
|
104624
|
+
log.success(`Workspace skills bridged — ${join15(after.root, ".agents/skills")} → .claude/skills`);
|
|
104422
104625
|
return "fixed";
|
|
104423
104626
|
}
|
|
104424
104627
|
log.warn("Could not create the skills bridge — create it manually: ln -s ../.agents/skills .claude/skills");
|
|
@@ -104886,18 +105089,18 @@ Examples:
|
|
|
104886
105089
|
|
|
104887
105090
|
// src/lib/sdk-deps.ts
|
|
104888
105091
|
import { existsSync as existsSync5 } from "node:fs";
|
|
104889
|
-
import { join as
|
|
105092
|
+
import { join as join16 } from "node:path";
|
|
104890
105093
|
function inDomainProject(cwd = process.cwd()) {
|
|
104891
|
-
return existsSync5(
|
|
105094
|
+
return existsSync5(join16(cwd, "astrale.config.ts"));
|
|
104892
105095
|
}
|
|
104893
105096
|
function foreignPackageManager(cwd = process.cwd()) {
|
|
104894
|
-
if (existsSync5(
|
|
105097
|
+
if (existsSync5(join16(cwd, "pnpm-lock.yaml")))
|
|
104895
105098
|
return null;
|
|
104896
|
-
if (existsSync5(
|
|
105099
|
+
if (existsSync5(join16(cwd, "package-lock.json")))
|
|
104897
105100
|
return "npm";
|
|
104898
|
-
if (existsSync5(
|
|
105101
|
+
if (existsSync5(join16(cwd, "yarn.lock")))
|
|
104899
105102
|
return "yarn";
|
|
104900
|
-
if (existsSync5(
|
|
105103
|
+
if (existsSync5(join16(cwd, "bun.lockb")) || existsSync5(join16(cwd, "bun.lock")))
|
|
104901
105104
|
return "bun";
|
|
104902
105105
|
return null;
|
|
104903
105106
|
}
|
|
@@ -104948,18 +105151,15 @@ __export(exports_update, {
|
|
|
104948
105151
|
cliStale: () => cliStale,
|
|
104949
105152
|
default: () => update_default
|
|
104950
105153
|
});
|
|
104951
|
-
async function refreshSkills() {
|
|
104952
|
-
|
|
104953
|
-
|
|
104954
|
-
|
|
104955
|
-
|
|
104956
|
-
|
|
104957
|
-
|
|
104958
|
-
|
|
104959
|
-
|
|
104960
|
-
else if (result.status === "repaired")
|
|
104961
|
-
log.success("Astrale skills repaired and updated");
|
|
104962
|
-
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");
|
|
104963
105163
|
}
|
|
104964
105164
|
function skillCheckStale(skills) {
|
|
104965
105165
|
return skills.status === "update-available" || skills.status === "repair-needed";
|
|
@@ -105052,11 +105252,37 @@ async function cliStale(opts, dependencies = CLI_STALE_DEPENDENCIES) {
|
|
|
105052
105252
|
};
|
|
105053
105253
|
}
|
|
105054
105254
|
}
|
|
105055
|
-
async function refreshSkillsWithUpdatedBinary(bin) {
|
|
105056
|
-
|
|
105057
|
-
|
|
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
|
+
}
|
|
105058
105283
|
return;
|
|
105059
|
-
|
|
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()}` : ""}`);
|
|
105060
105286
|
}
|
|
105061
105287
|
async function sdkStale() {
|
|
105062
105288
|
if (!inDomainProject() || foreignPackageManager()) {
|
|
@@ -105076,6 +105302,7 @@ var init_update2 = __esm(() => {
|
|
|
105076
105302
|
init_sdk_deps();
|
|
105077
105303
|
init_skills();
|
|
105078
105304
|
init_update();
|
|
105305
|
+
init_configure();
|
|
105079
105306
|
CLI_STALE_DEPENDENCIES = {
|
|
105080
105307
|
update: updateAstrale
|
|
105081
105308
|
};
|
|
@@ -105094,7 +105321,7 @@ var init_update2 = __esm(() => {
|
|
|
105094
105321
|
{ flags: "--no-deps", description: "Skip checking @astrale-os SDK dependency versions" },
|
|
105095
105322
|
{
|
|
105096
105323
|
flags: "--yes",
|
|
105097
|
-
description: "Non-interactive: apply
|
|
105324
|
+
description: "Non-interactive: apply updates without opting into a first skill install"
|
|
105098
105325
|
},
|
|
105099
105326
|
...RAW_OUTPUT_OPTIONS
|
|
105100
105327
|
],
|
|
@@ -105103,10 +105330,9 @@ Behavior:
|
|
|
105103
105330
|
Keeps three things current, in order. (1) The CLI distribution: updates official
|
|
105104
105331
|
standalone installs with checksum verification; npm-owned installs report the
|
|
105105
105332
|
exact npm command and never overwrite package-manager files. (2) The Astrale
|
|
105106
|
-
agent skills:
|
|
105107
|
-
|
|
105108
|
-
|
|
105109
|
-
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
|
|
105110
105336
|
project, proposes any @astrale-os/* dependency with a newer release and, on
|
|
105111
105337
|
confirm, runs "pnpm update --latest --lockfile-only" (updates package.json AND
|
|
105112
105338
|
the lockfile, honoring your registry + supply-chain age policy; run "pnpm
|
|
@@ -105115,9 +105341,10 @@ Behavior:
|
|
|
105115
105341
|
The default release channel is beta; --channel overrides it for one run.
|
|
105116
105342
|
--check is a dry run (binary + skills + SDK deps; exit 10 if anything is available) and
|
|
105117
105343
|
never writes. With --json it emits a unified staleness report
|
|
105118
|
-
({ stale, cli, skills, sdk }) for tooling. --yes applies
|
|
105119
|
-
|
|
105120
|
-
claiming a partial success. --no-skills
|
|
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.
|
|
105121
105348
|
|
|
105122
105349
|
Examples:
|
|
105123
105350
|
$ astrale update
|
|
@@ -105170,17 +105397,19 @@ Examples:
|
|
|
105170
105397
|
throw error52;
|
|
105171
105398
|
}
|
|
105172
105399
|
if (opts.skills !== false) {
|
|
105400
|
+
const interactiveSkills = skillInstallPromptAllowed(opts);
|
|
105401
|
+
const humanSkills = !isMachine(opts);
|
|
105173
105402
|
if (opts.check) {
|
|
105174
105403
|
const skills = await checkAstraleSkills();
|
|
105175
105404
|
printSkillCheck(skills);
|
|
105176
105405
|
if (skillCheckStale(skills))
|
|
105177
105406
|
anyAvailable = true;
|
|
105178
105407
|
} else if (result.status === "updated") {
|
|
105179
|
-
|
|
105180
|
-
|
|
105181
|
-
|
|
105408
|
+
if (humanSkills)
|
|
105409
|
+
log.step("Applying skills embedded in the updated CLI");
|
|
105410
|
+
await refreshSkillsWithUpdatedBinary(result.bin, interactiveSkills);
|
|
105182
105411
|
} else {
|
|
105183
|
-
await refreshSkills();
|
|
105412
|
+
await refreshSkills(interactiveSkills, humanSkills);
|
|
105184
105413
|
}
|
|
105185
105414
|
} else if (!opts.check) {
|
|
105186
105415
|
log.dim(" Astrale skills skipped (--no-skills)");
|
|
@@ -105751,7 +105980,7 @@ __export(exports_mutate, {
|
|
|
105751
105980
|
default: () => mutate_default,
|
|
105752
105981
|
mutateCommand: () => mutateCommand
|
|
105753
105982
|
});
|
|
105754
|
-
import { readFile as
|
|
105983
|
+
import { readFile as readFile15 } from "node:fs/promises";
|
|
105755
105984
|
async function mutateCommand(opts) {
|
|
105756
105985
|
let mutation;
|
|
105757
105986
|
try {
|
|
@@ -105784,7 +106013,7 @@ async function readDocument(opts) {
|
|
|
105784
106013
|
if (opts.file !== undefined) {
|
|
105785
106014
|
let raw3;
|
|
105786
106015
|
try {
|
|
105787
|
-
raw3 = await
|
|
106016
|
+
raw3 = await readFile15(opts.file, "utf8");
|
|
105788
106017
|
} catch (error52) {
|
|
105789
106018
|
throw new AstraleError("FILE_READ_FAILED", `Cannot read --file ${opts.file}.`, undefined, {
|
|
105790
106019
|
cause: error52
|
|
@@ -105868,7 +106097,7 @@ __export(exports_query, {
|
|
|
105868
106097
|
default: () => query_default,
|
|
105869
106098
|
queryCommand: () => queryCommand
|
|
105870
106099
|
});
|
|
105871
|
-
import { readFile as
|
|
106100
|
+
import { readFile as readFile16 } from "node:fs/promises";
|
|
105872
106101
|
async function queryCommand(sources2, opts) {
|
|
105873
106102
|
let input;
|
|
105874
106103
|
try {
|
|
@@ -105919,7 +106148,7 @@ async function readAst(opts) {
|
|
|
105919
106148
|
return;
|
|
105920
106149
|
let raw2;
|
|
105921
106150
|
try {
|
|
105922
|
-
raw2 = await
|
|
106151
|
+
raw2 = await readFile16(opts.file, "utf8");
|
|
105923
106152
|
} catch (error52) {
|
|
105924
106153
|
throw new AstraleError("FILE_READ_FAILED", `Cannot read --file ${opts.file}.`, undefined, {
|
|
105925
106154
|
cause: error52
|
|
@@ -106493,8 +106722,8 @@ var init_external_open_origins = __esm(() => {
|
|
|
106493
106722
|
|
|
106494
106723
|
// src/lib/view/session.ts
|
|
106495
106724
|
import { closeSync as closeSync2, fchmodSync, openSync as openSync2 } from "node:fs";
|
|
106496
|
-
import { chmod as chmod4, mkdir as mkdir12, readdir as readdir4, readFile as
|
|
106497
|
-
import { join as
|
|
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";
|
|
106498
106727
|
async function ensureViewDirectory(directory = VIEW_DIR) {
|
|
106499
106728
|
await mkdir12(directory, { recursive: true, mode: 448 });
|
|
106500
106729
|
await chmod4(directory, 448);
|
|
@@ -106522,9 +106751,9 @@ async function openSessionLog(id, directory = VIEW_DIR) {
|
|
|
106522
106751
|
}
|
|
106523
106752
|
async function removeSessionFiles(id, directory = VIEW_DIR) {
|
|
106524
106753
|
await Promise.all([
|
|
106525
|
-
|
|
106526
|
-
|
|
106527
|
-
|
|
106754
|
+
rm7(recordPath(id, directory), { force: true }),
|
|
106755
|
+
rm7(configPath(id, directory), { force: true }),
|
|
106756
|
+
rm7(logPath(id, directory), { force: true })
|
|
106528
106757
|
]);
|
|
106529
106758
|
}
|
|
106530
106759
|
function isAlive(pid) {
|
|
@@ -106548,7 +106777,7 @@ async function listSessions() {
|
|
|
106548
106777
|
continue;
|
|
106549
106778
|
let record12;
|
|
106550
106779
|
try {
|
|
106551
|
-
record12 = JSON.parse(await
|
|
106780
|
+
record12 = JSON.parse(await readFile17(join17(VIEW_DIR, entry2), "utf8"));
|
|
106552
106781
|
} catch {
|
|
106553
106782
|
continue;
|
|
106554
106783
|
}
|
|
@@ -106576,22 +106805,22 @@ async function closeSession(record12) {
|
|
|
106576
106805
|
}
|
|
106577
106806
|
await removeSessionFiles(record12.id);
|
|
106578
106807
|
}
|
|
106579
|
-
var VIEW_DIR, recordPath = (id, directory = VIEW_DIR) =>
|
|
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;
|
|
106580
106809
|
var init_session5 = __esm(() => {
|
|
106581
106810
|
init_state();
|
|
106582
|
-
VIEW_DIR =
|
|
106811
|
+
VIEW_DIR = join17(paths2.home, "view");
|
|
106583
106812
|
});
|
|
106584
106813
|
|
|
106585
106814
|
// src/lib/view/port-allocation.ts
|
|
106586
|
-
import { join as
|
|
106587
|
-
function withViewPortAllocationLock(fn,
|
|
106588
|
-
return withFileLock(
|
|
106815
|
+
import { join as join18 } from "node:path";
|
|
106816
|
+
function withViewPortAllocationLock(fn, lockPath2 = VIEW_PORT_LOCK) {
|
|
106817
|
+
return withFileLock(lockPath2, fn);
|
|
106589
106818
|
}
|
|
106590
106819
|
var VIEW_PORT_LOCK;
|
|
106591
106820
|
var init_port_allocation = __esm(() => {
|
|
106592
106821
|
init_state();
|
|
106593
106822
|
init_session5();
|
|
106594
|
-
VIEW_PORT_LOCK =
|
|
106823
|
+
VIEW_PORT_LOCK = join18(VIEW_DIR, "ports.lock");
|
|
106595
106824
|
});
|
|
106596
106825
|
|
|
106597
106826
|
// src/lib/view/resolve.ts
|
|
@@ -106661,33 +106890,33 @@ var init_resolve2 = __esm(() => {
|
|
|
106661
106890
|
// src/lib/view/assets.ts
|
|
106662
106891
|
import { existsSync as existsSync6, statSync } from "node:fs";
|
|
106663
106892
|
import { copyFile as copyFile2 } from "node:fs/promises";
|
|
106664
|
-
import { dirname as dirname13, join as
|
|
106893
|
+
import { dirname as dirname13, join as join19 } from "node:path";
|
|
106665
106894
|
import { fileURLToPath } from "node:url";
|
|
106666
106895
|
function viewerDistDir(moduleUrl = import.meta.url, entry2 = process.argv[1] ?? ".") {
|
|
106667
106896
|
const override = process.env.ASTRALE_VIEWER_DIR;
|
|
106668
106897
|
if (override)
|
|
106669
106898
|
return override;
|
|
106670
106899
|
const moduleDirectory = dirname13(fileURLToPath(moduleUrl));
|
|
106671
|
-
const published =
|
|
106672
|
-
const source2 =
|
|
106673
|
-
const legacy =
|
|
106900
|
+
const published = join19(moduleDirectory, "..", "viewer", "dist");
|
|
106901
|
+
const source2 = join19(moduleDirectory, "..", "..", "..", "viewer", "dist");
|
|
106902
|
+
const legacy = join19(dirname13(entry2), "..", "viewer", "dist");
|
|
106674
106903
|
const standalone = entry2.startsWith("/$bunfs/") ? embeddedAssetDir("viewer") : undefined;
|
|
106675
106904
|
const complete = [standalone, published, source2, legacy].find((candidate2) => candidate2 !== undefined && hasViewerBundle(candidate2));
|
|
106676
106905
|
if (complete)
|
|
106677
106906
|
return complete;
|
|
106678
|
-
if (hasViewerSource(
|
|
106907
|
+
if (hasViewerSource(join19(source2, "..")))
|
|
106679
106908
|
return source2;
|
|
106680
106909
|
return published;
|
|
106681
106910
|
}
|
|
106682
106911
|
async function ensureViewerAssets(moduleUrl = import.meta.url, entry2 = process.argv[1] ?? ".") {
|
|
106683
106912
|
const dist = viewerDistDir(moduleUrl, entry2);
|
|
106684
|
-
const srcDir =
|
|
106913
|
+
const srcDir = join19(dist, "..");
|
|
106685
106914
|
if (hasViewerBundle(dist) && !viewerSourceIsNewer(srcDir, dist))
|
|
106686
106915
|
return dist;
|
|
106687
106916
|
const bun = globalThis.Bun;
|
|
106688
106917
|
if (bun && hasViewerSource(srcDir)) {
|
|
106689
106918
|
const result = await bun.build({
|
|
106690
|
-
entrypoints: [
|
|
106919
|
+
entrypoints: [join19(srcDir, "main.ts")],
|
|
106691
106920
|
outdir: dist,
|
|
106692
106921
|
target: "browser",
|
|
106693
106922
|
minify: false
|
|
@@ -106695,24 +106924,24 @@ async function ensureViewerAssets(moduleUrl = import.meta.url, entry2 = process.
|
|
|
106695
106924
|
if (!result.success)
|
|
106696
106925
|
throw new Error(`viewer build failed: ${result.logs.join(`
|
|
106697
106926
|
`)}`);
|
|
106698
|
-
await copyFile2(
|
|
106927
|
+
await copyFile2(join19(srcDir, "index.html"), join19(dist, "index.html"));
|
|
106699
106928
|
return dist;
|
|
106700
106929
|
}
|
|
106701
106930
|
return materializeEmbeddedAssets("viewer");
|
|
106702
106931
|
}
|
|
106703
106932
|
function hasViewerBundle(directory) {
|
|
106704
|
-
return existsSync6(
|
|
106933
|
+
return existsSync6(join19(directory, "main.js")) && existsSync6(join19(directory, "index.html"));
|
|
106705
106934
|
}
|
|
106706
106935
|
function hasViewerSource(directory) {
|
|
106707
|
-
return existsSync6(
|
|
106936
|
+
return existsSync6(join19(directory, "main.ts")) && existsSync6(join19(directory, "index.html"));
|
|
106708
106937
|
}
|
|
106709
106938
|
function viewerSourceIsNewer(source2, dist) {
|
|
106710
106939
|
if (!hasViewerSource(source2))
|
|
106711
106940
|
return false;
|
|
106712
106941
|
if (!hasViewerBundle(dist))
|
|
106713
106942
|
return true;
|
|
106714
|
-
const newestSource = Math.max(statSync(
|
|
106715
|
-
const oldestOutput = Math.min(statSync(
|
|
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);
|
|
106716
106945
|
return newestSource > oldestOutput;
|
|
106717
106946
|
}
|
|
106718
106947
|
var init_assets = __esm(() => {
|
|
@@ -106720,9 +106949,9 @@ var init_assets = __esm(() => {
|
|
|
106720
106949
|
});
|
|
106721
106950
|
|
|
106722
106951
|
// src/lib/view/server.ts
|
|
106723
|
-
import { readFile as
|
|
106952
|
+
import { readFile as readFile18 } from "node:fs/promises";
|
|
106724
106953
|
import { createServer } from "node:http";
|
|
106725
|
-
import { join as
|
|
106954
|
+
import { join as join20 } from "node:path";
|
|
106726
106955
|
import { Readable } from "node:stream";
|
|
106727
106956
|
function startViewServer(config2) {
|
|
106728
106957
|
const { session: session3, proxy } = config2;
|
|
@@ -106770,11 +106999,11 @@ function startViewServer(config2) {
|
|
|
106770
106999
|
return;
|
|
106771
107000
|
}
|
|
106772
107001
|
if (sub === "/" || sub === "/index.html") {
|
|
106773
|
-
await serveAsset(res,
|
|
107002
|
+
await serveAsset(res, join20(hostDir, "index.html"), "text/html; charset=utf-8");
|
|
106774
107003
|
return;
|
|
106775
107004
|
}
|
|
106776
107005
|
if (sub === "/main.js") {
|
|
106777
|
-
await serveAsset(res,
|
|
107006
|
+
await serveAsset(res, join20(hostDir, "main.js"), "text/javascript; charset=utf-8");
|
|
106778
107007
|
return;
|
|
106779
107008
|
}
|
|
106780
107009
|
if (sub === "/config.json" && req.method === "GET") {
|
|
@@ -106894,7 +107123,7 @@ function json3(res, code, body) {
|
|
|
106894
107123
|
}
|
|
106895
107124
|
async function serveAsset(res, file2, contentType) {
|
|
106896
107125
|
try {
|
|
106897
|
-
const content = await
|
|
107126
|
+
const content = await readFile18(file2);
|
|
106898
107127
|
res.writeHead(200, { "content-type": contentType, "cache-control": "no-store" });
|
|
106899
107128
|
res.end(content);
|
|
106900
107129
|
} catch {
|
|
@@ -107010,8 +107239,8 @@ __export(exports_view3, {
|
|
|
107010
107239
|
});
|
|
107011
107240
|
import { randomBytes } from "node:crypto";
|
|
107012
107241
|
import { closeSync as closeSync3, existsSync as existsSync7, statSync as statSync2 } from "node:fs";
|
|
107013
|
-
import { readdir as readdir5, readFile as
|
|
107014
|
-
import { dirname as dirname14, join as
|
|
107242
|
+
import { readdir as readdir5, readFile as readFile19 } from "node:fs/promises";
|
|
107243
|
+
import { dirname as dirname14, join as join21 } from "node:path";
|
|
107015
107244
|
async function resolveSession(spec, opts) {
|
|
107016
107245
|
rejectUnrepresentableOverrides(opts);
|
|
107017
107246
|
const parsed = parseViewSpec(spec);
|
|
@@ -107068,7 +107297,7 @@ async function resolveServeRuntime(environment = {}) {
|
|
|
107068
107297
|
if (node4 && entry2?.endsWith(".js") && exists(entry2))
|
|
107069
107298
|
return { file: node4, args: [entry2] };
|
|
107070
107299
|
if (node4 && entry2?.endsWith(".ts")) {
|
|
107071
|
-
const dist =
|
|
107300
|
+
const dist = join21(dirname14(entry2), "..", "dist", "astrale.js");
|
|
107072
107301
|
await ensureDevDist(entry2, dist);
|
|
107073
107302
|
if (exists(dist))
|
|
107074
107303
|
return { file: node4, args: [dist] };
|
|
@@ -107094,8 +107323,8 @@ async function findOnPath(name) {
|
|
|
107094
107323
|
async function ensureDevDist(entry2, dist) {
|
|
107095
107324
|
if (!await devDistIsStale(entry2, dist))
|
|
107096
107325
|
return;
|
|
107097
|
-
const projectDir =
|
|
107098
|
-
const buildScript =
|
|
107326
|
+
const projectDir = join21(dirname14(entry2), "..");
|
|
107327
|
+
const buildScript = join21(projectDir, "scripts", "build.ts");
|
|
107099
107328
|
const bun = await findOnPath("bun");
|
|
107100
107329
|
if (!bun || !existsSync7(buildScript))
|
|
107101
107330
|
return;
|
|
@@ -107111,13 +107340,13 @@ async function ensureDevDist(entry2, dist) {
|
|
|
107111
107340
|
async function devDistIsStale(entry2, dist) {
|
|
107112
107341
|
if (!existsSync7(dist))
|
|
107113
107342
|
return true;
|
|
107114
|
-
const projectDir =
|
|
107343
|
+
const projectDir = join21(dirname14(entry2), "..");
|
|
107115
107344
|
const builtAt = statSync2(dist).mtimeMs;
|
|
107116
|
-
const directories = [
|
|
107345
|
+
const directories = [join21(projectDir, "src"), join21(projectDir, "bin"), join21(projectDir, "vendor")];
|
|
107117
107346
|
const files = [
|
|
107118
|
-
|
|
107119
|
-
|
|
107120
|
-
|
|
107347
|
+
join21(projectDir, "scripts", "build.ts"),
|
|
107348
|
+
join21(projectDir, "package.json"),
|
|
107349
|
+
join21(projectDir, "pnpm-lock.yaml")
|
|
107121
107350
|
];
|
|
107122
107351
|
for (const directory of directories) {
|
|
107123
107352
|
if (existsSync7(directory) && await newerThan(directory, builtAt))
|
|
@@ -107130,7 +107359,7 @@ async function newerThan(dir, mtimeMs) {
|
|
|
107130
107359
|
for (const item of entries) {
|
|
107131
107360
|
if (!item.isFile())
|
|
107132
107361
|
continue;
|
|
107133
|
-
if (statSync2(
|
|
107362
|
+
if (statSync2(join21(item.parentPath, item.name)).mtimeMs > mtimeMs)
|
|
107134
107363
|
return true;
|
|
107135
107364
|
}
|
|
107136
107365
|
return false;
|
|
@@ -107208,7 +107437,7 @@ async function startSessionLocked(view2, opts, kernelTarget, activeInstance, def
|
|
|
107208
107437
|
break;
|
|
107209
107438
|
await sleep2(POLL_MS2);
|
|
107210
107439
|
}
|
|
107211
|
-
const tail = await
|
|
107440
|
+
const tail = await readFile19(logPath(id), "utf8").catch(() => "");
|
|
107212
107441
|
await closeSession(live);
|
|
107213
107442
|
throw new Error(`View session server did not come up.${tail ? `
|
|
107214
107443
|
--- server log ---
|
|
@@ -107482,7 +107711,7 @@ Examples:
|
|
|
107482
107711
|
if (state2?.state === "failed") {
|
|
107483
107712
|
await reportOpened(record12, state2, mode, opts);
|
|
107484
107713
|
if (opts.debug) {
|
|
107485
|
-
const tail = await
|
|
107714
|
+
const tail = await readFile19(logPath(record12.id), "utf8").catch(() => "");
|
|
107486
107715
|
if (tail)
|
|
107487
107716
|
console.error(`--- server log ---
|
|
107488
107717
|
${tail.slice(-3000)}`);
|
|
@@ -107555,8 +107784,8 @@ var init_status = __esm(() => {
|
|
|
107555
107784
|
|
|
107556
107785
|
// src/lib/browser-retention.ts
|
|
107557
107786
|
import { readlinkSync as readlinkSync2 } from "node:fs";
|
|
107558
|
-
import { readdir as readdir6, rm as
|
|
107559
|
-
import { join as
|
|
107787
|
+
import { readdir as readdir6, rm as rm8, stat as stat3 } from "node:fs/promises";
|
|
107788
|
+
import { join as join22 } from "node:path";
|
|
107560
107789
|
function firstPositive(candidates) {
|
|
107561
107790
|
for (const candidate2 of candidates) {
|
|
107562
107791
|
if (candidate2 === undefined)
|
|
@@ -107584,7 +107813,7 @@ function isLive(pid) {
|
|
|
107584
107813
|
function heldByLiveBrowser(profileDir) {
|
|
107585
107814
|
let target2;
|
|
107586
107815
|
try {
|
|
107587
|
-
target2 = readlinkSync2(
|
|
107816
|
+
target2 = readlinkSync2(join22(profileDir, "SingletonLock"));
|
|
107588
107817
|
} catch {
|
|
107589
107818
|
return false;
|
|
107590
107819
|
}
|
|
@@ -107600,7 +107829,7 @@ async function directoryBytes(dir) {
|
|
|
107600
107829
|
}
|
|
107601
107830
|
let total = 0;
|
|
107602
107831
|
for (const entry2 of entries) {
|
|
107603
|
-
const path5 =
|
|
107832
|
+
const path5 = join22(dir, entry2.name);
|
|
107604
107833
|
if (entry2.isDirectory()) {
|
|
107605
107834
|
total += await directoryBytes(path5);
|
|
107606
107835
|
} else if (entry2.isFile()) {
|
|
@@ -107614,13 +107843,13 @@ async function directoryBytes(dir) {
|
|
|
107614
107843
|
async function profileCacheBytes(profileDir) {
|
|
107615
107844
|
let total = 0;
|
|
107616
107845
|
for (const relative2 of CACHE_PATHS)
|
|
107617
|
-
total += await directoryBytes(
|
|
107846
|
+
total += await directoryBytes(join22(profileDir, relative2));
|
|
107618
107847
|
return total;
|
|
107619
107848
|
}
|
|
107620
107849
|
async function purgeCache(profileDir) {
|
|
107621
107850
|
const before = await profileCacheBytes(profileDir);
|
|
107622
107851
|
for (const relative2 of CACHE_PATHS) {
|
|
107623
|
-
await
|
|
107852
|
+
await rm8(join22(profileDir, relative2), { recursive: true, force: true }).catch(() => {});
|
|
107624
107853
|
}
|
|
107625
107854
|
return before - await profileCacheBytes(profileDir);
|
|
107626
107855
|
}
|
|
@@ -107638,7 +107867,7 @@ async function sweepBrowserProfiles(options = {}) {
|
|
|
107638
107867
|
const now = options.now ?? Date.now();
|
|
107639
107868
|
const result = { removed: [], purged: [], skipped: [], bytesFreed: 0 };
|
|
107640
107869
|
for (const name of names) {
|
|
107641
|
-
const profileDir =
|
|
107870
|
+
const profileDir = join22(dir, name);
|
|
107642
107871
|
if (heldByLiveBrowser(profileDir)) {
|
|
107643
107872
|
result.skipped.push(name);
|
|
107644
107873
|
continue;
|
|
@@ -107647,7 +107876,7 @@ async function sweepBrowserProfiles(options = {}) {
|
|
|
107647
107876
|
const idleMs = now - (await stat3(profileDir)).mtime.getTime();
|
|
107648
107877
|
if (idleMs > budget.maxProfileAgeMs) {
|
|
107649
107878
|
result.bytesFreed += await directoryBytes(profileDir);
|
|
107650
|
-
await
|
|
107879
|
+
await rm8(profileDir, { recursive: true, force: true });
|
|
107651
107880
|
result.removed.push(name);
|
|
107652
107881
|
continue;
|
|
107653
107882
|
}
|
|
@@ -107865,7 +108094,7 @@ var exports_view_serve = {};
|
|
|
107865
108094
|
__export(exports_view_serve, {
|
|
107866
108095
|
default: () => view_serve_default
|
|
107867
108096
|
});
|
|
107868
|
-
import { readFile as
|
|
108097
|
+
import { readFile as readFile20 } from "node:fs/promises";
|
|
107869
108098
|
var view_serve_default;
|
|
107870
108099
|
var init_view_serve = __esm(() => {
|
|
107871
108100
|
init_server();
|
|
@@ -107877,7 +108106,7 @@ var init_view_serve = __esm(() => {
|
|
|
107877
108106
|
action: async (opts) => {
|
|
107878
108107
|
if (!opts.config)
|
|
107879
108108
|
throw new Error("--config is required");
|
|
107880
|
-
const config2 = JSON.parse(await
|
|
108109
|
+
const config2 = JSON.parse(await readFile20(opts.config, "utf8"));
|
|
107881
108110
|
startViewServer(config2);
|
|
107882
108111
|
console.log(`view session ${config2.session.id} listening on ${config2.session.pageUrl}`);
|
|
107883
108112
|
await new Promise(() => {});
|
|
@@ -107900,7 +108129,7 @@ __export(exports_studio, {
|
|
|
107900
108129
|
encodeStudioCliDescriptor: () => encodeStudioCliDescriptor
|
|
107901
108130
|
});
|
|
107902
108131
|
import { existsSync as existsSync10, realpathSync } from "node:fs";
|
|
107903
|
-
import { dirname as dirname15, join as
|
|
108132
|
+
import { dirname as dirname15, join as join23, resolve as resolve8 } from "node:path";
|
|
107904
108133
|
function encodeStudioCliDescriptor(executable = process.execPath, entry2 = process.argv[1]) {
|
|
107905
108134
|
const args = entry2 && entry2 !== executable && !entry2.startsWith("/$bunfs") && existsSync10(entry2) ? [realpathSync(entry2)] : [];
|
|
107906
108135
|
return JSON.stringify({ version: 1, executable, args });
|
|
@@ -107911,21 +108140,21 @@ function resolveStudioDir() {
|
|
|
107911
108140
|
candidates.push(process.env.ASTRALE_STUDIO_DIR);
|
|
107912
108141
|
try {
|
|
107913
108142
|
const entryDir = dirname15(realpathSync(process.argv[1] ?? ""));
|
|
107914
|
-
candidates.push(
|
|
108143
|
+
candidates.push(join23(entryDir, "..", "studio"), join23(entryDir, "studio"));
|
|
107915
108144
|
} catch {}
|
|
107916
108145
|
for (const c2 of candidates) {
|
|
107917
|
-
if (existsSync10(
|
|
108146
|
+
if (existsSync10(join23(c2, "server", "index.ts")))
|
|
107918
108147
|
return resolve8(c2);
|
|
107919
108148
|
}
|
|
107920
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.`);
|
|
107921
108150
|
}
|
|
107922
108151
|
function isDevSource(studioDir) {
|
|
107923
|
-
return existsSync10(
|
|
108152
|
+
return existsSync10(join23(studioDir, "vite.config.ts")) && existsSync10(join23(studioDir, "client", "src"));
|
|
107924
108153
|
}
|
|
107925
108154
|
function resolveViteBin(studioDir) {
|
|
107926
108155
|
for (const c2 of [
|
|
107927
|
-
|
|
107928
|
-
|
|
108156
|
+
join23(studioDir, "node_modules", ".bin", "vite"),
|
|
108157
|
+
join23(studioDir, "..", "..", "node_modules", ".bin", "vite")
|
|
107929
108158
|
]) {
|
|
107930
108159
|
if (existsSync10(c2))
|
|
107931
108160
|
return c2;
|
|
@@ -108284,7 +108513,7 @@ var init_model7 = __esm(() => {
|
|
|
108284
108513
|
|
|
108285
108514
|
// src/ui/lock.ts
|
|
108286
108515
|
import { createHash as createHash3 } from "node:crypto";
|
|
108287
|
-
import { readFile as
|
|
108516
|
+
import { readFile as readFile21 } from "node:fs/promises";
|
|
108288
108517
|
function digest5(value3) {
|
|
108289
108518
|
return createHash3("sha256").update(value3).digest("hex");
|
|
108290
108519
|
}
|
|
@@ -108322,7 +108551,7 @@ function pathIsAbsolute(value3) {
|
|
|
108322
108551
|
}
|
|
108323
108552
|
async function readUiLock(target2) {
|
|
108324
108553
|
try {
|
|
108325
|
-
return parseUiLock(JSON.parse(await
|
|
108554
|
+
return parseUiLock(JSON.parse(await readFile21(target2, "utf8")));
|
|
108326
108555
|
} catch (cause) {
|
|
108327
108556
|
if (cause instanceof UiError)
|
|
108328
108557
|
throw cause;
|
|
@@ -108722,7 +108951,7 @@ var require_util = __commonJS(function(exports, module) {
|
|
|
108722
108951
|
var require_parse = __commonJS(function(exports, module) {
|
|
108723
108952
|
var util = require_util();
|
|
108724
108953
|
var source2;
|
|
108725
|
-
var
|
|
108954
|
+
var parseState2;
|
|
108726
108955
|
var stack;
|
|
108727
108956
|
var pos;
|
|
108728
108957
|
var line;
|
|
@@ -108732,7 +108961,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
108732
108961
|
var root;
|
|
108733
108962
|
module.exports = function parse6(text13, reviver) {
|
|
108734
108963
|
source2 = String(text13);
|
|
108735
|
-
|
|
108964
|
+
parseState2 = "start";
|
|
108736
108965
|
stack = [];
|
|
108737
108966
|
pos = 0;
|
|
108738
108967
|
line = 1;
|
|
@@ -108742,7 +108971,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
108742
108971
|
root = undefined;
|
|
108743
108972
|
do {
|
|
108744
108973
|
token = lex();
|
|
108745
|
-
parseStates[
|
|
108974
|
+
parseStates[parseState2]();
|
|
108746
108975
|
} while (token.type !== "eof");
|
|
108747
108976
|
if (typeof reviver === "function") {
|
|
108748
108977
|
return internalize({ "": root }, "", reviver);
|
|
@@ -108852,7 +109081,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
108852
109081
|
read2();
|
|
108853
109082
|
return;
|
|
108854
109083
|
}
|
|
108855
|
-
return lexStates[
|
|
109084
|
+
return lexStates[parseState2]();
|
|
108856
109085
|
},
|
|
108857
109086
|
comment() {
|
|
108858
109087
|
switch (c2) {
|
|
@@ -109400,7 +109629,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
109400
109629
|
case "identifier":
|
|
109401
109630
|
case "string":
|
|
109402
109631
|
key = token.value;
|
|
109403
|
-
|
|
109632
|
+
parseState2 = "afterPropertyName";
|
|
109404
109633
|
return;
|
|
109405
109634
|
case "punctuator":
|
|
109406
109635
|
pop();
|
|
@@ -109413,7 +109642,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
109413
109642
|
if (token.type === "eof") {
|
|
109414
109643
|
throw invalidEOF();
|
|
109415
109644
|
}
|
|
109416
|
-
|
|
109645
|
+
parseState2 = "beforePropertyValue";
|
|
109417
109646
|
},
|
|
109418
109647
|
beforePropertyValue() {
|
|
109419
109648
|
if (token.type === "eof") {
|
|
@@ -109437,7 +109666,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
109437
109666
|
}
|
|
109438
109667
|
switch (token.value) {
|
|
109439
109668
|
case ",":
|
|
109440
|
-
|
|
109669
|
+
parseState2 = "beforePropertyName";
|
|
109441
109670
|
return;
|
|
109442
109671
|
case "}":
|
|
109443
109672
|
pop();
|
|
@@ -109449,7 +109678,7 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
109449
109678
|
}
|
|
109450
109679
|
switch (token.value) {
|
|
109451
109680
|
case ",":
|
|
109452
|
-
|
|
109681
|
+
parseState2 = "beforeArrayValue";
|
|
109453
109682
|
return;
|
|
109454
109683
|
case "]":
|
|
109455
109684
|
pop();
|
|
@@ -109495,18 +109724,18 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
109495
109724
|
if (value3 !== null && typeof value3 === "object") {
|
|
109496
109725
|
stack.push(value3);
|
|
109497
109726
|
if (Array.isArray(value3)) {
|
|
109498
|
-
|
|
109727
|
+
parseState2 = "beforeArrayValue";
|
|
109499
109728
|
} else {
|
|
109500
|
-
|
|
109729
|
+
parseState2 = "beforePropertyName";
|
|
109501
109730
|
}
|
|
109502
109731
|
} else {
|
|
109503
109732
|
const current = stack[stack.length - 1];
|
|
109504
109733
|
if (current == null) {
|
|
109505
|
-
|
|
109734
|
+
parseState2 = "end";
|
|
109506
109735
|
} else if (Array.isArray(current)) {
|
|
109507
|
-
|
|
109736
|
+
parseState2 = "afterArrayValue";
|
|
109508
109737
|
} else {
|
|
109509
|
-
|
|
109738
|
+
parseState2 = "afterPropertyValue";
|
|
109510
109739
|
}
|
|
109511
109740
|
}
|
|
109512
109741
|
}
|
|
@@ -109514,11 +109743,11 @@ var require_parse = __commonJS(function(exports, module) {
|
|
|
109514
109743
|
stack.pop();
|
|
109515
109744
|
const current = stack[stack.length - 1];
|
|
109516
109745
|
if (current == null) {
|
|
109517
|
-
|
|
109746
|
+
parseState2 = "end";
|
|
109518
109747
|
} else if (Array.isArray(current)) {
|
|
109519
|
-
|
|
109748
|
+
parseState2 = "afterArrayValue";
|
|
109520
109749
|
} else {
|
|
109521
|
-
|
|
109750
|
+
parseState2 = "afterPropertyValue";
|
|
109522
109751
|
}
|
|
109523
109752
|
}
|
|
109524
109753
|
function invalidChar(c3) {
|
|
@@ -110353,14 +110582,14 @@ var require_lib5 = __commonJS(function(exports) {
|
|
|
110353
110582
|
});
|
|
110354
110583
|
|
|
110355
110584
|
// src/ui/project.ts
|
|
110356
|
-
import { access as access2, lstat as lstat3, readFile as
|
|
110585
|
+
import { access as access2, lstat as lstat3, readFile as readFile22, realpath as realpath2 } from "node:fs/promises";
|
|
110357
110586
|
import path5 from "node:path";
|
|
110358
110587
|
async function exists(target2) {
|
|
110359
110588
|
return access2(target2).then(() => true, () => false);
|
|
110360
110589
|
}
|
|
110361
110590
|
async function readManifest(target2) {
|
|
110362
110591
|
try {
|
|
110363
|
-
return JSON.parse(await
|
|
110592
|
+
return JSON.parse(await readFile22(target2, "utf8"));
|
|
110364
110593
|
} catch (cause) {
|
|
110365
110594
|
throw new UiError("UI_PROJECT_UNSUPPORTED", "package.json is not valid JSON.", undefined, {
|
|
110366
110595
|
cause
|
|
@@ -110430,7 +110659,7 @@ async function resolveAlias(project2, candidate2) {
|
|
|
110430
110659
|
async function resolveUiRegistryTarget(project2, declaredTarget) {
|
|
110431
110660
|
if (!declaredTarget.startsWith("components/"))
|
|
110432
110661
|
return declaredTarget;
|
|
110433
|
-
const components = await
|
|
110662
|
+
const components = await readFile22(project2.componentsPath, "utf8").then((value3) => JSON.parse(value3)).catch(() => {
|
|
110434
110663
|
return;
|
|
110435
110664
|
});
|
|
110436
110665
|
const componentsAlias = components?.aliases?.components;
|
|
@@ -110500,30 +110729,30 @@ async function discoverUiProject(input = process.cwd()) {
|
|
|
110500
110729
|
const packageJsonPath = path5.join(root, "package.json");
|
|
110501
110730
|
const packageJson = await readManifest(packageJsonPath);
|
|
110502
110731
|
let manager = "npm";
|
|
110503
|
-
let
|
|
110732
|
+
let lockPath2;
|
|
110504
110733
|
for (const [file2, candidate2] of MANAGERS) {
|
|
110505
110734
|
const target2 = path5.join(root, file2);
|
|
110506
110735
|
if (await exists(target2)) {
|
|
110507
110736
|
manager = candidate2;
|
|
110508
|
-
|
|
110737
|
+
lockPath2 = target2;
|
|
110509
110738
|
break;
|
|
110510
110739
|
}
|
|
110511
110740
|
}
|
|
110512
110741
|
const declared = packageJson.packageManager;
|
|
110513
|
-
if (!
|
|
110742
|
+
if (!lockPath2 && typeof declared === "string") {
|
|
110514
110743
|
const candidate2 = declared.split("@")[0];
|
|
110515
110744
|
if (candidate2 === "pnpm" || candidate2 === "npm" || candidate2 === "yarn" || candidate2 === "bun") {
|
|
110516
110745
|
manager = candidate2;
|
|
110517
110746
|
}
|
|
110518
110747
|
}
|
|
110519
|
-
if (!
|
|
110748
|
+
if (!lockPath2) {
|
|
110520
110749
|
const expectedLock = {
|
|
110521
110750
|
pnpm: "pnpm-lock.yaml",
|
|
110522
110751
|
npm: "package-lock.json",
|
|
110523
110752
|
yarn: "yarn.lock",
|
|
110524
110753
|
bun: "bun.lock"
|
|
110525
110754
|
}[manager];
|
|
110526
|
-
|
|
110755
|
+
lockPath2 = path5.join(root, expectedLock);
|
|
110527
110756
|
}
|
|
110528
110757
|
const rootCssCandidates = ["src/index.css", "src/app.css", "app/globals.css", "src/styles.css"];
|
|
110529
110758
|
const frontendCssCandidates = [
|
|
@@ -110532,7 +110761,7 @@ async function discoverUiProject(input = process.cwd()) {
|
|
|
110532
110761
|
"frontend/src/styles.css"
|
|
110533
110762
|
];
|
|
110534
110763
|
const componentsPath = path5.join(root, "components.json");
|
|
110535
|
-
const configuredCss = await
|
|
110764
|
+
const configuredCss = await readFile22(componentsPath, "utf8").then((value3) => {
|
|
110536
110765
|
const components = JSON.parse(value3);
|
|
110537
110766
|
const css = components.tailwind?.css;
|
|
110538
110767
|
if (typeof css !== "string" || css.length === 0)
|
|
@@ -110558,7 +110787,7 @@ async function discoverUiProject(input = process.cwd()) {
|
|
|
110558
110787
|
packageJsonPath,
|
|
110559
110788
|
packageJson,
|
|
110560
110789
|
manager,
|
|
110561
|
-
lockPath,
|
|
110790
|
+
lockPath: lockPath2,
|
|
110562
110791
|
cssPath: path5.join(root, cssRelative),
|
|
110563
110792
|
componentsPath,
|
|
110564
110793
|
uiLockPath: path5.join(root, "astrale-ui.lock.json"),
|
|
@@ -110843,13 +111072,13 @@ var init_runner = __esm(() => {
|
|
|
110843
111072
|
});
|
|
110844
111073
|
|
|
110845
111074
|
// src/ui/operations.ts
|
|
110846
|
-
import { access as access3, lstat as lstat4, mkdir as mkdir13, readFile as
|
|
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";
|
|
110847
111076
|
import path6 from "node:path";
|
|
110848
111077
|
async function exists2(target2) {
|
|
110849
111078
|
return access3(target2).then(() => true, () => false);
|
|
110850
111079
|
}
|
|
110851
111080
|
async function readOptional(target2) {
|
|
110852
|
-
return
|
|
111081
|
+
return readFile23(target2, "utf8").catch(() => {
|
|
110853
111082
|
return;
|
|
110854
111083
|
});
|
|
110855
111084
|
}
|
|
@@ -110963,7 +111192,7 @@ async function appendPnpmWorkspace(project2, workspace) {
|
|
|
110963
111192
|
async function hasDomainRegistryWorkspace(project2) {
|
|
110964
111193
|
if (!project2.isAstraleDomain || !await exists2(domainRegistryPackagePath(project2)))
|
|
110965
111194
|
return false;
|
|
110966
|
-
const registryManifest = JSON.parse(await
|
|
111195
|
+
const registryManifest = JSON.parse(await readFile23(domainRegistryPackagePath(project2), "utf8"));
|
|
110967
111196
|
if (registryManifest.private !== true || typeof registryManifest.name !== "string" || registryManifest.name === UI_PACKAGE || registryManifest.name === project2.packageJson.name) {
|
|
110968
111197
|
return false;
|
|
110969
111198
|
}
|
|
@@ -111143,13 +111372,13 @@ async function initUi(options, dependencies = {}) {
|
|
|
111143
111372
|
if (value3 !== undefined)
|
|
111144
111373
|
await writeFile9(target2, value3, "utf8");
|
|
111145
111374
|
else
|
|
111146
|
-
await
|
|
111375
|
+
await rm9(target2, { force: true });
|
|
111147
111376
|
}
|
|
111148
111377
|
throw error52;
|
|
111149
111378
|
}
|
|
111150
111379
|
}
|
|
111151
111380
|
async function pinUiDependency(project2, version2, section, runner) {
|
|
111152
|
-
const manifest = JSON.parse(await
|
|
111381
|
+
const manifest = JSON.parse(await readFile23(project2.packageJsonPath, "utf8"));
|
|
111153
111382
|
const current = manifestDependencies(manifest, section)[UI_PACKAGE];
|
|
111154
111383
|
const other = section === "dependencies" ? "devDependencies" : "dependencies";
|
|
111155
111384
|
if (current === version2 && manifestDependencies(manifest, other)[UI_PACKAGE] === undefined)
|
|
@@ -111187,7 +111416,7 @@ async function addLocalTheme(address, project2, options) {
|
|
|
111187
111416
|
if (!THEME_SLUG.test(slug)) {
|
|
111188
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.");
|
|
111189
111418
|
}
|
|
111190
|
-
const source2 = await
|
|
111419
|
+
const source2 = await readFile23(sourcePath, "utf8");
|
|
111191
111420
|
admitLocalThemeCss(source2, slug);
|
|
111192
111421
|
return installThemeCss(slug, source2, digest5(source2), address, project2, options);
|
|
111193
111422
|
}
|
|
@@ -111236,7 +111465,7 @@ async function installThemeCss(slug, source2, sourceDigest, sourceLabel, project
|
|
|
111236
111465
|
} catch (error52) {
|
|
111237
111466
|
for (const [mutation, previous] of snapshots) {
|
|
111238
111467
|
if (previous === undefined)
|
|
111239
|
-
await
|
|
111468
|
+
await rm9(mutation, { force: true });
|
|
111240
111469
|
else
|
|
111241
111470
|
await writeFile9(mutation, previous, "utf8");
|
|
111242
111471
|
}
|
|
@@ -111331,7 +111560,7 @@ async function addUi(addresses, options, dependencies = {}) {
|
|
|
111331
111560
|
} catch (error52) {
|
|
111332
111561
|
for (const [target2, previous] of snapshots) {
|
|
111333
111562
|
if (previous === undefined)
|
|
111334
|
-
await
|
|
111563
|
+
await rm9(target2, { force: true });
|
|
111335
111564
|
else
|
|
111336
111565
|
await writeFile9(target2, previous, "utf8");
|
|
111337
111566
|
}
|
|
@@ -111362,7 +111591,7 @@ async function addUi(addresses, options, dependencies = {}) {
|
|
|
111362
111591
|
if (!file2.target)
|
|
111363
111592
|
continue;
|
|
111364
111593
|
const target2 = await safeTarget(project2, resolvedTargets.get(file2.target));
|
|
111365
|
-
files[projectRelative(project2, target2)] = digest5(await
|
|
111594
|
+
files[projectRelative(project2, target2)] = digest5(await readFile23(target2));
|
|
111366
111595
|
}
|
|
111367
111596
|
lock.items[item.meta.canonicalAddress] = {
|
|
111368
111597
|
address: item.meta.canonicalAddress,
|
|
@@ -111374,7 +111603,7 @@ async function addUi(addresses, options, dependencies = {}) {
|
|
|
111374
111603
|
} catch (error52) {
|
|
111375
111604
|
for (const [target2, previous] of snapshots) {
|
|
111376
111605
|
if (previous === undefined)
|
|
111377
|
-
await
|
|
111606
|
+
await rm9(target2, { force: true });
|
|
111378
111607
|
else
|
|
111379
111608
|
await writeFile9(target2, previous, "utf8");
|
|
111380
111609
|
}
|
|
@@ -111394,7 +111623,7 @@ async function doctorUi(input) {
|
|
|
111394
111623
|
const checks3 = [];
|
|
111395
111624
|
let lock;
|
|
111396
111625
|
try {
|
|
111397
|
-
lock = parseUiLock(JSON.parse(await
|
|
111626
|
+
lock = parseUiLock(JSON.parse(await readFile23(project2.uiLockPath, "utf8")));
|
|
111398
111627
|
checks3.push({ check: "lock", ok: true });
|
|
111399
111628
|
} catch (error52) {
|
|
111400
111629
|
checks3.push({
|
|
@@ -111422,7 +111651,7 @@ async function doctorUi(input) {
|
|
|
111422
111651
|
if (lock) {
|
|
111423
111652
|
for (const item of Object.values(lock.items)) {
|
|
111424
111653
|
for (const [file2, expected] of Object.entries(item.files)) {
|
|
111425
|
-
const actual = await
|
|
111654
|
+
const actual = await readFile23(path6.join(project2.root, file2)).then(digest5).catch(() => "");
|
|
111426
111655
|
checks3.push({ check: "item:" + item.address + ":" + file2, ok: actual === expected });
|
|
111427
111656
|
}
|
|
111428
111657
|
}
|
|
@@ -111475,7 +111704,7 @@ async function rejectLocalChanges(project2, lock, items, overwrite) {
|
|
|
111475
111704
|
if (!installed)
|
|
111476
111705
|
continue;
|
|
111477
111706
|
for (const [file2, expected] of Object.entries(installed.files)) {
|
|
111478
|
-
const actual = await
|
|
111707
|
+
const actual = await readFile23(path6.join(project2.root, file2)).then(digest5).catch(() => "");
|
|
111479
111708
|
if (actual !== expected) {
|
|
111480
111709
|
throw new UiError("UI_LOCAL_CHANGES", "Installed UI file has local changes: " + file2, "Review the file, then repeat add with explicit --overwrite --yes.");
|
|
111481
111710
|
}
|
|
@@ -111775,7 +112004,7 @@ var init_model8 = __esm(() => {
|
|
|
111775
112004
|
|
|
111776
112005
|
// src/ui/search/artifacts.ts
|
|
111777
112006
|
import { createHash as createHash5 } from "node:crypto";
|
|
111778
|
-
import { readFile as
|
|
112007
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
111779
112008
|
import { homedir as homedir6 } from "node:os";
|
|
111780
112009
|
import path7 from "node:path";
|
|
111781
112010
|
function cacheBase(commit, configured) {
|
|
@@ -111832,14 +112061,14 @@ function verify3(bytes, file2) {
|
|
|
111832
112061
|
return bytes.byteLength === file2.bytes && createHash5("sha256").update(bytes).digest("hex") === file2.sha256;
|
|
111833
112062
|
}
|
|
111834
112063
|
async function readVerifiedCache(target2, file2) {
|
|
111835
|
-
const bytes = await
|
|
112064
|
+
const bytes = await readFile24(target2).catch(() => {
|
|
111836
112065
|
return;
|
|
111837
112066
|
});
|
|
111838
112067
|
return bytes && verify3(bytes, file2) ? bytes : undefined;
|
|
111839
112068
|
}
|
|
111840
112069
|
async function readManifestCache(target2) {
|
|
111841
112070
|
try {
|
|
111842
|
-
return acceptSearchManifest(JSON.parse(await
|
|
112071
|
+
return acceptSearchManifest(JSON.parse(await readFile24(target2, "utf8")));
|
|
111843
112072
|
} catch {
|
|
111844
112073
|
return;
|
|
111845
112074
|
}
|
|
@@ -114174,9 +114403,9 @@ __export(exports_register, {
|
|
|
114174
114403
|
formatIdentityRegistration: () => formatIdentityRegistration,
|
|
114175
114404
|
prepareIdentityProvision: () => prepareIdentityProvision
|
|
114176
114405
|
});
|
|
114177
|
-
import { readFile as
|
|
114406
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
114178
114407
|
async function readJwk(path9) {
|
|
114179
|
-
return JSON.parse(await
|
|
114408
|
+
return JSON.parse(await readFile25(path9, "utf8"));
|
|
114180
114409
|
}
|
|
114181
114410
|
function formatIdentityRegistration(result, format3, machine) {
|
|
114182
114411
|
output(result, format3);
|
|
@@ -114191,7 +114420,7 @@ async function prepareIdentityProvision(input) {
|
|
|
114191
114420
|
builder.createNode({ as: binding6, class: input.classPath, props: input.properties });
|
|
114192
114421
|
return;
|
|
114193
114422
|
});
|
|
114194
|
-
const registrationKey =
|
|
114423
|
+
const registrationKey = await derivedIdempotencyKey("identity-register", input.name);
|
|
114195
114424
|
const unsigned = exports_provision.accept({
|
|
114196
114425
|
idempotencyKey: registrationKey,
|
|
114197
114426
|
mutation,
|
|
@@ -114584,7 +114813,7 @@ var exports_import = {};
|
|
|
114584
114813
|
__export(exports_import, {
|
|
114585
114814
|
default: () => import_default
|
|
114586
114815
|
});
|
|
114587
|
-
import { readFile as
|
|
114816
|
+
import { readFile as readFile26 } from "node:fs/promises";
|
|
114588
114817
|
var import_default;
|
|
114589
114818
|
var init_import2 = __esm(() => {
|
|
114590
114819
|
init_identity7();
|
|
@@ -114612,7 +114841,7 @@ var init_import2 = __esm(() => {
|
|
|
114612
114841
|
],
|
|
114613
114842
|
action: async (path9, opts) => {
|
|
114614
114843
|
try {
|
|
114615
|
-
const raw2 = await
|
|
114844
|
+
const raw2 = await readFile26(path9, "utf-8");
|
|
114616
114845
|
const passphrase = isEncryptedIdentityExport(raw2) ? await readPassphrase("Passphrase: ") : undefined;
|
|
114617
114846
|
const envelope = await decodeIdentityExport(raw2, passphrase);
|
|
114618
114847
|
const name = opts.name ?? envelope.subject;
|
|
@@ -114967,21 +115196,21 @@ var init_status5 = __esm(() => {
|
|
|
114967
115196
|
|
|
114968
115197
|
// src/telemetry/store.ts
|
|
114969
115198
|
import { existsSync as existsSync11, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync3 } from "node:fs";
|
|
114970
|
-
import { join as
|
|
115199
|
+
import { join as join24 } from "node:path";
|
|
114971
115200
|
function sessionsRoot() {
|
|
114972
|
-
return
|
|
115201
|
+
return join24(createPaths().home, "sessions");
|
|
114973
115202
|
}
|
|
114974
115203
|
function sessionDir(id) {
|
|
114975
|
-
return
|
|
115204
|
+
return join24(sessionsRoot(), id);
|
|
114976
115205
|
}
|
|
114977
115206
|
function eventsPath(id) {
|
|
114978
|
-
return
|
|
115207
|
+
return join24(sessionDir(id), "events.jsonl");
|
|
114979
115208
|
}
|
|
114980
115209
|
function metaPath(id) {
|
|
114981
|
-
return
|
|
115210
|
+
return join24(sessionDir(id), "meta.json");
|
|
114982
115211
|
}
|
|
114983
115212
|
function markerPath(id) {
|
|
114984
|
-
return
|
|
115213
|
+
return join24(sessionDir(id), ".analyzed");
|
|
114985
115214
|
}
|
|
114986
115215
|
function sessionIds() {
|
|
114987
115216
|
try {
|
|
@@ -115013,7 +115242,7 @@ function directoryBytes2(dir) {
|
|
|
115013
115242
|
}
|
|
115014
115243
|
let total = 0;
|
|
115015
115244
|
for (const entry2 of entries) {
|
|
115016
|
-
const path9 =
|
|
115245
|
+
const path9 = join24(dir, entry2.name);
|
|
115017
115246
|
if (entry2.isDirectory()) {
|
|
115018
115247
|
total += directoryBytes2(path9);
|
|
115019
115248
|
} else if (entry2.isFile()) {
|
|
@@ -115103,12 +115332,12 @@ var init_list4 = __esm(() => {
|
|
|
115103
115332
|
// src/telemetry/adapters/claude-code.ts
|
|
115104
115333
|
import { existsSync as existsSync12, readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
|
|
115105
115334
|
import { homedir as homedir7 } from "node:os";
|
|
115106
|
-
import { join as
|
|
115335
|
+
import { join as join25 } from "node:path";
|
|
115107
115336
|
function mungeCwd(cwd) {
|
|
115108
115337
|
return cwd.replace(/[^a-zA-Z0-9]/g, "-");
|
|
115109
115338
|
}
|
|
115110
|
-
function claudeCodeAdapter(base2 =
|
|
115111
|
-
const projectsDir =
|
|
115339
|
+
function claudeCodeAdapter(base2 = join25(homedir7(), ".claude")) {
|
|
115340
|
+
const projectsDir = join25(base2, "projects");
|
|
115112
115341
|
function detect2() {
|
|
115113
115342
|
try {
|
|
115114
115343
|
return existsSync12(projectsDir);
|
|
@@ -115132,7 +115361,7 @@ function claudeCodeAdapter(base2 = join24(homedir7(), ".claude")) {
|
|
|
115132
115361
|
for (const dir of dirs) {
|
|
115133
115362
|
if (dir !== munged && !dir.startsWith(prefix))
|
|
115134
115363
|
continue;
|
|
115135
|
-
const projectPath =
|
|
115364
|
+
const projectPath = join25(projectsDir, dir);
|
|
115136
115365
|
let files;
|
|
115137
115366
|
try {
|
|
115138
115367
|
files = readdirSync3(projectPath);
|
|
@@ -115142,7 +115371,7 @@ function claudeCodeAdapter(base2 = join24(homedir7(), ".claude")) {
|
|
|
115142
115371
|
for (const file2 of files) {
|
|
115143
115372
|
if (!file2.endsWith(".jsonl"))
|
|
115144
115373
|
continue;
|
|
115145
|
-
const transcriptPath =
|
|
115374
|
+
const transcriptPath = join25(projectPath, file2);
|
|
115146
115375
|
try {
|
|
115147
115376
|
const st = statSync4(transcriptPath);
|
|
115148
115377
|
const mtimeMs = st.mtime.getTime();
|
|
@@ -115178,7 +115407,7 @@ var init_claude_code = __esm(() => {
|
|
|
115178
115407
|
import { existsSync as existsSync13, openSync as openSync3, readdirSync as readdirSync4, readSync, statSync as statSync5 } from "node:fs";
|
|
115179
115408
|
import { closeSync as closeSync4 } from "node:fs";
|
|
115180
115409
|
import { homedir as homedir8 } from "node:os";
|
|
115181
|
-
import { join as
|
|
115410
|
+
import { join as join26 } from "node:path";
|
|
115182
115411
|
function readFirstLine(path9) {
|
|
115183
115412
|
let fd = null;
|
|
115184
115413
|
try {
|
|
@@ -115218,8 +115447,8 @@ function numericDirs(path9) {
|
|
|
115218
115447
|
return [];
|
|
115219
115448
|
}
|
|
115220
115449
|
}
|
|
115221
|
-
function codexAdapter(base2 =
|
|
115222
|
-
const sessionsDir =
|
|
115450
|
+
function codexAdapter(base2 = join26(homedir8(), ".codex")) {
|
|
115451
|
+
const sessionsDir = join26(base2, "sessions");
|
|
115223
115452
|
function detect2() {
|
|
115224
115453
|
try {
|
|
115225
115454
|
return existsSync13(sessionsDir);
|
|
@@ -115232,14 +115461,14 @@ function codexAdapter(base2 = join25(homedir8(), ".codex")) {
|
|
|
115232
115461
|
try {
|
|
115233
115462
|
const startMs = window2.start.getTime();
|
|
115234
115463
|
const endMs = window2.end.getTime();
|
|
115235
|
-
const lowerMs = startMs -
|
|
115464
|
+
const lowerMs = startMs - DAY_MS2;
|
|
115236
115465
|
for (const yyyy of numericDirs(sessionsDir)) {
|
|
115237
|
-
for (const mm of numericDirs(
|
|
115238
|
-
for (const dd of numericDirs(
|
|
115466
|
+
for (const mm of numericDirs(join26(sessionsDir, yyyy))) {
|
|
115467
|
+
for (const dd of numericDirs(join26(sessionsDir, yyyy, mm))) {
|
|
115239
115468
|
const dayStart = Date.UTC(Number(yyyy), Number(mm) - 1, Number(dd));
|
|
115240
|
-
if (dayStart > endMs +
|
|
115469
|
+
if (dayStart > endMs + DAY_MS2 || dayStart + DAY_MS2 <= lowerMs)
|
|
115241
115470
|
continue;
|
|
115242
|
-
scanDay(
|
|
115471
|
+
scanDay(join26(sessionsDir, yyyy, mm, dd), root, startMs, endMs, sessions);
|
|
115243
115472
|
}
|
|
115244
115473
|
}
|
|
115245
115474
|
}
|
|
@@ -115261,7 +115490,7 @@ function scanDay(dayPath, root, startMs, endMs, out) {
|
|
|
115261
115490
|
for (const file2 of files) {
|
|
115262
115491
|
if (!file2.startsWith("rollout-") || !file2.endsWith(".jsonl"))
|
|
115263
115492
|
continue;
|
|
115264
|
-
const transcriptPath =
|
|
115493
|
+
const transcriptPath = join26(dayPath, file2);
|
|
115265
115494
|
try {
|
|
115266
115495
|
const st = statSync5(transcriptPath);
|
|
115267
115496
|
const mtimeMs = st.mtime.getTime();
|
|
@@ -115298,9 +115527,9 @@ function scanDay(dayPath, root, startMs, endMs, out) {
|
|
|
115298
115527
|
} catch {}
|
|
115299
115528
|
}
|
|
115300
115529
|
}
|
|
115301
|
-
var
|
|
115530
|
+
var DAY_MS2, HEAD_CHUNK, MAX_HEAD_BYTES, READING_GUIDE2;
|
|
115302
115531
|
var init_codex = __esm(() => {
|
|
115303
|
-
|
|
115532
|
+
DAY_MS2 = 24 * 60 * 60 * 1000;
|
|
115304
115533
|
HEAD_CHUNK = 64 * 1024;
|
|
115305
115534
|
MAX_HEAD_BYTES = 512 * 1024;
|
|
115306
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.";
|
|
@@ -115447,7 +115676,7 @@ var init_settings = __esm(() => {
|
|
|
115447
115676
|
|
|
115448
115677
|
// src/telemetry/retention.ts
|
|
115449
115678
|
import { readdirSync as readdirSync5, rmSync as rmSync2 } from "node:fs";
|
|
115450
|
-
import { join as
|
|
115679
|
+
import { join as join27 } from "node:path";
|
|
115451
115680
|
function tidySession(id, options = {}) {
|
|
115452
115681
|
const dir = sessionDir(id);
|
|
115453
115682
|
let entries;
|
|
@@ -115463,7 +115692,7 @@ function tidySession(id, options = {}) {
|
|
|
115463
115692
|
if (entry2.name === ANALYZER_PROMPT && options.keepPrompt === true)
|
|
115464
115693
|
continue;
|
|
115465
115694
|
try {
|
|
115466
|
-
rmSync2(
|
|
115695
|
+
rmSync2(join27(dir, entry2.name), { recursive: true, force: true });
|
|
115467
115696
|
removed.push(entry2.name);
|
|
115468
115697
|
} catch {}
|
|
115469
115698
|
}
|
|
@@ -115539,7 +115768,7 @@ var init_retention = __esm(() => {
|
|
|
115539
115768
|
// src/telemetry/analyze.ts
|
|
115540
115769
|
import { spawn as spawn3 } from "node:child_process";
|
|
115541
115770
|
import { writeFileSync as writeFileSync3 } from "node:fs";
|
|
115542
|
-
import { join as
|
|
115771
|
+
import { join as join28 } from "node:path";
|
|
115543
115772
|
function writeMarker(id, marker) {
|
|
115544
115773
|
writeFileSync3(markerPath(id), JSON.stringify(marker, null, 2) + `
|
|
115545
115774
|
`);
|
|
@@ -115646,7 +115875,7 @@ async function analyzeSession(id, opts = {}) {
|
|
|
115646
115875
|
const guides = new Map(adapters.map((a) => [a.name, a.readingGuide]));
|
|
115647
115876
|
const prompt = buildPrompt({ id, root, signals: signals2, guides, file: opts.file ?? false });
|
|
115648
115877
|
const dir = sessionDir(id);
|
|
115649
|
-
writeFileSync3(
|
|
115878
|
+
writeFileSync3(join28(dir, "analyzer-prompt.md"), prompt);
|
|
115650
115879
|
const outcome = await runClaude(prompt, dir, opts);
|
|
115651
115880
|
const marker = {
|
|
115652
115881
|
analyzedAt: new Date().toISOString(),
|
|
@@ -115655,7 +115884,7 @@ async function analyzeSession(id, opts = {}) {
|
|
|
115655
115884
|
};
|
|
115656
115885
|
writeMarker(id, marker);
|
|
115657
115886
|
tidySession(id, { keepPrompt: marker.outcome === "error" });
|
|
115658
|
-
return { ...marker, reportPath:
|
|
115887
|
+
return { ...marker, reportPath: join28(dir, "report.md") };
|
|
115659
115888
|
}
|
|
115660
115889
|
function runClaude(prompt, cwd, opts) {
|
|
115661
115890
|
return new Promise((resolve9) => {
|
|
@@ -115685,7 +115914,7 @@ function runClaude(prompt, cwd, opts) {
|
|
|
115685
115914
|
child3.on("close", (code) => {
|
|
115686
115915
|
clearTimeout(timer);
|
|
115687
115916
|
try {
|
|
115688
|
-
writeFileSync3(
|
|
115917
|
+
writeFileSync3(join28(cwd, "analyzer.log"), clampLog(out + (err ? `
|
|
115689
115918
|
--- stderr ---
|
|
115690
115919
|
${err}` : "")));
|
|
115691
115920
|
} catch {}
|
|
@@ -115718,18 +115947,18 @@ var init_analyze = __esm(() => {
|
|
|
115718
115947
|
|
|
115719
115948
|
// src/telemetry/trigger.ts
|
|
115720
115949
|
import { existsSync as existsSync14, mkdirSync as mkdirSync4, readFileSync as readFileSync7, unlinkSync as unlinkSync3, writeFileSync as writeFileSync4 } from "node:fs";
|
|
115721
|
-
import { join as
|
|
115722
|
-
function
|
|
115723
|
-
return
|
|
115950
|
+
import { join as join29 } from "node:path";
|
|
115951
|
+
function lockPath2() {
|
|
115952
|
+
return join29(sessionsRoot(), ".analyzer.lock");
|
|
115724
115953
|
}
|
|
115725
115954
|
function releaseLock() {
|
|
115726
115955
|
try {
|
|
115727
|
-
unlinkSync3(
|
|
115956
|
+
unlinkSync3(lockPath2());
|
|
115728
115957
|
} catch {}
|
|
115729
115958
|
}
|
|
115730
115959
|
function restampLock() {
|
|
115731
115960
|
try {
|
|
115732
|
-
writeFileSync4(
|
|
115961
|
+
writeFileSync4(lockPath2(), JSON.stringify({ pid: process.pid, at: Date.now() }));
|
|
115733
115962
|
} catch {}
|
|
115734
115963
|
}
|
|
115735
115964
|
var LOCK_STALE_MS;
|
|
@@ -115816,7 +116045,7 @@ var exports_add2 = {};
|
|
|
115816
116045
|
__export(exports_add2, {
|
|
115817
116046
|
default: () => add_default2
|
|
115818
116047
|
});
|
|
115819
|
-
import { readFile as
|
|
116048
|
+
import { readFile as readFile27 } from "node:fs/promises";
|
|
115820
116049
|
function isString(value3) {
|
|
115821
116050
|
return typeof value3 === "string";
|
|
115822
116051
|
}
|
|
@@ -115878,7 +116107,7 @@ Security:
|
|
|
115878
116107
|
if (!opts.issuer && !opts.metadata && !opts.workosAuthkit) {
|
|
115879
116108
|
throw new Error("Either --issuer, --metadata, or --workos-authkit is required");
|
|
115880
116109
|
}
|
|
115881
|
-
let metadata = opts.workosAuthkit ? workosAuthKitMetadata(opts.workosApiHostname, opts.clientId) : opts.metadata ? OidcMetadataSchema.parse(JSON.parse(await
|
|
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);
|
|
115882
116111
|
if (opts.issuer) {
|
|
115883
116112
|
validateUrl(opts.issuer);
|
|
115884
116113
|
if (normalizeIssuer2(metadata.issuer) !== normalizeIssuer2(opts.issuer)) {
|
|
@@ -116254,9 +116483,9 @@ import {
|
|
|
116254
116483
|
rmSync as rmSync3,
|
|
116255
116484
|
writeFileSync as writeFileSync7
|
|
116256
116485
|
} from "node:fs";
|
|
116257
|
-
import { dirname as dirname17, join as
|
|
116486
|
+
import { dirname as dirname17, join as join33, relative as relative2, resolve as resolve9, sep } from "node:path";
|
|
116258
116487
|
function dotDir(domainRoot) {
|
|
116259
|
-
return
|
|
116488
|
+
return join33(domainRoot, DOT);
|
|
116260
116489
|
}
|
|
116261
116490
|
function assertInsideDot(domainRoot, target2) {
|
|
116262
116491
|
const abs = resolve9(target2);
|
|
@@ -116276,7 +116505,7 @@ function assertInsideDot(domainRoot, target2) {
|
|
|
116276
116505
|
let prefix = root;
|
|
116277
116506
|
for (const part of ["", ...parts]) {
|
|
116278
116507
|
if (part)
|
|
116279
|
-
prefix =
|
|
116508
|
+
prefix = join33(prefix, part);
|
|
116280
116509
|
try {
|
|
116281
116510
|
lstatSync2(prefix);
|
|
116282
116511
|
} catch (error52) {
|
|
@@ -116298,13 +116527,13 @@ function assertInsideDot(domainRoot, target2) {
|
|
|
116298
116527
|
return abs;
|
|
116299
116528
|
}
|
|
116300
116529
|
function ensureDir(domainRoot, subpath = "") {
|
|
116301
|
-
const target2 = subpath ?
|
|
116530
|
+
const target2 = subpath ? join33(dotDir(domainRoot), subpath) : dotDir(domainRoot);
|
|
116302
116531
|
assertInsideDot(domainRoot, target2);
|
|
116303
116532
|
mkdirSync7(target2, { recursive: true });
|
|
116304
116533
|
return target2;
|
|
116305
116534
|
}
|
|
116306
116535
|
function writeState(domainRoot, subpath, contents) {
|
|
116307
|
-
const target2 =
|
|
116536
|
+
const target2 = join33(dotDir(domainRoot), subpath);
|
|
116308
116537
|
const abs = assertInsideDot(domainRoot, target2);
|
|
116309
116538
|
mkdirSync7(dirname17(abs), { recursive: true });
|
|
116310
116539
|
writeFileSync7(abs, contents);
|
|
@@ -116313,16 +116542,16 @@ function writeJson2(domainRoot, subpath, value3) {
|
|
|
116313
116542
|
writeState(domainRoot, subpath, JSON.stringify(value3, null, 2));
|
|
116314
116543
|
}
|
|
116315
116544
|
function writeStateBuffer(domainRoot, subpath, data4) {
|
|
116316
|
-
const target2 =
|
|
116545
|
+
const target2 = join33(dotDir(domainRoot), subpath);
|
|
116317
116546
|
const abs = assertInsideDot(domainRoot, target2);
|
|
116318
116547
|
mkdirSync7(dirname17(abs), { recursive: true });
|
|
116319
116548
|
writeFileSync7(abs, data4);
|
|
116320
116549
|
}
|
|
116321
|
-
function
|
|
116322
|
-
return assertInsideDot(domainRoot,
|
|
116550
|
+
function statePath2(domainRoot, subpath) {
|
|
116551
|
+
return assertInsideDot(domainRoot, join33(dotDir(domainRoot), subpath));
|
|
116323
116552
|
}
|
|
116324
116553
|
function readState(domainRoot, subpath) {
|
|
116325
|
-
const target2 = assertInsideDot(domainRoot,
|
|
116554
|
+
const target2 = assertInsideDot(domainRoot, join33(dotDir(domainRoot), subpath));
|
|
116326
116555
|
if (!existsSync18(target2))
|
|
116327
116556
|
return null;
|
|
116328
116557
|
return readFileSync10(target2, "utf8");
|
|
@@ -116337,19 +116566,19 @@ function readJson2(domainRoot, subpath, decode12, fallback) {
|
|
|
116337
116566
|
return decode12(parsed) ?? fallback;
|
|
116338
116567
|
}
|
|
116339
116568
|
function listState(domainRoot, subpath) {
|
|
116340
|
-
const target2 = assertInsideDot(domainRoot,
|
|
116569
|
+
const target2 = assertInsideDot(domainRoot, join33(dotDir(domainRoot), subpath));
|
|
116341
116570
|
if (!existsSync18(target2))
|
|
116342
116571
|
return [];
|
|
116343
116572
|
return readdirSync7(target2);
|
|
116344
116573
|
}
|
|
116345
116574
|
function removeState(domainRoot, subpath) {
|
|
116346
|
-
const target2 =
|
|
116575
|
+
const target2 = join33(dotDir(domainRoot), subpath);
|
|
116347
116576
|
const abs = assertInsideDot(domainRoot, target2);
|
|
116348
116577
|
if (existsSync18(abs))
|
|
116349
116578
|
rmSync3(abs, { recursive: true, force: true });
|
|
116350
116579
|
}
|
|
116351
116580
|
function stateExists(domainRoot, subpath) {
|
|
116352
|
-
return existsSync18(assertInsideDot(domainRoot,
|
|
116581
|
+
return existsSync18(assertInsideDot(domainRoot, join33(dotDir(domainRoot), subpath)));
|
|
116353
116582
|
}
|
|
116354
116583
|
function initDotDir(domainRoot) {
|
|
116355
116584
|
ensureDir(domainRoot);
|
|
@@ -116838,7 +117067,7 @@ var init_routes2 = __esm(() => {
|
|
|
116838
117067
|
// studio/server/agent/bridge/grant.ts
|
|
116839
117068
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
116840
117069
|
import { chmodSync as chmodSync2 } from "node:fs";
|
|
116841
|
-
import { join as
|
|
117070
|
+
import { join as join34 } from "node:path";
|
|
116842
117071
|
function setBridgePort(port) {
|
|
116843
117072
|
studioPort = port;
|
|
116844
117073
|
}
|
|
@@ -116849,7 +117078,7 @@ function startBridge(handle, notify) {
|
|
|
116849
117078
|
const base2 = `http://127.0.0.1:${studioPort}/api/domain/${encodeURIComponent(handle.id)}/agent/bridge`;
|
|
116850
117079
|
const bridgeRel = `.cache/agent/bridge-${fileId}.json`;
|
|
116851
117080
|
writeJson2(handle.root, bridgeRel, { base: base2, token });
|
|
116852
|
-
const bridgeConfigPath =
|
|
117081
|
+
const bridgeConfigPath = statePath2(handle.root, bridgeRel);
|
|
116853
117082
|
chmodSync2(bridgeConfigPath, 384);
|
|
116854
117083
|
let bridgeCommand;
|
|
116855
117084
|
try {
|
|
@@ -116906,7 +117135,7 @@ var init_grant2 = __esm(() => {
|
|
|
116906
117135
|
raise_question: "raise_question"
|
|
116907
117136
|
};
|
|
116908
117137
|
studioPort = Number(process.env.PORT) || 4319;
|
|
116909
|
-
MCP_SERVER =
|
|
117138
|
+
MCP_SERVER = join34(import.meta.dir, "stdio.ts");
|
|
116910
117139
|
});
|
|
116911
117140
|
|
|
116912
117141
|
// studio/shared/schema/identity.ts
|
|
@@ -116946,7 +117175,7 @@ var init_types = __esm(() => {
|
|
|
116946
117175
|
|
|
116947
117176
|
// studio/server/client-package.ts
|
|
116948
117177
|
import { existsSync as existsSync19, readFileSync as readFileSync11, statSync as statSync7 } from "node:fs";
|
|
116949
|
-
import { isAbsolute as isAbsolute2, join as
|
|
117178
|
+
import { isAbsolute as isAbsolute2, join as join35, relative as relative3, resolve as resolve10 } from "node:path";
|
|
116950
117179
|
async function resolveClientPackage(root, force = false) {
|
|
116951
117180
|
const projectDir = resolve10(root);
|
|
116952
117181
|
const inputs = discoverInputs(projectDir);
|
|
@@ -116969,7 +117198,7 @@ function invalidateClientPackage(root) {
|
|
|
116969
117198
|
cache2.delete(resolve10(root));
|
|
116970
117199
|
}
|
|
116971
117200
|
function discoverInputs(projectDir) {
|
|
116972
|
-
const rootPackageFile =
|
|
117201
|
+
const rootPackageFile = join35(projectDir, "package.json");
|
|
116973
117202
|
let rootPackage;
|
|
116974
117203
|
try {
|
|
116975
117204
|
if (existsSync19(rootPackageFile))
|
|
@@ -116990,7 +117219,7 @@ function discoverInputs(projectDir) {
|
|
|
116990
117219
|
}
|
|
116991
117220
|
}
|
|
116992
117221
|
function resolveDiscovery(projectDir, rootPackage, inspectedFiles) {
|
|
116993
|
-
const rootPackageFile =
|
|
117222
|
+
const rootPackageFile = join35(projectDir, "package.json");
|
|
116994
117223
|
const candidates = [];
|
|
116995
117224
|
for (const packageFile of inspectedFiles) {
|
|
116996
117225
|
if (packageFile === rootPackageFile)
|
|
@@ -117031,7 +117260,7 @@ function resolveDiscovery(projectDir, rootPackage, inspectedFiles) {
|
|
|
117031
117260
|
return unavailable3("This domain has no package that defines a dev:hmr script.");
|
|
117032
117261
|
}
|
|
117033
117262
|
function discoverPackageFiles(projectDir, rootPackage) {
|
|
117034
|
-
const workspaceFile =
|
|
117263
|
+
const workspaceFile = join35(projectDir, "pnpm-workspace.yaml");
|
|
117035
117264
|
const patterns2 = [...packageWorkspacePatterns(rootPackage)];
|
|
117036
117265
|
if (existsSync19(workspaceFile)) {
|
|
117037
117266
|
const workspace2 = $parse(readFileSync11(workspaceFile, "utf8"));
|
|
@@ -117117,7 +117346,7 @@ function inside(root, file2) {
|
|
|
117117
117346
|
function inputFingerprint(projectDir, packageFiles) {
|
|
117118
117347
|
return [
|
|
117119
117348
|
fileFingerprint(projectDir),
|
|
117120
|
-
fileFingerprint(
|
|
117349
|
+
fileFingerprint(join35(projectDir, "pnpm-workspace.yaml")),
|
|
117121
117350
|
...packageFiles.map(fileFingerprint)
|
|
117122
117351
|
].join("|");
|
|
117123
117352
|
}
|
|
@@ -125201,7 +125430,7 @@ ${lanes.join(`
|
|
|
125201
125430
|
writeOutputIsTTY() {
|
|
125202
125431
|
return process.stdout.isTTY;
|
|
125203
125432
|
},
|
|
125204
|
-
readFile:
|
|
125433
|
+
readFile: readFile28,
|
|
125205
125434
|
writeFile: writeFile22,
|
|
125206
125435
|
watchFile: watchFile2,
|
|
125207
125436
|
watchDirectory,
|
|
@@ -125394,7 +125623,7 @@ ${lanes.join(`
|
|
|
125394
125623
|
function fsWatchWorker(fileOrDirectory, recursive, callback) {
|
|
125395
125624
|
return _fs.watch(fileOrDirectory, fsSupportsRecursiveFsWatch ? { persistent: true, recursive: !!recursive } : { persistent: true }, callback);
|
|
125396
125625
|
}
|
|
125397
|
-
function
|
|
125626
|
+
function readFile28(fileName, _encoding) {
|
|
125398
125627
|
let buffer;
|
|
125399
125628
|
try {
|
|
125400
125629
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -156023,7 +156252,7 @@ ${lanes.join(`
|
|
|
156023
156252
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
156024
156253
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node5, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node5, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
156025
156254
|
}
|
|
156026
|
-
function parseCommandLineWorker(diagnostics, commandLine,
|
|
156255
|
+
function parseCommandLineWorker(diagnostics, commandLine, readFile28) {
|
|
156027
156256
|
const options = {};
|
|
156028
156257
|
let watchOptions;
|
|
156029
156258
|
const fileNames = [];
|
|
@@ -156061,7 +156290,7 @@ ${lanes.join(`
|
|
|
156061
156290
|
}
|
|
156062
156291
|
}
|
|
156063
156292
|
function parseResponseFile(fileName) {
|
|
156064
|
-
const text13 = tryReadFile(fileName,
|
|
156293
|
+
const text13 = tryReadFile(fileName, readFile28 || ((fileName2) => sys.readFile(fileName2)));
|
|
156065
156294
|
if (!isString2(text13)) {
|
|
156066
156295
|
errors7.push(text13);
|
|
156067
156296
|
return;
|
|
@@ -156164,8 +156393,8 @@ ${lanes.join(`
|
|
|
156164
156393
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
156165
156394
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
156166
156395
|
};
|
|
156167
|
-
function parseCommandLine(commandLine,
|
|
156168
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
156396
|
+
function parseCommandLine(commandLine, readFile28) {
|
|
156397
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile28);
|
|
156169
156398
|
}
|
|
156170
156399
|
function getOptionFromName(optionName, allowShort) {
|
|
156171
156400
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -156233,8 +156462,8 @@ ${lanes.join(`
|
|
|
156233
156462
|
result.originalFileName = result.fileName;
|
|
156234
156463
|
return parseJsonSourceFileConfigFileContent(result, host, getNormalizedAbsolutePath(getDirectoryPath(configFileName), cwd), optionsToExtend, getNormalizedAbsolutePath(configFileName, cwd), undefined, extraFileExtensions, extendedConfigCache, watchOptionsToExtend);
|
|
156235
156464
|
}
|
|
156236
|
-
function readConfigFile(fileName,
|
|
156237
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
156465
|
+
function readConfigFile(fileName, readFile28) {
|
|
156466
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile28);
|
|
156238
156467
|
return isString2(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
156239
156468
|
}
|
|
156240
156469
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -156244,14 +156473,14 @@ ${lanes.join(`
|
|
|
156244
156473
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined
|
|
156245
156474
|
};
|
|
156246
156475
|
}
|
|
156247
|
-
function readJsonConfigFile(fileName,
|
|
156248
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
156476
|
+
function readJsonConfigFile(fileName, readFile28) {
|
|
156477
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile28);
|
|
156249
156478
|
return isString2(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
156250
156479
|
}
|
|
156251
|
-
function tryReadFile(fileName,
|
|
156480
|
+
function tryReadFile(fileName, readFile28) {
|
|
156252
156481
|
let text13;
|
|
156253
156482
|
try {
|
|
156254
|
-
text13 =
|
|
156483
|
+
text13 = readFile28(fileName);
|
|
156255
156484
|
} catch (e) {
|
|
156256
156485
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
|
|
156257
156486
|
}
|
|
@@ -223007,12 +223236,12 @@ ${lanes.join(`
|
|
|
223007
223236
|
function createCompilerHost(options, setParentNodes) {
|
|
223008
223237
|
return createCompilerHostWorker(options, setParentNodes);
|
|
223009
223238
|
}
|
|
223010
|
-
function createGetSourceFile(
|
|
223239
|
+
function createGetSourceFile(readFile28, setParentNodes) {
|
|
223011
223240
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
223012
223241
|
let text13;
|
|
223013
223242
|
try {
|
|
223014
223243
|
mark("beforeIORead");
|
|
223015
|
-
text13 =
|
|
223244
|
+
text13 = readFile28(fileName);
|
|
223016
223245
|
mark("afterIORead");
|
|
223017
223246
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
223018
223247
|
} catch (e) {
|
|
@@ -223838,7 +224067,7 @@ ${lanes.join(`
|
|
|
223838
224067
|
getSourceOfProjectReferenceRedirect,
|
|
223839
224068
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
223840
224069
|
});
|
|
223841
|
-
const
|
|
224070
|
+
const readFile28 = host.readFile.bind(host);
|
|
223842
224071
|
(_e = tracing) == null || _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
223843
224072
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
223844
224073
|
(_f = tracing) == null || _f.pop();
|
|
@@ -224014,7 +224243,7 @@ ${lanes.join(`
|
|
|
224014
224243
|
shouldTransformImportCall,
|
|
224015
224244
|
emitBuildInfo,
|
|
224016
224245
|
fileExists: fileExists2,
|
|
224017
|
-
readFile:
|
|
224246
|
+
readFile: readFile28,
|
|
224018
224247
|
directoryExists: directoryExists2,
|
|
224019
224248
|
getSymlinkCache,
|
|
224020
224249
|
realpath: (_o = host.realpath) == null ? undefined : _o.bind(host),
|
|
@@ -292113,7 +292342,7 @@ var require_path_browserify = __commonJS(function(exports, module) {
|
|
|
292113
292342
|
assertPath(path9);
|
|
292114
292343
|
return path9.length > 0 && path9.charCodeAt(0) === 47;
|
|
292115
292344
|
},
|
|
292116
|
-
join: function
|
|
292345
|
+
join: function join36() {
|
|
292117
292346
|
if (arguments.length === 0)
|
|
292118
292347
|
return ".";
|
|
292119
292348
|
var joined;
|
|
@@ -348042,16 +348271,16 @@ Node text: ${this.#forgottenText}`;
|
|
|
348042
348271
|
|
|
348043
348272
|
// studio/server/domain.ts
|
|
348044
348273
|
import { existsSync as existsSync20, readFileSync as readFileSync12, statSync as statSync8 } from "node:fs";
|
|
348045
|
-
import { basename, dirname as dirname18, extname, isAbsolute as isAbsolute3, join as
|
|
348274
|
+
import { basename, dirname as dirname18, extname, isAbsolute as isAbsolute3, join as join36, relative as relative4, resolve as resolve11 } from "node:path";
|
|
348046
348275
|
function makeId(root) {
|
|
348047
348276
|
return basename(resolve11(root)).replace(/[^a-zA-Z0-9_-]/g, "-") || "domain";
|
|
348048
348277
|
}
|
|
348049
348278
|
function resolveApplicationEntry(root) {
|
|
348050
348279
|
const project2 = resolve11(root);
|
|
348051
|
-
const conventional =
|
|
348280
|
+
const conventional = join36(project2, "application.ts");
|
|
348052
348281
|
if (existsSync20(conventional))
|
|
348053
348282
|
return conventional;
|
|
348054
|
-
const config2 =
|
|
348283
|
+
const config2 = join36(project2, "astrale.config.ts");
|
|
348055
348284
|
if (!existsSync20(config2))
|
|
348056
348285
|
return null;
|
|
348057
348286
|
let source2;
|
|
@@ -348093,7 +348322,7 @@ function resolveSchemaEntry(root, applicationFile) {
|
|
|
348093
348322
|
}
|
|
348094
348323
|
function isDomainDir(root) {
|
|
348095
348324
|
const project2 = resolve11(root);
|
|
348096
|
-
if (!existsSync20(
|
|
348325
|
+
if (!existsSync20(join36(project2, "astrale.config.ts")))
|
|
348097
348326
|
return false;
|
|
348098
348327
|
const application = resolveApplicationEntry(project2);
|
|
348099
348328
|
return application !== null && resolveSchemaEntry(project2, application) !== null;
|
|
@@ -348101,7 +348330,7 @@ function isDomainDir(root) {
|
|
|
348101
348330
|
function registerDomain(root) {
|
|
348102
348331
|
const project2 = resolve11(root);
|
|
348103
348332
|
const applicationFile = resolveApplicationEntry(project2);
|
|
348104
|
-
if (applicationFile === null || !existsSync20(
|
|
348333
|
+
if (applicationFile === null || !existsSync20(join36(project2, "astrale.config.ts")))
|
|
348105
348334
|
return null;
|
|
348106
348335
|
const schemaIndex = resolveSchemaEntry(project2, applicationFile);
|
|
348107
348336
|
if (schemaIndex === null)
|
|
@@ -348110,7 +348339,7 @@ function registerDomain(root) {
|
|
|
348110
348339
|
const handle = {
|
|
348111
348340
|
id: makeId(project2),
|
|
348112
348341
|
root: project2,
|
|
348113
|
-
configFile:
|
|
348342
|
+
configFile: join36(project2, "astrale.config.ts"),
|
|
348114
348343
|
applicationFile,
|
|
348115
348344
|
schemaDirName: relative4(project2, schemaDir).replaceAll("\\", "/") || ".",
|
|
348116
348345
|
schemaDir,
|
|
@@ -348133,7 +348362,7 @@ function allDomains() {
|
|
|
348133
348362
|
return [...registry2.values()];
|
|
348134
348363
|
}
|
|
348135
348364
|
function depsInstalled(root) {
|
|
348136
|
-
if (existsSync20(
|
|
348365
|
+
if (existsSync20(join36(root, "node_modules", "@astrale-os", "sdk")))
|
|
348137
348366
|
return true;
|
|
348138
348367
|
try {
|
|
348139
348368
|
Bun.resolveSync("@astrale-os/sdk/schema", root);
|
|
@@ -348259,8 +348488,8 @@ function sourceCandidates(file2) {
|
|
|
348259
348488
|
`${sourceBase}.tsx`,
|
|
348260
348489
|
`${sourceBase}.mts`,
|
|
348261
348490
|
`${sourceBase}.cts`,
|
|
348262
|
-
|
|
348263
|
-
|
|
348491
|
+
join36(file2, "index.ts"),
|
|
348492
|
+
join36(file2, "index.tsx")
|
|
348264
348493
|
];
|
|
348265
348494
|
}
|
|
348266
348495
|
function isFile(file2) {
|
|
@@ -348355,7 +348584,7 @@ var init_settings2 = __esm(() => {
|
|
|
348355
348584
|
|
|
348356
348585
|
// studio/server/introspect/anatomy/source.ts
|
|
348357
348586
|
import { existsSync as existsSync21, readFileSync as readFileSync13, readdirSync as readdirSync8, statSync as statSync9 } from "node:fs";
|
|
348358
|
-
import { join as
|
|
348587
|
+
import { join as join37 } from "node:path";
|
|
348359
348588
|
function readTextSafe(file2) {
|
|
348360
348589
|
try {
|
|
348361
348590
|
return existsSync21(file2) ? readFileSync13(file2, "utf8") : "";
|
|
@@ -348367,7 +348596,7 @@ function listFiles(dir) {
|
|
|
348367
348596
|
try {
|
|
348368
348597
|
return readdirSync8(dir).filter((e) => {
|
|
348369
348598
|
try {
|
|
348370
|
-
return statSync9(
|
|
348599
|
+
return statSync9(join37(dir, e)).isFile();
|
|
348371
348600
|
} catch {
|
|
348372
348601
|
return false;
|
|
348373
348602
|
}
|
|
@@ -348380,7 +348609,7 @@ function listDirs(dir) {
|
|
|
348380
348609
|
try {
|
|
348381
348610
|
return readdirSync8(dir).filter((e) => {
|
|
348382
348611
|
try {
|
|
348383
|
-
return statSync9(
|
|
348612
|
+
return statSync9(join37(dir, e)).isDirectory();
|
|
348384
348613
|
} catch {
|
|
348385
348614
|
return false;
|
|
348386
348615
|
}
|
|
@@ -348401,7 +348630,7 @@ function listSourceFiles(dir) {
|
|
|
348401
348630
|
for (const entry2 of entries) {
|
|
348402
348631
|
if (SKIP_SOURCE_DIRS.has(entry2))
|
|
348403
348632
|
continue;
|
|
348404
|
-
const file2 =
|
|
348633
|
+
const file2 = join37(current, entry2);
|
|
348405
348634
|
let stat4;
|
|
348406
348635
|
try {
|
|
348407
348636
|
stat4 = statSync9(file2);
|
|
@@ -348517,15 +348746,15 @@ var init_source2 = __esm(() => {
|
|
|
348517
348746
|
|
|
348518
348747
|
// studio/server/introspect/anatomy/client-tree.ts
|
|
348519
348748
|
import { existsSync as existsSync22 } from "node:fs";
|
|
348520
|
-
import { join as
|
|
348521
|
-
function buildClientTree(root, clientDir =
|
|
348522
|
-
const srcDir = clientDir ?
|
|
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") : "";
|
|
348523
348752
|
if (!existsSync22(srcDir)) {
|
|
348524
348753
|
return { shell: [], features: [], routes: {}, present: false };
|
|
348525
348754
|
}
|
|
348526
|
-
const shell = listFiles(
|
|
348527
|
-
const features = listDirs(srcDir).filter((d) => !RESERVED_CLIENT_DIRS.has(d)).map((name) => ({ name, files: listFiles(
|
|
348528
|
-
const routes = parseRoutes(listFiles(srcDir).filter((file2) => /\.[cm]?[jt]sx?$/.test(file2)).map((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)));
|
|
348529
348758
|
return { shell, features, routes, present: true };
|
|
348530
348759
|
}
|
|
348531
348760
|
function parseRoutes(files) {
|
|
@@ -348548,7 +348777,7 @@ var init_client_tree = __esm(() => {
|
|
|
348548
348777
|
|
|
348549
348778
|
// studio/server/introspect/anatomy/env-fields.ts
|
|
348550
348779
|
import { existsSync as existsSync23 } from "node:fs";
|
|
348551
|
-
import { join as
|
|
348780
|
+
import { join as join39 } from "node:path";
|
|
348552
348781
|
function cleanDoc(raw2) {
|
|
348553
348782
|
if (!raw2)
|
|
348554
348783
|
return;
|
|
@@ -348558,7 +348787,7 @@ function cleanDoc(raw2) {
|
|
|
348558
348787
|
return text13.length ? text13 : undefined;
|
|
348559
348788
|
}
|
|
348560
348789
|
function buildEnvFields(root) {
|
|
348561
|
-
const envFile =
|
|
348790
|
+
const envFile = join39(root, "env.ts");
|
|
348562
348791
|
if (!existsSync23(envFile))
|
|
348563
348792
|
return [];
|
|
348564
348793
|
let project2;
|
|
@@ -348600,10 +348829,10 @@ var init_env_fields = __esm(() => {
|
|
|
348600
348829
|
});
|
|
348601
348830
|
|
|
348602
348831
|
// studio/server/introspect/anatomy/schema-definition.ts
|
|
348603
|
-
import { join as
|
|
348832
|
+
import { join as join40 } from "node:path";
|
|
348604
348833
|
function schemaProject(root, schemaDirName) {
|
|
348605
348834
|
const project2 = makeProject();
|
|
348606
|
-
return listSourceFiles(
|
|
348835
|
+
return listSourceFiles(join40(root, schemaDirName)).map((file2) => addSource(project2, file2)).filter((source2) => source2 !== null);
|
|
348607
348836
|
}
|
|
348608
348837
|
function defineSchemaCalls(source2) {
|
|
348609
348838
|
return source2.getDescendantsOfKind(import_ts_morph4.SyntaxKind.CallExpression).filter((call3) => {
|
|
@@ -348634,7 +348863,7 @@ var init_schema_definition = __esm(() => {
|
|
|
348634
348863
|
});
|
|
348635
348864
|
|
|
348636
348865
|
// studio/server/introspect/anatomy/views/routes.ts
|
|
348637
|
-
import { join as
|
|
348866
|
+
import { join as join41, relative as relative5 } from "node:path";
|
|
348638
348867
|
function buildSchemaViewSources(root, schemaDirName) {
|
|
348639
348868
|
const sources2 = new Map;
|
|
348640
348869
|
for (const source2 of schemaProject(root, schemaDirName)) {
|
|
@@ -348670,7 +348899,7 @@ function buildFrontendViews(root, canonicalViewNames) {
|
|
|
348670
348899
|
const project2 = makeProject();
|
|
348671
348900
|
const application = resolveApplicationEntry(root);
|
|
348672
348901
|
const applicationFiles = application === null ? [] : [application];
|
|
348673
|
-
const sources2 = [...new Set([...listSourceFiles(
|
|
348902
|
+
const sources2 = [...new Set([...listSourceFiles(join41(root, "views")), ...applicationFiles])].map((file2) => addSource(project2, file2)).filter((source2) => source2 !== null);
|
|
348674
348903
|
const views = [];
|
|
348675
348904
|
for (const source2 of sources2) {
|
|
348676
348905
|
for (const call3 of source2.getDescendantsOfKind(import_ts_morph5.SyntaxKind.CallExpression)) {
|
|
@@ -348770,7 +348999,7 @@ var init_anatomy_extras = __esm(() => {
|
|
|
348770
348999
|
|
|
348771
349000
|
// studio/server/introspect/config-preview.ts
|
|
348772
349001
|
import { readFileSync as readFileSync14 } from "node:fs";
|
|
348773
|
-
import { join as
|
|
349002
|
+
import { join as join42 } from "node:path";
|
|
348774
349003
|
function withoutComments(source2) {
|
|
348775
349004
|
let output3 = "";
|
|
348776
349005
|
let quote = null;
|
|
@@ -348867,7 +349096,7 @@ function parseConfigPreview(source2) {
|
|
|
348867
349096
|
}
|
|
348868
349097
|
function readConfigPreview(root) {
|
|
348869
349098
|
try {
|
|
348870
|
-
return parseConfigPreview(readFileSync14(
|
|
349099
|
+
return parseConfigPreview(readFileSync14(join42(root, "astrale.config.ts"), "utf8"));
|
|
348871
349100
|
} catch {
|
|
348872
349101
|
return { adapter: "unknown", configuredSecretFiles: [] };
|
|
348873
349102
|
}
|
|
@@ -348876,7 +349105,7 @@ var init_config_preview = () => {};
|
|
|
348876
349105
|
|
|
348877
349106
|
// studio/server/introspect/anatomy.ts
|
|
348878
349107
|
import { existsSync as existsSync24, readFileSync as readFileSync15, readdirSync as readdirSync9, statSync as statSync10 } from "node:fs";
|
|
348879
|
-
import { join as
|
|
349108
|
+
import { join as join43, relative as relative6 } from "node:path";
|
|
348880
349109
|
function buildAnatomy({
|
|
348881
349110
|
root,
|
|
348882
349111
|
schemaDirName,
|
|
@@ -348884,7 +349113,7 @@ function buildAnatomy({
|
|
|
348884
349113
|
canonicalViews
|
|
348885
349114
|
}) {
|
|
348886
349115
|
const schema2 = findSchemaDefinition(root, schemaDirName);
|
|
348887
|
-
const authoredClientDir = clientDir ?? (existsSync24(
|
|
349116
|
+
const authoredClientDir = clientDir ?? (existsSync24(join43(root, "ui")) ? join43(root, "ui") : undefined);
|
|
348888
349117
|
return {
|
|
348889
349118
|
overview: buildOverview(root, schemaDirName, authoredClientDir, schema2?.origin),
|
|
348890
349119
|
views: buildViews(root, schemaDirName, canonicalViews),
|
|
@@ -348894,7 +349123,7 @@ function buildAnatomy({
|
|
|
348894
349123
|
};
|
|
348895
349124
|
}
|
|
348896
349125
|
function buildOverview(root, schemaDirName, clientDir, schemaOrigin) {
|
|
348897
|
-
const pkg = readPackageJsonSafe(
|
|
349126
|
+
const pkg = readPackageJsonSafe(join43(root, "package.json"));
|
|
348898
349127
|
const astraleDeps = {};
|
|
348899
349128
|
for (const [k, v] of Object.entries({
|
|
348900
349129
|
...pkg?.dependencies ?? {},
|
|
@@ -348906,7 +349135,7 @@ function buildOverview(root, schemaDirName, clientDir, schemaOrigin) {
|
|
|
348906
349135
|
const config2 = readConfigPreview(root);
|
|
348907
349136
|
const application = resolveApplicationEntry(root);
|
|
348908
349137
|
const applicationSrc = application === null ? "" : readTextSafe2(application);
|
|
348909
|
-
const origin2 = schemaOrigin ?? applicationSrc.match(/defineSchema\(\s*['"]([^'"]+)['"]/)?.[1] ?? readTextSafe2(
|
|
349138
|
+
const origin2 = schemaOrigin ?? applicationSrc.match(/defineSchema\(\s*['"]([^'"]+)['"]/)?.[1] ?? readTextSafe2(join43(root, schemaDirName, "index.ts")).match(/defineSchema\(\s*['"]([^'"]+)['"]/)?.[1] ?? "";
|
|
348910
349139
|
return {
|
|
348911
349140
|
origin: origin2,
|
|
348912
349141
|
applicationFile: application === null ? undefined : relative6(root, application).replaceAll("\\", "/"),
|
|
@@ -348922,13 +349151,13 @@ function buildOverview(root, schemaDirName, clientDir, schemaOrigin) {
|
|
|
348922
349151
|
};
|
|
348923
349152
|
}
|
|
348924
349153
|
function detectIntegrations(root) {
|
|
348925
|
-
const dir =
|
|
349154
|
+
const dir = join43(root, readSettings(root).integrationsDir);
|
|
348926
349155
|
if (!existsSync24(dir))
|
|
348927
349156
|
return [];
|
|
348928
349157
|
try {
|
|
348929
349158
|
return readdirSync9(dir).filter((e) => {
|
|
348930
349159
|
try {
|
|
348931
|
-
return statSync10(
|
|
349160
|
+
return statSync10(join43(dir, e)).isDirectory();
|
|
348932
349161
|
} catch {
|
|
348933
349162
|
return false;
|
|
348934
349163
|
}
|
|
@@ -349243,7 +349472,7 @@ var init_project4 = __esm(() => {
|
|
|
349243
349472
|
|
|
349244
349473
|
// studio/server/introspect/source-overlay/handlers.ts
|
|
349245
349474
|
import { readdirSync as readdirSync10 } from "node:fs";
|
|
349246
|
-
import { join as
|
|
349475
|
+
import { join as join44 } from "node:path";
|
|
349247
349476
|
function authoredTypeScriptFiles(root) {
|
|
349248
349477
|
const files = [];
|
|
349249
349478
|
const visit4 = (directory) => {
|
|
@@ -349256,7 +349485,7 @@ function authoredTypeScriptFiles(root) {
|
|
|
349256
349485
|
for (const entry2 of entries) {
|
|
349257
349486
|
if (entry2.isSymbolicLink())
|
|
349258
349487
|
continue;
|
|
349259
|
-
const path9 =
|
|
349488
|
+
const path9 = join44(directory, entry2.name);
|
|
349260
349489
|
if (entry2.isDirectory()) {
|
|
349261
349490
|
if (!IGNORED_DIRECTORIES.has(entry2.name))
|
|
349262
349491
|
visit4(path9);
|
|
@@ -350388,7 +350617,7 @@ function structuralStatusOf(changes) {
|
|
|
350388
350617
|
// studio/server/state/baseline.ts
|
|
350389
350618
|
import { createHash as createHash8 } from "node:crypto";
|
|
350390
350619
|
import { existsSync as existsSync27, readFileSync as readFileSync17, readdirSync as readdirSync11, statSync as statSync11 } from "node:fs";
|
|
350391
|
-
import { join as
|
|
350620
|
+
import { join as join45, relative as relative8, resolve as resolve12 } from "node:path";
|
|
350392
350621
|
function sha2562(buf) {
|
|
350393
350622
|
return createHash8("sha256").update(buf).digest("hex");
|
|
350394
350623
|
}
|
|
@@ -350402,7 +350631,7 @@ function walkFiles(dir, out) {
|
|
|
350402
350631
|
for (const e of entries) {
|
|
350403
350632
|
if (SKIP_DIRS.has(e))
|
|
350404
350633
|
continue;
|
|
350405
|
-
const full =
|
|
350634
|
+
const full = join45(dir, e);
|
|
350406
350635
|
let st;
|
|
350407
350636
|
try {
|
|
350408
350637
|
st = statSync11(full);
|
|
@@ -350419,7 +350648,7 @@ function hashAnatomyFiles(root, schemaDirName, applicationFile) {
|
|
|
350419
350648
|
const r = resolve12(root);
|
|
350420
350649
|
const absFiles = [];
|
|
350421
350650
|
for (const d of [schemaDirName, ...ANATOMY_GLOBS.dirs]) {
|
|
350422
|
-
const abs =
|
|
350651
|
+
const abs = join45(r, d);
|
|
350423
350652
|
if (existsSync27(abs)) {
|
|
350424
350653
|
let st;
|
|
350425
350654
|
try {
|
|
@@ -350434,7 +350663,7 @@ function hashAnatomyFiles(root, schemaDirName, applicationFile) {
|
|
|
350434
350663
|
}
|
|
350435
350664
|
}
|
|
350436
350665
|
for (const f of ANATOMY_GLOBS.files) {
|
|
350437
|
-
const abs =
|
|
350666
|
+
const abs = join45(r, f);
|
|
350438
350667
|
if (existsSync27(abs)) {
|
|
350439
350668
|
try {
|
|
350440
350669
|
if (statSync11(abs).isFile())
|
|
@@ -350629,7 +350858,7 @@ var init_baseline = __esm(() => {
|
|
|
350629
350858
|
// studio/server/cache.ts
|
|
350630
350859
|
import { createHash as createHash9 } from "node:crypto";
|
|
350631
350860
|
import { existsSync as existsSync28, readFileSync as readFileSync18 } from "node:fs";
|
|
350632
|
-
import { join as
|
|
350861
|
+
import { join as join46, relative as relative9 } from "node:path";
|
|
350633
350862
|
function isHandlerLink(value3) {
|
|
350634
350863
|
const record14 = asJsonRecord(value3);
|
|
350635
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";
|
|
@@ -350720,10 +350949,10 @@ function bundleCacheKey(root, schemaDirName, applicationFile) {
|
|
|
350720
350949
|
hash2.update(`${file2}\x00${digest7}\x00`);
|
|
350721
350950
|
}
|
|
350722
350951
|
for (const file2 of LOCKFILES)
|
|
350723
|
-
hashFileIfPresent(hash2, file2,
|
|
350952
|
+
hashFileIfPresent(hash2, file2, join46(root, file2));
|
|
350724
350953
|
const serverRoot = import.meta.dir;
|
|
350725
350954
|
for (const file2 of TOOL_INPUTS) {
|
|
350726
|
-
const abs =
|
|
350955
|
+
const abs = join46(serverRoot, file2);
|
|
350727
350956
|
hashFileIfPresent(hash2, `tool:${relative9(serverRoot, abs)}`, abs);
|
|
350728
350957
|
}
|
|
350729
350958
|
return hash2.digest("hex");
|
|
@@ -351166,7 +351395,7 @@ var init_token3 = __esm(() => {
|
|
|
351166
351395
|
// studio/server/agent/harness/gateway/config.ts
|
|
351167
351396
|
import { chmodSync as chmodSync3, existsSync as existsSync29, mkdirSync as mkdirSync8, readFileSync as readFileSync19, rmSync as rmSync4, writeFileSync as writeFileSync8 } from "node:fs";
|
|
351168
351397
|
import { homedir as homedir9 } from "node:os";
|
|
351169
|
-
import { dirname as dirname20, join as
|
|
351398
|
+
import { dirname as dirname20, join as join47 } from "node:path";
|
|
351170
351399
|
function normalizeAuth(input) {
|
|
351171
351400
|
const record14 = asJsonRecord(input);
|
|
351172
351401
|
if (record14?.mode === "token" || record14?.token != null && record14?.mode == null)
|
|
@@ -351250,7 +351479,7 @@ function setHarnessGateway(root, input) {
|
|
|
351250
351479
|
removeState(root, LOCAL_FILE);
|
|
351251
351480
|
} else {
|
|
351252
351481
|
writeJson2(root, LOCAL_FILE, cfg);
|
|
351253
|
-
chmodSync3(
|
|
351482
|
+
chmodSync3(statePath2(root, LOCAL_FILE), 384);
|
|
351254
351483
|
}
|
|
351255
351484
|
return getHarnessGatewayState(root);
|
|
351256
351485
|
}
|
|
@@ -351309,13 +351538,13 @@ var LOCAL_FILE = "harness-gateway.json", GLOBAL_FILE;
|
|
|
351309
351538
|
var init_config2 = __esm(() => {
|
|
351310
351539
|
init_store2();
|
|
351311
351540
|
init_token3();
|
|
351312
|
-
GLOBAL_FILE =
|
|
351541
|
+
GLOBAL_FILE = join47(homedir9(), ".domain-studio", "harness-gateway.json");
|
|
351313
351542
|
});
|
|
351314
351543
|
|
|
351315
351544
|
// studio/server/agent/harness/skills.ts
|
|
351316
351545
|
import { existsSync as existsSync30, readdirSync as readdirSync12, readFileSync as readFileSync20 } from "node:fs";
|
|
351317
351546
|
import { homedir as homedir10 } from "node:os";
|
|
351318
|
-
import { dirname as dirname21, join as
|
|
351547
|
+
import { dirname as dirname21, join as join48 } from "node:path";
|
|
351319
351548
|
function readSkillMeta(skillMd) {
|
|
351320
351549
|
let text13;
|
|
351321
351550
|
try {
|
|
@@ -351348,7 +351577,7 @@ function scanSkillDir(dir, source2, plugin, commandPrefix, loaded, out, seen) {
|
|
|
351348
351577
|
return;
|
|
351349
351578
|
}
|
|
351350
351579
|
for (const entry2 of entries) {
|
|
351351
|
-
const skillMd =
|
|
351580
|
+
const skillMd = join48(dir, entry2, "SKILL.md");
|
|
351352
351581
|
if (!existsSync30(skillMd))
|
|
351353
351582
|
continue;
|
|
351354
351583
|
const command = commandPrefix + entry2;
|
|
@@ -351372,7 +351601,7 @@ function scanAncestors(root, dirs, out, seen) {
|
|
|
351372
351601
|
let current = root;
|
|
351373
351602
|
for (let i = 0;i < 12 && current !== home; i++) {
|
|
351374
351603
|
for (const dir of dirs)
|
|
351375
|
-
scanSkillDir(
|
|
351604
|
+
scanSkillDir(join48(current, dir), "project", undefined, "", true, out, seen);
|
|
351376
351605
|
const parent = dirname21(current);
|
|
351377
351606
|
if (parent === current)
|
|
351378
351607
|
break;
|
|
@@ -351623,7 +351852,7 @@ function writeClaudeMcpConfig(root, servers) {
|
|
|
351623
351852
|
]))
|
|
351624
351853
|
});
|
|
351625
351854
|
return {
|
|
351626
|
-
path:
|
|
351855
|
+
path: statePath2(root, rel),
|
|
351627
351856
|
dispose: () => {
|
|
351628
351857
|
try {
|
|
351629
351858
|
removeState(root, rel);
|
|
@@ -351845,9 +352074,9 @@ var init_events = __esm(() => {
|
|
|
351845
352074
|
// studio/server/agent/harness/claude/skills.ts
|
|
351846
352075
|
import { readFileSync as readFileSync21 } from "node:fs";
|
|
351847
352076
|
import { homedir as homedir11 } from "node:os";
|
|
351848
|
-
import { join as
|
|
352077
|
+
import { join as join49 } from "node:path";
|
|
351849
352078
|
function installedPluginDirs() {
|
|
351850
|
-
const file2 =
|
|
352079
|
+
const file2 = join49(homedir11(), ".claude", "plugins", "installed_plugins.json");
|
|
351851
352080
|
let parsed;
|
|
351852
352081
|
try {
|
|
351853
352082
|
parsed = JSON.parse(readFileSync21(file2, "utf8"));
|
|
@@ -351873,10 +352102,10 @@ function scanClaudeSkills(root) {
|
|
|
351873
352102
|
const seen = new Set;
|
|
351874
352103
|
const home = homedir11();
|
|
351875
352104
|
scanAncestors(root, [".claude/skills", ".agents/skills"], out, seen);
|
|
351876
|
-
scanSkillDir(
|
|
351877
|
-
scanSkillDir(
|
|
352105
|
+
scanSkillDir(join49(home, ".claude", "skills"), "user", undefined, "", true, out, seen);
|
|
352106
|
+
scanSkillDir(join49(home, ".agents", "skills"), "user", undefined, "", true, out, seen);
|
|
351878
352107
|
for (const { plugin, installPath } of installedPluginDirs())
|
|
351879
|
-
scanSkillDir(
|
|
352108
|
+
scanSkillDir(join49(installPath, "skills"), "plugin", plugin, `${plugin}:`, true, out, seen);
|
|
351880
352109
|
return out;
|
|
351881
352110
|
}
|
|
351882
352111
|
var init_skills4 = __esm(() => {
|
|
@@ -352639,16 +352868,16 @@ var init_models = __esm(() => {
|
|
|
352639
352868
|
|
|
352640
352869
|
// studio/server/agent/harness/codex/skills.ts
|
|
352641
352870
|
import { homedir as homedir12 } from "node:os";
|
|
352642
|
-
import { join as
|
|
352871
|
+
import { join as join50 } from "node:path";
|
|
352643
352872
|
function scanCodexSkills(root, plugins) {
|
|
352644
352873
|
const out = [];
|
|
352645
352874
|
const seen = new Set;
|
|
352646
352875
|
const home = homedir12();
|
|
352647
352876
|
scanAncestors(root, [".agents/skills", ".codex/skills"], out, seen);
|
|
352648
|
-
scanSkillDir(
|
|
352649
|
-
scanSkillDir(
|
|
352877
|
+
scanSkillDir(join50(home, ".agents", "skills"), "user", undefined, "", true, out, seen);
|
|
352878
|
+
scanSkillDir(join50(home, ".codex", "skills"), "user", undefined, "", true, out, seen);
|
|
352650
352879
|
for (const plugin of plugins)
|
|
352651
|
-
scanSkillDir(
|
|
352880
|
+
scanSkillDir(join50(plugin.path, "skills"), "plugin", plugin.name, `${plugin.name}:`, plugin.enabled, out, seen);
|
|
352652
352881
|
return out;
|
|
352653
352882
|
}
|
|
352654
352883
|
var init_skills5 = __esm(() => {
|
|
@@ -352792,7 +353021,7 @@ var init_adapter2 = __esm(() => {
|
|
|
352792
353021
|
|
|
352793
353022
|
// studio/server/agent/harness/mock/domain-edit.ts
|
|
352794
353023
|
import { existsSync as existsSync31, readFileSync as readFileSync22, readdirSync as readdirSync13, writeFileSync as writeFileSync9 } from "node:fs";
|
|
352795
|
-
import { join as
|
|
353024
|
+
import { join as join51 } from "node:path";
|
|
352796
353025
|
function identifier(text14, fallback) {
|
|
352797
353026
|
const words = text14.toLowerCase().replace(/[^a-z0-9 ]+/g, " ").trim().split(/\s+/).filter(Boolean).slice(0, 3);
|
|
352798
353027
|
if (words.length === 0)
|
|
@@ -352800,13 +353029,13 @@ function identifier(text14, fallback) {
|
|
|
352800
353029
|
return words.map((word, index3) => index3 === 0 ? word : word[0].toUpperCase() + word.slice(1)).join("");
|
|
352801
353030
|
}
|
|
352802
353031
|
function applyMockDomainEdit(root, instruction) {
|
|
352803
|
-
const schemaDir =
|
|
353032
|
+
const schemaDir = join51(root, "schema");
|
|
352804
353033
|
if (!existsSync31(schemaDir))
|
|
352805
353034
|
return null;
|
|
352806
353035
|
const files = readdirSync13(schemaDir).filter((file2) => file2.endsWith(".ts") && file2 !== "index.ts");
|
|
352807
353036
|
const propName = identifier(instruction, "agentNote");
|
|
352808
353037
|
for (const file2 of files) {
|
|
352809
|
-
const absolute =
|
|
353038
|
+
const absolute = join51(schemaDir, file2);
|
|
352810
353039
|
const source2 = readFileSync22(absolute, "utf8");
|
|
352811
353040
|
const props4 = source2.indexOf("props: {");
|
|
352812
353041
|
if (props4 < 0)
|
|
@@ -354087,7 +354316,7 @@ function uniqueStoredPath(root, docs, name) {
|
|
|
354087
354316
|
const taken = new Set(docs.map((doc2) => doc2.stored));
|
|
354088
354317
|
for (let attempt = 0;; attempt++) {
|
|
354089
354318
|
const candidate2 = `${DIR}/${slug}${attempt === 0 ? "" : `-${attempt + 1}`}${extension}`;
|
|
354090
|
-
if (!taken.has(candidate2) && !existsSync33(
|
|
354319
|
+
if (!taken.has(candidate2) && !existsSync33(statePath2(root, candidate2)))
|
|
354091
354320
|
return candidate2;
|
|
354092
354321
|
}
|
|
354093
354322
|
}
|
|
@@ -354099,7 +354328,7 @@ function migrateDocuments(root) {
|
|
|
354099
354328
|
for (const doc2 of docs) {
|
|
354100
354329
|
if (!doc2.stored.startsWith(`${LEGACY_DIR}/`))
|
|
354101
354330
|
continue;
|
|
354102
|
-
const from2 =
|
|
354331
|
+
const from2 = statePath2(root, doc2.stored);
|
|
354103
354332
|
if (!existsSync33(from2))
|
|
354104
354333
|
continue;
|
|
354105
354334
|
const next = uniqueStoredPath(root, docs, doc2.name);
|
|
@@ -354184,7 +354413,7 @@ function readDocument2(root, id) {
|
|
|
354184
354413
|
const doc2 = listDocuments(root).find((d) => d.id === id);
|
|
354185
354414
|
if (!doc2)
|
|
354186
354415
|
return null;
|
|
354187
|
-
const abs =
|
|
354416
|
+
const abs = statePath2(root, doc2.stored);
|
|
354188
354417
|
if (!existsSync33(abs))
|
|
354189
354418
|
return null;
|
|
354190
354419
|
return { meta: doc2, abs };
|
|
@@ -355113,10 +355342,10 @@ var init_deploy_record = __esm(() => {
|
|
|
355113
355342
|
|
|
355114
355343
|
// studio/server/instances/deploy.ts
|
|
355115
355344
|
import { readFileSync as readFileSync24 } from "node:fs";
|
|
355116
|
-
import { join as
|
|
355345
|
+
import { join as join52 } from "node:path";
|
|
355117
355346
|
function hasProdScript(root) {
|
|
355118
355347
|
try {
|
|
355119
|
-
const pkg = JSON.parse(readFileSync24(
|
|
355348
|
+
const pkg = JSON.parse(readFileSync24(join52(root, "package.json"), "utf8"));
|
|
355120
355349
|
return typeof pkg?.scripts?.prod === "string";
|
|
355121
355350
|
} catch {
|
|
355122
355351
|
return false;
|
|
@@ -355448,10 +355677,10 @@ function parseDotenvPreview(contents) {
|
|
|
355448
355677
|
|
|
355449
355678
|
// studio/server/environment/files.ts
|
|
355450
355679
|
import { existsSync as existsSync34, readFileSync as readFileSync25, writeFileSync as writeFileSync10 } from "node:fs";
|
|
355451
|
-
import { join as
|
|
355680
|
+
import { join as join53, resolve as resolve14 } from "node:path";
|
|
355452
355681
|
function readEnvModel(root, env2) {
|
|
355453
355682
|
const file2 = envFileName(env2);
|
|
355454
|
-
const abs =
|
|
355683
|
+
const abs = join53(root, file2);
|
|
355455
355684
|
const exists4 = existsSync34(abs);
|
|
355456
355685
|
const values = exists4 ? parseDotenvPreview(readFileSync25(abs, "utf8")) : {};
|
|
355457
355686
|
const declared = buildEnvFields(root).filter((f) => f.secret);
|
|
@@ -355519,7 +355748,7 @@ function applyUpdates2(contents, updates) {
|
|
|
355519
355748
|
`);
|
|
355520
355749
|
}
|
|
355521
355750
|
function writeEnvUpdates(root, env2, updates) {
|
|
355522
|
-
const abs =
|
|
355751
|
+
const abs = join53(root, envFileName(env2));
|
|
355523
355752
|
if (!resolve14(abs).startsWith(resolve14(root)))
|
|
355524
355753
|
throw new Error("refused: path escapes the domain root");
|
|
355525
355754
|
const prior = existsSync34(abs) ? readFileSync25(abs, "utf8") : SCAFFOLD_HEADER(env2);
|
|
@@ -357851,7 +358080,7 @@ var init_sse = __esm(() => {
|
|
|
357851
358080
|
});
|
|
357852
358081
|
|
|
357853
358082
|
// studio/server/watch.ts
|
|
357854
|
-
import { join as
|
|
358083
|
+
import { join as join56, relative as relative13 } from "node:path";
|
|
357855
358084
|
function ignored(p) {
|
|
357856
358085
|
return p.includes("node_modules") || p.includes(".domain-studio") || p.includes(".astrale") || p.includes(".dist");
|
|
357857
358086
|
}
|
|
@@ -357865,7 +358094,7 @@ function watchDomain(handle) {
|
|
|
357865
358094
|
ignoreInitial: true,
|
|
357866
358095
|
ignored
|
|
357867
358096
|
});
|
|
357868
|
-
const anatomyW = esm_default.watch(ANATOMY_PATHS.map((p) =>
|
|
358097
|
+
const anatomyW = esm_default.watch(ANATOMY_PATHS.map((p) => join56(handle.root, p)), { ignoreInitial: true, ignored });
|
|
357869
358098
|
let st;
|
|
357870
358099
|
let at;
|
|
357871
358100
|
schemaW.on("all", () => {
|
|
@@ -357954,7 +358183,7 @@ var init_workspace_state = __esm(() => {
|
|
|
357954
358183
|
|
|
357955
358184
|
// studio/server/workspace/create.ts
|
|
357956
358185
|
import { existsSync as existsSync35, readFileSync as readFileSync26, writeFileSync as writeFileSync11 } from "node:fs";
|
|
357957
|
-
import { join as
|
|
358186
|
+
import { join as join57 } from "node:path";
|
|
357958
358187
|
async function run2(cmd, args, cwd) {
|
|
357959
358188
|
try {
|
|
357960
358189
|
const proc = Bun.spawn([cmd, ...args], {
|
|
@@ -357986,7 +358215,7 @@ async function createDomain2(rawName, instance) {
|
|
|
357986
358215
|
const root = workspaceRoot();
|
|
357987
358216
|
if (!root)
|
|
357988
358217
|
return { ok: false, error: "No workspace root is configured.", output: "" };
|
|
357989
|
-
const dir =
|
|
358218
|
+
const dir = join57(root, name);
|
|
357990
358219
|
if (existsSync35(dir)) {
|
|
357991
358220
|
return {
|
|
357992
358221
|
ok: false,
|
|
@@ -358151,7 +358380,7 @@ var init_api2 = __esm(() => {
|
|
|
358151
358380
|
|
|
358152
358381
|
// studio/server/detect.ts
|
|
358153
358382
|
import { existsSync as existsSync36, lstatSync as lstatSync3, readdirSync as readdirSync14 } from "node:fs";
|
|
358154
|
-
import { dirname as dirname25, join as
|
|
358383
|
+
import { dirname as dirname25, join as join58, resolve as resolve17 } from "node:path";
|
|
358155
358384
|
function resolveTarget2(target2) {
|
|
358156
358385
|
const abs = resolve17(target2);
|
|
358157
358386
|
if (abs.endsWith("astrale.config.ts")) {
|
|
@@ -358185,7 +358414,7 @@ function scanWorkspace(workspace2, maxDepth = 4) {
|
|
|
358185
358414
|
for (const e of entries) {
|
|
358186
358415
|
if (IGNORE.has(e) || e.startsWith("."))
|
|
358187
358416
|
continue;
|
|
358188
|
-
const full =
|
|
358417
|
+
const full = join58(dir, e);
|
|
358189
358418
|
let st;
|
|
358190
358419
|
try {
|
|
358191
358420
|
st = lstatSync3(full);
|
|
@@ -358317,16 +358546,16 @@ var init_workspace_watch = __esm(() => {
|
|
|
358317
358546
|
// studio/server/index.ts
|
|
358318
358547
|
var exports_server = {};
|
|
358319
358548
|
import { existsSync as existsSync37, statSync as statSync12 } from "node:fs";
|
|
358320
|
-
import { dirname as dirname26, join as
|
|
358549
|
+
import { dirname as dirname26, join as join59, resolve as resolve18 } from "node:path";
|
|
358321
358550
|
function serveStatic(pathname) {
|
|
358322
358551
|
const rel = pathname === "/" ? "index.html" : pathname.replace(/^\//, "");
|
|
358323
|
-
const file2 =
|
|
358552
|
+
const file2 = join59(DIST, rel);
|
|
358324
358553
|
if (existsSync37(file2) && !file2.endsWith("/") && rel !== "index.html") {
|
|
358325
358554
|
return new Response(Bun.file(file2), {
|
|
358326
358555
|
headers: { "cache-control": "public, max-age=31536000, immutable" }
|
|
358327
358556
|
});
|
|
358328
358557
|
}
|
|
358329
|
-
const index3 =
|
|
358558
|
+
const index3 = join59(DIST, "index.html");
|
|
358330
358559
|
if (existsSync37(index3))
|
|
358331
358560
|
return new Response(Bun.file(index3), {
|
|
358332
358561
|
headers: { "content-type": "text/html", "cache-control": "no-store" }
|
|
@@ -358388,7 +358617,7 @@ var init_server2 = __esm(async () => {
|
|
|
358388
358617
|
initWorkspaceState(watchRoot);
|
|
358389
358618
|
if (existsSync37(watchRoot) && statSync12(watchRoot).isDirectory())
|
|
358390
358619
|
watchWorkspace(watchRoot, stoppers);
|
|
358391
|
-
DIST = process.env.DOMAIN_STUDIO_DIST ||
|
|
358620
|
+
DIST = process.env.DOMAIN_STUDIO_DIST || join59(import.meta.dir, "..", "client", "dist");
|
|
358392
358621
|
DEV = process.env.DOMAIN_STUDIO_DEV === "1";
|
|
358393
358622
|
VITE = process.env.VITE_URL || "http://localhost:5173";
|
|
358394
358623
|
HOST = process.env.DOMAIN_STUDIO_HOST || "127.0.0.1";
|
|
@@ -358437,22 +358666,22 @@ var init_server2 = __esm(async () => {
|
|
|
358437
358666
|
// studio/server/introspect/extractor.ts
|
|
358438
358667
|
var exports_extractor = {};
|
|
358439
358668
|
import { existsSync as existsSync38 } from "node:fs";
|
|
358440
|
-
import { mkdtemp as mkdtemp3, readFile as
|
|
358669
|
+
import { mkdtemp as mkdtemp3, readFile as readFile28, rm as rm10, writeFile as writeFile10 } from "node:fs/promises";
|
|
358441
358670
|
import { createRequire as createRequire2 } from "node:module";
|
|
358442
358671
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
358443
|
-
import { dirname as dirname27, join as
|
|
358672
|
+
import { dirname as dirname27, join as join60 } from "node:path";
|
|
358444
358673
|
import { pathToFileURL } from "node:url";
|
|
358445
358674
|
async function installedSdkSchema(root) {
|
|
358446
358675
|
let directory = root;
|
|
358447
358676
|
for (;; ) {
|
|
358448
|
-
const packageRoot =
|
|
358449
|
-
const manifestPath =
|
|
358677
|
+
const packageRoot = join60(directory, "node_modules", "@astrale-os", "sdk");
|
|
358678
|
+
const manifestPath = join60(packageRoot, "package.json");
|
|
358450
358679
|
if (existsSync38(manifestPath)) {
|
|
358451
|
-
const manifest = JSON.parse(await
|
|
358680
|
+
const manifest = JSON.parse(await readFile28(manifestPath, "utf8"));
|
|
358452
358681
|
const exported = manifest.exports?.["./schema"];
|
|
358453
358682
|
const target3 = typeof exported === "string" ? exported : exported?.import ?? exported?.default ?? exported?.types;
|
|
358454
358683
|
if (target3)
|
|
358455
|
-
return
|
|
358684
|
+
return join60(packageRoot, target3);
|
|
358456
358685
|
throw new Error(`${manifestPath} does not export @astrale-os/sdk/schema`);
|
|
358457
358686
|
}
|
|
358458
358687
|
const parent = dirname27(directory);
|
|
@@ -358476,10 +358705,10 @@ function buildFailure(cause) {
|
|
|
358476
358705
|
async function main() {
|
|
358477
358706
|
if (!schemaPath)
|
|
358478
358707
|
throw new Error("extractor: missing <schemaPath>");
|
|
358479
|
-
const temporary = await mkdtemp3(
|
|
358708
|
+
const temporary = await mkdtemp3(join60(tmpdir2(), "astrale-studio-extractor-"));
|
|
358480
358709
|
try {
|
|
358481
358710
|
const sdkPath = await installedSdkSchema(projectRoot);
|
|
358482
|
-
const wrapper =
|
|
358711
|
+
const wrapper = join60(temporary, "entry.ts");
|
|
358483
358712
|
await writeFile10(wrapper, `import * as authored from ${JSON.stringify(schemaPath)};
|
|
358484
358713
|
` + `import * as sdk from ${JSON.stringify(sdkPath)};
|
|
358485
358714
|
` + `export { authored, sdk };
|
|
@@ -358507,7 +358736,7 @@ async function main() {
|
|
|
358507
358736
|
throw new Error("schema bundle produced no entrypoint");
|
|
358508
358737
|
const source2 = await output3.text();
|
|
358509
358738
|
const module = { exports: {} };
|
|
358510
|
-
const require2 = createRequire2(pathToFileURL(
|
|
358739
|
+
const require2 = createRequire2(pathToFileURL(join60(projectRoot, "package.json")));
|
|
358511
358740
|
const factory = new Function(`return (
|
|
358512
358741
|
${source2}
|
|
358513
358742
|
);`)();
|
|
@@ -358528,7 +358757,7 @@ ${source2}
|
|
|
358528
358757
|
revision: extraction.revision
|
|
358529
358758
|
}));
|
|
358530
358759
|
} finally {
|
|
358531
|
-
await
|
|
358760
|
+
await rm10(temporary, { recursive: true, force: true });
|
|
358532
358761
|
}
|
|
358533
358762
|
}
|
|
358534
358763
|
var schemaPath, projectRoot;
|
|
@@ -358919,14 +359148,14 @@ init_proc();
|
|
|
358919
359148
|
init_prompt();
|
|
358920
359149
|
init_skills();
|
|
358921
359150
|
init_update();
|
|
358922
|
-
import { readFile as
|
|
358923
|
-
import { join as
|
|
359151
|
+
import { readFile as readFile10, rm as rm6 } from "node:fs/promises";
|
|
359152
|
+
import { join as join10 } from "node:path";
|
|
358924
359153
|
var CACHE_VERSION = 1;
|
|
358925
359154
|
var CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
358926
359155
|
var CHECK_TIMEOUT_MS = 4000;
|
|
358927
359156
|
var REEXEC_ENV = "ASTRALE_UPDATE_REEXEC";
|
|
358928
359157
|
function cachePath() {
|
|
358929
|
-
return
|
|
359158
|
+
return join10(paths2.home, "update-notice.json");
|
|
358930
359159
|
}
|
|
358931
359160
|
function parseCache(value) {
|
|
358932
359161
|
if (!value || typeof value !== "object")
|
|
@@ -358939,7 +359168,7 @@ function parseCache(value) {
|
|
|
358939
359168
|
}
|
|
358940
359169
|
async function readCache() {
|
|
358941
359170
|
try {
|
|
358942
|
-
return parseCache(JSON.parse(await
|
|
359171
|
+
return parseCache(JSON.parse(await readFile10(cachePath(), "utf8")));
|
|
358943
359172
|
} catch {
|
|
358944
359173
|
return;
|
|
358945
359174
|
}
|
|
@@ -359034,14 +359263,14 @@ async function updateAndReexec(release, argv) {
|
|
|
359034
359263
|
return false;
|
|
359035
359264
|
log.step(`Updating Astrale ${release.currentVersion} → ${release.latestVersion}`);
|
|
359036
359265
|
const environment = { ...process.env, [REEXEC_ENV]: "1" };
|
|
359037
|
-
const updated = await runInherit(execution.executable, ["update", "--
|
|
359266
|
+
const updated = await runInherit(execution.executable, ["update", "--no-deps"], {
|
|
359038
359267
|
env: environment
|
|
359039
359268
|
});
|
|
359040
359269
|
if (updated !== 0) {
|
|
359041
359270
|
log.warn("Automatic update did not complete; continuing with the current command.");
|
|
359042
359271
|
return false;
|
|
359043
359272
|
}
|
|
359044
|
-
await
|
|
359273
|
+
await rm6(cachePath(), { force: true }).catch(() => {
|
|
359045
359274
|
return;
|
|
359046
359275
|
});
|
|
359047
359276
|
const resumed = await runInherit(execution.executable, argv.slice(2), { env: environment });
|
|
@@ -359070,6 +359299,15 @@ async function offerReleaseUpdate(argv) {
|
|
|
359070
359299
|
}
|
|
359071
359300
|
async function offerSkillMaintenance() {
|
|
359072
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
|
+
}
|
|
359073
359311
|
if (state2.status !== "update-available" && state2.status !== "repair-needed")
|
|
359074
359312
|
return;
|
|
359075
359313
|
const label = state2.status === "repair-needed" ? "need repair" : "have an update available";
|
|
@@ -359165,7 +359403,15 @@ function registerCommand(parent, def) {
|
|
|
359165
359403
|
}
|
|
359166
359404
|
if (def.options) {
|
|
359167
359405
|
for (const opt of def.options) {
|
|
359168
|
-
if (opt.
|
|
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) {
|
|
359169
359415
|
const o = new Option2(opt.flags, opt.description);
|
|
359170
359416
|
o.choices(opt.choices);
|
|
359171
359417
|
if (opt.default !== undefined)
|
|
@@ -359428,12 +359674,12 @@ function redactArgv(argv) {
|
|
|
359428
359674
|
init_store();
|
|
359429
359675
|
import { createHash as createHash6 } from "node:crypto";
|
|
359430
359676
|
import { existsSync as existsSync15, mkdirSync as mkdirSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
359431
|
-
import { dirname as dirname16, join as
|
|
359677
|
+
import { dirname as dirname16, join as join30 } from "node:path";
|
|
359432
359678
|
var MAX_ID_LEN = 64;
|
|
359433
359679
|
function findGitRoot(start) {
|
|
359434
359680
|
let dir = start;
|
|
359435
359681
|
for (;; ) {
|
|
359436
|
-
if (existsSync15(
|
|
359682
|
+
if (existsSync15(join30(dir, ".git")))
|
|
359437
359683
|
return dir;
|
|
359438
359684
|
const parent = dirname16(dir);
|
|
359439
359685
|
if (parent === dir)
|
|
@@ -359543,19 +359789,19 @@ function beginInvocation(argv, sessions) {
|
|
|
359543
359789
|
// src/telemetry/store.ts
|
|
359544
359790
|
init_state();
|
|
359545
359791
|
import { existsSync as existsSync16, readdirSync as readdirSync6, readFileSync as readFileSync8, statSync as statSync6 } from "node:fs";
|
|
359546
|
-
import { join as
|
|
359792
|
+
import { join as join31 } from "node:path";
|
|
359547
359793
|
var IDLE_WINDOW_MS2 = 30 * 60 * 1000;
|
|
359548
359794
|
function sessionsRoot2() {
|
|
359549
|
-
return
|
|
359795
|
+
return join31(createPaths().home, "sessions");
|
|
359550
359796
|
}
|
|
359551
359797
|
function sessionDir2(id) {
|
|
359552
|
-
return
|
|
359798
|
+
return join31(sessionsRoot2(), id);
|
|
359553
359799
|
}
|
|
359554
359800
|
function eventsPath2(id) {
|
|
359555
|
-
return
|
|
359801
|
+
return join31(sessionDir2(id), "events.jsonl");
|
|
359556
359802
|
}
|
|
359557
359803
|
function markerPath2(id) {
|
|
359558
|
-
return
|
|
359804
|
+
return join31(sessionDir2(id), ".analyzed");
|
|
359559
359805
|
}
|
|
359560
359806
|
function sessionIds2() {
|
|
359561
359807
|
try {
|
|
@@ -359585,13 +359831,13 @@ init_settings();
|
|
|
359585
359831
|
init_store();
|
|
359586
359832
|
import { spawn as spawn4 } from "node:child_process";
|
|
359587
359833
|
import { existsSync as existsSync17, mkdirSync as mkdirSync6, readFileSync as readFileSync9, unlinkSync as unlinkSync4, writeFileSync as writeFileSync6 } from "node:fs";
|
|
359588
|
-
import { join as
|
|
359834
|
+
import { join as join32 } from "node:path";
|
|
359589
359835
|
var LOCK_STALE_MS2 = 30 * 60 * 1000;
|
|
359590
|
-
function
|
|
359591
|
-
return
|
|
359836
|
+
function lockPath3() {
|
|
359837
|
+
return join32(sessionsRoot(), ".analyzer.lock");
|
|
359592
359838
|
}
|
|
359593
359839
|
function claimLock() {
|
|
359594
|
-
const path9 =
|
|
359840
|
+
const path9 = lockPath3();
|
|
359595
359841
|
try {
|
|
359596
359842
|
if (existsSync17(path9)) {
|
|
359597
359843
|
const lock = JSON.parse(readFileSync9(path9, "utf-8"));
|