@moxt-ai/mobius 0.0.279 → 0.0.280

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/cli.js CHANGED
@@ -5398,7 +5398,7 @@ var program = new Command();
5398
5398
  // package.json
5399
5399
  var package_default = {
5400
5400
  name: "@moxt-ai/mobius",
5401
- version: "0.0.279",
5401
+ version: "0.0.280",
5402
5402
  description: "Mobius CLI for pairing and running local AI agent services.",
5403
5403
  type: "module",
5404
5404
  bin: {
@@ -25213,8 +25213,17 @@ var decodeRuntimeDiagnosticsResult = (raw) => runtimeDiagnosticsResultSchema.par
25213
25213
  var encodeRuntimeDiagnosticsRequest = (value) => JSON.stringify(runtimeDiagnosticsRequestSchema.parse(value));
25214
25214
  var encodeRuntimeDiagnosticsResult = (value) => JSON.stringify(runtimeDiagnosticsResultSchema.parse(value));
25215
25215
 
25216
+ // ../mobius-sdk/src/protocol/shared/directory.ts
25217
+ var MAX_WORKSPACE_PATH_LENGTH = 4096;
25218
+ var MAX_DIRECTORY_IDENTIFIER_LENGTH = "path-".length + MAX_WORKSPACE_PATH_LENGTH * 4;
25219
+ var DIRECTORY_IDENTIFIER_PATTERN = new RegExp(
25220
+ `^[a-zA-Z0-9][a-zA-Z0-9_-]{0,${MAX_DIRECTORY_IDENTIFIER_LENGTH - 1}}$`,
25221
+ "u"
25222
+ );
25223
+ var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(MAX_DIRECTORY_IDENTIFIER_LENGTH).regex(DIRECTORY_IDENTIFIER_PATTERN);
25224
+ var isDirectoryIdentifier = (value) => typeof value === "string" && value.length <= MAX_DIRECTORY_IDENTIFIER_LENGTH && DIRECTORY_IDENTIFIER_PATTERN.test(value);
25225
+
25216
25226
  // ../mobius-sdk/src/protocol/shared/message-codec.ts
25217
- var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
25218
25227
  var ProtocolMessageError = class extends Error {
25219
25228
  code = "invalid_protocol_message";
25220
25229
  constructor(message, options = {}) {
@@ -25272,7 +25281,7 @@ function readDirectoryIdentifiers(value, key, maximumCount) {
25272
25281
  const identifiers = [];
25273
25282
  const unique = /* @__PURE__ */ new Set();
25274
25283
  for (const candidate of field) {
25275
- if (typeof candidate !== "string" || !DIRECTORY_IDENTIFIER_PATTERN.test(candidate) || unique.has(candidate)) {
25284
+ if (!isDirectoryIdentifier(candidate) || unique.has(candidate)) {
25276
25285
  throw new ProtocolMessageError(`Invalid directory in field: ${key}`);
25277
25286
  }
25278
25287
  unique.add(candidate);
@@ -25288,8 +25297,8 @@ function readIdentifier(value, key) {
25288
25297
  }
25289
25298
  }
25290
25299
  function readDirectoryIdentifier(value, key) {
25291
- const field = readString(value, key, 2048);
25292
- if (!DIRECTORY_IDENTIFIER_PATTERN.test(field)) {
25300
+ const field = readString(value, key, MAX_DIRECTORY_IDENTIFIER_LENGTH);
25301
+ if (!isDirectoryIdentifier(field)) {
25293
25302
  throw new ProtocolMessageError(`Invalid directory identifier field: ${key}`);
25294
25303
  }
25295
25304
  return field;
@@ -25330,6 +25339,8 @@ var RUNTIME_HEARTBEAT_KIND = "runtime.heartbeat";
25330
25339
  var RUNTIME_HEARTBEAT_ACK_KIND = "runtime.heartbeat.ack";
25331
25340
  var RUNTIME_PING_KIND = "runtime.ping";
25332
25341
  var RUNTIME_PONG_KIND = "runtime.pong";
25342
+ var RUNTIME_HEARTBEAT_MESSAGE = `{"kind":"${RUNTIME_HEARTBEAT_KIND}"}`;
25343
+ var RUNTIME_HEARTBEAT_ACK_MESSAGE = `{"kind":"${RUNTIME_HEARTBEAT_ACK_KIND}"}`;
25333
25344
  function decodeRuntimeLivenessReadyEvent(encoded) {
25334
25345
  const value = parseJson(encoded);
25335
25346
  assertKind(value, RUNTIME_LIVENESS_READY_KIND);
@@ -25338,18 +25349,12 @@ function decodeRuntimeLivenessReadyEvent(encoded) {
25338
25349
  function decodeRuntimeHeartbeatEvent(encoded) {
25339
25350
  const value = parseJson(encoded);
25340
25351
  assertKind(value, RUNTIME_HEARTBEAT_KIND);
25341
- return {
25342
- heartbeatId: readIdentifier(value, "heartbeatId"),
25343
- kind: RUNTIME_HEARTBEAT_KIND
25344
- };
25352
+ return "heartbeatId" in value ? { heartbeatId: readIdentifier(value, "heartbeatId"), kind: RUNTIME_HEARTBEAT_KIND } : { kind: RUNTIME_HEARTBEAT_KIND };
25345
25353
  }
25346
25354
  function decodeRuntimeHeartbeatAckEvent(encoded) {
25347
25355
  const value = parseJson(encoded);
25348
25356
  assertKind(value, RUNTIME_HEARTBEAT_ACK_KIND);
25349
- return {
25350
- heartbeatId: readIdentifier(value, "heartbeatId"),
25351
- kind: RUNTIME_HEARTBEAT_ACK_KIND
25352
- };
25357
+ return "heartbeatId" in value ? { heartbeatId: readIdentifier(value, "heartbeatId"), kind: RUNTIME_HEARTBEAT_ACK_KIND } : { kind: RUNTIME_HEARTBEAT_ACK_KIND };
25353
25358
  }
25354
25359
  function decodeRuntimePingCommand(encoded) {
25355
25360
  const value = parseJson(encoded);
@@ -25365,10 +25370,12 @@ function encodeRuntimeLivenessReadyEvent(message) {
25365
25370
  return JSON.stringify(decodeRuntimeLivenessReadyEvent(JSON.stringify(message)));
25366
25371
  }
25367
25372
  function encodeRuntimeHeartbeatEvent(message) {
25368
- return JSON.stringify(decodeRuntimeHeartbeatEvent(JSON.stringify(message)));
25373
+ const decoded = decodeRuntimeHeartbeatEvent(JSON.stringify(message));
25374
+ return "heartbeatId" in decoded ? JSON.stringify(decoded) : RUNTIME_HEARTBEAT_MESSAGE;
25369
25375
  }
25370
25376
  function encodeRuntimeHeartbeatAckEvent(message) {
25371
- return JSON.stringify(decodeRuntimeHeartbeatAckEvent(JSON.stringify(message)));
25377
+ const decoded = decodeRuntimeHeartbeatAckEvent(JSON.stringify(message));
25378
+ return "heartbeatId" in decoded ? JSON.stringify(decoded) : RUNTIME_HEARTBEAT_ACK_MESSAGE;
25372
25379
  }
25373
25380
  function encodeRuntimePingCommand(message) {
25374
25381
  return JSON.stringify(decodeRuntimePingCommand(JSON.stringify(message)));
@@ -25407,8 +25414,6 @@ var decodeRuntimeUpgradeResult = (raw) => runtimeUpgradeResultSchema.parse(JSON.
25407
25414
  var encodeRuntimeUpgradeResult = (value) => JSON.stringify(runtimeUpgradeResultSchema.parse(value));
25408
25415
 
25409
25416
  // ../mobius-sdk/src/protocol/session/shared/index.ts
25410
- var DIRECTORY_IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
25411
- var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN2);
25412
25417
  var SHORT_TEXT = external_exports.string().max(500);
25413
25418
  var workspaceEntrySchema = external_exports.object({
25414
25419
  directoryId: DIRECTORY_IDENTIFIER,
@@ -25883,7 +25888,7 @@ var sessionMetadataSchema = external_exports.object({
25883
25888
  additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
25884
25889
  agentId: identifierStringSchema,
25885
25890
  directoryId: DIRECTORY_IDENTIFIER,
25886
- directoryLabel: external_exports.string().min(1).max(2048),
25891
+ directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
25887
25892
  prompted: external_exports.boolean(),
25888
25893
  sessionId: identifierStringSchema,
25889
25894
  status: sessionStatusSchema.default({ kind: "idle" }),
@@ -25957,7 +25962,7 @@ var sessionReadyEventSchema = external_exports.object({
25957
25962
  commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
25958
25963
  configOptions: sessionConfigOptionsSchema,
25959
25964
  directoryId: DIRECTORY_IDENTIFIER,
25960
- directoryLabel: external_exports.string().min(1).max(2048),
25965
+ directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
25961
25966
  kind: external_exports.literal(SESSION_READY_KIND),
25962
25967
  requestId: identifierStringSchema,
25963
25968
  restored: external_exports.boolean(),
@@ -26145,7 +26150,6 @@ var NATIVE_SESSION_RESULT_KIND = "native.session.result";
26145
26150
  var NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
26146
26151
  var SESSION_HISTORY_CHARACTER_LIMIT = 256e3;
26147
26152
  var SESSION_HISTORY_MESSAGE_LIMIT = 1e3;
26148
- var directoryId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
26149
26153
  var envelope = {
26150
26154
  requestId: identifierStringSchema,
26151
26155
  sessionId: identifierStringSchema
@@ -26160,10 +26164,10 @@ var activeTurnSnapshotSchema = external_exports.object({
26160
26164
  var identity = {
26161
26165
  ...envelope,
26162
26166
  kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
26163
- additionalDirectoryIds: external_exports.array(directoryId).max(16).readonly(),
26167
+ additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
26164
26168
  agentId: identifierStringSchema,
26165
26169
  bindingId: identifierStringSchema,
26166
- directoryId
26170
+ directoryId: DIRECTORY_IDENTIFIER
26167
26171
  };
26168
26172
  var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
26169
26173
  external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
@@ -26200,10 +26204,10 @@ var nativeSessionEntrySchema = external_exports.object({
26200
26204
  mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
26201
26205
  nativeSessionId: identifierStringSchema,
26202
26206
  title: external_exports.string().max(500),
26203
- directoryId,
26204
- directoryLabel: external_exports.string().min(1).max(2048),
26207
+ directoryId: DIRECTORY_IDENTIFIER,
26208
+ directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
26205
26209
  updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
26206
- additionalDirectories: external_exports.array(external_exports.object({ directoryId, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
26210
+ additionalDirectories: external_exports.array(external_exports.object({ directoryId: DIRECTORY_IDENTIFIER, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
26207
26211
  }).readonly();
26208
26212
  var resultEnvelope = {
26209
26213
  ...envelope,
@@ -26492,8 +26496,8 @@ var acpSessionUpdateSchema = external_exports.discriminatedUnion("sessionUpdate"
26492
26496
  var lifecycleBase = { commandId: identifierStringSchema };
26493
26497
  var promptExecutionContextSchema = external_exports.object({
26494
26498
  agentId: identifierStringSchema,
26495
- directoryId: shortString,
26496
- additionalDirectoryIds: external_exports.array(identifierStringSchema).max(16).readonly()
26499
+ directoryId: DIRECTORY_IDENTIFIER,
26500
+ additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly()
26497
26501
  }).readonly();
26498
26502
  var lifecycleMetadataSchema = external_exports.discriminatedUnion("kind", [
26499
26503
  external_exports.object({ kind: external_exports.literal("session.queue.changed") }).readonly(),
@@ -26645,7 +26649,6 @@ var SESSION_HISTORY_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
26645
26649
  var SESSION_HISTORY_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
26646
26650
  var SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
26647
26651
  var SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND = "session.preview-history.page.loaded";
26648
- var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
26649
26652
  var pageRequestFields = {
26650
26653
  cursor: external_exports.string().min(1).max(512).nullable(),
26651
26654
  eventLimit: external_exports.number().int().min(1).max(1e4),
@@ -26656,10 +26659,10 @@ var pageRequestFields = {
26656
26659
  var sessionHistoryPageLoadSchema = external_exports.object({ ...pageRequestFields, kind: external_exports.literal(SESSION_HISTORY_PAGE_LOAD_KIND) }).readonly();
26657
26660
  var sessionPreviewHistoryPageLoadSchema = external_exports.object({
26658
26661
  ...pageRequestFields,
26659
- additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
26662
+ additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
26660
26663
  agentId: identifierStringSchema,
26661
26664
  bindingId: identifierStringSchema,
26662
- directoryId: directoryIdentifier,
26665
+ directoryId: DIRECTORY_IDENTIFIER,
26663
26666
  kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND)
26664
26667
  }).readonly();
26665
26668
  var pageLoadedFields = {
@@ -26768,10 +26771,10 @@ var workspaceListCommandSchema = external_exports.object({
26768
26771
  var workspaceEntriesEventSchema = external_exports.object({
26769
26772
  bindingId: identifierStringSchema,
26770
26773
  directoryId: DIRECTORY_IDENTIFIER,
26771
- directoryLabel: external_exports.string().min(1).max(2048),
26774
+ directoryLabel: external_exports.string().min(1).max(MAX_WORKSPACE_PATH_LENGTH),
26772
26775
  entries: external_exports.array(workspaceEntrySchema).max(500).readonly(),
26773
26776
  kind: external_exports.literal(WORKSPACE_ENTRIES_KIND),
26774
- parentDirectoryId: external_exports.string().max(2048),
26777
+ parentDirectoryId: external_exports.string().max(MAX_DIRECTORY_IDENTIFIER_LENGTH),
26775
26778
  requestId: identifierStringSchema
26776
26779
  }).readonly();
26777
26780
  var decodeWorkspaceListCommand = (encoded) => decodeZodMessage(encoded, workspaceListCommandSchema);
@@ -92609,12 +92612,11 @@ var RelayConnectionDiagnostics = class {
92609
92612
  false
92610
92613
  );
92611
92614
  };
92612
- heartbeatTimedOut = (connectionEpoch, heartbeatId, timeoutMilliseconds) => {
92615
+ heartbeatTimedOut = (connectionEpoch, timeoutMilliseconds) => {
92613
92616
  this.#record(
92614
92617
  "relay_heartbeat_timed_out",
92615
92618
  {
92616
92619
  connectionEpoch: connectionEpoch.toString(),
92617
- heartbeatId,
92618
92620
  relayOrigin: this.#relayOrigin,
92619
92621
  timeoutMilliseconds: timeoutMilliseconds.toString(),
92620
92622
  ...this.#route
@@ -93666,8 +93668,8 @@ var ResolvedSessionDirectories = class {
93666
93668
  this.cwd = cwd;
93667
93669
  }
93668
93670
  };
93669
- async function resolveSessionDirectories(directories, bindingId, directoryId2, additionalDirectoryIds, signal) {
93670
- const cwd = await directories.resolve(bindingId, directoryId2, signal);
93671
+ async function resolveSessionDirectories(directories, bindingId, directoryId, additionalDirectoryIds, signal) {
93672
+ const cwd = await directories.resolve(bindingId, directoryId, signal);
93671
93673
  const additionalDirectories = [];
93672
93674
  const additionalDirectoryEntries = [];
93673
93675
  const unique = /* @__PURE__ */ new Set([cwd]);
@@ -95104,7 +95106,6 @@ function connectRelay(url2, signal) {
95104
95106
  }
95105
95107
 
95106
95108
  // src/runtime/relay/liveness.ts
95107
- import { randomUUID as randomUUID16 } from "node:crypto";
95108
95109
  var HEARTBEAT_ACK_TIMEOUT_MILLISECONDS = 1e4;
95109
95110
  var HEARTBEAT_INTERVAL_MILLISECONDS = 2e4;
95110
95111
  var RelayLivenessState = class {
@@ -95112,11 +95113,9 @@ var RelayLivenessState = class {
95112
95113
  var UnsupportedRelayLivenessState = class extends RelayLivenessState {
95113
95114
  };
95114
95115
  var AwaitingHeartbeatAckState = class extends RelayLivenessState {
95115
- heartbeatId;
95116
95116
  timeout;
95117
- constructor(heartbeatId, timeout) {
95117
+ constructor(timeout) {
95118
95118
  super();
95119
- this.heartbeatId = heartbeatId;
95120
95119
  this.timeout = timeout;
95121
95120
  }
95122
95121
  };
@@ -95137,13 +95136,10 @@ var RelayConnectionLiveness = class {
95137
95136
  this.#timer = timer;
95138
95137
  this.#transport = transport;
95139
95138
  }
95140
- acknowledge = (event) => {
95139
+ acknowledge = () => {
95141
95140
  if (!(this.#state instanceof AwaitingHeartbeatAckState)) {
95142
95141
  throw new Error("Unexpected relay heartbeat acknowledgement");
95143
95142
  }
95144
- if (event.heartbeatId !== this.#state.heartbeatId) {
95145
- throw new Error("Relay acknowledged the wrong heartbeat");
95146
- }
95147
95143
  this.#state.timeout.cancel();
95148
95144
  this.#state = new WaitingForHeartbeatState(
95149
95145
  this.#timer.schedule(this.#sendHeartbeat, HEARTBEAT_INTERVAL_MILLISECONDS)
@@ -95179,10 +95175,9 @@ var RelayConnectionLiveness = class {
95179
95175
  if (!(this.#state instanceof AwaitingHeartbeatAckState)) {
95180
95176
  throw new Error("Heartbeat timeout occurred in an invalid state");
95181
95177
  }
95182
- const heartbeatId = this.#state.heartbeatId;
95183
95178
  this.#state.timeout.cancel();
95184
95179
  this.#state = new FinishedRelayLivenessState();
95185
- this.#transport.unresponsive(heartbeatId, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS);
95180
+ this.#transport.unresponsive(HEARTBEAT_ACK_TIMEOUT_MILLISECONDS);
95186
95181
  };
95187
95182
  #sendHeartbeat = () => {
95188
95183
  if (this.#state instanceof WaitingForHeartbeatState) {
@@ -95193,17 +95188,13 @@ var RelayConnectionLiveness = class {
95193
95188
  }
95194
95189
  throw new Error("Heartbeat was scheduled in an invalid state");
95195
95190
  }
95196
- const heartbeatId = randomUUID16();
95197
- this.#state = new AwaitingHeartbeatAckState(
95198
- heartbeatId,
95191
+ const awaiting = new AwaitingHeartbeatAckState(
95199
95192
  this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
95200
95193
  );
95201
- const sent = this.#transport.send({
95202
- heartbeatId,
95203
- kind: RUNTIME_HEARTBEAT_KIND
95204
- });
95205
- if (!sent && this.#state instanceof AwaitingHeartbeatAckState && this.#state.heartbeatId === heartbeatId) {
95206
- this.#state.timeout.cancel();
95194
+ this.#state = awaiting;
95195
+ const sent = this.#transport.send({ kind: RUNTIME_HEARTBEAT_KIND });
95196
+ if (!sent && this.#state === awaiting) {
95197
+ awaiting.timeout.cancel();
95207
95198
  this.#state = new FinishedRelayLivenessState();
95208
95199
  }
95209
95200
  };
@@ -95350,8 +95341,8 @@ async function runRelayConnection({
95350
95341
  throw error62;
95351
95342
  }
95352
95343
  },
95353
- unresponsive: (heartbeatId, timeoutMilliseconds) => {
95354
- diagnostics.heartbeatTimedOut(connectionEpoch, heartbeatId, timeoutMilliseconds);
95344
+ unresponsive: (timeoutMilliseconds) => {
95345
+ diagnostics.heartbeatTimedOut(connectionEpoch, timeoutMilliseconds);
95355
95346
  diagnostics.connectionClosed(
95356
95347
  connectionEpoch,
95357
95348
  4001,
@@ -95402,7 +95393,7 @@ async function runRelayConnection({
95402
95393
  return;
95403
95394
  }
95404
95395
  if (kind === RUNTIME_HEARTBEAT_ACK_KIND) {
95405
- connectionLiveness.acknowledge(message);
95396
+ connectionLiveness.acknowledge();
95406
95397
  return;
95407
95398
  }
95408
95399
  commands.dispatch(message);
@@ -95725,7 +95716,7 @@ var RuntimeSessionEventProjection = class {
95725
95716
  };
95726
95717
 
95727
95718
  // src/runtime/session/turn/active-turn.ts
95728
- import { randomUUID as randomUUID17 } from "node:crypto";
95719
+ import { randomUUID as randomUUID16 } from "node:crypto";
95729
95720
  var ActiveRuntimeTurn = class {
95730
95721
  attemptId;
95731
95722
  command;
@@ -95735,7 +95726,7 @@ var ActiveRuntimeTurn = class {
95735
95726
  #dispatch;
95736
95727
  #sequence = 0;
95737
95728
  #interaction = null;
95738
- #epoch = decodeIdentifier(randomUUID17());
95729
+ #epoch = decodeIdentifier(randomUUID16());
95739
95730
  constructor(command, attemptId) {
95740
95731
  this.attemptId = attemptId;
95741
95732
  this.command = command;
@@ -96017,8 +96008,8 @@ var WorkspaceDirectoryListing = class {
96017
96008
  directoryLabel;
96018
96009
  entries;
96019
96010
  parentDirectoryId;
96020
- constructor(directoryId2, directoryLabel, entries, parentDirectoryId) {
96021
- this.directoryId = directoryId2;
96011
+ constructor(directoryId, directoryLabel, entries, parentDirectoryId) {
96012
+ this.directoryId = directoryId;
96022
96013
  this.directoryLabel = directoryLabel;
96023
96014
  this.entries = entries;
96024
96015
  this.parentDirectoryId = parentDirectoryId;
@@ -96026,7 +96017,7 @@ var WorkspaceDirectoryListing = class {
96026
96017
  };
96027
96018
  function encodePath(path8) {
96028
96019
  const encoded = Buffer.from(path8, "utf8").toString("base64url");
96029
- if (encoded.length === 0 || encoded.length > 2e3) {
96020
+ if (path8.length === 0 || path8.length > MAX_WORKSPACE_PATH_LENGTH || encoded.length + "path-".length > MAX_DIRECTORY_IDENTIFIER_LENGTH) {
96030
96021
  throw new LocalAuthorizationError("The local directory path is too long to select");
96031
96022
  }
96032
96023
  return `path-${encoded}`;
@@ -96036,12 +96027,12 @@ function expandCurrentUserHome(path8) {
96036
96027
  }
96037
96028
  function decodePath(value, prefix) {
96038
96029
  const encoded = value.slice(prefix.length);
96039
- if (encoded.length === 0 || encoded.length > 2e3 || !/^[a-zA-Z0-9_-]+$/.test(encoded)) {
96030
+ if (encoded.length === 0 || value.length > MAX_DIRECTORY_IDENTIFIER_LENGTH || !/^[a-zA-Z0-9_-]+$/.test(encoded)) {
96040
96031
  throw new LocalAuthorizationError("The directory identifier is invalid");
96041
96032
  }
96042
96033
  const decoded = Buffer.from(encoded, "base64url").toString("utf8");
96043
96034
  const normalized = process.platform === "win32" && decoded.startsWith("~/") ? normalize3(decoded).replaceAll("\\", "/") : normalize3(decoded);
96044
- if (Buffer.from(decoded, "utf8").toString("base64url") !== encoded || decoded.includes("\0") || normalized !== decoded) {
96035
+ if (Buffer.from(decoded, "utf8").toString("base64url") !== encoded || decoded.length > MAX_WORKSPACE_PATH_LENGTH || decoded.includes("\0") || normalized !== decoded) {
96045
96036
  throw new LocalAuthorizationError("The directory identifier is invalid");
96046
96037
  }
96047
96038
  return decoded;