ConversionOrchestrator.h header

#include <ew/app/ConversionOrchestrator.h>

Namespace ew::app

ConversionExistingNames struct

struct ew::app::ConversionExistingNames

The names already present in the open project, so every stage's proposals dedup against them (docs/AI_FOLDER_CONVERSION.md §3 – trimmed, case-insensitive via sameProposalName). Leave a list empty when the project has none of that family.

Members

QStringList ew::app::ConversionExistingNames::entities

Existing codex entity names (plus aliases, at the caller's discretion).

QStringList ew::app::ConversionExistingNames::timelineEvents

Existing timeline event titles.

QStringList ew::app::ConversionExistingNames::sheets

Existing spreadsheet titles.

QStringList ew::app::ConversionExistingNames::sources

Existing research source titles.

QStringList ew::app::ConversionExistingNames::tasks

Existing task titles.

QStringList ew::app::ConversionExistingNames::plotThreads

Existing plot thread names.

QStringList ew::app::ConversionExistingNames::statBlocks

Existing stat block names.

QStringList ew::app::ConversionExistingNames::rollTables

Existing random/roll table titles.

ConversionGmJudgement struct

struct ew::app::ConversionGmJudgement

One file the long-tail stage judged to be game-master-only material, with its evidence, so the apply stage routes that file's note into an audience-restricted destination.

Members

QString ew::app::ConversionGmJudgement::relativePath

The file's forward-slash path relative to the converted folder.

QString ew::app::ConversionGmJudgement::reason

The stage's one-sentence evidence ("Says the players must not know."); may be empty.

bool ew::app::ConversionGmJudgement::operator==(const ConversionGmJudgement &) const =default

Compares equal when every field matches.

ConversionOptions struct

struct ew::app::ConversionOptions

The run's mode and callbacks. The engine is blocking (BatchAi pattern) – call it off the GUI thread; every callback is invoked on the calling (worker) thread.

Members

ConversionMode ew::app::ConversionOptions::mode =

Supervised asks askQuestion; Autonomous takes recommended defaults.

std::function<int(const ConversionQuestion&)> ew::app::ConversionOptions::askQuestion

Supervised-mode question resolver returning the chosen option index. An absent resolver, or an out-of-range answer, falls back to the recommended default.

std::function<void(int done, int total, const QString& activity)> ew::app::ConversionOptions::progress

Optional progress: done of total AI calls completed, activity a short "Stage: file" label for the one about to run.

std::function<bool()> ew::app::ConversionOptions::cancelled

Optional cancellation poll, checked before every AI call; returning true ends the run with partial results and ConversionProposal::cancelled set.

qsizetype ew::app::ConversionOptions::chunkSize = 8000

Maximum characters per AI chunk (paragraph-aligned; see chunkConversionText).

ConversionProposal struct

struct ew::app::ConversionProposal

Everything one conversion run proposes, ready for the wizard's per-stage review (supervised) or a single apply (autonomous). Proposals are deduplicated against the existing project and each other; nothing the folder contained is silently dropped – whatever was not converted is in the report with its reason.

Members

std::vector<ConvertedEntity> ew::app::ConversionProposal::entities

Proposed codex entities (name/category/summary/aliases/fields).

std::vector<ConvertedEntityDetails> ew::app::ConversionProposal::details

Proposed relationships/lifespans/state-over-time, merged per entity across chunks.

ConvertedTimeline ew::app::ConversionProposal::timeline

Proposed timeline events, eras, and the calendar hint (merged across chunks).

std::vector<ConvertedSheet> ew::app::ConversionProposal::sheets

Proposed spreadsheets extracted from list-like text (CSV/TSV files ingest directly and are in spreadsheetImports instead).

std::vector<ConvertedMediaMatch> ew::app::ConversionProposal::mediaMatches

Proposed image placements (gallery/cover/caption or map backdrop).

std::vector<ConvertedSource> ew::app::ConversionProposal::sources

Proposed research sources (bibliographies plus PDFs kept as references).

std::vector<ConvertedTask> ew::app::ConversionProposal::tasks

Proposed tasks.

std::vector<ConvertedPlotThread> ew::app::ConversionProposal::plotThreads

Proposed plot threads.

std::vector<ConversionTtrpgCapture> ew::app::ConversionProposal::ttrpg

Proposed conlang/stat-block/roll-table captures, one entry per contributing file.

std::vector<ConversionGmJudgement> ew::app::ConversionProposal::gmOnly

Files judged game-master-only (route their notes audience-restricted).

std::vector<ConvertedPdfText> ew::app::ConversionProposal::pdfConversions

PDFs resolved to Convert, with their extracted text (become documents on apply).

QStringList ew::app::ConversionProposal::proseImports

Prose/chronology files to import as documents (relative paths).

QStringList ew::app::ConversionProposal::screenplayImports

Screenplay files to import via the Fountain/.fdx importers (relative paths).

QStringList ew::app::ConversionProposal::spreadsheetImports

CSV/TSV files to ingest directly as spreadsheets, no AI (relative paths).

QStringList ew::app::ConversionProposal::assetImports

Media/asset files to import into the media library (relative paths) – every image plus every PDF kept as a reference.

QStringList ew::app::ConversionProposal::noteImports

Unclassifiable files to import as plain Notes (relative paths).

std::vector<ConversionQuestion> ew::app::ConversionProposal::questions

Every question the run raised, with ConversionQuestion::chosenOption resolved.

ConversionReport ew::app::ConversionProposal::report

The full record of what happened (also shown/saved by the wizard).

TokenUsage ew::app::ConversionProposal::usage

Token usage summed across every AI call the run made.

bool ew::app::ConversionProposal::cancelled = false

True when ConversionOptions::cancelled stopped the run early (partial results).

ConversionTtrpgCapture struct

struct ew::app::ConversionTtrpgCapture

One file's conlang/stat-block/roll-table capture. The file is carried so the apply stage can fall back to its stem when the capture names no language (see ConvertedTtrpg::languageName).

Members

QString ew::app::ConversionTtrpgCapture::relativePath

The contributing file's forward-slash path relative to the converted folder.

ConvertedTtrpg ew::app::ConversionTtrpgCapture::capture

What the TTRPG stage extracted from it (duplicates already collapsed run-wide).

bool ew::app::ConversionTtrpgCapture::operator==(const ConversionTtrpgCapture &) const =default

Compares equal when every field matches.

ConvertedPdfText struct

struct ew::app::ConvertedPdfText

A PDF whose disposition resolved to Convert, with its extracted text: the apply stage turns it into a document exactly like an imported prose file (the text also fed the AI stages).

Members

QString ew::app::ConvertedPdfText::relativePath

The PDF's forward-slash path relative to the converted folder.

QString ew::app::ConvertedPdfText::text

The extracted text (pages joined by blank lines).

bool ew::app::ConvertedPdfText::operator==(const ConvertedPdfText &) const =default

Compares equal when every field matches.

Enumerations

enum class ConversionMode { Supervised, Autonomous }

How the conversion resolves its questions (docs/AI_FOLDER_CONVERSION.md §1): Supervised asks through ConversionOptions::askQuestion; Autonomous takes every recommended default and only logs the choice in the report.

Functions

QStringList ew::app::chunkConversionText(const QString &text, qsizetype maxChars)

Splits text into chunks of at most maxChars, cutting on paragraph boundaries (blank lines) where possible and hard-splitting only a single over-long paragraph. Trimmed-empty text yields no chunks. Pure.

ConversionProposal ew::app::runFolderConversion(const QString &folder, const ConversionExistingNames &existing, AiProvider &provider, const ConversionOptions &options)

Runs the whole conversion pipeline over folder (docs/AI_FOLDER_CONVERSION.md §4 C12): scan/classify, resolve the disposition questions (per PDF, and map-vs-art per map-named image), then drive provider through the extraction stages – entities first so every later stage knows the full name set, then details/timeline/sheets/long-tail per prose chunk, the TTRPG stage per flagged file, and one media-matching call – deduplicating every family against existing and prior chunks. AI-call failures and unreadable files are reported and skipped, never fatal. Blocking; call off the GUI thread.