@moxt-ai/mobius 0.0.117 → 0.0.118
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/cli.js +73 -7
- package/dist/cli.js.map +2 -2
- package/dist/index.js +72 -6
- package/dist/index.js.map +2 -2
- 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 +2 -2
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +72 -6
- package/dist/runtime.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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
|
};
|
|
@@ -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);
|
|
@@ -40220,6 +40274,7 @@ var threadSchema = external_exports.object({
|
|
|
40220
40274
|
var turnsSchema = external_exports.object({
|
|
40221
40275
|
data: external_exports.array(
|
|
40222
40276
|
external_exports.object({
|
|
40277
|
+
id: external_exports.string().min(1),
|
|
40223
40278
|
error: external_exports.unknown().nullish(),
|
|
40224
40279
|
items: external_exports.array(external_exports.unknown()).max(1e5)
|
|
40225
40280
|
})
|
|
@@ -40282,6 +40337,8 @@ function messageSize(message) {
|
|
|
40282
40337
|
}
|
|
40283
40338
|
function decodeHistory(thread, value, options) {
|
|
40284
40339
|
const page = turnsSchema.parse(value);
|
|
40340
|
+
const nativeTurn = options.nativeTurn?.();
|
|
40341
|
+
const coveredCommandIds = nativeTurn != null && page.data[0]?.id === nativeTurn.nativeTurnId ? [nativeTurn.commandId] : [];
|
|
40285
40342
|
const messages = [];
|
|
40286
40343
|
let characters = 0;
|
|
40287
40344
|
let truncated = page.nextCursor != null;
|
|
@@ -40425,7 +40482,7 @@ function decodeHistory(thread, value, options) {
|
|
|
40425
40482
|
status: "available",
|
|
40426
40483
|
messages,
|
|
40427
40484
|
truncated,
|
|
40428
|
-
coveredCommandIds
|
|
40485
|
+
coveredCommandIds,
|
|
40429
40486
|
coveredMessageIds: []
|
|
40430
40487
|
}
|
|
40431
40488
|
};
|
|
@@ -40625,7 +40682,10 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
|
|
|
40625
40682
|
}
|
|
40626
40683
|
}
|
|
40627
40684
|
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, {
|
|
40685
|
+
var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal, nativeTurn) => await readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal, {
|
|
40686
|
+
detail: "rich",
|
|
40687
|
+
...nativeTurn === void 0 ? {} : { nativeTurn }
|
|
40688
|
+
});
|
|
40629
40689
|
|
|
40630
40690
|
// src/native-sessions/handle-native-requests.ts
|
|
40631
40691
|
import { WebSocket as WebSocket5 } from "undici";
|
|
@@ -42256,7 +42316,13 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42256
42316
|
new DaemonAcpObserver(recordSessionEvent),
|
|
42257
42317
|
sessionStore,
|
|
42258
42318
|
{
|
|
42259
|
-
read: async (options2, nativeSessionId) => options2.agent.id === "codex" ? (await readCodexFullHistory(
|
|
42319
|
+
read: async (options2, nativeSessionId, nativeTurn) => options2.agent.id === "codex" ? (await readCodexFullHistory(
|
|
42320
|
+
options2.agent,
|
|
42321
|
+
options2.cwd,
|
|
42322
|
+
nativeSessionId,
|
|
42323
|
+
options2.signal,
|
|
42324
|
+
nativeTurn
|
|
42325
|
+
)).history : null
|
|
42260
42326
|
},
|
|
42261
42327
|
"native"
|
|
42262
42328
|
);
|