@niwa-labs/harness-codex 0.0.0-stage → 0.0.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.
- package/LICENSE +21 -0
- package/README.md +16 -2
- package/package.json +20 -4
- package/scripts/gen-codex.ts +352 -0
- package/src/control.ts +1596 -0
- package/src/fixtures.ts +103 -0
- package/src/format.ts +196 -0
- package/src/incoming.ts +273 -0
- package/src/index.ts +128 -0
- package/src/paths.ts +42 -0
- package/src/protocol/generated/app-server.ts +2818 -0
- package/src/protocol/index.ts +106 -0
- package/src/reading.ts +940 -0
- package/src/refusals.ts +72 -0
- package/src/reverse.ts +243 -0
- package/src/skills.ts +6 -0
- package/src/tools.ts +69 -0
- package/test/codex-conformance.test.ts +29 -0
- package/test/codex-control-process.test.ts +1239 -0
- package/test/codex-control.test.ts +217 -0
- package/test/codex-elicitation.test.ts +71 -0
- package/test/codex-protocol.test.ts +245 -0
- package/test/codex-reading.test.ts +513 -0
- package/test/fixtures/codex-app-server/captured.jsonl +21 -0
- package/test/fixtures/codex-frames.ts +88 -0
- package/test/fixtures/zod-instance.ts +35 -0
- package/test/profile.test.ts +48 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,2818 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The messages of `codex app-server`, as zod schemas and types.
|
|
3
|
+
*
|
|
4
|
+
* GENERATED by scripts/gen-codex.ts from codex-cli 0.169.0-alpha.11.1. Do not edit: run `bun scripts/gen-codex.ts`.
|
|
5
|
+
* Command: codex app-server generate-json-schema --out <dir> (the stable surface, no --experimental)
|
|
6
|
+
* Objects are open: a field a newer codex adds does not fail a message. Descriptions are in the upstream schema.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
|
|
11
|
+
export const AbsolutePathBufSchema = z.string();
|
|
12
|
+
export type AbsolutePathBuf = z.infer<typeof AbsolutePathBufSchema>;
|
|
13
|
+
|
|
14
|
+
export const DesktopOnboardingEntrypointSchema = z.literal("life_sciences");
|
|
15
|
+
export type DesktopOnboardingEntrypoint = z.infer<typeof DesktopOnboardingEntrypointSchema>;
|
|
16
|
+
|
|
17
|
+
export const AccountLoginCompletedNotificationSchema = z.object({
|
|
18
|
+
"error": z.union([z.string(), z.null()]).optional(),
|
|
19
|
+
"loginId": z.union([z.string(), z.null()]).optional(),
|
|
20
|
+
"onboardingEntrypoint": z.union([DesktopOnboardingEntrypointSchema, z.null()]).optional(),
|
|
21
|
+
"success": z.boolean(),
|
|
22
|
+
});
|
|
23
|
+
export type AccountLoginCompletedNotification = z.infer<typeof AccountLoginCompletedNotificationSchema>;
|
|
24
|
+
|
|
25
|
+
export const CreditsSnapshotSchema = z.object({
|
|
26
|
+
"balance": z.union([z.string(), z.null()]).optional(),
|
|
27
|
+
"hasCredits": z.boolean(),
|
|
28
|
+
"unlimited": z.boolean(),
|
|
29
|
+
});
|
|
30
|
+
export type CreditsSnapshot = z.infer<typeof CreditsSnapshotSchema>;
|
|
31
|
+
|
|
32
|
+
export const PlanTypeSchema = z.enum([
|
|
33
|
+
"free",
|
|
34
|
+
"go",
|
|
35
|
+
"plus",
|
|
36
|
+
"pro",
|
|
37
|
+
"prolite",
|
|
38
|
+
"promax",
|
|
39
|
+
"team",
|
|
40
|
+
"self_serve_business_prolite",
|
|
41
|
+
"self_serve_business_usage_based",
|
|
42
|
+
"business",
|
|
43
|
+
"ent26",
|
|
44
|
+
"enterprise_cbp_automation",
|
|
45
|
+
"enterprise_cbp_usage_based",
|
|
46
|
+
"enterprise",
|
|
47
|
+
"edu",
|
|
48
|
+
"edu_plus",
|
|
49
|
+
"edu_pro",
|
|
50
|
+
"sci",
|
|
51
|
+
"sci_plus",
|
|
52
|
+
"unknown",
|
|
53
|
+
]);
|
|
54
|
+
export type PlanType = z.infer<typeof PlanTypeSchema>;
|
|
55
|
+
|
|
56
|
+
export const RateLimitReachedTypeSchema = z.enum([
|
|
57
|
+
"rate_limit_reached",
|
|
58
|
+
"workspace_owner_credits_depleted",
|
|
59
|
+
"workspace_member_credits_depleted",
|
|
60
|
+
"workspace_owner_usage_limit_reached",
|
|
61
|
+
"workspace_member_usage_limit_reached",
|
|
62
|
+
]);
|
|
63
|
+
export type RateLimitReachedType = z.infer<typeof RateLimitReachedTypeSchema>;
|
|
64
|
+
|
|
65
|
+
export const RateLimitWindowSchema = z.object({
|
|
66
|
+
"resetsAt": z.union([z.number().int(), z.null()]).optional(),
|
|
67
|
+
"usedPercent": z.number().int(),
|
|
68
|
+
"windowDurationMins": z.union([z.number().int(), z.null()]).optional(),
|
|
69
|
+
});
|
|
70
|
+
export type RateLimitWindow = z.infer<typeof RateLimitWindowSchema>;
|
|
71
|
+
|
|
72
|
+
export const SpendControlLimitSnapshotSchema = z.object({
|
|
73
|
+
"limit": z.string(),
|
|
74
|
+
"remainingPercent": z.number().int(),
|
|
75
|
+
"resetsAt": z.number().int(),
|
|
76
|
+
"used": z.string(),
|
|
77
|
+
});
|
|
78
|
+
export type SpendControlLimitSnapshot = z.infer<typeof SpendControlLimitSnapshotSchema>;
|
|
79
|
+
|
|
80
|
+
export const RateLimitSnapshotSchema = z.object({
|
|
81
|
+
"credits": z.union([CreditsSnapshotSchema, z.null()]).optional(),
|
|
82
|
+
"individualLimit": z.union([SpendControlLimitSnapshotSchema, z.null()]).optional(),
|
|
83
|
+
"limitId": z.union([z.string(), z.null()]).optional(),
|
|
84
|
+
"limitName": z.union([z.string(), z.null()]).optional(),
|
|
85
|
+
"normalModelSlug": z.union([z.string(), z.null()]).optional(),
|
|
86
|
+
"planType": z.union([PlanTypeSchema, z.null()]).optional(),
|
|
87
|
+
"primary": z.union([RateLimitWindowSchema, z.null()]).optional(),
|
|
88
|
+
"rateLimitReachedType": z.union([RateLimitReachedTypeSchema, z.null()]).optional(),
|
|
89
|
+
"secondary": z.union([RateLimitWindowSchema, z.null()]).optional(),
|
|
90
|
+
"spendControlReached": z.union([z.boolean(), z.null()]).optional(),
|
|
91
|
+
});
|
|
92
|
+
export type RateLimitSnapshot = z.infer<typeof RateLimitSnapshotSchema>;
|
|
93
|
+
|
|
94
|
+
export const AccountRateLimitsUpdatedNotificationSchema = z.object({ "rateLimits": RateLimitSnapshotSchema });
|
|
95
|
+
export type AccountRateLimitsUpdatedNotification = z.infer<typeof AccountRateLimitsUpdatedNotificationSchema>;
|
|
96
|
+
|
|
97
|
+
export const AuthModeSchema = z.union([
|
|
98
|
+
z.literal("apikey"),
|
|
99
|
+
z.literal("chatgpt"),
|
|
100
|
+
z.literal("chatgptAuthTokens"),
|
|
101
|
+
z.literal("headers"),
|
|
102
|
+
z.literal("agentIdentity"),
|
|
103
|
+
z.literal("personalAccessToken"),
|
|
104
|
+
z.literal("bedrockApiKey"),
|
|
105
|
+
z.literal("bedrockAccessKeys"),
|
|
106
|
+
]);
|
|
107
|
+
export type AuthMode = z.infer<typeof AuthModeSchema>;
|
|
108
|
+
|
|
109
|
+
export const AccountUpdatedNotificationSchema = z.object({
|
|
110
|
+
"authMode": z.union([AuthModeSchema, z.null()]).optional(),
|
|
111
|
+
"planType": z.union([PlanTypeSchema, z.null()]).optional(),
|
|
112
|
+
});
|
|
113
|
+
export type AccountUpdatedNotification = z.infer<typeof AccountUpdatedNotificationSchema>;
|
|
114
|
+
|
|
115
|
+
export const ActivePermissionProfileSchema = z.object({
|
|
116
|
+
"extends": z.union([z.string(), z.null()]).default(null),
|
|
117
|
+
"id": z.string(),
|
|
118
|
+
});
|
|
119
|
+
export type ActivePermissionProfile = z.infer<typeof ActivePermissionProfileSchema>;
|
|
120
|
+
|
|
121
|
+
export const FileSystemAccessModeSchema = z.enum(["read", "write", "deny"]);
|
|
122
|
+
export type FileSystemAccessMode = z.infer<typeof FileSystemAccessModeSchema>;
|
|
123
|
+
|
|
124
|
+
export const LegacyAppPathStringSchema = z.string();
|
|
125
|
+
export type LegacyAppPathString = z.infer<typeof LegacyAppPathStringSchema>;
|
|
126
|
+
|
|
127
|
+
export const FileSystemSpecialPathSchema = z.discriminatedUnion("kind", [
|
|
128
|
+
z.object({ "kind": z.literal("root") }),
|
|
129
|
+
z.object({ "kind": z.literal("minimal") }),
|
|
130
|
+
z.object({
|
|
131
|
+
"kind": z.literal("project_roots"),
|
|
132
|
+
"subpath": z.union([LegacyAppPathStringSchema, z.null()]).optional(),
|
|
133
|
+
}),
|
|
134
|
+
z.object({ "kind": z.literal("tmpdir") }),
|
|
135
|
+
z.object({ "kind": z.literal("slash_tmp") }),
|
|
136
|
+
z.object({
|
|
137
|
+
"kind": z.literal("unknown"),
|
|
138
|
+
"path": z.string(),
|
|
139
|
+
"subpath": z.union([LegacyAppPathStringSchema, z.null()]).optional(),
|
|
140
|
+
}),
|
|
141
|
+
]);
|
|
142
|
+
export type FileSystemSpecialPath = z.infer<typeof FileSystemSpecialPathSchema>;
|
|
143
|
+
|
|
144
|
+
export const FileSystemPathSchema = z.discriminatedUnion("type", [
|
|
145
|
+
z.object({ "path": LegacyAppPathStringSchema, "type": z.literal("path") }),
|
|
146
|
+
z.object({ "pattern": z.string(), "type": z.literal("glob_pattern") }),
|
|
147
|
+
z.object({ "type": z.literal("special"), "value": FileSystemSpecialPathSchema }),
|
|
148
|
+
]);
|
|
149
|
+
export type FileSystemPath = z.infer<typeof FileSystemPathSchema>;
|
|
150
|
+
|
|
151
|
+
export const FileSystemSandboxEntrySchema = z.object({
|
|
152
|
+
"access": FileSystemAccessModeSchema,
|
|
153
|
+
"path": FileSystemPathSchema,
|
|
154
|
+
});
|
|
155
|
+
export type FileSystemSandboxEntry = z.infer<typeof FileSystemSandboxEntrySchema>;
|
|
156
|
+
|
|
157
|
+
export const AdditionalFileSystemPermissionsSchema = z.object({
|
|
158
|
+
"entries": z.union([z.array(FileSystemSandboxEntrySchema), z.null()]).optional(),
|
|
159
|
+
"globScanMaxDepth": z.union([z.number().int().gte(1), z.null()]).optional(),
|
|
160
|
+
"read": z.union([z.array(LegacyAppPathStringSchema), z.null()]).optional(),
|
|
161
|
+
"write": z.union([z.array(LegacyAppPathStringSchema), z.null()]).optional(),
|
|
162
|
+
});
|
|
163
|
+
export type AdditionalFileSystemPermissions = z.infer<typeof AdditionalFileSystemPermissionsSchema>;
|
|
164
|
+
|
|
165
|
+
export const AdditionalNetworkPermissionsSchema = z.object({
|
|
166
|
+
"enabled": z.union([z.boolean(), z.null()]).optional(),
|
|
167
|
+
});
|
|
168
|
+
export type AdditionalNetworkPermissions = z.infer<typeof AdditionalNetworkPermissionsSchema>;
|
|
169
|
+
|
|
170
|
+
export const AdditionalPermissionProfileSchema = z.object({
|
|
171
|
+
"fileSystem": z.union([AdditionalFileSystemPermissionsSchema, z.null()]).optional(),
|
|
172
|
+
"network": z.union([AdditionalNetworkPermissionsSchema, z.null()]).optional(),
|
|
173
|
+
});
|
|
174
|
+
export type AdditionalPermissionProfile = z.infer<typeof AdditionalPermissionProfileSchema>;
|
|
175
|
+
|
|
176
|
+
export const AgentMessageDeliverySchema = z.literal("async");
|
|
177
|
+
export type AgentMessageDelivery = z.infer<typeof AgentMessageDeliverySchema>;
|
|
178
|
+
|
|
179
|
+
export const AgentMessageDeltaNotificationSchema = z.object({
|
|
180
|
+
"delta": z.string(),
|
|
181
|
+
"itemId": z.string(),
|
|
182
|
+
"threadId": z.string(),
|
|
183
|
+
"turnId": z.string(),
|
|
184
|
+
});
|
|
185
|
+
export type AgentMessageDeltaNotification = z.infer<typeof AgentMessageDeltaNotificationSchema>;
|
|
186
|
+
|
|
187
|
+
export const AgentMessageDisplaySchema = z.object({
|
|
188
|
+
"action": z.string(),
|
|
189
|
+
"blockType": z.union([z.string(), z.null()]).optional(),
|
|
190
|
+
"checkTrustedContacts": z.union([z.boolean(), z.null()]).optional(),
|
|
191
|
+
"cyberTrustedAccess": z.union([z.boolean(), z.null()]).optional(),
|
|
192
|
+
});
|
|
193
|
+
export type AgentMessageDisplay = z.infer<typeof AgentMessageDisplaySchema>;
|
|
194
|
+
|
|
195
|
+
export const AgentMessageModerationSchema = z.object({
|
|
196
|
+
"display": z.union([AgentMessageDisplaySchema, z.null()]).optional(),
|
|
197
|
+
"moderated": z.boolean(),
|
|
198
|
+
});
|
|
199
|
+
export type AgentMessageModeration = z.infer<typeof AgentMessageModerationSchema>;
|
|
200
|
+
|
|
201
|
+
export const AgentPathSchema = z.string();
|
|
202
|
+
export type AgentPath = z.infer<typeof AgentPathSchema>;
|
|
203
|
+
|
|
204
|
+
export const AppBrandingSchema = z.object({
|
|
205
|
+
"category": z.union([z.string(), z.null()]).optional(),
|
|
206
|
+
"developer": z.union([z.string(), z.null()]).optional(),
|
|
207
|
+
"isDiscoverableApp": z.boolean(),
|
|
208
|
+
"privacyPolicy": z.union([z.string(), z.null()]).optional(),
|
|
209
|
+
"termsOfService": z.union([z.string(), z.null()]).optional(),
|
|
210
|
+
"website": z.union([z.string(), z.null()]).optional(),
|
|
211
|
+
});
|
|
212
|
+
export type AppBranding = z.infer<typeof AppBrandingSchema>;
|
|
213
|
+
|
|
214
|
+
export const AppReviewSchema = z.object({ "status": z.string() });
|
|
215
|
+
export type AppReview = z.infer<typeof AppReviewSchema>;
|
|
216
|
+
|
|
217
|
+
export const AppScreenshotSchema = z.object({
|
|
218
|
+
"fileId": z.union([z.string(), z.null()]).optional(),
|
|
219
|
+
"url": z.union([z.string(), z.null()]).optional(),
|
|
220
|
+
"userPrompt": z.string(),
|
|
221
|
+
});
|
|
222
|
+
export type AppScreenshot = z.infer<typeof AppScreenshotSchema>;
|
|
223
|
+
|
|
224
|
+
export const AppMetadataSchema = z.object({
|
|
225
|
+
"categories": z.union([z.array(z.string()), z.null()]).optional(),
|
|
226
|
+
"developer": z.union([z.string(), z.null()]).optional(),
|
|
227
|
+
"firstPartyRequiresInstall": z.union([z.boolean(), z.null()]).optional(),
|
|
228
|
+
"review": z.union([AppReviewSchema, z.null()]).optional(),
|
|
229
|
+
"screenshots": z.union([z.array(AppScreenshotSchema), z.null()]).optional(),
|
|
230
|
+
"seoDescription": z.union([z.string(), z.null()]).optional(),
|
|
231
|
+
"showInComposerWhenUnlinked": z.union([z.boolean(), z.null()]).optional(),
|
|
232
|
+
"subCategories": z.union([z.array(z.string()), z.null()]).optional(),
|
|
233
|
+
"version": z.union([z.string(), z.null()]).optional(),
|
|
234
|
+
"versionId": z.union([z.string(), z.null()]).optional(),
|
|
235
|
+
"versionNotes": z.union([z.string(), z.null()]).optional(),
|
|
236
|
+
});
|
|
237
|
+
export type AppMetadata = z.infer<typeof AppMetadataSchema>;
|
|
238
|
+
|
|
239
|
+
export const AppInfoSchema = z.object({
|
|
240
|
+
"appMetadata": z.union([AppMetadataSchema, z.null()]).optional(),
|
|
241
|
+
"branding": z.union([AppBrandingSchema, z.null()]).optional(),
|
|
242
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
243
|
+
"distributionChannel": z.union([z.string(), z.null()]).optional(),
|
|
244
|
+
"iconAssets": z.union([z.record(z.string(), z.string()), z.null()]).optional(),
|
|
245
|
+
"iconDarkAssets": z.union([z.record(z.string(), z.string()), z.null()]).optional(),
|
|
246
|
+
"id": z.string(),
|
|
247
|
+
"installUrl": z.union([z.string(), z.null()]).optional(),
|
|
248
|
+
"isAccessible": z.boolean().default(false),
|
|
249
|
+
"isEnabled": z.boolean().default(true),
|
|
250
|
+
"labels": z.union([z.record(z.string(), z.string()), z.null()]).optional(),
|
|
251
|
+
"logoUrl": z.union([z.string(), z.null()]).optional(),
|
|
252
|
+
"logoUrlDark": z.union([z.string(), z.null()]).optional(),
|
|
253
|
+
"name": z.string(),
|
|
254
|
+
"pluginDisplayNames": z.array(z.string()).default([]),
|
|
255
|
+
});
|
|
256
|
+
export type AppInfo = z.infer<typeof AppInfoSchema>;
|
|
257
|
+
|
|
258
|
+
export const AppListUpdatedNotificationSchema = z.object({ "data": z.array(AppInfoSchema) });
|
|
259
|
+
export type AppListUpdatedNotification = z.infer<typeof AppListUpdatedNotificationSchema>;
|
|
260
|
+
|
|
261
|
+
export const FileChangeSchema = z.discriminatedUnion("type", [
|
|
262
|
+
z.object({ "content": z.string(), "type": z.literal("add") }),
|
|
263
|
+
z.object({ "content": z.string(), "type": z.literal("delete") }),
|
|
264
|
+
z.object({
|
|
265
|
+
"move_path": z.union([z.string(), z.null()]).optional(),
|
|
266
|
+
"type": z.literal("update"),
|
|
267
|
+
"unified_diff": z.string(),
|
|
268
|
+
}),
|
|
269
|
+
]);
|
|
270
|
+
export type FileChange = z.infer<typeof FileChangeSchema>;
|
|
271
|
+
|
|
272
|
+
export const ThreadIdSchema = z.string();
|
|
273
|
+
export type ThreadId = z.infer<typeof ThreadIdSchema>;
|
|
274
|
+
|
|
275
|
+
export const ApplyPatchApprovalParamsSchema = z.object({
|
|
276
|
+
"callId": z.string(),
|
|
277
|
+
"conversationId": ThreadIdSchema,
|
|
278
|
+
"fileChanges": z.record(z.string(), FileChangeSchema),
|
|
279
|
+
"grantRoot": z.union([z.string(), z.null()]).optional(),
|
|
280
|
+
"reason": z.union([z.string(), z.null()]).optional(),
|
|
281
|
+
});
|
|
282
|
+
export type ApplyPatchApprovalParams = z.infer<typeof ApplyPatchApprovalParamsSchema>;
|
|
283
|
+
|
|
284
|
+
export const NetworkPolicyRuleActionSchema = z.enum(["allow", "deny"]);
|
|
285
|
+
export type NetworkPolicyRuleAction = z.infer<typeof NetworkPolicyRuleActionSchema>;
|
|
286
|
+
|
|
287
|
+
export const NetworkPolicyAmendmentSchema = z.object({
|
|
288
|
+
"action": NetworkPolicyRuleActionSchema,
|
|
289
|
+
"host": z.string(),
|
|
290
|
+
});
|
|
291
|
+
export type NetworkPolicyAmendment = z.infer<typeof NetworkPolicyAmendmentSchema>;
|
|
292
|
+
|
|
293
|
+
export const ReviewDecisionSchema = z.union([
|
|
294
|
+
z.literal("approved"),
|
|
295
|
+
z.object({
|
|
296
|
+
"approved_execpolicy_amendment": z.object({ "proposed_execpolicy_amendment": z.array(z.string()) }),
|
|
297
|
+
}),
|
|
298
|
+
z.literal("approved_for_session"),
|
|
299
|
+
z.literal("approved_mcp_policy_amendment"),
|
|
300
|
+
z.object({
|
|
301
|
+
"network_policy_amendment": z.object({ "network_policy_amendment": NetworkPolicyAmendmentSchema }),
|
|
302
|
+
}),
|
|
303
|
+
z.object({ "denied": z.object({ "rejection": z.string() }) }),
|
|
304
|
+
z.literal("timed_out"),
|
|
305
|
+
z.literal("abort"),
|
|
306
|
+
]);
|
|
307
|
+
export type ReviewDecision = z.infer<typeof ReviewDecisionSchema>;
|
|
308
|
+
|
|
309
|
+
export const ApplyPatchApprovalResponseSchema = z.object({ "decision": ReviewDecisionSchema });
|
|
310
|
+
export type ApplyPatchApprovalResponse = z.infer<typeof ApplyPatchApprovalResponseSchema>;
|
|
311
|
+
|
|
312
|
+
export const ApprovalsReviewerSchema = z.enum(["user", "auto_review", "guardian_subagent"]);
|
|
313
|
+
export type ApprovalsReviewer = z.infer<typeof ApprovalsReviewerSchema>;
|
|
314
|
+
|
|
315
|
+
export const AskForApprovalSchema = z.union([
|
|
316
|
+
z.enum(["untrusted", "on-request", "never"]),
|
|
317
|
+
z.object({
|
|
318
|
+
"granular": z.object({
|
|
319
|
+
"mcp_elicitations": z.boolean(),
|
|
320
|
+
"request_permissions": z.boolean().default(false),
|
|
321
|
+
"rules": z.boolean(),
|
|
322
|
+
"sandbox_approval": z.boolean(),
|
|
323
|
+
"skill_approval": z.boolean().default(false),
|
|
324
|
+
}),
|
|
325
|
+
}),
|
|
326
|
+
]);
|
|
327
|
+
export type AskForApproval = z.infer<typeof AskForApprovalSchema>;
|
|
328
|
+
|
|
329
|
+
export const AsyncUserInputQuestionSchema = z.object({
|
|
330
|
+
"options": z.union([z.array(z.string()), z.null()]).optional(),
|
|
331
|
+
"title": z.string(),
|
|
332
|
+
});
|
|
333
|
+
export type AsyncUserInputQuestion = z.infer<typeof AsyncUserInputQuestionSchema>;
|
|
334
|
+
|
|
335
|
+
export const AttestationGenerateParamsSchema = z.record(z.string(), z.any());
|
|
336
|
+
export type AttestationGenerateParams = z.infer<typeof AttestationGenerateParamsSchema>;
|
|
337
|
+
|
|
338
|
+
export const AuthRecoveryNotificationSchema = z.object({
|
|
339
|
+
"message": z.string(),
|
|
340
|
+
"provider": z.string(),
|
|
341
|
+
"threadId": z.string(),
|
|
342
|
+
"turnId": z.string(),
|
|
343
|
+
});
|
|
344
|
+
export type AuthRecoveryNotification = z.infer<typeof AuthRecoveryNotificationSchema>;
|
|
345
|
+
|
|
346
|
+
export const AutoReviewDecisionSourceSchema = z.literal("agent");
|
|
347
|
+
export type AutoReviewDecisionSource = z.infer<typeof AutoReviewDecisionSourceSchema>;
|
|
348
|
+
|
|
349
|
+
export const ByteRangeSchema = z.object({ "end": z.number().int().gte(0), "start": z.number().int().gte(0) });
|
|
350
|
+
export type ByteRange = z.infer<typeof ByteRangeSchema>;
|
|
351
|
+
|
|
352
|
+
export const ChatgptAuthTokensRefreshReasonSchema = z.literal("unauthorized");
|
|
353
|
+
export type ChatgptAuthTokensRefreshReason = z.infer<typeof ChatgptAuthTokensRefreshReasonSchema>;
|
|
354
|
+
|
|
355
|
+
export const ChatgptAuthTokensRefreshParamsSchema = z.object({
|
|
356
|
+
"previousAccountId": z.union([z.string(), z.null()]).optional(),
|
|
357
|
+
"reason": ChatgptAuthTokensRefreshReasonSchema,
|
|
358
|
+
});
|
|
359
|
+
export type ChatgptAuthTokensRefreshParams = z.infer<typeof ChatgptAuthTokensRefreshParamsSchema>;
|
|
360
|
+
|
|
361
|
+
export const NonSteerableTurnKindSchema = z.enum(["review", "compact"]);
|
|
362
|
+
export type NonSteerableTurnKind = z.infer<typeof NonSteerableTurnKindSchema>;
|
|
363
|
+
|
|
364
|
+
export const CodexErrorInfoSchema = z.union([
|
|
365
|
+
z.enum([
|
|
366
|
+
"contextWindowExceeded",
|
|
367
|
+
"sessionBudgetExceeded",
|
|
368
|
+
"usageLimitExceeded",
|
|
369
|
+
"rateLimitExceeded",
|
|
370
|
+
"flexUnavailable",
|
|
371
|
+
"serverOverloaded",
|
|
372
|
+
"modelNotFound",
|
|
373
|
+
"policyCapacityUnavailable",
|
|
374
|
+
"cyberPolicy",
|
|
375
|
+
"misalignmentPolicyViolation",
|
|
376
|
+
"tooManyDenials",
|
|
377
|
+
"internalServerError",
|
|
378
|
+
"unauthorized",
|
|
379
|
+
"badRequest",
|
|
380
|
+
"threadRollbackFailed",
|
|
381
|
+
"sandboxError",
|
|
382
|
+
"other",
|
|
383
|
+
]),
|
|
384
|
+
z.literal("inferenceHookDenied"),
|
|
385
|
+
z.object({
|
|
386
|
+
"httpConnectionFailed": z.object({
|
|
387
|
+
"httpStatusCode": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
388
|
+
}),
|
|
389
|
+
}),
|
|
390
|
+
z.object({
|
|
391
|
+
"responseStreamConnectionFailed": z.object({
|
|
392
|
+
"httpStatusCode": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
393
|
+
}),
|
|
394
|
+
}),
|
|
395
|
+
z.object({
|
|
396
|
+
"responseStreamDisconnected": z.object({
|
|
397
|
+
"httpStatusCode": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
398
|
+
}),
|
|
399
|
+
}),
|
|
400
|
+
z.object({
|
|
401
|
+
"responseTooManyFailedAttempts": z.object({
|
|
402
|
+
"httpStatusCode": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
403
|
+
}),
|
|
404
|
+
}),
|
|
405
|
+
z.object({ "activeTurnNotSteerable": z.object({ "turnKind": NonSteerableTurnKindSchema }) }),
|
|
406
|
+
z.union([z.string(), z.record(z.string(), z.any())]),
|
|
407
|
+
]);
|
|
408
|
+
export type CodexErrorInfo = z.infer<typeof CodexErrorInfoSchema>;
|
|
409
|
+
|
|
410
|
+
export const CollabAgentStatusSchema = z.enum([
|
|
411
|
+
"pendingInit",
|
|
412
|
+
"running",
|
|
413
|
+
"interrupted",
|
|
414
|
+
"completed",
|
|
415
|
+
"errored",
|
|
416
|
+
"shutdown",
|
|
417
|
+
"notFound",
|
|
418
|
+
]);
|
|
419
|
+
export type CollabAgentStatus = z.infer<typeof CollabAgentStatusSchema>;
|
|
420
|
+
|
|
421
|
+
export const CollabAgentStateSchema = z.object({
|
|
422
|
+
"message": z.union([z.string(), z.null()]).optional(),
|
|
423
|
+
"status": CollabAgentStatusSchema,
|
|
424
|
+
});
|
|
425
|
+
export type CollabAgentState = z.infer<typeof CollabAgentStateSchema>;
|
|
426
|
+
|
|
427
|
+
export const CollabAgentToolSchema = z.enum([
|
|
428
|
+
"spawnAgent",
|
|
429
|
+
"sendInput",
|
|
430
|
+
"resumeAgent",
|
|
431
|
+
"wait",
|
|
432
|
+
"closeAgent",
|
|
433
|
+
"sendMessage",
|
|
434
|
+
"followupTask",
|
|
435
|
+
"interruptAgent",
|
|
436
|
+
"listAgents",
|
|
437
|
+
]);
|
|
438
|
+
export type CollabAgentTool = z.infer<typeof CollabAgentToolSchema>;
|
|
439
|
+
|
|
440
|
+
export const CollabAgentToolCallStatusSchema = z.enum(["inProgress", "completed", "failed", "interrupted"]);
|
|
441
|
+
export type CollabAgentToolCallStatus = z.infer<typeof CollabAgentToolCallStatusSchema>;
|
|
442
|
+
|
|
443
|
+
export const ModeKindSchema = z.enum(["plan", "default"]);
|
|
444
|
+
export type ModeKind = z.infer<typeof ModeKindSchema>;
|
|
445
|
+
|
|
446
|
+
export const ReasoningEffortSchema = z.string().min(1);
|
|
447
|
+
export type ReasoningEffort = z.infer<typeof ReasoningEffortSchema>;
|
|
448
|
+
|
|
449
|
+
export const SettingsSchema = z.object({
|
|
450
|
+
"developer_instructions": z.union([z.string(), z.null()]).optional(),
|
|
451
|
+
"model": z.string(),
|
|
452
|
+
"reasoning_effort": z.union([ReasoningEffortSchema, z.null()]).optional(),
|
|
453
|
+
});
|
|
454
|
+
export type Settings = z.infer<typeof SettingsSchema>;
|
|
455
|
+
|
|
456
|
+
export const CollaborationModeSchema = z.object({ "mode": ModeKindSchema, "settings": SettingsSchema });
|
|
457
|
+
export type CollaborationMode = z.infer<typeof CollaborationModeSchema>;
|
|
458
|
+
|
|
459
|
+
export const CommandActionSchema = z.discriminatedUnion("type", [
|
|
460
|
+
z.object({
|
|
461
|
+
"command": z.string(),
|
|
462
|
+
"name": z.string(),
|
|
463
|
+
"path": LegacyAppPathStringSchema,
|
|
464
|
+
"type": z.literal("read"),
|
|
465
|
+
}),
|
|
466
|
+
z.object({
|
|
467
|
+
"command": z.string(),
|
|
468
|
+
"path": z.union([z.string(), z.null()]).optional(),
|
|
469
|
+
"type": z.literal("listFiles"),
|
|
470
|
+
}),
|
|
471
|
+
z.object({
|
|
472
|
+
"command": z.string(),
|
|
473
|
+
"path": z.union([z.string(), z.null()]).optional(),
|
|
474
|
+
"query": z.union([z.string(), z.null()]).optional(),
|
|
475
|
+
"type": z.literal("search"),
|
|
476
|
+
}),
|
|
477
|
+
z.object({ "command": z.string(), "type": z.literal("unknown") }),
|
|
478
|
+
]);
|
|
479
|
+
export type CommandAction = z.infer<typeof CommandActionSchema>;
|
|
480
|
+
|
|
481
|
+
export const CommandExecOutputStreamSchema = z.union([z.literal("stdout"), z.literal("stderr")]);
|
|
482
|
+
export type CommandExecOutputStream = z.infer<typeof CommandExecOutputStreamSchema>;
|
|
483
|
+
|
|
484
|
+
export const CommandExecOutputDeltaNotificationSchema = z.object({
|
|
485
|
+
"capReached": z.boolean(),
|
|
486
|
+
"deltaBase64": z.string(),
|
|
487
|
+
"processId": z.string(),
|
|
488
|
+
"stream": CommandExecOutputStreamSchema,
|
|
489
|
+
});
|
|
490
|
+
export type CommandExecOutputDeltaNotification = z.infer<typeof CommandExecOutputDeltaNotificationSchema>;
|
|
491
|
+
|
|
492
|
+
export const CommandExecutionApprovalDecisionSchema = z.union([
|
|
493
|
+
z.literal("accept"),
|
|
494
|
+
z.literal("acceptForSession"),
|
|
495
|
+
z.object({ "acceptWithExecpolicyAmendment": z.object({ "execpolicy_amendment": z.array(z.string()) }) }),
|
|
496
|
+
z.object({
|
|
497
|
+
"applyNetworkPolicyAmendment": z.object({ "network_policy_amendment": NetworkPolicyAmendmentSchema }),
|
|
498
|
+
}),
|
|
499
|
+
z.literal("decline"),
|
|
500
|
+
z.literal("cancel"),
|
|
501
|
+
]);
|
|
502
|
+
export type CommandExecutionApprovalDecision = z.infer<typeof CommandExecutionApprovalDecisionSchema>;
|
|
503
|
+
|
|
504
|
+
export const CommandExecutionApprovalKindSchema = z.union([
|
|
505
|
+
z.enum(["command", "writeStdin"]),
|
|
506
|
+
z.literal("humanCommand"),
|
|
507
|
+
]);
|
|
508
|
+
export type CommandExecutionApprovalKind = z.infer<typeof CommandExecutionApprovalKindSchema>;
|
|
509
|
+
|
|
510
|
+
export const CommandExecutionOutputDeltaNotificationSchema = z.object({
|
|
511
|
+
"delta": z.string(),
|
|
512
|
+
"itemId": z.string(),
|
|
513
|
+
"threadId": z.string(),
|
|
514
|
+
"turnId": z.string(),
|
|
515
|
+
});
|
|
516
|
+
export type CommandExecutionOutputDeltaNotification = z.infer<typeof CommandExecutionOutputDeltaNotificationSchema>;
|
|
517
|
+
|
|
518
|
+
export const NetworkApprovalProtocolSchema = z.enum(["http", "https", "socks5Tcp", "socks5Udp"]);
|
|
519
|
+
export type NetworkApprovalProtocol = z.infer<typeof NetworkApprovalProtocolSchema>;
|
|
520
|
+
|
|
521
|
+
export const NetworkApprovalContextSchema = z.object({
|
|
522
|
+
"host": z.string(),
|
|
523
|
+
"protocol": NetworkApprovalProtocolSchema,
|
|
524
|
+
});
|
|
525
|
+
export type NetworkApprovalContext = z.infer<typeof NetworkApprovalContextSchema>;
|
|
526
|
+
|
|
527
|
+
export const CommandExecutionRequestApprovalParamsSchema = z.object({
|
|
528
|
+
"approvalId": z.union([z.string(), z.null()]).optional(),
|
|
529
|
+
"command": z.union([z.string(), z.null()]).optional(),
|
|
530
|
+
"commandActions": z.union([z.array(CommandActionSchema), z.null()]).optional(),
|
|
531
|
+
"cwd": z.union([LegacyAppPathStringSchema, z.null()]).optional(),
|
|
532
|
+
"environmentId": z.union([z.string(), z.null()]).default(null),
|
|
533
|
+
"itemId": z.string(),
|
|
534
|
+
"kind": CommandExecutionApprovalKindSchema.default("command"),
|
|
535
|
+
"networkApprovalContext": z.union([NetworkApprovalContextSchema, z.null()]).optional(),
|
|
536
|
+
"proposedExecpolicyAmendment": z.union([z.array(z.string()), z.null()]).optional(),
|
|
537
|
+
"proposedNetworkPolicyAmendments": z.union([z.array(NetworkPolicyAmendmentSchema), z.null()]).optional(),
|
|
538
|
+
"reason": z.union([z.string(), z.null()]).optional(),
|
|
539
|
+
"startedAtMs": z.number().int(),
|
|
540
|
+
"threadId": z.string(),
|
|
541
|
+
"turnId": z.string(),
|
|
542
|
+
});
|
|
543
|
+
export type CommandExecutionRequestApprovalParams = z.infer<typeof CommandExecutionRequestApprovalParamsSchema>;
|
|
544
|
+
|
|
545
|
+
export const CommandExecutionRequestApprovalResponseSchema = z.object({
|
|
546
|
+
"decision": CommandExecutionApprovalDecisionSchema,
|
|
547
|
+
});
|
|
548
|
+
export type CommandExecutionRequestApprovalResponse = z.infer<typeof CommandExecutionRequestApprovalResponseSchema>;
|
|
549
|
+
|
|
550
|
+
export const CommandExecutionSourceSchema = z.enum([
|
|
551
|
+
"agent",
|
|
552
|
+
"userShell",
|
|
553
|
+
"unifiedExecStartup",
|
|
554
|
+
"unifiedExecInteraction",
|
|
555
|
+
]);
|
|
556
|
+
export type CommandExecutionSource = z.infer<typeof CommandExecutionSourceSchema>;
|
|
557
|
+
|
|
558
|
+
export const CommandExecutionStatusSchema = z.enum(["inProgress", "completed", "failed", "declined"]);
|
|
559
|
+
export type CommandExecutionStatus = z.infer<typeof CommandExecutionStatusSchema>;
|
|
560
|
+
|
|
561
|
+
export const TextPositionSchema = z.object({
|
|
562
|
+
"column": z.number().int().gte(0),
|
|
563
|
+
"line": z.number().int().gte(0),
|
|
564
|
+
});
|
|
565
|
+
export type TextPosition = z.infer<typeof TextPositionSchema>;
|
|
566
|
+
|
|
567
|
+
export const TextRangeSchema = z.object({ "end": TextPositionSchema, "start": TextPositionSchema });
|
|
568
|
+
export type TextRange = z.infer<typeof TextRangeSchema>;
|
|
569
|
+
|
|
570
|
+
export const ConfigWarningNotificationSchema = z.object({
|
|
571
|
+
"details": z.union([z.string(), z.null()]).optional(),
|
|
572
|
+
"path": z.union([z.string(), z.null()]).optional(),
|
|
573
|
+
"range": z.union([TextRangeSchema, z.null()]).optional(),
|
|
574
|
+
"summary": z.string(),
|
|
575
|
+
});
|
|
576
|
+
export type ConfigWarningNotification = z.infer<typeof ConfigWarningNotificationSchema>;
|
|
577
|
+
|
|
578
|
+
export const ContextCompactedNotificationSchema = z.object({ "threadId": z.string(), "turnId": z.string() });
|
|
579
|
+
export type ContextCompactedNotification = z.infer<typeof ContextCompactedNotificationSchema>;
|
|
580
|
+
|
|
581
|
+
export const DeprecationNoticeNotificationSchema = z.object({
|
|
582
|
+
"details": z.union([z.string(), z.null()]).optional(),
|
|
583
|
+
"summary": z.string(),
|
|
584
|
+
});
|
|
585
|
+
export type DeprecationNoticeNotification = z.infer<typeof DeprecationNoticeNotificationSchema>;
|
|
586
|
+
|
|
587
|
+
export const DynamicToolCallOutputContentItemSchema = z.discriminatedUnion("type", [
|
|
588
|
+
z.object({ "text": z.string(), "type": z.literal("inputText") }),
|
|
589
|
+
z.object({ "imageUrl": z.string(), "type": z.literal("inputImage") }),
|
|
590
|
+
z.object({ "audioUrl": z.string(), "type": z.literal("inputAudio") }),
|
|
591
|
+
]);
|
|
592
|
+
export type DynamicToolCallOutputContentItem = z.infer<typeof DynamicToolCallOutputContentItemSchema>;
|
|
593
|
+
|
|
594
|
+
export const DynamicToolCallParamsSchema = z.object({
|
|
595
|
+
"arguments": z.json(),
|
|
596
|
+
"callId": z.string(),
|
|
597
|
+
"namespace": z.union([z.string(), z.null()]).optional(),
|
|
598
|
+
"threadId": z.string(),
|
|
599
|
+
"tool": z.string(),
|
|
600
|
+
"turnId": z.string(),
|
|
601
|
+
});
|
|
602
|
+
export type DynamicToolCallParams = z.infer<typeof DynamicToolCallParamsSchema>;
|
|
603
|
+
|
|
604
|
+
export const DynamicToolCallResponseSchema = z.object({
|
|
605
|
+
"contentItems": z.array(DynamicToolCallOutputContentItemSchema),
|
|
606
|
+
"success": z.boolean(),
|
|
607
|
+
});
|
|
608
|
+
export type DynamicToolCallResponse = z.infer<typeof DynamicToolCallResponseSchema>;
|
|
609
|
+
|
|
610
|
+
export const DynamicToolCallStatusSchema = z.enum(["inProgress", "completed", "failed"]);
|
|
611
|
+
export type DynamicToolCallStatus = z.infer<typeof DynamicToolCallStatusSchema>;
|
|
612
|
+
|
|
613
|
+
export const EnvironmentConnectionNotificationSchema = z.object({
|
|
614
|
+
"environmentId": z.string(),
|
|
615
|
+
"threadId": z.string(),
|
|
616
|
+
});
|
|
617
|
+
export type EnvironmentConnectionNotification = z.infer<typeof EnvironmentConnectionNotificationSchema>;
|
|
618
|
+
|
|
619
|
+
export const MisalignmentSteerSchema = z.object({ "message": z.string() });
|
|
620
|
+
export type MisalignmentSteer = z.infer<typeof MisalignmentSteerSchema>;
|
|
621
|
+
|
|
622
|
+
export const MisalignmentErrorDetailsSchema = z.object({
|
|
623
|
+
"detailedExplanation": z.union([z.string(), z.null()]).optional(),
|
|
624
|
+
"errorType": z.union([z.string(), z.null()]).optional(),
|
|
625
|
+
"reviewTarget": z.union([z.string(), z.null()]).optional(),
|
|
626
|
+
"steer": z.union([MisalignmentSteerSchema, z.null()]).optional(),
|
|
627
|
+
});
|
|
628
|
+
export type MisalignmentErrorDetails = z.infer<typeof MisalignmentErrorDetailsSchema>;
|
|
629
|
+
|
|
630
|
+
export const TurnErrorSchema = z.object({
|
|
631
|
+
"additionalDetails": z.union([z.string(), z.null()]).default(null),
|
|
632
|
+
"codexErrorInfo": z.union([CodexErrorInfoSchema, z.null()]).optional(),
|
|
633
|
+
"message": z.string(),
|
|
634
|
+
"misalignment": z.union([MisalignmentErrorDetailsSchema, z.null()]).default(null),
|
|
635
|
+
});
|
|
636
|
+
export type TurnError = z.infer<typeof TurnErrorSchema>;
|
|
637
|
+
|
|
638
|
+
export const ErrorNotificationSchema = z.object({
|
|
639
|
+
"error": TurnErrorSchema,
|
|
640
|
+
"threadId": z.string(),
|
|
641
|
+
"turnId": z.string(),
|
|
642
|
+
"willRetry": z.boolean(),
|
|
643
|
+
});
|
|
644
|
+
export type ErrorNotification = z.infer<typeof ErrorNotificationSchema>;
|
|
645
|
+
|
|
646
|
+
export const ParsedCommandSchema = z.discriminatedUnion("type", [
|
|
647
|
+
z.object({ "cmd": z.string(), "name": z.string(), "path": z.string(), "type": z.literal("read") }),
|
|
648
|
+
z.object({
|
|
649
|
+
"cmd": z.string(),
|
|
650
|
+
"path": z.union([z.string(), z.null()]).optional(),
|
|
651
|
+
"type": z.literal("list_files"),
|
|
652
|
+
}),
|
|
653
|
+
z.object({
|
|
654
|
+
"cmd": z.string(),
|
|
655
|
+
"path": z.union([z.string(), z.null()]).optional(),
|
|
656
|
+
"query": z.union([z.string(), z.null()]).optional(),
|
|
657
|
+
"type": z.literal("search"),
|
|
658
|
+
}),
|
|
659
|
+
z.object({ "cmd": z.string(), "type": z.literal("unknown") }),
|
|
660
|
+
]);
|
|
661
|
+
export type ParsedCommand = z.infer<typeof ParsedCommandSchema>;
|
|
662
|
+
|
|
663
|
+
export const ExecCommandApprovalParamsSchema = z.object({
|
|
664
|
+
"approvalId": z.union([z.string(), z.null()]).optional(),
|
|
665
|
+
"callId": z.string(),
|
|
666
|
+
"command": z.array(z.string()),
|
|
667
|
+
"conversationId": ThreadIdSchema,
|
|
668
|
+
"cwd": z.string(),
|
|
669
|
+
"parsedCmd": z.array(ParsedCommandSchema),
|
|
670
|
+
"reason": z.union([z.string(), z.null()]).optional(),
|
|
671
|
+
});
|
|
672
|
+
export type ExecCommandApprovalParams = z.infer<typeof ExecCommandApprovalParamsSchema>;
|
|
673
|
+
|
|
674
|
+
export const ExecCommandApprovalResponseSchema = z.object({ "decision": ReviewDecisionSchema });
|
|
675
|
+
export type ExecCommandApprovalResponse = z.infer<typeof ExecCommandApprovalResponseSchema>;
|
|
676
|
+
|
|
677
|
+
export const ExternalAgentConfigMigrationItemTypeSchema = z.enum([
|
|
678
|
+
"AGENTS_MD",
|
|
679
|
+
"CONFIG",
|
|
680
|
+
"SKILLS",
|
|
681
|
+
"PLUGINS",
|
|
682
|
+
"MCP_SERVER_CONFIG",
|
|
683
|
+
"SUBAGENTS",
|
|
684
|
+
"HOOKS",
|
|
685
|
+
"COMMANDS",
|
|
686
|
+
"MEMORY",
|
|
687
|
+
"SESSIONS",
|
|
688
|
+
]);
|
|
689
|
+
export type ExternalAgentConfigMigrationItemType = z.infer<typeof ExternalAgentConfigMigrationItemTypeSchema>;
|
|
690
|
+
|
|
691
|
+
export const ExternalAgentConfigImportItemTypeFailureSchema = z.object({
|
|
692
|
+
"cwd": z.union([z.string(), z.null()]).optional(),
|
|
693
|
+
"errorType": z.union([z.string(), z.null()]).optional(),
|
|
694
|
+
"failureStage": z.string(),
|
|
695
|
+
"itemType": ExternalAgentConfigMigrationItemTypeSchema,
|
|
696
|
+
"message": z.string(),
|
|
697
|
+
"source": z.union([z.string(), z.null()]).optional(),
|
|
698
|
+
"subErrorType": z.union([z.string(), z.null()]).optional(),
|
|
699
|
+
});
|
|
700
|
+
export type ExternalAgentConfigImportItemTypeFailure = z.infer<typeof ExternalAgentConfigImportItemTypeFailureSchema>;
|
|
701
|
+
|
|
702
|
+
export const ExternalAgentConfigImportItemTypeSuccessSchema = z.object({
|
|
703
|
+
"cwd": z.union([z.string(), z.null()]).optional(),
|
|
704
|
+
"itemType": ExternalAgentConfigMigrationItemTypeSchema,
|
|
705
|
+
"source": z.union([z.string(), z.null()]).optional(),
|
|
706
|
+
"target": z.union([z.string(), z.null()]).optional(),
|
|
707
|
+
"title": z.union([z.string(), z.null()]).default(null),
|
|
708
|
+
});
|
|
709
|
+
export type ExternalAgentConfigImportItemTypeSuccess = z.infer<typeof ExternalAgentConfigImportItemTypeSuccessSchema>;
|
|
710
|
+
|
|
711
|
+
export const ExternalAgentConfigImportTypeResultSchema = z.object({
|
|
712
|
+
"failures": z.array(ExternalAgentConfigImportItemTypeFailureSchema),
|
|
713
|
+
"itemType": ExternalAgentConfigMigrationItemTypeSchema,
|
|
714
|
+
"successes": z.array(ExternalAgentConfigImportItemTypeSuccessSchema),
|
|
715
|
+
});
|
|
716
|
+
export type ExternalAgentConfigImportTypeResult = z.infer<typeof ExternalAgentConfigImportTypeResultSchema>;
|
|
717
|
+
|
|
718
|
+
export const ExternalAgentConfigImportCompletedNotificationSchema = z.object({
|
|
719
|
+
"importId": z.string(),
|
|
720
|
+
"itemTypeResults": z.array(ExternalAgentConfigImportTypeResultSchema),
|
|
721
|
+
});
|
|
722
|
+
export type ExternalAgentConfigImportCompletedNotification = z.infer<typeof ExternalAgentConfigImportCompletedNotificationSchema>;
|
|
723
|
+
|
|
724
|
+
export const ExternalAgentConfigImportProgressNotificationSchema = z.object({
|
|
725
|
+
"importId": z.string(),
|
|
726
|
+
"itemTypeResults": z.array(ExternalAgentConfigImportTypeResultSchema),
|
|
727
|
+
});
|
|
728
|
+
export type ExternalAgentConfigImportProgressNotification = z.infer<typeof ExternalAgentConfigImportProgressNotificationSchema>;
|
|
729
|
+
|
|
730
|
+
export const FileChangeApprovalDecisionSchema = z.union([
|
|
731
|
+
z.literal("accept"),
|
|
732
|
+
z.literal("acceptForSession"),
|
|
733
|
+
z.literal("decline"),
|
|
734
|
+
z.literal("cancel"),
|
|
735
|
+
]);
|
|
736
|
+
export type FileChangeApprovalDecision = z.infer<typeof FileChangeApprovalDecisionSchema>;
|
|
737
|
+
|
|
738
|
+
export const FileChangeOutputDeltaNotificationSchema = z.object({
|
|
739
|
+
"delta": z.string(),
|
|
740
|
+
"itemId": z.string(),
|
|
741
|
+
"threadId": z.string(),
|
|
742
|
+
"turnId": z.string(),
|
|
743
|
+
});
|
|
744
|
+
export type FileChangeOutputDeltaNotification = z.infer<typeof FileChangeOutputDeltaNotificationSchema>;
|
|
745
|
+
|
|
746
|
+
export const PatchChangeKindSchema = z.discriminatedUnion("type", [
|
|
747
|
+
z.object({ "type": z.literal("add") }),
|
|
748
|
+
z.object({ "type": z.literal("delete") }),
|
|
749
|
+
z.object({ "move_path": z.union([z.string(), z.null()]).optional(), "type": z.literal("update") }),
|
|
750
|
+
]);
|
|
751
|
+
export type PatchChangeKind = z.infer<typeof PatchChangeKindSchema>;
|
|
752
|
+
|
|
753
|
+
export const FileUpdateChangeSchema = z.object({
|
|
754
|
+
"diff": z.string(),
|
|
755
|
+
"kind": PatchChangeKindSchema,
|
|
756
|
+
"path": z.string(),
|
|
757
|
+
});
|
|
758
|
+
export type FileUpdateChange = z.infer<typeof FileUpdateChangeSchema>;
|
|
759
|
+
|
|
760
|
+
export const FileChangePatchUpdatedNotificationSchema = z.object({
|
|
761
|
+
"changes": z.array(FileUpdateChangeSchema),
|
|
762
|
+
"itemId": z.string(),
|
|
763
|
+
"threadId": z.string(),
|
|
764
|
+
"turnId": z.string(),
|
|
765
|
+
});
|
|
766
|
+
export type FileChangePatchUpdatedNotification = z.infer<typeof FileChangePatchUpdatedNotificationSchema>;
|
|
767
|
+
|
|
768
|
+
export const FileChangeRequestApprovalParamsSchema = z.object({
|
|
769
|
+
"grantRoot": z.union([z.string(), z.null()]).optional(),
|
|
770
|
+
"itemId": z.string(),
|
|
771
|
+
"reason": z.union([z.string(), z.null()]).optional(),
|
|
772
|
+
"startedAtMs": z.number().int(),
|
|
773
|
+
"threadId": z.string(),
|
|
774
|
+
"turnId": z.string(),
|
|
775
|
+
});
|
|
776
|
+
export type FileChangeRequestApprovalParams = z.infer<typeof FileChangeRequestApprovalParamsSchema>;
|
|
777
|
+
|
|
778
|
+
export const FileChangeRequestApprovalResponseSchema = z.object({
|
|
779
|
+
"decision": FileChangeApprovalDecisionSchema,
|
|
780
|
+
});
|
|
781
|
+
export type FileChangeRequestApprovalResponse = z.infer<typeof FileChangeRequestApprovalResponseSchema>;
|
|
782
|
+
|
|
783
|
+
export const FsChangedNotificationSchema = z.object({
|
|
784
|
+
"changedPaths": z.array(AbsolutePathBufSchema),
|
|
785
|
+
"watchId": z.string(),
|
|
786
|
+
});
|
|
787
|
+
export type FsChangedNotification = z.infer<typeof FsChangedNotificationSchema>;
|
|
788
|
+
|
|
789
|
+
export const ImageDetailSchema = z.enum(["auto", "low", "high", "original"]);
|
|
790
|
+
export type ImageDetail = z.infer<typeof ImageDetailSchema>;
|
|
791
|
+
|
|
792
|
+
export const FunctionCallOutputContentItemSchema = z.discriminatedUnion("type", [
|
|
793
|
+
z.object({ "text": z.string(), "type": z.literal("input_text") }),
|
|
794
|
+
z.object({
|
|
795
|
+
"detail": z.union([ImageDetailSchema, z.null()]).optional(),
|
|
796
|
+
"type": z.literal("input_image"),
|
|
797
|
+
"image_url": z.string().optional(),
|
|
798
|
+
"file_id": z.string().optional(),
|
|
799
|
+
}),
|
|
800
|
+
z.object({
|
|
801
|
+
"type": z.literal("input_audio"),
|
|
802
|
+
"audio_url": z.string().optional(),
|
|
803
|
+
"file_id": z.string().optional(),
|
|
804
|
+
}),
|
|
805
|
+
z.object({ "encrypted_content": z.string(), "type": z.literal("encrypted_content") }),
|
|
806
|
+
]);
|
|
807
|
+
export type FunctionCallOutputContentItem = z.infer<typeof FunctionCallOutputContentItemSchema>;
|
|
808
|
+
|
|
809
|
+
export const FunctionCallOutputBodySchema = z.union([z.string(), z.array(FunctionCallOutputContentItemSchema)]);
|
|
810
|
+
export type FunctionCallOutputBody = z.infer<typeof FunctionCallOutputBodySchema>;
|
|
811
|
+
|
|
812
|
+
export const FuzzyFileSearchMatchTypeSchema = z.enum(["file", "directory"]);
|
|
813
|
+
export type FuzzyFileSearchMatchType = z.infer<typeof FuzzyFileSearchMatchTypeSchema>;
|
|
814
|
+
|
|
815
|
+
export const FuzzyFileSearchResultSchema = z.object({
|
|
816
|
+
"file_name": z.string(),
|
|
817
|
+
"indices": z.union([z.array(z.number().int().gte(0)), z.null()]).optional(),
|
|
818
|
+
"match_type": FuzzyFileSearchMatchTypeSchema,
|
|
819
|
+
"path": z.string(),
|
|
820
|
+
"root": z.string(),
|
|
821
|
+
"score": z.number().int().gte(0),
|
|
822
|
+
});
|
|
823
|
+
export type FuzzyFileSearchResult = z.infer<typeof FuzzyFileSearchResultSchema>;
|
|
824
|
+
|
|
825
|
+
export const FuzzyFileSearchSessionCompletedNotificationSchema = z.object({ "sessionId": z.string() });
|
|
826
|
+
export type FuzzyFileSearchSessionCompletedNotification = z.infer<typeof FuzzyFileSearchSessionCompletedNotificationSchema>;
|
|
827
|
+
|
|
828
|
+
export const FuzzyFileSearchSessionUpdatedNotificationSchema = z.object({
|
|
829
|
+
"files": z.array(FuzzyFileSearchResultSchema),
|
|
830
|
+
"query": z.string(),
|
|
831
|
+
"sessionId": z.string(),
|
|
832
|
+
});
|
|
833
|
+
export type FuzzyFileSearchSessionUpdatedNotification = z.infer<typeof FuzzyFileSearchSessionUpdatedNotificationSchema>;
|
|
834
|
+
|
|
835
|
+
export const GatewayOAuthStatusSchema = z.enum(["notReady", "started", "succeeded", "failed"]);
|
|
836
|
+
export type GatewayOAuthStatus = z.infer<typeof GatewayOAuthStatusSchema>;
|
|
837
|
+
|
|
838
|
+
export const GatewayOAuthChangedNotificationSchema = z.object({
|
|
839
|
+
"authUrl": z.union([z.string(), z.null()]).optional(),
|
|
840
|
+
"error": z.union([z.string(), z.null()]).optional(),
|
|
841
|
+
"loginId": z.union([z.string(), z.null()]).optional(),
|
|
842
|
+
"providerId": z.string(),
|
|
843
|
+
"status": GatewayOAuthStatusSchema,
|
|
844
|
+
});
|
|
845
|
+
export type GatewayOAuthChangedNotification = z.infer<typeof GatewayOAuthChangedNotificationSchema>;
|
|
846
|
+
|
|
847
|
+
export const GitInfoSchema = z.object({
|
|
848
|
+
"branch": z.union([z.string(), z.null()]).optional(),
|
|
849
|
+
"originUrl": z.union([z.string(), z.null()]).optional(),
|
|
850
|
+
"sha": z.union([z.string(), z.null()]).optional(),
|
|
851
|
+
});
|
|
852
|
+
export type GitInfo = z.infer<typeof GitInfoSchema>;
|
|
853
|
+
|
|
854
|
+
export const GrantedPermissionProfileSchema = z.object({
|
|
855
|
+
"fileSystem": z.union([AdditionalFileSystemPermissionsSchema, z.null()]).optional(),
|
|
856
|
+
"network": z.union([AdditionalNetworkPermissionsSchema, z.null()]).optional(),
|
|
857
|
+
});
|
|
858
|
+
export type GrantedPermissionProfile = z.infer<typeof GrantedPermissionProfileSchema>;
|
|
859
|
+
|
|
860
|
+
export const GuardianApprovalReviewStatusSchema = z.enum([
|
|
861
|
+
"inProgress",
|
|
862
|
+
"approved",
|
|
863
|
+
"denied",
|
|
864
|
+
"timedOut",
|
|
865
|
+
"aborted",
|
|
866
|
+
]);
|
|
867
|
+
export type GuardianApprovalReviewStatus = z.infer<typeof GuardianApprovalReviewStatusSchema>;
|
|
868
|
+
|
|
869
|
+
export const GuardianRiskLevelSchema = z.enum(["low", "medium", "high", "critical"]);
|
|
870
|
+
export type GuardianRiskLevel = z.infer<typeof GuardianRiskLevelSchema>;
|
|
871
|
+
|
|
872
|
+
export const GuardianUserAuthorizationSchema = z.enum(["unknown", "low", "medium", "high"]);
|
|
873
|
+
export type GuardianUserAuthorization = z.infer<typeof GuardianUserAuthorizationSchema>;
|
|
874
|
+
|
|
875
|
+
export const GuardianApprovalReviewSchema = z.object({
|
|
876
|
+
"rationale": z.union([z.string(), z.null()]).optional(),
|
|
877
|
+
"riskLevel": z.union([GuardianRiskLevelSchema, z.null()]).optional(),
|
|
878
|
+
"status": GuardianApprovalReviewStatusSchema,
|
|
879
|
+
"userAuthorization": z.union([GuardianUserAuthorizationSchema, z.null()]).optional(),
|
|
880
|
+
});
|
|
881
|
+
export type GuardianApprovalReview = z.infer<typeof GuardianApprovalReviewSchema>;
|
|
882
|
+
|
|
883
|
+
export const GuardianCommandSourceSchema = z.enum(["shell", "unifiedExec"]);
|
|
884
|
+
export type GuardianCommandSource = z.infer<typeof GuardianCommandSourceSchema>;
|
|
885
|
+
|
|
886
|
+
export const RequestPermissionProfileSchema = z.object({
|
|
887
|
+
"fileSystem": z.union([AdditionalFileSystemPermissionsSchema, z.null()]).optional(),
|
|
888
|
+
"network": z.union([AdditionalNetworkPermissionsSchema, z.null()]).optional(),
|
|
889
|
+
});
|
|
890
|
+
export type RequestPermissionProfile = z.infer<typeof RequestPermissionProfileSchema>;
|
|
891
|
+
|
|
892
|
+
export const GuardianApprovalReviewActionSchema = z.discriminatedUnion("type", [
|
|
893
|
+
z.object({
|
|
894
|
+
"command": z.string(),
|
|
895
|
+
"cwd": LegacyAppPathStringSchema,
|
|
896
|
+
"source": GuardianCommandSourceSchema,
|
|
897
|
+
"type": z.literal("command"),
|
|
898
|
+
}),
|
|
899
|
+
z.object({
|
|
900
|
+
"argv": z.array(z.string()),
|
|
901
|
+
"cwd": AbsolutePathBufSchema,
|
|
902
|
+
"program": z.string(),
|
|
903
|
+
"source": GuardianCommandSourceSchema,
|
|
904
|
+
"type": z.literal("execve"),
|
|
905
|
+
}),
|
|
906
|
+
z.object({
|
|
907
|
+
"approvalId": z.string(),
|
|
908
|
+
"cwd": LegacyAppPathStringSchema,
|
|
909
|
+
"processId": z.string(),
|
|
910
|
+
"stdin": z.string(),
|
|
911
|
+
"type": z.literal("writeStdin"),
|
|
912
|
+
}),
|
|
913
|
+
z.object({
|
|
914
|
+
"cwd": LegacyAppPathStringSchema,
|
|
915
|
+
"files": z.array(LegacyAppPathStringSchema),
|
|
916
|
+
"type": z.literal("applyPatch"),
|
|
917
|
+
}),
|
|
918
|
+
z.object({
|
|
919
|
+
"host": z.string(),
|
|
920
|
+
"port": z.number().int().gte(0),
|
|
921
|
+
"protocol": NetworkApprovalProtocolSchema,
|
|
922
|
+
"target": z.string(),
|
|
923
|
+
"type": z.literal("networkAccess"),
|
|
924
|
+
}),
|
|
925
|
+
z.object({
|
|
926
|
+
"connectorId": z.union([z.string(), z.null()]).optional(),
|
|
927
|
+
"connectorName": z.union([z.string(), z.null()]).optional(),
|
|
928
|
+
"server": z.string(),
|
|
929
|
+
"toolName": z.string(),
|
|
930
|
+
"toolTitle": z.union([z.string(), z.null()]).optional(),
|
|
931
|
+
"type": z.literal("mcpToolCall"),
|
|
932
|
+
}),
|
|
933
|
+
z.object({
|
|
934
|
+
"permissions": RequestPermissionProfileSchema,
|
|
935
|
+
"reason": z.union([z.string(), z.null()]).optional(),
|
|
936
|
+
"type": z.literal("requestPermissions"),
|
|
937
|
+
}),
|
|
938
|
+
]);
|
|
939
|
+
export type GuardianApprovalReviewAction = z.infer<typeof GuardianApprovalReviewActionSchema>;
|
|
940
|
+
|
|
941
|
+
export const GuardianWarningNotificationSchema = z.object({ "message": z.string(), "threadId": z.string() });
|
|
942
|
+
export type GuardianWarningNotification = z.infer<typeof GuardianWarningNotificationSchema>;
|
|
943
|
+
|
|
944
|
+
export const HookEventNameSchema = z.enum([
|
|
945
|
+
"preModelRequest",
|
|
946
|
+
"postModelRequest",
|
|
947
|
+
"preToolUse",
|
|
948
|
+
"permissionRequest",
|
|
949
|
+
"postToolUse",
|
|
950
|
+
"preCompact",
|
|
951
|
+
"postCompact",
|
|
952
|
+
"sessionStart",
|
|
953
|
+
"sessionEnd",
|
|
954
|
+
"userPromptSubmit",
|
|
955
|
+
"subagentStart",
|
|
956
|
+
"subagentStop",
|
|
957
|
+
"stop",
|
|
958
|
+
"interrupt",
|
|
959
|
+
]);
|
|
960
|
+
export type HookEventName = z.infer<typeof HookEventNameSchema>;
|
|
961
|
+
|
|
962
|
+
export const HookExecutionModeSchema = z.enum(["sync", "async"]);
|
|
963
|
+
export type HookExecutionMode = z.infer<typeof HookExecutionModeSchema>;
|
|
964
|
+
|
|
965
|
+
export const HookHandlerTypeSchema = z.enum(["command", "mcpTool", "prompt", "agent"]);
|
|
966
|
+
export type HookHandlerType = z.infer<typeof HookHandlerTypeSchema>;
|
|
967
|
+
|
|
968
|
+
export const HookOutputEntryKindSchema = z.enum(["warning", "stop", "feedback", "context", "error"]);
|
|
969
|
+
export type HookOutputEntryKind = z.infer<typeof HookOutputEntryKindSchema>;
|
|
970
|
+
|
|
971
|
+
export const HookOutputEntrySchema = z.object({ "kind": HookOutputEntryKindSchema, "text": z.string() });
|
|
972
|
+
export type HookOutputEntry = z.infer<typeof HookOutputEntrySchema>;
|
|
973
|
+
|
|
974
|
+
export const HookRunStatusSchema = z.enum(["running", "completed", "failed", "blocked", "stopped"]);
|
|
975
|
+
export type HookRunStatus = z.infer<typeof HookRunStatusSchema>;
|
|
976
|
+
|
|
977
|
+
export const HookScopeSchema = z.enum(["thread", "turn"]);
|
|
978
|
+
export type HookScope = z.infer<typeof HookScopeSchema>;
|
|
979
|
+
|
|
980
|
+
export const HookSourceSchema = z.enum([
|
|
981
|
+
"system",
|
|
982
|
+
"user",
|
|
983
|
+
"project",
|
|
984
|
+
"mdm",
|
|
985
|
+
"sessionFlags",
|
|
986
|
+
"plugin",
|
|
987
|
+
"cloudRequirements",
|
|
988
|
+
"cloudManagedConfig",
|
|
989
|
+
"legacyManagedConfigFile",
|
|
990
|
+
"legacyManagedConfigMdm",
|
|
991
|
+
"unknown",
|
|
992
|
+
]);
|
|
993
|
+
export type HookSource = z.infer<typeof HookSourceSchema>;
|
|
994
|
+
|
|
995
|
+
export const HookRunSummarySchema = z.object({
|
|
996
|
+
"completedAt": z.union([z.number().int(), z.null()]).optional(),
|
|
997
|
+
"displayOrder": z.number().int(),
|
|
998
|
+
"durationMs": z.union([z.number().int(), z.null()]).optional(),
|
|
999
|
+
"entries": z.array(HookOutputEntrySchema),
|
|
1000
|
+
"eventName": HookEventNameSchema,
|
|
1001
|
+
"executionMode": HookExecutionModeSchema,
|
|
1002
|
+
"handlerType": HookHandlerTypeSchema,
|
|
1003
|
+
"id": z.string(),
|
|
1004
|
+
"scope": HookScopeSchema,
|
|
1005
|
+
"source": HookSourceSchema.default("unknown"),
|
|
1006
|
+
"sourcePath": LegacyAppPathStringSchema,
|
|
1007
|
+
"startedAt": z.number().int(),
|
|
1008
|
+
"status": HookRunStatusSchema,
|
|
1009
|
+
"statusMessage": z.union([z.string(), z.null()]).optional(),
|
|
1010
|
+
});
|
|
1011
|
+
export type HookRunSummary = z.infer<typeof HookRunSummarySchema>;
|
|
1012
|
+
|
|
1013
|
+
export const HookCompletedNotificationSchema = z.object({
|
|
1014
|
+
"run": HookRunSummarySchema,
|
|
1015
|
+
"threadId": z.string(),
|
|
1016
|
+
"turnId": z.union([z.string(), z.null()]).optional(),
|
|
1017
|
+
});
|
|
1018
|
+
export type HookCompletedNotification = z.infer<typeof HookCompletedNotificationSchema>;
|
|
1019
|
+
|
|
1020
|
+
export const HookPromptFragmentSchema = z.object({ "hookRunId": z.string(), "text": z.string() });
|
|
1021
|
+
export type HookPromptFragment = z.infer<typeof HookPromptFragmentSchema>;
|
|
1022
|
+
|
|
1023
|
+
export const HookStartedNotificationSchema = z.object({
|
|
1024
|
+
"run": HookRunSummarySchema,
|
|
1025
|
+
"threadId": z.string(),
|
|
1026
|
+
"turnId": z.union([z.string(), z.null()]).optional(),
|
|
1027
|
+
});
|
|
1028
|
+
export type HookStartedNotification = z.infer<typeof HookStartedNotificationSchema>;
|
|
1029
|
+
|
|
1030
|
+
export const ImageGenerationFailureSchema = z.object({
|
|
1031
|
+
"limitId": z.string(),
|
|
1032
|
+
"resetsAt": z.union([z.number().int(), z.null()]).optional(),
|
|
1033
|
+
"type": z.literal("usageLimitExceeded"),
|
|
1034
|
+
});
|
|
1035
|
+
export type ImageGenerationFailure = z.infer<typeof ImageGenerationFailureSchema>;
|
|
1036
|
+
|
|
1037
|
+
export const ImageGenerationInputImageSchema = z.object({
|
|
1038
|
+
"path": AbsolutePathBufSchema,
|
|
1039
|
+
"sha256": z.string(),
|
|
1040
|
+
});
|
|
1041
|
+
export type ImageGenerationInputImage = z.infer<typeof ImageGenerationInputImageSchema>;
|
|
1042
|
+
|
|
1043
|
+
export const McpAppDisplayModeSchema = z.enum(["inline", "fullscreen"]);
|
|
1044
|
+
export type McpAppDisplayMode = z.infer<typeof McpAppDisplayModeSchema>;
|
|
1045
|
+
|
|
1046
|
+
export const McpAppUiSchema = z.object({
|
|
1047
|
+
"preferredModelDisplayMode": McpAppDisplayModeSchema,
|
|
1048
|
+
"resourceUri": z.string(),
|
|
1049
|
+
});
|
|
1050
|
+
export type McpAppUi = z.infer<typeof McpAppUiSchema>;
|
|
1051
|
+
|
|
1052
|
+
export const McpToolCallAppContextSchema = z.object({
|
|
1053
|
+
"actionName": z.union([z.string(), z.null()]).optional(),
|
|
1054
|
+
"appName": z.union([z.string(), z.null()]).optional(),
|
|
1055
|
+
"connectorId": z.string(),
|
|
1056
|
+
"linkId": z.union([z.string(), z.null()]).optional(),
|
|
1057
|
+
"resourceUri": z.union([z.string(), z.null()]).optional(),
|
|
1058
|
+
});
|
|
1059
|
+
export type McpToolCallAppContext = z.infer<typeof McpToolCallAppContextSchema>;
|
|
1060
|
+
|
|
1061
|
+
export const McpToolCallErrorSchema = z.object({ "message": z.string() });
|
|
1062
|
+
export type McpToolCallError = z.infer<typeof McpToolCallErrorSchema>;
|
|
1063
|
+
|
|
1064
|
+
export const McpToolCallResultSchema = z.object({
|
|
1065
|
+
"_meta": z.json().optional(),
|
|
1066
|
+
"content": z.array(z.json()),
|
|
1067
|
+
"structuredContent": z.json().optional(),
|
|
1068
|
+
});
|
|
1069
|
+
export type McpToolCallResult = z.infer<typeof McpToolCallResultSchema>;
|
|
1070
|
+
|
|
1071
|
+
export const McpToolCallStatusSchema = z.enum(["inProgress", "completed", "failed"]);
|
|
1072
|
+
export type McpToolCallStatus = z.infer<typeof McpToolCallStatusSchema>;
|
|
1073
|
+
|
|
1074
|
+
export const MemoryCitationEntrySchema = z.object({
|
|
1075
|
+
"lineEnd": z.number().int().gte(0),
|
|
1076
|
+
"lineStart": z.number().int().gte(0),
|
|
1077
|
+
"note": z.string(),
|
|
1078
|
+
"path": z.string(),
|
|
1079
|
+
});
|
|
1080
|
+
export type MemoryCitationEntry = z.infer<typeof MemoryCitationEntrySchema>;
|
|
1081
|
+
|
|
1082
|
+
export const MemoryCitationSchema = z.object({
|
|
1083
|
+
"entries": z.array(MemoryCitationEntrySchema),
|
|
1084
|
+
"threadIds": z.array(z.string()),
|
|
1085
|
+
});
|
|
1086
|
+
export type MemoryCitation = z.infer<typeof MemoryCitationSchema>;
|
|
1087
|
+
|
|
1088
|
+
export const MessagePhaseSchema = z.union([
|
|
1089
|
+
z.literal("commentary"),
|
|
1090
|
+
z.literal("partial_answer"),
|
|
1091
|
+
z.literal("final_answer"),
|
|
1092
|
+
]);
|
|
1093
|
+
export type MessagePhase = z.infer<typeof MessagePhaseSchema>;
|
|
1094
|
+
|
|
1095
|
+
export const PatchApplyStatusSchema = z.enum(["inProgress", "completed", "failed", "declined"]);
|
|
1096
|
+
export type PatchApplyStatus = z.infer<typeof PatchApplyStatusSchema>;
|
|
1097
|
+
|
|
1098
|
+
export const SubAgentActivityKindSchema = z.enum(["started", "interacted", "interrupted", "completed"]);
|
|
1099
|
+
export type SubAgentActivityKind = z.infer<typeof SubAgentActivityKindSchema>;
|
|
1100
|
+
|
|
1101
|
+
export const TextElementSchema = z.object({
|
|
1102
|
+
"byteRange": ByteRangeSchema,
|
|
1103
|
+
"placeholder": z.union([z.string(), z.null()]).optional(),
|
|
1104
|
+
});
|
|
1105
|
+
export type TextElement = z.infer<typeof TextElementSchema>;
|
|
1106
|
+
|
|
1107
|
+
export const UserInputSchema = z.discriminatedUnion("type", [
|
|
1108
|
+
z.object({
|
|
1109
|
+
"text": z.string(),
|
|
1110
|
+
"text_elements": z.array(TextElementSchema).default([]),
|
|
1111
|
+
"type": z.literal("text"),
|
|
1112
|
+
}),
|
|
1113
|
+
z.object({
|
|
1114
|
+
"detail": z.union([ImageDetailSchema, z.null()]).default(null),
|
|
1115
|
+
"type": z.literal("image"),
|
|
1116
|
+
"url": z.string().optional(),
|
|
1117
|
+
"fileId": z.string().optional(),
|
|
1118
|
+
}),
|
|
1119
|
+
z.object({
|
|
1120
|
+
"detail": z.union([ImageDetailSchema, z.null()]).default(null),
|
|
1121
|
+
"path": z.string(),
|
|
1122
|
+
"type": z.literal("localImage"),
|
|
1123
|
+
}),
|
|
1124
|
+
z.object({ "type": z.literal("audio"), "url": z.string().optional(), "fileId": z.string().optional() }),
|
|
1125
|
+
z.object({ "path": z.string(), "type": z.literal("localAudio") }),
|
|
1126
|
+
z.object({ "name": z.string(), "path": z.string(), "type": z.literal("skill") }),
|
|
1127
|
+
z.object({ "name": z.string(), "path": z.string(), "type": z.literal("mention") }),
|
|
1128
|
+
]);
|
|
1129
|
+
export type UserInput = z.infer<typeof UserInputSchema>;
|
|
1130
|
+
|
|
1131
|
+
export const WebSearchActionSchema = z.discriminatedUnion("type", [
|
|
1132
|
+
z.object({
|
|
1133
|
+
"queries": z.union([z.array(z.string()), z.null()]).optional(),
|
|
1134
|
+
"query": z.union([z.string(), z.null()]).optional(),
|
|
1135
|
+
"type": z.literal("search"),
|
|
1136
|
+
}),
|
|
1137
|
+
z.object({ "type": z.literal("openPage"), "url": z.union([z.string(), z.null()]).optional() }),
|
|
1138
|
+
z.object({
|
|
1139
|
+
"pattern": z.union([z.string(), z.null()]).optional(),
|
|
1140
|
+
"type": z.literal("findInPage"),
|
|
1141
|
+
"url": z.union([z.string(), z.null()]).optional(),
|
|
1142
|
+
}),
|
|
1143
|
+
z.object({ "type": z.literal("other") }),
|
|
1144
|
+
]);
|
|
1145
|
+
export type WebSearchAction = z.infer<typeof WebSearchActionSchema>;
|
|
1146
|
+
|
|
1147
|
+
export const ThreadItemSchema = z.discriminatedUnion("type", [
|
|
1148
|
+
z.object({
|
|
1149
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1150
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1151
|
+
"clientId": z.union([z.string(), z.null()]).optional(),
|
|
1152
|
+
"content": z.array(UserInputSchema),
|
|
1153
|
+
"id": z.string(),
|
|
1154
|
+
"type": z.literal("userMessage"),
|
|
1155
|
+
}),
|
|
1156
|
+
z.object({
|
|
1157
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1158
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1159
|
+
"fragments": z.array(HookPromptFragmentSchema),
|
|
1160
|
+
"id": z.string(),
|
|
1161
|
+
"type": z.literal("hookPrompt"),
|
|
1162
|
+
}),
|
|
1163
|
+
z.object({
|
|
1164
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1165
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1166
|
+
"delivery": z.union([AgentMessageDeliverySchema, z.null()]).default(null),
|
|
1167
|
+
"id": z.string(),
|
|
1168
|
+
"memoryCitation": z.union([MemoryCitationSchema, z.null()]).default(null),
|
|
1169
|
+
"moderation": z.union([AgentMessageModerationSchema, z.null()]).default(null),
|
|
1170
|
+
"phase": z.union([MessagePhaseSchema, z.null()]).default(null),
|
|
1171
|
+
"questions": z.union([z.array(AsyncUserInputQuestionSchema), z.null()]).default(null),
|
|
1172
|
+
"text": z.string(),
|
|
1173
|
+
"type": z.literal("agentMessage"),
|
|
1174
|
+
}),
|
|
1175
|
+
z.object({
|
|
1176
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1177
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1178
|
+
"id": z.string(),
|
|
1179
|
+
"name": z.string(),
|
|
1180
|
+
"namespace": z.union([z.string(), z.null()]).optional(),
|
|
1181
|
+
"output": FunctionCallOutputBodySchema,
|
|
1182
|
+
"type": z.literal("functionCallOutput"),
|
|
1183
|
+
}),
|
|
1184
|
+
z.object({
|
|
1185
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1186
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1187
|
+
"id": z.string(),
|
|
1188
|
+
"text": z.string(),
|
|
1189
|
+
"type": z.literal("plan"),
|
|
1190
|
+
}),
|
|
1191
|
+
z.object({
|
|
1192
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1193
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1194
|
+
"content": z.array(z.string()).default([]),
|
|
1195
|
+
"id": z.string(),
|
|
1196
|
+
"summary": z.array(z.string()).default([]),
|
|
1197
|
+
"type": z.literal("reasoning"),
|
|
1198
|
+
}),
|
|
1199
|
+
z.object({
|
|
1200
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1201
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1202
|
+
"aggregatedOutput": z.union([z.string(), z.null()]).optional(),
|
|
1203
|
+
"command": z.string(),
|
|
1204
|
+
"commandActions": z.array(CommandActionSchema),
|
|
1205
|
+
"cwd": LegacyAppPathStringSchema,
|
|
1206
|
+
"durationMs": z.union([z.number().int(), z.null()]).optional(),
|
|
1207
|
+
"exitCode": z.union([z.number().int(), z.null()]).optional(),
|
|
1208
|
+
"id": z.string(),
|
|
1209
|
+
"pluginId": z.union([z.string(), z.null()]).default(null),
|
|
1210
|
+
"processId": z.union([z.string(), z.null()]).optional(),
|
|
1211
|
+
"scriptPath": z.union([z.string(), z.null()]).default(null),
|
|
1212
|
+
"source": CommandExecutionSourceSchema.default("agent"),
|
|
1213
|
+
"status": CommandExecutionStatusSchema,
|
|
1214
|
+
"type": z.literal("commandExecution"),
|
|
1215
|
+
}),
|
|
1216
|
+
z.object({
|
|
1217
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1218
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1219
|
+
"changes": z.array(FileUpdateChangeSchema),
|
|
1220
|
+
"id": z.string(),
|
|
1221
|
+
"status": PatchApplyStatusSchema,
|
|
1222
|
+
"type": z.literal("fileChange"),
|
|
1223
|
+
}),
|
|
1224
|
+
z.object({
|
|
1225
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1226
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1227
|
+
"appContext": z.union([McpToolCallAppContextSchema, z.null()]).optional(),
|
|
1228
|
+
"arguments": z.json(),
|
|
1229
|
+
"durationMs": z.union([z.number().int(), z.null()]).optional(),
|
|
1230
|
+
"error": z.union([McpToolCallErrorSchema, z.null()]).optional(),
|
|
1231
|
+
"id": z.string(),
|
|
1232
|
+
"mcpAppResourceUri": z.union([z.string(), z.null()]).optional(),
|
|
1233
|
+
"mcpAppUi": z.union([McpAppUiSchema, z.null()]).optional(),
|
|
1234
|
+
"pluginId": z.union([z.string(), z.null()]).optional(),
|
|
1235
|
+
"readOnlyHint": z.union([z.boolean(), z.null()]).optional(),
|
|
1236
|
+
"result": z.union([McpToolCallResultSchema, z.null()]).optional(),
|
|
1237
|
+
"server": z.string(),
|
|
1238
|
+
"status": McpToolCallStatusSchema,
|
|
1239
|
+
"tool": z.string(),
|
|
1240
|
+
"type": z.literal("mcpToolCall"),
|
|
1241
|
+
}),
|
|
1242
|
+
z.object({
|
|
1243
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1244
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1245
|
+
"arguments": z.json(),
|
|
1246
|
+
"contentItems": z.union([z.array(DynamicToolCallOutputContentItemSchema), z.null()]).optional(),
|
|
1247
|
+
"durationMs": z.union([z.number().int(), z.null()]).optional(),
|
|
1248
|
+
"id": z.string(),
|
|
1249
|
+
"namespace": z.union([z.string(), z.null()]).optional(),
|
|
1250
|
+
"status": DynamicToolCallStatusSchema,
|
|
1251
|
+
"success": z.union([z.boolean(), z.null()]).optional(),
|
|
1252
|
+
"tool": z.string(),
|
|
1253
|
+
"type": z.literal("dynamicToolCall"),
|
|
1254
|
+
}),
|
|
1255
|
+
z.object({
|
|
1256
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1257
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1258
|
+
"agentsStates": z.record(z.string(), CollabAgentStateSchema),
|
|
1259
|
+
"id": z.string(),
|
|
1260
|
+
"model": z.union([z.string(), z.null()]).optional(),
|
|
1261
|
+
"prompt": z.union([z.string(), z.null()]).optional(),
|
|
1262
|
+
"reasoningEffort": z.union([ReasoningEffortSchema, z.null()]).optional(),
|
|
1263
|
+
"receiverThreadIds": z.array(z.string()),
|
|
1264
|
+
"senderThreadId": z.string(),
|
|
1265
|
+
"status": CollabAgentToolCallStatusSchema,
|
|
1266
|
+
"tool": CollabAgentToolSchema,
|
|
1267
|
+
"type": z.literal("collabAgentToolCall"),
|
|
1268
|
+
}),
|
|
1269
|
+
z.object({
|
|
1270
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1271
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1272
|
+
"agentPath": z.string(),
|
|
1273
|
+
"agentThreadId": z.string(),
|
|
1274
|
+
"id": z.string(),
|
|
1275
|
+
"kind": SubAgentActivityKindSchema,
|
|
1276
|
+
"model": z.union([z.string(), z.null()]).optional(),
|
|
1277
|
+
"reasoningEffort": z.union([ReasoningEffortSchema, z.null()]).optional(),
|
|
1278
|
+
"type": z.literal("subAgentActivity"),
|
|
1279
|
+
}),
|
|
1280
|
+
z.object({
|
|
1281
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1282
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1283
|
+
"action": z.union([WebSearchActionSchema, z.null()]).optional(),
|
|
1284
|
+
"id": z.string(),
|
|
1285
|
+
"query": z.string(),
|
|
1286
|
+
"results": z.union([z.array(z.json()), z.null()]).default(null),
|
|
1287
|
+
"type": z.literal("webSearch"),
|
|
1288
|
+
}),
|
|
1289
|
+
z.object({
|
|
1290
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1291
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1292
|
+
"id": z.string(),
|
|
1293
|
+
"path": LegacyAppPathStringSchema,
|
|
1294
|
+
"type": z.literal("imageView"),
|
|
1295
|
+
}),
|
|
1296
|
+
z.object({
|
|
1297
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1298
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1299
|
+
"durationMs": z.number().int().gte(0),
|
|
1300
|
+
"id": z.string(),
|
|
1301
|
+
"type": z.literal("sleep"),
|
|
1302
|
+
}),
|
|
1303
|
+
z.object({
|
|
1304
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1305
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1306
|
+
"failure": z.union([ImageGenerationFailureSchema, z.null()]).default(null),
|
|
1307
|
+
"generationId": z.union([z.string(), z.null()]).default(null),
|
|
1308
|
+
"id": z.string(),
|
|
1309
|
+
"inputImages": z.array(ImageGenerationInputImageSchema).optional(),
|
|
1310
|
+
"revisedPrompt": z.union([z.string(), z.null()]).optional(),
|
|
1311
|
+
"savedPath": z.union([AbsolutePathBufSchema, z.null()]).optional(),
|
|
1312
|
+
"status": z.string(),
|
|
1313
|
+
"transparentBackground": z.union([z.boolean(), z.null()]).default(null),
|
|
1314
|
+
"type": z.literal("imageGeneration"),
|
|
1315
|
+
"fileId": z.string().optional(),
|
|
1316
|
+
"result": z.string().optional(),
|
|
1317
|
+
}),
|
|
1318
|
+
z.object({
|
|
1319
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1320
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1321
|
+
"id": z.string(),
|
|
1322
|
+
"review": z.string(),
|
|
1323
|
+
"type": z.literal("enteredReviewMode"),
|
|
1324
|
+
}),
|
|
1325
|
+
z.object({
|
|
1326
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1327
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1328
|
+
"id": z.string(),
|
|
1329
|
+
"review": z.string(),
|
|
1330
|
+
"type": z.literal("exitedReviewMode"),
|
|
1331
|
+
}),
|
|
1332
|
+
z.object({
|
|
1333
|
+
"completedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1334
|
+
"startedAtMs": z.union([z.number().int(), z.null()]).default(null),
|
|
1335
|
+
"id": z.string(),
|
|
1336
|
+
"type": z.literal("contextCompaction"),
|
|
1337
|
+
}),
|
|
1338
|
+
]);
|
|
1339
|
+
export type ThreadItem = z.infer<typeof ThreadItemSchema>;
|
|
1340
|
+
|
|
1341
|
+
export const ItemCompletedNotificationSchema = z.object({
|
|
1342
|
+
"completedAtMs": z.number().int(),
|
|
1343
|
+
"contentTokenCount": z.union([z.number().int().gte(0), z.null()]).default(null),
|
|
1344
|
+
"item": ThreadItemSchema,
|
|
1345
|
+
"threadId": z.string(),
|
|
1346
|
+
"turnId": z.string(),
|
|
1347
|
+
});
|
|
1348
|
+
export type ItemCompletedNotification = z.infer<typeof ItemCompletedNotificationSchema>;
|
|
1349
|
+
|
|
1350
|
+
export const ItemGuardianApprovalReviewCompletedNotificationSchema = z.object({
|
|
1351
|
+
"action": GuardianApprovalReviewActionSchema,
|
|
1352
|
+
"completedAtMs": z.number().int(),
|
|
1353
|
+
"decisionSource": AutoReviewDecisionSourceSchema,
|
|
1354
|
+
"review": GuardianApprovalReviewSchema,
|
|
1355
|
+
"reviewId": z.string(),
|
|
1356
|
+
"startedAtMs": z.number().int(),
|
|
1357
|
+
"targetItemId": z.union([z.string(), z.null()]).optional(),
|
|
1358
|
+
"threadId": z.string(),
|
|
1359
|
+
"turnId": z.string(),
|
|
1360
|
+
});
|
|
1361
|
+
export type ItemGuardianApprovalReviewCompletedNotification = z.infer<typeof ItemGuardianApprovalReviewCompletedNotificationSchema>;
|
|
1362
|
+
|
|
1363
|
+
export const ItemGuardianApprovalReviewStartedNotificationSchema = z.object({
|
|
1364
|
+
"action": GuardianApprovalReviewActionSchema,
|
|
1365
|
+
"review": GuardianApprovalReviewSchema,
|
|
1366
|
+
"reviewId": z.string(),
|
|
1367
|
+
"startedAtMs": z.number().int(),
|
|
1368
|
+
"targetItemId": z.union([z.string(), z.null()]).optional(),
|
|
1369
|
+
"threadId": z.string(),
|
|
1370
|
+
"turnId": z.string(),
|
|
1371
|
+
});
|
|
1372
|
+
export type ItemGuardianApprovalReviewStartedNotification = z.infer<typeof ItemGuardianApprovalReviewStartedNotificationSchema>;
|
|
1373
|
+
|
|
1374
|
+
export const ItemStartedNotificationSchema = z.object({
|
|
1375
|
+
"item": ThreadItemSchema,
|
|
1376
|
+
"startedAtMs": z.number().int(),
|
|
1377
|
+
"threadId": z.string(),
|
|
1378
|
+
"turnId": z.string(),
|
|
1379
|
+
});
|
|
1380
|
+
export type ItemStartedNotification = z.infer<typeof ItemStartedNotificationSchema>;
|
|
1381
|
+
|
|
1382
|
+
export const JSONRPCErrorErrorSchema = z.object({
|
|
1383
|
+
"code": z.number().int(),
|
|
1384
|
+
"data": z.json().optional(),
|
|
1385
|
+
"message": z.string(),
|
|
1386
|
+
});
|
|
1387
|
+
export type JSONRPCErrorError = z.infer<typeof JSONRPCErrorErrorSchema>;
|
|
1388
|
+
|
|
1389
|
+
export const RequestIdSchema = z.union([z.string(), z.number().int()]);
|
|
1390
|
+
export type RequestId = z.infer<typeof RequestIdSchema>;
|
|
1391
|
+
|
|
1392
|
+
export const JSONRPCErrorSchema = z.object({ "error": JSONRPCErrorErrorSchema, "id": RequestIdSchema });
|
|
1393
|
+
export type JSONRPCError = z.infer<typeof JSONRPCErrorSchema>;
|
|
1394
|
+
|
|
1395
|
+
export const JSONRPCNotificationSchema = z.object({ "method": z.string(), "params": z.json().optional() });
|
|
1396
|
+
export type JSONRPCNotification = z.infer<typeof JSONRPCNotificationSchema>;
|
|
1397
|
+
|
|
1398
|
+
export const W3cTraceContextSchema = z.object({
|
|
1399
|
+
"traceparent": z.union([z.string(), z.null()]).optional(),
|
|
1400
|
+
"tracestate": z.union([z.string(), z.null()]).optional(),
|
|
1401
|
+
});
|
|
1402
|
+
export type W3cTraceContext = z.infer<typeof W3cTraceContextSchema>;
|
|
1403
|
+
|
|
1404
|
+
export const JSONRPCRequestSchema = z.object({
|
|
1405
|
+
"id": RequestIdSchema,
|
|
1406
|
+
"method": z.string(),
|
|
1407
|
+
"params": z.json().optional(),
|
|
1408
|
+
"trace": z.union([W3cTraceContextSchema, z.null()]).optional(),
|
|
1409
|
+
});
|
|
1410
|
+
export type JSONRPCRequest = z.infer<typeof JSONRPCRequestSchema>;
|
|
1411
|
+
|
|
1412
|
+
export const JSONRPCResponseSchema = z.object({ "id": RequestIdSchema, "result": z.json() });
|
|
1413
|
+
export type JSONRPCResponse = z.infer<typeof JSONRPCResponseSchema>;
|
|
1414
|
+
|
|
1415
|
+
export const JSONRPCMessageSchema = z.union([
|
|
1416
|
+
JSONRPCRequestSchema,
|
|
1417
|
+
JSONRPCNotificationSchema,
|
|
1418
|
+
JSONRPCResponseSchema,
|
|
1419
|
+
JSONRPCErrorSchema,
|
|
1420
|
+
]);
|
|
1421
|
+
export type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
|
|
1422
|
+
|
|
1423
|
+
export const McpElicitationArrayTypeSchema = z.literal("array");
|
|
1424
|
+
export type McpElicitationArrayType = z.infer<typeof McpElicitationArrayTypeSchema>;
|
|
1425
|
+
|
|
1426
|
+
export const McpElicitationBooleanTypeSchema = z.literal("boolean");
|
|
1427
|
+
export type McpElicitationBooleanType = z.infer<typeof McpElicitationBooleanTypeSchema>;
|
|
1428
|
+
|
|
1429
|
+
export const McpElicitationBooleanSchemaSchema = z.object({
|
|
1430
|
+
"default": z.union([z.boolean(), z.null()]).optional(),
|
|
1431
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
1432
|
+
"title": z.union([z.string(), z.null()]).optional(),
|
|
1433
|
+
"type": McpElicitationBooleanTypeSchema,
|
|
1434
|
+
});
|
|
1435
|
+
export type McpElicitationBooleanSchema = z.infer<typeof McpElicitationBooleanSchemaSchema>;
|
|
1436
|
+
|
|
1437
|
+
export const McpElicitationConstOptionSchema = z.object({ "const": z.string(), "title": z.string() });
|
|
1438
|
+
export type McpElicitationConstOption = z.infer<typeof McpElicitationConstOptionSchema>;
|
|
1439
|
+
|
|
1440
|
+
export const McpElicitationStringTypeSchema = z.literal("string");
|
|
1441
|
+
export type McpElicitationStringType = z.infer<typeof McpElicitationStringTypeSchema>;
|
|
1442
|
+
|
|
1443
|
+
export const McpElicitationLegacyTitledEnumSchemaSchema = z.object({
|
|
1444
|
+
"default": z.union([z.string(), z.null()]).optional(),
|
|
1445
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
1446
|
+
"enum": z.array(z.string()),
|
|
1447
|
+
"enumNames": z.union([z.array(z.string()), z.null()]).optional(),
|
|
1448
|
+
"title": z.union([z.string(), z.null()]).optional(),
|
|
1449
|
+
"type": McpElicitationStringTypeSchema,
|
|
1450
|
+
});
|
|
1451
|
+
export type McpElicitationLegacyTitledEnumSchema = z.infer<typeof McpElicitationLegacyTitledEnumSchemaSchema>;
|
|
1452
|
+
|
|
1453
|
+
export const McpElicitationTitledEnumItemsSchema = z.object({
|
|
1454
|
+
"anyOf": z.array(McpElicitationConstOptionSchema),
|
|
1455
|
+
});
|
|
1456
|
+
export type McpElicitationTitledEnumItems = z.infer<typeof McpElicitationTitledEnumItemsSchema>;
|
|
1457
|
+
|
|
1458
|
+
export const McpElicitationTitledMultiSelectEnumSchemaSchema = z.object({
|
|
1459
|
+
"default": z.union([z.array(z.string()), z.null()]).optional(),
|
|
1460
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
1461
|
+
"items": McpElicitationTitledEnumItemsSchema,
|
|
1462
|
+
"maxItems": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
1463
|
+
"minItems": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
1464
|
+
"title": z.union([z.string(), z.null()]).optional(),
|
|
1465
|
+
"type": McpElicitationArrayTypeSchema,
|
|
1466
|
+
});
|
|
1467
|
+
export type McpElicitationTitledMultiSelectEnumSchema = z.infer<typeof McpElicitationTitledMultiSelectEnumSchemaSchema>;
|
|
1468
|
+
|
|
1469
|
+
export const McpElicitationUntitledEnumItemsSchema = z.object({
|
|
1470
|
+
"enum": z.array(z.string()),
|
|
1471
|
+
"type": McpElicitationStringTypeSchema,
|
|
1472
|
+
});
|
|
1473
|
+
export type McpElicitationUntitledEnumItems = z.infer<typeof McpElicitationUntitledEnumItemsSchema>;
|
|
1474
|
+
|
|
1475
|
+
export const McpElicitationUntitledMultiSelectEnumSchemaSchema = z.object({
|
|
1476
|
+
"default": z.union([z.array(z.string()), z.null()]).optional(),
|
|
1477
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
1478
|
+
"items": McpElicitationUntitledEnumItemsSchema,
|
|
1479
|
+
"maxItems": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
1480
|
+
"minItems": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
1481
|
+
"title": z.union([z.string(), z.null()]).optional(),
|
|
1482
|
+
"type": McpElicitationArrayTypeSchema,
|
|
1483
|
+
});
|
|
1484
|
+
export type McpElicitationUntitledMultiSelectEnumSchema = z.infer<typeof McpElicitationUntitledMultiSelectEnumSchemaSchema>;
|
|
1485
|
+
|
|
1486
|
+
export const McpElicitationMultiSelectEnumSchemaSchema = z.union([
|
|
1487
|
+
McpElicitationUntitledMultiSelectEnumSchemaSchema,
|
|
1488
|
+
McpElicitationTitledMultiSelectEnumSchemaSchema,
|
|
1489
|
+
]);
|
|
1490
|
+
export type McpElicitationMultiSelectEnumSchema = z.infer<typeof McpElicitationMultiSelectEnumSchemaSchema>;
|
|
1491
|
+
|
|
1492
|
+
export const McpElicitationTitledSingleSelectEnumSchemaSchema = z.object({
|
|
1493
|
+
"default": z.union([z.string(), z.null()]).optional(),
|
|
1494
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
1495
|
+
"oneOf": z.array(McpElicitationConstOptionSchema),
|
|
1496
|
+
"title": z.union([z.string(), z.null()]).optional(),
|
|
1497
|
+
"type": McpElicitationStringTypeSchema,
|
|
1498
|
+
});
|
|
1499
|
+
export type McpElicitationTitledSingleSelectEnumSchema = z.infer<typeof McpElicitationTitledSingleSelectEnumSchemaSchema>;
|
|
1500
|
+
|
|
1501
|
+
export const McpElicitationUntitledSingleSelectEnumSchemaSchema = z.object({
|
|
1502
|
+
"default": z.union([z.string(), z.null()]).optional(),
|
|
1503
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
1504
|
+
"enum": z.array(z.string()),
|
|
1505
|
+
"title": z.union([z.string(), z.null()]).optional(),
|
|
1506
|
+
"type": McpElicitationStringTypeSchema,
|
|
1507
|
+
});
|
|
1508
|
+
export type McpElicitationUntitledSingleSelectEnumSchema = z.infer<typeof McpElicitationUntitledSingleSelectEnumSchemaSchema>;
|
|
1509
|
+
|
|
1510
|
+
export const McpElicitationSingleSelectEnumSchemaSchema = z.union([
|
|
1511
|
+
McpElicitationUntitledSingleSelectEnumSchemaSchema,
|
|
1512
|
+
McpElicitationTitledSingleSelectEnumSchemaSchema,
|
|
1513
|
+
]);
|
|
1514
|
+
export type McpElicitationSingleSelectEnumSchema = z.infer<typeof McpElicitationSingleSelectEnumSchemaSchema>;
|
|
1515
|
+
|
|
1516
|
+
export const McpElicitationEnumSchemaSchema = z.union([
|
|
1517
|
+
McpElicitationSingleSelectEnumSchemaSchema,
|
|
1518
|
+
McpElicitationMultiSelectEnumSchemaSchema,
|
|
1519
|
+
McpElicitationLegacyTitledEnumSchemaSchema,
|
|
1520
|
+
]);
|
|
1521
|
+
export type McpElicitationEnumSchema = z.infer<typeof McpElicitationEnumSchemaSchema>;
|
|
1522
|
+
|
|
1523
|
+
export const McpElicitationNumberTypeSchema = z.enum(["number", "integer"]);
|
|
1524
|
+
export type McpElicitationNumberType = z.infer<typeof McpElicitationNumberTypeSchema>;
|
|
1525
|
+
|
|
1526
|
+
export const McpElicitationNumberSchemaSchema = z.object({
|
|
1527
|
+
"default": z.union([z.number(), z.null()]).optional(),
|
|
1528
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
1529
|
+
"maximum": z.union([z.number(), z.null()]).optional(),
|
|
1530
|
+
"minimum": z.union([z.number(), z.null()]).optional(),
|
|
1531
|
+
"title": z.union([z.string(), z.null()]).optional(),
|
|
1532
|
+
"type": McpElicitationNumberTypeSchema,
|
|
1533
|
+
});
|
|
1534
|
+
export type McpElicitationNumberSchema = z.infer<typeof McpElicitationNumberSchemaSchema>;
|
|
1535
|
+
|
|
1536
|
+
export const McpElicitationObjectTypeSchema = z.literal("object");
|
|
1537
|
+
export type McpElicitationObjectType = z.infer<typeof McpElicitationObjectTypeSchema>;
|
|
1538
|
+
|
|
1539
|
+
export const McpElicitationStringFormatSchema = z.enum(["email", "uri", "date", "date-time"]);
|
|
1540
|
+
export type McpElicitationStringFormat = z.infer<typeof McpElicitationStringFormatSchema>;
|
|
1541
|
+
|
|
1542
|
+
export const McpElicitationStringSchemaSchema = z.object({
|
|
1543
|
+
"default": z.union([z.string(), z.null()]).optional(),
|
|
1544
|
+
"description": z.union([z.string(), z.null()]).optional(),
|
|
1545
|
+
"format": z.union([McpElicitationStringFormatSchema, z.null()]).optional(),
|
|
1546
|
+
"maxLength": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
1547
|
+
"minLength": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
1548
|
+
"title": z.union([z.string(), z.null()]).optional(),
|
|
1549
|
+
"type": McpElicitationStringTypeSchema,
|
|
1550
|
+
});
|
|
1551
|
+
export type McpElicitationStringSchema = z.infer<typeof McpElicitationStringSchemaSchema>;
|
|
1552
|
+
|
|
1553
|
+
export const McpElicitationPrimitiveSchemaSchema = z.union([
|
|
1554
|
+
McpElicitationEnumSchemaSchema,
|
|
1555
|
+
McpElicitationStringSchemaSchema,
|
|
1556
|
+
McpElicitationNumberSchemaSchema,
|
|
1557
|
+
McpElicitationBooleanSchemaSchema,
|
|
1558
|
+
]);
|
|
1559
|
+
export type McpElicitationPrimitiveSchema = z.infer<typeof McpElicitationPrimitiveSchemaSchema>;
|
|
1560
|
+
|
|
1561
|
+
export const McpElicitationSchemaSchema = z.object({
|
|
1562
|
+
"$schema": z.union([z.string(), z.null()]).optional(),
|
|
1563
|
+
"properties": z.record(z.string(), McpElicitationPrimitiveSchemaSchema),
|
|
1564
|
+
"required": z.union([z.array(z.string()), z.null()]).optional(),
|
|
1565
|
+
"type": McpElicitationObjectTypeSchema,
|
|
1566
|
+
});
|
|
1567
|
+
export type McpElicitationSchema = z.infer<typeof McpElicitationSchemaSchema>;
|
|
1568
|
+
|
|
1569
|
+
export const McpServerElicitationActionSchema = z.enum(["accept", "decline", "cancel"]);
|
|
1570
|
+
export type McpServerElicitationAction = z.infer<typeof McpServerElicitationActionSchema>;
|
|
1571
|
+
|
|
1572
|
+
export const McpServerElicitationRequestParamsSchema = z.discriminatedUnion("mode", [
|
|
1573
|
+
z.object({
|
|
1574
|
+
"serverName": z.string(),
|
|
1575
|
+
"threadId": z.string(),
|
|
1576
|
+
"turnId": z.union([z.string(), z.null()]).optional(),
|
|
1577
|
+
"_meta": z.json().optional(),
|
|
1578
|
+
"message": z.string(),
|
|
1579
|
+
"mode": z.literal("form"),
|
|
1580
|
+
"requestedSchema": McpElicitationSchemaSchema,
|
|
1581
|
+
}),
|
|
1582
|
+
z.object({
|
|
1583
|
+
"serverName": z.string(),
|
|
1584
|
+
"threadId": z.string(),
|
|
1585
|
+
"turnId": z.union([z.string(), z.null()]).optional(),
|
|
1586
|
+
"_meta": z.json().optional(),
|
|
1587
|
+
"message": z.string(),
|
|
1588
|
+
"mode": z.literal("openai/form"),
|
|
1589
|
+
"requestedSchema": z.json(),
|
|
1590
|
+
}),
|
|
1591
|
+
z.object({
|
|
1592
|
+
"serverName": z.string(),
|
|
1593
|
+
"threadId": z.string(),
|
|
1594
|
+
"turnId": z.union([z.string(), z.null()]).optional(),
|
|
1595
|
+
"_meta": z.json().optional(),
|
|
1596
|
+
"message": z.string(),
|
|
1597
|
+
"mode": z.literal("openaiForm"),
|
|
1598
|
+
"requestedSchema": z.json(),
|
|
1599
|
+
}),
|
|
1600
|
+
z.object({
|
|
1601
|
+
"serverName": z.string(),
|
|
1602
|
+
"threadId": z.string(),
|
|
1603
|
+
"turnId": z.union([z.string(), z.null()]).optional(),
|
|
1604
|
+
"_meta": z.json().optional(),
|
|
1605
|
+
"elicitationId": z.string(),
|
|
1606
|
+
"message": z.string(),
|
|
1607
|
+
"mode": z.literal("url"),
|
|
1608
|
+
"url": z.string(),
|
|
1609
|
+
}),
|
|
1610
|
+
]);
|
|
1611
|
+
export type McpServerElicitationRequestParams = z.infer<typeof McpServerElicitationRequestParamsSchema>;
|
|
1612
|
+
|
|
1613
|
+
export const McpServerElicitationRequestResponseSchema = z.object({
|
|
1614
|
+
"_meta": z.json().optional(),
|
|
1615
|
+
"action": McpServerElicitationActionSchema,
|
|
1616
|
+
"content": z.json().optional(),
|
|
1617
|
+
});
|
|
1618
|
+
export type McpServerElicitationRequestResponse = z.infer<typeof McpServerElicitationRequestResponseSchema>;
|
|
1619
|
+
|
|
1620
|
+
export const McpServerEventNotificationSchema = z.object({ "method": z.string(), "params": z.json() });
|
|
1621
|
+
export type McpServerEventNotification = z.infer<typeof McpServerEventNotificationSchema>;
|
|
1622
|
+
|
|
1623
|
+
export const McpServerEventStreamNotificationSchema = z.object({
|
|
1624
|
+
"notification": McpServerEventNotificationSchema,
|
|
1625
|
+
"subscriptionId": z.string(),
|
|
1626
|
+
});
|
|
1627
|
+
export type McpServerEventStreamNotification = z.infer<typeof McpServerEventStreamNotificationSchema>;
|
|
1628
|
+
|
|
1629
|
+
export const McpServerOauthLoginCompletedNotificationSchema = z.object({
|
|
1630
|
+
"error": z.union([z.string(), z.null()]).optional(),
|
|
1631
|
+
"loginId": z.union([z.string(), z.null()]).optional(),
|
|
1632
|
+
"name": z.string(),
|
|
1633
|
+
"success": z.boolean(),
|
|
1634
|
+
"threadId": z.union([z.string(), z.null()]).optional(),
|
|
1635
|
+
});
|
|
1636
|
+
export type McpServerOauthLoginCompletedNotification = z.infer<typeof McpServerOauthLoginCompletedNotificationSchema>;
|
|
1637
|
+
|
|
1638
|
+
export const McpServerStartupFailureReasonSchema = z.literal("reauthenticationRequired");
|
|
1639
|
+
export type McpServerStartupFailureReason = z.infer<typeof McpServerStartupFailureReasonSchema>;
|
|
1640
|
+
|
|
1641
|
+
export const McpServerStartupStateSchema = z.enum(["starting", "ready", "failed", "cancelled"]);
|
|
1642
|
+
export type McpServerStartupState = z.infer<typeof McpServerStartupStateSchema>;
|
|
1643
|
+
|
|
1644
|
+
export const McpServerStatusUpdatedNotificationSchema = z.object({
|
|
1645
|
+
"error": z.union([z.string(), z.null()]).optional(),
|
|
1646
|
+
"failureReason": z.union([McpServerStartupFailureReasonSchema, z.null()]).optional(),
|
|
1647
|
+
"name": z.string(),
|
|
1648
|
+
"status": McpServerStartupStateSchema,
|
|
1649
|
+
"threadId": z.union([z.string(), z.null()]).optional(),
|
|
1650
|
+
});
|
|
1651
|
+
export type McpServerStatusUpdatedNotification = z.infer<typeof McpServerStatusUpdatedNotificationSchema>;
|
|
1652
|
+
|
|
1653
|
+
export const McpToolCallProgressNotificationSchema = z.object({
|
|
1654
|
+
"itemId": z.string(),
|
|
1655
|
+
"message": z.string(),
|
|
1656
|
+
"threadId": z.string(),
|
|
1657
|
+
"turnId": z.string(),
|
|
1658
|
+
});
|
|
1659
|
+
export type McpToolCallProgressNotification = z.infer<typeof McpToolCallProgressNotificationSchema>;
|
|
1660
|
+
|
|
1661
|
+
export const ModelRerouteReasonSchema = z.literal("highRiskCyberActivity");
|
|
1662
|
+
export type ModelRerouteReason = z.infer<typeof ModelRerouteReasonSchema>;
|
|
1663
|
+
|
|
1664
|
+
export const ModelReroutedNotificationSchema = z.object({
|
|
1665
|
+
"fromModel": z.string(),
|
|
1666
|
+
"reason": ModelRerouteReasonSchema,
|
|
1667
|
+
"threadId": z.string(),
|
|
1668
|
+
"toModel": z.string(),
|
|
1669
|
+
"turnId": z.string(),
|
|
1670
|
+
});
|
|
1671
|
+
export type ModelReroutedNotification = z.infer<typeof ModelReroutedNotificationSchema>;
|
|
1672
|
+
|
|
1673
|
+
export const ModelSafetyBufferingUpdatedNotificationSchema = z.object({
|
|
1674
|
+
"fasterModel": z.union([z.string(), z.null()]).optional(),
|
|
1675
|
+
"model": z.string(),
|
|
1676
|
+
"reasons": z.array(z.string()),
|
|
1677
|
+
"showBufferingUi": z.boolean(),
|
|
1678
|
+
"threadId": z.string(),
|
|
1679
|
+
"turnId": z.string(),
|
|
1680
|
+
"useCases": z.array(z.string()),
|
|
1681
|
+
});
|
|
1682
|
+
export type ModelSafetyBufferingUpdatedNotification = z.infer<typeof ModelSafetyBufferingUpdatedNotificationSchema>;
|
|
1683
|
+
|
|
1684
|
+
export const ModelVerificationSchema = z.literal("trustedAccessForCyber");
|
|
1685
|
+
export type ModelVerification = z.infer<typeof ModelVerificationSchema>;
|
|
1686
|
+
|
|
1687
|
+
export const ModelVerificationNotificationSchema = z.object({
|
|
1688
|
+
"threadId": z.string(),
|
|
1689
|
+
"turnId": z.string(),
|
|
1690
|
+
"verifications": z.array(ModelVerificationSchema),
|
|
1691
|
+
});
|
|
1692
|
+
export type ModelVerificationNotification = z.infer<typeof ModelVerificationNotificationSchema>;
|
|
1693
|
+
|
|
1694
|
+
export const MultiAgentModeSchema = z.union([
|
|
1695
|
+
z.enum(["explicitRequestOnly", "proactive"]),
|
|
1696
|
+
z.object({ "custom": z.string() }),
|
|
1697
|
+
]);
|
|
1698
|
+
export type MultiAgentMode = z.infer<typeof MultiAgentModeSchema>;
|
|
1699
|
+
|
|
1700
|
+
export const NetworkAccessSchema = z.enum(["restricted", "enabled"]);
|
|
1701
|
+
export type NetworkAccess = z.infer<typeof NetworkAccessSchema>;
|
|
1702
|
+
|
|
1703
|
+
export const PermissionGrantScopeSchema = z.enum(["turn", "session"]);
|
|
1704
|
+
export type PermissionGrantScope = z.infer<typeof PermissionGrantScopeSchema>;
|
|
1705
|
+
|
|
1706
|
+
export const PermissionsRequestApprovalParamsSchema = z.object({
|
|
1707
|
+
"cwd": LegacyAppPathStringSchema,
|
|
1708
|
+
"environmentId": z.union([z.string(), z.null()]).default(null),
|
|
1709
|
+
"itemId": z.string(),
|
|
1710
|
+
"permissions": RequestPermissionProfileSchema,
|
|
1711
|
+
"reason": z.union([z.string(), z.null()]).optional(),
|
|
1712
|
+
"startedAtMs": z.number().int(),
|
|
1713
|
+
"threadId": z.string(),
|
|
1714
|
+
"turnId": z.string(),
|
|
1715
|
+
});
|
|
1716
|
+
export type PermissionsRequestApprovalParams = z.infer<typeof PermissionsRequestApprovalParamsSchema>;
|
|
1717
|
+
|
|
1718
|
+
export const PermissionsRequestApprovalResponseSchema = z.object({
|
|
1719
|
+
"permissions": GrantedPermissionProfileSchema,
|
|
1720
|
+
"scope": PermissionGrantScopeSchema.default("turn"),
|
|
1721
|
+
"strictAutoReview": z.union([z.boolean(), z.null()]).optional(),
|
|
1722
|
+
});
|
|
1723
|
+
export type PermissionsRequestApprovalResponse = z.infer<typeof PermissionsRequestApprovalResponseSchema>;
|
|
1724
|
+
|
|
1725
|
+
export const PersonalitySchema = z.enum(["none", "friendly", "pragmatic"]);
|
|
1726
|
+
export type Personality = z.infer<typeof PersonalitySchema>;
|
|
1727
|
+
|
|
1728
|
+
export const PlanDeltaNotificationSchema = z.object({
|
|
1729
|
+
"delta": z.string(),
|
|
1730
|
+
"itemId": z.string(),
|
|
1731
|
+
"threadId": z.string(),
|
|
1732
|
+
"turnId": z.string(),
|
|
1733
|
+
});
|
|
1734
|
+
export type PlanDeltaNotification = z.infer<typeof PlanDeltaNotificationSchema>;
|
|
1735
|
+
|
|
1736
|
+
export const ProcessExitedNotificationSchema = z.object({
|
|
1737
|
+
"exitCode": z.number().int(),
|
|
1738
|
+
"outputDrainTimedOut": z.union([z.boolean(), z.null()]).optional(),
|
|
1739
|
+
"processHandle": z.string(),
|
|
1740
|
+
"stderr": z.string(),
|
|
1741
|
+
"stderrCapReached": z.boolean(),
|
|
1742
|
+
"stdout": z.string(),
|
|
1743
|
+
"stdoutCapReached": z.boolean(),
|
|
1744
|
+
});
|
|
1745
|
+
export type ProcessExitedNotification = z.infer<typeof ProcessExitedNotificationSchema>;
|
|
1746
|
+
|
|
1747
|
+
export const ProcessOutputStreamSchema = z.union([z.literal("stdout"), z.literal("stderr")]);
|
|
1748
|
+
export type ProcessOutputStream = z.infer<typeof ProcessOutputStreamSchema>;
|
|
1749
|
+
|
|
1750
|
+
export const ProcessOutputDeltaNotificationSchema = z.object({
|
|
1751
|
+
"capReached": z.boolean(),
|
|
1752
|
+
"deltaBase64": z.string(),
|
|
1753
|
+
"processHandle": z.string(),
|
|
1754
|
+
"stream": ProcessOutputStreamSchema,
|
|
1755
|
+
});
|
|
1756
|
+
export type ProcessOutputDeltaNotification = z.infer<typeof ProcessOutputDeltaNotificationSchema>;
|
|
1757
|
+
|
|
1758
|
+
export const ProjectChangeTypeSchema = z.enum(["created", "updated", "deleted"]);
|
|
1759
|
+
export type ProjectChangeType = z.infer<typeof ProjectChangeTypeSchema>;
|
|
1760
|
+
|
|
1761
|
+
export const ProjectChangedNotificationSchema = z.object({
|
|
1762
|
+
"changeType": ProjectChangeTypeSchema,
|
|
1763
|
+
"projectId": z.string(),
|
|
1764
|
+
});
|
|
1765
|
+
export type ProjectChangedNotification = z.infer<typeof ProjectChangedNotificationSchema>;
|
|
1766
|
+
|
|
1767
|
+
export const RealtimeConversationVersionSchema = z.enum(["v1", "v2", "v3"]);
|
|
1768
|
+
export type RealtimeConversationVersion = z.infer<typeof RealtimeConversationVersionSchema>;
|
|
1769
|
+
|
|
1770
|
+
export const ReasoningSummarySchema = z.union([z.enum(["auto", "concise", "detailed"]), z.literal("none")]);
|
|
1771
|
+
export type ReasoningSummary = z.infer<typeof ReasoningSummarySchema>;
|
|
1772
|
+
|
|
1773
|
+
export const ReasoningSummaryPartAddedNotificationSchema = z.object({
|
|
1774
|
+
"itemId": z.string(),
|
|
1775
|
+
"summaryIndex": z.number().int(),
|
|
1776
|
+
"threadId": z.string(),
|
|
1777
|
+
"turnId": z.string(),
|
|
1778
|
+
});
|
|
1779
|
+
export type ReasoningSummaryPartAddedNotification = z.infer<typeof ReasoningSummaryPartAddedNotificationSchema>;
|
|
1780
|
+
|
|
1781
|
+
export const ReasoningSummaryTextDeltaNotificationSchema = z.object({
|
|
1782
|
+
"delta": z.string(),
|
|
1783
|
+
"itemId": z.string(),
|
|
1784
|
+
"summaryIndex": z.number().int(),
|
|
1785
|
+
"threadId": z.string(),
|
|
1786
|
+
"turnId": z.string(),
|
|
1787
|
+
});
|
|
1788
|
+
export type ReasoningSummaryTextDeltaNotification = z.infer<typeof ReasoningSummaryTextDeltaNotificationSchema>;
|
|
1789
|
+
|
|
1790
|
+
export const ReasoningTextDeltaNotificationSchema = z.object({
|
|
1791
|
+
"contentIndex": z.number().int(),
|
|
1792
|
+
"delta": z.string(),
|
|
1793
|
+
"itemId": z.string(),
|
|
1794
|
+
"threadId": z.string(),
|
|
1795
|
+
"turnId": z.string(),
|
|
1796
|
+
});
|
|
1797
|
+
export type ReasoningTextDeltaNotification = z.infer<typeof ReasoningTextDeltaNotificationSchema>;
|
|
1798
|
+
|
|
1799
|
+
export const RemoteControlConnectionStatusSchema = z.enum(["disabled", "connecting", "connected", "errored"]);
|
|
1800
|
+
export type RemoteControlConnectionStatus = z.infer<typeof RemoteControlConnectionStatusSchema>;
|
|
1801
|
+
|
|
1802
|
+
export const RemoteControlStatusChangedNotificationSchema = z.object({
|
|
1803
|
+
"environmentId": z.union([z.string(), z.null()]).optional(),
|
|
1804
|
+
"installationId": z.string(),
|
|
1805
|
+
"serverName": z.string(),
|
|
1806
|
+
"status": RemoteControlConnectionStatusSchema,
|
|
1807
|
+
});
|
|
1808
|
+
export type RemoteControlStatusChangedNotification = z.infer<typeof RemoteControlStatusChangedNotificationSchema>;
|
|
1809
|
+
|
|
1810
|
+
export const SandboxPolicySchema = z.discriminatedUnion("type", [
|
|
1811
|
+
z.object({ "type": z.literal("dangerFullAccess") }),
|
|
1812
|
+
z.object({ "networkAccess": z.boolean().default(false), "type": z.literal("readOnly") }),
|
|
1813
|
+
z.object({
|
|
1814
|
+
"networkAccess": NetworkAccessSchema.default("restricted"),
|
|
1815
|
+
"type": z.literal("externalSandbox"),
|
|
1816
|
+
}),
|
|
1817
|
+
z.object({
|
|
1818
|
+
"excludeSlashTmp": z.boolean().default(false),
|
|
1819
|
+
"excludeTmpdirEnvVar": z.boolean().default(false),
|
|
1820
|
+
"networkAccess": z.boolean().default(false),
|
|
1821
|
+
"type": z.literal("workspaceWrite"),
|
|
1822
|
+
"writableRoots": z.array(AbsolutePathBufSchema).default([]),
|
|
1823
|
+
}),
|
|
1824
|
+
]);
|
|
1825
|
+
export type SandboxPolicy = z.infer<typeof SandboxPolicySchema>;
|
|
1826
|
+
|
|
1827
|
+
export const ServerRequestResolvedNotificationSchema = z.object({
|
|
1828
|
+
"requestId": RequestIdSchema,
|
|
1829
|
+
"threadId": z.string(),
|
|
1830
|
+
});
|
|
1831
|
+
export type ServerRequestResolvedNotification = z.infer<typeof ServerRequestResolvedNotificationSchema>;
|
|
1832
|
+
|
|
1833
|
+
export const SkillsChangedNotificationSchema = z.record(z.string(), z.any());
|
|
1834
|
+
export type SkillsChangedNotification = z.infer<typeof SkillsChangedNotificationSchema>;
|
|
1835
|
+
|
|
1836
|
+
export const StrictReviewRequiredNotificationSchema = z.object({
|
|
1837
|
+
"startedAtMs": z.number().int(),
|
|
1838
|
+
"threadId": z.string(),
|
|
1839
|
+
"turnId": z.string(),
|
|
1840
|
+
});
|
|
1841
|
+
export type StrictReviewRequiredNotification = z.infer<typeof StrictReviewRequiredNotificationSchema>;
|
|
1842
|
+
|
|
1843
|
+
export const TerminalInteractionNotificationSchema = z.object({
|
|
1844
|
+
"itemId": z.string(),
|
|
1845
|
+
"processId": z.string(),
|
|
1846
|
+
"stdin": z.string(),
|
|
1847
|
+
"threadId": z.string(),
|
|
1848
|
+
"turnId": z.string(),
|
|
1849
|
+
});
|
|
1850
|
+
export type TerminalInteractionNotification = z.infer<typeof TerminalInteractionNotificationSchema>;
|
|
1851
|
+
|
|
1852
|
+
export const ThreadArchivedNotificationSchema = z.object({ "threadId": z.string() });
|
|
1853
|
+
export type ThreadArchivedNotification = z.infer<typeof ThreadArchivedNotificationSchema>;
|
|
1854
|
+
|
|
1855
|
+
export const ThreadAttachmentOperationSchema = z.enum(["created", "deleted"]);
|
|
1856
|
+
export type ThreadAttachmentOperation = z.infer<typeof ThreadAttachmentOperationSchema>;
|
|
1857
|
+
|
|
1858
|
+
export const ThreadAttachmentUpdatedNotificationSchema = z.object({
|
|
1859
|
+
"attachmentId": z.string(),
|
|
1860
|
+
"attachmentType": z.string(),
|
|
1861
|
+
"identityKey": z.string(),
|
|
1862
|
+
"operation": ThreadAttachmentOperationSchema,
|
|
1863
|
+
"threadId": z.string(),
|
|
1864
|
+
});
|
|
1865
|
+
export type ThreadAttachmentUpdatedNotification = z.infer<typeof ThreadAttachmentUpdatedNotificationSchema>;
|
|
1866
|
+
|
|
1867
|
+
export const ThreadClosedNotificationSchema = z.object({ "threadId": z.string() });
|
|
1868
|
+
export type ThreadClosedNotification = z.infer<typeof ThreadClosedNotificationSchema>;
|
|
1869
|
+
|
|
1870
|
+
export const ThreadDeletedNotificationSchema = z.object({ "threadId": z.string() });
|
|
1871
|
+
export type ThreadDeletedNotification = z.infer<typeof ThreadDeletedNotificationSchema>;
|
|
1872
|
+
|
|
1873
|
+
export const ThreadGoalClearedNotificationSchema = z.object({ "threadId": z.string() });
|
|
1874
|
+
export type ThreadGoalClearedNotification = z.infer<typeof ThreadGoalClearedNotificationSchema>;
|
|
1875
|
+
|
|
1876
|
+
export const ThreadGoalStatusSchema = z.enum([
|
|
1877
|
+
"active",
|
|
1878
|
+
"paused",
|
|
1879
|
+
"blocked",
|
|
1880
|
+
"usageLimited",
|
|
1881
|
+
"budgetLimited",
|
|
1882
|
+
"complete",
|
|
1883
|
+
]);
|
|
1884
|
+
export type ThreadGoalStatus = z.infer<typeof ThreadGoalStatusSchema>;
|
|
1885
|
+
|
|
1886
|
+
export const ThreadGoalSchema = z.object({
|
|
1887
|
+
"createdAt": z.number().int(),
|
|
1888
|
+
"objective": z.string(),
|
|
1889
|
+
"status": ThreadGoalStatusSchema,
|
|
1890
|
+
"threadId": z.string(),
|
|
1891
|
+
"timeUsedSeconds": z.number().int(),
|
|
1892
|
+
"tokenBudget": z.union([z.number().int(), z.null()]).optional(),
|
|
1893
|
+
"tokensUsed": z.number().int(),
|
|
1894
|
+
"updatedAt": z.number().int(),
|
|
1895
|
+
});
|
|
1896
|
+
export type ThreadGoal = z.infer<typeof ThreadGoalSchema>;
|
|
1897
|
+
|
|
1898
|
+
export const ThreadGoalUpdatedNotificationSchema = z.object({
|
|
1899
|
+
"goal": ThreadGoalSchema,
|
|
1900
|
+
"threadId": z.string(),
|
|
1901
|
+
"turnId": z.union([z.string(), z.null()]).optional(),
|
|
1902
|
+
});
|
|
1903
|
+
export type ThreadGoalUpdatedNotification = z.infer<typeof ThreadGoalUpdatedNotificationSchema>;
|
|
1904
|
+
|
|
1905
|
+
export const ThreadNameUpdatedNotificationSchema = z.object({
|
|
1906
|
+
"threadId": z.string(),
|
|
1907
|
+
"threadName": z.union([z.string(), z.null()]).optional(),
|
|
1908
|
+
});
|
|
1909
|
+
export type ThreadNameUpdatedNotification = z.infer<typeof ThreadNameUpdatedNotificationSchema>;
|
|
1910
|
+
|
|
1911
|
+
export const ThreadPredictionResultSchema = z.discriminatedUnion("type", [
|
|
1912
|
+
z.object({ "text": z.union([z.string(), z.null()]).optional(), "type": z.literal("completed") }),
|
|
1913
|
+
z.object({ "type": z.literal("failed") }),
|
|
1914
|
+
]);
|
|
1915
|
+
export type ThreadPredictionResult = z.infer<typeof ThreadPredictionResultSchema>;
|
|
1916
|
+
|
|
1917
|
+
export const ThreadPredictionUpdatedNotificationSchema = z.object({
|
|
1918
|
+
"result": ThreadPredictionResultSchema,
|
|
1919
|
+
"sourceTurnId": z.string(),
|
|
1920
|
+
"threadId": z.string(),
|
|
1921
|
+
});
|
|
1922
|
+
export type ThreadPredictionUpdatedNotification = z.infer<typeof ThreadPredictionUpdatedNotificationSchema>;
|
|
1923
|
+
|
|
1924
|
+
export const ThreadProjectUpdatedNotificationSchema = z.object({
|
|
1925
|
+
"projectId": z.union([z.string(), z.null()]),
|
|
1926
|
+
"threadId": z.string(),
|
|
1927
|
+
});
|
|
1928
|
+
export type ThreadProjectUpdatedNotification = z.infer<typeof ThreadProjectUpdatedNotificationSchema>;
|
|
1929
|
+
|
|
1930
|
+
export const ThreadQueueChangedNotificationSchema = z.object({ "threadId": z.string() });
|
|
1931
|
+
export type ThreadQueueChangedNotification = z.infer<typeof ThreadQueueChangedNotificationSchema>;
|
|
1932
|
+
|
|
1933
|
+
export const ThreadUnreadPositionSchema = z.discriminatedUnion("type", [
|
|
1934
|
+
z.object({ "type": z.literal("threadStart") }),
|
|
1935
|
+
z.object({ "turnId": z.string(), "type": z.literal("turn") }),
|
|
1936
|
+
]);
|
|
1937
|
+
export type ThreadUnreadPosition = z.infer<typeof ThreadUnreadPositionSchema>;
|
|
1938
|
+
|
|
1939
|
+
export const ThreadReadStateSchema = z.object({
|
|
1940
|
+
"firstUnread": z.union([ThreadUnreadPositionSchema, z.null()]).optional(),
|
|
1941
|
+
"revision": z.string(),
|
|
1942
|
+
});
|
|
1943
|
+
export type ThreadReadState = z.infer<typeof ThreadReadStateSchema>;
|
|
1944
|
+
|
|
1945
|
+
export const ThreadReadStateChangedNotificationSchema = z.object({
|
|
1946
|
+
"readState": ThreadReadStateSchema,
|
|
1947
|
+
"threadId": z.string(),
|
|
1948
|
+
});
|
|
1949
|
+
export type ThreadReadStateChangedNotification = z.infer<typeof ThreadReadStateChangedNotificationSchema>;
|
|
1950
|
+
|
|
1951
|
+
export const ThreadRealtimeClosedNotificationSchema = z.object({
|
|
1952
|
+
"reason": z.union([z.string(), z.null()]).optional(),
|
|
1953
|
+
"threadId": z.string(),
|
|
1954
|
+
});
|
|
1955
|
+
export type ThreadRealtimeClosedNotification = z.infer<typeof ThreadRealtimeClosedNotificationSchema>;
|
|
1956
|
+
|
|
1957
|
+
export const ThreadRealtimeErrorNotificationSchema = z.object({
|
|
1958
|
+
"message": z.string(),
|
|
1959
|
+
"threadId": z.string(),
|
|
1960
|
+
});
|
|
1961
|
+
export type ThreadRealtimeErrorNotification = z.infer<typeof ThreadRealtimeErrorNotificationSchema>;
|
|
1962
|
+
|
|
1963
|
+
export const ThreadRealtimeItemAddedNotificationSchema = z.object({ "item": z.json(), "threadId": z.string() });
|
|
1964
|
+
export type ThreadRealtimeItemAddedNotification = z.infer<typeof ThreadRealtimeItemAddedNotificationSchema>;
|
|
1965
|
+
|
|
1966
|
+
export const ThreadRealtimeBemItemPresentationSchema = z.discriminatedUnion("type", [
|
|
1967
|
+
z.object({ "type": z.literal("wholeItem") }),
|
|
1968
|
+
z.object({ "type": z.literal("inlineMarkdown") }),
|
|
1969
|
+
z.object({ "index": z.number().int().gte(0), "type": z.literal("inlineVisualization") }),
|
|
1970
|
+
]);
|
|
1971
|
+
export type ThreadRealtimeBemItemPresentation = z.infer<typeof ThreadRealtimeBemItemPresentationSchema>;
|
|
1972
|
+
|
|
1973
|
+
export const ThreadRealtimeSessionOutcomeSchema = z.enum(["ended", "failed"]);
|
|
1974
|
+
export type ThreadRealtimeSessionOutcome = z.infer<typeof ThreadRealtimeSessionOutcomeSchema>;
|
|
1975
|
+
|
|
1976
|
+
export const ThreadRealtimeTranscriptRoleSchema = z.enum(["user", "assistant"]);
|
|
1977
|
+
export type ThreadRealtimeTranscriptRole = z.infer<typeof ThreadRealtimeTranscriptRoleSchema>;
|
|
1978
|
+
|
|
1979
|
+
export const ThreadRealtimeItemSchema = z.discriminatedUnion("type", [
|
|
1980
|
+
z.object({ "id": z.string(), "realtimeSessionId": z.string(), "type": z.literal("realtimeSessionStarted") }),
|
|
1981
|
+
z.object({
|
|
1982
|
+
"id": z.string(),
|
|
1983
|
+
"realtimeSessionId": z.string(),
|
|
1984
|
+
"role": ThreadRealtimeTranscriptRoleSchema,
|
|
1985
|
+
"text": z.string(),
|
|
1986
|
+
"type": z.literal("transcriptSegment"),
|
|
1987
|
+
}),
|
|
1988
|
+
z.object({
|
|
1989
|
+
"id": z.string(),
|
|
1990
|
+
"realtimeSessionId": z.string(),
|
|
1991
|
+
"item_id": z.string(),
|
|
1992
|
+
"presentation": ThreadRealtimeBemItemPresentationSchema,
|
|
1993
|
+
"turn_id": z.string(),
|
|
1994
|
+
"type": z.literal("bemItemPromoted"),
|
|
1995
|
+
}),
|
|
1996
|
+
z.object({
|
|
1997
|
+
"id": z.string(),
|
|
1998
|
+
"realtimeSessionId": z.string(),
|
|
1999
|
+
"outcome": ThreadRealtimeSessionOutcomeSchema,
|
|
2000
|
+
"type": z.literal("realtimeSessionClosed"),
|
|
2001
|
+
}),
|
|
2002
|
+
]);
|
|
2003
|
+
export type ThreadRealtimeItem = z.infer<typeof ThreadRealtimeItemSchema>;
|
|
2004
|
+
|
|
2005
|
+
export const ThreadRealtimeItemCompletedNotificationSchema = z.object({
|
|
2006
|
+
"item": ThreadRealtimeItemSchema,
|
|
2007
|
+
"threadId": z.string(),
|
|
2008
|
+
});
|
|
2009
|
+
export type ThreadRealtimeItemCompletedNotification = z.infer<typeof ThreadRealtimeItemCompletedNotificationSchema>;
|
|
2010
|
+
|
|
2011
|
+
export const ThreadRealtimeItemStartedNotificationSchema = z.object({
|
|
2012
|
+
"item": ThreadRealtimeItemSchema,
|
|
2013
|
+
"threadId": z.string(),
|
|
2014
|
+
});
|
|
2015
|
+
export type ThreadRealtimeItemStartedNotification = z.infer<typeof ThreadRealtimeItemStartedNotificationSchema>;
|
|
2016
|
+
|
|
2017
|
+
export const ThreadRealtimeItemTranscriptDeltaNotificationSchema = z.object({
|
|
2018
|
+
"delta": z.string(),
|
|
2019
|
+
"itemId": z.string(),
|
|
2020
|
+
"threadId": z.string(),
|
|
2021
|
+
});
|
|
2022
|
+
export type ThreadRealtimeItemTranscriptDeltaNotification = z.infer<typeof ThreadRealtimeItemTranscriptDeltaNotificationSchema>;
|
|
2023
|
+
|
|
2024
|
+
export const ThreadRealtimeAudioChunkSchema = z.object({
|
|
2025
|
+
"data": z.string(),
|
|
2026
|
+
"itemId": z.union([z.string(), z.null()]).optional(),
|
|
2027
|
+
"numChannels": z.number().int().gte(0),
|
|
2028
|
+
"sampleRate": z.number().int().gte(0),
|
|
2029
|
+
"samplesPerChannel": z.union([z.number().int().gte(0), z.null()]).optional(),
|
|
2030
|
+
});
|
|
2031
|
+
export type ThreadRealtimeAudioChunk = z.infer<typeof ThreadRealtimeAudioChunkSchema>;
|
|
2032
|
+
|
|
2033
|
+
export const ThreadRealtimeOutputAudioDeltaNotificationSchema = z.object({
|
|
2034
|
+
"audio": ThreadRealtimeAudioChunkSchema,
|
|
2035
|
+
"threadId": z.string(),
|
|
2036
|
+
});
|
|
2037
|
+
export type ThreadRealtimeOutputAudioDeltaNotification = z.infer<typeof ThreadRealtimeOutputAudioDeltaNotificationSchema>;
|
|
2038
|
+
|
|
2039
|
+
export const ThreadRealtimeSdpNotificationSchema = z.object({ "sdp": z.string(), "threadId": z.string() });
|
|
2040
|
+
export type ThreadRealtimeSdpNotification = z.infer<typeof ThreadRealtimeSdpNotificationSchema>;
|
|
2041
|
+
|
|
2042
|
+
export const ThreadRealtimeStartedNotificationSchema = z.object({
|
|
2043
|
+
"realtimeSessionId": z.union([z.string(), z.null()]).optional(),
|
|
2044
|
+
"threadId": z.string(),
|
|
2045
|
+
"version": RealtimeConversationVersionSchema,
|
|
2046
|
+
});
|
|
2047
|
+
export type ThreadRealtimeStartedNotification = z.infer<typeof ThreadRealtimeStartedNotificationSchema>;
|
|
2048
|
+
|
|
2049
|
+
export const ThreadRealtimeTranscriptDeltaNotificationSchema = z.object({
|
|
2050
|
+
"delta": z.string(),
|
|
2051
|
+
"role": z.string(),
|
|
2052
|
+
"threadId": z.string(),
|
|
2053
|
+
});
|
|
2054
|
+
export type ThreadRealtimeTranscriptDeltaNotification = z.infer<typeof ThreadRealtimeTranscriptDeltaNotificationSchema>;
|
|
2055
|
+
|
|
2056
|
+
export const ThreadRealtimeTranscriptDoneNotificationSchema = z.object({
|
|
2057
|
+
"role": z.string(),
|
|
2058
|
+
"text": z.string(),
|
|
2059
|
+
"threadId": z.string(),
|
|
2060
|
+
});
|
|
2061
|
+
export type ThreadRealtimeTranscriptDoneNotification = z.infer<typeof ThreadRealtimeTranscriptDoneNotificationSchema>;
|
|
2062
|
+
|
|
2063
|
+
export const ThreadRevertedNotificationSchema = z.object({ "threadId": z.string() });
|
|
2064
|
+
export type ThreadRevertedNotification = z.infer<typeof ThreadRevertedNotificationSchema>;
|
|
2065
|
+
|
|
2066
|
+
export const ThreadSectionChangedNotificationSchema = z.object({
|
|
2067
|
+
"sectionId": z.union([z.string(), z.null()]),
|
|
2068
|
+
"threadId": z.string(),
|
|
2069
|
+
});
|
|
2070
|
+
export type ThreadSectionChangedNotification = z.infer<typeof ThreadSectionChangedNotificationSchema>;
|
|
2071
|
+
|
|
2072
|
+
export const ThreadSettingsSchema = z.object({
|
|
2073
|
+
"activePermissionProfile": z.union([ActivePermissionProfileSchema, z.null()]).optional(),
|
|
2074
|
+
"approvalPolicy": AskForApprovalSchema,
|
|
2075
|
+
"approvalsReviewer": ApprovalsReviewerSchema,
|
|
2076
|
+
"collaborationMode": CollaborationModeSchema,
|
|
2077
|
+
"cwd": AbsolutePathBufSchema,
|
|
2078
|
+
"disabledPluginIds": z.array(z.string()).default([]),
|
|
2079
|
+
"effort": z.union([ReasoningEffortSchema, z.null()]).optional(),
|
|
2080
|
+
"model": z.string(),
|
|
2081
|
+
"modelProvider": z.string(),
|
|
2082
|
+
"personality": z.union([PersonalitySchema, z.null()]).optional(),
|
|
2083
|
+
"sandboxPolicy": SandboxPolicySchema,
|
|
2084
|
+
"serviceTier": z.union([z.string(), z.null()]).optional(),
|
|
2085
|
+
"summary": z.union([ReasoningSummarySchema, z.null()]).optional(),
|
|
2086
|
+
});
|
|
2087
|
+
export type ThreadSettings = z.infer<typeof ThreadSettingsSchema>;
|
|
2088
|
+
|
|
2089
|
+
export const ThreadSettingsUpdatedNotificationSchema = z.object({
|
|
2090
|
+
"threadId": z.string(),
|
|
2091
|
+
"threadSettings": ThreadSettingsSchema,
|
|
2092
|
+
});
|
|
2093
|
+
export type ThreadSettingsUpdatedNotification = z.infer<typeof ThreadSettingsUpdatedNotificationSchema>;
|
|
2094
|
+
|
|
2095
|
+
export const SubAgentSourceSchema = z.union([
|
|
2096
|
+
z.enum(["review", "compact", "memory_consolidation"]),
|
|
2097
|
+
z.object({
|
|
2098
|
+
"thread_spawn": z.object({
|
|
2099
|
+
"agent_nickname": z.union([z.string(), z.null()]).default(null),
|
|
2100
|
+
"agent_path": z.union([AgentPathSchema, z.null()]).default(null),
|
|
2101
|
+
"agent_role": z.union([z.string(), z.null()]).default(null),
|
|
2102
|
+
"depth": z.number().int(),
|
|
2103
|
+
"parent_thread_id": ThreadIdSchema,
|
|
2104
|
+
}),
|
|
2105
|
+
}),
|
|
2106
|
+
z.object({ "other": z.string() }),
|
|
2107
|
+
]);
|
|
2108
|
+
export type SubAgentSource = z.infer<typeof SubAgentSourceSchema>;
|
|
2109
|
+
|
|
2110
|
+
export const SessionSourceSchema = z.union([
|
|
2111
|
+
z.enum(["cli", "vscode", "exec", "appServer", "unknown"]),
|
|
2112
|
+
z.object({ "custom": z.string() }),
|
|
2113
|
+
z.object({ "subAgent": SubAgentSourceSchema }),
|
|
2114
|
+
]);
|
|
2115
|
+
export type SessionSource = z.infer<typeof SessionSourceSchema>;
|
|
2116
|
+
|
|
2117
|
+
export const ThreadHistoryModeSchema = z.enum(["legacy", "paginated"]);
|
|
2118
|
+
export type ThreadHistoryMode = z.infer<typeof ThreadHistoryModeSchema>;
|
|
2119
|
+
|
|
2120
|
+
export const ThreadSectionAppearanceSchema = z.object({
|
|
2121
|
+
"color": z.union([z.string(), z.null()]).optional(),
|
|
2122
|
+
"icon": z.union([z.string(), z.null()]).optional(),
|
|
2123
|
+
});
|
|
2124
|
+
export type ThreadSectionAppearance = z.infer<typeof ThreadSectionAppearanceSchema>;
|
|
2125
|
+
|
|
2126
|
+
export const ThreadSectionSchema = z.object({
|
|
2127
|
+
"appearance": z.union([ThreadSectionAppearanceSchema, z.null()]).default(null),
|
|
2128
|
+
"id": z.string(),
|
|
2129
|
+
"name": z.string(),
|
|
2130
|
+
});
|
|
2131
|
+
export type ThreadSection = z.infer<typeof ThreadSectionSchema>;
|
|
2132
|
+
|
|
2133
|
+
export const ThreadSourceSchema = z.string();
|
|
2134
|
+
export type ThreadSource = z.infer<typeof ThreadSourceSchema>;
|
|
2135
|
+
|
|
2136
|
+
export const ThreadActiveFlagSchema = z.enum(["waitingOnApproval", "waitingOnUserInput"]);
|
|
2137
|
+
export type ThreadActiveFlag = z.infer<typeof ThreadActiveFlagSchema>;
|
|
2138
|
+
|
|
2139
|
+
export const ThreadStatusSchema = z.discriminatedUnion("type", [
|
|
2140
|
+
z.object({ "type": z.literal("notLoaded") }),
|
|
2141
|
+
z.object({ "type": z.literal("idle") }),
|
|
2142
|
+
z.object({ "type": z.literal("systemError") }),
|
|
2143
|
+
z.object({ "activeFlags": z.array(ThreadActiveFlagSchema), "type": z.literal("active") }),
|
|
2144
|
+
]);
|
|
2145
|
+
export type ThreadStatus = z.infer<typeof ThreadStatusSchema>;
|
|
2146
|
+
|
|
2147
|
+
export const TurnItemsViewSchema = z.union([z.literal("notLoaded"), z.literal("summary"), z.literal("full")]);
|
|
2148
|
+
export type TurnItemsView = z.infer<typeof TurnItemsViewSchema>;
|
|
2149
|
+
|
|
2150
|
+
export const TurnStatusSchema = z.enum(["completed", "interrupted", "failed", "inProgress"]);
|
|
2151
|
+
export type TurnStatus = z.infer<typeof TurnStatusSchema>;
|
|
2152
|
+
|
|
2153
|
+
export const TurnSchema = z.object({
|
|
2154
|
+
"completedAt": z.union([z.number().int(), z.null()]).optional(),
|
|
2155
|
+
"durationMs": z.union([z.number().int(), z.null()]).optional(),
|
|
2156
|
+
"error": z.union([TurnErrorSchema, z.null()]).optional(),
|
|
2157
|
+
"id": z.string(),
|
|
2158
|
+
"items": z.array(ThreadItemSchema),
|
|
2159
|
+
"itemsView": TurnItemsViewSchema.default("full"),
|
|
2160
|
+
"rootTurnId": z.union([z.string(), z.null()]).optional(),
|
|
2161
|
+
"startedAt": z.union([z.number().int(), z.null()]).optional(),
|
|
2162
|
+
"status": TurnStatusSchema,
|
|
2163
|
+
});
|
|
2164
|
+
export type Turn = z.infer<typeof TurnSchema>;
|
|
2165
|
+
|
|
2166
|
+
export const ThreadSchema = z.object({
|
|
2167
|
+
"agentNickname": z.union([z.string(), z.null()]).optional(),
|
|
2168
|
+
"agentRole": z.union([z.string(), z.null()]).optional(),
|
|
2169
|
+
"cliVersion": z.string(),
|
|
2170
|
+
"createdAt": z.number().int(),
|
|
2171
|
+
"cwd": AbsolutePathBufSchema,
|
|
2172
|
+
"ephemeral": z.boolean(),
|
|
2173
|
+
"forkedFromId": z.union([z.string(), z.null()]).optional(),
|
|
2174
|
+
"gitInfo": z.union([GitInfoSchema, z.null()]).optional(),
|
|
2175
|
+
"historyMode": ThreadHistoryModeSchema.default("legacy"),
|
|
2176
|
+
"id": z.string(),
|
|
2177
|
+
"model": z.union([z.string(), z.null()]).optional(),
|
|
2178
|
+
"modelProvider": z.string(),
|
|
2179
|
+
"name": z.union([z.string(), z.null()]).optional(),
|
|
2180
|
+
"originator": z.union([z.string(), z.null()]).optional(),
|
|
2181
|
+
"parentThreadId": z.union([z.string(), z.null()]).optional(),
|
|
2182
|
+
"path": z.union([z.string(), z.null()]).optional(),
|
|
2183
|
+
"preview": z.string(),
|
|
2184
|
+
"projectId": z.union([z.string(), z.null()]),
|
|
2185
|
+
"reasoningEffort": z.union([ReasoningEffortSchema, z.null()]).optional(),
|
|
2186
|
+
"recencyAt": z.union([z.number().int(), z.null()]).optional(),
|
|
2187
|
+
"section": z.union([ThreadSectionSchema, z.null()]).default(null),
|
|
2188
|
+
"sectionEnteredAt": z.union([z.number().int(), z.null()]).default(null),
|
|
2189
|
+
"sessionId": z.string(),
|
|
2190
|
+
"source": SessionSourceSchema,
|
|
2191
|
+
"status": ThreadStatusSchema,
|
|
2192
|
+
"threadSource": z.union([ThreadSourceSchema, z.null()]).optional(),
|
|
2193
|
+
"turns": z.array(TurnSchema),
|
|
2194
|
+
"updatedAt": z.number().int(),
|
|
2195
|
+
});
|
|
2196
|
+
export type Thread = z.infer<typeof ThreadSchema>;
|
|
2197
|
+
|
|
2198
|
+
export const ThreadStartedNotificationSchema = z.object({ "thread": ThreadSchema });
|
|
2199
|
+
export type ThreadStartedNotification = z.infer<typeof ThreadStartedNotificationSchema>;
|
|
2200
|
+
|
|
2201
|
+
export const ThreadStatusChangedNotificationSchema = z.object({
|
|
2202
|
+
"status": ThreadStatusSchema,
|
|
2203
|
+
"threadId": z.string(),
|
|
2204
|
+
});
|
|
2205
|
+
export type ThreadStatusChangedNotification = z.infer<typeof ThreadStatusChangedNotificationSchema>;
|
|
2206
|
+
|
|
2207
|
+
export const TokenUsageBreakdownSchema = z.object({
|
|
2208
|
+
"cacheWriteInputTokens": z.number().int().default(0),
|
|
2209
|
+
"cachedInputTokens": z.number().int(),
|
|
2210
|
+
"inputTokens": z.number().int(),
|
|
2211
|
+
"outputTokens": z.number().int(),
|
|
2212
|
+
"reasoningOutputTokens": z.number().int(),
|
|
2213
|
+
"totalTokens": z.number().int(),
|
|
2214
|
+
});
|
|
2215
|
+
export type TokenUsageBreakdown = z.infer<typeof TokenUsageBreakdownSchema>;
|
|
2216
|
+
|
|
2217
|
+
export const ThreadTokenUsageSchema = z.object({
|
|
2218
|
+
"last": TokenUsageBreakdownSchema,
|
|
2219
|
+
"modelContextWindow": z.union([z.number().int(), z.null()]).optional(),
|
|
2220
|
+
"total": TokenUsageBreakdownSchema,
|
|
2221
|
+
});
|
|
2222
|
+
export type ThreadTokenUsage = z.infer<typeof ThreadTokenUsageSchema>;
|
|
2223
|
+
|
|
2224
|
+
export const ThreadTokenUsageUpdatedNotificationSchema = z.object({
|
|
2225
|
+
"threadId": z.string(),
|
|
2226
|
+
"tokenUsage": ThreadTokenUsageSchema,
|
|
2227
|
+
"turnId": z.string(),
|
|
2228
|
+
});
|
|
2229
|
+
export type ThreadTokenUsageUpdatedNotification = z.infer<typeof ThreadTokenUsageUpdatedNotificationSchema>;
|
|
2230
|
+
|
|
2231
|
+
export const ThreadUnarchivedNotificationSchema = z.object({ "threadId": z.string() });
|
|
2232
|
+
export type ThreadUnarchivedNotification = z.infer<typeof ThreadUnarchivedNotificationSchema>;
|
|
2233
|
+
|
|
2234
|
+
export const TurnCompletedNotificationSchema = z.object({ "threadId": z.string(), "turn": TurnSchema });
|
|
2235
|
+
export type TurnCompletedNotification = z.infer<typeof TurnCompletedNotificationSchema>;
|
|
2236
|
+
|
|
2237
|
+
export const TurnDiffUpdatedNotificationSchema = z.object({
|
|
2238
|
+
"diff": z.string(),
|
|
2239
|
+
"threadId": z.string(),
|
|
2240
|
+
"turnId": z.string(),
|
|
2241
|
+
});
|
|
2242
|
+
export type TurnDiffUpdatedNotification = z.infer<typeof TurnDiffUpdatedNotificationSchema>;
|
|
2243
|
+
|
|
2244
|
+
export const TurnModerationMetadataNotificationSchema = z.object({
|
|
2245
|
+
"metadata": z.json(),
|
|
2246
|
+
"threadId": z.string(),
|
|
2247
|
+
"turnId": z.string(),
|
|
2248
|
+
});
|
|
2249
|
+
export type TurnModerationMetadataNotification = z.infer<typeof TurnModerationMetadataNotificationSchema>;
|
|
2250
|
+
|
|
2251
|
+
export const TurnPlanStepStatusSchema = z.enum(["pending", "inProgress", "completed"]);
|
|
2252
|
+
export type TurnPlanStepStatus = z.infer<typeof TurnPlanStepStatusSchema>;
|
|
2253
|
+
|
|
2254
|
+
export const TurnPlanStepSchema = z.object({ "status": TurnPlanStepStatusSchema, "step": z.string() });
|
|
2255
|
+
export type TurnPlanStep = z.infer<typeof TurnPlanStepSchema>;
|
|
2256
|
+
|
|
2257
|
+
export const TurnPlanUpdatedNotificationSchema = z.object({
|
|
2258
|
+
"explanation": z.union([z.string(), z.null()]).optional(),
|
|
2259
|
+
"plan": z.array(TurnPlanStepSchema),
|
|
2260
|
+
"threadId": z.string(),
|
|
2261
|
+
"turnId": z.string(),
|
|
2262
|
+
});
|
|
2263
|
+
export type TurnPlanUpdatedNotification = z.infer<typeof TurnPlanUpdatedNotificationSchema>;
|
|
2264
|
+
|
|
2265
|
+
export const TurnStartedNotificationSchema = z.object({ "threadId": z.string(), "turn": TurnSchema });
|
|
2266
|
+
export type TurnStartedNotification = z.infer<typeof TurnStartedNotificationSchema>;
|
|
2267
|
+
|
|
2268
|
+
export const WarningNotificationSchema = z.object({
|
|
2269
|
+
"message": z.string(),
|
|
2270
|
+
"threadId": z.union([z.string(), z.null()]).optional(),
|
|
2271
|
+
});
|
|
2272
|
+
export type WarningNotification = z.infer<typeof WarningNotificationSchema>;
|
|
2273
|
+
|
|
2274
|
+
export const WindowsSandboxSetupModeSchema = z.enum(["elevated", "unelevated"]);
|
|
2275
|
+
export type WindowsSandboxSetupMode = z.infer<typeof WindowsSandboxSetupModeSchema>;
|
|
2276
|
+
|
|
2277
|
+
export const WindowsSandboxSetupCompletedNotificationSchema = z.object({
|
|
2278
|
+
"error": z.union([z.string(), z.null()]).optional(),
|
|
2279
|
+
"mode": WindowsSandboxSetupModeSchema,
|
|
2280
|
+
"success": z.boolean(),
|
|
2281
|
+
});
|
|
2282
|
+
export type WindowsSandboxSetupCompletedNotification = z.infer<typeof WindowsSandboxSetupCompletedNotificationSchema>;
|
|
2283
|
+
|
|
2284
|
+
export const WindowsWorldWritableWarningNotificationSchema = z.object({
|
|
2285
|
+
"extraCount": z.number().int().gte(0),
|
|
2286
|
+
"failedScan": z.boolean(),
|
|
2287
|
+
"samplePaths": z.array(z.string()),
|
|
2288
|
+
});
|
|
2289
|
+
export type WindowsWorldWritableWarningNotification = z.infer<typeof WindowsWorldWritableWarningNotificationSchema>;
|
|
2290
|
+
|
|
2291
|
+
export const ServerNotificationSchema = z.discriminatedUnion("method", [
|
|
2292
|
+
z.object({
|
|
2293
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2294
|
+
"method": z.literal("error"),
|
|
2295
|
+
"params": ErrorNotificationSchema,
|
|
2296
|
+
}),
|
|
2297
|
+
z.object({
|
|
2298
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2299
|
+
"method": z.literal("thread/started"),
|
|
2300
|
+
"params": ThreadStartedNotificationSchema,
|
|
2301
|
+
}),
|
|
2302
|
+
z.object({
|
|
2303
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2304
|
+
"method": z.literal("thread/status/changed"),
|
|
2305
|
+
"params": ThreadStatusChangedNotificationSchema,
|
|
2306
|
+
}),
|
|
2307
|
+
z.object({
|
|
2308
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2309
|
+
"method": z.literal("thread/readState/changed"),
|
|
2310
|
+
"params": ThreadReadStateChangedNotificationSchema,
|
|
2311
|
+
}),
|
|
2312
|
+
z.object({
|
|
2313
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2314
|
+
"method": z.literal("thread/archived"),
|
|
2315
|
+
"params": ThreadArchivedNotificationSchema,
|
|
2316
|
+
}),
|
|
2317
|
+
z.object({
|
|
2318
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2319
|
+
"method": z.literal("thread/deleted"),
|
|
2320
|
+
"params": ThreadDeletedNotificationSchema,
|
|
2321
|
+
}),
|
|
2322
|
+
z.object({
|
|
2323
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2324
|
+
"method": z.literal("thread/unarchived"),
|
|
2325
|
+
"params": ThreadUnarchivedNotificationSchema,
|
|
2326
|
+
}),
|
|
2327
|
+
z.object({
|
|
2328
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2329
|
+
"method": z.literal("thread/closed"),
|
|
2330
|
+
"params": ThreadClosedNotificationSchema,
|
|
2331
|
+
}),
|
|
2332
|
+
z.object({
|
|
2333
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2334
|
+
"method": z.literal("thread/reverted"),
|
|
2335
|
+
"params": ThreadRevertedNotificationSchema,
|
|
2336
|
+
}),
|
|
2337
|
+
z.object({
|
|
2338
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2339
|
+
"method": z.literal("skills/changed"),
|
|
2340
|
+
"params": SkillsChangedNotificationSchema,
|
|
2341
|
+
}),
|
|
2342
|
+
z.object({
|
|
2343
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2344
|
+
"method": z.literal("thread/name/updated"),
|
|
2345
|
+
"params": ThreadNameUpdatedNotificationSchema,
|
|
2346
|
+
}),
|
|
2347
|
+
z.object({
|
|
2348
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2349
|
+
"method": z.literal("thread/section/changed"),
|
|
2350
|
+
"params": ThreadSectionChangedNotificationSchema,
|
|
2351
|
+
}),
|
|
2352
|
+
z.object({
|
|
2353
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2354
|
+
"method": z.literal("thread/attachment/updated"),
|
|
2355
|
+
"params": ThreadAttachmentUpdatedNotificationSchema,
|
|
2356
|
+
}),
|
|
2357
|
+
z.object({
|
|
2358
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2359
|
+
"method": z.literal("thread/goal/updated"),
|
|
2360
|
+
"params": ThreadGoalUpdatedNotificationSchema,
|
|
2361
|
+
}),
|
|
2362
|
+
z.object({
|
|
2363
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2364
|
+
"method": z.literal("thread/prediction/updated"),
|
|
2365
|
+
"params": ThreadPredictionUpdatedNotificationSchema,
|
|
2366
|
+
}),
|
|
2367
|
+
z.object({
|
|
2368
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2369
|
+
"method": z.literal("thread/goal/cleared"),
|
|
2370
|
+
"params": ThreadGoalClearedNotificationSchema,
|
|
2371
|
+
}),
|
|
2372
|
+
z.object({
|
|
2373
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2374
|
+
"method": z.literal("thread/queue/changed"),
|
|
2375
|
+
"params": ThreadQueueChangedNotificationSchema,
|
|
2376
|
+
}),
|
|
2377
|
+
z.object({
|
|
2378
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2379
|
+
"method": z.literal("project/changed"),
|
|
2380
|
+
"params": ProjectChangedNotificationSchema,
|
|
2381
|
+
}),
|
|
2382
|
+
z.object({
|
|
2383
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2384
|
+
"method": z.literal("thread/project/updated"),
|
|
2385
|
+
"params": ThreadProjectUpdatedNotificationSchema,
|
|
2386
|
+
}),
|
|
2387
|
+
z.object({
|
|
2388
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2389
|
+
"method": z.literal("thread/environment/connected"),
|
|
2390
|
+
"params": EnvironmentConnectionNotificationSchema,
|
|
2391
|
+
}),
|
|
2392
|
+
z.object({
|
|
2393
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2394
|
+
"method": z.literal("thread/environment/disconnected"),
|
|
2395
|
+
"params": EnvironmentConnectionNotificationSchema,
|
|
2396
|
+
}),
|
|
2397
|
+
z.object({
|
|
2398
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2399
|
+
"method": z.literal("thread/settings/updated"),
|
|
2400
|
+
"params": ThreadSettingsUpdatedNotificationSchema,
|
|
2401
|
+
}),
|
|
2402
|
+
z.object({
|
|
2403
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2404
|
+
"method": z.literal("thread/tokenUsage/updated"),
|
|
2405
|
+
"params": ThreadTokenUsageUpdatedNotificationSchema,
|
|
2406
|
+
}),
|
|
2407
|
+
z.object({
|
|
2408
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2409
|
+
"method": z.literal("turn/started"),
|
|
2410
|
+
"params": TurnStartedNotificationSchema,
|
|
2411
|
+
}),
|
|
2412
|
+
z.object({
|
|
2413
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2414
|
+
"method": z.literal("hook/started"),
|
|
2415
|
+
"params": HookStartedNotificationSchema,
|
|
2416
|
+
}),
|
|
2417
|
+
z.object({
|
|
2418
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2419
|
+
"method": z.literal("turn/completed"),
|
|
2420
|
+
"params": TurnCompletedNotificationSchema,
|
|
2421
|
+
}),
|
|
2422
|
+
z.object({
|
|
2423
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2424
|
+
"method": z.literal("hook/completed"),
|
|
2425
|
+
"params": HookCompletedNotificationSchema,
|
|
2426
|
+
}),
|
|
2427
|
+
z.object({
|
|
2428
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2429
|
+
"method": z.literal("turn/diff/updated"),
|
|
2430
|
+
"params": TurnDiffUpdatedNotificationSchema,
|
|
2431
|
+
}),
|
|
2432
|
+
z.object({
|
|
2433
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2434
|
+
"method": z.literal("turn/plan/updated"),
|
|
2435
|
+
"params": TurnPlanUpdatedNotificationSchema,
|
|
2436
|
+
}),
|
|
2437
|
+
z.object({
|
|
2438
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2439
|
+
"method": z.literal("item/started"),
|
|
2440
|
+
"params": ItemStartedNotificationSchema,
|
|
2441
|
+
}),
|
|
2442
|
+
z.object({
|
|
2443
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2444
|
+
"method": z.literal("item/autoApprovalReview/started"),
|
|
2445
|
+
"params": ItemGuardianApprovalReviewStartedNotificationSchema,
|
|
2446
|
+
}),
|
|
2447
|
+
z.object({
|
|
2448
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2449
|
+
"method": z.literal("item/autoApprovalReview/completed"),
|
|
2450
|
+
"params": ItemGuardianApprovalReviewCompletedNotificationSchema,
|
|
2451
|
+
}),
|
|
2452
|
+
z.object({
|
|
2453
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2454
|
+
"method": z.literal("autoApprovalReview/strictReviewRequired"),
|
|
2455
|
+
"params": StrictReviewRequiredNotificationSchema,
|
|
2456
|
+
}),
|
|
2457
|
+
z.object({
|
|
2458
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2459
|
+
"method": z.literal("item/completed"),
|
|
2460
|
+
"params": ItemCompletedNotificationSchema,
|
|
2461
|
+
}),
|
|
2462
|
+
z.object({
|
|
2463
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2464
|
+
"method": z.literal("item/agentMessage/delta"),
|
|
2465
|
+
"params": AgentMessageDeltaNotificationSchema,
|
|
2466
|
+
}),
|
|
2467
|
+
z.object({
|
|
2468
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2469
|
+
"method": z.literal("item/plan/delta"),
|
|
2470
|
+
"params": PlanDeltaNotificationSchema,
|
|
2471
|
+
}),
|
|
2472
|
+
z.object({
|
|
2473
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2474
|
+
"method": z.literal("command/exec/outputDelta"),
|
|
2475
|
+
"params": CommandExecOutputDeltaNotificationSchema,
|
|
2476
|
+
}),
|
|
2477
|
+
z.object({
|
|
2478
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2479
|
+
"method": z.literal("process/outputDelta"),
|
|
2480
|
+
"params": ProcessOutputDeltaNotificationSchema,
|
|
2481
|
+
}),
|
|
2482
|
+
z.object({
|
|
2483
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2484
|
+
"method": z.literal("process/exited"),
|
|
2485
|
+
"params": ProcessExitedNotificationSchema,
|
|
2486
|
+
}),
|
|
2487
|
+
z.object({
|
|
2488
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2489
|
+
"method": z.literal("item/commandExecution/outputDelta"),
|
|
2490
|
+
"params": CommandExecutionOutputDeltaNotificationSchema,
|
|
2491
|
+
}),
|
|
2492
|
+
z.object({
|
|
2493
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2494
|
+
"method": z.literal("item/commandExecution/terminalInteraction"),
|
|
2495
|
+
"params": TerminalInteractionNotificationSchema,
|
|
2496
|
+
}),
|
|
2497
|
+
z.object({
|
|
2498
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2499
|
+
"method": z.literal("item/fileChange/outputDelta"),
|
|
2500
|
+
"params": FileChangeOutputDeltaNotificationSchema,
|
|
2501
|
+
}),
|
|
2502
|
+
z.object({
|
|
2503
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2504
|
+
"method": z.literal("item/fileChange/patchUpdated"),
|
|
2505
|
+
"params": FileChangePatchUpdatedNotificationSchema,
|
|
2506
|
+
}),
|
|
2507
|
+
z.object({
|
|
2508
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2509
|
+
"method": z.literal("serverRequest/resolved"),
|
|
2510
|
+
"params": ServerRequestResolvedNotificationSchema,
|
|
2511
|
+
}),
|
|
2512
|
+
z.object({
|
|
2513
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2514
|
+
"method": z.literal("item/mcpToolCall/progress"),
|
|
2515
|
+
"params": McpToolCallProgressNotificationSchema,
|
|
2516
|
+
}),
|
|
2517
|
+
z.object({
|
|
2518
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2519
|
+
"method": z.literal("mcpServer/oauthLogin/completed"),
|
|
2520
|
+
"params": McpServerOauthLoginCompletedNotificationSchema,
|
|
2521
|
+
}),
|
|
2522
|
+
z.object({
|
|
2523
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2524
|
+
"method": z.literal("mcpServer/startupStatus/updated"),
|
|
2525
|
+
"params": McpServerStatusUpdatedNotificationSchema,
|
|
2526
|
+
}),
|
|
2527
|
+
z.object({
|
|
2528
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2529
|
+
"method": z.literal("mcpServer/event/stream/notification"),
|
|
2530
|
+
"params": McpServerEventStreamNotificationSchema,
|
|
2531
|
+
}),
|
|
2532
|
+
z.object({
|
|
2533
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2534
|
+
"method": z.literal("account/updated"),
|
|
2535
|
+
"params": AccountUpdatedNotificationSchema,
|
|
2536
|
+
}),
|
|
2537
|
+
z.object({
|
|
2538
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2539
|
+
"method": z.literal("account/gatewayOAuth/changed"),
|
|
2540
|
+
"params": GatewayOAuthChangedNotificationSchema,
|
|
2541
|
+
}),
|
|
2542
|
+
z.object({
|
|
2543
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2544
|
+
"method": z.literal("account/rateLimits/updated"),
|
|
2545
|
+
"params": AccountRateLimitsUpdatedNotificationSchema,
|
|
2546
|
+
}),
|
|
2547
|
+
z.object({
|
|
2548
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2549
|
+
"method": z.literal("app/list/updated"),
|
|
2550
|
+
"params": AppListUpdatedNotificationSchema,
|
|
2551
|
+
}),
|
|
2552
|
+
z.object({
|
|
2553
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2554
|
+
"method": z.literal("remoteControl/status/changed"),
|
|
2555
|
+
"params": RemoteControlStatusChangedNotificationSchema,
|
|
2556
|
+
}),
|
|
2557
|
+
z.object({
|
|
2558
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2559
|
+
"method": z.literal("externalAgentConfig/import/progress"),
|
|
2560
|
+
"params": ExternalAgentConfigImportProgressNotificationSchema,
|
|
2561
|
+
}),
|
|
2562
|
+
z.object({
|
|
2563
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2564
|
+
"method": z.literal("externalAgentConfig/import/completed"),
|
|
2565
|
+
"params": ExternalAgentConfigImportCompletedNotificationSchema,
|
|
2566
|
+
}),
|
|
2567
|
+
z.object({
|
|
2568
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2569
|
+
"method": z.literal("fs/changed"),
|
|
2570
|
+
"params": FsChangedNotificationSchema,
|
|
2571
|
+
}),
|
|
2572
|
+
z.object({
|
|
2573
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2574
|
+
"method": z.literal("item/reasoning/summaryTextDelta"),
|
|
2575
|
+
"params": ReasoningSummaryTextDeltaNotificationSchema,
|
|
2576
|
+
}),
|
|
2577
|
+
z.object({
|
|
2578
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2579
|
+
"method": z.literal("item/reasoning/summaryPartAdded"),
|
|
2580
|
+
"params": ReasoningSummaryPartAddedNotificationSchema,
|
|
2581
|
+
}),
|
|
2582
|
+
z.object({
|
|
2583
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2584
|
+
"method": z.literal("item/reasoning/textDelta"),
|
|
2585
|
+
"params": ReasoningTextDeltaNotificationSchema,
|
|
2586
|
+
}),
|
|
2587
|
+
z.object({
|
|
2588
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2589
|
+
"method": z.literal("thread/compacted"),
|
|
2590
|
+
"params": ContextCompactedNotificationSchema,
|
|
2591
|
+
}),
|
|
2592
|
+
z.object({
|
|
2593
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2594
|
+
"method": z.literal("model/rerouted"),
|
|
2595
|
+
"params": ModelReroutedNotificationSchema,
|
|
2596
|
+
}),
|
|
2597
|
+
z.object({
|
|
2598
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2599
|
+
"method": z.literal("model/verification"),
|
|
2600
|
+
"params": ModelVerificationNotificationSchema,
|
|
2601
|
+
}),
|
|
2602
|
+
z.object({
|
|
2603
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2604
|
+
"method": z.literal("modelProvider/authRecoveryStarted"),
|
|
2605
|
+
"params": AuthRecoveryNotificationSchema,
|
|
2606
|
+
}),
|
|
2607
|
+
z.object({
|
|
2608
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2609
|
+
"method": z.literal("modelProvider/authRecoveryCompleted"),
|
|
2610
|
+
"params": AuthRecoveryNotificationSchema,
|
|
2611
|
+
}),
|
|
2612
|
+
z.object({
|
|
2613
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2614
|
+
"method": z.literal("turn/moderationMetadata"),
|
|
2615
|
+
"params": TurnModerationMetadataNotificationSchema,
|
|
2616
|
+
}),
|
|
2617
|
+
z.object({
|
|
2618
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2619
|
+
"method": z.literal("model/safetyBuffering/updated"),
|
|
2620
|
+
"params": ModelSafetyBufferingUpdatedNotificationSchema,
|
|
2621
|
+
}),
|
|
2622
|
+
z.object({
|
|
2623
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2624
|
+
"method": z.literal("warning"),
|
|
2625
|
+
"params": WarningNotificationSchema,
|
|
2626
|
+
}),
|
|
2627
|
+
z.object({
|
|
2628
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2629
|
+
"method": z.literal("guardianWarning"),
|
|
2630
|
+
"params": GuardianWarningNotificationSchema,
|
|
2631
|
+
}),
|
|
2632
|
+
z.object({
|
|
2633
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2634
|
+
"method": z.literal("deprecationNotice"),
|
|
2635
|
+
"params": DeprecationNoticeNotificationSchema,
|
|
2636
|
+
}),
|
|
2637
|
+
z.object({
|
|
2638
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2639
|
+
"method": z.literal("configWarning"),
|
|
2640
|
+
"params": ConfigWarningNotificationSchema,
|
|
2641
|
+
}),
|
|
2642
|
+
z.object({
|
|
2643
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2644
|
+
"method": z.literal("fuzzyFileSearch/sessionUpdated"),
|
|
2645
|
+
"params": FuzzyFileSearchSessionUpdatedNotificationSchema,
|
|
2646
|
+
}),
|
|
2647
|
+
z.object({
|
|
2648
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2649
|
+
"method": z.literal("fuzzyFileSearch/sessionCompleted"),
|
|
2650
|
+
"params": FuzzyFileSearchSessionCompletedNotificationSchema,
|
|
2651
|
+
}),
|
|
2652
|
+
z.object({
|
|
2653
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2654
|
+
"method": z.literal("thread/realtime/started"),
|
|
2655
|
+
"params": ThreadRealtimeStartedNotificationSchema,
|
|
2656
|
+
}),
|
|
2657
|
+
z.object({
|
|
2658
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2659
|
+
"method": z.literal("thread/realtime/itemAdded"),
|
|
2660
|
+
"params": ThreadRealtimeItemAddedNotificationSchema,
|
|
2661
|
+
}),
|
|
2662
|
+
z.object({
|
|
2663
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2664
|
+
"method": z.literal("thread/realtime/item/started"),
|
|
2665
|
+
"params": ThreadRealtimeItemStartedNotificationSchema,
|
|
2666
|
+
}),
|
|
2667
|
+
z.object({
|
|
2668
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2669
|
+
"method": z.literal("thread/realtime/item/transcript/delta"),
|
|
2670
|
+
"params": ThreadRealtimeItemTranscriptDeltaNotificationSchema,
|
|
2671
|
+
}),
|
|
2672
|
+
z.object({
|
|
2673
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2674
|
+
"method": z.literal("thread/realtime/item/completed"),
|
|
2675
|
+
"params": ThreadRealtimeItemCompletedNotificationSchema,
|
|
2676
|
+
}),
|
|
2677
|
+
z.object({
|
|
2678
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2679
|
+
"method": z.literal("thread/realtime/transcript/delta"),
|
|
2680
|
+
"params": ThreadRealtimeTranscriptDeltaNotificationSchema,
|
|
2681
|
+
}),
|
|
2682
|
+
z.object({
|
|
2683
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2684
|
+
"method": z.literal("thread/realtime/transcript/done"),
|
|
2685
|
+
"params": ThreadRealtimeTranscriptDoneNotificationSchema,
|
|
2686
|
+
}),
|
|
2687
|
+
z.object({
|
|
2688
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2689
|
+
"method": z.literal("thread/realtime/outputAudio/delta"),
|
|
2690
|
+
"params": ThreadRealtimeOutputAudioDeltaNotificationSchema,
|
|
2691
|
+
}),
|
|
2692
|
+
z.object({
|
|
2693
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2694
|
+
"method": z.literal("thread/realtime/sdp"),
|
|
2695
|
+
"params": ThreadRealtimeSdpNotificationSchema,
|
|
2696
|
+
}),
|
|
2697
|
+
z.object({
|
|
2698
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2699
|
+
"method": z.literal("thread/realtime/error"),
|
|
2700
|
+
"params": ThreadRealtimeErrorNotificationSchema,
|
|
2701
|
+
}),
|
|
2702
|
+
z.object({
|
|
2703
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2704
|
+
"method": z.literal("thread/realtime/closed"),
|
|
2705
|
+
"params": ThreadRealtimeClosedNotificationSchema,
|
|
2706
|
+
}),
|
|
2707
|
+
z.object({
|
|
2708
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2709
|
+
"method": z.literal("windows/worldWritableWarning"),
|
|
2710
|
+
"params": WindowsWorldWritableWarningNotificationSchema,
|
|
2711
|
+
}),
|
|
2712
|
+
z.object({
|
|
2713
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2714
|
+
"method": z.literal("windowsSandbox/setupCompleted"),
|
|
2715
|
+
"params": WindowsSandboxSetupCompletedNotificationSchema,
|
|
2716
|
+
}),
|
|
2717
|
+
z.object({
|
|
2718
|
+
"emittedAtMs": z.number().int().optional(),
|
|
2719
|
+
"method": z.literal("account/login/completed"),
|
|
2720
|
+
"params": AccountLoginCompletedNotificationSchema,
|
|
2721
|
+
}),
|
|
2722
|
+
]);
|
|
2723
|
+
export type ServerNotification = z.infer<typeof ServerNotificationSchema>;
|
|
2724
|
+
|
|
2725
|
+
export const ToolRequestUserInputOptionSchema = z.object({ "description": z.string(), "label": z.string() });
|
|
2726
|
+
export type ToolRequestUserInputOption = z.infer<typeof ToolRequestUserInputOptionSchema>;
|
|
2727
|
+
|
|
2728
|
+
export const ToolRequestUserInputQuestionSchema = z.object({
|
|
2729
|
+
"header": z.string(),
|
|
2730
|
+
"id": z.string(),
|
|
2731
|
+
"isOther": z.boolean().default(false),
|
|
2732
|
+
"isSecret": z.boolean().default(false),
|
|
2733
|
+
"options": z.union([z.array(ToolRequestUserInputOptionSchema), z.null()]).optional(),
|
|
2734
|
+
"question": z.string(),
|
|
2735
|
+
});
|
|
2736
|
+
export type ToolRequestUserInputQuestion = z.infer<typeof ToolRequestUserInputQuestionSchema>;
|
|
2737
|
+
|
|
2738
|
+
export const ToolRequestUserInputParamsSchema = z.object({
|
|
2739
|
+
"autoResolutionMs": z.union([z.number().int().gte(0), z.null()]).default(null),
|
|
2740
|
+
"isBlocking": z.boolean(),
|
|
2741
|
+
"itemId": z.string(),
|
|
2742
|
+
"questions": z.array(ToolRequestUserInputQuestionSchema),
|
|
2743
|
+
"threadId": z.string(),
|
|
2744
|
+
"turnId": z.string(),
|
|
2745
|
+
});
|
|
2746
|
+
export type ToolRequestUserInputParams = z.infer<typeof ToolRequestUserInputParamsSchema>;
|
|
2747
|
+
|
|
2748
|
+
export const ServerRequestSchema = z.discriminatedUnion("method", [
|
|
2749
|
+
z.object({
|
|
2750
|
+
"id": RequestIdSchema,
|
|
2751
|
+
"method": z.literal("item/commandExecution/requestApproval"),
|
|
2752
|
+
"params": CommandExecutionRequestApprovalParamsSchema,
|
|
2753
|
+
}),
|
|
2754
|
+
z.object({
|
|
2755
|
+
"id": RequestIdSchema,
|
|
2756
|
+
"method": z.literal("item/fileChange/requestApproval"),
|
|
2757
|
+
"params": FileChangeRequestApprovalParamsSchema,
|
|
2758
|
+
}),
|
|
2759
|
+
z.object({
|
|
2760
|
+
"id": RequestIdSchema,
|
|
2761
|
+
"method": z.literal("item/tool/requestUserInput"),
|
|
2762
|
+
"params": ToolRequestUserInputParamsSchema,
|
|
2763
|
+
}),
|
|
2764
|
+
z.object({
|
|
2765
|
+
"id": RequestIdSchema,
|
|
2766
|
+
"method": z.literal("mcpServer/elicitation/request"),
|
|
2767
|
+
"params": McpServerElicitationRequestParamsSchema,
|
|
2768
|
+
}),
|
|
2769
|
+
z.object({
|
|
2770
|
+
"id": RequestIdSchema,
|
|
2771
|
+
"method": z.literal("item/permissions/requestApproval"),
|
|
2772
|
+
"params": PermissionsRequestApprovalParamsSchema,
|
|
2773
|
+
}),
|
|
2774
|
+
z.object({
|
|
2775
|
+
"id": RequestIdSchema,
|
|
2776
|
+
"method": z.literal("item/tool/call"),
|
|
2777
|
+
"params": DynamicToolCallParamsSchema,
|
|
2778
|
+
}),
|
|
2779
|
+
z.object({
|
|
2780
|
+
"id": RequestIdSchema,
|
|
2781
|
+
"method": z.literal("account/chatgptAuthTokens/refresh"),
|
|
2782
|
+
"params": ChatgptAuthTokensRefreshParamsSchema,
|
|
2783
|
+
}),
|
|
2784
|
+
z.object({
|
|
2785
|
+
"id": RequestIdSchema,
|
|
2786
|
+
"method": z.literal("attestation/generate"),
|
|
2787
|
+
"params": AttestationGenerateParamsSchema,
|
|
2788
|
+
}),
|
|
2789
|
+
z.object({
|
|
2790
|
+
"id": RequestIdSchema,
|
|
2791
|
+
"method": z.literal("applyPatchApproval"),
|
|
2792
|
+
"params": ApplyPatchApprovalParamsSchema,
|
|
2793
|
+
}),
|
|
2794
|
+
z.object({
|
|
2795
|
+
"id": RequestIdSchema,
|
|
2796
|
+
"method": z.literal("execCommandApproval"),
|
|
2797
|
+
"params": ExecCommandApprovalParamsSchema,
|
|
2798
|
+
}),
|
|
2799
|
+
]);
|
|
2800
|
+
export type ServerRequest = z.infer<typeof ServerRequestSchema>;
|
|
2801
|
+
|
|
2802
|
+
export const ThreadEnvironmentSchema = z.object({
|
|
2803
|
+
"cwd": LegacyAppPathStringSchema,
|
|
2804
|
+
"environmentId": z.string(),
|
|
2805
|
+
"runtimeWorkspaceRoots": z.array(LegacyAppPathStringSchema),
|
|
2806
|
+
});
|
|
2807
|
+
export type ThreadEnvironment = z.infer<typeof ThreadEnvironmentSchema>;
|
|
2808
|
+
|
|
2809
|
+
export const ThreadExtraSchema = z.record(z.string(), z.any());
|
|
2810
|
+
export type ThreadExtra = z.infer<typeof ThreadExtraSchema>;
|
|
2811
|
+
|
|
2812
|
+
export const ToolRequestUserInputAnswerSchema = z.object({ "answers": z.array(z.string()) });
|
|
2813
|
+
export type ToolRequestUserInputAnswer = z.infer<typeof ToolRequestUserInputAnswerSchema>;
|
|
2814
|
+
|
|
2815
|
+
export const ToolRequestUserInputResponseSchema = z.object({
|
|
2816
|
+
"answers": z.record(z.string(), ToolRequestUserInputAnswerSchema),
|
|
2817
|
+
});
|
|
2818
|
+
export type ToolRequestUserInputResponse = z.infer<typeof ToolRequestUserInputResponseSchema>;
|