@opencode/client 0.0.0-dev-210 → 0.0.0-dev-216
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/chunks/{service-contender-anregfhs.js → contract-15p82y03.js} +5 -5
- package/dist/chunks/{service-contender-8ye1ye6f.js → contract-2ny4vxct.js} +2 -2
- package/dist/chunks/{service-contender-khkm0pf7.js → contract-csehnca4.js} +1 -1
- package/dist/chunks/{service-contender-0f3b9fnq.js → contract-cvg5j6d1.js} +2 -1
- package/dist/chunks/{service-contender-ph0x2cx8.js → contract-e4dem3g3.js} +17 -17
- package/dist/chunks/{service-contender-gecjxyvt.js → contract-gecjxyvt.js} +1 -1
- package/dist/chunks/{service-contender-bwabkrm6.js → contract-jndfjhn3.js} +2 -2
- package/dist/chunks/{service-contender-z11mztjj.js → contract-kdshn947.js} +1 -1
- package/dist/chunks/{service-contender-js54wxgp.js → contract-nwcpakzx.js} +2 -2
- package/dist/chunks/contract-p0cwenbx.js +30 -0
- package/dist/chunks/{service-contender-8mywvvwh.js → contract-r76mn47y.js} +32 -10
- package/dist/chunks/{service-contender-ryy6kscr.js → contract-ryy6kscr.js} +1 -1
- package/dist/chunks/{service-contender-7f0py9js.js → contract-y2etg5bs.js} +2 -2
- package/dist/chunks/{service-contender-sp3vqdnr.js → contract-yn2a71yh.js} +71 -19
- package/dist/contract.js +1 -1
- package/dist/effect/api/api.d.ts +43 -0
- package/dist/effect/client.d.ts +156 -0
- package/dist/effect/client.js +12 -12
- package/dist/effect/generated/client-error.js +3 -3
- package/dist/effect/generated/client.d.ts +157 -1
- package/dist/effect/generated/client.js +5 -5
- package/dist/effect/generated/index.js +8 -8
- package/dist/effect/index.js +12 -12
- package/dist/effect/rpc.js +4 -4
- package/dist/effect/service.js +6 -6
- package/dist/promise/client.d.ts +8 -0
- package/dist/promise/client.js +11 -11
- package/dist/promise/generated/client-error.js +3 -3
- package/dist/promise/generated/client.d.ts +9 -1
- package/dist/promise/generated/client.js +4 -4
- package/dist/promise/generated/index.js +11 -9
- package/dist/promise/generated/types.d.ts +121 -0
- package/dist/promise/generated/types.js +3 -1
- package/dist/promise/index.js +15 -13
- package/dist/promise/rpc.js +2 -2
- package/dist/promise/service.js +6 -6
- package/dist/pty-handoff.js +4 -4
- package/dist/rpc-runtime.js +1 -1
- package/dist/service-contender.js +1 -1
- package/dist/service-probe.js +3 -3
- package/dist/service-timing.js +1 -1
- package/dist/service-version.js +1 -1
- package/dist/service.js +1 -1
- package/dist/shared-events.js +1 -1
- package/dist/solid/connection.js +1 -1
- package/dist/solid/data.js +9 -9
- package/dist/solid/index.js +13 -13
- package/dist/solid/pty.js +1 -1
- package/dist/solid/retention.js +1 -1
- package/dist/solid/usage.js +1 -1
- package/package.json +4 -4
- package/dist/chunks/service-contender-ek8qkqrq.js +0 -30
- /package/dist/chunks/{service-contender-60xe5cbf.js → contract-60xe5cbf.js} +0 -0
- /package/dist/chunks/{service-contender-6mptkzbc.js → contract-6mptkzbc.js} +0 -0
- /package/dist/chunks/{service-contender-6mq2wh8y.js → contract-6mq2wh8y.js} +0 -0
- /package/dist/chunks/{service-contender-8s2anffy.js → contract-8s2anffy.js} +0 -0
- /package/dist/chunks/{service-contender-9rqn6x4v.js → contract-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{service-contender-gne7h7mq.js → contract-gne7h7mq.js} +0 -0
- /package/dist/chunks/{service-contender-m2eywc8w.js → contract-m2eywc8w.js} +0 -0
- /package/dist/chunks/{service-contender-qav6mfdz.js → contract-qav6mfdz.js} +0 -0
- /package/dist/chunks/{service-contender-sxt88q69.js → contract-sxt88q69.js} +0 -0
- /package/dist/chunks/{service-contender-ve4aws36.js → contract-ve4aws36.js} +0 -0
- /package/dist/chunks/{service-contender-vyas3vgt.js → contract-vyas3vgt.js} +0 -0
- /package/dist/chunks/{service-contender-xgnj2w4v.js → contract-xgnj2w4v.js} +0 -0
- /package/dist/chunks/{service-contender-ydhz1zrh.js → contract-ydhz1zrh.js} +0 -0
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
readError2,
|
|
4
4
|
event2,
|
|
5
5
|
eventType2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./contract-ryy6kscr.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./contract-9rqn6x4v.js";
|
|
10
10
|
|
|
11
11
|
// src/effect/rpc.ts
|
|
12
12
|
var exports_rpc = {};
|
|
13
13
|
__export(exports_rpc, {
|
|
14
14
|
RpcClientRuntime: () => exports_rpc,
|
|
15
15
|
aborted: () => aborted2,
|
|
16
|
-
make: () =>
|
|
16
|
+
make: () => make3
|
|
17
17
|
});
|
|
18
18
|
import { Effect, Stream } from "effect";
|
|
19
|
-
function
|
|
19
|
+
function make3(call, subscribe) {
|
|
20
20
|
return (definition) => {
|
|
21
21
|
const methods = Object.fromEntries(Object.entries(definition.methods).map(([name, method]) => [
|
|
22
22
|
name,
|
|
@@ -59,4 +59,4 @@ function aborted2(signal) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export {
|
|
62
|
+
export { make3, aborted2, exports_rpc };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defaultEnsureTiming2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./contract-xgnj2w4v.js";
|
|
4
4
|
import {
|
|
5
5
|
matchesVersion2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./contract-sxt88q69.js";
|
|
7
7
|
|
|
8
8
|
// src/service-probe.ts
|
|
9
9
|
import { homedir } from "node:os";
|
|
@@ -34,8 +34,9 @@ var isFileNotFoundError2 = (value) => typeof value === "object" && value !== nul
|
|
|
34
34
|
var isRpcError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcError";
|
|
35
35
|
var isRpcInternalError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcInternalError";
|
|
36
36
|
var isPtyNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PtyNotFoundError";
|
|
37
|
+
var isScheduleNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ScheduleNotFoundError";
|
|
37
38
|
var isShellNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ShellNotFoundError";
|
|
38
39
|
var isWorktreeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "WorktreeError";
|
|
39
40
|
var isVcsInitNotSupportedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "VcsInitNotSupportedError";
|
|
40
41
|
|
|
41
|
-
export { isInvalidRequestError2, isUnauthorizedError2, isLocationNotFoundError2, isServiceUnavailableError2, isAgentNotFoundError2, isPluginNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isMessageNotFoundError2, isConflictError2, isCommandNotFoundError2, isCommandExecutionError2, isSessionBusyError2, isUnknownError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isSkillNotFoundError2, isInstructionEntryValueTooLargeError2, isProviderNotFoundError2, isModelNotFoundError2, isUnsupportedModelError2, isProviderRequestError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2, isForbiddenError2, isProjectNotFoundError2, isPermissionSavedNotFoundError2, isPermissionNotFoundError2, isFileNotFoundError2, isRpcError2, isRpcInternalError2, isPtyNotFoundError2, isShellNotFoundError2, isWorktreeError2, isVcsInitNotSupportedError2 };
|
|
42
|
+
export { isInvalidRequestError2, isUnauthorizedError2, isLocationNotFoundError2, isServiceUnavailableError2, isAgentNotFoundError2, isPluginNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isMessageNotFoundError2, isConflictError2, isCommandNotFoundError2, isCommandExecutionError2, isSessionBusyError2, isUnknownError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isSkillNotFoundError2, isInstructionEntryValueTooLargeError2, isProviderNotFoundError2, isModelNotFoundError2, isUnsupportedModelError2, isProviderRequestError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2, isForbiddenError2, isProjectNotFoundError2, isPermissionSavedNotFoundError2, isPermissionNotFoundError2, isFileNotFoundError2, isRpcError2, isRpcInternalError2, isPtyNotFoundError2, isScheduleNotFoundError2, isShellNotFoundError2, isWorktreeError2, isVcsInitNotSupportedError2 };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
make7
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./contract-gecjxyvt.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./
|
|
5
|
+
ClientError2
|
|
6
|
+
} from "./contract-y2etg5bs.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./
|
|
8
|
+
make4
|
|
9
|
+
} from "./contract-r76mn47y.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
11
|
+
make3,
|
|
12
12
|
aborted2
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./contract-15p82y03.js";
|
|
14
14
|
import {
|
|
15
15
|
__export
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./contract-9rqn6x4v.js";
|
|
17
17
|
|
|
18
18
|
// src/effect/client.ts
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
OpenCode: () =>
|
|
22
|
-
make: () =>
|
|
19
|
+
var exports_client = {};
|
|
20
|
+
__export(exports_client, {
|
|
21
|
+
OpenCode: () => exports_client,
|
|
22
|
+
make: () => make2
|
|
23
23
|
});
|
|
24
24
|
import { Cause, Context, Effect, Stream } from "effect";
|
|
25
25
|
import { HttpClient, HttpClientRequest } from "effect/http";
|
|
@@ -28,9 +28,9 @@ var CurrentHeaders = Context.Reference("@opencode/client/effect/rpc/headers", {
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
var
|
|
31
|
+
var make2 = Effect.fn("OpenCode.make")(function* (options) {
|
|
32
32
|
const httpClient = yield* HttpClient.HttpClient;
|
|
33
|
-
const raw = yield*
|
|
33
|
+
const raw = yield* make4(options).pipe(Effect.provideService(HttpClient.HttpClient, HttpClient.mapRequestEffect(httpClient, (request) => Effect.map(CurrentHeaders, (headers) => headers ? HttpClientRequest.setHeaders(request, new Headers(headers)) : request))));
|
|
34
34
|
const context = yield* Effect.context();
|
|
35
35
|
const native = raw.event.subscribe();
|
|
36
36
|
|
|
@@ -41,12 +41,12 @@ var make4 = Effect.fn("OpenCode.make")(function* (options) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
const shared = make7((signal) => Stream.toAsyncIterableWith(native.pipe(Stream.interruptWhen(aborted2(signal)), Stream.catchCause((cause) => Stream.fail(new EventFailure(cause)))), context));
|
|
44
|
-
const subscribe = (input) => Stream.fromAsyncIterable(shared.subscribe({ types: input?.types }), (error) => error).pipe(Stream.catch((error) => Stream.failCause(error instanceof EventFailure ? error.cause : Cause.fail(new
|
|
44
|
+
const subscribe = (input) => Stream.fromAsyncIterable(shared.subscribe({ types: input?.types }), (error) => error).pipe(Stream.catch((error) => Stream.failCause(error instanceof EventFailure ? error.cause : Cause.fail(new ClientError2({ cause: error })))));
|
|
45
45
|
return {
|
|
46
46
|
...raw,
|
|
47
47
|
event: { ...raw.event, subscribe },
|
|
48
|
-
rpc: Object.assign(
|
|
48
|
+
rpc: Object.assign(make3((input, options) => raw.rpc.call(input).pipe(Effect.provideService(CurrentHeaders, options?.headers)), subscribe), raw.rpc)
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
export {
|
|
52
|
+
export { make2, exports_client };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/promise/generated/client-error.ts
|
|
2
|
-
class
|
|
2
|
+
class ClientError3 extends Error {
|
|
3
3
|
reason;
|
|
4
4
|
name = "ClientError";
|
|
5
5
|
constructor(reason, options) {
|
|
@@ -9,4 +9,4 @@ class ClientError2 extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { ClientError3 };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
make7
|
|
3
|
+
} from "./contract-gecjxyvt.js";
|
|
4
|
+
import {
|
|
5
|
+
make6
|
|
6
|
+
} from "./contract-yn2a71yh.js";
|
|
7
|
+
import {
|
|
8
|
+
makeRpc2
|
|
9
|
+
} from "./contract-kdshn947.js";
|
|
10
|
+
import {
|
|
11
|
+
__export
|
|
12
|
+
} from "./contract-9rqn6x4v.js";
|
|
13
|
+
|
|
14
|
+
// src/promise/client.ts
|
|
15
|
+
var exports_client3 = {};
|
|
16
|
+
__export(exports_client3, {
|
|
17
|
+
OpenCode: () => exports_client3,
|
|
18
|
+
make: () => make5
|
|
19
|
+
});
|
|
20
|
+
function make5(options) {
|
|
21
|
+
const raw = make6(options);
|
|
22
|
+
const events = make7((signal, onActivity) => raw.event.subscribe(undefined, { signal, onActivity }));
|
|
23
|
+
return {
|
|
24
|
+
...raw,
|
|
25
|
+
rpc: Object.assign(makeRpc2(raw, events), raw.rpc),
|
|
26
|
+
event: events
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { make5, exports_client3 };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientApi2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./contract-60xe5cbf.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./
|
|
5
|
+
ClientError2
|
|
6
|
+
} from "./contract-y2etg5bs.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./contract-9rqn6x4v.js";
|
|
10
10
|
|
|
11
11
|
// src/effect/generated/client.ts
|
|
12
|
-
var
|
|
13
|
-
__export(
|
|
14
|
-
make: () =>
|
|
12
|
+
var exports_client2 = {};
|
|
13
|
+
__export(exports_client2, {
|
|
14
|
+
make: () => make4
|
|
15
15
|
});
|
|
16
16
|
import { Effect, Stream, Schema } from "effect";
|
|
17
17
|
import { Sse } from "effect/encoding";
|
|
18
18
|
import { HttpClientError } from "effect/http";
|
|
19
19
|
import { HttpApiClient } from "effect/http-api";
|
|
20
|
-
var mapClientError = (error) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new
|
|
20
|
+
var mapClientError = (error) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new ClientError2({ cause: error }) : error;
|
|
21
21
|
var preserveEffect = () => (effect) => effect;
|
|
22
22
|
var preserveStream = () => (stream) => stream;
|
|
23
23
|
var EndpointServerInfo = (raw) => () => preserveEffect()(raw["server.info"]({}).pipe(Effect.mapError(mapClientError)));
|
|
@@ -548,6 +548,20 @@ var EndpointExperimentalPersistentPtyConnectToken = (raw) => (input) => preserve
|
|
|
548
548
|
params: { ptyID: input["ptyID"] },
|
|
549
549
|
headers: { "x-opencode-ticket": input["x-opencode-ticket"] }
|
|
550
550
|
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
551
|
+
var EndpointExperimentalScheduleCreate = (raw) => (input) => preserveEffect()(raw["schedule.create"]({
|
|
552
|
+
payload: {
|
|
553
|
+
sessionID: input["sessionID"],
|
|
554
|
+
name: input["name"],
|
|
555
|
+
when: input["when"],
|
|
556
|
+
ends: input["ends"],
|
|
557
|
+
prompt: input["prompt"]
|
|
558
|
+
}
|
|
559
|
+
}).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
560
|
+
var EndpointExperimentalScheduleList = (raw) => (input) => preserveEffect()(raw["schedule.list"]({ query: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
561
|
+
var EndpointExperimentalScheduleGet = (raw) => (input) => preserveEffect()(raw["schedule.get"]({ params: { scheduleID: input["scheduleID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
562
|
+
var EndpointExperimentalSchedulePause = (raw) => (input) => preserveEffect()(raw["schedule.pause"]({ params: { scheduleID: input["scheduleID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
563
|
+
var EndpointExperimentalScheduleResume = (raw) => (input) => preserveEffect()(raw["schedule.resume"]({ params: { scheduleID: input["scheduleID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
|
|
564
|
+
var EndpointExperimentalScheduleDelete = (raw) => (input) => preserveEffect()(raw["schedule.delete"]({ params: { scheduleID: input["scheduleID"] } }).pipe(Effect.mapError(mapClientError)));
|
|
551
565
|
var adaptGroupExperimental = (raw) => ({
|
|
552
566
|
persistentPty: {
|
|
553
567
|
read: EndpointExperimentalPersistentPtyRead(raw),
|
|
@@ -560,6 +574,14 @@ var adaptGroupExperimental = (raw) => ({
|
|
|
560
574
|
snapshot: EndpointExperimentalPersistentPtySnapshot(raw),
|
|
561
575
|
remove: EndpointExperimentalPersistentPtyRemove(raw),
|
|
562
576
|
connectToken: EndpointExperimentalPersistentPtyConnectToken(raw)
|
|
577
|
+
},
|
|
578
|
+
schedule: {
|
|
579
|
+
create: EndpointExperimentalScheduleCreate(raw),
|
|
580
|
+
list: EndpointExperimentalScheduleList(raw),
|
|
581
|
+
get: EndpointExperimentalScheduleGet(raw),
|
|
582
|
+
pause: EndpointExperimentalSchedulePause(raw),
|
|
583
|
+
resume: EndpointExperimentalScheduleResume(raw),
|
|
584
|
+
delete: EndpointExperimentalScheduleDelete(raw)
|
|
563
585
|
}
|
|
564
586
|
});
|
|
565
587
|
var EndpointShellList = (raw) => (input) => preserveEffect()(raw["shell.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
@@ -764,6 +786,6 @@ var adaptClient = (raw) => {
|
|
|
764
786
|
}
|
|
765
787
|
};
|
|
766
788
|
};
|
|
767
|
-
var
|
|
789
|
+
var make4 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
|
|
768
790
|
|
|
769
|
-
export {
|
|
791
|
+
export { make4, exports_client2 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/effect/generated/client-error.ts
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class ClientError2 extends Schema.TaggedError()("ClientError", {
|
|
5
5
|
cause: Schema.Defect()
|
|
6
6
|
}) {
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { ClientError2 };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
ClientError3
|
|
3
|
+
} from "./contract-nwcpakzx.js";
|
|
4
4
|
import {
|
|
5
5
|
__export
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./contract-9rqn6x4v.js";
|
|
7
7
|
|
|
8
8
|
// src/promise/generated/client.ts
|
|
9
|
-
var
|
|
10
|
-
__export(
|
|
11
|
-
make: () =>
|
|
9
|
+
var exports_client4 = {};
|
|
10
|
+
__export(exports_client4, {
|
|
11
|
+
make: () => make6
|
|
12
12
|
});
|
|
13
13
|
var maxSseEventBytes = 16 * 1024 * 1024;
|
|
14
|
-
function
|
|
14
|
+
function make6(options) {
|
|
15
15
|
const fetch = options.fetch ?? globalThis.fetch;
|
|
16
16
|
const prepare = (descriptor, requestOptions) => {
|
|
17
17
|
const baseUrl = new URL(options.baseUrl);
|
|
@@ -44,7 +44,7 @@ function make3(options) {
|
|
|
44
44
|
const prepared = prepare(descriptor, requestOptions);
|
|
45
45
|
return await fetch(prepared.url, prepared.init);
|
|
46
46
|
} catch (cause) {
|
|
47
|
-
throw new
|
|
47
|
+
throw new ClientError3("Transport", { cause });
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
const responseError = async (response, descriptor) => {
|
|
@@ -53,7 +53,7 @@ function make3(options) {
|
|
|
53
53
|
try {
|
|
54
54
|
await response.body?.cancel();
|
|
55
55
|
} catch {}
|
|
56
|
-
throw new
|
|
56
|
+
throw new ClientError3("UnexpectedStatus", { cause: { status: response.status }, detail: String(response.status) });
|
|
57
57
|
};
|
|
58
58
|
const request = async (descriptor, requestOptions) => {
|
|
59
59
|
const response = await execute(descriptor, requestOptions);
|
|
@@ -78,10 +78,10 @@ function make3(options) {
|
|
|
78
78
|
try {
|
|
79
79
|
await response.body?.cancel();
|
|
80
80
|
} catch {}
|
|
81
|
-
throw new
|
|
81
|
+
throw new ClientError3("UnsupportedContentType", { detail: response.headers.get("content-type") });
|
|
82
82
|
}
|
|
83
83
|
if (response.body === null)
|
|
84
|
-
throw new
|
|
84
|
+
throw new ClientError3("MalformedResponse");
|
|
85
85
|
const reader = response.body.getReader();
|
|
86
86
|
const decoder = new TextDecoder;
|
|
87
87
|
let buffer = "";
|
|
@@ -91,13 +91,13 @@ function make3(options) {
|
|
|
91
91
|
try {
|
|
92
92
|
next = await reader.read();
|
|
93
93
|
} catch (cause) {
|
|
94
|
-
throw new
|
|
94
|
+
throw new ClientError3("Transport", { cause });
|
|
95
95
|
}
|
|
96
96
|
if (!next.done)
|
|
97
97
|
requestOptions?.onActivity?.();
|
|
98
98
|
buffer += decoder.decode(next.value, { stream: !next.done });
|
|
99
99
|
if (buffer.length > maxSseEventBytes)
|
|
100
|
-
throw new
|
|
100
|
+
throw new ClientError3("SseEventTooLarge");
|
|
101
101
|
const trailingCarriageReturn = !next.done && buffer.endsWith("\r");
|
|
102
102
|
if (trailingCarriageReturn)
|
|
103
103
|
buffer = buffer.slice(0, -1);
|
|
@@ -124,7 +124,7 @@ function make3(options) {
|
|
|
124
124
|
try {
|
|
125
125
|
yield JSON.parse(data);
|
|
126
126
|
} catch (cause) {
|
|
127
|
-
throw new
|
|
127
|
+
throw new ClientError3("MalformedResponse", { cause });
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
boundary = buffer.indexOf(`
|
|
@@ -856,6 +856,58 @@ function make3(options) {
|
|
|
856
856
|
binary: true
|
|
857
857
|
}, requestOptions)
|
|
858
858
|
},
|
|
859
|
+
schedule: {
|
|
860
|
+
create: (input, requestOptions) => request({
|
|
861
|
+
method: "POST",
|
|
862
|
+
path: `/api/experimental/schedule`,
|
|
863
|
+
body: {
|
|
864
|
+
sessionID: input["sessionID"],
|
|
865
|
+
name: input["name"],
|
|
866
|
+
when: input["when"],
|
|
867
|
+
ends: input["ends"],
|
|
868
|
+
prompt: input["prompt"]
|
|
869
|
+
},
|
|
870
|
+
successStatus: 200,
|
|
871
|
+
declaredStatuses: [400, 401, 403, 404],
|
|
872
|
+
empty: false
|
|
873
|
+
}, requestOptions).then((value) => value.data),
|
|
874
|
+
list: (input, requestOptions) => request({
|
|
875
|
+
method: "GET",
|
|
876
|
+
path: `/api/experimental/schedule`,
|
|
877
|
+
query: { sessionID: input["sessionID"] },
|
|
878
|
+
successStatus: 200,
|
|
879
|
+
declaredStatuses: [400, 401, 403, 404],
|
|
880
|
+
empty: false
|
|
881
|
+
}, requestOptions).then((value) => value.data),
|
|
882
|
+
get: (input, requestOptions) => request({
|
|
883
|
+
method: "GET",
|
|
884
|
+
path: `/api/experimental/schedule/${encodeURIComponent(input.scheduleID)}`,
|
|
885
|
+
successStatus: 200,
|
|
886
|
+
declaredStatuses: [400, 401, 403, 404],
|
|
887
|
+
empty: false
|
|
888
|
+
}, requestOptions).then((value) => value.data),
|
|
889
|
+
pause: (input, requestOptions) => request({
|
|
890
|
+
method: "POST",
|
|
891
|
+
path: `/api/experimental/schedule/${encodeURIComponent(input.scheduleID)}/pause`,
|
|
892
|
+
successStatus: 200,
|
|
893
|
+
declaredStatuses: [400, 401, 403, 404],
|
|
894
|
+
empty: false
|
|
895
|
+
}, requestOptions).then((value) => value.data),
|
|
896
|
+
resume: (input, requestOptions) => request({
|
|
897
|
+
method: "POST",
|
|
898
|
+
path: `/api/experimental/schedule/${encodeURIComponent(input.scheduleID)}/resume`,
|
|
899
|
+
successStatus: 200,
|
|
900
|
+
declaredStatuses: [400, 401, 403, 404],
|
|
901
|
+
empty: false
|
|
902
|
+
}, requestOptions).then((value) => value.data),
|
|
903
|
+
delete: (input, requestOptions) => request({
|
|
904
|
+
method: "DELETE",
|
|
905
|
+
path: `/api/experimental/schedule/${encodeURIComponent(input.scheduleID)}`,
|
|
906
|
+
successStatus: 204,
|
|
907
|
+
declaredStatuses: [400, 401, 403, 404],
|
|
908
|
+
empty: true
|
|
909
|
+
}, requestOptions)
|
|
910
|
+
},
|
|
859
911
|
migration: {
|
|
860
912
|
v1: {
|
|
861
913
|
status: (requestOptions) => request({
|
|
@@ -1641,20 +1693,20 @@ async function json(response) {
|
|
|
1641
1693
|
try {
|
|
1642
1694
|
await response.body?.cancel();
|
|
1643
1695
|
} catch {}
|
|
1644
|
-
throw new
|
|
1696
|
+
throw new ClientError3("UnsupportedContentType", { detail: response.headers.get("content-type") });
|
|
1645
1697
|
}
|
|
1646
1698
|
let text;
|
|
1647
1699
|
try {
|
|
1648
1700
|
text = await response.text();
|
|
1649
1701
|
} catch (cause) {
|
|
1650
|
-
throw new
|
|
1702
|
+
throw new ClientError3("Transport", { cause });
|
|
1651
1703
|
}
|
|
1652
1704
|
if (text === "")
|
|
1653
|
-
throw new
|
|
1705
|
+
throw new ClientError3("MalformedResponse");
|
|
1654
1706
|
try {
|
|
1655
1707
|
return JSON.parse(text);
|
|
1656
1708
|
} catch (cause) {
|
|
1657
|
-
throw new
|
|
1709
|
+
throw new ClientError3("MalformedResponse", { cause });
|
|
1658
1710
|
}
|
|
1659
1711
|
}
|
|
1660
1712
|
function declared(body) {
|
|
@@ -1667,4 +1719,4 @@ function isContentType(response, expected) {
|
|
|
1667
1719
|
return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected;
|
|
1668
1720
|
}
|
|
1669
1721
|
|
|
1670
|
-
export {
|
|
1722
|
+
export { make6, exports_client4 };
|
package/dist/contract.js
CHANGED
package/dist/effect/api/api.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ import type { FileSystem } from "@opencode/schema/filesystem";
|
|
|
36
36
|
import type { Command } from "@opencode/schema/command";
|
|
37
37
|
import type { OpenCodeEvent } from "@opencode/protocol/groups/event";
|
|
38
38
|
import type { Pty } from "@opencode/schema/pty";
|
|
39
|
+
import type { Schedule } from "@opencode/schema/schedule";
|
|
39
40
|
import type { Reference } from "@opencode/schema/reference";
|
|
40
41
|
import type { Worktree } from "@opencode/schema/worktree";
|
|
41
42
|
import type { Vcs } from "@opencode/schema/vcs";
|
|
@@ -2689,6 +2690,40 @@ export type ExperimentalPersistentPtyConnectTokenInput = {
|
|
|
2689
2690
|
};
|
|
2690
2691
|
export type ExperimentalPersistentPtyConnectTokenOutput = PtyTicket.ConnectToken;
|
|
2691
2692
|
export type ExperimentalPersistentPtyConnectTokenOperation<E = never> = (input: ExperimentalPersistentPtyConnectTokenInput) => Effect.Effect<ExperimentalPersistentPtyConnectTokenOutput, E>;
|
|
2693
|
+
export type ExperimentalScheduleCreateInput = {
|
|
2694
|
+
readonly sessionID: Session.ID;
|
|
2695
|
+
readonly name?: string | undefined;
|
|
2696
|
+
readonly when: Schedule.WhenInput;
|
|
2697
|
+
readonly ends?: Schedule.Ends | undefined;
|
|
2698
|
+
readonly prompt: string;
|
|
2699
|
+
};
|
|
2700
|
+
export type ExperimentalScheduleCreateOutput = Schedule.Info;
|
|
2701
|
+
export type ExperimentalScheduleCreateOperation<E = never> = (input: ExperimentalScheduleCreateInput) => Effect.Effect<ExperimentalScheduleCreateOutput, E>;
|
|
2702
|
+
export type ExperimentalScheduleListInput = {
|
|
2703
|
+
readonly sessionID: Session.ID;
|
|
2704
|
+
};
|
|
2705
|
+
export type ExperimentalScheduleListOutput = ReadonlyArray<Schedule.Info>;
|
|
2706
|
+
export type ExperimentalScheduleListOperation<E = never> = (input: ExperimentalScheduleListInput) => Effect.Effect<ExperimentalScheduleListOutput, E>;
|
|
2707
|
+
export type ExperimentalScheduleGetInput = {
|
|
2708
|
+
readonly scheduleID: Schedule.ID;
|
|
2709
|
+
};
|
|
2710
|
+
export type ExperimentalScheduleGetOutput = Schedule.Info;
|
|
2711
|
+
export type ExperimentalScheduleGetOperation<E = never> = (input: ExperimentalScheduleGetInput) => Effect.Effect<ExperimentalScheduleGetOutput, E>;
|
|
2712
|
+
export type ExperimentalSchedulePauseInput = {
|
|
2713
|
+
readonly scheduleID: Schedule.ID;
|
|
2714
|
+
};
|
|
2715
|
+
export type ExperimentalSchedulePauseOutput = Schedule.Info;
|
|
2716
|
+
export type ExperimentalSchedulePauseOperation<E = never> = (input: ExperimentalSchedulePauseInput) => Effect.Effect<ExperimentalSchedulePauseOutput, E>;
|
|
2717
|
+
export type ExperimentalScheduleResumeInput = {
|
|
2718
|
+
readonly scheduleID: Schedule.ID;
|
|
2719
|
+
};
|
|
2720
|
+
export type ExperimentalScheduleResumeOutput = Schedule.Info;
|
|
2721
|
+
export type ExperimentalScheduleResumeOperation<E = never> = (input: ExperimentalScheduleResumeInput) => Effect.Effect<ExperimentalScheduleResumeOutput, E>;
|
|
2722
|
+
export type ExperimentalScheduleDeleteInput = {
|
|
2723
|
+
readonly scheduleID: Schedule.ID;
|
|
2724
|
+
};
|
|
2725
|
+
export type ExperimentalScheduleDeleteOutput = void;
|
|
2726
|
+
export type ExperimentalScheduleDeleteOperation<E = never> = (input: ExperimentalScheduleDeleteInput) => Effect.Effect<ExperimentalScheduleDeleteOutput, E>;
|
|
2692
2727
|
export interface ExperimentalApi<E = never> {
|
|
2693
2728
|
readonly persistentPty: {
|
|
2694
2729
|
readonly read: ExperimentalPersistentPtyReadOperation<E>;
|
|
@@ -2702,6 +2737,14 @@ export interface ExperimentalApi<E = never> {
|
|
|
2702
2737
|
readonly remove: ExperimentalPersistentPtyRemoveOperation<E>;
|
|
2703
2738
|
readonly connectToken: ExperimentalPersistentPtyConnectTokenOperation<E>;
|
|
2704
2739
|
};
|
|
2740
|
+
readonly schedule: {
|
|
2741
|
+
readonly create: ExperimentalScheduleCreateOperation<E>;
|
|
2742
|
+
readonly list: ExperimentalScheduleListOperation<E>;
|
|
2743
|
+
readonly get: ExperimentalScheduleGetOperation<E>;
|
|
2744
|
+
readonly pause: ExperimentalSchedulePauseOperation<E>;
|
|
2745
|
+
readonly resume: ExperimentalScheduleResumeOperation<E>;
|
|
2746
|
+
readonly delete: ExperimentalScheduleDeleteOperation<E>;
|
|
2747
|
+
};
|
|
2705
2748
|
}
|
|
2706
2749
|
export type ShellListInput = {
|
|
2707
2750
|
readonly location?: {
|