@moxt-ai/mobius 0.0.108 → 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.
Files changed (47) hide show
  1. package/dist/acp/process-session.d.ts +0 -1
  2. package/dist/acp/process-session.d.ts.map +1 -1
  3. package/dist/acp/process-session.js +0 -9
  4. package/dist/acp/process-session.js.map +1 -1
  5. package/dist/acp/session-manager.d.ts +1 -3
  6. package/dist/acp/session-manager.d.ts.map +1 -1
  7. package/dist/acp/session-manager.js +4 -37
  8. package/dist/acp/session-manager.js.map +1 -1
  9. package/dist/cli.js +175 -261
  10. package/dist/cli.js.map +4 -4
  11. package/dist/daemon-turn-reconciliation.d.ts.map +1 -1
  12. package/dist/daemon-turn-reconciliation.js +3 -3
  13. package/dist/daemon-turn-reconciliation.js.map +1 -1
  14. package/dist/index.js +175 -262
  15. package/dist/index.js.map +4 -4
  16. package/dist/native-sessions/acp-adapter.d.ts.map +1 -1
  17. package/dist/native-sessions/acp-adapter.js +0 -1
  18. package/dist/native-sessions/acp-adapter.js.map +1 -1
  19. package/dist/native-sessions/agent-adapter.d.ts +0 -1
  20. package/dist/native-sessions/agent-adapter.d.ts.map +1 -1
  21. package/dist/native-sessions/agent-adapter.js +0 -3
  22. package/dist/native-sessions/agent-adapter.js.map +1 -1
  23. package/dist/native-sessions/codex-adapter.d.ts.map +1 -1
  24. package/dist/native-sessions/codex-adapter.js +0 -1
  25. package/dist/native-sessions/codex-adapter.js.map +1 -1
  26. package/dist/native-sessions/handle-native-requests.js +1 -1
  27. package/dist/native-sessions/handle-native-requests.js.map +1 -1
  28. package/dist/native-sessions/service.d.ts +1 -1
  29. package/dist/native-sessions/service.d.ts.map +1 -1
  30. package/dist/native-sessions/service.js +9 -46
  31. package/dist/native-sessions/service.js.map +1 -1
  32. package/dist/pairing/pair-local-machine.d.ts.map +1 -1
  33. package/dist/pairing/pair-local-machine.js +5 -6
  34. package/dist/pairing/pair-local-machine.js.map +1 -1
  35. package/dist/prompt-artifact-resolver.d.ts +1 -1
  36. package/dist/prompt-artifact-resolver.d.ts.map +1 -1
  37. package/dist/prompt-artifact-resolver.js +2 -2
  38. package/dist/prompt-artifact-resolver.js.map +1 -1
  39. package/dist/run-daemon.d.ts.map +1 -1
  40. package/dist/run-daemon.js +17 -1
  41. package/dist/run-daemon.js.map +1 -1
  42. package/dist/runtime.d.ts.map +1 -1
  43. package/dist/runtime.js +8202 -8291
  44. package/dist/runtime.js.map +4 -4
  45. package/dist/storage/runtime-installation-store.js +3 -3
  46. package/dist/storage/runtime-installation-store.js.map +1 -1
  47. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3381,7 +3381,7 @@ var program = new Command();
3381
3381
  // package.json
3382
3382
  var package_default = {
3383
3383
  name: "@moxt-ai/mobius",
3384
- version: "0.0.108",
3384
+ version: "0.0.111",
3385
3385
  description: "Mobius CLI for pairing and running local AI agent services.",
3386
3386
  type: "module",
3387
3387
  bin: {
@@ -27836,6 +27836,17 @@ async function discoverLocalAgentInventory(options) {
27836
27836
  // src/config.ts
27837
27837
  import { join as join14, resolve as resolve3 } from "node:path";
27838
27838
 
27839
+ // ../protocol/src/identifier.ts
27840
+ var IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
27841
+ var identifierStringSchema = external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN);
27842
+ var identifierSchema = identifierStringSchema.brand();
27843
+ function isIdentifier(value) {
27844
+ return identifierSchema.safeParse(value).success;
27845
+ }
27846
+ function decodeIdentifier(value) {
27847
+ return identifierSchema.parse(value);
27848
+ }
27849
+
27839
27850
  // ../protocol/src/prompt-usage.ts
27840
27851
  var TOKEN_COUNT = external_exports.number().int().nonnegative();
27841
27852
  function normalizeQuotaTokenCount(value) {
@@ -27943,9 +27954,7 @@ var FILE_BEGIN_KIND = "file.begin";
27943
27954
  var FILE_CHUNK_KIND = "file.chunk";
27944
27955
  var FILE_END_KIND = "file.end";
27945
27956
  var FILE_FAILED_KIND = "file.failed";
27946
- var IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
27947
27957
  var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
27948
- var IDENTIFIER = external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN);
27949
27958
  var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN);
27950
27959
  var SHORT_TEXT = external_exports.string().max(500);
27951
27960
  var LONG_TEXT = external_exports.string().max(1e5);
@@ -27955,29 +27964,29 @@ var workspaceEntrySchema = external_exports.strictObject({
27955
27964
  }).readonly();
27956
27965
  var sessionMetadataSchema = external_exports.strictObject({
27957
27966
  additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
27958
- agentId: IDENTIFIER,
27967
+ agentId: identifierStringSchema,
27959
27968
  directoryId: DIRECTORY_IDENTIFIER,
27960
27969
  directoryLabel: external_exports.string().min(1).max(2048),
27961
27970
  prompted: external_exports.boolean(),
27962
- sessionId: IDENTIFIER,
27971
+ sessionId: identifierStringSchema,
27963
27972
  title: external_exports.string().max(500),
27964
27973
  updatedAt: external_exports.iso.datetime({ offset: true })
27965
27974
  }).readonly();
27966
27975
  var sessionQueryCommandSchema = external_exports.strictObject({
27967
27976
  kind: external_exports.literal(SESSION_QUERY_KIND),
27968
- requestId: IDENTIFIER,
27969
- sessionIds: external_exports.array(IDENTIFIER).min(1).max(500).readonly()
27977
+ requestId: identifierStringSchema,
27978
+ sessionIds: external_exports.array(identifierStringSchema).min(1).max(500).readonly()
27970
27979
  }).readonly();
27971
27980
  var sessionsQueriedEventSchema = external_exports.strictObject({
27972
27981
  entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
27973
27982
  kind: external_exports.literal(SESSION_QUERIED_KIND),
27974
- requestId: IDENTIFIER
27983
+ requestId: identifierStringSchema
27975
27984
  }).readonly();
27976
27985
  var fileReadCommandSchema = external_exports.strictObject({
27977
27986
  kind: external_exports.literal(FILE_READ_KIND),
27978
27987
  maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
27979
- requestId: IDENTIFIER,
27980
- sessionId: IDENTIFIER,
27988
+ requestId: identifierStringSchema,
27989
+ sessionId: identifierStringSchema,
27981
27990
  path: external_exports.string().min(1).max(4096)
27982
27991
  }).readonly();
27983
27992
  var fileBeginEventSchema = external_exports.strictObject({
@@ -27986,27 +27995,27 @@ var fileBeginEventSchema = external_exports.strictObject({
27986
27995
  mediaType: external_exports.string().min(1).max(255),
27987
27996
  modifiedAt: external_exports.iso.datetime({ offset: true }),
27988
27997
  name: external_exports.string().min(1).max(500),
27989
- requestId: IDENTIFIER,
27990
- sessionId: IDENTIFIER
27998
+ requestId: identifierStringSchema,
27999
+ sessionId: identifierStringSchema
27991
28000
  }).readonly();
27992
28001
  var fileChunkEventSchema = external_exports.strictObject({
27993
28002
  data: external_exports.string().min(1).max(4e5),
27994
28003
  kind: external_exports.literal(FILE_CHUNK_KIND),
27995
- requestId: IDENTIFIER,
28004
+ requestId: identifierStringSchema,
27996
28005
  sequence: external_exports.number().int().nonnegative().max(1024),
27997
- sessionId: IDENTIFIER
28006
+ sessionId: identifierStringSchema
27998
28007
  }).readonly();
27999
28008
  var fileEndEventSchema = external_exports.strictObject({
28000
28009
  kind: external_exports.literal(FILE_END_KIND),
28001
- requestId: IDENTIFIER,
28002
- sessionId: IDENTIFIER
28010
+ requestId: identifierStringSchema,
28011
+ sessionId: identifierStringSchema
28003
28012
  }).readonly();
28004
28013
  var fileFailedEventSchema = external_exports.strictObject({
28005
- code: IDENTIFIER,
28014
+ code: identifierStringSchema,
28006
28015
  kind: external_exports.literal(FILE_FAILED_KIND),
28007
28016
  message: external_exports.string().min(1).max(500),
28008
- requestId: IDENTIFIER,
28009
- sessionId: IDENTIFIER
28017
+ requestId: identifierStringSchema,
28018
+ sessionId: identifierStringSchema
28010
28019
  }).readonly();
28011
28020
  var configValueSchema = external_exports.strictObject({
28012
28021
  description: SHORT_TEXT,
@@ -28057,44 +28066,44 @@ var agentModelEffortSchema = external_exports.strictObject({
28057
28066
  valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
28058
28067
  }).readonly();
28059
28068
  var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
28060
- agentId: IDENTIFIER,
28069
+ agentId: identifierStringSchema,
28061
28070
  kind: external_exports.literal(AGENT_SETTINGS_DISCOVER_KIND),
28062
28071
  model: external_exports.string().min(1).max(500).optional(),
28063
- requestId: IDENTIFIER
28072
+ requestId: identifierStringSchema
28064
28073
  }).readonly();
28065
28074
  var agentSettingsDiscoveredEventSchema = external_exports.strictObject({
28066
- agentId: IDENTIFIER,
28075
+ agentId: identifierStringSchema,
28067
28076
  agentName: external_exports.string().max(255),
28068
28077
  agentVersion: external_exports.string().max(128),
28069
28078
  kind: external_exports.literal(AGENT_SETTINGS_DISCOVERED_KIND),
28070
28079
  modelEffort: agentModelEffortSchema,
28071
- requestId: IDENTIFIER,
28080
+ requestId: identifierStringSchema,
28072
28081
  settings: agentSettingsSchema,
28073
28082
  settingsRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
28074
28083
  }).readonly();
28075
28084
  var agentSettingsDiscoveryFailedEventSchema = external_exports.strictObject({
28076
- code: IDENTIFIER,
28085
+ code: identifierStringSchema,
28077
28086
  kind: external_exports.literal(AGENT_SETTINGS_DISCOVERY_FAILED_KIND),
28078
28087
  message: external_exports.string().min(1).max(500),
28079
- requestId: IDENTIFIER
28088
+ requestId: identifierStringSchema
28080
28089
  }).readonly();
28081
28090
  var agentCatalogRefreshCommandSchema = external_exports.strictObject({
28082
28091
  kind: external_exports.literal(AGENT_CATALOG_REFRESH_KIND),
28083
- requestId: IDENTIFIER
28092
+ requestId: identifierStringSchema
28084
28093
  }).readonly();
28085
28094
  var agentCatalogRefreshedEventSchema = external_exports.strictObject({
28086
28095
  kind: external_exports.literal(AGENT_CATALOG_REFRESHED_KIND),
28087
- requestId: IDENTIFIER
28096
+ requestId: identifierStringSchema
28088
28097
  }).readonly();
28089
28098
  var agentCatalogRefreshFailedEventSchema = external_exports.strictObject({
28090
- code: IDENTIFIER,
28099
+ code: identifierStringSchema,
28091
28100
  kind: external_exports.literal(AGENT_CATALOG_REFRESH_FAILED_KIND),
28092
28101
  message: external_exports.string().min(1).max(500),
28093
- requestId: IDENTIFIER
28102
+ requestId: identifierStringSchema
28094
28103
  }).readonly();
28095
28104
  var sessionConfigurationSelectionSchema = external_exports.strictObject({
28096
28105
  booleanValue: external_exports.boolean(),
28097
- configId: IDENTIFIER,
28106
+ configId: identifierStringSchema,
28098
28107
  value: external_exports.string().max(500),
28099
28108
  valueType: external_exports.enum(["boolean", "select"])
28100
28109
  }).readonly();
@@ -28236,26 +28245,26 @@ var promptResourceSchema = external_exports.strictObject({
28236
28245
  uri: external_exports.string().min(1).max(4096)
28237
28246
  }).readonly();
28238
28247
  var workspaceListCommandSchema = external_exports.strictObject({
28239
- bindingId: IDENTIFIER,
28248
+ bindingId: identifierStringSchema,
28240
28249
  directoryId: DIRECTORY_IDENTIFIER,
28241
28250
  kind: external_exports.literal(WORKSPACE_LIST_KIND),
28242
- requestId: IDENTIFIER
28251
+ requestId: identifierStringSchema
28243
28252
  }).readonly();
28244
28253
  var workspaceEntriesEventSchema = external_exports.strictObject({
28245
- bindingId: IDENTIFIER,
28254
+ bindingId: identifierStringSchema,
28246
28255
  directoryId: DIRECTORY_IDENTIFIER,
28247
28256
  directoryLabel: external_exports.string().min(1).max(2048),
28248
28257
  entries: external_exports.array(workspaceEntrySchema).max(500).readonly(),
28249
28258
  kind: external_exports.literal(WORKSPACE_ENTRIES_KIND),
28250
28259
  parentDirectoryId: external_exports.string().max(2048),
28251
- requestId: IDENTIFIER
28260
+ requestId: identifierStringSchema
28252
28261
  }).readonly();
28253
28262
  var sessionIdentityFields = {
28254
28263
  additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
28255
- agentId: IDENTIFIER,
28256
- bindingId: IDENTIFIER,
28264
+ agentId: identifierStringSchema,
28265
+ bindingId: identifierStringSchema,
28257
28266
  directoryId: DIRECTORY_IDENTIFIER,
28258
- sessionId: IDENTIFIER
28267
+ sessionId: identifierStringSchema
28259
28268
  };
28260
28269
  var sessionPrepareCommandSchema = external_exports.strictObject({
28261
28270
  ...sessionIdentityFields,
@@ -28266,7 +28275,7 @@ var sessionPrepareCommandSchema = external_exports.strictObject({
28266
28275
  valueType: external_exports.enum(["boolean", "select"])
28267
28276
  }).readonly().optional(),
28268
28277
  kind: external_exports.literal(SESSION_PREPARE_KIND),
28269
- requestId: IDENTIFIER,
28278
+ requestId: identifierStringSchema,
28270
28279
  sessionState: external_exports.literal("provisioned").optional(),
28271
28280
  /** Marks an inspection-only Session preparation. */
28272
28281
  transient: external_exports.boolean().optional()
@@ -28287,7 +28296,7 @@ var runtimeTimingsSchema = external_exports.array(
28287
28296
  ).max(16).readonly();
28288
28297
  var sessionReadyEventSchema = external_exports.strictObject({
28289
28298
  additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
28290
- agentId: IDENTIFIER,
28299
+ agentId: identifierStringSchema,
28291
28300
  agentName: external_exports.string().max(255),
28292
28301
  agentVersion: external_exports.string().max(128),
28293
28302
  capabilities: sessionCapabilitiesSchema,
@@ -28296,41 +28305,41 @@ var sessionReadyEventSchema = external_exports.strictObject({
28296
28305
  directoryId: DIRECTORY_IDENTIFIER,
28297
28306
  directoryLabel: external_exports.string().min(1).max(2048),
28298
28307
  kind: external_exports.literal(SESSION_READY_KIND),
28299
- requestId: IDENTIFIER,
28308
+ requestId: identifierStringSchema,
28300
28309
  restored: external_exports.boolean(),
28301
28310
  runtimeTimings: runtimeTimingsSchema.optional(),
28302
- sessionId: IDENTIFIER
28311
+ sessionId: identifierStringSchema
28303
28312
  }).readonly();
28304
28313
  var sessionConfigureCommandSchema = external_exports.strictObject({
28305
28314
  ...sessionIdentityFields,
28306
28315
  booleanValue: external_exports.boolean(),
28307
28316
  configId: external_exports.string().min(1).max(128),
28308
28317
  kind: external_exports.literal(SESSION_CONFIGURE_KIND),
28309
- requestId: IDENTIFIER,
28318
+ requestId: identifierStringSchema,
28310
28319
  value: external_exports.string().max(500),
28311
28320
  valueType: external_exports.enum(["boolean", "select"])
28312
28321
  }).readonly();
28313
28322
  var sessionConfigUpdatedEventSchema = external_exports.strictObject({
28314
28323
  configOptions: sessionConfigOptionsSchema,
28315
28324
  kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
28316
- requestId: IDENTIFIER,
28317
- sessionId: IDENTIFIER
28325
+ requestId: identifierStringSchema,
28326
+ sessionId: identifierStringSchema
28318
28327
  }).readonly();
28319
28328
  var sessionContextUsageUpdatedEventSchema = external_exports.strictObject({
28320
28329
  costAmount: external_exports.number().finite().nonnegative(),
28321
28330
  costCurrency: external_exports.string().max(16),
28322
28331
  hasCost: external_exports.boolean(),
28323
28332
  kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
28324
- sessionId: IDENTIFIER,
28333
+ sessionId: identifierStringSchema,
28325
28334
  size: external_exports.number().int().nonnegative(),
28326
28335
  source: external_exports.literal("context").default("context"),
28327
28336
  used: external_exports.number().int().nonnegative()
28328
28337
  }).readonly();
28329
28338
  var sessionPromptUsageUpdatedEventSchema = external_exports.strictObject({
28330
28339
  _meta: promptMetadataSchema.nullable(),
28331
- commandId: IDENTIFIER,
28340
+ commandId: identifierStringSchema,
28332
28341
  kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
28333
- sessionId: IDENTIFIER,
28342
+ sessionId: identifierStringSchema,
28334
28343
  source: external_exports.literal("prompt"),
28335
28344
  usage: promptUsageSchema.nullable()
28336
28345
  }).refine((event) => event.usage !== null || event._meta?.quota !== void 0).readonly();
@@ -28341,82 +28350,82 @@ var sessionUsageUpdatedEventSchema = external_exports.union([
28341
28350
  var sessionCommandsUpdatedEventSchema = external_exports.strictObject({
28342
28351
  commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
28343
28352
  kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
28344
- sessionId: IDENTIFIER
28353
+ sessionId: identifierStringSchema
28345
28354
  }).readonly();
28346
28355
  var sessionInfoUpdatedEventSchema = external_exports.strictObject({
28347
28356
  kind: external_exports.literal(SESSION_INFO_UPDATED_KIND),
28348
- sessionId: IDENTIFIER,
28357
+ sessionId: identifierStringSchema,
28349
28358
  title: external_exports.string().max(500).nullable(),
28350
28359
  updatedAt: external_exports.string().max(128)
28351
28360
  }).readonly();
28352
28361
  var sessionPermissionRequestedEventSchema = external_exports.strictObject({
28353
- commandId: IDENTIFIER,
28354
- interactionId: IDENTIFIER,
28362
+ commandId: identifierStringSchema,
28363
+ interactionId: identifierStringSchema,
28355
28364
  kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
28356
28365
  options: external_exports.array(permissionOptionSchema).min(1).max(20).readonly(),
28357
- sessionId: IDENTIFIER,
28366
+ sessionId: identifierStringSchema,
28358
28367
  title: external_exports.string().min(1).max(500),
28359
28368
  toolCallId: external_exports.string().min(1).max(255),
28360
28369
  toolKind: external_exports.string().max(64)
28361
28370
  }).readonly();
28362
28371
  var sessionPermissionRespondCommandSchema = external_exports.strictObject({
28363
- interactionId: IDENTIFIER,
28372
+ interactionId: identifierStringSchema,
28364
28373
  kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
28365
28374
  optionId: external_exports.string().max(255),
28366
28375
  outcome: external_exports.enum(["cancelled", "selected"]),
28367
- sessionId: IDENTIFIER
28376
+ sessionId: identifierStringSchema
28368
28377
  }).readonly();
28369
28378
  var sessionPermissionResolvedEventSchema = external_exports.strictObject({
28370
- interactionId: IDENTIFIER,
28379
+ interactionId: identifierStringSchema,
28371
28380
  kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
28372
28381
  optionId: external_exports.string().max(255),
28373
28382
  outcome: external_exports.enum(["cancelled", "selected"]),
28374
- sessionId: IDENTIFIER
28383
+ sessionId: identifierStringSchema
28375
28384
  }).readonly();
28376
28385
  var sessionElicitationRequestedEventSchema = external_exports.strictObject({
28377
28386
  accepted: external_exports.boolean(),
28378
- commandId: IDENTIFIER,
28387
+ commandId: identifierStringSchema,
28379
28388
  elicitationId: external_exports.string().max(255),
28380
28389
  fields: external_exports.array(elicitationFieldSchema).max(100).readonly(),
28381
- interactionId: IDENTIFIER,
28390
+ interactionId: identifierStringSchema,
28382
28391
  kind: external_exports.literal(SESSION_ELICITATION_REQUESTED_KIND),
28383
28392
  message: external_exports.string().min(1).max(2e3),
28384
28393
  mode: external_exports.enum(["form", "url"]),
28385
- sessionId: IDENTIFIER,
28394
+ sessionId: identifierStringSchema,
28386
28395
  url: external_exports.string().max(4096)
28387
28396
  }).readonly();
28388
28397
  var sessionElicitationRespondCommandSchema = external_exports.strictObject({
28389
28398
  action: external_exports.enum(["accept", "cancel", "decline"]),
28390
28399
  content: external_exports.string().max(1e5),
28391
- interactionId: IDENTIFIER,
28400
+ interactionId: identifierStringSchema,
28392
28401
  kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
28393
- sessionId: IDENTIFIER
28402
+ sessionId: identifierStringSchema
28394
28403
  }).readonly();
28395
28404
  var sessionElicitationResolvedEventSchema = external_exports.strictObject({
28396
28405
  action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
28397
- interactionId: IDENTIFIER,
28406
+ interactionId: identifierStringSchema,
28398
28407
  kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
28399
- sessionId: IDENTIFIER
28408
+ sessionId: identifierStringSchema
28400
28409
  }).readonly();
28401
28410
  var sessionOperationFailedEventSchema = external_exports.strictObject({
28402
- code: IDENTIFIER,
28411
+ code: identifierStringSchema,
28403
28412
  kind: external_exports.literal(SESSION_OPERATION_FAILED_KIND),
28404
28413
  message: external_exports.string().min(1).max(500),
28405
- requestId: IDENTIFIER,
28414
+ requestId: identifierStringSchema,
28406
28415
  runtimeTimings: runtimeTimingsSchema.optional(),
28407
28416
  sessionId: external_exports.string().max(128)
28408
28417
  }).readonly();
28409
28418
  var agentContentEventSchema = external_exports.strictObject({
28410
- commandId: IDENTIFIER,
28419
+ commandId: identifierStringSchema,
28411
28420
  content: displayContentSchema,
28412
- contentId: IDENTIFIER,
28421
+ contentId: identifierStringSchema,
28413
28422
  kind: external_exports.literal(AGENT_CONTENT_KIND),
28414
28423
  messageId: external_exports.string().max(255),
28415
- sessionId: IDENTIFIER
28424
+ sessionId: identifierStringSchema
28416
28425
  }).readonly();
28417
28426
  var agentInstallIdentityFields = {
28418
- agentId: IDENTIFIER,
28419
- requestId: IDENTIFIER
28427
+ agentId: identifierStringSchema,
28428
+ requestId: identifierStringSchema
28420
28429
  };
28421
28430
  var agentInstallRequestCommandSchema = external_exports.strictObject({
28422
28431
  ...agentInstallIdentityFields,
@@ -28424,7 +28433,7 @@ var agentInstallRequestCommandSchema = external_exports.strictObject({
28424
28433
  }).readonly();
28425
28434
  var agentInstallCancelCommandSchema = external_exports.strictObject({
28426
28435
  kind: external_exports.literal(AGENT_INSTALL_CANCEL_KIND),
28427
- requestId: IDENTIFIER
28436
+ requestId: identifierStringSchema
28428
28437
  }).readonly();
28429
28438
  var agentInstallStartedEventSchema = external_exports.strictObject({
28430
28439
  ...agentInstallIdentityFields,
@@ -28449,7 +28458,7 @@ var agentInstallCompletedEventSchema = external_exports.strictObject({
28449
28458
  }).readonly();
28450
28459
  var agentInstallFailedEventSchema = external_exports.strictObject({
28451
28460
  ...agentInstallIdentityFields,
28452
- code: IDENTIFIER,
28461
+ code: identifierStringSchema,
28453
28462
  kind: external_exports.literal(AGENT_INSTALL_FAILED_KIND),
28454
28463
  message: external_exports.string().min(1).max(500)
28455
28464
  }).readonly();
@@ -28581,7 +28590,6 @@ var SessionPromptDisposition = Object.freeze({
28581
28590
  });
28582
28591
 
28583
28592
  // ../protocol/src/codecs/messages.ts
28584
- var IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
28585
28593
  var DIRECTORY_IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
28586
28594
  var MAX_PROMPT_LENGTH = 1e4;
28587
28595
  var MAX_PROMPT_ATTACHMENT_LENGTH = 6e6;
@@ -28762,11 +28770,11 @@ function readActivityDetail(value) {
28762
28770
  throw new ProtocolMessageError("Invalid activity detail availability");
28763
28771
  }
28764
28772
  function readIdentifier(value, key) {
28765
- const field = readString(value, key, 128);
28766
- if (!IDENTIFIER_PATTERN2.test(field)) {
28767
- throw new ProtocolMessageError(`Invalid identifier field: ${key}`);
28773
+ try {
28774
+ return decodeIdentifier(value[key]);
28775
+ } catch (cause) {
28776
+ throw new ProtocolMessageError(`Invalid identifier field: ${key}`, { cause });
28768
28777
  }
28769
- return field;
28770
28778
  }
28771
28779
  function readDirectoryIdentifier(value, key) {
28772
28780
  const field = readString(value, key, 2048);
@@ -28815,7 +28823,7 @@ function decodeSessionPromptCommand(encoded) {
28815
28823
  const disposition = readPromptDisposition(value);
28816
28824
  const rawTargetCommandId = value["targetCommandId"];
28817
28825
  const targetCommandId = rawTargetCommandId === void 0 ? "" : readText(value, "targetCommandId", 128);
28818
- if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !IDENTIFIER_PATTERN2.test(targetCommandId)) {
28826
+ if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !isIdentifier(targetCommandId)) {
28819
28827
  throw new ProtocolMessageError("Prompt disposition has an invalid target command");
28820
28828
  }
28821
28829
  const sessionConfigurations = hasSessionConfigurations ? decodeSessionConfigurationSelections(value["sessionConfigurations"]) : [];
@@ -29061,8 +29069,13 @@ var availableSessionHistoryObjectSchema = external_exports.strictObject({
29061
29069
  status: external_exports.literal("available"),
29062
29070
  messages: external_exports.array(historyMessage).max(SESSION_HISTORY_MESSAGE_LIMIT).readonly(),
29063
29071
  truncated: external_exports.boolean(),
29064
- coveredCommandIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/)).max(1e4).readonly(),
29065
- coveredMessageIds: external_exports.array(external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}:(?:user|agent)$/)).max(2e4).readonly().default([])
29072
+ coveredCommandIds: external_exports.array(identifierStringSchema).max(1e4).readonly(),
29073
+ coveredMessageIds: external_exports.array(
29074
+ external_exports.string().refine((value) => {
29075
+ const suffix = value.endsWith(":user") ? ":user" : value.endsWith(":agent") ? ":agent" : null;
29076
+ return suffix !== null && isIdentifier(value.slice(0, -suffix.length));
29077
+ })
29078
+ ).max(2e4).readonly().default([])
29066
29079
  });
29067
29080
  var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
29068
29081
  var unavailableSessionHistoryObjectSchema = external_exports.strictObject({
@@ -29096,78 +29109,69 @@ var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
29096
29109
  var NATIVE_SESSION_RESULT_KIND = "native.session.result";
29097
29110
  var NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
29098
29111
  var ACTIVE_TURN_TEXT_LIMIT = 1e6;
29099
- var identifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
29100
29112
  var directoryId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
29101
29113
  var envelope = {
29102
- requestId: identifier,
29103
- sessionId: identifier
29114
+ requestId: identifierStringSchema,
29115
+ sessionId: identifierStringSchema
29104
29116
  };
29105
29117
  var identity = {
29106
29118
  ...envelope,
29107
29119
  kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
29108
29120
  additionalDirectoryIds: external_exports.array(directoryId).max(16).readonly(),
29109
- agentId: identifier,
29110
- bindingId: identifier,
29121
+ agentId: identifierStringSchema,
29122
+ bindingId: identifierStringSchema,
29111
29123
  directoryId
29112
29124
  };
29113
29125
  var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
29114
29126
  external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
29115
- external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
29116
- external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
29117
- external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
29118
- external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
29119
- external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifier }).readonly(),
29127
+ external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
29128
+ external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
29129
+ external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
29130
+ external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
29120
29131
  external_exports.strictObject({
29121
29132
  ...identity,
29122
29133
  action: external_exports.literal("list"),
29123
- cursor: identifier.nullable()
29134
+ cursor: identifierStringSchema.nullable()
29124
29135
  }).readonly(),
29125
29136
  external_exports.strictObject({
29126
29137
  ...identity,
29127
29138
  action: external_exports.enum(["import", "fork"]),
29128
- entryId: identifier,
29129
- targetSessionId: identifier
29139
+ entryId: identifierStringSchema,
29140
+ targetSessionId: identifierStringSchema
29130
29141
  }).readonly(),
29131
29142
  external_exports.strictObject({
29132
29143
  ...identity,
29133
29144
  action: external_exports.literal("delete"),
29134
- entryId: identifier
29145
+ entryId: identifierStringSchema
29135
29146
  }).readonly()
29136
29147
  ]);
29137
29148
  var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
29138
29149
  external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
29139
- external_exports.strictObject({ ...identity, action: external_exports.literal("linked-history"), targetSessionId: identifier }).readonly(),
29140
- external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifier }).readonly(),
29141
- external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
29142
- external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifier }).readonly(),
29143
- external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifier }).readonly(),
29150
+ external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
29151
+ external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
29152
+ external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
29153
+ external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
29144
29154
  external_exports.strictObject({
29145
29155
  ...identity,
29146
29156
  action: external_exports.literal("list"),
29147
- cursor: identifier.nullable()
29157
+ cursor: identifierStringSchema.nullable()
29148
29158
  }).readonly(),
29149
29159
  external_exports.strictObject({
29150
29160
  ...identity,
29151
29161
  action: external_exports.enum(["import", "fork"]),
29152
- entryId: identifier,
29153
- targetSessionId: identifier
29154
- }).readonly(),
29155
- external_exports.strictObject({
29156
- ...identity,
29157
- action: external_exports.enum(["import-only", "fork-only"]),
29158
- entryId: identifier,
29159
- targetSessionId: identifier
29162
+ entryId: identifierStringSchema,
29163
+ targetSessionId: identifierStringSchema
29160
29164
  }).readonly(),
29161
29165
  external_exports.strictObject({
29162
29166
  ...identity,
29163
29167
  action: external_exports.literal("delete"),
29164
- entryId: identifier
29168
+ entryId: identifierStringSchema
29165
29169
  }).readonly()
29166
29170
  ]);
29167
29171
  var nativeSessionEntrySchema = external_exports.strictObject({
29168
- entryId: identifier,
29169
- mobiusSessionIds: external_exports.array(identifier).max(500).readonly(),
29170
- nativeSessionId: identifier,
29172
+ entryId: identifierStringSchema,
29173
+ mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
29174
+ nativeSessionId: identifierStringSchema,
29171
29175
  title: external_exports.string().max(500),
29172
29176
  directoryId,
29173
29177
  directoryLabel: external_exports.string().min(1).max(2048),
@@ -29179,23 +29183,17 @@ var resultEnvelope = {
29179
29183
  kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
29180
29184
  };
29181
29185
  var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
29182
- external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifier }).readonly(),
29183
- external_exports.strictObject({
29184
- ...resultEnvelope,
29185
- action: external_exports.literal("linked-history"),
29186
- targetSessionId: identifier,
29187
- history: sessionHistorySchema
29188
- }).readonly(),
29186
+ external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifierStringSchema }).readonly(),
29189
29187
  external_exports.strictObject({
29190
29188
  ...resultEnvelope,
29191
29189
  action: external_exports.literal("active-turn"),
29192
- targetSessionId: identifier,
29190
+ targetSessionId: identifierStringSchema,
29193
29191
  turn: external_exports.strictObject({
29194
- commandId: identifier,
29192
+ commandId: identifierStringSchema,
29195
29193
  prompt: external_exports.string().max(1e5),
29196
29194
  text: external_exports.string().max(ACTIVE_TURN_TEXT_LIMIT),
29197
29195
  truncated: external_exports.boolean(),
29198
- epoch: identifier,
29196
+ epoch: identifierStringSchema,
29199
29197
  interaction: external_exports.discriminatedUnion("kind", [
29200
29198
  sessionPermissionRequestedEventSchema,
29201
29199
  sessionElicitationRequestedEventSchema
@@ -29204,11 +29202,6 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
29204
29202
  state: external_exports.literal("running")
29205
29203
  }).readonly().nullable()
29206
29204
  }).readonly(),
29207
- external_exports.strictObject({
29208
- ...resultEnvelope,
29209
- action: external_exports.literal("unlinked-history"),
29210
- targetSessionId: identifier
29211
- }).readonly(),
29212
29205
  external_exports.strictObject({
29213
29206
  ...resultEnvelope,
29214
29207
  action: external_exports.literal("find"),
@@ -29219,21 +29212,20 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
29219
29212
  action: external_exports.literal("list"),
29220
29213
  capabilities: sessionCapabilitiesSchema,
29221
29214
  entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
29222
- nextCursor: identifier.nullable()
29215
+ nextCursor: identifierStringSchema.nullable()
29223
29216
  }).readonly(),
29224
29217
  external_exports.strictObject({
29225
29218
  ...resultEnvelope,
29226
29219
  action: external_exports.enum(["import", "fork"]),
29227
- targetSessionId: identifier,
29220
+ targetSessionId: identifierStringSchema,
29228
29221
  ready: sessionReadyEventSchema,
29229
- history: sessionHistorySchema,
29230
29222
  title: external_exports.string().max(500)
29231
29223
  }).readonly(),
29232
29224
  external_exports.strictObject({
29233
29225
  ...resultEnvelope,
29234
29226
  action: external_exports.literal("preview"),
29235
- entryId: identifier,
29236
- targetSessionId: identifier,
29227
+ entryId: identifierStringSchema,
29228
+ targetSessionId: identifierStringSchema,
29237
29229
  reason: external_exports.enum(["continuation_unavailable", "requested"]),
29238
29230
  history: sessionHistorySchema,
29239
29231
  title: external_exports.string().max(500)
@@ -29241,15 +29233,15 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
29241
29233
  external_exports.strictObject({
29242
29234
  ...resultEnvelope,
29243
29235
  action: external_exports.literal("history"),
29244
- entryId: identifier,
29236
+ entryId: identifierStringSchema,
29245
29237
  history: sessionHistorySchema,
29246
29238
  title: external_exports.string().max(500)
29247
29239
  }).readonly(),
29248
29240
  external_exports.strictObject({
29249
29241
  ...resultEnvelope,
29250
29242
  action: external_exports.literal("delete"),
29251
- entryId: identifier,
29252
- deletedSessionIds: external_exports.array(identifier).max(500).readonly()
29243
+ entryId: identifierStringSchema,
29244
+ deletedSessionIds: external_exports.array(identifierStringSchema).max(500).readonly()
29253
29245
  }).readonly()
29254
29246
  ]);
29255
29247
  var nativeSessionCancelSchema = external_exports.strictObject({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
@@ -29271,17 +29263,16 @@ var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSch
29271
29263
  // ../protocol/src/session-events.ts
29272
29264
  var SESSION_EVENT_KIND = "session.event";
29273
29265
  var SESSION_EVENT_COMMITTED_KIND = "session.event.committed";
29274
- var IDENTIFIER_PATTERN3 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
29275
29266
  var MAX_RECORDED_EVENT_LENGTH = 8 * 1024 * 1024;
29276
29267
  var eventEnvelopeSchema = external_exports.strictObject({
29277
29268
  kind: external_exports.literal(SESSION_EVENT_KIND),
29278
29269
  payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
29279
- sessionId: external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN3)
29270
+ sessionId: identifierStringSchema
29280
29271
  }).readonly();
29281
29272
  var committedEventSchema = external_exports.strictObject({
29282
29273
  kind: external_exports.literal(SESSION_EVENT_COMMITTED_KIND),
29283
29274
  payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
29284
- sessionId: external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN3)
29275
+ sessionId: identifierStringSchema
29285
29276
  }).readonly();
29286
29277
  function decode5(encoded, schema) {
29287
29278
  let value;
@@ -29355,39 +29346,38 @@ var SESSION_LIVE_HISTORY_LOAD_KIND = "session.live-history.load";
29355
29346
  var SESSION_LIVE_HISTORY_LOADED_KIND = "session.live-history.loaded";
29356
29347
  var SESSION_LIVE_HISTORY_PAGE_LOAD_KIND = "session.live-history.page.load";
29357
29348
  var SESSION_LIVE_HISTORY_PAGE_LOADED_KIND = "session.live-history.page.loaded";
29358
- var identifier2 = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
29359
29349
  var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
29360
29350
  var sessionLiveHistoryLoadSchema = external_exports.strictObject({
29361
29351
  additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
29362
- agentId: identifier2,
29363
- bindingId: identifier2,
29352
+ agentId: identifierStringSchema,
29353
+ bindingId: identifierStringSchema,
29364
29354
  directoryId: directoryIdentifier,
29365
29355
  kind: external_exports.literal(SESSION_LIVE_HISTORY_LOAD_KIND),
29366
- requestId: identifier2,
29367
- sessionId: identifier2
29356
+ requestId: identifierStringSchema,
29357
+ sessionId: identifierStringSchema
29368
29358
  }).readonly();
29369
29359
  var sessionLiveHistoryLoadedSchema = external_exports.strictObject({
29370
29360
  history: sessionHistorySchema,
29371
29361
  kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
29372
- requestId: identifier2,
29373
- sessionId: identifier2
29362
+ requestId: identifierStringSchema,
29363
+ sessionId: identifierStringSchema
29374
29364
  }).readonly();
29375
29365
  var sessionLiveHistoryPageLoadSchema = external_exports.strictObject({
29376
29366
  additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
29377
- agentId: identifier2,
29378
- bindingId: identifier2,
29367
+ agentId: identifierStringSchema,
29368
+ bindingId: identifierStringSchema,
29379
29369
  cursor: external_exports.string().min(1).max(512).nullable(),
29380
29370
  directoryId: directoryIdentifier,
29381
29371
  kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOAD_KIND),
29382
29372
  limit: external_exports.number().int().min(1).max(100),
29383
- requestId: identifier2,
29384
- sessionId: identifier2
29373
+ requestId: identifierStringSchema,
29374
+ sessionId: identifierStringSchema
29385
29375
  }).readonly();
29386
29376
  var sessionLiveHistoryPageLoadedSchema = external_exports.strictObject({
29387
29377
  kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOADED_KIND),
29388
29378
  page: nativeMessagePageSchema,
29389
- requestId: identifier2,
29390
- sessionId: identifier2
29379
+ requestId: identifierStringSchema,
29380
+ sessionId: identifierStringSchema
29391
29381
  }).readonly();
29392
29382
  function decode6(schema, encoded) {
29393
29383
  try {
@@ -29706,7 +29696,6 @@ import { dirname as dirname3, join as join15, resolve as resolve4 } from "node:p
29706
29696
  var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
29707
29697
  var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
29708
29698
  var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
29709
- var IDENTIFIER_PATTERN4 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
29710
29699
  var RUNTIME_CREDENTIAL_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
29711
29700
  var MAX_FILE_LENGTH = 16 * 1024;
29712
29701
  var INSTALLATION_POINTER_KEYS = ["installationId", "version"];
@@ -29784,7 +29773,7 @@ function validateApplicationId(value) {
29784
29773
  return value;
29785
29774
  }
29786
29775
  function validateRemoteAppId(value) {
29787
- if (!IDENTIFIER_PATTERN4.test(value)) {
29776
+ if (!isIdentifier(value)) {
29788
29777
  throw new RuntimeInstallationStoreError("invalid_app_id", "The remote App ID is invalid");
29789
29778
  }
29790
29779
  return value;
@@ -29802,7 +29791,7 @@ function validateInstallationId(value) {
29802
29791
  return value;
29803
29792
  }
29804
29793
  function validateIdentifier(value, code) {
29805
- if (!IDENTIFIER_PATTERN4.test(value)) {
29794
+ if (!isIdentifier(value)) {
29806
29795
  throw new RuntimeInstallationStoreError(code, "The saved Runtime connection is invalid");
29807
29796
  }
29808
29797
  return value;
@@ -30206,7 +30195,6 @@ async function openRuntimeInstallationStore(options, signal) {
30206
30195
  // src/pairing/pair-local-machine.ts
30207
30196
  var PAIRING_TIMEOUT_MILLISECONDS = 2e4;
30208
30197
  var PAIRING_CODE_PATTERN = /^[A-HJ-NP-Z2-9]{4}(?:-[A-HJ-NP-Z2-9]{4}){4}$/;
30209
- var IDENTIFIER_PATTERN5 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
30210
30198
  var TOKEN_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
30211
30199
  var CLAIM_RESPONSE_KEYS = ["appId", "channelId", "daemonToken", "runtimeId"];
30212
30200
  var REDEEM_RESPONSE_KEYS = ["appId", "channelId", "runtimeCredential", "runtimeId"];
@@ -30293,7 +30281,7 @@ function parsePairCommand(arguments_, defaultWorkspace) {
30293
30281
  };
30294
30282
  }
30295
30283
  function validatePairingId(value) {
30296
- if (!IDENTIFIER_PATTERN5.test(value)) {
30284
+ if (!isIdentifier(value)) {
30297
30285
  throw new PairingClientError("invalid_pairing_id", "The Runtime pairing ID is invalid");
30298
30286
  }
30299
30287
  return value;
@@ -30362,7 +30350,7 @@ function decodePairingResponse(value, credentialField, expectedKeys) {
30362
30350
  const channelId = value["channelId"];
30363
30351
  const runtimeCredential2 = value[credentialField];
30364
30352
  const runtimeId = value["runtimeId"];
30365
- 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)) {
30353
+ if (typeof appId !== "string" || !isIdentifier(appId) || typeof channelId !== "string" || !isIdentifier(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !isIdentifier(runtimeId)) {
30366
30354
  throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
30367
30355
  }
30368
30356
  return { appId, channelId, runtimeCredential: runtimeCredential2, runtimeId };
@@ -32353,15 +32341,6 @@ var PendingElicitation = class {
32353
32341
  var PROCESS_STOP_TIMEOUT_MILLISECONDS = 1e3;
32354
32342
  var MAX_PRE_SESSION_UPDATES = 100;
32355
32343
  var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
32356
- function nativeHistoryNotRetained() {
32357
- return {
32358
- cause: {
32359
- code: "native_history_not_retained",
32360
- message: "Native message history is not retained in the cloud for this Session."
32361
- },
32362
- status: "unavailable"
32363
- };
32364
- }
32365
32344
  var NullAcpSessionObserver = class {
32366
32345
  onCommands = () => Promise.resolve();
32367
32346
  onConfig = () => Promise.resolve();
@@ -34108,7 +34087,7 @@ var AcpSessionManager = class {
34108
34087
  return await this.#startRetainedSessionProcess(
34109
34088
  options,
34110
34089
  async () => await AcpProcessSession.start(
34111
- this.#sessionIdentity === "native" && isNativeChatSessionId(options.agent.id, options.sessionId) && this.#store.read(options.sessionId) instanceof MissingAcpStoredSession ? { ...options, origin: { kind: "import", nativeSessionId: options.sessionId } } : options,
34090
+ options.origin === void 0 && this.#sessionIdentity === "native" && isNativeChatSessionId(options.agent.id, options.sessionId) && this.#store.read(options.sessionId) instanceof MissingAcpStoredSession ? { ...options, origin: { kind: "import", nativeSessionId: options.sessionId } } : options,
34112
34091
  () => this.#observer,
34113
34092
  this.#store,
34114
34093
  metrics
@@ -34651,26 +34630,7 @@ var AcpSessionManager = class {
34651
34630
  this.#endSessionUse(options.sessionId);
34652
34631
  }
34653
34632
  };
34654
- loadLinkedSessionHistory = async (options) => {
34655
- options.signal.throwIfAborted();
34656
- const stored = this.#store.read(options.sessionId);
34657
- if (!(stored instanceof FoundAcpStoredSession) || !stored.session.prompted) {
34658
- return null;
34659
- }
34660
- const linked = stored.session;
34661
- if (linked.agentId !== options.agent.id || linked.cwd !== options.cwd || linked.additionalDirectories.length !== options.additionalDirectories.length || linked.additionalDirectories.some((directory, index) => directory !== options.additionalDirectories[index])) {
34662
- throw new AcpExecutionError(
34663
- "The session belongs to another Agent or workspace",
34664
- {},
34665
- "session_identity_mismatch"
34666
- );
34667
- }
34668
- if (this.#nativeHistoryReader === null) {
34669
- return await this.loadSessionHistory(options);
34670
- }
34671
- return await this.#nativeHistoryReader.read(options, linked.nativeSessionId) ?? await this.loadSessionHistory(options);
34672
- };
34673
- openNativeSession = async (options, origin, loadHistory) => {
34633
+ openNativeSession = async (options, origin) => {
34674
34634
  const key = `${options.agent.id}:${origin.nativeSessionId}`;
34675
34635
  if (this.#nativeOperations.has(key)) {
34676
34636
  throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
@@ -34700,19 +34660,10 @@ var AcpSessionManager = class {
34700
34660
  }
34701
34661
  this.#nativeOperations.add(key);
34702
34662
  try {
34703
- const history = loadHistory ? await runtime.loadHistory(options.signal) : nativeHistoryNotRetained();
34704
34663
  return {
34705
34664
  prepared: runtime.prepared(),
34706
- sessionId: existing.sessionId,
34707
- history
34665
+ sessionId: existing.sessionId
34708
34666
  };
34709
- } catch (error62) {
34710
- await this.#retireSessionProcess(
34711
- existing.sessionId,
34712
- runtime,
34713
- async () => await runtime.closeProcess()
34714
- );
34715
- throw error62;
34716
34667
  } finally {
34717
34668
  this.#nativeOperations.delete(key);
34718
34669
  this.#notifyProcessCapacityChanged();
@@ -34731,16 +34682,10 @@ var AcpSessionManager = class {
34731
34682
  const openedKey = `${options.agent.id}:${runtime.nativeSessionId()}`;
34732
34683
  this.#nativeOperations.add(openedKey);
34733
34684
  try {
34734
- const history = loadHistory ? await runtime.loadHistory(options.signal) : nativeHistoryNotRetained();
34735
34685
  return {
34736
34686
  sessionId: options.sessionId,
34737
- prepared: runtime.prepared(),
34738
- history
34687
+ prepared: runtime.prepared()
34739
34688
  };
34740
- } catch (error62) {
34741
- this.#store.remove(options.sessionId);
34742
- await this.#retireSessionProcess(options.sessionId, runtime, async () => await runtime.closeProcess());
34743
- throw error62;
34744
34689
  } finally {
34745
34690
  this.#nativeOperations.delete(openedKey);
34746
34691
  this.#notifyProcessCapacityChanged();
@@ -35309,7 +35254,6 @@ var ARTIFACT_SCHEME = "mobius-artifact:";
35309
35254
  var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
35310
35255
  var MAX_AGENT_IMAGE_BASE64_LENGTH = 4e6;
35311
35256
  var MAX_AGENT_RESOURCE_BYTE_LENGTH = 1e6;
35312
- var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
35313
35257
  var PromptArtifactError = class extends Error {
35314
35258
  code;
35315
35259
  constructor(code, message, options = {}) {
@@ -35352,7 +35296,7 @@ function parseReference(resource) {
35352
35296
  const encodedByteLength2 = url2.searchParams.get("byteLength") ?? "";
35353
35297
  const sha256 = url2.searchParams.get("sha256") ?? "";
35354
35298
  const byteLength = Number(encodedByteLength2);
35355
- 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)) {
35299
+ 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)) {
35356
35300
  throw new PromptArtifactError("artifact_reference_invalid", "The prompt artifact reference is invalid");
35357
35301
  }
35358
35302
  return new PromptArtifactReference(artifactId, byteLength, sha256, resource);
@@ -37750,7 +37694,7 @@ var ActiveDaemonTurn = class {
37750
37694
  #truncated = false;
37751
37695
  #sequence = 0;
37752
37696
  #interaction = null;
37753
- #epoch = randomUUID3();
37697
+ #epoch = decodeIdentifier(randomUUID3());
37754
37698
  constructor(command, attemptId) {
37755
37699
  this.attemptId = attemptId;
37756
37700
  this.command = command;
@@ -37786,7 +37730,7 @@ var ActiveDaemonTurn = class {
37786
37730
  }
37787
37731
  };
37788
37732
  snapshot = () => this.#accepted ? {
37789
- commandId: this.command.commandId,
37733
+ commandId: decodeIdentifier(this.command.commandId),
37790
37734
  prompt: this.command.prompt,
37791
37735
  text: this.#text,
37792
37736
  truncated: this.#truncated,
@@ -38337,7 +38281,7 @@ function createNativeSessionRequestHandler(dependencies) {
38337
38281
  };
38338
38282
  const handle = (command) => {
38339
38283
  const previous = [...pending.values()].filter((request) => request.agentId === command.agentId);
38340
- const parallelRead = command.action === "linked-history" || command.action === "active-turn";
38284
+ const parallelRead = command.action === "active-turn";
38341
38285
  if (pending.has(command.requestId) || pending.size >= 4 || !parallelRead && previous.some((request) => !request.controller.signal.aborted)) {
38342
38286
  reportOperationFailure(
38343
38287
  socket,
@@ -38456,7 +38400,6 @@ async function readAcpHistory(sessions, directories, bindingId, options, nativeS
38456
38400
 
38457
38401
  // src/native-sessions/acp-adapter.ts
38458
38402
  var acpSessionAdapter = {
38459
- linkedHistory: async ({ sessions, directories, bindingId, options, nativeSessionId }) => await readAcpHistory(sessions, directories, bindingId, options, nativeSessionId),
38460
38403
  history: async ({ sessions, directories, bindingId, options, nativeSessionId }) => await readAcpHistory(sessions, directories, bindingId, options, nativeSessionId),
38461
38404
  preview: async ({ sessions, options, nativeSessionId }) => await sessions.previewNativeSession(options, nativeSessionId)
38462
38405
  };
@@ -38476,7 +38419,6 @@ async function verifiedHistory(context, full) {
38476
38419
  return snapshot.history;
38477
38420
  }
38478
38421
  var codexSessionAdapter = {
38479
- linkedHistory: async (context) => await verifiedHistory(context, true),
38480
38422
  history: async (context) => await verifiedHistory(context, true),
38481
38423
  // Codex enforces an exclusive writer per thread. Its read-only app-server
38482
38424
  // history path keeps externally owned conversations previewable.
@@ -38485,9 +38427,6 @@ var codexSessionAdapter = {
38485
38427
 
38486
38428
  // src/native-sessions/agent-adapter.ts
38487
38429
  var genericSessionAdapter = {
38488
- linkedHistory: async () => {
38489
- throw new AcpExecutionError("This Agent does not support Chat history", {}, "native_session_unsupported");
38490
- },
38491
38430
  history: async () => {
38492
38431
  throw new AcpExecutionError("Native history is unavailable for this Agent", {}, "native_session_unsupported");
38493
38432
  },
@@ -38547,42 +38486,6 @@ var NativeSessionService = class {
38547
38486
  turn: this.#activeTurn(command)
38548
38487
  };
38549
38488
  }
38550
- if (command.action === "linked-history") {
38551
- const nativeSessionId = nativeSessionIdSchema.parse(command.targetSessionId);
38552
- if (this.#sessions.hasPreparedSession(nativeSessionId, options.agent.id, cwd, additionalDirectories) && await this.#sessions.loadLinkedSessionHistory({ ...options, sessionId: nativeSessionId }) === null) {
38553
- this.record(command, "native_session_history_read");
38554
- return {
38555
- action: "linked-history",
38556
- history: {
38557
- status: "available",
38558
- messages: [],
38559
- truncated: false,
38560
- coveredCommandIds: [],
38561
- coveredMessageIds: []
38562
- },
38563
- kind: "native.session.result",
38564
- requestId: command.requestId,
38565
- sessionId: command.sessionId,
38566
- targetSessionId: command.targetSessionId
38567
- };
38568
- }
38569
- const history = await nativeSessionAdapter(options.agent.id).linkedHistory({
38570
- sessions: this.#sessions,
38571
- directories: this.#directories,
38572
- bindingId: command.bindingId,
38573
- options,
38574
- nativeSessionId
38575
- });
38576
- this.record(command, "native_session_history_read");
38577
- return {
38578
- action: "linked-history",
38579
- history,
38580
- kind: "native.session.result",
38581
- requestId: command.requestId,
38582
- sessionId: command.sessionId,
38583
- targetSessionId: command.targetSessionId
38584
- };
38585
- }
38586
38489
  if (command.action === "create") {
38587
38490
  if (!supportsNativeChat(options.agent.id)) {
38588
38491
  throw new AcpExecutionError(
@@ -38597,7 +38500,7 @@ var NativeSessionService = class {
38597
38500
  return {
38598
38501
  action: "create",
38599
38502
  kind: "native.session.result",
38600
- nativeSessionId,
38503
+ nativeSessionId: decodeIdentifier(nativeSessionId),
38601
38504
  requestId: command.requestId,
38602
38505
  sessionId: command.sessionId
38603
38506
  };
@@ -38617,7 +38520,7 @@ var NativeSessionService = class {
38617
38520
  if (authorized === null) {
38618
38521
  return null;
38619
38522
  }
38620
- const entryId = randomUUID4();
38523
+ const entryId = decodeIdentifier(randomUUID4());
38621
38524
  if (this.#entries.size >= 5e3) {
38622
38525
  this.#entries.clear();
38623
38526
  }
@@ -38629,8 +38532,8 @@ var NativeSessionService = class {
38629
38532
  });
38630
38533
  return {
38631
38534
  entryId,
38632
- mobiusSessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => session.sessionId),
38633
- nativeSessionId: info.sessionId,
38535
+ mobiusSessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => decodeIdentifier(session.sessionId)),
38536
+ nativeSessionId: decodeIdentifier(info.sessionId),
38634
38537
  title: info.title ?? "Untitled session",
38635
38538
  directoryId: authorized.directoryId,
38636
38539
  directoryLabel: authorized.directoryLabel,
@@ -38673,7 +38576,7 @@ var NativeSessionService = class {
38673
38576
  "invalid_native_session_response"
38674
38577
  );
38675
38578
  }
38676
- nextCursor = randomUUID4();
38579
+ nextCursor = decodeIdentifier(randomUUID4());
38677
38580
  if (this.#cursors.size >= 500) {
38678
38581
  this.#cursors.clear();
38679
38582
  }
@@ -38790,10 +38693,10 @@ var NativeSessionService = class {
38790
38693
  ...envelope2,
38791
38694
  action: "delete",
38792
38695
  entryId: command.entryId,
38793
- deletedSessionIds
38696
+ deletedSessionIds: deletedSessionIds.map(decodeIdentifier)
38794
38697
  };
38795
38698
  }
38796
- const action = command.action === "import-only" ? "import" : command.action === "fork-only" ? "fork" : command.action;
38699
+ const action = command.action;
38797
38700
  if (action === "import" && !prepared.capabilities.loadSession && !prepared.capabilities.resumeSession) {
38798
38701
  throw new AcpExecutionError("This Agent cannot import native sessions", {}, "native_session_unsupported");
38799
38702
  }
@@ -38818,8 +38721,7 @@ var NativeSessionService = class {
38818
38721
  sessionId: command.targetSessionId,
38819
38722
  additionalDirectories: target.additionalDirectories
38820
38723
  },
38821
- { kind: action, nativeSessionId: target.info.sessionId },
38822
- command.action !== "import-only" && command.action !== "fork-only"
38724
+ { kind: action, nativeSessionId: target.info.sessionId }
38823
38725
  );
38824
38726
  signal.throwIfAborted();
38825
38727
  const ready = {
@@ -38843,8 +38745,7 @@ var NativeSessionService = class {
38843
38745
  action,
38844
38746
  ready,
38845
38747
  targetSessionId: command.targetSessionId,
38846
- title: target.info.title ?? "Untitled session",
38847
- history: opened.history
38748
+ title: target.info.title ?? "Untitled session"
38848
38749
  };
38849
38750
  };
38850
38751
  querySessions = async (sessionIds, signal) => {
@@ -39851,6 +39752,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
39851
39752
  );
39852
39753
  return;
39853
39754
  }
39755
+ if (kind === SESSION_QUERY_KIND) {
39756
+ const command2 = message;
39757
+ void nativeSessions.querySessions(command2.sessionIds, connectionController.signal).then((entries) => {
39758
+ send(socket, {
39759
+ entries,
39760
+ kind: SESSION_QUERIED_KIND,
39761
+ requestId: command2.requestId
39762
+ });
39763
+ }).catch((error62) => {
39764
+ reportOperationFailure(socket, command2.requestId, "", error62);
39765
+ });
39766
+ return;
39767
+ }
39854
39768
  if (kind === SESSION_PERMISSION_RESPOND_KIND) {
39855
39769
  const command2 = message;
39856
39770
  void sessions.respondPermission(command2).then(() => {