@agentclientprotocol/codex-acp 2.5.1-preview.15 → 2.5.1-preview.17

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 (2) hide show
  1. package/dist/index.js +746 -136
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4216,9 +4216,14 @@ var AGENT_METHODS = {
4216
4216
  session_list: "session/list",
4217
4217
  session_delete: "session/delete",
4218
4218
  session_fork: "session/fork",
4219
+ session_archive: "session/archive",
4220
+ session_unarchive: "session/unarchive",
4221
+ session_status: "session/status",
4222
+ session_set_title: "session/set_title",
4219
4223
  session_resume: "session/resume",
4220
4224
  session_close: "session/close",
4221
- logout: "logout"
4225
+ logout: "logout",
4226
+ auth_status: "auth/status"
4222
4227
  };
4223
4228
  var CLIENT_METHODS = {
4224
4229
  session_request_permission: "session/request_permission",
@@ -4232,7 +4237,8 @@ var CLIENT_METHODS = {
4232
4237
  terminal_kill: "terminal/kill",
4233
4238
  mcp_message: "mcp/message",
4234
4239
  elicitation_create: "elicitation/create",
4235
- elicitation_complete: "elicitation/complete"
4240
+ elicitation_complete: "elicitation/complete",
4241
+ auth_status_update: "auth/status_update"
4236
4242
  };
4237
4243
  var PROTOCOL_METHODS = {
4238
4244
  cancel_request: "$/cancel_request"
@@ -24482,6 +24488,15 @@ var zSessionSystemPromptCapabilities = object({
24482
24488
  var zSessionForkCapabilities = object({
24483
24489
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24484
24490
  });
24491
+ var zSessionArchiveCapabilities = object({
24492
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24493
+ });
24494
+ var zSessionStatusCapabilities = object({
24495
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24496
+ });
24497
+ var zSessionTitleCapabilities = object({
24498
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24499
+ });
24485
24500
  var zSessionResumeCapabilities = object({
24486
24501
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24487
24502
  });
@@ -24494,14 +24509,21 @@ var zSessionCapabilities = object({
24494
24509
  additionalDirectories: defaultOnError(zSessionAdditionalDirectoriesCapabilities.nullish(), () => void 0),
24495
24510
  systemPrompt: defaultOnError(zSessionSystemPromptCapabilities.nullish(), () => void 0),
24496
24511
  fork: defaultOnError(zSessionForkCapabilities.nullish(), () => void 0),
24512
+ archive: defaultOnError(zSessionArchiveCapabilities.nullish(), () => void 0),
24513
+ status: defaultOnError(zSessionStatusCapabilities.nullish(), () => void 0),
24514
+ title: defaultOnError(zSessionTitleCapabilities.nullish(), () => void 0),
24497
24515
  resume: defaultOnError(zSessionResumeCapabilities.nullish(), () => void 0),
24498
24516
  close: defaultOnError(zSessionCloseCapabilities.nullish(), () => void 0),
24499
24517
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24500
24518
  });
24519
+ var zAuthStatusCapabilities = object({
24520
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24521
+ });
24501
24522
  var zLogoutCapabilities = object({
24502
24523
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24503
24524
  });
24504
24525
  var zAgentAuthCapabilities = object({
24526
+ status: defaultOnError(zAuthStatusCapabilities.nullish(), () => void 0),
24505
24527
  logout: defaultOnError(zLogoutCapabilities.nullish(), () => void 0),
24506
24528
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24507
24529
  });
@@ -24632,6 +24654,26 @@ var zDisableProviderResponse = object({
24632
24654
  var zLogoutResponse = object({
24633
24655
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24634
24656
  });
24657
+ var zAuthState = union([
24658
+ literal("authenticated"),
24659
+ literal("unauthenticated"),
24660
+ literal("not_required"),
24661
+ literal("unknown"),
24662
+ string2()
24663
+ ]);
24664
+ var zAuthAccount = object({
24665
+ label: string2(),
24666
+ active: defaultOnError(boolean2().nullish(), () => void 0),
24667
+ name: defaultOnError(string2().nullish(), () => void 0),
24668
+ email: defaultOnError(string2().nullish(), () => void 0),
24669
+ organization: defaultOnError(string2().nullish(), () => void 0),
24670
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24671
+ });
24672
+ var zAuthStatusResponse = object({
24673
+ state: zAuthState,
24674
+ accounts: defaultOnError(vecSkipError(zAuthAccount).optional(), () => []),
24675
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24676
+ });
24635
24677
  var zSessionModeId = string2();
24636
24678
  var zSessionMode = object({
24637
24679
  id: zSessionModeId,
@@ -24708,6 +24750,7 @@ var zSessionInfo = object({
24708
24750
  additionalDirectories: defaultOnError(vecSkipError(string2()).optional(), () => []),
24709
24751
  title: defaultOnError(string2().nullish(), () => void 0),
24710
24752
  updatedAt: defaultOnError(string2().nullish(), () => void 0),
24753
+ archived: defaultOnError(boolean2().nullish(), () => void 0),
24711
24754
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24712
24755
  });
24713
24756
  var zListSessionsResponse = object({
@@ -24724,6 +24767,25 @@ var zForkSessionResponse = object({
24724
24767
  configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => void 0),
24725
24768
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24726
24769
  });
24770
+ var zArchiveSessionResponse = object({
24771
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24772
+ });
24773
+ var zUnarchiveSessionResponse = object({
24774
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24775
+ });
24776
+ var zSessionStatus = union([
24777
+ literal("open"),
24778
+ literal("saved"),
24779
+ string2()
24780
+ ]);
24781
+ var zSessionStatusResponse = object({
24782
+ status: zSessionStatus,
24783
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24784
+ });
24785
+ var zSetSessionTitleResponse = object({
24786
+ title: string2(),
24787
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
24788
+ });
24727
24789
  var zResumeSessionResponse = object({
24728
24790
  modes: defaultOnError(zSessionModeState.nullish(), () => void 0),
24729
24791
  configOptions: defaultOnError(vecSkipError(zSessionConfigOption).nullish(), () => void 0),
@@ -24791,11 +24853,16 @@ var zAgentResponse = union([
24791
24853
  zSetProviderResponse,
24792
24854
  zDisableProviderResponse,
24793
24855
  zLogoutResponse,
24856
+ zAuthStatusResponse,
24794
24857
  zNewSessionResponse,
24795
24858
  zLoadSessionResponse,
24796
24859
  zListSessionsResponse,
24797
24860
  zDeleteSessionResponse,
24798
24861
  zForkSessionResponse,
24862
+ zArchiveSessionResponse,
24863
+ zUnarchiveSessionResponse,
24864
+ zSessionStatusResponse,
24865
+ zSetSessionTitleResponse,
24799
24866
  zResumeSessionResponse,
24800
24867
  zCloseSessionResponse,
24801
24868
  zSetSessionModeResponse,
@@ -25125,12 +25192,18 @@ var zCompleteElicitationNotification = object({
25125
25192
  elicitationId: zElicitationId,
25126
25193
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25127
25194
  });
25195
+ var zAuthStatusUpdateNotification = object({
25196
+ state: zAuthState,
25197
+ accounts: defaultOnError(vecSkipError(zAuthAccount).optional(), () => []),
25198
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25199
+ });
25128
25200
  var zExtNotification = unknown();
25129
25201
  var zAgentNotification = object({
25130
25202
  method: string2(),
25131
25203
  params: union([
25132
25204
  zSessionNotification,
25133
25205
  zCompleteElicitationNotification,
25206
+ zAuthStatusUpdateNotification,
25134
25207
  zExtNotification
25135
25208
  ]).nullish()
25136
25209
  });
@@ -25220,6 +25293,9 @@ var zDisableProviderRequest = object({
25220
25293
  var zLogoutRequest = object({
25221
25294
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25222
25295
  });
25296
+ var zAuthStatusRequest = object({
25297
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25298
+ });
25223
25299
  var zHttpHeader = object({
25224
25300
  name: string2(),
25225
25301
  value: string2(),
@@ -25286,9 +25362,16 @@ var zLoadSessionRequest = object({
25286
25362
  systemPrompt: zSystemPrompt.nullish(),
25287
25363
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25288
25364
  });
25365
+ var zSessionArchiveFilter = union([
25366
+ literal("exclude"),
25367
+ literal("include"),
25368
+ literal("only"),
25369
+ string2()
25370
+ ]);
25289
25371
  var zListSessionsRequest = object({
25290
25372
  cwd: string2().nullish(),
25291
25373
  cursor: string2().nullish(),
25374
+ archived: zSessionArchiveFilter.nullish(),
25292
25375
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25293
25376
  });
25294
25377
  var zDeleteSessionRequest = object({
@@ -25303,6 +25386,23 @@ var zForkSessionRequest = object({
25303
25386
  systemPrompt: zSystemPrompt.nullish(),
25304
25387
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25305
25388
  });
25389
+ var zArchiveSessionRequest = object({
25390
+ sessionId: zSessionId,
25391
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25392
+ });
25393
+ var zUnarchiveSessionRequest = object({
25394
+ sessionId: zSessionId,
25395
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25396
+ });
25397
+ var zSessionStatusRequest = object({
25398
+ sessionId: zSessionId,
25399
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25400
+ });
25401
+ var zSetSessionTitleRequest = object({
25402
+ sessionId: zSessionId,
25403
+ title: string2(),
25404
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25405
+ });
25306
25406
  var zResumeSessionRequest = object({
25307
25407
  sessionId: zSessionId,
25308
25408
  cwd: string2(),
@@ -25348,11 +25448,16 @@ var zClientRequest = object({
25348
25448
  zSetProviderRequest,
25349
25449
  zDisableProviderRequest,
25350
25450
  zLogoutRequest,
25451
+ zAuthStatusRequest,
25351
25452
  zNewSessionRequest,
25352
25453
  zLoadSessionRequest,
25353
25454
  zListSessionsRequest,
25354
25455
  zDeleteSessionRequest,
25355
25456
  zForkSessionRequest,
25457
+ zArchiveSessionRequest,
25458
+ zUnarchiveSessionRequest,
25459
+ zSessionStatusRequest,
25460
+ zSetSessionTitleRequest,
25356
25461
  zResumeSessionRequest,
25357
25462
  zCloseSessionRequest,
25358
25463
  zSetSessionModeRequest,
@@ -25500,6 +25605,38 @@ var zCancelRequestNotification = object({
25500
25605
  requestId: zRequestId,
25501
25606
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25502
25607
  });
25608
+ var zInitializeProxyRequest = zInitializeRequest;
25609
+ var zProxySuccessorRequest = object({
25610
+ method: string2(),
25611
+ params: unknown().optional(),
25612
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25613
+ });
25614
+ var zProxyRequest = object({
25615
+ id: zRequestId,
25616
+ method: string2(),
25617
+ params: union([zInitializeProxyRequest, zProxySuccessorRequest]).nullish()
25618
+ });
25619
+ var zInitializeProxyResponse = zInitializeResponse;
25620
+ var zProxySuccessorResponse = unknown();
25621
+ var zProxyResponse = union([
25622
+ object({
25623
+ id: zRequestId,
25624
+ result: union([zInitializeProxyResponse, zProxySuccessorResponse])
25625
+ }),
25626
+ object({
25627
+ id: zRequestId,
25628
+ error: zError
25629
+ })
25630
+ ]);
25631
+ var zProxySuccessorNotification = object({
25632
+ method: string2(),
25633
+ params: unknown().optional(),
25634
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
25635
+ });
25636
+ var zProxyNotification = object({
25637
+ method: string2(),
25638
+ params: zProxySuccessorNotification.nullish()
25639
+ });
25503
25640
 
25504
25641
  // node_modules/@agentclientprotocol/sdk/dist/core/jsonrpc.js
25505
25642
  var CANCEL_REQUEST_METHOD = "$/cancel_request";
@@ -25905,6 +26042,10 @@ var Connection = class {
25905
26042
  pendingResponse.cleanup?.();
25906
26043
  void this.sendCancelRequest(id).catch(() => {
25907
26044
  });
26045
+ if (options.stopWaitingOnCancel) {
26046
+ pendingResponse.abandoned = true;
26047
+ reject(requestCancelledError(options.cancellationSignal?.reason));
26048
+ }
25908
26049
  };
25909
26050
  options.cancellationSignal?.addEventListener("abort", cancel, {
25910
26051
  once: true
@@ -26111,6 +26252,9 @@ var Connection = class {
26111
26252
  if (pendingResponse) {
26112
26253
  this.pendingResponses.delete(response.id);
26113
26254
  pendingResponse.cleanup?.();
26255
+ if (pendingResponse.abandoned) {
26256
+ return;
26257
+ }
26114
26258
  if (!isResponseMessage(response)) {
26115
26259
  pendingResponse.reject(RequestError.invalidRequest(response));
26116
26260
  } else if ("result" in response) {
@@ -26794,6 +26938,9 @@ var methods = {
26794
26938
  initialize: AGENT_METHODS.initialize,
26795
26939
  authenticate: AGENT_METHODS.authenticate,
26796
26940
  logout: AGENT_METHODS.logout,
26941
+ auth: {
26942
+ status: AGENT_METHODS.auth_status
26943
+ },
26797
26944
  providers: {
26798
26945
  list: AGENT_METHODS.providers_list,
26799
26946
  set: AGENT_METHODS.providers_set,
@@ -26805,6 +26952,10 @@ var methods = {
26805
26952
  list: AGENT_METHODS.session_list,
26806
26953
  delete: AGENT_METHODS.session_delete,
26807
26954
  fork: AGENT_METHODS.session_fork,
26955
+ archive: AGENT_METHODS.session_archive,
26956
+ unarchive: AGENT_METHODS.session_unarchive,
26957
+ status: AGENT_METHODS.session_status,
26958
+ setTitle: AGENT_METHODS.session_set_title,
26808
26959
  resume: AGENT_METHODS.session_resume,
26809
26960
  close: AGENT_METHODS.session_close,
26810
26961
  setMode: AGENT_METHODS.session_set_mode,
@@ -26838,6 +26989,9 @@ var methods = {
26838
26989
  elicitation: {
26839
26990
  create: CLIENT_METHODS.elicitation_create,
26840
26991
  complete: CLIENT_METHODS.elicitation_complete
26992
+ },
26993
+ auth: {
26994
+ statusUpdate: CLIENT_METHODS.auth_status_update
26841
26995
  }
26842
26996
  },
26843
26997
  protocol: {
@@ -27293,6 +27447,10 @@ var agentRequestSpecs = {
27293
27447
  unstable_forkSession: requestSpec(AGENT_METHODS.session_fork, zForkSessionRequest),
27294
27448
  listSessions: requestSpec(AGENT_METHODS.session_list, zListSessionsRequest),
27295
27449
  deleteSession: requestSpec(AGENT_METHODS.session_delete, zDeleteSessionRequest, emptyObjectResponse),
27450
+ unstable_archiveSession: requestSpec(AGENT_METHODS.session_archive, zArchiveSessionRequest, emptyObjectResponse),
27451
+ unstable_unarchiveSession: requestSpec(AGENT_METHODS.session_unarchive, zUnarchiveSessionRequest, emptyObjectResponse),
27452
+ unstable_sessionStatus: requestSpec(AGENT_METHODS.session_status, zSessionStatusRequest),
27453
+ unstable_setSessionTitle: requestSpec(AGENT_METHODS.session_set_title, zSetSessionTitleRequest),
27296
27454
  resumeSession: requestSpec(AGENT_METHODS.session_resume, zResumeSessionRequest),
27297
27455
  closeSession: requestSpec(AGENT_METHODS.session_close, zCloseSessionRequest, emptyObjectResponse),
27298
27456
  setSessionMode: requestSpec(AGENT_METHODS.session_set_mode, zSetSessionModeRequest, emptyObjectResponse),
@@ -27302,6 +27460,7 @@ var agentRequestSpecs = {
27302
27460
  unstable_setProvider: requestSpec(AGENT_METHODS.providers_set, zSetProviderRequest, emptyObjectResponse),
27303
27461
  unstable_disableProvider: requestSpec(AGENT_METHODS.providers_disable, zDisableProviderRequest, emptyObjectResponse),
27304
27462
  logout: requestSpec(AGENT_METHODS.logout, zLogoutRequest, emptyObjectResponse),
27463
+ unstable_authStatus: requestSpec(AGENT_METHODS.auth_status, zAuthStatusRequest),
27305
27464
  prompt: requestSpec(AGENT_METHODS.session_prompt, zPromptRequest)
27306
27465
  };
27307
27466
  var agentNotificationSpecs = {
@@ -27322,7 +27481,8 @@ var clientRequestSpecs = {
27322
27481
  };
27323
27482
  var clientNotificationSpecs = {
27324
27483
  sessionUpdate: notificationSpec(CLIENT_METHODS.session_update, zSessionNotification),
27325
- completeElicitation: notificationSpec(CLIENT_METHODS.elicitation_complete, zCompleteElicitationNotification)
27484
+ completeElicitation: notificationSpec(CLIENT_METHODS.elicitation_complete, zCompleteElicitationNotification),
27485
+ unstable_authStatusUpdate: notificationSpec(CLIENT_METHODS.auth_status_update, zAuthStatusUpdateNotification)
27326
27486
  };
27327
27487
  var agentRequestSpecsByMethod = specsByMethod(agentRequestSpecs);
27328
27488
  var agentNotificationSpecsByMethod = specsByMethod(agentNotificationSpecs);
@@ -28028,16 +28188,24 @@ var AGENT_METHODS2 = {
28028
28188
  session_list: "session/list",
28029
28189
  session_delete: "session/delete",
28030
28190
  session_fork: "session/fork",
28191
+ session_archive: "session/archive",
28192
+ session_unarchive: "session/unarchive",
28193
+ session_status: "session/status",
28194
+ session_set_title: "session/set_title",
28031
28195
  session_resume: "session/resume",
28032
28196
  session_close: "session/close",
28033
- auth_logout: "auth/logout"
28197
+ tool_call_cancel: "tool_call/cancel",
28198
+ terminal_cancel: "terminal/cancel",
28199
+ auth_logout: "auth/logout",
28200
+ auth_status: "auth/status"
28034
28201
  };
28035
28202
  var CLIENT_METHODS2 = {
28036
28203
  session_request_permission: "session/request_permission",
28037
28204
  session_update: "session/update",
28038
28205
  mcp_message: "mcp/message",
28039
28206
  elicitation_create: "elicitation/create",
28040
- elicitation_complete: "elicitation/complete"
28207
+ elicitation_complete: "elicitation/complete",
28208
+ auth_status_update: "auth/status_update"
28041
28209
  };
28042
28210
  var PROTOCOL_METHODS2 = {
28043
28211
  cancel_request: "$/cancel_request"
@@ -28064,6 +28232,7 @@ var zToolKind2 = union([
28064
28232
  var zToolCallStatus2 = union([
28065
28233
  literal("pending"),
28066
28234
  literal("in_progress"),
28235
+ literal("paused"),
28067
28236
  literal("completed"),
28068
28237
  literal("failed"),
28069
28238
  literal("cancelled"),
@@ -28243,6 +28412,13 @@ var zToolCallLocation2 = object({
28243
28412
  }).nullish(), () => void 0),
28244
28413
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28245
28414
  });
28415
+ var zToolCallCancelCapabilities = object({
28416
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28417
+ });
28418
+ var zToolCallCapabilities = object({
28419
+ cancel: defaultOnError(zToolCallCancelCapabilities.nullish(), () => void 0),
28420
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28421
+ });
28246
28422
  var zToolCallUpdate2 = object({
28247
28423
  toolCallId: zToolCallId2,
28248
28424
  name: defaultOnError(string2().nullish(), () => void 0),
@@ -28253,6 +28429,7 @@ var zToolCallUpdate2 = object({
28253
28429
  locations: defaultOnError(vecSkipError(zToolCallLocation2).nullish(), () => void 0),
28254
28430
  rawInput: defaultOnError(unknown().optional(), () => void 0),
28255
28431
  rawOutput: defaultOnError(unknown().optional(), () => void 0),
28432
+ capabilities: defaultOnError(zToolCallCapabilities.nullish(), () => void 0),
28256
28433
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28257
28434
  });
28258
28435
  var zToolCallPermissionSubject = object({
@@ -28511,6 +28688,15 @@ var zSessionSystemPromptCapabilities2 = object({
28511
28688
  var zSessionForkCapabilities2 = object({
28512
28689
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28513
28690
  });
28691
+ var zSessionArchiveCapabilities2 = object({
28692
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28693
+ });
28694
+ var zSessionStatusCapabilities2 = object({
28695
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28696
+ });
28697
+ var zSessionTitleCapabilities2 = object({
28698
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28699
+ });
28514
28700
  var zSessionCapabilities2 = object({
28515
28701
  prompt: defaultOnError(zPromptCapabilities2.nullish(), () => void 0),
28516
28702
  mcp: defaultOnError(zMcpCapabilities2.nullish(), () => void 0),
@@ -28518,9 +28704,16 @@ var zSessionCapabilities2 = object({
28518
28704
  additionalDirectories: defaultOnError(zSessionAdditionalDirectoriesCapabilities2.nullish(), () => void 0),
28519
28705
  systemPrompt: defaultOnError(zSessionSystemPromptCapabilities2.nullish(), () => void 0),
28520
28706
  fork: defaultOnError(zSessionForkCapabilities2.nullish(), () => void 0),
28707
+ archive: defaultOnError(zSessionArchiveCapabilities2.nullish(), () => void 0),
28708
+ status: defaultOnError(zSessionStatusCapabilities2.nullish(), () => void 0),
28709
+ title: defaultOnError(zSessionTitleCapabilities2.nullish(), () => void 0),
28710
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28711
+ });
28712
+ var zAuthStatusCapabilities2 = object({
28521
28713
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28522
28714
  });
28523
28715
  var zAgentAuthCapabilities2 = object({
28716
+ status: defaultOnError(zAuthStatusCapabilities2.nullish(), () => void 0),
28524
28717
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28525
28718
  });
28526
28719
  var zProvidersCapabilities2 = object({
@@ -28609,6 +28802,26 @@ var zDisableProviderResponse2 = object({
28609
28802
  var zLogoutAuthResponse = object({
28610
28803
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28611
28804
  });
28805
+ var zAuthState2 = union([
28806
+ literal("authenticated"),
28807
+ literal("unauthenticated"),
28808
+ literal("not_required"),
28809
+ literal("unknown"),
28810
+ string2()
28811
+ ]);
28812
+ var zAuthAccount2 = object({
28813
+ label: string2(),
28814
+ active: defaultOnError(boolean2().nullish(), () => void 0),
28815
+ name: defaultOnError(string2().nullish(), () => void 0),
28816
+ email: defaultOnError(string2().nullish(), () => void 0),
28817
+ organization: defaultOnError(string2().nullish(), () => void 0),
28818
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28819
+ });
28820
+ var zAuthStatusResponse2 = object({
28821
+ state: zAuthState2,
28822
+ accounts: defaultOnError(vecSkipError(zAuthAccount2).optional(), () => []),
28823
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28824
+ });
28612
28825
  var zSessionConfigId2 = string2();
28613
28826
  var zSessionConfigOptionCategory2 = union([
28614
28827
  literal("mode"),
@@ -28699,6 +28912,7 @@ var zSessionInfo2 = object({
28699
28912
  additionalDirectories: defaultOnNull(array(zAbsolutePath), () => []).optional(),
28700
28913
  title: defaultOnError(string2().nullish(), () => void 0),
28701
28914
  updatedAt: defaultOnError(iso_exports.datetime({ offset: true }).nullish(), () => void 0),
28915
+ archived: defaultOnError(boolean2().nullish(), () => void 0),
28702
28916
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28703
28917
  });
28704
28918
  var zSessionListCursor = string2();
@@ -28716,24 +28930,47 @@ var zForkSessionResponse2 = object({
28716
28930
  availableCommands: defaultOnError(vecSkipError(zAvailableCommand2).optional(), () => []),
28717
28931
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28718
28932
  });
28719
- var zResumeSessionResponse2 = object({
28720
- configOptions: defaultOnError(vecSkipError(zSessionConfigOption2).optional(), () => []),
28721
- availableCommands: defaultOnError(vecSkipError(zAvailableCommand2).optional(), () => []),
28933
+ var zArchiveSessionResponse2 = object({
28722
28934
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28723
28935
  });
28724
- var zCloseSessionResponse2 = object({
28936
+ var zUnarchiveSessionResponse2 = object({
28725
28937
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28726
28938
  });
28727
- var zSetSessionConfigOptionResponse2 = object({
28728
- configOptions: vecSkipError(zSessionConfigOption2),
28939
+ var zSessionStatus2 = union([
28940
+ literal("open"),
28941
+ literal("saved"),
28942
+ string2()
28943
+ ]);
28944
+ var zBackgroundTerminal = object({
28945
+ terminalId: zTerminalId2,
28729
28946
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28730
28947
  });
28731
- var zMessageId2 = string2();
28732
- var zPromptResponse2 = object({
28733
- messageId: zMessageId2,
28948
+ var zBackgroundToolCall = object({
28949
+ toolCallId: zToolCallId2,
28950
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28951
+ });
28952
+ var zBackgroundSubagent = object({
28953
+ sessionId: zSessionId2,
28954
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28955
+ });
28956
+ var zBackgroundWork = preserveCustomPayload(union([
28957
+ zBackgroundTerminal.and(object({
28958
+ type: literal("terminal")
28959
+ })),
28960
+ zBackgroundToolCall.and(object({
28961
+ type: literal("tool_call")
28962
+ })),
28963
+ zBackgroundSubagent.and(object({
28964
+ type: literal("subagent")
28965
+ })),
28966
+ excludeKnownTags(object({
28967
+ type: string2()
28968
+ }), "type", ["subagent", "terminal", "tool_call"])
28969
+ ]), "type", ["subagent", "terminal", "tool_call"]);
28970
+ var zRunningStateUpdate2 = object({
28971
+ background: defaultOnError(array(zBackgroundWork).nullish(), () => void 0),
28734
28972
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28735
28973
  });
28736
- var zExtResponse2 = unknown();
28737
28974
  var zErrorCode2 = union([
28738
28975
  literal(-32700),
28739
28976
  literal(-32600),
@@ -28769,55 +29006,6 @@ var zError2 = object({
28769
29006
  message: string2(),
28770
29007
  data: defaultOnError(zErrorData.nullish(), () => void 0)
28771
29008
  });
28772
- var zAgentResponse2 = union([
28773
- object({
28774
- id: zRequestId2,
28775
- result: union([
28776
- zInitializeResponse2,
28777
- zLoginAuthResponse,
28778
- zListProvidersResponse2,
28779
- zSetProviderResponse2,
28780
- zDisableProviderResponse2,
28781
- zLogoutAuthResponse,
28782
- zNewSessionResponse2,
28783
- zListSessionsResponse2,
28784
- zDeleteSessionResponse2,
28785
- zForkSessionResponse2,
28786
- zResumeSessionResponse2,
28787
- zCloseSessionResponse2,
28788
- zSetSessionConfigOptionResponse2,
28789
- zPromptResponse2,
28790
- zExtResponse2
28791
- ])
28792
- }),
28793
- object({
28794
- id: union([wideInt(), string2()]).nullable(),
28795
- error: zError2
28796
- })
28797
- ]);
28798
- var zContentChunk2 = object({
28799
- messageId: zMessageId2,
28800
- content: zContentBlock2,
28801
- _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28802
- });
28803
- var zUserMessage = object({
28804
- messageId: zMessageId2,
28805
- content: defaultOnError(vecSkipError(zContentBlock2).nullish(), () => void 0),
28806
- _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28807
- });
28808
- var zAgentMessage = object({
28809
- messageId: zMessageId2,
28810
- content: defaultOnError(vecSkipError(zContentBlock2).nullish(), () => void 0),
28811
- _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28812
- });
28813
- var zAgentThought = object({
28814
- messageId: zMessageId2,
28815
- content: defaultOnError(vecSkipError(zContentBlock2).nullish(), () => void 0),
28816
- _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28817
- });
28818
- var zRunningStateUpdate2 = object({
28819
- _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28820
- });
28821
29009
  var zErrorStopReason2 = object({
28822
29010
  error: defaultOnError(zError2.nullish(), () => void 0)
28823
29011
  });
@@ -28864,6 +29052,7 @@ var zIdleStateUpdate2 = defaultOnErrorOptionalStringTag(preserveCustomPayload(in
28864
29052
  })
28865
29053
  ]), object({
28866
29054
  usage: defaultOnError(zUsage2.nullish(), () => void 0),
29055
+ background: defaultOnError(array(zBackgroundWork).nullish(), () => void 0),
28867
29056
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0),
28868
29057
  stopReason: defaultOnError(string2().nullish(), () => void 0)
28869
29058
  })), "stopReason", [
@@ -28875,9 +29064,11 @@ var zIdleStateUpdate2 = defaultOnErrorOptionalStringTag(preserveCustomPayload(in
28875
29064
  "refusal"
28876
29065
  ]), "stopReason");
28877
29066
  var zRequiresActionStateUpdate2 = object({
29067
+ background: defaultOnError(array(zBackgroundWork).nullish(), () => void 0),
28878
29068
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28879
29069
  });
28880
29070
  var zUnknownStateUpdate2 = object({
29071
+ background: defaultOnError(array(zBackgroundWork).nullish(), () => void 0),
28881
29072
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28882
29073
  });
28883
29074
  var zStateUpdate2 = preserveCustomPayload(union([
@@ -28897,6 +29088,92 @@ var zStateUpdate2 = preserveCustomPayload(union([
28897
29088
  state: string2()
28898
29089
  }), "state", ["idle", "requires_action", "running", "unknown"])
28899
29090
  ]), "state", ["idle", "requires_action", "running", "unknown"]);
29091
+ var zSessionStatusResponse2 = object({
29092
+ status: zSessionStatus2,
29093
+ state: defaultOnError(zStateUpdate2.nullish(), () => void 0),
29094
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29095
+ });
29096
+ var zSetSessionTitleResponse2 = object({
29097
+ title: string2(),
29098
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29099
+ });
29100
+ var zResumeSessionResponse2 = object({
29101
+ configOptions: defaultOnError(vecSkipError(zSessionConfigOption2).optional(), () => []),
29102
+ availableCommands: defaultOnError(vecSkipError(zAvailableCommand2).optional(), () => []),
29103
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29104
+ });
29105
+ var zCloseSessionResponse2 = object({
29106
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29107
+ });
29108
+ var zCancelToolCallResponse = object({
29109
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29110
+ });
29111
+ var zCancelTerminalResponse = object({
29112
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29113
+ });
29114
+ var zSetSessionConfigOptionResponse2 = object({
29115
+ configOptions: vecSkipError(zSessionConfigOption2),
29116
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29117
+ });
29118
+ var zMessageId2 = string2();
29119
+ var zPromptResponse2 = object({
29120
+ messageId: zMessageId2,
29121
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29122
+ });
29123
+ var zExtResponse2 = unknown();
29124
+ var zAgentResponse2 = union([
29125
+ object({
29126
+ id: zRequestId2,
29127
+ result: union([
29128
+ zInitializeResponse2,
29129
+ zLoginAuthResponse,
29130
+ zListProvidersResponse2,
29131
+ zSetProviderResponse2,
29132
+ zDisableProviderResponse2,
29133
+ zLogoutAuthResponse,
29134
+ zAuthStatusResponse2,
29135
+ zNewSessionResponse2,
29136
+ zListSessionsResponse2,
29137
+ zDeleteSessionResponse2,
29138
+ zForkSessionResponse2,
29139
+ zArchiveSessionResponse2,
29140
+ zUnarchiveSessionResponse2,
29141
+ zSessionStatusResponse2,
29142
+ zSetSessionTitleResponse2,
29143
+ zResumeSessionResponse2,
29144
+ zCloseSessionResponse2,
29145
+ zCancelToolCallResponse,
29146
+ zCancelTerminalResponse,
29147
+ zSetSessionConfigOptionResponse2,
29148
+ zPromptResponse2,
29149
+ zExtResponse2
29150
+ ])
29151
+ }),
29152
+ object({
29153
+ id: union([wideInt(), string2()]).nullable(),
29154
+ error: zError2
29155
+ })
29156
+ ]);
29157
+ var zContentChunk2 = object({
29158
+ messageId: zMessageId2,
29159
+ content: zContentBlock2,
29160
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29161
+ });
29162
+ var zUserMessage = object({
29163
+ messageId: zMessageId2,
29164
+ content: defaultOnError(vecSkipError(zContentBlock2).nullish(), () => void 0),
29165
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29166
+ });
29167
+ var zAgentMessage = object({
29168
+ messageId: zMessageId2,
29169
+ content: defaultOnError(vecSkipError(zContentBlock2).nullish(), () => void 0),
29170
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29171
+ });
29172
+ var zAgentThought = object({
29173
+ messageId: zMessageId2,
29174
+ content: defaultOnError(vecSkipError(zContentBlock2).nullish(), () => void 0),
29175
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29176
+ });
28900
29177
  var zToolCallContentChunk = object({
28901
29178
  toolCallId: zToolCallId2,
28902
29179
  content: zToolCallContent2,
@@ -28916,6 +29193,13 @@ var zTerminalSize = object({
28916
29193
  rows: int().gte(1).lte(65535),
28917
29194
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28918
29195
  });
29196
+ var zTerminalCancelCapabilities = object({
29197
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29198
+ });
29199
+ var zTerminalCapabilities = object({
29200
+ cancel: defaultOnError(zTerminalCancelCapabilities.nullish(), () => void 0),
29201
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29202
+ });
28919
29203
  var zTerminalUpdate = object({
28920
29204
  terminalId: zTerminalId2,
28921
29205
  command: defaultOnError(string2().nullish(), () => void 0),
@@ -28923,6 +29207,7 @@ var zTerminalUpdate = object({
28923
29207
  output: defaultOnError(zTerminalOutput.nullish(), () => void 0),
28924
29208
  exitStatus: defaultOnError(zTerminalExitStatus2.nullish(), () => void 0),
28925
29209
  size: defaultOnError(zTerminalSize.nullish(), () => void 0),
29210
+ capabilities: defaultOnError(zTerminalCapabilities.nullish(), () => void 0),
28926
29211
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
28927
29212
  });
28928
29213
  var zTerminalOutputChunk = object({
@@ -29206,12 +29491,18 @@ var zCompleteElicitationNotification2 = object({
29206
29491
  elicitationId: zElicitationId2,
29207
29492
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29208
29493
  });
29494
+ var zAuthStatusUpdateNotification2 = object({
29495
+ state: zAuthState2,
29496
+ accounts: defaultOnError(vecSkipError(zAuthAccount2).optional(), () => []),
29497
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29498
+ });
29209
29499
  var zExtNotification2 = unknown();
29210
29500
  var zAgentNotification2 = object({
29211
29501
  method: string2(),
29212
29502
  params: union([
29213
29503
  zUpdateSessionNotification,
29214
29504
  zCompleteElicitationNotification2,
29505
+ zAuthStatusUpdateNotification2,
29215
29506
  zExtNotification2
29216
29507
  ]).nullish()
29217
29508
  });
@@ -29265,6 +29556,9 @@ var zDisableProviderRequest2 = object({
29265
29556
  var zLogoutAuthRequest = object({
29266
29557
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29267
29558
  });
29559
+ var zAuthStatusRequest2 = object({
29560
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29561
+ });
29268
29562
  var zHttpHeader2 = object({
29269
29563
  name: string2(),
29270
29564
  value: string2(),
@@ -29319,9 +29613,16 @@ var zNewSessionRequest2 = object({
29319
29613
  systemPrompt: zSystemPrompt2.nullish(),
29320
29614
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29321
29615
  });
29616
+ var zSessionArchiveFilter2 = union([
29617
+ literal("exclude"),
29618
+ literal("include"),
29619
+ literal("only"),
29620
+ string2()
29621
+ ]);
29322
29622
  var zListSessionsRequest2 = object({
29323
29623
  cwd: zAbsolutePath.nullish(),
29324
29624
  cursor: zSessionListCursor.nullish(),
29625
+ archived: zSessionArchiveFilter2.nullish(),
29325
29626
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29326
29627
  });
29327
29628
  var zDeleteSessionRequest2 = object({
@@ -29336,6 +29637,23 @@ var zForkSessionRequest2 = object({
29336
29637
  systemPrompt: zSystemPrompt2.nullish(),
29337
29638
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29338
29639
  });
29640
+ var zArchiveSessionRequest2 = object({
29641
+ sessionId: zSessionId2,
29642
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29643
+ });
29644
+ var zUnarchiveSessionRequest2 = object({
29645
+ sessionId: zSessionId2,
29646
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29647
+ });
29648
+ var zSessionStatusRequest2 = object({
29649
+ sessionId: zSessionId2,
29650
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29651
+ });
29652
+ var zSetSessionTitleRequest2 = object({
29653
+ sessionId: zSessionId2,
29654
+ title: string2(),
29655
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29656
+ });
29339
29657
  var zReplayFromStart = object({
29340
29658
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29341
29659
  });
@@ -29360,6 +29678,16 @@ var zCloseSessionRequest2 = object({
29360
29678
  sessionId: zSessionId2,
29361
29679
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29362
29680
  });
29681
+ var zCancelToolCallRequest = object({
29682
+ sessionId: zSessionId2,
29683
+ toolCallId: zToolCallId2,
29684
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29685
+ });
29686
+ var zCancelTerminalRequest = object({
29687
+ sessionId: zSessionId2,
29688
+ terminalId: zTerminalId2,
29689
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29690
+ });
29363
29691
  var zSetSessionConfigOptionRequest2 = preserveCustomPayload(intersection(union([
29364
29692
  object({
29365
29693
  type: literal("id"),
@@ -29393,12 +29721,19 @@ var zClientRequest2 = object({
29393
29721
  zSetProviderRequest2,
29394
29722
  zDisableProviderRequest2,
29395
29723
  zLogoutAuthRequest,
29724
+ zAuthStatusRequest2,
29396
29725
  zNewSessionRequest2,
29397
29726
  zListSessionsRequest2,
29398
29727
  zDeleteSessionRequest2,
29399
29728
  zForkSessionRequest2,
29729
+ zArchiveSessionRequest2,
29730
+ zUnarchiveSessionRequest2,
29731
+ zSessionStatusRequest2,
29732
+ zSetSessionTitleRequest2,
29400
29733
  zResumeSessionRequest2,
29401
29734
  zCloseSessionRequest2,
29735
+ zCancelToolCallRequest,
29736
+ zCancelTerminalRequest,
29402
29737
  zSetSessionConfigOptionRequest2,
29403
29738
  zPromptRequest2,
29404
29739
  zExtRequest2
@@ -29510,6 +29845,38 @@ var zCancelRequestNotification2 = object({
29510
29845
  requestId: zRequestId2,
29511
29846
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29512
29847
  });
29848
+ var zInitializeProxyRequest2 = zInitializeRequest2;
29849
+ var zProxySuccessorRequest2 = object({
29850
+ method: string2(),
29851
+ params: unknown().optional(),
29852
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29853
+ });
29854
+ var zProxyRequest2 = object({
29855
+ id: zRequestId2,
29856
+ method: string2(),
29857
+ params: union([zInitializeProxyRequest2, zProxySuccessorRequest2]).nullish()
29858
+ });
29859
+ var zInitializeProxyResponse2 = zInitializeResponse2;
29860
+ var zProxySuccessorResponse2 = unknown();
29861
+ var zProxyResponse2 = union([
29862
+ object({
29863
+ id: zRequestId2,
29864
+ result: union([zInitializeProxyResponse2, zProxySuccessorResponse2])
29865
+ }),
29866
+ object({
29867
+ id: union([wideInt(), string2()]).nullable(),
29868
+ error: zError2
29869
+ })
29870
+ ]);
29871
+ var zProxySuccessorNotification2 = object({
29872
+ method: string2(),
29873
+ params: unknown().optional(),
29874
+ _meta: defaultOnError(record(string2(), unknown()).nullish(), () => void 0)
29875
+ });
29876
+ var zProxyNotification2 = object({
29877
+ method: string2(),
29878
+ params: zProxySuccessorNotification2.nullish()
29879
+ });
29513
29880
 
29514
29881
  // node_modules/@agentclientprotocol/sdk/dist/v2/unstable/schema/guards.gen.js
29515
29882
  function tagOf2(value, key) {
@@ -29563,6 +29930,30 @@ var zGuardAvailableCommandCustom = object({
29563
29930
  description: string2()
29564
29931
  });
29565
29932
  var zGuardAvailableCommandInputText = zTextCommandInput.and(object({ type: literal("text") }));
29933
+ var zGuardStateUpdateRunning2 = zRunningStateUpdate2.and(object({ state: literal("running") }));
29934
+ var zGuardStateUpdateIdle2 = zIdleStateUpdate2.and(object({ usage: zUsage2.nullish() })).and(object({ state: literal("idle") }));
29935
+ var zGuardStateUpdateRequiresAction2 = zRequiresActionStateUpdate2.and(object({ state: literal("requires_action") }));
29936
+ var zGuardStateUpdateUnknown2 = zUnknownStateUpdate2.and(object({ state: literal("unknown") }));
29937
+ var zGuardBackgroundWorkTerminal = zBackgroundTerminal.and(object({ type: literal("terminal") }));
29938
+ var zGuardBackgroundWorkToolCall = zBackgroundToolCall.and(object({ type: literal("tool_call") }));
29939
+ var zGuardBackgroundWorkSubagent = zBackgroundSubagent.and(object({ type: literal("subagent") }));
29940
+ var zGuardIdleStateUpdateEndTurn2 = object({
29941
+ stopReason: literal("end_turn")
29942
+ });
29943
+ var zGuardIdleStateUpdateMaxTokens2 = object({
29944
+ stopReason: literal("max_tokens")
29945
+ });
29946
+ var zGuardIdleStateUpdateMaxTurnRequests2 = object({
29947
+ stopReason: literal("max_turn_requests")
29948
+ });
29949
+ var zGuardIdleStateUpdateRefusal2 = object({
29950
+ stopReason: literal("refusal")
29951
+ });
29952
+ var zGuardIdleStateUpdateCancelled2 = object({
29953
+ stopReason: literal("cancelled")
29954
+ });
29955
+ var zGuardIdleStateUpdateError2 = zErrorStopReason2.and(object({ error: zError2.nullish() })).and(object({ stopReason: literal("error") }));
29956
+ var zGuardIdleStateUpdateNone2 = object({ stopReason: _null3().optional() });
29566
29957
  var zGuardSessionUpdateUserMessageChunk = zContentChunk2.and(object({ sessionUpdate: literal("user_message_chunk") }));
29567
29958
  var zGuardSessionUpdateUserMessage = zUserMessage.and(object({ sessionUpdate: literal("user_message") }));
29568
29959
  var zGuardSessionUpdateAgentMessageChunk = zContentChunk2.and(object({ sessionUpdate: literal("agent_message_chunk") }));
@@ -29573,13 +29964,15 @@ var zGuardSessionUpdateStateUpdate = zStateUpdate2.and(object({ sessionUpdate: l
29573
29964
  var zGuardSessionUpdateToolCallContentChunk = zToolCallContentChunk.and(object({ sessionUpdate: literal("tool_call_content_chunk") }));
29574
29965
  var zGuardSessionUpdateToolCallUpdate = zToolCallUpdate2.and(object({
29575
29966
  kind: zToolKind2.nullish(),
29576
- status: zToolCallStatus2.nullish()
29967
+ status: zToolCallStatus2.nullish(),
29968
+ capabilities: zToolCallCapabilities.nullish()
29577
29969
  })).and(object({ sessionUpdate: literal("tool_call_update") }));
29578
29970
  var zGuardSessionUpdateTerminalUpdate = zTerminalUpdate.and(object({
29579
29971
  cwd: zAbsolutePath.nullish(),
29580
29972
  output: zTerminalOutput.nullish(),
29581
29973
  exitStatus: zTerminalExitStatus2.nullish(),
29582
- size: zTerminalSize.nullish()
29974
+ size: zTerminalSize.nullish(),
29975
+ capabilities: zTerminalCapabilities.nullish()
29583
29976
  })).and(object({ sessionUpdate: literal("terminal_update") }));
29584
29977
  var zGuardSessionUpdateTerminalOutputChunk = zTerminalOutputChunk.and(object({ sessionUpdate: literal("terminal_output_chunk") }));
29585
29978
  var zGuardSessionUpdatePlanUpdate = zPlanUpdate2.and(object({ sessionUpdate: literal("plan_update") }));
@@ -29602,27 +29995,6 @@ var zGuardSessionUpdateSessionMessage = zSessionMessage2.and(object({
29602
29995
  recipientMessageId: zMessageId2.nullish()
29603
29996
  })).and(object({ sessionUpdate: literal("session_message") }));
29604
29997
  var zGuardSessionUpdateSessionMessageChunk = zSessionMessageChunk2.and(object({ sessionUpdate: literal("session_message_chunk") }));
29605
- var zGuardIdleStateUpdateEndTurn2 = object({
29606
- stopReason: literal("end_turn")
29607
- });
29608
- var zGuardIdleStateUpdateMaxTokens2 = object({
29609
- stopReason: literal("max_tokens")
29610
- });
29611
- var zGuardIdleStateUpdateMaxTurnRequests2 = object({
29612
- stopReason: literal("max_turn_requests")
29613
- });
29614
- var zGuardIdleStateUpdateRefusal2 = object({
29615
- stopReason: literal("refusal")
29616
- });
29617
- var zGuardIdleStateUpdateCancelled2 = object({
29618
- stopReason: literal("cancelled")
29619
- });
29620
- var zGuardIdleStateUpdateError2 = zErrorStopReason2.and(object({ error: zError2.nullish() })).and(object({ stopReason: literal("error") }));
29621
- var zGuardIdleStateUpdateNone2 = object({ stopReason: _null3().optional() });
29622
- var zGuardStateUpdateRunning2 = zRunningStateUpdate2.and(object({ state: literal("running") }));
29623
- var zGuardStateUpdateIdle2 = zIdleStateUpdate2.and(object({ usage: zUsage2.nullish() })).and(object({ state: literal("idle") }));
29624
- var zGuardStateUpdateRequiresAction2 = zRequiresActionStateUpdate2.and(object({ state: literal("requires_action") }));
29625
- var zGuardStateUpdateUnknown2 = zUnknownStateUpdate2.and(object({ state: literal("unknown") }));
29626
29998
  var zGuardPlanUpdateContentItems = zPlanItems2.and(object({ type: literal("items") }));
29627
29999
  var zGuardPlanUpdateContentFile = zPlanFile2.and(object({ type: literal("file") }));
29628
30000
  var zGuardPlanUpdateContentMarkdown = zPlanMarkdown2.and(object({ type: literal("markdown") }));
@@ -29652,6 +30024,27 @@ var zGuardCreateElicitationResponseDecline2 = object({
29652
30024
  var zGuardCreateElicitationResponseCancel2 = object({
29653
30025
  action: literal("cancel")
29654
30026
  });
30027
+ var RequestPermissionSubject = {
30028
+ /** Narrow to the `tool_call` variant, validating its payload. */
30029
+ isToolCall(value) {
30030
+ return tagOf2(value, "type") === "tool_call" && zGuardRequestPermissionSubjectToolCall.safeParse(value).success;
30031
+ },
30032
+ /** Narrow to the `command` variant, validating its payload. */
30033
+ isCommand(value) {
30034
+ return tagOf2(value, "type") === "command" && zGuardRequestPermissionSubjectCommand.safeParse(value).success;
30035
+ },
30036
+ /**
30037
+ * Narrow to a custom or future variant: the `type` tag matches no known variant.
30038
+ *
30039
+ * TypeScript keeps the known variants in the narrowed union (they are
30040
+ * structural subtypes of the catch-all), so read vendor payload keys
30041
+ * via a widening cast: `(value as Record<string, unknown>).someKey`.
30042
+ */
30043
+ isCustom(value) {
30044
+ const tag = tagOf2(value, "type");
30045
+ return typeof tag === "string" && !["command", "tool_call"].includes(tag);
30046
+ }
30047
+ };
29655
30048
  var ContentBlock = {
29656
30049
  /** Narrow to the `text` variant, validating its payload. */
29657
30050
  isText(value) {
@@ -29685,6 +30078,60 @@ var ContentBlock = {
29685
30078
  return typeof tag === "string" && !["audio", "image", "resource", "resource_link", "text"].includes(tag);
29686
30079
  }
29687
30080
  };
30081
+ var StateUpdate2 = {
30082
+ /** Narrow to the `running` variant, validating its payload. */
30083
+ isRunning(value) {
30084
+ return tagOf2(value, "state") === "running" && zGuardStateUpdateRunning2.safeParse(value).success;
30085
+ },
30086
+ /** Narrow to the `idle` variant, validating its payload. */
30087
+ isIdle(value) {
30088
+ return tagOf2(value, "state") === "idle" && zGuardStateUpdateIdle2.safeParse(value).success;
30089
+ },
30090
+ /** Narrow to the `requires_action` variant, validating its payload. */
30091
+ isRequiresAction(value) {
30092
+ return tagOf2(value, "state") === "requires_action" && zGuardStateUpdateRequiresAction2.safeParse(value).success;
30093
+ },
30094
+ /** Narrow to the `unknown` variant, validating its payload. */
30095
+ isUnknown(value) {
30096
+ return tagOf2(value, "state") === "unknown" && zGuardStateUpdateUnknown2.safeParse(value).success;
30097
+ },
30098
+ /**
30099
+ * Narrow to a custom or future variant: the `state` tag matches no known variant.
30100
+ *
30101
+ * TypeScript keeps the known variants in the narrowed union (they are
30102
+ * structural subtypes of the catch-all), so read vendor payload keys
30103
+ * via a widening cast: `(value as Record<string, unknown>).someKey`.
30104
+ */
30105
+ isCustom(value) {
30106
+ const tag = tagOf2(value, "state");
30107
+ return typeof tag === "string" && !["idle", "requires_action", "running", "unknown"].includes(tag);
30108
+ }
30109
+ };
30110
+ var BackgroundWork = {
30111
+ /** Narrow to the `terminal` variant, validating its payload. */
30112
+ isTerminal(value) {
30113
+ return tagOf2(value, "type") === "terminal" && zGuardBackgroundWorkTerminal.safeParse(value).success;
30114
+ },
30115
+ /** Narrow to the `tool_call` variant, validating its payload. */
30116
+ isToolCall(value) {
30117
+ return tagOf2(value, "type") === "tool_call" && zGuardBackgroundWorkToolCall.safeParse(value).success;
30118
+ },
30119
+ /** Narrow to the `subagent` variant, validating its payload. */
30120
+ isSubagent(value) {
30121
+ return tagOf2(value, "type") === "subagent" && zGuardBackgroundWorkSubagent.safeParse(value).success;
30122
+ },
30123
+ /**
30124
+ * Narrow to a custom or future variant: the `type` tag matches no known variant.
30125
+ *
30126
+ * TypeScript keeps the known variants in the narrowed union (they are
30127
+ * structural subtypes of the catch-all), so read vendor payload keys
30128
+ * via a widening cast: `(value as Record<string, unknown>).someKey`.
30129
+ */
30130
+ isCustom(value) {
30131
+ const tag = tagOf2(value, "type");
30132
+ return typeof tag === "string" && !["subagent", "terminal", "tool_call"].includes(tag);
30133
+ }
30134
+ };
29688
30135
  var SessionUpdate = {
29689
30136
  /** Narrow to the `user_message_chunk` variant, validating its payload. */
29690
30137
  isUserMessageChunk(value) {
@@ -29814,35 +30261,6 @@ var SessionUpdate = {
29814
30261
  ].includes(tag);
29815
30262
  }
29816
30263
  };
29817
- var StateUpdate2 = {
29818
- /** Narrow to the `running` variant, validating its payload. */
29819
- isRunning(value) {
29820
- return tagOf2(value, "state") === "running" && zGuardStateUpdateRunning2.safeParse(value).success;
29821
- },
29822
- /** Narrow to the `idle` variant, validating its payload. */
29823
- isIdle(value) {
29824
- return tagOf2(value, "state") === "idle" && zGuardStateUpdateIdle2.safeParse(value).success;
29825
- },
29826
- /** Narrow to the `requires_action` variant, validating its payload. */
29827
- isRequiresAction(value) {
29828
- return tagOf2(value, "state") === "requires_action" && zGuardStateUpdateRequiresAction2.safeParse(value).success;
29829
- },
29830
- /** Narrow to the `unknown` variant, validating its payload. */
29831
- isUnknown(value) {
29832
- return tagOf2(value, "state") === "unknown" && zGuardStateUpdateUnknown2.safeParse(value).success;
29833
- },
29834
- /**
29835
- * Narrow to a custom or future variant: the `state` tag matches no known variant.
29836
- *
29837
- * TypeScript keeps the known variants in the narrowed union (they are
29838
- * structural subtypes of the catch-all), so read vendor payload keys
29839
- * via a widening cast: `(value as Record<string, unknown>).someKey`.
29840
- */
29841
- isCustom(value) {
29842
- const tag = tagOf2(value, "state");
29843
- return typeof tag === "string" && !["idle", "requires_action", "running", "unknown"].includes(tag);
29844
- }
29845
- };
29846
30264
  var CreateElicitationResponse2 = {
29847
30265
  /** Narrow to the `accept` variant, validating its payload. */
29848
30266
  isAccept(value) {
@@ -30518,6 +30936,29 @@ async function waitUntilInitializedIncoming(message, state) {
30518
30936
  }
30519
30937
  return blockUninitializedIncoming(message);
30520
30938
  }
30939
+ function defaultEntityCancelHandler(handles) {
30940
+ const entities = {
30941
+ [AGENT_METHODS2.tool_call_cancel]: {
30942
+ key: "toolCallId",
30943
+ label: "tool call"
30944
+ },
30945
+ [AGENT_METHODS2.terminal_cancel]: {
30946
+ key: "terminalId",
30947
+ label: "terminal"
30948
+ }
30949
+ };
30950
+ return {
30951
+ async handleMessage(message) {
30952
+ const entity = Object.hasOwn(entities, message.method) ? entities[message.method] : void 0;
30953
+ if (message.kind !== "request" || !entity || handles(message.method)) {
30954
+ return Handled.no(message);
30955
+ }
30956
+ const id = isRecord(message.params) ? message.params[entity.key] : void 0;
30957
+ return rejectIncoming(message, RequestError.invalidParams(typeof id === "string" ? { [entity.key]: id } : void 0, `the ${entity.label} is unknown or not cancellable`));
30958
+ },
30959
+ describe: () => "default-entity-cancel"
30960
+ };
30961
+ }
30521
30962
  function agentInitializationGuard() {
30522
30963
  return {
30523
30964
  async handleMessage(message, cx) {
@@ -30594,7 +31035,8 @@ var methods2 = {
30594
31035
  initialize: AGENT_METHODS2.initialize,
30595
31036
  auth: {
30596
31037
  login: AGENT_METHODS2.auth_login,
30597
- logout: AGENT_METHODS2.auth_logout
31038
+ logout: AGENT_METHODS2.auth_logout,
31039
+ status: AGENT_METHODS2.auth_status
30598
31040
  },
30599
31041
  providers: {
30600
31042
  list: AGENT_METHODS2.providers_list,
@@ -30606,12 +31048,22 @@ var methods2 = {
30606
31048
  list: AGENT_METHODS2.session_list,
30607
31049
  delete: AGENT_METHODS2.session_delete,
30608
31050
  fork: AGENT_METHODS2.session_fork,
31051
+ archive: AGENT_METHODS2.session_archive,
31052
+ unarchive: AGENT_METHODS2.session_unarchive,
31053
+ status: AGENT_METHODS2.session_status,
31054
+ setTitle: AGENT_METHODS2.session_set_title,
30609
31055
  resume: AGENT_METHODS2.session_resume,
30610
31056
  close: AGENT_METHODS2.session_close,
30611
31057
  setConfigOption: AGENT_METHODS2.session_set_config_option,
30612
31058
  prompt: AGENT_METHODS2.session_prompt,
30613
31059
  cancel: AGENT_METHODS2.session_cancel
30614
31060
  },
31061
+ toolCall: {
31062
+ cancel: AGENT_METHODS2.tool_call_cancel
31063
+ },
31064
+ terminal: {
31065
+ cancel: AGENT_METHODS2.terminal_cancel
31066
+ },
30615
31067
  mcp: {
30616
31068
  message: AGENT_METHODS2.mcp_message
30617
31069
  }
@@ -30627,6 +31079,9 @@ var methods2 = {
30627
31079
  elicitation: {
30628
31080
  create: CLIENT_METHODS2.elicitation_create,
30629
31081
  complete: CLIENT_METHODS2.elicitation_complete
31082
+ },
31083
+ auth: {
31084
+ statusUpdate: CLIENT_METHODS2.auth_status_update
30630
31085
  }
30631
31086
  },
30632
31087
  protocol: {
@@ -30927,6 +31382,16 @@ var AsyncQueue2 = class {
30927
31382
  });
30928
31383
  }
30929
31384
  };
31385
+ function applyCancelCapability(cancellable, id, capabilities) {
31386
+ if (capabilities === void 0) {
31387
+ return;
31388
+ }
31389
+ if (capabilities?.cancel != null) {
31390
+ cancellable.add(id);
31391
+ } else {
31392
+ cancellable.delete(id);
31393
+ }
31394
+ }
30930
31395
  function cloneNewSessionRequest2(request) {
30931
31396
  return structuredClone(request);
30932
31397
  }
@@ -31005,6 +31470,9 @@ var ActiveSession2 = class _ActiveSession {
31005
31470
  updates;
31006
31471
  registrations;
31007
31472
  currentConfigOptions;
31473
+ latestBackground;
31474
+ cancellableToolCalls = /* @__PURE__ */ new Set();
31475
+ cancellableTerminals = /* @__PURE__ */ new Set();
31008
31476
  constructor(cx, sessionResponse, updates, registrations) {
31009
31477
  this.cx = cx;
31010
31478
  this.sessionResponse = sessionResponse;
@@ -31040,6 +31508,101 @@ var ActiveSession2 = class _ActiveSession {
31040
31508
  get meta() {
31041
31509
  return this.sessionResponse._meta;
31042
31510
  }
31511
+ /**
31512
+ * The `background` list from the latest `state_update` routed to this
31513
+ * session, or `undefined` while background work is not reported.
31514
+ *
31515
+ * Each `state_update` replaces it, applied when the notification arrives,
31516
+ * before it is read with `nextUpdate()`. `[]` means no background work is
31517
+ * running. A snapshot that omits the list, carries `null` or a malformed
31518
+ * list, or reports a state this SDK does not know resets it to `undefined`:
31519
+ * background work is unknown until a list arrives, and nothing should be
31520
+ * treated as abandoned. Updates stop after `dispose()`.
31521
+ */
31522
+ get background() {
31523
+ return this.latestBackground;
31524
+ }
31525
+ /**
31526
+ * Whether `request`'s `subject` references work in the latest `background`
31527
+ * list: a listed tool call (by the subject's `toolCall.toolCallId`, or a
31528
+ * command subject's `toolCallId`) or a listed terminal (by a command
31529
+ * subject's `terminalId`).
31530
+ *
31531
+ * `session/cancel` does not cover listed work, so permission requests for
31532
+ * it stay open. For the cancelled foreground work, the Agent stops waiting
31533
+ * on its permission requests and cancels them with `$/cancel_request`, and
31534
+ * the Client answers each cancelled request with the `cancelled` outcome.
31535
+ * A Client may also answer a request with `cancelled` right after sending
31536
+ * `session/cancel`, without waiting for `$/cancel_request`, but only when
31537
+ * it knows the request belongs to the cancelled work. A `false` result
31538
+ * alone does not establish that: it is also returned for requests without
31539
+ * a `subject`, custom subjects, and any request while `background` is not
31540
+ * reported. On `session/close`, the Agent cancels every pending permission
31541
+ * request in the session with `$/cancel_request`. When an Agent sends a
31542
+ * permission request with `cancellationSignal` and
31543
+ * `stopWaitingOnCancel: true`, aborting the signal sends
31544
+ * `$/cancel_request` and stops waiting for the answer.
31545
+ */
31546
+ isForBackgroundWork(request) {
31547
+ const background = this.latestBackground;
31548
+ const subject = request.subject;
31549
+ if (!background || !subject) {
31550
+ return false;
31551
+ }
31552
+ let toolCallId;
31553
+ let terminalId;
31554
+ if (RequestPermissionSubject.isToolCall(subject)) {
31555
+ toolCallId = subject.toolCall.toolCallId;
31556
+ } else if (RequestPermissionSubject.isCommand(subject)) {
31557
+ toolCallId = subject.toolCallId;
31558
+ terminalId = subject.terminalId;
31559
+ }
31560
+ return background.some((work) => toolCallId != null && BackgroundWork.isToolCall(work) && work.toolCallId === toolCallId || terminalId != null && BackgroundWork.isTerminal(work) && work.terminalId === terminalId);
31561
+ }
31562
+ /**
31563
+ * Whether the tool call currently advertises `capabilities.cancel`, from
31564
+ * the `tool_call_update` patches routed to this session.
31565
+ */
31566
+ canCancelToolCall(toolCallId) {
31567
+ return this.cancellableToolCalls.has(toolCallId);
31568
+ }
31569
+ /**
31570
+ * Whether the terminal currently advertises `capabilities.cancel`, from the
31571
+ * `terminal_update` patches routed to this session.
31572
+ */
31573
+ canCancelTerminal(terminalId) {
31574
+ return this.cancellableTerminals.has(terminalId);
31575
+ }
31576
+ /**
31577
+ * Cancels one tool call with `tool_call/cancel`.
31578
+ *
31579
+ * Rejects with a `TypeError`, without sending the request, unless the tool
31580
+ * call currently advertises `capabilities.cancel` (see
31581
+ * `canCancelToolCall`). The response means the Agent accepted the
31582
+ * cancellation, not that the work stopped. The Agent confirms it with a
31583
+ * `tool_call_update` to a final status.
31584
+ */
31585
+ cancelToolCall(toolCallId, options) {
31586
+ if (!this.canCancelToolCall(toolCallId)) {
31587
+ return Promise.reject(new TypeError(`Tool call ${JSON.stringify(toolCallId)} does not advertise cancel`));
31588
+ }
31589
+ return this.cx.request(AGENT_METHODS2.tool_call_cancel, { sessionId: this.sessionId, toolCallId }, options);
31590
+ }
31591
+ /**
31592
+ * Stops a terminal's process with `terminal/cancel`.
31593
+ *
31594
+ * Rejects with a `TypeError`, without sending the request, unless the
31595
+ * terminal currently advertises `capabilities.cancel` (see
31596
+ * `canCancelTerminal`). The response means the Agent accepted the
31597
+ * cancellation, not that the process stopped. The Agent confirms it with a
31598
+ * `terminal_update` that sets `exitStatus`. The terminal is not released.
31599
+ */
31600
+ cancelTerminal(terminalId, options) {
31601
+ if (!this.canCancelTerminal(terminalId)) {
31602
+ return Promise.reject(new TypeError(`Terminal ${JSON.stringify(terminalId)} does not advertise cancel`));
31603
+ }
31604
+ return this.cx.request(AGENT_METHODS2.terminal_cancel, { sessionId: this.sessionId, terminalId }, options);
31605
+ }
31043
31606
  /**
31044
31607
  * Full response returned by `session/new`.
31045
31608
  */
@@ -31142,8 +31705,15 @@ var ActiveSession2 = class _ActiveSession {
31142
31705
  }
31143
31706
  /** @internal */
31144
31707
  [routeActiveSessionUpdate](message) {
31145
- if (SessionUpdate.isConfigOptionUpdate(message.update)) {
31146
- this.currentConfigOptions = message.update.configOptions;
31708
+ const { update } = message;
31709
+ if (SessionUpdate.isConfigOptionUpdate(update)) {
31710
+ this.currentConfigOptions = update.configOptions;
31711
+ } else if (SessionUpdate.isStateUpdate(update)) {
31712
+ this.latestBackground = !StateUpdate2.isCustom(update) && Array.isArray(update.background) ? update.background : void 0;
31713
+ } else if (SessionUpdate.isToolCallUpdate(update)) {
31714
+ applyCancelCapability(this.cancellableToolCalls, update.toolCallId, update.capabilities);
31715
+ } else if (SessionUpdate.isTerminalUpdate(update)) {
31716
+ applyCancelCapability(this.cancellableTerminals, update.terminalId, update.capabilities);
31147
31717
  }
31148
31718
  this.updates.enqueue(message);
31149
31719
  }
@@ -31210,9 +31780,16 @@ var agentRequestSpecs2 = {
31210
31780
  listSessions: requestSpec2(AGENT_METHODS2.session_list, zListSessionsRequest2, zListSessionsResponse2),
31211
31781
  deleteSession: requestSpec2(AGENT_METHODS2.session_delete, zDeleteSessionRequest2, zDeleteSessionResponse2, emptyObjectResponse2),
31212
31782
  unstable_forkSession: requestSpec2(AGENT_METHODS2.session_fork, received(zForkSessionRequest2), received(zForkSessionResponse2)),
31783
+ unstable_archiveSession: requestSpec2(AGENT_METHODS2.session_archive, zArchiveSessionRequest2, zArchiveSessionResponse2, emptyObjectResponse2),
31784
+ unstable_unarchiveSession: requestSpec2(AGENT_METHODS2.session_unarchive, zUnarchiveSessionRequest2, zUnarchiveSessionResponse2, emptyObjectResponse2),
31785
+ unstable_sessionStatus: requestSpec2(AGENT_METHODS2.session_status, zSessionStatusRequest2, received(zSessionStatusResponse2)),
31786
+ unstable_setSessionTitle: requestSpec2(AGENT_METHODS2.session_set_title, zSetSessionTitleRequest2, zSetSessionTitleResponse2),
31213
31787
  resumeSession: requestSpec2(AGENT_METHODS2.session_resume, received(zResumeSessionRequest2), received(zResumeSessionResponse2)),
31214
31788
  closeSession: requestSpec2(AGENT_METHODS2.session_close, zCloseSessionRequest2, zCloseSessionResponse2, emptyObjectResponse2),
31215
- logoutAuth: requestSpec2(AGENT_METHODS2.auth_logout, zLogoutAuthRequest, zLogoutAuthResponse, emptyObjectResponse2)
31789
+ cancelToolCall: requestSpec2(AGENT_METHODS2.tool_call_cancel, zCancelToolCallRequest, zCancelToolCallResponse, emptyObjectResponse2),
31790
+ cancelTerminal: requestSpec2(AGENT_METHODS2.terminal_cancel, zCancelTerminalRequest, zCancelTerminalResponse, emptyObjectResponse2),
31791
+ logoutAuth: requestSpec2(AGENT_METHODS2.auth_logout, zLogoutAuthRequest, zLogoutAuthResponse, emptyObjectResponse2),
31792
+ unstable_authStatus: requestSpec2(AGENT_METHODS2.auth_status, zAuthStatusRequest2, zAuthStatusResponse2)
31216
31793
  };
31217
31794
  var agentNotificationSpecs2 = {
31218
31795
  cancelSession: notificationSpec2(AGENT_METHODS2.session_cancel, zCancelSessionNotification),
@@ -31225,7 +31802,8 @@ var clientRequestSpecs2 = {
31225
31802
  };
31226
31803
  var clientNotificationSpecs2 = {
31227
31804
  sessionUpdate: notificationSpec2(CLIENT_METHODS2.session_update, received(zUpdateSessionNotification)),
31228
- completeElicitation: notificationSpec2(CLIENT_METHODS2.elicitation_complete, zCompleteElicitationNotification2)
31805
+ completeElicitation: notificationSpec2(CLIENT_METHODS2.elicitation_complete, zCompleteElicitationNotification2),
31806
+ unstable_authStatusUpdate: notificationSpec2(CLIENT_METHODS2.auth_status_update, zAuthStatusUpdateNotification2)
31229
31807
  };
31230
31808
  var agentRequestSpecsByMethod2 = specsByMethod2(agentRequestSpecs2);
31231
31809
  var agentNotificationSpecsByMethod2 = specsByMethod2(agentNotificationSpecs2);
@@ -31349,9 +31927,11 @@ var AgentApp2 = class {
31349
31927
  builder = Connection.builder();
31350
31928
  connectHandlers = [];
31351
31929
  fallbackKinds = /* @__PURE__ */ new Set();
31930
+ requestMethods = /* @__PURE__ */ new Set();
31352
31931
  hasInitializeHandler = false;
31353
31932
  constructor(options = {}) {
31354
31933
  this.builder.withHandler(agentInitializationGuard());
31934
+ this.builder.withHandler(defaultEntityCancelHandler((method) => this.requestMethods.has(method) || this.fallbackKinds.has("request")));
31355
31935
  if (options.name) {
31356
31936
  this.builder.name(options.name);
31357
31937
  }
@@ -31422,6 +32002,7 @@ var AgentApp2 = class {
31422
32002
  if (method === AGENT_METHODS2.initialize) {
31423
32003
  this.hasInitializeHandler = true;
31424
32004
  }
32005
+ this.requestMethods.add(method);
31425
32006
  return this.request(spec, handlerOrParams);
31426
32007
  }
31427
32008
  onNotification(method, handlerOrParams, handler) {
@@ -32805,7 +33386,11 @@ var AcpClientDelivery = class {
32805
33386
  return await this.withElicitationRequest(
32806
33387
  method,
32807
33388
  params,
32808
- () => this.client.request(method, params, { ...options, cancellationSignal })
33389
+ () => this.client.request(method, params, {
33390
+ ...options,
33391
+ cancellationSignal,
33392
+ stopWaitingOnCancel: method === methods.client.session.requestPermission || options?.stopWaitingOnCancel === true
33393
+ })
32809
33394
  );
32810
33395
  } finally {
32811
33396
  requests.delete(controller);
@@ -33012,7 +33597,7 @@ var AcpV2Connection = class {
33012
33597
  const response = await this.client.request(
33013
33598
  methods2.client.session.requestPermission,
33014
33599
  toV2RequestPermissionRequest(request),
33015
- options
33600
+ { ...options, stopWaitingOnCancel: true }
33016
33601
  );
33017
33602
  return toV1RequestPermissionResponse(response);
33018
33603
  }, options?.cancellationSignal);
@@ -37708,11 +38293,12 @@ var SessionIndexTitles = class {
37708
38293
  title
37709
38294
  });
37710
38295
  }
38296
+ return title;
37711
38297
  }
37712
38298
  /**
37713
38299
  * Writes an automatic title in the write queue of the session, unless `_session/rename` has set or is
37714
38300
  * setting the title. The check runs when the write gets its turn, whatever `SessionState` the generator
37715
- * belongs to. Only a `sessionIndex` client renames this way, so nothing changes for other clients.
38301
+ * belongs to. Both standard and AIR title requests suppress automatic title writes.
37716
38302
  */
37717
38303
  writeAutomaticTitle(sessionId, title, write) {
37718
38304
  return this.writes.run(sessionId, async () => {
@@ -41315,6 +41901,7 @@ var AgentMode = class _AgentMode {
41315
41901
 
41316
41902
  // src/CodexAcpClient.ts
41317
41903
  import path10 from "node:path";
41904
+ import { isDeepStrictEqual } from "node:util";
41318
41905
 
41319
41906
  // package.json
41320
41907
  var package_default = {
@@ -41322,7 +41909,7 @@ var package_default = {
41322
41909
  publishConfig: {
41323
41910
  access: "public"
41324
41911
  },
41325
- version: "2.5.1-preview.15",
41912
+ version: "2.5.1-preview.17",
41326
41913
  description: "",
41327
41914
  main: "dist/index.js",
41328
41915
  bin: {
@@ -41387,7 +41974,7 @@ var package_default = {
41387
41974
  vitest: "^5.0.1"
41388
41975
  },
41389
41976
  dependencies: {
41390
- "@agentclientprotocol/sdk": "~2.2.0",
41977
+ "@agentclientprotocol/sdk": "~2.4.0",
41391
41978
  "@openai/codex": "^0.165.0",
41392
41979
  "cross-spawn": "^7.0.6",
41393
41980
  diff: "^9.0.0",
@@ -41786,6 +42373,9 @@ function clientSystemPromptText(value) {
41786
42373
  if (typeof value !== "object" || Array.isArray(value) || !("mode" in value) || value.mode !== "append" || !("content" in value) || !Array.isArray(value.content)) {
41787
42374
  throw RequestError.invalidParams(void 0, "systemPrompt requires append mode and text content");
41788
42375
  }
42376
+ if (value.content.length === 0) {
42377
+ throw RequestError.invalidParams(void 0, "systemPrompt content must not be empty");
42378
+ }
41789
42379
  const blocks = [];
41790
42380
  for (const block of value.content) {
41791
42381
  if (block === null || typeof block !== "object" || block.type !== "text" || typeof block.text !== "string") {
@@ -42204,9 +42794,9 @@ var CodexAcpClient = class _CodexAcpClient {
42204
42794
  if (!URL.canParse(request.baseUrl) || !["http:", "https:"].includes(new URL(request.baseUrl).protocol)) {
42205
42795
  throw RequestError.invalidParams({ baseUrl: request.baseUrl }, "baseUrl must be an http(s) URL");
42206
42796
  }
42207
- const previous = this.gatewayConfigSource === "acpProviders" ? this.gatewayConfig : null;
42797
+ const previousListing = this.hasProviderRouting(gatewayConfig) ? this.gatewayConfig?.listedModels ?? null : null;
42208
42798
  try {
42209
- gatewayConfig.listedModels = previous?.listedModels && sameGatewayRouting(previous, gatewayConfig) ? previous.listedModels : await listGatewayModels(gatewayConfig.config.base_url, gatewayConfig.config.http_headers);
42799
+ gatewayConfig.listedModels = previousListing ?? await listGatewayModels(gatewayConfig.config.base_url, gatewayConfig.config.http_headers);
42210
42800
  } catch (error62) {
42211
42801
  if (error62 instanceof GatewayListingError) {
42212
42802
  throw RequestError.internalError(
@@ -42218,6 +42808,10 @@ var CodexAcpClient = class _CodexAcpClient {
42218
42808
  }
42219
42809
  return gatewayConfig;
42220
42810
  }
42811
+ /** Whether `providers/set` already applied the provider config of `gatewayConfig`. */
42812
+ hasProviderRouting(gatewayConfig) {
42813
+ return this.gatewayConfigSource === "acpProviders" && this.gatewayConfig !== null && sameProviderConfig(this.gatewayConfig, gatewayConfig);
42814
+ }
42221
42815
  /** `providers/set`: replaces the routing with a configuration from {@link prepareProvider}. */
42222
42816
  setProvider(gatewayConfig) {
42223
42817
  this.gatewayConfigSource = "acpProviders";
@@ -43144,10 +43738,8 @@ function buildGatewayConfig(params) {
43144
43738
  listedModels: null
43145
43739
  };
43146
43740
  }
43147
- function sameGatewayRouting(left, right) {
43148
- const leftHeaders = Object.entries(left.config.http_headers);
43149
- const rightHeaders = right.config.http_headers;
43150
- return left.config.base_url === right.config.base_url && left.config.wire_api === right.config.wire_api && leftHeaders.length === Object.keys(rightHeaders).length && leftHeaders.every(([name, value]) => rightHeaders[name] === value);
43741
+ function sameProviderConfig(left, right) {
43742
+ return left.modelProvider === right.modelProvider && isDeepStrictEqual(left.config, right.config);
43151
43743
  }
43152
43744
  function readMetaAdditionalRoots(meta3) {
43153
43745
  const rawRoots = meta3?.["additionalRoots"];
@@ -49501,10 +50093,14 @@ var SessionIndexService = class {
49501
50093
  /** `_session/rename`. */
49502
50094
  async rename({ sessionId, title }) {
49503
50095
  this.require(SESSION_RENAME_METHOD);
49504
- await this.host.ensureAppServer();
49505
- await this.titles.rename(sessionId, title);
50096
+ await this.setTitle({ sessionId, title });
49506
50097
  return {};
49507
50098
  }
50099
+ /** Standard title requests share persistence, normalization and automatic-title suppression with AIR. */
50100
+ async setTitle({ sessionId, title }) {
50101
+ await this.host.ensureAppServer();
50102
+ return { title: await this.titles.rename(sessionId, title) };
50103
+ }
49508
50104
  /**
49509
50105
  * `_session/archive` and `_session/unarchive`, as `session/archive` and `session/unarchive` of ACP RFD #2161.
49510
50106
  * Both are idempotent and work for a session that is not loaded. Archiving stops a session that is open here,
@@ -50129,6 +50725,8 @@ var CodexAcpServer = class {
50129
50725
  recovery;
50130
50726
  initializeRequest = null;
50131
50727
  providerUpdate = null;
50728
+ /** The last provider update failed, so the app-server may not run the routing of the agent. */
50729
+ providerUpdateFailed = false;
50132
50730
  /**
50133
50731
  * Numbers `providers/set` and `providers/disable` requests in arrival order. A listing finishing after a newer
50134
50732
  * request was applied is dropped; a newer request that failed drops nothing.
@@ -50375,6 +50973,7 @@ var CodexAcpServer = class {
50375
50973
  close: {},
50376
50974
  delete: {},
50377
50975
  fork: {},
50976
+ title: {},
50378
50977
  additionalDirectories: {},
50379
50978
  subagents: {},
50380
50979
  systemPrompt: {}
@@ -50454,6 +51053,7 @@ var CodexAcpServer = class {
50454
51053
  delete: {},
50455
51054
  additionalDirectories: {},
50456
51055
  fork: {},
51056
+ title: {},
50457
51057
  systemPrompt: {}
50458
51058
  }
50459
51059
  },
@@ -51664,6 +52264,11 @@ You have been logged out. Please try again.`);
51664
52264
  return {};
51665
52265
  }
51666
52266
  this.appliedProviderRequest = request;
52267
+ if (this.codexAcpClient.hasProviderRouting(gatewayConfig) && !this.providerUpdateFailed) {
52268
+ logger.log("providers/set unchanged: the app-server is not restarted");
52269
+ await this.waitForProviderUpdate();
52270
+ return {};
52271
+ }
51667
52272
  this.codexAcpClient.setProvider(gatewayConfig);
51668
52273
  await this.enqueueProviderUpdate((client) => client.setProvider(gatewayConfig));
51669
52274
  return {};
@@ -51761,6 +52366,11 @@ You have been logged out. Please try again.`);
51761
52366
  }
51762
52367
  });
51763
52368
  this.providerUpdate = update;
52369
+ update.then(() => {
52370
+ this.providerUpdateFailed = false;
52371
+ }, () => {
52372
+ this.providerUpdateFailed = true;
52373
+ });
51764
52374
  this.recovery?.settleReplacement(update);
51765
52375
  try {
51766
52376
  await update;
@@ -54954,8 +55564,8 @@ function createRouter(createAgent, responses) {
54954
55564
  });
54955
55565
  return result;
54956
55566
  };
54957
- const v1Agent = agent({ name: package_default.name }).onConnect((connection) => attachAgent(createAgent(connection.client), connection.signal)).onRequest(methods.agent.initialize, (ctx) => initialize(ctx.requestId, () => getAgent().initialize(ctx.params))).onRequest(methods.agent.session.new, (ctx) => createdSetup(ctx.requestId, () => getAgentForPaths(ctx.params).newSession(ctx.params))).onRequest(methods.agent.session.load, (ctx) => setup(ctx.params.sessionId, ctx.requestId, () => getAgentForPaths(ctx.params).loadSession(ctx.params), ctx.signal)).onRequest(methods.agent.session.fork, (ctx) => createdSetup(ctx.requestId, () => getAgentForPaths(ctx.params).forkSession(ctx.params))).onRequest(methods.agent.session.list, (ctx) => getAgentForPaths({ cwd: ctx.params.cwd ?? null }).listSessions(ctx.params)).onRequest(methods.agent.session.delete, (ctx) => getAgent(ctx.params).deleteSession(ctx.params)).onRequest(methods.agent.session.resume, (ctx) => setup(ctx.params.sessionId, ctx.requestId, () => getAgentForPaths(ctx.params).resumeSession(ctx.params), ctx.signal)).onRequest(methods.agent.session.close, (ctx) => getAgent(ctx.params).closeSession(ctx.params)).onRequest(methods.agent.session.setMode, (ctx) => getAgent(ctx.params).setSessionMode(ctx.params)).onRequest(methods.agent.session.setConfigOption, (ctx) => getAgent(ctx.params).setSessionConfigOption(ctx.params)).onRequest(methods.agent.authenticate, (ctx) => getAgent().authenticate(ctx.params, ctx.requestId, ctx.signal)).onRequest(methods.agent.logout, (ctx) => getAgent().logout(ctx.params)).onRequest(methods.agent.providers.list, (ctx) => getAgent().listProviders(ctx.params)).onRequest(methods.agent.providers.set, (ctx) => getAgent().setProvider(ctx.params)).onRequest(methods.agent.providers.disable, (ctx) => getAgent().disableProvider(ctx.params)).onRequest(methods.agent.session.prompt, (ctx) => getAgent(ctx.params).prompt(ctx.params, ctx.signal)).onNotification(methods.agent.session.cancel, (ctx) => getAgent().cancel(ctx.params)).onRequest("authentication/status", emptyExtensionParamsParser, (ctx) => getAgent().extMethod("authentication/status", ctx.params)).onRequest("authentication/logout", emptyExtensionParamsParser, (ctx) => getAgent().extMethod("authentication/logout", ctx.params)).onRequest(LEGACY_SET_SESSION_MODEL_METHOD, legacySetSessionModelParamsParser, (ctx) => getAgent(ctx.params).extMethod(LEGACY_SET_SESSION_MODEL_METHOD, ctx.params)).onRequest(SESSION_STEERING_METHOD, sessionSteerParamsParser, (ctx) => getAgent(ctx.params).extMethod(SESSION_STEERING_METHOD, ctx.params)).onRequest(ASYNC_TASK_STOP_METHOD, asyncTaskStopParamsParser, (ctx) => getAgent(ctx.params).extMethod(ASYNC_TASK_STOP_METHOD, ctx.params)).onRequest(CODEX_HOOKS_LIST_METHOD, hooksListParamsParser, (ctx) => getAgent().listHooks(ctx.params.cwd)).onRequest(CODEX_HOOKS_TRUST_METHOD, hooksTrustParamsParser, (ctx) => getAgent().trustHooks(ctx.params.cwd, ctx.params.hooks)).onRequest(GOAL_CONTROL_METHOD, goalControlParamsParser, (ctx) => getAgent(ctx.params).extMethod(GOAL_CONTROL_METHOD, ctx.params)).onRequest(SESSION_RENAME_METHOD, sessionRenameParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.rename(ctx.params)).onRequest(SESSION_BATCH_GET_METHOD, sessionBatchGetParamsParser, (ctx) => getAgent().sessionIndex.batchGet(ctx.params)).onRequest(SESSION_ARCHIVE_METHOD, sessionArchiveParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.setArchived(ctx.params, true)).onRequest(SESSION_UNARCHIVE_METHOD, sessionArchiveParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.setArchived(ctx.params, false)).onRequest(SESSION_LIST_SUBSCRIBE_METHOD, sessionListSubscriptionParamsParser, (ctx) => getAgent().sessionIndex.subscribeList(ctx.params)).onRequest(SESSION_LIST_UNSUBSCRIBE_METHOD, sessionListSubscriptionParamsParser, (ctx) => getAgent().sessionIndex.unsubscribeList(ctx.params));
54958
- const v2Agent = agent2({ name: package_default.name }).onConnect((connection) => attachAgent(createAgent(new AcpV2Connection(connection.client)), connection.signal)).onRequest(methods2.agent.initialize, (ctx) => initialize(ctx.requestId, () => getAgent().initializeV2(ctx.params))).onRequest(methods2.agent.session.new, (ctx) => createdSetup(ctx.requestId, () => getAgentForPaths(ctx.params).newSessionV2(ctx.params))).onRequest(methods2.agent.session.list, (ctx) => getAgentForPaths({ cwd: ctx.params.cwd ?? null }).listSessions(ctx.params)).onRequest(methods2.agent.session.delete, (ctx) => getAgent(ctx.params).deleteSession(ctx.params)).onRequest(methods2.agent.session.resume, (ctx) => setup(ctx.params.sessionId, ctx.requestId, () => getAgentForPaths(ctx.params).resumeSessionV2(ctx.params), ctx.signal)).onRequest(methods2.agent.session.fork, (ctx) => createdSetup(ctx.requestId, () => getAgentForPaths(ctx.params).forkSessionV2(ctx.params))).onRequest(methods2.agent.session.close, (ctx) => getAgent(ctx.params).closeSession(ctx.params)).onRequest(methods2.agent.session.setConfigOption, (ctx) => getAgent(ctx.params).setSessionConfigOptionV2(ctx.params)).onRequest(methods2.agent.auth.login, (ctx) => getAgent().authenticateV2(ctx.params, ctx.requestId, ctx.signal)).onRequest(methods2.agent.auth.logout, (ctx) => getAgent().logoutV2(ctx.params)).onRequest(methods2.agent.session.prompt, (ctx) => getAgent(ctx.params).promptV2(ctx.params, ctx.signal)).onNotification(methods2.agent.session.cancel, (ctx) => getAgent().cancel(ctx.params)).onRequest(methods2.agent.providers.list, (ctx) => getAgent().listProviders(ctx.params)).onRequest(methods2.agent.providers.set, (ctx) => getAgent().setProvider(ctx.params)).onRequest(methods2.agent.providers.disable, (ctx) => getAgent().disableProvider(ctx.params)).onRequest(SESSION_STEERING_METHOD, sessionSteerParamsParser, (ctx) => getAgent(ctx.params).extMethod(SESSION_STEERING_METHOD, ctx.params)).onRequest(GOAL_CONTROL_METHOD, goalControlParamsParser, (ctx) => getAgent(ctx.params).extMethod(GOAL_CONTROL_METHOD, ctx.params)).onRequest(ASYNC_TASK_STOP_METHOD, asyncTaskStopParamsParser, (ctx) => getAgent(ctx.params).extMethod(ASYNC_TASK_STOP_METHOD, ctx.params)).onRequest(SESSION_RENAME_METHOD, sessionRenameParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.rename(ctx.params)).onRequest(SESSION_BATCH_GET_METHOD, sessionBatchGetParamsParser, (ctx) => getAgent().sessionIndex.batchGet(ctx.params)).onRequest(SESSION_ARCHIVE_METHOD, sessionArchiveParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.setArchived(ctx.params, true)).onRequest(SESSION_UNARCHIVE_METHOD, sessionArchiveParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.setArchived(ctx.params, false)).onRequest(SESSION_LIST_SUBSCRIBE_METHOD, sessionListSubscriptionParamsParser, (ctx) => getAgent().sessionIndex.subscribeList(ctx.params)).onRequest(SESSION_LIST_UNSUBSCRIBE_METHOD, sessionListSubscriptionParamsParser, (ctx) => getAgent().sessionIndex.unsubscribeList(ctx.params));
55567
+ const v1Agent = agent({ name: package_default.name }).onConnect((connection) => attachAgent(createAgent(connection.client), connection.signal)).onRequest(methods.agent.initialize, (ctx) => initialize(ctx.requestId, () => getAgent().initialize(ctx.params))).onRequest(methods.agent.session.new, (ctx) => createdSetup(ctx.requestId, () => getAgentForPaths(ctx.params).newSession(ctx.params))).onRequest(methods.agent.session.load, (ctx) => setup(ctx.params.sessionId, ctx.requestId, () => getAgentForPaths(ctx.params).loadSession(ctx.params), ctx.signal)).onRequest(methods.agent.session.fork, (ctx) => createdSetup(ctx.requestId, () => getAgentForPaths(ctx.params).forkSession(ctx.params))).onRequest(methods.agent.session.list, (ctx) => getAgentForPaths({ cwd: ctx.params.cwd ?? null }).listSessions(ctx.params)).onRequest(methods.agent.session.delete, (ctx) => getAgent(ctx.params).deleteSession(ctx.params)).onRequest(methods.agent.session.resume, (ctx) => setup(ctx.params.sessionId, ctx.requestId, () => getAgentForPaths(ctx.params).resumeSession(ctx.params), ctx.signal)).onRequest(methods.agent.session.close, (ctx) => getAgent(ctx.params).closeSession(ctx.params)).onRequest(methods.agent.session.setMode, (ctx) => getAgent(ctx.params).setSessionMode(ctx.params)).onRequest(methods.agent.session.setConfigOption, (ctx) => getAgent(ctx.params).setSessionConfigOption(ctx.params)).onRequest(methods.agent.session.setTitle, (ctx) => getAgent(ctx.params).sessionIndex.setTitle(ctx.params)).onRequest(methods.agent.authenticate, (ctx) => getAgent().authenticate(ctx.params, ctx.requestId, ctx.signal)).onRequest(methods.agent.logout, (ctx) => getAgent().logout(ctx.params)).onRequest(methods.agent.providers.list, (ctx) => getAgent().listProviders(ctx.params)).onRequest(methods.agent.providers.set, (ctx) => getAgent().setProvider(ctx.params)).onRequest(methods.agent.providers.disable, (ctx) => getAgent().disableProvider(ctx.params)).onRequest(methods.agent.session.prompt, (ctx) => getAgent(ctx.params).prompt(ctx.params, ctx.signal)).onNotification(methods.agent.session.cancel, (ctx) => getAgent().cancel(ctx.params)).onRequest("authentication/status", emptyExtensionParamsParser, (ctx) => getAgent().extMethod("authentication/status", ctx.params)).onRequest("authentication/logout", emptyExtensionParamsParser, (ctx) => getAgent().extMethod("authentication/logout", ctx.params)).onRequest(LEGACY_SET_SESSION_MODEL_METHOD, legacySetSessionModelParamsParser, (ctx) => getAgent(ctx.params).extMethod(LEGACY_SET_SESSION_MODEL_METHOD, ctx.params)).onRequest(SESSION_STEERING_METHOD, sessionSteerParamsParser, (ctx) => getAgent(ctx.params).extMethod(SESSION_STEERING_METHOD, ctx.params)).onRequest(ASYNC_TASK_STOP_METHOD, asyncTaskStopParamsParser, (ctx) => getAgent(ctx.params).extMethod(ASYNC_TASK_STOP_METHOD, ctx.params)).onRequest(CODEX_HOOKS_LIST_METHOD, hooksListParamsParser, (ctx) => getAgent().listHooks(ctx.params.cwd)).onRequest(CODEX_HOOKS_TRUST_METHOD, hooksTrustParamsParser, (ctx) => getAgent().trustHooks(ctx.params.cwd, ctx.params.hooks)).onRequest(GOAL_CONTROL_METHOD, goalControlParamsParser, (ctx) => getAgent(ctx.params).extMethod(GOAL_CONTROL_METHOD, ctx.params)).onRequest(SESSION_RENAME_METHOD, sessionRenameParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.rename(ctx.params)).onRequest(SESSION_BATCH_GET_METHOD, sessionBatchGetParamsParser, (ctx) => getAgent().sessionIndex.batchGet(ctx.params)).onRequest(SESSION_ARCHIVE_METHOD, sessionArchiveParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.setArchived(ctx.params, true)).onRequest(SESSION_UNARCHIVE_METHOD, sessionArchiveParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.setArchived(ctx.params, false)).onRequest(SESSION_LIST_SUBSCRIBE_METHOD, sessionListSubscriptionParamsParser, (ctx) => getAgent().sessionIndex.subscribeList(ctx.params)).onRequest(SESSION_LIST_UNSUBSCRIBE_METHOD, sessionListSubscriptionParamsParser, (ctx) => getAgent().sessionIndex.unsubscribeList(ctx.params));
55568
+ const v2Agent = agent2({ name: package_default.name }).onConnect((connection) => attachAgent(createAgent(new AcpV2Connection(connection.client)), connection.signal)).onRequest(methods2.agent.initialize, (ctx) => initialize(ctx.requestId, () => getAgent().initializeV2(ctx.params))).onRequest(methods2.agent.session.new, (ctx) => createdSetup(ctx.requestId, () => getAgentForPaths(ctx.params).newSessionV2(ctx.params))).onRequest(methods2.agent.session.list, (ctx) => getAgentForPaths({ cwd: ctx.params.cwd ?? null }).listSessions(ctx.params)).onRequest(methods2.agent.session.delete, (ctx) => getAgent(ctx.params).deleteSession(ctx.params)).onRequest(methods2.agent.session.resume, (ctx) => setup(ctx.params.sessionId, ctx.requestId, () => getAgentForPaths(ctx.params).resumeSessionV2(ctx.params), ctx.signal)).onRequest(methods2.agent.session.fork, (ctx) => createdSetup(ctx.requestId, () => getAgentForPaths(ctx.params).forkSessionV2(ctx.params))).onRequest(methods2.agent.session.close, (ctx) => getAgent(ctx.params).closeSession(ctx.params)).onRequest(methods2.agent.session.setConfigOption, (ctx) => getAgent(ctx.params).setSessionConfigOptionV2(ctx.params)).onRequest(methods2.agent.session.setTitle, (ctx) => getAgent(ctx.params).sessionIndex.setTitle(ctx.params)).onRequest(methods2.agent.auth.login, (ctx) => getAgent().authenticateV2(ctx.params, ctx.requestId, ctx.signal)).onRequest(methods2.agent.auth.logout, (ctx) => getAgent().logoutV2(ctx.params)).onRequest(methods2.agent.session.prompt, (ctx) => getAgent(ctx.params).promptV2(ctx.params, ctx.signal)).onNotification(methods2.agent.session.cancel, (ctx) => getAgent().cancel(ctx.params)).onRequest(methods2.agent.providers.list, (ctx) => getAgent().listProviders(ctx.params)).onRequest(methods2.agent.providers.set, (ctx) => getAgent().setProvider(ctx.params)).onRequest(methods2.agent.providers.disable, (ctx) => getAgent().disableProvider(ctx.params)).onRequest(SESSION_STEERING_METHOD, sessionSteerParamsParser, (ctx) => getAgent(ctx.params).extMethod(SESSION_STEERING_METHOD, ctx.params)).onRequest(GOAL_CONTROL_METHOD, goalControlParamsParser, (ctx) => getAgent(ctx.params).extMethod(GOAL_CONTROL_METHOD, ctx.params)).onRequest(ASYNC_TASK_STOP_METHOD, asyncTaskStopParamsParser, (ctx) => getAgent(ctx.params).extMethod(ASYNC_TASK_STOP_METHOD, ctx.params)).onRequest(SESSION_RENAME_METHOD, sessionRenameParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.rename(ctx.params)).onRequest(SESSION_BATCH_GET_METHOD, sessionBatchGetParamsParser, (ctx) => getAgent().sessionIndex.batchGet(ctx.params)).onRequest(SESSION_ARCHIVE_METHOD, sessionArchiveParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.setArchived(ctx.params, true)).onRequest(SESSION_UNARCHIVE_METHOD, sessionArchiveParamsParser, (ctx) => getAgent(ctx.params).sessionIndex.setArchived(ctx.params, false)).onRequest(SESSION_LIST_SUBSCRIBE_METHOD, sessionListSubscriptionParamsParser, (ctx) => getAgent().sessionIndex.subscribeList(ctx.params)).onRequest(SESSION_LIST_UNSUBSCRIBE_METHOD, sessionListSubscriptionParamsParser, (ctx) => getAgent().sessionIndex.unsubscribeList(ctx.params));
54959
55569
  return agentProtocolRouter().withV1(v1Agent).withV2(v2Agent);
54960
55570
  }
54961
55571