@moxt-ai/mobius 0.0.197 → 0.0.199
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.map +1 -1
- package/dist/acp/codex/agent.js +6 -1
- package/dist/acp/codex/agent.js.map +1 -1
- package/dist/acp/codex/items.d.ts +2 -2
- package/dist/acp/codex/items.d.ts.map +1 -1
- package/dist/acp/codex/items.js.map +1 -1
- package/dist/acp/session-event-store-v2.d.ts.map +1 -1
- package/dist/acp/session-event-store-v2.js +108 -16
- package/dist/acp/session-event-store-v2.js.map +1 -1
- package/dist/cli.js +148 -52
- package/dist/cli.js.map +4 -4
- package/dist/daemon-command-handler.d.ts +3 -3
- package/dist/daemon-command-handler.d.ts.map +1 -1
- package/dist/daemon-command-handler.js +8 -8
- package/dist/daemon-command-handler.js.map +1 -1
- package/dist/daemon-command-results.d.ts +2 -2
- package/dist/daemon-command-results.d.ts.map +1 -1
- package/dist/daemon-command-results.js +3 -3
- package/dist/daemon-command-results.js.map +1 -1
- package/dist/daemon-history-commands.d.ts +3 -3
- package/dist/daemon-history-commands.d.ts.map +1 -1
- package/dist/daemon-history-commands.js +7 -7
- package/dist/daemon-history-commands.js.map +1 -1
- package/dist/daemon-prompt-executor.d.ts +3 -3
- package/dist/daemon-prompt-executor.d.ts.map +1 -1
- package/dist/daemon-prompt-executor.js +5 -5
- package/dist/daemon-prompt-executor.js.map +1 -1
- package/dist/index.js +148 -52
- package/dist/index.js.map +4 -4
- package/dist/relay-connection/run-relay-connection.d.ts +3 -3
- package/dist/relay-connection/run-relay-connection.d.ts.map +1 -1
- package/dist/relay-connection/run-relay-connection.js +2 -2
- package/dist/relay-connection/run-relay-connection.js.map +1 -1
- package/dist/run-daemon.js +4 -4
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +148 -52
- package/dist/runtime.js.map +4 -4
- package/dist/{session-event-log-v2.d.ts → session-event-projection-v2.d.ts} +3 -3
- package/dist/session-event-projection-v2.d.ts.map +1 -0
- package/dist/{session-event-log-v2.js → session-event-projection-v2.js} +4 -4
- package/dist/session-event-projection-v2.js.map +1 -0
- package/package.json +1 -1
- package/dist/session-event-log-v2.d.ts.map +0 -1
- package/dist/session-event-log-v2.js.map +0 -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.199",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -28706,7 +28706,11 @@ var CodexAcpAgent = class {
|
|
|
28706
28706
|
const update = toolCallUpdate(item, method === "item/completed" ? "completed" : "started");
|
|
28707
28707
|
if (update !== null) {
|
|
28708
28708
|
await this.#enqueue(async () => {
|
|
28709
|
-
|
|
28709
|
+
if (method === "item/started") {
|
|
28710
|
+
await this.#emit({ ...update, sessionUpdate: "tool_call" });
|
|
28711
|
+
} else {
|
|
28712
|
+
await this.#emit({ ...update, sessionUpdate: "tool_call_update" });
|
|
28713
|
+
}
|
|
28710
28714
|
});
|
|
28711
28715
|
}
|
|
28712
28716
|
};
|
|
@@ -39077,6 +39081,73 @@ var sessionEventV2 = sqliteTable(
|
|
|
39077
39081
|
// src/acp/session-event-store-v2.ts
|
|
39078
39082
|
var HOT_EVENT_HIGH_WATER_MARK = 256;
|
|
39079
39083
|
var HOT_EVENT_RETENTION = 128;
|
|
39084
|
+
var PositionedSessionEventV2 = class {
|
|
39085
|
+
#event;
|
|
39086
|
+
position;
|
|
39087
|
+
constructor(event, position) {
|
|
39088
|
+
this.#event = event;
|
|
39089
|
+
this.position = position;
|
|
39090
|
+
}
|
|
39091
|
+
get event() {
|
|
39092
|
+
return this.#event;
|
|
39093
|
+
}
|
|
39094
|
+
replaceEvent = (event) => {
|
|
39095
|
+
this.#event = event;
|
|
39096
|
+
};
|
|
39097
|
+
};
|
|
39098
|
+
var SessionEventsV2 = class {
|
|
39099
|
+
hot = [];
|
|
39100
|
+
#toolCallUpdateMap = /* @__PURE__ */ new Map();
|
|
39101
|
+
sessionGenerationId;
|
|
39102
|
+
nextPosition = 1;
|
|
39103
|
+
constructor() {
|
|
39104
|
+
this.sessionGenerationId = randomUUID2();
|
|
39105
|
+
}
|
|
39106
|
+
getToolCallUpdate = (toolCallId) => this.#toolCallUpdateMap.get(toolCallId);
|
|
39107
|
+
updateToolCallUpdate = (toolCallId, item) => {
|
|
39108
|
+
const current = this.#toolCallUpdateMap.get(toolCallId);
|
|
39109
|
+
if (current === void 0 || current.position !== item.position) {
|
|
39110
|
+
return false;
|
|
39111
|
+
}
|
|
39112
|
+
current.replaceEvent(item.event);
|
|
39113
|
+
return true;
|
|
39114
|
+
};
|
|
39115
|
+
append = (item) => {
|
|
39116
|
+
this.hot.push(item);
|
|
39117
|
+
const event = item.event;
|
|
39118
|
+
if (event.type === "acp" && (event.payload.sessionUpdate === "tool_call" || event.payload.sessionUpdate === "tool_call_update")) {
|
|
39119
|
+
this.#toolCallUpdateMap.set(event.payload.toolCallId, item);
|
|
39120
|
+
}
|
|
39121
|
+
};
|
|
39122
|
+
removeHotHead = (count) => {
|
|
39123
|
+
this.hot.splice(0, count);
|
|
39124
|
+
};
|
|
39125
|
+
};
|
|
39126
|
+
function projectAppend(session, event, position) {
|
|
39127
|
+
if (event.type !== "acp" || event.payload.sessionUpdate !== "tool_call_update") {
|
|
39128
|
+
return { item: new PositionedSessionEventV2(event, position), kind: "append" };
|
|
39129
|
+
}
|
|
39130
|
+
const update = event.payload;
|
|
39131
|
+
const previous = session.getToolCallUpdate(update.toolCallId);
|
|
39132
|
+
const previousPayload = previous?.event.type === "acp" ? previous.event.payload : void 0;
|
|
39133
|
+
const previousUpdate = previousPayload?.sessionUpdate === "tool_call" || previousPayload?.sessionUpdate === "tool_call_update" ? previousPayload : void 0;
|
|
39134
|
+
const merged = {
|
|
39135
|
+
...previousUpdate,
|
|
39136
|
+
...update,
|
|
39137
|
+
sessionUpdate: "tool_call_update",
|
|
39138
|
+
toolCallId: update.toolCallId
|
|
39139
|
+
};
|
|
39140
|
+
const item = new PositionedSessionEventV2({ payload: merged, type: "acp" }, position);
|
|
39141
|
+
return previousPayload?.sessionUpdate !== "tool_call_update" || previous === void 0 ? { item, kind: "append" } : {
|
|
39142
|
+
item,
|
|
39143
|
+
kind: "compact-and-append",
|
|
39144
|
+
previous: new PositionedSessionEventV2(compactedToolCallUpdate(update.toolCallId), previous.position),
|
|
39145
|
+
toolCallId: update.toolCallId
|
|
39146
|
+
};
|
|
39147
|
+
}
|
|
39148
|
+
function compactedToolCallUpdate(toolCallId) {
|
|
39149
|
+
return { payload: { sessionUpdate: "tool_call_update", toolCallId }, type: "acp" };
|
|
39150
|
+
}
|
|
39080
39151
|
function eventPage(sessionGenerationId, eventCount, eventLimit, cursor, read) {
|
|
39081
39152
|
const parsedCursor = cursor === null ? eventCount : Number(cursor);
|
|
39082
39153
|
if (!Number.isSafeInteger(parsedCursor) || parsedCursor < 0 || parsedCursor > eventCount) {
|
|
@@ -39104,18 +39175,18 @@ function pageAcpSessionEventsV2(sessionGenerationId, events, eventLimit, cursor)
|
|
|
39104
39175
|
var MemoryAcpSessionEventStoreV2 = class {
|
|
39105
39176
|
#events = /* @__PURE__ */ new Map();
|
|
39106
39177
|
#session = (sessionId) => {
|
|
39107
|
-
const session = this.#events.get(sessionId) ??
|
|
39108
|
-
hot: [],
|
|
39109
|
-
nextPosition: 1,
|
|
39110
|
-
sessionGenerationId: randomUUID2()
|
|
39111
|
-
};
|
|
39178
|
+
const session = this.#events.get(sessionId) ?? new SessionEventsV2();
|
|
39112
39179
|
this.#events.set(sessionId, session);
|
|
39113
39180
|
return session;
|
|
39114
39181
|
};
|
|
39115
39182
|
append = (sessionId, event) => {
|
|
39116
39183
|
const session = this.#session(sessionId);
|
|
39117
39184
|
const position = session.nextPosition;
|
|
39118
|
-
session
|
|
39185
|
+
const projected = projectAppend(session, event, position);
|
|
39186
|
+
if (projected.kind === "compact-and-append") {
|
|
39187
|
+
session.updateToolCallUpdate(projected.toolCallId, projected.previous);
|
|
39188
|
+
}
|
|
39189
|
+
session.append(projected.item);
|
|
39119
39190
|
session.nextPosition += 1;
|
|
39120
39191
|
return { position, sessionGenerationId: session.sessionGenerationId };
|
|
39121
39192
|
};
|
|
@@ -39134,7 +39205,7 @@ var MemoryAcpSessionEventStoreV2 = class {
|
|
|
39134
39205
|
this.#events.delete(sessionId);
|
|
39135
39206
|
};
|
|
39136
39207
|
reset = (sessionId) => {
|
|
39137
|
-
this.#events.set(sessionId,
|
|
39208
|
+
this.#events.set(sessionId, new SessionEventsV2());
|
|
39138
39209
|
};
|
|
39139
39210
|
};
|
|
39140
39211
|
var cachedEventRowSchema = external_exports.object({ eventJson: external_exports.string(), position: external_exports.number().int().positive() });
|
|
@@ -39169,11 +39240,7 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39169
39240
|
}
|
|
39170
39241
|
}
|
|
39171
39242
|
#session = (sessionId) => {
|
|
39172
|
-
const session = this.#sessions.get(sessionId) ??
|
|
39173
|
-
hot: [],
|
|
39174
|
-
nextPosition: 1,
|
|
39175
|
-
sessionGenerationId: randomUUID2()
|
|
39176
|
-
};
|
|
39243
|
+
const session = this.#sessions.get(sessionId) ?? new SessionEventsV2();
|
|
39177
39244
|
this.#sessions.set(sessionId, session);
|
|
39178
39245
|
return session;
|
|
39179
39246
|
};
|
|
@@ -39183,7 +39250,11 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39183
39250
|
}
|
|
39184
39251
|
const session = this.#session(sessionId);
|
|
39185
39252
|
const position = session.nextPosition;
|
|
39186
|
-
session
|
|
39253
|
+
const projected = projectAppend(session, event, position);
|
|
39254
|
+
if (projected.kind === "compact-and-append") {
|
|
39255
|
+
this.#updateToolCallUpdate(sessionId, session, projected.toolCallId, projected.previous);
|
|
39256
|
+
}
|
|
39257
|
+
session.append(projected.item);
|
|
39187
39258
|
session.nextPosition += 1;
|
|
39188
39259
|
this.#sessions.set(sessionId, session);
|
|
39189
39260
|
if (session.hot.length > HOT_EVENT_HIGH_WATER_MARK) {
|
|
@@ -39191,6 +39262,23 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39191
39262
|
}
|
|
39192
39263
|
return { position, sessionGenerationId: session.sessionGenerationId };
|
|
39193
39264
|
};
|
|
39265
|
+
#updateToolCallUpdate = (sessionId, session, toolCallId, item) => {
|
|
39266
|
+
if (!session.updateToolCallUpdate(toolCallId, item) || !this.#isLocalDBAvailable) {
|
|
39267
|
+
return;
|
|
39268
|
+
}
|
|
39269
|
+
try {
|
|
39270
|
+
this.#database.update(sessionEventV2).set({ eventJson: JSON.stringify(item.event) }).where(
|
|
39271
|
+
and(
|
|
39272
|
+
eq(sessionEventV2.generationId, session.sessionGenerationId),
|
|
39273
|
+
eq(sessionEventV2.sessionId, sessionId),
|
|
39274
|
+
eq(sessionEventV2.position, item.position)
|
|
39275
|
+
)
|
|
39276
|
+
).run();
|
|
39277
|
+
} catch (cause) {
|
|
39278
|
+
this.#isLocalDBAvailable = false;
|
|
39279
|
+
console.warn("Mobius V2 Session event cache writes are unavailable; retaining events in memory", cause);
|
|
39280
|
+
}
|
|
39281
|
+
};
|
|
39194
39282
|
#scheduleFlush = () => {
|
|
39195
39283
|
if (!this.#isLocalDBAvailable || this.#flushSchedule.kind !== "idle") {
|
|
39196
39284
|
return;
|
|
@@ -39237,7 +39325,10 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39237
39325
|
}
|
|
39238
39326
|
});
|
|
39239
39327
|
for (const batch of batches) {
|
|
39240
|
-
this.#sessions.get(batch.sessionId)
|
|
39328
|
+
const session = this.#sessions.get(batch.sessionId);
|
|
39329
|
+
if (session !== void 0) {
|
|
39330
|
+
session.removeHotHead(batch.count);
|
|
39331
|
+
}
|
|
39241
39332
|
}
|
|
39242
39333
|
} catch (cause) {
|
|
39243
39334
|
this.#isLocalDBAvailable = false;
|
|
@@ -39258,7 +39349,10 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39258
39349
|
)
|
|
39259
39350
|
).orderBy(asc(sessionEventV2.position)).all().map((value) => {
|
|
39260
39351
|
const row = cachedEventRowSchema.parse(value);
|
|
39261
|
-
return
|
|
39352
|
+
return new PositionedSessionEventV2(
|
|
39353
|
+
decodeCachedEvent(JSON.parse(row.eventJson)),
|
|
39354
|
+
row.position
|
|
39355
|
+
);
|
|
39262
39356
|
});
|
|
39263
39357
|
const hot = (session?.hot ?? []).filter(
|
|
39264
39358
|
({ position }) => position >= startPosition && position <= endPosition
|
|
@@ -39292,7 +39386,7 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39292
39386
|
reset = (sessionId) => {
|
|
39293
39387
|
const previous = this.#sessions.get(sessionId);
|
|
39294
39388
|
this.#deletePersisted(sessionId, previous?.sessionGenerationId);
|
|
39295
|
-
this.#sessions.set(sessionId,
|
|
39389
|
+
this.#sessions.set(sessionId, new SessionEventsV2());
|
|
39296
39390
|
};
|
|
39297
39391
|
close = () => {
|
|
39298
39392
|
if (this.#flushSchedule.kind === "closed") {
|
|
@@ -43227,7 +43321,7 @@ function send(socket, message) {
|
|
|
43227
43321
|
}
|
|
43228
43322
|
socket.send(encodeDaemonToServiceMessage(message));
|
|
43229
43323
|
}
|
|
43230
|
-
async function settleAbandonedTurn(
|
|
43324
|
+
async function settleAbandonedTurn(projection, operations, audit, cancellation) {
|
|
43231
43325
|
const attemptId = operations.findUnsettledAttemptId(cancellation.commandId, cancellation.sessionId);
|
|
43232
43326
|
if (attemptId === null) {
|
|
43233
43327
|
console.warn("Mobius daemon ignored cancellation for an inactive turn");
|
|
@@ -43238,14 +43332,14 @@ async function settleAbandonedTurn(eventLog, operations, audit, cancellation) {
|
|
|
43238
43332
|
event: "session_abandoned_turn_settled",
|
|
43239
43333
|
sessionId: cancellation.sessionId
|
|
43240
43334
|
});
|
|
43241
|
-
await
|
|
43335
|
+
await projection.failed(
|
|
43242
43336
|
cancellation.sessionId,
|
|
43243
43337
|
cancellation.commandId,
|
|
43244
43338
|
"agent_execution_abandoned",
|
|
43245
43339
|
"The local Agent execution was abandoned before it completed"
|
|
43246
43340
|
);
|
|
43247
43341
|
operations.transitionExecution(cancellation.commandId, "failed");
|
|
43248
|
-
|
|
43342
|
+
projection.publishTerminal(cancellation.sessionId, cancellation.commandId);
|
|
43249
43343
|
}
|
|
43250
43344
|
function operationErrorCode(error62) {
|
|
43251
43345
|
if (error62 instanceof AcpExecutionError || error62 instanceof LocalAuthorizationError || error62 instanceof LocalAgentCatalogError || error62 instanceof PromptArtifactError) {
|
|
@@ -46382,7 +46476,7 @@ function omitAgentReasoning(events) {
|
|
|
46382
46476
|
}
|
|
46383
46477
|
return retained;
|
|
46384
46478
|
}
|
|
46385
|
-
async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoning, queuedPromptRequests, load,
|
|
46479
|
+
async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoning, queuedPromptRequests, load, eventProjectionV2) {
|
|
46386
46480
|
let cursor = initialCursor;
|
|
46387
46481
|
let loaded = [];
|
|
46388
46482
|
let sessionGenerationId = null;
|
|
@@ -46394,7 +46488,7 @@ async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoni
|
|
|
46394
46488
|
}
|
|
46395
46489
|
sessionGenerationId = replay.sessionGenerationId;
|
|
46396
46490
|
const events2 = replay.events.map(
|
|
46397
|
-
(event, index2) =>
|
|
46491
|
+
(event, index2) => eventProjectionV2.event(
|
|
46398
46492
|
sessionId,
|
|
46399
46493
|
replay.sessionGenerationId,
|
|
46400
46494
|
replay.startPosition + index2,
|
|
@@ -46430,7 +46524,7 @@ async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoni
|
|
|
46430
46524
|
queuedPromptRequests
|
|
46431
46525
|
};
|
|
46432
46526
|
}
|
|
46433
|
-
async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions,
|
|
46527
|
+
async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventProjectionV2, signal) {
|
|
46434
46528
|
let agentId;
|
|
46435
46529
|
try {
|
|
46436
46530
|
const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
|
|
@@ -46452,7 +46546,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
46452
46546
|
sessionId: command.sessionId,
|
|
46453
46547
|
signal
|
|
46454
46548
|
};
|
|
46455
|
-
const recovery =
|
|
46549
|
+
const recovery = eventProjectionV2.promptRequestRecovery(command.sessionId);
|
|
46456
46550
|
const events = await loadHistoryPage(
|
|
46457
46551
|
command.sessionId,
|
|
46458
46552
|
command.eventLimit,
|
|
@@ -46460,7 +46554,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
46460
46554
|
command.omit?.includes("agent-reasoning") === true,
|
|
46461
46555
|
recovery.queuedPromptRequests,
|
|
46462
46556
|
async (eventLimit, cursor) => await sessions.loadSessionEventsV2(loadOptions, eventLimit, cursor),
|
|
46463
|
-
|
|
46557
|
+
eventProjectionV2
|
|
46464
46558
|
);
|
|
46465
46559
|
signal.throwIfAborted();
|
|
46466
46560
|
audit.record({
|
|
@@ -46499,7 +46593,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
46499
46593
|
}
|
|
46500
46594
|
}
|
|
46501
46595
|
}
|
|
46502
|
-
async function executeSessionPreviewHistoryPageLoad(socket, command, config2, directories, audit, diagnostics, sessions,
|
|
46596
|
+
async function executeSessionPreviewHistoryPageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventProjectionV2, signal) {
|
|
46503
46597
|
try {
|
|
46504
46598
|
const resolved = await resolveSessionDirectories(
|
|
46505
46599
|
directories,
|
|
@@ -46522,7 +46616,7 @@ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, di
|
|
|
46522
46616
|
command.omit?.includes("agent-reasoning") === true,
|
|
46523
46617
|
[],
|
|
46524
46618
|
async (eventLimit, cursor) => await sessions.previewNativeSessionEventsV2(loadOptions, command.sessionId, eventLimit, cursor),
|
|
46525
|
-
|
|
46619
|
+
eventProjectionV2
|
|
46526
46620
|
);
|
|
46527
46621
|
signal.throwIfAborted();
|
|
46528
46622
|
audit.record({
|
|
@@ -46765,7 +46859,7 @@ function daemonActivity(command, activity2) {
|
|
|
46765
46859
|
}
|
|
46766
46860
|
async function executePrompt({
|
|
46767
46861
|
operations,
|
|
46768
|
-
|
|
46862
|
+
eventProjectionV2,
|
|
46769
46863
|
command,
|
|
46770
46864
|
config: config2,
|
|
46771
46865
|
directories,
|
|
@@ -46845,7 +46939,7 @@ async function executePrompt({
|
|
|
46845
46939
|
}
|
|
46846
46940
|
}
|
|
46847
46941
|
const stream = activateAttempt();
|
|
46848
|
-
const lifecycleV2 =
|
|
46942
|
+
const lifecycleV2 = eventProjectionV2.started(
|
|
46849
46943
|
command.sessionId,
|
|
46850
46944
|
command.commandId,
|
|
46851
46945
|
attemptId,
|
|
@@ -46900,7 +46994,7 @@ async function executePrompt({
|
|
|
46900
46994
|
});
|
|
46901
46995
|
stopReason = result.stopReason;
|
|
46902
46996
|
}
|
|
46903
|
-
await
|
|
46997
|
+
await eventProjectionV2.completed(command.sessionId, command.commandId, stopReason);
|
|
46904
46998
|
operations.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
46905
46999
|
audit.record({
|
|
46906
47000
|
commandId: command.commandId,
|
|
@@ -46909,7 +47003,7 @@ async function executePrompt({
|
|
|
46909
47003
|
});
|
|
46910
47004
|
} catch (error62) {
|
|
46911
47005
|
if (signal.aborted && cancellationRequested()) {
|
|
46912
|
-
await
|
|
47006
|
+
await eventProjectionV2.completed(command.sessionId, command.commandId, "cancelled");
|
|
46913
47007
|
operations.transitionExecution(command.commandId, "cancelled");
|
|
46914
47008
|
audit.record({
|
|
46915
47009
|
commandId: command.commandId,
|
|
@@ -46926,7 +47020,7 @@ async function executePrompt({
|
|
|
46926
47020
|
const code = operationErrorCode(error62);
|
|
46927
47021
|
const failureCode = code === "session_operation_failed" ? "agent_execution_failed" : code;
|
|
46928
47022
|
const failureMessage = code === "session_operation_failed" ? "The local agent could not complete the request" : operationErrorMessage(error62);
|
|
46929
|
-
await
|
|
47023
|
+
await eventProjectionV2.failed(command.sessionId, command.commandId, failureCode, failureMessage);
|
|
46930
47024
|
operations.transitionExecution(command.commandId, "failed");
|
|
46931
47025
|
console.error("Mobius daemon command failed", error62);
|
|
46932
47026
|
}
|
|
@@ -47038,7 +47132,7 @@ function createDaemonCommandHandler({
|
|
|
47038
47132
|
installations,
|
|
47039
47133
|
nativeSessions,
|
|
47040
47134
|
operations,
|
|
47041
|
-
|
|
47135
|
+
eventProjectionV2,
|
|
47042
47136
|
externalContent,
|
|
47043
47137
|
activeTurns,
|
|
47044
47138
|
diagnostics,
|
|
@@ -47058,7 +47152,7 @@ function createDaemonCommandHandler({
|
|
|
47058
47152
|
timer
|
|
47059
47153
|
});
|
|
47060
47154
|
const queueChanged = (sessionId) => {
|
|
47061
|
-
void
|
|
47155
|
+
void eventProjectionV2.queueChanged(sessionId).catch((error62) => {
|
|
47062
47156
|
console.error("Could not record queue change", error62);
|
|
47063
47157
|
});
|
|
47064
47158
|
};
|
|
@@ -47118,7 +47212,7 @@ function createDaemonCommandHandler({
|
|
|
47118
47212
|
diagnostics,
|
|
47119
47213
|
sessions,
|
|
47120
47214
|
nativeSessions,
|
|
47121
|
-
|
|
47215
|
+
eventProjectionV2,
|
|
47122
47216
|
signal
|
|
47123
47217
|
);
|
|
47124
47218
|
return;
|
|
@@ -47132,7 +47226,7 @@ function createDaemonCommandHandler({
|
|
|
47132
47226
|
audit,
|
|
47133
47227
|
diagnostics,
|
|
47134
47228
|
sessions,
|
|
47135
|
-
|
|
47229
|
+
eventProjectionV2,
|
|
47136
47230
|
signal
|
|
47137
47231
|
);
|
|
47138
47232
|
return;
|
|
@@ -47175,9 +47269,11 @@ function createDaemonCommandHandler({
|
|
|
47175
47269
|
const cancellation = message;
|
|
47176
47270
|
const turn2 = activeTurns.get(cancellation.commandId);
|
|
47177
47271
|
if (turn2 === void 0 || !turn2.matches(cancellation)) {
|
|
47178
|
-
void settleAbandonedTurn(
|
|
47179
|
-
|
|
47180
|
-
|
|
47272
|
+
void settleAbandonedTurn(eventProjectionV2, operations, audit, cancellation).catch(
|
|
47273
|
+
(error62) => {
|
|
47274
|
+
console.error("Could not settle abandoned turn", error62);
|
|
47275
|
+
}
|
|
47276
|
+
);
|
|
47181
47277
|
return;
|
|
47182
47278
|
}
|
|
47183
47279
|
const cancellationState = turn2.requestCancellation();
|
|
@@ -47336,10 +47432,10 @@ function createDaemonCommandHandler({
|
|
|
47336
47432
|
return;
|
|
47337
47433
|
}
|
|
47338
47434
|
const turn = activeTurns.start(command, receipt.attemptId);
|
|
47339
|
-
|
|
47435
|
+
eventProjectionV2.requested(command);
|
|
47340
47436
|
void executePrompt({
|
|
47341
47437
|
operations,
|
|
47342
|
-
|
|
47438
|
+
eventProjectionV2,
|
|
47343
47439
|
command,
|
|
47344
47440
|
config: config2,
|
|
47345
47441
|
directories,
|
|
@@ -47363,7 +47459,7 @@ function createDaemonCommandHandler({
|
|
|
47363
47459
|
console.error("Mobius daemon turn failed", error62);
|
|
47364
47460
|
}).finally(() => {
|
|
47365
47461
|
activeTurns.finish(turn);
|
|
47366
|
-
|
|
47462
|
+
eventProjectionV2.publishTerminal(command.sessionId, command.commandId);
|
|
47367
47463
|
if (command.disposition === SessionPromptDisposition.Queue) {
|
|
47368
47464
|
queueChanged(command.sessionId);
|
|
47369
47465
|
}
|
|
@@ -47625,7 +47721,7 @@ async function runRelayConnection({
|
|
|
47625
47721
|
nativeSessions,
|
|
47626
47722
|
operations,
|
|
47627
47723
|
publisher,
|
|
47628
|
-
|
|
47724
|
+
eventProjectionV2,
|
|
47629
47725
|
externalContent,
|
|
47630
47726
|
activeTurns,
|
|
47631
47727
|
connectionEpoch,
|
|
@@ -47647,7 +47743,7 @@ async function runRelayConnection({
|
|
|
47647
47743
|
installations,
|
|
47648
47744
|
nativeSessions,
|
|
47649
47745
|
operations,
|
|
47650
|
-
|
|
47746
|
+
eventProjectionV2,
|
|
47651
47747
|
externalContent,
|
|
47652
47748
|
activeTurns,
|
|
47653
47749
|
diagnostics,
|
|
@@ -47890,7 +47986,7 @@ var SystemDaemonTimer = class {
|
|
|
47890
47986
|
};
|
|
47891
47987
|
var systemDaemonTimer = new SystemDaemonTimer();
|
|
47892
47988
|
|
|
47893
|
-
// src/session-event-
|
|
47989
|
+
// src/session-event-projection-v2.ts
|
|
47894
47990
|
function promptContent(command) {
|
|
47895
47991
|
const content = [];
|
|
47896
47992
|
if (command.prompt.length > 0) {
|
|
@@ -47914,7 +48010,7 @@ function promptContent(command) {
|
|
|
47914
48010
|
}
|
|
47915
48011
|
return content;
|
|
47916
48012
|
}
|
|
47917
|
-
function
|
|
48013
|
+
function projectSessionEventV2(sessionGenerationId, sessionId, position, event, recordedAt) {
|
|
47918
48014
|
return {
|
|
47919
48015
|
eventId: `event-${sessionGenerationId}-${position.toString().padStart(16, "0")}`,
|
|
47920
48016
|
...event,
|
|
@@ -47925,7 +48021,7 @@ function sessionEventV22(sessionGenerationId, sessionId, position, event, record
|
|
|
47925
48021
|
sessionId
|
|
47926
48022
|
};
|
|
47927
48023
|
}
|
|
47928
|
-
var
|
|
48024
|
+
var DaemonSessionEventProjectionV2 = class {
|
|
47929
48025
|
#publisher;
|
|
47930
48026
|
#terminal = /* @__PURE__ */ new Map();
|
|
47931
48027
|
#publications = /* @__PURE__ */ new Map();
|
|
@@ -48009,7 +48105,7 @@ var DaemonSessionEventLogV2 = class {
|
|
|
48009
48105
|
}
|
|
48010
48106
|
this.#queued.delete(commandId);
|
|
48011
48107
|
};
|
|
48012
|
-
event = (sessionId, sessionGenerationId, position, event, recordedAt) =>
|
|
48108
|
+
event = (sessionId, sessionGenerationId, position, event, recordedAt) => projectSessionEventV2(sessionGenerationId, sessionId, position, event, recordedAt);
|
|
48013
48109
|
queueChanged = async (sessionId) => {
|
|
48014
48110
|
await this.#recordLifecycle(sessionId, {
|
|
48015
48111
|
type: "lifecycle-metadata",
|
|
@@ -48138,7 +48234,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48138
48234
|
await using externalContent = new LocalExternalContentStore(stateDirectory);
|
|
48139
48235
|
const operations = new DaemonOperationState();
|
|
48140
48236
|
const publisher = new DaemonSessionEventPublisher(timer);
|
|
48141
|
-
const
|
|
48237
|
+
const eventProjectionV2 = new DaemonSessionEventProjectionV2(
|
|
48142
48238
|
publisher,
|
|
48143
48239
|
(sessionId, event) => agentRuntime.recordLifecycleEventV2(sessionId, event)
|
|
48144
48240
|
);
|
|
@@ -48149,7 +48245,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48149
48245
|
if (event.kind === "session.info.updated") {
|
|
48150
48246
|
publisher.publishInfo(event);
|
|
48151
48247
|
}
|
|
48152
|
-
},
|
|
48248
|
+
}, eventProjectionV2.record),
|
|
48153
48249
|
sessionStore,
|
|
48154
48250
|
{
|
|
48155
48251
|
access: (options2) => options2.agent.id === "codex" ? {
|
|
@@ -48274,7 +48370,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48274
48370
|
nativeSessions,
|
|
48275
48371
|
operations,
|
|
48276
48372
|
publisher,
|
|
48277
|
-
|
|
48373
|
+
eventProjectionV2,
|
|
48278
48374
|
externalContent,
|
|
48279
48375
|
activeTurns,
|
|
48280
48376
|
connectionEpoch,
|