replicas-engine 0.1.796 → 0.1.798
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/{asp-host-FZQ2TUF2.js → asp-host-TI26BVGX.js} +4 -4
- package/dist/src/{chunk-R3ZAMRF2.js → chunk-2JUVZJ6U.js} +5 -1
- package/dist/src/{chunk-OXIIP2JJ.js → chunk-7JWJOKBV.js} +2 -2
- package/dist/src/{chunk-DYSV2LJI.js → chunk-GE4BAPLW.js} +1 -1
- package/dist/src/{chunk-WL6U3PYX.js → chunk-GY3VI2DT.js} +1 -1
- package/dist/src/{chunk-5OZAF43V.js → chunk-H2WKCWRK.js} +4 -4
- package/dist/src/{chunk-VBL36FFD.js → chunk-LI5WPJD6.js} +2 -2
- package/dist/src/command-protection-hook.js +3 -3
- package/dist/src/deepseek-command-protection-plugin.js +4 -4
- package/dist/src/headless-agent.js +2 -2
- package/dist/src/index.js +89 -81
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/relay-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-H2WKCWRK.js";
|
|
9
|
+
import "./chunk-GY3VI2DT.js";
|
|
10
|
+
import "./chunk-7JWJOKBV.js";
|
|
11
11
|
import "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-2JUVZJ6U.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
export {
|
|
15
15
|
getCodexAspHost,
|
|
@@ -3317,7 +3317,8 @@ var SENTRY_ABILITY = {
|
|
|
3317
3317
|
};
|
|
3318
3318
|
|
|
3319
3319
|
// ../shared/src/slack-response-style.ts
|
|
3320
|
-
var SLACK_CONCISE_REPLY_SHAPE = "
|
|
3320
|
+
var SLACK_CONCISE_REPLY_SHAPE = "concise and easy to scan, leading with the outcome and including the reasoning, evidence, caveats, and next steps needed to make the update useful. Remove repetition, filler, and step-by-step narration, but do not omit relevant substance to satisfy a word or sentence limit. Put exhaustive logs and file-by-file recaps in the pull request or workspace unless the user asks for them";
|
|
3321
|
+
var SLACK_QUOTE_REPLY_GUIDANCE = "Use a short Slack blockquote (`> quoted text`) only when answering a specific earlier message or when the reply would otherwise have an unclear referent. Quote only the relevant line; do not quote the latest message by default, repeat the full request, or add a blockquote when the reply is already unambiguous.";
|
|
3321
3322
|
var SLACK_BLOCK_KIT_GUIDANCE = "Use Block Kit whenever structure or a link would make the message faster to scan or use. Before composing a structured message, read Slack's live [block catalog](https://docs.slack.dev/reference/block-kit/blocks) and the linked schema for each block you plan to use; do not rely on memory for which blocks exist or their fields. You have broad leeway to use display-only blocks and `actions` with URL buttons, but do not add controls that require an interaction callback. Keep simple replies as plain text, do not add decorative UI or repeat content across blocks, and always keep `text` as a concise, complete fallback for notifications and accessibility.";
|
|
3322
3323
|
var SLACK_PR_BUTTON_GUIDANCE = 'The first time you share a given pull request or merge request link in a thread \u2014 the message announcing you opened it \u2014 attach a button for it: send `blocks` alongside `text` \u2014 a `section` block holding your message as `mrkdwn`, then an `actions` block with one element per newly shared link, `{"type": "button", "style": "primary", "text": {"type": "plain_text", "text": "View PR"}, "url": "<pr url>", "action_id": "view_pr"}`. Later messages about a pull request you already linked in this thread keep the link in the sentence and get no button, and never re-post a button for a link someone already has. Label it "View MR" for GitLab, and if there are several give each button a unique `action_id` and name its repository in the label ("View PR \xB7 web"). Always keep `text` populated with the same message \u2014 Slack uses it for notifications and fallback \u2014 and keep the link in the sentence too.';
|
|
3323
3324
|
|
|
@@ -3370,6 +3371,8 @@ await Bun.write('/tmp/recording.mov', response);
|
|
|
3370
3371
|
|
|
3371
3372
|
Write like a teammate, not a report. Lead with the outcome, remove repetition and filler, and preserve the facts needed to understand the result, blocker, or next action. A routine update is ${SLACK_CONCISE_REPLY_SHAPE}.
|
|
3372
3373
|
|
|
3374
|
+
${SLACK_QUOTE_REPLY_GUIDANCE}
|
|
3375
|
+
|
|
3373
3376
|
${SLACK_BLOCK_KIT_GUIDANCE}
|
|
3374
3377
|
|
|
3375
3378
|
\`\`\`ts
|
|
@@ -7610,6 +7613,7 @@ export {
|
|
|
7610
7613
|
getProviderDisplayName,
|
|
7611
7614
|
detectAgentQuotaLimit,
|
|
7612
7615
|
CREDENTIAL_METHOD,
|
|
7616
|
+
AGENT_CREDENTIAL_METHODS_IN_ORDER,
|
|
7613
7617
|
agentCredentialSnapshotSchema,
|
|
7614
7618
|
isAgentChatTurnActivityRecord,
|
|
7615
7619
|
isAgentChatSkillActivityRecord,
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES,
|
|
6
6
|
isVersionBelow
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2JUVZJ6U.js";
|
|
8
8
|
|
|
9
9
|
// src/utils/codex-agent-env.ts
|
|
10
10
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -241,7 +241,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
241
241
|
var MIN_CODEX_CLI_VERSION = "0.153.3";
|
|
242
242
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
243
243
|
var codexCliVersionEnsured = null;
|
|
244
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
244
|
+
var ENGINE_PACKAGE_VERSION = "0.1.798";
|
|
245
245
|
var INITIALIZE_METHOD = "initialize";
|
|
246
246
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
247
247
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
findCodeHostPullRequestUrls,
|
|
6
6
|
mayCreatePullRequest
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2JUVZJ6U.js";
|
|
8
8
|
|
|
9
9
|
// src/services/post-tool-pr-notifier.ts
|
|
10
10
|
async function notifyPostToolUse(toolName, toolInput, toolResult) {
|
|
@@ -5,18 +5,18 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GY3VI2DT.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
buildCodexAgentEnv
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7JWJOKBV.js";
|
|
13
13
|
import {
|
|
14
14
|
CODEX_AUTH_ENV_KEYS,
|
|
15
15
|
CODEX_AUTH_ENV_KEYS_BY_METHOD,
|
|
16
16
|
codexAuthEnvFromResponse,
|
|
17
17
|
createErrorResult,
|
|
18
18
|
createSuccessResult
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2JUVZJ6U.js";
|
|
20
20
|
|
|
21
21
|
// src/managers/codex-token-manager.ts
|
|
22
22
|
import { promises as fs } from "fs";
|
|
@@ -232,7 +232,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
232
232
|
const data = await response.json();
|
|
233
233
|
await this.applyCredentialsResponse(data);
|
|
234
234
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
235
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
235
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-TI26BVGX.js");
|
|
236
236
|
await restartCodexAspHostIfRunning2();
|
|
237
237
|
}
|
|
238
238
|
if (data.scope) {
|
|
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
monolithRequest
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GY3VI2DT.js";
|
|
7
7
|
import {
|
|
8
8
|
extractCommandProtectionCommandText,
|
|
9
9
|
findGitCommitSignals,
|
|
10
10
|
findPrMergeSignals
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2JUVZJ6U.js";
|
|
12
12
|
|
|
13
13
|
// src/services/command-protection-service.ts
|
|
14
14
|
var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
|
|
@@ -3,12 +3,12 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-LI5WPJD6.js";
|
|
7
|
+
import "./chunk-GY3VI2DT.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-2JUVZJ6U.js";
|
|
12
12
|
import "./chunk-VEQXQN22.js";
|
|
13
13
|
|
|
14
14
|
// src/command-protection-hook.ts
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
evaluateCommandProtection
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LI5WPJD6.js";
|
|
7
7
|
import {
|
|
8
8
|
notifyPostToolUse
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-GE4BAPLW.js";
|
|
10
|
+
import "./chunk-GY3VI2DT.js";
|
|
11
11
|
import "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-2JUVZJ6U.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/deepseek-command-protection-plugin.ts
|
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
AppServerProcess,
|
|
10
10
|
buildCodexAgentEnv
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7JWJOKBV.js";
|
|
12
12
|
import {
|
|
13
13
|
AGENT,
|
|
14
14
|
getMemoryOutputSafetyViolation,
|
|
15
15
|
headlessAgentRequestSchema
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2JUVZJ6U.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
|
|
19
19
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
evaluateCommandProtection,
|
|
92
92
|
extractToolCommand,
|
|
93
93
|
reportCommandProtectionBlock
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-LI5WPJD6.js";
|
|
95
95
|
import {
|
|
96
96
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
97
97
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -124,26 +124,27 @@ import {
|
|
|
124
124
|
recordCredentialFallback,
|
|
125
125
|
recordExhaustedCredential,
|
|
126
126
|
restartCodexAspHost
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-H2WKCWRK.js";
|
|
128
128
|
import {
|
|
129
129
|
ENGINE_ENV,
|
|
130
130
|
IS_WARMING_MODE,
|
|
131
131
|
monolithRequest,
|
|
132
132
|
monolithService,
|
|
133
133
|
setAgentCredentialSnapshot
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-GY3VI2DT.js";
|
|
135
135
|
import {
|
|
136
136
|
AspClient,
|
|
137
137
|
SUBPROCESS_MAX_BUFFER,
|
|
138
138
|
execAsync,
|
|
139
139
|
execFileAsync
|
|
140
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-7JWJOKBV.js";
|
|
141
141
|
import {
|
|
142
142
|
isRecord as isRecord2
|
|
143
143
|
} from "./chunk-UZSNFLDQ.js";
|
|
144
144
|
import {
|
|
145
145
|
ACCEPTED_USER_MESSAGE_SOURCE,
|
|
146
146
|
AGENT,
|
|
147
|
+
AGENT_CREDENTIAL_METHODS_IN_ORDER,
|
|
147
148
|
AGENT_MODELS,
|
|
148
149
|
AGENT_QUOTA_EXHAUSTED_EVENT_TYPE,
|
|
149
150
|
AI_GATEWAY_BASE_URL,
|
|
@@ -337,7 +338,7 @@ import {
|
|
|
337
338
|
spawnRelaySubagentRequestSchema,
|
|
338
339
|
stripAgentDiagnosticErrors,
|
|
339
340
|
withTimeout
|
|
340
|
-
} from "./chunk-
|
|
341
|
+
} from "./chunk-2JUVZJ6U.js";
|
|
341
342
|
import {
|
|
342
343
|
__commonJS,
|
|
343
344
|
__export,
|
|
@@ -9692,14 +9693,14 @@ var EngineLogger = class {
|
|
|
9692
9693
|
var engineLogger = new EngineLogger();
|
|
9693
9694
|
|
|
9694
9695
|
// src/services/replicas-config-service.ts
|
|
9695
|
-
import { readFile as
|
|
9696
|
+
import { readFile as readFile7, appendFile, writeFile as writeFile4, mkdir as mkdir6 } from "fs/promises";
|
|
9696
9697
|
import { existsSync as existsSync4 } from "fs";
|
|
9697
9698
|
import { join as join10 } from "path";
|
|
9698
9699
|
import { homedir as homedir7 } from "os";
|
|
9699
9700
|
import { spawn as spawn2 } from "child_process";
|
|
9700
9701
|
|
|
9701
9702
|
// src/services/environment-details-service.ts
|
|
9702
|
-
import { mkdir as mkdir4, readFile as
|
|
9703
|
+
import { mkdir as mkdir4, readFile as readFile5 } from "fs/promises";
|
|
9703
9704
|
import { existsSync as existsSync3 } from "fs";
|
|
9704
9705
|
import { homedir as homedir5 } from "os";
|
|
9705
9706
|
import { join as join8 } from "path";
|
|
@@ -9785,6 +9786,26 @@ function isAgentAvailable(provider) {
|
|
|
9785
9786
|
return detectAgentAuthMethod(provider) !== "none";
|
|
9786
9787
|
}
|
|
9787
9788
|
|
|
9789
|
+
// src/managers/pi-auth.ts
|
|
9790
|
+
import { readFile as readFile4 } from "fs/promises";
|
|
9791
|
+
async function getPiProviderCredentials() {
|
|
9792
|
+
let credentials;
|
|
9793
|
+
try {
|
|
9794
|
+
credentials = JSON.parse(await readFile4(PI_AUTH_PATH, "utf8"));
|
|
9795
|
+
} catch {
|
|
9796
|
+
return createErrorResult({ message: "Pi credentials are unavailable." });
|
|
9797
|
+
}
|
|
9798
|
+
if (isRecord2(credentials)) {
|
|
9799
|
+
for (const { method: provider } of AGENT_CREDENTIAL_METHODS_IN_ORDER.pi) {
|
|
9800
|
+
const credential = credentials[provider];
|
|
9801
|
+
if (isRecord2(credential) && credential.type === "api_key" && typeof credential.key === "string") {
|
|
9802
|
+
return createSuccessResult({ provider, apiKey: credential.key });
|
|
9803
|
+
}
|
|
9804
|
+
}
|
|
9805
|
+
}
|
|
9806
|
+
return createErrorResult({ message: "Pi API key is not configured." });
|
|
9807
|
+
}
|
|
9808
|
+
|
|
9788
9809
|
// src/services/environment-details-service.ts
|
|
9789
9810
|
var REPLICAS_DIR = join8(homedir5(), ".replicas");
|
|
9790
9811
|
var DETAILS_FILE = join8(REPLICAS_DIR, "environment-details.json");
|
|
@@ -9800,7 +9821,7 @@ async function detectGitIdentityConfigured() {
|
|
|
9800
9821
|
}
|
|
9801
9822
|
async function detectGitLabAccessConfigured() {
|
|
9802
9823
|
try {
|
|
9803
|
-
const credentials = await
|
|
9824
|
+
const credentials = await readFile5(GIT_CREDENTIALS_PATH, "utf-8");
|
|
9804
9825
|
return credentials.split("\n").some((line) => {
|
|
9805
9826
|
try {
|
|
9806
9827
|
return new URL(line).username === "oauth2";
|
|
@@ -9859,7 +9880,7 @@ async function readDetails() {
|
|
|
9859
9880
|
if (!existsSync3(DETAILS_FILE)) {
|
|
9860
9881
|
return createDefaultDetails();
|
|
9861
9882
|
}
|
|
9862
|
-
const raw = await
|
|
9883
|
+
const raw = await readFile5(DETAILS_FILE, "utf-8");
|
|
9863
9884
|
const parsed = JSON.parse(raw);
|
|
9864
9885
|
delete parsed.googleAccessConfigured;
|
|
9865
9886
|
return { ...createDefaultDetails(), ...parsed };
|
|
@@ -9874,11 +9895,12 @@ async function writeDetails(details) {
|
|
|
9874
9895
|
}
|
|
9875
9896
|
var EnvironmentDetailsService = class {
|
|
9876
9897
|
async getDetails() {
|
|
9877
|
-
const [details, repositories, gitIdentityConfigured, gitlabAccessConfigured] = await Promise.all([
|
|
9898
|
+
const [details, repositories, gitIdentityConfigured, gitlabAccessConfigured, piCredentials] = await Promise.all([
|
|
9878
9899
|
readDetails(),
|
|
9879
9900
|
gitService.listRepositories(),
|
|
9880
9901
|
detectGitIdentityConfigured(),
|
|
9881
|
-
detectGitLabAccessConfigured()
|
|
9902
|
+
detectGitLabAccessConfigured(),
|
|
9903
|
+
getPiProviderCredentials()
|
|
9882
9904
|
]);
|
|
9883
9905
|
details.engineVersion = ENGINE_ENV.REPLICAS_SANDBOX_IMAGE_VERSION;
|
|
9884
9906
|
details.supportsMidTurnSteering = true;
|
|
@@ -9896,6 +9918,7 @@ var EnvironmentDetailsService = class {
|
|
|
9896
9918
|
details.museAuthMethod = detectAgentAuthMethod(AGENT.MUSE);
|
|
9897
9919
|
details.opencodeAuthMethod = detectAgentAuthMethod(AGENT.OPENCODE);
|
|
9898
9920
|
details.piAuthMethod = detectAgentAuthMethod(AGENT.PI);
|
|
9921
|
+
details.piInferenceProvider = piCredentials.ok ? piCredentials.data.provider : void 0;
|
|
9899
9922
|
details.credentialFallbacks = listCredentialFallbacks();
|
|
9900
9923
|
details.gitIdentityConfigured = gitIdentityConfigured;
|
|
9901
9924
|
const ghConfigured = existsSync3(GH_HOSTS_PATH);
|
|
@@ -9976,7 +9999,7 @@ var EnvironmentDetailsService = class {
|
|
|
9976
9999
|
var environmentDetailsService = new EnvironmentDetailsService();
|
|
9977
10000
|
|
|
9978
10001
|
// src/services/start-hook-logs-service.ts
|
|
9979
|
-
import { mkdir as mkdir5, readFile as
|
|
10002
|
+
import { mkdir as mkdir5, readFile as readFile6, writeFile as writeFile3, readdir as readdir2 } from "fs/promises";
|
|
9980
10003
|
import { homedir as homedir6 } from "os";
|
|
9981
10004
|
import { join as join9 } from "path";
|
|
9982
10005
|
|
|
@@ -10053,7 +10076,7 @@ var StartHookLogsService = class {
|
|
|
10053
10076
|
continue;
|
|
10054
10077
|
}
|
|
10055
10078
|
try {
|
|
10056
|
-
const raw = await
|
|
10079
|
+
const raw = await readFile6(join9(LOGS_DIR, file), "utf-8");
|
|
10057
10080
|
const stored = normalizeStored(JSON.parse(raw));
|
|
10058
10081
|
if (stored) {
|
|
10059
10082
|
logs.push(withPreview(stored));
|
|
@@ -10072,7 +10095,7 @@ var StartHookLogsService = class {
|
|
|
10072
10095
|
async getFullOutput(hookType, hookName) {
|
|
10073
10096
|
const filename = hookType === "environment" ? ENVIRONMENT_HOOK_LOG_FILENAME : repoHookLogFilename(hookName);
|
|
10074
10097
|
try {
|
|
10075
|
-
const raw = await
|
|
10098
|
+
const raw = await readFile6(join9(LOGS_DIR, filename), "utf-8");
|
|
10076
10099
|
const stored = normalizeStored(JSON.parse(raw));
|
|
10077
10100
|
if (!stored || stored.hookType !== hookType || stored.hookName !== hookName) {
|
|
10078
10101
|
return null;
|
|
@@ -10104,7 +10127,7 @@ async function readReplicasConfigFromDir(dirPath) {
|
|
|
10104
10127
|
if (!existsSync4(configPath)) {
|
|
10105
10128
|
continue;
|
|
10106
10129
|
}
|
|
10107
|
-
const data = await
|
|
10130
|
+
const data = await readFile7(configPath, "utf-8");
|
|
10108
10131
|
const config = parseReplicasConfigString(data, filename);
|
|
10109
10132
|
return { config, filename };
|
|
10110
10133
|
}
|
|
@@ -10535,7 +10558,7 @@ var EventService = class {
|
|
|
10535
10558
|
var eventService = new EventService();
|
|
10536
10559
|
|
|
10537
10560
|
// src/services/preview-service.ts
|
|
10538
|
-
import { mkdir as mkdir8, readFile as
|
|
10561
|
+
import { mkdir as mkdir8, readFile as readFile8 } from "fs/promises";
|
|
10539
10562
|
import { existsSync as existsSync5 } from "fs";
|
|
10540
10563
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
10541
10564
|
import { homedir as homedir9 } from "os";
|
|
@@ -10546,7 +10569,7 @@ async function readPreviewsFile() {
|
|
|
10546
10569
|
if (!existsSync5(PREVIEW_PORTS_FILE)) {
|
|
10547
10570
|
return { previews: [] };
|
|
10548
10571
|
}
|
|
10549
|
-
const raw = await
|
|
10572
|
+
const raw = await readFile8(PREVIEW_PORTS_FILE, "utf-8");
|
|
10550
10573
|
return JSON.parse(raw);
|
|
10551
10574
|
} catch {
|
|
10552
10575
|
return { previews: [] };
|
|
@@ -10650,7 +10673,7 @@ async function registerDesktopPreview() {
|
|
|
10650
10673
|
}
|
|
10651
10674
|
|
|
10652
10675
|
// src/services/chat/chat-service.ts
|
|
10653
|
-
import { appendFile as appendFile5, copyFile as copyFile2, mkdir as mkdir21, readFile as
|
|
10676
|
+
import { appendFile as appendFile5, copyFile as copyFile2, mkdir as mkdir21, readFile as readFile22, rename as rename4, rm as rm4 } from "fs/promises";
|
|
10654
10677
|
import { join as join37 } from "path";
|
|
10655
10678
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
10656
10679
|
|
|
@@ -12154,7 +12177,7 @@ var PullRequestCheckService = class {
|
|
|
12154
12177
|
var pullRequestCheckService = new PullRequestCheckService();
|
|
12155
12178
|
|
|
12156
12179
|
// src/services/skill-registry-service.ts
|
|
12157
|
-
import { readFile as
|
|
12180
|
+
import { readFile as readFile9, readdir as readdir3, stat as stat2 } from "fs/promises";
|
|
12158
12181
|
import { dirname as dirname3, isAbsolute, join as join15, relative, resolve } from "path";
|
|
12159
12182
|
var REGISTRY_ROOT_DIR = ".replicas/skill-registries";
|
|
12160
12183
|
var REGISTRY_MANIFEST = "manifest.json";
|
|
@@ -12302,7 +12325,7 @@ async function installCodexRegistryPlugins(client2, inventory) {
|
|
|
12302
12325
|
}
|
|
12303
12326
|
async function readManifest(homeDir) {
|
|
12304
12327
|
try {
|
|
12305
|
-
const raw = await
|
|
12328
|
+
const raw = await readFile9(getManifestPath(homeDir), "utf8");
|
|
12306
12329
|
const parsed = JSON.parse(raw);
|
|
12307
12330
|
if (!isSkillRegistryManifest(parsed)) {
|
|
12308
12331
|
console.warn("[SkillRegistry] Ignoring invalid skill registry manifest.");
|
|
@@ -12388,7 +12411,7 @@ function isNotFoundError(error) {
|
|
|
12388
12411
|
}
|
|
12389
12412
|
|
|
12390
12413
|
// src/managers/codex-asp/codex-history-file.ts
|
|
12391
|
-
import { appendFile as appendFile2, open, readFile as
|
|
12414
|
+
import { appendFile as appendFile2, open, readFile as readFile10 } from "fs/promises";
|
|
12392
12415
|
var CodexHistoryFile = class {
|
|
12393
12416
|
constructor(filePath) {
|
|
12394
12417
|
this.filePath = filePath;
|
|
@@ -12410,7 +12433,7 @@ var CodexHistoryFile = class {
|
|
|
12410
12433
|
}
|
|
12411
12434
|
async load() {
|
|
12412
12435
|
try {
|
|
12413
|
-
const content = await
|
|
12436
|
+
const content = await readFile10(this.filePath, "utf-8");
|
|
12414
12437
|
return parseAgentEventJsonlWithCodexAspTranscript(content);
|
|
12415
12438
|
} catch (error) {
|
|
12416
12439
|
if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT")) {
|
|
@@ -16201,14 +16224,14 @@ var CodexAspManager = class extends CodingAgentManager {
|
|
|
16201
16224
|
};
|
|
16202
16225
|
|
|
16203
16226
|
// src/managers/cursor-manager.ts
|
|
16204
|
-
import { mkdir as mkdir12, readFile as
|
|
16227
|
+
import { mkdir as mkdir12, readFile as readFile12, readdir as readdir5 } from "fs/promises";
|
|
16205
16228
|
import { basename as basename2, dirname as dirname7, extname, join as join21 } from "path";
|
|
16206
16229
|
import { parse as parseYaml } from "yaml";
|
|
16207
16230
|
import { Agent as CursorAgent2 } from "@cursor/sdk";
|
|
16208
16231
|
|
|
16209
16232
|
// src/services/native-command-protection-hooks.ts
|
|
16210
16233
|
import { existsSync as existsSync9 } from "fs";
|
|
16211
|
-
import { mkdir as mkdir11, readFile as
|
|
16234
|
+
import { mkdir as mkdir11, readFile as readFile11, writeFile as writeFile6 } from "fs/promises";
|
|
16212
16235
|
import { basename, dirname as dirname6, join as join20 } from "path";
|
|
16213
16236
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
16214
16237
|
var moduleDirectory = dirname6(fileURLToPath2(import.meta.url));
|
|
@@ -16242,7 +16265,7 @@ async function ensureCursorCommandProtectionHook() {
|
|
|
16242
16265
|
const path7 = join20(ENGINE_ENV.HOME_DIR, ".cursor", "hooks.json");
|
|
16243
16266
|
let config = {};
|
|
16244
16267
|
try {
|
|
16245
|
-
const parsed = JSON.parse(await
|
|
16268
|
+
const parsed = JSON.parse(await readFile11(path7, "utf8"));
|
|
16246
16269
|
if (!isRecord2(parsed)) throw new Error("Invalid Cursor hooks configuration.");
|
|
16247
16270
|
config = parsed;
|
|
16248
16271
|
} catch (error) {
|
|
@@ -16269,7 +16292,7 @@ async function ensureKimiCommandProtectionHook() {
|
|
|
16269
16292
|
const end = "# End Replicas command protection hook";
|
|
16270
16293
|
let config = "";
|
|
16271
16294
|
try {
|
|
16272
|
-
config = await
|
|
16295
|
+
config = await readFile11(path7, "utf8");
|
|
16273
16296
|
} catch (error) {
|
|
16274
16297
|
if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT")) throw error;
|
|
16275
16298
|
}
|
|
@@ -16373,7 +16396,7 @@ async function listCursorCommandsInDirectory(directory) {
|
|
|
16373
16396
|
const name = basename2(entry.name, ".md");
|
|
16374
16397
|
let description;
|
|
16375
16398
|
try {
|
|
16376
|
-
description = extractCursorCommandDescription(await
|
|
16399
|
+
description = extractCursorCommandDescription(await readFile12(join21(directory, entry.name), "utf8"));
|
|
16377
16400
|
} catch (error) {
|
|
16378
16401
|
console.warn("[CursorManager] Failed to read slash command file:", error);
|
|
16379
16402
|
}
|
|
@@ -16754,7 +16777,7 @@ import { createRequire as createRequire2 } from "module";
|
|
|
16754
16777
|
import { basename as basename3, dirname as dirname8, join as join22 } from "path";
|
|
16755
16778
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
16756
16779
|
import { existsSync as existsSync10 } from "fs";
|
|
16757
|
-
import { mkdir as mkdir13, readFile as
|
|
16780
|
+
import { mkdir as mkdir13, readFile as readFile13, rename as rename2, writeFile as writeFile7 } from "fs/promises";
|
|
16758
16781
|
import { z as z2 } from "zod";
|
|
16759
16782
|
import WebSocket from "ws";
|
|
16760
16783
|
import { AbstractApiClient } from "@deepseek-ai/dsh-host-apiproxy/client";
|
|
@@ -17003,7 +17026,7 @@ var DeepseekManager = class extends CodingAgentManager {
|
|
|
17003
17026
|
if (!DSH_PATCH || !DSH_COMMAND_PROTECTION_PLUGIN) throw new Error("DeepSeek Harness configuration is missing from the engine package.");
|
|
17004
17027
|
const runtimePatch = join22(this.deepseekHome, "replicas.cordis.patch.yml");
|
|
17005
17028
|
await mkdir13(dirname8(runtimePatch), { recursive: true });
|
|
17006
|
-
await writeFile7(runtimePatch, (await
|
|
17029
|
+
await writeFile7(runtimePatch, (await readFile13(DSH_PATCH, "utf8")).replace(
|
|
17007
17030
|
"__REPLICAS_DSH_COMMAND_PROTECTION_PLUGIN__",
|
|
17008
17031
|
JSON.stringify(DSH_COMMAND_PROTECTION_PLUGIN)
|
|
17009
17032
|
));
|
|
@@ -17253,13 +17276,13 @@ ${request.message}` : request.message;
|
|
|
17253
17276
|
};
|
|
17254
17277
|
|
|
17255
17278
|
// src/managers/fx-manager.ts
|
|
17256
|
-
import { readFile as
|
|
17279
|
+
import { readFile as readFile15 } from "fs/promises";
|
|
17257
17280
|
import { spawn as spawn5 } from "child_process";
|
|
17258
17281
|
|
|
17259
17282
|
// src/managers/acp-manager.ts
|
|
17260
17283
|
import { spawn as spawn4 } from "child_process";
|
|
17261
17284
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
17262
|
-
import { mkdir as mkdir14, readFile as
|
|
17285
|
+
import { mkdir as mkdir14, readFile as readFile14, writeFile as writeFile8 } from "fs/promises";
|
|
17263
17286
|
import { dirname as dirname9 } from "path";
|
|
17264
17287
|
import { Writable } from "stream";
|
|
17265
17288
|
import {
|
|
@@ -17331,7 +17354,7 @@ var AcpManager = class extends CodingAgentManager {
|
|
|
17331
17354
|
});
|
|
17332
17355
|
const app2 = client({ name: "Replicas" }).onNotification(methods.client.session.update, ({ params }) => this.recordUpdate(params)).onRequest(methods.client.fs.readTextFile, async ({ params }) => {
|
|
17333
17356
|
this.assertSession(params.sessionId);
|
|
17334
|
-
const content = await
|
|
17357
|
+
const content = await readFile14(params.path, "utf8");
|
|
17335
17358
|
if (params.line === void 0 && params.limit === void 0) return { content };
|
|
17336
17359
|
const start = Math.max(0, (params.line ?? 1) - 1);
|
|
17337
17360
|
const end = params.limit === null || params.limit === void 0 ? void 0 : start + params.limit;
|
|
@@ -17717,7 +17740,7 @@ ${request.message}` : request.message
|
|
|
17717
17740
|
|
|
17718
17741
|
// src/managers/fx-manager.ts
|
|
17719
17742
|
async function ensureResolvableDnsConfig() {
|
|
17720
|
-
const contents = await
|
|
17743
|
+
const contents = await readFile15("/etc/resolv.conf");
|
|
17721
17744
|
if (contents.length === 0 || contents.at(-1) === 10) return;
|
|
17722
17745
|
await new Promise((resolve7, reject) => {
|
|
17723
17746
|
const child = spawn5("sudo", ["tee", "-a", "/etc/resolv.conf"], { stdio: ["pipe", "ignore", "pipe"] });
|
|
@@ -18306,7 +18329,7 @@ ${pending}
|
|
|
18306
18329
|
|
|
18307
18330
|
// src/managers/opencode-manager.ts
|
|
18308
18331
|
import { existsSync as existsSync11 } from "fs";
|
|
18309
|
-
import { copyFile, mkdir as mkdir16, readFile as
|
|
18332
|
+
import { copyFile, mkdir as mkdir16, readFile as readFile16, rm as rm2 } from "fs/promises";
|
|
18310
18333
|
import { delimiter, dirname as dirname11, join as join23 } from "path";
|
|
18311
18334
|
import { randomBytes as randomBytes3 } from "crypto";
|
|
18312
18335
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
@@ -18391,7 +18414,7 @@ var opencodeAuthSchema = z3.record(z3.string(), z3.object({
|
|
|
18391
18414
|
async function hasOpencodeCredentials(provider) {
|
|
18392
18415
|
if (!existsSync11(OPENCODE_AUTH_PATH)) return false;
|
|
18393
18416
|
try {
|
|
18394
|
-
const auth2 = opencodeAuthSchema.safeParse(JSON.parse(await
|
|
18417
|
+
const auth2 = opencodeAuthSchema.safeParse(JSON.parse(await readFile16(OPENCODE_AUTH_PATH, "utf8")));
|
|
18395
18418
|
return auth2.success && auth2.data[provider]?.type === "api" && Boolean(auth2.data[provider]?.key);
|
|
18396
18419
|
} catch {
|
|
18397
18420
|
return false;
|
|
@@ -18496,7 +18519,7 @@ function isOpencodeMcpEntry(value) {
|
|
|
18496
18519
|
async function readProvisionedOpencodeMcpConfig() {
|
|
18497
18520
|
let raw;
|
|
18498
18521
|
try {
|
|
18499
|
-
raw = await
|
|
18522
|
+
raw = await readFile16(OPENCODE_CONFIG_PATH, "utf8");
|
|
18500
18523
|
} catch (error) {
|
|
18501
18524
|
if (isRecord2(error) && error.code === "ENOENT") return void 0;
|
|
18502
18525
|
console.error("[OpencodeManager] Failed to read Opencode config:", error);
|
|
@@ -19002,7 +19025,7 @@ var OpencodeManager = class extends CodingAgentManager {
|
|
|
19002
19025
|
};
|
|
19003
19026
|
|
|
19004
19027
|
// src/managers/pi-manager.ts
|
|
19005
|
-
import { mkdir as mkdir18, readFile as
|
|
19028
|
+
import { mkdir as mkdir18, readFile as readFile17 } from "fs/promises";
|
|
19006
19029
|
import { dirname as dirname19, join as join30 } from "path";
|
|
19007
19030
|
import {
|
|
19008
19031
|
createAgentSession,
|
|
@@ -59484,7 +59507,7 @@ var pi_mcp_adapter_default = createMcpAdapter();
|
|
|
59484
59507
|
// src/managers/pi-manager.ts
|
|
59485
59508
|
async function getManagedPiMcpServers() {
|
|
59486
59509
|
try {
|
|
59487
|
-
const parsed = JSON.parse(await
|
|
59510
|
+
const parsed = JSON.parse(await readFile17(PI_MCP_CONFIG_PATH, "utf8"));
|
|
59488
59511
|
if (!isRecord2(parsed) || !isRecord2(parsed.mcpServers)) return {};
|
|
59489
59512
|
return Object.fromEntries(Object.entries(parsed.mcpServers).filter(
|
|
59490
59513
|
(entry) => isRecord2(entry[1]) && (typeof entry[1].command === "string" || typeof entry[1].url === "string")
|
|
@@ -59631,7 +59654,7 @@ var PiManager = class extends CodingAgentManager {
|
|
|
59631
59654
|
}
|
|
59632
59655
|
async enqueueMessage(request, onAccepted) {
|
|
59633
59656
|
await this.initialized;
|
|
59634
|
-
if (!this.session && !await
|
|
59657
|
+
if (!this.session && !(await getPiProviderCredentials()).ok) {
|
|
59635
59658
|
throw new Error("OpenCode Go, Aster, or OpenRouter authentication is missing for Pi. Add an API key in Settings \u2192 Coding agents.");
|
|
59636
59659
|
}
|
|
59637
59660
|
return this.messageQueue.enqueue(request, onAccepted);
|
|
@@ -59669,8 +59692,9 @@ var PiManager = class extends CodingAgentManager {
|
|
|
59669
59692
|
return this.session;
|
|
59670
59693
|
}
|
|
59671
59694
|
const modelRuntime = await this.getModelRuntime();
|
|
59672
|
-
const
|
|
59673
|
-
if (!
|
|
59695
|
+
const credentialResult = await getPiProviderCredentials();
|
|
59696
|
+
if (!credentialResult.ok) throw new Error("OpenCode Go, Aster, or OpenRouter API key is not configured for Pi.");
|
|
59697
|
+
const credentials = credentialResult.data;
|
|
59674
59698
|
this.providerId = credentials.provider;
|
|
59675
59699
|
this.providerApiKey = credentials.apiKey;
|
|
59676
59700
|
const modelRegistry = new ModelRegistry(modelRuntime);
|
|
@@ -59756,22 +59780,6 @@ var PiManager = class extends CodingAgentManager {
|
|
|
59756
59780
|
this.unsubscribe = this.session.subscribe((event) => this.handleEvent(event));
|
|
59757
59781
|
return this.session;
|
|
59758
59782
|
}
|
|
59759
|
-
async getProviderCredentials() {
|
|
59760
|
-
let credentials;
|
|
59761
|
-
try {
|
|
59762
|
-
credentials = JSON.parse(await readFile16(PI_AUTH_PATH, "utf8"));
|
|
59763
|
-
} catch {
|
|
59764
|
-
return null;
|
|
59765
|
-
}
|
|
59766
|
-
if (!isRecord2(credentials)) return null;
|
|
59767
|
-
for (const provider of [OPENCODE_GO_PROVIDER, ASTER_PROVIDER, "openrouter"]) {
|
|
59768
|
-
const credential = credentials[provider];
|
|
59769
|
-
if (isRecord2(credential) && credential.type === "api_key" && typeof credential.key === "string") {
|
|
59770
|
-
return { provider, apiKey: credential.key };
|
|
59771
|
-
}
|
|
59772
|
-
}
|
|
59773
|
-
return null;
|
|
59774
|
-
}
|
|
59775
59783
|
async getModelRuntime() {
|
|
59776
59784
|
this.modelRuntime ??= await ModelRuntime.create({ authPath: PI_AUTH_PATH, refreshOnCreate: false });
|
|
59777
59785
|
return this.modelRuntime;
|
|
@@ -59865,7 +59873,7 @@ async function uploadAnalytics(endpoint, body) {
|
|
|
59865
59873
|
import {
|
|
59866
59874
|
appendFile as appendFile4,
|
|
59867
59875
|
mkdir as mkdir19,
|
|
59868
|
-
readFile as
|
|
59876
|
+
readFile as readFile18,
|
|
59869
59877
|
readdir as readdir6,
|
|
59870
59878
|
rename as rename3,
|
|
59871
59879
|
unlink as unlink3
|
|
@@ -60003,7 +60011,7 @@ var AnalyticsRecordBuffer = class {
|
|
|
60003
60011
|
return { flushed, failed };
|
|
60004
60012
|
}
|
|
60005
60013
|
async uploadSegment(filePath) {
|
|
60006
|
-
const records = this.parseRecords(await
|
|
60014
|
+
const records = this.parseRecords(await readFile18(filePath, "utf-8"));
|
|
60007
60015
|
if (records.length > 0) await this.options.upload(records);
|
|
60008
60016
|
await rename3(filePath, `${filePath}${UPLOADED_SUFFIX}`).catch(() => {
|
|
60009
60017
|
});
|
|
@@ -60813,7 +60821,7 @@ var KeepAliveService = class _KeepAliveService {
|
|
|
60813
60821
|
var keepAliveService = new KeepAliveService();
|
|
60814
60822
|
|
|
60815
60823
|
// src/services/canvas-service.ts
|
|
60816
|
-
import { readdir as readdir7, readFile as
|
|
60824
|
+
import { readdir as readdir7, readFile as readFile20, stat as stat4 } from "fs/promises";
|
|
60817
60825
|
import { homedir as homedir13 } from "os";
|
|
60818
60826
|
import { join as join32 } from "path";
|
|
60819
60827
|
|
|
@@ -60841,9 +60849,9 @@ function fileRevision(content) {
|
|
|
60841
60849
|
}
|
|
60842
60850
|
|
|
60843
60851
|
// src/utils/revisioned-text-file.ts
|
|
60844
|
-
import { readFile as
|
|
60852
|
+
import { readFile as readFile19 } from "fs/promises";
|
|
60845
60853
|
async function writeRevisionedTextFile(filePath, content, expectedRevision) {
|
|
60846
|
-
const current = await
|
|
60854
|
+
const current = await readFile19(filePath, "utf8");
|
|
60847
60855
|
const revision = fileRevision(current);
|
|
60848
60856
|
if (revision !== expectedRevision) {
|
|
60849
60857
|
return {
|
|
@@ -60936,7 +60944,7 @@ var CanvasService = class {
|
|
|
60936
60944
|
};
|
|
60937
60945
|
}
|
|
60938
60946
|
try {
|
|
60939
|
-
const bytes = await
|
|
60947
|
+
const bytes = await readFile20(filePath);
|
|
60940
60948
|
return { filename: safe, kind, sizeBytes, mimeType, updatedAt, bytes };
|
|
60941
60949
|
} catch {
|
|
60942
60950
|
continue;
|
|
@@ -61098,7 +61106,7 @@ async function reconcileCanvasItems(filenames) {
|
|
|
61098
61106
|
// src/services/upload-chat-transcripts.ts
|
|
61099
61107
|
import { createReadStream } from "fs";
|
|
61100
61108
|
import { createHash as createHash8 } from "crypto";
|
|
61101
|
-
import { readFile as
|
|
61109
|
+
import { readFile as readFile21, readdir as readdir8, stat as stat5 } from "fs/promises";
|
|
61102
61110
|
import { basename as basename4, join as join34 } from "path";
|
|
61103
61111
|
|
|
61104
61112
|
// src/services/chat/chat-senders.ts
|
|
@@ -61164,7 +61172,7 @@ async function flushAllChatTranscripts(chatsById = /* @__PURE__ */ new Map(), ca
|
|
|
61164
61172
|
async function uploadChatTranscript(chatId, filePath, chat, capture) {
|
|
61165
61173
|
const { size } = await stat5(filePath);
|
|
61166
61174
|
if (size === 0) return null;
|
|
61167
|
-
const historyPages = createChatTranscriptPages(await
|
|
61175
|
+
const historyPages = createChatTranscriptPages(await readFile21(filePath));
|
|
61168
61176
|
const metadata = chat ? {
|
|
61169
61177
|
provider: chat.provider,
|
|
61170
61178
|
...chat.relayBaseProvider ? { relayBaseProvider: chat.relayBaseProvider } : {},
|
|
@@ -61185,7 +61193,7 @@ async function uploadChatTranscript(chatId, filePath, chat, capture) {
|
|
|
61185
61193
|
}
|
|
61186
61194
|
try {
|
|
61187
61195
|
metadata.senders = parseChatMessageSendersJsonl(
|
|
61188
|
-
await
|
|
61196
|
+
await readFile21(chatMessageSendersFilePath(chatId), "utf-8")
|
|
61189
61197
|
);
|
|
61190
61198
|
} catch (error) {
|
|
61191
61199
|
if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT")) throw error;
|
|
@@ -61882,7 +61890,7 @@ var ChatService = class {
|
|
|
61882
61890
|
}
|
|
61883
61891
|
}
|
|
61884
61892
|
async readSenders(chatId) {
|
|
61885
|
-
return
|
|
61893
|
+
return readFile22(chatMessageSendersFilePath(chatId), "utf-8").then(parseChatMessageSendersJsonl).catch((error) => {
|
|
61886
61894
|
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") return [];
|
|
61887
61895
|
console.error("[ChatService] Failed to read sender records:", error);
|
|
61888
61896
|
return [];
|
|
@@ -62666,7 +62674,7 @@ var ChatService = class {
|
|
|
62666
62674
|
}
|
|
62667
62675
|
async loadChats() {
|
|
62668
62676
|
try {
|
|
62669
|
-
const content = await
|
|
62677
|
+
const content = await readFile22(CHATS_FILE, "utf-8");
|
|
62670
62678
|
return parsePersistedChatsContent(content);
|
|
62671
62679
|
} catch (error) {
|
|
62672
62680
|
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
@@ -62681,7 +62689,7 @@ var ChatService = class {
|
|
|
62681
62689
|
console.error("[ChatService] Failed to quarantine corrupt chats file:", renameError);
|
|
62682
62690
|
}
|
|
62683
62691
|
try {
|
|
62684
|
-
const backupContent = await
|
|
62692
|
+
const backupContent = await readFile22(CHATS_BACKUP_FILE, "utf-8");
|
|
62685
62693
|
return parsePersistedChatsContent(backupContent);
|
|
62686
62694
|
} catch (backupError) {
|
|
62687
62695
|
if (backupError && typeof backupError === "object" && "code" in backupError && backupError.code === "ENOENT") {
|
|
@@ -62771,7 +62779,7 @@ var ChatService = class {
|
|
|
62771
62779
|
|
|
62772
62780
|
// src/services/repo-file-service.ts
|
|
62773
62781
|
import { execFile as execFile7 } from "child_process";
|
|
62774
|
-
import { readFile as
|
|
62782
|
+
import { readFile as readFile23 } from "fs/promises";
|
|
62775
62783
|
import { extname as extname3 } from "path";
|
|
62776
62784
|
|
|
62777
62785
|
// src/services/language-server-service.ts
|
|
@@ -63106,7 +63114,7 @@ var RepoFileService = class {
|
|
|
63106
63114
|
sizeBytes,
|
|
63107
63115
|
binary: true,
|
|
63108
63116
|
tooLarge: false,
|
|
63109
|
-
base64: (await
|
|
63117
|
+
base64: (await readFile23(fullPath)).toString("base64"),
|
|
63110
63118
|
mimeType
|
|
63111
63119
|
};
|
|
63112
63120
|
}
|
|
@@ -63131,7 +63139,7 @@ var RepoFileService = class {
|
|
|
63131
63139
|
tooLarge: true
|
|
63132
63140
|
};
|
|
63133
63141
|
}
|
|
63134
|
-
const content = await
|
|
63142
|
+
const content = await readFile23(fullPath, "utf-8");
|
|
63135
63143
|
return {
|
|
63136
63144
|
repoName,
|
|
63137
63145
|
path: filePath,
|
|
@@ -63163,7 +63171,7 @@ var RepoFileService = class {
|
|
|
63163
63171
|
async inspectSymbol(repoName, filePath, line, character, action) {
|
|
63164
63172
|
const resolved = await this.resolveFile(repoName, filePath);
|
|
63165
63173
|
if (!resolved || line < 1 || character < 0 || isBinaryExtension(filePath)) return null;
|
|
63166
|
-
const content = await
|
|
63174
|
+
const content = await readFile23(resolved.fullPath, "utf8");
|
|
63167
63175
|
const sourceLine = content.split("\n")[line - 1];
|
|
63168
63176
|
if (sourceLine === void 0) return null;
|
|
63169
63177
|
const symbolMatch = Array.from(sourceLine.matchAll(/[\p{L}_$][\p{L}\p{N}_$]*/gu)).find((match) => character >= match.index && character <= match.index + match[0].length);
|
|
@@ -63276,17 +63284,17 @@ var RepoFileService = class {
|
|
|
63276
63284
|
// src/v1-routes.ts
|
|
63277
63285
|
import { Hono } from "hono";
|
|
63278
63286
|
import { z as z6 } from "zod";
|
|
63279
|
-
import { readdir as readdir11, stat as stat7, readFile as
|
|
63287
|
+
import { readdir as readdir11, stat as stat7, readFile as readFile26 } from "fs/promises";
|
|
63280
63288
|
import { join as join41, resolve as resolve5 } from "path";
|
|
63281
63289
|
|
|
63282
63290
|
// src/services/warm-hooks-service.ts
|
|
63283
63291
|
import { spawn as spawn10 } from "child_process";
|
|
63284
|
-
import { readFile as
|
|
63292
|
+
import { readFile as readFile25 } from "fs/promises";
|
|
63285
63293
|
import { existsSync as existsSync19 } from "fs";
|
|
63286
63294
|
import { join as join40 } from "path";
|
|
63287
63295
|
|
|
63288
63296
|
// src/services/warm-hook-logs-service.ts
|
|
63289
|
-
import { mkdir as mkdir22, readFile as
|
|
63297
|
+
import { mkdir as mkdir22, readFile as readFile24, writeFile as writeFile12, readdir as readdir10, appendFile as appendFile6, unlink as unlink4 } from "fs/promises";
|
|
63290
63298
|
import { homedir as homedir14 } from "os";
|
|
63291
63299
|
import { join as join39 } from "path";
|
|
63292
63300
|
var LOGS_DIR2 = join39(homedir14(), ".replicas", "warm-hook-logs");
|
|
@@ -63346,7 +63354,7 @@ var WarmHookLogsService = class {
|
|
|
63346
63354
|
continue;
|
|
63347
63355
|
}
|
|
63348
63356
|
try {
|
|
63349
|
-
const raw = await
|
|
63357
|
+
const raw = await readFile24(join39(LOGS_DIR2, file), "utf-8");
|
|
63350
63358
|
const stored = JSON.parse(raw);
|
|
63351
63359
|
logs.push(withPreview2(stored));
|
|
63352
63360
|
} catch {
|
|
@@ -63375,7 +63383,7 @@ var WarmHookLogsService = class {
|
|
|
63375
63383
|
}
|
|
63376
63384
|
async getCurrentRunLog() {
|
|
63377
63385
|
try {
|
|
63378
|
-
return await
|
|
63386
|
+
return await readFile24(CURRENT_RUN_LOG, "utf-8");
|
|
63379
63387
|
} catch (err) {
|
|
63380
63388
|
if (err.code === "ENOENT") return null;
|
|
63381
63389
|
throw err;
|
|
@@ -63384,7 +63392,7 @@ var WarmHookLogsService = class {
|
|
|
63384
63392
|
async getFullOutput(hookType, hookName) {
|
|
63385
63393
|
const filename = hookType === "global" ? GLOBAL_FILENAME : hookType === "environment" ? ENVIRONMENT_HOOK_LOG_FILENAME : repoHookLogFilename(hookName);
|
|
63386
63394
|
try {
|
|
63387
|
-
const raw = await
|
|
63395
|
+
const raw = await readFile24(join39(LOGS_DIR2, filename), "utf-8");
|
|
63388
63396
|
const stored = JSON.parse(raw);
|
|
63389
63397
|
if (stored.hookType !== hookType || stored.hookName !== hookName) {
|
|
63390
63398
|
return null;
|
|
@@ -63408,7 +63416,7 @@ async function readRepoWarmHook(repoPath) {
|
|
|
63408
63416
|
continue;
|
|
63409
63417
|
}
|
|
63410
63418
|
try {
|
|
63411
|
-
const raw = await
|
|
63419
|
+
const raw = await readFile25(configPath, "utf-8");
|
|
63412
63420
|
const config = parseReplicasConfigString(raw, filename);
|
|
63413
63421
|
if (!config.warmHook) {
|
|
63414
63422
|
return null;
|
|
@@ -64761,7 +64769,7 @@ data: ${JSON.stringify("Terminal session not found")}
|
|
|
64761
64769
|
}
|
|
64762
64770
|
let content;
|
|
64763
64771
|
try {
|
|
64764
|
-
content = await
|
|
64772
|
+
content = await readFile26(filePath, "utf-8");
|
|
64765
64773
|
} catch {
|
|
64766
64774
|
return c.json(jsonError("Log session not found"), 404);
|
|
64767
64775
|
}
|
|
@@ -3,11 +3,11 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
notifyPostToolUse
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GE4BAPLW.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-2JUVZJ6U.js";
|
|
11
11
|
import "./chunk-VEQXQN22.js";
|
|
12
12
|
|
|
13
13
|
// src/post-tool-pr-hook.ts
|
package/dist/src/relay-mcp.js
CHANGED