@get-bb/plugin-sdk 0.4.94 → 0.4.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-types/bb-plugin-sdk-app.d.ts +55 -3
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +18 -0
- package/bundled-types/bb-plugin-sdk-machine-provider.d.ts +2 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +4 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +5 -0
- package/bundled-types/bb-plugin-sdk-testing.d.ts +16 -0
- package/bundled-types/bb-plugin-sdk.d.ts +482 -3
- package/dist/internal/host-policy.js +117 -93
- package/dist/provider-bridge-acp.js +2121 -1562
- package/dist/provider-bridge-testing.js +1301 -1228
- package/dist/provider-bridge.js +1819 -1311
- package/dist/testing/app.js +17 -0
- package/dist/testing/index.js +118 -93
- package/package.json +1 -1
package/dist/testing/app.js
CHANGED
|
@@ -15803,6 +15803,7 @@ function renderSlot(registration, props, options = {}) {
|
|
|
15803
15803
|
submits: []
|
|
15804
15804
|
};
|
|
15805
15805
|
const composerOwnership = { active: true };
|
|
15806
|
+
const submissionListeners = /* @__PURE__ */ new Set();
|
|
15806
15807
|
const composer = {
|
|
15807
15808
|
getAttachmentCount: () => composerAttachmentCount,
|
|
15808
15809
|
getScope: () => composerScope,
|
|
@@ -15846,6 +15847,21 @@ ${block}
|
|
|
15846
15847
|
}
|
|
15847
15848
|
composerLog.focusCount += 1;
|
|
15848
15849
|
},
|
|
15850
|
+
experimental_onSubmitted(listener) {
|
|
15851
|
+
submissionListeners.add(listener);
|
|
15852
|
+
return () => {
|
|
15853
|
+
submissionListeners.delete(listener);
|
|
15854
|
+
};
|
|
15855
|
+
},
|
|
15856
|
+
experimental_removeMention({ provider, id }) {
|
|
15857
|
+
for (let index = composerLog.mentions.length - 1; index >= 0; index -= 1) {
|
|
15858
|
+
const mention = composerLog.mentions[index];
|
|
15859
|
+
if (mention?.provider === provider && mention.id === id) {
|
|
15860
|
+
commitComposerText(composerText.replace(mention.label, ""));
|
|
15861
|
+
composerLog.mentions.splice(index, 1);
|
|
15862
|
+
}
|
|
15863
|
+
}
|
|
15864
|
+
},
|
|
15849
15865
|
insertMention(mention) {
|
|
15850
15866
|
const label = mention.label.trim() || mention.id;
|
|
15851
15867
|
const separator = composerText.length === 0 || /\s$/u.test(composerText) ? "" : " ";
|
|
@@ -15868,6 +15884,7 @@ ${block}
|
|
|
15868
15884
|
}
|
|
15869
15885
|
composerLog.submits.push(options2);
|
|
15870
15886
|
commitComposerText("");
|
|
15887
|
+
for (const listener of submissionListeners) listener();
|
|
15871
15888
|
}
|
|
15872
15889
|
}
|
|
15873
15890
|
};
|
package/dist/testing/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/internal/host-policy.ts
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import { z as
|
|
3
|
+
import { z as z5 } from "zod";
|
|
4
4
|
|
|
5
5
|
// ../domain/src/plugin-icon.ts
|
|
6
6
|
function isPluginOwnedIconPath(icon) {
|
|
@@ -35,6 +35,7 @@ var RESERVED_BB_CLI_COMMANDS = [
|
|
|
35
35
|
"plugin",
|
|
36
36
|
"project",
|
|
37
37
|
"provider",
|
|
38
|
+
"server",
|
|
38
39
|
"settings",
|
|
39
40
|
"skill",
|
|
40
41
|
"status",
|
|
@@ -54,6 +55,12 @@ import { z } from "zod";
|
|
|
54
55
|
var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
|
|
55
56
|
var providerForkSchema = z.enum(PROVIDER_FORK_VALUES);
|
|
56
57
|
|
|
58
|
+
// ../domain/src/completed-turn-display.ts
|
|
59
|
+
import { z as z2 } from "zod";
|
|
60
|
+
var COMPLETED_TURN_DISPLAY_VALUES = ["collapse", "flat"];
|
|
61
|
+
var completedTurnDisplaySchema = z2.enum(COMPLETED_TURN_DISPLAY_VALUES);
|
|
62
|
+
var DEFAULT_COMPLETED_TURN_DISPLAY = "collapse";
|
|
63
|
+
|
|
57
64
|
// ../domain/src/provider-skill-roots.ts
|
|
58
65
|
function isAbsoluteProviderSkillRootPath(value) {
|
|
59
66
|
if (value.length === 0) {
|
|
@@ -76,53 +83,53 @@ function isRelativeProviderSkillRootPath(value) {
|
|
|
76
83
|
}
|
|
77
84
|
|
|
78
85
|
// ../domain/src/json-value.ts
|
|
79
|
-
import { z as
|
|
80
|
-
var jsonValueSchema =
|
|
81
|
-
() =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
import { z as z3 } from "zod";
|
|
87
|
+
var jsonValueSchema = z3.lazy(
|
|
88
|
+
() => z3.union([
|
|
89
|
+
z3.string(),
|
|
90
|
+
z3.number(),
|
|
91
|
+
z3.boolean(),
|
|
92
|
+
z3.null(),
|
|
93
|
+
z3.array(jsonValueSchema),
|
|
94
|
+
z3.record(z3.string(), jsonValueSchema)
|
|
88
95
|
])
|
|
89
96
|
);
|
|
90
|
-
var jsonObjectSchema =
|
|
91
|
-
|
|
97
|
+
var jsonObjectSchema = z3.record(
|
|
98
|
+
z3.string(),
|
|
92
99
|
jsonValueSchema
|
|
93
100
|
);
|
|
94
101
|
|
|
95
102
|
// ../domain/src/native-roots.ts
|
|
96
|
-
import { z as
|
|
103
|
+
import { z as z4 } from "zod";
|
|
97
104
|
var PROVIDER_NATIVE_ROOTS_MAX = 32;
|
|
98
105
|
var PROVIDER_NATIVE_ROOT_NAME_PREFIX_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,62}:$/u;
|
|
99
|
-
var nativeRootNamePrefixSchema =
|
|
106
|
+
var nativeRootNamePrefixSchema = z4.string().refine(
|
|
100
107
|
(value) => value === "" || PROVIDER_NATIVE_ROOT_NAME_PREFIX_PATTERN.test(value),
|
|
101
108
|
"A root name prefix is a plugin-name-like token ending in ':'"
|
|
102
109
|
);
|
|
103
|
-
var nativeRootManifestPathSchema =
|
|
110
|
+
var nativeRootManifestPathSchema = z4.string().min(1).refine(
|
|
104
111
|
isRelativeProviderSkillRootPath,
|
|
105
112
|
"A manifest marker is a relative path without dot segments"
|
|
106
113
|
);
|
|
107
|
-
var relativeNativeRootPathSchema =
|
|
114
|
+
var relativeNativeRootPathSchema = z4.string().min(1).refine(
|
|
108
115
|
isRelativeProviderSkillRootPath,
|
|
109
116
|
"Roots must be relative paths without dot segments"
|
|
110
117
|
);
|
|
111
|
-
var absoluteNativeRootPathSchema =
|
|
118
|
+
var absoluteNativeRootPathSchema = z4.string().min(1).refine(
|
|
112
119
|
isAbsoluteProviderSkillRootPath,
|
|
113
120
|
"Absolute roots must be absolute paths without dot segments"
|
|
114
121
|
);
|
|
115
|
-
var providerNativeRootInputSchema =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
path:
|
|
122
|
+
var providerNativeRootInputSchema = z4.union([
|
|
123
|
+
z4.string().min(1),
|
|
124
|
+
z4.object({
|
|
125
|
+
path: z4.string().min(1),
|
|
119
126
|
/** Skills nest in subdirectories (the agent scans recursively). */
|
|
120
|
-
recursive:
|
|
127
|
+
recursive: z4.boolean().optional(),
|
|
121
128
|
/**
|
|
122
129
|
* Scan the same relative directory in every ancestor of the workspace
|
|
123
130
|
* up to the repository root (`project` roots only).
|
|
124
131
|
*/
|
|
125
|
-
ancestors:
|
|
132
|
+
ancestors: z4.boolean().optional(),
|
|
126
133
|
/**
|
|
127
134
|
* Prepended to every name under the root, a vendor plugin's
|
|
128
135
|
* `plugin-name:`; a prefixed root is listed as a plugin root.
|
|
@@ -137,14 +144,14 @@ var providerNativeRootInputSchema = z3.union([
|
|
|
137
144
|
skipIfManifest: nativeRootManifestPathSchema.optional()
|
|
138
145
|
}).strict()
|
|
139
146
|
]);
|
|
140
|
-
var providerNativeRootsInputSchema =
|
|
141
|
-
user:
|
|
142
|
-
project:
|
|
147
|
+
var providerNativeRootsInputSchema = z4.object({
|
|
148
|
+
user: z4.array(providerNativeRootInputSchema).optional(),
|
|
149
|
+
project: z4.array(providerNativeRootInputSchema).optional()
|
|
143
150
|
}).strict();
|
|
144
|
-
var providerNativeRootSchema =
|
|
145
|
-
path:
|
|
146
|
-
recursive:
|
|
147
|
-
ancestors:
|
|
151
|
+
var providerNativeRootSchema = z4.object({
|
|
152
|
+
path: z4.string().min(1),
|
|
153
|
+
recursive: z4.boolean(),
|
|
154
|
+
ancestors: z4.boolean(),
|
|
148
155
|
namePrefix: nativeRootNamePrefixSchema,
|
|
149
156
|
/** Absent: every skill-shaped directory under the root is a skill. */
|
|
150
157
|
skipIfManifest: nativeRootManifestPathSchema.optional()
|
|
@@ -153,7 +160,7 @@ function uniqueByPath(roots) {
|
|
|
153
160
|
return new Set(roots.map((root) => root.path)).size === roots.length;
|
|
154
161
|
}
|
|
155
162
|
function nativeRootSideSchema(side) {
|
|
156
|
-
return
|
|
163
|
+
return z4.array(
|
|
157
164
|
providerNativeRootSchema.extend({ path: relativeNativeRootPathSchema }).superRefine((root, context) => {
|
|
158
165
|
if (root.ancestors && side !== "project") {
|
|
159
166
|
context.addIssue({
|
|
@@ -164,7 +171,7 @@ function nativeRootSideSchema(side) {
|
|
|
164
171
|
})
|
|
165
172
|
).max(PROVIDER_NATIVE_ROOTS_MAX).refine(uniqueByPath, "Roots must not repeat a path");
|
|
166
173
|
}
|
|
167
|
-
var providerNativeRootsSchema =
|
|
174
|
+
var providerNativeRootsSchema = z4.object({
|
|
168
175
|
user: nativeRootSideSchema("user"),
|
|
169
176
|
project: nativeRootSideSchema("project")
|
|
170
177
|
}).strict();
|
|
@@ -190,19 +197,19 @@ function normalizeProviderNativeRoots(roots) {
|
|
|
190
197
|
project: (roots?.project ?? []).map(normalizeProviderNativeRoot)
|
|
191
198
|
};
|
|
192
199
|
}
|
|
193
|
-
var providerResolvedNativeRootShapeSchema =
|
|
200
|
+
var providerResolvedNativeRootShapeSchema = z4.enum([
|
|
194
201
|
"skills",
|
|
195
202
|
"skill",
|
|
196
203
|
"skill-file",
|
|
197
204
|
"commands",
|
|
198
205
|
"command-file"
|
|
199
206
|
]);
|
|
200
|
-
var resolvedNativeRootFieldsSchema =
|
|
207
|
+
var resolvedNativeRootFieldsSchema = z4.object({
|
|
201
208
|
path: absoluteNativeRootPathSchema,
|
|
202
|
-
origin:
|
|
203
|
-
recursive:
|
|
209
|
+
origin: z4.enum(["user", "project"]),
|
|
210
|
+
recursive: z4.boolean(),
|
|
204
211
|
/** Only with origin `project`, for a path inside the workspace. */
|
|
205
|
-
ancestors:
|
|
212
|
+
ancestors: z4.boolean(),
|
|
206
213
|
namePrefix: nativeRootNamePrefixSchema,
|
|
207
214
|
shape: providerResolvedNativeRootShapeSchema,
|
|
208
215
|
/**
|
|
@@ -210,7 +217,7 @@ var resolvedNativeRootFieldsSchema = z3.object({
|
|
|
210
217
|
* none. A vendor plugin's root SKILL.md takes the plugin's name; absent
|
|
211
218
|
* means the parent directory's name.
|
|
212
219
|
*/
|
|
213
|
-
fallbackName:
|
|
220
|
+
fallbackName: z4.string().min(1).optional(),
|
|
214
221
|
/**
|
|
215
222
|
* `skills` only: a file, relative to a skill directory under this root,
|
|
216
223
|
* that marks the directory as a vendor plugin rather than a skill; the
|
|
@@ -254,14 +261,14 @@ var resolvedCommandShapes = /* @__PURE__ */ new Set([
|
|
|
254
261
|
"command-file"
|
|
255
262
|
]);
|
|
256
263
|
var PROVIDER_RESOLVED_NATIVE_ROOTS_MAX = 256;
|
|
257
|
-
var providerResolvedNativeRootsSchema =
|
|
258
|
-
skills:
|
|
264
|
+
var providerResolvedNativeRootsSchema = z4.object({
|
|
265
|
+
skills: z4.array(
|
|
259
266
|
providerResolvedNativeRootSchema.refine(
|
|
260
267
|
(root) => resolvedSkillShapes.has(root.shape),
|
|
261
268
|
"A skills root needs a skill shape"
|
|
262
269
|
)
|
|
263
270
|
).max(PROVIDER_RESOLVED_NATIVE_ROOTS_MAX),
|
|
264
|
-
commands:
|
|
271
|
+
commands: z4.array(
|
|
265
272
|
providerResolvedNativeRootSchema.refine(
|
|
266
273
|
(root) => resolvedCommandShapes.has(root.shape),
|
|
267
274
|
"A commands root needs a command shape"
|
|
@@ -272,7 +279,7 @@ var EMPTY_PROVIDER_RESOLVED_NATIVE_ROOTS = Object.freeze({
|
|
|
272
279
|
skills: Object.freeze([]),
|
|
273
280
|
commands: Object.freeze([])
|
|
274
281
|
});
|
|
275
|
-
var providerNativeRootSetSchema =
|
|
282
|
+
var providerNativeRootSetSchema = z4.object({
|
|
276
283
|
skills: providerNativeRootsSchema,
|
|
277
284
|
commands: providerNativeRootsSchema,
|
|
278
285
|
resolved: providerResolvedNativeRootsSchema
|
|
@@ -350,15 +357,15 @@ var CLI_COMMAND_NAME_PATTERN = /^[a-z0-9-]+$/;
|
|
|
350
357
|
var AGENT_TOOL_NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
351
358
|
var PLUGIN_PROVIDER_ENV_NAME_PATTERN = /^[A-Z_][A-Z0-9_]*$/;
|
|
352
359
|
var PLUGIN_PROVIDER_ENV_MAX_ENTRIES = 32;
|
|
353
|
-
var pluginProviderEnvEntrySchema =
|
|
354
|
-
name:
|
|
355
|
-
value:
|
|
356
|
-
|
|
357
|
-
|
|
360
|
+
var pluginProviderEnvEntrySchema = z5.object({
|
|
361
|
+
name: z5.string().regex(PLUGIN_PROVIDER_ENV_NAME_PATTERN),
|
|
362
|
+
value: z5.union([
|
|
363
|
+
z5.string(),
|
|
364
|
+
z5.object({ serverPath: z5.string().startsWith("/") }).strict()
|
|
358
365
|
]),
|
|
359
|
-
reason:
|
|
366
|
+
reason: z5.string()
|
|
360
367
|
}).strict();
|
|
361
|
-
var pluginProviderEnvEntriesSchema =
|
|
368
|
+
var pluginProviderEnvEntriesSchema = z5.array(pluginProviderEnvEntrySchema).max(PLUGIN_PROVIDER_ENV_MAX_ENTRIES).superRefine((entries, context) => {
|
|
362
369
|
const names = /* @__PURE__ */ new Set();
|
|
363
370
|
for (let index = 0; index < entries.length; index += 1) {
|
|
364
371
|
const name = entries[index]?.name;
|
|
@@ -393,26 +400,26 @@ var PROVIDER_ID_PATTERN = /^[a-z0-9][a-z0-9-]{1,63}$/;
|
|
|
393
400
|
var PLUGIN_PROVIDER_BRIDGE_OPTIONS_MAX_BYTES = 64 * 1024;
|
|
394
401
|
var SETTING_KEY_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
395
402
|
var settingsBaseFields = {
|
|
396
|
-
label:
|
|
397
|
-
description:
|
|
403
|
+
label: z5.string().min(1),
|
|
404
|
+
description: z5.string().min(1).optional()
|
|
398
405
|
};
|
|
399
|
-
var stringSettingSchemaSchema =
|
|
406
|
+
var stringSettingSchemaSchema = z5.custom(
|
|
400
407
|
(value) => isStandardSchema(value)
|
|
401
408
|
);
|
|
402
|
-
var booleanSettingSchemaSchema =
|
|
409
|
+
var booleanSettingSchemaSchema = z5.custom(
|
|
403
410
|
(value) => isStandardSchema(value)
|
|
404
411
|
);
|
|
405
|
-
var numberSettingSchemaSchema =
|
|
412
|
+
var numberSettingSchemaSchema = z5.custom(
|
|
406
413
|
(value) => isStandardSchema(value)
|
|
407
414
|
);
|
|
408
|
-
var settingDescriptorSchema =
|
|
409
|
-
|
|
410
|
-
type:
|
|
415
|
+
var settingDescriptorSchema = z5.discriminatedUnion("type", [
|
|
416
|
+
z5.object({
|
|
417
|
+
type: z5.literal("string"),
|
|
411
418
|
...settingsBaseFields,
|
|
412
|
-
secret:
|
|
413
|
-
experimental_multiline:
|
|
419
|
+
secret: z5.literal(true).optional(),
|
|
420
|
+
experimental_multiline: z5.boolean().optional(),
|
|
414
421
|
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
415
|
-
default:
|
|
422
|
+
default: z5.string().optional()
|
|
416
423
|
}).strict().refine(
|
|
417
424
|
(descriptor) => !(descriptor.secret === true && descriptor.experimental_multiline === true),
|
|
418
425
|
{
|
|
@@ -420,30 +427,30 @@ var settingDescriptorSchema = z4.discriminatedUnion("type", [
|
|
|
420
427
|
path: ["experimental_multiline"]
|
|
421
428
|
}
|
|
422
429
|
),
|
|
423
|
-
|
|
424
|
-
type:
|
|
430
|
+
z5.object({
|
|
431
|
+
type: z5.literal("boolean"),
|
|
425
432
|
...settingsBaseFields,
|
|
426
433
|
experimental_schema: booleanSettingSchemaSchema.optional(),
|
|
427
|
-
default:
|
|
434
|
+
default: z5.boolean().optional()
|
|
428
435
|
}).strict(),
|
|
429
|
-
|
|
430
|
-
type:
|
|
436
|
+
z5.object({
|
|
437
|
+
type: z5.literal("number"),
|
|
431
438
|
...settingsBaseFields,
|
|
432
439
|
experimental_schema: numberSettingSchemaSchema.optional(),
|
|
433
|
-
default:
|
|
440
|
+
default: z5.number().finite().optional()
|
|
434
441
|
}).strict(),
|
|
435
|
-
|
|
436
|
-
type:
|
|
442
|
+
z5.object({
|
|
443
|
+
type: z5.literal("select"),
|
|
437
444
|
...settingsBaseFields,
|
|
438
|
-
options:
|
|
445
|
+
options: z5.array(z5.string().min(1)).min(1),
|
|
439
446
|
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
440
|
-
default:
|
|
447
|
+
default: z5.string().optional()
|
|
441
448
|
}).strict(),
|
|
442
|
-
|
|
443
|
-
type:
|
|
449
|
+
z5.object({
|
|
450
|
+
type: z5.literal("project"),
|
|
444
451
|
...settingsBaseFields,
|
|
445
452
|
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
446
|
-
default:
|
|
453
|
+
default: z5.string().optional()
|
|
447
454
|
}).strict()
|
|
448
455
|
]);
|
|
449
456
|
function registerSettingDescriptors(target, added) {
|
|
@@ -991,6 +998,18 @@ function validateProviderModelCatalogScope(providerId, value) {
|
|
|
991
998
|
}
|
|
992
999
|
return value;
|
|
993
1000
|
}
|
|
1001
|
+
var PROVIDER_COMPLETED_TURN_DISPLAYS = COMPLETED_TURN_DISPLAY_VALUES;
|
|
1002
|
+
function validateProviderCompletedTurnDisplay(providerId, value) {
|
|
1003
|
+
if (value === void 0) {
|
|
1004
|
+
return DEFAULT_COMPLETED_TURN_DISPLAY;
|
|
1005
|
+
}
|
|
1006
|
+
if (typeof value !== "string" || !PROVIDER_COMPLETED_TURN_DISPLAYS.includes(value)) {
|
|
1007
|
+
throw new Error(
|
|
1008
|
+
`provider "${providerId}" completedTurnDisplay must be one of ${PROVIDER_COMPLETED_TURN_DISPLAYS.join(", ")}`
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
return value;
|
|
1012
|
+
}
|
|
994
1013
|
function validateProviderFallbackModels(providerId, value) {
|
|
995
1014
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
996
1015
|
throw new Error(`provider "${providerId}" models must be an object`);
|
|
@@ -1371,6 +1390,10 @@ function validatePluginProviderDeclaration(declaration) {
|
|
|
1371
1390
|
allowed: PLUGIN_PROVIDER_COMPOSER_ACTION_VALUES,
|
|
1372
1391
|
requireNonEmpty: false
|
|
1373
1392
|
});
|
|
1393
|
+
const completedTurnDisplay = validateProviderCompletedTurnDisplay(
|
|
1394
|
+
id,
|
|
1395
|
+
declaration.completedTurnDisplay
|
|
1396
|
+
);
|
|
1374
1397
|
const bridgeOptions = declaration.experimental_bridgeOptions === void 0 ? void 0 : normalizeProviderBridgeOptions(
|
|
1375
1398
|
id,
|
|
1376
1399
|
declaration.experimental_bridgeOptions
|
|
@@ -1436,6 +1459,7 @@ function validatePluginProviderDeclaration(declaration) {
|
|
|
1436
1459
|
maintenance: normalizedMaintenance,
|
|
1437
1460
|
capabilities: normalizedCapabilities,
|
|
1438
1461
|
composerActions,
|
|
1462
|
+
completedTurnDisplay,
|
|
1439
1463
|
...strings === void 0 ? {} : { strings },
|
|
1440
1464
|
...serviceTiers === void 0 ? {} : { serviceTiers },
|
|
1441
1465
|
...reasoningLevels === void 0 ? {} : { reasoningLevels },
|
|
@@ -1456,9 +1480,9 @@ function isStandardSchema(value) {
|
|
|
1456
1480
|
const standard = Reflect.get(value, "~standard");
|
|
1457
1481
|
return typeof standard === "object" && standard !== null && Reflect.get(standard, "version") === 1 && typeof Reflect.get(standard, "vendor") === "string" && typeof Reflect.get(standard, "validate") === "function";
|
|
1458
1482
|
}
|
|
1459
|
-
var rpcDescriptionSchema =
|
|
1460
|
-
var rpcPublicationOptionsSchema =
|
|
1461
|
-
experimental_discoverable:
|
|
1483
|
+
var rpcDescriptionSchema = z5.string().trim().min(1).max(4096).optional().transform((value) => value ?? null);
|
|
1484
|
+
var rpcPublicationOptionsSchema = z5.object({
|
|
1485
|
+
experimental_discoverable: z5.boolean().default(false),
|
|
1462
1486
|
experimental_description: rpcDescriptionSchema
|
|
1463
1487
|
}).strict();
|
|
1464
1488
|
function readRpcMethodContract(method, value) {
|
|
@@ -1500,7 +1524,7 @@ function publishedRpcSchema(schema, direction) {
|
|
|
1500
1524
|
if (serialized === void 0 || new TextEncoder().encode(serialized).byteLength > 128 * 1024) {
|
|
1501
1525
|
throw new Error("published RPC schema must be JSON and at most 128 KiB");
|
|
1502
1526
|
}
|
|
1503
|
-
const result =
|
|
1527
|
+
const result = z5.record(z5.string(), jsonValueSchema).parse(JSON.parse(serialized));
|
|
1504
1528
|
const inspect = (value) => {
|
|
1505
1529
|
if (value === null || typeof value !== "object") return;
|
|
1506
1530
|
if (Array.isArray(value)) {
|
|
@@ -1550,7 +1574,7 @@ function zodSchemaToJsonSchema(schema) {
|
|
|
1550
1574
|
if (typeof schema.toJSONSchema === "function") {
|
|
1551
1575
|
return schema.toJSONSchema({ io: "input" });
|
|
1552
1576
|
}
|
|
1553
|
-
return
|
|
1577
|
+
return z5.toJSONSchema(schema, { io: "input" });
|
|
1554
1578
|
}
|
|
1555
1579
|
var SINGLE_SCHEMA_KEYWORDS = [
|
|
1556
1580
|
"additionalItems",
|
|
@@ -1885,15 +1909,15 @@ var ENVIRONMENT_PROVIDER_REQUIREMENT_NAMES = [
|
|
|
1885
1909
|
"gitRemote",
|
|
1886
1910
|
"projectless"
|
|
1887
1911
|
];
|
|
1888
|
-
var environmentCompositionSchema =
|
|
1889
|
-
id:
|
|
1890
|
-
displayName:
|
|
1891
|
-
description:
|
|
1892
|
-
icon:
|
|
1912
|
+
var environmentCompositionSchema = z5.object({
|
|
1913
|
+
id: z5.string().regex(ENVIRONMENT_PROVIDER_ID_PATTERN),
|
|
1914
|
+
displayName: z5.string().trim().min(1).max(ENVIRONMENT_PROVIDER_DISPLAY_NAME_MAX_CHARS),
|
|
1915
|
+
description: z5.string().trim().min(1).max(ENVIRONMENT_PROVIDER_DESCRIPTION_MAX_CHARS).optional().transform((value) => value ?? null),
|
|
1916
|
+
icon: z5.string().trim().min(1).transform(
|
|
1893
1917
|
(icon) => isPluginOwnedIconPath(icon) ? validateProviderRelativePath(icon, "Composition icon") : icon
|
|
1894
1918
|
).optional().transform((value) => value ?? null),
|
|
1895
|
-
machineProviderId:
|
|
1896
|
-
environmentProviderId:
|
|
1919
|
+
machineProviderId: z5.string().regex(ENVIRONMENT_PROVIDER_ID_PATTERN),
|
|
1920
|
+
environmentProviderId: z5.string().regex(ENVIRONMENT_PROVIDER_ID_PATTERN)
|
|
1897
1921
|
}).strict();
|
|
1898
1922
|
function requireProviderIdAndDisplayName(noun, declaration) {
|
|
1899
1923
|
if (typeof declaration !== "object" || declaration === null) {
|
|
@@ -1959,8 +1983,8 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
|
|
|
1959
1983
|
"environment provider",
|
|
1960
1984
|
declaration
|
|
1961
1985
|
);
|
|
1962
|
-
const description =
|
|
1963
|
-
const icon =
|
|
1986
|
+
const description = z5.string().trim().min(1).max(ENVIRONMENT_PROVIDER_DESCRIPTION_MAX_CHARS).optional().transform((value) => value ?? null).parse(declaration.description);
|
|
1987
|
+
const icon = z5.string().trim().min(1).optional().transform((value) => value ?? null).parse(declaration.icon);
|
|
1964
1988
|
if (icon !== null) {
|
|
1965
1989
|
assertProviderIconShape("environment provider", id, icon);
|
|
1966
1990
|
}
|
|
@@ -2029,9 +2053,9 @@ function normalizeEnvironmentProviderRequirements(id, declaration) {
|
|
|
2029
2053
|
}
|
|
2030
2054
|
return normalized;
|
|
2031
2055
|
}
|
|
2032
|
-
var environmentProviderPolicySchema =
|
|
2033
|
-
retireGraceMs:
|
|
2034
|
-
pathKeys:
|
|
2056
|
+
var environmentProviderPolicySchema = z5.object({
|
|
2057
|
+
retireGraceMs: z5.number().int().nonnegative().nullable().default(3e5),
|
|
2058
|
+
pathKeys: z5.enum(["per-thread", "per-attempt"]).default("per-thread")
|
|
2035
2059
|
}).strict();
|
|
2036
2060
|
var MACHINE_PROVIDER_DESCRIPTION_MAX_CHARS = 200;
|
|
2037
2061
|
function validatePluginMachineProviderDeclaration(declaration) {
|
|
@@ -2039,10 +2063,10 @@ function validatePluginMachineProviderDeclaration(declaration) {
|
|
|
2039
2063
|
"machine provider",
|
|
2040
2064
|
declaration
|
|
2041
2065
|
);
|
|
2042
|
-
const description =
|
|
2043
|
-
const icon =
|
|
2066
|
+
const description = z5.string().trim().min(1).max(MACHINE_PROVIDER_DESCRIPTION_MAX_CHARS).parse(declaration.description);
|
|
2067
|
+
const icon = z5.string().trim().min(1).parse(declaration.icon);
|
|
2044
2068
|
assertProviderIconShape("machine provider", id, icon);
|
|
2045
|
-
const ephemeral =
|
|
2069
|
+
const ephemeral = z5.boolean().default(false).parse(declaration.ephemeral);
|
|
2046
2070
|
const inputs = normalizeProviderInputs(
|
|
2047
2071
|
"machine provider",
|
|
2048
2072
|
id,
|
|
@@ -4221,6 +4245,7 @@ function makeThreadResponse(overrides = {}) {
|
|
|
4221
4245
|
sectionId: null,
|
|
4222
4246
|
status: "idle",
|
|
4223
4247
|
parentThreadId: null,
|
|
4248
|
+
lifecycleOwnerThreadId: null,
|
|
4224
4249
|
sourceThreadId: null,
|
|
4225
4250
|
originKind: null,
|
|
4226
4251
|
originPluginId: null,
|