@opencode-ai/client 0.0.0-next-14944 → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -25
- package/package.json +2 -56
- package/dist/contract.d.ts +0 -1
- package/dist/contract.js +0 -1
- package/dist/effect/api/api.d.ts +0 -814
- package/dist/effect/api/api.js +0 -0
- package/dist/effect/api.d.ts +0 -6
- package/dist/effect/api.js +0 -0
- package/dist/effect/generated/client-error.d.ts +0 -7
- package/dist/effect/generated/client-error.js +0 -5
- package/dist/effect/generated/client.d.ts +0 -6112
- package/dist/effect/generated/client.js +0 -376
- package/dist/effect/generated/index.d.ts +0 -2
- package/dist/effect/generated/index.js +0 -2
- package/dist/effect/index.d.ts +0 -30
- package/dist/effect/index.js +0 -26
- package/dist/effect/service.d.ts +0 -28
- package/dist/effect/service.js +0 -113
- package/dist/promise/api.d.ts +0 -21
- package/dist/promise/api.js +0 -0
- package/dist/promise/generated/client-error.d.ts +0 -6
- package/dist/promise/generated/client-error.js +0 -8
- package/dist/promise/generated/client.d.ts +0 -1298
- package/dist/promise/generated/client.js +0 -970
- package/dist/promise/generated/index.d.ts +0 -3
- package/dist/promise/generated/index.js +0 -3
- package/dist/promise/generated/types.d.ts +0 -8306
- package/dist/promise/generated/types.js +0 -21
- package/dist/promise/index.d.ts +0 -4
- package/dist/promise/index.js +0 -1
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
// Generated by @opencode-ai/httpapi-codegen. Do not edit.
|
|
2
|
-
import { Effect, Stream, Schema } from "effect";
|
|
3
|
-
import { Sse } from "effect/unstable/encoding";
|
|
4
|
-
import { HttpClientError } from "effect/unstable/http";
|
|
5
|
-
import { HttpApiClient } from "effect/unstable/httpapi";
|
|
6
|
-
import { ClientApi } from "../../contract";
|
|
7
|
-
import { ClientError } from "./client-error";
|
|
8
|
-
const mapClientError = (error) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error)
|
|
9
|
-
? new ClientError({ cause: error })
|
|
10
|
-
: error;
|
|
11
|
-
const Endpoint0_0 = (raw) => () => raw["health.get"]({}).pipe(Effect.mapError(mapClientError));
|
|
12
|
-
const adaptGroup0 = (raw) => ({ get: Endpoint0_0(raw) });
|
|
13
|
-
const Endpoint1_0 = (raw) => (input) => raw["location.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
14
|
-
const adaptGroup1 = (raw) => ({ get: Endpoint1_0(raw) });
|
|
15
|
-
const Endpoint2_0 = (raw) => (input) => raw["agent.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
16
|
-
const adaptGroup2 = (raw) => ({ list: Endpoint2_0(raw) });
|
|
17
|
-
const Endpoint3_0 = (raw) => (input) => raw["plugin.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
18
|
-
const adaptGroup3 = (raw) => ({ list: Endpoint3_0(raw) });
|
|
19
|
-
const Endpoint4_0 = (raw) => (input) => raw["session.list"]({
|
|
20
|
-
query: {
|
|
21
|
-
workspace: input?.["workspace"],
|
|
22
|
-
limit: input?.["limit"],
|
|
23
|
-
order: input?.["order"],
|
|
24
|
-
search: input?.["search"],
|
|
25
|
-
parentID: input?.["parentID"],
|
|
26
|
-
directory: input?.["directory"],
|
|
27
|
-
project: input?.["project"],
|
|
28
|
-
subpath: input?.["subpath"],
|
|
29
|
-
cursor: input?.["cursor"],
|
|
30
|
-
},
|
|
31
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
32
|
-
const Endpoint4_1 = (raw) => (input) => raw["session.create"]({
|
|
33
|
-
payload: { id: input?.["id"], agent: input?.["agent"], model: input?.["model"], location: input?.["location"] },
|
|
34
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
35
|
-
const Endpoint4_2 = (raw) => () => raw["session.active"]({}).pipe(Effect.mapError(mapClientError));
|
|
36
|
-
const Endpoint4_3 = (raw) => (input) => raw["session.get"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
37
|
-
const Endpoint4_4 = (raw) => (input) => raw["session.fork"]({ params: { sessionID: input["sessionID"] }, payload: { messageID: input["messageID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
38
|
-
const Endpoint4_5 = (raw) => (input) => raw["session.switchAgent"]({ params: { sessionID: input["sessionID"] }, payload: { agent: input["agent"] } }).pipe(Effect.mapError(mapClientError));
|
|
39
|
-
const Endpoint4_6 = (raw) => (input) => raw["session.switchModel"]({ params: { sessionID: input["sessionID"] }, payload: { model: input["model"] } }).pipe(Effect.mapError(mapClientError));
|
|
40
|
-
const Endpoint4_7 = (raw) => (input) => raw["session.rename"]({ params: { sessionID: input["sessionID"] }, payload: { title: input["title"] } }).pipe(Effect.mapError(mapClientError));
|
|
41
|
-
const Endpoint4_8 = (raw) => (input) => raw["session.prompt"]({
|
|
42
|
-
params: { sessionID: input["sessionID"] },
|
|
43
|
-
payload: { id: input["id"], prompt: input["prompt"], delivery: input["delivery"], resume: input["resume"] },
|
|
44
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
45
|
-
const Endpoint4_9 = (raw) => (input) => raw["session.command"]({
|
|
46
|
-
params: { sessionID: input["sessionID"] },
|
|
47
|
-
payload: {
|
|
48
|
-
id: input["id"],
|
|
49
|
-
command: input["command"],
|
|
50
|
-
arguments: input["arguments"],
|
|
51
|
-
agent: input["agent"],
|
|
52
|
-
model: input["model"],
|
|
53
|
-
files: input["files"],
|
|
54
|
-
agents: input["agents"],
|
|
55
|
-
delivery: input["delivery"],
|
|
56
|
-
resume: input["resume"],
|
|
57
|
-
},
|
|
58
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
59
|
-
const Endpoint4_10 = (raw) => (input) => raw["session.skill"]({
|
|
60
|
-
params: { sessionID: input["sessionID"] },
|
|
61
|
-
payload: { id: input["id"], skill: input["skill"], resume: input["resume"] },
|
|
62
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
63
|
-
const Endpoint4_11 = (raw) => (input) => raw["session.synthetic"]({
|
|
64
|
-
params: { sessionID: input["sessionID"] },
|
|
65
|
-
payload: { text: input["text"], description: input["description"], metadata: input["metadata"] },
|
|
66
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
67
|
-
const Endpoint4_12 = (raw) => (input) => raw["session.shell"]({
|
|
68
|
-
params: { sessionID: input["sessionID"] },
|
|
69
|
-
payload: { id: input["id"], command: input["command"] },
|
|
70
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
71
|
-
const Endpoint4_13 = (raw) => (input) => raw["session.compact"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError));
|
|
72
|
-
const Endpoint4_14 = (raw) => (input) => raw["session.wait"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError));
|
|
73
|
-
const Endpoint4_15 = (raw) => (input) => raw["session.revert.stage"]({
|
|
74
|
-
params: { sessionID: input["sessionID"] },
|
|
75
|
-
payload: { messageID: input["messageID"], files: input["files"] },
|
|
76
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
77
|
-
const Endpoint4_16 = (raw) => (input) => raw["session.revert.clear"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError));
|
|
78
|
-
const Endpoint4_17 = (raw) => (input) => raw["session.revert.commit"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError));
|
|
79
|
-
const Endpoint4_18 = (raw) => (input) => raw["session.context"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
80
|
-
const Endpoint4_19 = (raw) => (input) => raw["session.context.entry.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
81
|
-
const Endpoint4_20 = (raw) => (input) => raw["session.context.entry.put"]({
|
|
82
|
-
params: { sessionID: input["sessionID"], key: input["key"] },
|
|
83
|
-
payload: { value: input["value"] },
|
|
84
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
85
|
-
const Endpoint4_21 = (raw) => (input) => raw["session.context.entry.remove"]({ params: { sessionID: input["sessionID"], key: input["key"] } }).pipe(Effect.mapError(mapClientError));
|
|
86
|
-
const Endpoint4_22 = (raw) => (input) => Stream.unwrap(raw["session.log"]({
|
|
87
|
-
params: { sessionID: input["sessionID"] },
|
|
88
|
-
query: { after: input["after"], follow: input["follow"] },
|
|
89
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError)))));
|
|
90
|
-
const Endpoint4_23 = (raw) => (input) => raw["session.interrupt"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError));
|
|
91
|
-
const Endpoint4_24 = (raw) => (input) => raw["session.background"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError));
|
|
92
|
-
const Endpoint4_25 = (raw) => (input) => raw["session.message"]({ params: { sessionID: input["sessionID"], messageID: input["messageID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
93
|
-
const adaptGroup4 = (raw) => ({
|
|
94
|
-
list: Endpoint4_0(raw),
|
|
95
|
-
create: Endpoint4_1(raw),
|
|
96
|
-
active: Endpoint4_2(raw),
|
|
97
|
-
get: Endpoint4_3(raw),
|
|
98
|
-
fork: Endpoint4_4(raw),
|
|
99
|
-
switchAgent: Endpoint4_5(raw),
|
|
100
|
-
switchModel: Endpoint4_6(raw),
|
|
101
|
-
rename: Endpoint4_7(raw),
|
|
102
|
-
prompt: Endpoint4_8(raw),
|
|
103
|
-
command: Endpoint4_9(raw),
|
|
104
|
-
skill: Endpoint4_10(raw),
|
|
105
|
-
synthetic: Endpoint4_11(raw),
|
|
106
|
-
shell: Endpoint4_12(raw),
|
|
107
|
-
compact: Endpoint4_13(raw),
|
|
108
|
-
wait: Endpoint4_14(raw),
|
|
109
|
-
revertStage: Endpoint4_15(raw),
|
|
110
|
-
revertClear: Endpoint4_16(raw),
|
|
111
|
-
revertCommit: Endpoint4_17(raw),
|
|
112
|
-
context: Endpoint4_18(raw),
|
|
113
|
-
listContextEntries: Endpoint4_19(raw),
|
|
114
|
-
putContextEntry: Endpoint4_20(raw),
|
|
115
|
-
removeContextEntry: Endpoint4_21(raw),
|
|
116
|
-
log: Endpoint4_22(raw),
|
|
117
|
-
interrupt: Endpoint4_23(raw),
|
|
118
|
-
background: Endpoint4_24(raw),
|
|
119
|
-
message: Endpoint4_25(raw),
|
|
120
|
-
});
|
|
121
|
-
const Endpoint5_0 = (raw) => (input) => raw["session.messages"]({
|
|
122
|
-
params: { sessionID: input["sessionID"] },
|
|
123
|
-
query: { limit: input["limit"], order: input["order"], cursor: input["cursor"] },
|
|
124
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
125
|
-
const adaptGroup5 = (raw) => ({ list: Endpoint5_0(raw) });
|
|
126
|
-
const Endpoint6_0 = (raw) => (input) => raw["model.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
127
|
-
const Endpoint6_1 = (raw) => (input) => raw["model.default"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
128
|
-
const adaptGroup6 = (raw) => ({ list: Endpoint6_0(raw), default: Endpoint6_1(raw) });
|
|
129
|
-
const Endpoint7_0 = (raw) => (input) => raw["generate.text"]({
|
|
130
|
-
query: { location: input["location"] },
|
|
131
|
-
payload: { prompt: input["prompt"], model: input["model"] },
|
|
132
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
133
|
-
const adaptGroup7 = (raw) => ({ text: Endpoint7_0(raw) });
|
|
134
|
-
const Endpoint8_0 = (raw) => (input) => raw["provider.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
135
|
-
const Endpoint8_1 = (raw) => (input) => raw["provider.get"]({ params: { providerID: input["providerID"] }, query: { location: input["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
136
|
-
const adaptGroup8 = (raw) => ({ list: Endpoint8_0(raw), get: Endpoint8_1(raw) });
|
|
137
|
-
const Endpoint9_0 = (raw) => (input) => raw["integration.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
138
|
-
const Endpoint9_1 = (raw) => (input) => raw["integration.get"]({
|
|
139
|
-
params: { integrationID: input["integrationID"] },
|
|
140
|
-
query: { location: input["location"] },
|
|
141
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
142
|
-
const Endpoint9_2 = (raw) => (input) => raw["integration.connect.key"]({
|
|
143
|
-
params: { integrationID: input["integrationID"] },
|
|
144
|
-
query: { location: input["location"] },
|
|
145
|
-
payload: { key: input["key"], label: input["label"] },
|
|
146
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
147
|
-
const Endpoint9_3 = (raw) => (input) => raw["integration.connect.oauth"]({
|
|
148
|
-
params: { integrationID: input["integrationID"] },
|
|
149
|
-
query: { location: input["location"] },
|
|
150
|
-
payload: { methodID: input["methodID"], inputs: input["inputs"], label: input["label"] },
|
|
151
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
152
|
-
const Endpoint9_4 = (raw) => (input) => raw["integration.attempt.status"]({
|
|
153
|
-
params: { attemptID: input["attemptID"] },
|
|
154
|
-
query: { location: input["location"] },
|
|
155
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
156
|
-
const Endpoint9_5 = (raw) => (input) => raw["integration.attempt.complete"]({
|
|
157
|
-
params: { attemptID: input["attemptID"] },
|
|
158
|
-
query: { location: input["location"] },
|
|
159
|
-
payload: { code: input["code"] },
|
|
160
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
161
|
-
const Endpoint9_6 = (raw) => (input) => raw["integration.attempt.cancel"]({
|
|
162
|
-
params: { attemptID: input["attemptID"] },
|
|
163
|
-
query: { location: input["location"] },
|
|
164
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
165
|
-
const adaptGroup9 = (raw) => ({
|
|
166
|
-
list: Endpoint9_0(raw),
|
|
167
|
-
get: Endpoint9_1(raw),
|
|
168
|
-
connectKey: Endpoint9_2(raw),
|
|
169
|
-
connectOauth: Endpoint9_3(raw),
|
|
170
|
-
attemptStatus: Endpoint9_4(raw),
|
|
171
|
-
attemptComplete: Endpoint9_5(raw),
|
|
172
|
-
attemptCancel: Endpoint9_6(raw),
|
|
173
|
-
});
|
|
174
|
-
const Endpoint10_0 = (raw) => (input) => raw["mcp.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
175
|
-
const adaptGroup10 = (raw) => ({ list: Endpoint10_0(raw) });
|
|
176
|
-
const Endpoint11_0 = (raw) => (input) => raw["credential.update"]({
|
|
177
|
-
params: { credentialID: input["credentialID"] },
|
|
178
|
-
query: { location: input["location"] },
|
|
179
|
-
payload: { label: input["label"] },
|
|
180
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
181
|
-
const Endpoint11_1 = (raw) => (input) => raw["credential.remove"]({
|
|
182
|
-
params: { credentialID: input["credentialID"] },
|
|
183
|
-
query: { location: input["location"] },
|
|
184
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
185
|
-
const adaptGroup11 = (raw) => ({ update: Endpoint11_0(raw), remove: Endpoint11_1(raw) });
|
|
186
|
-
const Endpoint12_0 = (raw) => (input) => raw["project.current"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
187
|
-
const Endpoint12_1 = (raw) => (input) => raw["project.directories"]({
|
|
188
|
-
params: { projectID: input["projectID"] },
|
|
189
|
-
query: { location: input["location"] },
|
|
190
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
191
|
-
const adaptGroup12 = (raw) => ({
|
|
192
|
-
current: Endpoint12_0(raw),
|
|
193
|
-
directories: Endpoint12_1(raw),
|
|
194
|
-
});
|
|
195
|
-
const Endpoint13_0 = (raw) => (input) => raw["form.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
196
|
-
const Endpoint13_1 = (raw) => (input) => raw["session.form.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
197
|
-
const Endpoint13_2 = (raw) => (input) => raw["session.form.create"]({
|
|
198
|
-
params: { sessionID: input["sessionID"] },
|
|
199
|
-
payload: {
|
|
200
|
-
id: input["id"],
|
|
201
|
-
title: input["title"],
|
|
202
|
-
metadata: input["metadata"],
|
|
203
|
-
mode: input["mode"],
|
|
204
|
-
fields: input["fields"],
|
|
205
|
-
url: input["url"],
|
|
206
|
-
},
|
|
207
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
208
|
-
const Endpoint13_3 = (raw) => (input) => raw["session.form.get"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
209
|
-
const Endpoint13_4 = (raw) => (input) => raw["session.form.state"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
210
|
-
const Endpoint13_5 = (raw) => (input) => raw["session.form.reply"]({
|
|
211
|
-
params: { sessionID: input["sessionID"], formID: input["formID"] },
|
|
212
|
-
payload: { answer: input["answer"] },
|
|
213
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
214
|
-
const Endpoint13_6 = (raw) => (input) => raw["session.form.cancel"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError));
|
|
215
|
-
const adaptGroup13 = (raw) => ({
|
|
216
|
-
listRequests: Endpoint13_0(raw),
|
|
217
|
-
list: Endpoint13_1(raw),
|
|
218
|
-
create: Endpoint13_2(raw),
|
|
219
|
-
get: Endpoint13_3(raw),
|
|
220
|
-
state: Endpoint13_4(raw),
|
|
221
|
-
reply: Endpoint13_5(raw),
|
|
222
|
-
cancel: Endpoint13_6(raw),
|
|
223
|
-
});
|
|
224
|
-
const Endpoint14_0 = (raw) => (input) => raw["permission.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
225
|
-
const Endpoint14_1 = (raw) => (input) => raw["permission.saved.list"]({ query: { projectID: input?.["projectID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
226
|
-
const Endpoint14_2 = (raw) => (input) => raw["permission.saved.remove"]({ params: { id: input["id"] } }).pipe(Effect.mapError(mapClientError));
|
|
227
|
-
const Endpoint14_3 = (raw) => (input) => raw["session.permission.create"]({
|
|
228
|
-
params: { sessionID: input["sessionID"] },
|
|
229
|
-
payload: {
|
|
230
|
-
id: input["id"],
|
|
231
|
-
action: input["action"],
|
|
232
|
-
resources: input["resources"],
|
|
233
|
-
save: input["save"],
|
|
234
|
-
metadata: input["metadata"],
|
|
235
|
-
source: input["source"],
|
|
236
|
-
agent: input["agent"],
|
|
237
|
-
},
|
|
238
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
239
|
-
const Endpoint14_4 = (raw) => (input) => raw["session.permission.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
240
|
-
const Endpoint14_5 = (raw) => (input) => raw["session.permission.get"]({ params: { sessionID: input["sessionID"], requestID: input["requestID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
241
|
-
const Endpoint14_6 = (raw) => (input) => raw["session.permission.reply"]({
|
|
242
|
-
params: { sessionID: input["sessionID"], requestID: input["requestID"] },
|
|
243
|
-
payload: { reply: input["reply"], message: input["message"] },
|
|
244
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
245
|
-
const adaptGroup14 = (raw) => ({
|
|
246
|
-
listRequests: Endpoint14_0(raw),
|
|
247
|
-
listSaved: Endpoint14_1(raw),
|
|
248
|
-
removeSaved: Endpoint14_2(raw),
|
|
249
|
-
create: Endpoint14_3(raw),
|
|
250
|
-
list: Endpoint14_4(raw),
|
|
251
|
-
get: Endpoint14_5(raw),
|
|
252
|
-
reply: Endpoint14_6(raw),
|
|
253
|
-
});
|
|
254
|
-
const Endpoint15_0 = (raw) => (input) => raw["fs.list"]({ query: { location: input?.["location"], path: input?.["path"] } }).pipe(Effect.mapError(mapClientError));
|
|
255
|
-
const Endpoint15_1 = (raw) => (input) => raw["fs.find"]({
|
|
256
|
-
query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] },
|
|
257
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
258
|
-
const adaptGroup15 = (raw) => ({ list: Endpoint15_0(raw), find: Endpoint15_1(raw) });
|
|
259
|
-
const Endpoint16_0 = (raw) => (input) => raw["command.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
260
|
-
const adaptGroup16 = (raw) => ({ list: Endpoint16_0(raw) });
|
|
261
|
-
const Endpoint17_0 = (raw) => (input) => raw["skill.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
262
|
-
const adaptGroup17 = (raw) => ({ list: Endpoint17_0(raw) });
|
|
263
|
-
const Endpoint18_0 = (raw) => () => Stream.unwrap(raw["event.subscribe"]({}).pipe(Effect.mapError(mapClientError), Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError)))));
|
|
264
|
-
const Endpoint18_1 = (raw) => () => Stream.unwrap(raw["event.changes"]({}).pipe(Effect.mapError(mapClientError), Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError)))));
|
|
265
|
-
const adaptGroup18 = (raw) => ({ subscribe: Endpoint18_0(raw), changes: Endpoint18_1(raw) });
|
|
266
|
-
const Endpoint19_0 = (raw) => (input) => raw["pty.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
267
|
-
const Endpoint19_1 = (raw) => (input) => raw["pty.create"]({
|
|
268
|
-
query: { location: input?.["location"] },
|
|
269
|
-
payload: {
|
|
270
|
-
command: input?.["command"],
|
|
271
|
-
args: input?.["args"],
|
|
272
|
-
cwd: input?.["cwd"],
|
|
273
|
-
title: input?.["title"],
|
|
274
|
-
env: input?.["env"],
|
|
275
|
-
},
|
|
276
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
277
|
-
const Endpoint19_2 = (raw) => (input) => raw["pty.get"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
278
|
-
const Endpoint19_3 = (raw) => (input) => raw["pty.update"]({
|
|
279
|
-
params: { ptyID: input["ptyID"] },
|
|
280
|
-
query: { location: input["location"] },
|
|
281
|
-
payload: { title: input["title"], size: input["size"] },
|
|
282
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
283
|
-
const Endpoint19_4 = (raw) => (input) => raw["pty.remove"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
284
|
-
const adaptGroup19 = (raw) => ({
|
|
285
|
-
list: Endpoint19_0(raw),
|
|
286
|
-
create: Endpoint19_1(raw),
|
|
287
|
-
get: Endpoint19_2(raw),
|
|
288
|
-
update: Endpoint19_3(raw),
|
|
289
|
-
remove: Endpoint19_4(raw),
|
|
290
|
-
});
|
|
291
|
-
const Endpoint20_0 = (raw) => (input) => raw["shell.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
292
|
-
const Endpoint20_1 = (raw) => (input) => raw["shell.create"]({
|
|
293
|
-
query: { location: input["location"] },
|
|
294
|
-
payload: { command: input["command"], cwd: input["cwd"], timeout: input["timeout"], metadata: input["metadata"] },
|
|
295
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
296
|
-
const Endpoint20_2 = (raw) => (input) => raw["shell.get"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
297
|
-
const Endpoint20_3 = (raw) => (input) => raw["shell.output"]({
|
|
298
|
-
params: { id: input["id"] },
|
|
299
|
-
query: { location: input["location"], cursor: input["cursor"], limit: input["limit"] },
|
|
300
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
301
|
-
const Endpoint20_4 = (raw) => (input) => raw["shell.remove"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
302
|
-
const adaptGroup20 = (raw) => ({
|
|
303
|
-
list: Endpoint20_0(raw),
|
|
304
|
-
create: Endpoint20_1(raw),
|
|
305
|
-
get: Endpoint20_2(raw),
|
|
306
|
-
output: Endpoint20_3(raw),
|
|
307
|
-
remove: Endpoint20_4(raw),
|
|
308
|
-
});
|
|
309
|
-
const Endpoint21_0 = (raw) => (input) => raw["question.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
310
|
-
const Endpoint21_1 = (raw) => (input) => raw["session.question.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data));
|
|
311
|
-
const Endpoint21_2 = (raw) => (input) => raw["session.question.reply"]({
|
|
312
|
-
params: { sessionID: input["sessionID"], requestID: input["requestID"] },
|
|
313
|
-
payload: { answers: input["answers"] },
|
|
314
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
315
|
-
const Endpoint21_3 = (raw) => (input) => raw["session.question.reject"]({ params: { sessionID: input["sessionID"], requestID: input["requestID"] } }).pipe(Effect.mapError(mapClientError));
|
|
316
|
-
const adaptGroup21 = (raw) => ({
|
|
317
|
-
listRequests: Endpoint21_0(raw),
|
|
318
|
-
list: Endpoint21_1(raw),
|
|
319
|
-
reply: Endpoint21_2(raw),
|
|
320
|
-
reject: Endpoint21_3(raw),
|
|
321
|
-
});
|
|
322
|
-
const Endpoint22_0 = (raw) => (input) => raw["reference.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
323
|
-
const adaptGroup22 = (raw) => ({ list: Endpoint22_0(raw) });
|
|
324
|
-
const Endpoint23_0 = (raw) => (input) => raw["projectCopy.create"]({
|
|
325
|
-
params: { projectID: input["projectID"] },
|
|
326
|
-
query: { location: input["location"] },
|
|
327
|
-
payload: { strategy: input["strategy"], directory: input["directory"], name: input["name"] },
|
|
328
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
329
|
-
const Endpoint23_1 = (raw) => (input) => raw["projectCopy.remove"]({
|
|
330
|
-
params: { projectID: input["projectID"] },
|
|
331
|
-
query: { location: input["location"] },
|
|
332
|
-
payload: { directory: input["directory"], force: input["force"] },
|
|
333
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
334
|
-
const Endpoint23_2 = (raw) => (input) => raw["projectCopy.refresh"]({
|
|
335
|
-
params: { projectID: input["projectID"] },
|
|
336
|
-
query: { location: input["location"] },
|
|
337
|
-
}).pipe(Effect.mapError(mapClientError));
|
|
338
|
-
const adaptGroup23 = (raw) => ({
|
|
339
|
-
create: Endpoint23_0(raw),
|
|
340
|
-
remove: Endpoint23_1(raw),
|
|
341
|
-
refresh: Endpoint23_2(raw),
|
|
342
|
-
});
|
|
343
|
-
const Endpoint24_0 = (raw) => (input) => raw["vcs.status"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError));
|
|
344
|
-
const Endpoint24_1 = (raw) => (input) => raw["vcs.diff"]({ query: { location: input["location"], mode: input["mode"], context: input["context"] } }).pipe(Effect.mapError(mapClientError));
|
|
345
|
-
const adaptGroup24 = (raw) => ({ status: Endpoint24_0(raw), diff: Endpoint24_1(raw) });
|
|
346
|
-
const Endpoint25_0 = (raw) => () => raw["debug.location"]({}).pipe(Effect.mapError(mapClientError));
|
|
347
|
-
const adaptGroup25 = (raw) => ({ location: Endpoint25_0(raw) });
|
|
348
|
-
const adaptClient = (raw) => ({
|
|
349
|
-
health: adaptGroup0(raw["server.health"]),
|
|
350
|
-
location: adaptGroup1(raw["server.location"]),
|
|
351
|
-
agent: adaptGroup2(raw["server.agent"]),
|
|
352
|
-
plugin: adaptGroup3(raw["server.plugin"]),
|
|
353
|
-
session: adaptGroup4(raw["server.session"]),
|
|
354
|
-
message: adaptGroup5(raw["server.message"]),
|
|
355
|
-
model: adaptGroup6(raw["server.model"]),
|
|
356
|
-
generate: adaptGroup7(raw["server.generate"]),
|
|
357
|
-
provider: adaptGroup8(raw["server.provider"]),
|
|
358
|
-
integration: adaptGroup9(raw["server.integration"]),
|
|
359
|
-
"server.mcp": adaptGroup10(raw["server.mcp"]),
|
|
360
|
-
credential: adaptGroup11(raw["server.credential"]),
|
|
361
|
-
project: adaptGroup12(raw["server.project"]),
|
|
362
|
-
form: adaptGroup13(raw["server.form"]),
|
|
363
|
-
permission: adaptGroup14(raw["server.permission"]),
|
|
364
|
-
file: adaptGroup15(raw["server.fs"]),
|
|
365
|
-
command: adaptGroup16(raw["server.command"]),
|
|
366
|
-
skill: adaptGroup17(raw["server.skill"]),
|
|
367
|
-
event: adaptGroup18(raw["server.event"]),
|
|
368
|
-
pty: adaptGroup19(raw["server.pty"]),
|
|
369
|
-
shell: adaptGroup20(raw["server.shell"]),
|
|
370
|
-
question: adaptGroup21(raw["server.question"]),
|
|
371
|
-
reference: adaptGroup22(raw["server.reference"]),
|
|
372
|
-
projectCopy: adaptGroup23(raw["server.projectCopy"]),
|
|
373
|
-
vcs: adaptGroup24(raw["server.vcs"]),
|
|
374
|
-
debug: adaptGroup25(raw["server.debug"]),
|
|
375
|
-
});
|
|
376
|
-
export const make = (options) => HttpApiClient.make(ClientApi, options).pipe(Effect.map(adaptClient));
|
package/dist/effect/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Effect } from "effect";
|
|
2
|
-
export * from "./generated/index";
|
|
3
|
-
export type { AgentApi, AppApi, CatalogApi, CommandApi, EventApi, IntegrationApi, ModelApi, PluginApi, ProviderApi, ReferenceApi, SessionApi, SkillApi, } from "./api.js";
|
|
4
|
-
export { Service } from "./service.js";
|
|
5
|
-
export { Agent } from "@opencode-ai/schema/agent";
|
|
6
|
-
export { Command } from "@opencode-ai/schema/command";
|
|
7
|
-
export { Credential } from "@opencode-ai/schema/credential";
|
|
8
|
-
export { Event } from "@opencode-ai/schema/event";
|
|
9
|
-
export { EventLog } from "@opencode-ai/schema/event-log";
|
|
10
|
-
export { FileSystem } from "@opencode-ai/schema/filesystem";
|
|
11
|
-
export { Form } from "@opencode-ai/schema/form";
|
|
12
|
-
export { Integration } from "@opencode-ai/schema/integration";
|
|
13
|
-
export { Location } from "@opencode-ai/schema/location";
|
|
14
|
-
export { Model } from "@opencode-ai/schema/model";
|
|
15
|
-
export { Permission } from "@opencode-ai/schema/permission";
|
|
16
|
-
export { PermissionSaved } from "@opencode-ai/schema/permission-saved";
|
|
17
|
-
export { Project } from "@opencode-ai/schema/project";
|
|
18
|
-
export { ProjectCopy } from "@opencode-ai/schema/project-copy";
|
|
19
|
-
export { Provider } from "@opencode-ai/schema/provider";
|
|
20
|
-
export { Pty } from "@opencode-ai/schema/pty";
|
|
21
|
-
export { Question } from "@opencode-ai/schema/question";
|
|
22
|
-
export { Reference } from "@opencode-ai/schema/reference";
|
|
23
|
-
export { AbsolutePath, RelativePath } from "@opencode-ai/schema/schema";
|
|
24
|
-
export { Session } from "@opencode-ai/schema/session";
|
|
25
|
-
export { SessionInput } from "@opencode-ai/schema/session-input";
|
|
26
|
-
export { SessionMessage } from "@opencode-ai/schema/session-message";
|
|
27
|
-
export { Skill } from "@opencode-ai/schema/skill";
|
|
28
|
-
export { Prompt } from "@opencode-ai/schema/prompt";
|
|
29
|
-
export type { OpenCodeEvent } from "@opencode-ai/protocol/groups/event";
|
|
30
|
-
export type OpenCodeClient = Effect.Success<ReturnType<typeof import("./generated/client").make>>;
|
package/dist/effect/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export * from "./generated/index";
|
|
2
|
-
export { Service } from "./service.js";
|
|
3
|
-
export { Agent } from "@opencode-ai/schema/agent";
|
|
4
|
-
export { Command } from "@opencode-ai/schema/command";
|
|
5
|
-
export { Credential } from "@opencode-ai/schema/credential";
|
|
6
|
-
export { Event } from "@opencode-ai/schema/event";
|
|
7
|
-
export { EventLog } from "@opencode-ai/schema/event-log";
|
|
8
|
-
export { FileSystem } from "@opencode-ai/schema/filesystem";
|
|
9
|
-
export { Form } from "@opencode-ai/schema/form";
|
|
10
|
-
export { Integration } from "@opencode-ai/schema/integration";
|
|
11
|
-
export { Location } from "@opencode-ai/schema/location";
|
|
12
|
-
export { Model } from "@opencode-ai/schema/model";
|
|
13
|
-
export { Permission } from "@opencode-ai/schema/permission";
|
|
14
|
-
export { PermissionSaved } from "@opencode-ai/schema/permission-saved";
|
|
15
|
-
export { Project } from "@opencode-ai/schema/project";
|
|
16
|
-
export { ProjectCopy } from "@opencode-ai/schema/project-copy";
|
|
17
|
-
export { Provider } from "@opencode-ai/schema/provider";
|
|
18
|
-
export { Pty } from "@opencode-ai/schema/pty";
|
|
19
|
-
export { Question } from "@opencode-ai/schema/question";
|
|
20
|
-
export { Reference } from "@opencode-ai/schema/reference";
|
|
21
|
-
export { AbsolutePath, RelativePath } from "@opencode-ai/schema/schema";
|
|
22
|
-
export { Session } from "@opencode-ai/schema/session";
|
|
23
|
-
export { SessionInput } from "@opencode-ai/schema/session-input";
|
|
24
|
-
export { SessionMessage } from "@opencode-ai/schema/session-message";
|
|
25
|
-
export { Skill } from "@opencode-ai/schema/skill";
|
|
26
|
-
export { Prompt } from "@opencode-ai/schema/prompt";
|
package/dist/effect/service.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Effect, FileSystem, Schema } from "effect";
|
|
2
|
-
export type Transport = {
|
|
3
|
-
readonly url: string;
|
|
4
|
-
readonly headers?: RequestInit["headers"];
|
|
5
|
-
};
|
|
6
|
-
export type Options = {
|
|
7
|
-
readonly file?: string;
|
|
8
|
-
readonly version?: string;
|
|
9
|
-
readonly command?: ReadonlyArray<string>;
|
|
10
|
-
};
|
|
11
|
-
export declare const discover: (options?: Options | undefined) => Effect.Effect<{
|
|
12
|
-
url: string;
|
|
13
|
-
headers: HeadersInit | undefined;
|
|
14
|
-
} | undefined, never, FileSystem.FileSystem>;
|
|
15
|
-
export declare const start: (options?: Options | undefined) => Effect.Effect<{
|
|
16
|
-
url: string;
|
|
17
|
-
headers: HeadersInit | undefined;
|
|
18
|
-
}, Error, FileSystem.FileSystem>;
|
|
19
|
-
export declare const stop: (options?: Options | undefined) => Effect.Effect<void, Error, FileSystem.FileSystem>;
|
|
20
|
-
export declare const Info: Schema.Struct<{
|
|
21
|
-
readonly id: Schema.optional<Schema.String>;
|
|
22
|
-
readonly version: Schema.optional<Schema.String>;
|
|
23
|
-
readonly url: Schema.String;
|
|
24
|
-
readonly pid: Schema.Int;
|
|
25
|
-
readonly password: Schema.optional<Schema.String>;
|
|
26
|
-
}>;
|
|
27
|
-
export type Info = typeof Info.Type;
|
|
28
|
-
export * as Service from "./service.js";
|
package/dist/effect/service.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Effect, FileSystem, Option, Schedule, Schema } from "effect";
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
// Read-only lookup: registration file plus health check and version gate.
|
|
6
|
-
// Never spawns; escalation to start() is the caller's policy.
|
|
7
|
-
export const discover = Effect.fn("service.discover")(function* (options = {}) {
|
|
8
|
-
const info = yield* read(options.file);
|
|
9
|
-
if (info === undefined)
|
|
10
|
-
return undefined;
|
|
11
|
-
if (options.version !== undefined && info.version !== options.version)
|
|
12
|
-
return undefined;
|
|
13
|
-
const found = yield* probe(info);
|
|
14
|
-
return found?.transport;
|
|
15
|
-
});
|
|
16
|
-
// Idempotent ensure-running: reuses a healthy compatible server, replaces a
|
|
17
|
-
// version-mismatched one, and otherwise spawns the service command detached.
|
|
18
|
-
export const start = Effect.fn("service.start")(function* (options = {}) {
|
|
19
|
-
const compatible = yield* discover(options);
|
|
20
|
-
if (compatible !== undefined)
|
|
21
|
-
return compatible;
|
|
22
|
-
const mismatched = yield* find(options);
|
|
23
|
-
if (mismatched !== undefined)
|
|
24
|
-
yield* kill(mismatched.info, options).pipe(Effect.ignore);
|
|
25
|
-
const [command, ...args] = options.command ?? ["opencode", "serve", "--service"];
|
|
26
|
-
if (command === undefined)
|
|
27
|
-
return yield* Effect.fail(new Error("Missing service command"));
|
|
28
|
-
yield* Effect.try({
|
|
29
|
-
try: () => {
|
|
30
|
-
spawn(command, args, { detached: true, stdio: "ignore" }).unref();
|
|
31
|
-
},
|
|
32
|
-
catch: (cause) => new Error("Failed to start server", { cause }),
|
|
33
|
-
});
|
|
34
|
-
return yield* discover(options).pipe(Effect.flatMap((found) => found === undefined ? Effect.fail(new Error("Server is not ready")) : Effect.succeed(found)), Effect.retry(poll), Effect.mapError(() => new Error("Failed to start server")));
|
|
35
|
-
});
|
|
36
|
-
export const stop = Effect.fn("service.stop")(function* (options = {}) {
|
|
37
|
-
const fs = yield* FileSystem.FileSystem;
|
|
38
|
-
const existing = yield* find(options);
|
|
39
|
-
if (existing !== undefined)
|
|
40
|
-
yield* kill(existing.info, options);
|
|
41
|
-
yield* fs.remove(options.file ?? fallback()).pipe(Effect.ignore);
|
|
42
|
-
});
|
|
43
|
-
function fallback() {
|
|
44
|
-
const state = process.env["XDG_STATE_HOME"] ?? join(homedir(), ".local", "state");
|
|
45
|
-
return join(state, "opencode", "service.json");
|
|
46
|
-
}
|
|
47
|
-
function auth(password) {
|
|
48
|
-
return { authorization: "Basic " + btoa("opencode:" + password) };
|
|
49
|
-
}
|
|
50
|
-
export const Info = Schema.Struct({
|
|
51
|
-
id: Schema.optional(Schema.String),
|
|
52
|
-
version: Schema.optional(Schema.String),
|
|
53
|
-
url: Schema.String,
|
|
54
|
-
pid: Schema.Int.check(Schema.isGreaterThan(0)),
|
|
55
|
-
password: Schema.optional(Schema.String),
|
|
56
|
-
});
|
|
57
|
-
const decode = Schema.decodeUnknownEffect(Schema.fromJsonString(Info));
|
|
58
|
-
// A missing or corrupt file means no valid info; callers treat both
|
|
59
|
-
// the same (the registering server self-evicts, clients rediscover).
|
|
60
|
-
const read = Effect.fnUntraced(function* (file) {
|
|
61
|
-
const fs = yield* FileSystem.FileSystem;
|
|
62
|
-
const text = yield* fs.readFileString(file ?? fallback()).pipe(Effect.option);
|
|
63
|
-
if (Option.isNone(text))
|
|
64
|
-
return undefined;
|
|
65
|
-
return yield* decode(text.value).pipe(Effect.option, Effect.map(Option.getOrUndefined));
|
|
66
|
-
});
|
|
67
|
-
const probe = Effect.fnUntraced(function* (info) {
|
|
68
|
-
const headers = info.password === undefined ? undefined : auth(info.password);
|
|
69
|
-
const healthy = yield* Effect.tryPromise(() => fetch(new URL("/api/health", info.url), {
|
|
70
|
-
headers,
|
|
71
|
-
signal: AbortSignal.timeout(2_000),
|
|
72
|
-
})).pipe(Effect.map((response) => response.ok), Effect.orElseSucceed(() => false));
|
|
73
|
-
if (!healthy)
|
|
74
|
-
return undefined;
|
|
75
|
-
return { info, transport: { url: info.url, headers } };
|
|
76
|
-
});
|
|
77
|
-
// Health-checked lookup without the version gate: lifecycle operations must be
|
|
78
|
-
// able to see (and replace or stop) a server from a different version.
|
|
79
|
-
const find = Effect.fnUntraced(function* (options) {
|
|
80
|
-
const info = yield* read(options.file);
|
|
81
|
-
if (info === undefined)
|
|
82
|
-
return undefined;
|
|
83
|
-
return yield* probe(info);
|
|
84
|
-
});
|
|
85
|
-
// 50ms cadence bounded at ~5s, shared by stop escalation and start readiness.
|
|
86
|
-
const poll = Schedule.spaced("50 millis").pipe(Schedule.both(Schedule.recurs(100)));
|
|
87
|
-
const signal = (pid, name) => Effect.try({ try: () => process.kill(pid, name), catch: (cause) => cause }).pipe(Effect.ignore);
|
|
88
|
-
const stopped = Effect.fnUntraced(function* (pid) {
|
|
89
|
-
const running = yield* Effect.try({ try: () => process.kill(pid, 0), catch: () => false }).pipe(Effect.orElseSucceed(() => false));
|
|
90
|
-
if (!running)
|
|
91
|
-
return true;
|
|
92
|
-
return yield* Effect.fail(new Error(`Server process ${pid} is still running`));
|
|
93
|
-
});
|
|
94
|
-
function same(left, right) {
|
|
95
|
-
return left.id === right.id && left.version === right.version && left.url === right.url && left.pid === right.pid;
|
|
96
|
-
}
|
|
97
|
-
const kill = Effect.fnUntraced(function* (info, options) {
|
|
98
|
-
// A stale registration may point at a PID that has since been reused by
|
|
99
|
-
// another process. Only signal the PID after authenticating the server.
|
|
100
|
-
const current = yield* find(options);
|
|
101
|
-
if (current === undefined || !same(current.info, info))
|
|
102
|
-
return;
|
|
103
|
-
yield* signal(info.pid, "SIGTERM");
|
|
104
|
-
const done = yield* stopped(info.pid).pipe(Effect.retry(poll), Effect.option);
|
|
105
|
-
if (Option.isSome(done))
|
|
106
|
-
return;
|
|
107
|
-
const latest = yield* find(options);
|
|
108
|
-
if (latest === undefined || !same(latest.info, info))
|
|
109
|
-
return;
|
|
110
|
-
yield* signal(info.pid, "SIGKILL");
|
|
111
|
-
yield* stopped(info.pid).pipe(Effect.retry(poll));
|
|
112
|
-
});
|
|
113
|
-
export * as Service from "./service.js";
|
package/dist/promise/api.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { AgentApi as EffectAgentApi, CommandApi as EffectCommandApi, EventApi as EffectEventApi, IntegrationApi as EffectIntegrationApi, ModelApi as EffectModelApi, PluginApi as EffectPluginApi, ProviderApi as EffectProviderApi, ReferenceApi as EffectReferenceApi, SessionApi as EffectSessionApi, SkillApi as EffectSkillApi } from "../effect/api/api.js";
|
|
2
|
-
import type { Effect, Stream } from "effect";
|
|
3
|
-
type PromisifyOperation<Operation> = Operation extends (...args: infer Args) => Effect.Effect<infer Success, unknown, unknown> ? (...args: Args) => Promise<Success> : Operation extends (...args: infer Args) => Stream.Stream<infer Success, unknown, unknown> ? (...args: Args) => AsyncIterable<Success> : Operation;
|
|
4
|
-
type PromisifyApi<Api> = {
|
|
5
|
-
readonly [Name in keyof Api]: PromisifyOperation<Api[Name]>;
|
|
6
|
-
};
|
|
7
|
-
export type AgentApi = PromisifyApi<EffectAgentApi<unknown>>;
|
|
8
|
-
export type CommandApi = PromisifyApi<EffectCommandApi<unknown>>;
|
|
9
|
-
export type EventApi = PromisifyApi<EffectEventApi<unknown>>;
|
|
10
|
-
export type IntegrationApi = PromisifyApi<EffectIntegrationApi<unknown>>;
|
|
11
|
-
export type ModelApi = PromisifyApi<EffectModelApi<unknown>>;
|
|
12
|
-
export type PluginApi = PromisifyApi<EffectPluginApi<unknown>>;
|
|
13
|
-
export type ProviderApi = PromisifyApi<EffectProviderApi<unknown>>;
|
|
14
|
-
export type ReferenceApi = PromisifyApi<EffectReferenceApi<unknown>>;
|
|
15
|
-
export type SessionApi = PromisifyApi<EffectSessionApi<unknown>>;
|
|
16
|
-
export type SkillApi = PromisifyApi<EffectSkillApi<unknown>>;
|
|
17
|
-
export interface CatalogApi {
|
|
18
|
-
readonly provider: ProviderApi;
|
|
19
|
-
readonly model: ModelApi;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
package/dist/promise/api.js
DELETED
|
File without changes
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type ClientErrorReason = "Transport" | "UnexpectedStatus" | "UnsupportedContentType" | "MalformedResponse";
|
|
2
|
-
export declare class ClientError extends Error {
|
|
3
|
-
readonly reason: ClientErrorReason;
|
|
4
|
-
readonly name = "ClientError";
|
|
5
|
-
constructor(reason: ClientErrorReason, options?: ErrorOptions);
|
|
6
|
-
}
|