@huaweidevtools/aishell-dsh-deploy 0.0.14 → 0.0.16
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 +25 -9
- package/cordis.patch.yml +12 -3
- package/lib/data/permission-registry.json +1 -1
- package/lib/index.js +5271 -1402
- package/lib/types/auth-http.d.ts +36 -4
- package/lib/types/auth-obs-signer.d.ts +8 -5
- package/lib/types/auth-signer.d.ts +6 -1
- package/lib/types/bridge.d.ts +4 -4
- package/lib/types/bss.d.ts +159 -0
- package/lib/types/catalog.d.ts +118 -0
- package/lib/types/credentials.d.ts +64 -18
- package/lib/types/d2-render.d.ts +74 -0
- package/lib/types/data-paths.d.ts +10 -0
- package/lib/types/deployment-state.d.ts +90 -13
- package/lib/types/existing.d.ts +79 -0
- package/lib/types/gates/cost_gate.d.ts +38 -16
- package/lib/types/gates/credential_gate.d.ts +29 -3
- package/lib/types/gates/design_gate.d.ts +72 -0
- package/lib/types/gates/mirror.d.ts +1 -1
- package/lib/types/gates/plan_gate.d.ts +116 -0
- package/lib/types/gates/provider_installed.d.ts +32 -0
- package/lib/types/gates/terraform_env.d.ts +15 -2
- package/lib/types/hcl.d.ts +176 -0
- package/lib/types/index.d.ts +18 -4
- package/lib/types/network-checks.d.ts +67 -0
- package/lib/types/permission/gate.d.ts +6 -6
- package/lib/types/permission/registry.d.ts +11 -0
- package/lib/types/plan.d.ts +68 -0
- package/lib/types/prompt.d.ts +5 -4
- package/lib/types/rating-map.d.ts +132 -0
- package/lib/types/security-groups.d.ts +16 -23
- package/lib/types/terraform-run.d.ts +32 -0
- package/lib/types/tools/annotations.d.ts +1 -1
- package/lib/types/tools/balance_summary.d.ts +1 -1
- package/lib/types/tools/deployment.d.ts +3 -3
- package/lib/types/tools/design.d.ts +54 -0
- package/lib/types/tools/errors.d.ts +22 -4
- package/lib/types/tools/examples.d.ts +1 -1
- package/lib/types/tools/existing_resources.d.ts +1 -1
- package/lib/types/tools/index.d.ts +26 -12
- package/lib/types/tools/openapi.d.ts +19 -9
- package/lib/types/tools/pricing.d.ts +213 -0
- package/lib/types/tools/provider_schema.d.ts +1 -1
- package/lib/types/tools/specs.d.ts +41 -0
- package/lib/types/tools/terraform.d.ts +27 -25
- package/lib/types/topology.d.ts +232 -0
- package/lib/types/types.d.ts +1 -1
- package/lib/types/utils/hash.d.ts +15 -5
- package/package.json +4 -2
- package/lib/types/gates/networking_gate.d.ts +0 -9
- package/lib/types/schemas/cost.d.ts +0 -108
- package/lib/types/schemas/networking.d.ts +0 -115
- package/lib/types/tools/cost.d.ts +0 -16
- package/lib/types/tools/networking.d.ts +0 -13
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The network topology, derived from the `.tf` files a deployment contains.
|
|
3
|
+
*
|
|
4
|
+
* ## What this module is
|
|
5
|
+
*
|
|
6
|
+
* A pure transform: resource blocks in, a normalized topology out. No
|
|
7
|
+
* filesystem, no terraform binary, no rendering — those live in the callers.
|
|
8
|
+
* Keeping the derivation pure is what makes the interesting part testable: the
|
|
9
|
+
* containment rule, the reference resolution and the display facts all run
|
|
10
|
+
* against a string.
|
|
11
|
+
*
|
|
12
|
+
* ## Why the `.tf` is the source of truth
|
|
13
|
+
*
|
|
14
|
+
* A network design and the resources that implement it are the same
|
|
15
|
+
* configuration. Holding a second, hand-written description of the network
|
|
16
|
+
* beside the `.tf` means two statements of one fact, and the day they disagree
|
|
17
|
+
* there is no way to tell which one terraform will act on. Deriving the
|
|
18
|
+
* topology from the configuration removes the second statement entirely: every
|
|
19
|
+
* node in the diagram is a resource block terraform will create, and the
|
|
20
|
+
* picture cannot drift from what runs.
|
|
21
|
+
*
|
|
22
|
+
* What follows from that choice:
|
|
23
|
+
*
|
|
24
|
+
* - The model edits `.tf` and nothing else. There is no synchronisation step.
|
|
25
|
+
* - `terraform validate` becomes the schema. Provider attribute names,
|
|
26
|
+
* required-ness and value formats are checked by the provider itself, so
|
|
27
|
+
* this module never encodes any of them.
|
|
28
|
+
* - What the provider does NOT check — overlapping CIDRs, a gateway outside
|
|
29
|
+
* its subnet, a rule open to the world — is reported by `network-checks` as
|
|
30
|
+
* a FINDING rather than a validation error. Those are properties of the
|
|
31
|
+
* assembled network, not of any single block, and `terraform validate`
|
|
32
|
+
* accepts them.
|
|
33
|
+
*
|
|
34
|
+
* ## Containment is read from the configuration, never guessed
|
|
35
|
+
*
|
|
36
|
+
* A subnet lives inside the VPC its `vpc_id` names. That reference is the only
|
|
37
|
+
* evidence of containment available before terraform runs, so it is what
|
|
38
|
+
* decides the nesting. A node whose containment reference is missing or points
|
|
39
|
+
* at an unknown resource lands at the root — visibly unparented, which a reader
|
|
40
|
+
* can see and fix, rather than silently nested in the wrong box.
|
|
41
|
+
*
|
|
42
|
+
* @module @huaweidevtools/aishell-dsh-deploy/topology
|
|
43
|
+
*/
|
|
44
|
+
import type { ResourceBlock } from './hcl.ts';
|
|
45
|
+
import type { ExistingResource } from './existing.ts';
|
|
46
|
+
/**
|
|
47
|
+
* What a node in the topology represents.
|
|
48
|
+
*
|
|
49
|
+
* These are the kinds a network design is written in — nothing else appears in
|
|
50
|
+
* the picture. A resource outside this list is reported by name (see
|
|
51
|
+
* {@link Topology.omitted}) rather than drawn, because a diagram is read by
|
|
52
|
+
* comparing boxes and a box that represents nothing the reader is comparing
|
|
53
|
+
* against is noise exactly where the signal has to fit.
|
|
54
|
+
*/
|
|
55
|
+
export type NodeKind = 'vpc' | 'subnet' | 'security-group' | 'security-group-rule' | 'gateway' | 'load-balancer'
|
|
56
|
+
/** A compute instance: belongs to the subnet its `network` block names. */
|
|
57
|
+
| 'compute'
|
|
58
|
+
/** A managed database (RDS, DCS, GaussDB): belongs to its `subnet_id`. */
|
|
59
|
+
| 'database';
|
|
60
|
+
/** One node in the derived picture. */
|
|
61
|
+
export interface TopologyNode {
|
|
62
|
+
/** Stable identity: the terraform address (`huaweicloud_vpc_subnet.web`). */
|
|
63
|
+
readonly address: string;
|
|
64
|
+
readonly type: string;
|
|
65
|
+
readonly name: string;
|
|
66
|
+
readonly kind: NodeKind;
|
|
67
|
+
/**
|
|
68
|
+
* Whether this resource already exists in the account, rather than being
|
|
69
|
+
* created by this deployment.
|
|
70
|
+
*
|
|
71
|
+
* The distinction is the one a reviewer checks first ("am I about to
|
|
72
|
+
* duplicate what we have?"), so it is a property of the node rather than
|
|
73
|
+
* something a renderer infers from its address.
|
|
74
|
+
*/
|
|
75
|
+
readonly existing: boolean;
|
|
76
|
+
/** The address of the node this one belongs inside, or `undefined` at the root. */
|
|
77
|
+
readonly parent: string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Every container above this node, nearest first (`[parent, grandparent, …]`).
|
|
80
|
+
*
|
|
81
|
+
* A compute instance is placed in a subnet, but a reader asking "where does
|
|
82
|
+
* this live" means the VPC too. The chain is precomputed so a renderer never
|
|
83
|
+
* has to walk parents itself.
|
|
84
|
+
*/
|
|
85
|
+
readonly ancestors: readonly string[];
|
|
86
|
+
/** Attributes worth showing on the box, already chosen for display. */
|
|
87
|
+
readonly facts: readonly TopologyFact[];
|
|
88
|
+
/** The node's children, in configuration order. */
|
|
89
|
+
readonly children: readonly TopologyNode[];
|
|
90
|
+
}
|
|
91
|
+
/** One attribute shown on a node's box. */
|
|
92
|
+
export interface TopologyFact {
|
|
93
|
+
readonly key: string;
|
|
94
|
+
readonly value: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* How two VPCs are joined.
|
|
98
|
+
*
|
|
99
|
+
* A connection is a RELATIONSHIP, not a device: a peering, an endpoint or a
|
|
100
|
+
* route has no place of its own, and drawing it as a box would present it as
|
|
101
|
+
* something the network contains. What it says is "these two are reachable from
|
|
102
|
+
* each other, this way" — so it becomes a labelled edge between the two VPCs,
|
|
103
|
+
* which is how a reader asks the question.
|
|
104
|
+
*/
|
|
105
|
+
export interface TopologyConnection {
|
|
106
|
+
/** The terraform address of the resource that establishes it. */
|
|
107
|
+
readonly address: string;
|
|
108
|
+
readonly type: string;
|
|
109
|
+
/** `peering` | `endpoint` | `route`, for the label and the colour. */
|
|
110
|
+
readonly kind: ConnectionKind;
|
|
111
|
+
/** The VPC addresses it joins. Either may be absent when unresolved. */
|
|
112
|
+
readonly from: string | undefined;
|
|
113
|
+
readonly to: string | undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The ways this provider joins two networks.
|
|
117
|
+
*
|
|
118
|
+
* Each is a resource whose placement argument is `vpc_id`, and whose other
|
|
119
|
+
* side is either an explicit peer or a service reached through an endpoint:
|
|
120
|
+
*
|
|
121
|
+
* - `huaweicloud_vpc_peering_connection` — `vpc_id` ↔ `peer_vpc_id`.
|
|
122
|
+
* - `huaweicloud_vpcep_endpoint` — `vpc_id` ↔ the endpoint service's VPC. The
|
|
123
|
+
* service is usually another account's, so the far side is often not in
|
|
124
|
+
* this configuration at all; the edge is then drawn to the endpoint
|
|
125
|
+
* SERVICE, which is what the EC is reachable at.
|
|
126
|
+
* - `huaweicloud_vpc_route` — `vpc_id` → wherever the next hop goes. Exactly
|
|
127
|
+
* one side is in this deployment in most cases.
|
|
128
|
+
*
|
|
129
|
+
* A route is the weakest of the three as a "connection": it points at a next
|
|
130
|
+
* hop rather than at a peer. It is included because a reader tracing how a
|
|
131
|
+
* subnet reaches the outside world needs to see it, and excluded from the
|
|
132
|
+
* object is nothing.
|
|
133
|
+
*/
|
|
134
|
+
export type ConnectionKind = 'peering' | 'endpoint' | 'route';
|
|
135
|
+
/** How serious a finding is. */
|
|
136
|
+
export type FindingSeverity = 'error' | 'warning';
|
|
137
|
+
/**
|
|
138
|
+
* A design problem the provider's own validation does not catch.
|
|
139
|
+
*
|
|
140
|
+
* Reported, not enforced: `terraform validate` passing does not mean the
|
|
141
|
+
* network is sensible, and a deployment that silently accepts overlapping
|
|
142
|
+
* subnets is one whose first `apply` produces a broken VPC.
|
|
143
|
+
*/
|
|
144
|
+
export interface Finding {
|
|
145
|
+
readonly severity: FindingSeverity;
|
|
146
|
+
/** One-line statement of the problem, naming the resources involved. */
|
|
147
|
+
readonly summary: string;
|
|
148
|
+
/** Why it matters, and what to do about it. */
|
|
149
|
+
readonly detail: string;
|
|
150
|
+
/** The resource addresses involved, so a reader can go straight to them. */
|
|
151
|
+
readonly addresses: readonly string[];
|
|
152
|
+
}
|
|
153
|
+
/** The whole derived picture. */
|
|
154
|
+
export interface Topology {
|
|
155
|
+
/** Root nodes in configuration order; children are nested inside. */
|
|
156
|
+
readonly roots: readonly TopologyNode[];
|
|
157
|
+
/** Every node, flattened, for lookups. */
|
|
158
|
+
readonly nodes: readonly TopologyNode[];
|
|
159
|
+
/** Design problems found while deriving. */
|
|
160
|
+
readonly findings: readonly Finding[];
|
|
161
|
+
/** Node kinds present, so a renderer can decide whether there is a picture. */
|
|
162
|
+
readonly kinds: readonly NodeKind[];
|
|
163
|
+
/**
|
|
164
|
+
* How the VPCs in this design reach each other.
|
|
165
|
+
*
|
|
166
|
+
* Reported separately from the nodes because a connection is not a thing the
|
|
167
|
+
* network contains — it is a relationship between two of them, and the
|
|
168
|
+
* picture draws it as a labelled edge.
|
|
169
|
+
*/
|
|
170
|
+
readonly connections: readonly TopologyConnection[];
|
|
171
|
+
/**
|
|
172
|
+
* Resources the configuration declares that the picture does not show.
|
|
173
|
+
*
|
|
174
|
+
* Reported rather than ignored, and counted rather than listed one by one:
|
|
175
|
+
* a deployment legitimately declares alarm rules, backups, key pairs and
|
|
176
|
+
* parameter templates alongside its network, and a reader needs to know the
|
|
177
|
+
* diagram is not the whole file — without reading forty boxes to find out.
|
|
178
|
+
*/
|
|
179
|
+
readonly omitted: readonly OmittedResource[];
|
|
180
|
+
}
|
|
181
|
+
/** One resource type left out of the picture, and how many of it there are. */
|
|
182
|
+
export interface OmittedResource {
|
|
183
|
+
readonly type: string;
|
|
184
|
+
readonly count: number;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Derive the whole topology from resource blocks.
|
|
188
|
+
*
|
|
189
|
+
* @param blocks - every resource block across the deployment's `.tf` files.
|
|
190
|
+
* @returns the nested picture, the flat node list, and the findings.
|
|
191
|
+
*/
|
|
192
|
+
export declare function deriveTopology(blocks: readonly ResourceBlock[], existing?: readonly ExistingResource[]): Topology;
|
|
193
|
+
/**
|
|
194
|
+
* One drawable relationship.
|
|
195
|
+
*
|
|
196
|
+
* `label` is present only for a connection, and it is what tells a renderer to
|
|
197
|
+
* draw the edge differently: "reachable through this" is a different claim from
|
|
198
|
+
* "refers to this", and a picture that renders both as bare arrows says the
|
|
199
|
+
* wrong thing about one of them.
|
|
200
|
+
*/
|
|
201
|
+
export interface TopologyEdge {
|
|
202
|
+
readonly from: string;
|
|
203
|
+
readonly to: string;
|
|
204
|
+
/** The connection kind, when this edge IS a connection between networks. */
|
|
205
|
+
readonly connection?: ConnectionKind;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The relationships a renderer should draw as lines.
|
|
209
|
+
*
|
|
210
|
+
* Two sources, and they mean different things:
|
|
211
|
+
*
|
|
212
|
+
* 1. **A reference** — one resource names another, and the nesting does not
|
|
213
|
+
* already express it. Every subnet references its VPC's `id`, and the
|
|
214
|
+
* subnet is also nested inside that VPC; drawing both puts an arrow from
|
|
215
|
+
* each subnet to the box that already contains it, which reads as a
|
|
216
|
+
* connection between peers and is the one thing the picture must not say.
|
|
217
|
+
* Containment is expressed by the nesting alone.
|
|
218
|
+
* 2. **A connection** — a peering, an endpoint or a route joins two VPCs.
|
|
219
|
+
* These are not references at all: the resource exists to state that the
|
|
220
|
+
* two networks can reach each other, so it becomes a LABELLED edge and the
|
|
221
|
+
* resource itself is not a box.
|
|
222
|
+
*
|
|
223
|
+
* References to resources the topology does not know (a `data.` source, a
|
|
224
|
+
* variable's members) are dropped: an edge needs two boxes, and inventing one
|
|
225
|
+
* would present a relationship that may not exist.
|
|
226
|
+
*
|
|
227
|
+
* @param blocks - every resource block.
|
|
228
|
+
* @param topology - the derived topology, whose addresses are the drawable ones.
|
|
229
|
+
* @returns one entry per drawable relationship.
|
|
230
|
+
*/
|
|
231
|
+
export declare function edgesOf(blocks: readonly ResourceBlock[], topology: Topology): TopologyEdge[];
|
|
232
|
+
//# sourceMappingURL=topology.d.ts.map
|
package/lib/types/types.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export interface ToolAnnotations {
|
|
|
75
75
|
*
|
|
76
76
|
* Implemented by `bridge.ts`. The handler's argument is `any` rather than
|
|
77
77
|
* `unknown` because each registrar passes a handler typed to its own
|
|
78
|
-
* zod-inferred shape; a stricter signature would force a cast at all
|
|
78
|
+
* zod-inferred shape; a stricter signature would force a cast at all 18
|
|
79
79
|
* registration sites.
|
|
80
80
|
*/
|
|
81
81
|
export interface ToolRegistrar {
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SHA-256 hash of
|
|
2
|
+
* SHA-256 hash of a deployment's configuration, recorded as `tf_hash`.
|
|
3
3
|
*
|
|
4
|
-
* Deterministic: files sorted by
|
|
5
|
-
* "sha256:" + SHA256(
|
|
4
|
+
* Deterministic: files sorted by path, content hashed, concatenated.
|
|
5
|
+
* "sha256:" + SHA256(path1 + hash1 + path2 + hash2 + ...)
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* ## Which files
|
|
8
|
+
*
|
|
9
|
+
* The same set every other reader uses — {@link configurationFiles} in `hcl`,
|
|
10
|
+
* which includes a local module's `.tf`. That is the point of routing through
|
|
11
|
+
* one function: the digest answers "has the configuration changed since it was
|
|
12
|
+
* checked", and a file the design tool READ but the digest IGNORED would let an
|
|
13
|
+
* edit pass every gate unnoticed.
|
|
14
|
+
*
|
|
15
|
+
* A `.terraform/` directory is excluded by that function's construction, not by
|
|
16
|
+
* a filter here: it holds providers, downloaded modules and the state, and
|
|
17
|
+
* hashing those would make the digest change whenever terraform fetched
|
|
18
|
+
* anything.
|
|
9
19
|
*/
|
|
10
20
|
export declare function computeTfHash(dir: string): Promise<string>;
|
|
11
21
|
//# sourceMappingURL=hash.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaweidevtools/aishell-dsh-deploy",
|
|
3
3
|
"description": "Huawei Cloud infrastructure tools for DSH — Terraform, OpenAPI, resource inventory, cost estimates",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.16",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,10 +27,12 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@terrastruct/d2": "^0.1.33",
|
|
30
31
|
"adm-zip": "^0.6.1",
|
|
32
|
+
"hcl2-parser": "^1.0.3",
|
|
31
33
|
"jsonpath-plus": "^10.4.0",
|
|
32
34
|
"zod": "^4.2.0",
|
|
33
|
-
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.
|
|
35
|
+
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.16"
|
|
34
36
|
},
|
|
35
37
|
"peerDependencies": {
|
|
36
38
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* networking_gate.ts — existence check for networking.json (§6.3 门 1).
|
|
3
|
-
*
|
|
4
|
-
* Weak gate: only proves the networking design was persisted. Cannot
|
|
5
|
-
* verify .tf matches the design (HCL semantics, needs AI).
|
|
6
|
-
*/
|
|
7
|
-
export declare function networkingJsonExists(dir: string): Promise<boolean>;
|
|
8
|
-
export declare function assertNetworking(dir: string): Promise<void>;
|
|
9
|
-
//# sourceMappingURL=networking_gate.d.ts.map
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* cost.json zod schema.
|
|
3
|
-
*
|
|
4
|
-
* Two charging shapes (§5.3):
|
|
5
|
-
* Shape A (包周期类): mode prepaid|on-demand, period/period_unit/auto_renew
|
|
6
|
-
* Shape B (带宽类): mode bandwidth|traffic, share_type/size
|
|
7
|
-
*
|
|
8
|
-
* cost.json uses lowercase/hyphen mode values (prepaid/on-demand); the
|
|
9
|
-
* provider uses camelCase (prePaid/postPaid). The translation mapping
|
|
10
|
-
* (§5.3) is documented in the design doc — server does NOT validate
|
|
11
|
-
* charging↔.tf consistency (HCL semantics, out of scope).
|
|
12
|
-
*/
|
|
13
|
-
import { z } from "zod";
|
|
14
|
-
declare const chargingSchema: z.ZodObject<{
|
|
15
|
-
mode: z.ZodEnum<{
|
|
16
|
-
bandwidth: "bandwidth";
|
|
17
|
-
prepaid: "prepaid";
|
|
18
|
-
"on-demand": "on-demand";
|
|
19
|
-
traffic: "traffic";
|
|
20
|
-
}>;
|
|
21
|
-
period: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
period_unit: z.ZodOptional<z.ZodEnum<{
|
|
23
|
-
month: "month";
|
|
24
|
-
year: "year";
|
|
25
|
-
}>>;
|
|
26
|
-
auto_renew: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
-
share_type: z.ZodOptional<z.ZodEnum<{
|
|
28
|
-
PER: "PER";
|
|
29
|
-
WHOLE: "WHOLE";
|
|
30
|
-
STANDARD: "STANDARD";
|
|
31
|
-
}>>;
|
|
32
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
33
|
-
}, z.core.$strip>;
|
|
34
|
-
declare const costItemSchema: z.ZodObject<{
|
|
35
|
-
resource: z.ZodString;
|
|
36
|
-
source: z.ZodEnum<{
|
|
37
|
-
reuse: "reuse";
|
|
38
|
-
new: "new";
|
|
39
|
-
}>;
|
|
40
|
-
existing_id: z.ZodOptional<z.ZodString>;
|
|
41
|
-
spec: z.ZodString;
|
|
42
|
-
charging: z.ZodObject<{
|
|
43
|
-
mode: z.ZodEnum<{
|
|
44
|
-
bandwidth: "bandwidth";
|
|
45
|
-
prepaid: "prepaid";
|
|
46
|
-
"on-demand": "on-demand";
|
|
47
|
-
traffic: "traffic";
|
|
48
|
-
}>;
|
|
49
|
-
period: z.ZodOptional<z.ZodNumber>;
|
|
50
|
-
period_unit: z.ZodOptional<z.ZodEnum<{
|
|
51
|
-
month: "month";
|
|
52
|
-
year: "year";
|
|
53
|
-
}>>;
|
|
54
|
-
auto_renew: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
-
share_type: z.ZodOptional<z.ZodEnum<{
|
|
56
|
-
PER: "PER";
|
|
57
|
-
WHOLE: "WHOLE";
|
|
58
|
-
STANDARD: "STANDARD";
|
|
59
|
-
}>>;
|
|
60
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
61
|
-
}, z.core.$strip>;
|
|
62
|
-
monthly: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<null>]>;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
export declare const CostSchema: z.ZodObject<{
|
|
65
|
-
$schema: z.ZodOptional<z.ZodString>;
|
|
66
|
-
currency: z.ZodEnum<{
|
|
67
|
-
CNY: "CNY";
|
|
68
|
-
USD: "USD";
|
|
69
|
-
}>;
|
|
70
|
-
items: z.ZodArray<z.ZodObject<{
|
|
71
|
-
resource: z.ZodString;
|
|
72
|
-
source: z.ZodEnum<{
|
|
73
|
-
reuse: "reuse";
|
|
74
|
-
new: "new";
|
|
75
|
-
}>;
|
|
76
|
-
existing_id: z.ZodOptional<z.ZodString>;
|
|
77
|
-
spec: z.ZodString;
|
|
78
|
-
charging: z.ZodObject<{
|
|
79
|
-
mode: z.ZodEnum<{
|
|
80
|
-
bandwidth: "bandwidth";
|
|
81
|
-
prepaid: "prepaid";
|
|
82
|
-
"on-demand": "on-demand";
|
|
83
|
-
traffic: "traffic";
|
|
84
|
-
}>;
|
|
85
|
-
period: z.ZodOptional<z.ZodNumber>;
|
|
86
|
-
period_unit: z.ZodOptional<z.ZodEnum<{
|
|
87
|
-
month: "month";
|
|
88
|
-
year: "year";
|
|
89
|
-
}>>;
|
|
90
|
-
auto_renew: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
-
share_type: z.ZodOptional<z.ZodEnum<{
|
|
92
|
-
PER: "PER";
|
|
93
|
-
WHOLE: "WHOLE";
|
|
94
|
-
STANDARD: "STANDARD";
|
|
95
|
-
}>>;
|
|
96
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
97
|
-
}, z.core.$strip>;
|
|
98
|
-
monthly: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<null>]>;
|
|
99
|
-
}, z.core.$strip>>;
|
|
100
|
-
total_monthly: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<null>]>>;
|
|
101
|
-
tf_hash: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<null>]>>;
|
|
102
|
-
estimated_at: z.ZodOptional<z.ZodString>;
|
|
103
|
-
}, z.core.$strip>;
|
|
104
|
-
export type Cost = z.infer<typeof CostSchema>;
|
|
105
|
-
export type CostItem = z.infer<typeof costItemSchema>;
|
|
106
|
-
export type Charging = z.infer<typeof chargingSchema>;
|
|
107
|
-
export {};
|
|
108
|
-
//# sourceMappingURL=cost.d.ts.map
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* networking.json zod schema.
|
|
3
|
-
*
|
|
4
|
-
* Three layers: topology (infra), network_objects (eips/nat/lb),
|
|
5
|
-
* components (resource identity + optional network attach).
|
|
6
|
-
*
|
|
7
|
-
* Validation tiers (§6):
|
|
8
|
-
* A (server hard-validates): reference consistency, uniqueness, CIDR
|
|
9
|
-
* B (structural): enums, required, port ranges
|
|
10
|
-
* C (loose): ports syntax, source CIDR, description — non-empty only
|
|
11
|
-
*
|
|
12
|
-
* Validation reads its contract from this in-code schema, NOT
|
|
13
|
-
* from the file's $schema field. $schema is just a label; the file is a
|
|
14
|
-
* request body, not a persistent contract — server upgrades don't
|
|
15
|
-
* promise to accept old files (re-run update_networking).
|
|
16
|
-
*/
|
|
17
|
-
import { z } from "zod";
|
|
18
|
-
export declare const NetworkingSchema: z.ZodObject<{
|
|
19
|
-
$schema: z.ZodOptional<z.ZodString>;
|
|
20
|
-
topology: z.ZodObject<{
|
|
21
|
-
vpc: z.ZodObject<{
|
|
22
|
-
name: z.ZodString;
|
|
23
|
-
cidr: z.ZodString;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
subnets: z.ZodArray<z.ZodObject<{
|
|
26
|
-
name: z.ZodString;
|
|
27
|
-
cidr: z.ZodString;
|
|
28
|
-
az: z.ZodString;
|
|
29
|
-
route_table: z.ZodOptional<z.ZodString>;
|
|
30
|
-
}, z.core.$strip>>;
|
|
31
|
-
route_tables: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
32
|
-
name: z.ZodString;
|
|
33
|
-
routes: z.ZodArray<z.ZodObject<{
|
|
34
|
-
destination: z.ZodString;
|
|
35
|
-
next_hop_type: z.ZodEnum<{
|
|
36
|
-
nat: "nat";
|
|
37
|
-
vpn: "vpn";
|
|
38
|
-
peering: "peering";
|
|
39
|
-
internet: "internet";
|
|
40
|
-
}>;
|
|
41
|
-
next_hop: z.ZodString;
|
|
42
|
-
}, z.core.$strip>>;
|
|
43
|
-
}, z.core.$strip>>>;
|
|
44
|
-
security_groups: z.ZodArray<z.ZodObject<{
|
|
45
|
-
name: z.ZodString;
|
|
46
|
-
rules: z.ZodArray<z.ZodObject<{
|
|
47
|
-
direction: z.ZodEnum<{
|
|
48
|
-
ingress: "ingress";
|
|
49
|
-
egress: "egress";
|
|
50
|
-
}>;
|
|
51
|
-
protocol: z.ZodEnum<{
|
|
52
|
-
any: "any";
|
|
53
|
-
tcp: "tcp";
|
|
54
|
-
udp: "udp";
|
|
55
|
-
icmp: "icmp";
|
|
56
|
-
icmpv6: "icmpv6";
|
|
57
|
-
}>;
|
|
58
|
-
ports: z.ZodString;
|
|
59
|
-
source: z.ZodOptional<z.ZodString>;
|
|
60
|
-
destination: z.ZodOptional<z.ZodString>;
|
|
61
|
-
description: z.ZodOptional<z.ZodString>;
|
|
62
|
-
}, z.core.$strip>>;
|
|
63
|
-
}, z.core.$strip>>;
|
|
64
|
-
}, z.core.$strip>;
|
|
65
|
-
network_objects: z.ZodOptional<z.ZodObject<{
|
|
66
|
-
eips: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
-
id: z.ZodString;
|
|
68
|
-
bandwidth: z.ZodString;
|
|
69
|
-
attached_to: z.ZodObject<{
|
|
70
|
-
kind: z.ZodEnum<{
|
|
71
|
-
nat: "nat";
|
|
72
|
-
instance: "instance";
|
|
73
|
-
port: "port";
|
|
74
|
-
}>;
|
|
75
|
-
target: z.ZodString;
|
|
76
|
-
}, z.core.$strip>;
|
|
77
|
-
}, z.core.$strip>>>;
|
|
78
|
-
nat_gateways: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
79
|
-
id: z.ZodString;
|
|
80
|
-
subnet: z.ZodString;
|
|
81
|
-
snat_eip: z.ZodString;
|
|
82
|
-
snat_source_cidr: z.ZodString;
|
|
83
|
-
}, z.core.$strip>>>;
|
|
84
|
-
loadbalancers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
85
|
-
id: z.ZodString;
|
|
86
|
-
subnet: z.ZodString;
|
|
87
|
-
vip_type: z.ZodEnum<{
|
|
88
|
-
external: "external";
|
|
89
|
-
internal: "internal";
|
|
90
|
-
}>;
|
|
91
|
-
listeners: z.ZodArray<z.ZodObject<{
|
|
92
|
-
port: z.ZodNumber;
|
|
93
|
-
protocol: z.ZodEnum<{
|
|
94
|
-
tcp: "tcp";
|
|
95
|
-
udp: "udp";
|
|
96
|
-
http: "http";
|
|
97
|
-
https: "https";
|
|
98
|
-
}>;
|
|
99
|
-
}, z.core.$strip>>;
|
|
100
|
-
members: z.ZodArray<z.ZodObject<{
|
|
101
|
-
target: z.ZodString;
|
|
102
|
-
port: z.ZodNumber;
|
|
103
|
-
}, z.core.$strip>>;
|
|
104
|
-
}, z.core.$strip>>>;
|
|
105
|
-
}, z.core.$strip>>;
|
|
106
|
-
components: z.ZodArray<z.ZodObject<{
|
|
107
|
-
id: z.ZodString;
|
|
108
|
-
type: z.ZodString;
|
|
109
|
-
subnet: z.ZodOptional<z.ZodString>;
|
|
110
|
-
security_groups: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
|
-
instance: z.ZodOptional<z.ZodString>;
|
|
112
|
-
}, z.core.$strip>>;
|
|
113
|
-
}, z.core.$strip>;
|
|
114
|
-
export type Networking = z.infer<typeof NetworkingSchema>;
|
|
115
|
-
//# sourceMappingURL=networking.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ToolRegistrar } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* update_cost.
|
|
4
|
-
*
|
|
5
|
-
* inputSchema uses CostSchema directly — the zod-to-JSON-Schema conversion
|
|
6
|
-
* preserves the full structure (currency/items/charging), so the model sees
|
|
7
|
-
* exactly what fields to pass. superRefine (reuse→existing_id check) is
|
|
8
|
-
* runtime validation only; it does NOT block the JSON Schema export.
|
|
9
|
-
*
|
|
10
|
-
* Cross-file reference check (§5.2 A-layer): items[].resource must reference
|
|
11
|
-
* a component id in networking.json. This CANNOT be done in the zod schema
|
|
12
|
-
* (it validates one file; the reference target is another file). It's done
|
|
13
|
-
* in the handler after schema parse succeeds.
|
|
14
|
-
*/
|
|
15
|
-
export declare function registerCostTool(registrar: ToolRegistrar): void;
|
|
16
|
-
//# sourceMappingURL=cost.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ToolRegistrar } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* update_networking.
|
|
4
|
-
*
|
|
5
|
-
* inputSchema uses NetworkingSchema directly — the zod-to-JSON-Schema
|
|
6
|
-
* conversion preserves the full structure (topology/components/network_objects),
|
|
7
|
-
* so the model sees exactly what fields to pass. superRefine (A-layer
|
|
8
|
-
* reference consistency) is runtime validation only; it does NOT block the
|
|
9
|
-
* JSON Schema export (verified: z.toJSONSchema emits the object shape
|
|
10
|
-
* regardless of superRefine).
|
|
11
|
-
*/
|
|
12
|
-
export declare function registerNetworkingTool(registrar: ToolRegistrar): void;
|
|
13
|
-
//# sourceMappingURL=networking.d.ts.map
|