refactor(provider): flow branded ProviderID/ModelID through internal signatures (#17182)

This commit is contained in:
Kit Langton
2026-03-12 10:48:17 -04:00
committed by GitHub
parent a4f8d66a9b
commit 1cb7df7159
24 changed files with 227 additions and 205 deletions

View File

@@ -91,7 +91,7 @@ export namespace Pty {
}
const state = Instance.state(
() => new Map<string, ActiveSession>(),
() => new Map<PtyID, ActiveSession>(),
async (sessions) => {
for (const session of sessions.values()) {
try {
@@ -113,7 +113,7 @@ export namespace Pty {
return Array.from(state().values()).map((s) => s.info)
}
export function get(id: string) {
export function get(id: PtyID) {
return state().get(id)?.info
}
@@ -205,7 +205,7 @@ export namespace Pty {
return info
}
export async function update(id: string, input: UpdateInput) {
export async function update(id: PtyID, input: UpdateInput) {
const session = state().get(id)
if (!session) return
if (input.title) {
@@ -218,7 +218,7 @@ export namespace Pty {
return session.info
}
export async function remove(id: string) {
export async function remove(id: PtyID) {
const session = state().get(id)
if (!session) return
state().delete(id)
@@ -237,21 +237,21 @@ export namespace Pty {
Bus.publish(Event.Deleted, { id: session.info.id })
}
export function resize(id: string, cols: number, rows: number) {
export function resize(id: PtyID, cols: number, rows: number) {
const session = state().get(id)
if (session && session.info.status === "running") {
session.process.resize(cols, rows)
}
}
export function write(id: string, data: string) {
export function write(id: PtyID, data: string) {
const session = state().get(id)
if (session && session.info.status === "running") {
session.process.write(data)
}
}
export function connect(id: string, ws: Socket, cursor?: number) {
export function connect(id: PtyID, ws: Socket, cursor?: number) {
const session = state().get(id)
if (!session) {
ws.close()