@get-bb/plugin-sdk 0.4.56 → 0.4.87
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/README.md +0 -12
- package/bundled-types/bb-plugin-sdk-app.d.ts +137 -20
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +35 -3
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +406 -52
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +8 -3
- package/bundled-types/bb-plugin-sdk-machine-provider.d.ts +84 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +57 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +131 -2
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +7 -2
- package/bundled-types/bb-plugin-sdk-testing.d.ts +212 -12
- package/bundled-types/bb-plugin-sdk.d.ts +749 -49
- package/dist/app.js +4 -0
- package/dist/host.js +1 -1
- package/dist/internal/host-policy.js +855 -68
- package/dist/internal/plugin-app-collector.js +116 -91
- package/dist/machine-provider.js +0 -0
- package/dist/provider-bridge-acp.js +1964 -2045
- package/dist/provider-bridge-testing.js +1378 -1404
- package/dist/provider-bridge-worker-entry.mjs +0 -1
- package/dist/provider-bridge.js +1455 -1498
- package/dist/testing/app.js +134 -91
- package/dist/testing/index.js +1092 -730
- package/package.json +7 -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,288 +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
|
-
|
|
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()
|
|
1732
1720
|
]),
|
|
1733
|
-
value:
|
|
1734
|
-
|
|
1735
|
-
|
|
1721
|
+
value: z13.union([
|
|
1722
|
+
z13.string(),
|
|
1723
|
+
z13.object({ masked: z13.literal(true) }).strict()
|
|
1736
1724
|
]),
|
|
1737
|
-
reason:
|
|
1725
|
+
reason: z13.string().optional()
|
|
1738
1726
|
}).strict()
|
|
1739
1727
|
)
|
|
1740
1728
|
}),
|
|
1741
|
-
|
|
1742
|
-
type:
|
|
1743
|
-
threadId:
|
|
1744
|
-
providerThreadId:
|
|
1729
|
+
z13.object({
|
|
1730
|
+
type: z13.literal("thread/extensionState/updated"),
|
|
1731
|
+
threadId: z13.string(),
|
|
1732
|
+
providerThreadId: z13.string(),
|
|
1745
1733
|
kind: extensionKindSchema,
|
|
1746
1734
|
payload: jsonValueSchema
|
|
1747
1735
|
}),
|
|
1748
|
-
|
|
1749
|
-
type:
|
|
1750
|
-
threadId:
|
|
1751
|
-
providerThreadId:
|
|
1736
|
+
z13.object({
|
|
1737
|
+
type: z13.literal("provider/warning"),
|
|
1738
|
+
threadId: z13.string(),
|
|
1739
|
+
providerThreadId: z13.string(),
|
|
1752
1740
|
category: threadEventWarningCategorySchema,
|
|
1753
|
-
summary:
|
|
1754
|
-
details:
|
|
1741
|
+
summary: z13.string().optional(),
|
|
1742
|
+
details: z13.string().optional()
|
|
1755
1743
|
}),
|
|
1756
|
-
|
|
1757
|
-
type:
|
|
1758
|
-
threadId:
|
|
1759
|
-
providerThreadId:
|
|
1760
|
-
originalModel:
|
|
1761
|
-
fallbackModel:
|
|
1762
|
-
reason:
|
|
1763
|
-
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()
|
|
1764
1752
|
}),
|
|
1765
1753
|
providerUnhandledEventSchema
|
|
1766
1754
|
]);
|
|
1767
|
-
var scopedEventDataSchema =
|
|
1755
|
+
var scopedEventDataSchema = z13.object({
|
|
1768
1756
|
scope: threadEventScopeSchema
|
|
1769
1757
|
});
|
|
1770
1758
|
var providerEventSchema = unscopedProviderEventSchema.and(
|
|
@@ -1773,58 +1761,58 @@ var providerEventSchema = unscopedProviderEventSchema.and(
|
|
|
1773
1761
|
var providerEventTypeValues = unscopedProviderEventSchema.options.map(
|
|
1774
1762
|
(option) => option.shape.type.value
|
|
1775
1763
|
);
|
|
1776
|
-
var unscopedSystemEventSchema =
|
|
1777
|
-
|
|
1778
|
-
type:
|
|
1779
|
-
threadId:
|
|
1764
|
+
var unscopedSystemEventSchema = z13.discriminatedUnion("type", [
|
|
1765
|
+
z13.object({
|
|
1766
|
+
type: z13.literal("client/thread/start"),
|
|
1767
|
+
threadId: z13.string()
|
|
1780
1768
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
1781
|
-
|
|
1782
|
-
type:
|
|
1783
|
-
threadId:
|
|
1769
|
+
z13.object({
|
|
1770
|
+
type: z13.literal("client/turn/requested"),
|
|
1771
|
+
threadId: z13.string()
|
|
1784
1772
|
}).merge(turnRequestEventDataSchema),
|
|
1785
|
-
|
|
1786
|
-
type:
|
|
1787
|
-
threadId:
|
|
1773
|
+
z13.object({
|
|
1774
|
+
type: z13.literal("client/turn/rejected"),
|
|
1775
|
+
threadId: z13.string()
|
|
1788
1776
|
}).merge(turnRequestRejectedEventDataSchema),
|
|
1789
|
-
|
|
1790
|
-
type:
|
|
1791
|
-
threadId:
|
|
1777
|
+
z13.object({
|
|
1778
|
+
type: z13.literal("client/turn/start"),
|
|
1779
|
+
threadId: z13.string()
|
|
1792
1780
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
1793
|
-
|
|
1794
|
-
type:
|
|
1795
|
-
threadId:
|
|
1781
|
+
z13.object({
|
|
1782
|
+
type: z13.literal("system/error"),
|
|
1783
|
+
threadId: z13.string()
|
|
1796
1784
|
}).merge(systemErrorEventDataSchema),
|
|
1797
|
-
|
|
1798
|
-
type:
|
|
1799
|
-
threadId:
|
|
1785
|
+
z13.object({
|
|
1786
|
+
type: z13.literal("system/manager/user_message"),
|
|
1787
|
+
threadId: z13.string()
|
|
1800
1788
|
}).merge(systemLegacyUserMessageEventDataSchema),
|
|
1801
|
-
|
|
1802
|
-
type:
|
|
1803
|
-
threadId:
|
|
1789
|
+
z13.object({
|
|
1790
|
+
type: z13.literal("system/thread/interrupted"),
|
|
1791
|
+
threadId: z13.string()
|
|
1804
1792
|
}).merge(systemThreadInterruptedEventDataSchema),
|
|
1805
|
-
|
|
1806
|
-
type:
|
|
1807
|
-
threadId:
|
|
1793
|
+
z13.object({
|
|
1794
|
+
type: z13.literal("system/operation"),
|
|
1795
|
+
threadId: z13.string()
|
|
1808
1796
|
}).merge(systemOperationEventDataSchema),
|
|
1809
|
-
|
|
1810
|
-
type:
|
|
1811
|
-
threadId:
|
|
1797
|
+
z13.object({
|
|
1798
|
+
type: z13.literal("system/interaction/lifecycle"),
|
|
1799
|
+
threadId: z13.string()
|
|
1812
1800
|
}).merge(systemInteractionLifecycleEventDataSchema),
|
|
1813
|
-
|
|
1814
|
-
type:
|
|
1815
|
-
threadId:
|
|
1801
|
+
z13.object({
|
|
1802
|
+
type: z13.literal("system/permissionGrant/lifecycle"),
|
|
1803
|
+
threadId: z13.string()
|
|
1816
1804
|
}).merge(systemPermissionGrantLifecycleEventDataSchema),
|
|
1817
|
-
|
|
1818
|
-
type:
|
|
1819
|
-
threadId:
|
|
1805
|
+
z13.object({
|
|
1806
|
+
type: z13.literal("system/userQuestion/lifecycle"),
|
|
1807
|
+
threadId: z13.string()
|
|
1820
1808
|
}).merge(systemUserQuestionLifecycleEventDataSchema),
|
|
1821
|
-
|
|
1822
|
-
type:
|
|
1823
|
-
threadId:
|
|
1809
|
+
z13.object({
|
|
1810
|
+
type: z13.literal("system/thread-provisioning"),
|
|
1811
|
+
threadId: z13.string()
|
|
1824
1812
|
}).merge(systemThreadProvisioningEventDataSchema),
|
|
1825
|
-
|
|
1826
|
-
type:
|
|
1827
|
-
threadId:
|
|
1813
|
+
z13.object({
|
|
1814
|
+
type: z13.literal("system/provider-turn-watchdog"),
|
|
1815
|
+
threadId: z13.string()
|
|
1828
1816
|
}).merge(systemProviderTurnWatchdogEventDataSchema)
|
|
1829
1817
|
]);
|
|
1830
1818
|
var systemEventSchema = unscopedSystemEventSchema.and(scopedEventDataSchema);
|
|
@@ -1832,13 +1820,13 @@ var legacyClientRequestKey = ["clientRequest", "Sequence"].join("");
|
|
|
1832
1820
|
function isEventPropertyBag(value) {
|
|
1833
1821
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1834
1822
|
}
|
|
1835
|
-
var rejectLegacyClientRequestSequenceSchema =
|
|
1823
|
+
var rejectLegacyClientRequestSequenceSchema = z13.unknown().superRefine((value, ctx) => {
|
|
1836
1824
|
if (!isEventPropertyBag(value)) {
|
|
1837
1825
|
return;
|
|
1838
1826
|
}
|
|
1839
1827
|
if (Object.hasOwn(value, legacyClientRequestKey)) {
|
|
1840
1828
|
ctx.addIssue({
|
|
1841
|
-
code:
|
|
1829
|
+
code: z13.ZodIssueCode.custom,
|
|
1842
1830
|
message: "legacy request sequence field is no longer accepted",
|
|
1843
1831
|
path: [legacyClientRequestKey]
|
|
1844
1832
|
});
|
|
@@ -1846,21 +1834,21 @@ var rejectLegacyClientRequestSequenceSchema = z12.unknown().superRefine((value,
|
|
|
1846
1834
|
const item = value.item;
|
|
1847
1835
|
if (isEventPropertyBag(item) && item.type === "userMessage" && Object.hasOwn(item, legacyClientRequestKey)) {
|
|
1848
1836
|
ctx.addIssue({
|
|
1849
|
-
code:
|
|
1837
|
+
code: z13.ZodIssueCode.custom,
|
|
1850
1838
|
message: "legacy user-message request sequence field is no longer accepted",
|
|
1851
1839
|
path: ["item", legacyClientRequestKey]
|
|
1852
1840
|
});
|
|
1853
1841
|
}
|
|
1854
1842
|
});
|
|
1855
1843
|
var threadEventSchema = rejectLegacyClientRequestSequenceSchema.pipe(
|
|
1856
|
-
|
|
1844
|
+
z13.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
|
|
1857
1845
|
const result2 = validateThreadEventScope({
|
|
1858
1846
|
type: event.type,
|
|
1859
1847
|
scope: event.scope
|
|
1860
1848
|
});
|
|
1861
1849
|
if (!result2.valid) {
|
|
1862
1850
|
ctx.addIssue({
|
|
1863
|
-
code:
|
|
1851
|
+
code: z13.ZodIssueCode.custom,
|
|
1864
1852
|
message: result2.message ?? "Invalid thread event scope",
|
|
1865
1853
|
path: ["scope"]
|
|
1866
1854
|
});
|
|
@@ -1886,7 +1874,7 @@ var threadEventTypeValues = [
|
|
|
1886
1874
|
...systemEventTypeValues
|
|
1887
1875
|
];
|
|
1888
1876
|
var threadEventTypeSet = new Set(threadEventTypeValues);
|
|
1889
|
-
var threadEventTypeSchema =
|
|
1877
|
+
var threadEventTypeSchema = z13.string().refine(
|
|
1890
1878
|
(value) => threadEventTypeSet.has(value),
|
|
1891
1879
|
"Invalid thread event type"
|
|
1892
1880
|
);
|
|
@@ -1909,95 +1897,95 @@ function parseNamespacedGlyph(glyph) {
|
|
|
1909
1897
|
}
|
|
1910
1898
|
|
|
1911
1899
|
// ../domain/src/provider-fork.ts
|
|
1912
|
-
import { z as
|
|
1900
|
+
import { z as z14 } from "zod";
|
|
1913
1901
|
var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
|
|
1914
|
-
var providerForkSchema =
|
|
1902
|
+
var providerForkSchema = z14.enum(PROVIDER_FORK_VALUES);
|
|
1915
1903
|
|
|
1916
1904
|
// ../domain/src/provider-types.ts
|
|
1917
|
-
import { z as
|
|
1918
|
-
var modelReasoningEffortSchema =
|
|
1905
|
+
import { z as z15 } from "zod";
|
|
1906
|
+
var modelReasoningEffortSchema = z15.object({
|
|
1919
1907
|
reasoningEffort: reasoningLevelSchema,
|
|
1920
|
-
description:
|
|
1921
|
-
});
|
|
1922
|
-
var availableModelSchema =
|
|
1923
|
-
id:
|
|
1924
|
-
model:
|
|
1925
|
-
displayName:
|
|
1926
|
-
routeProviderId:
|
|
1927
|
-
description:
|
|
1928
|
-
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),
|
|
1929
1917
|
defaultReasoningEffort: reasoningLevelSchema,
|
|
1930
|
-
isDefault:
|
|
1931
|
-
});
|
|
1932
|
-
var providerModelCatalogScopeSchema =
|
|
1933
|
-
var providerCapabilitiesSchema =
|
|
1934
|
-
supportsThreadArchive:
|
|
1935
|
-
supportsThreadRename:
|
|
1936
|
-
supportsServiceTier:
|
|
1937
|
-
supportsNativeUserQuestion:
|
|
1938
|
-
supportsFork:
|
|
1939
|
-
supportsSessionRewind:
|
|
1940
|
-
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),
|
|
1941
1929
|
modelCatalogScope: providerModelCatalogScopeSchema
|
|
1942
1930
|
});
|
|
1943
|
-
var providerComposerCommandSchema =
|
|
1931
|
+
var providerComposerCommandSchema = z15.object({
|
|
1944
1932
|
trigger: promptMentionCommandTriggerSchema,
|
|
1945
|
-
name:
|
|
1946
|
-
trailingText:
|
|
1933
|
+
name: z15.string().min(1).regex(/^[^\s/$]+$/u),
|
|
1934
|
+
trailingText: z15.string().regex(/^\s*$/u)
|
|
1947
1935
|
});
|
|
1948
|
-
var providerComposerActionSchema =
|
|
1949
|
-
|
|
1950
|
-
kind:
|
|
1936
|
+
var providerComposerActionSchema = z15.discriminatedUnion("kind", [
|
|
1937
|
+
z15.object({
|
|
1938
|
+
kind: z15.literal("skills"),
|
|
1951
1939
|
trigger: promptMentionCommandTriggerSchema
|
|
1952
1940
|
}),
|
|
1953
|
-
|
|
1954
|
-
kind:
|
|
1941
|
+
z15.object({
|
|
1942
|
+
kind: z15.literal("plan"),
|
|
1955
1943
|
command: providerComposerCommandSchema
|
|
1956
1944
|
}),
|
|
1957
|
-
|
|
1958
|
-
kind:
|
|
1945
|
+
z15.object({
|
|
1946
|
+
kind: z15.literal("goal"),
|
|
1959
1947
|
command: providerComposerCommandSchema
|
|
1960
1948
|
})
|
|
1961
1949
|
]);
|
|
1962
|
-
var providerStringsSchema =
|
|
1963
|
-
signInHint:
|
|
1964
|
-
expiredHint:
|
|
1965
|
-
installUrl:
|
|
1966
|
-
brandPrefix:
|
|
1967
|
-
planModeCopy:
|
|
1968
|
-
iconTint:
|
|
1969
|
-
});
|
|
1970
|
-
var providerOptionDescriptorSchema =
|
|
1971
|
-
id:
|
|
1972
|
-
label:
|
|
1973
|
-
description:
|
|
1974
|
-
});
|
|
1975
|
-
var providerExtensionKindInfoSchema =
|
|
1976
|
-
item:
|
|
1977
|
-
state:
|
|
1978
|
-
});
|
|
1979
|
-
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(
|
|
1980
1968
|
extensionKindSchema,
|
|
1981
1969
|
providerExtensionKindInfoSchema
|
|
1982
1970
|
);
|
|
1983
|
-
var providerInfoSchema =
|
|
1984
|
-
id:
|
|
1985
|
-
pluginId:
|
|
1986
|
-
displayName:
|
|
1987
|
-
family:
|
|
1988
|
-
icon:
|
|
1989
|
-
logoUrl:
|
|
1990
|
-
maintenance:
|
|
1991
|
-
health:
|
|
1992
|
-
usage:
|
|
1993
|
-
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()
|
|
1994
1982
|
}),
|
|
1995
1983
|
capabilities: providerCapabilitiesSchema,
|
|
1996
|
-
composerActions:
|
|
1997
|
-
available:
|
|
1984
|
+
composerActions: z15.array(providerComposerActionSchema),
|
|
1985
|
+
available: z15.boolean(),
|
|
1998
1986
|
strings: providerStringsSchema.optional(),
|
|
1999
|
-
serviceTiers:
|
|
2000
|
-
reasoningLevels:
|
|
1987
|
+
serviceTiers: z15.array(providerOptionDescriptorSchema).optional(),
|
|
1988
|
+
reasoningLevels: z15.array(providerOptionDescriptorSchema).optional(),
|
|
2001
1989
|
extensionKinds: providerExtensionKindsSchema.optional()
|
|
2002
1990
|
});
|
|
2003
1991
|
var providerRecoveryKindValues = [
|
|
@@ -2007,151 +1995,151 @@ var providerRecoveryKindValues = [
|
|
|
2007
1995
|
"staleTurn",
|
|
2008
1996
|
"rateLimited"
|
|
2009
1997
|
];
|
|
2010
|
-
var providerRecoveryKindSchema =
|
|
2011
|
-
var toolCallOutputItemSchema =
|
|
2012
|
-
|
|
2013
|
-
type:
|
|
2014
|
-
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()
|
|
2015
2003
|
}),
|
|
2016
|
-
|
|
2017
|
-
type:
|
|
2018
|
-
imageUrl:
|
|
2004
|
+
z15.object({
|
|
2005
|
+
type: z15.literal("inputImage"),
|
|
2006
|
+
imageUrl: z15.string()
|
|
2019
2007
|
})
|
|
2020
2008
|
]);
|
|
2021
|
-
var toolCallRequestSchema =
|
|
2022
|
-
requestId:
|
|
2023
|
-
threadId:
|
|
2024
|
-
providerThreadId:
|
|
2025
|
-
turnId:
|
|
2026
|
-
callId:
|
|
2027
|
-
tool:
|
|
2028
|
-
arguments:
|
|
2029
|
-
});
|
|
2030
|
-
var toolCallResponseSchema =
|
|
2031
|
-
contentItems:
|
|
2032
|
-
success:
|
|
2033
|
-
});
|
|
2034
|
-
var dynamicToolSchema =
|
|
2035
|
-
name:
|
|
2036
|
-
description:
|
|
2037
|
-
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(),
|
|
2038
2026
|
presentation: threadEventItemPresentationSchema.optional()
|
|
2039
2027
|
});
|
|
2040
2028
|
|
|
2041
2029
|
// ../provider-bridge-protocol/src/thread-delta.ts
|
|
2042
|
-
import { z as
|
|
2030
|
+
import { z as z16 } from "zod";
|
|
2043
2031
|
var THREAD_DELTA_NOTIFICATION_METHOD = "thread/delta";
|
|
2044
2032
|
var deltaPresentationSchema = threadEventItemPresentationSchema;
|
|
2045
2033
|
var THREAD_DELTA_KEY_SEPARATOR = "";
|
|
2046
|
-
var deltaKeyPartSchema =
|
|
2034
|
+
var deltaKeyPartSchema = z16.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
|
|
2047
2035
|
message: "provider keys must not contain the internal key separator (\\u001f)"
|
|
2048
2036
|
});
|
|
2049
|
-
var deltaItemKeySchema =
|
|
2037
|
+
var deltaItemKeySchema = z16.object({
|
|
2050
2038
|
providerItemId: deltaKeyPartSchema.optional(),
|
|
2051
2039
|
channel: deltaKeyPartSchema.optional(),
|
|
2052
2040
|
parentRef: deltaKeyPartSchema.optional()
|
|
2053
2041
|
});
|
|
2054
2042
|
var providerTurnIdSchema = deltaKeyPartSchema;
|
|
2055
|
-
var deltaFileChangeSchema =
|
|
2056
|
-
path:
|
|
2057
|
-
kind:
|
|
2058
|
-
movePath:
|
|
2059
|
-
diff:
|
|
2060
|
-
oldText:
|
|
2061
|
-
newText:
|
|
2062
|
-
});
|
|
2063
|
-
var deltaBackgroundTaskShapeSchema =
|
|
2064
|
-
type:
|
|
2065
|
-
familyId:
|
|
2066
|
-
taskType:
|
|
2067
|
-
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(),
|
|
2068
2056
|
status: threadEventItemStatusSchema,
|
|
2069
2057
|
taskStatus: backgroundTaskStatusSchema,
|
|
2070
|
-
skipTranscript:
|
|
2071
|
-
workflowName:
|
|
2058
|
+
skipTranscript: z16.boolean(),
|
|
2059
|
+
workflowName: z16.string().optional(),
|
|
2072
2060
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
2073
2061
|
usage: backgroundTaskUsageSchema.optional(),
|
|
2074
|
-
summary:
|
|
2075
|
-
error:
|
|
2076
|
-
outputFile:
|
|
2062
|
+
summary: z16.string().optional(),
|
|
2063
|
+
error: z16.string().optional(),
|
|
2064
|
+
outputFile: z16.string().optional()
|
|
2077
2065
|
});
|
|
2078
|
-
var deltaFileReadShapeSchema =
|
|
2079
|
-
type:
|
|
2080
|
-
path:
|
|
2081
|
-
cmd:
|
|
2066
|
+
var deltaFileReadShapeSchema = z16.object({
|
|
2067
|
+
type: z16.literal("fileRead"),
|
|
2068
|
+
path: z16.string(),
|
|
2069
|
+
cmd: z16.string().optional()
|
|
2082
2070
|
});
|
|
2083
|
-
var deltaSearchShapeSchema =
|
|
2084
|
-
type:
|
|
2071
|
+
var deltaSearchShapeSchema = z16.object({
|
|
2072
|
+
type: z16.literal("search"),
|
|
2085
2073
|
mode: threadEventSearchModeSchema,
|
|
2086
|
-
query:
|
|
2087
|
-
path:
|
|
2088
|
-
cmd:
|
|
2074
|
+
query: z16.string(),
|
|
2075
|
+
path: z16.string().optional(),
|
|
2076
|
+
cmd: z16.string().optional()
|
|
2089
2077
|
});
|
|
2090
|
-
var deltaDelegationShapeSchema =
|
|
2091
|
-
type:
|
|
2078
|
+
var deltaDelegationShapeSchema = z16.object({
|
|
2079
|
+
type: z16.literal("delegation"),
|
|
2092
2080
|
childRef: deltaKeyPartSchema,
|
|
2093
|
-
label:
|
|
2094
|
-
background:
|
|
2095
|
-
summary:
|
|
2081
|
+
label: z16.string(),
|
|
2082
|
+
background: z16.boolean(),
|
|
2083
|
+
summary: z16.string().optional()
|
|
2096
2084
|
});
|
|
2097
|
-
var deltaPlanStepsShapeSchema =
|
|
2098
|
-
type:
|
|
2099
|
-
steps:
|
|
2100
|
-
explanation:
|
|
2085
|
+
var deltaPlanStepsShapeSchema = z16.object({
|
|
2086
|
+
type: z16.literal("planSteps"),
|
|
2087
|
+
steps: z16.array(threadEventPlanStepSchema),
|
|
2088
|
+
explanation: z16.string().optional()
|
|
2101
2089
|
});
|
|
2102
|
-
var deltaExtensionShapeSchema =
|
|
2103
|
-
type:
|
|
2090
|
+
var deltaExtensionShapeSchema = z16.object({
|
|
2091
|
+
type: z16.literal("extension"),
|
|
2104
2092
|
kind: extensionKindSchema,
|
|
2105
2093
|
payload: jsonValueSchema
|
|
2106
2094
|
});
|
|
2107
|
-
var deltaItemShapeSchema =
|
|
2108
|
-
|
|
2109
|
-
type:
|
|
2110
|
-
command:
|
|
2111
|
-
cwd:
|
|
2112
|
-
aggregatedOutput:
|
|
2113
|
-
exitCode:
|
|
2114
|
-
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()
|
|
2115
2103
|
}),
|
|
2116
|
-
|
|
2117
|
-
type:
|
|
2118
|
-
changes:
|
|
2104
|
+
z16.object({
|
|
2105
|
+
type: z16.literal("fileChange"),
|
|
2106
|
+
changes: z16.array(deltaFileChangeSchema)
|
|
2119
2107
|
}),
|
|
2120
|
-
|
|
2121
|
-
type:
|
|
2122
|
-
tool:
|
|
2123
|
-
server:
|
|
2124
|
-
args:
|
|
2125
|
-
result:
|
|
2126
|
-
error:
|
|
2127
|
-
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()
|
|
2128
2116
|
}),
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
type:
|
|
2133
|
-
summary:
|
|
2134
|
-
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())
|
|
2135
2123
|
}),
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
type:
|
|
2139
|
-
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)
|
|
2140
2128
|
}),
|
|
2141
|
-
|
|
2142
|
-
type:
|
|
2143
|
-
url:
|
|
2144
|
-
prompt:
|
|
2145
|
-
pattern:
|
|
2129
|
+
z16.object({
|
|
2130
|
+
type: z16.literal("webFetch"),
|
|
2131
|
+
url: z16.string(),
|
|
2132
|
+
prompt: z16.string().nullable().optional(),
|
|
2133
|
+
pattern: z16.string().nullable()
|
|
2146
2134
|
}),
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
type:
|
|
2150
|
-
prompt:
|
|
2151
|
-
path:
|
|
2152
|
-
result:
|
|
2153
|
-
error:
|
|
2154
|
-
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()
|
|
2155
2143
|
}),
|
|
2156
2144
|
deltaBackgroundTaskShapeSchema,
|
|
2157
2145
|
deltaFileReadShapeSchema,
|
|
@@ -2160,22 +2148,22 @@ var deltaItemShapeSchema = z15.discriminatedUnion("type", [
|
|
|
2160
2148
|
deltaPlanStepsShapeSchema,
|
|
2161
2149
|
deltaExtensionShapeSchema
|
|
2162
2150
|
]);
|
|
2163
|
-
var deltaProgressSnapshotSchema =
|
|
2151
|
+
var deltaProgressSnapshotSchema = z16.discriminatedUnion("type", [
|
|
2164
2152
|
deltaBackgroundTaskShapeSchema,
|
|
2165
2153
|
deltaDelegationShapeSchema
|
|
2166
2154
|
]);
|
|
2167
|
-
var deltaTextChannelSchema =
|
|
2155
|
+
var deltaTextChannelSchema = z16.enum([
|
|
2168
2156
|
"agentMessage",
|
|
2169
2157
|
"reasoningSummary",
|
|
2170
2158
|
"reasoningText",
|
|
2171
2159
|
"plan"
|
|
2172
2160
|
]);
|
|
2173
|
-
var deltaOutputChannelSchema =
|
|
2174
|
-
var deltaErrorSchema =
|
|
2175
|
-
var deltaAttachSchema =
|
|
2176
|
-
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({
|
|
2177
2165
|
raw: providerRawEventSchema,
|
|
2178
|
-
rawType:
|
|
2166
|
+
rawType: z16.string()
|
|
2179
2167
|
});
|
|
2180
2168
|
function requireExtensionPresentation(delta, ctx) {
|
|
2181
2169
|
if (delta.item.type === "extension" && delta.presentation === void 0) {
|
|
@@ -2186,32 +2174,32 @@ function requireExtensionPresentation(delta, ctx) {
|
|
|
2186
2174
|
});
|
|
2187
2175
|
}
|
|
2188
2176
|
}
|
|
2189
|
-
var threadDeltaSchema =
|
|
2190
|
-
|
|
2191
|
-
kind:
|
|
2177
|
+
var threadDeltaSchema = z16.discriminatedUnion("kind", [
|
|
2178
|
+
z16.object({
|
|
2179
|
+
kind: z16.literal("input.accepted"),
|
|
2192
2180
|
clientRequestId: clientTurnRequestIdSchema,
|
|
2193
2181
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2194
2182
|
}),
|
|
2195
|
-
|
|
2196
|
-
kind:
|
|
2197
|
-
text:
|
|
2183
|
+
z16.object({
|
|
2184
|
+
kind: z16.literal("input.provider"),
|
|
2185
|
+
text: z16.string().min(1),
|
|
2198
2186
|
parentRef: deltaKeyPartSchema.optional()
|
|
2199
2187
|
}),
|
|
2200
|
-
|
|
2201
|
-
kind:
|
|
2188
|
+
z16.object({
|
|
2189
|
+
kind: z16.literal("turn.open"),
|
|
2202
2190
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2203
2191
|
parentRef: deltaKeyPartSchema.optional()
|
|
2204
2192
|
}),
|
|
2205
|
-
|
|
2206
|
-
kind:
|
|
2193
|
+
z16.object({
|
|
2194
|
+
kind: z16.literal("turn.boundary"),
|
|
2207
2195
|
status: threadEventTurnStatusSchema,
|
|
2208
2196
|
error: deltaErrorSchema.optional(),
|
|
2209
|
-
providerCheckpointId:
|
|
2210
|
-
claimIfIdle:
|
|
2197
|
+
providerCheckpointId: z16.string().min(1).optional(),
|
|
2198
|
+
claimIfIdle: z16.boolean().optional(),
|
|
2211
2199
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2212
2200
|
}),
|
|
2213
|
-
|
|
2214
|
-
kind:
|
|
2201
|
+
z16.object({
|
|
2202
|
+
kind: z16.literal("item.open"),
|
|
2215
2203
|
key: deltaItemKeySchema,
|
|
2216
2204
|
item: deltaItemShapeSchema,
|
|
2217
2205
|
presentation: deltaPresentationSchema.optional(),
|
|
@@ -2219,139 +2207,140 @@ var threadDeltaSchema = z15.discriminatedUnion("kind", [
|
|
|
2219
2207
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2220
2208
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2221
2209
|
}).superRefine(requireExtensionPresentation),
|
|
2222
|
-
|
|
2223
|
-
kind:
|
|
2210
|
+
z16.object({
|
|
2211
|
+
kind: z16.literal("item.close"),
|
|
2224
2212
|
key: deltaItemKeySchema,
|
|
2225
2213
|
status: threadEventItemStatusSchema,
|
|
2226
|
-
resultText:
|
|
2227
|
-
exitCode:
|
|
2228
|
-
aggregatedOutput:
|
|
2229
|
-
approvalStatus:
|
|
2214
|
+
resultText: z16.string().optional(),
|
|
2215
|
+
exitCode: z16.number().optional(),
|
|
2216
|
+
aggregatedOutput: z16.string().optional(),
|
|
2217
|
+
approvalStatus: z16.literal("denied").optional(),
|
|
2230
2218
|
item: deltaItemShapeSchema,
|
|
2231
2219
|
presentation: deltaPresentationSchema.optional(),
|
|
2232
2220
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2233
2221
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2234
2222
|
}).superRefine(requireExtensionPresentation),
|
|
2235
|
-
|
|
2236
|
-
kind:
|
|
2223
|
+
z16.object({
|
|
2224
|
+
kind: z16.literal("item.progress"),
|
|
2237
2225
|
key: deltaItemKeySchema,
|
|
2238
|
-
message:
|
|
2226
|
+
message: z16.string().optional(),
|
|
2239
2227
|
snapshot: deltaProgressSnapshotSchema.optional(),
|
|
2240
|
-
flush:
|
|
2228
|
+
flush: z16.boolean().optional(),
|
|
2241
2229
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2242
2230
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2243
2231
|
}),
|
|
2244
|
-
|
|
2245
|
-
kind:
|
|
2232
|
+
z16.object({
|
|
2233
|
+
kind: z16.literal("item.textDelta"),
|
|
2246
2234
|
key: deltaItemKeySchema,
|
|
2247
2235
|
channel: deltaTextChannelSchema,
|
|
2248
|
-
text:
|
|
2236
|
+
text: z16.string(),
|
|
2249
2237
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2250
2238
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2251
2239
|
}),
|
|
2252
|
-
|
|
2253
|
-
kind:
|
|
2240
|
+
z16.object({
|
|
2241
|
+
kind: z16.literal("item.textClose"),
|
|
2254
2242
|
key: deltaItemKeySchema,
|
|
2255
2243
|
channel: deltaTextChannelSchema,
|
|
2256
|
-
text:
|
|
2244
|
+
text: z16.string().optional(),
|
|
2257
2245
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2258
2246
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2259
2247
|
}),
|
|
2260
|
-
|
|
2261
|
-
kind:
|
|
2248
|
+
z16.object({
|
|
2249
|
+
kind: z16.literal("item.outputDelta"),
|
|
2262
2250
|
key: deltaItemKeySchema,
|
|
2263
2251
|
channel: deltaOutputChannelSchema,
|
|
2264
|
-
text:
|
|
2252
|
+
text: z16.string(),
|
|
2265
2253
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2266
2254
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2267
2255
|
}),
|
|
2268
|
-
|
|
2269
|
-
kind:
|
|
2256
|
+
z16.object({
|
|
2257
|
+
kind: z16.literal("command.outputSnapshot"),
|
|
2270
2258
|
key: deltaItemKeySchema,
|
|
2271
|
-
text:
|
|
2259
|
+
text: z16.string(),
|
|
2272
2260
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2273
2261
|
}),
|
|
2274
|
-
|
|
2275
|
-
kind:
|
|
2262
|
+
z16.object({
|
|
2263
|
+
kind: z16.literal("usage"),
|
|
2276
2264
|
total: threadEventTokenUsageBreakdownSchema,
|
|
2277
2265
|
last: threadEventTokenUsageBreakdownSchema,
|
|
2278
|
-
modelContextWindow:
|
|
2266
|
+
modelContextWindow: z16.number().nullable(),
|
|
2279
2267
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2280
2268
|
}),
|
|
2281
|
-
|
|
2282
|
-
kind:
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
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(),
|
|
2286
2275
|
attach: deltaAttachSchema,
|
|
2287
2276
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2288
2277
|
}),
|
|
2289
|
-
|
|
2290
|
-
kind:
|
|
2278
|
+
z16.object({
|
|
2279
|
+
kind: z16.literal("context.compacted"),
|
|
2291
2280
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2292
2281
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2293
2282
|
}),
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
kind:
|
|
2297
|
-
diff:
|
|
2283
|
+
z16.object({ kind: z16.literal("context.cleared") }),
|
|
2284
|
+
z16.object({
|
|
2285
|
+
kind: z16.literal("turn.diff"),
|
|
2286
|
+
diff: z16.string(),
|
|
2298
2287
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2299
2288
|
}),
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
kind:
|
|
2303
|
-
providerThreadId:
|
|
2289
|
+
z16.object({ kind: z16.literal("thread.started") }),
|
|
2290
|
+
z16.object({
|
|
2291
|
+
kind: z16.literal("thread.identity"),
|
|
2292
|
+
providerThreadId: z16.string().min(1)
|
|
2304
2293
|
}),
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
kind:
|
|
2294
|
+
z16.object({ kind: z16.literal("thread.name"), name: z16.string().min(1) }),
|
|
2295
|
+
z16.object({
|
|
2296
|
+
kind: z16.literal("extension.state"),
|
|
2308
2297
|
extensionKind: extensionKindSchema,
|
|
2309
2298
|
payload: jsonValueSchema
|
|
2310
2299
|
}),
|
|
2311
|
-
|
|
2312
|
-
kind:
|
|
2300
|
+
z16.object({
|
|
2301
|
+
kind: z16.literal("provider.rateLimits"),
|
|
2313
2302
|
rateLimits: providerRateLimitStateSchema
|
|
2314
2303
|
}),
|
|
2315
|
-
|
|
2316
|
-
kind:
|
|
2317
|
-
message:
|
|
2318
|
-
detail:
|
|
2319
|
-
willRetry:
|
|
2304
|
+
z16.object({
|
|
2305
|
+
kind: z16.literal("provider.error"),
|
|
2306
|
+
message: z16.string(),
|
|
2307
|
+
detail: z16.string().optional(),
|
|
2308
|
+
willRetry: z16.boolean().optional(),
|
|
2320
2309
|
category: providerErrorCategorySchema.optional(),
|
|
2321
2310
|
errorInfo: providerErrorInfoSchema.optional(),
|
|
2322
|
-
settlesTurn:
|
|
2311
|
+
settlesTurn: z16.boolean().optional(),
|
|
2323
2312
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2324
|
-
threadScoped:
|
|
2313
|
+
threadScoped: z16.boolean().optional()
|
|
2325
2314
|
}),
|
|
2326
|
-
|
|
2327
|
-
kind:
|
|
2328
|
-
originalModel:
|
|
2329
|
-
fallbackModel:
|
|
2330
|
-
reason:
|
|
2331
|
-
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()
|
|
2332
2321
|
}),
|
|
2333
|
-
|
|
2334
|
-
kind:
|
|
2335
|
-
summary:
|
|
2336
|
-
details:
|
|
2322
|
+
z16.object({
|
|
2323
|
+
kind: z16.literal("provider.warning"),
|
|
2324
|
+
summary: z16.string().optional(),
|
|
2325
|
+
details: z16.string().optional(),
|
|
2337
2326
|
category: threadEventWarningCategorySchema.optional(),
|
|
2338
|
-
vouchedTurn:
|
|
2327
|
+
vouchedTurn: z16.boolean().optional()
|
|
2339
2328
|
}),
|
|
2340
|
-
|
|
2341
|
-
kind:
|
|
2329
|
+
z16.object({
|
|
2330
|
+
kind: z16.literal("unhandled"),
|
|
2342
2331
|
raw: providerRawEventSchema,
|
|
2343
|
-
rawType:
|
|
2344
|
-
vouchedTurn:
|
|
2345
|
-
onlyIfNoTurn:
|
|
2332
|
+
rawType: z16.string(),
|
|
2333
|
+
vouchedTurn: z16.boolean(),
|
|
2334
|
+
onlyIfNoTurn: z16.boolean().optional(),
|
|
2346
2335
|
parentRef: deltaKeyPartSchema.optional(),
|
|
2347
2336
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2348
2337
|
}),
|
|
2349
|
-
|
|
2350
|
-
|
|
2338
|
+
z16.object({ kind: z16.literal("session.ended") }),
|
|
2339
|
+
z16.object({ kind: z16.literal("session.reset") })
|
|
2351
2340
|
]);
|
|
2352
|
-
var threadDeltaNotificationParamsSchema =
|
|
2353
|
-
threadId:
|
|
2354
|
-
deltas:
|
|
2341
|
+
var threadDeltaNotificationParamsSchema = z16.object({
|
|
2342
|
+
threadId: z16.string().min(1),
|
|
2343
|
+
deltas: z16.array(threadDeltaSchema)
|
|
2355
2344
|
}).passthrough();
|
|
2356
2345
|
|
|
2357
2346
|
// ../provider-bridge-protocol/src/assembler/delta-assembler.ts
|
|
@@ -2362,17 +2351,17 @@ var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
|
|
|
2362
2351
|
var THREAD_DELTA_GRAMMAR_V3 = 3;
|
|
2363
2352
|
|
|
2364
2353
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
2365
|
-
import { z as
|
|
2354
|
+
import { z as z18 } from "zod";
|
|
2366
2355
|
|
|
2367
2356
|
// ../provider-bridge-protocol/src/bridge-kit/tool-arg-schemas.ts
|
|
2368
|
-
import { z as
|
|
2369
|
-
var bashArgsSchema =
|
|
2370
|
-
command:
|
|
2371
|
-
cwd:
|
|
2357
|
+
import { z as z17 } from "zod";
|
|
2358
|
+
var bashArgsSchema = z17.object({
|
|
2359
|
+
command: z17.string().optional(),
|
|
2360
|
+
cwd: z17.string().optional()
|
|
2372
2361
|
}).passthrough();
|
|
2373
|
-
var textBlockSchema =
|
|
2374
|
-
type:
|
|
2375
|
-
text:
|
|
2362
|
+
var textBlockSchema = z17.object({
|
|
2363
|
+
type: z17.literal("text"),
|
|
2364
|
+
text: z17.string()
|
|
2376
2365
|
});
|
|
2377
2366
|
|
|
2378
2367
|
// ../provider-bridge-protocol/src/bridge-kit/provider-visibility-helpers.ts
|
|
@@ -2381,10 +2370,10 @@ function isRecord(value) {
|
|
|
2381
2370
|
}
|
|
2382
2371
|
|
|
2383
2372
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
2384
|
-
var contentWrapperSchema =
|
|
2385
|
-
content:
|
|
2373
|
+
var contentWrapperSchema = z18.object({
|
|
2374
|
+
content: z18.array(z18.unknown())
|
|
2386
2375
|
}).passthrough();
|
|
2387
|
-
var shellEnvironmentVariableKeySchema =
|
|
2376
|
+
var shellEnvironmentVariableKeySchema = z18.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
|
|
2388
2377
|
var MAX_EXACT_LINE_DIFF_CELLS = 1e6;
|
|
2389
2378
|
function splitComparableLines(text) {
|
|
2390
2379
|
const normalized = text.replace(/\r\n?/gu, "\n");
|
|
@@ -3923,9 +3912,10 @@ function createDeltaAssembler(options) {
|
|
|
3923
3912
|
providerThreadId: "",
|
|
3924
3913
|
scope: turnId === void 0 ? threadScope() : turnScope(turnId),
|
|
3925
3914
|
contextWindowUsage: {
|
|
3926
|
-
usedTokens: delta.used,
|
|
3927
|
-
modelContextWindow: delta.size ?? null,
|
|
3928
|
-
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 } : {}
|
|
3929
3919
|
}
|
|
3930
3920
|
});
|
|
3931
3921
|
return;
|
|
@@ -4230,11 +4220,11 @@ function toConformanceMessages() {
|
|
|
4230
4220
|
}
|
|
4231
4221
|
|
|
4232
4222
|
// ../provider-bridge-protocol/src/conformance/client.ts
|
|
4233
|
-
import { z as
|
|
4223
|
+
import { z as z19 } from "zod";
|
|
4234
4224
|
function isWireMessage(value) {
|
|
4235
4225
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4236
4226
|
}
|
|
4237
|
-
var threadDeltaAddressSchema =
|
|
4227
|
+
var threadDeltaAddressSchema = z19.object({ threadId: z19.string() }).passthrough();
|
|
4238
4228
|
var ConformanceClient = class {
|
|
4239
4229
|
constructor(transport, timeoutMs, collector) {
|
|
4240
4230
|
this.transport = transport;
|
|
@@ -4343,11 +4333,11 @@ function nextConformanceClientRequestId() {
|
|
|
4343
4333
|
}
|
|
4344
4334
|
|
|
4345
4335
|
// ../provider-bridge-protocol/src/conformance/scenarios.ts
|
|
4346
|
-
import { z as
|
|
4336
|
+
import { z as z27 } from "zod";
|
|
4347
4337
|
|
|
4348
4338
|
// ../provider-bridge-protocol/src/handshake.ts
|
|
4349
|
-
import { z as
|
|
4350
|
-
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, {
|
|
4351
4341
|
message: "grammarVersions must be an ascending [min, max] range"
|
|
4352
4342
|
});
|
|
4353
4343
|
function negotiateGrammarVersion(runtime, bridge) {
|
|
@@ -4355,62 +4345,62 @@ function negotiateGrammarVersion(runtime, bridge) {
|
|
|
4355
4345
|
const max = Math.min(runtime[1], bridge[1]);
|
|
4356
4346
|
return min <= max ? max : null;
|
|
4357
4347
|
}
|
|
4358
|
-
var bridgeSteerModeSchema =
|
|
4359
|
-
var bridgeCapabilitiesSchema =
|
|
4360
|
-
sessionRestore:
|
|
4361
|
-
threadArchive:
|
|
4362
|
-
threadRename:
|
|
4363
|
-
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),
|
|
4364
4354
|
fork: providerForkSchema.default("none"),
|
|
4365
|
-
approvalEnforcedBy:
|
|
4355
|
+
approvalEnforcedBy: z20.enum(["runtime", "provider"]).default("runtime"),
|
|
4366
4356
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4367
4357
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4368
4358
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4369
4359
|
]),
|
|
4370
4360
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
4371
|
-
skills:
|
|
4361
|
+
skills: z20.object({ configure: z20.boolean().default(false) }).default({ configure: false })
|
|
4372
4362
|
}).passthrough();
|
|
4373
|
-
var initializeParamsSchema =
|
|
4374
|
-
protocolVersion:
|
|
4375
|
-
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) }),
|
|
4376
4366
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
4377
4367
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
4378
4368
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
4379
4369
|
])
|
|
4380
4370
|
}).passthrough();
|
|
4381
|
-
var initializeResultSchema =
|
|
4382
|
-
protocolVersion:
|
|
4383
|
-
capabilities:
|
|
4371
|
+
var initializeResultSchema = z20.object({
|
|
4372
|
+
protocolVersion: z20.number().int().positive(),
|
|
4373
|
+
capabilities: z20.preprocess(
|
|
4384
4374
|
(value) => value ?? {},
|
|
4385
4375
|
bridgeCapabilitiesSchema
|
|
4386
4376
|
)
|
|
4387
4377
|
}).passthrough();
|
|
4388
4378
|
|
|
4389
4379
|
// ../provider-bridge-protocol/src/execution-options.ts
|
|
4390
|
-
import { z as
|
|
4391
|
-
var bridgeExecutionOptionsSchema =
|
|
4392
|
-
model:
|
|
4380
|
+
import { z as z21 } from "zod";
|
|
4381
|
+
var bridgeExecutionOptionsSchema = z21.object({
|
|
4382
|
+
model: z21.string().min(1).optional(),
|
|
4393
4383
|
serviceTier: serviceTierSchema.optional(),
|
|
4394
4384
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
4395
4385
|
promptMode: promptModeSchema.optional(),
|
|
4396
|
-
instructions:
|
|
4397
|
-
envVars:
|
|
4398
|
-
providerOptions:
|
|
4386
|
+
instructions: z21.string().optional(),
|
|
4387
|
+
envVars: z21.record(z21.string(), z21.string()).optional(),
|
|
4388
|
+
providerOptions: z21.record(z21.string(), z21.unknown()).optional()
|
|
4399
4389
|
}).and(runtimePermissionPolicySchema);
|
|
4400
4390
|
|
|
4401
4391
|
// ../provider-bridge-protocol/src/provider-maintenance.ts
|
|
4402
|
-
import { z as
|
|
4403
|
-
var providerMaintenanceParamsSchema =
|
|
4404
|
-
providerId:
|
|
4405
|
-
cwd:
|
|
4406
|
-
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()
|
|
4407
4397
|
}).passthrough();
|
|
4408
|
-
var providerInstallationRequirementSchema =
|
|
4398
|
+
var providerInstallationRequirementSchema = z22.enum(["thread_rewind"]);
|
|
4409
4399
|
var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4410
4400
|
requirement: providerInstallationRequirementSchema.optional()
|
|
4411
4401
|
});
|
|
4412
|
-
var providerHealthSchema =
|
|
4413
|
-
status:
|
|
4402
|
+
var providerHealthSchema = z22.object({
|
|
4403
|
+
status: z22.enum([
|
|
4414
4404
|
"ready",
|
|
4415
4405
|
"not_installed",
|
|
4416
4406
|
"unauthenticated",
|
|
@@ -4418,114 +4408,114 @@ var providerHealthSchema = z21.object({
|
|
|
4418
4408
|
"unsupported_version",
|
|
4419
4409
|
"unknown"
|
|
4420
4410
|
]),
|
|
4421
|
-
statusMessage:
|
|
4422
|
-
accountEmail:
|
|
4423
|
-
planLabel:
|
|
4424
|
-
installedVersion:
|
|
4425
|
-
minimumSupportedVersion:
|
|
4426
|
-
canInstall:
|
|
4427
|
-
canUpdate:
|
|
4428
|
-
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()
|
|
4429
4419
|
}).passthrough();
|
|
4430
|
-
var providerUsageWindowSchema =
|
|
4431
|
-
label:
|
|
4432
|
-
usedPercent:
|
|
4433
|
-
resetsAt:
|
|
4434
|
-
cost:
|
|
4435
|
-
usedUsdCents:
|
|
4436
|
-
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()
|
|
4437
4427
|
}).optional()
|
|
4438
4428
|
}).passthrough();
|
|
4439
|
-
var providerUsageSchema =
|
|
4440
|
-
|
|
4441
|
-
status:
|
|
4442
|
-
accountEmail:
|
|
4443
|
-
planLabel:
|
|
4444
|
-
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)
|
|
4445
4435
|
}).passthrough(),
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
status:
|
|
4451
|
-
message:
|
|
4452
|
-
planLabel:
|
|
4453
|
-
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)
|
|
4454
4444
|
}).passthrough()
|
|
4455
4445
|
]);
|
|
4456
|
-
var providerHealthResultSchema =
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
supported:
|
|
4446
|
+
var providerHealthResultSchema = z22.discriminatedUnion("supported", [
|
|
4447
|
+
z22.object({ supported: z22.literal(false) }).passthrough(),
|
|
4448
|
+
z22.object({
|
|
4449
|
+
supported: z22.literal(true),
|
|
4460
4450
|
health: providerHealthSchema
|
|
4461
4451
|
}).passthrough()
|
|
4462
4452
|
]);
|
|
4463
|
-
var providerUsageResultSchema =
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
supported:
|
|
4453
|
+
var providerUsageResultSchema = z22.discriminatedUnion("supported", [
|
|
4454
|
+
z22.object({ supported: z22.literal(false) }).passthrough(),
|
|
4455
|
+
z22.object({
|
|
4456
|
+
supported: z22.literal(true),
|
|
4467
4457
|
usage: providerUsageSchema
|
|
4468
4458
|
}).passthrough()
|
|
4469
4459
|
]);
|
|
4470
|
-
var providerInstallationActionKindSchema =
|
|
4460
|
+
var providerInstallationActionKindSchema = z22.enum([
|
|
4471
4461
|
"install",
|
|
4472
4462
|
"update"
|
|
4473
4463
|
]);
|
|
4474
|
-
var providerInstallationActionSchema =
|
|
4464
|
+
var providerInstallationActionSchema = z22.object({
|
|
4475
4465
|
kind: providerInstallationActionKindSchema,
|
|
4476
|
-
label:
|
|
4477
|
-
command:
|
|
4466
|
+
label: z22.enum(["Install", "Update"]),
|
|
4467
|
+
command: z22.string().min(1)
|
|
4478
4468
|
}).passthrough();
|
|
4479
|
-
var providerInstallationSourceSchema =
|
|
4469
|
+
var providerInstallationSourceSchema = z22.enum([
|
|
4480
4470
|
"notInstalled",
|
|
4481
4471
|
"npmGlobal",
|
|
4482
4472
|
"external"
|
|
4483
4473
|
]);
|
|
4484
|
-
var providerInstallationStatusSchema =
|
|
4485
|
-
executableName:
|
|
4486
|
-
executablePath:
|
|
4487
|
-
installed:
|
|
4474
|
+
var providerInstallationStatusSchema = z22.object({
|
|
4475
|
+
executableName: z22.string().min(1),
|
|
4476
|
+
executablePath: z22.string().min(1).nullable(),
|
|
4477
|
+
installed: z22.boolean(),
|
|
4488
4478
|
installSource: providerInstallationSourceSchema,
|
|
4489
|
-
currentVersion:
|
|
4490
|
-
latestVersion:
|
|
4491
|
-
minimumSupportedVersion:
|
|
4492
|
-
npmPackageName:
|
|
4493
|
-
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(),
|
|
4494
4484
|
installAction: providerInstallationActionSchema.nullable(),
|
|
4495
|
-
needsUpdate:
|
|
4496
|
-
versionUnsupported:
|
|
4485
|
+
needsUpdate: z22.boolean(),
|
|
4486
|
+
versionUnsupported: z22.boolean()
|
|
4497
4487
|
}).passthrough();
|
|
4498
4488
|
var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
4499
4489
|
action: providerInstallationActionKindSchema
|
|
4500
4490
|
});
|
|
4501
|
-
var providerInstallationCommandSchema =
|
|
4502
|
-
command:
|
|
4503
|
-
args:
|
|
4504
|
-
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)
|
|
4505
4495
|
}).passthrough();
|
|
4506
|
-
var providerInstallationVerificationSchema =
|
|
4496
|
+
var providerInstallationVerificationSchema = z22.discriminatedUnion(
|
|
4507
4497
|
"kind",
|
|
4508
4498
|
[
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
kind:
|
|
4512
|
-
previousVersion:
|
|
4499
|
+
z22.object({ kind: z22.literal("installed") }).passthrough(),
|
|
4500
|
+
z22.object({
|
|
4501
|
+
kind: z22.literal("version_changed"),
|
|
4502
|
+
previousVersion: z22.string().min(1)
|
|
4513
4503
|
}).passthrough(),
|
|
4514
|
-
|
|
4515
|
-
kind:
|
|
4516
|
-
version:
|
|
4504
|
+
z22.object({
|
|
4505
|
+
kind: z22.literal("version_at_least"),
|
|
4506
|
+
version: z22.string().min(1)
|
|
4517
4507
|
}).passthrough()
|
|
4518
4508
|
]
|
|
4519
4509
|
);
|
|
4520
|
-
var providerInstallationRunResultSchema =
|
|
4510
|
+
var providerInstallationRunResultSchema = z22.discriminatedUnion(
|
|
4521
4511
|
"available",
|
|
4522
4512
|
[
|
|
4523
|
-
|
|
4524
|
-
available:
|
|
4525
|
-
message:
|
|
4513
|
+
z22.object({
|
|
4514
|
+
available: z22.literal(false),
|
|
4515
|
+
message: z22.string().min(1)
|
|
4526
4516
|
}).passthrough(),
|
|
4527
|
-
|
|
4528
|
-
available:
|
|
4517
|
+
z22.object({
|
|
4518
|
+
available: z22.literal(true),
|
|
4529
4519
|
command: providerInstallationCommandSchema,
|
|
4530
4520
|
verification: providerInstallationVerificationSchema
|
|
4531
4521
|
}).passthrough()
|
|
@@ -4533,7 +4523,7 @@ var providerInstallationRunResultSchema = z21.discriminatedUnion(
|
|
|
4533
4523
|
);
|
|
4534
4524
|
|
|
4535
4525
|
// ../provider-bridge-protocol/src/requests.ts
|
|
4536
|
-
import { z as
|
|
4526
|
+
import { z as z23 } from "zod";
|
|
4537
4527
|
var BRIDGE_REQUEST_METHODS = {
|
|
4538
4528
|
initialize: "initialize",
|
|
4539
4529
|
modelList: "model/list",
|
|
@@ -4555,81 +4545,77 @@ var BRIDGE_REQUEST_METHODS = {
|
|
|
4555
4545
|
skillsConfigure: "skills/configure"
|
|
4556
4546
|
};
|
|
4557
4547
|
var sessionConstructionFields = {
|
|
4558
|
-
threadId:
|
|
4559
|
-
cwd:
|
|
4548
|
+
threadId: z23.string().min(1),
|
|
4549
|
+
cwd: z23.string().min(1),
|
|
4560
4550
|
options: bridgeExecutionOptionsSchema,
|
|
4561
|
-
dynamicTools:
|
|
4562
|
-
disallowedTools:
|
|
4551
|
+
dynamicTools: z23.array(dynamicToolSchema).optional(),
|
|
4552
|
+
disallowedTools: z23.array(z23.string().min(1)).optional(),
|
|
4563
4553
|
instructionMode: instructionModeSchema
|
|
4564
4554
|
};
|
|
4565
|
-
var modelListParamsSchema =
|
|
4566
|
-
var threadStartParamsSchema =
|
|
4555
|
+
var modelListParamsSchema = z23.object({ cwd: z23.string().min(1).optional() }).passthrough();
|
|
4556
|
+
var threadStartParamsSchema = z23.object({
|
|
4567
4557
|
...sessionConstructionFields,
|
|
4568
|
-
input:
|
|
4558
|
+
input: z23.array(promptInputSchema).optional()
|
|
4569
4559
|
}).passthrough();
|
|
4570
|
-
var threadResumeParamsSchema =
|
|
4560
|
+
var threadResumeParamsSchema = z23.object({
|
|
4571
4561
|
...sessionConstructionFields,
|
|
4572
|
-
providerThreadId:
|
|
4562
|
+
providerThreadId: z23.string().min(1)
|
|
4573
4563
|
}).passthrough();
|
|
4574
|
-
var threadForkParamsSchema =
|
|
4564
|
+
var threadForkParamsSchema = z23.object({
|
|
4575
4565
|
...sessionConstructionFields,
|
|
4576
|
-
sourceProviderThreadId:
|
|
4577
|
-
sourceProviderCheckpointId:
|
|
4566
|
+
sourceProviderThreadId: z23.string().min(1),
|
|
4567
|
+
sourceProviderCheckpointId: z23.string().min(1).optional()
|
|
4578
4568
|
}).passthrough();
|
|
4579
|
-
var threadStopParamsSchema =
|
|
4580
|
-
threadId:
|
|
4581
|
-
providerThreadId:
|
|
4582
|
-
intent:
|
|
4583
|
-
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()
|
|
4584
4574
|
}).passthrough();
|
|
4585
|
-
var threadRefParams =
|
|
4586
|
-
threadId:
|
|
4587
|
-
providerThreadId:
|
|
4575
|
+
var threadRefParams = z23.object({
|
|
4576
|
+
threadId: z23.string().min(1),
|
|
4577
|
+
providerThreadId: z23.string().min(1)
|
|
4588
4578
|
}).passthrough();
|
|
4589
|
-
var threadNameSetParamsSchema =
|
|
4590
|
-
threadId:
|
|
4591
|
-
providerThreadId:
|
|
4592
|
-
title:
|
|
4579
|
+
var threadNameSetParamsSchema = z23.object({
|
|
4580
|
+
threadId: z23.string().min(1),
|
|
4581
|
+
providerThreadId: z23.string().min(1),
|
|
4582
|
+
title: z23.string().min(1)
|
|
4593
4583
|
}).passthrough();
|
|
4594
4584
|
var turnInputFields = {
|
|
4595
|
-
threadId:
|
|
4596
|
-
providerThreadId:
|
|
4597
|
-
input:
|
|
4585
|
+
threadId: z23.string().min(1),
|
|
4586
|
+
providerThreadId: z23.string().min(1),
|
|
4587
|
+
input: z23.array(promptInputSchema),
|
|
4598
4588
|
clientRequestId: clientTurnRequestIdSchema,
|
|
4599
4589
|
options: bridgeExecutionOptionsSchema
|
|
4600
4590
|
};
|
|
4601
|
-
var turnStartParamsSchema =
|
|
4602
|
-
var turnSteerParamsSchema =
|
|
4591
|
+
var turnStartParamsSchema = z23.object(turnInputFields).passthrough();
|
|
4592
|
+
var turnSteerParamsSchema = z23.object({
|
|
4603
4593
|
...turnInputFields,
|
|
4604
|
-
expectedTurnId:
|
|
4594
|
+
expectedTurnId: z23.string().min(1)
|
|
4605
4595
|
}).passthrough();
|
|
4606
|
-
var skillsConfigureRootSchema =
|
|
4607
|
-
id:
|
|
4608
|
-
path:
|
|
4609
|
-
skills:
|
|
4610
|
-
|
|
4611
|
-
name:
|
|
4612
|
-
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()
|
|
4613
4603
|
}).passthrough()
|
|
4614
4604
|
)
|
|
4615
4605
|
}).passthrough();
|
|
4616
|
-
var skillsConfigureParamsSchema =
|
|
4617
|
-
roots:
|
|
4618
|
-
}).passthrough();
|
|
4619
|
-
var threadIdentityResultSchema = z22.object({
|
|
4620
|
-
providerThreadId: z22.string().min(1),
|
|
4621
|
-
sessionRestorable: z22.boolean().optional()
|
|
4606
|
+
var skillsConfigureParamsSchema = z23.object({
|
|
4607
|
+
roots: z23.array(skillsConfigureRootSchema)
|
|
4622
4608
|
}).passthrough();
|
|
4623
|
-
var
|
|
4624
|
-
|
|
4625
|
-
|
|
4609
|
+
var threadIdentityResultSchema = z23.object({
|
|
4610
|
+
providerThreadId: z23.string().min(1),
|
|
4611
|
+
sessionRestorable: z23.boolean().optional()
|
|
4626
4612
|
}).passthrough();
|
|
4627
4613
|
|
|
4628
4614
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4629
|
-
import { z as
|
|
4615
|
+
import { z as z25 } from "zod";
|
|
4630
4616
|
|
|
4631
4617
|
// ../provider-bridge-protocol/src/errors.ts
|
|
4632
|
-
import { z as
|
|
4618
|
+
import { z as z24 } from "zod";
|
|
4633
4619
|
var BRIDGE_JSON_RPC_ERRORS = {
|
|
4634
4620
|
INVALID_PARAMS: -32602,
|
|
4635
4621
|
METHOD_NOT_FOUND: -32601,
|
|
@@ -4638,68 +4624,65 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
4638
4624
|
SESSION_NOT_RESTORABLE: -32002,
|
|
4639
4625
|
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
4640
4626
|
};
|
|
4641
|
-
var providerRecoveryHintSchema =
|
|
4627
|
+
var providerRecoveryHintSchema = z24.object({
|
|
4642
4628
|
kind: providerRecoveryKindSchema,
|
|
4643
|
-
message:
|
|
4644
|
-
retryable:
|
|
4629
|
+
message: z24.string().min(1),
|
|
4630
|
+
retryable: z24.boolean()
|
|
4645
4631
|
});
|
|
4646
|
-
var bridgeErrorDataSchema =
|
|
4632
|
+
var bridgeErrorDataSchema = z24.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
|
|
4647
4633
|
|
|
4648
4634
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
4649
|
-
var threadIdentityNotificationSchema =
|
|
4650
|
-
threadId:
|
|
4651
|
-
providerThreadId:
|
|
4652
|
-
sessionRestorable:
|
|
4653
|
-
}).passthrough();
|
|
4654
|
-
var sessionReplacedNotificationSchema = z24.object({
|
|
4655
|
-
threadId: z24.string().min(1),
|
|
4656
|
-
providerThreadId: z24.string().min(1).nullable(),
|
|
4657
|
-
reason: z24.string().min(1),
|
|
4658
|
-
contextLost: z24.boolean().default(false),
|
|
4659
|
-
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()
|
|
4660
4639
|
}).passthrough();
|
|
4661
|
-
var
|
|
4662
|
-
threadId:
|
|
4663
|
-
|
|
4664
|
-
|
|
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)
|
|
4665
4646
|
}).passthrough();
|
|
4666
|
-
var providerRecoveryNotificationSchema =
|
|
4667
|
-
threadId:
|
|
4647
|
+
var providerRecoveryNotificationSchema = z25.object({
|
|
4648
|
+
threadId: z25.string().min(1).optional(),
|
|
4668
4649
|
...providerRecoveryHintSchema.shape
|
|
4669
4650
|
}).passthrough();
|
|
4670
|
-
var errorNotificationSchema =
|
|
4671
|
-
threadId:
|
|
4672
|
-
|
|
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)
|
|
4673
4655
|
}).passthrough();
|
|
4674
4656
|
|
|
4675
4657
|
// ../provider-bridge-protocol/src/bridge-requests.ts
|
|
4676
|
-
import { z as
|
|
4677
|
-
var toolCallRequestParamsSchema =
|
|
4678
|
-
providerThreadId:
|
|
4679
|
-
threadId:
|
|
4680
|
-
turnId:
|
|
4681
|
-
callId:
|
|
4682
|
-
tool:
|
|
4683
|
-
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()
|
|
4684
4667
|
}).passthrough();
|
|
4685
|
-
var toolCallResultSchema =
|
|
4686
|
-
success:
|
|
4687
|
-
contentItems:
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
type:
|
|
4692
|
-
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)
|
|
4693
4676
|
})
|
|
4694
4677
|
])
|
|
4695
4678
|
)
|
|
4696
4679
|
}).passthrough();
|
|
4697
|
-
var interactionRequestParamsSchema =
|
|
4698
|
-
providerThreadId:
|
|
4699
|
-
threadId:
|
|
4700
|
-
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()]),
|
|
4701
4684
|
payload: pendingInteractionPayloadSchema,
|
|
4702
|
-
providerNativeIds:
|
|
4685
|
+
providerNativeIds: z26.boolean().optional()
|
|
4703
4686
|
}).passthrough();
|
|
4704
4687
|
|
|
4705
4688
|
// ../provider-bridge-protocol/src/thread-event-grammar.ts
|
|
@@ -4876,7 +4859,7 @@ function threadEvents(context, threadId) {
|
|
|
4876
4859
|
context.client.drainIntoLog();
|
|
4877
4860
|
return context.client.events.filter((entry) => entry.threadId === threadId).map((entry) => entry.event);
|
|
4878
4861
|
}
|
|
4879
|
-
var persistedEventSchema =
|
|
4862
|
+
var persistedEventSchema = z27.preprocess(
|
|
4880
4863
|
(event) => JSON.parse(JSON.stringify(event)),
|
|
4881
4864
|
threadEventSchema
|
|
4882
4865
|
);
|
|
@@ -5971,26 +5954,26 @@ function formatConformanceReport(report) {
|
|
|
5971
5954
|
}
|
|
5972
5955
|
|
|
5973
5956
|
// ../provider-bridge-protocol/src/testing/bridge-json-rpc-test-helpers.ts
|
|
5974
|
-
import { z as
|
|
5975
|
-
var bridgeJsonRpcValueSchema =
|
|
5976
|
-
() =>
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
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)
|
|
5983
5966
|
])
|
|
5984
5967
|
);
|
|
5985
|
-
var bridgeJsonRpcOutputSchema =
|
|
5986
|
-
jsonrpc:
|
|
5987
|
-
id:
|
|
5988
|
-
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(),
|
|
5989
5972
|
params: bridgeJsonRpcValueSchema.optional(),
|
|
5990
5973
|
result: bridgeJsonRpcValueSchema.optional(),
|
|
5991
|
-
error:
|
|
5992
|
-
code:
|
|
5993
|
-
message:
|
|
5974
|
+
error: z28.object({
|
|
5975
|
+
code: z28.number(),
|
|
5976
|
+
message: z28.string(),
|
|
5994
5977
|
data: bridgeJsonRpcValueSchema.optional()
|
|
5995
5978
|
}).optional()
|
|
5996
5979
|
});
|
|
@@ -6279,11 +6262,7 @@ function parseEntry(raw, file, lineNumber) {
|
|
|
6279
6262
|
const entry = parsed;
|
|
6280
6263
|
return { ...entry, run: typeof entry.run === "number" ? entry.run : 0 };
|
|
6281
6264
|
}
|
|
6282
|
-
function
|
|
6283
|
-
const file = join(dir, bridgeRecordingFileName(direction));
|
|
6284
|
-
if (!existsSync(file)) {
|
|
6285
|
-
return [];
|
|
6286
|
-
}
|
|
6265
|
+
function readLaneEntries(file, direction, laneLabel) {
|
|
6287
6266
|
const entries = [];
|
|
6288
6267
|
const lines = readFileSync(file, "utf8").split("\n");
|
|
6289
6268
|
for (const [index, raw] of lines.entries()) {
|
|
@@ -6291,32 +6270,27 @@ function readBridgeRecordingLane(dir, direction) {
|
|
|
6291
6270
|
const entry = parseEntry(raw, file, index + 1);
|
|
6292
6271
|
if (entry.dir !== direction) {
|
|
6293
6272
|
throw new Error(
|
|
6294
|
-
`${file}:${index + 1}: entry direction ${entry.dir} in the ${
|
|
6273
|
+
`${file}:${index + 1}: entry direction ${entry.dir} in the ${laneLabel}`
|
|
6295
6274
|
);
|
|
6296
6275
|
}
|
|
6297
6276
|
entries.push(entry);
|
|
6298
6277
|
}
|
|
6299
6278
|
return entries;
|
|
6300
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
|
+
}
|
|
6301
6287
|
var CURRENT_BRIDGE_LANE_FILE = "bridge\u2192runtime.current.ndjson";
|
|
6302
6288
|
function readCurrentBridgeLane(dir) {
|
|
6303
6289
|
const file = join(dir, CURRENT_BRIDGE_LANE_FILE);
|
|
6304
6290
|
if (!existsSync(file)) {
|
|
6305
6291
|
return null;
|
|
6306
6292
|
}
|
|
6307
|
-
|
|
6308
|
-
const lines = readFileSync(file, "utf8").split("\n");
|
|
6309
|
-
for (const [index, raw] of lines.entries()) {
|
|
6310
|
-
if (raw.length === 0) continue;
|
|
6311
|
-
const entry = parseEntry(raw, file, index + 1);
|
|
6312
|
-
if (entry.dir !== "bridge\u2192runtime") {
|
|
6313
|
-
throw new Error(
|
|
6314
|
-
`${file}:${index + 1}: entry direction ${entry.dir} in the current bridge lane`
|
|
6315
|
-
);
|
|
6316
|
-
}
|
|
6317
|
-
entries.push(entry);
|
|
6318
|
-
}
|
|
6319
|
-
return entries;
|
|
6293
|
+
return readLaneEntries(file, "bridge\u2192runtime", "current bridge lane");
|
|
6320
6294
|
}
|
|
6321
6295
|
function withCurrentBridgeLane(recording) {
|
|
6322
6296
|
const current = readCurrentBridgeLane(recording.dir);
|