@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
@@ -2,7 +2,6 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { datasetTypePlural, supportedDatasetTypes } from "./dataset-types.js";
4
4
  import { sha256Text } from "./hash-utils.js";
5
- import { annualSupplyMissingDataSentinelText } from "./prewrite-cleanup.js";
6
5
  import { asText, ensureArray, fileExists, jsonLines, nowIso, readJson, readText, repoRelativePath, resolveRepoPath, sanitizeFileName, unique, writeJson, writeText, } from "./runtime-io.js";
7
6
  import { buildPatchTemplate, contextSummaryHasKind, contextSummaryHasNonEmptyPayload, contextSummaryHasPattern, decisionOnlyActionItems, fullContextAiConfigRequiresAuthoring, markdownList, packageContextFileSummary, patchAuthoringActionItems, relOrNull, requiredFullContextFilePatterns, requiredFullContextKinds, sharedContextBundleReadinessBlockers, } from "./workflow-semantic-actions.js";
8
7
  function isRecord(value) {
@@ -245,7 +244,7 @@ The patch must:
245
244
  - preserve source-language content and provide evidence-backed English for fields required by the current TIDAS/profile contract; keep the same factual meaning
246
245
  - do not use \`common:other\` as a substitute for mandatory schema fields; schema-required values need evidence-backed values or must remain blocked
247
246
  - if a value cannot be inferred safely and the action item's allowed modes include \`deferred_to_common_other\`, add \`common:other.tiangongfoundry:unresolvedTrace\` with \`status\`, \`action_item_code\`, \`blocked_path\`, \`reason\`, structured \`evidence\`, and \`next_action\`; evidence must include source plus quote/trace/path/citation pointer
248
- - do not defer \`annualSupplyOrProductionVolume\` to \`common:other\`; if source annual volume evidence is missing, Foundry deterministic cleanup writes \`${annualSupplyMissingDataSentinelText}\` into the required field for later database-side curation
247
+ - do not defer \`annualSupplyOrProductionVolume\` to \`common:other\` and never invent a quantity from a reference flow or a default unit; supply a real annualized quantity from source evidence, or leave the field to Foundry deterministic cleanup, which normalizes it to the supported empty array and records a row-level evidence gap
249
248
  - if source exchange completeness is being accepted as source-faithful, use \`resolution.mode=source_trace_verified\` and add \`common:other.tiangongfoundry:sourceExchangeCompleteness\` with accepted \`status\` and structured source trace evidence; evidence must include source plus quote/trace/path/citation pointer
250
249
 
251
250
  ## Deterministic Apply
@@ -1,5 +1,4 @@
1
1
  import path from "node:path";
2
- import { annualSupplyMissingDataSentinelText } from "./prewrite-cleanup.js";
3
2
  import { asText, ensureArray, fileExists, optionList, readJson, readRows, readText, repoRelativePath, resolveRepoPath, unique, } from "./runtime-io.js";
4
3
  import { operationFullContextEvidenceBlockers, operationHasEvidence, operationResolution, operationResolutionMode, operationTouchesCommonOther, operationUsedContextKinds, patchSetAuthoringPackage, patchSetDatasetId, patchSetDatasetVersion, patchSetOperations, taskRequiredContextKinds, taskRequiresFullContextEvidence, } from "./workflow-authoring-tasks.js";
5
4
  import { containsAiTemplatePlaceholder, operationClosesAnnualSupplyTarget, operationClosureCodes, operationClosureKeys, operationTargetsLocationCode, taskActionItemKeys, taskActionItemsForOperation, taskAuthoringPackageName, validateDeferredCommonOtherTrace, validateFlowClassificationDecisionOperation, validateLocationDecisionOperation, validateProcessClassificationDecisionOperation, validateSourceExchangeCompletenessTrace, } from "./workflow-patch-evidence.js";
@@ -30,8 +29,8 @@ export function validateCollectedPatchSet({ repoRoot, task, patchSet, patchSetIn
30
29
  if (deferredAnnualSupply) {
31
30
  blockers.push({
32
31
  code: "patch_deferred_annual_supply_not_allowed",
33
- message: "annualSupplyOrProductionVolume is schema-required and must not be deferred to common:other; use Foundry deterministic cleanup to write the searchable 9999 missing-data sentinel when source evidence is missing.",
34
- sentinel_value: annualSupplyMissingDataSentinelText,
32
+ message: "annualSupplyOrProductionVolume is schema-required and must not be deferred to common:other; supply a real annualized quantity from source evidence, or let Foundry deterministic cleanup normalize the field to the supported empty array and record a row-level evidence gap.",
33
+ normalized_unknown_value: [],
35
34
  patch_file: patchLocation,
36
35
  patch_set_index: patchSetIndex,
37
36
  entity,
@@ -1,7 +1,7 @@
1
1
  import path from "node:path";
2
2
  import { resolveArtifactPath } from "./artifact-inputs.js";
3
3
  import { identityKey, detectDatasetType, unwrapDatasetPayload } from "./dataset-payload.js";
4
- import { annualSupplyMissingDataSentinelText } from "./prewrite-cleanup.js";
4
+ import { annualSupplyFieldPath as canonicalAnnualSupplyFieldPath, legacyAnnualSupplyMissingDataSentinelText, } from "./prewrite-cleanup.js";
5
5
  import { asText, directoryExists, ensureArray, fileExists, readJson, readJsonIfExists, readRows, repoRelativePath, resolveRepoPath, } from "./runtime-io.js";
6
6
  function isRecord(value) {
7
7
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -10,7 +10,7 @@ function isQueueTask(value) {
10
10
  return Boolean(value) && typeof value === "object";
11
11
  }
12
12
  // part-00.mjs
13
- export const annualSupplyFieldPath = "processDataSet.modellingAndValidation.dataSourcesTreatmentAndRepresentativeness.annualSupplyOrProductionVolume";
13
+ export const annualSupplyFieldPath = canonicalAnnualSupplyFieldPath;
14
14
  export function isAnnualSupplyTarget(code, itemPath) {
15
15
  return (asText(code).startsWith("annual_supply_or_production_volume") ||
16
16
  asText(itemPath).includes("annualSupplyOrProductionVolume"));
@@ -24,7 +24,7 @@ export function schemaIssueInstruction(issue) {
24
24
  const code = String(typedIssue?.code ?? "");
25
25
  const issuePath = String(typedIssue?.path ?? "");
26
26
  if (isAnnualSupplyTarget(code, issuePath)) {
27
- return `Use source evidence or an explicitly documented profile fallback to write annualSupplyOrProductionVolume as a real annualized quantity with unit, for example '<number> <unit>/year'. If no annualized source evidence exists, Foundry deterministic cleanup must write the intentionally non-physical sentinel '${annualSupplyMissingDataSentinelText}' so database-side follow-up can bulk-locate and replace it later.`;
27
+ return `Use source evidence or an explicitly documented profile fallback to write annualSupplyOrProductionVolume as a real annualized quantity with unit, for example '<number> <unit>/year'. Never invent a quantity from a reference flow or a default unit. If no annualized source evidence exists, Foundry deterministic cleanup normalizes the field to the supported empty array and records a row-level evidence gap; the historical '${legacyAnnualSupplyMissingDataSentinelText}' marker is recognized only so rows written by earlier rounds can be normalized, and is never written again.`;
28
28
  }
29
29
  if (code === "invalid_format") {
30
30
  return "Use the SDK schema and methodology YAML for this field to replace the invalid value with a schema-valid source-backed value.";
@@ -44,17 +44,17 @@ export function schemaIssueCurationAction(issue) {
44
44
  instruction: schemaIssueInstruction(issue),
45
45
  ...(annualSupplyIssue
46
46
  ? {
47
- sentinel_completion_allowed: true,
48
- sentinel_cleanup_path: annualSupplyFieldPath,
49
- sentinel_value: annualSupplyMissingDataSentinelText,
50
- sentinel_policy: "The 9999 missing-data sentinel is intentionally non-physical and easy to bulk-query; later database-side curation owns replacing it with real annual volume evidence.",
47
+ unknown_normalization_allowed: true,
48
+ cleanup_field_path: annualSupplyFieldPath,
49
+ normalized_unknown_value: [],
50
+ unknown_evidence_policy: "An absent annual volume is normalized to the supported empty array and reported as a row-level evidence gap; Foundry never writes a synthesized quantity, and downstream schema, authoring, curation, and write gates keep owning rejection.",
51
51
  }
52
52
  : {}),
53
53
  };
54
54
  if (annualSupplyIssue) {
55
55
  return {
56
56
  ...base,
57
- action_kind: "annual_supply_sentinel_completion",
57
+ action_kind: "annual_supply_unknown_evidence_normalization",
58
58
  required_owner: "foundry_deterministic_cleanup",
59
59
  ai_required: false,
60
60
  instruction: schemaIssueInstruction(issue),
@@ -3,7 +3,6 @@ import { normalizeTidasLanguageCode } from "../../tidas-language-utils.js";
3
3
  import { fullContextAiCompletionRequirement } from "./context-inputs.js";
4
4
  import { dataSetInformation, datasetRoot } from "./dataset-payload.js";
5
5
  import { sha256Text } from "./hash-utils.js";
6
- import { annualSupplyMissingDataSentinelText } from "./prewrite-cleanup.js";
7
6
  import { asText, ensureArray, fileExists, readJson, repoRelativeArtifactPath, repoRelativePath, resolveRepoPath, } from "./runtime-io.js";
8
7
  import { collectCommonOtherTraceEntries } from "./trace-summary.js";
9
8
  import { hasNonEmptyTraceEvidence } from "./workflow-authoring-tasks.js";
@@ -498,6 +497,17 @@ export function collectNamePlanQualitySemanticActions(payload, datasetType) {
498
497
  : "name.baseName contains route, mix, availability, or location segments that should be split into the structured TIDAS name fields.",
499
498
  evidence: {
500
499
  ...finding,
500
+ // W8 public premises are referenced by identity; source-specific detection and
501
+ // the decision to block remain Foundry policy, not copied public definitions.
502
+ public_rule_refs: finding.code === "semantic_name_base_contains_unsplit_segments" ||
503
+ finding.code === "semantic_name_quantitative_property_not_split"
504
+ ? datasetType === "flow"
505
+ ? ["tidas.flow.name.base-name.technical"]
506
+ : datasetType === "process"
507
+ ? ["tidas.process.name.qualifiers.structured"]
508
+ : []
509
+ : [],
510
+ public_rule_source: "tiangong-lca/tidas-spec@ea4a58984c22734f2d54cda6d45b2733d9920ac0:assets/tidas/rules/public-rules.v1.json",
501
511
  current_name: {
502
512
  baseName: textValue(name?.baseName) || null,
503
513
  treatmentStandardsRoutes: textValue(name?.treatmentStandardsRoutes) || null,
@@ -1225,7 +1235,7 @@ export function buildPatchTemplate(packagePayload, packagePath) {
1225
1235
  "Do not remove authoring_package; strict Foundry apply uses it for package lineage and action-item closure.",
1226
1236
  "Do not use common:other as a substitute for mandatory schema fields. Only action items whose allowed_resolution_modes include deferred_to_common_other may be deferred.",
1227
1237
  "For deferred_to_common_other, add tiangongfoundry:unresolvedTrace under common:other with status, action_item_code, blocked_path, reason, structured evidence, and next_action. Evidence must include source plus quote_or_trace/source_path/field_path/citation.",
1228
- `Do not defer annualSupplyOrProductionVolume to common:other. When source annual volume evidence is missing, Foundry deterministic cleanup writes '${annualSupplyMissingDataSentinelText}' so the required schema field remains present and later database-side curation can bulk-locate it.`,
1238
+ "Do not defer annualSupplyOrProductionVolume to common:other and do not invent a quantity from a reference flow or a default unit. Supply a real annualized quantity from source evidence, or leave the field to Foundry deterministic cleanup, which normalizes it to the supported empty array and records a row-level evidence gap.",
1229
1239
  "For source_trace_verified, add tiangongfoundry:sourceExchangeCompleteness under common:other with accepted status and structured source trace evidence. Evidence must include source plus quote_or_trace/source_path/field_path/citation.",
1230
1240
  ],
1231
1241
  patch_sets: [
@@ -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
- ? ["task", "actor", "semanticInput", "authorizationInput", "referenceInput"]
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.9",
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",
@@ -81,7 +82,7 @@
81
82
  },
82
83
  "license": "MIT",
83
84
  "dependencies": {
84
- "@tiangong-lca/cli": "0.1.14"
85
+ "@tiangong-lca/cli": "0.1.19"
85
86
  },
86
87
  "foundryRuntime": {
87
88
  "schema": "tiangong-foundry.runtime-layout.v2",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema_version": 2,
3
- "updated_at_utc": "2026-09-10T23:06:45Z",
3
+ "updated_at_utc": "2026-09-21T07:44:02Z",
4
4
  "default_profile": "generic",
5
5
  "profiles": {
6
6
  "generic": {
@@ -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
  }
@@ -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
+ }
@@ -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.9"
21
+ "const": "0.1.11"
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
  },
@@ -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
  }