@opencode/client 2.0.2 → 2.0.4
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 +331 -345
- package/dist/effect/api.d.ts +1 -5
- package/dist/effect/client.d.ts +60 -69
- package/dist/effect/generated/client.d.ts +61 -70
- package/dist/effect/generated/client.js +58 -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 +23 -39
- package/dist/promise/generated/client.d.ts +24 -40
- package/dist/promise/generated/client.js +125 -192
- package/dist/promise/generated/types.d.ts +1421 -1872
- 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 +79 -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"] },
|
|
@@ -135,10 +133,16 @@ const EndpointSessionRevertStage = (raw) => (input) => preserveEffect()(raw["ses
|
|
|
135
133
|
const EndpointSessionRevertClear = (raw) => (input) => preserveEffect()(raw["session.revert.clear"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
136
134
|
const EndpointSessionRevertCommit = (raw) => (input) => preserveEffect()(raw["session.revert.commit"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
137
135
|
const EndpointSessionContext = (raw) => (input) => preserveEffect()(raw["session.context"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
136
|
+
const EndpointSessionDiff = (raw) => (input) => preserveEffect()(raw["session.diff"]({
|
|
137
|
+
params: { sessionID: input["sessionID"] },
|
|
138
|
+
query: { from: input["from"], to: input["to"], context: input["context"] },
|
|
139
|
+
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
138
140
|
const EndpointSessionInboxList = (raw) => (input) => preserveEffect()(raw["session.inbox.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
139
141
|
const EndpointSessionInboxCancel = (raw) => (input) => preserveEffect()(raw["session.inbox.cancel"]({ params: { sessionID: input["sessionID"], inboxID: input["inboxID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
140
|
-
const
|
|
141
|
-
|
|
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)));
|
|
142
146
|
const EndpointSessionInstructionsEntryList = (raw) => (input) => preserveEffect()(raw["session.instructions.entry.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
143
147
|
const EndpointSessionInstructionsEntryPut = (raw) => (input) => preserveEffect()(raw["session.instructions.entry.put"]({
|
|
144
148
|
params: { sessionID: input["sessionID"], key: input["key"] },
|
|
@@ -150,12 +154,20 @@ const EndpointSessionLog = (raw) => (input) => preserveStream()(Stream.unwrap(ra
|
|
|
150
154
|
params: { sessionID: input["sessionID"] },
|
|
151
155
|
query: { after: input["after"], follow: input["follow"] },
|
|
152
156
|
}).pipe(Effect.mapError(mapClientError), Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError))))));
|
|
153
|
-
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"]({
|
|
154
162
|
params: { sessionID: input["sessionID"] },
|
|
155
|
-
|
|
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"] },
|
|
156
169
|
}).pipe(Effect.mapError(mapClientError)));
|
|
157
|
-
const
|
|
158
|
-
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)));
|
|
159
171
|
const EndpointSessionEnvironment = (raw) => (input) => preserveEffect()(raw["session.environment"]({
|
|
160
172
|
params: { sessionID: input["sessionID"] },
|
|
161
173
|
payload: { variables: input["variables"] },
|
|
@@ -173,7 +185,7 @@ const adaptGroupSession = (raw) => ({
|
|
|
173
185
|
fork: EndpointSessionFork(raw),
|
|
174
186
|
switchAgent: EndpointSessionSwitchAgent(raw),
|
|
175
187
|
switchModel: EndpointSessionSwitchModel(raw),
|
|
176
|
-
|
|
188
|
+
update: EndpointSessionUpdate(raw),
|
|
177
189
|
move: EndpointSessionMove(raw),
|
|
178
190
|
prompt: EndpointSessionPrompt(raw),
|
|
179
191
|
command: EndpointSessionCommand(raw),
|
|
@@ -188,11 +200,11 @@ const adaptGroupSession = (raw) => ({
|
|
|
188
200
|
commit: EndpointSessionRevertCommit(raw),
|
|
189
201
|
},
|
|
190
202
|
context: EndpointSessionContext(raw),
|
|
203
|
+
diff: EndpointSessionDiff(raw),
|
|
191
204
|
inbox: {
|
|
192
205
|
list: EndpointSessionInboxList(raw),
|
|
193
206
|
cancel: EndpointSessionInboxCancel(raw),
|
|
194
|
-
|
|
195
|
-
queue: EndpointSessionInboxQueue(raw),
|
|
207
|
+
update: EndpointSessionInboxUpdate(raw),
|
|
196
208
|
},
|
|
197
209
|
instructions: {
|
|
198
210
|
entry: {
|
|
@@ -205,7 +217,14 @@ const adaptGroupSession = (raw) => ({
|
|
|
205
217
|
log: EndpointSessionLog(raw),
|
|
206
218
|
interrupt: EndpointSessionInterrupt(raw),
|
|
207
219
|
background: EndpointSessionBackground(raw),
|
|
208
|
-
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
|
+
},
|
|
209
228
|
environment: EndpointSessionEnvironment(raw),
|
|
210
229
|
view: EndpointSessionView(raw),
|
|
211
230
|
});
|
|
@@ -307,17 +326,10 @@ const adaptGroupMcp = (raw) => ({
|
|
|
307
326
|
});
|
|
308
327
|
const EndpointCredentialUpdate = (raw) => (input) => preserveEffect()(raw["credential.update"]({
|
|
309
328
|
params: { credentialID: input["credentialID"] },
|
|
310
|
-
query: { location: input["location"] },
|
|
311
329
|
payload: { label: input["label"] },
|
|
312
330
|
}).pipe(Effect.mapError(mapClientError)));
|
|
313
|
-
const EndpointCredentialActivate = (raw) => (input) => preserveEffect()(raw["credential.activate"]({
|
|
314
|
-
|
|
315
|
-
query: { location: input["location"] },
|
|
316
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
317
|
-
const EndpointCredentialRemove = (raw) => (input) => preserveEffect()(raw["credential.remove"]({
|
|
318
|
-
params: { credentialID: input["credentialID"] },
|
|
319
|
-
query: { location: input["location"] },
|
|
320
|
-
}).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)));
|
|
321
333
|
const adaptGroupCredential = (raw) => ({
|
|
322
334
|
update: EndpointCredentialUpdate(raw),
|
|
323
335
|
activate: EndpointCredentialActivate(raw),
|
|
@@ -328,34 +340,12 @@ const EndpointProjectUpdate = (raw) => (input) => preserveEffect()(raw["project.
|
|
|
328
340
|
params: { projectID: input["projectID"] },
|
|
329
341
|
payload: { canonical: input["canonical"], name: input["name"], icon: input["icon"], commands: input["commands"] },
|
|
330
342
|
}).pipe(Effect.mapError(mapClientError)));
|
|
331
|
-
const EndpointProjectCurrent = (raw) => (input) => preserveEffect()(raw["project.current"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
332
343
|
const adaptGroupProject = (raw) => ({
|
|
333
344
|
list: EndpointProjectList(raw),
|
|
334
345
|
update: EndpointProjectUpdate(raw),
|
|
335
|
-
current: EndpointProjectCurrent(raw),
|
|
336
|
-
});
|
|
337
|
-
const EndpointFormRequestList = (raw) => (input) => preserveEffect()(raw["form.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
338
|
-
const EndpointFormList = (raw) => (input) => preserveEffect()(raw["session.form.list"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
339
|
-
const EndpointFormCreate = (raw) => (input) => preserveEffect()(raw["session.form.create"]({
|
|
340
|
-
params: { sessionID: input["sessionID"] },
|
|
341
|
-
payload: { id: input["id"], title: input["title"], metadata: input["metadata"], fields: input["fields"] },
|
|
342
|
-
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
343
|
-
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)));
|
|
344
|
-
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)));
|
|
345
|
-
const EndpointFormReply = (raw) => (input) => preserveEffect()(raw["session.form.reply"]({
|
|
346
|
-
params: { sessionID: input["sessionID"], formID: input["formID"] },
|
|
347
|
-
payload: { answer: input["answer"] },
|
|
348
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
349
|
-
const EndpointFormCancel = (raw) => (input) => preserveEffect()(raw["session.form.cancel"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
350
|
-
const adaptGroupForm = (raw) => ({
|
|
351
|
-
request: { list: EndpointFormRequestList(raw) },
|
|
352
|
-
list: EndpointFormList(raw),
|
|
353
|
-
create: EndpointFormCreate(raw),
|
|
354
|
-
get: EndpointFormGet(raw),
|
|
355
|
-
state: EndpointFormState(raw),
|
|
356
|
-
reply: EndpointFormReply(raw),
|
|
357
|
-
cancel: EndpointFormCancel(raw),
|
|
358
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) });
|
|
359
349
|
const EndpointPermissionRequestList = (raw) => (input) => preserveEffect()(raw["permission.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
360
350
|
const EndpointPermissionSavedList = (raw) => (input) => preserveEffect()(raw["permission.saved.list"]({ query: { projectID: input?.["projectID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
361
351
|
const EndpointPermissionSavedRemove = (raw) => (input) => preserveEffect()(raw["permission.saved.remove"]({ params: { id: input["id"] } }).pipe(Effect.mapError(mapClientError)));
|
|
@@ -375,11 +365,7 @@ const EndpointPermissionList = (raw) => (input) => preserveEffect()(raw["session
|
|
|
375
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)));
|
|
376
366
|
const EndpointPermissionReply = (raw) => (input) => preserveEffect()(raw["session.permission.reply"]({
|
|
377
367
|
params: { sessionID: input["sessionID"], requestID: input["requestID"] },
|
|
378
|
-
payload: {
|
|
379
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
380
|
-
const EndpointPermissionRules = (raw) => (input) => preserveEffect()(raw["session.permission.rules"]({
|
|
381
|
-
params: { sessionID: input["sessionID"] },
|
|
382
|
-
payload: { permissions: input["permissions"] },
|
|
368
|
+
payload: { decision: input["decision"], message: input["message"] },
|
|
383
369
|
}).pipe(Effect.mapError(mapClientError)));
|
|
384
370
|
const adaptGroupPermission = (raw) => ({
|
|
385
371
|
request: { list: EndpointPermissionRequestList(raw) },
|
|
@@ -388,7 +374,6 @@ const adaptGroupPermission = (raw) => ({
|
|
|
388
374
|
list: EndpointPermissionList(raw),
|
|
389
375
|
get: EndpointPermissionGet(raw),
|
|
390
376
|
reply: EndpointPermissionReply(raw),
|
|
391
|
-
rules: EndpointPermissionRules(raw),
|
|
392
377
|
});
|
|
393
378
|
const EndpointFileList = (raw) => (input) => preserveEffect()(raw["fs.list"]({ query: { location: input?.["location"], path: input?.["path"] } }).pipe(Effect.mapError(mapClientError)));
|
|
394
379
|
const EndpointFileFind = (raw) => (input) => preserveEffect()(raw["fs.find"]({
|
|
@@ -484,11 +469,6 @@ const EndpointShellCreate = (raw) => (input) => preserveEffect()(raw["shell.crea
|
|
|
484
469
|
payload: { command: input["command"], cwd: input["cwd"], timeout: input["timeout"], metadata: input["metadata"] },
|
|
485
470
|
}).pipe(Effect.mapError(mapClientError)));
|
|
486
471
|
const EndpointShellGet = (raw) => (input) => preserveEffect()(raw["shell.get"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
487
|
-
const EndpointShellTimeout = (raw) => (input) => preserveEffect()(raw["shell.timeout"]({
|
|
488
|
-
params: { id: input["id"] },
|
|
489
|
-
query: { location: input["location"] },
|
|
490
|
-
payload: { timeout: input["timeout"] },
|
|
491
|
-
}).pipe(Effect.mapError(mapClientError)));
|
|
492
472
|
const EndpointShellOutput = (raw) => (input) => preserveEffect()(raw["shell.output"]({
|
|
493
473
|
params: { id: input["id"] },
|
|
494
474
|
query: { location: input["location"], cursor: input["cursor"], limit: input["limit"] },
|
|
@@ -498,44 +478,35 @@ const adaptGroupShell = (raw) => ({
|
|
|
498
478
|
list: EndpointShellList(raw),
|
|
499
479
|
create: EndpointShellCreate(raw),
|
|
500
480
|
get: EndpointShellGet(raw),
|
|
501
|
-
timeout: EndpointShellTimeout(raw),
|
|
502
481
|
output: EndpointShellOutput(raw),
|
|
503
482
|
remove: EndpointShellRemove(raw),
|
|
504
483
|
});
|
|
505
484
|
const EndpointReferenceList = (raw) => (input) => preserveEffect()(raw["reference.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
506
485
|
const adaptGroupReference = (raw) => ({ list: EndpointReferenceList(raw) });
|
|
507
|
-
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)));
|
|
508
487
|
const EndpointWorktreeCreate = (raw) => (input) => preserveEffect()(raw["worktree.create"]({
|
|
509
|
-
query: { location: input?.["location"] },
|
|
510
488
|
payload: {
|
|
511
|
-
|
|
512
|
-
from: input
|
|
513
|
-
branch: input
|
|
514
|
-
directory: input
|
|
515
|
-
name: input
|
|
489
|
+
projectID: input["projectID"],
|
|
490
|
+
from: input["from"],
|
|
491
|
+
branch: input["branch"],
|
|
492
|
+
directory: input["directory"],
|
|
493
|
+
name: input["name"],
|
|
516
494
|
},
|
|
517
495
|
}).pipe(Effect.mapError(mapClientError)));
|
|
518
496
|
const EndpointWorktreeRemove = (raw) => (input) => preserveEffect()(raw["worktree.remove"]({
|
|
519
|
-
|
|
520
|
-
payload: { directory: input["directory"], force: input["force"] },
|
|
497
|
+
payload: { projectID: input["projectID"], directory: input["directory"], force: input["force"] },
|
|
521
498
|
}).pipe(Effect.mapError(mapClientError)));
|
|
522
|
-
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)));
|
|
523
500
|
const adaptGroupWorktree = (raw) => ({
|
|
524
501
|
list: EndpointWorktreeList(raw),
|
|
525
502
|
create: EndpointWorktreeCreate(raw),
|
|
526
503
|
remove: EndpointWorktreeRemove(raw),
|
|
527
504
|
refresh: EndpointWorktreeRefresh(raw),
|
|
528
505
|
});
|
|
529
|
-
const EndpointWorkspaceCreate = (raw) => (input) => preserveEffect()(raw["workspace.create"]({ payload: { id: input["id"], provider: input["provider"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
530
|
-
const EndpointWorkspaceDestroy = (raw) => (input) => preserveEffect()(raw["workspace.destroy"]({ params: { workspaceID: input["workspaceID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
531
|
-
const adaptGroupWorkspace = (raw) => ({
|
|
532
|
-
create: EndpointWorkspaceCreate(raw),
|
|
533
|
-
destroy: EndpointWorkspaceDestroy(raw),
|
|
534
|
-
});
|
|
535
506
|
const EndpointVcsGet = (raw) => (input) => preserveEffect()(raw["vcs.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
536
507
|
const EndpointVcsBase = (raw) => (input) => preserveEffect()(raw["vcs.base"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
537
508
|
const EndpointVcsStatus = (raw) => (input) => preserveEffect()(raw["vcs.status"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
538
|
-
const
|
|
509
|
+
const EndpointVcsBranchList = (raw) => (input) => preserveEffect()(raw["vcs.branch.list"]({
|
|
539
510
|
query: { location: input?.["location"], search: input?.["search"], limit: input?.["limit"] },
|
|
540
511
|
}).pipe(Effect.mapError(mapClientError)));
|
|
541
512
|
const EndpointVcsDiff = (raw) => (input) => preserveEffect()(raw["vcs.diff"]({
|
|
@@ -545,7 +516,7 @@ const adaptGroupVcs = (raw) => ({
|
|
|
545
516
|
get: EndpointVcsGet(raw),
|
|
546
517
|
base: EndpointVcsBase(raw),
|
|
547
518
|
status: EndpointVcsStatus(raw),
|
|
548
|
-
|
|
519
|
+
branch: { list: EndpointVcsBranchList(raw) },
|
|
549
520
|
diff: EndpointVcsDiff(raw),
|
|
550
521
|
});
|
|
551
522
|
const EndpointDebugLocationList = (raw) => () => preserveEffect()(raw["debug.location"]({}).pipe(Effect.mapError(mapClientError)));
|
|
@@ -565,17 +536,14 @@ const adaptGroupWebsearch = (raw) => ({
|
|
|
565
536
|
query: EndpointWebsearchQuery(raw),
|
|
566
537
|
});
|
|
567
538
|
const EndpointConfigGet = (raw) => (input) => preserveEffect()(raw["config.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
568
|
-
const EndpointConfigPreferences = (raw) => () => preserveEffect()(raw["config.preferences"]({}).pipe(Effect.mapError(mapClientError)));
|
|
569
|
-
const EndpointConfigUpdatePreferences = (raw) => (input) => preserveEffect()(raw["config.updatePreferences"]({ payload: { shell: input?.["shell"], websearch: input?.["websearch"] } }).pipe(Effect.mapError(mapClientError)));
|
|
570
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)));
|
|
571
541
|
const adaptGroupConfig = (raw) => ({
|
|
572
542
|
get: EndpointConfigGet(raw),
|
|
573
|
-
preferences: EndpointConfigPreferences(raw),
|
|
574
|
-
updatePreferences: EndpointConfigUpdatePreferences(raw),
|
|
575
543
|
shells: EndpointConfigShells(raw),
|
|
544
|
+
update: EndpointConfigUpdate(raw),
|
|
576
545
|
});
|
|
577
546
|
const adaptClient = (raw) => ({
|
|
578
|
-
health: adaptGroupHealth(raw["server.health"]),
|
|
579
547
|
server: adaptGroupServer(raw["server.server"]),
|
|
580
548
|
location: adaptGroupLocation(raw["server.location"]),
|
|
581
549
|
agent: adaptGroupAgent(raw["server.agent"]),
|
|
@@ -601,7 +569,6 @@ const adaptClient = (raw) => ({
|
|
|
601
569
|
shell: adaptGroupShell(raw["server.shell"]),
|
|
602
570
|
reference: adaptGroupReference(raw["server.reference"]),
|
|
603
571
|
worktree: adaptGroupWorktree(raw["server.worktree"]),
|
|
604
|
-
workspace: adaptGroupWorkspace(raw["server.workspace"]),
|
|
605
572
|
vcs: adaptGroupVcs(raw["server.vcs"]),
|
|
606
573
|
debug: adaptGroupDebug(raw["server.debug"]),
|
|
607
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
|
-
}
|