@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/runtime.js
CHANGED
|
@@ -21409,24 +21409,28 @@ var decodeAcpSessionUpdateV2 = (value) => decode5(value, acpSessionUpdateV2Schem
|
|
|
21409
21409
|
// ../protocol/src/session-live-history.ts
|
|
21410
21410
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
21411
21411
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
|
|
21412
|
+
var SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
|
|
21413
|
+
var SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND = "session.preview-history.page.loaded";
|
|
21412
21414
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
21413
|
-
var
|
|
21415
|
+
var pageLoadFields = {
|
|
21414
21416
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21415
21417
|
agentId: identifierStringSchema,
|
|
21416
21418
|
bindingId: identifierStringSchema,
|
|
21417
21419
|
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
21418
21420
|
directoryId: directoryIdentifier,
|
|
21419
|
-
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND),
|
|
21420
21421
|
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
21421
21422
|
requestId: identifierStringSchema,
|
|
21422
21423
|
sessionId: identifierStringSchema
|
|
21423
|
-
}
|
|
21424
|
-
var
|
|
21424
|
+
};
|
|
21425
|
+
var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
|
|
21426
|
+
var sessionPreviewHistoryPageLoadSchema = external_exports.object({ ...pageLoadFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND) }).readonly();
|
|
21427
|
+
var pageLoadedFields = {
|
|
21425
21428
|
events: nativeSessionEventsV2Schema,
|
|
21426
|
-
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND),
|
|
21427
21429
|
requestId: identifierStringSchema,
|
|
21428
21430
|
sessionId: identifierStringSchema
|
|
21429
|
-
}
|
|
21431
|
+
};
|
|
21432
|
+
var sessionLiveHistoryV2PageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND) }).readonly();
|
|
21433
|
+
var sessionPreviewHistoryPageLoadedSchema = external_exports.object({ ...pageLoadedFields, kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND) }).readonly();
|
|
21430
21434
|
function decode6(schema, encoded) {
|
|
21431
21435
|
try {
|
|
21432
21436
|
const value = JSON.parse(encoded);
|
|
@@ -21437,8 +21441,12 @@ function decode6(schema, encoded) {
|
|
|
21437
21441
|
}
|
|
21438
21442
|
var decodeSessionLiveHistoryV2PageLoad = (encoded) => decode6(sessionLiveHistoryV2PageLoadSchema, encoded);
|
|
21439
21443
|
var decodeSessionLiveHistoryV2PageLoaded = (encoded) => decode6(sessionLiveHistoryV2PageLoadedSchema, encoded);
|
|
21444
|
+
var decodeSessionPreviewHistoryPageLoad = (encoded) => decode6(sessionPreviewHistoryPageLoadSchema, encoded);
|
|
21445
|
+
var decodeSessionPreviewHistoryPageLoaded = (encoded) => decode6(sessionPreviewHistoryPageLoadedSchema, encoded);
|
|
21440
21446
|
var encodeSessionLiveHistoryV2PageLoad = (value) => JSON.stringify(sessionLiveHistoryV2PageLoadSchema.parse(value));
|
|
21441
21447
|
var encodeSessionLiveHistoryV2PageLoaded = (value) => JSON.stringify(sessionLiveHistoryV2PageLoadedSchema.parse(value));
|
|
21448
|
+
var encodeSessionPreviewHistoryPageLoad = (value) => JSON.stringify(sessionPreviewHistoryPageLoadSchema.parse(value));
|
|
21449
|
+
var encodeSessionPreviewHistoryPageLoaded = (value) => JSON.stringify(sessionPreviewHistoryPageLoadedSchema.parse(value));
|
|
21442
21450
|
|
|
21443
21451
|
// ../protocol/src/daemon-transport.ts
|
|
21444
21452
|
function defineMessageSignature(kind, encoder, decoder) {
|
|
@@ -21451,6 +21459,11 @@ function defineMessageSignature(kind, encoder, decoder) {
|
|
|
21451
21459
|
};
|
|
21452
21460
|
}
|
|
21453
21461
|
var serviceToDaemonSignatures = {
|
|
21462
|
+
[SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND]: defineMessageSignature(
|
|
21463
|
+
SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND,
|
|
21464
|
+
encodeSessionPreviewHistoryPageLoad,
|
|
21465
|
+
decodeSessionPreviewHistoryPageLoad
|
|
21466
|
+
),
|
|
21454
21467
|
[AGENT_INSTALL_CANCEL_KIND]: defineMessageSignature(
|
|
21455
21468
|
AGENT_INSTALL_CANCEL_KIND,
|
|
21456
21469
|
encodeAgentInstallCancelCommand,
|
|
@@ -21555,6 +21568,11 @@ function decodeServiceToDaemonMessage(encoded) {
|
|
|
21555
21568
|
return signature.decoder(encoded);
|
|
21556
21569
|
}
|
|
21557
21570
|
var daemonToServiceSignatures = {
|
|
21571
|
+
[SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND]: defineMessageSignature(
|
|
21572
|
+
SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
|
|
21573
|
+
encodeSessionPreviewHistoryPageLoaded,
|
|
21574
|
+
decodeSessionPreviewHistoryPageLoaded
|
|
21575
|
+
),
|
|
21558
21576
|
[SESSION_CONFIG_UPDATED_KIND]: defineMessageSignature(
|
|
21559
21577
|
SESSION_CONFIG_UPDATED_KIND,
|
|
21560
21578
|
encodeSessionConfigUpdatedEvent,
|
|
@@ -24404,7 +24422,9 @@ var CodexAcpAgent = class {
|
|
|
24404
24422
|
"thread/fork",
|
|
24405
24423
|
{
|
|
24406
24424
|
cwd: context.params.cwd,
|
|
24407
|
-
|
|
24425
|
+
// Fork keeps the native context; its response only needs the new identity
|
|
24426
|
+
// and settings. History is read through the separate history boundary.
|
|
24427
|
+
excludeTurns: true,
|
|
24408
24428
|
threadId: context.params.sessionId
|
|
24409
24429
|
},
|
|
24410
24430
|
AbortSignal.any([context.signal, AbortSignal.timeout(APPROVAL_TIMEOUT_MILLISECONDS2)])
|
|
@@ -24413,7 +24433,6 @@ var CodexAcpAgent = class {
|
|
|
24413
24433
|
this.#nativeSessionId = forked.thread.id;
|
|
24414
24434
|
this.#settings.selectRestoredThread(forked);
|
|
24415
24435
|
await this.#settings.probeCollaborationMode(this.#nativeSessionId, context.signal);
|
|
24416
|
-
await this.#replayHistory(forked.thread.turns);
|
|
24417
24436
|
await this.#emitAvailableCommands();
|
|
24418
24437
|
return { configOptions: this.#settings.configOptions(), sessionId: forked.thread.id };
|
|
24419
24438
|
}).onRequest(methods.agent.session.resume, async (context) => {
|
|
@@ -26876,7 +26895,7 @@ function createDaemonConfig(connection, agents = [], installableAgents = [], loc
|
|
|
26876
26895
|
}
|
|
26877
26896
|
|
|
26878
26897
|
// src/run-daemon.ts
|
|
26879
|
-
import { createHash as
|
|
26898
|
+
import { createHash as createHash7, randomUUID as randomUUID8 } from "node:crypto";
|
|
26880
26899
|
import { join as join18 } from "node:path";
|
|
26881
26900
|
import { styleText } from "node:util";
|
|
26882
26901
|
|
|
@@ -27771,7 +27790,7 @@ var AcpActivity = class _AcpActivity {
|
|
|
27771
27790
|
toolKind;
|
|
27772
27791
|
content;
|
|
27773
27792
|
detail;
|
|
27774
|
-
constructor(activityId, activityType, input2, locations, name2, output2, sequence, status, title2,
|
|
27793
|
+
constructor(activityId, activityType, input2, locations, name2, output2, sequence, status, title2, toolKind2, content = [], detail = captureActivityDetail(content, input2, output2)) {
|
|
27775
27794
|
this.activityId = activityId;
|
|
27776
27795
|
this.activityType = activityType;
|
|
27777
27796
|
this.input = input2;
|
|
@@ -27781,7 +27800,7 @@ var AcpActivity = class _AcpActivity {
|
|
|
27781
27800
|
this.sequence = sequence;
|
|
27782
27801
|
this.status = status;
|
|
27783
27802
|
this.title = title2;
|
|
27784
|
-
this.toolKind =
|
|
27803
|
+
this.toolKind = toolKind2;
|
|
27785
27804
|
this.content = content;
|
|
27786
27805
|
this.detail = detail;
|
|
27787
27806
|
}
|
|
@@ -28438,6 +28457,9 @@ function sessionConfigProtocolForAgent(_agentId) {
|
|
|
28438
28457
|
}
|
|
28439
28458
|
|
|
28440
28459
|
// src/acp/session-contracts.ts
|
|
28460
|
+
var acpNativeHistoryReader = {
|
|
28461
|
+
access: () => ({ kind: "acp" })
|
|
28462
|
+
};
|
|
28441
28463
|
var NullAcpSessionObserver = class {
|
|
28442
28464
|
onSessionEventV2 = (_sessionId, _event, _position) => Promise.resolve();
|
|
28443
28465
|
onCommands = () => Promise.resolve();
|
|
@@ -34088,6 +34110,15 @@ function eventPage(sessionGenerationId, eventCount, eventLimit, cursor, read) {
|
|
|
34088
34110
|
truncated: startPosition > 0
|
|
34089
34111
|
};
|
|
34090
34112
|
}
|
|
34113
|
+
function pageAcpSessionEventsV2(sessionGenerationId, events, eventLimit, cursor) {
|
|
34114
|
+
return eventPage(
|
|
34115
|
+
sessionGenerationId,
|
|
34116
|
+
events.length,
|
|
34117
|
+
eventLimit,
|
|
34118
|
+
cursor,
|
|
34119
|
+
(startPosition, endPosition) => events.slice(startPosition - 1, endPosition)
|
|
34120
|
+
);
|
|
34121
|
+
}
|
|
34091
34122
|
var MemoryAcpSessionEventStoreV2 = class {
|
|
34092
34123
|
#events = /* @__PURE__ */ new Map();
|
|
34093
34124
|
#session = (sessionId) => {
|
|
@@ -36210,6 +36241,147 @@ function isNativeChatSessionId(agentId, sessionId) {
|
|
|
36210
36241
|
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);
|
|
36211
36242
|
}
|
|
36212
36243
|
|
|
36244
|
+
// src/native-sessions/native-history-events-v2.ts
|
|
36245
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
36246
|
+
function contentBlock(content) {
|
|
36247
|
+
switch (content.type) {
|
|
36248
|
+
case "text":
|
|
36249
|
+
return { text: content.text, type: "text" };
|
|
36250
|
+
case "image":
|
|
36251
|
+
return {
|
|
36252
|
+
data: content.data,
|
|
36253
|
+
mimeType: content.mimeType,
|
|
36254
|
+
type: "image",
|
|
36255
|
+
...content.uri.length === 0 ? {} : { uri: content.uri }
|
|
36256
|
+
};
|
|
36257
|
+
case "resource_link":
|
|
36258
|
+
return {
|
|
36259
|
+
name: content.name.length === 0 ? content.uri : content.name,
|
|
36260
|
+
type: "resource_link",
|
|
36261
|
+
uri: content.uri,
|
|
36262
|
+
...content.mimeType.length === 0 ? {} : { mimeType: content.mimeType }
|
|
36263
|
+
};
|
|
36264
|
+
case "resource":
|
|
36265
|
+
return {
|
|
36266
|
+
resource: content.text.length > 0 ? {
|
|
36267
|
+
text: content.text,
|
|
36268
|
+
uri: content.uri,
|
|
36269
|
+
...content.mimeType.length === 0 ? {} : { mimeType: content.mimeType }
|
|
36270
|
+
} : {
|
|
36271
|
+
blob: content.data,
|
|
36272
|
+
uri: content.uri,
|
|
36273
|
+
...content.mimeType.length === 0 ? {} : { mimeType: content.mimeType }
|
|
36274
|
+
},
|
|
36275
|
+
type: "resource"
|
|
36276
|
+
};
|
|
36277
|
+
case "diff":
|
|
36278
|
+
case "terminal":
|
|
36279
|
+
case "video":
|
|
36280
|
+
return null;
|
|
36281
|
+
default: {
|
|
36282
|
+
const unhandled = content.type;
|
|
36283
|
+
throw new Error(`Unknown native history content: ${String(unhandled)}`);
|
|
36284
|
+
}
|
|
36285
|
+
}
|
|
36286
|
+
}
|
|
36287
|
+
function toolContent2(content) {
|
|
36288
|
+
if (content.type === "diff") {
|
|
36289
|
+
return {
|
|
36290
|
+
newText: content.newText,
|
|
36291
|
+
path: content.path,
|
|
36292
|
+
type: "diff",
|
|
36293
|
+
...content.oldText.length === 0 ? {} : { oldText: content.oldText }
|
|
36294
|
+
};
|
|
36295
|
+
}
|
|
36296
|
+
if (content.type === "terminal") {
|
|
36297
|
+
return { terminalId: content.terminalId, type: "terminal" };
|
|
36298
|
+
}
|
|
36299
|
+
const block = contentBlock(content);
|
|
36300
|
+
return block === null ? null : { content: block, type: "content" };
|
|
36301
|
+
}
|
|
36302
|
+
function toolKind(value) {
|
|
36303
|
+
switch (value) {
|
|
36304
|
+
case "read":
|
|
36305
|
+
case "edit":
|
|
36306
|
+
case "delete":
|
|
36307
|
+
case "move":
|
|
36308
|
+
case "search":
|
|
36309
|
+
case "execute":
|
|
36310
|
+
case "think":
|
|
36311
|
+
case "fetch":
|
|
36312
|
+
case "switch_mode":
|
|
36313
|
+
case "other":
|
|
36314
|
+
return value;
|
|
36315
|
+
default:
|
|
36316
|
+
return "other";
|
|
36317
|
+
}
|
|
36318
|
+
}
|
|
36319
|
+
function toolStatus(value) {
|
|
36320
|
+
switch (value) {
|
|
36321
|
+
case "pending":
|
|
36322
|
+
return "pending";
|
|
36323
|
+
case "running":
|
|
36324
|
+
case "in_progress":
|
|
36325
|
+
return "in_progress";
|
|
36326
|
+
case "completed":
|
|
36327
|
+
return "completed";
|
|
36328
|
+
default:
|
|
36329
|
+
return "failed";
|
|
36330
|
+
}
|
|
36331
|
+
}
|
|
36332
|
+
function activityEvent(activity2) {
|
|
36333
|
+
const content = activity2.content.flatMap((item) => {
|
|
36334
|
+
const converted = toolContent2(item);
|
|
36335
|
+
return converted === null ? [] : [converted];
|
|
36336
|
+
});
|
|
36337
|
+
return {
|
|
36338
|
+
payload: {
|
|
36339
|
+
content,
|
|
36340
|
+
kind: toolKind(activity2.toolKind),
|
|
36341
|
+
locations: activity2.locations.map((path2) => ({ path: path2 })),
|
|
36342
|
+
rawInput: activity2.input,
|
|
36343
|
+
rawOutput: activity2.output,
|
|
36344
|
+
sessionUpdate: "tool_call",
|
|
36345
|
+
status: toolStatus(activity2.status),
|
|
36346
|
+
title: activity2.title,
|
|
36347
|
+
toolCallId: activity2.activityId,
|
|
36348
|
+
...activity2.name.length === 0 ? {} : { name: activity2.name }
|
|
36349
|
+
},
|
|
36350
|
+
type: "acp"
|
|
36351
|
+
};
|
|
36352
|
+
}
|
|
36353
|
+
function contentEvent(sessionUpdate, messageId, content) {
|
|
36354
|
+
return { payload: { content, messageId, sessionUpdate }, type: "acp" };
|
|
36355
|
+
}
|
|
36356
|
+
function historyEvents(history) {
|
|
36357
|
+
return history.messages.flatMap((message, index2) => {
|
|
36358
|
+
const messageId = `native-history-${index2.toString()}`;
|
|
36359
|
+
const sessionUpdate = message.role === "user" ? "user_message_chunk" : "agent_message_chunk";
|
|
36360
|
+
const images = (message.images ?? []).map(
|
|
36361
|
+
(image) => contentEvent(sessionUpdate, messageId, {
|
|
36362
|
+
data: image.data,
|
|
36363
|
+
mimeType: image.mimeType,
|
|
36364
|
+
type: "image"
|
|
36365
|
+
})
|
|
36366
|
+
);
|
|
36367
|
+
const text2 = message.text.length === 0 ? [] : [contentEvent(sessionUpdate, messageId, { text: message.text, type: "text" })];
|
|
36368
|
+
if (message.role === "user") {
|
|
36369
|
+
return [...images, ...text2];
|
|
36370
|
+
}
|
|
36371
|
+
const activities = message.activities.map(activityEvent);
|
|
36372
|
+
const content = message.content.flatMap((item) => {
|
|
36373
|
+
const converted = contentBlock(item);
|
|
36374
|
+
return converted === null ? [] : [contentEvent(sessionUpdate, messageId, converted)];
|
|
36375
|
+
});
|
|
36376
|
+
return [...activities, ...content, ...images, ...text2];
|
|
36377
|
+
});
|
|
36378
|
+
}
|
|
36379
|
+
function nativeHistoryEventsV2(nativeSessionId, history, eventLimit, cursor) {
|
|
36380
|
+
const events = historyEvents(history);
|
|
36381
|
+
const generationId = createHash3("sha256").update(nativeSessionId).update("\0").update(JSON.stringify(events)).digest("hex");
|
|
36382
|
+
return pageAcpSessionEventsV2(generationId, events, eventLimit, cursor);
|
|
36383
|
+
}
|
|
36384
|
+
|
|
36213
36385
|
// src/acp/process-capacity.ts
|
|
36214
36386
|
var AcpProcessCapacityLease = class {
|
|
36215
36387
|
#releaseCapacity;
|
|
@@ -36422,7 +36594,7 @@ var AgentRuntimeManager = class {
|
|
|
36422
36594
|
#onSessionStatusChanged;
|
|
36423
36595
|
#contentExternalizer;
|
|
36424
36596
|
#observer;
|
|
36425
|
-
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader =
|
|
36597
|
+
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = acpNativeHistoryReader, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0, contentExternalizer = new AcpContentExternalizer(new UnretainedExternalContentStore())) {
|
|
36426
36598
|
this.#observer = observer;
|
|
36427
36599
|
this.#store = store;
|
|
36428
36600
|
this.#nativeHistoryReader = nativeHistoryReader;
|
|
@@ -36952,6 +37124,14 @@ var AgentRuntimeManager = class {
|
|
|
36952
37124
|
}
|
|
36953
37125
|
this.#nativeOperations.add(key);
|
|
36954
37126
|
try {
|
|
37127
|
+
const historyAccess = this.#nativeHistoryReader.access(options2);
|
|
37128
|
+
if (historyAccess.kind === "direct") {
|
|
37129
|
+
const history = await historyAccess.read(nativeSessionId, () => null);
|
|
37130
|
+
if (history.status === "unavailable") {
|
|
37131
|
+
throw new AcpExecutionError(history.cause.message, {}, history.cause.code);
|
|
37132
|
+
}
|
|
37133
|
+
return nativeHistoryEventsV2(nativeSessionId, history, eventLimit, cursor);
|
|
37134
|
+
}
|
|
36955
37135
|
return await this.#queryProcesses.previewEventsV2(options2, nativeSessionId, eventLimit, cursor);
|
|
36956
37136
|
} finally {
|
|
36957
37137
|
this.#nativeOperations.delete(key);
|
|
@@ -36961,15 +37141,9 @@ var AgentRuntimeManager = class {
|
|
|
36961
37141
|
return await this.#executionProcesses.use(options2.sessionId, async () => {
|
|
36962
37142
|
const runtime = await this.ensureSession(options2);
|
|
36963
37143
|
const stored = this.#store.read(options2.sessionId);
|
|
36964
|
-
|
|
36965
|
-
|
|
36966
|
-
|
|
36967
|
-
stored.session.nativeSessionId,
|
|
36968
|
-
runtime.nativeHistoryTurn
|
|
36969
|
-
);
|
|
36970
|
-
if (history !== null) {
|
|
36971
|
-
return history;
|
|
36972
|
-
}
|
|
37144
|
+
const historyAccess = this.#nativeHistoryReader.access(options2);
|
|
37145
|
+
if (stored instanceof FoundAcpStoredSession && historyAccess.kind === "direct") {
|
|
37146
|
+
return await historyAccess.read(stored.session.nativeSessionId, runtime.nativeHistoryTurn);
|
|
36973
37147
|
}
|
|
36974
37148
|
return await runtime.loadHistory(options2.signal);
|
|
36975
37149
|
});
|
|
@@ -37862,7 +38036,7 @@ import { WebSocket as WebSocket2 } from "undici";
|
|
|
37862
38036
|
import { WebSocket } from "undici";
|
|
37863
38037
|
|
|
37864
38038
|
// src/prompt-artifact-resolver.ts
|
|
37865
|
-
import { createHash as
|
|
38039
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
37866
38040
|
import { fetch as fetch3 } from "undici";
|
|
37867
38041
|
var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
37868
38042
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
@@ -38000,7 +38174,7 @@ async function download(config2, command, reference, signal) {
|
|
|
38000
38174
|
);
|
|
38001
38175
|
}
|
|
38002
38176
|
const bytes = await responseBytes(response, reference.byteLength, requestSignal);
|
|
38003
|
-
if (
|
|
38177
|
+
if (createHash4("sha256").update(bytes).digest("hex") !== reference.sha256) {
|
|
38004
38178
|
throw new PromptArtifactError(
|
|
38005
38179
|
"artifact_integrity_failed",
|
|
38006
38180
|
"The prompt artifact failed integrity validation"
|
|
@@ -39021,6 +39195,14 @@ var historyItemSchema = external_exports.discriminatedUnion("type", [
|
|
|
39021
39195
|
dynamicToolCallSchema,
|
|
39022
39196
|
planSchema
|
|
39023
39197
|
]);
|
|
39198
|
+
var CodexHistoryResponseError = class extends Error {
|
|
39199
|
+
code;
|
|
39200
|
+
constructor(response) {
|
|
39201
|
+
super(response.message);
|
|
39202
|
+
this.code = response.code;
|
|
39203
|
+
this.name = "CodexHistoryResponseError";
|
|
39204
|
+
}
|
|
39205
|
+
};
|
|
39024
39206
|
function bounded(value, maximum) {
|
|
39025
39207
|
return value.slice(0, maximum);
|
|
39026
39208
|
}
|
|
@@ -39060,7 +39242,7 @@ function formatted(value) {
|
|
|
39060
39242
|
}
|
|
39061
39243
|
return JSON.stringify(value) ?? "";
|
|
39062
39244
|
}
|
|
39063
|
-
function
|
|
39245
|
+
function toolStatus2(status) {
|
|
39064
39246
|
return status === "inProgress" ? "running" : status === "completed" ? "completed" : "failed";
|
|
39065
39247
|
}
|
|
39066
39248
|
function diffDisplayContent(path2, newText) {
|
|
@@ -39267,7 +39449,7 @@ function decodeHistory(thread, value, options) {
|
|
|
39267
39449
|
formatted_output: historyItem.aggregatedOutput ?? "",
|
|
39268
39450
|
...historyItem.exitCode == null ? {} : { exit_code: historyItem.exitCode }
|
|
39269
39451
|
}),
|
|
39270
|
-
status:
|
|
39452
|
+
status: toolStatus2(historyItem.status),
|
|
39271
39453
|
title: historyItem.command,
|
|
39272
39454
|
toolKind: action
|
|
39273
39455
|
})
|
|
@@ -39289,7 +39471,7 @@ function decodeHistory(thread, value, options) {
|
|
|
39289
39471
|
locations: paths,
|
|
39290
39472
|
name: "",
|
|
39291
39473
|
output: "",
|
|
39292
|
-
status:
|
|
39474
|
+
status: toolStatus2(historyItem.status),
|
|
39293
39475
|
title: paths.join(", "),
|
|
39294
39476
|
toolKind: "edit"
|
|
39295
39477
|
})
|
|
@@ -39307,7 +39489,7 @@ function decodeHistory(thread, value, options) {
|
|
|
39307
39489
|
locations: [],
|
|
39308
39490
|
name: historyItem.tool,
|
|
39309
39491
|
output: formatted(historyItem.error ?? historyItem.result),
|
|
39310
|
-
status:
|
|
39492
|
+
status: toolStatus2(historyItem.status),
|
|
39311
39493
|
title: `${historyItem.server}/${historyItem.tool}`,
|
|
39312
39494
|
toolKind: "other"
|
|
39313
39495
|
})
|
|
@@ -39325,7 +39507,7 @@ function decodeHistory(thread, value, options) {
|
|
|
39325
39507
|
locations: [],
|
|
39326
39508
|
name: historyItem.tool,
|
|
39327
39509
|
output: formatted(historyItem.contentItems),
|
|
39328
|
-
status:
|
|
39510
|
+
status: toolStatus2(historyItem.status),
|
|
39329
39511
|
title: historyItem.namespace == null ? historyItem.tool : `${historyItem.namespace}/${historyItem.tool}`,
|
|
39330
39512
|
toolKind: "other"
|
|
39331
39513
|
})
|
|
@@ -39491,7 +39673,7 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
|
|
|
39491
39673
|
fail(
|
|
39492
39674
|
new AcpExecutionError(
|
|
39493
39675
|
"Saved Codex history could not be read.",
|
|
39494
|
-
{ cause: message.error },
|
|
39676
|
+
{ cause: new CodexHistoryResponseError(message.error) },
|
|
39495
39677
|
"native_history_unavailable"
|
|
39496
39678
|
)
|
|
39497
39679
|
);
|
|
@@ -39999,7 +40181,7 @@ var NativeSessionService = class {
|
|
|
39999
40181
|
};
|
|
40000
40182
|
|
|
40001
40183
|
// src/relay-connection/daemon-operation-state.ts
|
|
40002
|
-
import { createHash as
|
|
40184
|
+
import { createHash as createHash5, randomUUID as randomUUID5 } from "node:crypto";
|
|
40003
40185
|
var MAX_TERMINAL_RECEIPTS = 1024;
|
|
40004
40186
|
function isTerminal(state) {
|
|
40005
40187
|
return state === "succeeded" || state === "failed" || state === "cancelled";
|
|
@@ -40008,7 +40190,7 @@ var DaemonOperationState = class {
|
|
|
40008
40190
|
#executions = /* @__PURE__ */ new Map();
|
|
40009
40191
|
#terminalCount = 0;
|
|
40010
40192
|
claimExecution = (commandId, sessionId, commandJson) => {
|
|
40011
|
-
const commandHash =
|
|
40193
|
+
const commandHash = createHash5("sha256").update(commandJson).digest("hex");
|
|
40012
40194
|
const existing = this.#executions.get(commandId);
|
|
40013
40195
|
if (existing !== void 0) {
|
|
40014
40196
|
if (existing.sessionId !== sessionId || existing.commandHash !== commandHash) {
|
|
@@ -40230,7 +40412,7 @@ import { WebSocket as WebSocket5 } from "undici";
|
|
|
40230
40412
|
import { WebSocket as WebSocket3 } from "undici";
|
|
40231
40413
|
|
|
40232
40414
|
// src/agent-catalog/discover-agent-settings.ts
|
|
40233
|
-
import { createHash as
|
|
40415
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
40234
40416
|
|
|
40235
40417
|
// src/agent-catalog/agent-settings-base.ts
|
|
40236
40418
|
var AgentSettingsConfigurationError = class extends Error {
|
|
@@ -40694,7 +40876,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
40694
40876
|
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
40695
40877
|
valuesByModel: {}
|
|
40696
40878
|
};
|
|
40697
|
-
return
|
|
40879
|
+
return createHash6("sha256").update(
|
|
40698
40880
|
JSON.stringify({
|
|
40699
40881
|
adapterVersion: agent.kind === "acp-adapter-process" ? agent.adapterVersion : agent.agentVersion,
|
|
40700
40882
|
agentId: agent.id,
|
|
@@ -41006,7 +41188,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
41006
41188
|
},
|
|
41007
41189
|
queuedPromptRequests: recovery.queuedPromptRequests
|
|
41008
41190
|
},
|
|
41009
|
-
kind:
|
|
41191
|
+
kind: SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND,
|
|
41010
41192
|
requestId: command.requestId,
|
|
41011
41193
|
sessionId: command.sessionId
|
|
41012
41194
|
});
|
|
@@ -41035,6 +41217,81 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
41035
41217
|
}
|
|
41036
41218
|
}
|
|
41037
41219
|
}
|
|
41220
|
+
async function executeSessionPreviewHistoryPageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventLogV2, signal) {
|
|
41221
|
+
try {
|
|
41222
|
+
const resolved = await resolveSessionDirectories(
|
|
41223
|
+
directories,
|
|
41224
|
+
config2.bindingId,
|
|
41225
|
+
command.directoryId,
|
|
41226
|
+
command.additionalDirectoryIds,
|
|
41227
|
+
signal
|
|
41228
|
+
);
|
|
41229
|
+
const replay = await sessions.previewNativeSessionEventsV2(
|
|
41230
|
+
{
|
|
41231
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
41232
|
+
agent: config2.catalog.find(command.agentId),
|
|
41233
|
+
cwd: resolved.cwd,
|
|
41234
|
+
sessionId: command.sessionId,
|
|
41235
|
+
signal
|
|
41236
|
+
},
|
|
41237
|
+
command.sessionId,
|
|
41238
|
+
command.eventLimit,
|
|
41239
|
+
command.cursor
|
|
41240
|
+
);
|
|
41241
|
+
signal.throwIfAborted();
|
|
41242
|
+
const events = replay.events.map(
|
|
41243
|
+
(event, index2) => eventLogV2.event(
|
|
41244
|
+
command.sessionId,
|
|
41245
|
+
replay.sessionGenerationId,
|
|
41246
|
+
replay.startPosition + index2,
|
|
41247
|
+
event,
|
|
41248
|
+
"1970-01-01T00:00:00.000Z"
|
|
41249
|
+
)
|
|
41250
|
+
);
|
|
41251
|
+
const tailCursor = events.at(-1)?.eventId ?? "";
|
|
41252
|
+
audit.record({
|
|
41253
|
+
commandId: command.requestId,
|
|
41254
|
+
event: "session_event_log_v2_loaded",
|
|
41255
|
+
sessionId: command.sessionId
|
|
41256
|
+
});
|
|
41257
|
+
send(socket, {
|
|
41258
|
+
events: {
|
|
41259
|
+
events: {
|
|
41260
|
+
events,
|
|
41261
|
+
nextCursor: replay.nextCursor,
|
|
41262
|
+
sessionGenerationId: replay.sessionGenerationId,
|
|
41263
|
+
tailCursor,
|
|
41264
|
+
truncated: replay.truncated,
|
|
41265
|
+
version: 2
|
|
41266
|
+
},
|
|
41267
|
+
queuedPromptRequests: []
|
|
41268
|
+
},
|
|
41269
|
+
kind: SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND,
|
|
41270
|
+
requestId: command.requestId,
|
|
41271
|
+
sessionId: command.sessionId
|
|
41272
|
+
});
|
|
41273
|
+
} catch (error62) {
|
|
41274
|
+
if (!signal.aborted) {
|
|
41275
|
+
diagnostics.daemonDiagnostic(
|
|
41276
|
+
"session_history_v2_load_failed",
|
|
41277
|
+
command.requestId,
|
|
41278
|
+
{
|
|
41279
|
+
agentId: command.agentId,
|
|
41280
|
+
code: operationErrorCode(error62),
|
|
41281
|
+
sessionId: command.sessionId
|
|
41282
|
+
},
|
|
41283
|
+
error62
|
|
41284
|
+
);
|
|
41285
|
+
audit.record({
|
|
41286
|
+
commandId: command.requestId,
|
|
41287
|
+
details: { agentId: command.agentId, code: operationErrorCode(error62) },
|
|
41288
|
+
event: "session_history_v2_load_failed",
|
|
41289
|
+
sessionId: command.sessionId
|
|
41290
|
+
});
|
|
41291
|
+
reportOperationFailure(socket, command.requestId, command.sessionId, error62);
|
|
41292
|
+
}
|
|
41293
|
+
}
|
|
41294
|
+
}
|
|
41038
41295
|
|
|
41039
41296
|
// src/acp/session-config/apply-session-configuration.ts
|
|
41040
41297
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
@@ -41784,6 +42041,20 @@ function createDaemonCommandHandler({
|
|
|
41784
42041
|
);
|
|
41785
42042
|
return;
|
|
41786
42043
|
}
|
|
42044
|
+
if (kind === SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND) {
|
|
42045
|
+
void executeSessionPreviewHistoryPageLoad(
|
|
42046
|
+
socket,
|
|
42047
|
+
message,
|
|
42048
|
+
config2,
|
|
42049
|
+
directories,
|
|
42050
|
+
audit,
|
|
42051
|
+
diagnostics,
|
|
42052
|
+
sessions,
|
|
42053
|
+
eventLogV2,
|
|
42054
|
+
signal
|
|
42055
|
+
);
|
|
42056
|
+
return;
|
|
42057
|
+
}
|
|
41787
42058
|
if (kind === NATIVE_SESSION_CANCEL_KIND) {
|
|
41788
42059
|
nativeRequestHandler.cancel(message);
|
|
41789
42060
|
return;
|
|
@@ -42755,7 +43026,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42755
43026
|
publishCatalog: async (installationSignal) => await publishAgentCatalog(config2, installationSignal),
|
|
42756
43027
|
stateDirectory
|
|
42757
43028
|
});
|
|
42758
|
-
const channelHash =
|
|
43029
|
+
const channelHash = createHash7("sha256").update(config2.channelId).digest("hex");
|
|
42759
43030
|
const sessionDatabase = openAcpSessionDatabase(join18(stateDirectory, "sessions", `${channelHash}.sqlite`));
|
|
42760
43031
|
let eventsV2;
|
|
42761
43032
|
try {
|
|
@@ -42781,13 +43052,16 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
42781
43052
|
}, eventLogV2.record),
|
|
42782
43053
|
sessionStore,
|
|
42783
43054
|
{
|
|
42784
|
-
|
|
42785
|
-
|
|
42786
|
-
|
|
42787
|
-
|
|
42788
|
-
|
|
42789
|
-
|
|
42790
|
-
|
|
43055
|
+
access: (options2) => options2.agent.id === "codex" ? {
|
|
43056
|
+
kind: "direct",
|
|
43057
|
+
read: async (nativeSessionId, nativeTurn) => (await readCodexFullHistory(
|
|
43058
|
+
options2.agent,
|
|
43059
|
+
options2.cwd,
|
|
43060
|
+
nativeSessionId,
|
|
43061
|
+
options2.signal,
|
|
43062
|
+
nativeTurn
|
|
43063
|
+
)).history
|
|
43064
|
+
} : { kind: "acp" }
|
|
42791
43065
|
},
|
|
42792
43066
|
"native",
|
|
42793
43067
|
publisher.publishStatus,
|
|
@@ -42963,7 +43237,7 @@ import { basename as basename6, resolve as resolve7 } from "node:path";
|
|
|
42963
43237
|
import { fetch as fetch4 } from "undici";
|
|
42964
43238
|
|
|
42965
43239
|
// src/storage/runtime-installation-store.ts
|
|
42966
|
-
import { createHash as
|
|
43240
|
+
import { createHash as createHash8, randomUUID as randomUUID9 } from "node:crypto";
|
|
42967
43241
|
import { mkdir as mkdir5, open as open5, readdir as readdir4, rename as rename4, unlink, writeFile as writeFile4 } from "node:fs/promises";
|
|
42968
43242
|
import { dirname as dirname6, join as join19, resolve as resolve6 } from "node:path";
|
|
42969
43243
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
@@ -43099,7 +43373,7 @@ function installationId() {
|
|
|
43099
43373
|
return `min_${randomUUID9().replaceAll("-", "")}`;
|
|
43100
43374
|
}
|
|
43101
43375
|
function channelIndexFileName(channelId) {
|
|
43102
|
-
return `mci_${
|
|
43376
|
+
return `mci_${createHash8("sha256").update(channelId).digest("hex")}.json`;
|
|
43103
43377
|
}
|
|
43104
43378
|
function decodeInstallationPointer(value) {
|
|
43105
43379
|
if (!isRecord10(value) || !hasExactKeys(value, INSTALLATION_POINTER_KEYS) || value["version"] !== 1) {
|