/** * Introspection REST Client for Node.js * * Exposes the Control Plane REST surface for running runtimes and operating * experiments. Calling `client.runtimes(slug).run()` or * `client.experiments(id).run()` returns a {@link Runner} bound to a Data * Plane sandbox. * * This class is **REST-only** and does not depend on the OpenTelemetry * SDK. For event tracking, feedback, identify, and baggage context * helpers, use {@link IntrospectionLogs} from * `@introspection-sdk/introspection-node/otel`. */ import type { AdvancedOptions } from "@introspection-sdk/types"; import { EventsApi } from "@introspection-sdk/http"; import type { IntrospectionClientOptions } from "./types.js"; import { type ServiceAccountTokenParams } from "./auth.js"; import { HttpClient } from "./http.js"; import { type RuntimeHandleFactory, type RuntimesApi } from "./resources/runtimes.js"; import { type ExperimentHandleFactory, type ExperimentsApi } from "./resources/experiments.js"; import { type RecipesApi } from "./resources/recipes.js"; import { type ConnectorsApi } from "./resources/connectors.js"; import { type AnnotationsApi, type ProjectLabelsApi } from "./resources/annotations.js"; /** * Introspection REST client. * * @example * ```typescript * const client = new IntrospectionClient({ * token: process.env.INTROSPECTION_TOKEN, * }); * * // Open a runner from a runtime, then drive it. * const runner = await client.runtimes("customer-agent").run({ * identity: { user_id: "u_42" }, * }); * const run = await runner.tasks.create({ prompt: "Summarize this repo" }); * for await (const ev of run.stream()) console.log(ev.type); * * await runner.close(); * await client.shutdown(); * ``` */ export declare class IntrospectionClient { /** @internal — HTTP client pointed at the CP API with the customer key. */ readonly cpHttp: HttpClient; /** @internal — HTTP client pointed at the project Data Plane. */ readonly dpHttp: HttpClient; /** @internal — passed through to Runner so it can build its own DP HTTP client. */ readonly advancedOptions: AdvancedOptions; /** * Read/resolve `/v1/runtimes` and open a runner with the callable handle. * Runtime lifecycle, version selection, and environment routing are managed * through the Introspection CLI and platform. */ readonly runtimes: RuntimesApi & RuntimeHandleFactory; /** CRUD on `/v1/experiments` plus the callable run-lifecycle handle. */ readonly experiments: ExperimentsApi & ExperimentHandleFactory; /** * Reads on `/v1/recipes`. Recipes are immutable build artefacts * (repository + git ref + commit sha) referenced by runtimes and * experiment arms; authoring them is a CLI action. */ readonly recipes: RecipesApi; /** * CRUD on `/v1/connectors` (with connections nested under * `.connections`) plus `connectors.authorize(id)`, which mints the * single-use consent URL a Business hands its customer. */ readonly connectors: ConnectorsApi; /** Read folded span annotations and append one annotation mutation. */ readonly annotations: AnnotationsApi; /** Manage reusable project labels. */ readonly projectLabels: ProjectLabelsApi; /** Read immutable annotation activity and other typed platform events. */ readonly events: EventsApi; constructor(options?: IntrospectionClientOptions); /** * Authenticate as a confidential service account and return a ready * client. * * Mints a short-lived, project-scoped CP access token via the * `client_credentials` grant (see {@link serviceAccountToken}) and wires * it in as the bearer token, so the runtime flow works exactly as it does * with an API key: * * @example * ```typescript * const client = await IntrospectionClient.fromServiceAccount({ * clientId: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_ID!, * clientSecret: process.env.INTROSPECTION_SERVICE_ACCOUNT_CLIENT_SECRET!, * project: process.env.INTRO_PROJECT!, * }); * * // Resolved fresh from the runtime slug on every call. * const runner = await client.runtimes("customer-agent").run({ * identity: { user_id: "u_demo" }, * }); * ``` * * The token is not auto-refreshed: it lives for `expires_in` seconds, so * re-mint (call this again) for long-lived processes once it lapses. */ static fromServiceAccount(params: ServiceAccountTokenParams & { serviceName?: string; }): Promise; /** Close the underlying HTTP client. */ shutdown(): Promise; } //# sourceMappingURL=client.d.ts.map