@moxt-ai/mobius 0.0.179 → 0.0.180
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-contracts.d.ts +4 -2
- package/dist/acp/session-contracts.d.ts.map +1 -1
- package/dist/acp/session-contracts.js.map +1 -1
- package/dist/acp/session-event-store-v2.d.ts +9 -8
- package/dist/acp/session-event-store-v2.d.ts.map +1 -1
- package/dist/acp/session-event-store-v2.js +59 -25
- package/dist/acp/session-event-store-v2.js.map +1 -1
- package/dist/acp/session-history.d.ts +3 -3
- package/dist/acp/session-history.d.ts.map +1 -1
- package/dist/acp/session-history.js +2 -1
- package/dist/acp/session-history.js.map +1 -1
- package/dist/acp/session-store.d.ts.map +1 -1
- package/dist/acp/session-store.js +2 -3
- package/dist/acp/session-store.js.map +1 -1
- package/dist/cli.js +98 -55
- package/dist/cli.js.map +4 -4
- package/dist/daemon-history-commands.d.ts.map +1 -1
- package/dist/daemon-history-commands.js +2 -2
- package/dist/daemon-history-commands.js.map +1 -1
- package/dist/daemon-observers.d.ts +3 -2
- package/dist/daemon-observers.d.ts.map +1 -1
- package/dist/daemon-observers.js.map +1 -1
- package/dist/index.js +95 -52
- package/dist/index.js.map +4 -4
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +2 -3
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +100 -57
- package/dist/runtime.js.map +4 -4
- package/dist/session-event-log-v2.d.ts +5 -5
- package/dist/session-event-log-v2.d.ts.map +1 -1
- package/dist/session-event-log-v2.js +6 -9
- package/dist/session-event-log-v2.js.map +1 -1
- 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.180",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -29943,6 +29943,7 @@ var sessionEventFieldsV2 = {
|
|
|
29943
29943
|
position: positionSchema,
|
|
29944
29944
|
provenance: provenanceSchema,
|
|
29945
29945
|
recordedAt: external_exports.iso.datetime({ offset: true }),
|
|
29946
|
+
sessionGenerationId: identifierStringSchema,
|
|
29946
29947
|
sessionId: identifierStringSchema
|
|
29947
29948
|
};
|
|
29948
29949
|
var sessionEventV2Schema = external_exports.discriminatedUnion("type", [
|
|
@@ -29998,9 +29999,9 @@ var mobiusSessionExportV2Schema = external_exports.object({
|
|
|
29998
29999
|
}).readonly();
|
|
29999
30000
|
var sessionEventEnvelopeV2Schema = external_exports.object({ events: sessionEventBatchV2Schema, kind: external_exports.literal(SESSION_EVENT_V2_KIND) }).readonly();
|
|
30000
30001
|
var sessionEventLogPageV2Schema = external_exports.object({
|
|
30001
|
-
daemonGenerationId: identifierStringSchema,
|
|
30002
30002
|
events: external_exports.array(sessionEventV2Schema).max(MAX_EVENT_COUNT).readonly(),
|
|
30003
30003
|
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
30004
|
+
sessionGenerationId: identifierStringSchema,
|
|
30004
30005
|
tailCursor: external_exports.string().max(512),
|
|
30005
30006
|
truncated: external_exports.boolean(),
|
|
30006
30007
|
version: external_exports.literal(2)
|
|
@@ -30359,7 +30360,7 @@ function createDaemonConfig(connection, agents = [], installableAgents = [], loc
|
|
|
30359
30360
|
|
|
30360
30361
|
// src/daemon-manager.ts
|
|
30361
30362
|
import { spawn as spawn6 } from "node:child_process";
|
|
30362
|
-
import { createHash as
|
|
30363
|
+
import { createHash as createHash8, randomBytes } from "node:crypto";
|
|
30363
30364
|
import { readFile as readFile3, unlink as unlink2, writeFile as writeFile5 } from "node:fs/promises";
|
|
30364
30365
|
import { createConnection, createServer } from "node:net";
|
|
30365
30366
|
import { tmpdir } from "node:os";
|
|
@@ -31193,7 +31194,7 @@ var AuditStore = class {
|
|
|
31193
31194
|
};
|
|
31194
31195
|
|
|
31195
31196
|
// src/run-daemon.ts
|
|
31196
|
-
import { createHash as
|
|
31197
|
+
import { createHash as createHash7, randomUUID as randomUUID9 } from "node:crypto";
|
|
31197
31198
|
import { join as join19 } from "node:path";
|
|
31198
31199
|
import { styleText } from "node:util";
|
|
31199
31200
|
|
|
@@ -32839,7 +32840,8 @@ var AcpHistoryReplay = class {
|
|
|
32839
32840
|
record = async (update, rawUpdate, onRecorded = () => Promise.resolve()) => {
|
|
32840
32841
|
const position = this.#events.append(this.#sessionId, { payload: rawUpdate, type: "acp" });
|
|
32841
32842
|
await onRecorded(position);
|
|
32842
|
-
|
|
32843
|
+
await this.#applyUpdate(update, position.position);
|
|
32844
|
+
return position.position;
|
|
32843
32845
|
};
|
|
32844
32846
|
#applyUpdate = async (update, position) => {
|
|
32845
32847
|
if (update.sessionUpdate === "agent_thought_chunk") {
|
|
@@ -33578,9 +33580,6 @@ var AcpSessionInteractions = class {
|
|
|
33578
33580
|
};
|
|
33579
33581
|
};
|
|
33580
33582
|
|
|
33581
|
-
// src/acp/session-store.ts
|
|
33582
|
-
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
33583
|
-
|
|
33584
33583
|
// ../../node_modules/.pnpm/drizzle-orm@1.0.0-rc.4_@cloudflare+workers-types@5.20260918.1_@types+better-sqlite3@7.6_f872c171b7e1945bb1fa42180063dab2/node_modules/drizzle-orm/entity.js
|
|
33585
33584
|
var entityKind = /* @__PURE__ */ Symbol.for("drizzle:entityKind");
|
|
33586
33585
|
function is(value, type) {
|
|
@@ -38352,6 +38351,9 @@ var acpSession = sqliteTable("acp_session", {
|
|
|
38352
38351
|
updatedAt: text("updated_at").notNull()
|
|
38353
38352
|
});
|
|
38354
38353
|
|
|
38354
|
+
// src/acp/session-event-store-v2.ts
|
|
38355
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
38356
|
+
|
|
38355
38357
|
// src/schema/session-event-cache/session-event-v2.ts
|
|
38356
38358
|
var sessionEventV2 = sqliteTable(
|
|
38357
38359
|
"session_event_v2",
|
|
@@ -38374,7 +38376,7 @@ var sessionEventV2 = sqliteTable(
|
|
|
38374
38376
|
// src/acp/session-event-store-v2.ts
|
|
38375
38377
|
var HOT_EVENT_HIGH_WATER_MARK = 256;
|
|
38376
38378
|
var HOT_EVENT_RETENTION = 128;
|
|
38377
|
-
function eventPage(eventCount, eventLimit, cursor, read) {
|
|
38379
|
+
function eventPage(sessionGenerationId, eventCount, eventLimit, cursor, read) {
|
|
38378
38380
|
const parsedCursor = cursor === null ? eventCount : Number(cursor);
|
|
38379
38381
|
if (!Number.isSafeInteger(parsedCursor) || parsedCursor < 0 || parsedCursor > eventCount) {
|
|
38380
38382
|
throw new Error("The native event cursor is invalid");
|
|
@@ -38384,36 +38386,46 @@ function eventPage(eventCount, eventLimit, cursor, read) {
|
|
|
38384
38386
|
return {
|
|
38385
38387
|
events: read(startPosition + 1, endPosition),
|
|
38386
38388
|
nextCursor: startPosition === 0 ? null : startPosition.toString(),
|
|
38389
|
+
sessionGenerationId,
|
|
38387
38390
|
startPosition: startPosition + 1,
|
|
38388
38391
|
truncated: startPosition > 0
|
|
38389
38392
|
};
|
|
38390
38393
|
}
|
|
38391
38394
|
var MemoryAcpSessionEventStoreV2 = class {
|
|
38392
|
-
generationId;
|
|
38393
38395
|
#events = /* @__PURE__ */ new Map();
|
|
38394
|
-
|
|
38395
|
-
this.
|
|
38396
|
-
|
|
38396
|
+
#session = (sessionId) => {
|
|
38397
|
+
const session = this.#events.get(sessionId) ?? {
|
|
38398
|
+
hot: [],
|
|
38399
|
+
nextPosition: 1,
|
|
38400
|
+
sessionGenerationId: randomUUID2()
|
|
38401
|
+
};
|
|
38402
|
+
this.#events.set(sessionId, session);
|
|
38403
|
+
return session;
|
|
38404
|
+
};
|
|
38397
38405
|
append = (sessionId, event) => {
|
|
38398
|
-
const
|
|
38399
|
-
|
|
38400
|
-
|
|
38401
|
-
|
|
38406
|
+
const session = this.#session(sessionId);
|
|
38407
|
+
const position = session.nextPosition;
|
|
38408
|
+
session.hot.push({ event, position });
|
|
38409
|
+
session.nextPosition += 1;
|
|
38410
|
+
return { position, sessionGenerationId: session.sessionGenerationId };
|
|
38402
38411
|
};
|
|
38403
38412
|
close = () => this.#events.clear();
|
|
38404
38413
|
page = (sessionId, eventLimit, cursor) => {
|
|
38405
|
-
const
|
|
38414
|
+
const session = this.#session(sessionId);
|
|
38406
38415
|
return eventPage(
|
|
38407
|
-
|
|
38416
|
+
session.sessionGenerationId,
|
|
38417
|
+
session.nextPosition - 1,
|
|
38408
38418
|
eventLimit,
|
|
38409
38419
|
cursor,
|
|
38410
|
-
(
|
|
38420
|
+
(start, end) => session.hot.filter(({ position }) => position >= start && position <= end).map(({ event }) => event)
|
|
38411
38421
|
);
|
|
38412
38422
|
};
|
|
38413
38423
|
remove = (sessionId) => {
|
|
38414
38424
|
this.#events.delete(sessionId);
|
|
38415
38425
|
};
|
|
38416
|
-
reset =
|
|
38426
|
+
reset = (sessionId) => {
|
|
38427
|
+
this.#events.set(sessionId, { hot: [], nextPosition: 1, sessionGenerationId: randomUUID2() });
|
|
38428
|
+
};
|
|
38417
38429
|
};
|
|
38418
38430
|
var cachedEventRowSchema = external_exports.object({ eventJson: external_exports.string(), position: external_exports.number().int().positive() });
|
|
38419
38431
|
function decodeCachedEvent(value) {
|
|
@@ -38424,20 +38436,19 @@ function decodeCachedEvent(value) {
|
|
|
38424
38436
|
position: "1",
|
|
38425
38437
|
provenance: { kind: "original" },
|
|
38426
38438
|
recordedAt: "1970-01-01T00:00:00.000Z",
|
|
38439
|
+
sessionGenerationId: "cached-generation",
|
|
38427
38440
|
sessionId: "cached-session"
|
|
38428
38441
|
});
|
|
38429
38442
|
return event.type === "acp" ? { payload: event.payload, type: event.type } : { payload: event.payload, type: event.type };
|
|
38430
38443
|
}
|
|
38431
38444
|
var CachedAcpSessionEventStoreV2 = class {
|
|
38432
|
-
generationId;
|
|
38433
38445
|
#database;
|
|
38434
38446
|
#ignoredPersistedSessions = /* @__PURE__ */ new Set();
|
|
38435
38447
|
#localDatabase;
|
|
38436
38448
|
#sessions = /* @__PURE__ */ new Map();
|
|
38437
38449
|
#flushSchedule = { kind: "idle" };
|
|
38438
38450
|
#isLocalDBAvailable = true;
|
|
38439
|
-
constructor(localDatabase
|
|
38440
|
-
this.generationId = generationId;
|
|
38451
|
+
constructor(localDatabase) {
|
|
38441
38452
|
this.#localDatabase = localDatabase;
|
|
38442
38453
|
this.#database = localDatabase.orm;
|
|
38443
38454
|
try {
|
|
@@ -38447,11 +38458,20 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
38447
38458
|
throw error62;
|
|
38448
38459
|
}
|
|
38449
38460
|
}
|
|
38461
|
+
#session = (sessionId) => {
|
|
38462
|
+
const session = this.#sessions.get(sessionId) ?? {
|
|
38463
|
+
hot: [],
|
|
38464
|
+
nextPosition: 1,
|
|
38465
|
+
sessionGenerationId: randomUUID2()
|
|
38466
|
+
};
|
|
38467
|
+
this.#sessions.set(sessionId, session);
|
|
38468
|
+
return session;
|
|
38469
|
+
};
|
|
38450
38470
|
append = (sessionId, event) => {
|
|
38451
38471
|
if (this.#flushSchedule.kind === "closed") {
|
|
38452
38472
|
throw new Error("The V2 Session event store is closed");
|
|
38453
38473
|
}
|
|
38454
|
-
const session = this.#
|
|
38474
|
+
const session = this.#session(sessionId);
|
|
38455
38475
|
const position = session.nextPosition;
|
|
38456
38476
|
session.hot.push({ event, position });
|
|
38457
38477
|
session.nextPosition += 1;
|
|
@@ -38459,7 +38479,7 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
38459
38479
|
if (session.hot.length > HOT_EVENT_HIGH_WATER_MARK) {
|
|
38460
38480
|
this.#scheduleFlush();
|
|
38461
38481
|
}
|
|
38462
|
-
return position;
|
|
38482
|
+
return { position, sessionGenerationId: session.sessionGenerationId };
|
|
38463
38483
|
};
|
|
38464
38484
|
#scheduleFlush = () => {
|
|
38465
38485
|
if (!this.#isLocalDBAvailable || this.#flushSchedule.kind !== "idle") {
|
|
@@ -38480,12 +38500,19 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
38480
38500
|
}
|
|
38481
38501
|
const batches = [...this.#sessions.entries()].flatMap(([sessionId, session]) => {
|
|
38482
38502
|
const count = includeHotTail ? session.hot.length : Math.max(0, session.hot.length - HOT_EVENT_RETENTION);
|
|
38483
|
-
return count === 0 ? [] : [
|
|
38503
|
+
return count === 0 ? [] : [
|
|
38504
|
+
{
|
|
38505
|
+
count,
|
|
38506
|
+
events: session.hot.slice(0, count),
|
|
38507
|
+
sessionGenerationId: session.sessionGenerationId,
|
|
38508
|
+
sessionId
|
|
38509
|
+
}
|
|
38510
|
+
];
|
|
38484
38511
|
});
|
|
38485
38512
|
const values = batches.flatMap(
|
|
38486
38513
|
(batch) => batch.events.map(({ event, position }) => ({
|
|
38487
38514
|
eventJson: JSON.stringify(event),
|
|
38488
|
-
generationId:
|
|
38515
|
+
generationId: batch.sessionGenerationId,
|
|
38489
38516
|
position,
|
|
38490
38517
|
sessionId: batch.sessionId
|
|
38491
38518
|
}))
|
|
@@ -38509,11 +38536,12 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
38509
38536
|
};
|
|
38510
38537
|
page = (sessionId, eventLimit, cursor) => {
|
|
38511
38538
|
const session = this.#sessions.get(sessionId);
|
|
38512
|
-
const
|
|
38513
|
-
|
|
38539
|
+
const current = session ?? this.#session(sessionId);
|
|
38540
|
+
const eventCount = current.nextPosition - 1;
|
|
38541
|
+
return eventPage(current.sessionGenerationId, eventCount, eventLimit, cursor, (startPosition, endPosition) => {
|
|
38514
38542
|
const persisted = this.#ignoredPersistedSessions.has(sessionId) ? [] : this.#database.select({ eventJson: sessionEventV2.eventJson, position: sessionEventV2.position }).from(sessionEventV2).where(
|
|
38515
38543
|
and(
|
|
38516
|
-
eq(sessionEventV2.generationId,
|
|
38544
|
+
eq(sessionEventV2.generationId, current.sessionGenerationId),
|
|
38517
38545
|
eq(sessionEventV2.sessionId, sessionId),
|
|
38518
38546
|
gte(sessionEventV2.position, startPosition),
|
|
38519
38547
|
lte(sessionEventV2.position, endPosition)
|
|
@@ -38528,13 +38556,18 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
38528
38556
|
return [...persisted, ...hot].toSorted((left, right) => left.position - right.position).map(({ event }) => event);
|
|
38529
38557
|
});
|
|
38530
38558
|
};
|
|
38531
|
-
#deletePersisted = (sessionId) => {
|
|
38559
|
+
#deletePersisted = (sessionId, sessionGenerationId) => {
|
|
38532
38560
|
if (!this.#isLocalDBAvailable) {
|
|
38533
38561
|
this.#ignoredPersistedSessions.add(sessionId);
|
|
38534
38562
|
return;
|
|
38535
38563
|
}
|
|
38536
38564
|
try {
|
|
38537
|
-
this.#database.delete(sessionEventV2).where(
|
|
38565
|
+
this.#database.delete(sessionEventV2).where(
|
|
38566
|
+
sessionGenerationId === void 0 ? eq(sessionEventV2.sessionId, sessionId) : and(
|
|
38567
|
+
eq(sessionEventV2.generationId, sessionGenerationId),
|
|
38568
|
+
eq(sessionEventV2.sessionId, sessionId)
|
|
38569
|
+
)
|
|
38570
|
+
).run();
|
|
38538
38571
|
this.#ignoredPersistedSessions.delete(sessionId);
|
|
38539
38572
|
} catch (cause) {
|
|
38540
38573
|
this.#isLocalDBAvailable = false;
|
|
@@ -38546,7 +38579,11 @@ var CachedAcpSessionEventStoreV2 = class {
|
|
|
38546
38579
|
this.#deletePersisted(sessionId);
|
|
38547
38580
|
this.#sessions.delete(sessionId);
|
|
38548
38581
|
};
|
|
38549
|
-
reset =
|
|
38582
|
+
reset = (sessionId) => {
|
|
38583
|
+
const previous = this.#sessions.get(sessionId);
|
|
38584
|
+
this.#deletePersisted(sessionId, previous?.sessionGenerationId);
|
|
38585
|
+
this.#sessions.set(sessionId, { hot: [], nextPosition: 1, sessionGenerationId: randomUUID2() });
|
|
38586
|
+
};
|
|
38550
38587
|
close = () => {
|
|
38551
38588
|
if (this.#flushSchedule.kind === "closed") {
|
|
38552
38589
|
return;
|
|
@@ -38599,7 +38636,7 @@ var FoundAcpStoredSession = class extends AcpStoredSessionLookup {
|
|
|
38599
38636
|
var MemoryAcpSessionStore = class {
|
|
38600
38637
|
eventsV2;
|
|
38601
38638
|
#sessions = /* @__PURE__ */ new Map();
|
|
38602
|
-
constructor(eventsV2 = new MemoryAcpSessionEventStoreV2(
|
|
38639
|
+
constructor(eventsV2 = new MemoryAcpSessionEventStoreV2()) {
|
|
38603
38640
|
this.eventsV2 = eventsV2;
|
|
38604
38641
|
}
|
|
38605
38642
|
close = () => {
|
|
@@ -38651,7 +38688,7 @@ var SqliteAcpSessionStore = class {
|
|
|
38651
38688
|
eventsV2;
|
|
38652
38689
|
#database;
|
|
38653
38690
|
#localDatabase;
|
|
38654
|
-
constructor(localDatabase, eventsV2 = new MemoryAcpSessionEventStoreV2(
|
|
38691
|
+
constructor(localDatabase, eventsV2 = new MemoryAcpSessionEventStoreV2()) {
|
|
38655
38692
|
this.eventsV2 = eventsV2;
|
|
38656
38693
|
this.#localDatabase = localDatabase;
|
|
38657
38694
|
this.#database = localDatabase.orm;
|
|
@@ -45156,7 +45193,13 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
45156
45193
|
const replay = await sessions.loadSessionEventsV2(loadOptions, command.eventLimit, command.cursor);
|
|
45157
45194
|
signal.throwIfAborted();
|
|
45158
45195
|
const events = replay.events.map(
|
|
45159
|
-
(event, index2) => eventLogV2.event(
|
|
45196
|
+
(event, index2) => eventLogV2.event(
|
|
45197
|
+
command.sessionId,
|
|
45198
|
+
replay.sessionGenerationId,
|
|
45199
|
+
replay.startPosition + index2,
|
|
45200
|
+
event,
|
|
45201
|
+
"1970-01-01T00:00:00.000Z"
|
|
45202
|
+
)
|
|
45160
45203
|
);
|
|
45161
45204
|
const tailCursor = events.at(-1)?.eventId ?? "";
|
|
45162
45205
|
audit.record({
|
|
@@ -45167,9 +45210,9 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
45167
45210
|
send(socket, {
|
|
45168
45211
|
events: {
|
|
45169
45212
|
events: {
|
|
45170
|
-
daemonGenerationId: eventLogV2.daemonGenerationId,
|
|
45171
45213
|
events,
|
|
45172
45214
|
nextCursor: replay.nextCursor,
|
|
45215
|
+
sessionGenerationId: replay.sessionGenerationId,
|
|
45173
45216
|
tailCursor,
|
|
45174
45217
|
truncated: replay.truncated,
|
|
45175
45218
|
version: 2
|
|
@@ -46628,7 +46671,6 @@ var SystemDaemonTimer = class {
|
|
|
46628
46671
|
var systemDaemonTimer = new SystemDaemonTimer();
|
|
46629
46672
|
|
|
46630
46673
|
// src/session-event-log-v2.ts
|
|
46631
|
-
import { createHash as createHash7, randomUUID as randomUUID9 } from "node:crypto";
|
|
46632
46674
|
function promptContent(command) {
|
|
46633
46675
|
const content = [];
|
|
46634
46676
|
if (command.prompt.length > 0) {
|
|
@@ -46652,28 +46694,26 @@ function promptContent(command) {
|
|
|
46652
46694
|
}
|
|
46653
46695
|
return content;
|
|
46654
46696
|
}
|
|
46655
|
-
function sessionEventV22(
|
|
46656
|
-
const sessionPrefix = createHash7("sha256").update(sessionId).digest("hex").slice(0, 16);
|
|
46697
|
+
function sessionEventV22(sessionGenerationId, sessionId, position, event, recordedAt) {
|
|
46657
46698
|
return {
|
|
46658
|
-
eventId: `event-${
|
|
46699
|
+
eventId: `event-${sessionGenerationId}-${position.toString().padStart(16, "0")}`,
|
|
46659
46700
|
...event,
|
|
46660
46701
|
position: position.toString(),
|
|
46661
46702
|
provenance: { kind: "original" },
|
|
46662
46703
|
recordedAt,
|
|
46704
|
+
sessionGenerationId,
|
|
46663
46705
|
sessionId
|
|
46664
46706
|
};
|
|
46665
46707
|
}
|
|
46666
46708
|
var DaemonSessionEventLogV2 = class {
|
|
46667
|
-
daemonGenerationId;
|
|
46668
46709
|
#publisher;
|
|
46669
46710
|
#terminal = /* @__PURE__ */ new Map();
|
|
46670
46711
|
#publications = /* @__PURE__ */ new Map();
|
|
46671
46712
|
#queued = /* @__PURE__ */ new Map();
|
|
46672
46713
|
#recordLifecycle;
|
|
46673
|
-
constructor(publisher, recordLifecycle
|
|
46714
|
+
constructor(publisher, recordLifecycle) {
|
|
46674
46715
|
this.#recordLifecycle = recordLifecycle;
|
|
46675
46716
|
this.#publisher = publisher;
|
|
46676
|
-
this.daemonGenerationId = daemonGenerationId;
|
|
46677
46717
|
}
|
|
46678
46718
|
requested = (command) => {
|
|
46679
46719
|
this.#queued.set(command.commandId, {
|
|
@@ -46697,7 +46737,13 @@ var DaemonSessionEventLogV2 = class {
|
|
|
46697
46737
|
throw new Error("The executing prompt was not registered in the V2 queue");
|
|
46698
46738
|
};
|
|
46699
46739
|
record = (sessionId, event, position) => {
|
|
46700
|
-
const recorded = this.event(
|
|
46740
|
+
const recorded = this.event(
|
|
46741
|
+
sessionId,
|
|
46742
|
+
position.sessionGenerationId,
|
|
46743
|
+
position.position,
|
|
46744
|
+
event,
|
|
46745
|
+
(/* @__PURE__ */ new Date()).toISOString()
|
|
46746
|
+
);
|
|
46701
46747
|
if (event.type === "lifecycle-metadata" && (event.payload.kind === "prompt.completed" || event.payload.kind === "prompt.failed" || event.payload.kind === "prompt.failed-before-start")) {
|
|
46702
46748
|
this.#terminal.set(event.payload.commandId, recorded);
|
|
46703
46749
|
const pending2 = this.#publications.get(sessionId) ?? [];
|
|
@@ -46734,7 +46780,7 @@ var DaemonSessionEventLogV2 = class {
|
|
|
46734
46780
|
}
|
|
46735
46781
|
this.#queued.delete(commandId);
|
|
46736
46782
|
};
|
|
46737
|
-
event = (sessionId, position, event, recordedAt) => sessionEventV22(
|
|
46783
|
+
event = (sessionId, sessionGenerationId, position, event, recordedAt) => sessionEventV22(sessionGenerationId, sessionId, position, event, recordedAt);
|
|
46738
46784
|
queueChanged = async (sessionId) => {
|
|
46739
46785
|
await this.#recordLifecycle(sessionId, {
|
|
46740
46786
|
type: "lifecycle-metadata",
|
|
@@ -46825,7 +46871,7 @@ async function installDetectedAgentIntegrations(config2, installations, signal)
|
|
|
46825
46871
|
{
|
|
46826
46872
|
agentId: agent.id,
|
|
46827
46873
|
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
46828
|
-
requestId: `automatic-integration-${
|
|
46874
|
+
requestId: `automatic-integration-${randomUUID9()}`
|
|
46829
46875
|
},
|
|
46830
46876
|
signal
|
|
46831
46877
|
);
|
|
@@ -46843,14 +46889,12 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
46843
46889
|
publishCatalog: async (installationSignal) => await publishAgentCatalog(config2, installationSignal),
|
|
46844
46890
|
stateDirectory
|
|
46845
46891
|
});
|
|
46846
|
-
const channelHash =
|
|
46847
|
-
const daemonGenerationId = randomUUID10();
|
|
46892
|
+
const channelHash = createHash7("sha256").update(config2.channelId).digest("hex");
|
|
46848
46893
|
const sessionDatabase = openAcpSessionDatabase(join19(stateDirectory, "sessions", `${channelHash}.sqlite`));
|
|
46849
46894
|
let eventsV2;
|
|
46850
46895
|
try {
|
|
46851
46896
|
eventsV2 = new CachedAcpSessionEventStoreV2(
|
|
46852
|
-
openSessionEventCacheV2Database(join19(stateDirectory, "sessions", `${channelHash}.events.sqlite`))
|
|
46853
|
-
daemonGenerationId
|
|
46897
|
+
openSessionEventCacheV2Database(join19(stateDirectory, "sessions", `${channelHash}.events.sqlite`))
|
|
46854
46898
|
);
|
|
46855
46899
|
} catch (error62) {
|
|
46856
46900
|
sessionDatabase.close();
|
|
@@ -46862,8 +46906,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
46862
46906
|
const publisher = new DaemonSessionEventPublisher(timer);
|
|
46863
46907
|
const eventLogV2 = new DaemonSessionEventLogV2(
|
|
46864
46908
|
publisher,
|
|
46865
|
-
(sessionId, event) => agentRuntime.recordLifecycleEventV2(sessionId, event)
|
|
46866
|
-
daemonGenerationId
|
|
46909
|
+
(sessionId, event) => agentRuntime.recordLifecycleEventV2(sessionId, event)
|
|
46867
46910
|
);
|
|
46868
46911
|
const activeTurns = new DaemonTurnRegistry(operations);
|
|
46869
46912
|
const agentRuntime = new AgentRuntimeManager(
|
|
@@ -47143,7 +47186,7 @@ function isRecord12(value) {
|
|
|
47143
47186
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
47144
47187
|
}
|
|
47145
47188
|
function controlSocketPath(stateDirectory) {
|
|
47146
|
-
const installationHash =
|
|
47189
|
+
const installationHash = createHash8("sha256").update(stateDirectory).digest("hex").slice(0, 32);
|
|
47147
47190
|
return process.platform === "win32" ? `\\\\.\\pipe\\mobius-${installationHash}` : join20(tmpdir(), `mobius-${installationHash}.sock`);
|
|
47148
47191
|
}
|
|
47149
47192
|
function controlTokenPath(stateDirectory) {
|