mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-13 12:13:42 +01:00
The app held every flow in memory and redid all of its work for each new one: the sidebar mounted every domain and path node (its tree scrolled inside a container that never bounded it), every tree row looked up its atoms by scanning every atom the family had made, and the layout, detail pane and list rows re-rendered per flow. At 3,000 flows each new one cost about 90 ms of main thread, more than the traffic left time for. The app now holds a window of the newest 2,000 flows, applies new ones in batches, and loads older ones in pages from the database on scrolling to the top, through a new list_flows RPC that pages in SQL. The database keeps every flow. Also adds clear_flows: an RPC, POST /flows/clear on the control API, and a Clear button in the header that Cmd+K opens, confirming first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
156 lines
4.7 KiB
TypeScript
Generated
156 lines
4.7 KiB
TypeScript
Generated
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
import type { Flow, FlowBody, ModelPayload } from "./gen_models";
|
|
|
|
export type ActionInvocation = { "scope": "global", action: GlobalAction, };
|
|
|
|
export type ActionMetadata = { label: string, defaultHotkey: string | null, };
|
|
|
|
export type CaStatus = {
|
|
/**
|
|
* macOS trusts this app's CA, so HTTPS flows can be decrypted.
|
|
*/
|
|
trusted: boolean,
|
|
/**
|
|
* A certificate named "Yaak Proxy CA" is in a keychain: this one, or an older one.
|
|
*/
|
|
installed: boolean, certPath: string, };
|
|
|
|
export type CaStatusRequest = Record<string, never>;
|
|
|
|
export type CaTrustRequest = Record<string, never>;
|
|
|
|
export type ClearFlowsRequest = Record<string, never>;
|
|
|
|
export type FilterBodyRequest = { flowId: string, which: FlowBody,
|
|
/**
|
|
* JSONPath, or XPath for an XML or HTML body.
|
|
*/
|
|
expression: string,
|
|
/**
|
|
* The language the viewer detected from the body. Without it, the Content-Type decides.
|
|
*/
|
|
language?: FilterLanguage, };
|
|
|
|
export type FilterBodyResponse = { content: string, error: string | null, };
|
|
|
|
export type FilterLanguage = "jsonpath" | "xpath";
|
|
|
|
/**
|
|
* Which flows a listing or a HAR export covers. Every field narrows it; none is all of them.
|
|
*/
|
|
export type FlowFilter = {
|
|
/**
|
|
* Part of the host, any case: `stripe` matches `api.stripe.com`.
|
|
*/
|
|
host?: string,
|
|
/**
|
|
* The method, any case.
|
|
*/
|
|
method?: string,
|
|
/**
|
|
* A status (`404`), a class of them (`4xx`), or `error` for flows that failed.
|
|
*/
|
|
status?: string,
|
|
/**
|
|
* At most this many flows, the newest.
|
|
*/
|
|
limit?: number,
|
|
/**
|
|
* Only flows recorded after the flow with this id, for following new traffic. Flows are
|
|
* recorded when they end, so a slow one that started earlier still comes through.
|
|
*/
|
|
after?: string,
|
|
/**
|
|
* Only flows older than the flow with this id, by start and then id, for paging back
|
|
* through older traffic.
|
|
*/
|
|
before?: string, };
|
|
|
|
export type FlowsClearedPayload = Record<string, never>;
|
|
|
|
export type FormatBodyRequest = { text: string, };
|
|
|
|
export type GetFlowBodyRequest = { flowId: string, which: FlowBody, };
|
|
|
|
export type GetFlowBodyResponse = {
|
|
/**
|
|
* The body decoded with its Content-Encoding, at most the capture limit of it, in base64.
|
|
*/
|
|
data: string,
|
|
/**
|
|
* The body is incomplete: cut on the wire, or decoded past the capture limit.
|
|
*/
|
|
truncated: boolean,
|
|
/**
|
|
* Bytes stored for the body, as they were on the wire.
|
|
*/
|
|
storedSize: number, };
|
|
|
|
export type GetProxyStateRequest = Record<string, never>;
|
|
|
|
export type GetProxyStateResponse = { state: ProxyState,
|
|
/**
|
|
* The port the engine is bound to, while it runs.
|
|
*/
|
|
port: number | null, };
|
|
|
|
export type GlobalAction = "proxy_start" | "proxy_stop" | "flows_clear";
|
|
|
|
export type ListActionsRequest = Record<string, never>;
|
|
|
|
export type ListActionsResponse = { actions: Array<[ActionInvocation, ActionMetadata]>, };
|
|
|
|
export type ListFlowsResponse = {
|
|
/**
|
|
* Newest first.
|
|
*/
|
|
flows: Array<Flow>,
|
|
/**
|
|
* Flows in the database, whatever the filter.
|
|
*/
|
|
total: number, };
|
|
|
|
/**
|
|
* The process that runs the engine.
|
|
*/
|
|
export type Owner = "app" | "cli";
|
|
|
|
export type ProxySetting = { enabled: boolean, server: string, port: number, };
|
|
|
|
export type ProxyState = "running" | "stopped";
|
|
|
|
export type ProxyStatePayload = { state: ProxyState, };
|
|
|
|
export type RpcEventSchema = { flows_cleared: FlowsClearedPayload, model_write: ModelPayload, proxy_state_changed: ProxyStatePayload, };
|
|
|
|
export type RpcSchema = { execute_action: [ActionInvocation, boolean], format_body: [FormatBodyRequest, string], get_proxy_state: [GetProxyStateRequest, GetProxyStateResponse], list_actions: [ListActionsRequest, ListActionsResponse], list_flows: [FlowFilter, ListFlowsResponse], ca_status: [CaStatusRequest, CaStatus], ca_trust: [CaTrustRequest, CaStatus], clear_flows: [ClearFlowsRequest, number], filter_body: [FilterBodyRequest, FilterBodyResponse], get_flow_body: [GetFlowBodyRequest, GetFlowBodyResponse], system_proxy_set: [SystemProxySetRequest, SystemProxyStatus], system_proxy_status: [SystemProxyStatusRequest, SystemProxyStatus], };
|
|
|
|
export type ServiceProxy = {
|
|
/**
|
|
* The network service, as System Settings names it: "Wi-Fi", "USB 10/100/1000 LAN".
|
|
*/
|
|
name: string, http: ProxySetting, https: ProxySetting, };
|
|
|
|
/**
|
|
* How a change gets administrator rights.
|
|
*/
|
|
export type SystemProxyBackend = "helper" | "admin_prompt" | "sudo";
|
|
|
|
export type SystemProxySetRequest = { enabled: boolean, };
|
|
|
|
export type SystemProxyStatus = {
|
|
/**
|
|
* Every enabled network service sends HTTP and HTTPS to `127.0.0.1:<port>`.
|
|
*/
|
|
enabled: boolean,
|
|
/**
|
|
* The port checked against.
|
|
*/
|
|
port: number, services: Array<ServiceProxy>, backend: SystemProxyBackend,
|
|
/**
|
|
* This platform has a system proxy the app can set.
|
|
*/
|
|
supported: boolean, };
|
|
|
|
export type SystemProxyStatusRequest = Record<string, never>;
|