@moxt-ai/mobius 0.0.117 → 0.0.119
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/codex/agent.d.ts +1 -0
- package/dist/acp/codex/agent.d.ts.map +1 -1
- package/dist/acp/codex/agent.js +29 -2
- package/dist/acp/codex/agent.js.map +1 -1
- package/dist/acp/codex/app-server-protocol.d.ts +6 -0
- package/dist/acp/codex/app-server-protocol.d.ts.map +1 -1
- package/dist/acp/codex/app-server-protocol.js +6 -0
- package/dist/acp/codex/app-server-protocol.js.map +1 -1
- package/dist/acp/in-process/acp-endpoint.d.ts +2 -0
- package/dist/acp/in-process/acp-endpoint.d.ts.map +1 -1
- package/dist/acp/process-session.d.ts +8 -1
- package/dist/acp/process-session.d.ts.map +1 -1
- package/dist/acp/process-session.js +12 -0
- package/dist/acp/process-session.js.map +1 -1
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +1 -1
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/artifacts/local-file-streamer.d.ts +1 -1
- package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
- package/dist/artifacts/local-file-streamer.js +10 -6
- package/dist/artifacts/local-file-streamer.js.map +1 -1
- package/dist/cli.js +120 -49
- package/dist/cli.js.map +3 -3
- package/dist/index.js +105 -34
- package/dist/index.js.map +3 -3
- package/dist/native-sessions/codex-history.d.ts +8 -1
- package/dist/native-sessions/codex-history.d.ts.map +1 -1
- package/dist/native-sessions/codex-history.js +8 -2
- package/dist/native-sessions/codex-history.js.map +1 -1
- package/dist/native-sessions/live-history-page.d.ts.map +1 -1
- package/dist/native-sessions/live-history-page.js +15 -1
- package/dist/native-sessions/live-history-page.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +3 -3
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +109 -38
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5060,7 +5060,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
5060
5060
|
var NONE = 0;
|
|
5061
5061
|
var ASSUMED = 1;
|
|
5062
5062
|
var PROVEN = 2;
|
|
5063
|
-
function isRecursive(inst, stack,
|
|
5063
|
+
function isRecursive(inst, stack, resolve9) {
|
|
5064
5064
|
const cached2 = recursive.get(inst);
|
|
5065
5065
|
if (cached2 !== void 0)
|
|
5066
5066
|
return cached2 ? PROVEN : NONE;
|
|
@@ -5070,7 +5070,7 @@ function isRecursive(inst, stack, resolve8) {
|
|
|
5070
5070
|
let result = NONE;
|
|
5071
5071
|
const check2 = (child) => {
|
|
5072
5072
|
if (result !== PROVEN && child?._zod) {
|
|
5073
|
-
const answer = isRecursive(child, stack,
|
|
5073
|
+
const answer = isRecursive(child, stack, resolve9);
|
|
5074
5074
|
if (answer > result)
|
|
5075
5075
|
result = answer;
|
|
5076
5076
|
}
|
|
@@ -5081,7 +5081,7 @@ function isRecursive(inst, stack, resolve8) {
|
|
|
5081
5081
|
const desc2 = Object.getOwnPropertyDescriptor(sh, key);
|
|
5082
5082
|
if (spread && !desc2.enumerable)
|
|
5083
5083
|
continue;
|
|
5084
|
-
const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack,
|
|
5084
|
+
const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve9) : NONE;
|
|
5085
5085
|
if (child > answer)
|
|
5086
5086
|
answer = child;
|
|
5087
5087
|
}
|
|
@@ -5145,7 +5145,7 @@ function isRecursive(inst, stack, resolve8) {
|
|
|
5145
5145
|
break;
|
|
5146
5146
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
5147
5147
|
case "lazy": {
|
|
5148
|
-
const inner = def._cachedInner ?? (
|
|
5148
|
+
const inner = def._cachedInner ?? (resolve9 ? inst._zod.innerType : void 0);
|
|
5149
5149
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
5150
5150
|
break;
|
|
5151
5151
|
}
|
|
@@ -29883,7 +29883,7 @@ function createWritableAcpStream(output2) {
|
|
|
29883
29883
|
if (outputFailure !== void 0) {
|
|
29884
29884
|
return Promise.reject(outputFailure);
|
|
29885
29885
|
}
|
|
29886
|
-
return new Promise((
|
|
29886
|
+
return new Promise((resolve9, reject) => {
|
|
29887
29887
|
pendingWriteFailures.add(reject);
|
|
29888
29888
|
output2.write(chunk, (error62) => {
|
|
29889
29889
|
pendingWriteFailures.delete(reject);
|
|
@@ -29896,7 +29896,7 @@ function createWritableAcpStream(output2) {
|
|
|
29896
29896
|
reject(outputFailure);
|
|
29897
29897
|
return;
|
|
29898
29898
|
}
|
|
29899
|
-
|
|
29899
|
+
resolve9();
|
|
29900
29900
|
});
|
|
29901
29901
|
});
|
|
29902
29902
|
}
|
|
@@ -29940,6 +29940,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
29940
29940
|
#configOptions = [];
|
|
29941
29941
|
#nativeSessionId = "";
|
|
29942
29942
|
#prompted = false;
|
|
29943
|
+
#nativePrompt = null;
|
|
29943
29944
|
#replay = {
|
|
29944
29945
|
kind: "idle"
|
|
29945
29946
|
};
|
|
@@ -29991,12 +29992,12 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
29991
29992
|
stderr.on("data", (chunk) => {
|
|
29992
29993
|
process.stderr.write(`[${agent.id}-acp] ${chunk}`);
|
|
29993
29994
|
});
|
|
29994
|
-
this.#termination = new Promise((
|
|
29995
|
+
this.#termination = new Promise((resolve9) => {
|
|
29995
29996
|
child.once("error", (cause) => {
|
|
29996
|
-
|
|
29997
|
+
resolve9({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
|
|
29997
29998
|
});
|
|
29998
29999
|
child.once("exit", (code, signal) => {
|
|
29999
|
-
|
|
30000
|
+
resolve9({
|
|
30000
30001
|
kind: "failed",
|
|
30001
30002
|
error: new AcpExecutionError("The ACP process stopped", { cause: { code, signal } })
|
|
30002
30003
|
});
|
|
@@ -30597,6 +30598,11 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
30597
30598
|
}
|
|
30598
30599
|
return prompt;
|
|
30599
30600
|
};
|
|
30601
|
+
nativeHistoryTurn = () => {
|
|
30602
|
+
const prompt = this.#nativePrompt;
|
|
30603
|
+
const nativeTurnId = this.#inProcessAgent?.nativeTurnId?.() ?? null;
|
|
30604
|
+
return prompt === null || nativeTurnId === null || nativeTurnId === prompt.previousTurnId ? null : { commandId: prompt.commandId, nativeTurnId };
|
|
30605
|
+
};
|
|
30600
30606
|
prompt = async (options) => {
|
|
30601
30607
|
if (this.#turn.running) {
|
|
30602
30608
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
@@ -30625,6 +30631,10 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
30625
30631
|
this.prepareAgentContent
|
|
30626
30632
|
);
|
|
30627
30633
|
this.#turn = running;
|
|
30634
|
+
this.#nativePrompt = {
|
|
30635
|
+
commandId: options.commandId,
|
|
30636
|
+
previousTurnId: this.#inProcessAgent?.nativeTurnId?.() ?? null
|
|
30637
|
+
};
|
|
30628
30638
|
try {
|
|
30629
30639
|
const response = await this.race(
|
|
30630
30640
|
this.#connection.agent.request(
|
|
@@ -32066,7 +32076,11 @@ var AcpSessionManager = class {
|
|
|
32066
32076
|
const runtime = await this.ensureSession(options);
|
|
32067
32077
|
const stored = this.#store.read(options.sessionId);
|
|
32068
32078
|
if (stored instanceof FoundAcpStoredSession && this.#nativeHistoryReader !== null) {
|
|
32069
|
-
const history = await this.#nativeHistoryReader.read(
|
|
32079
|
+
const history = await this.#nativeHistoryReader.read(
|
|
32080
|
+
options,
|
|
32081
|
+
stored.session.nativeSessionId,
|
|
32082
|
+
runtime.nativeHistoryTurn
|
|
32083
|
+
);
|
|
32070
32084
|
if (history !== null) {
|
|
32071
32085
|
return history;
|
|
32072
32086
|
}
|
|
@@ -32947,6 +32961,12 @@ var requestUserInputParamsSchema = external_exports.object({
|
|
|
32947
32961
|
threadId: boundedText(256),
|
|
32948
32962
|
turnId: boundedText(256)
|
|
32949
32963
|
});
|
|
32964
|
+
var reasoningTextDeltaParamsSchema = external_exports.object({
|
|
32965
|
+
delta: boundedText(1e5),
|
|
32966
|
+
itemId: boundedText(256),
|
|
32967
|
+
threadId: boundedText(256),
|
|
32968
|
+
turnId: boundedText(256)
|
|
32969
|
+
});
|
|
32950
32970
|
var mcpElicitationParamsSchema = external_exports.object({
|
|
32951
32971
|
message: boundedText(4096),
|
|
32952
32972
|
mode: external_exports.enum(["form", "url"]).or(external_exports.string()),
|
|
@@ -33682,7 +33702,9 @@ var CodexAcpAgent = class {
|
|
|
33682
33702
|
// rather than break every turn.
|
|
33683
33703
|
#collaborationModeSupported = null;
|
|
33684
33704
|
#selection;
|
|
33705
|
+
#streamedReasoningItemIds = /* @__PURE__ */ new Set();
|
|
33685
33706
|
#turn = null;
|
|
33707
|
+
#nativeTurnId = null;
|
|
33686
33708
|
#updateTail = Promise.resolve();
|
|
33687
33709
|
constructor(options) {
|
|
33688
33710
|
this.#selection = {
|
|
@@ -33821,6 +33843,7 @@ var CodexAcpAgent = class {
|
|
|
33821
33843
|
}
|
|
33822
33844
|
/** The ACP agent app Mobius connects its own ACP client to, in-process. */
|
|
33823
33845
|
app = () => this.#app;
|
|
33846
|
+
nativeTurnId = () => this.#nativeTurnId;
|
|
33824
33847
|
/** Starts the app-server, performs its handshake, and reads the model catalog Codex offers. */
|
|
33825
33848
|
initialize = async (signal) => {
|
|
33826
33849
|
await this.#appServer.initialize(signal);
|
|
@@ -34092,6 +34115,7 @@ var CodexAcpAgent = class {
|
|
|
34092
34115
|
const decoded = turnNotificationSchema.safeParse(params);
|
|
34093
34116
|
if (decoded.success && decoded.data.threadId === this.#nativeSessionId && this.#turn !== null) {
|
|
34094
34117
|
this.#turn.turn.id = decoded.data.turn.id;
|
|
34118
|
+
this.#nativeTurnId = decoded.data.turn.id;
|
|
34095
34119
|
}
|
|
34096
34120
|
return;
|
|
34097
34121
|
}
|
|
@@ -34138,6 +34162,20 @@ var CodexAcpAgent = class {
|
|
|
34138
34162
|
}
|
|
34139
34163
|
return;
|
|
34140
34164
|
}
|
|
34165
|
+
if (method === "item/reasoning/summaryTextDelta" || method === "item/reasoning/textDelta") {
|
|
34166
|
+
const decoded = reasoningTextDeltaParamsSchema.safeParse(params);
|
|
34167
|
+
if (decoded.success && decoded.data.threadId === this.#nativeSessionId && this.#turn !== null && decoded.data.turnId === this.#turn.turn.id && decoded.data.delta.length > 0) {
|
|
34168
|
+
this.#streamedReasoningItemIds.add(decoded.data.itemId);
|
|
34169
|
+
await this.#enqueue(async () => {
|
|
34170
|
+
await this.#emit({
|
|
34171
|
+
content: { text: decoded.data.delta, type: "text" },
|
|
34172
|
+
messageId: decoded.data.itemId,
|
|
34173
|
+
sessionUpdate: "agent_thought_chunk"
|
|
34174
|
+
});
|
|
34175
|
+
});
|
|
34176
|
+
}
|
|
34177
|
+
return;
|
|
34178
|
+
}
|
|
34141
34179
|
if (method !== "item/started" && method !== "item/completed") {
|
|
34142
34180
|
return;
|
|
34143
34181
|
}
|
|
@@ -34161,7 +34199,8 @@ var CodexAcpAgent = class {
|
|
|
34161
34199
|
}
|
|
34162
34200
|
const reasoning = reasoningText(item);
|
|
34163
34201
|
if (reasoning !== null) {
|
|
34164
|
-
|
|
34202
|
+
const streamed = method === "item/completed" && this.#streamedReasoningItemIds.delete(item.id);
|
|
34203
|
+
if (method === "item/completed" && reasoning.length > 0 && !streamed) {
|
|
34165
34204
|
await this.#enqueue(async () => {
|
|
34166
34205
|
await this.#emit({
|
|
34167
34206
|
content: { text: reasoning, type: "text" },
|
|
@@ -34308,7 +34347,9 @@ var CodexAcpAgent = class {
|
|
|
34308
34347
|
};
|
|
34309
34348
|
signal.addEventListener("abort", aborted2, { once: true });
|
|
34310
34349
|
const turn = { completion, turn: { id: "" } };
|
|
34350
|
+
this.#streamedReasoningItemIds.clear();
|
|
34311
34351
|
this.#turn = turn;
|
|
34352
|
+
this.#nativeTurnId = null;
|
|
34312
34353
|
try {
|
|
34313
34354
|
const selection = this.#selection;
|
|
34314
34355
|
const mode = AGENT_MODES.find((candidate) => candidate.id === selection.mode) ?? DEFAULT_MODE;
|
|
@@ -34349,12 +34390,14 @@ var CodexAcpAgent = class {
|
|
|
34349
34390
|
);
|
|
34350
34391
|
if (this.#turn === turn) {
|
|
34351
34392
|
turn.turn.id = started.id;
|
|
34393
|
+
this.#nativeTurnId = started.id;
|
|
34352
34394
|
}
|
|
34353
34395
|
return await completion.promise;
|
|
34354
34396
|
} finally {
|
|
34355
34397
|
signal.removeEventListener("abort", aborted2);
|
|
34356
34398
|
if (this.#turn === turn) {
|
|
34357
34399
|
this.#turn = null;
|
|
34400
|
+
this.#streamedReasoningItemIds.clear();
|
|
34358
34401
|
}
|
|
34359
34402
|
}
|
|
34360
34403
|
};
|
|
@@ -37560,8 +37603,19 @@ function paginateLiveSessionHistory(history, activeTurn, sessionId, cursor, limi
|
|
|
37560
37603
|
truncated: activeTurn.truncated || activeText.length !== activeTurn.text.length
|
|
37561
37604
|
};
|
|
37562
37605
|
}
|
|
37606
|
+
const activeUserIndex = history.coveredCommandIds.includes(activeTurn.commandId) ? history.messages.findLastIndex((message) => message.role === "user") : -1;
|
|
37607
|
+
if (activeUserIndex >= 0) {
|
|
37608
|
+
history = {
|
|
37609
|
+
...history,
|
|
37610
|
+
coveredCommandIds: history.coveredCommandIds.filter((id) => id !== activeTurn.commandId),
|
|
37611
|
+
coveredMessageIds: history.coveredMessageIds.filter(
|
|
37612
|
+
(id) => id !== `${activeTurn.commandId}:user` && id !== `${activeTurn.commandId}:agent`
|
|
37613
|
+
),
|
|
37614
|
+
messages: history.messages.slice(0, activeUserIndex + 1)
|
|
37615
|
+
};
|
|
37616
|
+
}
|
|
37563
37617
|
const latestNativeMessage = history.messages.at(-1);
|
|
37564
|
-
const activeMessages = latestNativeMessage?.role === "user" && latestNativeMessage.text === activeTurn.prompt ? completeActiveMessages.slice(1) : completeActiveMessages;
|
|
37618
|
+
const activeMessages = activeUserIndex >= 0 || latestNativeMessage?.role === "user" && latestNativeMessage.text === activeTurn.prompt ? completeActiveMessages.slice(1) : completeActiveMessages;
|
|
37565
37619
|
let historicalMessageCount = 0;
|
|
37566
37620
|
let remainingCharacters = SESSION_HISTORY_CHARACTER_LIMIT - activeText.length - activeMessageOverhead - activeStructuredCharacters - (activeMessages.length === completeActiveMessages.length ? activeTurn.prompt.length : 0);
|
|
37567
37621
|
const historicalMessageLimit = Math.max(0, limit - activeMessages.length);
|
|
@@ -39654,7 +39708,7 @@ var FixedInstallationExecutor = class {
|
|
|
39654
39708
|
// src/artifacts/local-file-streamer.ts
|
|
39655
39709
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
39656
39710
|
import { realpath as realpath8, stat as stat7 } from "node:fs/promises";
|
|
39657
|
-
import { basename as basename5, isAbsolute as isAbsolute9, normalize as normalize3 } from "node:path";
|
|
39711
|
+
import { basename as basename5, isAbsolute as isAbsolute9, normalize as normalize3, resolve as resolve7 } from "node:path";
|
|
39658
39712
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
39659
39713
|
var CHUNK_BYTES = 192 * 1024;
|
|
39660
39714
|
function requestedPath(value) {
|
|
@@ -39671,9 +39725,13 @@ function requestedPath(value) {
|
|
|
39671
39725
|
}
|
|
39672
39726
|
return value;
|
|
39673
39727
|
}
|
|
39674
|
-
async function resolveFile(value, signal) {
|
|
39675
|
-
const
|
|
39676
|
-
if (
|
|
39728
|
+
async function resolveFile(value, workingDirectory, signal) {
|
|
39729
|
+
const path2 = requestedPath(value);
|
|
39730
|
+
if (path2 === null || !isAbsolute9(path2) && workingDirectory === null) {
|
|
39731
|
+
return null;
|
|
39732
|
+
}
|
|
39733
|
+
const requested = workingDirectory === null ? path2 : resolve7(workingDirectory, path2);
|
|
39734
|
+
if (!isAbsolute9(requested) || isAbsolute9(path2) && normalize3(path2) !== path2) {
|
|
39677
39735
|
return null;
|
|
39678
39736
|
}
|
|
39679
39737
|
try {
|
|
@@ -39685,8 +39743,8 @@ async function resolveFile(value, signal) {
|
|
|
39685
39743
|
return null;
|
|
39686
39744
|
}
|
|
39687
39745
|
}
|
|
39688
|
-
async function streamLocalFile(command, send2, signal) {
|
|
39689
|
-
const target = await resolveFile(command.path, signal);
|
|
39746
|
+
async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
39747
|
+
const target = await resolveFile(command.path, workingDirectory, signal);
|
|
39690
39748
|
if (target === null) {
|
|
39691
39749
|
throw new Error("The local file is unavailable");
|
|
39692
39750
|
}
|
|
@@ -40220,6 +40278,7 @@ var threadSchema = external_exports.object({
|
|
|
40220
40278
|
var turnsSchema = external_exports.object({
|
|
40221
40279
|
data: external_exports.array(
|
|
40222
40280
|
external_exports.object({
|
|
40281
|
+
id: external_exports.string().min(1),
|
|
40223
40282
|
error: external_exports.unknown().nullish(),
|
|
40224
40283
|
items: external_exports.array(external_exports.unknown()).max(1e5)
|
|
40225
40284
|
})
|
|
@@ -40282,6 +40341,8 @@ function messageSize(message) {
|
|
|
40282
40341
|
}
|
|
40283
40342
|
function decodeHistory(thread, value, options) {
|
|
40284
40343
|
const page = turnsSchema.parse(value);
|
|
40344
|
+
const nativeTurn = options.nativeTurn?.();
|
|
40345
|
+
const coveredCommandIds = nativeTurn != null && page.data[0]?.id === nativeTurn.nativeTurnId ? [nativeTurn.commandId] : [];
|
|
40285
40346
|
const messages = [];
|
|
40286
40347
|
let characters = 0;
|
|
40287
40348
|
let truncated = page.nextCursor != null;
|
|
@@ -40425,7 +40486,7 @@ function decodeHistory(thread, value, options) {
|
|
|
40425
40486
|
status: "available",
|
|
40426
40487
|
messages,
|
|
40427
40488
|
truncated,
|
|
40428
|
-
coveredCommandIds
|
|
40489
|
+
coveredCommandIds,
|
|
40429
40490
|
coveredMessageIds: []
|
|
40430
40491
|
}
|
|
40431
40492
|
};
|
|
@@ -40625,7 +40686,10 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
|
|
|
40625
40686
|
}
|
|
40626
40687
|
}
|
|
40627
40688
|
var readCodexHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, { detail: "messages" });
|
|
40628
|
-
var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, {
|
|
40689
|
+
var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal, nativeTurn) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, {
|
|
40690
|
+
detail: "rich",
|
|
40691
|
+
...nativeTurn === void 0 ? {} : { nativeTurn }
|
|
40692
|
+
});
|
|
40629
40693
|
|
|
40630
40694
|
// src/native-sessions/handle-native-requests.ts
|
|
40631
40695
|
import { WebSocket as WebSocket5 } from "undici";
|
|
@@ -40665,13 +40729,13 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
40665
40729
|
operationSignal.throwIfAborted();
|
|
40666
40730
|
const skipPrevious = command.action === "active-turn";
|
|
40667
40731
|
if (previous.length > 0 && !skipPrevious) {
|
|
40668
|
-
await new Promise((
|
|
40732
|
+
await new Promise((resolve9, reject) => {
|
|
40669
40733
|
const onAbort = () => reject(operationSignal.reason);
|
|
40670
40734
|
operationSignal.addEventListener("abort", onAbort, { once: true });
|
|
40671
40735
|
void Promise.all(previous.map((request) => request.completion)).then(
|
|
40672
40736
|
() => {
|
|
40673
40737
|
operationSignal.removeEventListener("abort", onAbort);
|
|
40674
|
-
|
|
40738
|
+
resolve9();
|
|
40675
40739
|
},
|
|
40676
40740
|
(error62) => {
|
|
40677
40741
|
operationSignal.removeEventListener("abort", onAbort);
|
|
@@ -41230,7 +41294,7 @@ var RelayConnectionError = class extends Error {
|
|
|
41230
41294
|
};
|
|
41231
41295
|
function connectRelay(url2, signal) {
|
|
41232
41296
|
signal.throwIfAborted();
|
|
41233
|
-
return new Promise((
|
|
41297
|
+
return new Promise((resolve9, reject) => {
|
|
41234
41298
|
const endpoint = new URL(url2);
|
|
41235
41299
|
const headers = runtimeAuthorization(endpoint);
|
|
41236
41300
|
endpoint.searchParams.delete("token");
|
|
@@ -41297,7 +41361,7 @@ function connectRelay(url2, signal) {
|
|
|
41297
41361
|
}
|
|
41298
41362
|
finished = true;
|
|
41299
41363
|
cleanup();
|
|
41300
|
-
|
|
41364
|
+
resolve9(socket);
|
|
41301
41365
|
};
|
|
41302
41366
|
function onTimeout() {
|
|
41303
41367
|
fail(
|
|
@@ -41722,12 +41786,12 @@ function waitForRelayRetry(signal, timer) {
|
|
|
41722
41786
|
if (signal.aborted) {
|
|
41723
41787
|
return Promise.resolve();
|
|
41724
41788
|
}
|
|
41725
|
-
return new Promise((
|
|
41789
|
+
return new Promise((resolve9) => {
|
|
41726
41790
|
const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
|
|
41727
41791
|
function finish() {
|
|
41728
41792
|
retry.cancel();
|
|
41729
41793
|
signal.removeEventListener("abort", finish);
|
|
41730
|
-
|
|
41794
|
+
resolve9();
|
|
41731
41795
|
}
|
|
41732
41796
|
signal.addEventListener("abort", finish, { once: true });
|
|
41733
41797
|
});
|
|
@@ -41818,7 +41882,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41818
41882
|
installationObserver.connect(socket);
|
|
41819
41883
|
onConnected();
|
|
41820
41884
|
try {
|
|
41821
|
-
await new Promise((
|
|
41885
|
+
await new Promise((resolve9, reject) => {
|
|
41822
41886
|
let finished = false;
|
|
41823
41887
|
const cleanup = () => {
|
|
41824
41888
|
connectionLiveness.close();
|
|
@@ -41836,7 +41900,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41836
41900
|
}
|
|
41837
41901
|
finished = true;
|
|
41838
41902
|
cleanup();
|
|
41839
|
-
|
|
41903
|
+
resolve9();
|
|
41840
41904
|
};
|
|
41841
41905
|
const rejectConnection = (failure2) => {
|
|
41842
41906
|
if (finished) {
|
|
@@ -41859,7 +41923,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41859
41923
|
};
|
|
41860
41924
|
const waitForTurnCompletion = (turn, waitSignal) => {
|
|
41861
41925
|
waitSignal.throwIfAborted();
|
|
41862
|
-
return new Promise((
|
|
41926
|
+
return new Promise((resolve10, reject2) => {
|
|
41863
41927
|
let settled = false;
|
|
41864
41928
|
const finish = (result) => {
|
|
41865
41929
|
if (settled) {
|
|
@@ -41868,7 +41932,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
41868
41932
|
settled = true;
|
|
41869
41933
|
waitSignal.removeEventListener("abort", onAbort);
|
|
41870
41934
|
if (result.kind === "completed") {
|
|
41871
|
-
|
|
41935
|
+
resolve10();
|
|
41872
41936
|
} else {
|
|
41873
41937
|
reject2(result.error);
|
|
41874
41938
|
}
|
|
@@ -42024,7 +42088,8 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
42024
42088
|
void streamLocalFile(
|
|
42025
42089
|
command2,
|
|
42026
42090
|
(message2) => send(socket, message2),
|
|
42027
|
-
connectionController.signal
|
|
42091
|
+
connectionController.signal,
|
|
42092
|
+
sessions.findSessions([command2.sessionId])[0]?.cwd ?? null
|
|
42028
42093
|
).catch((error62) => {
|
|
42029
42094
|
if (socket.readyState !== WebSocket8.OPEN || connectionController.signal.aborted) {
|
|
42030
42095
|
return;
|
|
@@ -42256,7 +42321,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42256
42321
|
new DaemonAcpObserver(recordSessionEvent),
|
|
42257
42322
|
sessionStore,
|
|
42258
42323
|
{
|
|
42259
|
-
read: async (options2, nativeSessionId) => options2.agent.id === "codex" ? (await readCodexFullHistory(
|
|
42324
|
+
read: async (options2, nativeSessionId, nativeTurn) => options2.agent.id === "codex" ? (await readCodexFullHistory(
|
|
42325
|
+
options2.agent,
|
|
42326
|
+
options2.cwd,
|
|
42327
|
+
nativeSessionId,
|
|
42328
|
+
options2.signal,
|
|
42329
|
+
nativeTurn
|
|
42330
|
+
)).history : null
|
|
42260
42331
|
},
|
|
42261
42332
|
"native"
|
|
42262
42333
|
);
|
|
@@ -42418,7 +42489,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42418
42489
|
|
|
42419
42490
|
// src/runtime.ts
|
|
42420
42491
|
import { mkdir as mkdir6, realpath as realpath10, stat as stat9 } from "node:fs/promises";
|
|
42421
|
-
import { resolve as
|
|
42492
|
+
import { resolve as resolve8 } from "node:path";
|
|
42422
42493
|
var RUNTIME_CREDENTIAL_PATTERN2 = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
42423
42494
|
var MobiusRuntimeConfigurationError = class extends Error {
|
|
42424
42495
|
code = "runtime_configuration_invalid";
|
|
@@ -42481,7 +42552,7 @@ function loadMobiusRuntimeConnection(environment = process.env) {
|
|
|
42481
42552
|
});
|
|
42482
42553
|
}
|
|
42483
42554
|
async function resolveWorkspace(path2) {
|
|
42484
|
-
const requested =
|
|
42555
|
+
const requested = resolve8(path2);
|
|
42485
42556
|
try {
|
|
42486
42557
|
await mkdir6(requested, { recursive: true, mode: 448 });
|
|
42487
42558
|
const resolved = await realpath10(requested);
|