@forgezero/agent 0.1.33 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,6 +36,27 @@ Install the service explicitly:
36
36
  fz agent install --apply # writes a hardened systemd unit
37
37
  ```
38
38
 
39
+ The attended Cloudflare resource phase is part of the same published command,
40
+ but remains separate from the root host install so its management token never
41
+ enters the API or Agent service environment:
42
+
43
+ ```bash
44
+ chmod 600 cloudflare-bootstrap.json cloudflare-management.token
45
+ fz bootstrap platform cloudflare --bootstrap-config ./cloudflare-bootstrap.json
46
+ fz bootstrap platform cloudflare --bootstrap-config ./cloudflare-bootstrap.json --apply
47
+ ```
48
+
49
+ The reviewed JSON has `format: 1`, kind
50
+ `forgezero-cloudflare-bootstrap-request`, a `checkpointPath`, the typed
51
+ `coordinates`, and `tokenFiles` containing file paths only. `coordinates.nodes`
52
+ explicitly lists each node name, origin hostname, loopback service, Tunnel name
53
+ and Access application name. Relative token, checkpoint and Worker project
54
+ paths resolve beside the config file. Plan is offline. Apply creates/reuses one
55
+ shared KV namespace, Worker and Access service token plus one Tunnel, Access
56
+ application, ingress rule and DNS record per node. The command prints only
57
+ resource IDs; connector, Access and requested runtime-token values stay in the
58
+ atomically updated owner-only checkpoint for direct systemd-credential handoff.
59
+
39
60
  ## What changes for an application
40
61
 
41
62
  Nothing.
@@ -744,7 +744,7 @@ async function postSignedNode(options, path, body) {
744
744
  }
745
745
 
746
746
  // src/version.ts
747
- var VERSION3 = "0.1.33";
747
+ var VERSION3 = "0.1.35";
748
748
 
749
749
  // src/agent-heartbeat.ts
750
750
  var unquote = (value) => value.replace(/^['"]|['"]$/g, "");
@@ -0,0 +1,128 @@
1
+ import { type ProvisionPlan } from './cli/agent-install';
2
+ import { type SoftwareCommandResult, type SoftwareRequirement } from './software';
3
+ import { type PlatformSharedEnvironment } from './platform-bootstrap-runtime';
4
+ export declare const PLATFORM_BOOTSTRAP_PROFILES: readonly ["platform-db-api", "platform-api"];
5
+ export type PlatformBootstrapProfile = (typeof PLATFORM_BOOTSTRAP_PROFILES)[number];
6
+ export type DatabaseBootstrapRole = 'master' | 'joiner' | 'none';
7
+ export type BootstrapEnvironment = 'production' | 'development';
8
+ export interface PlatformBootstrapConfig {
9
+ kind: 'platform';
10
+ environment: BootstrapEnvironment;
11
+ profile: PlatformBootstrapProfile;
12
+ /** API-owned compute reference. Initial seed references are fz-n1..3/dev-fz-n1..3. */
13
+ computeReference: string;
14
+ nodeHostname: string;
15
+ apiUrl: string;
16
+ repository: string;
17
+ branch: string;
18
+ deployRoot?: string;
19
+ telemetryEndpoint: string;
20
+ database: {
21
+ role: DatabaseBootstrapRole;
22
+ /** Cluster mode must remain default. Bootstrap verifies it and never mutates it. */
23
+ serverMode: 'default';
24
+ address?: string;
25
+ master?: string;
26
+ coordinators: string[];
27
+ /** Owner/root-only file containing the shared 64-hex bootstrap code. */
28
+ bootstrapSecretFile: string;
29
+ };
30
+ /** Required for every post-genesis compute; initial n1..n3 derive their one-use capability. */
31
+ platformEnrolTokenFile?: string;
32
+ runtime: {
33
+ environment: PlatformSharedEnvironment;
34
+ serviceUser: string;
35
+ slotsDirectory: string;
36
+ bluePort: number;
37
+ greenPort: number;
38
+ healthPath: string;
39
+ keepReleases: number;
40
+ credentialFiles?: {
41
+ smtpPassword?: string;
42
+ backupS3Secret?: string;
43
+ };
44
+ };
45
+ firewall: {
46
+ enabled: boolean;
47
+ sshPort: number;
48
+ privateCidrs: string[];
49
+ };
50
+ /** Install the connector binary only. Resource creation belongs to attended Cloudflare bootstrap. */
51
+ installCloudflared?: boolean;
52
+ /** Completed attended resource checkpoint; root seals only this node's runtime capabilities. */
53
+ cloudflareHandoff?: {
54
+ checkpointFile: string;
55
+ nodeName: string;
56
+ };
57
+ }
58
+ export interface TenantBootstrapConfig {
59
+ kind: 'tenant';
60
+ apiUrl: string;
61
+ realm: string;
62
+ nodeHostname: string;
63
+ telemetryEndpoint: string;
64
+ enrolTokenFile: string;
65
+ repository?: string;
66
+ branch?: string;
67
+ profile?: string;
68
+ deployRoot?: string;
69
+ software?: SoftwareRequirement[];
70
+ installCloudflared?: boolean;
71
+ }
72
+ export type BootstrapConfig = PlatformBootstrapConfig | TenantBootstrapConfig;
73
+ export interface BootstrapStep {
74
+ id: string;
75
+ label: string;
76
+ mutation: boolean;
77
+ }
78
+ export interface BootstrapPlan {
79
+ kind: BootstrapConfig['kind'];
80
+ mode: 'install' | 'repair';
81
+ profile: string;
82
+ steps: readonly BootstrapStep[];
83
+ software: readonly SoftwareRequirement[];
84
+ statePath: string;
85
+ }
86
+ export interface BootstrapResult {
87
+ plan: BootstrapPlan;
88
+ applied: boolean;
89
+ status: BootstrapStatus;
90
+ launch?: {
91
+ command: string;
92
+ inviteUrl: string;
93
+ };
94
+ }
95
+ export interface BootstrapStatus {
96
+ initialized: boolean;
97
+ kind?: BootstrapConfig['kind'];
98
+ profile?: string;
99
+ services: Record<string, boolean>;
100
+ problems: string[];
101
+ }
102
+ export interface BootstrapHost {
103
+ uid(): number;
104
+ exists(path: string): boolean;
105
+ read(path: string): string;
106
+ write(path: string, content: string, mode: number): void;
107
+ mkdir(path: string, mode: number): void;
108
+ remove(path: string): void;
109
+ inspect?(path: string): {
110
+ regular: boolean;
111
+ symbolic: boolean;
112
+ uid: number;
113
+ mode: number;
114
+ links: number;
115
+ size: number;
116
+ };
117
+ exec(argv: readonly string[], options?: {
118
+ stdin?: string;
119
+ }): Promise<SoftwareCommandResult>;
120
+ ensureSoftware(requirements: readonly SoftwareRequirement[]): Promise<unknown>;
121
+ installAgent(config: BootstrapConfig, enrolTokenSourcePath?: string): Promise<ProvisionPlan>;
122
+ }
123
+ export declare function validateBootstrapConfig(value: BootstrapConfig): BootstrapConfig;
124
+ export declare function planBootstrap(input: BootstrapConfig, initialized?: boolean): BootstrapPlan;
125
+ export declare function bootstrapStatus(host?: BootstrapHost): Promise<BootstrapStatus>;
126
+ export declare function applyBootstrap(input: BootstrapConfig, host?: BootstrapHost): Promise<BootstrapResult>;
127
+ export declare function readBootstrapConfig(path: string): BootstrapConfig;
128
+ export declare function localBootstrapHost(): BootstrapHost;