agenter 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agenter.js +277 -414
- package/package.json +2 -2
package/dist/agenter.js
CHANGED
|
@@ -138181,151 +138181,14 @@ var init_recording = () => {};
|
|
|
138181
138181
|
var init_warnings = () => {};
|
|
138182
138182
|
|
|
138183
138183
|
// node_modules/.bun/@termless+core@0.6.0/node_modules/@termless/core/src/backends.ts
|
|
138184
|
-
import { readFileSync as readFileSync11, existsSync as existsSync9, readdirSync as readdirSync4, mkdirSync as mkdirSync8, writeFileSync as writeFileSync5 } from "fs";
|
|
138185
138184
|
import { dirname as dirname12, join as join17 } from "path";
|
|
138186
138185
|
import { homedir as homedir6 } from "os";
|
|
138187
138186
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
138188
|
-
|
|
138189
|
-
function manifest() {
|
|
138190
|
-
if (_manifest)
|
|
138191
|
-
return _manifest;
|
|
138192
|
-
const raw2 = JSON.parse(readFileSync11(MANIFEST_PATH, "utf-8"));
|
|
138193
|
-
const backends = {};
|
|
138194
|
-
for (const [name2, entry] of Object.entries(raw2.backends)) {
|
|
138195
|
-
backends[name2] = {
|
|
138196
|
-
package: entry.package,
|
|
138197
|
-
upstream: entry.upstream ?? null,
|
|
138198
|
-
version: entry.upstreamVersion ?? null,
|
|
138199
|
-
type: entry.type,
|
|
138200
|
-
default: entry.default,
|
|
138201
|
-
platforms: entry.platforms,
|
|
138202
|
-
label: entry.label,
|
|
138203
|
-
description: entry.description,
|
|
138204
|
-
url: entry.url,
|
|
138205
|
-
caveat: entry.caveat,
|
|
138206
|
-
slug: entry.slug,
|
|
138207
|
-
terminal: entry.terminal
|
|
138208
|
-
};
|
|
138209
|
-
}
|
|
138210
|
-
_manifest = { version: raw2.version, backends };
|
|
138211
|
-
return _manifest;
|
|
138212
|
-
}
|
|
138213
|
-
function hasFilesWithExt(dir, ext, subdirs = []) {
|
|
138214
|
-
const dirs = [dir, ...subdirs.map((s) => join17(dir, s))];
|
|
138215
|
-
for (const d of dirs) {
|
|
138216
|
-
if (!existsSync9(d))
|
|
138217
|
-
continue;
|
|
138218
|
-
try {
|
|
138219
|
-
for (const f of readdirSync4(d)) {
|
|
138220
|
-
if (f.endsWith(ext))
|
|
138221
|
-
return true;
|
|
138222
|
-
}
|
|
138223
|
-
} catch {}
|
|
138224
|
-
}
|
|
138225
|
-
return false;
|
|
138226
|
-
}
|
|
138227
|
-
function resolveModule(pkg, opts) {
|
|
138228
|
-
return async () => {
|
|
138229
|
-
const mod2 = await import(pkg);
|
|
138230
|
-
return typeof mod2.resolve === "function" ? mod2.resolve(opts) : mod2[Object.keys(mod2).find((k) => k.startsWith("create"))](opts);
|
|
138231
|
-
};
|
|
138232
|
-
}
|
|
138233
|
-
function runBuildScript(pkgDir) {
|
|
138234
|
-
const buildScript = join17(pkgDir, "build", "build.sh");
|
|
138235
|
-
if (!existsSync9(buildScript))
|
|
138236
|
-
return;
|
|
138237
|
-
console.log(` Building in ${pkgDir}...`);
|
|
138238
|
-
try {
|
|
138239
|
-
execSync(`bash build/build.sh`, { cwd: pkgDir, stdio: "inherit" });
|
|
138240
|
-
} catch {
|
|
138241
|
-
const flakeDir = join17(__dirname3, "..");
|
|
138242
|
-
if (existsSync9(join17(flakeDir, "flake.nix"))) {
|
|
138243
|
-
execSync(`nix develop ${flakeDir} --command bash build/build.sh`, { cwd: pkgDir, stdio: "inherit" });
|
|
138244
|
-
} else {
|
|
138245
|
-
throw new Error(`Build failed. Install dependencies or use the nix flake: nix develop`);
|
|
138246
|
-
}
|
|
138247
|
-
}
|
|
138248
|
-
}
|
|
138249
|
-
function buildBackend(name2) {
|
|
138250
|
-
const m = manifest();
|
|
138251
|
-
const e = m.backends[name2];
|
|
138252
|
-
if (!e)
|
|
138253
|
-
throw new Error(`Unknown backend: ${name2}`);
|
|
138254
|
-
const type = backendTypes[e.type];
|
|
138255
|
-
if (!type)
|
|
138256
|
-
return;
|
|
138257
|
-
const pkgDir = findPackageDir(e.package);
|
|
138258
|
-
if (!pkgDir)
|
|
138259
|
-
return;
|
|
138260
|
-
if (!type.isReady(pkgDir)) {
|
|
138261
|
-
type.build(pkgDir);
|
|
138262
|
-
}
|
|
138263
|
-
}
|
|
138264
|
-
function isReady(name2) {
|
|
138265
|
-
const m = manifest();
|
|
138266
|
-
const entry = m.backends[name2];
|
|
138267
|
-
if (!entry)
|
|
138268
|
-
return false;
|
|
138269
|
-
try {
|
|
138270
|
-
import.meta.resolve(entry.package);
|
|
138271
|
-
} catch {
|
|
138272
|
-
return false;
|
|
138273
|
-
}
|
|
138274
|
-
const type = backendTypes[entry.type];
|
|
138275
|
-
if (!type)
|
|
138276
|
-
return false;
|
|
138277
|
-
const pkgDir = findPackageDir(entry.package);
|
|
138278
|
-
return pkgDir ? type.isReady(pkgDir) : false;
|
|
138279
|
-
}
|
|
138280
|
-
function findPackageDir(packageName) {
|
|
138281
|
-
try {
|
|
138282
|
-
const resolved = fileURLToPath5(import.meta.resolve(packageName));
|
|
138283
|
-
let dir = dirname12(resolved);
|
|
138284
|
-
for (let i = 0;i < 10; i++) {
|
|
138285
|
-
if (existsSync9(join17(dir, "package.json"))) {
|
|
138286
|
-
try {
|
|
138287
|
-
const pkg = JSON.parse(readFileSync11(join17(dir, "package.json"), "utf-8"));
|
|
138288
|
-
if (pkg.name === packageName)
|
|
138289
|
-
return dir;
|
|
138290
|
-
} catch {}
|
|
138291
|
-
}
|
|
138292
|
-
const parent = dirname12(dir);
|
|
138293
|
-
if (parent === dir)
|
|
138294
|
-
break;
|
|
138295
|
-
dir = parent;
|
|
138296
|
-
}
|
|
138297
|
-
} catch {}
|
|
138298
|
-
return null;
|
|
138299
|
-
}
|
|
138300
|
-
var __dirname3, MANIFEST_PATH, _manifest = null, backendTypes, CACHE_DIR;
|
|
138187
|
+
var __dirname3, MANIFEST_PATH, CACHE_DIR;
|
|
138301
138188
|
var init_backends = __esm(() => {
|
|
138302
138189
|
init_terminal();
|
|
138303
138190
|
__dirname3 = dirname12(fileURLToPath5(import.meta.url));
|
|
138304
138191
|
MANIFEST_PATH = join17(__dirname3, "..", "backends.json");
|
|
138305
|
-
backendTypes = {
|
|
138306
|
-
js: {
|
|
138307
|
-
isReady: () => true,
|
|
138308
|
-
build: () => {},
|
|
138309
|
-
resolve: async (pkg, opts) => resolveModule(pkg, opts)()
|
|
138310
|
-
},
|
|
138311
|
-
wasm: {
|
|
138312
|
-
isReady: (pkgDir) => {
|
|
138313
|
-
return hasFilesWithExt(pkgDir, ".wasm", ["wasm", "build"]) || !existsSync9(join17(pkgDir, "build"));
|
|
138314
|
-
},
|
|
138315
|
-
build: (pkgDir) => runBuildScript(pkgDir),
|
|
138316
|
-
resolve: async (pkg, opts) => resolveModule(pkg, opts)()
|
|
138317
|
-
},
|
|
138318
|
-
native: {
|
|
138319
|
-
isReady: (pkgDir) => hasFilesWithExt(pkgDir, ".node", ["build", "native"]),
|
|
138320
|
-
build: (pkgDir) => runBuildScript(pkgDir),
|
|
138321
|
-
resolve: async (pkg, opts) => resolveModule(pkg, opts)()
|
|
138322
|
-
},
|
|
138323
|
-
os: {
|
|
138324
|
-
isReady: () => true,
|
|
138325
|
-
build: () => {},
|
|
138326
|
-
resolve: async (pkg, opts) => resolveModule(pkg, opts)()
|
|
138327
|
-
}
|
|
138328
|
-
};
|
|
138329
138192
|
CACHE_DIR = join17(process.env.XDG_CACHE_HOME ?? join17(homedir6(), ".cache"), "termless", "backends");
|
|
138330
138193
|
});
|
|
138331
138194
|
|
|
@@ -142603,10 +142466,10 @@ var init_termless_xtermjs = __esm(() => {
|
|
|
142603
142466
|
|
|
142604
142467
|
// packages/termless-core/src/backend-factory.ts
|
|
142605
142468
|
import { execFileSync } from "child_process";
|
|
142606
|
-
import { existsSync as
|
|
142469
|
+
import { existsSync as existsSync9, readFileSync as readFileSync11 } from "fs";
|
|
142607
142470
|
import { createRequire as createRequire2 } from "module";
|
|
142608
142471
|
import { dirname as dirname13, join as join18 } from "path";
|
|
142609
|
-
var TERMINAL_BACKEND_KINDS, DEFAULT_TERMINAL_BACKEND = "xterm", isTerminalBackendKind = (value) => typeof value === "string" && TERMINAL_BACKEND_KINDS.includes(value),
|
|
142472
|
+
var TERMINAL_BACKEND_KINDS, DEFAULT_TERMINAL_BACKEND = "xterm", isTerminalBackendKind = (value) => typeof value === "string" && TERMINAL_BACKEND_KINDS.includes(value), require2, loadGhosttyNativeModule = () => {
|
|
142610
142473
|
return require2("@jixo/ghostty-native");
|
|
142611
142474
|
}, resolveInstalledPackageRoot = (packageName) => {
|
|
142612
142475
|
try {
|
|
@@ -142614,9 +142477,9 @@ var TERMINAL_BACKEND_KINDS, DEFAULT_TERMINAL_BACKEND = "xterm", isTerminalBacken
|
|
|
142614
142477
|
let dir = dirname13(resolvedEntry);
|
|
142615
142478
|
for (let depth = 0;depth < 10; depth += 1) {
|
|
142616
142479
|
const packageJsonPath = join18(dir, "package.json");
|
|
142617
|
-
if (
|
|
142480
|
+
if (existsSync9(packageJsonPath)) {
|
|
142618
142481
|
try {
|
|
142619
|
-
const pkg = JSON.parse(
|
|
142482
|
+
const pkg = JSON.parse(readFileSync11(packageJsonPath, "utf8"));
|
|
142620
142483
|
if (pkg.name === packageName) {
|
|
142621
142484
|
return dir;
|
|
142622
142485
|
}
|
|
@@ -142632,30 +142495,31 @@ var TERMINAL_BACKEND_KINDS, DEFAULT_TERMINAL_BACKEND = "xterm", isTerminalBacken
|
|
|
142632
142495
|
return null;
|
|
142633
142496
|
}
|
|
142634
142497
|
return null;
|
|
142635
|
-
}, hasGhosttyNativeArtifact = (packageRoot) =>
|
|
142498
|
+
}, hasGhosttyNativeArtifact = (packageRoot) => existsSync9(join18(packageRoot, "termless-ghostty-native.node")), ensureGhosttyNativeReady = () => {
|
|
142636
142499
|
const packageRoot = resolveInstalledPackageRoot("@jixo/ghostty-native");
|
|
142637
|
-
if (!packageRoot
|
|
142500
|
+
if (!packageRoot) {
|
|
142638
142501
|
return;
|
|
142639
142502
|
}
|
|
142640
|
-
|
|
142641
|
-
if (!existsSync10(buildScript)) {
|
|
142503
|
+
if (hasGhosttyNativeArtifact(packageRoot)) {
|
|
142642
142504
|
return;
|
|
142643
142505
|
}
|
|
142644
|
-
|
|
142645
|
-
|
|
142646
|
-
|
|
142647
|
-
|
|
142648
|
-
|
|
142649
|
-
|
|
142650
|
-
|
|
142651
|
-
|
|
142506
|
+
const buildScript = join18(packageRoot, "build", "build.sh");
|
|
142507
|
+
if (existsSync9(buildScript)) {
|
|
142508
|
+
execFileSync("bash", [buildScript], {
|
|
142509
|
+
cwd: packageRoot,
|
|
142510
|
+
stdio: "inherit"
|
|
142511
|
+
});
|
|
142512
|
+
}
|
|
142513
|
+
if (!hasGhosttyNativeArtifact(packageRoot)) {
|
|
142514
|
+
throw new Error(`ghostty-native artifact is missing in ${packageRoot}`);
|
|
142652
142515
|
}
|
|
142516
|
+
}, ensureTerminalBackendReady = (backend2) => {
|
|
142653
142517
|
if (backend2 === "ghostty-native") {
|
|
142654
|
-
|
|
142518
|
+
ensureGhosttyNativeReady();
|
|
142655
142519
|
}
|
|
142656
142520
|
}, createOfficialTerminalBackend = (backend2, input) => {
|
|
142657
142521
|
try {
|
|
142658
|
-
|
|
142522
|
+
ensureTerminalBackendReady(backend2);
|
|
142659
142523
|
if (backend2 === "xterm") {
|
|
142660
142524
|
return createXtermBackend2({
|
|
142661
142525
|
cols: input.cols,
|
|
@@ -142700,7 +142564,6 @@ var TERMINAL_BACKEND_KINDS, DEFAULT_TERMINAL_BACKEND = "xterm", isTerminalBacken
|
|
|
142700
142564
|
}
|
|
142701
142565
|
};
|
|
142702
142566
|
var init_backend_factory = __esm(() => {
|
|
142703
|
-
init_src16();
|
|
142704
142567
|
init_termless_xtermjs();
|
|
142705
142568
|
TERMINAL_BACKEND_KINDS = ["xterm", "ghostty-native"];
|
|
142706
142569
|
require2 = createRequire2(import.meta.url);
|
|
@@ -143231,7 +143094,7 @@ class Committer {
|
|
|
143231
143094
|
}
|
|
143232
143095
|
|
|
143233
143096
|
// packages/terminal-system/src/git-log.ts
|
|
143234
|
-
import { appendFileSync, existsSync as
|
|
143097
|
+
import { appendFileSync, existsSync as existsSync10, mkdirSync as mkdirSync8 } from "fs";
|
|
143235
143098
|
import { join as join19 } from "path";
|
|
143236
143099
|
|
|
143237
143100
|
class TerminalGitLogger {
|
|
@@ -143245,7 +143108,7 @@ class TerminalGitLogger {
|
|
|
143245
143108
|
this.workspace = workspace;
|
|
143246
143109
|
this.mode = mode;
|
|
143247
143110
|
const debugDir = join19(workspace, "debug");
|
|
143248
|
-
|
|
143111
|
+
mkdirSync8(debugDir, { recursive: true });
|
|
143249
143112
|
this.debugPath = join19(debugDir, "git-log.ndjson");
|
|
143250
143113
|
this.env = {
|
|
143251
143114
|
...Object.fromEntries(Object.entries(process.env).filter((entry2) => typeof entry2[1] === "string")),
|
|
@@ -143264,7 +143127,7 @@ class TerminalGitLogger {
|
|
|
143264
143127
|
}
|
|
143265
143128
|
this.queue = this.queue.then(async () => {
|
|
143266
143129
|
const gitDir = join19(this.workspace, ".git");
|
|
143267
|
-
if (!
|
|
143130
|
+
if (!existsSync10(gitDir)) {
|
|
143268
143131
|
const initResult = this.runGit(["init", "-q"]);
|
|
143269
143132
|
this.logDebug("git.init", {
|
|
143270
143133
|
ok: initResult.ok,
|
|
@@ -143371,7 +143234,7 @@ var decodeText = (data) => {
|
|
|
143371
143234
|
var init_git_log = () => {};
|
|
143372
143235
|
|
|
143373
143236
|
// packages/terminal-system/src/input-inbox.ts
|
|
143374
|
-
import { mkdirSync as
|
|
143237
|
+
import { mkdirSync as mkdirSync9, readdirSync as readdirSync4, readFileSync as readFileSync12, renameSync, watch } from "fs";
|
|
143375
143238
|
import { join as join20 } from "path";
|
|
143376
143239
|
|
|
143377
143240
|
class InputInbox {
|
|
@@ -143392,9 +143255,9 @@ class InputInbox {
|
|
|
143392
143255
|
this.doneDir = join20(options.inputDir, "done");
|
|
143393
143256
|
this.failedDir = join20(options.inputDir, "failed");
|
|
143394
143257
|
this.pollMs = options.pollMs ?? 120;
|
|
143395
|
-
|
|
143396
|
-
|
|
143397
|
-
|
|
143258
|
+
mkdirSync9(this.pendingDir, { recursive: true });
|
|
143259
|
+
mkdirSync9(this.doneDir, { recursive: true });
|
|
143260
|
+
mkdirSync9(this.failedDir, { recursive: true });
|
|
143398
143261
|
}
|
|
143399
143262
|
start() {
|
|
143400
143263
|
if (this.running) {
|
|
@@ -143442,7 +143305,7 @@ class InputInbox {
|
|
|
143442
143305
|
}
|
|
143443
143306
|
const files = (() => {
|
|
143444
143307
|
try {
|
|
143445
|
-
return
|
|
143308
|
+
return readdirSync4(this.pendingDir).filter(isInputFile).sort();
|
|
143446
143309
|
} catch (cause) {
|
|
143447
143310
|
const error53 = cause;
|
|
143448
143311
|
if (error53?.code === "ENOENT") {
|
|
@@ -143466,7 +143329,7 @@ class InputInbox {
|
|
|
143466
143329
|
if (!mode) {
|
|
143467
143330
|
throw new Error(`unsupported pending input suffix: ${name2}`);
|
|
143468
143331
|
}
|
|
143469
|
-
const raw2 =
|
|
143332
|
+
const raw2 = readFileSync12(src, "utf8");
|
|
143470
143333
|
await this.options.onInput(raw2, name2, mode);
|
|
143471
143334
|
renameSync(src, join20(this.doneDir, `${name2}.done`));
|
|
143472
143335
|
} catch (cause) {
|
|
@@ -143676,13 +143539,13 @@ var init_input_parser = __esm(() => {
|
|
|
143676
143539
|
// packages/terminal-system/src/pagination.ts
|
|
143677
143540
|
import {
|
|
143678
143541
|
appendFileSync as appendFileSync2,
|
|
143679
|
-
existsSync as
|
|
143680
|
-
mkdirSync as
|
|
143681
|
-
readFileSync as
|
|
143682
|
-
readdirSync as
|
|
143542
|
+
existsSync as existsSync11,
|
|
143543
|
+
mkdirSync as mkdirSync10,
|
|
143544
|
+
readFileSync as readFileSync13,
|
|
143545
|
+
readdirSync as readdirSync5,
|
|
143683
143546
|
renameSync as renameSync2,
|
|
143684
143547
|
rmSync as rmSync3,
|
|
143685
|
-
writeFileSync as
|
|
143548
|
+
writeFileSync as writeFileSync5
|
|
143686
143549
|
} from "fs";
|
|
143687
143550
|
import { dirname as dirname14, join as join21 } from "path";
|
|
143688
143551
|
|
|
@@ -143699,9 +143562,9 @@ class HtmlPaginationStore {
|
|
|
143699
143562
|
constructor(workspace, maxLinesPerFile) {
|
|
143700
143563
|
this.workspace = workspace;
|
|
143701
143564
|
this.maxLinesPerFile = maxLinesPerFile;
|
|
143702
|
-
|
|
143565
|
+
mkdirSync10(this.workspace, { recursive: true });
|
|
143703
143566
|
this.outputDir = join21(this.workspace, "output");
|
|
143704
|
-
|
|
143567
|
+
mkdirSync10(this.outputDir, { recursive: true });
|
|
143705
143568
|
this.latestPath = join21(this.outputDir, "latest.log.html");
|
|
143706
143569
|
const state = this.restoreState();
|
|
143707
143570
|
this.latestStartLine = state.latestStartLine;
|
|
@@ -143765,7 +143628,7 @@ class HtmlPaginationStore {
|
|
|
143765
143628
|
this.lastLoggedAbsoluteY = Math.max(this.lastLoggedAbsoluteY, total);
|
|
143766
143629
|
}
|
|
143767
143630
|
sealForResize(currentTotalLines, seed) {
|
|
143768
|
-
if (!
|
|
143631
|
+
if (!existsSync11(this.latestPath)) {
|
|
143769
143632
|
return null;
|
|
143770
143633
|
}
|
|
143771
143634
|
const endLine = Math.max(this.latestStartLine, currentTotalLines);
|
|
@@ -143777,7 +143640,7 @@ class HtmlPaginationStore {
|
|
|
143777
143640
|
};
|
|
143778
143641
|
appendResizeSplitFooter(this.latestPath, splitMeta);
|
|
143779
143642
|
const archivePath = join21(this.outputDir, archiveName);
|
|
143780
|
-
if (
|
|
143643
|
+
if (existsSync11(archivePath)) {
|
|
143781
143644
|
rmSync3(archivePath, { force: true });
|
|
143782
143645
|
}
|
|
143783
143646
|
renameSync2(this.latestPath, archivePath);
|
|
@@ -143870,7 +143733,7 @@ class HtmlPaginationStore {
|
|
|
143870
143733
|
const lastArchive = latestArchive(this.outputDir);
|
|
143871
143734
|
let latestStartLine = (lastArchive?.end ?? 0) + 1;
|
|
143872
143735
|
let lastLoggedAbsoluteY = lastArchive?.end ?? 0;
|
|
143873
|
-
if (!
|
|
143736
|
+
if (!existsSync11(this.latestPath)) {
|
|
143874
143737
|
return {
|
|
143875
143738
|
latestStartLine: Math.max(1, latestStartLine),
|
|
143876
143739
|
archiveChain: chain,
|
|
@@ -143897,7 +143760,7 @@ class HtmlPaginationStore {
|
|
|
143897
143760
|
const latestEnd = latestStart + latestLines.length - 1;
|
|
143898
143761
|
const archivedName = `${latestStart}~${latestEnd}.log.html`;
|
|
143899
143762
|
const archivedPath = join21(this.outputDir, archivedName);
|
|
143900
|
-
if (!
|
|
143763
|
+
if (!existsSync11(archivedPath)) {
|
|
143901
143764
|
renameSync2(this.latestPath, archivedPath);
|
|
143902
143765
|
} else {
|
|
143903
143766
|
rmSync3(this.latestPath, { force: true });
|
|
@@ -143946,7 +143809,7 @@ var ARCHIVE_FILE, META_PRE_FILE, LEGACY_META_PRE_FILE, toLineNumber = (value) =>
|
|
|
143946
143809
|
return null;
|
|
143947
143810
|
}
|
|
143948
143811
|
return { name: name2, start, end };
|
|
143949
|
-
}, listArchives = (dir) =>
|
|
143812
|
+
}, listArchives = (dir) => readdirSync5(dir).map((name2) => parseArchiveName(name2)).filter((item) => item !== null).sort((a, b) => a.start - b.start), latestArchive = (dir) => {
|
|
143950
143813
|
const items = listArchives(dir);
|
|
143951
143814
|
if (items.length === 0) {
|
|
143952
143815
|
return null;
|
|
@@ -143968,10 +143831,10 @@ var ARCHIVE_FILE, META_PRE_FILE, LEGACY_META_PRE_FILE, toLineNumber = (value) =>
|
|
|
143968
143831
|
}
|
|
143969
143832
|
return trim3.slice(marker + 3);
|
|
143970
143833
|
}, readBodyLines = (filePath) => {
|
|
143971
|
-
if (!
|
|
143834
|
+
if (!existsSync11(filePath)) {
|
|
143972
143835
|
return [];
|
|
143973
143836
|
}
|
|
143974
|
-
const raw2 =
|
|
143837
|
+
const raw2 = readFileSync13(filePath, "utf8");
|
|
143975
143838
|
const withoutMeta = stripLeadingMetaComment(raw2);
|
|
143976
143839
|
const withoutSource = stripSourceComments(withoutMeta);
|
|
143977
143840
|
const withoutResizeFooter = stripResizeFooterComments(withoutSource);
|
|
@@ -143982,10 +143845,10 @@ var ARCHIVE_FILE, META_PRE_FILE, LEGACY_META_PRE_FILE, toLineNumber = (value) =>
|
|
|
143982
143845
|
}
|
|
143983
143846
|
return lines;
|
|
143984
143847
|
}, parsePreFileFromLatest = (latestPath) => {
|
|
143985
|
-
if (!
|
|
143848
|
+
if (!existsSync11(latestPath)) {
|
|
143986
143849
|
return null;
|
|
143987
143850
|
}
|
|
143988
|
-
const raw2 =
|
|
143851
|
+
const raw2 = readFileSync13(latestPath, "utf8");
|
|
143989
143852
|
const match2 = META_PRE_FILE.exec(raw2) ?? LEGACY_META_PRE_FILE.exec(raw2);
|
|
143990
143853
|
if (!match2) {
|
|
143991
143854
|
return null;
|
|
@@ -144042,11 +143905,11 @@ ${buildSourceYaml(source, false)}`;
|
|
|
144042
143905
|
return `${head}
|
|
144043
143906
|
${joinHtmlLines(lines)}`;
|
|
144044
143907
|
}, writeArchiveFile = (filePath, meta3, source, lines, splitMeta) => {
|
|
144045
|
-
|
|
144046
|
-
|
|
143908
|
+
mkdirSync10(dirname14(filePath), { recursive: true });
|
|
143909
|
+
writeFileSync5(filePath, buildArchiveContent(meta3, source, lines, splitMeta), "utf8");
|
|
144047
143910
|
}, writeLatestFile = (filePath, meta3, source, lines, eventTag) => {
|
|
144048
|
-
|
|
144049
|
-
|
|
143911
|
+
mkdirSync10(dirname14(filePath), { recursive: true });
|
|
143912
|
+
writeFileSync5(filePath, buildLatestContent(meta3, source, lines, eventTag), "utf8");
|
|
144050
143913
|
}, appendResizeSplitFooter = (filePath, splitMeta) => {
|
|
144051
143914
|
const footer = [
|
|
144052
143915
|
"<!--",
|
|
@@ -144067,7 +143930,7 @@ var init_pagination3 = __esm(() => {
|
|
|
144067
143930
|
});
|
|
144068
143931
|
|
|
144069
143932
|
// packages/terminal-system/src/pty.ts
|
|
144070
|
-
import { mkdirSync as
|
|
143933
|
+
import { mkdirSync as mkdirSync11 } from "fs";
|
|
144071
143934
|
|
|
144072
143935
|
class Pty {
|
|
144073
143936
|
command;
|
|
@@ -144102,7 +143965,7 @@ class Pty {
|
|
|
144102
143965
|
const env3 = createEnv(this.color, this.env);
|
|
144103
143966
|
const command2 = resolveCommand(this.command, env3);
|
|
144104
143967
|
if (this.cwd && this.cwd.length > 0) {
|
|
144105
|
-
|
|
143968
|
+
mkdirSync11(this.cwd, { recursive: true });
|
|
144106
143969
|
}
|
|
144107
143970
|
this.proc = Bun.spawn([command2, ...this.args], {
|
|
144108
143971
|
cwd: this.cwd,
|
|
@@ -144438,14 +144301,14 @@ var init_types9 = __esm(() => {
|
|
|
144438
144301
|
});
|
|
144439
144302
|
|
|
144440
144303
|
// packages/terminal-system/src/workspace.ts
|
|
144441
|
-
import { existsSync as
|
|
144304
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync12, readdirSync as readdirSync6, rmSync as rmSync4, statSync as statSync3 } from "fs";
|
|
144442
144305
|
import { tmpdir } from "os";
|
|
144443
144306
|
import { isAbsolute as isAbsolute2, join as join22, resolve as resolve17 } from "path";
|
|
144444
144307
|
function createWorkspace(options) {
|
|
144445
144308
|
const rootDir3 = resolveOutputRoot(options?.outputRoot);
|
|
144446
|
-
|
|
144309
|
+
mkdirSync12(rootDir3, { recursive: true });
|
|
144447
144310
|
if (options?.workspacePath) {
|
|
144448
|
-
if (!
|
|
144311
|
+
if (!existsSync12(options.workspacePath)) {
|
|
144449
144312
|
throw new Error(`Workspace does not exist: ${options.workspacePath}`);
|
|
144450
144313
|
}
|
|
144451
144314
|
return options.workspacePath;
|
|
@@ -144458,14 +144321,14 @@ function createWorkspace(options) {
|
|
|
144458
144321
|
return found;
|
|
144459
144322
|
}
|
|
144460
144323
|
const dir = createUtcWorkspacePath(rootDir3, process.pid);
|
|
144461
|
-
|
|
144324
|
+
mkdirSync12(dir, { recursive: true });
|
|
144462
144325
|
return dir;
|
|
144463
144326
|
}
|
|
144464
144327
|
function destroyWorkspace(workspace, keepLogs) {
|
|
144465
144328
|
if (keepLogs) {
|
|
144466
144329
|
return;
|
|
144467
144330
|
}
|
|
144468
|
-
if (
|
|
144331
|
+
if (existsSync12(workspace)) {
|
|
144469
144332
|
rmSync4(workspace, { recursive: true, force: true });
|
|
144470
144333
|
}
|
|
144471
144334
|
}
|
|
@@ -144485,16 +144348,16 @@ var BASE_DIR, resolveOutputRoot = (outputRoot) => {
|
|
|
144485
144348
|
const hour = pad22(now.getUTCHours());
|
|
144486
144349
|
const minute = pad22(now.getUTCMinutes());
|
|
144487
144350
|
const dayDir = join22(rootDir3, year, month, day);
|
|
144488
|
-
|
|
144351
|
+
mkdirSync12(dayDir, { recursive: true });
|
|
144489
144352
|
const baseName = `${hour}_${minute}-${pid}`;
|
|
144490
144353
|
let candidate = join22(dayDir, baseName);
|
|
144491
|
-
if (!
|
|
144354
|
+
if (!existsSync12(candidate)) {
|
|
144492
144355
|
return candidate;
|
|
144493
144356
|
}
|
|
144494
144357
|
for (let index2 = 1;index2 < 100; index2 += 1) {
|
|
144495
144358
|
const suffix2 = pad22(index2);
|
|
144496
144359
|
candidate = join22(dayDir, `${baseName}-${suffix2}`);
|
|
144497
|
-
if (!
|
|
144360
|
+
if (!existsSync12(candidate)) {
|
|
144498
144361
|
return candidate;
|
|
144499
144362
|
}
|
|
144500
144363
|
}
|
|
@@ -144509,7 +144372,7 @@ var BASE_DIR, resolveOutputRoot = (outputRoot) => {
|
|
|
144509
144372
|
const stack = [rootDir3];
|
|
144510
144373
|
while (stack.length > 0) {
|
|
144511
144374
|
const current = stack.pop();
|
|
144512
|
-
const entries =
|
|
144375
|
+
const entries = readdirSync6(current, { withFileTypes: true });
|
|
144513
144376
|
for (const entry2 of entries) {
|
|
144514
144377
|
if (!entry2.isDirectory()) {
|
|
144515
144378
|
continue;
|
|
@@ -144523,7 +144386,7 @@ var BASE_DIR, resolveOutputRoot = (outputRoot) => {
|
|
|
144523
144386
|
}
|
|
144524
144387
|
return out;
|
|
144525
144388
|
}, findByPid = (rootDir3, pid) => {
|
|
144526
|
-
if (!
|
|
144389
|
+
if (!existsSync12(rootDir3)) {
|
|
144527
144390
|
return null;
|
|
144528
144391
|
}
|
|
144529
144392
|
const candidates = collectWorkspaceCandidates(rootDir3, pid).sort((a, b) => {
|
|
@@ -144652,7 +144515,7 @@ var OSC_PREFIX = "\x1B]", OSC_TERMINATOR_BEL = "\x07", OSC_TERMINATOR_ST = "\x1B
|
|
|
144652
144515
|
};
|
|
144653
144516
|
|
|
144654
144517
|
// packages/terminal-system/src/agentic-terminal.ts
|
|
144655
|
-
import { appendFileSync as appendFileSync3, mkdirSync as
|
|
144518
|
+
import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync13, writeFileSync as writeFileSync6 } from "fs";
|
|
144656
144519
|
import { join as join23 } from "path";
|
|
144657
144520
|
|
|
144658
144521
|
class AgenticTerminal {
|
|
@@ -144741,8 +144604,8 @@ class AgenticTerminal {
|
|
|
144741
144604
|
});
|
|
144742
144605
|
const inputDir = join23(this.workspace, "input");
|
|
144743
144606
|
const debugDir = join23(this.workspace, "debug");
|
|
144744
|
-
|
|
144745
|
-
|
|
144607
|
+
mkdirSync13(inputDir, { recursive: true });
|
|
144608
|
+
mkdirSync13(debugDir, { recursive: true });
|
|
144746
144609
|
this.debugLogPath = join23(debugDir, "terminal.ndjson");
|
|
144747
144610
|
this.debug("start", {
|
|
144748
144611
|
command: this.command,
|
|
@@ -144880,7 +144743,7 @@ class AgenticTerminal {
|
|
|
144880
144743
|
const failedFile = `${file2}.failed`;
|
|
144881
144744
|
const donePath = join23(this.workspace, "input", "done", doneFile);
|
|
144882
144745
|
const failedPath = join23(this.workspace, "input", "failed", failedFile);
|
|
144883
|
-
|
|
144746
|
+
writeFileSync6(pendingPath, input, "utf8");
|
|
144884
144747
|
this.appendInputLog(input, `queue:${file2}`);
|
|
144885
144748
|
this.debug("input.enqueue", { id, file: file2, mode });
|
|
144886
144749
|
this.inbox?.poke();
|
|
@@ -145666,7 +145529,7 @@ class AgenticTerminal {
|
|
|
145666
145529
|
}
|
|
145667
145530
|
try {
|
|
145668
145531
|
const debugDir = join23(this.workspace, "debug");
|
|
145669
|
-
|
|
145532
|
+
mkdirSync13(debugDir, { recursive: true });
|
|
145670
145533
|
appendFileSync3(this.debugLogPath, `${JSON.stringify({
|
|
145671
145534
|
ts: new Date().toISOString(),
|
|
145672
145535
|
source: "agentic-terminal",
|
|
@@ -145685,7 +145548,7 @@ class AgenticTerminal {
|
|
|
145685
145548
|
const end = Math.min(render.plainLines.length - 1, row + 4);
|
|
145686
145549
|
const context = render.plainLines.slice(start, end + 1);
|
|
145687
145550
|
const logPath = join23(this.workspace, "output", "cursor-debug.ndjson");
|
|
145688
|
-
|
|
145551
|
+
mkdirSync13(join23(this.workspace, "output"), { recursive: true });
|
|
145689
145552
|
const record2 = {
|
|
145690
145553
|
timestamp: new Date().toISOString(),
|
|
145691
145554
|
seq: this.renderSerial,
|
|
@@ -145815,7 +145678,7 @@ var init_agentic_terminal = __esm(() => {
|
|
|
145815
145678
|
});
|
|
145816
145679
|
|
|
145817
145680
|
// packages/terminal-system/src/default-shell-command.ts
|
|
145818
|
-
import { existsSync as
|
|
145681
|
+
import { existsSync as existsSync13 } from "fs";
|
|
145819
145682
|
import { delimiter, isAbsolute as isAbsolute3, join as join24 } from "path";
|
|
145820
145683
|
var findExecutableOnPath = (command2) => {
|
|
145821
145684
|
const pathValue = process.env.PATH;
|
|
@@ -145827,7 +145690,7 @@ var findExecutableOnPath = (command2) => {
|
|
|
145827
145690
|
continue;
|
|
145828
145691
|
}
|
|
145829
145692
|
const candidate = join24(segment, command2);
|
|
145830
|
-
if (
|
|
145693
|
+
if (existsSync13(candidate)) {
|
|
145831
145694
|
return candidate;
|
|
145832
145695
|
}
|
|
145833
145696
|
}
|
|
@@ -145838,7 +145701,7 @@ var findExecutableOnPath = (command2) => {
|
|
|
145838
145701
|
continue;
|
|
145839
145702
|
}
|
|
145840
145703
|
if (isAbsolute3(candidate)) {
|
|
145841
|
-
if (
|
|
145704
|
+
if (existsSync13(candidate)) {
|
|
145842
145705
|
return candidate;
|
|
145843
145706
|
}
|
|
145844
145707
|
continue;
|
|
@@ -150833,7 +150696,7 @@ var init_terminal_control_plane_types = __esm(() => {
|
|
|
150833
150696
|
|
|
150834
150697
|
// packages/terminal-system/src/terminal-db.ts
|
|
150835
150698
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
150836
|
-
import { mkdirSync as
|
|
150699
|
+
import { mkdirSync as mkdirSync14 } from "fs";
|
|
150837
150700
|
import { dirname as dirname15, resolve as resolve18 } from "path";
|
|
150838
150701
|
import { Database as Database5 } from "bun:sqlite";
|
|
150839
150702
|
|
|
@@ -150842,7 +150705,7 @@ class TerminalDb {
|
|
|
150842
150705
|
hasLegacyCwdColumn = false;
|
|
150843
150706
|
constructor(filePath) {
|
|
150844
150707
|
const fullPath = resolve18(filePath);
|
|
150845
|
-
|
|
150708
|
+
mkdirSync14(dirname15(fullPath), { recursive: true });
|
|
150846
150709
|
this.db = new Database5(fullPath, { create: true, strict: true });
|
|
150847
150710
|
this.migrate();
|
|
150848
150711
|
}
|
|
@@ -156182,7 +156045,7 @@ var init_auth_draft_types = __esm(() => {
|
|
|
156182
156045
|
|
|
156183
156046
|
// packages/app-server/src/auth-draft-store.ts
|
|
156184
156047
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
156185
|
-
import { mkdirSync as
|
|
156048
|
+
import { mkdirSync as mkdirSync15 } from "fs";
|
|
156186
156049
|
import { homedir as homedir8 } from "os";
|
|
156187
156050
|
import { dirname as dirname17, join as join26, resolve as resolve20 } from "path";
|
|
156188
156051
|
import { Database as Database6 } from "bun:sqlite";
|
|
@@ -156192,7 +156055,7 @@ class AuthDraftStore {
|
|
|
156192
156055
|
listeners = new Set;
|
|
156193
156056
|
constructor(filePath = resolveAuthDraftDbPath()) {
|
|
156194
156057
|
const fullPath = resolve20(filePath);
|
|
156195
|
-
|
|
156058
|
+
mkdirSync15(dirname17(fullPath), { recursive: true });
|
|
156196
156059
|
this.db = new Database6(fullPath, { create: true, strict: true });
|
|
156197
156060
|
this.migrate();
|
|
156198
156061
|
}
|
|
@@ -156599,7 +156462,7 @@ var init_auth_kv_types = __esm(() => {
|
|
|
156599
156462
|
});
|
|
156600
156463
|
|
|
156601
156464
|
// packages/app-server/src/auth-kv-store.ts
|
|
156602
|
-
import { mkdirSync as
|
|
156465
|
+
import { mkdirSync as mkdirSync16 } from "fs";
|
|
156603
156466
|
import { homedir as homedir9 } from "os";
|
|
156604
156467
|
import { dirname as dirname18, join as join27, resolve as resolve21 } from "path";
|
|
156605
156468
|
import { Database as Database7 } from "bun:sqlite";
|
|
@@ -156609,7 +156472,7 @@ class AuthKvStore {
|
|
|
156609
156472
|
listeners = new Set;
|
|
156610
156473
|
constructor(filePath = resolveAuthKvDbPath()) {
|
|
156611
156474
|
const fullPath = resolve21(filePath);
|
|
156612
|
-
|
|
156475
|
+
mkdirSync16(dirname18(fullPath), { recursive: true });
|
|
156613
156476
|
this.db = new Database7(fullPath, { create: true, strict: true });
|
|
156614
156477
|
this.migrate();
|
|
156615
156478
|
}
|
|
@@ -156852,7 +156715,7 @@ var init_auth_kv_store = __esm(() => {
|
|
|
156852
156715
|
});
|
|
156853
156716
|
|
|
156854
156717
|
// packages/app-server/src/auth-service-bridge-impl.ts
|
|
156855
|
-
import { existsSync as
|
|
156718
|
+
import { existsSync as existsSync14 } from "fs";
|
|
156856
156719
|
import { join as join28 } from "path";
|
|
156857
156720
|
import { suffix as suffix2 } from "bun:ffi";
|
|
156858
156721
|
|
|
@@ -157285,7 +157148,7 @@ var toOwnedArrayBuffer2 = (bytes) => new Uint8Array(bytes).buffer, jsonHeaders,
|
|
|
157285
157148
|
return;
|
|
157286
157149
|
}
|
|
157287
157150
|
const path4 = join28(root, ...segments);
|
|
157288
|
-
return
|
|
157151
|
+
return existsSync14(path4) ? path4 : undefined;
|
|
157289
157152
|
}, withBearerToken = (token, headers = {}) => token ? { ...headers, authorization: `Bearer ${token}` } : headers, withTrailingSlashTrimmed = (value) => value.replace(/\/$/, ""), toExternalLikeAuthDescriptor = (descriptor) => ({
|
|
157290
157153
|
...descriptor,
|
|
157291
157154
|
rootAuthBootstrapMode: "external",
|
|
@@ -218510,7 +218373,7 @@ var require_sql_wasm = __commonJS((exports, module) => {
|
|
|
218510
218373
|
if (initSqlJsPromise) {
|
|
218511
218374
|
return initSqlJsPromise;
|
|
218512
218375
|
}
|
|
218513
|
-
initSqlJsPromise = new Promise(function(
|
|
218376
|
+
initSqlJsPromise = new Promise(function(resolveModule, reject) {
|
|
218514
218377
|
var Module = typeof moduleConfig !== "undefined" ? moduleConfig : {};
|
|
218515
218378
|
var originalOnAbortFunction = Module["onAbort"];
|
|
218516
218379
|
Module["onAbort"] = function(errorThatCausedAbort) {
|
|
@@ -218521,7 +218384,7 @@ var require_sql_wasm = __commonJS((exports, module) => {
|
|
|
218521
218384
|
};
|
|
218522
218385
|
Module["postRun"] = Module["postRun"] || [];
|
|
218523
218386
|
Module["postRun"].push(function() {
|
|
218524
|
-
|
|
218387
|
+
resolveModule(Module);
|
|
218525
218388
|
});
|
|
218526
218389
|
module = undefined;
|
|
218527
218390
|
var k16;
|
|
@@ -233746,11 +233609,11 @@ var GLOBAL_WORKSPACE_PATH = "~/", normalizeGlobalToken = (value) => {
|
|
|
233746
233609
|
var init_workspace_target = () => {};
|
|
233747
233610
|
|
|
233748
233611
|
// packages/app-server/src/workspace-system/paths.ts
|
|
233749
|
-
import { existsSync as
|
|
233612
|
+
import { existsSync as existsSync16, realpathSync as realpathSync5 } from "fs";
|
|
233750
233613
|
import { homedir as homedir11 } from "os";
|
|
233751
233614
|
import { join as join34 } from "path";
|
|
233752
233615
|
var normalizeWorkspaceAssetKind = (value) => value, resolveAliasTargetOrSelf2 = (path6) => {
|
|
233753
|
-
if (!
|
|
233616
|
+
if (!existsSync16(path6)) {
|
|
233754
233617
|
return path6;
|
|
233755
233618
|
}
|
|
233756
233619
|
try {
|
|
@@ -233789,7 +233652,7 @@ var init_paths = __esm(() => {
|
|
|
233789
233652
|
});
|
|
233790
233653
|
|
|
233791
233654
|
// packages/app-server/src/workspace-system/tool-bindings.ts
|
|
233792
|
-
import { accessSync, existsSync as
|
|
233655
|
+
import { accessSync, existsSync as existsSync17, constants as fsConstants, readdirSync as readdirSync9, readFileSync as readFileSync14, statSync as statSync5 } from "fs";
|
|
233793
233656
|
import { join as join35, resolve as resolve28 } from "path";
|
|
233794
233657
|
var WORKSPACE_TOOL_HELP_METADATA_SUFFIX = ".cli.json", workspaceToolHelpcenterMetadataSchema, ensureReadableDirectory = (path6) => {
|
|
233795
233658
|
try {
|
|
@@ -233799,7 +233662,7 @@ var WORKSPACE_TOOL_HELP_METADATA_SUFFIX = ".cli.json", workspaceToolHelpcenterMe
|
|
|
233799
233662
|
return false;
|
|
233800
233663
|
}
|
|
233801
233664
|
}, isWorkspaceToolMetadataFile = (fileName) => fileName.endsWith(WORKSPACE_TOOL_HELP_METADATA_SUFFIX), resolveToolRunner = (filePath) => {
|
|
233802
|
-
const firstLine =
|
|
233665
|
+
const firstLine = readFileSync14(filePath, "utf8").split(/\r?\n/u, 1)[0] ?? "";
|
|
233803
233666
|
if (firstLine.includes("python")) {
|
|
233804
233667
|
return "python3";
|
|
233805
233668
|
}
|
|
@@ -233817,11 +233680,11 @@ var WORKSPACE_TOOL_HELP_METADATA_SUFFIX = ".cli.json", workspaceToolHelpcenterMe
|
|
|
233817
233680
|
}
|
|
233818
233681
|
return "bash";
|
|
233819
233682
|
}, resolveWorkspaceToolMetadataPath = (rootPath, fileName) => join35(rootPath, `${fileName}${WORKSPACE_TOOL_HELP_METADATA_SUFFIX}`), readWorkspaceToolHelpcenterMetadata = (metadataPath) => {
|
|
233820
|
-
if (!
|
|
233683
|
+
if (!existsSync17(metadataPath)) {
|
|
233821
233684
|
return null;
|
|
233822
233685
|
}
|
|
233823
233686
|
try {
|
|
233824
|
-
const parsed = JSON.parse(
|
|
233687
|
+
const parsed = JSON.parse(readFileSync14(metadataPath, "utf8"));
|
|
233825
233688
|
return workspaceToolHelpcenterMetadataSchema.parse(parsed);
|
|
233826
233689
|
} catch {
|
|
233827
233690
|
return null;
|
|
@@ -233842,7 +233705,7 @@ var WORKSPACE_TOOL_HELP_METADATA_SUFFIX = ".cli.json", workspaceToolHelpcenterMe
|
|
|
233842
233705
|
if (!ensureReadableDirectory(root2.rootPath)) {
|
|
233843
233706
|
continue;
|
|
233844
233707
|
}
|
|
233845
|
-
for (const entry2 of
|
|
233708
|
+
for (const entry2 of readdirSync9(root2.rootPath, { withFileTypes: true })) {
|
|
233846
233709
|
if (!entry2.isFile() || isWorkspaceToolMetadataFile(entry2.name)) {
|
|
233847
233710
|
continue;
|
|
233848
233711
|
}
|
|
@@ -233864,7 +233727,7 @@ var WORKSPACE_TOOL_HELP_METADATA_SUFFIX = ".cli.json", workspaceToolHelpcenterMe
|
|
|
233864
233727
|
description: metadata.description,
|
|
233865
233728
|
skillRef: metadata.skillRef
|
|
233866
233729
|
} : {
|
|
233867
|
-
metadataPath:
|
|
233730
|
+
metadataPath: existsSync17(metadataPath) ? metadataPath : null,
|
|
233868
233731
|
registered: false,
|
|
233869
233732
|
name: entry2.name,
|
|
233870
233733
|
description: buildWorkspaceToolFallbackDescription({
|
|
@@ -234219,7 +234082,7 @@ var init_one_shot_shell_guard = __esm(() => {
|
|
|
234219
234082
|
});
|
|
234220
234083
|
|
|
234221
234084
|
// packages/app-server/src/workspace-system/private-isolation.ts
|
|
234222
|
-
import { readdirSync as
|
|
234085
|
+
import { readdirSync as readdirSync10, realpathSync as realpathSync6 } from "fs";
|
|
234223
234086
|
import { relative as relative4, resolve as resolve29 } from "path";
|
|
234224
234087
|
var resolveExistingPath = (path6) => {
|
|
234225
234088
|
try {
|
|
@@ -234235,7 +234098,7 @@ var resolveExistingPath = (path6) => {
|
|
|
234235
234098
|
return relation.length === 0 ? "/" : `/${relation}`;
|
|
234236
234099
|
}, listSiblingDirectories = (root2) => {
|
|
234237
234100
|
try {
|
|
234238
|
-
return
|
|
234101
|
+
return readdirSync10(root2, { withFileTypes: true }).filter((entry2) => entry2.isDirectory() || entry2.isSymbolicLink()).map((entry2) => entry2.name);
|
|
234239
234102
|
} catch {
|
|
234240
234103
|
return [];
|
|
234241
234104
|
}
|
|
@@ -234265,10 +234128,10 @@ var init_private_isolation = __esm(() => {
|
|
|
234265
234128
|
});
|
|
234266
234129
|
|
|
234267
234130
|
// packages/app-server/src/workspace-system/exec.ts
|
|
234268
|
-
import { mkdirSync as
|
|
234131
|
+
import { mkdirSync as mkdirSync17 } from "fs";
|
|
234269
234132
|
import { relative as relative5, resolve as resolve30 } from "path";
|
|
234270
234133
|
var WORKSPACE_SYSTEM_GRANT_KINDS, createBashFs = (input) => {
|
|
234271
|
-
|
|
234134
|
+
mkdirSync17(input.workspacePath, { recursive: true });
|
|
234272
234135
|
const systemGrantPatterns = WORKSPACE_SYSTEM_GRANT_KINDS.flatMap((kind7) => {
|
|
234273
234136
|
const roots = [
|
|
234274
234137
|
resolveWorkspacePublicAssetRoot(input.workspacePath, kind7),
|
|
@@ -234492,7 +234355,7 @@ try {
|
|
|
234492
234355
|
});
|
|
234493
234356
|
|
|
234494
234357
|
// packages/app-server/src/workspace-system/root-exec.ts
|
|
234495
|
-
import { mkdirSync as
|
|
234358
|
+
import { mkdirSync as mkdirSync18 } from "fs";
|
|
234496
234359
|
import { relative as relative6, resolve as resolve31 } from "path";
|
|
234497
234360
|
|
|
234498
234361
|
class RootWorkspaceShellWorld {
|
|
@@ -234505,7 +234368,7 @@ class RootWorkspaceShellWorld {
|
|
|
234505
234368
|
constructor(input) {
|
|
234506
234369
|
this.rootWorkspacePath = resolve31(input.rootWorkspacePath);
|
|
234507
234370
|
ensureMountParentDirs(this.baseFs, this.rootWorkspacePath);
|
|
234508
|
-
|
|
234371
|
+
mkdirSync18(this.rootWorkspacePath, { recursive: true });
|
|
234509
234372
|
this.mountableFs.mount(this.rootWorkspacePath, new Ss3({ root: this.rootWorkspacePath }));
|
|
234510
234373
|
this.bash = new xt7({
|
|
234511
234374
|
fs: this.mountableFs,
|
|
@@ -234572,7 +234435,7 @@ class RootWorkspaceShellWorld {
|
|
|
234572
234435
|
this.mountableFs.unmount(path6);
|
|
234573
234436
|
}
|
|
234574
234437
|
ensureMountParentDirs(this.baseFs, path6);
|
|
234575
|
-
|
|
234438
|
+
mkdirSync18(path6, { recursive: true });
|
|
234576
234439
|
const nextState = createDynamicMountState(mount);
|
|
234577
234440
|
this.mountableFs.mount(path6, nextState.fs);
|
|
234578
234441
|
this.dynamicMounts.set(path6, nextState);
|
|
@@ -234716,7 +234579,7 @@ var init_root_exec = __esm(() => {
|
|
|
234716
234579
|
|
|
234717
234580
|
// packages/app-server/src/workspace-system/store.ts
|
|
234718
234581
|
import { createHash as createHash10, randomUUID as randomUUID9 } from "crypto";
|
|
234719
|
-
import { mkdirSync as
|
|
234582
|
+
import { mkdirSync as mkdirSync19, readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
|
|
234720
234583
|
import { homedir as homedir12 } from "os";
|
|
234721
234584
|
import { dirname as dirname23, join as join36 } from "path";
|
|
234722
234585
|
|
|
@@ -234902,7 +234765,7 @@ class WorkspaceSystemStore {
|
|
|
234902
234765
|
}
|
|
234903
234766
|
readSnapshot() {
|
|
234904
234767
|
try {
|
|
234905
|
-
const parsed = JSON.parse(
|
|
234768
|
+
const parsed = JSON.parse(readFileSync15(this.filePath, "utf8"));
|
|
234906
234769
|
if (parsed.version === 3) {
|
|
234907
234770
|
return {
|
|
234908
234771
|
version: 3,
|
|
@@ -234986,8 +234849,8 @@ class WorkspaceSystemStore {
|
|
|
234986
234849
|
return index2 >= 0 ? index2 + 1 : ordered.length + 1;
|
|
234987
234850
|
}
|
|
234988
234851
|
flush() {
|
|
234989
|
-
|
|
234990
|
-
|
|
234852
|
+
mkdirSync19(dirname23(this.filePath), { recursive: true });
|
|
234853
|
+
writeFileSync7(this.filePath, `${JSON.stringify(this.snapshot, null, 2)}
|
|
234991
234854
|
`, "utf8");
|
|
234992
234855
|
}
|
|
234993
234856
|
}
|
|
@@ -235030,16 +234893,16 @@ var init_workspace_system = __esm(() => {
|
|
|
235030
234893
|
|
|
235031
234894
|
// packages/app-server/src/avatar-seat-store.ts
|
|
235032
234895
|
import {
|
|
235033
|
-
existsSync as
|
|
234896
|
+
existsSync as existsSync18,
|
|
235034
234897
|
lstatSync as lstatSync4,
|
|
235035
|
-
mkdirSync as
|
|
235036
|
-
readdirSync as
|
|
235037
|
-
readFileSync as
|
|
234898
|
+
mkdirSync as mkdirSync20,
|
|
234899
|
+
readdirSync as readdirSync11,
|
|
234900
|
+
readFileSync as readFileSync16,
|
|
235038
234901
|
realpathSync as realpathSync7,
|
|
235039
234902
|
renameSync as renameSync3,
|
|
235040
234903
|
rmSync as rmSync5,
|
|
235041
234904
|
symlinkSync,
|
|
235042
|
-
writeFileSync as
|
|
234905
|
+
writeFileSync as writeFileSync8
|
|
235043
234906
|
} from "fs";
|
|
235044
234907
|
import { homedir as homedir13 } from "os";
|
|
235045
234908
|
import { dirname as dirname24, join as join37, relative as relative7 } from "path";
|
|
@@ -235048,11 +234911,11 @@ var createEmptyAvatarSeatDocument = () => ({
|
|
|
235048
234911
|
messageSeats: {},
|
|
235049
234912
|
terminalSeats: {}
|
|
235050
234913
|
}), mergeLegacyAvatarDirectory = (sourceRoot, canonicalRoot) => {
|
|
235051
|
-
|
|
235052
|
-
for (const entry2 of
|
|
234914
|
+
mkdirSync20(canonicalRoot, { recursive: true });
|
|
234915
|
+
for (const entry2 of readdirSync11(sourceRoot, { withFileTypes: true })) {
|
|
235053
234916
|
const sourcePath = join37(sourceRoot, entry2.name);
|
|
235054
234917
|
const canonicalPath = join37(canonicalRoot, entry2.name);
|
|
235055
|
-
if (
|
|
234918
|
+
if (existsSync18(canonicalPath)) {
|
|
235056
234919
|
if (entry2.isDirectory() && lstatSync4(canonicalPath).isDirectory()) {
|
|
235057
234920
|
mergeLegacyAvatarDirectory(sourcePath, canonicalPath);
|
|
235058
234921
|
rmSync5(sourcePath, { recursive: true, force: true });
|
|
@@ -235067,8 +234930,8 @@ var createEmptyAvatarSeatDocument = () => ({
|
|
|
235067
234930
|
const homeDir = input.homeDir ?? homedir13();
|
|
235068
234931
|
const canonicalRoot = resolveWorkspaceAvatarCanonicalRoot(input.workspacePath, input.principalId, homeDir);
|
|
235069
234932
|
const aliasPath = resolveWorkspaceAvatarAliasRoot(input.workspacePath, input.avatar, homeDir);
|
|
235070
|
-
|
|
235071
|
-
|
|
234933
|
+
mkdirSync20(canonicalRoot, { recursive: true });
|
|
234934
|
+
mkdirSync20(dirname24(aliasPath), { recursive: true });
|
|
235072
234935
|
try {
|
|
235073
234936
|
const stats = lstatSync4(aliasPath);
|
|
235074
234937
|
if (stats.isDirectory()) {
|
|
@@ -235187,11 +235050,11 @@ var createEmptyAvatarSeatDocument = () => ({
|
|
|
235187
235050
|
};
|
|
235188
235051
|
}, readAvatarSeatDocument = (workspacePath, avatar, homeDir = homedir13()) => {
|
|
235189
235052
|
const filePath = resolveAvatarSeatSettingsPath(workspacePath, avatar, homeDir);
|
|
235190
|
-
if (!
|
|
235053
|
+
if (!existsSync18(filePath)) {
|
|
235191
235054
|
return createEmptyAvatarSeatDocument();
|
|
235192
235055
|
}
|
|
235193
235056
|
try {
|
|
235194
|
-
return normalizeSeatDocument(JSON.parse(
|
|
235057
|
+
return normalizeSeatDocument(JSON.parse(readFileSync16(filePath, "utf8")));
|
|
235195
235058
|
} catch {
|
|
235196
235059
|
return createEmptyAvatarSeatDocument();
|
|
235197
235060
|
}
|
|
@@ -235232,8 +235095,8 @@ var createEmptyAvatarSeatDocument = () => ({
|
|
|
235232
235095
|
principalId: input.doc.principalId,
|
|
235233
235096
|
homeDir
|
|
235234
235097
|
}).canonicalRoot, "settings.local.json") : resolveAvatarSeatSettingsPath(input.workspacePath, input.avatar, homeDir);
|
|
235235
|
-
|
|
235236
|
-
|
|
235098
|
+
mkdirSync20(dirname24(filePath), { recursive: true });
|
|
235099
|
+
writeFileSync8(filePath, `${JSON.stringify(input.doc, null, 2)}
|
|
235237
235100
|
`, "utf8");
|
|
235238
235101
|
return input.doc;
|
|
235239
235102
|
}, saveAvatarMessageSeatCredential = (input) => {
|
|
@@ -235284,7 +235147,7 @@ var init_avatar_seat_store = __esm(() => {
|
|
|
235284
235147
|
});
|
|
235285
235148
|
|
|
235286
235149
|
// packages/app-server/src/avatar-catalog.ts
|
|
235287
|
-
import { existsSync as
|
|
235150
|
+
import { existsSync as existsSync19, readdirSync as readdirSync12 } from "fs";
|
|
235288
235151
|
import { homedir as homedir14 } from "os";
|
|
235289
235152
|
var compareAvatarNickname = (left2, right2) => {
|
|
235290
235153
|
if (left2 === defaultAvatarNickname()) {
|
|
@@ -235297,11 +235160,11 @@ var compareAvatarNickname = (left2, right2) => {
|
|
|
235297
235160
|
}, resolveWorkspaceAvatarRoot = (workspacePath, homeDir) => {
|
|
235298
235161
|
return isGlobalWorkspacePath(workspacePath, homeDir) ? resolveGlobalAvatarNicknamesRoot(homeDir) : resolveWorkspaceAvatarNicknamesRoot(workspacePath, homeDir);
|
|
235299
235162
|
}, listAvatarNicknames = (root2) => {
|
|
235300
|
-
if (!
|
|
235163
|
+
if (!existsSync19(root2)) {
|
|
235301
235164
|
return [];
|
|
235302
235165
|
}
|
|
235303
235166
|
try {
|
|
235304
|
-
return
|
|
235167
|
+
return readdirSync12(root2, { withFileTypes: true }).filter((entry2) => entry2.isDirectory() || entry2.isSymbolicLink()).map((entry2) => normalizeAvatarNickname(entry2.name));
|
|
235305
235168
|
} catch {
|
|
235306
235169
|
return [];
|
|
235307
235170
|
}
|
|
@@ -235324,8 +235187,8 @@ var compareAvatarNickname = (left2, right2) => {
|
|
|
235324
235187
|
const nickname = normalizeAvatarNickname(input.nickname);
|
|
235325
235188
|
const globalPath = resolveGlobalAvatarRoot(nickname, input.homeDir);
|
|
235326
235189
|
const workspacePrivatePath = resolveWorkspaceAvatarPrivateRoot(input.workspacePath, nickname, input.homeDir);
|
|
235327
|
-
const globalAvailable = input.globalAvailable ?? (
|
|
235328
|
-
const workspacePrivateSlotReady = !isGlobalWorkspacePath(input.workspacePath, input.homeDir) &&
|
|
235190
|
+
const globalAvailable = input.globalAvailable ?? (existsSync19(resolveGlobalAvatarAliasRoot(nickname, input.homeDir)) || existsSync19(globalPath));
|
|
235191
|
+
const workspacePrivateSlotReady = !isGlobalWorkspacePath(input.workspacePath, input.homeDir) && existsSync19(resolveWorkspaceAvatarAliasRoot(input.workspacePath, nickname, input.homeDir));
|
|
235329
235192
|
return {
|
|
235330
235193
|
avatarPrincipalId: input.avatarPrincipalId ?? null,
|
|
235331
235194
|
runtimeId: resolveAvatarRuntimeId(nickname),
|
|
@@ -235903,7 +235766,7 @@ var init_heartbeat_groups_page = __esm(() => {
|
|
|
235903
235766
|
});
|
|
235904
235767
|
|
|
235905
235768
|
// packages/app-server/src/local-env.ts
|
|
235906
|
-
import { existsSync as
|
|
235769
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync21, readFileSync as readFileSync17, writeFileSync as writeFileSync9 } from "fs";
|
|
235907
235770
|
import { join as join39 } from "path";
|
|
235908
235771
|
var splitEnvLine = (line) => {
|
|
235909
235772
|
const trimmed = line.trim();
|
|
@@ -235931,16 +235794,16 @@ var splitEnvLine = (line) => {
|
|
|
235931
235794
|
`)}
|
|
235932
235795
|
`, resolveLocalEnvPath = (homeDir) => join39(homeDir, ".agenter", "local.env"), readLocalEnvValue = (homeDir, key) => {
|
|
235933
235796
|
const filePath = resolveLocalEnvPath(homeDir);
|
|
235934
|
-
if (!
|
|
235797
|
+
if (!existsSync20(filePath)) {
|
|
235935
235798
|
return null;
|
|
235936
235799
|
}
|
|
235937
|
-
return parseEnvFile(
|
|
235800
|
+
return parseEnvFile(readFileSync17(filePath, "utf8")).get(key) ?? null;
|
|
235938
235801
|
}, writeLocalEnvValue = (homeDir, key, value) => {
|
|
235939
235802
|
const filePath = resolveLocalEnvPath(homeDir);
|
|
235940
|
-
|
|
235941
|
-
const entries =
|
|
235803
|
+
mkdirSync21(join39(homeDir, ".agenter"), { recursive: true });
|
|
235804
|
+
const entries = existsSync20(filePath) ? parseEnvFile(readFileSync17(filePath, "utf8")) : new Map;
|
|
235942
235805
|
entries.set(key, value.trim());
|
|
235943
|
-
|
|
235806
|
+
writeFileSync9(filePath, serializeEnvFile(entries), "utf8");
|
|
235944
235807
|
return filePath;
|
|
235945
235808
|
};
|
|
235946
235809
|
var init_local_env = () => {};
|
|
@@ -241256,7 +241119,7 @@ var init_session_assets = __esm(() => {
|
|
|
241256
241119
|
|
|
241257
241120
|
// packages/app-server/src/room-assets.ts
|
|
241258
241121
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
241259
|
-
import { existsSync as
|
|
241122
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync22, readFileSync as readFileSync18, writeFileSync as writeFileSync10 } from "fs";
|
|
241260
241123
|
import { dirname as dirname26, join as join40, posix as posixPath2 } from "path";
|
|
241261
241124
|
|
|
241262
241125
|
class RoomAssetStore {
|
|
@@ -241275,15 +241138,15 @@ class RoomAssetStore {
|
|
|
241275
241138
|
}
|
|
241276
241139
|
readIndex(roomId) {
|
|
241277
241140
|
const indexPath = this.getIndexPath(roomId);
|
|
241278
|
-
if (!
|
|
241141
|
+
if (!existsSync21(indexPath)) {
|
|
241279
241142
|
return [];
|
|
241280
241143
|
}
|
|
241281
|
-
return parseRoomAssetIndex(
|
|
241144
|
+
return parseRoomAssetIndex(readFileSync18(indexPath, "utf8"));
|
|
241282
241145
|
}
|
|
241283
241146
|
writeIndex(roomId, records) {
|
|
241284
241147
|
const indexPath = this.getIndexPath(roomId);
|
|
241285
|
-
|
|
241286
|
-
|
|
241148
|
+
mkdirSync22(dirname26(indexPath), { recursive: true });
|
|
241149
|
+
writeFileSync10(indexPath, `${JSON.stringify(records, null, 2)}
|
|
241287
241150
|
`, "utf8");
|
|
241288
241151
|
}
|
|
241289
241152
|
uploadAssets(roomId, files, input = {}) {
|
|
@@ -241305,8 +241168,8 @@ class RoomAssetStore {
|
|
|
241305
241168
|
uploadedByActorId: input.uploadedByActorId
|
|
241306
241169
|
};
|
|
241307
241170
|
const filePath = this.resolveAbsolutePath(record2.relativePath);
|
|
241308
|
-
|
|
241309
|
-
|
|
241171
|
+
mkdirSync22(dirname26(filePath), { recursive: true });
|
|
241172
|
+
writeFileSync10(filePath, file3.bytes);
|
|
241310
241173
|
created.push(record2);
|
|
241311
241174
|
}
|
|
241312
241175
|
if (created.length > 0) {
|
|
@@ -241676,20 +241539,20 @@ var init_runtime_tool_views = __esm(() => {
|
|
|
241676
241539
|
});
|
|
241677
241540
|
|
|
241678
241541
|
// packages/app-server/src/session-doc.ts
|
|
241679
|
-
import { existsSync as
|
|
241542
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync23, readFileSync as readFileSync19, writeFileSync as writeFileSync11 } from "fs";
|
|
241680
241543
|
import { dirname as dirname27 } from "path";
|
|
241681
241544
|
var readSessionDocument = (filePath) => {
|
|
241682
|
-
if (!
|
|
241545
|
+
if (!existsSync22(filePath)) {
|
|
241683
241546
|
return null;
|
|
241684
241547
|
}
|
|
241685
241548
|
try {
|
|
241686
|
-
return JSON.parse(
|
|
241549
|
+
return JSON.parse(readFileSync19(filePath, "utf8"));
|
|
241687
241550
|
} catch {
|
|
241688
241551
|
return null;
|
|
241689
241552
|
}
|
|
241690
241553
|
}, writeSessionDocument = (filePath, doc2) => {
|
|
241691
|
-
|
|
241692
|
-
|
|
241554
|
+
mkdirSync23(dirname27(filePath), { recursive: true });
|
|
241555
|
+
writeFileSync11(filePath, `${JSON.stringify(doc2, null, 2)}
|
|
241693
241556
|
`, "utf8");
|
|
241694
241557
|
};
|
|
241695
241558
|
var init_session_doc = () => {};
|
|
@@ -241703,7 +241566,7 @@ var init_session_identity = __esm(() => {
|
|
|
241703
241566
|
});
|
|
241704
241567
|
|
|
241705
241568
|
// packages/app-server/src/session-catalog.ts
|
|
241706
|
-
import { existsSync as
|
|
241569
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync24, readdirSync as readdirSync13, renameSync as renameSync4, rmSync as rmSync6 } from "fs";
|
|
241707
241570
|
import { homedir as homedir16 } from "os";
|
|
241708
241571
|
import { basename as basename9, dirname as dirname28, join as join41, resolve as resolve32 } from "path";
|
|
241709
241572
|
|
|
@@ -241766,7 +241629,7 @@ class SessionCatalog {
|
|
|
241766
241629
|
}),
|
|
241767
241630
|
storeTarget: input.storeTarget
|
|
241768
241631
|
};
|
|
241769
|
-
|
|
241632
|
+
mkdirSync24(session.sessionRoot, { recursive: true });
|
|
241770
241633
|
this.persistMeta(session);
|
|
241771
241634
|
this.byId.set(id, session);
|
|
241772
241635
|
return session;
|
|
@@ -241799,7 +241662,7 @@ class SessionCatalog {
|
|
|
241799
241662
|
}
|
|
241800
241663
|
const archivedAt = isoNow();
|
|
241801
241664
|
const nextRoot = this.resolveArchiveSessionRoot(current.id, archivedAt);
|
|
241802
|
-
|
|
241665
|
+
mkdirSync24(dirname28(nextRoot), { recursive: true });
|
|
241803
241666
|
renameSync4(current.sessionRoot, nextRoot);
|
|
241804
241667
|
const next2 = {
|
|
241805
241668
|
...current,
|
|
@@ -241823,7 +241686,7 @@ class SessionCatalog {
|
|
|
241823
241686
|
return current;
|
|
241824
241687
|
}
|
|
241825
241688
|
const nextRoot = this.resolveActiveSessionRoot(current);
|
|
241826
|
-
|
|
241689
|
+
mkdirSync24(dirname28(nextRoot), { recursive: true });
|
|
241827
241690
|
renameSync4(current.sessionRoot, nextRoot);
|
|
241828
241691
|
const restoredAt = isoNow();
|
|
241829
241692
|
const next2 = {
|
|
@@ -241909,7 +241772,7 @@ class SessionCatalog {
|
|
|
241909
241772
|
const roots = [];
|
|
241910
241773
|
for (const avatarRoot of legacyRoots) {
|
|
241911
241774
|
try {
|
|
241912
|
-
const avatars =
|
|
241775
|
+
const avatars = readdirSync13(avatarRoot, { withFileTypes: true });
|
|
241913
241776
|
for (const avatar of avatars) {
|
|
241914
241777
|
if (!avatar.isDirectory()) {
|
|
241915
241778
|
continue;
|
|
@@ -241961,14 +241824,14 @@ class SessionCatalog {
|
|
|
241961
241824
|
return meta3.id === resolveWorkspaceAvatarSessionId(GLOBAL_WORKSPACE_PATH, meta3.avatar);
|
|
241962
241825
|
}
|
|
241963
241826
|
quarantineSessionRoot(sessionRoot) {
|
|
241964
|
-
if (!
|
|
241827
|
+
if (!existsSync23(sessionRoot)) {
|
|
241965
241828
|
return;
|
|
241966
241829
|
}
|
|
241967
241830
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
241968
241831
|
const baseName = basename9(sessionRoot) || "session";
|
|
241969
241832
|
const targetRoot = join41(this.legacyRoot, timestamp, baseName);
|
|
241970
241833
|
try {
|
|
241971
|
-
|
|
241834
|
+
mkdirSync24(dirname28(targetRoot), { recursive: true });
|
|
241972
241835
|
renameSync4(sessionRoot, targetRoot);
|
|
241973
241836
|
} catch {
|
|
241974
241837
|
rmSync6(sessionRoot, { recursive: true, force: true });
|
|
@@ -242024,22 +241887,22 @@ var isoNow = () => new Date().toISOString(), toUtcBucket = (isoLike) => {
|
|
|
242024
241887
|
}, scanBucketedSessionRoots = (baseDir) => {
|
|
242025
241888
|
const roots = [];
|
|
242026
241889
|
try {
|
|
242027
|
-
for (const year of
|
|
241890
|
+
for (const year of readdirSync13(baseDir, { withFileTypes: true })) {
|
|
242028
241891
|
if (!year.isDirectory()) {
|
|
242029
241892
|
continue;
|
|
242030
241893
|
}
|
|
242031
241894
|
const yearDir = join41(baseDir, year.name);
|
|
242032
|
-
for (const month of
|
|
241895
|
+
for (const month of readdirSync13(yearDir, { withFileTypes: true })) {
|
|
242033
241896
|
if (!month.isDirectory()) {
|
|
242034
241897
|
continue;
|
|
242035
241898
|
}
|
|
242036
241899
|
const monthDir = join41(yearDir, month.name);
|
|
242037
|
-
for (const day of
|
|
241900
|
+
for (const day of readdirSync13(monthDir, { withFileTypes: true })) {
|
|
242038
241901
|
if (!day.isDirectory()) {
|
|
242039
241902
|
continue;
|
|
242040
241903
|
}
|
|
242041
241904
|
const dayDir = join41(monthDir, day.name);
|
|
242042
|
-
for (const session of
|
|
241905
|
+
for (const session of readdirSync13(dayDir, { withFileTypes: true })) {
|
|
242043
241906
|
if (session.isDirectory()) {
|
|
242044
241907
|
roots.push(join41(dayDir, session.name));
|
|
242045
241908
|
}
|
|
@@ -242053,7 +241916,7 @@ var isoNow = () => new Date().toISOString(), toUtcBucket = (isoLike) => {
|
|
|
242053
241916
|
return roots;
|
|
242054
241917
|
}, scanDirectSessionRoots = (baseDir) => {
|
|
242055
241918
|
try {
|
|
242056
|
-
return
|
|
241919
|
+
return readdirSync13(baseDir, { withFileTypes: true }).filter((entry2) => entry2.isDirectory()).map((entry2) => join41(baseDir, entry2.name)).filter((entry2) => existsSync23(join41(entry2, "session.json")));
|
|
242057
241920
|
} catch {
|
|
242058
241921
|
return [];
|
|
242059
241922
|
}
|
|
@@ -242074,7 +241937,7 @@ var resolveSessionRoomActorId = (sessionId) => `session:${sessionId}`;
|
|
|
242074
241937
|
|
|
242075
241938
|
// packages/app-server/src/i18n.ts
|
|
242076
241939
|
import { copyFile, mkdir as mkdir5, mkdtemp, readFile as readFile4, rm as rm2 } from "fs/promises";
|
|
242077
|
-
import { existsSync as
|
|
241940
|
+
import { existsSync as existsSync24 } from "fs";
|
|
242078
241941
|
import { homedir as homedir17, tmpdir as tmpdir2 } from "os";
|
|
242079
241942
|
import { join as join42 } from "path";
|
|
242080
241943
|
var APP_SERVER_PACKAGE_JSON_PATH, BUNDLED_ASSETS_ROOT_ENV2 = "AGENTER_BUNDLED_ASSETS_ROOT", DEFAULT_LANGUAGE = "en", LANG_PACKAGES, VERSION_PATTERN, textDecoder2, parseLangAlias = (value) => {
|
|
@@ -242122,7 +241985,7 @@ var APP_SERVER_PACKAGE_JSON_PATH, BUNDLED_ASSETS_ROOT_ENV2 = "AGENTER_BUNDLED_AS
|
|
|
242122
241985
|
const bundledRoot = process.env[BUNDLED_ASSETS_ROOT_ENV2]?.trim();
|
|
242123
241986
|
if (bundledRoot) {
|
|
242124
241987
|
const promptsDir2 = join42(bundledRoot, config2.workspaceDirName, "prompts");
|
|
242125
|
-
if (
|
|
241988
|
+
if (existsSync24(promptsDir2)) {
|
|
242126
241989
|
return buildPromptDocsFromDir(promptsDir2);
|
|
242127
241990
|
}
|
|
242128
241991
|
}
|
|
@@ -254986,7 +254849,7 @@ var init_sql = __esm(() => {
|
|
|
254986
254849
|
});
|
|
254987
254850
|
|
|
254988
254851
|
// packages/app-server/src/mcp-system/store.ts
|
|
254989
|
-
import { mkdirSync as
|
|
254852
|
+
import { mkdirSync as mkdirSync25 } from "fs";
|
|
254990
254853
|
import { dirname as dirname29, resolve as resolve34 } from "path";
|
|
254991
254854
|
import { Database as Database8 } from "bun:sqlite";
|
|
254992
254855
|
|
|
@@ -254994,7 +254857,7 @@ class McpSystemStore {
|
|
|
254994
254857
|
db;
|
|
254995
254858
|
constructor(filePath) {
|
|
254996
254859
|
const fullPath = resolve34(filePath);
|
|
254997
|
-
|
|
254860
|
+
mkdirSync25(dirname29(fullPath), { recursive: true });
|
|
254998
254861
|
this.db = new Database8(fullPath, { create: true, strict: true });
|
|
254999
254862
|
this.db.exec(`pragma journal_mode = WAL;`);
|
|
255000
254863
|
this.db.exec(`pragma foreign_keys = on;`);
|
|
@@ -255523,7 +255386,7 @@ var init_store2 = __esm(() => {
|
|
|
255523
255386
|
});
|
|
255524
255387
|
|
|
255525
255388
|
// packages/app-server/src/mcp-system/system.ts
|
|
255526
|
-
import { mkdirSync as
|
|
255389
|
+
import { mkdirSync as mkdirSync26 } from "fs";
|
|
255527
255390
|
import { resolve as resolve35 } from "path";
|
|
255528
255391
|
|
|
255529
255392
|
class McpSystem {
|
|
@@ -255537,7 +255400,7 @@ class McpSystem {
|
|
|
255537
255400
|
locks = new Map;
|
|
255538
255401
|
constructor(options) {
|
|
255539
255402
|
this.rootWorkspacePath = resolve35(options.rootWorkspacePath);
|
|
255540
|
-
|
|
255403
|
+
mkdirSync26(this.rootWorkspacePath, { recursive: true });
|
|
255541
255404
|
this.runtimeEnv = cloneStringRecord(options.runtimeEnv);
|
|
255542
255405
|
this.clientName = options.clientName ?? "agenter-mcp-system";
|
|
255543
255406
|
this.clientVersion = options.clientVersion ?? "0.0.0";
|
|
@@ -279990,7 +279853,7 @@ References:
|
|
|
279990
279853
|
|
|
279991
279854
|
// packages/app-server/src/runtime-skill-config.ts
|
|
279992
279855
|
import { createHash as createHash13 } from "crypto";
|
|
279993
|
-
import { existsSync as
|
|
279856
|
+
import { existsSync as existsSync25, readFileSync as readFileSync20, readdirSync as readdirSync14, statSync as statSync6, writeFileSync as writeFileSync12 } from "fs";
|
|
279994
279857
|
import { basename as basename11, isAbsolute as isAbsolute11, join as join47, relative as relative9, resolve as resolve38 } from "path";
|
|
279995
279858
|
var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtimeSkillConfigSchema, MAGIC_PATTERN, normalizeConfigPattern = (value) => {
|
|
279996
279859
|
const normalized = value.replace(/\\/gu, "/").trim().replace(/^\.\/+/u, "");
|
|
@@ -280010,8 +279873,8 @@ var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtime
|
|
|
280010
279873
|
return segments.join("/");
|
|
280011
279874
|
}, normalizeConfigFiles = (value) => ({
|
|
280012
279875
|
files: value.files?.map((item) => normalizeConfigPattern(item)).filter((item, index3, items) => items.indexOf(item) === index3).sort((left2, right2) => left2.localeCompare(right2)) ?? undefined
|
|
280013
|
-
}), parseConfigJson = (raw2) => normalizeConfigFiles(runtimeSkillConfigSchema.parse(JSON.parse(raw2))), hashContent = (value) => createHash13("sha1").update(value).digest("hex"), readFileFingerprint = (path6) => hashContent(
|
|
280014
|
-
if (depth > maxDepth || !
|
|
279876
|
+
}), parseConfigJson = (raw2) => normalizeConfigFiles(runtimeSkillConfigSchema.parse(JSON.parse(raw2))), hashContent = (value) => createHash13("sha1").update(value).digest("hex"), readFileFingerprint = (path6) => hashContent(readFileSync20(path6, "utf8")), walkFiles = (root3, depth = 0, maxDepth = Number.POSITIVE_INFINITY) => {
|
|
279877
|
+
if (depth > maxDepth || !existsSync25(root3)) {
|
|
280015
279878
|
return [];
|
|
280016
279879
|
}
|
|
280017
279880
|
const stats = statSync6(root3);
|
|
@@ -280019,7 +279882,7 @@ var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtime
|
|
|
280019
279882
|
return stats.isFile() ? [root3] : [];
|
|
280020
279883
|
}
|
|
280021
279884
|
const output = [];
|
|
280022
|
-
for (const entry2 of
|
|
279885
|
+
for (const entry2 of readdirSync14(root3, { withFileTypes: true })) {
|
|
280023
279886
|
const nextPath = join47(root3, entry2.name);
|
|
280024
279887
|
if (entry2.isDirectory()) {
|
|
280025
279888
|
output.push(...walkFiles(nextPath, depth + 1, maxDepth));
|
|
@@ -280046,7 +279909,7 @@ var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtime
|
|
|
280046
279909
|
};
|
|
280047
279910
|
}, resolvePatternMatches = (skillDir, spec) => {
|
|
280048
279911
|
const matcher = new Minimatch(spec.pattern, MATCH_OPTIONS2);
|
|
280049
|
-
if (!
|
|
279912
|
+
if (!existsSync25(spec.anchorPath)) {
|
|
280050
279913
|
return [];
|
|
280051
279914
|
}
|
|
280052
279915
|
const stats = statSync6(spec.anchorPath);
|
|
@@ -280060,18 +279923,18 @@ var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtime
|
|
|
280060
279923
|
return walkFiles(spec.anchorPath, 0, maxDepth).map((path6) => resolve38(path6)).filter((path6) => matcher.match(relative9(skillDir, path6).replace(/\\/gu, "/"))).sort((left2, right2) => left2.localeCompare(right2));
|
|
280061
279924
|
}, resolveDeclaredPatterns = (skill, config2) => (config2?.files ?? []).map((pattern) => {
|
|
280062
279925
|
const absoluteCandidate = resolve38(skill.skillDir, pattern);
|
|
280063
|
-
if (!pattern.includes("*") &&
|
|
279926
|
+
if (!pattern.includes("*") && existsSync25(absoluteCandidate) && statSync6(absoluteCandidate).isDirectory()) {
|
|
280064
279927
|
return `${pattern.replace(/\/$/u, "")}/**`;
|
|
280065
279928
|
}
|
|
280066
279929
|
return pattern;
|
|
280067
279930
|
}), getRuntimeSkillConfigPath = (skill) => resolve38(skill.configPath || join47(skill.skillDir, RUNTIME_SKILL_CONFIG_BASENAME)), readRuntimeSkillConfigState = (skill) => {
|
|
280068
279931
|
const configPath = getRuntimeSkillConfigPath(skill);
|
|
280069
|
-
const configExists =
|
|
279932
|
+
const configExists = existsSync25(configPath);
|
|
280070
279933
|
let config2 = null;
|
|
280071
279934
|
let configError = null;
|
|
280072
279935
|
if (configExists) {
|
|
280073
279936
|
try {
|
|
280074
|
-
config2 = parseConfigJson(
|
|
279937
|
+
config2 = parseConfigJson(readFileSync20(configPath, "utf8"));
|
|
280075
279938
|
} catch (error53) {
|
|
280076
279939
|
configError = error53 instanceof Error ? error53.message : String(error53);
|
|
280077
279940
|
}
|
|
@@ -280102,7 +279965,7 @@ var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtime
|
|
|
280102
279965
|
};
|
|
280103
279966
|
}, buildRuntimeSkillObservedFiles = (skill, state = readRuntimeSkillConfigState(skill)) => {
|
|
280104
279967
|
const observed = new Set;
|
|
280105
|
-
if (
|
|
279968
|
+
if (existsSync25(skill.path)) {
|
|
280106
279969
|
observed.add(resolve38(skill.path));
|
|
280107
279970
|
} else if (typeof skill.content === "string" && skill.content.length > 0) {
|
|
280108
279971
|
observed.add(resolve38(skill.path));
|
|
@@ -280114,7 +279977,7 @@ var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtime
|
|
|
280114
279977
|
if (target2 === resolve38(skill.path) || target2 === resolve38(state.configPath)) {
|
|
280115
279978
|
continue;
|
|
280116
279979
|
}
|
|
280117
|
-
if (
|
|
279980
|
+
if (existsSync25(target2) && statSync6(target2).isFile()) {
|
|
280118
279981
|
observed.add(resolve38(target2));
|
|
280119
279982
|
}
|
|
280120
279983
|
}
|
|
@@ -280122,7 +279985,7 @@ var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtime
|
|
|
280122
279985
|
}, buildRuntimeSkillFileFingerprintMap = (skill, state = readRuntimeSkillConfigState(skill)) => {
|
|
280123
279986
|
const fingerprints = new Map;
|
|
280124
279987
|
for (const path6 of buildRuntimeSkillObservedFiles(skill, state)) {
|
|
280125
|
-
if (
|
|
279988
|
+
if (existsSync25(path6)) {
|
|
280126
279989
|
fingerprints.set(path6, readFileFingerprint(path6));
|
|
280127
279990
|
continue;
|
|
280128
279991
|
}
|
|
@@ -280134,7 +279997,7 @@ var RUNTIME_SKILL_CONFIG_BASENAME = "ccski.config.json", MATCH_OPTIONS2, runtime
|
|
|
280134
279997
|
}, writeRuntimeSkillConfigFile = (skill, config2) => {
|
|
280135
279998
|
const normalized = normalizeConfigFiles(config2);
|
|
280136
279999
|
const configPath = getRuntimeSkillConfigPath(skill);
|
|
280137
|
-
|
|
280000
|
+
writeFileSync12(configPath, `${JSON.stringify(normalized, null, 2)}
|
|
280138
280001
|
`, "utf8");
|
|
280139
280002
|
return configPath;
|
|
280140
280003
|
}, hasRuntimeSkillRecursiveWatchSpec = (state) => state.watchSpecs.some((spec) => spec.recursive), formatRuntimeSkillRelativeFiles = (skillDir, paths, maxItems = 3) => {
|
|
@@ -280201,12 +280064,12 @@ var normalizeRuntimeSkillName = (value) => value.trim().toLowerCase(), parseRunt
|
|
|
280201
280064
|
};
|
|
280202
280065
|
|
|
280203
280066
|
// packages/app-server/src/runtime-skills.ts
|
|
280204
|
-
import { existsSync as
|
|
280067
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync27, readFileSync as readFileSync21, readdirSync as readdirSync15, rmSync as rmSync7, statSync as statSync7, writeFileSync as writeFileSync13 } from "fs";
|
|
280205
280068
|
import { homedir as homedir19 } from "os";
|
|
280206
280069
|
import { basename as basename12, dirname as dirname31, join as join48, relative as relative10, resolve as resolve39 } from "path";
|
|
280207
280070
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
280208
280071
|
var RUNTIME_API_BASE_URL_ENV = "AGENTER_ATTENTION_API_BASE_URL", RUNTIME_MANAGED_SEAT_AUTHORITY_URL_ENV = "AGENTER_MANAGED_SEAT_AUTHORITY_URL", RUNTIME_HOME_DIR_ENV = "AGENTER_HOME_DIR", RUNTIME_PRINCIPAL_ID_ENV = "AGENTER_AVATAR_PRINCIPAL_ID", RUNTIME_PRIVATE_KEY_ENV = "AGENTER_AVATAR_PRIVATE_KEY", RUNTIME_ROOT_WORKSPACE_ENV = "AGENTER_ROOT_WORKSPACE", DEFAULT_REPO_ROOT, RUNTIME_TOOL_NAMESPACES, EXAMPLE_SLOT_PATTERN, RUNTIME_SKILL_VISIBLE_LAYER_ORDER, collectSkillFiles = (root3, depth = 0) => {
|
|
280209
|
-
if (!
|
|
280072
|
+
if (!existsSync26(root3) || depth > 4) {
|
|
280210
280073
|
return [];
|
|
280211
280074
|
}
|
|
280212
280075
|
let stats;
|
|
@@ -280219,11 +280082,11 @@ var RUNTIME_API_BASE_URL_ENV = "AGENTER_ATTENTION_API_BASE_URL", RUNTIME_MANAGED
|
|
|
280219
280082
|
return [];
|
|
280220
280083
|
}
|
|
280221
280084
|
const directSkill = join48(root3, "SKILL.md");
|
|
280222
|
-
if (
|
|
280085
|
+
if (existsSync26(directSkill)) {
|
|
280223
280086
|
return [directSkill];
|
|
280224
280087
|
}
|
|
280225
280088
|
const output = [];
|
|
280226
|
-
for (const entry2 of
|
|
280089
|
+
for (const entry2 of readdirSync15(root3, { withFileTypes: true })) {
|
|
280227
280090
|
if (!entry2.isDirectory()) {
|
|
280228
280091
|
continue;
|
|
280229
280092
|
}
|
|
@@ -280238,11 +280101,11 @@ var RUNTIME_API_BASE_URL_ENV = "AGENTER_ATTENTION_API_BASE_URL", RUNTIME_MANAGED
|
|
|
280238
280101
|
path: resolve39(input.path),
|
|
280239
280102
|
skillDir,
|
|
280240
280103
|
configPath,
|
|
280241
|
-
configExists:
|
|
280104
|
+
configExists: existsSync26(configPath)
|
|
280242
280105
|
};
|
|
280243
280106
|
}, readSkillRecord = (filePath, root3) => {
|
|
280244
280107
|
try {
|
|
280245
|
-
const content3 =
|
|
280108
|
+
const content3 = readFileSync21(filePath, "utf8");
|
|
280246
280109
|
const frontmatter = parseRuntimeSkillFrontmatter(content3);
|
|
280247
280110
|
const fallbackName = basename12(relative10(root3.path, filePath).replace(/\/SKILL\.md$/u, ""));
|
|
280248
280111
|
const name3 = normalizeRuntimeSkillName(frontmatter.name ?? fallbackName);
|
|
@@ -280317,9 +280180,9 @@ var RUNTIME_API_BASE_URL_ENV = "AGENTER_ATTENTION_API_BASE_URL", RUNTIME_MANAGED
|
|
|
280317
280180
|
`);
|
|
280318
280181
|
}, readBuiltinSkillTemplate = (entry2, repoRoot) => {
|
|
280319
280182
|
const sourcePath = resolve39(repoRoot, entry2.sourcePath);
|
|
280320
|
-
if (
|
|
280183
|
+
if (existsSync26(sourcePath)) {
|
|
280321
280184
|
return {
|
|
280322
|
-
template:
|
|
280185
|
+
template: readFileSync21(sourcePath, "utf8"),
|
|
280323
280186
|
sourcePath
|
|
280324
280187
|
};
|
|
280325
280188
|
}
|
|
@@ -280391,7 +280254,7 @@ var RUNTIME_API_BASE_URL_ENV = "AGENTER_ATTENTION_API_BASE_URL", RUNTIME_MANAGED
|
|
|
280391
280254
|
}
|
|
280392
280255
|
const source = input.rootKind ? listRuntimeSkillsByVisibleLayerOrder(input) : listRuntimeSkills(input);
|
|
280393
280256
|
return source.find((skill) => skill.name === normalizedName && (input.rootKind ? skill.rootKind === input.rootKind : true)) ?? null;
|
|
280394
|
-
}, readRuntimeSkillContent = (skill) => typeof skill === "string" ?
|
|
280257
|
+
}, readRuntimeSkillContent = (skill) => typeof skill === "string" ? readFileSync21(skill, "utf8") : skill.content ?? readFileSync21(skill.path, "utf8"), upsertRuntimeSkillFile = (input) => {
|
|
280395
280258
|
const normalizedName = normalizeRuntimeSkillName(input.name);
|
|
280396
280259
|
if (!normalizedName) {
|
|
280397
280260
|
throw new Error(`invalid skill name: ${input.name}`);
|
|
@@ -280404,8 +280267,8 @@ var RUNTIME_API_BASE_URL_ENV = "AGENTER_ATTENTION_API_BASE_URL", RUNTIME_MANAGED
|
|
|
280404
280267
|
const root3 = resolveRuntimeSkillRootByKind(input, input.rootKind ?? "avatar");
|
|
280405
280268
|
const skillDir = join48(root3.path, normalizedName);
|
|
280406
280269
|
const skillPath = join48(skillDir, "SKILL.md");
|
|
280407
|
-
|
|
280408
|
-
|
|
280270
|
+
mkdirSync27(skillDir, { recursive: true });
|
|
280271
|
+
writeFileSync13(skillPath, input.content.endsWith(`
|
|
280409
280272
|
`) ? input.content : `${input.content}
|
|
280410
280273
|
`, "utf8");
|
|
280411
280274
|
const record3 = readSkillRecord(skillPath, root3);
|
|
@@ -280515,12 +280378,12 @@ var init_runtime_skills = __esm(() => {
|
|
|
280515
280378
|
});
|
|
280516
280379
|
|
|
280517
280380
|
// packages/app-server/src/runtime-tools.ts
|
|
280518
|
-
import { copyFileSync, existsSync as
|
|
280381
|
+
import { copyFileSync, existsSync as existsSync27, mkdirSync as mkdirSync28, readdirSync as readdirSync16, statSync as statSync8 } from "fs";
|
|
280519
280382
|
import { homedir as homedir20 } from "os";
|
|
280520
280383
|
import { dirname as dirname32, join as join49, relative as relative11, resolve as resolve40 } from "path";
|
|
280521
280384
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
280522
280385
|
var DEFAULT_REPO_ROOT2, BUILTIN_RUNTIME_TOOLS_SOURCE = "packages/app-server/tools", BUILTIN_RUNTIME_TOOL_DESCRIPTORS, collectToolFiles = (root3, depth = 0) => {
|
|
280523
|
-
if (!
|
|
280386
|
+
if (!existsSync27(root3) || depth > 4) {
|
|
280524
280387
|
return [];
|
|
280525
280388
|
}
|
|
280526
280389
|
let stats;
|
|
@@ -280533,7 +280396,7 @@ var DEFAULT_REPO_ROOT2, BUILTIN_RUNTIME_TOOLS_SOURCE = "packages/app-server/tool
|
|
|
280533
280396
|
return [];
|
|
280534
280397
|
}
|
|
280535
280398
|
const output = [];
|
|
280536
|
-
for (const entry2 of
|
|
280399
|
+
for (const entry2 of readdirSync16(root3, { withFileTypes: true })) {
|
|
280537
280400
|
const nextPath = join49(root3, entry2.name);
|
|
280538
280401
|
if (entry2.isDirectory()) {
|
|
280539
280402
|
output.push(...collectToolFiles(nextPath, depth + 1));
|
|
@@ -280547,7 +280410,7 @@ var DEFAULT_REPO_ROOT2, BUILTIN_RUNTIME_TOOLS_SOURCE = "packages/app-server/tool
|
|
|
280547
280410
|
}, copyToolFile = (sourcePath, sourceRoot, targetRoot) => {
|
|
280548
280411
|
const relativePath = relative11(sourceRoot, sourcePath);
|
|
280549
280412
|
const targetPath = join49(targetRoot, relativePath);
|
|
280550
|
-
|
|
280413
|
+
mkdirSync28(dirname32(targetPath), { recursive: true });
|
|
280551
280414
|
copyFileSync(sourcePath, targetPath);
|
|
280552
280415
|
}, getBuiltinRuntimeToolDescriptor = (fileName) => BUILTIN_RUNTIME_TOOL_DESCRIPTORS[fileName] ?? null, renderBuiltinRuntimeToolHelp = (descriptor) => [
|
|
280553
280416
|
descriptor.fileName,
|
|
@@ -280568,7 +280431,7 @@ var DEFAULT_REPO_ROOT2, BUILTIN_RUNTIME_TOOLS_SOURCE = "packages/app-server/tool
|
|
|
280568
280431
|
const repoRoot = resolve40(input.repoRoot ?? DEFAULT_REPO_ROOT2);
|
|
280569
280432
|
const sourceRoot = resolve40(repoRoot, BUILTIN_RUNTIME_TOOLS_SOURCE);
|
|
280570
280433
|
const targetRoot = getRuntimeToolRoot(input);
|
|
280571
|
-
|
|
280434
|
+
mkdirSync28(targetRoot, { recursive: true });
|
|
280572
280435
|
const files = collectToolFiles(sourceRoot);
|
|
280573
280436
|
for (const filePath of files) {
|
|
280574
280437
|
copyToolFile(filePath, sourceRoot, targetRoot);
|
|
@@ -280585,7 +280448,7 @@ var init_runtime_tools = __esm(() => {
|
|
|
280585
280448
|
});
|
|
280586
280449
|
|
|
280587
280450
|
// packages/app-server/src/runtime-cli.ts
|
|
280588
|
-
import { existsSync as
|
|
280451
|
+
import { existsSync as existsSync28, readFileSync as readFileSync22 } from "fs";
|
|
280589
280452
|
import { join as join50 } from "path";
|
|
280590
280453
|
var json3 = (value) => `${JSON.stringify(value, null, 2)}
|
|
280591
280454
|
`, isHelpArg2 = (value) => value === "--help", isCompactArg = (value) => value === "--compact", parseRuntimeSubcommandArgs = (args) => {
|
|
@@ -280703,10 +280566,10 @@ Config error: ${result.configError}` : "",
|
|
|
280703
280566
|
}
|
|
280704
280567
|
return payload;
|
|
280705
280568
|
}, resolveToolRunner2 = (filePath) => {
|
|
280706
|
-
if (!
|
|
280569
|
+
if (!existsSync28(filePath)) {
|
|
280707
280570
|
throw new Error(`tool file not found: ${filePath}`);
|
|
280708
280571
|
}
|
|
280709
|
-
const firstLine =
|
|
280572
|
+
const firstLine = readFileSync22(filePath, "utf8").split(/\r?\n/u, 1)[0] ?? "";
|
|
280710
280573
|
if (firstLine.includes("python")) {
|
|
280711
280574
|
return "python3";
|
|
280712
280575
|
}
|
|
@@ -281319,14 +281182,14 @@ var init_runtime_local_api = __esm(() => {
|
|
|
281319
281182
|
});
|
|
281320
281183
|
|
|
281321
281184
|
// packages/app-server/src/runtime-shell-bin.ts
|
|
281322
|
-
import { chmodSync, mkdirSync as
|
|
281185
|
+
import { chmodSync, mkdirSync as mkdirSync29, writeFileSync as writeFileSync14 } from "fs";
|
|
281323
281186
|
import { join as join51, resolve as resolve41 } from "path";
|
|
281324
281187
|
var RUNTIME_BIN_DIRNAME = ".runtime-bin", RUNTIME_SHELL_COMMANDS, writeExecutable = (filePath, content3) => {
|
|
281325
|
-
|
|
281188
|
+
writeFileSync14(filePath, content3, "utf8");
|
|
281326
281189
|
chmodSync(filePath, 493);
|
|
281327
281190
|
}, resolveRuntimeShellBinDir = (rootWorkspacePath) => resolve41(rootWorkspacePath, RUNTIME_BIN_DIRNAME), materializeRuntimeShellBin = (rootWorkspacePath) => {
|
|
281328
281191
|
const binDir = resolveRuntimeShellBinDir(rootWorkspacePath);
|
|
281329
|
-
|
|
281192
|
+
mkdirSync29(binDir, { recursive: true });
|
|
281330
281193
|
for (const commandName of RUNTIME_SHELL_COMMANDS) {
|
|
281331
281194
|
writeExecutable(join51(binDir, commandName), [
|
|
281332
281195
|
"#!/usr/bin/env bash",
|
|
@@ -281468,14 +281331,14 @@ var init_runtime_shell_bin = __esm(() => {
|
|
|
281468
281331
|
});
|
|
281469
281332
|
|
|
281470
281333
|
// packages/app-server/src/runtime-skill-fingerprint-manifest.ts
|
|
281471
|
-
import { existsSync as
|
|
281334
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync30, readFileSync as readFileSync23, renameSync as renameSync5, rmSync as rmSync8, writeFileSync as writeFileSync15 } from "fs";
|
|
281472
281335
|
import { dirname as dirname33 } from "path";
|
|
281473
281336
|
var RUNTIME_SKILL_FINGERPRINT_MANIFEST_VERSION = 1, runtimeSkillFingerprintFileSchema, runtimeSkillFingerprintEntrySchema, runtimeSkillFingerprintManifestSchema, readRuntimeSkillFingerprintManifest = (path6) => {
|
|
281474
|
-
if (!
|
|
281337
|
+
if (!existsSync29(path6)) {
|
|
281475
281338
|
return { kind: "missing" };
|
|
281476
281339
|
}
|
|
281477
281340
|
try {
|
|
281478
|
-
const parsed = runtimeSkillFingerprintManifestSchema.parse(JSON.parse(
|
|
281341
|
+
const parsed = runtimeSkillFingerprintManifestSchema.parse(JSON.parse(readFileSync23(path6, "utf8")));
|
|
281479
281342
|
return {
|
|
281480
281343
|
kind: "ok",
|
|
281481
281344
|
trackedSkills: new Map(parsed.skills.map((entry2) => [
|
|
@@ -281517,10 +281380,10 @@ var RUNTIME_SKILL_FINGERPRINT_MANIFEST_VERSION = 1, runtimeSkillFingerprintFileS
|
|
|
281517
281380
|
generatedAt: new Date().toISOString(),
|
|
281518
281381
|
skills
|
|
281519
281382
|
};
|
|
281520
|
-
|
|
281383
|
+
mkdirSync30(dirname33(path6), { recursive: true });
|
|
281521
281384
|
const tempPath = `${path6}.${process.pid}.${Date.now()}.tmp`;
|
|
281522
281385
|
try {
|
|
281523
|
-
|
|
281386
|
+
writeFileSync15(tempPath, `${JSON.stringify(manifest2, null, 2)}
|
|
281524
281387
|
`, "utf8");
|
|
281525
281388
|
renameSync5(tempPath, path6);
|
|
281526
281389
|
} catch (error53) {
|
|
@@ -281752,7 +281615,7 @@ var init_runtime_skill_ingress = __esm(() => {
|
|
|
281752
281615
|
});
|
|
281753
281616
|
|
|
281754
281617
|
// packages/app-server/src/runtime-skill-watch-service.ts
|
|
281755
|
-
import { existsSync as
|
|
281618
|
+
import { existsSync as existsSync30, statSync as statSync9, watch as watch2 } from "fs";
|
|
281756
281619
|
import { basename as basename13, dirname as dirname34, resolve as resolve42 } from "path";
|
|
281757
281620
|
|
|
281758
281621
|
class RuntimeSkillWatchService {
|
|
@@ -281946,7 +281809,7 @@ var DEFAULT_SKILL_WATCH_DEBOUNCE_MS = 800, DEFAULT_SKILL_WATCH_POLL_MS = 2000, n
|
|
|
281946
281809
|
}, resolveWatchLocation = (path6) => {
|
|
281947
281810
|
let current2 = resolve42(path6);
|
|
281948
281811
|
let filterName = null;
|
|
281949
|
-
while (!
|
|
281812
|
+
while (!existsSync30(current2)) {
|
|
281950
281813
|
filterName = basename13(current2);
|
|
281951
281814
|
const parent = dirname34(current2);
|
|
281952
281815
|
if (parent === current2) {
|
|
@@ -282691,7 +282554,7 @@ var cloneWatch = (watch3) => ({
|
|
|
282691
282554
|
});
|
|
282692
282555
|
|
|
282693
282556
|
// packages/app-server/src/session-store.ts
|
|
282694
|
-
import { mkdirSync as
|
|
282557
|
+
import { mkdirSync as mkdirSync31 } from "fs";
|
|
282695
282558
|
import { join as join52, resolve as resolve43 } from "path";
|
|
282696
282559
|
|
|
282697
282560
|
class SessionStore {
|
|
@@ -282700,8 +282563,8 @@ class SessionStore {
|
|
|
282700
282563
|
constructor(options) {
|
|
282701
282564
|
const now3 = new Date().toISOString();
|
|
282702
282565
|
const sessionRoot = resolve43(options.sessionRoot);
|
|
282703
|
-
|
|
282704
|
-
|
|
282566
|
+
mkdirSync31(sessionRoot, { recursive: true });
|
|
282567
|
+
mkdirSync31(join52(sessionRoot, "logs"), { recursive: true });
|
|
282705
282568
|
this.filePath = join52(sessionRoot, "session.json");
|
|
282706
282569
|
const existingSession = readSessionDocument(this.filePath)?.session;
|
|
282707
282570
|
this.doc = existingSession ? {
|
|
@@ -282755,7 +282618,7 @@ var init_session_store = __esm(() => {
|
|
|
282755
282618
|
});
|
|
282756
282619
|
|
|
282757
282620
|
// packages/app-server/src/settings-editor.ts
|
|
282758
|
-
import { mkdirSync as
|
|
282621
|
+
import { mkdirSync as mkdirSync32 } from "fs";
|
|
282759
282622
|
import { readFile as readFile7, stat as stat3, writeFile as writeFile7 } from "fs/promises";
|
|
282760
282623
|
import { dirname as dirname35, resolve as resolve44 } from "path";
|
|
282761
282624
|
|
|
@@ -282783,7 +282646,7 @@ class SettingsEditor {
|
|
|
282783
282646
|
latest: current2
|
|
282784
282647
|
};
|
|
282785
282648
|
}
|
|
282786
|
-
|
|
282649
|
+
mkdirSync32(dirname35(path6), { recursive: true });
|
|
282787
282650
|
await writeFile7(path6, content3, "utf8");
|
|
282788
282651
|
const next2 = await readMaybe(path6);
|
|
282789
282652
|
return {
|
|
@@ -282840,7 +282703,7 @@ var stableSnapshotStringify = (value) => JSON.stringify(value), buildFingerprint
|
|
|
282840
282703
|
var init_terminal_snapshot_fingerprint = () => {};
|
|
282841
282704
|
|
|
282842
282705
|
// packages/app-server/src/usage-analytics-db.ts
|
|
282843
|
-
import { mkdirSync as
|
|
282706
|
+
import { mkdirSync as mkdirSync33 } from "fs";
|
|
282844
282707
|
import { dirname as dirname36, resolve as resolve45 } from "path";
|
|
282845
282708
|
import { Database as Database9 } from "bun:sqlite";
|
|
282846
282709
|
|
|
@@ -282848,7 +282711,7 @@ class UsageAnalyticsDb {
|
|
|
282848
282711
|
db;
|
|
282849
282712
|
constructor(filePath) {
|
|
282850
282713
|
const fullPath = resolve45(filePath);
|
|
282851
|
-
|
|
282714
|
+
mkdirSync33(dirname36(fullPath), { recursive: true });
|
|
282852
282715
|
this.db = new Database9(fullPath, { create: true, strict: true });
|
|
282853
282716
|
this.migrate();
|
|
282854
282717
|
}
|
|
@@ -292932,7 +292795,7 @@ var init_session_runtime = __esm(() => {
|
|
|
292932
292795
|
});
|
|
292933
292796
|
|
|
292934
292797
|
// packages/app-server/src/skill-browser.ts
|
|
292935
|
-
import { existsSync as
|
|
292798
|
+
import { existsSync as existsSync31, readdirSync as readdirSync17, readFileSync as readFileSync24, statSync as statSync10 } from "fs";
|
|
292936
292799
|
import { extname as extname4, join as join56, relative as relative13, resolve as resolve49 } from "path";
|
|
292937
292800
|
var DEFAULT_TREE_LIMIT = 1000, DEFAULT_TEXT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW_BYTES, TEXT_EXTENSIONS, IMAGE_EXTENSIONS, AUDIO_EXTENSIONS, VIDEO_EXTENSIONS, PDF_EXTENSIONS, compareDirectoryEntryName = (left2, right2) => left2.localeCompare(right2, undefined, { numeric: true }), normalizeRelativePath = (value) => {
|
|
292938
292801
|
const normalized = (value ?? "/").replace(/\\/gu, "/").trim();
|
|
@@ -293079,7 +292942,7 @@ var DEFAULT_TREE_LIMIT = 1000, DEFAULT_TEXT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW
|
|
|
293079
292942
|
if (!directoryStat.isDirectory()) {
|
|
293080
292943
|
throw new Error(`skill tree target is not a directory: ${relativePath}`);
|
|
293081
292944
|
}
|
|
293082
|
-
const entries =
|
|
292945
|
+
const entries = readdirSync17(absolutePath, { withFileTypes: true }).sort((left2, right2) => {
|
|
293083
292946
|
if (left2.isDirectory() !== right2.isDirectory()) {
|
|
293084
292947
|
return left2.isDirectory() ? -1 : 1;
|
|
293085
292948
|
}
|
|
@@ -293135,7 +292998,7 @@ var DEFAULT_TREE_LIMIT = 1000, DEFAULT_TEXT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW
|
|
|
293135
292998
|
const maxBytes = Math.max(1, Math.min(previewKind === "text" ? DEFAULT_TEXT_PREVIEW_BYTES : DEFAULT_MEDIA_PREVIEW_BYTES, input.maxBytes ?? (previewKind === "text" ? DEFAULT_TEXT_PREVIEW_BYTES : DEFAULT_MEDIA_PREVIEW_BYTES)));
|
|
293136
292999
|
const truncated = sizeBytes > maxBytes;
|
|
293137
293000
|
if (previewKind === "text") {
|
|
293138
|
-
const buffer =
|
|
293001
|
+
const buffer = readFileSync24(absolutePath);
|
|
293139
293002
|
const sliced = truncated ? buffer.subarray(0, maxBytes) : buffer;
|
|
293140
293003
|
return {
|
|
293141
293004
|
path: relativePath,
|
|
@@ -293167,7 +293030,7 @@ var DEFAULT_TREE_LIMIT = 1000, DEFAULT_TEXT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW
|
|
|
293167
293030
|
note: `Preview unavailable because the file exceeds the ${maxBytes}-byte preview limit.`
|
|
293168
293031
|
};
|
|
293169
293032
|
}
|
|
293170
|
-
const buffer =
|
|
293033
|
+
const buffer = readFileSync24(absolutePath);
|
|
293171
293034
|
return {
|
|
293172
293035
|
path: relativePath,
|
|
293173
293036
|
name: relativePath.split("/").filter(Boolean).at(-1) ?? "",
|
|
@@ -293539,7 +293402,7 @@ var require_ignore = __commonJS((exports, module) => {
|
|
|
293539
293402
|
|
|
293540
293403
|
// packages/app-server/src/workspace-path-search.ts
|
|
293541
293404
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
293542
|
-
import { existsSync as
|
|
293405
|
+
import { existsSync as existsSync32, readFileSync as readFileSync25, realpathSync as realpathSync8, readdirSync as readdirSync18, statSync as statSync11 } from "fs";
|
|
293543
293406
|
import { dirname as dirname39, isAbsolute as isAbsolute14, join as join57, relative as relative14, resolve as resolve50, sep as sep4 } from "path";
|
|
293544
293407
|
|
|
293545
293408
|
class WorkspacePathSearchIndex {
|
|
@@ -293583,7 +293446,7 @@ class WorkspacePathSearchIndex {
|
|
|
293583
293446
|
this.cache.delete(resolve50(cwd));
|
|
293584
293447
|
}
|
|
293585
293448
|
getEntries(workspacePath) {
|
|
293586
|
-
if (!
|
|
293449
|
+
if (!existsSync32(workspacePath) || !statSync11(workspacePath).isDirectory()) {
|
|
293587
293450
|
this.cache.delete(workspacePath);
|
|
293588
293451
|
return [];
|
|
293589
293452
|
}
|
|
@@ -293720,11 +293583,11 @@ var import_ignore, INDEX_TTL_MS = 30000, isMissingWorkspaceError = (error53) =>
|
|
|
293720
293583
|
}).filter((filePath) => filePath.length > 0 && !filePath.startsWith("../"));
|
|
293721
293584
|
}, loadWorkspaceFilePathsWithRg = (workspacePath) => parseNullSeparatedLines(readCommandOutput("rg", ["--files", "--hidden", "--no-require-git", "-0"], workspacePath)), loadWorkspaceIgnoreFilter = (workspacePath) => {
|
|
293722
293585
|
const gitignorePath = join57(workspacePath, ".gitignore");
|
|
293723
|
-
if (!
|
|
293586
|
+
if (!existsSync32(gitignorePath)) {
|
|
293724
293587
|
return null;
|
|
293725
293588
|
}
|
|
293726
293589
|
try {
|
|
293727
|
-
const patterns =
|
|
293590
|
+
const patterns = readFileSync25(gitignorePath, "utf8");
|
|
293728
293591
|
if (patterns.trim().length === 0) {
|
|
293729
293592
|
return null;
|
|
293730
293593
|
}
|
|
@@ -293745,7 +293608,7 @@ var import_ignore, INDEX_TTL_MS = 30000, isMissingWorkspaceError = (error53) =>
|
|
|
293745
293608
|
}
|
|
293746
293609
|
let entries;
|
|
293747
293610
|
try {
|
|
293748
|
-
entries =
|
|
293611
|
+
entries = readdirSync18(current2, { withFileTypes: true });
|
|
293749
293612
|
} catch (error53) {
|
|
293750
293613
|
if (isMissingWorkspaceError(error53)) {
|
|
293751
293614
|
continue;
|
|
@@ -293842,7 +293705,7 @@ var import_ignore, INDEX_TTL_MS = 30000, isMissingWorkspaceError = (error53) =>
|
|
|
293842
293705
|
const normalizedLeafQuery = leafQuery.toLowerCase();
|
|
293843
293706
|
let entries;
|
|
293844
293707
|
try {
|
|
293845
|
-
entries =
|
|
293708
|
+
entries = readdirSync18(parentAbsolutePath, { withFileTypes: true });
|
|
293846
293709
|
} catch (error53) {
|
|
293847
293710
|
if (isMissingWorkspaceError(error53)) {
|
|
293848
293711
|
return [];
|
|
@@ -293880,7 +293743,7 @@ var init_workspace_path_search = __esm(() => {
|
|
|
293880
293743
|
});
|
|
293881
293744
|
|
|
293882
293745
|
// packages/app-server/src/workspace-workbench.ts
|
|
293883
|
-
import { existsSync as
|
|
293746
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync34, readdirSync as readdirSync19, readFileSync as readFileSync26, statSync as statSync12, writeFileSync as writeFileSync16 } from "fs";
|
|
293884
293747
|
import { extname as extname5, join as join58, relative as relative15, resolve as resolve51 } from "path";
|
|
293885
293748
|
var DEFAULT_TREE_LIMIT2 = 1000, DEFAULT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW_BYTES2, TEXT_EXTENSIONS2, IMAGE_EXTENSIONS2, AUDIO_EXTENSIONS2, VIDEO_EXTENSIONS2, toRelativePath = (value) => {
|
|
293886
293749
|
const normalized = value.replace(/\\/gu, "/").trim();
|
|
@@ -293899,7 +293762,7 @@ var DEFAULT_TREE_LIMIT2 = 1000, DEFAULT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW_BYT
|
|
|
293899
293762
|
}, resolveWorkbenchRoot = (input) => {
|
|
293900
293763
|
if (input.mode === "private") {
|
|
293901
293764
|
const root3 = resolveWorkspaceAvatarPrivateRoot(input.workspacePath, input.avatar);
|
|
293902
|
-
|
|
293765
|
+
mkdirSync34(root3, { recursive: true });
|
|
293903
293766
|
return root3;
|
|
293904
293767
|
}
|
|
293905
293768
|
return toWorkspaceCwd(input.workspacePath);
|
|
@@ -293963,7 +293826,7 @@ var DEFAULT_TREE_LIMIT2 = 1000, DEFAULT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW_BYT
|
|
|
293963
293826
|
if (!directoryStat.isDirectory()) {
|
|
293964
293827
|
throw new Error(`workspace tree target is not a directory: ${relativePath}`);
|
|
293965
293828
|
}
|
|
293966
|
-
const entries =
|
|
293829
|
+
const entries = readdirSync19(absolutePath, { withFileTypes: true }).sort((left2, right2) => {
|
|
293967
293830
|
if (left2.isDirectory() !== right2.isDirectory()) {
|
|
293968
293831
|
return left2.isDirectory() ? -1 : 1;
|
|
293969
293832
|
}
|
|
@@ -294033,7 +293896,7 @@ var DEFAULT_TREE_LIMIT2 = 1000, DEFAULT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW_BYT
|
|
|
294033
293896
|
}
|
|
294034
293897
|
const maxBytes = Math.max(1, input.maxBytes ?? DEFAULT_PREVIEW_BYTES);
|
|
294035
293898
|
if (previewKind === "text") {
|
|
294036
|
-
const raw2 =
|
|
293899
|
+
const raw2 = readFileSync26(absolutePath);
|
|
294037
293900
|
const truncated = raw2.byteLength > maxBytes;
|
|
294038
293901
|
return {
|
|
294039
293902
|
path: relativePath,
|
|
@@ -294050,7 +293913,7 @@ var DEFAULT_TREE_LIMIT2 = 1000, DEFAULT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW_BYT
|
|
|
294050
293913
|
};
|
|
294051
293914
|
}
|
|
294052
293915
|
if (previewKind === "image" || previewKind === "audio" || previewKind === "video") {
|
|
294053
|
-
const raw2 =
|
|
293916
|
+
const raw2 = readFileSync26(absolutePath);
|
|
294054
293917
|
const overLimit = raw2.byteLength > DEFAULT_MEDIA_PREVIEW_BYTES2;
|
|
294055
293918
|
return {
|
|
294056
293919
|
path: relativePath,
|
|
@@ -294087,25 +293950,25 @@ var DEFAULT_TREE_LIMIT2 = 1000, DEFAULT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW_BYT
|
|
|
294087
293950
|
});
|
|
294088
293951
|
const parentPath = toRelativePath(input.parentPath ?? "/");
|
|
294089
293952
|
const parentAbsolutePath = ensureInsideRoot2(rootPath, parentPath);
|
|
294090
|
-
|
|
293953
|
+
mkdirSync34(parentAbsolutePath, { recursive: true });
|
|
294091
293954
|
const targetRelativePath = toRelativePath(parentPath === "/" ? input.name : join58(parentPath.slice(1), input.name));
|
|
294092
293955
|
const targetAbsolutePath = ensureInsideRoot2(rootPath, targetRelativePath);
|
|
294093
293956
|
if (input.kind === "directory") {
|
|
294094
|
-
|
|
293957
|
+
mkdirSync34(targetAbsolutePath, { recursive: true });
|
|
294095
293958
|
} else {
|
|
294096
|
-
|
|
294097
|
-
|
|
293959
|
+
mkdirSync34(resolve51(targetAbsolutePath, ".."), { recursive: true });
|
|
293960
|
+
writeFileSync16(targetAbsolutePath, "", "utf8");
|
|
294098
293961
|
}
|
|
294099
293962
|
return { path: targetRelativePath };
|
|
294100
293963
|
}, ensureWorkspacePrivateTextAsset = (input) => {
|
|
294101
293964
|
const rootPath = resolveWorkspaceAvatarAssetRoot(input.workspacePath, input.avatar, input.assetKind);
|
|
294102
|
-
|
|
293965
|
+
mkdirSync34(rootPath, { recursive: true });
|
|
294103
293966
|
const relativePath = toRelativePath(input.relativePath);
|
|
294104
293967
|
if (relativePath === "/") {
|
|
294105
293968
|
throw new Error("private text asset path must point to a file");
|
|
294106
293969
|
}
|
|
294107
293970
|
const absolutePath = ensureInsideRoot2(rootPath, relativePath);
|
|
294108
|
-
if (
|
|
293971
|
+
if (existsSync33(absolutePath)) {
|
|
294109
293972
|
const current2 = statSync12(absolutePath);
|
|
294110
293973
|
if (current2.isDirectory()) {
|
|
294111
293974
|
throw new Error(`private text asset path is a directory: ${relativePath}`);
|
|
@@ -294113,17 +293976,17 @@ var DEFAULT_TREE_LIMIT2 = 1000, DEFAULT_PREVIEW_BYTES, DEFAULT_MEDIA_PREVIEW_BYT
|
|
|
294113
293976
|
return {
|
|
294114
293977
|
path: relativePath,
|
|
294115
293978
|
created: false,
|
|
294116
|
-
content:
|
|
293979
|
+
content: readFileSync26(absolutePath, "utf8"),
|
|
294117
293980
|
mtimeMs: current2.mtimeMs
|
|
294118
293981
|
};
|
|
294119
293982
|
}
|
|
294120
|
-
|
|
294121
|
-
|
|
293983
|
+
mkdirSync34(resolve51(absolutePath, ".."), { recursive: true });
|
|
293984
|
+
writeFileSync16(absolutePath, input.seedContent, "utf8");
|
|
294122
293985
|
const created = statSync12(absolutePath);
|
|
294123
293986
|
return {
|
|
294124
293987
|
path: relativePath,
|
|
294125
293988
|
created: true,
|
|
294126
|
-
content:
|
|
293989
|
+
content: readFileSync26(absolutePath, "utf8"),
|
|
294127
293990
|
mtimeMs: created.mtimeMs
|
|
294128
293991
|
};
|
|
294129
293992
|
};
|
|
@@ -294168,7 +294031,7 @@ var init_workspace_workbench = __esm(() => {
|
|
|
294168
294031
|
});
|
|
294169
294032
|
|
|
294170
294033
|
// packages/app-server/src/workspaces-store.ts
|
|
294171
|
-
import { closeSync as closeSync2, mkdirSync as
|
|
294034
|
+
import { closeSync as closeSync2, mkdirSync as mkdirSync35, openSync as openSync2, readFileSync as readFileSync27, renameSync as renameSync6, statSync as statSync13, unlinkSync as unlinkSync4, writeFileSync as writeFileSync17 } from "fs";
|
|
294172
294035
|
import { homedir as homedir23 } from "os";
|
|
294173
294036
|
import { dirname as dirname40, resolve as resolve52 } from "path";
|
|
294174
294037
|
|
|
@@ -294305,14 +294168,14 @@ class WorkspacesStore {
|
|
|
294305
294168
|
});
|
|
294306
294169
|
}
|
|
294307
294170
|
load() {
|
|
294308
|
-
|
|
294171
|
+
mkdirSync35(dirname40(this.filePath), { recursive: true });
|
|
294309
294172
|
const loaded = this.readFromDisk();
|
|
294310
294173
|
this.replace(loaded);
|
|
294311
294174
|
this.flushAtomic(this.doc);
|
|
294312
294175
|
}
|
|
294313
294176
|
readFromDisk() {
|
|
294314
294177
|
try {
|
|
294315
|
-
return parseWorkspaceYaml(
|
|
294178
|
+
return parseWorkspaceYaml(readFileSync27(this.filePath, "utf8"));
|
|
294316
294179
|
} catch {
|
|
294317
294180
|
return emptyDocument();
|
|
294318
294181
|
}
|
|
@@ -294321,14 +294184,14 @@ class WorkspacesStore {
|
|
|
294321
294184
|
this.doc = normalizeDocument(next2);
|
|
294322
294185
|
}
|
|
294323
294186
|
flushAtomic(doc2) {
|
|
294324
|
-
|
|
294187
|
+
mkdirSync35(dirname40(this.filePath), { recursive: true });
|
|
294325
294188
|
const tempPath = `${this.filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
294326
|
-
|
|
294189
|
+
writeFileSync17(tempPath, toYaml3(doc2), "utf8");
|
|
294327
294190
|
renameSync6(tempPath, this.filePath);
|
|
294328
294191
|
}
|
|
294329
294192
|
withFileLock(run2) {
|
|
294330
294193
|
const lockPath = `${this.filePath}.lock`;
|
|
294331
|
-
|
|
294194
|
+
mkdirSync35(dirname40(this.filePath), { recursive: true });
|
|
294332
294195
|
const start2 = Date.now();
|
|
294333
294196
|
while (true) {
|
|
294334
294197
|
try {
|
|
@@ -294475,11 +294338,11 @@ var init_workspaces_store = __esm(() => {
|
|
|
294475
294338
|
// packages/app-server/src/app-kernel.ts
|
|
294476
294339
|
import {
|
|
294477
294340
|
accessSync as accessSync2,
|
|
294478
|
-
existsSync as
|
|
294341
|
+
existsSync as existsSync34,
|
|
294479
294342
|
constants as fsConstants2,
|
|
294480
|
-
mkdirSync as
|
|
294481
|
-
readdirSync as
|
|
294482
|
-
readFileSync as
|
|
294343
|
+
mkdirSync as mkdirSync36,
|
|
294344
|
+
readdirSync as readdirSync20,
|
|
294345
|
+
readFileSync as readFileSync28,
|
|
294483
294346
|
statSync as statSync14,
|
|
294484
294347
|
watch as watch3
|
|
294485
294348
|
} from "fs";
|
|
@@ -294577,15 +294440,15 @@ class AppKernel {
|
|
|
294577
294440
|
const homeDir = this.getHomeDir();
|
|
294578
294441
|
const normalizedWorkspacePath = isGlobalWorkspacePath(workspacePath, homeDir) ? GLOBAL_WORKSPACE_PATH : workspacePath;
|
|
294579
294442
|
const workspaceCwd = toWorkspaceCwd(normalizedWorkspacePath, homeDir);
|
|
294580
|
-
if (!
|
|
294443
|
+
if (!existsSync34(workspaceCwd)) {
|
|
294581
294444
|
return null;
|
|
294582
294445
|
}
|
|
294583
294446
|
const agenterRoot = join59(workspaceCwd, ".agenter");
|
|
294584
294447
|
const avatarRoot = resolveWorkspaceAvatarRoot(normalizedWorkspacePath, homeDir);
|
|
294585
|
-
if (
|
|
294448
|
+
if (existsSync34(avatarRoot)) {
|
|
294586
294449
|
return avatarRoot;
|
|
294587
294450
|
}
|
|
294588
|
-
if (
|
|
294451
|
+
if (existsSync34(agenterRoot)) {
|
|
294589
294452
|
return agenterRoot;
|
|
294590
294453
|
}
|
|
294591
294454
|
return workspaceCwd;
|
|
@@ -295479,7 +295342,7 @@ class AppKernel {
|
|
|
295479
295342
|
archive: resolveWorkspaceAvatarAssetRoot(workspacePath, avatar, "archive", homeDir)
|
|
295480
295343
|
};
|
|
295481
295344
|
for (const root3 of [...Object.values(publicRoots), ...Object.values(privateRoots)]) {
|
|
295482
|
-
|
|
295345
|
+
mkdirSync36(root3, { recursive: true });
|
|
295483
295346
|
}
|
|
295484
295347
|
return {
|
|
295485
295348
|
workspacePath,
|
|
@@ -295774,9 +295637,9 @@ class AppKernel {
|
|
|
295774
295637
|
}
|
|
295775
295638
|
ensureRuntimeAvatarRootWorkspace(input) {
|
|
295776
295639
|
const rootWorkspacePath = resolveGlobalAvatarCanonicalRoot(input.avatarPrincipalId, this.getHomeDir());
|
|
295777
|
-
|
|
295640
|
+
mkdirSync36(rootWorkspacePath, { recursive: true });
|
|
295778
295641
|
for (const directory of ["skills", "memories", "tools", "tmp"]) {
|
|
295779
|
-
|
|
295642
|
+
mkdirSync36(join59(rootWorkspacePath, directory), { recursive: true });
|
|
295780
295643
|
}
|
|
295781
295644
|
this.workspaceSystem.attachRuntime({
|
|
295782
295645
|
runtimeId: input.runtimeId,
|
|
@@ -295927,7 +295790,7 @@ class AppKernel {
|
|
|
295927
295790
|
const includeHidden = input.includeHidden ?? false;
|
|
295928
295791
|
try {
|
|
295929
295792
|
accessSync2(root3, fsConstants2.R_OK);
|
|
295930
|
-
const entries =
|
|
295793
|
+
const entries = readdirSync20(root3, { withFileTypes: true });
|
|
295931
295794
|
return entries.filter((entry2) => entry2.isDirectory()).filter((entry2) => includeHidden || !entry2.name.startsWith(".")).map((entry2) => ({
|
|
295932
295795
|
name: entry2.name,
|
|
295933
295796
|
path: join59(root3, entry2.name)
|
|
@@ -297296,7 +297159,7 @@ class AppKernel {
|
|
|
297296
297159
|
return null;
|
|
297297
297160
|
}
|
|
297298
297161
|
const dbPath = join59(session.sessionRoot, "session.db");
|
|
297299
|
-
if (!
|
|
297162
|
+
if (!existsSync34(dbPath)) {
|
|
297300
297163
|
return null;
|
|
297301
297164
|
}
|
|
297302
297165
|
const db = new SessionDb(dbPath);
|
|
@@ -297611,7 +297474,7 @@ class AppKernel {
|
|
|
297611
297474
|
return createEmptyUsageAnalyticsResult(input);
|
|
297612
297475
|
}
|
|
297613
297476
|
const dbPath = resolveUsageAnalyticsDbPathFromAvatarRoot(resolveGlobalAvatarCanonicalRoot(session.avatarPrincipalId, this.getHomeDir()));
|
|
297614
|
-
if (!
|
|
297477
|
+
if (!existsSync34(dbPath)) {
|
|
297615
297478
|
return createEmptyUsageAnalyticsResult(input);
|
|
297616
297479
|
}
|
|
297617
297480
|
const db = new UsageAnalyticsDb(dbPath);
|
|
@@ -297959,7 +297822,7 @@ class AppKernel {
|
|
|
297959
297822
|
}
|
|
297960
297823
|
readChatMessagesFromDb(sessionRoot, sessionId, afterId, limit2) {
|
|
297961
297824
|
const dbPath = join59(sessionRoot, "session.db");
|
|
297962
|
-
if (!
|
|
297825
|
+
if (!existsSync34(dbPath)) {
|
|
297963
297826
|
return [];
|
|
297964
297827
|
}
|
|
297965
297828
|
const db = new SessionDb(dbPath);
|
|
@@ -297971,7 +297834,7 @@ class AppKernel {
|
|
|
297971
297834
|
}
|
|
297972
297835
|
readChatMessagesPageFromDb(sessionRoot, sessionId, input) {
|
|
297973
297836
|
const dbPath = join59(sessionRoot, "session.db");
|
|
297974
|
-
if (!
|
|
297837
|
+
if (!existsSync34(dbPath)) {
|
|
297975
297838
|
return emptyReversePage();
|
|
297976
297839
|
}
|
|
297977
297840
|
const db = new SessionDb(dbPath);
|
|
@@ -298010,7 +297873,7 @@ class AppKernel {
|
|
|
298010
297873
|
createdAt: Date.parse(commit.createdAt) || Date.now()
|
|
298011
297874
|
})));
|
|
298012
297875
|
const dbPath = join59(session.sessionRoot, "session.db");
|
|
298013
|
-
const dispatches =
|
|
297876
|
+
const dispatches = existsSync34(dbPath) ? (() => {
|
|
298014
297877
|
const db = new SessionDb(dbPath);
|
|
298015
297878
|
try {
|
|
298016
297879
|
return db.listAttentionDispatches({
|
|
@@ -298023,7 +297886,7 @@ class AppKernel {
|
|
|
298023
297886
|
db.close();
|
|
298024
297887
|
}
|
|
298025
297888
|
})() : [];
|
|
298026
|
-
const receipts =
|
|
297889
|
+
const receipts = existsSync34(dbPath) ? (() => {
|
|
298027
297890
|
const db = new SessionDb(dbPath);
|
|
298028
297891
|
try {
|
|
298029
297892
|
return db.listAttentionReceipts({
|
|
@@ -298172,7 +298035,7 @@ class AppKernel {
|
|
|
298172
298035
|
homeDir: this.getHomeDir()
|
|
298173
298036
|
});
|
|
298174
298037
|
const dbPath = join59(session.sessionRoot, "session.db");
|
|
298175
|
-
if (!
|
|
298038
|
+
if (!existsSync34(dbPath)) {
|
|
298176
298039
|
return {
|
|
298177
298040
|
config: {
|
|
298178
298041
|
providerId: resolved.ai.providerId,
|
|
@@ -298236,7 +298099,7 @@ class AppKernel {
|
|
|
298236
298099
|
}
|
|
298237
298100
|
readChatMessagesBeforeFromDb(sessionRoot, sessionId, beforeId, limit2) {
|
|
298238
298101
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298239
|
-
if (!
|
|
298102
|
+
if (!existsSync34(dbPath)) {
|
|
298240
298103
|
return [];
|
|
298241
298104
|
}
|
|
298242
298105
|
const db = new SessionDb(dbPath);
|
|
@@ -298248,7 +298111,7 @@ class AppKernel {
|
|
|
298248
298111
|
}
|
|
298249
298112
|
readChatCyclesFromDb(sessionRoot, sessionId, limit2) {
|
|
298250
298113
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298251
|
-
if (!
|
|
298114
|
+
if (!existsSync34(dbPath)) {
|
|
298252
298115
|
return [];
|
|
298253
298116
|
}
|
|
298254
298117
|
const db = new SessionDb(dbPath);
|
|
@@ -298260,7 +298123,7 @@ class AppKernel {
|
|
|
298260
298123
|
}
|
|
298261
298124
|
readChatCyclesPageFromDb(sessionRoot, sessionId, input) {
|
|
298262
298125
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298263
|
-
if (!
|
|
298126
|
+
if (!existsSync34(dbPath)) {
|
|
298264
298127
|
return emptyReversePage();
|
|
298265
298128
|
}
|
|
298266
298129
|
const db = new SessionDb(dbPath);
|
|
@@ -298277,7 +298140,7 @@ class AppKernel {
|
|
|
298277
298140
|
}
|
|
298278
298141
|
readChatCyclesBeforeFromDb(sessionRoot, sessionId, beforeCycleId, limit2) {
|
|
298279
298142
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298280
|
-
if (!
|
|
298143
|
+
if (!existsSync34(dbPath)) {
|
|
298281
298144
|
return [];
|
|
298282
298145
|
}
|
|
298283
298146
|
const db = new SessionDb(dbPath);
|
|
@@ -298314,7 +298177,7 @@ class AppKernel {
|
|
|
298314
298177
|
}
|
|
298315
298178
|
readModelCallsPageFromDb(sessionRoot, input) {
|
|
298316
298179
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298317
|
-
if (!
|
|
298180
|
+
if (!existsSync34(dbPath)) {
|
|
298318
298181
|
return emptyReversePage();
|
|
298319
298182
|
}
|
|
298320
298183
|
const db = new SessionDb(dbPath);
|
|
@@ -298331,7 +298194,7 @@ class AppKernel {
|
|
|
298331
298194
|
}
|
|
298332
298195
|
readRequestAuxPageFromDb(sessionRoot, input) {
|
|
298333
298196
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298334
|
-
if (!
|
|
298197
|
+
if (!existsSync34(dbPath)) {
|
|
298335
298198
|
return emptyReversePage();
|
|
298336
298199
|
}
|
|
298337
298200
|
const db = new SessionDb(dbPath);
|
|
@@ -298343,7 +298206,7 @@ class AppKernel {
|
|
|
298343
298206
|
}
|
|
298344
298207
|
readHeartbeatPartsPageFromDb(sessionRoot, input) {
|
|
298345
298208
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298346
|
-
if (!
|
|
298209
|
+
if (!existsSync34(dbPath)) {
|
|
298347
298210
|
return emptyReversePage();
|
|
298348
298211
|
}
|
|
298349
298212
|
const db = new SessionDb(dbPath);
|
|
@@ -298355,7 +298218,7 @@ class AppKernel {
|
|
|
298355
298218
|
}
|
|
298356
298219
|
readHeartbeatGroupsPageFromDb(sessionRoot, input) {
|
|
298357
298220
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298358
|
-
if (!
|
|
298221
|
+
if (!existsSync34(dbPath)) {
|
|
298359
298222
|
return emptyReversePage();
|
|
298360
298223
|
}
|
|
298361
298224
|
const db = new SessionDb(dbPath);
|
|
@@ -298367,7 +298230,7 @@ class AppKernel {
|
|
|
298367
298230
|
}
|
|
298368
298231
|
readApiCallsPageFromDb(sessionRoot, input) {
|
|
298369
298232
|
const dbPath = join59(sessionRoot, "session.db");
|
|
298370
|
-
if (!
|
|
298233
|
+
if (!existsSync34(dbPath)) {
|
|
298371
298234
|
return emptyReversePage();
|
|
298372
298235
|
}
|
|
298373
298236
|
const db = new SessionDb(dbPath);
|
|
@@ -298618,11 +298481,11 @@ var now3 = () => Date.now(), clonePromptWindowMessages2 = (messages3) => structu
|
|
|
298618
298481
|
};
|
|
298619
298482
|
}, resolveWorkspaceGroup = (workspacePath) => {
|
|
298620
298483
|
const gitConfigPath = join59(workspacePath, ".git", "config");
|
|
298621
|
-
if (!
|
|
298484
|
+
if (!existsSync34(gitConfigPath)) {
|
|
298622
298485
|
return "Other";
|
|
298623
298486
|
}
|
|
298624
298487
|
try {
|
|
298625
|
-
const lines =
|
|
298488
|
+
const lines = readFileSync28(gitConfigPath, "utf8").split(/\r?\n/);
|
|
298626
298489
|
let inOriginRemote = false;
|
|
298627
298490
|
let userName = null;
|
|
298628
298491
|
for (const line of lines) {
|
|
@@ -298787,7 +298650,7 @@ var now3 = () => Date.now(), clonePromptWindowMessages2 = (messages3) => structu
|
|
|
298787
298650
|
}, resolveDefaultAuthServiceDataDir = (stateRoot) => {
|
|
298788
298651
|
const canonical = join59(stateRoot, "auth-service");
|
|
298789
298652
|
const legacy = join59(stateRoot, "profile-service");
|
|
298790
|
-
return !
|
|
298653
|
+
return !existsSync34(canonical) && existsSync34(legacy) ? legacy : canonical;
|
|
298791
298654
|
};
|
|
298792
298655
|
var init_app_kernel = __esm(() => {
|
|
298793
298656
|
init_src9();
|
|
@@ -301322,7 +301185,7 @@ var exports_trpc_server = {};
|
|
|
301322
301185
|
__export(exports_trpc_server, {
|
|
301323
301186
|
startTrpcServer: () => startTrpcServer
|
|
301324
301187
|
});
|
|
301325
|
-
import { createReadStream as createReadStream2, existsSync as
|
|
301188
|
+
import { createReadStream as createReadStream2, existsSync as existsSync35 } from "fs";
|
|
301326
301189
|
import { createServer as createServer2 } from "http";
|
|
301327
301190
|
import { extname as extname6, join as join60, normalize as normalize6, resolve as resolve54 } from "path";
|
|
301328
301191
|
import { Readable as Readable3 } from "stream";
|
|
@@ -301335,7 +301198,7 @@ var MIME_BY_EXT, MEDIA_AUTH_TOKEN_QUERY_KEY = "authToken", STATIC_ENTRY_FILENAME
|
|
|
301335
301198
|
}, resolveStaticEntryDocumentPath = (staticDir) => {
|
|
301336
301199
|
for (const filename of STATIC_ENTRY_FILENAMES) {
|
|
301337
301200
|
const filePath = join60(staticDir, filename);
|
|
301338
|
-
if (
|
|
301201
|
+
if (existsSync35(filePath)) {
|
|
301339
301202
|
return filePath;
|
|
301340
301203
|
}
|
|
301341
301204
|
}
|
|
@@ -301454,11 +301317,11 @@ var MIME_BY_EXT, MEDIA_AUTH_TOKEN_QUERY_KEY = "authToken", STATIC_ENTRY_FILENAME
|
|
|
301454
301317
|
return;
|
|
301455
301318
|
}
|
|
301456
301319
|
let targetPath = resolvedPath;
|
|
301457
|
-
if (!
|
|
301320
|
+
if (!existsSync35(targetPath)) {
|
|
301458
301321
|
const fallback200 = join60(staticDir, "200.html");
|
|
301459
|
-
targetPath =
|
|
301322
|
+
targetPath = existsSync35(fallback200) ? fallback200 : entryDocumentPath ?? join60(staticDir, "index.html");
|
|
301460
301323
|
}
|
|
301461
|
-
if (!
|
|
301324
|
+
if (!existsSync35(targetPath)) {
|
|
301462
301325
|
res.statusCode = 404;
|
|
301463
301326
|
res.end("web assets not found");
|
|
301464
301327
|
return;
|
|
@@ -307803,7 +307666,7 @@ import { mkdir as mkdir10, writeFile as writeFileNode } from "fs/promises";
|
|
|
307803
307666
|
import { dirname as dirname41, isAbsolute as isAbsolute15, resolve as resolve55 } from "path";
|
|
307804
307667
|
import { fileURLToPath as fileURLToPath12 } from "url";
|
|
307805
307668
|
import { resolve as resolve210, isAbsolute as isAbsolute22, parse as parse10 } from "path";
|
|
307806
|
-
import { existsSync as
|
|
307669
|
+
import { existsSync as existsSync36 } from "fs";
|
|
307807
307670
|
import { basename as basename15, join as join61 } from "path";
|
|
307808
307671
|
import os5 from "os";
|
|
307809
307672
|
import path6 from "path";
|
|
@@ -307816,7 +307679,7 @@ import * as path32 from "path";
|
|
|
307816
307679
|
import { readdir as readdir2 } from "fs/promises";
|
|
307817
307680
|
import { createRequire as createRequire4 } from "module";
|
|
307818
307681
|
import { fileURLToPath as fileURLToPath22 } from "url";
|
|
307819
|
-
import { existsSync as existsSync210, writeFileSync as
|
|
307682
|
+
import { existsSync as existsSync210, writeFileSync as writeFileSync18 } from "fs";
|
|
307820
307683
|
import { EventEmitter as EventEmitter4 } from "events";
|
|
307821
307684
|
import { EventEmitter as EventEmitter5 } from "events";
|
|
307822
307685
|
import util from "util";
|
|
@@ -315322,7 +315185,7 @@ function convertToDebugSymbols(symbols3) {
|
|
|
315322
315185
|
if (env3.OTUI_DEBUG_FFI && globalFFILogPath) {
|
|
315323
315186
|
const logPath = globalFFILogPath;
|
|
315324
315187
|
const writeSync = (msg) => {
|
|
315325
|
-
|
|
315188
|
+
writeFileSync18(logPath, msg + `
|
|
315326
315189
|
`, { flag: "a" });
|
|
315327
315190
|
};
|
|
315328
315191
|
Object.entries(symbols3).forEach(([key, value]) => {
|
|
@@ -323719,7 +323582,7 @@ var init_index_t4yn324k = __esm(async () => {
|
|
|
323719
323582
|
return this.options.workerPath;
|
|
323720
323583
|
}
|
|
323721
323584
|
let workerPath = new URL("./parser.worker.js", import.meta.url).href;
|
|
323722
|
-
if (!
|
|
323585
|
+
if (!existsSync36(resolve210(import.meta.dirname, "parser.worker.js"))) {
|
|
323723
323586
|
workerPath = new URL("./parser.worker.ts", import.meta.url).href;
|
|
323724
323587
|
}
|
|
323725
323588
|
return workerPath;
|
|
@@ -343958,7 +343821,7 @@ var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
|
|
|
343958
343821
|
|
|
343959
343822
|
// packages/cli/src/run-cli.ts
|
|
343960
343823
|
import { spawn as spawnChildProcess } from "child_process";
|
|
343961
|
-
import { closeSync as closeSync3, existsSync as
|
|
343824
|
+
import { closeSync as closeSync3, existsSync as existsSync37, mkdirSync as mkdirSync37, openSync as openSync3, readFileSync as readFileSync29 } from "fs";
|
|
343962
343825
|
import { createRequire as createRequire5 } from "module";
|
|
343963
343826
|
import { request as httpRequest2 } from "http";
|
|
343964
343827
|
import { request as httpsRequest } from "https";
|
|
@@ -349114,7 +348977,7 @@ var resolveDaemonHealthLabel = (args) => `http://${args.host}:${args.port}/healt
|
|
|
349114
348977
|
var resolveCliEntryPath = () => resolve57(import.meta.dir, "bin", "agenter.ts");
|
|
349115
348978
|
var resolveCurrentCliEntrypointArgv = () => {
|
|
349116
348979
|
const entrypoint = process.argv[1];
|
|
349117
|
-
if (entrypoint &&
|
|
348980
|
+
if (entrypoint && existsSync37(entrypoint)) {
|
|
349118
348981
|
return [entrypoint];
|
|
349119
348982
|
}
|
|
349120
348983
|
return ["run", resolveCliEntryPath()];
|
|
@@ -349127,7 +348990,7 @@ var resolveBundledAssetPath2 = (...segments) => {
|
|
|
349127
348990
|
return;
|
|
349128
348991
|
}
|
|
349129
348992
|
const path7 = join64(root3, ...segments);
|
|
349130
|
-
return
|
|
348993
|
+
return existsSync37(path7) ? path7 : undefined;
|
|
349131
348994
|
};
|
|
349132
348995
|
var isHttpHealthAlive = async (urlString, timeoutMs = HEALTH_REQUEST_TIMEOUT_MS) => {
|
|
349133
348996
|
const url2 = new URL(urlString);
|
|
@@ -349196,7 +349059,7 @@ var buildDaemonServeArgv = (args) => {
|
|
|
349196
349059
|
};
|
|
349197
349060
|
var readLogTail = (path7, maxBytes = 16384) => {
|
|
349198
349061
|
try {
|
|
349199
|
-
const text4 =
|
|
349062
|
+
const text4 = readFileSync29(path7, "utf8");
|
|
349200
349063
|
return text4.length > maxBytes ? text4.slice(-maxBytes) : text4;
|
|
349201
349064
|
} catch {
|
|
349202
349065
|
return "";
|
|
@@ -349204,7 +349067,7 @@ var readLogTail = (path7, maxBytes = 16384) => {
|
|
|
349204
349067
|
};
|
|
349205
349068
|
var spawnManagedDaemonProcess = (args) => {
|
|
349206
349069
|
const logPath = resolveDaemonLogPath(resolveLauncherHomeDir(), args);
|
|
349207
|
-
|
|
349070
|
+
mkdirSync37(dirname44(logPath), { recursive: true });
|
|
349208
349071
|
const logFd = openSync3(logPath, "a");
|
|
349209
349072
|
const child = (() => {
|
|
349210
349073
|
try {
|