@tiangong-lca/foundry 0.1.19 → 0.1.20

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 (51) hide show
  1. package/README.md +5 -3
  2. package/docs/architecture.md +5 -3
  3. package/docs/foundry-task-contracts.md +2 -0
  4. package/docs/package-distribution-contract.md +5 -3
  5. package/docs/public-runtime-contract.md +41 -3
  6. package/docs/runtime-context-contract.md +5 -3
  7. package/docs/task-authorization-contract.md +2 -0
  8. package/package-dist/assets/foundry-package-descriptor.json +142 -74
  9. package/package-dist/scripts/foundry-facade.d.ts +6 -0
  10. package/package-dist/scripts/foundry-facade.js +35 -0
  11. package/package-dist/scripts/foundry-runtime.d.ts +2 -1
  12. package/package-dist/scripts/lib/final-delivery-manifest.d.ts +40 -0
  13. package/package-dist/scripts/lib/final-delivery-manifest.js +145 -0
  14. package/package-dist/scripts/lib/final-delivery-review.d.ts +37 -0
  15. package/package-dist/scripts/lib/final-delivery-review.js +108 -0
  16. package/package-dist/scripts/lib/finalize-owners/native-draft-handoff.js +4 -3
  17. package/package-dist/scripts/lib/foundry-edge-repair-preparation.d.ts +3 -0
  18. package/package-dist/scripts/lib/foundry-edge-repair-preparation.js +90 -1
  19. package/package-dist/scripts/lib/foundry-edge-session.d.ts +18 -1
  20. package/package-dist/scripts/lib/foundry-edge-session.js +137 -3
  21. package/package-dist/scripts/lib/foundry-edge-support.d.ts +1 -1
  22. package/package-dist/scripts/lib/foundry-interaction-input.js +2 -2
  23. package/package-dist/scripts/lib/foundry-operation-result.d.ts +1 -1
  24. package/package-dist/scripts/lib/foundry-operation-result.js +1 -0
  25. package/package-dist/scripts/lib/foundry-owner-readback.d.ts +3 -2
  26. package/package-dist/scripts/lib/foundry-owner-readback.js +21 -2
  27. package/package-dist/scripts/lib/foundry-package-contract.d.ts +3 -3
  28. package/package-dist/scripts/lib/foundry-package-contract.js +7 -1
  29. package/package-dist/scripts/lib/foundry-repair-census.d.ts +82 -0
  30. package/package-dist/scripts/lib/foundry-repair-census.js +574 -0
  31. package/package-dist/scripts/lib/foundry-repair-scope.d.ts +15 -2
  32. package/package-dist/scripts/lib/foundry-repair-scope.js +62 -10
  33. package/package-dist/scripts/lib/foundry-scientific-repair.d.ts +38 -0
  34. package/package-dist/scripts/lib/foundry-scientific-repair.js +438 -0
  35. package/package-dist/scripts/lib/foundry-semantic-input.js +1 -1
  36. package/package-dist/scripts/lib/foundry-task-input-preparation.d.ts +4 -0
  37. package/package-dist/scripts/lib/foundry-task-input-preparation.js +160 -0
  38. package/package-dist/scripts/lib/foundry-task-registration.js +19 -1
  39. package/package-dist/scripts/lib/foundry-task-types.d.ts +2 -0
  40. package/package-dist/scripts/lib/foundry-workflow-execution.js +3 -0
  41. package/package-dist/scripts/lib/foundry-workflow-repair.d.ts +5 -0
  42. package/package-dist/scripts/lib/foundry-workflow-repair.js +151 -0
  43. package/package-dist/scripts/public-api.d.ts +6 -0
  44. package/package-dist/scripts/runtime-entry.js +15 -6
  45. package/package.json +4 -1
  46. package/specs/schemas/foundry-interaction-draft.schema.json +323 -0
  47. package/specs/schemas/foundry-operation-result.schema.json +1 -0
  48. package/specs/schemas/foundry-package-descriptor.schema.json +4 -1
  49. package/specs/schemas/foundry-scientific-repair.schema.json +66 -0
  50. package/specs/schemas/foundry-semantic-draft.schema.json +50 -0
  51. package/specs/schemas/foundry-task-start.schema.json +10 -2
@@ -0,0 +1,323 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://tiangong-lca.local/foundry/interaction-draft.schema.json",
4
+ "title": "Foundry interaction preparation draft v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema", "events"],
8
+ "properties": {
9
+ "schema": {
10
+ "const": "tiangong-foundry.interaction-draft.v1"
11
+ },
12
+ "events": {
13
+ "type": "array",
14
+ "minItems": 1,
15
+ "maxItems": 16,
16
+ "items": {
17
+ "oneOf": [
18
+ {
19
+ "$ref": "#/$defs/question"
20
+ },
21
+ {
22
+ "$ref": "#/$defs/answer"
23
+ },
24
+ {
25
+ "$ref": "#/$defs/assumption"
26
+ }
27
+ ]
28
+ }
29
+ }
30
+ },
31
+ "$defs": {
32
+ "id": {
33
+ "type": "string",
34
+ "minLength": 1,
35
+ "maxLength": 256,
36
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
37
+ },
38
+ "text": {
39
+ "type": "string",
40
+ "minLength": 1,
41
+ "maxLength": 4096,
42
+ "pattern": "^[^\\u0000\\r\\n]+$"
43
+ },
44
+ "shortText": {
45
+ "type": "string",
46
+ "minLength": 1,
47
+ "maxLength": 1200,
48
+ "pattern": "^[^\\u0000\\r\\n]+$"
49
+ },
50
+ "scope": {
51
+ "oneOf": [
52
+ {
53
+ "type": "null"
54
+ },
55
+ {
56
+ "enum": [
57
+ "contact",
58
+ "source",
59
+ "support",
60
+ "flow",
61
+ "flowproperty",
62
+ "unitgroup",
63
+ "process",
64
+ "lifecyclemodel"
65
+ ]
66
+ }
67
+ ]
68
+ },
69
+ "concreteScope": {
70
+ "enum": [
71
+ "contact",
72
+ "source",
73
+ "flow",
74
+ "flowproperty",
75
+ "unitgroup",
76
+ "process",
77
+ "lifecyclemodel"
78
+ ]
79
+ },
80
+ "objectScope": {
81
+ "type": "object",
82
+ "additionalProperties": false,
83
+ "required": ["entity_id", "version"],
84
+ "properties": {
85
+ "entity_id": {
86
+ "$ref": "#/$defs/id"
87
+ },
88
+ "version": {
89
+ "$ref": "#/$defs/id"
90
+ }
91
+ }
92
+ },
93
+ "evidence": {
94
+ "type": "array",
95
+ "maxItems": 16,
96
+ "uniqueItems": true,
97
+ "items": {
98
+ "$ref": "#/$defs/text"
99
+ }
100
+ },
101
+ "question": {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "required": [
105
+ "kind",
106
+ "id",
107
+ "dataset_type",
108
+ "missing",
109
+ "impact",
110
+ "recommendation",
111
+ "ask",
112
+ "choices",
113
+ "evidence_files",
114
+ "supersedes"
115
+ ],
116
+ "properties": {
117
+ "kind": {
118
+ "const": "question"
119
+ },
120
+ "id": {
121
+ "$ref": "#/$defs/id"
122
+ },
123
+ "dataset_type": {
124
+ "$ref": "#/$defs/scope"
125
+ },
126
+ "object_scope": {
127
+ "$ref": "#/$defs/objectScope"
128
+ },
129
+ "missing": {
130
+ "$ref": "#/$defs/shortText"
131
+ },
132
+ "impact": {
133
+ "$ref": "#/$defs/shortText"
134
+ },
135
+ "recommendation": {
136
+ "$ref": "#/$defs/shortText"
137
+ },
138
+ "ask": {
139
+ "$ref": "#/$defs/shortText"
140
+ },
141
+ "choices": {
142
+ "type": "array",
143
+ "maxItems": 4,
144
+ "uniqueItems": true,
145
+ "items": {
146
+ "type": "string",
147
+ "minLength": 1,
148
+ "maxLength": 240,
149
+ "pattern": "^[^\\u0000\\r\\n]+$"
150
+ }
151
+ },
152
+ "supersedes": {
153
+ "oneOf": [
154
+ {
155
+ "$ref": "#/$defs/id"
156
+ },
157
+ {
158
+ "type": "null"
159
+ }
160
+ ]
161
+ },
162
+ "evidence_files": {
163
+ "$ref": "#/$defs/evidence"
164
+ }
165
+ },
166
+ "if": {
167
+ "properties": {
168
+ "object_scope": {}
169
+ },
170
+ "required": ["object_scope"]
171
+ },
172
+ "then": {
173
+ "properties": {
174
+ "dataset_type": {
175
+ "$ref": "#/$defs/concreteScope"
176
+ }
177
+ }
178
+ }
179
+ },
180
+ "answer": {
181
+ "type": "object",
182
+ "additionalProperties": false,
183
+ "required": [
184
+ "kind",
185
+ "question_id",
186
+ "decision_id",
187
+ "supersedes_decision_id",
188
+ "raw_answer",
189
+ "adopted_decision",
190
+ "disposition",
191
+ "evidence_files"
192
+ ],
193
+ "properties": {
194
+ "kind": {
195
+ "const": "answer"
196
+ },
197
+ "question_id": {
198
+ "$ref": "#/$defs/id"
199
+ },
200
+ "decision_id": {
201
+ "$ref": "#/$defs/id"
202
+ },
203
+ "supersedes_decision_id": {
204
+ "oneOf": [
205
+ {
206
+ "$ref": "#/$defs/id"
207
+ },
208
+ {
209
+ "type": "null"
210
+ }
211
+ ]
212
+ },
213
+ "raw_answer": {
214
+ "type": "string",
215
+ "minLength": 1,
216
+ "maxLength": 16384,
217
+ "pattern": "^[^\\u0000]+$"
218
+ },
219
+ "adopted_decision": {
220
+ "oneOf": [
221
+ {
222
+ "$ref": "#/$defs/text"
223
+ },
224
+ {
225
+ "type": "null"
226
+ }
227
+ ]
228
+ },
229
+ "disposition": {
230
+ "enum": ["decided", "investigate"]
231
+ },
232
+ "evidence_files": {
233
+ "$ref": "#/$defs/evidence"
234
+ }
235
+ },
236
+ "allOf": [
237
+ {
238
+ "if": {
239
+ "properties": {
240
+ "disposition": {
241
+ "const": "investigate"
242
+ }
243
+ },
244
+ "required": ["disposition"]
245
+ },
246
+ "then": {
247
+ "properties": {
248
+ "adopted_decision": {
249
+ "type": "null"
250
+ }
251
+ }
252
+ },
253
+ "else": {
254
+ "properties": {
255
+ "adopted_decision": {
256
+ "$ref": "#/$defs/text"
257
+ }
258
+ }
259
+ }
260
+ }
261
+ ]
262
+ },
263
+ "assumption": {
264
+ "type": "object",
265
+ "additionalProperties": false,
266
+ "required": [
267
+ "kind",
268
+ "id",
269
+ "dataset_type",
270
+ "statement",
271
+ "impact",
272
+ "evidence_files",
273
+ "supersedes"
274
+ ],
275
+ "properties": {
276
+ "kind": {
277
+ "const": "assumption"
278
+ },
279
+ "id": {
280
+ "$ref": "#/$defs/id"
281
+ },
282
+ "dataset_type": {
283
+ "$ref": "#/$defs/scope"
284
+ },
285
+ "object_scope": {
286
+ "$ref": "#/$defs/objectScope"
287
+ },
288
+ "statement": {
289
+ "$ref": "#/$defs/text"
290
+ },
291
+ "impact": {
292
+ "$ref": "#/$defs/text"
293
+ },
294
+ "supersedes": {
295
+ "oneOf": [
296
+ {
297
+ "$ref": "#/$defs/id"
298
+ },
299
+ {
300
+ "type": "null"
301
+ }
302
+ ]
303
+ },
304
+ "evidence_files": {
305
+ "$ref": "#/$defs/evidence"
306
+ }
307
+ },
308
+ "if": {
309
+ "properties": {
310
+ "object_scope": {}
311
+ },
312
+ "required": ["object_scope"]
313
+ },
314
+ "then": {
315
+ "properties": {
316
+ "dataset_type": {
317
+ "$ref": "#/$defs/concreteScope"
318
+ }
319
+ }
320
+ }
321
+ }
322
+ }
323
+ }
@@ -24,6 +24,7 @@
24
24
  "doctor",
25
25
  "task.start",
26
26
  "task.status",
27
+ "task.prepare-input",
27
28
  "task.resume",
28
29
  "task.adopt-runtime",
29
30
  "workspace.migrate"
@@ -18,7 +18,7 @@
18
18
  "const": "@tiangong-lca/foundry"
19
19
  },
20
20
  "version": {
21
- "const": "0.1.19"
21
+ "const": "0.1.20"
22
22
  },
23
23
  "cli_dependency": {
24
24
  "type": "object",
@@ -73,6 +73,9 @@
73
73
  "tiangong-foundry.operation-result.v1",
74
74
  "tiangong-foundry.task-start.v1",
75
75
  "tiangong-foundry.semantic-input.v1",
76
+ "tiangong-foundry.semantic-draft.v1",
77
+ "tiangong-foundry.interaction-draft.v1",
78
+ "tiangong-foundry.scientific-repair.v1",
76
79
  "tiangong-foundry.interaction-input.v1",
77
80
  "tiangong-foundry.authorization-input.v1",
78
81
  "tiangong-foundry.reference-input.v1",
@@ -0,0 +1,66 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://tiangong-lca.local/foundry/scientific-repair.schema.json",
4
+ "title": "Foundry scientific owner-draft repair evidence selection",
5
+ "type": "object",
6
+ "required": [
7
+ "schema",
8
+ "author_id",
9
+ "worker_input",
10
+ "worker_report",
11
+ "changes",
12
+ "review",
13
+ "sources"
14
+ ],
15
+ "properties": {
16
+ "schema": {
17
+ "const": "tiangong-foundry.scientific-repair.v1"
18
+ },
19
+ "author_id": {
20
+ "type": "string",
21
+ "minLength": 1,
22
+ "maxLength": 256
23
+ },
24
+ "worker_input": {
25
+ "$ref": "#/$defs/selectedFile"
26
+ },
27
+ "worker_report": {
28
+ "$ref": "#/$defs/selectedFile"
29
+ },
30
+ "changes": {
31
+ "$ref": "#/$defs/selectedFile"
32
+ },
33
+ "review": {
34
+ "$ref": "#/$defs/selectedFile"
35
+ },
36
+ "sources": {
37
+ "type": "array",
38
+ "items": {
39
+ "$ref": "#/$defs/selectedFile"
40
+ },
41
+ "minItems": 1,
42
+ "maxItems": 128,
43
+ "uniqueItems": true
44
+ }
45
+ },
46
+ "additionalProperties": false,
47
+ "$defs": {
48
+ "selectedFile": {
49
+ "type": "object",
50
+ "properties": {
51
+ "file": {
52
+ "type": "string",
53
+ "minLength": 1,
54
+ "description": "Canonical path of a source selected in this task."
55
+ },
56
+ "sha256": {
57
+ "type": "string",
58
+ "pattern": "^[0-9a-f]{64}$",
59
+ "description": "SHA-256 of the selected file bytes."
60
+ }
61
+ },
62
+ "required": ["file", "sha256"],
63
+ "additionalProperties": false
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://tiangong-lca.local/foundry/semantic-draft.schema.json",
4
+ "title": "Foundry semantic preparation draft v1",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["schema", "submissions"],
8
+ "properties": {
9
+ "schema": {
10
+ "const": "tiangong-foundry.semantic-draft.v1"
11
+ },
12
+ "submissions": {
13
+ "type": "array",
14
+ "minItems": 1,
15
+ "maxItems": 1000,
16
+ "items": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["kind", "authoring_task", "file"],
20
+ "properties": {
21
+ "kind": {
22
+ "enum": ["patch", "classification", "location", "identity"]
23
+ },
24
+ "file": {
25
+ "type": "string",
26
+ "minLength": 1,
27
+ "maxLength": 4096,
28
+ "pattern": "^[^\\u0000\\r\\n]+$"
29
+ },
30
+ "decision_ids": {
31
+ "type": "array",
32
+ "maxItems": 100,
33
+ "uniqueItems": true,
34
+ "items": {
35
+ "type": "string",
36
+ "maxLength": 256,
37
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
38
+ }
39
+ },
40
+ "authoring_task": {
41
+ "type": "string",
42
+ "minLength": 1,
43
+ "maxLength": 4096,
44
+ "pattern": "^[^\\u0000\\r\\n]+$"
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
@@ -335,8 +335,9 @@
335
335
  "required": ["kind", "contract", "before", "candidate", "predecessor"],
336
336
  "properties": {
337
337
  "kind": {
338
- "const": "existing-owner-draft-metadata"
338
+ "enum": ["existing-owner-draft-metadata", "existing-owner-draft-scientific"]
339
339
  },
340
+ "scientific": { "type": "string", "minLength": 1, "maxLength": 4096 },
340
341
  "contract": {
341
342
  "type": "string",
342
343
  "minLength": 1,
@@ -373,7 +374,14 @@
373
374
  }
374
375
  ]
375
376
  }
376
- }
377
+ },
378
+ "allOf": [
379
+ {
380
+ "if": { "properties": { "kind": { "const": "existing-owner-draft-scientific" } } },
381
+ "then": { "properties": { "scientific": true }, "required": ["scientific"] },
382
+ "else": { "properties": { "scientific": false } }
383
+ }
384
+ ]
377
385
  }
378
386
  }
379
387
  }