@zakstam/codex-local-component 0.6.0 → 0.7.1

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 (142) hide show
  1. package/LLMS.md +111 -0
  2. package/README.md +25 -249
  3. package/dist/component/_generated/api.d.ts +42 -0
  4. package/dist/component/_generated/api.d.ts.map +1 -1
  5. package/dist/component/_generated/api.js.map +1 -1
  6. package/dist/component/_generated/component.d.ts +279 -126
  7. package/dist/component/_generated/component.d.ts.map +1 -1
  8. package/dist/component/approvals.d.ts +2 -6
  9. package/dist/component/approvals.d.ts.map +1 -1
  10. package/dist/component/approvals.js +8 -7
  11. package/dist/component/approvals.js.map +1 -1
  12. package/dist/component/dispatch.d.ts +7 -21
  13. package/dist/component/dispatch.d.ts.map +1 -1
  14. package/dist/component/dispatch.js +21 -20
  15. package/dist/component/dispatch.js.map +1 -1
  16. package/dist/component/ingest/applyApprovals.d.ts.map +1 -1
  17. package/dist/component/ingest/applyApprovals.js +3 -2
  18. package/dist/component/ingest/applyApprovals.js.map +1 -1
  19. package/dist/component/ingest/applyMessages.d.ts.map +1 -1
  20. package/dist/component/ingest/applyMessages.js +8 -7
  21. package/dist/component/ingest/applyMessages.js.map +1 -1
  22. package/dist/component/ingest/applyStreams.d.ts.map +1 -1
  23. package/dist/component/ingest/applyStreams.js +13 -12
  24. package/dist/component/ingest/applyStreams.js.map +1 -1
  25. package/dist/component/ingest/applyTurns.d.ts.map +1 -1
  26. package/dist/component/ingest/applyTurns.js +8 -7
  27. package/dist/component/ingest/applyTurns.js.map +1 -1
  28. package/dist/component/ingest/checkpoints.d.ts.map +1 -1
  29. package/dist/component/ingest/checkpoints.js +10 -13
  30. package/dist/component/ingest/checkpoints.js.map +1 -1
  31. package/dist/component/ingest/index.d.ts.map +1 -1
  32. package/dist/component/ingest/index.js +3 -2
  33. package/dist/component/ingest/index.js.map +1 -1
  34. package/dist/component/ingest/postIngest.d.ts.map +1 -1
  35. package/dist/component/ingest/postIngest.js +2 -1
  36. package/dist/component/ingest/postIngest.js.map +1 -1
  37. package/dist/component/ingest/sessionGuard.d.ts.map +1 -1
  38. package/dist/component/ingest/sessionGuard.js +5 -14
  39. package/dist/component/ingest/sessionGuard.js.map +1 -1
  40. package/dist/component/ingest/stateCache.d.ts +1 -1
  41. package/dist/component/ingest/stateCache.d.ts.map +1 -1
  42. package/dist/component/ingest/stateCache.js +8 -8
  43. package/dist/component/ingest/stateCache.js.map +1 -1
  44. package/dist/component/ingest/types.d.ts +2 -4
  45. package/dist/component/ingest/types.d.ts.map +1 -1
  46. package/dist/component/messages.d.ts +2 -6
  47. package/dist/component/messages.d.ts.map +1 -1
  48. package/dist/component/messages.js +4 -3
  49. package/dist/component/messages.js.map +1 -1
  50. package/dist/component/reasoning.d.ts +1 -3
  51. package/dist/component/reasoning.d.ts.map +1 -1
  52. package/dist/component/reasoning.js +3 -2
  53. package/dist/component/reasoning.js.map +1 -1
  54. package/dist/component/schema.d.ts +116 -122
  55. package/dist/component/schema.d.ts.map +1 -1
  56. package/dist/component/schema.js +74 -78
  57. package/dist/component/schema.js.map +1 -1
  58. package/dist/component/scope.d.ts +4 -0
  59. package/dist/component/scope.d.ts.map +1 -0
  60. package/dist/component/scope.js +6 -0
  61. package/dist/component/scope.js.map +1 -0
  62. package/dist/component/serverRequests.d.ts +3 -9
  63. package/dist/component/serverRequests.d.ts.map +1 -1
  64. package/dist/component/serverRequests.js +11 -10
  65. package/dist/component/serverRequests.js.map +1 -1
  66. package/dist/component/sessions.d.ts +1 -1
  67. package/dist/component/sessions.js +3 -3
  68. package/dist/component/sessions.js.map +1 -1
  69. package/dist/component/streamStats.d.ts +4 -4
  70. package/dist/component/streamStats.d.ts.map +1 -1
  71. package/dist/component/streamStats.js +10 -10
  72. package/dist/component/streamStats.js.map +1 -1
  73. package/dist/component/streams.d.ts +3 -3
  74. package/dist/component/streams.js +18 -18
  75. package/dist/component/streams.js.map +1 -1
  76. package/dist/component/sync.d.ts +4 -12
  77. package/dist/component/sync.d.ts.map +1 -1
  78. package/dist/component/sync.js +1 -1
  79. package/dist/component/sync.js.map +1 -1
  80. package/dist/component/syncIngest.d.ts +1 -3
  81. package/dist/component/syncIngest.d.ts.map +1 -1
  82. package/dist/component/syncReplay.d.ts +1 -3
  83. package/dist/component/syncReplay.d.ts.map +1 -1
  84. package/dist/component/syncReplay.js +11 -12
  85. package/dist/component/syncReplay.js.map +1 -1
  86. package/dist/component/threads.d.ts +7 -21
  87. package/dist/component/threads.d.ts.map +1 -1
  88. package/dist/component/threads.js +35 -34
  89. package/dist/component/threads.js.map +1 -1
  90. package/dist/component/turns.d.ts +2 -6
  91. package/dist/component/turns.d.ts.map +1 -1
  92. package/dist/component/turns.js +9 -8
  93. package/dist/component/turns.js.map +1 -1
  94. package/dist/component/turnsInternal.d.ts +1 -1
  95. package/dist/component/turnsInternal.js +3 -3
  96. package/dist/component/turnsInternal.js.map +1 -1
  97. package/dist/component/types.d.ts +4 -10
  98. package/dist/component/types.d.ts.map +1 -1
  99. package/dist/component/types.js +1 -3
  100. package/dist/component/types.js.map +1 -1
  101. package/dist/component/utils.d.ts.map +1 -1
  102. package/dist/component/utils.js +8 -11
  103. package/dist/component/utils.js.map +1 -1
  104. package/dist/host/convex-entry.d.ts +4 -1
  105. package/dist/host/convex-entry.d.ts.map +1 -1
  106. package/dist/host/convex-entry.js +3 -0
  107. package/dist/host/convex-entry.js.map +1 -1
  108. package/dist/host/convexPreset.d.ts +1422 -0
  109. package/dist/host/convexPreset.d.ts.map +1 -0
  110. package/dist/host/convexPreset.js +516 -0
  111. package/dist/host/convexPreset.js.map +1 -0
  112. package/dist/host/convexSlice.d.ts +46 -40
  113. package/dist/host/convexSlice.d.ts.map +1 -1
  114. package/dist/host/convexSlice.js +2 -4
  115. package/dist/host/convexSlice.js.map +1 -1
  116. package/dist/host/index.d.ts +4 -1
  117. package/dist/host/index.d.ts.map +1 -1
  118. package/dist/host/index.js +3 -0
  119. package/dist/host/index.js.map +1 -1
  120. package/dist/host/runtime.d.ts +1 -3
  121. package/dist/host/runtime.d.ts.map +1 -1
  122. package/dist/host/runtime.js +1 -1
  123. package/dist/host/runtime.js.map +1 -1
  124. package/dist/host/surfaceGenerator.d.ts +16 -0
  125. package/dist/host/surfaceGenerator.d.ts.map +1 -0
  126. package/dist/host/surfaceGenerator.js +56 -0
  127. package/dist/host/surfaceGenerator.js.map +1 -0
  128. package/dist/host/surfaceManifest.d.ts +27 -0
  129. package/dist/host/surfaceManifest.d.ts.map +1 -0
  130. package/dist/host/surfaceManifest.js +78 -0
  131. package/dist/host/surfaceManifest.js.map +1 -0
  132. package/dist/host/wrapDefinitions.d.ts +17 -0
  133. package/dist/host/wrapDefinitions.d.ts.map +1 -0
  134. package/dist/host/wrapDefinitions.js +18 -0
  135. package/dist/host/wrapDefinitions.js.map +1 -0
  136. package/docs/CLIENT_AND_REACT_HOOKS.md +99 -0
  137. package/docs/DISPATCH_MANAGED_REFERENCE_HOST.md +64 -0
  138. package/docs/HOST_INTEGRATION.md +89 -0
  139. package/docs/HOST_PRESET_MATRIX.md +72 -0
  140. package/docs/OPERATIONS_AND_ERRORS.md +62 -0
  141. package/docs/RUNTIME_OWNED_REFERENCE_HOST.md +59 -0
  142. package/package.json +8 -3
@@ -0,0 +1,1422 @@
1
+ import { type CodexHostComponentRefs, type CodexHostComponentsInput, type HostActorContext, type HostMutationRunner, type HostQueryRunner } from "./convexSlice.js";
2
+ import { HOST_SURFACE_MANIFEST } from "./surfaceManifest.js";
3
+ export type CodexHostSliceProfile = "runtimeOwned" | "dispatchManaged";
4
+ export type CodexHostSliceIngestMode = "streamOnly" | "mixed";
5
+ export type CodexHostSliceThreadMode = "create" | "resolve";
6
+ export type CodexHostSliceFeatures = {
7
+ hooks?: boolean;
8
+ approvals?: boolean;
9
+ serverRequests?: boolean;
10
+ reasoning?: boolean;
11
+ observability?: boolean;
12
+ hygiene?: boolean;
13
+ };
14
+ type ExtractCodexHostComponentRefs<Components extends CodexHostComponentsInput> = Components extends {
15
+ codexLocal: infer Component;
16
+ } ? Component extends CodexHostComponentRefs ? Component : never : Components extends CodexHostComponentRefs ? Components : never;
17
+ export type DefineCodexHostSliceOptions<Components extends CodexHostComponentsInput = CodexHostComponentsInput> = {
18
+ components: Components;
19
+ serverActor: HostActorContext;
20
+ profile: CodexHostSliceProfile;
21
+ ingestMode: CodexHostSliceIngestMode;
22
+ threadMode: CodexHostSliceThreadMode;
23
+ features?: CodexHostSliceFeatures;
24
+ };
25
+ export declare function defineCodexHostSlice<Components extends CodexHostComponentsInput>(options: DefineCodexHostSliceOptions<Components>): {
26
+ profile: CodexHostSliceProfile;
27
+ mutations: {
28
+ interruptTurnForHooks?: {
29
+ args: {
30
+ actor: import("convex/values").VObject<{
31
+ userId?: string;
32
+ }, {
33
+ userId: import("convex/values").VString<string | undefined, "optional">;
34
+ }, "required", "userId">;
35
+ threadId: import("convex/values").VString<string, "required">;
36
+ turnId: import("convex/values").VString<string, "required">;
37
+ reason: import("convex/values").VString<string | undefined, "optional">;
38
+ };
39
+ returns: import("convex/values").VNull<null, "required">;
40
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
41
+ actor: HostActorContext;
42
+ threadId: string;
43
+ turnId: string;
44
+ reason?: string;
45
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["turns"]["interrupt"]>>;
46
+ };
47
+ upsertPendingServerRequestForHooks?: {
48
+ args: {
49
+ actor: import("convex/values").VObject<{
50
+ userId?: string;
51
+ }, {
52
+ userId: import("convex/values").VString<string | undefined, "optional">;
53
+ }, "required", "userId">;
54
+ requestId: import("convex/values").VUnion<string | number, [import("convex/values").VString<string, "required">, import("convex/values").VFloat64<number, "required">], "required", never>;
55
+ threadId: import("convex/values").VString<string, "required">;
56
+ turnId: import("convex/values").VString<string, "required">;
57
+ itemId: import("convex/values").VString<string, "required">;
58
+ method: import("convex/values").VUnion<"item/commandExecution/requestApproval" | "item/fileChange/requestApproval" | "item/tool/requestUserInput" | "item/tool/call", [import("convex/values").VLiteral<"item/commandExecution/requestApproval", "required">, import("convex/values").VLiteral<"item/fileChange/requestApproval", "required">, import("convex/values").VLiteral<"item/tool/requestUserInput", "required">, import("convex/values").VLiteral<"item/tool/call", "required">], "required", never>;
59
+ payloadJson: import("convex/values").VString<string, "required">;
60
+ reason: import("convex/values").VString<string | undefined, "optional">;
61
+ questionsJson: import("convex/values").VString<string | undefined, "optional">;
62
+ requestedAt: import("convex/values").VFloat64<number, "required">;
63
+ };
64
+ returns: import("convex/values").VNull<null, "required">;
65
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
66
+ actor: HostActorContext;
67
+ requestId: string | number;
68
+ threadId: string;
69
+ turnId: string;
70
+ itemId: string;
71
+ method: "item/commandExecution/requestApproval" | "item/fileChange/requestApproval" | "item/tool/requestUserInput" | "item/tool/call";
72
+ payloadJson: string;
73
+ reason?: string;
74
+ questionsJson?: string;
75
+ requestedAt: number;
76
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["serverRequests"]["upsertPending"]>>;
77
+ };
78
+ resolvePendingServerRequestForHooks?: {
79
+ args: {
80
+ actor: import("convex/values").VObject<{
81
+ userId?: string;
82
+ }, {
83
+ userId: import("convex/values").VString<string | undefined, "optional">;
84
+ }, "required", "userId">;
85
+ threadId: import("convex/values").VString<string, "required">;
86
+ requestId: import("convex/values").VUnion<string | number, [import("convex/values").VString<string, "required">, import("convex/values").VFloat64<number, "required">], "required", never>;
87
+ status: import("convex/values").VUnion<"answered" | "expired", [import("convex/values").VLiteral<"answered", "required">, import("convex/values").VLiteral<"expired", "required">], "required", never>;
88
+ resolvedAt: import("convex/values").VFloat64<number, "required">;
89
+ responseJson: import("convex/values").VString<string | undefined, "optional">;
90
+ };
91
+ returns: import("convex/values").VNull<null, "required">;
92
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
93
+ actor: HostActorContext;
94
+ threadId: string;
95
+ requestId: string | number;
96
+ status: "answered" | "expired";
97
+ resolvedAt: number;
98
+ responseJson?: string;
99
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["serverRequests"]["resolve"]>>;
100
+ };
101
+ respondApprovalForHooks?: {
102
+ args: {
103
+ actor: import("convex/values").VObject<{
104
+ userId?: string;
105
+ }, {
106
+ userId: import("convex/values").VString<string | undefined, "optional">;
107
+ }, "required", "userId">;
108
+ threadId: import("convex/values").VString<string, "required">;
109
+ turnId: import("convex/values").VString<string, "required">;
110
+ itemId: import("convex/values").VString<string, "required">;
111
+ decision: import("convex/values").VUnion<"declined" | "accepted", [import("convex/values").VLiteral<"accepted", "required">, import("convex/values").VLiteral<"declined", "required">], "required", never>;
112
+ };
113
+ returns: import("convex/values").VNull<null, "required">;
114
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
115
+ actor: HostActorContext;
116
+ threadId: string;
117
+ turnId: string;
118
+ itemId: string;
119
+ decision: "accepted" | "declined";
120
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["approvals"]["respond"]>>;
121
+ };
122
+ ensureThread: {
123
+ args: {
124
+ actor: import("convex/values").VObject<{
125
+ userId?: string;
126
+ }, {
127
+ userId: import("convex/values").VString<string | undefined, "optional">;
128
+ }, "required", "userId">;
129
+ threadId: import("convex/values").VString<string | undefined, "optional">;
130
+ externalThreadId: import("convex/values").VString<string | undefined, "optional">;
131
+ model: import("convex/values").VString<string | undefined, "optional">;
132
+ cwd: import("convex/values").VString<string | undefined, "optional">;
133
+ };
134
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
135
+ actor: HostActorContext;
136
+ threadId?: string;
137
+ externalThreadId?: string;
138
+ model?: string;
139
+ cwd?: string;
140
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["threads"]["resolve"]> | import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["threads"]["create"]>>;
141
+ };
142
+ enqueueTurnDispatch: {
143
+ args: {
144
+ actor: import("convex/values").VObject<{
145
+ userId?: string;
146
+ }, {
147
+ userId: import("convex/values").VString<string | undefined, "optional">;
148
+ }, "required", "userId">;
149
+ threadId: import("convex/values").VString<string, "required">;
150
+ dispatchId: import("convex/values").VString<string | undefined, "optional">;
151
+ turnId: import("convex/values").VString<string, "required">;
152
+ idempotencyKey: import("convex/values").VString<string, "required">;
153
+ input: import("convex/values").VArray<{
154
+ text?: string;
155
+ url?: string;
156
+ path?: string;
157
+ type: string;
158
+ }[], import("convex/values").VObject<{
159
+ text?: string;
160
+ url?: string;
161
+ path?: string;
162
+ type: string;
163
+ }, {
164
+ type: import("convex/values").VString<string, "required">;
165
+ text: import("convex/values").VString<string | undefined, "optional">;
166
+ url: import("convex/values").VString<string | undefined, "optional">;
167
+ path: import("convex/values").VString<string | undefined, "optional">;
168
+ }, "required", "text" | "type" | "url" | "path">, "required">;
169
+ };
170
+ returns: import("convex/values").VObject<{
171
+ status: "completed" | "failed" | "cancelled" | "queued" | "claimed" | "started";
172
+ turnId: string;
173
+ accepted: boolean;
174
+ dispatchId: string;
175
+ }, {
176
+ dispatchId: import("convex/values").VString<string, "required">;
177
+ turnId: import("convex/values").VString<string, "required">;
178
+ status: import("convex/values").VUnion<"completed" | "failed" | "cancelled" | "queued" | "claimed" | "started", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"claimed", "required">, import("convex/values").VLiteral<"started", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"cancelled", "required">], "required", never>;
179
+ accepted: import("convex/values").VBoolean<boolean, "required">;
180
+ }, "required", "status" | "turnId" | "accepted" | "dispatchId">;
181
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
182
+ actor: HostActorContext;
183
+ threadId: string;
184
+ dispatchId?: string;
185
+ turnId: string;
186
+ idempotencyKey: string;
187
+ input: Array<{
188
+ type: string;
189
+ text?: string;
190
+ url?: string;
191
+ path?: string;
192
+ }>;
193
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["dispatch"]["enqueueTurnDispatch"]>>;
194
+ };
195
+ claimNextTurnDispatch: {
196
+ args: {
197
+ actor: import("convex/values").VObject<{
198
+ userId?: string;
199
+ }, {
200
+ userId: import("convex/values").VString<string | undefined, "optional">;
201
+ }, "required", "userId">;
202
+ threadId: import("convex/values").VString<string, "required">;
203
+ claimOwner: import("convex/values").VString<string, "required">;
204
+ leaseMs: import("convex/values").VFloat64<number | undefined, "optional">;
205
+ };
206
+ returns: import("convex/values").VUnion<{
207
+ inputText: string;
208
+ turnId: string;
209
+ idempotencyKey: string;
210
+ dispatchId: string;
211
+ claimToken: string;
212
+ leaseExpiresAt: number;
213
+ attemptCount: number;
214
+ } | null, [import("convex/values").VNull<null, "required">, import("convex/values").VObject<{
215
+ inputText: string;
216
+ turnId: string;
217
+ idempotencyKey: string;
218
+ dispatchId: string;
219
+ claimToken: string;
220
+ leaseExpiresAt: number;
221
+ attemptCount: number;
222
+ }, {
223
+ dispatchId: import("convex/values").VString<string, "required">;
224
+ turnId: import("convex/values").VString<string, "required">;
225
+ idempotencyKey: import("convex/values").VString<string, "required">;
226
+ inputText: import("convex/values").VString<string, "required">;
227
+ claimToken: import("convex/values").VString<string, "required">;
228
+ leaseExpiresAt: import("convex/values").VFloat64<number, "required">;
229
+ attemptCount: import("convex/values").VFloat64<number, "required">;
230
+ }, "required", "inputText" | "turnId" | "idempotencyKey" | "dispatchId" | "claimToken" | "leaseExpiresAt" | "attemptCount">], "required", "inputText" | "turnId" | "idempotencyKey" | "dispatchId" | "claimToken" | "leaseExpiresAt" | "attemptCount">;
231
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
232
+ actor: HostActorContext;
233
+ threadId: string;
234
+ claimOwner: string;
235
+ leaseMs?: number;
236
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["dispatch"]["claimNextTurnDispatch"]>>;
237
+ };
238
+ markTurnDispatchStarted: {
239
+ args: {
240
+ actor: import("convex/values").VObject<{
241
+ userId?: string;
242
+ }, {
243
+ userId: import("convex/values").VString<string | undefined, "optional">;
244
+ }, "required", "userId">;
245
+ threadId: import("convex/values").VString<string, "required">;
246
+ dispatchId: import("convex/values").VString<string, "required">;
247
+ claimToken: import("convex/values").VString<string, "required">;
248
+ runtimeThreadId: import("convex/values").VString<string | undefined, "optional">;
249
+ runtimeTurnId: import("convex/values").VString<string | undefined, "optional">;
250
+ };
251
+ returns: import("convex/values").VNull<null, "required">;
252
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
253
+ actor: HostActorContext;
254
+ threadId: string;
255
+ dispatchId: string;
256
+ claimToken: string;
257
+ runtimeThreadId?: string;
258
+ runtimeTurnId?: string;
259
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["dispatch"]["markTurnStarted"]>>;
260
+ };
261
+ markTurnDispatchCompleted: {
262
+ args: {
263
+ actor: import("convex/values").VObject<{
264
+ userId?: string;
265
+ }, {
266
+ userId: import("convex/values").VString<string | undefined, "optional">;
267
+ }, "required", "userId">;
268
+ threadId: import("convex/values").VString<string, "required">;
269
+ dispatchId: import("convex/values").VString<string, "required">;
270
+ claimToken: import("convex/values").VString<string, "required">;
271
+ };
272
+ returns: import("convex/values").VNull<null, "required">;
273
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
274
+ actor: HostActorContext;
275
+ threadId: string;
276
+ dispatchId: string;
277
+ claimToken: string;
278
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["dispatch"]["markTurnCompleted"]>>;
279
+ };
280
+ markTurnDispatchFailed: {
281
+ args: {
282
+ actor: import("convex/values").VObject<{
283
+ userId?: string;
284
+ }, {
285
+ userId: import("convex/values").VString<string | undefined, "optional">;
286
+ }, "required", "userId">;
287
+ threadId: import("convex/values").VString<string, "required">;
288
+ dispatchId: import("convex/values").VString<string, "required">;
289
+ claimToken: import("convex/values").VString<string, "required">;
290
+ code: import("convex/values").VString<string | undefined, "optional">;
291
+ reason: import("convex/values").VString<string, "required">;
292
+ };
293
+ returns: import("convex/values").VNull<null, "required">;
294
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
295
+ actor: HostActorContext;
296
+ threadId: string;
297
+ dispatchId: string;
298
+ claimToken: string;
299
+ code?: string;
300
+ reason: string;
301
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["dispatch"]["markTurnFailed"]>>;
302
+ };
303
+ cancelTurnDispatch: {
304
+ args: {
305
+ actor: import("convex/values").VObject<{
306
+ userId?: string;
307
+ }, {
308
+ userId: import("convex/values").VString<string | undefined, "optional">;
309
+ }, "required", "userId">;
310
+ threadId: import("convex/values").VString<string, "required">;
311
+ dispatchId: import("convex/values").VString<string, "required">;
312
+ claimToken: import("convex/values").VString<string | undefined, "optional">;
313
+ reason: import("convex/values").VString<string, "required">;
314
+ };
315
+ returns: import("convex/values").VNull<null, "required">;
316
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
317
+ actor: HostActorContext;
318
+ threadId: string;
319
+ dispatchId: string;
320
+ claimToken?: string;
321
+ reason: string;
322
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["dispatch"]["cancelTurnDispatch"]>>;
323
+ };
324
+ ensureSession: {
325
+ args: {
326
+ actor: import("convex/values").VObject<{
327
+ userId?: string;
328
+ }, {
329
+ userId: import("convex/values").VString<string | undefined, "optional">;
330
+ }, "required", "userId">;
331
+ sessionId: import("convex/values").VString<string, "required">;
332
+ threadId: import("convex/values").VString<string, "required">;
333
+ };
334
+ returns: import("convex/values").VObject<{
335
+ status: "active" | "created";
336
+ threadId: string;
337
+ sessionId: string;
338
+ }, {
339
+ sessionId: import("convex/values").VString<string, "required">;
340
+ threadId: import("convex/values").VString<string, "required">;
341
+ status: import("convex/values").VUnion<"active" | "created", [import("convex/values").VLiteral<"created", "required">, import("convex/values").VLiteral<"active", "required">], "required", never>;
342
+ }, "required", "status" | "threadId" | "sessionId">;
343
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
344
+ actor: HostActorContext;
345
+ sessionId: string;
346
+ threadId: string;
347
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["sync"]["ensureSession"]>>;
348
+ };
349
+ ingestEvent: {
350
+ args: {
351
+ actor: import("convex/values").VObject<{
352
+ userId?: string;
353
+ }, {
354
+ userId: import("convex/values").VString<string | undefined, "optional">;
355
+ }, "required", "userId">;
356
+ sessionId: import("convex/values").VString<string, "required">;
357
+ threadId: import("convex/values").VString<string, "required">;
358
+ event: import("convex/values").VUnion<{
359
+ turnId: string;
360
+ kind: string;
361
+ createdAt: number;
362
+ cursorEnd: number;
363
+ payloadJson: string;
364
+ streamId: string;
365
+ eventId: string;
366
+ cursorStart: number;
367
+ } | {
368
+ type: "stream_delta";
369
+ turnId: string;
370
+ kind: string;
371
+ createdAt: number;
372
+ cursorEnd: number;
373
+ payloadJson: string;
374
+ streamId: string;
375
+ eventId: string;
376
+ cursorStart: number;
377
+ } | {
378
+ turnId?: string;
379
+ type: "lifecycle_event";
380
+ kind: string;
381
+ createdAt: number;
382
+ payloadJson: string;
383
+ eventId: string;
384
+ }, [import("convex/values").VObject<{
385
+ turnId: string;
386
+ kind: string;
387
+ createdAt: number;
388
+ cursorEnd: number;
389
+ payloadJson: string;
390
+ streamId: string;
391
+ eventId: string;
392
+ cursorStart: number;
393
+ }, {
394
+ eventId: import("convex/values").VString<string, "required">;
395
+ turnId: import("convex/values").VString<string, "required">;
396
+ streamId: import("convex/values").VString<string, "required">;
397
+ kind: import("convex/values").VString<string, "required">;
398
+ payloadJson: import("convex/values").VString<string, "required">;
399
+ cursorStart: import("convex/values").VFloat64<number, "required">;
400
+ cursorEnd: import("convex/values").VFloat64<number, "required">;
401
+ createdAt: import("convex/values").VFloat64<number, "required">;
402
+ }, "required", "turnId" | "kind" | "createdAt" | "cursorEnd" | "payloadJson" | "streamId" | "eventId" | "cursorStart">, import("convex/values").VObject<{
403
+ type: "stream_delta";
404
+ turnId: string;
405
+ kind: string;
406
+ createdAt: number;
407
+ cursorEnd: number;
408
+ payloadJson: string;
409
+ streamId: string;
410
+ eventId: string;
411
+ cursorStart: number;
412
+ }, {
413
+ type: import("convex/values").VLiteral<"stream_delta", "required">;
414
+ eventId: import("convex/values").VString<string, "required">;
415
+ turnId: import("convex/values").VString<string, "required">;
416
+ streamId: import("convex/values").VString<string, "required">;
417
+ kind: import("convex/values").VString<string, "required">;
418
+ payloadJson: import("convex/values").VString<string, "required">;
419
+ cursorStart: import("convex/values").VFloat64<number, "required">;
420
+ cursorEnd: import("convex/values").VFloat64<number, "required">;
421
+ createdAt: import("convex/values").VFloat64<number, "required">;
422
+ }, "required", "type" | "turnId" | "kind" | "createdAt" | "cursorEnd" | "payloadJson" | "streamId" | "eventId" | "cursorStart">, import("convex/values").VObject<{
423
+ turnId?: string;
424
+ type: "lifecycle_event";
425
+ kind: string;
426
+ createdAt: number;
427
+ payloadJson: string;
428
+ eventId: string;
429
+ }, {
430
+ type: import("convex/values").VLiteral<"lifecycle_event", "required">;
431
+ eventId: import("convex/values").VString<string, "required">;
432
+ turnId: import("convex/values").VString<string | undefined, "optional">;
433
+ kind: import("convex/values").VString<string, "required">;
434
+ payloadJson: import("convex/values").VString<string, "required">;
435
+ createdAt: import("convex/values").VFloat64<number, "required">;
436
+ }, "required", "type" | "turnId" | "kind" | "createdAt" | "payloadJson" | "eventId">], "required", "type" | "turnId" | "kind" | "createdAt" | "cursorEnd" | "payloadJson" | "streamId" | "eventId" | "cursorStart">;
437
+ };
438
+ returns: import("convex/values").VObject<{
439
+ recovery?: {
440
+ action: "session_rebound";
441
+ threadId: string;
442
+ sessionId: string;
443
+ };
444
+ status: "ok" | "partial" | "session_recovered" | "rejected";
445
+ errors: {
446
+ message: string;
447
+ code: "SESSION_NOT_FOUND" | "SESSION_THREAD_MISMATCH" | "OUT_OF_ORDER" | "REPLAY_GAP" | "UNKNOWN";
448
+ recoverable: boolean;
449
+ }[];
450
+ ingestStatus: "ok" | "partial";
451
+ ackedStreams: {
452
+ streamId: string;
453
+ ackCursorEnd: number;
454
+ }[];
455
+ }, {
456
+ status: import("convex/values").VUnion<"ok" | "partial" | "session_recovered" | "rejected", [import("convex/values").VLiteral<"ok", "required">, import("convex/values").VLiteral<"partial", "required">, import("convex/values").VLiteral<"session_recovered", "required">, import("convex/values").VLiteral<"rejected", "required">], "required", never>;
457
+ ingestStatus: import("convex/values").VUnion<"ok" | "partial", [import("convex/values").VLiteral<"ok", "required">, import("convex/values").VLiteral<"partial", "required">], "required", never>;
458
+ ackedStreams: import("convex/values").VArray<{
459
+ streamId: string;
460
+ ackCursorEnd: number;
461
+ }[], import("convex/values").VObject<{
462
+ streamId: string;
463
+ ackCursorEnd: number;
464
+ }, {
465
+ streamId: import("convex/values").VString<string, "required">;
466
+ ackCursorEnd: import("convex/values").VFloat64<number, "required">;
467
+ }, "required", "streamId" | "ackCursorEnd">, "required">;
468
+ recovery: import("convex/values").VObject<{
469
+ action: "session_rebound";
470
+ threadId: string;
471
+ sessionId: string;
472
+ } | undefined, {
473
+ action: import("convex/values").VLiteral<"session_rebound", "required">;
474
+ sessionId: import("convex/values").VString<string, "required">;
475
+ threadId: import("convex/values").VString<string, "required">;
476
+ }, "optional", "action" | "threadId" | "sessionId">;
477
+ errors: import("convex/values").VArray<{
478
+ message: string;
479
+ code: "SESSION_NOT_FOUND" | "SESSION_THREAD_MISMATCH" | "OUT_OF_ORDER" | "REPLAY_GAP" | "UNKNOWN";
480
+ recoverable: boolean;
481
+ }[], import("convex/values").VObject<{
482
+ message: string;
483
+ code: "SESSION_NOT_FOUND" | "SESSION_THREAD_MISMATCH" | "OUT_OF_ORDER" | "REPLAY_GAP" | "UNKNOWN";
484
+ recoverable: boolean;
485
+ }, {
486
+ code: import("convex/values").VUnion<"SESSION_NOT_FOUND" | "SESSION_THREAD_MISMATCH" | "OUT_OF_ORDER" | "REPLAY_GAP" | "UNKNOWN", [import("convex/values").VLiteral<"SESSION_NOT_FOUND", "required">, import("convex/values").VLiteral<"SESSION_THREAD_MISMATCH", "required">, import("convex/values").VLiteral<"OUT_OF_ORDER", "required">, import("convex/values").VLiteral<"REPLAY_GAP", "required">, import("convex/values").VLiteral<"UNKNOWN", "required">], "required", never>;
487
+ message: import("convex/values").VString<string, "required">;
488
+ recoverable: import("convex/values").VBoolean<boolean, "required">;
489
+ }, "required", "message" | "code" | "recoverable">, "required">;
490
+ }, "required", "status" | "errors" | "ingestStatus" | "ackedStreams" | "recovery" | "recovery.action" | "recovery.threadId" | "recovery.sessionId">;
491
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
492
+ actor: HostActorContext;
493
+ sessionId: string;
494
+ threadId: string;
495
+ event: {
496
+ eventId: string;
497
+ turnId: string;
498
+ streamId: string;
499
+ kind: string;
500
+ payloadJson: string;
501
+ cursorStart: number;
502
+ cursorEnd: number;
503
+ createdAt: number;
504
+ } | {
505
+ type: "stream_delta";
506
+ eventId: string;
507
+ turnId: string;
508
+ streamId: string;
509
+ kind: string;
510
+ payloadJson: string;
511
+ cursorStart: number;
512
+ cursorEnd: number;
513
+ createdAt: number;
514
+ } | {
515
+ type: "lifecycle_event";
516
+ eventId: string;
517
+ turnId?: string;
518
+ kind: string;
519
+ payloadJson: string;
520
+ createdAt: number;
521
+ };
522
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["sync"]["ingestSafe"]>>;
523
+ };
524
+ ingestBatch: {
525
+ args: {
526
+ actor: import("convex/values").VObject<{
527
+ userId?: string;
528
+ }, {
529
+ userId: import("convex/values").VString<string | undefined, "optional">;
530
+ }, "required", "userId">;
531
+ sessionId: import("convex/values").VString<string, "required">;
532
+ threadId: import("convex/values").VString<string, "required">;
533
+ deltas: import("convex/values").VArray<({
534
+ turnId: string;
535
+ kind: string;
536
+ createdAt: number;
537
+ cursorEnd: number;
538
+ payloadJson: string;
539
+ streamId: string;
540
+ eventId: string;
541
+ cursorStart: number;
542
+ } | {
543
+ type: "stream_delta";
544
+ turnId: string;
545
+ kind: string;
546
+ createdAt: number;
547
+ cursorEnd: number;
548
+ payloadJson: string;
549
+ streamId: string;
550
+ eventId: string;
551
+ cursorStart: number;
552
+ } | {
553
+ turnId?: string;
554
+ type: "lifecycle_event";
555
+ kind: string;
556
+ createdAt: number;
557
+ payloadJson: string;
558
+ eventId: string;
559
+ })[], import("convex/values").VUnion<{
560
+ turnId: string;
561
+ kind: string;
562
+ createdAt: number;
563
+ cursorEnd: number;
564
+ payloadJson: string;
565
+ streamId: string;
566
+ eventId: string;
567
+ cursorStart: number;
568
+ } | {
569
+ type: "stream_delta";
570
+ turnId: string;
571
+ kind: string;
572
+ createdAt: number;
573
+ cursorEnd: number;
574
+ payloadJson: string;
575
+ streamId: string;
576
+ eventId: string;
577
+ cursorStart: number;
578
+ } | {
579
+ turnId?: string;
580
+ type: "lifecycle_event";
581
+ kind: string;
582
+ createdAt: number;
583
+ payloadJson: string;
584
+ eventId: string;
585
+ }, [import("convex/values").VObject<{
586
+ turnId: string;
587
+ kind: string;
588
+ createdAt: number;
589
+ cursorEnd: number;
590
+ payloadJson: string;
591
+ streamId: string;
592
+ eventId: string;
593
+ cursorStart: number;
594
+ }, {
595
+ eventId: import("convex/values").VString<string, "required">;
596
+ turnId: import("convex/values").VString<string, "required">;
597
+ streamId: import("convex/values").VString<string, "required">;
598
+ kind: import("convex/values").VString<string, "required">;
599
+ payloadJson: import("convex/values").VString<string, "required">;
600
+ cursorStart: import("convex/values").VFloat64<number, "required">;
601
+ cursorEnd: import("convex/values").VFloat64<number, "required">;
602
+ createdAt: import("convex/values").VFloat64<number, "required">;
603
+ }, "required", "turnId" | "kind" | "createdAt" | "cursorEnd" | "payloadJson" | "streamId" | "eventId" | "cursorStart">, import("convex/values").VObject<{
604
+ type: "stream_delta";
605
+ turnId: string;
606
+ kind: string;
607
+ createdAt: number;
608
+ cursorEnd: number;
609
+ payloadJson: string;
610
+ streamId: string;
611
+ eventId: string;
612
+ cursorStart: number;
613
+ }, {
614
+ type: import("convex/values").VLiteral<"stream_delta", "required">;
615
+ eventId: import("convex/values").VString<string, "required">;
616
+ turnId: import("convex/values").VString<string, "required">;
617
+ streamId: import("convex/values").VString<string, "required">;
618
+ kind: import("convex/values").VString<string, "required">;
619
+ payloadJson: import("convex/values").VString<string, "required">;
620
+ cursorStart: import("convex/values").VFloat64<number, "required">;
621
+ cursorEnd: import("convex/values").VFloat64<number, "required">;
622
+ createdAt: import("convex/values").VFloat64<number, "required">;
623
+ }, "required", "type" | "turnId" | "kind" | "createdAt" | "cursorEnd" | "payloadJson" | "streamId" | "eventId" | "cursorStart">, import("convex/values").VObject<{
624
+ turnId?: string;
625
+ type: "lifecycle_event";
626
+ kind: string;
627
+ createdAt: number;
628
+ payloadJson: string;
629
+ eventId: string;
630
+ }, {
631
+ type: import("convex/values").VLiteral<"lifecycle_event", "required">;
632
+ eventId: import("convex/values").VString<string, "required">;
633
+ turnId: import("convex/values").VString<string | undefined, "optional">;
634
+ kind: import("convex/values").VString<string, "required">;
635
+ payloadJson: import("convex/values").VString<string, "required">;
636
+ createdAt: import("convex/values").VFloat64<number, "required">;
637
+ }, "required", "type" | "turnId" | "kind" | "createdAt" | "payloadJson" | "eventId">], "required", "type" | "turnId" | "kind" | "createdAt" | "cursorEnd" | "payloadJson" | "streamId" | "eventId" | "cursorStart">, "required">;
638
+ runtime: import("convex/values").VObject<{
639
+ saveStreamDeltas?: boolean;
640
+ saveReasoningDeltas?: boolean;
641
+ exposeRawReasoningDeltas?: boolean;
642
+ maxDeltasPerStreamRead?: number;
643
+ maxDeltasPerRequestRead?: number;
644
+ finishedStreamDeleteDelayMs?: number;
645
+ } | undefined, {
646
+ saveStreamDeltas: import("convex/values").VBoolean<boolean | undefined, "optional">;
647
+ saveReasoningDeltas: import("convex/values").VBoolean<boolean | undefined, "optional">;
648
+ exposeRawReasoningDeltas: import("convex/values").VBoolean<boolean | undefined, "optional">;
649
+ maxDeltasPerStreamRead: import("convex/values").VFloat64<number | undefined, "optional">;
650
+ maxDeltasPerRequestRead: import("convex/values").VFloat64<number | undefined, "optional">;
651
+ finishedStreamDeleteDelayMs: import("convex/values").VFloat64<number | undefined, "optional">;
652
+ }, "optional", "saveStreamDeltas" | "saveReasoningDeltas" | "exposeRawReasoningDeltas" | "maxDeltasPerStreamRead" | "maxDeltasPerRequestRead" | "finishedStreamDeleteDelayMs">;
653
+ };
654
+ returns: import("convex/values").VObject<{
655
+ recovery?: {
656
+ action: "session_rebound";
657
+ threadId: string;
658
+ sessionId: string;
659
+ };
660
+ status: "ok" | "partial" | "session_recovered" | "rejected";
661
+ errors: {
662
+ message: string;
663
+ code: "SESSION_NOT_FOUND" | "SESSION_THREAD_MISMATCH" | "OUT_OF_ORDER" | "REPLAY_GAP" | "UNKNOWN";
664
+ recoverable: boolean;
665
+ }[];
666
+ ingestStatus: "ok" | "partial";
667
+ ackedStreams: {
668
+ streamId: string;
669
+ ackCursorEnd: number;
670
+ }[];
671
+ }, {
672
+ status: import("convex/values").VUnion<"ok" | "partial" | "session_recovered" | "rejected", [import("convex/values").VLiteral<"ok", "required">, import("convex/values").VLiteral<"partial", "required">, import("convex/values").VLiteral<"session_recovered", "required">, import("convex/values").VLiteral<"rejected", "required">], "required", never>;
673
+ ingestStatus: import("convex/values").VUnion<"ok" | "partial", [import("convex/values").VLiteral<"ok", "required">, import("convex/values").VLiteral<"partial", "required">], "required", never>;
674
+ ackedStreams: import("convex/values").VArray<{
675
+ streamId: string;
676
+ ackCursorEnd: number;
677
+ }[], import("convex/values").VObject<{
678
+ streamId: string;
679
+ ackCursorEnd: number;
680
+ }, {
681
+ streamId: import("convex/values").VString<string, "required">;
682
+ ackCursorEnd: import("convex/values").VFloat64<number, "required">;
683
+ }, "required", "streamId" | "ackCursorEnd">, "required">;
684
+ recovery: import("convex/values").VObject<{
685
+ action: "session_rebound";
686
+ threadId: string;
687
+ sessionId: string;
688
+ } | undefined, {
689
+ action: import("convex/values").VLiteral<"session_rebound", "required">;
690
+ sessionId: import("convex/values").VString<string, "required">;
691
+ threadId: import("convex/values").VString<string, "required">;
692
+ }, "optional", "action" | "threadId" | "sessionId">;
693
+ errors: import("convex/values").VArray<{
694
+ message: string;
695
+ code: "SESSION_NOT_FOUND" | "SESSION_THREAD_MISMATCH" | "OUT_OF_ORDER" | "REPLAY_GAP" | "UNKNOWN";
696
+ recoverable: boolean;
697
+ }[], import("convex/values").VObject<{
698
+ message: string;
699
+ code: "SESSION_NOT_FOUND" | "SESSION_THREAD_MISMATCH" | "OUT_OF_ORDER" | "REPLAY_GAP" | "UNKNOWN";
700
+ recoverable: boolean;
701
+ }, {
702
+ code: import("convex/values").VUnion<"SESSION_NOT_FOUND" | "SESSION_THREAD_MISMATCH" | "OUT_OF_ORDER" | "REPLAY_GAP" | "UNKNOWN", [import("convex/values").VLiteral<"SESSION_NOT_FOUND", "required">, import("convex/values").VLiteral<"SESSION_THREAD_MISMATCH", "required">, import("convex/values").VLiteral<"OUT_OF_ORDER", "required">, import("convex/values").VLiteral<"REPLAY_GAP", "required">, import("convex/values").VLiteral<"UNKNOWN", "required">], "required", never>;
703
+ message: import("convex/values").VString<string, "required">;
704
+ recoverable: import("convex/values").VBoolean<boolean, "required">;
705
+ }, "required", "message" | "code" | "recoverable">, "required">;
706
+ }, "required", "status" | "errors" | "ingestStatus" | "ackedStreams" | "recovery" | "recovery.action" | "recovery.threadId" | "recovery.sessionId">;
707
+ handler: (ctx: HostMutationRunner & HostQueryRunner, args: {
708
+ actor: HostActorContext;
709
+ sessionId: string;
710
+ threadId: string;
711
+ deltas: Array<{
712
+ eventId: string;
713
+ turnId: string;
714
+ streamId: string;
715
+ kind: string;
716
+ payloadJson: string;
717
+ cursorStart: number;
718
+ cursorEnd: number;
719
+ createdAt: number;
720
+ } | {
721
+ type: "stream_delta";
722
+ eventId: string;
723
+ turnId: string;
724
+ streamId: string;
725
+ kind: string;
726
+ payloadJson: string;
727
+ cursorStart: number;
728
+ cursorEnd: number;
729
+ createdAt: number;
730
+ } | {
731
+ type: "lifecycle_event";
732
+ eventId: string;
733
+ turnId?: string;
734
+ kind: string;
735
+ payloadJson: string;
736
+ createdAt: number;
737
+ }>;
738
+ runtime?: {
739
+ saveStreamDeltas?: boolean;
740
+ saveReasoningDeltas?: boolean;
741
+ exposeRawReasoningDeltas?: boolean;
742
+ maxDeltasPerStreamRead?: number;
743
+ maxDeltasPerRequestRead?: number;
744
+ finishedStreamDeleteDelayMs?: number;
745
+ };
746
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["sync"]["ingestSafe"]>>;
747
+ };
748
+ };
749
+ queries: {
750
+ listPendingServerRequestsForHooks?: {
751
+ args: {
752
+ actor: import("convex/values").VObject<{
753
+ userId?: string;
754
+ }, {
755
+ userId: import("convex/values").VString<string | undefined, "optional">;
756
+ }, "required", "userId">;
757
+ threadId: import("convex/values").VString<string | undefined, "optional">;
758
+ limit: import("convex/values").VFloat64<number | undefined, "optional">;
759
+ };
760
+ handler: (ctx: HostQueryRunner, args: {
761
+ actor: HostActorContext;
762
+ threadId?: string;
763
+ limit?: number;
764
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["serverRequests"]["listPending"]>>;
765
+ };
766
+ listPendingApprovalsForHooks?: {
767
+ args: {
768
+ actor: import("convex/values").VObject<{
769
+ userId?: string;
770
+ }, {
771
+ userId: import("convex/values").VString<string | undefined, "optional">;
772
+ }, "required", "userId">;
773
+ threadId: import("convex/values").VString<string | undefined, "optional">;
774
+ paginationOpts: import("convex/values").VObject<{
775
+ id?: number;
776
+ endCursor?: string | null;
777
+ maximumRowsRead?: number;
778
+ maximumBytesRead?: number;
779
+ numItems: number;
780
+ cursor: string | null;
781
+ }, {
782
+ numItems: import("convex/values").VFloat64<number, "required">;
783
+ cursor: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
784
+ endCursor: import("convex/values").VUnion<string | null | undefined, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
785
+ id: import("convex/values").VFloat64<number | undefined, "optional">;
786
+ maximumRowsRead: import("convex/values").VFloat64<number | undefined, "optional">;
787
+ maximumBytesRead: import("convex/values").VFloat64<number | undefined, "optional">;
788
+ }, "required", "id" | "cursor" | "numItems" | "endCursor" | "maximumRowsRead" | "maximumBytesRead">;
789
+ };
790
+ handler: (ctx: HostQueryRunner, args: {
791
+ actor: HostActorContext;
792
+ threadId?: string;
793
+ paginationOpts: {
794
+ cursor: string | null;
795
+ numItems: number;
796
+ };
797
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["approvals"]["listPending"]>>;
798
+ };
799
+ listThreadReasoningForHooks?: {
800
+ args: {
801
+ actor: import("convex/values").VObject<{
802
+ userId?: string;
803
+ }, {
804
+ userId: import("convex/values").VString<string | undefined, "optional">;
805
+ }, "required", "userId">;
806
+ threadId: import("convex/values").VString<string, "required">;
807
+ paginationOpts: import("convex/values").VObject<{
808
+ id?: number;
809
+ endCursor?: string | null;
810
+ maximumRowsRead?: number;
811
+ maximumBytesRead?: number;
812
+ numItems: number;
813
+ cursor: string | null;
814
+ }, {
815
+ numItems: import("convex/values").VFloat64<number, "required">;
816
+ cursor: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
817
+ endCursor: import("convex/values").VUnion<string | null | undefined, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
818
+ id: import("convex/values").VFloat64<number | undefined, "optional">;
819
+ maximumRowsRead: import("convex/values").VFloat64<number | undefined, "optional">;
820
+ maximumBytesRead: import("convex/values").VFloat64<number | undefined, "optional">;
821
+ }, "required", "id" | "cursor" | "numItems" | "endCursor" | "maximumRowsRead" | "maximumBytesRead">;
822
+ includeRaw: import("convex/values").VBoolean<boolean | undefined, "optional">;
823
+ };
824
+ handler: (ctx: HostQueryRunner, args: {
825
+ actor: HostActorContext;
826
+ threadId: string;
827
+ paginationOpts: {
828
+ cursor: string | null;
829
+ numItems: number;
830
+ };
831
+ includeRaw?: boolean;
832
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["reasoning"]["listByThread"]>>;
833
+ };
834
+ listThreadMessagesForHooks?: {
835
+ args: {
836
+ actor: import("convex/values").VObject<{
837
+ userId?: string;
838
+ }, {
839
+ userId: import("convex/values").VString<string | undefined, "optional">;
840
+ }, "required", "userId">;
841
+ threadId: import("convex/values").VString<string, "required">;
842
+ paginationOpts: import("convex/values").VObject<{
843
+ id?: number;
844
+ endCursor?: string | null;
845
+ maximumRowsRead?: number;
846
+ maximumBytesRead?: number;
847
+ numItems: number;
848
+ cursor: string | null;
849
+ }, {
850
+ numItems: import("convex/values").VFloat64<number, "required">;
851
+ cursor: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
852
+ endCursor: import("convex/values").VUnion<string | null | undefined, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
853
+ id: import("convex/values").VFloat64<number | undefined, "optional">;
854
+ maximumRowsRead: import("convex/values").VFloat64<number | undefined, "optional">;
855
+ maximumBytesRead: import("convex/values").VFloat64<number | undefined, "optional">;
856
+ }, "required", "id" | "cursor" | "numItems" | "endCursor" | "maximumRowsRead" | "maximumBytesRead">;
857
+ streamArgs: import("convex/values").VUnion<{
858
+ startOrder?: number;
859
+ kind: "list";
860
+ } | {
861
+ kind: "deltas";
862
+ cursors: {
863
+ cursor: number;
864
+ streamId: string;
865
+ }[];
866
+ } | undefined, [import("convex/values").VObject<{
867
+ startOrder?: number;
868
+ kind: "list";
869
+ }, {
870
+ kind: import("convex/values").VLiteral<"list", "required">;
871
+ startOrder: import("convex/values").VFloat64<number | undefined, "optional">;
872
+ }, "required", "kind" | "startOrder">, import("convex/values").VObject<{
873
+ kind: "deltas";
874
+ cursors: {
875
+ cursor: number;
876
+ streamId: string;
877
+ }[];
878
+ }, {
879
+ kind: import("convex/values").VLiteral<"deltas", "required">;
880
+ cursors: import("convex/values").VArray<{
881
+ cursor: number;
882
+ streamId: string;
883
+ }[], import("convex/values").VObject<{
884
+ cursor: number;
885
+ streamId: string;
886
+ }, {
887
+ streamId: import("convex/values").VString<string, "required">;
888
+ cursor: import("convex/values").VFloat64<number, "required">;
889
+ }, "required", "cursor" | "streamId">, "required">;
890
+ }, "required", "kind" | "cursors">], "optional", "kind" | "startOrder" | "cursors">;
891
+ runtime: import("convex/values").VObject<{
892
+ saveStreamDeltas?: boolean;
893
+ saveReasoningDeltas?: boolean;
894
+ exposeRawReasoningDeltas?: boolean;
895
+ maxDeltasPerStreamRead?: number;
896
+ maxDeltasPerRequestRead?: number;
897
+ finishedStreamDeleteDelayMs?: number;
898
+ } | undefined, {
899
+ saveStreamDeltas: import("convex/values").VBoolean<boolean | undefined, "optional">;
900
+ saveReasoningDeltas: import("convex/values").VBoolean<boolean | undefined, "optional">;
901
+ exposeRawReasoningDeltas: import("convex/values").VBoolean<boolean | undefined, "optional">;
902
+ maxDeltasPerStreamRead: import("convex/values").VFloat64<number | undefined, "optional">;
903
+ maxDeltasPerRequestRead: import("convex/values").VFloat64<number | undefined, "optional">;
904
+ finishedStreamDeleteDelayMs: import("convex/values").VFloat64<number | undefined, "optional">;
905
+ }, "optional", "saveStreamDeltas" | "saveReasoningDeltas" | "exposeRawReasoningDeltas" | "maxDeltasPerStreamRead" | "maxDeltasPerRequestRead" | "finishedStreamDeleteDelayMs">;
906
+ };
907
+ handler: (ctx: HostQueryRunner, args: {
908
+ actor: HostActorContext;
909
+ threadId: string;
910
+ paginationOpts: {
911
+ cursor: string | null;
912
+ numItems: number;
913
+ };
914
+ streamArgs?: {
915
+ kind: "list";
916
+ startOrder?: number;
917
+ } | {
918
+ kind: "deltas";
919
+ cursors: Array<{
920
+ streamId: string;
921
+ cursor: number;
922
+ }>;
923
+ };
924
+ runtime?: {
925
+ saveStreamDeltas?: boolean;
926
+ saveReasoningDeltas?: boolean;
927
+ exposeRawReasoningDeltas?: boolean;
928
+ maxDeltasPerStreamRead?: number;
929
+ maxDeltasPerRequestRead?: number;
930
+ finishedStreamDeleteDelayMs?: number;
931
+ };
932
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["messages"]["listByThread"]> & {
933
+ streams?: {
934
+ kind: "list";
935
+ streams: Array<{
936
+ streamId: string;
937
+ state: string;
938
+ }>;
939
+ } | {
940
+ kind: "deltas";
941
+ streams: Array<{
942
+ streamId: string;
943
+ state: string;
944
+ }>;
945
+ deltas: Array<Record<string, unknown>>;
946
+ streamWindows: Array<{
947
+ streamId: string;
948
+ status: "ok" | "rebased" | "stale";
949
+ serverCursorStart: number;
950
+ serverCursorEnd: number;
951
+ }>;
952
+ nextCheckpoints: Array<{
953
+ streamId: string;
954
+ cursor: number;
955
+ }>;
956
+ };
957
+ }>;
958
+ };
959
+ listTurnMessagesForHooks?: {
960
+ args: {
961
+ actor: import("convex/values").VObject<{
962
+ userId?: string;
963
+ }, {
964
+ userId: import("convex/values").VString<string | undefined, "optional">;
965
+ }, "required", "userId">;
966
+ threadId: import("convex/values").VString<string, "required">;
967
+ turnId: import("convex/values").VString<string, "required">;
968
+ };
969
+ handler: (ctx: HostQueryRunner, args: {
970
+ actor: HostActorContext;
971
+ threadId: string;
972
+ turnId: string;
973
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["messages"]["getByTurn"]>>;
974
+ };
975
+ dataHygiene?: {
976
+ args: {
977
+ actor: import("convex/values").VObject<{
978
+ userId?: string;
979
+ }, {
980
+ userId: import("convex/values").VString<string | undefined, "optional">;
981
+ }, "required", "userId">;
982
+ threadId: import("convex/values").VString<string, "required">;
983
+ };
984
+ returns: import("convex/values").VObject<{
985
+ scannedStreamStats: number;
986
+ streamStatOrphans: number;
987
+ orphanStreamIds: string[];
988
+ }, {
989
+ scannedStreamStats: import("convex/values").VFloat64<number, "required">;
990
+ streamStatOrphans: import("convex/values").VFloat64<number, "required">;
991
+ orphanStreamIds: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
992
+ }, "required", "scannedStreamStats" | "streamStatOrphans" | "orphanStreamIds">;
993
+ handler: (ctx: HostQueryRunner, args: {
994
+ actor: HostActorContext;
995
+ threadId: string;
996
+ }) => Promise<{
997
+ scannedStreamStats: number;
998
+ streamStatOrphans: number;
999
+ orphanStreamIds: string[];
1000
+ }>;
1001
+ };
1002
+ getDispatchObservability?: {
1003
+ args: {
1004
+ actor: import("convex/values").VObject<{
1005
+ userId?: string;
1006
+ }, {
1007
+ userId: import("convex/values").VString<string | undefined, "optional">;
1008
+ }, "required", "userId">;
1009
+ threadId: import("convex/values").VString<string, "required">;
1010
+ dispatchId: import("convex/values").VString<string | undefined, "optional">;
1011
+ turnId: import("convex/values").VString<string | undefined, "optional">;
1012
+ };
1013
+ returns: import("convex/values").VObject<{
1014
+ threadId: string;
1015
+ turn: {
1016
+ status?: string;
1017
+ turnId?: string;
1018
+ };
1019
+ runtime: {
1020
+ runtimeThreadId?: string;
1021
+ runtimeTurnId?: string;
1022
+ inFlight: boolean;
1023
+ };
1024
+ dispatch: {
1025
+ startedAt?: number;
1026
+ completedAt?: number;
1027
+ claimOwner?: string;
1028
+ claimToken?: string;
1029
+ runtimeThreadId?: string;
1030
+ runtimeTurnId?: string;
1031
+ failureCode?: string;
1032
+ failureReason?: string;
1033
+ cancelledAt?: number;
1034
+ inputText: string;
1035
+ status: "completed" | "failed" | "cancelled" | "queued" | "claimed" | "started";
1036
+ turnId: string;
1037
+ createdAt: number;
1038
+ updatedAt: number;
1039
+ idempotencyKey: string;
1040
+ dispatchId: string;
1041
+ leaseExpiresAt: number;
1042
+ attemptCount: number;
1043
+ } | null;
1044
+ claim: {
1045
+ leaseExpiresAt?: number;
1046
+ owner?: string;
1047
+ token?: string;
1048
+ active: boolean;
1049
+ };
1050
+ correlations: {
1051
+ dispatchId?: string;
1052
+ claimToken?: string;
1053
+ runtimeThreadId?: string;
1054
+ runtimeTurnId?: string;
1055
+ localTurnId?: string;
1056
+ };
1057
+ }, {
1058
+ threadId: import("convex/values").VString<string, "required">;
1059
+ dispatch: import("convex/values").VUnion<{
1060
+ startedAt?: number;
1061
+ completedAt?: number;
1062
+ claimOwner?: string;
1063
+ claimToken?: string;
1064
+ runtimeThreadId?: string;
1065
+ runtimeTurnId?: string;
1066
+ failureCode?: string;
1067
+ failureReason?: string;
1068
+ cancelledAt?: number;
1069
+ inputText: string;
1070
+ status: "completed" | "failed" | "cancelled" | "queued" | "claimed" | "started";
1071
+ turnId: string;
1072
+ createdAt: number;
1073
+ updatedAt: number;
1074
+ idempotencyKey: string;
1075
+ dispatchId: string;
1076
+ leaseExpiresAt: number;
1077
+ attemptCount: number;
1078
+ } | null, [import("convex/values").VNull<null, "required">, import("convex/values").VObject<{
1079
+ startedAt?: number;
1080
+ completedAt?: number;
1081
+ claimOwner?: string;
1082
+ claimToken?: string;
1083
+ runtimeThreadId?: string;
1084
+ runtimeTurnId?: string;
1085
+ failureCode?: string;
1086
+ failureReason?: string;
1087
+ cancelledAt?: number;
1088
+ inputText: string;
1089
+ status: "completed" | "failed" | "cancelled" | "queued" | "claimed" | "started";
1090
+ turnId: string;
1091
+ createdAt: number;
1092
+ updatedAt: number;
1093
+ idempotencyKey: string;
1094
+ dispatchId: string;
1095
+ leaseExpiresAt: number;
1096
+ attemptCount: number;
1097
+ }, {
1098
+ dispatchId: import("convex/values").VString<string, "required">;
1099
+ turnId: import("convex/values").VString<string, "required">;
1100
+ status: import("convex/values").VUnion<"completed" | "failed" | "cancelled" | "queued" | "claimed" | "started", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"claimed", "required">, import("convex/values").VLiteral<"started", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"cancelled", "required">], "required", never>;
1101
+ idempotencyKey: import("convex/values").VString<string, "required">;
1102
+ inputText: import("convex/values").VString<string, "required">;
1103
+ claimToken: import("convex/values").VString<string | undefined, "optional">;
1104
+ claimOwner: import("convex/values").VString<string | undefined, "optional">;
1105
+ leaseExpiresAt: import("convex/values").VFloat64<number, "required">;
1106
+ attemptCount: import("convex/values").VFloat64<number, "required">;
1107
+ runtimeThreadId: import("convex/values").VString<string | undefined, "optional">;
1108
+ runtimeTurnId: import("convex/values").VString<string | undefined, "optional">;
1109
+ failureCode: import("convex/values").VString<string | undefined, "optional">;
1110
+ failureReason: import("convex/values").VString<string | undefined, "optional">;
1111
+ createdAt: import("convex/values").VFloat64<number, "required">;
1112
+ updatedAt: import("convex/values").VFloat64<number, "required">;
1113
+ startedAt: import("convex/values").VFloat64<number | undefined, "optional">;
1114
+ completedAt: import("convex/values").VFloat64<number | undefined, "optional">;
1115
+ cancelledAt: import("convex/values").VFloat64<number | undefined, "optional">;
1116
+ }, "required", "inputText" | "status" | "turnId" | "createdAt" | "updatedAt" | "idempotencyKey" | "startedAt" | "completedAt" | "dispatchId" | "claimOwner" | "claimToken" | "leaseExpiresAt" | "attemptCount" | "runtimeThreadId" | "runtimeTurnId" | "failureCode" | "failureReason" | "cancelledAt">], "required", "inputText" | "status" | "turnId" | "createdAt" | "updatedAt" | "idempotencyKey" | "startedAt" | "completedAt" | "dispatchId" | "claimOwner" | "claimToken" | "leaseExpiresAt" | "attemptCount" | "runtimeThreadId" | "runtimeTurnId" | "failureCode" | "failureReason" | "cancelledAt">;
1117
+ claim: import("convex/values").VObject<{
1118
+ leaseExpiresAt?: number;
1119
+ owner?: string;
1120
+ token?: string;
1121
+ active: boolean;
1122
+ }, {
1123
+ owner: import("convex/values").VString<string | undefined, "optional">;
1124
+ token: import("convex/values").VString<string | undefined, "optional">;
1125
+ leaseExpiresAt: import("convex/values").VFloat64<number | undefined, "optional">;
1126
+ active: import("convex/values").VBoolean<boolean, "required">;
1127
+ }, "required", "active" | "leaseExpiresAt" | "owner" | "token">;
1128
+ runtime: import("convex/values").VObject<{
1129
+ runtimeThreadId?: string;
1130
+ runtimeTurnId?: string;
1131
+ inFlight: boolean;
1132
+ }, {
1133
+ runtimeThreadId: import("convex/values").VString<string | undefined, "optional">;
1134
+ runtimeTurnId: import("convex/values").VString<string | undefined, "optional">;
1135
+ inFlight: import("convex/values").VBoolean<boolean, "required">;
1136
+ }, "required", "runtimeThreadId" | "runtimeTurnId" | "inFlight">;
1137
+ turn: import("convex/values").VObject<{
1138
+ status?: string;
1139
+ turnId?: string;
1140
+ }, {
1141
+ turnId: import("convex/values").VString<string | undefined, "optional">;
1142
+ status: import("convex/values").VString<string | undefined, "optional">;
1143
+ }, "required", "status" | "turnId">;
1144
+ correlations: import("convex/values").VObject<{
1145
+ dispatchId?: string;
1146
+ claimToken?: string;
1147
+ runtimeThreadId?: string;
1148
+ runtimeTurnId?: string;
1149
+ localTurnId?: string;
1150
+ }, {
1151
+ dispatchId: import("convex/values").VString<string | undefined, "optional">;
1152
+ claimToken: import("convex/values").VString<string | undefined, "optional">;
1153
+ localTurnId: import("convex/values").VString<string | undefined, "optional">;
1154
+ runtimeTurnId: import("convex/values").VString<string | undefined, "optional">;
1155
+ runtimeThreadId: import("convex/values").VString<string | undefined, "optional">;
1156
+ }, "required", "dispatchId" | "claimToken" | "runtimeThreadId" | "runtimeTurnId" | "localTurnId">;
1157
+ }, "required", "threadId" | "turn" | "runtime" | "dispatch" | "claim" | "correlations" | "turn.status" | "turn.turnId" | "runtime.runtimeThreadId" | "runtime.runtimeTurnId" | "runtime.inFlight" | "dispatch.inputText" | "dispatch.status" | "dispatch.turnId" | "dispatch.createdAt" | "dispatch.updatedAt" | "dispatch.idempotencyKey" | "dispatch.startedAt" | "dispatch.completedAt" | "dispatch.dispatchId" | "dispatch.claimOwner" | "dispatch.claimToken" | "dispatch.leaseExpiresAt" | "dispatch.attemptCount" | "dispatch.runtimeThreadId" | "dispatch.runtimeTurnId" | "dispatch.failureCode" | "dispatch.failureReason" | "dispatch.cancelledAt" | "claim.active" | "claim.leaseExpiresAt" | "claim.owner" | "claim.token" | "correlations.dispatchId" | "correlations.claimToken" | "correlations.runtimeThreadId" | "correlations.runtimeTurnId" | "correlations.localTurnId">;
1158
+ handler: (ctx: HostQueryRunner, args: {
1159
+ actor: HostActorContext;
1160
+ threadId: string;
1161
+ dispatchId?: string;
1162
+ turnId?: string;
1163
+ }) => Promise<{
1164
+ threadId: string;
1165
+ dispatch: import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["dispatch"]["getTurnDispatchState"]>;
1166
+ claim: {
1167
+ owner?: string;
1168
+ token?: string;
1169
+ leaseExpiresAt?: number;
1170
+ active: boolean;
1171
+ };
1172
+ runtime: {
1173
+ runtimeThreadId?: string;
1174
+ runtimeTurnId?: string;
1175
+ inFlight: boolean;
1176
+ };
1177
+ turn: {
1178
+ turnId?: string;
1179
+ status?: string;
1180
+ };
1181
+ correlations: {
1182
+ dispatchId?: string;
1183
+ claimToken?: string;
1184
+ localTurnId?: string;
1185
+ runtimeTurnId?: string;
1186
+ runtimeThreadId?: string;
1187
+ };
1188
+ }>;
1189
+ };
1190
+ validateHostWiring: {
1191
+ args: {
1192
+ actor: import("convex/values").VObject<{
1193
+ userId?: string;
1194
+ }, {
1195
+ userId: import("convex/values").VString<string | undefined, "optional">;
1196
+ }, "required", "userId">;
1197
+ threadId: import("convex/values").VString<string | undefined, "optional">;
1198
+ };
1199
+ handler: (ctx: HostQueryRunner, args: {
1200
+ actor: HostActorContext;
1201
+ threadId?: string;
1202
+ }) => Promise<{
1203
+ ok: boolean;
1204
+ checks: {
1205
+ name: string;
1206
+ ok: boolean;
1207
+ error?: string;
1208
+ }[];
1209
+ }>;
1210
+ };
1211
+ getTurnDispatchState: {
1212
+ args: {
1213
+ actor: import("convex/values").VObject<{
1214
+ userId?: string;
1215
+ }, {
1216
+ userId: import("convex/values").VString<string | undefined, "optional">;
1217
+ }, "required", "userId">;
1218
+ threadId: import("convex/values").VString<string, "required">;
1219
+ dispatchId: import("convex/values").VString<string | undefined, "optional">;
1220
+ turnId: import("convex/values").VString<string | undefined, "optional">;
1221
+ };
1222
+ returns: import("convex/values").VUnion<{
1223
+ startedAt?: number;
1224
+ completedAt?: number;
1225
+ claimOwner?: string;
1226
+ claimToken?: string;
1227
+ runtimeThreadId?: string;
1228
+ runtimeTurnId?: string;
1229
+ failureCode?: string;
1230
+ failureReason?: string;
1231
+ cancelledAt?: number;
1232
+ inputText: string;
1233
+ status: "completed" | "failed" | "cancelled" | "queued" | "claimed" | "started";
1234
+ turnId: string;
1235
+ createdAt: number;
1236
+ updatedAt: number;
1237
+ idempotencyKey: string;
1238
+ dispatchId: string;
1239
+ leaseExpiresAt: number;
1240
+ attemptCount: number;
1241
+ } | null, [import("convex/values").VNull<null, "required">, import("convex/values").VObject<{
1242
+ startedAt?: number;
1243
+ completedAt?: number;
1244
+ claimOwner?: string;
1245
+ claimToken?: string;
1246
+ runtimeThreadId?: string;
1247
+ runtimeTurnId?: string;
1248
+ failureCode?: string;
1249
+ failureReason?: string;
1250
+ cancelledAt?: number;
1251
+ inputText: string;
1252
+ status: "completed" | "failed" | "cancelled" | "queued" | "claimed" | "started";
1253
+ turnId: string;
1254
+ createdAt: number;
1255
+ updatedAt: number;
1256
+ idempotencyKey: string;
1257
+ dispatchId: string;
1258
+ leaseExpiresAt: number;
1259
+ attemptCount: number;
1260
+ }, {
1261
+ dispatchId: import("convex/values").VString<string, "required">;
1262
+ turnId: import("convex/values").VString<string, "required">;
1263
+ status: import("convex/values").VUnion<"completed" | "failed" | "cancelled" | "queued" | "claimed" | "started", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"claimed", "required">, import("convex/values").VLiteral<"started", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"cancelled", "required">], "required", never>;
1264
+ idempotencyKey: import("convex/values").VString<string, "required">;
1265
+ inputText: import("convex/values").VString<string, "required">;
1266
+ claimToken: import("convex/values").VString<string | undefined, "optional">;
1267
+ claimOwner: import("convex/values").VString<string | undefined, "optional">;
1268
+ leaseExpiresAt: import("convex/values").VFloat64<number, "required">;
1269
+ attemptCount: import("convex/values").VFloat64<number, "required">;
1270
+ runtimeThreadId: import("convex/values").VString<string | undefined, "optional">;
1271
+ runtimeTurnId: import("convex/values").VString<string | undefined, "optional">;
1272
+ failureCode: import("convex/values").VString<string | undefined, "optional">;
1273
+ failureReason: import("convex/values").VString<string | undefined, "optional">;
1274
+ createdAt: import("convex/values").VFloat64<number, "required">;
1275
+ updatedAt: import("convex/values").VFloat64<number, "required">;
1276
+ startedAt: import("convex/values").VFloat64<number | undefined, "optional">;
1277
+ completedAt: import("convex/values").VFloat64<number | undefined, "optional">;
1278
+ cancelledAt: import("convex/values").VFloat64<number | undefined, "optional">;
1279
+ }, "required", "inputText" | "status" | "turnId" | "createdAt" | "updatedAt" | "idempotencyKey" | "startedAt" | "completedAt" | "dispatchId" | "claimOwner" | "claimToken" | "leaseExpiresAt" | "attemptCount" | "runtimeThreadId" | "runtimeTurnId" | "failureCode" | "failureReason" | "cancelledAt">], "required", "inputText" | "status" | "turnId" | "createdAt" | "updatedAt" | "idempotencyKey" | "startedAt" | "completedAt" | "dispatchId" | "claimOwner" | "claimToken" | "leaseExpiresAt" | "attemptCount" | "runtimeThreadId" | "runtimeTurnId" | "failureCode" | "failureReason" | "cancelledAt">;
1280
+ handler: (ctx: HostQueryRunner, args: {
1281
+ actor: HostActorContext;
1282
+ threadId: string;
1283
+ dispatchId?: string;
1284
+ turnId?: string;
1285
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["dispatch"]["getTurnDispatchState"]>>;
1286
+ };
1287
+ threadSnapshot: {
1288
+ args: {
1289
+ actor: import("convex/values").VObject<{
1290
+ userId?: string;
1291
+ }, {
1292
+ userId: import("convex/values").VString<string | undefined, "optional">;
1293
+ }, "required", "userId">;
1294
+ threadId: import("convex/values").VString<string, "required">;
1295
+ };
1296
+ handler: (ctx: HostQueryRunner, args: {
1297
+ actor: HostActorContext;
1298
+ threadId: string;
1299
+ }) => Promise<import("convex/server").FunctionReturnType<ExtractCodexHostComponentRefs<Components>["threads"]["getState"]>>;
1300
+ };
1301
+ persistenceStats: {
1302
+ args: {
1303
+ actor: import("convex/values").VObject<{
1304
+ userId?: string;
1305
+ }, {
1306
+ userId: import("convex/values").VString<string | undefined, "optional">;
1307
+ }, "required", "userId">;
1308
+ threadId: import("convex/values").VString<string, "required">;
1309
+ };
1310
+ returns: import("convex/values").VObject<{
1311
+ deltaCount: number;
1312
+ streamCount: number;
1313
+ latestCursorByStream: {
1314
+ cursor: number;
1315
+ streamId: string;
1316
+ }[];
1317
+ }, {
1318
+ streamCount: import("convex/values").VFloat64<number, "required">;
1319
+ deltaCount: import("convex/values").VFloat64<number, "required">;
1320
+ latestCursorByStream: import("convex/values").VArray<{
1321
+ cursor: number;
1322
+ streamId: string;
1323
+ }[], import("convex/values").VObject<{
1324
+ cursor: number;
1325
+ streamId: string;
1326
+ }, {
1327
+ streamId: import("convex/values").VString<string, "required">;
1328
+ cursor: import("convex/values").VFloat64<number, "required">;
1329
+ }, "required", "cursor" | "streamId">, "required">;
1330
+ }, "required", "deltaCount" | "streamCount" | "latestCursorByStream">;
1331
+ handler: (ctx: HostQueryRunner, args: {
1332
+ actor: HostActorContext;
1333
+ threadId: string;
1334
+ }) => Promise<{
1335
+ streamCount: number;
1336
+ deltaCount: number;
1337
+ latestCursorByStream: Array<{
1338
+ streamId: string;
1339
+ cursor: number;
1340
+ }>;
1341
+ }>;
1342
+ };
1343
+ durableHistoryStats: {
1344
+ args: {
1345
+ actor: import("convex/values").VObject<{
1346
+ userId?: string;
1347
+ }, {
1348
+ userId: import("convex/values").VString<string | undefined, "optional">;
1349
+ }, "required", "userId">;
1350
+ threadId: import("convex/values").VString<string, "required">;
1351
+ };
1352
+ returns: import("convex/values").VObject<{
1353
+ messageCountInPage: number;
1354
+ latest: {
1355
+ text: string;
1356
+ role: string;
1357
+ status: string;
1358
+ turnId: string;
1359
+ messageId: string;
1360
+ }[];
1361
+ }, {
1362
+ messageCountInPage: import("convex/values").VFloat64<number, "required">;
1363
+ latest: import("convex/values").VArray<{
1364
+ text: string;
1365
+ role: string;
1366
+ status: string;
1367
+ turnId: string;
1368
+ messageId: string;
1369
+ }[], import("convex/values").VObject<{
1370
+ text: string;
1371
+ role: string;
1372
+ status: string;
1373
+ turnId: string;
1374
+ messageId: string;
1375
+ }, {
1376
+ messageId: import("convex/values").VString<string, "required">;
1377
+ turnId: import("convex/values").VString<string, "required">;
1378
+ role: import("convex/values").VString<string, "required">;
1379
+ status: import("convex/values").VString<string, "required">;
1380
+ text: import("convex/values").VString<string, "required">;
1381
+ }, "required", "text" | "role" | "status" | "turnId" | "messageId">, "required">;
1382
+ }, "required", "messageCountInPage" | "latest">;
1383
+ handler: (ctx: HostQueryRunner, args: {
1384
+ actor: HostActorContext;
1385
+ threadId: string;
1386
+ }) => Promise<{
1387
+ messageCountInPage: number;
1388
+ latest: {
1389
+ messageId: string;
1390
+ turnId: string;
1391
+ role: string;
1392
+ status: string;
1393
+ text: string;
1394
+ }[];
1395
+ }>;
1396
+ };
1397
+ };
1398
+ };
1399
+ type CodexHostSliceDefinitions = ReturnType<typeof defineCodexHostSlice>;
1400
+ type PickRequiredKeys<T, Keys extends keyof T> = {
1401
+ [K in Keys]-?: T[K];
1402
+ };
1403
+ type DispatchManagedMutationKeys = (typeof HOST_SURFACE_MANIFEST.dispatchManaged.mutations)[number];
1404
+ type DispatchManagedQueryKeys = (typeof HOST_SURFACE_MANIFEST.dispatchManaged.queries)[number];
1405
+ type RuntimeOwnedMutationKeys = (typeof HOST_SURFACE_MANIFEST.runtimeOwned.mutations)[number];
1406
+ type RuntimeOwnedQueryKeys = (typeof HOST_SURFACE_MANIFEST.runtimeOwned.queries)[number];
1407
+ export type DispatchManagedHostDefinitions = {
1408
+ profile: "dispatchManaged";
1409
+ mutations: PickRequiredKeys<CodexHostSliceDefinitions["mutations"], DispatchManagedMutationKeys>;
1410
+ queries: PickRequiredKeys<CodexHostSliceDefinitions["queries"], DispatchManagedQueryKeys>;
1411
+ };
1412
+ export type RuntimeOwnedHostDefinitions = {
1413
+ profile: "runtimeOwned";
1414
+ mutations: PickRequiredKeys<CodexHostSliceDefinitions["mutations"], RuntimeOwnedMutationKeys>;
1415
+ queries: PickRequiredKeys<CodexHostSliceDefinitions["queries"], RuntimeOwnedQueryKeys>;
1416
+ };
1417
+ export type DefineDispatchManagedHostSliceOptions<Components extends CodexHostComponentsInput = CodexHostComponentsInput> = Pick<DefineCodexHostSliceOptions<Components>, "components" | "serverActor">;
1418
+ export type DefineRuntimeOwnedHostSliceOptions<Components extends CodexHostComponentsInput = CodexHostComponentsInput> = Pick<DefineCodexHostSliceOptions<Components>, "components" | "serverActor">;
1419
+ export declare function defineDispatchManagedHostSlice<Components extends CodexHostComponentsInput>(options: DefineDispatchManagedHostSliceOptions<Components>): DispatchManagedHostDefinitions;
1420
+ export declare function defineRuntimeOwnedHostSlice<Components extends CodexHostComponentsInput>(options: DefineRuntimeOwnedHostSliceOptions<Components>): RuntimeOwnedHostDefinitions;
1421
+ export {};
1422
+ //# sourceMappingURL=convexPreset.d.ts.map