@ai-sdk/harness-acp 1.0.22 → 1.0.23

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/dist/index.d.ts CHANGED
@@ -127,7 +127,11 @@ type ACPNpmLockedSource = {
127
127
  readonly packageJson: string;
128
128
  readonly pnpmLockYaml: string;
129
129
  };
130
- type ACPSource = ACPNpmSimpleSource | ACPNpmLockedSource;
130
+ type ACPInstallCommandSource = {
131
+ readonly type: 'install-command';
132
+ readonly command: string;
133
+ };
134
+ type ACPSource = ACPNpmSimpleSource | ACPNpmLockedSource | ACPInstallCommandSource;
131
135
  type ACPAuthentication = {
132
136
  readonly methodId: string;
133
137
  readonly meta?: Readonly<Record<string, ACPSerializableValue>>;
@@ -254,4 +258,4 @@ declare function createACP<TBuiltinTools extends ToolSet = {}>(settings: ACPHarn
254
258
 
255
259
  declare const VERSION: string;
256
260
 
257
- export { type ACPAnnotations, type ACPAudioContent, type ACPAuthOptions, type ACPAuthentication, type ACPBlobResourceContents, type ACPClientApp, type ACPContentBlock, type ACPCredentialBrokering, type ACPEmbeddedResource, type ACPHarnessSettings, type ACPImageContent, type ACPInstructionMapping, type ACPMetadata, type ACPNpmLockedSource, type ACPNpmSimpleSource, type ACPOutputSchemaMapping, 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 };
261
+ export { type ACPAnnotations, type ACPAudioContent, type ACPAuthOptions, type ACPAuthentication, type ACPBlobResourceContents, type ACPClientApp, type ACPContentBlock, type ACPCredentialBrokering, type ACPEmbeddedResource, type ACPHarnessSettings, type ACPImageContent, type ACPInstallCommandSource, type ACPInstructionMapping, type ACPMetadata, type ACPNpmLockedSource, type ACPNpmSimpleSource, type ACPOutputSchemaMapping, 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
@@ -201,12 +201,14 @@ function validateACPV1Implementation(implementation) {
201
201
  if (source.pnpmLockYaml.length === 0) {
202
202
  throw new Error("ACP source.pnpmLockYaml must not be empty.");
203
203
  }
204
- } else {
204
+ } else if (source.type === "npm-simple") {
205
205
  validateNpmSimpleSource({ source });
206
+ } else if (source.command.trim().length === 0) {
207
+ throw new Error("ACP source.command must not be empty.");
206
208
  }
207
209
  if (!EXECUTABLE_NAME_REGEXP.test(implementation.executable)) {
208
210
  throw new Error(
209
- `ACP executable must be a package bin name without a path; received ${JSON.stringify(implementation.executable)}.`
211
+ `ACP executable must be a bare command name without a path; received ${JSON.stringify(implementation.executable)}.`
210
212
  );
211
213
  }
212
214
  validateForwardEnvironment({ forwardEnv: implementation.forwardEnv });
@@ -238,6 +240,7 @@ function createImplementationManifest({
238
240
  implementation
239
241
  }) {
240
242
  const { source } = implementation;
243
+ if (source.type === "install-command") return void 0;
241
244
  if (source.type === "npm-locked") {
242
245
  return source.packageJson;
243
246
  }
@@ -266,7 +269,8 @@ function createImplementationDescriptor({
266
269
  }) {
267
270
  return JSON.stringify(
268
271
  {
269
- executable: implementation.executable,
272
+ executablePath: implementation.source.type === "install-command" ? `home/.local/bin/${implementation.executable}` : `node_modules/.bin/${implementation.executable}`,
273
+ privateHome: implementation.source.type === "install-command",
270
274
  args: implementation.args ?? [],
271
275
  envKeys: getImplementationEnvironmentKeys({ implementation })
272
276
  },
@@ -287,10 +291,13 @@ function createImplementationIdentity({
287
291
  type: source.type,
288
292
  packageJson: source.packageJson,
289
293
  pnpmLockYaml: source.pnpmLockYaml
290
- } : {
294
+ } : source.type === "npm-simple" ? {
291
295
  type: source.type,
292
296
  packageName: source.packageName,
293
297
  ...source.packageVersion == null ? {} : { packageVersion: source.packageVersion }
298
+ } : {
299
+ type: source.type,
300
+ command: source.command
294
301
  };
295
302
  const forwardedEnvironment = [
296
303
  ...new Set(implementation.forwardEnv ?? [])
@@ -323,8 +330,29 @@ function createImplementationInstallCommand({
323
330
  storeDir,
324
331
  implementation
325
332
  }) {
333
+ if (implementation.source.type === "install-command") {
334
+ return "bash implementation/install.sh";
335
+ }
326
336
  return `pnpm --dir ${implementationDir} install` + (implementation.source.type === "npm-locked" ? " --frozen-lockfile" : "") + ` --prod --store-dir ${storeDir}`;
327
337
  }
338
+ function getImplementationInstallScript({
339
+ implementation
340
+ }) {
341
+ if (implementation.source.type !== "install-command") return void 0;
342
+ return `#!/usr/bin/env bash
343
+ set -euo pipefail
344
+
345
+ ACP_IMPLEMENTATION_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
346
+ ACP_INSTALL_HOME="$ACP_IMPLEMENTATION_DIR/home"
347
+ export HOME="$ACP_INSTALL_HOME"
348
+ export PATH="$ACP_INSTALL_HOME/.local/bin:$PATH"
349
+
350
+ mkdir -p "$ACP_INSTALL_HOME/.local/bin"
351
+ cd "$ACP_IMPLEMENTATION_DIR"
352
+
353
+ ${implementation.source.command}
354
+ `;
355
+ }
328
356
  function resolveImplementationEnvironment({
329
357
  implementation,
330
358
  env
@@ -428,9 +456,15 @@ function createACPBootstrap({
428
456
  readBridgeAsset({ name: "index.mjs" }),
429
457
  readBridgeAsset({ name: "host-tool-mcp.mjs" })
430
458
  ]);
459
+ const implementationManifest = createImplementationManifest({
460
+ implementation
461
+ });
431
462
  const implementationLock = getImplementationLockfile({
432
463
  implementation
433
464
  });
465
+ const implementationInstallScript = getImplementationInstallScript({
466
+ implementation
467
+ });
434
468
  cachedBootstrap = {
435
469
  harnessId,
436
470
  bootstrapDir,
@@ -448,19 +482,27 @@ function createACPBootstrap({
448
482
  path: `${bootstrapDir}/host-tool-mcp.mjs`,
449
483
  content: hostToolMCP
450
484
  },
451
- {
452
- path: `${bootstrapDir}/implementation/package.json`,
453
- content: createImplementationManifest({ implementation })
454
- },
455
485
  {
456
486
  path: `${bootstrapDir}/implementation/implementation.json`,
457
487
  content: createImplementationDescriptor({ implementation })
458
488
  },
489
+ ...implementationManifest == null ? [] : [
490
+ {
491
+ path: `${bootstrapDir}/implementation/package.json`,
492
+ content: implementationManifest
493
+ }
494
+ ],
459
495
  ...implementationLock == null ? [] : [
460
496
  {
461
497
  path: `${bootstrapDir}/implementation/pnpm-lock.yaml`,
462
498
  content: implementationLock
463
499
  }
500
+ ],
501
+ ...implementationInstallScript == null ? [] : [
502
+ {
503
+ path: `${bootstrapDir}/implementation/install.sh`,
504
+ content: implementationInstallScript
505
+ }
464
506
  ]
465
507
  ],
466
508
  commands: [
@@ -2494,7 +2536,7 @@ function deserializeBridgeError({
2494
2536
  }
2495
2537
 
2496
2538
  // src/version.ts
2497
- var VERSION = true ? "1.0.22" : "0.0.0-test";
2539
+ var VERSION = true ? "1.0.23" : "0.0.0-test";
2498
2540
 
2499
2541
  // src/acp-harness.ts
2500
2542
  var ACP_CLIENT_APP = {