@itsthelore/proofkeeper 2026.6.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/NOTICE +10 -0
- package/README.md +207 -0
- package/dist/agent/adapters/claude.d.ts +93 -0
- package/dist/agent/adapters/claude.d.ts.map +1 -0
- package/dist/agent/adapters/claude.js +96 -0
- package/dist/agent/adapters/claude.js.map +1 -0
- package/dist/agent/drive.d.ts +53 -0
- package/dist/agent/drive.d.ts.map +1 -0
- package/dist/agent/drive.js +194 -0
- package/dist/agent/drive.js.map +1 -0
- package/dist/agent/loop.d.ts +40 -0
- package/dist/agent/loop.d.ts.map +1 -0
- package/dist/agent/loop.js +29 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/model.d.ts +43 -0
- package/dist/agent/model.d.ts.map +1 -0
- package/dist/agent/model.js +10 -0
- package/dist/agent/model.js.map +1 -0
- package/dist/agent/observe.d.ts +48 -0
- package/dist/agent/observe.d.ts.map +1 -0
- package/dist/agent/observe.js +65 -0
- package/dist/agent/observe.js.map +1 -0
- package/dist/agent/tools.d.ts +74 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +257 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/cli.d.ts +61 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +648 -0
- package/dist/cli.js.map +1 -0
- package/dist/compiler/actions.d.ts +101 -0
- package/dist/compiler/actions.d.ts.map +1 -0
- package/dist/compiler/actions.js +13 -0
- package/dist/compiler/actions.js.map +1 -0
- package/dist/compiler/compiler.d.ts +25 -0
- package/dist/compiler/compiler.d.ts.map +1 -0
- package/dist/compiler/compiler.js +42 -0
- package/dist/compiler/compiler.js.map +1 -0
- package/dist/compiler/emit.d.ts +21 -0
- package/dist/compiler/emit.d.ts.map +1 -0
- package/dist/compiler/emit.js +164 -0
- package/dist/compiler/emit.js.map +1 -0
- package/dist/compiler/http.d.ts +30 -0
- package/dist/compiler/http.d.ts.map +1 -0
- package/dist/compiler/http.js +30 -0
- package/dist/compiler/http.js.map +1 -0
- package/dist/compiler/recorder.d.ts +62 -0
- package/dist/compiler/recorder.d.ts.map +1 -0
- package/dist/compiler/recorder.js +148 -0
- package/dist/compiler/recorder.js.map +1 -0
- package/dist/compiler/summary.d.ts +11 -0
- package/dist/compiler/summary.d.ts.map +1 -0
- package/dist/compiler/summary.js +56 -0
- package/dist/compiler/summary.js.map +1 -0
- package/dist/compiler/terminal.d.ts +42 -0
- package/dist/compiler/terminal.d.ts.map +1 -0
- package/dist/compiler/terminal.js +47 -0
- package/dist/compiler/terminal.js.map +1 -0
- package/dist/compiler/types.d.ts +25 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/types.js +10 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/coverage/graph.d.ts +55 -0
- package/dist/coverage/graph.d.ts.map +1 -0
- package/dist/coverage/graph.js +87 -0
- package/dist/coverage/graph.js.map +1 -0
- package/dist/coverage/model.d.ts +36 -0
- package/dist/coverage/model.d.ts.map +1 -0
- package/dist/coverage/model.js +57 -0
- package/dist/coverage/model.js.map +1 -0
- package/dist/coverage/report.d.ts +27 -0
- package/dist/coverage/report.d.ts.map +1 -0
- package/dist/coverage/report.js +45 -0
- package/dist/coverage/report.js.map +1 -0
- package/dist/coverage/source.d.ts +23 -0
- package/dist/coverage/source.d.ts.map +1 -0
- package/dist/coverage/source.js +48 -0
- package/dist/coverage/source.js.map +1 -0
- package/dist/fidelity/gate.d.ts +34 -0
- package/dist/fidelity/gate.d.ts.map +1 -0
- package/dist/fidelity/gate.js +38 -0
- package/dist/fidelity/gate.js.map +1 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/learning/store.d.ts +44 -0
- package/dist/learning/store.d.ts.map +1 -0
- package/dist/learning/store.js +64 -0
- package/dist/learning/store.js.map +1 -0
- package/dist/qa/concurrency.d.ts +7 -0
- package/dist/qa/concurrency.d.ts.map +1 -0
- package/dist/qa/concurrency.js +21 -0
- package/dist/qa/concurrency.js.map +1 -0
- package/dist/qa/run-qa.d.ts +87 -0
- package/dist/qa/run-qa.d.ts.map +1 -0
- package/dist/qa/run-qa.js +106 -0
- package/dist/qa/run-qa.js.map +1 -0
- package/dist/qa/run-scoped.d.ts +82 -0
- package/dist/qa/run-scoped.d.ts.map +1 -0
- package/dist/qa/run-scoped.js +96 -0
- package/dist/qa/run-scoped.js.map +1 -0
- package/dist/runner/playwright-report.d.ts +52 -0
- package/dist/runner/playwright-report.d.ts.map +1 -0
- package/dist/runner/playwright-report.js +90 -0
- package/dist/runner/playwright-report.js.map +1 -0
- package/dist/runner/playwright-runner.d.ts +38 -0
- package/dist/runner/playwright-runner.d.ts.map +1 -0
- package/dist/runner/playwright-runner.js +73 -0
- package/dist/runner/playwright-runner.js.map +1 -0
- package/dist/runner/types.d.ts +45 -0
- package/dist/runner/types.d.ts.map +1 -0
- package/dist/runner/types.js +10 -0
- package/dist/runner/types.js.map +1 -0
- package/dist/scaffold/scaffold.d.ts +22 -0
- package/dist/scaffold/scaffold.d.ts.map +1 -0
- package/dist/scaffold/scaffold.js +34 -0
- package/dist/scaffold/scaffold.js.map +1 -0
- package/dist/scope/config.d.ts +89 -0
- package/dist/scope/config.d.ts.map +1 -0
- package/dist/scope/config.js +172 -0
- package/dist/scope/config.js.map +1 -0
- package/dist/scope/diff-scope.d.ts +31 -0
- package/dist/scope/diff-scope.d.ts.map +1 -0
- package/dist/scope/diff-scope.js +42 -0
- package/dist/scope/diff-scope.js.map +1 -0
- package/dist/scope/glob.d.ts +17 -0
- package/dist/scope/glob.d.ts.map +1 -0
- package/dist/scope/glob.js +50 -0
- package/dist/scope/glob.js.map +1 -0
- package/dist/writeback/comment.d.ts +103 -0
- package/dist/writeback/comment.d.ts.map +1 -0
- package/dist/writeback/comment.js +150 -0
- package/dist/writeback/comment.js.map +1 -0
- package/dist/writeback/gateways/github-rest.d.ts +66 -0
- package/dist/writeback/gateways/github-rest.d.ts.map +1 -0
- package/dist/writeback/gateways/github-rest.js +107 -0
- package/dist/writeback/gateways/github-rest.js.map +1 -0
- package/dist/writeback/merge.d.ts +27 -0
- package/dist/writeback/merge.d.ts.map +1 -0
- package/dist/writeback/merge.js +89 -0
- package/dist/writeback/merge.js.map +1 -0
- package/dist/writeback/proposal.d.ts +52 -0
- package/dist/writeback/proposal.d.ts.map +1 -0
- package/dist/writeback/proposal.js +79 -0
- package/dist/writeback/proposal.js.map +1 -0
- package/dist/writeback/proposer.d.ts +94 -0
- package/dist/writeback/proposer.d.ts.map +1 -0
- package/dist/writeback/proposer.js +79 -0
- package/dist/writeback/proposer.js.map +1 -0
- package/dist/writeback/verified-by.d.ts +56 -0
- package/dist/writeback/verified-by.d.ts.map +1 -0
- package/dist/writeback/verified-by.js +60 -0
- package/dist/writeback/verified-by.js.map +1 -0
- package/package.json +62 -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 Derivative
|
|
95
|
+
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, excluding
|
|
103
|
+
those notices that do not pertain to any part of the Derivative
|
|
104
|
+
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 do
|
|
117
|
+
not modify the License. You may add Your own attribution notices
|
|
118
|
+
within Derivative Works that You distribute, alongside or as an
|
|
119
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
120
|
+
additional attribution notices cannot be construed as modifying
|
|
121
|
+
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 2026 Tom Ballard and the Lore Proofkeeper contributors
|
|
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/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Lore Proofkeeper
|
|
2
|
+
Copyright 2026 Tom Ballard and the Lore Proofkeeper contributors
|
|
3
|
+
|
|
4
|
+
This product is part of the Lore family (https://github.com/itsthelore).
|
|
5
|
+
It is a contract consumer of Lore (RAC): it reads the published
|
|
6
|
+
`rac export --graph` contract and proposes `## Verified By` write-back links
|
|
7
|
+
through human-reviewed pull requests. It does not depend on or embed the Lore
|
|
8
|
+
engine's internals.
|
|
9
|
+
|
|
10
|
+
Licensed under the Apache License, Version 2.0. See the LICENSE file.
|
package/README.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Proofkeeper
|
|
2
|
+
|
|
3
|
+
<!--
|
|
4
|
+
Banner: add docs/assets/proofkeeper-header-{dark,light}.png, then uncomment.
|
|
5
|
+
<picture>
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/itsthelore/proofkeeper/main/docs/assets/proofkeeper-header-dark.png">
|
|
7
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/itsthelore/proofkeeper/main/docs/assets/proofkeeper-header-light.png">
|
|
8
|
+
<img alt="Proofkeeper — the verification arm of Lore. A BYOK agent that drives your app and proves every capability with a real test." src="https://raw.githubusercontent.com/itsthelore/proofkeeper/main/docs/assets/proofkeeper-header-light.png">
|
|
9
|
+
</picture>
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="#quickstart">Quickstart</a> ·
|
|
14
|
+
<a href="#how-it-compares">How it compares</a> ·
|
|
15
|
+
<a href="#how-it-works">How it works</a> ·
|
|
16
|
+
<a href="#write-back">Write-back</a> ·
|
|
17
|
+
<a href="#origin">Origin</a> ·
|
|
18
|
+
<a href="./CHANGELOG.md">Changelog</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="https://github.com/itsthelore/proofkeeper/actions/workflows/ci.yml"><img src="https://github.com/itsthelore/proofkeeper/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
23
|
+
<a href="https://www.npmjs.com/package/@itsthelore/proofkeeper"><img src="https://img.shields.io/npm/v/@itsthelore/proofkeeper" alt="npm"></a>
|
|
24
|
+
<img src="https://img.shields.io/badge/node-%E2%89%A520-blue" alt="Node >= 20">
|
|
25
|
+
<img src="https://img.shields.io/badge/types-TypeScript-blue.svg" alt="TypeScript">
|
|
26
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="License: Apache 2.0"></a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
> **rac-core captures what your product should do. Proofkeeper proves it does — a BYOK agent that drives your app and verifies each capability with a real test.**
|
|
30
|
+
|
|
31
|
+
[Lore (rac-core)](https://github.com/itsthelore/rac-core) keeps your product's capabilities as typed, read-only knowledge — requirements as code. Proofkeeper is the **verification arm** of that corpus: a bring-your-own-model agent that reads the capabilities Lore already records (over the published `rac export --graph` contract), drives your product to exercise each one, compiles the working session into a durable end-to-end test, and proposes linking that test back to the capability it proves. It produces **verification evidence and nothing else** — not code review, not codegen. It is a **contract consumer** of Lore, never an extension of its engine: Lore owns the knowledge; Proofkeeper produces and runs the evidence.
|
|
32
|
+
|
|
33
|
+
## How it compares
|
|
34
|
+
|
|
35
|
+
Proofkeeper isn't a record-and-watch tool or an automated reviewer — it turns an agent's exploratory run into a **re-runnable test a human reviews**. The differentiator is the durable artifact: a committed Playwright test plus its replayable trace, gated on fidelity, rather than a watch-once recording or a one-off review pass.
|
|
36
|
+
|
|
37
|
+
| | Proofkeeper | Record-and-watch (e.g. Devin) | Automated review (e.g. Factory) |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| Output of a verification | committed test **+ replayable trace** | watch-once annotated video | a review pass on the PR |
|
|
40
|
+
| Re-runnable | yes — `npx playwright test` | no | n/a |
|
|
41
|
+
| Flakiness handling | the **fidelity gate** (N green re-runs) | none | n/a |
|
|
42
|
+
| Knowledge write-back | `## Verified By` via PR (ADR-084) | proposes a Skill via PR | AGENTS.md conventions |
|
|
43
|
+
| Model | **bring your own** | bundled | bundled |
|
|
44
|
+
|
|
45
|
+
## Quickstart
|
|
46
|
+
|
|
47
|
+
1. **Install** dependencies (Node ≥ 20):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install && npm run build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. **See what's unverified** in a Lore corpus (shells out to `rac export --graph`, or pass a graph file):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
proofkeeper coverage --corpus path/to/rac/
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
3. **Scaffold** a config from the same graph (one capability per requirement):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
proofkeeper init --corpus path/to/rac/ --url http://localhost:3000
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
4. **Verify** a capability end-to-end — drive, compile, fidelity-gate, and (optionally) propose the write-back:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
ANTHROPIC_API_KEY=… proofkeeper qa --corpus path/to/rac/ --url http://localhost:3000/
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The bundled Claude adapter is used when `ANTHROPIC_API_KEY` is set; bring any other provider by calling `runQa()` from the library with your own `ModelClient`.
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
| Command | Gets you |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `npm install` | the library and the `proofkeeper` CLI |
|
|
78
|
+
| `npx playwright install chromium` | the browser the drive and runner need |
|
|
79
|
+
| `npm i @anthropic-ai/sdk` | the optional reference Claude adapter (BYO-model otherwise) |
|
|
80
|
+
|
|
81
|
+
Requires Node ≥ 20. Published as `@itsthelore/proofkeeper`; the CLI binary is `proofkeeper`. The model SDK is an **optional** peer dependency — installing Proofkeeper never pulls in a model.
|
|
82
|
+
|
|
83
|
+
## How it works
|
|
84
|
+
|
|
85
|
+
<!-- Given a capability Lore records, Proofkeeper drives → compiles → fidelity-gates → runs → proposes. -->
|
|
86
|
+
|
|
87
|
+
- **Drives** your product the way a developer would — an agent loop with a **browser, a terminal, and HTTP** (ADR-083, ADR-085), using *your* model. It records only what succeeds.
|
|
88
|
+
- **Compiles** that working session into a durable Playwright `.spec.ts` with a deterministic emitter — record and replay agree.
|
|
89
|
+
- **Gates on fidelity** by re-running each emitted test N times and keeping only the green, stable ones. This faithful session→test conversion is the moat.
|
|
90
|
+
- **Runs** the compiled suite fast, emitting a replayable trace per run.
|
|
91
|
+
- **Reports** which Lore capabilities are unverified, and proposes `## Verified By` links back to the corpus through a **human-reviewed pull request** (ADR-065) — never a direct write.
|
|
92
|
+
|
|
93
|
+
## The boundary
|
|
94
|
+
|
|
95
|
+
Proofkeeper is a **contract consumer** of Lore, and the boundary is load-bearing:
|
|
96
|
+
|
|
97
|
+
- **Reads the published contract only.** It consumes `rac export --graph` to learn which capabilities lack a verifying test. It never imports the Lore engine's internals.
|
|
98
|
+
- **Bring-your-own-model.** No model or inference is bundled; the agent runtime lives here, never in the Lore engine.
|
|
99
|
+
- **Write-back is a proposal, never a mutation.** It opens a pull request a human reviews (ADR-065) — it never writes a corpus directly.
|
|
100
|
+
- **Verification only.** Proofkeeper "produces verification evidence and nothing else"; code review and codegen are explicit non-goals, owned by sibling products.
|
|
101
|
+
|
|
102
|
+
## The coverage signal
|
|
103
|
+
|
|
104
|
+
A requirement node in `rac export --graph` is a product **capability**; the engine emits a typed `verified_by` edge from a capability to each test that verifies it (an external-target reference, ADR-084). A capability is **unverified** when it has no such edge — a pure, deterministic signal, no browser and no model required.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
proofkeeper coverage --graph-file graph.json # from a graph export
|
|
108
|
+
proofkeeper coverage --corpus path/to/rac/ --json # shell out to rac; machine-readable
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Exit codes are a stable contract: `0` everything verified, `1` one or more unverified (gates cleanly in CI), `2` usage error.
|
|
112
|
+
|
|
113
|
+
## Verify a capability
|
|
114
|
+
|
|
115
|
+
`proofkeeper qa` (alias `verify`) runs the whole loop behind one command: pick an unverified capability → drive → compile → fidelity → run → optionally propose the write-back. With `--config`, it scopes to a pull request — driving every unverified capability the changed files touch, concurrently and context-isolated, and posting the evidence as a single comment that updates in place.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Verify a specific capability and, when stable, open the write-back PR:
|
|
119
|
+
ANTHROPIC_API_KEY=… GITHUB_TOKEN=… proofkeeper qa \
|
|
120
|
+
--corpus path/to/rac/ --url http://localhost:3000/ \
|
|
121
|
+
--capability REQ-CHECKOUT --n 5 \
|
|
122
|
+
--propose --repo itsthelore/your-corpus --target-path rac/requirements/checkout.md
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Pass `--plan` to have the model write a human-readable test plan before driving. The drive has a **browser, a terminal, and HTTP**: `run_command` / `expect_output` / `expect_exit` for CLI capabilities, and `request` / `expect_status` / `expect_json` for API capabilities — a session may interleave all three.
|
|
126
|
+
|
|
127
|
+
## Write-back
|
|
128
|
+
|
|
129
|
+
Once a test is stable, Proofkeeper proposes linking it to the capability it verifies by opening a **human-reviewed pull request** against the target's Lore corpus — it never commits the base branch (ADR-065). The `## Verified By` section records bare reference paths (the test and its replayable trace), so the engine's `verified_by` edge targets stay clean. Repository operations go through an injected `RepoGateway`, so there is no hard GitHub dependency.
|
|
130
|
+
|
|
131
|
+
The PR carries readable evidence — a numbered step summary of the driven flow and a `npx playwright show-trace` hint — so a reviewer reads what was exercised, then re-runs the committed test to confirm. The merged artifact validates against the real engine, and the new `verified_by` edge flips the capability to verified in `proofkeeper coverage`.
|
|
132
|
+
|
|
133
|
+
## Bring your own model
|
|
134
|
+
|
|
135
|
+
Proofkeeper bundles no model — you implement `ModelClient` against your provider, or use the optional reference `ClaudeModelClient` (lazily imports `@anthropic-ai/sdk`).
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { AutonomousDriver, CodegenCompiler, PlaywrightRunner, assessFidelity } from "@itsthelore/proofkeeper";
|
|
139
|
+
import { chromium } from "@playwright/test";
|
|
140
|
+
|
|
141
|
+
const model = {
|
|
142
|
+
async complete(request) {
|
|
143
|
+
/* call your LLM with request.transcript and request.tools */
|
|
144
|
+
return { toolCalls: [/* { name, arguments } */] };
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const page = await (await chromium.launch()).newPage();
|
|
149
|
+
const { session } = await new AutonomousDriver(page, model, {
|
|
150
|
+
capabilityId: "REQ-VERIFY",
|
|
151
|
+
title: "verify flips status to verified",
|
|
152
|
+
startUrl: "http://localhost:3000/",
|
|
153
|
+
goal: "Click Verify and confirm the status changes to 'verified'.",
|
|
154
|
+
}).drive();
|
|
155
|
+
|
|
156
|
+
const candidate = await new CodegenCompiler({ outDir: "tests/generated" }).compile(session);
|
|
157
|
+
const verdict = await assessFidelity(new PlaywrightRunner(), candidate, {
|
|
158
|
+
n: 5,
|
|
159
|
+
target: { name: "dev", baseURL: "http://localhost:3000/" },
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Failure-learning
|
|
164
|
+
|
|
165
|
+
When a drive doesn't finish or its compiled test fails the fidelity gate, the run is recorded against the capability through a pluggable `LearningStore`. The next drive of that capability is handed the prior reasons, so the model steers away from the same dead ends. The config's `failureLearning` strategy controls how the catalog is *surfaced* — the default `suggest_in_report` adds a "Known failure modes" section to the scoped-QA PR comment; repo-writing strategies stay behind the propose-only boundary (ADR-065).
|
|
166
|
+
|
|
167
|
+
## Origin
|
|
168
|
+
|
|
169
|
+
Proofkeeper is a sibling of **[Lore / RAC](https://github.com/itsthelore/rac-core)**, split out because **verification is a runtime concern, not a knowledge one** — the same reasoning that separated [Wayfinder](https://github.com/itsthelore/wayfinder-router) (prompt-complexity routing) from the engine. Lore records *what* a product should do and serves it read-only; Proofkeeper drives the product to prove it does, and proposes the evidence back through a human-reviewed PR. The two compose over the published `rac export --graph` contract (ADR-063, ADR-083): no engine change is required, and the `verified_by` edge already exists in the engine. Proofkeeper produces and runs the evidence; Lore records it.
|
|
170
|
+
|
|
171
|
+
> **Naming.** The product is **Proofkeeper**; the display brand is **Lore Proofkeeper** where disambiguation helps. It is unrelated to Epic Games' "Lore" version-control system — different audience, different tool.
|
|
172
|
+
|
|
173
|
+
## Repository layout
|
|
174
|
+
|
|
175
|
+
```text
|
|
176
|
+
lore-proofkeeper/
|
|
177
|
+
src/ the library: coverage read-model, agent drive, session→test
|
|
178
|
+
compiler, fidelity gate, runner, and the write-back proposer
|
|
179
|
+
src/cli.ts the `proofkeeper` CLI (coverage, init, qa / verify)
|
|
180
|
+
lore-proofkeeper/ the dogfood corpus — the requirements, designs, and roadmap
|
|
181
|
+
that govern Proofkeeper itself (verified by its own tests)
|
|
182
|
+
tests/ vitest unit tests plus browser-gated e2e (PROOFKEEPER_E2E)
|
|
183
|
+
examples/ the demo corpus, product page, and generated specs
|
|
184
|
+
docs/ the build-shape and competitive notes
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Test
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm run typecheck # strict TypeScript
|
|
191
|
+
npm test # vitest unit tests (fast, hermetic — no browser)
|
|
192
|
+
npm run build # emit dist/
|
|
193
|
+
|
|
194
|
+
# Browser-driven end-to-end checks (real Chromium), opt-in:
|
|
195
|
+
npx playwright install chromium
|
|
196
|
+
PROOFKEEPER_E2E=1 npx vitest run tests/runner.integration.test.ts
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
The default `npm test` is fully hermetic. The browser-driven integration tests are gated behind `PROOFKEEPER_E2E` so they run only when you opt in (and in the CI `e2e` job).
|
|
200
|
+
|
|
201
|
+
## Project status
|
|
202
|
+
|
|
203
|
+
Proofkeeper is an early **v0.0.1** prototype, evolving quickly: the full drive → compile → fidelity → run → write-back pipeline works end-to-end against a real corpus graph, and Proofkeeper verifies its own capabilities (`proofkeeper coverage --corpus lore-proofkeeper/` reports them green). Contributions and experiments welcome — see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
[Apache-2.0](./LICENSE). Contributions require a DCO sign-off — see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reference {@link ModelClient} adapter for the Anthropic Claude API.
|
|
3
|
+
*
|
|
4
|
+
* Proofkeeper bundles no model (ADR-035, ADR-002) — this adapter is OPTIONAL
|
|
5
|
+
* and sits behind the `ModelClient` boundary. `@anthropic-ai/sdk` is an
|
|
6
|
+
* optional peer dependency, imported lazily, so installing Proofkeeper does not
|
|
7
|
+
* pull in a model SDK. Bring your own provider by implementing `ModelClient`
|
|
8
|
+
* directly; this adapter is one worked example, not a requirement.
|
|
9
|
+
*
|
|
10
|
+
* Defaults to `claude-opus-4-8`. The translation functions are pure and
|
|
11
|
+
* exported so the request/response mapping is unit-testable without the SDK or
|
|
12
|
+
* the network.
|
|
13
|
+
*/
|
|
14
|
+
import type { ModelClient, ModelRequest, ModelResponse } from "../model.js";
|
|
15
|
+
/** The model used unless overridden. */
|
|
16
|
+
export declare const DEFAULT_CLAUDE_MODEL = "claude-opus-4-8";
|
|
17
|
+
/** Minimal structural shape of the Anthropic Messages API we depend on. */
|
|
18
|
+
interface AnthropicCreateParams {
|
|
19
|
+
model: string;
|
|
20
|
+
max_tokens: number;
|
|
21
|
+
system?: string;
|
|
22
|
+
messages: {
|
|
23
|
+
role: "user" | "assistant";
|
|
24
|
+
content: string;
|
|
25
|
+
}[];
|
|
26
|
+
tools?: {
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
input_schema: Record<string, unknown>;
|
|
30
|
+
}[];
|
|
31
|
+
thinking?: {
|
|
32
|
+
type: "adaptive";
|
|
33
|
+
};
|
|
34
|
+
output_config?: {
|
|
35
|
+
effort: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface AnthropicContentBlock {
|
|
39
|
+
type: string;
|
|
40
|
+
text?: string;
|
|
41
|
+
name?: string;
|
|
42
|
+
input?: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
interface AnthropicMessage {
|
|
45
|
+
stop_reason?: string;
|
|
46
|
+
content: AnthropicContentBlock[];
|
|
47
|
+
}
|
|
48
|
+
/** The slice of the Anthropic SDK client this adapter calls. */
|
|
49
|
+
export interface AnthropicLike {
|
|
50
|
+
messages: {
|
|
51
|
+
create(params: AnthropicCreateParams): Promise<AnthropicMessage>;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ClaudeModelClientOptions {
|
|
55
|
+
/** API key; falls back to the ANTHROPIC_API_KEY environment variable. */
|
|
56
|
+
apiKey?: string;
|
|
57
|
+
/** Model id. Defaults to {@link DEFAULT_CLAUDE_MODEL}. */
|
|
58
|
+
model?: string;
|
|
59
|
+
/** Output token cap per turn. Defaults to 4096 (tool decisions are small). */
|
|
60
|
+
maxTokens?: number;
|
|
61
|
+
/** Enable adaptive thinking. Off by default to keep the text transcript self-contained. */
|
|
62
|
+
thinking?: boolean;
|
|
63
|
+
/** Optional effort level (low | medium | high | xhigh | max). */
|
|
64
|
+
effort?: "low" | "medium" | "high" | "xhigh" | "max";
|
|
65
|
+
/** Inject a pre-constructed client (or a test double); skips the SDK import. */
|
|
66
|
+
client?: AnthropicLike;
|
|
67
|
+
}
|
|
68
|
+
/** Split the transcript into the Anthropic `system` string and message turns. */
|
|
69
|
+
export declare function toAnthropicMessages(transcript: ModelRequest["transcript"]): {
|
|
70
|
+
system?: string;
|
|
71
|
+
messages: {
|
|
72
|
+
role: "user" | "assistant";
|
|
73
|
+
content: string;
|
|
74
|
+
}[];
|
|
75
|
+
};
|
|
76
|
+
/** Map Proofkeeper tool definitions to Anthropic tool definitions. */
|
|
77
|
+
export declare function toAnthropicTools(tools: ModelRequest["tools"]): {
|
|
78
|
+
name: string;
|
|
79
|
+
description: string;
|
|
80
|
+
input_schema: Record<string, unknown>;
|
|
81
|
+
}[];
|
|
82
|
+
/** Reduce an Anthropic response to a {@link ModelResponse}. */
|
|
83
|
+
export declare function fromAnthropicResponse(message: AnthropicMessage): ModelResponse;
|
|
84
|
+
export declare class ClaudeModelClient implements ModelClient {
|
|
85
|
+
private readonly options;
|
|
86
|
+
private client;
|
|
87
|
+
constructor(options?: ClaudeModelClientOptions);
|
|
88
|
+
/** Lazily construct the SDK client, importing the optional peer dependency. */
|
|
89
|
+
private getClient;
|
|
90
|
+
complete(request: ModelRequest): Promise<ModelResponse>;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
93
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/agent/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAY,MAAM,aAAa,CAAC;AAEtF,wCAAwC;AACxC,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD,2EAA2E;AAC3E,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5D,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAC;IACvF,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC;IAChC,aAAa,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAED,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,UAAU,gBAAgB;IACxB,WAAW,C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AA2B;IACnD,OAAO,CAAC,MAAM,CAA4B;gBAE9B,OAAO,GAAE,wBAA6B;IAKlD,+EAA+E;YACjE,SAAS;IAgBjB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;CAgB9D"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reference {@link ModelClient} adapter for the Anthropic Claude API.
|
|
3
|
+
*
|
|
4
|
+
* Proofkeeper bundles no model (ADR-035, ADR-002) — this adapter is OPTIONAL
|
|
5
|
+
* and sits behind the `ModelClient` boundary. `@anthropic-ai/sdk` is an
|
|
6
|
+
* optional peer dependency, imported lazily, so installing Proofkeeper does not
|
|
7
|
+
* pull in a model SDK. Bring your own provider by implementing `ModelClient`
|
|
8
|
+
* directly; this adapter is one worked example, not a requirement.
|
|
9
|
+
*
|
|
10
|
+
* Defaults to `claude-opus-4-8`. The translation functions are pure and
|
|
11
|
+
* exported so the request/response mapping is unit-testable without the SDK or
|
|
12
|
+
* the network.
|
|
13
|
+
*/
|
|
14
|
+
/** The model used unless overridden. */
|
|
15
|
+
export const DEFAULT_CLAUDE_MODEL = "claude-opus-4-8";
|
|
16
|
+
/** Split the transcript into the Anthropic `system` string and message turns. */
|
|
17
|
+
export function toAnthropicMessages(transcript) {
|
|
18
|
+
const systemParts = [];
|
|
19
|
+
const messages = [];
|
|
20
|
+
for (const turn of transcript) {
|
|
21
|
+
if (turn.role === "system") {
|
|
22
|
+
systemParts.push(turn.content);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
messages.push({ role: turn.role, content: turn.content });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const system = systemParts.length > 0 ? systemParts.join("\n\n") : undefined;
|
|
29
|
+
return system === undefined ? { messages } : { system, messages };
|
|
30
|
+
}
|
|
31
|
+
/** Map Proofkeeper tool definitions to Anthropic tool definitions. */
|
|
32
|
+
export function toAnthropicTools(tools) {
|
|
33
|
+
return tools.map((tool) => ({
|
|
34
|
+
name: tool.name,
|
|
35
|
+
description: tool.description,
|
|
36
|
+
input_schema: tool.inputSchema ?? { type: "object", properties: {} },
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
/** Reduce an Anthropic response to a {@link ModelResponse}. */
|
|
40
|
+
export function fromAnthropicResponse(message) {
|
|
41
|
+
const toolCalls = [];
|
|
42
|
+
const textParts = [];
|
|
43
|
+
for (const block of message.content) {
|
|
44
|
+
if (block.type === "tool_use" && block.name) {
|
|
45
|
+
toolCalls.push({ name: block.name, arguments: block.input ?? {} });
|
|
46
|
+
}
|
|
47
|
+
else if (block.type === "text" && block.text) {
|
|
48
|
+
textParts.push(block.text);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (toolCalls.length > 0)
|
|
52
|
+
return { toolCalls };
|
|
53
|
+
return { done: textParts.join("\n") };
|
|
54
|
+
}
|
|
55
|
+
export class ClaudeModelClient {
|
|
56
|
+
options;
|
|
57
|
+
client;
|
|
58
|
+
constructor(options = {}) {
|
|
59
|
+
this.options = options;
|
|
60
|
+
this.client = options.client;
|
|
61
|
+
}
|
|
62
|
+
/** Lazily construct the SDK client, importing the optional peer dependency. */
|
|
63
|
+
async getClient() {
|
|
64
|
+
if (this.client)
|
|
65
|
+
return this.client;
|
|
66
|
+
let mod;
|
|
67
|
+
try {
|
|
68
|
+
mod = (await import("@anthropic-ai/sdk"));
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
throw new Error("ClaudeModelClient needs the optional peer dependency '@anthropic-ai/sdk'. " +
|
|
72
|
+
"Install it (`npm install @anthropic-ai/sdk`) or pass your own `client`.");
|
|
73
|
+
}
|
|
74
|
+
const Anthropic = mod.default;
|
|
75
|
+
this.client = new Anthropic({ apiKey: this.options.apiKey });
|
|
76
|
+
return this.client;
|
|
77
|
+
}
|
|
78
|
+
async complete(request) {
|
|
79
|
+
const client = await this.getClient();
|
|
80
|
+
const { system, messages } = toAnthropicMessages(request.transcript);
|
|
81
|
+
const params = {
|
|
82
|
+
model: this.options.model ?? DEFAULT_CLAUDE_MODEL,
|
|
83
|
+
max_tokens: this.options.maxTokens ?? 4096,
|
|
84
|
+
messages,
|
|
85
|
+
tools: toAnthropicTools(request.tools),
|
|
86
|
+
};
|
|
87
|
+
if (system !== undefined)
|
|
88
|
+
params.system = system;
|
|
89
|
+
if (this.options.thinking)
|
|
90
|
+
params.thinking = { type: "adaptive" };
|
|
91
|
+
if (this.options.effort)
|
|
92
|
+
params.output_config = { effort: this.options.effort };
|
|
93
|
+
return fromAnthropicResponse(await client.messages.create(params));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/agent/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,wCAAwC;AACxC,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AA6CtD,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,CAAC,UAAsC;IAIxE,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAsD,EAAE,CAAC;IACvE,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS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