@moxt-ai/mobius 0.0.163 → 0.0.165

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/agent-runtime-manager.d.ts +3 -2
  2. package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
  3. package/dist/acp/agent-runtime-manager.js +17 -1
  4. package/dist/acp/agent-runtime-manager.js.map +1 -1
  5. package/dist/acp/codex/app-server-client.d.ts.map +1 -1
  6. package/dist/acp/codex/app-server-client.js +23 -12
  7. package/dist/acp/codex/app-server-client.js.map +1 -1
  8. package/dist/agent-catalog/agents/pi-agent.d.ts +1 -1
  9. package/dist/agent-catalog/agents/pi-agent.d.ts.map +1 -1
  10. package/dist/agent-catalog/agents/pi-agent.js +1 -1
  11. package/dist/agent-catalog/agents/pi-agent.js.map +1 -1
  12. package/dist/agent-installation/pi-managed-packages.js +2 -2
  13. package/dist/agent-installation/pi-managed-packages.js.map +1 -1
  14. package/dist/cli.js +123 -40
  15. package/dist/cli.js.map +2 -2
  16. package/dist/index.js +122 -39
  17. package/dist/index.js.map +2 -2
  18. package/dist/native-sessions/codex-history.d.ts.map +1 -1
  19. package/dist/native-sessions/codex-history.js +22 -11
  20. package/dist/native-sessions/codex-history.js.map +1 -1
  21. package/dist/native-sessions/service.d.ts.map +1 -1
  22. package/dist/native-sessions/service.js +1 -0
  23. package/dist/native-sessions/service.js.map +1 -1
  24. package/dist/relay-connection/session-event-publisher.d.ts +2 -1
  25. package/dist/relay-connection/session-event-publisher.d.ts.map +1 -1
  26. package/dist/relay-connection/session-event-publisher.js +17 -0
  27. package/dist/relay-connection/session-event-publisher.js.map +1 -1
  28. package/dist/run-daemon.d.ts.map +1 -1
  29. package/dist/run-daemon.js +1 -1
  30. package/dist/run-daemon.js.map +1 -1
  31. package/dist/runtime.js +122 -39
  32. package/dist/runtime.js.map +2 -2
  33. 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.163",
3384
+ version: "0.0.165",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -24873,7 +24873,7 @@ var threadSettingsUpdatedSchema = external_exports.object({
24873
24873
 
24874
24874
  // src/acp/codex/app-server-client.ts
24875
24875
  var INITIALIZE_TIMEOUT_MILLISECONDS = 3e4;
24876
- var OUTPUT_LIMIT_BYTES = 32 * 1024 * 1024;
24876
+ var MESSAGE_OUTPUT_LIMIT_BYTES = 32 * 1024 * 1024;
24877
24877
  var CodexAppServerError = class extends AcpExecutionError {
24878
24878
  constructor(code, message, options = {}) {
24879
24879
  super(message, options, code);
@@ -24890,8 +24890,8 @@ var CodexAppServerClient = class {
24890
24890
  kind: "open"
24891
24891
  };
24892
24892
  #nextRequestId = 1;
24893
- #pendingBuffer = "";
24894
- #receivedBytes = 0;
24893
+ #pendingBytes = 0;
24894
+ #pendingFragments = [];
24895
24895
  constructor(options) {
24896
24896
  this.#handlers = options.handlers;
24897
24897
  this.#child = spawn2(options.command, ["app-server"], {
@@ -24967,25 +24967,39 @@ var CodexAppServerClient = class {
24967
24967
  return;
24968
24968
  }
24969
24969
  try {
24970
- this.#receivedBytes += Buffer.byteLength(chunk);
24971
- if (this.#receivedBytes > OUTPUT_LIMIT_BYTES) {
24972
- throw new CodexAppServerError(
24973
- "codex_app_server_output_limit",
24974
- "The Codex app-server produced too much output"
24975
- );
24976
- }
24977
- this.#pendingBuffer += chunk;
24978
- let newline = this.#pendingBuffer.indexOf("\n");
24970
+ let cursor = 0;
24971
+ let newline = chunk.indexOf("\n");
24979
24972
  while (newline >= 0) {
24980
- const line = this.#pendingBuffer.slice(0, newline);
24981
- this.#pendingBuffer = this.#pendingBuffer.slice(newline + 1);
24982
- newline = this.#pendingBuffer.indexOf("\n");
24973
+ const fragment = chunk.slice(cursor, newline);
24974
+ const lineBytes = this.#pendingBytes + Buffer.byteLength(fragment);
24975
+ if (lineBytes > MESSAGE_OUTPUT_LIMIT_BYTES) {
24976
+ throw new CodexAppServerError(
24977
+ "codex_app_server_output_limit",
24978
+ "The Codex app-server produced an oversized message"
24979
+ );
24980
+ }
24981
+ const line = this.#pendingFragments.length === 0 ? fragment : [...this.#pendingFragments, fragment].join("");
24982
+ this.#pendingBytes = 0;
24983
+ this.#pendingFragments = [];
24984
+ cursor = newline + 1;
24985
+ newline = chunk.indexOf("\n", cursor);
24983
24986
  if (line.trim().length === 0) {
24984
24987
  continue;
24985
24988
  }
24986
24989
  const value = JSON.parse(line);
24987
24990
  this.#dispatch(decodeAppServerMessage(value));
24988
24991
  }
24992
+ const remainder = chunk.slice(cursor);
24993
+ if (remainder.length > 0) {
24994
+ this.#pendingBytes += Buffer.byteLength(remainder);
24995
+ if (this.#pendingBytes > MESSAGE_OUTPUT_LIMIT_BYTES) {
24996
+ throw new CodexAppServerError(
24997
+ "codex_app_server_output_limit",
24998
+ "The Codex app-server produced an oversized message"
24999
+ );
25000
+ }
25001
+ this.#pendingFragments.push(remainder);
25002
+ }
24989
25003
  } catch (error62) {
24990
25004
  this.#fail(
24991
25005
  error62 instanceof CodexAppServerError ? error62 : new CodexAppServerError(
@@ -27340,17 +27354,17 @@ import {
27340
27354
  // src/agent-installation/pi-managed-packages.ts
27341
27355
  var PI_ACP_PACKAGE = new SriManagedNpmPackageDefinition(
27342
27356
  "pi-acp",
27343
- "0.0.33",
27357
+ "0.0.34",
27344
27358
  "pi-acp",
27345
- "sha512-vX9kY1tK14E72G4dBAx+RGCk/k7XPjTHls6dLUxA8WSkBav6B6JHuSBv3eusp50LCR/GTRsR2kIKsG0Z5jANzw==",
27346
- "https://registry.npmjs.org/pi-acp/-/pi-acp-0.0.33.tgz"
27359
+ "sha512-MrCp37UbpUzkTkzTIMJQf1RYrT+kr4fgGDGFoLmBN26UupuCZp0XxVIY+7XYsMo3yDnzDeZUJ0jPyM3Si6Bkkg==",
27360
+ "https://registry.npmjs.org/pi-acp/-/pi-acp-0.0.34.tgz"
27347
27361
  );
27348
27362
  var PI_AGENT_PACKAGE = new SriManagedNpmPackageDefinition(
27349
27363
  "@earendil-works/pi-coding-agent",
27350
- "0.85.0",
27364
+ "1.1.0",
27351
27365
  "pi",
27352
- "sha512-INxVkLAVfAMju5MojJpmyu/0bMP+r+ffZuS7UqVv32E2JwHBRbcHfELDfmFNvapEbgYfKN2r9OYO1p3TqDBR+g==",
27353
- "https://registry.npmjs.org/@earendil-works/pi-coding-agent/-/pi-coding-agent-0.85.0.tgz"
27366
+ "sha512-SeEi/4hdcHNgA9UWlefZl7ZZpm3dzi2OoxNjDHsBJ9o298LNOtbL4DGKgitlEj6uCTccvtw6f2hlCkTPVJ2RXg==",
27367
+ "https://registry.npmjs.org/@earendil-works/pi-coding-agent/-/pi-coding-agent-1.1.0.tgz"
27354
27368
  );
27355
27369
 
27356
27370
  // src/agent-catalog/agents/pi-agent.ts
@@ -27366,7 +27380,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
27366
27380
  agentOverrideVariable = "MOBIUS_PI_PATH";
27367
27381
  id = "pi";
27368
27382
  label = "Pi";
27369
- minimumSupportedAgentVersion = PI_AGENT_PACKAGE.version;
27383
+ minimumSupportedAgentVersion = "0.85.0";
27370
27384
  maximumTestedAgentVersion = PI_AGENT_PACKAGE.version;
27371
27385
  managedAdapterExecutablePath = [
27372
27386
  "adapters",
@@ -28361,6 +28375,7 @@ var SESSION_LIST_KIND = "session.list";
28361
28375
  var SESSION_LISTED_KIND = "session.listed";
28362
28376
  var SESSION_QUERY_KIND = "session.query";
28363
28377
  var SESSION_QUERIED_KIND = "session.queried";
28378
+ var SESSION_STATUS_CHANGED_KIND = "session.status.changed";
28364
28379
  var SESSION_CONFIGURE_KIND = "session.configure";
28365
28380
  var SESSION_CONFIG_UPDATED_KIND = "session.config.updated";
28366
28381
  var SESSION_USAGE_UPDATED_KIND = "session.usage.updated";
@@ -28400,6 +28415,18 @@ var workspaceEntrySchema = external_exports.strictObject({
28400
28415
  directoryId: DIRECTORY_IDENTIFIER,
28401
28416
  name: external_exports.string().min(1).max(255)
28402
28417
  }).readonly();
28418
+ var sessionStatusSchema = external_exports.discriminatedUnion("kind", [
28419
+ external_exports.strictObject({ kind: external_exports.literal("idle") }).readonly(),
28420
+ external_exports.strictObject({
28421
+ commandId: identifierStringSchema,
28422
+ kind: external_exports.literal("working")
28423
+ }).readonly()
28424
+ ]);
28425
+ var sessionStatusChangedEventSchema = external_exports.strictObject({
28426
+ kind: external_exports.literal(SESSION_STATUS_CHANGED_KIND),
28427
+ sessionId: identifierStringSchema,
28428
+ status: sessionStatusSchema
28429
+ }).readonly();
28403
28430
  var sessionMetadataSchema = external_exports.strictObject({
28404
28431
  additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
28405
28432
  agentId: identifierStringSchema,
@@ -28407,6 +28434,7 @@ var sessionMetadataSchema = external_exports.strictObject({
28407
28434
  directoryLabel: external_exports.string().min(1).max(2048),
28408
28435
  prompted: external_exports.boolean(),
28409
28436
  sessionId: identifierStringSchema,
28437
+ status: sessionStatusSchema,
28410
28438
  title: external_exports.string().max(500),
28411
28439
  updatedAt: external_exports.iso.datetime({ offset: true })
28412
28440
  }).readonly();
@@ -28981,6 +29009,8 @@ var decodeSessionQueryCommand = (encoded) => decode3(encoded, sessionQueryComman
28981
29009
  var encodeSessionQueryCommand = (message) => encode3(message, sessionQueryCommandSchema);
28982
29010
  var decodeSessionsQueriedEvent = (encoded) => decode3(encoded, sessionsQueriedEventSchema);
28983
29011
  var encodeSessionsQueriedEvent = (message) => encode3(message, sessionsQueriedEventSchema);
29012
+ var decodeSessionStatusChangedEvent = (encoded) => decode3(encoded, sessionStatusChangedEventSchema);
29013
+ var encodeSessionStatusChangedEvent = (message) => encode3(message, sessionStatusChangedEventSchema);
28984
29014
  var decodeSessionPrepareCommand = (encoded) => decode3(encoded, sessionPrepareCommandSchema);
28985
29015
  var encodeSessionPrepareCommand = (message) => encode3(message, sessionPrepareCommandSchema);
28986
29016
  var decodeSessionReadyEvent = (encoded) => decode3(encoded, sessionReadyEventSchema);
@@ -30589,6 +30619,11 @@ var daemonToServiceSignatures = {
30589
30619
  encodeSessionsQueriedEvent,
30590
30620
  decodeSessionsQueriedEvent
30591
30621
  ),
30622
+ [SESSION_STATUS_CHANGED_KIND]: defineMessageSignature(
30623
+ SESSION_STATUS_CHANGED_KIND,
30624
+ encodeSessionStatusChangedEvent,
30625
+ decodeSessionStatusChangedEvent
30626
+ ),
30592
30627
  [SESSION_QUEUED_KIND]: defineMessageSignature(
30593
30628
  SESSION_QUEUED_KIND,
30594
30629
  encodeSessionQueuedEvent,
@@ -41111,12 +41146,14 @@ var AgentRuntimeManager = class {
41111
41146
  #store;
41112
41147
  #nativeHistoryReader;
41113
41148
  #sessionIdentity;
41149
+ #onSessionStatusChanged;
41114
41150
  #observer;
41115
- constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned") {
41151
+ constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0) {
41116
41152
  this.#observer = observer;
41117
41153
  this.#store = store;
41118
41154
  this.#nativeHistoryReader = nativeHistoryReader;
41119
41155
  this.#sessionIdentity = sessionIdentity;
41156
+ this.#onSessionStatusChanged = onSessionStatusChanged;
41120
41157
  }
41121
41158
  setObserver = (observer) => {
41122
41159
  this.#observer = observer;
@@ -41423,6 +41460,11 @@ var AgentRuntimeManager = class {
41423
41460
  }
41424
41461
  this.#executions.begin(options2.sessionId, options2.commandId);
41425
41462
  try {
41463
+ this.#onSessionStatusChanged({
41464
+ kind: "session.status.changed",
41465
+ sessionId: options2.sessionId,
41466
+ status: { commandId: options2.commandId, kind: "working" }
41467
+ });
41426
41468
  if (this.#executions.cancellation(options2.sessionId) !== void 0) {
41427
41469
  return { stopReason: "cancelled" };
41428
41470
  }
@@ -41466,6 +41508,11 @@ var AgentRuntimeManager = class {
41466
41508
  await this.#executions.cancellation(options2.sessionId);
41467
41509
  } finally {
41468
41510
  this.#executions.finish(options2.sessionId, options2.commandId);
41511
+ this.#onSessionStatusChanged({
41512
+ kind: "session.status.changed",
41513
+ sessionId: options2.sessionId,
41514
+ status: { kind: "idle" }
41515
+ });
41469
41516
  this.#executionProcesses.touch(options2.sessionId);
41470
41517
  this.#processes.notifyChanged();
41471
41518
  }
@@ -41498,6 +41545,10 @@ var AgentRuntimeManager = class {
41498
41545
  const stored = this.#store.read(sessionId);
41499
41546
  return stored instanceof FoundAcpStoredSession ? [stored.session] : [];
41500
41547
  });
41548
+ sessionStatus = (sessionId) => {
41549
+ const commandId = this.#executions.command(sessionId);
41550
+ return commandId === void 0 ? { kind: "idle" } : { commandId, kind: "working" };
41551
+ };
41501
41552
  listSessions = (limit) => this.#store.list().filter((session) => session.prompted).slice(0, limit);
41502
41553
  findLinkedSessions = (agentId, nativeSessionId) => this.#store.findNative(agentId, nativeSessionId);
41503
41554
  hasPreparedSession = (sessionId, agentId, cwd, additionalDirectories) => this.#executionProcesses.get(sessionId)?.belongsTo(agentId, cwd, additionalDirectories) === true;
@@ -43943,8 +43994,8 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
43943
43994
  const response = Promise.withResolvers();
43944
43995
  let state = { kind: "initializing", requestId: 1 };
43945
43996
  const seenCursors = /* @__PURE__ */ new Set();
43946
- let pending = "";
43947
- let receivedBytes = 0;
43997
+ let pendingBytes = 0;
43998
+ let pendingFragments = [];
43948
43999
  const fail = (cause) => response.reject(
43949
44000
  cause instanceof AcpExecutionError ? cause : new AcpExecutionError(
43950
44001
  "Saved Codex history could not be read.",
@@ -43958,20 +44009,23 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
43958
44009
  };
43959
44010
  const onData = (chunk) => {
43960
44011
  try {
43961
- receivedBytes += Buffer.byteLength(chunk);
43962
- if (receivedBytes > 32 * 1024 * 1024) {
43963
- throw new AcpExecutionError(
43964
- "This saved conversation is too large to preview.",
43965
- {},
43966
- "native_history_too_large"
43967
- );
43968
- }
43969
- pending += chunk;
43970
- let newline = pending.indexOf("\n");
44012
+ let cursor = 0;
44013
+ let newline = chunk.indexOf("\n");
43971
44014
  while (newline >= 0) {
43972
- const line = pending.slice(0, newline);
43973
- pending = pending.slice(newline + 1);
43974
- newline = pending.indexOf("\n");
44015
+ const fragment = chunk.slice(cursor, newline);
44016
+ const lineBytes = pendingBytes + Buffer.byteLength(fragment);
44017
+ if (lineBytes > 32 * 1024 * 1024) {
44018
+ throw new AcpExecutionError(
44019
+ "This saved conversation is too large to preview.",
44020
+ {},
44021
+ "native_history_too_large"
44022
+ );
44023
+ }
44024
+ const line = pendingFragments.length === 0 ? fragment : [...pendingFragments, fragment].join("");
44025
+ pendingBytes = 0;
44026
+ pendingFragments = [];
44027
+ cursor = newline + 1;
44028
+ newline = chunk.indexOf("\n", cursor);
43975
44029
  if (line.trim().length === 0) {
43976
44030
  continue;
43977
44031
  }
@@ -44067,6 +44121,18 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
44067
44121
  }
44068
44122
  }
44069
44123
  }
44124
+ const remainder = chunk.slice(cursor);
44125
+ if (remainder.length > 0) {
44126
+ pendingBytes += Buffer.byteLength(remainder);
44127
+ if (pendingBytes > 32 * 1024 * 1024) {
44128
+ throw new AcpExecutionError(
44129
+ "This saved conversation is too large to preview.",
44130
+ {},
44131
+ "native_history_too_large"
44132
+ );
44133
+ }
44134
+ pendingFragments.push(remainder);
44135
+ }
44070
44136
  } catch (cause) {
44071
44137
  fail(cause);
44072
44138
  }
@@ -44585,6 +44651,7 @@ var NativeSessionService = class {
44585
44651
  directoryLabel: directory.label,
44586
44652
  prompted: session.prompted,
44587
44653
  sessionId: session.sessionId,
44654
+ status: this.#sessions.sessionStatus(session.sessionId),
44588
44655
  title: session.title || "Untitled session",
44589
44656
  updatedAt: session.updatedAt
44590
44657
  });
@@ -47799,6 +47866,21 @@ var DaemonSessionEventPublisher = class {
47799
47866
  this.publish(sessionId, event);
47800
47867
  }
47801
47868
  };
47869
+ publishStatus = (event) => {
47870
+ const socket = this.#socket;
47871
+ if (socket === null || socket.readyState !== WebSocket9.OPEN) {
47872
+ return;
47873
+ }
47874
+ const encoded = encodeDaemonToServiceMessage(event);
47875
+ if (socket.bufferedAmount + Buffer.byteLength(encoded, "utf8") > MAX_BUFFERED_BYTES) {
47876
+ socket.close(1013, "Live event transport overloaded");
47877
+ return;
47878
+ }
47879
+ try {
47880
+ socket.send(encoded);
47881
+ } catch {
47882
+ }
47883
+ };
47802
47884
  publishV2 = (event) => {
47803
47885
  this.#store.appendExecutingPromptEventV2(event);
47804
47886
  const socket = this.#socket;
@@ -48111,7 +48193,8 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
48111
48193
  nativeTurn
48112
48194
  )).history : null
48113
48195
  },
48114
- "native"
48196
+ "native",
48197
+ publisher.publishStatus
48115
48198
  );
48116
48199
  const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
48117
48200
  const installationObserver = new DaemonInstallationObserver();