mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-02 07:03:45 +00:00
refactor(provider): flow branded ProviderID/ModelID through internal signatures (#17182)
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user