@get-bb/plugin-sdk 0.6.42 → 0.6.43
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.
|
@@ -10352,6 +10352,7 @@ type SystemProvidersQuery = z$1.infer<typeof systemProvidersQuerySchema>;
|
|
|
10352
10352
|
declare const systemExecutionOptionsQuerySchema: z$1.ZodObject<{
|
|
10353
10353
|
environmentId: z$1.ZodOptional<z$1.ZodString>;
|
|
10354
10354
|
hostId: z$1.ZodOptional<z$1.ZodString>;
|
|
10355
|
+
projectId: z$1.ZodOptional<z$1.ZodString>;
|
|
10355
10356
|
providerId: z$1.ZodOptional<z$1.ZodString>;
|
|
10356
10357
|
}, z$1.core.$strip>;
|
|
10357
10358
|
type SystemExecutionOptionsQuery = z$1.infer<typeof systemExecutionOptionsQuerySchema>;
|
|
@@ -11077,6 +11078,20 @@ declare const systemVersionResponseSchema: z$1.ZodObject<{
|
|
|
11077
11078
|
upgradeCommand: z$1.ZodString;
|
|
11078
11079
|
}, z$1.core.$strip>;
|
|
11079
11080
|
type SystemVersionResponse = z$1.infer<typeof systemVersionResponseSchema>;
|
|
11081
|
+
declare const systemCliCommandStatusSchema: z$1.ZodObject<{
|
|
11082
|
+
installedPath: z$1.ZodNullable<z$1.ZodString>;
|
|
11083
|
+
onPath: z$1.ZodBoolean;
|
|
11084
|
+
shadowedBy: z$1.ZodNullable<z$1.ZodObject<{
|
|
11085
|
+
path: z$1.ZodString;
|
|
11086
|
+
source: z$1.ZodEnum<{
|
|
11087
|
+
machine: "machine";
|
|
11088
|
+
npm: "npm";
|
|
11089
|
+
other: "other";
|
|
11090
|
+
}>;
|
|
11091
|
+
}, z$1.core.$strip>>;
|
|
11092
|
+
supported: z$1.ZodBoolean;
|
|
11093
|
+
}, z$1.core.$strip>;
|
|
11094
|
+
type SystemCliCommandStatus = z$1.infer<typeof systemCliCommandStatusSchema>;
|
|
11080
11095
|
declare const systemAppUpdateStatusSchema: z$1.ZodObject<{
|
|
11081
11096
|
activity: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
11082
11097
|
phase: z$1.ZodLiteral<"idle">;
|
|
@@ -17236,7 +17251,19 @@ type ProviderListArgs = ProviderHostRoutingArgs & {
|
|
|
17236
17251
|
capability?: SystemProvidersQuery["capability"];
|
|
17237
17252
|
signal?: AbortSignal;
|
|
17238
17253
|
};
|
|
17239
|
-
type ProviderModelsArgs =
|
|
17254
|
+
type ProviderModelsArgs = ({
|
|
17255
|
+
environmentId: string;
|
|
17256
|
+
hostId?: never;
|
|
17257
|
+
projectId?: never;
|
|
17258
|
+
} | {
|
|
17259
|
+
environmentId?: never;
|
|
17260
|
+
hostId: string;
|
|
17261
|
+
projectId?: string;
|
|
17262
|
+
} | {
|
|
17263
|
+
environmentId?: never;
|
|
17264
|
+
hostId?: never;
|
|
17265
|
+
projectId?: string;
|
|
17266
|
+
}) & {
|
|
17240
17267
|
providerId?: string;
|
|
17241
17268
|
signal?: AbortSignal;
|
|
17242
17269
|
};
|
|
@@ -17640,6 +17667,10 @@ interface SystemAppUpdateArgs {
|
|
|
17640
17667
|
type SystemApplyAppUpdateArgs = SystemAppUpdateApplyRequest;
|
|
17641
17668
|
type SystemAcknowledgeAppUpdateArgs = SystemAppUpdateAcknowledgeRequest;
|
|
17642
17669
|
type SystemAppUpdateStatusResult = SystemAppUpdateStatus;
|
|
17670
|
+
interface SystemCliCommandArgs {
|
|
17671
|
+
signal?: AbortSignal;
|
|
17672
|
+
}
|
|
17673
|
+
type SystemCliCommandStatusResult = SystemCliCommandStatus;
|
|
17643
17674
|
interface SystemVoiceTranscriptionArgs {
|
|
17644
17675
|
file: Blob;
|
|
17645
17676
|
prompt?: string;
|
|
@@ -17727,6 +17758,9 @@ interface SystemArea {
|
|
|
17727
17758
|
appUpdate(args?: SystemAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
|
|
17728
17759
|
applyAppUpdate(args: SystemApplyAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
|
|
17729
17760
|
acknowledgeAppUpdate(args: SystemAcknowledgeAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
|
|
17761
|
+
experimental_cliCommand(args?: SystemCliCommandArgs): Promise<SystemCliCommandStatusResult>;
|
|
17762
|
+
experimental_installCliCommand(): Promise<SystemCliCommandStatusResult>;
|
|
17763
|
+
experimental_removeCliCommand(): Promise<SystemCliCommandStatusResult>;
|
|
17730
17764
|
}
|
|
17731
17765
|
|
|
17732
17766
|
interface TerminalThreadScope {
|
|
@@ -10411,6 +10411,7 @@ type SystemProvidersQuery = z$1.infer<typeof systemProvidersQuerySchema>;
|
|
|
10411
10411
|
declare const systemExecutionOptionsQuerySchema: z$1.ZodObject<{
|
|
10412
10412
|
environmentId: z$1.ZodOptional<z$1.ZodString>;
|
|
10413
10413
|
hostId: z$1.ZodOptional<z$1.ZodString>;
|
|
10414
|
+
projectId: z$1.ZodOptional<z$1.ZodString>;
|
|
10414
10415
|
providerId: z$1.ZodOptional<z$1.ZodString>;
|
|
10415
10416
|
}, z$1.core.$strip>;
|
|
10416
10417
|
type SystemExecutionOptionsQuery = z$1.infer<typeof systemExecutionOptionsQuerySchema>;
|
|
@@ -11136,6 +11137,20 @@ declare const systemVersionResponseSchema: z$1.ZodObject<{
|
|
|
11136
11137
|
upgradeCommand: z$1.ZodString;
|
|
11137
11138
|
}, z$1.core.$strip>;
|
|
11138
11139
|
type SystemVersionResponse = z$1.infer<typeof systemVersionResponseSchema>;
|
|
11140
|
+
declare const systemCliCommandStatusSchema: z$1.ZodObject<{
|
|
11141
|
+
installedPath: z$1.ZodNullable<z$1.ZodString>;
|
|
11142
|
+
onPath: z$1.ZodBoolean;
|
|
11143
|
+
shadowedBy: z$1.ZodNullable<z$1.ZodObject<{
|
|
11144
|
+
path: z$1.ZodString;
|
|
11145
|
+
source: z$1.ZodEnum<{
|
|
11146
|
+
machine: "machine";
|
|
11147
|
+
npm: "npm";
|
|
11148
|
+
other: "other";
|
|
11149
|
+
}>;
|
|
11150
|
+
}, z$1.core.$strip>>;
|
|
11151
|
+
supported: z$1.ZodBoolean;
|
|
11152
|
+
}, z$1.core.$strip>;
|
|
11153
|
+
type SystemCliCommandStatus = z$1.infer<typeof systemCliCommandStatusSchema>;
|
|
11139
11154
|
declare const systemAppUpdateStatusSchema: z$1.ZodObject<{
|
|
11140
11155
|
activity: z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
11141
11156
|
phase: z$1.ZodLiteral<"idle">;
|
|
@@ -17307,7 +17322,19 @@ type ProviderListArgs = ProviderHostRoutingArgs & {
|
|
|
17307
17322
|
capability?: SystemProvidersQuery["capability"];
|
|
17308
17323
|
signal?: AbortSignal;
|
|
17309
17324
|
};
|
|
17310
|
-
type ProviderModelsArgs =
|
|
17325
|
+
type ProviderModelsArgs = ({
|
|
17326
|
+
environmentId: string;
|
|
17327
|
+
hostId?: never;
|
|
17328
|
+
projectId?: never;
|
|
17329
|
+
} | {
|
|
17330
|
+
environmentId?: never;
|
|
17331
|
+
hostId: string;
|
|
17332
|
+
projectId?: string;
|
|
17333
|
+
} | {
|
|
17334
|
+
environmentId?: never;
|
|
17335
|
+
hostId?: never;
|
|
17336
|
+
projectId?: string;
|
|
17337
|
+
}) & {
|
|
17311
17338
|
providerId?: string;
|
|
17312
17339
|
signal?: AbortSignal;
|
|
17313
17340
|
};
|
|
@@ -17711,6 +17738,10 @@ interface SystemAppUpdateArgs {
|
|
|
17711
17738
|
type SystemApplyAppUpdateArgs = SystemAppUpdateApplyRequest;
|
|
17712
17739
|
type SystemAcknowledgeAppUpdateArgs = SystemAppUpdateAcknowledgeRequest;
|
|
17713
17740
|
type SystemAppUpdateStatusResult = SystemAppUpdateStatus;
|
|
17741
|
+
interface SystemCliCommandArgs {
|
|
17742
|
+
signal?: AbortSignal;
|
|
17743
|
+
}
|
|
17744
|
+
type SystemCliCommandStatusResult = SystemCliCommandStatus;
|
|
17714
17745
|
interface SystemVoiceTranscriptionArgs {
|
|
17715
17746
|
file: Blob;
|
|
17716
17747
|
prompt?: string;
|
|
@@ -17798,6 +17829,9 @@ interface SystemArea {
|
|
|
17798
17829
|
appUpdate(args?: SystemAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
|
|
17799
17830
|
applyAppUpdate(args: SystemApplyAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
|
|
17800
17831
|
acknowledgeAppUpdate(args: SystemAcknowledgeAppUpdateArgs): Promise<SystemAppUpdateStatusResult>;
|
|
17832
|
+
experimental_cliCommand(args?: SystemCliCommandArgs): Promise<SystemCliCommandStatusResult>;
|
|
17833
|
+
experimental_installCliCommand(): Promise<SystemCliCommandStatusResult>;
|
|
17834
|
+
experimental_removeCliCommand(): Promise<SystemCliCommandStatusResult>;
|
|
17801
17835
|
}
|
|
17802
17836
|
|
|
17803
17837
|
interface TerminalThreadScope {
|
|
@@ -21678,7 +21678,64 @@ function rememberDeclaredSessionOptions(key, sessionSetup) {
|
|
|
21678
21678
|
function freshDeclaredSessionOptions(key) {
|
|
21679
21679
|
return cachedDeclaredSessionOptions?.key === key && Date.now() - cachedDeclaredSessionOptions.fetchedAt < SESSION_MODEL_DISCOVERY_TTL_MS ? cachedDeclaredSessionOptions.options : null;
|
|
21680
21680
|
}
|
|
21681
|
-
|
|
21681
|
+
var ACP_DISCOVERY_SESSION_DELETE_TIMEOUT_MS = 2e3;
|
|
21682
|
+
var ACP_DISCOVERY_SESSION_CLI_DELETE_TIMEOUT_MS = 15e3;
|
|
21683
|
+
function discoverySessionCliDeleteArgs(args) {
|
|
21684
|
+
if (args.dialectId !== "opencode" || args.agentArgs.at(-1) !== "acp" || !/^[A-Za-z0-9_-]+$/u.test(args.sessionId)) {
|
|
21685
|
+
return null;
|
|
21686
|
+
}
|
|
21687
|
+
return [...args.agentArgs.slice(0, -1), "session", "delete", args.sessionId];
|
|
21688
|
+
}
|
|
21689
|
+
async function endDiscoveryConnection(args) {
|
|
21690
|
+
const { connection, agent, session } = args;
|
|
21691
|
+
const agentDeletes = session?.capabilities.session.delete === true;
|
|
21692
|
+
if (session !== null && agentDeletes) {
|
|
21693
|
+
await connection.request({
|
|
21694
|
+
method: "session/delete",
|
|
21695
|
+
params: { sessionId: session.sessionId },
|
|
21696
|
+
resultSchema: z48.unknown(),
|
|
21697
|
+
timeoutMs: ACP_DISCOVERY_SESSION_DELETE_TIMEOUT_MS
|
|
21698
|
+
}).catch(() => void 0);
|
|
21699
|
+
}
|
|
21700
|
+
await connection.kill();
|
|
21701
|
+
if (session === null || agentDeletes) {
|
|
21702
|
+
return;
|
|
21703
|
+
}
|
|
21704
|
+
const cliArgs = discoverySessionCliDeleteArgs({
|
|
21705
|
+
dialectId: args.dialectId,
|
|
21706
|
+
agentArgs: agent.args,
|
|
21707
|
+
sessionId: session.sessionId
|
|
21708
|
+
});
|
|
21709
|
+
if (cliArgs === null) {
|
|
21710
|
+
return;
|
|
21711
|
+
}
|
|
21712
|
+
void execPortableFile(agent.command, cliArgs, {
|
|
21713
|
+
cwd: agent.cwd ?? process.cwd(),
|
|
21714
|
+
env: args.env,
|
|
21715
|
+
maxBuffer: 64 * 1024,
|
|
21716
|
+
timeout: ACP_DISCOVERY_SESSION_CLI_DELETE_TIMEOUT_MS
|
|
21717
|
+
}).catch(() => void 0);
|
|
21718
|
+
}
|
|
21719
|
+
async function resolveModelListWorkspace(cwd) {
|
|
21720
|
+
if (cwd === void 0) {
|
|
21721
|
+
return void 0;
|
|
21722
|
+
}
|
|
21723
|
+
const stats = await fs4.stat(cwd).catch(() => null);
|
|
21724
|
+
return stats?.isDirectory() === true ? cwd : void 0;
|
|
21725
|
+
}
|
|
21726
|
+
function inModelListWorkspace(params, workspace) {
|
|
21727
|
+
if (workspace === void 0) {
|
|
21728
|
+
return params;
|
|
21729
|
+
}
|
|
21730
|
+
const place = (command) => command.cwd === void 0 ? { ...command, cwd: workspace } : command;
|
|
21731
|
+
return {
|
|
21732
|
+
...params,
|
|
21733
|
+
...params.listCommand === void 0 ? {} : { listCommand: place(params.listCommand) },
|
|
21734
|
+
...params.agent === void 0 ? {} : { agent: place(params.agent) },
|
|
21735
|
+
...params.optionsAgent === void 0 ? {} : { optionsAgent: place(params.optionsAgent) }
|
|
21736
|
+
};
|
|
21737
|
+
}
|
|
21738
|
+
async function loadDeclaredSessionOptions(agent, parameterizedModelPicker, dialectId) {
|
|
21682
21739
|
const key = declaredSessionOptionsKey(agent, parameterizedModelPicker);
|
|
21683
21740
|
const cached = freshDeclaredSessionOptions(key);
|
|
21684
21741
|
if (cached !== null) {
|
|
@@ -21718,6 +21775,7 @@ async function loadDeclaredSessionOptions(agent, parameterizedModelPicker) {
|
|
|
21718
21775
|
);
|
|
21719
21776
|
}, MODEL_LIST_TIMEOUT_MS);
|
|
21720
21777
|
});
|
|
21778
|
+
let discoverySession = null;
|
|
21721
21779
|
try {
|
|
21722
21780
|
await Promise.race([
|
|
21723
21781
|
(async () => {
|
|
@@ -21730,11 +21788,15 @@ async function loadDeclaredSessionOptions(agent, parameterizedModelPicker) {
|
|
|
21730
21788
|
env: childEnv,
|
|
21731
21789
|
capabilities
|
|
21732
21790
|
});
|
|
21733
|
-
await connection.request({
|
|
21791
|
+
const newSession = await connection.request({
|
|
21734
21792
|
method: "session/new",
|
|
21735
21793
|
params: { cwd: agent.cwd ?? process.cwd(), mcpServers: [] },
|
|
21736
21794
|
resultSchema: z48.unknown()
|
|
21737
21795
|
});
|
|
21796
|
+
const sessionId = isJsonObject(newSession) ? newSession["sessionId"] : void 0;
|
|
21797
|
+
if (typeof sessionId === "string") {
|
|
21798
|
+
discoverySession = { capabilities, sessionId };
|
|
21799
|
+
}
|
|
21738
21800
|
})(),
|
|
21739
21801
|
timeoutReached
|
|
21740
21802
|
]);
|
|
@@ -21747,7 +21809,13 @@ async function loadDeclaredSessionOptions(agent, parameterizedModelPicker) {
|
|
|
21747
21809
|
if (timeout !== void 0) {
|
|
21748
21810
|
clearTimeout(timeout);
|
|
21749
21811
|
}
|
|
21750
|
-
await
|
|
21812
|
+
await endDiscoveryConnection({
|
|
21813
|
+
connection,
|
|
21814
|
+
agent,
|
|
21815
|
+
env: childEnv,
|
|
21816
|
+
dialectId,
|
|
21817
|
+
session: discoverySession
|
|
21818
|
+
});
|
|
21751
21819
|
}
|
|
21752
21820
|
return settleDeclaredSessionOptions(key);
|
|
21753
21821
|
}
|
|
@@ -21759,7 +21827,7 @@ function settleDeclaredSessionOptions(key) {
|
|
|
21759
21827
|
cachedDeclaredSessionOptions = { key, options: [], fetchedAt: Date.now() };
|
|
21760
21828
|
return [];
|
|
21761
21829
|
}
|
|
21762
|
-
async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds, parameterizedModelPicker) {
|
|
21830
|
+
async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds, parameterizedModelPicker, dialectId) {
|
|
21763
21831
|
const key = JSON.stringify({
|
|
21764
21832
|
agent,
|
|
21765
21833
|
reasoningProbePriorityModelIds,
|
|
@@ -21806,6 +21874,7 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
|
|
|
21806
21874
|
}, MODEL_LIST_TIMEOUT_MS);
|
|
21807
21875
|
});
|
|
21808
21876
|
let discoveredCapabilities = null;
|
|
21877
|
+
let discoverySession = null;
|
|
21809
21878
|
try {
|
|
21810
21879
|
const newSession = await Promise.race([
|
|
21811
21880
|
(async () => {
|
|
@@ -21819,11 +21888,13 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
|
|
|
21819
21888
|
env: childEnv,
|
|
21820
21889
|
capabilities
|
|
21821
21890
|
});
|
|
21822
|
-
|
|
21891
|
+
const created = await connection.request({
|
|
21823
21892
|
method: "session/new",
|
|
21824
21893
|
params: { cwd: agent.cwd ?? process.cwd(), mcpServers: [] },
|
|
21825
21894
|
resultSchema: acpSessionNewResultSchema
|
|
21826
21895
|
});
|
|
21896
|
+
discoverySession = { capabilities, sessionId: created.sessionId };
|
|
21897
|
+
return created;
|
|
21827
21898
|
})(),
|
|
21828
21899
|
timeoutReached
|
|
21829
21900
|
]);
|
|
@@ -21875,7 +21946,13 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
|
|
|
21875
21946
|
if (timeout !== void 0) {
|
|
21876
21947
|
clearTimeout(timeout);
|
|
21877
21948
|
}
|
|
21878
|
-
await
|
|
21949
|
+
await endDiscoveryConnection({
|
|
21950
|
+
connection,
|
|
21951
|
+
agent,
|
|
21952
|
+
env: childEnv,
|
|
21953
|
+
dialectId,
|
|
21954
|
+
session: discoverySession
|
|
21955
|
+
});
|
|
21879
21956
|
settleDeclaredSessionOptions(
|
|
21880
21957
|
declaredSessionOptionsKey(agent, parameterizedModelPicker)
|
|
21881
21958
|
);
|
|
@@ -23570,9 +23647,14 @@ function decodeAcpBridgeJsonRpcRequest(raw) {
|
|
|
23570
23647
|
};
|
|
23571
23648
|
}
|
|
23572
23649
|
async function handleModelList(id, params, dialectId) {
|
|
23650
|
+
const resolvedDialectId = resolveAcpDialect({
|
|
23651
|
+
dialectId,
|
|
23652
|
+
command: params.optionsAgent?.command ?? params.agent?.command ?? ""
|
|
23653
|
+
}).id;
|
|
23573
23654
|
const declaredOptions = () => params.optionsAgent ? loadDeclaredSessionOptions(
|
|
23574
23655
|
params.optionsAgent,
|
|
23575
|
-
params.parameterizedModelPicker
|
|
23656
|
+
params.parameterizedModelPicker,
|
|
23657
|
+
resolvedDialectId
|
|
23576
23658
|
) : Promise.resolve([]);
|
|
23577
23659
|
function withDeclaredOptions(models, options) {
|
|
23578
23660
|
return options.length === 0 ? [...models] : models.map((model) => ({ ...model, sessionOptions: [...options] }));
|
|
@@ -23602,7 +23684,8 @@ async function handleModelList(id, params, dialectId) {
|
|
|
23602
23684
|
const sessionDiscoveredModels = params.listCommand === void 0 && params.agent ? await loadSessionDiscoveredModels(
|
|
23603
23685
|
params.agent,
|
|
23604
23686
|
params.reasoningProbePriorityModelIds,
|
|
23605
|
-
params.parameterizedModelPicker
|
|
23687
|
+
params.parameterizedModelPicker,
|
|
23688
|
+
resolvedDialectId
|
|
23606
23689
|
) : null;
|
|
23607
23690
|
if (sessionDiscoveredModels) {
|
|
23608
23691
|
await sendModels(sessionDiscoveredModels);
|
|
@@ -23689,9 +23772,12 @@ async function handleRequest2(request) {
|
|
|
23689
23772
|
);
|
|
23690
23773
|
await handleModelList(
|
|
23691
23774
|
request.id,
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
|
|
23775
|
+
inModelListWorkspace(
|
|
23776
|
+
buildAcpModelListParams(
|
|
23777
|
+
decodeLaunchSpec(request.params.providerOptions),
|
|
23778
|
+
modelPicker
|
|
23779
|
+
),
|
|
23780
|
+
await resolveModelListWorkspace(request.params.cwd)
|
|
23695
23781
|
),
|
|
23696
23782
|
decodeDialectId(request.params.providerOptions)
|
|
23697
23783
|
);
|
|
@@ -15965,6 +15965,22 @@ async function revokeCursorSessionMcpServer(approval) {
|
|
|
15965
15965
|
|
|
15966
15966
|
// ../provider-bridge-acp/src/bridge/bridge.ts
|
|
15967
15967
|
var sessionsByBbThreadId = /* @__PURE__ */ new Map();
|
|
15968
|
+
var agentConnections = /* @__PURE__ */ new Set();
|
|
15969
|
+
var shuttingDown = false;
|
|
15970
|
+
function createBridgeAgentConnection(options) {
|
|
15971
|
+
if (shuttingDown) {
|
|
15972
|
+
throw new Error("ACP bridge is shutting down");
|
|
15973
|
+
}
|
|
15974
|
+
const connection = createAcpAgentConnection({
|
|
15975
|
+
...options,
|
|
15976
|
+
onExit: (info) => {
|
|
15977
|
+
agentConnections.delete(connection);
|
|
15978
|
+
options.onExit(info);
|
|
15979
|
+
}
|
|
15980
|
+
});
|
|
15981
|
+
agentConnections.add(connection);
|
|
15982
|
+
return connection;
|
|
15983
|
+
}
|
|
15968
15984
|
var bbThreadIdByProviderThreadId = /* @__PURE__ */ new Map();
|
|
15969
15985
|
var pendingRuntimeRequests = /* @__PURE__ */ new Map();
|
|
15970
15986
|
var runtimeRequestIdCounter = 0;
|
|
@@ -16412,7 +16428,7 @@ async function loadSessionDiscoveredModels(agent, reasoningProbePriorityModelIds
|
|
|
16412
16428
|
...withoutBridgeRuntimeEnv(process.env),
|
|
16413
16429
|
...agent.envVars ?? {}
|
|
16414
16430
|
};
|
|
16415
|
-
const connection =
|
|
16431
|
+
const connection = createBridgeAgentConnection({
|
|
16416
16432
|
command: agent.command,
|
|
16417
16433
|
args: agent.args,
|
|
16418
16434
|
cwd: agent.cwd ?? process.cwd(),
|
|
@@ -17105,7 +17121,7 @@ async function startAgentSession(request) {
|
|
|
17105
17121
|
...params.envVars,
|
|
17106
17122
|
...dialect.id === "opencode" ? { OPENCODE_CLIENT: "acp", OPENCODE_ENABLE_QUESTION_TOOL: "false" } : {}
|
|
17107
17123
|
};
|
|
17108
|
-
const connection =
|
|
17124
|
+
const connection = createBridgeAgentConnection({
|
|
17109
17125
|
command: params.agent.command,
|
|
17110
17126
|
args: launch.args,
|
|
17111
17127
|
cwd: params.cwd,
|
|
@@ -18111,11 +18127,21 @@ function handleParsedMessage(parsed) {
|
|
|
18111
18127
|
}
|
|
18112
18128
|
var handleLine = createBridgeLineHandler({ handleParsedMessage });
|
|
18113
18129
|
async function stopAllSessions() {
|
|
18114
|
-
await Promise.
|
|
18115
|
-
Array.from(
|
|
18116
|
-
(
|
|
18117
|
-
|
|
18118
|
-
|
|
18130
|
+
const results = await Promise.allSettled([
|
|
18131
|
+
...Array.from(
|
|
18132
|
+
sessionsByBbThreadId.values(),
|
|
18133
|
+
(session) => releaseSession(session)
|
|
18134
|
+
),
|
|
18135
|
+
...Array.from(agentConnections, (connection) => connection.kill())
|
|
18136
|
+
]);
|
|
18137
|
+
for (const result of results) {
|
|
18138
|
+
if (result.status === "rejected") {
|
|
18139
|
+
process.stderr.write(
|
|
18140
|
+
`acp bridge: shutdown cleanup failed: ${String(result.reason)}
|
|
18141
|
+
`
|
|
18142
|
+
);
|
|
18143
|
+
}
|
|
18144
|
+
}
|
|
18119
18145
|
const dynamicToolBridge = dynamicToolBridgePromise ? await dynamicToolBridgePromise.catch(() => null) : null;
|
|
18120
18146
|
await new Promise((resolveClose) => {
|
|
18121
18147
|
if (!dynamicToolBridge) {
|
|
@@ -18125,16 +18151,22 @@ async function stopAllSessions() {
|
|
|
18125
18151
|
dynamicToolBridge.server.close(() => resolveClose());
|
|
18126
18152
|
});
|
|
18127
18153
|
}
|
|
18154
|
+
function shutdownBridge() {
|
|
18155
|
+
if (shuttingDown) return;
|
|
18156
|
+
shuttingDown = true;
|
|
18157
|
+
void stopAllSessions().catch((error) => {
|
|
18158
|
+
process.stderr.write(`acp bridge: shutdown failed: ${String(error)}
|
|
18159
|
+
`);
|
|
18160
|
+
}).finally(() => process.exit(0));
|
|
18161
|
+
}
|
|
18128
18162
|
if (process.argv.includes("--mcp-stdio")) {
|
|
18129
18163
|
runAcpDynamicToolMcpServer();
|
|
18130
18164
|
}
|
|
18131
18165
|
var experimental_providerBridge = experimental_defineProviderBridge({
|
|
18132
18166
|
handleLine,
|
|
18133
|
-
onClose:
|
|
18134
|
-
|
|
18135
|
-
|
|
18136
|
-
});
|
|
18137
|
-
}
|
|
18167
|
+
onClose: shutdownBridge,
|
|
18168
|
+
onSigterm: shutdownBridge,
|
|
18169
|
+
onSigint: shutdownBridge
|
|
18138
18170
|
});
|
|
18139
18171
|
|
|
18140
18172
|
// ../provider-bridge-acp/src/probe.ts
|