@nyssance/codex-acp-v2 0.7.6 → 0.7.8

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 (3) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/index.js +492 -83
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.8 — 2026-10-10
4
+
5
+ ### Fixed
6
+
7
+ - Update ACP SDK to 1.8.0 and report failed turns with the standard `error` stop reason and JSON-RPC error details. Preserve Codex diagnostics and existing limit/refusal classifications.
8
+
9
+ ## 0.7.7 — 2026-10-09
10
+
11
+ ### Added
12
+
13
+ - Independent read-only history APIs: `_codex/session_history` for paginated turns and
14
+ `_codex/session_history_items` for paginated items, advertised through the version 2
15
+ `sessionHistory` capability.
16
+ - Browse mode for live history and export mode with optimistic consistency checks,
17
+ bounded response sizes, scoped cursors, cancellation, and structured errors.
18
+ - History projections preserve media references and text annotations, with optional
19
+ native records and explicit omission metadata for archival and export consumers.
20
+
21
+ ### Fixed
22
+
23
+ - Session listing includes custom-provider conversations by clearing the native
24
+ default model-provider filter.
25
+
3
26
  ## 0.7.6 — 2026-10-08
4
27
 
5
28
  ### Added
package/dist/index.js CHANGED
@@ -14791,6 +14791,21 @@ function preserveCustomPayload(schema, key, knownTags) {
14791
14791
  return output;
14792
14792
  });
14793
14793
  }
14794
+ function defaultOnErrorOptionalStringTag(schema, key) {
14795
+ return exports_external.preprocess((value) => {
14796
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
14797
+ return value;
14798
+ }
14799
+ const record2 = value;
14800
+ const tag = record2[key];
14801
+ if (tag === undefined || tag === null || typeof tag === "string") {
14802
+ return value;
14803
+ }
14804
+ const normalized = { ...record2 };
14805
+ delete normalized[key];
14806
+ return normalized;
14807
+ }, schema);
14808
+ }
14794
14809
  function vecSkipError(itemSchema) {
14795
14810
  return exports_external.array(itemSchema.catch(skippedItem)).transform((items) => items.filter((item) => item !== skippedItem));
14796
14811
  }
@@ -15654,8 +15669,8 @@ var zAuthMethodTerminal = object({
15654
15669
  description: defaultOnError(string2().nullish(), () => {
15655
15670
  return;
15656
15671
  }),
15657
- args: defaultOnError(vecSkipError(string2()).optional(), () => []),
15658
- env: defaultOnError(vecSkipError(zEnvVariable).optional(), () => []),
15672
+ args: array(string2()).optional(),
15673
+ env: array(zEnvVariable).optional(),
15659
15674
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
15660
15675
  return;
15661
15676
  })
@@ -16095,14 +16110,11 @@ var zRunningStateUpdate = object({
16095
16110
  return;
16096
16111
  })
16097
16112
  });
16098
- var zStopReason = union([
16099
- literal("end_turn"),
16100
- literal("max_tokens"),
16101
- literal("max_turn_requests"),
16102
- literal("refusal"),
16103
- literal("cancelled"),
16104
- string2()
16105
- ]);
16113
+ var zErrorStopReason = object({
16114
+ error: defaultOnError(zError.nullish(), () => {
16115
+ return;
16116
+ })
16117
+ });
16106
16118
  var zUsage = object({
16107
16119
  totalTokens: number2(),
16108
16120
  inputTokens: number2(),
@@ -16120,17 +16132,56 @@ var zUsage = object({
16120
16132
  return;
16121
16133
  })
16122
16134
  });
16123
- var zIdleStateUpdate = object({
16124
- stopReason: defaultOnError(zStopReason.nullish(), () => {
16125
- return;
16135
+ var zIdleStateUpdate = defaultOnErrorOptionalStringTag(preserveCustomPayload(intersection(union([
16136
+ object({
16137
+ stopReason: literal("end_turn")
16138
+ }),
16139
+ object({
16140
+ stopReason: literal("max_tokens")
16141
+ }),
16142
+ object({
16143
+ stopReason: literal("max_turn_requests")
16144
+ }),
16145
+ object({
16146
+ stopReason: literal("refusal")
16147
+ }),
16148
+ object({
16149
+ stopReason: literal("cancelled")
16126
16150
  }),
16151
+ zErrorStopReason.and(object({
16152
+ stopReason: literal("error")
16153
+ })),
16154
+ excludeKnownTags(object({
16155
+ stopReason: string2()
16156
+ }), "stopReason", [
16157
+ "cancelled",
16158
+ "end_turn",
16159
+ "error",
16160
+ "max_tokens",
16161
+ "max_turn_requests",
16162
+ "refusal"
16163
+ ]),
16164
+ object({
16165
+ stopReason: _null3().optional()
16166
+ })
16167
+ ]), object({
16127
16168
  usage: defaultOnError(zUsage.nullish(), () => {
16128
16169
  return;
16129
16170
  }),
16130
16171
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
16131
16172
  return;
16173
+ }),
16174
+ stopReason: defaultOnError(string2().nullish(), () => {
16175
+ return;
16132
16176
  })
16133
- });
16177
+ })), "stopReason", [
16178
+ "cancelled",
16179
+ "end_turn",
16180
+ "error",
16181
+ "max_tokens",
16182
+ "max_turn_requests",
16183
+ "refusal"
16184
+ ]), "stopReason");
16134
16185
  var zRequiresActionStateUpdate = object({
16135
16186
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
16136
16187
  return;
@@ -16730,8 +16781,8 @@ var zMcpServer = preserveCustomPayload(union([
16730
16781
  ]), "type", ["acp", "http", "stdio"]);
16731
16782
  var zNewSessionRequest = object({
16732
16783
  cwd: zAbsolutePath,
16733
- additionalDirectories: defaultOnError(vecSkipError(zAbsolutePath).optional(), () => []),
16734
- mcpServers: defaultOnError(vecSkipError(zMcpServer).optional(), () => []),
16784
+ additionalDirectories: array(zAbsolutePath).optional(),
16785
+ mcpServers: array(zMcpServer).optional(),
16735
16786
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
16736
16787
  return;
16737
16788
  })
@@ -16752,8 +16803,8 @@ var zDeleteSessionRequest = object({
16752
16803
  var zForkSessionRequest = object({
16753
16804
  sessionId: zSessionId,
16754
16805
  cwd: zAbsolutePath,
16755
- additionalDirectories: defaultOnError(vecSkipError(zAbsolutePath).optional(), () => []),
16756
- mcpServers: defaultOnError(vecSkipError(zMcpServer).optional(), () => []),
16806
+ additionalDirectories: array(zAbsolutePath).optional(),
16807
+ mcpServers: array(zMcpServer).optional(),
16757
16808
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
16758
16809
  return;
16759
16810
  })
@@ -16777,11 +16828,9 @@ var zReplayFrom = preserveCustomPayload(union([
16777
16828
  var zResumeSessionRequest = object({
16778
16829
  sessionId: zSessionId,
16779
16830
  cwd: zAbsolutePath,
16780
- additionalDirectories: defaultOnError(vecSkipError(zAbsolutePath).optional(), () => []),
16781
- mcpServers: defaultOnError(vecSkipError(zMcpServer).optional(), () => []),
16782
- replayFrom: defaultOnError(zReplayFrom.nullish(), () => {
16783
- return;
16784
- }),
16831
+ additionalDirectories: array(zAbsolutePath).optional(),
16832
+ mcpServers: array(zMcpServer).optional(),
16833
+ replayFrom: zReplayFrom.nullish(),
16785
16834
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
16786
16835
  return;
16787
16836
  })
@@ -17093,7 +17142,7 @@ var zDidChangeDocumentNotification = object({
17093
17142
  sessionId: zSessionId,
17094
17143
  uri: url(),
17095
17144
  version: number2(),
17096
- contentChanges: requiredDefaultOnError(vecSkipError(zTextDocumentContentChangeEvent), () => []),
17145
+ contentChanges: array(zTextDocumentContentChangeEvent),
17097
17146
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
17098
17147
  return;
17099
17148
  })
@@ -17186,15 +17235,21 @@ function tagOf(value, key) {
17186
17235
  return typeof value === "object" && value !== null ? value[key] : undefined;
17187
17236
  }
17188
17237
  var zGuardRequestPermissionSubjectToolCall = zToolCallPermissionSubject.and(object({ type: literal("tool_call") }));
17189
- var zGuardRequestPermissionSubjectCommand = zCommandPermissionSubject.and(object({ type: literal("command") }));
17238
+ var zGuardRequestPermissionSubjectCommand = zCommandPermissionSubject.and(object({
17239
+ toolCallId: zToolCallId.nullish(),
17240
+ terminalId: zTerminalId.nullish()
17241
+ })).and(object({ type: literal("command") }));
17190
17242
  var zGuardToolCallContentContent = zContent.and(object({ type: literal("content") }));
17191
- var zGuardToolCallContentDiff = zDiff.and(object({ type: literal("diff") }));
17243
+ var zGuardToolCallContentDiff = zDiff.and(object({ patch: zDiffPatch.nullish() })).and(object({ type: literal("diff") }));
17192
17244
  var zGuardToolCallContentTerminal = zTerminal.and(object({ type: literal("terminal") }));
17193
- var zGuardContentBlockText = zTextContent.and(object({ type: literal("text") }));
17194
- var zGuardContentBlockImage = zImageContent.and(object({ type: literal("image") }));
17195
- var zGuardContentBlockAudio = zAudioContent.and(object({ type: literal("audio") }));
17196
- var zGuardContentBlockResourceLink = zResourceLink.and(object({ type: literal("resource_link") }));
17197
- var zGuardContentBlockResource = zEmbeddedResource.and(object({ type: literal("resource") }));
17245
+ var zGuardContentBlockText = zTextContent.and(object({ annotations: zAnnotations.nullish() })).and(object({ type: literal("text") }));
17246
+ var zGuardContentBlockImage = zImageContent.and(object({ annotations: zAnnotations.nullish() })).and(object({ type: literal("image") }));
17247
+ var zGuardContentBlockAudio = zAudioContent.and(object({ annotations: zAnnotations.nullish() })).and(object({ type: literal("audio") }));
17248
+ var zGuardContentBlockResourceLink = zResourceLink.and(object({
17249
+ mimeType: zMediaType.nullish(),
17250
+ annotations: zAnnotations.nullish()
17251
+ })).and(object({ type: literal("resource_link") }));
17252
+ var zGuardContentBlockResource = zEmbeddedResource.and(object({ annotations: zAnnotations.nullish() })).and(object({ type: literal("resource") }));
17198
17253
  var zGuardDiffChangeAdd = zDiffPathChange.and(object({ operation: literal("add") }));
17199
17254
  var zGuardDiffChangeDelete = zDiffPathChange.and(object({ operation: literal("delete") }));
17200
17255
  var zGuardDiffChangeModify = zDiffPathChange.and(object({ operation: literal("modify") }));
@@ -17222,7 +17277,7 @@ var zGuardSessionConfigOptionCustom = object({
17222
17277
  name: string2()
17223
17278
  });
17224
17279
  var zGuardAvailableCommandInputText = zTextCommandInput.and(object({ type: literal("text") }));
17225
- var zGuardNesSuggestionEdit = zNesEditSuggestion.and(object({ kind: literal("edit") }));
17280
+ var zGuardNesSuggestionEdit = zNesEditSuggestion.and(object({ cursorPosition: zPosition.nullish() })).and(object({ kind: literal("edit") }));
17226
17281
  var zGuardNesSuggestionJump = zNesJumpSuggestion.and(object({ kind: literal("jump") }));
17227
17282
  var zGuardNesSuggestionRename = zNesRenameSuggestion.and(object({ kind: literal("rename") }));
17228
17283
  var zGuardNesSuggestionSearchAndReplace = zNesSearchAndReplaceSuggestion.and(object({ kind: literal("searchAndReplace") }));
@@ -17237,23 +17292,56 @@ var zGuardSessionUpdateAgentThoughtChunk = zContentChunk.and(object({ sessionUpd
17237
17292
  var zGuardSessionUpdateAgentThought = zAgentThought.and(object({ sessionUpdate: literal("agent_thought") }));
17238
17293
  var zGuardSessionUpdateStateUpdate = zStateUpdate.and(object({ sessionUpdate: literal("state_update") }));
17239
17294
  var zGuardSessionUpdateToolCallContentChunk = zToolCallContentChunk.and(object({ sessionUpdate: literal("tool_call_content_chunk") }));
17240
- var zGuardSessionUpdateToolCallUpdate = zToolCallUpdate.and(object({ sessionUpdate: literal("tool_call_update") }));
17241
- var zGuardSessionUpdateTerminalUpdate = zTerminalUpdate.and(object({ sessionUpdate: literal("terminal_update") }));
17295
+ var zGuardSessionUpdateToolCallUpdate = zToolCallUpdate.and(object({
17296
+ kind: zToolKind.nullish(),
17297
+ status: zToolCallStatus.nullish()
17298
+ })).and(object({ sessionUpdate: literal("tool_call_update") }));
17299
+ var zGuardSessionUpdateTerminalUpdate = zTerminalUpdate.and(object({
17300
+ cwd: zAbsolutePath.nullish(),
17301
+ output: zTerminalOutput.nullish(),
17302
+ exitStatus: zTerminalExitStatus.nullish()
17303
+ })).and(object({ sessionUpdate: literal("terminal_update") }));
17242
17304
  var zGuardSessionUpdateTerminalOutputChunk = zTerminalOutputChunk.and(object({ sessionUpdate: literal("terminal_output_chunk") }));
17243
17305
  var zGuardSessionUpdatePlanUpdate = zPlanUpdate.and(object({ sessionUpdate: literal("plan_update") }));
17244
17306
  var zGuardSessionUpdatePlanRemoved = zPlanRemoved.and(object({ sessionUpdate: literal("plan_removed") }));
17245
17307
  var zGuardSessionUpdateAvailableCommandsUpdate = zAvailableCommandsUpdate.and(object({ sessionUpdate: literal("available_commands_update") }));
17246
17308
  var zGuardSessionUpdateConfigOptionUpdate = zConfigOptionUpdate.and(object({ sessionUpdate: literal("config_option_update") }));
17247
17309
  var zGuardSessionUpdateSessionInfoUpdate = zSessionInfoUpdate.and(object({ sessionUpdate: literal("session_info_update") }));
17248
- var zGuardSessionUpdateUsageUpdate = zUsageUpdate.and(object({ sessionUpdate: literal("usage_update") }));
17310
+ var zGuardSessionUpdateUsageUpdate = zUsageUpdate.and(object({ cost: zCost.nullish() })).and(object({ sessionUpdate: literal("usage_update") }));
17249
17311
  var zGuardSessionUpdateNotice = zNotice.and(object({ sessionUpdate: literal("notice") }));
17250
17312
  var zGuardSessionUpdateCompactionUpdate = zCompactionUpdate.and(object({ sessionUpdate: literal("compaction_update") }));
17251
17313
  var zGuardSessionUpdateCompactionSummaryChunk = zCompactionSummaryChunk.and(object({ sessionUpdate: literal("compaction_summary_chunk") }));
17252
- var zGuardSessionUpdateSubagentUpdate = zSubagentUpdate.and(object({ sessionUpdate: literal("subagent_update") }));
17253
- var zGuardSessionUpdateSessionMessage = zSessionMessage.and(object({ sessionUpdate: literal("session_message") }));
17254
- var zGuardSessionUpdateSessionMessageChunk = zSessionMessageChunk.and(object({ sessionUpdate: literal("session_message_chunk") }));
17314
+ var zGuardSessionUpdateSubagentUpdate = zSubagentUpdate.and(object({
17315
+ capabilities: zSubagentSessionCapabilities.nullish(),
17316
+ state: zStateUpdate.nullish()
17317
+ })).and(object({ sessionUpdate: literal("subagent_update") }));
17318
+ var zGuardSessionUpdateSessionMessage = zSessionMessage.and(object({
17319
+ senderSessionId: zSessionId.nullish(),
17320
+ recipientSessionId: zSessionId.nullish()
17321
+ })).and(object({ sessionUpdate: literal("session_message") }));
17322
+ var zGuardSessionUpdateSessionMessageChunk = zSessionMessageChunk.and(object({
17323
+ senderSessionId: zSessionId.nullish(),
17324
+ recipientSessionId: zSessionId.nullish()
17325
+ })).and(object({ sessionUpdate: literal("session_message_chunk") }));
17326
+ var zGuardIdleStateUpdateEndTurn = object({
17327
+ stopReason: literal("end_turn")
17328
+ });
17329
+ var zGuardIdleStateUpdateMaxTokens = object({
17330
+ stopReason: literal("max_tokens")
17331
+ });
17332
+ var zGuardIdleStateUpdateMaxTurnRequests = object({
17333
+ stopReason: literal("max_turn_requests")
17334
+ });
17335
+ var zGuardIdleStateUpdateRefusal = object({
17336
+ stopReason: literal("refusal")
17337
+ });
17338
+ var zGuardIdleStateUpdateCancelled = object({
17339
+ stopReason: literal("cancelled")
17340
+ });
17341
+ var zGuardIdleStateUpdateError = zErrorStopReason.and(object({ error: zError.nullish() })).and(object({ stopReason: literal("error") }));
17342
+ var zGuardIdleStateUpdateNone = object({ stopReason: _null3().optional() });
17255
17343
  var zGuardStateUpdateRunning = zRunningStateUpdate.and(object({ state: literal("running") }));
17256
- var zGuardStateUpdateIdle = zIdleStateUpdate.and(object({ state: literal("idle") }));
17344
+ var zGuardStateUpdateIdle = zIdleStateUpdate.and(object({ usage: zUsage.nullish() })).and(object({ state: literal("idle") }));
17257
17345
  var zGuardStateUpdateRequiresAction = zRequiresActionStateUpdate.and(object({ state: literal("requires_action") }));
17258
17346
  var zGuardStateUpdateUnknown = zUnknownStateUpdate.and(object({ state: literal("unknown") }));
17259
17347
  var zGuardPlanUpdateContentItems = zPlanItems.and(object({ type: literal("items") }));
@@ -18458,16 +18546,12 @@ var zWriteTextFileRequest = object({
18458
18546
  var zReadTextFileRequest = object({
18459
18547
  sessionId: zSessionId2,
18460
18548
  path: string2(),
18461
- line: defaultOnError(int().gte(0).max(4294967295, {
18549
+ line: int().gte(0).max(4294967295, {
18462
18550
  error: "Invalid value: Expected uint32 to be <= 4294967295"
18463
- }).nullish(), () => {
18464
- return;
18465
- }),
18466
- limit: defaultOnError(int().gte(0).max(4294967295, {
18551
+ }).nullish(),
18552
+ limit: int().gte(0).max(4294967295, {
18467
18553
  error: "Invalid value: Expected uint32 to be <= 4294967295"
18468
- }).nullish(), () => {
18469
- return;
18470
- }),
18554
+ }).nullish(),
18471
18555
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
18472
18556
  return;
18473
18557
  })
@@ -18718,14 +18802,10 @@ var zEnvVariable2 = object({
18718
18802
  var zCreateTerminalRequest = object({
18719
18803
  sessionId: zSessionId2,
18720
18804
  command: string2(),
18721
- args: defaultOnError(vecSkipError(string2()).optional(), () => []),
18722
- env: defaultOnError(vecSkipError(zEnvVariable2).optional(), () => []),
18723
- cwd: defaultOnError(string2().nullish(), () => {
18724
- return;
18725
- }),
18726
- outputByteLimit: defaultOnError(number2().nullish(), () => {
18727
- return;
18728
- }),
18805
+ args: array(string2()).optional(),
18806
+ env: array(zEnvVariable2).optional(),
18807
+ cwd: string2().nullish(),
18808
+ outputByteLimit: number2().nullish(),
18729
18809
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
18730
18810
  return;
18731
18811
  })
@@ -19251,10 +19331,8 @@ var zAuthMethodTerminal2 = object({
19251
19331
  description: defaultOnError(string2().nullish(), () => {
19252
19332
  return;
19253
19333
  }),
19254
- args: defaultOnError(vecSkipError(string2()).optional(), () => []),
19255
- env: defaultOnError(record(string2(), string2()).optional(), () => {
19256
- return;
19257
- }),
19334
+ args: array(string2()).optional(),
19335
+ env: record(string2(), string2()).optional(),
19258
19336
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
19259
19337
  return;
19260
19338
  })
@@ -19542,7 +19620,7 @@ var zSetSessionConfigOptionResponse2 = object({
19542
19620
  return;
19543
19621
  })
19544
19622
  });
19545
- var zStopReason2 = union([
19623
+ var zStopReason = union([
19546
19624
  literal("end_turn"),
19547
19625
  literal("max_tokens"),
19548
19626
  literal("max_turn_requests"),
@@ -19567,7 +19645,7 @@ var zUsage2 = object({
19567
19645
  })
19568
19646
  });
19569
19647
  var zPromptResponse2 = object({
19570
- stopReason: zStopReason2,
19648
+ stopReason: zStopReason,
19571
19649
  usage: defaultOnError(zUsage2.nullish(), () => {
19572
19650
  return;
19573
19651
  }),
@@ -19952,17 +20030,61 @@ var zRunningStateUpdate2 = object({
19952
20030
  return;
19953
20031
  })
19954
20032
  });
19955
- var zIdleStateUpdate2 = object({
19956
- stopReason: defaultOnError(zStopReason2.nullish(), () => {
20033
+ var zErrorStopReason2 = object({
20034
+ error: defaultOnError(zError2.nullish(), () => {
19957
20035
  return;
20036
+ })
20037
+ });
20038
+ var zIdleStateUpdate2 = defaultOnErrorOptionalStringTag(preserveCustomPayload(intersection(union([
20039
+ object({
20040
+ stopReason: literal("end_turn")
20041
+ }),
20042
+ object({
20043
+ stopReason: literal("max_tokens")
19958
20044
  }),
20045
+ object({
20046
+ stopReason: literal("max_turn_requests")
20047
+ }),
20048
+ object({
20049
+ stopReason: literal("refusal")
20050
+ }),
20051
+ object({
20052
+ stopReason: literal("cancelled")
20053
+ }),
20054
+ zErrorStopReason2.and(object({
20055
+ stopReason: literal("error")
20056
+ })),
20057
+ excludeKnownTags(object({
20058
+ stopReason: string2()
20059
+ }), "stopReason", [
20060
+ "cancelled",
20061
+ "end_turn",
20062
+ "error",
20063
+ "max_tokens",
20064
+ "max_turn_requests",
20065
+ "refusal"
20066
+ ]),
20067
+ object({
20068
+ stopReason: _null3().optional()
20069
+ })
20070
+ ]), object({
19959
20071
  usage: defaultOnError(zUsage2.nullish(), () => {
19960
20072
  return;
19961
20073
  }),
19962
20074
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
19963
20075
  return;
20076
+ }),
20077
+ stopReason: defaultOnError(string2().nullish(), () => {
20078
+ return;
19964
20079
  })
19965
- });
20080
+ })), "stopReason", [
20081
+ "cancelled",
20082
+ "end_turn",
20083
+ "error",
20084
+ "max_tokens",
20085
+ "max_turn_requests",
20086
+ "refusal"
20087
+ ]), "stopReason");
19966
20088
  var zRequiresActionStateUpdate2 = object({
19967
20089
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
19968
20090
  return;
@@ -20345,16 +20467,16 @@ var zMcpServer2 = union([
20345
20467
  ]);
20346
20468
  var zNewSessionRequest2 = object({
20347
20469
  cwd: string2(),
20348
- additionalDirectories: defaultOnError(vecSkipError(string2()).optional(), () => []),
20349
- mcpServers: requiredDefaultOnError(vecSkipError(zMcpServer2), () => []),
20470
+ additionalDirectories: array(string2()).optional(),
20471
+ mcpServers: array(zMcpServer2),
20350
20472
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
20351
20473
  return;
20352
20474
  })
20353
20475
  });
20354
20476
  var zLoadSessionRequest = object({
20355
- mcpServers: requiredDefaultOnError(vecSkipError(zMcpServer2), () => []),
20477
+ mcpServers: array(zMcpServer2),
20356
20478
  cwd: string2(),
20357
- additionalDirectories: defaultOnError(vecSkipError(string2()).optional(), () => []),
20479
+ additionalDirectories: array(string2()).optional(),
20358
20480
  sessionId: zSessionId2,
20359
20481
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
20360
20482
  return;
@@ -20376,8 +20498,8 @@ var zDeleteSessionRequest2 = object({
20376
20498
  var zForkSessionRequest2 = object({
20377
20499
  sessionId: zSessionId2,
20378
20500
  cwd: string2(),
20379
- additionalDirectories: defaultOnError(vecSkipError(string2()).optional(), () => []),
20380
- mcpServers: defaultOnError(vecSkipError(zMcpServer2).optional(), () => []),
20501
+ additionalDirectories: array(string2()).optional(),
20502
+ mcpServers: array(zMcpServer2).optional(),
20381
20503
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
20382
20504
  return;
20383
20505
  })
@@ -20385,8 +20507,8 @@ var zForkSessionRequest2 = object({
20385
20507
  var zResumeSessionRequest2 = object({
20386
20508
  sessionId: zSessionId2,
20387
20509
  cwd: string2(),
20388
- additionalDirectories: defaultOnError(vecSkipError(string2()).optional(), () => []),
20389
- mcpServers: defaultOnError(vecSkipError(zMcpServer2).optional(), () => []),
20510
+ additionalDirectories: array(string2()).optional(),
20511
+ mcpServers: array(zMcpServer2).optional(),
20390
20512
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
20391
20513
  return;
20392
20514
  })
@@ -20767,7 +20889,7 @@ var zDidChangeDocumentNotification2 = object({
20767
20889
  sessionId: zSessionId2,
20768
20890
  uri: string2(),
20769
20891
  version: number2(),
20770
- contentChanges: requiredDefaultOnError(vecSkipError(zTextDocumentContentChangeEvent2), () => []),
20892
+ contentChanges: array(zTextDocumentContentChangeEvent2),
20771
20893
  _meta: defaultOnError(record(string2(), unknown()).nullish(), () => {
20772
20894
  return;
20773
20895
  })
@@ -22046,7 +22168,7 @@ var package_default = {
22046
22168
  publishConfig: {
22047
22169
  access: "public"
22048
22170
  },
22049
- version: "0.7.6",
22171
+ version: "0.7.8",
22050
22172
  description: "Native ACP v2 agent for the OpenAI Codex app-server",
22051
22173
  packageManager: "bun@1.4.0",
22052
22174
  engines: {
@@ -22112,7 +22234,7 @@ var package_default = {
22112
22234
  vitest: "^4.1.11"
22113
22235
  },
22114
22236
  dependencies: {
22115
- "@agentclientprotocol/sdk": "^1.7.0",
22237
+ "@agentclientprotocol/sdk": "^1.8.0",
22116
22238
  diff: "^9.0.0",
22117
22239
  open: "^11.0.2",
22118
22240
  "vscode-jsonrpc": "^9.0.2"
@@ -22263,7 +22385,7 @@ class ClientTools {
22263
22385
 
22264
22386
  // src/agent/turnErrors.ts
22265
22387
  function classifyTurnError(info) {
22266
- const failure2 = (category, retryable = false, stopReason = "_error") => ({ category, retryable, stopReason });
22388
+ const failure2 = (category, retryable = false, stopReason = "error") => ({ category, retryable, stopReason });
22267
22389
  if (info === null)
22268
22390
  return failure2("unknown");
22269
22391
  if (typeof info === "object") {
@@ -26581,13 +26703,27 @@ class ClientSession {
26581
26703
  this.terminalAttempted = true;
26582
26704
  this.turnActive = false;
26583
26705
  this.waiting = 0;
26584
- await this.update(this.correlated({
26585
- sessionUpdate: "state_update",
26586
- state: "idle",
26587
- stopReason,
26706
+ const details = {
26588
26707
  ...extra?.usage === undefined ? {} : { usage: extra.usage },
26589
26708
  ...extra?._meta === undefined ? {} : { _meta: extra._meta }
26590
- }));
26709
+ };
26710
+ const idle = (() => {
26711
+ switch (stopReason) {
26712
+ case "error":
26713
+ return { stopReason, ...details, ...extra?.error === undefined ? {} : { error: extra.error } };
26714
+ case "end_turn":
26715
+ return { stopReason, ...details };
26716
+ case "cancelled":
26717
+ return { stopReason, ...details };
26718
+ case "max_tokens":
26719
+ return { stopReason, ...details };
26720
+ case "max_turn_requests":
26721
+ return { stopReason, ...details };
26722
+ case "refusal":
26723
+ return { stopReason, ...details };
26724
+ }
26725
+ })();
26726
+ await this.update(this.correlated({ sessionUpdate: "state_update", state: "idle", ...idle }));
26591
26727
  }
26592
26728
  correlated(update) {
26593
26729
  if (this.messageId === undefined)
@@ -26888,6 +27024,255 @@ function firstLine(text2) {
26888
27024
  return line.length > 120 ? `${line.slice(0, 117)}...` : line;
26889
27025
  }
26890
27026
 
27027
+ // src/agent/historyProtocol.ts
27028
+ import { createHash } from "crypto";
27029
+ function historyError(reason, message, retryable, extra = {}, code = -32600) {
27030
+ return new RequestError(code, message, { reason, retryable, ...extra });
27031
+ }
27032
+ function invalid(message) {
27033
+ throw historyError("history_invalid_params", message, false, {}, -32602);
27034
+ }
27035
+ function parse5(raw, items) {
27036
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
27037
+ invalid("History params must be an object");
27038
+ const p = raw;
27039
+ const allowed = new Set(["sessionId", "cursor", "limit", "mode", "sortDirection", "maxBytes", "includeNative", "_meta", ...items ? ["turnId", "anchorItemId"] : ["itemsView"]]);
27040
+ for (const key of Object.keys(p))
27041
+ if (!allowed.has(key))
27042
+ invalid(`Unknown history parameter: ${key}`);
27043
+ if (typeof p["sessionId"] !== "string" || !p["sessionId"].trim())
27044
+ invalid("sessionId must be a non-empty string");
27045
+ if (p["cursor"] != null && (typeof p["cursor"] !== "string" || !p["cursor"] || p["cursor"].length > 65536))
27046
+ invalid("cursor must be a non-empty history cursor or null");
27047
+ for (const [key, min, max] of [["limit", 1, 100], ["maxBytes", 1024, 16 * 1024 * 1024]]) {
27048
+ if (p[key] !== undefined && (typeof p[key] !== "number" || !Number.isInteger(p[key]) || p[key] < min || p[key] > max))
27049
+ invalid(`${key} must be an integer between ${min} and ${max}`);
27050
+ }
27051
+ if (p["mode"] !== undefined && p["mode"] !== "browse" && p["mode"] !== "export")
27052
+ invalid("mode must be browse or export");
27053
+ if (p["sortDirection"] !== undefined && p["sortDirection"] !== "asc" && p["sortDirection"] !== "desc")
27054
+ invalid("sortDirection must be asc or desc");
27055
+ if (p["includeNative"] !== undefined && typeof p["includeNative"] !== "boolean")
27056
+ invalid("includeNative must be a boolean");
27057
+ if (!items && p["itemsView"] !== undefined && p["itemsView"] !== "summary" && p["itemsView"] !== "full")
27058
+ invalid("itemsView must be summary or full");
27059
+ if (!items && p["includeNative"] === true && p["itemsView"] !== "full")
27060
+ invalid("includeNative requires itemsView: full; use the items endpoint for details");
27061
+ for (const key of ["turnId", "anchorItemId"]) {
27062
+ if (p[key] !== undefined && (typeof p[key] !== "string" || !p[key].trim()))
27063
+ invalid(`${key} must be a non-empty string`);
27064
+ }
27065
+ if (p["anchorItemId"] !== undefined && (p["turnId"] === undefined || p["cursor"] != null))
27066
+ invalid("anchorItemId requires turnId and cannot be combined with cursor");
27067
+ return p;
27068
+ }
27069
+ function parseSessionHistoryParams(raw) {
27070
+ return parse5(raw, false);
27071
+ }
27072
+ function parseSessionHistoryItemsParams(raw) {
27073
+ return parse5(raw, true);
27074
+ }
27075
+ function sourceError(error40) {
27076
+ if (error40 instanceof RequestError)
27077
+ return error40;
27078
+ const e = error40 && typeof error40 === "object" ? error40 : {};
27079
+ const message = error40 instanceof Error ? error40.message : String(error40);
27080
+ const native = { code: e["code"] ?? null, data: e["data"] ?? null };
27081
+ const code = typeof e["code"] === "number" ? e["code"] : -32603;
27082
+ if (/thread not found|no rollout found for thread|unknown thread/i.test(message))
27083
+ return historyError("history_not_found", message, false, { native }, code);
27084
+ if (code === -32602 && /cursor/i.test(message))
27085
+ return historyError("history_invalid_cursor", message, false, { native }, code);
27086
+ if (code === -32602)
27087
+ return historyError("history_invalid_params", message, false, { native }, code);
27088
+ if (code === -32601)
27089
+ return historyError("history_unsupported", message, false, { native }, code);
27090
+ if (["ECONNRESET", "EPIPE", "ETIMEDOUT", "ECONNREFUSED"].includes(String(e["code"])))
27091
+ return historyError("history_unavailable", message, true, { native }, code);
27092
+ return historyError("history_source_error", message, null, { native }, code);
27093
+ }
27094
+
27095
+ class HistoryRead {
27096
+ codex;
27097
+ params;
27098
+ signal;
27099
+ direction;
27100
+ mode;
27101
+ after;
27102
+ binding;
27103
+ previous;
27104
+ constructor(codex, params, scope, signal) {
27105
+ this.codex = codex;
27106
+ this.params = params;
27107
+ this.signal = signal;
27108
+ this.direction = params.sortDirection ?? "asc";
27109
+ this.mode = params.mode ?? "browse";
27110
+ this.binding = JSON.stringify({ sessionId: params.sessionId, mode: this.mode, sortDirection: this.direction, includeNative: params.includeNative ?? false, ...scope });
27111
+ this.previous = this.decode(params.cursor);
27112
+ this.after = this.previous?.after ?? null;
27113
+ }
27114
+ decode(raw) {
27115
+ if (raw == null)
27116
+ return null;
27117
+ try {
27118
+ const v = JSON.parse(Buffer.from(raw, "base64url").toString("utf8"));
27119
+ if (!v || v.version !== 2 || v.binding !== this.binding || typeof v.after !== "string" || !v.after || (this.mode === "browse" ? v.revision !== null : typeof v.revision !== "string" || !/^[a-f0-9]{64}$/.test(v.revision)))
27120
+ throw new Error("cursor mismatch");
27121
+ return v;
27122
+ } catch {
27123
+ throw historyError("history_invalid_cursor", "Invalid history cursor or changed query options; restart without a cursor", false, {}, -32602);
27124
+ }
27125
+ }
27126
+ async call(operation) {
27127
+ const check2 = () => {
27128
+ if (this.signal?.aborted)
27129
+ throw historyError("history_cancelled", "History request cancelled", false);
27130
+ };
27131
+ check2();
27132
+ try {
27133
+ const result = this.signal ? await abortable(operation(), this.signal) : await operation();
27134
+ check2();
27135
+ return result;
27136
+ } catch (error40) {
27137
+ check2();
27138
+ throw sourceError(error40);
27139
+ }
27140
+ }
27141
+ async start() {
27142
+ const boundary = await this.boundary();
27143
+ if (this.previous && this.previous.revision !== boundary.revision)
27144
+ this.changed();
27145
+ return boundary;
27146
+ }
27147
+ async boundary() {
27148
+ const { thread } = await this.call(() => this.codex.threadRead({ threadId: this.params.sessionId, includeTurns: false }));
27149
+ if (this.mode === "browse")
27150
+ return { thread, revision: null };
27151
+ if (thread.status.type === "active")
27152
+ this.busy();
27153
+ if (thread.status.type === "systemError")
27154
+ throw historyError("history_unavailable", "Codex reports a session error; retry when it is resolved", true);
27155
+ const tail = await this.call(() => this.codex.threadTurnsList({ threadId: this.params.sessionId, limit: 1, sortDirection: "desc", itemsView: "summary" }));
27156
+ this.checkTurns(tail.data);
27157
+ const revision = createHash("sha256").update(JSON.stringify({ id: thread.id, cwd: thread.cwd, name: thread.name, preview: thread.preview, createdAt: thread.createdAt, updatedAt: thread.updatedAt, forkedFromId: thread.forkedFromId, tail: tail.data[0] ?? null })).digest("hex");
27158
+ return { thread, revision };
27159
+ }
27160
+ checkTurns(turns) {
27161
+ if (this.mode === "export" && turns.some((turn) => turn.status === "inProgress"))
27162
+ this.busy();
27163
+ }
27164
+ busy() {
27165
+ throw historyError("history_busy", "Session history is still running; retry after the turn finishes", true);
27166
+ }
27167
+ changed() {
27168
+ throw historyError("history_changed", "Session history changed; discard collected pages and restart without a cursor", true);
27169
+ }
27170
+ async finish(start, next, count) {
27171
+ if (next !== null && (!next || next === this.after || count === 0))
27172
+ throw historyError("history_invalid_page", "Codex history pagination made no progress; restart the read", false, {}, -32603);
27173
+ if (this.mode === "export" && start.revision !== (await this.boundary()).revision)
27174
+ this.changed();
27175
+ const nextCursor = next === null ? null : Buffer.from(JSON.stringify({ version: 2, binding: this.binding, revision: start.revision, after: next })).toString("base64url");
27176
+ const t = start.thread;
27177
+ return { sessionId: this.params.sessionId, cwd: t.cwd, title: t.name?.trim() || t.preview.trim() || null, createdAt: t.createdAt, updatedAt: t.updatedAt, forkedFromId: t.forkedFromId, running: t.status.type === "active" ? true : t.status.type === "idle" ? false : null, revision: start.revision, consistency: this.mode === "export" ? "optimistic" : "live", nextCursor, complete: nextCursor === null };
27178
+ }
27179
+ bounded(page) {
27180
+ const bytes = Buffer.byteLength(JSON.stringify(page));
27181
+ const maxBytes = this.params.maxBytes ?? 1024 * 1024;
27182
+ if (bytes > maxBytes)
27183
+ throw historyError("history_page_too_large", "History page exceeds maxBytes; retry the same cursor with a smaller limit or larger maxBytes, or start a new summary/item traversal", true, { bytes, maxBytes }, -32600);
27184
+ return page;
27185
+ }
27186
+ }
27187
+
27188
+ // src/agent/historyProjection.ts
27189
+ import { pathToFileURL as pathToFileURL2 } from "url";
27190
+ function inputBlock(input) {
27191
+ switch (input.type) {
27192
+ case "text":
27193
+ return { type: "text", text: input.text, ...input.text_elements.length ? { _meta: { codex: { textElements: input.text_elements } } } : {} };
27194
+ case "image":
27195
+ return { type: "resource_link", name: "Image", uri: "url" in input ? input.url : `codex-file:${encodeURIComponent(input.fileId)}`, _meta: { codex: { inputType: input.type, ...input.detail ? { detail: input.detail } : {}, ..."fileId" in input ? { fileId: input.fileId } : {} } } };
27196
+ case "audio":
27197
+ return { type: "resource_link", name: "Audio", uri: input.url, _meta: { codex: { inputType: input.type } } };
27198
+ case "localImage":
27199
+ case "localAudio":
27200
+ return { type: "resource_link", name: input.type === "localImage" ? "Image" : "Audio", uri: input.path.startsWith("file://") ? input.path : pathToFileURL2(input.path).href, _meta: { codex: { inputType: input.type, ..."detail" in input && input.detail ? { detail: input.detail } : {} } } };
27201
+ case "skill":
27202
+ case "mention":
27203
+ return { type: "resource_link", name: input.name, uri: input.path.startsWith("file://") ? input.path : pathToFileURL2(input.path).href, _meta: { codex: { inputType: input.type } } };
27204
+ }
27205
+ }
27206
+ function projectHistoryItem(item, turnId, startedAt) {
27207
+ const omissions = [];
27208
+ let updates;
27209
+ if (item.type === "userMessage") {
27210
+ updates = [{ sessionUpdate: "user_message", messageId: item.clientId ?? item.id, content: item.content.map(inputBlock) }];
27211
+ } else {
27212
+ updates = itemSnapshot(item);
27213
+ if (!updates.length)
27214
+ omissions.push({ itemId: item.id, field: "*", reason: "no_acp_representation" });
27215
+ if (item.type === "reasoning" && item.summary.length && item.content.length)
27216
+ omissions.push({ itemId: item.id, field: "content", reason: "summary_selected" });
27217
+ if (item.type === "agentMessage") {
27218
+ for (const field of ["memoryCitation", "delivery", "questions"]) {
27219
+ if (item[field] !== null)
27220
+ omissions.push({ itemId: item.id, field, reason: "no_acp_representation" });
27221
+ }
27222
+ }
27223
+ }
27224
+ return { updates: updates.map((update) => withTurnId(update, turnId, startedAt)), omissions };
27225
+ }
27226
+
27227
+ // src/agent/sessionHistory.ts
27228
+ async function readSessionHistory(codex, raw, signal) {
27229
+ const params = parseSessionHistoryParams(raw);
27230
+ const view = params.itemsView ?? "summary";
27231
+ const read = new HistoryRead(codex, params, { endpoint: "turns", itemsView: view }, signal);
27232
+ const start = await read.start();
27233
+ const page = await read.call(() => codex.threadTurnsList({ threadId: params.sessionId, cursor: read.after, limit: params.limit ?? 50, sortDirection: read.direction, itemsView: view }));
27234
+ read.checkTurns(page.data);
27235
+ if (view === "full" && page.data.some((turn) => turn.itemsView !== "full"))
27236
+ throw historyError("history_incomplete", "Codex did not return full history items; update Codex and retry", false, {}, -32603);
27237
+ const result = await read.finish(start, page.nextCursor, page.data.length);
27238
+ return read.bounded({ ...result, running: page.data.some((turn) => turn.status === "inProgress") ? true : result.running, turns: page.data.map((turn) => {
27239
+ const projections = view === "full" ? turn.items.map((item) => projectHistoryItem(item, turn.id, turn.startedAt)) : [];
27240
+ return {
27241
+ turnId: turn.id,
27242
+ status: turn.status,
27243
+ error: turn.error,
27244
+ startedAt: turn.startedAt,
27245
+ completedAt: turn.completedAt,
27246
+ durationMs: turn.durationMs,
27247
+ itemsView: view === "summary" ? "summary" : turn.itemsView,
27248
+ updates: projections.flatMap((p) => p.updates),
27249
+ omissions: projections.flatMap((p) => p.omissions),
27250
+ ...params.includeNative ? { _meta: { codex: { items: turn.items } } } : {}
27251
+ };
27252
+ }) });
27253
+ }
27254
+ async function readSessionHistoryItems(codex, raw, signal) {
27255
+ const params = parseSessionHistoryItemsParams(raw);
27256
+ const read = new HistoryRead(codex, params, { endpoint: "items", turnId: params.turnId ?? null }, signal);
27257
+ const start = await read.start();
27258
+ const page = await read.call(() => codex.threadItemsList({
27259
+ threadId: params.sessionId,
27260
+ turnId: params.turnId ?? null,
27261
+ cursor: read.after ?? (params.anchorItemId ? { type: "item", itemId: params.anchorItemId } : null),
27262
+ limit: params.limit ?? 50,
27263
+ sortDirection: read.direction
27264
+ }));
27265
+ const result = await read.finish(start, page.nextCursor, page.data.length);
27266
+ return read.bounded({ ...result, items: page.data.map((entry) => ({
27267
+ turnId: entry.turnId,
27268
+ itemId: entry.item.id,
27269
+ startedAtMs: entry.startedAtMs,
27270
+ completedAtMs: entry.completedAtMs,
27271
+ ...projectHistoryItem(entry.item, entry.turnId),
27272
+ ...params.includeNative ? { _meta: { codex: { item: entry.item } } } : {}
27273
+ })) });
27274
+ }
27275
+
26891
27276
  // src/agent/forkIndex.ts
26892
27277
  import { createReadStream } from "fs";
26893
27278
  import { readdir, realpath } from "fs/promises";
@@ -27117,7 +27502,7 @@ class CodexAgent {
27117
27502
  additionalDirectories: {}
27118
27503
  },
27119
27504
  providers: {},
27120
- _meta: { alwith: { tools: { version: 1 }, turns: { version: 2 } }, codex: { forkAtTurn: true, sessionLineage: true, archive: true, seedHistory: true, skills: true, plugins: true, providerCatalog: true, rename: true, account: true, fuzzyFileSearch: true } }
27505
+ _meta: { alwith: { tools: { version: 1 }, turns: { version: 2 } }, codex: { forkAtTurn: true, sessionLineage: true, archive: true, sessionHistory: { version: 2, items: true, modes: ["browse", "export"] }, seedHistory: true, skills: true, plugins: true, providerCatalog: true, rename: true, account: true, fuzzyFileSearch: true } }
27121
27506
  },
27122
27507
  authMethods: authMethods(this.capabilities, this.env)
27123
27508
  };
@@ -27669,6 +28054,7 @@ class CodexAgent {
27669
28054
  cursor,
27670
28055
  ...cwd ? { cwd } : {},
27671
28056
  sourceKinds: ["cli", "vscode", "exec", "appServer", "unknown"],
28057
+ modelProviders: [],
27672
28058
  ...archived ? { archived: true } : {}
27673
28059
  }));
27674
28060
  const response = await list(params.cursor ?? null);
@@ -27722,6 +28108,25 @@ class CodexAgent {
27722
28108
  await this.withCodex(() => this.codex.threadDelete({ threadId: params.sessionId }));
27723
28109
  return {};
27724
28110
  }
28111
+ async sessionHistory(params, signal) {
28112
+ this.requireInitialized("_codex/session_history");
28113
+ this.checkHistoryIdle(params);
28114
+ const response = await readSessionHistory(this.codex, params, signal);
28115
+ this.checkHistoryIdle(params);
28116
+ return { ...response, running: this.sessions.get(params.sessionId)?.session.activeTurn ? true : response.running };
28117
+ }
28118
+ async sessionHistoryItems(params, signal) {
28119
+ this.requireInitialized("_codex/session_history_items");
28120
+ this.checkHistoryIdle(params);
28121
+ const response = await readSessionHistoryItems(this.codex, params, signal);
28122
+ this.checkHistoryIdle(params);
28123
+ return { ...response, running: this.sessions.get(params.sessionId)?.session.activeTurn ? true : response.running };
28124
+ }
28125
+ checkHistoryIdle(params) {
28126
+ if (params.mode === "export" && this.sessions.get(params.sessionId)?.session.activeTurn) {
28127
+ throw historyError("history_busy", "Session history is still running; retry after the turn finishes", true);
28128
+ }
28129
+ }
27725
28130
  async archiveSession(params) {
27726
28131
  return await this.admission(() => this.archiveSessionInternal(params), params.sessionId);
27727
28132
  }
@@ -28188,6 +28593,7 @@ ${error40.additionalDetails}` : error40.message;
28188
28593
  _meta: { codex: { error: { ...classification, message: error40.message, codexErrorInfo: error40.codexErrorInfo, additionalDetails: error40.additionalDetails } } }
28189
28594
  });
28190
28595
  await this.reportIdle(runtime, turn, stopReason, {
28596
+ ...stopReason === "error" ? { error: { code: -32603, message, data: { codex: { ...classification, codexErrorInfo: error40.codexErrorInfo } } } } : {},
28191
28597
  usage: usageOf(runtime.session),
28192
28598
  _meta: { codex: { error: { ...classification, message: error40.message, codexErrorInfo: error40.codexErrorInfo } } }
28193
28599
  });
@@ -28526,7 +28932,7 @@ function createAgentApp(options) {
28526
28932
  };
28527
28933
  return agent({ name: options.info.name }).onConnect((connection) => {
28528
28934
  agent2 = new CodexAgent(connection.client, options);
28529
- }).onRequest(methods.agent.initialize, (ctx) => current().initialize(ctx.params)).onRequest(methods.agent.auth.login, (ctx) => current().login(ctx.params, ctx.requestId)).onRequest(methods.agent.auth.logout, (ctx) => current().logout(ctx.params)).onRequest(methods.agent.providers.list, (ctx) => current().listProviders(ctx.params)).onRequest(methods.agent.providers.set, (ctx) => current().setProvider(ctx.params)).onRequest(methods.agent.providers.disable, (ctx) => current().disableProvider(ctx.params)).onRequest(methods.agent.session.new, (ctx) => current().newSession(ctx.params, ctx.signal)).onRequest(methods.agent.session.resume, (ctx) => current().resumeSession(ctx.params, ctx.signal)).onRequest(methods.agent.session.fork, (ctx) => current().forkSession(ctx.params, ctx.signal)).onRequest(methods.agent.session.list, (ctx) => current().listSessions(ctx.params)).onRequest(methods.agent.session.close, (ctx) => current().closeSession(ctx.params)).onRequest(methods.agent.session.delete, (ctx) => current().deleteSession(ctx.params)).onRequest("_codex/session_archive", { parse: parseSessionIdParams }, (ctx) => current().archiveSession(ctx.params)).onRequest("_codex/session_unarchive", { parse: parseSessionIdParams }, (ctx) => current().unarchiveSession(ctx.params)).onRequest("_codex/skills_list", { parse: objectParams() }, (ctx) => current().skillsList(ctx.params)).onRequest("_codex/skills_config_write", { parse: objectParams() }, (ctx) => current().skillsConfigWrite(ctx.params)).onRequest("_codex/plugin_list", { parse: objectParams() }, (ctx) => current().pluginList(ctx.params)).onRequest("_codex/plugin_installed", { parse: objectParams() }, (ctx) => current().pluginInstalled(ctx.params)).onRequest("_codex/plugin_install", { parse: objectParams() }, (ctx) => current().pluginInstall(ctx.params)).onRequest("_codex/plugin_uninstall", { parse: objectParams() }, (ctx) => current().pluginUninstall(ctx.params)).onRequest("_codex/plugin_read", { parse: objectParams() }, (ctx) => current().pluginRead(ctx.params)).onRequest("_codex/marketplace_add", { parse: objectParams() }, (ctx) => current().marketplaceAdd(ctx.params)).onRequest("_codex/marketplace_remove", { parse: objectParams() }, (ctx) => current().marketplaceRemove(ctx.params)).onRequest("_codex/marketplace_upgrade", { parse: objectParams() }, (ctx) => current().marketplaceUpgrade(ctx.params)).onRequest("_codex/session_rename", { parse: parseSessionRenameParams }, (ctx) => current().sessionRename(ctx.params)).onRequest("_codex/account_read", { parse: objectParams() }, () => current().accountRead()).onRequest("_codex/rate_limits", { parse: objectParams() }, () => current().rateLimits()).onRequest("_codex/fuzzy_file_search", { parse: parseFuzzyFileSearchParams }, (ctx) => current().fuzzyFileSearch(ctx.params)).onRequest(methods.agent.session.setConfigOption, (ctx) => current().setSessionConfigOption(ctx.params)).onRequest(methods.agent.session.prompt, (ctx) => current().prompt(ctx.params)).onNotification(methods.agent.session.cancel, (ctx) => current().cancel(ctx.params));
28935
+ }).onRequest(methods.agent.initialize, (ctx) => current().initialize(ctx.params)).onRequest(methods.agent.auth.login, (ctx) => current().login(ctx.params, ctx.requestId)).onRequest(methods.agent.auth.logout, (ctx) => current().logout(ctx.params)).onRequest(methods.agent.providers.list, (ctx) => current().listProviders(ctx.params)).onRequest(methods.agent.providers.set, (ctx) => current().setProvider(ctx.params)).onRequest(methods.agent.providers.disable, (ctx) => current().disableProvider(ctx.params)).onRequest(methods.agent.session.new, (ctx) => current().newSession(ctx.params, ctx.signal)).onRequest(methods.agent.session.resume, (ctx) => current().resumeSession(ctx.params, ctx.signal)).onRequest(methods.agent.session.fork, (ctx) => current().forkSession(ctx.params, ctx.signal)).onRequest(methods.agent.session.list, (ctx) => current().listSessions(ctx.params)).onRequest(methods.agent.session.close, (ctx) => current().closeSession(ctx.params)).onRequest(methods.agent.session.delete, (ctx) => current().deleteSession(ctx.params)).onRequest("_codex/session_history", { parse: parseSessionHistoryParams }, (ctx) => current().sessionHistory(ctx.params, ctx.signal)).onRequest("_codex/session_history_items", { parse: parseSessionHistoryItemsParams }, (ctx) => current().sessionHistoryItems(ctx.params, ctx.signal)).onRequest("_codex/session_archive", { parse: parseSessionIdParams }, (ctx) => current().archiveSession(ctx.params)).onRequest("_codex/session_unarchive", { parse: parseSessionIdParams }, (ctx) => current().unarchiveSession(ctx.params)).onRequest("_codex/skills_list", { parse: objectParams() }, (ctx) => current().skillsList(ctx.params)).onRequest("_codex/skills_config_write", { parse: objectParams() }, (ctx) => current().skillsConfigWrite(ctx.params)).onRequest("_codex/plugin_list", { parse: objectParams() }, (ctx) => current().pluginList(ctx.params)).onRequest("_codex/plugin_installed", { parse: objectParams() }, (ctx) => current().pluginInstalled(ctx.params)).onRequest("_codex/plugin_install", { parse: objectParams() }, (ctx) => current().pluginInstall(ctx.params)).onRequest("_codex/plugin_uninstall", { parse: objectParams() }, (ctx) => current().pluginUninstall(ctx.params)).onRequest("_codex/plugin_read", { parse: objectParams() }, (ctx) => current().pluginRead(ctx.params)).onRequest("_codex/marketplace_add", { parse: objectParams() }, (ctx) => current().marketplaceAdd(ctx.params)).onRequest("_codex/marketplace_remove", { parse: objectParams() }, (ctx) => current().marketplaceRemove(ctx.params)).onRequest("_codex/marketplace_upgrade", { parse: objectParams() }, (ctx) => current().marketplaceUpgrade(ctx.params)).onRequest("_codex/session_rename", { parse: parseSessionRenameParams }, (ctx) => current().sessionRename(ctx.params)).onRequest("_codex/account_read", { parse: objectParams() }, () => current().accountRead()).onRequest("_codex/rate_limits", { parse: objectParams() }, () => current().rateLimits()).onRequest("_codex/fuzzy_file_search", { parse: parseFuzzyFileSearchParams }, (ctx) => current().fuzzyFileSearch(ctx.params)).onRequest(methods.agent.session.setConfigOption, (ctx) => current().setSessionConfigOption(ctx.params)).onRequest(methods.agent.session.prompt, (ctx) => current().prompt(ctx.params)).onNotification(methods.agent.session.cancel, (ctx) => current().cancel(ctx.params));
28530
28936
  }
28531
28937
 
28532
28938
  // src/codex/AppServerClient.ts
@@ -28843,6 +29249,9 @@ class AppServerClient {
28843
29249
  threadTurnsList(params) {
28844
29250
  return this.send({ method: "thread/turns/list", params });
28845
29251
  }
29252
+ threadItemsList(params) {
29253
+ return this.send({ method: "thread/items/list", params });
29254
+ }
28846
29255
  threadArchive(params) {
28847
29256
  return this.send({ method: "thread/archive", params });
28848
29257
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.7.6",
6
+ "version": "0.7.8",
7
7
  "description": "Native ACP v2 agent for the OpenAI Codex app-server",
8
8
  "packageManager": "bun@1.4.0",
9
9
  "engines": {
@@ -69,7 +69,7 @@
69
69
  "vitest": "^4.1.11"
70
70
  },
71
71
  "dependencies": {
72
- "@agentclientprotocol/sdk": "^1.7.0",
72
+ "@agentclientprotocol/sdk": "^1.8.0",
73
73
  "diff": "^9.0.0",
74
74
  "open": "^11.0.2",
75
75
  "vscode-jsonrpc": "^9.0.2"