@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/index.js CHANGED
@@ -19791,6 +19791,7 @@ var SESSION_LIST_KIND = "session.list";
19791
19791
  var SESSION_LISTED_KIND = "session.listed";
19792
19792
  var SESSION_QUERY_KIND = "session.query";
19793
19793
  var SESSION_QUERIED_KIND = "session.queried";
19794
+ var SESSION_STATUS_CHANGED_KIND = "session.status.changed";
19794
19795
  var SESSION_CONFIGURE_KIND = "session.configure";
19795
19796
  var SESSION_CONFIG_UPDATED_KIND = "session.config.updated";
19796
19797
  var SESSION_USAGE_UPDATED_KIND = "session.usage.updated";
@@ -19830,6 +19831,18 @@ var workspaceEntrySchema = external_exports.strictObject({
19830
19831
  directoryId: DIRECTORY_IDENTIFIER,
19831
19832
  name: external_exports.string().min(1).max(255)
19832
19833
  }).readonly();
19834
+ var sessionStatusSchema = external_exports.discriminatedUnion("kind", [
19835
+ external_exports.strictObject({ kind: external_exports.literal("idle") }).readonly(),
19836
+ external_exports.strictObject({
19837
+ commandId: identifierStringSchema,
19838
+ kind: external_exports.literal("working")
19839
+ }).readonly()
19840
+ ]);
19841
+ var sessionStatusChangedEventSchema = external_exports.strictObject({
19842
+ kind: external_exports.literal(SESSION_STATUS_CHANGED_KIND),
19843
+ sessionId: identifierStringSchema,
19844
+ status: sessionStatusSchema
19845
+ }).readonly();
19833
19846
  var sessionMetadataSchema = external_exports.strictObject({
19834
19847
  additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
19835
19848
  agentId: identifierStringSchema,
@@ -19837,6 +19850,7 @@ var sessionMetadataSchema = external_exports.strictObject({
19837
19850
  directoryLabel: external_exports.string().min(1).max(2048),
19838
19851
  prompted: external_exports.boolean(),
19839
19852
  sessionId: identifierStringSchema,
19853
+ status: sessionStatusSchema,
19840
19854
  title: external_exports.string().max(500),
19841
19855
  updatedAt: external_exports.iso.datetime({ offset: true })
19842
19856
  }).readonly();
@@ -20411,6 +20425,8 @@ var decodeSessionQueryCommand = (encoded) => decode3(encoded, sessionQueryComman
20411
20425
  var encodeSessionQueryCommand = (message) => encode3(message, sessionQueryCommandSchema);
20412
20426
  var decodeSessionsQueriedEvent = (encoded) => decode3(encoded, sessionsQueriedEventSchema);
20413
20427
  var encodeSessionsQueriedEvent = (message) => encode3(message, sessionsQueriedEventSchema);
20428
+ var decodeSessionStatusChangedEvent = (encoded) => decode3(encoded, sessionStatusChangedEventSchema);
20429
+ var encodeSessionStatusChangedEvent = (message) => encode3(message, sessionStatusChangedEventSchema);
20414
20430
  var decodeSessionPrepareCommand = (encoded) => decode3(encoded, sessionPrepareCommandSchema);
20415
20431
  var encodeSessionPrepareCommand = (message) => encode3(message, sessionPrepareCommandSchema);
20416
20432
  var decodeSessionReadyEvent = (encoded) => decode3(encoded, sessionReadyEventSchema);
@@ -22019,6 +22035,11 @@ var daemonToServiceSignatures = {
22019
22035
  encodeSessionsQueriedEvent,
22020
22036
  decodeSessionsQueriedEvent
22021
22037
  ),
22038
+ [SESSION_STATUS_CHANGED_KIND]: defineMessageSignature(
22039
+ SESSION_STATUS_CHANGED_KIND,
22040
+ encodeSessionStatusChangedEvent,
22041
+ decodeSessionStatusChangedEvent
22042
+ ),
22022
22043
  [SESSION_QUEUED_KIND]: defineMessageSignature(
22023
22044
  SESSION_QUEUED_KIND,
22024
22045
  encodeSessionQueuedEvent,
@@ -32573,12 +32594,14 @@ var AgentRuntimeManager = class {
32573
32594
  #store;
32574
32595
  #nativeHistoryReader;
32575
32596
  #sessionIdentity;
32597
+ #onSessionStatusChanged;
32576
32598
  #observer;
32577
- constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned") {
32599
+ constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0) {
32578
32600
  this.#observer = observer;
32579
32601
  this.#store = store;
32580
32602
  this.#nativeHistoryReader = nativeHistoryReader;
32581
32603
  this.#sessionIdentity = sessionIdentity;
32604
+ this.#onSessionStatusChanged = onSessionStatusChanged;
32582
32605
  }
32583
32606
  setObserver = (observer) => {
32584
32607
  this.#observer = observer;
@@ -32885,6 +32908,11 @@ var AgentRuntimeManager = class {
32885
32908
  }
32886
32909
  this.#executions.begin(options2.sessionId, options2.commandId);
32887
32910
  try {
32911
+ this.#onSessionStatusChanged({
32912
+ kind: "session.status.changed",
32913
+ sessionId: options2.sessionId,
32914
+ status: { commandId: options2.commandId, kind: "working" }
32915
+ });
32888
32916
  if (this.#executions.cancellation(options2.sessionId) !== void 0) {
32889
32917
  return { stopReason: "cancelled" };
32890
32918
  }
@@ -32928,6 +32956,11 @@ var AgentRuntimeManager = class {
32928
32956
  await this.#executions.cancellation(options2.sessionId);
32929
32957
  } finally {
32930
32958
  this.#executions.finish(options2.sessionId, options2.commandId);
32959
+ this.#onSessionStatusChanged({
32960
+ kind: "session.status.changed",
32961
+ sessionId: options2.sessionId,
32962
+ status: { kind: "idle" }
32963
+ });
32931
32964
  this.#executionProcesses.touch(options2.sessionId);
32932
32965
  this.#processes.notifyChanged();
32933
32966
  }
@@ -32960,6 +32993,10 @@ var AgentRuntimeManager = class {
32960
32993
  const stored = this.#store.read(sessionId);
32961
32994
  return stored instanceof FoundAcpStoredSession ? [stored.session] : [];
32962
32995
  });
32996
+ sessionStatus = (sessionId) => {
32997
+ const commandId = this.#executions.command(sessionId);
32998
+ return commandId === void 0 ? { kind: "idle" } : { commandId, kind: "working" };
32999
+ };
32963
33000
  listSessions = (limit) => this.#store.list().filter((session) => session.prompted).slice(0, limit);
32964
33001
  findLinkedSessions = (agentId, nativeSessionId) => this.#store.findNative(agentId, nativeSessionId);
32965
33002
  hasPreparedSession = (sessionId, agentId, cwd, additionalDirectories) => this.#executionProcesses.get(sessionId)?.belongsTo(agentId, cwd, additionalDirectories) === true;
@@ -34076,7 +34113,7 @@ var threadSettingsUpdatedSchema = external_exports.object({
34076
34113
 
34077
34114
  // src/acp/codex/app-server-client.ts
34078
34115
  var INITIALIZE_TIMEOUT_MILLISECONDS = 3e4;
34079
- var OUTPUT_LIMIT_BYTES = 32 * 1024 * 1024;
34116
+ var MESSAGE_OUTPUT_LIMIT_BYTES = 32 * 1024 * 1024;
34080
34117
  var CodexAppServerError = class extends AcpExecutionError {
34081
34118
  constructor(code, message, options = {}) {
34082
34119
  super(message, options, code);
@@ -34093,8 +34130,8 @@ var CodexAppServerClient = class {
34093
34130
  kind: "open"
34094
34131
  };
34095
34132
  #nextRequestId = 1;
34096
- #pendingBuffer = "";
34097
- #receivedBytes = 0;
34133
+ #pendingBytes = 0;
34134
+ #pendingFragments = [];
34098
34135
  constructor(options) {
34099
34136
  this.#handlers = options.handlers;
34100
34137
  this.#child = spawn3(options.command, ["app-server"], {
@@ -34170,25 +34207,39 @@ var CodexAppServerClient = class {
34170
34207
  return;
34171
34208
  }
34172
34209
  try {
34173
- this.#receivedBytes += Buffer.byteLength(chunk);
34174
- if (this.#receivedBytes > OUTPUT_LIMIT_BYTES) {
34175
- throw new CodexAppServerError(
34176
- "codex_app_server_output_limit",
34177
- "The Codex app-server produced too much output"
34178
- );
34179
- }
34180
- this.#pendingBuffer += chunk;
34181
- let newline = this.#pendingBuffer.indexOf("\n");
34210
+ let cursor = 0;
34211
+ let newline = chunk.indexOf("\n");
34182
34212
  while (newline >= 0) {
34183
- const line = this.#pendingBuffer.slice(0, newline);
34184
- this.#pendingBuffer = this.#pendingBuffer.slice(newline + 1);
34185
- newline = this.#pendingBuffer.indexOf("\n");
34213
+ const fragment = chunk.slice(cursor, newline);
34214
+ const lineBytes = this.#pendingBytes + Buffer.byteLength(fragment);
34215
+ if (lineBytes > MESSAGE_OUTPUT_LIMIT_BYTES) {
34216
+ throw new CodexAppServerError(
34217
+ "codex_app_server_output_limit",
34218
+ "The Codex app-server produced an oversized message"
34219
+ );
34220
+ }
34221
+ const line = this.#pendingFragments.length === 0 ? fragment : [...this.#pendingFragments, fragment].join("");
34222
+ this.#pendingBytes = 0;
34223
+ this.#pendingFragments = [];
34224
+ cursor = newline + 1;
34225
+ newline = chunk.indexOf("\n", cursor);
34186
34226
  if (line.trim().length === 0) {
34187
34227
  continue;
34188
34228
  }
34189
34229
  const value = JSON.parse(line);
34190
34230
  this.#dispatch(decodeAppServerMessage(value));
34191
34231
  }
34232
+ const remainder = chunk.slice(cursor);
34233
+ if (remainder.length > 0) {
34234
+ this.#pendingBytes += Buffer.byteLength(remainder);
34235
+ if (this.#pendingBytes > MESSAGE_OUTPUT_LIMIT_BYTES) {
34236
+ throw new CodexAppServerError(
34237
+ "codex_app_server_output_limit",
34238
+ "The Codex app-server produced an oversized message"
34239
+ );
34240
+ }
34241
+ this.#pendingFragments.push(remainder);
34242
+ }
34192
34243
  } catch (error62) {
34193
34244
  this.#fail(
34194
34245
  error62 instanceof CodexAppServerError ? error62 : new CodexAppServerError(
@@ -36532,17 +36583,17 @@ import {
36532
36583
  // src/agent-installation/pi-managed-packages.ts
36533
36584
  var PI_ACP_PACKAGE = new SriManagedNpmPackageDefinition(
36534
36585
  "pi-acp",
36535
- "0.0.33",
36586
+ "0.0.34",
36536
36587
  "pi-acp",
36537
- "sha512-vX9kY1tK14E72G4dBAx+RGCk/k7XPjTHls6dLUxA8WSkBav6B6JHuSBv3eusp50LCR/GTRsR2kIKsG0Z5jANzw==",
36538
- "https://registry.npmjs.org/pi-acp/-/pi-acp-0.0.33.tgz"
36588
+ "sha512-MrCp37UbpUzkTkzTIMJQf1RYrT+kr4fgGDGFoLmBN26UupuCZp0XxVIY+7XYsMo3yDnzDeZUJ0jPyM3Si6Bkkg==",
36589
+ "https://registry.npmjs.org/pi-acp/-/pi-acp-0.0.34.tgz"
36539
36590
  );
36540
36591
  var PI_AGENT_PACKAGE = new SriManagedNpmPackageDefinition(
36541
36592
  "@earendil-works/pi-coding-agent",
36542
- "0.85.0",
36593
+ "1.1.0",
36543
36594
  "pi",
36544
- "sha512-INxVkLAVfAMju5MojJpmyu/0bMP+r+ffZuS7UqVv32E2JwHBRbcHfELDfmFNvapEbgYfKN2r9OYO1p3TqDBR+g==",
36545
- "https://registry.npmjs.org/@earendil-works/pi-coding-agent/-/pi-coding-agent-0.85.0.tgz"
36595
+ "sha512-SeEi/4hdcHNgA9UWlefZl7ZZpm3dzi2OoxNjDHsBJ9o298LNOtbL4DGKgitlEj6uCTccvtw6f2hlCkTPVJ2RXg==",
36596
+ "https://registry.npmjs.org/@earendil-works/pi-coding-agent/-/pi-coding-agent-1.1.0.tgz"
36546
36597
  );
36547
36598
 
36548
36599
  // src/agent-catalog/agents/pi-agent.ts
@@ -36558,7 +36609,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
36558
36609
  agentOverrideVariable = "MOBIUS_PI_PATH";
36559
36610
  id = "pi";
36560
36611
  label = "Pi";
36561
- minimumSupportedAgentVersion = PI_AGENT_PACKAGE.version;
36612
+ minimumSupportedAgentVersion = "0.85.0";
36562
36613
  maximumTestedAgentVersion = PI_AGENT_PACKAGE.version;
36563
36614
  managedAdapterExecutablePath = [
36564
36615
  "adapters",
@@ -40460,8 +40511,8 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
40460
40511
  const response = Promise.withResolvers();
40461
40512
  let state = { kind: "initializing", requestId: 1 };
40462
40513
  const seenCursors = /* @__PURE__ */ new Set();
40463
- let pending = "";
40464
- let receivedBytes = 0;
40514
+ let pendingBytes = 0;
40515
+ let pendingFragments = [];
40465
40516
  const fail = (cause) => response.reject(
40466
40517
  cause instanceof AcpExecutionError ? cause : new AcpExecutionError(
40467
40518
  "Saved Codex history could not be read.",
@@ -40475,20 +40526,23 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
40475
40526
  };
40476
40527
  const onData = (chunk) => {
40477
40528
  try {
40478
- receivedBytes += Buffer.byteLength(chunk);
40479
- if (receivedBytes > 32 * 1024 * 1024) {
40480
- throw new AcpExecutionError(
40481
- "This saved conversation is too large to preview.",
40482
- {},
40483
- "native_history_too_large"
40484
- );
40485
- }
40486
- pending += chunk;
40487
- let newline = pending.indexOf("\n");
40529
+ let cursor = 0;
40530
+ let newline = chunk.indexOf("\n");
40488
40531
  while (newline >= 0) {
40489
- const line = pending.slice(0, newline);
40490
- pending = pending.slice(newline + 1);
40491
- newline = pending.indexOf("\n");
40532
+ const fragment = chunk.slice(cursor, newline);
40533
+ const lineBytes = pendingBytes + Buffer.byteLength(fragment);
40534
+ if (lineBytes > 32 * 1024 * 1024) {
40535
+ throw new AcpExecutionError(
40536
+ "This saved conversation is too large to preview.",
40537
+ {},
40538
+ "native_history_too_large"
40539
+ );
40540
+ }
40541
+ const line = pendingFragments.length === 0 ? fragment : [...pendingFragments, fragment].join("");
40542
+ pendingBytes = 0;
40543
+ pendingFragments = [];
40544
+ cursor = newline + 1;
40545
+ newline = chunk.indexOf("\n", cursor);
40492
40546
  if (line.trim().length === 0) {
40493
40547
  continue;
40494
40548
  }
@@ -40584,6 +40638,18 @@ async function readCodexHistoryWithOptions(agent, cwd, nativeSessionId, signal,
40584
40638
  }
40585
40639
  }
40586
40640
  }
40641
+ const remainder = chunk.slice(cursor);
40642
+ if (remainder.length > 0) {
40643
+ pendingBytes += Buffer.byteLength(remainder);
40644
+ if (pendingBytes > 32 * 1024 * 1024) {
40645
+ throw new AcpExecutionError(
40646
+ "This saved conversation is too large to preview.",
40647
+ {},
40648
+ "native_history_too_large"
40649
+ );
40650
+ }
40651
+ pendingFragments.push(remainder);
40652
+ }
40587
40653
  } catch (cause) {
40588
40654
  fail(cause);
40589
40655
  }
@@ -41102,6 +41168,7 @@ var NativeSessionService = class {
41102
41168
  directoryLabel: directory.label,
41103
41169
  prompted: session.prompted,
41104
41170
  sessionId: session.sessionId,
41171
+ status: this.#sessions.sessionStatus(session.sessionId),
41105
41172
  title: session.title || "Untitled session",
41106
41173
  updatedAt: session.updatedAt
41107
41174
  });
@@ -44296,6 +44363,21 @@ var DaemonSessionEventPublisher = class {
44296
44363
  this.publish(sessionId, event);
44297
44364
  }
44298
44365
  };
44366
+ publishStatus = (event) => {
44367
+ const socket = this.#socket;
44368
+ if (socket === null || socket.readyState !== WebSocket9.OPEN) {
44369
+ return;
44370
+ }
44371
+ const encoded = encodeDaemonToServiceMessage(event);
44372
+ if (socket.bufferedAmount + Buffer.byteLength(encoded, "utf8") > MAX_BUFFERED_BYTES) {
44373
+ socket.close(1013, "Live event transport overloaded");
44374
+ return;
44375
+ }
44376
+ try {
44377
+ socket.send(encoded);
44378
+ } catch {
44379
+ }
44380
+ };
44299
44381
  publishV2 = (event) => {
44300
44382
  this.#store.appendExecutingPromptEventV2(event);
44301
44383
  const socket = this.#socket;
@@ -44608,7 +44690,8 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
44608
44690
  nativeTurn
44609
44691
  )).history : null
44610
44692
  },
44611
- "native"
44693
+ "native",
44694
+ publisher.publishStatus
44612
44695
  );
44613
44696
  const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
44614
44697
  const installationObserver = new DaemonInstallationObserver();