@moxt-ai/mobius 0.0.186 → 0.0.188
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/agent-runtime-manager.d.ts +2 -2
- package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
- package/dist/acp/agent-runtime-manager.js +17 -8
- package/dist/acp/agent-runtime-manager.js.map +1 -1
- package/dist/acp/codex/agent.d.ts.map +1 -1
- package/dist/acp/codex/agent.js +3 -2
- package/dist/acp/codex/agent.js.map +1 -1
- package/dist/acp/session-contracts.d.ts +10 -3
- package/dist/acp/session-contracts.d.ts.map +1 -1
- package/dist/acp/session-contracts.js +3 -0
- package/dist/acp/session-contracts.js.map +1 -1
- package/dist/acp/session-event-store-v2.d.ts +1 -0
- package/dist/acp/session-event-store-v2.d.ts.map +1 -1
- package/dist/acp/session-event-store-v2.js +3 -0
- package/dist/acp/session-event-store-v2.js.map +1 -1
- package/dist/cli.js +319 -45
- package/dist/cli.js.map +4 -4
- package/dist/daemon-command-handler.d.ts.map +1 -1
- package/dist/daemon-command-handler.js +6 -2
- package/dist/daemon-command-handler.js.map +1 -1
- package/dist/daemon-history-commands.d.ts +2 -1
- package/dist/daemon-history-commands.d.ts.map +1 -1
- package/dist/daemon-history-commands.js +54 -1
- package/dist/daemon-history-commands.js.map +1 -1
- package/dist/index.js +320 -46
- package/dist/index.js.map +4 -4
- package/dist/native-sessions/codex-history.d.ts.map +1 -1
- package/dist/native-sessions/codex-history.js +9 -1
- package/dist/native-sessions/codex-history.js.map +1 -1
- package/dist/native-sessions/native-history-events-v2.d.ts +8 -0
- package/dist/native-sessions/native-history-events-v2.d.ts.map +1 -0
- package/dist/native-sessions/native-history-events-v2.js +147 -0
- package/dist/native-sessions/native-history-events-v2.js.map +1 -0
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +6 -3
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +318 -44
- package/dist/runtime.js.map +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -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.188",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -25944,7 +25944,9 @@ var CodexAcpAgent = class {
|
|
|
25944
25944
|
"thread/fork",
|
|
25945
25945
|
{
|
|
25946
25946
|
cwd: context.params.cwd,
|
|
25947
|
-
|
|
25947
|
+
// Fork keeps the native context; its response only needs the new identity
|
|
25948
|
+
// and settings. History is read through the separate history boundary.
|
|
25949
|
+
excludeTurns: true,
|
|
25948
25950
|
threadId: context.params.sessionId
|
|
25949
25951
|
},
|
|
25950
25952
|
AbortSignal.any([context.signal, AbortSignal.timeout(APPROVAL_TIMEOUT_MILLISECONDS2)])
|
|
@@ -25953,7 +25955,6 @@ var CodexAcpAgent = class {
|
|
|
25953
25955
|
this.#nativeSessionId = forked.thread.id;
|
|
25954
25956
|
this.#settings.selectRestoredThread(forked);
|
|
25955
25957
|
await this.#settings.probeCollaborationMode(this.#nativeSessionId, context.signal);
|
|
25956
|
-
await this.#replayHistory(forked.thread.turns);
|
|
25957
25958
|
await this.#emitAvailableCommands();
|
|
25958
25959
|
return { configOptions: this.#settings.configOptions(), sessionId: forked.thread.id };
|
|
25959
25960
|
}).onRequest(methods.agent.session.resume, async (context) => {
|
|
@@ -30085,24 +30086,28 @@ var decodeAcpSessionUpdateV2 = (value) => decode5(value, acpSessionUpdateV2Schem
|
|
|
30085
30086
|
// ../protocol/src/session-live-history.ts
|
|
30086
30087
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
30087
30088
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
|
|
30089
|
+
var SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
|
|
30090
|
+
var SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND = "session.preview-history.page.loaded";
|
|
30088
30091
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
30089
|
-
var
|
|
30092
|
+
var pageLoadFields = {
|
|
30090
30093
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
30091
30094
|
agentId: identifierStringSchema,
|
|
30092
30095
|
bindingId: identifierStringSchema,
|
|
30093
30096
|
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
30094
30097
|
directoryId: directoryIdentifier,
|
|
30095
|
-
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND),
|
|
30096
30098
|
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
30097
30099
|
requestId: identifierStringSchema,
|
|
30098
30100
|
sessionId: identifierStringSchema
|
|
30099
|
-
}
|
|
30100
|
-
var
|
|
30101
|
+
};
|
|
30102
|
+
var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
|
|
30103
|
+
var sessionPreviewHistoryPageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND) }).readonly();
|
|
30104
|
+
var pageLoadedFields = {
|
|
30101
30105
|
events: nativeSessionEventsV2Schema,
|
|
30102
|
-
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND),
|
|
30103
30106
|
requestId: identifierStringSchema,
|
|
30104
30107
|
sessionId: identifierStringSchema
|
|
30105
|
-
}
|
|
30108
|
+
};
|
|
30109
|
+
var sessionLiveHistoryV2PageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND) }).readonly();
|
|
30110
|
+
var sessionPreviewHistoryPageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND) }).readonly();
|
|
30106
30111
|
function decode6(schema, encoded) {
|
|
30107
30112
|
try {
|
|
30108
30113
|
const value = JSON.parse(encoded);
|
|
@@ -30113,8 +30118,12 @@ function decode6(schema, encoded) {
|
|
|
30113
30118
|
}
|
|
30114
30119
|
var decodeSessionLiveHistoryV2PageLoad = (encoded) => decode6(sessionLiveHistoryV2PageLoadSchema, encoded);
|
|
30115
30120
|
var decodeSessionLiveHistoryV2PageLoaded = (encoded) => decode6(sessionLiveHistoryV2PageLoadedSchema, encoded);
|
|
30121
|
+
var decodeSessionPreviewHistoryPageLoad = (encoded) => decode6(sessionPreviewHistoryPageLoadSchema, encoded);
|
|
30122
|
+
var decodeSessionPreviewHistoryPageLoaded = (encoded) => decode6(sessionPreviewHistoryPageLoadedSchema, encoded);
|
|
30116
30123
|
var encodeSessionLiveHistoryV2PageLoad = (value) => JSON.stringify(sessionLiveHistoryV2PageLoadSchema.parse(value));
|
|
30117
30124
|
var encodeSessionLiveHistoryV2PageLoaded = (value) => JSON.stringify(sessionLiveHistoryV2PageLoadedSchema.parse(value));
|
|
30125
|
+
var encodeSessionPreviewHistoryPageLoad = (value) => JSON.stringify(sessionPreviewHistoryPageLoadSchema.parse(value));
|
|
30126
|
+
var encodeSessionPreviewHistoryPageLoaded = (value) => JSON.stringify(sessionPreviewHistoryPageLoadedSchema.parse(value));
|
|
30118
30127
|
|
|
30119
30128
|
// ../protocol/src/daemon-transport.ts
|
|
30120
30129
|
function defineMessageSignature(kind, encoder, decoder) {
|
|
@@ -30127,6 +30136,11 @@ function defineMessageSignature(kind, encoder, decoder) {
|
|
|
30127
30136
|
};
|
|
30128
30137
|
}
|
|
30129
30138
|
var serviceToDaemonSignatures = {
|
|
30139
|
+
[SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND]: defineMessageSignature(
|
|
30140
|
+
SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND,
|
|
30141
|
+
encodeSessionPreviewHistoryPageLoad,
|
|
30142
|
+
decodeSessionPreviewHistoryPageLoad
|
|
30143
|
+
),
|
|
30130
30144
|
[AGENT_INSTALL_CANCEL_KIND]: defineMessageSignature(
|
|
30131
30145
|
AGENT_INSTALL_CANCEL_KIND,
|
|
30132
30146
|
encodeAgentInstallCancelCommand,
|
|
@@ -30231,6 +30245,11 @@ function decodeServiceToDaemonMessage(encoded) {
|
|
|
30231
30245
|
return signature.decoder(encoded);
|
|
30232
30246
|
}
|
|
30233
30247
|
var daemonToServiceSignatures = {
|
|
30248
|
+
[SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND]: defineMessageSignature(
|
|
30249
|
+
SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
|
|
30250
|
+
encodeSessionPreviewHistoryPageLoaded,
|
|
30251
|
+
decodeSessionPreviewHistoryPageLoaded
|
|
30252
|
+
),
|
|
30234
30253
|
[SESSION_CONFIG_UPDATED_KIND]: defineMessageSignature(
|
|
30235
30254
|
SESSION_CONFIG_UPDATED_KIND,
|
|
30236
30255
|
encodeSessionConfigUpdatedEvent,
|
|
@@ -30410,7 +30429,7 @@ function createDaemonConfig(connection, agents = [], installableAgents = [], loc
|
|
|
30410
30429
|
|
|
30411
30430
|
// src/daemon-manager.ts
|
|
30412
30431
|
import { spawn as spawn6 } from "node:child_process";
|
|
30413
|
-
import { createHash as
|
|
30432
|
+
import { createHash as createHash9, randomBytes } from "node:crypto";
|
|
30414
30433
|
import { readFile as readFile3, unlink as unlink2, writeFile as writeFile5 } from "node:fs/promises";
|
|
30415
30434
|
import { createConnection, createServer } from "node:net";
|
|
30416
30435
|
import { tmpdir } from "node:os";
|
|
@@ -31244,7 +31263,7 @@ var AuditStore = class {
|
|
|
31244
31263
|
};
|
|
31245
31264
|
|
|
31246
31265
|
// src/run-daemon.ts
|
|
31247
|
-
import { createHash as
|
|
31266
|
+
import { createHash as createHash8, randomUUID as randomUUID9 } from "node:crypto";
|
|
31248
31267
|
import { join as join19 } from "node:path";
|
|
31249
31268
|
import { styleText } from "node:util";
|
|
31250
31269
|
|
|
@@ -32139,7 +32158,7 @@ var AcpActivity = class _AcpActivity {
|
|
|
32139
32158
|
toolKind;
|
|
32140
32159
|
content;
|
|
32141
32160
|
detail;
|
|
32142
|
-
constructor(activityId, activityType, input2, locations, name2, output2, sequence, status, title2,
|
|
32161
|
+
constructor(activityId, activityType, input2, locations, name2, output2, sequence, status, title2, toolKind2, content = [], detail = captureActivityDetail(content, input2, output2)) {
|
|
32143
32162
|
this.activityId = activityId;
|
|
32144
32163
|
this.activityType = activityType;
|
|
32145
32164
|
this.input = input2;
|
|
@@ -32149,7 +32168,7 @@ var AcpActivity = class _AcpActivity {
|
|
|
32149
32168
|
this.sequence = sequence;
|
|
32150
32169
|
this.status = status;
|
|
32151
32170
|
this.title = title2;
|
|
32152
|
-
this.toolKind =
|
|
32171
|
+
this.toolKind = toolKind2;
|
|
32153
32172
|
this.content = content;
|
|
32154
32173
|
this.detail = detail;
|
|
32155
32174
|
}
|
|
@@ -32806,6 +32825,9 @@ function sessionConfigProtocolForAgent(_agentId) {
|
|
|
32806
32825
|
}
|
|
32807
32826
|
|
|
32808
32827
|
// src/acp/session-contracts.ts
|
|
32828
|
+
var acpNativeHistoryReader = {
|
|
32829
|
+
access: () => ({ kind: "acp" })
|
|
32830
|
+
};
|
|
32809
32831
|
var NullAcpSessionObserver = class {
|
|
32810
32832
|
onSessionEventV2 = (_sessionId, _event, _position) => Promise.resolve();
|
|
32811
32833
|
onCommands = () => Promise.resolve();
|
|
@@ -38456,6 +38478,15 @@ function eventPage(sessionGenerationId, eventCount, eventLimit, cursor, read) {
|
|
|
38456
38478
|
truncated: startPosition > 0
|
|
38457
38479
|
};
|
|
38458
38480
|
}
|
|
38481
|
+
function pageAcpSessionEventsV2(sessionGenerationId, events, eventLimit, cursor) {
|
|
38482
|
+
return eventPage(
|
|
38483
|
+
sessionGenerationId,
|
|
38484
|
+
events.length,
|
|
38485
|
+
eventLimit,
|
|
38486
|
+
cursor,
|
|
38487
|
+
(startPosition, endPosition) => events.slice(startPosition - 1, endPosition)
|
|
38488
|
+
);
|
|
38489
|
+
}
|
|
38459
38490
|
var MemoryAcpSessionEventStoreV2 = class {
|
|
38460
38491
|
#events = /* @__PURE__ */ new Map();
|
|
38461
38492
|
#session = (sessionId) => {
|
|
@@ -40578,6 +40609,147 @@ function isNativeChatSessionId(agentId, sessionId) {
|
|
|
40578
40609
|
return (agentId === "codex" || agentId === "claude" || agentId === "pi") && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu.test(sessionId);
|
|
40579
40610
|
}
|
|
40580
40611
|
|
|
40612
|
+
// src/native-sessions/native-history-events-v2.ts
|
|
40613
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
40614
|
+
function contentBlock(content) {
|
|
40615
|
+
switch (content.type) {
|
|
40616
|
+
case "text":
|
|
40617
|
+
return { text: content.text, type: "text" };
|
|
40618
|
+
case "image":
|
|
40619
|
+
return {
|
|
40620
|
+
data: content.data,
|
|
40621
|
+
mimeType: content.mimeType,
|
|
40622
|
+
type: "image",
|
|
40623
|
+
...content.uri.length === 0 ? {} : { uri: content.uri }
|
|
40624
|
+
};
|
|
40625
|
+
case "resource_link":
|
|
40626
|
+
return {
|
|
40627
|
+
name: content.name.length === 0 ? content.uri : content.name,
|
|
40628
|
+
type: "resource_link",
|
|
40629
|
+
uri: content.uri,
|
|
40630
|
+
...content.mimeType.length === 0 ? {} : { mimeType: content.mimeType }
|
|
40631
|
+
};
|
|
40632
|
+
case "resource":
|
|
40633
|
+
return {
|
|
40634
|
+
resource: content.text.length > 0 ? {
|
|
40635
|
+
text: content.text,
|
|
40636
|
+
uri: content.uri,
|
|
40637
|
+
...content.mimeType.length === 0 ? {} : { mimeType: content.mimeType }
|
|
40638
|
+
} : {
|
|
40639
|
+
blob: content.data,
|
|
40640
|
+
uri: content.uri,
|
|
40641
|
+
...content.mimeType.length === 0 ? {} : { mimeType: content.mimeType }
|
|
40642
|
+
},
|
|
40643
|
+
type: "resource"
|
|
40644
|
+
};
|
|
40645
|
+
case "diff":
|
|
40646
|
+
case "terminal":
|
|
40647
|
+
case "video":
|
|
40648
|
+
return null;
|
|
40649
|
+
default: {
|
|
40650
|
+
const unhandled = content.type;
|
|
40651
|
+
throw new Error(`Unknown native history content: ${String(unhandled)}`);
|
|
40652
|
+
}
|
|
40653
|
+
}
|
|
40654
|
+
}
|
|
40655
|
+
function toolContent2(content) {
|
|
40656
|
+
if (content.type === "diff") {
|
|
40657
|
+
return {
|
|
40658
|
+
newText: content.newText,
|
|
40659
|
+
path: content.path,
|
|
40660
|
+
type: "diff",
|
|
40661
|
+
...content.oldText.length === 0 ? {} : { oldText: content.oldText }
|
|
40662
|
+
};
|
|
40663
|
+
}
|
|
40664
|
+
if (content.type === "terminal") {
|
|
40665
|
+
return { terminalId: content.terminalId, type: "terminal" };
|
|
40666
|
+
}
|
|
40667
|
+
const block = contentBlock(content);
|
|
40668
|
+
return block === null ? null : { content: block, type: "content" };
|
|
40669
|
+
}
|
|
40670
|
+
function toolKind(value) {
|
|
40671
|
+
switch (value) {
|
|
40672
|
+
case "read":
|
|
40673
|
+
case "edit":
|
|
40674
|
+
case "delete":
|
|
40675
|
+
case "move":
|
|
40676
|
+
case "search":
|
|
40677
|
+
case "execute":
|
|
40678
|
+
case "think":
|
|
40679
|
+
case "fetch":
|
|
40680
|
+
case "switch_mode":
|
|
40681
|
+
case "other":
|
|
40682
|
+
return value;
|
|
40683
|
+
default:
|
|
40684
|
+
return "other";
|
|
40685
|
+
}
|
|
40686
|
+
}
|
|
40687
|
+
function toolStatus(value) {
|
|
40688
|
+
switch (value) {
|
|
40689
|
+
case "pending":
|
|
40690
|
+
return "pending";
|
|
40691
|
+
case "running":
|
|
40692
|
+
case "in_progress":
|
|
40693
|
+
return "in_progress";
|
|
40694
|
+
case "completed":
|
|
40695
|
+
return "completed";
|
|
40696
|
+
default:
|
|
40697
|
+
return "failed";
|
|
40698
|
+
}
|
|
40699
|
+
}
|
|
40700
|
+
function activityEvent(activity2) {
|
|
40701
|
+
const content = activity2.content.flatMap((item) => {
|
|
40702
|
+
const converted = toolContent2(item);
|
|
40703
|
+
return converted === null ? [] : [converted];
|
|
40704
|
+
});
|
|
40705
|
+
return {
|
|
40706
|
+
payload: {
|
|
40707
|
+
content,
|
|
40708
|
+
kind: toolKind(activity2.toolKind),
|
|
40709
|
+
locations: activity2.locations.map((path3) => ({ path: path3 })),
|
|
40710
|
+
rawInput: activity2.input,
|
|
40711
|
+
rawOutput: activity2.output,
|
|
40712
|
+
sessionUpdate: "tool_call",
|
|
40713
|
+
status: toolStatus(activity2.status),
|
|
40714
|
+
title: activity2.title,
|
|
40715
|
+
toolCallId: activity2.activityId,
|
|
40716
|
+
...activity2.name.length === 0 ? {} : { name: activity2.name }
|
|
40717
|
+
},
|
|
40718
|
+
type: "acp"
|
|
40719
|
+
};
|
|
40720
|
+
}
|
|
40721
|
+
function contentEvent(sessionUpdate, messageId, content) {
|
|
40722
|
+
return { payload: { content, messageId, sessionUpdate }, type: "acp" };
|
|
40723
|
+
}
|
|
40724
|
+
function historyEvents(history) {
|
|
40725
|
+
return history.messages.flatMap((message, index2) => {
|
|
40726
|
+
const messageId = `native-history-${index2.toString()}`;
|
|
40727
|
+
const sessionUpdate = message.role === "user" ? "user_message_chunk" : "agent_message_chunk";
|
|
40728
|
+
const images = (message.images ?? []).map(
|
|
40729
|
+
(image) => contentEvent(sessionUpdate, messageId, {
|
|
40730
|
+
data: image.data,
|
|
40731
|
+
mimeType: image.mimeType,
|
|
40732
|
+
type: "image"
|
|
40733
|
+
})
|
|
40734
|
+
);
|
|
40735
|
+
const text2 = message.text.length === 0 ? [] : [contentEvent(sessionUpdate, messageId, { text: message.text, type: "text" })];
|
|
40736
|
+
if (message.role === "user") {
|
|
40737
|
+
return [...images, ...text2];
|
|
40738
|
+
}
|
|
40739
|
+
const activities = message.activities.map(activityEvent);
|
|
40740
|
+
const content = message.content.flatMap((item) => {
|
|
40741
|
+
const converted = contentBlock(item);
|
|
40742
|
+
return converted === null ? [] : [contentEvent(sessionUpdate, messageId, converted)];
|
|
40743
|
+
});
|
|
40744
|
+
return [...activities, ...content, ...images, ...text2];
|
|
40745
|
+
});
|
|
40746
|
+
}
|
|
40747
|
+
function nativeHistoryEventsV2(nativeSessionId, history, eventLimit, cursor) {
|
|
40748
|
+
const events = historyEvents(history);
|
|
40749
|
+
const generationId = createHash4("sha256").update(nativeSessionId).update("\0").update(JSON.stringify(events)).digest("hex");
|
|
40750
|
+
return pageAcpSessionEventsV2(generationId, events, eventLimit, cursor);
|
|
40751
|
+
}
|
|
40752
|
+
|
|
40581
40753
|
// src/acp/process-capacity.ts
|
|
40582
40754
|
var AcpProcessCapacityLease = class {
|
|
40583
40755
|
#releaseCapacity;
|
|
@@ -40790,7 +40962,7 @@ var AgentRuntimeManager = class {
|
|
|
40790
40962
|
#onSessionStatusChanged;
|
|
40791
40963
|
#contentExternalizer;
|
|
40792
40964
|
#observer;
|
|
40793
|
-
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader =
|
|
40965
|
+
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = acpNativeHistoryReader, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0, contentExternalizer = new AcpContentExternalizer(new UnretainedExternalContentStore())) {
|
|
40794
40966
|
this.#observer = observer;
|
|
40795
40967
|
this.#store = store;
|
|
40796
40968
|
this.#nativeHistoryReader = nativeHistoryReader;
|
|
@@ -41320,6 +41492,14 @@ var AgentRuntimeManager = class {
|
|
|
41320
41492
|
}
|
|
41321
41493
|
this.#nativeOperations.add(key);
|
|
41322
41494
|
try {
|
|
41495
|
+
const historyAccess = this.#nativeHistoryReader.access(options2);
|
|
41496
|
+
if (historyAccess.kind === "direct") {
|
|
41497
|
+
const history = await historyAccess.read(nativeSessionId, () => null);
|
|
41498
|
+
if (history.status === "unavailable") {
|
|
41499
|
+
throw new AcpExecutionError(history.cause.message, {}, history.cause.code);
|
|
41500
|
+
}
|
|
41501
|
+
return nativeHistoryEventsV2(nativeSessionId, history, eventLimit, cursor);
|
|
41502
|
+
}
|
|
41323
41503
|
return await this.#queryProcesses.previewEventsV2(options2, nativeSessionId, eventLimit, cursor);
|
|
41324
41504
|
} finally {
|
|
41325
41505
|
this.#nativeOperations.delete(key);
|
|
@@ -41329,15 +41509,9 @@ var AgentRuntimeManager = class {
|
|
|
41329
41509
|
return await this.#executionProcesses.use(options2.sessionId, async () => {
|
|
41330
41510
|
const runtime = await this.ensureSession(options2);
|
|
41331
41511
|
const stored = this.#store.read(options2.sessionId);
|
|
41332
|
-
|
|
41333
|
-
|
|
41334
|
-
|
|
41335
|
-
stored.session.nativeSessionId,
|
|
41336
|
-
runtime.nativeHistoryTurn
|
|
41337
|
-
);
|
|
41338
|
-
if (history !== null) {
|
|
41339
|
-
return history;
|
|
41340
|
-
}
|
|
41512
|
+
const historyAccess = this.#nativeHistoryReader.access(options2);
|
|
41513
|
+
if (stored instanceof FoundAcpStoredSession && historyAccess.kind === "direct") {
|
|
41514
|
+
return await historyAccess.read(stored.session.nativeSessionId, runtime.nativeHistoryTurn);
|
|
41341
41515
|
}
|
|
41342
41516
|
return await runtime.loadHistory(options2.signal);
|
|
41343
41517
|
});
|
|
@@ -42230,7 +42404,7 @@ import { WebSocket as WebSocket2 } from "undici";
|
|
|
42230
42404
|
import { WebSocket } from "undici";
|
|
42231
42405
|
|
|
42232
42406
|
// src/prompt-artifact-resolver.ts
|
|
42233
|
-
import { createHash as
|
|
42407
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
42234
42408
|
import { fetch as fetch4 } from "undici";
|
|
42235
42409
|
var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
42236
42410
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
@@ -42368,7 +42542,7 @@ async function download(config2, command, reference, signal) {
|
|
|
42368
42542
|
);
|
|
42369
42543
|
}
|
|
42370
42544
|
const bytes = await responseBytes(response, reference.byteLength, requestSignal);
|
|
42371
|
-
if (
|
|
42545
|
+
if (createHash5("sha256").update(bytes).digest("hex") !== reference.sha256) {
|
|
42372
42546
|
throw new PromptArtifactError(
|
|
42373
42547
|
"artifact_integrity_failed",
|
|
42374
42548
|
"The prompt artifact failed integrity validation"
|
|
@@ -43389,6 +43563,14 @@ var historyItemSchema = external_exports.discriminatedUnion("type", [
|
|
|
43389
43563
|
dynamicToolCallSchema,
|
|
43390
43564
|
planSchema
|
|
43391
43565
|
]);
|
|
43566
|
+
var CodexHistoryResponseError = class extends Error {
|
|
43567
|
+
code;
|
|
43568
|
+
constructor(response) {
|
|
43569
|
+
super(response.message);
|
|
43570
|
+
this.code = response.code;
|
|
43571
|
+
this.name = "CodexHistoryResponseError";
|
|
43572
|
+
}
|
|
43573
|
+
};
|
|
43392
43574
|
function bounded(value, maximum) {
|
|
43393
43575
|
return value.slice(0, maximum);
|
|
43394
43576
|
}
|
|
@@ -43428,7 +43610,7 @@ function formatted(value) {
|
|
|
43428
43610
|
}
|
|
43429
43611
|
return JSON.stringify(value) ?? "";
|
|
43430
43612
|
}
|
|
43431
|
-
function
|
|
43613
|
+
function toolStatus2(status) {
|
|
43432
43614
|
return status === "inProgress" ? "running" : status === "completed" ? "completed" : "failed";
|
|
43433
43615
|
}
|
|
43434
43616
|
function diffDisplayContent(path3, newText) {
|
|
@@ -43635,7 +43817,7 @@ function decodeHistory(thread, value, options) {
|
|
|
43635
43817
|
formatted_output: historyItem.aggregatedOutput ?? "",
|
|
43636
43818
|
...historyItem.exitCode == null ? {} : { exit_code: historyItem.exitCode }
|
|
43637
43819
|
}),
|
|
43638
|
-
status:
|
|
43820
|
+
status: toolStatus2(historyItem.status),
|
|
43639
43821
|
title: historyItem.command,
|
|
43640
43822
|
toolKind: action
|
|
43641
43823
|
})
|
|
@@ -43657,7 +43839,7 @@ function decodeHistory(thread, value, options) {
|
|
|
43657
43839
|
locations: paths,
|
|
43658
43840
|
name: "",
|
|
43659
43841
|
output: "",
|
|
43660
|
-
status:
|
|
43842
|
+
status: toolStatus2(historyItem.status),
|
|
43661
43843
|
title: paths.join(", "),
|
|
43662
43844
|
toolKind: "edit"
|
|
43663
43845
|
})
|
|
@@ -43675,7 +43857,7 @@ function decodeHistory(thread, value, options) {
|
|
|
43675
43857
|
locations: [],
|
|
43676
43858
|
name: historyItem.tool,
|
|
43677
43859
|
output: formatted(historyItem.error ?? historyItem.result),
|
|
43678
|
-
status:
|
|
43860
|
+
status: toolStatus2(historyItem.status),
|
|
43679
43861
|
title: `${historyItem.server}/${historyItem.tool}`,
|
|
43680
43862
|
toolKind: "other"
|
|
43681
43863
|
})
|
|
@@ -43693,7 +43875,7 @@ function decodeHistory(thread, value, options) {
|
|
|
43693
43875
|
locations: [],
|
|
43694
43876
|
name: historyItem.tool,
|
|
43695
43877
|
output: formatted(historyItem.contentItems),
|
|
43696
|
-
status:
|
|
43878
|
+
status: toolStatus2(historyItem.status),
|
|
43697
43879
|
title: historyItem.namespace == null ? historyItem.tool : `${historyItem.namespace}/${historyItem.tool}`,
|
|
43698
43880
|
toolKind: "other"
|
|
43699
43881
|
})
|
|
@@ -43859,7 +44041,7 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
|
|
|
43859
44041
|
fail(
|
|
43860
44042
|
new AcpExecutionError(
|
|
43861
44043
|
"Saved Codex history could not be read.",
|
|
43862
|
-
{ cause: message.error },
|
|
44044
|
+
{ cause: new CodexHistoryResponseError(message.error) },
|
|
43863
44045
|
"native_history_unavailable"
|
|
43864
44046
|
)
|
|
43865
44047
|
);
|
|
@@ -44367,7 +44549,7 @@ var NativeSessionService = class {
|
|
|
44367
44549
|
};
|
|
44368
44550
|
|
|
44369
44551
|
// src/relay-connection/daemon-operation-state.ts
|
|
44370
|
-
import { createHash as
|
|
44552
|
+
import { createHash as createHash6, randomUUID as randomUUID6 } from "node:crypto";
|
|
44371
44553
|
var MAX_TERMINAL_RECEIPTS = 1024;
|
|
44372
44554
|
function isTerminal(state) {
|
|
44373
44555
|
return state === "succeeded" || state === "failed" || state === "cancelled";
|
|
@@ -44376,7 +44558,7 @@ var DaemonOperationState = class {
|
|
|
44376
44558
|
#executions = /* @__PURE__ */ new Map();
|
|
44377
44559
|
#terminalCount = 0;
|
|
44378
44560
|
claimExecution = (commandId, sessionId, commandJson) => {
|
|
44379
|
-
const commandHash =
|
|
44561
|
+
const commandHash = createHash6("sha256").update(commandJson).digest("hex");
|
|
44380
44562
|
const existing = this.#executions.get(commandId);
|
|
44381
44563
|
if (existing !== void 0) {
|
|
44382
44564
|
if (existing.sessionId !== sessionId || existing.commandHash !== commandHash) {
|
|
@@ -44598,7 +44780,7 @@ import { WebSocket as WebSocket5 } from "undici";
|
|
|
44598
44780
|
import { WebSocket as WebSocket3 } from "undici";
|
|
44599
44781
|
|
|
44600
44782
|
// src/agent-catalog/discover-agent-settings.ts
|
|
44601
|
-
import { createHash as
|
|
44783
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
44602
44784
|
|
|
44603
44785
|
// src/agent-catalog/agent-settings-base.ts
|
|
44604
44786
|
var AgentSettingsConfigurationError = class extends Error {
|
|
@@ -45062,7 +45244,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
45062
45244
|
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
45063
45245
|
valuesByModel: {}
|
|
45064
45246
|
};
|
|
45065
|
-
return
|
|
45247
|
+
return createHash7("sha256").update(
|
|
45066
45248
|
JSON.stringify({
|
|
45067
45249
|
adapterVersion: agent.kind === "acp-adapter-process" ? agent.adapterVersion : agent.agentVersion,
|
|
45068
45250
|
agentId: agent.id,
|
|
@@ -45374,7 +45556,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
45374
45556
|
},
|
|
45375
45557
|
queuedPromptRequests: recovery.queuedPromptRequests
|
|
45376
45558
|
},
|
|
45377
|
-
kind:
|
|
45559
|
+
kind: SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND,
|
|
45378
45560
|
requestId: command.requestId,
|
|
45379
45561
|
sessionId: command.sessionId
|
|
45380
45562
|
});
|
|
@@ -45403,6 +45585,81 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
45403
45585
|
}
|
|
45404
45586
|
}
|
|
45405
45587
|
}
|
|
45588
|
+
async function executeSessionPreviewHistoryPageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventLogV2, signal) {
|
|
45589
|
+
try {
|
|
45590
|
+
const resolved = await resolveSessionDirectories(
|
|
45591
|
+
directories,
|
|
45592
|
+
config2.bindingId,
|
|
45593
|
+
command.directoryId,
|
|
45594
|
+
command.additionalDirectoryIds,
|
|
45595
|
+
signal
|
|
45596
|
+
);
|
|
45597
|
+
const replay = await sessions.previewNativeSessionEventsV2(
|
|
45598
|
+
{
|
|
45599
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
45600
|
+
agent: config2.catalog.find(command.agentId),
|
|
45601
|
+
cwd: resolved.cwd,
|
|
45602
|
+
sessionId: command.sessionId,
|
|
45603
|
+
signal
|
|
45604
|
+
},
|
|
45605
|
+
command.sessionId,
|
|
45606
|
+
command.eventLimit,
|
|
45607
|
+
command.cursor
|
|
45608
|
+
);
|
|
45609
|
+
signal.throwIfAborted();
|
|
45610
|
+
const events = replay.events.map(
|
|
45611
|
+
(event, index2) => eventLogV2.event(
|
|
45612
|
+
command.sessionId,
|
|
45613
|
+
replay.sessionGenerationId,
|
|
45614
|
+
replay.startPosition + index2,
|
|
45615
|
+
event,
|
|
45616
|
+
"1970-01-01T00:00:00.000Z"
|
|
45617
|
+
)
|
|
45618
|
+
);
|
|
45619
|
+
const tailCursor = events.at(-1)?.eventId ?? "";
|
|
45620
|
+
audit.record({
|
|
45621
|
+
commandId: command.requestId,
|
|
45622
|
+
event: "session_event_log_v2_loaded",
|
|
45623
|
+
sessionId: command.sessionId
|
|
45624
|
+
});
|
|
45625
|
+
send(socket, {
|
|
45626
|
+
events: {
|
|
45627
|
+
events: {
|
|
45628
|
+
events,
|
|
45629
|
+
nextCursor: replay.nextCursor,
|
|
45630
|
+
sessionGenerationId: replay.sessionGenerationId,
|
|
45631
|
+
tailCursor,
|
|
45632
|
+
truncated: replay.truncated,
|
|
45633
|
+
version: 2
|
|
45634
|
+
},
|
|
45635
|
+
queuedPromptRequests: []
|
|
45636
|
+
},
|
|
45637
|
+
kind: SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
|
|
45638
|
+
requestId: command.requestId,
|
|
45639
|
+
sessionId: command.sessionId
|
|
45640
|
+
});
|
|
45641
|
+
} catch (error62) {
|
|
45642
|
+
if (!signal.aborted) {
|
|
45643
|
+
diagnostics.daemonDiagnostic(
|
|
45644
|
+
"session_history_v2_load_failed",
|
|
45645
|
+
command.requestId,
|
|
45646
|
+
{
|
|
45647
|
+
agentId: command.agentId,
|
|
45648
|
+
code: operationErrorCode(error62),
|
|
45649
|
+
sessionId: command.sessionId
|
|
45650
|
+
},
|
|
45651
|
+
error62
|
|
45652
|
+
);
|
|
45653
|
+
audit.record({
|
|
45654
|
+
commandId: command.requestId,
|
|
45655
|
+
details: { agentId: command.agentId, code: operationErrorCode(error62) },
|
|
45656
|
+
event: "session_history_v2_load_failed",
|
|
45657
|
+
sessionId: command.sessionId
|
|
45658
|
+
});
|
|
45659
|
+
reportOperationFailure(socket, command.requestId, command.sessionId, error62);
|
|
45660
|
+
}
|
|
45661
|
+
}
|
|
45662
|
+
}
|
|
45406
45663
|
|
|
45407
45664
|
// src/acp/session-config/apply-session-configuration.ts
|
|
45408
45665
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
@@ -46152,6 +46409,20 @@ function createDaemonCommandHandler({
|
|
|
46152
46409
|
);
|
|
46153
46410
|
return;
|
|
46154
46411
|
}
|
|
46412
|
+
if (kind === SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND) {
|
|
46413
|
+
void executeSessionPreviewHistoryPageLoad(
|
|
46414
|
+
socket,
|
|
46415
|
+
message,
|
|
46416
|
+
config2,
|
|
46417
|
+
directories,
|
|
46418
|
+
audit,
|
|
46419
|
+
diagnostics,
|
|
46420
|
+
sessions,
|
|
46421
|
+
eventLogV2,
|
|
46422
|
+
signal
|
|
46423
|
+
);
|
|
46424
|
+
return;
|
|
46425
|
+
}
|
|
46155
46426
|
if (kind === NATIVE_SESSION_CANCEL_KIND) {
|
|
46156
46427
|
nativeRequestHandler.cancel(message);
|
|
46157
46428
|
return;
|
|
@@ -47123,7 +47394,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
47123
47394
|
publishCatalog: async (installationSignal) => await publishAgentCatalog(config2, installationSignal),
|
|
47124
47395
|
stateDirectory
|
|
47125
47396
|
});
|
|
47126
|
-
const channelHash =
|
|
47397
|
+
const channelHash = createHash8("sha256").update(config2.channelId).digest("hex");
|
|
47127
47398
|
const sessionDatabase = openAcpSessionDatabase(join19(stateDirectory, "sessions", `${channelHash}.sqlite`));
|
|
47128
47399
|
let eventsV2;
|
|
47129
47400
|
try {
|
|
@@ -47149,13 +47420,16 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
47149
47420
|
}, eventLogV2.record),
|
|
47150
47421
|
sessionStore,
|
|
47151
47422
|
{
|
|
47152
|
-
|
|
47153
|
-
|
|
47154
|
-
|
|
47155
|
-
|
|
47156
|
-
|
|
47157
|
-
|
|
47158
|
-
|
|
47423
|
+
access: (options2) => options2.agent.id === "codex" ? {
|
|
47424
|
+
kind: "direct",
|
|
47425
|
+
read: async (nativeSessionId, nativeTurn) => (await readCodexFullHistory(
|
|
47426
|
+
options2.agent,
|
|
47427
|
+
options2.cwd,
|
|
47428
|
+
nativeSessionId,
|
|
47429
|
+
options2.signal,
|
|
47430
|
+
nativeTurn
|
|
47431
|
+
)).history
|
|
47432
|
+
} : { kind: "acp" }
|
|
47159
47433
|
},
|
|
47160
47434
|
"native",
|
|
47161
47435
|
publisher.publishStatus,
|
|
@@ -47420,7 +47694,7 @@ function isRecord12(value) {
|
|
|
47420
47694
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
47421
47695
|
}
|
|
47422
47696
|
function controlSocketPath(stateDirectory) {
|
|
47423
|
-
const installationHash =
|
|
47697
|
+
const installationHash = createHash9("sha256").update(stateDirectory).digest("hex").slice(0, 32);
|
|
47424
47698
|
return process.platform === "win32" ? `\\\\.\\pipe\\mobius-${installationHash}` : join20(tmpdir(), `mobius-${installationHash}.sock`);
|
|
47425
47699
|
}
|
|
47426
47700
|
function controlTokenPath(stateDirectory) {
|