Skip to main content

kaizen/sync/
mod.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
2//! Sync daemon: redacted outbox → `POST /v1/events`.
3
4pub mod canonical;
5pub mod client;
6pub mod context;
7pub mod engine;
8pub mod export_batch;
9pub mod outbound;
10pub mod redact;
11pub mod smart;
12pub mod telemetry_replay;
13
14pub use canonical::{
15    CanonicalEnvelope, CanonicalEventName, CanonicalItem, EventItem, KAIZEN_SCHEMA_VERSION,
16    RepoSnapshotChunkItem, ToolSpanItem, WorkspaceFactSnapshotItem, expand_ingest_batch,
17};
18pub use context::SyncIngestContext;
19pub use engine::{FlushExporters, FlushStats, flush_outbox_once};
20pub use export_batch::IngestExportBatch;
21pub use outbound::{EventsBatchBody, OutboundEvent, hash_with_salt, workspace_hash};
22pub use telemetry_replay::{
23    chunk_events_into_ingest_batches, chunk_tool_spans_into_ingest_batches,
24};
25
26use crate::core::config::Config;
27use std::path::PathBuf;
28
29/// When sync endpoint is configured, pass this into `append_event_with_sync`.
30pub fn ingest_ctx(cfg: &Config, workspace_root: PathBuf) -> Option<SyncIngestContext> {
31    if cfg.sync.endpoint.is_empty() {
32        return None;
33    }
34    Some(SyncIngestContext::new(cfg.sync.clone(), workspace_root))
35}