replicas-engine 0.1.1275 → 0.1.1277
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-U7DZUJIB.js → asp-host-WNBX4TA5.js} +5 -5
- package/dist/src/{chunk-XAQ6GHR3.js → chunk-CMBVI5RY.js} +2 -2
- package/dist/src/{chunk-BLD35QJH.js → chunk-DOIUIFTK.js} +3 -3
- package/dist/src/{chunk-YYKT5ENX.js → chunk-JXPRQY2T.js} +1 -1
- package/dist/src/{chunk-O6BNU2BC.js → chunk-QGEYP7R5.js} +1 -1
- package/dist/src/{chunk-OC2XSSGV.js → chunk-RFV64KYY.js} +6 -6
- package/dist/src/{chunk-KJBI5WXM.js → chunk-SBWWSTV3.js} +2 -2
- package/dist/src/{chunk-A67ZSUFV.js → chunk-YQMNXI2D.js} +78 -4
- package/dist/src/{chunk-NIOKFQKT.js → chunk-ZWLSWMXF.js} +2 -2
- package/dist/src/command-protection-hook.js +4 -4
- package/dist/src/headless-agent.js +4 -4
- package/dist/src/index.js +45 -8
- package/dist/src/post-tool-pr-hook.js +2 -2
- package/dist/src/subagent-mcp.js +1 -1
- package/package.json +1 -1
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
listRunningCodexModels,
|
|
9
9
|
restartCodexAspHost,
|
|
10
10
|
restartCodexAspHostIfRunning
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-RFV64KYY.js";
|
|
12
|
+
import "./chunk-CMBVI5RY.js";
|
|
13
|
+
import "./chunk-DOIUIFTK.js";
|
|
14
|
+
import "./chunk-JXPRQY2T.js";
|
|
15
15
|
import "./chunk-UZSNFLDQ.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-YQMNXI2D.js";
|
|
17
17
|
import "./chunk-VEQXQN22.js";
|
|
18
18
|
export {
|
|
19
19
|
CODEX_ULTRAFAST_SERVICE_TIER,
|
|
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
SUBPROCESS_MAX_BUFFER,
|
|
6
6
|
execFileAsync
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JXPRQY2T.js";
|
|
8
8
|
import {
|
|
9
9
|
isRecord as isRecord2
|
|
10
10
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
provisionedDeviceSchema,
|
|
23
23
|
readReplicasRuntimeEnv,
|
|
24
24
|
serializePosixEnvFile
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-YQMNXI2D.js";
|
|
26
26
|
|
|
27
27
|
// src/runtime-env-loader.ts
|
|
28
28
|
import { readFileSync } 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-JXPRQY2T.js";
|
|
7
7
|
import {
|
|
8
8
|
isVersionBelow
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YQMNXI2D.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.1277";
|
|
244
244
|
var INITIALIZE_METHOD = "initialize";
|
|
245
245
|
var INITIALIZED_NOTIFICATION = "initialized";
|
|
246
246
|
var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
|
|
@@ -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-YQMNXI2D.js";
|
|
7
7
|
|
|
8
8
|
// src/utils/exec.ts
|
|
9
9
|
import { exec, execFile } from "child_process";
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
resolveDiffBase,
|
|
11
11
|
runGitCommand,
|
|
12
12
|
setAgentCredentialSnapshot
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-CMBVI5RY.js";
|
|
14
14
|
import {
|
|
15
15
|
AppServerProcess,
|
|
16
16
|
buildCodexAgentEnv
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DOIUIFTK.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBPROCESS_MAX_BUFFER,
|
|
20
20
|
execFileAsync
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JXPRQY2T.js";
|
|
22
22
|
import {
|
|
23
23
|
isRecord
|
|
24
24
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
resolveOpenAICompatibleModelsUrl,
|
|
56
56
|
splitMothershipInstructions,
|
|
57
57
|
withTimeout
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-YQMNXI2D.js";
|
|
59
59
|
|
|
60
60
|
// src/managers/codex-token-manager.ts
|
|
61
61
|
import { promises as fs } from "fs";
|
|
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
291
291
|
await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
|
|
292
292
|
await this.applyCredentialsResponse(data);
|
|
293
293
|
setAgentCredentialSnapshot("codex", data);
|
|
294
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
294
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WNBX4TA5.js");
|
|
295
295
|
await restartCodexAspHostIfRunning2();
|
|
296
296
|
});
|
|
297
297
|
await this.start(true);
|
|
@@ -313,7 +313,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
|
|
|
313
313
|
const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
|
|
314
314
|
await this.applyCredentialsResponse(data);
|
|
315
315
|
if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
|
|
316
|
-
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-
|
|
316
|
+
const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WNBX4TA5.js");
|
|
317
317
|
await restartCodexAspHostIfRunning2();
|
|
318
318
|
}
|
|
319
319
|
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
|
AspClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DOIUIFTK.js";
|
|
7
7
|
import {
|
|
8
8
|
ASTER_BASE_URL,
|
|
9
9
|
ASTER_PROVIDER,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
isRecord,
|
|
14
14
|
readOllamaAuthEnv,
|
|
15
15
|
readOpenAICompatibleAuthEnv
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-YQMNXI2D.js";
|
|
17
17
|
|
|
18
18
|
// src/managers/codex-asp/notification-dispatch.ts
|
|
19
19
|
var TURN_STARTED_METHOD = "turn/started";
|
|
@@ -1451,6 +1451,7 @@ var CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
|
|
|
1451
1451
|
var CHAT_MESSAGE_REJECTED_EVENT_TYPE = "replicas-message-rejected";
|
|
1452
1452
|
var CHAT_TURN_LOST_EVENT_TYPE = "replicas-turn-lost";
|
|
1453
1453
|
var CHAT_GOAL_EVENT_TYPE = "chat-goal";
|
|
1454
|
+
var CLAUDE_PEER_MESSAGE_EVENT_TYPE = "claude-peer-message";
|
|
1454
1455
|
var AUTH_RETRY_STATUS_EVENT_TYPE = "auth-retry-status";
|
|
1455
1456
|
var CURSOR_CONNECTION_STATUS_EVENT_TYPE = "cursor-connection-status";
|
|
1456
1457
|
var AUTH_FALLBACK_EVENT_TYPE = "auth-fallback";
|
|
@@ -2213,6 +2214,12 @@ async function readSseStream(body, onEvent, shouldContinue = () => true, onChunk
|
|
|
2213
2214
|
// ../shared/src/types.ts
|
|
2214
2215
|
var ENGINE_SEND_MESSAGE_FAILED_ERROR = "Failed to send message";
|
|
2215
2216
|
|
|
2217
|
+
// ../shared/src/palette-search.ts
|
|
2218
|
+
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
2219
|
+
var RECENCY_HALF_LIFE_MS = 14 * DAY_MS;
|
|
2220
|
+
var SEARCH_OPEN_DEDUPE_MS = 10 * 60 * 1e3;
|
|
2221
|
+
var PICK_WINDOW_MS = 21 * DAY_MS;
|
|
2222
|
+
|
|
2216
2223
|
// ../shared/src/auth-fallback.ts
|
|
2217
2224
|
function describeCredential(provider2, credential) {
|
|
2218
2225
|
const { ownerName, email, ordinal: ordinal2 } = credential.account ?? {};
|
|
@@ -5749,6 +5756,9 @@ function planItemsFromMessage(message2) {
|
|
|
5749
5756
|
return [{ text: text3, status: status === "completed" || status === "in_progress" ? status : "pending" }];
|
|
5750
5757
|
});
|
|
5751
5758
|
}
|
|
5759
|
+
function peerChatName(message2) {
|
|
5760
|
+
return message2.chat ?? "another chat";
|
|
5761
|
+
}
|
|
5752
5762
|
function todoItemStatus(item) {
|
|
5753
5763
|
return item.itemStatus ?? (item.completed ? "completed" : "pending");
|
|
5754
5764
|
}
|
|
@@ -5781,6 +5791,7 @@ ${operation.diff}` : ""}`).join("\n\n");
|
|
|
5781
5791
|
if (message2.type === "harness_switch") return { kind: "error", title: describeHarnessSwitch(message2), summary: "", content: "" };
|
|
5782
5792
|
if (message2.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
|
|
5783
5793
|
if (message2.type === "capacity_retry") return { kind: "task", title: "Model at capacity", summary: `Retry ${message2.attempt} of ${message2.maxAttempts}`, content: "" };
|
|
5794
|
+
if (message2.type === "peer_message") return { kind: "task", title: `${message2.direction === "received" ? "Message from" : "Message to"} ${peerChatName(message2)}`, summary: "", content: message2.content };
|
|
5784
5795
|
if (message2.type === "multitask_event") return { kind: "task", title: "Ship update", summary: message2.events.map((event) => `${event.agentName}: ${event.summary}`).join(" \xB7 "), content: "" };
|
|
5785
5796
|
return { kind: "error", title: "Agent error", summary: "", content: message2.message };
|
|
5786
5797
|
}
|
|
@@ -5986,6 +5997,27 @@ var REPLICAS_API_STEPS = {
|
|
|
5986
5997
|
|
|
5987
5998
|
// ../shared/src/user-message-attachments.ts
|
|
5988
5999
|
var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
|
|
6000
|
+
var ANNOTATIONS_NOTE_OPENING = '<replicas_annotations>\nThe user quoted these passages, some with a comment. Address each annotation, and when you do, refer to it as "Annotation N".';
|
|
6001
|
+
var ANNOTATIONS_NOTE_REGEX = /(?:^|\n\n)<replicas_annotations>\n([\s\S]*?)\n<\/replicas_annotations>$/;
|
|
6002
|
+
var ANNOTATION_HEADER_REGEX = /^Annotation \d+$/m;
|
|
6003
|
+
function findAnnotationsNote(content) {
|
|
6004
|
+
const complete = content.match(ANNOTATIONS_NOTE_REGEX);
|
|
6005
|
+
if (complete) return { index: complete.index ?? 0, body: complete[1] };
|
|
6006
|
+
for (const { index } of content.matchAll(/(?:^|\n\n)(?=<r)/g)) {
|
|
6007
|
+
const note = content.slice(index).trimStart();
|
|
6008
|
+
if (note.startsWith(ANNOTATIONS_NOTE_OPENING) || ANNOTATIONS_NOTE_OPENING.startsWith(note)) return { index, body: note.slice("<replicas_annotations>\n".length) };
|
|
6009
|
+
}
|
|
6010
|
+
return null;
|
|
6011
|
+
}
|
|
6012
|
+
function parseAnnotationsNote(body) {
|
|
6013
|
+
return body.split(ANNOTATION_HEADER_REGEX).slice(1).map((entry) => {
|
|
6014
|
+
const lines = entry.trim().split("\n");
|
|
6015
|
+
const quoteLength = lines.findIndex((line) => !line.startsWith(">"));
|
|
6016
|
+
const quote = lines.slice(0, quoteLength === -1 ? void 0 : quoteLength).map((line) => line.replace(/^>\s?/, ""));
|
|
6017
|
+
const comment = quoteLength === -1 ? "" : lines.slice(quoteLength).join("\n").trim();
|
|
6018
|
+
return { text: quote.join("\n"), ...comment ? { comment } : {} };
|
|
6019
|
+
});
|
|
6020
|
+
}
|
|
5989
6021
|
var APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)" window="([^"\n]*)" image="(\d+)">\n([^\n<]*)(?:\n\n([^<]*))?\n<\/replicas_appshot>$/;
|
|
5990
6022
|
var TRUNCATED_APPSHOT_NOTE_REGEX = /(?:^|\n\n)<replicas_appshot app="([^"\n]*)(?:" window="([^"\n]*)(?:" image="(\d*))?)?[^<]*(?:<\/?[a-z_]*)?$/;
|
|
5991
6023
|
var XML_UNESCAPES = { "&": "&", "<": "<", ">": ">", """: '"', "'": "'" };
|
|
@@ -6019,11 +6051,14 @@ function stripAttachmentNote(text3) {
|
|
|
6019
6051
|
};
|
|
6020
6052
|
const walkthroughs = takeTrailingNotes(WALKTHROUGH_NOTE_REGEX, TRUNCATED_WALKTHROUGH_NOTE_REGEX, (walkthrough) => ({ path: walkthrough[1], durationSeconds: Number(walkthrough[2] ?? 0), audio: walkthrough[3] === "true" }));
|
|
6021
6053
|
const appshots = takeTrailingNotes(APPSHOT_NOTE_REGEX, TRUNCATED_APPSHOT_NOTE_REGEX, parseAppshot);
|
|
6054
|
+
const annotationsNote = findAnnotationsNote(content);
|
|
6055
|
+
if (annotationsNote) content = content.slice(0, annotationsNote.index).trim();
|
|
6022
6056
|
return {
|
|
6023
6057
|
content,
|
|
6024
6058
|
files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path]) => path) : [],
|
|
6025
6059
|
walkthroughs,
|
|
6026
|
-
appshots
|
|
6060
|
+
appshots,
|
|
6061
|
+
annotations: annotationsNote ? parseAnnotationsNote(annotationsNote.body) : []
|
|
6027
6062
|
};
|
|
6028
6063
|
}
|
|
6029
6064
|
|
|
@@ -7451,6 +7486,8 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
7451
7486
|
});
|
|
7452
7487
|
const toolCallMap = /* @__PURE__ */ new Map();
|
|
7453
7488
|
const taskMessageMap = /* @__PURE__ */ new Map();
|
|
7489
|
+
const peerNames = /* @__PURE__ */ new Map();
|
|
7490
|
+
const peerTimestamps = /* @__PURE__ */ new Map();
|
|
7454
7491
|
const workflowAgentMessageMap = /* @__PURE__ */ new Map();
|
|
7455
7492
|
const ambientTaskIds = /* @__PURE__ */ new Set();
|
|
7456
7493
|
const partialIndexes = /* @__PURE__ */ new Map();
|
|
@@ -7548,6 +7585,22 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
7548
7585
|
partialIndexes.set(payload.streamId, existing);
|
|
7549
7586
|
return;
|
|
7550
7587
|
}
|
|
7588
|
+
if (event.type === CLAUDE_PEER_MESSAGE_EVENT_TYPE) {
|
|
7589
|
+
const { name, from, body } = event.payload;
|
|
7590
|
+
if (typeof body !== "string") return;
|
|
7591
|
+
if (typeof name === "string" && typeof from === "string") peerNames.set(from, name);
|
|
7592
|
+
const sameTime = peerTimestamps.get(event.timestamp) ?? 0;
|
|
7593
|
+
peerTimestamps.set(event.timestamp, sameTime + 1);
|
|
7594
|
+
messages.push({
|
|
7595
|
+
id: `peer-${event.timestamp}-${sameTime}`,
|
|
7596
|
+
type: "peer_message",
|
|
7597
|
+
direction: "received",
|
|
7598
|
+
...typeof name === "string" ? { chat: name } : {},
|
|
7599
|
+
content: body,
|
|
7600
|
+
timestamp: event.timestamp
|
|
7601
|
+
});
|
|
7602
|
+
return;
|
|
7603
|
+
}
|
|
7551
7604
|
if (event.type === "claude-user") {
|
|
7552
7605
|
const content = normalizeContentBlocks(event.payload.message?.content);
|
|
7553
7606
|
const toolResult = content.find((c) => c.type === "tool_result");
|
|
@@ -7688,6 +7741,20 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
7688
7741
|
timestamp: event.timestamp
|
|
7689
7742
|
});
|
|
7690
7743
|
}
|
|
7744
|
+
} else if (toolName === "SendMessage") {
|
|
7745
|
+
const parsed = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
7746
|
+
const input = isRecord(parsed) ? parsed : {};
|
|
7747
|
+
const to = typeof input.to === "string" ? input.to.replace(/\s+\[[0-9a-f]+\]$/, "") : "";
|
|
7748
|
+
const chat = peerNames.get(to) ?? (to.startsWith("uds:") ? void 0 : to || void 0);
|
|
7749
|
+
messages.push({
|
|
7750
|
+
id: `peer-${toolUseId}`,
|
|
7751
|
+
type: "peer_message",
|
|
7752
|
+
direction: "sent",
|
|
7753
|
+
...chat ? { chat } : {},
|
|
7754
|
+
content: typeof input.message === "string" ? input.message : "",
|
|
7755
|
+
status: "in_progress",
|
|
7756
|
+
timestamp: event.timestamp
|
|
7757
|
+
});
|
|
7691
7758
|
} else if (toolName === "WebSearch") {
|
|
7692
7759
|
const inputObj = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
|
|
7693
7760
|
const query = inputObj.query || "";
|
|
@@ -7858,6 +7925,9 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
7858
7925
|
message2.status = status;
|
|
7859
7926
|
} else if (message2.type === "web_search") {
|
|
7860
7927
|
message2.status = status;
|
|
7928
|
+
} else if (message2.type === "peer_message") {
|
|
7929
|
+
const result2 = safeJsonParse(resultContent, {});
|
|
7930
|
+
message2.status = isError || isRecord(result2) && result2.success === false ? "failed" : "completed";
|
|
7861
7931
|
} else if (message2.type === "tool_call") {
|
|
7862
7932
|
message2.output = resultContent;
|
|
7863
7933
|
message2.outputOmitted = outputOmitted;
|
|
@@ -8041,18 +8111,19 @@ function filterDisplayMessages(messages, provider2) {
|
|
|
8041
8111
|
}
|
|
8042
8112
|
result = result.flatMap((msg) => {
|
|
8043
8113
|
if (msg.type !== "user") return [msg];
|
|
8044
|
-
const { content, files, walkthroughs, appshots } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
|
|
8114
|
+
const { content, files, walkthroughs, appshots, annotations } = stripAttachmentNote(stripReplicasInstructionBlock(msg.content).trim());
|
|
8045
8115
|
if (INTERRUPTED_MESSAGE_REGEX.test(content)) {
|
|
8046
8116
|
return [{ id: msg.id, type: "interruption", timestamp: msg.timestamp }];
|
|
8047
8117
|
}
|
|
8048
8118
|
const cleaned = (msg.images?.length || files.length) && ATTACHMENT_PLACEHOLDER_REGEX.test(content) ? "" : content;
|
|
8049
|
-
if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0) return [];
|
|
8050
|
-
if (cleaned === msg.content && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0) return [msg];
|
|
8119
|
+
if (cleaned.length === 0 && !msg.images?.length && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [];
|
|
8120
|
+
if (cleaned === msg.content && files.length === 0 && walkthroughs.length === 0 && appshots.length === 0 && annotations.length === 0) return [msg];
|
|
8051
8121
|
return [{
|
|
8052
8122
|
...msg,
|
|
8053
8123
|
content: cleaned,
|
|
8054
8124
|
...files.length > 0 ? { files } : {},
|
|
8055
8125
|
...walkthroughs.length > 0 ? { walkthroughs } : {},
|
|
8126
|
+
...annotations.length > 0 ? { annotations } : {},
|
|
8056
8127
|
...appshots.length > 0 ? { appshots } : {}
|
|
8057
8128
|
}];
|
|
8058
8129
|
});
|
|
@@ -10062,6 +10133,7 @@ var WORKSPACE_SECTION_ORDER_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-sectio
|
|
|
10062
10133
|
var WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-stages-";
|
|
10063
10134
|
var WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-marked-unread-";
|
|
10064
10135
|
var PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX = "replicas-prompt-history-";
|
|
10136
|
+
var WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-search-opens-";
|
|
10065
10137
|
var orgUserClientStateKey = (prefix) => (organizationId, userId) => `${prefix}${organizationId}-${userId}`;
|
|
10066
10138
|
var workspaceLastViewedAtClientStateKey = orgUserClientStateKey(WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX);
|
|
10067
10139
|
var workspaceAttentionDoneClientStateKey = orgUserClientStateKey(WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX);
|
|
@@ -10069,6 +10141,7 @@ var workspaceStagesClientStateKey = orgUserClientStateKey(WORKSPACE_STAGES_CLIEN
|
|
|
10069
10141
|
var workspaceSectionOrderClientStateKey = orgUserClientStateKey(WORKSPACE_SECTION_ORDER_CLIENT_STATE_KEY_PREFIX);
|
|
10070
10142
|
var workspaceMarkedUnreadClientStateKey = orgUserClientStateKey(WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX);
|
|
10071
10143
|
var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX);
|
|
10144
|
+
var workspaceSearchOpensClientStateKey = orgUserClientStateKey(WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX);
|
|
10072
10145
|
|
|
10073
10146
|
// ../shared/src/routes/workspace-events.ts
|
|
10074
10147
|
import { z as z24 } from "zod";
|
|
@@ -10526,6 +10599,7 @@ export {
|
|
|
10526
10599
|
CHAT_INTERRUPTED_EVENT_TYPE,
|
|
10527
10600
|
CHAT_TURN_LOST_EVENT_TYPE,
|
|
10528
10601
|
CHAT_GOAL_EVENT_TYPE,
|
|
10602
|
+
CLAUDE_PEER_MESSAGE_EVENT_TYPE,
|
|
10529
10603
|
AUTH_RETRY_STATUS_EVENT_TYPE,
|
|
10530
10604
|
CURSOR_CONNECTION_STATUS_EVENT_TYPE,
|
|
10531
10605
|
AUTH_FALLBACK_EVENT_TYPE,
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
getOriginDefaultBranch,
|
|
6
6
|
monolithRequest,
|
|
7
7
|
runGitCommand
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CMBVI5RY.js";
|
|
9
9
|
import {
|
|
10
10
|
extractCommandProtectionCommandText,
|
|
11
11
|
findCommandProtectionGitLookups,
|
|
12
12
|
findGitCommitSignals,
|
|
13
13
|
findPrMergeSignals,
|
|
14
14
|
parseCommandProtectionRequest
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-YQMNXI2D.js";
|
|
16
16
|
|
|
17
17
|
// src/services/command-protection-service.ts
|
|
18
18
|
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-ZWLSWMXF.js";
|
|
7
|
+
import "./chunk-CMBVI5RY.js";
|
|
8
|
+
import "./chunk-JXPRQY2T.js";
|
|
9
9
|
import {
|
|
10
10
|
isRecord
|
|
11
11
|
} from "./chunk-UZSNFLDQ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-YQMNXI2D.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/command-protection-hook.ts
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
recoverCompletedTurn,
|
|
14
14
|
spawnMuseMsp,
|
|
15
15
|
startMuseSession
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SBWWSTV3.js";
|
|
17
17
|
import {
|
|
18
18
|
AppServerProcess,
|
|
19
19
|
buildCodexAgentEnv
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-DOIUIFTK.js";
|
|
21
|
+
import "./chunk-JXPRQY2T.js";
|
|
22
22
|
import {
|
|
23
23
|
AGENT,
|
|
24
24
|
OPENCODE_GO_PROVIDER,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
headlessAgentUsagePath,
|
|
29
29
|
isRecord,
|
|
30
30
|
withTimeout
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-YQMNXI2D.js";
|
|
32
32
|
import "./chunk-VEQXQN22.js";
|
|
33
33
|
|
|
34
34
|
// src/headless-agent.ts
|
package/dist/src/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
evaluateCommandProtection,
|
|
28
28
|
extractToolCommand,
|
|
29
29
|
reportCommandProtectionBlock
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZWLSWMXF.js";
|
|
31
31
|
import {
|
|
32
32
|
ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
|
|
33
33
|
AGENT_MESSAGE_DELTA_METHOD,
|
|
@@ -64,10 +64,10 @@ import {
|
|
|
64
64
|
spawnMuseMsp,
|
|
65
65
|
startMuseSession,
|
|
66
66
|
uuidV7
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-SBWWSTV3.js";
|
|
68
68
|
import {
|
|
69
69
|
publishedPullRequestUrls
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-QGEYP7R5.js";
|
|
71
71
|
import {
|
|
72
72
|
ACCOUNT_RATE_LIMITS_READ_METHOD,
|
|
73
73
|
AsyncLock,
|
|
@@ -140,7 +140,7 @@ import {
|
|
|
140
140
|
timestampFromSeconds,
|
|
141
141
|
upsertCredentialFileLines,
|
|
142
142
|
writeSecureCredentialFile
|
|
143
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-RFV64KYY.js";
|
|
144
144
|
import {
|
|
145
145
|
ENGINE_ENV,
|
|
146
146
|
monolithRequest,
|
|
@@ -150,15 +150,15 @@ import {
|
|
|
150
150
|
resolveDiffBase,
|
|
151
151
|
setAgentCredentialSnapshot,
|
|
152
152
|
setLinearSessionId
|
|
153
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-CMBVI5RY.js";
|
|
154
154
|
import {
|
|
155
155
|
getCodexModelProvider
|
|
156
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-DOIUIFTK.js";
|
|
157
157
|
import {
|
|
158
158
|
SUBPROCESS_MAX_BUFFER,
|
|
159
159
|
execAsync,
|
|
160
160
|
execFileAsync
|
|
161
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-JXPRQY2T.js";
|
|
162
162
|
import {
|
|
163
163
|
isRecord as isRecord2
|
|
164
164
|
} from "./chunk-UZSNFLDQ.js";
|
|
@@ -184,6 +184,7 @@ import {
|
|
|
184
184
|
CLAUDE_HAIKU_4_5_BEDROCK_MODEL,
|
|
185
185
|
CLAUDE_OPUS_4_8_BEDROCK_MODEL,
|
|
186
186
|
CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE,
|
|
187
|
+
CLAUDE_PEER_MESSAGE_EVENT_TYPE,
|
|
187
188
|
CLAUDE_SONNET_5_BEDROCK_MODEL,
|
|
188
189
|
CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
|
|
189
190
|
CODEX_HISTORY_FORMAT_EVENT_TYPE,
|
|
@@ -402,7 +403,7 @@ import {
|
|
|
402
403
|
workspaceTokenRequestSchema,
|
|
403
404
|
workspaceTokenResponseSchema,
|
|
404
405
|
wrapInTag
|
|
405
|
-
} from "./chunk-
|
|
406
|
+
} from "./chunk-YQMNXI2D.js";
|
|
406
407
|
import {
|
|
407
408
|
cloneMcpConfig,
|
|
408
409
|
ensureCompatibilityImports,
|
|
@@ -11610,6 +11611,7 @@ var CodingAgentManager = class {
|
|
|
11610
11611
|
topLevel;
|
|
11611
11612
|
chatId;
|
|
11612
11613
|
originChatId;
|
|
11614
|
+
chatTitle;
|
|
11613
11615
|
hostOnTurnComplete;
|
|
11614
11616
|
onProcessingChanged;
|
|
11615
11617
|
onMessageStarted;
|
|
@@ -11642,6 +11644,7 @@ var CodingAgentManager = class {
|
|
|
11642
11644
|
this.topLevel = options.parentChatId === null;
|
|
11643
11645
|
this.chatId = options.chatId;
|
|
11644
11646
|
this.originChatId = options.originChatId;
|
|
11647
|
+
this.chatTitle = options.chatTitle;
|
|
11645
11648
|
this.hostOnTurnComplete = options.onTurnComplete;
|
|
11646
11649
|
this.onProcessingChanged = options.onProcessingChanged ?? (() => {
|
|
11647
11650
|
});
|
|
@@ -12720,8 +12723,10 @@ var PromptStream = class {
|
|
|
12720
12723
|
queue = [];
|
|
12721
12724
|
closed = false;
|
|
12722
12725
|
waiters = [];
|
|
12726
|
+
sentUuids = /* @__PURE__ */ new Set();
|
|
12723
12727
|
push(message) {
|
|
12724
12728
|
if (this.closed) return;
|
|
12729
|
+
if (message.uuid) this.sentUuids.add(message.uuid);
|
|
12725
12730
|
const waiter = this.waiters.shift();
|
|
12726
12731
|
if (waiter) {
|
|
12727
12732
|
waiter({ value: message, done: false });
|
|
@@ -13048,6 +13053,32 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13048
13053
|
this.pendingTurn?.steers.delete(uuid);
|
|
13049
13054
|
if (this.markSteerRead(steer.messageId)) await this.recordEvent(steer.userMessage, steer.messageId);
|
|
13050
13055
|
}
|
|
13056
|
+
// Claude Code starts a command for another chat's SendMessage without streaming its text, and can start it a moment before writing it.
|
|
13057
|
+
async recordPeerMessage(uuid, query2) {
|
|
13058
|
+
for (const delayMs of [0, 100, 300, 600, 1e3]) {
|
|
13059
|
+
if (delayMs) await new Promise((resolve7) => setTimeout(resolve7, delayMs));
|
|
13060
|
+
if (this.activeQuery !== query2 || !this.sessionId) return;
|
|
13061
|
+
const entry = (await getSessionMessages(this.sessionId, { dir: this.workingDirectory })).findLast((message) => message.uuid === uuid);
|
|
13062
|
+
if (!entry) continue;
|
|
13063
|
+
const origin = "origin" in entry && isRecord(entry.origin) ? entry.origin : null;
|
|
13064
|
+
if (origin?.kind !== "peer" || origin.senderTaskId) return;
|
|
13065
|
+
const text = extractToolResultText(isRecord(entry.message) ? entry.message.content : void 0);
|
|
13066
|
+
const envelopes = [...text.matchAll(/<cross-session-message\b([^>]*)>\n?([\s\S]*?)\n?<\/cross-session-message>/g)].map(([, attributes, body]) => ({
|
|
13067
|
+
name: /\bfrom-name="([^"]*)"/.exec(attributes)?.[1],
|
|
13068
|
+
from: /\bfrom="([^"]*)"/.exec(attributes)?.[1],
|
|
13069
|
+
body
|
|
13070
|
+
}));
|
|
13071
|
+
const messages = envelopes.length > 0 ? envelopes : typeof origin.body === "string" ? [{ name: typeof origin.name === "string" ? origin.name : void 0, from: typeof origin.from === "string" ? origin.from : void 0, body: origin.body }] : [];
|
|
13072
|
+
for (const { name, from, body } of messages) {
|
|
13073
|
+
this.recordHistoryEvent(CLAUDE_PEER_MESSAGE_EVENT_TYPE, {
|
|
13074
|
+
...name ? { name } : {},
|
|
13075
|
+
...from ? { from } : {},
|
|
13076
|
+
body
|
|
13077
|
+
}, this.historyFile);
|
|
13078
|
+
}
|
|
13079
|
+
return;
|
|
13080
|
+
}
|
|
13081
|
+
}
|
|
13051
13082
|
async abortAllPendingToolInputs() {
|
|
13052
13083
|
const pending = Array.from(this.pendingToolInputs.values());
|
|
13053
13084
|
this.pendingToolInputs.clear();
|
|
@@ -13717,8 +13748,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13717
13748
|
} : {}
|
|
13718
13749
|
},
|
|
13719
13750
|
model: claudeCodeModel,
|
|
13751
|
+
...this.chatTitle ? { title: this.chatTitle() } : {},
|
|
13720
13752
|
settings: {
|
|
13721
13753
|
fastMode: signature.fastMode,
|
|
13754
|
+
// Every session in the sandbox is one of the user's chats; the default holds messages across permission modes, and a plan mode chat has no one to release them.
|
|
13755
|
+
crossSessionInbound: "accept",
|
|
13722
13756
|
...signature.autoCompactTokens ? { autoCompactWindow: signature.autoCompactTokens } : {},
|
|
13723
13757
|
...ultracode ? { enableWorkflows: true, ultracode: true } : {}
|
|
13724
13758
|
},
|
|
@@ -13809,6 +13843,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
|
|
|
13809
13843
|
const lifecycle2 = msg;
|
|
13810
13844
|
if (isRecord(lifecycle2) && lifecycle2.type === "command_lifecycle" && lifecycle2.state === "started" && typeof lifecycle2.command_uuid === "string") {
|
|
13811
13845
|
if (this.pendingTurn?.userMessageUuids.has(lifecycle2.command_uuid)) this.turnPromptRecorded = true;
|
|
13846
|
+
else if (!this.activePromptStream?.sentUuids.has(lifecycle2.command_uuid)) await this.recordPeerMessage(lifecycle2.command_uuid, response);
|
|
13847
|
+
if (this.activeQuery !== response) break;
|
|
13812
13848
|
await this.recordSteerRead(lifecycle2.command_uuid);
|
|
13813
13849
|
}
|
|
13814
13850
|
if (this.pendingTurn && _ClaudeManager.isTurnActivity(msg)) {
|
|
@@ -61142,6 +61178,7 @@ ${note}`;
|
|
|
61142
61178
|
fallbackContext,
|
|
61143
61179
|
chatId: persisted.id,
|
|
61144
61180
|
originChatId,
|
|
61181
|
+
chatTitle: () => persisted.title,
|
|
61145
61182
|
onModelSwitched,
|
|
61146
61183
|
onChatCredential,
|
|
61147
61184
|
lastSenderKey: persisted.lastSenderKey,
|
|
@@ -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-QGEYP7R5.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-YQMNXI2D.js";
|
|
13
13
|
import "./chunk-VEQXQN22.js";
|
|
14
14
|
|
|
15
15
|
// src/services/post-tool-pr-notifier.ts
|
package/dist/src/subagent-mcp.js
CHANGED