agent-runtime-kit 0.0.0-semantically-released
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +37 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.cjs +4 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.cjs.map +1 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js +4 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/agent.cjs +2 -0
- package/dist/agent.cjs.map +1 -0
- package/dist/agent.d.ts +11 -0
- package/dist/agent.js +2 -0
- package/dist/agent.js.map +1 -0
- package/dist/codex.cjs +2 -0
- package/dist/codex.cjs.map +1 -0
- package/dist/codex.d.ts +8 -0
- package/dist/codex.js +2 -0
- package/dist/codex.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.cjs +2 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.ts +17 -0
- package/dist/runtime.js +2 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# agent-runtime-kit
|
|
2
|
+
|
|
3
|
+
A provider-agnostic SDK for orchestrating AI agent sessions, streaming events, and structured outputs across multiple coding agent backends.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/WillBooster/agent-runtime-kit/actions/workflows/test.yml)
|
|
6
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install agent-runtime-kit
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { createCodexRuntime } from 'agent-runtime-kit';
|
|
18
|
+
|
|
19
|
+
const runtime = createCodexRuntime();
|
|
20
|
+
|
|
21
|
+
const result = await runtime.run({
|
|
22
|
+
cwd: process.cwd(),
|
|
23
|
+
instructions: 'Summarize the current repository structure.',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
console.log(result.outputText);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## GitHub E2E
|
|
30
|
+
|
|
31
|
+
The repository includes a fixed end-to-end test for a user program built on top of this wrapper. The user program targets `exKAZUu/agent-benchmark` issue `#1`, asks either the Codex SDK or the Claude Agent SDK to implement the fix and open a PR, then the test waits until the PR's required GitHub checks pass.
|
|
32
|
+
|
|
33
|
+
The e2e test is skipped only when `CI` is set. Outside CI, `bun test` runs the fixed e2e for every provider listed in `SUPPORTED_RUNTIME_PROVIDERS`, so adding a new SDK requires updating that provider list and the tests will cover it automatically.
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
Apache License 2.0
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";function t(r){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var r=t.done;return Promise.resolve(t.value).then(function(t){return{value:t,done:r}})}return t=function(t){this.s=t,this.n=t.next},t.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var r=this.s.return;return void 0===r?Promise.resolve({value:t,done:!0}):e(r.apply(this.s,arguments))},throw:function(t){var r=this.s.return;return void 0===r?Promise.reject(t):e(r.apply(this.s,arguments))}},new t(r)}function r(t,r,e,n,o,i,u){try{var c=t[i](u),a=c.value}catch(t){return void e(t)}c.done?r(a):Promise.resolve(a).then(n,o)}function e(t,r,e){return(r=c(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function n(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function o(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
+
var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",u=e.toStringTag||"@@toStringTag";function c(e,n,o,u){var c=n&&n.prototype instanceof f?n:f,s=Object.create(c.prototype);return i(s,"_invoke",function(e,n,o){var i,u,c,f=0,s=o||[],p=!1,l={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,u=0,c=t,l.n=e,a}};function y(e,n){for(u=e,c=n,r=0;!p&&f&&!o&&r<s.length;r++){var o,i=s[r],y=l.p,v=i[2];e>3?(o=v===n)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&y<i[1])?(u=0,l.v=n,l.n=i[1]):y<v&&(o=e<3||i[0]>n||n>v)&&(i[4]=e,i[5]=n,l.n=v,u=0))}if(o||e>1)return a;throw p=!0,n}return function(o,s,v){if(f>1)throw TypeError("Generator is already running");for(p&&1===s&&y(s,v),u=s,c=v;(r=u<2?t:c)||!p;){i||(u?u<3?(u>1&&(l.n=-1),y(u,c)):l.n=c:l.v=c);try{if(f=2,i){if(u||(o="next"),r=i[o]){if(!(r=r.call(i,c)))throw TypeError("iterator result is not an object");if(!r.done)return r;c=r.value,u<2&&(u=0)}else 1===u&&(r=i.return)&&r.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((r=(p=l.n<0)?c:e.call(n,l))!==a)break}catch(r){i=t,u=1,c=r}finally{f=1}}return{value:r,done:p}}}(e,o,u),!0),s}var a={};function f(){}function s(){}function p(){}r=Object.getPrototypeOf;var l=[][n]?r(r([][n]())):(i(r={},n,function(){return this}),r),y=p.prototype=f.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,i(t,u,"GeneratorFunction")),t.prototype=Object.create(y),t}return s.prototype=p,i(y,"constructor",p),i(p,"constructor",s),s.displayName="GeneratorFunction",i(p,u,"GeneratorFunction"),i(y),i(y,u,"Generator"),i(y,n,function(){return this}),i(y,"toString",function(){return"[object Generator]"}),(o=function(){return{w:c,m:v}})()}function i(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}i=function(t,r,e,n){function u(r,e){i(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(u("next",0),u("throw",1),u("return",2))},i(t,r,e,n)}function u(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function c(t){var r=u(t,"string");return"symbol"==typeof r?r:r+""}exports.asyncIterator=function(r){var e,n,o,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,o=Symbol.iterator);i--;){if(n&&null!=(e=r[n]))return e.call(r);if(o&&null!=(e=r[o]))return new t(e.call(r));n="@@asyncIterator",o="@@iterator"}throw new TypeError("Object is not async iterable")},exports.asyncToGenerator=function(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var u=t.apply(e,n);function c(t){r(u,o,i,c,a,"next",t)}function a(t){r(u,o,i,c,a,"throw",t)}c(void 0)})}},exports.defineProperty=e,exports.objectSpread2=function(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?n(Object(o),!0).forEach(function(r){e(t,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(o,r))})}return t},exports.regenerator=o,exports.regeneratorDefine=i,exports.toPrimitive=u,exports.toPropertyKey=c;
|
|
4
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
function t(t){var e,n,o,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,o=Symbol.iterator);i--;){if(n&&null!=(e=t[n]))return e.call(t);if(o&&null!=(e=t[o]))return new r(e.call(t));n="@@asyncIterator",o="@@iterator"}throw new TypeError("Object is not async iterable")}function r(t){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var r=t.done;return Promise.resolve(t.value).then(function(t){return{value:t,done:r}})}return r=function(t){this.s=t,this.n=t.next},r.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var r=this.s.return;return void 0===r?Promise.resolve({value:t,done:!0}):e(r.apply(this.s,arguments))},throw:function(t){var r=this.s.return;return void 0===r?Promise.reject(t):e(r.apply(this.s,arguments))}},new r(t)}function e(t,r,e,n,o,i,u){try{var c=t[i](u),a=c.value}catch(t){return void e(t)}c.done?r(a):Promise.resolve(a).then(n,o)}function n(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var u=t.apply(r,n);function c(t){e(u,o,i,c,a,"next",t)}function a(t){e(u,o,i,c,a,"throw",t)}c(void 0)})}}function o(t,r,e){return(r=s(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function i(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),e.push.apply(e,n)}return e}function u(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?i(Object(e),!0).forEach(function(r){o(t,r,e[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):i(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}return t}function c(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
+
var t,r,e="function"==typeof Symbol?Symbol:{},n=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,n,o,i){var c=n&&n.prototype instanceof f?n:f,s=Object.create(c.prototype);return a(s,"_invoke",function(e,n,o){var i,c,a,f=0,s=o||[],l=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(r,e){return i=r,c=0,a=t,p.n=e,u}};function y(e,n){for(c=e,a=n,r=0;!l&&f&&!o&&r<s.length;r++){var o,i=s[r],y=p.p,v=i[2];e>3?(o=v===n)&&(a=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=e<2&&y<i[1])?(c=0,p.v=n,p.n=i[1]):y<v&&(o=e<3||i[0]>n||n>v)&&(i[4]=e,i[5]=n,p.n=v,c=0))}if(o||e>1)return u;throw l=!0,n}return function(o,s,v){if(f>1)throw TypeError("Generator is already running");for(l&&1===s&&y(s,v),c=s,a=v;(r=c<2?t:a)||!l;){i||(c?c<3?(c>1&&(p.n=-1),y(c,a)):p.n=a:p.v=a);try{if(f=2,i){if(c||(o="next"),r=i[o]){if(!(r=r.call(i,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,c<2&&(c=0)}else 1===c&&(r=i.return)&&r.call(i),c<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((r=(l=p.n<0)?a:e.call(n,p))!==u)break}catch(r){i=t,c=1,a=r}finally{f=1}}return{value:r,done:l}}}(e,o,i),!0),s}var u={};function f(){}function s(){}function l(){}r=Object.getPrototypeOf;var p=[][n]?r(r([][n]())):(a(r={},n,function(){return this}),r),y=l.prototype=f.prototype=Object.create(p);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,a(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t}return s.prototype=l,a(y,"constructor",l),a(l,"constructor",s),s.displayName="GeneratorFunction",a(l,o,"GeneratorFunction"),a(y),a(y,o,"Generator"),a(y,n,function(){return this}),a(y,"toString",function(){return"[object Generator]"}),(c=function(){return{w:i,m:v}})()}function a(t,r,e,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}a=function(t,r,e,n){function i(r,e){a(t,r,function(t){return this._invoke(r,e,t)})}r?o?o(t,r,{value:e,enumerable:!n,configurable:!n,writable:!n}):t[r]=e:(i("next",0),i("throw",1),i("return",2))},a(t,r,e,n)}function f(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}function s(t){var r=f(t,"string");return"symbol"==typeof r?r:r+""}export{t as asyncIterator,n as asyncToGenerator,o as defineProperty,u as objectSpread2,c as regenerator,a as regeneratorDefine,f as toPrimitive,s as toPropertyKey};
|
|
4
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/agent.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("./_virtual/_rollupPluginBabelHelpers.cjs"),r=require("@anthropic-ai/claude-agent-sdk"),n=require("./runtime.cjs");function t(e,r){return a.apply(this,arguments)}function a(){return(a=e.asyncToGenerator(e.regenerator().m(function n(t,a){var s,o,c,i,p,f,l,g,d,v;return e.regenerator().w(function(n){for(;;)switch(n.p=n.n){case 0:s=[],o="",c=!1,i=!1,n.p=1,f=e.asyncIterator((null!=(g=a.queryFn)?g:r.query)({prompt:t.instructions,options:e.objectSpread2(e.objectSpread2({},a.sdkOptions),{},{cwd:t.cwd,env:t.env})}));case 2:return n.n=3,f.next();case 3:if(!(c=!(l=n.v).done)){n.n=5;break}d=l.value,s.push(d),o=u(d,o);case 4:c=!1,n.n=2;break;case 5:n.n=7;break;case 6:n.p=6,v=n.v,i=!0,p=v;case 7:if(n.p=7,n.p=8,!c||null==f.return){n.n=9;break}return n.n=9,f.return();case 9:if(n.p=9,!i){n.n=10;break}throw p;case 10:return n.f(9);case 11:return n.f(7);case 12:return n.a(2,{outputText:o,raw:s})}},n,null,[[8,,9,11],[1,6,7,12]])}))).apply(this,arguments)}function u(e,r){var n=e;return"string"==typeof n.result?n.result:"string"==typeof n.message?n.message:"string"==typeof n.content?n.content:r}exports.createAgentRuntime=function(r){return void 0===r&&(r={}),n.createRuntimeClient("agent-sdk",e.asyncToGenerator(e.regenerator().m(function n(a){return e.regenerator().w(function(e){for(;;)if(0===e.n)return e.a(2,t(a,r))},n)})))};
|
|
2
|
+
//# sourceMappingURL=agent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.cjs","sources":["../src/agent.ts"],"sourcesContent":["import { type Options, query, type SDKMessage } from '@anthropic-ai/claude-agent-sdk';\nimport { createRuntimeClient, type RuntimeClient, type RuntimeTaskRequest } from './runtime.js';\n\nexport type AgentQueryFn = (params: { options?: Options; prompt: string }) => AsyncIterable<SDKMessage>;\n\nexport type AgentRuntimeOptions = {\n queryFn?: AgentQueryFn;\n sdkOptions?: Omit<Options, 'cwd' | 'env'>;\n};\n\nexport function createAgentRuntime(options: AgentRuntimeOptions = {}): RuntimeClient {\n return createRuntimeClient('agent-sdk', async (request) => runAgentTask(request, options));\n}\n\nasync function runAgentTask(\n request: RuntimeTaskRequest,\n options: AgentRuntimeOptions\n): Promise<{ outputText: string; raw: SDKMessage[] }> {\n const messages: SDKMessage[] = [];\n let outputText = '';\n\n for await (const message of (options.queryFn ?? query)({\n prompt: request.instructions,\n options: {\n ...options.sdkOptions,\n cwd: request.cwd,\n env: request.env,\n },\n })) {\n messages.push(message);\n outputText = getLatestOutputText(message, outputText);\n }\n\n return {\n outputText,\n raw: messages,\n };\n}\n\nfunction getLatestOutputText(message: SDKMessage, previousOutput: string): string {\n const candidate = message as {\n content?: unknown;\n message?: unknown;\n result?: unknown;\n };\n if (typeof candidate.result === 'string') {\n return candidate.result;\n }\n if (typeof candidate.message === 'string') {\n return candidate.message;\n }\n if (typeof candidate.content === 'string') {\n return candidate.content;\n }\n return previousOutput;\n}\n"],"names":["runAgentTask","_x2","_x3","_runAgentTask","apply","this","arguments","_asyncToGenerator","_regenerator","m","_callee2","request","options","messages","outputText","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_step","_options$queryFn","message","_t","w","_context2","p","n","_asyncIterator","queryFn","query","prompt","instructions","_objectSpread","sdkOptions","cwd","env","next","v","done","value","push","getLatestOutputText","f","a","raw","previousOutput","candidate","result","content","createRuntimeClient","_callee","_context"],"mappings":"8IAYC,SAEcA,EAAYC,EAAAC,GAAA,OAAAC,EAAAC,MAAAC,KAAAC,UAAA,CAAA,SAAAH,IAuB1B,OAvB0BA,EAAAI,EAAAA,iBAAAC,gBAAAC,EAA3B,SAAAC,EACEC,EACAC,GAA4B,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAd,gBAAAe,EAAA,SAAAC,GAAA,cAAAA,EAAAC,EAAAD,EAAAE,GAAA,KAAA,EAEtBb,EAAyB,GAC3BC,EAAa,GAAEC,GAAA,EAAAC,GAAA,EAAAQ,EAAAC,EAAA,EAAAP,EAAAS,EAAAA,eAEyB,OAAhBP,EAACR,EAAQgB,SAAOR,EAAIS,SAAO,CACrDC,OAAQnB,EAAQoB,aAChBnB,QAAOoB,EAAAA,cAAAA,gBAAA,CAAA,EACFpB,EAAQqB,YAAU,GAAA,CACrBC,IAAKvB,EAAQuB,IACbC,IAAKxB,EAAQwB,SAEf,KAAA,EAAA,OAAAX,EAAAE,EAAA,EAAAR,EAAAkB,OAAA,KAAA,EAAA,KAAArB,IAAAI,EAAAK,EAAAa,GAAAC,MAAA,CAAAd,EAAAE,EAAA,EAAA,KAAA,CAPeL,EAAOF,EAAAoB,MAQtB1B,EAAS2B,KAAKnB,GACdP,EAAa2B,EAAoBpB,EAASP,GAAY,KAAA,EAAAC,GAAA,EAAAS,EAAAE,EAAA,EAAA,MAAA,KAAA,EAAAF,EAAAE,EAAA,EAAA,MAAA,KAAA,EAAAF,EAAAC,EAAA,EAAAH,EAAAE,EAAAa,EAAArB,GAAA,EAAAC,EAAAK,EAAA,KAAA,EAAA,GAAAE,EAAAC,EAAA,EAAAD,EAAAC,EAAA,GAAAV,GAAA,MAAAG,EAAA,OAAA,CAAAM,EAAAE,EAAA,EAAA,KAAA,CAAA,OAAAF,EAAAE,EAAA,EAAAR,EAAA,SAAA,KAAA,EAAA,GAAAM,EAAAC,EAAA,GAAAT,EAAA,CAAAQ,EAAAE,EAAA,GAAA,KAAA,CAAA,MAAAT,EAAA,KAAA,GAAA,OAAAO,EAAAkB,EAAA,GAAA,KAAA,GAAA,OAAAlB,EAAAkB,EAAA,GAAA,KAAA,GAAA,OAAAlB,EAAAmB,EAAA,EAGjD,CACL7B,WAAAA,EACA8B,IAAK/B,IACN,EAAAH,EAAA,KAAA,CAAA,CAAA,EAAA,CAAA,EAAA,IAAA,CAAA,EAAA,EAAA,EAAA,KAAA,KACFN,MAAAC,KAAAC,UAAA,CAED,SAASmC,EAAoBpB,EAAqBwB,GAChD,IAAMC,EAAYzB,EAKlB,MAAgC,iBAArByB,EAAUC,OACZD,EAAUC,OAEc,iBAAtBD,EAAUzB,QACZyB,EAAUzB,QAEc,iBAAtByB,EAAUE,QACZF,EAAUE,QAEZH,CACT,4BA7CO,SAA4BjC,GACjC,YAD6D,IAA5BA,IAAAA,EAA+B,CAAA,GACzDqC,EAAAA,oBAAoB,YAAW1C,mBAAAC,EAAAA,cAAAC,EAAE,SAAAyC,EAAOvC,GAAO,OAAAH,gBAAAe,EAAA,SAAA4B,GAAA,UAAA,IAAAA,EAAAzB,EAAA,OAAAyB,EAAAR,EAAA,EAAK3C,EAAaW,EAASC,GAAQ,EAAAsC,EAAA,IAC3F"}
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Options, type SDKMessage } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
+
import { type RuntimeClient } from './runtime.js';
|
|
3
|
+
export type AgentQueryFn = (params: {
|
|
4
|
+
options?: Options;
|
|
5
|
+
prompt: string;
|
|
6
|
+
}) => AsyncIterable<SDKMessage>;
|
|
7
|
+
export type AgentRuntimeOptions = {
|
|
8
|
+
queryFn?: AgentQueryFn;
|
|
9
|
+
sdkOptions?: Omit<Options, 'cwd' | 'env'>;
|
|
10
|
+
};
|
|
11
|
+
export declare function createAgentRuntime(options?: AgentRuntimeOptions): RuntimeClient;
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{asyncToGenerator as n,regenerator as r,asyncIterator as e,objectSpread2 as t}from"./_virtual/_rollupPluginBabelHelpers.js";import{query as a}from"@anthropic-ai/claude-agent-sdk";import{createRuntimeClient as s}from"./runtime.js";function o(e){return void 0===e&&(e={}),s("agent-sdk",n(r().m(function n(t){return r().w(function(n){for(;;)if(0===n.n)return n.a(2,u(t,e))},n)})))}function u(n,r){return i.apply(this,arguments)}function i(){return(i=n(r().m(function n(s,o){var u,i,p,f,l,m,d,g,v,k;return r().w(function(n){for(;;)switch(n.p=n.n){case 0:u=[],i="",p=!1,f=!1,n.p=1,m=e((null!=(g=o.queryFn)?g:a)({prompt:s.instructions,options:t(t({},o.sdkOptions),{},{cwd:s.cwd,env:s.env})}));case 2:return n.n=3,m.next();case 3:if(!(p=!(d=n.v).done)){n.n=5;break}v=d.value,u.push(v),i=c(v,i);case 4:p=!1,n.n=2;break;case 5:n.n=7;break;case 6:n.p=6,k=n.v,f=!0,l=k;case 7:if(n.p=7,n.p=8,!p||null==m.return){n.n=9;break}return n.n=9,m.return();case 9:if(n.p=9,!f){n.n=10;break}throw l;case 10:return n.f(9);case 11:return n.f(7);case 12:return n.a(2,{outputText:i,raw:u})}},n,null,[[8,,9,11],[1,6,7,12]])}))).apply(this,arguments)}function c(n,r){var e=n;return"string"==typeof e.result?e.result:"string"==typeof e.message?e.message:"string"==typeof e.content?e.content:r}export{o as createAgentRuntime};
|
|
2
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sources":["../src/agent.ts"],"sourcesContent":["import { type Options, query, type SDKMessage } from '@anthropic-ai/claude-agent-sdk';\nimport { createRuntimeClient, type RuntimeClient, type RuntimeTaskRequest } from './runtime.js';\n\nexport type AgentQueryFn = (params: { options?: Options; prompt: string }) => AsyncIterable<SDKMessage>;\n\nexport type AgentRuntimeOptions = {\n queryFn?: AgentQueryFn;\n sdkOptions?: Omit<Options, 'cwd' | 'env'>;\n};\n\nexport function createAgentRuntime(options: AgentRuntimeOptions = {}): RuntimeClient {\n return createRuntimeClient('agent-sdk', async (request) => runAgentTask(request, options));\n}\n\nasync function runAgentTask(\n request: RuntimeTaskRequest,\n options: AgentRuntimeOptions\n): Promise<{ outputText: string; raw: SDKMessage[] }> {\n const messages: SDKMessage[] = [];\n let outputText = '';\n\n for await (const message of (options.queryFn ?? query)({\n prompt: request.instructions,\n options: {\n ...options.sdkOptions,\n cwd: request.cwd,\n env: request.env,\n },\n })) {\n messages.push(message);\n outputText = getLatestOutputText(message, outputText);\n }\n\n return {\n outputText,\n raw: messages,\n };\n}\n\nfunction getLatestOutputText(message: SDKMessage, previousOutput: string): string {\n const candidate = message as {\n content?: unknown;\n message?: unknown;\n result?: unknown;\n };\n if (typeof candidate.result === 'string') {\n return candidate.result;\n }\n if (typeof candidate.message === 'string') {\n return candidate.message;\n }\n if (typeof candidate.content === 'string') {\n return candidate.content;\n }\n return previousOutput;\n}\n"],"names":["createAgentRuntime","options","createRuntimeClient","_asyncToGenerator","_regenerator","m","_callee","request","w","_context","n","a","runAgentTask","_x2","_x3","_runAgentTask","apply","this","arguments","_callee2","messages","outputText","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_iterator","_step","_options$queryFn","message","_t","_context2","p","_asyncIterator","queryFn","query","prompt","instructions","_objectSpread","sdkOptions","cwd","env","next","v","done","value","push","getLatestOutputText","f","raw","previousOutput","candidate","result","content"],"mappings":"4OAUO,SAASA,EAAmBC,GACjC,YAD6D,IAA5BA,IAAAA,EAA+B,CAAA,GACzDC,EAAoB,YAAWC,EAAAC,IAAAC,EAAE,SAAAC,EAAOC,GAAO,OAAAH,IAAAI,EAAA,SAAAC,GAAA,UAAA,IAAAA,EAAAC,EAAA,OAAAD,EAAAE,EAAA,EAAKC,EAAaL,EAASN,GAAQ,EAAAK,EAAA,IAC3F,CAAC,SAEcM,EAAYC,EAAAC,GAAA,OAAAC,EAAAC,MAAAC,KAAAC,UAAA,CAAA,SAAAH,IAuB1B,OAvB0BA,EAAAZ,EAAAC,IAAAC,EAA3B,SAAAc,EACEZ,EACAN,GAA4B,IAAAmB,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAzB,IAAAI,EAAA,SAAAsB,GAAA,cAAAA,EAAAC,EAAAD,EAAApB,GAAA,KAAA,EAEtBU,EAAyB,GAC3BC,EAAa,GAAEC,GAAA,EAAAC,GAAA,EAAAO,EAAAC,EAAA,EAAAN,EAAAO,GAEyB,OAAhBL,EAAC1B,EAAQgC,SAAON,EAAIO,GAAO,CACrDC,OAAQ5B,EAAQ6B,aAChBnC,QAAOoC,EAAAA,EAAA,CAAA,EACFpC,EAAQqC,YAAU,GAAA,CACrBC,IAAKhC,EAAQgC,IACbC,IAAKjC,EAAQiC,SAEf,KAAA,EAAA,OAAAV,EAAApB,EAAA,EAAAe,EAAAgB,OAAA,KAAA,EAAA,KAAAnB,IAAAI,EAAAI,EAAAY,GAAAC,MAAA,CAAAb,EAAApB,EAAA,EAAA,KAAA,CAPekB,EAAOF,EAAAkB,MAQtBxB,EAASyB,KAAKjB,GACdP,EAAayB,EAAoBlB,EAASP,GAAY,KAAA,EAAAC,GAAA,EAAAQ,EAAApB,EAAA,EAAA,MAAA,KAAA,EAAAoB,EAAApB,EAAA,EAAA,MAAA,KAAA,EAAAoB,EAAAC,EAAA,EAAAF,EAAAC,EAAAY,EAAAnB,GAAA,EAAAC,EAAAK,EAAA,KAAA,EAAA,GAAAC,EAAAC,EAAA,EAAAD,EAAAC,EAAA,GAAAT,GAAA,MAAAG,EAAA,OAAA,CAAAK,EAAApB,EAAA,EAAA,KAAA,CAAA,OAAAoB,EAAApB,EAAA,EAAAe,EAAA,SAAA,KAAA,EAAA,GAAAK,EAAAC,EAAA,GAAAR,EAAA,CAAAO,EAAApB,EAAA,GAAA,KAAA,CAAA,MAAAc,EAAA,KAAA,GAAA,OAAAM,EAAAiB,EAAA,GAAA,KAAA,GAAA,OAAAjB,EAAAiB,EAAA,GAAA,KAAA,GAAA,OAAAjB,EAAAnB,EAAA,EAGjD,CACLU,WAAAA,EACA2B,IAAK5B,IACN,EAAAD,EAAA,KAAA,CAAA,CAAA,EAAA,CAAA,EAAA,IAAA,CAAA,EAAA,EAAA,EAAA,KAAA,KACFH,MAAAC,KAAAC,UAAA,CAED,SAAS4B,EAAoBlB,EAAqBqB,GAChD,IAAMC,EAAYtB,EAKlB,MAAgC,iBAArBsB,EAAUC,OACZD,EAAUC,OAEc,iBAAtBD,EAAUtB,QACZsB,EAAUtB,QAEc,iBAAtBsB,EAAUE,QACZF,EAAUE,QAEZH,CACT"}
|
package/dist/codex.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("./_virtual/_rollupPluginBabelHelpers.cjs"),r=require("@openai/codex-sdk"),n=require("./runtime.cjs");function t(e,r){return o.apply(this,arguments)}function o(){return(o=e.asyncToGenerator(e.regenerator().m(function n(t,o){var u,c,a,s;return e.regenerator().w(function(n){for(;;)switch(n.n){case 0:return c=null!=(u=o.client)?u:new r.Codex(i(t,o.clientOptions)),a=c.startThread(e.objectSpread2(e.objectSpread2({},o.threadOptions),{},{workingDirectory:t.cwd})),n.n=1,a.run(t.instructions);case 1:return s=n.v,n.a(2,{outputText:s.finalResponse,raw:s})}},n)}))).apply(this,arguments)}function i(r,n){return r.env?e.objectSpread2(e.objectSpread2({},n),{},{env:(t=r.env,Object.fromEntries(Object.entries(t).filter(function(e){return"string"==typeof e[1]})))}):n;var t}exports.createCodexRuntime=function(r){return void 0===r&&(r={}),n.createRuntimeClient("codex-sdk",e.asyncToGenerator(e.regenerator().m(function n(o){return e.regenerator().w(function(e){for(;;)if(0===e.n)return e.a(2,t(o,r))},n)})))};
|
|
2
|
+
//# sourceMappingURL=codex.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.cjs","sources":["../src/codex.ts"],"sourcesContent":["import { Codex, type CodexOptions, type RunResult, type ThreadOptions } from '@openai/codex-sdk';\nimport { createRuntimeClient, type RuntimeClient, type RuntimeTaskRequest } from './runtime.js';\n\nexport type CodexRuntimeOptions = {\n client?: Codex;\n clientOptions?: CodexOptions;\n threadOptions?: Omit<ThreadOptions, 'workingDirectory'>;\n};\n\nexport function createCodexRuntime(options: CodexRuntimeOptions = {}): RuntimeClient {\n return createRuntimeClient('codex-sdk', async (request) => runCodexTask(request, options));\n}\n\nasync function runCodexTask(\n request: RuntimeTaskRequest,\n options: CodexRuntimeOptions\n): Promise<{ outputText: string; raw: RunResult }> {\n const client = options.client ?? new Codex(createCodexOptions(request, options.clientOptions));\n const thread = client.startThread({\n ...options.threadOptions,\n workingDirectory: request.cwd,\n });\n const result = await thread.run(request.instructions);\n return {\n outputText: result.finalResponse,\n raw: result,\n };\n}\n\nfunction createCodexOptions(request: RuntimeTaskRequest, options: CodexOptions | undefined): CodexOptions | undefined {\n if (!request.env) {\n return options;\n }\n\n return {\n ...options,\n env: normalizeEnv(request.env),\n };\n}\n\nfunction normalizeEnv(env: NodeJS.ProcessEnv): Record<string, string> {\n return Object.fromEntries(\n Object.entries(env).filter((entry): entry is [string, string] => typeof entry[1] === 'string')\n );\n}\n"],"names":["runCodexTask","_x2","_x3","_runCodexTask","apply","this","arguments","_asyncToGenerator","_regenerator","m","_callee2","request","options","_options$client","client","thread","result","w","_context2","n","Codex","createCodexOptions","clientOptions","startThread","_objectSpread","threadOptions","workingDirectory","cwd","run","instructions","v","a","outputText","finalResponse","raw","env","Object","fromEntries","entries","filter","entry","createRuntimeClient","_callee","_context"],"mappings":"iIAWC,SAEcA,EAAYC,EAAAC,GAAA,OAAAC,EAAAC,MAAAC,KAAAC,UAAA,CAAA,SAAAH,IAc1B,OAd0BA,EAAAI,EAAAA,iBAAAC,gBAAAC,EAA3B,SAAAC,EACEC,EACAC,GAA4B,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAR,gBAAAS,EAAA,SAAAC,GAAA,cAAAA,EAAAC,GAAA,KAAA,EAM1B,OAJIL,EAAuB,OAAjBD,EAAGD,EAAQE,QAAMD,EAAI,IAAIO,EAAAA,MAAMC,EAAmBV,EAASC,EAAQU,gBACzEP,EAASD,EAAOS,YAAWC,gBAAAA,EAAAA,cAAA,CAAA,EAC5BZ,EAAQa,eAAa,GAAA,CACxBC,iBAAkBf,EAAQgB,OAC1BT,EAAAC,EAAA,EACmBJ,EAAOa,IAAIjB,EAAQkB,cAAa,KAAA,EAAzC,OAANb,EAAME,EAAAY,EAAAZ,EAAAa,EAAA,EACL,CACLC,WAAYhB,EAAOiB,cACnBC,IAAKlB,IACN,EAAAN,EAAA,KACFN,MAAAC,KAAAC,UAAA,CAED,SAASe,EAAmBV,EAA6BC,GACvD,OAAKD,EAAQwB,IAIbX,EAAAA,cAAAA,EAAAA,cAAA,CAAA,EACKZ,GAAO,CAAA,EAAA,CACVuB,KAIkBA,EAJAxB,EAAQwB,IAKrBC,OAAOC,YACZD,OAAOE,QAAQH,GAAKI,OAAO,SAACC,GAAK,MAAoD,iBAAbA,EAAM,EAAe,OAXtF5B,EASX,IAAsBuB,CAFtB,4BA7BO,SAA4BvB,GACjC,YAD6D,IAA5BA,IAAAA,EAA+B,CAAA,GACzD6B,EAAAA,oBAAoB,YAAWlC,mBAAAC,EAAAA,cAAAC,EAAE,SAAAiC,EAAO/B,GAAO,OAAAH,gBAAAS,EAAA,SAAA0B,GAAA,UAAA,IAAAA,EAAAxB,EAAA,OAAAwB,EAAAZ,EAAA,EAAK/B,EAAaW,EAASC,GAAQ,EAAA8B,EAAA,IAC3F"}
|
package/dist/codex.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Codex, type CodexOptions, type ThreadOptions } from '@openai/codex-sdk';
|
|
2
|
+
import { type RuntimeClient } from './runtime.js';
|
|
3
|
+
export type CodexRuntimeOptions = {
|
|
4
|
+
client?: Codex;
|
|
5
|
+
clientOptions?: CodexOptions;
|
|
6
|
+
threadOptions?: Omit<ThreadOptions, 'workingDirectory'>;
|
|
7
|
+
};
|
|
8
|
+
export declare function createCodexRuntime(options?: CodexRuntimeOptions): RuntimeClient;
|
package/dist/codex.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{asyncToGenerator as n,regenerator as r,objectSpread2 as t}from"./_virtual/_rollupPluginBabelHelpers.js";import{Codex as e}from"@openai/codex-sdk";import{createRuntimeClient as o}from"./runtime.js";function i(t){return void 0===t&&(t={}),o("codex-sdk",n(r().m(function n(e){return r().w(function(n){for(;;)if(0===n.n)return n.a(2,u(e,t))},n)})))}function u(n,r){return s.apply(this,arguments)}function s(){return(s=n(r().m(function n(o,i){var u,s,c,f;return r().w(function(n){for(;;)switch(n.n){case 0:return s=null!=(u=i.client)?u:new e(a(o,i.clientOptions)),c=s.startThread(t(t({},i.threadOptions),{},{workingDirectory:o.cwd})),n.n=1,c.run(o.instructions);case 1:return f=n.v,n.a(2,{outputText:f.finalResponse,raw:f})}},n)}))).apply(this,arguments)}function a(n,r){return n.env?t(t({},r),{},{env:(e=n.env,Object.fromEntries(Object.entries(e).filter(function(n){return"string"==typeof n[1]})))}):r;var e}export{i as createCodexRuntime};
|
|
2
|
+
//# sourceMappingURL=codex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.js","sources":["../src/codex.ts"],"sourcesContent":["import { Codex, type CodexOptions, type RunResult, type ThreadOptions } from '@openai/codex-sdk';\nimport { createRuntimeClient, type RuntimeClient, type RuntimeTaskRequest } from './runtime.js';\n\nexport type CodexRuntimeOptions = {\n client?: Codex;\n clientOptions?: CodexOptions;\n threadOptions?: Omit<ThreadOptions, 'workingDirectory'>;\n};\n\nexport function createCodexRuntime(options: CodexRuntimeOptions = {}): RuntimeClient {\n return createRuntimeClient('codex-sdk', async (request) => runCodexTask(request, options));\n}\n\nasync function runCodexTask(\n request: RuntimeTaskRequest,\n options: CodexRuntimeOptions\n): Promise<{ outputText: string; raw: RunResult }> {\n const client = options.client ?? new Codex(createCodexOptions(request, options.clientOptions));\n const thread = client.startThread({\n ...options.threadOptions,\n workingDirectory: request.cwd,\n });\n const result = await thread.run(request.instructions);\n return {\n outputText: result.finalResponse,\n raw: result,\n };\n}\n\nfunction createCodexOptions(request: RuntimeTaskRequest, options: CodexOptions | undefined): CodexOptions | undefined {\n if (!request.env) {\n return options;\n }\n\n return {\n ...options,\n env: normalizeEnv(request.env),\n };\n}\n\nfunction normalizeEnv(env: NodeJS.ProcessEnv): Record<string, string> {\n return Object.fromEntries(\n Object.entries(env).filter((entry): entry is [string, string] => typeof entry[1] === 'string')\n );\n}\n"],"names":["createCodexRuntime","options","createRuntimeClient","_asyncToGenerator","_regenerator","m","_callee","request","w","_context","n","a","runCodexTask","_x2","_x3","_runCodexTask","apply","this","arguments","_callee2","_options$client","client","thread","result","_context2","Codex","createCodexOptions","clientOptions","startThread","_objectSpread","threadOptions","workingDirectory","cwd","run","instructions","v","outputText","finalResponse","raw","env","Object","fromEntries","entries","filter","entry"],"mappings":"4MASO,SAASA,EAAmBC,GACjC,YAD6D,IAA5BA,IAAAA,EAA+B,CAAA,GACzDC,EAAoB,YAAWC,EAAAC,IAAAC,EAAE,SAAAC,EAAOC,GAAO,OAAAH,IAAAI,EAAA,SAAAC,GAAA,UAAA,IAAAA,EAAAC,EAAA,OAAAD,EAAAE,EAAA,EAAKC,EAAaL,EAASN,GAAQ,EAAAK,EAAA,IAC3F,CAAC,SAEcM,EAAYC,EAAAC,GAAA,OAAAC,EAAAC,MAAAC,KAAAC,UAAA,CAAA,SAAAH,IAc1B,OAd0BA,EAAAZ,EAAAC,IAAAC,EAA3B,SAAAc,EACEZ,EACAN,GAA4B,IAAAmB,EAAAC,EAAAC,EAAAC,EAAA,OAAAnB,IAAAI,EAAA,SAAAgB,GAAA,cAAAA,EAAAd,GAAA,KAAA,EAM1B,OAJIW,EAAuB,OAAjBD,EAAGnB,EAAQoB,QAAMD,EAAI,IAAIK,EAAMC,EAAmBnB,EAASN,EAAQ0B,gBACzEL,EAASD,EAAOO,YAAWC,EAAAA,EAAA,CAAA,EAC5B5B,EAAQ6B,eAAa,GAAA,CACxBC,iBAAkBxB,EAAQyB,OAC1BR,EAAAd,EAAA,EACmBY,EAAOW,IAAI1B,EAAQ2B,cAAa,KAAA,EAAzC,OAANX,EAAMC,EAAAW,EAAAX,EAAAb,EAAA,EACL,CACLyB,WAAYb,EAAOc,cACnBC,IAAKf,IACN,EAAAJ,EAAA,KACFH,MAAAC,KAAAC,UAAA,CAED,SAASQ,EAAmBnB,EAA6BN,GACvD,OAAKM,EAAQgC,IAIbV,EAAAA,EAAA,CAAA,EACK5B,GAAO,CAAA,EAAA,CACVsC,KAIkBA,EAJAhC,EAAQgC,IAKrBC,OAAOC,YACZD,OAAOE,QAAQH,GAAKI,OAAO,SAACC,GAAK,MAAoD,iBAAbA,EAAM,EAAe,OAXtF3C,EASX,IAAsBsC,CAFtB"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("./agent.cjs"),t=require("./codex.cjs"),r=require("./runtime.cjs");exports.createAgentRuntime=e.createAgentRuntime,exports.createCodexRuntime=t.createCodexRuntime,exports.SUPPORTED_RUNTIME_PROVIDERS=r.SUPPORTED_RUNTIME_PROVIDERS,exports.createRuntimeClient=r.createRuntimeClient;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type AgentRuntimeOptions, createAgentRuntime } from './agent.js';
|
|
2
|
+
export { type CodexRuntimeOptions, createCodexRuntime } from './codex.js';
|
|
3
|
+
export { createRuntimeClient, type RuntimeClient, type RuntimeProvider, type RuntimeTaskRequest, type RuntimeTaskResult, SUPPORTED_RUNTIME_PROVIDERS, } from './runtime.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/runtime.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=require("./_virtual/_rollupPluginBabelHelpers.cjs");exports.SUPPORTED_RUNTIME_PROVIDERS=["codex-sdk","agent-sdk"],exports.createRuntimeClient=function(e,t){return{provider:e,run:(n=r.asyncToGenerator(r.regenerator().m(function n(a){var o;return r.regenerator().w(function(n){for(;;)switch(n.n){case 0:return n.n=1,t(a);case 1:return o=n.v,n.a(2,r.objectSpread2(r.objectSpread2({},o),{},{provider:e}))}},n)})),function(r){return n.apply(this,arguments)})};var n};
|
|
2
|
+
//# sourceMappingURL=runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.cjs","sources":["../src/runtime.ts"],"sourcesContent":["export const SUPPORTED_RUNTIME_PROVIDERS = ['codex-sdk', 'agent-sdk'] as const;\n\nexport type RuntimeProvider = (typeof SUPPORTED_RUNTIME_PROVIDERS)[number];\n\nexport type RuntimeTaskRequest = {\n cwd: string;\n env?: NodeJS.ProcessEnv;\n instructions: string;\n};\n\nexport type RuntimeTaskResult = {\n outputText: string;\n provider: RuntimeProvider;\n raw?: unknown;\n};\n\nexport type RuntimeClient = {\n provider: RuntimeProvider;\n run: (request: RuntimeTaskRequest) => Promise<RuntimeTaskResult>;\n};\n\nexport function createRuntimeClient(\n provider: RuntimeProvider,\n execute: (request: RuntimeTaskRequest) => Promise<Omit<RuntimeTaskResult, 'provider'>>\n): RuntimeClient {\n return {\n provider,\n run: async (request) => {\n const response = await execute(request);\n return {\n ...response,\n provider,\n };\n },\n };\n}\n"],"names":["provider","execute","run","_run","_asyncToGenerator","_regenerator","m","_callee","request","response","w","_context","n","v","a","_objectSpread","_x","apply","this","arguments"],"mappings":"2GAA2C,CAAC,YAAa,yCAqBlD,SACLA,EACAC,GAEA,MAAO,CACLD,SAAAA,EACAE,KAAGC,EAAAC,EAAAA,iBAAAC,EAAAA,cAAAC,EAAE,SAAAC,EAAOC,GAAO,IAAAC,EAAA,OAAAJ,gBAAAK,EAAA,SAAAC,GAAA,cAAAA,EAAAC,GAAA,KAAA,EAAA,OAAAD,EAAAC,EAAA,EACMX,EAAQO,GAAQ,KAAA,EAAzB,OAARC,EAAQE,EAAAE,EAAAF,EAAAG,EAAA,EAAAC,EAAAA,cAAAA,EAAAA,iBAETN,GAAQ,GAAA,CACXT,SAAAA,KAAQ,EAAAO,EAAA,IAEX,SANES,GAAA,OAAAb,EAAAc,MAAAC,KAAAC,UAAA,IAAA,IAAAhB,CAQP"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const SUPPORTED_RUNTIME_PROVIDERS: readonly ["codex-sdk", "agent-sdk"];
|
|
2
|
+
export type RuntimeProvider = (typeof SUPPORTED_RUNTIME_PROVIDERS)[number];
|
|
3
|
+
export type RuntimeTaskRequest = {
|
|
4
|
+
cwd: string;
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
instructions: string;
|
|
7
|
+
};
|
|
8
|
+
export type RuntimeTaskResult = {
|
|
9
|
+
outputText: string;
|
|
10
|
+
provider: RuntimeProvider;
|
|
11
|
+
raw?: unknown;
|
|
12
|
+
};
|
|
13
|
+
export type RuntimeClient = {
|
|
14
|
+
provider: RuntimeProvider;
|
|
15
|
+
run: (request: RuntimeTaskRequest) => Promise<RuntimeTaskResult>;
|
|
16
|
+
};
|
|
17
|
+
export declare function createRuntimeClient(provider: RuntimeProvider, execute: (request: RuntimeTaskRequest) => Promise<Omit<RuntimeTaskResult, 'provider'>>): RuntimeClient;
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{asyncToGenerator as r,regenerator as e,objectSpread2 as n}from"./_virtual/_rollupPluginBabelHelpers.js";var t=["codex-sdk","agent-sdk"];function a(t,a){return{provider:t,run:(o=r(e().m(function r(o){var u;return e().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,a(o);case 1:return u=r.v,r.a(2,n(n({},u),{},{provider:t}))}},r)})),function(r){return o.apply(this,arguments)})};var o}export{t as SUPPORTED_RUNTIME_PROVIDERS,a as createRuntimeClient};
|
|
2
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sources":["../src/runtime.ts"],"sourcesContent":["export const SUPPORTED_RUNTIME_PROVIDERS = ['codex-sdk', 'agent-sdk'] as const;\n\nexport type RuntimeProvider = (typeof SUPPORTED_RUNTIME_PROVIDERS)[number];\n\nexport type RuntimeTaskRequest = {\n cwd: string;\n env?: NodeJS.ProcessEnv;\n instructions: string;\n};\n\nexport type RuntimeTaskResult = {\n outputText: string;\n provider: RuntimeProvider;\n raw?: unknown;\n};\n\nexport type RuntimeClient = {\n provider: RuntimeProvider;\n run: (request: RuntimeTaskRequest) => Promise<RuntimeTaskResult>;\n};\n\nexport function createRuntimeClient(\n provider: RuntimeProvider,\n execute: (request: RuntimeTaskRequest) => Promise<Omit<RuntimeTaskResult, 'provider'>>\n): RuntimeClient {\n return {\n provider,\n run: async (request) => {\n const response = await execute(request);\n return {\n ...response,\n provider,\n };\n },\n };\n}\n"],"names":["SUPPORTED_RUNTIME_PROVIDERS","createRuntimeClient","provider","execute","run","_run","_asyncToGenerator","_regenerator","m","_callee","request","response","w","_context","n","v","a","_objectSpread","_x","apply","this","arguments"],"mappings":"mHAAaA,EAA8B,CAAC,YAAa,aAqBlD,SAASC,EACdC,EACAC,GAEA,MAAO,CACLD,SAAAA,EACAE,KAAGC,EAAAC,EAAAC,IAAAC,EAAE,SAAAC,EAAOC,GAAO,IAAAC,EAAA,OAAAJ,IAAAK,EAAA,SAAAC,GAAA,cAAAA,EAAAC,GAAA,KAAA,EAAA,OAAAD,EAAAC,EAAA,EACMX,EAAQO,GAAQ,KAAA,EAAzB,OAARC,EAAQE,EAAAE,EAAAF,EAAAG,EAAA,EAAAC,EAAAA,KAETN,GAAQ,GAAA,CACXT,SAAAA,KAAQ,EAAAO,EAAA,IAEX,SANES,GAAA,OAAAb,EAAAc,MAAAC,KAAAC,UAAA,IAAA,IAAAhB,CAQP"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-runtime-kit",
|
|
3
|
+
"version": "0.0.0-semantically-released",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/WillBooster/agent-runtime-kit.git"
|
|
7
|
+
},
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"author": "WillBooster Inc.",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist/"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "build-ts lib",
|
|
24
|
+
"check-all-for-ai": "bun run check-for-ai && bun run test --silent",
|
|
25
|
+
"check-for-ai": "bun install > /dev/null && bun run cleanup && bun run typecheck",
|
|
26
|
+
"cleanup": "bun --bun wb lint --fix --format",
|
|
27
|
+
"format": "bun --bun wb lint --format",
|
|
28
|
+
"lint": "bun --bun wb lint",
|
|
29
|
+
"lint-fix": "bun --bun wb lint --fix",
|
|
30
|
+
"prepare": "lefthook install || true",
|
|
31
|
+
"prepublishOnly": "bun run build",
|
|
32
|
+
"release": "semantic-release",
|
|
33
|
+
"test": "bun test && bun wb test",
|
|
34
|
+
"test:e2e-github": "bun test test/e2e/github-pr.test.ts",
|
|
35
|
+
"typecheck": "bun --bun wb typecheck"
|
|
36
|
+
},
|
|
37
|
+
"prettier": "@willbooster/prettier-config",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.80",
|
|
40
|
+
"@openai/codex-sdk": "0.116.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@biomejs/biome": "2.4.7",
|
|
44
|
+
"@types/bun": "1.3.10",
|
|
45
|
+
"@willbooster/biome-config": "3.2.5",
|
|
46
|
+
"@willbooster/prettier-config": "10.2.4",
|
|
47
|
+
"@willbooster/wb": "13.4.2",
|
|
48
|
+
"build-ts": "^17.0.22",
|
|
49
|
+
"conventional-changelog-conventionalcommits": "9.3.0",
|
|
50
|
+
"lefthook": "2.1.4",
|
|
51
|
+
"prettier": "3.8.1",
|
|
52
|
+
"prettier-plugin-java": "2.8.1",
|
|
53
|
+
"semantic-release": "25.0.3",
|
|
54
|
+
"sort-package-json": "3.6.1",
|
|
55
|
+
"typescript": "5.9.3"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=24"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public",
|
|
62
|
+
"tag": "latest"
|
|
63
|
+
}
|
|
64
|
+
}
|