@get-bb/plugin-sdk 0.4.30 → 0.4.35
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 +124 -3
- package/bundled-types/bb-plugin-sdk-host.d.ts +1 -1
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +563 -8
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +10 -1
- package/bundled-types/bb-plugin-sdk-testing.d.ts +31 -3
- package/bundled-types/bb-plugin-sdk.d.ts +903 -21
- package/dist/internal/host-policy.js +72 -1
- package/dist/internal/plugin-app-collector.js +18 -0
- package/dist/provider-bridge-acp.js +1382 -1369
- package/dist/provider-bridge-testing.js +1014 -1001
- package/dist/provider-bridge.js +1047 -1034
- package/dist/testing/app.js +33 -1
- package/dist/testing/index.js +186 -34
- package/package.json +1 -1
|
@@ -293,12 +293,19 @@ var settingsBaseFields = {
|
|
|
293
293
|
label: z3.string().min(1),
|
|
294
294
|
description: z3.string().min(1).optional()
|
|
295
295
|
};
|
|
296
|
+
var stringSettingSchemaSchema = z3.custom(
|
|
297
|
+
(value) => isStandardSchema(value)
|
|
298
|
+
);
|
|
299
|
+
var booleanSettingSchemaSchema = z3.custom(
|
|
300
|
+
(value) => isStandardSchema(value)
|
|
301
|
+
);
|
|
296
302
|
var settingDescriptorSchema = z3.discriminatedUnion("type", [
|
|
297
303
|
z3.object({
|
|
298
304
|
type: z3.literal("string"),
|
|
299
305
|
...settingsBaseFields,
|
|
300
306
|
secret: z3.literal(true).optional(),
|
|
301
307
|
experimental_multiline: z3.boolean().optional(),
|
|
308
|
+
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
302
309
|
default: z3.string().optional()
|
|
303
310
|
}).strict().refine(
|
|
304
311
|
(descriptor) => !(descriptor.secret === true && descriptor.experimental_multiline === true),
|
|
@@ -310,17 +317,20 @@ var settingDescriptorSchema = z3.discriminatedUnion("type", [
|
|
|
310
317
|
z3.object({
|
|
311
318
|
type: z3.literal("boolean"),
|
|
312
319
|
...settingsBaseFields,
|
|
320
|
+
experimental_schema: booleanSettingSchemaSchema.optional(),
|
|
313
321
|
default: z3.boolean().optional()
|
|
314
322
|
}).strict(),
|
|
315
323
|
z3.object({
|
|
316
324
|
type: z3.literal("select"),
|
|
317
325
|
...settingsBaseFields,
|
|
318
326
|
options: z3.array(z3.string().min(1)).min(1),
|
|
327
|
+
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
319
328
|
default: z3.string().optional()
|
|
320
329
|
}).strict(),
|
|
321
330
|
z3.object({
|
|
322
331
|
type: z3.literal("project"),
|
|
323
332
|
...settingsBaseFields,
|
|
333
|
+
experimental_schema: stringSettingSchemaSchema.optional(),
|
|
324
334
|
default: z3.string().optional()
|
|
325
335
|
}).strict()
|
|
326
336
|
]);
|
|
@@ -349,11 +359,39 @@ function registerSettingDescriptors(target, added) {
|
|
|
349
359
|
`default for setting "${key}" must be one of its options`
|
|
350
360
|
);
|
|
351
361
|
}
|
|
362
|
+
if (descriptor.default !== void 0) {
|
|
363
|
+
const errors = validateSettingsUpdate(
|
|
364
|
+
{ [key]: descriptor },
|
|
365
|
+
{ [key]: descriptor.default }
|
|
366
|
+
);
|
|
367
|
+
if (errors.length > 0) {
|
|
368
|
+
throw new Error(`invalid default for setting "${key}": ${errors[0]}`);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
352
371
|
validated[key] = descriptor;
|
|
353
372
|
}
|
|
354
373
|
Object.assign(target, validated);
|
|
355
374
|
return validated;
|
|
356
375
|
}
|
|
376
|
+
function settingSchemaError(key, schema, value) {
|
|
377
|
+
if (schema === void 0) return null;
|
|
378
|
+
try {
|
|
379
|
+
const result = schema["~standard"].validate(value);
|
|
380
|
+
if (result instanceof Promise) {
|
|
381
|
+
return `schema for setting "${key}" must validate synchronously`;
|
|
382
|
+
}
|
|
383
|
+
if (result.issues !== void 0) {
|
|
384
|
+
return result.issues[0]?.message ?? `schema for setting "${key}" rejected the value`;
|
|
385
|
+
}
|
|
386
|
+
if (result.value !== value) {
|
|
387
|
+
return `schema for setting "${key}" must not transform its value`;
|
|
388
|
+
}
|
|
389
|
+
return null;
|
|
390
|
+
} catch (error) {
|
|
391
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
392
|
+
return `schema for setting "${key}" failed: ${detail}`;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
357
395
|
function validateSettingsUpdate(descriptors, values) {
|
|
358
396
|
const errors = [];
|
|
359
397
|
for (const [key, value] of Object.entries(values)) {
|
|
@@ -366,6 +404,15 @@ function validateSettingsUpdate(descriptors, values) {
|
|
|
366
404
|
if (descriptor.type === "boolean") {
|
|
367
405
|
if (typeof value !== "boolean") {
|
|
368
406
|
errors.push(`setting "${key}" expects a boolean`);
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
const validationError2 = settingSchemaError(
|
|
410
|
+
key,
|
|
411
|
+
descriptor.experimental_schema,
|
|
412
|
+
value
|
|
413
|
+
);
|
|
414
|
+
if (validationError2 !== null) {
|
|
415
|
+
errors.push(validationError2);
|
|
369
416
|
}
|
|
370
417
|
continue;
|
|
371
418
|
}
|
|
@@ -377,6 +424,15 @@ function validateSettingsUpdate(descriptors, values) {
|
|
|
377
424
|
errors.push(
|
|
378
425
|
`setting "${key}" must be one of: ${descriptor.options.join(", ")}`
|
|
379
426
|
);
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
const validationError = settingSchemaError(
|
|
430
|
+
key,
|
|
431
|
+
descriptor.experimental_schema,
|
|
432
|
+
value
|
|
433
|
+
);
|
|
434
|
+
if (validationError !== null) {
|
|
435
|
+
errors.push(validationError);
|
|
380
436
|
}
|
|
381
437
|
}
|
|
382
438
|
return errors;
|
|
@@ -1290,6 +1346,12 @@ function readRpcMethodContract(method, value) {
|
|
|
1290
1346
|
function isZodSchemaLike(value) {
|
|
1291
1347
|
return typeof value === "object" && value !== null && typeof value.safeParse === "function";
|
|
1292
1348
|
}
|
|
1349
|
+
function zodSchemaToJsonSchema(schema) {
|
|
1350
|
+
if (typeof schema.toJSONSchema === "function") {
|
|
1351
|
+
return schema.toJSONSchema({ io: "input" });
|
|
1352
|
+
}
|
|
1353
|
+
return z3.toJSONSchema(schema, { io: "input" });
|
|
1354
|
+
}
|
|
1293
1355
|
var SINGLE_SCHEMA_KEYWORDS = [
|
|
1294
1356
|
"additionalItems",
|
|
1295
1357
|
"additionalProperties",
|
|
@@ -1608,6 +1670,12 @@ function agentToolIconRefusalMessage(toolName, problem) {
|
|
|
1608
1670
|
function providerWithoutBridgeMessage(providerId) {
|
|
1609
1671
|
return `provider "${providerId}" has no bridge to run on: this plugin declares no "bb.host" entry in its manifest`;
|
|
1610
1672
|
}
|
|
1673
|
+
function storePluginHook(records, hook, handler) {
|
|
1674
|
+
records[hook] = handler;
|
|
1675
|
+
}
|
|
1676
|
+
function pluginHookAlreadyRegisteredMessage(hook) {
|
|
1677
|
+
return `a "${hook}" hook handler is already registered by this plugin`;
|
|
1678
|
+
}
|
|
1611
1679
|
export {
|
|
1612
1680
|
AGENT_TOOL_NAME_PATTERN,
|
|
1613
1681
|
BACKGROUND_NAME_PATTERN,
|
|
@@ -1645,15 +1713,18 @@ export {
|
|
|
1645
1713
|
normalizeMentionProviderTriggers,
|
|
1646
1714
|
parsePluginAgentToolPresentation,
|
|
1647
1715
|
pluginCliCollisionWarning,
|
|
1716
|
+
pluginHookAlreadyRegisteredMessage,
|
|
1648
1717
|
providerAlreadyRegisteredMessage,
|
|
1649
1718
|
providerIconRefusalMessage,
|
|
1650
1719
|
providerWithoutBridgeMessage,
|
|
1651
1720
|
readRpcMethodContract,
|
|
1652
1721
|
registerSettingDescriptors,
|
|
1653
1722
|
rejectStaleAgentToolFields,
|
|
1723
|
+
storePluginHook,
|
|
1654
1724
|
summarizeParseIssues,
|
|
1655
1725
|
undeclaredIconProblem,
|
|
1656
1726
|
validatePluginAiServiceDeclaration,
|
|
1657
1727
|
validatePluginProviderDeclaration,
|
|
1658
|
-
validateSettingsUpdate
|
|
1728
|
+
validateSettingsUpdate,
|
|
1729
|
+
zodSchemaToJsonSchema
|
|
1659
1730
|
};
|
|
@@ -252,6 +252,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
252
252
|
composerCustomizations: [],
|
|
253
253
|
pendingInteractions: [],
|
|
254
254
|
sidebarFooterActions: [],
|
|
255
|
+
experimentalSidebarNavigations: [],
|
|
255
256
|
threadLists: [],
|
|
256
257
|
threadHeaderActions: [],
|
|
257
258
|
fileOpeners: [],
|
|
@@ -273,6 +274,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
273
274
|
composerCustomization: /* @__PURE__ */ new Set(),
|
|
274
275
|
pendingInteraction: /* @__PURE__ */ new Set(),
|
|
275
276
|
sidebarFooterAction: /* @__PURE__ */ new Set(),
|
|
277
|
+
sidebarNavigation: /* @__PURE__ */ new Set(),
|
|
276
278
|
threadList: /* @__PURE__ */ new Set(),
|
|
277
279
|
threadHeaderAction: /* @__PURE__ */ new Set(),
|
|
278
280
|
fileOpener: /* @__PURE__ */ new Set(),
|
|
@@ -464,6 +466,22 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
464
466
|
run: registration.run
|
|
465
467
|
});
|
|
466
468
|
},
|
|
469
|
+
experimental_sidebarNavigation(registration) {
|
|
470
|
+
const kind = "slots.experimental_sidebarNavigation";
|
|
471
|
+
const id = requireSlotId(kind, registration?.id);
|
|
472
|
+
requireUniqueId(kind, seenIds.sidebarNavigation, id);
|
|
473
|
+
const description = requireOptionalString(
|
|
474
|
+
kind,
|
|
475
|
+
"description",
|
|
476
|
+
registration.description
|
|
477
|
+
);
|
|
478
|
+
collected.experimentalSidebarNavigations.push({
|
|
479
|
+
id,
|
|
480
|
+
title: requireNonEmptyString(kind, "title", registration.title),
|
|
481
|
+
...description !== void 0 ? { description } : {},
|
|
482
|
+
component: requireComponent(kind, registration.component)
|
|
483
|
+
});
|
|
484
|
+
},
|
|
467
485
|
experimental_threadList(registration) {
|
|
468
486
|
const kind = "slots.experimental_threadList";
|
|
469
487
|
const id = requireSlotId(kind, registration?.id);
|