@ai-sdk/harness-acp 1.0.7 → 1.0.9

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @ai-sdk/harness-acp
2
2
 
3
+ ## 1.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 69bb613: feat(harness): support request transformations in network sandbox abstraction and use it to apply credential brokering when available
8
+ - 52bc889: feat(harness): add `getPortEndpoint()` as more comprehensive replacement to `getPortUrl()` (now deprecated) in `HarnessV1NetworkSandboxSession`
9
+ - 4cd4989: chore(harness): decouple bridge based harness bootstrap recipe logic from dynamic params and enforce unique harnesses in `prepareSandboxForHarness()` helper
10
+ - Updated dependencies [69bb613]
11
+ - Updated dependencies [52bc889]
12
+ - Updated dependencies [4cd4989]
13
+ - @ai-sdk/harness@1.0.72
14
+
15
+ ## 1.0.8
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [8d717b3]
20
+ - @ai-sdk/harness@1.0.71
21
+
3
22
  ## 1.0.7
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -23,6 +23,7 @@ authentication:
23
23
  ```ts
24
24
  import { HarnessAgent } from '@ai-sdk/harness/agent';
25
25
  import { createACP } from '@ai-sdk/harness-acp';
26
+ import { createCredentialRequestTransformation } from '@ai-sdk/harness/utils';
26
27
  import { createVercelSandbox } from '@ai-sdk/sandbox-vercel';
27
28
 
28
29
  const codexACP = createACP({
@@ -33,7 +34,17 @@ const codexACP = createACP({
33
34
  packageVersion: '1.1.4',
34
35
  },
35
36
  executable: 'codex-acp',
36
- forwardEnv: ['CODEX_API_KEY', 'OPENAI_API_KEY'],
37
+ credentialEnv: ['CODEX_API_KEY', 'OPENAI_API_KEY'],
38
+ credentialBrokering: ({ env }) => {
39
+ const credential = env.CODEX_API_KEY ?? env.OPENAI_API_KEY;
40
+ if (!credential) return [];
41
+ return [
42
+ createCredentialRequestTransformation({
43
+ baseUrl: 'https://api.openai.com/v1',
44
+ headers: { Authorization: `Bearer ${credential}` },
45
+ }),
46
+ ];
47
+ },
37
48
  instructionMapping: {
38
49
  type: 'launch-env-json',
39
50
  variable: 'CODEX_CONFIG',
@@ -69,9 +80,11 @@ try {
69
80
  }
70
81
  ```
71
82
 
72
- Set `CODEX_API_KEY` or `OPENAI_API_KEY` in the host environment. The adapter
73
- resolves the value when the ACP process starts and does not store it in the
74
- profile. Codex ACP supports only `permissionMode: 'allow-all'` because its
83
+ Set `CODEX_API_KEY` or `OPENAI_API_KEY` in the host environment. Sandboxes that
84
+ support additive request transformations receive only credential placeholders;
85
+ the real value is injected into matching outbound requests. Other sandboxes
86
+ retain the legacy behavior of forwarding the value to the ACP process. Codex
87
+ ACP supports only `permissionMode: 'allow-all'` because its
75
88
  restrictive modes enable Codex's internal sandbox. A bridge-backed ACP harness
76
89
  requires a sandbox with at least one exposed port.
77
90
 
@@ -12,7 +12,7 @@ import {
12
12
  ListToolsRequestSchema,
13
13
  McpError
14
14
  } from "@modelcontextprotocol/sdk/types.js";
15
- var VERSION = true ? "1.0.7" : "0.0.0-test";
15
+ var VERSION = true ? "1.0.9" : "0.0.0-test";
16
16
  function createHostToolMCPServer({
17
17
  tools: tools2,
18
18
  revision = 1,
@@ -529,6 +529,7 @@ var providerAuthenticationSchema = z.discriminatedUnion("type", [
529
529
  var bridgeConfigurationSchema = z.object({
530
530
  authentication: authenticationSchema.optional(),
531
531
  providerAuthentication: providerAuthenticationSchema.optional(),
532
+ providerEnvironment: z.record(z.string(), z.string()).optional(),
532
533
  sessionMeta: serializableRecordSchema.optional()
533
534
  });
534
535
  async function readACPBridgeEnvironment({
@@ -3107,6 +3108,7 @@ async function ensureSession({
3107
3108
  const fingerprint = JSON.stringify({
3108
3109
  authentication: bridgeConfiguration.authentication,
3109
3110
  providerAuthentication: bridgeConfiguration.providerAuthentication,
3111
+ providerEnvironment: bridgeConfiguration.providerEnvironment,
3110
3112
  sessionMeta: bridgeConfiguration.sessionMeta,
3111
3113
  instructionMapping: start.instructionMapping,
3112
3114
  permissionMode: start.permissionMode,
@@ -3140,11 +3142,10 @@ async function ensureSession({
3140
3142
  return;
3141
3143
  }
3142
3144
  const clientApp = resolveClientApp();
3143
- const gateway = bridgeConfiguration.providerAuthentication?.type === "ai-gateway" ? resolveGatewayValues({ clientApp }) : void 0;
3144
3145
  const authentication = bridgeConfiguration.authentication;
3145
- const launchEnv = resolveACPLaunchEnvironment({
3146
+ const launchEnv = bridgeConfiguration.providerEnvironment ?? resolveACPLaunchEnvironment({
3146
3147
  providerAuthentication: bridgeConfiguration.providerAuthentication,
3147
- gateway
3148
+ gateway: bridgeConfiguration.providerAuthentication?.type === "ai-gateway" ? resolveGatewayValues({ clientApp }) : void 0
3148
3149
  });
3149
3150
  const instructionConfiguration = await resolveACPInstructionConfiguration({
3150
3151
  instructions: start.instructions,