@moxt-ai/mobius 0.0.138 → 0.0.140

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/index.js CHANGED
@@ -24032,6 +24032,7 @@ function sessionFailureMeta(failure2) {
24032
24032
  // src/acp/session-history.ts
24033
24033
  var HISTORY_ACTIVITY_FIELD_LIMIT = 1e5;
24034
24034
  var HISTORY_ACTIVITY_LIMIT = 100;
24035
+ var HISTORY_MESSAGE_LIMIT = 50;
24035
24036
  function historyActivity(activity2) {
24036
24037
  return {
24037
24038
  activityId: activity2.activityId.slice(0, 128),
@@ -24074,6 +24075,7 @@ var AcpHistoryReplay = class {
24074
24075
  () => Promise.resolve()
24075
24076
  );
24076
24077
  #lastMessageId = null;
24078
+ #firstMessageIndex = 0;
24077
24079
  #characters = 0;
24078
24080
  #truncated = false;
24079
24081
  record = async (update) => {
@@ -24159,7 +24161,7 @@ var AcpHistoryReplay = class {
24159
24161
  };
24160
24162
  snapshot = async () => {
24161
24163
  await this.#activityTracker.finish();
24162
- const messages = this.#messages.map((message) => {
24164
+ const messages = this.#messages.slice(this.#firstMessageIndex).map((message) => {
24163
24165
  if (message.role === "user") {
24164
24166
  return message;
24165
24167
  }
@@ -24224,13 +24226,18 @@ var AcpHistoryReplay = class {
24224
24226
  this.trimMessages();
24225
24227
  };
24226
24228
  trimMessages = () => {
24227
- while (this.#messages.length > SESSION_HISTORY_PREVIEW_MESSAGE_LIMIT || this.#characters > SESSION_HISTORY_CHARACTER_LIMIT) {
24228
- const removed = this.#messages.shift();
24229
+ while (this.#messages.length - this.#firstMessageIndex > HISTORY_MESSAGE_LIMIT || this.#characters > SESSION_HISTORY_CHARACTER_LIMIT) {
24230
+ const removed = this.#messages[this.#firstMessageIndex];
24229
24231
  if (removed !== void 0) {
24230
24232
  this.#characters -= removed.text.length;
24233
+ this.#firstMessageIndex += 1;
24231
24234
  }
24232
24235
  this.#truncated = true;
24233
24236
  }
24237
+ if (this.#firstMessageIndex >= HISTORY_MESSAGE_LIMIT) {
24238
+ this.#messages.splice(0, this.#firstMessageIndex);
24239
+ this.#firstMessageIndex = 0;
24240
+ }
24234
24241
  };
24235
24242
  };
24236
24243
 
@@ -34041,6 +34048,7 @@ var APPROVAL_TIMEOUT_MILLISECONDS2 = 36e5;
34041
34048
  var CODEX_AGENT_VERSION = "0.154.0";
34042
34049
  var SESSION_LIST_TIMEOUT_MILLISECONDS = 3e4;
34043
34050
  var CODEX_COMMANDS = Object.freeze([{ description: "Compact the conversation context", name: "compact" }]);
34051
+ var COMPACT_COMPLETED_MESSAGE = "Context compacted.";
34044
34052
  var APPROVAL_OPTIONS = Object.freeze([
34045
34053
  { kind: "allow_once", name: "Allow once", optionId: "accept" },
34046
34054
  { kind: "allow_always", name: "Allow for this session", optionId: "acceptForSession" },
@@ -34733,7 +34741,15 @@ var CodexAcpAgent = class {
34733
34741
  this.#turn = turn;
34734
34742
  try {
34735
34743
  await this.#appServer.request("thread/compact/start", { threadId: this.#nativeSessionId }, signal);
34736
- return await completion.promise;
34744
+ const result = await completion.promise;
34745
+ if (result.stopReason !== "cancelled") {
34746
+ await this.#emit({
34747
+ content: { text: COMPACT_COMPLETED_MESSAGE, type: "text" },
34748
+ messageId: turn.turn.id.length > 0 ? turn.turn.id : "compact-completed",
34749
+ sessionUpdate: "agent_message_chunk"
34750
+ });
34751
+ }
34752
+ return result;
34737
34753
  } finally {
34738
34754
  signal.removeEventListener("abort", aborted2);
34739
34755
  if (this.#turn === turn) {