NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
sqlite_runtime_stores.h
1#pragma once
2
3#include <neograph/context_store.h>
4#include <neograph/controlled_provider.h>
7
8#include <memory>
9#include <string>
10#include <vector>
11
12namespace neograph {
13
15class NEOGRAPH_API SQLiteContextStore final : public DurableContextStore {
16public:
17 explicit SQLiteContextStore(std::string database_path,
18 std::shared_ptr<sp::NativeArchive> archive = {});
19 ~SQLiteContextStore() override;
21 SQLiteContextStore& operator=(SQLiteContextStore&&) noexcept;
23 SQLiteContextStore& operator=(const SQLiteContextStore&) = delete;
24 ContextStoreAppendResult append_history(const ContextStoreFeed&, const RuntimeHistoryRecord&, const std::optional<std::string>&) override;
25 ContextStoreHead history_head(const ContextStoreFeed&) const override;
26 std::optional<RuntimeHistoryRecord> history_record_by_message_id(
27 const ContextStoreFeed&, std::string_view) const override;
28 ContextHistoryRange snapshot_history(const ContextStoreFeed&, std::uint64_t, std::uint64_t) const override;
29 std::string hydrate_history(const ContextHistoryRange&) const override;
30 std::vector<RuntimeHistoryRecord> hydrate_records(
31 const ContextHistoryRange&) const override;
32 ContextArtifactPutResult put_artifact(std::string_view, const ContextArtifact&) override;
33 std::optional<ContextArtifact> get_artifact(std::string_view, std::string_view) const override;
34private: struct Impl; std::unique_ptr<Impl> impl_;
35};
36
37class NEOGRAPH_API SQLiteHookJournal final : public HookJournal {
38public:
39 explicit SQLiteHookJournal(std::string database_path);
40 ~SQLiteHookJournal() override;
41 SQLiteHookJournal(SQLiteHookJournal&&) noexcept;
42 SQLiteHookJournal& operator=(SQLiteHookJournal&&) noexcept;
43 SQLiteHookJournal(const SQLiteHookJournal&) = delete;
44 SQLiteHookJournal& operator=(const SQLiteHookJournal&) = delete;
45 HookOutboxEntry enqueue(HookInvocation, RuntimeEvent, std::uint32_t, std::chrono::system_clock::time_point) override;
46 HookOutboxEntry publish(std::string_view) override;
47 std::optional<HookLease> claim(std::string_view, std::string_view, std::chrono::system_clock::time_point, std::chrono::milliseconds) override;
48 std::optional<HookOutboxEntry> settle(std::string_view, std::uint64_t, HookExecutionReceipt, std::chrono::system_clock::time_point) override;
49 std::optional<HookOutboxEntry> reconcile(std::string_view, HookExecutionState, std::string_view, std::uint64_t, HookExecutionReceipt) override;
50 std::vector<HookOutboxEntry> pending() const override;
51 std::vector<HookOutboxEntry> reconciliation_required() const override;
52 std::optional<HookOutboxEntry> get(std::string_view) const override;
53private: struct Impl; std::unique_ptr<Impl> impl_;
54};
55
56class NEOGRAPH_API SQLiteProviderDispatchReceiptStore final : public DurableProviderDispatchReceiptStore {
57public:
58 explicit SQLiteProviderDispatchReceiptStore(std::string database_path);
59 ~SQLiteProviderDispatchReceiptStore() override;
60 SQLiteProviderDispatchReceiptStore(SQLiteProviderDispatchReceiptStore&&) noexcept;
61 SQLiteProviderDispatchReceiptStore& operator=(SQLiteProviderDispatchReceiptStore&&) noexcept;
62 SQLiteProviderDispatchReceiptStore(const SQLiteProviderDispatchReceiptStore&) = delete;
63 SQLiteProviderDispatchReceiptStore& operator=(const SQLiteProviderDispatchReceiptStore&) = delete;
64 ProviderDispatchReceiptPutResult persist(const ProviderDispatchReceipt&) override;
65 ProviderDispatchReceiptPutResult persist(std::string_view owner_scope,
66 const ProviderDispatchReceipt&) override;
67 ProviderDispatchState state(std::string_view) const override;
68 ProviderDispatchState state(std::string_view owner_scope,
69 std::string_view) const override;
70 ProviderDispatchOutcomePutResult settle(
71 std::string_view owner_scope,
72 const ProviderDispatchOutcomeReceipt&) override;
73 std::optional<ProviderDispatchOutcomeReceipt> outcome(
74 std::string_view owner_scope,
75 std::string_view dispatch_id) const override;
76private: struct Impl; std::unique_ptr<Impl> impl_;
77};
78
79
88 Tool* tool = nullptr;
89 std::string executable_id;
90};
91
92class NEOGRAPH_API SQLiteToolEffectBroker final : public ToolEffectBroker {
93public:
94 SQLiteToolEffectBroker(std::string database_path,
95 std::vector<SQLiteToolExecutableBinding> bindings);
96 ~SQLiteToolEffectBroker() override;
97 SQLiteToolEffectBroker(const SQLiteToolEffectBroker&) = delete;
98 SQLiteToolEffectBroker& operator=(const SQLiteToolEffectBroker&) = delete;
99 asio::awaitable<ToolExecutionResult> execute(
100 ToolEffectIdentity identity, Tool& tool, json arguments,
101 ToolExecutionContext context) override;
102private:
103 struct Impl;
104 std::unique_ptr<Impl> impl_;
105};
106} // namespace neograph
Immutable context material.
Opt-in marker for ContextStore implementations that survive process restart.
Opt-in marker for receipt stores backed by durable storage.
Immutable durable terminal-attempt record.
Definition hook_outbox.h:41
Atomic durable-outbox abstraction.
Definition hook_outbox.h:99
Immutable snapshot of one logical invocation's durable outbox state.
Definition hook_outbox.h:68
Immutable terminal or reconciliation evidence for one admitted dispatch.
Immutable proof that an assembled request was admitted to provider dispatch.
One immutable, content-addressed line in the authoritative RAW history feed.
Optional SQLite implementations of the runtime durability contracts.
std::optional< RuntimeHistoryRecord > history_record_by_message_id(const ContextStoreFeed &, std::string_view) const override
Exact host message identity lookup; default is a bounded reverse scan.
std::vector< RuntimeHistoryRecord > hydrate_records(const ContextHistoryRange &) const override
Hydrate full typed records; native seals require trusted storage custody.
The trusted host persists a dispatch marker before calling the controller, replays exact completed re...
Abstract base class for tools that agents can call.
Definition tool.h:114
Durable hook dispatch contracts and in-memory journal.
Immutable reference to an exact contiguous history range, not a feed copy.
Owner-scoped identity of one append-only runtime-history feed.
The current durable head of a feed.
Concrete write-ahead mediated Tool broker.
One host-scoped, stable Core task and assistant-batch call ordinal.
Per-invocation context for a cooperative asynchronous tool.
Definition tool.h:39
Host-owned replay boundary for one mediated Tool effect.