import { type RunnerContext, type RunnerDeployment, type RunnerSpec, type RunRequest, type Uuid } from "@introspection-sdk/types"; import { ConversationsApi, EventsApi, FilesApi, MetricsApi, SharesApi, TasksApi } from "@introspection-sdk/http"; import type { IntrospectionClient } from "./client.js"; /** * Where this Runner came from, so `refresh()` can call CP again with the * same arguments to obtain a fresh `RunnerSpec` (manual escape hatch only; * not auto-scheduled). */ export type RunnerSource = { kind: "runtime"; id: Uuid; options?: RunRequest; } | { kind: "experiment"; id: Uuid; options?: RunRequest; }; /** * Live handle to a Data Plane sandbox. Holds the bearer JWT, the DP * endpoint URL, and the runtime/experiment context, and exposes the * runner-bound `tasks`, `files`, `conversations`, `events`, and * `metrics` namespaces (the telemetry reads are Data-Plane-scoped and so * hang off the runner, which carries the DP bearer + `events:read`). * * In v1 of the agent-session-based design, token refresh is handled * server-side by the DP materializer attached to the agent session — the * SDK does NOT auto-refresh and does NOT install a 401 safety-net. The * `refresh()` method is kept as a manual escape hatch that re-calls the * CP `/run` route to mint a brand-new spec. */ export declare class Runner { private readonly client; private readonly source; private spec; private http; private closed; readonly tasks: TasksApi; readonly files: FilesApi; readonly conversations: ConversationsApi; readonly events: EventsApi; readonly metrics: MetricsApi; readonly shares: SharesApi; constructor(client: IntrospectionClient, source: RunnerSource, spec: RunnerSpec); /** DP REST base URL the runner is bound to. */ get dpEndpoint(): string; /** Routing target — DP endpoint / slug / region. */ get deployment(): Readonly; /** Session lifetime (ISO-8601 string). */ get expires_at(): string; /** Session ID assigned by CP. */ get session_id(): string; /** Resolved runtime / arm / recipe / identity / caller context. */ get context(): Readonly; /** True once `close()` has been called. */ get isClosed(): boolean; /** * Manual escape hatch: re-call CP `/v1/runtimes/{id}/run` or * `/v1/experiments/{id}/run` with the original `RunRequest` and replace * this runner's in-memory spec with a fresh one. * * Not auto-scheduled — in v1 the DP materializer refreshes the * underlying access token transparently for the agent-session-backed * runner. Call this only if you have an explicit reason to mint a new * session (e.g. you held a runner across a very long pause). */ refresh(): Promise; /** * Best-effort close — flips a local `isClosed` flag so subsequent * `runner.tasks` / `runner.files` / `runner.conversations` calls * throw a friendly error. No * server-side revoke is performed; future work will route a revoke via * the CP locator-token path. */ close(): Promise; private buildHttp; /** * A stable handle over whatever client the runner currently holds. * * The namespaces (`runner.tasks`, …) are built once in the constructor and * handed out by reference, so they must not capture a client: they read * `this.http` per call, which is what lets {@link refresh} repoint them. * Calls after `close()` fail with a clear `RunnerExpiredError` instead of * hitting the network with a stale bearer. No 401 retry / refresh logic -- * that is the DP materializer's job in v1. */ private guardedHttp; private assertOpen; private requestFreshSpec; } //# sourceMappingURL=runner.d.ts.map