replicas-engine 0.1.1183 → 0.1.1184
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/README.md +1 -3
- package/dist/src/{asp-host-Y5PB7ROJ.js → asp-host-PTEDR5TW.js} +2 -2
- package/dist/src/{chunk-RB33U66A.js → chunk-2YHCBP6R.js} +1 -1
- package/dist/src/{chunk-6TR2W5B3.js → chunk-CPHIDGPB.js} +56 -29
- package/dist/src/{chunk-E6ZC5R42.js → chunk-PNIWI4J6.js} +1 -1
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +101 -115
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,9 +103,7 @@ Token refresh managers may later overwrite credential files in place:
|
|
|
103
103
|
|
|
104
104
|
Engine persistence locations:
|
|
105
105
|
|
|
106
|
-
-
|
|
107
|
-
- `~/.replicas/engine/events.jsonl`
|
|
108
|
-
- `~/.replicas/engine-state.json`
|
|
106
|
+
- `/var/lib/replicas/engine/` (`REPLICAS_ENGINE_STATE_DIR` overrides `/var/lib/replicas`): `chats.json`, `events.jsonl`, `engine-state.json`, and chat histories
|
|
109
107
|
- `~/.replicas/startHooks.log`
|
|
110
108
|
- Canvas read locations (for `/canvas` endpoints):
|
|
111
109
|
- `~/.claude/plans` (where Claude Code writes its plans)
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
listRunningCodexModels,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CPHIDGPB.js";
|
|
12
12
|
import "./chunk-OKE4RCRY.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-2YHCBP6R.js";
|
|
14
14
|
import "./chunk-2AG3DWDX.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
16
|
import "./chunk-AGNQDFJU.js";
|
|
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
|
|
|
240
240
|
if (method === "foundry") return "azure";
|
|
241
241
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
242
242
|
}
|
|
243
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
243
|
+
var ENGINE_PACKAGE_VERSION = "0.1.1184";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-2YHCBP6R.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBPROCESS_MAX_BUFFER,
|
|
20
20
|
execFileAsync
|
|
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
291
291
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
292
292
|
await this.applyCredentialsResponse(data);
|
|
293
293
|
setAgentCredentialSnapshot("codex", data);
|
|
294
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
294
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-PTEDR5TW.js");
|
|
295
295
|
await restartCodexAspHostIfRunning2();
|
|
296
296
|
});
|
|
297
297
|
await this.start(true);
|
|
@@ -313,7 +313,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
313
313
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
314
314
|
await this.applyCredentialsResponse(data);
|
|
315
315
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
316
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
316
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-PTEDR5TW.js");
|
|
317
317
|
await restartCodexAspHostIfRunning2();
|
|
318
318
|
}
|
|
319
319
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -430,18 +430,37 @@ import { existsSync as existsSync3, readFileSync } from "fs";
|
|
|
430
430
|
// src/git/service.ts
|
|
431
431
|
import { readdir, readFile as readFile3, stat } from "fs/promises";
|
|
432
432
|
import { spawn } from "child_process";
|
|
433
|
-
import { isAbsolute, join as
|
|
433
|
+
import { isAbsolute, join as join4 } from "path";
|
|
434
434
|
|
|
435
435
|
// src/utils/state.ts
|
|
436
436
|
import { readFile as readFile2, mkdir as mkdir2 } from "fs/promises";
|
|
437
437
|
import { existsSync } from "fs";
|
|
438
|
-
import { join as
|
|
439
|
-
|
|
438
|
+
import { join as join3 } from "path";
|
|
439
|
+
|
|
440
|
+
// src/services/chat/history-paths.ts
|
|
441
|
+
import { join } from "path";
|
|
442
|
+
var ENGINE_DIR = join(process.env.REPLICAS_ENGINE_STATE_DIR ?? "/var/lib/replicas", "engine");
|
|
443
|
+
var CHATS_FILE = join(ENGINE_DIR, "chats.json");
|
|
444
|
+
var CLAUDE_HISTORY_DIR = join(ENGINE_DIR, "claude-histories");
|
|
445
|
+
var CODEX_HISTORY_DIR = join(ENGINE_DIR, "codex-histories");
|
|
446
|
+
var CURSOR_HISTORY_DIR = join(ENGINE_DIR, "cursor-histories");
|
|
447
|
+
var OPENCODE_HISTORY_DIR = join(ENGINE_DIR, "opencode-histories");
|
|
448
|
+
var PI_HISTORY_DIR = join(ENGINE_DIR, "pi-histories");
|
|
449
|
+
var MUSE_HISTORY_DIR = join(ENGINE_DIR, "muse-histories");
|
|
450
|
+
var FORKS_DIR = join(ENGINE_DIR, "forks");
|
|
451
|
+
var HISTORY_DIR_BY_PROVIDER = {
|
|
452
|
+
claude: CLAUDE_HISTORY_DIR,
|
|
453
|
+
codex: CODEX_HISTORY_DIR,
|
|
454
|
+
cursor: CURSOR_HISTORY_DIR,
|
|
455
|
+
muse: MUSE_HISTORY_DIR,
|
|
456
|
+
opencode: OPENCODE_HISTORY_DIR,
|
|
457
|
+
pi: PI_HISTORY_DIR
|
|
458
|
+
};
|
|
440
459
|
|
|
441
460
|
// src/utils/file.ts
|
|
442
461
|
import { randomUUID } from "crypto";
|
|
443
462
|
import { mkdir, readFile, rename, unlink, writeFile } from "fs/promises";
|
|
444
|
-
import { dirname, join } from "path";
|
|
463
|
+
import { dirname, join as join2 } from "path";
|
|
445
464
|
|
|
446
465
|
// src/utils/async-lock.ts
|
|
447
466
|
var AsyncLock = class {
|
|
@@ -474,8 +493,8 @@ async function writeSecureCredentialFile(filePath, content, options) {
|
|
|
474
493
|
await atomicWriteFile(filePath, content, { mode: 384 });
|
|
475
494
|
}
|
|
476
495
|
async function configureManagedGitCredentialHelper(homeDir) {
|
|
477
|
-
const credentialsPath =
|
|
478
|
-
const helperPath =
|
|
496
|
+
const credentialsPath = join2(homeDir, ".git-credentials");
|
|
497
|
+
const helperPath = join2(homeDir, GIT_CREDENTIAL_HELPER_FILENAME);
|
|
479
498
|
await atomicWriteFile(helperPath, buildGitCredentialHelperScript(credentialsPath), { mode: 448 });
|
|
480
499
|
await execFileAsync("git", ["config", "--global", "credential.helper", helperPath], {
|
|
481
500
|
env: { ...process.env, HOME: homeDir }
|
|
@@ -511,8 +530,7 @@ function removeCredentialFileLines(filePath, shouldRemove) {
|
|
|
511
530
|
}
|
|
512
531
|
|
|
513
532
|
// src/utils/state.ts
|
|
514
|
-
var
|
|
515
|
-
var STATE_FILE = join2(STATE_DIR, "engine-state.json");
|
|
533
|
+
var STATE_FILE = join3(ENGINE_DIR, "engine-state.json");
|
|
516
534
|
var DEFAULT_STATE = {
|
|
517
535
|
repos: {},
|
|
518
536
|
removedRepos: {}
|
|
@@ -520,7 +538,7 @@ var DEFAULT_STATE = {
|
|
|
520
538
|
var stateWriteLock = new AsyncLock();
|
|
521
539
|
async function updateEngineState(updater) {
|
|
522
540
|
return stateWriteLock.run(async () => {
|
|
523
|
-
await mkdir2(
|
|
541
|
+
await mkdir2(ENGINE_DIR, { recursive: true });
|
|
524
542
|
const currentState = await loadEngineState();
|
|
525
543
|
const nextState = updater(currentState);
|
|
526
544
|
await atomicWriteFile(STATE_FILE, JSON.stringify(nextState, null, 2));
|
|
@@ -659,13 +677,13 @@ var GitService = class {
|
|
|
659
677
|
const repos = [];
|
|
660
678
|
let complete = true;
|
|
661
679
|
for (const entry of entries) {
|
|
662
|
-
const fullPath =
|
|
680
|
+
const fullPath = join4(root, entry);
|
|
663
681
|
try {
|
|
664
682
|
const entryStat = await stat(fullPath);
|
|
665
683
|
if (!entryStat.isDirectory()) {
|
|
666
684
|
continue;
|
|
667
685
|
}
|
|
668
|
-
const hasGit = Boolean(await this.safeStat(
|
|
686
|
+
const hasGit = Boolean(await this.safeStat(join4(fullPath, ".git")));
|
|
669
687
|
if (!hasGit) {
|
|
670
688
|
continue;
|
|
671
689
|
}
|
|
@@ -686,8 +704,8 @@ var GitService = class {
|
|
|
686
704
|
const removed = new Map(Object.entries(state.removedRepos));
|
|
687
705
|
for (const repo of Object.values(state.repos)) {
|
|
688
706
|
if (!isAbsolute(repo.name)) continue;
|
|
689
|
-
const exists = Boolean(await this.safeStat(
|
|
690
|
-
const origin = exists ? (await readFile3(
|
|
707
|
+
const exists = Boolean(await this.safeStat(join4(repo.path, ".git")));
|
|
708
|
+
const origin = exists ? (await readFile3(join4(repo.path, ".git", "config"), "utf-8").catch(() => "")).match(/\[remote "origin"\][^[]*?\burl\s*=\s*(\S+)/)?.[1] ?? null : null;
|
|
691
709
|
const known = this.trackedCloneOrigins.has(repo.path) ? this.trackedCloneOrigins.get(repo.path) : origin;
|
|
692
710
|
if (exists && origin === known) {
|
|
693
711
|
this.trackedCloneOrigins.set(repo.path, origin);
|
|
@@ -711,7 +729,7 @@ var GitService = class {
|
|
|
711
729
|
const commonDir = await runGitCommand(["rev-parse", "--path-format=absolute", "--git-common-dir"], worktree).catch(() => null);
|
|
712
730
|
if (!commonDir) return false;
|
|
713
731
|
const { repos } = await this.listTrackedRepositories();
|
|
714
|
-
if (repos.some((repo) => repo.path === worktree ||
|
|
732
|
+
if (repos.some((repo) => repo.path === worktree || join4(repo.path, ".git") === commonDir)) return false;
|
|
715
733
|
const defaultBranch = await this.resolveDefaultBranch(worktree);
|
|
716
734
|
await saveRepoState(worktree, {}, {
|
|
717
735
|
name: worktree,
|
|
@@ -855,7 +873,7 @@ var GitService = class {
|
|
|
855
873
|
for (let i = 0; i < paths.length; i += UNTRACKED_STAT_CONCURRENCY) {
|
|
856
874
|
const batch = await Promise.all(paths.slice(i, i + UNTRACKED_STAT_CONCURRENCY).map(async (path2) => {
|
|
857
875
|
try {
|
|
858
|
-
return { path: path2, size: (await stat(
|
|
876
|
+
return { path: path2, size: (await stat(join4(repoPath, path2))).size };
|
|
859
877
|
} catch {
|
|
860
878
|
return null;
|
|
861
879
|
}
|
|
@@ -935,7 +953,7 @@ Binary files /dev/null and ${quote(`b/${path2}`)} differ
|
|
|
935
953
|
for (const { path: path2, tooLarge } of files) {
|
|
936
954
|
if (tooLarge) continue;
|
|
937
955
|
try {
|
|
938
|
-
const contents = await readFile3(
|
|
956
|
+
const contents = await readFile3(join4(repoPath, path2));
|
|
939
957
|
if (contents.length === 0 || contents.includes(0)) {
|
|
940
958
|
continue;
|
|
941
959
|
}
|
|
@@ -1123,7 +1141,7 @@ Binary files /dev/null and ${quote(`b/${path2}`)} differ
|
|
|
1123
1141
|
}
|
|
1124
1142
|
async getGitLabAccessToken(host) {
|
|
1125
1143
|
try {
|
|
1126
|
-
const credentials = await readFile3(
|
|
1144
|
+
const credentials = await readFile3(join4(ENGINE_ENV.HOME_DIR, ".git-credentials"), "utf-8");
|
|
1127
1145
|
for (const line of credentials.split("\n")) {
|
|
1128
1146
|
const trimmed = line.trim();
|
|
1129
1147
|
if (!trimmed) continue;
|
|
@@ -1202,8 +1220,8 @@ async function getAgentAdditionalDirectories() {
|
|
|
1202
1220
|
// src/utils/image-utils.ts
|
|
1203
1221
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1204
1222
|
import { mkdir as mkdir3, unlink as unlink2, writeFile as writeFile2 } from "fs/promises";
|
|
1205
|
-
import { homedir
|
|
1206
|
-
import { join as
|
|
1223
|
+
import { homedir } from "os";
|
|
1224
|
+
import { join as join5 } from "path";
|
|
1207
1225
|
function isImageMediaType(value) {
|
|
1208
1226
|
return IMAGE_MEDIA_TYPES.includes(value);
|
|
1209
1227
|
}
|
|
@@ -1268,14 +1286,14 @@ async function normalizeImages(images) {
|
|
|
1268
1286
|
}
|
|
1269
1287
|
return normalized;
|
|
1270
1288
|
}
|
|
1271
|
-
async function saveNormalizedImagesToTempFiles(images, tempImageDir =
|
|
1289
|
+
async function saveNormalizedImagesToTempFiles(images, tempImageDir = join5(homedir(), ".replicas", "codex", "temp-images")) {
|
|
1272
1290
|
await mkdir3(tempImageDir, { recursive: true });
|
|
1273
1291
|
const tempPaths = [];
|
|
1274
1292
|
try {
|
|
1275
1293
|
for (const image of images) {
|
|
1276
1294
|
const ext = image.source.media_type.split("/")[1] || "png";
|
|
1277
1295
|
const filename = `img_${randomUUID2()}.${ext}`;
|
|
1278
|
-
const filepath =
|
|
1296
|
+
const filepath = join5(tempImageDir, filename);
|
|
1279
1297
|
await writeFile2(filepath, Buffer.from(image.source.data, "base64"));
|
|
1280
1298
|
tempPaths.push(filepath);
|
|
1281
1299
|
}
|
|
@@ -1352,14 +1370,14 @@ var CodexQuotaStatusTracker = class {
|
|
|
1352
1370
|
|
|
1353
1371
|
// src/managers/subagent-mcp-config.ts
|
|
1354
1372
|
import { existsSync as existsSync2 } from "fs";
|
|
1355
|
-
import { dirname as dirname2, join as
|
|
1373
|
+
import { dirname as dirname2, join as join6 } from "path";
|
|
1356
1374
|
import { fileURLToPath } from "url";
|
|
1357
1375
|
import { createRequire } from "module";
|
|
1358
1376
|
var SUBAGENT_MCP_TOOL_TIMEOUT_MS = 24 * 60 * 60 * 1e3 + 6e4;
|
|
1359
1377
|
function subagentMcpProcessConfig(parentChatId) {
|
|
1360
1378
|
const directory = dirname2(fileURLToPath(import.meta.url));
|
|
1361
|
-
const builtEntry =
|
|
1362
|
-
const sourceEntry =
|
|
1379
|
+
const builtEntry = join6(directory, "subagent-mcp.js");
|
|
1380
|
+
const sourceEntry = join6(directory, "..", "subagent-mcp.ts");
|
|
1363
1381
|
const entry = existsSync2(builtEntry) ? builtEntry : sourceEntry;
|
|
1364
1382
|
return {
|
|
1365
1383
|
command: process.execPath,
|
|
@@ -1845,9 +1863,9 @@ async function buildTurnStartParams(threadId, request, serviceTier) {
|
|
|
1845
1863
|
// src/managers/codex-asp/openai-compatible-model-catalog.ts
|
|
1846
1864
|
import { writeFile as writeFile3 } from "fs/promises";
|
|
1847
1865
|
import { tmpdir } from "os";
|
|
1848
|
-
import { join as
|
|
1866
|
+
import { join as join7 } from "path";
|
|
1849
1867
|
var CATALOG_TTL_MS = 6e4;
|
|
1850
|
-
var CODEX_MODEL_CATALOG_PATH =
|
|
1868
|
+
var CODEX_MODEL_CATALOG_PATH = join7(tmpdir(), "replicas-openai-compatible-model-catalog.json");
|
|
1851
1869
|
var cachedCatalog = null;
|
|
1852
1870
|
async function writeCodexModelCatalog(modelsUrl) {
|
|
1853
1871
|
const ollama = ENGINE_ENV.REPLICAS_CODEX_AUTH_METHOD === "ollama" ? readOllamaAuthEnv("codex", process.env) : null;
|
|
@@ -2003,6 +2021,15 @@ export {
|
|
|
2003
2021
|
configureManagedGitCredentialHelper,
|
|
2004
2022
|
upsertCredentialFileLines,
|
|
2005
2023
|
removeCredentialFileLines,
|
|
2024
|
+
ENGINE_DIR,
|
|
2025
|
+
CHATS_FILE,
|
|
2026
|
+
CLAUDE_HISTORY_DIR,
|
|
2027
|
+
CODEX_HISTORY_DIR,
|
|
2028
|
+
CURSOR_HISTORY_DIR,
|
|
2029
|
+
OPENCODE_HISTORY_DIR,
|
|
2030
|
+
PI_HISTORY_DIR,
|
|
2031
|
+
FORKS_DIR,
|
|
2032
|
+
HISTORY_DIR_BY_PROVIDER,
|
|
2006
2033
|
loadRepoState,
|
|
2007
2034
|
saveRepoState,
|
|
2008
2035
|
gitService,
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
recoverCompletedTurn,
|
|
14
14
|
spawnMuseMsp,
|
|
15
15
|
startMuseSession
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-PNIWI4J6.js";
|
|
17
17
|
import {
|
|
18
18
|
AppServerProcess,
|
|
19
19
|
buildCodexAgentEnv
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2YHCBP6R.js";
|
|
21
21
|
import "./chunk-2AG3DWDX.js";
|
|
22
22
|
import {
|
|
23
23
|
AGENT,
|
package/dist/src/index.js
CHANGED
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
spawnMuseMsp,
|
|
65
65
|
startMuseSession,
|
|
66
66
|
uuidV7
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-PNIWI4J6.js";
|
|
68
68
|
import {
|
|
69
69
|
publishedPullRequestUrls
|
|
70
70
|
} from "./chunk-E5HOEAHV.js";
|
|
@@ -72,10 +72,19 @@ import {
|
|
|
72
72
|
ACCOUNT_RATE_LIMITS_READ_METHOD,
|
|
73
73
|
AsyncLock,
|
|
74
74
|
BaseRefreshManager,
|
|
75
|
+
CHATS_FILE,
|
|
76
|
+
CLAUDE_HISTORY_DIR,
|
|
77
|
+
CODEX_HISTORY_DIR,
|
|
75
78
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
79
|
+
CURSOR_HISTORY_DIR,
|
|
76
80
|
CodexAspAuthMethodChangedError,
|
|
77
81
|
CodexQuotaStatusTracker,
|
|
78
82
|
DEFAULT_MODEL,
|
|
83
|
+
ENGINE_DIR,
|
|
84
|
+
FORKS_DIR,
|
|
85
|
+
HISTORY_DIR_BY_PROVIDER,
|
|
86
|
+
OPENCODE_HISTORY_DIR,
|
|
87
|
+
PI_HISTORY_DIR,
|
|
79
88
|
SKILLS_LIST_METHOD,
|
|
80
89
|
SUBAGENT_MCP_TOOL_TIMEOUT_MS,
|
|
81
90
|
THREAD_BACKGROUND_TERMINALS_CLEAN_METHOD,
|
|
@@ -130,7 +139,7 @@ import {
|
|
|
130
139
|
timestampFromSeconds,
|
|
131
140
|
upsertCredentialFileLines,
|
|
132
141
|
writeSecureCredentialFile
|
|
133
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-CPHIDGPB.js";
|
|
134
143
|
import {
|
|
135
144
|
ENGINE_ENV,
|
|
136
145
|
monolithRequest,
|
|
@@ -142,7 +151,7 @@ import {
|
|
|
142
151
|
} from "./chunk-OKE4RCRY.js";
|
|
143
152
|
import {
|
|
144
153
|
getCodexModelProvider
|
|
145
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-2YHCBP6R.js";
|
|
146
155
|
import {
|
|
147
156
|
SUBPROCESS_MAX_BUFFER,
|
|
148
157
|
execAsync,
|
|
@@ -575,7 +584,7 @@ var require_lib = __commonJS({
|
|
|
575
584
|
"../node_modules/.bun/which@5.0.0/node_modules/which/lib/index.js"(exports, module) {
|
|
576
585
|
"use strict";
|
|
577
586
|
var { isexe, sync: isexeSync } = require_index_min();
|
|
578
|
-
var { join:
|
|
587
|
+
var { join: join35, delimiter: delimiter3, sep: sep2, posix } = __require("path");
|
|
579
588
|
var isWindows = process.platform === "win32";
|
|
580
589
|
var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
|
|
581
590
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
@@ -604,7 +613,7 @@ var require_lib = __commonJS({
|
|
|
604
613
|
var getPathPart = (raw, cmd) => {
|
|
605
614
|
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
606
615
|
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
607
|
-
return prefix +
|
|
616
|
+
return prefix + join35(pathPart, cmd);
|
|
608
617
|
};
|
|
609
618
|
var which = async (cmd, opt = {}) => {
|
|
610
619
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
@@ -10275,10 +10284,8 @@ var replicasConfigService = new ReplicasConfigService();
|
|
|
10275
10284
|
|
|
10276
10285
|
// src/services/event-service.ts
|
|
10277
10286
|
import { mkdir as mkdir5 } from "fs/promises";
|
|
10278
|
-
import { homedir as homedir6 } from "os";
|
|
10279
10287
|
import { join as join6 } from "path";
|
|
10280
10288
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
10281
|
-
var ENGINE_DIR = join6(homedir6(), ".replicas", "engine");
|
|
10282
10289
|
var EVENTS_FILE = join6(ENGINE_DIR, "events.jsonl");
|
|
10283
10290
|
var EventService = class {
|
|
10284
10291
|
subscribers = /* @__PURE__ */ new Map();
|
|
@@ -10313,9 +10320,9 @@ var eventService = new EventService();
|
|
|
10313
10320
|
import { mkdir as mkdir6, readFile as readFile5 } from "fs/promises";
|
|
10314
10321
|
import { existsSync as existsSync4 } from "fs";
|
|
10315
10322
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
10316
|
-
import { homedir as
|
|
10323
|
+
import { homedir as homedir6 } from "os";
|
|
10317
10324
|
import { dirname, join as join7 } from "path";
|
|
10318
|
-
var PREVIEW_PORTS_FILE = join7(
|
|
10325
|
+
var PREVIEW_PORTS_FILE = join7(homedir6(), ".replicas", "preview-ports.json");
|
|
10319
10326
|
async function readPreviewsFile() {
|
|
10320
10327
|
try {
|
|
10321
10328
|
if (!existsSync4(PREVIEW_PORTS_FILE)) {
|
|
@@ -10430,7 +10437,7 @@ async function registerDesktopPreview(signal) {
|
|
|
10430
10437
|
|
|
10431
10438
|
// src/services/chat/chat-service.ts
|
|
10432
10439
|
import { appendFile as appendFile5, copyFile as copyFile2, mkdir as mkdir17, readFile as readFile16, rename as rename3, rm as rm4, stat as stat6 } from "fs/promises";
|
|
10433
|
-
import { join as
|
|
10440
|
+
import { join as join28 } from "path";
|
|
10434
10441
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
10435
10442
|
|
|
10436
10443
|
// ../shared/src/workspace-chat.ts
|
|
@@ -10612,7 +10619,7 @@ import {
|
|
|
10612
10619
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
10613
10620
|
import { dirname as dirname3, join as join10 } from "path";
|
|
10614
10621
|
import { mkdir as mkdir7, readdir as readdir3, readFile as readFile7 } from "fs/promises";
|
|
10615
|
-
import { homedir as
|
|
10622
|
+
import { homedir as homedir7 } from "os";
|
|
10616
10623
|
|
|
10617
10624
|
// src/utils/linear-converter.ts
|
|
10618
10625
|
function linearThoughtToResponse(thought) {
|
|
@@ -12669,7 +12676,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
12669
12676
|
});
|
|
12670
12677
|
this.onChatCredential = options.onChatCredential ?? (() => {
|
|
12671
12678
|
});
|
|
12672
|
-
this.historyFilePath = options.historyFilePath ?? join10(
|
|
12679
|
+
this.historyFilePath = options.historyFilePath ?? join10(homedir7(), ".replicas", "claude", "history.jsonl");
|
|
12673
12680
|
this.historyFile = new CodexHistoryFile(this.historyFilePath);
|
|
12674
12681
|
this.initializeManager(this.processMessageInternal.bind(this));
|
|
12675
12682
|
}
|
|
@@ -16766,7 +16773,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
16766
16773
|
|
|
16767
16774
|
// src/managers/pi-manager.ts
|
|
16768
16775
|
import { mkdir as mkdir14, readFile as readFile11 } from "fs/promises";
|
|
16769
|
-
import { dirname as dirname15, join as
|
|
16776
|
+
import { dirname as dirname15, join as join21 } from "path";
|
|
16770
16777
|
import {
|
|
16771
16778
|
createAgentSession,
|
|
16772
16779
|
ModelRegistry,
|
|
@@ -16775,27 +16782,6 @@ import {
|
|
|
16775
16782
|
DefaultResourceLoader
|
|
16776
16783
|
} from "@earendil-works/pi-coding-agent";
|
|
16777
16784
|
|
|
16778
|
-
// src/services/chat/history-paths.ts
|
|
16779
|
-
import { homedir as homedir9 } from "os";
|
|
16780
|
-
import { join as join15 } from "path";
|
|
16781
|
-
var ENGINE_DIR2 = join15(homedir9(), ".replicas", "engine");
|
|
16782
|
-
var CHATS_FILE = join15(ENGINE_DIR2, "chats.json");
|
|
16783
|
-
var CLAUDE_HISTORY_DIR = join15(ENGINE_DIR2, "claude-histories");
|
|
16784
|
-
var CODEX_HISTORY_DIR = join15(ENGINE_DIR2, "codex-histories");
|
|
16785
|
-
var CURSOR_HISTORY_DIR = join15(ENGINE_DIR2, "cursor-histories");
|
|
16786
|
-
var OPENCODE_HISTORY_DIR = join15(ENGINE_DIR2, "opencode-histories");
|
|
16787
|
-
var PI_HISTORY_DIR = join15(ENGINE_DIR2, "pi-histories");
|
|
16788
|
-
var MUSE_HISTORY_DIR = join15(ENGINE_DIR2, "muse-histories");
|
|
16789
|
-
var FORKS_DIR = join15(ENGINE_DIR2, "forks");
|
|
16790
|
-
var HISTORY_DIR_BY_PROVIDER = {
|
|
16791
|
-
claude: CLAUDE_HISTORY_DIR,
|
|
16792
|
-
codex: CODEX_HISTORY_DIR,
|
|
16793
|
-
cursor: CURSOR_HISTORY_DIR,
|
|
16794
|
-
muse: MUSE_HISTORY_DIR,
|
|
16795
|
-
opencode: OPENCODE_HISTORY_DIR,
|
|
16796
|
-
pi: PI_HISTORY_DIR
|
|
16797
|
-
};
|
|
16798
|
-
|
|
16799
16785
|
// ../node_modules/.bun/typebox@1.3.7/node_modules/typebox/build/system/memory/memory.mjs
|
|
16800
16786
|
var memory_exports = {};
|
|
16801
16787
|
__export(memory_exports, {
|
|
@@ -39326,7 +39312,7 @@ async function probeMcpEndpoint(url3) {
|
|
|
39326
39312
|
|
|
39327
39313
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/npx-resolver.ts
|
|
39328
39314
|
import { existsSync as existsSync9, readFileSync as readFileSync2, realpathSync, readdirSync, statSync, writeFileSync as writeFileSync2, renameSync, mkdirSync as mkdirSync2, openSync, readSync, closeSync, unlinkSync } from "fs";
|
|
39329
|
-
import { join as
|
|
39315
|
+
import { join as join15, dirname as dirname8, extname as extname2, resolve as resolve2, sep } from "path";
|
|
39330
39316
|
|
|
39331
39317
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/abort.ts
|
|
39332
39318
|
function throwIfAborted(signal) {
|
|
@@ -39483,7 +39469,7 @@ function resolveFromNpmCache(packageSpec, binName) {
|
|
|
39483
39469
|
const { packageName, exactVersion } = parsedSpec;
|
|
39484
39470
|
const packageDir = findCachedPackageDir(cacheDir, packageName, exactVersion);
|
|
39485
39471
|
if (!packageDir) return null;
|
|
39486
|
-
const packageJsonPath =
|
|
39472
|
+
const packageJsonPath = join15(packageDir, "package.json");
|
|
39487
39473
|
if (!existsSync9(packageJsonPath)) return null;
|
|
39488
39474
|
let pkg = null;
|
|
39489
39475
|
try {
|
|
@@ -39517,7 +39503,7 @@ function resolveFromNpmCache(packageSpec, binName) {
|
|
|
39517
39503
|
}
|
|
39518
39504
|
if (!binRel) return null;
|
|
39519
39505
|
const nodeModulesDir = findNodeModulesDir(packageDir);
|
|
39520
|
-
const binLink = chosenBinName ?
|
|
39506
|
+
const binLink = chosenBinName ? join15(nodeModulesDir, ".bin", chosenBinName) : null;
|
|
39521
39507
|
let resolvedBin = binLink && existsSync9(binLink) ? safeRealpath(binLink) : "";
|
|
39522
39508
|
if (!resolvedBin) {
|
|
39523
39509
|
resolvedBin = resolve2(packageDir, binRel);
|
|
@@ -39619,17 +39605,17 @@ function defaultBinName(packageName) {
|
|
|
39619
39605
|
return packageName;
|
|
39620
39606
|
}
|
|
39621
39607
|
function findCachedPackageDir(cacheDir, packageName, exactVersion) {
|
|
39622
|
-
const npxDir =
|
|
39608
|
+
const npxDir = join15(cacheDir, "_npx");
|
|
39623
39609
|
if (!existsSync9(npxDir)) return null;
|
|
39624
39610
|
const packagePathParts = packageName.startsWith("@") ? packageName.split("/") : [packageName];
|
|
39625
39611
|
const candidates = readdirSync(npxDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => {
|
|
39626
|
-
const full =
|
|
39612
|
+
const full = join15(npxDir, entry.name);
|
|
39627
39613
|
const mtime = safeStatMtime(full);
|
|
39628
39614
|
return { name: entry.name, mtime };
|
|
39629
39615
|
}).sort((a, b) => b.mtime - a.mtime);
|
|
39630
39616
|
for (const entry of candidates) {
|
|
39631
|
-
const pkgDir =
|
|
39632
|
-
const packageJsonPath =
|
|
39617
|
+
const pkgDir = join15(npxDir, entry.name, "node_modules", ...packagePathParts);
|
|
39618
|
+
const packageJsonPath = join15(pkgDir, "package.json");
|
|
39633
39619
|
if (!existsSync9(packageJsonPath)) continue;
|
|
39634
39620
|
if (exactVersion) {
|
|
39635
39621
|
try {
|
|
@@ -39649,7 +39635,7 @@ function findNodeModulesDir(packageDir) {
|
|
|
39649
39635
|
if (idx >= 0) {
|
|
39650
39636
|
return parts.slice(0, idx + 1).join(sep);
|
|
39651
39637
|
}
|
|
39652
|
-
return
|
|
39638
|
+
return join15(packageDir, "..");
|
|
39653
39639
|
}
|
|
39654
39640
|
function detectJsBinary(binPath) {
|
|
39655
39641
|
const ext = extname2(binPath).toLowerCase();
|
|
@@ -39841,7 +39827,7 @@ import { spawnSync } from "child_process";
|
|
|
39841
39827
|
import { createHash as createHash2 } from "crypto";
|
|
39842
39828
|
import { createRequire } from "module";
|
|
39843
39829
|
import { readFileSync as readFileSync3, existsSync as existsSync10, rmSync as rmSync2 } from "fs";
|
|
39844
|
-
import { dirname as dirname9, join as
|
|
39830
|
+
import { dirname as dirname9, join as join16 } from "path";
|
|
39845
39831
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
39846
39832
|
var require2 = createRequire(import.meta.url);
|
|
39847
39833
|
var AUTH_SECRET_SERVICE = "pi-mcp-adapter.oauth";
|
|
@@ -39997,7 +39983,7 @@ function loadKeyringNativeBindingFallback(keyringRequire, platform3, arch2) {
|
|
|
39997
39983
|
for (const target of targets) {
|
|
39998
39984
|
try {
|
|
39999
39985
|
const packageJsonPath = keyringRequire.resolve(`${target.packageName}/package.json`);
|
|
40000
|
-
return keyringRequire(
|
|
39986
|
+
return keyringRequire(join16(dirname9(packageJsonPath), target.bindingFile));
|
|
40001
39987
|
} catch (error) {
|
|
40002
39988
|
lastError = error;
|
|
40003
39989
|
}
|
|
@@ -40102,7 +40088,7 @@ function getServerDir(serverName, options) {
|
|
|
40102
40088
|
throw new Error(`Invalid MCP server name: ${JSON.stringify(serverName)}`);
|
|
40103
40089
|
}
|
|
40104
40090
|
const storageKey = getAuthEntryAccount(serverName);
|
|
40105
|
-
return
|
|
40091
|
+
return join16(getAuthBaseDir(options), storageKey);
|
|
40106
40092
|
}
|
|
40107
40093
|
function getAuthEntryAccount(serverName) {
|
|
40108
40094
|
if (typeof serverName !== "string") {
|
|
@@ -40111,7 +40097,7 @@ function getAuthEntryAccount(serverName) {
|
|
|
40111
40097
|
return `sha256-${createHash2("sha256").update(serverName, "utf8").digest("hex")}`;
|
|
40112
40098
|
}
|
|
40113
40099
|
function getAuthEntryFilePath(serverName, options) {
|
|
40114
|
-
return
|
|
40100
|
+
return join16(getServerDir(serverName, options), "tokens.json");
|
|
40115
40101
|
}
|
|
40116
40102
|
function parseJsonPayload(serverName, payload, source) {
|
|
40117
40103
|
try {
|
|
@@ -42714,7 +42700,7 @@ async function shutdownOAuth(runtime = legacyRuntime) {
|
|
|
42714
42700
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/mcp-bearer-store.ts
|
|
42715
42701
|
import { createHash as createHash3 } from "crypto";
|
|
42716
42702
|
import { createRequire as createRequire2 } from "module";
|
|
42717
|
-
import { dirname as dirname10, join as
|
|
42703
|
+
import { dirname as dirname10, join as join17 } from "path";
|
|
42718
42704
|
var require3 = createRequire2(import.meta.url);
|
|
42719
42705
|
var BEARER_SECRET_SERVICE = "pi-mcp-adapter.bearer";
|
|
42720
42706
|
var TEST_AUTH_STORE_ENV2 = "PI_MCP_ADAPTER_TEST_AUTH_STORE";
|
|
@@ -42816,7 +42802,7 @@ function loadKeyringNativeBindingFallback2(keyringRequire, platform3, arch2) {
|
|
|
42816
42802
|
for (const target of targets) {
|
|
42817
42803
|
try {
|
|
42818
42804
|
const packageJsonPath = keyringRequire.resolve(`${target.packageName}/package.json`);
|
|
42819
|
-
return keyringRequire(
|
|
42805
|
+
return keyringRequire(join17(dirname10(packageJsonPath), target.bindingFile));
|
|
42820
42806
|
} catch (error) {
|
|
42821
42807
|
lastError = error;
|
|
42822
42808
|
}
|
|
@@ -47283,7 +47269,7 @@ async function openMcpAuthPanel(state, pi, ctx, configOverridePath) {
|
|
|
47283
47269
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/tool-registrar.ts
|
|
47284
47270
|
import { mkdtempSync, rmSync as rmSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
47285
47271
|
import { tmpdir } from "os";
|
|
47286
|
-
import { join as
|
|
47272
|
+
import { join as join18 } from "path";
|
|
47287
47273
|
var MAX_BINARY_RESOURCE_BYTES = 10 * 1024 * 1024;
|
|
47288
47274
|
var MAX_SESSION_RESOURCE_BYTES = 100 * 1024 * 1024;
|
|
47289
47275
|
var MAX_SESSION_RESOURCE_FILES = 1e4;
|
|
@@ -47390,11 +47376,11 @@ function materializeBinaryResource(resource, scope) {
|
|
|
47390
47376
|
return omitBinaryResource(resource, "session resource limit reached");
|
|
47391
47377
|
}
|
|
47392
47378
|
try {
|
|
47393
|
-
session.directory ??= mkdtempSync(
|
|
47379
|
+
session.directory ??= mkdtempSync(join18(tmpdir(), "pi-mcp-resource-"));
|
|
47394
47380
|
} catch {
|
|
47395
47381
|
return omitBinaryResource(resource, "could not be saved");
|
|
47396
47382
|
}
|
|
47397
|
-
const filePath =
|
|
47383
|
+
const filePath = join18(session.directory, `resource-${++session.sequence}.bin`);
|
|
47398
47384
|
session.bytes += decodedBytes;
|
|
47399
47385
|
session.files += 1;
|
|
47400
47386
|
try {
|
|
@@ -47487,7 +47473,7 @@ function stringifyStructuredContent(value) {
|
|
|
47487
47473
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
47488
47474
|
import { mkdtemp, rm as rm3, writeFile as writeFile7 } from "fs/promises";
|
|
47489
47475
|
import { tmpdir as tmpdir2 } from "os";
|
|
47490
|
-
import { dirname as dirname13, join as
|
|
47476
|
+
import { dirname as dirname13, join as join19 } from "path";
|
|
47491
47477
|
var DEFAULT_MCP_OUTPUT_MAX_BYTES = 50 * 1024;
|
|
47492
47478
|
var DEFAULT_MCP_OUTPUT_MAX_LINES = 2e3;
|
|
47493
47479
|
var DEFAULT_MCP_DETAILS_MAX_BYTES = 16 * 1024;
|
|
@@ -47795,8 +47781,8 @@ function serializedObjectEntryBytes(key, value, hasPrevious) {
|
|
|
47795
47781
|
}
|
|
47796
47782
|
async function saveArtifact(kind, text) {
|
|
47797
47783
|
try {
|
|
47798
|
-
const dir = await mkdtemp(
|
|
47799
|
-
const path7 =
|
|
47784
|
+
const dir = await mkdtemp(join19(tmpdir2(), "pi-mcp-output-"));
|
|
47785
|
+
const path7 = join19(dir, `${kind}-${randomBytes3(4).toString("hex")}.txt`);
|
|
47800
47786
|
await writeFile7(path7, text, { encoding: "utf8", mode: 384 });
|
|
47801
47787
|
return { path: path7 };
|
|
47802
47788
|
} catch (error) {
|
|
@@ -49443,7 +49429,7 @@ function sendText(res, status, text) {
|
|
|
49443
49429
|
// ../node_modules/.bun/pi-mcp-adapter@2.32.1+04b0d7b0bc944965/node_modules/pi-mcp-adapter/glimpse-ui.ts
|
|
49444
49430
|
import { existsSync as existsSync13 } from "fs";
|
|
49445
49431
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
49446
|
-
import { join as
|
|
49432
|
+
import { join as join20, dirname as dirname14 } from "path";
|
|
49447
49433
|
import { platform as platform2 } from "os";
|
|
49448
49434
|
import { createRequire as createRequire3 } from "module";
|
|
49449
49435
|
var glimpseAvailable = null;
|
|
@@ -49465,20 +49451,20 @@ function getGlimpseBinaryPath() {
|
|
|
49465
49451
|
try {
|
|
49466
49452
|
const require6 = createRequire3(import.meta.url);
|
|
49467
49453
|
const glimpseuiPath = require6.resolve("glimpseui");
|
|
49468
|
-
const binaryPath =
|
|
49454
|
+
const binaryPath = join20(dirname14(glimpseuiPath), "glimpse");
|
|
49469
49455
|
if (existsSync13(binaryPath)) return binaryPath;
|
|
49470
49456
|
} catch {
|
|
49471
49457
|
}
|
|
49472
49458
|
try {
|
|
49473
49459
|
const globalRoot = execFileSync2("npm", ["root", "-g"], { encoding: "utf-8" }).trim();
|
|
49474
|
-
const binaryPath =
|
|
49460
|
+
const binaryPath = join20(globalRoot, "glimpseui", "src", "glimpse");
|
|
49475
49461
|
if (existsSync13(binaryPath)) return binaryPath;
|
|
49476
49462
|
} catch {
|
|
49477
49463
|
}
|
|
49478
49464
|
return null;
|
|
49479
49465
|
}
|
|
49480
49466
|
async function openGlimpseWindow(html, options) {
|
|
49481
|
-
const modulePath = resolvedBinaryPath ?
|
|
49467
|
+
const modulePath = resolvedBinaryPath ? join20(dirname14(resolvedBinaryPath), "glimpse.mjs") : "glimpseui";
|
|
49482
49468
|
const glimpse = await import(modulePath);
|
|
49483
49469
|
let active = true;
|
|
49484
49470
|
const win = glimpse.open(html, {
|
|
@@ -57392,7 +57378,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
57392
57378
|
modelRuntime = null;
|
|
57393
57379
|
constructor(options) {
|
|
57394
57380
|
super(options);
|
|
57395
|
-
this.historyFilePath = options.historyFilePath ??
|
|
57381
|
+
this.historyFilePath = options.historyFilePath ?? join21(PI_HISTORY_DIR, `${Date.now()}.jsonl`);
|
|
57396
57382
|
this.historyFile = new CodexHistoryFile(this.historyFilePath);
|
|
57397
57383
|
this.initializeManager(this.processMessageInternal.bind(this));
|
|
57398
57384
|
}
|
|
@@ -57551,7 +57537,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
57551
57537
|
}
|
|
57552
57538
|
const resourceLoader = new DefaultResourceLoader({
|
|
57553
57539
|
cwd: this.workingDirectory,
|
|
57554
|
-
agentDir:
|
|
57540
|
+
agentDir: join21(ENGINE_ENV.HOME_DIR, ".pi", "agent"),
|
|
57555
57541
|
extensionFactories,
|
|
57556
57542
|
appendSystemPrompt: [instructions]
|
|
57557
57543
|
});
|
|
@@ -57632,7 +57618,7 @@ import {
|
|
|
57632
57618
|
unlink
|
|
57633
57619
|
} from "fs/promises";
|
|
57634
57620
|
import { existsSync as existsSync14, readFileSync as readFileSync5, readdirSync as readdirSync2 } from "fs";
|
|
57635
|
-
import { join as
|
|
57621
|
+
import { join as join22 } from "path";
|
|
57636
57622
|
var MAX_FAILED_RECORDS = 500;
|
|
57637
57623
|
var FLUSH_DEBOUNCE_MS = 15e3;
|
|
57638
57624
|
var MAX_UPLOADED_SEGMENTS = 50;
|
|
@@ -57644,7 +57630,7 @@ var AnalyticsRecordBuffer = class {
|
|
|
57644
57630
|
options.storageName,
|
|
57645
57631
|
...options.legacyStorageNames ?? []
|
|
57646
57632
|
];
|
|
57647
|
-
this.liveFile =
|
|
57633
|
+
this.liveFile = join22(ENGINE_DIR, `${options.storageName}.jsonl`);
|
|
57648
57634
|
this.segmentFilePatterns = this.storageNames.map(
|
|
57649
57635
|
(storageName) => new RegExp(`^${storageName}\\.(\\d+)\\.jsonl$`)
|
|
57650
57636
|
);
|
|
@@ -57667,7 +57653,7 @@ var AnalyticsRecordBuffer = class {
|
|
|
57667
57653
|
if (this.recordIds.has(recordId)) return;
|
|
57668
57654
|
this.recordIds.add(recordId);
|
|
57669
57655
|
}
|
|
57670
|
-
const pending = mkdir15(
|
|
57656
|
+
const pending = mkdir15(ENGINE_DIR, { recursive: true }).then(() => appendFile4(this.liveFile, `${JSON.stringify(record3)}
|
|
57671
57657
|
`, "utf-8")).catch((error) => {
|
|
57672
57658
|
console.error(
|
|
57673
57659
|
`[${this.options.storageName}] Append failed, will retry on flush:`,
|
|
@@ -57679,10 +57665,10 @@ var AnalyticsRecordBuffer = class {
|
|
|
57679
57665
|
void pending.finally(() => this.pendingAppends.delete(pending));
|
|
57680
57666
|
}
|
|
57681
57667
|
readStoredRecords() {
|
|
57682
|
-
if (!existsSync14(
|
|
57683
|
-
return readdirSync2(
|
|
57668
|
+
if (!existsSync14(ENGINE_DIR)) return [];
|
|
57669
|
+
return readdirSync2(ENGINE_DIR, { withFileTypes: true }).filter((entry) => entry.isFile() && this.storageNames.some(
|
|
57684
57670
|
(storageName) => entry.name === `${storageName}.jsonl` || entry.name.startsWith(`${storageName}.`) && (entry.name.endsWith(".jsonl") || entry.name.endsWith(`.jsonl${UPLOADED_SUFFIX}`))
|
|
57685
|
-
)).map(({ name }) => name).sort().flatMap((name) => this.parseRecords(readFileSync5(
|
|
57671
|
+
)).map(({ name }) => name).sort().flatMap((name) => this.parseRecords(readFileSync5(join22(ENGINE_DIR, name), "utf-8"))).map((record3) => {
|
|
57686
57672
|
const recordId = this.options.getRecordId?.(record3);
|
|
57687
57673
|
if (recordId) this.recordIds.add(recordId);
|
|
57688
57674
|
return record3;
|
|
@@ -57717,18 +57703,18 @@ var AnalyticsRecordBuffer = class {
|
|
|
57717
57703
|
}
|
|
57718
57704
|
for (const storageName of this.storageNames) {
|
|
57719
57705
|
await rename2(
|
|
57720
|
-
|
|
57721
|
-
|
|
57706
|
+
join22(ENGINE_DIR, `${storageName}.jsonl`),
|
|
57707
|
+
join22(ENGINE_DIR, `${storageName}.${Date.now()}.jsonl`)
|
|
57722
57708
|
).catch(() => {
|
|
57723
57709
|
});
|
|
57724
57710
|
}
|
|
57725
|
-
const entries = await readdir5(
|
|
57711
|
+
const entries = await readdir5(ENGINE_DIR).catch(() => []);
|
|
57726
57712
|
let flushed = 0;
|
|
57727
57713
|
let failed = 0;
|
|
57728
57714
|
for (const entry of entries) {
|
|
57729
57715
|
if (!this.segmentFilePatterns.some((pattern) => pattern.test(entry))) continue;
|
|
57730
57716
|
try {
|
|
57731
|
-
await this.uploadSegment(
|
|
57717
|
+
await this.uploadSegment(join22(ENGINE_DIR, entry));
|
|
57732
57718
|
flushed++;
|
|
57733
57719
|
} catch (error) {
|
|
57734
57720
|
failed++;
|
|
@@ -57757,7 +57743,7 @@ var AnalyticsRecordBuffer = class {
|
|
|
57757
57743
|
(storageName) => entry.startsWith(`${storageName}.`)
|
|
57758
57744
|
) && entry.endsWith(UPLOADED_SUFFIX)).sort();
|
|
57759
57745
|
for (const entry of uploaded.slice(0, -MAX_UPLOADED_SEGMENTS)) {
|
|
57760
|
-
await unlink(
|
|
57746
|
+
await unlink(join22(ENGINE_DIR, entry)).catch(() => {
|
|
57761
57747
|
});
|
|
57762
57748
|
}
|
|
57763
57749
|
}
|
|
@@ -58567,8 +58553,8 @@ var keepAliveService = new KeepAliveService();
|
|
|
58567
58553
|
|
|
58568
58554
|
// src/services/canvas-service.ts
|
|
58569
58555
|
import { readdir as readdir6, readFile as readFile14, stat as stat3 } from "fs/promises";
|
|
58570
|
-
import { homedir as
|
|
58571
|
-
import { join as
|
|
58556
|
+
import { homedir as homedir8 } from "os";
|
|
58557
|
+
import { join as join23 } from "path";
|
|
58572
58558
|
|
|
58573
58559
|
// src/utils/contained-file.ts
|
|
58574
58560
|
import { realpath, stat as stat2 } from "fs/promises";
|
|
@@ -58610,15 +58596,15 @@ async function writeRevisionedTextFile(filePath, content, expectedRevision) {
|
|
|
58610
58596
|
|
|
58611
58597
|
// src/services/canvas-service.ts
|
|
58612
58598
|
var GLOBAL_CANVAS_DIRECTORIES = [
|
|
58613
|
-
|
|
58614
|
-
|
|
58615
|
-
|
|
58599
|
+
join23(homedir8(), ".claude", "plans"),
|
|
58600
|
+
join23(process.env.XDG_DATA_HOME ?? join23(homedir8(), ".local", "share"), "opencode", "plans"),
|
|
58601
|
+
join23(homedir8(), ".replicas", "canvas")
|
|
58616
58602
|
];
|
|
58617
58603
|
async function canvasDirectories() {
|
|
58618
58604
|
const repositories = await gitService.listRepositories().catch(() => []);
|
|
58619
58605
|
return [
|
|
58620
58606
|
...GLOBAL_CANVAS_DIRECTORIES,
|
|
58621
|
-
...repositories.map((repository) =>
|
|
58607
|
+
...repositories.map((repository) => join23(repository.path, ".opencode", "plans"))
|
|
58622
58608
|
];
|
|
58623
58609
|
}
|
|
58624
58610
|
var CanvasService = class {
|
|
@@ -58643,7 +58629,7 @@ var CanvasService = class {
|
|
|
58643
58629
|
for (const entry of entries) {
|
|
58644
58630
|
if (entry.name.startsWith(".")) continue;
|
|
58645
58631
|
const filename = current.relativePath ? `${current.relativePath}/${entry.name}` : entry.name;
|
|
58646
|
-
const filePath =
|
|
58632
|
+
const filePath = join23(current.directory, entry.name);
|
|
58647
58633
|
if (entry.isDirectory()) {
|
|
58648
58634
|
pending.push({ directory: filePath, relativePath: filename });
|
|
58649
58635
|
continue;
|
|
@@ -58668,7 +58654,7 @@ var CanvasService = class {
|
|
|
58668
58654
|
if (!safe) return null;
|
|
58669
58655
|
const { kind, mimeType } = classifyCanvasFilename(safe);
|
|
58670
58656
|
for (const directory of await this.directories()) {
|
|
58671
|
-
const filePath =
|
|
58657
|
+
const filePath = join23(directory, safe);
|
|
58672
58658
|
let sizeBytes = 0;
|
|
58673
58659
|
let updatedAt = "";
|
|
58674
58660
|
try {
|
|
@@ -58852,13 +58838,13 @@ async function reconcileCanvasItems(filenames) {
|
|
|
58852
58838
|
import { createReadStream as createReadStream3 } from "fs";
|
|
58853
58839
|
import { createHash as createHash7 } from "crypto";
|
|
58854
58840
|
import { readFile as readFile15, readdir as readdir7, stat as stat4 } from "fs/promises";
|
|
58855
|
-
import { basename as basename3, join as
|
|
58841
|
+
import { basename as basename3, join as join25 } from "path";
|
|
58856
58842
|
|
|
58857
58843
|
// src/services/chat/chat-senders.ts
|
|
58858
|
-
import { join as
|
|
58859
|
-
var CHAT_SENDERS_DIR =
|
|
58844
|
+
import { join as join24 } from "path";
|
|
58845
|
+
var CHAT_SENDERS_DIR = join24(ENGINE_DIR, "chat-senders");
|
|
58860
58846
|
function chatMessageSendersFilePath(chatId) {
|
|
58861
|
-
return
|
|
58847
|
+
return join24(CHAT_SENDERS_DIR, `${chatId}.jsonl`);
|
|
58862
58848
|
}
|
|
58863
58849
|
function parseChatMessageSendersJsonl(content) {
|
|
58864
58850
|
return content.split("\n").flatMap((line) => {
|
|
@@ -58945,7 +58931,7 @@ async function flushAllChatTranscripts(chatsById = /* @__PURE__ */ new Map(), ca
|
|
|
58945
58931
|
const chat = chatsById.get(chatId);
|
|
58946
58932
|
if (!shouldFlushChatTranscript(dir, chat, chatsById, Boolean(capture))) continue;
|
|
58947
58933
|
tasks.push(
|
|
58948
|
-
uploadChatTranscript(chatId,
|
|
58934
|
+
uploadChatTranscript(chatId, join25(dir, entry), chat, capture).then(async (artifact) => {
|
|
58949
58935
|
flushed++;
|
|
58950
58936
|
if (artifact && capture) revisions.push(artifact);
|
|
58951
58937
|
await onUploaded?.(chatId, artifact).catch((err) => {
|
|
@@ -59073,7 +59059,7 @@ async function flushRepoState() {
|
|
|
59073
59059
|
// src/services/upload-engine-logs.ts
|
|
59074
59060
|
import { createReadStream as createReadStream4 } from "fs";
|
|
59075
59061
|
import { readdir as readdir8, stat as stat5 } from "fs/promises";
|
|
59076
|
-
import { join as
|
|
59062
|
+
import { join as join26 } from "path";
|
|
59077
59063
|
var MAX_ENGINE_LOG_FLUSH_SESSIONS = 10;
|
|
59078
59064
|
var MAX_ENGINE_LOG_FLUSH_BYTES = 5 * 1024 * 1024;
|
|
59079
59065
|
var ENGINE_LOG_FLUSH_TIMEOUT_MS = 2e4;
|
|
@@ -59102,7 +59088,7 @@ async function flushAllEngineLogs() {
|
|
|
59102
59088
|
const candidates = (await Promise.all(filenames.slice(0, MAX_ENGINE_LOG_FLUSH_SESSIONS).map(async (filename) => {
|
|
59103
59089
|
try {
|
|
59104
59090
|
const sessionId = filename.slice(0, -".log".length);
|
|
59105
|
-
const filePath =
|
|
59091
|
+
const filePath = join26(LOG_DIR, filename);
|
|
59106
59092
|
const fileStat = await runBeforeDeadline(() => stat5(filePath), deadline);
|
|
59107
59093
|
if (!fileStat.isFile()) {
|
|
59108
59094
|
skipped++;
|
|
@@ -59200,7 +59186,7 @@ async function uploadEngineLog(input, timeoutMs) {
|
|
|
59200
59186
|
// src/services/chat/fork-handoff.ts
|
|
59201
59187
|
import { createHash as createHash8 } from "crypto";
|
|
59202
59188
|
import { mkdir as mkdir16, open as open3, writeFile as writeFile8 } from "fs/promises";
|
|
59203
|
-
import { join as
|
|
59189
|
+
import { join as join27 } from "path";
|
|
59204
59190
|
var EXCERPT_MAX_CHARS = 24e3;
|
|
59205
59191
|
var MAX_SANITIZED_SOURCE_BYTES = 32 * 1024 * 1024;
|
|
59206
59192
|
function unansweredRequest(blocks) {
|
|
@@ -59248,7 +59234,7 @@ function unseenTurnsExcerpt(seenHashes, blocks) {
|
|
|
59248
59234
|
${excerpt}` : excerpt;
|
|
59249
59235
|
}
|
|
59250
59236
|
async function buildForkHandoff(input) {
|
|
59251
|
-
const rawHistoryPath =
|
|
59237
|
+
const rawHistoryPath = join27(HISTORY_DIR_BY_PROVIDER[input.sourceProvider], `${input.sourceChatId}.jsonl`);
|
|
59252
59238
|
const { content, truncated: sourceTruncated } = await readHistoryTail(rawHistoryPath, MAX_SANITIZED_SOURCE_BYTES);
|
|
59253
59239
|
let blocks = canonicalizeChatTranscriptBlocks(content, input.sourceProvider, input.senders);
|
|
59254
59240
|
if (input.turnLimit !== void 0) {
|
|
@@ -59256,9 +59242,9 @@ async function buildForkHandoff(input) {
|
|
|
59256
59242
|
const start = blocks.findLastIndex((block) => block.startsWith("## User") && ++turns === input.turnLimit);
|
|
59257
59243
|
blocks = blocks.slice(Math.max(0, start));
|
|
59258
59244
|
}
|
|
59259
|
-
const forkDir =
|
|
59245
|
+
const forkDir = join27(FORKS_DIR, input.targetChatId);
|
|
59260
59246
|
await mkdir16(forkDir, { recursive: true });
|
|
59261
|
-
const transcriptPath =
|
|
59247
|
+
const transcriptPath = join27(forkDir, "source-transcript.md");
|
|
59262
59248
|
const header = sourceTruncated ? `_This file was generated from only the most recent ${MAX_SANITIZED_SOURCE_BYTES / 1024 / 1024} MB of the source chat.${input.turnLimit === void 0 ? ` The complete raw event log is at ${rawHistoryPath}; grep it for anything earlier.` : ""}_
|
|
59263
59249
|
|
|
59264
59250
|
` : "";
|
|
@@ -59418,7 +59404,7 @@ var ChatService = class {
|
|
|
59418
59404
|
persistPromise = null;
|
|
59419
59405
|
persistQueued = false;
|
|
59420
59406
|
async initialize() {
|
|
59421
|
-
await mkdir17(
|
|
59407
|
+
await mkdir17(ENGINE_DIR, { recursive: true });
|
|
59422
59408
|
await mkdir17(CLAUDE_HISTORY_DIR, { recursive: true });
|
|
59423
59409
|
await mkdir17(CODEX_HISTORY_DIR, { recursive: true });
|
|
59424
59410
|
await mkdir17(CURSOR_HISTORY_DIR, { recursive: true });
|
|
@@ -60070,7 +60056,7 @@ var ChatService = class {
|
|
|
60070
60056
|
`${historyPath}.pages.index.json`
|
|
60071
60057
|
].map((path7) => rm4(path7, { force: true })));
|
|
60072
60058
|
await rm4(chatMessageSendersFilePath(persisted.id), { force: true });
|
|
60073
|
-
await rm4(
|
|
60059
|
+
await rm4(join28(FORKS_DIR, persisted.id), { recursive: true, force: true });
|
|
60074
60060
|
}
|
|
60075
60061
|
/** Resolves once the target chat exists; the handoff and its first turn run in the background. */
|
|
60076
60062
|
async forkChat(sourceChatId, request, trigger = "manual", reason) {
|
|
@@ -60272,7 +60258,7 @@ var ChatService = class {
|
|
|
60272
60258
|
};
|
|
60273
60259
|
}
|
|
60274
60260
|
historyPath(persisted) {
|
|
60275
|
-
return
|
|
60261
|
+
return join28(HISTORY_DIR_BY_PROVIDER[persisted.provider], `${persisted.id}.jsonl`);
|
|
60276
60262
|
}
|
|
60277
60263
|
async recordUploadedHistory(chatId, artifact) {
|
|
60278
60264
|
const chat = this.getRuntimeChat(chatId);
|
|
@@ -60391,7 +60377,7 @@ var ChatService = class {
|
|
|
60391
60377
|
persisted.parentChatId = null;
|
|
60392
60378
|
}
|
|
60393
60379
|
const baseProvider = persisted.provider;
|
|
60394
|
-
const historyFilePath =
|
|
60380
|
+
const historyFilePath = join28(HISTORY_DIR_BY_PROVIDER[persisted.provider], `${persisted.id}.jsonl`);
|
|
60395
60381
|
const managerOptions = {
|
|
60396
60382
|
provider: baseProvider,
|
|
60397
60383
|
workingDirectory: this.workingDirectory,
|
|
@@ -60869,14 +60855,14 @@ var ChatService = class {
|
|
|
60869
60855
|
// src/services/repo-file-service.ts
|
|
60870
60856
|
import { execFile as execFile7 } from "child_process";
|
|
60871
60857
|
import { readFile as readFile17 } from "fs/promises";
|
|
60872
|
-
import { homedir as
|
|
60873
|
-
import { extname as extname3, join as
|
|
60858
|
+
import { homedir as homedir9 } from "os";
|
|
60859
|
+
import { extname as extname3, join as join30 } from "path";
|
|
60874
60860
|
|
|
60875
60861
|
// src/services/language-server-service.ts
|
|
60876
60862
|
import { spawn as spawn4 } from "child_process";
|
|
60877
60863
|
import { existsSync as existsSync15, readFileSync as readFileSync6 } from "fs";
|
|
60878
60864
|
import { createRequire as createRequire5 } from "module";
|
|
60879
|
-
import { delimiter as delimiter2, dirname as dirname16, join as
|
|
60865
|
+
import { delimiter as delimiter2, dirname as dirname16, join as join29, relative as relative2 } from "path";
|
|
60880
60866
|
import { setTimeout as setTimeout3 } from "timers/promises";
|
|
60881
60867
|
import { fileURLToPath as fileURLToPath5, pathToFileURL } from "url";
|
|
60882
60868
|
import { createMessageConnection, StreamMessageReader, StreamMessageWriter } from "vscode-jsonrpc/node.js";
|
|
@@ -60995,7 +60981,7 @@ var LanguageServerService = class {
|
|
|
60995
60981
|
if (config.package && config.bin) command = process.execPath;
|
|
60996
60982
|
else if (config.command) {
|
|
60997
60983
|
const commandName = config.command;
|
|
60998
|
-
command = process.env.PATH?.split(delimiter2).map((directory) =>
|
|
60984
|
+
command = process.env.PATH?.split(delimiter2).map((directory) => join29(directory, commandName)).find(existsSync15);
|
|
60999
60985
|
}
|
|
61000
60986
|
const args = config.package && config.bin ? [packageBin(config.package, config.bin), ...config.args] : config.args;
|
|
61001
60987
|
if (!command) return null;
|
|
@@ -61088,7 +61074,7 @@ function execGitAsync(args, cwd, timeoutMs) {
|
|
|
61088
61074
|
});
|
|
61089
61075
|
}
|
|
61090
61076
|
var RepoFileService = class {
|
|
61091
|
-
constructor(gitService2, homeDir =
|
|
61077
|
+
constructor(gitService2, homeDir = homedir9()) {
|
|
61092
61078
|
this.homeDir = homeDir;
|
|
61093
61079
|
this.gitService = gitService2;
|
|
61094
61080
|
}
|
|
@@ -61282,7 +61268,7 @@ var RepoFileService = class {
|
|
|
61282
61268
|
return await resolveContainedFile(repo.path, filePath);
|
|
61283
61269
|
}
|
|
61284
61270
|
async resolveSkillFile(filePath) {
|
|
61285
|
-
const skillRoots = SANDBOX_SKILL_DIRS.map((dir) =>
|
|
61271
|
+
const skillRoots = SANDBOX_SKILL_DIRS.map((dir) => join30(this.homeDir, dir));
|
|
61286
61272
|
if (!skillRoots.some((root) => filePath.startsWith(`${root}/`))) return null;
|
|
61287
61273
|
const repos = await this.gitService.listRepositories();
|
|
61288
61274
|
for (const root of [...skillRoots, ...repos.map((repo) => repo.path)]) {
|
|
@@ -61356,20 +61342,20 @@ var RepoFileService = class {
|
|
|
61356
61342
|
import { Hono } from "hono";
|
|
61357
61343
|
import { z as z4 } from "zod";
|
|
61358
61344
|
import { readdir as readdir10, stat as stat7, readFile as readFile20 } from "fs/promises";
|
|
61359
|
-
import { join as
|
|
61345
|
+
import { join as join33, resolve as resolve5 } from "path";
|
|
61360
61346
|
|
|
61361
61347
|
// src/services/warm-hooks-service.ts
|
|
61362
61348
|
import { spawn as spawn5 } from "child_process";
|
|
61363
61349
|
import { readFile as readFile19 } from "fs/promises";
|
|
61364
61350
|
import { existsSync as existsSync16 } from "fs";
|
|
61365
|
-
import { join as
|
|
61351
|
+
import { join as join32 } from "path";
|
|
61366
61352
|
|
|
61367
61353
|
// src/services/warm-hook-logs-service.ts
|
|
61368
61354
|
import { mkdir as mkdir18, readFile as readFile18, writeFile as writeFile9, readdir as readdir9, appendFile as appendFile6, unlink as unlink2 } from "fs/promises";
|
|
61369
|
-
import { homedir as
|
|
61370
|
-
import { join as
|
|
61371
|
-
var LOGS_DIR2 =
|
|
61372
|
-
var CURRENT_RUN_LOG =
|
|
61355
|
+
import { homedir as homedir10 } from "os";
|
|
61356
|
+
import { join as join31 } from "path";
|
|
61357
|
+
var LOGS_DIR2 = join31(homedir10(), ".replicas", "warm-hook-logs");
|
|
61358
|
+
var CURRENT_RUN_LOG = join31(LOGS_DIR2, "current-run.log");
|
|
61373
61359
|
function withPreview2(stored) {
|
|
61374
61360
|
const preview = buildHookOutputPreview(stored.output);
|
|
61375
61361
|
return { ...stored, ...preview };
|
|
@@ -61385,7 +61371,7 @@ var WarmHookLogsService = class {
|
|
|
61385
61371
|
hookName: "environment",
|
|
61386
61372
|
...entry
|
|
61387
61373
|
};
|
|
61388
|
-
await writeFile9(
|
|
61374
|
+
await writeFile9(join31(LOGS_DIR2, ENVIRONMENT_HOOK_LOG_FILENAME), `${JSON.stringify(log, null, 2)}
|
|
61389
61375
|
`, "utf-8");
|
|
61390
61376
|
}
|
|
61391
61377
|
async saveRepoHookLog(repoName, entry) {
|
|
@@ -61395,7 +61381,7 @@ var WarmHookLogsService = class {
|
|
|
61395
61381
|
hookName: repoName,
|
|
61396
61382
|
...entry
|
|
61397
61383
|
};
|
|
61398
|
-
await writeFile9(
|
|
61384
|
+
await writeFile9(join31(LOGS_DIR2, repoHookLogFilename(repoName)), `${JSON.stringify(log, null, 2)}
|
|
61399
61385
|
`, "utf-8");
|
|
61400
61386
|
}
|
|
61401
61387
|
async getAllLogs() {
|
|
@@ -61414,7 +61400,7 @@ var WarmHookLogsService = class {
|
|
|
61414
61400
|
continue;
|
|
61415
61401
|
}
|
|
61416
61402
|
try {
|
|
61417
|
-
const raw = await readFile18(
|
|
61403
|
+
const raw = await readFile18(join31(LOGS_DIR2, file), "utf-8");
|
|
61418
61404
|
const stored = JSON.parse(raw);
|
|
61419
61405
|
if (stored.hookType !== "environment" && stored.hookType !== "repository") continue;
|
|
61420
61406
|
logs.push(withPreview2(stored));
|
|
@@ -61450,7 +61436,7 @@ var WarmHookLogsService = class {
|
|
|
61450
61436
|
async getFullOutput(hookType, hookName) {
|
|
61451
61437
|
const filename = hookType === "environment" ? ENVIRONMENT_HOOK_LOG_FILENAME : repoHookLogFilename(hookName);
|
|
61452
61438
|
try {
|
|
61453
|
-
const raw = await readFile18(
|
|
61439
|
+
const raw = await readFile18(join31(LOGS_DIR2, filename), "utf-8");
|
|
61454
61440
|
const stored = JSON.parse(raw);
|
|
61455
61441
|
if (stored.hookType !== hookType || stored.hookName !== hookName) {
|
|
61456
61442
|
return null;
|
|
@@ -61469,7 +61455,7 @@ var warmHookLogsService = new WarmHookLogsService();
|
|
|
61469
61455
|
// src/services/warm-hooks-service.ts
|
|
61470
61456
|
async function readRepoWarmHook(repoPath) {
|
|
61471
61457
|
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
61472
|
-
const configPath =
|
|
61458
|
+
const configPath = join32(repoPath, filename);
|
|
61473
61459
|
if (!existsSync16(configPath)) {
|
|
61474
61460
|
continue;
|
|
61475
61461
|
}
|
|
@@ -62832,7 +62818,7 @@ data: ${JSON.stringify("Terminal session not found")}
|
|
|
62832
62818
|
const logFiles = files.filter((f) => f.endsWith(".log"));
|
|
62833
62819
|
const sessions = await Promise.all(
|
|
62834
62820
|
logFiles.map(async (filename) => {
|
|
62835
|
-
const filePath =
|
|
62821
|
+
const filePath = join33(LOG_DIR, filename);
|
|
62836
62822
|
const fileStat = await stat7(filePath);
|
|
62837
62823
|
const sessionId = filename.replace(/\.log$/, "");
|
|
62838
62824
|
return {
|
|
@@ -63058,8 +63044,8 @@ async function installWorkspaceSdk() {
|
|
|
63058
63044
|
// src/services/git-push-tracker.ts
|
|
63059
63045
|
import { mkdir as mkdir20, rm as rm5 } from "fs/promises";
|
|
63060
63046
|
import { createServer as createServer2 } from "net";
|
|
63061
|
-
import { join as
|
|
63062
|
-
var SOCKET_PATH =
|
|
63047
|
+
import { join as join34 } from "path";
|
|
63048
|
+
var SOCKET_PATH = join34(ENGINE_DIR, "git-trace2.sock");
|
|
63063
63049
|
var MAX_LINE_LENGTH = 1024 * 1024;
|
|
63064
63050
|
var listening = null;
|
|
63065
63051
|
function startGitPushTracker() {
|
|
@@ -63069,7 +63055,7 @@ function startGitPushTracker() {
|
|
|
63069
63055
|
});
|
|
63070
63056
|
}
|
|
63071
63057
|
async function listen() {
|
|
63072
|
-
await mkdir20(
|
|
63058
|
+
await mkdir20(ENGINE_DIR, { recursive: true });
|
|
63073
63059
|
await rm5(SOCKET_PATH, { force: true });
|
|
63074
63060
|
const server3 = createServer2((socket) => {
|
|
63075
63061
|
let buffered = "";
|