@treeseed/sdk 0.13.0-rc.77 → 0.13.0-rc.80
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/dist/.treeseed-build-complete.json +1 -1
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-context-pack.d.ts +6 -6
- package/dist/capacity-provider/capability-ontology.d.ts +2 -2
- package/dist/deployment/hosted-topology-template.d.ts +449 -0
- package/dist/deployment/hosted-topology-template.js +56 -0
- package/dist/deployment/hosted-topology.d.ts +1143 -76
- package/dist/deployment/hosted-topology.js +148 -22
- package/dist/deployment/index.d.ts +1 -0
- package/dist/deployment/index.js +1 -0
- package/dist/operator-contracts/canonical-command-tree.js +1 -1
- package/dist/operator-contracts/catalog/hosted-topology-operations.d.ts +102 -9
- package/dist/operator-contracts/control-plane-operations.d.ts +102 -9
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"completedAt":"2026-09-
|
|
1
|
+
{"completedAt":"2026-09-02T09:32:30.488Z"}
|
|
@@ -76,7 +76,7 @@ export declare const assignmentContextSourceSchema: z.ZodObject<{
|
|
|
76
76
|
amount: number;
|
|
77
77
|
unit: "items" | "tokens" | "bytes";
|
|
78
78
|
};
|
|
79
|
-
layer: "live" | "
|
|
79
|
+
layer: "live" | "core" | "tool" | "agent" | "activity";
|
|
80
80
|
disposition: "failed" | "included" | "summarized" | "omitted";
|
|
81
81
|
}, {
|
|
82
82
|
path: string | null;
|
|
@@ -92,7 +92,7 @@ export declare const assignmentContextSourceSchema: z.ZodObject<{
|
|
|
92
92
|
amount: number;
|
|
93
93
|
unit: "items" | "tokens" | "bytes";
|
|
94
94
|
};
|
|
95
|
-
layer: "live" | "
|
|
95
|
+
layer: "live" | "core" | "tool" | "agent" | "activity";
|
|
96
96
|
disposition: "failed" | "included" | "summarized" | "omitted";
|
|
97
97
|
metadata?: Record<string, unknown> | undefined;
|
|
98
98
|
}>;
|
|
@@ -197,7 +197,7 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
|
|
|
197
197
|
amount: number;
|
|
198
198
|
unit: "items" | "tokens" | "bytes";
|
|
199
199
|
};
|
|
200
|
-
layer: "live" | "
|
|
200
|
+
layer: "live" | "core" | "tool" | "agent" | "activity";
|
|
201
201
|
disposition: "failed" | "included" | "summarized" | "omitted";
|
|
202
202
|
}, {
|
|
203
203
|
path: string | null;
|
|
@@ -213,7 +213,7 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
|
|
|
213
213
|
amount: number;
|
|
214
214
|
unit: "items" | "tokens" | "bytes";
|
|
215
215
|
};
|
|
216
|
-
layer: "live" | "
|
|
216
|
+
layer: "live" | "core" | "tool" | "agent" | "activity";
|
|
217
217
|
disposition: "failed" | "included" | "summarized" | "omitted";
|
|
218
218
|
metadata?: Record<string, unknown> | undefined;
|
|
219
219
|
}>, "many">;
|
|
@@ -235,7 +235,7 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
|
|
|
235
235
|
amount: number;
|
|
236
236
|
unit: "items" | "tokens" | "bytes";
|
|
237
237
|
};
|
|
238
|
-
layer: "live" | "
|
|
238
|
+
layer: "live" | "core" | "tool" | "agent" | "activity";
|
|
239
239
|
disposition: "failed" | "included" | "summarized" | "omitted";
|
|
240
240
|
}[];
|
|
241
241
|
digest: string;
|
|
@@ -274,7 +274,7 @@ export declare const assignmentContextPackSchema: z.ZodObject<{
|
|
|
274
274
|
amount: number;
|
|
275
275
|
unit: "items" | "tokens" | "bytes";
|
|
276
276
|
};
|
|
277
|
-
layer: "live" | "
|
|
277
|
+
layer: "live" | "core" | "tool" | "agent" | "activity";
|
|
278
278
|
disposition: "failed" | "included" | "summarized" | "omitted";
|
|
279
279
|
metadata?: Record<string, unknown> | undefined;
|
|
280
280
|
}[];
|
|
@@ -1276,6 +1276,7 @@ export declare const capabilityOfferSchema: z.ZodObject<{
|
|
|
1276
1276
|
digest: string;
|
|
1277
1277
|
}[];
|
|
1278
1278
|
trust: string[];
|
|
1279
|
+
region: string | null;
|
|
1279
1280
|
features: string[];
|
|
1280
1281
|
permissionClasses: string[];
|
|
1281
1282
|
contextModes: string[];
|
|
@@ -1347,7 +1348,6 @@ export declare const capabilityOfferSchema: z.ZodObject<{
|
|
|
1347
1348
|
currency: string | null;
|
|
1348
1349
|
estimatedCost: number | null;
|
|
1349
1350
|
};
|
|
1350
|
-
region: string | null;
|
|
1351
1351
|
offerDigest: string;
|
|
1352
1352
|
}, {
|
|
1353
1353
|
schemaVersion: "treeseed.capability-offer/v2";
|
|
@@ -1357,6 +1357,7 @@ export declare const capabilityOfferSchema: z.ZodObject<{
|
|
|
1357
1357
|
digest: string;
|
|
1358
1358
|
}[];
|
|
1359
1359
|
trust: string[];
|
|
1360
|
+
region: string | null;
|
|
1360
1361
|
features: string[];
|
|
1361
1362
|
permissionClasses: string[];
|
|
1362
1363
|
contextModes: string[];
|
|
@@ -1428,7 +1429,6 @@ export declare const capabilityOfferSchema: z.ZodObject<{
|
|
|
1428
1429
|
currency: string | null;
|
|
1429
1430
|
estimatedCost: number | null;
|
|
1430
1431
|
};
|
|
1431
|
-
region: string | null;
|
|
1432
1432
|
offerDigest: string;
|
|
1433
1433
|
}>;
|
|
1434
1434
|
export declare const capabilityNegotiationReceiptSchema: z.ZodObject<{
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { hostedArtifactSchema } from './hosted-topology.js';
|
|
3
|
+
export declare const hostedTopologyTemplateSchema: z.ZodEffects<z.ZodObject<{
|
|
4
|
+
schemaVersion: z.ZodLiteral<"treeseed.hosted-topology-template/v1">;
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
deploymentId: z.ZodString;
|
|
7
|
+
stackId: z.ZodString;
|
|
8
|
+
environment: z.ZodEnum<["staging", "production"]>;
|
|
9
|
+
mutation: z.ZodLiteral<"approval-required">;
|
|
10
|
+
stateBackend: z.ZodObject<{
|
|
11
|
+
connectionRef: z.ZodString;
|
|
12
|
+
}, "strict", z.ZodTypeAny, {
|
|
13
|
+
connectionRef: string;
|
|
14
|
+
}, {
|
|
15
|
+
connectionRef: string;
|
|
16
|
+
}>;
|
|
17
|
+
providerConnections: z.ZodRecord<z.ZodEnum<["cloudflare", "railway"]>, z.ZodObject<{
|
|
18
|
+
connectionRef: z.ZodString;
|
|
19
|
+
}, "strict", z.ZodTypeAny, {
|
|
20
|
+
connectionRef: string;
|
|
21
|
+
}, {
|
|
22
|
+
connectionRef: string;
|
|
23
|
+
}>>;
|
|
24
|
+
artifactBindings: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
25
|
+
input: z.ZodString;
|
|
26
|
+
kind: z.ZodEnum<["archive", "file", "oci-image"]>;
|
|
27
|
+
}, "strict", z.ZodTypeAny, {
|
|
28
|
+
kind: "oci-image" | "archive" | "file";
|
|
29
|
+
input: string;
|
|
30
|
+
}, {
|
|
31
|
+
kind: "oci-image" | "archive" | "file";
|
|
32
|
+
input: string;
|
|
33
|
+
}>>;
|
|
34
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
provider: z.ZodEnum<["cloudflare", "railway"]>;
|
|
37
|
+
kind: z.ZodEnum<["admin-application", "pages-application", "dns-record", "tls-policy", "api-proxy", "control-plane-api", "postgresql", "operations-runner", "treedx-service"]>;
|
|
38
|
+
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
39
|
+
parameters: z.ZodDefault<z.ZodRecord<z.ZodUnion<[z.ZodString, z.ZodString]>, z.ZodUnion<[z.ZodObject<{
|
|
40
|
+
input: z.ZodString;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
input: string;
|
|
43
|
+
}, {
|
|
44
|
+
input: string;
|
|
45
|
+
}>, z.ZodObject<{
|
|
46
|
+
artifact: z.ZodString;
|
|
47
|
+
}, "strict", z.ZodTypeAny, {
|
|
48
|
+
artifact: string;
|
|
49
|
+
}, {
|
|
50
|
+
artifact: string;
|
|
51
|
+
}>, z.ZodObject<{
|
|
52
|
+
resourceOutput: z.ZodObject<{
|
|
53
|
+
resourceId: z.ZodString;
|
|
54
|
+
output: z.ZodString;
|
|
55
|
+
}, "strict", z.ZodTypeAny, {
|
|
56
|
+
resourceId: string;
|
|
57
|
+
output: string;
|
|
58
|
+
}, {
|
|
59
|
+
resourceId: string;
|
|
60
|
+
output: string;
|
|
61
|
+
}>;
|
|
62
|
+
}, "strict", z.ZodTypeAny, {
|
|
63
|
+
resourceOutput: {
|
|
64
|
+
resourceId: string;
|
|
65
|
+
output: string;
|
|
66
|
+
};
|
|
67
|
+
}, {
|
|
68
|
+
resourceOutput: {
|
|
69
|
+
resourceId: string;
|
|
70
|
+
output: string;
|
|
71
|
+
};
|
|
72
|
+
}>, z.ZodObject<{
|
|
73
|
+
literal: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
74
|
+
}, "strict", z.ZodTypeAny, {
|
|
75
|
+
literal: string | number | boolean;
|
|
76
|
+
}, {
|
|
77
|
+
literal: string | number | boolean;
|
|
78
|
+
}>]>>>;
|
|
79
|
+
adoption: z.ZodObject<{
|
|
80
|
+
mode: z.ZodLiteral<"adopt-or-create">;
|
|
81
|
+
externalIdInput: z.ZodOptional<z.ZodString>;
|
|
82
|
+
replacement: z.ZodLiteral<"forbidden">;
|
|
83
|
+
}, "strict", z.ZodTypeAny, {
|
|
84
|
+
mode: "adopt-or-create";
|
|
85
|
+
replacement: "forbidden";
|
|
86
|
+
externalIdInput?: string | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
mode: "adopt-or-create";
|
|
89
|
+
replacement: "forbidden";
|
|
90
|
+
externalIdInput?: string | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
}, "strict", z.ZodTypeAny, {
|
|
93
|
+
id: string;
|
|
94
|
+
kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
|
|
95
|
+
provider: "cloudflare" | "railway";
|
|
96
|
+
dependsOn: string[];
|
|
97
|
+
parameters: Record<string, {
|
|
98
|
+
input: string;
|
|
99
|
+
} | {
|
|
100
|
+
artifact: string;
|
|
101
|
+
} | {
|
|
102
|
+
resourceOutput: {
|
|
103
|
+
resourceId: string;
|
|
104
|
+
output: string;
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
literal: string | number | boolean;
|
|
108
|
+
}>;
|
|
109
|
+
adoption: {
|
|
110
|
+
mode: "adopt-or-create";
|
|
111
|
+
replacement: "forbidden";
|
|
112
|
+
externalIdInput?: string | undefined;
|
|
113
|
+
};
|
|
114
|
+
}, {
|
|
115
|
+
id: string;
|
|
116
|
+
kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
|
|
117
|
+
provider: "cloudflare" | "railway";
|
|
118
|
+
adoption: {
|
|
119
|
+
mode: "adopt-or-create";
|
|
120
|
+
replacement: "forbidden";
|
|
121
|
+
externalIdInput?: string | undefined;
|
|
122
|
+
};
|
|
123
|
+
dependsOn?: string[] | undefined;
|
|
124
|
+
parameters?: Record<string, {
|
|
125
|
+
input: string;
|
|
126
|
+
} | {
|
|
127
|
+
artifact: string;
|
|
128
|
+
} | {
|
|
129
|
+
resourceOutput: {
|
|
130
|
+
resourceId: string;
|
|
131
|
+
output: string;
|
|
132
|
+
};
|
|
133
|
+
} | {
|
|
134
|
+
literal: string | number | boolean;
|
|
135
|
+
}> | undefined;
|
|
136
|
+
}>, "many">;
|
|
137
|
+
}, "strict", z.ZodTypeAny, {
|
|
138
|
+
schemaVersion: "treeseed.hosted-topology-template/v1";
|
|
139
|
+
resources: {
|
|
140
|
+
id: string;
|
|
141
|
+
kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
|
|
142
|
+
provider: "cloudflare" | "railway";
|
|
143
|
+
dependsOn: string[];
|
|
144
|
+
parameters: Record<string, {
|
|
145
|
+
input: string;
|
|
146
|
+
} | {
|
|
147
|
+
artifact: string;
|
|
148
|
+
} | {
|
|
149
|
+
resourceOutput: {
|
|
150
|
+
resourceId: string;
|
|
151
|
+
output: string;
|
|
152
|
+
};
|
|
153
|
+
} | {
|
|
154
|
+
literal: string | number | boolean;
|
|
155
|
+
}>;
|
|
156
|
+
adoption: {
|
|
157
|
+
mode: "adopt-or-create";
|
|
158
|
+
replacement: "forbidden";
|
|
159
|
+
externalIdInput?: string | undefined;
|
|
160
|
+
};
|
|
161
|
+
}[];
|
|
162
|
+
id: string;
|
|
163
|
+
mutation: "approval-required";
|
|
164
|
+
environment: "production" | "staging";
|
|
165
|
+
deploymentId: string;
|
|
166
|
+
stackId: string;
|
|
167
|
+
stateBackend: {
|
|
168
|
+
connectionRef: string;
|
|
169
|
+
};
|
|
170
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
171
|
+
connectionRef: string;
|
|
172
|
+
}>>;
|
|
173
|
+
artifactBindings: Record<string, {
|
|
174
|
+
kind: "oci-image" | "archive" | "file";
|
|
175
|
+
input: string;
|
|
176
|
+
}>;
|
|
177
|
+
}, {
|
|
178
|
+
schemaVersion: "treeseed.hosted-topology-template/v1";
|
|
179
|
+
resources: {
|
|
180
|
+
id: string;
|
|
181
|
+
kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
|
|
182
|
+
provider: "cloudflare" | "railway";
|
|
183
|
+
adoption: {
|
|
184
|
+
mode: "adopt-or-create";
|
|
185
|
+
replacement: "forbidden";
|
|
186
|
+
externalIdInput?: string | undefined;
|
|
187
|
+
};
|
|
188
|
+
dependsOn?: string[] | undefined;
|
|
189
|
+
parameters?: Record<string, {
|
|
190
|
+
input: string;
|
|
191
|
+
} | {
|
|
192
|
+
artifact: string;
|
|
193
|
+
} | {
|
|
194
|
+
resourceOutput: {
|
|
195
|
+
resourceId: string;
|
|
196
|
+
output: string;
|
|
197
|
+
};
|
|
198
|
+
} | {
|
|
199
|
+
literal: string | number | boolean;
|
|
200
|
+
}> | undefined;
|
|
201
|
+
}[];
|
|
202
|
+
id: string;
|
|
203
|
+
mutation: "approval-required";
|
|
204
|
+
environment: "production" | "staging";
|
|
205
|
+
deploymentId: string;
|
|
206
|
+
stackId: string;
|
|
207
|
+
stateBackend: {
|
|
208
|
+
connectionRef: string;
|
|
209
|
+
};
|
|
210
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
211
|
+
connectionRef: string;
|
|
212
|
+
}>>;
|
|
213
|
+
artifactBindings: Record<string, {
|
|
214
|
+
kind: "oci-image" | "archive" | "file";
|
|
215
|
+
input: string;
|
|
216
|
+
}>;
|
|
217
|
+
}>, {
|
|
218
|
+
schemaVersion: "treeseed.hosted-topology-template/v1";
|
|
219
|
+
resources: {
|
|
220
|
+
id: string;
|
|
221
|
+
kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
|
|
222
|
+
provider: "cloudflare" | "railway";
|
|
223
|
+
dependsOn: string[];
|
|
224
|
+
parameters: Record<string, {
|
|
225
|
+
input: string;
|
|
226
|
+
} | {
|
|
227
|
+
artifact: string;
|
|
228
|
+
} | {
|
|
229
|
+
resourceOutput: {
|
|
230
|
+
resourceId: string;
|
|
231
|
+
output: string;
|
|
232
|
+
};
|
|
233
|
+
} | {
|
|
234
|
+
literal: string | number | boolean;
|
|
235
|
+
}>;
|
|
236
|
+
adoption: {
|
|
237
|
+
mode: "adopt-or-create";
|
|
238
|
+
replacement: "forbidden";
|
|
239
|
+
externalIdInput?: string | undefined;
|
|
240
|
+
};
|
|
241
|
+
}[];
|
|
242
|
+
id: string;
|
|
243
|
+
mutation: "approval-required";
|
|
244
|
+
environment: "production" | "staging";
|
|
245
|
+
deploymentId: string;
|
|
246
|
+
stackId: string;
|
|
247
|
+
stateBackend: {
|
|
248
|
+
connectionRef: string;
|
|
249
|
+
};
|
|
250
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
251
|
+
connectionRef: string;
|
|
252
|
+
}>>;
|
|
253
|
+
artifactBindings: Record<string, {
|
|
254
|
+
kind: "oci-image" | "archive" | "file";
|
|
255
|
+
input: string;
|
|
256
|
+
}>;
|
|
257
|
+
}, {
|
|
258
|
+
schemaVersion: "treeseed.hosted-topology-template/v1";
|
|
259
|
+
resources: {
|
|
260
|
+
id: string;
|
|
261
|
+
kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
|
|
262
|
+
provider: "cloudflare" | "railway";
|
|
263
|
+
adoption: {
|
|
264
|
+
mode: "adopt-or-create";
|
|
265
|
+
replacement: "forbidden";
|
|
266
|
+
externalIdInput?: string | undefined;
|
|
267
|
+
};
|
|
268
|
+
dependsOn?: string[] | undefined;
|
|
269
|
+
parameters?: Record<string, {
|
|
270
|
+
input: string;
|
|
271
|
+
} | {
|
|
272
|
+
artifact: string;
|
|
273
|
+
} | {
|
|
274
|
+
resourceOutput: {
|
|
275
|
+
resourceId: string;
|
|
276
|
+
output: string;
|
|
277
|
+
};
|
|
278
|
+
} | {
|
|
279
|
+
literal: string | number | boolean;
|
|
280
|
+
}> | undefined;
|
|
281
|
+
}[];
|
|
282
|
+
id: string;
|
|
283
|
+
mutation: "approval-required";
|
|
284
|
+
environment: "production" | "staging";
|
|
285
|
+
deploymentId: string;
|
|
286
|
+
stackId: string;
|
|
287
|
+
stateBackend: {
|
|
288
|
+
connectionRef: string;
|
|
289
|
+
};
|
|
290
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
291
|
+
connectionRef: string;
|
|
292
|
+
}>>;
|
|
293
|
+
artifactBindings: Record<string, {
|
|
294
|
+
kind: "oci-image" | "archive" | "file";
|
|
295
|
+
input: string;
|
|
296
|
+
}>;
|
|
297
|
+
}>;
|
|
298
|
+
export type HostedTopologyTemplate = z.infer<typeof hostedTopologyTemplateSchema>;
|
|
299
|
+
export declare const hostedTopologyArtifactInputsSchema: z.ZodObject<{
|
|
300
|
+
schemaVersion: z.ZodLiteral<"treeseed.hosted-topology-artifacts/v1">;
|
|
301
|
+
artifacts: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
302
|
+
kind: z.ZodLiteral<"archive">;
|
|
303
|
+
format: z.ZodLiteral<"tar+gzip">;
|
|
304
|
+
digest: z.ZodString;
|
|
305
|
+
source: z.ZodString;
|
|
306
|
+
}, "strict", z.ZodTypeAny, {
|
|
307
|
+
digest: string;
|
|
308
|
+
source: string;
|
|
309
|
+
kind: "archive";
|
|
310
|
+
format: "tar+gzip";
|
|
311
|
+
}, {
|
|
312
|
+
digest: string;
|
|
313
|
+
source: string;
|
|
314
|
+
kind: "archive";
|
|
315
|
+
format: "tar+gzip";
|
|
316
|
+
}>, z.ZodObject<{
|
|
317
|
+
kind: z.ZodLiteral<"file">;
|
|
318
|
+
mediaType: z.ZodString;
|
|
319
|
+
digest: z.ZodString;
|
|
320
|
+
source: z.ZodString;
|
|
321
|
+
}, "strict", z.ZodTypeAny, {
|
|
322
|
+
digest: string;
|
|
323
|
+
source: string;
|
|
324
|
+
kind: "file";
|
|
325
|
+
mediaType: string;
|
|
326
|
+
}, {
|
|
327
|
+
digest: string;
|
|
328
|
+
source: string;
|
|
329
|
+
kind: "file";
|
|
330
|
+
mediaType: string;
|
|
331
|
+
}>, z.ZodEffects<z.ZodObject<{
|
|
332
|
+
kind: z.ZodLiteral<"oci-image">;
|
|
333
|
+
digest: z.ZodString;
|
|
334
|
+
identity: z.ZodString;
|
|
335
|
+
}, "strict", z.ZodTypeAny, {
|
|
336
|
+
digest: string;
|
|
337
|
+
kind: "oci-image";
|
|
338
|
+
identity: string;
|
|
339
|
+
}, {
|
|
340
|
+
digest: string;
|
|
341
|
+
kind: "oci-image";
|
|
342
|
+
identity: string;
|
|
343
|
+
}>, {
|
|
344
|
+
digest: string;
|
|
345
|
+
kind: "oci-image";
|
|
346
|
+
identity: string;
|
|
347
|
+
}, {
|
|
348
|
+
digest: string;
|
|
349
|
+
kind: "oci-image";
|
|
350
|
+
identity: string;
|
|
351
|
+
}>]>>;
|
|
352
|
+
}, "strict", z.ZodTypeAny, {
|
|
353
|
+
schemaVersion: "treeseed.hosted-topology-artifacts/v1";
|
|
354
|
+
artifacts: Record<string, {
|
|
355
|
+
digest: string;
|
|
356
|
+
source: string;
|
|
357
|
+
kind: "archive";
|
|
358
|
+
format: "tar+gzip";
|
|
359
|
+
} | {
|
|
360
|
+
digest: string;
|
|
361
|
+
source: string;
|
|
362
|
+
kind: "file";
|
|
363
|
+
mediaType: string;
|
|
364
|
+
} | {
|
|
365
|
+
digest: string;
|
|
366
|
+
kind: "oci-image";
|
|
367
|
+
identity: string;
|
|
368
|
+
}>;
|
|
369
|
+
}, {
|
|
370
|
+
schemaVersion: "treeseed.hosted-topology-artifacts/v1";
|
|
371
|
+
artifacts: Record<string, {
|
|
372
|
+
digest: string;
|
|
373
|
+
source: string;
|
|
374
|
+
kind: "archive";
|
|
375
|
+
format: "tar+gzip";
|
|
376
|
+
} | {
|
|
377
|
+
digest: string;
|
|
378
|
+
source: string;
|
|
379
|
+
kind: "file";
|
|
380
|
+
mediaType: string;
|
|
381
|
+
} | {
|
|
382
|
+
digest: string;
|
|
383
|
+
kind: "oci-image";
|
|
384
|
+
identity: string;
|
|
385
|
+
}>;
|
|
386
|
+
}>;
|
|
387
|
+
export type HostedTopologyArtifactInputs = z.infer<typeof hostedTopologyArtifactInputsSchema>;
|
|
388
|
+
export declare function compileHostedTopologyTemplate(input: {
|
|
389
|
+
template: HostedTopologyTemplate;
|
|
390
|
+
teamId: string;
|
|
391
|
+
platformCommit: string;
|
|
392
|
+
artifacts: Record<string, z.input<typeof hostedArtifactSchema>>;
|
|
393
|
+
}): {
|
|
394
|
+
schemaVersion: "treeseed.hosted-topology/v1";
|
|
395
|
+
resources: {
|
|
396
|
+
id: string;
|
|
397
|
+
kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
|
|
398
|
+
provider: "cloudflare" | "railway";
|
|
399
|
+
dependsOn: string[];
|
|
400
|
+
parameters: Record<string, {
|
|
401
|
+
input: string;
|
|
402
|
+
} | {
|
|
403
|
+
artifact: string;
|
|
404
|
+
} | {
|
|
405
|
+
resourceOutput: {
|
|
406
|
+
resourceId: string;
|
|
407
|
+
output: string;
|
|
408
|
+
};
|
|
409
|
+
} | {
|
|
410
|
+
literal: string | number | boolean;
|
|
411
|
+
}>;
|
|
412
|
+
adoption: {
|
|
413
|
+
mode: "adopt-or-create";
|
|
414
|
+
replacement: "forbidden";
|
|
415
|
+
externalIdInput?: string | undefined;
|
|
416
|
+
};
|
|
417
|
+
}[];
|
|
418
|
+
id: string;
|
|
419
|
+
teamId: string;
|
|
420
|
+
platform: {
|
|
421
|
+
repository: "treeseed-ai/platform";
|
|
422
|
+
commit: string;
|
|
423
|
+
};
|
|
424
|
+
mutation: "approval-required";
|
|
425
|
+
environment: "production" | "staging";
|
|
426
|
+
artifacts: Record<string, {
|
|
427
|
+
digest: string;
|
|
428
|
+
source: string;
|
|
429
|
+
kind: "archive";
|
|
430
|
+
format: "tar+gzip";
|
|
431
|
+
} | {
|
|
432
|
+
digest: string;
|
|
433
|
+
source: string;
|
|
434
|
+
kind: "file";
|
|
435
|
+
mediaType: string;
|
|
436
|
+
} | {
|
|
437
|
+
digest: string;
|
|
438
|
+
kind: "oci-image";
|
|
439
|
+
identity: string;
|
|
440
|
+
}>;
|
|
441
|
+
deploymentId: string;
|
|
442
|
+
stackId: string;
|
|
443
|
+
stateBackend: {
|
|
444
|
+
connectionRef: string;
|
|
445
|
+
};
|
|
446
|
+
providerConnections: Partial<Record<"cloudflare" | "railway", {
|
|
447
|
+
connectionRef: string;
|
|
448
|
+
}>>;
|
|
449
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { hostedArtifactSchema, hostedProviderSchema, hostedResourceDeclarationSchema, hostedTopologyDeclarationSchema } from "./hosted-topology.js";
|
|
3
|
+
const identifier = z.string().regex(/^[a-z][a-z0-9.-]{1,63}$/u);
|
|
4
|
+
const custodyIdentifier = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/u);
|
|
5
|
+
const gitCommit = z.string().regex(/^[a-f0-9]{40}$/u);
|
|
6
|
+
const hostedTopologyTemplateSchema = z.object({
|
|
7
|
+
schemaVersion: z.literal("treeseed.hosted-topology-template/v1"),
|
|
8
|
+
id: identifier,
|
|
9
|
+
deploymentId: custodyIdentifier,
|
|
10
|
+
stackId: custodyIdentifier,
|
|
11
|
+
environment: z.enum(["staging", "production"]),
|
|
12
|
+
mutation: z.literal("approval-required"),
|
|
13
|
+
stateBackend: z.object({ connectionRef: identifier }).strict(),
|
|
14
|
+
providerConnections: z.record(hostedProviderSchema, z.object({ connectionRef: identifier }).strict()),
|
|
15
|
+
artifactBindings: z.record(identifier, z.object({ input: identifier, kind: z.enum(["archive", "file", "oci-image"]) }).strict()),
|
|
16
|
+
resources: z.array(hostedResourceDeclarationSchema)
|
|
17
|
+
}).strict().superRefine((template, context) => {
|
|
18
|
+
const referenced = new Set(template.resources.flatMap(({ parameters }) => Object.values(parameters).flatMap((parameter) => "artifact" in parameter ? [parameter.artifact] : [])));
|
|
19
|
+
for (const artifact of referenced) if (!template.artifactBindings[artifact]) context.addIssue({ code: z.ZodIssueCode.custom, path: ["artifactBindings"], message: `Hosted topology template has no binding for ${artifact}.` });
|
|
20
|
+
for (const artifact of Object.keys(template.artifactBindings)) if (!referenced.has(artifact)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["artifactBindings", artifact], message: `Hosted topology artifact binding ${artifact} is unused.` });
|
|
21
|
+
});
|
|
22
|
+
const hostedTopologyArtifactInputsSchema = z.object({
|
|
23
|
+
schemaVersion: z.literal("treeseed.hosted-topology-artifacts/v1"),
|
|
24
|
+
artifacts: z.record(identifier, hostedArtifactSchema)
|
|
25
|
+
}).strict();
|
|
26
|
+
function compileHostedTopologyTemplate(input) {
|
|
27
|
+
const template = hostedTopologyTemplateSchema.parse(input.template), teamId = custodyIdentifier.parse(input.teamId), platformCommit = gitCommit.parse(input.platformCommit);
|
|
28
|
+
const artifactInputs = hostedTopologyArtifactInputsSchema.parse({ schemaVersion: "treeseed.hosted-topology-artifacts/v1", artifacts: input.artifacts }).artifacts;
|
|
29
|
+
const expectedInputs = Object.values(template.artifactBindings).map(({ input: name }) => name).sort(), receivedInputs = Object.keys(artifactInputs).sort();
|
|
30
|
+
if (new Set(expectedInputs).size !== expectedInputs.length) throw new Error("Hosted topology template artifact input names must be unique.");
|
|
31
|
+
if (expectedInputs.join("\n") !== receivedInputs.join("\n")) throw new Error("Hosted topology artifact inputs must match the exact template bindings.");
|
|
32
|
+
const artifacts = Object.fromEntries(Object.entries(template.artifactBindings).sort(([left], [right]) => left.localeCompare(right)).map(([id, binding]) => {
|
|
33
|
+
const artifact = artifactInputs[binding.input];
|
|
34
|
+
if (artifact.kind !== binding.kind) throw new Error(`Hosted topology artifact ${binding.input} must be ${binding.kind}.`);
|
|
35
|
+
return [id, artifact];
|
|
36
|
+
}));
|
|
37
|
+
return hostedTopologyDeclarationSchema.parse({
|
|
38
|
+
schemaVersion: "treeseed.hosted-topology/v1",
|
|
39
|
+
id: template.id,
|
|
40
|
+
teamId,
|
|
41
|
+
deploymentId: template.deploymentId,
|
|
42
|
+
stackId: template.stackId,
|
|
43
|
+
environment: template.environment,
|
|
44
|
+
mutation: template.mutation,
|
|
45
|
+
platform: { repository: "treeseed-ai/platform", commit: platformCommit },
|
|
46
|
+
stateBackend: template.stateBackend,
|
|
47
|
+
providerConnections: template.providerConnections,
|
|
48
|
+
artifacts,
|
|
49
|
+
resources: template.resources
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
compileHostedTopologyTemplate,
|
|
54
|
+
hostedTopologyArtifactInputsSchema,
|
|
55
|
+
hostedTopologyTemplateSchema
|
|
56
|
+
};
|