NAH 1.0.6
Native Application Host - Library API Reference
Loading...
Searching...
No Matches
install_record.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "nah/types.hpp"
4
5#include <string>
6#include <unordered_map>
7#include <vector>
8
9namespace nah {
10
11// ============================================================================
12// App Install Record (per SPEC L285-L379)
13// ============================================================================
14
16 std::string schema; // MUST be "nah.app.install.v1"
17
18 // [install] section
19 struct {
20 std::string instance_id; // UUID string, unique per install
22
23 // [app] section (audit snapshots only; MUST NOT affect behavior)
24 struct {
25 std::string id;
26 std::string version;
27 std::string nak_id;
28 std::string nak_version_req;
29 } app;
30
31 // [nak] section (pinned NAK)
32 struct {
33 std::string id;
34 std::string version;
35 std::string record_ref; // "<nak_id>@<version>.toml"
36 std::string selection_reason; // optional audit-only string
37 } nak;
38
39 // [paths] section
40 struct {
41 std::string install_root; // Absolute path to app root
43
44 // [provenance] section
45 struct {
46 std::string package_hash; // "sha256:..."
47 std::string installed_at; // RFC3339 timestamp
48 std::string installed_by;
49 std::string source; // e.g., "package.nap"
51
52 // [trust] section
54
55 // [verification] section
56 struct {
57 std::string last_verified_at;
60
61 // [overrides] section
62 struct {
63 std::unordered_map<std::string, std::string> environment;
64 struct {
65 std::vector<std::string> prepend;
66 std::vector<std::string> append;
68 struct {
69 std::vector<std::string> library_prepend;
72
73 // Source path for trace
74 std::string source_path;
75};
76
77// ============================================================================
78// App Install Record Parsing Result
79// ============================================================================
80
82 bool ok = false;
83 bool is_critical_error = false; // True if schema/required fields missing
84 std::string error;
86 std::vector<std::string> warnings;
87};
88
89// Parse an App Install Record from TOML string
91 const std::string& source_path = "");
92
93// ============================================================================
94// App Install Record Validation
95// ============================================================================
96
97// Validate required fields per SPEC Presence semantics
98// Returns true if all required fields are present and valid
99bool validate_app_install_record(const AppInstallRecord& record, std::string& error);
100
101// ============================================================================
102// Legacy API for backward compatibility
103// ============================================================================
104
106 bool ok;
107 std::string error;
108};
109
112
113} // namespace nah
Result type for fallible operations.
Definition nahhost.hpp:109
InstallRecordValidation parse_app_install_record(const std::string &toml, AppInstallRecord &out)
bool validate_app_install_record(const AppInstallRecord &record, std::string &error)
AppInstallRecordParseResult parse_app_install_record_full(const std::string &toml_str, const std::string &source_path="")
std::vector< std::string > warnings
std::string last_verifier_version
struct nah::AppInstallRecord::@4 app
struct nah::AppInstallRecord::@8 verification
struct nah::AppInstallRecord::@6 paths
std::unordered_map< std::string, std::string > environment
struct nah::AppInstallRecord::@5 nak
struct nah::AppInstallRecord::@3 install
std::vector< std::string > library_prepend
std::vector< std::string > append
struct nah::AppInstallRecord::@9::@10 arguments
struct nah::AppInstallRecord::@7 provenance
struct nah::AppInstallRecord::@9 overrides
std::vector< std::string > prepend