/** * Serve-time enrichment of linked agents (slug + build status) from the * Agents API. `listVisible()`: one tenant-scoped list per pass; the engine * 404s foreign ids, so callers intersect instead of asking per id. * `resolveMetadata()`: per-id detail, for ids the list proved visible. * Slugs are cached (stable); failed lookups retain only a display bit. * * Mirrors `@sapiom/tools`'s DEFAULT_BASE_URL for the base URL resolution. */ /** Returns the agents API base URL, honouring the same env-var precedence as * @sapiom/tools's DEFAULT_BASE_URL. */ export declare function resolveAgentsBaseUrl(): string; /** * Resolve the CORE surface base URL (`api.`), distinct from the agents * host (`tools.`) resolved above. A run lives in the agents env, and any * core-surface call for that run must target the MATCHING core env — otherwise * a prod run queried against dev 401s. So we DERIVE the core host from the * agents host (`tools.` → `api.`) rather than reading * `SAPIOM_API_URL`, which in some setups points at a different env than the * agents surface. An explicit `SAPIOM_CORE_URL` still wins for full control. * * Co-located with {@link resolveAgentsBaseUrl} (its sole dependency) so the two * env-precedence helpers live together. */ export declare function resolveCoreBaseUrl(): string; export interface DefinitionMetadata { slug: string | null; activeBuildRunId: string | null; activeBuildRunStatus: string | null; } export type DefinitionMetadataResult = { status: "available"; metadata: DefinitionMetadata; } | { status: "not-found"; } | { status: "unavailable"; lastConfirmedDeployed: boolean | null; }; /** One list pass: the account's visible definitions, or the retained display * bits when the list could not be read (signed out, outage, stale scope). */ export type DefinitionListResult = { status: "available"; visible: ReadonlyMap; } | { status: "unavailable"; lastConfirmedDeployed: ReadonlyMap; }; export interface DefinitionSlugResolver { resolve(definitionId: string): Promise; /** Fetch mutable definition metadata. Unlike the stable slug lookup, build * state is deliberately not cached so a completed build becomes visible. * Ask only for ids {@link listVisible} proved visible: anything else 404s. */ resolveMetadata(definitionId: string): Promise; /** One tenant-scoped list request. The engine returns the account's full * set, unpaginated: absence = not visible. Single-flight per api key; a * key change during the request yields "unavailable". */ listVisible(): Promise; invalidate(): void; } /** * Resolver over `GET /agents/v1/definitions` (list) and `/definitions/` * (detail). Never throws. Failed checks retain only a scoped display bit; * they never return cached runnable build fields. */ export declare function createDefinitionSlugResolver(opts: { /** A getter keeps enrichment working when the user signs in after boot. */ apiKey: string | null | (() => string | null); baseUrl?: string; /** Injectable for unit tests; defaults to the global `fetch`. */ fetchImpl?: typeof fetch; }): DefinitionSlugResolver; //# sourceMappingURL=definition-slug-resolver.d.ts.map