@ai-sdk/harness-acp 1.0.2 → 1.0.4
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 +16 -0
- package/README.md +13 -0
- package/dist/bridge/host-tool-mcp.mjs +1 -1
- package/dist/bridge/index.mjs +103 -12
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +41 -6
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/acp-harness.ts +1 -0
- package/src/index.ts +1 -0
- package/src/v1/acp-v1-bridge-protocol.ts +21 -1
- package/src/v1/acp-v1-harness.ts +37 -1
- package/src/v1/acp-v1-settings.ts +21 -0
- package/src/v1/acp-v1-turn-start-config.ts +4 -0
- package/src/v1/bridge/index.ts +14 -6
- package/src/v1/bridge/instruction-mapping.ts +132 -0
- package/src/v1/index.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -148,6 +148,19 @@ type ACPPermissionModeTarget = {
|
|
|
148
148
|
readonly value: string | boolean;
|
|
149
149
|
};
|
|
150
150
|
type ACPPermissionModeMapping = Readonly<Record<HarnessV1PermissionMode, ACPPermissionModeTarget | null>>;
|
|
151
|
+
/**
|
|
152
|
+
* Describes where an ACP implementation accepts native session instructions.
|
|
153
|
+
* Session metadata paths are relative to `_meta`; launch environment paths are
|
|
154
|
+
* relative to the parsed JSON object stored in `variable`.
|
|
155
|
+
*/
|
|
156
|
+
type ACPInstructionMapping = {
|
|
157
|
+
readonly type: 'session-meta';
|
|
158
|
+
readonly path: ReadonlyArray<string>;
|
|
159
|
+
} | {
|
|
160
|
+
readonly type: 'launch-env-json';
|
|
161
|
+
readonly variable: string;
|
|
162
|
+
readonly path: ReadonlyArray<string>;
|
|
163
|
+
};
|
|
151
164
|
type ACPV1Settings = {
|
|
152
165
|
readonly version?: 'v1';
|
|
153
166
|
readonly harnessId: string;
|
|
@@ -166,6 +179,11 @@ type ACPV1Settings = {
|
|
|
166
179
|
readonly authentication?: ACPAuthentication;
|
|
167
180
|
readonly providerAuthentication?: ACPProviderAuthentication;
|
|
168
181
|
readonly modelId?: string;
|
|
182
|
+
/**
|
|
183
|
+
* Routes HarnessAgent instructions to a runtime-native system or developer
|
|
184
|
+
* prompt. When omitted, instructions are prepended to the first user prompt.
|
|
185
|
+
*/
|
|
186
|
+
readonly instructionMapping?: ACPInstructionMapping;
|
|
169
187
|
readonly permissionModeMapping?: ACPPermissionModeMapping;
|
|
170
188
|
readonly session?: {
|
|
171
189
|
readonly meta?: Readonly<Record<string, ACPSerializableValue>>;
|
|
@@ -205,6 +223,7 @@ type ACPHarnessSettings<TBuiltinTools extends ToolSet = {}> = {
|
|
|
205
223
|
readonly authentication?: ACPV1Settings['authentication'];
|
|
206
224
|
readonly providerAuthentication?: ACPV1Settings['providerAuthentication'];
|
|
207
225
|
readonly modelId?: ACPV1Settings['modelId'];
|
|
226
|
+
readonly instructionMapping?: ACPV1Settings['instructionMapping'];
|
|
208
227
|
readonly permissionModeMapping?: ACPV1Settings['permissionModeMapping'];
|
|
209
228
|
readonly session?: ACPV1Settings['session'];
|
|
210
229
|
readonly mintBridgeToken?: ACPV1Settings['mintBridgeToken'];
|
|
@@ -213,4 +232,4 @@ declare function createACP<TBuiltinTools extends ToolSet = {}>(settings: ACPHarn
|
|
|
213
232
|
|
|
214
233
|
declare const VERSION: string;
|
|
215
234
|
|
|
216
|
-
export { type ACPAnnotations, type ACPAudioContent, type ACPAuthOptions, type ACPAuthentication, type ACPBlobResourceContents, type ACPClientApp, type ACPContentBlock, type ACPEmbeddedResource, type ACPHarnessSettings, type ACPImageContent, type ACPMetadata, type ACPNpmLockedSource, type ACPNpmSimpleSource, type ACPPermissionModeMapping, type ACPPermissionModeTarget, type ACPProfileValue, type ACPProviderAuthentication, type ACPProviderAuthenticationMode, 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 };
|
|
235
|
+
export { type ACPAnnotations, type ACPAudioContent, type ACPAuthOptions, type ACPAuthentication, type ACPBlobResourceContents, type ACPClientApp, type ACPContentBlock, type ACPEmbeddedResource, type ACPHarnessSettings, type ACPImageContent, type ACPInstructionMapping, type ACPMetadata, type ACPNpmLockedSource, type ACPNpmSimpleSource, type ACPPermissionModeMapping, type ACPPermissionModeTarget, type ACPProfileValue, type ACPProviderAuthentication, type ACPProviderAuthenticationMode, 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
|
@@ -518,6 +518,18 @@ var permissionModeMappingSchema = z2.object({
|
|
|
518
518
|
"allow-edits": permissionModeTargetSchema.nullable(),
|
|
519
519
|
"allow-all": permissionModeTargetSchema.nullable()
|
|
520
520
|
});
|
|
521
|
+
var instructionMappingPathSchema = z2.array(z2.string().min(1)).min(1);
|
|
522
|
+
var instructionMappingSchema = z2.discriminatedUnion("type", [
|
|
523
|
+
z2.object({
|
|
524
|
+
type: z2.literal("session-meta"),
|
|
525
|
+
path: instructionMappingPathSchema
|
|
526
|
+
}),
|
|
527
|
+
z2.object({
|
|
528
|
+
type: z2.literal("launch-env-json"),
|
|
529
|
+
variable: z2.string().min(1),
|
|
530
|
+
path: instructionMappingPathSchema
|
|
531
|
+
})
|
|
532
|
+
]);
|
|
521
533
|
var acpTurnStartConfigSchema = z2.object({
|
|
522
534
|
version: z2.literal(1),
|
|
523
535
|
configurationFingerprint: z2.string(),
|
|
@@ -552,6 +564,8 @@ var outboundMessageSchema = z2.union([
|
|
|
552
564
|
]);
|
|
553
565
|
var startMessageSchema = harnessV1BridgeStartBaseSchema.extend({
|
|
554
566
|
prompt: z2.array(acpTextContentBlockSchema),
|
|
567
|
+
instructions: z2.string().optional(),
|
|
568
|
+
instructionMapping: instructionMappingSchema.optional(),
|
|
555
569
|
mcpServers: z2.record(z2.string(), z2.unknown()).optional(),
|
|
556
570
|
tools: z2.array(acpSerializableToolSpecSchema).optional(),
|
|
557
571
|
builtinTools: z2.array(builtinToolSchema).readonly().default([]),
|
|
@@ -635,7 +649,8 @@ function createACPTurnStartConfig({
|
|
|
635
649
|
mcpServers,
|
|
636
650
|
debug,
|
|
637
651
|
authenticationProfile,
|
|
638
|
-
sessionMeta
|
|
652
|
+
sessionMeta,
|
|
653
|
+
instructionMapping
|
|
639
654
|
}) {
|
|
640
655
|
return {
|
|
641
656
|
version: 1,
|
|
@@ -643,6 +658,7 @@ function createACPTurnStartConfig({
|
|
|
643
658
|
stableStringify3({
|
|
644
659
|
authenticationProfile,
|
|
645
660
|
sessionMeta: sessionMeta ?? null,
|
|
661
|
+
...instructionMapping == null ? {} : { instructionMapping },
|
|
646
662
|
builtinTools,
|
|
647
663
|
permissionModeMapping: permissionModeMapping ?? null,
|
|
648
664
|
mcpServers: mcpServers ?? null
|
|
@@ -1132,6 +1148,7 @@ function createACPV1({
|
|
|
1132
1148
|
proc: void 0,
|
|
1133
1149
|
modelId: settings.modelId,
|
|
1134
1150
|
sessionMeta: settings.session?.meta,
|
|
1151
|
+
instructionMapping: settings.instructionMapping,
|
|
1135
1152
|
debug: startOptions.observability?.debug,
|
|
1136
1153
|
implementationIdentity,
|
|
1137
1154
|
authenticationProfile,
|
|
@@ -1188,6 +1205,7 @@ function createACPV1({
|
|
|
1188
1205
|
turnStartConfig,
|
|
1189
1206
|
authenticationProfile,
|
|
1190
1207
|
sessionMeta: settings.session?.meta,
|
|
1208
|
+
instructionMapping: settings.instructionMapping,
|
|
1191
1209
|
builtinTools: builtinToolCatalog,
|
|
1192
1210
|
permissionModeMapping,
|
|
1193
1211
|
mcpServers: settings.mcpServers
|
|
@@ -1217,6 +1235,7 @@ function createACPV1({
|
|
|
1217
1235
|
permissionMode,
|
|
1218
1236
|
authenticationProfile,
|
|
1219
1237
|
sessionMeta: settings.session?.meta,
|
|
1238
|
+
instructionMapping: settings.instructionMapping,
|
|
1220
1239
|
builtinTools: builtinToolCatalog,
|
|
1221
1240
|
permissionModeMapping,
|
|
1222
1241
|
mcpServers: settings.mcpServers,
|
|
@@ -1324,6 +1343,7 @@ function createACPV1({
|
|
|
1324
1343
|
builtinTools: builtinToolCatalog,
|
|
1325
1344
|
permissionMode,
|
|
1326
1345
|
permissionModeMapping,
|
|
1346
|
+
...settings.instructionMapping == null ? {} : { instructionMapping: settings.instructionMapping },
|
|
1327
1347
|
...settings.mcpServers == null ? {} : { mcpServers: settings.mcpServers },
|
|
1328
1348
|
tools: respawnStrategy.turnStartConfig.tools,
|
|
1329
1349
|
turnStartConfig: respawnStrategy.turnStartConfig,
|
|
@@ -1356,6 +1376,7 @@ function createACPV1({
|
|
|
1356
1376
|
proc,
|
|
1357
1377
|
modelId: settings.modelId,
|
|
1358
1378
|
sessionMeta: settings.session?.meta,
|
|
1379
|
+
instructionMapping: settings.instructionMapping,
|
|
1359
1380
|
debug: startOptions.observability?.debug,
|
|
1360
1381
|
implementationIdentity,
|
|
1361
1382
|
authenticationProfile,
|
|
@@ -1517,6 +1538,7 @@ function createSession({
|
|
|
1517
1538
|
proc,
|
|
1518
1539
|
modelId,
|
|
1519
1540
|
sessionMeta,
|
|
1541
|
+
instructionMapping,
|
|
1520
1542
|
debug,
|
|
1521
1543
|
implementationIdentity,
|
|
1522
1544
|
authenticationProfile,
|
|
@@ -1814,7 +1836,8 @@ function createSession({
|
|
|
1814
1836
|
mcpServers,
|
|
1815
1837
|
debug,
|
|
1816
1838
|
authenticationProfile,
|
|
1817
|
-
sessionMeta
|
|
1839
|
+
sessionMeta,
|
|
1840
|
+
instructionMapping
|
|
1818
1841
|
});
|
|
1819
1842
|
const control = wireTurn({
|
|
1820
1843
|
emit: options.emit,
|
|
@@ -1830,9 +1853,13 @@ function createSession({
|
|
|
1830
1853
|
type: "start",
|
|
1831
1854
|
prompt: initialGuidanceApplied ? prompt : prependACPInitialGuidance({
|
|
1832
1855
|
prompt,
|
|
1833
|
-
instructions: options.instructions,
|
|
1856
|
+
instructions: instructionMapping == null ? options.instructions : void 0,
|
|
1834
1857
|
skills: skillCatalog
|
|
1835
1858
|
}),
|
|
1859
|
+
...instructionMapping == null ? {} : {
|
|
1860
|
+
instructionMapping,
|
|
1861
|
+
...options.instructions == null ? {} : { instructions: options.instructions }
|
|
1862
|
+
},
|
|
1836
1863
|
debug,
|
|
1837
1864
|
builtinTools,
|
|
1838
1865
|
permissionMode,
|
|
@@ -1875,6 +1902,10 @@ function createSession({
|
|
|
1875
1902
|
builtinTools: turnStartConfig.builtinTools,
|
|
1876
1903
|
permissionMode: turnStartConfig.permissionMode,
|
|
1877
1904
|
permissionModeMapping: turnStartConfig.permissionModeMapping,
|
|
1905
|
+
...instructionMapping == null ? {} : {
|
|
1906
|
+
instructionMapping,
|
|
1907
|
+
...options.instructions == null ? {} : { instructions: options.instructions }
|
|
1908
|
+
},
|
|
1878
1909
|
...mcpServers == null ? {} : { mcpServers },
|
|
1879
1910
|
tools: turnStartConfig.tools,
|
|
1880
1911
|
turnStartConfig,
|
|
@@ -2007,6 +2038,7 @@ function validateACPTurnStartConfig({
|
|
|
2007
2038
|
turnStartConfig,
|
|
2008
2039
|
authenticationProfile,
|
|
2009
2040
|
sessionMeta,
|
|
2041
|
+
instructionMapping,
|
|
2010
2042
|
builtinTools,
|
|
2011
2043
|
permissionModeMapping,
|
|
2012
2044
|
mcpServers
|
|
@@ -2020,7 +2052,8 @@ function validateACPTurnStartConfig({
|
|
|
2020
2052
|
mcpServers,
|
|
2021
2053
|
debug: turnStartConfig.debug,
|
|
2022
2054
|
authenticationProfile,
|
|
2023
|
-
sessionMeta
|
|
2055
|
+
sessionMeta,
|
|
2056
|
+
instructionMapping
|
|
2024
2057
|
});
|
|
2025
2058
|
if (current.configurationFingerprint !== turnStartConfig.configurationFingerprint) {
|
|
2026
2059
|
throw new Error(
|
|
@@ -2034,6 +2067,7 @@ function validateACPColdSessionConfiguration({
|
|
|
2034
2067
|
permissionMode,
|
|
2035
2068
|
authenticationProfile,
|
|
2036
2069
|
sessionMeta,
|
|
2070
|
+
instructionMapping,
|
|
2037
2071
|
builtinTools,
|
|
2038
2072
|
permissionModeMapping,
|
|
2039
2073
|
mcpServers,
|
|
@@ -2048,7 +2082,8 @@ function validateACPColdSessionConfiguration({
|
|
|
2048
2082
|
mcpServers,
|
|
2049
2083
|
debug,
|
|
2050
2084
|
authenticationProfile,
|
|
2051
|
-
sessionMeta
|
|
2085
|
+
sessionMeta,
|
|
2086
|
+
instructionMapping
|
|
2052
2087
|
});
|
|
2053
2088
|
if (current.configurationFingerprint !== coldSession.configurationFingerprint || coldSession.permissionMode !== permissionMode || coldSession.modelId !== modelId) {
|
|
2054
2089
|
throw new Error(
|
|
@@ -2095,7 +2130,7 @@ function deserializeBridgeError({
|
|
|
2095
2130
|
}
|
|
2096
2131
|
|
|
2097
2132
|
// src/version.ts
|
|
2098
|
-
var VERSION = true ? "1.0.
|
|
2133
|
+
var VERSION = true ? "1.0.4" : "0.0.0-test";
|
|
2099
2134
|
|
|
2100
2135
|
// src/acp-harness.ts
|
|
2101
2136
|
var ACP_CLIENT_APP = {
|