18namespace neograph::program {
21class ProgramBundleAccess;
35NEOGRAPH_PROGRAM_API std::string_view to_string(ExecutionGuarantee guarantee)
noexcept;
36NEOGRAPH_PROGRAM_API ExecutionGuarantee execution_guarantee_from_string(std::string_view value);
37NEOGRAPH_PROGRAM_API std::uint8_t execution_guarantee_rank(ExecutionGuarantee guarantee)
noexcept;
39enum class ExecutableKind { Node, Reducer, Condition,
Provider,
Tool, Imported };
41NEOGRAPH_PROGRAM_API std::string_view to_string(ExecutableKind kind)
noexcept;
42NEOGRAPH_PROGRAM_API ExecutableKind executable_kind_from_string(std::string_view value);
44struct ExecutableIdentity {
45 ExecutableKind kind = ExecutableKind::Node;
47 std::string semantic_version;
48 std::string implementation_digest;
50 bool operator==(
const ExecutableIdentity&)
const =
default;
53struct ContractRecord {
54 std::uint32_t schema_version = 1;
55 json schema = json::object();
66 std::string_view path =
"$schema");
67NEOGRAPH_PROGRAM_API
void validate_contract_value(
69 const ContractRecord& contract,
70 std::string_view subject =
"Program contract value",
71 std::string_view path =
"$");
73struct OrchestrationPlanRecord {
74 std::uint32_t schema_version = 1;
75 json plan = json::object();
78struct SealedCoreDefinition {
79 static constexpr std::uint32_t STORAGE_SCHEMA_VERSION = 1;
82 std::string definition_hash;
83 json definition = json::object();
94 const SealedCoreDefinition& definition,
95 std::string_view compiler_build_id,
96 std::string_view registry_snapshot_fingerprint,
97 const std::vector<ExecutableIdentity>& executable_closure);
99struct CorePlanIdentity {
101 std::string compiled_plan_identity;
103 bool operator==(
const CorePlanIdentity&)
const =
default;
106struct CapabilityEffectClosure {
107 std::vector<std::string> capabilities;
108 std::vector<std::string> effects;
110 bool operator==(
const CapabilityEffectClosure&)
const =
default;
113struct BudgetRequirement {
114 std::string resource;
115 std::uint64_t minimum = 0;
116 std::uint64_t maximum = 0;
118 bool operator==(
const BudgetRequirement&)
const =
default;
132 std::string source_hash;
138 std::string canonical_program_hash;
139 std::string compiler_build_id;
140 std::uint32_t program_schema_version = 1;
141 std::string registry_snapshot_fingerprint;
142 std::string module_dependency_merkle_root;
145 ContractRecord input_contract;
146 ContractRecord output_contract;
147 OrchestrationPlanRecord orchestration_plan;
148 std::vector<SealedCoreDefinition> sealed_core_definitions;
149 std::vector<CorePlanIdentity> core_plan_identities;
150 CapabilityEffectClosure capability_effect_closure;
153 std::vector<ExecutableIdentity> executable_registry_identities;
154 std::vector<BudgetRequirement> declared_budget_requirements;
155 std::vector<SourceMapEntry> source_map;
156 std::vector<Diagnostic> diagnostics;
161class NEOGRAPH_PROGRAM_API ProgramBundle {
163 static constexpr std::uint32_t STORAGE_SCHEMA_VERSION = 1;
166 static ProgramBundle parse(std::string_view stored_bytes);
168 const std::string& id()
const noexcept;
170 const std::string& source_hash()
const noexcept;
172 std::optional<ProgramSource> control_source()
const;
173 const std::string& canonical_program_hash()
const noexcept;
174 const std::string& compiler_build_id()
const noexcept;
175 std::uint32_t program_schema_version()
const noexcept;
176 const std::string& registry_snapshot_fingerprint()
const noexcept;
177 const std::string& module_dependency_merkle_root()
const noexcept;
179 const std::vector<ModuleCoordinate>& module_coordinates()
const noexcept;
180 ContractRecord input_contract()
const;
181 ContractRecord output_contract()
const;
182 OrchestrationPlanRecord orchestration_plan()
const;
184 const ProgramPlan& typed_orchestration_plan()
const;
185 std::vector<SealedCoreDefinition> sealed_core_definitions()
const;
186 const std::vector<CorePlanIdentity>& core_plan_identities()
const noexcept;
187 const CapabilityEffectClosure& capability_effect_closure()
const noexcept;
189 const std::vector<ExecutableIdentity>& executable_registry_identities()
const noexcept;
190 const std::vector<BudgetRequirement>& declared_budget_requirements()
const noexcept;
191 const std::vector<SourceMapEntry>& source_map()
const noexcept;
193 std::vector<Diagnostic> diagnostics()
const;
200 std::vector<Diagnostic> compile_diagnostics()
const;
201 std::string serialize_canonical()
const;
204 friend class detail::ProgramBundleAccess;
206 ProgramBundle(
ProgramBundleData data, std::optional<std::vector<Diagnostic>> compiled);
207 explicit ProgramBundle(std::shared_ptr<const Impl> impl);
208 std::shared_ptr<const Impl> impl_;
NEOGRAPH_PROGRAM_API std::string core_compiled_plan_identity(const SealedCoreDefinition &definition, std::string_view compiler_build_id, std::string_view registry_snapshot_fingerprint, const std::vector< ExecutableIdentity > &executable_closure)
Returns the deterministic Core compiled-plan identity for a sealed definition and the exact executabl...
NEOGRAPH_PROGRAM_API void validate_contract_schema(const ContractRecord &contract, std::string_view path="$schema")
Validate the Program-v1 JSON Schema subset retained by a contract.
NEOGRAPH_PROGRAM_API std::string sealed_core_definition_hash(const json &definition)
Returns the v1 content identity required by SealedCoreDefinition::definition_hash.
ExecutionGuarantee
The lowest recoverability/integrity class reachable through an executable closure.
Capability identity plus a single prepared, owned operation contract.
Immutable operation graph.
Immutable content-addressed coordinates for reusable Program modules.
Typed immutable orchestration plans used by ProgramRuntime.
Deeply owned, immutable Program source values.
SourceKind
Source identity carried by Program values.
Exact identity of the private JavaScript frontend.
Mutable construction input.
SourceKind source_kind
Required; invalid sentinel rejects omission.
std::optional< ProgramSource > control_source
Retained source for the opt-in JavaScript yielded-command controller.
ExecutionGuarantee execution_guarantee
Exact weakest guarantee in the compiler-derived executable/control closure.
std::vector< ModuleCoordinate > module_coordinates
Exact module coordinates represented by the dependency receipts.
JavaScriptRuntimeIdentity javascript_runtime
Present for JavaScript bundles; omitted for non-JavaScript sources.