@moxt-ai/mobius 0.0.61 → 0.0.64

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/runtime.js CHANGED
@@ -22645,7 +22645,11 @@ var configValueSchema = external_exports.strictObject({
22645
22645
  groupId: external_exports.string().max(128),
22646
22646
  groupName: external_exports.string().max(255),
22647
22647
  name: external_exports.string().min(1).max(255),
22648
- value: external_exports.string().min(1).max(500)
22648
+ // ACP types a select value id as any string, and Agents use the empty
22649
+ // id to mean "the provider's own default" — no explicit setting is
22650
+ // sent. Refusing it would drop the whole option, so the id is bounded
22651
+ // by length alone.
22652
+ value: external_exports.string().max(500)
22649
22653
  }).readonly();
22650
22654
  var sessionConfigOptionSchema = external_exports.strictObject({
22651
22655
  booleanValue: external_exports.boolean(),
@@ -23952,6 +23956,39 @@ function decodeRecordedSessionEvent(encoded) {
23952
23956
  }
23953
23957
  var encodeRecordedSessionEvent = (event) => JSON.stringify(decodeRecordedSessionEvent(JSON.stringify(event)));
23954
23958
 
23959
+ // ../protocol/src/session-live-history.ts
23960
+ var SESSION_LIVE_HISTORY_LOAD_KIND = "session.live-history.load";
23961
+ var SESSION_LIVE_HISTORY_LOADED_KIND = "session.live-history.loaded";
23962
+ var identifier2 = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
23963
+ var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
23964
+ var sessionLiveHistoryLoadSchema = external_exports.strictObject({
23965
+ additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
23966
+ agentId: identifier2,
23967
+ bindingId: identifier2,
23968
+ directoryId: directoryIdentifier,
23969
+ kind: external_exports.literal(SESSION_LIVE_HISTORY_LOAD_KIND),
23970
+ requestId: identifier2,
23971
+ sessionId: identifier2
23972
+ }).readonly();
23973
+ var sessionLiveHistoryLoadedSchema = external_exports.strictObject({
23974
+ history: sessionHistorySchema,
23975
+ kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
23976
+ requestId: identifier2,
23977
+ sessionId: identifier2
23978
+ }).readonly();
23979
+ function decode6(schema, encoded) {
23980
+ try {
23981
+ const value = JSON.parse(encoded);
23982
+ return schema.parse(value);
23983
+ } catch (cause) {
23984
+ throw new ProtocolMessageError("Invalid live Session history message", { cause });
23985
+ }
23986
+ }
23987
+ var decodeSessionLiveHistoryLoad = (encoded) => decode6(sessionLiveHistoryLoadSchema, encoded);
23988
+ var decodeSessionLiveHistoryLoaded = (encoded) => decode6(sessionLiveHistoryLoadedSchema, encoded);
23989
+ var encodeSessionLiveHistoryLoad = (value) => JSON.stringify(sessionLiveHistoryLoadSchema.parse(value));
23990
+ var encodeSessionLiveHistoryLoaded = (value) => JSON.stringify(sessionLiveHistoryLoadedSchema.parse(value));
23991
+
23955
23992
  // ../protocol/src/daemon-transport.ts
23956
23993
  function defineMessageSignature(kind, encoder, decoder) {
23957
23994
  const schema = (message) => decoder(JSON.stringify(message));
@@ -24049,6 +24086,11 @@ var serviceToDaemonSignatures = {
24049
24086
  encodeSessionEventRejection,
24050
24087
  decodeSessionEventRejection
24051
24088
  ),
24089
+ [SESSION_LIVE_HISTORY_LOAD_KIND]: defineMessageSignature(
24090
+ SESSION_LIVE_HISTORY_LOAD_KIND,
24091
+ encodeSessionLiveHistoryLoad,
24092
+ decodeSessionLiveHistoryLoad
24093
+ ),
24052
24094
  [SESSION_PERMISSION_RESPOND_KIND]: defineMessageSignature(
24053
24095
  SESSION_PERMISSION_RESPOND_KIND,
24054
24096
  encodeSessionPermissionRespondCommand,
@@ -24154,6 +24196,11 @@ var daemonToServiceSignatures = {
24154
24196
  encodeSessionOperationFailedEvent,
24155
24197
  decodeSessionOperationFailedEvent
24156
24198
  ),
24199
+ [SESSION_LIVE_HISTORY_LOADED_KIND]: defineMessageSignature(
24200
+ SESSION_LIVE_HISTORY_LOADED_KIND,
24201
+ encodeSessionLiveHistoryLoaded,
24202
+ decodeSessionLiveHistoryLoaded
24203
+ ),
24157
24204
  [SESSION_READY_KIND]: defineMessageSignature(SESSION_READY_KIND, encodeSessionReadyEvent, decodeSessionReadyEvent),
24158
24205
  [WORKSPACE_ENTRIES_KIND]: defineMessageSignature(
24159
24206
  WORKSPACE_ENTRIES_KIND,
@@ -29096,7 +29143,7 @@ var titleBefore = {
29096
29143
  };
29097
29144
  function tokenizeDefinition(effects, ok2, nok) {
29098
29145
  const self = this;
29099
- let identifier2;
29146
+ let identifier3;
29100
29147
  return start;
29101
29148
  function start(code) {
29102
29149
  effects.enter("definition");
@@ -29115,7 +29162,7 @@ function tokenizeDefinition(effects, ok2, nok) {
29115
29162
  )(code);
29116
29163
  }
29117
29164
  function labelAfter(code) {
29118
- identifier2 = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
29165
+ identifier3 = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
29119
29166
  if (code === 58) {
29120
29167
  effects.enter("definitionMarker");
29121
29168
  effects.consume(code);
@@ -29149,7 +29196,7 @@ function tokenizeDefinition(effects, ok2, nok) {
29149
29196
  function afterWhitespace(code) {
29150
29197
  if (code === null || markdownLineEnding(code)) {
29151
29198
  effects.exit("definition");
29152
- self.parser.defined.push(identifier2);
29199
+ self.parser.defined.push(identifier3);
29153
29200
  return ok2(code);
29154
29201
  }
29155
29202
  return nok(code);
@@ -31280,9 +31327,9 @@ function preprocess2() {
31280
31327
  // ../../node_modules/.pnpm/micromark-util-decode-string@2.0.1/node_modules/micromark-util-decode-string/index.js
31281
31328
  var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
31282
31329
  function decodeString(value) {
31283
- return value.replace(characterEscapeOrReference, decode6);
31330
+ return value.replace(characterEscapeOrReference, decode7);
31284
31331
  }
31285
- function decode6($0, $1, $2) {
31332
+ function decode7($0, $1, $2) {
31286
31333
  if ($1) {
31287
31334
  return $1;
31288
31335
  }
@@ -32322,12 +32369,16 @@ function readBoolean(value, fallback = false) {
32322
32369
  return typeof value === "boolean" ? value : fallback;
32323
32370
  }
32324
32371
  function normalizeConfigValue(option, groupId = "", groupName = "") {
32372
+ const value = option["value"];
32373
+ if (typeof value !== "string") {
32374
+ return void 0;
32375
+ }
32325
32376
  return {
32326
32377
  description: truncate2(readString2(option["description"]), 500),
32327
32378
  groupId: truncate2(groupId, 128),
32328
32379
  groupName: truncate2(groupName, 255),
32329
- name: truncate2(readString2(option["name"], readString2(option["value"])), 255),
32330
- value: truncate2(readString2(option["value"]), 500)
32380
+ name: truncate2(readString2(option["name"], value), 255),
32381
+ value: truncate2(value, 500)
32331
32382
  };
32332
32383
  }
32333
32384
  function normalizeConfigValues(value) {
@@ -32345,14 +32396,20 @@ function normalizeConfigValues(value) {
32345
32396
  const groupName = readString2(entry["name"]);
32346
32397
  for (const groupedOption of groupedOptions) {
32347
32398
  if (isRecord6(groupedOption)) {
32348
- normalized.push(normalizeConfigValue(groupedOption, groupId, groupName));
32399
+ const normalizedValue = normalizeConfigValue(groupedOption, groupId, groupName);
32400
+ if (normalizedValue !== void 0) {
32401
+ normalized.push(normalizedValue);
32402
+ }
32349
32403
  }
32350
32404
  }
32351
32405
  continue;
32352
32406
  }
32353
- normalized.push(normalizeConfigValue(entry));
32407
+ const normalizedEntry = normalizeConfigValue(entry);
32408
+ if (normalizedEntry !== void 0) {
32409
+ normalized.push(normalizedEntry);
32410
+ }
32354
32411
  }
32355
- return normalized.filter((entry) => entry.value.length > 0).slice(0, 500);
32412
+ return normalized.slice(0, 500);
32356
32413
  }
32357
32414
  function normalizeConfigOptions(value, modes) {
32358
32415
  const normalized = [];
@@ -32383,7 +32440,7 @@ function normalizeConfigOptions(value, modes) {
32383
32440
  if (option["type"] === "select") {
32384
32441
  const values = normalizeConfigValues(option["options"]);
32385
32442
  const currentValue = truncate2(readString2(option["currentValue"]), 500);
32386
- if (currentValue.length > 0 && values.some((entry) => entry.value === currentValue)) {
32443
+ if (values.some((entry) => entry.value === currentValue)) {
32387
32444
  normalized.push({
32388
32445
  booleanValue: false,
32389
32446
  category,
@@ -35567,6 +35624,14 @@ var AcpSessionManager = class {
35567
35624
  this.#nativeOperations.delete(key);
35568
35625
  }
35569
35626
  };
35627
+ loadSessionHistory = async (options) => {
35628
+ this.#beginSessionUse(options.sessionId);
35629
+ try {
35630
+ return await (await this.ensureSession(options)).loadHistory(options.signal);
35631
+ } finally {
35632
+ this.#endSessionUse(options.sessionId);
35633
+ }
35634
+ };
35570
35635
  openNativeSession = async (options, origin) => {
35571
35636
  const key = `${options.agent.id}:${origin.nativeSessionId}`;
35572
35637
  if (this.#nativeOperations.has(key)) {
@@ -39548,6 +39613,52 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
39548
39613
  reportOperationFailure(socket, command.requestId, command.sessionId, error62, metrics.snapshot());
39549
39614
  }
39550
39615
  }
39616
+ async function executeSessionLiveHistoryLoad(socket, command, config2, directories, audit, sessions, signal) {
39617
+ try {
39618
+ const resolved = await resolveSessionDirectories(
39619
+ directories,
39620
+ config2.bindingId,
39621
+ command.directoryId,
39622
+ command.additionalDirectoryIds,
39623
+ signal
39624
+ );
39625
+ const history = await sessions.loadSessionHistory({
39626
+ additionalDirectories: resolved.additionalDirectories,
39627
+ agent: config2.catalog.find(command.agentId),
39628
+ cwd: resolved.cwd,
39629
+ sessionId: command.sessionId,
39630
+ signal
39631
+ });
39632
+ signal.throwIfAborted();
39633
+ audit.record({
39634
+ commandId: command.requestId,
39635
+ event: "session_history_loaded",
39636
+ sessionId: command.sessionId
39637
+ });
39638
+ send(socket, {
39639
+ history,
39640
+ kind: "session.live-history.loaded",
39641
+ requestId: command.requestId,
39642
+ sessionId: command.sessionId
39643
+ });
39644
+ } catch (error62) {
39645
+ if (signal.aborted) {
39646
+ return;
39647
+ }
39648
+ audit.record({
39649
+ commandId: command.requestId,
39650
+ details: { code: operationErrorCode(error62) },
39651
+ event: "session_history_unavailable",
39652
+ sessionId: command.sessionId
39653
+ });
39654
+ send(socket, {
39655
+ history: { status: "unavailable" },
39656
+ kind: "session.live-history.loaded",
39657
+ requestId: command.requestId,
39658
+ sessionId: command.sessionId
39659
+ });
39660
+ }
39661
+ }
39551
39662
  async function executeSessionConfigure(publisher, socket, command, config2, directories, audit, sessions, signal) {
39552
39663
  try {
39553
39664
  const resolved = await resolveSessionDirectories(
@@ -40389,6 +40500,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
40389
40500
  }
40390
40501
  return;
40391
40502
  }
40503
+ if (kind === SESSION_LIVE_HISTORY_LOAD_KIND) {
40504
+ const command2 = decodeSessionLiveHistoryLoad(encoded);
40505
+ void executeSessionLiveHistoryLoad(
40506
+ socket,
40507
+ command2,
40508
+ config2,
40509
+ directories,
40510
+ audit,
40511
+ sessions,
40512
+ connectionController.signal
40513
+ );
40514
+ return;
40515
+ }
40392
40516
  if (kind === NATIVE_SESSION_CANCEL_KIND) {
40393
40517
  const command2 = message;
40394
40518
  const pending = nativeRequests.get(command2.requestId);