@get-bb/plugin-sdk 0.6.112 → 0.6.121
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 +3 -1
- package/bundled-types/bb-plugin-sdk-app.d.ts +90 -115
- package/bundled-types/bb-plugin-sdk-internal-file-navigation-validation.d.ts +5 -1
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +8 -3
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp-next.d.ts +11 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge-acp.d.ts +11 -1
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +5 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +5 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +8 -3
- package/bundled-types/bb-plugin-sdk.d.ts +124 -118
- package/dist/app.js +4 -0
- package/dist/index.js +161 -1
- package/dist/internal/file-navigation-validation.js +13 -0
- package/dist/internal/plugin-app-collector.js +2 -2
- package/dist/internal/rpc-query-host.js +7 -5
- package/dist/provider-bridge-acp-next.js +32 -22
- package/dist/provider-bridge-acp.js +32 -22
- package/dist/provider-bridge-testing.js +4 -0
- package/dist/provider-bridge.js +2 -0
- package/dist/replay-provider-child.mjs +21 -22
- package/dist/testing/app.js +15 -7
- package/dist/testing/index.js +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -918,6 +918,158 @@ var experimental_THREAD_INFO_SECTION_GROUPS = {
|
|
|
918
918
|
changes: "2_changes",
|
|
919
919
|
storage: "3_storage"
|
|
920
920
|
};
|
|
921
|
+
|
|
922
|
+
// ../domain/src/host-path.ts
|
|
923
|
+
var WINDOWS_DRIVE_PATH_PATTERN = /^([A-Za-z]):(?:[\\/]+|$)/u;
|
|
924
|
+
var WINDOWS_UNC_PATH_PATTERN = /^[\\/]{2}([^\\/]+)[\\/]+([^\\/]+)(?:[\\/]+|$)/u;
|
|
925
|
+
var WINDOWS_SEPARATOR_PATTERN = /[\\/]+/u;
|
|
926
|
+
function collapseSegments(rawSegments) {
|
|
927
|
+
const segments = [];
|
|
928
|
+
for (const segment of rawSegments) {
|
|
929
|
+
if (segment.length === 0 || segment === ".") {
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
932
|
+
if (segment === "..") {
|
|
933
|
+
segments.pop();
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
936
|
+
segments.push(segment);
|
|
937
|
+
}
|
|
938
|
+
return segments;
|
|
939
|
+
}
|
|
940
|
+
function splitHostPathRoot(path) {
|
|
941
|
+
const drive = WINDOWS_DRIVE_PATH_PATTERN.exec(path);
|
|
942
|
+
if (drive) {
|
|
943
|
+
return {
|
|
944
|
+
flavor: "windows",
|
|
945
|
+
root: `${(drive[1] ?? "").toUpperCase()}:\\`,
|
|
946
|
+
relativePath: path.slice(drive[0].length)
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
const unc = WINDOWS_UNC_PATH_PATTERN.exec(path);
|
|
950
|
+
if (unc) {
|
|
951
|
+
return {
|
|
952
|
+
flavor: "windows",
|
|
953
|
+
root: `\\\\${unc[1] ?? ""}\\${unc[2] ?? ""}\\`,
|
|
954
|
+
relativePath: path.slice(unc[0].length)
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
if (path.startsWith("/")) {
|
|
958
|
+
return { flavor: "posix", root: "/", relativePath: path.slice(1) };
|
|
959
|
+
}
|
|
960
|
+
return null;
|
|
961
|
+
}
|
|
962
|
+
function parseHostPath(path) {
|
|
963
|
+
const split = splitHostPathRoot(path);
|
|
964
|
+
if (split === null) {
|
|
965
|
+
return null;
|
|
966
|
+
}
|
|
967
|
+
return {
|
|
968
|
+
flavor: split.flavor,
|
|
969
|
+
root: split.root,
|
|
970
|
+
segments: collapseSegments(
|
|
971
|
+
split.relativePath.split(
|
|
972
|
+
split.flavor === "windows" ? WINDOWS_SEPARATOR_PATTERN : "/"
|
|
973
|
+
)
|
|
974
|
+
)
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
function formatHostPath(parsed) {
|
|
978
|
+
if (parsed.flavor === "posix") {
|
|
979
|
+
return `/${parsed.segments.join("/")}`;
|
|
980
|
+
}
|
|
981
|
+
if (parsed.segments.length === 0) {
|
|
982
|
+
return parsed.root;
|
|
983
|
+
}
|
|
984
|
+
return `${parsed.root}${parsed.segments.join("\\")}`;
|
|
985
|
+
}
|
|
986
|
+
function comparisonSegments(parsed) {
|
|
987
|
+
return parsed.flavor === "windows" ? parsed.segments.map((segment) => segment.toLowerCase()) : parsed.segments;
|
|
988
|
+
}
|
|
989
|
+
function comparisonRoot(parsed) {
|
|
990
|
+
return parsed.flavor === "windows" ? parsed.root.toLowerCase() : parsed.root;
|
|
991
|
+
}
|
|
992
|
+
function normalizeHostPath(path) {
|
|
993
|
+
const parsed = parseHostPath(path);
|
|
994
|
+
return parsed === null ? null : formatHostPath(parsed);
|
|
995
|
+
}
|
|
996
|
+
function getHostPathComparisonKey(path) {
|
|
997
|
+
const parsed = parseHostPath(path);
|
|
998
|
+
if (parsed === null) {
|
|
999
|
+
return null;
|
|
1000
|
+
}
|
|
1001
|
+
return formatHostPath({
|
|
1002
|
+
flavor: parsed.flavor,
|
|
1003
|
+
root: comparisonRoot(parsed),
|
|
1004
|
+
segments: comparisonSegments(parsed)
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
function isHostPathWithin({
|
|
1008
|
+
rootPath,
|
|
1009
|
+
candidatePath
|
|
1010
|
+
}) {
|
|
1011
|
+
const root = parseHostPath(rootPath);
|
|
1012
|
+
const candidate = parseHostPath(candidatePath);
|
|
1013
|
+
if (root === null || candidate === null || root.flavor !== candidate.flavor || comparisonRoot(root) !== comparisonRoot(candidate)) {
|
|
1014
|
+
return false;
|
|
1015
|
+
}
|
|
1016
|
+
const rootSegments = comparisonSegments(root);
|
|
1017
|
+
const candidateSegments = comparisonSegments(candidate);
|
|
1018
|
+
return rootSegments.length <= candidateSegments.length && rootSegments.every((segment, index) => segment === candidateSegments[index]);
|
|
1019
|
+
}
|
|
1020
|
+
function joinHostPath({
|
|
1021
|
+
rootPath,
|
|
1022
|
+
relativePath
|
|
1023
|
+
}) {
|
|
1024
|
+
const parsed = parseHostPath(rootPath);
|
|
1025
|
+
if (parsed === null) {
|
|
1026
|
+
return null;
|
|
1027
|
+
}
|
|
1028
|
+
const relativeSegments = relativePath.split(
|
|
1029
|
+
parsed.flavor === "windows" ? WINDOWS_SEPARATOR_PATTERN : "/"
|
|
1030
|
+
);
|
|
1031
|
+
return formatHostPath({
|
|
1032
|
+
...parsed,
|
|
1033
|
+
segments: collapseSegments([...parsed.segments, ...relativeSegments])
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
function resolveHostPath({
|
|
1037
|
+
rootPath,
|
|
1038
|
+
path
|
|
1039
|
+
}) {
|
|
1040
|
+
if (path.length === 0 || path.includes("\0") || rootPath.includes("\0")) {
|
|
1041
|
+
return null;
|
|
1042
|
+
}
|
|
1043
|
+
const absolute = normalizeHostPath(path);
|
|
1044
|
+
if (absolute !== null) return absolute;
|
|
1045
|
+
if (path.startsWith("\\") || /^[A-Za-z]:/u.test(path)) return null;
|
|
1046
|
+
return joinHostPath({ rootPath, relativePath: path });
|
|
1047
|
+
}
|
|
1048
|
+
function getHostPathDirname(path) {
|
|
1049
|
+
const parsed = parseHostPath(path);
|
|
1050
|
+
if (parsed === null) {
|
|
1051
|
+
return null;
|
|
1052
|
+
}
|
|
1053
|
+
return formatHostPath({ ...parsed, segments: parsed.segments.slice(0, -1) });
|
|
1054
|
+
}
|
|
1055
|
+
function getHostPathBasename(path) {
|
|
1056
|
+
const parsed = parseHostPath(path);
|
|
1057
|
+
if (parsed === null) {
|
|
1058
|
+
return null;
|
|
1059
|
+
}
|
|
1060
|
+
return parsed.segments.at(-1) ?? "";
|
|
1061
|
+
}
|
|
1062
|
+
function getRelativeHostPath({
|
|
1063
|
+
rootPath,
|
|
1064
|
+
candidatePath
|
|
1065
|
+
}) {
|
|
1066
|
+
if (!isHostPathWithin({ rootPath, candidatePath })) {
|
|
1067
|
+
return null;
|
|
1068
|
+
}
|
|
1069
|
+
const rootSegments = parseHostPath(rootPath)?.segments ?? [];
|
|
1070
|
+
const candidateSegments = parseHostPath(candidatePath)?.segments ?? [];
|
|
1071
|
+
return candidateSegments.slice(rootSegments.length).join("/");
|
|
1072
|
+
}
|
|
921
1073
|
export {
|
|
922
1074
|
PLUGIN_CLI_OUTPUT_MAX_BYTES,
|
|
923
1075
|
PluginCliError,
|
|
@@ -930,5 +1082,13 @@ export {
|
|
|
930
1082
|
experimental_THREAD_CONTEXT_SEGMENT_GROUPS,
|
|
931
1083
|
experimental_THREAD_INFO_ROW_GROUPS,
|
|
932
1084
|
experimental_THREAD_INFO_SECTION_GROUPS,
|
|
933
|
-
experimental_defineHostEntry
|
|
1085
|
+
experimental_defineHostEntry,
|
|
1086
|
+
getHostPathBasename as experimental_getHostPathBasename,
|
|
1087
|
+
getHostPathComparisonKey as experimental_getHostPathComparisonKey,
|
|
1088
|
+
getHostPathDirname as experimental_getHostPathDirname,
|
|
1089
|
+
getRelativeHostPath as experimental_getRelativeHostPath,
|
|
1090
|
+
isHostPathWithin as experimental_isHostPathWithin,
|
|
1091
|
+
joinHostPath as experimental_joinHostPath,
|
|
1092
|
+
normalizeHostPath as experimental_normalizeHostPath,
|
|
1093
|
+
resolveHostPath as experimental_resolveHostPath
|
|
934
1094
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/internal/composer-customization-validation.ts
|
|
2
|
+
var PLUGIN_SLOT_ID_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
3
|
+
|
|
1
4
|
// src/internal/file-navigation-validation.ts
|
|
2
5
|
var FILE_PATH_MAX_LENGTH = 32768;
|
|
3
6
|
var WINDOWS_DRIVE_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]/u;
|
|
@@ -139,8 +142,18 @@ function normalizeExperimentalFileOpenOptions(value) {
|
|
|
139
142
|
if (target === null || location === void 0) return null;
|
|
140
143
|
return { target, location };
|
|
141
144
|
}
|
|
145
|
+
function normalizeExperimentalFilePreviewOptions(value) {
|
|
146
|
+
if (!isJsonObject(value)) return null;
|
|
147
|
+
const { opener = null, ...rest } = value;
|
|
148
|
+
if (opener !== null && (typeof opener !== "string" || !PLUGIN_SLOT_ID_PATTERN.test(opener))) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const options = normalizeExperimentalFileOpenOptions(rest);
|
|
152
|
+
return options === null ? null : { options, opener };
|
|
153
|
+
}
|
|
142
154
|
export {
|
|
143
155
|
normalizeExperimentalFileLocation,
|
|
144
156
|
normalizeExperimentalFileOpenOptions,
|
|
157
|
+
normalizeExperimentalFilePreviewOptions,
|
|
145
158
|
normalizeExperimentalLiveFileTarget
|
|
146
159
|
};
|
|
@@ -1018,9 +1018,9 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
1018
1018
|
const id = requireSlotId(kind, registration?.id);
|
|
1019
1019
|
requireUniqueId(kind, seenIds.fileOpener, id);
|
|
1020
1020
|
const rawExtensions = registration?.extensions;
|
|
1021
|
-
if (!Array.isArray(rawExtensions)
|
|
1021
|
+
if (!Array.isArray(rawExtensions)) {
|
|
1022
1022
|
throw new Error(
|
|
1023
|
-
`${kind}: "extensions" must be
|
|
1023
|
+
`${kind}: "extensions" must be an array of lowercase extensions without the dot`
|
|
1024
1024
|
);
|
|
1025
1025
|
}
|
|
1026
1026
|
const extensions = rawExtensions.map((extension) => {
|
|
@@ -1752,7 +1752,8 @@ var queuedMessageWaitingOnKindValues = [
|
|
|
1752
1752
|
"provisioning",
|
|
1753
1753
|
"host-offline",
|
|
1754
1754
|
"interaction",
|
|
1755
|
-
"plugin"
|
|
1755
|
+
"plugin",
|
|
1756
|
+
"superseded"
|
|
1756
1757
|
];
|
|
1757
1758
|
var queuedMessageWaitingOnKindSchema = z9.enum(
|
|
1758
1759
|
queuedMessageWaitingOnKindValues
|
|
@@ -1775,7 +1776,8 @@ var queuedMessageWaitingOnSchema = z9.discriminatedUnion("kind", [
|
|
|
1775
1776
|
kind: z9.literal("plugin"),
|
|
1776
1777
|
pluginId: pluginIdSchema,
|
|
1777
1778
|
reason: queuedMessageWaitReasonSchema
|
|
1778
|
-
})
|
|
1779
|
+
}),
|
|
1780
|
+
z9.object({ kind: z9.literal("superseded") })
|
|
1779
1781
|
]);
|
|
1780
1782
|
var QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH = 200;
|
|
1781
1783
|
var queuedMessageFailureReasonSchema = z9.string().min(1).max(QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH);
|
|
@@ -2020,14 +2022,14 @@ var ENVIRONMENT_CHANGE_KINDS = [
|
|
|
2020
2022
|
"status-changed",
|
|
2021
2023
|
"work-status-changed",
|
|
2022
2024
|
"git-refs-changed",
|
|
2023
|
-
"thread-storage-changed"
|
|
2024
|
-
"diff-viewed-changed"
|
|
2025
|
+
"thread-storage-changed"
|
|
2025
2026
|
];
|
|
2026
2027
|
var HOST_CHANGE_KINDS = [
|
|
2027
2028
|
"host-connected",
|
|
2028
2029
|
"host-disconnected",
|
|
2029
2030
|
"provider-model-catalog-changed",
|
|
2030
|
-
"provider-commands-changed"
|
|
2031
|
+
"provider-commands-changed",
|
|
2032
|
+
"provider-cli-status-changed"
|
|
2031
2033
|
];
|
|
2032
2034
|
var SYSTEM_CHANGE_KINDS = [
|
|
2033
2035
|
"config-changed",
|
|
@@ -2423,6 +2423,7 @@ var threadEventItemSchema = z18.discriminatedUnion("type", [
|
|
|
2423
2423
|
id: z18.string(),
|
|
2424
2424
|
command: z18.string(),
|
|
2425
2425
|
cwd: z18.string(),
|
|
2426
|
+
description: z18.string().optional(),
|
|
2426
2427
|
status: threadEventItemStatusSchema,
|
|
2427
2428
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
2428
2429
|
aggregatedOutput: z18.string().optional(),
|
|
@@ -3506,6 +3507,7 @@ var deltaItemShapeSchema = z31.discriminatedUnion("type", [
|
|
|
3506
3507
|
type: z31.literal("command"),
|
|
3507
3508
|
command: z31.string(),
|
|
3508
3509
|
cwd: z31.string(),
|
|
3510
|
+
description: z31.string().optional(),
|
|
3509
3511
|
aggregatedOutput: z31.string().optional(),
|
|
3510
3512
|
exitCode: z31.number().optional(),
|
|
3511
3513
|
durationMs: z31.number().optional()
|
|
@@ -15058,7 +15060,7 @@ function createAcpDeltaTranslator(options = {}) {
|
|
|
15058
15060
|
};
|
|
15059
15061
|
}
|
|
15060
15062
|
function commandCloseFields(event, status) {
|
|
15061
|
-
const normalizedEvent = dialect.normalizeCommandEvent?.(event) ?? event;
|
|
15063
|
+
const normalizedEvent = dialect.normalizeCommandEvent?.(event, event) ?? event;
|
|
15062
15064
|
const result = dialect.commandResult?.(normalizedEvent) ?? extractAcpCommandResult(normalizedEvent);
|
|
15063
15065
|
const exitCode = result.exitCode ?? (status === "failed" ? 1 : void 0);
|
|
15064
15066
|
return {
|
|
@@ -15067,7 +15069,8 @@ function createAcpDeltaTranslator(options = {}) {
|
|
|
15067
15069
|
};
|
|
15068
15070
|
}
|
|
15069
15071
|
function genericCloseFields(event) {
|
|
15070
|
-
const
|
|
15072
|
+
const normalizedEvent = dialect.normalizeToolCallEvent?.(event, event) ?? event;
|
|
15073
|
+
const outputText = extractAcpToolCallOutputText(normalizedEvent);
|
|
15071
15074
|
return outputText === void 0 ? {} : { resultText: outputText };
|
|
15072
15075
|
}
|
|
15073
15076
|
function drainOpenToolCalls(context, status) {
|
|
@@ -15206,7 +15209,7 @@ function createAcpDeltaTranslator(options = {}) {
|
|
|
15206
15209
|
...open?.clientFileWrites === void 0 ? {} : { clientFileWrites: open.clientFileWrites }
|
|
15207
15210
|
});
|
|
15208
15211
|
if (event.status === "in_progress" && mergedType === "command" && open?.openedType === "command") {
|
|
15209
|
-
const normalizedEvent = dialect.normalizeCommandEvent?.(event) ?? event;
|
|
15212
|
+
const normalizedEvent = dialect.normalizeCommandEvent?.(event, merged) ?? event;
|
|
15210
15213
|
const streamed = extractAcpStreamedCommandOutput(normalizedEvent);
|
|
15211
15214
|
return streamed === void 0 ? suppressedUnhandled(rawEvent) : [
|
|
15212
15215
|
{
|
|
@@ -15216,7 +15219,8 @@ function createAcpDeltaTranslator(options = {}) {
|
|
|
15216
15219
|
}
|
|
15217
15220
|
];
|
|
15218
15221
|
}
|
|
15219
|
-
const
|
|
15222
|
+
const progressEvent = dialect.normalizeToolCallEvent?.(event, merged) ?? event;
|
|
15223
|
+
const progressText = extractAcpToolCallOutputText(progressEvent);
|
|
15220
15224
|
if (progressText === void 0) {
|
|
15221
15225
|
return suppressedUnhandled(rawEvent);
|
|
15222
15226
|
}
|
|
@@ -22910,24 +22914,30 @@ async function discoverAcpNativeModelSupport(args) {
|
|
|
22910
22914
|
for (const model of modelsToProbe) {
|
|
22911
22915
|
if (timedOut) break;
|
|
22912
22916
|
try {
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
|
|
22921
|
-
|
|
22922
|
-
|
|
22923
|
-
|
|
22924
|
-
|
|
22925
|
-
|
|
22926
|
-
|
|
22927
|
-
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
|
-
|
|
22917
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
22918
|
+
const configState = await args.connection.request({
|
|
22919
|
+
method: "session/set_config_option",
|
|
22920
|
+
params: {
|
|
22921
|
+
sessionId: args.sessionId,
|
|
22922
|
+
configId: modelOption.id,
|
|
22923
|
+
value: model.value
|
|
22924
|
+
},
|
|
22925
|
+
resultSchema: acpConfigStateResultSchema
|
|
22926
|
+
});
|
|
22927
|
+
if (timedOut) break;
|
|
22928
|
+
if (findAcpModelConfigOption(configState.configOptions)?.currentValue !== model.value) {
|
|
22929
|
+
continue;
|
|
22930
|
+
}
|
|
22931
|
+
supportByModel.set(model.value, {
|
|
22932
|
+
...buildAcpNativeReasoningSupport(
|
|
22933
|
+
findAcpThoughtLevelConfigOption(configState.configOptions)
|
|
22934
|
+
),
|
|
22935
|
+
supportedServiceTiers: findAcpFastConfigOption(
|
|
22936
|
+
configState.configOptions
|
|
22937
|
+
)?.options?.some((option) => option.value === "true") ? [{ id: "fast" }] : []
|
|
22938
|
+
});
|
|
22939
|
+
break;
|
|
22940
|
+
}
|
|
22931
22941
|
} catch (error) {
|
|
22932
22942
|
if (timedOut) {
|
|
22933
22943
|
break;
|
|
@@ -2423,6 +2423,7 @@ var threadEventItemSchema = z18.discriminatedUnion("type", [
|
|
|
2423
2423
|
id: z18.string(),
|
|
2424
2424
|
command: z18.string(),
|
|
2425
2425
|
cwd: z18.string(),
|
|
2426
|
+
description: z18.string().optional(),
|
|
2426
2427
|
status: threadEventItemStatusSchema,
|
|
2427
2428
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
2428
2429
|
aggregatedOutput: z18.string().optional(),
|
|
@@ -3506,6 +3507,7 @@ var deltaItemShapeSchema = z31.discriminatedUnion("type", [
|
|
|
3506
3507
|
type: z31.literal("command"),
|
|
3507
3508
|
command: z31.string(),
|
|
3508
3509
|
cwd: z31.string(),
|
|
3510
|
+
description: z31.string().optional(),
|
|
3509
3511
|
aggregatedOutput: z31.string().optional(),
|
|
3510
3512
|
exitCode: z31.number().optional(),
|
|
3511
3513
|
durationMs: z31.number().optional()
|
|
@@ -15058,7 +15060,7 @@ function createAcpDeltaTranslator(options = {}) {
|
|
|
15058
15060
|
};
|
|
15059
15061
|
}
|
|
15060
15062
|
function commandCloseFields(event, status) {
|
|
15061
|
-
const normalizedEvent = dialect.normalizeCommandEvent?.(event) ?? event;
|
|
15063
|
+
const normalizedEvent = dialect.normalizeCommandEvent?.(event, event) ?? event;
|
|
15062
15064
|
const result = dialect.commandResult?.(normalizedEvent) ?? extractAcpCommandResult(normalizedEvent);
|
|
15063
15065
|
const exitCode = result.exitCode ?? (status === "failed" ? 1 : void 0);
|
|
15064
15066
|
return {
|
|
@@ -15067,7 +15069,8 @@ function createAcpDeltaTranslator(options = {}) {
|
|
|
15067
15069
|
};
|
|
15068
15070
|
}
|
|
15069
15071
|
function genericCloseFields(event) {
|
|
15070
|
-
const
|
|
15072
|
+
const normalizedEvent = dialect.normalizeToolCallEvent?.(event, event) ?? event;
|
|
15073
|
+
const outputText = extractAcpToolCallOutputText(normalizedEvent);
|
|
15071
15074
|
return outputText === void 0 ? {} : { resultText: outputText };
|
|
15072
15075
|
}
|
|
15073
15076
|
function drainOpenToolCalls(context, status) {
|
|
@@ -15206,7 +15209,7 @@ function createAcpDeltaTranslator(options = {}) {
|
|
|
15206
15209
|
...open?.clientFileWrites === void 0 ? {} : { clientFileWrites: open.clientFileWrites }
|
|
15207
15210
|
});
|
|
15208
15211
|
if (event.status === "in_progress" && mergedType === "command" && open?.openedType === "command") {
|
|
15209
|
-
const normalizedEvent = dialect.normalizeCommandEvent?.(event) ?? event;
|
|
15212
|
+
const normalizedEvent = dialect.normalizeCommandEvent?.(event, merged) ?? event;
|
|
15210
15213
|
const streamed = extractAcpStreamedCommandOutput(normalizedEvent);
|
|
15211
15214
|
return streamed === void 0 ? suppressedUnhandled(rawEvent) : [
|
|
15212
15215
|
{
|
|
@@ -15216,7 +15219,8 @@ function createAcpDeltaTranslator(options = {}) {
|
|
|
15216
15219
|
}
|
|
15217
15220
|
];
|
|
15218
15221
|
}
|
|
15219
|
-
const
|
|
15222
|
+
const progressEvent = dialect.normalizeToolCallEvent?.(event, merged) ?? event;
|
|
15223
|
+
const progressText = extractAcpToolCallOutputText(progressEvent);
|
|
15220
15224
|
if (progressText === void 0) {
|
|
15221
15225
|
return suppressedUnhandled(rawEvent);
|
|
15222
15226
|
}
|
|
@@ -22910,24 +22914,30 @@ async function discoverAcpNativeModelSupport(args) {
|
|
|
22910
22914
|
for (const model of modelsToProbe) {
|
|
22911
22915
|
if (timedOut) break;
|
|
22912
22916
|
try {
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
|
|
22918
|
-
|
|
22919
|
-
|
|
22920
|
-
|
|
22921
|
-
|
|
22922
|
-
|
|
22923
|
-
|
|
22924
|
-
|
|
22925
|
-
|
|
22926
|
-
|
|
22927
|
-
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
|
-
|
|
22917
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
22918
|
+
const configState = await args.connection.request({
|
|
22919
|
+
method: "session/set_config_option",
|
|
22920
|
+
params: {
|
|
22921
|
+
sessionId: args.sessionId,
|
|
22922
|
+
configId: modelOption.id,
|
|
22923
|
+
value: model.value
|
|
22924
|
+
},
|
|
22925
|
+
resultSchema: acpConfigStateResultSchema
|
|
22926
|
+
});
|
|
22927
|
+
if (timedOut) break;
|
|
22928
|
+
if (findAcpModelConfigOption(configState.configOptions)?.currentValue !== model.value) {
|
|
22929
|
+
continue;
|
|
22930
|
+
}
|
|
22931
|
+
supportByModel.set(model.value, {
|
|
22932
|
+
...buildAcpNativeReasoningSupport(
|
|
22933
|
+
findAcpThoughtLevelConfigOption(configState.configOptions)
|
|
22934
|
+
),
|
|
22935
|
+
supportedServiceTiers: findAcpFastConfigOption(
|
|
22936
|
+
configState.configOptions
|
|
22937
|
+
)?.options?.some((option) => option.value === "true") ? [{ id: "fast" }] : []
|
|
22938
|
+
});
|
|
22939
|
+
break;
|
|
22940
|
+
}
|
|
22931
22941
|
} catch (error) {
|
|
22932
22942
|
if (timedOut) {
|
|
22933
22943
|
break;
|
|
@@ -1513,6 +1513,7 @@ var threadEventItemSchema = z16.discriminatedUnion("type", [
|
|
|
1513
1513
|
id: z16.string(),
|
|
1514
1514
|
command: z16.string(),
|
|
1515
1515
|
cwd: z16.string(),
|
|
1516
|
+
description: z16.string().optional(),
|
|
1516
1517
|
status: threadEventItemStatusSchema,
|
|
1517
1518
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1518
1519
|
aggregatedOutput: z16.string().optional(),
|
|
@@ -2141,6 +2142,7 @@ var deltaItemShapeSchema = z20.discriminatedUnion("type", [
|
|
|
2141
2142
|
type: z20.literal("command"),
|
|
2142
2143
|
command: z20.string(),
|
|
2143
2144
|
cwd: z20.string(),
|
|
2145
|
+
description: z20.string().optional(),
|
|
2144
2146
|
aggregatedOutput: z20.string().optional(),
|
|
2145
2147
|
exitCode: z20.number().optional(),
|
|
2146
2148
|
durationMs: z20.number().optional()
|
|
@@ -3046,6 +3048,7 @@ function createDeltaAssembler(options) {
|
|
|
3046
3048
|
id: bbItemId,
|
|
3047
3049
|
command: shape.command,
|
|
3048
3050
|
cwd: shape.cwd,
|
|
3051
|
+
...shape.description === void 0 ? {} : { description: shape.description },
|
|
3049
3052
|
...shape.aggregatedOutput === void 0 ? {} : { aggregatedOutput: shape.aggregatedOutput },
|
|
3050
3053
|
...shape.exitCode === void 0 ? {} : { exitCode: shape.exitCode },
|
|
3051
3054
|
...shape.durationMs === void 0 ? {} : { durationMs: shape.durationMs },
|
|
@@ -3273,6 +3276,7 @@ function createDeltaAssembler(options) {
|
|
|
3273
3276
|
id: bbItemId,
|
|
3274
3277
|
command: shape.command,
|
|
3275
3278
|
cwd: shape.cwd,
|
|
3279
|
+
...shape.description === void 0 ? {} : { description: shape.description },
|
|
3276
3280
|
...aggregatedOutput === void 0 ? {} : { aggregatedOutput },
|
|
3277
3281
|
...exitCode === void 0 ? {} : { exitCode },
|
|
3278
3282
|
...shape.durationMs === void 0 ? {} : { durationMs: shape.durationMs },
|
package/dist/provider-bridge.js
CHANGED
|
@@ -2943,6 +2943,7 @@ var threadEventItemSchema = z20.discriminatedUnion("type", [
|
|
|
2943
2943
|
id: z20.string(),
|
|
2944
2944
|
command: z20.string(),
|
|
2945
2945
|
cwd: z20.string(),
|
|
2946
|
+
description: z20.string().optional(),
|
|
2946
2947
|
status: threadEventItemStatusSchema,
|
|
2947
2948
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
2948
2949
|
aggregatedOutput: z20.string().optional(),
|
|
@@ -12425,6 +12426,7 @@ var deltaItemShapeSchema = z37.discriminatedUnion("type", [
|
|
|
12425
12426
|
type: z37.literal("command"),
|
|
12426
12427
|
command: z37.string(),
|
|
12427
12428
|
cwd: z37.string(),
|
|
12429
|
+
description: z37.string().optional(),
|
|
12428
12430
|
aggregatedOutput: z37.string().optional(),
|
|
12429
12431
|
exitCode: z37.number().optional(),
|
|
12430
12432
|
durationMs: z37.number().optional()
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
* STALL_MS is answered with a generic success, and a child past the end of its
|
|
34
34
|
* segment answers everything generically. Both are logged on stderr.
|
|
35
35
|
*/
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
36
|
+
import { existsSync, mkdirSync, readFileSync, rmdirSync } from "node:fs";
|
|
37
|
+
import { connect } from "node:net";
|
|
38
38
|
import { StringDecoder } from "node:string_decoder";
|
|
39
39
|
import { join } from "node:path";
|
|
40
40
|
|
|
@@ -159,15 +159,15 @@ const DIALECTS = {
|
|
|
159
159
|
* `pi --mode rpc`: commands carry `{ id, type }`, responses are
|
|
160
160
|
* `{ id, type: "response", command, success }`, and every other line is a
|
|
161
161
|
* raw AgentSessionEvent (or an `extension_ui_request`). The bb extension's
|
|
162
|
-
* channel (
|
|
163
|
-
* same lanes wrapped as `{ bbChannel: <message> }`; this
|
|
164
|
-
* those back onto
|
|
162
|
+
* channel (the socket the bridge names in `BB_PI_BRIDGE_CHANNEL`) is
|
|
163
|
+
* recorded on the same lanes wrapped as `{ bbChannel: <message> }`; this
|
|
164
|
+
* dialect routes those back onto that socket.
|
|
165
165
|
*/
|
|
166
166
|
"pi-rpc": {
|
|
167
167
|
channel: {
|
|
168
168
|
key: "bbChannel",
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
addressEnv: "BB_PI_BRIDGE_CHANNEL",
|
|
170
|
+
tokenEnv: "BB_PI_BRIDGE_CHANNEL_TOKEN",
|
|
171
171
|
},
|
|
172
172
|
classify(message) {
|
|
173
173
|
const channel = message.bbChannel;
|
|
@@ -353,6 +353,14 @@ function readNewlineDelimitedLines(input, onLine) {
|
|
|
353
353
|
});
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
function connectChannel(channel) {
|
|
357
|
+
const socket = connect(process.env[channel.addressEnv]);
|
|
358
|
+
socket.on("error", () => {});
|
|
359
|
+
socket.unref();
|
|
360
|
+
socket.write(`${process.env[channel.tokenEnv]}\n`);
|
|
361
|
+
return socket;
|
|
362
|
+
}
|
|
363
|
+
|
|
356
364
|
// ---------------------------------------------------------------------------
|
|
357
365
|
// Player
|
|
358
366
|
// ---------------------------------------------------------------------------
|
|
@@ -381,14 +389,11 @@ function servePiCatalog(entries) {
|
|
|
381
389
|
}
|
|
382
390
|
}
|
|
383
391
|
}
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
channelIn.on("error", () => {});
|
|
387
|
-
channelIn.unref();
|
|
388
|
-
readNewlineDelimitedLines(channelIn, (line) => {
|
|
392
|
+
const channel = connectChannel(DIALECTS["pi-rpc"].channel);
|
|
393
|
+
readNewlineDelimitedLines(channel, (line) => {
|
|
389
394
|
const message = parseLine(line);
|
|
390
395
|
if (message?.kind !== "request" || message.method !== "model-scope") return;
|
|
391
|
-
|
|
396
|
+
channel.write(
|
|
392
397
|
`${JSON.stringify({
|
|
393
398
|
kind: "reply",
|
|
394
399
|
id: message.id,
|
|
@@ -471,10 +476,10 @@ function main() {
|
|
|
471
476
|
let emitTimer = null;
|
|
472
477
|
|
|
473
478
|
const channel = dialect.channel ?? null;
|
|
474
|
-
const
|
|
479
|
+
const channelSocket = channel ? connectChannel(channel) : null;
|
|
475
480
|
function emit(message) {
|
|
476
481
|
if (channel && typeof message[channel.key] === "object" && message[channel.key] !== null) {
|
|
477
|
-
|
|
482
|
+
channelSocket.write(`${JSON.stringify(message[channel.key])}\n`);
|
|
478
483
|
return;
|
|
479
484
|
}
|
|
480
485
|
process.stdout.write(`${JSON.stringify(message)}\n`);
|
|
@@ -710,13 +715,7 @@ function main() {
|
|
|
710
715
|
process.exit(0);
|
|
711
716
|
});
|
|
712
717
|
if (channel) {
|
|
713
|
-
|
|
714
|
-
// their own fd; wrap them the way the recorder did so they match. A
|
|
715
|
-
// net.Socket reads the pipe non-blockingly, as the real extension does.
|
|
716
|
-
const channelIn = new Socket({ fd: channel.bridgeToChildFd, readable: true, writable: false });
|
|
717
|
-
channelIn.on("error", () => {});
|
|
718
|
-
channelIn.unref();
|
|
719
|
-
readNewlineDelimitedLines(channelIn, (line) => {
|
|
718
|
+
readNewlineDelimitedLines(channelSocket, (line) => {
|
|
720
719
|
const message = parseLine(line);
|
|
721
720
|
if (message !== null) onLiveMessage({ [channel.key]: message });
|
|
722
721
|
});
|
package/dist/testing/app.js
CHANGED
|
@@ -1755,7 +1755,8 @@ var queuedMessageWaitingOnKindValues = [
|
|
|
1755
1755
|
"provisioning",
|
|
1756
1756
|
"host-offline",
|
|
1757
1757
|
"interaction",
|
|
1758
|
-
"plugin"
|
|
1758
|
+
"plugin",
|
|
1759
|
+
"superseded"
|
|
1759
1760
|
];
|
|
1760
1761
|
var queuedMessageWaitingOnKindSchema = z9.enum(
|
|
1761
1762
|
queuedMessageWaitingOnKindValues
|
|
@@ -1778,7 +1779,8 @@ var queuedMessageWaitingOnSchema = z9.discriminatedUnion("kind", [
|
|
|
1778
1779
|
kind: z9.literal("plugin"),
|
|
1779
1780
|
pluginId: pluginIdSchema,
|
|
1780
1781
|
reason: queuedMessageWaitReasonSchema
|
|
1781
|
-
})
|
|
1782
|
+
}),
|
|
1783
|
+
z9.object({ kind: z9.literal("superseded") })
|
|
1782
1784
|
]);
|
|
1783
1785
|
var QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH = 200;
|
|
1784
1786
|
var queuedMessageFailureReasonSchema = z9.string().min(1).max(QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH);
|
|
@@ -2023,14 +2025,14 @@ var ENVIRONMENT_CHANGE_KINDS = [
|
|
|
2023
2025
|
"status-changed",
|
|
2024
2026
|
"work-status-changed",
|
|
2025
2027
|
"git-refs-changed",
|
|
2026
|
-
"thread-storage-changed"
|
|
2027
|
-
"diff-viewed-changed"
|
|
2028
|
+
"thread-storage-changed"
|
|
2028
2029
|
];
|
|
2029
2030
|
var HOST_CHANGE_KINDS = [
|
|
2030
2031
|
"host-connected",
|
|
2031
2032
|
"host-disconnected",
|
|
2032
2033
|
"provider-model-catalog-changed",
|
|
2033
|
-
"provider-commands-changed"
|
|
2034
|
+
"provider-commands-changed",
|
|
2035
|
+
"provider-cli-status-changed"
|
|
2034
2036
|
];
|
|
2035
2037
|
var SYSTEM_CHANGE_KINDS = [
|
|
2036
2038
|
"config-changed",
|
|
@@ -4476,9 +4478,9 @@ function collectPluginAppRegistrations(definition, onWarning = (message) => cons
|
|
|
4476
4478
|
const id = requireSlotId(kind, registration?.id);
|
|
4477
4479
|
requireUniqueId(kind, seenIds.fileOpener, id);
|
|
4478
4480
|
const rawExtensions = registration?.extensions;
|
|
4479
|
-
if (!Array.isArray(rawExtensions)
|
|
4481
|
+
if (!Array.isArray(rawExtensions)) {
|
|
4480
4482
|
throw new Error(
|
|
4481
|
-
`${kind}: "extensions" must be
|
|
4483
|
+
`${kind}: "extensions" must be an array of lowercase extensions without the dot`
|
|
4482
4484
|
);
|
|
4483
4485
|
}
|
|
4484
4486
|
const extensions = rawExtensions.map((extension) => {
|
|
@@ -5521,6 +5523,10 @@ function TestVoiceInputTextarea({
|
|
|
5521
5523
|
}
|
|
5522
5524
|
);
|
|
5523
5525
|
}
|
|
5526
|
+
function TestFilePreview({ target, renderPreview }) {
|
|
5527
|
+
const file = useSlotEnv("experimental_FilePreview").filePreview(target);
|
|
5528
|
+
return /* @__PURE__ */ jsx("div", { "data-testid": "bb-file-preview", "data-path": target.path, children: file === null ? null : renderPreview(file) });
|
|
5529
|
+
}
|
|
5524
5530
|
function TestSourceCode({
|
|
5525
5531
|
content,
|
|
5526
5532
|
path,
|
|
@@ -5816,6 +5822,7 @@ var testPluginSdkApp = {
|
|
|
5816
5822
|
return useSlotEnv("experimental_useCheckoutState").checkoutState;
|
|
5817
5823
|
},
|
|
5818
5824
|
experimental_SourceCode: TestSourceCode,
|
|
5825
|
+
experimental_FilePreview: TestFilePreview,
|
|
5819
5826
|
experimental_Diff: TestDiff,
|
|
5820
5827
|
experimental_InfoSection: TestInfoSection,
|
|
5821
5828
|
experimental_DetailRow: TestDetailRow,
|
|
@@ -6831,6 +6838,7 @@ ${block}
|
|
|
6831
6838
|
providers,
|
|
6832
6839
|
codeTheme,
|
|
6833
6840
|
canOpenFileExternally: options.canOpenFileExternally ?? (() => false),
|
|
6841
|
+
filePreview: options.filePreview ?? (() => null),
|
|
6834
6842
|
tabVisible: options.tabVisible ?? true,
|
|
6835
6843
|
servers: options.servers ?? null,
|
|
6836
6844
|
branchesState: {
|