@moxt-ai/mobius 0.0.319 → 0.0.321
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/acp/adapter/claude/agent-connection.d.ts.map +1 -1
- package/dist/acp/adapter/claude/agent-connection.js +3 -1
- package/dist/acp/adapter/claude/agent-connection.js.map +1 -1
- package/dist/acp/adapter/session-events.d.ts.map +1 -1
- package/dist/acp/adapter/session-events.js.map +1 -1
- package/dist/acp/agent/in-process-endpoint.d.ts +3 -2
- package/dist/acp/agent/in-process-endpoint.d.ts.map +1 -1
- package/dist/acp/agent/in-process-endpoint.js.map +1 -1
- package/dist/acp/connection/agent-update-stream.d.ts +1 -1
- package/dist/acp/connection/agent-update-stream.d.ts.map +1 -1
- package/dist/acp/connection/agent-update-stream.js.map +1 -1
- package/dist/acp/connection/create-client.d.ts +3 -2
- package/dist/acp/connection/create-client.d.ts.map +1 -1
- package/dist/acp/connection/create-client.js +0 -3
- package/dist/acp/connection/create-client.js.map +1 -1
- package/dist/acp/connection/session-notification.d.ts +12 -0
- package/dist/acp/connection/session-notification.d.ts.map +1 -0
- package/dist/acp/connection/session-notification.js +2 -0
- package/dist/acp/connection/session-notification.js.map +1 -0
- package/dist/acp/harness/claude/endpoint.d.ts +5 -1
- package/dist/acp/harness/claude/endpoint.d.ts.map +1 -1
- package/dist/acp/harness/claude/endpoint.js.map +1 -1
- package/dist/acp/harness/codex/agent.d.ts +3 -2
- package/dist/acp/harness/codex/agent.d.ts.map +1 -1
- package/dist/acp/harness/codex/agent.js.map +1 -1
- package/dist/acp/harness/codex/borrowed-agent.d.ts +3 -2
- package/dist/acp/harness/codex/borrowed-agent.d.ts.map +1 -1
- package/dist/acp/harness/codex/borrowed-agent.js +2 -2
- package/dist/acp/harness/codex/borrowed-agent.js.map +1 -1
- package/dist/acp/harness/codex/history.d.ts +2 -2
- package/dist/acp/harness/codex/history.d.ts.map +1 -1
- package/dist/acp/harness/codex/history.js.map +1 -1
- package/dist/acp/harness/codex/owned-agent.d.ts +4 -3
- package/dist/acp/harness/codex/owned-agent.d.ts.map +1 -1
- package/dist/acp/harness/codex/owned-agent.js +3 -7
- package/dist/acp/harness/codex/owned-agent.js.map +1 -1
- package/dist/acp/harness/codex/session-update.d.ts +17 -0
- package/dist/acp/harness/codex/session-update.d.ts.map +1 -0
- package/dist/acp/harness/codex/session-update.js +2 -0
- package/dist/acp/harness/codex/session-update.js.map +1 -0
- package/dist/cli.js +139 -78
- package/dist/cli.js.map +3 -3
- package/dist/runtime.js +130 -69
- package/dist/runtime.js.map +3 -3
- package/package.json +2 -2
package/dist/runtime.js
CHANGED
|
@@ -1176,9 +1176,7 @@ var createAcpClient = (handler) => client({ name: "mobius" }).onRequest(
|
|
|
1176
1176
|
).onRequest(
|
|
1177
1177
|
methods.client.elicitation.create,
|
|
1178
1178
|
async (context) => await handler.onElicitation(context.params, context.signal)
|
|
1179
|
-
).onNotification(methods.client.
|
|
1180
|
-
await handler.onUpdate(context.params);
|
|
1181
|
-
}).onNotification(methods.client.elicitation.complete, async (context) => {
|
|
1179
|
+
).onNotification(methods.client.elicitation.complete, async (context) => {
|
|
1182
1180
|
await handler.onElicitationComplete(context.params);
|
|
1183
1181
|
});
|
|
1184
1182
|
|
|
@@ -26048,13 +26046,9 @@ var CodexOwnedAcpAgent = class {
|
|
|
26048
26046
|
};
|
|
26049
26047
|
/** Pushes the current settings so a mode change Codex applied reaches the Run settings panel. */
|
|
26050
26048
|
#emitConfigOptionsUpdate = async () => {
|
|
26051
|
-
|
|
26052
|
-
|
|
26053
|
-
|
|
26054
|
-
}
|
|
26055
|
-
await connection.client.notify(methods6.client.session.update, {
|
|
26056
|
-
sessionId: this.#context.threadId(),
|
|
26057
|
-
update: { configOptions: this.#settings.configOptions(), sessionUpdate: "config_option_update" }
|
|
26049
|
+
await this.#context.emit({
|
|
26050
|
+
configOptions: this.#settings.configOptions(),
|
|
26051
|
+
sessionUpdate: "config_option_update"
|
|
26058
26052
|
});
|
|
26059
26053
|
};
|
|
26060
26054
|
// Notifications are serialized so two app-server items cannot interleave into one ACP update
|
|
@@ -32281,7 +32275,7 @@ import { fetch as fetch3 } from "undici";
|
|
|
32281
32275
|
// package.json
|
|
32282
32276
|
var package_default = {
|
|
32283
32277
|
name: "@moxt-ai/mobius",
|
|
32284
|
-
version: "0.0.
|
|
32278
|
+
version: "0.0.321",
|
|
32285
32279
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
32286
32280
|
type: "module",
|
|
32287
32281
|
bin: {
|
|
@@ -32458,7 +32452,7 @@ function spawnClaudeWithParentLifeline(options) {
|
|
|
32458
32452
|
|
|
32459
32453
|
// src/acp/harness/claude/upstream/dist/acp-agent.js
|
|
32460
32454
|
import { execFile as execFile3 } from "node:child_process";
|
|
32461
|
-
import { randomUUID as
|
|
32455
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
32462
32456
|
import { existsSync as existsSync3 } from "node:fs";
|
|
32463
32457
|
import * as fs3 from "node:fs/promises";
|
|
32464
32458
|
import * as os3 from "node:os";
|
|
@@ -71591,6 +71585,7 @@ var SettingsManager = class {
|
|
|
71591
71585
|
};
|
|
71592
71586
|
|
|
71593
71587
|
// src/acp/harness/claude/upstream/dist/session-mode.js
|
|
71588
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
71594
71589
|
import { RequestError as RequestError3 } from "@agentclientprotocol/sdk";
|
|
71595
71590
|
var MODE_CONFIG_ID = "mode";
|
|
71596
71591
|
var AUTO_MODE_FALLBACK = "acceptEdits";
|
|
@@ -71714,11 +71709,13 @@ var SessionModeManager = class {
|
|
|
71714
71709
|
return;
|
|
71715
71710
|
}
|
|
71716
71711
|
session.autoModeFallbackWarningShown = true;
|
|
71712
|
+
const messageId = randomUUID5();
|
|
71717
71713
|
try {
|
|
71718
71714
|
await this.options.sessionUpdate({
|
|
71719
71715
|
sessionId,
|
|
71720
71716
|
update: {
|
|
71721
71717
|
sessionUpdate: "agent_message_chunk",
|
|
71718
|
+
messageId,
|
|
71722
71719
|
content: { type: "text", text: AUTO_MODE_FALLBACK_NOTICE }
|
|
71723
71720
|
}
|
|
71724
71721
|
});
|
|
@@ -72151,7 +72148,7 @@ async function authenticateMcpServer(host, sessionId, query, serverName) {
|
|
|
72151
72148
|
if (!login.authUrl) {
|
|
72152
72149
|
throw new Error("Claude Code requested user action without returning an authorization URL");
|
|
72153
72150
|
}
|
|
72154
|
-
const elicitationId = `mcp-oauth-${
|
|
72151
|
+
const elicitationId = `mcp-oauth-${randomUUID6()}`;
|
|
72155
72152
|
const flowAbort = new AbortController();
|
|
72156
72153
|
const abortFlow = () => flowAbort.abort(session.abortController.signal.reason);
|
|
72157
72154
|
session.abortController.signal.addEventListener("abort", abortFlow, { once: true });
|
|
@@ -72625,7 +72622,7 @@ var ClaudeAcpAgent = class {
|
|
|
72625
72622
|
await this.publishTaskPlan(params.sessionId, session.taskState);
|
|
72626
72623
|
}
|
|
72627
72624
|
const userMessage = promptToClaude(params);
|
|
72628
|
-
const promptUuid =
|
|
72625
|
+
const promptUuid = randomUUID6();
|
|
72629
72626
|
userMessage.uuid = promptUuid;
|
|
72630
72627
|
const firstText = params.prompt[0]?.type === "text" ? params.prompt[0].text : "";
|
|
72631
72628
|
const isLocalOnlyCommand = firstText.startsWith("/") && LOCAL_ONLY_COMMANDS.has(firstText.split(" ", 1)[0]);
|
|
@@ -72777,7 +72774,7 @@ var ClaudeAcpAgent = class {
|
|
|
72777
72774
|
prompt: params.prompt
|
|
72778
72775
|
};
|
|
72779
72776
|
const userMessage = promptToClaude(promptRequest);
|
|
72780
|
-
const steeredUuid =
|
|
72777
|
+
const steeredUuid = randomUUID6();
|
|
72781
72778
|
userMessage.uuid = steeredUuid;
|
|
72782
72779
|
userMessage.priority = (session.pendingUserInputCount ?? 0) > 0 ? STEER_PRIORITY_LATER : STEER_PRIORITY_NOW;
|
|
72783
72780
|
turnInFlight.steeredEchoes ??= /* @__PURE__ */ new Set();
|
|
@@ -73170,7 +73167,7 @@ var ClaudeAcpAgent = class {
|
|
|
73170
73167
|
case "status": {
|
|
73171
73168
|
if (message.status === "compacting") {
|
|
73172
73169
|
if (compaction === null) {
|
|
73173
|
-
compaction = { id:
|
|
73170
|
+
compaction = { id: randomUUID6() };
|
|
73174
73171
|
await sendUpdate({
|
|
73175
73172
|
sessionId: message.session_id,
|
|
73176
73173
|
update: {
|
|
@@ -73227,6 +73224,7 @@ var ClaudeAcpAgent = class {
|
|
|
73227
73224
|
sessionId: message.session_id,
|
|
73228
73225
|
update: {
|
|
73229
73226
|
sessionUpdate: "agent_message_chunk",
|
|
73227
|
+
messageId: message.uuid,
|
|
73230
73228
|
content: { type: "text", text: message.content }
|
|
73231
73229
|
}
|
|
73232
73230
|
});
|
|
@@ -73343,6 +73341,7 @@ var ClaudeAcpAgent = class {
|
|
|
73343
73341
|
sessionId: message.session_id,
|
|
73344
73342
|
update: {
|
|
73345
73343
|
sessionUpdate: "agent_message_chunk",
|
|
73344
|
+
messageId: message.uuid,
|
|
73346
73345
|
content: { type: "text", text: text2 }
|
|
73347
73346
|
}
|
|
73348
73347
|
});
|
|
@@ -73440,6 +73439,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
73440
73439
|
sessionId: message.session_id,
|
|
73441
73440
|
update: {
|
|
73442
73441
|
sessionUpdate: "agent_message_chunk",
|
|
73442
|
+
messageId: message.uuid,
|
|
73443
73443
|
content: {
|
|
73444
73444
|
type: "text",
|
|
73445
73445
|
text: `**Model fallback:** ${message.original_model} declined this request${category}; retried with ${message.fallback_model}. ${outcome}${explanation}`
|
|
@@ -73591,6 +73591,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
73591
73591
|
sessionId: params.sessionId,
|
|
73592
73592
|
update: {
|
|
73593
73593
|
sessionUpdate: "agent_message_chunk",
|
|
73594
|
+
messageId: message.uuid,
|
|
73594
73595
|
content: { type: "text", text: lastRefusalExplanation }
|
|
73595
73596
|
}
|
|
73596
73597
|
});
|
|
@@ -73614,7 +73615,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
73614
73615
|
break;
|
|
73615
73616
|
}
|
|
73616
73617
|
if (session.activeTurn?.isLocalOnlyCommand || !deliveredAssistantText && (message.usage.output_tokens ?? 0) === 0) {
|
|
73617
|
-
for (const notification of toAcpNotifications(message.result, "assistant", params.sessionId, session.toolUseCache, this.client, this.logger)) {
|
|
73618
|
+
for (const notification of toAcpNotifications(message.result, "assistant", params.sessionId, session.toolUseCache, this.client, this.logger, { messageId: message.uuid })) {
|
|
73618
73619
|
await sendUpdate(notification);
|
|
73619
73620
|
}
|
|
73620
73621
|
}
|
|
@@ -73734,6 +73735,12 @@ ${message.api_refusal_explanation}` : "";
|
|
|
73734
73735
|
});
|
|
73735
73736
|
}
|
|
73736
73737
|
}
|
|
73738
|
+
if (currentStreamMessageId === void 0) {
|
|
73739
|
+
if (message.event.type !== "content_block_start" && message.event.type !== "content_block_delta") {
|
|
73740
|
+
break;
|
|
73741
|
+
}
|
|
73742
|
+
throw RequestError4.internalError({ code: "invalid_message_boundary" });
|
|
73743
|
+
}
|
|
73737
73744
|
for (const notification of streamEventToAcpNotifications(message, params.sessionId, session.toolUseCache, this.client, this.logger, {
|
|
73738
73745
|
clientCapabilities: this.clientCapabilities,
|
|
73739
73746
|
cwd: session.cwd,
|
|
@@ -73764,10 +73771,14 @@ ${message.api_refusal_explanation}` : "";
|
|
|
73764
73771
|
if (message.parent_tool_use_id !== null && !(session.forwardSubagentText || supportsSubagentTranscript(this.clientCapabilities))) {
|
|
73765
73772
|
break;
|
|
73766
73773
|
}
|
|
73767
|
-
|
|
73768
|
-
|
|
73769
|
-
session.messageIdToUuid.set(mappedMessageId, message.uuid);
|
|
73774
|
+
if (message.uuid === void 0) {
|
|
73775
|
+
throw RequestError4.internalError({ code: "invalid_source_message" });
|
|
73770
73776
|
}
|
|
73777
|
+
const mappedMessageId = messageIdForGrouping({
|
|
73778
|
+
type: message.type,
|
|
73779
|
+
uuid: message.uuid,
|
|
73780
|
+
message: message.message
|
|
73781
|
+
});
|
|
73771
73782
|
if (message.type === "user" && "uuid" in message && message.uuid) {
|
|
73772
73783
|
if (session.pendingGoalUpdate?.commandUuid === message.uuid) {
|
|
73773
73784
|
session.pendingGoalUpdate.started = true;
|
|
@@ -73834,7 +73845,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
73834
73845
|
parentToolUseId: message.parent_tool_use_id,
|
|
73835
73846
|
cwd: session.cwd,
|
|
73836
73847
|
taskState: session.taskState,
|
|
73837
|
-
messageId:
|
|
73848
|
+
messageId: mappedMessageId
|
|
73838
73849
|
})) {
|
|
73839
73850
|
await sendUpdate(notification);
|
|
73840
73851
|
}
|
|
@@ -73900,7 +73911,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
73900
73911
|
cwd: session.cwd,
|
|
73901
73912
|
taskState: session.taskState,
|
|
73902
73913
|
emittedToolCalls: session.emittedToolCalls,
|
|
73903
|
-
messageId:
|
|
73914
|
+
messageId: mappedMessageId,
|
|
73904
73915
|
toolUseResult: message.type === "user" ? message.tool_use_result : void 0,
|
|
73905
73916
|
// On the wire since CLI 2.1.216 but not in SDKUserMessage's
|
|
73906
73917
|
// type, hence the cast. Validated by parseToolResultMeta.
|
|
@@ -74249,10 +74260,6 @@ ${message.api_refusal_explanation}` : "";
|
|
|
74249
74260
|
}
|
|
74250
74261
|
}
|
|
74251
74262
|
const replayMessageId = messageIdForGrouping(message);
|
|
74252
|
-
const replaySession = this.sessions[sessionId];
|
|
74253
|
-
if (replaySession && replayMessageId && message.uuid) {
|
|
74254
|
-
replaySession.messageIdToUuid.set(replayMessageId, message.uuid);
|
|
74255
|
-
}
|
|
74256
74263
|
const parentToolUseId = parentToolUseIdOf(message);
|
|
74257
74264
|
if (parentToolUseId !== null && !forwardSubagentText) {
|
|
74258
74265
|
continue;
|
|
@@ -74726,10 +74733,12 @@ ${message.api_refusal_explanation}` : "";
|
|
|
74726
74733
|
session.fastModeDisabledReason = nextReason;
|
|
74727
74734
|
this.refreshFastModeOption(session, enabled);
|
|
74728
74735
|
if (explain) {
|
|
74736
|
+
const messageId = randomUUID6();
|
|
74729
74737
|
await this.client.sessionUpdate({
|
|
74730
74738
|
sessionId,
|
|
74731
74739
|
update: {
|
|
74732
74740
|
sessionUpdate: "agent_message_chunk",
|
|
74741
|
+
messageId,
|
|
74733
74742
|
content: {
|
|
74734
74743
|
type: "text",
|
|
74735
74744
|
text: `**Fast mode turned off:** ${FAST_MODE_UNAVAILABLE_EXPLANATIONS[nextReason]}.`
|
|
@@ -74800,7 +74809,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
74800
74809
|
} else if (creationOpts.resume) {
|
|
74801
74810
|
sessionId = creationOpts.resume;
|
|
74802
74811
|
} else {
|
|
74803
|
-
sessionId =
|
|
74812
|
+
sessionId = randomUUID6();
|
|
74804
74813
|
}
|
|
74805
74814
|
const input2 = new Pushable();
|
|
74806
74815
|
const settingsManager = new SettingsManager(params.cwd, {
|
|
@@ -74998,7 +75007,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
74998
75007
|
...acpAdditionalDirectories
|
|
74999
75008
|
];
|
|
75000
75009
|
if (creationOpts?.resume === void 0) {
|
|
75001
|
-
options.sessionId = creationOpts.publicSessionId ?
|
|
75010
|
+
options.sessionId = creationOpts.publicSessionId ? randomUUID6() : sessionId;
|
|
75002
75011
|
}
|
|
75003
75012
|
if (abortController?.signal.aborted) {
|
|
75004
75013
|
throw new Error("Cancelled");
|
|
@@ -75093,8 +75102,7 @@ ${message.api_refusal_explanation}` : "";
|
|
|
75093
75102
|
emittedToolCalls: /* @__PURE__ */ new Set(),
|
|
75094
75103
|
liveBackgroundTasks: /* @__PURE__ */ new Map(),
|
|
75095
75104
|
emittedAssistantText: false,
|
|
75096
|
-
idleBoundary: { kind: "unaccounted" }
|
|
75097
|
-
messageIdToUuid: /* @__PURE__ */ new Map()
|
|
75105
|
+
idleBoundary: { kind: "unaccounted" }
|
|
75098
75106
|
};
|
|
75099
75107
|
return {
|
|
75100
75108
|
sessionId,
|
|
@@ -75843,17 +75851,12 @@ ${chunk.resource.text}
|
|
|
75843
75851
|
function messageIdForGrouping(message) {
|
|
75844
75852
|
if (message.type === "assistant") {
|
|
75845
75853
|
const inner = message.message;
|
|
75846
|
-
const apiId = inner && typeof inner === "object"
|
|
75854
|
+
const apiId = inner !== null && typeof inner === "object" ? Reflect.get(inner, "id") : void 0;
|
|
75847
75855
|
if (typeof apiId === "string" && apiId.length > 0) {
|
|
75848
75856
|
return apiId;
|
|
75849
75857
|
}
|
|
75850
75858
|
}
|
|
75851
|
-
return
|
|
75852
|
-
}
|
|
75853
|
-
function applyMessageId(update, messageId) {
|
|
75854
|
-
if (messageId && (update.sessionUpdate === "agent_message_chunk" || update.sessionUpdate === "user_message_chunk" || update.sessionUpdate === "agent_thought_chunk")) {
|
|
75855
|
-
update.messageId = messageId;
|
|
75856
|
-
}
|
|
75859
|
+
return message.uuid;
|
|
75857
75860
|
}
|
|
75858
75861
|
function isTaskTool(toolName) {
|
|
75859
75862
|
return toolName === "TaskCreate" || toolName === "TaskUpdate" || toolName === "TaskList" || toolName === "TaskGet";
|
|
@@ -75945,14 +75948,15 @@ function toAcpNotifications(content, role, sessionId, toolUseCache, client2, log
|
|
|
75945
75948
|
if (content.length === 0) {
|
|
75946
75949
|
return [];
|
|
75947
75950
|
}
|
|
75951
|
+
const messageId = options.messageId;
|
|
75948
75952
|
const update = {
|
|
75949
75953
|
sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
|
|
75954
|
+
messageId,
|
|
75950
75955
|
content: {
|
|
75951
75956
|
type: "text",
|
|
75952
75957
|
text: content
|
|
75953
75958
|
}
|
|
75954
75959
|
};
|
|
75955
|
-
applyMessageId(update, options?.messageId);
|
|
75956
75960
|
if (options?.parentToolUseId) {
|
|
75957
75961
|
update._meta = {
|
|
75958
75962
|
...update._meta,
|
|
@@ -75973,8 +75977,10 @@ function toAcpNotifications(content, role, sessionId, toolUseCache, client2, log
|
|
|
75973
75977
|
case "text":
|
|
75974
75978
|
case "text_delta": {
|
|
75975
75979
|
if (chunk.text) {
|
|
75980
|
+
const messageId = options.messageId;
|
|
75976
75981
|
update = {
|
|
75977
75982
|
sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
|
|
75983
|
+
messageId,
|
|
75978
75984
|
content: {
|
|
75979
75985
|
type: "text",
|
|
75980
75986
|
text: chunk.text
|
|
@@ -75983,9 +75989,11 @@ function toAcpNotifications(content, role, sessionId, toolUseCache, client2, log
|
|
|
75983
75989
|
}
|
|
75984
75990
|
break;
|
|
75985
75991
|
}
|
|
75986
|
-
case "image":
|
|
75992
|
+
case "image": {
|
|
75993
|
+
const messageId = options.messageId;
|
|
75987
75994
|
update = {
|
|
75988
75995
|
sessionUpdate: role === "assistant" ? "agent_message_chunk" : "user_message_chunk",
|
|
75996
|
+
messageId,
|
|
75989
75997
|
content: {
|
|
75990
75998
|
type: "image",
|
|
75991
75999
|
data: chunk.source.type === "base64" ? chunk.source.data : "",
|
|
@@ -75994,11 +76002,14 @@ function toAcpNotifications(content, role, sessionId, toolUseCache, client2, log
|
|
|
75994
76002
|
}
|
|
75995
76003
|
};
|
|
75996
76004
|
break;
|
|
76005
|
+
}
|
|
75997
76006
|
case "thinking":
|
|
75998
76007
|
case "thinking_delta": {
|
|
75999
76008
|
if (chunk.thinking) {
|
|
76009
|
+
const messageId = options.messageId;
|
|
76000
76010
|
update = {
|
|
76001
76011
|
sessionUpdate: "agent_thought_chunk",
|
|
76012
|
+
messageId,
|
|
76002
76013
|
content: {
|
|
76003
76014
|
type: "text",
|
|
76004
76015
|
text: chunk.thinking
|
|
@@ -76213,7 +76224,6 @@ function toAcpNotifications(content, role, sessionId, toolUseCache, client2, log
|
|
|
76213
76224
|
}
|
|
76214
76225
|
};
|
|
76215
76226
|
}
|
|
76216
|
-
applyMessageId(update, options?.messageId);
|
|
76217
76227
|
output2.push({ sessionId, update });
|
|
76218
76228
|
}
|
|
76219
76229
|
}
|
|
@@ -76293,7 +76303,6 @@ function streamEventToAcpNotifications(message, sessionId, toolUseCache, client2
|
|
|
76293
76303
|
}
|
|
76294
76304
|
};
|
|
76295
76305
|
}
|
|
76296
|
-
applyMessageId(update, options?.messageId);
|
|
76297
76306
|
return [{ sessionId, update }];
|
|
76298
76307
|
}
|
|
76299
76308
|
return toAcpNotifications([event.delta], "assistant", sessionId, toolUseCache, client2, logger, forwardedOptions);
|
|
@@ -76507,7 +76516,9 @@ var ClaudeAgentConnection = class extends EndpointAgentConnection {
|
|
|
76507
76516
|
command: options.command,
|
|
76508
76517
|
cwd: options.cwd,
|
|
76509
76518
|
environment: options.environment,
|
|
76510
|
-
onSessionUpdate:
|
|
76519
|
+
onSessionUpdate: async (notification) => {
|
|
76520
|
+
await options.client.onUpdate(notification);
|
|
76521
|
+
},
|
|
76511
76522
|
onBackgroundActivity: (active) => options.onBackgroundActivity?.(active)
|
|
76512
76523
|
});
|
|
76513
76524
|
super(endpoint, options.client);
|
|
@@ -76584,7 +76595,7 @@ import {
|
|
|
76584
76595
|
} from "@agentclientprotocol/sdk";
|
|
76585
76596
|
|
|
76586
76597
|
// src/acp/harness/codex/borrowed-agent.ts
|
|
76587
|
-
import { randomUUID as
|
|
76598
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
76588
76599
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
76589
76600
|
var REQUEST_TIMEOUT = 3e4;
|
|
76590
76601
|
var POLL_INTERVAL = 500;
|
|
@@ -76685,7 +76696,7 @@ var CodexBorrowedAcpAgent = class {
|
|
|
76685
76696
|
if (!baseline && !this.#seen.has(key) && clientId !== this.#pending?.clientId && text2.length > 0) {
|
|
76686
76697
|
await this.#emit({
|
|
76687
76698
|
sessionUpdate: "user_message_chunk",
|
|
76688
|
-
messageId:
|
|
76699
|
+
messageId: item.id,
|
|
76689
76700
|
content: { type: "text", text: text2 }
|
|
76690
76701
|
});
|
|
76691
76702
|
}
|
|
@@ -76703,7 +76714,7 @@ var CodexBorrowedAcpAgent = class {
|
|
|
76703
76714
|
if (text2.length > 0) {
|
|
76704
76715
|
await this.#emit({
|
|
76705
76716
|
sessionUpdate: item.type === "agentMessage" ? "agent_message_chunk" : "agent_thought_chunk",
|
|
76706
|
-
messageId:
|
|
76717
|
+
messageId: item.id,
|
|
76707
76718
|
content: { type: "text", text: text2 }
|
|
76708
76719
|
});
|
|
76709
76720
|
}
|
|
@@ -76743,7 +76754,7 @@ var CodexBorrowedAcpAgent = class {
|
|
|
76743
76754
|
if (this.#pending !== null) {
|
|
76744
76755
|
throw new AcpExecutionError("Another prompt is already running", {}, "session_busy");
|
|
76745
76756
|
}
|
|
76746
|
-
const pending = { clientId:
|
|
76757
|
+
const pending = { clientId: randomUUID7(), completion: Promise.withResolvers() };
|
|
76747
76758
|
this.#pending = pending;
|
|
76748
76759
|
void pending.completion.promise.catch(() => {
|
|
76749
76760
|
});
|
|
@@ -77598,7 +77609,7 @@ import { agent as createAgentApp2, methods as methods10 } from "@agentclientprot
|
|
|
77598
77609
|
|
|
77599
77610
|
// src/acp/harness/pi/upstream/dist/acp/agent.js
|
|
77600
77611
|
import { spawnSync } from "node:child_process";
|
|
77601
|
-
import { randomUUID as
|
|
77612
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
77602
77613
|
import { existsSync as existsSync7, readdirSync as readdirSync6, readFileSync as readFileSync8, realpathSync as realpathSync4, statSync as statSync4, unlinkSync as unlinkSync2 } from "node:fs";
|
|
77603
77614
|
import { basename as basename5, dirname as dirname8, isAbsolute as isAbsolute13, join as join19 } from "node:path";
|
|
77604
77615
|
import { RequestError as RequestError8 } from "@agentclientprotocol/sdk";
|
|
@@ -78507,7 +78518,7 @@ function getQuietStartup(cwd, environment = process.env) {
|
|
|
78507
78518
|
}
|
|
78508
78519
|
|
|
78509
78520
|
// src/acp/harness/pi/upstream/dist/acp/session.js
|
|
78510
|
-
import { randomUUID as
|
|
78521
|
+
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
78511
78522
|
import { readFileSync as readFileSync7 } from "node:fs";
|
|
78512
78523
|
import { isAbsolute as isAbsolute12, resolve as resolvePath } from "node:path";
|
|
78513
78524
|
import { RequestError as RequestError7 } from "@agentclientprotocol/sdk";
|
|
@@ -79195,13 +79206,13 @@ var PiAcpSession = class {
|
|
|
79195
79206
|
return settled;
|
|
79196
79207
|
}
|
|
79197
79208
|
if (this.activeCompactionId === null) {
|
|
79198
|
-
this.activeCompactionId =
|
|
79209
|
+
this.activeCompactionId = randomUUID8();
|
|
79199
79210
|
}
|
|
79200
79211
|
return this.activeCompactionId;
|
|
79201
79212
|
}
|
|
79202
79213
|
/** Opening half of compactionId: always returns an id. */
|
|
79203
79214
|
openCompactionId() {
|
|
79204
|
-
return this.compactionId(true) ??
|
|
79215
|
+
return this.compactionId(true) ?? randomUUID8();
|
|
79205
79216
|
}
|
|
79206
79217
|
constructor(opts) {
|
|
79207
79218
|
this.sessionId = opts.sessionId;
|
|
@@ -79211,7 +79222,11 @@ var PiAcpSession = class {
|
|
|
79211
79222
|
this.conn = opts.conn;
|
|
79212
79223
|
this.fileCommands = opts.fileCommands ?? [];
|
|
79213
79224
|
this.extensionQuestions = new PiExtensionQuestions(this.sessionId, this.conn, this.proc, async (text2) => {
|
|
79214
|
-
this.emit({
|
|
79225
|
+
this.emit({
|
|
79226
|
+
sessionUpdate: "agent_message_chunk",
|
|
79227
|
+
messageId: randomUUID8(),
|
|
79228
|
+
content: { type: "text", text: text2 }
|
|
79229
|
+
});
|
|
79215
79230
|
await this.flushEmits();
|
|
79216
79231
|
});
|
|
79217
79232
|
this.proc.signal.addEventListener("abort", () => {
|
|
@@ -79258,6 +79273,7 @@ var PiAcpSession = class {
|
|
|
79258
79273
|
this.startupInfoSent = true;
|
|
79259
79274
|
this.emit({
|
|
79260
79275
|
sessionUpdate: "agent_message_chunk",
|
|
79276
|
+
messageId: randomUUID8(),
|
|
79261
79277
|
content: { type: "text", text: this.startupInfo }
|
|
79262
79278
|
});
|
|
79263
79279
|
}
|
|
@@ -79269,6 +79285,7 @@ var PiAcpSession = class {
|
|
|
79269
79285
|
this.turnQueue.push(queued);
|
|
79270
79286
|
this.emit({
|
|
79271
79287
|
sessionUpdate: "agent_message_chunk",
|
|
79288
|
+
messageId: randomUUID8(),
|
|
79272
79289
|
content: {
|
|
79273
79290
|
type: "text",
|
|
79274
79291
|
text: `Queued message (position ${this.turnQueue.length}).`
|
|
@@ -79335,6 +79352,7 @@ var PiAcpSession = class {
|
|
|
79335
79352
|
}
|
|
79336
79353
|
this.emit({
|
|
79337
79354
|
sessionUpdate: "agent_message_chunk",
|
|
79355
|
+
messageId: randomUUID8(),
|
|
79338
79356
|
content: { type: "text", text: "Cleared queued prompts." }
|
|
79339
79357
|
});
|
|
79340
79358
|
this.emit({
|
|
@@ -79407,6 +79425,7 @@ var PiAcpSession = class {
|
|
|
79407
79425
|
if (next) {
|
|
79408
79426
|
this.emit({
|
|
79409
79427
|
sessionUpdate: "agent_message_chunk",
|
|
79428
|
+
messageId: randomUUID8(),
|
|
79410
79429
|
content: { type: "text", text: `Starting queued message. (${this.turnQueue.length} remaining)` }
|
|
79411
79430
|
});
|
|
79412
79431
|
this.startTurn(next);
|
|
@@ -79474,24 +79493,41 @@ var PiAcpSession = class {
|
|
|
79474
79493
|
void err;
|
|
79475
79494
|
});
|
|
79476
79495
|
}
|
|
79496
|
+
streamedMessage = {
|
|
79497
|
+
kind: "idle"
|
|
79498
|
+
};
|
|
79477
79499
|
handlePiEvent(ev2) {
|
|
79478
79500
|
const type = String(ev2.type ?? "");
|
|
79479
79501
|
switch (type) {
|
|
79502
|
+
case "message_start":
|
|
79503
|
+
this.streamedMessage = { kind: "active", messageId: randomUUID8() };
|
|
79504
|
+
break;
|
|
79505
|
+
case "message_end":
|
|
79506
|
+
this.streamedMessage = { kind: "idle" };
|
|
79507
|
+
break;
|
|
79480
79508
|
case "message_update": {
|
|
79481
79509
|
const ame2 = ev2.assistantMessageEvent;
|
|
79482
79510
|
if (this.turnRetryFailure !== null && (ame2?.type === "text_delta" || ame2?.type === "thinking_delta" || ame2?.type === "toolcall_start")) {
|
|
79483
79511
|
this.turnRetryFailure = null;
|
|
79484
79512
|
}
|
|
79485
79513
|
if (ame2?.type === "text_delta" && typeof ame2.delta === "string") {
|
|
79514
|
+
if (this.streamedMessage.kind !== "active") {
|
|
79515
|
+
throw RequestError7.internalError({ code: "invalid_message_boundary" });
|
|
79516
|
+
}
|
|
79486
79517
|
this.emit({
|
|
79487
79518
|
sessionUpdate: "agent_message_chunk",
|
|
79519
|
+
messageId: this.streamedMessage.messageId,
|
|
79488
79520
|
content: { type: "text", text: ame2.delta }
|
|
79489
79521
|
});
|
|
79490
79522
|
break;
|
|
79491
79523
|
}
|
|
79492
79524
|
if (ame2?.type === "thinking_delta" && typeof ame2.delta === "string") {
|
|
79525
|
+
if (this.streamedMessage.kind !== "active") {
|
|
79526
|
+
throw RequestError7.internalError({ code: "invalid_message_boundary" });
|
|
79527
|
+
}
|
|
79493
79528
|
this.emit({
|
|
79494
79529
|
sessionUpdate: "agent_thought_chunk",
|
|
79530
|
+
messageId: this.streamedMessage.messageId,
|
|
79495
79531
|
content: { type: "text", text: ame2.delta }
|
|
79496
79532
|
});
|
|
79497
79533
|
break;
|
|
@@ -79698,6 +79734,7 @@ var PiAcpSession = class {
|
|
|
79698
79734
|
if (ev2.method === "notify") {
|
|
79699
79735
|
this.emit({
|
|
79700
79736
|
sessionUpdate: "agent_message_chunk",
|
|
79737
|
+
messageId: randomUUID8(),
|
|
79701
79738
|
content: { type: "text", text: stringProp(ev2, "message") ?? "Pi notification" },
|
|
79702
79739
|
_meta: { piAcp: { notify: { level: stringProp(ev2, "notifyType") ?? "info" } } }
|
|
79703
79740
|
});
|
|
@@ -80193,7 +80230,7 @@ var PiAcpAgent = class {
|
|
|
80193
80230
|
const args = parseCommandArgs(argsString);
|
|
80194
80231
|
if (cmd === "compact") {
|
|
80195
80232
|
const customInstructions = args.join(" ").trim() || void 0;
|
|
80196
|
-
const compactionId =
|
|
80233
|
+
const compactionId = randomUUID9();
|
|
80197
80234
|
await this.conn.sessionUpdate({
|
|
80198
80235
|
sessionId: session.sessionId,
|
|
80199
80236
|
update: {
|
|
@@ -80282,6 +80319,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80282
80319
|
sessionId: session.sessionId,
|
|
80283
80320
|
update: {
|
|
80284
80321
|
sessionUpdate: "agent_message_chunk",
|
|
80322
|
+
messageId: randomUUID9(),
|
|
80285
80323
|
content: { type: "text", text: text2 }
|
|
80286
80324
|
}
|
|
80287
80325
|
});
|
|
@@ -80294,6 +80332,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80294
80332
|
sessionId: session.sessionId,
|
|
80295
80333
|
update: {
|
|
80296
80334
|
sessionUpdate: "agent_message_chunk",
|
|
80335
|
+
messageId: randomUUID9(),
|
|
80297
80336
|
content: { type: "text", text: "Usage: /name <name>" }
|
|
80298
80337
|
}
|
|
80299
80338
|
});
|
|
@@ -80308,6 +80347,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80308
80347
|
sessionId: session.sessionId,
|
|
80309
80348
|
update: {
|
|
80310
80349
|
sessionUpdate: "agent_message_chunk",
|
|
80350
|
+
messageId: randomUUID9(),
|
|
80311
80351
|
content: { type: "text", text: `Failed to set session name: ${msg}${hint}` }
|
|
80312
80352
|
}
|
|
80313
80353
|
});
|
|
@@ -80325,6 +80365,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80325
80365
|
sessionId: session.sessionId,
|
|
80326
80366
|
update: {
|
|
80327
80367
|
sessionUpdate: "agent_message_chunk",
|
|
80368
|
+
messageId: randomUUID9(),
|
|
80328
80369
|
content: { type: "text", text: `Session name set: ${name2}` }
|
|
80329
80370
|
}
|
|
80330
80371
|
});
|
|
@@ -80339,6 +80380,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80339
80380
|
sessionId: session.sessionId,
|
|
80340
80381
|
update: {
|
|
80341
80382
|
sessionUpdate: "agent_message_chunk",
|
|
80383
|
+
messageId: randomUUID9(),
|
|
80342
80384
|
content: {
|
|
80343
80385
|
type: "text",
|
|
80344
80386
|
text: `Steering mode: ${current || "unknown"}`
|
|
@@ -80352,6 +80394,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80352
80394
|
sessionId: session.sessionId,
|
|
80353
80395
|
update: {
|
|
80354
80396
|
sessionUpdate: "agent_message_chunk",
|
|
80397
|
+
messageId: randomUUID9(),
|
|
80355
80398
|
content: {
|
|
80356
80399
|
type: "text",
|
|
80357
80400
|
text: "Usage: /steering all | /steering one-at-a-time"
|
|
@@ -80365,6 +80408,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80365
80408
|
sessionId: session.sessionId,
|
|
80366
80409
|
update: {
|
|
80367
80410
|
sessionUpdate: "agent_message_chunk",
|
|
80411
|
+
messageId: randomUUID9(),
|
|
80368
80412
|
content: { type: "text", text: `Steering mode set to: ${modeRaw}` }
|
|
80369
80413
|
}
|
|
80370
80414
|
});
|
|
@@ -80379,6 +80423,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80379
80423
|
sessionId: session.sessionId,
|
|
80380
80424
|
update: {
|
|
80381
80425
|
sessionUpdate: "agent_message_chunk",
|
|
80426
|
+
messageId: randomUUID9(),
|
|
80382
80427
|
content: {
|
|
80383
80428
|
type: "text",
|
|
80384
80429
|
text: `Follow-up mode: ${current || "unknown"}`
|
|
@@ -80392,6 +80437,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80392
80437
|
sessionId: session.sessionId,
|
|
80393
80438
|
update: {
|
|
80394
80439
|
sessionUpdate: "agent_message_chunk",
|
|
80440
|
+
messageId: randomUUID9(),
|
|
80395
80441
|
content: {
|
|
80396
80442
|
type: "text",
|
|
80397
80443
|
text: "Usage: /follow-up all | /follow-up one-at-a-time"
|
|
@@ -80405,6 +80451,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80405
80451
|
sessionId: session.sessionId,
|
|
80406
80452
|
update: {
|
|
80407
80453
|
sessionUpdate: "agent_message_chunk",
|
|
80454
|
+
messageId: randomUUID9(),
|
|
80408
80455
|
content: { type: "text", text: `Follow-up mode set to: ${modeRaw}` }
|
|
80409
80456
|
}
|
|
80410
80457
|
});
|
|
@@ -80445,6 +80492,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80445
80492
|
sessionId: session.sessionId,
|
|
80446
80493
|
update: {
|
|
80447
80494
|
sessionUpdate: "agent_message_chunk",
|
|
80495
|
+
messageId: randomUUID9(),
|
|
80448
80496
|
content: { type: "text", text: "Changelog not found (couldn't locate pi installation)." }
|
|
80449
80497
|
}
|
|
80450
80498
|
});
|
|
@@ -80458,6 +80506,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80458
80506
|
sessionId: session.sessionId,
|
|
80459
80507
|
update: {
|
|
80460
80508
|
sessionUpdate: "agent_message_chunk",
|
|
80509
|
+
messageId: randomUUID9(),
|
|
80461
80510
|
content: { type: "text", text: `Failed to read changelog: ${String(e?.message ?? e)}` }
|
|
80462
80511
|
}
|
|
80463
80512
|
});
|
|
@@ -80473,6 +80522,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80473
80522
|
sessionId: session.sessionId,
|
|
80474
80523
|
update: {
|
|
80475
80524
|
sessionUpdate: "agent_message_chunk",
|
|
80525
|
+
messageId: randomUUID9(),
|
|
80476
80526
|
content: { type: "text", text: text2 }
|
|
80477
80527
|
}
|
|
80478
80528
|
});
|
|
@@ -80487,6 +80537,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80487
80537
|
sessionId: session.sessionId,
|
|
80488
80538
|
update: {
|
|
80489
80539
|
sessionUpdate: "agent_message_chunk",
|
|
80540
|
+
messageId: randomUUID9(),
|
|
80490
80541
|
content: {
|
|
80491
80542
|
type: "text",
|
|
80492
80543
|
text: "Nothing to export yet (no session messages). Send a prompt first."
|
|
@@ -80502,6 +80553,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80502
80553
|
sessionId: session.sessionId,
|
|
80503
80554
|
update: {
|
|
80504
80555
|
sessionUpdate: "agent_message_chunk",
|
|
80556
|
+
messageId: randomUUID9(),
|
|
80505
80557
|
content: {
|
|
80506
80558
|
type: "text",
|
|
80507
80559
|
text: "Nothing to export yet (empty session file). Send a prompt first."
|
|
@@ -80515,6 +80567,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80515
80567
|
sessionId: session.sessionId,
|
|
80516
80568
|
update: {
|
|
80517
80569
|
sessionUpdate: "agent_message_chunk",
|
|
80570
|
+
messageId: randomUUID9(),
|
|
80518
80571
|
content: {
|
|
80519
80572
|
type: "text",
|
|
80520
80573
|
text: "Couldn't read session file for export. Try sending a prompt first."
|
|
@@ -80534,6 +80587,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80534
80587
|
sessionId: session.sessionId,
|
|
80535
80588
|
update: {
|
|
80536
80589
|
sessionUpdate: "agent_message_chunk",
|
|
80590
|
+
messageId: randomUUID9(),
|
|
80537
80591
|
content: {
|
|
80538
80592
|
type: "text",
|
|
80539
80593
|
text: `Export failed: ${String(e?.message ?? e)}`
|
|
@@ -80547,6 +80601,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80547
80601
|
sessionId: session.sessionId,
|
|
80548
80602
|
update: {
|
|
80549
80603
|
sessionUpdate: "agent_message_chunk",
|
|
80604
|
+
messageId: randomUUID9(),
|
|
80550
80605
|
content: {
|
|
80551
80606
|
type: "text",
|
|
80552
80607
|
text: "Export failed: no output path returned by pi."
|
|
@@ -80556,10 +80611,12 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80556
80611
|
return { stopReason: "end_turn" };
|
|
80557
80612
|
}
|
|
80558
80613
|
const uri = `file://${resultPath}`;
|
|
80614
|
+
const messageId = randomUUID9();
|
|
80559
80615
|
await this.conn.sessionUpdate({
|
|
80560
80616
|
sessionId: session.sessionId,
|
|
80561
80617
|
update: {
|
|
80562
80618
|
sessionUpdate: "agent_message_chunk",
|
|
80619
|
+
messageId,
|
|
80563
80620
|
content: {
|
|
80564
80621
|
type: "text",
|
|
80565
80622
|
text: "Session exported: "
|
|
@@ -80570,6 +80627,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80570
80627
|
sessionId: session.sessionId,
|
|
80571
80628
|
update: {
|
|
80572
80629
|
sessionUpdate: "agent_message_chunk",
|
|
80630
|
+
messageId,
|
|
80573
80631
|
content: {
|
|
80574
80632
|
type: "resource_link",
|
|
80575
80633
|
name: `pi-session-${safeSessionId}.html`,
|
|
@@ -80599,6 +80657,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80599
80657
|
sessionId: session.sessionId,
|
|
80600
80658
|
update: {
|
|
80601
80659
|
sessionUpdate: "agent_message_chunk",
|
|
80660
|
+
messageId: randomUUID9(),
|
|
80602
80661
|
content: {
|
|
80603
80662
|
type: "text",
|
|
80604
80663
|
text: `Auto-compaction ${enabled ? "enabled" : "disabled"}.`
|
|
@@ -80834,6 +80893,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80834
80893
|
sessionId: session.sessionId,
|
|
80835
80894
|
update: {
|
|
80836
80895
|
sessionUpdate: "user_message_chunk",
|
|
80896
|
+
messageId: randomUUID9(),
|
|
80837
80897
|
content: { type: "text", text: text2 }
|
|
80838
80898
|
}
|
|
80839
80899
|
});
|
|
@@ -80846,6 +80906,7 @@ ${JSON.stringify(stats, null, 2)}`;
|
|
|
80846
80906
|
sessionId: session.sessionId,
|
|
80847
80907
|
update: {
|
|
80848
80908
|
sessionUpdate: "agent_message_chunk",
|
|
80909
|
+
messageId: randomUUID9(),
|
|
80849
80910
|
content: { type: "text", text: text2 }
|
|
80850
80911
|
}
|
|
80851
80912
|
});
|
|
@@ -82392,11 +82453,11 @@ async function unchangedIdentity(agent, signal) {
|
|
|
82392
82453
|
}
|
|
82393
82454
|
|
|
82394
82455
|
// src/runtime/connection/runtime-installation-store.ts
|
|
82395
|
-
import { randomUUID as
|
|
82456
|
+
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
82396
82457
|
import { resolve as resolve15 } from "node:path";
|
|
82397
82458
|
|
|
82398
82459
|
// src/storage/installation/installation-files.ts
|
|
82399
|
-
import { createHash as createHash5, randomUUID as
|
|
82460
|
+
import { createHash as createHash5, randomUUID as randomUUID10 } from "node:crypto";
|
|
82400
82461
|
import { mkdir as mkdir4, open as open5, readdir as readdir5, rename as rename3, unlink as unlink3, writeFile } from "node:fs/promises";
|
|
82401
82462
|
import { dirname as dirname9, join as join23 } from "node:path";
|
|
82402
82463
|
|
|
@@ -82458,7 +82519,7 @@ async function readInstallationFile(path7) {
|
|
|
82458
82519
|
async function writeInstallationFile(path7, text2, signal) {
|
|
82459
82520
|
signal.throwIfAborted();
|
|
82460
82521
|
const directory = dirname9(path7);
|
|
82461
|
-
const temporaryPath = join23(directory, `.${
|
|
82522
|
+
const temporaryPath = join23(directory, `.${randomUUID10()}.tmp`);
|
|
82462
82523
|
try {
|
|
82463
82524
|
await mkdir4(directory, { mode: 448, recursive: true });
|
|
82464
82525
|
signal.throwIfAborted();
|
|
@@ -82617,10 +82678,10 @@ function parseRelayOrigin(value) {
|
|
|
82617
82678
|
return origin;
|
|
82618
82679
|
}
|
|
82619
82680
|
function connectionId() {
|
|
82620
|
-
return `mcn_${
|
|
82681
|
+
return `mcn_${randomUUID11().replaceAll("-", "")}`;
|
|
82621
82682
|
}
|
|
82622
82683
|
function installationId() {
|
|
82623
|
-
return `min_${
|
|
82684
|
+
return `min_${randomUUID11().replaceAll("-", "")}`;
|
|
82624
82685
|
}
|
|
82625
82686
|
function decodeInstallationPointer(value) {
|
|
82626
82687
|
if (!isRecord7(value) || !hasExactKeys(value, INSTALLATION_POINTER_KEYS) || value["version"] !== 1) {
|
|
@@ -86032,7 +86093,7 @@ var SessionManager2 = class {
|
|
|
86032
86093
|
};
|
|
86033
86094
|
|
|
86034
86095
|
// src/session/native/native-session-browser.ts
|
|
86035
|
-
import { randomUUID as
|
|
86096
|
+
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
86036
86097
|
|
|
86037
86098
|
// src/session/workspace/local-authorization-error.ts
|
|
86038
86099
|
var LocalAuthorizationError = class extends OperationError {
|
|
@@ -86141,7 +86202,7 @@ var NativeSessionService = class {
|
|
|
86141
86202
|
if (authorized === null) {
|
|
86142
86203
|
return null;
|
|
86143
86204
|
}
|
|
86144
|
-
const entryId = decodeIdentifier(
|
|
86205
|
+
const entryId = decodeIdentifier(randomUUID12());
|
|
86145
86206
|
if (this.#entries.size >= 5e3) {
|
|
86146
86207
|
this.#entries.clear();
|
|
86147
86208
|
}
|
|
@@ -86197,7 +86258,7 @@ var NativeSessionService = class {
|
|
|
86197
86258
|
"invalid_native_session_response"
|
|
86198
86259
|
);
|
|
86199
86260
|
}
|
|
86200
|
-
nextCursor = decodeIdentifier(
|
|
86261
|
+
nextCursor = decodeIdentifier(randomUUID12());
|
|
86201
86262
|
if (this.#cursors.size >= 500) {
|
|
86202
86263
|
this.#cursors.clear();
|
|
86203
86264
|
}
|
|
@@ -86559,7 +86620,7 @@ async function settleAbandonedTurn(projection, operations, cancellation) {
|
|
|
86559
86620
|
}
|
|
86560
86621
|
|
|
86561
86622
|
// src/session/turn/execution-receipts.ts
|
|
86562
|
-
import { createHash as createHash6, randomUUID as
|
|
86623
|
+
import { createHash as createHash6, randomUUID as randomUUID13 } from "node:crypto";
|
|
86563
86624
|
var MAX_TERMINAL_RECEIPTS = 1024;
|
|
86564
86625
|
function isTerminal(state) {
|
|
86565
86626
|
return state === "succeeded" || state === "failed" || state === "cancelled";
|
|
@@ -86688,7 +86749,7 @@ var ExecutionReceipts = class {
|
|
|
86688
86749
|
outcome: this.#recoveredCommands.has(commandId) ? this.outcome(commandId) : void 0
|
|
86689
86750
|
};
|
|
86690
86751
|
}
|
|
86691
|
-
const attemptId =
|
|
86752
|
+
const attemptId = randomUUID13();
|
|
86692
86753
|
this.#save(commandId, {
|
|
86693
86754
|
attemptId,
|
|
86694
86755
|
commandHash,
|
|
@@ -86812,7 +86873,7 @@ var RuntimeTurnActivity = class {
|
|
|
86812
86873
|
};
|
|
86813
86874
|
|
|
86814
86875
|
// src/session/turn/active-turn.ts
|
|
86815
|
-
import { randomUUID as
|
|
86876
|
+
import { randomUUID as randomUUID14 } from "node:crypto";
|
|
86816
86877
|
var ActiveRuntimeTurn = class {
|
|
86817
86878
|
attemptId;
|
|
86818
86879
|
command;
|
|
@@ -86822,7 +86883,7 @@ var ActiveRuntimeTurn = class {
|
|
|
86822
86883
|
#dispatch;
|
|
86823
86884
|
#sequence = 0;
|
|
86824
86885
|
#interaction = null;
|
|
86825
|
-
#epoch = decodeIdentifier(
|
|
86886
|
+
#epoch = decodeIdentifier(randomUUID14());
|
|
86826
86887
|
constructor(command, attemptId) {
|
|
86827
86888
|
this.attemptId = attemptId;
|
|
86828
86889
|
this.command = command;
|
|
@@ -87379,11 +87440,11 @@ import { createHash as createHash7 } from "node:crypto";
|
|
|
87379
87440
|
import { join as join27 } from "node:path";
|
|
87380
87441
|
|
|
87381
87442
|
// src/storage/files/scratch-directory.ts
|
|
87382
|
-
import { randomUUID as
|
|
87443
|
+
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
87383
87444
|
import { lstat as lstat4, mkdir as mkdir5, readdir as readdir6, realpath as realpath7, rename as rename4, rm as rm3, stat as stat6, utimes, writeFile as writeFile2 } from "node:fs/promises";
|
|
87384
87445
|
import { dirname as dirname11, join as join26 } from "node:path";
|
|
87385
87446
|
async function atomicWrite(path7, bytes, signal) {
|
|
87386
|
-
const temporary = `${path7}.${
|
|
87447
|
+
const temporary = `${path7}.${randomUUID15()}.tmp`;
|
|
87387
87448
|
try {
|
|
87388
87449
|
await writeFile2(temporary, bytes, { mode: 384, signal });
|
|
87389
87450
|
signal.throwIfAborted();
|
|
@@ -87395,7 +87456,7 @@ async function atomicWrite(path7, bytes, signal) {
|
|
|
87395
87456
|
var ScratchDirectory = class {
|
|
87396
87457
|
#root;
|
|
87397
87458
|
constructor(parent) {
|
|
87398
|
-
this.#root = join26(parent,
|
|
87459
|
+
this.#root = join26(parent, randomUUID15());
|
|
87399
87460
|
}
|
|
87400
87461
|
/** Refreshes this directory's lease and removes sibling directories whose lease is older than `leaseMilliseconds`. */
|
|
87401
87462
|
refreshLease = async (leaseMilliseconds) => {
|
|
@@ -89395,7 +89456,7 @@ function createNativeSessionCommands(context) {
|
|
|
89395
89456
|
}
|
|
89396
89457
|
|
|
89397
89458
|
// src/session/prompt/apply-session-configuration.ts
|
|
89398
|
-
import { randomUUID as
|
|
89459
|
+
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
89399
89460
|
function invalidSessionConfiguration(message) {
|
|
89400
89461
|
return new AcpExecutionError(message, {}, "invalid_session_configuration");
|
|
89401
89462
|
}
|
|
@@ -89533,7 +89594,7 @@ async function applySessionConfigurationSelection(sessions, options, selection,
|
|
|
89533
89594
|
booleanValue: selection.booleanValue,
|
|
89534
89595
|
configId: selection.configId,
|
|
89535
89596
|
cwd,
|
|
89536
|
-
requestId: `cfg_${
|
|
89597
|
+
requestId: `cfg_${randomUUID16()}`,
|
|
89537
89598
|
sessionId,
|
|
89538
89599
|
signal,
|
|
89539
89600
|
value: selection.value,
|