@ai-sdk/harness-acp 1.0.31 → 1.0.33
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/CHANGELOG.md +20 -0
- package/README.md +10 -9
- package/dist/bridge/host-tool-mcp.mjs +1 -1
- package/dist/bridge/index.mjs +59 -24
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/index.d.ts +13 -17
- package/dist/index.js +86 -75
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/acp-harness.ts +8 -3
- package/src/index.ts +1 -2
- package/src/v1/{acp-bootstrap.ts → acp-v1-bootstrap.ts} +12 -20
- package/src/v1/acp-v1-bridge-protocol.ts +27 -6
- package/src/v1/acp-v1-harness.ts +41 -49
- package/src/v1/acp-v1-settings.ts +12 -16
- package/src/v1/acp-v1-turn-start-config.ts +7 -3
- package/src/v1/bridge/acp-v1-bridge-environment.ts +4 -8
- package/src/v1/bridge/index.ts +10 -2
- package/src/v1/bridge/model-mapping.ts +35 -0
- package/src/v1/bridge/protocol-configuration.ts +6 -2
- package/src/v1/implementation.ts +8 -0
- package/src/v1/index.ts +1 -2
- package/src/acp-bridge-protocol.ts +0 -13
package/dist/index.d.ts
CHANGED
|
@@ -145,19 +145,13 @@ type ACPProviderAuthentication = {
|
|
|
145
145
|
readonly env: Readonly<Record<string, ACPProfileValue>>;
|
|
146
146
|
};
|
|
147
147
|
};
|
|
148
|
-
type
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
readonly
|
|
153
|
-
|
|
154
|
-
* Overlays the implementation's static launch environment.
|
|
155
|
-
*/
|
|
156
|
-
readonly env?: Readonly<Record<string, string>>;
|
|
148
|
+
type ACPModelMapping = {
|
|
149
|
+
readonly type: 'session-config-option';
|
|
150
|
+
readonly path: string;
|
|
151
|
+
} | {
|
|
152
|
+
readonly type: 'session-model';
|
|
153
|
+
readonly path: string;
|
|
157
154
|
};
|
|
158
|
-
type ACPModelResolver = (options: {
|
|
159
|
-
readonly model: string;
|
|
160
|
-
}) => ACPModelResolution;
|
|
161
155
|
type ACPCredentialBrokering = ({ env, sandboxEnv, }: {
|
|
162
156
|
env: Readonly<Record<string, string>>;
|
|
163
157
|
sandboxEnv?: Readonly<Record<string, string>>;
|
|
@@ -212,11 +206,12 @@ type ACPV1Settings = {
|
|
|
212
206
|
*/
|
|
213
207
|
readonly env?: Readonly<Record<string, string>>;
|
|
214
208
|
readonly authentication?: ACPAuthentication;
|
|
209
|
+
readonly clientCapabilities?: Readonly<Record<string, ACPSerializableValue>>;
|
|
215
210
|
readonly providerAuthentication?: ACPProviderAuthentication;
|
|
216
211
|
/**
|
|
217
|
-
* Maps
|
|
212
|
+
* Maps the HarnessAgent model identifier to an ACP session operation.
|
|
218
213
|
*/
|
|
219
|
-
readonly
|
|
214
|
+
readonly modelMapping: ACPModelMapping;
|
|
220
215
|
/**
|
|
221
216
|
* @deprecated Use `model` on `HarnessAgent` instead.
|
|
222
217
|
*/
|
|
@@ -287,11 +282,12 @@ type ACPHarnessSettings<TBuiltinTools extends ToolSet = {}> = {
|
|
|
287
282
|
readonly credentialForwarding?: ACPV1Settings['credentialForwarding'];
|
|
288
283
|
readonly env?: ACPV1Settings['env'];
|
|
289
284
|
readonly authentication?: ACPV1Settings['authentication'];
|
|
285
|
+
readonly clientCapabilities?: ACPV1Settings['clientCapabilities'];
|
|
290
286
|
readonly providerAuthentication?: ACPV1Settings['providerAuthentication'];
|
|
291
287
|
/**
|
|
292
|
-
* Maps
|
|
288
|
+
* Maps the HarnessAgent model identifier to an ACP session operation.
|
|
293
289
|
*/
|
|
294
|
-
readonly
|
|
290
|
+
readonly modelMapping: ACPV1Settings['modelMapping'];
|
|
295
291
|
/**
|
|
296
292
|
* @deprecated Use `model` on `HarnessAgent` instead.
|
|
297
293
|
*/
|
|
@@ -307,4 +303,4 @@ declare function createACP<TBuiltinTools extends ToolSet = {}>(settings: ACPHarn
|
|
|
307
303
|
|
|
308
304
|
declare const VERSION: string;
|
|
309
305
|
|
|
310
|
-
export { type ACPAnnotations, type ACPAudioContent, type ACPAuthentication, type ACPAuthenticationMode, type ACPBlobResourceContents, type ACPClientApp, type ACPContentBlock, type ACPCredentialBrokering, type ACPEmbeddedResource, type ACPHarnessSettings, type ACPImageContent, type ACPInstallCommandSource, type ACPInstructionMapping, type ACPMetadata, type
|
|
306
|
+
export { type ACPAnnotations, type ACPAudioContent, type ACPAuthentication, type ACPAuthenticationMode, type ACPBlobResourceContents, type ACPClientApp, type ACPContentBlock, type ACPCredentialBrokering, type ACPEmbeddedResource, type ACPHarnessSettings, type ACPImageContent, type ACPInstallCommandSource, type ACPInstructionMapping, type ACPMetadata, type ACPModelMapping, type ACPNpmLockedSource, type ACPNpmSimpleSource, type ACPOutputSchemaMapping, type ACPPermissionModeMapping, type ACPPermissionModeTarget, type ACPProfileValue, type ACPProviderAuthentication, type ACPResourceLink, type ACPRole, type ACPSerializablePrimitive, type ACPSerializableValue, type ACPSource, type ACPTextContent, type ACPTextResourceContents, type ACPToolCall, type ACPToolCallContent, type ACPToolCallLocation, type ACPToolCallStatus, type ACPToolKind, type ACPV1Settings, type ACPValueSource, VERSION, createACP };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { z as z4 } from "zod/v4";
|
|
3
3
|
|
|
4
4
|
// src/v1/acp-v1-harness.ts
|
|
5
|
-
import { createHash as createHash5
|
|
5
|
+
import { createHash as createHash5 } from "crypto";
|
|
6
6
|
import { posix } from "path";
|
|
7
7
|
import {
|
|
8
8
|
HarnessCapabilityUnsupportedError as HarnessCapabilityUnsupportedError2,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { HarnessBridgeCapabilityUnsupportedError } from "@ai-sdk/harness/bridge";
|
|
12
12
|
import {
|
|
13
13
|
applyCredentialForwarding,
|
|
14
|
+
createBridgeToken,
|
|
14
15
|
createBridgeErrorHandler,
|
|
15
16
|
createBridgeStartupError,
|
|
16
17
|
createSandboxCredentialEnvironment,
|
|
@@ -24,7 +25,8 @@ import {
|
|
|
24
25
|
SandboxChannel,
|
|
25
26
|
shellQuote,
|
|
26
27
|
warnCredentialBrokeringUnavailable,
|
|
27
|
-
waitForBridgeReady
|
|
28
|
+
waitForBridgeReady,
|
|
29
|
+
withBridgeToken
|
|
28
30
|
} from "@ai-sdk/harness/utils";
|
|
29
31
|
import {
|
|
30
32
|
asSchema
|
|
@@ -311,6 +313,8 @@ function createImplementationIdentity({
|
|
|
311
313
|
acpVersion,
|
|
312
314
|
implementation,
|
|
313
315
|
clientApp,
|
|
316
|
+
clientCapabilities,
|
|
317
|
+
modelMapping,
|
|
314
318
|
providerAuthentication,
|
|
315
319
|
permissionModeMapping
|
|
316
320
|
}) {
|
|
@@ -344,6 +348,8 @@ function createImplementationIdentity({
|
|
|
344
348
|
executable: implementation.executable,
|
|
345
349
|
args: implementation.args ?? [],
|
|
346
350
|
clientApp,
|
|
351
|
+
clientCapabilities: clientCapabilities ?? null,
|
|
352
|
+
modelMapping,
|
|
347
353
|
environment: {
|
|
348
354
|
forwarded: forwardedEnvironment,
|
|
349
355
|
credential: credentialEnvironment,
|
|
@@ -470,7 +476,7 @@ function sortValue({ value }) {
|
|
|
470
476
|
return value;
|
|
471
477
|
}
|
|
472
478
|
|
|
473
|
-
// src/v1/acp-bootstrap.ts
|
|
479
|
+
// src/v1/acp-v1-bootstrap.ts
|
|
474
480
|
import { readFile } from "fs/promises";
|
|
475
481
|
import { fileURLToPath } from "url";
|
|
476
482
|
function createACPBootstrap({
|
|
@@ -565,29 +571,21 @@ function createACPBootstrap({
|
|
|
565
571
|
};
|
|
566
572
|
}
|
|
567
573
|
async function readBridgeAsset({ name }) {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
if (error.code !== "ENOENT") throw error;
|
|
578
|
-
lastError = error;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
throw lastError ?? new Error(`ACP bridge asset not found: ${name}`);
|
|
574
|
+
return readFile(
|
|
575
|
+
fileURLToPath(
|
|
576
|
+
resolveBridgeAssetUrl({
|
|
577
|
+
name,
|
|
578
|
+
moduleUrl: import.meta.url
|
|
579
|
+
})
|
|
580
|
+
),
|
|
581
|
+
"utf8"
|
|
582
|
+
);
|
|
582
583
|
}
|
|
583
|
-
function
|
|
584
|
+
function resolveBridgeAssetUrl({
|
|
584
585
|
name,
|
|
585
586
|
moduleUrl
|
|
586
587
|
}) {
|
|
587
|
-
return
|
|
588
|
-
new URL(`./bridge/${name}`, moduleUrl),
|
|
589
|
-
new URL(`../bridge/${name}`, moduleUrl)
|
|
590
|
-
];
|
|
588
|
+
return new URL(`./bridge/${name}`, moduleUrl);
|
|
591
589
|
}
|
|
592
590
|
|
|
593
591
|
// src/v1/acp-v1-bridge-protocol.ts
|
|
@@ -729,6 +727,19 @@ var outputSchemaMappingSchema = z2.object({
|
|
|
729
727
|
type: z2.literal("session-prompt-meta"),
|
|
730
728
|
path: z2.array(z2.string().min(1)).min(1)
|
|
731
729
|
});
|
|
730
|
+
var modelMappingSchema = z2.discriminatedUnion(
|
|
731
|
+
"type",
|
|
732
|
+
[
|
|
733
|
+
z2.object({
|
|
734
|
+
type: z2.literal("session-config-option"),
|
|
735
|
+
path: z2.string().min(1)
|
|
736
|
+
}),
|
|
737
|
+
z2.object({
|
|
738
|
+
type: z2.literal("session-model"),
|
|
739
|
+
path: z2.string().min(1)
|
|
740
|
+
})
|
|
741
|
+
]
|
|
742
|
+
);
|
|
732
743
|
var acpTurnStartConfigSchema = z2.object({
|
|
733
744
|
version: z2.literal(1),
|
|
734
745
|
configurationFingerprint: z2.string(),
|
|
@@ -737,12 +748,17 @@ var acpTurnStartConfigSchema = z2.object({
|
|
|
737
748
|
builtinTools: z2.array(builtinToolSchema).default([]),
|
|
738
749
|
permissionMode: harnessV1BridgeStartBaseSchema.shape.permissionMode.unwrap(),
|
|
739
750
|
permissionModeMapping: permissionModeMappingSchema.optional(),
|
|
751
|
+
model: harnessV1BridgeStartBaseSchema.shape.model.optional(),
|
|
752
|
+
modelMapping: modelMappingSchema.optional(),
|
|
740
753
|
debug: harnessV1BridgeStartBaseSchema.shape.debug.optional(),
|
|
741
754
|
responseFormat: harnessV1BridgeStartBaseSchema.shape.responseFormat.optional(),
|
|
742
755
|
outputSchemaMapping: outputSchemaMappingSchema.optional()
|
|
743
756
|
});
|
|
744
|
-
var acpColdSessionStateSchema = acpTurnStartConfigSchema.omit({
|
|
745
|
-
|
|
757
|
+
var acpColdSessionStateSchema = acpTurnStartConfigSchema.omit({
|
|
758
|
+
prompt: true,
|
|
759
|
+
debug: true,
|
|
760
|
+
model: true,
|
|
761
|
+
modelMapping: true
|
|
746
762
|
});
|
|
747
763
|
var lossyRecoverySchema = z2.object({
|
|
748
764
|
type: z2.literal("lossy-rerun"),
|
|
@@ -772,6 +788,7 @@ var startMessageSchema = harnessV1BridgeStartBaseSchema.extend({
|
|
|
772
788
|
tools: z2.array(acpSerializableToolSpecSchema).optional(),
|
|
773
789
|
builtinTools: z2.array(builtinToolSchema).readonly().default([]),
|
|
774
790
|
permissionModeMapping: permissionModeMappingSchema.optional(),
|
|
791
|
+
modelMapping: modelMappingSchema.optional(),
|
|
775
792
|
turnStartConfig: acpTurnStartConfigSchema,
|
|
776
793
|
recoveryMode: z2.discriminatedUnion("type", [lossyRecoverySchema, coldRestoreSchema]).optional()
|
|
777
794
|
});
|
|
@@ -826,16 +843,14 @@ var bridgeConfigurationSchema = z3.object({
|
|
|
826
843
|
providerAuthentication: providerAuthenticationSchema.optional(),
|
|
827
844
|
providerEnvironment: z3.record(z3.string(), z3.string()).optional(),
|
|
828
845
|
sessionMeta: serializableRecordSchema.optional(),
|
|
829
|
-
|
|
830
|
-
implementationEnv: z3.record(z3.string(), z3.string()).optional()
|
|
846
|
+
clientCapabilities: serializableRecordSchema.optional()
|
|
831
847
|
});
|
|
832
848
|
function createACPBridgeEnvironment({
|
|
833
849
|
authentication,
|
|
834
850
|
providerAuthentication,
|
|
835
851
|
providerEnvironment,
|
|
836
852
|
sessionMeta,
|
|
837
|
-
|
|
838
|
-
implementationEnv
|
|
853
|
+
clientCapabilities
|
|
839
854
|
}) {
|
|
840
855
|
return {
|
|
841
856
|
[ACP_BRIDGE_CONFIGURATION_ENV]: JSON.stringify({
|
|
@@ -843,8 +858,7 @@ function createACPBridgeEnvironment({
|
|
|
843
858
|
...providerAuthentication == null ? {} : { providerAuthentication },
|
|
844
859
|
...providerEnvironment == null ? {} : { providerEnvironment },
|
|
845
860
|
...sessionMeta == null ? {} : { sessionMeta },
|
|
846
|
-
...
|
|
847
|
-
...implementationEnv == null ? {} : { implementationEnv }
|
|
861
|
+
...clientCapabilities == null ? {} : { clientCapabilities }
|
|
848
862
|
})
|
|
849
863
|
};
|
|
850
864
|
}
|
|
@@ -958,7 +972,9 @@ function createACPTurnStartConfig({
|
|
|
958
972
|
sessionMeta,
|
|
959
973
|
instructionMapping,
|
|
960
974
|
responseFormat,
|
|
961
|
-
outputSchemaMapping
|
|
975
|
+
outputSchemaMapping,
|
|
976
|
+
model,
|
|
977
|
+
modelMapping
|
|
962
978
|
}) {
|
|
963
979
|
return {
|
|
964
980
|
version: 1,
|
|
@@ -968,6 +984,7 @@ function createACPTurnStartConfig({
|
|
|
968
984
|
sessionMeta: sessionMeta ?? null,
|
|
969
985
|
...instructionMapping == null ? {} : { instructionMapping },
|
|
970
986
|
...outputSchemaMapping == null ? {} : { outputSchemaMapping },
|
|
987
|
+
modelMapping,
|
|
971
988
|
builtinTools,
|
|
972
989
|
permissionModeMapping: permissionModeMapping ?? null,
|
|
973
990
|
mcpServers: mcpServers ?? null
|
|
@@ -977,6 +994,7 @@ function createACPTurnStartConfig({
|
|
|
977
994
|
tools: tools.map((tool) => acpSerializableToolSpecSchema.parse(tool)),
|
|
978
995
|
builtinTools: [...builtinTools],
|
|
979
996
|
permissionMode,
|
|
997
|
+
...model == null ? {} : { model, modelMapping },
|
|
980
998
|
...responseFormat == null ? {} : { responseFormat },
|
|
981
999
|
...outputSchemaMapping == null ? {} : {
|
|
982
1000
|
outputSchemaMapping: {
|
|
@@ -989,8 +1007,7 @@ function createACPTurnStartConfig({
|
|
|
989
1007
|
};
|
|
990
1008
|
}
|
|
991
1009
|
function createACPColdSessionState({
|
|
992
|
-
turnStartConfig
|
|
993
|
-
modelId
|
|
1010
|
+
turnStartConfig
|
|
994
1011
|
}) {
|
|
995
1012
|
return {
|
|
996
1013
|
version: turnStartConfig.version,
|
|
@@ -1000,8 +1017,7 @@ function createACPColdSessionState({
|
|
|
1000
1017
|
permissionMode: turnStartConfig.permissionMode,
|
|
1001
1018
|
...turnStartConfig.responseFormat == null ? {} : { responseFormat: turnStartConfig.responseFormat },
|
|
1002
1019
|
...turnStartConfig.outputSchemaMapping == null ? {} : { outputSchemaMapping: turnStartConfig.outputSchemaMapping },
|
|
1003
|
-
...turnStartConfig.permissionModeMapping == null ? {} : { permissionModeMapping: turnStartConfig.permissionModeMapping }
|
|
1004
|
-
...modelId == null ? {} : { modelId }
|
|
1020
|
+
...turnStartConfig.permissionModeMapping == null ? {} : { permissionModeMapping: turnStartConfig.permissionModeMapping }
|
|
1005
1021
|
};
|
|
1006
1022
|
}
|
|
1007
1023
|
function stableStringify3(value) {
|
|
@@ -1222,11 +1238,11 @@ function createACPV1({
|
|
|
1222
1238
|
`ACP harnessId must be a stable kebab-case identifier; received ${JSON.stringify(settings.harnessId)}.`
|
|
1223
1239
|
);
|
|
1224
1240
|
}
|
|
1225
|
-
const
|
|
1226
|
-
validateACPV1Implementation(
|
|
1241
|
+
const implementation = createACPV1Implementation({ settings });
|
|
1242
|
+
validateACPV1Implementation(implementation);
|
|
1227
1243
|
const bootstrap = createACPBootstrap({
|
|
1228
1244
|
harnessId: settings.harnessId,
|
|
1229
|
-
implementation
|
|
1245
|
+
implementation
|
|
1230
1246
|
});
|
|
1231
1247
|
const permissionModeMapping = isCompletePermissionModeMapping({
|
|
1232
1248
|
value: settings.permissionModeMapping
|
|
@@ -1246,19 +1262,6 @@ function createACPV1({
|
|
|
1246
1262
|
message: "ACP built-in tool filtering is not available in this initial ACP v1 implementation."
|
|
1247
1263
|
});
|
|
1248
1264
|
}
|
|
1249
|
-
const modelId = startOptions.model ?? settings.modelId;
|
|
1250
|
-
const modelConfiguration = modelId == null ? void 0 : settings.resolveModel({ model: modelId });
|
|
1251
|
-
const implementation = {
|
|
1252
|
-
...baseImplementation,
|
|
1253
|
-
...modelConfiguration?.args == null ? {} : { args: modelConfiguration.args },
|
|
1254
|
-
...modelConfiguration?.env == null ? {} : {
|
|
1255
|
-
env: {
|
|
1256
|
-
...baseImplementation.env,
|
|
1257
|
-
...modelConfiguration.env
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
};
|
|
1261
|
-
validateACPV1Implementation(implementation);
|
|
1262
1265
|
const permissionMode = startOptions.permissionMode ?? "allow-all";
|
|
1263
1266
|
const env = { ...process.env };
|
|
1264
1267
|
const authenticationEnvironment = resolveACPAuthenticationEnvironment({
|
|
@@ -1275,6 +1278,8 @@ function createACPV1({
|
|
|
1275
1278
|
acpVersion: "v1",
|
|
1276
1279
|
implementation,
|
|
1277
1280
|
clientApp,
|
|
1281
|
+
clientCapabilities: settings.clientCapabilities,
|
|
1282
|
+
modelMapping: settings.modelMapping,
|
|
1278
1283
|
providerAuthentication: providerAuthenticationCompatibility,
|
|
1279
1284
|
permissionModeMapping: settings.permissionModeMapping
|
|
1280
1285
|
});
|
|
@@ -1468,7 +1473,8 @@ function createACPV1({
|
|
|
1468
1473
|
harnessId: settings.harnessId,
|
|
1469
1474
|
channel: attachChannel,
|
|
1470
1475
|
proc: void 0,
|
|
1471
|
-
|
|
1476
|
+
modelMapping: settings.modelMapping,
|
|
1477
|
+
defaultModelId: settings.modelId,
|
|
1472
1478
|
sessionMeta: settings.session?.meta,
|
|
1473
1479
|
instructionMapping: settings.instructionMapping,
|
|
1474
1480
|
outputSchemaMapping: settings.outputSchemaMapping,
|
|
@@ -1533,6 +1539,7 @@ function createACPV1({
|
|
|
1533
1539
|
sessionMeta: settings.session?.meta,
|
|
1534
1540
|
instructionMapping: settings.instructionMapping,
|
|
1535
1541
|
outputSchemaMapping: settings.outputSchemaMapping,
|
|
1542
|
+
modelMapping: settings.modelMapping,
|
|
1536
1543
|
builtinTools: builtinToolCatalog,
|
|
1537
1544
|
permissionModeMapping,
|
|
1538
1545
|
mcpServers: settings.mcpServers
|
|
@@ -1558,12 +1565,12 @@ function createACPV1({
|
|
|
1558
1565
|
}
|
|
1559
1566
|
const turnStartConfig = validateACPColdSessionConfiguration({
|
|
1560
1567
|
coldSession,
|
|
1561
|
-
modelId,
|
|
1562
1568
|
permissionMode,
|
|
1563
1569
|
authenticationProfile,
|
|
1564
1570
|
sessionMeta: settings.session?.meta,
|
|
1565
1571
|
instructionMapping: settings.instructionMapping,
|
|
1566
1572
|
outputSchemaMapping: settings.outputSchemaMapping,
|
|
1573
|
+
modelMapping: settings.modelMapping,
|
|
1567
1574
|
builtinTools: builtinToolCatalog,
|
|
1568
1575
|
permissionModeMapping,
|
|
1569
1576
|
mcpServers: settings.mcpServers,
|
|
@@ -1586,7 +1593,7 @@ function createACPV1({
|
|
|
1586
1593
|
override: portOverride,
|
|
1587
1594
|
harnessId: settings.harnessId
|
|
1588
1595
|
});
|
|
1589
|
-
const token = settings.mintBridgeToken == null ?
|
|
1596
|
+
const token = settings.mintBridgeToken == null ? createBridgeToken() : settings.mintBridgeToken(sandboxId);
|
|
1590
1597
|
await toolSafeSandboxSession.run({
|
|
1591
1598
|
command: `mkdir -p ${shellQuote(workDir)} ${shellQuote(bridgeStateDir)}`,
|
|
1592
1599
|
abortSignal: startOptions.abortSignal
|
|
@@ -1606,8 +1613,7 @@ function createACPV1({
|
|
|
1606
1613
|
providerAuthentication: resolvedProviderAuthentication.providerAuthentication,
|
|
1607
1614
|
providerEnvironment: sandboxProviderEnvironment == null ? void 0 : {},
|
|
1608
1615
|
sessionMeta: settings.session?.meta,
|
|
1609
|
-
|
|
1610
|
-
implementationEnv: modelConfiguration?.env
|
|
1616
|
+
clientCapabilities: settings.clientCapabilities
|
|
1611
1617
|
}),
|
|
1612
1618
|
...sandboxProviderAuthenticationEnvironment,
|
|
1613
1619
|
BRIDGE_CHANNEL_TOKEN: token,
|
|
@@ -1710,7 +1716,8 @@ function createACPV1({
|
|
|
1710
1716
|
harnessId: settings.harnessId,
|
|
1711
1717
|
channel,
|
|
1712
1718
|
proc,
|
|
1713
|
-
|
|
1719
|
+
modelMapping: settings.modelMapping,
|
|
1720
|
+
defaultModelId: settings.modelId,
|
|
1714
1721
|
sessionMeta: settings.session?.meta,
|
|
1715
1722
|
instructionMapping: settings.instructionMapping,
|
|
1716
1723
|
outputSchemaMapping: settings.outputSchemaMapping,
|
|
@@ -1872,14 +1879,6 @@ function openWebSocket({
|
|
|
1872
1879
|
ws.once("error", onError);
|
|
1873
1880
|
});
|
|
1874
1881
|
}
|
|
1875
|
-
function withBridgeToken({
|
|
1876
|
-
endpoint,
|
|
1877
|
-
token
|
|
1878
|
-
}) {
|
|
1879
|
-
const bridgeUrl = new URL(endpoint.url);
|
|
1880
|
-
bridgeUrl.searchParams.set("agent_bridge_token", token);
|
|
1881
|
-
return { ...endpoint, url: bridgeUrl.toString() };
|
|
1882
|
-
}
|
|
1883
1882
|
function restoreColdACPSession({
|
|
1884
1883
|
channel,
|
|
1885
1884
|
harnessId,
|
|
@@ -1954,7 +1953,8 @@ function createSession({
|
|
|
1954
1953
|
harnessId,
|
|
1955
1954
|
channel,
|
|
1956
1955
|
proc,
|
|
1957
|
-
|
|
1956
|
+
modelMapping,
|
|
1957
|
+
defaultModelId,
|
|
1958
1958
|
sessionMeta,
|
|
1959
1959
|
instructionMapping,
|
|
1960
1960
|
outputSchemaMapping,
|
|
@@ -2223,8 +2223,7 @@ function createSession({
|
|
|
2223
2223
|
...bridge == null ? {} : { bridge },
|
|
2224
2224
|
...latestTurnStartConfig == null ? {} : {
|
|
2225
2225
|
coldSession: createACPColdSessionState({
|
|
2226
|
-
turnStartConfig: latestTurnStartConfig
|
|
2227
|
-
modelId
|
|
2226
|
+
turnStartConfig: latestTurnStartConfig
|
|
2228
2227
|
})
|
|
2229
2228
|
},
|
|
2230
2229
|
...!includeTurnStartConfig || latestTurnStartConfig == null ? {} : { turnStartConfig: latestTurnStartConfig },
|
|
@@ -2249,7 +2248,6 @@ function createSession({
|
|
|
2249
2248
|
return {
|
|
2250
2249
|
sessionId,
|
|
2251
2250
|
isResume,
|
|
2252
|
-
...modelId == null ? {} : { modelId },
|
|
2253
2251
|
doPromptTurn: async (options) => {
|
|
2254
2252
|
await synchronizeSkills({
|
|
2255
2253
|
skills: options.skills,
|
|
@@ -2281,6 +2279,7 @@ function createSession({
|
|
|
2281
2279
|
prompt: options.prompt,
|
|
2282
2280
|
harnessId
|
|
2283
2281
|
});
|
|
2282
|
+
const model = options.model ?? defaultModelId;
|
|
2284
2283
|
const turnStartConfig = createACPTurnStartConfig({
|
|
2285
2284
|
prompt,
|
|
2286
2285
|
tools: options.tools ?? [],
|
|
@@ -2293,7 +2292,9 @@ function createSession({
|
|
|
2293
2292
|
sessionMeta,
|
|
2294
2293
|
instructionMapping,
|
|
2295
2294
|
responseFormat: options.responseFormat,
|
|
2296
|
-
outputSchemaMapping
|
|
2295
|
+
outputSchemaMapping,
|
|
2296
|
+
model,
|
|
2297
|
+
modelMapping
|
|
2297
2298
|
});
|
|
2298
2299
|
const nextInstructionsFingerprint = fingerprintValue({
|
|
2299
2300
|
value: options.instructions ?? null
|
|
@@ -2322,6 +2323,7 @@ function createSession({
|
|
|
2322
2323
|
builtinTools,
|
|
2323
2324
|
permissionMode,
|
|
2324
2325
|
permissionModeMapping,
|
|
2326
|
+
...model == null ? {} : { model, modelMapping },
|
|
2325
2327
|
...options.responseFormat == null ? {} : { responseFormat: options.responseFormat },
|
|
2326
2328
|
...turnStartConfig.outputSchemaMapping == null ? {} : { outputSchemaMapping: turnStartConfig.outputSchemaMapping },
|
|
2327
2329
|
...mcpServers == null ? {} : { mcpServers },
|
|
@@ -2381,6 +2383,10 @@ function createSession({
|
|
|
2381
2383
|
builtinTools: turnStartConfig.builtinTools,
|
|
2382
2384
|
permissionMode: turnStartConfig.permissionMode,
|
|
2383
2385
|
permissionModeMapping: turnStartConfig.permissionModeMapping,
|
|
2386
|
+
...turnStartConfig.model == null ? {} : {
|
|
2387
|
+
model: turnStartConfig.model,
|
|
2388
|
+
modelMapping: turnStartConfig.modelMapping
|
|
2389
|
+
},
|
|
2384
2390
|
...turnStartConfig.responseFormat == null ? {} : { responseFormat: turnStartConfig.responseFormat },
|
|
2385
2391
|
...turnStartConfig.outputSchemaMapping == null ? {} : { outputSchemaMapping: turnStartConfig.outputSchemaMapping },
|
|
2386
2392
|
...instructionMapping == null ? {} : {
|
|
@@ -2525,6 +2531,7 @@ function validateACPTurnStartConfig({
|
|
|
2525
2531
|
sessionMeta,
|
|
2526
2532
|
instructionMapping,
|
|
2527
2533
|
outputSchemaMapping,
|
|
2534
|
+
modelMapping,
|
|
2528
2535
|
builtinTools,
|
|
2529
2536
|
permissionModeMapping,
|
|
2530
2537
|
mcpServers
|
|
@@ -2541,7 +2548,9 @@ function validateACPTurnStartConfig({
|
|
|
2541
2548
|
sessionMeta,
|
|
2542
2549
|
instructionMapping,
|
|
2543
2550
|
responseFormat: turnStartConfig.responseFormat,
|
|
2544
|
-
outputSchemaMapping
|
|
2551
|
+
outputSchemaMapping,
|
|
2552
|
+
model: turnStartConfig.model,
|
|
2553
|
+
modelMapping
|
|
2545
2554
|
});
|
|
2546
2555
|
if (current.configurationFingerprint !== turnStartConfig.configurationFingerprint) {
|
|
2547
2556
|
throw new Error(
|
|
@@ -2551,12 +2560,12 @@ function validateACPTurnStartConfig({
|
|
|
2551
2560
|
}
|
|
2552
2561
|
function validateACPColdSessionConfiguration({
|
|
2553
2562
|
coldSession,
|
|
2554
|
-
modelId,
|
|
2555
2563
|
permissionMode,
|
|
2556
2564
|
authenticationProfile,
|
|
2557
2565
|
sessionMeta,
|
|
2558
2566
|
instructionMapping,
|
|
2559
2567
|
outputSchemaMapping,
|
|
2568
|
+
modelMapping,
|
|
2560
2569
|
builtinTools,
|
|
2561
2570
|
permissionModeMapping,
|
|
2562
2571
|
mcpServers,
|
|
@@ -2574,9 +2583,11 @@ function validateACPColdSessionConfiguration({
|
|
|
2574
2583
|
sessionMeta,
|
|
2575
2584
|
instructionMapping,
|
|
2576
2585
|
responseFormat: coldSession.responseFormat,
|
|
2577
|
-
outputSchemaMapping
|
|
2586
|
+
outputSchemaMapping,
|
|
2587
|
+
model: void 0,
|
|
2588
|
+
modelMapping
|
|
2578
2589
|
});
|
|
2579
|
-
if (current.configurationFingerprint !== coldSession.configurationFingerprint || coldSession.permissionMode !== permissionMode
|
|
2590
|
+
if (current.configurationFingerprint !== coldSession.configurationFingerprint || coldSession.permissionMode !== permissionMode) {
|
|
2580
2591
|
throw new Error(
|
|
2581
2592
|
"ACP cold-session state is incompatible with the current non-secret session configuration."
|
|
2582
2593
|
);
|
|
@@ -2621,7 +2632,7 @@ function deserializeBridgeError({
|
|
|
2621
2632
|
}
|
|
2622
2633
|
|
|
2623
2634
|
// src/version.ts
|
|
2624
|
-
var VERSION = true ? "1.0.
|
|
2635
|
+
var VERSION = true ? "1.0.33" : "0.0.0-test";
|
|
2625
2636
|
|
|
2626
2637
|
// src/acp-harness.ts
|
|
2627
2638
|
var ACP_CLIENT_APP = {
|