@get-bb/plugin-sdk 0.6.26 → 0.6.31
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/README.md +10 -2
- package/bundled-types/bb-plugin-sdk-app.d.ts +107 -7
- package/bundled-types/bb-plugin-sdk-host.d.ts +30 -3
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +1 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +2 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +26 -1
- package/bundled-types/bb-plugin-sdk.d.ts +117 -7
- package/dist/app.js +4 -0
- package/dist/host.js +111 -11
- package/dist/internal/host-policy.js +5 -2
- package/dist/provider-bridge-acp.js +133 -42
- package/dist/provider-bridge-testing.js +8 -2
- package/dist/provider-bridge.js +3 -1
- package/dist/testing/app.js +29 -1
- package/dist/testing/index.js +7 -2
- package/package.json +1 -1
|
@@ -1245,6 +1245,7 @@ import { z as z10 } from "zod";
|
|
|
1245
1245
|
// ../domain/src/plugin-interaction-limits.ts
|
|
1246
1246
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
1247
1247
|
var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
|
|
1248
|
+
var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
1248
1249
|
function jsonByteLength(value) {
|
|
1249
1250
|
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
1250
1251
|
}
|
|
@@ -3068,7 +3069,8 @@ var providerHealthSchema = z22.object({
|
|
|
3068
3069
|
minimumSupportedVersion: z22.string().min(1).nullable(),
|
|
3069
3070
|
canInstall: z22.boolean(),
|
|
3070
3071
|
canUpdate: z22.boolean(),
|
|
3071
|
-
loginCommand: z22.string().min(1).nullable()
|
|
3072
|
+
loginCommand: z22.string().min(1).nullable(),
|
|
3073
|
+
localLoginCommand: z22.string().min(1).nullable().optional()
|
|
3072
3074
|
}).passthrough();
|
|
3073
3075
|
var providerUsageWindowSchema = z22.object({
|
|
3074
3076
|
label: z22.string().min(1),
|
|
@@ -15019,11 +15021,23 @@ function buildAcpModelListParams(launchSpec, options) {
|
|
|
15019
15021
|
...launchSpec.nativeReasoning !== void 0 ? { nativeReasoning: launchSpec.nativeReasoning } : {}
|
|
15020
15022
|
};
|
|
15021
15023
|
}
|
|
15022
|
-
function
|
|
15024
|
+
function buildAcpModelSelectionParams(launchSpec, options, parameterizedModelPicker, dialectId) {
|
|
15025
|
+
const modelSelection = buildAcpModelSelection(
|
|
15026
|
+
launchSpec,
|
|
15027
|
+
options,
|
|
15028
|
+
parameterizedModelPicker,
|
|
15029
|
+
dialectId
|
|
15030
|
+
);
|
|
15031
|
+
return {
|
|
15032
|
+
...modelSelection !== void 0 ? { modelSelection } : {},
|
|
15033
|
+
...launchSpec.reasoningCli !== void 0 && options.reasoningLevel !== void 0 ? { launchReasoningLevel: options.reasoningLevel } : {}
|
|
15034
|
+
};
|
|
15035
|
+
}
|
|
15036
|
+
function buildAcpModelSelection(launchSpec, options, parameterizedModelPicker, dialectId) {
|
|
15023
15037
|
const model = options.model;
|
|
15024
15038
|
const listCommand = buildAcpModelListCommand(launchSpec);
|
|
15025
15039
|
if (!model || model === ACP_DEFAULT_MODEL_ID) {
|
|
15026
|
-
return
|
|
15040
|
+
return void 0;
|
|
15027
15041
|
}
|
|
15028
15042
|
if (parameterizedModelPicker || !listCommand || !launchSpec.modelCli?.selectFlag) {
|
|
15029
15043
|
const modelSelection = parameterizedModelPicker && dialectId === "cursor" ? cursorParameterizedSelection(model, options.reasoningLevel) : {
|
|
@@ -15031,20 +15045,16 @@ function buildAcpModelSelectionParam(launchSpec, options, parameterizedModelPick
|
|
|
15031
15045
|
...options.reasoningLevel !== void 0 ? { reasoningLevel: options.reasoningLevel } : {}
|
|
15032
15046
|
};
|
|
15033
15047
|
return {
|
|
15034
|
-
modelSelection
|
|
15035
|
-
|
|
15036
|
-
...parameterizedModelPicker && options.serviceTier !== void 0 ? { serviceTier: options.serviceTier } : {}
|
|
15037
|
-
}
|
|
15048
|
+
...modelSelection,
|
|
15049
|
+
...parameterizedModelPicker && options.serviceTier !== void 0 ? { serviceTier: options.serviceTier } : {}
|
|
15038
15050
|
};
|
|
15039
15051
|
}
|
|
15040
15052
|
return {
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15044
|
-
|
|
15045
|
-
|
|
15046
|
-
...options.serviceTier === "fast" ? { serviceTier: options.serviceTier } : {}
|
|
15047
|
-
}
|
|
15053
|
+
listCommand,
|
|
15054
|
+
selectFlag: launchSpec.modelCli.selectFlag,
|
|
15055
|
+
model,
|
|
15056
|
+
...options.reasoningLevel !== void 0 ? { reasoningLevel: options.reasoningLevel } : {},
|
|
15057
|
+
...options.serviceTier === "fast" ? { serviceTier: options.serviceTier } : {}
|
|
15048
15058
|
};
|
|
15049
15059
|
}
|
|
15050
15060
|
function buildAcpSessionParams(args) {
|
|
@@ -15068,7 +15078,7 @@ function buildAcpSessionParams(args) {
|
|
|
15068
15078
|
args: [...launchSpec.args]
|
|
15069
15079
|
},
|
|
15070
15080
|
...args.dialectId === void 0 ? {} : { dialectId: args.dialectId },
|
|
15071
|
-
...
|
|
15081
|
+
...buildAcpModelSelectionParams(
|
|
15072
15082
|
launchSpec,
|
|
15073
15083
|
options,
|
|
15074
15084
|
args.parameterizedModelPicker,
|
|
@@ -15078,7 +15088,6 @@ function buildAcpSessionParams(args) {
|
|
|
15078
15088
|
...launchSpec.reasoningCli !== void 0 ? { reasoningCli: launchSpec.reasoningCli } : {},
|
|
15079
15089
|
...launchSpec.nativeReasoning !== void 0 ? { nativeReasoning: launchSpec.nativeReasoning } : {},
|
|
15080
15090
|
...launchSpec.permissionCli !== void 0 ? { permissionCli: launchSpec.permissionCli } : {},
|
|
15081
|
-
...launchSpec.reasoningCli !== void 0 && options.reasoningLevel !== void 0 ? { launchReasoningLevel: options.reasoningLevel } : {},
|
|
15082
15091
|
permissionMode: options.permissionMode,
|
|
15083
15092
|
workspaceWriteRoots: [cwd, ...args.additionalWorkspaceWriteRoots],
|
|
15084
15093
|
...Object.keys(envVars).length > 0 ? { envVars } : {},
|
|
@@ -16566,19 +16575,20 @@ async function selectAcpNativeModel(args) {
|
|
|
16566
16575
|
if (!selection || !("modelId" in selection)) {
|
|
16567
16576
|
return;
|
|
16568
16577
|
}
|
|
16569
|
-
|
|
16570
|
-
const
|
|
16571
|
-
const
|
|
16578
|
+
const { session } = args;
|
|
16579
|
+
const { configOptions, models } = session.nativeConfig;
|
|
16580
|
+
const modelOption = findAcpModelConfigOption(configOptions);
|
|
16581
|
+
const availableSessionModels = models?.availableModels ?? [];
|
|
16572
16582
|
const sessionModelsIncludeSelection = availableSessionModels.some(
|
|
16573
16583
|
(model) => model.modelId === selection.modelId
|
|
16574
16584
|
);
|
|
16575
|
-
const shouldSetModel = modelOption && modelOption.currentValue !== selection.modelId || !modelOption && sessionModelsIncludeSelection &&
|
|
16585
|
+
const shouldSetModel = modelOption && modelOption.currentValue !== selection.modelId || !modelOption && sessionModelsIncludeSelection && models?.currentModelId !== selection.modelId;
|
|
16576
16586
|
if (shouldSetModel) {
|
|
16577
16587
|
let configState = null;
|
|
16578
16588
|
let setModel = true;
|
|
16579
16589
|
if (modelOption) {
|
|
16580
16590
|
try {
|
|
16581
|
-
configState = await
|
|
16591
|
+
configState = await session.connection.request({
|
|
16582
16592
|
method: "session/set_config_option",
|
|
16583
16593
|
params: {
|
|
16584
16594
|
sessionId: args.sessionId,
|
|
@@ -16593,34 +16603,61 @@ async function selectAcpNativeModel(args) {
|
|
|
16593
16603
|
}
|
|
16594
16604
|
}
|
|
16595
16605
|
if (setModel) {
|
|
16596
|
-
configState = await
|
|
16606
|
+
configState = await session.connection.request({
|
|
16597
16607
|
method: "session/set_model",
|
|
16598
16608
|
params: { sessionId: args.sessionId, modelId: selection.modelId },
|
|
16599
16609
|
resultSchema: z43.union([acpConfigStateResultSchema, z43.null()])
|
|
16600
16610
|
});
|
|
16601
16611
|
}
|
|
16602
|
-
|
|
16612
|
+
const current = session.nativeConfig;
|
|
16613
|
+
session.nativeConfig = {
|
|
16614
|
+
configOptions: configState?.configOptions ?? withAcpConfigValue(
|
|
16615
|
+
current.configOptions,
|
|
16616
|
+
modelOption?.id,
|
|
16617
|
+
selection.modelId
|
|
16618
|
+
),
|
|
16619
|
+
models: configState?.models ?? (current.models && {
|
|
16620
|
+
...current.models,
|
|
16621
|
+
currentModelId: selection.modelId
|
|
16622
|
+
})
|
|
16623
|
+
};
|
|
16603
16624
|
}
|
|
16604
16625
|
await selectAcpNativeReasoning({
|
|
16605
|
-
|
|
16626
|
+
session,
|
|
16606
16627
|
sessionId: args.sessionId,
|
|
16607
|
-
configOptions,
|
|
16608
16628
|
modelSelection: selection,
|
|
16609
16629
|
nativeReasoning: args.nativeReasoning
|
|
16610
16630
|
});
|
|
16611
16631
|
await selectAcpNativeServiceTier({
|
|
16612
|
-
|
|
16632
|
+
session,
|
|
16613
16633
|
sessionId: args.sessionId,
|
|
16614
|
-
configOptions,
|
|
16615
16634
|
modelSelection: selection
|
|
16616
16635
|
});
|
|
16617
16636
|
}
|
|
16637
|
+
function withAcpConfigValue(configOptions, configId, value) {
|
|
16638
|
+
return configOptions?.map(
|
|
16639
|
+
(option) => option.id === configId ? { ...option, currentValue: value } : option
|
|
16640
|
+
);
|
|
16641
|
+
}
|
|
16642
|
+
function recordAcpConfigValue(session, configState, configId, value) {
|
|
16643
|
+
session.nativeConfig = {
|
|
16644
|
+
...session.nativeConfig,
|
|
16645
|
+
configOptions: configState?.configOptions ?? withAcpConfigValue(session.nativeConfig.configOptions, configId, value)
|
|
16646
|
+
};
|
|
16647
|
+
}
|
|
16648
|
+
function acpNativeModelDrifted(nativeConfig, modelSelection) {
|
|
16649
|
+
if (!modelSelection || !("modelId" in modelSelection)) {
|
|
16650
|
+
return false;
|
|
16651
|
+
}
|
|
16652
|
+
const currentModelId = findAcpModelConfigOption(nativeConfig.configOptions)?.currentValue ?? nativeConfig.models?.currentModelId;
|
|
16653
|
+
return currentModelId !== void 0 && currentModelId !== modelSelection.modelId;
|
|
16654
|
+
}
|
|
16618
16655
|
async function selectAcpNativeReasoning(args) {
|
|
16619
16656
|
const reasoningLevel = args.modelSelection.reasoningLevel;
|
|
16620
16657
|
if (reasoningLevel === void 0) {
|
|
16621
16658
|
return;
|
|
16622
16659
|
}
|
|
16623
|
-
const thoughtLevelOption = findAcpThoughtLevelConfigOption(args.configOptions) ?? nativeReasoningToThoughtLevelOption(args.nativeReasoning);
|
|
16660
|
+
const thoughtLevelOption = findAcpThoughtLevelConfigOption(args.session.nativeConfig.configOptions) ?? nativeReasoningToThoughtLevelOption(args.nativeReasoning);
|
|
16624
16661
|
if (!thoughtLevelOption) {
|
|
16625
16662
|
return;
|
|
16626
16663
|
}
|
|
@@ -16631,40 +16668,44 @@ async function selectAcpNativeReasoning(args) {
|
|
|
16631
16668
|
if (value === void 0) {
|
|
16632
16669
|
return;
|
|
16633
16670
|
}
|
|
16671
|
+
let configState;
|
|
16634
16672
|
try {
|
|
16635
|
-
await args.connection.request({
|
|
16673
|
+
configState = await args.session.connection.request({
|
|
16636
16674
|
method: "session/set_config_option",
|
|
16637
16675
|
params: {
|
|
16638
16676
|
sessionId: args.sessionId,
|
|
16639
16677
|
configId: thoughtLevelOption.id,
|
|
16640
16678
|
value
|
|
16641
16679
|
},
|
|
16642
|
-
resultSchema: acpConfigStateResultSchema
|
|
16680
|
+
resultSchema: z43.union([acpConfigStateResultSchema, z43.null()])
|
|
16643
16681
|
});
|
|
16644
16682
|
} catch {
|
|
16683
|
+
return;
|
|
16645
16684
|
}
|
|
16685
|
+
recordAcpConfigValue(args.session, configState, thoughtLevelOption.id, value);
|
|
16646
16686
|
}
|
|
16647
16687
|
async function selectAcpNativeServiceTier(args) {
|
|
16648
16688
|
const serviceTier = args.modelSelection.serviceTier;
|
|
16649
16689
|
if (serviceTier === void 0) {
|
|
16650
16690
|
return;
|
|
16651
16691
|
}
|
|
16652
|
-
const fastOption = (args.configOptions ?? []).find(
|
|
16692
|
+
const fastOption = (args.session.nativeConfig.configOptions ?? []).find(
|
|
16653
16693
|
(option) => option.id === "fast" && option.type === "select"
|
|
16654
16694
|
);
|
|
16655
16695
|
const value = serviceTier === "fast" ? "true" : "false";
|
|
16656
16696
|
if (!fastOption?.options?.some((option) => option.value === value)) {
|
|
16657
16697
|
return;
|
|
16658
16698
|
}
|
|
16659
|
-
await args.connection.request({
|
|
16699
|
+
const configState = await args.session.connection.request({
|
|
16660
16700
|
method: "session/set_config_option",
|
|
16661
16701
|
params: {
|
|
16662
16702
|
sessionId: args.sessionId,
|
|
16663
16703
|
configId: fastOption.id,
|
|
16664
16704
|
value
|
|
16665
16705
|
},
|
|
16666
|
-
resultSchema: acpConfigStateResultSchema
|
|
16706
|
+
resultSchema: z43.union([acpConfigStateResultSchema, z43.null()])
|
|
16667
16707
|
});
|
|
16708
|
+
recordAcpConfigValue(args.session, configState, fastOption.id, value);
|
|
16668
16709
|
}
|
|
16669
16710
|
function buildPromptContentBlocks(session, input) {
|
|
16670
16711
|
const blocks = [];
|
|
@@ -16999,6 +17040,7 @@ async function startAgentSession(request) {
|
|
|
16999
17040
|
session = {
|
|
17000
17041
|
bbThreadId,
|
|
17001
17042
|
construction: params,
|
|
17043
|
+
nativeConfig: { configOptions: void 0, models: void 0 },
|
|
17002
17044
|
providerThreadId: "",
|
|
17003
17045
|
cwd: params.cwd,
|
|
17004
17046
|
dialect,
|
|
@@ -17124,11 +17166,13 @@ async function startAgentSession(request) {
|
|
|
17124
17166
|
sessionId = newSession.sessionId;
|
|
17125
17167
|
createdFreshSession = true;
|
|
17126
17168
|
rememberGrokContextWindow(session, newSession.models);
|
|
17169
|
+
session.nativeConfig = {
|
|
17170
|
+
configOptions: newSession.configOptions,
|
|
17171
|
+
models: newSession.models
|
|
17172
|
+
};
|
|
17127
17173
|
await selectAcpNativeModel({
|
|
17128
|
-
|
|
17174
|
+
session,
|
|
17129
17175
|
sessionId,
|
|
17130
|
-
configOptions: newSession.configOptions,
|
|
17131
|
-
models: newSession.models,
|
|
17132
17176
|
modelSelection: params.modelSelection,
|
|
17133
17177
|
nativeReasoning: params.nativeReasoning
|
|
17134
17178
|
});
|
|
@@ -17139,11 +17183,13 @@ async function startAgentSession(request) {
|
|
|
17139
17183
|
});
|
|
17140
17184
|
}
|
|
17141
17185
|
} else {
|
|
17186
|
+
session.nativeConfig = {
|
|
17187
|
+
configOptions: loadedConfigOptions,
|
|
17188
|
+
models: loadedModels
|
|
17189
|
+
};
|
|
17142
17190
|
await selectAcpNativeModel({
|
|
17143
|
-
|
|
17191
|
+
session,
|
|
17144
17192
|
sessionId,
|
|
17145
|
-
configOptions: loadedConfigOptions,
|
|
17146
|
-
models: loadedModels,
|
|
17147
17193
|
modelSelection: params.modelSelection,
|
|
17148
17194
|
nativeReasoning: params.nativeReasoning
|
|
17149
17195
|
});
|
|
@@ -17385,16 +17431,25 @@ function reconcileExecutionSettings(session, options) {
|
|
|
17385
17431
|
if (options.permissionMode === "auto") {
|
|
17386
17432
|
throw new Error('ACP does not support permission mode "auto".');
|
|
17387
17433
|
}
|
|
17434
|
+
const launchSpec = decodeLaunchSpec(options.providerOptions);
|
|
17388
17435
|
const envVars = Object.keys(options.envVars ?? {}).length > 0 ? {
|
|
17389
|
-
...
|
|
17436
|
+
...launchSpec?.env ?? {},
|
|
17390
17437
|
...options.envVars
|
|
17391
17438
|
} : session.construction.envVars;
|
|
17392
17439
|
const workspaceWriteRoots = options.providerOptions?.additionalWorkspaceWriteRoots !== void 0 ? [
|
|
17393
17440
|
session.cwd,
|
|
17394
17441
|
...decodeAdditionalWorkspaceWriteRoots(options.providerOptions)
|
|
17395
17442
|
] : session.policy.workspaceWriteRoots;
|
|
17443
|
+
const modelParams = launchSpec === null ? session.construction : buildAcpModelSelectionParams(
|
|
17444
|
+
launchSpec,
|
|
17445
|
+
options,
|
|
17446
|
+
decodeAcpModelPickerOptions(options.providerOptions).parameterizedModelPicker,
|
|
17447
|
+
decodeDialectId(options.providerOptions)
|
|
17448
|
+
);
|
|
17396
17449
|
const construction = {
|
|
17397
17450
|
...session.construction,
|
|
17451
|
+
modelSelection: modelParams.modelSelection,
|
|
17452
|
+
launchReasoningLevel: modelParams.launchReasoningLevel,
|
|
17398
17453
|
envVars,
|
|
17399
17454
|
permissionMode: options.permissionMode,
|
|
17400
17455
|
workspaceWriteRoots
|
|
@@ -17408,6 +17463,9 @@ function reconcileExecutionSettings(session, options) {
|
|
|
17408
17463
|
construction.permissionCli,
|
|
17409
17464
|
construction.permissionMode
|
|
17410
17465
|
)
|
|
17466
|
+
) || !isDeepStrictEqual(
|
|
17467
|
+
launchModelSelection(session.construction),
|
|
17468
|
+
launchModelSelection(construction)
|
|
17411
17469
|
);
|
|
17412
17470
|
const restart = session.connection.exited || session.restartAfterCancelError || launchArgsChanged || !isDeepStrictEqual(envVars ?? {}, session.construction.envVars ?? {});
|
|
17413
17471
|
cancelPendingPermissions(session);
|
|
@@ -17415,11 +17473,33 @@ function reconcileExecutionSettings(session, options) {
|
|
|
17415
17473
|
permissionMode: options.permissionMode,
|
|
17416
17474
|
workspaceWriteRoots
|
|
17417
17475
|
};
|
|
17418
|
-
if (
|
|
17476
|
+
if (restart) {
|
|
17477
|
+
return rebuildAgentSession(session, construction);
|
|
17478
|
+
}
|
|
17479
|
+
if (isDeepStrictEqual(
|
|
17480
|
+
construction.modelSelection,
|
|
17481
|
+
session.construction.modelSelection
|
|
17482
|
+
) && !acpNativeModelDrifted(session.nativeConfig, construction.modelSelection)) {
|
|
17419
17483
|
session.construction = construction;
|
|
17420
17484
|
return session;
|
|
17421
17485
|
}
|
|
17422
|
-
return
|
|
17486
|
+
return applyNativeModelSelection(session, construction);
|
|
17487
|
+
}
|
|
17488
|
+
function launchModelSelection(params) {
|
|
17489
|
+
return {
|
|
17490
|
+
modelSelection: params.modelSelection && "selectFlag" in params.modelSelection ? params.modelSelection : void 0,
|
|
17491
|
+
launchReasoningLevel: params.launchReasoningLevel
|
|
17492
|
+
};
|
|
17493
|
+
}
|
|
17494
|
+
async function applyNativeModelSelection(session, construction) {
|
|
17495
|
+
await selectAcpNativeModel({
|
|
17496
|
+
session,
|
|
17497
|
+
sessionId: session.providerThreadId,
|
|
17498
|
+
modelSelection: construction.modelSelection,
|
|
17499
|
+
nativeReasoning: construction.nativeReasoning
|
|
17500
|
+
});
|
|
17501
|
+
session.construction = construction;
|
|
17502
|
+
return session;
|
|
17423
17503
|
}
|
|
17424
17504
|
async function rebuildAgentSession(session, construction) {
|
|
17425
17505
|
const previousProviderThreadId = session.providerThreadId;
|
|
@@ -17565,6 +17645,17 @@ function handleAgentNotification(session, method, params) {
|
|
|
17565
17645
|
if (parsed.data.sessionId !== session.providerThreadId) {
|
|
17566
17646
|
return;
|
|
17567
17647
|
}
|
|
17648
|
+
if (parsed.data.update.sessionUpdate === "config_option_update") {
|
|
17649
|
+
const configState = acpConfigStateResultSchema.safeParse(
|
|
17650
|
+
parsed.data.update
|
|
17651
|
+
);
|
|
17652
|
+
if (configState.success && configState.data.configOptions) {
|
|
17653
|
+
session.nativeConfig = {
|
|
17654
|
+
...session.nativeConfig,
|
|
17655
|
+
configOptions: configState.data.configOptions
|
|
17656
|
+
};
|
|
17657
|
+
}
|
|
17658
|
+
}
|
|
17568
17659
|
if (session.activePromptKind === "compaction") {
|
|
17569
17660
|
const chunk = acpAgentMessageChunkUpdateSchema.safeParse(
|
|
17570
17661
|
parsed.data.update
|
|
@@ -340,6 +340,7 @@ import { z as z8 } from "zod";
|
|
|
340
340
|
// ../domain/src/plugin-interaction-limits.ts
|
|
341
341
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
342
342
|
var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
|
|
343
|
+
var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
343
344
|
function jsonByteLength(value) {
|
|
344
345
|
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
345
346
|
}
|
|
@@ -4189,7 +4190,11 @@ function createDeltaAssembler(options) {
|
|
|
4189
4190
|
|
|
4190
4191
|
// ../provider-bridge-protocol/src/testing/bridge-delta-assembly.ts
|
|
4191
4192
|
function createBridgeDeltaEventCollector(providerId = "pi") {
|
|
4192
|
-
const assembler = createDeltaAssembler({
|
|
4193
|
+
const assembler = createDeltaAssembler({
|
|
4194
|
+
providerId,
|
|
4195
|
+
textDeltaFlushMs: 0,
|
|
4196
|
+
now: () => 0
|
|
4197
|
+
});
|
|
4193
4198
|
return {
|
|
4194
4199
|
assembler,
|
|
4195
4200
|
assembleMessage(message) {
|
|
@@ -4415,7 +4420,8 @@ var providerHealthSchema = z23.object({
|
|
|
4415
4420
|
minimumSupportedVersion: z23.string().min(1).nullable(),
|
|
4416
4421
|
canInstall: z23.boolean(),
|
|
4417
4422
|
canUpdate: z23.boolean(),
|
|
4418
|
-
loginCommand: z23.string().min(1).nullable()
|
|
4423
|
+
loginCommand: z23.string().min(1).nullable(),
|
|
4424
|
+
localLoginCommand: z23.string().min(1).nullable().optional()
|
|
4419
4425
|
}).passthrough();
|
|
4420
4426
|
var providerUsageWindowSchema = z23.object({
|
|
4421
4427
|
label: z23.string().min(1),
|
package/dist/provider-bridge.js
CHANGED
|
@@ -1763,6 +1763,7 @@ import { z as z12 } from "zod";
|
|
|
1763
1763
|
// ../domain/src/plugin-interaction-limits.ts
|
|
1764
1764
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
1765
1765
|
var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
|
|
1766
|
+
var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
1766
1767
|
function jsonByteLength(value) {
|
|
1767
1768
|
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
1768
1769
|
}
|
|
@@ -11380,7 +11381,8 @@ var providerHealthSchema = z30.object({
|
|
|
11380
11381
|
minimumSupportedVersion: z30.string().min(1).nullable(),
|
|
11381
11382
|
canInstall: z30.boolean(),
|
|
11382
11383
|
canUpdate: z30.boolean(),
|
|
11383
|
-
loginCommand: z30.string().min(1).nullable()
|
|
11384
|
+
loginCommand: z30.string().min(1).nullable(),
|
|
11385
|
+
localLoginCommand: z30.string().min(1).nullable().optional()
|
|
11384
11386
|
}).passthrough();
|
|
11385
11387
|
var providerUsageWindowSchema = z30.object({
|
|
11386
11388
|
label: z30.string().min(1),
|
package/dist/testing/app.js
CHANGED
|
@@ -2162,6 +2162,15 @@ function TestDiff({
|
|
|
2162
2162
|
}
|
|
2163
2163
|
);
|
|
2164
2164
|
}
|
|
2165
|
+
var activeClipboard = null;
|
|
2166
|
+
function captureClipboardWrites(result) {
|
|
2167
|
+
const writes = [];
|
|
2168
|
+
activeClipboard = (content) => {
|
|
2169
|
+
writes.push({ ...content });
|
|
2170
|
+
return result?.(content) ?? Promise.resolve(true);
|
|
2171
|
+
};
|
|
2172
|
+
return writes;
|
|
2173
|
+
}
|
|
2165
2174
|
var testPluginSdkApp = {
|
|
2166
2175
|
definePluginApp,
|
|
2167
2176
|
useRpc() {
|
|
@@ -2297,6 +2306,9 @@ var testPluginSdkApp = {
|
|
|
2297
2306
|
experimental_useCodeTheme() {
|
|
2298
2307
|
return useSlotEnv("experimental_useCodeTheme").codeTheme;
|
|
2299
2308
|
},
|
|
2309
|
+
experimental_copyToClipboard(content) {
|
|
2310
|
+
return activeClipboard?.(content) ?? Promise.resolve(true);
|
|
2311
|
+
},
|
|
2300
2312
|
experimental_useSidebarThreadActions() {
|
|
2301
2313
|
return useSlotEnv("experimental_useSidebarThreadActions").sidebarActions;
|
|
2302
2314
|
},
|
|
@@ -2426,6 +2438,9 @@ async function mountPluginContentScripts(app, options) {
|
|
|
2426
2438
|
const mounted = [];
|
|
2427
2439
|
const threadRowStatuses = /* @__PURE__ */ new Map();
|
|
2428
2440
|
const threadRowStatusCalls = [];
|
|
2441
|
+
const experimental_clipboardWrites = captureClipboardWrites(
|
|
2442
|
+
options.experimental_copyToClipboard
|
|
2443
|
+
);
|
|
2429
2444
|
let disposed = false;
|
|
2430
2445
|
const setThreadRowStatus = (threadId, status) => {
|
|
2431
2446
|
if (controller.signal.aborted) return;
|
|
@@ -2505,7 +2520,8 @@ async function mountPluginContentScripts(app, options) {
|
|
|
2505
2520
|
getThreadRowStatus(threadId) {
|
|
2506
2521
|
const status = threadRowStatuses.get(threadId);
|
|
2507
2522
|
return status === void 0 ? null : { ...status };
|
|
2508
|
-
}
|
|
2523
|
+
},
|
|
2524
|
+
experimental_clipboardWrites
|
|
2509
2525
|
},
|
|
2510
2526
|
lifecycle: { dispose }
|
|
2511
2527
|
};
|
|
@@ -2722,6 +2738,9 @@ function renderSlot(registration, props, options = {}) {
|
|
|
2722
2738
|
name: options.codeTheme?.name ?? "pierre-light",
|
|
2723
2739
|
theme: options.codeTheme?.theme ?? null
|
|
2724
2740
|
};
|
|
2741
|
+
const experimental_clipboardWrites = captureClipboardWrites(
|
|
2742
|
+
options.experimental_copyToClipboard
|
|
2743
|
+
);
|
|
2725
2744
|
const sidebarActions = {
|
|
2726
2745
|
open(threadId2, openOptions) {
|
|
2727
2746
|
sidebarActionCalls.push({
|
|
@@ -2802,6 +2821,13 @@ function renderSlot(registration, props, options = {}) {
|
|
|
2802
2821
|
options: fileOptions
|
|
2803
2822
|
});
|
|
2804
2823
|
return options.openFileExternally?.(fileOptions) ?? false;
|
|
2824
|
+
},
|
|
2825
|
+
async experimental_openTerminal(terminalOptions) {
|
|
2826
|
+
navigateCalls.push({
|
|
2827
|
+
method: "experimental_openTerminal",
|
|
2828
|
+
options: terminalOptions
|
|
2829
|
+
});
|
|
2830
|
+
return options.openTerminal?.(terminalOptions) ?? false;
|
|
2805
2831
|
}
|
|
2806
2832
|
};
|
|
2807
2833
|
const projectId = options.context?.projectId ?? null;
|
|
@@ -3137,6 +3163,7 @@ ${block}
|
|
|
3137
3163
|
sidebarActionCalls,
|
|
3138
3164
|
sidebarNavigationCalls,
|
|
3139
3165
|
sdkCalls,
|
|
3166
|
+
experimental_clipboardWrites,
|
|
3140
3167
|
composer: composerLog,
|
|
3141
3168
|
behavior: {
|
|
3142
3169
|
emitRealtime,
|
|
@@ -3151,6 +3178,7 @@ ${block}
|
|
|
3151
3178
|
sidebarActionCalls,
|
|
3152
3179
|
sidebarNavigationCalls,
|
|
3153
3180
|
sdkCalls,
|
|
3181
|
+
experimental_clipboardWrites,
|
|
3154
3182
|
composer: composerLog
|
|
3155
3183
|
},
|
|
3156
3184
|
lifecycle: { rerender: rerenderSlot, unmount: unmountSlot }
|
package/dist/testing/index.js
CHANGED
|
@@ -50,6 +50,7 @@ var RESERVED_BB_CLI_COMMANDS = [
|
|
|
50
50
|
// ../domain/src/plugin-interaction-limits.ts
|
|
51
51
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
52
52
|
var PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES = 64 * 1024;
|
|
53
|
+
var PLUGIN_INTERACTION_MAX_TIMEOUT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
53
54
|
|
|
54
55
|
// ../domain/src/provider-fork.ts
|
|
55
56
|
import { z } from "zod";
|
|
@@ -2478,8 +2479,10 @@ function normalizeInteractionRequest(request) {
|
|
|
2478
2479
|
throw new Error("ui.requestInput payload must be JSON-serializable");
|
|
2479
2480
|
}
|
|
2480
2481
|
const timeoutMs = request.timeoutMs ?? 10 * 60 * 1e3;
|
|
2481
|
-
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs >
|
|
2482
|
-
throw new Error(
|
|
2482
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > PLUGIN_INTERACTION_MAX_TIMEOUT_MS) {
|
|
2483
|
+
throw new Error(
|
|
2484
|
+
`ui.requestInput timeoutMs must be between 1 and ${PLUGIN_INTERACTION_MAX_TIMEOUT_MS}`
|
|
2485
|
+
);
|
|
2483
2486
|
}
|
|
2484
2487
|
if (request.describeSubmission !== void 0 && typeof request.describeSubmission !== "function") {
|
|
2485
2488
|
throw new Error("ui.requestInput describeSubmission must be a function");
|
|
@@ -3303,6 +3306,7 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3303
3306
|
"experimental_thread.events": [],
|
|
3304
3307
|
"experimental_terminal.input": [],
|
|
3305
3308
|
"experimental_host.deleted": [],
|
|
3309
|
+
"experimental_environment.removed": [],
|
|
3306
3310
|
"thread.created": [],
|
|
3307
3311
|
"thread.active": [],
|
|
3308
3312
|
"thread.idle": [],
|
|
@@ -3740,6 +3744,7 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3740
3744
|
return {
|
|
3741
3745
|
"experimental_thread.events": threadEventHandlers["experimental_thread.events"].length,
|
|
3742
3746
|
"experimental_terminal.input": threadEventHandlers["experimental_terminal.input"].length,
|
|
3747
|
+
"experimental_environment.removed": threadEventHandlers["experimental_environment.removed"].length,
|
|
3743
3748
|
"experimental_host.deleted": threadEventHandlers["experimental_host.deleted"].length,
|
|
3744
3749
|
"thread.created": threadEventHandlers["thread.created"].length,
|
|
3745
3750
|
"thread.active": threadEventHandlers["thread.active"].length,
|