agent-shim 8.7.0 → 8.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cli.cjs +6077 -2159
- package/dist/index.cjs +3723 -3040
- package/dist/index.mjs +3706 -3045
- package/dist/types/index.d.ts +601 -79
- package/package.json +3 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import * as zod from 'zod';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
|
|
3
4
|
import * as net from 'node:net';
|
|
4
5
|
import { Duplex } from 'node:stream';
|
|
6
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
7
|
+
import * as _orpc_server from '@orpc/server';
|
|
8
|
+
import { RouterClient } from '@orpc/server';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* Every category a `~/.claude` entry can be classified into. `secret` is deliberately part of this list — it is a real classification the resolver acts on — but it is NOT part of `CategoryMapSchema`'s shape, because no configuration layer may ever toggle it. See OVERRIDABLE_CATEGORIES.
|
|
@@ -1602,6 +1606,44 @@ declare function realConnectCertStore(paths: {
|
|
|
1602
1606
|
readonly frontdoorCaKeyFile: string;
|
|
1603
1607
|
}): ConnectCertStore;
|
|
1604
1608
|
|
|
1609
|
+
/**
|
|
1610
|
+
* The Zod schemas of the Remote Control surfaces: one definition each for the summaries, statuses and pending lists the tracker produces, the stream events the door's client attachment fans out, and every input and output the typed API accepts. The tracker's own TypeScript interfaces in `rcSessions.ts` stay the implementations' types; these schemas are what the oRPC contract validates through, and because the procedures wrap the very operations that produce those interfaces' values, a drift between a schema and its interface fails the API's own output validation (exercised by its tests) rather than shipping silently. This module deliberately imports nothing from oRPC: it is a plain Zod leaf, so the tracker and the stream half can share it without either depending on the API layer.
|
|
1611
|
+
*/
|
|
1612
|
+
/** The permission modes the SDK's own `set_permission_mode` control request accepts, as the input schema of the set-permission-mode operation and the subscribe-free vocabulary every surface narrows untrusted strings through. */
|
|
1613
|
+
declare const RcPermissionModeSchema: z.ZodEnum<{
|
|
1614
|
+
default: "default";
|
|
1615
|
+
acceptEdits: "acceptEdits";
|
|
1616
|
+
bypassPermissions: "bypassPermissions";
|
|
1617
|
+
plan: "plan";
|
|
1618
|
+
dontAsk: "dontAsk";
|
|
1619
|
+
auto: "auto";
|
|
1620
|
+
}>;
|
|
1621
|
+
/** One event off the client read stream, exactly as the door forwards it to subscribers: the envelope the API host sent, with the fields the door itself relies on typed and the rest (the payload above all) carried verbatim for the consumer to narrow. */
|
|
1622
|
+
declare const RcStreamEnvelopeSchema: z.ZodObject<{
|
|
1623
|
+
event_id: z.ZodOptional<z.ZodString>;
|
|
1624
|
+
event_type: z.ZodString;
|
|
1625
|
+
sequence_num: z.ZodInt;
|
|
1626
|
+
source: z.ZodString;
|
|
1627
|
+
payload: z.ZodOptional<z.ZodUnknown>;
|
|
1628
|
+
created_at: z.ZodOptional<z.ZodUnknown>;
|
|
1629
|
+
}, z.core.$loose>;
|
|
1630
|
+
/** One fan-out event: the session the stream it rode belongs to, beside the envelope itself. */
|
|
1631
|
+
declare const RcStreamEventSchema: z.ZodObject<{
|
|
1632
|
+
session: z.ZodString;
|
|
1633
|
+
envelope: z.ZodObject<{
|
|
1634
|
+
event_id: z.ZodOptional<z.ZodString>;
|
|
1635
|
+
event_type: z.ZodString;
|
|
1636
|
+
sequence_num: z.ZodInt;
|
|
1637
|
+
source: z.ZodString;
|
|
1638
|
+
payload: z.ZodOptional<z.ZodUnknown>;
|
|
1639
|
+
created_at: z.ZodOptional<z.ZodUnknown>;
|
|
1640
|
+
}, z.core.$loose>;
|
|
1641
|
+
}, z.core.$strict>;
|
|
1642
|
+
/** One event off the client read stream, as the TypeScript every in-process consumer of the fan-out handles it (the schema's own inferred type, so the two cannot drift). */
|
|
1643
|
+
type RcStreamEnvelope = z.output<typeof RcStreamEnvelopeSchema>;
|
|
1644
|
+
/** One fan-out event, as the TypeScript every in-process consumer handles it. */
|
|
1645
|
+
type RcStreamEvent = z.output<typeof RcStreamEventSchema>;
|
|
1646
|
+
|
|
1605
1647
|
/** What the identity step learned about one request from the launcher-injected headers. */
|
|
1606
1648
|
interface SessionIdentity {
|
|
1607
1649
|
/** The identity name the launch resolved, when it resolved one. */
|
|
@@ -1750,6 +1792,14 @@ interface RcSessionTracker {
|
|
|
1750
1792
|
readonly pendingOf: (sessionId?: string) => readonly RcPendingRequestSummary[];
|
|
1751
1793
|
/** The observed credential and protocol headers for one session, the client-half writes' accessor: present only while the session is tracked, and never surfaced anywhere a summary, log or capture goes. */
|
|
1752
1794
|
readonly credentialOf: (sessionId: string) => RcObservedCredential | undefined;
|
|
1795
|
+
/** Advances the session's sequence cursor to the highest number named, which every confirmed client-half write calls with the numbers the real service assigned its events. */
|
|
1796
|
+
readonly noteSequenceNums: (sessionId: string, sequenceNums: readonly number[]) => void;
|
|
1797
|
+
/** The session's sequence cursor: the highest number the door has seen, from the client read stream's envelopes or from its own confirmed writes; undefined while neither has been seen. */
|
|
1798
|
+
readonly sequenceNumOf: (sessionId: string) => number | undefined;
|
|
1799
|
+
/**
|
|
1800
|
+
* Files one client read stream envelope: advances the session's sequence cursor, and treats the payload exactly as an observed event-batch body's would be treated, which is how an approval reaches the pending list from the stream (the live finding behind the client attachment: the CLI routes `control_request`s only toward attached clients, so the stream, not the worker's own writes, is where a `can_use_tool` the door must answer becomes visible). A `control_request` whose envelope names the worker as its source births a pending entry; a `control_response` retires the request it answers, whoever answered it.
|
|
1801
|
+
*/
|
|
1802
|
+
readonly fileStreamEvent: (sessionId: string, event: RcStreamEnvelope) => void;
|
|
1753
1803
|
/** Retires one pending control request as answered: what a successful answer write calls, so the request stops being listed the moment it is answered. */
|
|
1754
1804
|
readonly completePending: (sessionId: string, requestId: string) => void;
|
|
1755
1805
|
/** Stops the idle sweep timer. The entries themselves are unreachable the moment the door drops them. */
|
|
@@ -1759,8 +1809,12 @@ interface RcSessionTracker {
|
|
|
1759
1809
|
declare function createRcSessionTracker(deps: RcSessionTrackerDeps): RcSessionTracker;
|
|
1760
1810
|
/**
|
|
1761
1811
|
* Wraps one route so the tracker sees every exchange the route serves: the request's facts are handed over first, and when they are Remote Control facts the request's body chunks and the response the route writes are teed to the tracker's observer while flowing on unchanged. Used on the door's route resolution, so the bare `/v1/` pass-through an OAuth session's Remote Control calls ride is where observation happens.
|
|
1812
|
+
*
|
|
1813
|
+
* `onExchangeSettled`, when given, is called once the exchange's response has ended and the observer has filed whatever it filed: it is where the door re-pokes the client stream attachment, so a session becomes attached the moment its create's own response completes rather than at whatever exchange happens to follow.
|
|
1762
1814
|
*/
|
|
1763
|
-
declare function observingRoutedRoute(route: FrontDoorRoute, tracker: RcSessionTracker
|
|
1815
|
+
declare function observingRoutedRoute(route: FrontDoorRoute, tracker: RcSessionTracker, hooks?: {
|
|
1816
|
+
readonly onExchangeSettled?: () => void;
|
|
1817
|
+
}): FrontDoorRoute;
|
|
1764
1818
|
/** Adapts the tracker's exchange observer to the passthrough forwarding's observer shape, so the connect test world (which forwards rather than routes) observes through the same tracker. */
|
|
1765
1819
|
declare function rcObserverAsPassthrough(observer: RcExchangeObserver): PassthroughObserver;
|
|
1766
1820
|
/**
|
|
@@ -1800,6 +1854,8 @@ type RcObservedCredential = RcWriteHeaders;
|
|
|
1800
1854
|
interface RcInjectDeps {
|
|
1801
1855
|
/** Reads the observed credential for a session: the tracker's accessor, in production. */
|
|
1802
1856
|
readonly credentialOf: (sessionId: string) => RcObservedCredential | undefined;
|
|
1857
|
+
/** Advances the session's sequence cursor: the tracker's accessor, in production, so a delivered write's numbers are what a stream resume continues after. */
|
|
1858
|
+
readonly noteSequenceNums: (sessionId: string, sequenceNums: readonly number[]) => void;
|
|
1803
1859
|
/** The dial to the real API host. */
|
|
1804
1860
|
readonly dial: RcEventDial;
|
|
1805
1861
|
/** Mints the payload event's uuid: a v4 UUID or better in production. */
|
|
@@ -1847,6 +1903,8 @@ interface RcAnswerDeps {
|
|
|
1847
1903
|
readonly pendingOf: (sessionId: string) => readonly RcPendingRequestSummary[];
|
|
1848
1904
|
/** Retires a pending request as answered: the tracker's accessor, in production, called only once the write is confirmed delivered. */
|
|
1849
1905
|
readonly completePending: (sessionId: string, requestId: string) => void;
|
|
1906
|
+
/** Advances the session's sequence cursor: the tracker's accessor, in production, so a delivered write's numbers are what a stream resume continues after. */
|
|
1907
|
+
readonly noteSequenceNums: (sessionId: string, sequenceNums: readonly number[]) => void;
|
|
1850
1908
|
/** The dial to the real API host. */
|
|
1851
1909
|
readonly dial: RcEventDial;
|
|
1852
1910
|
}
|
|
@@ -1858,6 +1916,8 @@ declare function answerRcControlRequest(deps: RcAnswerDeps, sessionId: string, r
|
|
|
1858
1916
|
interface RcControlRequestDeps {
|
|
1859
1917
|
/** Reads the observed credential for a session: the tracker's accessor, in production. */
|
|
1860
1918
|
readonly credentialOf: (sessionId: string) => RcObservedCredential | undefined;
|
|
1919
|
+
/** Advances the session's sequence cursor: the tracker's accessor, in production, so a delivered write's numbers are what a stream resume continues after. */
|
|
1920
|
+
readonly noteSequenceNums: (sessionId: string, sequenceNums: readonly number[]) => void;
|
|
1861
1921
|
/** The dial to the real API host. */
|
|
1862
1922
|
readonly dial: RcEventDial;
|
|
1863
1923
|
/** Mints the request's id: a v4 UUID or better in production, the id the worker's `control_response` echoes. */
|
|
@@ -1876,6 +1936,88 @@ declare function setRcSessionModel(deps: RcControlRequestDeps, sessionId: string
|
|
|
1876
1936
|
*/
|
|
1877
1937
|
declare function setRcSessionPermissionMode(deps: RcControlRequestDeps, sessionId: string, mode: RcPermissionMode): Promise<RcEventWriteResult>;
|
|
1878
1938
|
|
|
1939
|
+
/**
|
|
1940
|
+
* How long a failed attachment backs off before retrying. Not a fresh number: it is the session's own liveness bound (`RC_IDLE_EXPIRY_MS`, the 45 s stream timeout the tracker's idle expiry already derives from), so an attachment that cannot be re-established retries at exactly the cadence the protocol itself gives up on a quiet session at. Production passes that constant; tests pass small values so a backoff is reached in milliseconds.
|
|
1941
|
+
*/
|
|
1942
|
+
declare const RC_STREAM_BACKOFF_MS = 45000;
|
|
1943
|
+
/** One event the SSE parser completed: the fields the wire's own framing carried, before any protocol interpretation. */
|
|
1944
|
+
interface SseParsedEvent {
|
|
1945
|
+
/** The `event:` field's value, when the block carried one; the protocol's own events always do. */
|
|
1946
|
+
readonly event: string | undefined;
|
|
1947
|
+
/** The `id:` field's value in force at dispatch (the most recent one the connection saw, per the SSE framing rules); on this stream it carries the event's sequence number. */
|
|
1948
|
+
readonly id: string | undefined;
|
|
1949
|
+
/** The `data:` lines joined with newlines, exactly as the SSE framing defines. */
|
|
1950
|
+
readonly data: string;
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* An incremental Server-Sent Events parser: feed it the stream's text chunks as they arrive and it returns the events each write completed. Chunks may split lines, fields and even a CRLF pair anywhere; the parser buffers until a line ending is certain, so a `\r` at a chunk's end waits for the byte that decides whether it is `\r\n`. Comments (`:`-prefixed lines, the protocol's 15 s keepalives) complete nothing, an event with no `data:` line dispatches nothing (the framing's own rule), and the `id:` value persists to the next dispatched event the same way, which is what carries the sequence number of an id-only block forward.
|
|
1954
|
+
*/
|
|
1955
|
+
declare function createSseParser(): {
|
|
1956
|
+
readonly write: (text: string) => readonly SseParsedEvent[];
|
|
1957
|
+
};
|
|
1958
|
+
/**
|
|
1959
|
+
* One parsed SSE event as the protocol's envelope, or undefined when the event is not a client event this half reads: a block under any other event name, or data that is not one JSON object carrying the fields the door relies on (`event_type`, `sequence_num`, `source`). An envelope the door cannot read is one it knows nothing about, never a failure: the stream stays up and the next event is read on its own merits.
|
|
1960
|
+
*/
|
|
1961
|
+
declare function parseRcStreamEnvelope(parsed: SseParsedEvent): RcStreamEnvelope | undefined;
|
|
1962
|
+
/** One answer from the API host the presence call dials: the status and the whole body. Presence answers one small JSON object, never a stream, so the body needs no cap of its own. */
|
|
1963
|
+
interface RcPresenceAnswer {
|
|
1964
|
+
readonly status: number;
|
|
1965
|
+
readonly body: string;
|
|
1966
|
+
}
|
|
1967
|
+
/** One answer from the API host the stream dial opens: the status and the body's chunks as they arrive. On a success the chunks are the live stream (consumed incrementally, never buffered); the production dial returns an already-drained empty iterable for any non-2xx answer, whose body is one small error document. */
|
|
1968
|
+
interface RcStreamAnswer {
|
|
1969
|
+
readonly status: number;
|
|
1970
|
+
readonly chunks: AsyncIterable<Uint8Array>;
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* The one network effect the client read stream performs, injected so the attachment logic runs against fakes: announce a client's presence, and open the read stream. Production dials the real API host over the door's interception-proof agent; tests redirect to a local stand-in. `resume` names the documented resume pair's value: present only when the door has seen events for the session already, it sends `from_sequence_num` as a query parameter and `Last-Event-ID` as a header together.
|
|
1974
|
+
*/
|
|
1975
|
+
interface RcStreamDial {
|
|
1976
|
+
readonly announcePresence: (sessionId: string, headers: Readonly<Record<string, string>>, clientId: string) => Promise<RcPresenceAnswer>;
|
|
1977
|
+
readonly openStream: (sessionId: string, headers: Readonly<Record<string, string>>, resume: {
|
|
1978
|
+
readonly fromSequenceNum: number;
|
|
1979
|
+
} | undefined, signal: AbortSignal) => Promise<RcStreamAnswer>;
|
|
1980
|
+
}
|
|
1981
|
+
/** The fan-out every stream event is handed to: the tracker files what it recognises, and each subscriber receives the event beside it. */
|
|
1982
|
+
interface RcEventFanout {
|
|
1983
|
+
/** Delivers one event to every subscriber listening for its session (or for every session), synchronously, in publication order. */
|
|
1984
|
+
readonly publish: (event: RcStreamEvent) => void;
|
|
1985
|
+
/** Adds one listener, told every event whose session it matches; `undefined` listens to every session. Returns the detach function. */
|
|
1986
|
+
readonly subscribe: (session: string | undefined, listener: (event: RcStreamEvent) => void) => () => void;
|
|
1987
|
+
}
|
|
1988
|
+
/** Creates the fan-out: plain synchronous listener sets, one per session plus one for every-session listeners. Delivery is synchronous so the tracker's filing (which rides the same publish) and every subscriber observe the same order; a subscriber that cannot keep up is bounded where it is bridged to a pull (the typed API's subscription), not here. */
|
|
1989
|
+
declare function createRcEventFanout(): RcEventFanout;
|
|
1990
|
+
/** Everything the attachment hub needs, injected so its decisions run against fakes in unit tests. */
|
|
1991
|
+
interface RcStreamHubDeps {
|
|
1992
|
+
readonly now: () => number;
|
|
1993
|
+
/** The tracker's credential accessor: the OAuth-kind bearer and protocol headers the attachment replays, exactly as the write path does. */
|
|
1994
|
+
readonly credentialOf: (sessionId: string) => RcObservedCredential | undefined;
|
|
1995
|
+
/** The tracker's swept session list: an attachment whose session has expired is dropped, exactly when the tracker itself gives up on it. */
|
|
1996
|
+
readonly trackedSessions: () => readonly string[];
|
|
1997
|
+
/** Files one envelope with the tracker: advances the session's sequence cursor and births or retires pending control requests, exactly as an observed event-batch body does. */
|
|
1998
|
+
readonly fileStreamEvent: (sessionId: string, event: RcStreamEnvelope) => void;
|
|
1999
|
+
/** Reads the session's sequence cursor: the highest number the door has seen, from the stream or from its own confirmed writes. */
|
|
2000
|
+
readonly sequenceNumOf: (sessionId: string) => number | undefined;
|
|
2001
|
+
readonly dial: RcStreamDial;
|
|
2002
|
+
readonly fanout: RcEventFanout;
|
|
2003
|
+
/** Mints the stable client id one session's attachment announces: a v4 UUID or better in production. Stable means it survives reconnects, so the host sees one client, not a new one per drop. */
|
|
2004
|
+
readonly newClientId: () => string;
|
|
2005
|
+
/** How long a failed attachment backs off; production passes `RC_STREAM_BACKOFF_MS`, tests pass small values so a backoff is reached in milliseconds. */
|
|
2006
|
+
readonly backoffMs: number;
|
|
2007
|
+
readonly sleep: (ms: number) => Promise<void>;
|
|
2008
|
+
/** The door's log, for attachment lifecycle lines only: never an event payload, never a credential. */
|
|
2009
|
+
readonly log?: (line: string) => void;
|
|
2010
|
+
}
|
|
2011
|
+
/** The door's client read stream attachment: one stream per tracked session, fanned out to every subscriber. */
|
|
2012
|
+
interface RcStreamHub {
|
|
2013
|
+
/** Reconciles the attachments against the tracker: attaches a stream to every tracked session whose OAuth credential is known, and drops an attachment whose session has expired or lost its credential. Idempotent, synchronous and total (never throws): the door calls it after every observed Remote Control exchange, so an attachment follows the session it belongs to without any polling of its own. */
|
|
2014
|
+
readonly reconcile: () => void;
|
|
2015
|
+
/** Stops every attachment and frees their dials. */
|
|
2016
|
+
readonly close: () => void;
|
|
2017
|
+
}
|
|
2018
|
+
/** Creates the attachment hub. One per door process; everything it holds dies with it. */
|
|
2019
|
+
declare function createRcStreamHub(deps: RcStreamHubDeps): RcStreamHub;
|
|
2020
|
+
|
|
1879
2021
|
/** Where the Remote Control inject path dials: the API host's own address by default, over TLS with the door's interception-proof agent (real-name DNS resolution and the pf-exempt source-port range), so an injected event cannot be looped back into the door's own transparent surface. A test redirects the dial at a local stand-in presenting the host's name, exactly as the forwarding targets are redirected. */
|
|
1880
2022
|
interface RcDialTarget {
|
|
1881
2023
|
readonly host: string;
|
|
@@ -1891,6 +2033,7 @@ interface RcDialTarget {
|
|
|
1891
2033
|
* The real `RcEventDial`: one keep-alive TLS agent of the door's own exempt kind, so every injected event rides the same interception-proof dials the door's forwarded traffic does. The dial only ever reads small JSON answers (an event write's result, or an error), never a stream.
|
|
1892
2034
|
*/
|
|
1893
2035
|
declare function realRcEventDial(target?: RcDialTarget): RcEventDial;
|
|
2036
|
+
declare function realRcStreamDial(target?: RcDialTarget): RcStreamDial;
|
|
1894
2037
|
declare function realConnectEffects(): ConnectEffects;
|
|
1895
2038
|
|
|
1896
2039
|
/**
|
|
@@ -1966,6 +2109,225 @@ declare function frontDoorRcControl(transport: RcControlTransport, token: string
|
|
|
1966
2109
|
/** The filesystem operations headroom coordination needs: the same shape as `FarmFs`, injected so every decision over state, sessions, and the start lock runs against an in-memory fake in tests. */
|
|
1967
2110
|
type HeadroomFs = Pick<FarmFs, "mkdirp" | "mkdirPrivate" | "readFileUtf8" | "writeFileUtf8" | "writeFilePrivate" | "writeFileExclusive" | "readdir" | "removeRecursive">;
|
|
1968
2111
|
|
|
2112
|
+
/** What an `lstat` (which never follows symlinks) reports about one path, narrowed to what authenticating the socket needs. */
|
|
2113
|
+
interface SocketPathStat {
|
|
2114
|
+
readonly kind: "dir" | "socket" | "symlink" | "other";
|
|
2115
|
+
/** The owning user id. */
|
|
2116
|
+
readonly uid: number;
|
|
2117
|
+
/** The permission bits, without the file type bits. */
|
|
2118
|
+
readonly mode: number;
|
|
2119
|
+
}
|
|
2120
|
+
/** The platform facts and the one filesystem call the socket checks need, injected so every refusal is unit-testable without a real socket, directory or second user. */
|
|
2121
|
+
interface HeadroomSocketTrustPorts {
|
|
2122
|
+
/** `process.platform` in the real implementation. */
|
|
2123
|
+
readonly platform: string;
|
|
2124
|
+
/** This process's user id. Only called on a platform with unix sockets, which all have POSIX user ids. */
|
|
2125
|
+
readonly currentUid: () => number;
|
|
2126
|
+
/** Stats one path without following symlinks, or returns undefined when nothing is there. */
|
|
2127
|
+
readonly lstat: (target: string) => SocketPathStat | undefined;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* A secondary pre-pipeline surface the listener answers under one path prefix: the typed Remote Control API. The listener owns only the dispatch (the prefix and the not-matched 404); the handle itself is whatever the door built, so this file stays independent of the API framework behind it.
|
|
2132
|
+
*/
|
|
2133
|
+
interface PrePipelineApi {
|
|
2134
|
+
/** The path prefix every request of this surface arrives under, outside the routed URL space. */
|
|
2135
|
+
readonly pathPrefix: string;
|
|
2136
|
+
/** Serves one request, resolving with whether a procedure under the prefix matched; the listener answers the 404 itself when one did not. */
|
|
2137
|
+
readonly handle: (request: IncomingMessage, response: ServerResponse) => Promise<{
|
|
2138
|
+
readonly matched: boolean;
|
|
2139
|
+
}>;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
/**
|
|
2143
|
+
* The Remote Control operations as a typed oRPC API, so programmatic consumers (automation, a mobile or web client, another of this user's tools) get a generated type-safe client instead of hand-rolled HTTP. One procedure per existing operation, each wrapping the same operation the bespoke token-gated routes wrap (the routes stay: the CLI uses them), with inputs and outputs validating through the Zod schemas of `rcSchemas.ts`, which the operations' own values must satisfy, so contract and behaviour share one schema source and cannot drift apart silently.
|
|
2144
|
+
*
|
|
2145
|
+
* Mounted on the provider listener beside the bespoke namespace, authenticated by the same per-generation owner-only control token as a Bearer credential: a fresh random value per door start, written owner-only under the front door's state directory, and checked in constant time like every other capability the door accepts. `rc.subscribe` streams the client attachment's fan-out: every event the door's held stream produced, SSE-framed by oRPC's event iterator, each carrying its sequence number as the SSE event id so a consumer's own reconnect can resume exactly as the door's does.
|
|
2146
|
+
*/
|
|
2147
|
+
/** The one path prefix the typed API is mounted under, answered before the routed pipeline like the bespoke control routes are. */
|
|
2148
|
+
declare const RC_ORPC_PATH_PREFIX = "/__agent-shim/orpc";
|
|
2149
|
+
/** Everything the typed API needs: the same operations the bespoke control routes take, the fan-out its subscription reads, and the token both surfaces demand. */
|
|
2150
|
+
interface RcApiDeps {
|
|
2151
|
+
/** This generation's control token: the value the door wrote owner-only for its callers to present. */
|
|
2152
|
+
readonly expectedToken: string;
|
|
2153
|
+
/** The observed sessions as the tracker lists them. */
|
|
2154
|
+
readonly list: () => readonly RcSessionSummary[];
|
|
2155
|
+
/** The observed sessions as the tracker reports their status, filtered to one when named. */
|
|
2156
|
+
readonly statusOf: (sessionId?: string) => readonly RcSessionStatus[];
|
|
2157
|
+
/** The control requests awaiting an answer, filtered to one session when named. */
|
|
2158
|
+
readonly pendingOf: (sessionId?: string) => readonly RcPendingRequestSummary[];
|
|
2159
|
+
/** The inject operation, already wired to the tracker and the door's API-host dial. */
|
|
2160
|
+
readonly inject: (sessionId: string, text: string) => Promise<RcEventWriteResult>;
|
|
2161
|
+
/** The answer operation, already wired to the tracker and the door's API-host dial. */
|
|
2162
|
+
readonly answer: (sessionId: string, requestId: string, decision: RcAnswerDecision) => Promise<RcEventWriteResult>;
|
|
2163
|
+
/** The interrupt operation, already wired to the tracker and the door's API-host dial. */
|
|
2164
|
+
readonly interrupt: (sessionId: string) => Promise<RcEventWriteResult>;
|
|
2165
|
+
/** The set-model operation, already wired to the tracker and the door's API-host dial. */
|
|
2166
|
+
readonly setModel: (sessionId: string, model: string) => Promise<RcEventWriteResult>;
|
|
2167
|
+
/** The set-permission-mode operation, already wired to the tracker and the door's API-host dial. */
|
|
2168
|
+
readonly setPermissionMode: (sessionId: string, mode: RcPermissionMode) => Promise<RcEventWriteResult>;
|
|
2169
|
+
/** The client attachment's fan-out, whose events the subscription yields. */
|
|
2170
|
+
readonly fanout: RcEventFanout;
|
|
2171
|
+
}
|
|
2172
|
+
/** Builds the typed API's router: one procedure per operation, every one behind the control-token middleware. */
|
|
2173
|
+
declare function createRcApiRouter(deps: RcApiDeps): {
|
|
2174
|
+
rc: {
|
|
2175
|
+
list: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2176
|
+
readonly headers: IncomingHttpHeaders;
|
|
2177
|
+
} & Record<never, never>, {
|
|
2178
|
+
readonly headers: IncomingHttpHeaders;
|
|
2179
|
+
}, {
|
|
2180
|
+
readonly headers: IncomingHttpHeaders;
|
|
2181
|
+
}>, any, Schema<unknown, unknown>, zod.ZodObject<{
|
|
2182
|
+
sessions: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
|
|
2183
|
+
id: zod.ZodString;
|
|
2184
|
+
createdAt: zod.ZodNumber;
|
|
2185
|
+
lastSeenAt: zod.ZodNumber;
|
|
2186
|
+
}, zod_v4_core.$strict>>>;
|
|
2187
|
+
}, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
|
|
2188
|
+
status: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2189
|
+
readonly headers: IncomingHttpHeaders;
|
|
2190
|
+
} & Record<never, never>, {
|
|
2191
|
+
readonly headers: IncomingHttpHeaders;
|
|
2192
|
+
}, {
|
|
2193
|
+
readonly headers: IncomingHttpHeaders;
|
|
2194
|
+
}>, any, zod.ZodObject<{
|
|
2195
|
+
session: zod.ZodOptional<zod.ZodString>;
|
|
2196
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
2197
|
+
statuses: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
|
|
2198
|
+
workerState: zod.ZodOptional<zod.ZodObject<{
|
|
2199
|
+
value: zod.ZodString;
|
|
2200
|
+
observedAt: zod.ZodNumber;
|
|
2201
|
+
}, zod_v4_core.$strict>>;
|
|
2202
|
+
workerIdleSeconds: zod.ZodOptional<zod.ZodObject<{
|
|
2203
|
+
value: zod.ZodNumber;
|
|
2204
|
+
observedAt: zod.ZodNumber;
|
|
2205
|
+
}, zod_v4_core.$strict>>;
|
|
2206
|
+
pending: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
|
|
2207
|
+
sessionId: zod.ZodString;
|
|
2208
|
+
requestId: zod.ZodString;
|
|
2209
|
+
type: zod.ZodString;
|
|
2210
|
+
summary: zod.ZodString;
|
|
2211
|
+
observedAt: zod.ZodNumber;
|
|
2212
|
+
}, zod_v4_core.$strict>>>;
|
|
2213
|
+
id: zod.ZodString;
|
|
2214
|
+
createdAt: zod.ZodNumber;
|
|
2215
|
+
lastSeenAt: zod.ZodNumber;
|
|
2216
|
+
}, zod_v4_core.$strict>>>;
|
|
2217
|
+
}, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
|
|
2218
|
+
pending: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2219
|
+
readonly headers: IncomingHttpHeaders;
|
|
2220
|
+
} & Record<never, never>, {
|
|
2221
|
+
readonly headers: IncomingHttpHeaders;
|
|
2222
|
+
}, {
|
|
2223
|
+
readonly headers: IncomingHttpHeaders;
|
|
2224
|
+
}>, any, zod.ZodObject<{
|
|
2225
|
+
session: zod.ZodOptional<zod.ZodString>;
|
|
2226
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
2227
|
+
pending: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
|
|
2228
|
+
sessionId: zod.ZodString;
|
|
2229
|
+
requestId: zod.ZodString;
|
|
2230
|
+
type: zod.ZodString;
|
|
2231
|
+
summary: zod.ZodString;
|
|
2232
|
+
observedAt: zod.ZodNumber;
|
|
2233
|
+
}, zod_v4_core.$strict>>>;
|
|
2234
|
+
}, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
|
|
2235
|
+
send: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2236
|
+
readonly headers: IncomingHttpHeaders;
|
|
2237
|
+
} & Record<never, never>, {
|
|
2238
|
+
readonly headers: IncomingHttpHeaders;
|
|
2239
|
+
}, {
|
|
2240
|
+
readonly headers: IncomingHttpHeaders;
|
|
2241
|
+
}>, any, zod.ZodObject<{
|
|
2242
|
+
session: zod.ZodString;
|
|
2243
|
+
text: zod.ZodString;
|
|
2244
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
2245
|
+
session: zod.ZodString;
|
|
2246
|
+
sequenceNums: zod.ZodReadonly<zod.ZodArray<zod.ZodNumber>>;
|
|
2247
|
+
}, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
|
|
2248
|
+
answer: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2249
|
+
readonly headers: IncomingHttpHeaders;
|
|
2250
|
+
} & Record<never, never>, {
|
|
2251
|
+
readonly headers: IncomingHttpHeaders;
|
|
2252
|
+
}, {
|
|
2253
|
+
readonly headers: IncomingHttpHeaders;
|
|
2254
|
+
}>, any, zod.ZodObject<{
|
|
2255
|
+
session: zod.ZodString;
|
|
2256
|
+
request: zod.ZodString;
|
|
2257
|
+
approve: zod.ZodBoolean;
|
|
2258
|
+
text: zod.ZodOptional<zod.ZodString>;
|
|
2259
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
2260
|
+
session: zod.ZodString;
|
|
2261
|
+
request: zod.ZodString;
|
|
2262
|
+
sequenceNums: zod.ZodReadonly<zod.ZodArray<zod.ZodNumber>>;
|
|
2263
|
+
}, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
|
|
2264
|
+
interrupt: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2265
|
+
readonly headers: IncomingHttpHeaders;
|
|
2266
|
+
} & Record<never, never>, {
|
|
2267
|
+
readonly headers: IncomingHttpHeaders;
|
|
2268
|
+
}, {
|
|
2269
|
+
readonly headers: IncomingHttpHeaders;
|
|
2270
|
+
}>, any, zod.ZodObject<{
|
|
2271
|
+
session: zod.ZodString;
|
|
2272
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
2273
|
+
session: zod.ZodString;
|
|
2274
|
+
sequenceNums: zod.ZodReadonly<zod.ZodArray<zod.ZodNumber>>;
|
|
2275
|
+
}, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
|
|
2276
|
+
setModel: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2277
|
+
readonly headers: IncomingHttpHeaders;
|
|
2278
|
+
} & Record<never, never>, {
|
|
2279
|
+
readonly headers: IncomingHttpHeaders;
|
|
2280
|
+
}, {
|
|
2281
|
+
readonly headers: IncomingHttpHeaders;
|
|
2282
|
+
}>, any, zod.ZodObject<{
|
|
2283
|
+
session: zod.ZodString;
|
|
2284
|
+
model: zod.ZodString;
|
|
2285
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
2286
|
+
session: zod.ZodString;
|
|
2287
|
+
sequenceNums: zod.ZodReadonly<zod.ZodArray<zod.ZodNumber>>;
|
|
2288
|
+
}, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
|
|
2289
|
+
setPermissionMode: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2290
|
+
readonly headers: IncomingHttpHeaders;
|
|
2291
|
+
} & Record<never, never>, {
|
|
2292
|
+
readonly headers: IncomingHttpHeaders;
|
|
2293
|
+
}, {
|
|
2294
|
+
readonly headers: IncomingHttpHeaders;
|
|
2295
|
+
}>, any, zod.ZodObject<{
|
|
2296
|
+
session: zod.ZodString;
|
|
2297
|
+
mode: zod.ZodEnum<{
|
|
2298
|
+
default: "default";
|
|
2299
|
+
acceptEdits: "acceptEdits";
|
|
2300
|
+
bypassPermissions: "bypassPermissions";
|
|
2301
|
+
plan: "plan";
|
|
2302
|
+
dontAsk: "dontAsk";
|
|
2303
|
+
auto: "auto";
|
|
2304
|
+
}>;
|
|
2305
|
+
}, zod_v4_core.$strict>, zod.ZodObject<{
|
|
2306
|
+
session: zod.ZodString;
|
|
2307
|
+
sequenceNums: zod.ZodReadonly<zod.ZodArray<zod.ZodNumber>>;
|
|
2308
|
+
}, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
|
|
2309
|
+
subscribe: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<{
|
|
2310
|
+
readonly headers: IncomingHttpHeaders;
|
|
2311
|
+
} & Record<never, never>, {
|
|
2312
|
+
readonly headers: IncomingHttpHeaders;
|
|
2313
|
+
}, {
|
|
2314
|
+
readonly headers: IncomingHttpHeaders;
|
|
2315
|
+
}>, any, zod.ZodObject<{
|
|
2316
|
+
session: zod.ZodOptional<zod.ZodString>;
|
|
2317
|
+
}, zod_v4_core.$strict>, any, Record<never, never>, Record<never, never>>;
|
|
2318
|
+
};
|
|
2319
|
+
};
|
|
2320
|
+
/** The typed API's router, as the CLI-side client's own type is derived from it. */
|
|
2321
|
+
type RcApiRouter = ReturnType<typeof createRcApiRouter>;
|
|
2322
|
+
/**
|
|
2323
|
+
* Builds the typed API's node handler, already bound to its mount prefix and context: the pre-pipeline surface the provider listener hands every request under `RC_ORPC_PATH_PREFIX`, answering with `matched: false` for a path under the prefix that names no procedure (which the listener itself answers as a 404). Request bodies are bounded by the same protocol cap the bespoke routes apply.
|
|
2324
|
+
*/
|
|
2325
|
+
declare function createRcApiNodeHandler(deps: RcApiDeps): PrePipelineApi;
|
|
2326
|
+
/** The typed API's client as the `frontdoor rc` verbs use it: every call presents the control token, over TLS trusting only the CA file the door's own state names. */
|
|
2327
|
+
type RcApiClient = RouterClient<RcApiRouter>;
|
|
2328
|
+
/** Builds the typed API's client for the door's provider listener: the same address, CA and per-generation control token the bespoke control client uses. */
|
|
2329
|
+
declare function frontDoorRcApiClient(port: number, ca: string, token: string): RcApiClient;
|
|
2330
|
+
|
|
1969
2331
|
/** The outcome of authenticating the listener a front-door state file names. */
|
|
1970
2332
|
type ListenerVerdict = {
|
|
1971
2333
|
readonly ok: true;
|
|
@@ -2049,6 +2411,73 @@ interface RunFrontDoorSupervisorOptions {
|
|
|
2049
2411
|
*/
|
|
2050
2412
|
declare function runFrontDoorSupervisor(idleShutdownMinutes: number, ports: FrontDoorSupervisorPorts, options?: RunFrontDoorSupervisorOptions): Promise<number>;
|
|
2051
2413
|
|
|
2414
|
+
/** One routed request, appended to the usage log when its response has finished. */
|
|
2415
|
+
declare const UsageRecordSchema: z.ZodObject<{
|
|
2416
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
2417
|
+
at: z.ZodISODateTime;
|
|
2418
|
+
identity: z.ZodOptional<z.ZodString>;
|
|
2419
|
+
provider: z.ZodString;
|
|
2420
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
2421
|
+
project: z.ZodOptional<z.ZodString>;
|
|
2422
|
+
route: z.ZodString;
|
|
2423
|
+
method: z.ZodString;
|
|
2424
|
+
endpoint: z.ZodString;
|
|
2425
|
+
model: z.ZodOptional<z.ZodString>;
|
|
2426
|
+
status: z.ZodNumber;
|
|
2427
|
+
latencyMs: z.ZodNumber;
|
|
2428
|
+
durationMs: z.ZodNumber;
|
|
2429
|
+
outcome: z.ZodEnum<{
|
|
2430
|
+
completed: "completed";
|
|
2431
|
+
aborted: "aborted";
|
|
2432
|
+
}>;
|
|
2433
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
2434
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2435
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2436
|
+
cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2437
|
+
cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
2438
|
+
}, z.core.$strict>>;
|
|
2439
|
+
rateLimitHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
2440
|
+
limit: z.ZodOptional<z.ZodObject<{
|
|
2441
|
+
kind: z.ZodEnum<{
|
|
2442
|
+
"rate-limited": "rate-limited";
|
|
2443
|
+
"quota-exhausted": "quota-exhausted";
|
|
2444
|
+
}>;
|
|
2445
|
+
retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
|
|
2446
|
+
resetAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2447
|
+
window: z.ZodOptional<z.ZodString>;
|
|
2448
|
+
evidence: z.ZodArray<z.ZodString>;
|
|
2449
|
+
}, z.core.$strict>>;
|
|
2450
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
2451
|
+
}, z.core.$strict>;
|
|
2452
|
+
type UsageRecord = z.infer<typeof UsageRecordSchema>;
|
|
2453
|
+
/** One quota window from Anthropic's unified rate-limit headers. */
|
|
2454
|
+
declare const QuotaWindowSchema: z.ZodObject<{
|
|
2455
|
+
utilization: z.ZodOptional<z.ZodNumber>;
|
|
2456
|
+
resetsAt: z.ZodOptional<z.ZodISODateTime>;
|
|
2457
|
+
status: z.ZodOptional<z.ZodString>;
|
|
2458
|
+
}, z.core.$strict>;
|
|
2459
|
+
type QuotaWindow = z.infer<typeof QuotaWindowSchema>;
|
|
2460
|
+
/**
|
|
2461
|
+
* The account fields copied from an identity's stored Claude login (`oauthAccount` in the identity's `.claude.json`): who the account is and which plan and tier it is on. Never the token, which Claude Code keeps elsewhere. Each field is present only when the stored login has it; a setup-token identity has no profile scope and so none of them (see issue #44).
|
|
2462
|
+
*/
|
|
2463
|
+
declare const AccountMetadataSchema: z.ZodObject<{
|
|
2464
|
+
accountUuid: z.ZodOptional<z.ZodString>;
|
|
2465
|
+
emailAddress: z.ZodOptional<z.ZodString>;
|
|
2466
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
2467
|
+
organizationUuid: z.ZodOptional<z.ZodString>;
|
|
2468
|
+
organizationName: z.ZodOptional<z.ZodString>;
|
|
2469
|
+
organizationType: z.ZodOptional<z.ZodString>;
|
|
2470
|
+
organizationRole: z.ZodOptional<z.ZodString>;
|
|
2471
|
+
workspaceRole: z.ZodOptional<z.ZodString>;
|
|
2472
|
+
billingType: z.ZodOptional<z.ZodString>;
|
|
2473
|
+
seatTier: z.ZodOptional<z.ZodString>;
|
|
2474
|
+
organizationRateLimitTier: z.ZodOptional<z.ZodString>;
|
|
2475
|
+
userRateLimitTier: z.ZodOptional<z.ZodString>;
|
|
2476
|
+
hasExtraUsageEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
2477
|
+
subscriptionCreatedAt: z.ZodOptional<z.ZodString>;
|
|
2478
|
+
accountCreatedAt: z.ZodOptional<z.ZodString>;
|
|
2479
|
+
}, z.core.$strict>;
|
|
2480
|
+
type AccountMetadata = z.infer<typeof AccountMetadataSchema>;
|
|
2052
2481
|
/**
|
|
2053
2482
|
* The latest state for one identity, rewritten atomically after each recorded response: the snapshot file other tools read (`~/.agent-shim/usage/snapshots/<identity>.json`) without shelling out to `agent-shim`.
|
|
2054
2483
|
*/
|
|
@@ -2145,6 +2574,175 @@ declare function readUsageSnapshot(fs: Pick<FarmFs, "readFileUtf8">, snapshotsDi
|
|
|
2145
2574
|
/** Reads every identity's snapshot, by identity name. */
|
|
2146
2575
|
declare function listUsageSnapshots(fs: UsageReadFs, snapshotsDir: string): readonly UsageSnapshot[];
|
|
2147
2576
|
|
|
2577
|
+
/** A quota window as it stands at a given instant. */
|
|
2578
|
+
interface EffectiveWindow {
|
|
2579
|
+
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
2580
|
+
readonly reset: boolean;
|
|
2581
|
+
/** The fraction used: 0 for a reset window, otherwise what was last observed (a lower bound, since utilisation only rises within a window), or undefined when none was reported. */
|
|
2582
|
+
readonly utilization?: number;
|
|
2583
|
+
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
2584
|
+
readonly resetsAtMs?: number;
|
|
2585
|
+
/** The window's own status, for a window that has not reset yet. */
|
|
2586
|
+
readonly status?: string;
|
|
2587
|
+
}
|
|
2588
|
+
/** Reads a recorded window at `nowMs`: a window whose reset has passed is empty and carries no status, so every consumer agrees on what an old observation still means. */
|
|
2589
|
+
declare function effectiveWindow(window: Readonly<QuotaWindow>, nowMs: number): EffectiveWindow;
|
|
2590
|
+
|
|
2591
|
+
/**
|
|
2592
|
+
* What an account's plan means for picking it: a subscription with a capacity relative to the smallest paid tier, or an account billed by use.
|
|
2593
|
+
*/
|
|
2594
|
+
declare const PlanClassSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
2595
|
+
kind: z.ZodLiteral<"subscription">;
|
|
2596
|
+
capacity: z.ZodNumber;
|
|
2597
|
+
recognised: z.ZodBoolean;
|
|
2598
|
+
tier: z.ZodOptional<z.ZodString>;
|
|
2599
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2600
|
+
kind: z.ZodLiteral<"pay-per-use">;
|
|
2601
|
+
tier: z.ZodOptional<z.ZodString>;
|
|
2602
|
+
}, z.core.$strict>]>;
|
|
2603
|
+
type PlanClass = z.infer<typeof PlanClassSchema>;
|
|
2604
|
+
/**
|
|
2605
|
+
* Classifies an account from the rate-limit tier of its stored login (`organizationRateLimitTier`, which decides the organisation's limits, then `userRateLimitTier`). The tier strings are free text on Anthropic's side, so only the shapes seen are read: a trailing `<n>x` is that multiple, a bare `pro` is 1, a `zero` tier is pay-per-use. Anything else is a subscription of unrecognised size, counted as 1 and marked so the ranking can say it guessed.
|
|
2606
|
+
*/
|
|
2607
|
+
declare function planOf(account: AccountMetadata | undefined): PlanClass;
|
|
2608
|
+
|
|
2609
|
+
/** Anthropic's longest prompt-cache lifetime (the one-hour tier): a conversation resumed within it still has a warm cache on the account that served it, and the cache is per organisation, so it is lost by switching. */
|
|
2610
|
+
declare const PROMPT_CACHE_TTL_MS: number;
|
|
2611
|
+
/** The state a member's ranking was built from. */
|
|
2612
|
+
interface PoolMember {
|
|
2613
|
+
readonly identity: string;
|
|
2614
|
+
/** The identity's usage snapshot, when it has one. */
|
|
2615
|
+
readonly snapshot?: UsageSnapshot;
|
|
2616
|
+
/** Why the member's recorded state could not be read (a corrupt or newer-schema snapshot, an unreadable login file), when that is the case. */
|
|
2617
|
+
readonly readError?: string;
|
|
2618
|
+
readonly account?: AccountMetadata;
|
|
2619
|
+
/** The member's usage-log records from the current five-hour window on. */
|
|
2620
|
+
readonly records: readonly UsageRecord[];
|
|
2621
|
+
}
|
|
2622
|
+
/** The member last picked for this directory, kept so a conversation stays on the account whose prompt cache is warm. */
|
|
2623
|
+
interface StickyPick {
|
|
2624
|
+
readonly identity: string;
|
|
2625
|
+
readonly at: string;
|
|
2626
|
+
}
|
|
2627
|
+
interface RankPoolInput {
|
|
2628
|
+
readonly members: readonly PoolMember[];
|
|
2629
|
+
readonly nowMs: number;
|
|
2630
|
+
readonly sticky?: StickyPick;
|
|
2631
|
+
/** True when the launch continues or resumes a conversation, which belongs on the account it started on whatever the cache lifetime. */
|
|
2632
|
+
readonly resuming: boolean;
|
|
2633
|
+
}
|
|
2634
|
+
/** In pick order. `scored` has usable quota data; `unknown` has none (never recorded, or unreadable); `pay-per-use` bills by use instead of drawing on a plan; `ineligible` is refused right now. */
|
|
2635
|
+
type CandidateClass = "scored" | "unknown" | "pay-per-use" | "ineligible";
|
|
2636
|
+
interface Candidate {
|
|
2637
|
+
readonly identity: string;
|
|
2638
|
+
readonly class: CandidateClass;
|
|
2639
|
+
/** Plan-size-weighted remaining quota per hour until its reset: higher is more wasted if left unused. Present for `scored` only. */
|
|
2640
|
+
readonly score?: number;
|
|
2641
|
+
/** False when the five-hour window would run dry, at the observed pace, before it resets. A `scored` candidate that is not feasible ranks below every feasible one. */
|
|
2642
|
+
readonly feasible: boolean;
|
|
2643
|
+
/** When an `ineligible` candidate can be used again. */
|
|
2644
|
+
readonly blockedUntilMs?: number;
|
|
2645
|
+
readonly plan: PlanClass;
|
|
2646
|
+
/** Human-readable facts behind the class and score, in the order they matter. */
|
|
2647
|
+
readonly reasons: readonly string[];
|
|
2648
|
+
}
|
|
2649
|
+
interface PoolRanking {
|
|
2650
|
+
/** Every member, best first. */
|
|
2651
|
+
readonly candidates: readonly Candidate[];
|
|
2652
|
+
/** The member to launch on: the best one that is not refused. Undefined when every member is refused. */
|
|
2653
|
+
readonly pick?: Candidate;
|
|
2654
|
+
/** When nothing can be picked, the soonest any member comes back. */
|
|
2655
|
+
readonly earliestReturn?: {
|
|
2656
|
+
readonly identity: string;
|
|
2657
|
+
readonly atMs: number;
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
/**
|
|
2661
|
+
* Ranks `members` for a launch.
|
|
2662
|
+
*
|
|
2663
|
+
* A member is `ineligible` while a window of its plan, or a refusal it last hit, still binds; it is `unknown` without recorded quota, `pay-per-use` when its usage bills by use, and otherwise `scored`. Scored members order by how much plan-size-weighted quota would expire unused per hour of runway, with any whose five-hour window would run dry at the observed pace (their own, or the person's pace on another member rescaled by plan size) placed behind those that would not. The member last picked for this directory then moves to the front if it is still usable and either the launch resumes a conversation or its prompt cache is still warm.
|
|
2664
|
+
*/
|
|
2665
|
+
declare function rankPool(input: RankPoolInput): PoolRanking;
|
|
2666
|
+
|
|
2667
|
+
/** What `pool pick` reports: the ranking a launch from `directory` would act on right now. */
|
|
2668
|
+
declare const PoolPickReportSchema: z.ZodObject<{
|
|
2669
|
+
pool: z.ZodString;
|
|
2670
|
+
directory: z.ZodString;
|
|
2671
|
+
pick: z.ZodOptional<z.ZodString>;
|
|
2672
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
2673
|
+
identity: z.ZodString;
|
|
2674
|
+
class: z.ZodEnum<{
|
|
2675
|
+
unknown: "unknown";
|
|
2676
|
+
"pay-per-use": "pay-per-use";
|
|
2677
|
+
scored: "scored";
|
|
2678
|
+
ineligible: "ineligible";
|
|
2679
|
+
}>;
|
|
2680
|
+
score: z.ZodOptional<z.ZodNumber>;
|
|
2681
|
+
feasible: z.ZodBoolean;
|
|
2682
|
+
blockedUntil: z.ZodOptional<z.ZodISODateTime>;
|
|
2683
|
+
plan: z.ZodUnion<readonly [z.ZodObject<{
|
|
2684
|
+
kind: z.ZodLiteral<"subscription">;
|
|
2685
|
+
capacity: z.ZodNumber;
|
|
2686
|
+
recognised: z.ZodBoolean;
|
|
2687
|
+
tier: z.ZodOptional<z.ZodString>;
|
|
2688
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2689
|
+
kind: z.ZodLiteral<"pay-per-use">;
|
|
2690
|
+
tier: z.ZodOptional<z.ZodString>;
|
|
2691
|
+
}, z.core.$strict>]>;
|
|
2692
|
+
reasons: z.ZodArray<z.ZodString>;
|
|
2693
|
+
}, z.core.$strict>>;
|
|
2694
|
+
missing: z.ZodArray<z.ZodString>;
|
|
2695
|
+
earliestReturn: z.ZodOptional<z.ZodObject<{
|
|
2696
|
+
identity: z.ZodString;
|
|
2697
|
+
at: z.ZodISODateTime;
|
|
2698
|
+
}, z.core.$strict>>;
|
|
2699
|
+
stickyProblem: z.ZodOptional<z.ZodString>;
|
|
2700
|
+
}, z.core.$strict>;
|
|
2701
|
+
type PoolPickReport = z.infer<typeof PoolPickReportSchema>;
|
|
2702
|
+
|
|
2703
|
+
/**
|
|
2704
|
+
* Ranks a pool exactly as a launch from `directory` would right now, without recording a pick. Shares `rankPoolFromStore` with the launcher, so what this prints is what a launch does.
|
|
2705
|
+
*/
|
|
2706
|
+
declare function collectPoolPick(params: Readonly<{
|
|
2707
|
+
paths: LayoutPaths;
|
|
2708
|
+
fs: FsPort;
|
|
2709
|
+
usageFs: FarmFs;
|
|
2710
|
+
poolName: string;
|
|
2711
|
+
pool: Pool;
|
|
2712
|
+
directory: string;
|
|
2713
|
+
nowMs: number;
|
|
2714
|
+
}>): PoolPickReport;
|
|
2715
|
+
|
|
2716
|
+
/** Everything a `when` condition can be evaluated against, injected rather than read. */
|
|
2717
|
+
interface ConditionContext {
|
|
2718
|
+
readonly nowMs: number;
|
|
2719
|
+
/** Facts about the specific entry being decided. Absent when evaluating a rule-level condition that has no single entry (a directory rule's own `when`). */
|
|
2720
|
+
readonly fact?: EntryFact;
|
|
2721
|
+
/** The branch checked out at `cwd`, or undefined when `cwd` is not in a repository. */
|
|
2722
|
+
readonly branch?: string;
|
|
2723
|
+
/** True when the repository is in detached-HEAD state, in which case no `branch` condition can match. */
|
|
2724
|
+
readonly branchDetached?: boolean;
|
|
2725
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
2726
|
+
}
|
|
2727
|
+
/** The result of evaluating one `when` object. */
|
|
2728
|
+
interface WhenEvaluation {
|
|
2729
|
+
readonly passed: boolean;
|
|
2730
|
+
/** Which condition fields were present and evaluated. */
|
|
2731
|
+
readonly checked: readonly string[];
|
|
2732
|
+
/** Which of those fields did not hold. Empty when `passed` is true. */
|
|
2733
|
+
readonly failed: readonly string[];
|
|
2734
|
+
}
|
|
2735
|
+
/** True when `branch` matches `pattern`. The pattern is glob-capable (`client/*`); a detached HEAD or a non-repository directory never matches. */
|
|
2736
|
+
declare function matchBranch(pattern: string, branch: string | undefined, detached?: boolean): boolean;
|
|
2737
|
+
/**
|
|
2738
|
+
* Evaluates a `when` object. Every present field must hold — conditions AND together within one object.
|
|
2739
|
+
*
|
|
2740
|
+
* An absent condition is vacuously true, so `when: {}` passes; `agent-shim check` warns about that rather than erroring, since an empty object is more likely a half-finished edit than an intentional statement.
|
|
2741
|
+
*
|
|
2742
|
+
* `newerThan`, `olderThan`, and `maxSizeBytes` read the subtree-aggregated facts (`latestMtimeMs`, `totalSizeBytes`), never the entry's own inode stat: a directory's own mtime does not change when a file three levels beneath it is rewritten, and its own size is a ~4KB inode figure that says nothing about what it contains.
|
|
2743
|
+
*/
|
|
2744
|
+
declare function evaluateWhen(when: WhenCondition | undefined, context: ConditionContext): WhenEvaluation;
|
|
2745
|
+
|
|
2148
2746
|
/** Raised when the daemon cannot be brought up in time, or reports a fatal `lastError`: a launch that asked for headroom must never silently fall back to a direct connection. */
|
|
2149
2747
|
declare class HeadroomStartError extends CliError {
|
|
2150
2748
|
constructor(message: string);
|
|
@@ -2181,24 +2779,6 @@ declare function ensureHeadroom(params: {
|
|
|
2181
2779
|
/** The token-saving settings of the `headroom` config block, without its install and lifecycle fields (`source`, `idleShutdownMinutes`). */
|
|
2182
2780
|
type HeadroomSettings = Pick<HeadroomGlobalConfig, "mode" | "targetRatio" | "ccr" | "rolloutChannel" | "interceptToolResults" | "readMaturation">;
|
|
2183
2781
|
|
|
2184
|
-
/** What an `lstat` (which never follows symlinks) reports about one path, narrowed to what authenticating the socket needs. */
|
|
2185
|
-
interface SocketPathStat {
|
|
2186
|
-
readonly kind: "dir" | "socket" | "symlink" | "other";
|
|
2187
|
-
/** The owning user id. */
|
|
2188
|
-
readonly uid: number;
|
|
2189
|
-
/** The permission bits, without the file type bits. */
|
|
2190
|
-
readonly mode: number;
|
|
2191
|
-
}
|
|
2192
|
-
/** The platform facts and the one filesystem call the socket checks need, injected so every refusal is unit-testable without a real socket, directory or second user. */
|
|
2193
|
-
interface HeadroomSocketTrustPorts {
|
|
2194
|
-
/** `process.platform` in the real implementation. */
|
|
2195
|
-
readonly platform: string;
|
|
2196
|
-
/** This process's user id. Only called on a platform with unix sockets, which all have POSIX user ids. */
|
|
2197
|
-
readonly currentUid: () => number;
|
|
2198
|
-
/** Stats one path without following symlinks, or returns undefined when nothing is there. */
|
|
2199
|
-
readonly lstat: (target: string) => SocketPathStat | undefined;
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
2782
|
/** Everything the supervisor needs to run the daemon, resolved from the global config and the filesystem before it starts. */
|
|
2203
2783
|
interface HeadroomSupervisorConfig {
|
|
2204
2784
|
/** The install spec as configured (`headroom.source`), already defaulted. */
|
|
@@ -2755,64 +3335,6 @@ type ConfigProfileDecisionSource =
|
|
|
2755
3335
|
/** Nothing resolved a configuration profile at all. */
|
|
2756
3336
|
| "none";
|
|
2757
3337
|
|
|
2758
|
-
/** What an account's plan means for picking it: a subscription with a capacity relative to the smallest paid tier, or an account billed by use. */
|
|
2759
|
-
type PlanClass = {
|
|
2760
|
-
readonly kind: "subscription";
|
|
2761
|
-
/** The plan's size as a multiple of the smallest subscription tier (Max 5x is 5, Max 20x is 20). */
|
|
2762
|
-
readonly capacity: number;
|
|
2763
|
-
/** False when the tier string named no multiplier and no tier this project knows, so `capacity` is the neutral 1 rather than a reading. */
|
|
2764
|
-
readonly recognised: boolean;
|
|
2765
|
-
/** The tier string the classification rests on, when the account had one. */
|
|
2766
|
-
readonly tier?: string;
|
|
2767
|
-
} | {
|
|
2768
|
-
readonly kind: "pay-per-use";
|
|
2769
|
-
readonly tier?: string;
|
|
2770
|
-
};
|
|
2771
|
-
|
|
2772
|
-
/** In pick order. `scored` has usable quota data; `unknown` has none (never recorded, or unreadable); `pay-per-use` bills by use instead of drawing on a plan; `ineligible` is refused right now. */
|
|
2773
|
-
type CandidateClass = "scored" | "unknown" | "pay-per-use" | "ineligible";
|
|
2774
|
-
interface Candidate {
|
|
2775
|
-
readonly identity: string;
|
|
2776
|
-
readonly class: CandidateClass;
|
|
2777
|
-
/** Plan-size-weighted remaining quota per hour until its reset: higher is more wasted if left unused. Present for `scored` only. */
|
|
2778
|
-
readonly score?: number;
|
|
2779
|
-
/** False when the five-hour window would run dry, at the observed pace, before it resets. A `scored` candidate that is not feasible ranks below every feasible one. */
|
|
2780
|
-
readonly feasible: boolean;
|
|
2781
|
-
/** When an `ineligible` candidate can be used again. */
|
|
2782
|
-
readonly blockedUntilMs?: number;
|
|
2783
|
-
readonly plan: PlanClass;
|
|
2784
|
-
/** Human-readable facts behind the class and score, in the order they matter. */
|
|
2785
|
-
readonly reasons: readonly string[];
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
|
-
/** What `pool pick` reports: the ranking a launch from `directory` would act on right now. */
|
|
2789
|
-
interface PoolPickReport {
|
|
2790
|
-
readonly pool: string;
|
|
2791
|
-
readonly directory: string;
|
|
2792
|
-
/** The member a launch would run as, absent when every member is refused. */
|
|
2793
|
-
readonly pick?: string;
|
|
2794
|
-
readonly candidates: readonly PoolPickCandidateView[];
|
|
2795
|
-
/** Members that name an identity that does not exist; a launch skips them. */
|
|
2796
|
-
readonly missing: readonly string[];
|
|
2797
|
-
/** When nothing can be picked, the soonest any member returns. */
|
|
2798
|
-
readonly earliestReturn?: {
|
|
2799
|
-
readonly identity: string;
|
|
2800
|
-
readonly at: string;
|
|
2801
|
-
};
|
|
2802
|
-
/** Why the last-pick record could not be read, when that is the case. */
|
|
2803
|
-
readonly stickyProblem?: string;
|
|
2804
|
-
}
|
|
2805
|
-
/** One ranked member as `pool pick --json` prints it. */
|
|
2806
|
-
interface PoolPickCandidateView {
|
|
2807
|
-
readonly identity: string;
|
|
2808
|
-
readonly class: Candidate["class"];
|
|
2809
|
-
readonly score?: number;
|
|
2810
|
-
readonly feasible: boolean;
|
|
2811
|
-
readonly blockedUntil?: string;
|
|
2812
|
-
readonly plan: Candidate["plan"];
|
|
2813
|
-
readonly reasons: readonly string[];
|
|
2814
|
-
}
|
|
2815
|
-
|
|
2816
3338
|
/**
|
|
2817
3339
|
* Forward-only encoding of a real working directory into the single directory name Claude Code gives it under `~/.claude/projects/`.
|
|
2818
3340
|
*
|
|
@@ -3209,5 +3731,5 @@ interface PrepareClaudeLaunchOptions {
|
|
|
3209
3731
|
*/
|
|
3210
3732
|
declare function prepareClaudeLaunch(options: PrepareClaudeLaunchOptions): LaunchPlan;
|
|
3211
3733
|
|
|
3212
|
-
export { AMBIENT_CREDENTIAL_VARS, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CliError, ConfigProfileSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, EXIT_FAILURE, EXIT_USAGE, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorStartError, GlobalConfigSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LaunchRefusedError, LegacyProviderFileError, PoolNameSchema, PoolNotFoundError, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, RC_IDLE_EXPIRY_MS, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_REQUEST_PARSE_CAP_BYTES, RC_SESSIONS_PATH_PREFIX, ROUTED_PATH_PREFIX, UsageError, UsageSnapshotError, UsageSnapshotSchema, WhenSchema, addDirectoryRule, addIdentity, addPool, addProvider, answerRcControlRequest, buildEntryFacts, buildLayoutPaths, buildRcControlResponsePayload, buildRcEventWriteBody, buildRcInterruptPayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, createLeafCache, createProfile, createRcControlHandler, createRcSessionTracker, describeProviderEndpoint, detectAmbientCredential, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, forwardableHeaders, frontDoorRcControl, generateCa, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isRcPermissionMode, listDirectoryRules, listIdentities, listProfiles, listProviders, listUsageSnapshots, mintLeaf, observingRoutedRoute, parseConnectTarget, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rcEventWriteResultFromAnswer, rcObserverAsPassthrough, readActiveIdentity, readDirectoryRules, readFarmManifest, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readUsageSnapshot, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, recoverFarm, recoveryDiagnostics, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveDecisions, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runDoctor, runFrontDoorSupervisor, runSupervisor, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setPool, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, snapshotPath, startConnectServer, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, writeDirectoryRules };
|
|
3213
|
-
export type { AddDirectoryRuleOptions, AddProviderInput, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, BuildEntryFactsParams, CaMaterial, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectServerConfig, ConnectServerHandle, ConnectTarget, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorRcControl, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, InjectedCredential, LaunchPlan, Layer, LayerId, LayoutPaths, LeafCert, Pool, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, RcAnswerDecision, RcAnswerDeps, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcDialAnswer, RcDialTarget, RcEventDial, RcEventWriteResult, RcExchangeObserver, RcInjectDeps, RcObservedCredential, RcObservedRequest, RcPendingRequestSummary, RcPermissionMode, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcWorkerFact, RcWriteHeaders, RecoverFarmParams, RecoveryResult, ResolveDecisionsInput, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunDoctorParams, RunFrontDoorSupervisorOptions, RunSupervisorOptions, SupervisorPorts, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageReadFs, UsageSnapshot, WhenCondition };
|
|
3734
|
+
export { AMBIENT_CREDENTIAL_VARS, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CliError, ConfigProfileSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, EXIT_FAILURE, EXIT_USAGE, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorStartError, GlobalConfigSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LaunchRefusedError, LegacyProviderFileError, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_REQUEST_PARSE_CAP_BYTES, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, ROUTED_PATH_PREFIX, RcPermissionModeSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, UsageError, UsageSnapshotError, UsageSnapshotSchema, WhenSchema, addDirectoryRule, addIdentity, addPool, addProvider, answerRcControlRequest, buildEntryFacts, buildLayoutPaths, buildRcControlResponsePayload, buildRcEventWriteBody, buildRcInterruptPayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectPoolPick, createLeafCache, createProfile, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcEventFanout, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, effectiveWindow, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, forwardableHeaders, frontDoorRcApiClient, frontDoorRcControl, generateCa, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isRcPermissionMode, listDirectoryRules, listIdentities, listProfiles, listProviders, listUsageSnapshots, matchBranch, mintLeaf, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcObserverAsPassthrough, readActiveIdentity, readDirectoryRules, readFarmManifest, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readUsageSnapshot, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, recoverFarm, recoveryDiagnostics, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveDecisions, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runDoctor, runFrontDoorSupervisor, runSupervisor, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setPool, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, snapshotPath, startConnectServer, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, writeDirectoryRules };
|
|
3735
|
+
export type { AddDirectoryRuleOptions, AddProviderInput, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, BuildEntryFactsParams, CaMaterial, Candidate, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConditionContext, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectServerConfig, ConnectServerHandle, ConnectTarget, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, EffectiveWindow, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorRcControl, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, InjectedCredential, LaunchPlan, Layer, LayerId, LayoutPaths, LeafCert, PlanClass, Pool, PoolMember, PoolPickReport, PoolRanking, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, RankPoolInput, RcAnswerDecision, RcAnswerDeps, RcApiClient, RcApiDeps, RcApiRouter, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcDialAnswer, RcDialTarget, RcEventDial, RcEventFanout, RcEventWriteResult, RcExchangeObserver, RcInjectDeps, RcObservedCredential, RcObservedRequest, RcPendingRequestSummary, RcPermissionMode, RcPresenceAnswer, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcStreamAnswer, RcStreamDial, RcStreamEnvelope, RcStreamEvent, RcStreamHub, RcStreamHubDeps, RcWorkerFact, RcWriteHeaders, RecoverFarmParams, RecoveryResult, ResolveDecisionsInput, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunDoctorParams, RunFrontDoorSupervisorOptions, RunSupervisorOptions, SseParsedEvent, StickyPick, SupervisorPorts, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageReadFs, UsageSnapshot, WhenCondition, WhenEvaluation };
|