@tiangong-lca/foundry 0.1.10 → 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.
- package/README.md +6 -6
- package/docs/architecture.md +6 -6
- package/docs/foundry-task-contracts.md +9 -3
- package/docs/package-distribution-contract.md +6 -4
- package/docs/public-runtime-contract.md +17 -5
- package/docs/runtime-context-contract.md +5 -3
- package/docs/task-authorization-contract.md +5 -3
- package/package-dist/assets/foundry-package-descriptor.json +120 -64
- package/package-dist/scripts/foundry-facade.d.ts +1 -0
- package/package-dist/scripts/foundry-facade.js +165 -31
- package/package-dist/scripts/foundry-runtime.d.ts +2 -1
- package/package-dist/scripts/foundry-runtime.js +2 -2
- package/package-dist/scripts/lib/foundry-interaction-input.d.ts +19 -0
- package/package-dist/scripts/lib/foundry-interaction-input.js +327 -0
- package/package-dist/scripts/lib/foundry-interaction-projection.d.ts +22 -0
- package/package-dist/scripts/lib/foundry-interaction-projection.js +81 -0
- package/package-dist/scripts/lib/foundry-interaction-types.d.ts +17 -0
- package/package-dist/scripts/lib/foundry-interaction-types.js +4 -0
- package/package-dist/scripts/lib/foundry-owner-execution-store.js +34 -2
- package/package-dist/scripts/lib/foundry-package-contract.d.ts +3 -3
- package/package-dist/scripts/lib/foundry-package-contract.js +3 -1
- package/package-dist/scripts/lib/foundry-semantic-input.d.ts +2 -0
- package/package-dist/scripts/lib/foundry-semantic-input.js +29 -2
- package/package-dist/scripts/lib/foundry-semantic-interaction.d.ts +12 -0
- package/package-dist/scripts/lib/foundry-semantic-interaction.js +38 -0
- package/package-dist/scripts/lib/foundry-task-start-spec.d.ts +11 -0
- package/package-dist/scripts/lib/foundry-task-start-spec.js +36 -0
- package/package-dist/scripts/lib/foundry-task-store.d.ts +1 -1
- package/package-dist/scripts/lib/foundry-workflow-assessment.d.ts +7 -1
- package/package-dist/scripts/lib/foundry-workflow-assessment.js +127 -6
- package/package-dist/scripts/lib/foundry-workflow-finalize.js +7 -4
- package/package-dist/scripts/lib/foundry-workflow-interaction.d.ts +4 -0
- package/package-dist/scripts/lib/foundry-workflow-interaction.js +63 -0
- package/package-dist/scripts/lib/foundry-workflow-semantic.js +21 -1
- package/package-dist/scripts/lib/foundry-workflow-state.d.ts +9 -1
- package/package-dist/scripts/lib/foundry-workflow-state.js +173 -21
- package/package-dist/scripts/public-api.d.ts +2 -0
- package/package-dist/scripts/public-api.js +1 -0
- package/package-dist/scripts/runtime-entry.js +9 -1
- package/package.json +2 -1
- package/specs/schemas/foundry-interaction-input.schema.json +173 -0
- package/specs/schemas/foundry-package-descriptor.schema.json +2 -1
- package/specs/schemas/foundry-semantic-input.schema.json +12 -1
- package/specs/schemas/foundry-task-start.schema.json +75 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import { FoundryContextError, resolveFoundryOutput, } from "./foundry-runtime-context.js";
|
|
4
|
+
import { captureFoundryInput, FoundryContextError, resolveFoundryOutput, } from "./foundry-runtime-context.js";
|
|
5
5
|
import { readTaskBytes } from "./foundry-task-io.js";
|
|
6
|
+
import { sha256Json } from "./identity-preflight-proof.js";
|
|
7
|
+
import { applicableFoundryInteractionDigest } from "./foundry-interaction-projection.js";
|
|
6
8
|
/**
|
|
7
9
|
* The repair producer's registration of the preparation report. These two values are repeated here
|
|
8
10
|
* rather than imported so this projection module stays a graph leaf; the public repair suite fails
|
|
@@ -11,6 +13,28 @@ import { readTaskBytes } from "./foundry-task-io.js";
|
|
|
11
13
|
const FOUNDRY_REPAIR_PREFLIGHT_COMMAND = "dataset-workflow-repair-preflight";
|
|
12
14
|
const FOUNDRY_REPAIR_REPORT_NAME = "foundry-repair-preflight.json";
|
|
13
15
|
const FOUNDRY_REPAIR_PREPARATION_SCHEMA = "tiangong-foundry.repair-preparation.v1";
|
|
16
|
+
const queueTypes = new Set(["process", "flow", "contact", "source", "unitgroup", "flowproperty"]);
|
|
17
|
+
export function workflowAssessmentQueueScopeSha256(sets) {
|
|
18
|
+
if (!sets.some((set) => set.type === "process"))
|
|
19
|
+
return null;
|
|
20
|
+
return sha256Json(sets
|
|
21
|
+
.filter((set) => queueTypes.has(set.type))
|
|
22
|
+
.map((set) => {
|
|
23
|
+
const fact = captureFoundryInput(set.file);
|
|
24
|
+
return { type: set.type, path: set.file, bytes: fact.bytes, sha256: fact.sha256 };
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
function registeredAssessmentFile(context, entries, file) {
|
|
28
|
+
if (typeof file !== "string")
|
|
29
|
+
return false;
|
|
30
|
+
const entry = entries.find((candidate) => resolveFoundryOutput(context, candidate.path) === file);
|
|
31
|
+
if (!entry)
|
|
32
|
+
return false;
|
|
33
|
+
const fact = captureFoundryInput(file);
|
|
34
|
+
if (fact.bytes !== entry.bytes || fact.sha256 !== entry.sha256)
|
|
35
|
+
throw new FoundryContextError("workflow_assessment_changed", "A registered assessment input or report changed.");
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
14
38
|
export function workflowObject(value) {
|
|
15
39
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
16
40
|
throw new FoundryContextError("workflow_report_invalid", "Workflow metadata must be an object.");
|
|
@@ -85,6 +109,29 @@ export function currentWorkflowState(context, entries) {
|
|
|
85
109
|
}
|
|
86
110
|
}
|
|
87
111
|
}
|
|
112
|
+
const interactionEntry = entries.findLast((entry) => entry.command === "dataset-workflow-interaction" &&
|
|
113
|
+
path.basename(entry.path) === "interaction-state.json");
|
|
114
|
+
const interactionSha256 = interactionEntry?.sha256 ?? null;
|
|
115
|
+
const interactionValue = interactionEntry
|
|
116
|
+
? readWorkflowArtifact(context, interactionEntry).value
|
|
117
|
+
: null;
|
|
118
|
+
if (interactionValue &&
|
|
119
|
+
(interactionValue.schema !== "tiangong-foundry.interaction-state.v1" ||
|
|
120
|
+
interactionValue.task_id !== context.taskId ||
|
|
121
|
+
interactionValue.actor_id !== context.actorId ||
|
|
122
|
+
!Array.isArray(interactionValue.events)))
|
|
123
|
+
throw new FoundryContextError("workflow_interaction_invalid", "Registered task decisions are invalid.");
|
|
124
|
+
const interaction = interactionValue;
|
|
125
|
+
const contextShaByType = new Map();
|
|
126
|
+
for (const entry of entries) {
|
|
127
|
+
if (entry.command !== "dataset-context-pack" ||
|
|
128
|
+
path.basename(entry.path) !== "contract-report.json")
|
|
129
|
+
continue;
|
|
130
|
+
const report = readWorkflowArtifact(context, entry).value;
|
|
131
|
+
if (report.status === "completed" && typeof report.type === "string")
|
|
132
|
+
contextShaByType.set(report.type, entry.sha256);
|
|
133
|
+
}
|
|
134
|
+
const queueScopeSha256 = rows ? workflowAssessmentQueueScopeSha256(rows.value.sets) : null;
|
|
88
135
|
let assessment = null;
|
|
89
136
|
if (rows) {
|
|
90
137
|
for (const entry of [...entries].reverse()) {
|
|
@@ -93,31 +140,133 @@ export function currentWorkflowState(context, entries) {
|
|
|
93
140
|
continue;
|
|
94
141
|
const found = readWorkflowArtifact(context, entry), value = found.value;
|
|
95
142
|
if (value.schema !== "tiangong-foundry.assessment-stage.v1" ||
|
|
96
|
-
|
|
143
|
+
value.owner_base !== context.assetRoot ||
|
|
144
|
+
!["in_progress", "completed"].includes(String(value.status)) ||
|
|
97
145
|
!Array.isArray(value.sets))
|
|
98
146
|
throw new FoundryContextError("workflow_assessment_invalid", "Registered assessment metadata is invalid.");
|
|
99
147
|
const sets = value.sets.map(workflowObject);
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
148
|
+
const reportRowsEntry = entries.find((candidate) => ["dataset-workflow-rows", "dataset-semantic-apply"].includes(candidate.command) &&
|
|
149
|
+
path.basename(candidate.path) === "foundry-rows.json" &&
|
|
150
|
+
resolveFoundryOutput(context, candidate.path) === value.rows_report);
|
|
151
|
+
const reportRows = reportRowsEntry
|
|
152
|
+
? readWorkflowArtifact(context, reportRowsEntry).value
|
|
153
|
+
: value.rows_report === undefined
|
|
154
|
+
? rows.value
|
|
155
|
+
: null;
|
|
156
|
+
if (!reportRows || !Array.isArray(reportRows.sets))
|
|
157
|
+
throw new FoundryContextError("workflow_assessment_invalid", "Assessment row ancestry is not registered.");
|
|
158
|
+
// An empty reference-only row revision needs its own assessment receipt. There are
|
|
159
|
+
// no per-type set facts to reuse from a predecessor with different rows.
|
|
160
|
+
if (!rows.value.sets.length && value.rows_report !== rows.file)
|
|
161
|
+
continue;
|
|
162
|
+
const originalRows = reportRows.sets.map(workflowObject);
|
|
163
|
+
let lastOriginal = -1;
|
|
164
|
+
for (const set of sets) {
|
|
165
|
+
const next = originalRows.findIndex((row, index) => index > lastOriginal && row.type === set.type && row.file === set.rows);
|
|
166
|
+
if (next < 0)
|
|
167
|
+
throw new FoundryContextError("workflow_assessment_invalid", "Assessment contains an unbound or duplicate row set.");
|
|
168
|
+
lastOriginal = next;
|
|
169
|
+
}
|
|
170
|
+
if ((value.status === "completed") !== (sets.length === originalRows.length))
|
|
171
|
+
throw new FoundryContextError("workflow_assessment_invalid", "Assessment completion must match its registered row-set coverage.");
|
|
172
|
+
if (value.previous_assessment !== undefined) {
|
|
173
|
+
const previousPath = value.previous_assessment;
|
|
174
|
+
const previousSha = value.previous_assessment_sha256;
|
|
175
|
+
const previousEntry = typeof previousPath === "string"
|
|
176
|
+
? entries.find((candidate) => candidate.command === "dataset-workflow-assessment" &&
|
|
177
|
+
candidate.sequence < entry.sequence &&
|
|
178
|
+
resolveFoundryOutput(context, candidate.path) === previousPath &&
|
|
179
|
+
candidate.sha256 === previousSha)
|
|
180
|
+
: undefined;
|
|
181
|
+
if ((previousPath === null && previousSha !== null) ||
|
|
182
|
+
(typeof previousPath === "string" && !previousEntry) ||
|
|
183
|
+
(previousPath !== null && typeof previousPath !== "string") ||
|
|
184
|
+
(previousPath === null && (sets.length !== 1 || value.assessed_type !== sets[0]?.type)))
|
|
185
|
+
throw new FoundryContextError("workflow_assessment_invalid", "Assessment progress has no matching registered predecessor.");
|
|
186
|
+
if (previousEntry) {
|
|
187
|
+
const prior = readWorkflowArtifact(context, previousEntry).value;
|
|
188
|
+
const priorSets = Array.isArray(prior.sets) ? prior.sets.map(workflowObject) : null;
|
|
189
|
+
if (prior.schema !== "tiangong-foundry.assessment-stage.v1" ||
|
|
190
|
+
!priorSets ||
|
|
191
|
+
typeof value.assessed_type !== "string" ||
|
|
192
|
+
!sets.some((set) => set.type === value.assessed_type) ||
|
|
193
|
+
sets.some((set) => set.type !== value.assessed_type &&
|
|
194
|
+
!priorSets.some((old) => sha256Json(old) === sha256Json(set))))
|
|
195
|
+
throw new FoundryContextError("workflow_assessment_invalid", "Assessment retained a set outside its registered predecessor.");
|
|
196
|
+
}
|
|
118
197
|
}
|
|
198
|
+
else if (value.status === "in_progress") {
|
|
199
|
+
throw new FoundryContextError("workflow_assessment_invalid", "Partial assessment must identify its predecessor boundary.");
|
|
200
|
+
}
|
|
201
|
+
const identityMatches = (value.identity_report ?? null) ===
|
|
202
|
+
(identity?.value.status === "completed" ? identity.file : null);
|
|
203
|
+
const currentSets = identityMatches
|
|
204
|
+
? sets.filter((set) => {
|
|
205
|
+
const row = rows.value.sets.find((candidate) => candidate.type === set.type);
|
|
206
|
+
if (!row || row.file !== set.rows)
|
|
207
|
+
return false;
|
|
208
|
+
if ((set.interaction_digest ?? null) !==
|
|
209
|
+
applicableFoundryInteractionDigest(interaction, row.type))
|
|
210
|
+
return false;
|
|
211
|
+
const expectedContext = contextShaByType.get(row.type);
|
|
212
|
+
if ((set.context_report_sha256 !== undefined &&
|
|
213
|
+
set.context_report_sha256 !== expectedContext) ||
|
|
214
|
+
(set.context_report_sha256 === undefined && value.rows_report !== rows.file))
|
|
215
|
+
return false;
|
|
216
|
+
if (["flow", "process"].includes(row.type)) {
|
|
217
|
+
if ((set.queue_scope_sha256 !== undefined &&
|
|
218
|
+
set.queue_scope_sha256 !== queueScopeSha256) ||
|
|
219
|
+
(set.queue_scope_sha256 === undefined &&
|
|
220
|
+
queueScopeSha256 !== null &&
|
|
221
|
+
value.rows_report !== rows.file))
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
const files = [
|
|
225
|
+
set.rows,
|
|
226
|
+
set.schema_report,
|
|
227
|
+
set.qa_report,
|
|
228
|
+
set.curation_report,
|
|
229
|
+
set.authoring_manifest,
|
|
230
|
+
];
|
|
231
|
+
if (set.interaction_context !== undefined)
|
|
232
|
+
files.push(set.interaction_context);
|
|
233
|
+
if (files.some((file) => !registeredAssessmentFile(context, entries, file)))
|
|
234
|
+
throw new FoundryContextError("workflow_assessment_invalid", "A reusable assessment file is not registered.");
|
|
235
|
+
return true;
|
|
236
|
+
})
|
|
237
|
+
: [];
|
|
238
|
+
const covered = new Set(currentSets.map((set) => set.type));
|
|
239
|
+
assessment = {
|
|
240
|
+
...found,
|
|
241
|
+
value: {
|
|
242
|
+
schema: "tiangong-foundry.assessment-stage.v1",
|
|
243
|
+
status: covered.size === rows.value.sets.length ? "completed" : "in_progress",
|
|
244
|
+
owner_base: value.owner_base,
|
|
245
|
+
rows_report: rows.file,
|
|
246
|
+
identity_report: identity?.value.status === "completed" ? identity.file : null,
|
|
247
|
+
...(value.previous_assessment !== undefined
|
|
248
|
+
? {
|
|
249
|
+
previous_assessment: value.previous_assessment,
|
|
250
|
+
previous_assessment_sha256: value.previous_assessment_sha256,
|
|
251
|
+
}
|
|
252
|
+
: {}),
|
|
253
|
+
...(typeof value.interaction_sha256 === "string"
|
|
254
|
+
? { interaction_sha256: value.interaction_sha256 }
|
|
255
|
+
: {}),
|
|
256
|
+
...(typeof value.assessed_type === "string"
|
|
257
|
+
? { assessed_type: value.assessed_type }
|
|
258
|
+
: {}),
|
|
259
|
+
sets: currentSets,
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
break;
|
|
119
263
|
}
|
|
120
264
|
}
|
|
265
|
+
const assessmentComplete = assessment?.value.status === "completed";
|
|
266
|
+
const coveredTypes = new Set(assessment?.value.sets.map((set) => set.type) ?? []);
|
|
267
|
+
const assessmentRemainingTypes = rows
|
|
268
|
+
? rows.value.sets.filter((set) => !coveredTypes.has(set.type)).map((set) => set.type)
|
|
269
|
+
: [];
|
|
121
270
|
const referenceInputs = new Map();
|
|
122
271
|
for (const entry of entries) {
|
|
123
272
|
if (entry.command !== "dataset-workflow-reference-input" ||
|
|
@@ -138,7 +287,7 @@ export function currentWorkflowState(context, entries) {
|
|
|
138
287
|
.digest("hex")
|
|
139
288
|
: null;
|
|
140
289
|
let finalization = null;
|
|
141
|
-
if (rows && assessment) {
|
|
290
|
+
if (rows && assessmentComplete && assessment) {
|
|
142
291
|
for (const entry of [...entries].reverse()) {
|
|
143
292
|
if (entry.command !== "dataset-workflow-finalize" ||
|
|
144
293
|
path.basename(entry.path) !== "foundry-finalize.json")
|
|
@@ -225,6 +374,9 @@ export function currentWorkflowState(context, entries) {
|
|
|
225
374
|
return {
|
|
226
375
|
rows,
|
|
227
376
|
assessment,
|
|
377
|
+
assessmentComplete,
|
|
378
|
+
assessmentRemainingTypes,
|
|
379
|
+
interactionSha256,
|
|
228
380
|
identity,
|
|
229
381
|
finalization,
|
|
230
382
|
authorization,
|
|
@@ -11,6 +11,7 @@ export type { FoundryFacadeRuntimeSelection } from "./foundry-facade.ts";
|
|
|
11
11
|
export { FOUNDRY_AUTHORIZATION_INPUT_SCHEMA, type FoundryAuthorizationInput, } from "./lib/foundry-authorization-input.ts";
|
|
12
12
|
export type { FoundryAuthentication, FoundryPublicOAuthConfiguration, } from "./lib/foundry-runtime-identity.ts";
|
|
13
13
|
export { FOUNDRY_SEMANTIC_INPUT_SCHEMA, type FoundrySemanticInput, type SemanticPatchInput, type SemanticDecisionInput, type SemanticSubmission, } from "./lib/foundry-semantic-input.ts";
|
|
14
|
+
export { FOUNDRY_INTERACTION_INPUT_SCHEMA, FOUNDRY_INTERACTION_STATE_SCHEMA, type FoundryInteractionInput, type FoundryInteractionState, } from "./lib/foundry-interaction-input.ts";
|
|
14
15
|
export type { FoundryWorkspaceAccess } from "./lib/foundry-runtime-context.ts";
|
|
15
16
|
export { FOUNDRY_RUNTIME_SELECTION_SCHEMA, type FoundryRuntimeSelectionRecord, } from "./lib/foundry-runtime-selection-record.ts";
|
|
16
17
|
export type { FoundryRuntimeManagerOptions } from "./lib/foundry-runtime-selection.ts";
|
|
@@ -62,6 +63,7 @@ export declare function createFoundryFacade(options: FoundryPackageFacadeOptions
|
|
|
62
63
|
taskId: string;
|
|
63
64
|
actorId: string;
|
|
64
65
|
semanticInputFile?: string;
|
|
66
|
+
interactionInputFile?: string;
|
|
65
67
|
authorizationInputFile?: string;
|
|
66
68
|
referenceInputFile?: string;
|
|
67
69
|
}): Promise<import("./lib/foundry-operation-result.ts").FoundryOperationResult>;
|
|
@@ -12,6 +12,7 @@ export function createFoundryWorkspaceAccess(input) {
|
|
|
12
12
|
}
|
|
13
13
|
export { FOUNDRY_AUTHORIZATION_INPUT_SCHEMA, } from "./lib/foundry-authorization-input.js";
|
|
14
14
|
export { FOUNDRY_SEMANTIC_INPUT_SCHEMA, } from "./lib/foundry-semantic-input.js";
|
|
15
|
+
export { FOUNDRY_INTERACTION_INPUT_SCHEMA, FOUNDRY_INTERACTION_STATE_SCHEMA, } from "./lib/foundry-interaction-input.js";
|
|
15
16
|
export { FOUNDRY_RUNTIME_SELECTION_SCHEMA, } from "./lib/foundry-runtime-selection-record.js";
|
|
16
17
|
/** Public host factory with package/source identity bound by this module, never caller input. */
|
|
17
18
|
export function createFoundryFacade(options) {
|
|
@@ -119,7 +119,14 @@ async function runPublicCommand(parsed, host) {
|
|
|
119
119
|
: parsed.operation === "task.start"
|
|
120
120
|
? ["spec"]
|
|
121
121
|
: parsed.operation === "task.resume"
|
|
122
|
-
? [
|
|
122
|
+
? [
|
|
123
|
+
"task",
|
|
124
|
+
"actor",
|
|
125
|
+
"semanticInput",
|
|
126
|
+
"authorizationInput",
|
|
127
|
+
"referenceInput",
|
|
128
|
+
"interactionInput",
|
|
129
|
+
]
|
|
123
130
|
: parsed.operation === "task.status"
|
|
124
131
|
? ["task", "actor"]
|
|
125
132
|
: []),
|
|
@@ -298,6 +305,7 @@ async function runPublicCommand(parsed, host) {
|
|
|
298
305
|
taskId,
|
|
299
306
|
actorId,
|
|
300
307
|
semanticInputFile: option(parsed.args.semanticInput, "--semantic-input") ?? undefined,
|
|
308
|
+
interactionInputFile: option(parsed.args.interactionInput, "--interaction-input") ?? undefined,
|
|
301
309
|
referenceInputFile: option(parsed.args.referenceInput, "--reference-input") ?? undefined,
|
|
302
310
|
authorizationInputFile: option(parsed.args.authorizationInput, "--authorization-input") ?? undefined,
|
|
303
311
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiangong-lca/foundry",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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,7 @@
|
|
|
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-interaction-input.schema.json",
|
|
44
45
|
"specs/schemas/foundry-authorization-input.schema.json",
|
|
45
46
|
"specs/schemas/foundry-reference-input.schema.json",
|
|
46
47
|
"specs/schemas/foundry-workspace-migration-plan.schema.json",
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://tiangong-lca.local/foundry/interaction-input.schema.json",
|
|
4
|
+
"title": "Foundry task interaction input v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schema", "task_id", "actor_id", "expected_state_sha256", "events"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schema": { "const": "tiangong-foundry.interaction-input.v1" },
|
|
10
|
+
"task_id": { "type": "string", "pattern": "^task-[0-9a-f]{64}-r[0-9]{4}$" },
|
|
11
|
+
"actor_id": { "$ref": "#/$defs/id" },
|
|
12
|
+
"expected_state_sha256": {
|
|
13
|
+
"oneOf": [{ "$ref": "#/$defs/sha" }, { "type": "null" }]
|
|
14
|
+
},
|
|
15
|
+
"events": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"minItems": 1,
|
|
18
|
+
"maxItems": 16,
|
|
19
|
+
"items": {
|
|
20
|
+
"oneOf": [
|
|
21
|
+
{ "$ref": "#/$defs/question" },
|
|
22
|
+
{ "$ref": "#/$defs/answer" },
|
|
23
|
+
{ "$ref": "#/$defs/assumption" }
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"$defs": {
|
|
29
|
+
"id": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 1,
|
|
32
|
+
"maxLength": 256,
|
|
33
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
|
|
34
|
+
},
|
|
35
|
+
"sha": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
|
|
36
|
+
"text": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"minLength": 1,
|
|
39
|
+
"maxLength": 4096,
|
|
40
|
+
"pattern": "^[^\\u0000\\r\\n]+$"
|
|
41
|
+
},
|
|
42
|
+
"shortText": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1,
|
|
45
|
+
"maxLength": 1200,
|
|
46
|
+
"pattern": "^[^\\u0000\\r\\n]+$"
|
|
47
|
+
},
|
|
48
|
+
"scope": {
|
|
49
|
+
"oneOf": [
|
|
50
|
+
{ "type": "null" },
|
|
51
|
+
{
|
|
52
|
+
"enum": [
|
|
53
|
+
"contact",
|
|
54
|
+
"source",
|
|
55
|
+
"support",
|
|
56
|
+
"flow",
|
|
57
|
+
"flowproperty",
|
|
58
|
+
"unitgroup",
|
|
59
|
+
"process",
|
|
60
|
+
"lifecyclemodel"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"evidence": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"maxItems": 16,
|
|
68
|
+
"uniqueItems": true,
|
|
69
|
+
"items": { "$ref": "#/$defs/sha" }
|
|
70
|
+
},
|
|
71
|
+
"question": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"required": [
|
|
75
|
+
"kind",
|
|
76
|
+
"id",
|
|
77
|
+
"dataset_type",
|
|
78
|
+
"missing",
|
|
79
|
+
"impact",
|
|
80
|
+
"recommendation",
|
|
81
|
+
"ask",
|
|
82
|
+
"choices",
|
|
83
|
+
"evidence_sha256",
|
|
84
|
+
"supersedes"
|
|
85
|
+
],
|
|
86
|
+
"properties": {
|
|
87
|
+
"kind": { "const": "question" },
|
|
88
|
+
"id": { "$ref": "#/$defs/id" },
|
|
89
|
+
"dataset_type": { "$ref": "#/$defs/scope" },
|
|
90
|
+
"missing": { "$ref": "#/$defs/shortText" },
|
|
91
|
+
"impact": { "$ref": "#/$defs/shortText" },
|
|
92
|
+
"recommendation": { "$ref": "#/$defs/shortText" },
|
|
93
|
+
"ask": { "$ref": "#/$defs/shortText" },
|
|
94
|
+
"choices": {
|
|
95
|
+
"type": "array",
|
|
96
|
+
"maxItems": 4,
|
|
97
|
+
"uniqueItems": true,
|
|
98
|
+
"items": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"minLength": 1,
|
|
101
|
+
"maxLength": 240,
|
|
102
|
+
"pattern": "^[^\\u0000\\r\\n]+$"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"evidence_sha256": { "$ref": "#/$defs/evidence" },
|
|
106
|
+
"supersedes": { "oneOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }] }
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"answer": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"additionalProperties": false,
|
|
112
|
+
"required": [
|
|
113
|
+
"kind",
|
|
114
|
+
"question_id",
|
|
115
|
+
"decision_id",
|
|
116
|
+
"supersedes_decision_id",
|
|
117
|
+
"raw_answer",
|
|
118
|
+
"adopted_decision",
|
|
119
|
+
"disposition",
|
|
120
|
+
"evidence_sha256"
|
|
121
|
+
],
|
|
122
|
+
"properties": {
|
|
123
|
+
"kind": { "const": "answer" },
|
|
124
|
+
"question_id": { "$ref": "#/$defs/id" },
|
|
125
|
+
"decision_id": { "$ref": "#/$defs/id" },
|
|
126
|
+
"supersedes_decision_id": {
|
|
127
|
+
"oneOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }]
|
|
128
|
+
},
|
|
129
|
+
"raw_answer": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"minLength": 1,
|
|
132
|
+
"maxLength": 16384,
|
|
133
|
+
"pattern": "^[^\\u0000]+$"
|
|
134
|
+
},
|
|
135
|
+
"adopted_decision": { "oneOf": [{ "$ref": "#/$defs/text" }, { "type": "null" }] },
|
|
136
|
+
"disposition": { "enum": ["decided", "investigate"] },
|
|
137
|
+
"evidence_sha256": { "$ref": "#/$defs/evidence" }
|
|
138
|
+
},
|
|
139
|
+
"allOf": [
|
|
140
|
+
{
|
|
141
|
+
"if": {
|
|
142
|
+
"properties": { "disposition": { "const": "investigate" } },
|
|
143
|
+
"required": ["disposition"]
|
|
144
|
+
},
|
|
145
|
+
"then": { "properties": { "adopted_decision": { "type": "null" } } },
|
|
146
|
+
"else": { "properties": { "adopted_decision": { "$ref": "#/$defs/text" } } }
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"assumption": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"additionalProperties": false,
|
|
153
|
+
"required": [
|
|
154
|
+
"kind",
|
|
155
|
+
"id",
|
|
156
|
+
"dataset_type",
|
|
157
|
+
"statement",
|
|
158
|
+
"impact",
|
|
159
|
+
"evidence_sha256",
|
|
160
|
+
"supersedes"
|
|
161
|
+
],
|
|
162
|
+
"properties": {
|
|
163
|
+
"kind": { "const": "assumption" },
|
|
164
|
+
"id": { "$ref": "#/$defs/id" },
|
|
165
|
+
"dataset_type": { "$ref": "#/$defs/scope" },
|
|
166
|
+
"statement": { "$ref": "#/$defs/text" },
|
|
167
|
+
"impact": { "$ref": "#/$defs/text" },
|
|
168
|
+
"evidence_sha256": { "$ref": "#/$defs/evidence" },
|
|
169
|
+
"supersedes": { "oneOf": [{ "$ref": "#/$defs/id" }, { "type": "null" }] }
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"const": "@tiangong-lca/foundry"
|
|
19
19
|
},
|
|
20
20
|
"version": {
|
|
21
|
-
"const": "0.1.
|
|
21
|
+
"const": "0.1.11"
|
|
22
22
|
},
|
|
23
23
|
"cli_dependency": {
|
|
24
24
|
"type": "object",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"tiangong-foundry.operation-result.v1",
|
|
74
74
|
"tiangong-foundry.task-start.v1",
|
|
75
75
|
"tiangong-foundry.semantic-input.v1",
|
|
76
|
+
"tiangong-foundry.interaction-input.v1",
|
|
76
77
|
"tiangong-foundry.authorization-input.v1",
|
|
77
78
|
"tiangong-foundry.reference-input.v1",
|
|
78
79
|
"tiangong-foundry.facade-request-index.v1",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"task_id": { "type": "string", "pattern": "^task-[0-9a-f]{64}-r[0-9]{4}$" },
|
|
11
11
|
"actor_id": { "type": "string", "maxLength": 256, "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$" },
|
|
12
12
|
"assessment_sha256": { "$ref": "#/$defs/sha" },
|
|
13
|
+
"interaction_sha256": { "$ref": "#/$defs/sha" },
|
|
13
14
|
"submissions": {
|
|
14
15
|
"type": "array",
|
|
15
16
|
"minItems": 1,
|
|
@@ -27,7 +28,17 @@
|
|
|
27
28
|
"maxLength": 4096,
|
|
28
29
|
"pattern": "^[^\\u0000\\r\\n]+$"
|
|
29
30
|
},
|
|
30
|
-
"sha256": { "$ref": "#/$defs/sha" }
|
|
31
|
+
"sha256": { "$ref": "#/$defs/sha" },
|
|
32
|
+
"decision_ids": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"maxItems": 100,
|
|
35
|
+
"uniqueItems": true,
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"maxLength": 256,
|
|
39
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:/-]*$"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
31
42
|
}
|
|
32
43
|
}
|
|
33
44
|
}
|
|
@@ -92,6 +92,9 @@
|
|
|
92
92
|
}
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
|
+
"brief": {
|
|
96
|
+
"$ref": "#/$defs/taskBrief"
|
|
97
|
+
},
|
|
95
98
|
"repair": {
|
|
96
99
|
"oneOf": [
|
|
97
100
|
{
|
|
@@ -162,6 +165,78 @@
|
|
|
162
165
|
}
|
|
163
166
|
],
|
|
164
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
|
+
},
|
|
165
240
|
"id": {
|
|
166
241
|
"type": "string",
|
|
167
242
|
"minLength": 1,
|