@nifrajs/agent-app 3.2.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.
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Transport seam for the Agent App SDK. The client speaks only these two verbs - a request/response
3
+ * `command` and a Server-Sent-Events `stream` - so a fake, a replay driver, and a real loopback RPC
4
+ * host are interchangeable behind one interface.
5
+ *
6
+ * Caller credentials are never stored on the transport. The optional {@link AuthProvider} is invoked
7
+ * per request to mint a bearer token; the token is placed on the outgoing `Authorization` header and
8
+ * is never copied into a result, an error, or a log line.
9
+ */
10
+ import type { AgentEvent } from "@nifrajs/agent-protocol";
11
+ /** One RPC-style call. `params` is JSON-serializable; `signal` cancels the in-flight request. */
12
+ export interface AgentTransportRequest {
13
+ readonly method: string;
14
+ readonly params?: unknown;
15
+ readonly signal?: AbortSignal;
16
+ }
17
+ /**
18
+ * The outcome of a command. Non-ok responses never throw here so a caller can render a bounded state
19
+ * instead of unwinding; `error` carries only the server's status text, never a credential.
20
+ */
21
+ export type CommandOutcome<T> = {
22
+ readonly ok: true;
23
+ readonly status: number;
24
+ readonly value: T;
25
+ } | {
26
+ readonly ok: false;
27
+ readonly status: number;
28
+ readonly error: string;
29
+ };
30
+ export interface AgentTransport {
31
+ command<T = unknown>(request: AgentTransportRequest): Promise<CommandOutcome<T>>;
32
+ stream(request: AgentTransportRequest): AsyncIterable<AgentEvent>;
33
+ }
34
+ /** Returns a bearer token for the next request, or `undefined` for an unauthenticated call. */
35
+ export type AuthProvider = () => string | undefined | Promise<string | undefined>;
36
+ export interface HttpAgentTransportOptions {
37
+ /** RPC origin, e.g. `http://127.0.0.1:8787`. The `/rpc` path is appended. */
38
+ readonly endpoint: string;
39
+ /** Per-request bearer-token source. Never stored; only the header value is used and discarded. */
40
+ readonly authorize?: AuthProvider;
41
+ /** Injectable fetch for tests and non-DOM hosts. Defaults to the ambient `fetch`. */
42
+ readonly fetch?: typeof fetch;
43
+ }
44
+ /** Thrown only for transport-level faults (network, malformed body). Carries no credential. */
45
+ export declare class AgentTransportError extends Error {
46
+ readonly method: string;
47
+ constructor(method: string, reason: string);
48
+ }
49
+ /** Web `fetch` + SSE transport. Browser- and Bun-compatible; depends on no Node or framework code. */
50
+ export declare class HttpAgentTransport implements AgentTransport {
51
+ private readonly url;
52
+ private readonly authorize;
53
+ private readonly fetchImpl;
54
+ constructor(options: HttpAgentTransportOptions);
55
+ private headers;
56
+ command<T = unknown>(request: AgentTransportRequest): Promise<CommandOutcome<T>>;
57
+ stream(request: AgentTransportRequest): AsyncIterable<AgentEvent>;
58
+ }
59
+ /** Parse an SSE body into protocol events, skipping any frame whose data is not a valid event. */
60
+ export declare function parseEventStream(body: ReadableStream<Uint8Array>, method: string): AsyncIterable<AgentEvent>;
61
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAGzD,iGAAiG;AACjG,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IACxB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACjE;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3E,MAAM,WA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AU,CAAC,CAuB3B"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Transport seam for the Agent App SDK. The client speaks only these two verbs - a request/response
3
+ * `command` and a Server-Sent-Events `stream` - so a fake, a replay driver, and a real loopback RPC
4
+ * host are interchangeable behind one interface.
5
+ *
6
+ * Caller credentials are never stored on the transport. The optional {@link AuthProvider} is invoked
7
+ * per request to mint a bearer token; the token is placed on the outgoing `Authorization` header and
8
+ * is never copied into a result, an error, or a log line.
9
+ */
10
+ import { isAgentEvent } from "@nifrajs/agent-protocol";
11
+ /** Thrown only for transport-level faults (network, malformed body). Carries no credential. */
12
+ export class AgentTransportError extends Error {
13
+ method;
14
+ constructor(method, reason) {
15
+ super(`agent transport: ${method}: ${reason}`);
16
+ this.method = method;
17
+ this.name = "AgentTransportError";
18
+ }
19
+ }
20
+ /** Web `fetch` + SSE transport. Browser- and Bun-compatible; depends on no Node or framework code. */
21
+ export class HttpAgentTransport {
22
+ url;
23
+ authorize;
24
+ fetchImpl;
25
+ constructor(options) {
26
+ if (typeof options.endpoint !== "string" || options.endpoint.length === 0)
27
+ throw new TypeError("agent transport: endpoint is required");
28
+ this.url = `${options.endpoint.replace(/\/$/, "")}/rpc`;
29
+ this.authorize = options.authorize;
30
+ const bound = options.fetch ?? globalThis.fetch;
31
+ if (typeof bound !== "function")
32
+ throw new TypeError("agent transport: no fetch available");
33
+ this.fetchImpl = bound.bind(globalThis);
34
+ }
35
+ async headers(accept) {
36
+ const headers = new Headers({ "content-type": "application/json", accept });
37
+ const token = await this.authorize?.();
38
+ if (token !== undefined && token.length > 0)
39
+ headers.set("authorization", `Bearer ${token}`);
40
+ return headers;
41
+ }
42
+ async command(request) {
43
+ const body = serialize(request);
44
+ let response;
45
+ try {
46
+ response = await this.fetchImpl(this.url, {
47
+ method: "POST",
48
+ headers: await this.headers("application/json"),
49
+ body,
50
+ ...(request.signal ? { signal: request.signal } : {}),
51
+ });
52
+ }
53
+ catch (error) {
54
+ throw new AgentTransportError(request.method, describe(error));
55
+ }
56
+ const text = await response.text();
57
+ if (!response.ok)
58
+ return { ok: false, status: response.status, error: text || response.statusText };
59
+ if (text.length === 0)
60
+ return { ok: true, status: response.status, value: undefined };
61
+ try {
62
+ return { ok: true, status: response.status, value: JSON.parse(text) };
63
+ }
64
+ catch {
65
+ throw new AgentTransportError(request.method, "response body was not JSON");
66
+ }
67
+ }
68
+ async *stream(request) {
69
+ let response;
70
+ try {
71
+ response = await this.fetchImpl(this.url, {
72
+ method: "POST",
73
+ headers: await this.headers("text/event-stream"),
74
+ body: serialize(request),
75
+ ...(request.signal ? { signal: request.signal } : {}),
76
+ });
77
+ }
78
+ catch (error) {
79
+ throw new AgentTransportError(request.method, describe(error));
80
+ }
81
+ if (!response.ok) {
82
+ const text = await response.text();
83
+ throw new AgentTransportError(request.method, text || `status ${response.status}`);
84
+ }
85
+ if (response.body === null)
86
+ return;
87
+ yield* parseEventStream(response.body, request.method);
88
+ }
89
+ }
90
+ /** Parse an SSE body into protocol events, skipping any frame whose data is not a valid event. */
91
+ export async function* parseEventStream(body, method) {
92
+ const reader = body.getReader();
93
+ const decoder = new TextDecoder();
94
+ let buffer = "";
95
+ try {
96
+ for (;;) {
97
+ const chunk = await reader.read();
98
+ if (chunk.done)
99
+ break;
100
+ buffer += decoder.decode(chunk.value, { stream: true });
101
+ let boundary = buffer.indexOf("\n\n");
102
+ while (boundary !== -1) {
103
+ const frame = buffer.slice(0, boundary);
104
+ buffer = buffer.slice(boundary + 2);
105
+ const event = frameToEvent(frame);
106
+ if (event !== undefined)
107
+ yield event;
108
+ boundary = buffer.indexOf("\n\n");
109
+ }
110
+ }
111
+ }
112
+ catch (error) {
113
+ throw new AgentTransportError(method, describe(error));
114
+ }
115
+ finally {
116
+ reader.releaseLock();
117
+ }
118
+ }
119
+ function frameToEvent(frame) {
120
+ const data = frame
121
+ .split("\n")
122
+ .filter((line) => line.startsWith("data:"))
123
+ .map((line) => line.slice(5).replace(/^ /, ""))
124
+ .join("\n");
125
+ if (data.length === 0)
126
+ return undefined;
127
+ let value;
128
+ try {
129
+ value = JSON.parse(data);
130
+ }
131
+ catch {
132
+ return undefined;
133
+ }
134
+ return isAgentEvent(value) ? value : undefined;
135
+ }
136
+ function serialize(request) {
137
+ return JSON.stringify({
138
+ method: request.method,
139
+ ...(request.params === undefined ? {} : { params: request.params }),
140
+ });
141
+ }
142
+ function describe(error) {
143
+ return error instanceof Error ? error.message : String(error);
144
+ }
145
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAkCtD,+FAA+F;AAC/F,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAEjC;IADX,YACW,MAAc,EACvB,MAAc;QAEd,KAAK,CAAC,oBAAoB,MAAM,KAAK,MAAM,EAAE,CAAC,CAAA;QAHrC,WAAM,GAAN,MAAM,CAAQ;QAIvB,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED,sGAAsG;AACtG,MAAM,OAAO,kBAAkB;IACZ,GAAG,CAAQ;IACX,SAAS,CAA0B;IACnC,SAAS,CAAc;IAExC,YAAY,OAAkC;QAC5C,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YACvE,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAA;QAC9D,IAAI,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAA;QACvD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAA;QAC/C,IAAI,OAAO,KAAK,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AAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC"}
@@ -0,0 +1,283 @@
1
+ /**
2
+ * Presentation-safe projections of the agent protocol.
3
+ *
4
+ * A backend event or session snapshot carries prompt text, tool inputs and outputs, model
5
+ * completions, diagnostic reports, and filesystem paths. None of that may reach browser-facing code.
6
+ * These view models expose only stable identifiers, lifecycle statuses, counters, and opaque
7
+ * references - never the content itself. A prompt becomes a character count; a tool result becomes an
8
+ * `ok` flag and an error *code*; a compaction becomes before/after token counts. The projection is the
9
+ * boundary: an upstream consumer sees enough to render progress and resolve interactions, and nothing
10
+ * it could use to reconstruct a payload.
11
+ */
12
+ import { type AgentEvent, type AgentSessionSnapshot, type AgentSessionStatus, type BoundaryCommand, type HandoffSnapshot, type RunSnapshot } from "@nifrajs/agent-protocol";
13
+ /** A session reduced to lifecycle and capability facts. The working directory is deliberately omitted. */
14
+ export interface SessionView {
15
+ readonly id: string;
16
+ readonly backend: string;
17
+ readonly status: AgentSessionStatus;
18
+ readonly createdAt: number;
19
+ readonly updatedAt: number;
20
+ readonly lastSeq: number;
21
+ readonly activeTurnId?: string;
22
+ readonly extensionRevision?: string;
23
+ readonly capabilities: readonly string[];
24
+ }
25
+ export declare function toSessionView(snapshot: AgentSessionSnapshot): SessionView;
26
+ interface EventViewBase {
27
+ readonly kind: AgentEvent["type"];
28
+ readonly seq: number;
29
+ readonly at: number;
30
+ }
31
+ export interface SessionLifecycleView extends EventViewBase {
32
+ readonly kind: "session.started" | "session.updated" | "session.completed";
33
+ readonly session: SessionView;
34
+ }
35
+ export interface TurnStartedView extends EventViewBase {
36
+ readonly kind: "turn.started";
37
+ readonly turnId: string;
38
+ }
39
+ export interface AssistantChunkView extends EventViewBase {
40
+ readonly kind: "assistant.delta" | "assistant.message";
41
+ readonly turnId: string;
42
+ /** Length of the assistant text. The text itself is never carried. */
43
+ readonly chars: number;
44
+ }
45
+ export interface ToolStartedView extends EventViewBase {
46
+ readonly kind: "tool.started";
47
+ readonly turnId: string;
48
+ readonly callId: string;
49
+ readonly name: string;
50
+ readonly hasInput: boolean;
51
+ }
52
+ export interface ToolDeltaView extends EventViewBase {
53
+ readonly kind: "tool.delta";
54
+ readonly turnId: string;
55
+ readonly callId: string;
56
+ readonly chars: number;
57
+ }
58
+ export interface ToolCompletedView extends EventViewBase {
59
+ readonly kind: "tool.completed";
60
+ readonly turnId: string;
61
+ readonly callId: string;
62
+ readonly name: string;
63
+ readonly ok: boolean;
64
+ /** Error *code* only; the human-readable message is content and is dropped. */
65
+ readonly errorCode?: string;
66
+ }
67
+ export interface ApprovalRequiredView extends EventViewBase {
68
+ readonly kind: "approval.required";
69
+ readonly turnId: string;
70
+ readonly approvalId: string;
71
+ readonly action: string;
72
+ readonly capability: string;
73
+ }
74
+ export interface ApprovalResolvedView extends EventViewBase {
75
+ readonly kind: "approval.resolved";
76
+ readonly turnId?: string;
77
+ readonly approvalId: string;
78
+ readonly approved: boolean;
79
+ }
80
+ export interface RepairRequiredView extends EventViewBase {
81
+ readonly kind: "repair.required";
82
+ readonly turnId?: string;
83
+ readonly taskId: string;
84
+ readonly verification: "check" | "assure" | "test";
85
+ readonly capabilities: readonly string[];
86
+ }
87
+ export interface VerificationCompletedView extends EventViewBase {
88
+ readonly kind: "verification.completed";
89
+ readonly name: string;
90
+ readonly ok: boolean;
91
+ }
92
+ export interface MemoryCompactedView extends EventViewBase {
93
+ readonly kind: "memory.compacted";
94
+ readonly before: number;
95
+ readonly after: number;
96
+ readonly reason: "manual" | "threshold" | "overflow" | "workflow";
97
+ }
98
+ export interface ExtensionReloadedView extends EventViewBase {
99
+ readonly kind: "extension.reloaded";
100
+ readonly revision: string;
101
+ readonly loadedCount: number;
102
+ readonly disabledCount: number;
103
+ readonly rolledBack: boolean;
104
+ }
105
+ export interface SessionFailedView extends EventViewBase {
106
+ readonly kind: "session.failed";
107
+ readonly errorCode: string;
108
+ readonly recoverable: boolean;
109
+ }
110
+ export interface SessionStoppedView extends EventViewBase {
111
+ readonly kind: "session.stopped";
112
+ }
113
+ export type AgentEventView = SessionLifecycleView | TurnStartedView | AssistantChunkView | ToolStartedView | ToolDeltaView | ToolCompletedView | ApprovalRequiredView | ApprovalResolvedView | RepairRequiredView | VerificationCompletedView | MemoryCompactedView | ExtensionReloadedView | SessionFailedView | SessionStoppedView;
114
+ /** Project one protocol event to its content-free view. Total over the event union - never returns undefined. */
115
+ export declare function toEventView(event: AgentEvent): AgentEventView;
116
+ /** A run reduced to plan reference, lifecycle state, and progress counters - no node payloads. */
117
+ export interface RunView {
118
+ readonly runId: string;
119
+ readonly planId: string;
120
+ readonly planDigest: string;
121
+ readonly nodeCount: number;
122
+ readonly state: RunSnapshot["state"];
123
+ readonly cursor: number;
124
+ readonly total: number;
125
+ readonly completed: number;
126
+ readonly failed: number;
127
+ readonly updatedAt: number;
128
+ readonly failureCode?: string;
129
+ }
130
+ export declare function toRunView(snapshot: RunSnapshot): RunView;
131
+ /** A handoff reduced to routing identifiers and status - the reason string is content and is dropped. */
132
+ export interface HandoffView {
133
+ readonly runId: string;
134
+ readonly nodeId: string;
135
+ readonly seq: number;
136
+ readonly from: string;
137
+ readonly to: string;
138
+ readonly status: HandoffSnapshot["status"];
139
+ }
140
+ export declare function toHandoffView(snapshot: HandoffSnapshot): HandoffView;
141
+ /**
142
+ * A registry capability projected to its content-free identity card.
143
+ *
144
+ * The registry lists the invokable capabilities a host admits. A view carries only structural facts -
145
+ * kind, identifier, version, the schema *digest* (a hash, never the schema), the required capability
146
+ * tokens, and the host classes (approval, retry, idempotency, isolation). It never carries an input
147
+ * schema, a description, an instruction, a prompt, or any other content field; any such field on the
148
+ * raw record is simply dropped by the projection rather than surfaced.
149
+ */
150
+ export interface RegistryCapabilityView {
151
+ readonly kind: "tool" | "mcp-tool" | "extension" | "model-adapter" | "deployment-adapter";
152
+ readonly name: string;
153
+ readonly version: string;
154
+ readonly schemaDigest: string;
155
+ readonly requiredCapabilities: readonly string[];
156
+ readonly approval: "none" | "required" | "threshold";
157
+ /** Present only for a `threshold` approval class. A numeric level is a bound, not content. */
158
+ readonly approvalLevel?: number;
159
+ readonly retry: "none" | "idempotent";
160
+ readonly idempotency: "none" | "request" | "durable";
161
+ readonly isolation: "inherit" | "process" | "sandbox";
162
+ }
163
+ /**
164
+ * Project one raw registry descriptor to a content-free {@link RegistryCapabilityView}, or `undefined`
165
+ * when a required identifier is missing or malformed. Only whitelisted structural fields are read, so
166
+ * an unexpected content field on the record can never reach the returned view.
167
+ */
168
+ export declare function toRegistryCapabilityView(value: unknown): RegistryCapabilityView | undefined;
169
+ /** The minimal boundary facts a decision needs. A `BoundaryItemView` from the client satisfies it. */
170
+ export interface BoundaryStateView {
171
+ readonly kind: "approval" | "handoff";
172
+ readonly state: string;
173
+ /** Absolute epoch-ms expiry. At or past it, the boundary is stale and offers no command. */
174
+ readonly expiresAt: number;
175
+ }
176
+ /** True once `now` reaches or passes the boundary's expiry. A stale boundary fails every command closed. */
177
+ export declare function boundaryIsStale(item: BoundaryStateView, now: number): boolean;
178
+ /**
179
+ * The boundary commands a UI may currently offer for one item. A command appears only when the host
180
+ * has negotiated the `inbox` feature, the boundary has not expired, and the op is a legal transition
181
+ * from the boundary's live state. An unknown or terminal state yields no commands, so a stale,
182
+ * unsupported, or already-settled boundary can never present an actionable control.
183
+ */
184
+ export declare function boundaryCommands(item: BoundaryStateView, options: {
185
+ readonly inbox: boolean;
186
+ readonly now: number;
187
+ }): readonly BoundaryCommand[];
188
+ /**
189
+ * Orders events by their sequence number and suppresses duplicates before they reach the UI.
190
+ *
191
+ * A live SSE stream can redeliver an event after a reconnect, or hand two frames to a consumer out of
192
+ * order. {@link offer} returns only the events that are newly deliverable, in sequence order. Events
193
+ * whose seq was already delivered, or is already buffered, are dropped as duplicates. A bounded
194
+ * `maxPending` guards against an unbounded hole: once more than `maxPending` out-of-order events are
195
+ * held waiting for a missing seq, the buffer skips the gap to the lowest pending seq and records the
196
+ * skipped count on {@link dropped}, so a permanently lost event cannot stall the view forever.
197
+ */
198
+ export declare class OrderedEventBuffer {
199
+ private next;
200
+ private readonly pending;
201
+ private readonly maxPending;
202
+ private droppedCount;
203
+ /**
204
+ * @param options.from Last already-delivered seq; the next expected event is `from + 1`. Omit for a
205
+ * fresh buffer that adopts the first offered event's seq as its starting point.
206
+ * @param options.maxPending Out-of-order events held before the buffer skips a gap. Default 256.
207
+ */
208
+ constructor(options?: {
209
+ readonly from?: number;
210
+ readonly maxPending?: number;
211
+ });
212
+ /** Count of events skipped to recover from an unfilled gap. */
213
+ get dropped(): number;
214
+ /** Seq the buffer will emit next, or `undefined` before the first event is seen. */
215
+ get expected(): number | undefined;
216
+ offer(view: AgentEventView): readonly AgentEventView[];
217
+ private drain;
218
+ }
219
+ export type RunStudioNodeState = "pending" | "running" | "paused" | "succeeded" | "failed" | "cancelled" | "recovered";
220
+ export interface RunStudioNodeView {
221
+ readonly nodeId: string;
222
+ readonly dependsOn: readonly string[];
223
+ readonly state: RunStudioNodeState;
224
+ readonly attempt: number;
225
+ readonly retryCount: number;
226
+ readonly checkpointed: boolean;
227
+ readonly cancelled: boolean;
228
+ readonly recovered: boolean;
229
+ }
230
+ export interface RunStudioView {
231
+ readonly runId: string;
232
+ readonly planId: string;
233
+ readonly planDigest: string;
234
+ readonly cursor: number;
235
+ readonly state: RunStudioNodeState;
236
+ readonly nodes: readonly RunStudioNodeView[];
237
+ readonly activeNodes: number;
238
+ readonly terminalNodes: number;
239
+ readonly traceRef?: string;
240
+ readonly replayRef?: string;
241
+ }
242
+ export interface EvidenceTimelineView {
243
+ readonly seq: number;
244
+ readonly eventId: string;
245
+ readonly runId: string;
246
+ readonly nodeId: string;
247
+ readonly status: "started" | "checkpointed" | "retrying" | "recovered" | "completed" | "failed" | "cancelled" | "dead-lettered";
248
+ readonly attempt: number;
249
+ readonly traceRef?: string;
250
+ readonly replayRef?: string;
251
+ readonly scheduleToken?: string;
252
+ }
253
+ export type EvalComparisonViewCode = "equal" | "improved" | "tolerated" | "regressed" | "missing" | "incomparable";
254
+ export interface EvalComparisonView {
255
+ readonly suiteId: string;
256
+ readonly comparisons: readonly {
257
+ readonly caseId: string;
258
+ readonly rubricId: string;
259
+ readonly code: EvalComparisonViewCode;
260
+ readonly regressionId: string;
261
+ }[];
262
+ readonly regressionIds: readonly string[];
263
+ }
264
+ export interface FaultInjectionView {
265
+ readonly id: string;
266
+ readonly kind: string;
267
+ readonly scheduleToken: string;
268
+ readonly regressionId: string;
269
+ readonly ok: boolean;
270
+ }
271
+ /** Project an evidence-only run graph; malformed or content-bearing input is rejected. */
272
+ export declare function toRunStudioView(value: unknown): RunStudioView | undefined;
273
+ /** Drop every field except bounded timeline evidence and sort by sequence. */
274
+ export declare function toEvidenceTimelineView(value: unknown): readonly EvidenceTimelineView[];
275
+ export declare function toEvalComparisonView(value: unknown): EvalComparisonView | undefined;
276
+ export declare function toFaultInjectionViews(value: unknown): readonly FaultInjectionView[];
277
+ /** Keep browser work bounded when a run has more than 1,000 evidence rows. */
278
+ export declare function virtualizeEvidenceRows<T>(rows: readonly T[], cursor: number, windowSize?: number): {
279
+ readonly offset: number;
280
+ readonly rows: readonly T[];
281
+ };
282
+ export {};
283
+ //# sourceMappingURL=view-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-models.d.ts","sourceRoot":"","sources":["../src/view-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EAEpB,KAAK,eAAe,EAGpB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAA;AAEhC,0GAA0G;AAC1G,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,kBAAkB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