NeoGraph 0.16.0
A C++20 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
replay.h
Go to the documentation of this file.
1
5#pragma once
6
10
11#include <cstdint>
12#include <memory>
13#include <optional>
14#include <string>
15#include <string_view>
16#include <vector>
17
18namespace neograph::program {
19
20enum class RecordedEvidenceCoverage : std::uint8_t { Full, Partial, Redacted };
21
22NEOGRAPH_PROGRAM_API std::string_view to_string(RecordedEvidenceCoverage coverage) noexcept;
23NEOGRAPH_PROGRAM_API RecordedEvidenceCoverage
24recorded_evidence_coverage_from_string(std::string_view value);
25
26struct RecordedCapabilityFailure {
27 std::string code;
28 std::string classification;
29 std::string message;
30 json witness = json::object();
31
32 bool operator==(const RecordedCapabilityFailure&) const = default;
33};
34
37 std::uint64_t sequence = 0;
38 CapabilityBindingReceipt binding;
39 std::string operation_id;
40 std::string call_id;
41 std::optional<std::string> effect_id;
42
43 bool operator==(const RecordedCapabilityCallReference&) const = default;
44};
45
46struct RecordedCapabilityEvidenceData {
48 RecordedEvidenceCoverage coverage = RecordedEvidenceCoverage::Partial;
49 bool redacted = false;
50 std::optional<ProgramPendingInput> input_outcome;
51 std::optional<ProgramPendingEffect> effect_outcome;
52 std::optional<RecordedCapabilityFailure> failure;
53};
54
56class NEOGRAPH_PROGRAM_API RecordedCapabilityEvidence {
57public:
58 static constexpr std::uint32_t STORAGE_SCHEMA_VERSION = 1;
59
60 explicit RecordedCapabilityEvidence(RecordedCapabilityEvidenceData data);
61 static RecordedCapabilityEvidence parse(std::string_view stored_bytes);
62
63 const std::string& id() const noexcept;
64 const RecordedCapabilityCallReference& reference() const noexcept;
65 RecordedEvidenceCoverage coverage() const noexcept;
66 bool redacted() const noexcept;
67 std::optional<ProgramPendingInput> input_outcome() const;
68 std::optional<ProgramPendingEffect> effect_outcome() const;
69 std::optional<RecordedCapabilityFailure> failure() const;
70 std::string serialize_canonical() const;
71
72private:
73 struct Impl;
74 explicit RecordedCapabilityEvidence(std::shared_ptr<const Impl> impl);
75 std::shared_ptr<const Impl> impl_;
76};
77
84class NEOGRAPH_PROGRAM_API RecordedBindingSet {
85public:
86 RecordedBindingSet(std::vector<CapabilityBindingReceipt> exact_bindings,
87 std::vector<RecordedCapabilityCallReference> expected_calls,
88 std::vector<RecordedCapabilityEvidence> evidence);
90 RecordedBindingSet& operator=(RecordedBindingSet&&) noexcept;
92 RecordedBindingSet& operator=(const RecordedBindingSet&) = delete;
94
95 const std::string& fingerprint() const noexcept;
96 const std::vector<CapabilityBindingReceipt>& exact_bindings() const noexcept;
97 const std::vector<RecordedCapabilityCallReference>& expected_calls() const noexcept;
98 const std::vector<RecordedCapabilityEvidence>& evidence() const noexcept;
99
101 void validate_target(const ProgramVersion& target) const;
102
103private:
104 struct Impl;
105 std::unique_ptr<Impl> impl_;
106};
107
113
115
116NEOGRAPH_PROGRAM_API ProgramHistoricalReplacementChain
117inspect_program_replacement_chain(const BlockingProgramTransitionStore& store,
118 std::string_view owner_scope,
119 std::string_view any_run_id);
120
122class NEOGRAPH_PROGRAM_API ProgramHistoricalReplacementStep final {
123public:
124 const ProgramRunGeneration& source_generation() const noexcept;
125 const ProgramRunLineage& source_lineage() const noexcept;
126 const ProgramRunRecord& source_run() const noexcept;
127 const ProgramJavaScriptCommandJournalEntry& checkpoint() const noexcept;
128 const ProgramRunGeneration& target_generation() const noexcept;
129 const ProgramRunLineage& target_initial_lineage() const noexcept;
130 const ProgramTransitionPublication& target_initial_publication() const noexcept;
131
132private:
133 struct Impl;
134 explicit ProgramHistoricalReplacementStep(std::shared_ptr<const Impl> impl);
135 std::shared_ptr<const Impl> impl_;
136
137 friend ProgramHistoricalReplacementChain inspect_program_replacement_chain(
138 const BlockingProgramTransitionStore&, std::string_view, std::string_view);
139};
140
142class NEOGRAPH_PROGRAM_API ProgramHistoricalReplacementChain final {
143public:
144 const ProgramRunLineage& anchor() const noexcept;
145 const std::vector<ProgramRunGeneration>& generations() const noexcept;
146 const std::vector<ProgramHistoricalReplacementStep>& replacements() const noexcept;
147
148private:
149 struct Impl;
150 explicit ProgramHistoricalReplacementChain(std::shared_ptr<const Impl> impl);
151 std::shared_ptr<const Impl> impl_;
152
153 friend ProgramHistoricalReplacementChain inspect_program_replacement_chain(
154 const BlockingProgramTransitionStore&, std::string_view, std::string_view);
155};
156
157} // namespace neograph::program
Admission and process-local materialization of immutable Programs.
A ProgramTransitionStore for a caller that cannot suspend: the synchronous Program API,...
Read-only, fail-closed evidence for one immutable A -> ... -> N lineage.
Definition replay.h:142
One fully revalidated transition in a historical replacement chain.
Definition replay.h:122
Immutable, content-addressed command-journal value.
Immutable identity of one admitted topology generation in a run lineage.
Definition lineage.h:102
Immutable content-addressed head of one stable run lineage.
Definition lineage.h:150
Deep-owned, content-addressed run snapshot used for reconnect and CAS publication.
Definition run_record.h:119
Move-only captured evidence proposal.
Definition replay.h:84
void validate_target(const ProgramVersion &target) const
Re-check against the pinned target version immediately before start.
Canonical immutable result or failure for one exact recorded capability call.
Definition replay.h:56
Protocol-neutral durable pending input and effect values.
Exact host-resource receipt returned by the Catalog capability binder.
Definition catalog.h:90
Exact expected coordinate loaded from the source run's durable call/effect ledger.
Definition replay.h:36
Constructed only by the Catalog's trusted captured-capability registration.
Definition replay.h:109
Atomic owner-scoped Program transition publication.