@moxt-ai/mobius 0.0.283 → 0.0.285

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
@@ -894,10 +894,26 @@ function readExecutableIdentity(path7) {
894
894
  );
895
895
  }
896
896
 
897
- // src/acp/protocol/session-capabilities.ts
897
+ // src/util/value-utils.ts
898
+ function truncate(value, maximumLength) {
899
+ return value.length <= maximumLength ? value : `${value.slice(0, Math.max(0, maximumLength - 1))}\u2026`;
900
+ }
898
901
  function isRecord(value) {
899
902
  return typeof value === "object" && value !== null && !Array.isArray(value);
900
903
  }
904
+ function readString(value, fallback = "") {
905
+ return typeof value === "string" ? value : fallback;
906
+ }
907
+ function arraysEqual(left, right) {
908
+ return left.length === right.length && left.every((value, index2) => value === right[index2]);
909
+ }
910
+ function recordsEqual(left, right) {
911
+ const leftEntries = Object.entries(left);
912
+ const rightEntries = Object.entries(right);
913
+ return leftEntries.length === rightEntries.length && leftEntries.every(([name2, value]) => right[name2] === value);
914
+ }
915
+
916
+ // src/acp/protocol/session-capabilities.ts
901
917
  function hasTrueChildField(value, childKey, fieldKey) {
902
918
  if (!isRecord(value)) {
903
919
  return false;
@@ -20777,7 +20793,7 @@ function parseJson(encoded) {
20777
20793
  }
20778
20794
  return value;
20779
20795
  }
20780
- function readString(value, key, maximumLength) {
20796
+ function readString2(value, key, maximumLength) {
20781
20797
  const field = value[key];
20782
20798
  if (typeof field !== "string" || field.length === 0 || field.length > maximumLength) {
20783
20799
  throw new ProtocolMessageError(`Invalid string field: ${key}`);
@@ -20815,7 +20831,7 @@ function readIdentifier(value, key) {
20815
20831
  }
20816
20832
  }
20817
20833
  function readDirectoryIdentifier(value, key) {
20818
- const field = readString(value, key, MAX_DIRECTORY_IDENTIFIER_LENGTH);
20834
+ const field = readString2(value, key, MAX_DIRECTORY_IDENTIFIER_LENGTH);
20819
20835
  if (!isDirectoryIdentifier(field)) {
20820
20836
  throw new ProtocolMessageError(`Invalid directory identifier field: ${key}`);
20821
20837
  }
@@ -20827,7 +20843,7 @@ function assertKind(value, expectedKind) {
20827
20843
  }
20828
20844
  }
20829
20845
  function decodeMessageKind(encoded) {
20830
- return readString(parseJson(encoded), "kind", 64);
20846
+ return readString2(parseJson(encoded), "kind", 64);
20831
20847
  }
20832
20848
  function decodeZodMessage(encoded, schema) {
20833
20849
  const result = schema.safeParse(parseJson(encoded));
@@ -22552,7 +22568,7 @@ import { fetch as fetch3 } from "undici";
22552
22568
  // package.json
22553
22569
  var package_default = {
22554
22570
  name: "@moxt-ai/mobius",
22555
- version: "0.0.283",
22571
+ version: "0.0.285",
22556
22572
  description: "Mobius CLI for pairing and running local AI agent services.",
22557
22573
  type: "module",
22558
22574
  bin: {
@@ -22606,6 +22622,8 @@ var package_default = {
22606
22622
  "test:controlled": "vitest run tests/sessions tests/runtime --maxWorkers=4",
22607
22623
  "pretest:agents": "tsc --project src/acp/harness/claude/upstream/tsconfig.json && tsc --project src/acp/harness/pi/upstream/tsconfig.json",
22608
22624
  "test:agents": "vitest run tests/agents --maxWorkers=2",
22625
+ "pretest:npm-compatibility": "tsc --project src/acp/harness/claude/upstream/tsconfig.json && tsc --project src/acp/harness/pi/upstream/tsconfig.json",
22626
+ "test:npm-compatibility": "vitest run tests/runtime/daemon-upgrade.integration.test.ts tests/runtime/daemon-upgrade-command.integration.test.ts",
22609
22627
  "pretest:pressure": "tsc --project src/acp/harness/claude/upstream/tsconfig.json && tsc --project src/acp/harness/pi/upstream/tsconfig.json",
22610
22628
  "test:pressure": "node tests/pressure/concurrent-sessions.mjs"
22611
22629
  },
@@ -67056,7 +67074,7 @@ import { setTimeout as setTimeout2 } from "node:timers/promises";
67056
67074
  import { pathToFileURL } from "node:url";
67057
67075
  var TOOL_OUTPUT_CHARACTER_LIMIT = 32768;
67058
67076
  var TITLE_CHARACTER_LIMIT = 500;
67059
- function truncate(value, limit) {
67077
+ function truncate2(value, limit) {
67060
67078
  return value.length <= limit ? value : value.slice(0, limit);
67061
67079
  }
67062
67080
  function boundedParagraphs(values, limit) {
@@ -67072,7 +67090,7 @@ function boundedParagraphs(values, limit) {
67072
67090
  return text2;
67073
67091
  }
67074
67092
  function textContent(text2) {
67075
- const block = { text: truncate(text2, TOOL_OUTPUT_CHARACTER_LIMIT), type: "text" };
67093
+ const block = { text: truncate2(text2, TOOL_OUTPUT_CHARACTER_LIMIT), type: "text" };
67076
67094
  return { content: block, type: "content" };
67077
67095
  }
67078
67096
  function structuredToolText(value) {
@@ -67161,16 +67179,16 @@ function presentToolItem(item) {
67161
67179
  rawInput: { command: item.command, cwd: item.cwd },
67162
67180
  rawOutput: {
67163
67181
  ...item.exitCode == null ? {} : { exitCode: item.exitCode },
67164
- output: truncate(output2, TOOL_OUTPUT_CHARACTER_LIMIT)
67182
+ output: truncate2(output2, TOOL_OUTPUT_CHARACTER_LIMIT)
67165
67183
  },
67166
67184
  status: commandStatus(item.status),
67167
- title: truncate(firstLine(item.command), TITLE_CHARACTER_LIMIT)
67185
+ title: truncate2(firstLine(item.command), TITLE_CHARACTER_LIMIT)
67168
67186
  };
67169
67187
  }
67170
67188
  if (item.type === "fileChange") {
67171
67189
  const paths = item.changes.map((change) => change.path);
67172
67190
  const content = item.changes.map((change) => ({
67173
- newText: truncate(change.diff, TOOL_OUTPUT_CHARACTER_LIMIT),
67191
+ newText: truncate2(change.diff, TOOL_OUTPUT_CHARACTER_LIMIT),
67174
67192
  path: change.path,
67175
67193
  type: "diff"
67176
67194
  }));
@@ -67181,7 +67199,7 @@ function presentToolItem(item) {
67181
67199
  rawInput: { changes: item.changes.map((change) => change.path) },
67182
67200
  rawOutput: null,
67183
67201
  status: patchStatus(item.status),
67184
- title: truncate(paths.join(", "), TITLE_CHARACTER_LIMIT)
67202
+ title: truncate2(paths.join(", "), TITLE_CHARACTER_LIMIT)
67185
67203
  };
67186
67204
  }
67187
67205
  if (item.type === "mcpToolCall") {
@@ -67194,7 +67212,7 @@ function presentToolItem(item) {
67194
67212
  rawInput: item.arguments ?? null,
67195
67213
  rawOutput: item.error ?? item.result ?? null,
67196
67214
  status: mcpStatus(item.status),
67197
- title: truncate(label, TITLE_CHARACTER_LIMIT)
67215
+ title: truncate2(label, TITLE_CHARACTER_LIMIT)
67198
67216
  };
67199
67217
  }
67200
67218
  if (item.type === "dynamicToolCall") {
@@ -67207,7 +67225,7 @@ function presentToolItem(item) {
67207
67225
  rawInput: item.arguments ?? null,
67208
67226
  rawOutput: item.contentItems ?? null,
67209
67227
  status: mcpStatus(item.status),
67210
- title: truncate(label, TITLE_CHARACTER_LIMIT)
67228
+ title: truncate2(label, TITLE_CHARACTER_LIMIT)
67211
67229
  };
67212
67230
  }
67213
67231
  if (item.type === "collabAgentToolCall") {
@@ -67238,7 +67256,7 @@ function presentToolItem(item) {
67238
67256
  rawInput: { agentPath: item.agentPath },
67239
67257
  rawOutput: { agentThreadId: item.agentThreadId },
67240
67258
  status: "in_progress",
67241
- title: truncate(`Dispatch subagent ${item.agentPath}`, TITLE_CHARACTER_LIMIT)
67259
+ title: truncate2(`Dispatch subagent ${item.agentPath}`, TITLE_CHARACTER_LIMIT)
67242
67260
  };
67243
67261
  }
67244
67262
  return null;
@@ -74387,9 +74405,6 @@ var PairingClientError = class extends Error {
74387
74405
  this.name = "PairingClientError";
74388
74406
  }
74389
74407
  };
74390
- function isRecord6(value) {
74391
- return typeof value === "object" && value !== null && !Array.isArray(value);
74392
- }
74393
74408
  function hasExactKeys2(value, expectedKeys) {
74394
74409
  const keys = Object.keys(value);
74395
74410
  return keys.length === expectedKeys.length && expectedKeys.every((key) => Object.hasOwn(value, key));
@@ -74461,9 +74476,9 @@ async function readJsonResponse(response) {
74461
74476
  }
74462
74477
  }
74463
74478
  function readRelayError(value) {
74464
- if (isRecord6(value)) {
74479
+ if (isRecord(value)) {
74465
74480
  const error62 = value["error"];
74466
- if (isRecord6(error62)) {
74481
+ if (isRecord(error62)) {
74467
74482
  const code = error62["code"];
74468
74483
  const message = error62["message"];
74469
74484
  if (typeof code === "string" && typeof message === "string") {
@@ -74474,7 +74489,7 @@ function readRelayError(value) {
74474
74489
  return new PairingClientError("pairing_failed", "The relay could not pair this machine");
74475
74490
  }
74476
74491
  function decodePairingResponse(value, credentialField, expectedKeys) {
74477
- if (!isRecord6(value) || !hasExactKeys2(value, expectedKeys)) {
74492
+ if (!isRecord(value) || !hasExactKeys2(value, expectedKeys)) {
74478
74493
  throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
74479
74494
  }
74480
74495
  const appId = value["appId"];
@@ -75691,7 +75706,7 @@ var toolImageSchema = external_exports.union([
75691
75706
  file: external_exports.object({ base64: external_exports.string(), type: external_exports.string() })
75692
75707
  }).transform(({ file: file2 }) => ({ type: "image", data: file2.base64, mimeType: file2.type }))
75693
75708
  ]);
75694
- function isRecord7(value) {
75709
+ function isRecord6(value) {
75695
75710
  return typeof value === "object" && value !== null && !Array.isArray(value);
75696
75711
  }
75697
75712
  var AcpContentExternalizer = class {
@@ -75798,13 +75813,13 @@ var AcpContentExternalizer = class {
75798
75813
  }
75799
75814
  return result2;
75800
75815
  }
75801
- if (!isRecord7(value)) {
75816
+ if (!isRecord6(value)) {
75802
75817
  return value;
75803
75818
  }
75804
75819
  const image = toolImageSchema.safeParse(value);
75805
75820
  if (image.success && image.data.data.length > 0) {
75806
75821
  const prepared = await this.#content(sessionId, image.data, signal);
75807
- if (isRecord7(prepared.event) && typeof prepared.event["imageKey"] === "string") {
75822
+ if (isRecord6(prepared.event) && typeof prepared.event["imageKey"] === "string") {
75808
75823
  images.set(prepared.event["imageKey"], prepared);
75809
75824
  } else {
75810
75825
  images.set(`unavailable:${images.size}`, prepared);
@@ -75835,7 +75850,7 @@ var AcpContentExternalizer = class {
75835
75850
  const prepared = await this.#content(sessionId, content, signal);
75836
75851
  agentContent.push({ ...item, content: prepared.agent });
75837
75852
  eventContent.push({ ...item, content: prepared.event });
75838
- if (isRecord7(prepared.event) && typeof prepared.event["imageKey"] === "string") {
75853
+ if (isRecord6(prepared.event) && typeof prepared.event["imageKey"] === "string") {
75839
75854
  images.delete(prepared.event["imageKey"]);
75840
75855
  }
75841
75856
  }
@@ -81921,41 +81936,20 @@ function buildPromptContent(options, capabilities) {
81921
81936
  // src/acp/connection/agent-connection.ts
81922
81937
  import { spawn as spawn7 } from "node:child_process";
81923
81938
  import { ndJsonStream as ndJsonStream3, RequestError as RequestError8 } from "@agentclientprotocol/sdk";
81924
-
81925
- // src/util/value-utils.ts
81926
- function truncate2(value, maximumLength) {
81927
- return value.length <= maximumLength ? value : `${value.slice(0, Math.max(0, maximumLength - 1))}\u2026`;
81928
- }
81929
- function isRecord8(value) {
81930
- return typeof value === "object" && value !== null && !Array.isArray(value);
81931
- }
81932
- function readString2(value, fallback = "") {
81933
- return typeof value === "string" ? value : fallback;
81934
- }
81935
- function arraysEqual(left, right) {
81936
- return left.length === right.length && left.every((value, index2) => value === right[index2]);
81937
- }
81938
- function recordsEqual(left, right) {
81939
- const leftEntries = Object.entries(left);
81940
- const rightEntries = Object.entries(right);
81941
- return leftEntries.length === rightEntries.length && leftEntries.every(([name2, value]) => right[name2] === value);
81942
- }
81943
-
81944
- // src/acp/connection/agent-connection.ts
81945
81939
  function requestErrorMessage(error62) {
81946
- const fallback = truncate2(error62.message, 500);
81947
- if (error62.message !== "Internal error" || !isRecord8(error62.data)) {
81940
+ const fallback = truncate(error62.message, 500);
81941
+ if (error62.message !== "Internal error" || !isRecord(error62.data)) {
81948
81942
  return fallback;
81949
81943
  }
81950
81944
  const agentError = error62.data["error"];
81951
- if (isRecord8(agentError)) {
81945
+ if (isRecord(agentError)) {
81952
81946
  const message = agentError["message"];
81953
81947
  if (typeof message === "string" && message.length > 0) {
81954
- return truncate2(message, 500);
81948
+ return truncate(message, 500);
81955
81949
  }
81956
81950
  }
81957
81951
  const details = error62.data["details"];
81958
- return typeof details === "string" && details.length > 0 ? truncate2(details, 500) : fallback;
81952
+ return typeof details === "string" && details.length > 0 ? truncate(details, 500) : fallback;
81959
81953
  }
81960
81954
  function readableWebStream(input2) {
81961
81955
  let streamOpen = true;
@@ -82255,7 +82249,7 @@ var SessionConfigProtocolError = class extends Error {
82255
82249
  this.name = "SessionConfigProtocolError";
82256
82250
  }
82257
82251
  };
82258
- function isRecord9(value) {
82252
+ function isRecord7(value) {
82259
82253
  return typeof value === "object" && value !== null && !Array.isArray(value);
82260
82254
  }
82261
82255
  function readString3(value, fallback = "") {
@@ -82286,7 +82280,7 @@ function normalizeConfigValues(value) {
82286
82280
  }
82287
82281
  const normalized = [];
82288
82282
  for (const entry of value) {
82289
- if (!isRecord9(entry)) {
82283
+ if (!isRecord7(entry)) {
82290
82284
  continue;
82291
82285
  }
82292
82286
  const groupedOptions = entry["options"];
@@ -82294,7 +82288,7 @@ function normalizeConfigValues(value) {
82294
82288
  const groupId = readString3(entry["group"]);
82295
82289
  const groupName = readString3(entry["name"]);
82296
82290
  for (const groupedOption of groupedOptions) {
82297
- if (isRecord9(groupedOption)) {
82291
+ if (isRecord7(groupedOption)) {
82298
82292
  const normalizedValue = normalizeConfigValue(groupedOption, groupId, groupName);
82299
82293
  if (normalizedValue !== void 0) {
82300
82294
  normalized.push(normalizedValue);
@@ -82319,7 +82313,7 @@ function normalizeConfigOptions(value, modes) {
82319
82313
  const normalized = [];
82320
82314
  if (Array.isArray(value)) {
82321
82315
  for (const option of value) {
82322
- if (!isRecord9(option)) {
82316
+ if (!isRecord7(option)) {
82323
82317
  continue;
82324
82318
  }
82325
82319
  const id = truncate3(readString3(option["id"]), 128);
@@ -82359,12 +82353,12 @@ function normalizeConfigOptions(value, modes) {
82359
82353
  }
82360
82354
  }
82361
82355
  }
82362
- if (isRecord9(modes)) {
82356
+ if (isRecord7(modes)) {
82363
82357
  const values = [];
82364
82358
  const availableModes = modes["availableModes"];
82365
82359
  if (Array.isArray(availableModes)) {
82366
82360
  for (const mode of availableModes) {
82367
- if (!isRecord9(mode)) {
82361
+ if (!isRecord7(mode)) {
82368
82362
  continue;
82369
82363
  }
82370
82364
  const id = truncate3(readString3(mode["id"]), 500);
@@ -82397,7 +82391,7 @@ function normalizeConfigOptions(value, modes) {
82397
82391
  return normalized.slice(0, MAXIMUM_CONFIG_OPTIONS);
82398
82392
  }
82399
82393
  function normalizeStandardLifecycle(response) {
82400
- const lifecycle = isRecord9(response) ? response : {};
82394
+ const lifecycle = isRecord7(response) ? response : {};
82401
82395
  return normalizeConfigOptions(lifecycle["configOptions"], lifecycle["modes"]);
82402
82396
  }
82403
82397
  function replaceStandardConfigOptions(current, value) {
@@ -82439,7 +82433,7 @@ var StandardSessionConfigProtocol = class {
82439
82433
  "ACP agent exited while changing session configuration",
82440
82434
  change.signal
82441
82435
  );
82442
- if (!isRecord9(response) || !Array.isArray(response["configOptions"])) {
82436
+ if (!isRecord7(response) || !Array.isArray(response["configOptions"])) {
82443
82437
  throw new SessionConfigProtocolError("The Agent returned an invalid session configuration response");
82444
82438
  }
82445
82439
  return replaceStandardConfigOptions(current, response["configOptions"]);
@@ -82536,11 +82530,11 @@ function normalizeElicitationOptions(schema) {
82536
82530
  const oneOf = schema["oneOf"];
82537
82531
  if (Array.isArray(oneOf)) {
82538
82532
  for (const option of oneOf) {
82539
- if (isRecord8(option) && typeof option["const"] === "string") {
82533
+ if (isRecord(option) && typeof option["const"] === "string") {
82540
82534
  normalized.push({
82541
- description: truncate2(readString2(option["description"]), 500),
82542
- label: truncate2(readString2(option["title"], option["const"]), 255),
82543
- value: truncate2(option["const"], 500)
82535
+ description: truncate(readString(option["description"]), 500),
82536
+ label: truncate(readString(option["title"], option["const"]), 255),
82537
+ value: truncate(option["const"], 500)
82544
82538
  });
82545
82539
  }
82546
82540
  }
@@ -82556,7 +82550,7 @@ function normalizeElicitationOptions(schema) {
82556
82550
  return normalized.slice(0, 200);
82557
82551
  }
82558
82552
  const items = schema["items"];
82559
- if (!isRecord8(items)) {
82553
+ if (!isRecord(items)) {
82560
82554
  return normalized;
82561
82555
  }
82562
82556
  const anyOf = items["anyOf"];
@@ -82569,7 +82563,7 @@ function numericString(value) {
82569
82563
  return typeof value === "number" && Number.isFinite(value) ? value.toString() : "";
82570
82564
  }
82571
82565
  function normalizeElicitationFields(requestedSchema) {
82572
- if (!isRecord8(requestedSchema) || !isRecord8(requestedSchema["properties"])) {
82566
+ if (!isRecord(requestedSchema) || !isRecord(requestedSchema["properties"])) {
82573
82567
  return [];
82574
82568
  }
82575
82569
  const properties = requestedSchema["properties"];
@@ -82579,7 +82573,7 @@ function normalizeElicitationFields(requestedSchema) {
82579
82573
  );
82580
82574
  const normalized = [];
82581
82575
  for (const [name2, property] of Object.entries(properties)) {
82582
- if (!isRecord8(property)) {
82576
+ if (!isRecord(property)) {
82583
82577
  continue;
82584
82578
  }
82585
82579
  const type = elicitationFieldType(property["type"]);
@@ -82589,19 +82583,19 @@ function normalizeElicitationFields(requestedSchema) {
82589
82583
  normalized.push({
82590
82584
  defaultBooleanValue: typeof defaultValue === "boolean" ? defaultValue : false,
82591
82585
  defaultNumberValue: typeof defaultValue === "number" && Number.isFinite(defaultValue) ? defaultValue : 0,
82592
- defaultStringValue: typeof defaultValue === "string" ? truncate2(defaultValue, 1e4) : Array.isArray(defaultValue) ? truncate2(JSON.stringify(defaultValue), 1e4) : "",
82593
- description: truncate2(readString2(property["description"]), 500),
82594
- format: truncate2(readString2(property["format"]), 64),
82586
+ defaultStringValue: typeof defaultValue === "string" ? truncate(defaultValue, 1e4) : Array.isArray(defaultValue) ? truncate(JSON.stringify(defaultValue), 1e4) : "",
82587
+ description: truncate(readString(property["description"]), 500),
82588
+ format: truncate(readString(property["format"]), 64),
82595
82589
  hasDefaultValue: defaultValue !== void 0 && defaultValue !== null,
82596
82590
  maximum: numericString(property["maximum"]),
82597
82591
  maximumLength: numericString(property["maxLength"] ?? property["maxItems"]),
82598
82592
  minimum: numericString(property["minimum"]),
82599
82593
  minimumLength: numericString(property["minLength"] ?? property["minItems"]),
82600
- name: truncate2(name2, 128),
82594
+ name: truncate(name2, 128),
82601
82595
  options,
82602
- pattern: truncate2(readString2(property["pattern"]), 500),
82596
+ pattern: truncate(readString(property["pattern"]), 500),
82603
82597
  required: required2.has(name2),
82604
- title: truncate2(readString2(property["title"], name2), 255),
82598
+ title: truncate(readString(property["title"], name2), 255),
82605
82599
  type: normalizedType
82606
82600
  });
82607
82601
  }
@@ -82670,7 +82664,7 @@ function validateElicitationContent(encoded, requestedSchema) {
82670
82664
  "invalid_elicitation_response"
82671
82665
  );
82672
82666
  }
82673
- if (!isRecord8(decoded) || !isRecord8(requestedSchema) || !isRecord8(requestedSchema["properties"])) {
82667
+ if (!isRecord(decoded) || !isRecord(requestedSchema) || !isRecord(requestedSchema["properties"])) {
82674
82668
  throw new AcpExecutionError(
82675
82669
  "Elicitation response does not match the requested form",
82676
82670
  {},
@@ -82690,7 +82684,7 @@ function validateElicitationContent(encoded, requestedSchema) {
82690
82684
  const validated = {};
82691
82685
  for (const [name2, value] of Object.entries(decoded)) {
82692
82686
  const property = properties[name2];
82693
- if (!isRecord8(property)) {
82687
+ if (!isRecord(property)) {
82694
82688
  throw new AcpExecutionError(
82695
82689
  `Elicitation field ${name2} was not requested`,
82696
82690
  {},
@@ -82922,8 +82916,8 @@ var SessionInteractions = class {
82922
82916
  const interactionId = `permission-${crypto.randomUUID()}`;
82923
82917
  const options = request.options.slice(0, 20).map((option) => ({
82924
82918
  kind: option.kind,
82925
- name: truncate2(option.name, 255),
82926
- optionId: truncate2(option.optionId, 255)
82919
+ name: truncate(option.name, 255),
82920
+ optionId: truncate(option.optionId, 255)
82927
82921
  }));
82928
82922
  if (options.length === 0) {
82929
82923
  throw new AcpExecutionError(
@@ -82955,9 +82949,9 @@ var SessionInteractions = class {
82955
82949
  kind: SESSION_PERMISSION_REQUESTED_KIND,
82956
82950
  options,
82957
82951
  sessionId: this.#context.sessionId(),
82958
- title: truncate2(title2 ?? "Permission required", 500),
82959
- toolCallId: truncate2(request.toolCall.toolCallId, 255),
82960
- toolKind: truncate2(kind ?? "other", 64)
82952
+ title: truncate(title2 ?? "Permission required", 500),
82953
+ toolCallId: truncate(request.toolCall.toolCallId, 255),
82954
+ toolKind: truncate(kind ?? "other", 64)
82961
82955
  });
82962
82956
  return await pending.completion.promise;
82963
82957
  } finally {
@@ -82986,7 +82980,7 @@ var SessionInteractions = class {
82986
82980
  const schemaValue = Reflect.get(request, "requestedSchema");
82987
82981
  const requestedSchema = request.mode === "form" ? schemaValue : {};
82988
82982
  const elicitationIdValue = Reflect.get(request, "elicitationId");
82989
- const elicitationId = request.mode === "url" && typeof elicitationIdValue === "string" ? truncate2(elicitationIdValue, 255) : "";
82983
+ const elicitationId = request.mode === "url" && typeof elicitationIdValue === "string" ? truncate(elicitationIdValue, 255) : "";
82990
82984
  const pending = new PendingElicitation(interactionId, elicitationId, requestedSchema);
82991
82985
  this.#pendingElicitations.set(interactionId, pending);
82992
82986
  const abort = () => {
@@ -83001,10 +82995,10 @@ var SessionInteractions = class {
83001
82995
  fields: normalizeElicitationFields(requestedSchema),
83002
82996
  interactionId,
83003
82997
  kind: SESSION_ELICITATION_REQUESTED_KIND,
83004
- message: truncate2(request.message, 2e3),
82998
+ message: truncate(request.message, 2e3),
83005
82999
  mode: request.mode,
83006
83000
  sessionId: this.#context.sessionId(),
83007
- url: request.mode === "url" && typeof Reflect.get(request, "url") === "string" ? truncate2(readString2(Reflect.get(request, "url")), 4096) : ""
83001
+ url: request.mode === "url" && typeof Reflect.get(request, "url") === "string" ? truncate(readString(Reflect.get(request, "url")), 4096) : ""
83008
83002
  });
83009
83003
  return await pending.completion.promise;
83010
83004
  } finally {
@@ -83518,7 +83512,6 @@ var AgentSession = class _AgentSession {
83518
83512
  #sessionConfigurations = new SessionConfigurations();
83519
83513
  #nativeHistoryOwnership = { kind: "unbound" };
83520
83514
  #prompted = false;
83521
- #nativePrompt = null;
83522
83515
  #sessionLoad = { kind: "not-requested" };
83523
83516
  #restored = false;
83524
83517
  #sessionTitle = null;
@@ -83644,7 +83637,7 @@ var AgentSession = class _AgentSession {
83644
83637
  * directory observes the same title transition.
83645
83638
  */
83646
83639
  renameSession = async (title2, signal) => {
83647
- const normalized = truncate2(title2, 500);
83640
+ const normalized = truncate(title2, 500);
83648
83641
  if (normalized.length === 0) {
83649
83642
  throw new AcpExecutionError("The Session title cannot be empty", {}, "invalid_session_title");
83650
83643
  }
@@ -83825,8 +83818,8 @@ var AgentSession = class _AgentSession {
83825
83818
  );
83826
83819
  }
83827
83820
  this.#capabilities = normalizeAcpCapabilities(initialized);
83828
- this.#agentName = truncate2(initialized.agentInfo?.title ?? initialized.agentInfo?.name ?? this.#agentId, 255);
83829
- this.#agentVersion = truncate2(
83821
+ this.#agentName = truncate(initialized.agentInfo?.title ?? initialized.agentInfo?.name ?? this.#agentId, 255);
83822
+ this.#agentVersion = truncate(
83830
83823
  this.#verifiedAgentVersion.length > 0 ? this.#verifiedAgentVersion : initialized.agentInfo?.version ?? "",
83831
83824
  128
83832
83825
  );
@@ -83956,11 +83949,6 @@ var AgentSession = class _AgentSession {
83956
83949
  return this.#configOptions;
83957
83950
  };
83958
83951
  buildPrompt = (options) => buildPromptContent(options, this.#capabilities);
83959
- nativeHistoryTurn = () => {
83960
- const prompt = this.#nativePrompt;
83961
- const nativeTurnId = this.#connection.inProcessAgent?.nativeTurnId?.() ?? null;
83962
- return prompt === null || nativeTurnId === null || nativeTurnId === prompt.previousTurnId ? null : { commandId: prompt.commandId, nativeTurnId };
83963
- };
83964
83952
  prompt = async (options) => {
83965
83953
  if (this.#turn.running) {
83966
83954
  throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
@@ -83977,7 +83965,7 @@ var AgentSession = class _AgentSession {
83977
83965
  }
83978
83966
  const prompt = this.buildPrompt(options);
83979
83967
  if (this.#sessionTitle === null || this.#sessionTitle.length === 0) {
83980
- this.#sessionTitle = truncate2(options.prompt, 500);
83968
+ this.#sessionTitle = truncate(options.prompt, 500);
83981
83969
  }
83982
83970
  this.#prompted = true;
83983
83971
  this.writeStoredSession((/* @__PURE__ */ new Date()).toISOString());
@@ -84006,10 +83994,6 @@ var AgentSession = class _AgentSession {
84006
83994
  type: "lifecycle-metadata"
84007
83995
  });
84008
83996
  }
84009
- this.#nativePrompt = {
84010
- commandId: options.commandId,
84011
- previousTurnId: this.#connection.inProcessAgent?.nativeTurnId?.() ?? null
84012
- };
84013
83997
  try {
84014
83998
  const response = await this.race(
84015
83999
  this.#connection.connection.agent.request(
@@ -84048,7 +84032,7 @@ var AgentSession = class _AgentSession {
84048
84032
  code: failure2.code,
84049
84033
  commandId: options.commandId,
84050
84034
  kind: "prompt.failed",
84051
- message: truncate2(failure2.message, 500)
84035
+ message: truncate(failure2.message, 500)
84052
84036
  },
84053
84037
  type: "lifecycle-metadata"
84054
84038
  });
@@ -84106,7 +84090,7 @@ var AgentSession = class _AgentSession {
84106
84090
  "ACP agent exited during steering",
84107
84091
  options.signal
84108
84092
  );
84109
- if (!isRecord8(response)) {
84093
+ if (!isRecord(response)) {
84110
84094
  throw new AcpExecutionError(
84111
84095
  "ACP agent returned an invalid steering response",
84112
84096
  {},
@@ -84147,7 +84131,7 @@ var AgentSession = class _AgentSession {
84147
84131
  code: failure2.code,
84148
84132
  commandId: options.commandId,
84149
84133
  kind: "prompt.failed",
84150
- message: truncate2(failure2.message, 500)
84134
+ message: truncate(failure2.message, 500)
84151
84135
  },
84152
84136
  type: "lifecycle-metadata"
84153
84137
  });
@@ -84214,9 +84198,9 @@ var AgentSession = class _AgentSession {
84214
84198
  }
84215
84199
  if (update.sessionUpdate === "available_commands_update") {
84216
84200
  const commands = update.availableCommands.slice(0, 500).map((command) => ({
84217
- description: truncate2(command.description, 500),
84218
- inputHint: truncate2(command.input?.hint ?? "", 255),
84219
- name: truncate2(command.name, 128)
84201
+ description: truncate(command.description, 500),
84202
+ inputHint: truncate(command.input?.hint ?? "", 255),
84203
+ name: truncate(command.name, 128)
84220
84204
  })).filter((command) => command.name.length > 0);
84221
84205
  this.#commands = commands;
84222
84206
  await this.#getObserver().onCommands({
@@ -84247,10 +84231,10 @@ var AgentSession = class _AgentSession {
84247
84231
  }
84248
84232
  if (update.sessionUpdate === "session_info_update") {
84249
84233
  if (Object.hasOwn(update, "title")) {
84250
- this.#sessionTitle = truncate2(update.title ?? "", 500);
84234
+ this.#sessionTitle = truncate(update.title ?? "", 500);
84251
84235
  }
84252
84236
  if (Object.hasOwn(update, "updatedAt")) {
84253
- this.#sessionUpdatedAt = truncate2(update.updatedAt ?? "", 128);
84237
+ this.#sessionUpdatedAt = truncate(update.updatedAt ?? "", 128);
84254
84238
  }
84255
84239
  if (this.#updates.sessionId().length > 0) {
84256
84240
  this.writeStoredSession((/* @__PURE__ */ new Date()).toISOString());