@moxt-ai/mobius 0.0.108 → 0.0.110

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.
Files changed (33) hide show
  1. package/dist/acp/process-session.d.ts +0 -1
  2. package/dist/acp/process-session.d.ts.map +1 -1
  3. package/dist/acp/process-session.js +0 -9
  4. package/dist/acp/process-session.js.map +1 -1
  5. package/dist/acp/session-manager.d.ts +1 -3
  6. package/dist/acp/session-manager.d.ts.map +1 -1
  7. package/dist/acp/session-manager.js +4 -37
  8. package/dist/acp/session-manager.js.map +1 -1
  9. package/dist/cli.js +22 -115
  10. package/dist/cli.js.map +2 -2
  11. package/dist/index.js +21 -114
  12. package/dist/index.js.map +2 -2
  13. package/dist/native-sessions/acp-adapter.d.ts.map +1 -1
  14. package/dist/native-sessions/acp-adapter.js +0 -1
  15. package/dist/native-sessions/acp-adapter.js.map +1 -1
  16. package/dist/native-sessions/agent-adapter.d.ts +0 -1
  17. package/dist/native-sessions/agent-adapter.d.ts.map +1 -1
  18. package/dist/native-sessions/agent-adapter.js +0 -3
  19. package/dist/native-sessions/agent-adapter.js.map +1 -1
  20. package/dist/native-sessions/codex-adapter.d.ts.map +1 -1
  21. package/dist/native-sessions/codex-adapter.js +0 -1
  22. package/dist/native-sessions/codex-adapter.js.map +1 -1
  23. package/dist/native-sessions/handle-native-requests.js +1 -1
  24. package/dist/native-sessions/handle-native-requests.js.map +1 -1
  25. package/dist/native-sessions/service.d.ts.map +1 -1
  26. package/dist/native-sessions/service.js +2 -40
  27. package/dist/native-sessions/service.js.map +1 -1
  28. package/dist/run-daemon.d.ts.map +1 -1
  29. package/dist/run-daemon.js +17 -1
  30. package/dist/run-daemon.js.map +1 -1
  31. package/dist/runtime.js +21 -114
  32. package/dist/runtime.js.map +2 -2
  33. package/package.json +1 -1
package/dist/runtime.js CHANGED
@@ -25633,7 +25633,6 @@ var identity = {
25633
25633
  };
25634
25634
  var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
25635
25635
  external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
25636
- external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
25637
25636
  external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
25638
25637
  external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
25639
25638
  external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
@@ -25657,7 +25656,6 @@ var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
25657
25656
  ]);
25658
25657
  var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
25659
25658
  external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
25660
- external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
25661
25659
  external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
25662
25660
  external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
25663
25661
  external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
@@ -25673,12 +25671,6 @@ var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
25673
25671
  entryId: identifier,
25674
25672
  targetSessionId: identifier
25675
25673
  }).readonly(),
25676
- external_exports.strictObject({
25677
- ...identity,
25678
- action: external_exports.enum(["import-only", "fork-only"]),
25679
- entryId: identifier,
25680
- targetSessionId: identifier
25681
- }).readonly(),
25682
25674
  external_exports.strictObject({
25683
25675
  ...identity,
25684
25676
  action: external_exports.literal("delete"),
@@ -25701,12 +25693,6 @@ var resultEnvelope = {
25701
25693
  };
25702
25694
  var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
25703
25695
  external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifier }).readonly(),
25704
- external_exports.strictObject({
25705
- ...resultEnvelope,
25706
- action: external_exports.literal("linked-history"),
25707
- targetSessionId: identifier,
25708
- history: sessionHistorySchema
25709
- }).readonly(),
25710
25696
  external_exports.strictObject({
25711
25697
  ...resultEnvelope,
25712
25698
  action: external_exports.literal("active-turn"),
@@ -25725,11 +25711,6 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
25725
25711
  state: external_exports.literal("running")
25726
25712
  }).readonly().nullable()
25727
25713
  }).readonly(),
25728
- external_exports.strictObject({
25729
- ...resultEnvelope,
25730
- action: external_exports.literal("unlinked-history"),
25731
- targetSessionId: identifier
25732
- }).readonly(),
25733
25714
  external_exports.strictObject({
25734
25715
  ...resultEnvelope,
25735
25716
  action: external_exports.literal("find"),
@@ -25747,7 +25728,6 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
25747
25728
  action: external_exports.enum(["import", "fork"]),
25748
25729
  targetSessionId: identifier,
25749
25730
  ready: sessionReadyEventSchema,
25750
- history: sessionHistorySchema,
25751
25731
  title: external_exports.string().max(500)
25752
25732
  }).readonly(),
25753
25733
  external_exports.strictObject({
@@ -28037,15 +28017,6 @@ var PendingElicitation = class {
28037
28017
  var PROCESS_STOP_TIMEOUT_MILLISECONDS = 1e3;
28038
28018
  var MAX_PRE_SESSION_UPDATES = 100;
28039
28019
  var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
28040
- function nativeHistoryNotRetained() {
28041
- return {
28042
- cause: {
28043
- code: "native_history_not_retained",
28044
- message: "Native message history is not retained in the cloud for this Session."
28045
- },
28046
- status: "unavailable"
28047
- };
28048
- }
28049
28020
  var NullAcpSessionObserver = class {
28050
28021
  onCommands = () => Promise.resolve();
28051
28022
  onConfig = () => Promise.resolve();
@@ -29792,7 +29763,7 @@ var AcpSessionManager = class {
29792
29763
  return await this.#startRetainedSessionProcess(
29793
29764
  options,
29794
29765
  async () => await AcpProcessSession.start(
29795
- this.#sessionIdentity === "native" && isNativeChatSessionId(options.agent.id, options.sessionId) && this.#store.read(options.sessionId) instanceof MissingAcpStoredSession ? { ...options, origin: { kind: "import", nativeSessionId: options.sessionId } } : options,
29766
+ options.origin === void 0 && this.#sessionIdentity === "native" && isNativeChatSessionId(options.agent.id, options.sessionId) && this.#store.read(options.sessionId) instanceof MissingAcpStoredSession ? { ...options, origin: { kind: "import", nativeSessionId: options.sessionId } } : options,
29796
29767
  () => this.#observer,
29797
29768
  this.#store,
29798
29769
  metrics
@@ -30335,26 +30306,7 @@ var AcpSessionManager = class {
30335
30306
  this.#endSessionUse(options.sessionId);
30336
30307
  }
30337
30308
  };
30338
- loadLinkedSessionHistory = async (options) => {
30339
- options.signal.throwIfAborted();
30340
- const stored = this.#store.read(options.sessionId);
30341
- if (!(stored instanceof FoundAcpStoredSession) || !stored.session.prompted) {
30342
- return null;
30343
- }
30344
- const linked = stored.session;
30345
- if (linked.agentId !== options.agent.id || linked.cwd !== options.cwd || linked.additionalDirectories.length !== options.additionalDirectories.length || linked.additionalDirectories.some((directory, index) => directory !== options.additionalDirectories[index])) {
30346
- throw new AcpExecutionError(
30347
- "The session belongs to another Agent or workspace",
30348
- {},
30349
- "session_identity_mismatch"
30350
- );
30351
- }
30352
- if (this.#nativeHistoryReader === null) {
30353
- return await this.loadSessionHistory(options);
30354
- }
30355
- return await this.#nativeHistoryReader.read(options, linked.nativeSessionId) ?? await this.loadSessionHistory(options);
30356
- };
30357
- openNativeSession = async (options, origin, loadHistory) => {
30309
+ openNativeSession = async (options, origin) => {
30358
30310
  const key = `${options.agent.id}:${origin.nativeSessionId}`;
30359
30311
  if (this.#nativeOperations.has(key)) {
30360
30312
  throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
@@ -30384,19 +30336,10 @@ var AcpSessionManager = class {
30384
30336
  }
30385
30337
  this.#nativeOperations.add(key);
30386
30338
  try {
30387
- const history = loadHistory ? await runtime.loadHistory(options.signal) : nativeHistoryNotRetained();
30388
30339
  return {
30389
30340
  prepared: runtime.prepared(),
30390
- sessionId: existing.sessionId,
30391
- history
30341
+ sessionId: existing.sessionId
30392
30342
  };
30393
- } catch (error62) {
30394
- await this.#retireSessionProcess(
30395
- existing.sessionId,
30396
- runtime,
30397
- async () => await runtime.closeProcess()
30398
- );
30399
- throw error62;
30400
30343
  } finally {
30401
30344
  this.#nativeOperations.delete(key);
30402
30345
  this.#notifyProcessCapacityChanged();
@@ -30415,16 +30358,10 @@ var AcpSessionManager = class {
30415
30358
  const openedKey = `${options.agent.id}:${runtime.nativeSessionId()}`;
30416
30359
  this.#nativeOperations.add(openedKey);
30417
30360
  try {
30418
- const history = loadHistory ? await runtime.loadHistory(options.signal) : nativeHistoryNotRetained();
30419
30361
  return {
30420
30362
  sessionId: options.sessionId,
30421
- prepared: runtime.prepared(),
30422
- history
30363
+ prepared: runtime.prepared()
30423
30364
  };
30424
- } catch (error62) {
30425
- this.#store.remove(options.sessionId);
30426
- await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.closeProcess());
30427
- throw error62;
30428
30365
  } finally {
30429
30366
  this.#nativeOperations.delete(openedKey);
30430
30367
  this.#notifyProcessCapacityChanged();
@@ -34021,7 +33958,7 @@ function createNativeSessionRequestHandler(dependencies) {
34021
33958
  };
34022
33959
  const handle = (command) => {
34023
33960
  const previous = [...pending.values()].filter((request) => request.agentId === command.agentId);
34024
- const parallelRead = command.action === "linked-history" || command.action === "active-turn";
33961
+ const parallelRead = command.action === "active-turn";
34025
33962
  if (pending.has(command.requestId) || pending.size >= 4 || !parallelRead && previous.some((request) => !request.controller.signal.aborted)) {
34026
33963
  reportOperationFailure(
34027
33964
  socket,
@@ -34140,7 +34077,6 @@ async function readAcpHistory(sessions, directories, bindingId, options, nativeS
34140
34077
 
34141
34078
  // src/native-sessions/acp-adapter.ts
34142
34079
  var acpSessionAdapter = {
34143
- linkedHistory: async ({ sessions, directories, bindingId, options, nativeSessionId }) => await readAcpHistory(sessions, directories, bindingId, options, nativeSessionId),
34144
34080
  history: async ({ sessions, directories, bindingId, options, nativeSessionId }) => await readAcpHistory(sessions, directories, bindingId, options, nativeSessionId),
34145
34081
  preview: async ({ sessions, options, nativeSessionId }) => await sessions.previewNativeSession(options, nativeSessionId)
34146
34082
  };
@@ -34160,7 +34096,6 @@ async function verifiedHistory(context, full) {
34160
34096
  return snapshot.history;
34161
34097
  }
34162
34098
  var codexSessionAdapter = {
34163
- linkedHistory: async (context) => await verifiedHistory(context, true),
34164
34099
  history: async (context) => await verifiedHistory(context, true),
34165
34100
  // Codex enforces an exclusive writer per thread. Its read-only app-server
34166
34101
  // history path keeps externally owned conversations previewable.
@@ -34169,9 +34104,6 @@ var codexSessionAdapter = {
34169
34104
 
34170
34105
  // src/native-sessions/agent-adapter.ts
34171
34106
  var genericSessionAdapter = {
34172
- linkedHistory: async () => {
34173
- throw new AcpExecutionError("This Agent does not support Chat history", {}, "native_session_unsupported");
34174
- },
34175
34107
  history: async () => {
34176
34108
  throw new AcpExecutionError("Native history is unavailable for this Agent", {}, "native_session_unsupported");
34177
34109
  },
@@ -34231,42 +34163,6 @@ var NativeSessionService = class {
34231
34163
  turn: this.#activeTurn(command)
34232
34164
  };
34233
34165
  }
34234
- if (command.action === "linked-history") {
34235
- const nativeSessionId = nativeSessionIdSchema.parse(command.targetSessionId);
34236
- if (this.#sessions.hasPreparedSession(nativeSessionId, options.agent.id, cwd, additionalDirectories) && await this.#sessions.loadLinkedSessionHistory({ ...options, sessionId: nativeSessionId }) === null) {
34237
- this.record(command, "native_session_history_read");
34238
- return {
34239
- action: "linked-history",
34240
- history: {
34241
- status: "available",
34242
- messages: [],
34243
- truncated: false,
34244
- coveredCommandIds: [],
34245
- coveredMessageIds: []
34246
- },
34247
- kind: "native.session.result",
34248
- requestId: command.requestId,
34249
- sessionId: command.sessionId,
34250
- targetSessionId: command.targetSessionId
34251
- };
34252
- }
34253
- const history = await nativeSessionAdapter(options.agent.id).linkedHistory({
34254
- sessions: this.#sessions,
34255
- directories: this.#directories,
34256
- bindingId: command.bindingId,
34257
- options,
34258
- nativeSessionId
34259
- });
34260
- this.record(command, "native_session_history_read");
34261
- return {
34262
- action: "linked-history",
34263
- history,
34264
- kind: "native.session.result",
34265
- requestId: command.requestId,
34266
- sessionId: command.sessionId,
34267
- targetSessionId: command.targetSessionId
34268
- };
34269
- }
34270
34166
  if (command.action === "create") {
34271
34167
  if (!supportsNativeChat(options.agent.id)) {
34272
34168
  throw new AcpExecutionError(
@@ -34477,7 +34373,7 @@ var NativeSessionService = class {
34477
34373
  deletedSessionIds
34478
34374
  };
34479
34375
  }
34480
- const action = command.action === "import-only" ? "import" : command.action === "fork-only" ? "fork" : command.action;
34376
+ const action = command.action;
34481
34377
  if (action === "import" && !prepared.capabilities.loadSession && !prepared.capabilities.resumeSession) {
34482
34378
  throw new AcpExecutionError("This Agent cannot import native sessions", {}, "native_session_unsupported");
34483
34379
  }
@@ -34502,8 +34398,7 @@ var NativeSessionService = class {
34502
34398
  sessionId: command.targetSessionId,
34503
34399
  additionalDirectories: target.additionalDirectories
34504
34400
  },
34505
- { kind: action, nativeSessionId: target.info.sessionId },
34506
- command.action !== "import-only" && command.action !== "fork-only"
34401
+ { kind: action, nativeSessionId: target.info.sessionId }
34507
34402
  );
34508
34403
  signal.throwIfAborted();
34509
34404
  const ready = {
@@ -34527,8 +34422,7 @@ var NativeSessionService = class {
34527
34422
  action,
34528
34423
  ready,
34529
34424
  targetSessionId: command.targetSessionId,
34530
- title: target.info.title ?? "Untitled session",
34531
- history: opened.history
34425
+ title: target.info.title ?? "Untitled session"
34532
34426
  };
34533
34427
  };
34534
34428
  querySessions = async (sessionIds, signal) => {
@@ -35535,6 +35429,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
35535
35429
  );
35536
35430
  return;
35537
35431
  }
35432
+ if (kind === SESSION_QUERY_KIND) {
35433
+ const command2 = message;
35434
+ void nativeSessions.querySessions(command2.sessionIds, connectionController.signal).then((entries) => {
35435
+ send(socket, {
35436
+ entries,
35437
+ kind: SESSION_QUERIED_KIND,
35438
+ requestId: command2.requestId
35439
+ });
35440
+ }).catch((error62) => {
35441
+ reportOperationFailure(socket, command2.requestId, "", error62);
35442
+ });
35443
+ return;
35444
+ }
35538
35445
  if (kind === SESSION_PERMISSION_RESPOND_KIND) {
35539
35446
  const command2 = message;
35540
35447
  void sessions.respondPermission(command2).then(() => {