@opencode/client 2.0.7 → 2.0.9

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.
Files changed (56) hide show
  1. package/dist/chunks/pty-handoff-1tbj6z39.js +81 -0
  2. package/dist/chunks/pty-handoff-4tveyqeh.js +34 -0
  3. package/dist/chunks/pty-handoff-65kht65h.js +62 -0
  4. package/dist/chunks/pty-handoff-6mptkzbc.js +0 -0
  5. package/dist/chunks/pty-handoff-9rqn6x4v.js +16 -0
  6. package/dist/chunks/pty-handoff-atpwm825.js +1638 -0
  7. package/dist/chunks/pty-handoff-bssvn03b.js +594 -0
  8. package/dist/chunks/pty-handoff-frbwqjmf.js +145 -0
  9. package/dist/chunks/pty-handoff-m2eywc8w.js +0 -0
  10. package/dist/chunks/pty-handoff-n3c99vt5.js +11 -0
  11. package/dist/chunks/pty-handoff-nqd0dnpk.js +112 -0
  12. package/dist/chunks/pty-handoff-qav6mfdz.js +0 -0
  13. package/dist/chunks/pty-handoff-radw39tv.js +1402 -0
  14. package/dist/chunks/pty-handoff-sxt88q69.js +12 -0
  15. package/dist/chunks/pty-handoff-t1xa31vm.js +39 -0
  16. package/dist/chunks/pty-handoff-txckps9j.js +57 -0
  17. package/dist/chunks/pty-handoff-vgxtr9hm.js +30 -0
  18. package/dist/chunks/pty-handoff-vmytr4q8.js +4 -0
  19. package/dist/chunks/pty-handoff-vyas3vgt.js +0 -0
  20. package/dist/chunks/pty-handoff-xgnj2w4v.js +20 -0
  21. package/dist/chunks/pty-handoff-y2etg5bs.js +9 -0
  22. package/dist/chunks/pty-handoff-ydhz1zrh.js +238 -0
  23. package/dist/chunks/pty-handoff-yepdgb80.js +44 -0
  24. package/dist/chunks/pty-handoff-zadn5mwr.js +52 -0
  25. package/dist/contract.js +12 -1
  26. package/dist/effect/client.d.ts +4 -4
  27. package/dist/effect/client.js +15 -29
  28. package/dist/effect/generated/client-error.js +6 -5
  29. package/dist/effect/generated/client.d.ts +4 -4
  30. package/dist/effect/generated/client.js +8 -582
  31. package/dist/effect/generated/index.js +12 -2
  32. package/dist/effect/index.js +75 -30
  33. package/dist/effect/rpc.js +11 -49
  34. package/dist/effect/service.js +238 -245
  35. package/dist/promise/client.js +14 -13
  36. package/dist/promise/generated/client-error.js +6 -8
  37. package/dist/promise/generated/client.js +7 -1396
  38. package/dist/promise/generated/index.js +75 -3
  39. package/dist/promise/generated/types.d.ts +91 -89
  40. package/dist/promise/generated/types.js +66 -34
  41. package/dist/promise/index.js +79 -2
  42. package/dist/promise/rpc.js +7 -86
  43. package/dist/promise/service.js +230 -227
  44. package/dist/pty-handoff.js +14 -121
  45. package/dist/rpc-runtime.js +14 -32
  46. package/dist/service-contender.js +10 -56
  47. package/dist/service-timing.d.ts +0 -1
  48. package/dist/service-timing.js +9 -18
  49. package/dist/service-version.js +6 -9
  50. package/dist/service.js +1 -0
  51. package/dist/shared-events.js +8 -137
  52. package/dist/solid/connection.js +10 -246
  53. package/dist/solid/data.js +18 -1769
  54. package/dist/solid/index.js +32 -3
  55. package/dist/solid/pty.js +8 -41
  56. package/package.json +4 -4
@@ -0,0 +1,81 @@
1
+ import {
2
+ isRpcError2,
3
+ isRpcInternalError2
4
+ } from "./pty-handoff-4tveyqeh.js";
5
+
6
+ // src/promise/rpc.ts
7
+ function makeRpc2(raw, events) {
8
+ return (definition) => {
9
+ const subscribe = (name, options) => {
10
+ if (!Object.hasOwn(definition.events, name))
11
+ throw new Error(`Unknown RPC event: ${definition.id}.${name}`);
12
+ const type = eventType(definition, name);
13
+ return {
14
+ [Symbol.asyncIterator]() {
15
+ const controller = new AbortController;
16
+ const signal = options?.signal ? AbortSignal.any([controller.signal, options.signal]) : controller.signal;
17
+ const iterator = async function* () {
18
+ try {
19
+ for await (const published of events.subscribe({ signal })) {
20
+ if (signal.aborted)
21
+ return;
22
+ if (published.type !== type)
23
+ continue;
24
+ yield published;
25
+ }
26
+ } catch (error) {
27
+ if (!signal.aborted)
28
+ throw error;
29
+ } finally {
30
+ controller.abort();
31
+ }
32
+ }();
33
+ return {
34
+ next: () => iterator.next(),
35
+ return: () => {
36
+ controller.abort();
37
+ return iterator.return();
38
+ }
39
+ };
40
+ }
41
+ };
42
+ };
43
+ return Object.assign(Object.fromEntries(Object.keys(definition.methods).map((name) => [
44
+ name,
45
+ async (input, options) => {
46
+ try {
47
+ const result = await raw.rpc.call({
48
+ rpcID: definition.id,
49
+ method: name,
50
+ input,
51
+ location: options?.location
52
+ }, { signal: options?.signal, headers: options?.headers });
53
+ return result.output;
54
+ } catch (error) {
55
+ if (!isRpcError2(error) && !isRpcInternalError2(error))
56
+ throw error;
57
+ throw error.data === undefined ? { type: error.type, message: error.message } : { type: error.type, message: error.message, data: error.data };
58
+ }
59
+ }
60
+ ])), {
61
+ events: {
62
+ subscribe,
63
+ on: (name, handler, options) => {
64
+ const controller = new AbortController;
65
+ const signal = options?.signal ? AbortSignal.any([controller.signal, options.signal]) : controller.signal;
66
+ const source = subscribe(name, { signal });
67
+ (async () => {
68
+ for await (const event of source)
69
+ await handler(event);
70
+ })().catch((error) => console.error(error));
71
+ return () => controller.abort();
72
+ }
73
+ }
74
+ });
75
+ };
76
+ }
77
+ function eventType(definition, name) {
78
+ return `rpc.${definition.id}.${name}`;
79
+ }
80
+
81
+ export { makeRpc2 };
@@ -0,0 +1,34 @@
1
+ // src/promise/generated/types.ts
2
+ var isInvalidRequestError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InvalidRequestError";
3
+ var isUnauthorizedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "UnauthorizedError";
4
+ var isServiceUnavailableError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ServiceUnavailableError";
5
+ var isAgentNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "AgentNotFoundError";
6
+ var isInvalidCursorError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InvalidCursorError";
7
+ var isSessionNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SessionNotFoundError";
8
+ var isConflictError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ConflictError";
9
+ var isUnknownError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "UnknownError";
10
+ var isMessageNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "MessageNotFoundError";
11
+ var isCommandNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "CommandNotFoundError";
12
+ var isCommandExecutionError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "CommandExecutionError";
13
+ var isSkillNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SkillNotFoundError";
14
+ var isSessionBusyError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SessionBusyError";
15
+ var isInstructionEntryValueTooLargeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InstructionEntryValueTooLargeError";
16
+ var isFormNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormNotFoundError";
17
+ var isFormInvalidAnswerError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormInvalidAnswerError";
18
+ var isFormAlreadySettledError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormAlreadySettledError";
19
+ var isProviderNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ProviderNotFoundError";
20
+ var isIntegrationNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationNotFoundError";
21
+ var isIntegrationAttemptNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationAttemptNotFoundError";
22
+ var isIntegrationMethodNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationMethodNotFoundError";
23
+ var isMcpServerNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "McpServerNotFoundError";
24
+ var isProjectNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ProjectNotFoundError";
25
+ var isPermissionNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PermissionNotFoundError";
26
+ var isFileNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FileNotFoundError";
27
+ var isRpcError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcError";
28
+ var isRpcInternalError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcInternalError";
29
+ var isPtyNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PtyNotFoundError";
30
+ var isForbiddenError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ForbiddenError";
31
+ var isShellNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ShellNotFoundError";
32
+ var isWorktreeError2 = (value) => typeof value === "object" && value !== null && ("name" in value) && value["name"] === "WorktreeError";
33
+
34
+ export { isInvalidRequestError2, isUnauthorizedError2, isServiceUnavailableError2, isAgentNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isConflictError2, isUnknownError2, isMessageNotFoundError2, isCommandNotFoundError2, isCommandExecutionError2, isSkillNotFoundError2, isSessionBusyError2, isInstructionEntryValueTooLargeError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isProviderNotFoundError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2, isProjectNotFoundError2, isPermissionNotFoundError2, isFileNotFoundError2, isRpcError2, isRpcInternalError2, isPtyNotFoundError2, isForbiddenError2, isShellNotFoundError2, isWorktreeError2 };
@@ -0,0 +1,62 @@
1
+ import {
2
+ read2,
3
+ readError2,
4
+ event2,
5
+ eventType2
6
+ } from "./pty-handoff-t1xa31vm.js";
7
+ import {
8
+ __export
9
+ } from "./pty-handoff-9rqn6x4v.js";
10
+
11
+ // src/effect/rpc.ts
12
+ var exports_rpc = {};
13
+ __export(exports_rpc, {
14
+ RpcClientRuntime: () => exports_rpc,
15
+ aborted: () => aborted2,
16
+ make: () => make3
17
+ });
18
+ import { Effect, Stream } from "effect";
19
+ function make3(call, subscribe) {
20
+ return (definition) => {
21
+ const methods = Object.fromEntries(Object.entries(definition.methods).map(([name, method]) => [
22
+ name,
23
+ (input, options) => {
24
+ const result = Effect.gen(function* () {
25
+ const response = yield* call({
26
+ rpcID: definition.id,
27
+ method: name,
28
+ input,
29
+ location: options?.location
30
+ }, options);
31
+ return yield* read2(method.output, response.output);
32
+ }).pipe(Effect.catch((error) => readError2(method, error)));
33
+ const signal = options?.signal;
34
+ if (!signal)
35
+ return result;
36
+ return Effect.suspend(() => signal.aborted ? Effect.interrupt : Effect.raceFirst(result, Effect.andThen(aborted2(signal), Effect.interrupt)));
37
+ }
38
+ ]));
39
+ return Object.assign(methods, {
40
+ events: {
41
+ subscribe: (name) => {
42
+ const type = eventType2(definition, name);
43
+ if (!Object.hasOwn(definition.events, name))
44
+ return Stream.fail(new Error(`Unknown RPC event: ${type}`));
45
+ const schema = definition.events[name];
46
+ return subscribe().pipe(Stream.filter((event) => event.type === type), Stream.mapEffect((event) => event2(definition, name, schema, event)));
47
+ }
48
+ }
49
+ });
50
+ };
51
+ }
52
+ function aborted2(signal) {
53
+ return Effect.callback((resume) => {
54
+ if (signal.aborted)
55
+ return resume(Effect.void);
56
+ const abort = () => resume(Effect.void);
57
+ signal.addEventListener("abort", abort, { once: true });
58
+ return Effect.sync(() => signal.removeEventListener("abort", abort));
59
+ });
60
+ }
61
+
62
+ export { make3, aborted2, exports_rpc };
File without changes
@@ -0,0 +1,16 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true,
11
+ configurable: true,
12
+ set: __exportSetter.bind(all, name)
13
+ });
14
+ };
15
+
16
+ export { __export };