@get-bb/plugin-sdk 0.4.84 → 0.4.88
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/bundled-types/bb-plugin-sdk-app.d.ts +9 -1
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +229 -43
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +52 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +131 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +17 -8
- package/bundled-types/bb-plugin-sdk.d.ts +172 -5
- package/dist/host.js +1 -1
- package/dist/internal/host-policy.js +790 -114
- package/dist/internal/plugin-app-collector.js +71 -90
- package/dist/provider-bridge-acp.js +1967 -2047
- package/dist/provider-bridge-testing.js +1378 -1405
- package/dist/provider-bridge-worker-entry.mjs +0 -1
- package/dist/provider-bridge.js +1458 -1500
- package/dist/testing/app.js +71 -90
- package/dist/testing/index.js +954 -791
- package/package.json +1 -2
|
@@ -1,20 +1,47 @@
|
|
|
1
|
+
// ../domain/src/context-snapshot.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var tokenCountSchema = z.number().int().nonnegative();
|
|
4
|
+
var contextEntrySchema = z.object({
|
|
5
|
+
id: z.string().min(1),
|
|
6
|
+
label: z.string().min(1),
|
|
7
|
+
tokens: tokenCountSchema
|
|
8
|
+
});
|
|
9
|
+
var contextCategorySchema = z.object({
|
|
10
|
+
id: z.string().min(1),
|
|
11
|
+
label: z.string().min(1),
|
|
12
|
+
kind: z.enum(["used", "free", "reserved", "deferred"]),
|
|
13
|
+
tokens: tokenCountSchema,
|
|
14
|
+
entries: z.array(contextEntrySchema)
|
|
15
|
+
});
|
|
16
|
+
var contextSnapshotSchema = z.object({
|
|
17
|
+
capturedAt: z.iso.datetime(),
|
|
18
|
+
providerSessionId: z.string().min(1),
|
|
19
|
+
providerTurnId: z.string().min(1).nullable(),
|
|
20
|
+
model: z.string().min(1),
|
|
21
|
+
usedTokens: tokenCountSchema,
|
|
22
|
+
contextWindowTokens: z.number().int().positive(),
|
|
23
|
+
autoCompactAtTokens: z.number().int().positive().nullable(),
|
|
24
|
+
estimated: z.boolean(),
|
|
25
|
+
categories: z.array(contextCategorySchema)
|
|
26
|
+
});
|
|
27
|
+
|
|
1
28
|
// ../domain/src/shared-types.ts
|
|
2
|
-
import { z as
|
|
29
|
+
import { z as z3 } from "zod";
|
|
3
30
|
|
|
4
31
|
// ../domain/src/json-value.ts
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
var jsonValueSchema =
|
|
7
|
-
() =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
32
|
+
import { z as z2 } from "zod";
|
|
33
|
+
var jsonValueSchema = z2.lazy(
|
|
34
|
+
() => z2.union([
|
|
35
|
+
z2.string(),
|
|
36
|
+
z2.number(),
|
|
37
|
+
z2.boolean(),
|
|
38
|
+
z2.null(),
|
|
39
|
+
z2.array(jsonValueSchema),
|
|
40
|
+
z2.record(z2.string(), jsonValueSchema)
|
|
14
41
|
])
|
|
15
42
|
);
|
|
16
|
-
var jsonObjectSchema =
|
|
17
|
-
|
|
43
|
+
var jsonObjectSchema = z2.record(
|
|
44
|
+
z2.string(),
|
|
18
45
|
jsonValueSchema
|
|
19
46
|
);
|
|
20
47
|
|
|
@@ -29,42 +56,42 @@ var reasoningLevelValues = [
|
|
|
29
56
|
"max",
|
|
30
57
|
"ultra"
|
|
31
58
|
];
|
|
32
|
-
var reasoningLevelSchema =
|
|
33
|
-
var serviceTierSchema =
|
|
59
|
+
var reasoningLevelSchema = z3.enum(reasoningLevelValues);
|
|
60
|
+
var serviceTierSchema = z3.enum(["fast", "default"]);
|
|
34
61
|
var instructionModeValues = ["append", "replace"];
|
|
35
|
-
var instructionModeSchema =
|
|
62
|
+
var instructionModeSchema = z3.enum(instructionModeValues);
|
|
36
63
|
var permissionModeValues = ["accept-edits", "auto", "full"];
|
|
37
|
-
var permissionModeSchema =
|
|
38
|
-
var permissionModeInputSchema =
|
|
64
|
+
var permissionModeSchema = z3.enum(permissionModeValues);
|
|
65
|
+
var permissionModeInputSchema = z3.union([permissionModeSchema, z3.literal("workspace-write")]).transform(
|
|
39
66
|
(permissionMode) => permissionMode === "workspace-write" ? "accept-edits" : permissionMode
|
|
40
67
|
);
|
|
41
68
|
var legacyRecordedPermissionModeValues = [
|
|
42
69
|
"workspace-write",
|
|
43
70
|
"readonly"
|
|
44
71
|
];
|
|
45
|
-
var recordedPermissionModeSchema =
|
|
72
|
+
var recordedPermissionModeSchema = z3.enum([
|
|
46
73
|
...permissionModeValues,
|
|
47
74
|
...legacyRecordedPermissionModeValues
|
|
48
75
|
]);
|
|
49
76
|
var permissionEscalationValues = ["ask", "deny"];
|
|
50
|
-
var permissionEscalationSchema =
|
|
77
|
+
var permissionEscalationSchema = z3.enum(permissionEscalationValues);
|
|
51
78
|
var promptInputVisibilityValues = ["agent-only"];
|
|
52
|
-
var promptInputVisibilitySchema =
|
|
79
|
+
var promptInputVisibilitySchema = z3.enum(promptInputVisibilityValues);
|
|
53
80
|
var promptInputVisibilityFields = {
|
|
54
81
|
visibility: promptInputVisibilitySchema.optional()
|
|
55
82
|
};
|
|
56
83
|
var promptMentionPathSourceValues = ["workspace", "thread-storage"];
|
|
57
|
-
var promptMentionPathSourceSchema =
|
|
84
|
+
var promptMentionPathSourceSchema = z3.enum(promptMentionPathSourceValues);
|
|
58
85
|
var promptMentionPathEntryKindValues = ["file", "directory"];
|
|
59
|
-
var promptMentionPathEntryKindSchema =
|
|
86
|
+
var promptMentionPathEntryKindSchema = z3.enum(
|
|
60
87
|
promptMentionPathEntryKindValues
|
|
61
88
|
);
|
|
62
89
|
var promptMentionCommandTriggerValues = ["/"];
|
|
63
|
-
var promptMentionCommandTriggerSchema =
|
|
90
|
+
var promptMentionCommandTriggerSchema = z3.enum(
|
|
64
91
|
promptMentionCommandTriggerValues
|
|
65
92
|
);
|
|
66
93
|
var promptMentionCommandSourceValues = ["skill", "command"];
|
|
67
|
-
var promptMentionCommandSourceSchema =
|
|
94
|
+
var promptMentionCommandSourceSchema = z3.enum(
|
|
68
95
|
promptMentionCommandSourceValues
|
|
69
96
|
);
|
|
70
97
|
var promptMentionCommandOriginValues = [
|
|
@@ -72,48 +99,48 @@ var promptMentionCommandOriginValues = [
|
|
|
72
99
|
"project",
|
|
73
100
|
"user"
|
|
74
101
|
];
|
|
75
|
-
var promptMentionCommandOriginSchema =
|
|
102
|
+
var promptMentionCommandOriginSchema = z3.enum(
|
|
76
103
|
promptMentionCommandOriginValues
|
|
77
104
|
);
|
|
78
|
-
var canonicalPromptMentionResourceSchema =
|
|
79
|
-
|
|
80
|
-
kind:
|
|
81
|
-
threadId:
|
|
82
|
-
projectId:
|
|
83
|
-
label:
|
|
105
|
+
var canonicalPromptMentionResourceSchema = z3.discriminatedUnion("kind", [
|
|
106
|
+
z3.object({
|
|
107
|
+
kind: z3.literal("thread"),
|
|
108
|
+
threadId: z3.string(),
|
|
109
|
+
projectId: z3.string().optional(),
|
|
110
|
+
label: z3.string()
|
|
84
111
|
}),
|
|
85
|
-
|
|
86
|
-
kind:
|
|
87
|
-
projectId:
|
|
88
|
-
label:
|
|
112
|
+
z3.object({
|
|
113
|
+
kind: z3.literal("project"),
|
|
114
|
+
projectId: z3.string(),
|
|
115
|
+
label: z3.string()
|
|
89
116
|
}),
|
|
90
|
-
|
|
91
|
-
kind:
|
|
92
|
-
sectionId:
|
|
93
|
-
label:
|
|
117
|
+
z3.object({
|
|
118
|
+
kind: z3.literal("section"),
|
|
119
|
+
sectionId: z3.string(),
|
|
120
|
+
label: z3.string()
|
|
94
121
|
}),
|
|
95
|
-
|
|
96
|
-
kind:
|
|
122
|
+
z3.object({
|
|
123
|
+
kind: z3.literal("path"),
|
|
97
124
|
source: promptMentionPathSourceSchema,
|
|
98
125
|
entryKind: promptMentionPathEntryKindSchema,
|
|
99
|
-
path:
|
|
100
|
-
label:
|
|
126
|
+
path: z3.string(),
|
|
127
|
+
label: z3.string()
|
|
101
128
|
}),
|
|
102
|
-
|
|
103
|
-
kind:
|
|
129
|
+
z3.object({
|
|
130
|
+
kind: z3.literal("command"),
|
|
104
131
|
trigger: promptMentionCommandTriggerSchema,
|
|
105
|
-
name:
|
|
132
|
+
name: z3.string(),
|
|
106
133
|
source: promptMentionCommandSourceSchema,
|
|
107
134
|
origin: promptMentionCommandOriginSchema,
|
|
108
|
-
label:
|
|
109
|
-
argumentHint:
|
|
135
|
+
label: z3.string(),
|
|
136
|
+
argumentHint: z3.string().nullable()
|
|
110
137
|
}),
|
|
111
|
-
|
|
112
|
-
kind:
|
|
113
|
-
pluginId:
|
|
114
|
-
icon:
|
|
115
|
-
itemId:
|
|
116
|
-
label:
|
|
138
|
+
z3.object({
|
|
139
|
+
kind: z3.literal("plugin"),
|
|
140
|
+
pluginId: z3.string(),
|
|
141
|
+
icon: z3.string().nullable().optional(),
|
|
142
|
+
itemId: z3.string(),
|
|
143
|
+
label: z3.string()
|
|
117
144
|
})
|
|
118
145
|
]);
|
|
119
146
|
function normalizeLegacyPromptMentionResource(value) {
|
|
@@ -127,42 +154,42 @@ function normalizeLegacyPromptMentionResource(value) {
|
|
|
127
154
|
const { folderId, ...rest } = record;
|
|
128
155
|
return { ...rest, kind: "section", sectionId: folderId };
|
|
129
156
|
}
|
|
130
|
-
var promptMentionResourceSchema =
|
|
157
|
+
var promptMentionResourceSchema = z3.preprocess(
|
|
131
158
|
normalizeLegacyPromptMentionResource,
|
|
132
159
|
canonicalPromptMentionResourceSchema
|
|
133
160
|
);
|
|
134
|
-
var promptTextMentionSchema =
|
|
135
|
-
start:
|
|
136
|
-
end:
|
|
161
|
+
var promptTextMentionSchema = z3.object({
|
|
162
|
+
start: z3.number().int().nonnegative(),
|
|
163
|
+
end: z3.number().int().nonnegative(),
|
|
137
164
|
resource: promptMentionResourceSchema
|
|
138
165
|
});
|
|
139
|
-
var promptInputSchema =
|
|
140
|
-
|
|
141
|
-
type:
|
|
142
|
-
text:
|
|
143
|
-
mentions:
|
|
166
|
+
var promptInputSchema = z3.discriminatedUnion("type", [
|
|
167
|
+
z3.object({
|
|
168
|
+
type: z3.literal("text"),
|
|
169
|
+
text: z3.string(),
|
|
170
|
+
mentions: z3.array(promptTextMentionSchema).default([]),
|
|
144
171
|
...promptInputVisibilityFields
|
|
145
172
|
}),
|
|
146
|
-
|
|
147
|
-
type:
|
|
148
|
-
url:
|
|
173
|
+
z3.object({
|
|
174
|
+
type: z3.literal("image"),
|
|
175
|
+
url: z3.string().url(),
|
|
149
176
|
...promptInputVisibilityFields
|
|
150
177
|
}),
|
|
151
|
-
|
|
152
|
-
type:
|
|
153
|
-
path:
|
|
178
|
+
z3.object({
|
|
179
|
+
type: z3.literal("localImage"),
|
|
180
|
+
path: z3.string(),
|
|
154
181
|
...promptInputVisibilityFields
|
|
155
182
|
}),
|
|
156
|
-
|
|
157
|
-
type:
|
|
158
|
-
path:
|
|
159
|
-
name:
|
|
160
|
-
sizeBytes:
|
|
161
|
-
mimeType:
|
|
183
|
+
z3.object({
|
|
184
|
+
type: z3.literal("localFile"),
|
|
185
|
+
path: z3.string(),
|
|
186
|
+
name: z3.string().optional(),
|
|
187
|
+
sizeBytes: z3.number().int().nonnegative().optional(),
|
|
188
|
+
mimeType: z3.string().optional(),
|
|
162
189
|
...promptInputVisibilityFields
|
|
163
190
|
})
|
|
164
191
|
]);
|
|
165
|
-
var threadExecutionSourceSchema =
|
|
192
|
+
var threadExecutionSourceSchema = z3.enum([
|
|
166
193
|
"client/thread/start",
|
|
167
194
|
"client/turn/requested",
|
|
168
195
|
"client/turn/start"
|
|
@@ -171,19 +198,19 @@ var callerExecutionInputSourceValues = [
|
|
|
171
198
|
"explicit",
|
|
172
199
|
"client-preference"
|
|
173
200
|
];
|
|
174
|
-
var callerExecutionInputSourceSchema =
|
|
201
|
+
var callerExecutionInputSourceSchema = z3.enum(
|
|
175
202
|
callerExecutionInputSourceValues
|
|
176
203
|
);
|
|
177
|
-
var threadExecutionOptionsSchema =
|
|
178
|
-
model:
|
|
204
|
+
var threadExecutionOptionsSchema = z3.object({
|
|
205
|
+
model: z3.string().optional(),
|
|
179
206
|
serviceTier: serviceTierSchema.optional(),
|
|
180
207
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
181
208
|
permissionMode: permissionModeSchema.optional(),
|
|
182
209
|
source: threadExecutionSourceSchema.optional(),
|
|
183
|
-
seq:
|
|
210
|
+
seq: z3.number().int().optional()
|
|
184
211
|
});
|
|
185
212
|
var resolvedThreadExecutionOptionsSchema = threadExecutionOptionsSchema.extend({
|
|
186
|
-
model:
|
|
213
|
+
model: z3.string().min(1),
|
|
187
214
|
serviceTier: serviceTierSchema,
|
|
188
215
|
reasoningLevel: reasoningLevelSchema,
|
|
189
216
|
permissionMode: permissionModeSchema,
|
|
@@ -193,49 +220,49 @@ var recordedThreadExecutionOptionsSchema = resolvedThreadExecutionOptionsSchema.
|
|
|
193
220
|
permissionMode: recordedPermissionModeSchema
|
|
194
221
|
});
|
|
195
222
|
var runtimePermissionScopeValues = ["workspace", "full"];
|
|
196
|
-
var runtimePermissionScopeSchema =
|
|
197
|
-
var runtimePermissionPolicySchema =
|
|
223
|
+
var runtimePermissionScopeSchema = z3.enum(runtimePermissionScopeValues);
|
|
224
|
+
var runtimePermissionPolicySchema = z3.discriminatedUnion(
|
|
198
225
|
"permissionMode",
|
|
199
226
|
[
|
|
200
|
-
|
|
201
|
-
permissionMode:
|
|
202
|
-
permissionScope:
|
|
203
|
-
approvalReviewer:
|
|
227
|
+
z3.object({
|
|
228
|
+
permissionMode: z3.literal("accept-edits"),
|
|
229
|
+
permissionScope: z3.literal("workspace"),
|
|
230
|
+
approvalReviewer: z3.literal("user"),
|
|
204
231
|
permissionEscalation: permissionEscalationSchema
|
|
205
232
|
}),
|
|
206
|
-
|
|
207
|
-
permissionMode:
|
|
208
|
-
permissionScope:
|
|
209
|
-
approvalReviewer:
|
|
233
|
+
z3.object({
|
|
234
|
+
permissionMode: z3.literal("auto"),
|
|
235
|
+
permissionScope: z3.literal("workspace"),
|
|
236
|
+
approvalReviewer: z3.literal("automatic"),
|
|
210
237
|
permissionEscalation: permissionEscalationSchema
|
|
211
238
|
}),
|
|
212
|
-
|
|
213
|
-
permissionMode:
|
|
214
|
-
permissionScope:
|
|
215
|
-
approvalReviewer:
|
|
216
|
-
permissionEscalation:
|
|
239
|
+
z3.object({
|
|
240
|
+
permissionMode: z3.literal("full"),
|
|
241
|
+
permissionScope: z3.literal("full"),
|
|
242
|
+
approvalReviewer: z3.null(),
|
|
243
|
+
permissionEscalation: z3.null()
|
|
217
244
|
})
|
|
218
245
|
]
|
|
219
246
|
);
|
|
220
|
-
var promptModeSchema =
|
|
221
|
-
var runtimeThreadExecutionBaseOptionsSchema =
|
|
222
|
-
model:
|
|
247
|
+
var promptModeSchema = z3.literal("plan");
|
|
248
|
+
var runtimeThreadExecutionBaseOptionsSchema = z3.object({
|
|
249
|
+
model: z3.string().min(1),
|
|
223
250
|
serviceTier: serviceTierSchema,
|
|
224
251
|
reasoningLevel: reasoningLevelSchema,
|
|
225
252
|
promptMode: promptModeSchema.optional(),
|
|
226
253
|
providerOptions: jsonObjectSchema
|
|
227
254
|
});
|
|
228
255
|
var runtimeThreadExecutionOptionsSchema = runtimeThreadExecutionBaseOptionsSchema.and(runtimePermissionPolicySchema);
|
|
229
|
-
var projectExecutionDefaultsSchema =
|
|
230
|
-
providerId:
|
|
231
|
-
model:
|
|
256
|
+
var projectExecutionDefaultsSchema = z3.object({
|
|
257
|
+
providerId: z3.string().min(1),
|
|
258
|
+
model: z3.string().min(1),
|
|
232
259
|
serviceTier: serviceTierSchema,
|
|
233
260
|
reasoningLevel: reasoningLevelSchema,
|
|
234
261
|
permissionMode: permissionModeSchema
|
|
235
262
|
});
|
|
236
263
|
|
|
237
264
|
// ../domain/src/background-task.ts
|
|
238
|
-
import { z as
|
|
265
|
+
import { z as z4 } from "zod";
|
|
239
266
|
var backgroundTaskStatusValues = [
|
|
240
267
|
"pending",
|
|
241
268
|
"running",
|
|
@@ -245,7 +272,7 @@ var backgroundTaskStatusValues = [
|
|
|
245
272
|
"killed",
|
|
246
273
|
"stopped"
|
|
247
274
|
];
|
|
248
|
-
var backgroundTaskStatusSchema =
|
|
275
|
+
var backgroundTaskStatusSchema = z4.enum(backgroundTaskStatusValues);
|
|
249
276
|
var workflowAgentStateValues = [
|
|
250
277
|
"queued",
|
|
251
278
|
"running",
|
|
@@ -253,53 +280,53 @@ var workflowAgentStateValues = [
|
|
|
253
280
|
"failed",
|
|
254
281
|
"skipped"
|
|
255
282
|
];
|
|
256
|
-
var workflowAgentStateSchema =
|
|
257
|
-
var workflowAgentSnapshotSchema =
|
|
258
|
-
index:
|
|
259
|
-
label:
|
|
283
|
+
var workflowAgentStateSchema = z4.enum(workflowAgentStateValues);
|
|
284
|
+
var workflowAgentSnapshotSchema = z4.object({
|
|
285
|
+
index: z4.number().int().positive(),
|
|
286
|
+
label: z4.string(),
|
|
260
287
|
state: workflowAgentStateSchema,
|
|
261
|
-
model:
|
|
262
|
-
attempt:
|
|
263
|
-
cached:
|
|
264
|
-
lastProgressAt:
|
|
265
|
-
phaseIndex:
|
|
266
|
-
phaseTitle:
|
|
267
|
-
agentType:
|
|
268
|
-
isolation:
|
|
269
|
-
queuedAt:
|
|
270
|
-
startedAt:
|
|
271
|
-
lastToolName:
|
|
272
|
-
lastToolSummary:
|
|
273
|
-
promptPreview:
|
|
274
|
-
resultPreview:
|
|
275
|
-
error:
|
|
276
|
-
tokens:
|
|
277
|
-
toolCalls:
|
|
278
|
-
durationMs:
|
|
279
|
-
});
|
|
280
|
-
var workflowPhaseSnapshotSchema =
|
|
281
|
-
index:
|
|
282
|
-
title:
|
|
283
|
-
kind:
|
|
284
|
-
});
|
|
285
|
-
var workflowProgressSnapshotSchema =
|
|
286
|
-
phases:
|
|
287
|
-
agents:
|
|
288
|
-
});
|
|
289
|
-
var backgroundTaskUsageSchema =
|
|
290
|
-
totalTokens:
|
|
291
|
-
toolUses:
|
|
292
|
-
durationMs:
|
|
288
|
+
model: z4.string(),
|
|
289
|
+
attempt: z4.number().int().positive(),
|
|
290
|
+
cached: z4.boolean(),
|
|
291
|
+
lastProgressAt: z4.number(),
|
|
292
|
+
phaseIndex: z4.number().int().positive().optional(),
|
|
293
|
+
phaseTitle: z4.string().optional(),
|
|
294
|
+
agentType: z4.string().optional(),
|
|
295
|
+
isolation: z4.string().optional(),
|
|
296
|
+
queuedAt: z4.number().optional(),
|
|
297
|
+
startedAt: z4.number().optional(),
|
|
298
|
+
lastToolName: z4.string().optional(),
|
|
299
|
+
lastToolSummary: z4.string().optional(),
|
|
300
|
+
promptPreview: z4.string().optional(),
|
|
301
|
+
resultPreview: z4.string().optional(),
|
|
302
|
+
error: z4.string().optional(),
|
|
303
|
+
tokens: z4.number().optional(),
|
|
304
|
+
toolCalls: z4.number().optional(),
|
|
305
|
+
durationMs: z4.number().optional()
|
|
306
|
+
});
|
|
307
|
+
var workflowPhaseSnapshotSchema = z4.object({
|
|
308
|
+
index: z4.number().int().positive(),
|
|
309
|
+
title: z4.string(),
|
|
310
|
+
kind: z4.string().optional()
|
|
311
|
+
});
|
|
312
|
+
var workflowProgressSnapshotSchema = z4.object({
|
|
313
|
+
phases: z4.array(workflowPhaseSnapshotSchema),
|
|
314
|
+
agents: z4.array(workflowAgentSnapshotSchema)
|
|
315
|
+
});
|
|
316
|
+
var backgroundTaskUsageSchema = z4.object({
|
|
317
|
+
totalTokens: z4.number(),
|
|
318
|
+
toolUses: z4.number(),
|
|
319
|
+
durationMs: z4.number()
|
|
293
320
|
});
|
|
294
321
|
|
|
295
322
|
// ../domain/src/provider-event.ts
|
|
296
|
-
import { z as
|
|
323
|
+
import { z as z13 } from "zod";
|
|
297
324
|
|
|
298
325
|
// ../domain/src/thread-events.ts
|
|
299
|
-
import { z as
|
|
326
|
+
import { z as z10 } from "zod";
|
|
300
327
|
|
|
301
328
|
// ../domain/src/pending-interactions.ts
|
|
302
|
-
import { z as
|
|
329
|
+
import { z as z7 } from "zod";
|
|
303
330
|
|
|
304
331
|
// ../domain/src/plugin-interaction-limits.ts
|
|
305
332
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
@@ -309,223 +336,223 @@ function jsonByteLength(value) {
|
|
|
309
336
|
}
|
|
310
337
|
|
|
311
338
|
// ../domain/src/item-presentation.ts
|
|
312
|
-
import { z as
|
|
339
|
+
import { z as z5 } from "zod";
|
|
313
340
|
var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
|
|
314
|
-
var threadEventItemPresentationLabelSchema =
|
|
315
|
-
pending:
|
|
316
|
-
completed:
|
|
341
|
+
var threadEventItemPresentationLabelSchema = z5.object({
|
|
342
|
+
pending: z5.string().min(1),
|
|
343
|
+
completed: z5.string().min(1)
|
|
317
344
|
});
|
|
318
|
-
var threadEventItemPresentationIconSchema =
|
|
319
|
-
glyph:
|
|
345
|
+
var threadEventItemPresentationIconSchema = z5.object({
|
|
346
|
+
glyph: z5.string().min(1)
|
|
320
347
|
});
|
|
321
|
-
var threadEventItemPresentationTintSchema =
|
|
322
|
-
light:
|
|
323
|
-
dark:
|
|
348
|
+
var threadEventItemPresentationTintSchema = z5.object({
|
|
349
|
+
light: z5.string().min(1),
|
|
350
|
+
dark: z5.string().min(1)
|
|
324
351
|
});
|
|
325
352
|
var THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH = 80;
|
|
326
|
-
var threadEventItemPresentationBadgeSchema =
|
|
327
|
-
glyph:
|
|
328
|
-
label:
|
|
329
|
-
hint:
|
|
330
|
-
tone:
|
|
353
|
+
var threadEventItemPresentationBadgeSchema = z5.object({
|
|
354
|
+
glyph: z5.string().min(1),
|
|
355
|
+
label: z5.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
|
|
356
|
+
hint: z5.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
|
|
357
|
+
tone: z5.enum(["neutral", "destructive"])
|
|
331
358
|
});
|
|
332
|
-
var threadEventItemPresentationSchema =
|
|
359
|
+
var threadEventItemPresentationSchema = z5.object({
|
|
333
360
|
label: threadEventItemPresentationLabelSchema,
|
|
334
361
|
icon: threadEventItemPresentationIconSchema,
|
|
335
|
-
title:
|
|
336
|
-
detail:
|
|
337
|
-
suppress:
|
|
362
|
+
title: z5.string().optional(),
|
|
363
|
+
detail: z5.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
364
|
+
suppress: z5.boolean().optional(),
|
|
338
365
|
tint: threadEventItemPresentationTintSchema.optional(),
|
|
339
366
|
badge: threadEventItemPresentationBadgeSchema.optional()
|
|
340
367
|
});
|
|
341
368
|
|
|
342
369
|
// ../domain/src/provider-extension-kind.ts
|
|
343
|
-
import { z as
|
|
370
|
+
import { z as z6 } from "zod";
|
|
344
371
|
var EXTENSION_KIND_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/u;
|
|
345
372
|
function isExtensionKind(value) {
|
|
346
373
|
return EXTENSION_KIND_PATTERN.test(value);
|
|
347
374
|
}
|
|
348
|
-
var extensionKindSchema =
|
|
375
|
+
var extensionKindSchema = z6.string().refine(isExtensionKind, {
|
|
349
376
|
message: 'extension kinds are "<pluginId>/<name>" (lowercase letters, digits, and "-")'
|
|
350
377
|
});
|
|
351
378
|
|
|
352
379
|
// ../domain/src/pending-interactions.ts
|
|
353
|
-
var pendingInteractionStatusSchema =
|
|
380
|
+
var pendingInteractionStatusSchema = z7.enum([
|
|
354
381
|
"pending",
|
|
355
382
|
"resolving",
|
|
356
383
|
"resolved",
|
|
357
384
|
"interrupted"
|
|
358
385
|
]);
|
|
359
|
-
var pendingInteractionCommandActionSchema =
|
|
386
|
+
var pendingInteractionCommandActionSchema = z7.discriminatedUnion(
|
|
360
387
|
"type",
|
|
361
388
|
[
|
|
362
|
-
|
|
363
|
-
type:
|
|
364
|
-
command:
|
|
365
|
-
name:
|
|
366
|
-
path:
|
|
389
|
+
z7.object({
|
|
390
|
+
type: z7.literal("read"),
|
|
391
|
+
command: z7.string(),
|
|
392
|
+
name: z7.string(),
|
|
393
|
+
path: z7.string()
|
|
367
394
|
}),
|
|
368
|
-
|
|
369
|
-
type:
|
|
370
|
-
command:
|
|
371
|
-
path:
|
|
395
|
+
z7.object({
|
|
396
|
+
type: z7.literal("listFiles"),
|
|
397
|
+
command: z7.string(),
|
|
398
|
+
path: z7.string().nullable()
|
|
372
399
|
}),
|
|
373
|
-
|
|
374
|
-
type:
|
|
375
|
-
command:
|
|
376
|
-
query:
|
|
377
|
-
path:
|
|
400
|
+
z7.object({
|
|
401
|
+
type: z7.literal("search"),
|
|
402
|
+
command: z7.string(),
|
|
403
|
+
query: z7.string().nullable(),
|
|
404
|
+
path: z7.string().nullable()
|
|
378
405
|
}),
|
|
379
|
-
|
|
380
|
-
type:
|
|
381
|
-
command:
|
|
406
|
+
z7.object({
|
|
407
|
+
type: z7.literal("unknown"),
|
|
408
|
+
command: z7.string()
|
|
382
409
|
})
|
|
383
410
|
]
|
|
384
411
|
);
|
|
385
|
-
var pendingInteractionNetworkPermissionsSchema =
|
|
386
|
-
enabled:
|
|
412
|
+
var pendingInteractionNetworkPermissionsSchema = z7.object({
|
|
413
|
+
enabled: z7.boolean().nullable()
|
|
387
414
|
});
|
|
388
|
-
var pendingInteractionFileSystemPermissionsSchema =
|
|
389
|
-
read:
|
|
390
|
-
write:
|
|
415
|
+
var pendingInteractionFileSystemPermissionsSchema = z7.object({
|
|
416
|
+
read: z7.array(z7.string()),
|
|
417
|
+
write: z7.array(z7.string())
|
|
391
418
|
});
|
|
392
|
-
var pendingInteractionMacOsPreferencesPermissionSchema =
|
|
419
|
+
var pendingInteractionMacOsPreferencesPermissionSchema = z7.enum([
|
|
393
420
|
"none",
|
|
394
421
|
"read_only",
|
|
395
422
|
"read_write"
|
|
396
423
|
]);
|
|
397
|
-
var pendingInteractionMacOsContactsPermissionSchema =
|
|
424
|
+
var pendingInteractionMacOsContactsPermissionSchema = z7.enum([
|
|
398
425
|
"none",
|
|
399
426
|
"read_only",
|
|
400
427
|
"read_write"
|
|
401
428
|
]);
|
|
402
|
-
var pendingInteractionMacOsAutomationPermissionSchema =
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
kind:
|
|
407
|
-
bundleIds:
|
|
429
|
+
var pendingInteractionMacOsAutomationPermissionSchema = z7.union([
|
|
430
|
+
z7.literal("none"),
|
|
431
|
+
z7.literal("all"),
|
|
432
|
+
z7.object({
|
|
433
|
+
kind: z7.literal("bundle_ids"),
|
|
434
|
+
bundleIds: z7.array(z7.string())
|
|
408
435
|
})
|
|
409
436
|
]);
|
|
410
|
-
var pendingInteractionMacOsPermissionsSchema =
|
|
437
|
+
var pendingInteractionMacOsPermissionsSchema = z7.object({
|
|
411
438
|
preferences: pendingInteractionMacOsPreferencesPermissionSchema,
|
|
412
439
|
automations: pendingInteractionMacOsAutomationPermissionSchema,
|
|
413
|
-
launchServices:
|
|
414
|
-
accessibility:
|
|
415
|
-
calendar:
|
|
416
|
-
reminders:
|
|
440
|
+
launchServices: z7.boolean(),
|
|
441
|
+
accessibility: z7.boolean(),
|
|
442
|
+
calendar: z7.boolean(),
|
|
443
|
+
reminders: z7.boolean(),
|
|
417
444
|
contacts: pendingInteractionMacOsContactsPermissionSchema
|
|
418
445
|
});
|
|
419
|
-
var pendingInteractionRequestedPermissionProfileSchema =
|
|
446
|
+
var pendingInteractionRequestedPermissionProfileSchema = z7.object({
|
|
420
447
|
network: pendingInteractionNetworkPermissionsSchema.nullable(),
|
|
421
448
|
fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable(),
|
|
422
449
|
macos: pendingInteractionMacOsPermissionsSchema.nullable()
|
|
423
450
|
});
|
|
424
|
-
var pendingInteractionGrantablePermissionProfileSchema =
|
|
451
|
+
var pendingInteractionGrantablePermissionProfileSchema = z7.object({
|
|
425
452
|
network: pendingInteractionNetworkPermissionsSchema.nullable(),
|
|
426
453
|
fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable()
|
|
427
454
|
}).strict();
|
|
428
455
|
var pendingInteractionGrantedPermissionProfileSchema = pendingInteractionGrantablePermissionProfileSchema;
|
|
429
|
-
var pendingInteractionApprovalDecisionSchema =
|
|
456
|
+
var pendingInteractionApprovalDecisionSchema = z7.enum([
|
|
430
457
|
"allow_once",
|
|
431
458
|
"allow_for_session",
|
|
432
459
|
"deny"
|
|
433
460
|
]);
|
|
434
|
-
var pendingInteractionFileChangeWriteScopeSchema =
|
|
435
|
-
var pendingInteractionCommandApprovalSubjectSchema =
|
|
436
|
-
kind:
|
|
437
|
-
itemId:
|
|
438
|
-
command:
|
|
439
|
-
cwd:
|
|
440
|
-
actions:
|
|
461
|
+
var pendingInteractionFileChangeWriteScopeSchema = z7.string().min(1);
|
|
462
|
+
var pendingInteractionCommandApprovalSubjectSchema = z7.object({
|
|
463
|
+
kind: z7.literal("command"),
|
|
464
|
+
itemId: z7.string().min(1),
|
|
465
|
+
command: z7.string().min(1),
|
|
466
|
+
cwd: z7.string().nullable(),
|
|
467
|
+
actions: z7.array(pendingInteractionCommandActionSchema),
|
|
441
468
|
sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
|
|
442
469
|
});
|
|
443
|
-
var pendingInteractionFileChangeApprovalSubjectSchema =
|
|
444
|
-
kind:
|
|
445
|
-
itemId:
|
|
470
|
+
var pendingInteractionFileChangeApprovalSubjectSchema = z7.object({
|
|
471
|
+
kind: z7.literal("file_change"),
|
|
472
|
+
itemId: z7.string().min(1),
|
|
446
473
|
writeScope: pendingInteractionFileChangeWriteScopeSchema.nullable(),
|
|
447
474
|
sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
|
|
448
475
|
});
|
|
449
|
-
var pendingInteractionPermissionGrantApprovalSubjectSchema =
|
|
450
|
-
kind:
|
|
451
|
-
itemId:
|
|
452
|
-
toolName:
|
|
476
|
+
var pendingInteractionPermissionGrantApprovalSubjectSchema = z7.object({
|
|
477
|
+
kind: z7.literal("permission_grant"),
|
|
478
|
+
itemId: z7.string().min(1),
|
|
479
|
+
toolName: z7.string().nullable(),
|
|
453
480
|
permissions: pendingInteractionGrantablePermissionProfileSchema
|
|
454
481
|
});
|
|
455
|
-
var pendingInteractionPlanApprovalSubjectSchema =
|
|
456
|
-
kind:
|
|
457
|
-
itemId:
|
|
458
|
-
plan:
|
|
459
|
-
planFilePath:
|
|
482
|
+
var pendingInteractionPlanApprovalSubjectSchema = z7.object({
|
|
483
|
+
kind: z7.literal("plan"),
|
|
484
|
+
itemId: z7.string().min(1),
|
|
485
|
+
plan: z7.string().min(1),
|
|
486
|
+
planFilePath: z7.string().min(1).nullable()
|
|
460
487
|
});
|
|
461
|
-
var pendingInteractionToolUseApprovalSubjectSchema =
|
|
462
|
-
kind:
|
|
463
|
-
itemId:
|
|
464
|
-
tool:
|
|
488
|
+
var pendingInteractionToolUseApprovalSubjectSchema = z7.object({
|
|
489
|
+
kind: z7.literal("tool_use"),
|
|
490
|
+
itemId: z7.string().min(1),
|
|
491
|
+
tool: z7.string().min(1),
|
|
465
492
|
presentation: threadEventItemPresentationSchema
|
|
466
493
|
});
|
|
467
|
-
var pendingInteractionApprovalSubjectSchema =
|
|
494
|
+
var pendingInteractionApprovalSubjectSchema = z7.discriminatedUnion("kind", [
|
|
468
495
|
pendingInteractionCommandApprovalSubjectSchema,
|
|
469
496
|
pendingInteractionFileChangeApprovalSubjectSchema,
|
|
470
497
|
pendingInteractionPermissionGrantApprovalSubjectSchema,
|
|
471
498
|
pendingInteractionPlanApprovalSubjectSchema,
|
|
472
499
|
pendingInteractionToolUseApprovalSubjectSchema
|
|
473
500
|
]);
|
|
474
|
-
var approvalPendingInteractionPayloadSchema =
|
|
475
|
-
kind:
|
|
501
|
+
var approvalPendingInteractionPayloadSchema = z7.object({
|
|
502
|
+
kind: z7.literal("approval"),
|
|
476
503
|
subject: pendingInteractionApprovalSubjectSchema,
|
|
477
|
-
reason:
|
|
478
|
-
availableDecisions:
|
|
504
|
+
reason: z7.string().nullable(),
|
|
505
|
+
availableDecisions: z7.array(pendingInteractionApprovalDecisionSchema).min(1)
|
|
479
506
|
});
|
|
480
507
|
var USER_QUESTION_MAX_QUESTIONS = 4;
|
|
481
508
|
var USER_QUESTION_MAX_OPTIONS = 4;
|
|
482
509
|
var USER_QUESTION_MAX_SELECTED = 4;
|
|
483
510
|
var USER_QUESTION_MAX_FREE_TEXT_LENGTH = 4096;
|
|
484
|
-
var pendingInteractionUserQuestionIdSchema =
|
|
511
|
+
var pendingInteractionUserQuestionIdSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
|
|
485
512
|
message: "User question ids cannot be blank"
|
|
486
513
|
});
|
|
487
|
-
var pendingInteractionUserQuestionPromptSchema =
|
|
514
|
+
var pendingInteractionUserQuestionPromptSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
|
|
488
515
|
message: "User question prompts cannot be blank"
|
|
489
516
|
});
|
|
490
|
-
var pendingInteractionUserQuestionShortLabelSchema =
|
|
517
|
+
var pendingInteractionUserQuestionShortLabelSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
|
|
491
518
|
message: "User question short labels cannot be blank"
|
|
492
519
|
});
|
|
493
|
-
var pendingInteractionUserQuestionOptionValueSchema =
|
|
520
|
+
var pendingInteractionUserQuestionOptionValueSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
|
|
494
521
|
message: "User question option values cannot be blank"
|
|
495
522
|
});
|
|
496
|
-
var pendingInteractionUserQuestionOptionLabelSchema =
|
|
523
|
+
var pendingInteractionUserQuestionOptionLabelSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
|
|
497
524
|
message: "User question option labels cannot be blank"
|
|
498
525
|
});
|
|
499
|
-
var pendingInteractionUserQuestionOptionDescriptionSchema =
|
|
526
|
+
var pendingInteractionUserQuestionOptionDescriptionSchema = z7.string().min(1).refine((value) => value.trim().length > 0, {
|
|
500
527
|
message: "User question option descriptions cannot be blank"
|
|
501
528
|
});
|
|
502
|
-
var pendingInteractionUserQuestionFreeTextSchema =
|
|
529
|
+
var pendingInteractionUserQuestionFreeTextSchema = z7.string().min(1).max(
|
|
503
530
|
USER_QUESTION_MAX_FREE_TEXT_LENGTH,
|
|
504
531
|
`User question free text cannot exceed ${USER_QUESTION_MAX_FREE_TEXT_LENGTH} characters`
|
|
505
532
|
).refine((value) => value.trim().length > 0, {
|
|
506
533
|
message: "User question free text cannot be blank"
|
|
507
534
|
});
|
|
508
|
-
var pendingInteractionUserQuestionOptionSchema =
|
|
535
|
+
var pendingInteractionUserQuestionOptionSchema = z7.object({
|
|
509
536
|
value: pendingInteractionUserQuestionOptionValueSchema,
|
|
510
537
|
label: pendingInteractionUserQuestionOptionLabelSchema,
|
|
511
538
|
description: pendingInteractionUserQuestionOptionDescriptionSchema.optional()
|
|
512
539
|
});
|
|
513
|
-
var pendingInteractionUserQuestionQuestionSchema =
|
|
540
|
+
var pendingInteractionUserQuestionQuestionSchema = z7.object({
|
|
514
541
|
id: pendingInteractionUserQuestionIdSchema,
|
|
515
542
|
prompt: pendingInteractionUserQuestionPromptSchema,
|
|
516
543
|
shortLabel: pendingInteractionUserQuestionShortLabelSchema.optional(),
|
|
517
|
-
multiSelect:
|
|
518
|
-
options:
|
|
544
|
+
multiSelect: z7.boolean(),
|
|
545
|
+
options: z7.array(pendingInteractionUserQuestionOptionSchema).max(
|
|
519
546
|
USER_QUESTION_MAX_OPTIONS,
|
|
520
547
|
`User questions cannot include more than ${USER_QUESTION_MAX_OPTIONS} options`
|
|
521
548
|
).optional(),
|
|
522
|
-
allowFreeText:
|
|
549
|
+
allowFreeText: z7.boolean()
|
|
523
550
|
}).superRefine((question, context) => {
|
|
524
551
|
const optionValues = /* @__PURE__ */ new Set();
|
|
525
552
|
question.options?.forEach((option, index) => {
|
|
526
553
|
if (optionValues.has(option.value)) {
|
|
527
554
|
context.addIssue({
|
|
528
|
-
code:
|
|
555
|
+
code: z7.ZodIssueCode.custom,
|
|
529
556
|
message: "User question option values must be unique",
|
|
530
557
|
path: ["options", index, "value"]
|
|
531
558
|
});
|
|
@@ -540,9 +567,9 @@ var pendingInteractionUserQuestionQuestionSchema = z6.object({
|
|
|
540
567
|
path: ["options"]
|
|
541
568
|
}
|
|
542
569
|
);
|
|
543
|
-
var userQuestionPendingInteractionPayloadSchema =
|
|
544
|
-
kind:
|
|
545
|
-
questions:
|
|
570
|
+
var userQuestionPendingInteractionPayloadSchema = z7.object({
|
|
571
|
+
kind: z7.literal("user_question"),
|
|
572
|
+
questions: z7.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
|
|
546
573
|
USER_QUESTION_MAX_QUESTIONS,
|
|
547
574
|
`User questions cannot include more than ${USER_QUESTION_MAX_QUESTIONS} questions`
|
|
548
575
|
)
|
|
@@ -551,7 +578,7 @@ var userQuestionPendingInteractionPayloadSchema = z6.object({
|
|
|
551
578
|
payload.questions.forEach((question, index) => {
|
|
552
579
|
if (questionIds.has(question.id)) {
|
|
553
580
|
context.addIssue({
|
|
554
|
-
code:
|
|
581
|
+
code: z7.ZodIssueCode.custom,
|
|
555
582
|
message: "User question ids must be unique",
|
|
556
583
|
path: ["questions", index, "id"]
|
|
557
584
|
});
|
|
@@ -560,65 +587,65 @@ var userQuestionPendingInteractionPayloadSchema = z6.object({
|
|
|
560
587
|
questionIds.add(question.id);
|
|
561
588
|
});
|
|
562
589
|
});
|
|
563
|
-
var pluginPendingInteractionPayloadSchema =
|
|
564
|
-
kind:
|
|
565
|
-
title:
|
|
590
|
+
var pluginPendingInteractionPayloadSchema = z7.object({
|
|
591
|
+
kind: z7.literal("plugin"),
|
|
592
|
+
title: z7.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
566
593
|
data: jsonValueSchema
|
|
567
594
|
});
|
|
568
|
-
var pluginExtensionInteractionRequestPayloadSchema =
|
|
595
|
+
var pluginExtensionInteractionRequestPayloadSchema = z7.object({
|
|
569
596
|
kind: extensionKindSchema,
|
|
570
|
-
title:
|
|
597
|
+
title: z7.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
571
598
|
data: jsonValueSchema.refine(
|
|
572
599
|
(value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
|
|
573
600
|
{ message: "Plugin request data exceeds 64 KiB" }
|
|
574
601
|
)
|
|
575
602
|
});
|
|
576
|
-
var interactionRequestPayloadSchema =
|
|
603
|
+
var interactionRequestPayloadSchema = z7.union([
|
|
577
604
|
userQuestionPendingInteractionPayloadSchema,
|
|
578
605
|
pluginExtensionInteractionRequestPayloadSchema
|
|
579
606
|
]);
|
|
580
|
-
var pendingInteractionPayloadSchema =
|
|
607
|
+
var pendingInteractionPayloadSchema = z7.union([
|
|
581
608
|
approvalPendingInteractionPayloadSchema,
|
|
582
609
|
userQuestionPendingInteractionPayloadSchema,
|
|
583
610
|
pluginExtensionInteractionRequestPayloadSchema
|
|
584
611
|
]);
|
|
585
612
|
var approvalDecisionDiscriminatorError = "Invalid discriminator value. Expected 'allow_once' | 'allow_for_session' | 'deny'";
|
|
586
|
-
var approvalPendingInteractionResolutionSchema =
|
|
613
|
+
var approvalPendingInteractionResolutionSchema = z7.discriminatedUnion(
|
|
587
614
|
"decision",
|
|
588
615
|
[
|
|
589
|
-
|
|
590
|
-
decision:
|
|
616
|
+
z7.object({
|
|
617
|
+
decision: z7.literal("allow_once"),
|
|
591
618
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
592
619
|
}),
|
|
593
|
-
|
|
594
|
-
decision:
|
|
620
|
+
z7.object({
|
|
621
|
+
decision: z7.literal("allow_for_session"),
|
|
595
622
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
596
623
|
}),
|
|
597
|
-
|
|
598
|
-
decision:
|
|
624
|
+
z7.object({
|
|
625
|
+
decision: z7.literal("deny")
|
|
599
626
|
})
|
|
600
627
|
],
|
|
601
628
|
approvalDecisionDiscriminatorError
|
|
602
629
|
);
|
|
603
|
-
var pendingInteractionUserAnswerSchema =
|
|
604
|
-
selected:
|
|
630
|
+
var pendingInteractionUserAnswerSchema = z7.object({
|
|
631
|
+
selected: z7.array(z7.string().min(1)).max(
|
|
605
632
|
USER_QUESTION_MAX_SELECTED,
|
|
606
633
|
`User question selected choices cannot exceed ${USER_QUESTION_MAX_SELECTED}`
|
|
607
634
|
),
|
|
608
635
|
freeText: pendingInteractionUserQuestionFreeTextSchema.optional()
|
|
609
636
|
});
|
|
610
|
-
var userQuestionPendingInteractionResolutionSchema =
|
|
611
|
-
kind:
|
|
612
|
-
answers:
|
|
637
|
+
var userQuestionPendingInteractionResolutionSchema = z7.object({
|
|
638
|
+
kind: z7.literal("user_answer"),
|
|
639
|
+
answers: z7.record(z7.string().min(1), pendingInteractionUserAnswerSchema)
|
|
613
640
|
});
|
|
614
|
-
var pluginPendingInteractionResolutionSchema =
|
|
615
|
-
kind:
|
|
641
|
+
var pluginPendingInteractionResolutionSchema = z7.object({
|
|
642
|
+
kind: z7.literal("plugin_submitted")
|
|
616
643
|
});
|
|
617
|
-
var pluginExtensionInteractionResolutionSchema =
|
|
618
|
-
kind:
|
|
644
|
+
var pluginExtensionInteractionResolutionSchema = z7.object({
|
|
645
|
+
kind: z7.literal("request_answer"),
|
|
619
646
|
value: jsonValueSchema
|
|
620
647
|
});
|
|
621
|
-
var pendingInteractionResolutionSchema =
|
|
648
|
+
var pendingInteractionResolutionSchema = z7.union(
|
|
622
649
|
[
|
|
623
650
|
approvalPendingInteractionResolutionSchema,
|
|
624
651
|
userQuestionPendingInteractionResolutionSchema,
|
|
@@ -627,56 +654,56 @@ var pendingInteractionResolutionSchema = z6.union(
|
|
|
627
654
|
],
|
|
628
655
|
approvalDecisionDiscriminatorError
|
|
629
656
|
);
|
|
630
|
-
var approvalInteractionOutcomeSchema =
|
|
657
|
+
var approvalInteractionOutcomeSchema = z7.object({
|
|
631
658
|
payload: approvalPendingInteractionPayloadSchema,
|
|
632
659
|
resolution: approvalPendingInteractionResolutionSchema
|
|
633
660
|
});
|
|
634
|
-
var userQuestionInteractionOutcomeSchema =
|
|
661
|
+
var userQuestionInteractionOutcomeSchema = z7.object({
|
|
635
662
|
payload: userQuestionPendingInteractionPayloadSchema,
|
|
636
663
|
resolution: userQuestionPendingInteractionResolutionSchema
|
|
637
664
|
});
|
|
638
|
-
var pluginExtensionInteractionOutcomeSchema =
|
|
665
|
+
var pluginExtensionInteractionOutcomeSchema = z7.object({
|
|
639
666
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
640
667
|
resolution: pluginExtensionInteractionResolutionSchema
|
|
641
668
|
});
|
|
642
|
-
var providerInteractionOutcomeSchema =
|
|
669
|
+
var providerInteractionOutcomeSchema = z7.union([
|
|
643
670
|
approvalInteractionOutcomeSchema,
|
|
644
671
|
userQuestionInteractionOutcomeSchema,
|
|
645
672
|
pluginExtensionInteractionOutcomeSchema
|
|
646
673
|
]);
|
|
647
|
-
var pendingInteractionProviderOriginSchema =
|
|
648
|
-
kind:
|
|
649
|
-
providerId:
|
|
650
|
-
providerThreadId:
|
|
651
|
-
providerRequestId:
|
|
652
|
-
});
|
|
653
|
-
var pendingInteractionPluginOriginSchema =
|
|
654
|
-
kind:
|
|
655
|
-
pluginId:
|
|
656
|
-
rendererId:
|
|
657
|
-
});
|
|
658
|
-
var pendingInteractionCreateSchema =
|
|
659
|
-
threadId:
|
|
660
|
-
turnId:
|
|
661
|
-
providerId:
|
|
662
|
-
providerThreadId:
|
|
663
|
-
providerRequestId:
|
|
674
|
+
var pendingInteractionProviderOriginSchema = z7.object({
|
|
675
|
+
kind: z7.literal("provider"),
|
|
676
|
+
providerId: z7.string().min(1),
|
|
677
|
+
providerThreadId: z7.string().min(1),
|
|
678
|
+
providerRequestId: z7.string().min(1)
|
|
679
|
+
});
|
|
680
|
+
var pendingInteractionPluginOriginSchema = z7.object({
|
|
681
|
+
kind: z7.literal("plugin"),
|
|
682
|
+
pluginId: z7.string().min(1),
|
|
683
|
+
rendererId: z7.string().min(1)
|
|
684
|
+
});
|
|
685
|
+
var pendingInteractionCreateSchema = z7.object({
|
|
686
|
+
threadId: z7.string().min(1),
|
|
687
|
+
turnId: z7.string().min(1),
|
|
688
|
+
providerId: z7.string().min(1),
|
|
689
|
+
providerThreadId: z7.string().min(1),
|
|
690
|
+
providerRequestId: z7.string().min(1),
|
|
664
691
|
payload: pendingInteractionPayloadSchema
|
|
665
692
|
});
|
|
666
|
-
var pendingInteractionBaseSchema =
|
|
667
|
-
id:
|
|
668
|
-
threadId:
|
|
693
|
+
var pendingInteractionBaseSchema = z7.object({
|
|
694
|
+
id: z7.string().min(1),
|
|
695
|
+
threadId: z7.string().min(1),
|
|
669
696
|
status: pendingInteractionStatusSchema,
|
|
670
|
-
statusReason:
|
|
671
|
-
createdAt:
|
|
672
|
-
expiresAt:
|
|
673
|
-
resolvedAt:
|
|
697
|
+
statusReason: z7.string().nullable(),
|
|
698
|
+
createdAt: z7.number().int().nonnegative(),
|
|
699
|
+
expiresAt: z7.number().int().nonnegative().nullable().optional(),
|
|
700
|
+
resolvedAt: z7.number().int().nonnegative().nullable()
|
|
674
701
|
});
|
|
675
702
|
var providerPendingInteractionBaseSchema = pendingInteractionBaseSchema.extend({
|
|
676
|
-
turnId:
|
|
677
|
-
providerId:
|
|
678
|
-
providerThreadId:
|
|
679
|
-
providerRequestId:
|
|
703
|
+
turnId: z7.string().min(1),
|
|
704
|
+
providerId: z7.string().min(1),
|
|
705
|
+
providerThreadId: z7.string().min(1),
|
|
706
|
+
providerRequestId: z7.string().min(1),
|
|
680
707
|
origin: pendingInteractionProviderOriginSchema.optional()
|
|
681
708
|
});
|
|
682
709
|
var approvalPendingInteractionSchema = providerPendingInteractionBaseSchema.extend({
|
|
@@ -691,30 +718,30 @@ var pluginExtensionPendingInteractionSchema = providerPendingInteractionBaseSche
|
|
|
691
718
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
692
719
|
resolution: pluginExtensionInteractionResolutionSchema.nullable()
|
|
693
720
|
});
|
|
694
|
-
var providerPendingInteractionSchema =
|
|
721
|
+
var providerPendingInteractionSchema = z7.union([
|
|
695
722
|
approvalPendingInteractionSchema,
|
|
696
723
|
userQuestionPendingInteractionSchema,
|
|
697
724
|
pluginExtensionPendingInteractionSchema
|
|
698
725
|
]);
|
|
699
726
|
var pluginPendingInteractionSchema = pendingInteractionBaseSchema.extend({
|
|
700
|
-
turnId:
|
|
727
|
+
turnId: z7.string().min(1).nullable(),
|
|
701
728
|
origin: pendingInteractionPluginOriginSchema,
|
|
702
729
|
payload: pluginPendingInteractionPayloadSchema,
|
|
703
730
|
resolution: pluginPendingInteractionResolutionSchema.nullable()
|
|
704
731
|
});
|
|
705
|
-
var pendingInteractionSchema =
|
|
732
|
+
var pendingInteractionSchema = z7.union([
|
|
706
733
|
providerPendingInteractionSchema,
|
|
707
734
|
pluginPendingInteractionSchema
|
|
708
735
|
]);
|
|
709
|
-
var interactionLifecycleRecordBaseSchema =
|
|
710
|
-
id:
|
|
736
|
+
var interactionLifecycleRecordBaseSchema = z7.object({
|
|
737
|
+
id: z7.string().min(1),
|
|
711
738
|
status: pendingInteractionStatusSchema,
|
|
712
|
-
statusReason:
|
|
739
|
+
statusReason: z7.string().nullable()
|
|
713
740
|
});
|
|
714
|
-
var interactionLifecycleProviderOriginSchema =
|
|
715
|
-
kind:
|
|
716
|
-
providerId:
|
|
717
|
-
providerRequestId:
|
|
741
|
+
var interactionLifecycleProviderOriginSchema = z7.object({
|
|
742
|
+
kind: z7.literal("provider"),
|
|
743
|
+
providerId: z7.string().min(1),
|
|
744
|
+
providerRequestId: z7.string().min(1)
|
|
718
745
|
});
|
|
719
746
|
var approvalInteractionLifecycleRecordPayloadSchema = approvalPendingInteractionPayloadSchema.omit({ availableDecisions: true });
|
|
720
747
|
var approvalInteractionLifecycleSchema = interactionLifecycleRecordBaseSchema.extend({
|
|
@@ -739,7 +766,7 @@ var pluginExtensionInteractionLifecycleSchema = interactionLifecycleRecordBaseSc
|
|
|
739
766
|
}),
|
|
740
767
|
resolution: pluginExtensionInteractionResolutionSchema.omit({ value: true }).nullable()
|
|
741
768
|
});
|
|
742
|
-
var interactionLifecycleSchema =
|
|
769
|
+
var interactionLifecycleSchema = z7.union([
|
|
743
770
|
approvalInteractionLifecycleSchema,
|
|
744
771
|
userQuestionInteractionLifecycleSchema,
|
|
745
772
|
pluginInteractionLifecycleSchema,
|
|
@@ -747,11 +774,11 @@ var interactionLifecycleSchema = z6.union([
|
|
|
747
774
|
]);
|
|
748
775
|
|
|
749
776
|
// ../domain/src/protocol-ids.ts
|
|
750
|
-
import { z as
|
|
751
|
-
var clientTurnRequestIdSchema =
|
|
777
|
+
import { z as z8 } from "zod";
|
|
778
|
+
var clientTurnRequestIdSchema = z8.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
|
|
752
779
|
|
|
753
780
|
// ../domain/src/system-message.ts
|
|
754
|
-
import { z as
|
|
781
|
+
import { z as z9 } from "zod";
|
|
755
782
|
var systemMessageKindValues = [
|
|
756
783
|
"ownership-assigned",
|
|
757
784
|
"ownership-removed",
|
|
@@ -762,16 +789,16 @@ var systemMessageKindValues = [
|
|
|
762
789
|
"child-outcome-batch",
|
|
763
790
|
"unlabeled"
|
|
764
791
|
];
|
|
765
|
-
var systemMessageKindSchema =
|
|
766
|
-
var systemMessageSubjectSchema =
|
|
767
|
-
|
|
768
|
-
kind:
|
|
769
|
-
threadId:
|
|
770
|
-
threadName:
|
|
792
|
+
var systemMessageKindSchema = z9.enum(systemMessageKindValues);
|
|
793
|
+
var systemMessageSubjectSchema = z9.discriminatedUnion("kind", [
|
|
794
|
+
z9.object({
|
|
795
|
+
kind: z9.literal("thread"),
|
|
796
|
+
threadId: z9.string(),
|
|
797
|
+
threadName: z9.string()
|
|
771
798
|
}),
|
|
772
|
-
|
|
773
|
-
kind:
|
|
774
|
-
count:
|
|
799
|
+
z9.object({
|
|
800
|
+
kind: z9.literal("thread-batch"),
|
|
801
|
+
count: z9.number()
|
|
775
802
|
})
|
|
776
803
|
]);
|
|
777
804
|
|
|
@@ -794,31 +821,31 @@ var systemEventTypeValues = [
|
|
|
794
821
|
"system/provider-turn-watchdog"
|
|
795
822
|
];
|
|
796
823
|
var threadTurnInitiatorValues = ["user", "agent", "system"];
|
|
797
|
-
var threadTurnInitiatorSchema =
|
|
824
|
+
var threadTurnInitiatorSchema = z10.enum(threadTurnInitiatorValues);
|
|
798
825
|
var turnRequestOptionsSchema = recordedThreadExecutionOptionsSchema;
|
|
799
|
-
var turnRequestTargetSchema =
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
kind:
|
|
804
|
-
expectedTurnId:
|
|
826
|
+
var turnRequestTargetSchema = z10.discriminatedUnion("kind", [
|
|
827
|
+
z10.object({ kind: z10.literal("thread-start") }),
|
|
828
|
+
z10.object({ kind: z10.literal("new-turn") }),
|
|
829
|
+
z10.object({
|
|
830
|
+
kind: z10.literal("auto"),
|
|
831
|
+
expectedTurnId: z10.string().nullable()
|
|
805
832
|
}),
|
|
806
|
-
|
|
807
|
-
kind:
|
|
808
|
-
expectedTurnId:
|
|
833
|
+
z10.object({
|
|
834
|
+
kind: z10.literal("steer"),
|
|
835
|
+
expectedTurnId: z10.string().nullable()
|
|
809
836
|
})
|
|
810
837
|
]);
|
|
811
|
-
var clientTurnLifecycleEventDataSchema =
|
|
812
|
-
direction:
|
|
813
|
-
source:
|
|
838
|
+
var clientTurnLifecycleEventDataSchema = z10.object({
|
|
839
|
+
direction: z10.literal("outbound"),
|
|
840
|
+
source: z10.enum(["spawn", "tell"]),
|
|
814
841
|
initiator: threadTurnInitiatorSchema,
|
|
815
|
-
request:
|
|
816
|
-
method:
|
|
817
|
-
params:
|
|
842
|
+
request: z10.object({
|
|
843
|
+
method: z10.enum(["thread/start", "turn/start"]),
|
|
844
|
+
params: z10.record(z10.string(), z10.unknown())
|
|
818
845
|
})
|
|
819
846
|
});
|
|
820
|
-
var turnRequestEventDataSchema =
|
|
821
|
-
direction:
|
|
847
|
+
var turnRequestEventDataSchema = z10.object({
|
|
848
|
+
direction: z10.literal("outbound"),
|
|
822
849
|
requestId: clientTurnRequestIdSchema,
|
|
823
850
|
// Retry provenance, written only when a `turn.failed` gate's retry row
|
|
824
851
|
// dispatches. Both fields are present together or not at all: absence means
|
|
@@ -828,45 +855,45 @@ var turnRequestEventDataSchema = z9.object({
|
|
|
828
855
|
/** The original request this attempt re-submits, unchanged across attempts. */
|
|
829
856
|
retryOfRequestId: clientTurnRequestIdSchema.optional(),
|
|
830
857
|
/** Which attempt this is: 2 is the first retry of the original request. */
|
|
831
|
-
retryAttempt:
|
|
832
|
-
source:
|
|
858
|
+
retryAttempt: z10.number().int().min(2).optional(),
|
|
859
|
+
source: z10.enum(["spawn", "tell"]),
|
|
833
860
|
initiator: threadTurnInitiatorSchema,
|
|
834
|
-
senderThreadId:
|
|
861
|
+
senderThreadId: z10.string().nullable(),
|
|
835
862
|
systemMessageKind: systemMessageKindSchema.optional(),
|
|
836
863
|
systemMessageSubject: systemMessageSubjectSchema.nullable().optional(),
|
|
837
|
-
input:
|
|
838
|
-
inputGroups:
|
|
864
|
+
input: z10.array(promptInputSchema),
|
|
865
|
+
inputGroups: z10.array(z10.array(promptInputSchema).min(1)).min(1).optional(),
|
|
839
866
|
target: turnRequestTargetSchema,
|
|
840
|
-
request:
|
|
841
|
-
method:
|
|
842
|
-
params:
|
|
867
|
+
request: z10.object({
|
|
868
|
+
method: z10.enum(["thread/start", "turn/start"]),
|
|
869
|
+
params: z10.record(z10.string(), z10.unknown())
|
|
843
870
|
}),
|
|
844
871
|
execution: turnRequestOptionsSchema
|
|
845
872
|
});
|
|
846
|
-
var turnRequestRejectedEventDataSchema =
|
|
873
|
+
var turnRequestRejectedEventDataSchema = z10.object({
|
|
847
874
|
requestId: clientTurnRequestIdSchema,
|
|
848
|
-
reason:
|
|
849
|
-
message:
|
|
850
|
-
});
|
|
851
|
-
var systemErrorEventDataSchema =
|
|
852
|
-
code:
|
|
853
|
-
message:
|
|
854
|
-
detail:
|
|
855
|
-
reconnectAttempt:
|
|
856
|
-
reconnectTotal:
|
|
875
|
+
reason: z10.string().min(1),
|
|
876
|
+
message: z10.string().min(1)
|
|
877
|
+
});
|
|
878
|
+
var systemErrorEventDataSchema = z10.object({
|
|
879
|
+
code: z10.string().optional(),
|
|
880
|
+
message: z10.string(),
|
|
881
|
+
detail: z10.string().optional(),
|
|
882
|
+
reconnectAttempt: z10.number().int().positive().optional(),
|
|
883
|
+
reconnectTotal: z10.number().int().positive().optional()
|
|
857
884
|
}).superRefine((value, ctx) => {
|
|
858
885
|
const hasReconnectAttempt = value.reconnectAttempt !== void 0;
|
|
859
886
|
const hasReconnectTotal = value.reconnectTotal !== void 0;
|
|
860
887
|
if (hasReconnectAttempt !== hasReconnectTotal) {
|
|
861
888
|
ctx.addIssue({
|
|
862
|
-
code:
|
|
889
|
+
code: z10.ZodIssueCode.custom,
|
|
863
890
|
message: "system/error reconnectAttempt and reconnectTotal must be provided together"
|
|
864
891
|
});
|
|
865
892
|
return;
|
|
866
893
|
}
|
|
867
894
|
if (value.reconnectAttempt !== void 0 && value.reconnectTotal !== void 0 && value.reconnectAttempt > value.reconnectTotal) {
|
|
868
895
|
ctx.addIssue({
|
|
869
|
-
code:
|
|
896
|
+
code: z10.ZodIssueCode.custom,
|
|
870
897
|
message: "system/error reconnectAttempt cannot be greater than reconnectTotal"
|
|
871
898
|
});
|
|
872
899
|
}
|
|
@@ -876,42 +903,42 @@ var ownershipChangeOperationActionValues = [
|
|
|
876
903
|
"release",
|
|
877
904
|
"transfer"
|
|
878
905
|
];
|
|
879
|
-
var ownershipChangeOperationActionSchema =
|
|
906
|
+
var ownershipChangeOperationActionSchema = z10.enum(
|
|
880
907
|
ownershipChangeOperationActionValues
|
|
881
908
|
);
|
|
882
|
-
var ownershipChangeOperationMetadataSchema =
|
|
909
|
+
var ownershipChangeOperationMetadataSchema = z10.object({
|
|
883
910
|
action: ownershipChangeOperationActionSchema,
|
|
884
|
-
nextParentThreadId:
|
|
885
|
-
nextParentThreadTitle:
|
|
886
|
-
previousParentThreadId:
|
|
887
|
-
previousParentThreadTitle:
|
|
888
|
-
});
|
|
889
|
-
var systemOperationEventDataSchema =
|
|
890
|
-
operation:
|
|
891
|
-
status:
|
|
892
|
-
message:
|
|
893
|
-
operationId:
|
|
894
|
-
metadata:
|
|
895
|
-
});
|
|
896
|
-
var systemInteractionLifecycleEventDataSchema =
|
|
911
|
+
nextParentThreadId: z10.string().nullable(),
|
|
912
|
+
nextParentThreadTitle: z10.string().nullable(),
|
|
913
|
+
previousParentThreadId: z10.string().nullable(),
|
|
914
|
+
previousParentThreadTitle: z10.string().nullable()
|
|
915
|
+
});
|
|
916
|
+
var systemOperationEventDataSchema = z10.object({
|
|
917
|
+
operation: z10.string(),
|
|
918
|
+
status: z10.string(),
|
|
919
|
+
message: z10.string(),
|
|
920
|
+
operationId: z10.string(),
|
|
921
|
+
metadata: z10.record(z10.string(), jsonValueSchema).optional()
|
|
922
|
+
});
|
|
923
|
+
var systemInteractionLifecycleEventDataSchema = z10.object({
|
|
897
924
|
interaction: interactionLifecycleSchema
|
|
898
925
|
});
|
|
899
|
-
var systemPermissionGrantLifecycleEventDataSchema =
|
|
900
|
-
interactionId:
|
|
901
|
-
providerId:
|
|
902
|
-
providerRequestId:
|
|
926
|
+
var systemPermissionGrantLifecycleEventDataSchema = z10.object({
|
|
927
|
+
interactionId: z10.string(),
|
|
928
|
+
providerId: z10.string(),
|
|
929
|
+
providerRequestId: z10.string(),
|
|
903
930
|
status: pendingInteractionStatusSchema,
|
|
904
931
|
resolution: approvalPendingInteractionResolutionSchema.nullable().default(null),
|
|
905
|
-
statusReason:
|
|
932
|
+
statusReason: z10.string().nullable().default(null),
|
|
906
933
|
subject: pendingInteractionPermissionGrantApprovalSubjectSchema
|
|
907
934
|
});
|
|
908
|
-
var systemUserQuestionLifecycleEventDataSchema =
|
|
909
|
-
interactionId:
|
|
910
|
-
providerId:
|
|
911
|
-
providerRequestId:
|
|
935
|
+
var systemUserQuestionLifecycleEventDataSchema = z10.object({
|
|
936
|
+
interactionId: z10.string(),
|
|
937
|
+
providerId: z10.string(),
|
|
938
|
+
providerRequestId: z10.string(),
|
|
912
939
|
status: pendingInteractionStatusSchema,
|
|
913
940
|
resolution: userQuestionPendingInteractionResolutionSchema.nullable().default(null),
|
|
914
|
-
statusReason:
|
|
941
|
+
statusReason: z10.string().nullable().default(null),
|
|
915
942
|
payload: userQuestionPendingInteractionPayloadSchema
|
|
916
943
|
});
|
|
917
944
|
var systemThreadInterruptedReasonValues = [
|
|
@@ -919,20 +946,20 @@ var systemThreadInterruptedReasonValues = [
|
|
|
919
946
|
"host-daemon-restarted",
|
|
920
947
|
"provider-turn-idle"
|
|
921
948
|
];
|
|
922
|
-
var systemThreadInterruptedReasonSchema =
|
|
949
|
+
var systemThreadInterruptedReasonSchema = z10.enum(
|
|
923
950
|
systemThreadInterruptedReasonValues
|
|
924
951
|
);
|
|
925
|
-
var systemThreadInterruptedEventDataSchema =
|
|
952
|
+
var systemThreadInterruptedEventDataSchema = z10.object({
|
|
926
953
|
reason: systemThreadInterruptedReasonSchema,
|
|
927
|
-
cause:
|
|
954
|
+
cause: z10.literal("host-connection-lost").optional()
|
|
928
955
|
});
|
|
929
|
-
var provisioningTranscriptEntrySchema =
|
|
930
|
-
type:
|
|
931
|
-
key:
|
|
932
|
-
text:
|
|
933
|
-
startedAt:
|
|
934
|
-
status:
|
|
935
|
-
metadata:
|
|
956
|
+
var provisioningTranscriptEntrySchema = z10.object({
|
|
957
|
+
type: z10.enum(["step", "output"]),
|
|
958
|
+
key: z10.string(),
|
|
959
|
+
text: z10.string(),
|
|
960
|
+
startedAt: z10.number().optional(),
|
|
961
|
+
status: z10.enum(["started", "completed", "failed"]).optional(),
|
|
962
|
+
metadata: z10.record(z10.string(), z10.unknown()).optional()
|
|
936
963
|
});
|
|
937
964
|
var systemThreadProvisioningStatusValues = [
|
|
938
965
|
"active",
|
|
@@ -940,48 +967,48 @@ var systemThreadProvisioningStatusValues = [
|
|
|
940
967
|
"failed",
|
|
941
968
|
"cancelled"
|
|
942
969
|
];
|
|
943
|
-
var systemThreadProvisioningStatusSchema =
|
|
970
|
+
var systemThreadProvisioningStatusSchema = z10.enum(
|
|
944
971
|
systemThreadProvisioningStatusValues
|
|
945
972
|
);
|
|
946
|
-
var systemThreadProvisioningEventDataSchema =
|
|
947
|
-
provisioningId:
|
|
973
|
+
var systemThreadProvisioningEventDataSchema = z10.object({
|
|
974
|
+
provisioningId: z10.string(),
|
|
948
975
|
status: systemThreadProvisioningStatusSchema,
|
|
949
|
-
environmentId:
|
|
950
|
-
entries:
|
|
951
|
-
});
|
|
952
|
-
var systemLegacyUserMessageEventDataSchema =
|
|
953
|
-
text:
|
|
954
|
-
toolCallId:
|
|
955
|
-
turnId:
|
|
956
|
-
});
|
|
957
|
-
var systemProviderTurnWatchdogEventDataSchema =
|
|
958
|
-
reason:
|
|
959
|
-
thresholdMs:
|
|
960
|
-
elapsedMs:
|
|
961
|
-
activeTurnId:
|
|
962
|
-
activeTurnStartedAt:
|
|
963
|
-
lastActivityEventSequence:
|
|
964
|
-
lastActivityEventType:
|
|
965
|
-
lastActivityEventAt:
|
|
966
|
-
providerId:
|
|
967
|
-
providerThreadId:
|
|
968
|
-
firedAt:
|
|
976
|
+
environmentId: z10.string().nullable(),
|
|
977
|
+
entries: z10.array(provisioningTranscriptEntrySchema)
|
|
978
|
+
});
|
|
979
|
+
var systemLegacyUserMessageEventDataSchema = z10.object({
|
|
980
|
+
text: z10.string(),
|
|
981
|
+
toolCallId: z10.string().optional(),
|
|
982
|
+
turnId: z10.string().optional()
|
|
983
|
+
});
|
|
984
|
+
var systemProviderTurnWatchdogEventDataSchema = z10.object({
|
|
985
|
+
reason: z10.literal("provider-turn-idle"),
|
|
986
|
+
thresholdMs: z10.number().int().positive(),
|
|
987
|
+
elapsedMs: z10.number().int().nonnegative(),
|
|
988
|
+
activeTurnId: z10.string().min(1),
|
|
989
|
+
activeTurnStartedAt: z10.number().int().nonnegative(),
|
|
990
|
+
lastActivityEventSequence: z10.number().int().positive(),
|
|
991
|
+
lastActivityEventType: z10.string().min(1),
|
|
992
|
+
lastActivityEventAt: z10.number().int().nonnegative(),
|
|
993
|
+
providerId: z10.string().min(1),
|
|
994
|
+
providerThreadId: z10.string().min(1).nullable(),
|
|
995
|
+
firedAt: z10.number().int().nonnegative()
|
|
969
996
|
});
|
|
970
997
|
|
|
971
998
|
// ../domain/src/thread-event-scope.ts
|
|
972
|
-
import { z as
|
|
999
|
+
import { z as z11 } from "zod";
|
|
973
1000
|
var threadEventScopeKindValues = ["thread", "turn"];
|
|
974
|
-
var threadEventScopeKindSchema =
|
|
975
|
-
var threadEventScopeSchema =
|
|
976
|
-
|
|
977
|
-
|
|
1001
|
+
var threadEventScopeKindSchema = z11.enum(threadEventScopeKindValues);
|
|
1002
|
+
var threadEventScopeSchema = z11.discriminatedUnion("kind", [
|
|
1003
|
+
z11.object({ kind: z11.literal("thread") }),
|
|
1004
|
+
z11.object({ kind: z11.literal("turn"), turnId: z11.string().min(1) })
|
|
978
1005
|
]);
|
|
979
1006
|
var threadEventScopePolicyValues = [
|
|
980
1007
|
"thread",
|
|
981
1008
|
"turn",
|
|
982
1009
|
"thread-or-turn"
|
|
983
1010
|
];
|
|
984
|
-
var threadEventScopePolicySchema =
|
|
1011
|
+
var threadEventScopePolicySchema = z11.enum(threadEventScopePolicyValues);
|
|
985
1012
|
var threadEventScopeDefinitionByType = {
|
|
986
1013
|
"thread/started": {
|
|
987
1014
|
policy: "thread",
|
|
@@ -1124,9 +1151,6 @@ function getThreadEventScopePolicyDefinitionEntries() {
|
|
|
1124
1151
|
})
|
|
1125
1152
|
);
|
|
1126
1153
|
}
|
|
1127
|
-
function getThreadEventTypesForScopePolicy(policy) {
|
|
1128
|
-
return getThreadEventScopePolicyDefinitionEntries().filter((entry) => entry.definition.policy === policy).map((entry) => entry.type);
|
|
1129
|
-
}
|
|
1130
1154
|
function buildThreadEventScopePolicyByType() {
|
|
1131
1155
|
const policies = {};
|
|
1132
1156
|
for (const entry of getThreadEventScopePolicyDefinitionEntries()) {
|
|
@@ -1134,20 +1158,7 @@ function buildThreadEventScopePolicyByType() {
|
|
|
1134
1158
|
}
|
|
1135
1159
|
return policies;
|
|
1136
1160
|
}
|
|
1137
|
-
function buildThreadScopeRationaleByType() {
|
|
1138
|
-
const rationales = {};
|
|
1139
|
-
for (const entry of getThreadEventScopePolicyDefinitionEntries()) {
|
|
1140
|
-
if (entry.definition.rationale) {
|
|
1141
|
-
rationales[entry.type] = entry.definition.rationale;
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
return rationales;
|
|
1145
|
-
}
|
|
1146
|
-
var turnOnlyThreadEventTypes = getThreadEventTypesForScopePolicy("turn");
|
|
1147
|
-
var threadOnlyThreadEventTypes = getThreadEventTypesForScopePolicy("thread");
|
|
1148
|
-
var threadOrTurnThreadEventTypes = getThreadEventTypesForScopePolicy("thread-or-turn");
|
|
1149
1161
|
var threadEventScopePolicyByType = buildThreadEventScopePolicyByType();
|
|
1150
|
-
var threadScopeRationaleByType = buildThreadScopeRationaleByType();
|
|
1151
1162
|
function threadScope() {
|
|
1152
1163
|
return { kind: "thread" };
|
|
1153
1164
|
}
|
|
@@ -1172,32 +1183,32 @@ function validateThreadEventScope(args) {
|
|
|
1172
1183
|
}
|
|
1173
1184
|
|
|
1174
1185
|
// ../domain/src/thread-timeline-goal.ts
|
|
1175
|
-
import { z as
|
|
1176
|
-
var threadTimelineGoalStatusSchema =
|
|
1186
|
+
import { z as z12 } from "zod";
|
|
1187
|
+
var threadTimelineGoalStatusSchema = z12.enum([
|
|
1177
1188
|
"active",
|
|
1178
1189
|
"paused",
|
|
1179
1190
|
"budgetLimited",
|
|
1180
1191
|
"complete"
|
|
1181
1192
|
]);
|
|
1182
|
-
var threadTimelineGoalSchema =
|
|
1183
|
-
sourceSeq:
|
|
1184
|
-
updatedAt:
|
|
1185
|
-
objective:
|
|
1193
|
+
var threadTimelineGoalSchema = z12.object({
|
|
1194
|
+
sourceSeq: z12.number().int().nonnegative(),
|
|
1195
|
+
updatedAt: z12.number(),
|
|
1196
|
+
objective: z12.string(),
|
|
1186
1197
|
status: threadTimelineGoalStatusSchema,
|
|
1187
|
-
tokenBudget:
|
|
1188
|
-
tokensUsed:
|
|
1189
|
-
timeUsedSeconds:
|
|
1198
|
+
tokenBudget: z12.number().nullable(),
|
|
1199
|
+
tokensUsed: z12.number(),
|
|
1200
|
+
timeUsedSeconds: z12.number()
|
|
1190
1201
|
});
|
|
1191
1202
|
|
|
1192
1203
|
// ../domain/src/provider-event.ts
|
|
1193
|
-
var threadEventItemStatusSchema =
|
|
1204
|
+
var threadEventItemStatusSchema = z13.enum([
|
|
1194
1205
|
"pending",
|
|
1195
1206
|
"completed",
|
|
1196
1207
|
"failed",
|
|
1197
1208
|
"interrupted"
|
|
1198
1209
|
]);
|
|
1199
|
-
var threadEventItemApprovalStatusSchema =
|
|
1200
|
-
var threadEventTurnStatusSchema =
|
|
1210
|
+
var threadEventItemApprovalStatusSchema = z13.enum(["waiting_for_approval", "denied"]).nullable();
|
|
1211
|
+
var threadEventTurnStatusSchema = z13.enum([
|
|
1201
1212
|
"completed",
|
|
1202
1213
|
"failed",
|
|
1203
1214
|
"interrupted"
|
|
@@ -1223,259 +1234,260 @@ var providerErrorCategoryValues = [
|
|
|
1223
1234
|
"unauthorized",
|
|
1224
1235
|
"unknown"
|
|
1225
1236
|
];
|
|
1226
|
-
var providerErrorCategorySchema =
|
|
1227
|
-
var providerErrorInfoSchema =
|
|
1237
|
+
var providerErrorCategorySchema = z13.enum(providerErrorCategoryValues);
|
|
1238
|
+
var providerErrorInfoSchema = z13.object({
|
|
1228
1239
|
category: providerErrorCategorySchema,
|
|
1229
|
-
providerCode:
|
|
1230
|
-
httpStatusCode:
|
|
1240
|
+
providerCode: z13.string().nullable(),
|
|
1241
|
+
httpStatusCode: z13.number().nullable()
|
|
1231
1242
|
});
|
|
1232
|
-
var providerRateLimitStatusSchema =
|
|
1243
|
+
var providerRateLimitStatusSchema = z13.enum([
|
|
1233
1244
|
"allowed",
|
|
1234
1245
|
"warning",
|
|
1235
1246
|
"blocked",
|
|
1236
1247
|
"unknown"
|
|
1237
1248
|
]);
|
|
1238
|
-
var providerRateLimitWindowSchema =
|
|
1239
|
-
providerKey:
|
|
1240
|
-
label:
|
|
1249
|
+
var providerRateLimitWindowSchema = z13.object({
|
|
1250
|
+
providerKey: z13.string().min(1).nullable(),
|
|
1251
|
+
label: z13.string().min(1).nullable(),
|
|
1241
1252
|
status: providerRateLimitStatusSchema,
|
|
1242
|
-
resetsAtMs:
|
|
1253
|
+
resetsAtMs: z13.number().int().nonnegative().nullable()
|
|
1243
1254
|
});
|
|
1244
|
-
var providerRateLimitStateSchema =
|
|
1245
|
-
providerId:
|
|
1255
|
+
var providerRateLimitStateSchema = z13.object({
|
|
1256
|
+
providerId: z13.string().min(1),
|
|
1246
1257
|
status: providerRateLimitStatusSchema,
|
|
1247
|
-
kind:
|
|
1248
|
-
windows:
|
|
1249
|
-
reachedReason:
|
|
1250
|
-
overageStatus:
|
|
1251
|
-
overageReason:
|
|
1252
|
-
});
|
|
1253
|
-
var threadEventFileChangeKindSchema =
|
|
1254
|
-
var threadEventFileChangeSchema =
|
|
1255
|
-
path:
|
|
1258
|
+
kind: z13.enum(["subscription-window", "credits", "spend-control", "unknown"]),
|
|
1259
|
+
windows: z13.array(providerRateLimitWindowSchema),
|
|
1260
|
+
reachedReason: z13.string().min(1).nullable(),
|
|
1261
|
+
overageStatus: z13.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
|
|
1262
|
+
overageReason: z13.string().min(1).nullable()
|
|
1263
|
+
});
|
|
1264
|
+
var threadEventFileChangeKindSchema = z13.enum(["add", "delete", "update"]);
|
|
1265
|
+
var threadEventFileChangeSchema = z13.object({
|
|
1266
|
+
path: z13.string(),
|
|
1256
1267
|
kind: threadEventFileChangeKindSchema,
|
|
1257
|
-
movePath:
|
|
1258
|
-
diff:
|
|
1268
|
+
movePath: z13.string().optional(),
|
|
1269
|
+
diff: z13.string().optional()
|
|
1259
1270
|
});
|
|
1260
|
-
var threadEventPlanStepStatusSchema =
|
|
1271
|
+
var threadEventPlanStepStatusSchema = z13.enum([
|
|
1261
1272
|
"pending",
|
|
1262
1273
|
"active",
|
|
1263
1274
|
"completed",
|
|
1264
1275
|
"failed"
|
|
1265
1276
|
]);
|
|
1266
|
-
var threadEventPlanStepSchema =
|
|
1267
|
-
step:
|
|
1277
|
+
var threadEventPlanStepSchema = z13.object({
|
|
1278
|
+
step: z13.string(),
|
|
1268
1279
|
status: threadEventPlanStepStatusSchema.optional()
|
|
1269
1280
|
});
|
|
1270
1281
|
var itemPresentationField = {
|
|
1271
1282
|
presentation: threadEventItemPresentationSchema.optional()
|
|
1272
1283
|
};
|
|
1273
|
-
var threadEventWebSearchItemSchema =
|
|
1274
|
-
type:
|
|
1275
|
-
id:
|
|
1276
|
-
queries:
|
|
1277
|
-
resultText:
|
|
1284
|
+
var threadEventWebSearchItemSchema = z13.object({
|
|
1285
|
+
type: z13.literal("webSearch"),
|
|
1286
|
+
id: z13.string(),
|
|
1287
|
+
queries: z13.array(z13.string()).min(1),
|
|
1288
|
+
resultText: z13.string().nullable(),
|
|
1278
1289
|
...itemPresentationField,
|
|
1279
|
-
parentToolCallId:
|
|
1280
|
-
});
|
|
1281
|
-
var threadEventWebFetchItemSchema =
|
|
1282
|
-
type:
|
|
1283
|
-
id:
|
|
1284
|
-
url:
|
|
1285
|
-
prompt:
|
|
1286
|
-
pattern:
|
|
1287
|
-
resultText:
|
|
1290
|
+
parentToolCallId: z13.string().optional()
|
|
1291
|
+
});
|
|
1292
|
+
var threadEventWebFetchItemSchema = z13.object({
|
|
1293
|
+
type: z13.literal("webFetch"),
|
|
1294
|
+
id: z13.string(),
|
|
1295
|
+
url: z13.string(),
|
|
1296
|
+
prompt: z13.string().nullable(),
|
|
1297
|
+
pattern: z13.string().nullable(),
|
|
1298
|
+
resultText: z13.string().nullable(),
|
|
1288
1299
|
...itemPresentationField,
|
|
1289
|
-
parentToolCallId:
|
|
1300
|
+
parentToolCallId: z13.string().optional()
|
|
1290
1301
|
});
|
|
1291
|
-
var threadEventImageViewItemSchema =
|
|
1292
|
-
type:
|
|
1293
|
-
id:
|
|
1294
|
-
path:
|
|
1302
|
+
var threadEventImageViewItemSchema = z13.object({
|
|
1303
|
+
type: z13.literal("imageView"),
|
|
1304
|
+
id: z13.string(),
|
|
1305
|
+
path: z13.string(),
|
|
1295
1306
|
...itemPresentationField,
|
|
1296
|
-
parentToolCallId:
|
|
1307
|
+
parentToolCallId: z13.string().optional()
|
|
1297
1308
|
});
|
|
1298
|
-
var threadEventFileReadItemSchema =
|
|
1299
|
-
type:
|
|
1300
|
-
id:
|
|
1301
|
-
path:
|
|
1302
|
-
cmd:
|
|
1309
|
+
var threadEventFileReadItemSchema = z13.object({
|
|
1310
|
+
type: z13.literal("fileRead"),
|
|
1311
|
+
id: z13.string(),
|
|
1312
|
+
path: z13.string(),
|
|
1313
|
+
cmd: z13.string().optional(),
|
|
1303
1314
|
status: threadEventItemStatusSchema,
|
|
1304
1315
|
...itemPresentationField,
|
|
1305
|
-
parentToolCallId:
|
|
1316
|
+
parentToolCallId: z13.string().optional()
|
|
1306
1317
|
});
|
|
1307
|
-
var threadEventSearchModeSchema =
|
|
1308
|
-
var threadEventSearchItemSchema =
|
|
1309
|
-
type:
|
|
1310
|
-
id:
|
|
1318
|
+
var threadEventSearchModeSchema = z13.enum(["content", "path", "list"]);
|
|
1319
|
+
var threadEventSearchItemSchema = z13.object({
|
|
1320
|
+
type: z13.literal("search"),
|
|
1321
|
+
id: z13.string(),
|
|
1311
1322
|
mode: threadEventSearchModeSchema,
|
|
1312
|
-
query:
|
|
1313
|
-
path:
|
|
1314
|
-
cmd:
|
|
1323
|
+
query: z13.string(),
|
|
1324
|
+
path: z13.string().optional(),
|
|
1325
|
+
cmd: z13.string().optional(),
|
|
1315
1326
|
status: threadEventItemStatusSchema,
|
|
1316
1327
|
...itemPresentationField,
|
|
1317
|
-
parentToolCallId:
|
|
1328
|
+
parentToolCallId: z13.string().optional()
|
|
1318
1329
|
});
|
|
1319
|
-
var threadEventDelegationItemSchema =
|
|
1320
|
-
type:
|
|
1321
|
-
id:
|
|
1322
|
-
childRef:
|
|
1323
|
-
label:
|
|
1330
|
+
var threadEventDelegationItemSchema = z13.object({
|
|
1331
|
+
type: z13.literal("delegation"),
|
|
1332
|
+
id: z13.string(),
|
|
1333
|
+
childRef: z13.string().min(1),
|
|
1334
|
+
label: z13.string(),
|
|
1324
1335
|
status: threadEventItemStatusSchema,
|
|
1325
|
-
background:
|
|
1326
|
-
summary:
|
|
1336
|
+
background: z13.boolean(),
|
|
1337
|
+
summary: z13.string().optional(),
|
|
1327
1338
|
...itemPresentationField,
|
|
1328
|
-
parentToolCallId:
|
|
1339
|
+
parentToolCallId: z13.string().optional()
|
|
1329
1340
|
});
|
|
1330
|
-
var threadEventPlanStepsItemSchema =
|
|
1331
|
-
type:
|
|
1332
|
-
id:
|
|
1333
|
-
steps:
|
|
1334
|
-
explanation:
|
|
1341
|
+
var threadEventPlanStepsItemSchema = z13.object({
|
|
1342
|
+
type: z13.literal("planSteps"),
|
|
1343
|
+
id: z13.string(),
|
|
1344
|
+
steps: z13.array(threadEventPlanStepSchema),
|
|
1345
|
+
explanation: z13.string().optional(),
|
|
1335
1346
|
status: threadEventItemStatusSchema,
|
|
1336
1347
|
...itemPresentationField,
|
|
1337
|
-
parentToolCallId:
|
|
1348
|
+
parentToolCallId: z13.string().optional()
|
|
1338
1349
|
});
|
|
1339
|
-
var threadEventExtensionItemSchema =
|
|
1340
|
-
type:
|
|
1341
|
-
id:
|
|
1350
|
+
var threadEventExtensionItemSchema = z13.object({
|
|
1351
|
+
type: z13.literal("extension"),
|
|
1352
|
+
id: z13.string(),
|
|
1342
1353
|
kind: extensionKindSchema,
|
|
1343
1354
|
payload: jsonValueSchema,
|
|
1344
1355
|
status: threadEventItemStatusSchema,
|
|
1345
1356
|
presentation: threadEventItemPresentationSchema,
|
|
1346
|
-
parentToolCallId:
|
|
1357
|
+
parentToolCallId: z13.string().optional()
|
|
1347
1358
|
});
|
|
1348
|
-
var threadEventTextTruncationSchema =
|
|
1349
|
-
originalLength:
|
|
1350
|
-
retainedHeadLength:
|
|
1351
|
-
retainedTailLength:
|
|
1352
|
-
truncatedAt:
|
|
1359
|
+
var threadEventTextTruncationSchema = z13.object({
|
|
1360
|
+
originalLength: z13.number(),
|
|
1361
|
+
retainedHeadLength: z13.number(),
|
|
1362
|
+
retainedTailLength: z13.number(),
|
|
1363
|
+
truncatedAt: z13.number()
|
|
1353
1364
|
});
|
|
1354
|
-
var threadEventItemTruncationSchema =
|
|
1365
|
+
var threadEventItemTruncationSchema = z13.object({
|
|
1355
1366
|
aggregatedOutput: threadEventTextTruncationSchema.optional(),
|
|
1356
1367
|
result: threadEventTextTruncationSchema.optional(),
|
|
1357
1368
|
resultText: threadEventTextTruncationSchema.optional()
|
|
1358
1369
|
});
|
|
1359
|
-
var threadEventImageGenerationItemSchema =
|
|
1360
|
-
type:
|
|
1361
|
-
id:
|
|
1370
|
+
var threadEventImageGenerationItemSchema = z13.object({
|
|
1371
|
+
type: z13.literal("imageGeneration"),
|
|
1372
|
+
id: z13.string(),
|
|
1362
1373
|
status: threadEventItemStatusSchema,
|
|
1363
|
-
prompt:
|
|
1364
|
-
path:
|
|
1365
|
-
result:
|
|
1366
|
-
error:
|
|
1367
|
-
transparentBackground:
|
|
1374
|
+
prompt: z13.string().nullable(),
|
|
1375
|
+
path: z13.string().nullable(),
|
|
1376
|
+
result: z13.string().optional(),
|
|
1377
|
+
error: z13.string().nullable(),
|
|
1378
|
+
transparentBackground: z13.boolean(),
|
|
1368
1379
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1369
1380
|
...itemPresentationField,
|
|
1370
|
-
parentToolCallId:
|
|
1381
|
+
parentToolCallId: z13.string().optional()
|
|
1371
1382
|
});
|
|
1372
|
-
var threadEventUserContentSchema =
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1383
|
+
var threadEventUserContentSchema = z13.discriminatedUnion("type", [
|
|
1384
|
+
z13.object({ type: z13.literal("text"), text: z13.string() }),
|
|
1385
|
+
z13.object({ type: z13.literal("image"), url: z13.string() }),
|
|
1386
|
+
z13.object({ type: z13.literal("localImage"), path: z13.string() }),
|
|
1387
|
+
z13.object({ type: z13.literal("localFile"), path: z13.string() })
|
|
1377
1388
|
]);
|
|
1378
|
-
var threadEventTokenUsageBreakdownSchema =
|
|
1379
|
-
totalTokens:
|
|
1380
|
-
inputTokens:
|
|
1381
|
-
cachedInputTokens:
|
|
1382
|
-
outputTokens:
|
|
1383
|
-
reasoningOutputTokens:
|
|
1384
|
-
});
|
|
1385
|
-
var threadEventContextWindowUsageSchema =
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1389
|
+
var threadEventTokenUsageBreakdownSchema = z13.object({
|
|
1390
|
+
totalTokens: z13.number(),
|
|
1391
|
+
inputTokens: z13.number(),
|
|
1392
|
+
cachedInputTokens: z13.number(),
|
|
1393
|
+
outputTokens: z13.number(),
|
|
1394
|
+
reasoningOutputTokens: z13.number()
|
|
1395
|
+
});
|
|
1396
|
+
var threadEventContextWindowUsageSchema = z13.object({
|
|
1397
|
+
snapshot: contextSnapshotSchema.optional(),
|
|
1398
|
+
usedTokens: z13.number().nullable(),
|
|
1399
|
+
modelContextWindow: z13.number().nullable(),
|
|
1400
|
+
estimated: z13.boolean()
|
|
1401
|
+
});
|
|
1402
|
+
var threadEventTokenUsageSchema = z13.object({
|
|
1391
1403
|
total: threadEventTokenUsageBreakdownSchema,
|
|
1392
1404
|
last: threadEventTokenUsageBreakdownSchema,
|
|
1393
|
-
modelContextWindow:
|
|
1405
|
+
modelContextWindow: z13.number().nullable()
|
|
1394
1406
|
});
|
|
1395
|
-
var threadEventWarningCategorySchema =
|
|
1407
|
+
var threadEventWarningCategorySchema = z13.enum([
|
|
1396
1408
|
"deprecation",
|
|
1397
1409
|
"config",
|
|
1398
1410
|
"general",
|
|
1399
1411
|
"compaction-skipped"
|
|
1400
1412
|
]);
|
|
1401
|
-
var providerRawEventSchema =
|
|
1402
|
-
jsonrpc:
|
|
1403
|
-
id:
|
|
1404
|
-
method:
|
|
1413
|
+
var providerRawEventSchema = z13.object({
|
|
1414
|
+
jsonrpc: z13.literal("2.0"),
|
|
1415
|
+
id: z13.union([z13.string(), z13.number()]).optional(),
|
|
1416
|
+
method: z13.string(),
|
|
1405
1417
|
params: jsonValueSchema.optional()
|
|
1406
1418
|
});
|
|
1407
|
-
var providerUnhandledEventSchema =
|
|
1408
|
-
type:
|
|
1409
|
-
threadId:
|
|
1410
|
-
providerThreadId:
|
|
1411
|
-
providerId:
|
|
1412
|
-
rawType:
|
|
1419
|
+
var providerUnhandledEventSchema = z13.object({
|
|
1420
|
+
type: z13.literal("provider/unhandled"),
|
|
1421
|
+
threadId: z13.string(),
|
|
1422
|
+
providerThreadId: z13.string(),
|
|
1423
|
+
providerId: z13.string(),
|
|
1424
|
+
rawType: z13.string(),
|
|
1413
1425
|
rawEvent: providerRawEventSchema,
|
|
1414
|
-
parentToolCallId:
|
|
1415
|
-
});
|
|
1416
|
-
var toolCallProgressEventSchema =
|
|
1417
|
-
type:
|
|
1418
|
-
threadId:
|
|
1419
|
-
providerThreadId:
|
|
1420
|
-
itemId:
|
|
1421
|
-
message:
|
|
1422
|
-
parentToolCallId:
|
|
1423
|
-
});
|
|
1424
|
-
var threadEventBackgroundTaskItemSchema =
|
|
1425
|
-
type:
|
|
1426
|
-
id:
|
|
1427
|
-
familyId:
|
|
1428
|
-
taskType:
|
|
1429
|
-
description:
|
|
1426
|
+
parentToolCallId: z13.string().optional()
|
|
1427
|
+
});
|
|
1428
|
+
var toolCallProgressEventSchema = z13.object({
|
|
1429
|
+
type: z13.literal("item/toolCall/progress"),
|
|
1430
|
+
threadId: z13.string(),
|
|
1431
|
+
providerThreadId: z13.string(),
|
|
1432
|
+
itemId: z13.string(),
|
|
1433
|
+
message: z13.string().optional(),
|
|
1434
|
+
parentToolCallId: z13.string().optional()
|
|
1435
|
+
});
|
|
1436
|
+
var threadEventBackgroundTaskItemSchema = z13.object({
|
|
1437
|
+
type: z13.literal("backgroundTask"),
|
|
1438
|
+
id: z13.string(),
|
|
1439
|
+
familyId: z13.string().optional(),
|
|
1440
|
+
taskType: z13.string(),
|
|
1441
|
+
description: z13.string(),
|
|
1430
1442
|
status: threadEventItemStatusSchema,
|
|
1431
1443
|
taskStatus: backgroundTaskStatusSchema,
|
|
1432
|
-
skipTranscript:
|
|
1433
|
-
workflowName:
|
|
1444
|
+
skipTranscript: z13.boolean(),
|
|
1445
|
+
workflowName: z13.string().optional(),
|
|
1434
1446
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
1435
1447
|
usage: backgroundTaskUsageSchema.optional(),
|
|
1436
|
-
summary:
|
|
1437
|
-
error:
|
|
1438
|
-
outputFile:
|
|
1448
|
+
summary: z13.string().optional(),
|
|
1449
|
+
error: z13.string().optional(),
|
|
1450
|
+
outputFile: z13.string().optional(),
|
|
1439
1451
|
...itemPresentationField,
|
|
1440
|
-
parentToolCallId:
|
|
1452
|
+
parentToolCallId: z13.string().optional()
|
|
1441
1453
|
});
|
|
1442
|
-
var threadEventItemSchema =
|
|
1443
|
-
|
|
1444
|
-
type:
|
|
1445
|
-
id:
|
|
1446
|
-
content:
|
|
1454
|
+
var threadEventItemSchema = z13.discriminatedUnion("type", [
|
|
1455
|
+
z13.object({
|
|
1456
|
+
type: z13.literal("userMessage"),
|
|
1457
|
+
id: z13.string(),
|
|
1458
|
+
content: z13.array(threadEventUserContentSchema),
|
|
1447
1459
|
clientRequestId: clientTurnRequestIdSchema.optional(),
|
|
1448
|
-
parentToolCallId:
|
|
1460
|
+
parentToolCallId: z13.string().optional()
|
|
1449
1461
|
}).strict(),
|
|
1450
|
-
|
|
1451
|
-
type:
|
|
1452
|
-
id:
|
|
1453
|
-
text:
|
|
1462
|
+
z13.object({
|
|
1463
|
+
type: z13.literal("agentMessage"),
|
|
1464
|
+
id: z13.string(),
|
|
1465
|
+
text: z13.string(),
|
|
1454
1466
|
...itemPresentationField,
|
|
1455
|
-
parentToolCallId:
|
|
1467
|
+
parentToolCallId: z13.string().optional()
|
|
1456
1468
|
}),
|
|
1457
|
-
|
|
1458
|
-
type:
|
|
1459
|
-
id:
|
|
1460
|
-
command:
|
|
1461
|
-
cwd:
|
|
1469
|
+
z13.object({
|
|
1470
|
+
type: z13.literal("commandExecution"),
|
|
1471
|
+
id: z13.string(),
|
|
1472
|
+
command: z13.string(),
|
|
1473
|
+
cwd: z13.string(),
|
|
1462
1474
|
status: threadEventItemStatusSchema,
|
|
1463
1475
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1464
|
-
aggregatedOutput:
|
|
1465
|
-
exitCode:
|
|
1466
|
-
durationMs:
|
|
1476
|
+
aggregatedOutput: z13.string().optional(),
|
|
1477
|
+
exitCode: z13.number().optional(),
|
|
1478
|
+
durationMs: z13.number().optional(),
|
|
1467
1479
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1468
1480
|
...itemPresentationField,
|
|
1469
|
-
parentToolCallId:
|
|
1481
|
+
parentToolCallId: z13.string().optional()
|
|
1470
1482
|
}),
|
|
1471
|
-
|
|
1472
|
-
type:
|
|
1473
|
-
id:
|
|
1474
|
-
changes:
|
|
1483
|
+
z13.object({
|
|
1484
|
+
type: z13.literal("fileChange"),
|
|
1485
|
+
id: z13.string(),
|
|
1486
|
+
changes: z13.array(threadEventFileChangeSchema),
|
|
1475
1487
|
status: threadEventItemStatusSchema,
|
|
1476
1488
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1477
1489
|
...itemPresentationField,
|
|
1478
|
-
parentToolCallId:
|
|
1490
|
+
parentToolCallId: z13.string().optional()
|
|
1479
1491
|
}),
|
|
1480
1492
|
threadEventWebSearchItemSchema,
|
|
1481
1493
|
threadEventWebFetchItemSchema,
|
|
@@ -1483,289 +1495,264 @@ var threadEventItemSchema = z12.discriminatedUnion("type", [
|
|
|
1483
1495
|
threadEventImageGenerationItemSchema,
|
|
1484
1496
|
threadEventFileReadItemSchema,
|
|
1485
1497
|
threadEventSearchItemSchema,
|
|
1486
|
-
|
|
1487
|
-
type:
|
|
1488
|
-
id:
|
|
1489
|
-
server:
|
|
1490
|
-
tool:
|
|
1491
|
-
arguments:
|
|
1498
|
+
z13.object({
|
|
1499
|
+
type: z13.literal("toolCall"),
|
|
1500
|
+
id: z13.string(),
|
|
1501
|
+
server: z13.string().optional(),
|
|
1502
|
+
tool: z13.string(),
|
|
1503
|
+
arguments: z13.record(z13.string(), z13.unknown()).optional(),
|
|
1492
1504
|
status: threadEventItemStatusSchema,
|
|
1493
|
-
result:
|
|
1494
|
-
error:
|
|
1495
|
-
durationMs:
|
|
1505
|
+
result: z13.unknown().optional(),
|
|
1506
|
+
error: z13.string().optional(),
|
|
1507
|
+
durationMs: z13.number().optional(),
|
|
1496
1508
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1497
1509
|
...itemPresentationField,
|
|
1498
|
-
parentToolCallId:
|
|
1510
|
+
parentToolCallId: z13.string().optional()
|
|
1499
1511
|
}),
|
|
1500
|
-
|
|
1501
|
-
type:
|
|
1502
|
-
id:
|
|
1503
|
-
summary:
|
|
1504
|
-
content:
|
|
1512
|
+
z13.object({
|
|
1513
|
+
type: z13.literal("reasoning"),
|
|
1514
|
+
id: z13.string(),
|
|
1515
|
+
summary: z13.array(z13.string()),
|
|
1516
|
+
content: z13.array(z13.string()),
|
|
1505
1517
|
...itemPresentationField,
|
|
1506
|
-
parentToolCallId:
|
|
1518
|
+
parentToolCallId: z13.string().optional()
|
|
1507
1519
|
}),
|
|
1508
|
-
|
|
1509
|
-
type:
|
|
1510
|
-
id:
|
|
1511
|
-
text:
|
|
1520
|
+
z13.object({
|
|
1521
|
+
type: z13.literal("plan"),
|
|
1522
|
+
id: z13.string(),
|
|
1523
|
+
text: z13.string(),
|
|
1512
1524
|
...itemPresentationField,
|
|
1513
|
-
parentToolCallId:
|
|
1525
|
+
parentToolCallId: z13.string().optional()
|
|
1514
1526
|
}),
|
|
1515
1527
|
threadEventPlanStepsItemSchema,
|
|
1516
|
-
|
|
1517
|
-
type:
|
|
1518
|
-
id:
|
|
1528
|
+
z13.object({
|
|
1529
|
+
type: z13.literal("contextCompaction"),
|
|
1530
|
+
id: z13.string(),
|
|
1519
1531
|
...itemPresentationField,
|
|
1520
|
-
parentToolCallId:
|
|
1532
|
+
parentToolCallId: z13.string().optional()
|
|
1521
1533
|
}),
|
|
1522
1534
|
threadEventBackgroundTaskItemSchema,
|
|
1523
1535
|
threadEventDelegationItemSchema,
|
|
1524
1536
|
threadEventExtensionItemSchema
|
|
1525
1537
|
]);
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
type:
|
|
1529
|
-
threadId:
|
|
1538
|
+
function itemTextDeltaEventSchema(type) {
|
|
1539
|
+
return z13.object({
|
|
1540
|
+
type: z13.literal(type),
|
|
1541
|
+
threadId: z13.string(),
|
|
1542
|
+
providerThreadId: z13.string(),
|
|
1543
|
+
itemId: z13.string(),
|
|
1544
|
+
delta: z13.string(),
|
|
1545
|
+
parentToolCallId: z13.string().optional()
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
var unscopedProviderEventSchema = z13.discriminatedUnion("type", [
|
|
1549
|
+
z13.object({
|
|
1550
|
+
type: z13.literal("thread/started"),
|
|
1551
|
+
threadId: z13.string()
|
|
1530
1552
|
}),
|
|
1531
|
-
|
|
1532
|
-
type:
|
|
1533
|
-
threadId:
|
|
1534
|
-
providerThreadId:
|
|
1553
|
+
z13.object({
|
|
1554
|
+
type: z13.literal("thread/identity"),
|
|
1555
|
+
threadId: z13.string(),
|
|
1556
|
+
providerThreadId: z13.string()
|
|
1535
1557
|
}),
|
|
1536
|
-
|
|
1537
|
-
type:
|
|
1538
|
-
threadId:
|
|
1539
|
-
providerThreadId:
|
|
1540
|
-
parentToolCallId:
|
|
1558
|
+
z13.object({
|
|
1559
|
+
type: z13.literal("turn/started"),
|
|
1560
|
+
threadId: z13.string(),
|
|
1561
|
+
providerThreadId: z13.string(),
|
|
1562
|
+
parentToolCallId: z13.string().optional()
|
|
1541
1563
|
}),
|
|
1542
|
-
|
|
1543
|
-
type:
|
|
1544
|
-
threadId:
|
|
1545
|
-
providerThreadId:
|
|
1564
|
+
z13.object({
|
|
1565
|
+
type: z13.literal("turn/completed"),
|
|
1566
|
+
threadId: z13.string(),
|
|
1567
|
+
providerThreadId: z13.string().nullable(),
|
|
1546
1568
|
status: threadEventTurnStatusSchema,
|
|
1547
|
-
error:
|
|
1548
|
-
providerCheckpointId:
|
|
1569
|
+
error: z13.object({ message: z13.string() }).optional(),
|
|
1570
|
+
providerCheckpointId: z13.string().min(1).optional()
|
|
1549
1571
|
}),
|
|
1550
|
-
|
|
1551
|
-
type:
|
|
1552
|
-
threadId:
|
|
1553
|
-
providerThreadId:
|
|
1572
|
+
z13.object({
|
|
1573
|
+
type: z13.literal("turn/input/accepted"),
|
|
1574
|
+
threadId: z13.string(),
|
|
1575
|
+
providerThreadId: z13.string(),
|
|
1554
1576
|
clientRequestId: clientTurnRequestIdSchema,
|
|
1555
1577
|
scope: threadEventScopeSchema
|
|
1556
1578
|
}).strict(),
|
|
1557
|
-
|
|
1558
|
-
type:
|
|
1559
|
-
threadId:
|
|
1560
|
-
providerThreadId:
|
|
1561
|
-
threadName:
|
|
1579
|
+
z13.object({
|
|
1580
|
+
type: z13.literal("thread/name/updated"),
|
|
1581
|
+
threadId: z13.string(),
|
|
1582
|
+
providerThreadId: z13.string(),
|
|
1583
|
+
threadName: z13.string()
|
|
1562
1584
|
}),
|
|
1563
|
-
|
|
1564
|
-
type:
|
|
1565
|
-
threadId:
|
|
1566
|
-
providerThreadId:
|
|
1585
|
+
z13.object({
|
|
1586
|
+
type: z13.literal("thread/compacted"),
|
|
1587
|
+
threadId: z13.string(),
|
|
1588
|
+
providerThreadId: z13.string()
|
|
1567
1589
|
}),
|
|
1568
|
-
|
|
1569
|
-
type:
|
|
1570
|
-
threadId:
|
|
1571
|
-
providerThreadId:
|
|
1590
|
+
z13.object({
|
|
1591
|
+
type: z13.literal("thread/context/cleared"),
|
|
1592
|
+
threadId: z13.string(),
|
|
1593
|
+
providerThreadId: z13.string()
|
|
1572
1594
|
}),
|
|
1573
|
-
|
|
1574
|
-
type:
|
|
1575
|
-
threadId:
|
|
1576
|
-
providerThreadId:
|
|
1577
|
-
objective:
|
|
1595
|
+
z13.object({
|
|
1596
|
+
type: z13.literal("thread/goal/updated"),
|
|
1597
|
+
threadId: z13.string(),
|
|
1598
|
+
providerThreadId: z13.string(),
|
|
1599
|
+
objective: z13.string(),
|
|
1578
1600
|
status: threadTimelineGoalStatusSchema,
|
|
1579
|
-
tokenBudget:
|
|
1580
|
-
tokensUsed:
|
|
1581
|
-
timeUsedSeconds:
|
|
1601
|
+
tokenBudget: z13.number().nullable(),
|
|
1602
|
+
tokensUsed: z13.number(),
|
|
1603
|
+
timeUsedSeconds: z13.number()
|
|
1582
1604
|
}),
|
|
1583
|
-
|
|
1584
|
-
type:
|
|
1585
|
-
threadId:
|
|
1586
|
-
providerThreadId:
|
|
1605
|
+
z13.object({
|
|
1606
|
+
type: z13.literal("thread/goal/cleared"),
|
|
1607
|
+
threadId: z13.string(),
|
|
1608
|
+
providerThreadId: z13.string()
|
|
1587
1609
|
}),
|
|
1588
|
-
|
|
1589
|
-
type:
|
|
1590
|
-
threadId:
|
|
1591
|
-
providerThreadId:
|
|
1610
|
+
z13.object({
|
|
1611
|
+
type: z13.literal("item/started"),
|
|
1612
|
+
threadId: z13.string(),
|
|
1613
|
+
providerThreadId: z13.string(),
|
|
1592
1614
|
item: threadEventItemSchema
|
|
1593
1615
|
}),
|
|
1594
|
-
|
|
1595
|
-
type:
|
|
1596
|
-
threadId:
|
|
1597
|
-
providerThreadId:
|
|
1616
|
+
z13.object({
|
|
1617
|
+
type: z13.literal("item/completed"),
|
|
1618
|
+
threadId: z13.string(),
|
|
1619
|
+
providerThreadId: z13.string(),
|
|
1598
1620
|
item: threadEventItemSchema
|
|
1599
1621
|
}),
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
type: z12.literal("item/commandExecution/outputDelta"),
|
|
1610
|
-
threadId: z12.string(),
|
|
1611
|
-
providerThreadId: z12.string(),
|
|
1612
|
-
itemId: z12.string(),
|
|
1613
|
-
delta: z12.string(),
|
|
1614
|
-
reset: z12.boolean().optional(),
|
|
1615
|
-
parentToolCallId: z12.string().optional()
|
|
1616
|
-
}),
|
|
1617
|
-
z12.object({
|
|
1618
|
-
type: z12.literal("item/fileChange/outputDelta"),
|
|
1619
|
-
threadId: z12.string(),
|
|
1620
|
-
providerThreadId: z12.string(),
|
|
1621
|
-
itemId: z12.string(),
|
|
1622
|
-
delta: z12.string(),
|
|
1623
|
-
parentToolCallId: z12.string().optional()
|
|
1624
|
-
}),
|
|
1625
|
-
z12.object({
|
|
1626
|
-
type: z12.literal("item/reasoning/summaryTextDelta"),
|
|
1627
|
-
threadId: z12.string(),
|
|
1628
|
-
providerThreadId: z12.string(),
|
|
1629
|
-
itemId: z12.string(),
|
|
1630
|
-
delta: z12.string(),
|
|
1631
|
-
parentToolCallId: z12.string().optional()
|
|
1632
|
-
}),
|
|
1633
|
-
z12.object({
|
|
1634
|
-
type: z12.literal("item/reasoning/textDelta"),
|
|
1635
|
-
threadId: z12.string(),
|
|
1636
|
-
providerThreadId: z12.string(),
|
|
1637
|
-
itemId: z12.string(),
|
|
1638
|
-
delta: z12.string(),
|
|
1639
|
-
parentToolCallId: z12.string().optional()
|
|
1640
|
-
}),
|
|
1641
|
-
z12.object({
|
|
1642
|
-
type: z12.literal("item/plan/delta"),
|
|
1643
|
-
threadId: z12.string(),
|
|
1644
|
-
providerThreadId: z12.string(),
|
|
1645
|
-
itemId: z12.string(),
|
|
1646
|
-
delta: z12.string(),
|
|
1647
|
-
parentToolCallId: z12.string().optional()
|
|
1622
|
+
itemTextDeltaEventSchema("item/agentMessage/delta"),
|
|
1623
|
+
z13.object({
|
|
1624
|
+
type: z13.literal("item/commandExecution/outputDelta"),
|
|
1625
|
+
threadId: z13.string(),
|
|
1626
|
+
providerThreadId: z13.string(),
|
|
1627
|
+
itemId: z13.string(),
|
|
1628
|
+
delta: z13.string(),
|
|
1629
|
+
reset: z13.boolean().optional(),
|
|
1630
|
+
parentToolCallId: z13.string().optional()
|
|
1648
1631
|
}),
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1632
|
+
itemTextDeltaEventSchema("item/fileChange/outputDelta"),
|
|
1633
|
+
itemTextDeltaEventSchema("item/reasoning/summaryTextDelta"),
|
|
1634
|
+
itemTextDeltaEventSchema("item/reasoning/textDelta"),
|
|
1635
|
+
itemTextDeltaEventSchema("item/plan/delta"),
|
|
1636
|
+
z13.object({
|
|
1637
|
+
type: z13.literal("item/mcpToolCall/progress"),
|
|
1638
|
+
threadId: z13.string(),
|
|
1639
|
+
providerThreadId: z13.string(),
|
|
1640
|
+
itemId: z13.string(),
|
|
1641
|
+
message: z13.string().optional(),
|
|
1642
|
+
parentToolCallId: z13.string().optional()
|
|
1656
1643
|
}),
|
|
1657
1644
|
toolCallProgressEventSchema,
|
|
1658
|
-
|
|
1659
|
-
type:
|
|
1660
|
-
threadId:
|
|
1661
|
-
providerThreadId:
|
|
1645
|
+
z13.object({
|
|
1646
|
+
type: z13.literal("item/backgroundTask/progress"),
|
|
1647
|
+
threadId: z13.string(),
|
|
1648
|
+
providerThreadId: z13.string(),
|
|
1662
1649
|
item: threadEventBackgroundTaskItemSchema
|
|
1663
1650
|
}),
|
|
1664
|
-
|
|
1665
|
-
type:
|
|
1666
|
-
threadId:
|
|
1667
|
-
providerThreadId:
|
|
1651
|
+
z13.object({
|
|
1652
|
+
type: z13.literal("item/backgroundTask/completed"),
|
|
1653
|
+
threadId: z13.string(),
|
|
1654
|
+
providerThreadId: z13.string(),
|
|
1668
1655
|
item: threadEventBackgroundTaskItemSchema
|
|
1669
1656
|
}),
|
|
1670
|
-
|
|
1671
|
-
type:
|
|
1672
|
-
threadId:
|
|
1673
|
-
providerThreadId:
|
|
1657
|
+
z13.object({
|
|
1658
|
+
type: z13.literal("item/delegation/progress"),
|
|
1659
|
+
threadId: z13.string(),
|
|
1660
|
+
providerThreadId: z13.string(),
|
|
1674
1661
|
item: threadEventDelegationItemSchema
|
|
1675
1662
|
}),
|
|
1676
|
-
|
|
1677
|
-
type:
|
|
1678
|
-
threadId:
|
|
1679
|
-
providerThreadId:
|
|
1663
|
+
z13.object({
|
|
1664
|
+
type: z13.literal("item/delegation/completed"),
|
|
1665
|
+
threadId: z13.string(),
|
|
1666
|
+
providerThreadId: z13.string(),
|
|
1680
1667
|
item: threadEventDelegationItemSchema
|
|
1681
1668
|
}),
|
|
1682
|
-
|
|
1683
|
-
type:
|
|
1684
|
-
threadId:
|
|
1685
|
-
providerThreadId:
|
|
1669
|
+
z13.object({
|
|
1670
|
+
type: z13.literal("thread/tokenUsage/updated"),
|
|
1671
|
+
threadId: z13.string(),
|
|
1672
|
+
providerThreadId: z13.string(),
|
|
1686
1673
|
tokenUsage: threadEventTokenUsageSchema
|
|
1687
1674
|
}),
|
|
1688
|
-
|
|
1689
|
-
type:
|
|
1690
|
-
threadId:
|
|
1691
|
-
providerThreadId:
|
|
1675
|
+
z13.object({
|
|
1676
|
+
type: z13.literal("thread/contextWindowUsage/updated"),
|
|
1677
|
+
threadId: z13.string(),
|
|
1678
|
+
providerThreadId: z13.string(),
|
|
1692
1679
|
contextWindowUsage: threadEventContextWindowUsageSchema
|
|
1693
1680
|
}),
|
|
1694
|
-
|
|
1695
|
-
type:
|
|
1696
|
-
threadId:
|
|
1697
|
-
providerThreadId:
|
|
1698
|
-
plan:
|
|
1699
|
-
explanation:
|
|
1681
|
+
z13.object({
|
|
1682
|
+
type: z13.literal("turn/plan/updated"),
|
|
1683
|
+
threadId: z13.string(),
|
|
1684
|
+
providerThreadId: z13.string(),
|
|
1685
|
+
plan: z13.array(threadEventPlanStepSchema),
|
|
1686
|
+
explanation: z13.string().optional()
|
|
1700
1687
|
}),
|
|
1701
|
-
|
|
1702
|
-
type:
|
|
1703
|
-
threadId:
|
|
1704
|
-
providerThreadId:
|
|
1705
|
-
diff:
|
|
1688
|
+
z13.object({
|
|
1689
|
+
type: z13.literal("turn/diff/updated"),
|
|
1690
|
+
threadId: z13.string(),
|
|
1691
|
+
providerThreadId: z13.string(),
|
|
1692
|
+
diff: z13.string().optional()
|
|
1706
1693
|
}),
|
|
1707
|
-
|
|
1708
|
-
type:
|
|
1709
|
-
threadId:
|
|
1710
|
-
providerThreadId:
|
|
1711
|
-
message:
|
|
1712
|
-
detail:
|
|
1713
|
-
willRetry:
|
|
1694
|
+
z13.object({
|
|
1695
|
+
type: z13.literal("provider/error"),
|
|
1696
|
+
threadId: z13.string(),
|
|
1697
|
+
providerThreadId: z13.string(),
|
|
1698
|
+
message: z13.string(),
|
|
1699
|
+
detail: z13.string().optional(),
|
|
1700
|
+
willRetry: z13.boolean().optional(),
|
|
1714
1701
|
errorInfo: providerErrorInfoSchema.optional()
|
|
1715
1702
|
}),
|
|
1716
|
-
|
|
1717
|
-
type:
|
|
1718
|
-
threadId:
|
|
1719
|
-
providerThreadId:
|
|
1703
|
+
z13.object({
|
|
1704
|
+
type: z13.literal("provider/rateLimits/updated"),
|
|
1705
|
+
threadId: z13.string(),
|
|
1706
|
+
providerThreadId: z13.string(),
|
|
1720
1707
|
rateLimits: providerRateLimitStateSchema
|
|
1721
1708
|
}),
|
|
1722
|
-
|
|
1723
|
-
type:
|
|
1724
|
-
threadId:
|
|
1725
|
-
providerThreadId:
|
|
1726
|
-
entries:
|
|
1727
|
-
|
|
1728
|
-
name:
|
|
1729
|
-
source:
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1709
|
+
z13.object({
|
|
1710
|
+
type: z13.literal("provider.env-resolved"),
|
|
1711
|
+
threadId: z13.string(),
|
|
1712
|
+
providerThreadId: z13.string(),
|
|
1713
|
+
entries: z13.array(
|
|
1714
|
+
z13.object({
|
|
1715
|
+
name: z13.string(),
|
|
1716
|
+
source: z13.union([
|
|
1717
|
+
z13.literal("shell"),
|
|
1718
|
+
z13.object({ plugin: z13.string() }).strict(),
|
|
1719
|
+
z13.object({ core: z13.enum(["machine-git", "machine-environment"]) }).strict()
|
|
1733
1720
|
]),
|
|
1734
|
-
value:
|
|
1735
|
-
|
|
1736
|
-
|
|
1721
|
+
value: z13.union([
|
|
1722
|
+
z13.string(),
|
|
1723
|
+
z13.object({ masked: z13.literal(true) }).strict()
|
|
1737
1724
|
]),
|
|
1738
|
-
reason:
|
|
1725
|
+
reason: z13.string().optional()
|
|
1739
1726
|
}).strict()
|
|
1740
1727
|
)
|
|
1741
1728
|
}),
|
|
1742
|
-
|
|
1743
|
-
type:
|
|
1744
|
-
threadId:
|
|
1745
|
-
providerThreadId:
|
|
1729
|
+
z13.object({
|
|
1730
|
+
type: z13.literal("thread/extensionState/updated"),
|
|
1731
|
+
threadId: z13.string(),
|
|
1732
|
+
providerThreadId: z13.string(),
|
|
1746
1733
|
kind: extensionKindSchema,
|
|
1747
1734
|
payload: jsonValueSchema
|
|
1748
1735
|
}),
|
|
1749
|
-
|
|
1750
|
-
type:
|
|
1751
|
-
threadId:
|
|
1752
|
-
providerThreadId:
|
|
1736
|
+
z13.object({
|
|
1737
|
+
type: z13.literal("provider/warning"),
|
|
1738
|
+
threadId: z13.string(),
|
|
1739
|
+
providerThreadId: z13.string(),
|
|
1753
1740
|
category: threadEventWarningCategorySchema,
|
|
1754
|
-
summary:
|
|
1755
|
-
details:
|
|
1741
|
+
summary: z13.string().optional(),
|
|
1742
|
+
details: z13.string().optional()
|
|
1756
1743
|
}),
|
|
1757
|
-
|
|
1758
|
-
type:
|
|
1759
|
-
threadId:
|
|
1760
|
-
providerThreadId:
|
|
1761
|
-
originalModel:
|
|
1762
|
-
fallbackModel:
|
|
1763
|
-
reason:
|
|
1764
|
-
message:
|
|
1744
|
+
z13.object({
|
|
1745
|
+
type: z13.literal("provider/modelFallback"),
|
|
1746
|
+
threadId: z13.string(),
|
|
1747
|
+
providerThreadId: z13.string(),
|
|
1748
|
+
originalModel: z13.string().min(1),
|
|
1749
|
+
fallbackModel: z13.string().min(1),
|
|
1750
|
+
reason: z13.enum(["refusal", "provider"]),
|
|
1751
|
+
message: z13.string()
|
|
1765
1752
|
}),
|
|
1766
1753
|
providerUnhandledEventSchema
|
|
1767
1754
|
]);
|
|
1768
|
-
var scopedEventDataSchema =
|
|
1755
|
+
var scopedEventDataSchema = z13.object({
|
|
1769
1756
|
scope: threadEventScopeSchema
|
|
1770
1757
|
});
|
|
1771
1758
|
var providerEventSchema = unscopedProviderEventSchema.and(
|
|
@@ -1774,58 +1761,58 @@ var providerEventSchema = unscopedProviderEventSchema.and(
|
|
|
1774
1761
|
var providerEventTypeValues = unscopedProviderEventSchema.options.map(
|
|
1775
1762
|
(option) => option.shape.type.value
|
|
1776
1763
|
);
|
|
1777
|
-
var unscopedSystemEventSchema =
|
|
1778
|
-
|
|
1779
|
-
type:
|
|
1780
|
-
threadId:
|
|
1764
|
+
var unscopedSystemEventSchema = z13.discriminatedUnion("type", [
|
|
1765
|
+
z13.object({
|
|
1766
|
+
type: z13.literal("client/thread/start"),
|
|
1767
|
+
threadId: z13.string()
|
|
1781
1768
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
1782
|
-
|
|
1783
|
-
type:
|
|
1784
|
-
threadId:
|
|
1769
|
+
z13.object({
|
|
1770
|
+
type: z13.literal("client/turn/requested"),
|
|
1771
|
+
threadId: z13.string()
|
|
1785
1772
|
}).merge(turnRequestEventDataSchema),
|
|
1786
|
-
|
|
1787
|
-
type:
|
|
1788
|
-
threadId:
|
|
1773
|
+
z13.object({
|
|
1774
|
+
type: z13.literal("client/turn/rejected"),
|
|
1775
|
+
threadId: z13.string()
|
|
1789
1776
|
}).merge(turnRequestRejectedEventDataSchema),
|
|
1790
|
-
|
|
1791
|
-
type:
|
|
1792
|
-
threadId:
|
|
1777
|
+
z13.object({
|
|
1778
|
+
type: z13.literal("client/turn/start"),
|
|
1779
|
+
threadId: z13.string()
|
|
1793
1780
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
1794
|
-
|
|
1795
|
-
type:
|
|
1796
|
-
threadId:
|
|
1781
|
+
z13.object({
|
|
1782
|
+
type: z13.literal("system/error"),
|
|
1783
|
+
threadId: z13.string()
|
|
1797
1784
|
}).merge(systemErrorEventDataSchema),
|
|
1798
|
-
|
|
1799
|
-
type:
|
|
1800
|
-
threadId:
|
|
1785
|
+
z13.object({
|
|
1786
|
+
type: z13.literal("system/manager/user_message"),
|
|
1787
|
+
threadId: z13.string()
|
|
1801
1788
|
}).merge(systemLegacyUserMessageEventDataSchema),
|
|
1802
|
-
|
|
1803
|
-
type:
|
|
1804
|
-
threadId:
|
|
1789
|
+
z13.object({
|
|
1790
|
+
type: z13.literal("system/thread/interrupted"),
|
|
1791
|
+
threadId: z13.string()
|
|
1805
1792
|
}).merge(systemThreadInterruptedEventDataSchema),
|
|
1806
|
-
|
|
1807
|
-
type:
|
|
1808
|
-
threadId:
|
|
1793
|
+
z13.object({
|
|
1794
|
+
type: z13.literal("system/operation"),
|
|
1795
|
+
threadId: z13.string()
|
|
1809
1796
|
}).merge(systemOperationEventDataSchema),
|
|
1810
|
-
|
|
1811
|
-
type:
|
|
1812
|
-
threadId:
|
|
1797
|
+
z13.object({
|
|
1798
|
+
type: z13.literal("system/interaction/lifecycle"),
|
|
1799
|
+
threadId: z13.string()
|
|
1813
1800
|
}).merge(systemInteractionLifecycleEventDataSchema),
|
|
1814
|
-
|
|
1815
|
-
type:
|
|
1816
|
-
threadId:
|
|
1801
|
+
z13.object({
|
|
1802
|
+
type: z13.literal("system/permissionGrant/lifecycle"),
|
|
1803
|
+
threadId: z13.string()
|
|
1817
1804
|
}).merge(systemPermissionGrantLifecycleEventDataSchema),
|
|
1818
|
-
|
|
1819
|
-
type:
|
|
1820
|
-
threadId:
|
|
1805
|
+
z13.object({
|
|
1806
|
+
type: z13.literal("system/userQuestion/lifecycle"),
|
|
1807
|
+
threadId: z13.string()
|
|
1821
1808
|
}).merge(systemUserQuestionLifecycleEventDataSchema),
|
|
1822
|
-
|
|
1823
|
-
type:
|
|
1824
|
-
threadId:
|
|
1809
|
+
z13.object({
|
|
1810
|
+
type: z13.literal("system/thread-provisioning"),
|
|
1811
|
+
threadId: z13.string()
|
|
1825
1812
|
}).merge(systemThreadProvisioningEventDataSchema),
|
|
1826
|
-
|
|
1827
|
-
type:
|
|
1828
|
-
threadId:
|
|
1813
|
+
z13.object({
|
|
1814
|
+
type: z13.literal("system/provider-turn-watchdog"),
|
|
1815
|
+
threadId: z13.string()
|
|
1829
1816
|
}).merge(systemProviderTurnWatchdogEventDataSchema)
|
|
1830
1817
|
]);
|
|
1831
1818
|
var systemEventSchema = unscopedSystemEventSchema.and(scopedEventDataSchema);
|
|
@@ -1833,13 +1820,13 @@ var legacyClientRequestKey = ["clientRequest", "Sequence"].join("");
|
|
|
1833
1820
|
function isEventPropertyBag(value) {
|
|
1834
1821
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1835
1822
|
}
|
|
1836
|
-
var rejectLegacyClientRequestSequenceSchema =
|
|
1823
|
+
var rejectLegacyClientRequestSequenceSchema = z13.unknown().superRefine((value, ctx) => {
|
|
1837
1824
|
if (!isEventPropertyBag(value)) {
|
|
1838
1825
|
return;
|
|
1839
1826
|
}
|
|
1840
1827
|
if (Object.hasOwn(value, legacyClientRequestKey)) {
|
|
1841
1828
|
ctx.addIssue({
|
|
1842
|
-
code:
|
|
1829
|
+
code: z13.ZodIssueCode.custom,
|
|
1843
1830
|
message: "legacy request sequence field is no longer accepted",
|
|
1844
1831
|
path: [legacyClientRequestKey]
|
|
1845
1832
|
});
|
|
@@ -1847,21 +1834,21 @@ var rejectLegacyClientRequestSequenceSchema = z12.unknown().superRefine((value,
|
|
|
1847
1834
|
const item = value.item;
|
|
1848
1835
|
if (isEventPropertyBag(item) && item.type === "userMessage" && Object.hasOwn(item, legacyClientRequestKey)) {
|
|
1849
1836
|
ctx.addIssue({
|
|
1850
|
-
code:
|
|
1837
|
+
code: z13.ZodIssueCode.custom,
|
|
1851
1838
|
message: "legacy user-message request sequence field is no longer accepted",
|
|
1852
1839
|
path: ["item", legacyClientRequestKey]
|
|
1853
1840
|
});
|
|
1854
1841
|
}
|
|
1855
1842
|
});
|
|
1856
1843
|
var threadEventSchema = rejectLegacyClientRequestSequenceSchema.pipe(
|
|
1857
|
-
|
|
1844
|
+
z13.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
|
|
1858
1845
|
const result2 = validateThreadEventScope({
|
|
1859
1846
|
type: event.type,
|
|
1860
1847
|
scope: event.scope
|
|
1861
1848
|
});
|
|
1862
1849
|
if (!result2.valid) {
|
|
1863
1850
|
ctx.addIssue({
|
|
1864
|
-
code:
|
|
1851
|
+
code: z13.ZodIssueCode.custom,
|
|
1865
1852
|
message: result2.message ?? "Invalid thread event scope",
|
|
1866
1853
|
path: ["scope"]
|
|
1867
1854
|
});
|
|
@@ -1887,7 +1874,7 @@ var threadEventTypeValues = [
|
|
|
1887
1874
|
...systemEventTypeValues
|
|
1888
1875
|
];
|
|
1889
1876
|
var threadEventTypeSet = new Set(threadEventTypeValues);
|
|
1890
|
-
var threadEventTypeSchema =
|
|
1877
|
+
var threadEventTypeSchema = z13.string().refine(
|
|
1891
1878
|
(value) => threadEventTypeSet.has(value),
|
|
1892
1879
|
"Invalid thread event type"
|
|
1893
1880
|
);
|
|
@@ -1910,95 +1897,95 @@ function parseNamespacedGlyph(glyph) {
|
|
|
1910
1897
|
}
|
|
1911
1898
|
|
|
1912
1899
|
// ../domain/src/provider-fork.ts
|
|
1913
|
-
import { z as
|
|
1900
|
+
import { z as z14 } from "zod";
|
|
1914
1901
|
var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
|
|
1915
|
-
var providerForkSchema =
|
|
1902
|
+
var providerForkSchema = z14.enum(PROVIDER_FORK_VALUES);
|
|
1916
1903
|
|
|
1917
1904
|
// ../domain/src/provider-types.ts
|
|
1918
|
-
import { z as
|
|
1919
|
-
var modelReasoningEffortSchema =
|
|
1905
|
+
import { z as z15 } from "zod";
|
|
1906
|
+
var modelReasoningEffortSchema = z15.object({
|
|
1920
1907
|
reasoningEffort: reasoningLevelSchema,
|
|
1921
|
-
description:
|
|
1922
|
-
});
|
|
1923
|
-
var availableModelSchema =
|
|
1924
|
-
id:
|
|
1925
|
-
model:
|
|
1926
|
-
displayName:
|
|
1927
|
-
routeProviderId:
|
|
1928
|
-
description:
|
|
1929
|
-
supportedReasoningEfforts:
|
|
1908
|
+
description: z15.string()
|
|
1909
|
+
});
|
|
1910
|
+
var availableModelSchema = z15.object({
|
|
1911
|
+
id: z15.string(),
|
|
1912
|
+
model: z15.string(),
|
|
1913
|
+
displayName: z15.string(),
|
|
1914
|
+
routeProviderId: z15.string().min(1).optional(),
|
|
1915
|
+
description: z15.string(),
|
|
1916
|
+
supportedReasoningEfforts: z15.array(modelReasoningEffortSchema),
|
|
1930
1917
|
defaultReasoningEffort: reasoningLevelSchema,
|
|
1931
|
-
isDefault:
|
|
1932
|
-
});
|
|
1933
|
-
var providerModelCatalogScopeSchema =
|
|
1934
|
-
var providerCapabilitiesSchema =
|
|
1935
|
-
supportsThreadArchive:
|
|
1936
|
-
supportsThreadRename:
|
|
1937
|
-
supportsServiceTier:
|
|
1938
|
-
supportsNativeUserQuestion:
|
|
1939
|
-
supportsFork:
|
|
1940
|
-
supportsSessionRewind:
|
|
1941
|
-
permissionModes:
|
|
1918
|
+
isDefault: z15.boolean()
|
|
1919
|
+
});
|
|
1920
|
+
var providerModelCatalogScopeSchema = z15.enum(["host", "workspace"]);
|
|
1921
|
+
var providerCapabilitiesSchema = z15.object({
|
|
1922
|
+
supportsThreadArchive: z15.boolean(),
|
|
1923
|
+
supportsThreadRename: z15.boolean(),
|
|
1924
|
+
supportsServiceTier: z15.boolean(),
|
|
1925
|
+
supportsNativeUserQuestion: z15.boolean(),
|
|
1926
|
+
supportsFork: z15.boolean(),
|
|
1927
|
+
supportsSessionRewind: z15.boolean(),
|
|
1928
|
+
permissionModes: z15.array(permissionModeSchema).min(1),
|
|
1942
1929
|
modelCatalogScope: providerModelCatalogScopeSchema
|
|
1943
1930
|
});
|
|
1944
|
-
var providerComposerCommandSchema =
|
|
1931
|
+
var providerComposerCommandSchema = z15.object({
|
|
1945
1932
|
trigger: promptMentionCommandTriggerSchema,
|
|
1946
|
-
name:
|
|
1947
|
-
trailingText:
|
|
1933
|
+
name: z15.string().min(1).regex(/^[^\s/$]+$/u),
|
|
1934
|
+
trailingText: z15.string().regex(/^\s*$/u)
|
|
1948
1935
|
});
|
|
1949
|
-
var providerComposerActionSchema =
|
|
1950
|
-
|
|
1951
|
-
kind:
|
|
1936
|
+
var providerComposerActionSchema = z15.discriminatedUnion("kind", [
|
|
1937
|
+
z15.object({
|
|
1938
|
+
kind: z15.literal("skills"),
|
|
1952
1939
|
trigger: promptMentionCommandTriggerSchema
|
|
1953
1940
|
}),
|
|
1954
|
-
|
|
1955
|
-
kind:
|
|
1941
|
+
z15.object({
|
|
1942
|
+
kind: z15.literal("plan"),
|
|
1956
1943
|
command: providerComposerCommandSchema
|
|
1957
1944
|
}),
|
|
1958
|
-
|
|
1959
|
-
kind:
|
|
1945
|
+
z15.object({
|
|
1946
|
+
kind: z15.literal("goal"),
|
|
1960
1947
|
command: providerComposerCommandSchema
|
|
1961
1948
|
})
|
|
1962
1949
|
]);
|
|
1963
|
-
var providerStringsSchema =
|
|
1964
|
-
signInHint:
|
|
1965
|
-
expiredHint:
|
|
1966
|
-
installUrl:
|
|
1967
|
-
brandPrefix:
|
|
1968
|
-
planModeCopy:
|
|
1969
|
-
iconTint:
|
|
1970
|
-
});
|
|
1971
|
-
var providerOptionDescriptorSchema =
|
|
1972
|
-
id:
|
|
1973
|
-
label:
|
|
1974
|
-
description:
|
|
1975
|
-
});
|
|
1976
|
-
var providerExtensionKindInfoSchema =
|
|
1977
|
-
item:
|
|
1978
|
-
state:
|
|
1979
|
-
});
|
|
1980
|
-
var providerExtensionKindsSchema =
|
|
1950
|
+
var providerStringsSchema = z15.object({
|
|
1951
|
+
signInHint: z15.string().min(1),
|
|
1952
|
+
expiredHint: z15.string().min(1),
|
|
1953
|
+
installUrl: z15.string().min(1),
|
|
1954
|
+
brandPrefix: z15.string().min(1).optional(),
|
|
1955
|
+
planModeCopy: z15.string().min(1).optional(),
|
|
1956
|
+
iconTint: z15.object({ light: z15.string().min(1), dark: z15.string().min(1) }).optional()
|
|
1957
|
+
});
|
|
1958
|
+
var providerOptionDescriptorSchema = z15.object({
|
|
1959
|
+
id: z15.string().min(1),
|
|
1960
|
+
label: z15.string().min(1),
|
|
1961
|
+
description: z15.string().min(1).optional()
|
|
1962
|
+
});
|
|
1963
|
+
var providerExtensionKindInfoSchema = z15.object({
|
|
1964
|
+
item: z15.boolean(),
|
|
1965
|
+
state: z15.boolean()
|
|
1966
|
+
});
|
|
1967
|
+
var providerExtensionKindsSchema = z15.record(
|
|
1981
1968
|
extensionKindSchema,
|
|
1982
1969
|
providerExtensionKindInfoSchema
|
|
1983
1970
|
);
|
|
1984
|
-
var providerInfoSchema =
|
|
1985
|
-
id:
|
|
1986
|
-
pluginId:
|
|
1987
|
-
displayName:
|
|
1988
|
-
family:
|
|
1989
|
-
icon:
|
|
1990
|
-
logoUrl:
|
|
1991
|
-
maintenance:
|
|
1992
|
-
health:
|
|
1993
|
-
usage:
|
|
1994
|
-
installation:
|
|
1971
|
+
var providerInfoSchema = z15.object({
|
|
1972
|
+
id: z15.string(),
|
|
1973
|
+
pluginId: z15.string().min(1),
|
|
1974
|
+
displayName: z15.string(),
|
|
1975
|
+
family: z15.string().min(1).optional(),
|
|
1976
|
+
icon: z15.object({ glyph: z15.string().min(1) }).optional(),
|
|
1977
|
+
logoUrl: z15.string().min(1).nullable(),
|
|
1978
|
+
maintenance: z15.object({
|
|
1979
|
+
health: z15.boolean(),
|
|
1980
|
+
usage: z15.boolean(),
|
|
1981
|
+
installation: z15.boolean()
|
|
1995
1982
|
}),
|
|
1996
1983
|
capabilities: providerCapabilitiesSchema,
|
|
1997
|
-
composerActions:
|
|
1998
|
-
available:
|
|
1984
|
+
composerActions: z15.array(providerComposerActionSchema),
|
|
1985
|
+
available: z15.boolean(),
|
|
1999
1986
|
strings: providerStringsSchema.optional(),
|
|
2000
|
-
serviceTiers:
|
|
2001
|
-
reasoningLevels:
|
|
1987
|
+
serviceTiers: z15.array(providerOptionDescriptorSchema).optional(),
|
|
1988
|
+
reasoningLevels: z15.array(providerOptionDescriptorSchema).optional(),
|
|
2002
1989
|
extensionKinds: providerExtensionKindsSchema.optional()
|
|
2003
1990
|
});
|
|
2004
1991
|
var providerRecoveryKindValues = [
|
|
@@ -2008,151 +1995,151 @@ var providerRecoveryKindValues = [
|
|
|
2008
1995
|
"staleTurn",
|
|
2009
1996
|
"rateLimited"
|
|
2010
1997
|
];
|
|
2011
|
-
var providerRecoveryKindSchema =
|
|
2012
|
-
var toolCallOutputItemSchema =
|
|
2013
|
-
|
|
2014
|
-
type:
|
|
2015
|
-
text:
|
|
1998
|
+
var providerRecoveryKindSchema = z15.enum(providerRecoveryKindValues);
|
|
1999
|
+
var toolCallOutputItemSchema = z15.discriminatedUnion("type", [
|
|
2000
|
+
z15.object({
|
|
2001
|
+
type: z15.literal("inputText"),
|
|
2002
|
+
text: z15.string()
|
|
2016
2003
|
}),
|
|
2017
|
-
|
|
2018
|
-
type:
|
|
2019
|
-
imageUrl:
|
|
2004
|
+
z15.object({
|
|
2005
|
+
type: z15.literal("inputImage"),
|
|
2006
|
+
imageUrl: z15.string()
|
|
2020
2007
|
})
|
|
2021
2008
|
]);
|
|
2022
|
-
var toolCallRequestSchema =
|
|
2023
|
-
requestId:
|
|
2024
|
-
threadId:
|
|
2025
|
-
providerThreadId:
|
|
2026
|
-
turnId:
|
|
2027
|
-
callId:
|
|
2028
|
-
tool:
|
|
2029
|
-
arguments:
|
|
2030
|
-
});
|
|
2031
|
-
var toolCallResponseSchema =
|
|
2032
|
-
contentItems:
|
|
2033
|
-
success:
|
|
2034
|
-
});
|
|
2035
|
-
var dynamicToolSchema =
|
|
2036
|
-
name:
|
|
2037
|
-
description:
|
|
2038
|
-
inputSchema:
|
|
2009
|
+
var toolCallRequestSchema = z15.object({
|
|
2010
|
+
requestId: z15.union([z15.string().min(1), z15.number()]),
|
|
2011
|
+
threadId: z15.string().min(1),
|
|
2012
|
+
providerThreadId: z15.string().min(1),
|
|
2013
|
+
turnId: z15.string().min(1),
|
|
2014
|
+
callId: z15.string().min(1),
|
|
2015
|
+
tool: z15.string().min(1),
|
|
2016
|
+
arguments: z15.unknown().optional()
|
|
2017
|
+
});
|
|
2018
|
+
var toolCallResponseSchema = z15.object({
|
|
2019
|
+
contentItems: z15.array(toolCallOutputItemSchema),
|
|
2020
|
+
success: z15.boolean()
|
|
2021
|
+
});
|
|
2022
|
+
var dynamicToolSchema = z15.object({
|
|
2023
|
+
name: z15.string(),
|
|
2024
|
+
description: z15.string(),
|
|
2025
|
+
inputSchema: z15.unknown(),
|
|
2039
2026
|
presentation: threadEventItemPresentationSchema.optional()
|
|
2040
2027
|
});
|
|
2041
2028
|
|
|
2042
2029
|
// ../provider-bridge-protocol/src/thread-delta.ts
|
|
2043
|
-
import { z as
|
|
2030
|
+
import { z as z16 } from "zod";
|
|
2044
2031
|
var THREAD_DELTA_NOTIFICATION_METHOD = "thread/delta";
|
|
2045
2032
|
var deltaPresentationSchema = threadEventItemPresentationSchema;
|
|
2046
2033
|
var THREAD_DELTA_KEY_SEPARATOR = "";
|
|
2047
|
-
var deltaKeyPartSchema =
|
|
2034
|
+
var deltaKeyPartSchema = z16.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
|
|
2048
2035
|
message: "provider keys must not contain the internal key separator (\\u001f)"
|
|
2049
2036
|
});
|
|
2050
|
-
var deltaItemKeySchema =
|
|
2037
|
+
var deltaItemKeySchema = z16.object({
|
|
2051
2038
|
providerItemId: deltaKeyPartSchema.optional(),
|
|
2052
2039
|
channel: deltaKeyPartSchema.optional(),
|
|
2053
2040
|
parentRef: deltaKeyPartSchema.optional()
|
|
2054
2041
|
});
|
|
2055
2042
|
var providerTurnIdSchema = deltaKeyPartSchema;
|
|
2056
|
-
var deltaFileChangeSchema =
|
|
2057
|
-
path:
|
|
2058
|
-
kind:
|
|
2059
|
-
movePath:
|
|
2060
|
-
diff:
|
|
2061
|
-
oldText:
|
|
2062
|
-
newText:
|
|
2063
|
-
});
|
|
2064
|
-
var deltaBackgroundTaskShapeSchema =
|
|
2065
|
-
type:
|
|
2066
|
-
familyId:
|
|
2067
|
-
taskType:
|
|
2068
|
-
description:
|
|
2043
|
+
var deltaFileChangeSchema = z16.object({
|
|
2044
|
+
path: z16.string(),
|
|
2045
|
+
kind: z16.enum(["add", "update", "delete"]),
|
|
2046
|
+
movePath: z16.string().optional(),
|
|
2047
|
+
diff: z16.string().optional(),
|
|
2048
|
+
oldText: z16.string().optional(),
|
|
2049
|
+
newText: z16.string().optional()
|
|
2050
|
+
});
|
|
2051
|
+
var deltaBackgroundTaskShapeSchema = z16.object({
|
|
2052
|
+
type: z16.literal("backgroundTask"),
|
|
2053
|
+
familyId: z16.string().min(1),
|
|
2054
|
+
taskType: z16.string(),
|
|
2055
|
+
description: z16.string(),
|
|
2069
2056
|
status: threadEventItemStatusSchema,
|
|
2070
2057
|
taskStatus: backgroundTaskStatusSchema,
|
|
2071
|
-
skipTranscript:
|
|
2072
|
-
workflowName:
|
|
2058
|
+
skipTranscript: z16.boolean(),
|
|
2059
|
+
workflowName: z16.string().optional(),
|
|
2073
2060
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
2074
2061
|
usage: backgroundTaskUsageSchema.optional(),
|
|
2075
|
-
summary:
|
|
2076
|
-
error:
|
|
2077
|
-
outputFile:
|
|
2062
|
+
summary: z16.string().optional(),
|
|
2063
|
+
error: z16.string().optional(),
|
|
2064
|
+
outputFile: z16.string().optional()
|
|
2078
2065
|
});
|
|
2079
|
-
var deltaFileReadShapeSchema =
|
|
2080
|
-
type:
|
|
2081
|
-
path:
|
|
2082
|
-
cmd:
|
|
2066
|
+
var deltaFileReadShapeSchema = z16.object({
|
|
2067
|
+
type: z16.literal("fileRead"),
|
|
2068
|
+
path: z16.string(),
|
|
2069
|
+
cmd: z16.string().optional()
|
|
2083
2070
|
});
|
|
2084
|
-
var deltaSearchShapeSchema =
|
|
2085
|
-
type:
|
|
2071
|
+
var deltaSearchShapeSchema = z16.object({
|
|
2072
|
+
type: z16.literal("search"),
|
|
2086
2073
|
mode: threadEventSearchModeSchema,
|
|
2087
|
-
query:
|
|
2088
|
-
path:
|
|
2089
|
-
cmd:
|
|
2074
|
+
query: z16.string(),
|
|
2075
|
+
path: z16.string().optional(),
|
|
2076
|
+
cmd: z16.string().optional()
|
|
2090
2077
|
});
|
|
2091
|
-
var deltaDelegationShapeSchema =
|
|
2092
|
-
type:
|
|
2078
|
+
var deltaDelegationShapeSchema = z16.object({
|
|
2079
|
+
type: z16.literal("delegation"),
|
|
2093
2080
|
childRef: deltaKeyPartSchema,
|
|
2094
|
-
label:
|
|
2095
|
-
background:
|
|
2096
|
-
summary:
|
|
2081
|
+
label: z16.string(),
|
|
2082
|
+
background: z16.boolean(),
|
|
2083
|
+
summary: z16.string().optional()
|
|
2097
2084
|
});
|
|
2098
|
-
var deltaPlanStepsShapeSchema =
|
|
2099
|
-
type:
|
|
2100
|
-
steps:
|
|
2101
|
-
explanation:
|
|
2085
|
+
var deltaPlanStepsShapeSchema = z16.object({
|
|
2086
|
+
type: z16.literal("planSteps"),
|
|
2087
|
+
steps: z16.array(threadEventPlanStepSchema),
|
|
2088
|
+
explanation: z16.string().optional()
|
|
2102
2089
|
});
|
|
2103
|
-
var deltaExtensionShapeSchema =
|
|
2104
|
-
type:
|
|
2090
|
+
var deltaExtensionShapeSchema = z16.object({
|
|
2091
|
+
type: z16.literal("extension"),
|
|
2105
2092
|
kind: extensionKindSchema,
|
|
2106
2093
|
payload: jsonValueSchema
|
|
2107
2094
|
});
|
|
2108
|
-
var deltaItemShapeSchema =
|
|
2109
|
-
|
|
2110
|
-
type:
|
|
2111
|
-
command:
|
|
2112
|
-
cwd:
|
|
2113
|
-
aggregatedOutput:
|
|
2114
|
-
exitCode:
|
|
2115
|
-
durationMs:
|
|
2095
|
+
var deltaItemShapeSchema = z16.discriminatedUnion("type", [
|
|
2096
|
+
z16.object({
|
|
2097
|
+
type: z16.literal("command"),
|
|
2098
|
+
command: z16.string(),
|
|
2099
|
+
cwd: z16.string(),
|
|
2100
|
+
aggregatedOutput: z16.string().optional(),
|
|
2101
|
+
exitCode: z16.number().optional(),
|
|
2102
|
+
durationMs: z16.number().optional()
|
|
2116
2103
|
}),
|
|
2117
|
-
|
|
2118
|
-
type:
|
|
2119
|
-
changes:
|
|
2104
|
+
z16.object({
|
|
2105
|
+
type: z16.literal("fileChange"),
|
|
2106
|
+
changes: z16.array(deltaFileChangeSchema)
|
|
2120
2107
|
}),
|
|
2121
|
-
|
|
2122
|
-
type:
|
|
2123
|
-
tool:
|
|
2124
|
-
server:
|
|
2125
|
-
args:
|
|
2126
|
-
result:
|
|
2127
|
-
error:
|
|
2128
|
-
durationMs:
|
|
2108
|
+
z16.object({
|
|
2109
|
+
type: z16.literal("tool"),
|
|
2110
|
+
tool: z16.string(),
|
|
2111
|
+
server: z16.string().optional(),
|
|
2112
|
+
args: z16.unknown().optional(),
|
|
2113
|
+
result: z16.unknown().optional(),
|
|
2114
|
+
error: z16.string().optional(),
|
|
2115
|
+
durationMs: z16.number().optional()
|
|
2129
2116
|
}),
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
type:
|
|
2134
|
-
summary:
|
|
2135
|
-
content:
|
|
2117
|
+
z16.object({ type: z16.literal("compaction") }),
|
|
2118
|
+
z16.object({ type: z16.literal("agentMessage"), text: z16.string() }),
|
|
2119
|
+
z16.object({
|
|
2120
|
+
type: z16.literal("reasoning"),
|
|
2121
|
+
summary: z16.array(z16.string()),
|
|
2122
|
+
content: z16.array(z16.string())
|
|
2136
2123
|
}),
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
type:
|
|
2140
|
-
queries:
|
|
2124
|
+
z16.object({ type: z16.literal("plan"), text: z16.string() }),
|
|
2125
|
+
z16.object({
|
|
2126
|
+
type: z16.literal("webSearch"),
|
|
2127
|
+
queries: z16.array(z16.string()).min(1)
|
|
2141
2128
|
}),
|
|
2142
|
-
|
|
2143
|
-
type:
|
|
2144
|
-
url:
|
|
2145
|
-
prompt:
|
|
2146
|
-
pattern:
|
|
2129
|
+
z16.object({
|
|
2130
|
+
type: z16.literal("webFetch"),
|
|
2131
|
+
url: z16.string(),
|
|
2132
|
+
prompt: z16.string().nullable().optional(),
|
|
2133
|
+
pattern: z16.string().nullable()
|
|
2147
2134
|
}),
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
type:
|
|
2151
|
-
prompt:
|
|
2152
|
-
path:
|
|
2153
|
-
result:
|
|
2154
|
-
error:
|
|
2155
|
-
transparentBackground:
|
|
2135
|
+
z16.object({ type: z16.literal("imageView"), path: z16.string() }),
|
|
2136
|
+
z16.object({
|
|
2137
|
+
type: z16.literal("imageGeneration"),
|
|
2138
|
+
prompt: z16.string().nullable(),
|
|
2139
|
+
path: z16.string().nullable(),
|
|
2140
|
+
result: z16.string().optional(),
|
|
2141
|
+
error: z16.string().nullable(),
|
|
2142
|
+
transparentBackground: z16.boolean()
|
|
2156
2143
|
}),
|
|
2157
2144
|
deltaBackgroundTaskShapeSchema,
|
|
2158
2145
|
deltaFileReadShapeSchema,
|
|
@@ -2161,22 +2148,22 @@ var deltaItemShapeSchema = z15.discriminatedUnion("type", [
|
|
|
2161
2148
|
deltaPlanStepsShapeSchema,
|
|
2162
2149
|
deltaExtensionShapeSchema
|
|
2163
2150
|
]);
|
|
2164
|
-
var deltaProgressSnapshotSchema =
|
|
2151
|
+
var deltaProgressSnapshotSchema = z16.discriminatedUnion("type", [
|
|
2165
2152
|
deltaBackgroundTaskShapeSchema,
|
|
2166
2153
|
deltaDelegationShapeSchema
|
|
2167
2154
|
]);
|
|
2168
|
-
var deltaTextChannelSchema =
|
|
2155
|
+
var deltaTextChannelSchema = z16.enum([
|
|
2169
2156
|
"agentMessage",
|
|
2170
2157
|
"reasoningSummary",
|
|
2171
2158
|
"reasoningText",
|
|
2172
2159
|
"plan"
|
|
2173
2160
|
]);
|
|
2174
|
-
var deltaOutputChannelSchema =
|
|
2175
|
-
var deltaErrorSchema =
|
|
2176
|
-
var deltaAttachSchema =
|
|
2177
|
-
var deltaNoTurnFallbackSchema =
|
|
2161
|
+
var deltaOutputChannelSchema = z16.enum(["command", "fileChange"]);
|
|
2162
|
+
var deltaErrorSchema = z16.object({ message: z16.string() });
|
|
2163
|
+
var deltaAttachSchema = z16.enum(["open", "currentOrLast"]);
|
|
2164
|
+
var deltaNoTurnFallbackSchema = z16.object({
|
|
2178
2165
|
raw: providerRawEventSchema,
|
|
2179
|
-
rawType:
|
|
2166
|
+
rawType: z16.string()
|
|
2180
2167
|
});
|
|
2181
2168
|
function requireExtensionPresentation(delta, ctx) {
|
|
2182
2169
|
if (delta.item.type === "extension" && delta.presentation === void 0) {
|
|
@@ -2187,32 +2174,32 @@ function requireExtensionPresentation(delta, ctx) {
|
|
|
2187
2174
|
});
|
|
2188
2175
|
}
|
|
2189
2176
|
}
|
|
2190
|
-
var threadDeltaSchema =
|
|
2191
|
-
|
|
2192
|
-
kind:
|
|
2177
|
+
var threadDeltaSchema = z16.discriminatedUnion("kind", [
|
|
2178
|
+
z16.object({
|
|
2179
|
+
kind: z16.literal("input.accepted"),
|
|
2193
2180
|
clientRequestId: clientTurnRequestIdSchema,
|
|
2194
2181
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2195
2182
|
}),
|
|
2196
|
-
|
|
2197
|
-
kind:
|
|
2198
|
-
text:
|
|
2183
|
+
z16.object({
|
|
2184
|
+
kind: z16.literal("input.provider"),
|
|
2185
|
+
text: z16.string().min(1),
|
|
2199
2186
|
parentRef: deltaKeyPartSchema.optional()
|
|
2200
2187
|
}),
|
|
2201
|
-
|
|
2202
|
-
kind:
|
|
2188
|
+
z16.object({
|
|
2189
|
+
kind: z16.literal("turn.open"),
|
|
2203
2190
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2204
2191
|
parentRef: deltaKeyPartSchema.optional()
|
|
2205
2192
|
}),
|
|
2206
|
-
|
|
2207
|
-
kind:
|
|
2193
|
+
z16.object({
|
|
2194
|
+
kind: z16.literal("turn.boundary"),
|
|
2208
2195
|
status: threadEventTurnStatusSchema,
|
|
2209
2196
|
error: deltaErrorSchema.optional(),
|
|
2210
|
-
providerCheckpointId:
|
|
2211
|
-
claimIfIdle:
|
|
2197
|
+
providerCheckpointId: z16.string().min(1).optional(),
|
|
2198
|
+
claimIfIdle: z16.boolean().optional(),
|
|
2212
2199
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2213
2200
|
}),
|
|
2214
|
-
|
|
2215
|
-
kind:
|
|
2201
|
+
z16.object({
|
|
2202
|
+
kind: z16.literal("item.open"),
|
|
2216
2203
|
key: deltaItemKeySchema,
|
|
2217
2204
|
item: deltaItemShapeSchema,
|
|
2218
2205
|
presentation: deltaPresentationSchema.optional(),
|
|
@@ -2220,139 +2207,140 @@ var threadDeltaSchema = z15.discriminatedUnion("kind", [
|
|
|
2220
2207
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2221
2208
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2222
2209
|
}).superRefine(requireExtensionPresentation),
|
|
2223
|
-
|
|
2224
|
-
kind:
|
|
2210
|
+
z16.object({
|
|
2211
|
+
kind: z16.literal("item.close"),
|
|
2225
2212
|
key: deltaItemKeySchema,
|
|
2226
2213
|
status: threadEventItemStatusSchema,
|
|
2227
|
-
resultText:
|
|
2228
|
-
exitCode:
|
|
2229
|
-
aggregatedOutput:
|
|
2230
|
-
approvalStatus:
|
|
2214
|
+
resultText: z16.string().optional(),
|
|
2215
|
+
exitCode: z16.number().optional(),
|
|
2216
|
+
aggregatedOutput: z16.string().optional(),
|
|
2217
|
+
approvalStatus: z16.literal("denied").optional(),
|
|
2231
2218
|
item: deltaItemShapeSchema,
|
|
2232
2219
|
presentation: deltaPresentationSchema.optional(),
|
|
2233
2220
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2234
2221
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2235
2222
|
}).superRefine(requireExtensionPresentation),
|
|
2236
|
-
|
|
2237
|
-
kind:
|
|
2223
|
+
z16.object({
|
|
2224
|
+
kind: z16.literal("item.progress"),
|
|
2238
2225
|
key: deltaItemKeySchema,
|
|
2239
|
-
message:
|
|
2226
|
+
message: z16.string().optional(),
|
|
2240
2227
|
snapshot: deltaProgressSnapshotSchema.optional(),
|
|
2241
|
-
flush:
|
|
2228
|
+
flush: z16.boolean().optional(),
|
|
2242
2229
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2243
2230
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2244
2231
|
}),
|
|
2245
|
-
|
|
2246
|
-
kind:
|
|
2232
|
+
z16.object({
|
|
2233
|
+
kind: z16.literal("item.textDelta"),
|
|
2247
2234
|
key: deltaItemKeySchema,
|
|
2248
2235
|
channel: deltaTextChannelSchema,
|
|
2249
|
-
text:
|
|
2236
|
+
text: z16.string(),
|
|
2250
2237
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2251
2238
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2252
2239
|
}),
|
|
2253
|
-
|
|
2254
|
-
kind:
|
|
2240
|
+
z16.object({
|
|
2241
|
+
kind: z16.literal("item.textClose"),
|
|
2255
2242
|
key: deltaItemKeySchema,
|
|
2256
2243
|
channel: deltaTextChannelSchema,
|
|
2257
|
-
text:
|
|
2244
|
+
text: z16.string().optional(),
|
|
2258
2245
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2259
2246
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2260
2247
|
}),
|
|
2261
|
-
|
|
2262
|
-
kind:
|
|
2248
|
+
z16.object({
|
|
2249
|
+
kind: z16.literal("item.outputDelta"),
|
|
2263
2250
|
key: deltaItemKeySchema,
|
|
2264
2251
|
channel: deltaOutputChannelSchema,
|
|
2265
|
-
text:
|
|
2252
|
+
text: z16.string(),
|
|
2266
2253
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2267
2254
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2268
2255
|
}),
|
|
2269
|
-
|
|
2270
|
-
kind:
|
|
2256
|
+
z16.object({
|
|
2257
|
+
kind: z16.literal("command.outputSnapshot"),
|
|
2271
2258
|
key: deltaItemKeySchema,
|
|
2272
|
-
text:
|
|
2259
|
+
text: z16.string(),
|
|
2273
2260
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2274
2261
|
}),
|
|
2275
|
-
|
|
2276
|
-
kind:
|
|
2262
|
+
z16.object({
|
|
2263
|
+
kind: z16.literal("usage"),
|
|
2277
2264
|
total: threadEventTokenUsageBreakdownSchema,
|
|
2278
2265
|
last: threadEventTokenUsageBreakdownSchema,
|
|
2279
|
-
modelContextWindow:
|
|
2266
|
+
modelContextWindow: z16.number().nullable(),
|
|
2280
2267
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2281
2268
|
}),
|
|
2282
|
-
|
|
2283
|
-
kind:
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2269
|
+
z16.object({
|
|
2270
|
+
kind: z16.literal("contextWindow"),
|
|
2271
|
+
snapshot: contextSnapshotSchema.optional(),
|
|
2272
|
+
used: z16.number().nullable(),
|
|
2273
|
+
size: z16.number().nullable().optional(),
|
|
2274
|
+
estimated: z16.boolean(),
|
|
2287
2275
|
attach: deltaAttachSchema,
|
|
2288
2276
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2289
2277
|
}),
|
|
2290
|
-
|
|
2291
|
-
kind:
|
|
2278
|
+
z16.object({
|
|
2279
|
+
kind: z16.literal("context.compacted"),
|
|
2292
2280
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2293
2281
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2294
2282
|
}),
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
kind:
|
|
2298
|
-
diff:
|
|
2283
|
+
z16.object({ kind: z16.literal("context.cleared") }),
|
|
2284
|
+
z16.object({
|
|
2285
|
+
kind: z16.literal("turn.diff"),
|
|
2286
|
+
diff: z16.string(),
|
|
2299
2287
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2300
2288
|
}),
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
kind:
|
|
2304
|
-
providerThreadId:
|
|
2289
|
+
z16.object({ kind: z16.literal("thread.started") }),
|
|
2290
|
+
z16.object({
|
|
2291
|
+
kind: z16.literal("thread.identity"),
|
|
2292
|
+
providerThreadId: z16.string().min(1)
|
|
2305
2293
|
}),
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
kind:
|
|
2294
|
+
z16.object({ kind: z16.literal("thread.name"), name: z16.string().min(1) }),
|
|
2295
|
+
z16.object({
|
|
2296
|
+
kind: z16.literal("extension.state"),
|
|
2309
2297
|
extensionKind: extensionKindSchema,
|
|
2310
2298
|
payload: jsonValueSchema
|
|
2311
2299
|
}),
|
|
2312
|
-
|
|
2313
|
-
kind:
|
|
2300
|
+
z16.object({
|
|
2301
|
+
kind: z16.literal("provider.rateLimits"),
|
|
2314
2302
|
rateLimits: providerRateLimitStateSchema
|
|
2315
2303
|
}),
|
|
2316
|
-
|
|
2317
|
-
kind:
|
|
2318
|
-
message:
|
|
2319
|
-
detail:
|
|
2320
|
-
willRetry:
|
|
2304
|
+
z16.object({
|
|
2305
|
+
kind: z16.literal("provider.error"),
|
|
2306
|
+
message: z16.string(),
|
|
2307
|
+
detail: z16.string().optional(),
|
|
2308
|
+
willRetry: z16.boolean().optional(),
|
|
2321
2309
|
category: providerErrorCategorySchema.optional(),
|
|
2322
2310
|
errorInfo: providerErrorInfoSchema.optional(),
|
|
2323
|
-
settlesTurn:
|
|
2311
|
+
settlesTurn: z16.boolean().optional(),
|
|
2324
2312
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2325
|
-
threadScoped:
|
|
2313
|
+
threadScoped: z16.boolean().optional()
|
|
2326
2314
|
}),
|
|
2327
|
-
|
|
2328
|
-
kind:
|
|
2329
|
-
originalModel:
|
|
2330
|
-
fallbackModel:
|
|
2331
|
-
reason:
|
|
2332
|
-
message:
|
|
2315
|
+
z16.object({
|
|
2316
|
+
kind: z16.literal("provider.modelFallback"),
|
|
2317
|
+
originalModel: z16.string().min(1),
|
|
2318
|
+
fallbackModel: z16.string().min(1),
|
|
2319
|
+
reason: z16.enum(["refusal", "provider"]),
|
|
2320
|
+
message: z16.string()
|
|
2333
2321
|
}),
|
|
2334
|
-
|
|
2335
|
-
kind:
|
|
2336
|
-
summary:
|
|
2337
|
-
details:
|
|
2322
|
+
z16.object({
|
|
2323
|
+
kind: z16.literal("provider.warning"),
|
|
2324
|
+
summary: z16.string().optional(),
|
|
2325
|
+
details: z16.string().optional(),
|
|
2338
2326
|
category: threadEventWarningCategorySchema.optional(),
|
|
2339
|
-
vouchedTurn:
|
|
2327
|
+
vouchedTurn: z16.boolean().optional()
|
|
2340
2328
|
}),
|
|
2341
|
-
|
|
2342
|
-
kind:
|
|
2329
|
+
z16.object({
|
|
2330
|
+
kind: z16.literal("unhandled"),
|
|
2343
2331
|
raw: providerRawEventSchema,
|
|
2344
|
-
rawType:
|
|
2345
|
-
vouchedTurn:
|
|
2346
|
-
onlyIfNoTurn:
|
|
2332
|
+
rawType: z16.string(),
|
|
2333
|
+
vouchedTurn: z16.boolean(),
|
|
2334
|
+
onlyIfNoTurn: z16.boolean().optional(),
|
|
2347
2335
|
parentRef: deltaKeyPartSchema.optional(),
|
|
2348
2336
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2349
2337
|
}),
|
|
2350
|
-
|
|
2351
|
-
|
|
2338
|
+
z16.object({ kind: z16.literal("session.ended") }),
|
|
2339
|
+
z16.object({ kind: z16.literal("session.reset") })
|
|
2352
2340
|
]);
|
|
2353
|
-
var threadDeltaNotificationParamsSchema =
|
|
2354
|
-
threadId:
|
|
2355
|
-
deltas:
|
|
2341
|
+
var threadDeltaNotificationParamsSchema = z16.object({
|
|
2342
|
+
threadId: z16.string().min(1),
|
|
2343
|
+
deltas: z16.array(threadDeltaSchema)
|
|
2356
2344
|
}).passthrough();
|
|
2357
2345
|
|
|
2358
2346
|
// ../provider-bridge-protocol/src/assembler/delta-assembler.ts
|
|
@@ -2363,17 +2351,17 @@ var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
|
|
|
2363
2351
|
var THREAD_DELTA_GRAMMAR_V3 = 3;
|
|
2364
2352
|
|
|
2365
2353
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
2366
|
-
import { z as
|
|
2354
|
+
import { z as z18 } from "zod";
|
|
2367
2355
|
|
|
2368
2356
|
// ../provider-bridge-protocol/src/bridge-kit/tool-arg-schemas.ts
|
|
2369
|
-
import { z as
|
|
2370
|
-
var bashArgsSchema =
|
|
2371
|
-
command:
|
|
2372
|
-
cwd:
|
|
2357
|
+
import { z as z17 } from "zod";
|
|
2358
|
+
var bashArgsSchema = z17.object({
|
|
2359
|
+
command: z17.string().optional(),
|
|
2360
|
+
cwd: z17.string().optional()
|
|
2373
2361
|
}).passthrough();
|
|
2374
|
-
var textBlockSchema =
|
|
2375
|
-
type:
|
|
2376
|
-
text:
|
|
2362
|
+
var textBlockSchema = z17.object({
|
|
2363
|
+
type: z17.literal("text"),
|
|
2364
|
+
text: z17.string()
|
|
2377
2365
|
});
|
|
2378
2366
|
|
|
2379
2367
|
// ../provider-bridge-protocol/src/bridge-kit/provider-visibility-helpers.ts
|
|
@@ -2382,10 +2370,10 @@ function isRecord(value) {
|
|
|
2382
2370
|
}
|
|
2383
2371
|
|
|
2384
2372
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
2385
|
-
var contentWrapperSchema =
|
|
2386
|
-
content:
|
|
2373
|
+
var contentWrapperSchema = z18.object({
|
|
2374
|
+
content: z18.array(z18.unknown())
|
|
2387
2375
|
}).passthrough();
|
|
2388
|
-
var shellEnvironmentVariableKeySchema =
|
|
2376
|
+
var shellEnvironmentVariableKeySchema = z18.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
|
|
2389
2377
|
var MAX_EXACT_LINE_DIFF_CELLS = 1e6;
|
|
2390
2378
|
function splitComparableLines(text) {
|
|
2391
2379
|
const normalized = text.replace(/\r\n?/gu, "\n");
|
|
@@ -3924,9 +3912,10 @@ function createDeltaAssembler(options) {
|
|
|
3924
3912
|
providerThreadId: "",
|
|
3925
3913
|
scope: turnId === void 0 ? threadScope() : turnScope(turnId),
|
|
3926
3914
|
contextWindowUsage: {
|
|
3927
|
-
usedTokens: delta.used,
|
|
3928
|
-
modelContextWindow: delta.size ?? null,
|
|
3929
|
-
estimated: delta.estimated
|
|
3915
|
+
usedTokens: delta.snapshot?.usedTokens ?? delta.used,
|
|
3916
|
+
modelContextWindow: delta.snapshot?.contextWindowTokens ?? delta.size ?? null,
|
|
3917
|
+
estimated: delta.snapshot?.estimated ?? delta.estimated,
|
|
3918
|
+
...delta.snapshot ? { snapshot: delta.snapshot } : {}
|
|
3930
3919
|
}
|
|
3931
3920
|
});
|
|
3932
3921
|
return;
|
|
@@ -4231,11 +4220,11 @@ function toConformanceMessages() {
|
|
|
4231
4220
|
}
|
|
4232
4221
|
|
|
4233
4222
|
// ../provider-bridge-protocol/src/conformance/client.ts
|
|
4234
|
-
import { z as
|
|
4223
|
+
import { z as z19 } from "zod";
|
|
4235
4224
|
function isWireMessage(value) {
|
|
4236
4225
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4237
4226
|
}
|
|
4238
|
-
var threadDeltaAddressSchema =
|
|
4227
|
+
var threadDeltaAddressSchema = z19.object({ threadId: z19.string() }).passthrough();
|
|
4239
4228
|
var ConformanceClient = class {
|
|
4240
4229
|
constructor(transport, timeoutMs, collector) {
|
|
4241
4230
|
this.transport = transport;
|
|
@@ -4344,11 +4333,11 @@ function nextConformanceClientRequestId() {
|
|
|
4344
4333
|
}
|
|
4345
4334
|
|
|
4346
4335
|
// ../provider-bridge-protocol/src/conformance/scenarios.ts
|
|
4347
|
-
import { z as
|
|
4336
|
+
import { z as z27 } from "zod";
|
|
4348
4337
|
|
|
4349
4338
|
// ../provider-bridge-protocol/src/handshake.ts
|
|
4350
|
-
import { z as
|
|
4351
|
-
var bridgeGrammarVersionsSchema =
|
|
4339
|
+
import { z as z20 } from "zod";
|
|
4340
|
+
var bridgeGrammarVersionsSchema = z20.tuple([z20.number().int().positive(), z20.number().int().positive()]).refine(([min, max]) => min <= max, {
|
|
4352
4341
|
message: "grammarVersions must be an ascending [min, max] range"
|
|
4353
4342
|
});
|
|
4354
4343
|
function negotiateGrammarVersion(runtime, bridge) {
|
|
@@ -4356,62 +4345,62 @@ function negotiateGrammarVersion(runtime, bridge) {
|
|
|
4356
4345
|
const max = Math.min(runtime[1], bridge[1]);
|
|
4357
4346
|
return min <= max ? max : null;
|
|
4358
4347
|
}
|
|
4359
|
-
var bridgeSteerModeSchema =
|
|
4360
|
-
var bridgeCapabilitiesSchema =
|
|
4361
|
-
sessionRestore:
|
|
4362
|
-
threadArchive:
|
|
4363
|
-
threadRename:
|
|
4364
|
-
threadGoalClear:
|
|
4348
|
+
var bridgeSteerModeSchema = z20.enum(["inject", "queue"]);
|
|
4349
|
+
var bridgeCapabilitiesSchema = z20.object({
|
|
4350
|
+
sessionRestore: z20.boolean().default(false),
|
|
4351
|
+
threadArchive: z20.boolean().default(false),
|
|
4352
|
+
threadRename: z20.boolean().default(false),
|
|
4353
|
+
threadGoalClear: z20.boolean().default(false),
|
|
4365
4354
|
fork: providerForkSchema.default("none"),
|
|
4366
|
-
approvalEnforcedBy:
|
|
4355
|
+
approvalEnforcedBy: z20.enum(["runtime", "provider"]).default("runtime"),
|
|
4367
4356
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4368
4357
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4369
4358
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4370
4359
|
]),
|
|
4371
4360
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
4372
|
-
skills:
|
|
4361
|
+
skills: z20.object({ configure: z20.boolean().default(false) }).default({ configure: false })
|
|
4373
4362
|
}).passthrough();
|
|
4374
|
-
var initializeParamsSchema =
|
|
4375
|
-
protocolVersion:
|
|
4376
|
-
client:
|
|
4363
|
+
var initializeParamsSchema = z20.object({
|
|
4364
|
+
protocolVersion: z20.number().int().positive(),
|
|
4365
|
+
client: z20.object({ name: z20.string().min(1), version: z20.string().min(1) }),
|
|
4377
4366
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4378
4367
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4379
4368
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4380
4369
|
])
|
|
4381
4370
|
}).passthrough();
|
|
4382
|
-
var initializeResultSchema =
|
|
4383
|
-
protocolVersion:
|
|
4384
|
-
capabilities:
|
|
4371
|
+
var initializeResultSchema = z20.object({
|
|
4372
|
+
protocolVersion: z20.number().int().positive(),
|
|
4373
|
+
capabilities: z20.preprocess(
|
|
4385
4374
|
(value) => value ?? {},
|
|
4386
4375
|
bridgeCapabilitiesSchema
|
|
4387
4376
|
)
|
|
4388
4377
|
}).passthrough();
|
|
4389
4378
|
|
|
4390
4379
|
// ../provider-bridge-protocol/src/execution-options.ts
|
|
4391
|
-
import { z as
|
|
4392
|
-
var bridgeExecutionOptionsSchema =
|
|
4393
|
-
model:
|
|
4380
|
+
import { z as z21 } from "zod";
|
|
4381
|
+
var bridgeExecutionOptionsSchema = z21.object({
|
|
4382
|
+
model: z21.string().min(1).optional(),
|
|
4394
4383
|
serviceTier: serviceTierSchema.optional(),
|
|
4395
4384
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
4396
4385
|
promptMode: promptModeSchema.optional(),
|
|
4397
|
-
instructions:
|
|
4398
|
-
envVars:
|
|
4399
|
-
providerOptions:
|
|
4386
|
+
instructions: z21.string().optional(),
|
|
4387
|
+
envVars: z21.record(z21.string(), z21.string()).optional(),
|
|
4388
|
+
providerOptions: z21.record(z21.string(), z21.unknown()).optional()
|
|
4400
4389
|
}).and(runtimePermissionPolicySchema);
|
|
4401
4390
|
|
|
4402
4391
|
// ../provider-bridge-protocol/src/provider-maintenance.ts
|
|
4403
|
-
import { z as
|
|
4404
|
-
var providerMaintenanceParamsSchema =
|
|
4405
|
-
providerId:
|
|
4406
|
-
cwd:
|
|
4407
|
-
providerOptions:
|
|
4392
|
+
import { z as z22 } from "zod";
|
|
4393
|
+
var providerMaintenanceParamsSchema = z22.object({
|
|
4394
|
+
providerId: z22.string().min(1),
|
|
4395
|
+
cwd: z22.string().min(1).optional(),
|
|
4396
|
+
providerOptions: z22.record(z22.string(), z22.unknown()).optional()
|
|
4408
4397
|
}).passthrough();
|
|
4409
|
-
var providerInstallationRequirementSchema =
|
|
4398
|
+
var providerInstallationRequirementSchema = z22.enum(["thread_rewind"]);
|
|
4410
4399
|
var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4411
4400
|
requirement: providerInstallationRequirementSchema.optional()
|
|
4412
4401
|
});
|
|
4413
|
-
var providerHealthSchema =
|
|
4414
|
-
status:
|
|
4402
|
+
var providerHealthSchema = z22.object({
|
|
4403
|
+
status: z22.enum([
|
|
4415
4404
|
"ready",
|
|
4416
4405
|
"not_installed",
|
|
4417
4406
|
"unauthenticated",
|
|
@@ -4419,114 +4408,114 @@ var providerHealthSchema = z21.object({
|
|
|
4419
4408
|
"unsupported_version",
|
|
4420
4409
|
"unknown"
|
|
4421
4410
|
]),
|
|
4422
|
-
statusMessage:
|
|
4423
|
-
accountEmail:
|
|
4424
|
-
planLabel:
|
|
4425
|
-
installedVersion:
|
|
4426
|
-
minimumSupportedVersion:
|
|
4427
|
-
canInstall:
|
|
4428
|
-
canUpdate:
|
|
4429
|
-
loginCommand:
|
|
4411
|
+
statusMessage: z22.string().min(1).nullable(),
|
|
4412
|
+
accountEmail: z22.string().nullable(),
|
|
4413
|
+
planLabel: z22.string().min(1).nullable(),
|
|
4414
|
+
installedVersion: z22.string().min(1).nullable(),
|
|
4415
|
+
minimumSupportedVersion: z22.string().min(1).nullable(),
|
|
4416
|
+
canInstall: z22.boolean(),
|
|
4417
|
+
canUpdate: z22.boolean(),
|
|
4418
|
+
loginCommand: z22.string().min(1).nullable()
|
|
4430
4419
|
}).passthrough();
|
|
4431
|
-
var providerUsageWindowSchema =
|
|
4432
|
-
label:
|
|
4433
|
-
usedPercent:
|
|
4434
|
-
resetsAt:
|
|
4435
|
-
cost:
|
|
4436
|
-
usedUsdCents:
|
|
4437
|
-
limitUsdCents:
|
|
4420
|
+
var providerUsageWindowSchema = z22.object({
|
|
4421
|
+
label: z22.string().min(1),
|
|
4422
|
+
usedPercent: z22.number().min(0).max(100),
|
|
4423
|
+
resetsAt: z22.string().min(1).nullable(),
|
|
4424
|
+
cost: z22.object({
|
|
4425
|
+
usedUsdCents: z22.number().int().nonnegative(),
|
|
4426
|
+
limitUsdCents: z22.number().int().positive()
|
|
4438
4427
|
}).optional()
|
|
4439
4428
|
}).passthrough();
|
|
4440
|
-
var providerUsageSchema =
|
|
4441
|
-
|
|
4442
|
-
status:
|
|
4443
|
-
accountEmail:
|
|
4444
|
-
planLabel:
|
|
4445
|
-
windows:
|
|
4429
|
+
var providerUsageSchema = z22.discriminatedUnion("status", [
|
|
4430
|
+
z22.object({
|
|
4431
|
+
status: z22.literal("ok"),
|
|
4432
|
+
accountEmail: z22.string().email().nullable(),
|
|
4433
|
+
planLabel: z22.string().min(1).nullable(),
|
|
4434
|
+
windows: z22.array(providerUsageWindowSchema)
|
|
4446
4435
|
}).passthrough(),
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
status:
|
|
4452
|
-
message:
|
|
4453
|
-
planLabel:
|
|
4454
|
-
accountEmail:
|
|
4436
|
+
z22.object({ status: z22.literal("not_installed") }).passthrough(),
|
|
4437
|
+
z22.object({ status: z22.literal("unauthenticated") }).passthrough(),
|
|
4438
|
+
z22.object({ status: z22.literal("expired") }).passthrough(),
|
|
4439
|
+
z22.object({
|
|
4440
|
+
status: z22.literal("error"),
|
|
4441
|
+
message: z22.string().min(1),
|
|
4442
|
+
planLabel: z22.string().min(1).nullable().default(null),
|
|
4443
|
+
accountEmail: z22.string().nullable().default(null)
|
|
4455
4444
|
}).passthrough()
|
|
4456
4445
|
]);
|
|
4457
|
-
var providerHealthResultSchema =
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
supported:
|
|
4446
|
+
var providerHealthResultSchema = z22.discriminatedUnion("supported", [
|
|
4447
|
+
z22.object({ supported: z22.literal(false) }).passthrough(),
|
|
4448
|
+
z22.object({
|
|
4449
|
+
supported: z22.literal(true),
|
|
4461
4450
|
health: providerHealthSchema
|
|
4462
4451
|
}).passthrough()
|
|
4463
4452
|
]);
|
|
4464
|
-
var providerUsageResultSchema =
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
supported:
|
|
4453
|
+
var providerUsageResultSchema = z22.discriminatedUnion("supported", [
|
|
4454
|
+
z22.object({ supported: z22.literal(false) }).passthrough(),
|
|
4455
|
+
z22.object({
|
|
4456
|
+
supported: z22.literal(true),
|
|
4468
4457
|
usage: providerUsageSchema
|
|
4469
4458
|
}).passthrough()
|
|
4470
4459
|
]);
|
|
4471
|
-
var providerInstallationActionKindSchema =
|
|
4460
|
+
var providerInstallationActionKindSchema = z22.enum([
|
|
4472
4461
|
"install",
|
|
4473
4462
|
"update"
|
|
4474
4463
|
]);
|
|
4475
|
-
var providerInstallationActionSchema =
|
|
4464
|
+
var providerInstallationActionSchema = z22.object({
|
|
4476
4465
|
kind: providerInstallationActionKindSchema,
|
|
4477
|
-
label:
|
|
4478
|
-
command:
|
|
4466
|
+
label: z22.enum(["Install", "Update"]),
|
|
4467
|
+
command: z22.string().min(1)
|
|
4479
4468
|
}).passthrough();
|
|
4480
|
-
var providerInstallationSourceSchema =
|
|
4469
|
+
var providerInstallationSourceSchema = z22.enum([
|
|
4481
4470
|
"notInstalled",
|
|
4482
4471
|
"npmGlobal",
|
|
4483
4472
|
"external"
|
|
4484
4473
|
]);
|
|
4485
|
-
var providerInstallationStatusSchema =
|
|
4486
|
-
executableName:
|
|
4487
|
-
executablePath:
|
|
4488
|
-
installed:
|
|
4474
|
+
var providerInstallationStatusSchema = z22.object({
|
|
4475
|
+
executableName: z22.string().min(1),
|
|
4476
|
+
executablePath: z22.string().min(1).nullable(),
|
|
4477
|
+
installed: z22.boolean(),
|
|
4489
4478
|
installSource: providerInstallationSourceSchema,
|
|
4490
|
-
currentVersion:
|
|
4491
|
-
latestVersion:
|
|
4492
|
-
minimumSupportedVersion:
|
|
4493
|
-
npmPackageName:
|
|
4494
|
-
npmGlobalPackageVersion:
|
|
4479
|
+
currentVersion: z22.string().min(1).nullable(),
|
|
4480
|
+
latestVersion: z22.string().min(1).nullable(),
|
|
4481
|
+
minimumSupportedVersion: z22.string().min(1).nullable(),
|
|
4482
|
+
npmPackageName: z22.string().min(1).nullable(),
|
|
4483
|
+
npmGlobalPackageVersion: z22.string().min(1).nullable(),
|
|
4495
4484
|
installAction: providerInstallationActionSchema.nullable(),
|
|
4496
|
-
needsUpdate:
|
|
4497
|
-
versionUnsupported:
|
|
4485
|
+
needsUpdate: z22.boolean(),
|
|
4486
|
+
versionUnsupported: z22.boolean()
|
|
4498
4487
|
}).passthrough();
|
|
4499
4488
|
var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4500
4489
|
action: providerInstallationActionKindSchema
|
|
4501
4490
|
});
|
|
4502
|
-
var providerInstallationCommandSchema =
|
|
4503
|
-
command:
|
|
4504
|
-
args:
|
|
4505
|
-
displayCommand:
|
|
4491
|
+
var providerInstallationCommandSchema = z22.object({
|
|
4492
|
+
command: z22.string().min(1),
|
|
4493
|
+
args: z22.array(z22.string()).max(64),
|
|
4494
|
+
displayCommand: z22.string().min(1)
|
|
4506
4495
|
}).passthrough();
|
|
4507
|
-
var providerInstallationVerificationSchema =
|
|
4496
|
+
var providerInstallationVerificationSchema = z22.discriminatedUnion(
|
|
4508
4497
|
"kind",
|
|
4509
4498
|
[
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
kind:
|
|
4513
|
-
previousVersion:
|
|
4499
|
+
z22.object({ kind: z22.literal("installed") }).passthrough(),
|
|
4500
|
+
z22.object({
|
|
4501
|
+
kind: z22.literal("version_changed"),
|
|
4502
|
+
previousVersion: z22.string().min(1)
|
|
4514
4503
|
}).passthrough(),
|
|
4515
|
-
|
|
4516
|
-
kind:
|
|
4517
|
-
version:
|
|
4504
|
+
z22.object({
|
|
4505
|
+
kind: z22.literal("version_at_least"),
|
|
4506
|
+
version: z22.string().min(1)
|
|
4518
4507
|
}).passthrough()
|
|
4519
4508
|
]
|
|
4520
4509
|
);
|
|
4521
|
-
var providerInstallationRunResultSchema =
|
|
4510
|
+
var providerInstallationRunResultSchema = z22.discriminatedUnion(
|
|
4522
4511
|
"available",
|
|
4523
4512
|
[
|
|
4524
|
-
|
|
4525
|
-
available:
|
|
4526
|
-
message:
|
|
4513
|
+
z22.object({
|
|
4514
|
+
available: z22.literal(false),
|
|
4515
|
+
message: z22.string().min(1)
|
|
4527
4516
|
}).passthrough(),
|
|
4528
|
-
|
|
4529
|
-
available:
|
|
4517
|
+
z22.object({
|
|
4518
|
+
available: z22.literal(true),
|
|
4530
4519
|
command: providerInstallationCommandSchema,
|
|
4531
4520
|
verification: providerInstallationVerificationSchema
|
|
4532
4521
|
}).passthrough()
|
|
@@ -4534,7 +4523,7 @@ var providerInstallationRunResultSchema = z21.discriminatedUnion(
|
|
|
4534
4523
|
);
|
|
4535
4524
|
|
|
4536
4525
|
// ../provider-bridge-protocol/src/requests.ts
|
|
4537
|
-
import { z as
|
|
4526
|
+
import { z as z23 } from "zod";
|
|
4538
4527
|
var BRIDGE_REQUEST_METHODS = {
|
|
4539
4528
|
initialize: "initialize",
|
|
4540
4529
|
modelList: "model/list",
|
|
@@ -4556,81 +4545,77 @@ var BRIDGE_REQUEST_METHODS = {
|
|
|
4556
4545
|
skillsConfigure: "skills/configure"
|
|
4557
4546
|
};
|
|
4558
4547
|
var sessionConstructionFields = {
|
|
4559
|
-
threadId:
|
|
4560
|
-
cwd:
|
|
4548
|
+
threadId: z23.string().min(1),
|
|
4549
|
+
cwd: z23.string().min(1),
|
|
4561
4550
|
options: bridgeExecutionOptionsSchema,
|
|
4562
|
-
dynamicTools:
|
|
4563
|
-
disallowedTools:
|
|
4551
|
+
dynamicTools: z23.array(dynamicToolSchema).optional(),
|
|
4552
|
+
disallowedTools: z23.array(z23.string().min(1)).optional(),
|
|
4564
4553
|
instructionMode: instructionModeSchema
|
|
4565
4554
|
};
|
|
4566
|
-
var modelListParamsSchema =
|
|
4567
|
-
var threadStartParamsSchema =
|
|
4555
|
+
var modelListParamsSchema = z23.object({ cwd: z23.string().min(1).optional() }).passthrough();
|
|
4556
|
+
var threadStartParamsSchema = z23.object({
|
|
4568
4557
|
...sessionConstructionFields,
|
|
4569
|
-
input:
|
|
4558
|
+
input: z23.array(promptInputSchema).optional()
|
|
4570
4559
|
}).passthrough();
|
|
4571
|
-
var threadResumeParamsSchema =
|
|
4560
|
+
var threadResumeParamsSchema = z23.object({
|
|
4572
4561
|
...sessionConstructionFields,
|
|
4573
|
-
providerThreadId:
|
|
4562
|
+
providerThreadId: z23.string().min(1)
|
|
4574
4563
|
}).passthrough();
|
|
4575
|
-
var threadForkParamsSchema =
|
|
4564
|
+
var threadForkParamsSchema = z23.object({
|
|
4576
4565
|
...sessionConstructionFields,
|
|
4577
|
-
sourceProviderThreadId:
|
|
4578
|
-
sourceProviderCheckpointId:
|
|
4566
|
+
sourceProviderThreadId: z23.string().min(1),
|
|
4567
|
+
sourceProviderCheckpointId: z23.string().min(1).optional()
|
|
4579
4568
|
}).passthrough();
|
|
4580
|
-
var threadStopParamsSchema =
|
|
4581
|
-
threadId:
|
|
4582
|
-
providerThreadId:
|
|
4583
|
-
intent:
|
|
4584
|
-
activeTurnId:
|
|
4569
|
+
var threadStopParamsSchema = z23.object({
|
|
4570
|
+
threadId: z23.string().min(1),
|
|
4571
|
+
providerThreadId: z23.string().min(1),
|
|
4572
|
+
intent: z23.enum(["interrupt", "release"]),
|
|
4573
|
+
activeTurnId: z23.string().min(1).nullable()
|
|
4585
4574
|
}).passthrough();
|
|
4586
|
-
var threadRefParams =
|
|
4587
|
-
threadId:
|
|
4588
|
-
providerThreadId:
|
|
4575
|
+
var threadRefParams = z23.object({
|
|
4576
|
+
threadId: z23.string().min(1),
|
|
4577
|
+
providerThreadId: z23.string().min(1)
|
|
4589
4578
|
}).passthrough();
|
|
4590
|
-
var threadNameSetParamsSchema =
|
|
4591
|
-
threadId:
|
|
4592
|
-
providerThreadId:
|
|
4593
|
-
title:
|
|
4579
|
+
var threadNameSetParamsSchema = z23.object({
|
|
4580
|
+
threadId: z23.string().min(1),
|
|
4581
|
+
providerThreadId: z23.string().min(1),
|
|
4582
|
+
title: z23.string().min(1)
|
|
4594
4583
|
}).passthrough();
|
|
4595
4584
|
var turnInputFields = {
|
|
4596
|
-
threadId:
|
|
4597
|
-
providerThreadId:
|
|
4598
|
-
input:
|
|
4585
|
+
threadId: z23.string().min(1),
|
|
4586
|
+
providerThreadId: z23.string().min(1),
|
|
4587
|
+
input: z23.array(promptInputSchema),
|
|
4599
4588
|
clientRequestId: clientTurnRequestIdSchema,
|
|
4600
4589
|
options: bridgeExecutionOptionsSchema
|
|
4601
4590
|
};
|
|
4602
|
-
var turnStartParamsSchema =
|
|
4603
|
-
var turnSteerParamsSchema =
|
|
4591
|
+
var turnStartParamsSchema = z23.object(turnInputFields).passthrough();
|
|
4592
|
+
var turnSteerParamsSchema = z23.object({
|
|
4604
4593
|
...turnInputFields,
|
|
4605
|
-
expectedTurnId:
|
|
4594
|
+
expectedTurnId: z23.string().min(1)
|
|
4606
4595
|
}).passthrough();
|
|
4607
|
-
var skillsConfigureRootSchema =
|
|
4608
|
-
id:
|
|
4609
|
-
path:
|
|
4610
|
-
skills:
|
|
4611
|
-
|
|
4612
|
-
name:
|
|
4613
|
-
description:
|
|
4596
|
+
var skillsConfigureRootSchema = z23.object({
|
|
4597
|
+
id: z23.string().min(1),
|
|
4598
|
+
path: z23.string().min(1),
|
|
4599
|
+
skills: z23.array(
|
|
4600
|
+
z23.object({
|
|
4601
|
+
name: z23.string().min(1),
|
|
4602
|
+
description: z23.string()
|
|
4614
4603
|
}).passthrough()
|
|
4615
4604
|
)
|
|
4616
4605
|
}).passthrough();
|
|
4617
|
-
var skillsConfigureParamsSchema =
|
|
4618
|
-
roots:
|
|
4619
|
-
}).passthrough();
|
|
4620
|
-
var threadIdentityResultSchema = z22.object({
|
|
4621
|
-
providerThreadId: z22.string().min(1),
|
|
4622
|
-
sessionRestorable: z22.boolean().optional()
|
|
4606
|
+
var skillsConfigureParamsSchema = z23.object({
|
|
4607
|
+
roots: z23.array(skillsConfigureRootSchema)
|
|
4623
4608
|
}).passthrough();
|
|
4624
|
-
var
|
|
4625
|
-
|
|
4626
|
-
|
|
4609
|
+
var threadIdentityResultSchema = z23.object({
|
|
4610
|
+
providerThreadId: z23.string().min(1),
|
|
4611
|
+
sessionRestorable: z23.boolean().optional()
|
|
4627
4612
|
}).passthrough();
|
|
4628
4613
|
|
|
4629
4614
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4630
|
-
import { z as
|
|
4615
|
+
import { z as z25 } from "zod";
|
|
4631
4616
|
|
|
4632
4617
|
// ../provider-bridge-protocol/src/errors.ts
|
|
4633
|
-
import { z as
|
|
4618
|
+
import { z as z24 } from "zod";
|
|
4634
4619
|
var BRIDGE_JSON_RPC_ERRORS = {
|
|
4635
4620
|
INVALID_PARAMS: -32602,
|
|
4636
4621
|
METHOD_NOT_FOUND: -32601,
|
|
@@ -4639,68 +4624,65 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
4639
4624
|
SESSION_NOT_RESTORABLE: -32002,
|
|
4640
4625
|
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
4641
4626
|
};
|
|
4642
|
-
var providerRecoveryHintSchema =
|
|
4627
|
+
var providerRecoveryHintSchema = z24.object({
|
|
4643
4628
|
kind: providerRecoveryKindSchema,
|
|
4644
|
-
message:
|
|
4645
|
-
retryable:
|
|
4629
|
+
message: z24.string().min(1),
|
|
4630
|
+
retryable: z24.boolean()
|
|
4646
4631
|
});
|
|
4647
|
-
var bridgeErrorDataSchema =
|
|
4632
|
+
var bridgeErrorDataSchema = z24.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
|
|
4648
4633
|
|
|
4649
4634
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4650
|
-
var threadIdentityNotificationSchema =
|
|
4651
|
-
threadId:
|
|
4652
|
-
providerThreadId:
|
|
4653
|
-
sessionRestorable:
|
|
4654
|
-
}).passthrough();
|
|
4655
|
-
var sessionReplacedNotificationSchema = z24.object({
|
|
4656
|
-
threadId: z24.string().min(1),
|
|
4657
|
-
providerThreadId: z24.string().min(1).nullable(),
|
|
4658
|
-
reason: z24.string().min(1),
|
|
4659
|
-
contextLost: z24.boolean().default(false),
|
|
4660
|
-
showRuntimeNote: z24.boolean().default(false)
|
|
4635
|
+
var threadIdentityNotificationSchema = z25.object({
|
|
4636
|
+
threadId: z25.string().min(1),
|
|
4637
|
+
providerThreadId: z25.string().min(1),
|
|
4638
|
+
sessionRestorable: z25.boolean().optional()
|
|
4661
4639
|
}).passthrough();
|
|
4662
|
-
var
|
|
4663
|
-
threadId:
|
|
4664
|
-
|
|
4665
|
-
|
|
4640
|
+
var sessionReplacedNotificationSchema = z25.object({
|
|
4641
|
+
threadId: z25.string().min(1),
|
|
4642
|
+
providerThreadId: z25.string().min(1).nullable(),
|
|
4643
|
+
reason: z25.string().min(1),
|
|
4644
|
+
contextLost: z25.boolean().default(false),
|
|
4645
|
+
showRuntimeNote: z25.boolean().default(false)
|
|
4666
4646
|
}).passthrough();
|
|
4667
|
-
var providerRecoveryNotificationSchema =
|
|
4668
|
-
threadId:
|
|
4647
|
+
var providerRecoveryNotificationSchema = z25.object({
|
|
4648
|
+
threadId: z25.string().min(1).optional(),
|
|
4669
4649
|
...providerRecoveryHintSchema.shape
|
|
4670
4650
|
}).passthrough();
|
|
4671
|
-
var errorNotificationSchema =
|
|
4672
|
-
threadId:
|
|
4673
|
-
|
|
4651
|
+
var errorNotificationSchema = z25.object({
|
|
4652
|
+
threadId: z25.string().min(1).optional(),
|
|
4653
|
+
providerThreadId: z25.string().min(1).optional(),
|
|
4654
|
+
message: z25.string().min(1)
|
|
4674
4655
|
}).passthrough();
|
|
4675
4656
|
|
|
4676
4657
|
// ../provider-bridge-protocol/src/bridge-requests.ts
|
|
4677
|
-
import { z as
|
|
4678
|
-
var toolCallRequestParamsSchema =
|
|
4679
|
-
providerThreadId:
|
|
4680
|
-
threadId:
|
|
4681
|
-
turnId:
|
|
4682
|
-
callId:
|
|
4683
|
-
tool:
|
|
4684
|
-
arguments:
|
|
4658
|
+
import { z as z26 } from "zod";
|
|
4659
|
+
var toolCallRequestParamsSchema = z26.object({
|
|
4660
|
+
providerThreadId: z26.string().min(1),
|
|
4661
|
+
threadId: z26.string().min(1).optional(),
|
|
4662
|
+
turnId: z26.union([z26.string().min(1), z26.null()]),
|
|
4663
|
+
callId: z26.string().min(1),
|
|
4664
|
+
tool: z26.string().min(1),
|
|
4665
|
+
arguments: z26.unknown(),
|
|
4666
|
+
providerNativeIds: z26.boolean().optional()
|
|
4685
4667
|
}).passthrough();
|
|
4686
|
-
var toolCallResultSchema =
|
|
4687
|
-
success:
|
|
4688
|
-
contentItems:
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
type:
|
|
4693
|
-
imageUrl:
|
|
4668
|
+
var toolCallResultSchema = z26.object({
|
|
4669
|
+
success: z26.boolean(),
|
|
4670
|
+
contentItems: z26.array(
|
|
4671
|
+
z26.discriminatedUnion("type", [
|
|
4672
|
+
z26.object({ type: z26.literal("inputText"), text: z26.string() }),
|
|
4673
|
+
z26.object({
|
|
4674
|
+
type: z26.literal("inputImage"),
|
|
4675
|
+
imageUrl: z26.string().min(1)
|
|
4694
4676
|
})
|
|
4695
4677
|
])
|
|
4696
4678
|
)
|
|
4697
4679
|
}).passthrough();
|
|
4698
|
-
var interactionRequestParamsSchema =
|
|
4699
|
-
providerThreadId:
|
|
4700
|
-
threadId:
|
|
4701
|
-
turnId:
|
|
4680
|
+
var interactionRequestParamsSchema = z26.object({
|
|
4681
|
+
providerThreadId: z26.string().min(1),
|
|
4682
|
+
threadId: z26.string().min(1).optional(),
|
|
4683
|
+
turnId: z26.union([z26.string().min(1), z26.null()]),
|
|
4702
4684
|
payload: pendingInteractionPayloadSchema,
|
|
4703
|
-
providerNativeIds:
|
|
4685
|
+
providerNativeIds: z26.boolean().optional()
|
|
4704
4686
|
}).passthrough();
|
|
4705
4687
|
|
|
4706
4688
|
// ../provider-bridge-protocol/src/thread-event-grammar.ts
|
|
@@ -4877,7 +4859,7 @@ function threadEvents(context, threadId) {
|
|
|
4877
4859
|
context.client.drainIntoLog();
|
|
4878
4860
|
return context.client.events.filter((entry) => entry.threadId === threadId).map((entry) => entry.event);
|
|
4879
4861
|
}
|
|
4880
|
-
var persistedEventSchema =
|
|
4862
|
+
var persistedEventSchema = z27.preprocess(
|
|
4881
4863
|
(event) => JSON.parse(JSON.stringify(event)),
|
|
4882
4864
|
threadEventSchema
|
|
4883
4865
|
);
|
|
@@ -5972,26 +5954,26 @@ function formatConformanceReport(report) {
|
|
|
5972
5954
|
}
|
|
5973
5955
|
|
|
5974
5956
|
// ../provider-bridge-protocol/src/testing/bridge-json-rpc-test-helpers.ts
|
|
5975
|
-
import { z as
|
|
5976
|
-
var bridgeJsonRpcValueSchema =
|
|
5977
|
-
() =>
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5957
|
+
import { z as z28 } from "zod";
|
|
5958
|
+
var bridgeJsonRpcValueSchema = z28.lazy(
|
|
5959
|
+
() => z28.union([
|
|
5960
|
+
z28.string(),
|
|
5961
|
+
z28.number(),
|
|
5962
|
+
z28.boolean(),
|
|
5963
|
+
z28.null(),
|
|
5964
|
+
z28.array(bridgeJsonRpcValueSchema),
|
|
5965
|
+
z28.record(z28.string(), bridgeJsonRpcValueSchema)
|
|
5984
5966
|
])
|
|
5985
5967
|
);
|
|
5986
|
-
var bridgeJsonRpcOutputSchema =
|
|
5987
|
-
jsonrpc:
|
|
5988
|
-
id:
|
|
5989
|
-
method:
|
|
5968
|
+
var bridgeJsonRpcOutputSchema = z28.object({
|
|
5969
|
+
jsonrpc: z28.literal("2.0"),
|
|
5970
|
+
id: z28.union([z28.string(), z28.number()]).optional(),
|
|
5971
|
+
method: z28.string().optional(),
|
|
5990
5972
|
params: bridgeJsonRpcValueSchema.optional(),
|
|
5991
5973
|
result: bridgeJsonRpcValueSchema.optional(),
|
|
5992
|
-
error:
|
|
5993
|
-
code:
|
|
5994
|
-
message:
|
|
5974
|
+
error: z28.object({
|
|
5975
|
+
code: z28.number(),
|
|
5976
|
+
message: z28.string(),
|
|
5995
5977
|
data: bridgeJsonRpcValueSchema.optional()
|
|
5996
5978
|
}).optional()
|
|
5997
5979
|
});
|
|
@@ -6280,11 +6262,7 @@ function parseEntry(raw, file, lineNumber) {
|
|
|
6280
6262
|
const entry = parsed;
|
|
6281
6263
|
return { ...entry, run: typeof entry.run === "number" ? entry.run : 0 };
|
|
6282
6264
|
}
|
|
6283
|
-
function
|
|
6284
|
-
const file = join(dir, bridgeRecordingFileName(direction));
|
|
6285
|
-
if (!existsSync(file)) {
|
|
6286
|
-
return [];
|
|
6287
|
-
}
|
|
6265
|
+
function readLaneEntries(file, direction, laneLabel) {
|
|
6288
6266
|
const entries = [];
|
|
6289
6267
|
const lines = readFileSync(file, "utf8").split("\n");
|
|
6290
6268
|
for (const [index, raw] of lines.entries()) {
|
|
@@ -6292,32 +6270,27 @@ function readBridgeRecordingLane(dir, direction) {
|
|
|
6292
6270
|
const entry = parseEntry(raw, file, index + 1);
|
|
6293
6271
|
if (entry.dir !== direction) {
|
|
6294
6272
|
throw new Error(
|
|
6295
|
-
`${file}:${index + 1}: entry direction ${entry.dir} in the ${
|
|
6273
|
+
`${file}:${index + 1}: entry direction ${entry.dir} in the ${laneLabel}`
|
|
6296
6274
|
);
|
|
6297
6275
|
}
|
|
6298
6276
|
entries.push(entry);
|
|
6299
6277
|
}
|
|
6300
6278
|
return entries;
|
|
6301
6279
|
}
|
|
6280
|
+
function readBridgeRecordingLane(dir, direction) {
|
|
6281
|
+
const file = join(dir, bridgeRecordingFileName(direction));
|
|
6282
|
+
if (!existsSync(file)) {
|
|
6283
|
+
return [];
|
|
6284
|
+
}
|
|
6285
|
+
return readLaneEntries(file, direction, `${direction} lane`);
|
|
6286
|
+
}
|
|
6302
6287
|
var CURRENT_BRIDGE_LANE_FILE = "bridge\u2192runtime.current.ndjson";
|
|
6303
6288
|
function readCurrentBridgeLane(dir) {
|
|
6304
6289
|
const file = join(dir, CURRENT_BRIDGE_LANE_FILE);
|
|
6305
6290
|
if (!existsSync(file)) {
|
|
6306
6291
|
return null;
|
|
6307
6292
|
}
|
|
6308
|
-
|
|
6309
|
-
const lines = readFileSync(file, "utf8").split("\n");
|
|
6310
|
-
for (const [index, raw] of lines.entries()) {
|
|
6311
|
-
if (raw.length === 0) continue;
|
|
6312
|
-
const entry = parseEntry(raw, file, index + 1);
|
|
6313
|
-
if (entry.dir !== "bridge\u2192runtime") {
|
|
6314
|
-
throw new Error(
|
|
6315
|
-
`${file}:${index + 1}: entry direction ${entry.dir} in the current bridge lane`
|
|
6316
|
-
);
|
|
6317
|
-
}
|
|
6318
|
-
entries.push(entry);
|
|
6319
|
-
}
|
|
6320
|
-
return entries;
|
|
6293
|
+
return readLaneEntries(file, "bridge\u2192runtime", "current bridge lane");
|
|
6321
6294
|
}
|
|
6322
6295
|
function withCurrentBridgeLane(recording) {
|
|
6323
6296
|
const current = readCurrentBridgeLane(recording.dir);
|