mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 00:03:52 +00:00
* chore(dead-code): drop 2k lines of unreachable exports and orphan modules Ran knip across every build entry (main, preload, renderer, popout, web, cli, relay, workers, forked sidecars, config scripts) and removed what no entry graph can reach. - 11 orphan modules nothing imported, plus one test that only covered them - 159 unused exports/types, with their now-dead helpers, imports and tests Each candidate was verified against dynamic references before deletion. 42 knip hits were false positives and are kept: shared modules consumed by the mobile/ workspace, the src/shared/plugins/** public API, vendored shadcn primitives, and relay wire-protocol constants held for compatibility. Adds knip.json + `pnpm audit:dead-code` so this stays measurable. Verified: pnpm typecheck, pnpm lint, and 2081 tests across the 73 affected test files all pass. * chore(dead-code): move knip config under config/ Root-level additions are blocked by the root directory guard. Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
90 lines
2.3 KiB
TypeScript
90 lines
2.3 KiB
TypeScript
export const DEFAULT_PTY_SOURCE_WINDOW_SU = 256 * 1024
|
|
export const MAX_PTY_ACK_ENTRIES = 64
|
|
|
|
export type PtySourceDeliveryIdentity = Readonly<{
|
|
id: string
|
|
providerGeneration: number
|
|
clientGeneration: number
|
|
ownerGeneration: number
|
|
ptyIncarnation: string
|
|
deliveryToken: string
|
|
}>
|
|
|
|
export type PtySourceTransform = Readonly<{
|
|
transformed: boolean
|
|
rawLengthSu: number
|
|
scalarSafe: boolean
|
|
}>
|
|
|
|
export type PtySourceSpan = PtySourceDeliveryIdentity &
|
|
Readonly<{
|
|
spanId: string
|
|
sourceStartSu: number
|
|
sourceEndSu: number
|
|
displayStart: number
|
|
displayEnd: number
|
|
data: string
|
|
splittable?: boolean
|
|
indivisible?: boolean
|
|
transform: PtySourceTransform
|
|
}>
|
|
|
|
export type PtySourceCreditAck = Readonly<{
|
|
id: string
|
|
clientGeneration: number
|
|
ownerGeneration: number
|
|
deliveryToken: string
|
|
creditedEndSu: number
|
|
}>
|
|
|
|
export type PtySourceCreditAckBatch = Readonly<{
|
|
acknowledgements: readonly PtySourceCreditAck[]
|
|
}>
|
|
|
|
export type PtySourceDeliveryCancellation = PtySourceDeliveryIdentity &
|
|
Readonly<{
|
|
reason: string
|
|
sentEndSu: number
|
|
creditedEndSu: number
|
|
remainingStartSu: number
|
|
remainingEndSu: number
|
|
replacementDeliveryToken?: string
|
|
}>
|
|
|
|
export type PtySourceDeliverySnapshot = PtySourceDeliveryIdentity &
|
|
Readonly<{
|
|
state: 'active' | 'sealed-unsettled' | 'closing' | 'closed'
|
|
windowSu: number
|
|
receivedEndSu: number
|
|
sentEndSu: number
|
|
creditedEndSu: number
|
|
exitPublished: boolean
|
|
generationClosed: boolean
|
|
}>
|
|
|
|
export function ptySourceDeliveryKey(
|
|
identity: Pick<PtySourceDeliveryIdentity, 'providerGeneration' | 'deliveryToken'>
|
|
): string {
|
|
return `${identity.providerGeneration}\0${identity.deliveryToken}`
|
|
}
|
|
|
|
export function samePtySourceDelivery(
|
|
left: PtySourceDeliveryIdentity,
|
|
right: PtySourceDeliveryIdentity
|
|
): boolean {
|
|
return (
|
|
left.id === right.id &&
|
|
left.providerGeneration === right.providerGeneration &&
|
|
left.clientGeneration === right.clientGeneration &&
|
|
left.ownerGeneration === right.ownerGeneration &&
|
|
left.ptyIncarnation === right.ptyIncarnation &&
|
|
left.deliveryToken === right.deliveryToken
|
|
)
|
|
}
|
|
|
|
export function ptySourceSpanIsSplittable(
|
|
span: Pick<PtySourceSpan, 'splittable' | 'indivisible'>
|
|
): boolean {
|
|
return span.splittable ?? (span.indivisible !== undefined ? !span.indivisible : false)
|
|
}
|