/** * Runtime asset resolution — read `skaile.yaml`, scan all declared repositories * (including the built-in `factory-assets/` directory as an implicit default), * and produce a unified view of connector catalog entries plus the implicit refs * that the `skaile.yaml` `connectors:` section adds to the dependency graph. * * This module is the single source of truth for "which connectors does this * project see at runtime, and where do their implementations live on disk". * Both the runner (serve, REPL, flow) and the platform's mid-session * `add_resource` flow consume `RuntimeAssetsResult.catalogEntries` and pass * it into `ConnectorManager` for catalog-based resolution. * * `factory-assets/` is the single first-party content tree (built-in connectors * + first-party skills + bundles) shipped inside the `@skaile/workspaces` * package — not a standalone package. * * It resolves to an **ordered list of roots** ({@link factoryAssetRoots}), not a * single dir. The bundled tree is always the baseline; an optional * `SKAILE_FACTORY_ASSETS_DIR` (legacy: `SKAILE_BASE_ASSETS_DIR`) is layered * **in front** as an additive override source — the agent container points it at * `/app/factory-assets/` (or a bind-mounted host dir) to ship updated skills / * flows / bundles / connector manifests without rebuilding the image. The two * roots resolve uniformly across every consumer (connector catalog scan, skill / * flow / completion discovery, the asset-manager factory source): * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir, when set and existing (override layer). * 2. the bundled tree via {@link resolvePackagedAssetsDir} — the in-repo source * `packages/workspaces/factory-assets/` during dev, else the published * `dist/factory-assets/` after install (always-present baseline). * * Override semantics are **env-first**: on a name conflict the env root wins and * the bundled root fills the rest. Connector *code* still loads via the package's * static `exports` map, so the env root can override/add skills, flows, bundles, * and connector **manifests/metadata**, but cannot ship a new executable * connector — its `.js` is not on the package's import graph. */ import type { CatalogEntry } from "./models.js"; /** * Catalog entry filtered to mount/connector kinds. Same shape as `CatalogEntry`. * @docLink packages/core/concepts#runtime-catalog-entry */ export type RuntimeCatalogEntry = CatalogEntry; /** * Implicit catalog reference derived from a `connectors:` declaration in `skaile.yaml`. * Each connector driver becomes an implicit ref that must be resolved in the catalog. * @docLink packages/core/concepts#runtime-asset-ref */ export interface RuntimeAssetRef { kind: "connector"; /** Driver name — matches `RuntimeCatalogEntry.name`. */ name: string; /** Source declaration id from `skaile.yaml`. */ declarationId: string; } /** * Aggregated npm packages required by all resolved mount/connector adapters. * Populated from `metadata.npm_deps` in each matched catalog entry. * @docLink packages/core/concepts#runtime-npm-deps */ export interface RuntimeNpmDeps { required: string[]; optional: string[]; } /** * Non-fatal warning emitted during `resolveRuntimeAssets` when a repo is unavailable * or a driver is not found in any catalog. * @docLink packages/core/concepts#runtime-asset-warning */ export interface RuntimeAssetWarning { /** Stable code for filtering / structured logging. */ code: "missing_driver" | "repo_unavailable" | "invalid_repo_decl"; message: string; /** Declaration id when applicable. */ declarationId?: string; /** Driver / repository name when applicable. */ name?: string; } /** * Repository name used for the implicit built-in `factory-assets` catalog entry * (the in-package connector tree). * @docLink packages/core/concepts#factory-assets-repo-name */ export declare const FACTORY_ASSETS_REPO_NAME = "factory-assets"; /** * Result of `resolveRuntimeAssets`. * The same object is mutated in place by `refresh()`, allowing callers to hold * a stable reference and observe updates after a new repository is cloned or * a driver is installed mid-session. * @docLink packages/core/concepts#runtime-assets-result */ export interface RuntimeAssetsResult { catalogEntries: RuntimeCatalogEntry[]; implicitRefs: RuntimeAssetRef[]; requiredNpmDeps: RuntimeNpmDeps; warnings: RuntimeAssetWarning[]; /** Re-scan repositories and re-derive implicit refs. Mutates in place. */ refresh(): Promise; /** * Catalog lookup. When `kind` is omitted and multiple entries share the * `name`, returns `undefined` (caller must disambiguate). */ findEntry(query: { kind?: "connector"; name: string; }): RuntimeCatalogEntry | undefined; } /** * Resolve all runtime assets visible to a project by scanning declared repositories. * * Reads `skaile.yaml`, scans every declared repository (plus the implicit * built-in `factory-assets` repo), and derives implicit refs from `mounts:` / * `connectors:` declarations. Does not clone or install anything — purely a * read-only scan of what is already on disk. URL-only repositories that have * not been cloned yet are reported as `repo_unavailable` warnings. * * @param projectDir - Absolute path to the project workspace root * @returns `RuntimeAssetsResult` with catalog entries, implicit refs, npm deps, and warnings * @docLink packages/core/concepts#resolve-runtime-assets */ export declare function resolveRuntimeAssets(projectDir: string): Promise; /** * Resolve the ordered list of on-disk roots for the built-in `factory-assets` * tree (built-in connectors + first-party skills + bundles). This is the single * shared resolver every consumer goes through, so the env override and the * bundled baseline are honoured uniformly. * * Order (env-first = override-wins): * 1. `SKAILE_FACTORY_ASSETS_DIR` env dir (legacy: `SKAILE_BASE_ASSETS_DIR`), * when set and existing — an additive override layer. * 2. {@link resolvePackagedAssetsDir} — the bundled tree (in-repo source in dev, * `dist/factory-assets/` after install). Always-present baseline. * * Returns `[]` only when the package cannot be located at all. De-duplicated, so * pointing the env var at the bundled dir collapses to one root. * * @docLink packages/core/concepts#resolve-factory-assets-root */ export declare function factoryAssetRoots(): string[]; /** * Resolve the primary on-disk root of the `factory-assets` tree — the first of * {@link factoryAssetRoots} (the env override when set, else the bundled tree). * Prefer {@link factoryAssetRoots} when you need to scan every layer; this * single-dir form is for callers that want one canonical path. * * @returns Absolute path to the highest-precedence `factory-assets` directory * @throws When no root can be located * @docLink packages/core/concepts#resolve-factory-assets-root */ export declare function resolveFactoryAssetsRoot(): string; /** * Non-throwing variant of {@link resolveFactoryAssetsRoot}: the same * env-then-packaged resolution tiers, returning `null` instead of throwing when * none locate the directory. Callers that treat a missing factory tree as a * soft "not present" (e.g. the asset-manager's implicit-source injection) MUST * use this so they honour the `SKAILE_FACTORY_ASSETS_DIR` container override * identically to the runtime path. */ export declare function resolveFactoryAssetsRootOrNull(): string | null; export declare function resolveWorkspacesPackageRoot(): string | null; /** * Locate a content-asset directory inside the package. Prefers the in-repo * **source** dir `/` when present — in a dev checkout it is the * full tree (e.g. `factory-assets/` keeps the connector `.ts` entry files that * `dist/` does not) — then the published `dist/` copy (what * `files: ["dist"]` ships, the only one present after `npm i`). Returns `null` * when neither exists. * * `factory-assets/` resolves to the source tree in dev (code + skills + bundles) * and to `dist/factory-assets` post-install (compiled connectors + copied * manifests/skills/bundles). * * @param subdir - `"factory-assets"` | … * @docLink packages/core/concepts#resolve-factory-assets-root */ export declare function resolvePackagedAssetsDir(subdir: string): string | null; //# sourceMappingURL=runtime-assets.d.ts.map