GeezerVison is showing github.com — chore: generate · ildella/opencode@8cc2276
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/core/src/pty.ts +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -278,8 +278,7 @@ export const layer = Layer.effect( | 278 | 278 | const update = Effect.fn("Pty.update")(function* (id: PtyID, input: UpdateInput) { | 279 | 279 | const session = yield* requireSession(id) | 280 | 280 | if (input.title) session.info.title = input.title | 281 | | - if (input.size && session.info.status === "running") | 282 | | - session.process.resize(input.size.cols, input.size.rows) | | 281 | + if (input.size && session.info.status === "running") session.process.resize(input.size.cols, input.size.rows) | 283 | 282 | yield* events.publish(Event.Updated, { info: session.info }) | 284 | 283 | return session.info | 285 | 284 | }) | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/test/server/httpapi-v2-pty.test.ts +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -164,7 +164,10 @@ describe("v2 pty HttpApi", () => { | 164 | 164 | expect(yield* takeUntil("ping-v2")).toContain("ping-v2") | 165 | 165 | yield* write(new Socket.CloseEvent(1000, "done")).pipe(Effect.catch(() => Effect.void)) | 166 | 166 |
| 167 | | - const removed = yield* HttpClientRequest.delete(`/api/pty/${info.id}`).pipe(directoryHeader(dir), HttpClient.execute) | | 167 | + const removed = yield* HttpClientRequest.delete(`/api/pty/${info.id}`).pipe( | | 168 | + directoryHeader(dir), | | 169 | + HttpClient.execute, | | 170 | + ) | 168 | 171 | expect(removed.status).toBe(204) | 169 | 172 | }), | 170 | 173 | ) | |
Collapse file Copy file name to clipboardExpand all lines: packages/sdk/js/src/v2/gen/sdk.gen.ts +271Lines changed: 271 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -309,6 +309,20 @@ import type { | 309 | 309 | V2ProviderGetResponses, | 310 | 310 | V2ProviderListErrors, | 311 | 311 | V2ProviderListResponses, | | 312 | + V2PtyConnectErrors, | | 313 | + V2PtyConnectResponses, | | 314 | + V2PtyConnectTokenErrors, | | 315 | + V2PtyConnectTokenResponses, | | 316 | + V2PtyCreateErrors, | | 317 | + V2PtyCreateResponses, | | 318 | + V2PtyGetErrors, | | 319 | + V2PtyGetResponses, | | 320 | + V2PtyListErrors, | | 321 | + V2PtyListResponses, | | 322 | + V2PtyRemoveErrors, | | 323 | + V2PtyRemoveResponses, | | 324 | + V2PtyUpdateErrors, | | 325 | + V2PtyUpdateResponses, | 312 | 326 | V2QuestionRequestListErrors, | 313 | 327 | V2QuestionRequestListResponses, | 314 | 328 | V2ReferenceListErrors, | @@ -6101,6 +6115,258 @@ export class Event2 extends HeyApiClient { | 6101 | 6115 | } | 6102 | 6116 | } | 6103 | 6117 |
| | 6118 | +export class Pty2 extends HeyApiClient { | | 6119 | + /** | | 6120 | + * List PTY sessions | | 6121 | + * | | 6122 | + * List PTY sessions for a location, including exited sessions retained until removal. | | 6123 | + */ | | 6124 | + public list<ThrowOnError extends boolean = false>( | | 6125 | + parameters?: { | | 6126 | + location?: { | | 6127 | + directory?: string | | 6128 | + workspace?: string | | 6129 | + } | | 6130 | + }, | | 6131 | + options?: Options<never, ThrowOnError>, | | 6132 | + ) { | | 6133 | + const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }]) | | 6134 | + return (options?.client ?? this.client).get<V2PtyListResponses, V2PtyListErrors, ThrowOnError>({ | | 6135 | + url: "/api/pty", | | 6136 | + ...options, | | 6137 | + ...params, | | 6138 | + }) | | 6139 | + } | | 6140 | + | | 6141 | + /** | | 6142 | + * Create PTY session | | 6143 | + * | | 6144 | + * Create a pseudo-terminal session for a location. | | 6145 | + */ | | 6146 | + public create<ThrowOnError extends boolean = false>( | | 6147 | + parameters?: { | | 6148 | + location?: { | | 6149 | + directory?: string | | 6150 | + workspace?: string | | 6151 | + } | | 6152 | + command?: string | | 6153 | + args?: Array<string> | | 6154 | + cwd?: string | | 6155 | + title?: string | | 6156 | + env?: { | | 6157 | + [key: string]: string | | 6158 | + } | | 6159 | + }, | | 6160 | + options?: Options<never, ThrowOnError>, | | 6161 | + ) { | | 6162 | + const params = buildClientParams( | | 6163 | + [parameters], | | 6164 | + [ | | 6165 | + { | | 6166 | + args: [ | | 6167 | + { in: "query", key: "location" }, | | 6168 | + { in: "body", key: "command" }, | | 6169 | + { in: "body", key: "args" }, | | 6170 | + { in: "body", key: "cwd" }, | | 6171 | + { in: "body", key: "title" }, | | 6172 | + { in: "body", key: "env" }, | | 6173 | + ], | | 6174 | + }, | | 6175 | + ], | | 6176 | + ) | | 6177 | + return (options?.client ?? this.client).post<V2PtyCreateResponses, V2PtyCreateErrors, ThrowOnError>({ | | 6178 | + url: "/api/pty", | | 6179 | + ...options, | | 6180 | + ...params, | | 6181 | + headers: { | | 6182 | + "Content-Type": "application/json", | | 6183 | + ...options?.headers, | | 6184 | + ...params.headers, | | 6185 | + }, | | 6186 | + }) | | 6187 | + } | | 6188 | + | | 6189 | + /** | | 6190 | + * Remove PTY session | | 6191 | + * | | 6192 | + * Terminate and remove one PTY session. | | 6193 | + */ | | 6194 | + public remove<ThrowOnError extends boolean = false>( | | 6195 | + parameters: { | | 6196 | + ptyID: string | | 6197 | + location?: { | | 6198 | + directory?: string | | 6199 | + workspace?: string | | 6200 | + } | | 6201 | + }, | | 6202 | + options?: Options<never, ThrowOnError>, | | 6203 | + ) { | | 6204 | + const params = buildClientParams( | | 6205 | + [parameters], | | 6206 | + [ | | 6207 | + { | | 6208 | + args: [ | | 6209 | + { in: "path", key: "ptyID" }, | | 6210 | + { in: "query", key: "location" }, | | 6211 | + ], | | 6212 | + }, | | 6213 | + ], | | 6214 | + ) | | 6215 | + return (options?.client ?? this.client).delete<V2PtyRemoveResponses, V2PtyRemoveErrors, ThrowOnError>({ | | 6216 | + url: "/api/pty/{ptyID}", | | 6217 | + ...options, | | 6218 | + ...params, | | 6219 | + }) | | 6220 | + } | | 6221 | + | | 6222 | + /** | | 6223 | + * Get PTY session | | 6224 | + * | | 6225 | + * Get one PTY session, including its exit code once exited. | | 6226 | + */ | | 6227 | + public get<ThrowOnError extends boolean = false>( | | 6228 | + parameters: { | | 6229 | + ptyID: string | | 6230 | + location?: { | | 6231 | + directory?: string | | 6232 | + workspace?: string | | 6233 | + } | | 6234 | + }, | | 6235 | + options?: Options<never, ThrowOnError>, | | 6236 | + ) { | | 6237 | + const params = buildClientParams( | | 6238 | + [parameters], | | 6239 | + [ | | 6240 | + { | | 6241 | + args: [ | | 6242 | + { in: "path", key: "ptyID" }, | | 6243 | + { in: "query", key: "location" }, | | 6244 | + ], | | 6245 | + }, | | 6246 | + ], | | 6247 | + ) | | 6248 | + return (options?.client ?? this.client).get<V2PtyGetResponses, V2PtyGetErrors, ThrowOnError>({ | | 6249 | + url: "/api/pty/{ptyID}", | | 6250 | + ...options, | | 6251 | + ...params, | | 6252 | + }) | | 6253 | + } | | 6254 | + | | 6255 | + /** | | 6256 | + * Update PTY session | | 6257 | + * | | 6258 | + * Update the title or viewport size of one PTY session. | | 6259 | + */ | | 6260 | + public update<ThrowOnError extends boolean = false>( | | 6261 | + parameters: { | | 6262 | + ptyID: string | | 6263 | + location?: { | | 6264 | + directory?: string | | 6265 | + workspace?: string | | 6266 | + } | | 6267 | + title?: string | | 6268 | + size?: { | | 6269 | + rows: number | | 6270 | + cols: number | | 6271 | + } | | 6272 | + }, | | 6273 | + options?: Options<never, ThrowOnError>, | | 6274 | + ) { | | 6275 | + const params = buildClientParams( | | 6276 | + [parameters], | | 6277 | + [ | | 6278 | + { | | 6279 | + args: [ | | 6280 | + { in: "path", key: "ptyID" }, | | 6281 | + { in: "query", key: "location" }, | | 6282 | + { in: "body", key: "title" }, | | 6283 | + { in: "body", key: "size" }, | | 6284 | + ], | | 6285 | + }, | | 6286 | + ], | | 6287 | + ) | | 6288 | + return (options?.client ?? this.client).put<V2PtyUpdateResponses, V2PtyUpdateErrors, ThrowOnError>({ | | 6289 | + url: "/api/pty/{ptyID}", | | 6290 | + ...options, | | 6291 | + ...params, | | 6292 | + headers: { | | 6293 | + "Content-Type": "application/json", | | 6294 | + ...options?.headers, | | 6295 | + ...params.headers, | | 6296 | + }, | | 6297 | + }) | | 6298 | + } | | 6299 | + | | 6300 | + /** | | 6301 | + * Create PTY WebSocket token | | 6302 | + * | | 6303 | + * Create a short-lived single-use ticket for opening a PTY WebSocket connection. | | 6304 | + */ | | 6305 | + public connectToken<ThrowOnError extends boolean = false>( | | 6306 | + parameters: { | | 6307 | + ptyID: string | | 6308 | + location?: { | | 6309 | + directory?: string | | 6310 | + workspace?: string | | 6311 | + } | | 6312 | + }, | | 6313 | + options?: Options<never, ThrowOnError>, | | 6314 | + ) { | | 6315 | + const params = buildClientParams( | | 6316 | + [parameters], | | 6317 | + [ | | 6318 | + { | | 6319 | + args: [ | | 6320 | + { in: "path", key: "ptyID" }, | | 6321 | + { in: "query", key: "location" }, | | 6322 | + ], | | 6323 | + }, | | 6324 | + ], | | 6325 | + ) | | 6326 | + return (options?.client ?? this.client).post<V2PtyConnectTokenResponses, V2PtyConnectTokenErrors, ThrowOnError>({ | | 6327 | + url: "/api/pty/{ptyID}/connect-token", | | 6328 | + ...options, | | 6329 | + ...params, | | 6330 | + }) | | 6331 | + } | | 6332 | + | | 6333 | + /** | | 6334 | + * Connect to PTY session | | 6335 | + * | | 6336 | + * Establish a WebSocket connection streaming PTY output and accepting terminal input. | | 6337 | + */ | | 6338 | + public connect<ThrowOnError extends boolean = false>( | | 6339 | + parameters: { | | 6340 | + ptyID: string | | 6341 | + "location[directory]"?: string | | 6342 | + "location[workspace]"?: string | | 6343 | + cursor?: string | | 6344 | + ticket?: string | | 6345 | + }, | | 6346 | + options?: Options<never, ThrowOnError>, | | 6347 | + ) { | | 6348 | + const params = buildClientParams( | | 6349 | + [parameters], | | 6350 | + [ | | 6351 | + { | | 6352 | + args: [ | | 6353 | + { in: "path", key: "ptyID" }, | | 6354 | + { in: "query", key: "location[directory]" }, | | 6355 | + { in: "query", key: "location[workspace]" }, | | 6356 | + { in: "query", key: "cursor" }, | | 6357 | + { in: "query", key: "ticket" }, | | 6358 | + ], | | 6359 | + }, | | 6360 | + ], | | 6361 | + ) | | 6362 | + return (options?.client ?? this.client).get<V2PtyConnectResponses, V2PtyConnectErrors, ThrowOnError>({ | | 6363 | + url: "/api/pty/{ptyID}/connect", | | 6364 | + ...options, | | 6365 | + ...params, | | 6366 | + }) | | 6367 | + } | | 6368 | +} | | 6369 | + | 6104 | 6370 | export class Request2 extends HeyApiClient { | 6105 | 6371 | /** | 6106 | 6372 | * List pending question requests | @@ -6342,6 +6608,11 @@ export class V2 extends HeyApiClient { | 6342 | 6608 | return (this._event ??= new Event2({ client: this.client })) | 6343 | 6609 | } | 6344 | 6610 |
| | 6611 | + private _pty?: Pty2 | | 6612 | + get pty(): Pty2 { | | 6613 | + return (this._pty ??= new Pty2({ client: this.client })) | | 6614 | + } | | 6615 | + | 6345 | 6616 | private _question?: Question3 | 6346 | 6617 | get question(): Question3 { | 6347 | 6618 | return (this._question ??= new Question3({ client: this.client })) | |
|