@ai-sdk/harness-acp 0.0.0 → 1.0.1

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +13 -0
  3. package/README.md +69 -3
  4. package/dist/bridge/host-tool-mcp.mjs +302 -0
  5. package/dist/bridge/host-tool-mcp.mjs.map +1 -0
  6. package/dist/bridge/index.mjs +3317 -0
  7. package/dist/bridge/index.mjs.map +1 -0
  8. package/dist/bridge/package.json +12 -0
  9. package/dist/bridge/pnpm-lock.yaml +816 -0
  10. package/dist/index.d.ts +104 -0
  11. package/dist/index.js +2089 -0
  12. package/dist/index.js.map +1 -0
  13. package/package.json +64 -10
  14. package/src/acp-auth.ts +254 -0
  15. package/src/acp-bridge-protocol.ts +13 -0
  16. package/src/acp-harness.ts +107 -0
  17. package/src/index.ts +19 -0
  18. package/src/v1/acp-v1-bridge-protocol.ts +151 -0
  19. package/src/v1/acp-v1-harness.ts +1461 -0
  20. package/src/v1/acp-v1-lifecycle.ts +115 -0
  21. package/src/v1/acp-v1-prompt.ts +122 -0
  22. package/src/v1/acp-v1-settings.ts +97 -0
  23. package/src/v1/acp-v1-skills.ts +228 -0
  24. package/src/v1/acp-v1-turn-start-config.ts +93 -0
  25. package/src/v1/bridge/acp-diagnostics.ts +83 -0
  26. package/src/v1/bridge/acp-stream-capture.ts +152 -0
  27. package/src/v1/bridge/acp-v1-bridge-environment.ts +95 -0
  28. package/src/v1/bridge/agent-stderr-monitor.ts +52 -0
  29. package/src/v1/bridge/create-emit-stream-event.ts +97 -0
  30. package/src/v1/bridge/host-tool-correlation.ts +640 -0
  31. package/src/v1/bridge/host-tool-mcp-server.ts +180 -0
  32. package/src/v1/bridge/host-tool-mcp.ts +185 -0
  33. package/src/v1/bridge/host-tool-relay-client.ts +53 -0
  34. package/src/v1/bridge/host-tool-relay.ts +510 -0
  35. package/src/v1/bridge/index.ts +714 -0
  36. package/src/v1/bridge/package.json +12 -0
  37. package/src/v1/bridge/permission-controller.ts +152 -0
  38. package/src/v1/bridge/permission-mode.ts +163 -0
  39. package/src/v1/bridge/pnpm-lock.yaml +816 -0
  40. package/src/v1/bridge/profile-values.ts +97 -0
  41. package/src/v1/bridge/protocol-configuration.ts +146 -0
  42. package/src/v1/bridge/recovered-session.ts +145 -0
  43. package/src/v1/bridge/refresh-host-tool-catalog.ts +33 -0
  44. package/src/v1/bridge/session-lifecycle.ts +83 -0
  45. package/src/v1/bridge/stream-translator.ts +901 -0
  46. package/src/v1/implementation.ts +308 -0
  47. package/src/v1/index.ts +16 -0
  48. package/src/version.ts +6 -0
  49. package/index.js +0 -1
@@ -0,0 +1,104 @@
1
+ import { HarnessV1PermissionMode, HarnessV1 } from '@ai-sdk/harness';
2
+ import { ToolSet } from '@ai-sdk/provider-utils';
3
+
4
+ type ACPSerializablePrimitive = string | number | boolean | null;
5
+ type ACPSerializableValue = ACPSerializablePrimitive | ReadonlyArray<ACPSerializableValue> | {
6
+ readonly [key: string]: ACPSerializableValue;
7
+ };
8
+ type ACPValueSource = {
9
+ readonly $source: 'gateway-api-key' | 'gateway-base-url' | 'gateway-authorization' | 'client-app' | 'client-app-name' | 'client-app-version';
10
+ readonly prefix?: string;
11
+ readonly suffix?: string;
12
+ readonly ensureSuffix?: string;
13
+ };
14
+ type ACPProfileValue = ACPSerializablePrimitive | ACPValueSource | ReadonlyArray<ACPProfileValue> | {
15
+ readonly [key: string]: ACPProfileValue;
16
+ };
17
+ type ACPNpmSimpleSource = {
18
+ readonly type: 'npm-simple';
19
+ readonly packageName: string;
20
+ /**
21
+ * Exact version to install. When omitted, the package's `latest` dist-tag is
22
+ * installed and no version takes part in the implementation identity, so a
23
+ * new upstream release does not invalidate existing lifecycle state.
24
+ */
25
+ readonly packageVersion?: string;
26
+ };
27
+ type ACPNpmLockedSource = {
28
+ readonly type: 'npm-locked';
29
+ readonly packageJson: string;
30
+ readonly pnpmLockYaml: string;
31
+ };
32
+ type ACPSource = ACPNpmSimpleSource | ACPNpmLockedSource;
33
+ type ACPAuthentication = {
34
+ readonly methodId: string;
35
+ readonly meta?: Readonly<Record<string, ACPSerializableValue>>;
36
+ readonly clientCapabilities?: Readonly<Record<string, ACPSerializableValue>>;
37
+ };
38
+ type ACPProviderAuthenticationMode = 'auto' | 'direct' | 'ai-gateway';
39
+ type ACPProviderAuthentication = {
40
+ readonly gateway: {
41
+ readonly env: Readonly<Record<string, ACPProfileValue>>;
42
+ };
43
+ };
44
+ type ACPPermissionModeTarget = {
45
+ readonly type: 'session-mode';
46
+ readonly modeId: string;
47
+ } | {
48
+ readonly type: 'session-config-option';
49
+ readonly configId: string;
50
+ readonly value: string | boolean;
51
+ };
52
+ type ACPPermissionModeMapping = Readonly<Record<HarnessV1PermissionMode, ACPPermissionModeTarget | null>>;
53
+ type ACPV1Settings = {
54
+ readonly version?: 'v1';
55
+ readonly harnessId: string;
56
+ readonly auth?: ACPProviderAuthenticationMode;
57
+ readonly source: ACPSource;
58
+ readonly executable: string;
59
+ readonly args?: ReadonlyArray<string>;
60
+ readonly forwardEnv?: ReadonlyArray<string>;
61
+ /**
62
+ * Runtime environment values that are safe to persist in bootstrap and
63
+ * lifecycle compatibility identity.
64
+ */
65
+ readonly env?: Readonly<Record<string, string>>;
66
+ readonly authentication?: ACPAuthentication;
67
+ readonly providerAuthentication?: ACPProviderAuthentication;
68
+ readonly modelId?: string;
69
+ readonly permissionModeMapping?: ACPPermissionModeMapping;
70
+ readonly session?: {
71
+ readonly meta?: Readonly<Record<string, ACPSerializableValue>>;
72
+ };
73
+ };
74
+
75
+ type ACPAuthOptions = ACPProviderAuthenticationMode;
76
+ type ACPClientApp = {
77
+ readonly name: string;
78
+ readonly version: string;
79
+ };
80
+
81
+ type ACPHarnessSettings<TBuiltinTools extends ToolSet = {}> = {
82
+ readonly builtinTools?: TBuiltinTools;
83
+ readonly port?: number;
84
+ readonly startupTimeoutMs?: number;
85
+ readonly clientApp?: ACPClientApp;
86
+ readonly version?: ACPV1Settings['version'];
87
+ readonly harnessId: ACPV1Settings['harnessId'];
88
+ readonly auth?: ACPV1Settings['auth'];
89
+ readonly source: ACPV1Settings['source'];
90
+ readonly executable: ACPV1Settings['executable'];
91
+ readonly args?: ACPV1Settings['args'];
92
+ readonly forwardEnv?: ACPV1Settings['forwardEnv'];
93
+ readonly env?: ACPV1Settings['env'];
94
+ readonly authentication?: ACPV1Settings['authentication'];
95
+ readonly providerAuthentication?: ACPV1Settings['providerAuthentication'];
96
+ readonly modelId?: ACPV1Settings['modelId'];
97
+ readonly permissionModeMapping?: ACPV1Settings['permissionModeMapping'];
98
+ readonly session?: ACPV1Settings['session'];
99
+ };
100
+ declare function createACP<TBuiltinTools extends ToolSet = {}>(settings: ACPHarnessSettings<TBuiltinTools>): HarnessV1<TBuiltinTools>;
101
+
102
+ declare const VERSION: string;
103
+
104
+ export { type ACPAuthOptions, type ACPAuthentication, type ACPClientApp, type ACPHarnessSettings, type ACPNpmLockedSource, type ACPNpmSimpleSource, type ACPPermissionModeMapping, type ACPPermissionModeTarget, type ACPProfileValue, type ACPProviderAuthentication, type ACPProviderAuthenticationMode, type ACPSerializablePrimitive, type ACPSerializableValue, type ACPSource, type ACPV1Settings, type ACPValueSource, VERSION, createACP };