@forgezero/agent 0.1.53 → 0.1.56
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 -9
- package/dist/agent-heartbeat.js +1 -1
- package/dist/bootstrap.js +110 -69
- package/dist/community-rehearsal-host.d.ts +7 -1
- package/dist/community-rehearsal-host.js +64 -6
- package/dist/container-supervisor.d.ts +36 -0
- package/dist/definition.js +37 -5
- package/dist/deploy-actions.d.ts +87 -0
- package/dist/deploy-compiler.d.ts +26 -0
- package/dist/deploy-compiler.js +1050 -0
- package/dist/deploy-file.js +44 -12
- package/dist/deploy-plan-runner.d.ts +65 -0
- package/dist/deploy-plan-runner.js +1205 -0
- package/dist/deploy-plan.d.ts +41 -0
- package/dist/deploy-plan.js +925 -0
- package/dist/deploy-providers.d.ts +85 -0
- package/dist/deploy.d.ts +439 -0
- package/dist/deploy.js +169 -0
- package/dist/deployment.d.ts +5 -0
- package/dist/fz-agent.js +2137 -326
- package/dist/fz.js +1492 -320
- package/dist/metal-bootstrap.js +1 -1
- package/dist/operator-bootstrap.d.ts +1 -1
- package/dist/operator-bootstrap.js +212 -130
- package/dist/platform-bootstrap-runtime.js +1 -1
- package/dist/platform-fleet-verification.js +499 -120
- package/dist/platform-genesis.d.ts +9 -0
- package/dist/provision.js +399 -20
- package/dist/software-helper.d.ts +5 -0
- package/dist/software-helper.js +399 -18
- package/dist/software.d.ts +1 -1
- package/dist/software.js +37 -5
- package/dist/version.d.ts +1 -1
- package/package.json +17 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type Condition, type RequirementDefinition } from './deploy';
|
|
2
|
+
export interface BunProviderConfig {
|
|
3
|
+
installScope: 'host';
|
|
4
|
+
}
|
|
5
|
+
export interface DockerProviderConfig {
|
|
6
|
+
installScope: 'host';
|
|
7
|
+
storageDriver: 'overlay2';
|
|
8
|
+
dataRoot: string;
|
|
9
|
+
liveRestore: boolean;
|
|
10
|
+
logDriver: 'journald' | 'local';
|
|
11
|
+
defaultNetwork: 'bridge';
|
|
12
|
+
rootless: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface NginxProviderConfig {
|
|
15
|
+
installScope: 'host';
|
|
16
|
+
websocket: boolean;
|
|
17
|
+
maximumBodyMiB: number;
|
|
18
|
+
workerProcesses: 'auto' | number;
|
|
19
|
+
workerConnections: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ArangoDbProviderConfig {
|
|
22
|
+
installScope: 'host';
|
|
23
|
+
runtime: 'native';
|
|
24
|
+
dataPath: string;
|
|
25
|
+
bind: 'private';
|
|
26
|
+
}
|
|
27
|
+
export interface CloudflaredProviderConfig {
|
|
28
|
+
installScope: 'host';
|
|
29
|
+
mode: 'tunnel';
|
|
30
|
+
}
|
|
31
|
+
export interface WarpProviderConfig {
|
|
32
|
+
installScope: 'host';
|
|
33
|
+
mode: 'device' | 'mesh';
|
|
34
|
+
}
|
|
35
|
+
export interface UfwProviderConfig {
|
|
36
|
+
installScope: 'host';
|
|
37
|
+
defaultIncoming: 'deny';
|
|
38
|
+
defaultOutgoing: 'allow';
|
|
39
|
+
}
|
|
40
|
+
export interface OpenSshProviderConfig {
|
|
41
|
+
installScope: 'host';
|
|
42
|
+
mode: 'client';
|
|
43
|
+
}
|
|
44
|
+
export interface SystemdProviderConfig {
|
|
45
|
+
installScope: 'host';
|
|
46
|
+
credentials: 'encrypted';
|
|
47
|
+
serviceSandbox: 'strict';
|
|
48
|
+
}
|
|
49
|
+
type RequirementOptions<T> = {
|
|
50
|
+
version: string;
|
|
51
|
+
config?: Partial<T>;
|
|
52
|
+
when?: Condition;
|
|
53
|
+
};
|
|
54
|
+
export declare const providers: {
|
|
55
|
+
readonly bun: {
|
|
56
|
+
readonly require: (options?: RequirementOptions<BunProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
57
|
+
};
|
|
58
|
+
readonly docker: {
|
|
59
|
+
readonly require: (options?: RequirementOptions<DockerProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
60
|
+
};
|
|
61
|
+
readonly nginx: {
|
|
62
|
+
readonly require: (options?: RequirementOptions<NginxProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
63
|
+
};
|
|
64
|
+
readonly arangodb: {
|
|
65
|
+
readonly require: (options?: RequirementOptions<ArangoDbProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
66
|
+
};
|
|
67
|
+
readonly cloudflared: {
|
|
68
|
+
readonly require: (options?: RequirementOptions<CloudflaredProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
69
|
+
};
|
|
70
|
+
readonly warp: {
|
|
71
|
+
readonly require: (options?: RequirementOptions<WarpProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
72
|
+
};
|
|
73
|
+
readonly ufw: {
|
|
74
|
+
readonly require: (options?: RequirementOptions<UfwProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
75
|
+
};
|
|
76
|
+
readonly openssh: {
|
|
77
|
+
readonly require: (options?: RequirementOptions<OpenSshProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
78
|
+
};
|
|
79
|
+
readonly systemd: {
|
|
80
|
+
readonly require: (options?: RequirementOptions<SystemdProviderConfig>) => RequirementDefinition<import("./deploy").JsonObject>;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
/** Runtime validation for package-owned provider contracts; TypeScript is not a trust boundary. */
|
|
84
|
+
export declare function validateBuiltInProvider(requirement: RequirementDefinition, where: string): void;
|
|
85
|
+
export {};
|
package/dist/deploy.d.ts
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript authoring surface for ForgeZero deployment plans.
|
|
3
|
+
*
|
|
4
|
+
* This module only constructs inert data. The production Agent never imports a
|
|
5
|
+
* repository's TypeScript definition; `fz deploy compile` turns it into the
|
|
6
|
+
* canonical JSON plan consumed by the Agent.
|
|
7
|
+
*/
|
|
8
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
9
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
10
|
+
[key: string]: JsonValue;
|
|
11
|
+
};
|
|
12
|
+
export type JsonObject = {
|
|
13
|
+
[key: string]: JsonValue;
|
|
14
|
+
};
|
|
15
|
+
export type InputDefinition = {
|
|
16
|
+
type: 'string';
|
|
17
|
+
required?: boolean;
|
|
18
|
+
default?: string;
|
|
19
|
+
minimumLength?: number;
|
|
20
|
+
maximumLength?: number;
|
|
21
|
+
pattern?: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'integer';
|
|
24
|
+
required?: boolean;
|
|
25
|
+
default?: number;
|
|
26
|
+
minimum?: number;
|
|
27
|
+
maximum?: number;
|
|
28
|
+
} | {
|
|
29
|
+
type: 'number';
|
|
30
|
+
required?: boolean;
|
|
31
|
+
default?: number;
|
|
32
|
+
minimum?: number;
|
|
33
|
+
maximum?: number;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'boolean';
|
|
36
|
+
required?: boolean;
|
|
37
|
+
default?: boolean;
|
|
38
|
+
} | {
|
|
39
|
+
type: 'enum';
|
|
40
|
+
values: readonly string[];
|
|
41
|
+
required?: boolean;
|
|
42
|
+
default?: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'hostname';
|
|
45
|
+
required?: boolean;
|
|
46
|
+
default?: string;
|
|
47
|
+
};
|
|
48
|
+
export interface ValueReference {
|
|
49
|
+
readonly $ref: `inputs.${string}` | `steps.${string}.status` | `steps.${string}.outputs.${string}` | `components.${string}.${string}` | `targets.${string}.${string}` | `deployment.${string}`;
|
|
50
|
+
}
|
|
51
|
+
export type ResolvableJsonValue = JsonPrimitive | ValueReference | readonly ResolvableJsonValue[] | {
|
|
52
|
+
[key: string]: ResolvableJsonValue;
|
|
53
|
+
};
|
|
54
|
+
export type ResolvableJsonObject = {
|
|
55
|
+
[key: string]: ResolvableJsonValue;
|
|
56
|
+
};
|
|
57
|
+
export type ConditionOperand = JsonPrimitive | ValueReference;
|
|
58
|
+
export type Condition = {
|
|
59
|
+
all: readonly Condition[];
|
|
60
|
+
} | {
|
|
61
|
+
any: readonly Condition[];
|
|
62
|
+
} | {
|
|
63
|
+
not: Condition;
|
|
64
|
+
} | {
|
|
65
|
+
equals: readonly [ConditionOperand, ConditionOperand];
|
|
66
|
+
} | {
|
|
67
|
+
notEquals: readonly [ConditionOperand, ConditionOperand];
|
|
68
|
+
} | {
|
|
69
|
+
greaterThan: readonly [ConditionOperand, ConditionOperand];
|
|
70
|
+
} | {
|
|
71
|
+
greaterThanOrEqual: readonly [ConditionOperand, ConditionOperand];
|
|
72
|
+
} | {
|
|
73
|
+
lessThan: readonly [ConditionOperand, ConditionOperand];
|
|
74
|
+
} | {
|
|
75
|
+
lessThanOrEqual: readonly [ConditionOperand, ConditionOperand];
|
|
76
|
+
} | {
|
|
77
|
+
contains: readonly [ConditionOperand, ConditionOperand];
|
|
78
|
+
} | {
|
|
79
|
+
startsWith: readonly [ConditionOperand, ConditionOperand];
|
|
80
|
+
} | {
|
|
81
|
+
exists: ValueReference;
|
|
82
|
+
} | {
|
|
83
|
+
succeeded: string;
|
|
84
|
+
} | {
|
|
85
|
+
failed: string;
|
|
86
|
+
} | {
|
|
87
|
+
changed: string;
|
|
88
|
+
};
|
|
89
|
+
export interface CredentialDefinition {
|
|
90
|
+
schema: string;
|
|
91
|
+
source: {
|
|
92
|
+
kind: 'vault' | 'systemd';
|
|
93
|
+
name: string;
|
|
94
|
+
fallback?: 'systemd';
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export interface TargetDefinition {
|
|
98
|
+
kind: 'compute';
|
|
99
|
+
selector: {
|
|
100
|
+
profiles: readonly string[];
|
|
101
|
+
confidentialCompute?: 'required' | 'preferred' | 'disabled';
|
|
102
|
+
labels?: Readonly<Record<string, string>>;
|
|
103
|
+
};
|
|
104
|
+
cardinality: {
|
|
105
|
+
minimum: number;
|
|
106
|
+
desired: number | ValueReference;
|
|
107
|
+
maximum: number;
|
|
108
|
+
};
|
|
109
|
+
placement?: {
|
|
110
|
+
spreadBy?: readonly ('metal' | 'region' | 'zone')[];
|
|
111
|
+
antiAffinity?: readonly string[];
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export interface RequirementDefinition<TConfig extends JsonObject = JsonObject> {
|
|
115
|
+
capability: string;
|
|
116
|
+
provider: string;
|
|
117
|
+
contract: number;
|
|
118
|
+
version: string;
|
|
119
|
+
config: TConfig;
|
|
120
|
+
when?: Condition;
|
|
121
|
+
}
|
|
122
|
+
export interface ResourceDefinition {
|
|
123
|
+
cpu?: {
|
|
124
|
+
limit: number;
|
|
125
|
+
weight?: number;
|
|
126
|
+
pinning?: 'automatic' | 'dedicated';
|
|
127
|
+
};
|
|
128
|
+
memory?: {
|
|
129
|
+
limitMiB: number;
|
|
130
|
+
reservationMiB?: number;
|
|
131
|
+
swap?: 'disabled' | 'bounded';
|
|
132
|
+
};
|
|
133
|
+
pids?: {
|
|
134
|
+
limit: number;
|
|
135
|
+
};
|
|
136
|
+
io?: {
|
|
137
|
+
weight?: number;
|
|
138
|
+
readBps?: number;
|
|
139
|
+
writeBps?: number;
|
|
140
|
+
readIops?: number;
|
|
141
|
+
writeIops?: number;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export interface HealthDefinition {
|
|
145
|
+
protocol: 'http';
|
|
146
|
+
method: 'GET' | 'HEAD';
|
|
147
|
+
path: string;
|
|
148
|
+
expectedStatus: readonly number[];
|
|
149
|
+
timeoutMs: number;
|
|
150
|
+
intervalMs?: number;
|
|
151
|
+
attempts?: number;
|
|
152
|
+
}
|
|
153
|
+
export type StorageMount = {
|
|
154
|
+
class: 'ephemeral';
|
|
155
|
+
path: string;
|
|
156
|
+
type: 'tmpfs';
|
|
157
|
+
sizeMiB: number;
|
|
158
|
+
} | {
|
|
159
|
+
class: 'persistent';
|
|
160
|
+
name: string;
|
|
161
|
+
path: string;
|
|
162
|
+
minimumFreePercent?: number;
|
|
163
|
+
} | {
|
|
164
|
+
class: 'database';
|
|
165
|
+
name: string;
|
|
166
|
+
path: string;
|
|
167
|
+
minimumFreePercent: number;
|
|
168
|
+
minimumIops?: number;
|
|
169
|
+
latencyTargetMs?: number;
|
|
170
|
+
};
|
|
171
|
+
export interface NetworkDefinition {
|
|
172
|
+
ingress?: {
|
|
173
|
+
exposure: 'loopback' | 'private' | 'public';
|
|
174
|
+
stablePort?: number;
|
|
175
|
+
};
|
|
176
|
+
private?: {
|
|
177
|
+
mode: 'private-lan' | 'cloudflare-warp' | 'auto';
|
|
178
|
+
preferences?: readonly ('private-lan' | 'cloudflare-warp')[];
|
|
179
|
+
};
|
|
180
|
+
public?: {
|
|
181
|
+
mode: 'disabled' | 'cloudflare-tunnel';
|
|
182
|
+
optional?: boolean;
|
|
183
|
+
};
|
|
184
|
+
container?: {
|
|
185
|
+
mode: 'bridge' | 'host';
|
|
186
|
+
network?: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export type ApplicationRuntime = {
|
|
190
|
+
kind: 'native';
|
|
191
|
+
provider: string;
|
|
192
|
+
requirement: string;
|
|
193
|
+
argv: readonly string[];
|
|
194
|
+
} | {
|
|
195
|
+
kind: 'container';
|
|
196
|
+
provider: string;
|
|
197
|
+
requirement: string;
|
|
198
|
+
image: {
|
|
199
|
+
source: {
|
|
200
|
+
kind: 'build';
|
|
201
|
+
context: string;
|
|
202
|
+
dockerfile: string;
|
|
203
|
+
} | {
|
|
204
|
+
kind: 'registry';
|
|
205
|
+
reference: string;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
entrypoint?: readonly string[];
|
|
209
|
+
security: {
|
|
210
|
+
privileged: false;
|
|
211
|
+
noNewPrivileges: true;
|
|
212
|
+
root: 'read-only' | 'writable';
|
|
213
|
+
dropCapabilities: readonly string[];
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
export interface ApplicationComponent {
|
|
217
|
+
kind: 'application';
|
|
218
|
+
target: string;
|
|
219
|
+
runtime: ApplicationRuntime;
|
|
220
|
+
service: {
|
|
221
|
+
protocol: 'http';
|
|
222
|
+
port: number;
|
|
223
|
+
health: HealthDefinition;
|
|
224
|
+
websocket?: boolean;
|
|
225
|
+
maximumConnections?: number;
|
|
226
|
+
};
|
|
227
|
+
resources: ResourceDefinition;
|
|
228
|
+
storage?: readonly StorageMount[];
|
|
229
|
+
network?: NetworkDefinition;
|
|
230
|
+
rollout: {
|
|
231
|
+
strategy: 'direct' | 'blue-green' | 'rolling' | 'canary';
|
|
232
|
+
proxy?: string;
|
|
233
|
+
drainMs?: number;
|
|
234
|
+
automaticRollback?: boolean;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
export interface DatabaseComponent {
|
|
238
|
+
kind: 'database';
|
|
239
|
+
target: string;
|
|
240
|
+
runtime: {
|
|
241
|
+
provider: string;
|
|
242
|
+
requirement: string;
|
|
243
|
+
mode: 'native';
|
|
244
|
+
};
|
|
245
|
+
topology: {
|
|
246
|
+
mode: 'standalone';
|
|
247
|
+
} | {
|
|
248
|
+
mode: 'cluster';
|
|
249
|
+
bootstrapMembers: number;
|
|
250
|
+
replicationFactor: number;
|
|
251
|
+
writeConcern: number;
|
|
252
|
+
additionalJoiners: 'allowed' | 'disabled';
|
|
253
|
+
};
|
|
254
|
+
resources?: ResourceDefinition;
|
|
255
|
+
storage: StorageMount & {
|
|
256
|
+
class: 'database';
|
|
257
|
+
};
|
|
258
|
+
network: NetworkDefinition;
|
|
259
|
+
}
|
|
260
|
+
export type ComponentDefinition = ApplicationComponent | DatabaseComponent;
|
|
261
|
+
export type StepScope = {
|
|
262
|
+
kind: 'release-executor';
|
|
263
|
+
} | {
|
|
264
|
+
kind: 'elected-one';
|
|
265
|
+
group: string;
|
|
266
|
+
} | {
|
|
267
|
+
kind: 'each-target';
|
|
268
|
+
target: string;
|
|
269
|
+
} | {
|
|
270
|
+
kind: 'target-batches';
|
|
271
|
+
target: string;
|
|
272
|
+
size: number;
|
|
273
|
+
};
|
|
274
|
+
export interface RetryDefinition {
|
|
275
|
+
attempts: number;
|
|
276
|
+
backoff: {
|
|
277
|
+
kind: 'fixed' | 'linear' | 'exponential';
|
|
278
|
+
initialMs: number;
|
|
279
|
+
maximumMs: number;
|
|
280
|
+
};
|
|
281
|
+
retryOn?: readonly ('network' | 'timeout' | 'provider-unavailable' | 'rate-limited' | 'conflict')[];
|
|
282
|
+
}
|
|
283
|
+
export interface WorkflowStepDefinition<TWith extends ResolvableJsonObject = ResolvableJsonObject> {
|
|
284
|
+
uses: `${string}@${number}`;
|
|
285
|
+
with: TWith;
|
|
286
|
+
if?: Condition;
|
|
287
|
+
scope: StepScope;
|
|
288
|
+
timeoutMs?: number;
|
|
289
|
+
retry?: RetryDefinition;
|
|
290
|
+
failure?: {
|
|
291
|
+
policy: 'continue' | 'stop' | 'rollback-stage' | 'rollback-deployment' | 'compensate' | 'manual-intervention';
|
|
292
|
+
};
|
|
293
|
+
compensate?: {
|
|
294
|
+
uses: `${string}@${number}`;
|
|
295
|
+
with: ResolvableJsonObject;
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
export interface StageDefinition {
|
|
299
|
+
dependsOn?: readonly string[];
|
|
300
|
+
if?: Condition;
|
|
301
|
+
strategy: {
|
|
302
|
+
mode: 'sequential' | 'parallel' | 'rolling' | 'blue-green' | 'canary';
|
|
303
|
+
maximumConcurrency?: number;
|
|
304
|
+
batchSize?: number;
|
|
305
|
+
minimumHealthy?: number;
|
|
306
|
+
increments?: readonly number[];
|
|
307
|
+
observationMs?: number;
|
|
308
|
+
};
|
|
309
|
+
steps: Readonly<Record<string, WorkflowStepDefinition>>;
|
|
310
|
+
}
|
|
311
|
+
export interface WorkflowDefinition {
|
|
312
|
+
concurrency?: {
|
|
313
|
+
group: string;
|
|
314
|
+
limit: number;
|
|
315
|
+
};
|
|
316
|
+
stages: Readonly<Record<string, StageDefinition>>;
|
|
317
|
+
}
|
|
318
|
+
export interface DeploymentSource {
|
|
319
|
+
apiVersion: 'deploy.forgezero.net/v1';
|
|
320
|
+
kind: 'Deployment';
|
|
321
|
+
metadata: {
|
|
322
|
+
name: string;
|
|
323
|
+
description?: string;
|
|
324
|
+
};
|
|
325
|
+
spec: {
|
|
326
|
+
security?: {
|
|
327
|
+
attestation?: 'required' | 'preferred' | 'disabled';
|
|
328
|
+
};
|
|
329
|
+
inputs?: Readonly<Record<string, InputDefinition>>;
|
|
330
|
+
credentials?: Readonly<Record<string, CredentialDefinition>>;
|
|
331
|
+
targets: Readonly<Record<string, TargetDefinition>>;
|
|
332
|
+
requirements?: Readonly<Record<string, RequirementDefinition>>;
|
|
333
|
+
components: Readonly<Record<string, ComponentDefinition>>;
|
|
334
|
+
workflows: Readonly<Record<string, WorkflowDefinition>>;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
export declare const input: {
|
|
338
|
+
string: (value?: Omit<Extract<InputDefinition, {
|
|
339
|
+
type: "string";
|
|
340
|
+
}>, "type">) => {
|
|
341
|
+
readonly required?: boolean;
|
|
342
|
+
readonly default?: string;
|
|
343
|
+
readonly minimumLength?: number;
|
|
344
|
+
readonly maximumLength?: number;
|
|
345
|
+
readonly pattern?: string;
|
|
346
|
+
readonly type: "string";
|
|
347
|
+
};
|
|
348
|
+
integer: (value?: Omit<Extract<InputDefinition, {
|
|
349
|
+
type: "integer";
|
|
350
|
+
}>, "type">) => {
|
|
351
|
+
readonly required?: boolean;
|
|
352
|
+
readonly default?: number;
|
|
353
|
+
readonly minimum?: number;
|
|
354
|
+
readonly maximum?: number;
|
|
355
|
+
readonly type: "integer";
|
|
356
|
+
};
|
|
357
|
+
number: (value?: Omit<Extract<InputDefinition, {
|
|
358
|
+
type: "number";
|
|
359
|
+
}>, "type">) => {
|
|
360
|
+
readonly required?: boolean;
|
|
361
|
+
readonly default?: number;
|
|
362
|
+
readonly minimum?: number;
|
|
363
|
+
readonly maximum?: number;
|
|
364
|
+
readonly type: "number";
|
|
365
|
+
};
|
|
366
|
+
boolean: (value?: Omit<Extract<InputDefinition, {
|
|
367
|
+
type: "boolean";
|
|
368
|
+
}>, "type">) => {
|
|
369
|
+
readonly required?: boolean;
|
|
370
|
+
readonly default?: boolean;
|
|
371
|
+
readonly type: "boolean";
|
|
372
|
+
};
|
|
373
|
+
enum: <const T extends readonly string[]>(value: {
|
|
374
|
+
values: T;
|
|
375
|
+
required?: boolean;
|
|
376
|
+
default?: T[number];
|
|
377
|
+
}) => {
|
|
378
|
+
readonly values: T;
|
|
379
|
+
readonly required?: boolean;
|
|
380
|
+
readonly default?: T[number];
|
|
381
|
+
readonly type: "enum";
|
|
382
|
+
};
|
|
383
|
+
hostname: (value?: Omit<Extract<InputDefinition, {
|
|
384
|
+
type: "hostname";
|
|
385
|
+
}>, "type">) => {
|
|
386
|
+
readonly required?: boolean;
|
|
387
|
+
readonly default?: string;
|
|
388
|
+
readonly type: "hostname";
|
|
389
|
+
};
|
|
390
|
+
ref: <T extends string>(name: T) => ValueReference;
|
|
391
|
+
};
|
|
392
|
+
export declare const ref: {
|
|
393
|
+
stepStatus: (step: string) => ValueReference;
|
|
394
|
+
stepOutput: (step: string, output: string) => ValueReference;
|
|
395
|
+
component: (component: string, property: string) => ValueReference;
|
|
396
|
+
target: (target: string, property: string) => ValueReference;
|
|
397
|
+
deployment: (property: string) => ValueReference;
|
|
398
|
+
};
|
|
399
|
+
export declare const conditions: {
|
|
400
|
+
all: (...values: Condition[]) => Condition;
|
|
401
|
+
any: (...values: Condition[]) => Condition;
|
|
402
|
+
not: (value: Condition) => Condition;
|
|
403
|
+
equals: (left: ConditionOperand, right: ConditionOperand) => Condition;
|
|
404
|
+
notEquals: (left: ConditionOperand, right: ConditionOperand) => Condition;
|
|
405
|
+
greaterThan: (left: ConditionOperand, right: ConditionOperand) => Condition;
|
|
406
|
+
greaterThanOrEqual: (left: ConditionOperand, right: ConditionOperand) => Condition;
|
|
407
|
+
lessThan: (left: ConditionOperand, right: ConditionOperand) => Condition;
|
|
408
|
+
lessThanOrEqual: (left: ConditionOperand, right: ConditionOperand) => Condition;
|
|
409
|
+
contains: (left: ConditionOperand, right: ConditionOperand) => Condition;
|
|
410
|
+
startsWith: (left: ConditionOperand, right: ConditionOperand) => Condition;
|
|
411
|
+
exists: (value: ValueReference) => Condition;
|
|
412
|
+
succeeded: (step: string) => Condition;
|
|
413
|
+
failed: (step: string) => Condition;
|
|
414
|
+
changed: (step: string) => Condition;
|
|
415
|
+
};
|
|
416
|
+
export declare const credential: {
|
|
417
|
+
vault: (value: {
|
|
418
|
+
schema: string;
|
|
419
|
+
name: string;
|
|
420
|
+
fallback?: "systemd";
|
|
421
|
+
}) => CredentialDefinition;
|
|
422
|
+
systemd: (value: {
|
|
423
|
+
schema: string;
|
|
424
|
+
name: string;
|
|
425
|
+
}) => CredentialDefinition;
|
|
426
|
+
};
|
|
427
|
+
export declare const target: {
|
|
428
|
+
compute: (value: Omit<TargetDefinition, "kind">) => TargetDefinition;
|
|
429
|
+
};
|
|
430
|
+
export declare function requirement<TConfig extends JsonObject>(value: RequirementDefinition<TConfig>): RequirementDefinition<TConfig>;
|
|
431
|
+
export declare function application(value: Omit<ApplicationComponent, 'kind'>): ApplicationComponent;
|
|
432
|
+
export declare function database(value: Omit<DatabaseComponent, 'kind'>): DatabaseComponent;
|
|
433
|
+
export declare function step<TWith extends ResolvableJsonObject>(value: WorkflowStepDefinition<TWith>): WorkflowStepDefinition<TWith>;
|
|
434
|
+
export declare function stage(value: StageDefinition): StageDefinition;
|
|
435
|
+
export declare function workflow(value: WorkflowDefinition): WorkflowDefinition;
|
|
436
|
+
export declare function defineDeployment<const T extends DeploymentSource>(definition: T): T;
|
|
437
|
+
export { actions } from './deploy-actions';
|
|
438
|
+
export { providers } from './deploy-providers';
|
|
439
|
+
export type { ArangoDbProviderConfig, BunProviderConfig, CloudflaredProviderConfig, DockerProviderConfig, NginxProviderConfig, OpenSshProviderConfig, SystemdProviderConfig, UfwProviderConfig, WarpProviderConfig } from './deploy-providers';
|
package/dist/deploy.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// src/deploy-actions.ts
|
|
2
|
+
function action(uses, withValue, options) {
|
|
3
|
+
return step({ uses, with: withValue, scope: options.scope, ...options.if ? { if: options.if } : {}, ...options.timeoutMs ? { timeoutMs: options.timeoutMs } : {}, ...options.retry ? { retry: options.retry } : {}, ...options.failure ? { failure: options.failure } : {}, ...options.compensate ? { compensate: options.compensate } : {} });
|
|
4
|
+
}
|
|
5
|
+
var actions = {
|
|
6
|
+
software: {
|
|
7
|
+
ensure: (withValue, options) => action("forgezero.software/ensure@1", withValue, options)
|
|
8
|
+
},
|
|
9
|
+
exec: {
|
|
10
|
+
argv: (withValue, options) => action("forgezero.exec/argv@1", withValue, options)
|
|
11
|
+
},
|
|
12
|
+
container: {
|
|
13
|
+
build: (withValue, options) => action("forgezero.oci/build@1", withValue, options),
|
|
14
|
+
pull: (withValue, options) => action("forgezero.oci/pull@1", withValue, options)
|
|
15
|
+
},
|
|
16
|
+
service: {
|
|
17
|
+
deploy: (withValue, options) => action("forgezero.service/deploy@1", withValue, options),
|
|
18
|
+
health: (withValue, options) => action("forgezero.health/http@1", withValue, options),
|
|
19
|
+
promote: (withValue, options) => action("forgezero.service/promote@1", withValue, options)
|
|
20
|
+
},
|
|
21
|
+
storage: {
|
|
22
|
+
verify: (withValue, options) => action("forgezero.storage/verify@1", withValue, options)
|
|
23
|
+
},
|
|
24
|
+
extension: (uses, withValue, options) => action(uses, withValue, options)
|
|
25
|
+
};
|
|
26
|
+
// src/deploy-providers.ts
|
|
27
|
+
function define(capability, provider, options, defaults) {
|
|
28
|
+
return requirement({
|
|
29
|
+
capability,
|
|
30
|
+
provider,
|
|
31
|
+
contract: 1,
|
|
32
|
+
version: options.version,
|
|
33
|
+
config: { ...defaults, ...options.config ?? {} },
|
|
34
|
+
...options.when ? { when: options.when } : {}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
var providers = {
|
|
38
|
+
bun: {
|
|
39
|
+
require: (options = { version: "1.3.14" }) => define("runtime.javascript", "forgezero.bun", options, { installScope: "host" })
|
|
40
|
+
},
|
|
41
|
+
docker: {
|
|
42
|
+
require: (options = { version: "ubuntu-26.04" }) => define("runtime.container", "forgezero.docker", options, {
|
|
43
|
+
installScope: "host",
|
|
44
|
+
storageDriver: "overlay2",
|
|
45
|
+
dataRoot: "/var/lib/docker",
|
|
46
|
+
liveRestore: true,
|
|
47
|
+
logDriver: "local",
|
|
48
|
+
defaultNetwork: "bridge",
|
|
49
|
+
rootless: false
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
nginx: {
|
|
53
|
+
require: (options = { version: "ubuntu-26.04" }) => define("proxy.http", "forgezero.nginx", options, {
|
|
54
|
+
installScope: "host",
|
|
55
|
+
websocket: true,
|
|
56
|
+
maximumBodyMiB: 16,
|
|
57
|
+
workerProcesses: "auto",
|
|
58
|
+
workerConnections: 4096
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
arangodb: {
|
|
62
|
+
require: (options = { version: "3.11.14" }) => define("database.arangodb", "forgezero.arangodb", options, {
|
|
63
|
+
installScope: "host",
|
|
64
|
+
runtime: "native",
|
|
65
|
+
dataPath: "/var/lib/arangodb3",
|
|
66
|
+
bind: "private"
|
|
67
|
+
})
|
|
68
|
+
},
|
|
69
|
+
cloudflared: {
|
|
70
|
+
require: (options = { version: "2026.7.3" }) => define("network.public-tunnel", "forgezero.cloudflared", options, { installScope: "host", mode: "tunnel" })
|
|
71
|
+
},
|
|
72
|
+
warp: {
|
|
73
|
+
require: (options = { version: "2026.6.822.0-min" }) => define("network.private", "forgezero.warp", options, { installScope: "host", mode: "device" })
|
|
74
|
+
},
|
|
75
|
+
ufw: {
|
|
76
|
+
require: (options = { version: "ubuntu-26.04" }) => define("security.firewall", "forgezero.ufw", options, { installScope: "host", defaultIncoming: "deny", defaultOutgoing: "allow" })
|
|
77
|
+
},
|
|
78
|
+
openssh: {
|
|
79
|
+
require: (options = { version: "ubuntu-26.04" }) => define("transport.ssh", "forgezero.openssh", options, { installScope: "host", mode: "client" })
|
|
80
|
+
},
|
|
81
|
+
systemd: {
|
|
82
|
+
require: (options = { version: "ubuntu-26.04" }) => define("service.manager", "forgezero.systemd", options, { installScope: "host", credentials: "encrypted", serviceSandbox: "strict" })
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// src/deploy.ts
|
|
87
|
+
var input = {
|
|
88
|
+
string: (value = {}) => ({ type: "string", ...value }),
|
|
89
|
+
integer: (value = {}) => ({ type: "integer", ...value }),
|
|
90
|
+
number: (value = {}) => ({ type: "number", ...value }),
|
|
91
|
+
boolean: (value = {}) => ({ type: "boolean", ...value }),
|
|
92
|
+
enum: (value) => ({ type: "enum", ...value }),
|
|
93
|
+
hostname: (value = {}) => ({ type: "hostname", ...value }),
|
|
94
|
+
ref: (name) => ({ $ref: `inputs.${name}` })
|
|
95
|
+
};
|
|
96
|
+
var ref = {
|
|
97
|
+
stepStatus: (step2) => ({ $ref: `steps.${step2}.status` }),
|
|
98
|
+
stepOutput: (step2, output) => ({ $ref: `steps.${step2}.outputs.${output}` }),
|
|
99
|
+
component: (component, property) => ({ $ref: `components.${component}.${property}` }),
|
|
100
|
+
target: (target, property) => ({ $ref: `targets.${target}.${property}` }),
|
|
101
|
+
deployment: (property) => ({ $ref: `deployment.${property}` })
|
|
102
|
+
};
|
|
103
|
+
var conditions = {
|
|
104
|
+
all: (...values) => ({ all: values }),
|
|
105
|
+
any: (...values) => ({ any: values }),
|
|
106
|
+
not: (value) => ({ not: value }),
|
|
107
|
+
equals: (left, right) => ({ equals: [left, right] }),
|
|
108
|
+
notEquals: (left, right) => ({ notEquals: [left, right] }),
|
|
109
|
+
greaterThan: (left, right) => ({ greaterThan: [left, right] }),
|
|
110
|
+
greaterThanOrEqual: (left, right) => ({ greaterThanOrEqual: [left, right] }),
|
|
111
|
+
lessThan: (left, right) => ({ lessThan: [left, right] }),
|
|
112
|
+
lessThanOrEqual: (left, right) => ({ lessThanOrEqual: [left, right] }),
|
|
113
|
+
contains: (left, right) => ({ contains: [left, right] }),
|
|
114
|
+
startsWith: (left, right) => ({ startsWith: [left, right] }),
|
|
115
|
+
exists: (value) => ({ exists: value }),
|
|
116
|
+
succeeded: (step2) => ({ succeeded: step2 }),
|
|
117
|
+
failed: (step2) => ({ failed: step2 }),
|
|
118
|
+
changed: (step2) => ({ changed: step2 })
|
|
119
|
+
};
|
|
120
|
+
var credential = {
|
|
121
|
+
vault: (value) => ({
|
|
122
|
+
schema: value.schema,
|
|
123
|
+
source: { kind: "vault", name: value.name, ...value.fallback ? { fallback: value.fallback } : {} }
|
|
124
|
+
}),
|
|
125
|
+
systemd: (value) => ({
|
|
126
|
+
schema: value.schema,
|
|
127
|
+
source: { kind: "systemd", name: value.name }
|
|
128
|
+
})
|
|
129
|
+
};
|
|
130
|
+
var target = {
|
|
131
|
+
compute: (value) => ({ kind: "compute", ...value })
|
|
132
|
+
};
|
|
133
|
+
function requirement(value) {
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
function application(value) {
|
|
137
|
+
return { kind: "application", ...value };
|
|
138
|
+
}
|
|
139
|
+
function database(value) {
|
|
140
|
+
return { kind: "database", ...value };
|
|
141
|
+
}
|
|
142
|
+
function step(value) {
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
function stage(value) {
|
|
146
|
+
return value;
|
|
147
|
+
}
|
|
148
|
+
function workflow(value) {
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
function defineDeployment(definition) {
|
|
152
|
+
return definition;
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
workflow,
|
|
156
|
+
target,
|
|
157
|
+
step,
|
|
158
|
+
stage,
|
|
159
|
+
requirement,
|
|
160
|
+
ref,
|
|
161
|
+
providers,
|
|
162
|
+
input,
|
|
163
|
+
defineDeployment,
|
|
164
|
+
database,
|
|
165
|
+
credential,
|
|
166
|
+
conditions,
|
|
167
|
+
application,
|
|
168
|
+
actions
|
|
169
|
+
};
|