@forgezero/agent 0.1.38 → 0.1.40
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 +118 -12
- package/dist/agent-heartbeat.d.ts +13 -0
- package/dist/agent-heartbeat.js +24 -14
- package/dist/agent-update-helper.js +15 -13
- package/dist/agent-update.js +15 -13
- package/dist/bootstrap.d.ts +49 -4
- package/dist/bootstrap.js +660 -791
- package/dist/cli/cloudflare-bootstrap.d.ts +5 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cloudflare-bootstrap.d.ts +36 -114
- package/dist/cloudflare-bootstrap.js +237 -738
- package/dist/cloudflare-edge.d.ts +3 -151
- package/dist/cloudflare-edge.js +28 -248
- package/dist/credential-schema.d.ts +60 -0
- package/dist/credential-schema.js +335 -0
- package/dist/definition.js +2 -2
- package/dist/deploy-file.js +2 -2
- package/dist/deployment-pull.d.ts +2 -0
- package/dist/fz-agent.js +6407 -58
- package/dist/fz.js +10668 -1151
- package/dist/index.d.ts +33 -0
- package/dist/metal-bootstrap.d.ts +1 -0
- package/dist/metal-bootstrap.js +5 -3
- package/dist/platform-bootstrap-runtime.d.ts +5 -28
- package/dist/platform-bootstrap-runtime.js +26 -77
- package/dist/project-context.js +1 -1
- package/dist/provision.js +18 -16
- package/dist/software-helper.js +2 -2
- package/dist/software.js +2 -2
- package/dist/version.d.ts +1 -1
- package/package.json +8 -4
- package/dist/cli/custody.d.ts +0 -35
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AttendedCloudflareBootstrapRequest, type CloudflareBootstrapEvidence, type CloudflareBootstrapPhaseRunner } from '../cloudflare-bootstrap';
|
|
1
|
+
import { verifyCloudflareBootstrapAcceptance, type AttendedCloudflareBootstrapRequest, type CloudflareBootstrapEvidence, type CloudflareBootstrapAcceptanceEvidence, type CloudflareBootstrapPhaseRunner } from '../cloudflare-bootstrap';
|
|
2
2
|
export interface CloudflareBootstrapCommandDependencies {
|
|
3
3
|
run?: CloudflareBootstrapPhaseRunner;
|
|
4
4
|
write?: (text: string) => void;
|
|
@@ -9,3 +9,7 @@ export interface CloudflareBootstrapCommandDependencies {
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function readCloudflareBootstrapCommandConfig(path: string, mode: 'plan' | 'apply'): AttendedCloudflareBootstrapRequest;
|
|
11
11
|
export declare function runCloudflareBootstrapCommand(configPath: string, apply: boolean, dependencies?: CloudflareBootstrapCommandDependencies): Promise<CloudflareBootstrapEvidence>;
|
|
12
|
+
export declare function runCloudflareBootstrapVerificationCommand(checkpointPath: string, dependencies?: {
|
|
13
|
+
verify?: typeof verifyCloudflareBootstrapAcceptance;
|
|
14
|
+
write?: (text: string) => void;
|
|
15
|
+
}): Promise<CloudflareBootstrapAcceptanceEvidence>;
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { type AgentIdentity } from '@forgezero/runtime/ssh-agent';
|
|
3
2
|
/**
|
|
4
3
|
* What every CLI request carries.
|
|
5
4
|
*
|
|
@@ -9,7 +8,6 @@ import { type AgentIdentity } from '@forgezero/runtime/ssh-agent';
|
|
|
9
8
|
* notice. A header nobody can see is a header nobody maintains.
|
|
10
9
|
*/
|
|
11
10
|
export declare function requestHeaders(apiBase: string, cookie: string | null): Record<string, string>;
|
|
12
|
-
export declare function useCustodyIdentity(identity: AgentIdentity, socketPath?: string): void;
|
|
13
11
|
export declare function safeApiPath(value: string): string;
|
|
14
12
|
export declare function targetCoordinate(value: string): {
|
|
15
13
|
computeReference: string;
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CloudflareApiTokens } from './cloudflare-edge';
|
|
2
2
|
export interface CloudflareBootstrapNodeCoordinates {
|
|
3
3
|
nodeName: string;
|
|
4
4
|
hostname: string;
|
|
5
5
|
service: string;
|
|
6
6
|
tunnelName: string;
|
|
7
|
-
applicationName: string;
|
|
8
|
-
/** Present only on DB nodes that publish an exact private host route. */
|
|
9
|
-
privateAddress?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface CloudflarePrivateNetworkCoordinates {
|
|
12
|
-
warpOrganization: string;
|
|
13
|
-
virtualNetworkName: string;
|
|
14
|
-
deviceProfileName: string;
|
|
15
|
-
enrollmentApplicationName: string;
|
|
16
|
-
deviceProfilePrecedence?: number;
|
|
17
7
|
}
|
|
18
8
|
export interface CloudflareBootstrapCoordinates {
|
|
19
9
|
accountId: string;
|
|
@@ -22,88 +12,49 @@ export interface CloudflareBootstrapCoordinates {
|
|
|
22
12
|
hostname: string;
|
|
23
13
|
service: string;
|
|
24
14
|
tunnelName: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
serviceTokenName: string;
|
|
28
|
-
policyName: string;
|
|
29
|
-
applicationName: string;
|
|
30
|
-
workerDirectory: string;
|
|
31
|
-
workerMain: string;
|
|
32
|
-
workerCompatibilityDate: string;
|
|
33
|
-
publicDomains: string[];
|
|
34
|
-
createRuntimeTokens: boolean;
|
|
35
|
-
createPrivateNetworkRuntimeToken: boolean;
|
|
36
|
-
runtimeTokenNamePrefix: string;
|
|
15
|
+
/** Existing namespace bound to the separately deployed Worker. */
|
|
16
|
+
kvNamespaceId: string;
|
|
37
17
|
nodes?: CloudflareBootstrapNodeCoordinates[];
|
|
38
|
-
privateNetwork?: CloudflarePrivateNetworkCoordinates;
|
|
39
18
|
}
|
|
40
19
|
export interface CloudflareBootstrapTokenFiles {
|
|
20
|
+
/** One owner-supplied token with Tunnel Write, DNS Write and KV Write. */
|
|
41
21
|
apiTokenFile?: string;
|
|
22
|
+
/** Recommended bootstrap token: Tunnel Write + DNS Write. */
|
|
23
|
+
managementApiTokenFile?: string;
|
|
24
|
+
/** Recommended normal-runtime token: Workers KV Storage Write. */
|
|
25
|
+
runtimeApiTokenFile?: string;
|
|
26
|
+
/** Optional split management/runtime tokens. */
|
|
42
27
|
tunnelApiTokenFile?: string;
|
|
43
28
|
dnsApiTokenFile?: string;
|
|
44
29
|
kvApiTokenFile?: string;
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
}
|
|
31
|
+
interface CloudflareBootstrapNodeResource extends CloudflareBootstrapNodeCoordinates {
|
|
32
|
+
tunnelId: string;
|
|
33
|
+
connectorToken: string;
|
|
47
34
|
}
|
|
48
35
|
interface CloudflareBootstrapResources {
|
|
36
|
+
/** First-node compatibility fields. */
|
|
49
37
|
tunnelId: string;
|
|
50
38
|
kvNamespaceId: string;
|
|
51
39
|
hostname: string;
|
|
52
40
|
service: string;
|
|
53
41
|
connectorToken: string;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
58
|
-
nodes: Array<{
|
|
59
|
-
nodeName: string;
|
|
60
|
-
hostname: string;
|
|
61
|
-
service: string;
|
|
62
|
-
tunnelName: string;
|
|
63
|
-
tunnelId: string;
|
|
64
|
-
connectorToken: string;
|
|
65
|
-
applicationId?: string;
|
|
66
|
-
}>;
|
|
67
|
-
worker?: {
|
|
68
|
-
scriptName: string;
|
|
69
|
-
publicDomains: string[];
|
|
70
|
-
deployed: true;
|
|
71
|
-
};
|
|
72
|
-
runtimeTokens?: {
|
|
73
|
-
kv: CloudflareAccountRuntimeToken;
|
|
74
|
-
privateNetwork?: CloudflareAccountRuntimeToken;
|
|
75
|
-
};
|
|
76
|
-
privateNetwork?: {
|
|
77
|
-
warpOrganization: string;
|
|
78
|
-
virtualNetworkId: string;
|
|
79
|
-
deviceProfileId: string;
|
|
80
|
-
enrollmentApplicationId: string;
|
|
81
|
-
routes: Array<{
|
|
82
|
-
nodeName: string;
|
|
83
|
-
routeId: string;
|
|
84
|
-
privateAddress: string;
|
|
85
|
-
}>;
|
|
86
|
-
};
|
|
42
|
+
/** Owner-supplied Workers KV Storage Write token, sealed into each host handoff. */
|
|
43
|
+
kvRuntimeToken: string;
|
|
44
|
+
nodes: CloudflareBootstrapNodeResource[];
|
|
87
45
|
}
|
|
88
46
|
export interface CloudflareBootstrapOutput {
|
|
89
47
|
format: 1;
|
|
90
48
|
kind: 'forgezero-cloudflare-bootstrap';
|
|
91
|
-
phase: 'edge-resources-provisioned' | '
|
|
49
|
+
phase: 'edge-resources-provisioned' | 'complete';
|
|
92
50
|
updatedAt: string;
|
|
93
51
|
coordinates: CloudflareBootstrapCoordinates;
|
|
94
52
|
resources: CloudflareBootstrapResources;
|
|
95
53
|
created?: {
|
|
96
54
|
tunnel: boolean;
|
|
97
|
-
kvNamespace: boolean;
|
|
98
|
-
serviceToken: boolean;
|
|
99
|
-
policy: boolean;
|
|
100
|
-
application: boolean;
|
|
101
|
-
privateNetwork: boolean;
|
|
102
|
-
workerDeployed: true;
|
|
103
55
|
nodes: Array<{
|
|
104
56
|
nodeName: string;
|
|
105
57
|
tunnel: boolean;
|
|
106
|
-
application: boolean;
|
|
107
58
|
}>;
|
|
108
59
|
};
|
|
109
60
|
}
|
|
@@ -116,12 +67,6 @@ export interface CloudflareBootstrapPlan {
|
|
|
116
67
|
operations: readonly string[];
|
|
117
68
|
secrets: readonly string[];
|
|
118
69
|
}
|
|
119
|
-
/**
|
|
120
|
-
* The published `fz bootstrap platform` boundary. It deliberately accepts
|
|
121
|
-
* token *paths*, never token values, so a caller cannot accidentally put the
|
|
122
|
-
* Cloudflare management credential into a platform manifest, runtime config,
|
|
123
|
-
* child argv, or evidence journal.
|
|
124
|
-
*/
|
|
125
70
|
export interface AttendedCloudflareBootstrapRequest {
|
|
126
71
|
mode: 'plan' | 'apply';
|
|
127
72
|
coordinates: CloudflareBootstrapCoordinates;
|
|
@@ -135,22 +80,26 @@ export interface CloudflareBootstrapEvidence {
|
|
|
135
80
|
phase: 'planned' | 'complete';
|
|
136
81
|
checkpointFile: string;
|
|
137
82
|
kvNamespaceId?: string;
|
|
138
|
-
workerScriptName: string;
|
|
139
|
-
publicDomains: readonly string[];
|
|
140
|
-
runtimeTokenIds?: {
|
|
141
|
-
kv?: string;
|
|
142
|
-
privateNetwork?: string;
|
|
143
|
-
};
|
|
144
83
|
nodes: ReadonlyArray<{
|
|
145
84
|
nodeName: string;
|
|
146
85
|
hostname: string;
|
|
86
|
+
handoffFile?: string;
|
|
147
87
|
tunnelId?: string;
|
|
148
|
-
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
export interface CloudflareBootstrapAcceptanceEvidence {
|
|
91
|
+
format: 1;
|
|
92
|
+
kind: 'forgezero-cloudflare-bootstrap-acceptance';
|
|
93
|
+
checkpointFile: string;
|
|
94
|
+
verifiedAt: string;
|
|
95
|
+
nodes: ReadonlyArray<{
|
|
96
|
+
nodeName: string;
|
|
97
|
+
hostname: string;
|
|
98
|
+
status: number;
|
|
149
99
|
}>;
|
|
150
100
|
}
|
|
151
101
|
export interface CloudflareBootstrapDependencies {
|
|
152
102
|
fetcher?: typeof fetch;
|
|
153
|
-
workerRunner?: CloudflareWorkerCommandRunner;
|
|
154
103
|
}
|
|
155
104
|
export type CloudflareBootstrapPhaseRunner = (request: AttendedCloudflareBootstrapRequest) => Promise<CloudflareBootstrapEvidence>;
|
|
156
105
|
/** Read exactly one API token from a non-symlinked, owner-only regular file. */
|
|
@@ -158,18 +107,6 @@ export declare function readOwnerApiToken(path: string): Promise<string>;
|
|
|
158
107
|
export declare function readCloudflareBootstrapTokens(files: CloudflareBootstrapTokenFiles): Promise<CloudflareApiTokens>;
|
|
159
108
|
export declare function validateCloudflareBootstrapCoordinates(input: CloudflareBootstrapCoordinates): CloudflareBootstrapCoordinates;
|
|
160
109
|
export declare function planCloudflareBootstrap(input: CloudflareBootstrapCoordinates, outputPath: string): CloudflareBootstrapPlan;
|
|
161
|
-
export interface CloudflareWorkerCommand {
|
|
162
|
-
command: readonly string[];
|
|
163
|
-
cwd: string;
|
|
164
|
-
env: Readonly<Record<string, string>>;
|
|
165
|
-
}
|
|
166
|
-
export type CloudflareWorkerCommandRunner = (request: CloudflareWorkerCommand) => Promise<{
|
|
167
|
-
exitCode: number;
|
|
168
|
-
stdout: string;
|
|
169
|
-
stderr: string;
|
|
170
|
-
}>;
|
|
171
|
-
/** Deploy one Worker from an ephemeral config containing the runtime-created KV id. */
|
|
172
|
-
export declare function deployCloudflareWorker(coordinates: CloudflareBootstrapCoordinates, kvNamespaceId: string, apiToken: string, runner?: CloudflareWorkerCommandRunner): Promise<void>;
|
|
173
110
|
export interface CloudflareConnectorHandoff {
|
|
174
111
|
nodeName: string;
|
|
175
112
|
hostname: string;
|
|
@@ -182,6 +119,7 @@ export interface CloudflareHostHandoff extends CloudflareConnectorHandoff {
|
|
|
182
119
|
zoneId: string;
|
|
183
120
|
kvNamespaceId: string;
|
|
184
121
|
kvRuntimeToken: string;
|
|
122
|
+
/** Backward-compatible private-network coordinates; not produced by this public-hostname bootstrap. */
|
|
185
123
|
privateNetworkRuntimeToken?: string;
|
|
186
124
|
warp?: {
|
|
187
125
|
organization: string;
|
|
@@ -191,28 +129,12 @@ export interface CloudflareHostHandoff extends CloudflareConnectorHandoff {
|
|
|
191
129
|
deviceProfileId: string;
|
|
192
130
|
};
|
|
193
131
|
}
|
|
194
|
-
|
|
195
|
-
* Select one node's connector credential directly from the completed fleet
|
|
196
|
-
* checkpoint. Host bootstrap can pipe this value into `systemd-creds` without
|
|
197
|
-
* creating another plaintext token file or accepting the whole JSON as a
|
|
198
|
-
* connector token.
|
|
199
|
-
*/
|
|
132
|
+
export declare function cloudflareHostHandoffPath(checkpointPath: string, nodeName: string): string;
|
|
200
133
|
export declare function readCloudflareConnectorHandoff(checkpointPath: string, nodeName: string): Promise<CloudflareConnectorHandoff>;
|
|
201
|
-
|
|
202
|
-
export declare function readCloudflareHostHandoff(checkpointPath: string, nodeName: string): Promise<CloudflareHostHandoff>;
|
|
203
|
-
/** Atomically persist sensitive bootstrap material without making it runtime configuration. */
|
|
134
|
+
export declare function readCloudflareHostHandoff(handoffPath: string, nodeName: string): Promise<CloudflareHostHandoff>;
|
|
204
135
|
export declare function writeOwnerBootstrapOutput(path: string, output: CloudflareBootstrapOutput): Promise<void>;
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
* every one-time secret is obtained, so a later API failure cannot orphan it.
|
|
208
|
-
*/
|
|
209
|
-
export declare function applyCloudflareBootstrap(input: CloudflareBootstrapCoordinates, tokens: CloudflareApiTokens, outputPath: string, fetcher?: typeof fetch, workerRunner?: CloudflareWorkerCommandRunner): Promise<CloudflareBootstrapOutput>;
|
|
210
|
-
/**
|
|
211
|
-
* Run the attended Cloudflare phase for `fz bootstrap platform`.
|
|
212
|
-
*
|
|
213
|
-
* Plans are offline. Applies read management tokens only inside this function,
|
|
214
|
-
* persist one-time handoff values only in the owner-only checkpoint, and return
|
|
215
|
-
* a deliberately secret-free evidence record to the outer bootstrap journal.
|
|
216
|
-
*/
|
|
136
|
+
/** Attended, resumable Tunnel/DNS/KV handoff bootstrap. */
|
|
137
|
+
export declare function applyCloudflareBootstrap(input: CloudflareBootstrapCoordinates, tokens: CloudflareApiTokens, outputPath: string, fetcher?: typeof fetch): Promise<CloudflareBootstrapOutput>;
|
|
217
138
|
export declare function runAttendedCloudflareBootstrap(request: AttendedCloudflareBootstrapRequest, dependencies?: CloudflareBootstrapDependencies): Promise<CloudflareBootstrapEvidence>;
|
|
139
|
+
export declare function verifyCloudflareBootstrapAcceptance(checkpointPath: string, fetcher?: typeof fetch): Promise<CloudflareBootstrapAcceptanceEvidence>;
|
|
218
140
|
export {};
|