replicas-engine 0.1.950 → 0.1.953
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-3SHV7Q4E.js → asp-host-AA37PZM6.js} +5 -5
- package/dist/src/{chunk-IXZN2VGZ.js → chunk-2E6P3M5D.js} +1 -1
- package/dist/src/{chunk-4W7QCOK3.js → chunk-3KHBTUNG.js} +1 -1
- package/dist/src/{chunk-QUT2FT6T.js → chunk-7QZTRTVH.js} +1 -1
- package/dist/src/{chunk-7EHG3T5K.js → chunk-AUCJ3CV7.js} +1 -1
- package/dist/src/{chunk-L4CL5EW7.js → chunk-FOFVCA44.js} +3 -3
- package/dist/src/{chunk-CTJLUGT2.js → chunk-G2GE3X7J.js} +64 -53
- package/dist/src/{chunk-POXHHD3Q.js → chunk-KIGE3Z2O.js} +6 -6
- package/dist/src/{chunk-RCUQHNVE.js → chunk-ZMIWCS6O.js} +3 -3
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +3 -3
- package/dist/src/index.js +48 -20
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/relay-mcp.js +2 -2
- package/package.json +1 -1
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
getCodexAspHost,
|
|
6
6
|
restartCodexAspHost,
|
|
7
7
|
restartCodexAspHostIfRunning
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-KIGE3Z2O.js";
|
|
9
|
+
import "./chunk-2E6P3M5D.js";
|
|
10
|
+
import "./chunk-FOFVCA44.js";
|
|
11
|
+
import "./chunk-7QZTRTVH.js";
|
|
12
12
|
import "./chunk-UZSNFLDQ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-G2GE3X7J.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
export {
|
|
16
16
|
getCodexAspHost,
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
HOOK_EXEC_MAX_BUFFER_BYTES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G2GE3X7J.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
RELAY_MCP_TOOL_NAMES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G2GE3X7J.js";
|
|
7
7
|
|
|
8
8
|
// src/managers/relay-mcp-config.ts
|
|
9
9
|
import { existsSync } from "fs";
|
|
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
execFileAsync
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7QZTRTVH.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-G2GE3X7J.js";
|
|
10
10
|
|
|
11
11
|
// src/utils/codex-agent-env.ts
|
|
12
12
|
function buildCodexAgentEnv(source = process.env) {
|
|
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
|
|
|
240
240
|
if (method === "foundry") return "azure";
|
|
241
241
|
return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
|
|
242
242
|
}
|
|
243
|
-
var ENGINE_PACKAGE_VERSION = "0.1.
|
|
243
|
+
var ENGINE_PACKAGE_VERSION = "0.1.953";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -1030,12 +1030,14 @@ function coerceClaudePartialMessagePayload(payload) {
|
|
|
1030
1030
|
const parentToolUseId = payload.parent_tool_use_id;
|
|
1031
1031
|
const text2 = typeof payload.text === "string" && payload.text ? payload.text : void 0;
|
|
1032
1032
|
const thinking = typeof payload.thinking === "string" && payload.thinking ? payload.thinking : void 0;
|
|
1033
|
-
|
|
1033
|
+
const tool = isRecord(payload.tool) && typeof payload.tool.id === "string" && typeof payload.tool.name === "string" ? typeof payload.tool.filePath === "string" ? { id: payload.tool.id, name: payload.tool.name, filePath: payload.tool.filePath } : typeof payload.tool.command === "string" ? { id: payload.tool.id, name: payload.tool.name, command: payload.tool.command } : void 0 : void 0;
|
|
1034
|
+
if (!text2 && !thinking && !tool) return null;
|
|
1034
1035
|
return {
|
|
1035
1036
|
streamId,
|
|
1036
1037
|
parent_tool_use_id: typeof parentToolUseId === "string" ? parentToolUseId : null,
|
|
1037
1038
|
...text2 ? { text: text2 } : {},
|
|
1038
1039
|
...thinking ? { thinking } : {},
|
|
1040
|
+
...tool ? { tool } : {},
|
|
1039
1041
|
status: payload.status === "completed" ? "completed" : "in_progress"
|
|
1040
1042
|
};
|
|
1041
1043
|
}
|
|
@@ -1813,12 +1815,14 @@ async function readSseStream(body, onEvent, shouldContinue = () => true) {
|
|
|
1813
1815
|
// ../shared/src/workspace-identity.ts
|
|
1814
1816
|
import { z as z5 } from "zod";
|
|
1815
1817
|
var WORKSPACE_IDENTITY_AUDIENCE = "replicas:workspace";
|
|
1818
|
+
var AWS_SOURCE_IDENTITY_CLAIM = "https://aws.amazon.com/source_identity";
|
|
1816
1819
|
var WORKSPACE_TOKEN_TTL_SECONDS = 15 * 60;
|
|
1817
1820
|
var IDENTITY_PROXY_PORT = 17323;
|
|
1818
1821
|
var IDENTITY_TOKEN_PATH = "/token";
|
|
1819
1822
|
var workspaceAudienceSchema = z5.string().min(1).max(255).regex(/^[\x21-\x7e]+$/, "Audience must be a single printable token without spaces");
|
|
1820
1823
|
var workspaceTokenRequestSchema = z5.object({
|
|
1821
|
-
audience: workspaceAudienceSchema.optional()
|
|
1824
|
+
audience: workspaceAudienceSchema.optional(),
|
|
1825
|
+
aws_source_identity: z5.boolean().optional()
|
|
1822
1826
|
});
|
|
1823
1827
|
var workspaceTokenClaimsSchema = z5.object({
|
|
1824
1828
|
iss: z5.string(),
|
|
@@ -1832,7 +1836,8 @@ var workspaceTokenClaimsSchema = z5.object({
|
|
|
1832
1836
|
workspace_id: z5.string().uuid(),
|
|
1833
1837
|
environment_id: z5.string().uuid(),
|
|
1834
1838
|
creator_id: z5.string().uuid().nullable(),
|
|
1835
|
-
creator_email: z5.string().nullable().default(null)
|
|
1839
|
+
creator_email: z5.string().nullable().default(null),
|
|
1840
|
+
[AWS_SOURCE_IDENTITY_CLAIM]: z5.string().uuid().optional()
|
|
1836
1841
|
}).passthrough();
|
|
1837
1842
|
var workspaceTokenResponseSchema = z5.object({
|
|
1838
1843
|
issuer: z5.string(),
|
|
@@ -4451,7 +4456,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
|
|
|
4451
4456
|
| \`replicas whoami\` | Print the workspace + org identity |
|
|
4452
4457
|
| \`replicas identity token [--audience <aud>]\` | Print the current short-lived workspace identity token for an audience |
|
|
4453
4458
|
| \`replicas identity token --format gcp --audience <aud>\` | Supply a current token to Google's executable credential source |
|
|
4454
|
-
| \`replicas identity aws-credentials --role-arn <arn> [--region <region>]\` | Exchange the current token for AWS credential_process JSON (requires AWS CLI) |
|
|
4459
|
+
| \`replicas identity aws-credentials --role-arn <arn> [--region <region>] [--source-identity]\` | Exchange the current token for AWS credential_process JSON (requires AWS CLI); \`--source-identity\` records the workspace ID in CloudTrail and needs \`sts:SetSourceIdentity\` in the role trust policy |
|
|
4455
4460
|
| \`replicas identity exec [--audience <aud>] -- <command>\` | Run a command with the current token and audience in its environment |
|
|
4456
4461
|
| \`replicas init\` | Create a \`replicas.json\` / \`replicas.yaml\` in the current directory |
|
|
4457
4462
|
| \`replicas connect <name>\` | SSH into another workspace (requires user creds \u2014 usually only useful when scripting locally) |
|
|
@@ -6138,6 +6143,51 @@ function parseMcpToolName(name) {
|
|
|
6138
6143
|
|
|
6139
6144
|
// ../shared/src/display-message/parsers/claude-parser.ts
|
|
6140
6145
|
var ABORTED_TERMINAL_REASONS = /* @__PURE__ */ new Set(["aborted_streaming", "aborted_tools"]);
|
|
6146
|
+
var COMMAND_TOOL_NAMES = /* @__PURE__ */ new Set(["Bash", "bash", "shell"]);
|
|
6147
|
+
var FILE_TOOL_NAMES = /* @__PURE__ */ new Set(["Write", "Edit"]);
|
|
6148
|
+
function fileOrCommandMessage(toolName, toolUseId, input, timestamp) {
|
|
6149
|
+
if (COMMAND_TOOL_NAMES.has(toolName)) {
|
|
6150
|
+
const command = typeof input.command === "string" ? input.command : "";
|
|
6151
|
+
const skillNames = skillNamesFromCommand(command);
|
|
6152
|
+
return {
|
|
6153
|
+
id: `command-${toolUseId}`,
|
|
6154
|
+
type: "command",
|
|
6155
|
+
command,
|
|
6156
|
+
...skillNames.length > 0 ? { skillNames } : {},
|
|
6157
|
+
output: "",
|
|
6158
|
+
status: "in_progress",
|
|
6159
|
+
timestamp
|
|
6160
|
+
};
|
|
6161
|
+
}
|
|
6162
|
+
const filePath = typeof input.file_path === "string" ? input.file_path : "";
|
|
6163
|
+
let diff;
|
|
6164
|
+
if (toolName === "Edit" && typeof input.old_string === "string" && typeof input.new_string === "string") {
|
|
6165
|
+
const oldLines = input.old_string.replace(/\n$/, "").split("\n");
|
|
6166
|
+
const newLines = input.new_string.replace(/\n$/, "").split("\n");
|
|
6167
|
+
diff = [
|
|
6168
|
+
`--- a/${filePath}`,
|
|
6169
|
+
`+++ b/${filePath}`,
|
|
6170
|
+
`@@ -1,${oldLines.length} +1,${newLines.length} @@`,
|
|
6171
|
+
...oldLines.map((l) => `-${l}`),
|
|
6172
|
+
...newLines.map((l) => `+${l}`)
|
|
6173
|
+
].join("\n");
|
|
6174
|
+
} else if (toolName === "Write" && typeof input.content === "string") {
|
|
6175
|
+
const newLines = input.content.replace(/\n$/, "").split("\n");
|
|
6176
|
+
diff = [
|
|
6177
|
+
`--- /dev/null`,
|
|
6178
|
+
`+++ b/${filePath}`,
|
|
6179
|
+
`@@ -0,0 +1,${newLines.length} @@`,
|
|
6180
|
+
...newLines.map((l) => `+${l}`)
|
|
6181
|
+
].join("\n");
|
|
6182
|
+
}
|
|
6183
|
+
return {
|
|
6184
|
+
id: `patch-${toolUseId}`,
|
|
6185
|
+
type: "patch",
|
|
6186
|
+
operations: [{ action: toolName === "Write" ? "add" : "update", path: filePath, diff }],
|
|
6187
|
+
status: "in_progress",
|
|
6188
|
+
timestamp
|
|
6189
|
+
};
|
|
6190
|
+
}
|
|
6141
6191
|
function createSubagentMessage(messageIndex, timestamp, fields) {
|
|
6142
6192
|
const { id = `subagent-${timestamp}-${messageIndex}`, ...message } = fields;
|
|
6143
6193
|
return { id, type: "subagent", ...message, timestamp };
|
|
@@ -6174,6 +6224,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6174
6224
|
const workflowAgentMessageMap = /* @__PURE__ */ new Map();
|
|
6175
6225
|
const ambientTaskIds = /* @__PURE__ */ new Set();
|
|
6176
6226
|
const partialIndexes = /* @__PURE__ */ new Map();
|
|
6227
|
+
const streamingTools = /* @__PURE__ */ new Map();
|
|
6177
6228
|
const completedStreamIds = /* @__PURE__ */ new Set();
|
|
6178
6229
|
const supersededStreamIds = /* @__PURE__ */ new Set();
|
|
6179
6230
|
let liveStreamId = null;
|
|
@@ -6251,6 +6302,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6251
6302
|
if (existing.agent !== void 0) messages[existing.agent] = agentMessage;
|
|
6252
6303
|
else existing.agent = messages.push(agentMessage) - 1;
|
|
6253
6304
|
}
|
|
6305
|
+
if (payload.tool) streamingTools.set(payload.streamId, { tool: payload.tool, timestamp: event.timestamp });
|
|
6254
6306
|
partialIndexes.set(payload.streamId, existing);
|
|
6255
6307
|
return;
|
|
6256
6308
|
}
|
|
@@ -6377,56 +6429,9 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6377
6429
|
status: "in_progress",
|
|
6378
6430
|
nestedEvents
|
|
6379
6431
|
}));
|
|
6380
|
-
} else if (toolName
|
|
6381
|
-
const inputObj = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
6382
|
-
const command = inputObj.command || "";
|
|
6383
|
-
const skillNames = skillNamesFromCommand(command);
|
|
6384
|
-
messages.push({
|
|
6385
|
-
id: `command-${event.timestamp}-${messages.length}`,
|
|
6386
|
-
type: "command",
|
|
6387
|
-
command,
|
|
6388
|
-
...skillNames.length > 0 ? { skillNames } : {},
|
|
6389
|
-
output: "",
|
|
6390
|
-
status: "in_progress",
|
|
6391
|
-
timestamp: event.timestamp
|
|
6392
|
-
});
|
|
6393
|
-
} else if (toolName === "Write" || toolName === "Edit") {
|
|
6432
|
+
} else if (COMMAND_TOOL_NAMES.has(toolName) || FILE_TOOL_NAMES.has(toolName)) {
|
|
6394
6433
|
const inputObj = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
6395
|
-
|
|
6396
|
-
const action = toolName === "Write" ? "add" : "update";
|
|
6397
|
-
let diff;
|
|
6398
|
-
if (toolName === "Edit" && inputObj.old_string != null && inputObj.new_string != null) {
|
|
6399
|
-
const oldLines = inputObj.old_string.replace(/\n$/, "").split("\n");
|
|
6400
|
-
const newLines = inputObj.new_string.replace(/\n$/, "").split("\n");
|
|
6401
|
-
const hunk = `@@ -1,${oldLines.length} +1,${newLines.length} @@`;
|
|
6402
|
-
diff = [
|
|
6403
|
-
`--- a/${filePath}`,
|
|
6404
|
-
`+++ b/${filePath}`,
|
|
6405
|
-
hunk,
|
|
6406
|
-
...oldLines.map((l) => `-${l}`),
|
|
6407
|
-
...newLines.map((l) => `+${l}`)
|
|
6408
|
-
].join("\n");
|
|
6409
|
-
} else if (toolName === "Write" && inputObj.content != null) {
|
|
6410
|
-
const newLines = inputObj.content.replace(/\n$/, "").split("\n");
|
|
6411
|
-
const hunk = `@@ -0,0 +1,${newLines.length} @@`;
|
|
6412
|
-
diff = [
|
|
6413
|
-
`--- /dev/null`,
|
|
6414
|
-
`+++ b/${filePath}`,
|
|
6415
|
-
hunk,
|
|
6416
|
-
...newLines.map((l) => `+${l}`)
|
|
6417
|
-
].join("\n");
|
|
6418
|
-
}
|
|
6419
|
-
messages.push({
|
|
6420
|
-
id: `patch-${event.timestamp}-${messages.length}`,
|
|
6421
|
-
type: "patch",
|
|
6422
|
-
operations: [{
|
|
6423
|
-
action,
|
|
6424
|
-
path: filePath,
|
|
6425
|
-
diff
|
|
6426
|
-
}],
|
|
6427
|
-
status: "in_progress",
|
|
6428
|
-
timestamp: event.timestamp
|
|
6429
|
-
});
|
|
6434
|
+
messages.push(fileOrCommandMessage(toolName, toolUseId, inputObj, event.timestamp));
|
|
6430
6435
|
} else if (toolName === "TaskCreate" || toolName === "TaskUpdate" || toolName === "TaskList") {
|
|
6431
6436
|
taskAccumulator.processContentBlock(block);
|
|
6432
6437
|
const snapshot = taskSnapshot();
|
|
@@ -6606,6 +6611,11 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6606
6611
|
};
|
|
6607
6612
|
}
|
|
6608
6613
|
});
|
|
6614
|
+
for (const [streamId, { tool, timestamp }] of streamingTools) {
|
|
6615
|
+
if (toolCallMap.has(tool.id) || supersededStreamIds.has(streamId)) continue;
|
|
6616
|
+
if (!COMMAND_TOOL_NAMES.has(tool.name) && !FILE_TOOL_NAMES.has(tool.name)) continue;
|
|
6617
|
+
messages.push(fileOrCommandMessage(tool.name, tool.id, "filePath" in tool ? { file_path: tool.filePath } : { command: tool.command }, timestamp));
|
|
6618
|
+
}
|
|
6609
6619
|
filteredEvents.forEach((event) => {
|
|
6610
6620
|
if (event.type === "claude-user") {
|
|
6611
6621
|
const content = normalizeContentBlocks(event.payload.message?.content);
|
|
@@ -9118,6 +9128,7 @@ export {
|
|
|
9118
9128
|
parseFrontmatter,
|
|
9119
9129
|
isSkillRegistryManifest,
|
|
9120
9130
|
WORKSPACE_IDENTITY_AUDIENCE,
|
|
9131
|
+
AWS_SOURCE_IDENTITY_CLAIM,
|
|
9121
9132
|
IDENTITY_PROXY_PORT,
|
|
9122
9133
|
IDENTITY_TOKEN_PATH,
|
|
9123
9134
|
workspaceAudienceSchema,
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
ENGINE_ENV,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
setAgentCredentialSnapshot
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2E6P3M5D.js";
|
|
9
9
|
import {
|
|
10
10
|
AppServerProcess,
|
|
11
11
|
buildCodexAgentEnv
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FOFVCA44.js";
|
|
13
13
|
import {
|
|
14
14
|
SUBPROCESS_MAX_BUFFER,
|
|
15
15
|
execFileAsync
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-7QZTRTVH.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
19
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
listOpenAICompatibleModels,
|
|
28
28
|
readOllamaAuthEnv,
|
|
29
29
|
resolveOpenAICompatibleModelsUrl
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-G2GE3X7J.js";
|
|
31
31
|
|
|
32
32
|
// src/managers/codex-token-manager.ts
|
|
33
33
|
import { promises as fs } from "fs";
|
|
@@ -260,7 +260,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
260
260
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
261
261
|
await this.applyCredentialsResponse(data);
|
|
262
262
|
setAgentCredentialSnapshot("codex", data);
|
|
263
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
263
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-AA37PZM6.js");
|
|
264
264
|
await restartCodexAspHostIfRunning2();
|
|
265
265
|
});
|
|
266
266
|
await this.start(true);
|
|
@@ -280,7 +280,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
280
280
|
await this.applyCredentialUpdate(generation, async () => {
|
|
281
281
|
await this.applyCredentialsResponse(data);
|
|
282
282
|
if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
|
|
283
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
283
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-AA37PZM6.js");
|
|
284
284
|
await restartCodexAspHostIfRunning2();
|
|
285
285
|
}
|
|
286
286
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -3,18 +3,18 @@ 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-2E6P3M5D.js";
|
|
7
7
|
import {
|
|
8
8
|
SUBPROCESS_MAX_BUFFER,
|
|
9
9
|
execFileAsync
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7QZTRTVH.js";
|
|
11
11
|
import {
|
|
12
12
|
extractCommandProtectionCommandText,
|
|
13
13
|
findCommandProtectionGitLookups,
|
|
14
14
|
findGitCommitSignals,
|
|
15
15
|
findPrMergeSignals,
|
|
16
16
|
parseCommandProtectionRequest
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-G2GE3X7J.js";
|
|
18
18
|
|
|
19
19
|
// src/services/command-protection-service.ts
|
|
20
20
|
import { readFile, stat } from "fs/promises";
|
|
@@ -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-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-ZMIWCS6O.js";
|
|
7
|
+
import "./chunk-2E6P3M5D.js";
|
|
8
|
+
import "./chunk-7QZTRTVH.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-G2GE3X7J.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
AppServerProcess,
|
|
10
10
|
buildCodexAgentEnv
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-FOFVCA44.js";
|
|
12
|
+
import "./chunk-7QZTRTVH.js";
|
|
13
13
|
import {
|
|
14
14
|
AGENT,
|
|
15
15
|
getMemoryOutputSafetyViolation,
|
|
16
16
|
headlessAgentRequestSchema
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-G2GE3X7J.js";
|
|
18
18
|
import "./chunk-VEQXQN22.js";
|
|
19
19
|
|
|
20
20
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
reportCommandProtectionBlock,
|
|
33
33
|
resolveDiffBase,
|
|
34
34
|
runGitCommand
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ZMIWCS6O.js";
|
|
36
36
|
import {
|
|
37
37
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
38
38
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -57,12 +57,12 @@ import {
|
|
|
57
57
|
} from "./chunk-FLDA7BX3.js";
|
|
58
58
|
import {
|
|
59
59
|
publishedPullRequestUrls
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-3KHBTUNG.js";
|
|
61
61
|
import {
|
|
62
62
|
RELAY_MCP_TOOL_TIMEOUT_MS,
|
|
63
63
|
relayCodexMcpConfig,
|
|
64
64
|
relayMcpProcessConfig
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-AUCJ3CV7.js";
|
|
66
66
|
import {
|
|
67
67
|
BaseRefreshManager,
|
|
68
68
|
CodexAspAuthMethodChangedError,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
refreshDelayMs,
|
|
78
78
|
restartCodexAspHost,
|
|
79
79
|
routineRefreshExclusions
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-KIGE3Z2O.js";
|
|
81
81
|
import {
|
|
82
82
|
ENGINE_ENV,
|
|
83
83
|
monolithRequest,
|
|
@@ -85,16 +85,16 @@ import {
|
|
|
85
85
|
readRuntimeEnvFile,
|
|
86
86
|
reloadEngineEnv,
|
|
87
87
|
setAgentCredentialSnapshot
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-2E6P3M5D.js";
|
|
89
89
|
import {
|
|
90
90
|
AspClient,
|
|
91
91
|
getCodexModelProvider
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-FOFVCA44.js";
|
|
93
93
|
import {
|
|
94
94
|
SUBPROCESS_MAX_BUFFER,
|
|
95
95
|
execAsync,
|
|
96
96
|
execFileAsync
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-7QZTRTVH.js";
|
|
98
98
|
import {
|
|
99
99
|
isRecord as isRecord2
|
|
100
100
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -110,6 +110,7 @@ import {
|
|
|
110
110
|
ASTER_PROVIDER,
|
|
111
111
|
AUTH_FALLBACK_EVENT_TYPE,
|
|
112
112
|
AUTH_RETRY_STATUS_EVENT_TYPE,
|
|
113
|
+
AWS_SOURCE_IDENTITY_CLAIM,
|
|
113
114
|
CHAT_FORK_EXCERPT_OMITTED_NOTICE,
|
|
114
115
|
CHAT_GOAL_EVENT_TYPE,
|
|
115
116
|
CHAT_INTERRUPTED_EVENT_TYPE,
|
|
@@ -326,7 +327,7 @@ import {
|
|
|
326
327
|
workspaceCredentialProviderSchema,
|
|
327
328
|
workspaceTokenRequestSchema,
|
|
328
329
|
workspaceTokenResponseSchema
|
|
329
|
-
} from "./chunk-
|
|
330
|
+
} from "./chunk-G2GE3X7J.js";
|
|
330
331
|
import {
|
|
331
332
|
cloneMcpConfig,
|
|
332
333
|
ensureCompatibilityImports,
|
|
@@ -9596,24 +9597,25 @@ var WorkspaceIdentityTokens = class {
|
|
|
9596
9597
|
request;
|
|
9597
9598
|
cache = /* @__PURE__ */ new Map();
|
|
9598
9599
|
inflight = /* @__PURE__ */ new Map();
|
|
9599
|
-
async get(audience = WORKSPACE_IDENTITY_AUDIENCE) {
|
|
9600
|
+
async get(audience = WORKSPACE_IDENTITY_AUDIENCE, awsSourceIdentity = false) {
|
|
9600
9601
|
const parsed = workspaceAudienceSchema.safeParse(audience);
|
|
9601
9602
|
if (!parsed.success) {
|
|
9602
9603
|
return createErrorResult({ message: parsed.error.issues[0]?.message ?? "Invalid audience", code: 400 });
|
|
9603
9604
|
}
|
|
9604
|
-
const
|
|
9605
|
+
const key = awsSourceIdentity ? `${audience} aws_source_identity` : audience;
|
|
9606
|
+
const cached = this.cache.get(key);
|
|
9605
9607
|
if (cached && Date.parse(cached.expires_at) - Date.now() > MIN_REMAINING_MS) return createSuccessResult(cached);
|
|
9606
|
-
let pending = this.inflight.get(
|
|
9608
|
+
let pending = this.inflight.get(key);
|
|
9607
9609
|
if (!pending) {
|
|
9608
|
-
pending = this.mint(audience).finally(() => this.inflight.delete(
|
|
9609
|
-
this.inflight.set(
|
|
9610
|
+
pending = this.mint(audience, awsSourceIdentity, key).finally(() => this.inflight.delete(key));
|
|
9611
|
+
this.inflight.set(key, pending);
|
|
9610
9612
|
}
|
|
9611
9613
|
return pending;
|
|
9612
9614
|
}
|
|
9613
|
-
async mint(audience) {
|
|
9615
|
+
async mint(audience, awsSourceIdentity, key) {
|
|
9614
9616
|
let response;
|
|
9615
9617
|
try {
|
|
9616
|
-
response = await this.request("/v1/engine/workspace-identity/token", { body: { audience } });
|
|
9618
|
+
response = await this.request("/v1/engine/workspace-identity/token", { body: { audience, aws_source_identity: awsSourceIdentity } });
|
|
9617
9619
|
} catch (error) {
|
|
9618
9620
|
return createErrorResult({ message: error instanceof Error ? error.message : "Workspace identity request failed", code: 503 });
|
|
9619
9621
|
}
|
|
@@ -9630,10 +9632,16 @@ var WorkspaceIdentityTokens = class {
|
|
|
9630
9632
|
if (!token) {
|
|
9631
9633
|
return createErrorResult({ message: `Workspace identity token for ${audience} is unavailable from this Replicas version`, code: 503 });
|
|
9632
9634
|
}
|
|
9633
|
-
|
|
9635
|
+
if (awsSourceIdentity) {
|
|
9636
|
+
const payload = JSON.parse(Buffer.from(token.token.split(".")[1] ?? "", "base64url").toString() || "null");
|
|
9637
|
+
if (!isRecord(payload) || typeof payload[AWS_SOURCE_IDENTITY_CLAIM] !== "string") {
|
|
9638
|
+
return createErrorResult({ message: "AWS source identity is unavailable from this Replicas version", code: 503 });
|
|
9639
|
+
}
|
|
9640
|
+
}
|
|
9641
|
+
this.cache.delete(key);
|
|
9634
9642
|
const oldest = this.cache.keys().next();
|
|
9635
9643
|
if (this.cache.size >= MAX_CACHED_AUDIENCES && !oldest.done) this.cache.delete(oldest.value);
|
|
9636
|
-
this.cache.set(
|
|
9644
|
+
this.cache.set(key, token);
|
|
9637
9645
|
return createSuccessResult(token);
|
|
9638
9646
|
}
|
|
9639
9647
|
};
|
|
@@ -9702,10 +9710,10 @@ function createIdentityProxy(tokens) {
|
|
|
9702
9710
|
}
|
|
9703
9711
|
const body = workspaceTokenRequestSchema.safeParse(await readJsonBody(request));
|
|
9704
9712
|
if (!body.success) {
|
|
9705
|
-
response.writeHead(400, { "content-type": "application/json" }).end(JSON.stringify({ error: 'Body must be JSON with an optional printable "audience" string' }));
|
|
9713
|
+
response.writeHead(400, { "content-type": "application/json" }).end(JSON.stringify({ error: 'Body must be JSON with an optional printable "audience" string and optional boolean "aws_source_identity"' }));
|
|
9706
9714
|
return;
|
|
9707
9715
|
}
|
|
9708
|
-
const result = await tokens.get(body.data.audience);
|
|
9716
|
+
const result = await tokens.get(body.data.audience, body.data.aws_source_identity);
|
|
9709
9717
|
response.writeHead(result.ok ? 200 : result.error.code ?? 503, { "content-type": "application/json", "cache-control": "no-store" });
|
|
9710
9718
|
response.end(JSON.stringify(result.ok ? result.data : { error: result.error.message }));
|
|
9711
9719
|
return;
|
|
@@ -13228,6 +13236,8 @@ var MAX_MIDTURN_CONTINUE_RETRIES = 2;
|
|
|
13228
13236
|
var TRANSIENT_RETRY_DELAYS_MS = [1e3, 2500];
|
|
13229
13237
|
var CLAUDE_TRANSIENT_HTTP_STATUSES = [408, 500, 502, 503, 504, 529];
|
|
13230
13238
|
var CLAUDE_MIDTURN_CONTINUE_PROMPT = "Your previous turn was interrupted by a transient network error before it could finish. Continue from exactly where you left off. Do not repeat any tool calls, commits, messages, or other actions you have already completed \u2014 first check what is already done, then do only the remaining work.";
|
|
13239
|
+
var TOOL_TARGET = /^\s*\{\s*"(\w+)"\s*:\s*(?:"((?:[^"\\]|\\.)*)(")?)?/;
|
|
13240
|
+
var JSON_FIRST_LINE = /^(?:[^\\]|\\[^n])*?(?=\\n)/;
|
|
13231
13241
|
function toSlashCommands(command) {
|
|
13232
13242
|
const names = [command.name, ...command.aliases ?? []];
|
|
13233
13243
|
return names.flatMap((name) => {
|
|
@@ -14461,7 +14471,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14461
14471
|
flushPartialMessageStream(key, status = "in_progress") {
|
|
14462
14472
|
this.clearPartialMessageFlush(key);
|
|
14463
14473
|
const stream = this.partialMessageStreams.get(key);
|
|
14464
|
-
if (!stream || !stream.text && !stream.thinking) return;
|
|
14474
|
+
if (!stream || !stream.text && !stream.thinking && !stream.tool) return;
|
|
14465
14475
|
this.onEvent({
|
|
14466
14476
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14467
14477
|
type: CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE,
|
|
@@ -14470,6 +14480,7 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14470
14480
|
parent_tool_use_id: stream.parent_tool_use_id,
|
|
14471
14481
|
...stream.text ? { text: stream.text } : {},
|
|
14472
14482
|
...stream.thinking ? { thinking: stream.thinking } : {},
|
|
14483
|
+
...stream.tool ? { tool: stream.tool } : {},
|
|
14473
14484
|
status
|
|
14474
14485
|
}
|
|
14475
14486
|
});
|
|
@@ -14504,6 +14515,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14504
14515
|
} else if (block.type === "thinking" && block.thinking) {
|
|
14505
14516
|
stream.thinking += block.thinking;
|
|
14506
14517
|
this.schedulePartialMessageFlush(key);
|
|
14518
|
+
} else if (block.type === "tool_use") {
|
|
14519
|
+
stream.toolUse = { id: block.id, name: block.name, input: "" };
|
|
14507
14520
|
}
|
|
14508
14521
|
return;
|
|
14509
14522
|
}
|
|
@@ -14515,6 +14528,21 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
14515
14528
|
} else if (delta.type === "thinking_delta") {
|
|
14516
14529
|
stream.thinking += delta.thinking;
|
|
14517
14530
|
this.schedulePartialMessageFlush(key);
|
|
14531
|
+
} else if (delta.type === "input_json_delta" && stream.toolUse) {
|
|
14532
|
+
stream.toolUse.input += delta.partial_json;
|
|
14533
|
+
const [, field, raw = "", closed] = TOOL_TARGET.exec(stream.toolUse.input) ?? [];
|
|
14534
|
+
const line = field === "command" ? JSON_FIRST_LINE.exec(raw)?.[0] : void 0;
|
|
14535
|
+
const value = closed || line ? safeJsonParse(`"${line ?? raw}"`, null) : null;
|
|
14536
|
+
if (field && field !== "file_path" && field !== "command") {
|
|
14537
|
+
stream.toolUse = void 0;
|
|
14538
|
+
} else if (typeof value === "string") {
|
|
14539
|
+
const { id, name } = stream.toolUse;
|
|
14540
|
+
stream.tool = field === "command" ? { id, name, command: value } : { id, name, filePath: value };
|
|
14541
|
+
stream.toolUse = void 0;
|
|
14542
|
+
this.schedulePartialMessageFlush(key);
|
|
14543
|
+
} else if (stream.toolUse.input.length > 16384) {
|
|
14544
|
+
stream.toolUse = void 0;
|
|
14545
|
+
}
|
|
14518
14546
|
}
|
|
14519
14547
|
return;
|
|
14520
14548
|
}
|
|
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
|
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
publishedPullRequestUrls
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3KHBTUNG.js";
|
|
7
7
|
import {
|
|
8
8
|
isRecord
|
|
9
9
|
} from "./chunk-UZSNFLDQ.js";
|
|
10
10
|
import {
|
|
11
11
|
shouldRefreshPullRequests
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-G2GE3X7J.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/services/post-tool-pr-notifier.ts
|
package/dist/src/relay-mcp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from 'node:module';
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-AUCJ3CV7.js";
|
|
5
5
|
import {
|
|
6
6
|
RELAY_MCP_SERVER_NAME,
|
|
7
7
|
RELAY_MCP_TOOLS,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
relaySubagentResponseSchema,
|
|
11
11
|
spawnRelaySubagentRequestSchema,
|
|
12
12
|
waitRelaySubagentRequestSchema
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G2GE3X7J.js";
|
|
14
14
|
import "./chunk-VEQXQN22.js";
|
|
15
15
|
|
|
16
16
|
// src/relay-mcp.ts
|