@moxt-ai/mobius 0.0.435 → 0.0.437
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/{chunk-4DTO2ZWK.js → chunk-M5CUSOGC.js} +2 -2
- package/dist/{chunk-4DTO2ZWK.js.map → chunk-M5CUSOGC.js.map} +1 -1
- package/dist/{chunk-JVJTTNWU.js → chunk-TP6MQ4X7.js} +47 -302
- package/dist/{chunk-JVJTTNWU.js.map → chunk-TP6MQ4X7.js.map} +4 -4
- package/dist/{cli-U3NTI74B.js → cli-VPYZQP54.js} +3 -3
- package/dist/cli.js +2 -2
- package/dist/engine/runtime/command/registry/history.d.ts +0 -10
- package/dist/engine/runtime/command/registry/history.d.ts.map +1 -1
- package/dist/engine/runtime/command/registry/history.js +8 -111
- package/dist/engine/runtime/command/registry/history.js.map +1 -1
- package/dist/engine/session/history/session-event-store.d.ts +7 -12
- package/dist/engine/session/history/session-event-store.d.ts.map +1 -1
- package/dist/engine/session/history/session-event-store.js +0 -65
- package/dist/engine/session/history/session-event-store.js.map +1 -1
- package/dist/engine/session/history/session-history.d.ts +1 -2
- package/dist/engine/session/history/session-history.d.ts.map +1 -1
- package/dist/engine/session/history/session-history.js +0 -1
- package/dist/engine/session/history/session-history.js.map +1 -1
- package/dist/engine/session/live/agent-session.d.ts +0 -2
- package/dist/engine/session/live/agent-session.d.ts.map +1 -1
- package/dist/engine/session/live/agent-session.js +0 -7
- package/dist/engine/session/live/agent-session.js.map +1 -1
- package/dist/engine/session/manager/session-manager.d.ts +0 -2
- package/dist/engine/session/manager/session-manager.d.ts.map +1 -1
- package/dist/engine/session/manager/session-manager.js +0 -6
- package/dist/engine/session/manager/session-manager.js.map +1 -1
- package/dist/engine/session/prompt/prompt-lifecycle.d.ts +2 -8
- package/dist/engine/session/prompt/prompt-lifecycle.d.ts.map +1 -1
- package/dist/engine/session/prompt/prompt-lifecycle.js +0 -12
- package/dist/engine/session/prompt/prompt-lifecycle.js.map +1 -1
- package/dist/engine/session/turn/execution-receipts.d.ts +1 -6
- package/dist/engine/session/turn/execution-receipts.d.ts.map +1 -1
- package/dist/engine/session/turn/execution-receipts.js +0 -21
- package/dist/engine/session/turn/execution-receipts.js.map +1 -1
- package/dist/engine/storage/session/session-event-cache-table.d.ts +0 -4
- package/dist/engine/storage/session/session-event-cache-table.d.ts.map +1 -1
- package/dist/engine/storage/session/session-event-cache-table.js +1 -17
- package/dist/engine/storage/session/session-event-cache-table.js.map +1 -1
- package/dist/engine.js +2 -2
- package/package.json +1 -1
- /package/dist/{cli-U3NTI74B.js.map → cli-VPYZQP54.js.map} +0 -0
|
@@ -80,7 +80,7 @@ var __callDispose = (stack, error, hasError) => {
|
|
|
80
80
|
// package.json
|
|
81
81
|
var package_default = {
|
|
82
82
|
name: "@moxt-ai/mobius",
|
|
83
|
-
version: "0.0.
|
|
83
|
+
version: "0.0.437",
|
|
84
84
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
85
85
|
type: "module",
|
|
86
86
|
bin: {
|
|
@@ -169,4 +169,4 @@ export {
|
|
|
169
169
|
__callDispose,
|
|
170
170
|
package_default
|
|
171
171
|
};
|
|
172
|
-
//# sourceMappingURL=chunk-
|
|
172
|
+
//# sourceMappingURL=chunk-M5CUSOGC.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../package.json"],
|
|
4
|
-
"sourcesContent": ["{\n \"name\": \"@moxt-ai/mobius\",\n \"version\": \"0.0.
|
|
4
|
+
"sourcesContent": ["{\n \"name\": \"@moxt-ai/mobius\",\n \"version\": \"0.0.437\",\n \"description\": \"Mobius CLI for pairing and running local AI agent services.\",\n \"type\": \"module\",\n \"bin\": {\n \"mobius\": \"dist/cli.js\"\n },\n \"exports\": {\n \"./engine\": {\n \"mobius-source\": \"./src/exports/engine.ts\",\n \"types\": \"./dist/exports/engine.d.ts\",\n \"default\": \"./dist/engine.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"NOTICE\",\n \"THIRD-PARTY-NOTICES.txt\"\n ],\n \"engines\": {\n \"node\": \">=22.19.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"exports\": {\n \"./engine\": {\n \"types\": \"./dist/exports/engine.d.ts\",\n \"import\": \"./dist/engine.js\",\n \"default\": \"./dist/engine.js\"\n }\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/moxt-ai/mobius.git\",\n \"directory\": \"packages/cli\"\n },\n \"scripts\": {\n \"prebuild\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"build\": \"node scripts/build.ts && tsc --project tsconfig.build.json\",\n \"dev\": \"node --watch src/cli/entrypoint.ts\",\n \"pretypecheck\": \"tsc --project src/engine/acp/harness/claude/upstream/tsconfig.json && tsc --project src/engine/acp/harness/pi/upstream/tsconfig.json\",\n \"prepack\": \"pnpm build\",\n \"start\": \"node dist/cli.js\",\n \"typecheck\": \"tsc --project tsconfig.json && tsc --project tests/tsconfig.json\",\n \"pretest:controlled\": \"pnpm build\",\n \"test:controlled\": \"vitest run tests/sessions tests/runtime\",\n \"pretest:manual\": \"pnpm pretest:controlled\",\n \"test:manual\": \"vitest run tests/manual\",\n \"pretest:agents\": \"pnpm build\",\n \"test:agents\": \"vitest run tests/agents --maxWorkers=2\"\n },\n \"dependencies\": {\n \"undici\": \"8.12.2\"\n },\n \"devDependencies\": {\n \"@agentclientprotocol/sdk\": \"^1.4.0\",\n \"@anthropic-ai/claude-agent-sdk\": \"0.3.257\",\n \"@anthropic-ai/sdk\": \"0.122.0\",\n \"@moxt-ai/mobius-sdk\": \"workspace:*\",\n \"@moxt-ai/mobius-test\": \"workspace:*\",\n \"@types/node\": \"^24.13.5\",\n \"@types/semver\": \"^7.8.0\",\n \"@types/ws\": \"^8.18.1\",\n \"commander\": \"15.0.0\",\n \"drizzle-kit\": \"1.0.0-rc.4\",\n \"drizzle-orm\": \"1.0.0-rc.4\",\n \"esbuild\": \"0.28.2\",\n \"semver\": \"^7.8.5\",\n \"valibot\": \"1.5.0\",\n \"ws\": \"^8.21.3\",\n \"zod\": \"^4.6.7\"\n },\n \"keywords\": [],\n \"author\": \"Moxt\",\n \"license\": \"Apache-2.0\",\n \"bugs\": {\n \"url\": \"https://github.com/moxt-ai/mobius/issues\"\n },\n \"homepage\": \"https://github.com/moxt-ai/mobius#readme\"\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACI,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,KAAO;AAAA,IACH,QAAU;AAAA,EACd;AAAA,EACA,SAAW;AAAA,IACP,YAAY;AAAA,MACR,iBAAiB;AAAA,MACjB,OAAS;AAAA,MACT,SAAW;AAAA,IACf;AAAA,EACJ;AAAA,EACA,OAAS;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AAAA,EACA,SAAW;AAAA,IACP,MAAQ;AAAA,EACZ;AAAA,EACA,eAAiB;AAAA,IACb,QAAU;AAAA,IACV,SAAW;AAAA,MACP,YAAY;AAAA,QACR,OAAS;AAAA,QACT,QAAU;AAAA,QACV,SAAW;AAAA,MACf;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,YAAc;AAAA,IACV,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACjB;AAAA,EACA,SAAW;AAAA,IACP,UAAY;AAAA,IACZ,OAAS;AAAA,IACT,KAAO;AAAA,IACP,cAAgB;AAAA,IAChB,SAAW;AAAA,IACX,OAAS;AAAA,IACT,WAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,kBAAkB;AAAA,IAClB,eAAe;AAAA,EACnB;AAAA,EACA,cAAgB;AAAA,IACZ,QAAU;AAAA,EACd;AAAA,EACA,iBAAmB;AAAA,IACf,4BAA4B;AAAA,IAC5B,kCAAkC;AAAA,IAClC,qBAAqB;AAAA,IACrB,uBAAuB;AAAA,IACvB,wBAAwB;AAAA,IACxB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,WAAa;AAAA,IACb,eAAe;AAAA,IACf,eAAe;AAAA,IACf,SAAW;AAAA,IACX,QAAU;AAAA,IACV,SAAW;AAAA,IACX,IAAM;AAAA,IACN,KAAO;AAAA,EACX;AAAA,EACA,UAAY,CAAC;AAAA,EACb,QAAU;AAAA,EACV,SAAW;AAAA,EACX,MAAQ;AAAA,IACJ,KAAO;AAAA,EACX;AAAA,EACA,UAAY;AAChB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__export,
|
|
4
4
|
__using,
|
|
5
5
|
package_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-M5CUSOGC.js";
|
|
7
7
|
|
|
8
8
|
// src/engine/runtime/relay/runtime-revocation.ts
|
|
9
9
|
var runtimeRevocationCloseCode = 1008;
|
|
@@ -87651,7 +87651,6 @@ var sessionEvent = sqliteTable(
|
|
|
87651
87651
|
|
|
87652
87652
|
// src/engine/storage/session/session-event-cache-table.ts
|
|
87653
87653
|
var cachedEventRowSchema = external_exports.object({ eventJson: external_exports.string() });
|
|
87654
|
-
var cachedEventOrdinalRowSchema = external_exports.object({ eventJson: external_exports.string(), ordinal: external_exports.number().int().positive() });
|
|
87655
87654
|
var SessionEventCacheTable = class {
|
|
87656
87655
|
#database;
|
|
87657
87656
|
#ignoredPersistedSessions = /* @__PURE__ */ new Set();
|
|
@@ -87738,22 +87737,6 @@ var SessionEventCacheTable = class {
|
|
|
87738
87737
|
}
|
|
87739
87738
|
return resolved;
|
|
87740
87739
|
};
|
|
87741
|
-
read = (sessionId, sessionGenerationId, startOrdinal, endOrdinal) => {
|
|
87742
|
-
if (this.#ignoredPersistedSessions.has(sessionId)) {
|
|
87743
|
-
return [];
|
|
87744
|
-
}
|
|
87745
|
-
return this.#database.select({ eventJson: sessionEvent.eventJson, ordinal: sessionEvent.ordinal }).from(sessionEvent).where(
|
|
87746
|
-
and(
|
|
87747
|
-
eq2(sessionEvent.generationId, sessionGenerationId),
|
|
87748
|
-
eq2(sessionEvent.sessionId, sessionId),
|
|
87749
|
-
gte2(sessionEvent.ordinal, startOrdinal),
|
|
87750
|
-
lte2(sessionEvent.ordinal, endOrdinal)
|
|
87751
|
-
)
|
|
87752
|
-
).orderBy(asc(sessionEvent.ordinal)).all().map((value) => {
|
|
87753
|
-
const row = cachedEventOrdinalRowSchema.parse(value);
|
|
87754
|
-
return { event: decodeSessionEvent(JSON.parse(row.eventJson)), ordinal: row.ordinal };
|
|
87755
|
-
});
|
|
87756
|
-
};
|
|
87757
87740
|
delete = (sessionId, sessionGenerationId) => {
|
|
87758
87741
|
if (!this.#isAvailable) {
|
|
87759
87742
|
this.#ignoredPersistedSessions.add(sessionId);
|
|
@@ -88322,23 +88305,6 @@ var SessionEvents = class {
|
|
|
88322
88305
|
}
|
|
88323
88306
|
/** The projected tool call for this identifier, materializing it if needed. */
|
|
88324
88307
|
toolCall = (toolCallId, resolve19) => this.#projection.getToolCall(toolCallId, resolve19);
|
|
88325
|
-
endIndex = (cursor) => {
|
|
88326
|
-
if (cursor === null) {
|
|
88327
|
-
return this.#eventIds.length;
|
|
88328
|
-
}
|
|
88329
|
-
const index2 = this.#eventIndexById.get(cursor);
|
|
88330
|
-
if (index2 === void 0) {
|
|
88331
|
-
throw new Error("The native event cursor is invalid");
|
|
88332
|
-
}
|
|
88333
|
-
return index2;
|
|
88334
|
-
};
|
|
88335
|
-
cursorAt = (index2) => {
|
|
88336
|
-
const cursor = this.#eventIds[index2];
|
|
88337
|
-
if (cursor === void 0) {
|
|
88338
|
-
throw new Error("The native event cursor is unavailable");
|
|
88339
|
-
}
|
|
88340
|
-
return cursor;
|
|
88341
|
-
};
|
|
88342
88308
|
item = (eventId) => this.#cachedItemsByEventId.get(eventId)?.event;
|
|
88343
88309
|
/**
|
|
88344
88310
|
* Materializes an event that was previously dropped to the cache database.
|
|
@@ -88352,22 +88318,6 @@ var SessionEvents = class {
|
|
|
88352
88318
|
this.#cachedItemsByEventId.set(event.eventId, new ProjectedSessionEvent(event));
|
|
88353
88319
|
return true;
|
|
88354
88320
|
};
|
|
88355
|
-
/**
|
|
88356
|
-
* Fills the ordinal-keyed merge view with materialized events, overriding
|
|
88357
|
-
* stale persisted rows for the same ordinals.
|
|
88358
|
-
*/
|
|
88359
|
-
eventsInRange = (startIndex, endIndex, into) => {
|
|
88360
|
-
for (let index2 = startIndex; index2 < endIndex; index2 += 1) {
|
|
88361
|
-
const eventId = this.#eventIds[index2];
|
|
88362
|
-
if (eventId === void 0) {
|
|
88363
|
-
throw new Error("The projected Session event is unavailable");
|
|
88364
|
-
}
|
|
88365
|
-
const item = this.#cachedItemsByEventId.get(eventId);
|
|
88366
|
-
if (item !== void 0) {
|
|
88367
|
-
into.set(index2 + 1, item.event);
|
|
88368
|
-
}
|
|
88369
|
-
}
|
|
88370
|
-
};
|
|
88371
88321
|
/**
|
|
88372
88322
|
* Collects the materialized events that fall outside the retention window,
|
|
88373
88323
|
* including adopted merge targets behind it, so a successful flush can
|
|
@@ -88400,16 +88350,6 @@ function liveEvent(sessionId, sessionGenerationId, eventId, position, event, rec
|
|
|
88400
88350
|
sessionId
|
|
88401
88351
|
};
|
|
88402
88352
|
}
|
|
88403
|
-
function eventPage(session, sessionGenerationId, endIndex, eventLimit, read) {
|
|
88404
|
-
const startIndex = Math.max(0, endIndex - eventLimit);
|
|
88405
|
-
return {
|
|
88406
|
-
events: read(startIndex, endIndex),
|
|
88407
|
-
throughPosition: session.throughPosition,
|
|
88408
|
-
nextCursor: startIndex === 0 ? null : session.cursorAt(startIndex),
|
|
88409
|
-
sessionGenerationId,
|
|
88410
|
-
truncated: startIndex > 0
|
|
88411
|
-
};
|
|
88412
|
-
}
|
|
88413
88353
|
var MemorySessionEventStore = class {
|
|
88414
88354
|
#allocatedPositionBySession = /* @__PURE__ */ new Map();
|
|
88415
88355
|
#events = /* @__PURE__ */ new Map();
|
|
@@ -88465,15 +88405,6 @@ var MemorySessionEventStore = class {
|
|
|
88465
88405
|
const session = this.#session(sessionId);
|
|
88466
88406
|
return { sessionGenerationId: session.sessionGenerationId, throughPosition: session.throughPosition };
|
|
88467
88407
|
};
|
|
88468
|
-
page = (sessionId, eventLimit, cursor) => {
|
|
88469
|
-
const session = this.#session(sessionId);
|
|
88470
|
-
const endIndex = session.endIndex(cursor);
|
|
88471
|
-
return eventPage(session, session.sessionGenerationId, endIndex, eventLimit, (start, end) => {
|
|
88472
|
-
const merged = /* @__PURE__ */ new Map();
|
|
88473
|
-
session.eventsInRange(start, end, merged);
|
|
88474
|
-
return [...merged.entries()].toSorted((left, right) => left[0] - right[0]).map(([, event]) => event);
|
|
88475
|
-
});
|
|
88476
|
-
};
|
|
88477
88408
|
remove = (sessionId) => {
|
|
88478
88409
|
this.#events.delete(sessionId);
|
|
88479
88410
|
};
|
|
@@ -88586,24 +88517,6 @@ var CachedSessionEventStore = class {
|
|
|
88586
88517
|
const session = this.#session(sessionId);
|
|
88587
88518
|
return { sessionGenerationId: session.sessionGenerationId, throughPosition: session.throughPosition };
|
|
88588
88519
|
};
|
|
88589
|
-
page = (sessionId, eventLimit, cursor) => {
|
|
88590
|
-
const session = this.#sessions.get(sessionId);
|
|
88591
|
-
const current = session ?? this.#session(sessionId);
|
|
88592
|
-
const endIndex = current.endIndex(cursor);
|
|
88593
|
-
return eventPage(current, current.sessionGenerationId, endIndex, eventLimit, (startIndex, endIndex2) => {
|
|
88594
|
-
const merged = /* @__PURE__ */ new Map();
|
|
88595
|
-
for (const { event, ordinal } of this.#cacheTable.read(
|
|
88596
|
-
sessionId,
|
|
88597
|
-
current.sessionGenerationId,
|
|
88598
|
-
startIndex + 1,
|
|
88599
|
-
endIndex2
|
|
88600
|
-
)) {
|
|
88601
|
-
merged.set(ordinal, event);
|
|
88602
|
-
}
|
|
88603
|
-
current.eventsInRange(startIndex, endIndex2, merged);
|
|
88604
|
-
return [...merged.entries()].toSorted((left, right) => left[0] - right[0]).map(([, event]) => event);
|
|
88605
|
-
});
|
|
88606
|
-
};
|
|
88607
88520
|
#deletePersisted = (sessionId, sessionGenerationId) => {
|
|
88608
88521
|
this.#cacheTable.delete(sessionId, sessionGenerationId);
|
|
88609
88522
|
};
|
|
@@ -88757,7 +88670,6 @@ var HistoryReplayCapture = class {
|
|
|
88757
88670
|
}
|
|
88758
88671
|
return this.#events.append(this.#sessionId, event);
|
|
88759
88672
|
};
|
|
88760
|
-
eventPage = (eventLimit, cursor) => this.#events.page(this.#sessionId, eventLimit, cursor);
|
|
88761
88673
|
};
|
|
88762
88674
|
|
|
88763
88675
|
// src/engine/acp/protocol/elicitation.ts
|
|
@@ -89908,17 +89820,6 @@ var AgentSession = class _AgentSession {
|
|
|
89908
89820
|
kind: "execution-only"
|
|
89909
89821
|
};
|
|
89910
89822
|
};
|
|
89911
|
-
loadHistoryEvents = async (eventLimit, cursor, signal) => {
|
|
89912
|
-
if (!this.#capabilities.loadSession) {
|
|
89913
|
-
throw new AcpExecutionError(
|
|
89914
|
-
"This Agent restores context but does not provide message history.",
|
|
89915
|
-
{},
|
|
89916
|
-
"native_history_unsupported"
|
|
89917
|
-
);
|
|
89918
|
-
}
|
|
89919
|
-
const history = await this.#completedHistory(signal);
|
|
89920
|
-
return history.eventPage(eventLimit, cursor);
|
|
89921
|
-
};
|
|
89922
89823
|
async #completedHistory(signal) {
|
|
89923
89824
|
if (!this.#prompted && this.#nativeHistoryOwnership.kind === "fresh-session") {
|
|
89924
89825
|
if (this.#sessionLoad.kind === "not-requested") {
|
|
@@ -91224,12 +91125,6 @@ var SessionManager2 = class {
|
|
|
91224
91125
|
}
|
|
91225
91126
|
return started;
|
|
91226
91127
|
});
|
|
91227
|
-
loadSessionEvents = async (options, eventLimit, cursor) => this.#operations.run(options, async (options2) => {
|
|
91228
|
-
return await this.#executionProcesses.use(options2.sessionId, async () => {
|
|
91229
|
-
const runtime = await this.ensureSession(options2);
|
|
91230
|
-
return await runtime.loadHistoryEvents(eventLimit, cursor, options2.signal);
|
|
91231
|
-
});
|
|
91232
|
-
});
|
|
91233
91128
|
};
|
|
91234
91129
|
|
|
91235
91130
|
// src/engine/session/native/native-session-browser.ts
|
|
@@ -91556,18 +91451,6 @@ var PromptLifecycle = class {
|
|
|
91556
91451
|
this.#sink.publishOperationFailure(sessionId, commandId, code, message);
|
|
91557
91452
|
}
|
|
91558
91453
|
};
|
|
91559
|
-
/** The recorded terminal events of the Session's settled prompts that name the user message they recorded. */
|
|
91560
|
-
promptOutcomes = (sessionId) => this.#executions.promptOutcomes(sessionId);
|
|
91561
|
-
promptRequestRecovery = (sessionId) => ({
|
|
91562
|
-
queuedPromptRequests: [...this.#queued.values()].filter(
|
|
91563
|
-
(request) => request.sessionId === sessionId && !this.#executions.hasStarted(request.commandId, sessionId)
|
|
91564
|
-
).map(({ commandId, content, disposition, targetCommandId }) => ({
|
|
91565
|
-
commandId,
|
|
91566
|
-
content,
|
|
91567
|
-
...disposition === void 0 ? {} : { disposition },
|
|
91568
|
-
...targetCommandId === void 0 ? {} : { targetCommandId }
|
|
91569
|
-
}))
|
|
91570
|
-
});
|
|
91571
91454
|
};
|
|
91572
91455
|
async function settleAbandonedTurn(projection, operations, cancellation) {
|
|
91573
91456
|
const cancelled = operations.recordCancellationBeforeAdmission(cancellation.commandId, cancellation.sessionId);
|
|
@@ -91837,24 +91720,6 @@ var ExecutionReceipts = class {
|
|
|
91837
91720
|
const receipt = this.#executions.get(commandId);
|
|
91838
91721
|
return receipt?.sessionId === sessionId && receipt.state.kind === "started" ? receipt.state.startedAt : void 0;
|
|
91839
91722
|
};
|
|
91840
|
-
/**
|
|
91841
|
-
* The recorded terminal events of the Session's settled prompts whose Agent reported the user message they
|
|
91842
|
-
* recorded, while their receipts are retained.
|
|
91843
|
-
*/
|
|
91844
|
-
promptOutcomes = (sessionId) => {
|
|
91845
|
-
const outcomes = [];
|
|
91846
|
-
for (const [commandId, receipt] of this.#executions) {
|
|
91847
|
-
if (receipt.sessionId !== sessionId) {
|
|
91848
|
-
continue;
|
|
91849
|
-
}
|
|
91850
|
-
const outcome = this.restatedOutcome(commandId);
|
|
91851
|
-
const event = outcome?.event;
|
|
91852
|
-
if (outcome?.recordedAt !== void 0 && event?.type === "lifecycle-metadata" && (event.payload.kind === "prompt.completed" || event.payload.kind === "prompt.failed") && event.payload.messageId !== void 0) {
|
|
91853
|
-
outcomes.push({ payload: event.payload, recordedAt: outcome.recordedAt });
|
|
91854
|
-
}
|
|
91855
|
-
}
|
|
91856
|
-
return outcomes;
|
|
91857
|
-
};
|
|
91858
91723
|
/** Started identities remain authoritative after their detailed receipt is evicted. */
|
|
91859
91724
|
hasStarted = (commandId, sessionId) => {
|
|
91860
91725
|
const standing = this.#standing(commandId, sessionId);
|
|
@@ -94353,179 +94218,24 @@ var fileReadCommand = {
|
|
|
94353
94218
|
}
|
|
94354
94219
|
};
|
|
94355
94220
|
|
|
94356
|
-
// src/engine/session/workspace/resolve-session-directories.ts
|
|
94357
|
-
import { basename as basename9 } from "node:path";
|
|
94358
|
-
var ResolvedSessionDirectories = class {
|
|
94359
|
-
additionalDirectories;
|
|
94360
|
-
additionalDirectoryEntries;
|
|
94361
|
-
cwd;
|
|
94362
|
-
directoryLabel;
|
|
94363
|
-
constructor(cwd, directoryLabel, additionalDirectories, additionalDirectoryEntries) {
|
|
94364
|
-
this.additionalDirectories = additionalDirectories;
|
|
94365
|
-
this.additionalDirectoryEntries = additionalDirectoryEntries;
|
|
94366
|
-
this.cwd = cwd;
|
|
94367
|
-
this.directoryLabel = directoryLabel;
|
|
94368
|
-
}
|
|
94369
|
-
};
|
|
94370
|
-
async function resolveSessionDirectories(directories, bindingId, directoryId, additionalDirectoryIds, signal) {
|
|
94371
|
-
const selection = await directories.describe(bindingId, directoryId, signal);
|
|
94372
|
-
const cwd = selection.path;
|
|
94373
|
-
const additionalDirectories = [];
|
|
94374
|
-
const additionalDirectoryEntries = [];
|
|
94375
|
-
const unique = /* @__PURE__ */ new Set([cwd]);
|
|
94376
|
-
for (const additionalDirectoryId of additionalDirectoryIds) {
|
|
94377
|
-
const directory = await directories.resolve(bindingId, additionalDirectoryId, signal);
|
|
94378
|
-
if (unique.has(directory)) {
|
|
94379
|
-
throw new LocalAuthorizationError("Workspace directories must resolve to distinct locations");
|
|
94380
|
-
}
|
|
94381
|
-
unique.add(directory);
|
|
94382
|
-
additionalDirectories.push(directory);
|
|
94383
|
-
additionalDirectoryEntries.push({
|
|
94384
|
-
directoryId: additionalDirectoryId,
|
|
94385
|
-
name: basename9(directory)
|
|
94386
|
-
});
|
|
94387
|
-
}
|
|
94388
|
-
return new ResolvedSessionDirectories(cwd, selection.label, additionalDirectories, additionalDirectoryEntries);
|
|
94389
|
-
}
|
|
94390
|
-
|
|
94391
94221
|
// src/engine/runtime/command/registry/history.ts
|
|
94392
|
-
function onPage(outcomes, events) {
|
|
94393
|
-
const messageIds = /* @__PURE__ */ new Set();
|
|
94394
|
-
for (const event of events) {
|
|
94395
|
-
if (event.type === "acp" && event.payload.sessionUpdate === "user_message_chunk" && event.payload.messageId !== void 0 && event.payload.messageId !== null) {
|
|
94396
|
-
messageIds.add(event.payload.messageId);
|
|
94397
|
-
}
|
|
94398
|
-
}
|
|
94399
|
-
return outcomes.filter(({ payload }) => payload.messageId !== void 0 && messageIds.has(payload.messageId));
|
|
94400
|
-
}
|
|
94401
|
-
async function loadHistoryPage(sessionId, eventLimit, initialCursor, queuedPromptRequests, load) {
|
|
94402
|
-
let cursor = initialCursor;
|
|
94403
|
-
let loaded = [];
|
|
94404
|
-
let sessionGenerationId = null;
|
|
94405
|
-
let sourceNextCursor = null;
|
|
94406
|
-
let throughPosition = null;
|
|
94407
|
-
do {
|
|
94408
|
-
const replay = await load(eventLimit, cursor);
|
|
94409
|
-
throughPosition ??= replay.throughPosition;
|
|
94410
|
-
if (sessionGenerationId !== null && replay.sessionGenerationId !== sessionGenerationId) {
|
|
94411
|
-
throw new SessionError("session_reloaded", "The Session reloaded while history was loading");
|
|
94412
|
-
}
|
|
94413
|
-
if (replay.events.some(
|
|
94414
|
-
(event) => event.sessionId !== sessionId || event.sessionGenerationId !== replay.sessionGenerationId
|
|
94415
|
-
)) {
|
|
94416
|
-
throw new SessionError(
|
|
94417
|
-
"session_history_unavailable",
|
|
94418
|
-
"The Session history contains events from another Session"
|
|
94419
|
-
);
|
|
94420
|
-
}
|
|
94421
|
-
sessionGenerationId = replay.sessionGenerationId;
|
|
94422
|
-
const events = replay.events.map((event, index2) => {
|
|
94423
|
-
const eventCursor = replay.nextCursor === null && index2 === 0 ? null : event.eventId;
|
|
94424
|
-
return { cursor: eventCursor, event };
|
|
94425
|
-
});
|
|
94426
|
-
loaded = [...events, ...loaded];
|
|
94427
|
-
sourceNextCursor = replay.nextCursor;
|
|
94428
|
-
if (loaded.length >= eventLimit) {
|
|
94429
|
-
break;
|
|
94430
|
-
}
|
|
94431
|
-
cursor = sourceNextCursor;
|
|
94432
|
-
} while (cursor !== null);
|
|
94433
|
-
if (sessionGenerationId === null || throughPosition === null) {
|
|
94434
|
-
throw new SessionError("session_history_unavailable", "The Session history is unavailable");
|
|
94435
|
-
}
|
|
94436
|
-
const orderedEvents = loaded.slice(-eventLimit);
|
|
94437
|
-
const nextCursor = orderedEvents[0]?.cursor ?? null;
|
|
94438
|
-
return {
|
|
94439
|
-
events: {
|
|
94440
|
-
events: orderedEvents.map(({ event }) => event),
|
|
94441
|
-
nextCursor,
|
|
94442
|
-
sessionGenerationId,
|
|
94443
|
-
tailCursor: orderedEvents.at(-1)?.event.eventId ?? "",
|
|
94444
|
-
throughPosition,
|
|
94445
|
-
truncated: nextCursor !== null,
|
|
94446
|
-
version: 2
|
|
94447
|
-
},
|
|
94448
|
-
queuedPromptRequests
|
|
94449
|
-
};
|
|
94450
|
-
}
|
|
94451
|
-
async function executeSessionHistoryPageLoad(socket, command, config2, resolveAgent, directories, diagnostics, sessions, nativeSessions, eventProjection, signal) {
|
|
94452
|
-
let agentId;
|
|
94453
|
-
try {
|
|
94454
|
-
const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
|
|
94455
|
-
if (entry === void 0) {
|
|
94456
|
-
throw new SessionError("session_not_found", "The Session was not found");
|
|
94457
|
-
}
|
|
94458
|
-
agentId = entry.agentId;
|
|
94459
|
-
const resolved = await resolveSessionDirectories(
|
|
94460
|
-
directories,
|
|
94461
|
-
config2.bindingId,
|
|
94462
|
-
entry.directoryId,
|
|
94463
|
-
entry.additionalDirectories.map((directory) => directory.directoryId),
|
|
94464
|
-
signal
|
|
94465
|
-
);
|
|
94466
|
-
const loadOptions = {
|
|
94467
|
-
additionalDirectories: resolved.additionalDirectories,
|
|
94468
|
-
...await resolveAgent(entry.agentId, signal, command.sessionId),
|
|
94469
|
-
cwd: resolved.cwd,
|
|
94470
|
-
sessionId: command.sessionId,
|
|
94471
|
-
signal
|
|
94472
|
-
};
|
|
94473
|
-
const recovery = eventProjection.promptRequestRecovery(command.sessionId);
|
|
94474
|
-
const settled = eventProjection.promptOutcomes(command.sessionId);
|
|
94475
|
-
const events = await loadHistoryPage(
|
|
94476
|
-
command.sessionId,
|
|
94477
|
-
command.eventLimit,
|
|
94478
|
-
command.cursor,
|
|
94479
|
-
recovery.queuedPromptRequests,
|
|
94480
|
-
async (eventLimit, cursor) => await sessions.loadSessionEvents(loadOptions, eventLimit, cursor)
|
|
94481
|
-
);
|
|
94482
|
-
signal.throwIfAborted();
|
|
94483
|
-
send(socket, {
|
|
94484
|
-
events: {
|
|
94485
|
-
...events,
|
|
94486
|
-
events: {
|
|
94487
|
-
...events.events,
|
|
94488
|
-
promptOutcomes: onPage(settled, events.events.events)
|
|
94489
|
-
}
|
|
94490
|
-
},
|
|
94491
|
-
kind: SESSION_HISTORY_PAGE_LOADED_KIND,
|
|
94492
|
-
requestId: command.requestId,
|
|
94493
|
-
sessionId: command.sessionId
|
|
94494
|
-
});
|
|
94495
|
-
} catch (error62) {
|
|
94496
|
-
if (!signal.aborted) {
|
|
94497
|
-
diagnostics.daemonDiagnostic(
|
|
94498
|
-
"session_history_v2_load_failed",
|
|
94499
|
-
command.requestId,
|
|
94500
|
-
{
|
|
94501
|
-
...agentId === void 0 ? {} : { agentId },
|
|
94502
|
-
code: operationErrorCode(error62),
|
|
94503
|
-
sessionId: command.sessionId
|
|
94504
|
-
},
|
|
94505
|
-
error62
|
|
94506
|
-
);
|
|
94507
|
-
reportOperationFailure(socket, command.requestId, command.sessionId, error62);
|
|
94508
|
-
}
|
|
94509
|
-
}
|
|
94510
|
-
}
|
|
94511
94222
|
var sessionHistoryPageLoadCommand = {
|
|
94512
94223
|
kind: SESSION_HISTORY_PAGE_LOAD_KIND,
|
|
94513
94224
|
handle: (context, message) => {
|
|
94514
94225
|
if (message.kind !== SESSION_HISTORY_PAGE_LOAD_KIND) {
|
|
94515
94226
|
throw new Error("Command kind mismatch");
|
|
94516
94227
|
}
|
|
94517
|
-
|
|
94518
|
-
|
|
94519
|
-
|
|
94520
|
-
|
|
94521
|
-
|
|
94522
|
-
|
|
94523
|
-
|
|
94524
|
-
|
|
94525
|
-
|
|
94526
|
-
context.eventProjection,
|
|
94527
|
-
context.signal
|
|
94228
|
+
const failure2 = new SessionError(
|
|
94229
|
+
"session_history_unavailable",
|
|
94230
|
+
"This Runtime no longer serves Session history pages"
|
|
94231
|
+
);
|
|
94232
|
+
context.diagnostics.daemonDiagnostic(
|
|
94233
|
+
"session_history_v2_load_failed",
|
|
94234
|
+
message.requestId,
|
|
94235
|
+
{ code: operationErrorCode(failure2), sessionId: message.sessionId },
|
|
94236
|
+
failure2
|
|
94528
94237
|
);
|
|
94238
|
+
reportOperationFailure(context.socket, message.requestId, message.sessionId, failure2);
|
|
94529
94239
|
}
|
|
94530
94240
|
};
|
|
94531
94241
|
var previewHistoryPageLoadCommand = {
|
|
@@ -94808,6 +94518,41 @@ function createNativeSessionCommands(context) {
|
|
|
94808
94518
|
];
|
|
94809
94519
|
}
|
|
94810
94520
|
|
|
94521
|
+
// src/engine/session/workspace/resolve-session-directories.ts
|
|
94522
|
+
import { basename as basename9 } from "node:path";
|
|
94523
|
+
var ResolvedSessionDirectories = class {
|
|
94524
|
+
additionalDirectories;
|
|
94525
|
+
additionalDirectoryEntries;
|
|
94526
|
+
cwd;
|
|
94527
|
+
directoryLabel;
|
|
94528
|
+
constructor(cwd, directoryLabel, additionalDirectories, additionalDirectoryEntries) {
|
|
94529
|
+
this.additionalDirectories = additionalDirectories;
|
|
94530
|
+
this.additionalDirectoryEntries = additionalDirectoryEntries;
|
|
94531
|
+
this.cwd = cwd;
|
|
94532
|
+
this.directoryLabel = directoryLabel;
|
|
94533
|
+
}
|
|
94534
|
+
};
|
|
94535
|
+
async function resolveSessionDirectories(directories, bindingId, directoryId, additionalDirectoryIds, signal) {
|
|
94536
|
+
const selection = await directories.describe(bindingId, directoryId, signal);
|
|
94537
|
+
const cwd = selection.path;
|
|
94538
|
+
const additionalDirectories = [];
|
|
94539
|
+
const additionalDirectoryEntries = [];
|
|
94540
|
+
const unique = /* @__PURE__ */ new Set([cwd]);
|
|
94541
|
+
for (const additionalDirectoryId of additionalDirectoryIds) {
|
|
94542
|
+
const directory = await directories.resolve(bindingId, additionalDirectoryId, signal);
|
|
94543
|
+
if (unique.has(directory)) {
|
|
94544
|
+
throw new LocalAuthorizationError("Workspace directories must resolve to distinct locations");
|
|
94545
|
+
}
|
|
94546
|
+
unique.add(directory);
|
|
94547
|
+
additionalDirectories.push(directory);
|
|
94548
|
+
additionalDirectoryEntries.push({
|
|
94549
|
+
directoryId: additionalDirectoryId,
|
|
94550
|
+
name: basename9(directory)
|
|
94551
|
+
});
|
|
94552
|
+
}
|
|
94553
|
+
return new ResolvedSessionDirectories(cwd, selection.label, additionalDirectories, additionalDirectoryEntries);
|
|
94554
|
+
}
|
|
94555
|
+
|
|
94811
94556
|
// src/engine/session/prompt/apply-session-configuration.ts
|
|
94812
94557
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
94813
94558
|
function invalidSessionConfiguration(message) {
|
|
@@ -96881,4 +96626,4 @@ export {
|
|
|
96881
96626
|
* MIT Licensed
|
|
96882
96627
|
*)
|
|
96883
96628
|
*/
|
|
96884
|
-
//# sourceMappingURL=chunk-
|
|
96629
|
+
//# sourceMappingURL=chunk-TP6MQ4X7.js.map
|