@opencode/client 0.0.0-beta-19275

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 (62) hide show
  1. package/README.md +27 -0
  2. package/dist/contract.d.ts +1 -0
  3. package/dist/contract.js +1 -0
  4. package/dist/effect/api/api.d.ts +2659 -0
  5. package/dist/effect/api/api.js +0 -0
  6. package/dist/effect/api.d.ts +8 -0
  7. package/dist/effect/api.js +0 -0
  8. package/dist/effect/client.d.ts +2535 -0
  9. package/dist/effect/client.js +29 -0
  10. package/dist/effect/generated/client-error.d.ts +7 -0
  11. package/dist/effect/generated/client-error.js +5 -0
  12. package/dist/effect/generated/client.d.ts +2534 -0
  13. package/dist/effect/generated/client.js +602 -0
  14. package/dist/effect/generated/index.d.ts +2 -0
  15. package/dist/effect/generated/index.js +2 -0
  16. package/dist/effect/index.d.ts +35 -0
  17. package/dist/effect/index.js +30 -0
  18. package/dist/effect/rpc.d.ts +20 -0
  19. package/dist/effect/rpc.js +49 -0
  20. package/dist/effect/service.d.ts +78 -0
  21. package/dist/effect/service.js +259 -0
  22. package/dist/promise/api.d.ts +24 -0
  23. package/dist/promise/api.js +0 -0
  24. package/dist/promise/client.d.ts +257 -0
  25. package/dist/promise/client.js +13 -0
  26. package/dist/promise/generated/client-error.d.ts +6 -0
  27. package/dist/promise/generated/client-error.js +8 -0
  28. package/dist/promise/generated/client.d.ts +264 -0
  29. package/dist/promise/generated/client.js +1425 -0
  30. package/dist/promise/generated/index.d.ts +3 -0
  31. package/dist/promise/generated/index.js +3 -0
  32. package/dist/promise/generated/types.d.ts +8717 -0
  33. package/dist/promise/generated/types.js +30 -0
  34. package/dist/promise/index.d.ts +6 -0
  35. package/dist/promise/index.js +2 -0
  36. package/dist/promise/rpc.d.ts +32 -0
  37. package/dist/promise/rpc.js +86 -0
  38. package/dist/promise/service.d.ts +26 -0
  39. package/dist/promise/service.js +247 -0
  40. package/dist/pty-handoff.d.ts +9 -0
  41. package/dist/pty-handoff.js +121 -0
  42. package/dist/rpc-runtime.d.ts +21 -0
  43. package/dist/rpc-runtime.js +32 -0
  44. package/dist/service-contender.d.ts +11 -0
  45. package/dist/service-contender.js +56 -0
  46. package/dist/service-timing.d.ts +13 -0
  47. package/dist/service-timing.js +19 -0
  48. package/dist/service-version.d.ts +2 -0
  49. package/dist/service-version.js +9 -0
  50. package/dist/service.d.ts +52 -0
  51. package/dist/service.js +0 -0
  52. package/dist/shared-events.d.ts +11 -0
  53. package/dist/shared-events.js +137 -0
  54. package/dist/solid/connection.d.ts +37 -0
  55. package/dist/solid/connection.js +246 -0
  56. package/dist/solid/data.d.ts +199 -0
  57. package/dist/solid/data.js +1724 -0
  58. package/dist/solid/index.d.ts +3 -0
  59. package/dist/solid/index.js +3 -0
  60. package/dist/solid/pty.d.ts +22 -0
  61. package/dist/solid/pty.js +43 -0
  62. package/package.json +85 -0
@@ -0,0 +1,199 @@
1
+ import type { AgentInfo, CommandInfo, ConfigEntry, FormCancelInput, FormInfo, FormReplyInput, IntegrationInfo, LocationRef, LocationGetOutput, McpResource, McpServer, ModelInfo, ModelRef, PermissionSavedInfo, PermissionRequest, PermissionReplyInput, Project, ProviderInfo, ReferenceInfo, SessionMessageInfo, SessionInfo, SessionInboxInfo, SessionInboxCompaction, ShellInfo, SkillInfo, VcsInfo, OpenCodeEvent, OpenCodeClient, WebSearchProvider } from "../promise";
2
+ import { type SessionPromptInput } from "../promise";
3
+ export type DataSessionStatus = "idle" | "running";
4
+ type OpenCodeEventMap = {
5
+ [Type in OpenCodeEvent["type"]]: Extract<OpenCodeEvent, {
6
+ type: Type;
7
+ }>;
8
+ };
9
+ export type CreateDataInput = {
10
+ readonly api: () => OpenCodeClient;
11
+ readonly directory: string;
12
+ readonly event: {
13
+ readonly on: <Type extends OpenCodeEvent["type"]>(type: Type, handler: (event: OpenCodeEventMap[Type]) => void) => () => void;
14
+ readonly listen: (handler: (event: {
15
+ name: OpenCodeEvent["type"];
16
+ details: OpenCodeEvent;
17
+ }) => void) => () => void;
18
+ };
19
+ readonly connection?: {
20
+ readonly status: () => "connected" | "connecting" | "reconnecting";
21
+ };
22
+ /** Receives failed event-driven reads. Explicit reads still reject to their caller. */
23
+ readonly onError?: (error: unknown) => void;
24
+ };
25
+ export declare const settleMs = 150;
26
+ export type FormWithLocation = FormInfo & {
27
+ readonly location?: LocationRef;
28
+ };
29
+ type ShellWithLocation = ShellInfo & {
30
+ readonly location: LocationRef;
31
+ };
32
+ export declare function locationKey(location: LocationRef): string;
33
+ export declare function createData(config: CreateDataInput): {
34
+ on: <Type extends OpenCodeEvent["type"]>(type: Type, handler: (event: OpenCodeEventMap[Type]) => void) => () => void;
35
+ listen: (handler: (event: {
36
+ name: OpenCodeEvent["type"];
37
+ details: OpenCodeEvent;
38
+ }) => void) => () => void;
39
+ session: {
40
+ list(): SessionInfo[];
41
+ get(sessionID: string): SessionInfo;
42
+ creating(sessionID: string): boolean;
43
+ remember(info: SessionInfo): void;
44
+ setStatus(sessionID: string, status: DataSessionStatus): void;
45
+ root(sessionID: string): string;
46
+ family(sessionID: string): string[];
47
+ /** Clear heavy cached data for the root and all known descendants. */
48
+ evict(sessionID: string): void;
49
+ cost(sessionID: string): number;
50
+ status(sessionID: string): DataSessionStatus;
51
+ input: {
52
+ list(sessionID: string): string[];
53
+ has(sessionID: string, inboxID: string): boolean;
54
+ };
55
+ pending: {
56
+ list(sessionID: string): SessionInboxInfo[];
57
+ sync(sessionID: string): Promise<void>;
58
+ invalidate(sessionID: string): void;
59
+ };
60
+ create(input: {
61
+ id?: string;
62
+ title?: string;
63
+ agent?: string;
64
+ model?: ModelRef;
65
+ location?: LocationRef;
66
+ projectID?: string;
67
+ }): {
68
+ id: string;
69
+ request: Promise<SessionInfo>;
70
+ };
71
+ compact(input: {
72
+ sessionID: string;
73
+ model?: ModelRef;
74
+ }): Promise<SessionInboxCompaction>;
75
+ prompt(input: SessionPromptInput & {
76
+ gate?: Promise<unknown>;
77
+ prepare?: () => Promise<unknown>;
78
+ }): Promise<import("../promise").SessionInboxUser>;
79
+ sync(sessionID: string, options?: {
80
+ children?: boolean;
81
+ }): Promise<void>;
82
+ invalidate(sessionID: string): void;
83
+ message: {
84
+ list(sessionID: string): SessionMessageInfo[];
85
+ get(sessionID: string, messageID: string): SessionMessageInfo | undefined;
86
+ sync(sessionID: string): Promise<void>;
87
+ more(sessionID: string): boolean;
88
+ loading(sessionID: string): boolean;
89
+ loadMore(sessionID: string, options?: {
90
+ all?: boolean;
91
+ signal?: AbortSignal;
92
+ /** Runs synchronously inside the store-publication batch. */
93
+ beforePublish?: () => void;
94
+ }): Promise<void>;
95
+ invalidate(sessionID: string): void;
96
+ };
97
+ permission: {
98
+ list(sessionID: string): PermissionRequest[];
99
+ sync(sessionID: string): Promise<void>;
100
+ invalidate(sessionID: string): void;
101
+ reply(input: PermissionReplyInput): Promise<void>;
102
+ };
103
+ form: {
104
+ list(sessionID: string, ref?: LocationRef): FormWithLocation[] | undefined;
105
+ sync(sessionID: string, ref?: LocationRef): Promise<void>;
106
+ invalidate(sessionID: string, ref?: LocationRef): void;
107
+ reply(input: FormReplyInput, ref?: LocationRef): Promise<void>;
108
+ cancel(input: FormCancelInput, ref?: LocationRef): Promise<void>;
109
+ };
110
+ };
111
+ project: {
112
+ list(): Project[];
113
+ get(projectID: string): Project;
114
+ sync(): Promise<void>;
115
+ invalidate(): void;
116
+ permission: {
117
+ list(projectID: string): PermissionSavedInfo[];
118
+ sync(projectID: string): Promise<void>;
119
+ invalidate(projectID: string): void;
120
+ };
121
+ };
122
+ shell: {
123
+ list(location?: LocationRef): ShellWithLocation[];
124
+ listBySession(sessionID: string): ShellWithLocation[];
125
+ get(id: string): ShellWithLocation | undefined;
126
+ sync: (ref?: LocationRef) => Promise<void>;
127
+ invalidate: (ref?: LocationRef) => void;
128
+ };
129
+ location: {
130
+ info(ref?: LocationRef): LocationGetOutput | undefined;
131
+ default(): LocationRef;
132
+ syncInfo(ref?: LocationRef): Promise<void>;
133
+ sync(ref?: LocationRef): Promise<void>;
134
+ invalidate(ref?: LocationRef): void;
135
+ vcs: {
136
+ info: (ref?: LocationRef) => VcsInfo | undefined;
137
+ sync: (ref?: LocationRef) => Promise<void>;
138
+ invalidate: (ref?: LocationRef) => void;
139
+ };
140
+ agent: {
141
+ list: (ref?: LocationRef) => AgentInfo[] | undefined;
142
+ sync: (ref?: LocationRef) => Promise<void>;
143
+ invalidate: (ref?: LocationRef) => void;
144
+ };
145
+ command: {
146
+ list: (ref?: LocationRef) => CommandInfo[] | undefined;
147
+ sync: (ref?: LocationRef) => Promise<void>;
148
+ invalidate: (ref?: LocationRef) => void;
149
+ };
150
+ config: {
151
+ list: (ref?: LocationRef) => ConfigEntry[] | undefined;
152
+ sync: (ref?: LocationRef) => Promise<void>;
153
+ invalidate: (ref?: LocationRef) => void;
154
+ };
155
+ integration: {
156
+ list: (ref?: LocationRef) => IntegrationInfo[] | undefined;
157
+ sync: (ref?: LocationRef) => Promise<void>;
158
+ invalidate: (ref?: LocationRef) => void;
159
+ };
160
+ mcp: {
161
+ server: {
162
+ list: (ref?: LocationRef) => McpServer[] | undefined;
163
+ sync: (ref?: LocationRef) => Promise<void>;
164
+ invalidate: (ref?: LocationRef) => void;
165
+ };
166
+ resource: {
167
+ list: (ref?: LocationRef) => McpResource[] | undefined;
168
+ sync: (ref?: LocationRef) => Promise<void>;
169
+ invalidate: (ref?: LocationRef) => void;
170
+ };
171
+ };
172
+ model: {
173
+ list: (ref?: LocationRef) => ModelInfo[] | undefined;
174
+ sync: (ref?: LocationRef) => Promise<void>;
175
+ invalidate: (ref?: LocationRef) => void;
176
+ };
177
+ provider: {
178
+ list: (ref?: LocationRef) => ProviderInfo[] | undefined;
179
+ sync: (ref?: LocationRef) => Promise<void>;
180
+ invalidate: (ref?: LocationRef) => void;
181
+ };
182
+ reference: {
183
+ list: (ref?: LocationRef) => ReferenceInfo[] | undefined;
184
+ sync: (ref?: LocationRef) => Promise<void>;
185
+ invalidate: (ref?: LocationRef) => void;
186
+ };
187
+ websearch: {
188
+ list(location?: LocationRef): WebSearchProvider[] | undefined;
189
+ refresh(ref?: LocationRef): Promise<void>;
190
+ };
191
+ skill: {
192
+ list: (ref?: LocationRef) => SkillInfo[] | undefined;
193
+ sync: (ref?: LocationRef) => Promise<void>;
194
+ invalidate: (ref?: LocationRef) => void;
195
+ };
196
+ };
197
+ };
198
+ export type Data = ReturnType<typeof createData>;
199
+ export {};