replicas-engine 0.1.743 → 0.1.744
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-47CGICOD.js → asp-host-FCGPBXUC.js} +4 -4
- package/dist/src/{chunk-WAB4RXD3.js → chunk-52VN7BOE.js} +2 -2
- package/dist/src/{chunk-KNYGSWUU.js → chunk-HMIVYASC.js} +2 -0
- package/dist/src/{chunk-JROJLNTZ.js → chunk-ITEQAMIZ.js} +1 -1
- package/dist/src/{chunk-TAJRILMY.js → chunk-PY7C2DWR.js} +4 -4
- package/dist/src/{chunk-LGSH2M6H.js → chunk-XQM2BWLW.js} +2 -2
- package/dist/src/{chunk-4ILGICWD.js → chunk-ZNKNSUIJ.js} +1 -1
- 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 +238 -18
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/package.json +10 -3
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
getCodexAspHost,
|
|
4
4
|
restartCodexAspHost,
|
|
5
5
|
restartCodexAspHostIfRunning
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-PY7C2DWR.js";
|
|
7
|
+
import "./chunk-ITEQAMIZ.js";
|
|
8
|
+
import "./chunk-XQM2BWLW.js";
|
|
9
9
|
import "./chunk-2RB7SIP3.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-HMIVYASC.js";
|
|
11
11
|
export {
|
|
12
12
|
getCodexAspHost,
|
|
13
13
|
restartCodexAspHost,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
monolithRequest
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ITEQAMIZ.js";
|
|
5
5
|
import {
|
|
6
6
|
extractCommandProtectionCommandText,
|
|
7
7
|
findGitCommitSignals,
|
|
8
8
|
findPrMergeSignals
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HMIVYASC.js";
|
|
10
10
|
|
|
11
11
|
// src/services/command-protection-service.ts
|
|
12
12
|
var DEFAULT_COMMAND_PROTECTION_BLOCK_MESSAGE = "Blocked by Replicas command protection.";
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
ENGINE_ENV,
|
|
4
4
|
monolithRequest,
|
|
5
5
|
setAgentCredentialSnapshot
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ITEQAMIZ.js";
|
|
7
7
|
import {
|
|
8
8
|
AppServerProcess,
|
|
9
9
|
buildCodexAgentEnv
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XQM2BWLW.js";
|
|
11
11
|
import {
|
|
12
12
|
CODEX_AUTH_ENV_KEYS,
|
|
13
13
|
CODEX_AUTH_ENV_KEYS_BY_METHOD,
|
|
14
14
|
codexAuthEnvFromResponse,
|
|
15
15
|
createErrorResult,
|
|
16
16
|
createSuccessResult
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HMIVYASC.js";
|
|
18
18
|
|
|
19
19
|
// src/managers/codex-token-manager.ts
|
|
20
20
|
import { promises as fs } from "fs";
|
|
@@ -230,7 +230,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
230
230
|
const data = await response.json();
|
|
231
231
|
await this.applyCredentialsResponse(data);
|
|
232
232
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
233
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
233
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-FCGPBXUC.js");
|
|
234
234
|
await restartCodexAspHostIfRunning2();
|
|
235
235
|
}
|
|
236
236
|
if (data.scope) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
HOOK_EXEC_MAX_BUFFER_BYTES,
|
|
4
4
|
isVersionBelow
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HMIVYASC.js";
|
|
6
6
|
|
|
7
7
|
// src/utils/codex-agent-env.ts
|
|
8
8
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -239,7 +239,7 @@ var DEFAULT_CODEX_ARGS = [
|
|
|
239
239
|
var MIN_CODEX_CLI_VERSION = "0.153.3";
|
|
240
240
|
var CODEX_UPGRADE_TIMEOUT_MS = 12e4;
|
|
241
241
|
var codexCliVersionEnsured = null;
|
|
242
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
242
|
+
var ENGINE_PACKAGE_VERSION = "0.1.744";
|
|
243
243
|
var INITIALIZE_METHOD = "initialize";
|
|
244
244
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
245
245
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
evaluateCommandProtection
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-52VN7BOE.js";
|
|
5
|
+
import "./chunk-ITEQAMIZ.js";
|
|
6
6
|
import {
|
|
7
7
|
isRecord
|
|
8
8
|
} from "./chunk-2RB7SIP3.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-HMIVYASC.js";
|
|
10
10
|
|
|
11
11
|
// src/command-protection-hook.ts
|
|
12
12
|
var provider = process.argv[2];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
evaluateCommandProtection
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-52VN7BOE.js";
|
|
5
5
|
import {
|
|
6
6
|
notifyPostToolUse
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-ZNKNSUIJ.js";
|
|
8
|
+
import "./chunk-ITEQAMIZ.js";
|
|
9
9
|
import "./chunk-2RB7SIP3.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-HMIVYASC.js";
|
|
11
11
|
|
|
12
12
|
// src/deepseek-command-protection-plugin.ts
|
|
13
13
|
function replicasCommandProtection(context) {
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
AppServerProcess,
|
|
8
8
|
buildCodexAgentEnv
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XQM2BWLW.js";
|
|
10
10
|
import {
|
|
11
11
|
AGENT,
|
|
12
12
|
getMemoryOutputSafetyViolation,
|
|
13
13
|
headlessAgentRequestSchema
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-HMIVYASC.js";
|
|
15
15
|
|
|
16
16
|
// src/headless-agent.ts
|
|
17
17
|
import { createHash } from "crypto";
|
package/dist/src/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
evaluateCommandProtection,
|
|
4
4
|
extractToolCommand,
|
|
5
5
|
reportCommandProtectionBlock
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-52VN7BOE.js";
|
|
7
7
|
import {
|
|
8
8
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
9
9
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -36,20 +36,20 @@ import {
|
|
|
36
36
|
recordCredentialFallback,
|
|
37
37
|
recordExhaustedCredential,
|
|
38
38
|
restartCodexAspHost
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-PY7C2DWR.js";
|
|
40
40
|
import {
|
|
41
41
|
ENGINE_ENV,
|
|
42
42
|
IS_WARMING_MODE,
|
|
43
43
|
monolithRequest,
|
|
44
44
|
monolithService,
|
|
45
45
|
setAgentCredentialSnapshot
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-ITEQAMIZ.js";
|
|
47
47
|
import {
|
|
48
48
|
AspClient,
|
|
49
49
|
SUBPROCESS_MAX_BUFFER,
|
|
50
50
|
execAsync,
|
|
51
51
|
execFileAsync
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-XQM2BWLW.js";
|
|
53
53
|
import {
|
|
54
54
|
isRecord as isRecord2
|
|
55
55
|
} from "./chunk-2RB7SIP3.js";
|
|
@@ -240,12 +240,12 @@ import {
|
|
|
240
240
|
shellQuotePosix,
|
|
241
241
|
stripAgentDiagnosticErrors,
|
|
242
242
|
withTimeout
|
|
243
|
-
} from "./chunk-
|
|
243
|
+
} from "./chunk-HMIVYASC.js";
|
|
244
244
|
|
|
245
245
|
// src/index.ts
|
|
246
246
|
import { serve } from "@hono/node-server";
|
|
247
247
|
import { Hono as Hono2 } from "hono";
|
|
248
|
-
import { existsSync as
|
|
248
|
+
import { existsSync as existsSync15 } from "fs";
|
|
249
249
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
250
250
|
import { connect } from "net";
|
|
251
251
|
|
|
@@ -14081,6 +14081,166 @@ var ChatService = class {
|
|
|
14081
14081
|
import { execFile } from "child_process";
|
|
14082
14082
|
import { readFile as readFile21 } from "fs/promises";
|
|
14083
14083
|
import { extname as extname2 } from "path";
|
|
14084
|
+
|
|
14085
|
+
// src/services/language-server-service.ts
|
|
14086
|
+
import { spawn as spawn7 } from "child_process";
|
|
14087
|
+
import { existsSync as existsSync12, readFileSync as readFileSync5 } from "fs";
|
|
14088
|
+
import { createRequire as createRequire2 } from "module";
|
|
14089
|
+
import { delimiter as delimiter2, dirname as dirname12, join as join31, relative as relative2 } from "path";
|
|
14090
|
+
import { setTimeout as setTimeout2 } from "timers/promises";
|
|
14091
|
+
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "url";
|
|
14092
|
+
import { createMessageConnection, StreamMessageReader, StreamMessageWriter } from "vscode-jsonrpc/node";
|
|
14093
|
+
var require3 = createRequire2(import.meta.url);
|
|
14094
|
+
var SERVER_TIMEOUT_MS = 1e4;
|
|
14095
|
+
var LANGUAGE_SERVERS = {
|
|
14096
|
+
typescript: { package: "typescript-language-server", bin: "typescript-language-server", args: ["--stdio"] },
|
|
14097
|
+
tsx: { package: "typescript-language-server", bin: "typescript-language-server", args: ["--stdio"], languageId: "typescriptreact" },
|
|
14098
|
+
javascript: { package: "typescript-language-server", bin: "typescript-language-server", args: ["--stdio"] },
|
|
14099
|
+
jsx: { package: "typescript-language-server", bin: "typescript-language-server", args: ["--stdio"], languageId: "javascriptreact" },
|
|
14100
|
+
python: { package: "pyright", bin: "pyright-langserver", args: ["--stdio"] },
|
|
14101
|
+
rust: { command: "rust-analyzer", args: [] },
|
|
14102
|
+
c: { command: "clangd", args: ["--background-index"] },
|
|
14103
|
+
cpp: { command: "clangd", args: ["--background-index"] },
|
|
14104
|
+
go: { command: "gopls", args: ["serve"] },
|
|
14105
|
+
ruby: { command: "solargraph", args: ["stdio"] },
|
|
14106
|
+
php: { command: "intelephense", args: ["--stdio"] },
|
|
14107
|
+
java: { command: "jdtls", args: [] },
|
|
14108
|
+
csharp: { command: "csharp-ls", args: [] },
|
|
14109
|
+
kotlin: { command: "kotlin-language-server", args: [] },
|
|
14110
|
+
lua: { command: "lua-language-server", args: [] },
|
|
14111
|
+
swift: { command: "sourcekit-lsp", args: [] },
|
|
14112
|
+
dart: { command: "dart", args: ["language-server", "--protocol=lsp"] },
|
|
14113
|
+
zig: { command: "zls", args: [] },
|
|
14114
|
+
terraform: { command: "terraform-ls", args: ["serve"] },
|
|
14115
|
+
toml: { command: "taplo", args: ["lsp", "stdio"] },
|
|
14116
|
+
bash: { package: "bash-language-server", bin: "bash-language-server", args: ["start"], languageId: "shellscript" },
|
|
14117
|
+
json: { package: "vscode-langservers-extracted", bin: "vscode-json-language-server", args: ["--stdio"] },
|
|
14118
|
+
html: { package: "vscode-langservers-extracted", bin: "vscode-html-language-server", args: ["--stdio"] },
|
|
14119
|
+
css: { package: "vscode-langservers-extracted", bin: "vscode-css-language-server", args: ["--stdio"] },
|
|
14120
|
+
scss: { package: "vscode-langservers-extracted", bin: "vscode-css-language-server", args: ["--stdio"] },
|
|
14121
|
+
less: { package: "vscode-langservers-extracted", bin: "vscode-css-language-server", args: ["--stdio"] },
|
|
14122
|
+
yaml: { package: "yaml-language-server", bin: "yaml-language-server", args: ["--stdio"] },
|
|
14123
|
+
dockerfile: { package: "dockerfile-language-server-nodejs", bin: "docker-langserver", args: ["--stdio"] }
|
|
14124
|
+
};
|
|
14125
|
+
function packageBin(packageName, binName) {
|
|
14126
|
+
const packageJsonPath = require3.resolve(`${packageName}/package.json`);
|
|
14127
|
+
const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf8"));
|
|
14128
|
+
const bin = typeof packageJson.bin === "string" ? packageJson.bin : packageJson.bin[binName];
|
|
14129
|
+
if (!bin) throw new Error(`Missing ${binName} binary`);
|
|
14130
|
+
return `${dirname12(packageJsonPath)}/${bin}`;
|
|
14131
|
+
}
|
|
14132
|
+
function markdownText(value) {
|
|
14133
|
+
if (typeof value === "string") return value;
|
|
14134
|
+
if (Array.isArray(value)) return value.map(markdownText).filter(Boolean).join("\n\n") || null;
|
|
14135
|
+
if (value && typeof value === "object" && "value" in value && typeof value.value === "string") return value.value;
|
|
14136
|
+
return null;
|
|
14137
|
+
}
|
|
14138
|
+
var LanguageServerClient = class {
|
|
14139
|
+
constructor(command, args, rootPath) {
|
|
14140
|
+
this.rootPath = rootPath;
|
|
14141
|
+
this.process = spawn7(command, args, {
|
|
14142
|
+
cwd: rootPath,
|
|
14143
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
14144
|
+
env: { ...process.env, ...command.includes("rust-analyzer") && { RA_LOG: "rust_analyzer=error" } }
|
|
14145
|
+
});
|
|
14146
|
+
if (process.env.REPLICAS_LSP_DEBUG) this.process.stderr.pipe(process.stderr);
|
|
14147
|
+
else this.process.stderr.resume();
|
|
14148
|
+
this.connection = createMessageConnection(
|
|
14149
|
+
new StreamMessageReader(this.process.stdout),
|
|
14150
|
+
new StreamMessageWriter(this.process.stdin)
|
|
14151
|
+
);
|
|
14152
|
+
this.connection.onRequest("workspace/workspaceFolders", () => [
|
|
14153
|
+
{ uri: pathToFileURL(this.rootPath).href, name: this.rootPath.split("/").at(-1) }
|
|
14154
|
+
]);
|
|
14155
|
+
this.connection.onRequest("workspace/configuration", (params) => Array.from({ length: params.items?.length ?? 0 }, () => null));
|
|
14156
|
+
this.connection.listen();
|
|
14157
|
+
this.ready = this.request("initialize", {
|
|
14158
|
+
processId: process.pid,
|
|
14159
|
+
rootUri: pathToFileURL(rootPath).href,
|
|
14160
|
+
capabilities: { textDocument: { hover: { contentFormat: ["markdown", "plaintext"] }, definition: { linkSupport: true } } },
|
|
14161
|
+
initializationOptions: command.includes("rust-analyzer") ? { cargo: { buildScripts: { enable: false }, noDeps: true }, procMacro: { enable: false }, check: { enable: false } } : {},
|
|
14162
|
+
workspaceFolders: [{ uri: pathToFileURL(rootPath).href, name: rootPath.split("/").at(-1) }]
|
|
14163
|
+
}).then(() => this.connection.sendNotification("initialized", {}));
|
|
14164
|
+
}
|
|
14165
|
+
rootPath;
|
|
14166
|
+
process;
|
|
14167
|
+
connection;
|
|
14168
|
+
opened = /* @__PURE__ */ new Map();
|
|
14169
|
+
ready;
|
|
14170
|
+
async inspect(filePath, languageId, content, line, character, action) {
|
|
14171
|
+
await this.ready;
|
|
14172
|
+
const uri = pathToFileURL(filePath).href;
|
|
14173
|
+
if (this.opened.get(uri) !== content) {
|
|
14174
|
+
if (this.opened.has(uri)) this.connection.sendNotification("textDocument/didChange", { textDocument: { uri, version: Date.now() }, contentChanges: [{ text: content }] });
|
|
14175
|
+
else this.connection.sendNotification("textDocument/didOpen", { textDocument: { uri, languageId, version: 1, text: content } });
|
|
14176
|
+
this.opened.set(uri, content);
|
|
14177
|
+
}
|
|
14178
|
+
return this.request(`textDocument/${action}`, {
|
|
14179
|
+
textDocument: { uri },
|
|
14180
|
+
position: { line: line - 1, character },
|
|
14181
|
+
...action === "references" && { context: { includeDeclaration: true } }
|
|
14182
|
+
});
|
|
14183
|
+
}
|
|
14184
|
+
request(method, params) {
|
|
14185
|
+
return Promise.race([
|
|
14186
|
+
this.connection.sendRequest(method, params),
|
|
14187
|
+
setTimeout2(SERVER_TIMEOUT_MS, void 0, { ref: false }).then(() => {
|
|
14188
|
+
throw new Error(`Language server timed out: ${method}`);
|
|
14189
|
+
})
|
|
14190
|
+
]);
|
|
14191
|
+
}
|
|
14192
|
+
dispose() {
|
|
14193
|
+
this.connection.dispose();
|
|
14194
|
+
this.process.kill();
|
|
14195
|
+
}
|
|
14196
|
+
};
|
|
14197
|
+
var LanguageServerService = class {
|
|
14198
|
+
clients = /* @__PURE__ */ new Map();
|
|
14199
|
+
async inspect(repoName, repoPath, filePath, content, line, character, action) {
|
|
14200
|
+
const language = detectLanguageByPath(filePath);
|
|
14201
|
+
const config = language ? LANGUAGE_SERVERS[language] : void 0;
|
|
14202
|
+
if (!language || !config) return null;
|
|
14203
|
+
const languageId = config.languageId ?? language;
|
|
14204
|
+
let command;
|
|
14205
|
+
if (config.package && config.bin) command = process.execPath;
|
|
14206
|
+
else if (config.command) {
|
|
14207
|
+
const commandName = config.command;
|
|
14208
|
+
command = process.env.PATH?.split(delimiter2).map((directory) => join31(directory, commandName)).find(existsSync12);
|
|
14209
|
+
}
|
|
14210
|
+
const args = config.package && config.bin ? [packageBin(config.package, config.bin), ...config.args] : config.args;
|
|
14211
|
+
if (!command) return null;
|
|
14212
|
+
const key = `${repoPath}:${languageId}`;
|
|
14213
|
+
let client2 = this.clients.get(key);
|
|
14214
|
+
if (!client2) {
|
|
14215
|
+
client2 = new LanguageServerClient(command, args, repoPath);
|
|
14216
|
+
this.clients.set(key, client2);
|
|
14217
|
+
}
|
|
14218
|
+
try {
|
|
14219
|
+
const result = await client2.inspect(filePath, languageId, content, line, character, action);
|
|
14220
|
+
if (action === "hover") {
|
|
14221
|
+
const detail = result && !Array.isArray(result) && "contents" in result ? markdownText(result.contents) : null;
|
|
14222
|
+
return detail ? { symbol: "", detail, documentation: null, locations: [], provider: "language-server" } : null;
|
|
14223
|
+
}
|
|
14224
|
+
const rawLocations = Array.isArray(result) ? result : result && ("uri" in result || "targetUri" in result) ? [result] : [];
|
|
14225
|
+
const locations = rawLocations.flatMap((location) => {
|
|
14226
|
+
const uri = "targetUri" in location ? location.targetUri : location.uri;
|
|
14227
|
+
const range = "targetSelectionRange" in location ? location.targetSelectionRange : location.range;
|
|
14228
|
+
const absolutePath = fileURLToPath4(uri);
|
|
14229
|
+
const path5 = relative2(repoPath, absolutePath);
|
|
14230
|
+
if (path5.startsWith("..")) return [];
|
|
14231
|
+
const preview = readFileSync5(absolutePath, "utf8").split("\n")[range.start.line]?.trim() ?? "";
|
|
14232
|
+
return [{ repoName, path: path5, line: range.start.line + 1, character: range.start.character, endCharacter: range.end.character, preview }];
|
|
14233
|
+
});
|
|
14234
|
+
return { symbol: "", detail: null, documentation: null, locations, provider: "language-server" };
|
|
14235
|
+
} catch {
|
|
14236
|
+
client2.dispose();
|
|
14237
|
+
this.clients.delete(key);
|
|
14238
|
+
return null;
|
|
14239
|
+
}
|
|
14240
|
+
}
|
|
14241
|
+
};
|
|
14242
|
+
|
|
14243
|
+
// src/services/repo-file-service.ts
|
|
14084
14244
|
var CACHE_TTL_MS = 3e4;
|
|
14085
14245
|
var SEARCH_TIMEOUT_MS = 15e3;
|
|
14086
14246
|
var DEFAULT_LIMIT = 50;
|
|
@@ -14162,6 +14322,7 @@ var RepoFileService = class {
|
|
|
14162
14322
|
gitService;
|
|
14163
14323
|
indexInflight = null;
|
|
14164
14324
|
writeLock = new AsyncLock();
|
|
14325
|
+
languageServers = new LanguageServerService();
|
|
14165
14326
|
constructor(gitService2) {
|
|
14166
14327
|
this.gitService = gitService2;
|
|
14167
14328
|
}
|
|
@@ -14307,6 +14468,52 @@ var RepoFileService = class {
|
|
|
14307
14468
|
}
|
|
14308
14469
|
});
|
|
14309
14470
|
}
|
|
14471
|
+
async inspectSymbol(repoName, filePath, line, character, action) {
|
|
14472
|
+
const resolved = await this.resolveFile(repoName, filePath);
|
|
14473
|
+
if (!resolved || line < 1 || character < 0 || isBinaryExtension(filePath)) return null;
|
|
14474
|
+
const content = await readFile21(resolved.fullPath, "utf8");
|
|
14475
|
+
const sourceLine = content.split("\n")[line - 1];
|
|
14476
|
+
if (sourceLine === void 0) return null;
|
|
14477
|
+
const symbolMatch = Array.from(sourceLine.matchAll(/[\p{L}_$][\p{L}\p{N}_$]*/gu)).find((match) => character >= match.index && character <= match.index + match[0].length);
|
|
14478
|
+
if (!symbolMatch) return { symbol: "", detail: null, documentation: null, locations: [], provider: "workspace" };
|
|
14479
|
+
const symbol = symbolMatch[0];
|
|
14480
|
+
const repo = (await this.gitService.listRepositories()).find((repository) => repository.name === repoName);
|
|
14481
|
+
if (!repo) return null;
|
|
14482
|
+
const languageServerResult = await this.languageServers.inspect(
|
|
14483
|
+
repoName,
|
|
14484
|
+
repo.path,
|
|
14485
|
+
resolved.fullPath,
|
|
14486
|
+
content,
|
|
14487
|
+
line,
|
|
14488
|
+
character,
|
|
14489
|
+
action
|
|
14490
|
+
);
|
|
14491
|
+
if (languageServerResult && (languageServerResult.detail || languageServerResult.locations.length > 0)) {
|
|
14492
|
+
return { ...languageServerResult, symbol };
|
|
14493
|
+
}
|
|
14494
|
+
let output = "";
|
|
14495
|
+
try {
|
|
14496
|
+
output = await execGitAsync(["grep", "-n", "-I", "-w", "--", symbol], repo.path, SEARCH_TIMEOUT_MS);
|
|
14497
|
+
} catch {
|
|
14498
|
+
return { symbol, detail: null, documentation: null, locations: [], provider: "workspace" };
|
|
14499
|
+
}
|
|
14500
|
+
const definitionPattern = new RegExp(`(?:class|interface|type|enum|function|def|fn|func|struct|trait|module|const|let|var|public|private|protected|static|async|export|[A-Za-z_$][\\w$<>?, .:*&[\\]]*)\\s+${symbol.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`);
|
|
14501
|
+
const locations = output.split("\n").flatMap((value) => {
|
|
14502
|
+
const match = value.match(/^(.+?):(\d+):(.*)$/);
|
|
14503
|
+
if (!match?.[1] || !match[2] || match[3] === void 0) return [];
|
|
14504
|
+
const matchCharacter = match[3].indexOf(symbol);
|
|
14505
|
+
return [{ repoName, path: match[1], line: Number(match[2]), character: Math.max(0, matchCharacter), endCharacter: Math.max(0, matchCharacter) + symbol.length, preview: match[3].trim() }];
|
|
14506
|
+
});
|
|
14507
|
+
const definitions = locations.filter((location) => definitionPattern.test(location.preview));
|
|
14508
|
+
const selected = action === "definition" ? definitions.slice(0, 20) : action === "references" ? locations.slice(0, 100) : [];
|
|
14509
|
+
return {
|
|
14510
|
+
symbol,
|
|
14511
|
+
detail: definitions[0]?.preview ?? `${locations.length} workspace reference${locations.length === 1 ? "" : "s"}`,
|
|
14512
|
+
documentation: null,
|
|
14513
|
+
locations: selected,
|
|
14514
|
+
provider: "workspace"
|
|
14515
|
+
};
|
|
14516
|
+
}
|
|
14310
14517
|
async resolveFile(repoName, filePath) {
|
|
14311
14518
|
if (filePath.includes("..") || filePath.startsWith("/")) return null;
|
|
14312
14519
|
const repo = (await this.gitService.listRepositories()).find((repository) => repository.name === repoName);
|
|
@@ -14381,9 +14588,9 @@ import { readdir as readdir11, stat as stat7, readFile as readFile24 } from "fs/
|
|
|
14381
14588
|
import { join as join34, resolve as resolve3 } from "path";
|
|
14382
14589
|
|
|
14383
14590
|
// src/services/warm-hooks-service.ts
|
|
14384
|
-
import { spawn as
|
|
14591
|
+
import { spawn as spawn8 } from "child_process";
|
|
14385
14592
|
import { readFile as readFile23 } from "fs/promises";
|
|
14386
|
-
import { existsSync as
|
|
14593
|
+
import { existsSync as existsSync13 } from "fs";
|
|
14387
14594
|
import { join as join33 } from "path";
|
|
14388
14595
|
|
|
14389
14596
|
// src/services/warm-hook-logs-service.ts
|
|
@@ -14505,7 +14712,7 @@ var warmHookLogsService = new WarmHookLogsService();
|
|
|
14505
14712
|
async function readRepoWarmHook(repoPath) {
|
|
14506
14713
|
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
14507
14714
|
const configPath = join33(repoPath, filename);
|
|
14508
|
-
if (!
|
|
14715
|
+
if (!existsSync13(configPath)) {
|
|
14509
14716
|
continue;
|
|
14510
14717
|
}
|
|
14511
14718
|
try {
|
|
@@ -14556,7 +14763,7 @@ async function executeHookScriptStreaming(params) {
|
|
|
14556
14763
|
params.onChunk(`$ ${params.label}
|
|
14557
14764
|
`);
|
|
14558
14765
|
return new Promise((resolve5) => {
|
|
14559
|
-
const proc =
|
|
14766
|
+
const proc = spawn8("bash", ["-lc", params.content], {
|
|
14560
14767
|
cwd: params.cwd,
|
|
14561
14768
|
env: process.env,
|
|
14562
14769
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -14766,8 +14973,8 @@ ${combinedScript}` : combinedScript;
|
|
|
14766
14973
|
|
|
14767
14974
|
// src/services/terminal-service.ts
|
|
14768
14975
|
import { randomUUID as randomUUID10 } from "crypto";
|
|
14769
|
-
import { existsSync as
|
|
14770
|
-
import { spawn as
|
|
14976
|
+
import { existsSync as existsSync14 } from "fs";
|
|
14977
|
+
import { spawn as spawn9 } from "node-pty";
|
|
14771
14978
|
var MAX_REPLAY_CHARS = 1024 * 1024;
|
|
14772
14979
|
var MAX_TERMINAL_SESSIONS = 8;
|
|
14773
14980
|
var MAX_PENDING_INPUT = 64;
|
|
@@ -14785,8 +14992,8 @@ var TerminalService = class {
|
|
|
14785
14992
|
});
|
|
14786
14993
|
}
|
|
14787
14994
|
const id = randomUUID10();
|
|
14788
|
-
const shell = process.env.SHELL &&
|
|
14789
|
-
const pty =
|
|
14995
|
+
const shell = process.env.SHELL && existsSync14(process.env.SHELL) ? process.env.SHELL : "/bin/bash";
|
|
14996
|
+
const pty = spawn9(shell, ["-l"], {
|
|
14790
14997
|
name: "xterm-256color",
|
|
14791
14998
|
cols,
|
|
14792
14999
|
rows,
|
|
@@ -15319,6 +15526,19 @@ function createV1Routes(deps) {
|
|
|
15319
15526
|
if (!result) return c.json(jsonError("File is not editable"), 400);
|
|
15320
15527
|
return c.json(result);
|
|
15321
15528
|
});
|
|
15529
|
+
app2.get("/repo-files/symbol", async (c) => {
|
|
15530
|
+
const repoName = c.req.query("repoName");
|
|
15531
|
+
const path5 = c.req.query("path");
|
|
15532
|
+
const action = c.req.query("action");
|
|
15533
|
+
const line = Number(c.req.query("line"));
|
|
15534
|
+
const character = Number(c.req.query("character"));
|
|
15535
|
+
if (!repoName || !path5 || action !== "hover" && action !== "definition" && action !== "references" || !Number.isInteger(line) || !Number.isInteger(character)) {
|
|
15536
|
+
return c.json(jsonError("Invalid symbol request"), 400);
|
|
15537
|
+
}
|
|
15538
|
+
const result = await deps.repoFileService.inspectSymbol(repoName, path5, line, character, action);
|
|
15539
|
+
if (!result) return c.json(jsonError("Symbol not found"), 404);
|
|
15540
|
+
return c.json(result);
|
|
15541
|
+
});
|
|
15322
15542
|
app2.get("/terminal/sessions", (c) => {
|
|
15323
15543
|
return c.json({ sessions: terminalService.list() });
|
|
15324
15544
|
});
|
|
@@ -15867,10 +16087,10 @@ var heartbeatService = new HeartbeatService();
|
|
|
15867
16087
|
|
|
15868
16088
|
// src/services/workspace-sdk-service.ts
|
|
15869
16089
|
import { cp, mkdir as mkdir22 } from "fs/promises";
|
|
15870
|
-
import { dirname as
|
|
15871
|
-
import { fileURLToPath as
|
|
16090
|
+
import { dirname as dirname13, resolve as resolve4 } from "path";
|
|
16091
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
15872
16092
|
async function installWorkspaceSdk() {
|
|
15873
|
-
const source = resolve4(
|
|
16093
|
+
const source = resolve4(dirname13(fileURLToPath5(import.meta.url)), "../../workspace-sdk");
|
|
15874
16094
|
const targets = [
|
|
15875
16095
|
resolve4(ENGINE_ENV.HOME_DIR, "node_modules/@replicas/sdk"),
|
|
15876
16096
|
"/tmp/node_modules/@replicas/sdk"
|
|
@@ -15904,7 +16124,7 @@ async function timeStartupStep(name, fn) {
|
|
|
15904
16124
|
async function waitForInitializationGate() {
|
|
15905
16125
|
if (!ENGINE_ENV.REPLICAS_ENGINE_DEFER_INITIALIZATION) return;
|
|
15906
16126
|
const deadline = Date.now() + ENGINE_INIT_GATE_TIMEOUT_MS;
|
|
15907
|
-
while (!
|
|
16127
|
+
while (!existsSync15(SANDBOX_PATHS.ENGINE_INIT_GATE)) {
|
|
15908
16128
|
if (Date.now() >= deadline) {
|
|
15909
16129
|
throw new Error("Timed out waiting for deferred engine initialization gate");
|
|
15910
16130
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
notifyPostToolUse
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZNKNSUIJ.js";
|
|
5
5
|
import {
|
|
6
6
|
isRecord
|
|
7
7
|
} from "./chunk-2RB7SIP3.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-HMIVYASC.js";
|
|
9
9
|
|
|
10
10
|
// src/post-tool-pr-hook.ts
|
|
11
11
|
async function main() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replicas-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.744",
|
|
4
4
|
"description": "Lightweight API server for Replicas workspaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -48,11 +48,19 @@
|
|
|
48
48
|
"@earendil-works/pi-coding-agent": "0.79.0",
|
|
49
49
|
"@hono/node-server": "^1.19.5",
|
|
50
50
|
"@opencode-ai/sdk": "1.17.9",
|
|
51
|
+
"bash-language-server": "^5.6.0",
|
|
52
|
+
"dockerfile-language-server-nodejs": "^0.14.1",
|
|
51
53
|
"hono": "^4.10.3",
|
|
52
54
|
"opencode-ai": "1.17.9",
|
|
55
|
+
"pyright": "^1.1.413",
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"typescript-language-server": "^4.4.1",
|
|
53
58
|
"undici": "7.29.0",
|
|
59
|
+
"vscode-jsonrpc": "^8.2.0",
|
|
60
|
+
"vscode-langservers-extracted": "^4.10.0",
|
|
54
61
|
"ws": "8.21.0",
|
|
55
62
|
"yaml": "^2.8.2",
|
|
63
|
+
"yaml-language-server": "^1.19.2",
|
|
56
64
|
"zod": "^4.0.0"
|
|
57
65
|
},
|
|
58
66
|
"optionalDependencies": {
|
|
@@ -64,7 +72,6 @@
|
|
|
64
72
|
"@types/node": "^20.11.17",
|
|
65
73
|
"@types/ws": "8.18.1",
|
|
66
74
|
"tsup": "^8.5.0",
|
|
67
|
-
"tsx": "^4.7.1"
|
|
68
|
-
"typescript": "^5.8.3"
|
|
75
|
+
"tsx": "^4.7.1"
|
|
69
76
|
}
|
|
70
77
|
}
|