@atom-workflow-agent/acp-sdk 0.1.0
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/LICENSE +201 -0
- package/README.md +28 -0
- package/README.zh-CN.md +34 -0
- package/dist/acp-client-error.d.ts +12 -0
- package/dist/acp-client-error.d.ts.map +1 -0
- package/dist/acp-client-error.js +40 -0
- package/dist/acp-client-error.js.map +1 -0
- package/dist/acp-client.d.ts +56 -0
- package/dist/acp-client.d.ts.map +1 -0
- package/dist/acp-client.js +140 -0
- package/dist/acp-client.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/provider-discovery.d.ts +31 -0
- package/dist/provider-discovery.d.ts.map +1 -0
- package/dist/provider-discovery.js +63 -0
- package/dist/provider-discovery.js.map +1 -0
- package/dist/provider-resolver.d.ts +13 -0
- package/dist/provider-resolver.d.ts.map +1 -0
- package/dist/provider-resolver.js +81 -0
- package/dist/provider-resolver.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @atom-workflow-agent/acp-sdk
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Standalone ACP client primitives for Atom implementations and ordinary Node.js applications.
|
|
6
|
+
|
|
7
|
+
The SDK discovers and runs local Traex, Codex, Claude Code, Pi, or a caller-supplied ACP provider. It owns process, handshake, Session, structured-output validation, cancellation, and cleanup. It deliberately does **not** retry an admitted request, switch providers/models after request failure, create HostTasks, wait for user Signals, or fabricate fallback output. Those decisions belong to the Atom.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createAcpClient } from "@atom-workflow-agent/acp-sdk";
|
|
11
|
+
|
|
12
|
+
const client = createAcpClient({
|
|
13
|
+
target: { provider: input.provider, model: input.model, cwd: context.cwd },
|
|
14
|
+
signal: context.signal,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const result = await client.run({
|
|
18
|
+
instruction: "Diagnose the supplied performance evidence.",
|
|
19
|
+
context: input,
|
|
20
|
+
outputSchema: DiagnosisSchema,
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Both `provider` and `model` are optional. Explicit values always win. When `provider` is omitted, the SDK performs ACP Session/model preflight in `traex > codex > claude-code > pi` order and selects the first usable target. Omitting `model` uses that provider's current default model. Once selected, a failed real request is never replayed on another provider. Omitted timeout values disable request timeouts; automatic discovery retains a bounded per-provider preflight timeout. Workflow node retry and Atom-authored ACP retry remain separate concerns.
|
|
25
|
+
|
|
26
|
+
Use `discoverAcpProviders({ cwd })` to inspect the complete ordered availability result without running a model request.
|
|
27
|
+
|
|
28
|
+
Use `resolveProvider` to add another ACP implementation. Calls made through unrelated model SDKs are also valid Atom internals; the Workflow Runtime treats every Atom as an isolated black box.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @atom-workflow-agent/acp-sdk
|
|
2
|
+
|
|
3
|
+
[English](README.md) | [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
面向 Atom 实现和普通 Node.js 应用的独立 ACP Client 基础能力。
|
|
6
|
+
|
|
7
|
+
SDK 负责发现并运行本地 Traex、Codex、Claude Code、Pi 或调用方提供的 ACP Provider,管理进程、握手、Session、结构化输出校验、取消和清理。SDK **不会** 自动重试已经开始的请求、在请求失败后切换 Provider/模型、创建 HostTask、等待用户 Signal,也不会伪造降级结果;这些决策全部属于 Atom。
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createAcpClient } from "@atom-workflow-agent/acp-sdk";
|
|
11
|
+
|
|
12
|
+
const client = createAcpClient({
|
|
13
|
+
target: { provider: input.provider, model: input.model, cwd: context.cwd },
|
|
14
|
+
signal: context.signal,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const result = await client.run({
|
|
18
|
+
instruction: "诊断给定的页面性能证据。",
|
|
19
|
+
context: input,
|
|
20
|
+
outputSchema: DiagnosisSchema,
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`provider` 和 `model` 都是可选的:显式值始终优先;省略 `provider` 时,SDK 在正式请求前按 `traex > codex > claude-code > pi` 依次完成 ACP Session 与模型发现,选择第一个可用目标;省略 `model` 使用该 Provider 当前默认模型。预检选中后,正式请求失败不会换 Provider 重跑。省略超时表示 ACP SDK 不设置请求超时;自动发现仍使用有界的单 Provider 预检超时。Workflow 节点重试与 Atom 自己编写的 ACP 调用重试是两个独立层次。
|
|
25
|
+
|
|
26
|
+
可以单独查看完整发现结果:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { discoverAcpProviders } from "@atom-workflow-agent/acp-sdk";
|
|
30
|
+
|
|
31
|
+
const providers = await discoverAcpProviders({ cwd: context.cwd });
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
通过 `resolveProvider` 可以接入更多 ACP 实现。Atom 也可以直接使用其他模型 SDK;Workflow Runtime 始终把 Atom 视为隔离的黑盒能力。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AcpClientPhase = "discovery" | "startup" | "handshake" | "session" | "request" | "output" | "unknown";
|
|
2
|
+
/** Public ACP failure. It describes the failure and never prescribes retry or fallback behavior. */
|
|
3
|
+
export declare class AcpClientError extends Error {
|
|
4
|
+
readonly code: string;
|
|
5
|
+
readonly phase: AcpClientPhase;
|
|
6
|
+
readonly provider: string;
|
|
7
|
+
readonly model?: string | undefined;
|
|
8
|
+
readonly name = "AcpClientError";
|
|
9
|
+
constructor(code: string, message: string, phase: AcpClientPhase, provider: string, model?: string | undefined, options?: ErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
export declare function toAcpClientError(error: unknown, provider: string, model?: string): AcpClientError;
|
|
12
|
+
//# sourceMappingURL=acp-client-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-client-error.d.ts","sourceRoot":"","sources":["../src/acp-client-error.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElH,oGAAoG;AACpG,qBAAa,cAAe,SAAQ,KAAK;IAIrC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,KAAK,EAAE,cAAc;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM;IAPzB,QAAQ,CAAC,IAAI,oBAAoB;gBAGtB,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,YAAA,EACvB,OAAO,CAAC,EAAE,YAAY;CAIzB;AAYD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,cAAc,CAOjG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Public ACP failure. It describes the failure and never prescribes retry or fallback behavior. */
|
|
2
|
+
export class AcpClientError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
phase;
|
|
5
|
+
provider;
|
|
6
|
+
model;
|
|
7
|
+
name = "AcpClientError";
|
|
8
|
+
constructor(code, message, phase, provider, model, options) {
|
|
9
|
+
super(message, options);
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.phase = phase;
|
|
12
|
+
this.provider = provider;
|
|
13
|
+
this.model = model;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function phaseFor(code) {
|
|
17
|
+
if (code.includes("PRESET") || code.includes("PROVIDER") || code.includes("EXECUTABLE"))
|
|
18
|
+
return "discovery";
|
|
19
|
+
if (code.includes("PROCESS") || code.includes("SPAWN"))
|
|
20
|
+
return "startup";
|
|
21
|
+
if (code.includes("INITIALIZE") || code.includes("HANDSHAKE") || code.includes("AUTH"))
|
|
22
|
+
return "handshake";
|
|
23
|
+
if (code.includes("SESSION") || code.includes("MODEL"))
|
|
24
|
+
return "session";
|
|
25
|
+
if (code.includes("OUTPUT") || code.includes("JSON") || code.includes("SCHEMA"))
|
|
26
|
+
return "output";
|
|
27
|
+
if (code.includes("PROMPT") || code.includes("TIMEOUT") || code.includes("CANCEL") || code.includes("EXECUTION"))
|
|
28
|
+
return "request";
|
|
29
|
+
return "unknown";
|
|
30
|
+
}
|
|
31
|
+
export function toAcpClientError(error, provider, model) {
|
|
32
|
+
if (error instanceof AcpClientError)
|
|
33
|
+
return error;
|
|
34
|
+
const candidate = error instanceof Error ? error : undefined;
|
|
35
|
+
const code = typeof candidate?.code === "string" ? candidate.code : "ACP_CLIENT_FAILED";
|
|
36
|
+
return new AcpClientError(code, candidate?.message ?? String(error), phaseFor(code), provider, model, {
|
|
37
|
+
...(candidate ? { cause: candidate } : {}),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=acp-client-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-client-error.js","sourceRoot":"","sources":["../src/acp-client-error.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,MAAM,OAAO,cAAe,SAAQ,KAAK;IAI5B;IAEA;IACA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AAC,WAAW,CAAC;QAAE,OAAO,SAAS,CAAC;IACnI,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,QAAgB,EAAE,KAAc;IAC/E,IAAI,KAAK,YAAY,cAAc;QAAE,OAAO,KAAK,CAAC;IAClD,MAAM,SAAS,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAmC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,MAAM,IAAI,GAAG,OAAO,SAAS,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACxF,OAAO,IAAI,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE;QACpG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { probeAcpModels, type AcpProviderConfigResolver, type AcpProviderEventHandler, type AcpPromptResult } from "@atom-workflow-agent/acp-provider";
|
|
2
|
+
import { type JsonSchema, type JsonValue } from "@atom-workflow-agent/contracts";
|
|
3
|
+
export interface AcpClientTarget {
|
|
4
|
+
/** Omit to discover the first usable local provider. */
|
|
5
|
+
readonly provider?: string;
|
|
6
|
+
/** Omit to use the provider's configured/default model. */
|
|
7
|
+
readonly model?: string;
|
|
8
|
+
/** Defaults to process.cwd(). */
|
|
9
|
+
readonly cwd?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CreateAcpClientOptions {
|
|
12
|
+
readonly target?: AcpClientTarget;
|
|
13
|
+
readonly resolveProvider?: AcpProviderConfigResolver;
|
|
14
|
+
/** Used only when target.provider is omitted. */
|
|
15
|
+
readonly providerPriority?: readonly string[];
|
|
16
|
+
/** Per-provider preflight timeout; used only for automatic discovery. */
|
|
17
|
+
readonly discoveryTimeoutMs?: number;
|
|
18
|
+
/** Test/embedding seam for ACP model discovery. */
|
|
19
|
+
readonly probeModels?: typeof probeAcpModels;
|
|
20
|
+
readonly signal?: AbortSignal;
|
|
21
|
+
/** null or omission means no SDK wall-clock timeout. */
|
|
22
|
+
readonly timeoutMs?: number | null;
|
|
23
|
+
/** null or omission means no SDK prompt-silence timeout. */
|
|
24
|
+
readonly idleTimeoutMs?: number | null;
|
|
25
|
+
readonly onEvent?: AcpProviderEventHandler;
|
|
26
|
+
}
|
|
27
|
+
export interface AcpRunRequest {
|
|
28
|
+
readonly instruction: string;
|
|
29
|
+
readonly context?: JsonValue;
|
|
30
|
+
readonly outputSchema?: JsonSchema;
|
|
31
|
+
readonly metadata?: Readonly<Record<string, JsonValue>>;
|
|
32
|
+
}
|
|
33
|
+
export interface AcpRunResult<TOutput extends JsonValue = JsonValue> {
|
|
34
|
+
readonly sessionId: string;
|
|
35
|
+
readonly provider: string;
|
|
36
|
+
readonly model?: string;
|
|
37
|
+
readonly output: TOutput;
|
|
38
|
+
readonly rawText: string;
|
|
39
|
+
readonly stopReason: AcpPromptResult["stopReason"];
|
|
40
|
+
readonly metadata: Readonly<Record<string, JsonValue>>;
|
|
41
|
+
}
|
|
42
|
+
export interface AcpClientSession {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly provider: string;
|
|
45
|
+
readonly model?: string;
|
|
46
|
+
prompt<TOutput extends JsonValue = JsonValue>(request: AcpRunRequest): Promise<AcpRunResult<TOutput>>;
|
|
47
|
+
cancel(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export interface AcpClient {
|
|
50
|
+
readonly target: Readonly<Required<Pick<AcpClientTarget, "cwd">> & Pick<AcpClientTarget, "provider" | "model">>;
|
|
51
|
+
run<TOutput extends JsonValue = JsonValue>(request: AcpRunRequest): Promise<AcpRunResult<TOutput>>;
|
|
52
|
+
withSession<T>(operation: (session: AcpClientSession) => Promise<T>): Promise<T>;
|
|
53
|
+
}
|
|
54
|
+
/** Creates a standalone client. It never retries, switches models, or creates Workflow waits. */
|
|
55
|
+
export declare function createAcpClient(options: CreateAcpClientOptions): AcpClient;
|
|
56
|
+
//# sourceMappingURL=acp-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-client.d.ts","sourceRoot":"","sources":["../src/acp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAGd,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,gCAAgC,CAAC;AAMxC,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,eAAe,CAAC,EAAE,yBAAyB,CAAC;IACrD,iDAAiD;IACjD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,yEAAyE;IACzE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,mDAAmD;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,cAAc,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,wDAAwD;IACxD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,4DAA4D;IAC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EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;IAChH,GAAG,CAAC,OAAO,SAAS,SAAS,GAAG,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IACnG,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAClF;AA2DD,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,CAmF1E"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { AcpAgentExecutor, probeAcpModels, } from "@atom-workflow-agent/acp-provider";
|
|
2
|
+
import { validateJsonSchemaInstance, } from "@atom-workflow-agent/contracts";
|
|
3
|
+
import { AcpClientError, toAcpClientError } from "./acp-client-error.js";
|
|
4
|
+
import { createDefaultAcpProviderResolver } from "./provider-resolver.js";
|
|
5
|
+
import { normalizeAcpProviderId } from "./provider-resolver.js";
|
|
6
|
+
import { resolveDefaultAcpTarget } from "./provider-discovery.js";
|
|
7
|
+
function prompt(request) {
|
|
8
|
+
if (!request.instruction.trim())
|
|
9
|
+
throw new TypeError("ACP instruction is required");
|
|
10
|
+
return [
|
|
11
|
+
request.instruction,
|
|
12
|
+
request.context === undefined ? undefined : `Context:\n${JSON.stringify(request.context)}`,
|
|
13
|
+
request.outputSchema === undefined
|
|
14
|
+
? undefined
|
|
15
|
+
: `Return exactly one JSON document matching this output Schema:\n${JSON.stringify(request.outputSchema)}`,
|
|
16
|
+
].filter((part) => part !== undefined).join("\n\n");
|
|
17
|
+
}
|
|
18
|
+
function parseOutput(rawText, outputSchema) {
|
|
19
|
+
const trimmed = rawText.trim();
|
|
20
|
+
const fenced = /^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(trimmed);
|
|
21
|
+
const document = fenced?.[1] ?? trimmed;
|
|
22
|
+
if (!outputSchema) {
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(document);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return rawText;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
let output;
|
|
31
|
+
try {
|
|
32
|
+
output = JSON.parse(document);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw new AcpClientError("ACP_OUTPUT_INVALID_JSON", "ACP output is not valid JSON", "output", "unknown", undefined, { cause: error });
|
|
36
|
+
}
|
|
37
|
+
const issues = validateJsonSchemaInstance(outputSchema, output, "$.output");
|
|
38
|
+
if (issues.length > 0) {
|
|
39
|
+
throw new AcpClientError("ACP_OUTPUT_SCHEMA_MISMATCH", "ACP output failed the requested Schema", "output", "unknown", undefined, { cause: issues });
|
|
40
|
+
}
|
|
41
|
+
return output;
|
|
42
|
+
}
|
|
43
|
+
function result(raw, request) {
|
|
44
|
+
if (raw.stopReason !== "end_turn") {
|
|
45
|
+
throw new AcpClientError("ACP_RESPONSE_INCOMPLETE", `ACP response stopped with '${raw.stopReason}'`, "request", raw.providerId, raw.model);
|
|
46
|
+
}
|
|
47
|
+
return Object.freeze({
|
|
48
|
+
sessionId: raw.sessionId,
|
|
49
|
+
provider: raw.providerId,
|
|
50
|
+
...(raw.model ? { model: raw.model } : {}),
|
|
51
|
+
output: parseOutput(raw.rawText, request.outputSchema),
|
|
52
|
+
rawText: raw.rawText,
|
|
53
|
+
stopReason: raw.stopReason,
|
|
54
|
+
metadata: Object.freeze({
|
|
55
|
+
...(request.metadata ?? {}),
|
|
56
|
+
turn: raw.turn,
|
|
57
|
+
eventCount: raw.events.length,
|
|
58
|
+
...(raw.usage !== undefined && raw.usage !== null ? { usage: JSON.parse(JSON.stringify(raw.usage)) } : {}),
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/** Creates a standalone client. It never retries, switches models, or creates Workflow waits. */
|
|
63
|
+
export function createAcpClient(options) {
|
|
64
|
+
const requestedProvider = options.target?.provider?.trim();
|
|
65
|
+
if (options.target?.provider !== undefined && !requestedProvider)
|
|
66
|
+
throw new TypeError("ACP target.provider must be non-empty when provided");
|
|
67
|
+
const provider = requestedProvider ? normalizeAcpProviderId(requestedProvider) ?? requestedProvider : undefined;
|
|
68
|
+
const cwd = options.target?.cwd ?? process.cwd();
|
|
69
|
+
const requestedModel = options.target?.model;
|
|
70
|
+
const target = Object.freeze({ ...(provider ? { provider } : {}), cwd, ...(requestedModel ? { model: requestedModel } : {}) });
|
|
71
|
+
const configuredResolver = options.resolveProvider ?? createDefaultAcpProviderResolver();
|
|
72
|
+
const providerConfigs = new Map();
|
|
73
|
+
const resolveProvider = (providerId) => {
|
|
74
|
+
const existing = providerConfigs.get(providerId);
|
|
75
|
+
if (existing)
|
|
76
|
+
return existing;
|
|
77
|
+
const pending = Promise.resolve(configuredResolver(providerId));
|
|
78
|
+
providerConfigs.set(providerId, pending);
|
|
79
|
+
return pending;
|
|
80
|
+
};
|
|
81
|
+
const executor = new AcpAgentExecutor({
|
|
82
|
+
resolveProvider,
|
|
83
|
+
});
|
|
84
|
+
const execution = {
|
|
85
|
+
totalTimeoutMs: options.timeoutMs ?? null,
|
|
86
|
+
idleTimeoutMs: options.idleTimeoutMs ?? null,
|
|
87
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
88
|
+
...(options.onEvent ? { onEvent: options.onEvent } : {}),
|
|
89
|
+
};
|
|
90
|
+
let resolvedTarget;
|
|
91
|
+
const resolveTarget = () => {
|
|
92
|
+
if (resolvedTarget)
|
|
93
|
+
return resolvedTarget;
|
|
94
|
+
resolvedTarget = provider
|
|
95
|
+
? Promise.resolve({ provider, ...(requestedModel ? { model: requestedModel } : {}) })
|
|
96
|
+
: resolveDefaultAcpTarget({
|
|
97
|
+
cwd,
|
|
98
|
+
...(requestedModel ? { model: requestedModel } : {}),
|
|
99
|
+
...(options.providerPriority ? { priority: options.providerPriority } : {}),
|
|
100
|
+
...(options.discoveryTimeoutMs !== undefined ? { timeoutMs: options.discoveryTimeoutMs } : {}),
|
|
101
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
102
|
+
resolveProvider,
|
|
103
|
+
...(options.probeModels ? { probeModels: options.probeModels } : {}),
|
|
104
|
+
}).then((resolved) => ({ provider: resolved.provider, model: resolved.model }));
|
|
105
|
+
return resolvedTarget;
|
|
106
|
+
};
|
|
107
|
+
const convert = async (operation, actualProvider = provider ?? "auto", actualModel = requestedModel) => {
|
|
108
|
+
try {
|
|
109
|
+
return await operation();
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const converted = toAcpClientError(error, actualProvider, actualModel);
|
|
113
|
+
if (converted.provider === "unknown") {
|
|
114
|
+
throw new AcpClientError(converted.code, converted.message, converted.phase, actualProvider, actualModel, { cause: converted });
|
|
115
|
+
}
|
|
116
|
+
throw converted;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const wrapSession = (session) => Object.freeze({
|
|
120
|
+
id: session.sessionId,
|
|
121
|
+
provider: session.providerId,
|
|
122
|
+
...(session.model ? { model: session.model } : {}),
|
|
123
|
+
prompt: (request) => convert(async () => result(await session.prompt({ text: prompt(request) }), request)),
|
|
124
|
+
cancel: () => convert(() => session.cancel()),
|
|
125
|
+
});
|
|
126
|
+
return Object.freeze({
|
|
127
|
+
target,
|
|
128
|
+
run: (request) => convert(async () => {
|
|
129
|
+
const resolved = await resolveTarget();
|
|
130
|
+
const executionTarget = { providerId: resolved.provider, cwd, ...(resolved.model ? { model: resolved.model } : {}) };
|
|
131
|
+
return convert(async () => result(await executor.execute(executionTarget, { text: prompt(request) }, execution), request), resolved.provider, resolved.model);
|
|
132
|
+
}),
|
|
133
|
+
withSession: (operation) => convert(async () => {
|
|
134
|
+
const resolved = await resolveTarget();
|
|
135
|
+
const executionTarget = { providerId: resolved.provider, cwd, ...(resolved.model ? { model: resolved.model } : {}) };
|
|
136
|
+
return convert(() => executor.withSession(executionTarget, execution, (session) => operation(wrapSession(session))), resolved.provider, resolved.model);
|
|
137
|
+
}),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=acp-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acp-client.js","sourceRoot":"","sources":["../src/acp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,GAMf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,GAG3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AA2DlE,SAAS,MAAM,CAAC,OAAsB;IACpC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,6BAA6B,CAAC,CAAC;IACpF,OAAO;QACL,OAAO,CAAC,WAAW;QACnB,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1F,OAAO,CAAC,YAAY,KAAK,SAAS;YAChC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,kEAAkE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;KAC7G,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC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E,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,EACpG,QAAQ,CAAC,QAAQ,EACjB,QAAQ,CAAC,KAAK,CACf,CAAC;QACJ,CAAC,CAAC;KACH,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { probeAcpModels, type AcpModelCatalog, type AcpProviderConfigResolver } from "@atom-workflow-agent/acp-provider";
|
|
2
|
+
import { type BuiltinAcpProviderId, type DefaultAcpProviderResolverOptions } from "./provider-resolver.js";
|
|
3
|
+
export interface AcpProviderDiscoveryEntry {
|
|
4
|
+
readonly provider: BuiltinAcpProviderId;
|
|
5
|
+
readonly available: boolean;
|
|
6
|
+
readonly currentModel?: string;
|
|
7
|
+
readonly models: AcpModelCatalog["models"];
|
|
8
|
+
readonly error?: Readonly<{
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export interface AcpResolvedTarget {
|
|
14
|
+
readonly provider: BuiltinAcpProviderId;
|
|
15
|
+
readonly model: string;
|
|
16
|
+
readonly catalog: AcpModelCatalog;
|
|
17
|
+
}
|
|
18
|
+
export interface AcpProviderDiscoveryOptions extends DefaultAcpProviderResolverOptions {
|
|
19
|
+
readonly cwd?: string;
|
|
20
|
+
readonly model?: string;
|
|
21
|
+
readonly priority?: readonly string[];
|
|
22
|
+
readonly signal?: AbortSignal;
|
|
23
|
+
readonly timeoutMs?: number;
|
|
24
|
+
readonly resolveProvider?: AcpProviderConfigResolver;
|
|
25
|
+
readonly probeModels?: typeof probeAcpModels;
|
|
26
|
+
}
|
|
27
|
+
/** Probes every configured candidate and returns facts in selection order. */
|
|
28
|
+
export declare function discoverAcpProviders(options?: AcpProviderDiscoveryOptions): Promise<readonly AcpProviderDiscoveryEntry[]>;
|
|
29
|
+
/** Selects the first provider that completes ACP Session and model discovery. */
|
|
30
|
+
export declare function resolveDefaultAcpTarget(options?: AcpProviderDiscoveryOptions): Promise<AcpResolvedTarget>;
|
|
31
|
+
//# sourceMappingURL=provider-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-discovery.d.ts","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC/B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,iCAAiC,EACvC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,2BAA4B,SAAQ,iCAAiC;IACpF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,CAAC,EAAE,yBAAyB,CAAC;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,cAAc,CAAC;CAC9C;AAwCD,8EAA8E;AAC9E,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC,CAI/C;AAED,iFAAiF;AACjF,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,iBAAiB,CAAC,CAkB5B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AcpRuntimeError, probeAcpModels, } from "@atom-workflow-agent/acp-provider";
|
|
2
|
+
import { BUILTIN_ACP_PROVIDER_PRIORITY, createDefaultAcpProviderResolver, normalizeAcpProviderId, } from "./provider-resolver.js";
|
|
3
|
+
function normalizePriority(values) {
|
|
4
|
+
const normalized = (values ?? BUILTIN_ACP_PROVIDER_PRIORITY).map((value) => {
|
|
5
|
+
const provider = normalizeAcpProviderId(value);
|
|
6
|
+
if (!provider)
|
|
7
|
+
throw new TypeError(`Unknown ACP provider in discovery priority: ${value}`);
|
|
8
|
+
return provider;
|
|
9
|
+
});
|
|
10
|
+
if (new Set(normalized).size !== normalized.length)
|
|
11
|
+
throw new TypeError("ACP provider discovery priority contains duplicates");
|
|
12
|
+
return normalized;
|
|
13
|
+
}
|
|
14
|
+
function errorFact(error) {
|
|
15
|
+
if (error instanceof Error)
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
code: "code" in error && typeof error.code === "string" ? error.code : "ACP_DISCOVERY_FAILED",
|
|
18
|
+
message: error.message,
|
|
19
|
+
});
|
|
20
|
+
return Object.freeze({ code: "ACP_DISCOVERY_FAILED", message: String(error) });
|
|
21
|
+
}
|
|
22
|
+
async function inspectProvider(provider, options) {
|
|
23
|
+
const resolveProvider = options.resolveProvider ?? createDefaultAcpProviderResolver(options);
|
|
24
|
+
const probe = options.probeModels ?? probeAcpModels;
|
|
25
|
+
try {
|
|
26
|
+
const config = await resolveProvider(provider);
|
|
27
|
+
const catalog = await probe(config, options.cwd ?? process.cwd(), {
|
|
28
|
+
timeoutMs: options.timeoutMs ?? 30_000,
|
|
29
|
+
...(options.model ? { model: options.model } : {}),
|
|
30
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
31
|
+
});
|
|
32
|
+
return Object.freeze({ provider, available: true, currentModel: catalog.currentModelId, models: [...catalog.models] });
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (options.signal?.aborted)
|
|
36
|
+
throw error;
|
|
37
|
+
return Object.freeze({ provider, available: false, models: [], error: errorFact(error) });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Probes every configured candidate and returns facts in selection order. */
|
|
41
|
+
export async function discoverAcpProviders(options = {}) {
|
|
42
|
+
const entries = [];
|
|
43
|
+
for (const provider of normalizePriority(options.priority))
|
|
44
|
+
entries.push(await inspectProvider(provider, options));
|
|
45
|
+
return Object.freeze(entries);
|
|
46
|
+
}
|
|
47
|
+
/** Selects the first provider that completes ACP Session and model discovery. */
|
|
48
|
+
export async function resolveDefaultAcpTarget(options = {}) {
|
|
49
|
+
const failures = [];
|
|
50
|
+
for (const provider of normalizePriority(options.priority)) {
|
|
51
|
+
const entry = await inspectProvider(provider, options);
|
|
52
|
+
if (entry.available && entry.currentModel)
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
provider,
|
|
55
|
+
model: entry.currentModel,
|
|
56
|
+
catalog: Object.freeze({ providerId: provider, currentModelId: entry.currentModel, models: [...entry.models] }),
|
|
57
|
+
});
|
|
58
|
+
failures.push(entry);
|
|
59
|
+
}
|
|
60
|
+
const summary = failures.map((entry) => `${entry.provider}: ${entry.error?.code ?? "MODEL_UNAVAILABLE"}`).join(", ");
|
|
61
|
+
throw new AcpRuntimeError("ACP_PROVIDER_UNAVAILABLE", `No usable ACP model was discovered in priority order (${summary}).`, false, { cause: new AggregateError(failures.map((entry) => new Error(`${entry.provider}: ${entry.error?.message ?? "unavailable"}`))) });
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=provider-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-discovery.js","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,GAGf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,EAChC,sBAAsB,GAGvB,MAAM,wBAAwB,CAAC;AA0BhC,SAAS,iBAAiB,CAAC,MAAqC;IAC9D,MAAM,UAAU,GAAG,CAAC,MAAM,IAAI,6BAA6B,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACzE,MAAM,QAAQ,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,SAAS,CAAC,+CAA+C,KAAK,EAAE,CAAC,CAAC;QAC3F,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,MAAM;QAAE,MAAM,IAAI,SAAS,CAAC,qDAAqD,CAAC,CAAC;IAC/H,OA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CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;aAChH,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,mBAAmB,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrH,MAAM,IAAI,eAAe,CACvB,0BAA0B,EAC1B,yDAAyD,OAAO,IAAI,EACpE,KAAK,EACL,EAAE,KAAK,EAAE,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,KAAK,EAAE,OAAO,IAAI,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CACjI,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AcpProviderConfigResolver } from "@atom-workflow-agent/acp-provider";
|
|
2
|
+
export declare const BUILTIN_ACP_PROVIDER_PRIORITY: readonly ["traex", "codex", "claude-code", "pi"];
|
|
3
|
+
export type BuiltinAcpProviderId = typeof BUILTIN_ACP_PROVIDER_PRIORITY[number];
|
|
4
|
+
export interface DefaultAcpProviderResolverOptions {
|
|
5
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
6
|
+
readonly homeDirectory?: string;
|
|
7
|
+
readonly lookup?: (command: string) => Promise<string | undefined>;
|
|
8
|
+
}
|
|
9
|
+
export declare function normalizeAcpProviderId(value: string): BuiltinAcpProviderId | undefined;
|
|
10
|
+
export declare function isBuiltinAcpProviderId(value: string): value is BuiltinAcpProviderId;
|
|
11
|
+
/** Resolves local launch configuration without downloading packages or probing models. */
|
|
12
|
+
export declare function createDefaultAcpProviderResolver(options?: DefaultAcpProviderResolverOptions): AcpProviderConfigResolver;
|
|
13
|
+
//# sourceMappingURL=provider-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-resolver.d.ts","sourceRoot":"","sources":["../src/provider-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,yBAAyB,EAC/B,MAAM,mCAAmC,CAAC;AAE3C,eAAO,MAAM,6BAA6B,kDAK/B,CAAC;AAEZ,MAAM,MAAM,oBAAoB,GAAG,OAAO,6BAA6B,CAAC,MAAM,CAAC,CAAC;AAWhF,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACpE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAEtF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,oBAAoB,CAEnF;AAqBD,0FAA0F;AAC1F,wBAAgB,gCAAgC,CAC9C,OAAO,GAAE,iCAAsC,GAC9C,yBAAyB,CAgD3B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { AcpRuntimeError, createBuiltinPresetRegistry, findExecutable, } from "@atom-workflow-agent/acp-provider";
|
|
4
|
+
export const BUILTIN_ACP_PROVIDER_PRIORITY = Object.freeze([
|
|
5
|
+
"traex",
|
|
6
|
+
"codex",
|
|
7
|
+
"claude-code",
|
|
8
|
+
"pi",
|
|
9
|
+
]);
|
|
10
|
+
const PROVIDER_ALIASES = Object.freeze({
|
|
11
|
+
trae: "traex",
|
|
12
|
+
traex: "traex",
|
|
13
|
+
codex: "codex",
|
|
14
|
+
claude: "claude-code",
|
|
15
|
+
"claude-code": "claude-code",
|
|
16
|
+
pi: "pi",
|
|
17
|
+
});
|
|
18
|
+
export function normalizeAcpProviderId(value) {
|
|
19
|
+
return PROVIDER_ALIASES[value.trim().toLowerCase()];
|
|
20
|
+
}
|
|
21
|
+
export function isBuiltinAcpProviderId(value) {
|
|
22
|
+
return BUILTIN_ACP_PROVIDER_PRIORITY.some((provider) => provider === value);
|
|
23
|
+
}
|
|
24
|
+
async function firstExecutable(candidates, lookup) {
|
|
25
|
+
for (const candidate of candidates) {
|
|
26
|
+
const executable = await lookup(candidate);
|
|
27
|
+
if (executable)
|
|
28
|
+
return executable;
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
function configuredCommand(env, names) {
|
|
33
|
+
for (const name of names) {
|
|
34
|
+
const value = env[name]?.trim();
|
|
35
|
+
if (value)
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
/** Resolves local launch configuration without downloading packages or probing models. */
|
|
41
|
+
export function createDefaultAcpProviderResolver(options = {}) {
|
|
42
|
+
const env = options.env ?? process.env;
|
|
43
|
+
const home = options.homeDirectory ?? homedir();
|
|
44
|
+
const lookup = options.lookup ?? findExecutable;
|
|
45
|
+
const presets = createBuiltinPresetRegistry();
|
|
46
|
+
return async (requestedProviderId) => {
|
|
47
|
+
const providerId = normalizeAcpProviderId(requestedProviderId);
|
|
48
|
+
if (!providerId) {
|
|
49
|
+
throw new AcpRuntimeError("ACP_PROVIDER_UNAVAILABLE", `No built-in ACP provider resolver exists for '${requestedProviderId}'. Pass resolveProvider to createAcpClient().`);
|
|
50
|
+
}
|
|
51
|
+
if (providerId === "codex") {
|
|
52
|
+
const codex = await lookup("codex");
|
|
53
|
+
return presets.create("codex", codex ? { env: { CODEX_PATH: codex } } : {});
|
|
54
|
+
}
|
|
55
|
+
if (providerId === "traex") {
|
|
56
|
+
const explicit = configuredCommand(env, ["ATOM_WORKFLOW_AGENT_TRAE_ACP_COMMAND", "ATOM_WORKFLOW_AGENT_TRAEX_ACP_COMMAND"]);
|
|
57
|
+
const executable = await firstExecutable(explicit
|
|
58
|
+
? [explicit]
|
|
59
|
+
: ["traecli", "traex", join(home, ".local", "bin", "traecli"), join(home, ".local", "bin", "traex")], lookup);
|
|
60
|
+
if (executable)
|
|
61
|
+
return presets.create("traex", { command: executable });
|
|
62
|
+
throw new AcpRuntimeError("ACP_PROVIDER_UNAVAILABLE", "Trae ACP is unavailable. Install traecli/traex or configure ATOM_WORKFLOW_AGENT_TRAE_ACP_COMMAND.");
|
|
63
|
+
}
|
|
64
|
+
if (providerId === "claude-code") {
|
|
65
|
+
const explicit = configuredCommand(env, ["ATOM_WORKFLOW_AGENT_CLAUDE_CODE_EXECUTABLE", "CLAUDE_CODE_EXECUTABLE"]);
|
|
66
|
+
const claude = explicit
|
|
67
|
+
? await lookup(explicit)
|
|
68
|
+
: await firstExecutable(["claude", join(home, ".local", "bin", "claude")], lookup);
|
|
69
|
+
return presets.create("claude-code", claude ? { env: { CLAUDE_CODE_EXECUTABLE: claude } } : {});
|
|
70
|
+
}
|
|
71
|
+
const explicitPi = configuredCommand(env, ["ATOM_WORKFLOW_AGENT_PI_EXECUTABLE", "PI_ACP_PI_COMMAND"]);
|
|
72
|
+
const pi = explicitPi
|
|
73
|
+
? await lookup(explicitPi)
|
|
74
|
+
: await firstExecutable(["pi", join(home, ".local", "bin", "pi")], lookup);
|
|
75
|
+
if (!pi) {
|
|
76
|
+
throw new AcpRuntimeError("ACP_PROVIDER_UNAVAILABLE", "Pi ACP is unavailable. Install the pi CLI or configure ATOM_WORKFLOW_AGENT_PI_EXECUTABLE.");
|
|
77
|
+
}
|
|
78
|
+
return presets.create("pi", { env: { PI_ACP_PI_COMMAND: pi } });
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=provider-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-resolver.js","sourceRoot":"","sources":["../src/provider-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,cAAc,GAGf,MAAM,mCAAmC,CAAC;AAE3C,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,CAAC;IACzD,OAAO;IACP,OAAO;IACP,aAAa;IACb,IAAI;CACI,CAAC,CAAC;AAIZ,MAAM,gBAAgB,GAAmD,MAAM,CAAC,MAAM,CAAC;IACrF,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,aAAa;IACrB,aAAa,EAAE,aAAa;IAC5B,EAAE,EAAE,IAAI;CACT,CAAC,CAAC;AAQH,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,OAAO,gBAAgB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,OAAO,6BAA6B,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,UAA6B,EAC7B,MAAwD;IAExD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;QAC3C,IAAI,UAAU;YAAE,OAAO,UAAU,CAAC;IACpC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAsB,EAAE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EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7E,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,eAAe,CACvB,0BAA0B,EAC1B,2FAA2F,CAC5F,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atom-workflow-agent/acp-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Standalone ACP client SDK for Atom implementations and ordinary Node.js applications.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/joekbits/atom-workflow-agent.git",
|
|
9
|
+
"directory": "packages/acp-sdk"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/joekbits/atom-workflow-agent/tree/main/packages/acp-sdk#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/joekbits/atom-workflow-agent/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"acp",
|
|
17
|
+
"agent",
|
|
18
|
+
"sdk"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md",
|
|
24
|
+
"README.zh-CN.md"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"provenance": true
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=22"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@atom-workflow-agent/acp-provider": "0.1.0",
|
|
41
|
+
"@atom-workflow-agent/contracts": "0.1.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json",
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
46
|
+
"test": "vitest run"
|
|
47
|
+
}
|
|
48
|
+
}
|