@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/index.js CHANGED
@@ -19865,7 +19865,11 @@ var configValueSchema = external_exports.strictObject({
19865
19865
  groupId: external_exports.string().max(128),
19866
19866
  groupName: external_exports.string().max(255),
19867
19867
  name: external_exports.string().min(1).max(255),
19868
- value: external_exports.string().min(1).max(500)
19868
+ // ACP types a select value id as any string, and Agents use the empty
19869
+ // id to mean "the provider's own default" — no explicit setting is
19870
+ // sent. Refusing it would drop the whole option, so the id is bounded
19871
+ // by length alone.
19872
+ value: external_exports.string().max(500)
19869
19873
  }).readonly();
19870
19874
  var sessionConfigOptionSchema = external_exports.strictObject({
19871
19875
  booleanValue: external_exports.boolean(),
@@ -21172,6 +21176,39 @@ function decodeRecordedSessionEvent(encoded) {
21172
21176
  }
21173
21177
  var encodeRecordedSessionEvent = (event) => JSON.stringify(decodeRecordedSessionEvent(JSON.stringify(event)));
21174
21178
 
21179
+ // ../protocol/src/session-live-history.ts
21180
+ var SESSION_LIVE_HISTORY_LOAD_KIND = "session.live-history.load";
21181
+ var SESSION_LIVE_HISTORY_LOADED_KIND = "session.live-history.loaded";
21182
+ var identifier2 = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
21183
+ var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
21184
+ var sessionLiveHistoryLoadSchema = external_exports.strictObject({
21185
+ additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
21186
+ agentId: identifier2,
21187
+ bindingId: identifier2,
21188
+ directoryId: directoryIdentifier,
21189
+ kind: external_exports.literal(SESSION_LIVE_HISTORY_LOAD_KIND),
21190
+ requestId: identifier2,
21191
+ sessionId: identifier2
21192
+ }).readonly();
21193
+ var sessionLiveHistoryLoadedSchema = external_exports.strictObject({
21194
+ history: sessionHistorySchema,
21195
+ kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
21196
+ requestId: identifier2,
21197
+ sessionId: identifier2
21198
+ }).readonly();
21199
+ function decode6(schema, encoded) {
21200
+ try {
21201
+ const value = JSON.parse(encoded);
21202
+ return schema.parse(value);
21203
+ } catch (cause) {
21204
+ throw new ProtocolMessageError("Invalid live Session history message", { cause });
21205
+ }
21206
+ }
21207
+ var decodeSessionLiveHistoryLoad = (encoded) => decode6(sessionLiveHistoryLoadSchema, encoded);
21208
+ var decodeSessionLiveHistoryLoaded = (encoded) => decode6(sessionLiveHistoryLoadedSchema, encoded);
21209
+ var encodeSessionLiveHistoryLoad = (value) => JSON.stringify(sessionLiveHistoryLoadSchema.parse(value));
21210
+ var encodeSessionLiveHistoryLoaded = (value) => JSON.stringify(sessionLiveHistoryLoadedSchema.parse(value));
21211
+
21175
21212
  // ../protocol/src/daemon-transport.ts
21176
21213
  function defineMessageSignature(kind, encoder, decoder) {
21177
21214
  const schema = (message) => decoder(JSON.stringify(message));
@@ -21269,6 +21306,11 @@ var serviceToDaemonSignatures = {
21269
21306
  encodeSessionEventRejection,
21270
21307
  decodeSessionEventRejection
21271
21308
  ),
21309
+ [SESSION_LIVE_HISTORY_LOAD_KIND]: defineMessageSignature(
21310
+ SESSION_LIVE_HISTORY_LOAD_KIND,
21311
+ encodeSessionLiveHistoryLoad,
21312
+ decodeSessionLiveHistoryLoad
21313
+ ),
21272
21314
  [SESSION_PERMISSION_RESPOND_KIND]: defineMessageSignature(
21273
21315
  SESSION_PERMISSION_RESPOND_KIND,
21274
21316
  encodeSessionPermissionRespondCommand,
@@ -21374,6 +21416,11 @@ var daemonToServiceSignatures = {
21374
21416
  encodeSessionOperationFailedEvent,
21375
21417
  decodeSessionOperationFailedEvent
21376
21418
  ),
21419
+ [SESSION_LIVE_HISTORY_LOADED_KIND]: defineMessageSignature(
21420
+ SESSION_LIVE_HISTORY_LOADED_KIND,
21421
+ encodeSessionLiveHistoryLoaded,
21422
+ decodeSessionLiveHistoryLoaded
21423
+ ),
21377
21424
  [SESSION_READY_KIND]: defineMessageSignature(SESSION_READY_KIND, encodeSessionReadyEvent, decodeSessionReadyEvent),
21378
21425
  [WORKSPACE_ENTRIES_KIND]: defineMessageSignature(
21379
21426
  WORKSPACE_ENTRIES_KIND,
@@ -27051,7 +27098,7 @@ var titleBefore = {
27051
27098
  };
27052
27099
  function tokenizeDefinition(effects, ok2, nok) {
27053
27100
  const self = this;
27054
- let identifier2;
27101
+ let identifier3;
27055
27102
  return start;
27056
27103
  function start(code) {
27057
27104
  effects.enter("definition");
@@ -27070,7 +27117,7 @@ function tokenizeDefinition(effects, ok2, nok) {
27070
27117
  )(code);
27071
27118
  }
27072
27119
  function labelAfter(code) {
27073
- identifier2 = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
27120
+ identifier3 = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
27074
27121
  if (code === 58) {
27075
27122
  effects.enter("definitionMarker");
27076
27123
  effects.consume(code);
@@ -27104,7 +27151,7 @@ function tokenizeDefinition(effects, ok2, nok) {
27104
27151
  function afterWhitespace(code) {
27105
27152
  if (code === null || markdownLineEnding(code)) {
27106
27153
  effects.exit("definition");
27107
- self.parser.defined.push(identifier2);
27154
+ self.parser.defined.push(identifier3);
27108
27155
  return ok2(code);
27109
27156
  }
27110
27157
  return nok(code);
@@ -29235,9 +29282,9 @@ function preprocess2() {
29235
29282
  // ../../node_modules/.pnpm/micromark-util-decode-string@2.0.1/node_modules/micromark-util-decode-string/index.js
29236
29283
  var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
29237
29284
  function decodeString(value) {
29238
- return value.replace(characterEscapeOrReference, decode6);
29285
+ return value.replace(characterEscapeOrReference, decode7);
29239
29286
  }
29240
- function decode6($0, $1, $2) {
29287
+ function decode7($0, $1, $2) {
29241
29288
  if ($1) {
29242
29289
  return $1;
29243
29290
  }
@@ -30277,12 +30324,16 @@ function readBoolean(value, fallback = false) {
30277
30324
  return typeof value === "boolean" ? value : fallback;
30278
30325
  }
30279
30326
  function normalizeConfigValue(option, groupId = "", groupName = "") {
30327
+ const value = option["value"];
30328
+ if (typeof value !== "string") {
30329
+ return void 0;
30330
+ }
30280
30331
  return {
30281
30332
  description: truncate2(readString2(option["description"]), 500),
30282
30333
  groupId: truncate2(groupId, 128),
30283
30334
  groupName: truncate2(groupName, 255),
30284
- name: truncate2(readString2(option["name"], readString2(option["value"])), 255),
30285
- value: truncate2(readString2(option["value"]), 500)
30335
+ name: truncate2(readString2(option["name"], value), 255),
30336
+ value: truncate2(value, 500)
30286
30337
  };
30287
30338
  }
30288
30339
  function normalizeConfigValues(value) {
@@ -30300,14 +30351,20 @@ function normalizeConfigValues(value) {
30300
30351
  const groupName = readString2(entry["name"]);
30301
30352
  for (const groupedOption of groupedOptions) {
30302
30353
  if (isRecord4(groupedOption)) {
30303
- normalized.push(normalizeConfigValue(groupedOption, groupId, groupName));
30354
+ const normalizedValue = normalizeConfigValue(groupedOption, groupId, groupName);
30355
+ if (normalizedValue !== void 0) {
30356
+ normalized.push(normalizedValue);
30357
+ }
30304
30358
  }
30305
30359
  }
30306
30360
  continue;
30307
30361
  }
30308
- normalized.push(normalizeConfigValue(entry));
30362
+ const normalizedEntry = normalizeConfigValue(entry);
30363
+ if (normalizedEntry !== void 0) {
30364
+ normalized.push(normalizedEntry);
30365
+ }
30309
30366
  }
30310
- return normalized.filter((entry) => entry.value.length > 0).slice(0, 500);
30367
+ return normalized.slice(0, 500);
30311
30368
  }
30312
30369
  function normalizeConfigOptions(value, modes) {
30313
30370
  const normalized = [];
@@ -30338,7 +30395,7 @@ function normalizeConfigOptions(value, modes) {
30338
30395
  if (option["type"] === "select") {
30339
30396
  const values = normalizeConfigValues(option["options"]);
30340
30397
  const currentValue = truncate2(readString2(option["currentValue"]), 500);
30341
- if (currentValue.length > 0 && values.some((entry) => entry.value === currentValue)) {
30398
+ if (values.some((entry) => entry.value === currentValue)) {
30342
30399
  normalized.push({
30343
30400
  booleanValue: false,
30344
30401
  category,
@@ -33522,6 +33579,14 @@ var AcpSessionManager = class {
33522
33579
  this.#nativeOperations.delete(key);
33523
33580
  }
33524
33581
  };
33582
+ loadSessionHistory = async (options) => {
33583
+ this.#beginSessionUse(options.sessionId);
33584
+ try {
33585
+ return await (await this.ensureSession(options)).loadHistory(options.signal);
33586
+ } finally {
33587
+ this.#endSessionUse(options.sessionId);
33588
+ }
33589
+ };
33525
33590
  openNativeSession = async (options, origin) => {
33526
33591
  const key = `${options.agent.id}:${origin.nativeSessionId}`;
33527
33592
  if (this.#nativeOperations.has(key)) {
@@ -40462,6 +40527,52 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
40462
40527
  reportOperationFailure(socket, command.requestId, command.sessionId, error62, metrics.snapshot());
40463
40528
  }
40464
40529
  }
40530
+ async function executeSessionLiveHistoryLoad(socket, command, config2, directories, audit, sessions, signal) {
40531
+ try {
40532
+ const resolved = await resolveSessionDirectories(
40533
+ directories,
40534
+ config2.bindingId,
40535
+ command.directoryId,
40536
+ command.additionalDirectoryIds,
40537
+ signal
40538
+ );
40539
+ const history = await sessions.loadSessionHistory({
40540
+ additionalDirectories: resolved.additionalDirectories,
40541
+ agent: config2.catalog.find(command.agentId),
40542
+ cwd: resolved.cwd,
40543
+ sessionId: command.sessionId,
40544
+ signal
40545
+ });
40546
+ signal.throwIfAborted();
40547
+ audit.record({
40548
+ commandId: command.requestId,
40549
+ event: "session_history_loaded",
40550
+ sessionId: command.sessionId
40551
+ });
40552
+ send(socket, {
40553
+ history,
40554
+ kind: "session.live-history.loaded",
40555
+ requestId: command.requestId,
40556
+ sessionId: command.sessionId
40557
+ });
40558
+ } catch (error62) {
40559
+ if (signal.aborted) {
40560
+ return;
40561
+ }
40562
+ audit.record({
40563
+ commandId: command.requestId,
40564
+ details: { code: operationErrorCode(error62) },
40565
+ event: "session_history_unavailable",
40566
+ sessionId: command.sessionId
40567
+ });
40568
+ send(socket, {
40569
+ history: { status: "unavailable" },
40570
+ kind: "session.live-history.loaded",
40571
+ requestId: command.requestId,
40572
+ sessionId: command.sessionId
40573
+ });
40574
+ }
40575
+ }
40465
40576
  async function executeSessionConfigure(publisher, socket, command, config2, directories, audit, sessions, signal) {
40466
40577
  try {
40467
40578
  const resolved = await resolveSessionDirectories(
@@ -41303,6 +41414,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
41303
41414
  }
41304
41415
  return;
41305
41416
  }
41417
+ if (kind === SESSION_LIVE_HISTORY_LOAD_KIND) {
41418
+ const command2 = decodeSessionLiveHistoryLoad(encoded);
41419
+ void executeSessionLiveHistoryLoad(
41420
+ socket,
41421
+ command2,
41422
+ config2,
41423
+ directories,
41424
+ audit,
41425
+ sessions,
41426
+ connectionController.signal
41427
+ );
41428
+ return;
41429
+ }
41306
41430
  if (kind === NATIVE_SESSION_CANCEL_KIND) {
41307
41431
  const command2 = message;
41308
41432
  const pending = nativeRequests.get(command2.requestId);