@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/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
import { constants as constants2 } from "node:fs";
|
|
10
10
|
import { mkdir as mkdir6, open as open6 } from "node:fs/promises";
|
|
11
|
-
import { resolve as
|
|
11
|
+
import { resolve as resolve8 } from "node:path";
|
|
12
12
|
|
|
13
13
|
// ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
14
14
|
var CommanderError = class extends Error {
|
|
@@ -3381,7 +3381,7 @@ var program = new Command();
|
|
|
3381
3381
|
// package.json
|
|
3382
3382
|
var package_default = {
|
|
3383
3383
|
name: "@moxt-ai/mobius",
|
|
3384
|
-
version: "0.0.
|
|
3384
|
+
version: "0.0.119",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -9853,7 +9853,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
9853
9853
|
var NONE = 0;
|
|
9854
9854
|
var ASSUMED = 1;
|
|
9855
9855
|
var PROVEN = 2;
|
|
9856
|
-
function isRecursive(inst, stack,
|
|
9856
|
+
function isRecursive(inst, stack, resolve9) {
|
|
9857
9857
|
const cached2 = recursive.get(inst);
|
|
9858
9858
|
if (cached2 !== void 0)
|
|
9859
9859
|
return cached2 ? PROVEN : NONE;
|
|
@@ -9863,7 +9863,7 @@ function isRecursive(inst, stack, resolve8) {
|
|
|
9863
9863
|
let result = NONE;
|
|
9864
9864
|
const check2 = (child) => {
|
|
9865
9865
|
if (result !== PROVEN && child?._zod) {
|
|
9866
|
-
const answer = isRecursive(child, stack,
|
|
9866
|
+
const answer = isRecursive(child, stack, resolve9);
|
|
9867
9867
|
if (answer > result)
|
|
9868
9868
|
result = answer;
|
|
9869
9869
|
}
|
|
@@ -9874,7 +9874,7 @@ function isRecursive(inst, stack, resolve8) {
|
|
|
9874
9874
|
const desc2 = Object.getOwnPropertyDescriptor(sh, key);
|
|
9875
9875
|
if (spread && !desc2.enumerable)
|
|
9876
9876
|
continue;
|
|
9877
|
-
const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack,
|
|
9877
|
+
const child = desc2.get ? ASSUMED : desc2.value?._zod ? isRecursive(desc2.value, stack, resolve9) : NONE;
|
|
9878
9878
|
if (child > answer)
|
|
9879
9879
|
answer = child;
|
|
9880
9880
|
}
|
|
@@ -9938,7 +9938,7 @@ function isRecursive(inst, stack, resolve8) {
|
|
|
9938
9938
|
break;
|
|
9939
9939
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
9940
9940
|
case "lazy": {
|
|
9941
|
-
const inner = def._cachedInner ?? (
|
|
9941
|
+
const inner = def._cachedInner ?? (resolve9 ? inst._zod.innerType : void 0);
|
|
9942
9942
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
9943
9943
|
break;
|
|
9944
9944
|
}
|
|
@@ -24648,6 +24648,12 @@ var requestUserInputParamsSchema = external_exports.object({
|
|
|
24648
24648
|
threadId: boundedText(256),
|
|
24649
24649
|
turnId: boundedText(256)
|
|
24650
24650
|
});
|
|
24651
|
+
var reasoningTextDeltaParamsSchema = external_exports.object({
|
|
24652
|
+
delta: boundedText(1e5),
|
|
24653
|
+
itemId: boundedText(256),
|
|
24654
|
+
threadId: boundedText(256),
|
|
24655
|
+
turnId: boundedText(256)
|
|
24656
|
+
});
|
|
24651
24657
|
var mcpElicitationParamsSchema = external_exports.object({
|
|
24652
24658
|
message: boundedText(4096),
|
|
24653
24659
|
mode: external_exports.enum(["form", "url"]).or(external_exports.string()),
|
|
@@ -25383,7 +25389,9 @@ var CodexAcpAgent = class {
|
|
|
25383
25389
|
// rather than break every turn.
|
|
25384
25390
|
#collaborationModeSupported = null;
|
|
25385
25391
|
#selection;
|
|
25392
|
+
#streamedReasoningItemIds = /* @__PURE__ */ new Set();
|
|
25386
25393
|
#turn = null;
|
|
25394
|
+
#nativeTurnId = null;
|
|
25387
25395
|
#updateTail = Promise.resolve();
|
|
25388
25396
|
constructor(options) {
|
|
25389
25397
|
this.#selection = {
|
|
@@ -25522,6 +25530,7 @@ var CodexAcpAgent = class {
|
|
|
25522
25530
|
}
|
|
25523
25531
|
/** The ACP agent app Mobius connects its own ACP client to, in-process. */
|
|
25524
25532
|
app = () => this.#app;
|
|
25533
|
+
nativeTurnId = () => this.#nativeTurnId;
|
|
25525
25534
|
/** Starts the app-server, performs its handshake, and reads the model catalog Codex offers. */
|
|
25526
25535
|
initialize = async (signal) => {
|
|
25527
25536
|
await this.#appServer.initialize(signal);
|
|
@@ -25793,6 +25802,7 @@ var CodexAcpAgent = class {
|
|
|
25793
25802
|
const decoded = turnNotificationSchema.safeParse(params);
|
|
25794
25803
|
if (decoded.success && decoded.data.threadId === this.#nativeSessionId && this.#turn !== null) {
|
|
25795
25804
|
this.#turn.turn.id = decoded.data.turn.id;
|
|
25805
|
+
this.#nativeTurnId = decoded.data.turn.id;
|
|
25796
25806
|
}
|
|
25797
25807
|
return;
|
|
25798
25808
|
}
|
|
@@ -25839,6 +25849,20 @@ var CodexAcpAgent = class {
|
|
|
25839
25849
|
}
|
|
25840
25850
|
return;
|
|
25841
25851
|
}
|
|
25852
|
+
if (method === "item/reasoning/summaryTextDelta" || method === "item/reasoning/textDelta") {
|
|
25853
|
+
const decoded = reasoningTextDeltaParamsSchema.safeParse(params);
|
|
25854
|
+
if (decoded.success && decoded.data.threadId === this.#nativeSessionId && this.#turn !== null && decoded.data.turnId === this.#turn.turn.id && decoded.data.delta.length > 0) {
|
|
25855
|
+
this.#streamedReasoningItemIds.add(decoded.data.itemId);
|
|
25856
|
+
await this.#enqueue(async () => {
|
|
25857
|
+
await this.#emit({
|
|
25858
|
+
content: { text: decoded.data.delta, type: "text" },
|
|
25859
|
+
messageId: decoded.data.itemId,
|
|
25860
|
+
sessionUpdate: "agent_thought_chunk"
|
|
25861
|
+
});
|
|
25862
|
+
});
|
|
25863
|
+
}
|
|
25864
|
+
return;
|
|
25865
|
+
}
|
|
25842
25866
|
if (method !== "item/started" && method !== "item/completed") {
|
|
25843
25867
|
return;
|
|
25844
25868
|
}
|
|
@@ -25862,7 +25886,8 @@ var CodexAcpAgent = class {
|
|
|
25862
25886
|
}
|
|
25863
25887
|
const reasoning = reasoningText(item);
|
|
25864
25888
|
if (reasoning !== null) {
|
|
25865
|
-
|
|
25889
|
+
const streamed = method === "item/completed" && this.#streamedReasoningItemIds.delete(item.id);
|
|
25890
|
+
if (method === "item/completed" && reasoning.length > 0 && !streamed) {
|
|
25866
25891
|
await this.#enqueue(async () => {
|
|
25867
25892
|
await this.#emit({
|
|
25868
25893
|
content: { text: reasoning, type: "text" },
|
|
@@ -26009,7 +26034,9 @@ var CodexAcpAgent = class {
|
|
|
26009
26034
|
};
|
|
26010
26035
|
signal.addEventListener("abort", aborted2, { once: true });
|
|
26011
26036
|
const turn = { completion, turn: { id: "" } };
|
|
26037
|
+
this.#streamedReasoningItemIds.clear();
|
|
26012
26038
|
this.#turn = turn;
|
|
26039
|
+
this.#nativeTurnId = null;
|
|
26013
26040
|
try {
|
|
26014
26041
|
const selection = this.#selection;
|
|
26015
26042
|
const mode = AGENT_MODES.find((candidate) => candidate.id === selection.mode) ?? DEFAULT_MODE;
|
|
@@ -26050,12 +26077,14 @@ var CodexAcpAgent = class {
|
|
|
26050
26077
|
);
|
|
26051
26078
|
if (this.#turn === turn) {
|
|
26052
26079
|
turn.turn.id = started.id;
|
|
26080
|
+
this.#nativeTurnId = started.id;
|
|
26053
26081
|
}
|
|
26054
26082
|
return await completion.promise;
|
|
26055
26083
|
} finally {
|
|
26056
26084
|
signal.removeEventListener("abort", aborted2);
|
|
26057
26085
|
if (this.#turn === turn) {
|
|
26058
26086
|
this.#turn = null;
|
|
26087
|
+
this.#streamedReasoningItemIds.clear();
|
|
26059
26088
|
}
|
|
26060
26089
|
}
|
|
26061
26090
|
};
|
|
@@ -38176,7 +38205,7 @@ function createWritableAcpStream(output2) {
|
|
|
38176
38205
|
if (outputFailure !== void 0) {
|
|
38177
38206
|
return Promise.reject(outputFailure);
|
|
38178
38207
|
}
|
|
38179
|
-
return new Promise((
|
|
38208
|
+
return new Promise((resolve9, reject) => {
|
|
38180
38209
|
pendingWriteFailures.add(reject);
|
|
38181
38210
|
output2.write(chunk, (error62) => {
|
|
38182
38211
|
pendingWriteFailures.delete(reject);
|
|
@@ -38189,7 +38218,7 @@ function createWritableAcpStream(output2) {
|
|
|
38189
38218
|
reject(outputFailure);
|
|
38190
38219
|
return;
|
|
38191
38220
|
}
|
|
38192
|
-
|
|
38221
|
+
resolve9();
|
|
38193
38222
|
});
|
|
38194
38223
|
});
|
|
38195
38224
|
}
|
|
@@ -38233,6 +38262,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
38233
38262
|
#configOptions = [];
|
|
38234
38263
|
#nativeSessionId = "";
|
|
38235
38264
|
#prompted = false;
|
|
38265
|
+
#nativePrompt = null;
|
|
38236
38266
|
#replay = {
|
|
38237
38267
|
kind: "idle"
|
|
38238
38268
|
};
|
|
@@ -38284,12 +38314,12 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
38284
38314
|
stderr.on("data", (chunk) => {
|
|
38285
38315
|
process.stderr.write(`[${agent.id}-acp] ${chunk}`);
|
|
38286
38316
|
});
|
|
38287
|
-
this.#termination = new Promise((
|
|
38317
|
+
this.#termination = new Promise((resolve9) => {
|
|
38288
38318
|
child.once("error", (cause) => {
|
|
38289
|
-
|
|
38319
|
+
resolve9({ kind: "failed", error: new AcpExecutionError("The ACP process could not run", { cause }) });
|
|
38290
38320
|
});
|
|
38291
38321
|
child.once("exit", (code, signal) => {
|
|
38292
|
-
|
|
38322
|
+
resolve9({
|
|
38293
38323
|
kind: "failed",
|
|
38294
38324
|
error: new AcpExecutionError("The ACP process stopped", { cause: { code, signal } })
|
|
38295
38325
|
});
|
|
@@ -38890,6 +38920,11 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
38890
38920
|
}
|
|
38891
38921
|
return prompt;
|
|
38892
38922
|
};
|
|
38923
|
+
nativeHistoryTurn = () => {
|
|
38924
|
+
const prompt = this.#nativePrompt;
|
|
38925
|
+
const nativeTurnId = this.#inProcessAgent?.nativeTurnId?.() ?? null;
|
|
38926
|
+
return prompt === null || nativeTurnId === null || nativeTurnId === prompt.previousTurnId ? null : { commandId: prompt.commandId, nativeTurnId };
|
|
38927
|
+
};
|
|
38893
38928
|
prompt = async (options) => {
|
|
38894
38929
|
if (this.#turn.running) {
|
|
38895
38930
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
@@ -38918,6 +38953,10 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
38918
38953
|
this.prepareAgentContent
|
|
38919
38954
|
);
|
|
38920
38955
|
this.#turn = running;
|
|
38956
|
+
this.#nativePrompt = {
|
|
38957
|
+
commandId: options.commandId,
|
|
38958
|
+
previousTurnId: this.#inProcessAgent?.nativeTurnId?.() ?? null
|
|
38959
|
+
};
|
|
38921
38960
|
try {
|
|
38922
38961
|
const response = await this.race(
|
|
38923
38962
|
this.#connection.agent.request(
|
|
@@ -40359,7 +40398,11 @@ var AcpSessionManager = class {
|
|
|
40359
40398
|
const runtime = await this.ensureSession(options);
|
|
40360
40399
|
const stored = this.#store.read(options.sessionId);
|
|
40361
40400
|
if (stored instanceof FoundAcpStoredSession && this.#nativeHistoryReader !== null) {
|
|
40362
|
-
const history = await this.#nativeHistoryReader.read(
|
|
40401
|
+
const history = await this.#nativeHistoryReader.read(
|
|
40402
|
+
options,
|
|
40403
|
+
stored.session.nativeSessionId,
|
|
40404
|
+
runtime.nativeHistoryTurn
|
|
40405
|
+
);
|
|
40363
40406
|
if (history !== null) {
|
|
40364
40407
|
return history;
|
|
40365
40408
|
}
|
|
@@ -41001,8 +41044,19 @@ function paginateLiveSessionHistory(history, activeTurn, sessionId, cursor, limi
|
|
|
41001
41044
|
truncated: activeTurn.truncated || activeText.length !== activeTurn.text.length
|
|
41002
41045
|
};
|
|
41003
41046
|
}
|
|
41047
|
+
const activeUserIndex = history.coveredCommandIds.includes(activeTurn.commandId) ? history.messages.findLastIndex((message) => message.role === "user") : -1;
|
|
41048
|
+
if (activeUserIndex >= 0) {
|
|
41049
|
+
history = {
|
|
41050
|
+
...history,
|
|
41051
|
+
coveredCommandIds: history.coveredCommandIds.filter((id) => id !== activeTurn.commandId),
|
|
41052
|
+
coveredMessageIds: history.coveredMessageIds.filter(
|
|
41053
|
+
(id) => id !== `${activeTurn.commandId}:user` && id !== `${activeTurn.commandId}:agent`
|
|
41054
|
+
),
|
|
41055
|
+
messages: history.messages.slice(0, activeUserIndex + 1)
|
|
41056
|
+
};
|
|
41057
|
+
}
|
|
41004
41058
|
const latestNativeMessage = history.messages.at(-1);
|
|
41005
|
-
const activeMessages = latestNativeMessage?.role === "user" && latestNativeMessage.text === activeTurn.prompt ? completeActiveMessages.slice(1) : completeActiveMessages;
|
|
41059
|
+
const activeMessages = activeUserIndex >= 0 || latestNativeMessage?.role === "user" && latestNativeMessage.text === activeTurn.prompt ? completeActiveMessages.slice(1) : completeActiveMessages;
|
|
41006
41060
|
let historicalMessageCount = 0;
|
|
41007
41061
|
let remainingCharacters = SESSION_HISTORY_CHARACTER_LIMIT - activeText.length - activeMessageOverhead - activeStructuredCharacters - (activeMessages.length === completeActiveMessages.length ? activeTurn.prompt.length : 0);
|
|
41008
41062
|
const historicalMessageLimit = Math.max(0, limit - activeMessages.length);
|
|
@@ -43095,7 +43149,7 @@ var FixedInstallationExecutor = class {
|
|
|
43095
43149
|
// src/artifacts/local-file-streamer.ts
|
|
43096
43150
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
43097
43151
|
import { realpath as realpath8, stat as stat7 } from "node:fs/promises";
|
|
43098
|
-
import { basename as basename5, isAbsolute as isAbsolute9, normalize as normalize3 } from "node:path";
|
|
43152
|
+
import { basename as basename5, isAbsolute as isAbsolute9, normalize as normalize3, resolve as resolve7 } from "node:path";
|
|
43099
43153
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
43100
43154
|
var CHUNK_BYTES = 192 * 1024;
|
|
43101
43155
|
function requestedPath(value) {
|
|
@@ -43112,9 +43166,13 @@ function requestedPath(value) {
|
|
|
43112
43166
|
}
|
|
43113
43167
|
return value;
|
|
43114
43168
|
}
|
|
43115
|
-
async function resolveFile(value, signal) {
|
|
43116
|
-
const
|
|
43117
|
-
if (
|
|
43169
|
+
async function resolveFile(value, workingDirectory, signal) {
|
|
43170
|
+
const path3 = requestedPath(value);
|
|
43171
|
+
if (path3 === null || !isAbsolute9(path3) && workingDirectory === null) {
|
|
43172
|
+
return null;
|
|
43173
|
+
}
|
|
43174
|
+
const requested = workingDirectory === null ? path3 : resolve7(workingDirectory, path3);
|
|
43175
|
+
if (!isAbsolute9(requested) || isAbsolute9(path3) && normalize3(path3) !== path3) {
|
|
43118
43176
|
return null;
|
|
43119
43177
|
}
|
|
43120
43178
|
try {
|
|
@@ -43126,8 +43184,8 @@ async function resolveFile(value, signal) {
|
|
|
43126
43184
|
return null;
|
|
43127
43185
|
}
|
|
43128
43186
|
}
|
|
43129
|
-
async function streamLocalFile(command, send2, signal) {
|
|
43130
|
-
const target = await resolveFile(command.path, signal);
|
|
43187
|
+
async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
43188
|
+
const target = await resolveFile(command.path, workingDirectory, signal);
|
|
43131
43189
|
if (target === null) {
|
|
43132
43190
|
throw new Error("The local file is unavailable");
|
|
43133
43191
|
}
|
|
@@ -43661,6 +43719,7 @@ var threadSchema = external_exports.object({
|
|
|
43661
43719
|
var turnsSchema = external_exports.object({
|
|
43662
43720
|
data: external_exports.array(
|
|
43663
43721
|
external_exports.object({
|
|
43722
|
+
id: external_exports.string().min(1),
|
|
43664
43723
|
error: external_exports.unknown().nullish(),
|
|
43665
43724
|
items: external_exports.array(external_exports.unknown()).max(1e5)
|
|
43666
43725
|
})
|
|
@@ -43723,6 +43782,8 @@ function messageSize(message) {
|
|
|
43723
43782
|
}
|
|
43724
43783
|
function decodeHistory(thread, value, options) {
|
|
43725
43784
|
const page = turnsSchema.parse(value);
|
|
43785
|
+
const nativeTurn = options.nativeTurn?.();
|
|
43786
|
+
const coveredCommandIds = nativeTurn != null && page.data[0]?.id === nativeTurn.nativeTurnId ? [nativeTurn.commandId] : [];
|
|
43726
43787
|
const messages = [];
|
|
43727
43788
|
let characters = 0;
|
|
43728
43789
|
let truncated = page.nextCursor != null;
|
|
@@ -43866,7 +43927,7 @@ function decodeHistory(thread, value, options) {
|
|
|
43866
43927
|
status: "available",
|
|
43867
43928
|
messages,
|
|
43868
43929
|
truncated,
|
|
43869
|
-
coveredCommandIds
|
|
43930
|
+
coveredCommandIds,
|
|
43870
43931
|
coveredMessageIds: []
|
|
43871
43932
|
}
|
|
43872
43933
|
};
|
|
@@ -44066,7 +44127,10 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
|
|
|
44066
44127
|
}
|
|
44067
44128
|
}
|
|
44068
44129
|
var readCodexHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, { detail: "messages" });
|
|
44069
|
-
var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, {
|
|
44130
|
+
var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal, nativeTurn) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, {
|
|
44131
|
+
detail: "rich",
|
|
44132
|
+
...nativeTurn === void 0 ? {} : { nativeTurn }
|
|
44133
|
+
});
|
|
44070
44134
|
|
|
44071
44135
|
// src/native-sessions/handle-native-requests.ts
|
|
44072
44136
|
import { WebSocket as WebSocket5 } from "undici";
|
|
@@ -44106,13 +44170,13 @@ function createNativeSessionRequestHandler(dependencies) {
|
|
|
44106
44170
|
operationSignal.throwIfAborted();
|
|
44107
44171
|
const skipPrevious = command.action === "active-turn";
|
|
44108
44172
|
if (previous.length > 0 && !skipPrevious) {
|
|
44109
|
-
await new Promise((
|
|
44173
|
+
await new Promise((resolve9, reject) => {
|
|
44110
44174
|
const onAbort = () => reject(operationSignal.reason);
|
|
44111
44175
|
operationSignal.addEventListener("abort", onAbort, { once: true });
|
|
44112
44176
|
void Promise.all(previous.map((request) => request.completion)).then(
|
|
44113
44177
|
() => {
|
|
44114
44178
|
operationSignal.removeEventListener("abort", onAbort);
|
|
44115
|
-
|
|
44179
|
+
resolve9();
|
|
44116
44180
|
},
|
|
44117
44181
|
(error62) => {
|
|
44118
44182
|
operationSignal.removeEventListener("abort", onAbort);
|
|
@@ -44691,7 +44755,7 @@ var RelayConnectionError = class extends Error {
|
|
|
44691
44755
|
};
|
|
44692
44756
|
function connectRelay(url2, signal) {
|
|
44693
44757
|
signal.throwIfAborted();
|
|
44694
|
-
return new Promise((
|
|
44758
|
+
return new Promise((resolve9, reject) => {
|
|
44695
44759
|
const endpoint = new URL(url2);
|
|
44696
44760
|
const headers = runtimeAuthorization(endpoint);
|
|
44697
44761
|
endpoint.searchParams.delete("token");
|
|
@@ -44758,7 +44822,7 @@ function connectRelay(url2, signal) {
|
|
|
44758
44822
|
}
|
|
44759
44823
|
finished = true;
|
|
44760
44824
|
cleanup();
|
|
44761
|
-
|
|
44825
|
+
resolve9(socket);
|
|
44762
44826
|
};
|
|
44763
44827
|
function onTimeout() {
|
|
44764
44828
|
fail(
|
|
@@ -45183,12 +45247,12 @@ function waitForRelayRetry(signal, timer) {
|
|
|
45183
45247
|
if (signal.aborted) {
|
|
45184
45248
|
return Promise.resolve();
|
|
45185
45249
|
}
|
|
45186
|
-
return new Promise((
|
|
45250
|
+
return new Promise((resolve9) => {
|
|
45187
45251
|
const retry = timer.schedule(finish, RELAY_RECONNECT_DELAY_MILLISECONDS);
|
|
45188
45252
|
function finish() {
|
|
45189
45253
|
retry.cancel();
|
|
45190
45254
|
signal.removeEventListener("abort", finish);
|
|
45191
|
-
|
|
45255
|
+
resolve9();
|
|
45192
45256
|
}
|
|
45193
45257
|
signal.addEventListener("abort", finish, { once: true });
|
|
45194
45258
|
});
|
|
@@ -45279,7 +45343,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
45279
45343
|
installationObserver.connect(socket);
|
|
45280
45344
|
onConnected();
|
|
45281
45345
|
try {
|
|
45282
|
-
await new Promise((
|
|
45346
|
+
await new Promise((resolve9, reject) => {
|
|
45283
45347
|
let finished = false;
|
|
45284
45348
|
const cleanup = () => {
|
|
45285
45349
|
connectionLiveness.close();
|
|
@@ -45297,7 +45361,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
45297
45361
|
}
|
|
45298
45362
|
finished = true;
|
|
45299
45363
|
cleanup();
|
|
45300
|
-
|
|
45364
|
+
resolve9();
|
|
45301
45365
|
};
|
|
45302
45366
|
const rejectConnection = (failure2) => {
|
|
45303
45367
|
if (finished) {
|
|
@@ -45320,7 +45384,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
45320
45384
|
};
|
|
45321
45385
|
const waitForTurnCompletion = (turn, waitSignal) => {
|
|
45322
45386
|
waitSignal.throwIfAborted();
|
|
45323
|
-
return new Promise((
|
|
45387
|
+
return new Promise((resolve10, reject2) => {
|
|
45324
45388
|
let settled = false;
|
|
45325
45389
|
const finish = (result) => {
|
|
45326
45390
|
if (settled) {
|
|
@@ -45329,7 +45393,7 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
45329
45393
|
settled = true;
|
|
45330
45394
|
waitSignal.removeEventListener("abort", onAbort);
|
|
45331
45395
|
if (result.kind === "completed") {
|
|
45332
|
-
|
|
45396
|
+
resolve10();
|
|
45333
45397
|
} else {
|
|
45334
45398
|
reject2(result.error);
|
|
45335
45399
|
}
|
|
@@ -45485,7 +45549,8 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
45485
45549
|
void streamLocalFile(
|
|
45486
45550
|
command2,
|
|
45487
45551
|
(message2) => send(socket, message2),
|
|
45488
|
-
connectionController.signal
|
|
45552
|
+
connectionController.signal,
|
|
45553
|
+
sessions.findSessions([command2.sessionId])[0]?.cwd ?? null
|
|
45489
45554
|
).catch((error62) => {
|
|
45490
45555
|
if (socket.readyState !== WebSocket8.OPEN || connectionController.signal.aborted) {
|
|
45491
45556
|
return;
|
|
@@ -45717,7 +45782,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
45717
45782
|
new DaemonAcpObserver(recordSessionEvent),
|
|
45718
45783
|
sessionStore,
|
|
45719
45784
|
{
|
|
45720
|
-
read: async (options2, nativeSessionId) => options2.agent.id === "codex" ? (await readCodexFullHistory(
|
|
45785
|
+
read: async (options2, nativeSessionId, nativeTurn) => options2.agent.id === "codex" ? (await readCodexFullHistory(
|
|
45786
|
+
options2.agent,
|
|
45787
|
+
options2.cwd,
|
|
45788
|
+
nativeSessionId,
|
|
45789
|
+
options2.signal,
|
|
45790
|
+
nativeTurn
|
|
45791
|
+
)).history : null
|
|
45721
45792
|
},
|
|
45722
45793
|
"native"
|
|
45723
45794
|
);
|
|
@@ -46217,9 +46288,9 @@ async function waitForReady(active, signal) {
|
|
|
46217
46288
|
return;
|
|
46218
46289
|
}
|
|
46219
46290
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(START_TIMEOUT_MILLISECONDS)]);
|
|
46220
|
-
await new Promise((
|
|
46291
|
+
await new Promise((resolve9, reject) => {
|
|
46221
46292
|
const abort = () => reject(deadline.reason);
|
|
46222
|
-
active.ready.then(
|
|
46293
|
+
active.ready.then(resolve9, reject).finally(() => deadline.removeEventListener("abort", abort));
|
|
46223
46294
|
deadline.addEventListener("abort", abort, { once: true });
|
|
46224
46295
|
});
|
|
46225
46296
|
if (active.status === "failed") {
|
|
@@ -46230,7 +46301,7 @@ function errorMessage2(error62) {
|
|
|
46230
46301
|
return error62 instanceof Error ? error62.message : "Unknown failure";
|
|
46231
46302
|
}
|
|
46232
46303
|
async function readSocketMessage(socket, signal) {
|
|
46233
|
-
return await new Promise((
|
|
46304
|
+
return await new Promise((resolve9, reject) => {
|
|
46234
46305
|
let encoded = "";
|
|
46235
46306
|
const finish = (error62, value) => {
|
|
46236
46307
|
signal.removeEventListener("abort", abort);
|
|
@@ -46238,7 +46309,7 @@ async function readSocketMessage(socket, signal) {
|
|
|
46238
46309
|
socket.removeAllListeners("error");
|
|
46239
46310
|
socket.removeAllListeners("end");
|
|
46240
46311
|
if (error62 === void 0) {
|
|
46241
|
-
|
|
46312
|
+
resolve9(value);
|
|
46242
46313
|
} else {
|
|
46243
46314
|
reject(error62);
|
|
46244
46315
|
}
|
|
@@ -46273,14 +46344,14 @@ async function sendControlRequest(stateDirectory, command, signal) {
|
|
|
46273
46344
|
const deadline = AbortSignal.any([signal, AbortSignal.timeout(CONTROL_TIMEOUT_MILLISECONDS)]);
|
|
46274
46345
|
const socket = createConnection(controlSocketPath(stateDirectory));
|
|
46275
46346
|
try {
|
|
46276
|
-
await new Promise((
|
|
46347
|
+
await new Promise((resolve9, reject) => {
|
|
46277
46348
|
const abort = () => {
|
|
46278
46349
|
socket.destroy();
|
|
46279
46350
|
reject(deadline.reason);
|
|
46280
46351
|
};
|
|
46281
46352
|
socket.once("connect", () => {
|
|
46282
46353
|
deadline.removeEventListener("abort", abort);
|
|
46283
|
-
|
|
46354
|
+
resolve9();
|
|
46284
46355
|
});
|
|
46285
46356
|
socket.once("error", reject);
|
|
46286
46357
|
deadline.addEventListener("abort", abort, { once: true });
|
|
@@ -46317,13 +46388,13 @@ async function waitForManagerExit(stateDirectory, signal) {
|
|
|
46317
46388
|
}
|
|
46318
46389
|
throw cause;
|
|
46319
46390
|
}
|
|
46320
|
-
await new Promise((
|
|
46391
|
+
await new Promise((resolve9, reject) => {
|
|
46321
46392
|
const timeout = setTimeout(finish, 20);
|
|
46322
46393
|
const abort = () => finish(deadline.reason);
|
|
46323
46394
|
function finish(cause) {
|
|
46324
46395
|
clearTimeout(timeout);
|
|
46325
46396
|
deadline.removeEventListener("abort", abort);
|
|
46326
|
-
cause === void 0 ?
|
|
46397
|
+
cause === void 0 ? resolve9() : reject(cause);
|
|
46327
46398
|
}
|
|
46328
46399
|
deadline.addEventListener("abort", abort, { once: true });
|
|
46329
46400
|
});
|
|
@@ -46373,13 +46444,13 @@ async function ensureMatchingManager(stateDirectory, managerVersion, signal) {
|
|
|
46373
46444
|
await launchManager(managerVersion);
|
|
46374
46445
|
managerStarted = true;
|
|
46375
46446
|
}
|
|
46376
|
-
await new Promise((
|
|
46447
|
+
await new Promise((resolve9, reject) => {
|
|
46377
46448
|
const timeout = setTimeout(finish, 50);
|
|
46378
46449
|
const abort = () => finish(signal.reason);
|
|
46379
46450
|
function finish(cause2) {
|
|
46380
46451
|
clearTimeout(timeout);
|
|
46381
46452
|
signal.removeEventListener("abort", abort);
|
|
46382
|
-
cause2 === void 0 ?
|
|
46453
|
+
cause2 === void 0 ? resolve9() : reject(cause2);
|
|
46383
46454
|
}
|
|
46384
46455
|
signal.addEventListener("abort", abort, { once: true });
|
|
46385
46456
|
});
|
|
@@ -46474,16 +46545,16 @@ async function runManager(installation, managerVersion, signal) {
|
|
|
46474
46545
|
});
|
|
46475
46546
|
}
|
|
46476
46547
|
server.listen(socketPath);
|
|
46477
|
-
await new Promise((
|
|
46478
|
-
server.once("listening",
|
|
46548
|
+
await new Promise((resolve9, reject) => {
|
|
46549
|
+
server.once("listening", resolve9);
|
|
46479
46550
|
server.once("error", reject);
|
|
46480
46551
|
});
|
|
46481
46552
|
if (process.platform !== "win32") {
|
|
46482
46553
|
await import("node:fs/promises").then(async ({ chmod: chmod2 }) => await chmod2(socketPath, 384));
|
|
46483
46554
|
}
|
|
46484
46555
|
try {
|
|
46485
|
-
await new Promise((
|
|
46486
|
-
const serverClosed = new Promise((
|
|
46556
|
+
await new Promise((resolve9) => combined.addEventListener("abort", () => resolve9(), { once: true }));
|
|
46557
|
+
const serverClosed = new Promise((resolve9) => server.close(() => resolve9()));
|
|
46487
46558
|
for (const socket of sockets) {
|
|
46488
46559
|
socket.destroy();
|
|
46489
46560
|
}
|
|
@@ -46635,7 +46706,7 @@ function createProgram() {
|
|
|
46635
46706
|
});
|
|
46636
46707
|
pair.command("list").description("list saved pairings").addOption(valueOption("--output-json <existing-file.json>", "write JSON to an existing file")).action(async (options) => {
|
|
46637
46708
|
const installation = await openMobiusCliInstallation(shutdown.signal, process.env);
|
|
46638
|
-
const outputPath = options.outputJson === void 0 ? null :
|
|
46709
|
+
const outputPath = options.outputJson === void 0 ? null : resolve8(options.outputJson);
|
|
46639
46710
|
const response = await requestManager(
|
|
46640
46711
|
installation,
|
|
46641
46712
|
package_default.version,
|