@xenosystem/acp-provider-manager 0.1.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.
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +13 -0
- package/dist/certification.d.ts +28 -0
- package/dist/certification.d.ts.map +1 -0
- package/dist/certification.js +34 -0
- package/dist/certification.js.map +1 -0
- package/dist/executableDiscovery.d.ts +7 -0
- package/dist/executableDiscovery.d.ts.map +1 -0
- package/dist/executableDiscovery.js +22 -0
- package/dist/executableDiscovery.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/kimiUpdater.d.ts +8 -0
- package/dist/kimiUpdater.d.ts.map +1 -0
- package/dist/kimiUpdater.js +113 -0
- package/dist/kimiUpdater.js.map +1 -0
- package/dist/providerLifecycle.d.ts +87 -0
- package/dist/providerLifecycle.d.ts.map +1 -0
- package/dist/providerLifecycle.js +115 -0
- package/dist/providerLifecycle.js.map +1 -0
- package/dist/registry.d.ts +12 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +175 -0
- package/dist/registry.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
xeno-acp
|
|
2
|
+
Copyright 2026 XENO Corporation
|
|
3
|
+
|
|
4
|
+
This product includes software developed at XENO Corporation.
|
|
5
|
+
|
|
6
|
+
Built on the Agent Client Protocol SDK (@agentclientprotocol/sdk), Apache-2.0.
|
|
7
|
+
Drives external ACP agents (Claude Code, Codex, OpenCode, Gemini CLI) via their
|
|
8
|
+
official ACP adapters / native ACP modes, using the operator's own provider
|
|
9
|
+
credentials.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @xenosystem/acp-provider-manager
|
|
2
|
+
|
|
3
|
+
XENO ACP's provider-management domain package. It owns provider catalog normalization,
|
|
4
|
+
lifecycle/action decisions, native launcher metadata, update plans, and verified provider
|
|
5
|
+
updates. Desktop hosts inject platform I/O and render the returned state; they do not hardcode
|
|
6
|
+
provider behavior.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @xenosystem/acp-provider-manager
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This package performs policy and lifecycle decisions; the embedding host retains all process,
|
|
13
|
+
network, filesystem, and UI authority. Public beta. Apache-2.0.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type ProviderCertificationStatus = 'PASSED' | 'AUTHENTICATION_REQUIRED' | 'BLOCKED_BY_ENVIRONMENT' | 'FAILED_WITH_BUG' | 'FALLBACK_FIXTURE_ONLY';
|
|
2
|
+
export interface ProviderCertificationProbe {
|
|
3
|
+
success: boolean;
|
|
4
|
+
protocolVersion?: number;
|
|
5
|
+
agentInfo?: {
|
|
6
|
+
name?: string;
|
|
7
|
+
version?: string;
|
|
8
|
+
};
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ProviderCertificationRecord {
|
|
12
|
+
status: 'certified' | 'fixture_only' | 'authentication_required' | 'blocked_by_environment' | 'failed';
|
|
13
|
+
certifiedAt: string;
|
|
14
|
+
certifiedBy: 'harness';
|
|
15
|
+
protocolVersion?: number;
|
|
16
|
+
agentName: string;
|
|
17
|
+
agentVersion?: string;
|
|
18
|
+
notes?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function classifyProviderCertification(tested: ProviderCertificationProbe, fixtureSimulation: boolean): ProviderCertificationStatus;
|
|
21
|
+
export declare function createProviderCertificationRecord(input: {
|
|
22
|
+
status: ProviderCertificationStatus;
|
|
23
|
+
providerName: string;
|
|
24
|
+
tested?: ProviderCertificationProbe;
|
|
25
|
+
error?: string;
|
|
26
|
+
certifiedAt?: string;
|
|
27
|
+
}): ProviderCertificationRecord;
|
|
28
|
+
//# sourceMappingURL=certification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"certification.d.ts","sourceRoot":"","sources":["../src/certification.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GACnC,QAAQ,GACR,yBAAyB,GACzB,wBAAwB,GACxB,iBAAiB,GACjB,uBAAuB,CAAA;AAE3B,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAA;IAChB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,WAAW,GAAG,cAAc,GAAG,yBAAyB,GAAG,wBAAwB,GAAG,QAAQ,CAAA;IACtG,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,SAAS,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,0BAA0B,EAClC,iBAAiB,EAAE,OAAO,GACzB,2BAA2B,CAM7B;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,MAAM,EAAE,2BAA2B,CAAA;IACnC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,2BAA2B,CAkB9B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function classifyProviderCertification(tested, fixtureSimulation) {
|
|
2
|
+
if (tested.success && fixtureSimulation)
|
|
3
|
+
return 'FALLBACK_FIXTURE_ONLY';
|
|
4
|
+
if (tested.success)
|
|
5
|
+
return 'PASSED';
|
|
6
|
+
if (/\b(?:authentication|login|sign[ -]?in) required\b|\bnot authenticated\b/i.test(tested.error || ''))
|
|
7
|
+
return 'AUTHENTICATION_REQUIRED';
|
|
8
|
+
if (/ENOENT|not found|does not exist/i.test(tested.error || ''))
|
|
9
|
+
return 'BLOCKED_BY_ENVIRONMENT';
|
|
10
|
+
return 'FAILED_WITH_BUG';
|
|
11
|
+
}
|
|
12
|
+
export function createProviderCertificationRecord(input) {
|
|
13
|
+
return {
|
|
14
|
+
status: input.status === 'PASSED'
|
|
15
|
+
? 'certified'
|
|
16
|
+
: input.status === 'FALLBACK_FIXTURE_ONLY'
|
|
17
|
+
? 'fixture_only'
|
|
18
|
+
: input.status === 'AUTHENTICATION_REQUIRED'
|
|
19
|
+
? 'authentication_required'
|
|
20
|
+
: input.status === 'BLOCKED_BY_ENVIRONMENT'
|
|
21
|
+
? 'blocked_by_environment'
|
|
22
|
+
: 'failed',
|
|
23
|
+
certifiedAt: input.certifiedAt || new Date().toISOString(),
|
|
24
|
+
certifiedBy: 'harness',
|
|
25
|
+
protocolVersion: input.tested?.protocolVersion,
|
|
26
|
+
agentName: input.tested?.agentInfo?.name || input.providerName,
|
|
27
|
+
agentVersion: input.tested?.agentInfo?.version,
|
|
28
|
+
notes: input.error ? safeNote(input.error) : undefined,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function safeNote(value) {
|
|
32
|
+
return value.replace(/[\u0000-\u001f\u007f]/g, ' ').trim().slice(0, 500);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=certification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"certification.js","sourceRoot":"","sources":["../src/certification.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,6BAA6B,CAC3C,MAAkC,EAClC,iBAA0B;IAE1B,IAAI,MAAM,CAAC,OAAO,IAAI,iBAAiB;QAAE,OAAO,uBAAuB,CAAA;IACvE,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,QAAQ,CAAA;IACnC,IAAI,0EAA0E,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QAAE,OAAO,yBAAyB,CAAA;IACzI,IAAI,kCAAkC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QAAE,OAAO,wBAAwB,CAAA;IAChG,OAAO,iBAAiB,CAAA;AAC1B,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,KAMjD;IACC,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM,KAAK,QAAQ;YAC/B,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,uBAAuB;gBACxC,CAAC,CAAC,cAAc;gBAChB,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,yBAAyB;oBAC1C,CAAC,CAAC,yBAAyB;oBAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,wBAAwB;wBACzC,CAAC,CAAC,wBAAwB;wBAC1B,CAAC,CAAC,QAAQ;QAClB,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC1D,WAAW,EAAE,SAAS;QACtB,eAAe,EAAE,KAAK,CAAC,MAAM,EAAE,eAAe;QAC9C,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,IAAI,KAAK,CAAC,YAAY;QAC9D,YAAY,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO;QAC9C,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS;KACvD,CAAA;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AAC1E,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select an executable returned by a host PATH lookup without accepting a platform-incompatible
|
|
3
|
+
* package-manager shim. In particular, npm installs an extensionless POSIX `#!/bin/sh` shim next
|
|
4
|
+
* to the Windows `.cmd` shim, and `where.exe` commonly returns the POSIX file first.
|
|
5
|
+
*/
|
|
6
|
+
export declare function selectProviderExecutableCandidate(candidates: readonly string[], platform?: NodeJS.Platform): string | undefined;
|
|
7
|
+
//# sourceMappingURL=executableDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executableDiscovery.d.ts","sourceRoot":"","sources":["../src/executableDiscovery.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC/C,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,MAAM,GAAG,SAAS,CAcpB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { posix, win32 } from 'node:path';
|
|
2
|
+
const WINDOWS_PROVIDER_EXECUTABLE_EXTENSIONS = new Set(['.exe', '.com', '.cmd', '.bat']);
|
|
3
|
+
/**
|
|
4
|
+
* Select an executable returned by a host PATH lookup without accepting a platform-incompatible
|
|
5
|
+
* package-manager shim. In particular, npm installs an extensionless POSIX `#!/bin/sh` shim next
|
|
6
|
+
* to the Windows `.cmd` shim, and `where.exe` commonly returns the POSIX file first.
|
|
7
|
+
*/
|
|
8
|
+
export function selectProviderExecutableCandidate(candidates, platform = process.platform) {
|
|
9
|
+
const normalized = candidates
|
|
10
|
+
.map((candidate) => candidate.trim())
|
|
11
|
+
.filter((candidate, index, all) => !!candidate && all.indexOf(candidate) === index);
|
|
12
|
+
if (platform === 'win32') {
|
|
13
|
+
return normalized.find((candidate) => {
|
|
14
|
+
if (!win32.isAbsolute(candidate))
|
|
15
|
+
return false;
|
|
16
|
+
const extension = win32.extname(candidate).toLowerCase();
|
|
17
|
+
return WINDOWS_PROVIDER_EXECUTABLE_EXTENSIONS.has(extension);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return normalized.find((candidate) => posix.isAbsolute(candidate));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=executableDiscovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executableDiscovery.js","sourceRoot":"","sources":["../src/executableDiscovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,sCAAsC,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAExF;;;;GAIG;AACH,MAAM,UAAU,iCAAiC,CAC/C,UAA6B,EAC7B,WAA4B,OAAO,CAAC,QAAQ;IAE5C,MAAM,UAAU,GAAG,UAAU;SAC1B,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;SACpC,MAAM,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,KAAK,CAAC,CAAA;IAErF,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;YACnC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;gBAAE,OAAO,KAAK,CAAA;YAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAA;YACxD,OAAO,sCAAsC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAC9D,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;AACpE,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,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProviderUpdatePlan } from './providerLifecycle.js';
|
|
2
|
+
export type ProviderUpdateFetch = (input: string, init?: RequestInit) => Promise<Response>;
|
|
3
|
+
export interface KimiUpdateOptions {
|
|
4
|
+
fetchImpl: ProviderUpdateFetch;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function installKimiNativeUpdate(input: ProviderUpdatePlan, options: KimiUpdateOptions): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=kimiUpdater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kimiUpdater.d.ts","sourceRoot":"","sources":["../src/kimiUpdater.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAOhE,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC1F,MAAM,WAAW,iBAAiB;IAAG,SAAS,EAAE,mBAAmB,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;AAEzF,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBlH"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { createHash } from 'crypto';
|
|
2
|
+
import { chmodSync, existsSync, lstatSync, renameSync, unlinkSync, writeFileSync } from 'fs';
|
|
3
|
+
import { basename, isAbsolute } from 'path';
|
|
4
|
+
const ORIGIN = 'https://code.kimi.com';
|
|
5
|
+
const ROOT = `${ORIGIN}/kimi-code`;
|
|
6
|
+
const METADATA_LIMIT = 1024 * 1024;
|
|
7
|
+
const BINARY_LIMIT = 256 * 1024 * 1024;
|
|
8
|
+
export async function installKimiNativeUpdate(input, options) {
|
|
9
|
+
if (input.providerId !== 'kimi')
|
|
10
|
+
throw new Error('Provider update is not supported.');
|
|
11
|
+
const name = basename(input.command).toLowerCase();
|
|
12
|
+
if ((name !== 'kimi' && name !== 'kimi.exe') || !isAbsolute(input.command) || !existsSync(input.command))
|
|
13
|
+
throw new Error('The installed Kimi executable could not be found.');
|
|
14
|
+
const stat = lstatSync(input.command);
|
|
15
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
16
|
+
throw new Error('The installed Kimi executable is not a regular file.');
|
|
17
|
+
const timeout = options.timeoutMs || 30_000;
|
|
18
|
+
const version = (await get(`${ROOT}/latest`, options.fetchImpl, timeout, METADATA_LIMIT)).toString('utf8').trim();
|
|
19
|
+
if (!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(version))
|
|
20
|
+
throw new Error('Moonshot returned an invalid Kimi release version.');
|
|
21
|
+
const manifestBytes = await get(`${ROOT}/binaries/${encodeURIComponent(version)}/manifest.json`, options.fetchImpl, timeout, METADATA_LIMIT);
|
|
22
|
+
const manifest = parseManifest(manifestBytes.toString('utf8'), version);
|
|
23
|
+
const key = `${process.platform}-${process.arch}`;
|
|
24
|
+
const target = manifest.platforms[key];
|
|
25
|
+
if (!target || !/^kimi-code-(darwin|linux|win32)-(arm64|x64)(?:\.exe)?$/.test(target.filename) || !target.filename.includes(key) || !/^[a-f0-9]{64}$/i.test(target.checksum))
|
|
26
|
+
throw new Error('Moonshot returned an invalid Kimi binary target.');
|
|
27
|
+
const binary = await get(`${ROOT}/binaries/${encodeURIComponent(version)}/${encodeURIComponent(target.filename)}`, options.fetchImpl, Math.max(timeout, 120_000), BINARY_LIMIT);
|
|
28
|
+
if (!binary.length || createHash('sha256').update(binary).digest('hex') !== target.checksum.toLowerCase())
|
|
29
|
+
throw new Error('The downloaded Kimi binary failed checksum verification.');
|
|
30
|
+
installVerifiedBinary(input.command, binary);
|
|
31
|
+
}
|
|
32
|
+
async function get(url, fetchImpl, timeoutMs, maxBytes) {
|
|
33
|
+
const parsed = new URL(url);
|
|
34
|
+
if (parsed.origin !== ORIGIN || !parsed.pathname.startsWith('/kimi-code/'))
|
|
35
|
+
throw new Error('Kimi update URL is not allowed.');
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetchImpl(parsed.toString(), { method: 'GET', redirect: 'follow', signal: controller.signal });
|
|
40
|
+
if (response.url) {
|
|
41
|
+
const finalUrl = new URL(response.url);
|
|
42
|
+
if (finalUrl.origin !== ORIGIN || !finalUrl.pathname.startsWith('/kimi-code/'))
|
|
43
|
+
throw new Error('Kimi update redirect is not allowed.');
|
|
44
|
+
}
|
|
45
|
+
if (!response.ok)
|
|
46
|
+
throw new Error(`Moonshot update service returned HTTP ${response.status}.`);
|
|
47
|
+
const declared = Number(response.headers.get('content-length'));
|
|
48
|
+
if (Number.isFinite(declared) && declared > maxBytes)
|
|
49
|
+
throw new Error('Moonshot update response is too large.');
|
|
50
|
+
const body = Buffer.from(await response.arrayBuffer());
|
|
51
|
+
if (body.length > maxBytes)
|
|
52
|
+
throw new Error('Moonshot update response is too large.');
|
|
53
|
+
return body;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (controller.signal.aborted)
|
|
57
|
+
throw new Error('Kimi update request timed out.');
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
clearTimeout(timer);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function parseManifest(text, version) {
|
|
65
|
+
let value;
|
|
66
|
+
try {
|
|
67
|
+
value = JSON.parse(text);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
throw new Error('Moonshot returned an invalid Kimi update manifest.');
|
|
71
|
+
}
|
|
72
|
+
if (!value || typeof value !== 'object')
|
|
73
|
+
throw new Error('Moonshot returned an invalid Kimi update manifest.');
|
|
74
|
+
const manifest = value;
|
|
75
|
+
if (manifest.version !== version || !manifest.platforms || typeof manifest.platforms !== 'object')
|
|
76
|
+
throw new Error('Moonshot returned an invalid Kimi update manifest.');
|
|
77
|
+
return manifest;
|
|
78
|
+
}
|
|
79
|
+
function installVerifiedBinary(command, binary) {
|
|
80
|
+
const suffix = `${process.pid}-${Date.now()}-${createHash('sha256').update(binary).digest('hex').slice(0, 12)}`;
|
|
81
|
+
const temp = `${command}.xeno-update-${suffix}`;
|
|
82
|
+
const backup = `${command}.xeno-backup-${suffix}`;
|
|
83
|
+
let moved = false;
|
|
84
|
+
try {
|
|
85
|
+
writeFileSync(temp, binary, { flag: 'wx', mode: 0o755 });
|
|
86
|
+
if (process.platform !== 'win32')
|
|
87
|
+
chmodSync(temp, 0o755);
|
|
88
|
+
renameSync(command, backup);
|
|
89
|
+
moved = true;
|
|
90
|
+
renameSync(temp, command);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
if (moved && !existsSync(command) && existsSync(backup))
|
|
94
|
+
try {
|
|
95
|
+
renameSync(backup, command);
|
|
96
|
+
}
|
|
97
|
+
catch { /* preserve original error */ }
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
if (existsSync(temp))
|
|
102
|
+
try {
|
|
103
|
+
unlinkSync(temp);
|
|
104
|
+
}
|
|
105
|
+
catch { /* best effort */ }
|
|
106
|
+
}
|
|
107
|
+
if (existsSync(backup))
|
|
108
|
+
try {
|
|
109
|
+
unlinkSync(backup);
|
|
110
|
+
}
|
|
111
|
+
catch { /* running Windows executable */ }
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=kimiUpdater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kimiUpdater.js","sourceRoot":"","sources":["../src/kimiUpdater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAC5F,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAG3C,MAAM,MAAM,GAAG,uBAAuB,CAAA;AACtC,MAAM,IAAI,GAAG,GAAG,MAAM,YAAY,CAAA;AAClC,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAA;AAClC,MAAM,YAAY,GAAG,GAAG,G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M,EAAE,CAAA;IACjD,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,IAAI,CAAC;QACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;QACxD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;YAAE,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxD,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC3B,KAAK,GAAG,IAAI,CAAA;QACZ,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC;gBAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,6BAA6B,CAAC,CAAC;QACpI,MAAM,KAAK,CAAA;IACb,CAAC;YAAS,CAAC;QACT,IAAI,UAAU,CAAC,IAAI,CAAC;YAAE,IAAI,CAAC;gBAAC,UAAU,CAAC,IAAI,CAAC,CAAA;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,CAAC;QAAE,IAAI,CAAC;YAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,gCAAgC,CAAC,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export interface RegistryPackageDistribution {
|
|
2
|
+
package: string;
|
|
3
|
+
args?: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface RegistryBinaryTarget {
|
|
6
|
+
archive?: string;
|
|
7
|
+
cmd: string;
|
|
8
|
+
args?: string[];
|
|
9
|
+
sha256?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface RegistryAgentManifest {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
description: string;
|
|
16
|
+
repository?: string;
|
|
17
|
+
website?: string;
|
|
18
|
+
authors: string[];
|
|
19
|
+
license?: string;
|
|
20
|
+
icon?: string;
|
|
21
|
+
distribution: {
|
|
22
|
+
npx?: RegistryPackageDistribution;
|
|
23
|
+
uvx?: RegistryPackageDistribution;
|
|
24
|
+
binary?: Record<string, RegistryBinaryTarget>;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export type ProviderDistributionKind = 'binary' | 'npx' | 'uvx' | 'custom';
|
|
28
|
+
export type ProviderCatalogStatus = 'ready' | 'setting_up' | 'available' | 'disabled' | 'update_required' | 'needs_attention' | 'not_installed';
|
|
29
|
+
export type ProviderActionId = 'install' | 'enable' | 'disable' | 'update' | 'login' | 'certify' | 'configure';
|
|
30
|
+
export interface ProviderAction {
|
|
31
|
+
id: ProviderActionId;
|
|
32
|
+
label: string;
|
|
33
|
+
mode: 'automatic' | 'external';
|
|
34
|
+
}
|
|
35
|
+
export interface ProviderLifecycleInput {
|
|
36
|
+
manifest: RegistryAgentManifest;
|
|
37
|
+
configured: boolean;
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
setupInProgress?: boolean;
|
|
40
|
+
certificationStatus?: string;
|
|
41
|
+
certificationMessage?: string;
|
|
42
|
+
readiness?: {
|
|
43
|
+
ok: boolean;
|
|
44
|
+
status: string;
|
|
45
|
+
message: string;
|
|
46
|
+
updateHint?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface ProviderLifecycle {
|
|
50
|
+
status: ProviderCatalogStatus;
|
|
51
|
+
statusMessage: string;
|
|
52
|
+
canAutoSetup: boolean;
|
|
53
|
+
primaryAction?: ProviderAction;
|
|
54
|
+
availableActions: ProviderAction[];
|
|
55
|
+
}
|
|
56
|
+
export interface ProviderUpdatePlan {
|
|
57
|
+
providerId: 'kimi';
|
|
58
|
+
command: string;
|
|
59
|
+
cwd?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface ProviderBinaryInstallPlan {
|
|
62
|
+
archiveUrl: string;
|
|
63
|
+
sha256: string;
|
|
64
|
+
command: string;
|
|
65
|
+
args: string[];
|
|
66
|
+
}
|
|
67
|
+
export declare function nativeLauncherFor(providerId: string): {
|
|
68
|
+
executable: string;
|
|
69
|
+
args: string[];
|
|
70
|
+
} | undefined;
|
|
71
|
+
export declare function providerConfigIds(providerId: string): string[];
|
|
72
|
+
export declare function providerConfigId(providerId: string): string;
|
|
73
|
+
export declare function providerPlatformTarget(platform?: NodeJS.Platform, arch?: NodeJS.Architecture): string;
|
|
74
|
+
export declare function providerDistributionKind(manifest: RegistryAgentManifest): ProviderDistributionKind;
|
|
75
|
+
export declare function canAutomaticallyInstallProvider(manifest: RegistryAgentManifest): boolean;
|
|
76
|
+
export declare function resolveProviderBinaryInstallPlan(manifest: RegistryAgentManifest, platform?: NodeJS.Platform, arch?: NodeJS.Architecture): ProviderBinaryInstallPlan | undefined;
|
|
77
|
+
export declare function resolveProviderLifecycle(input: ProviderLifecycleInput): ProviderLifecycle;
|
|
78
|
+
export declare function canAutomaticallyCertifyProvider(readiness?: {
|
|
79
|
+
ok: boolean;
|
|
80
|
+
status: string;
|
|
81
|
+
}): boolean;
|
|
82
|
+
export declare function resolveProviderUpdatePlan(manifest: RegistryAgentManifest, agent: {
|
|
83
|
+
command: string;
|
|
84
|
+
args: string[];
|
|
85
|
+
cwd?: string;
|
|
86
|
+
}): ProviderUpdatePlan | undefined;
|
|
87
|
+
//# sourceMappingURL=providerLifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providerLifecycle.d.ts","sourceRoot":"","sources":["../src/providerLifecycle.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAA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AAG,wBAAwB,CAKlG;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,qBAAqB,GAAG,OAAO,CAIxF;AAED,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,qBAAqB,EAC/B,QAAQ,kBAAmB,EAC3B,IAAI,sBAAe,GAClB,yBAAyB,GAAG,SAAS,CASvC;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAgDzF;AAED,wBAAgB,+BAA+B,CAAC,SAAS,CAAC,EAAE;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAEpG;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,GAAG,SAAS,CAInK"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
const NATIVE_LAUNCHERS = Object.freeze({
|
|
2
|
+
kimi: { executable: 'kimi', args: ['acp'] },
|
|
3
|
+
gemini: { executable: 'gemini', args: ['--acp'] },
|
|
4
|
+
opencode: { executable: 'opencode', args: ['acp'] },
|
|
5
|
+
});
|
|
6
|
+
const LEGACY_CONFIG_IDS = Object.freeze({
|
|
7
|
+
'claude-acp': ['claude-local'],
|
|
8
|
+
'codex-acp': ['codex-local'],
|
|
9
|
+
kimi: ['kimi'],
|
|
10
|
+
gemini: ['gemini'],
|
|
11
|
+
opencode: ['opencode'],
|
|
12
|
+
});
|
|
13
|
+
export function nativeLauncherFor(providerId) {
|
|
14
|
+
const launcher = NATIVE_LAUNCHERS[providerId];
|
|
15
|
+
return launcher ? { executable: launcher.executable, args: [...launcher.args] } : undefined;
|
|
16
|
+
}
|
|
17
|
+
export function providerConfigIds(providerId) {
|
|
18
|
+
const canonical = providerConfigId(providerId);
|
|
19
|
+
return [providerId, canonical, ...(LEGACY_CONFIG_IDS[providerId] || [])];
|
|
20
|
+
}
|
|
21
|
+
export function providerConfigId(providerId) {
|
|
22
|
+
return providerId === 'kimi' || providerId === 'gemini' || providerId === 'opencode'
|
|
23
|
+
? providerId
|
|
24
|
+
: `registry-${providerId}`;
|
|
25
|
+
}
|
|
26
|
+
export function providerPlatformTarget(platform = process.platform, arch = process.arch) {
|
|
27
|
+
const normalizedPlatform = platform === 'win32' ? 'windows' : platform;
|
|
28
|
+
const normalizedArch = arch === 'arm64' ? 'aarch64' : arch === 'x64' ? 'x86_64' : arch;
|
|
29
|
+
return `${normalizedPlatform}-${normalizedArch}`;
|
|
30
|
+
}
|
|
31
|
+
export function providerDistributionKind(manifest) {
|
|
32
|
+
if (manifest.distribution.npx)
|
|
33
|
+
return 'npx';
|
|
34
|
+
if (manifest.distribution.uvx)
|
|
35
|
+
return 'uvx';
|
|
36
|
+
if (manifest.distribution.binary)
|
|
37
|
+
return 'binary';
|
|
38
|
+
return 'custom';
|
|
39
|
+
}
|
|
40
|
+
export function canAutomaticallyInstallProvider(manifest) {
|
|
41
|
+
if (nativeLauncherFor(manifest.id) || manifest.distribution.npx || manifest.distribution.uvx)
|
|
42
|
+
return true;
|
|
43
|
+
const target = manifest.distribution.binary?.[providerPlatformTarget()];
|
|
44
|
+
return !!target?.archive && /^https:\/\//i.test(target.archive) && /^[a-f0-9]{64}$/i.test(target.sha256 || '');
|
|
45
|
+
}
|
|
46
|
+
export function resolveProviderBinaryInstallPlan(manifest, platform = process.platform, arch = process.arch) {
|
|
47
|
+
const target = manifest.distribution.binary?.[providerPlatformTarget(platform, arch)];
|
|
48
|
+
if (!target?.archive || !/^https:\/\//i.test(target.archive) || !/^[a-f0-9]{64}$/i.test(target.sha256 || ''))
|
|
49
|
+
return undefined;
|
|
50
|
+
return {
|
|
51
|
+
archiveUrl: target.archive,
|
|
52
|
+
sha256: target.sha256.toLowerCase(),
|
|
53
|
+
command: target.cmd,
|
|
54
|
+
args: [...(target.args || [])],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function resolveProviderLifecycle(input) {
|
|
58
|
+
const canAutoSetup = canAutomaticallyInstallProvider(input.manifest);
|
|
59
|
+
if (!input.configured) {
|
|
60
|
+
const action = canAutoSetup
|
|
61
|
+
? { id: 'enable', label: 'Enable', mode: 'automatic' }
|
|
62
|
+
: { id: 'install', label: 'Install', mode: 'external' };
|
|
63
|
+
return {
|
|
64
|
+
status: canAutoSetup ? 'available' : 'not_installed',
|
|
65
|
+
statusMessage: canAutoSetup
|
|
66
|
+
? 'Ready for automatic setup.'
|
|
67
|
+
: 'Install the provider CLI, then XENO ACP will detect and certify it.',
|
|
68
|
+
canAutoSetup,
|
|
69
|
+
primaryAction: action,
|
|
70
|
+
availableActions: [action],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (!input.enabled) {
|
|
74
|
+
const action = { id: 'enable', label: 'Enable', mode: 'automatic' };
|
|
75
|
+
return { status: 'disabled', statusMessage: 'Disabled.', canAutoSetup, primaryAction: action, availableActions: [action, { id: 'configure', label: 'Configure', mode: 'automatic' }] };
|
|
76
|
+
}
|
|
77
|
+
if (input.setupInProgress) {
|
|
78
|
+
return { status: 'setting_up', statusMessage: 'Automatic setup is in progress.', canAutoSetup, availableActions: [{ id: 'disable', label: 'Disable', mode: 'automatic' }] };
|
|
79
|
+
}
|
|
80
|
+
if (input.readiness && !input.readiness.ok && input.readiness.status !== 'not_applicable') {
|
|
81
|
+
const update = input.readiness.status === 'outdated';
|
|
82
|
+
const action = update
|
|
83
|
+
? { id: 'update', label: 'Update', mode: input.manifest.id === 'kimi' ? 'automatic' : 'external' }
|
|
84
|
+
: { id: 'configure', label: 'Configure', mode: 'automatic' };
|
|
85
|
+
return {
|
|
86
|
+
status: update ? 'update_required' : 'needs_attention',
|
|
87
|
+
statusMessage: input.readiness.updateHint || input.readiness.message,
|
|
88
|
+
canAutoSetup,
|
|
89
|
+
primaryAction: action,
|
|
90
|
+
availableActions: [action, { id: 'disable', label: 'Disable', mode: 'automatic' }],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (input.certificationStatus === 'certified') {
|
|
94
|
+
return { status: 'ready', statusMessage: 'Enabled and ready.', canAutoSetup, availableActions: [{ id: 'disable', label: 'Disable', mode: 'automatic' }, { id: 'configure', label: 'Configure', mode: 'automatic' }] };
|
|
95
|
+
}
|
|
96
|
+
if (input.certificationStatus === 'authentication_required') {
|
|
97
|
+
const action = { id: 'login', label: 'Sign in', mode: 'external' };
|
|
98
|
+
return { status: 'needs_attention', statusMessage: input.certificationMessage || 'Provider authentication is required.', canAutoSetup, primaryAction: action, availableActions: [action, { id: 'disable', label: 'Disable', mode: 'automatic' }] };
|
|
99
|
+
}
|
|
100
|
+
if (input.certificationStatus === 'failed' || input.certificationStatus === 'blocked_by_environment') {
|
|
101
|
+
const action = { id: 'certify', label: 'Verify again', mode: 'automatic' };
|
|
102
|
+
return { status: 'needs_attention', statusMessage: input.certificationMessage || 'Automatic setup needs attention.', canAutoSetup, primaryAction: action, availableActions: [action, { id: 'disable', label: 'Disable', mode: 'automatic' }] };
|
|
103
|
+
}
|
|
104
|
+
return { status: 'setting_up', statusMessage: 'Automatic setup is in progress.', canAutoSetup, availableActions: [{ id: 'disable', label: 'Disable', mode: 'automatic' }] };
|
|
105
|
+
}
|
|
106
|
+
export function canAutomaticallyCertifyProvider(readiness) {
|
|
107
|
+
return !readiness || readiness.ok || readiness.status === 'not_applicable';
|
|
108
|
+
}
|
|
109
|
+
export function resolveProviderUpdatePlan(manifest, agent) {
|
|
110
|
+
const commandName = agent.command.replace(/^.*[\\/]/, '').toLowerCase().replace(/\.(exe|cmd|bat)$/i, '');
|
|
111
|
+
if (manifest.id !== 'kimi' || commandName !== 'kimi' || !agent.args.some((arg) => arg.toLowerCase() === 'acp'))
|
|
112
|
+
return undefined;
|
|
113
|
+
return { providerId: 'kimi', command: agent.command, cwd: agent.cwd };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IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAChI,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAA;AACvE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RegistryAgentManifest } from './providerLifecycle.js';
|
|
2
|
+
export declare const ACP_PROVIDER_REGISTRY_URL = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json";
|
|
3
|
+
export interface RegistryDocument {
|
|
4
|
+
version: string;
|
|
5
|
+
agents: RegistryAgentManifest[];
|
|
6
|
+
}
|
|
7
|
+
export type ProviderRegistryFetch = (input: string, init?: RequestInit) => Promise<Response>;
|
|
8
|
+
export declare function fetchOfficialProviderRegistry(fetchImpl: ProviderRegistryFetch, timeoutMs?: number): Promise<unknown>;
|
|
9
|
+
export declare function normalizeProviderRegistry(value: unknown): RegistryDocument | undefined;
|
|
10
|
+
export declare function fallbackProviderRegistry(platform?: NodeJS.Platform, arch?: NodeJS.Architecture): RegistryDocument;
|
|
11
|
+
export declare function normalizeProviderHttpsUrl(value: unknown): string | undefined;
|
|
12
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,wBAAwB,CAAA;AAE/B,eAAO,MAAM,yBAAyB,yEAAyE,CAAA;AAE/G,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,qBAAqB,EAAE,CAAA;CAChC;AAED,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAE5F,wBAAsB,6BAA6B,CACjD,SAAS,EAAE,qBAAqB,EAChC,SAAS,SAAS,GACjB,OAAO,CAAC,OAAO,CAAC,CAkBlB;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAYtF;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,kBAAmB,EAAE,IAAI,sBAAe,GAAG,gBAAgB,CAmB3G;AAiED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAO5E"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { providerPlatformTarget, } from './providerLifecycle.js';
|
|
2
|
+
export const ACP_PROVIDER_REGISTRY_URL = 'https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json';
|
|
3
|
+
export async function fetchOfficialProviderRegistry(fetchImpl, timeoutMs = 10_000) {
|
|
4
|
+
const controller = new AbortController();
|
|
5
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
6
|
+
try {
|
|
7
|
+
const response = await fetchImpl(ACP_PROVIDER_REGISTRY_URL, {
|
|
8
|
+
method: 'GET',
|
|
9
|
+
headers: { Accept: 'application/json' },
|
|
10
|
+
redirect: 'follow',
|
|
11
|
+
signal: controller.signal,
|
|
12
|
+
});
|
|
13
|
+
if (!response.ok)
|
|
14
|
+
throw new Error(`Official ACP Registry request failed with status ${response.status}.`);
|
|
15
|
+
return response.json();
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (controller.signal.aborted)
|
|
19
|
+
throw new Error('Official ACP Registry request timed out.');
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
clearTimeout(timer);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function normalizeProviderRegistry(value) {
|
|
27
|
+
if (!isRecord(value) || !Array.isArray(value.agents))
|
|
28
|
+
return undefined;
|
|
29
|
+
const seen = new Set();
|
|
30
|
+
const agents = [];
|
|
31
|
+
for (const rawAgent of value.agents) {
|
|
32
|
+
const agent = normalizeManifest(rawAgent);
|
|
33
|
+
if (!agent || seen.has(agent.id))
|
|
34
|
+
continue;
|
|
35
|
+
seen.add(agent.id);
|
|
36
|
+
agents.push(agent);
|
|
37
|
+
}
|
|
38
|
+
if (!agents.length)
|
|
39
|
+
return undefined;
|
|
40
|
+
return { version: cleanString(value.version) || '1.0.0', agents };
|
|
41
|
+
}
|
|
42
|
+
export function fallbackProviderRegistry(platform = process.platform, arch = process.arch) {
|
|
43
|
+
const target = providerPlatformTarget(platform, arch);
|
|
44
|
+
return {
|
|
45
|
+
version: '1.0.0-fallback',
|
|
46
|
+
agents: [
|
|
47
|
+
packageManifest('claude-acp', 'Claude Agent', "ACP wrapper for Anthropic's Claude", '@agentclientprotocol/claude-agent-acp@latest'),
|
|
48
|
+
packageManifest('codex-acp', 'Codex', "ACP adapter for OpenAI's coding assistant", '@agentclientprotocol/codex-acp@latest'),
|
|
49
|
+
packageManifest('gemini', 'Gemini CLI', "Google's official CLI for Gemini", '@google/gemini-cli@latest', ['--acp']),
|
|
50
|
+
packageManifest('glm-acp-agent', 'GLM Agent', 'GLM coding agent over ACP', 'glm-acp-agent@latest'),
|
|
51
|
+
{
|
|
52
|
+
id: 'kimi', name: 'Kimi CLI', version: 'latest', description: "Moonshot AI's coding assistant", authors: ['Moonshot AI'],
|
|
53
|
+
distribution: { binary: { [target]: { cmd: platform === 'win32' ? './kimi.exe' : './kimi', args: ['acp'] } } },
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'opencode', name: 'OpenCode', version: 'latest', description: 'The open source coding agent', authors: ['Anomaly'],
|
|
57
|
+
distribution: { binary: { [target]: { cmd: platform === 'win32' ? './opencode.exe' : './opencode', args: ['acp'] } } },
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function normalizeManifest(value) {
|
|
63
|
+
if (!isRecord(value) || !isRecord(value.distribution))
|
|
64
|
+
return undefined;
|
|
65
|
+
const id = cleanString(value.id);
|
|
66
|
+
const name = cleanString(value.name);
|
|
67
|
+
const version = cleanString(value.version);
|
|
68
|
+
const description = cleanString(value.description);
|
|
69
|
+
if (!id || !/^[a-z][a-z0-9-]*$/.test(id) || !name || !version || !description)
|
|
70
|
+
return undefined;
|
|
71
|
+
const distribution = normalizeDistribution(value.distribution);
|
|
72
|
+
if (!distribution.npx && !distribution.uvx && !distribution.binary)
|
|
73
|
+
return undefined;
|
|
74
|
+
return {
|
|
75
|
+
id,
|
|
76
|
+
name: safeText(name, 160),
|
|
77
|
+
version: safeText(version, 80),
|
|
78
|
+
description: safeText(description, 500),
|
|
79
|
+
repository: normalizeProviderHttpsUrl(value.repository),
|
|
80
|
+
website: normalizeProviderHttpsUrl(value.website),
|
|
81
|
+
authors: Array.isArray(value.authors)
|
|
82
|
+
? value.authors.filter((author) => typeof author === 'string').slice(0, 10).map((author) => safeText(author, 160))
|
|
83
|
+
: [],
|
|
84
|
+
license: cleanString(value.license) ? safeText(cleanString(value.license), 80) : undefined,
|
|
85
|
+
icon: normalizeProviderHttpsUrl(value.icon),
|
|
86
|
+
distribution,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function normalizeDistribution(value) {
|
|
90
|
+
const npx = normalizePackageDistribution(value.npx, 'npx');
|
|
91
|
+
const uvx = normalizePackageDistribution(value.uvx, 'uvx');
|
|
92
|
+
const binary = {};
|
|
93
|
+
if (isRecord(value.binary)) {
|
|
94
|
+
for (const [target, raw] of Object.entries(value.binary)) {
|
|
95
|
+
if (!/^[a-z0-9_-]+-[a-z0-9_-]+$/i.test(target) || !isRecord(raw))
|
|
96
|
+
continue;
|
|
97
|
+
const cmd = safeCommand(raw.cmd);
|
|
98
|
+
if (!cmd)
|
|
99
|
+
continue;
|
|
100
|
+
const args = safeArgumentArray(raw.args);
|
|
101
|
+
if (raw.args !== undefined && !args)
|
|
102
|
+
continue;
|
|
103
|
+
binary[target] = {
|
|
104
|
+
cmd,
|
|
105
|
+
archive: normalizeProviderHttpsUrl(raw.archive),
|
|
106
|
+
...(args?.length ? { args } : {}),
|
|
107
|
+
sha256: cleanString(raw.sha256),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return { npx, uvx, binary: Object.keys(binary).length ? binary : undefined };
|
|
112
|
+
}
|
|
113
|
+
function normalizePackageDistribution(value, kind) {
|
|
114
|
+
if (!isRecord(value))
|
|
115
|
+
return undefined;
|
|
116
|
+
const packageName = cleanString(value.package);
|
|
117
|
+
if (!packageName || !safePackageSpec(packageName, kind))
|
|
118
|
+
return undefined;
|
|
119
|
+
const args = safeArgumentArray(value.args);
|
|
120
|
+
if (value.args !== undefined && !args)
|
|
121
|
+
return undefined;
|
|
122
|
+
return { package: packageName, ...(args?.length ? { args } : {}) };
|
|
123
|
+
}
|
|
124
|
+
function packageManifest(id, name, description, packageName, args = []) {
|
|
125
|
+
return { id, name, version: 'latest', description, authors: [], distribution: { npx: { package: packageName, args } } };
|
|
126
|
+
}
|
|
127
|
+
export function normalizeProviderHttpsUrl(value) {
|
|
128
|
+
const raw = cleanString(value);
|
|
129
|
+
if (!raw)
|
|
130
|
+
return undefined;
|
|
131
|
+
try {
|
|
132
|
+
const url = new URL(raw);
|
|
133
|
+
return url.protocol === 'https:' ? url.toString() : undefined;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function safeText(value, maxLength) {
|
|
140
|
+
return value.replace(/[\u0000-\u001f\u007f]/g, ' ').trim().slice(0, maxLength);
|
|
141
|
+
}
|
|
142
|
+
function safePackageSpec(value, kind) {
|
|
143
|
+
if (value.length > 240 || /[\u0000-\u0020\u007f]/.test(value))
|
|
144
|
+
return false;
|
|
145
|
+
if (kind === 'npx') {
|
|
146
|
+
return /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*(?:@[a-z0-9][a-z0-9._+~-]*)?$/i.test(value);
|
|
147
|
+
}
|
|
148
|
+
return /^[a-z0-9][a-z0-9._-]*(?:(?:==|@)[a-z0-9][a-z0-9._+~-]*)?$/i.test(value);
|
|
149
|
+
}
|
|
150
|
+
function safeArgumentArray(value) {
|
|
151
|
+
if (value === undefined)
|
|
152
|
+
return [];
|
|
153
|
+
if (!Array.isArray(value) || value.length > 64)
|
|
154
|
+
return undefined;
|
|
155
|
+
const result = [];
|
|
156
|
+
for (const item of value) {
|
|
157
|
+
if (typeof item !== 'string' || item.length > 2_000 || /[\u0000\r\n]/.test(item))
|
|
158
|
+
return undefined;
|
|
159
|
+
result.push(item);
|
|
160
|
+
}
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
function safeCommand(value) {
|
|
164
|
+
const command = cleanString(value);
|
|
165
|
+
if (!command || command.length > 2_000 || /[\u0000\r\n]/.test(command))
|
|
166
|
+
return undefined;
|
|
167
|
+
return command;
|
|
168
|
+
}
|
|
169
|
+
function cleanString(value) {
|
|
170
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
171
|
+
}
|
|
172
|
+
function isRecord(value) {
|
|
173
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAIvB,MAAM,wBAAwB,CAAA;AAE/B,MAAM,CAAC,MAAM,yBAAyB,GAAG,sEAAsE,CAAA;AAS/G,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,SAAgC,EAChC,SAAS,GAAG,MAAM;IAElB,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAA;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
|
|
1
|
+
{
|
|
2
|
+
"name": "@xenosystem/acp-provider-manager",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Provider catalog, lifecycle, installation and update policy for XENO ACP consumers.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"NOTICE"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=20"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"acp",
|
|
26
|
+
"agent-client-protocol",
|
|
27
|
+
"provider-management",
|
|
28
|
+
"ai-agent",
|
|
29
|
+
"xeno"
|
|
30
|
+
],
|
|
31
|
+
"homepage": "https://xenostudio.ai/product/acp",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/XENO-CORPORATION/xeno-acp.git",
|
|
35
|
+
"directory": "packages/provider-manager"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/XENO-CORPORATION/xeno-acp/issues"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^22.9.0",
|
|
45
|
+
"typescript": "^5.6.3"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "tsc -p tsconfig.json",
|
|
49
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
50
|
+
"clean": "rimraf dist *.tsbuildinfo"
|
|
51
|
+
}
|
|
52
|
+
}
|