@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
|
@@ -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
|
|
@@ -305,15 +312,15 @@ var CLI_COMMAND_NAME_PATTERN = /^[a-z0-9-]+$/;
|
|
|
305
312
|
var AGENT_TOOL_NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
306
313
|
var PLUGIN_PROVIDER_ENV_NAME_PATTERN = /^[A-Z_][A-Z0-9_]*$/;
|
|
307
314
|
var PLUGIN_PROVIDER_ENV_MAX_ENTRIES = 32;
|
|
308
|
-
var pluginProviderEnvEntrySchema =
|
|
309
|
-
name:
|
|
310
|
-
value:
|
|
311
|
-
|
|
312
|
-
|
|
315
|
+
var pluginProviderEnvEntrySchema = z5.object({
|
|
316
|
+
name: z5.string().regex(PLUGIN_PROVIDER_ENV_NAME_PATTERN),
|
|
317
|
+
value: z5.union([
|
|
318
|
+
z5.string(),
|
|
319
|
+
z5.object({ serverPath: z5.string().startsWith("/") }).strict()
|
|
313
320
|
]),
|
|
314
|
-
reason:
|
|
321
|
+
reason: z5.string()
|
|
315
322
|
}).strict();
|
|
316
|
-
var pluginProviderEnvEntriesSchema =
|
|
323
|
+
var pluginProviderEnvEntriesSchema = z5.array(pluginProviderEnvEntrySchema).max(PLUGIN_PROVIDER_ENV_MAX_ENTRIES).superRefine((entries, context) => {
|
|
317
324
|
const names = /* @__PURE__ */ new Set();
|
|
318
325
|
for (let index = 0; index < entries.length; index += 1) {
|
|
319
326
|
const name = entries[index]?.name;
|
|
@@ -348,26 +355,26 @@ var PROVIDER_ID_PATTERN = /^[a-z0-9][a-z0-9-]{1,63}$/;
|
|
|
348
355
|
var PLUGIN_PROVIDER_BRIDGE_OPTIONS_MAX_BYTES = 64 * 1024;
|
|
349
356
|
var SETTING_KEY_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
350
357
|
var settingsBaseFields = {
|
|
351
|
-
label:
|
|
352
|
-
description:
|
|
358
|
+
label: z5.string().min(1),
|
|
359
|
+
description: z5.string().min(1).optional()
|
|
353
360
|
};
|
|
354
|
-
var stringSettingSchemaSchema =
|
|
361
|
+
var stringSettingSchemaSchema = z5.custom(
|
|
355
362
|
(value) => isStandardSchema(value)
|
|
356
363
|
);
|
|
357
|
-
var booleanSettingSchemaSchema =
|
|
364
|
+
var booleanSettingSchemaSchema = z5.custom(
|
|
358
365
|
(value) => isStandardSchema(value)
|
|
359
366
|
);
|
|
360
|
-
var numberSettingSchemaSchema =
|
|
367
|
+
var numberSettingSchemaSchema = z5.custom(
|
|
361
368
|
(value) => isStandardSchema(value)
|
|
362
369
|
);
|
|
363
|
-
var settingDescriptorSchema =
|
|
364
|
-
|
|
365
|
-
type:
|
|
370
|
+
var settingDescriptorSchema = z5.discriminatedUnion("type", [
|
|
371
|
+
z5.object({
|
|
372
|
+
type: z5.literal("string"),
|
|
366
373
|
...settingsBaseFields,
|
|
367
|
-
secret:
|
|
368
|
-
experimental_multiline:
|
|
374
|
+
secret: z5.literal(true).optional(),
|
|
375
|
+
experimental_multiline: z5.boolean().optional(),
|
|
369
376
|
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
370
|
-
default:
|
|
377
|
+
default: z5.string().optional()
|
|
371
378
|
}).strict().refine(
|
|
372
379
|
(descriptor) => !(descriptor.secret === true && descriptor.experimental_multiline === true),
|
|
373
380
|
{
|
|
@@ -375,30 +382,30 @@ var settingDescriptorSchema = z4.discriminatedUnion("type", [
|
|
|
375
382
|
path: ["experimental_multiline"]
|
|
376
383
|
}
|
|
377
384
|
),
|
|
378
|
-
|
|
379
|
-
type:
|
|
385
|
+
z5.object({
|
|
386
|
+
type: z5.literal("boolean"),
|
|
380
387
|
...settingsBaseFields,
|
|
381
388
|
experimental_schema: booleanSettingSchemaSchema.optional(),
|
|
382
|
-
default:
|
|
389
|
+
default: z5.boolean().optional()
|
|
383
390
|
}).strict(),
|
|
384
|
-
|
|
385
|
-
type:
|
|
391
|
+
z5.object({
|
|
392
|
+
type: z5.literal("number"),
|
|
386
393
|
...settingsBaseFields,
|
|
387
394
|
experimental_schema: numberSettingSchemaSchema.optional(),
|
|
388
|
-
default:
|
|
395
|
+
default: z5.number().finite().optional()
|
|
389
396
|
}).strict(),
|
|
390
|
-
|
|
391
|
-
type:
|
|
397
|
+
z5.object({
|
|
398
|
+
type: z5.literal("select"),
|
|
392
399
|
...settingsBaseFields,
|
|
393
|
-
options:
|
|
400
|
+
options: z5.array(z5.string().min(1)).min(1),
|
|
394
401
|
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
395
|
-
default:
|
|
402
|
+
default: z5.string().optional()
|
|
396
403
|
}).strict(),
|
|
397
|
-
|
|
398
|
-
type:
|
|
404
|
+
z5.object({
|
|
405
|
+
type: z5.literal("project"),
|
|
399
406
|
...settingsBaseFields,
|
|
400
407
|
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
401
|
-
default:
|
|
408
|
+
default: z5.string().optional()
|
|
402
409
|
}).strict()
|
|
403
410
|
]);
|
|
404
411
|
function registerSettingDescriptors(target, added) {
|
|
@@ -946,6 +953,18 @@ function validateProviderModelCatalogScope(providerId, value) {
|
|
|
946
953
|
}
|
|
947
954
|
return value;
|
|
948
955
|
}
|
|
956
|
+
var PROVIDER_COMPLETED_TURN_DISPLAYS = COMPLETED_TURN_DISPLAY_VALUES;
|
|
957
|
+
function validateProviderCompletedTurnDisplay(providerId, value) {
|
|
958
|
+
if (value === void 0) {
|
|
959
|
+
return DEFAULT_COMPLETED_TURN_DISPLAY;
|
|
960
|
+
}
|
|
961
|
+
if (typeof value !== "string" || !PROVIDER_COMPLETED_TURN_DISPLAYS.includes(value)) {
|
|
962
|
+
throw new Error(
|
|
963
|
+
`provider "${providerId}" completedTurnDisplay must be one of ${PROVIDER_COMPLETED_TURN_DISPLAYS.join(", ")}`
|
|
964
|
+
);
|
|
965
|
+
}
|
|
966
|
+
return value;
|
|
967
|
+
}
|
|
949
968
|
function validateProviderFallbackModels(providerId, value) {
|
|
950
969
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
951
970
|
throw new Error(`provider "${providerId}" models must be an object`);
|
|
@@ -1326,6 +1345,10 @@ function validatePluginProviderDeclaration(declaration) {
|
|
|
1326
1345
|
allowed: PLUGIN_PROVIDER_COMPOSER_ACTION_VALUES,
|
|
1327
1346
|
requireNonEmpty: false
|
|
1328
1347
|
});
|
|
1348
|
+
const completedTurnDisplay = validateProviderCompletedTurnDisplay(
|
|
1349
|
+
id,
|
|
1350
|
+
declaration.completedTurnDisplay
|
|
1351
|
+
);
|
|
1329
1352
|
const bridgeOptions = declaration.experimental_bridgeOptions === void 0 ? void 0 : normalizeProviderBridgeOptions(
|
|
1330
1353
|
id,
|
|
1331
1354
|
declaration.experimental_bridgeOptions
|
|
@@ -1391,6 +1414,7 @@ function validatePluginProviderDeclaration(declaration) {
|
|
|
1391
1414
|
maintenance: normalizedMaintenance,
|
|
1392
1415
|
capabilities: normalizedCapabilities,
|
|
1393
1416
|
composerActions,
|
|
1417
|
+
completedTurnDisplay,
|
|
1394
1418
|
...strings === void 0 ? {} : { strings },
|
|
1395
1419
|
...serviceTiers === void 0 ? {} : { serviceTiers },
|
|
1396
1420
|
...reasoningLevels === void 0 ? {} : { reasoningLevels },
|
|
@@ -1421,9 +1445,9 @@ function isStandardSchema(value) {
|
|
|
1421
1445
|
const standard = Reflect.get(value, "~standard");
|
|
1422
1446
|
return typeof standard === "object" && standard !== null && Reflect.get(standard, "version") === 1 && typeof Reflect.get(standard, "vendor") === "string" && typeof Reflect.get(standard, "validate") === "function";
|
|
1423
1447
|
}
|
|
1424
|
-
var rpcDescriptionSchema =
|
|
1425
|
-
var rpcPublicationOptionsSchema =
|
|
1426
|
-
experimental_discoverable:
|
|
1448
|
+
var rpcDescriptionSchema = z5.string().trim().min(1).max(4096).optional().transform((value) => value ?? null);
|
|
1449
|
+
var rpcPublicationOptionsSchema = z5.object({
|
|
1450
|
+
experimental_discoverable: z5.boolean().default(false),
|
|
1427
1451
|
experimental_description: rpcDescriptionSchema
|
|
1428
1452
|
}).strict();
|
|
1429
1453
|
function readRpcMethodContract(method, value) {
|
|
@@ -1465,7 +1489,7 @@ function publishedRpcSchema(schema, direction) {
|
|
|
1465
1489
|
if (serialized === void 0 || new TextEncoder().encode(serialized).byteLength > 128 * 1024) {
|
|
1466
1490
|
throw new Error("published RPC schema must be JSON and at most 128 KiB");
|
|
1467
1491
|
}
|
|
1468
|
-
const result =
|
|
1492
|
+
const result = z5.record(z5.string(), jsonValueSchema).parse(JSON.parse(serialized));
|
|
1469
1493
|
const inspect = (value) => {
|
|
1470
1494
|
if (value === null || typeof value !== "object") return;
|
|
1471
1495
|
if (Array.isArray(value)) {
|
|
@@ -1515,7 +1539,7 @@ function zodSchemaToJsonSchema(schema) {
|
|
|
1515
1539
|
if (typeof schema.toJSONSchema === "function") {
|
|
1516
1540
|
return schema.toJSONSchema({ io: "input" });
|
|
1517
1541
|
}
|
|
1518
|
-
return
|
|
1542
|
+
return z5.toJSONSchema(schema, { io: "input" });
|
|
1519
1543
|
}
|
|
1520
1544
|
var SINGLE_SCHEMA_KEYWORDS = [
|
|
1521
1545
|
"additionalItems",
|
|
@@ -1860,15 +1884,15 @@ var ENVIRONMENT_PROVIDER_REQUIREMENT_NAMES = [
|
|
|
1860
1884
|
"gitRemote",
|
|
1861
1885
|
"projectless"
|
|
1862
1886
|
];
|
|
1863
|
-
var environmentCompositionSchema =
|
|
1864
|
-
id:
|
|
1865
|
-
displayName:
|
|
1866
|
-
description:
|
|
1867
|
-
icon:
|
|
1887
|
+
var environmentCompositionSchema = z5.object({
|
|
1888
|
+
id: z5.string().regex(ENVIRONMENT_PROVIDER_ID_PATTERN),
|
|
1889
|
+
displayName: z5.string().trim().min(1).max(ENVIRONMENT_PROVIDER_DISPLAY_NAME_MAX_CHARS),
|
|
1890
|
+
description: z5.string().trim().min(1).max(ENVIRONMENT_PROVIDER_DESCRIPTION_MAX_CHARS).optional().transform((value) => value ?? null),
|
|
1891
|
+
icon: z5.string().trim().min(1).transform(
|
|
1868
1892
|
(icon) => isPluginOwnedIconPath(icon) ? validateProviderRelativePath(icon, "Composition icon") : icon
|
|
1869
1893
|
).optional().transform((value) => value ?? null),
|
|
1870
|
-
machineProviderId:
|
|
1871
|
-
environmentProviderId:
|
|
1894
|
+
machineProviderId: z5.string().regex(ENVIRONMENT_PROVIDER_ID_PATTERN),
|
|
1895
|
+
environmentProviderId: z5.string().regex(ENVIRONMENT_PROVIDER_ID_PATTERN)
|
|
1872
1896
|
}).strict();
|
|
1873
1897
|
function requireProviderIdAndDisplayName(noun, declaration) {
|
|
1874
1898
|
if (typeof declaration !== "object" || declaration === null) {
|
|
@@ -1934,8 +1958,8 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
|
|
|
1934
1958
|
"environment provider",
|
|
1935
1959
|
declaration
|
|
1936
1960
|
);
|
|
1937
|
-
const description =
|
|
1938
|
-
const icon =
|
|
1961
|
+
const description = z5.string().trim().min(1).max(ENVIRONMENT_PROVIDER_DESCRIPTION_MAX_CHARS).optional().transform((value) => value ?? null).parse(declaration.description);
|
|
1962
|
+
const icon = z5.string().trim().min(1).optional().transform((value) => value ?? null).parse(declaration.icon);
|
|
1939
1963
|
if (icon !== null) {
|
|
1940
1964
|
assertProviderIconShape("environment provider", id, icon);
|
|
1941
1965
|
}
|
|
@@ -2004,9 +2028,9 @@ function normalizeEnvironmentProviderRequirements(id, declaration) {
|
|
|
2004
2028
|
}
|
|
2005
2029
|
return normalized;
|
|
2006
2030
|
}
|
|
2007
|
-
var environmentProviderPolicySchema =
|
|
2008
|
-
retireGraceMs:
|
|
2009
|
-
pathKeys:
|
|
2031
|
+
var environmentProviderPolicySchema = z5.object({
|
|
2032
|
+
retireGraceMs: z5.number().int().nonnegative().nullable().default(3e5),
|
|
2033
|
+
pathKeys: z5.enum(["per-thread", "per-attempt"]).default("per-thread")
|
|
2010
2034
|
}).strict();
|
|
2011
2035
|
var MACHINE_PROVIDER_DESCRIPTION_MAX_CHARS = 200;
|
|
2012
2036
|
function validatePluginMachineProviderDeclaration(declaration) {
|
|
@@ -2014,10 +2038,10 @@ function validatePluginMachineProviderDeclaration(declaration) {
|
|
|
2014
2038
|
"machine provider",
|
|
2015
2039
|
declaration
|
|
2016
2040
|
);
|
|
2017
|
-
const description =
|
|
2018
|
-
const icon =
|
|
2041
|
+
const description = z5.string().trim().min(1).max(MACHINE_PROVIDER_DESCRIPTION_MAX_CHARS).parse(declaration.description);
|
|
2042
|
+
const icon = z5.string().trim().min(1).parse(declaration.icon);
|
|
2019
2043
|
assertProviderIconShape("machine provider", id, icon);
|
|
2020
|
-
const ephemeral =
|
|
2044
|
+
const ephemeral = z5.boolean().default(false).parse(declaration.ephemeral);
|
|
2021
2045
|
const inputs = normalizeProviderInputs(
|
|
2022
2046
|
"machine provider",
|
|
2023
2047
|
id,
|