@get-bb/plugin-sdk 0.6.15 → 0.6.19
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 +647 -4
- package/bundled-types/bb-plugin-sdk-internal-composer-handle.d.ts +24 -16
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +8 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +12 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +16 -0
- package/bundled-types/bb-plugin-sdk.d.ts +647 -4
- package/dist/host.js +5 -0
- package/dist/internal/composer-handle.js +19 -7
- package/dist/provider-bridge-acp.js +101 -21
- package/dist/provider-bridge-testing.js +7 -8
- package/dist/provider-bridge-worker-entry.mjs +5 -0
- package/dist/provider-bridge.js +9 -0
- package/dist/testing/app.js +19 -7
- package/package.json +1 -1
package/dist/host.js
CHANGED
|
@@ -952,6 +952,11 @@ function sanitizeInheritedChildProcessEnv(args) {
|
|
|
952
952
|
import { execFile } from "node:child_process";
|
|
953
953
|
import { promisify } from "node:util";
|
|
954
954
|
var execFileAsync = promisify(execFile);
|
|
955
|
+
|
|
956
|
+
// ../process-utils/src/performance-diagnostics.ts
|
|
957
|
+
import { Session } from "node:inspector/promises";
|
|
958
|
+
var PROFILE_RETENTION_MS = 12 * 60 * 60 * 1e3;
|
|
959
|
+
var MAX_PROFILE_BYTES = 12 * 1024 * 1024;
|
|
955
960
|
export {
|
|
956
961
|
experimental_defineHostEntry,
|
|
957
962
|
experimental_filterResolvedNativeRoots,
|
|
@@ -95,14 +95,26 @@ var mentionSchema = z.discriminatedUnion("kind", [
|
|
|
95
95
|
icon: z.string().nullable().optional()
|
|
96
96
|
})
|
|
97
97
|
]);
|
|
98
|
+
var attachmentFields = {
|
|
99
|
+
type: z.enum(["localImage", "localFile"]),
|
|
100
|
+
path: z.string().min(1),
|
|
101
|
+
name: z.string(),
|
|
102
|
+
mimeType: z.string().optional(),
|
|
103
|
+
sizeBytes: z.number().nonnegative().optional()
|
|
104
|
+
};
|
|
98
105
|
var attachmentsSchema = z.array(
|
|
99
|
-
z.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
z.union([
|
|
107
|
+
z.object({
|
|
108
|
+
...attachmentFields,
|
|
109
|
+
hostId: z.string().min(1),
|
|
110
|
+
sourceProjectId: z.undefined().optional()
|
|
111
|
+
}),
|
|
112
|
+
z.object({
|
|
113
|
+
...attachmentFields,
|
|
114
|
+
sourceProjectId: z.string().min(1).optional(),
|
|
115
|
+
hostId: z.undefined().optional()
|
|
116
|
+
})
|
|
117
|
+
])
|
|
106
118
|
);
|
|
107
119
|
var replacementSchema = z.object({
|
|
108
120
|
text: z.string(),
|
|
@@ -743,11 +743,15 @@ var promptInputSchema = z3.discriminatedUnion("type", [
|
|
|
743
743
|
z3.object({
|
|
744
744
|
type: z3.literal("localImage"),
|
|
745
745
|
path: z3.string(),
|
|
746
|
+
sourceProjectId: z3.string().min(1).optional(),
|
|
747
|
+
hostId: z3.string().min(1).optional(),
|
|
746
748
|
...promptInputVisibilityFields
|
|
747
749
|
}),
|
|
748
750
|
z3.object({
|
|
749
751
|
type: z3.literal("localFile"),
|
|
750
752
|
path: z3.string(),
|
|
753
|
+
sourceProjectId: z3.string().min(1).optional(),
|
|
754
|
+
hostId: z3.string().min(1).optional(),
|
|
751
755
|
name: z3.string().optional(),
|
|
752
756
|
sizeBytes: z3.number().int().nonnegative().optional(),
|
|
753
757
|
mimeType: z3.string().optional(),
|
|
@@ -11504,6 +11508,11 @@ import { execFile as execFile2 } from "node:child_process";
|
|
|
11504
11508
|
import { promisify as promisify3 } from "node:util";
|
|
11505
11509
|
var execFileAsync = promisify3(execFile2);
|
|
11506
11510
|
|
|
11511
|
+
// ../process-utils/src/performance-diagnostics.ts
|
|
11512
|
+
import { Session } from "node:inspector/promises";
|
|
11513
|
+
var PROFILE_RETENTION_MS = 12 * 60 * 60 * 1e3;
|
|
11514
|
+
var MAX_PROFILE_BYTES = 12 * 1024 * 1024;
|
|
11515
|
+
|
|
11507
11516
|
// ../provider-bridge-protocol/src/bridge-kit/provider-maintenance-kit.ts
|
|
11508
11517
|
var import_compare = __toESM(require_compare(), 1);
|
|
11509
11518
|
var import_valid = __toESM(require_valid(), 1);
|
|
@@ -17301,6 +17310,21 @@ function runTurn(session, firstInput) {
|
|
|
17301
17310
|
let stopReason;
|
|
17302
17311
|
session.cancelRequested = false;
|
|
17303
17312
|
try {
|
|
17313
|
+
const previousSession = session;
|
|
17314
|
+
const reconciled = reconcileExecutionSettings(session, pending.options);
|
|
17315
|
+
session = reconciled instanceof Promise ? await reconciled : reconciled;
|
|
17316
|
+
if (session.stopping) {
|
|
17317
|
+
dropTurnInput(pending, "ACP session is stopping");
|
|
17318
|
+
finishTurn(session, "cancelled");
|
|
17319
|
+
return;
|
|
17320
|
+
}
|
|
17321
|
+
session.activePromptKind = "turn";
|
|
17322
|
+
session.turnSettled = previousSession.turnSettled;
|
|
17323
|
+
if (session !== previousSession) {
|
|
17324
|
+
emitForSession(session, ACP_TURN_STARTED_METHOD, {
|
|
17325
|
+
threadId: session.bbThreadId
|
|
17326
|
+
});
|
|
17327
|
+
}
|
|
17304
17328
|
session.promptRequestPending = true;
|
|
17305
17329
|
const promptResult = session.connection.request({
|
|
17306
17330
|
method: "session/prompt",
|
|
@@ -17351,6 +17375,77 @@ function runTurn(session, firstInput) {
|
|
|
17351
17375
|
}
|
|
17352
17376
|
})();
|
|
17353
17377
|
}
|
|
17378
|
+
function reconcileExecutionSettings(session, options) {
|
|
17379
|
+
if (options.permissionMode === "auto") {
|
|
17380
|
+
throw new Error('ACP does not support permission mode "auto".');
|
|
17381
|
+
}
|
|
17382
|
+
const envVars = Object.keys(options.envVars ?? {}).length > 0 ? {
|
|
17383
|
+
...decodeLaunchSpec(options.providerOptions)?.env ?? {},
|
|
17384
|
+
...options.envVars
|
|
17385
|
+
} : session.construction.envVars;
|
|
17386
|
+
const workspaceWriteRoots = options.providerOptions?.additionalWorkspaceWriteRoots !== void 0 ? [
|
|
17387
|
+
session.cwd,
|
|
17388
|
+
...decodeAdditionalWorkspaceWriteRoots(options.providerOptions)
|
|
17389
|
+
] : session.policy.workspaceWriteRoots;
|
|
17390
|
+
const construction = {
|
|
17391
|
+
...session.construction,
|
|
17392
|
+
envVars,
|
|
17393
|
+
permissionMode: options.permissionMode,
|
|
17394
|
+
workspaceWriteRoots
|
|
17395
|
+
};
|
|
17396
|
+
const launchArgsChanged = !isDeepStrictEqual(
|
|
17397
|
+
permissionCliArgsForMode(
|
|
17398
|
+
session.construction.permissionCli,
|
|
17399
|
+
session.construction.permissionMode
|
|
17400
|
+
),
|
|
17401
|
+
permissionCliArgsForMode(
|
|
17402
|
+
construction.permissionCli,
|
|
17403
|
+
construction.permissionMode
|
|
17404
|
+
)
|
|
17405
|
+
);
|
|
17406
|
+
const restart = session.restartAfterCancelError || launchArgsChanged || !isDeepStrictEqual(envVars ?? {}, session.construction.envVars ?? {});
|
|
17407
|
+
cancelPendingPermissions(session);
|
|
17408
|
+
session.policy = {
|
|
17409
|
+
permissionMode: options.permissionMode,
|
|
17410
|
+
workspaceWriteRoots
|
|
17411
|
+
};
|
|
17412
|
+
if (!restart) {
|
|
17413
|
+
session.construction = construction;
|
|
17414
|
+
return session;
|
|
17415
|
+
}
|
|
17416
|
+
return rebuildAgentSession(session, construction);
|
|
17417
|
+
}
|
|
17418
|
+
async function rebuildAgentSession(session, construction) {
|
|
17419
|
+
const previousProviderThreadId = session.providerThreadId;
|
|
17420
|
+
const reason = session.restartAfterCancelError ? "The ACP agent failed during cancellation; its session was rebuilt before continuing." : "Execution settings changed; the ACP session was rebuilt to apply them.";
|
|
17421
|
+
const queuedInputs = session.queuedInputs.splice(0);
|
|
17422
|
+
const continuingTurn = session.activePromptKind === "turn";
|
|
17423
|
+
finishTurn(session, "cancelled");
|
|
17424
|
+
let replacement;
|
|
17425
|
+
try {
|
|
17426
|
+
replacement = await startAgentSession({
|
|
17427
|
+
kind: "resume",
|
|
17428
|
+
params: construction,
|
|
17429
|
+
resumeProviderThreadId: previousProviderThreadId
|
|
17430
|
+
});
|
|
17431
|
+
} catch (error) {
|
|
17432
|
+
if (continuingTurn) {
|
|
17433
|
+
emitSessionError(
|
|
17434
|
+
session,
|
|
17435
|
+
error instanceof Error ? error.message : String(error)
|
|
17436
|
+
);
|
|
17437
|
+
}
|
|
17438
|
+
throw error;
|
|
17439
|
+
}
|
|
17440
|
+
replacement.queuedInputs.push(...queuedInputs);
|
|
17441
|
+
sendNotification(BRIDGE_NOTIFICATION_METHODS.sessionReplaced, {
|
|
17442
|
+
threadId: session.bbThreadId,
|
|
17443
|
+
providerThreadId: replacement.providerThreadId,
|
|
17444
|
+
reason,
|
|
17445
|
+
contextLost: replacement.providerThreadId !== previousProviderThreadId
|
|
17446
|
+
});
|
|
17447
|
+
return replacement;
|
|
17448
|
+
}
|
|
17354
17449
|
function startCompaction(session, pending) {
|
|
17355
17450
|
session.activePromptKind = "compaction";
|
|
17356
17451
|
session.compactionAgentMessage = "";
|
|
@@ -17721,29 +17816,13 @@ async function handleRequest2(request) {
|
|
|
17721
17816
|
sendError(request.id, -32e3, "A turn is already active");
|
|
17722
17817
|
return;
|
|
17723
17818
|
}
|
|
17724
|
-
const
|
|
17725
|
-
|
|
17726
|
-
...params.options.envVars
|
|
17727
|
-
} : session.construction.envVars;
|
|
17728
|
-
if (session.restartAfterCancelError || !isDeepStrictEqual(envVars ?? {}, session.construction.envVars ?? {})) {
|
|
17729
|
-
const previousProviderThreadId = session.providerThreadId;
|
|
17730
|
-
const reason = session.restartAfterCancelError ? "The ACP agent failed during cancellation; its session was rebuilt before continuing." : "Execution settings changed; the ACP session was rebuilt to apply them.";
|
|
17731
|
-
session = await startAgentSession({
|
|
17732
|
-
kind: "resume",
|
|
17733
|
-
params: { ...session.construction, envVars },
|
|
17734
|
-
resumeProviderThreadId: previousProviderThreadId
|
|
17735
|
-
});
|
|
17736
|
-
sendNotification(BRIDGE_NOTIFICATION_METHODS.sessionReplaced, {
|
|
17737
|
-
threadId: params.threadId,
|
|
17738
|
-
providerThreadId: session.providerThreadId,
|
|
17739
|
-
reason,
|
|
17740
|
-
contextLost: session.providerThreadId !== previousProviderThreadId
|
|
17741
|
-
});
|
|
17742
|
-
}
|
|
17819
|
+
const reconciled = reconcileExecutionSettings(session, params.options);
|
|
17820
|
+
session = reconciled instanceof Promise ? await reconciled : reconciled;
|
|
17743
17821
|
const pending = {
|
|
17744
17822
|
clientRequestId: params.clientRequestId,
|
|
17745
17823
|
input: params.input,
|
|
17746
|
-
requestId: request.id
|
|
17824
|
+
requestId: request.id,
|
|
17825
|
+
options: params.options
|
|
17747
17826
|
};
|
|
17748
17827
|
if (isStandaloneBuiltinCompactCommand(params.input)) {
|
|
17749
17828
|
startCompaction(session, pending);
|
|
@@ -17769,7 +17848,8 @@ async function handleRequest2(request) {
|
|
|
17769
17848
|
session.queuedInputs.push({
|
|
17770
17849
|
clientRequestId: params.clientRequestId,
|
|
17771
17850
|
input: params.input,
|
|
17772
|
-
requestId: null
|
|
17851
|
+
requestId: null,
|
|
17852
|
+
options: params.options
|
|
17773
17853
|
});
|
|
17774
17854
|
requestSteerCancel(session);
|
|
17775
17855
|
sendResult(request.id, { threadId: params.threadId });
|
|
@@ -178,11 +178,15 @@ var promptInputSchema = z3.discriminatedUnion("type", [
|
|
|
178
178
|
z3.object({
|
|
179
179
|
type: z3.literal("localImage"),
|
|
180
180
|
path: z3.string(),
|
|
181
|
+
sourceProjectId: z3.string().min(1).optional(),
|
|
182
|
+
hostId: z3.string().min(1).optional(),
|
|
181
183
|
...promptInputVisibilityFields
|
|
182
184
|
}),
|
|
183
185
|
z3.object({
|
|
184
186
|
type: z3.literal("localFile"),
|
|
185
187
|
path: z3.string(),
|
|
188
|
+
sourceProjectId: z3.string().min(1).optional(),
|
|
189
|
+
hostId: z3.string().min(1).optional(),
|
|
186
190
|
name: z3.string().optional(),
|
|
187
191
|
sizeBytes: z3.number().int().nonnegative().optional(),
|
|
188
192
|
mimeType: z3.string().optional(),
|
|
@@ -6216,13 +6220,8 @@ function describeCalibrationEvents(events) {
|
|
|
6216
6220
|
|
|
6217
6221
|
// ../provider-bridge-protocol/src/testing/parity.ts
|
|
6218
6222
|
import { spawn } from "node:child_process";
|
|
6219
|
-
import {
|
|
6220
|
-
|
|
6221
|
-
mkdtempSync,
|
|
6222
|
-
realpathSync,
|
|
6223
|
-
rmSync,
|
|
6224
|
-
writeFileSync
|
|
6225
|
-
} from "node:fs";
|
|
6223
|
+
import { existsSync as existsSync2, mkdtempSync, realpathSync, writeFileSync } from "node:fs";
|
|
6224
|
+
import { rm } from "node:fs/promises";
|
|
6226
6225
|
import { tmpdir } from "node:os";
|
|
6227
6226
|
import { isAbsolute, join as join2, resolve as resolve2 } from "node:path";
|
|
6228
6227
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
|
|
@@ -6833,7 +6832,7 @@ async function replayRecording(options) {
|
|
|
6833
6832
|
})
|
|
6834
6833
|
]);
|
|
6835
6834
|
for (const directory of [stateDir, workspaceDir]) {
|
|
6836
|
-
|
|
6835
|
+
await rm(directory, {
|
|
6837
6836
|
force: true,
|
|
6838
6837
|
maxRetries: REPLAY_CLEANUP_RETRIES,
|
|
6839
6838
|
recursive: true,
|
|
@@ -563,6 +563,11 @@ import { execFile } from "node:child_process";
|
|
|
563
563
|
import { promisify } from "node:util";
|
|
564
564
|
var execFileAsync = promisify(execFile);
|
|
565
565
|
|
|
566
|
+
// ../process-utils/src/performance-diagnostics.ts
|
|
567
|
+
import { Session } from "node:inspector/promises";
|
|
568
|
+
var PROFILE_RETENTION_MS = 12 * 60 * 60 * 1e3;
|
|
569
|
+
var MAX_PROFILE_BYTES = 12 * 1024 * 1024;
|
|
570
|
+
|
|
566
571
|
// ../provider-bridge-protocol/src/bridge-kit/bounded-line-reader.ts
|
|
567
572
|
import { StringDecoder } from "node:string_decoder";
|
|
568
573
|
var MAX_JSON_RPC_LINE_BYTES = 64 * 1024 * 1024;
|
package/dist/provider-bridge.js
CHANGED
|
@@ -1236,11 +1236,15 @@ var promptInputSchema = z5.discriminatedUnion("type", [
|
|
|
1236
1236
|
z5.object({
|
|
1237
1237
|
type: z5.literal("localImage"),
|
|
1238
1238
|
path: z5.string(),
|
|
1239
|
+
sourceProjectId: z5.string().min(1).optional(),
|
|
1240
|
+
hostId: z5.string().min(1).optional(),
|
|
1239
1241
|
...promptInputVisibilityFields
|
|
1240
1242
|
}),
|
|
1241
1243
|
z5.object({
|
|
1242
1244
|
type: z5.literal("localFile"),
|
|
1243
1245
|
path: z5.string(),
|
|
1246
|
+
sourceProjectId: z5.string().min(1).optional(),
|
|
1247
|
+
hostId: z5.string().min(1).optional(),
|
|
1244
1248
|
name: z5.string().optional(),
|
|
1245
1249
|
sizeBytes: z5.number().int().nonnegative().optional(),
|
|
1246
1250
|
mimeType: z5.string().optional(),
|
|
@@ -11066,6 +11070,11 @@ import { execFile as execFile2 } from "node:child_process";
|
|
|
11066
11070
|
import { promisify as promisify3 } from "node:util";
|
|
11067
11071
|
var execFileAsync = promisify3(execFile2);
|
|
11068
11072
|
|
|
11073
|
+
// ../process-utils/src/performance-diagnostics.ts
|
|
11074
|
+
import { Session } from "node:inspector/promises";
|
|
11075
|
+
var PROFILE_RETENTION_MS = 12 * 60 * 60 * 1e3;
|
|
11076
|
+
var MAX_PROFILE_BYTES = 12 * 1024 * 1024;
|
|
11077
|
+
|
|
11069
11078
|
// ../provider-bridge-protocol/src/bridge-kit/provider-maintenance-kit.ts
|
|
11070
11079
|
var import_compare = __toESM(require_compare(), 1);
|
|
11071
11080
|
var import_valid = __toESM(require_valid(), 1);
|
package/dist/testing/app.js
CHANGED
|
@@ -113,14 +113,26 @@ var mentionSchema = z.discriminatedUnion("kind", [
|
|
|
113
113
|
icon: z.string().nullable().optional()
|
|
114
114
|
})
|
|
115
115
|
]);
|
|
116
|
+
var attachmentFields = {
|
|
117
|
+
type: z.enum(["localImage", "localFile"]),
|
|
118
|
+
path: z.string().min(1),
|
|
119
|
+
name: z.string(),
|
|
120
|
+
mimeType: z.string().optional(),
|
|
121
|
+
sizeBytes: z.number().nonnegative().optional()
|
|
122
|
+
};
|
|
116
123
|
var attachmentsSchema = z.array(
|
|
117
|
-
z.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
z.union([
|
|
125
|
+
z.object({
|
|
126
|
+
...attachmentFields,
|
|
127
|
+
hostId: z.string().min(1),
|
|
128
|
+
sourceProjectId: z.undefined().optional()
|
|
129
|
+
}),
|
|
130
|
+
z.object({
|
|
131
|
+
...attachmentFields,
|
|
132
|
+
sourceProjectId: z.string().min(1).optional(),
|
|
133
|
+
hostId: z.undefined().optional()
|
|
134
|
+
})
|
|
135
|
+
])
|
|
124
136
|
);
|
|
125
137
|
var replacementSchema = z.object({
|
|
126
138
|
text: z.string(),
|