@get-bb/plugin-sdk 0.4.101 → 0.4.106
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 +86 -15
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +2 -0
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +74 -21
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +35 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +30 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +9 -1
- package/bundled-types/bb-plugin-sdk-testing.d.ts +6 -3
- package/bundled-types/bb-plugin-sdk.d.ts +576 -33
- package/dist/index.js +799 -0
- package/dist/internal/host-policy.js +28 -15
- package/dist/provider-bridge-acp.js +19 -3
- package/dist/provider-bridge-testing.js +18 -2
- package/dist/provider-bridge.js +18 -2
- package/dist/testing/app.js +19 -2
- package/dist/testing/index.js +34 -16
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ function parseNamespacedGlyph(glyph) {
|
|
|
25
25
|
// ../domain/src/plugin-cli.ts
|
|
26
26
|
var RESERVED_BB_CLI_COMMANDS = [
|
|
27
27
|
"browser",
|
|
28
|
+
"diagnostics",
|
|
28
29
|
"environment",
|
|
29
30
|
"file",
|
|
30
31
|
"guide",
|
|
@@ -1705,12 +1706,12 @@ function rejectStaleAgentToolFields(toolName, tool) {
|
|
|
1705
1706
|
);
|
|
1706
1707
|
}
|
|
1707
1708
|
}
|
|
1708
|
-
function
|
|
1709
|
+
function parsePluginRowPresentation(subject, value) {
|
|
1709
1710
|
if (value === void 0) {
|
|
1710
1711
|
return null;
|
|
1711
1712
|
}
|
|
1712
1713
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1713
|
-
throw new Error(
|
|
1714
|
+
throw new Error(`${subject} presentation must be an object`);
|
|
1714
1715
|
}
|
|
1715
1716
|
const declared = value;
|
|
1716
1717
|
const presentation = {};
|
|
@@ -1718,13 +1719,13 @@ function parsePluginAgentToolPresentation(toolName, value) {
|
|
|
1718
1719
|
const label = declared.label;
|
|
1719
1720
|
if (typeof label !== "object" || label === null || typeof label.pending !== "string" || typeof label.completed !== "string") {
|
|
1720
1721
|
throw new Error(
|
|
1721
|
-
|
|
1722
|
+
`${subject} presentation.label must provide pending and completed strings`
|
|
1722
1723
|
);
|
|
1723
1724
|
}
|
|
1724
1725
|
const { pending, completed } = label;
|
|
1725
1726
|
if (pending.trim().length === 0 || completed.trim().length === 0 || pending.length > PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS || completed.length > PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS) {
|
|
1726
1727
|
throw new Error(
|
|
1727
|
-
|
|
1728
|
+
`${subject} presentation.label strings must be non-empty and at most ${PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS} characters`
|
|
1728
1729
|
);
|
|
1729
1730
|
}
|
|
1730
1731
|
presentation.label = { pending, completed };
|
|
@@ -1732,17 +1733,13 @@ function parsePluginAgentToolPresentation(toolName, value) {
|
|
|
1732
1733
|
if (declared.icon !== void 0) {
|
|
1733
1734
|
const icon = declared.icon;
|
|
1734
1735
|
if (typeof icon !== "object" || icon === null || typeof icon.glyph !== "string" || icon.glyph.trim().length === 0) {
|
|
1735
|
-
throw new Error(
|
|
1736
|
-
`tool "${toolName}" presentation.icon must be { glyph: string }`
|
|
1737
|
-
);
|
|
1736
|
+
throw new Error(`${subject} presentation.icon must be { glyph: string }`);
|
|
1738
1737
|
}
|
|
1739
1738
|
presentation.icon = { glyph: icon.glyph };
|
|
1740
1739
|
}
|
|
1741
1740
|
if (declared.suppress !== void 0) {
|
|
1742
1741
|
if (typeof declared.suppress !== "boolean") {
|
|
1743
|
-
throw new Error(
|
|
1744
|
-
`tool "${toolName}" presentation.suppress must be a boolean`
|
|
1745
|
-
);
|
|
1742
|
+
throw new Error(`${subject} presentation.suppress must be a boolean`);
|
|
1746
1743
|
}
|
|
1747
1744
|
presentation.suppress = declared.suppress;
|
|
1748
1745
|
}
|
|
@@ -1750,7 +1747,7 @@ function parsePluginAgentToolPresentation(toolName, value) {
|
|
|
1750
1747
|
const tint = declared.tint;
|
|
1751
1748
|
if (typeof tint !== "object" || tint === null || typeof tint.light !== "string" || typeof tint.dark !== "string") {
|
|
1752
1749
|
throw new Error(
|
|
1753
|
-
|
|
1750
|
+
`${subject} presentation.tint must provide light and dark strings`
|
|
1754
1751
|
);
|
|
1755
1752
|
}
|
|
1756
1753
|
presentation.tint = {
|
|
@@ -1986,6 +1983,12 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
|
|
|
1986
1983
|
declaration.availability,
|
|
1987
1984
|
"availability"
|
|
1988
1985
|
);
|
|
1986
|
+
assertOptionalFunction(
|
|
1987
|
+
"environment provider",
|
|
1988
|
+
id,
|
|
1989
|
+
declaration.experimental_existingPath,
|
|
1990
|
+
"experimental_existingPath"
|
|
1991
|
+
);
|
|
1989
1992
|
return {
|
|
1990
1993
|
id,
|
|
1991
1994
|
displayName,
|
|
@@ -1996,6 +1999,7 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
|
|
|
1996
1999
|
inputsJsonSchema: inputs === null ? null : inputs.jsonSchema,
|
|
1997
2000
|
availability: declaration.availability ?? null,
|
|
1998
2001
|
validate: declaration.validate ?? null,
|
|
2002
|
+
experimental_existingPath: declaration.experimental_existingPath ?? null,
|
|
1999
2003
|
create: declaration.create,
|
|
2000
2004
|
remove: declaration.remove,
|
|
2001
2005
|
policy: environmentProviderPolicySchema.parse(declaration.policy ?? {})
|
|
@@ -2333,6 +2337,7 @@ function normalizeCliRegistration(registration, alreadyRegistered) {
|
|
|
2333
2337
|
name,
|
|
2334
2338
|
summary: registration.summary,
|
|
2335
2339
|
commands: validatedCommands,
|
|
2340
|
+
rendersHelp: registration.rendersHelp === true,
|
|
2336
2341
|
run: registration.run.bind(registration)
|
|
2337
2342
|
};
|
|
2338
2343
|
}
|
|
@@ -2361,8 +2366,8 @@ function normalizeAgentToolRegistration(args) {
|
|
|
2361
2366
|
`tool "${name}" instructions exceed the ${PLUGIN_AGENT_STATIC_INSTRUCTIONS_MAX_CHARS}-character limit`
|
|
2362
2367
|
);
|
|
2363
2368
|
}
|
|
2364
|
-
const presentation =
|
|
2365
|
-
name
|
|
2369
|
+
const presentation = parsePluginRowPresentation(
|
|
2370
|
+
`tool "${name}"`,
|
|
2366
2371
|
tool.presentation
|
|
2367
2372
|
);
|
|
2368
2373
|
if (presentation?.icon !== void 0) {
|
|
@@ -2490,12 +2495,20 @@ function normalizeInteractionRequest(request) {
|
|
|
2490
2495
|
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 60 * 60 * 1e3) {
|
|
2491
2496
|
throw new Error("ui.requestInput timeoutMs must be between 1 and 3600000");
|
|
2492
2497
|
}
|
|
2498
|
+
if (request.describeSubmission !== void 0 && typeof request.describeSubmission !== "function") {
|
|
2499
|
+
throw new Error("ui.requestInput describeSubmission must be a function");
|
|
2500
|
+
}
|
|
2493
2501
|
return {
|
|
2494
2502
|
threadId: request.threadId,
|
|
2495
2503
|
rendererId: request.rendererId,
|
|
2496
2504
|
title: request.title.trim(),
|
|
2497
2505
|
payload,
|
|
2498
|
-
timeoutMs
|
|
2506
|
+
timeoutMs,
|
|
2507
|
+
presentation: parsePluginRowPresentation(
|
|
2508
|
+
`ui.requestInput form "${request.rendererId}"`,
|
|
2509
|
+
request.presentation
|
|
2510
|
+
),
|
|
2511
|
+
describeSubmission: request.describeSubmission ?? null
|
|
2499
2512
|
};
|
|
2500
2513
|
}
|
|
2501
2514
|
function validateProviderEnvContribution(label, providerId, resolve, registered) {
|
|
@@ -2807,7 +2820,7 @@ export {
|
|
|
2807
2820
|
normalizeRpcJsonResult,
|
|
2808
2821
|
normalizeRpcRegistration,
|
|
2809
2822
|
normalizeWebSocketRouteRegistration,
|
|
2810
|
-
|
|
2823
|
+
parsePluginRowPresentation,
|
|
2811
2824
|
pluginCliCollisionWarning,
|
|
2812
2825
|
pluginHookAlreadyRegisteredMessage,
|
|
2813
2826
|
providerAlreadyRegisteredMessage,
|
|
@@ -1500,7 +1500,8 @@ var userQuestionPendingInteractionPayloadSchema = z10.object({
|
|
|
1500
1500
|
var pluginPendingInteractionPayloadSchema = z10.object({
|
|
1501
1501
|
kind: z10.literal("plugin"),
|
|
1502
1502
|
title: z10.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
1503
|
-
data: jsonValueSchema
|
|
1503
|
+
data: jsonValueSchema,
|
|
1504
|
+
presentation: threadEventItemPresentationSchema.optional()
|
|
1504
1505
|
});
|
|
1505
1506
|
var pluginExtensionInteractionRequestPayloadSchema = z10.object({
|
|
1506
1507
|
kind: extensionKindSchema,
|
|
@@ -1551,8 +1552,17 @@ var userQuestionPendingInteractionResolutionSchema = z10.object({
|
|
|
1551
1552
|
kind: z10.literal("user_answer"),
|
|
1552
1553
|
answers: z10.record(z10.string().min(1), pendingInteractionUserAnswerSchema)
|
|
1553
1554
|
});
|
|
1555
|
+
var pluginInteractionDescriptionSchema = z10.object({
|
|
1556
|
+
title: z10.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH).optional(),
|
|
1557
|
+
detail: z10.string().trim().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
1558
|
+
payload: jsonValueSchema.refine(
|
|
1559
|
+
(value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
|
|
1560
|
+
{ message: "Plugin interaction description payload exceeds 64 KiB" }
|
|
1561
|
+
).optional()
|
|
1562
|
+
});
|
|
1554
1563
|
var pluginPendingInteractionResolutionSchema = z10.object({
|
|
1555
|
-
kind: z10.literal("plugin_submitted")
|
|
1564
|
+
kind: z10.literal("plugin_submitted"),
|
|
1565
|
+
description: pluginInteractionDescriptionSchema.optional()
|
|
1556
1566
|
});
|
|
1557
1567
|
var pluginExtensionInteractionResolutionSchema = z10.object({
|
|
1558
1568
|
kind: z10.literal("request_answer"),
|
|
@@ -1703,6 +1713,7 @@ var systemMessageKindValues = [
|
|
|
1703
1713
|
"child-failed",
|
|
1704
1714
|
"child-interrupted",
|
|
1705
1715
|
"child-outcome-batch",
|
|
1716
|
+
"tool-result-delivered",
|
|
1706
1717
|
"unlabeled"
|
|
1707
1718
|
];
|
|
1708
1719
|
var systemMessageKindSchema = z12.enum(systemMessageKindValues);
|
|
@@ -1715,6 +1726,11 @@ var systemMessageSubjectSchema = z12.discriminatedUnion("kind", [
|
|
|
1715
1726
|
z12.object({
|
|
1716
1727
|
kind: z12.literal("thread-batch"),
|
|
1717
1728
|
count: z12.number()
|
|
1729
|
+
}),
|
|
1730
|
+
z12.object({
|
|
1731
|
+
kind: z12.literal("tool-call"),
|
|
1732
|
+
toolName: z12.string(),
|
|
1733
|
+
suppress: z12.boolean()
|
|
1718
1734
|
})
|
|
1719
1735
|
]);
|
|
1720
1736
|
|
|
@@ -9261,7 +9277,7 @@ async function handleFsWriteTextFile(session, params, responder) {
|
|
|
9261
9277
|
...oldText === void 0 ? {} : { oldText },
|
|
9262
9278
|
content: parsed.data.content
|
|
9263
9279
|
});
|
|
9264
|
-
responder.result(
|
|
9280
|
+
responder.result({});
|
|
9265
9281
|
} catch (error) {
|
|
9266
9282
|
responder.error(
|
|
9267
9283
|
-32603,
|
|
@@ -595,7 +595,8 @@ var userQuestionPendingInteractionPayloadSchema = z8.object({
|
|
|
595
595
|
var pluginPendingInteractionPayloadSchema = z8.object({
|
|
596
596
|
kind: z8.literal("plugin"),
|
|
597
597
|
title: z8.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
598
|
-
data: jsonValueSchema
|
|
598
|
+
data: jsonValueSchema,
|
|
599
|
+
presentation: threadEventItemPresentationSchema.optional()
|
|
599
600
|
});
|
|
600
601
|
var pluginExtensionInteractionRequestPayloadSchema = z8.object({
|
|
601
602
|
kind: extensionKindSchema,
|
|
@@ -643,8 +644,17 @@ var userQuestionPendingInteractionResolutionSchema = z8.object({
|
|
|
643
644
|
kind: z8.literal("user_answer"),
|
|
644
645
|
answers: z8.record(z8.string().min(1), pendingInteractionUserAnswerSchema)
|
|
645
646
|
});
|
|
647
|
+
var pluginInteractionDescriptionSchema = z8.object({
|
|
648
|
+
title: z8.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH).optional(),
|
|
649
|
+
detail: z8.string().trim().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
650
|
+
payload: jsonValueSchema.refine(
|
|
651
|
+
(value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
|
|
652
|
+
{ message: "Plugin interaction description payload exceeds 64 KiB" }
|
|
653
|
+
).optional()
|
|
654
|
+
});
|
|
646
655
|
var pluginPendingInteractionResolutionSchema = z8.object({
|
|
647
|
-
kind: z8.literal("plugin_submitted")
|
|
656
|
+
kind: z8.literal("plugin_submitted"),
|
|
657
|
+
description: pluginInteractionDescriptionSchema.optional()
|
|
648
658
|
});
|
|
649
659
|
var pluginExtensionInteractionResolutionSchema = z8.object({
|
|
650
660
|
kind: z8.literal("request_answer"),
|
|
@@ -792,6 +802,7 @@ var systemMessageKindValues = [
|
|
|
792
802
|
"child-failed",
|
|
793
803
|
"child-interrupted",
|
|
794
804
|
"child-outcome-batch",
|
|
805
|
+
"tool-result-delivered",
|
|
795
806
|
"unlabeled"
|
|
796
807
|
];
|
|
797
808
|
var systemMessageKindSchema = z10.enum(systemMessageKindValues);
|
|
@@ -804,6 +815,11 @@ var systemMessageSubjectSchema = z10.discriminatedUnion("kind", [
|
|
|
804
815
|
z10.object({
|
|
805
816
|
kind: z10.literal("thread-batch"),
|
|
806
817
|
count: z10.number()
|
|
818
|
+
}),
|
|
819
|
+
z10.object({
|
|
820
|
+
kind: z10.literal("tool-call"),
|
|
821
|
+
toolName: z10.string(),
|
|
822
|
+
suppress: z10.boolean()
|
|
807
823
|
})
|
|
808
824
|
]);
|
|
809
825
|
|
package/dist/provider-bridge.js
CHANGED
|
@@ -2521,7 +2521,8 @@ var userQuestionPendingInteractionPayloadSchema = z12.object({
|
|
|
2521
2521
|
var pluginPendingInteractionPayloadSchema = z12.object({
|
|
2522
2522
|
kind: z12.literal("plugin"),
|
|
2523
2523
|
title: z12.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
2524
|
-
data: jsonValueSchema
|
|
2524
|
+
data: jsonValueSchema,
|
|
2525
|
+
presentation: threadEventItemPresentationSchema.optional()
|
|
2525
2526
|
});
|
|
2526
2527
|
var pluginExtensionInteractionRequestPayloadSchema = z12.object({
|
|
2527
2528
|
kind: extensionKindSchema,
|
|
@@ -2575,8 +2576,17 @@ var userQuestionPendingInteractionResolutionSchema = z12.object({
|
|
|
2575
2576
|
kind: z12.literal("user_answer"),
|
|
2576
2577
|
answers: z12.record(z12.string().min(1), pendingInteractionUserAnswerSchema)
|
|
2577
2578
|
});
|
|
2579
|
+
var pluginInteractionDescriptionSchema = z12.object({
|
|
2580
|
+
title: z12.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH).optional(),
|
|
2581
|
+
detail: z12.string().trim().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
2582
|
+
payload: jsonValueSchema.refine(
|
|
2583
|
+
(value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
|
|
2584
|
+
{ message: "Plugin interaction description payload exceeds 64 KiB" }
|
|
2585
|
+
).optional()
|
|
2586
|
+
});
|
|
2578
2587
|
var pluginPendingInteractionResolutionSchema = z12.object({
|
|
2579
|
-
kind: z12.literal("plugin_submitted")
|
|
2588
|
+
kind: z12.literal("plugin_submitted"),
|
|
2589
|
+
description: pluginInteractionDescriptionSchema.optional()
|
|
2580
2590
|
});
|
|
2581
2591
|
var pluginExtensionInteractionResolutionSchema = z12.object({
|
|
2582
2592
|
kind: z12.literal("request_answer"),
|
|
@@ -2733,6 +2743,7 @@ var systemMessageKindValues = [
|
|
|
2733
2743
|
"child-failed",
|
|
2734
2744
|
"child-interrupted",
|
|
2735
2745
|
"child-outcome-batch",
|
|
2746
|
+
"tool-result-delivered",
|
|
2736
2747
|
"unlabeled"
|
|
2737
2748
|
];
|
|
2738
2749
|
var systemMessageKindSchema = z14.enum(systemMessageKindValues);
|
|
@@ -2745,6 +2756,11 @@ var systemMessageSubjectSchema = z14.discriminatedUnion("kind", [
|
|
|
2745
2756
|
z14.object({
|
|
2746
2757
|
kind: z14.literal("thread-batch"),
|
|
2747
2758
|
count: z14.number()
|
|
2759
|
+
}),
|
|
2760
|
+
z14.object({
|
|
2761
|
+
kind: z14.literal("tool-call"),
|
|
2762
|
+
toolName: z14.string(),
|
|
2763
|
+
suppress: z14.boolean()
|
|
2748
2764
|
})
|
|
2749
2765
|
]);
|
|
2750
2766
|
|
package/dist/testing/app.js
CHANGED
|
@@ -15157,7 +15157,7 @@ function TestBranchPicker({
|
|
|
15157
15157
|
"input",
|
|
15158
15158
|
{
|
|
15159
15159
|
"aria-label": label ?? "Branch",
|
|
15160
|
-
placeholder: placeholder ?? "",
|
|
15160
|
+
placeholder: placeholder ?? "Select branch",
|
|
15161
15161
|
disabled: inert,
|
|
15162
15162
|
value: value ?? "",
|
|
15163
15163
|
onChange: (event) => {
|
|
@@ -15800,7 +15800,8 @@ function renderSlot(registration, props, options = {}) {
|
|
|
15800
15800
|
quotes: [],
|
|
15801
15801
|
mentions: [],
|
|
15802
15802
|
focusCount: 0,
|
|
15803
|
-
submits: []
|
|
15803
|
+
submits: [],
|
|
15804
|
+
selections: []
|
|
15804
15805
|
};
|
|
15805
15806
|
const composerOwnership = { active: true };
|
|
15806
15807
|
const submissionListeners = /* @__PURE__ */ new Set();
|
|
@@ -15885,6 +15886,22 @@ ${block}
|
|
|
15885
15886
|
composerLog.submits.push(options2);
|
|
15886
15887
|
commitComposerText("");
|
|
15887
15888
|
for (const listener of submissionListeners) listener();
|
|
15889
|
+
},
|
|
15890
|
+
async experimental_setSelection(selection) {
|
|
15891
|
+
if (!composerOwnership.active) {
|
|
15892
|
+
throw new Error("This composer is no longer active.");
|
|
15893
|
+
}
|
|
15894
|
+
if (composerScope.kind === "queued-message" || composerScope.kind === "side-chat") {
|
|
15895
|
+
throw new Error("This composer has no pickers to set.");
|
|
15896
|
+
}
|
|
15897
|
+
const {
|
|
15898
|
+
projectId: _projectId,
|
|
15899
|
+
environment: _environment,
|
|
15900
|
+
...rest
|
|
15901
|
+
} = selection;
|
|
15902
|
+
const accepted = composerScope.kind === "thread" ? rest : { ...selection };
|
|
15903
|
+
composerLog.selections.push(accepted);
|
|
15904
|
+
return accepted;
|
|
15888
15905
|
}
|
|
15889
15906
|
}
|
|
15890
15907
|
};
|
package/dist/testing/index.js
CHANGED
|
@@ -25,6 +25,7 @@ function parseNamespacedGlyph(glyph) {
|
|
|
25
25
|
// ../domain/src/plugin-cli.ts
|
|
26
26
|
var RESERVED_BB_CLI_COMMANDS = [
|
|
27
27
|
"browser",
|
|
28
|
+
"diagnostics",
|
|
28
29
|
"environment",
|
|
29
30
|
"file",
|
|
30
31
|
"guide",
|
|
@@ -1740,12 +1741,12 @@ function rejectStaleAgentToolFields(toolName, tool) {
|
|
|
1740
1741
|
);
|
|
1741
1742
|
}
|
|
1742
1743
|
}
|
|
1743
|
-
function
|
|
1744
|
+
function parsePluginRowPresentation(subject, value) {
|
|
1744
1745
|
if (value === void 0) {
|
|
1745
1746
|
return null;
|
|
1746
1747
|
}
|
|
1747
1748
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1748
|
-
throw new Error(
|
|
1749
|
+
throw new Error(`${subject} presentation must be an object`);
|
|
1749
1750
|
}
|
|
1750
1751
|
const declared = value;
|
|
1751
1752
|
const presentation = {};
|
|
@@ -1753,13 +1754,13 @@ function parsePluginAgentToolPresentation(toolName, value) {
|
|
|
1753
1754
|
const label = declared.label;
|
|
1754
1755
|
if (typeof label !== "object" || label === null || typeof label.pending !== "string" || typeof label.completed !== "string") {
|
|
1755
1756
|
throw new Error(
|
|
1756
|
-
|
|
1757
|
+
`${subject} presentation.label must provide pending and completed strings`
|
|
1757
1758
|
);
|
|
1758
1759
|
}
|
|
1759
1760
|
const { pending, completed } = label;
|
|
1760
1761
|
if (pending.trim().length === 0 || completed.trim().length === 0 || pending.length > PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS || completed.length > PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS) {
|
|
1761
1762
|
throw new Error(
|
|
1762
|
-
|
|
1763
|
+
`${subject} presentation.label strings must be non-empty and at most ${PLUGIN_AGENT_STATUS_LABEL_MAX_CHARS} characters`
|
|
1763
1764
|
);
|
|
1764
1765
|
}
|
|
1765
1766
|
presentation.label = { pending, completed };
|
|
@@ -1767,17 +1768,13 @@ function parsePluginAgentToolPresentation(toolName, value) {
|
|
|
1767
1768
|
if (declared.icon !== void 0) {
|
|
1768
1769
|
const icon = declared.icon;
|
|
1769
1770
|
if (typeof icon !== "object" || icon === null || typeof icon.glyph !== "string" || icon.glyph.trim().length === 0) {
|
|
1770
|
-
throw new Error(
|
|
1771
|
-
`tool "${toolName}" presentation.icon must be { glyph: string }`
|
|
1772
|
-
);
|
|
1771
|
+
throw new Error(`${subject} presentation.icon must be { glyph: string }`);
|
|
1773
1772
|
}
|
|
1774
1773
|
presentation.icon = { glyph: icon.glyph };
|
|
1775
1774
|
}
|
|
1776
1775
|
if (declared.suppress !== void 0) {
|
|
1777
1776
|
if (typeof declared.suppress !== "boolean") {
|
|
1778
|
-
throw new Error(
|
|
1779
|
-
`tool "${toolName}" presentation.suppress must be a boolean`
|
|
1780
|
-
);
|
|
1777
|
+
throw new Error(`${subject} presentation.suppress must be a boolean`);
|
|
1781
1778
|
}
|
|
1782
1779
|
presentation.suppress = declared.suppress;
|
|
1783
1780
|
}
|
|
@@ -1785,7 +1782,7 @@ function parsePluginAgentToolPresentation(toolName, value) {
|
|
|
1785
1782
|
const tint = declared.tint;
|
|
1786
1783
|
if (typeof tint !== "object" || tint === null || typeof tint.light !== "string" || typeof tint.dark !== "string") {
|
|
1787
1784
|
throw new Error(
|
|
1788
|
-
|
|
1785
|
+
`${subject} presentation.tint must provide light and dark strings`
|
|
1789
1786
|
);
|
|
1790
1787
|
}
|
|
1791
1788
|
presentation.tint = {
|
|
@@ -2011,6 +2008,12 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
|
|
|
2011
2008
|
declaration.availability,
|
|
2012
2009
|
"availability"
|
|
2013
2010
|
);
|
|
2011
|
+
assertOptionalFunction(
|
|
2012
|
+
"environment provider",
|
|
2013
|
+
id,
|
|
2014
|
+
declaration.experimental_existingPath,
|
|
2015
|
+
"experimental_existingPath"
|
|
2016
|
+
);
|
|
2014
2017
|
return {
|
|
2015
2018
|
id,
|
|
2016
2019
|
displayName,
|
|
@@ -2021,6 +2024,7 @@ function validatePluginEnvironmentProviderDeclaration(declaration) {
|
|
|
2021
2024
|
inputsJsonSchema: inputs === null ? null : inputs.jsonSchema,
|
|
2022
2025
|
availability: declaration.availability ?? null,
|
|
2023
2026
|
validate: declaration.validate ?? null,
|
|
2027
|
+
experimental_existingPath: declaration.experimental_existingPath ?? null,
|
|
2024
2028
|
create: declaration.create,
|
|
2025
2029
|
remove: declaration.remove,
|
|
2026
2030
|
policy: environmentProviderPolicySchema.parse(declaration.policy ?? {})
|
|
@@ -2358,6 +2362,7 @@ function normalizeCliRegistration(registration, alreadyRegistered) {
|
|
|
2358
2362
|
name,
|
|
2359
2363
|
summary: registration.summary,
|
|
2360
2364
|
commands: validatedCommands,
|
|
2365
|
+
rendersHelp: registration.rendersHelp === true,
|
|
2361
2366
|
run: registration.run.bind(registration)
|
|
2362
2367
|
};
|
|
2363
2368
|
}
|
|
@@ -2386,8 +2391,8 @@ function normalizeAgentToolRegistration(args) {
|
|
|
2386
2391
|
`tool "${name}" instructions exceed the ${PLUGIN_AGENT_STATIC_INSTRUCTIONS_MAX_CHARS}-character limit`
|
|
2387
2392
|
);
|
|
2388
2393
|
}
|
|
2389
|
-
const presentation =
|
|
2390
|
-
name
|
|
2394
|
+
const presentation = parsePluginRowPresentation(
|
|
2395
|
+
`tool "${name}"`,
|
|
2391
2396
|
tool.presentation
|
|
2392
2397
|
);
|
|
2393
2398
|
if (presentation?.icon !== void 0) {
|
|
@@ -2515,12 +2520,20 @@ function normalizeInteractionRequest(request) {
|
|
|
2515
2520
|
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 60 * 60 * 1e3) {
|
|
2516
2521
|
throw new Error("ui.requestInput timeoutMs must be between 1 and 3600000");
|
|
2517
2522
|
}
|
|
2523
|
+
if (request.describeSubmission !== void 0 && typeof request.describeSubmission !== "function") {
|
|
2524
|
+
throw new Error("ui.requestInput describeSubmission must be a function");
|
|
2525
|
+
}
|
|
2518
2526
|
return {
|
|
2519
2527
|
threadId: request.threadId,
|
|
2520
2528
|
rendererId: request.rendererId,
|
|
2521
2529
|
title: request.title.trim(),
|
|
2522
2530
|
payload,
|
|
2523
|
-
timeoutMs
|
|
2531
|
+
timeoutMs,
|
|
2532
|
+
presentation: parsePluginRowPresentation(
|
|
2533
|
+
`ui.requestInput form "${request.rendererId}"`,
|
|
2534
|
+
request.presentation
|
|
2535
|
+
),
|
|
2536
|
+
describeSubmission: request.describeSubmission ?? null
|
|
2524
2537
|
};
|
|
2525
2538
|
}
|
|
2526
2539
|
function validateProviderEnvContribution(label, providerId, resolve2, registered) {
|
|
@@ -3354,8 +3367,13 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3354
3367
|
assertLive();
|
|
3355
3368
|
const normalized = normalizeInteractionRequest(request);
|
|
3356
3369
|
const normalizedRequest = {
|
|
3357
|
-
|
|
3358
|
-
|
|
3370
|
+
threadId: normalized.threadId,
|
|
3371
|
+
rendererId: normalized.rendererId,
|
|
3372
|
+
title: normalized.title,
|
|
3373
|
+
payload: normalized.payload,
|
|
3374
|
+
timeoutMs: normalized.timeoutMs,
|
|
3375
|
+
...normalized.presentation === null ? {} : { presentation: normalized.presentation },
|
|
3376
|
+
...normalized.describeSubmission === null ? {} : { describeSubmission: normalized.describeSubmission }
|
|
3359
3377
|
};
|
|
3360
3378
|
const id = `fake-interaction-${nextInteractionId++}`;
|
|
3361
3379
|
return new Promise((resolve2) => {
|