@arden-hq/headless 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +34 -2
- package/dist/client.d.ts +87 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +327 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@arden-hq/headless`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Node client for the HTTP and SSE API of an Arden server. The CLI (`arden run`) uses it.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createHeadlessClient } from "@arden-hq/headless"
|
|
7
|
+
|
|
8
|
+
const client = createHeadlessClient({ baseUrl: "http://127.0.0.1:3000" })
|
|
9
|
+
const { sessionId } = await client.createSession()
|
|
10
|
+
const run = await client.submit({ sessionId, message: "Hello" })
|
|
11
|
+
const detail = await client.wait(run)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Exports
|
|
15
|
+
|
|
16
|
+
- `createHeadlessClient(options)` and the `HeadlessClient` class. Options are `baseUrl`, `headers` and `fetch`.
|
|
17
|
+
- Sessions: `createSession`, `branchSession`, `listSessions`, `deleteSession`.
|
|
18
|
+
- Runs: `submit`, `getRun`, `getRunEvents`, `wait`, `waitForRun`, `cancel`.
|
|
19
|
+
- Answers: `answerApproval` and `answerConnection` reply to a paused run.
|
|
20
|
+
- Other: `health`, `listSpaces`.
|
|
21
|
+
- Errors: `HeadlessHttpError`, `HeadlessProtocolError`, `HeadlessTimeoutError`, `HeadlessEventHandlerError`.
|
|
22
|
+
|
|
23
|
+
## Rules
|
|
24
|
+
|
|
25
|
+
- All requests and responses use the contracts of `@arden-hq/protocol`. A bad response throws `HeadlessProtocolError`.
|
|
26
|
+
- `submit` retries with the same prepared body, so a retry cannot send the message twice.
|
|
27
|
+
- The client sends no credentials by default. Pass them in `headers`.
|
|
28
|
+
|
|
29
|
+
## Build
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun run build
|
|
33
|
+
bun run typecheck
|
|
34
|
+
bun run test
|
|
35
|
+
```
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { DecodedServerEventFrame } from "@arden-hq/protocol";
|
|
2
|
+
import { type CancelInput, type CancelResponse, type ChatMessageInput, type ChatReceiptStatus, type ConnectionResultInput, type ToolResultInput } from "@arden-hq/protocol/chat";
|
|
3
|
+
import { type SpaceListResponse } from "@arden-hq/protocol/spaces";
|
|
4
|
+
import { type HealthStatus } from "@arden-hq/protocol/health";
|
|
5
|
+
import { type RunDetail, type RunEventPage, type RunEventPageOptions, type RunTerminalResult } from "@arden-hq/protocol/runs";
|
|
6
|
+
import { type BranchSessionRequest, type BranchSessionResponse, type CreateSessionRequest, type CreateSessionResponse, type SessionListOptions, type SessionListResponse } from "@arden-hq/protocol/sessions";
|
|
7
|
+
export type { RunDetail, RunTerminalResult };
|
|
8
|
+
/** One decoded frame of a run's session event stream. */
|
|
9
|
+
export type HeadlessRunEvent = DecodedServerEventFrame;
|
|
10
|
+
export interface HeadlessClientOptions {
|
|
11
|
+
readonly baseUrl: string | URL;
|
|
12
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
13
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
14
|
+
}
|
|
15
|
+
export interface SubmittedRun {
|
|
16
|
+
readonly runId: string;
|
|
17
|
+
readonly sessionId: string;
|
|
18
|
+
readonly clientId: string;
|
|
19
|
+
readonly status: ChatReceiptStatus;
|
|
20
|
+
}
|
|
21
|
+
export interface HeadlessStreamOptions {
|
|
22
|
+
readonly signal?: AbortSignal;
|
|
23
|
+
}
|
|
24
|
+
export interface HeadlessRunEventOptions extends RunEventPageOptions {
|
|
25
|
+
readonly signal?: AbortSignal;
|
|
26
|
+
}
|
|
27
|
+
export interface WaitForRunOptions {
|
|
28
|
+
readonly signal?: AbortSignal;
|
|
29
|
+
readonly timeoutMs?: number;
|
|
30
|
+
readonly reconnectDelayMs?: number;
|
|
31
|
+
readonly onEvent?: (event: HeadlessRunEvent) => void | PromiseLike<void>;
|
|
32
|
+
}
|
|
33
|
+
export declare class HeadlessHttpError extends Error {
|
|
34
|
+
readonly status: number;
|
|
35
|
+
readonly method: string;
|
|
36
|
+
readonly path: string;
|
|
37
|
+
readonly detail: string;
|
|
38
|
+
readonly name = "HeadlessHttpError";
|
|
39
|
+
constructor(status: number, method: string, path: string, detail: string);
|
|
40
|
+
}
|
|
41
|
+
export declare class HeadlessProtocolError extends Error {
|
|
42
|
+
readonly name = "HeadlessProtocolError";
|
|
43
|
+
readonly cause?: unknown;
|
|
44
|
+
constructor(message: string, cause?: unknown);
|
|
45
|
+
}
|
|
46
|
+
export declare class HeadlessTimeoutError extends Error {
|
|
47
|
+
readonly timeoutMs: number;
|
|
48
|
+
readonly name = "HeadlessTimeoutError";
|
|
49
|
+
constructor(timeoutMs: number);
|
|
50
|
+
}
|
|
51
|
+
export declare class HeadlessEventHandlerError extends Error {
|
|
52
|
+
readonly name = "HeadlessEventHandlerError";
|
|
53
|
+
readonly cause: unknown;
|
|
54
|
+
constructor(cause: unknown);
|
|
55
|
+
}
|
|
56
|
+
export declare class HeadlessClient {
|
|
57
|
+
#private;
|
|
58
|
+
constructor(options: HeadlessClientOptions);
|
|
59
|
+
createSession(input?: CreateSessionRequest): Promise<CreateSessionResponse>;
|
|
60
|
+
branchSession(sessionId: string, input?: BranchSessionRequest): Promise<BranchSessionResponse>;
|
|
61
|
+
/** Submit with one generated client id and reuse the exact body for a lost-response retry. */
|
|
62
|
+
submit(input: ChatMessageInput): Promise<SubmittedRun>;
|
|
63
|
+
getRun(runId: string): Promise<RunDetail>;
|
|
64
|
+
getRunEvents(runId: string, options?: HeadlessRunEventOptions): Promise<RunEventPage>;
|
|
65
|
+
streamSession(sessionId: string, options?: HeadlessStreamOptions): AsyncGenerator<HeadlessRunEvent>;
|
|
66
|
+
/** Follow a submitted message to the end of the Run that answers it. A queued
|
|
67
|
+
* message joined the chat's running Run (a Goal's turn, say), which another
|
|
68
|
+
* client started; that Run answers it, under its own client identity. */
|
|
69
|
+
wait(run: SubmittedRun, options?: WaitForRunOptions): Promise<RunDetail>;
|
|
70
|
+
/** Follow a Run this client did not submit (one started earlier, or elsewhere) to its end. */
|
|
71
|
+
waitForRun(runId: string, options?: WaitForRunOptions): Promise<RunDetail>;
|
|
72
|
+
listSessions(options?: SessionListOptions): Promise<SessionListResponse>;
|
|
73
|
+
/** Whether the server is up and has a model to answer with. */
|
|
74
|
+
health(): Promise<HealthStatus>;
|
|
75
|
+
/** Delete a Session for good, with its files: archived first, as only an archived one deletes. */
|
|
76
|
+
deleteSession(sessionId: string): Promise<void>;
|
|
77
|
+
listSpaces(): Promise<SpaceListResponse>;
|
|
78
|
+
/** Answer a tool approval the Run is waiting on. */
|
|
79
|
+
answerApproval(input: ToolResultInput): Promise<void>;
|
|
80
|
+
/** Answer a connection request the Run is waiting on. */
|
|
81
|
+
answerConnection(input: ConnectionResultInput): Promise<void>;
|
|
82
|
+
cancel(input: CancelInput, options?: {
|
|
83
|
+
readonly signal?: AbortSignal;
|
|
84
|
+
}): Promise<CancelResponse>;
|
|
85
|
+
}
|
|
86
|
+
export declare const createHeadlessClient: (options: HeadlessClientOptions) => HeadlessClient;
|
|
87
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAA8B,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC9F,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE3F,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAA;AAIpC,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA;AAE5C,yDAAyD;AACzD,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AAEtD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACnD,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CACzC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB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D;IAEK,UAAU,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAE7C;IAED,oDAAoD;IAC9C,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAK1D;IAED,yDAAyD;IACnD,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAKlE;IAgEK,MAAM,CACV,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GAC9C,OAAO,CAAC,cAAc,CAAC,CAQzB;CAsCF;AAED,eAAO,MAAM,oBAAoB,YAAa,qBAAqB,KAAG,cACzC,CAAA"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { chatDecoders, chatRequests, chatRoutes } from "@arden-hq/protocol/chat";
|
|
2
|
+
import { spaceDecoders, spaceRoutes } from "@arden-hq/protocol/spaces";
|
|
3
|
+
import { healthDecoders, healthRoutes } from "@arden-hq/protocol/health";
|
|
4
|
+
import { ProtocolError } from "@arden-hq/protocol";
|
|
5
|
+
import { isTerminalRunStatus, runDecoders, runRoutes } from "@arden-hq/protocol/runs";
|
|
6
|
+
import { sessionDecoders, sessionRequests, sessionRoutes } from "@arden-hq/protocol/sessions";
|
|
7
|
+
import { retryableStatus } from "@arden-hq/std/retry";
|
|
8
|
+
import { sleep } from "@arden-hq/std/sleep";
|
|
9
|
+
export class HeadlessHttpError extends Error {
|
|
10
|
+
status;
|
|
11
|
+
method;
|
|
12
|
+
path;
|
|
13
|
+
detail;
|
|
14
|
+
name = "HeadlessHttpError";
|
|
15
|
+
constructor(status, method, path, detail) {
|
|
16
|
+
super(`${method} ${path} failed with HTTP ${status}${detail.length === 0 ? "" : `: ${detail}`}`);
|
|
17
|
+
this.status = status;
|
|
18
|
+
this.method = method;
|
|
19
|
+
this.path = path;
|
|
20
|
+
this.detail = detail;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class HeadlessProtocolError extends Error {
|
|
24
|
+
name = "HeadlessProtocolError";
|
|
25
|
+
cause;
|
|
26
|
+
constructor(message, cause) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.cause = cause;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export class HeadlessTimeoutError extends Error {
|
|
32
|
+
timeoutMs;
|
|
33
|
+
name = "HeadlessTimeoutError";
|
|
34
|
+
constructor(timeoutMs) {
|
|
35
|
+
super(`Run did not finish within ${timeoutMs} ms`);
|
|
36
|
+
this.timeoutMs = timeoutMs;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class HeadlessEventHandlerError extends Error {
|
|
40
|
+
name = "HeadlessEventHandlerError";
|
|
41
|
+
cause;
|
|
42
|
+
constructor(cause) {
|
|
43
|
+
super("Headless Run event handler failed");
|
|
44
|
+
this.cause = cause;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const reconcilingEvents = new Set([
|
|
48
|
+
"RUN_FINISHED",
|
|
49
|
+
"RUN_ERROR",
|
|
50
|
+
"run_cancelled",
|
|
51
|
+
"stream_snapshot",
|
|
52
|
+
"stream_live"
|
|
53
|
+
]);
|
|
54
|
+
const shouldReconcile = (event) => reconcilingEvents.has(event.data.type);
|
|
55
|
+
const responseDetail = (response) => response.text().then((body) => body.trim().slice(0, 2_000), () => "");
|
|
56
|
+
const responseJson = async (response) => {
|
|
57
|
+
try {
|
|
58
|
+
return await response.json();
|
|
59
|
+
}
|
|
60
|
+
catch (cause) {
|
|
61
|
+
throw new HeadlessProtocolError("Arden returned invalid JSON", cause);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const responseChunks = async function* (body) {
|
|
65
|
+
const reader = body.getReader();
|
|
66
|
+
try {
|
|
67
|
+
while (true) {
|
|
68
|
+
const next = await reader.read();
|
|
69
|
+
if (next.done)
|
|
70
|
+
return;
|
|
71
|
+
yield next.value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
await reader.cancel().catch(() => undefined);
|
|
76
|
+
reader.releaseLock();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const retryableConnectionFailure = (cause) => cause instanceof TypeError ||
|
|
80
|
+
(cause instanceof HeadlessHttpError && retryableStatus(cause.status));
|
|
81
|
+
const throwIfAborted = (signal) => {
|
|
82
|
+
if (signal?.aborted !== true)
|
|
83
|
+
return;
|
|
84
|
+
throw signal.reason instanceof Error ? signal.reason : new Error("Headless Run wait was aborted");
|
|
85
|
+
};
|
|
86
|
+
const assertRunIdentity = (detail, submitted) => {
|
|
87
|
+
if (detail.run_id !== submitted.runId || detail.session_id !== submitted.sessionId) {
|
|
88
|
+
throw new HeadlessProtocolError("Arden returned a Run that does not match its submission");
|
|
89
|
+
}
|
|
90
|
+
if (detail.client_id !== submitted.clientId) {
|
|
91
|
+
throw new HeadlessProtocolError("Arden returned a Run with a different client identity");
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
export class HeadlessClient {
|
|
95
|
+
#baseUrl;
|
|
96
|
+
#headers;
|
|
97
|
+
#fetch;
|
|
98
|
+
constructor(options) {
|
|
99
|
+
this.#baseUrl = new URL(options.baseUrl);
|
|
100
|
+
this.#headers = Object.freeze({ ...(options.headers ?? {}) });
|
|
101
|
+
this.#fetch = options.fetch ?? globalThis.fetch;
|
|
102
|
+
}
|
|
103
|
+
async createSession(input = {}) {
|
|
104
|
+
return sessionDecoders.createResponse(await this.#requestJson(sessionRoutes.collection, {
|
|
105
|
+
method: "POST",
|
|
106
|
+
body: sessionRequests.create(input)
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
async branchSession(sessionId, input = {}) {
|
|
110
|
+
return sessionDecoders.branchResponse(await this.#requestJson(sessionRoutes.branch(sessionId), {
|
|
111
|
+
method: "POST",
|
|
112
|
+
body: sessionRequests.branch(input)
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
/** Submit with one generated client id and reuse the exact body for a lost-response retry. */
|
|
116
|
+
async submit(input) {
|
|
117
|
+
const prepared = chatRequests.message(input);
|
|
118
|
+
let response;
|
|
119
|
+
let lastCause;
|
|
120
|
+
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
121
|
+
try {
|
|
122
|
+
response = await this.#fetch(this.#url(chatRoutes.message), {
|
|
123
|
+
method: "POST",
|
|
124
|
+
headers: this.#requestHeaders(true),
|
|
125
|
+
body: prepared.body
|
|
126
|
+
});
|
|
127
|
+
if (response.ok || !retryableStatus(response.status) || attempt === 1)
|
|
128
|
+
break;
|
|
129
|
+
lastCause = new HeadlessHttpError(response.status, "POST", chatRoutes.message, await responseDetail(response));
|
|
130
|
+
}
|
|
131
|
+
catch (cause) {
|
|
132
|
+
lastCause = cause;
|
|
133
|
+
if (attempt === 1)
|
|
134
|
+
throw cause;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (response === undefined)
|
|
138
|
+
throw lastCause;
|
|
139
|
+
if (!response.ok)
|
|
140
|
+
throw await this.#httpError(response, "POST", chatRoutes.message);
|
|
141
|
+
const receipt = chatDecoders.receipt(await responseJson(response));
|
|
142
|
+
if (receipt.runId === null) {
|
|
143
|
+
throw new HeadlessProtocolError("Arden accepted no Run for the submitted message");
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
runId: receipt.runId,
|
|
147
|
+
sessionId: receipt.sessionId,
|
|
148
|
+
clientId: prepared.clientId,
|
|
149
|
+
status: receipt.status
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
async getRun(runId) {
|
|
153
|
+
return this.#getRun(runId);
|
|
154
|
+
}
|
|
155
|
+
async getRunEvents(runId, options = {}) {
|
|
156
|
+
const { signal, ...page } = options;
|
|
157
|
+
return runDecoders.eventPage(await this.#requestJson(runRoutes.events(runId, page), {
|
|
158
|
+
method: "GET",
|
|
159
|
+
...(signal === undefined ? {} : { signal })
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
async *streamSession(sessionId, options = {}) {
|
|
163
|
+
const path = chatRoutes.events(sessionId);
|
|
164
|
+
const response = await this.#fetch(this.#url(path), {
|
|
165
|
+
method: "GET",
|
|
166
|
+
headers: this.#requestHeaders(false, { accept: "text/event-stream" }),
|
|
167
|
+
...(options.signal === undefined ? {} : { signal: options.signal })
|
|
168
|
+
});
|
|
169
|
+
if (!response.ok)
|
|
170
|
+
throw await this.#httpError(response, "GET", path);
|
|
171
|
+
if (response.body === null) {
|
|
172
|
+
throw new HeadlessProtocolError("Arden returned an empty event stream");
|
|
173
|
+
}
|
|
174
|
+
yield* chatDecoders.eventStream(responseChunks(response.body));
|
|
175
|
+
}
|
|
176
|
+
/** Follow a submitted message to the end of the Run that answers it. A queued
|
|
177
|
+
* message joined the chat's running Run (a Goal's turn, say), which another
|
|
178
|
+
* client started; that Run answers it, under its own client identity. */
|
|
179
|
+
async wait(run, options = {}) {
|
|
180
|
+
if (run.status === "queued")
|
|
181
|
+
return this.waitForRun(run.runId, options);
|
|
182
|
+
return this.#waitFor(run, options);
|
|
183
|
+
}
|
|
184
|
+
/** Follow a Run this client did not submit (one started earlier, or elsewhere) to its end. */
|
|
185
|
+
async waitForRun(runId, options = {}) {
|
|
186
|
+
const detail = await this.#getRun(runId, options.signal);
|
|
187
|
+
if (isTerminalRunStatus(detail.status))
|
|
188
|
+
return detail;
|
|
189
|
+
return this.#waitFor({ runId: detail.run_id, sessionId: detail.session_id, clientId: detail.client_id }, options);
|
|
190
|
+
}
|
|
191
|
+
async listSessions(options = {}) {
|
|
192
|
+
return sessionDecoders.listResponse(await this.#requestJson(sessionRoutes.list(options), { method: "GET" }));
|
|
193
|
+
}
|
|
194
|
+
/** Whether the server is up and has a model to answer with. */
|
|
195
|
+
async health() {
|
|
196
|
+
return healthDecoders.status(await this.#requestJson(healthRoutes.status, { method: "GET" }));
|
|
197
|
+
}
|
|
198
|
+
/** Delete a Session for good, with its files: archived first, as only an archived one deletes. */
|
|
199
|
+
async deleteSession(sessionId) {
|
|
200
|
+
await this.#requestJson(sessionRoutes.archive(sessionId, { stop: false }), { method: "DELETE" });
|
|
201
|
+
await this.#requestJson(sessionRoutes.permanentDelete(sessionId, { stop: false }), {
|
|
202
|
+
method: "DELETE"
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
async listSpaces() {
|
|
206
|
+
return spaceDecoders.list(await this.#requestJson(spaceRoutes.collection, { method: "GET" }));
|
|
207
|
+
}
|
|
208
|
+
/** Answer a tool approval the Run is waiting on. */
|
|
209
|
+
async answerApproval(input) {
|
|
210
|
+
await this.#requestJson(chatRoutes.toolResult, {
|
|
211
|
+
method: "POST",
|
|
212
|
+
body: chatRequests.toolResult(input)
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/** Answer a connection request the Run is waiting on. */
|
|
216
|
+
async answerConnection(input) {
|
|
217
|
+
await this.#requestJson(chatRoutes.connectionResult, {
|
|
218
|
+
method: "POST",
|
|
219
|
+
body: chatRequests.connectionResult(input)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
async #waitFor(run, options) {
|
|
223
|
+
const timeoutController = new AbortController();
|
|
224
|
+
const timeoutMs = options.timeoutMs;
|
|
225
|
+
const timeout = timeoutMs === undefined
|
|
226
|
+
? undefined
|
|
227
|
+
: setTimeout(() => {
|
|
228
|
+
timeoutController.abort(new HeadlessTimeoutError(timeoutMs));
|
|
229
|
+
}, timeoutMs);
|
|
230
|
+
timeout?.unref();
|
|
231
|
+
const signal = options.signal === undefined
|
|
232
|
+
? timeoutController.signal
|
|
233
|
+
: AbortSignal.any([options.signal, timeoutController.signal]);
|
|
234
|
+
const reconnectDelayMs = options.reconnectDelayMs ?? 100;
|
|
235
|
+
try {
|
|
236
|
+
while (true) {
|
|
237
|
+
throwIfAborted(signal);
|
|
238
|
+
let detail;
|
|
239
|
+
try {
|
|
240
|
+
detail = await this.#getRun(run.runId, signal);
|
|
241
|
+
}
|
|
242
|
+
catch (cause) {
|
|
243
|
+
throwIfAborted(signal);
|
|
244
|
+
if (!retryableConnectionFailure(cause))
|
|
245
|
+
throw cause;
|
|
246
|
+
await sleep(reconnectDelayMs, signal);
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
throwIfAborted(signal);
|
|
250
|
+
assertRunIdentity(detail, run);
|
|
251
|
+
if (isTerminalRunStatus(detail.status))
|
|
252
|
+
return detail;
|
|
253
|
+
try {
|
|
254
|
+
for await (const event of this.streamSession(run.sessionId, { signal })) {
|
|
255
|
+
throwIfAborted(signal);
|
|
256
|
+
if (options.onEvent !== undefined) {
|
|
257
|
+
try {
|
|
258
|
+
await options.onEvent(event);
|
|
259
|
+
}
|
|
260
|
+
catch (cause) {
|
|
261
|
+
throw new HeadlessEventHandlerError(cause);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (!shouldReconcile(event))
|
|
265
|
+
continue;
|
|
266
|
+
const reconciled = await this.#getRun(run.runId, signal);
|
|
267
|
+
throwIfAborted(signal);
|
|
268
|
+
assertRunIdentity(reconciled, run);
|
|
269
|
+
if (isTerminalRunStatus(reconciled.status))
|
|
270
|
+
return reconciled;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
catch (cause) {
|
|
274
|
+
throwIfAborted(signal);
|
|
275
|
+
if (cause instanceof ProtocolError || !retryableConnectionFailure(cause))
|
|
276
|
+
throw cause;
|
|
277
|
+
}
|
|
278
|
+
await sleep(reconnectDelayMs, signal);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (cause) {
|
|
282
|
+
throwIfAborted(signal);
|
|
283
|
+
throw cause;
|
|
284
|
+
}
|
|
285
|
+
finally {
|
|
286
|
+
if (timeout !== undefined)
|
|
287
|
+
clearTimeout(timeout);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
async cancel(input, options = {}) {
|
|
291
|
+
return chatDecoders.cancel(await this.#requestJson(chatRoutes.cancel, {
|
|
292
|
+
method: "POST",
|
|
293
|
+
body: chatRequests.cancel(input),
|
|
294
|
+
...(options.signal === undefined ? {} : { signal: options.signal })
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
async #getRun(runId, signal) {
|
|
298
|
+
return runDecoders.detail(await this.#requestJson(runRoutes.detail(runId), {
|
|
299
|
+
method: "GET",
|
|
300
|
+
...(signal === undefined ? {} : { signal })
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
303
|
+
async #requestJson(path, init) {
|
|
304
|
+
const response = await this.#fetch(this.#url(path), {
|
|
305
|
+
...init,
|
|
306
|
+
headers: this.#requestHeaders(init.body !== undefined)
|
|
307
|
+
});
|
|
308
|
+
if (!response.ok)
|
|
309
|
+
throw await this.#httpError(response, init.method ?? "GET", path);
|
|
310
|
+
return responseJson(response);
|
|
311
|
+
}
|
|
312
|
+
#requestHeaders(json, extra = {}) {
|
|
313
|
+
return {
|
|
314
|
+
...this.#headers,
|
|
315
|
+
...(json ? { "content-type": "application/json" } : {}),
|
|
316
|
+
...extra
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
#url(path) {
|
|
320
|
+
return new URL(path, this.#baseUrl);
|
|
321
|
+
}
|
|
322
|
+
async #httpError(response, method, path) {
|
|
323
|
+
return new HeadlessHttpError(response.status, method, path, await responseDetail(response));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
export const createHeadlessClient = (options) => new HeadlessClient(options);
|
|
327
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,UAAU,EAOX,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,WAAW,EAA0B,MAAM,2BAA2B,CAAA;AAC9F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAqB,MAAM,2BAA2B,CAAA;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;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B,GAAG,CAAC,OAA8B,EAAkB,EAAE,CACrF,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
2
3
|
"name": "@arden-hq/headless",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"description": "Node client for Arden's production HTTP and SSE runtime",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=20.19"
|
|
10
|
+
},
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"module": "./dist/index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"arden-source": "./src/index.ts",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/**/*.js",
|
|
22
|
+
"dist/**/*.d.ts",
|
|
23
|
+
"dist/**/*.js.map",
|
|
24
|
+
"dist/**/*.d.ts.map",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc -b",
|
|
30
|
+
"clean": "node ../../tooling/clean-dist.mjs",
|
|
31
|
+
"prepack": "bun run clean && bun run build",
|
|
32
|
+
"typecheck": "tsc -p tsconfig.check.json --noEmit --pretty false --incremental --tsBuildInfoFile ../../node_modules/.cache/tsc/libs-headless.tsbuildinfo",
|
|
33
|
+
"test": "vitest run"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@arden-hq/protocol": "0.1.0",
|
|
37
|
+
"@arden-hq/std": "0.1.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "24.10.1",
|
|
41
|
+
"typescript": "7.0.2",
|
|
42
|
+
"vitest": "4.1.12"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/arden-hq/arden-engine.git",
|
|
50
|
+
"directory": "libs/headless"
|
|
51
|
+
}
|
|
52
|
+
}
|