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