@platformcosmo/parts-base 0.0.0-stage → 0.1.0
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/LICENSE +201 -0
- package/NOTICE +14 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +347 -0
- package/package.json +38 -3
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
PlatformCosmo
|
|
2
|
+
Copyright 2026 MIRASTACK LABS PRIVATE LIMITED
|
|
3
|
+
|
|
4
|
+
This product includes software developed at MIRASTACK LABS PRIVATE LIMITED
|
|
5
|
+
(https://github.com/mirastacklabs-ai/platformcosmo).
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0. See LICENSE.
|
|
8
|
+
Bundled third-party icon sets carry their own licenses, listed under LICENSES/.
|
|
9
|
+
|
|
10
|
+
Bundled icon sets (notices in LICENSES/): PlatformCosmo base glyphs (Apache-2.0),
|
|
11
|
+
Lucide (ISC, plus MIT for Feather-derived icons), Kubernetes icons (Apache-2.0),
|
|
12
|
+
and the subset of Simple Icons whose per-icon license is CC0-1.0 or a verified Apache-2.0 (no MIT).
|
|
13
|
+
Bundled fonts (Latin subsets, SIL OFL 1.1, texts in LICENSES/): Oswald and JetBrains Mono.
|
|
14
|
+
Brand and Kubernetes marks are trademarks of their respective owners.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PartShapeDef, ParamValue, ParamSpec, PartShapePack, PartShapeRegistry } from '@platformcosmo/core';
|
|
2
|
+
export { ParamSpec } from '@platformcosmo/core';
|
|
3
|
+
|
|
4
|
+
/** In the order of assemblies §5. */
|
|
5
|
+
declare const hwShapes: readonly PartShapeDef[];
|
|
6
|
+
|
|
7
|
+
/** Validated shape params: integers, booleans and enum strings only. */
|
|
8
|
+
type HwParams = Record<string, ParamValue>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Extent limits per axis. Pack shapes expect real length units (mm, cm or in): coordinates are
|
|
12
|
+
* rounded to 2 decimals of the unit, so a part a few hundredths of a unit across degenerates.
|
|
13
|
+
* Sizes are clamped to [MIN_DIM, MAX_EXTENT_MM] by `definePack` so every origin is non-negative and finite.
|
|
14
|
+
*/
|
|
15
|
+
declare const MAX_EXTENT_MM = 100000;
|
|
16
|
+
/** Declared params of an `hw:` shape id, for docs and tests. */
|
|
17
|
+
declare const paramSpecsOf: (shapeId: string) => ReadonlyMap<string, ParamSpec> | undefined;
|
|
18
|
+
|
|
19
|
+
/** PlatformCosmo `hw:` part shapes (Track E-2a): generic server internals in millimetres. */
|
|
20
|
+
|
|
21
|
+
declare const hwPack: PartShapePack;
|
|
22
|
+
/** Registry over the `hw:` pack; `get` takes the full `hw:id` ref. */
|
|
23
|
+
declare const registry: PartShapeRegistry;
|
|
24
|
+
|
|
25
|
+
export { MAX_EXTENT_MM, hwPack, hwShapes, paramSpecsOf, registry };
|
|
26
|
+
export type { HwParams };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
// src/define.ts
|
|
2
|
+
import {
|
|
3
|
+
Draft,
|
|
4
|
+
MAX_PARAM_DIAGNOSTICS,
|
|
5
|
+
definePack
|
|
6
|
+
} from "@platformcosmo/core";
|
|
7
|
+
var MAX_EXTENT_MM = 1e5;
|
|
8
|
+
var pack = definePack({ prefix: "hw", maxExtent: MAX_EXTENT_MM });
|
|
9
|
+
var paramSpecsOf = pack.paramSpecsOf;
|
|
10
|
+
var defineShape = pack.defineShape;
|
|
11
|
+
|
|
12
|
+
// src/shapes.ts
|
|
13
|
+
var int = (min, max, def) => ({
|
|
14
|
+
kind: "int",
|
|
15
|
+
min,
|
|
16
|
+
max,
|
|
17
|
+
def
|
|
18
|
+
});
|
|
19
|
+
var bool = (def) => ({ kind: "bool", def });
|
|
20
|
+
var enumOf = (values, def) => ({
|
|
21
|
+
kind: "enum",
|
|
22
|
+
values,
|
|
23
|
+
def
|
|
24
|
+
});
|
|
25
|
+
function spread(i, n, w, lo, hi) {
|
|
26
|
+
const gap = (hi - lo - n * w) / (n + 1);
|
|
27
|
+
return lo + gap + i * (w + gap);
|
|
28
|
+
}
|
|
29
|
+
var board = defineShape({
|
|
30
|
+
id: "board",
|
|
31
|
+
label: "Server board",
|
|
32
|
+
type: "board",
|
|
33
|
+
role: "internal",
|
|
34
|
+
size: [305, 330, 12],
|
|
35
|
+
params: { sockets: int(0, 2, 2), dimmSlots: int(0, 16, 8) },
|
|
36
|
+
draw(g, p, tone) {
|
|
37
|
+
g.add("pcb", "plate", [0, 0, 0], [305, 330, 1.6], tone, { paint: true });
|
|
38
|
+
for (let i = 0; i < p.sockets; i++) {
|
|
39
|
+
g.add(`socket-${i}`, "box", [60, 50 + i * 130, 1.6], [60, 60, 4], "muted", { core: false });
|
|
40
|
+
}
|
|
41
|
+
for (let i = 0; i < p.dimmSlots; i++) {
|
|
42
|
+
g.add(`dimm-slot-${i}`, "box", [165, 5 + i * 20, 1.6], [133, 5.5, 10.4], "muted", {
|
|
43
|
+
core: false
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
g.add("io-header", "box", [4, 10, 1.6], [30, 50, 10.4], "muted", { core: false });
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
var cpu = defineShape({
|
|
51
|
+
id: "cpu",
|
|
52
|
+
label: "CPU package",
|
|
53
|
+
type: "cpu",
|
|
54
|
+
role: "internal",
|
|
55
|
+
size: [76, 56, 5],
|
|
56
|
+
params: { lid: bool(true) },
|
|
57
|
+
draw(g, p, tone) {
|
|
58
|
+
g.add("substrate", "plate", [0, 0, 0], [76, 56, 1.2], tone, { paint: true });
|
|
59
|
+
if (p.lid) g.add("lid", "box", [8, 6, 1.2], [60, 44, 3.8], "metal");
|
|
60
|
+
else g.add("die", "box", [22, 16, 1.2], [32, 24, 3.8], "metal");
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
var heatsink = defineShape({
|
|
65
|
+
id: "heatsink",
|
|
66
|
+
label: "Heatsink",
|
|
67
|
+
type: "heatsink",
|
|
68
|
+
role: "internal",
|
|
69
|
+
size: [105, 90, 60],
|
|
70
|
+
params: { fins: int(2, 48, 20) },
|
|
71
|
+
draw(g, p) {
|
|
72
|
+
g.add("base", "box", [0, 0, 0], [105, 90, 6], "metal", { paint: true });
|
|
73
|
+
const n = p.fins;
|
|
74
|
+
for (let i = 0; i < n; i++) {
|
|
75
|
+
g.add(`fin-${i}`, "plate", [i * 104 / (n - 1), 0, 6], [1, 90, 54], "metal");
|
|
76
|
+
}
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
var dimm = defineShape({
|
|
81
|
+
id: "dimm",
|
|
82
|
+
label: "Memory module",
|
|
83
|
+
type: "dimm",
|
|
84
|
+
role: "internal",
|
|
85
|
+
size: [133.35, 4, 31.25],
|
|
86
|
+
params: { chips: int(0, 9, 8), spreader: bool(false) },
|
|
87
|
+
draw(g, p, tone) {
|
|
88
|
+
const sp = p.spreader;
|
|
89
|
+
const y0 = sp ? 0.5 : 0;
|
|
90
|
+
const t = 1.4 - y0;
|
|
91
|
+
g.add("pins", "plate", [4, 1.4, 0], [125, 1.2, 3], "metal", { core: false });
|
|
92
|
+
g.add("pcb", "plate", [0, 1.4, 3], [133.35, 1.2, 28.25], tone, { paint: true });
|
|
93
|
+
for (let i = 0; i < p.chips; i++) {
|
|
94
|
+
g.add(`chip-f-${i}`, "box", [6 + i * 13.4, y0, 4], [11, t, 10], "muted");
|
|
95
|
+
g.add(`chip-b-${i}`, "box", [6 + i * 13.4, 2.6, 4], [11, t, 10], "muted");
|
|
96
|
+
}
|
|
97
|
+
g.add("rcd-f", "box", [61, y0, 16], [11, t, 10], "muted");
|
|
98
|
+
g.add("rcd-b", "box", [61, 2.6, 16], [11, t, 10], "muted");
|
|
99
|
+
if (sp) {
|
|
100
|
+
g.add("spreader-f", "plate", [3, 0, 3], [127, 0.5, 28.25], "metal");
|
|
101
|
+
g.add("spreader-b", "plate", [3, 3.5, 3], [127, 0.5, 28.25], "metal");
|
|
102
|
+
}
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
var gpuCard = defineShape({
|
|
107
|
+
id: "gpu-card",
|
|
108
|
+
label: "GPU card",
|
|
109
|
+
type: "gpu",
|
|
110
|
+
role: "internal",
|
|
111
|
+
size: [267, 38, 111],
|
|
112
|
+
params: { fans: int(0, 3, 2), bracket: bool(true) },
|
|
113
|
+
draw(g, p, tone) {
|
|
114
|
+
const x0 = p.bracket ? 1.6 : 0;
|
|
115
|
+
if (p.bracket) g.add("bracket", "plate", [0, 0, 0], [1.6, 38, 111], "metal", { core: false });
|
|
116
|
+
g.add("pcb", "plate", [x0, 0, 6], [267 - x0, 1.6, 105], "muted");
|
|
117
|
+
g.add("fingers", "plate", [40, 0, 0], [89, 1.6, 6], "metal", { core: false });
|
|
118
|
+
g.add("shroud", "box", [14, 1.6, 10], [250, 33.4, 95], tone, { paint: true });
|
|
119
|
+
const n = p.fans;
|
|
120
|
+
if (n === 0) g.add("cover", "plate", [14, 35, 10], [250, 3, 95], "accent");
|
|
121
|
+
for (let i = 0; i < n; i++) {
|
|
122
|
+
const x = spread(i, n, 76, 14, 264);
|
|
123
|
+
g.add(`fan-${i}`, "cylinder", [x, 35, 19.5], [76, 2, 76], "muted", { axis: "y" });
|
|
124
|
+
g.add(`hub-${i}`, "cylinder", [x + 27, 37, 46.5], [22, 1, 22], "metal", { axis: "y" });
|
|
125
|
+
}
|
|
126
|
+
return void 0;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
var nicOcp3 = defineShape({
|
|
130
|
+
id: "nic-ocp3",
|
|
131
|
+
label: "OCP 3.0 NIC (SFF)",
|
|
132
|
+
type: "nic",
|
|
133
|
+
role: "internal",
|
|
134
|
+
size: [76, 115, 16],
|
|
135
|
+
params: { ports: int(1, 4, 2) },
|
|
136
|
+
draw(g, p, tone) {
|
|
137
|
+
g.add("pcb", "plate", [0, 0, 0], [76, 115, 1.6], tone, { paint: true });
|
|
138
|
+
const n = p.ports;
|
|
139
|
+
const w = (68 - (n - 1) * 2) / n;
|
|
140
|
+
for (let i = 0; i < n; i++) {
|
|
141
|
+
g.add(`cage-${i}`, "box", [4 + i * (w + 2), 85, 1.6], [w, 30, 12], "metal", { core: false });
|
|
142
|
+
}
|
|
143
|
+
g.add("heatsink", "box", [8, 24, 1.6], [60, 58, 14.4], "metal");
|
|
144
|
+
g.add("connector", "box", [8, 0, 1.6], [60, 15, 6], "muted", { core: false });
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
var nvmeM2 = defineShape({
|
|
149
|
+
id: "nvme-m2",
|
|
150
|
+
label: "NVMe M.2 2280",
|
|
151
|
+
type: "ssd",
|
|
152
|
+
role: "internal",
|
|
153
|
+
size: [80, 22, 3.8],
|
|
154
|
+
params: { chips: int(1, 4, 3), doubleSided: bool(true) },
|
|
155
|
+
draw(g, p, tone) {
|
|
156
|
+
g.add("pcb", "plate", [0, 0, 1.3], [80, 22, 0.8], tone, { paint: true });
|
|
157
|
+
for (let i = 0; i < p.chips; i++) {
|
|
158
|
+
g.add(`chip-t-${i}`, "box", [12 + i * 17, 3, 2.1], [15, 16, 1.7], "muted");
|
|
159
|
+
if (p.doubleSided) g.add(`chip-b-${i}`, "box", [12 + i * 17, 3, 0], [15, 16, 1.3], "muted");
|
|
160
|
+
}
|
|
161
|
+
return void 0;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
var e1s = defineShape({
|
|
165
|
+
id: "e1s",
|
|
166
|
+
label: "E1.S drive",
|
|
167
|
+
type: "ssd",
|
|
168
|
+
role: "internal",
|
|
169
|
+
// Flat (default): 33.75 wide, 118.75 long (front at +y), 9.5 thick.
|
|
170
|
+
size: [33.75, 118.75, 9.5],
|
|
171
|
+
params: { fins: int(0, 12, 6), orientation: enumOf(["flat", "upright"], "flat") },
|
|
172
|
+
// Upright: the drive stands on its long edge, so x is the 9.5 mm thickness and z the 33.75 mm
|
|
173
|
+
// width (default size [9.5, 118.75, 33.75]).
|
|
174
|
+
swapXZ: (p) => p.orientation === "upright",
|
|
175
|
+
draw(g, p, tone) {
|
|
176
|
+
g.add("bezel", "box", [0, 115.75, 0], [33.75, 3, 7.5], "accent");
|
|
177
|
+
g.add("body", "box", [0, 0, 0], [33.75, 115.75, 7.5], tone, { paint: true });
|
|
178
|
+
const n = p.fins;
|
|
179
|
+
for (let i = 0; i < n; i++) {
|
|
180
|
+
const x = n === 1 ? 16.4 : 3 + i * 26.75 / (n - 1);
|
|
181
|
+
g.add(`fin-${i}`, "plate", [x, 5, 7.5], [1, 105.75, 2], "metal", { core: false });
|
|
182
|
+
}
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
var psu = defineShape({
|
|
187
|
+
id: "psu",
|
|
188
|
+
label: "Power supply (CRPS)",
|
|
189
|
+
type: "psu",
|
|
190
|
+
role: "internal",
|
|
191
|
+
size: [73.5, 185, 39],
|
|
192
|
+
params: { handle: bool(true) },
|
|
193
|
+
draw(g, p, tone) {
|
|
194
|
+
g.add("grille", "plate", [0, 0, 0], [73.5, 10, 39], "perforated");
|
|
195
|
+
g.add("body", "box", [0, 10, 0], [73.5, 169, 39], tone, { paint: true });
|
|
196
|
+
if (p.handle) g.add("handle", "box", [8, 179, 10], [57.5, 6, 19], "muted", { core: false });
|
|
197
|
+
return void 0;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
var fan = defineShape({
|
|
201
|
+
id: "fan",
|
|
202
|
+
label: "Chassis fan",
|
|
203
|
+
type: "fan",
|
|
204
|
+
role: "internal",
|
|
205
|
+
size: [60, 56, 60],
|
|
206
|
+
params: { blades: int(3, 10, 7), grille: bool(false) },
|
|
207
|
+
draw(g, p, tone) {
|
|
208
|
+
g.add("frame-l", "box", [0, 0, 0], [3, 56, 60], tone, { paint: true });
|
|
209
|
+
g.add("frame-r", "box", [57, 0, 0], [3, 56, 60], tone, { paint: true });
|
|
210
|
+
g.add("frame-b", "box", [3, 0, 0], [54, 56, 3], tone, { paint: true });
|
|
211
|
+
g.add("frame-t", "box", [3, 0, 57], [54, 56, 3], tone, { paint: true });
|
|
212
|
+
g.add("hub", "cylinder", [22, 14, 22], [16, 28, 16], "muted", { axis: "y" });
|
|
213
|
+
const n = p.blades;
|
|
214
|
+
for (let i = 0; i < n; i++) {
|
|
215
|
+
const a = 2 * Math.PI * i / n;
|
|
216
|
+
const c = Math.cos(a);
|
|
217
|
+
const s = Math.sin(a);
|
|
218
|
+
const w = Math.abs(c) * 9 + Math.abs(s) * 1.5;
|
|
219
|
+
const h = Math.abs(s) * 9 + Math.abs(c) * 1.5;
|
|
220
|
+
g.add(
|
|
221
|
+
`blade-${i}`,
|
|
222
|
+
"plate",
|
|
223
|
+
[30 + 19 * c - w / 2, 18, 30 + 19 * s - h / 2],
|
|
224
|
+
[w, 20, h],
|
|
225
|
+
"accent"
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
if (p.grille) {
|
|
229
|
+
g.add("bar-h", "plate", [3, 54.5, 29], [54, 1.5, 2], "metal");
|
|
230
|
+
g.add("bar-v-lo", "plate", [29, 54.5, 3], [2, 1.5, 26], "metal");
|
|
231
|
+
g.add("bar-v-hi", "plate", [29, 54.5, 31], [2, 1.5, 26], "metal");
|
|
232
|
+
}
|
|
233
|
+
return void 0;
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
var riser = defineShape({
|
|
237
|
+
id: "riser",
|
|
238
|
+
label: "PCIe riser",
|
|
239
|
+
type: "riser",
|
|
240
|
+
role: "internal",
|
|
241
|
+
size: [130, 12, 100],
|
|
242
|
+
params: { slots: int(1, 4, 2) },
|
|
243
|
+
draw(g, p, tone) {
|
|
244
|
+
g.add("pcb", "plate", [0, 0, 0], [130, 1.6, 100], tone, { paint: true });
|
|
245
|
+
for (let i = 0; i < p.slots; i++) {
|
|
246
|
+
g.add(`slot-${i}`, "box", [8, 1.6, 10 + i * 22], [89, 10.4, 7], "muted", { core: false });
|
|
247
|
+
}
|
|
248
|
+
g.add("power", "box", [105, 1.6, 10], [20, 6, 20], "muted", { core: false });
|
|
249
|
+
return void 0;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
var pcieCard = defineShape({
|
|
253
|
+
id: "pcie-card",
|
|
254
|
+
label: "PCIe add-in card (HHHL)",
|
|
255
|
+
type: "card",
|
|
256
|
+
role: "internal",
|
|
257
|
+
size: [168, 20, 69],
|
|
258
|
+
params: { bracket: bool(true), heatsink: bool(true) },
|
|
259
|
+
draw(g, p, tone) {
|
|
260
|
+
const x0 = p.bracket ? 1.6 : 0;
|
|
261
|
+
if (p.bracket) g.add("bracket", "plate", [0, 0, 0], [1.6, 20, 69], "metal", { core: false });
|
|
262
|
+
g.add("pcb", "plate", [x0, 0, 6], [168 - x0, 1.6, 63], tone, { paint: true });
|
|
263
|
+
g.add("fingers", "plate", [40, 0, 0], [76, 1.6, 6], "metal", { core: false });
|
|
264
|
+
g.add("chip-0", "box", [30, 1.6, 18], [22, 2, 22], "muted");
|
|
265
|
+
g.add("chip-1", "box", [62, 1.6, 18], [16, 2, 16], "muted");
|
|
266
|
+
if (p.heatsink) g.add("heatsink", "box", [90, 1.6, 12], [60, 18.4, 45], "metal");
|
|
267
|
+
return void 0;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
var chassis2u = defineShape({
|
|
271
|
+
id: "chassis-2u",
|
|
272
|
+
label: "2U chassis (open top)",
|
|
273
|
+
type: "chassis",
|
|
274
|
+
role: "shell",
|
|
275
|
+
size: [482.6, 740, 88.9],
|
|
276
|
+
params: { ears: bool(true) },
|
|
277
|
+
draw(g, p, tone) {
|
|
278
|
+
const back = ["floor", "wall-nx", "wall-ny"];
|
|
279
|
+
const front = ["wall-py", "wall-px"];
|
|
280
|
+
g.add("floor", "box", [17.5, 0, 0], [447.6, 740, 1.5], tone, { paint: true });
|
|
281
|
+
g.add("wall-nx", "box", [17.5, 0, 1.5], [1.5, 740, 87.4], tone, { paint: true });
|
|
282
|
+
g.add("wall-ny", "box", [19, 0, 1.5], [444.6, 1.5, 87.4], tone, { paint: true });
|
|
283
|
+
g.add("wall-py", "box", [19, 738.5, 1.5], [444.6, 1.5, 87.4], tone, { paint: true });
|
|
284
|
+
g.add("wall-px", "box", [463.6, 0, 1.5], [1.5, 740, 87.4], tone, { paint: true });
|
|
285
|
+
if (p.ears) {
|
|
286
|
+
g.add("ear-l", "plate", [0, 737.5, 0], [17.5, 2.5, 88.9], "metal", { core: false });
|
|
287
|
+
g.add("ear-r", "plate", [465.1, 737.5, 0], [17.5, 2.5, 88.9], "metal", { core: false });
|
|
288
|
+
back.push("ear-l");
|
|
289
|
+
front.push("ear-r");
|
|
290
|
+
}
|
|
291
|
+
return { back, front };
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
var lid = defineShape({
|
|
295
|
+
id: "lid",
|
|
296
|
+
label: "Chassis lid",
|
|
297
|
+
type: "lid",
|
|
298
|
+
role: "cover",
|
|
299
|
+
size: [447.6, 740, 3],
|
|
300
|
+
params: { vents: int(0, 8, 2) },
|
|
301
|
+
draw(g, p, tone) {
|
|
302
|
+
g.add("panel", "plate", [0, 0, 0], [447.6, 740, 2.4], tone, { paint: true });
|
|
303
|
+
for (let i = 0; i < p.vents; i++) {
|
|
304
|
+
g.add(`vent-${i}`, "plate", [20, 60 + i * 80, 2.4], [407.6, 40, 0.6], "perforated", {
|
|
305
|
+
core: false
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
return void 0;
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
var hwShapes = [
|
|
312
|
+
board,
|
|
313
|
+
cpu,
|
|
314
|
+
heatsink,
|
|
315
|
+
dimm,
|
|
316
|
+
gpuCard,
|
|
317
|
+
nicOcp3,
|
|
318
|
+
nvmeM2,
|
|
319
|
+
e1s,
|
|
320
|
+
psu,
|
|
321
|
+
fan,
|
|
322
|
+
riser,
|
|
323
|
+
pcieCard,
|
|
324
|
+
chassis2u,
|
|
325
|
+
lid
|
|
326
|
+
];
|
|
327
|
+
|
|
328
|
+
// src/index.ts
|
|
329
|
+
var hwPack = {
|
|
330
|
+
id: "hw",
|
|
331
|
+
name: "Hardware (server internals)",
|
|
332
|
+
license: "Apache-2.0",
|
|
333
|
+
shapes: hwShapes
|
|
334
|
+
};
|
|
335
|
+
var byRef = new Map(hwShapes.map((s) => [`hw:${s.id}`, s]));
|
|
336
|
+
var refs = [...byRef.keys()].sort();
|
|
337
|
+
var registry = {
|
|
338
|
+
get: (ref) => byRef.get(ref),
|
|
339
|
+
list: () => refs
|
|
340
|
+
};
|
|
341
|
+
export {
|
|
342
|
+
MAX_EXTENT_MM,
|
|
343
|
+
hwPack,
|
|
344
|
+
hwShapes,
|
|
345
|
+
paramSpecsOf,
|
|
346
|
+
registry
|
|
347
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformcosmo/parts-base",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "PlatformCosmo hw: part shapes: generic server internals in true millimetres (pre-alpha).",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/mirastacklabs-ai/platformcosmo.git",
|
|
10
|
+
"directory": "packages/parts-base"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://platformcosmo.io",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"NOTICE"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.12"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"provenance": true
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@platformcosmo/core": "0.1.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup",
|
|
39
|
+
"typecheck": "tsc --noEmit -p ."
|
|
40
|
+
}
|
|
6
41
|
}
|
package/README.md
DELETED