@moxt-ai/mobius 0.0.110 → 0.0.111

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
@@ -19702,6 +19702,17 @@ function date4(params) {
19702
19702
  return _coercedDate(ZodDate, params);
19703
19703
  }
19704
19704
 
19705
+ // ../protocol/src/identifier.ts
19706
+ var IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
19707
+ var identifierStringSchema = external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN);
19708
+ var identifierSchema = identifierStringSchema.brand();
19709
+ function isIdentifier(value) {
19710
+ return identifierSchema.safeParse(value).success;
19711
+ }
19712
+ function decodeIdentifier(value) {
19713
+ return identifierSchema.parse(value);
19714
+ }
19715
+
19705
19716
  // ../protocol/src/prompt-usage.ts
19706
19717
  var TOKEN_COUNT = external_exports.number().int().nonnegative();
19707
19718
  function normalizeQuotaTokenCount(value) {
@@ -19809,9 +19820,7 @@ var FILE_BEGIN_KIND = "file.begin";
19809
19820
  var FILE_CHUNK_KIND = "file.chunk";
19810
19821
  var FILE_END_KIND = "file.end";
19811
19822
  var FILE_FAILED_KIND = "file.failed";
19812
- var IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
19813
19823
  var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
19814
- var IDENTIFIER = external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN);
19815
19824
  var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN);
19816
19825
  var SHORT_TEXT = external_exports.string().max(500);
19817
19826
  var LONG_TEXT = external_exports.string().max(1e5);
@@ -19821,29 +19830,29 @@ var workspaceEntrySchema = external_exports.strictObject({
19821
19830
  }).readonly();
19822
19831
  var sessionMetadataSchema = external_exports.strictObject({
19823
19832
  additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
19824
- agentId: IDENTIFIER,
19833
+ agentId: identifierStringSchema,
19825
19834
  directoryId: DIRECTORY_IDENTIFIER,
19826
19835
  directoryLabel: external_exports.string().min(1).max(2048),
19827
19836
  prompted: external_exports.boolean(),
19828
- sessionId: IDENTIFIER,
19837
+ sessionId: identifierStringSchema,
19829
19838
  title: external_exports.string().max(500),
19830
19839
  updatedAt: external_exports.iso.datetime({ offset: true })
19831
19840
  }).readonly();
19832
19841
  var sessionQueryCommandSchema = external_exports.strictObject({
19833
19842
  kind: external_exports.literal(SESSION_QUERY_KIND),
19834
- requestId: IDENTIFIER,
19835
- sessionIds: external_exports.array(IDENTIFIER).min(1).max(500).readonly()
19843
+ requestId: identifierStringSchema,
19844
+ sessionIds: external_exports.array(identifierStringSchema).min(1).max(500).readonly()
19836
19845
  }).readonly();
19837
19846
  var sessionsQueriedEventSchema = external_exports.strictObject({
19838
19847
  entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
19839
19848
  kind: external_exports.literal(SESSION_QUERIED_KIND),
19840
- requestId: IDENTIFIER
19849
+ requestId: identifierStringSchema
19841
19850
  }).readonly();
19842
19851
  var fileReadCommandSchema = external_exports.strictObject({
19843
19852
  kind: external_exports.literal(FILE_READ_KIND),
19844
19853
  maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
19845
- requestId: IDENTIFIER,
19846
- sessionId: IDENTIFIER,
19854
+ requestId: identifierStringSchema,
19855
+ sessionId: identifierStringSchema,
19847
19856
  path: external_exports.string().min(1).max(4096)
19848
19857
  }).readonly();
19849
19858
  var fileBeginEventSchema = external_exports.strictObject({
@@ -19852,27 +19861,27 @@ var fileBeginEventSchema = external_exports.strictObject({
19852
19861
  mediaType: external_exports.string().min(1).max(255),
19853
19862
  modifiedAt: external_exports.iso.datetime({ offset: true }),
19854
19863
  name: external_exports.string().min(1).max(500),
19855
- requestId: IDENTIFIER,
19856
- sessionId: IDENTIFIER
19864
+ requestId: identifierStringSchema,
19865
+ sessionId: identifierStringSchema
19857
19866
  }).readonly();
19858
19867
  var fileChunkEventSchema = external_exports.strictObject({
19859
19868
  data: external_exports.string().min(1).max(4e5),
19860
19869
  kind: external_exports.literal(FILE_CHUNK_KIND),
19861
- requestId: IDENTIFIER,
19870
+ requestId: identifierStringSchema,
19862
19871
  sequence: external_exports.number().int().nonnegative().max(1024),
19863
- sessionId: IDENTIFIER
19872
+ sessionId: identifierStringSchema
19864
19873
  }).readonly();
19865
19874
  var fileEndEventSchema = external_exports.strictObject({
19866
19875
  kind: external_exports.literal(FILE_END_KIND),
19867
- requestId: IDENTIFIER,
19868
- sessionId: IDENTIFIER
19876
+ requestId: identifierStringSchema,
19877
+ sessionId: identifierStringSchema
19869
19878
  }).readonly();
19870
19879
  var fileFailedEventSchema = external_exports.strictObject({
19871
- code: IDENTIFIER,
19880
+ code: identifierStringSchema,
19872
19881
  kind: external_exports.literal(FILE_FAILED_KIND),
19873
19882
  message: external_exports.string().min(1).max(500),
19874
- requestId: IDENTIFIER,
19875
- sessionId: IDENTIFIER
19883
+ requestId: identifierStringSchema,
19884
+ sessionId: identifierStringSchema
19876
19885
  }).readonly();
19877
19886
  var configValueSchema = external_exports.strictObject({
19878
19887
  description: SHORT_TEXT,
@@ -19923,44 +19932,44 @@ var agentModelEffortSchema = external_exports.strictObject({
19923
19932
  valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
19924
19933
  }).readonly();
19925
19934
  var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
19926
- agentId: IDENTIFIER,
19935
+ agentId: identifierStringSchema,
19927
19936
  kind: external_exports.literal(AGENT_SETTINGS_DISCOVER_KIND),
19928
19937
  model: external_exports.string().min(1).max(500).optional(),
19929
- requestId: IDENTIFIER
19938
+ requestId: identifierStringSchema
19930
19939
  }).readonly();
19931
19940
  var agentSettingsDiscoveredEventSchema = external_exports.strictObject({
19932
- agentId: IDENTIFIER,
19941
+ agentId: identifierStringSchema,
19933
19942
  agentName: external_exports.string().max(255),
19934
19943
  agentVersion: external_exports.string().max(128),
19935
19944
  kind: external_exports.literal(AGENT_SETTINGS_DISCOVERED_KIND),
19936
19945
  modelEffort: agentModelEffortSchema,
19937
- requestId: IDENTIFIER,
19946
+ requestId: identifierStringSchema,
19938
19947
  settings: agentSettingsSchema,
19939
19948
  settingsRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
19940
19949
  }).readonly();
19941
19950
  var agentSettingsDiscoveryFailedEventSchema = external_exports.strictObject({
19942
- code: IDENTIFIER,
19951
+ code: identifierStringSchema,
19943
19952
  kind: external_exports.literal(AGENT_SETTINGS_DISCOVERY_FAILED_KIND),
19944
19953
  message: external_exports.string().min(1).max(500),
19945
- requestId: IDENTIFIER
19954
+ requestId: identifierStringSchema
19946
19955
  }).readonly();
19947
19956
  var agentCatalogRefreshCommandSchema = external_exports.strictObject({
19948
19957
  kind: external_exports.literal(AGENT_CATALOG_REFRESH_KIND),
19949
- requestId: IDENTIFIER
19958
+ requestId: identifierStringSchema
19950
19959
  }).readonly();
19951
19960
  var agentCatalogRefreshedEventSchema = external_exports.strictObject({
19952
19961
  kind: external_exports.literal(AGENT_CATALOG_REFRESHED_KIND),
19953
- requestId: IDENTIFIER
19962
+ requestId: identifierStringSchema
19954
19963
  }).readonly();
19955
19964
  var agentCatalogRefreshFailedEventSchema = external_exports.strictObject({
19956
- code: IDENTIFIER,
19965
+ code: identifierStringSchema,
19957
19966
  kind: external_exports.literal(AGENT_CATALOG_REFRESH_FAILED_KIND),
19958
19967
  message: external_exports.string().min(1).max(500),
19959
- requestId: IDENTIFIER
19968
+ requestId: identifierStringSchema
19960
19969
  }).readonly();
19961
19970
  var sessionConfigurationSelectionSchema = external_exports.strictObject({
19962
19971
  booleanValue: external_exports.boolean(),
19963
- configId: IDENTIFIER,
19972
+ configId: identifierStringSchema,
19964
19973
  value: external_exports.string().max(500),
19965
19974
  valueType: external_exports.enum(["boolean", "select"])
19966
19975
  }).readonly();
@@ -20102,26 +20111,26 @@ var promptResourceSchema = external_exports.strictObject({
20102
20111
  uri: external_exports.string().min(1).max(4096)
20103
20112
  }).readonly();
20104
20113
  var workspaceListCommandSchema = external_exports.strictObject({
20105
- bindingId: IDENTIFIER,
20114
+ bindingId: identifierStringSchema,
20106
20115
  directoryId: DIRECTORY_IDENTIFIER,
20107
20116
  kind: external_exports.literal(WORKSPACE_LIST_KIND),
20108
- requestId: IDENTIFIER
20117
+ requestId: identifierStringSchema
20109
20118
  }).readonly();
20110
20119
  var workspaceEntriesEventSchema = external_exports.strictObject({
20111
- bindingId: IDENTIFIER,
20120
+ bindingId: identifierStringSchema,
20112
20121
  directoryId: DIRECTORY_IDENTIFIER,
20113
20122
  directoryLabel: external_exports.string().min(1).max(2048),
20114
20123
  entries: external_exports.array(workspaceEntrySchema).max(500).readonly(),
20115
20124
  kind: external_exports.literal(WORKSPACE_ENTRIES_KIND),
20116
20125
  parentDirectoryId: external_exports.string().max(2048),
20117
- requestId: IDENTIFIER
20126
+ requestId: identifierStringSchema
20118
20127
  }).readonly();
20119
20128
  var sessionIdentityFields = {
20120
20129
  additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
20121
- agentId: IDENTIFIER,
20122
- bindingId: IDENTIFIER,
20130
+ agentId: identifierStringSchema,
20131
+ bindingId: identifierStringSchema,
20123
20132
  directoryId: DIRECTORY_IDENTIFIER,
20124
- sessionId: IDENTIFIER
20133
+ sessionId: identifierStringSchema
20125
20134
  };
20126
20135
  var sessionPrepareCommandSchema = external_exports.strictObject({
20127
20136
  ...sessionIdentityFields,
@@ -20132,7 +20141,7 @@ var sessionPrepareCommandSchema = external_exports.strictObject({
20132
20141
  valueType: external_exports.enum(["boolean", "select"])
20133
20142
  }).readonly().optional(),
20134
20143
  kind: external_exports.literal(SESSION_PREPARE_KIND),
20135
- requestId: IDENTIFIER,
20144
+ requestId: identifierStringSchema,
20136
20145
  sessionState: external_exports.literal("provisioned").optional(),
20137
20146
  /** Marks an inspection-only Session preparation. */
20138
20147
  transient: external_exports.boolean().optional()
@@ -20153,7 +20162,7 @@ var runtimeTimingsSchema = external_exports.array(
20153
20162
  ).max(16).readonly();
20154
20163
  var sessionReadyEventSchema = external_exports.strictObject({
20155
20164
  additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
20156
- agentId: IDENTIFIER,
20165
+ agentId: identifierStringSchema,
20157
20166
  agentName: external_exports.string().max(255),
20158
20167
  agentVersion: external_exports.string().max(128),
20159
20168
  capabilities: sessionCapabilitiesSchema,
@@ -20162,41 +20171,41 @@ var sessionReadyEventSchema = external_exports.strictObject({
20162
20171
  directoryId: DIRECTORY_IDENTIFIER,
20163
20172
  directoryLabel: external_exports.string().min(1).max(2048),
20164
20173
  kind: external_exports.literal(SESSION_READY_KIND),
20165
- requestId: IDENTIFIER,
20174
+ requestId: identifierStringSchema,
20166
20175
  restored: external_exports.boolean(),
20167
20176
  runtimeTimings: runtimeTimingsSchema.optional(),
20168
- sessionId: IDENTIFIER
20177
+ sessionId: identifierStringSchema
20169
20178
  }).readonly();
20170
20179
  var sessionConfigureCommandSchema = external_exports.strictObject({
20171
20180
  ...sessionIdentityFields,
20172
20181
  booleanValue: external_exports.boolean(),
20173
20182
  configId: external_exports.string().min(1).max(128),
20174
20183
  kind: external_exports.literal(SESSION_CONFIGURE_KIND),
20175
- requestId: IDENTIFIER,
20184
+ requestId: identifierStringSchema,
20176
20185
  value: external_exports.string().max(500),
20177
20186
  valueType: external_exports.enum(["boolean", "select"])
20178
20187
  }).readonly();
20179
20188
  var sessionConfigUpdatedEventSchema = external_exports.strictObject({
20180
20189
  configOptions: sessionConfigOptionsSchema,
20181
20190
  kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
20182
- requestId: IDENTIFIER,
20183
- sessionId: IDENTIFIER
20191
+ requestId: identifierStringSchema,
20192
+ sessionId: identifierStringSchema
20184
20193
  }).readonly();
20185
20194
  var sessionContextUsageUpdatedEventSchema = external_exports.strictObject({
20186
20195
  costAmount: external_exports.number().finite().nonnegative(),
20187
20196
  costCurrency: external_exports.string().max(16),
20188
20197
  hasCost: external_exports.boolean(),
20189
20198
  kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
20190
- sessionId: IDENTIFIER,
20199
+ sessionId: identifierStringSchema,
20191
20200
  size: external_exports.number().int().nonnegative(),
20192
20201
  source: external_exports.literal("context").default("context"),
20193
20202
  used: external_exports.number().int().nonnegative()
20194
20203
  }).readonly();
20195
20204
  var sessionPromptUsageUpdatedEventSchema = external_exports.strictObject({
20196
20205
  _meta: promptMetadataSchema.nullable(),
20197
- commandId: IDENTIFIER,
20206
+ commandId: identifierStringSchema,
20198
20207
  kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
20199
- sessionId: IDENTIFIER,
20208
+ sessionId: identifierStringSchema,
20200
20209
  source: external_exports.literal("prompt"),
20201
20210
  usage: promptUsageSchema.nullable()
20202
20211
  }).refine((event) => event.usage !== null || event._meta?.quota !== void 0).readonly();
@@ -20207,82 +20216,82 @@ var sessionUsageUpdatedEventSchema = external_exports.union([
20207
20216
  var sessionCommandsUpdatedEventSchema = external_exports.strictObject({
20208
20217
  commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
20209
20218
  kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
20210
- sessionId: IDENTIFIER
20219
+ sessionId: identifierStringSchema
20211
20220
  }).readonly();
20212
20221
  var sessionInfoUpdatedEventSchema = external_exports.strictObject({
20213
20222
  kind: external_exports.literal(SESSION_INFO_UPDATED_KIND),
20214
- sessionId: IDENTIFIER,
20223
+ sessionId: identifierStringSchema,
20215
20224
  title: external_exports.string().max(500).nullable(),
20216
20225
  updatedAt: external_exports.string().max(128)
20217
20226
  }).readonly();
20218
20227
  var sessionPermissionRequestedEventSchema = external_exports.strictObject({
20219
- commandId: IDENTIFIER,
20220
- interactionId: IDENTIFIER,
20228
+ commandId: identifierStringSchema,
20229
+ interactionId: identifierStringSchema,
20221
20230
  kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
20222
20231
  options: external_exports.array(permissionOptionSchema).min(1).max(20).readonly(),
20223
- sessionId: IDENTIFIER,
20232
+ sessionId: identifierStringSchema,
20224
20233
  title: external_exports.string().min(1).max(500),
20225
20234
  toolCallId: external_exports.string().min(1).max(255),
20226
20235
  toolKind: external_exports.string().max(64)
20227
20236
  }).readonly();
20228
20237
  var sessionPermissionRespondCommandSchema = external_exports.strictObject({
20229
- interactionId: IDENTIFIER,
20238
+ interactionId: identifierStringSchema,
20230
20239
  kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
20231
20240
  optionId: external_exports.string().max(255),
20232
20241
  outcome: external_exports.enum(["cancelled", "selected"]),
20233
- sessionId: IDENTIFIER
20242
+ sessionId: identifierStringSchema
20234
20243
  }).readonly();
20235
20244
  var sessionPermissionResolvedEventSchema = external_exports.strictObject({
20236
- interactionId: IDENTIFIER,
20245
+ interactionId: identifierStringSchema,
20237
20246
  kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
20238
20247
  optionId: external_exports.string().max(255),
20239
20248
  outcome: external_exports.enum(["cancelled", "selected"]),
20240
- sessionId: IDENTIFIER
20249
+ sessionId: identifierStringSchema
20241
20250
  }).readonly();
20242
20251
  var sessionElicitationRequestedEventSchema = external_exports.strictObject({
20243
20252
  accepted: external_exports.boolean(),
20244
- commandId: IDENTIFIER,
20253
+ commandId: identifierStringSchema,
20245
20254
  elicitationId: external_exports.string().max(255),
20246
20255
  fields: external_exports.array(elicitationFieldSchema).max(100).readonly(),
20247
- interactionId: IDENTIFIER,
20256
+ interactionId: identifierStringSchema,
20248
20257
  kind: external_exports.literal(SESSION_ELICITATION_REQUESTED_KIND),
20249
20258
  message: external_exports.string().min(1).max(2e3),
20250
20259
  mode: external_exports.enum(["form", "url"]),
20251
- sessionId: IDENTIFIER,
20260
+ sessionId: identifierStringSchema,
20252
20261
  url: external_exports.string().max(4096)
20253
20262
  }).readonly();
20254
20263
  var sessionElicitationRespondCommandSchema = external_exports.strictObject({
20255
20264
  action: external_exports.enum(["accept", "cancel", "decline"]),
20256
20265
  content: external_exports.string().max(1e5),
20257
- interactionId: IDENTIFIER,
20266
+ interactionId: identifierStringSchema,
20258
20267
  kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
20259
- sessionId: IDENTIFIER
20268
+ sessionId: identifierStringSchema
20260
20269
  }).readonly();
20261
20270
  var sessionElicitationResolvedEventSchema = external_exports.strictObject({
20262
20271
  action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
20263
- interactionId: IDENTIFIER,
20272
+ interactionId: identifierStringSchema,
20264
20273
  kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
20265
- sessionId: IDENTIFIER
20274
+ sessionId: identifierStringSchema
20266
20275
  }).readonly();
20267
20276
  var sessionOperationFailedEventSchema = external_exports.strictObject({
20268
- code: IDENTIFIER,
20277
+ code: identifierStringSchema,
20269
20278
  kind: external_exports.literal(SESSION_OPERATION_FAILED_KIND),
20270
20279
  message: external_exports.string().min(1).max(500),
20271
- requestId: IDENTIFIER,
20280
+ requestId: identifierStringSchema,
20272
20281
  runtimeTimings: runtimeTimingsSchema.optional(),
20273
20282
  sessionId: external_exports.string().max(128)
20274
20283
  }).readonly();
20275
20284
  var agentContentEventSchema = external_exports.strictObject({
20276
- commandId: IDENTIFIER,
20285
+ commandId: identifierStringSchema,
20277
20286
  content: displayContentSchema,
20278
- contentId: IDENTIFIER,
20287
+ contentId: identifierStringSchema,
20279
20288
  kind: external_exports.literal(AGENT_CONTENT_KIND),
20280
20289
  messageId: external_exports.string().max(255),
20281
- sessionId: IDENTIFIER
20290
+ sessionId: identifierStringSchema
20282
20291
  }).readonly();
20283
20292
  var agentInstallIdentityFields = {
20284
- agentId: IDENTIFIER,
20285
- requestId: IDENTIFIER
20293
+ agentId: identifierStringSchema,
20294
+ requestId: identifierStringSchema
20286
20295
  };
20287
20296
  var agentInstallRequestCommandSchema = external_exports.strictObject({
20288
20297
  ...agentInstallIdentityFields,
@@ -20290,7 +20299,7 @@ var agentInstallRequestCommandSchema = external_exports.strictObject({
20290
20299
  }).readonly();
20291
20300
  var agentInstallCancelCommandSchema = external_exports.strictObject({
20292
20301
  kind: external_exports.literal(AGENT_INSTALL_CANCEL_KIND),
20293
- requestId: IDENTIFIER
20302
+ requestId: identifierStringSchema
20294
20303
  }).readonly();
20295
20304
  var agentInstallStartedEventSchema = external_exports.strictObject({
20296
20305
  ...agentInstallIdentityFields,
@@ -20315,7 +20324,7 @@ var agentInstallCompletedEventSchema = external_exports.strictObject({
20315
20324
  }).readonly();
20316
20325
  var agentInstallFailedEventSchema = external_exports.strictObject({
20317
20326
  ...agentInstallIdentityFields,
20318
- code: IDENTIFIER,
20327
+ code: identifierStringSchema,
20319
20328
  kind: external_exports.literal(AGENT_INSTALL_FAILED_KIND),
20320
20329
  message: external_exports.string().min(1).max(500)
20321
20330
  }).readonly();
@@ -20447,7 +20456,6 @@ var SessionPromptDisposition = Object.freeze({
20447
20456
  });
20448
20457
 
20449
20458
  // ../protocol/src/codecs/messages.ts
20450
- var IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
20451
20459
  var DIRECTORY_IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
20452
20460
  var MAX_PROMPT_LENGTH = 1e4;
20453
20461
  var MAX_PROMPT_ATTACHMENT_LENGTH = 6e6;
@@ -20628,11 +20636,11 @@ function readActivityDetail(value) {
20628
20636
  throw new ProtocolMessageError("Invalid activity detail availability");
20629
20637
  }
20630
20638
  function readIdentifier(value, key) {
20631
- const field = readString(value, key, 128);
20632
- if (!IDENTIFIER_PATTERN2.test(field)) {
20633
- throw new ProtocolMessageError(`Invalid identifier field: ${key}`);
20639
+ try {
20640
+ return decodeIdentifier(value[key]);
20641
+ } catch (cause) {
20642
+ throw new ProtocolMessageError(`Invalid identifier field: ${key}`, { cause });
20634
20643
  }
20635
- return field;
20636
20644
  }
20637
20645
  function readDirectoryIdentifier(value, key) {
20638
20646
  const field = readString(value, key, 2048);
@@ -20681,7 +20689,7 @@ function decodeSessionPromptCommand(encoded) {
20681
20689
  const disposition = readPromptDisposition(value);
20682
20690
  const rawTargetCommandId = value["targetCommandId"];
20683
20691
  const targetCommandId = rawTargetCommandId === void 0 ? "" : readText(value, "targetCommandId", 128);
20684
- if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !IDENTIFIER_PATTERN2.test(targetCommandId)) {
20692
+ if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !isIdentifier(targetCommandId)) {
20685
20693
  throw new ProtocolMessageError("Prompt disposition has an invalid target command");
20686
20694
  }
20687
20695
  const sessionConfigurations = hasSessionConfigurations ? decodeSessionConfigurationSelections(value["sessionConfigurations"]) : [];
@@ -20927,8 +20935,13 @@ var availableSessionHistoryObjectSchema = external_exports.strictObject({
20927
20935
  status: external_exports.literal("available"),
20928
20936
  messages: external_exports.array(historyMessage).max(SESSION_HISTORY_MESSAGE_LIMIT).readonly(),
20929
20937
  truncated: external_exports.boolean(),
20930
- coveredCommandIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/)).max(1e4).readonly(),
20931
- coveredMessageIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}:(?:user|agent)$/)).max(2e4).readonly().default([])
20938
+ coveredCommandIds: external_exports.array(identifierStringSchema).max(1e4).readonly(),
20939
+ coveredMessageIds: external_exports.array(
20940
+ external_exports.string().refine((value) => {
20941
+ const suffix = value.endsWith(":user") ? ":user" : value.endsWith(":agent") ? ":agent" : null;
20942
+ return suffix !== null && isIdentifier(value.slice(0, -suffix.length));
20943
+ })
20944
+ ).max(2e4).readonly().default([])
20932
20945
  });
20933
20946
  var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
20934
20947
  var unavailableSessionHistoryObjectSchema = external_exports.strictObject({
@@ -20962,70 +20975,69 @@ var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
20962
20975
  var NATIVE_SESSION_RESULT_KIND = "native.session.result";
20963
20976
  var NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
20964
20977
  var ACTIVE_TURN_TEXT_LIMIT = 1e6;
20965
- var identifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
20966
20978
  var directoryId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
20967
20979
  var envelope = {
20968
- requestId: identifier,
20969
- sessionId: identifier
20980
+ requestId: identifierStringSchema,
20981
+ sessionId: identifierStringSchema
20970
20982
  };
20971
20983
  var identity = {
20972
20984
  ...envelope,
20973
20985
  kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
20974
20986
  additionalDirectoryIds: external_exports.array(directoryId).max(16).readonly(),
20975
- agentId: identifier,
20976
- bindingId: identifier,
20987
+ agentId: identifierStringSchema,
20988
+ bindingId: identifierStringSchema,
20977
20989
  directoryId
20978
20990
  };
20979
20991
  var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
20980
20992
  external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
20981
- external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
20982
- external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
20983
- external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
20984
- external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifier }).readonly(),
20993
+ external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
20994
+ external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
20995
+ external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
20996
+ external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
20985
20997
  external_exports.strictObject({
20986
20998
  ...identity,
20987
20999
  action: external_exports.literal("list"),
20988
- cursor: identifier.nullable()
21000
+ cursor: identifierStringSchema.nullable()
20989
21001
  }).readonly(),
20990
21002
  external_exports.strictObject({
20991
21003
  ...identity,
20992
21004
  action: external_exports.enum(["import", "fork"]),
20993
- entryId: identifier,
20994
- targetSessionId: identifier
21005
+ entryId: identifierStringSchema,
21006
+ targetSessionId: identifierStringSchema
20995
21007
  }).readonly(),
20996
21008
  external_exports.strictObject({
20997
21009
  ...identity,
20998
21010
  action: external_exports.literal("delete"),
20999
- entryId: identifier
21011
+ entryId: identifierStringSchema
21000
21012
  }).readonly()
21001
21013
  ]);
21002
21014
  var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
21003
21015
  external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
21004
- external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
21005
- external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
21006
- external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
21007
- external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifier }).readonly(),
21016
+ external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
21017
+ external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
21018
+ external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
21019
+ external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
21008
21020
  external_exports.strictObject({
21009
21021
  ...identity,
21010
21022
  action: external_exports.literal("list"),
21011
- cursor: identifier.nullable()
21023
+ cursor: identifierStringSchema.nullable()
21012
21024
  }).readonly(),
21013
21025
  external_exports.strictObject({
21014
21026
  ...identity,
21015
21027
  action: external_exports.enum(["import", "fork"]),
21016
- entryId: identifier,
21017
- targetSessionId: identifier
21028
+ entryId: identifierStringSchema,
21029
+ targetSessionId: identifierStringSchema
21018
21030
  }).readonly(),
21019
21031
  external_exports.strictObject({
21020
21032
  ...identity,
21021
21033
  action: external_exports.literal("delete"),
21022
- entryId: identifier
21034
+ entryId: identifierStringSchema
21023
21035
  }).readonly()
21024
21036
  ]);
21025
21037
  var nativeSessionEntrySchema = external_exports.strictObject({
21026
- entryId: identifier,
21027
- mobiusSessionIds: external_exports.array(identifier).max(500).readonly(),
21028
- nativeSessionId: identifier,
21038
+ entryId: identifierStringSchema,
21039
+ mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
21040
+ nativeSessionId: identifierStringSchema,
21029
21041
  title: external_exports.string().max(500),
21030
21042
  directoryId,
21031
21043
  directoryLabel: external_exports.string().min(1).max(2048),
@@ -21037,17 +21049,17 @@ var resultEnvelope = {
21037
21049
  kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
21038
21050
  };
21039
21051
  var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
21040
- external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifier }).readonly(),
21052
+ external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifierStringSchema }).readonly(),
21041
21053
  external_exports.strictObject({
21042
21054
  ...resultEnvelope,
21043
21055
  action: external_exports.literal("active-turn"),
21044
- targetSessionId: identifier,
21056
+ targetSessionId: identifierStringSchema,
21045
21057
  turn: external_exports.strictObject({
21046
- commandId: identifier,
21058
+ commandId: identifierStringSchema,
21047
21059
  prompt: external_exports.string().max(1e5),
21048
21060
  text: external_exports.string().max(ACTIVE_TURN_TEXT_LIMIT),
21049
21061
  truncated: external_exports.boolean(),
21050
- epoch: identifier,
21062
+ epoch: identifierStringSchema,
21051
21063
  interaction: external_exports.discriminatedUnion("kind", [
21052
21064
  sessionPermissionRequestedEventSchema,
21053
21065
  sessionElicitationRequestedEventSchema
@@ -21066,20 +21078,20 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
21066
21078
  action: external_exports.literal("list"),
21067
21079
  capabilities: sessionCapabilitiesSchema,
21068
21080
  entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
21069
- nextCursor: identifier.nullable()
21081
+ nextCursor: identifierStringSchema.nullable()
21070
21082
  }).readonly(),
21071
21083
  external_exports.strictObject({
21072
21084
  ...resultEnvelope,
21073
21085
  action: external_exports.enum(["import", "fork"]),
21074
- targetSessionId: identifier,
21086
+ targetSessionId: identifierStringSchema,
21075
21087
  ready: sessionReadyEventSchema,
21076
21088
  title: external_exports.string().max(500)
21077
21089
  }).readonly(),
21078
21090
  external_exports.strictObject({
21079
21091
  ...resultEnvelope,
21080
21092
  action: external_exports.literal("preview"),
21081
- entryId: identifier,
21082
- targetSessionId: identifier,
21093
+ entryId: identifierStringSchema,
21094
+ targetSessionId: identifierStringSchema,
21083
21095
  reason: external_exports.enum(["continuation_unavailable", "requested"]),
21084
21096
  history: sessionHistorySchema,
21085
21097
  title: external_exports.string().max(500)
@@ -21087,15 +21099,15 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
21087
21099
  external_exports.strictObject({
21088
21100
  ...resultEnvelope,
21089
21101
  action: external_exports.literal("history"),
21090
- entryId: identifier,
21102
+ entryId: identifierStringSchema,
21091
21103
  history: sessionHistorySchema,
21092
21104
  title: external_exports.string().max(500)
21093
21105
  }).readonly(),
21094
21106
  external_exports.strictObject({
21095
21107
  ...resultEnvelope,
21096
21108
  action: external_exports.literal("delete"),
21097
- entryId: identifier,
21098
- deletedSessionIds: external_exports.array(identifier).max(500).readonly()
21109
+ entryId: identifierStringSchema,
21110
+ deletedSessionIds: external_exports.array(identifierStringSchema).max(500).readonly()
21099
21111
  }).readonly()
21100
21112
  ]);
21101
21113
  var nativeSessionCancelSchema = external_exports.strictObject({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
@@ -21117,17 +21129,16 @@ var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSch
21117
21129
  // ../protocol/src/session-events.ts
21118
21130
  var SESSION_EVENT_KIND = "session.event";
21119
21131
  var SESSION_EVENT_COMMITTED_KIND = "session.event.committed";
21120
- var IDENTIFIER_PATTERN3 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
21121
21132
  var MAX_RECORDED_EVENT_LENGTH = 8 * 1024 * 1024;
21122
21133
  var eventEnvelopeSchema = external_exports.strictObject({
21123
21134
  kind: external_exports.literal(SESSION_EVENT_KIND),
21124
21135
  payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
21125
- sessionId: external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN3)
21136
+ sessionId: identifierStringSchema
21126
21137
  }).readonly();
21127
21138
  var committedEventSchema = external_exports.strictObject({
21128
21139
  kind: external_exports.literal(SESSION_EVENT_COMMITTED_KIND),
21129
21140
  payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
21130
- sessionId: external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN3)
21141
+ sessionId: identifierStringSchema
21131
21142
  }).readonly();
21132
21143
  function decode5(encoded, schema) {
21133
21144
  let value;
@@ -21201,39 +21212,38 @@ var SESSION_LIVE_HISTORY_LOAD_KIND = "session.live-history.load";
21201
21212
  var SESSION_LIVE_HISTORY_LOADED_KIND = "session.live-history.loaded";
21202
21213
  var SESSION_LIVE_HISTORY_PAGE_LOAD_KIND = "session.live-history.page.load";
21203
21214
  var SESSION_LIVE_HISTORY_PAGE_LOADED_KIND = "session.live-history.page.loaded";
21204
- var identifier2 = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
21205
21215
  var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
21206
21216
  var sessionLiveHistoryLoadSchema = external_exports.strictObject({
21207
21217
  additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
21208
- agentId: identifier2,
21209
- bindingId: identifier2,
21218
+ agentId: identifierStringSchema,
21219
+ bindingId: identifierStringSchema,
21210
21220
  directoryId: directoryIdentifier,
21211
21221
  kind: external_exports.literal(SESSION_LIVE_HISTORY_LOAD_KIND),
21212
- requestId: identifier2,
21213
- sessionId: identifier2
21222
+ requestId: identifierStringSchema,
21223
+ sessionId: identifierStringSchema
21214
21224
  }).readonly();
21215
21225
  var sessionLiveHistoryLoadedSchema = external_exports.strictObject({
21216
21226
  history: sessionHistorySchema,
21217
21227
  kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
21218
- requestId: identifier2,
21219
- sessionId: identifier2
21228
+ requestId: identifierStringSchema,
21229
+ sessionId: identifierStringSchema
21220
21230
  }).readonly();
21221
21231
  var sessionLiveHistoryPageLoadSchema = external_exports.strictObject({
21222
21232
  additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
21223
- agentId: identifier2,
21224
- bindingId: identifier2,
21233
+ agentId: identifierStringSchema,
21234
+ bindingId: identifierStringSchema,
21225
21235
  cursor: external_exports.string().min(1).max(512).nullable(),
21226
21236
  directoryId: directoryIdentifier,
21227
21237
  kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOAD_KIND),
21228
21238
  limit: external_exports.number().int().min(1).max(100),
21229
- requestId: identifier2,
21230
- sessionId: identifier2
21239
+ requestId: identifierStringSchema,
21240
+ sessionId: identifierStringSchema
21231
21241
  }).readonly();
21232
21242
  var sessionLiveHistoryPageLoadedSchema = external_exports.strictObject({
21233
21243
  kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOADED_KIND),
21234
21244
  page: nativeMessagePageSchema,
21235
- requestId: identifier2,
21236
- sessionId: identifier2
21245
+ requestId: identifierStringSchema,
21246
+ sessionId: identifierStringSchema
21237
21247
  }).readonly();
21238
21248
  function decode6(schema, encoded) {
21239
21249
  try {
@@ -30474,7 +30484,6 @@ import { dirname as dirname3, join as join15, resolve as resolve4 } from "node:p
30474
30484
  var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
30475
30485
  var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
30476
30486
  var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
30477
- var IDENTIFIER_PATTERN4 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
30478
30487
  var RUNTIME_CREDENTIAL_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
30479
30488
  var MAX_FILE_LENGTH = 16 * 1024;
30480
30489
  var INSTALLATION_POINTER_KEYS = ["installationId", "version"];
@@ -30552,7 +30561,7 @@ function validateApplicationId(value) {
30552
30561
  return value;
30553
30562
  }
30554
30563
  function validateRemoteAppId(value) {
30555
- if (!IDENTIFIER_PATTERN4.test(value)) {
30564
+ if (!isIdentifier(value)) {
30556
30565
  throw new RuntimeInstallationStoreError("invalid_app_id", "The remote App ID is invalid");
30557
30566
  }
30558
30567
  return value;
@@ -30570,7 +30579,7 @@ function validateInstallationId(value) {
30570
30579
  return value;
30571
30580
  }
30572
30581
  function validateIdentifier(value, code) {
30573
- if (!IDENTIFIER_PATTERN4.test(value)) {
30582
+ if (!isIdentifier(value)) {
30574
30583
  throw new RuntimeInstallationStoreError(code, "The saved Runtime connection is invalid");
30575
30584
  }
30576
30585
  return value;
@@ -30974,7 +30983,6 @@ async function openRuntimeInstallationStore(options, signal) {
30974
30983
  // src/pairing/pair-local-machine.ts
30975
30984
  var PAIRING_TIMEOUT_MILLISECONDS = 2e4;
30976
30985
  var PAIRING_CODE_PATTERN = /^[A-HJ-NP-Z2-9]{4}(?:-[A-HJ-NP-Z2-9]{4}){4}$/;
30977
- var IDENTIFIER_PATTERN5 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
30978
30986
  var TOKEN_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
30979
30987
  var CLAIM_RESPONSE_KEYS = ["appId", "channelId", "daemonToken", "runtimeId"];
30980
30988
  var REDEEM_RESPONSE_KEYS = ["appId", "channelId", "runtimeCredential", "runtimeId"];
@@ -31061,7 +31069,7 @@ function parsePairCommand(arguments_, defaultWorkspace) {
31061
31069
  };
31062
31070
  }
31063
31071
  function validatePairingId(value) {
31064
- if (!IDENTIFIER_PATTERN5.test(value)) {
31072
+ if (!isIdentifier(value)) {
31065
31073
  throw new PairingClientError("invalid_pairing_id", "The Runtime pairing ID is invalid");
31066
31074
  }
31067
31075
  return value;
@@ -31130,7 +31138,7 @@ function decodePairingResponse(value, credentialField, expectedKeys) {
31130
31138
  const channelId = value["channelId"];
31131
31139
  const runtimeCredential2 = value[credentialField];
31132
31140
  const runtimeId = value["runtimeId"];
31133
- if (typeof appId !== "string" || !IDENTIFIER_PATTERN5.test(appId) || typeof channelId !== "string" || !IDENTIFIER_PATTERN5.test(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !IDENTIFIER_PATTERN5.test(runtimeId)) {
31141
+ if (typeof appId !== "string" || !isIdentifier(appId) || typeof channelId !== "string" || !isIdentifier(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !isIdentifier(runtimeId)) {
31134
31142
  throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
31135
31143
  }
31136
31144
  return { appId, channelId, runtimeCredential: runtimeCredential2, runtimeId };
@@ -31808,7 +31816,6 @@ var ARTIFACT_SCHEME = "mobius-artifact:";
31808
31816
  var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
31809
31817
  var MAX_AGENT_IMAGE_BASE64_LENGTH = 4e6;
31810
31818
  var MAX_AGENT_RESOURCE_BYTE_LENGTH = 1e6;
31811
- var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
31812
31819
  var PromptArtifactError = class extends Error {
31813
31820
  code;
31814
31821
  constructor(code, message, options = {}) {
@@ -31851,7 +31858,7 @@ function parseReference(resource) {
31851
31858
  const encodedByteLength2 = url2.searchParams.get("byteLength") ?? "";
31852
31859
  const sha256 = url2.searchParams.get("sha256") ?? "";
31853
31860
  const byteLength = Number(encodedByteLength2);
31854
- if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !IDENTIFIER_PATTERN6.test(artifactId) || keys.length !== 2 || keys[0] !== "byteLength" || keys[1] !== "sha256" || !/^[1-9][0-9]*$/.test(encodedByteLength2) || !Number.isSafeInteger(byteLength) || !/^[a-f0-9]{64}$/.test(sha256)) {
31861
+ if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !isIdentifier(artifactId) || keys.length !== 2 || keys[0] !== "byteLength" || keys[1] !== "sha256" || !/^[1-9][0-9]*$/.test(encodedByteLength2) || !Number.isSafeInteger(byteLength) || !/^[a-f0-9]{64}$/.test(sha256)) {
31855
31862
  throw new PromptArtifactError("artifact_reference_invalid", "The prompt artifact reference is invalid");
31856
31863
  }
31857
31864
  return new PromptArtifactReference(artifactId, byteLength, sha256, resource);
@@ -34249,7 +34256,7 @@ var ActiveDaemonTurn = class {
34249
34256
  #truncated = false;
34250
34257
  #sequence = 0;
34251
34258
  #interaction = null;
34252
- #epoch = randomUUID3();
34259
+ #epoch = decodeIdentifier(randomUUID3());
34253
34260
  constructor(command, attemptId) {
34254
34261
  this.attemptId = attemptId;
34255
34262
  this.command = command;
@@ -34285,7 +34292,7 @@ var ActiveDaemonTurn = class {
34285
34292
  }
34286
34293
  };
34287
34294
  snapshot = () => this.#accepted ? {
34288
- commandId: this.command.commandId,
34295
+ commandId: decodeIdentifier(this.command.commandId),
34289
34296
  prompt: this.command.prompt,
34290
34297
  text: this.#text,
34291
34298
  truncated: this.#truncated,
@@ -35055,7 +35062,7 @@ var NativeSessionService = class {
35055
35062
  return {
35056
35063
  action: "create",
35057
35064
  kind: "native.session.result",
35058
- nativeSessionId,
35065
+ nativeSessionId: decodeIdentifier(nativeSessionId),
35059
35066
  requestId: command.requestId,
35060
35067
  sessionId: command.sessionId
35061
35068
  };
@@ -35075,7 +35082,7 @@ var NativeSessionService = class {
35075
35082
  if (authorized === null) {
35076
35083
  return null;
35077
35084
  }
35078
- const entryId = randomUUID4();
35085
+ const entryId = decodeIdentifier(randomUUID4());
35079
35086
  if (this.#entries.size >= 5e3) {
35080
35087
  this.#entries.clear();
35081
35088
  }
@@ -35087,8 +35094,8 @@ var NativeSessionService = class {
35087
35094
  });
35088
35095
  return {
35089
35096
  entryId,
35090
- mobiusSessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => session.sessionId),
35091
- nativeSessionId: info.sessionId,
35097
+ mobiusSessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => decodeIdentifier(session.sessionId)),
35098
+ nativeSessionId: decodeIdentifier(info.sessionId),
35092
35099
  title: info.title ?? "Untitled session",
35093
35100
  directoryId: authorized.directoryId,
35094
35101
  directoryLabel: authorized.directoryLabel,
@@ -35131,7 +35138,7 @@ var NativeSessionService = class {
35131
35138
  "invalid_native_session_response"
35132
35139
  );
35133
35140
  }
35134
- nextCursor = randomUUID4();
35141
+ nextCursor = decodeIdentifier(randomUUID4());
35135
35142
  if (this.#cursors.size >= 500) {
35136
35143
  this.#cursors.clear();
35137
35144
  }
@@ -35248,7 +35255,7 @@ var NativeSessionService = class {
35248
35255
  ...envelope2,
35249
35256
  action: "delete",
35250
35257
  entryId: command.entryId,
35251
- deletedSessionIds
35258
+ deletedSessionIds: deletedSessionIds.map(decodeIdentifier)
35252
35259
  };
35253
35260
  }
35254
35261
  const action = command.action;
@@ -36622,7 +36629,6 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
36622
36629
  // src/runtime.ts
36623
36630
  import { mkdir as mkdir6, realpath as realpath10, stat as stat9 } from "node:fs/promises";
36624
36631
  import { resolve as resolve7 } from "node:path";
36625
- var IDENTIFIER_PATTERN7 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
36626
36632
  var RUNTIME_CREDENTIAL_PATTERN2 = /^[a-zA-Z0-9_-]{32,256}$/;
36627
36633
  var MobiusRuntimeConfigurationError = class extends Error {
36628
36634
  code = "runtime_configuration_invalid";
@@ -36674,7 +36680,7 @@ function relayUrlFromConnection(connection) {
36674
36680
  }
36675
36681
  function loadMobiusRuntimeConnection(environment = process.env) {
36676
36682
  const channelId = requiredEnvironmentValue(environment, "MOBIUS_CHANNEL_ID");
36677
- if (!IDENTIFIER_PATTERN7.test(channelId)) {
36683
+ if (!isIdentifier(channelId)) {
36678
36684
  throw new MobiusRuntimeConfigurationError("MOBIUS_CHANNEL_ID is invalid");
36679
36685
  }
36680
36686
  return Object.freeze({