/** * G2.1 — `agentsmarket pipeline install [@]` — fetch a * pipeline bundle from the marketplace and write it under * `${AGENTSMARKET_PIPELINES_DIR}/@/`. * * Replaces the F28/F29 era YAML-only fetch + bundled-pipeline fallback. * New flow (Day 49): * * 1. Parse `[@]` argument (D2 syntax). * 2. POST /v1/pipelines/install {slug, version} to obtain a signed bundle URL * (G1.6). Auth required (server enforces). * 3. Download the zip (no auth headers — URL is HMAC-signed). * 4. Verify SHA-256 of the zip bytes matches the `sha256` field returned by * the install endpoint (mitigates MITM + corruption). * 5. Extract the zip into `.agentsmarket/pipelines/@/`. * - pipeline.yaml (required) * - README.md (optional — name taken from server's * `description_file_name`) * - metadata.json (optional — written next to pipeline.yaml so * consumers can read author/license without * re-hitting the server) * 6. Validate pipeline.yaml with `validatePipelineSpec` (rejects at install * time so bad pipelines never reach `agentsmarket pipeline call`). * 7. Update `pipeline.lock.yaml` at the install root with the resolved * version + sha256 + spec_hash. Idempotent re-installs update in place. * * Errors surface as ✗ + exit 1 (consistent with the rest of the CLI). * * When the server-side install endpoint is not yet deployed (G1 still in * progress), the CLI emits a clean "server endpoint missing" exit. Real-server * integration tests land after G1 merges; the current tests exercise the * full path against a mocked `fetch()` + a synthetic zip. */ import { authedJson } from '../../lib/http.js'; import { validatePipelineSpec } from '../../lib/pipeline-spec.js'; import { buildVariantDPayment } from '../../lib/variant-d-payment.js'; import { tryLoadIdentity } from '../call.js'; export interface ParsedSlug { slug: string; version: string | null; } export declare function parseSlugArg(raw: string): ParsedSlug; export declare class InstallArgError extends Error { readonly code: 'INSTALL_ARG_ERROR'; constructor(message: string); } export declare class InstallError extends Error { readonly code: string; constructor(code: string, message: string); } export interface InstallDeps { fetch?: typeof fetch; authedJson?: typeof authedJson; validatePipelineSpec?: typeof validatePipelineSpec; now?: () => Date; stderr?: (line: string) => void; stdout?: (line: string) => void; exit?: (code: number) => never; /** Signing a permit reads the token's on-chain nonce, so it is a seam. */ buildPayment?: typeof buildVariantDPayment; /** The buyer's key, also a seam: the tests have no identity on disk. */ loadIdentity?: typeof tryLoadIdentity; } export declare function pipelineInstallCommand(arg: string, depsOverrides?: InstallDeps, opts?: { force?: boolean; }): Promise;