chore: generate
This commit is contained in:
@@ -28,7 +28,9 @@ export interface Interface {
|
|||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/PtyTicket") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/PtyTicket") {}
|
||||||
|
|
||||||
function matches(record: Scope, input: Scope) {
|
function matches(record: Scope, input: Scope) {
|
||||||
return record.ptyID === input.ptyID && record.directory === input.directory && record.workspaceID === input.workspaceID
|
return (
|
||||||
|
record.ptyID === input.ptyID && record.directory === input.directory && record.workspaceID === input.workspaceID
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tickets are inserted via Cache.set and removed atomically via invalidateWhen. The lookup is
|
// Tickets are inserted via Cache.set and removed atomically via invalidateWhen. The lookup is
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ describe("PTY websocket tickets", () => {
|
|||||||
const ptyID = PtyID.ascending()
|
const ptyID = PtyID.ascending()
|
||||||
const issued = yield* tickets.issue({ ptyID, directory: "/tmp/a" })
|
const issued = yield* tickets.issue({ ptyID, directory: "/tmp/a" })
|
||||||
|
|
||||||
expect(
|
expect(yield* tickets.consume({ ptyID, directory: "/tmp/b", ticket: issued.ticket })).toBe(false)
|
||||||
yield* tickets.consume({ ptyID, directory: "/tmp/b", ticket: issued.ticket }),
|
|
||||||
).toBe(false)
|
|
||||||
expect(yield* tickets.consume({ ptyID, directory: "/tmp/a", ticket: issued.ticket })).toBe(true)
|
expect(yield* tickets.consume({ ptyID, directory: "/tmp/a", ticket: issued.ticket })).toBe(true)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3414,6 +3414,91 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/pty/{ptyID}/connect-token": {
|
||||||
|
"post": {
|
||||||
|
"tags": ["pty"],
|
||||||
|
"operationId": "pty.connectToken",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "directory",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "workspace",
|
||||||
|
"in": "query",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ptyID",
|
||||||
|
"in": "path",
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"pattern": "^pty.*"
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "WebSocket connect token",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"ticket": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"expires_in": {
|
||||||
|
"type": "integer",
|
||||||
|
"exclusiveMinimum": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["ticket", "expires_in"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "WebSocket connect token"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "Forbidden",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/effect_HttpApiError_Forbidden"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Not found",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/NotFoundError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "Create a short-lived ticket for opening a PTY WebSocket connection.",
|
||||||
|
"summary": "Create PTY WebSocket token",
|
||||||
|
"x-codeSamples": [
|
||||||
|
{
|
||||||
|
"lang": "js",
|
||||||
|
"source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.pty.connectToken({\n ...\n})"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/question": {
|
"/question": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": ["question"],
|
"tags": ["question"],
|
||||||
@@ -8327,6 +8412,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"403": {
|
||||||
|
"description": "Forbidden",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/effect_HttpApiError_Forbidden"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"404": {
|
"404": {
|
||||||
"description": "Not found",
|
"description": "Not found",
|
||||||
"content": {
|
"content": {
|
||||||
@@ -12752,6 +12847,17 @@
|
|||||||
"required": ["error"],
|
"required": ["error"],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
|
"effect_HttpApiError_Forbidden": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"_tag": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["Forbidden"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["_tag"],
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
"ProviderAuthMethod": {
|
"ProviderAuthMethod": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
Reference in New Issue
Block a user