@structupath/pi-steel 0.2.2 → 0.2.3

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.
Files changed (47) hide show
  1. package/DATA_PROVENANCE.json +23 -0
  2. package/DATA_PROVENANCE.md +35 -0
  3. package/PUBLIC_DATA_POLICY.md +52 -0
  4. package/README.md +114 -33
  5. package/docs/assets/pi-steel-demo.gif +0 -0
  6. package/docs/assets/pi-steel-gallery.webp +0 -0
  7. package/package.json +35 -4
  8. package/pyproject.toml +28 -0
  9. package/requirements-dev.txt +5 -0
  10. package/requirements-render.txt +1 -0
  11. package/requirements-tested.txt +9 -0
  12. package/requirements.txt +7 -0
  13. package/scripts/check-data-provenance.py +140 -0
  14. package/scripts/check-public-data.py +401 -0
  15. package/scripts/doctor.py +127 -0
  16. package/skills/_shared/bootstrap.py +32 -0
  17. package/skills/_shared/pi_steel/__init__.py +47 -0
  18. package/skills/_shared/pi_steel/cli.py +167 -0
  19. package/skills/_shared/pi_steel/contracts.py +87 -0
  20. package/skills/_shared/pi_steel/geometry_verify.py +243 -0
  21. package/skills/_shared/pi_steel/parsing.py +205 -0
  22. package/skills/_shared/pi_steel/run_manifest.py +317 -0
  23. package/skills/_shared/pi_steel/validation.py +597 -0
  24. package/skills/_shared/schemas/estimate-package.schema.json +424 -0
  25. package/skills/_shared/schemas/nest-result.schema.json +443 -0
  26. package/skills/_shared/schemas/run-manifest.schema.json +145 -0
  27. package/skills/steel-estimate/SKILL.md +119 -0
  28. package/skills/steel-estimate/references/estimate-package-example.json +91 -0
  29. package/skills/steel-estimate/references/output-contract.md +47 -0
  30. package/skills/steel-estimate/scripts/acknowledge-finding.py +193 -0
  31. package/skills/steel-estimate/scripts/build-estimate-package.py +836 -0
  32. package/skills/steel-nest/SKILL.md +50 -23
  33. package/skills/steel-nest/references/FIXTURE_PROVENANCE.md +12 -0
  34. package/skills/steel-nest/references/example_job.json +21 -25
  35. package/skills/steel-nest/references/job_template.json +11 -9
  36. package/skills/steel-nest/scripts/nest.py +1276 -250
  37. package/skills/steel-rfq/SKILL.md +93 -175
  38. package/skills/steel-rfq/assets/company-profile.example.json +11 -5
  39. package/skills/steel-rfq/references/rfq-input.md +58 -0
  40. package/skills/steel-rfq/scripts/generate-rfq.py +1221 -0
  41. package/skills/steel-rfq/scripts/recalc.py +33 -10
  42. package/skills/steel-takeoff/SKILL.md +12 -8
  43. package/skills/steel-takeoff/assets/bom-template.csv +1 -1
  44. package/skills/steel-takeoff/references/takeoff-procedures.md +3 -1
  45. package/skills/steel-takeoff/scripts/calculate-weight.sh +5 -10
  46. package/skills/steel-takeoff/scripts/lookup-member.sh +2 -2
  47. package/skills/steel-takeoff/scripts/validate-bom.py +151 -196
@@ -0,0 +1,443 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://structupath.ai/schemas/pi-steel/nest-result-1.0.0.json",
4
+ "title": "pi-steel canonical nest result",
5
+ "type": "object",
6
+ "required": [
7
+ "schema_version",
8
+ "algorithm_version",
9
+ "normalized_input_hash",
10
+ "estimate_input_hash",
11
+ "configuration_hash",
12
+ "outcome",
13
+ "package_status",
14
+ "meta",
15
+ "clearance_contract",
16
+ "groups",
17
+ "metrics",
18
+ "cost",
19
+ "plate_reports",
20
+ "unplaced",
21
+ "verification",
22
+ "validation_findings",
23
+ "geometry_readiness",
24
+ "burn_dxf_eligible",
25
+ "burn_dxf_warnings"
26
+ ],
27
+ "properties": {
28
+ "schema_version": { "const": "1.0.0" },
29
+ "algorithm_version": { "type": "string", "minLength": 1 },
30
+ "normalized_input_hash": { "$ref": "#/$defs/hash" },
31
+ "estimate_input_hash": { "$ref": "#/$defs/hash" },
32
+ "configuration_hash": { "$ref": "#/$defs/hash" },
33
+ "outcome": {
34
+ "enum": [
35
+ "ready",
36
+ "review_required",
37
+ "blocked",
38
+ "dependency_missing",
39
+ "usage_or_internal_error"
40
+ ]
41
+ },
42
+ "run_outcome": {
43
+ "enum": [
44
+ "ready",
45
+ "review_required",
46
+ "blocked",
47
+ "dependency_missing",
48
+ "usage_or_internal_error"
49
+ ]
50
+ },
51
+ "package_status": {
52
+ "enum": [
53
+ "draft",
54
+ "review_required",
55
+ "validated",
56
+ "nested_partial",
57
+ "nest_verified",
58
+ "rfq_draft_review_required",
59
+ "rfq_ready_for_review"
60
+ ]
61
+ },
62
+ "meta": {
63
+ "type": "object",
64
+ "required": [
65
+ "job_name",
66
+ "customer",
67
+ "project_id",
68
+ "revision_id",
69
+ "kerf_in",
70
+ "part_gap_in",
71
+ "edge_margin_in",
72
+ "density_lb_in3",
73
+ "unit_system"
74
+ ],
75
+ "properties": {
76
+ "job_name": { "type": "string" },
77
+ "customer": { "type": "string" },
78
+ "project_id": { "type": "string", "minLength": 1 },
79
+ "revision_id": { "type": "string", "minLength": 1 },
80
+ "kerf_in": { "type": "number", "minimum": 0 },
81
+ "part_gap_in": { "type": "number", "minimum": 0 },
82
+ "edge_margin_in": { "type": "number", "minimum": 0 },
83
+ "density_lb_in3": { "type": "number", "exclusiveMinimum": 0 },
84
+ "unit_system": { "type": "string" }
85
+ },
86
+ "additionalProperties": false
87
+ },
88
+ "clearance_contract": {
89
+ "type": "object",
90
+ "required": [
91
+ "edge_margin_ownership",
92
+ "inter_part_clearance_ownership",
93
+ "trailing_clearance_required_at_plate_edge"
94
+ ],
95
+ "properties": {
96
+ "edge_margin_ownership": { "const": "plate_to_part" },
97
+ "inter_part_clearance_ownership": { "const": "kerf_plus_gap" },
98
+ "trailing_clearance_required_at_plate_edge": { "const": false }
99
+ },
100
+ "additionalProperties": false
101
+ },
102
+ "groups": {
103
+ "type": "array",
104
+ "items": {
105
+ "type": "object",
106
+ "required": ["group_id", "material", "grade", "thickness", "placements"],
107
+ "properties": {
108
+ "group_id": { "type": "string", "minLength": 1 },
109
+ "material": { "type": ["string", "null"] },
110
+ "grade": { "type": ["string", "null"] },
111
+ "thickness": { "type": "number", "exclusiveMinimum": 0 },
112
+ "placements": {
113
+ "type": "array",
114
+ "items": { "$ref": "#/$defs/placement" }
115
+ }
116
+ },
117
+ "additionalProperties": false
118
+ }
119
+ },
120
+ "plates_used": { "type": "integer", "minimum": 0 },
121
+ "metrics": {
122
+ "type": "object",
123
+ "required": ["packing_utilization_pct", "net_material_yield_pct"],
124
+ "properties": {
125
+ "packing_utilization_pct": { "$ref": "#/$defs/metric" },
126
+ "net_material_yield_pct": { "$ref": "#/$defs/metric" }
127
+ },
128
+ "additionalProperties": false
129
+ },
130
+ "total_plate_weight_lb": { "type": "number", "minimum": 0 },
131
+ "total_part_weight_lb": { "type": "number", "minimum": 0 },
132
+ "total_scrap_weight_lb": { "type": "number", "minimum": 0 },
133
+ "cost": {
134
+ "type": "object",
135
+ "required": ["status", "total"],
136
+ "properties": {
137
+ "status": {
138
+ "enum": ["known", "not_provided", "incomplete_unplaced"]
139
+ },
140
+ "total": { "type": ["number", "null"], "minimum": 0 }
141
+ },
142
+ "additionalProperties": false
143
+ },
144
+ "total_material_cost": {
145
+ "type": ["number", "null"],
146
+ "minimum": 0
147
+ },
148
+ "cost_known": { "type": "boolean" },
149
+ "total_holes": { "type": "integer", "minimum": 0 },
150
+ "part_net_cost": {
151
+ "type": "object",
152
+ "additionalProperties": { "type": "number", "minimum": 0 }
153
+ },
154
+ "plate_reports": {
155
+ "type": "array",
156
+ "items": { "$ref": "#/$defs/plateReport" }
157
+ },
158
+ "unplaced": {
159
+ "type": "array",
160
+ "items": {
161
+ "type": "object",
162
+ "required": ["item_id", "label", "quantity", "size", "reason"],
163
+ "properties": {
164
+ "item_id": { "type": "string", "minLength": 1 },
165
+ "label": { "type": "string" },
166
+ "quantity": { "type": "integer", "minimum": 1 },
167
+ "size": { "type": "string" },
168
+ "reason": {
169
+ "enum": ["no_compatible_stock_fit", "stock_exhausted"]
170
+ }
171
+ },
172
+ "additionalProperties": false
173
+ }
174
+ },
175
+ "has_irregular": { "type": "boolean" },
176
+ "invalid_hole_warnings": {
177
+ "type": "array",
178
+ "items": { "type": "string" }
179
+ },
180
+ "validation_findings": {
181
+ "type": "array",
182
+ "items": { "$ref": "#/$defs/finding" }
183
+ },
184
+ "verification": {
185
+ "type": "object",
186
+ "required": ["status", "findings"],
187
+ "properties": {
188
+ "status": { "enum": ["verified", "failed"] },
189
+ "findings": {
190
+ "type": "array",
191
+ "items": {
192
+ "type": "object",
193
+ "required": ["code", "path", "message"],
194
+ "properties": {
195
+ "code": { "type": "string" },
196
+ "path": { "type": "string" },
197
+ "message": { "type": "string" }
198
+ },
199
+ "additionalProperties": false
200
+ }
201
+ }
202
+ },
203
+ "additionalProperties": false
204
+ },
205
+ "geometry_readiness": {
206
+ "enum": ["geometry_verified", "reference_only", "diagnostic"]
207
+ },
208
+ "burn_dxf_eligible": { "type": "boolean" },
209
+ "burn_dxf_warnings": {
210
+ "type": "array",
211
+ "items": { "type": "string" }
212
+ },
213
+ "rfq_nesting": { "$ref": "#/$defs/rfqHandoff" }
214
+ },
215
+ "additionalProperties": false,
216
+ "$defs": {
217
+ "hash": {
218
+ "type": "string",
219
+ "pattern": "^[0-9a-f]{64}$"
220
+ },
221
+ "metric": {
222
+ "type": "object",
223
+ "required": ["value", "approximation"],
224
+ "properties": {
225
+ "value": { "type": "number", "minimum": 0, "maximum": 100 },
226
+ "approximation": {
227
+ "enum": ["exact", "bounding_box", "declared_area", "bounding_box_estimate"]
228
+ }
229
+ },
230
+ "additionalProperties": false
231
+ },
232
+ "placement": {
233
+ "type": "object",
234
+ "required": [
235
+ "part_id",
236
+ "source_id",
237
+ "item_id",
238
+ "instance_id",
239
+ "placement_id",
240
+ "stock_id",
241
+ "label",
242
+ "x",
243
+ "y",
244
+ "w",
245
+ "h",
246
+ "rotated",
247
+ "shape",
248
+ "ow",
249
+ "oh",
250
+ "holes",
251
+ "base_area",
252
+ "holes_area",
253
+ "material",
254
+ "grade",
255
+ "thickness"
256
+ ],
257
+ "properties": {
258
+ "part_id": { "type": "string" },
259
+ "source_id": { "type": "string" },
260
+ "item_id": { "type": "string" },
261
+ "instance_id": { "type": "string" },
262
+ "placement_id": { "type": "string" },
263
+ "stock_id": { "type": "string" },
264
+ "label": { "type": "string" },
265
+ "x": { "type": "number", "minimum": 0 },
266
+ "y": { "type": "number", "minimum": 0 },
267
+ "w": { "type": "number", "exclusiveMinimum": 0 },
268
+ "h": { "type": "number", "exclusiveMinimum": 0 },
269
+ "rotated": { "type": "boolean" },
270
+ "shape": { "enum": ["rect", "irregular"] },
271
+ "ow": { "type": "number", "exclusiveMinimum": 0 },
272
+ "oh": { "type": "number", "exclusiveMinimum": 0 },
273
+ "holes": { "type": "array", "items": { "type": "object" } },
274
+ "base_area": { "type": "number", "exclusiveMinimum": 0 },
275
+ "holes_area": { "type": "number", "minimum": 0 },
276
+ "material": { "type": "string" },
277
+ "grade": { "type": "string" },
278
+ "thickness": { "type": "number", "exclusiveMinimum": 0 }
279
+ },
280
+ "additionalProperties": false
281
+ },
282
+ "remnantCandidate": {
283
+ "type": "object",
284
+ "required": ["width", "height", "area", "status"],
285
+ "properties": {
286
+ "width": { "type": "number", "exclusiveMinimum": 0 },
287
+ "height": { "type": "number", "exclusiveMinimum": 0 },
288
+ "area": { "type": "number", "exclusiveMinimum": 0 },
289
+ "status": { "const": "candidate_unverified" }
290
+ },
291
+ "additionalProperties": false
292
+ },
293
+ "plateReport": {
294
+ "type": "object",
295
+ "required": [
296
+ "index",
297
+ "stock",
298
+ "stock_id",
299
+ "material",
300
+ "grade",
301
+ "size",
302
+ "W",
303
+ "H",
304
+ "thickness",
305
+ "parts",
306
+ "num_parts",
307
+ "num_holes",
308
+ "packing_utilization_pct",
309
+ "net_material_yield_pct",
310
+ "plate_weight_lb",
311
+ "part_weight_lb",
312
+ "scrap_weight_lb",
313
+ "plate_cost",
314
+ "cost_basis",
315
+ "remnant_candidates",
316
+ "placements"
317
+ ],
318
+ "properties": {
319
+ "index": { "type": "integer", "minimum": 1 },
320
+ "stock": { "type": "string" },
321
+ "stock_id": { "type": "string" },
322
+ "material": { "type": "string" },
323
+ "grade": { "type": "string" },
324
+ "size": { "type": "string" },
325
+ "W": { "type": "number", "exclusiveMinimum": 0 },
326
+ "H": { "type": "number", "exclusiveMinimum": 0 },
327
+ "thickness": { "type": "number", "exclusiveMinimum": 0 },
328
+ "parts": {
329
+ "type": "object",
330
+ "additionalProperties": { "type": "integer", "minimum": 1 }
331
+ },
332
+ "num_parts": { "type": "integer", "minimum": 1 },
333
+ "num_holes": { "type": "integer", "minimum": 0 },
334
+ "packing_utilization_pct": { "$ref": "#/$defs/metric" },
335
+ "net_material_yield_pct": { "$ref": "#/$defs/metric" },
336
+ "plate_weight_lb": { "type": "number", "minimum": 0 },
337
+ "part_weight_lb": { "type": "number", "minimum": 0 },
338
+ "scrap_weight_lb": { "type": "number", "minimum": 0 },
339
+ "plate_cost": {
340
+ "type": ["number", "null"],
341
+ "minimum": 0
342
+ },
343
+ "cost_basis": {
344
+ "type": ["string", "null"],
345
+ "enum": ["per_sheet", "per_pound", null]
346
+ },
347
+ "remnant_candidates": {
348
+ "type": "array",
349
+ "items": { "$ref": "#/$defs/remnantCandidate" }
350
+ },
351
+ "placements": {
352
+ "type": "array",
353
+ "items": { "$ref": "#/$defs/placement" }
354
+ }
355
+ },
356
+ "additionalProperties": false
357
+ },
358
+ "finding": {
359
+ "type": "object",
360
+ "required": ["code", "severity", "path", "message"],
361
+ "properties": {
362
+ "code": { "type": "string" },
363
+ "severity": { "enum": ["error", "warning"] },
364
+ "path": { "type": "string" },
365
+ "message": { "type": "string" }
366
+ },
367
+ "additionalProperties": false
368
+ },
369
+ "rfqHandoff": {
370
+ "type": "object",
371
+ "required": [
372
+ "schema_version",
373
+ "source_nest_result_version",
374
+ "project_id",
375
+ "revision_id",
376
+ "estimate_input_hash",
377
+ "geometry_readiness",
378
+ "rows"
379
+ ],
380
+ "properties": {
381
+ "schema_version": { "const": "1.0.0" },
382
+ "source_nest_result_version": { "const": "1.0.0" },
383
+ "project_id": { "type": "string", "minLength": 1 },
384
+ "revision_id": { "type": "string", "minLength": 1 },
385
+ "estimate_input_hash": { "$ref": "#/$defs/hash" },
386
+ "geometry_readiness": {
387
+ "enum": ["geometry_verified", "reference_only", "diagnostic"]
388
+ },
389
+ "rows": {
390
+ "type": "array",
391
+ "items": { "$ref": "#/$defs/rfqHandoffRow" }
392
+ }
393
+ },
394
+ "additionalProperties": false
395
+ },
396
+ "rfqHandoffRow": {
397
+ "type": "object",
398
+ "required": [
399
+ "stock_id",
400
+ "stock_name",
401
+ "material",
402
+ "grade",
403
+ "thickness",
404
+ "sheets_needed",
405
+ "sheet_size",
406
+ "packing_utilization_pct",
407
+ "nesting_plan",
408
+ "drop_notes",
409
+ "remnant_candidates",
410
+ "total_cost",
411
+ "geometry_readiness"
412
+ ],
413
+ "properties": {
414
+ "stock_id": { "type": "string", "minLength": 1 },
415
+ "stock_name": { "type": "string", "minLength": 1 },
416
+ "material": { "type": "string", "minLength": 1 },
417
+ "grade": { "type": "string", "minLength": 1 },
418
+ "thickness": { "type": "number", "exclusiveMinimum": 0 },
419
+ "sheets_needed": { "type": "integer", "minimum": 1 },
420
+ "sheet_size": { "type": "string", "minLength": 1 },
421
+ "packing_utilization_pct": {
422
+ "type": "number",
423
+ "minimum": 0,
424
+ "maximum": 100
425
+ },
426
+ "nesting_plan": { "type": "string", "minLength": 1 },
427
+ "drop_notes": { "type": "string", "minLength": 1 },
428
+ "remnant_candidates": {
429
+ "type": "array",
430
+ "items": { "$ref": "#/$defs/remnantCandidate" }
431
+ },
432
+ "total_cost": {
433
+ "type": ["number", "null"],
434
+ "minimum": 0
435
+ },
436
+ "geometry_readiness": {
437
+ "enum": ["geometry_verified", "reference_only", "diagnostic"]
438
+ }
439
+ },
440
+ "additionalProperties": false
441
+ }
442
+ }
443
+ }
@@ -0,0 +1,145 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://structupath.ai/schemas/pi-steel/run-manifest-1.0.0.json",
4
+ "title": "Pi Steel Run Manifest",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schema_version",
9
+ "run_id",
10
+ "stage",
11
+ "run_outcome",
12
+ "package_status",
13
+ "created_at",
14
+ "schema_versions",
15
+ "tool_versions",
16
+ "input_hash",
17
+ "configuration_hash",
18
+ "explicit_dates",
19
+ "warnings",
20
+ "approximations",
21
+ "artifacts",
22
+ "semantic_hash"
23
+ ],
24
+ "properties": {
25
+ "schema_version": {
26
+ "const": "1.0.0"
27
+ },
28
+ "run_id": {
29
+ "type": "string",
30
+ "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
31
+ },
32
+ "stage": {
33
+ "type": "string",
34
+ "minLength": 1
35
+ },
36
+ "run_outcome": {
37
+ "enum": [
38
+ "ready",
39
+ "review_required",
40
+ "blocked",
41
+ "dependency_missing",
42
+ "usage_or_internal_error"
43
+ ]
44
+ },
45
+ "package_status": {
46
+ "enum": [
47
+ "draft",
48
+ "review_required",
49
+ "validated",
50
+ "nested_partial",
51
+ "nest_verified",
52
+ "rfq_draft_review_required",
53
+ "rfq_ready_for_review"
54
+ ]
55
+ },
56
+ "created_at": {
57
+ "type": "string",
58
+ "format": "date-time"
59
+ },
60
+ "schema_versions": {
61
+ "$ref": "#/$defs/versionMap"
62
+ },
63
+ "tool_versions": {
64
+ "$ref": "#/$defs/versionMap"
65
+ },
66
+ "input_hash": {
67
+ "$ref": "#/$defs/sha256"
68
+ },
69
+ "configuration_hash": {
70
+ "$ref": "#/$defs/sha256"
71
+ },
72
+ "explicit_dates": {
73
+ "type": "object",
74
+ "additionalProperties": {
75
+ "type": "string",
76
+ "format": "date"
77
+ }
78
+ },
79
+ "warnings": {
80
+ "type": "array",
81
+ "items": {}
82
+ },
83
+ "approximations": {
84
+ "type": "array",
85
+ "items": {}
86
+ },
87
+ "artifacts": {
88
+ "type": "array",
89
+ "items": {
90
+ "$ref": "#/$defs/artifact"
91
+ }
92
+ },
93
+ "semantic_hash": {
94
+ "$ref": "#/$defs/sha256"
95
+ }
96
+ },
97
+ "$defs": {
98
+ "sha256": {
99
+ "type": "string",
100
+ "pattern": "^[0-9a-f]{64}$"
101
+ },
102
+ "versionMap": {
103
+ "type": "object",
104
+ "additionalProperties": {
105
+ "type": "string",
106
+ "minLength": 1
107
+ }
108
+ },
109
+ "artifact": {
110
+ "type": "object",
111
+ "additionalProperties": false,
112
+ "required": [
113
+ "path",
114
+ "sha256",
115
+ "size_bytes",
116
+ "readiness"
117
+ ],
118
+ "properties": {
119
+ "path": {
120
+ "type": "string",
121
+ "minLength": 1
122
+ },
123
+ "sha256": {
124
+ "$ref": "#/$defs/sha256"
125
+ },
126
+ "size_bytes": {
127
+ "type": "integer",
128
+ "minimum": 0
129
+ },
130
+ "readiness": {
131
+ "enum": [
132
+ "geometry_verified",
133
+ "reference_only",
134
+ "draft",
135
+ "diagnostic"
136
+ ]
137
+ },
138
+ "media_type": {
139
+ "type": "string",
140
+ "minLength": 1
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }