@opencode/client 2.0.3 → 2.0.5
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/dist/effect/api/api.d.ts +321 -344
- package/dist/effect/api.d.ts +1 -5
- package/dist/effect/client.d.ts +59 -69
- package/dist/effect/generated/client.d.ts +60 -70
- package/dist/effect/generated/client.js +53 -91
- package/dist/effect/index.d.ts +1 -1
- package/dist/effect/service.js +43 -32
- package/dist/promise/api.d.ts +0 -4
- package/dist/promise/client.d.ts +22 -39
- package/dist/promise/generated/client.d.ts +23 -40
- package/dist/promise/generated/client.js +117 -192
- package/dist/promise/generated/types.d.ts +1352 -1867
- package/dist/promise/generated/types.js +6 -3
- package/dist/promise/index.d.ts +1 -1
- package/dist/promise/service.js +40 -24
- package/dist/rpc-runtime.d.ts +0 -1
- package/dist/solid/data.d.ts +4 -4
- package/dist/solid/data.js +68 -42
- package/dist/solid/pty.js +0 -2
- package/package.json +4 -4
|
@@ -10,10 +10,8 @@ const mapClientError = (error) => HttpClientError.isHttpClientError(error) || Sc
|
|
|
10
10
|
: error;
|
|
11
11
|
const preserveEffect = () => (effect) => effect;
|
|
12
12
|
const preserveStream = () => (stream) => stream;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const EndpointServerGet = (raw) => () => preserveEffect()(raw["server.get"]({}).pipe(Effect.mapError(mapClientError)));
|
|
16
|
-
const adaptGroupServer = (raw) => ({ get: EndpointServerGet(raw) });
|
|
13
|
+
const EndpointServerStatus = (raw) => () => preserveEffect()(raw["server.status"]({}).pipe(Effect.mapError(mapClientError)));
|
|
14
|
+
const adaptGroupServer = (raw) => ({ status: EndpointServerStatus(raw) });
|
|
17
15
|
const EndpointLocationGet = (raw) => (input) => preserveEffect()(raw["location.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
18
16
|
const adaptGroupLocation = (raw) => ({ get: EndpointLocationGet(raw) });
|
|
19
17
|
const EndpointAgentList = (raw) => (input) => preserveEffect()(raw["agent.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
@@ -23,18 +21,15 @@ const adaptGroupAgent = (raw) => ({
|
|
|
23
21
|
get: EndpointAgentGet(raw),
|
|
24
22
|
});
|
|
25
23
|
const EndpointPluginList = (raw) => (input) => preserveEffect()(raw["plugin.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
26
|
-
const EndpointPluginAwaitActivation = (raw) => (input) => preserveEffect()(raw["plugin.awaitActivation"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
27
24
|
const EndpointPluginCheck = (raw) => (input) => preserveEffect()(raw["plugin.check"]({ query: { location: input?.["location"] }, payload: { target: input?.["target"] } }).pipe(Effect.mapError(mapClientError)));
|
|
28
25
|
const EndpointPluginUpdate = (raw) => (input) => preserveEffect()(raw["plugin.update"]({ query: { location: input["location"] }, payload: { targets: input["targets"] } }).pipe(Effect.mapError(mapClientError)));
|
|
29
26
|
const adaptGroupPlugin = (raw) => ({
|
|
30
27
|
list: EndpointPluginList(raw),
|
|
31
|
-
awaitActivation: EndpointPluginAwaitActivation(raw),
|
|
32
28
|
check: EndpointPluginCheck(raw),
|
|
33
29
|
update: EndpointPluginUpdate(raw),
|
|
34
30
|
});
|
|
35
31
|
const EndpointSessionList = (raw) => (input) => preserveEffect()(raw["session.list"]({
|
|
36
32
|
query: {
|
|
37
|
-
workspace: input?.["workspace"],
|
|
38
33
|
limit: input?.["limit"],
|
|
39
34
|
order: input?.["order"],
|
|
40
35
|
search: input?.["search"],
|
|
@@ -72,13 +67,16 @@ const EndpointSessionExport = (raw) => (input) => preserveEffect()(raw["session.
|
|
|
72
67
|
const EndpointSessionActive = (raw) => () => preserveEffect()(raw["session.active"]({}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
73
68
|
const EndpointSessionGet = (raw) => (input) => preserveEffect()(raw["session.get"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
74
69
|
const EndpointSessionRemove = (raw) => (input) => preserveEffect()(raw["session.remove"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
75
|
-
const EndpointSessionFork = (raw) => (input) => preserveEffect()(raw["session.fork"]({ params: { sessionID: input["sessionID"] }, payload: {
|
|
70
|
+
const EndpointSessionFork = (raw) => (input) => preserveEffect()(raw["session.fork"]({ params: { sessionID: input["sessionID"] }, payload: { before: input["before"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
76
71
|
const EndpointSessionSwitchAgent = (raw) => (input) => preserveEffect()(raw["session.switchAgent"]({ params: { sessionID: input["sessionID"] }, payload: { agent: input["agent"] } }).pipe(Effect.mapError(mapClientError)));
|
|
77
72
|
const EndpointSessionSwitchModel = (raw) => (input) => preserveEffect()(raw["session.switchModel"]({ params: { sessionID: input["sessionID"] }, payload: { model: input["model"] } }).pipe(Effect.mapError(mapClientError)));
|
|
78
|
-
const
|
|
73
|
+
const EndpointSessionUpdate = (raw) => (input) => preserveEffect()(raw["session.update"]({
|
|
74
|
+
params: { sessionID: input["sessionID"] },
|
|
75
|
+
payload: { title: input["title"], permissions: input["permissions"] },
|
|
76
|
+
}).pipe(Effect.mapError(mapClientError)));
|
|
79
77
|
const EndpointSessionMove = (raw) => (input) => preserveEffect()(raw["session.move"]({
|
|
80
78
|
params: { sessionID: input["sessionID"] },
|
|
81
|
-
payload: { directory: input["directory"],
|
|
79
|
+
payload: { directory: input["directory"], delivery: input["delivery"] },
|
|
82
80
|
}).pipe(Effect.mapError(mapClientError)));
|
|
83
81
|
const EndpointSessionPrompt = (raw) => (input) => preserveEffect()(raw["session.prompt"]({
|
|
84
82
|
params: { sessionID: input["sessionID"] },
|
|
@@ -96,7 +94,7 @@ const EndpointSessionPrompt = (raw) => (input) => preserveEffect()(raw["session.
|
|
|
96
94
|
const EndpointSessionCommand = (raw) => (input) => preserveEffect()(raw["session.command"]({
|
|
97
95
|
params: { sessionID: input["sessionID"] },
|
|
98
96
|
payload: {
|
|
99
|
-
|
|
97
|
+
name: input["name"],
|
|
100
98
|
text: input["text"],
|
|
101
99
|
files: input["files"],
|
|
102
100
|
agents: input["agents"],
|
|
@@ -106,7 +104,7 @@ const EndpointSessionCommand = (raw) => (input) => preserveEffect()(raw["session
|
|
|
106
104
|
}).pipe(Effect.mapError(mapClientError)));
|
|
107
105
|
const EndpointSessionSkill = (raw) => (input) => preserveEffect()(raw["session.skill"]({
|
|
108
106
|
params: { sessionID: input["sessionID"] },
|
|
109
|
-
payload: { id: input["id"],
|
|
107
|
+
payload: { id: input["id"], resume: input["resume"] },
|
|
110
108
|
}).pipe(Effect.mapError(mapClientError)));
|
|
111
109
|
const EndpointSessionSynthetic = (raw) => (input) => preserveEffect()(raw["session.synthetic"]({
|
|
112
110
|
params: { sessionID: input["sessionID"] },
|
|
@@ -141,8 +139,10 @@ const EndpointSessionDiff = (raw) => (input) => preserveEffect()(raw["session.di
|
|
|
141
139
|
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
142
140
|
const EndpointSessionInboxList = (raw) => (input) => preserveEffect()(raw["session.inbox.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
143
141
|
const EndpointSessionInboxCancel = (raw) => (input) => preserveEffect()(raw["session.inbox.cancel"]({ params: { sessionID: input["sessionID"], inboxID: input["inboxID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
144
|
-
const
|
|
145
|
-
|
|
142
|
+
const EndpointSessionInboxUpdate = (raw) => (input) => preserveEffect()(raw["session.inbox.update"]({
|
|
143
|
+
params: { sessionID: input["sessionID"], inboxID: input["inboxID"] },
|
|
144
|
+
payload: { delivery: input["delivery"] },
|
|
145
|
+
}).pipe(Effect.mapError(mapClientError)));
|
|
146
146
|
const EndpointSessionInstructionsEntryList = (raw) => (input) => preserveEffect()(raw["session.instructions.entry.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
147
147
|
const EndpointSessionInstructionsEntryPut = (raw) => (input) => preserveEffect()(raw["session.instructions.entry.put"]({
|
|
148
148
|
params: { sessionID: input["sessionID"], key: input["key"] },
|
|
@@ -154,12 +154,20 @@ const EndpointSessionLog = (raw) => (input) => preserveStream()(Stream.unwrap(ra
|
|
|
154
154
|
params: { sessionID: input["sessionID"] },
|
|
155
155
|
query: { after: input["after"], follow: input["follow"] },
|
|
156
156
|
}).pipe(Effect.mapError(mapClientError), Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError))))));
|
|
157
|
-
const EndpointSessionInterrupt = (raw) => (input) => preserveEffect()(raw["session.interrupt"]({
|
|
157
|
+
const EndpointSessionInterrupt = (raw) => (input) => preserveEffect()(raw["session.interrupt"]({ params: { sessionID: input["sessionID"] }, query: { resume: input["resume"] } }).pipe(Effect.mapError(mapClientError)));
|
|
158
|
+
const EndpointSessionBackground = (raw) => (input) => preserveEffect()(raw["session.background"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
159
|
+
const EndpointSessionMessageGet = (raw) => (input) => preserveEffect()(raw["session.message"]({ params: { sessionID: input["sessionID"], messageID: input["messageID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
160
|
+
const EndpointSessionFormList = (raw) => (input) => preserveEffect()(raw["session.form.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
161
|
+
const EndpointSessionFormCreate = (raw) => (input) => preserveEffect()(raw["session.form.create"]({
|
|
158
162
|
params: { sessionID: input["sessionID"] },
|
|
159
|
-
|
|
163
|
+
payload: { id: input["id"], title: input["title"], metadata: input["metadata"], fields: input["fields"] },
|
|
164
|
+
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
165
|
+
const EndpointSessionFormGet = (raw) => (input) => preserveEffect()(raw["session.form.get"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
166
|
+
const EndpointSessionFormReply = (raw) => (input) => preserveEffect()(raw["session.form.reply"]({
|
|
167
|
+
params: { sessionID: input["sessionID"], formID: input["formID"] },
|
|
168
|
+
payload: { answer: input["answer"] },
|
|
160
169
|
}).pipe(Effect.mapError(mapClientError)));
|
|
161
|
-
const
|
|
162
|
-
const EndpointSessionMessage = (raw) => (input) => preserveEffect()(raw["session.message"]({ params: { sessionID: input["sessionID"], messageID: input["messageID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
170
|
+
const EndpointSessionFormCancel = (raw) => (input) => preserveEffect()(raw["session.form.cancel"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
163
171
|
const EndpointSessionEnvironment = (raw) => (input) => preserveEffect()(raw["session.environment"]({
|
|
164
172
|
params: { sessionID: input["sessionID"] },
|
|
165
173
|
payload: { variables: input["variables"] },
|
|
@@ -177,7 +185,7 @@ const adaptGroupSession = (raw) => ({
|
|
|
177
185
|
fork: EndpointSessionFork(raw),
|
|
178
186
|
switchAgent: EndpointSessionSwitchAgent(raw),
|
|
179
187
|
switchModel: EndpointSessionSwitchModel(raw),
|
|
180
|
-
|
|
188
|
+
update: EndpointSessionUpdate(raw),
|
|
181
189
|
move: EndpointSessionMove(raw),
|
|
182
190
|
prompt: EndpointSessionPrompt(raw),
|
|
183
191
|
command: EndpointSessionCommand(raw),
|
|
@@ -196,8 +204,7 @@ const adaptGroupSession = (raw) => ({
|
|
|
196
204
|
inbox: {
|
|
197
205
|
list: EndpointSessionInboxList(raw),
|
|
198
206
|
cancel: EndpointSessionInboxCancel(raw),
|
|
199
|
-
|
|
200
|
-
queue: EndpointSessionInboxQueue(raw),
|
|
207
|
+
update: EndpointSessionInboxUpdate(raw),
|
|
201
208
|
},
|
|
202
209
|
instructions: {
|
|
203
210
|
entry: {
|
|
@@ -210,7 +217,14 @@ const adaptGroupSession = (raw) => ({
|
|
|
210
217
|
log: EndpointSessionLog(raw),
|
|
211
218
|
interrupt: EndpointSessionInterrupt(raw),
|
|
212
219
|
background: EndpointSessionBackground(raw),
|
|
213
|
-
message:
|
|
220
|
+
message: { get: EndpointSessionMessageGet(raw) },
|
|
221
|
+
form: {
|
|
222
|
+
list: EndpointSessionFormList(raw),
|
|
223
|
+
create: EndpointSessionFormCreate(raw),
|
|
224
|
+
get: EndpointSessionFormGet(raw),
|
|
225
|
+
reply: EndpointSessionFormReply(raw),
|
|
226
|
+
cancel: EndpointSessionFormCancel(raw),
|
|
227
|
+
},
|
|
214
228
|
environment: EndpointSessionEnvironment(raw),
|
|
215
229
|
view: EndpointSessionView(raw),
|
|
216
230
|
});
|
|
@@ -312,17 +326,10 @@ const adaptGroupMcp = (raw) => ({
|
|
|
312
326
|
});
|
|
313
327
|
const EndpointCredentialUpdate = (raw) => (input) => preserveEffect()(raw["credential.update"]({
|
|
314
328
|
params: { credentialID: input["credentialID"] },
|
|
315
|
-
query: { location: input["location"] },
|
|
316
329
|
payload: { label: input["label"] },
|
|
317
330
|
}).pipe(Effect.mapError(mapClientError)));
|
|
318
|
-
const EndpointCredentialActivate = (raw) => (input) => preserveEffect()(raw["credential.activate"]({
|
|
319
|
-
|
|
320
|
-
query: { location: input["location"] },
|
|
321
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
322
|
-
const EndpointCredentialRemove = (raw) => (input) => preserveEffect()(raw["credential.remove"]({
|
|
323
|
-
params: { credentialID: input["credentialID"] },
|
|
324
|
-
query: { location: input["location"] },
|
|
325
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
331
|
+
const EndpointCredentialActivate = (raw) => (input) => preserveEffect()(raw["credential.activate"]({ params: { credentialID: input["credentialID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
332
|
+
const EndpointCredentialRemove = (raw) => (input) => preserveEffect()(raw["credential.remove"]({ params: { credentialID: input["credentialID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
326
333
|
const adaptGroupCredential = (raw) => ({
|
|
327
334
|
update: EndpointCredentialUpdate(raw),
|
|
328
335
|
activate: EndpointCredentialActivate(raw),
|
|
@@ -333,34 +340,12 @@ const EndpointProjectUpdate = (raw) => (input) => preserveEffect()(raw["project.
|
|
|
333
340
|
params: { projectID: input["projectID"] },
|
|
334
341
|
payload: { canonical: input["canonical"], name: input["name"], icon: input["icon"], commands: input["commands"] },
|
|
335
342
|
}).pipe(Effect.mapError(mapClientError)));
|
|
336
|
-
const EndpointProjectCurrent = (raw) => (input) => preserveEffect()(raw["project.current"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
337
343
|
const adaptGroupProject = (raw) => ({
|
|
338
344
|
list: EndpointProjectList(raw),
|
|
339
345
|
update: EndpointProjectUpdate(raw),
|
|
340
|
-
current: EndpointProjectCurrent(raw),
|
|
341
|
-
});
|
|
342
|
-
const EndpointFormRequestList = (raw) => (input) => preserveEffect()(raw["form.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
343
|
-
const EndpointFormList = (raw) => (input) => preserveEffect()(raw["session.form.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
344
|
-
const EndpointFormCreate = (raw) => (input) => preserveEffect()(raw["session.form.create"]({
|
|
345
|
-
params: { sessionID: input["sessionID"] },
|
|
346
|
-
payload: { id: input["id"], title: input["title"], metadata: input["metadata"], fields: input["fields"] },
|
|
347
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
348
|
-
const EndpointFormGet = (raw) => (input) => preserveEffect()(raw["session.form.get"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
349
|
-
const EndpointFormState = (raw) => (input) => preserveEffect()(raw["session.form.state"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
350
|
-
const EndpointFormReply = (raw) => (input) => preserveEffect()(raw["session.form.reply"]({
|
|
351
|
-
params: { sessionID: input["sessionID"], formID: input["formID"] },
|
|
352
|
-
payload: { answer: input["answer"] },
|
|
353
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
354
|
-
const EndpointFormCancel = (raw) => (input) => preserveEffect()(raw["session.form.cancel"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
355
|
-
const adaptGroupForm = (raw) => ({
|
|
356
|
-
request: { list: EndpointFormRequestList(raw) },
|
|
357
|
-
list: EndpointFormList(raw),
|
|
358
|
-
create: EndpointFormCreate(raw),
|
|
359
|
-
get: EndpointFormGet(raw),
|
|
360
|
-
state: EndpointFormState(raw),
|
|
361
|
-
reply: EndpointFormReply(raw),
|
|
362
|
-
cancel: EndpointFormCancel(raw),
|
|
363
346
|
});
|
|
347
|
+
const EndpointFormList = (raw) => (input) => preserveEffect()(raw["form.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
348
|
+
const adaptGroupForm = (raw) => ({ list: EndpointFormList(raw) });
|
|
364
349
|
const EndpointPermissionRequestList = (raw) => (input) => preserveEffect()(raw["permission.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
365
350
|
const EndpointPermissionSavedList = (raw) => (input) => preserveEffect()(raw["permission.saved.list"]({ query: { projectID: input?.["projectID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
366
351
|
const EndpointPermissionSavedRemove = (raw) => (input) => preserveEffect()(raw["permission.saved.remove"]({ params: { id: input["id"] } }).pipe(Effect.mapError(mapClientError)));
|
|
@@ -380,11 +365,7 @@ const EndpointPermissionList = (raw) => (input) => preserveEffect()(raw["session
|
|
|
380
365
|
const EndpointPermissionGet = (raw) => (input) => preserveEffect()(raw["session.permission.get"]({ params: { sessionID: input["sessionID"], requestID: input["requestID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
381
366
|
const EndpointPermissionReply = (raw) => (input) => preserveEffect()(raw["session.permission.reply"]({
|
|
382
367
|
params: { sessionID: input["sessionID"], requestID: input["requestID"] },
|
|
383
|
-
payload: {
|
|
384
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
385
|
-
const EndpointPermissionRules = (raw) => (input) => preserveEffect()(raw["session.permission.rules"]({
|
|
386
|
-
params: { sessionID: input["sessionID"] },
|
|
387
|
-
payload: { permissions: input["permissions"] },
|
|
368
|
+
payload: { decision: input["decision"], message: input["message"] },
|
|
388
369
|
}).pipe(Effect.mapError(mapClientError)));
|
|
389
370
|
const adaptGroupPermission = (raw) => ({
|
|
390
371
|
request: { list: EndpointPermissionRequestList(raw) },
|
|
@@ -393,7 +374,6 @@ const adaptGroupPermission = (raw) => ({
|
|
|
393
374
|
list: EndpointPermissionList(raw),
|
|
394
375
|
get: EndpointPermissionGet(raw),
|
|
395
376
|
reply: EndpointPermissionReply(raw),
|
|
396
|
-
rules: EndpointPermissionRules(raw),
|
|
397
377
|
});
|
|
398
378
|
const EndpointFileList = (raw) => (input) => preserveEffect()(raw["fs.list"]({ query: { location: input?.["location"], path: input?.["path"] } }).pipe(Effect.mapError(mapClientError)));
|
|
399
379
|
const EndpointFileFind = (raw) => (input) => preserveEffect()(raw["fs.find"]({
|
|
@@ -489,11 +469,6 @@ const EndpointShellCreate = (raw) => (input) => preserveEffect()(raw["shell.crea
|
|
|
489
469
|
payload: { command: input["command"], cwd: input["cwd"], timeout: input["timeout"], metadata: input["metadata"] },
|
|
490
470
|
}).pipe(Effect.mapError(mapClientError)));
|
|
491
471
|
const EndpointShellGet = (raw) => (input) => preserveEffect()(raw["shell.get"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
492
|
-
const EndpointShellTimeout = (raw) => (input) => preserveEffect()(raw["shell.timeout"]({
|
|
493
|
-
params: { id: input["id"] },
|
|
494
|
-
query: { location: input["location"] },
|
|
495
|
-
payload: { timeout: input["timeout"] },
|
|
496
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
497
472
|
const EndpointShellOutput = (raw) => (input) => preserveEffect()(raw["shell.output"]({
|
|
498
473
|
params: { id: input["id"] },
|
|
499
474
|
query: { location: input["location"], cursor: input["cursor"], limit: input["limit"] },
|
|
@@ -503,44 +478,35 @@ const adaptGroupShell = (raw) => ({
|
|
|
503
478
|
list: EndpointShellList(raw),
|
|
504
479
|
create: EndpointShellCreate(raw),
|
|
505
480
|
get: EndpointShellGet(raw),
|
|
506
|
-
timeout: EndpointShellTimeout(raw),
|
|
507
481
|
output: EndpointShellOutput(raw),
|
|
508
482
|
remove: EndpointShellRemove(raw),
|
|
509
483
|
});
|
|
510
484
|
const EndpointReferenceList = (raw) => (input) => preserveEffect()(raw["reference.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
511
485
|
const adaptGroupReference = (raw) => ({ list: EndpointReferenceList(raw) });
|
|
512
|
-
const EndpointWorktreeList = (raw) => (input) => preserveEffect()(raw["worktree.list"]({ query: {
|
|
486
|
+
const EndpointWorktreeList = (raw) => (input) => preserveEffect()(raw["worktree.list"]({ query: { projectID: input["projectID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
513
487
|
const EndpointWorktreeCreate = (raw) => (input) => preserveEffect()(raw["worktree.create"]({
|
|
514
|
-
query: { location: input?.["location"] },
|
|
515
488
|
payload: {
|
|
516
|
-
|
|
517
|
-
from: input
|
|
518
|
-
branch: input
|
|
519
|
-
directory: input
|
|
520
|
-
name: input
|
|
489
|
+
projectID: input["projectID"],
|
|
490
|
+
from: input["from"],
|
|
491
|
+
branch: input["branch"],
|
|
492
|
+
directory: input["directory"],
|
|
493
|
+
name: input["name"],
|
|
521
494
|
},
|
|
522
495
|
}).pipe(Effect.mapError(mapClientError)));
|
|
523
496
|
const EndpointWorktreeRemove = (raw) => (input) => preserveEffect()(raw["worktree.remove"]({
|
|
524
|
-
|
|
525
|
-
payload: { directory: input["directory"], force: input["force"] },
|
|
497
|
+
payload: { projectID: input["projectID"], directory: input["directory"], force: input["force"] },
|
|
526
498
|
}).pipe(Effect.mapError(mapClientError)));
|
|
527
|
-
const EndpointWorktreeRefresh = (raw) => (input) => preserveEffect()(raw["worktree.refresh"]({
|
|
499
|
+
const EndpointWorktreeRefresh = (raw) => (input) => preserveEffect()(raw["worktree.refresh"]({ payload: { projectID: input["projectID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
528
500
|
const adaptGroupWorktree = (raw) => ({
|
|
529
501
|
list: EndpointWorktreeList(raw),
|
|
530
502
|
create: EndpointWorktreeCreate(raw),
|
|
531
503
|
remove: EndpointWorktreeRemove(raw),
|
|
532
504
|
refresh: EndpointWorktreeRefresh(raw),
|
|
533
505
|
});
|
|
534
|
-
const EndpointWorkspaceCreate = (raw) => (input) => preserveEffect()(raw["workspace.create"]({ payload: { id: input["id"], provider: input["provider"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
535
|
-
const EndpointWorkspaceDestroy = (raw) => (input) => preserveEffect()(raw["workspace.destroy"]({ params: { workspaceID: input["workspaceID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
536
|
-
const adaptGroupWorkspace = (raw) => ({
|
|
537
|
-
create: EndpointWorkspaceCreate(raw),
|
|
538
|
-
destroy: EndpointWorkspaceDestroy(raw),
|
|
539
|
-
});
|
|
540
506
|
const EndpointVcsGet = (raw) => (input) => preserveEffect()(raw["vcs.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
541
507
|
const EndpointVcsBase = (raw) => (input) => preserveEffect()(raw["vcs.base"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
542
508
|
const EndpointVcsStatus = (raw) => (input) => preserveEffect()(raw["vcs.status"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
543
|
-
const
|
|
509
|
+
const EndpointVcsBranchList = (raw) => (input) => preserveEffect()(raw["vcs.branch.list"]({
|
|
544
510
|
query: { location: input?.["location"], search: input?.["search"], limit: input?.["limit"] },
|
|
545
511
|
}).pipe(Effect.mapError(mapClientError)));
|
|
546
512
|
const EndpointVcsDiff = (raw) => (input) => preserveEffect()(raw["vcs.diff"]({
|
|
@@ -550,7 +516,7 @@ const adaptGroupVcs = (raw) => ({
|
|
|
550
516
|
get: EndpointVcsGet(raw),
|
|
551
517
|
base: EndpointVcsBase(raw),
|
|
552
518
|
status: EndpointVcsStatus(raw),
|
|
553
|
-
|
|
519
|
+
branch: { list: EndpointVcsBranchList(raw) },
|
|
554
520
|
diff: EndpointVcsDiff(raw),
|
|
555
521
|
});
|
|
556
522
|
const EndpointDebugLocationList = (raw) => () => preserveEffect()(raw["debug.location"]({}).pipe(Effect.mapError(mapClientError)));
|
|
@@ -570,17 +536,14 @@ const adaptGroupWebsearch = (raw) => ({
|
|
|
570
536
|
query: EndpointWebsearchQuery(raw),
|
|
571
537
|
});
|
|
572
538
|
const EndpointConfigGet = (raw) => (input) => preserveEffect()(raw["config.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
573
|
-
const EndpointConfigPreferences = (raw) => () => preserveEffect()(raw["config.preferences"]({}).pipe(Effect.mapError(mapClientError)));
|
|
574
|
-
const EndpointConfigUpdatePreferences = (raw) => (input) => preserveEffect()(raw["config.updatePreferences"]({ payload: { shell: input?.["shell"], websearch: input?.["websearch"] } }).pipe(Effect.mapError(mapClientError)));
|
|
575
539
|
const EndpointConfigShells = (raw) => () => preserveEffect()(raw["config.shells"]({}).pipe(Effect.mapError(mapClientError)));
|
|
540
|
+
const EndpointConfigUpdate = (raw) => (input) => preserveEffect()(raw["config.update"]({ payload: { shell: input["shell"] } }).pipe(Effect.mapError(mapClientError)));
|
|
576
541
|
const adaptGroupConfig = (raw) => ({
|
|
577
542
|
get: EndpointConfigGet(raw),
|
|
578
|
-
preferences: EndpointConfigPreferences(raw),
|
|
579
|
-
updatePreferences: EndpointConfigUpdatePreferences(raw),
|
|
580
543
|
shells: EndpointConfigShells(raw),
|
|
544
|
+
update: EndpointConfigUpdate(raw),
|
|
581
545
|
});
|
|
582
546
|
const adaptClient = (raw) => ({
|
|
583
|
-
health: adaptGroupHealth(raw["server.health"]),
|
|
584
547
|
server: adaptGroupServer(raw["server.server"]),
|
|
585
548
|
location: adaptGroupLocation(raw["server.location"]),
|
|
586
549
|
agent: adaptGroupAgent(raw["server.agent"]),
|
|
@@ -606,7 +569,6 @@ const adaptClient = (raw) => ({
|
|
|
606
569
|
shell: adaptGroupShell(raw["server.shell"]),
|
|
607
570
|
reference: adaptGroupReference(raw["server.reference"]),
|
|
608
571
|
worktree: adaptGroupWorktree(raw["server.worktree"]),
|
|
609
|
-
workspace: adaptGroupWorkspace(raw["server.workspace"]),
|
|
610
572
|
vcs: adaptGroupVcs(raw["server.vcs"]),
|
|
611
573
|
debug: adaptGroupDebug(raw["server.debug"]),
|
|
612
574
|
migration: adaptGroupMigration(raw["server.migration"]),
|
package/dist/effect/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Effect } from "effect";
|
|
|
2
2
|
import type { OpenCode } from "./client.js";
|
|
3
3
|
export * from "./generated/index";
|
|
4
4
|
export { OpenCode } from "./client.js";
|
|
5
|
-
export type { AgentApi, AppApi,
|
|
5
|
+
export type { AgentApi, AppApi, CommandApi, ConfigApi, EventApi, IntegrationApi, ModelApi, PluginApi, ProviderApi, ReferenceApi, RpcApi, RpcClient, WebSearchApi, SessionApi, SkillApi, } from "./api.js";
|
|
6
6
|
export { Agent } from "@opencode/schema/agent";
|
|
7
7
|
export { Command } from "@opencode/schema/command";
|
|
8
8
|
export { Config } from "@opencode/schema/config";
|
package/dist/effect/service.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ServiceStatus } from "@opencode/protocol/groups/health";
|
|
2
1
|
import { Effect, FileSystem, Option, Schedule, Schema } from "effect";
|
|
3
2
|
import { homedir } from "node:os";
|
|
4
3
|
import { join } from "node:path";
|
|
@@ -21,6 +20,8 @@ export const discover = Effect.fn("service.discover")(function* (options = {}) {
|
|
|
21
20
|
const found = (yield* registered(options.file)).service;
|
|
22
21
|
if (found?.state !== "ready")
|
|
23
22
|
return undefined;
|
|
23
|
+
if (!found.compatible)
|
|
24
|
+
return undefined;
|
|
24
25
|
if (!matchesVersion(found.version, options))
|
|
25
26
|
return undefined;
|
|
26
27
|
return found.endpoint;
|
|
@@ -29,7 +30,9 @@ export const discover = Effect.fn("service.discover")(function* (options = {}) {
|
|
|
29
30
|
export const incumbent = Effect.fn("service.incumbent")(function* (options) {
|
|
30
31
|
const info = yield* read(options.file);
|
|
31
32
|
const found = info === undefined ? undefined : yield* probe({ ...info, url: options.url });
|
|
32
|
-
if (found === undefined
|
|
33
|
+
if (found === undefined)
|
|
34
|
+
return undefined;
|
|
35
|
+
if (!found.compatible)
|
|
33
36
|
return undefined;
|
|
34
37
|
if (!matchesVersion(found.version, options))
|
|
35
38
|
return undefined;
|
|
@@ -65,7 +68,7 @@ export const ensure = Effect.fn("service.ensure")(function* (options = {}) {
|
|
|
65
68
|
});
|
|
66
69
|
});
|
|
67
70
|
const found = yield* Effect.gen(function* () {
|
|
68
|
-
const registration = yield* registered(options.file,
|
|
71
|
+
const registration = yield* registered(options.file, timing.requestTimeout);
|
|
69
72
|
const info = registration.info;
|
|
70
73
|
const service = registration.service;
|
|
71
74
|
if (registration.timedOut && info !== undefined) {
|
|
@@ -86,7 +89,7 @@ export const ensure = Effect.fn("service.ensure")(function* (options = {}) {
|
|
|
86
89
|
timeouts = undefined;
|
|
87
90
|
if (service !== undefined) {
|
|
88
91
|
spawnDelay = timing.spawnDelay;
|
|
89
|
-
const compatible =
|
|
92
|
+
const compatible = service.compatible && matchesVersion(service.version, options);
|
|
90
93
|
if (compatible && service.state === "ready") {
|
|
91
94
|
yield* Effect.tryPromise(() => PtyHandoff.complete(options.file ?? fallback(), service.info));
|
|
92
95
|
return Option.some(service);
|
|
@@ -96,11 +99,11 @@ export const ensure = Effect.fn("service.ensure")(function* (options = {}) {
|
|
|
96
99
|
if (compatible)
|
|
97
100
|
return Option.none();
|
|
98
101
|
yield* announce("version-mismatch", service.version);
|
|
99
|
-
if (
|
|
102
|
+
if (service.state !== "ready")
|
|
100
103
|
yield* Effect.logWarning("Background service is not ready; replacement cannot preserve persistent terminals");
|
|
101
104
|
yield* stop({
|
|
102
105
|
file: options.file,
|
|
103
|
-
pty:
|
|
106
|
+
pty: service.state === "ready" ? "handoff" : "clear",
|
|
104
107
|
}).pipe(Effect.ignore);
|
|
105
108
|
lastSpawn = 0;
|
|
106
109
|
return Option.none();
|
|
@@ -159,8 +162,10 @@ export const Info = Schema.Struct({
|
|
|
159
162
|
password: Schema.optional(Schema.String),
|
|
160
163
|
});
|
|
161
164
|
const decode = Schema.decodeUnknownEffect(Schema.fromJsonString(Info));
|
|
162
|
-
const
|
|
163
|
-
|
|
165
|
+
const decodeStatus = Schema.decodeUnknownOption(Schema.Struct({
|
|
166
|
+
version: Schema.String,
|
|
167
|
+
pid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
168
|
+
}));
|
|
164
169
|
// A missing or corrupt file means no valid info; callers treat both
|
|
165
170
|
// the same (the registering server self-evicts, clients rediscover).
|
|
166
171
|
const read = Effect.fnUntraced(function* (file) {
|
|
@@ -170,10 +175,10 @@ const read = Effect.fnUntraced(function* (file) {
|
|
|
170
175
|
return undefined;
|
|
171
176
|
return yield* decode(text.value).pipe(Effect.option, Effect.map(Option.getOrUndefined));
|
|
172
177
|
});
|
|
173
|
-
const probe = Effect.fnUntraced(function* (info
|
|
174
|
-
return (yield* probeResult(info
|
|
178
|
+
const probe = Effect.fnUntraced(function* (info) {
|
|
179
|
+
return (yield* probeResult(info)).service;
|
|
175
180
|
});
|
|
176
|
-
const probeResult = Effect.fnUntraced(function* (info,
|
|
181
|
+
const probeResult = Effect.fnUntraced(function* (info, timeout = defaultEnsureTiming.requestTimeout) {
|
|
177
182
|
const endpoint = {
|
|
178
183
|
url: info.url,
|
|
179
184
|
auth: info.password === undefined
|
|
@@ -181,47 +186,53 @@ const probeResult = Effect.fnUntraced(function* (info, allowLegacy = false, time
|
|
|
181
186
|
: { type: "basic", username: "opencode", password: info.password },
|
|
182
187
|
};
|
|
183
188
|
const signal = AbortSignal.timeout(timeout);
|
|
184
|
-
const result = yield* Effect.promise(() => fetch(new URL("/api/
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
const result = yield* Effect.promise(() => fetch(new URL("/api/status", info.url), { headers: headers(endpoint), signal })
|
|
190
|
+
.then(async (response) => ({
|
|
191
|
+
response,
|
|
192
|
+
body: response.status === 404 ? undefined : (await response.json()),
|
|
193
|
+
}))
|
|
189
194
|
.then((value) => ({ value }), (cause) => ({ cause })));
|
|
190
195
|
if ("cause" in result)
|
|
191
196
|
return { service: undefined, timedOut: signal.aborted };
|
|
192
197
|
const response = result.value.response;
|
|
198
|
+
// The previous V2 service exposes /api/health instead. Its authenticated 404 is enough
|
|
199
|
+
// to recognize the registered daemon as incompatible and route it through replacement.
|
|
200
|
+
if (response.status === 404)
|
|
201
|
+
return {
|
|
202
|
+
service: {
|
|
203
|
+
info,
|
|
204
|
+
endpoint,
|
|
205
|
+
version: info.version,
|
|
206
|
+
state: "ready",
|
|
207
|
+
compatible: false,
|
|
208
|
+
},
|
|
209
|
+
timedOut: false,
|
|
210
|
+
};
|
|
193
211
|
const body = result.value.body;
|
|
194
|
-
const
|
|
195
|
-
if (Option.isSome(
|
|
196
|
-
if (
|
|
212
|
+
const status = decodeStatus(body);
|
|
213
|
+
if (Option.isSome(status)) {
|
|
214
|
+
if (status.value.pid !== info.pid)
|
|
197
215
|
return { service: undefined, timedOut: false };
|
|
198
|
-
if (info.version !== undefined &&
|
|
216
|
+
if (info.version !== undefined && status.value.version !== info.version)
|
|
199
217
|
return { service: undefined, timedOut: false };
|
|
200
218
|
return {
|
|
201
219
|
service: {
|
|
202
220
|
info,
|
|
203
221
|
endpoint,
|
|
204
|
-
version:
|
|
222
|
+
version: status.value.version,
|
|
205
223
|
state: response.ok ? "ready" : response.status === 500 ? "failed" : "waiting",
|
|
206
|
-
|
|
224
|
+
compatible: true,
|
|
207
225
|
},
|
|
208
226
|
timedOut: false,
|
|
209
227
|
};
|
|
210
228
|
}
|
|
211
|
-
|
|
212
|
-
Option.isNone(decodeLegacyHealth(body)) ||
|
|
213
|
-
(typeof body === "object" && body !== null && ("version" in body || "pid" in body)))
|
|
214
|
-
return { service: undefined, timedOut: false };
|
|
215
|
-
return {
|
|
216
|
-
service: { info, endpoint, state: "ready", legacy: true },
|
|
217
|
-
timedOut: false,
|
|
218
|
-
};
|
|
229
|
+
return { service: undefined, timedOut: false };
|
|
219
230
|
});
|
|
220
|
-
const registered = Effect.fnUntraced(function* (file,
|
|
231
|
+
const registered = Effect.fnUntraced(function* (file, timeout) {
|
|
221
232
|
const info = yield* read(file);
|
|
222
233
|
if (info === undefined)
|
|
223
234
|
return { info: undefined, service: undefined, timedOut: false };
|
|
224
|
-
return { info, ...(yield* probeResult(info,
|
|
235
|
+
return { info, ...(yield* probeResult(info, timeout)) };
|
|
225
236
|
});
|
|
226
237
|
// 50ms cadence bounded at ~5s, shared by stop escalation and each ensure
|
|
227
238
|
// discovery window.
|
package/dist/promise/api.d.ts
CHANGED
|
@@ -18,7 +18,3 @@ export type SessionApi = Client["session"];
|
|
|
18
18
|
export type SkillApi = Client["skill"];
|
|
19
19
|
export type VcsApi = Client["vcs"];
|
|
20
20
|
export type WorktreeApi = Client["worktree"];
|
|
21
|
-
export interface CatalogApi {
|
|
22
|
-
readonly provider: ProviderApi;
|
|
23
|
-
readonly model: ModelApi;
|
|
24
|
-
}
|