@moxt-ai/mobius 0.0.197 → 0.0.198
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/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 +143 -51
- 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 +143 -51
- 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 +143 -51
- 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.198",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -39077,6 +39077,73 @@ var sessionEventV2 = sqliteTable(
|
|
|
39077
39077
|
// src/acp/session-event-store-v2.ts
|
|
39078
39078
|
var HOT_EVENT_HIGH_WATER_MARK = 256;
|
|
39079
39079
|
var HOT_EVENT_RETENTION = 128;
|
|
39080
|
+
var PositionedSessionEventV2 = class {
|
|
39081
|
+
#event;
|
|
39082
|
+
position;
|
|
39083
|
+
constructor(event, position) {
|
|
39084
|
+
this.#event = event;
|
|
39085
|
+
this.position = position;
|
|
39086
|
+
}
|
|
39087
|
+
get event() {
|
|
39088
|
+
return this.#event;
|
|
39089
|
+
}
|
|
39090
|
+
replaceEvent = (event) => {
|
|
39091
|
+
this.#event = event;
|
|
39092
|
+
};
|
|
39093
|
+
};
|
|
39094
|
+
var SessionEventsV2 = class {
|
|
39095
|
+
hot = [];
|
|
39096
|
+
#toolCallUpdateMap = /* @__PURE__ */ new Map();
|
|
39097
|
+
sessionGenerationId;
|
|
39098
|
+
nextPosition = 1;
|
|
39099
|
+
constructor() {
|
|
39100
|
+
this.sessionGenerationId = randomUUID2();
|
|
39101
|
+
}
|
|
39102
|
+
getToolCallUpdate = (toolCallId) => this.#toolCallUpdateMap.get(toolCallId);
|
|
39103
|
+
updateToolCallUpdate = (toolCallId, item) => {
|
|
39104
|
+
const current = this.#toolCallUpdateMap.get(toolCallId);
|
|
39105
|
+
if (current === void 0 || current.position !== item.position) {
|
|
39106
|
+
return false;
|
|
39107
|
+
}
|
|
39108
|
+
current.replaceEvent(item.event);
|
|
39109
|
+
return true;
|
|
39110
|
+
};
|
|
39111
|
+
append = (item) => {
|
|
39112
|
+
this.hot.push(item);
|
|
39113
|
+
const event = item.event;
|
|
39114
|
+
if (event.type === "acp" && (event.payload.sessionUpdate === "tool_call" || event.payload.sessionUpdate === "tool_call_update")) {
|
|
39115
|
+
this.#toolCallUpdateMap.set(event.payload.toolCallId, item);
|
|
39116
|
+
}
|
|
39117
|
+
};
|
|
39118
|
+
removeHotHead = (count) => {
|
|
39119
|
+
this.hot.splice(0, count);
|
|
39120
|
+
};
|
|
39121
|
+
};
|
|
39122
|
+
function projectAppend(session, event, position) {
|
|
39123
|
+
if (event.type !== "acp" || event.payload.sessionUpdate !== "tool_call_update") {
|
|
39124
|
+
return { item: new PositionedSessionEventV2(event, position), kind: "append" };
|
|
39125
|
+
}
|
|
39126
|
+
const update = event.payload;
|
|
39127
|
+
const previous = session.getToolCallUpdate(update.toolCallId);
|
|
39128
|
+
const previousPayload = previous?.event.type === "acp" ? previous.event.payload : void 0;
|
|
39129
|
+
const previousUpdate = previousPayload?.sessionUpdate === "tool_call" || previousPayload?.sessionUpdate === "tool_call_update" ? previousPayload : void 0;
|
|
39130
|
+
const merged = {
|
|
39131
|
+
...previousUpdate,
|
|
39132
|
+
...update,
|
|
39133
|
+
sessionUpdate: "tool_call_update",
|
|
39134
|
+
toolCallId: update.toolCallId
|
|
39135
|
+
};
|
|
39136
|
+
const item = new PositionedSessionEventV2({ payload: merged, type: "acp" }, position);
|
|
39137
|
+
return previousPayload?.sessionUpdate !== "tool_call_update" || previous === void 0 ? { item, kind: "append" } : {
|
|
39138
|
+
item,
|
|
39139
|
+
kind: "compact-and-append",
|
|
39140
|
+
previous: new PositionedSessionEventV2(compactedToolCallUpdate(update.toolCallId), previous.position),
|
|
39141
|
+
toolCallId: update.toolCallId
|
|
39142
|
+
};
|
|
39143
|
+
}
|
|
39144
|
+
function compactedToolCallUpdate(toolCallId) {
|
|
39145
|
+
return { payload: { sessionUpdate: "tool_call_update", toolCallId }, type: "acp" };
|
|
39146
|
+
}
|
|
39080
39147
|
function eventPage(sessionGenerationId, eventCount, eventLimit, cursor, read) {
|
|
39081
39148
|
const parsedCursor = cursor === null ? eventCount : Number(cursor);
|
|
39082
39149
|
if (!Number.isSafeInteger(parsedCursor) || parsedCursor < 0 || parsedCursor > eventCount) {
|
|
@@ -39104,18 +39171,18 @@ function pageAcpSessionEventsV2(sessionGenerationId, events, eventLimit, cursor)
|
|
|
39104
39171
|
var MemoryAcpSessionEventStoreV2 = class {
|
|
39105
39172
|
#events = /* @__PURE__ */ new Map();
|
|
39106
39173
|
#session = (sessionId) => {
|
|
39107
|
-
const session = this.#events.get(sessionId) ??
|
|
39108
|
-
hot: [],
|
|
39109
|
-
nextPosition: 1,
|
|
39110
|
-
sessionGenerationId: randomUUID2()
|
|
39111
|
-
};
|
|
39174
|
+
const session = this.#events.get(sessionId) ?? new SessionEventsV2();
|
|
39112
39175
|
this.#events.set(sessionId, session);
|
|
39113
39176
|
return session;
|
|
39114
39177
|
};
|
|
39115
39178
|
append = (sessionId, event) => {
|
|
39116
39179
|
const session = this.#session(sessionId);
|
|
39117
39180
|
const position = session.nextPosition;
|
|
39118
|
-
session
|
|
39181
|
+
const projected = projectAppend(session, event, position);
|
|
39182
|
+
if (projected.kind === "compact-and-append") {
|
|
39183
|
+
session.updateToolCallUpdate(projected.toolCallId, projected.previous);
|
|
39184
|
+
}
|
|
39185
|
+
session.append(projected.item);
|
|
39119
39186
|
session.nextPosition += 1;
|
|
39120
39187
|
return { position, sessionGenerationId: session.sessionGenerationId };
|
|
39121
39188
|
};
|
|
@@ -39134,7 +39201,7 @@ var MemoryAcpSessionEventStoreV2 = class {
|
|
|
39134
39201
|
this.#events.delete(sessionId);
|
|
39135
39202
|
};
|
|
39136
39203
|
reset = (sessionId) => {
|
|
39137
|
-
this.#events.set(sessionId,
|
|
39204
|
+
this.#events.set(sessionId, new SessionEventsV2());
|
|
39138
39205
|
};
|
|
39139
39206
|
};
|
|
39140
39207
|
var cachedEventRowSchema = external_exports.object({ eventJson: external_exports.string(), position: external_exports.number().int().positive() });
|
|
@@ -39169,11 +39236,7 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39169
39236
|
}
|
|
39170
39237
|
}
|
|
39171
39238
|
#session = (sessionId) => {
|
|
39172
|
-
const session = this.#sessions.get(sessionId) ??
|
|
39173
|
-
hot: [],
|
|
39174
|
-
nextPosition: 1,
|
|
39175
|
-
sessionGenerationId: randomUUID2()
|
|
39176
|
-
};
|
|
39239
|
+
const session = this.#sessions.get(sessionId) ?? new SessionEventsV2();
|
|
39177
39240
|
this.#sessions.set(sessionId, session);
|
|
39178
39241
|
return session;
|
|
39179
39242
|
};
|
|
@@ -39183,7 +39246,11 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39183
39246
|
}
|
|
39184
39247
|
const session = this.#session(sessionId);
|
|
39185
39248
|
const position = session.nextPosition;
|
|
39186
|
-
session
|
|
39249
|
+
const projected = projectAppend(session, event, position);
|
|
39250
|
+
if (projected.kind === "compact-and-append") {
|
|
39251
|
+
this.#updateToolCallUpdate(sessionId, session, projected.toolCallId, projected.previous);
|
|
39252
|
+
}
|
|
39253
|
+
session.append(projected.item);
|
|
39187
39254
|
session.nextPosition += 1;
|
|
39188
39255
|
this.#sessions.set(sessionId, session);
|
|
39189
39256
|
if (session.hot.length > HOT_EVENT_HIGH_WATER_MARK) {
|
|
@@ -39191,6 +39258,23 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39191
39258
|
}
|
|
39192
39259
|
return { position, sessionGenerationId: session.sessionGenerationId };
|
|
39193
39260
|
};
|
|
39261
|
+
#updateToolCallUpdate = (sessionId, session, toolCallId, item) => {
|
|
39262
|
+
if (!session.updateToolCallUpdate(toolCallId, item) || !this.#isLocalDBAvailable) {
|
|
39263
|
+
return;
|
|
39264
|
+
}
|
|
39265
|
+
try {
|
|
39266
|
+
this.#database.update(sessionEventV2).set({ eventJson: JSON.stringify(item.event) }).where(
|
|
39267
|
+
and(
|
|
39268
|
+
eq(sessionEventV2.generationId, session.sessionGenerationId),
|
|
39269
|
+
eq(sessionEventV2.sessionId, sessionId),
|
|
39270
|
+
eq(sessionEventV2.position, item.position)
|
|
39271
|
+
)
|
|
39272
|
+
).run();
|
|
39273
|
+
} catch (cause) {
|
|
39274
|
+
this.#isLocalDBAvailable = false;
|
|
39275
|
+
console.warn("Mobius V2 Session event cache writes are unavailable; retaining events in memory", cause);
|
|
39276
|
+
}
|
|
39277
|
+
};
|
|
39194
39278
|
#scheduleFlush = () => {
|
|
39195
39279
|
if (!this.#isLocalDBAvailable || this.#flushSchedule.kind !== "idle") {
|
|
39196
39280
|
return;
|
|
@@ -39237,7 +39321,10 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39237
39321
|
}
|
|
39238
39322
|
});
|
|
39239
39323
|
for (const batch of batches) {
|
|
39240
|
-
this.#sessions.get(batch.sessionId)
|
|
39324
|
+
const session = this.#sessions.get(batch.sessionId);
|
|
39325
|
+
if (session !== void 0) {
|
|
39326
|
+
session.removeHotHead(batch.count);
|
|
39327
|
+
}
|
|
39241
39328
|
}
|
|
39242
39329
|
} catch (cause) {
|
|
39243
39330
|
this.#isLocalDBAvailable = false;
|
|
@@ -39258,7 +39345,10 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39258
39345
|
)
|
|
39259
39346
|
).orderBy(asc(sessionEventV2.position)).all().map((value) => {
|
|
39260
39347
|
const row = cachedEventRowSchema.parse(value);
|
|
39261
|
-
return
|
|
39348
|
+
return new PositionedSessionEventV2(
|
|
39349
|
+
decodeCachedEvent(JSON.parse(row.eventJson)),
|
|
39350
|
+
row.position
|
|
39351
|
+
);
|
|
39262
39352
|
});
|
|
39263
39353
|
const hot = (session?.hot ?? []).filter(
|
|
39264
39354
|
({ position }) => position >= startPosition && position <= endPosition
|
|
@@ -39292,7 +39382,7 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
39292
39382
|
reset = (sessionId) => {
|
|
39293
39383
|
const previous = this.#sessions.get(sessionId);
|
|
39294
39384
|
this.#deletePersisted(sessionId, previous?.sessionGenerationId);
|
|
39295
|
-
this.#sessions.set(sessionId,
|
|
39385
|
+
this.#sessions.set(sessionId, new SessionEventsV2());
|
|
39296
39386
|
};
|
|
39297
39387
|
close = () => {
|
|
39298
39388
|
if (this.#flushSchedule.kind === "closed") {
|
|
@@ -43227,7 +43317,7 @@ function send(socket, message) {
|
|
|
43227
43317
|
}
|
|
43228
43318
|
socket.send(encodeDaemonToServiceMessage(message));
|
|
43229
43319
|
}
|
|
43230
|
-
async function settleAbandonedTurn(
|
|
43320
|
+
async function settleAbandonedTurn(projection, operations, audit, cancellation) {
|
|
43231
43321
|
const attemptId = operations.findUnsettledAttemptId(cancellation.commandId, cancellation.sessionId);
|
|
43232
43322
|
if (attemptId === null) {
|
|
43233
43323
|
console.warn("Mobius daemon ignored cancellation for an inactive turn");
|
|
@@ -43238,14 +43328,14 @@ async function settleAbandonedTurn(eventLog, operations, audit, cancellation) {
|
|
|
43238
43328
|
event: "session_abandoned_turn_settled",
|
|
43239
43329
|
sessionId: cancellation.sessionId
|
|
43240
43330
|
});
|
|
43241
|
-
await
|
|
43331
|
+
await projection.failed(
|
|
43242
43332
|
cancellation.sessionId,
|
|
43243
43333
|
cancellation.commandId,
|
|
43244
43334
|
"agent_execution_abandoned",
|
|
43245
43335
|
"The local Agent execution was abandoned before it completed"
|
|
43246
43336
|
);
|
|
43247
43337
|
operations.transitionExecution(cancellation.commandId, "failed");
|
|
43248
|
-
|
|
43338
|
+
projection.publishTerminal(cancellation.sessionId, cancellation.commandId);
|
|
43249
43339
|
}
|
|
43250
43340
|
function operationErrorCode(error62) {
|
|
43251
43341
|
if (error62 instanceof AcpExecutionError || error62 instanceof LocalAuthorizationError || error62 instanceof LocalAgentCatalogError || error62 instanceof PromptArtifactError) {
|
|
@@ -46382,7 +46472,7 @@ function omitAgentReasoning(events) {
|
|
|
46382
46472
|
}
|
|
46383
46473
|
return retained;
|
|
46384
46474
|
}
|
|
46385
|
-
async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoning, queuedPromptRequests, load,
|
|
46475
|
+
async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoning, queuedPromptRequests, load, eventProjectionV2) {
|
|
46386
46476
|
let cursor = initialCursor;
|
|
46387
46477
|
let loaded = [];
|
|
46388
46478
|
let sessionGenerationId = null;
|
|
@@ -46394,7 +46484,7 @@ async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoni
|
|
|
46394
46484
|
}
|
|
46395
46485
|
sessionGenerationId = replay.sessionGenerationId;
|
|
46396
46486
|
const events2 = replay.events.map(
|
|
46397
|
-
(event, index2) =>
|
|
46487
|
+
(event, index2) => eventProjectionV2.event(
|
|
46398
46488
|
sessionId,
|
|
46399
46489
|
replay.sessionGenerationId,
|
|
46400
46490
|
replay.startPosition + index2,
|
|
@@ -46430,7 +46520,7 @@ async function loadHistoryPage(sessionId, eventLimit, initialCursor, omitReasoni
|
|
|
46430
46520
|
queuedPromptRequests
|
|
46431
46521
|
};
|
|
46432
46522
|
}
|
|
46433
|
-
async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions,
|
|
46523
|
+
async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventProjectionV2, signal) {
|
|
46434
46524
|
let agentId;
|
|
46435
46525
|
try {
|
|
46436
46526
|
const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
|
|
@@ -46452,7 +46542,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
46452
46542
|
sessionId: command.sessionId,
|
|
46453
46543
|
signal
|
|
46454
46544
|
};
|
|
46455
|
-
const recovery =
|
|
46545
|
+
const recovery = eventProjectionV2.promptRequestRecovery(command.sessionId);
|
|
46456
46546
|
const events = await loadHistoryPage(
|
|
46457
46547
|
command.sessionId,
|
|
46458
46548
|
command.eventLimit,
|
|
@@ -46460,7 +46550,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
46460
46550
|
command.omit?.includes("agent-reasoning") === true,
|
|
46461
46551
|
recovery.queuedPromptRequests,
|
|
46462
46552
|
async (eventLimit, cursor) => await sessions.loadSessionEventsV2(loadOptions, eventLimit, cursor),
|
|
46463
|
-
|
|
46553
|
+
eventProjectionV2
|
|
46464
46554
|
);
|
|
46465
46555
|
signal.throwIfAborted();
|
|
46466
46556
|
audit.record({
|
|
@@ -46499,7 +46589,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
46499
46589
|
}
|
|
46500
46590
|
}
|
|
46501
46591
|
}
|
|
46502
|
-
async function executeSessionPreviewHistoryPageLoad(socket, command, config2, directories, audit, diagnostics, sessions,
|
|
46592
|
+
async function executeSessionPreviewHistoryPageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventProjectionV2, signal) {
|
|
46503
46593
|
try {
|
|
46504
46594
|
const resolved = await resolveSessionDirectories(
|
|
46505
46595
|
directories,
|
|
@@ -46522,7 +46612,7 @@ async function executeSessionPreviewHistoryPageLoad(socket, command, config2, di
|
|
|
46522
46612
|
command.omit?.includes("agent-reasoning") === true,
|
|
46523
46613
|
[],
|
|
46524
46614
|
async (eventLimit, cursor) => await sessions.previewNativeSessionEventsV2(loadOptions, command.sessionId, eventLimit, cursor),
|
|
46525
|
-
|
|
46615
|
+
eventProjectionV2
|
|
46526
46616
|
);
|
|
46527
46617
|
signal.throwIfAborted();
|
|
46528
46618
|
audit.record({
|
|
@@ -46765,7 +46855,7 @@ function daemonActivity(command, activity2) {
|
|
|
46765
46855
|
}
|
|
46766
46856
|
async function executePrompt({
|
|
46767
46857
|
operations,
|
|
46768
|
-
|
|
46858
|
+
eventProjectionV2,
|
|
46769
46859
|
command,
|
|
46770
46860
|
config: config2,
|
|
46771
46861
|
directories,
|
|
@@ -46845,7 +46935,7 @@ async function executePrompt({
|
|
|
46845
46935
|
}
|
|
46846
46936
|
}
|
|
46847
46937
|
const stream = activateAttempt();
|
|
46848
|
-
const lifecycleV2 =
|
|
46938
|
+
const lifecycleV2 = eventProjectionV2.started(
|
|
46849
46939
|
command.sessionId,
|
|
46850
46940
|
command.commandId,
|
|
46851
46941
|
attemptId,
|
|
@@ -46900,7 +46990,7 @@ async function executePrompt({
|
|
|
46900
46990
|
});
|
|
46901
46991
|
stopReason = result.stopReason;
|
|
46902
46992
|
}
|
|
46903
|
-
await
|
|
46993
|
+
await eventProjectionV2.completed(command.sessionId, command.commandId, stopReason);
|
|
46904
46994
|
operations.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
46905
46995
|
audit.record({
|
|
46906
46996
|
commandId: command.commandId,
|
|
@@ -46909,7 +46999,7 @@ async function executePrompt({
|
|
|
46909
46999
|
});
|
|
46910
47000
|
} catch (error62) {
|
|
46911
47001
|
if (signal.aborted && cancellationRequested()) {
|
|
46912
|
-
await
|
|
47002
|
+
await eventProjectionV2.completed(command.sessionId, command.commandId, "cancelled");
|
|
46913
47003
|
operations.transitionExecution(command.commandId, "cancelled");
|
|
46914
47004
|
audit.record({
|
|
46915
47005
|
commandId: command.commandId,
|
|
@@ -46926,7 +47016,7 @@ async function executePrompt({
|
|
|
46926
47016
|
const code = operationErrorCode(error62);
|
|
46927
47017
|
const failureCode = code === "session_operation_failed" ? "agent_execution_failed" : code;
|
|
46928
47018
|
const failureMessage = code === "session_operation_failed" ? "The local agent could not complete the request" : operationErrorMessage(error62);
|
|
46929
|
-
await
|
|
47019
|
+
await eventProjectionV2.failed(command.sessionId, command.commandId, failureCode, failureMessage);
|
|
46930
47020
|
operations.transitionExecution(command.commandId, "failed");
|
|
46931
47021
|
console.error("Mobius daemon command failed", error62);
|
|
46932
47022
|
}
|
|
@@ -47038,7 +47128,7 @@ function createDaemonCommandHandler({
|
|
|
47038
47128
|
installations,
|
|
47039
47129
|
nativeSessions,
|
|
47040
47130
|
operations,
|
|
47041
|
-
|
|
47131
|
+
eventProjectionV2,
|
|
47042
47132
|
externalContent,
|
|
47043
47133
|
activeTurns,
|
|
47044
47134
|
diagnostics,
|
|
@@ -47058,7 +47148,7 @@ function createDaemonCommandHandler({
|
|
|
47058
47148
|
timer
|
|
47059
47149
|
});
|
|
47060
47150
|
const queueChanged = (sessionId) => {
|
|
47061
|
-
void
|
|
47151
|
+
void eventProjectionV2.queueChanged(sessionId).catch((error62) => {
|
|
47062
47152
|
console.error("Could not record queue change", error62);
|
|
47063
47153
|
});
|
|
47064
47154
|
};
|
|
@@ -47118,7 +47208,7 @@ function createDaemonCommandHandler({
|
|
|
47118
47208
|
diagnostics,
|
|
47119
47209
|
sessions,
|
|
47120
47210
|
nativeSessions,
|
|
47121
|
-
|
|
47211
|
+
eventProjectionV2,
|
|
47122
47212
|
signal
|
|
47123
47213
|
);
|
|
47124
47214
|
return;
|
|
@@ -47132,7 +47222,7 @@ function createDaemonCommandHandler({
|
|
|
47132
47222
|
audit,
|
|
47133
47223
|
diagnostics,
|
|
47134
47224
|
sessions,
|
|
47135
|
-
|
|
47225
|
+
eventProjectionV2,
|
|
47136
47226
|
signal
|
|
47137
47227
|
);
|
|
47138
47228
|
return;
|
|
@@ -47175,9 +47265,11 @@ function createDaemonCommandHandler({
|
|
|
47175
47265
|
const cancellation = message;
|
|
47176
47266
|
const turn2 = activeTurns.get(cancellation.commandId);
|
|
47177
47267
|
if (turn2 === void 0 || !turn2.matches(cancellation)) {
|
|
47178
|
-
void settleAbandonedTurn(
|
|
47179
|
-
|
|
47180
|
-
|
|
47268
|
+
void settleAbandonedTurn(eventProjectionV2, operations, audit, cancellation).catch(
|
|
47269
|
+
(error62) => {
|
|
47270
|
+
console.error("Could not settle abandoned turn", error62);
|
|
47271
|
+
}
|
|
47272
|
+
);
|
|
47181
47273
|
return;
|
|
47182
47274
|
}
|
|
47183
47275
|
const cancellationState = turn2.requestCancellation();
|
|
@@ -47336,10 +47428,10 @@ function createDaemonCommandHandler({
|
|
|
47336
47428
|
return;
|
|
47337
47429
|
}
|
|
47338
47430
|
const turn = activeTurns.start(command, receipt.attemptId);
|
|
47339
|
-
|
|
47431
|
+
eventProjectionV2.requested(command);
|
|
47340
47432
|
void executePrompt({
|
|
47341
47433
|
operations,
|
|
47342
|
-
|
|
47434
|
+
eventProjectionV2,
|
|
47343
47435
|
command,
|
|
47344
47436
|
config: config2,
|
|
47345
47437
|
directories,
|
|
@@ -47363,7 +47455,7 @@ function createDaemonCommandHandler({
|
|
|
47363
47455
|
console.error("Mobius daemon turn failed", error62);
|
|
47364
47456
|
}).finally(() => {
|
|
47365
47457
|
activeTurns.finish(turn);
|
|
47366
|
-
|
|
47458
|
+
eventProjectionV2.publishTerminal(command.sessionId, command.commandId);
|
|
47367
47459
|
if (command.disposition === SessionPromptDisposition.Queue) {
|
|
47368
47460
|
queueChanged(command.sessionId);
|
|
47369
47461
|
}
|
|
@@ -47625,7 +47717,7 @@ async function runRelayConnection({
|
|
|
47625
47717
|
nativeSessions,
|
|
47626
47718
|
operations,
|
|
47627
47719
|
publisher,
|
|
47628
|
-
|
|
47720
|
+
eventProjectionV2,
|
|
47629
47721
|
externalContent,
|
|
47630
47722
|
activeTurns,
|
|
47631
47723
|
connectionEpoch,
|
|
@@ -47647,7 +47739,7 @@ async function runRelayConnection({
|
|
|
47647
47739
|
installations,
|
|
47648
47740
|
nativeSessions,
|
|
47649
47741
|
operations,
|
|
47650
|
-
|
|
47742
|
+
eventProjectionV2,
|
|
47651
47743
|
externalContent,
|
|
47652
47744
|
activeTurns,
|
|
47653
47745
|
diagnostics,
|
|
@@ -47890,7 +47982,7 @@ var SystemDaemonTimer = class {
|
|
|
47890
47982
|
};
|
|
47891
47983
|
var systemDaemonTimer = new SystemDaemonTimer();
|
|
47892
47984
|
|
|
47893
|
-
// src/session-event-
|
|
47985
|
+
// src/session-event-projection-v2.ts
|
|
47894
47986
|
function promptContent(command) {
|
|
47895
47987
|
const content = [];
|
|
47896
47988
|
if (command.prompt.length > 0) {
|
|
@@ -47914,7 +48006,7 @@ function promptContent(command) {
|
|
|
47914
48006
|
}
|
|
47915
48007
|
return content;
|
|
47916
48008
|
}
|
|
47917
|
-
function
|
|
48009
|
+
function projectSessionEventV2(sessionGenerationId, sessionId, position, event, recordedAt) {
|
|
47918
48010
|
return {
|
|
47919
48011
|
eventId: `event-${sessionGenerationId}-${position.toString().padStart(16, "0")}`,
|
|
47920
48012
|
...event,
|
|
@@ -47925,7 +48017,7 @@ function sessionEventV22(sessionGenerationId, sessionId, position, event, record
|
|
|
47925
48017
|
sessionId
|
|
47926
48018
|
};
|
|
47927
48019
|
}
|
|
47928
|
-
var
|
|
48020
|
+
var DaemonSessionEventProjectionV2 = class {
|
|
47929
48021
|
#publisher;
|
|
47930
48022
|
#terminal = /* @__PURE__ */ new Map();
|
|
47931
48023
|
#publications = /* @__PURE__ */ new Map();
|
|
@@ -48009,7 +48101,7 @@ var DaemonSessionEventLogV2 = class {
|
|
|
48009
48101
|
}
|
|
48010
48102
|
this.#queued.delete(commandId);
|
|
48011
48103
|
};
|
|
48012
|
-
event = (sessionId, sessionGenerationId, position, event, recordedAt) =>
|
|
48104
|
+
event = (sessionId, sessionGenerationId, position, event, recordedAt) => projectSessionEventV2(sessionGenerationId, sessionId, position, event, recordedAt);
|
|
48013
48105
|
queueChanged = async (sessionId) => {
|
|
48014
48106
|
await this.#recordLifecycle(sessionId, {
|
|
48015
48107
|
type: "lifecycle-metadata",
|
|
@@ -48138,7 +48230,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48138
48230
|
await using externalContent = new LocalExternalContentStore(stateDirectory);
|
|
48139
48231
|
const operations = new DaemonOperationState();
|
|
48140
48232
|
const publisher = new DaemonSessionEventPublisher(timer);
|
|
48141
|
-
const
|
|
48233
|
+
const eventProjectionV2 = new DaemonSessionEventProjectionV2(
|
|
48142
48234
|
publisher,
|
|
48143
48235
|
(sessionId, event) => agentRuntime.recordLifecycleEventV2(sessionId, event)
|
|
48144
48236
|
);
|
|
@@ -48149,7 +48241,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48149
48241
|
if (event.kind === "session.info.updated") {
|
|
48150
48242
|
publisher.publishInfo(event);
|
|
48151
48243
|
}
|
|
48152
|
-
},
|
|
48244
|
+
}, eventProjectionV2.record),
|
|
48153
48245
|
sessionStore,
|
|
48154
48246
|
{
|
|
48155
48247
|
access: (options2) => options2.agent.id === "codex" ? {
|
|
@@ -48274,7 +48366,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
48274
48366
|
nativeSessions,
|
|
48275
48367
|
operations,
|
|
48276
48368
|
publisher,
|
|
48277
|
-
|
|
48369
|
+
eventProjectionV2,
|
|
48278
48370
|
externalContent,
|
|
48279
48371
|
activeTurns,
|
|
48280
48372
|
connectionEpoch,
|