@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/index.js CHANGED
@@ -20978,7 +20978,6 @@ var identity = {
20978
20978
  };
20979
20979
  var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
20980
20980
  external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
20981
- external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
20982
20981
  external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
20983
20982
  external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
20984
20983
  external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
@@ -21002,7 +21001,6 @@ var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
21002
21001
  ]);
21003
21002
  var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
21004
21003
  external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
21005
- external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
21006
21004
  external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
21007
21005
  external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
21008
21006
  external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
@@ -21018,12 +21016,6 @@ var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
21018
21016
  entryId: identifier,
21019
21017
  targetSessionId: identifier
21020
21018
  }).readonly(),
21021
- external_exports.strictObject({
21022
- ...identity,
21023
- action: external_exports.enum(["import-only", "fork-only"]),
21024
- entryId: identifier,
21025
- targetSessionId: identifier
21026
- }).readonly(),
21027
21019
  external_exports.strictObject({
21028
21020
  ...identity,
21029
21021
  action: external_exports.literal("delete"),
@@ -21046,12 +21038,6 @@ var resultEnvelope = {
21046
21038
  };
21047
21039
  var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
21048
21040
  external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifier }).readonly(),
21049
- external_exports.strictObject({
21050
- ...resultEnvelope,
21051
- action: external_exports.literal("linked-history"),
21052
- targetSessionId: identifier,
21053
- history: sessionHistorySchema
21054
- }).readonly(),
21055
21041
  external_exports.strictObject({
21056
21042
  ...resultEnvelope,
21057
21043
  action: external_exports.literal("active-turn"),
@@ -21070,11 +21056,6 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
21070
21056
  state: external_exports.literal("running")
21071
21057
  }).readonly().nullable()
21072
21058
  }).readonly(),
21073
- external_exports.strictObject({
21074
- ...resultEnvelope,
21075
- action: external_exports.literal("unlinked-history"),
21076
- targetSessionId: identifier
21077
- }).readonly(),
21078
21059
  external_exports.strictObject({
21079
21060
  ...resultEnvelope,
21080
21061
  action: external_exports.literal("find"),
@@ -21092,7 +21073,6 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
21092
21073
  action: external_exports.enum(["import", "fork"]),
21093
21074
  targetSessionId: identifier,
21094
21075
  ready: sessionReadyEventSchema,
21095
- history: sessionHistorySchema,
21096
21076
  title: external_exports.string().max(500)
21097
21077
  }).readonly(),
21098
21078
  external_exports.strictObject({
@@ -24179,15 +24159,6 @@ var PendingElicitation = class {
24179
24159
  var PROCESS_STOP_TIMEOUT_MILLISECONDS = 1e3;
24180
24160
  var MAX_PRE_SESSION_UPDATES = 100;
24181
24161
  var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
24182
- function nativeHistoryNotRetained() {
24183
- return {
24184
- cause: {
24185
- code: "native_history_not_retained",
24186
- message: "Native message history is not retained in the cloud for this Session."
24187
- },
24188
- status: "unavailable"
24189
- };
24190
- }
24191
24162
  var NullAcpSessionObserver = class {
24192
24163
  onCommands = () => Promise.resolve();
24193
24164
  onConfig = () => Promise.resolve();
@@ -25934,7 +25905,7 @@ var AcpSessionManager = class {
25934
25905
  return await this.#startRetainedSessionProcess(
25935
25906
  options,
25936
25907
  async () => await AcpProcessSession.start(
25937
- this.#sessionIdentity === "native" && isNativeChatSessionId(options.agent.id, options.sessionId) && this.#store.read(options.sessionId) instanceof MissingAcpStoredSession ? { ...options, origin: { kind: "import", nativeSessionId: options.sessionId } } : options,
25908
+ 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,
25938
25909
  () => this.#observer,
25939
25910
  this.#store,
25940
25911
  metrics
@@ -26477,26 +26448,7 @@ var AcpSessionManager = class {
26477
26448
  this.#endSessionUse(options.sessionId);
26478
26449
  }
26479
26450
  };
26480
- loadLinkedSessionHistory = async (options) => {
26481
- options.signal.throwIfAborted();
26482
- const stored = this.#store.read(options.sessionId);
26483
- if (!(stored instanceof FoundAcpStoredSession) || !stored.session.prompted) {
26484
- return null;
26485
- }
26486
- const linked = stored.session;
26487
- 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])) {
26488
- throw new AcpExecutionError(
26489
- "The session belongs to another Agent or workspace",
26490
- {},
26491
- "session_identity_mismatch"
26492
- );
26493
- }
26494
- if (this.#nativeHistoryReader === null) {
26495
- return await this.loadSessionHistory(options);
26496
- }
26497
- return await this.#nativeHistoryReader.read(options, linked.nativeSessionId) ?? await this.loadSessionHistory(options);
26498
- };
26499
- openNativeSession = async (options, origin, loadHistory) => {
26451
+ openNativeSession = async (options, origin) => {
26500
26452
  const key = `${options.agent.id}:${origin.nativeSessionId}`;
26501
26453
  if (this.#nativeOperations.has(key)) {
26502
26454
  throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
@@ -26526,19 +26478,10 @@ var AcpSessionManager = class {
26526
26478
  }
26527
26479
  this.#nativeOperations.add(key);
26528
26480
  try {
26529
- const history = loadHistory ? await runtime.loadHistory(options.signal) : nativeHistoryNotRetained();
26530
26481
  return {
26531
26482
  prepared: runtime.prepared(),
26532
- sessionId: existing.sessionId,
26533
- history
26483
+ sessionId: existing.sessionId
26534
26484
  };
26535
- } catch (error62) {
26536
- await this.#retireSessionProcess(
26537
- existing.sessionId,
26538
- runtime,
26539
- async () => await runtime.closeProcess()
26540
- );
26541
- throw error62;
26542
26485
  } finally {
26543
26486
  this.#nativeOperations.delete(key);
26544
26487
  this.#notifyProcessCapacityChanged();
@@ -26557,16 +26500,10 @@ var AcpSessionManager = class {
26557
26500
  const openedKey = `${options.agent.id}:${runtime.nativeSessionId()}`;
26558
26501
  this.#nativeOperations.add(openedKey);
26559
26502
  try {
26560
- const history = loadHistory ? await runtime.loadHistory(options.signal) : nativeHistoryNotRetained();
26561
26503
  return {
26562
26504
  sessionId: options.sessionId,
26563
- prepared: runtime.prepared(),
26564
- history
26505
+ prepared: runtime.prepared()
26565
26506
  };
26566
- } catch (error62) {
26567
- this.#store.remove(options.sessionId);
26568
- await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.closeProcess());
26569
- throw error62;
26570
26507
  } finally {
26571
26508
  this.#nativeOperations.delete(openedKey);
26572
26509
  this.#notifyProcessCapacityChanged();
@@ -34899,7 +34836,7 @@ function createNativeSessionRequestHandler(dependencies) {
34899
34836
  };
34900
34837
  const handle = (command) => {
34901
34838
  const previous = [...pending.values()].filter((request) => request.agentId === command.agentId);
34902
- const parallelRead = command.action === "linked-history" || command.action === "active-turn";
34839
+ const parallelRead = command.action === "active-turn";
34903
34840
  if (pending.has(command.requestId) || pending.size >= 4 || !parallelRead && previous.some((request) => !request.controller.signal.aborted)) {
34904
34841
  reportOperationFailure(
34905
34842
  socket,
@@ -35018,7 +34955,6 @@ async function readAcpHistory(sessions, directories, bindingId, options, nativeS
35018
34955
 
35019
34956
  // src/native-sessions/acp-adapter.ts
35020
34957
  var acpSessionAdapter = {
35021
- linkedHistory: async ({ sessions, directories, bindingId, options, nativeSessionId }) => await readAcpHistory(sessions, directories, bindingId, options, nativeSessionId),
35022
34958
  history: async ({ sessions, directories, bindingId, options, nativeSessionId }) => await readAcpHistory(sessions, directories, bindingId, options, nativeSessionId),
35023
34959
  preview: async ({ sessions, options, nativeSessionId }) => await sessions.previewNativeSession(options, nativeSessionId)
35024
34960
  };
@@ -35038,7 +34974,6 @@ async function verifiedHistory(context, full) {
35038
34974
  return snapshot.history;
35039
34975
  }
35040
34976
  var codexSessionAdapter = {
35041
- linkedHistory: async (context) => await verifiedHistory(context, true),
35042
34977
  history: async (context) => await verifiedHistory(context, true),
35043
34978
  // Codex enforces an exclusive writer per thread. Its read-only app-server
35044
34979
  // history path keeps externally owned conversations previewable.
@@ -35047,9 +34982,6 @@ var codexSessionAdapter = {
35047
34982
 
35048
34983
  // src/native-sessions/agent-adapter.ts
35049
34984
  var genericSessionAdapter = {
35050
- linkedHistory: async () => {
35051
- throw new AcpExecutionError("This Agent does not support Chat history", {}, "native_session_unsupported");
35052
- },
35053
34985
  history: async () => {
35054
34986
  throw new AcpExecutionError("Native history is unavailable for this Agent", {}, "native_session_unsupported");
35055
34987
  },
@@ -35109,42 +35041,6 @@ var NativeSessionService = class {
35109
35041
  turn: this.#activeTurn(command)
35110
35042
  };
35111
35043
  }
35112
- if (command.action === "linked-history") {
35113
- const nativeSessionId = nativeSessionIdSchema.parse(command.targetSessionId);
35114
- if (this.#sessions.hasPreparedSession(nativeSessionId, options.agent.id, cwd, additionalDirectories) && await this.#sessions.loadLinkedSessionHistory({ ...options, sessionId: nativeSessionId }) === null) {
35115
- this.record(command, "native_session_history_read");
35116
- return {
35117
- action: "linked-history",
35118
- history: {
35119
- status: "available",
35120
- messages: [],
35121
- truncated: false,
35122
- coveredCommandIds: [],
35123
- coveredMessageIds: []
35124
- },
35125
- kind: "native.session.result",
35126
- requestId: command.requestId,
35127
- sessionId: command.sessionId,
35128
- targetSessionId: command.targetSessionId
35129
- };
35130
- }
35131
- const history = await nativeSessionAdapter(options.agent.id).linkedHistory({
35132
- sessions: this.#sessions,
35133
- directories: this.#directories,
35134
- bindingId: command.bindingId,
35135
- options,
35136
- nativeSessionId
35137
- });
35138
- this.record(command, "native_session_history_read");
35139
- return {
35140
- action: "linked-history",
35141
- history,
35142
- kind: "native.session.result",
35143
- requestId: command.requestId,
35144
- sessionId: command.sessionId,
35145
- targetSessionId: command.targetSessionId
35146
- };
35147
- }
35148
35044
  if (command.action === "create") {
35149
35045
  if (!supportsNativeChat(options.agent.id)) {
35150
35046
  throw new AcpExecutionError(
@@ -35355,7 +35251,7 @@ var NativeSessionService = class {
35355
35251
  deletedSessionIds
35356
35252
  };
35357
35253
  }
35358
- const action = command.action === "import-only" ? "import" : command.action === "fork-only" ? "fork" : command.action;
35254
+ const action = command.action;
35359
35255
  if (action === "import" && !prepared.capabilities.loadSession && !prepared.capabilities.resumeSession) {
35360
35256
  throw new AcpExecutionError("This Agent cannot import native sessions", {}, "native_session_unsupported");
35361
35257
  }
@@ -35380,8 +35276,7 @@ var NativeSessionService = class {
35380
35276
  sessionId: command.targetSessionId,
35381
35277
  additionalDirectories: target.additionalDirectories
35382
35278
  },
35383
- { kind: action, nativeSessionId: target.info.sessionId },
35384
- command.action !== "import-only" && command.action !== "fork-only"
35279
+ { kind: action, nativeSessionId: target.info.sessionId }
35385
35280
  );
35386
35281
  signal.throwIfAborted();
35387
35282
  const ready = {
@@ -35405,8 +35300,7 @@ var NativeSessionService = class {
35405
35300
  action,
35406
35301
  ready,
35407
35302
  targetSessionId: command.targetSessionId,
35408
- title: target.info.title ?? "Untitled session",
35409
- history: opened.history
35303
+ title: target.info.title ?? "Untitled session"
35410
35304
  };
35411
35305
  };
35412
35306
  querySessions = async (sessionIds, signal) => {
@@ -36393,6 +36287,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
36393
36287
  );
36394
36288
  return;
36395
36289
  }
36290
+ if (kind === SESSION_QUERY_KIND) {
36291
+ const command2 = message;
36292
+ void nativeSessions.querySessions(command2.sessionIds, connectionController.signal).then((entries) => {
36293
+ send(socket, {
36294
+ entries,
36295
+ kind: SESSION_QUERIED_KIND,
36296
+ requestId: command2.requestId
36297
+ });
36298
+ }).catch((error62) => {
36299
+ reportOperationFailure(socket, command2.requestId, "", error62);
36300
+ });
36301
+ return;
36302
+ }
36396
36303
  if (kind === SESSION_PERMISSION_RESPOND_KIND) {
36397
36304
  const command2 = message;
36398
36305
  void sessions.respondPermission(command2).then(() => {