luplo.core.import_pipeline.begin

Phase 1 — open work_unit, build manifest, return to caller.

luplo’s job ends after returning the manifest. The agent owns extraction and verification; finalize accepts the results back. The pipeline is filesystem-free: callers (CLI, MCP, slash command) supply file content inline as SourceFile objects via luplo.core.import_pipeline.sources.make_source_file(). See that module for the rationale.

Classes

BeginResult

Outcome of begin_import.

Functions

begin_import(→ BeginResult)

Open a new import bundle (work_unit + manifest) and return to caller.

Module Contents

class luplo.core.import_pipeline.begin.BeginResult

Outcome of begin_import.

kind

Either "manifest" (success) or "refusal" (dedup hit).

manifest

The emitted manifest when kind == "manifest".

refusal

The 3-layer refusal payload when kind == "refusal".

kind: str
manifest: luplo.core.import_pipeline.manifest.ImportManifest | None = None
refusal: dict[str, str] | None = None
async luplo.core.import_pipeline.begin.begin_import(*, backend: luplo.core.backend.protocol.Backend, project_id: str, actor_id: str, spec: luplo.core.import_pipeline.manifest.SourceFile | None, plan: luplo.core.import_pipeline.manifest.SourceFile | None, dest_lang: str | None, repo_root: str, force: bool) BeginResult

Open a new import bundle (work_unit + manifest) and return to caller.

Dedups against any prior non-archived import work_unit whose stored content_hash_set matches the caller’s. Either:

  • returns a refusal payload when a duplicate exists and force is False,

  • archives the prior work_unit (when force is True) and opens a new one,

  • or simply opens a new work_unit when nothing prior exists.

Parameters:
  • backend – The luplo Backend (Local or Remote).

  • project_id – Project owning the import.

  • actor_id – Caller’s actor UUID; recorded as the work_unit creator.

  • spec – Optional spec SourceFile (path + content; caller already read the file).

  • plan – Optional plan SourceFile (path + content; caller already read the file).

  • dest_lang – ISO 639-1 target language, or None to preserve source.

  • repo_root – Project root path string. Stored verbatim in the manifest for the agent’s later use during code verification; the server never resolves or opens it.

  • force – When True, archive any prior import for the same content set.

Returns:

A BeginResult carrying either a manifest or a refusal payload.

Raises:

ValueError – When neither spec nor plan is provided.