@tiangong-lca/foundry 0.1.18 → 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 (116) 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 +10 -8
  5. package/docs/public-runtime-contract.md +53 -3
  6. package/docs/runtime-context-contract.md +7 -3
  7. package/docs/task-authorization-contract.md +2 -0
  8. package/package-dist/assets/foundry-package-descriptor.json +374 -136
  9. package/package-dist/scripts/foundry-facade.d.ts +6 -0
  10. package/package-dist/scripts/foundry-facade.js +38 -0
  11. package/package-dist/scripts/foundry-runtime.d.ts +3 -2
  12. package/package-dist/scripts/lib/decision-owners/identity-preflight.js +3 -1
  13. package/package-dist/scripts/lib/final-delivery-manifest.d.ts +40 -0
  14. package/package-dist/scripts/lib/final-delivery-manifest.js +145 -0
  15. package/package-dist/scripts/lib/final-delivery-review.d.ts +37 -0
  16. package/package-dist/scripts/lib/final-delivery-review.js +108 -0
  17. package/package-dist/scripts/lib/finalize-owners/cli-wrappers.d.ts +72 -1
  18. package/package-dist/scripts/lib/finalize-owners/cli-wrappers.js +123 -3
  19. package/package-dist/scripts/lib/finalize-owners/native-draft-handoff.js +4 -3
  20. package/package-dist/scripts/lib/finalize-owners/post-authoring.d.ts +9 -0
  21. package/package-dist/scripts/lib/finalize-owners/post-authoring.js +37 -8
  22. package/package-dist/scripts/lib/foundry-authentication-environment.js +1 -1
  23. package/package-dist/scripts/lib/foundry-curation-queue.d.ts +73 -0
  24. package/package-dist/scripts/lib/foundry-curation-queue.js +261 -0
  25. package/package-dist/scripts/lib/foundry-edge-draft-admission.d.ts +17 -0
  26. package/package-dist/scripts/lib/foundry-edge-draft-admission.js +94 -0
  27. package/package-dist/scripts/lib/foundry-edge-identity-preflight.d.ts +47 -0
  28. package/package-dist/scripts/lib/foundry-edge-identity-preflight.js +268 -0
  29. package/package-dist/scripts/lib/foundry-edge-oauth.d.ts +4 -0
  30. package/package-dist/scripts/lib/foundry-edge-oauth.js +154 -0
  31. package/package-dist/scripts/lib/foundry-edge-reference-intent.d.ts +51 -0
  32. package/package-dist/scripts/lib/foundry-edge-reference-intent.js +184 -0
  33. package/package-dist/scripts/lib/foundry-edge-repair-preparation.d.ts +24 -0
  34. package/package-dist/scripts/lib/foundry-edge-repair-preparation.js +209 -0
  35. package/package-dist/scripts/lib/foundry-edge-session.d.ts +32 -0
  36. package/package-dist/scripts/lib/foundry-edge-session.js +203 -0
  37. package/package-dist/scripts/lib/foundry-edge-support-plan.d.ts +69 -0
  38. package/package-dist/scripts/lib/foundry-edge-support-plan.js +245 -0
  39. package/package-dist/scripts/lib/foundry-edge-support-planning.d.ts +115 -0
  40. package/package-dist/scripts/lib/foundry-edge-support-planning.js +259 -0
  41. package/package-dist/scripts/lib/foundry-edge-support.d.ts +19 -0
  42. package/package-dist/scripts/lib/foundry-edge-support.js +188 -0
  43. package/package-dist/scripts/lib/foundry-execution-admission.d.ts +4 -2
  44. package/package-dist/scripts/lib/foundry-execution-admission.js +24 -2
  45. package/package-dist/scripts/lib/foundry-finalize-edge-identity.d.ts +30 -0
  46. package/package-dist/scripts/lib/foundry-finalize-edge-identity.js +102 -0
  47. package/package-dist/scripts/lib/foundry-finalize-owners.d.ts +1 -0
  48. package/package-dist/scripts/lib/foundry-finalize-owners.js +68 -2
  49. package/package-dist/scripts/lib/foundry-interaction-input.js +2 -2
  50. package/package-dist/scripts/lib/foundry-managed-authentication.js +1 -1
  51. package/package-dist/scripts/lib/foundry-operation-result.d.ts +1 -1
  52. package/package-dist/scripts/lib/foundry-operation-result.js +1 -0
  53. package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +16 -16
  54. package/package-dist/scripts/lib/foundry-owner-execution-store.js +34 -7
  55. package/package-dist/scripts/lib/foundry-owner-readback.d.ts +21 -0
  56. package/package-dist/scripts/lib/foundry-owner-readback.js +61 -0
  57. package/package-dist/scripts/lib/foundry-package-contract.d.ts +4 -4
  58. package/package-dist/scripts/lib/foundry-package-contract.js +8 -2
  59. package/package-dist/scripts/lib/foundry-preparation-cli-validation.js +71 -0
  60. package/package-dist/scripts/lib/foundry-process-mass-balance.d.ts +64 -0
  61. package/package-dist/scripts/lib/foundry-process-mass-balance.js +224 -0
  62. package/package-dist/scripts/lib/foundry-process-qa.d.ts +19 -0
  63. package/package-dist/scripts/lib/foundry-process-qa.js +423 -0
  64. package/package-dist/scripts/lib/foundry-repair-census.d.ts +82 -0
  65. package/package-dist/scripts/lib/foundry-repair-census.js +574 -0
  66. package/package-dist/scripts/lib/foundry-repair-execution.js +13 -2
  67. package/package-dist/scripts/lib/foundry-repair-scope.d.ts +15 -2
  68. package/package-dist/scripts/lib/foundry-repair-scope.js +62 -10
  69. package/package-dist/scripts/lib/foundry-runtime-environment.d.ts +2 -0
  70. package/package-dist/scripts/lib/foundry-runtime-environment.js +18 -0
  71. package/package-dist/scripts/lib/foundry-runtime-identity.d.ts +1 -0
  72. package/package-dist/scripts/lib/foundry-runtime-identity.js +19 -1
  73. package/package-dist/scripts/lib/foundry-runtime-qualification.js +2 -2
  74. package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +1 -0
  75. package/package-dist/scripts/lib/foundry-runtime-utils.js +1 -1
  76. package/package-dist/scripts/lib/foundry-scientific-repair.d.ts +38 -0
  77. package/package-dist/scripts/lib/foundry-scientific-repair.js +438 -0
  78. package/package-dist/scripts/lib/foundry-semantic-input.js +1 -1
  79. package/package-dist/scripts/lib/foundry-task-input-preparation.d.ts +4 -0
  80. package/package-dist/scripts/lib/foundry-task-input-preparation.js +160 -0
  81. package/package-dist/scripts/lib/foundry-task-registration.js +19 -1
  82. package/package-dist/scripts/lib/foundry-task-types.d.ts +2 -0
  83. package/package-dist/scripts/lib/foundry-typed-authoring-patch.d.ts +76 -0
  84. package/package-dist/scripts/lib/foundry-typed-authoring-patch.js +237 -0
  85. package/package-dist/scripts/lib/foundry-typed-context.d.ts +11 -0
  86. package/package-dist/scripts/lib/foundry-typed-context.js +79 -0
  87. package/package-dist/scripts/lib/foundry-typed-flow-qa.d.ts +166 -0
  88. package/package-dist/scripts/lib/foundry-typed-flow-qa.js +226 -0
  89. package/package-dist/scripts/lib/foundry-typed-model-write.d.ts +6 -0
  90. package/package-dist/scripts/lib/foundry-typed-model-write.js +59 -0
  91. package/package-dist/scripts/lib/foundry-workflow-assessment.js +67 -29
  92. package/package-dist/scripts/lib/foundry-workflow-authorization.js +82 -1
  93. package/package-dist/scripts/lib/foundry-workflow-context.js +59 -18
  94. package/package-dist/scripts/lib/foundry-workflow-execution.js +57 -5
  95. package/package-dist/scripts/lib/foundry-workflow-finalize.js +27 -3
  96. package/package-dist/scripts/lib/foundry-workflow-identity-stage.js +202 -161
  97. package/package-dist/scripts/lib/foundry-workflow-identity.js +16 -10
  98. package/package-dist/scripts/lib/foundry-workflow-io.js +27 -6
  99. package/package-dist/scripts/lib/foundry-workflow-reference-verify.js +102 -29
  100. package/package-dist/scripts/lib/foundry-workflow-repair.d.ts +5 -0
  101. package/package-dist/scripts/lib/foundry-workflow-repair.js +204 -2
  102. package/package-dist/scripts/lib/foundry-workflow-semantic.js +41 -21
  103. package/package-dist/scripts/lib/identity-preflight-proof.d.ts +1 -0
  104. package/package-dist/scripts/lib/identity-preflight-proof.js +19 -12
  105. package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +1 -1
  106. package/package-dist/scripts/public-api.d.ts +6 -0
  107. package/package-dist/scripts/runtime-entry.js +15 -6
  108. package/package.json +5 -2
  109. package/specs/schemas/foundry-interaction-draft.schema.json +323 -0
  110. package/specs/schemas/foundry-managed-runtime.schema.json +1 -1
  111. package/specs/schemas/foundry-operation-result.schema.json +1 -0
  112. package/specs/schemas/foundry-package-descriptor.schema.json +5 -2
  113. package/specs/schemas/foundry-scientific-repair.schema.json +66 -0
  114. package/specs/schemas/foundry-semantic-draft.schema.json +50 -0
  115. package/specs/schemas/foundry-task-start.schema.json +10 -2
  116. package/specs/schemas/runtime-qualification.schema.json +1 -1
@@ -245,10 +245,21 @@ export function validateIdentityPreflightExecution(input) {
245
245
  if (!authReceipt || !input.binding.account) {
246
246
  return failure("identity_preflight_auth_receipt_missing", "Identity-preflight execution requires account receipt evidence.");
247
247
  }
248
+ return {
249
+ ok: true,
250
+ report: diskReport,
251
+ manifest: createIdentityPreflightExecutionManifest(input.binding, input.diskReportText, input.completedAtUtc),
252
+ };
253
+ }
254
+ export function createIdentityPreflightExecutionManifest(binding, reportText, completedAtUtc) {
255
+ const report = exactRecord(JSON.parse(reportText), "Identity-preflight report");
256
+ const authReceipt = binding.inputs.authReceipt;
257
+ if (!authReceipt || !binding.account || !ALLOWED_REPORT_STATUSES.has(String(report.status)))
258
+ throw new Error("Identity-preflight report needs current account evidence and an accepted status.");
248
259
  const manifestScope = {
249
260
  schema: "tiangong-foundry.identity-preflight-execution.v1",
250
- binding_sha256: input.binding.binding_sha256,
251
- binding: bindingEvidence(input.binding),
261
+ binding_sha256: binding.binding_sha256,
262
+ binding: bindingEvidence(binding),
252
263
  producer_auth: {
253
264
  project_ref: authReceipt.project.project_ref,
254
265
  user_id: authReceipt.identity.user_id,
@@ -256,18 +267,14 @@ export function validateIdentityPreflightExecution(input) {
256
267
  captured_at_utc: authReceipt.captured_at_utc,
257
268
  },
258
269
  report: {
259
- bytes_sha256: sha256Text(input.diskReportText ?? ""),
260
- canonical_sha256: sha256Json(diskReport),
261
- status,
262
- decision: typeof diskReport.decision === "string" ? diskReport.decision : null,
270
+ bytes_sha256: sha256Text(reportText),
271
+ canonical_sha256: sha256Json(report),
272
+ status: String(report.status),
273
+ decision: typeof report.decision === "string" ? report.decision : null,
263
274
  },
264
- completed_at_utc: input.completedAtUtc,
265
- };
266
- return {
267
- ok: true,
268
- report: diskReport,
269
- manifest: { ...manifestScope, manifest_sha256: sha256Json(manifestScope) },
275
+ completed_at_utc: completedAtUtc,
270
276
  };
277
+ return { ...manifestScope, manifest_sha256: sha256Json(manifestScope) };
271
278
  }
272
279
  export function validateBoundExecutionManifest(value, binding, reportText) {
273
280
  if (!isRecord(value) || value.schema !== "tiangong-foundry.identity-preflight-execution.v1") {
@@ -6,7 +6,7 @@ import { asText, directoryExists, ensureArray, fileExists, readJson, readText, r
6
6
  function asJsonRecord(value) {
7
7
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
8
8
  }
9
- export const tidasSchemaSearchRoots = ["@tiangong-lca/cli@0.1.28/assets/tidas-schemas"];
9
+ export const tidasSchemaSearchRoots = ["@tiangong-lca/cli@0.4.0/assets/tidas-schemas"];
10
10
  export function tidasSchemaPath(repoRoot, schemaFile) {
11
11
  void repoRoot;
12
12
  const candidate = path.join(resolveInstalledTiangongLcaCliPackage().schemaDir, schemaFile);
@@ -57,6 +57,12 @@ export declare function createFoundryFacade(options: FoundryPackageFacadeOptions
57
57
  start(input: {
58
58
  specFile: string;
59
59
  }): Promise<import("./lib/foundry-operation-result.ts").FoundryOperationResult>;
60
+ prepareInput(input: {
61
+ taskId: string;
62
+ actorId: string;
63
+ kind: "interaction" | "semantic";
64
+ draftFile: string;
65
+ }): Promise<import("./lib/foundry-operation-result.ts").FoundryOperationResult>;
60
66
  status(input: {
61
67
  taskId: string;
62
68
  actorId: string;
@@ -34,7 +34,8 @@ function publicCommand(argv) {
34
34
  return { operation: "workspace.init", args: parseArgs(rest) };
35
35
  if (group === "workspace" && action === "migrate")
36
36
  return { operation: "workspace.migrate", args: parseArgs(rest) };
37
- if (group === "task" && ["start", "status", "resume", "adopt-runtime"].includes(action))
37
+ if (group === "task" &&
38
+ ["start", "status", "resume", "adopt-runtime", "prepare-input"].includes(action))
38
39
  return { operation: `task.${action}`, args: parseArgs(rest) };
39
40
  if (group === "workspace" || group === "task")
40
41
  return { operation: "unknown", args: parseArgs([action, ...rest].filter(Boolean)) };
@@ -131,9 +132,11 @@ async function runPublicCommand(parsed, host) {
131
132
  ]
132
133
  : parsed.operation === "task.adopt-runtime"
133
134
  ? ["task", "actor", "dryRun", "apply", "audit", "selection", "plan"]
134
- : parsed.operation === "task.status"
135
- ? ["task", "actor"]
136
- : []),
135
+ : parsed.operation === "task.prepare-input"
136
+ ? ["task", "actor", "kind", "input"]
137
+ : parsed.operation === "task.status"
138
+ ? ["task", "actor"]
139
+ : []),
137
140
  ]);
138
141
  const unknownOption = Object.keys(parsed.args).find((key) => !allowed.has(key));
139
142
  if (unknownOption)
@@ -302,8 +305,14 @@ async function runPublicCommand(parsed, host) {
302
305
  else {
303
306
  const actorId = option(parsed.args.actor, "--actor");
304
307
  if (!taskId || !actorId)
305
- return invalidResult(parsed.operation, taskId, "argument_task_actor_required", "Task status and resume require exact --task and --actor values.");
306
- if (parsed.operation === "task.adopt-runtime") {
308
+ return invalidResult(parsed.operation, taskId, "argument_task_actor_required", "Task operations require exact --task and --actor values.");
309
+ if (parsed.operation === "task.prepare-input") {
310
+ const kind = option(parsed.args.kind, "--kind"), draftFile = option(parsed.args.input, "--input");
311
+ if ((kind !== "interaction" && kind !== "semantic") || !draftFile)
312
+ return invalidResult(parsed.operation, taskId, "argument_input_draft_required", "Input preparation requires --kind interaction|semantic and one --input draft file.");
313
+ result = await facade.prepareInput({ taskId, actorId, kind, draftFile });
314
+ }
315
+ else if (parsed.operation === "task.adopt-runtime") {
307
316
  const modes = [parsed.args.dryRun, parsed.args.apply, parsed.args.audit];
308
317
  if (modes.filter((value) => value === true).length !== 1 ||
309
318
  modes.some((value) => value !== undefined && value !== true))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiangong-lca/foundry",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "type": "module",
5
5
  "description": "Control plane for TianGong LCA external dataset import and TIDAS authoring work.",
6
6
  "repository": {
@@ -41,6 +41,9 @@
41
41
  "specs/schemas/foundry-package-descriptor.schema.json",
42
42
  "specs/schemas/foundry-task-start.schema.json",
43
43
  "specs/schemas/foundry-semantic-input.schema.json",
44
+ "specs/schemas/foundry-semantic-draft.schema.json",
45
+ "specs/schemas/foundry-interaction-draft.schema.json",
46
+ "specs/schemas/foundry-scientific-repair.schema.json",
44
47
  "specs/schemas/foundry-interaction-input.schema.json",
45
48
  "specs/schemas/foundry-authorization-input.schema.json",
46
49
  "specs/schemas/foundry-reference-input.schema.json",
@@ -86,7 +89,7 @@
86
89
  },
87
90
  "license": "MIT",
88
91
  "dependencies": {
89
- "@tiangong-lca/cli": "0.1.28"
92
+ "@tiangong-lca/cli": "0.4.0"
90
93
  },
91
94
  "foundryRuntime": {
92
95
  "schema": "tiangong-foundry.runtime-layout.v2",
@@ -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
+ }
@@ -29,7 +29,7 @@
29
29
  "const": "tiangong-lca.cli-runtime-expectation.v1"
30
30
  },
31
31
  "package_version": {
32
- "const": "0.1.28"
32
+ "const": "0.4.0"
33
33
  },
34
34
  "platform": {
35
35
  "$ref": "#/$defs/platform"
@@ -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.18"
21
+ "const": "0.1.20"
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.28"
32
+ "const": "0.4.0"
33
33
  }
34
34
  }
35
35
  },
@@ -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
  }
@@ -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.28" },
17
+ "package_version": { "const": "0.4.0" },
18
18
  "platform": {
19
19
  "enum": ["linux-x64", "linux-arm64", "darwin-arm64", "win32-x64"]
20
20
  },