@tiangong-lca/foundry 0.1.8 → 0.1.10

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 (83) hide show
  1. package/README.md +11 -9
  2. package/docs/architecture.md +9 -7
  3. package/docs/foundry-task-contracts.md +10 -4
  4. package/docs/import-profiles/bafu/constraints.md +1 -1
  5. package/docs/import-profiles/bafu/profile.md +1 -1
  6. package/docs/import-profiles/worldsteel/constraints.md +3 -3
  7. package/docs/import-profiles/worldsteel/import-coverage.md +3 -3
  8. package/docs/import-profiles/worldsteel/import-plan.md +4 -4
  9. package/docs/import-profiles/worldsteel/profile.md +3 -3
  10. package/docs/package-distribution-contract.md +24 -16
  11. package/docs/public-runtime-contract.md +17 -7
  12. package/docs/runtime-context-contract.md +5 -5
  13. package/docs/task-authorization-contract.md +3 -3
  14. package/package-dist/assets/foundry-package-descriptor.json +218 -128
  15. package/package-dist/scripts/foundry-facade.js +71 -0
  16. package/package-dist/scripts/foundry-runtime.d.ts +12 -2
  17. package/package-dist/scripts/lib/finalize-owners/commit-handoff.js +3 -3
  18. package/package-dist/scripts/lib/finalize-owners/{native-insert-closeout.d.ts → native-draft-closeout.d.ts} +1 -1
  19. package/package-dist/scripts/lib/finalize-owners/{native-insert-closeout.js → native-draft-closeout.js} +10 -6
  20. package/package-dist/scripts/lib/finalize-owners/{native-insert-handoff.d.ts → native-draft-handoff.d.ts} +7 -5
  21. package/package-dist/scripts/lib/finalize-owners/{native-insert-handoff.js → native-draft-handoff.js} +30 -11
  22. package/package-dist/scripts/lib/finalize-owners/post-write-closeout.js +2 -2
  23. package/package-dist/scripts/lib/foundry-authorization-input.d.ts +10 -1
  24. package/package-dist/scripts/lib/foundry-authorization-input.js +27 -3
  25. package/package-dist/scripts/lib/foundry-command-metadata.js +25 -2
  26. package/package-dist/scripts/lib/foundry-command-registry.d.ts +4 -4
  27. package/package-dist/scripts/lib/foundry-command-registry.js +3 -0
  28. package/package-dist/scripts/lib/foundry-execution-admission.js +3 -3
  29. package/package-dist/scripts/lib/foundry-facade-store.js +56 -6
  30. package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +33 -16
  31. package/package-dist/scripts/lib/foundry-owner-execution-store.js +32 -3
  32. package/package-dist/scripts/lib/foundry-owner-readback.d.ts +3 -0
  33. package/package-dist/scripts/lib/foundry-owner-readback.js +101 -27
  34. package/package-dist/scripts/lib/foundry-package-contract.d.ts +2 -2
  35. package/package-dist/scripts/lib/foundry-package-contract.js +5 -5
  36. package/package-dist/scripts/lib/foundry-repair-execution.d.ts +11 -0
  37. package/package-dist/scripts/lib/foundry-repair-execution.js +70 -0
  38. package/package-dist/scripts/lib/foundry-repair-handoff.d.ts +16 -0
  39. package/package-dist/scripts/lib/foundry-repair-handoff.js +108 -0
  40. package/package-dist/scripts/lib/foundry-repair-preflight.d.ts +96 -0
  41. package/package-dist/scripts/lib/foundry-repair-preflight.js +313 -0
  42. package/package-dist/scripts/lib/foundry-repair-reference-binding.d.ts +26 -0
  43. package/package-dist/scripts/lib/foundry-repair-reference-binding.js +120 -0
  44. package/package-dist/scripts/lib/foundry-repair-reference-proof.d.ts +63 -0
  45. package/package-dist/scripts/lib/foundry-repair-reference-proof.js +329 -0
  46. package/package-dist/scripts/lib/foundry-repair-scope.d.ts +76 -0
  47. package/package-dist/scripts/lib/foundry-repair-scope.js +304 -0
  48. package/package-dist/scripts/lib/foundry-runtime-command-policy.js +1 -0
  49. package/package-dist/scripts/lib/foundry-runtime-qualification.js +2 -2
  50. package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +3 -0
  51. package/package-dist/scripts/lib/foundry-runtime-utils.js +6 -1
  52. package/package-dist/scripts/lib/foundry-successor-predecessor.d.ts +36 -0
  53. package/package-dist/scripts/lib/foundry-successor-predecessor.js +399 -0
  54. package/package-dist/scripts/lib/foundry-task-registration.js +64 -3
  55. package/package-dist/scripts/lib/foundry-task-start-spec.d.ts +3 -0
  56. package/package-dist/scripts/lib/foundry-task-start-spec.js +24 -1
  57. package/package-dist/scripts/lib/foundry-task-store.d.ts +13 -1
  58. package/package-dist/scripts/lib/foundry-task-store.js +23 -12
  59. package/package-dist/scripts/lib/foundry-task-types.d.ts +22 -1
  60. package/package-dist/scripts/lib/foundry-tidas-source.d.ts +15 -0
  61. package/package-dist/scripts/lib/foundry-tidas-source.js +90 -0
  62. package/package-dist/scripts/lib/foundry-workflow-authorization.d.ts +2 -1
  63. package/package-dist/scripts/lib/foundry-workflow-authorization.js +194 -26
  64. package/package-dist/scripts/lib/foundry-workflow-context.js +4 -0
  65. package/package-dist/scripts/lib/foundry-workflow-execution.js +6 -1
  66. package/package-dist/scripts/lib/foundry-workflow-repair.d.ts +36 -0
  67. package/package-dist/scripts/lib/foundry-workflow-repair.js +580 -0
  68. package/package-dist/scripts/lib/foundry-workflow-state.js +66 -18
  69. package/package-dist/scripts/lib/import-curation/curation-cleanup.js +39 -8
  70. package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +1 -1
  71. package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.d.ts +13 -2
  72. package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.js +100 -29
  73. package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.js +1 -2
  74. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.js +2 -3
  75. package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.js +8 -8
  76. package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.js +12 -2
  77. package/package.json +5 -5
  78. package/specs/import-profiles.json +1 -1
  79. package/specs/schemas/foundry-authorization-input.schema.json +45 -2
  80. package/specs/schemas/foundry-managed-runtime.schema.json +1 -1
  81. package/specs/schemas/foundry-package-descriptor.schema.json +2 -2
  82. package/specs/schemas/foundry-task-start.schema.json +200 -19
  83. package/specs/schemas/runtime-qualification.schema.json +1 -1
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  },
45
45
  "input_kind": {
46
- "enum": ["current_rows", "final_rows"]
46
+ "enum": ["current_rows", "final_rows", "repair_rows"]
47
47
  },
48
48
  "input_sha256": {
49
49
  "type": "string",
@@ -132,6 +132,24 @@
132
132
  "pattern": "^[0-9a-f]{64}$"
133
133
  }
134
134
  }
135
+ },
136
+ "repair_preparation": {
137
+ "description": "The registered preparation report a repair scope is authorized from; it is the scope authority and its digest is the descriptor's finalization_sha256.",
138
+ "type": "object",
139
+ "additionalProperties": false,
140
+ "required": ["file", "sha256"],
141
+ "properties": {
142
+ "file": {
143
+ "type": "string",
144
+ "minLength": 1,
145
+ "maxLength": 4096,
146
+ "pattern": "^[^\\u0000\\r\\n]+$"
147
+ },
148
+ "sha256": {
149
+ "type": "string",
150
+ "pattern": "^[0-9a-f]{64}$"
151
+ }
152
+ }
135
153
  }
136
154
  },
137
155
  "allOf": [
@@ -145,13 +163,38 @@
145
163
  "then": {
146
164
  "properties": {
147
165
  "input_kind": {
148
- "const": "final_rows"
166
+ "enum": ["final_rows", "repair_rows"]
149
167
  },
150
168
  "dataset_type": {
151
169
  "enum": ["flow", "process", "source"]
152
170
  }
153
171
  }
154
172
  }
173
+ },
174
+ {
175
+ "if": {
176
+ "required": ["input_kind"],
177
+ "properties": {
178
+ "input_kind": {
179
+ "const": "repair_rows"
180
+ }
181
+ }
182
+ },
183
+ "then": {
184
+ "required": ["repair_preparation", "execution_contract"],
185
+ "properties": {
186
+ "repair_preparation": {},
187
+ "execution_contract": {},
188
+ "dataset_type": {
189
+ "const": "process"
190
+ }
191
+ }
192
+ },
193
+ "else": {
194
+ "not": {
195
+ "required": ["repair_preparation"]
196
+ }
197
+ }
155
198
  }
156
199
  ]
157
200
  }
@@ -29,7 +29,7 @@
29
29
  "const": "tiangong-lca.cli-runtime-expectation.v1"
30
30
  },
31
31
  "package_version": {
32
- "const": "0.1.14"
32
+ "const": "0.1.19"
33
33
  },
34
34
  "platform": {
35
35
  "$ref": "#/$defs/platform"
@@ -18,7 +18,7 @@
18
18
  "const": "@tiangong-lca/foundry"
19
19
  },
20
20
  "version": {
21
- "const": "0.1.8"
21
+ "const": "0.1.10"
22
22
  },
23
23
  "cli_dependency": {
24
24
  "type": "object",
@@ -29,7 +29,7 @@
29
29
  "const": "@tiangong-lca/cli"
30
30
  },
31
31
  "version": {
32
- "const": "0.1.14"
32
+ "const": "0.1.19"
33
33
  }
34
34
  }
35
35
  },
@@ -17,13 +17,25 @@
17
17
  "preparation"
18
18
  ],
19
19
  "properties": {
20
- "schema": { "const": "tiangong-foundry.task-start.v1" },
21
- "request_id": { "$ref": "#/$defs/id" },
22
- "actor_id": { "$ref": "#/$defs/id" },
20
+ "schema": {
21
+ "const": "tiangong-foundry.task-start.v1"
22
+ },
23
+ "request_id": {
24
+ "$ref": "#/$defs/id"
25
+ },
26
+ "actor_id": {
27
+ "$ref": "#/$defs/id"
28
+ },
23
29
  "lane": {
24
- "enum": ["external-dataset-curated-import", "source-evidence-dataset-development"]
30
+ "enum": [
31
+ "external-dataset-curated-import",
32
+ "source-evidence-dataset-development",
33
+ "existing-owner-draft-repair"
34
+ ]
35
+ },
36
+ "profile_id": {
37
+ "$ref": "#/$defs/id"
25
38
  },
26
- "profile_id": { "$ref": "#/$defs/id" },
27
39
  "target_entities": {
28
40
  "type": "array",
29
41
  "minItems": 1,
@@ -46,23 +58,107 @@
46
58
  "type": "array",
47
59
  "minItems": 1,
48
60
  "maxItems": 1000,
49
- "items": { "$ref": "#/$defs/selection" }
61
+ "items": {
62
+ "$ref": "#/$defs/selection"
63
+ }
64
+ },
65
+ "seed": {
66
+ "oneOf": [
67
+ {
68
+ "$ref": "#/$defs/selection"
69
+ },
70
+ {
71
+ "type": "null"
72
+ }
73
+ ]
50
74
  },
51
- "seed": { "oneOf": [{ "$ref": "#/$defs/selection" }, { "type": "null" }] },
52
75
  "account_intent": {
53
- "oneOf": [{ "$ref": "#/$defs/accountIntent" }, { "type": "null" }]
76
+ "oneOf": [
77
+ {
78
+ "$ref": "#/$defs/accountIntent"
79
+ },
80
+ {
81
+ "type": "null"
82
+ }
83
+ ]
54
84
  },
55
85
  "preparation": {
56
- "oneOf": [{ "$ref": "#/$defs/cleanupPreparation" }, { "type": "null" }]
86
+ "oneOf": [
87
+ {
88
+ "$ref": "#/$defs/cleanupPreparation"
89
+ },
90
+ {
91
+ "type": "null"
92
+ }
93
+ ]
94
+ },
95
+ "repair": {
96
+ "oneOf": [
97
+ {
98
+ "$ref": "#/$defs/repairSelection"
99
+ },
100
+ {
101
+ "type": "null"
102
+ }
103
+ ]
57
104
  }
58
105
  },
59
106
  "allOf": [
60
107
  {
61
108
  "if": {
62
- "properties": { "lane": { "const": "source-evidence-dataset-development" } },
109
+ "properties": {
110
+ "lane": {
111
+ "const": "source-evidence-dataset-development"
112
+ }
113
+ },
114
+ "required": ["lane"]
115
+ },
116
+ "then": {
117
+ "properties": {
118
+ "seed": {
119
+ "$ref": "#/$defs/selection"
120
+ }
121
+ }
122
+ }
123
+ },
124
+ {
125
+ "if": {
126
+ "properties": {
127
+ "lane": {
128
+ "const": "existing-owner-draft-repair"
129
+ }
130
+ },
63
131
  "required": ["lane"]
64
132
  },
65
- "then": { "properties": { "seed": { "$ref": "#/$defs/selection" } } }
133
+ "then": {
134
+ "required": ["repair"],
135
+ "properties": {
136
+ "repair": {
137
+ "$ref": "#/$defs/repairSelection"
138
+ },
139
+ "target_entities": {
140
+ "type": "array",
141
+ "minItems": 1,
142
+ "maxItems": 1,
143
+ "items": {
144
+ "const": "process"
145
+ }
146
+ },
147
+ "seed": {
148
+ "type": "null"
149
+ },
150
+ "preparation": {
151
+ "type": "null"
152
+ }
153
+ }
154
+ },
155
+ "else": {
156
+ "properties": {
157
+ "repair": {
158
+ "type": "null"
159
+ }
160
+ }
161
+ }
66
162
  }
67
163
  ],
68
164
  "$defs": {
@@ -76,21 +172,41 @@
76
172
  "type": "object",
77
173
  "additionalProperties": false,
78
174
  "required": ["path"],
79
- "properties": { "path": { "type": "string", "minLength": 1, "maxLength": 4096 } }
175
+ "properties": {
176
+ "path": {
177
+ "type": "string",
178
+ "minLength": 1,
179
+ "maxLength": 4096
180
+ }
181
+ }
80
182
  },
81
183
  "accountIntent": {
82
184
  "type": "object",
83
185
  "additionalProperties": false,
84
186
  "required": ["project_ref", "user_id", "session_reference"],
85
187
  "properties": {
86
- "project_ref": { "type": "string", "pattern": "^[a-z0-9]{20}$" },
188
+ "project_ref": {
189
+ "type": "string",
190
+ "pattern": "^[a-z0-9]{20}$"
191
+ },
87
192
  "user_id": {
88
193
  "type": "string",
89
194
  "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
90
195
  },
91
- "account_mode": { "enum": ["ordinary", "production-test"] },
196
+ "account_mode": {
197
+ "enum": ["ordinary", "production-test"]
198
+ },
92
199
  "session_reference": {
93
- "oneOf": [{ "type": "string", "minLength": 1, "maxLength": 4096 }, { "type": "null" }]
200
+ "oneOf": [
201
+ {
202
+ "type": "string",
203
+ "minLength": 1,
204
+ "maxLength": 4096
205
+ },
206
+ {
207
+ "type": "null"
208
+ }
209
+ ]
94
210
  }
95
211
  }
96
212
  },
@@ -99,7 +215,9 @@
99
215
  "additionalProperties": false,
100
216
  "required": ["operation", "type", "input", "source_input", "output_directory"],
101
217
  "properties": {
102
- "operation": { "const": "dataset-curation-cleanup" },
218
+ "operation": {
219
+ "const": "dataset-curation-cleanup"
220
+ },
103
221
  "type": {
104
222
  "enum": [
105
223
  "contact",
@@ -112,11 +230,74 @@
112
230
  "lifecyclemodel"
113
231
  ]
114
232
  },
115
- "input": { "type": "string", "minLength": 1, "maxLength": 4096 },
233
+ "input": {
234
+ "type": "string",
235
+ "minLength": 1,
236
+ "maxLength": 4096
237
+ },
116
238
  "source_input": {
117
- "oneOf": [{ "type": "string", "minLength": 1, "maxLength": 4096 }, { "type": "null" }]
239
+ "oneOf": [
240
+ {
241
+ "type": "string",
242
+ "minLength": 1,
243
+ "maxLength": 4096
244
+ },
245
+ {
246
+ "type": "null"
247
+ }
248
+ ]
249
+ },
250
+ "output_directory": {
251
+ "type": "string",
252
+ "minLength": 1,
253
+ "maxLength": 4096
254
+ }
255
+ }
256
+ },
257
+ "repairSelection": {
258
+ "type": "object",
259
+ "additionalProperties": false,
260
+ "required": ["kind", "contract", "before", "candidate", "predecessor"],
261
+ "properties": {
262
+ "kind": {
263
+ "const": "existing-owner-draft-metadata"
264
+ },
265
+ "contract": {
266
+ "type": "string",
267
+ "minLength": 1,
268
+ "maxLength": 4096
269
+ },
270
+ "before": {
271
+ "type": "string",
272
+ "minLength": 1,
273
+ "maxLength": 4096
118
274
  },
119
- "output_directory": { "type": "string", "minLength": 1, "maxLength": 4096 }
275
+ "candidate": {
276
+ "type": "string",
277
+ "minLength": 1,
278
+ "maxLength": 4096
279
+ },
280
+ "predecessor": {
281
+ "oneOf": [
282
+ {
283
+ "type": "object",
284
+ "additionalProperties": false,
285
+ "required": ["task_id", "receipt_sha256"],
286
+ "properties": {
287
+ "task_id": {
288
+ "$ref": "#/$defs/id"
289
+ },
290
+ "receipt_sha256": {
291
+ "type": "string",
292
+ "pattern": "^[0-9a-f]{64}$"
293
+ }
294
+ }
295
+ },
296
+ {
297
+ "type": "null"
298
+ }
299
+ ]
300
+ }
120
301
  }
121
302
  }
122
303
  }
@@ -14,7 +14,7 @@
14
14
  "additionalProperties": false,
15
15
  "required": ["package_version", "platform", "content_sha256", "node_version", "node_sha256"],
16
16
  "properties": {
17
- "package_version": { "const": "0.1.14" },
17
+ "package_version": { "const": "0.1.19" },
18
18
  "platform": {
19
19
  "enum": ["linux-x64", "linux-arm64", "darwin-arm64", "win32-x64"]
20
20
  },