1#![cfg_attr(target_arch = "wasm32", allow(unused_imports))]
2
3#[cfg(target_arch = "wasm32")]
4pub mod tokio {
5 pub use tokio_with_wasm::alias::*;
6}
7
8#[cfg(not(target_arch = "wasm32"))]
9pub use ::tokio;
10
11mod error;
12mod machine;
13pub(crate) mod machines;
14mod rest_contract;
15mod service;
16mod store;
17mod surface;
18mod tool_surface;
19mod tools;
20mod types;
21
22pub use error::WorkGraphError;
23pub use machine::WorkGraphMachine;
24pub use rest_contract::{
25 WORKGRAPH_REST_PATHS, WorkGraphRestOperationDescriptor, WorkGraphRestPathDescriptor,
26 WorkGraphRestRoute, workgraph_rest_path_catalog, workgraph_rest_response_schema,
27};
28pub use service::WorkGraphService;
29#[cfg(not(target_arch = "wasm32"))]
30pub use store::SqliteWorkGraphStore;
31pub use store::{
32 DisabledWorkGraphStore, MemoryWorkGraphStore, WorkGraphEventFilter, WorkGraphStore,
33 WorkGraphStoreKind,
34};
35pub use surface::wire_workgraph_tools;
36pub use tool_surface::WorkGraphToolSurface;
37pub use tools::{
38 CAPABILITY_UNAVAILABLE as WORKGRAPH_TOOL_CAPABILITY_UNAVAILABLE,
39 INVALID_ARGUMENTS as WORKGRAPH_TOOL_INVALID_ARGUMENTS, NOT_FOUND as WORKGRAPH_TOOL_NOT_FOUND,
40 WorkGraphToolError, handle_workgraph_tools_call, workgraph_tools_list,
41};
42pub use types::{
43 AddEvidenceRequest, ClaimWorkItemRequest, CloseWorkItemRequest, CreateWorkItemRequest,
44 ExternalWorkRef, LinkWorkItemsRequest, ReadyWorkFilter, ReleaseWorkItemRequest,
45 UpdateWorkItemRequest, WorkClaim, WorkEdge, WorkEdgeKind, WorkEvidenceRef, WorkGraphEvent,
46 WorkGraphEventKind, WorkGraphEventsResponse, WorkGraphItemsResponse, WorkGraphMachineState,
47 WorkGraphSnapshot, WorkGraphSnapshotFilter, WorkItem, WorkItemFilter, WorkItemId,
48 WorkNamespace, WorkOwner, WorkOwnerKey, WorkOwnerKind, WorkPriority, WorkStatus,
49};
50
51pub const WORKGRAPH_CAPABILITY_DISABLED_DESCRIPTION: &str =
52 "config.tools.workgraph_enabled is false";
53
54pub fn workgraph_capability_enabled(config: &meerkat_core::Config) -> bool {
55 config.tools.workgraph_enabled
56}
57
58pub const WORKGRAPH_CAPABILITY_POLICY: meerkat_capabilities::FeatureCapabilityPolicy =
59 meerkat_capabilities::FeatureCapabilityPolicy::new(
60 workgraph_capability_enabled,
61 WORKGRAPH_CAPABILITY_DISABLED_DESCRIPTION,
62 );
63
64pub const fn workgraph_capability_policy() -> meerkat_capabilities::FeatureCapabilityPolicy {
65 WORKGRAPH_CAPABILITY_POLICY
66}
67
68inventory::submit! {
69 meerkat_capabilities::CapabilityRegistration {
70 id: meerkat_capabilities::CapabilityId::WorkGraph,
71 description: "Realm-scoped dependency-aware durable work graph",
72 scope: meerkat_capabilities::CapabilityScope::Universal,
73 requires_feature: None,
74 prerequisites: &[],
75 status_resolver: Some(|config| {
76 let policy = crate::workgraph_capability_policy();
77 if policy.is_enabled(config) {
78 meerkat_capabilities::CapabilityStatus::Available
79 } else {
80 meerkat_capabilities::CapabilityStatus::DisabledByPolicy {
81 description: policy.disabled_description().into(),
82 }
83 }
84 }),
85 }
86}
87
88#[cfg(feature = "skills")]
89inventory::submit! {
90 meerkat_skills::SkillRegistration {
91 id: "workgraph-workflow",
92 name: "WorkGraph Workflow",
93 description: "How to use WorkGraph for durable commitments, dependencies, claims, and evidence",
94 scope: meerkat_core::skills::SkillScope::Builtin,
95 requires_capabilities: &["work_graph"],
96 body: include_str!("../skills/workgraph-workflow/SKILL.md"),
97 extensions: &[],
98 }
99}
100
101#[doc(hidden)]
102#[cfg(feature = "machine-schema-exports")]
103pub mod machine_schema_exports {
104 pub fn workgraph_lifecycle_schema() -> meerkat_machine_schema::MachineSchema {
105 meerkat_machine_schema::catalog::dsl::workgraph_lifecycle_schema_metadata().attach_to(
106 crate::machines::workgraph_lifecycle::WorkGraphLifecycleMachineState::schema(),
107 )
108 }
109}