@archastro/sdk
    Preparing search index...
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Start an extraction Records a text-extraction job for a document (file) or a URL (url + mode). The job is owner-scoped and tagged with the caller-supplied destination namespace, without committing knowledge to an agent (no embeddings, no agent attach). Exactly one of file or (url + mode) is required. Document extraction (file) runs synchronously: the response already reflects the final state (done with its output, or an error if extraction couldn't complete), status 201. URL extraction (url + mode) submits an async crawl and returns immediately with state running, status 202 — poll GET /extractions/:extraction for its terminal state.

      Parameters

      • input: {
            agent?: string;
            destination_kind: "config" | "storage";
            destination_path?: string;
            file?: string;
            max_pages?: number;
            mode?: "link" | "site";
            org?: string;
            url?: string;
        }

        Request body.

        • Optionalagent?: string

          Owning agent (agt_...) — scopes the extraction and its outputs.

        • destination_kind: "config" | "storage"

          Where outputs are written.

        • Optionaldestination_path?: string

          Destination virtual_path prefix. Required for destination_kind=config, where it must name at least one path segment (. and .. segments are dropped).

        • Optionalfile?: string

          Source file id (fil_...) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected.

        • Optionalmax_pages?: number

          Crawl cap for mode=site — must be at least 1 (defaults to 100; link is always 1).

        • Optionalmode?: "link" | "site"

          Required with url. Document extraction is selected by file instead and takes no mode (its kind is document).

        • Optionalorg?: string

          Owning organization (org_...). Defaults to the viewer's org.

        • Optionalurl?: string

          Source URL for link/site extraction.

      Returns Promise<Extraction>

      The extraction job. Document extraction returns 201 with state: "done"; link/site extraction returns 202 with state: "running".

    • Retrieve an extraction Returns a single extraction job and its current state. Poll this endpoint after starting an async (link/site) extraction until state is done or failed. An extraction that exists but is not visible to the current viewer returns 404 rather than 403, so the resource's existence is not revealed.

      Parameters

      • extraction: string

        Extraction ID (ext_...).

      Returns Promise<Extraction>

      The extraction job.