replicas-engine 0.1.949 → 0.1.952
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-KCEKMHN3.js → asp-host-GPMOIWZB.js} +5 -5
- package/dist/src/{chunk-5QC2ZH2E.js → chunk-2E6P3M5D.js} +1 -1
- package/dist/src/{chunk-35P374LH.js → chunk-3KHBTUNG.js} +1 -1
- package/dist/src/{chunk-TE6LILL7.js → chunk-7PFBBYXO.js} +6 -6
- package/dist/src/{chunk-ETCLM4U2.js → chunk-7QZTRTVH.js} +1 -1
- package/dist/src/{chunk-DPXVOAHJ.js → chunk-AUCJ3CV7.js} +1 -1
- package/dist/src/{chunk-R6ILSFAC.js → chunk-G2GE3X7J.js} +72 -62
- package/dist/src/{chunk-22XCQMMN.js → chunk-MF3OC2NC.js} +3 -3
- package/dist/src/{chunk-GVXXHRWR.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-7PFBBYXO.js";
|
|
9
|
+
import "./chunk-2E6P3M5D.js";
|
|
10
|
+
import "./chunk-MF3OC2NC.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,
|
|
@@ -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-MF3OC2NC.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-GPMOIWZB.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-GPMOIWZB.js");
|
|
284
284
|
await restartCodexAspHostIfRunning2();
|
|
285
285
|
}
|
|
286
286
|
setAgentCredentialSnapshot("codex", data);
|
|
@@ -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";
|
|
@@ -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(),
|
|
@@ -3195,7 +3200,7 @@ Use subagents for broad, independent analysis when available, but read the files
|
|
|
3195
3200
|
|
|
3196
3201
|
The user may be watching the panel or may have walked away, so ask early and wait late:
|
|
3197
3202
|
|
|
3198
|
-
1. Right after step 1, request
|
|
3203
|
+
1. Right after step 1, request in one batch only the secrets you need to run the app and test its main flow (usually including sign-in) that you cannot replace locally. First check for a local stand-in the app supports, such as a local database, an auth emulator, or documented test credentials. Do not request values you can generate, values that duplicate another key, or values that are not secret, and list optional integrations in the proposal instead of requesting them. \`required\` means the app cannot start, or its main flow cannot be tested, without it.
|
|
3199
3204
|
|
|
3200
3205
|
\`\`\`bash
|
|
3201
3206
|
replicas environment-setup request-variables --file /tmp/variables.json
|
|
@@ -3204,24 +3209,23 @@ replicas environment-setup request-variables --file /tmp/variables.json
|
|
|
3204
3209
|
\`\`\`json
|
|
3205
3210
|
{
|
|
3206
3211
|
"variables": [
|
|
3207
|
-
{ "key": "
|
|
3208
|
-
{ "key": "STRIPE_SECRET_KEY", "description": "Stripe test-mode key; checkout cannot run without it", "required": true }
|
|
3212
|
+
{ "key": "FIREBASE_PRIVATE_KEY", "description": "Service account private key for a dev Firebase project; sign-in cannot be tested without it", "required": true }
|
|
3209
3213
|
]
|
|
3210
3214
|
}
|
|
3211
3215
|
\`\`\`
|
|
3212
3216
|
|
|
3213
3217
|
2. Keep working on everything that does not need the values. The request appears in the Environment panel next to the chat; the user types values there (stored encrypted on the environment, never in chat) or skips them.
|
|
3214
|
-
3. At the point you actually need a value, block on it:
|
|
3218
|
+
3. At the point you actually need a value, say in chat which keys you are waiting for and why, then block on it once:
|
|
3215
3219
|
|
|
3216
3220
|
\`\`\`bash
|
|
3217
|
-
replicas environment-setup wait-variables --timeout
|
|
3218
|
-
replicas environment-setup wait-variables --keys
|
|
3221
|
+
replicas environment-setup wait-variables --timeout 15m
|
|
3222
|
+
replicas environment-setup wait-variables --keys FIREBASE_PRIVATE_KEY --timeout 15m
|
|
3219
3223
|
\`\`\`
|
|
3220
3224
|
|
|
3221
3225
|
Without \`--keys\` it waits for every pending required key. It returns when the keys are provided or skipped, or when the time runs out, and prints which happened. Provided keys are exported for every new shell; restart anything you started with \`replicas service start\` before that point so it picks them up. Never print the values.
|
|
3222
|
-
4. For anything skipped or unanswered, use the safest local substitute (local database, mock, documented test value), say so in the verification rows, and list the key
|
|
3226
|
+
4. For anything skipped or still unanswered after that wait, use the safest local substitute (local database, mock, documented test value), say so in the verification rows, and list the key in the proposal, marked required only if the app cannot start or its main flow cannot be tested without it. A key the user skipped is not asked again; do not resend it.
|
|
3223
3227
|
5. Values the user provided are already saved on the environment. Still list those keys in the proposal so the review shows them as set.
|
|
3224
|
-
6. Requests are only accepted before you propose. Anything still missing after that goes into the proposal
|
|
3228
|
+
6. Requests are only accepted before you propose. Anything still missing after that goes into the proposal for the user to fill in at review.
|
|
3225
3229
|
|
|
3226
3230
|
## 2. Install and run
|
|
3227
3231
|
|
|
@@ -3234,7 +3238,7 @@ Work from the smallest failing layer, in this workspace:
|
|
|
3234
3238
|
|
|
3235
3239
|
Use the repository's pinned package manager and lockfile. Do not upgrade dependencies, rewrite lockfiles, or change application code to make setup pass; environment configuration and narrowly necessary fixes to setup scripts are in scope. Do not deploy, publish, or touch production resources.
|
|
3236
3240
|
|
|
3237
|
-
When something needs a secret you do not have, request it and run \`wait-variables\` at the point you need it (see "Asking for variables"). If it is skipped or unanswered, use the safest local substitute, keep going, and record the variable
|
|
3241
|
+
When something needs a secret you do not have, request it and run \`wait-variables\` at the point you need it (see "Asking for variables"). If it is skipped or unanswered, use the safest local substitute, keep going, and record the variable in the proposal with a clear description. Never invent or paste secret values anywhere.
|
|
3238
3242
|
|
|
3239
3243
|
## 3. Verify and record
|
|
3240
3244
|
|
|
@@ -4452,7 +4456,7 @@ In agent mode the CLI hides commands that don't make sense for in-workspace agen
|
|
|
4452
4456
|
| \`replicas whoami\` | Print the workspace + org identity |
|
|
4453
4457
|
| \`replicas identity token [--audience <aud>]\` | Print the current short-lived workspace identity token for an audience |
|
|
4454
4458
|
| \`replicas identity token --format gcp --audience <aud>\` | Supply a current token to Google's executable credential source |
|
|
4455
|
-
| \`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 |
|
|
4456
4460
|
| \`replicas identity exec [--audience <aud>] -- <command>\` | Run a command with the current token and audience in its environment |
|
|
4457
4461
|
| \`replicas init\` | Create a \`replicas.json\` / \`replicas.yaml\` in the current directory |
|
|
4458
4462
|
| \`replicas connect <name>\` | SSH into another workspace (requires user creds \u2014 usually only useful when scripting locally) |
|
|
@@ -6139,6 +6143,51 @@ function parseMcpToolName(name) {
|
|
|
6139
6143
|
|
|
6140
6144
|
// ../shared/src/display-message/parsers/claude-parser.ts
|
|
6141
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
|
+
}
|
|
6142
6191
|
function createSubagentMessage(messageIndex, timestamp, fields) {
|
|
6143
6192
|
const { id = `subagent-${timestamp}-${messageIndex}`, ...message } = fields;
|
|
6144
6193
|
return { id, type: "subagent", ...message, timestamp };
|
|
@@ -6175,6 +6224,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6175
6224
|
const workflowAgentMessageMap = /* @__PURE__ */ new Map();
|
|
6176
6225
|
const ambientTaskIds = /* @__PURE__ */ new Set();
|
|
6177
6226
|
const partialIndexes = /* @__PURE__ */ new Map();
|
|
6227
|
+
const streamingTools = /* @__PURE__ */ new Map();
|
|
6178
6228
|
const completedStreamIds = /* @__PURE__ */ new Set();
|
|
6179
6229
|
const supersededStreamIds = /* @__PURE__ */ new Set();
|
|
6180
6230
|
let liveStreamId = null;
|
|
@@ -6252,6 +6302,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6252
6302
|
if (existing.agent !== void 0) messages[existing.agent] = agentMessage;
|
|
6253
6303
|
else existing.agent = messages.push(agentMessage) - 1;
|
|
6254
6304
|
}
|
|
6305
|
+
if (payload.tool) streamingTools.set(payload.streamId, { tool: payload.tool, timestamp: event.timestamp });
|
|
6255
6306
|
partialIndexes.set(payload.streamId, existing);
|
|
6256
6307
|
return;
|
|
6257
6308
|
}
|
|
@@ -6378,56 +6429,9 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6378
6429
|
status: "in_progress",
|
|
6379
6430
|
nestedEvents
|
|
6380
6431
|
}));
|
|
6381
|
-
} else if (toolName
|
|
6382
|
-
const inputObj = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
6383
|
-
const command = inputObj.command || "";
|
|
6384
|
-
const skillNames = skillNamesFromCommand(command);
|
|
6385
|
-
messages.push({
|
|
6386
|
-
id: `command-${event.timestamp}-${messages.length}`,
|
|
6387
|
-
type: "command",
|
|
6388
|
-
command,
|
|
6389
|
-
...skillNames.length > 0 ? { skillNames } : {},
|
|
6390
|
-
output: "",
|
|
6391
|
-
status: "in_progress",
|
|
6392
|
-
timestamp: event.timestamp
|
|
6393
|
-
});
|
|
6394
|
-
} else if (toolName === "Write" || toolName === "Edit") {
|
|
6432
|
+
} else if (COMMAND_TOOL_NAMES.has(toolName) || FILE_TOOL_NAMES.has(toolName)) {
|
|
6395
6433
|
const inputObj = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
6396
|
-
|
|
6397
|
-
const action = toolName === "Write" ? "add" : "update";
|
|
6398
|
-
let diff;
|
|
6399
|
-
if (toolName === "Edit" && inputObj.old_string != null && inputObj.new_string != null) {
|
|
6400
|
-
const oldLines = inputObj.old_string.replace(/\n$/, "").split("\n");
|
|
6401
|
-
const newLines = inputObj.new_string.replace(/\n$/, "").split("\n");
|
|
6402
|
-
const hunk = `@@ -1,${oldLines.length} +1,${newLines.length} @@`;
|
|
6403
|
-
diff = [
|
|
6404
|
-
`--- a/${filePath}`,
|
|
6405
|
-
`+++ b/${filePath}`,
|
|
6406
|
-
hunk,
|
|
6407
|
-
...oldLines.map((l) => `-${l}`),
|
|
6408
|
-
...newLines.map((l) => `+${l}`)
|
|
6409
|
-
].join("\n");
|
|
6410
|
-
} else if (toolName === "Write" && inputObj.content != null) {
|
|
6411
|
-
const newLines = inputObj.content.replace(/\n$/, "").split("\n");
|
|
6412
|
-
const hunk = `@@ -0,0 +1,${newLines.length} @@`;
|
|
6413
|
-
diff = [
|
|
6414
|
-
`--- /dev/null`,
|
|
6415
|
-
`+++ b/${filePath}`,
|
|
6416
|
-
hunk,
|
|
6417
|
-
...newLines.map((l) => `+${l}`)
|
|
6418
|
-
].join("\n");
|
|
6419
|
-
}
|
|
6420
|
-
messages.push({
|
|
6421
|
-
id: `patch-${event.timestamp}-${messages.length}`,
|
|
6422
|
-
type: "patch",
|
|
6423
|
-
operations: [{
|
|
6424
|
-
action,
|
|
6425
|
-
path: filePath,
|
|
6426
|
-
diff
|
|
6427
|
-
}],
|
|
6428
|
-
status: "in_progress",
|
|
6429
|
-
timestamp: event.timestamp
|
|
6430
|
-
});
|
|
6434
|
+
messages.push(fileOrCommandMessage(toolName, toolUseId, inputObj, event.timestamp));
|
|
6431
6435
|
} else if (toolName === "TaskCreate" || toolName === "TaskUpdate" || toolName === "TaskList") {
|
|
6432
6436
|
taskAccumulator.processContentBlock(block);
|
|
6433
6437
|
const snapshot = taskSnapshot();
|
|
@@ -6607,6 +6611,11 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
6607
6611
|
};
|
|
6608
6612
|
}
|
|
6609
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
|
+
}
|
|
6610
6619
|
filteredEvents.forEach((event) => {
|
|
6611
6620
|
if (event.type === "claude-user") {
|
|
6612
6621
|
const content = normalizeContentBlocks(event.payload.message?.content);
|
|
@@ -9119,6 +9128,7 @@ export {
|
|
|
9119
9128
|
parseFrontmatter,
|
|
9120
9129
|
isSkillRegistryManifest,
|
|
9121
9130
|
WORKSPACE_IDENTITY_AUDIENCE,
|
|
9131
|
+
AWS_SOURCE_IDENTITY_CLAIM,
|
|
9122
9132
|
IDENTITY_PROXY_PORT,
|
|
9123
9133
|
IDENTITY_TOKEN_PATH,
|
|
9124
9134
|
workspaceAudienceSchema,
|
|
@@ -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.952";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -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-MF3OC2NC.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-7PFBBYXO.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-MF3OC2NC.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
|