replicas-engine 0.1.262 → 0.1.263
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/src/index.js +92 -64
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -286,7 +286,7 @@ var WORKSPACE_SIZES = ["small", "large"];
|
|
|
286
286
|
var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
|
|
287
287
|
|
|
288
288
|
// ../shared/src/e2b.ts
|
|
289
|
-
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-04-
|
|
289
|
+
var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-04-v5";
|
|
290
290
|
|
|
291
291
|
// ../shared/src/runtime-env.ts
|
|
292
292
|
function parsePosixEnvFile(content) {
|
|
@@ -2287,7 +2287,6 @@ var execFileAsync = promisify(execFile);
|
|
|
2287
2287
|
var SUBPROCESS_MAX_BUFFER = HOOK_EXEC_MAX_BUFFER_BYTES;
|
|
2288
2288
|
|
|
2289
2289
|
// src/managers/github-token-manager.ts
|
|
2290
|
-
import { promises as fs } from "fs";
|
|
2291
2290
|
import path from "path";
|
|
2292
2291
|
|
|
2293
2292
|
// src/engine-env.ts
|
|
@@ -2529,6 +2528,26 @@ var MonolithService = class {
|
|
|
2529
2528
|
};
|
|
2530
2529
|
var monolithService = new MonolithService();
|
|
2531
2530
|
|
|
2531
|
+
// src/utils/file.ts
|
|
2532
|
+
import { mkdir, rename, unlink, writeFile } from "fs/promises";
|
|
2533
|
+
import { dirname } from "path";
|
|
2534
|
+
async function atomicWriteFile(path4, data, options) {
|
|
2535
|
+
const tmpFile = `${path4}.${process.pid}.${Date.now()}.tmp`;
|
|
2536
|
+
try {
|
|
2537
|
+
await writeFile(tmpFile, data, { encoding: "utf-8", mode: options?.mode });
|
|
2538
|
+
await rename(tmpFile, path4);
|
|
2539
|
+
} catch (error) {
|
|
2540
|
+
await unlink(tmpFile).catch(() => void 0);
|
|
2541
|
+
throw error;
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
async function writeSecureCredentialFile(filePath, content, options) {
|
|
2545
|
+
if (options?.ensureParentDir) {
|
|
2546
|
+
await mkdir(dirname(filePath), { recursive: true, mode: 448 });
|
|
2547
|
+
}
|
|
2548
|
+
await atomicWriteFile(filePath, content, { mode: 384 });
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2532
2551
|
// src/managers/github-token-manager.ts
|
|
2533
2552
|
var GitHubTokenManager = class extends BaseRefreshManager {
|
|
2534
2553
|
constructor() {
|
|
@@ -2544,8 +2563,9 @@ var GitHubTokenManager = class extends BaseRefreshManager {
|
|
|
2544
2563
|
const data = await response.json();
|
|
2545
2564
|
await this.updateGitCredentials(data.token);
|
|
2546
2565
|
const ghToken = data.userToken?.token ?? data.token;
|
|
2566
|
+
const ghUsername = data.userToken?.username ?? "x-access-token";
|
|
2547
2567
|
ENGINE_ENV.GH_TOKEN = ghToken;
|
|
2548
|
-
|
|
2568
|
+
await this.updateGhHostsFile(ghToken, ghUsername);
|
|
2549
2569
|
if (data.userToken) {
|
|
2550
2570
|
console.log(`[GitHubTokenManager] Token refreshed with user token for PR attribution, installation token expires at ${data.expiresAt}, user token expires at ${data.userToken.expiresAt}`);
|
|
2551
2571
|
} else {
|
|
@@ -2553,22 +2573,35 @@ var GitHubTokenManager = class extends BaseRefreshManager {
|
|
|
2553
2573
|
}
|
|
2554
2574
|
}
|
|
2555
2575
|
async updateGitCredentials(token) {
|
|
2556
|
-
const
|
|
2557
|
-
const credentialsPath = path.join(workspaceHome, ".git-credentials");
|
|
2576
|
+
const credentialsPath = path.join(ENGINE_ENV.HOME_DIR, ".git-credentials");
|
|
2558
2577
|
const credentialsContent = `https://x-access-token:${token}@github.com
|
|
2559
2578
|
`;
|
|
2560
2579
|
try {
|
|
2561
|
-
await
|
|
2580
|
+
await writeSecureCredentialFile(credentialsPath, credentialsContent);
|
|
2562
2581
|
console.log(`[GitHubTokenManager] Updated ${credentialsPath}`);
|
|
2563
2582
|
} catch (error) {
|
|
2564
2583
|
console.error("[GitHubTokenManager] Failed to update git credentials:", error);
|
|
2565
2584
|
}
|
|
2566
2585
|
}
|
|
2586
|
+
async updateGhHostsFile(token, username) {
|
|
2587
|
+
const hostsPath = path.join(ENGINE_ENV.HOME_DIR, ".config", "gh", "hosts.yml");
|
|
2588
|
+
const content = `github.com:
|
|
2589
|
+
oauth_token: ${JSON.stringify(token)}
|
|
2590
|
+
user: ${JSON.stringify(username)}
|
|
2591
|
+
git_protocol: https
|
|
2592
|
+
`;
|
|
2593
|
+
try {
|
|
2594
|
+
await writeSecureCredentialFile(hostsPath, content, { ensureParentDir: true });
|
|
2595
|
+
console.log(`[GitHubTokenManager] Updated ${hostsPath}`);
|
|
2596
|
+
} catch (error) {
|
|
2597
|
+
console.error("[GitHubTokenManager] Failed to update gh hosts file:", error);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2567
2600
|
};
|
|
2568
2601
|
var githubTokenManager = new GitHubTokenManager();
|
|
2569
2602
|
|
|
2570
2603
|
// src/managers/claude-token-manager.ts
|
|
2571
|
-
import { promises as
|
|
2604
|
+
import { promises as fs } from "fs";
|
|
2572
2605
|
import path2 from "path";
|
|
2573
2606
|
|
|
2574
2607
|
// src/managers/auth-env-transition.ts
|
|
@@ -2661,9 +2694,7 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
|
|
|
2661
2694
|
});
|
|
2662
2695
|
}
|
|
2663
2696
|
async writeOauthCredentialsFile(credentials) {
|
|
2664
|
-
const
|
|
2665
|
-
const claudeDir = path2.join(workspaceHome, ".claude");
|
|
2666
|
-
const credentialsPath = path2.join(claudeDir, ".credentials.json");
|
|
2697
|
+
const credentialsPath = path2.join(ENGINE_ENV.HOME_DIR, ".claude", ".credentials.json");
|
|
2667
2698
|
const claudeCliConfig = {
|
|
2668
2699
|
claudeAiOauth: {
|
|
2669
2700
|
accessToken: credentials.accessToken,
|
|
@@ -2674,8 +2705,11 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
|
|
|
2674
2705
|
}
|
|
2675
2706
|
};
|
|
2676
2707
|
try {
|
|
2677
|
-
await
|
|
2678
|
-
|
|
2708
|
+
await writeSecureCredentialFile(
|
|
2709
|
+
credentialsPath,
|
|
2710
|
+
JSON.stringify(claudeCliConfig, null, 2),
|
|
2711
|
+
{ ensureParentDir: true }
|
|
2712
|
+
);
|
|
2679
2713
|
console.log(`[ClaudeTokenManager] Updated ${credentialsPath}`);
|
|
2680
2714
|
} catch (error) {
|
|
2681
2715
|
console.error("[ClaudeTokenManager] Failed to update credentials file:", error);
|
|
@@ -2684,7 +2718,7 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
|
|
|
2684
2718
|
async removeOauthCredentialsFile() {
|
|
2685
2719
|
const credentialsPath = path2.join(ENGINE_ENV.HOME_DIR, ".claude", ".credentials.json");
|
|
2686
2720
|
try {
|
|
2687
|
-
await
|
|
2721
|
+
await fs.unlink(credentialsPath);
|
|
2688
2722
|
} catch {
|
|
2689
2723
|
}
|
|
2690
2724
|
}
|
|
@@ -2692,7 +2726,7 @@ var ClaudeTokenManager = class extends BaseRefreshManager {
|
|
|
2692
2726
|
var claudeTokenManager = new ClaudeTokenManager();
|
|
2693
2727
|
|
|
2694
2728
|
// src/managers/codex-token-manager.ts
|
|
2695
|
-
import { promises as
|
|
2729
|
+
import { promises as fs2 } from "fs";
|
|
2696
2730
|
import path3 from "path";
|
|
2697
2731
|
var CodexTokenManager = class extends BaseRefreshManager {
|
|
2698
2732
|
constructor() {
|
|
@@ -2761,9 +2795,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
2761
2795
|
});
|
|
2762
2796
|
}
|
|
2763
2797
|
async writeOauthCredentialsFile(credentials) {
|
|
2764
|
-
const
|
|
2765
|
-
const codexDir = path3.join(workspaceHome, ".codex");
|
|
2766
|
-
const authPath = path3.join(codexDir, "auth.json");
|
|
2798
|
+
const authPath = path3.join(ENGINE_ENV.HOME_DIR, ".codex", "auth.json");
|
|
2767
2799
|
const codexAuthConfig = {
|
|
2768
2800
|
OPENAI_API_KEY: null,
|
|
2769
2801
|
tokens: {
|
|
@@ -2775,8 +2807,11 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
2775
2807
|
last_refresh: (/* @__PURE__ */ new Date()).toISOString()
|
|
2776
2808
|
};
|
|
2777
2809
|
try {
|
|
2778
|
-
await
|
|
2779
|
-
|
|
2810
|
+
await writeSecureCredentialFile(
|
|
2811
|
+
authPath,
|
|
2812
|
+
JSON.stringify(codexAuthConfig, null, 2),
|
|
2813
|
+
{ ensureParentDir: true }
|
|
2814
|
+
);
|
|
2780
2815
|
console.log(`[CodexTokenManager] Updated ${authPath}`);
|
|
2781
2816
|
} catch (error) {
|
|
2782
2817
|
console.error("[CodexTokenManager] Failed to update credentials file:", error);
|
|
@@ -2785,7 +2820,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
2785
2820
|
async removeOauthCredentialsFile() {
|
|
2786
2821
|
const authPath = path3.join(ENGINE_ENV.HOME_DIR, ".codex", "auth.json");
|
|
2787
2822
|
try {
|
|
2788
|
-
await
|
|
2823
|
+
await fs2.unlink(authPath);
|
|
2789
2824
|
} catch {
|
|
2790
2825
|
}
|
|
2791
2826
|
}
|
|
@@ -2799,24 +2834,11 @@ import { spawn } from "child_process";
|
|
|
2799
2834
|
import { join as join5 } from "path";
|
|
2800
2835
|
|
|
2801
2836
|
// src/utils/state.ts
|
|
2802
|
-
import { readFile, mkdir } from "fs/promises";
|
|
2837
|
+
import { readFile, mkdir as mkdir2 } from "fs/promises";
|
|
2803
2838
|
import { existsSync } from "fs";
|
|
2804
2839
|
import { join as join3 } from "path";
|
|
2805
2840
|
import { homedir as homedir3 } from "os";
|
|
2806
2841
|
|
|
2807
|
-
// src/utils/file.ts
|
|
2808
|
-
import { rename, unlink, writeFile } from "fs/promises";
|
|
2809
|
-
async function atomicWriteFile(path4, data) {
|
|
2810
|
-
const tmpFile = `${path4}.${process.pid}.${Date.now()}.tmp`;
|
|
2811
|
-
try {
|
|
2812
|
-
await writeFile(tmpFile, data, "utf-8");
|
|
2813
|
-
await rename(tmpFile, path4);
|
|
2814
|
-
} catch (error) {
|
|
2815
|
-
await unlink(tmpFile).catch(() => void 0);
|
|
2816
|
-
throw error;
|
|
2817
|
-
}
|
|
2818
|
-
}
|
|
2819
|
-
|
|
2820
2842
|
// src/utils/type-guards.ts
|
|
2821
2843
|
function isRecord4(value) {
|
|
2822
2844
|
return typeof value === "object" && value !== null;
|
|
@@ -2836,7 +2858,7 @@ function enqueueStateWrite(operation) {
|
|
|
2836
2858
|
}
|
|
2837
2859
|
async function updateEngineState(updater) {
|
|
2838
2860
|
await enqueueStateWrite(async () => {
|
|
2839
|
-
await
|
|
2861
|
+
await mkdir2(STATE_DIR, { recursive: true });
|
|
2840
2862
|
const currentState = await loadEngineState();
|
|
2841
2863
|
const nextState = updater(currentState);
|
|
2842
2864
|
await atomicWriteFile(STATE_FILE, JSON.stringify(nextState, null, 2));
|
|
@@ -3466,7 +3488,7 @@ var GitService = class {
|
|
|
3466
3488
|
var gitService = new GitService();
|
|
3467
3489
|
|
|
3468
3490
|
// src/utils/logger.ts
|
|
3469
|
-
import { appendFile, mkdir as
|
|
3491
|
+
import { appendFile, mkdir as mkdir3, writeFile as writeFile2 } from "fs/promises";
|
|
3470
3492
|
import { homedir as homedir4 } from "os";
|
|
3471
3493
|
import { join as join6 } from "path";
|
|
3472
3494
|
import { format } from "util";
|
|
@@ -3481,7 +3503,7 @@ var EngineLogger = class {
|
|
|
3481
3503
|
return this._sessionId;
|
|
3482
3504
|
}
|
|
3483
3505
|
async initialize() {
|
|
3484
|
-
await
|
|
3506
|
+
await mkdir3(LOG_DIR, { recursive: true });
|
|
3485
3507
|
this._sessionId = this.createSessionId();
|
|
3486
3508
|
this.filePath = join6(LOG_DIR, `${this._sessionId}.log`);
|
|
3487
3509
|
await writeFile2(this.filePath, `=== Replicas Engine Session ${this._sessionId} ===
|
|
@@ -3534,14 +3556,14 @@ var EngineLogger = class {
|
|
|
3534
3556
|
var engineLogger = new EngineLogger();
|
|
3535
3557
|
|
|
3536
3558
|
// src/services/replicas-config-service.ts
|
|
3537
|
-
import { readFile as readFile5, appendFile as appendFile2, writeFile as writeFile4, mkdir as
|
|
3559
|
+
import { readFile as readFile5, appendFile as appendFile2, writeFile as writeFile4, mkdir as mkdir6 } from "fs/promises";
|
|
3538
3560
|
import { existsSync as existsSync4 } from "fs";
|
|
3539
3561
|
import { join as join9 } from "path";
|
|
3540
3562
|
import { homedir as homedir7 } from "os";
|
|
3541
3563
|
import { spawn as spawn2 } from "child_process";
|
|
3542
3564
|
|
|
3543
3565
|
// src/services/environment-details-service.ts
|
|
3544
|
-
import { mkdir as
|
|
3566
|
+
import { mkdir as mkdir4, readFile as readFile3 } from "fs/promises";
|
|
3545
3567
|
import { existsSync as existsSync3 } from "fs";
|
|
3546
3568
|
import { homedir as homedir5 } from "os";
|
|
3547
3569
|
import { join as join7 } from "path";
|
|
@@ -3625,7 +3647,7 @@ async function readDetails() {
|
|
|
3625
3647
|
}
|
|
3626
3648
|
}
|
|
3627
3649
|
async function writeDetails(details) {
|
|
3628
|
-
await
|
|
3650
|
+
await mkdir4(REPLICAS_DIR, { recursive: true });
|
|
3629
3651
|
await atomicWriteFile(DETAILS_FILE, `${JSON.stringify(details, null, 2)}
|
|
3630
3652
|
`);
|
|
3631
3653
|
}
|
|
@@ -3711,7 +3733,7 @@ var EnvironmentDetailsService = class {
|
|
|
3711
3733
|
var environmentDetailsService = new EnvironmentDetailsService();
|
|
3712
3734
|
|
|
3713
3735
|
// src/services/start-hook-logs-service.ts
|
|
3714
|
-
import { mkdir as
|
|
3736
|
+
import { mkdir as mkdir5, readFile as readFile4, writeFile as writeFile3, readdir as readdir2 } from "fs/promises";
|
|
3715
3737
|
import { homedir as homedir6 } from "os";
|
|
3716
3738
|
import { join as join8 } from "path";
|
|
3717
3739
|
|
|
@@ -3757,7 +3779,7 @@ function normalizeStored(raw) {
|
|
|
3757
3779
|
}
|
|
3758
3780
|
var StartHookLogsService = class {
|
|
3759
3781
|
async ensureDir() {
|
|
3760
|
-
await
|
|
3782
|
+
await mkdir5(LOGS_DIR, { recursive: true });
|
|
3761
3783
|
}
|
|
3762
3784
|
async saveLog(hookType, hookName, entry) {
|
|
3763
3785
|
await this.ensureDir();
|
|
@@ -3905,7 +3927,7 @@ var ReplicasConfigService = class {
|
|
|
3905
3927
|
const logLine = `[${timestamp}] ${message}
|
|
3906
3928
|
`;
|
|
3907
3929
|
try {
|
|
3908
|
-
await
|
|
3930
|
+
await mkdir6(join9(homedir7(), ".replicas"), { recursive: true });
|
|
3909
3931
|
await appendFile2(START_HOOKS_LOG, logLine, "utf-8");
|
|
3910
3932
|
} catch (error) {
|
|
3911
3933
|
console.error("Failed to write to start hooks log:", error);
|
|
@@ -4040,7 +4062,7 @@ var ReplicasConfigService = class {
|
|
|
4040
4062
|
this.hooksCompleted = false;
|
|
4041
4063
|
this.hooksFailed = false;
|
|
4042
4064
|
try {
|
|
4043
|
-
await
|
|
4065
|
+
await mkdir6(join9(homedir7(), ".replicas"), { recursive: true });
|
|
4044
4066
|
await writeFile4(
|
|
4045
4067
|
START_HOOKS_LOG,
|
|
4046
4068
|
`=== Start Hooks Execution Log ===
|
|
@@ -4234,7 +4256,7 @@ ${startHookConfig.commands.join("\n")}`;
|
|
|
4234
4256
|
var replicasConfigService = new ReplicasConfigService();
|
|
4235
4257
|
|
|
4236
4258
|
// src/services/event-service.ts
|
|
4237
|
-
import { appendFile as appendFile3, mkdir as
|
|
4259
|
+
import { appendFile as appendFile3, mkdir as mkdir7 } from "fs/promises";
|
|
4238
4260
|
import { homedir as homedir8 } from "os";
|
|
4239
4261
|
import { join as join10 } from "path";
|
|
4240
4262
|
import { randomUUID } from "crypto";
|
|
@@ -4244,7 +4266,7 @@ var EventService = class {
|
|
|
4244
4266
|
subscribers = /* @__PURE__ */ new Map();
|
|
4245
4267
|
writeChain = Promise.resolve();
|
|
4246
4268
|
async initialize() {
|
|
4247
|
-
await
|
|
4269
|
+
await mkdir7(ENGINE_DIR, { recursive: true });
|
|
4248
4270
|
}
|
|
4249
4271
|
subscribe(subscriber) {
|
|
4250
4272
|
const id = randomUUID();
|
|
@@ -4274,11 +4296,11 @@ var EventService = class {
|
|
|
4274
4296
|
var eventService = new EventService();
|
|
4275
4297
|
|
|
4276
4298
|
// src/services/preview-service.ts
|
|
4277
|
-
import { mkdir as
|
|
4299
|
+
import { mkdir as mkdir8, readFile as readFile6 } from "fs/promises";
|
|
4278
4300
|
import { existsSync as existsSync5 } from "fs";
|
|
4279
4301
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
4280
4302
|
import { homedir as homedir9 } from "os";
|
|
4281
|
-
import { dirname, join as join11 } from "path";
|
|
4303
|
+
import { dirname as dirname2, join as join11 } from "path";
|
|
4282
4304
|
var PREVIEW_PORTS_FILE = join11(homedir9(), ".replicas", "preview-ports.json");
|
|
4283
4305
|
async function readPreviewsFile() {
|
|
4284
4306
|
try {
|
|
@@ -4292,8 +4314,8 @@ async function readPreviewsFile() {
|
|
|
4292
4314
|
}
|
|
4293
4315
|
}
|
|
4294
4316
|
async function writePreviewsFile(data) {
|
|
4295
|
-
const dir =
|
|
4296
|
-
await
|
|
4317
|
+
const dir = dirname2(PREVIEW_PORTS_FILE);
|
|
4318
|
+
await mkdir8(dir, { recursive: true });
|
|
4297
4319
|
await atomicWriteFile(PREVIEW_PORTS_FILE, `${JSON.stringify(data, null, 2)}
|
|
4298
4320
|
`);
|
|
4299
4321
|
}
|
|
@@ -4390,7 +4412,7 @@ async function registerDesktopPreview() {
|
|
|
4390
4412
|
|
|
4391
4413
|
// src/services/chat/chat-service.ts
|
|
4392
4414
|
import { existsSync as existsSync8 } from "fs";
|
|
4393
|
-
import { appendFile as appendFile5, copyFile, mkdir as
|
|
4415
|
+
import { appendFile as appendFile5, copyFile, mkdir as mkdir12, readFile as readFile9, rename as rename2, rm } from "fs/promises";
|
|
4394
4416
|
import { homedir as homedir13 } from "os";
|
|
4395
4417
|
import { join as join15 } from "path";
|
|
4396
4418
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
@@ -4401,7 +4423,7 @@ import {
|
|
|
4401
4423
|
} from "@anthropic-ai/claude-agent-sdk";
|
|
4402
4424
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
4403
4425
|
import { join as join13 } from "path";
|
|
4404
|
-
import { mkdir as
|
|
4426
|
+
import { mkdir as mkdir10, appendFile as appendFile4 } from "fs/promises";
|
|
4405
4427
|
import { homedir as homedir11 } from "os";
|
|
4406
4428
|
|
|
4407
4429
|
// src/utils/jsonl-reader.ts
|
|
@@ -4907,7 +4929,7 @@ function extractPlanFromCodexAspNotification(notification) {
|
|
|
4907
4929
|
|
|
4908
4930
|
// src/utils/image-utils.ts
|
|
4909
4931
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
4910
|
-
import { mkdir as
|
|
4932
|
+
import { mkdir as mkdir9, unlink as unlink2, writeFile as writeFile5 } from "fs/promises";
|
|
4911
4933
|
import { homedir as homedir10 } from "os";
|
|
4912
4934
|
import { join as join12 } from "path";
|
|
4913
4935
|
function isImageMediaType(value) {
|
|
@@ -4988,7 +5010,7 @@ async function normalizeImages(images) {
|
|
|
4988
5010
|
return normalized;
|
|
4989
5011
|
}
|
|
4990
5012
|
async function saveNormalizedImagesToTempFiles(images, tempImageDir = join12(homedir10(), ".replicas", "codex", "temp-images")) {
|
|
4991
|
-
await
|
|
5013
|
+
await mkdir9(tempImageDir, { recursive: true });
|
|
4992
5014
|
const tempPaths = [];
|
|
4993
5015
|
try {
|
|
4994
5016
|
for (const image of images) {
|
|
@@ -5320,6 +5342,9 @@ function buildClaudeAgentEnv(overrides) {
|
|
|
5320
5342
|
if (shouldStripAnthropicApiKey()) {
|
|
5321
5343
|
env.ANTHROPIC_API_KEY = void 0;
|
|
5322
5344
|
}
|
|
5345
|
+
env.GH_TOKEN = void 0;
|
|
5346
|
+
env.GITHUB_TOKEN = void 0;
|
|
5347
|
+
env.GH_CONFIG_DIR = void 0;
|
|
5323
5348
|
env.CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD = "1";
|
|
5324
5349
|
return env;
|
|
5325
5350
|
}
|
|
@@ -5333,6 +5358,9 @@ function buildCodexAgentEnv() {
|
|
|
5333
5358
|
if (shouldStripOpenAIApiKey()) {
|
|
5334
5359
|
delete env.OPENAI_API_KEY;
|
|
5335
5360
|
}
|
|
5361
|
+
delete env.GH_TOKEN;
|
|
5362
|
+
delete env.GITHUB_TOKEN;
|
|
5363
|
+
delete env.GH_CONFIG_DIR;
|
|
5336
5364
|
return env;
|
|
5337
5365
|
}
|
|
5338
5366
|
function resolveCodexApiKey() {
|
|
@@ -6139,7 +6167,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
6139
6167
|
}
|
|
6140
6168
|
async initialize() {
|
|
6141
6169
|
const historyDir = join13(homedir11(), ".replicas", "claude");
|
|
6142
|
-
await
|
|
6170
|
+
await mkdir10(historyDir, { recursive: true });
|
|
6143
6171
|
if (this.initialSessionId) {
|
|
6144
6172
|
this.sessionId = this.initialSessionId;
|
|
6145
6173
|
console.log(`[ClaudeManager] Restored session ID from persisted state: ${this.sessionId}`);
|
|
@@ -6373,7 +6401,7 @@ var AspClient = class {
|
|
|
6373
6401
|
// src/managers/codex-asp/app-server-process.ts
|
|
6374
6402
|
var DEFAULT_CODEX_BINARY = "codex";
|
|
6375
6403
|
var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
|
|
6376
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
6404
|
+
var ENGINE_PACKAGE_VERSION = "0.1.263";
|
|
6377
6405
|
var INITIALIZE_METHOD = "initialize";
|
|
6378
6406
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
6379
6407
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -7993,7 +8021,7 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
7993
8021
|
|
|
7994
8022
|
// src/managers/codex-manager.ts
|
|
7995
8023
|
import { Codex } from "@openai/codex-sdk";
|
|
7996
|
-
import { readdir as readdir3, stat as stat2, writeFile as writeFile6, mkdir as
|
|
8024
|
+
import { readdir as readdir3, stat as stat2, writeFile as writeFile6, mkdir as mkdir11, readFile as readFile8 } from "fs/promises";
|
|
7997
8025
|
import { existsSync as existsSync7 } from "fs";
|
|
7998
8026
|
import { join as join14 } from "path";
|
|
7999
8027
|
import { homedir as homedir12 } from "os";
|
|
@@ -8077,7 +8105,7 @@ var CodexManager = class extends CodingAgentManager {
|
|
|
8077
8105
|
async updateCodexConfig(developerInstructions) {
|
|
8078
8106
|
try {
|
|
8079
8107
|
const codexDir = join14(homedir12(), ".codex");
|
|
8080
|
-
await
|
|
8108
|
+
await mkdir11(codexDir, { recursive: true });
|
|
8081
8109
|
let config = {};
|
|
8082
8110
|
if (existsSync7(CODEX_CONFIG_PATH)) {
|
|
8083
8111
|
try {
|
|
@@ -9096,10 +9124,10 @@ var ChatService = class {
|
|
|
9096
9124
|
chats = /* @__PURE__ */ new Map();
|
|
9097
9125
|
writeChain = Promise.resolve();
|
|
9098
9126
|
async initialize() {
|
|
9099
|
-
await
|
|
9100
|
-
await
|
|
9101
|
-
await
|
|
9102
|
-
await
|
|
9127
|
+
await mkdir12(ENGINE_DIR2, { recursive: true });
|
|
9128
|
+
await mkdir12(CLAUDE_HISTORY_DIR, { recursive: true });
|
|
9129
|
+
await mkdir12(RELAY_HISTORY_DIR, { recursive: true });
|
|
9130
|
+
await mkdir12(CHAT_SENDERS_DIR, { recursive: true });
|
|
9103
9131
|
const persisted = await this.loadChats();
|
|
9104
9132
|
for (const chat of persisted) {
|
|
9105
9133
|
const runtime = this.createRuntimeChat(chat);
|
|
@@ -10018,7 +10046,7 @@ import { existsSync as existsSync9 } from "fs";
|
|
|
10018
10046
|
import { join as join19 } from "path";
|
|
10019
10047
|
|
|
10020
10048
|
// src/services/warm-hook-logs-service.ts
|
|
10021
|
-
import { mkdir as
|
|
10049
|
+
import { mkdir as mkdir13, readFile as readFile12, writeFile as writeFile7, readdir as readdir5, appendFile as appendFile6, unlink as unlink3 } from "fs/promises";
|
|
10022
10050
|
import { homedir as homedir15 } from "os";
|
|
10023
10051
|
import { join as join18 } from "path";
|
|
10024
10052
|
var LOGS_DIR2 = join18(homedir15(), ".replicas", "warm-hook-logs");
|
|
@@ -10030,7 +10058,7 @@ function withPreview2(stored) {
|
|
|
10030
10058
|
}
|
|
10031
10059
|
var WarmHookLogsService = class {
|
|
10032
10060
|
async ensureDir() {
|
|
10033
|
-
await
|
|
10061
|
+
await mkdir13(LOGS_DIR2, { recursive: true });
|
|
10034
10062
|
}
|
|
10035
10063
|
async saveGlobalHookLog(entry) {
|
|
10036
10064
|
await this.ensureDir();
|