Skip to content

Commit 9f708e7

Browse files
chore: generate
1 parent 7bc26da commit 9f708e7

3 files changed

Lines changed: 110 additions & 4 deletions

File tree

packages/opencode/src/pty/ticket.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export interface Interface {
2828
export class Service extends Context.Service<Service, Interface>()("@opencode/PtyTicket") {}
2929

3030
function matches(record: Scope, input: Scope) {
31-
return record.ptyID === input.ptyID && record.directory === input.directory && record.workspaceID === input.workspaceID
31+
return (
32+
record.ptyID === input.ptyID && record.directory === input.directory && record.workspaceID === input.workspaceID
33+
)
3234
}
3335

3436
// Tickets are inserted via Cache.set and removed atomically via invalidateWhen. The lookup is

packages/opencode/test/pty/ticket.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ describe("PTY websocket tickets", () => {
2626
const ptyID = PtyID.ascending()
2727
const issued = yield* tickets.issue({ ptyID, directory: "/tmp/a" })
2828

29-
expect(
30-
yield* tickets.consume({ ptyID, directory: "/tmp/b", ticket: issued.ticket }),
31-
).toBe(false)
29+
expect(yield* tickets.consume({ ptyID, directory: "/tmp/b", ticket: issued.ticket })).toBe(false)
3230
expect(yield* tickets.consume({ ptyID, directory: "/tmp/a", ticket: issued.ticket })).toBe(true)
3331
}),
3432
)

packages/sdk/openapi.json

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,6 +3414,91 @@
34143414
]
34153415
}
34163416
},
3417+
"/pty/{ptyID}/connect-token": {
3418+
"post": {
3419+
"tags": ["pty"],
3420+
"operationId": "pty.connectToken",
3421+
"parameters": [
3422+
{
3423+
"name": "directory",
3424+
"in": "query",
3425+
"required": false,
3426+
"schema": {
3427+
"type": "string"
3428+
}
3429+
},
3430+
{
3431+
"name": "workspace",
3432+
"in": "query",
3433+
"required": false,
3434+
"schema": {
3435+
"type": "string"
3436+
}
3437+
},
3438+
{
3439+
"name": "ptyID",
3440+
"in": "path",
3441+
"schema": {
3442+
"type": "string",
3443+
"pattern": "^pty.*"
3444+
},
3445+
"required": true
3446+
}
3447+
],
3448+
"responses": {
3449+
"200": {
3450+
"description": "WebSocket connect token",
3451+
"content": {
3452+
"application/json": {
3453+
"schema": {
3454+
"type": "object",
3455+
"properties": {
3456+
"ticket": {
3457+
"type": "string"
3458+
},
3459+
"expires_in": {
3460+
"type": "integer",
3461+
"exclusiveMinimum": 0
3462+
}
3463+
},
3464+
"required": ["ticket", "expires_in"],
3465+
"additionalProperties": false,
3466+
"description": "WebSocket connect token"
3467+
}
3468+
}
3469+
}
3470+
},
3471+
"403": {
3472+
"description": "Forbidden",
3473+
"content": {
3474+
"application/json": {
3475+
"schema": {
3476+
"$ref": "#/components/schemas/effect_HttpApiError_Forbidden"
3477+
}
3478+
}
3479+
}
3480+
},
3481+
"404": {
3482+
"description": "Not found",
3483+
"content": {
3484+
"application/json": {
3485+
"schema": {
3486+
"$ref": "#/components/schemas/NotFoundError"
3487+
}
3488+
}
3489+
}
3490+
}
3491+
},
3492+
"description": "Create a short-lived ticket for opening a PTY WebSocket connection.",
3493+
"summary": "Create PTY WebSocket token",
3494+
"x-codeSamples": [
3495+
{
3496+
"lang": "js",
3497+
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.connectToken({\n ...\n})"
3498+
}
3499+
]
3500+
}
3501+
},
34173502
"/question": {
34183503
"get": {
34193504
"tags": ["question"],
@@ -8327,6 +8412,16 @@
83278412
}
83288413
}
83298414
},
8415+
"403": {
8416+
"description": "Forbidden",
8417+
"content": {
8418+
"application/json": {
8419+
"schema": {
8420+
"$ref": "#/components/schemas/effect_HttpApiError_Forbidden"
8421+
}
8422+
}
8423+
}
8424+
},
83308425
"404": {
83318426
"description": "Not found",
83328427
"content": {
@@ -12752,6 +12847,17 @@
1275212847
"required": ["error"],
1275312848
"additionalProperties": false
1275412849
},
12850+
"effect_HttpApiError_Forbidden": {
12851+
"type": "object",
12852+
"properties": {
12853+
"_tag": {
12854+
"type": "string",
12855+
"enum": ["Forbidden"]
12856+
}
12857+
},
12858+
"required": ["_tag"],
12859+
"additionalProperties": false
12860+
},
1275512861
"ProviderAuthMethod": {
1275612862
"type": "object",
1275712863
"properties": {

0 commit comments

Comments
 (0)