stitchkit 0.130.1 → 0.132.0

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 (159) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/agent-executor/acp/v1-connect.d.ts +40 -26
  3. package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
  4. package/dist/agent-executor/acp/v1-driver.d.ts +10 -4
  5. package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
  6. package/dist/agent-executor/acp/v1-handlers.d.ts +6 -2
  7. package/dist/agent-executor/acp/v1-handlers.d.ts.map +1 -1
  8. package/dist/agent-executor/acp/v1-probe.d.ts +38 -0
  9. package/dist/agent-executor/acp/v1-probe.d.ts.map +1 -0
  10. package/dist/agent-executor/acp/v1-protocol.d.ts +15 -0
  11. package/dist/agent-executor/acp/v1-protocol.d.ts.map +1 -1
  12. package/dist/agent-executor/acp/v1-session.d.ts +9 -7
  13. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
  14. package/dist/agent-executor/claude/cli-driver.d.ts +7 -7
  15. package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
  16. package/dist/agent-executor/claude/limits.d.ts +6 -4
  17. package/dist/agent-executor/claude/limits.d.ts.map +1 -1
  18. package/dist/agent-executor/claude/session.d.ts +3 -3
  19. package/dist/agent-executor/claude/session.d.ts.map +1 -1
  20. package/dist/agent-executor/claude/transcript.d.ts +1 -1
  21. package/dist/agent-executor/claude/transcript.d.ts.map +1 -1
  22. package/dist/agent-executor/claude-sdk/controls.d.ts +1 -0
  23. package/dist/agent-executor/claude-sdk/controls.d.ts.map +1 -1
  24. package/dist/agent-executor/claude-sdk/driver.d.ts +51 -50
  25. package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
  26. package/dist/agent-executor/claude-sdk/probe.d.ts +3 -3
  27. package/dist/agent-executor/claude-sdk/probe.d.ts.map +1 -1
  28. package/dist/agent-executor/claude-sdk/query-loop.d.ts +2 -1
  29. package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -1
  30. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
  31. package/dist/agent-executor/codex/classify.d.ts.map +1 -1
  32. package/dist/agent-executor/codex/connect.d.ts +7 -7
  33. package/dist/agent-executor/codex/connect.d.ts.map +1 -1
  34. package/dist/agent-executor/codex/control-client.d.ts +86 -99
  35. package/dist/agent-executor/codex/control-client.d.ts.map +1 -1
  36. package/dist/agent-executor/codex/control-read-methods.d.ts +7 -0
  37. package/dist/agent-executor/codex/control-read-methods.d.ts.map +1 -0
  38. package/dist/agent-executor/codex/driver.d.ts +29 -28
  39. package/dist/agent-executor/codex/driver.d.ts.map +1 -1
  40. package/dist/agent-executor/codex/event-routing.d.ts +14 -0
  41. package/dist/agent-executor/codex/event-routing.d.ts.map +1 -0
  42. package/dist/agent-executor/codex/handlers.d.ts +2 -2
  43. package/dist/agent-executor/codex/handlers.d.ts.map +1 -1
  44. package/dist/agent-executor/codex/limits.d.ts +9 -3
  45. package/dist/agent-executor/codex/limits.d.ts.map +1 -1
  46. package/dist/agent-executor/codex/notifications.d.ts +183 -0
  47. package/dist/agent-executor/codex/notifications.d.ts.map +1 -0
  48. package/dist/agent-executor/codex/pagination.d.ts +54 -0
  49. package/dist/agent-executor/codex/pagination.d.ts.map +1 -0
  50. package/dist/agent-executor/codex/protocol.d.ts +586 -148
  51. package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
  52. package/dist/agent-executor/codex/request-answers.d.ts +4 -2
  53. package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
  54. package/dist/agent-executor/codex/responses.d.ts +855 -0
  55. package/dist/agent-executor/codex/responses.d.ts.map +1 -0
  56. package/dist/agent-executor/codex/session-bind.d.ts +410 -0
  57. package/dist/agent-executor/codex/session-bind.d.ts.map +1 -0
  58. package/dist/agent-executor/codex/session-controls.d.ts +19 -190
  59. package/dist/agent-executor/codex/session-controls.d.ts.map +1 -1
  60. package/dist/agent-executor/codex/session-types.d.ts +190 -0
  61. package/dist/agent-executor/codex/session-types.d.ts.map +1 -0
  62. package/dist/agent-executor/codex/session.d.ts +1 -1
  63. package/dist/agent-executor/codex/session.d.ts.map +1 -1
  64. package/dist/agent-executor/codex/shared-server.d.ts +4 -4
  65. package/dist/agent-executor/codex/shared-server.d.ts.map +1 -1
  66. package/dist/agent-executor/codex/shared-thread.d.ts +5 -5
  67. package/dist/agent-executor/codex/shared-thread.d.ts.map +1 -1
  68. package/dist/agent-executor/codex/thread-controls.d.ts +45 -36
  69. package/dist/agent-executor/codex/thread-controls.d.ts.map +1 -1
  70. package/dist/agent-executor/codex/thread-list-query.d.ts +5 -0
  71. package/dist/agent-executor/codex/thread-list-query.d.ts.map +1 -0
  72. package/dist/agent-executor/codex/thread-open.d.ts +20 -20
  73. package/dist/agent-executor/codex/thread-open.d.ts.map +1 -1
  74. package/dist/agent-executor/codex/turn-input.d.ts +4 -3
  75. package/dist/agent-executor/codex/turn-input.d.ts.map +1 -1
  76. package/dist/agent-executor/codex/unix-socket-target.d.ts +12 -3
  77. package/dist/agent-executor/codex/unix-socket-target.d.ts.map +1 -1
  78. package/dist/agent-executor/codex/ws-frame.d.ts +4 -1
  79. package/dist/agent-executor/codex/ws-frame.d.ts.map +1 -1
  80. package/dist/agent-executor/contract.d.ts +3 -1
  81. package/dist/agent-executor/contract.d.ts.map +1 -1
  82. package/dist/agent-executor/engine-process.d.ts +4 -4
  83. package/dist/agent-executor/engine-process.d.ts.map +1 -1
  84. package/dist/agent-executor/engine.d.ts +3 -3
  85. package/dist/agent-executor/engine.d.ts.map +1 -1
  86. package/dist/agent-executor/handoff.d.ts.map +1 -1
  87. package/dist/agent-executor/hello.d.ts +7 -0
  88. package/dist/agent-executor/hello.d.ts.map +1 -1
  89. package/dist/agent-executor/json-rpc-peer.d.ts +9 -4
  90. package/dist/agent-executor/json-rpc-peer.d.ts.map +1 -1
  91. package/dist/agent-executor/leases.d.ts +1 -1
  92. package/dist/agent-executor/leases.d.ts.map +1 -1
  93. package/dist/agent-executor/plan-limits.d.ts +12 -1
  94. package/dist/agent-executor/plan-limits.d.ts.map +1 -1
  95. package/dist/agent-executor/profile.d.ts +9 -1
  96. package/dist/agent-executor/profile.d.ts.map +1 -1
  97. package/dist/agent-executor/session-primitives.d.ts +8 -0
  98. package/dist/agent-executor/session-primitives.d.ts.map +1 -1
  99. package/dist/agent-executor/testing/consumer-stubs.d.ts +45 -0
  100. package/dist/agent-executor/testing/consumer-stubs.d.ts.map +1 -0
  101. package/dist/agent-executor/testing/fake-claude-sdk-query.d.ts +88 -0
  102. package/dist/agent-executor/testing/fake-claude-sdk-query.d.ts.map +1 -0
  103. package/dist/agent-executor/testing/fake-codex-app-server.d.ts +56 -0
  104. package/dist/agent-executor/testing/fake-codex-app-server.d.ts.map +1 -0
  105. package/dist/agent-executor/testing/fixtures.d.ts +26 -0
  106. package/dist/agent-executor/testing/fixtures.d.ts.map +1 -0
  107. package/dist/agent-executor/testing/replay-driver.d.ts +8 -8
  108. package/dist/agent-executor/testing/replay-driver.d.ts.map +1 -1
  109. package/dist/agent-executor/testing/replay-runner.d.ts +3 -2
  110. package/dist/agent-executor/testing/replay-runner.d.ts.map +1 -1
  111. package/dist/agent-executor/testing/replay-transcript.d.ts +5 -3
  112. package/dist/agent-executor/testing/replay-transcript.d.ts.map +1 -1
  113. package/dist/agent-runtime/branch-observations.d.ts +19 -19
  114. package/dist/agent-runtime/sql-rows.d.ts +10 -10
  115. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  116. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  117. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  118. package/dist/entrypoints/agent-executor/acp.d.ts +2 -1
  119. package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -1
  120. package/dist/entrypoints/agent-executor/acp.js +284 -82
  121. package/dist/entrypoints/agent-executor/claude-sdk.d.ts +4 -0
  122. package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -1
  123. package/dist/entrypoints/agent-executor/claude-sdk.js +64 -37
  124. package/dist/entrypoints/agent-executor/claude.d.ts +2 -2
  125. package/dist/entrypoints/agent-executor/claude.d.ts.map +1 -1
  126. package/dist/entrypoints/agent-executor/claude.js +29 -23
  127. package/dist/entrypoints/agent-executor/codex.d.ts +9 -5
  128. package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
  129. package/dist/entrypoints/agent-executor/codex.js +1860 -1695
  130. package/dist/entrypoints/agent-executor/testing.d.ts +4 -0
  131. package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -1
  132. package/dist/entrypoints/agent-executor/testing.js +880 -18
  133. package/dist/entrypoints/agent-executor.d.ts +3 -3
  134. package/dist/entrypoints/agent-executor.d.ts.map +1 -1
  135. package/dist/entrypoints/agent-executor.js +42 -8
  136. package/dist/entrypoints/process.js +3 -3
  137. package/dist/entrypoints/sync.js +8 -4
  138. package/dist/{index-jrn3prgm.js → index-athc412x.js} +29 -4
  139. package/dist/{index-dbp6xemn.js → index-f9p62ean.js} +219 -7
  140. package/dist/index-j15dhkda.js +749 -0
  141. package/dist/index-jcrj0b8z.js +56 -0
  142. package/dist/{index-1q0n6zek.js → index-kwsr7j5k.js} +84 -44
  143. package/dist/{index-p1qmpq0p.js → index-z114ax5e.js} +93 -57
  144. package/dist/sync/session-machine.d.ts.map +1 -1
  145. package/dist/sync/session.d.ts +3 -3
  146. package/llms/agent-executor-acp.txt +5 -5
  147. package/llms/agent-executor-claude-sdk.txt +3 -1
  148. package/llms/agent-executor-claude.txt +2 -2
  149. package/llms/agent-executor-codex.txt +11 -8
  150. package/llms/agent-executor-testing.txt +5 -1
  151. package/llms/agent-executor.txt +10 -4
  152. package/llms/stitchkit.txt +75 -74
  153. package/llms/sync.txt +1 -1
  154. package/llms/{upgrading-0.128.0-0.130.0.txt → upgrading-0.128.0-0.132.0.txt} +76 -3
  155. package/llms/upgrading.txt +1 -1
  156. package/llms-full.txt +185 -96
  157. package/llms.txt +8 -8
  158. package/package.json +3 -3
  159. package/dist/index-2s8sy57y.js +0 -229
@@ -0,0 +1,183 @@
1
+ import { z } from 'zod';
2
+ import type { CodexNotificationEvent } from './handlers.js';
3
+ /**
4
+ * Zod schemas for typed Codex app-server notifications, covering both delta-producing
5
+ * notifications and quiet lifecycle notifications (`thread/status/changed`, `turn/started`,
6
+ * `item/plan/delta`, `thread/settings/updated`, `model/rerouted`).
7
+ */
8
+ export declare const CodexNotificationParams: {
9
+ readonly 'item/agentMessage/delta': z.ZodObject<{
10
+ threadId: z.ZodOptional<z.ZodString>;
11
+ turnId: z.ZodOptional<z.ZodString>;
12
+ itemId: z.ZodString;
13
+ delta: z.ZodString;
14
+ }, z.core.$loose>;
15
+ readonly 'item/reasoning/textDelta': z.ZodObject<{
16
+ threadId: z.ZodOptional<z.ZodString>;
17
+ turnId: z.ZodOptional<z.ZodString>;
18
+ itemId: z.ZodString;
19
+ delta: z.ZodString;
20
+ }, z.core.$loose>;
21
+ readonly 'item/reasoning/summaryTextDelta': z.ZodObject<{
22
+ threadId: z.ZodOptional<z.ZodString>;
23
+ turnId: z.ZodOptional<z.ZodString>;
24
+ itemId: z.ZodString;
25
+ delta: z.ZodString;
26
+ summaryIndex: z.ZodOptional<z.ZodNumber>;
27
+ }, z.core.$loose>;
28
+ readonly 'item/plan/delta': z.ZodObject<{
29
+ threadId: z.ZodOptional<z.ZodString>;
30
+ turnId: z.ZodOptional<z.ZodString>;
31
+ itemId: z.ZodString;
32
+ delta: z.ZodString;
33
+ }, z.core.$loose>;
34
+ readonly 'item/started': z.ZodObject<{
35
+ threadId: z.ZodOptional<z.ZodString>;
36
+ turnId: z.ZodOptional<z.ZodString>;
37
+ item: z.ZodObject<{
38
+ type: z.ZodString;
39
+ id: z.ZodString;
40
+ }, z.core.$loose>;
41
+ }, z.core.$loose>;
42
+ readonly 'item/completed': z.ZodObject<{
43
+ threadId: z.ZodOptional<z.ZodString>;
44
+ turnId: z.ZodOptional<z.ZodString>;
45
+ item: z.ZodObject<{
46
+ type: z.ZodString;
47
+ id: z.ZodString;
48
+ }, z.core.$loose>;
49
+ }, z.core.$loose>;
50
+ readonly 'turn/started': z.ZodObject<{
51
+ threadId: z.ZodOptional<z.ZodString>;
52
+ turn: z.ZodObject<{
53
+ id: z.ZodString;
54
+ status: z.ZodEnum<{
55
+ completed: "completed";
56
+ failed: "failed";
57
+ inProgress: "inProgress";
58
+ interrupted: "interrupted";
59
+ }>;
60
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
61
+ message: z.ZodString;
62
+ codexErrorInfo: z.ZodOptional<z.ZodNullable<z.ZodJSONSchema>>;
63
+ }, z.core.$loose>>>;
64
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
65
+ type: z.ZodString;
66
+ clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ }, z.core.$loose>>>;
68
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
69
+ completedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
70
+ durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
71
+ rootTurnId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ }, z.core.$loose>;
73
+ }, z.core.$loose>;
74
+ readonly 'turn/completed': z.ZodObject<{
75
+ threadId: z.ZodOptional<z.ZodString>;
76
+ turn: z.ZodObject<{
77
+ id: z.ZodString;
78
+ status: z.ZodEnum<{
79
+ completed: "completed";
80
+ failed: "failed";
81
+ inProgress: "inProgress";
82
+ interrupted: "interrupted";
83
+ }>;
84
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
85
+ message: z.ZodString;
86
+ codexErrorInfo: z.ZodOptional<z.ZodNullable<z.ZodJSONSchema>>;
87
+ }, z.core.$loose>>>;
88
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
89
+ type: z.ZodString;
90
+ clientId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
+ }, z.core.$loose>>>;
92
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
93
+ completedAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
94
+ durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
95
+ rootTurnId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
96
+ }, z.core.$loose>;
97
+ }, z.core.$loose>;
98
+ readonly 'thread/status/changed': z.ZodObject<{
99
+ threadId: z.ZodString;
100
+ status: z.ZodUnion<readonly [z.ZodObject<{
101
+ type: z.ZodLiteral<"notLoaded">;
102
+ }, z.core.$loose>, z.ZodObject<{
103
+ type: z.ZodLiteral<"idle">;
104
+ }, z.core.$loose>, z.ZodObject<{
105
+ type: z.ZodLiteral<"systemError">;
106
+ }, z.core.$loose>, z.ZodObject<{
107
+ type: z.ZodLiteral<"active">;
108
+ activeFlags: z.ZodArray<z.ZodString>;
109
+ }, z.core.$loose>, z.ZodCustom<{
110
+ readonly type: string;
111
+ } & {
112
+ readonly activeFlags?: never;
113
+ }, {
114
+ readonly type: string;
115
+ } & {
116
+ readonly activeFlags?: never;
117
+ }>]>;
118
+ }, z.core.$loose>;
119
+ readonly 'thread/settings/updated': z.ZodObject<{
120
+ threadId: z.ZodString;
121
+ threadSettings: z.ZodObject<{}, z.core.$loose>;
122
+ }, z.core.$loose>;
123
+ readonly 'model/rerouted': z.ZodObject<{
124
+ threadId: z.ZodString;
125
+ turnId: z.ZodString;
126
+ fromModel: z.ZodString;
127
+ toModel: z.ZodString;
128
+ reason: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$loose>;
130
+ readonly 'thread/tokenUsage/updated': z.ZodObject<{
131
+ threadId: z.ZodOptional<z.ZodString>;
132
+ turnId: z.ZodOptional<z.ZodString>;
133
+ tokenUsage: z.ZodObject<{
134
+ last: z.ZodObject<{
135
+ inputTokens: z.ZodInt;
136
+ outputTokens: z.ZodInt;
137
+ cachedInputTokens: z.ZodOptional<z.ZodInt>;
138
+ cacheWriteInputTokens: z.ZodOptional<z.ZodInt>;
139
+ reasoningOutputTokens: z.ZodOptional<z.ZodInt>;
140
+ totalTokens: z.ZodOptional<z.ZodInt>;
141
+ }, z.core.$loose>;
142
+ total: z.ZodOptional<z.ZodObject<{
143
+ inputTokens: z.ZodOptional<z.ZodInt>;
144
+ outputTokens: z.ZodOptional<z.ZodInt>;
145
+ cachedInputTokens: z.ZodOptional<z.ZodInt>;
146
+ cacheWriteInputTokens: z.ZodOptional<z.ZodInt>;
147
+ reasoningOutputTokens: z.ZodOptional<z.ZodInt>;
148
+ totalTokens: z.ZodOptional<z.ZodInt>;
149
+ }, z.core.$loose>>;
150
+ modelContextWindow: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
151
+ }, z.core.$loose>;
152
+ }, z.core.$loose>;
153
+ readonly 'serverRequest/resolved': z.ZodObject<{
154
+ threadId: z.ZodOptional<z.ZodString>;
155
+ requestId: z.ZodUnion<readonly [z.ZodString, z.ZodInt]>;
156
+ }, z.core.$loose>;
157
+ readonly 'account/rateLimits/updated': z.ZodObject<{
158
+ rateLimits: z.ZodJSONSchema;
159
+ rateLimitsByLimitId: z.ZodOptional<z.ZodJSONSchema>;
160
+ }, z.core.$loose>;
161
+ };
162
+ /** Union of Codex notification method names with typed schemas in {@link CodexNotificationParams}. */
163
+ export type CodexNotificationMethod = keyof typeof CodexNotificationParams;
164
+ /** Discriminated union of parsed Codex app-server notifications returned by {@link parseCodexNotification}. */
165
+ export type CodexParsedNotification = {
166
+ [M in CodexNotificationMethod]: {
167
+ readonly method: M;
168
+ readonly params: z.infer<(typeof CodexNotificationParams)[M]>;
169
+ };
170
+ }[CodexNotificationMethod];
171
+ /** Quiet notifications that stay `ignore` in delta classification while offering typed schemas in {@link CodexNotificationParams}. */
172
+ export declare const CODEX_PARSED_QUIET_NOTIFICATIONS: readonly ['thread/status/changed', 'turn/started', 'item/plan/delta', 'thread/settings/updated', 'model/rerouted'];
173
+ /** Notifications the driver asks the server not to send: noise for a turn. */
174
+ export declare const CODEX_OPTED_OUT_NOTIFICATIONS: string[];
175
+ /** Notifications a turn sees and that carry nothing for it. */
176
+ export declare const CODEX_QUIET_NOTIFICATIONS: Set<string>;
177
+ /**
178
+ * Parse a raw Codex notification event into a discriminated union by `method`.
179
+ * Returns `null` for methods not listed in {@link CodexNotificationParams}; throws
180
+ * {@link CodexProtocolError} when a known method carries malformed params.
181
+ */
182
+ export declare function parseCodexNotification(event: Pick<CodexNotificationEvent, 'method' | 'params'>): CodexParsedNotification | null;
183
+ //# sourceMappingURL=notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAiBzD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;aAClC,yBAAyB;;;;;;aAMzB,0BAA0B;;;;;;aAM1B,iCAAiC;;;;;;;aAOjC,iBAAiB;;;;;;aAMjB,cAAc;;;;;;;;aAKd,gBAAgB;;;;;;;;aAKhB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;aAId,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;aAIhB,uBAAuB;;;;;;;;;;;;;;;;;;;;;aAIvB,yBAAyB;;;;aAIzB,gBAAgB;;;;;;;aAOhB,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;aAgB3B,wBAAwB;;;;aAIxB,4BAA4B;;;;CAIpB,CAAC;AAEX,sGAAsG;AACtG,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,uBAAuB,CAAC;AAE3E,+GAA+G;AAC/G,MAAM,MAAM,uBAAuB,GAAG;KACnC,CAAC,IAAI,uBAAuB,GAAG;QAC9B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACnB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/D;CACF,CAAC,uBAAuB,CAAC,CAAC;AAE3B,sIAAsI;AACtI,eAAO,MAAM,gCAAgC,YAC3C,uBAAuB,EACvB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,CACR,CAAC;AAEX,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,UASzC,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,aAiDpC,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,QAAQ,CAAC,GACvD,uBAAuB,GAAG,IAAI,CAkJhC"}
@@ -0,0 +1,54 @@
1
+ import type { CodexControlClient } from './control-client.js';
2
+ import type { CodexListedTurn } from './protocol.js';
3
+ /** Minimum cursor-bearing shape required by {@link iterateCodexPages}. */
4
+ export interface CodexPageCursorResult {
5
+ /** Opaque continuation cursor for the next page, or `null`/`undefined` when no more pages exist. */
6
+ readonly nextCursor?: string | null | undefined;
7
+ }
8
+ /** Options controlling bounded cursor pagination in {@link iterateCodexPages}. */
9
+ export interface IterateCodexPagesOptions {
10
+ /** Maximum number of pages to request before stopping with `truncated: true`. */
11
+ readonly maxPages: number;
12
+ /** Optional cancellation signal checked before and during every page fetch. */
13
+ readonly signal?: AbortSignal | undefined;
14
+ /** What to do when a server repeats a previously seen cursor: `'throw'` (default) or `'stop'`. */
15
+ readonly onRepeatedCursor?: 'throw' | 'stop' | undefined;
16
+ }
17
+ /** Collected pages and truncation status returned by {@link iterateCodexPages}. */
18
+ export interface IterateCodexPagesResult<TPage extends CodexPageCursorResult> {
19
+ /** All fetched pages in request order. */
20
+ readonly pages: readonly TPage[];
21
+ /** `true` when `maxPages` was reached while the last page still advertised a `nextCursor`, or stopped early on a repeated cursor. */
22
+ readonly truncated: boolean;
23
+ }
24
+ /**
25
+ * Iterate a cursor-paginated Codex RPC (`listTurns`, `listThreads`, `listModels`, `listItems`)
26
+ * with bounded page count, repeated-cursor loop protection, empty-string opaque cursor support,
27
+ * and `AbortSignal` cancellation.
28
+ */
29
+ export declare function iterateCodexPages<TPage extends CodexPageCursorResult>(fetchPage: (cursor: string | undefined) => Promise<TPage>, options: IterateCodexPagesOptions): Promise<IterateCodexPagesResult<TPage>>;
30
+ /** Parameters for locating a turn by `clientId` on a live Codex control connection or session. */
31
+ export interface FindCodexTurnByClientIdParams {
32
+ /** Thread identifier whose turn history will be scanned. */
33
+ readonly threadId: string;
34
+ /** Client-generated `clientUserMessageId` to match against `userMessage` items. */
35
+ readonly clientId: string;
36
+ /** Maximum pages to inspect before failing closed. Default `256`. */
37
+ readonly maxPages?: number | undefined;
38
+ /** Page size passed to `thread/turns/list` (`1..4294967295`). Default `50`. */
39
+ readonly pageSize?: number | undefined;
40
+ /** Optional cancellation signal checked before and during every page request. */
41
+ readonly signal?: AbortSignal | undefined;
42
+ /** Optional per-page RPC timeout in milliseconds forwarded to `listTurns`. */
43
+ readonly timeoutMs?: number | undefined;
44
+ }
45
+ /**
46
+ * Locate the turn carrying a `userMessage` with `clientId` over a live {@link CodexControlClient}
47
+ * (`CodexControlConnection`, `CodexSharedServer`, or `CodexSession`) without spawning a new process.
48
+ *
49
+ * Streams pages without buffering prior pages, stops immediately on match, fails closed if any
50
+ * returned turn declares an incomplete `itemsView` (anything other than `'full'`), and throws if
51
+ * `maxPages` is exhausted before history ends.
52
+ */
53
+ export declare function findCodexTurnByClientId(controls: Pick<CodexControlClient, 'listTurns'>, params: FindCodexTurnByClientIdParams): Promise<CodexListedTurn | null>;
54
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/pagination.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,oGAAoG;IACpG,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACjD;AAED,kFAAkF;AAClF,MAAM,WAAW,wBAAwB;IACvC,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC1C,kGAAkG;IAClG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CAC1D;AAED,mFAAmF;AACnF,MAAM,WAAW,uBAAuB,CAAC,KAAK,SAAS,qBAAqB;IAC1E,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,KAAK,EAAE,CAAC;IACjC,qIAAqI;IACrI,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AA6CD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,SAAS,qBAAqB,EACzE,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,KAAK,CAAC,EACzD,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAYzC;AAED,kGAAkG;AAClG,MAAM,WAAW,6BAA6B;IAC5C,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC1C,8EAA8E;IAC9E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,EAC/C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAkEjC"}