@tiangong-lca/foundry 0.1.9 → 0.1.11

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 (107) hide show
  1. package/README.md +13 -11
  2. package/docs/architecture.md +12 -10
  3. package/docs/foundry-task-contracts.md +16 -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 +11 -9
  11. package/docs/public-runtime-contract.md +31 -9
  12. package/docs/runtime-context-contract.md +7 -5
  13. package/docs/task-authorization-contract.md +5 -3
  14. package/package-dist/assets/foundry-package-descriptor.json +300 -154
  15. package/package-dist/scripts/foundry-facade.d.ts +1 -0
  16. package/package-dist/scripts/foundry-facade.js +233 -28
  17. package/package-dist/scripts/foundry-runtime.d.ts +14 -3
  18. package/package-dist/scripts/foundry-runtime.js +2 -2
  19. package/package-dist/scripts/lib/finalize-owners/commit-handoff.js +3 -3
  20. package/package-dist/scripts/lib/finalize-owners/{native-insert-closeout.d.ts → native-draft-closeout.d.ts} +1 -1
  21. package/package-dist/scripts/lib/finalize-owners/{native-insert-closeout.js → native-draft-closeout.js} +10 -6
  22. package/package-dist/scripts/lib/finalize-owners/{native-insert-handoff.d.ts → native-draft-handoff.d.ts} +7 -5
  23. package/package-dist/scripts/lib/finalize-owners/{native-insert-handoff.js → native-draft-handoff.js} +30 -11
  24. package/package-dist/scripts/lib/finalize-owners/post-write-closeout.js +2 -2
  25. package/package-dist/scripts/lib/foundry-authorization-input.d.ts +10 -1
  26. package/package-dist/scripts/lib/foundry-authorization-input.js +27 -3
  27. package/package-dist/scripts/lib/foundry-command-metadata.js +25 -2
  28. package/package-dist/scripts/lib/foundry-command-registry.d.ts +4 -4
  29. package/package-dist/scripts/lib/foundry-command-registry.js +3 -0
  30. package/package-dist/scripts/lib/foundry-execution-admission.js +3 -3
  31. package/package-dist/scripts/lib/foundry-facade-store.js +56 -6
  32. package/package-dist/scripts/lib/foundry-interaction-input.d.ts +19 -0
  33. package/package-dist/scripts/lib/foundry-interaction-input.js +327 -0
  34. package/package-dist/scripts/lib/foundry-interaction-projection.d.ts +22 -0
  35. package/package-dist/scripts/lib/foundry-interaction-projection.js +81 -0
  36. package/package-dist/scripts/lib/foundry-interaction-types.d.ts +17 -0
  37. package/package-dist/scripts/lib/foundry-interaction-types.js +4 -0
  38. package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +33 -16
  39. package/package-dist/scripts/lib/foundry-owner-execution-store.js +66 -5
  40. package/package-dist/scripts/lib/foundry-owner-readback.d.ts +3 -0
  41. package/package-dist/scripts/lib/foundry-owner-readback.js +101 -27
  42. package/package-dist/scripts/lib/foundry-package-contract.d.ts +4 -4
  43. package/package-dist/scripts/lib/foundry-package-contract.js +4 -2
  44. package/package-dist/scripts/lib/foundry-repair-execution.d.ts +11 -0
  45. package/package-dist/scripts/lib/foundry-repair-execution.js +70 -0
  46. package/package-dist/scripts/lib/foundry-repair-handoff.d.ts +16 -0
  47. package/package-dist/scripts/lib/foundry-repair-handoff.js +108 -0
  48. package/package-dist/scripts/lib/foundry-repair-preflight.d.ts +96 -0
  49. package/package-dist/scripts/lib/foundry-repair-preflight.js +313 -0
  50. package/package-dist/scripts/lib/foundry-repair-reference-binding.d.ts +26 -0
  51. package/package-dist/scripts/lib/foundry-repair-reference-binding.js +120 -0
  52. package/package-dist/scripts/lib/foundry-repair-reference-proof.d.ts +63 -0
  53. package/package-dist/scripts/lib/foundry-repair-reference-proof.js +329 -0
  54. package/package-dist/scripts/lib/foundry-repair-scope.d.ts +76 -0
  55. package/package-dist/scripts/lib/foundry-repair-scope.js +304 -0
  56. package/package-dist/scripts/lib/foundry-runtime-command-policy.js +1 -0
  57. package/package-dist/scripts/lib/foundry-runtime-qualification.js +2 -2
  58. package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +3 -0
  59. package/package-dist/scripts/lib/foundry-runtime-utils.js +6 -1
  60. package/package-dist/scripts/lib/foundry-semantic-input.d.ts +2 -0
  61. package/package-dist/scripts/lib/foundry-semantic-input.js +29 -2
  62. package/package-dist/scripts/lib/foundry-semantic-interaction.d.ts +12 -0
  63. package/package-dist/scripts/lib/foundry-semantic-interaction.js +38 -0
  64. package/package-dist/scripts/lib/foundry-successor-predecessor.d.ts +36 -0
  65. package/package-dist/scripts/lib/foundry-successor-predecessor.js +399 -0
  66. package/package-dist/scripts/lib/foundry-task-registration.js +64 -3
  67. package/package-dist/scripts/lib/foundry-task-start-spec.d.ts +14 -0
  68. package/package-dist/scripts/lib/foundry-task-start-spec.js +60 -1
  69. package/package-dist/scripts/lib/foundry-task-store.d.ts +13 -1
  70. package/package-dist/scripts/lib/foundry-task-store.js +23 -12
  71. package/package-dist/scripts/lib/foundry-task-types.d.ts +22 -1
  72. package/package-dist/scripts/lib/foundry-tidas-source.d.ts +15 -0
  73. package/package-dist/scripts/lib/foundry-tidas-source.js +90 -0
  74. package/package-dist/scripts/lib/foundry-workflow-assessment.d.ts +7 -1
  75. package/package-dist/scripts/lib/foundry-workflow-assessment.js +127 -6
  76. package/package-dist/scripts/lib/foundry-workflow-authorization.d.ts +2 -1
  77. package/package-dist/scripts/lib/foundry-workflow-authorization.js +194 -26
  78. package/package-dist/scripts/lib/foundry-workflow-context.js +4 -0
  79. package/package-dist/scripts/lib/foundry-workflow-execution.js +6 -1
  80. package/package-dist/scripts/lib/foundry-workflow-finalize.js +7 -4
  81. package/package-dist/scripts/lib/foundry-workflow-interaction.d.ts +4 -0
  82. package/package-dist/scripts/lib/foundry-workflow-interaction.js +63 -0
  83. package/package-dist/scripts/lib/foundry-workflow-repair.d.ts +36 -0
  84. package/package-dist/scripts/lib/foundry-workflow-repair.js +580 -0
  85. package/package-dist/scripts/lib/foundry-workflow-semantic.js +21 -1
  86. package/package-dist/scripts/lib/foundry-workflow-state.d.ts +9 -1
  87. package/package-dist/scripts/lib/foundry-workflow-state.js +239 -39
  88. package/package-dist/scripts/lib/import-curation/curation-cleanup.js +39 -8
  89. package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +1 -1
  90. package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.d.ts +13 -2
  91. package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.js +100 -29
  92. package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.js +1 -2
  93. package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.js +2 -3
  94. package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.js +8 -8
  95. package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.js +12 -2
  96. package/package-dist/scripts/public-api.d.ts +2 -0
  97. package/package-dist/scripts/public-api.js +1 -0
  98. package/package-dist/scripts/runtime-entry.js +9 -1
  99. package/package.json +3 -2
  100. package/specs/import-profiles.json +1 -1
  101. package/specs/schemas/foundry-authorization-input.schema.json +45 -2
  102. package/specs/schemas/foundry-interaction-input.schema.json +173 -0
  103. package/specs/schemas/foundry-managed-runtime.schema.json +1 -1
  104. package/specs/schemas/foundry-package-descriptor.schema.json +3 -2
  105. package/specs/schemas/foundry-semantic-input.schema.json +12 -1
  106. package/specs/schemas/foundry-task-start.schema.json +275 -19
  107. package/specs/schemas/runtime-qualification.schema.json +1 -1
@@ -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,26 +58,185 @@
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
+ "brief": {
96
+ "$ref": "#/$defs/taskBrief"
97
+ },
98
+ "repair": {
99
+ "oneOf": [
100
+ {
101
+ "$ref": "#/$defs/repairSelection"
102
+ },
103
+ {
104
+ "type": "null"
105
+ }
106
+ ]
57
107
  }
58
108
  },
59
109
  "allOf": [
60
110
  {
61
111
  "if": {
62
- "properties": { "lane": { "const": "source-evidence-dataset-development" } },
112
+ "properties": {
113
+ "lane": {
114
+ "const": "source-evidence-dataset-development"
115
+ }
116
+ },
63
117
  "required": ["lane"]
64
118
  },
65
- "then": { "properties": { "seed": { "$ref": "#/$defs/selection" } } }
119
+ "then": {
120
+ "properties": {
121
+ "seed": {
122
+ "$ref": "#/$defs/selection"
123
+ }
124
+ }
125
+ }
126
+ },
127
+ {
128
+ "if": {
129
+ "properties": {
130
+ "lane": {
131
+ "const": "existing-owner-draft-repair"
132
+ }
133
+ },
134
+ "required": ["lane"]
135
+ },
136
+ "then": {
137
+ "required": ["repair"],
138
+ "properties": {
139
+ "repair": {
140
+ "$ref": "#/$defs/repairSelection"
141
+ },
142
+ "target_entities": {
143
+ "type": "array",
144
+ "minItems": 1,
145
+ "maxItems": 1,
146
+ "items": {
147
+ "const": "process"
148
+ }
149
+ },
150
+ "seed": {
151
+ "type": "null"
152
+ },
153
+ "preparation": {
154
+ "type": "null"
155
+ }
156
+ }
157
+ },
158
+ "else": {
159
+ "properties": {
160
+ "repair": {
161
+ "type": "null"
162
+ }
163
+ }
164
+ }
66
165
  }
67
166
  ],
68
167
  "$defs": {
168
+ "taskBrief": {
169
+ "type": "object",
170
+ "additionalProperties": false,
171
+ "required": [
172
+ "original_request",
173
+ "goal",
174
+ "intended_use",
175
+ "scope",
176
+ "deliverables",
177
+ "user_constraints",
178
+ "ai_assumptions"
179
+ ],
180
+ "properties": {
181
+ "original_request": {
182
+ "oneOf": [
183
+ {
184
+ "type": "string",
185
+ "minLength": 1,
186
+ "maxLength": 16384,
187
+ "pattern": "\\S"
188
+ },
189
+ {
190
+ "type": "null"
191
+ }
192
+ ]
193
+ },
194
+ "goal": {
195
+ "$ref": "#/$defs/briefText"
196
+ },
197
+ "intended_use": {
198
+ "$ref": "#/$defs/nullableBriefText"
199
+ },
200
+ "scope": {
201
+ "$ref": "#/$defs/nullableBriefText"
202
+ },
203
+ "deliverables": {
204
+ "$ref": "#/$defs/briefItems"
205
+ },
206
+ "user_constraints": {
207
+ "$ref": "#/$defs/briefItems"
208
+ },
209
+ "ai_assumptions": {
210
+ "$ref": "#/$defs/briefItems"
211
+ }
212
+ }
213
+ },
214
+ "briefText": {
215
+ "type": "string",
216
+ "minLength": 1,
217
+ "maxLength": 4096,
218
+ "pattern": "\\S"
219
+ },
220
+ "nullableBriefText": {
221
+ "oneOf": [
222
+ {
223
+ "$ref": "#/$defs/briefText"
224
+ },
225
+ {
226
+ "type": "null"
227
+ }
228
+ ]
229
+ },
230
+ "briefItems": {
231
+ "type": "array",
232
+ "maxItems": 32,
233
+ "items": {
234
+ "type": "string",
235
+ "minLength": 1,
236
+ "maxLength": 2048,
237
+ "pattern": "\\S"
238
+ }
239
+ },
69
240
  "id": {
70
241
  "type": "string",
71
242
  "minLength": 1,
@@ -76,21 +247,41 @@
76
247
  "type": "object",
77
248
  "additionalProperties": false,
78
249
  "required": ["path"],
79
- "properties": { "path": { "type": "string", "minLength": 1, "maxLength": 4096 } }
250
+ "properties": {
251
+ "path": {
252
+ "type": "string",
253
+ "minLength": 1,
254
+ "maxLength": 4096
255
+ }
256
+ }
80
257
  },
81
258
  "accountIntent": {
82
259
  "type": "object",
83
260
  "additionalProperties": false,
84
261
  "required": ["project_ref", "user_id", "session_reference"],
85
262
  "properties": {
86
- "project_ref": { "type": "string", "pattern": "^[a-z0-9]{20}$" },
263
+ "project_ref": {
264
+ "type": "string",
265
+ "pattern": "^[a-z0-9]{20}$"
266
+ },
87
267
  "user_id": {
88
268
  "type": "string",
89
269
  "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
270
  },
91
- "account_mode": { "enum": ["ordinary", "production-test"] },
271
+ "account_mode": {
272
+ "enum": ["ordinary", "production-test"]
273
+ },
92
274
  "session_reference": {
93
- "oneOf": [{ "type": "string", "minLength": 1, "maxLength": 4096 }, { "type": "null" }]
275
+ "oneOf": [
276
+ {
277
+ "type": "string",
278
+ "minLength": 1,
279
+ "maxLength": 4096
280
+ },
281
+ {
282
+ "type": "null"
283
+ }
284
+ ]
94
285
  }
95
286
  }
96
287
  },
@@ -99,7 +290,9 @@
99
290
  "additionalProperties": false,
100
291
  "required": ["operation", "type", "input", "source_input", "output_directory"],
101
292
  "properties": {
102
- "operation": { "const": "dataset-curation-cleanup" },
293
+ "operation": {
294
+ "const": "dataset-curation-cleanup"
295
+ },
103
296
  "type": {
104
297
  "enum": [
105
298
  "contact",
@@ -112,11 +305,74 @@
112
305
  "lifecyclemodel"
113
306
  ]
114
307
  },
115
- "input": { "type": "string", "minLength": 1, "maxLength": 4096 },
308
+ "input": {
309
+ "type": "string",
310
+ "minLength": 1,
311
+ "maxLength": 4096
312
+ },
116
313
  "source_input": {
117
- "oneOf": [{ "type": "string", "minLength": 1, "maxLength": 4096 }, { "type": "null" }]
314
+ "oneOf": [
315
+ {
316
+ "type": "string",
317
+ "minLength": 1,
318
+ "maxLength": 4096
319
+ },
320
+ {
321
+ "type": "null"
322
+ }
323
+ ]
324
+ },
325
+ "output_directory": {
326
+ "type": "string",
327
+ "minLength": 1,
328
+ "maxLength": 4096
329
+ }
330
+ }
331
+ },
332
+ "repairSelection": {
333
+ "type": "object",
334
+ "additionalProperties": false,
335
+ "required": ["kind", "contract", "before", "candidate", "predecessor"],
336
+ "properties": {
337
+ "kind": {
338
+ "const": "existing-owner-draft-metadata"
339
+ },
340
+ "contract": {
341
+ "type": "string",
342
+ "minLength": 1,
343
+ "maxLength": 4096
344
+ },
345
+ "before": {
346
+ "type": "string",
347
+ "minLength": 1,
348
+ "maxLength": 4096
349
+ },
350
+ "candidate": {
351
+ "type": "string",
352
+ "minLength": 1,
353
+ "maxLength": 4096
118
354
  },
119
- "output_directory": { "type": "string", "minLength": 1, "maxLength": 4096 }
355
+ "predecessor": {
356
+ "oneOf": [
357
+ {
358
+ "type": "object",
359
+ "additionalProperties": false,
360
+ "required": ["task_id", "receipt_sha256"],
361
+ "properties": {
362
+ "task_id": {
363
+ "$ref": "#/$defs/id"
364
+ },
365
+ "receipt_sha256": {
366
+ "type": "string",
367
+ "pattern": "^[0-9a-f]{64}$"
368
+ }
369
+ }
370
+ },
371
+ {
372
+ "type": "null"
373
+ }
374
+ ]
375
+ }
120
376
  }
121
377
  }
122
378
  }
@@ -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
  },