Skip to main content

onetaskgraph_core/
lib.rs

1//! The onetaskgraph engine.
2//!
3//! It drives the sources a configuration names and reports what it had to do to
4//! answer. Everything a *plugin author* needs lives in `onetaskgraph-plugin-api`
5//! instead, and **no plugin crate may depend on this one**: `deny.toml` permits
6//! this crate exactly one wrapper, the binary, failing the required `deny` job, and
7//! `scripts/check-plugin-isolation.sh` reads the real `cargo metadata` graph inside
8//! `just check`.
9//!
10//! # The invariant that shapes this crate
11//!
12//! No work data may be stored, cached, indexed or mirrored outside a plugin. The
13//! engine compensates for a missing capability *transiently*: it holds at most one
14//! source page plus the caller's page and writes nothing down. Three mechanisms
15//! enforce that rather than asking for it: `deny.toml` refuses every embedded store,
16//! index and cache crate, so reaching for one fails the required `deny` job; a sandboxed
17//! journey plants sentinels, drives every verb, and fails if one reaches any file written
18//! during the run; and a re-ask test fails if one query asked twice reaches the source
19//! once. The latter two land with the verbs they drive.
20//!
21//! The repository README is included below so its worked Rust example is compiled and
22//! executed as a doctest whenever this crate's documentation tests run.
23#![doc = include_str!(concat!(
24    env!("CARGO_MANIFEST_DIR"),
25    "/",
26    env!("CARGO_PKG_README")
27))]
28#![deny(missing_docs)]
29
30pub mod config;
31
32mod engine;
33
34mod environment;
35mod failure;
36mod global_id;
37mod plan;
38mod registry;
39mod resolve;
40mod schema;
41mod secrets;
42pub mod subprocess;
43// llmlint: ignore[code_lands_in_the_domain_that_owns_it] The task that introduced templates fixes their API at this crate's root; the head of `template/mod.rs` states why.
44pub mod template;
45
46pub use config::{Config, ConfigError, Loaded, OutputFormat, SourceConfig};
47pub use engine::{
48    Body, BudgetSpent, CommentList, ConfiguredSource, CopyAction, CopyItems, CopyLink, CopyOutcome,
49    CopyReport, CopyRequest, CopyScope, CopyVia, DeletedComment, Delivered, DeliveryOutcome,
50    DependencyRequest, DocumentFilters, DocumentRequest, Engine, EngineError, Filters,
51    LabelRequest, LeftBehind, MatchBy, MetadataSet, NoCounterpart, Paging, ProjectRequest,
52    ProjectSelector, Qualified, QualifiedEdge, QualifiedEndpoint, SearchHit, SearchKind,
53    SearchRequest, SourceListing, SourceState, Spent, TaskContentSet, TaskDetail, TaskPrioritySet,
54    TaskRequest, TaskStatusSet, TaskUpdated, settled,
55};
56pub use engine::{
57    DocumentCreate, Regenerated, Regeneration, RenderRequest, RenderTemplate, RenderedRecord,
58    TaskCreate, TaskCreated, TemplateAnswers, UnusedAnswers,
59};
60pub use environment::Environment;
61pub use failure::{Failure, FailureClass, FailureDocument, classify};
62pub use global_id::GlobalId;
63/// Named by the answer of [`TaskSource::update_task`], so it lives in the plugin api, and
64/// re-exported here because [`TaskUpdated`] reports it.
65///
66/// [`TaskSource::update_task`]: onetaskgraph_plugin_api::TaskSource::update_task
67pub use onetaskgraph_plugin_api::UpdatedField;
68pub use plan::{PageToken, Predicate, QueryPlan, QueryResponse, SourceFailure, SourcePlan};
69pub use registry::{PluginKind, plugin_for, plugin_kinds, registry};
70pub use resolve::{
71    ResolvedSource, UnavailableSource, resolve, resolve_available, validate_sources,
72};
73pub use schema::{SCHEMA_BUNDLE_VERSION, schema_bundle};
74pub use secrets::{CredentialLayer, CredentialName, ResolvedCredential, Secrets, SecretsReport};
75pub use subprocess::{
76    MAX_LINE, Program, RequestDeadline, SubprocessConfig, SubprocessPlugin, SubprocessSource,
77    serve, serve_plugin,
78};
79pub use template::{
80    Answers, ChainField, DECLARATION_KEYS, FRONT_MATTER_KEYS, ItemType, LoaderDocument,
81    RenderedTemplate, Sha256Digest, Template, TemplateError, TemplateInput, TemplateLoader,
82    TemplateProvenance, TemplateVariable, TemplateVariables, VariableType,
83};