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
30mod clock;
31pub mod config;
32
33mod engine;
34
35mod environment;
36mod failure;
37mod global_id;
38mod plan;
39mod registry;
40mod resolve;
41mod schema;
42mod secrets;
43pub mod subprocess;
44// 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.
45pub mod template;
46
47pub use clock::{
48    ClockChoice, SIMULATED_CLOCK_VARIABLE, attach as attach_simulated_clock, clock_choice,
49    process_clock,
50};
51pub use config::{Config, ConfigError, Loaded, OutputFormat, SourceConfig};
52pub use engine::{
53    Body, BudgetSpent, CommentList, ConfiguredSource, CopyAction, CopyItems, CopyLink, CopyLookup,
54    CopyOutcome, CopyReport, CopyRequest, CopyScope, CopyVia, DeletedComment, Delivered,
55    DeliveryOutcome, DependencyRequest, DocumentDetail, DocumentFilters, DocumentRequest, Engine,
56    EngineError, Filters, LabelRequest, LeftBehind, MatchBy, MetadataSet, NoCounterpart, Paging,
57    ProjectRequest, ProjectSelector, Qualified, QualifiedEdge, QualifiedEndpoint, SearchHit,
58    SearchKind, SearchRequest, SourceListing, SourceState, Spent, TaskContentSet, TaskDetail,
59    TaskDetails, TaskPrioritySet, TaskRequest, TaskStatusSet, TaskUpdated, settled,
60};
61pub use engine::{
62    DocumentCreate, ProjectCreate, Regenerated, Regeneration, RenderRequest, RenderTemplate,
63    RenderedRecord, TaskCreate, TaskCreated, TemplateAnswers, UnusedAnswers,
64};
65pub use environment::Environment;
66pub use failure::{Failure, FailureClass, FailureDocument, classify};
67pub use global_id::GlobalId;
68/// Named by the answer of [`TaskSource::update_task`], so it lives in the plugin api, and
69/// re-exported here because [`TaskUpdated`] reports it.
70///
71/// [`TaskSource::update_task`]: onetaskgraph_plugin_api::TaskSource::update_task
72pub use onetaskgraph_plugin_api::UpdatedField;
73pub use plan::{PageToken, Predicate, QueryPlan, QueryResponse, SourceFailure, SourcePlan};
74pub use registry::{PluginKind, plugin_for, plugin_kinds, registry};
75pub use resolve::{
76    ResolvedSource, UnavailableSource, resolve, resolve_available, resolve_available_with_clock,
77    validate_sources,
78};
79pub use schema::{SCHEMA_BUNDLE_VERSION, schema_bundle};
80pub use secrets::{CredentialLayer, CredentialName, ResolvedCredential, Secrets, SecretsReport};
81pub use subprocess::{
82    MAX_LINE, Program, RequestDeadline, SubprocessConfig, SubprocessPlugin, SubprocessSource,
83    serve, serve_plugin,
84};
85pub use template::{
86    Answers, ChainField, DECLARATION_KEYS, FRONT_MATTER_KEYS, ItemType, LoaderDocument,
87    RenderedTemplate, Sha256Digest, Template, TemplateError, TemplateInput, TemplateLoader,
88    TemplateProvenance, TemplateVariable, TemplateVariables, VariableType,
89};