@tiangong-lca/foundry 0.1.2
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/LICENSE +21 -0
- package/README.md +532 -0
- package/docs/architecture.md +450 -0
- package/docs/foundry-task-contracts.md +147 -0
- package/docs/import-profiles/bafu/constraints.md +343 -0
- package/docs/import-profiles/bafu/leaf-process-classification-authoring.md +153 -0
- package/docs/import-profiles/bafu/profile.md +183 -0
- package/docs/import-profiles/uslci/constraints.md +29 -0
- package/docs/import-profiles/uslci/profile.md +43 -0
- package/docs/import-profiles/worldsteel/constraints.md +77 -0
- package/docs/import-profiles/worldsteel/import-coverage.md +93 -0
- package/docs/import-profiles/worldsteel/import-plan.md +375 -0
- package/docs/import-profiles/worldsteel/profile.md +78 -0
- package/docs/package-distribution-contract.md +287 -0
- package/docs/public-runtime-contract.md +218 -0
- package/docs/runtime-context-contract.md +138 -0
- package/docs/safety-policy.md +164 -0
- package/docs/task-authorization-contract.md +131 -0
- package/docs/uslci-import-runbook.md +336 -0
- package/docs/workspace-migration-contract.md +127 -0
- package/package-dist/assets/foundry-package-descriptor.json +1661 -0
- package/package-dist/scripts/foundry-facade.d.ts +78 -0
- package/package-dist/scripts/foundry-facade.js +1317 -0
- package/package-dist/scripts/foundry-runtime.d.ts +180 -0
- package/package-dist/scripts/foundry-runtime.js +190 -0
- package/package-dist/scripts/lib/batch-orchestration/scope-attempt-ledger.d.ts +27 -0
- package/package-dist/scripts/lib/batch-orchestration/scope-attempt-ledger.js +85 -0
- package/package-dist/scripts/lib/batch-orchestration/scope-resume-contract.d.ts +38 -0
- package/package-dist/scripts/lib/batch-orchestration/scope-resume-contract.js +90 -0
- package/package-dist/scripts/lib/bundle-row-types.d.ts +44 -0
- package/package-dist/scripts/lib/bundle-row-types.js +46 -0
- package/package-dist/scripts/lib/bundle-sample-utils.d.ts +183 -0
- package/package-dist/scripts/lib/bundle-sample-utils.js +526 -0
- package/package-dist/scripts/lib/bundle-source-context.d.ts +31 -0
- package/package-dist/scripts/lib/bundle-source-context.js +142 -0
- package/package-dist/scripts/lib/canonical-description.d.ts +12 -0
- package/package-dist/scripts/lib/canonical-description.js +72 -0
- package/package-dist/scripts/lib/canonical-support-rewrites.d.ts +127 -0
- package/package-dist/scripts/lib/canonical-support-rewrites.js +527 -0
- package/package-dist/scripts/lib/decision-owners/classification.d.ts +245 -0
- package/package-dist/scripts/lib/decision-owners/classification.js +754 -0
- package/package-dist/scripts/lib/decision-owners/identity-preflight.d.ts +333 -0
- package/package-dist/scripts/lib/decision-owners/identity-preflight.js +1353 -0
- package/package-dist/scripts/lib/decision-owners/identity-task.d.ts +130 -0
- package/package-dist/scripts/lib/decision-owners/identity-task.js +494 -0
- package/package-dist/scripts/lib/decision-owners/identity.d.ts +74 -0
- package/package-dist/scripts/lib/decision-owners/identity.js +443 -0
- package/package-dist/scripts/lib/decision-owners/location.d.ts +239 -0
- package/package-dist/scripts/lib/decision-owners/location.js +704 -0
- package/package-dist/scripts/lib/decision-task-utils.d.ts +484 -0
- package/package-dist/scripts/lib/decision-task-utils.js +735 -0
- package/package-dist/scripts/lib/finalize-owners/cli-wrappers.d.ts +52 -0
- package/package-dist/scripts/lib/finalize-owners/cli-wrappers.js +146 -0
- package/package-dist/scripts/lib/finalize-owners/commit-handoff.d.ts +79 -0
- package/package-dist/scripts/lib/finalize-owners/commit-handoff.js +515 -0
- package/package-dist/scripts/lib/finalize-owners/post-authoring.d.ts +234 -0
- package/package-dist/scripts/lib/finalize-owners/post-authoring.js +1720 -0
- package/package-dist/scripts/lib/finalize-owners/post-write-closeout.d.ts +140 -0
- package/package-dist/scripts/lib/finalize-owners/post-write-closeout.js +656 -0
- package/package-dist/scripts/lib/foundry-args.d.ts +7 -0
- package/package-dist/scripts/lib/foundry-args.js +38 -0
- package/package-dist/scripts/lib/foundry-authentication-environment.d.ts +17 -0
- package/package-dist/scripts/lib/foundry-authentication-environment.js +55 -0
- package/package-dist/scripts/lib/foundry-authorization-input.d.ts +31 -0
- package/package-dist/scripts/lib/foundry-authorization-input.js +151 -0
- package/package-dist/scripts/lib/foundry-command-metadata.d.ts +32 -0
- package/package-dist/scripts/lib/foundry-command-metadata.js +1012 -0
- package/package-dist/scripts/lib/foundry-command-registry.d.ts +34 -0
- package/package-dist/scripts/lib/foundry-command-registry.js +241 -0
- package/package-dist/scripts/lib/foundry-command-spec.d.ts +1 -0
- package/package-dist/scripts/lib/foundry-command-spec.js +1 -0
- package/package-dist/scripts/lib/foundry-decision-owners.d.ts +17 -0
- package/package-dist/scripts/lib/foundry-decision-owners.js +68 -0
- package/package-dist/scripts/lib/foundry-decision-routing.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-decision-routing.js +38 -0
- package/package-dist/scripts/lib/foundry-execution-admission.d.ts +33 -0
- package/package-dist/scripts/lib/foundry-execution-admission.js +225 -0
- package/package-dist/scripts/lib/foundry-execution-attempt.d.ts +11 -0
- package/package-dist/scripts/lib/foundry-execution-attempt.js +33 -0
- package/package-dist/scripts/lib/foundry-execution-context-format.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-execution-context-format.js +83 -0
- package/package-dist/scripts/lib/foundry-facade-store.d.ts +25 -0
- package/package-dist/scripts/lib/foundry-facade-store.js +449 -0
- package/package-dist/scripts/lib/foundry-finalize-owners.d.ts +21 -0
- package/package-dist/scripts/lib/foundry-finalize-owners.js +203 -0
- package/package-dist/scripts/lib/foundry-identity-owners.d.ts +13 -0
- package/package-dist/scripts/lib/foundry-identity-owners.js +58 -0
- package/package-dist/scripts/lib/foundry-managed-host.d.ts +7 -0
- package/package-dist/scripts/lib/foundry-managed-host.js +173 -0
- package/package-dist/scripts/lib/foundry-migration-adoption-plan.d.ts +39 -0
- package/package-dist/scripts/lib/foundry-migration-adoption-plan.js +467 -0
- package/package-dist/scripts/lib/foundry-migration-adoption.d.ts +31 -0
- package/package-dist/scripts/lib/foundry-migration-adoption.js +187 -0
- package/package-dist/scripts/lib/foundry-migration-authority.d.ts +42 -0
- package/package-dist/scripts/lib/foundry-migration-authority.js +280 -0
- package/package-dist/scripts/lib/foundry-migration-inventory.d.ts +31 -0
- package/package-dist/scripts/lib/foundry-migration-inventory.js +148 -0
- package/package-dist/scripts/lib/foundry-migration-plan.d.ts +48 -0
- package/package-dist/scripts/lib/foundry-migration-plan.js +234 -0
- package/package-dist/scripts/lib/foundry-migration-replay.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-migration-replay.js +134 -0
- package/package-dist/scripts/lib/foundry-migration-stage.d.ts +15 -0
- package/package-dist/scripts/lib/foundry-migration-stage.js +152 -0
- package/package-dist/scripts/lib/foundry-migration-transfer-io.d.ts +13 -0
- package/package-dist/scripts/lib/foundry-migration-transfer-io.js +226 -0
- package/package-dist/scripts/lib/foundry-migration-transfer.d.ts +36 -0
- package/package-dist/scripts/lib/foundry-migration-transfer.js +350 -0
- package/package-dist/scripts/lib/foundry-operation-result.d.ts +71 -0
- package/package-dist/scripts/lib/foundry-operation-result.js +264 -0
- package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +319 -0
- package/package-dist/scripts/lib/foundry-owner-execution-store.js +293 -0
- package/package-dist/scripts/lib/foundry-owner-readback.d.ts +22 -0
- package/package-dist/scripts/lib/foundry-owner-readback.js +189 -0
- package/package-dist/scripts/lib/foundry-owner-trace-acceptance.d.ts +15 -0
- package/package-dist/scripts/lib/foundry-owner-trace-acceptance.js +68 -0
- package/package-dist/scripts/lib/foundry-package-contract.d.ts +56 -0
- package/package-dist/scripts/lib/foundry-package-contract.js +392 -0
- package/package-dist/scripts/lib/foundry-private-path.d.ts +2 -0
- package/package-dist/scripts/lib/foundry-private-path.js +20 -0
- package/package-dist/scripts/lib/foundry-runtime-cache.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-runtime-cache.js +25 -0
- package/package-dist/scripts/lib/foundry-runtime-command-policy.d.ts +20 -0
- package/package-dist/scripts/lib/foundry-runtime-command-policy.js +173 -0
- package/package-dist/scripts/lib/foundry-runtime-context-types.d.ts +59 -0
- package/package-dist/scripts/lib/foundry-runtime-context-types.js +1 -0
- package/package-dist/scripts/lib/foundry-runtime-context.d.ts +27 -0
- package/package-dist/scripts/lib/foundry-runtime-context.js +668 -0
- package/package-dist/scripts/lib/foundry-runtime-environment.d.ts +9 -0
- package/package-dist/scripts/lib/foundry-runtime-environment.js +90 -0
- package/package-dist/scripts/lib/foundry-runtime-error.d.ts +4 -0
- package/package-dist/scripts/lib/foundry-runtime-error.js +8 -0
- package/package-dist/scripts/lib/foundry-runtime-identity.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-runtime-identity.js +127 -0
- package/package-dist/scripts/lib/foundry-runtime-paths.d.ts +16 -0
- package/package-dist/scripts/lib/foundry-runtime-paths.js +159 -0
- package/package-dist/scripts/lib/foundry-runtime-qualification.d.ts +66 -0
- package/package-dist/scripts/lib/foundry-runtime-qualification.js +223 -0
- package/package-dist/scripts/lib/foundry-runtime-selection-record.d.ts +16 -0
- package/package-dist/scripts/lib/foundry-runtime-selection-record.js +32 -0
- package/package-dist/scripts/lib/foundry-runtime-selection.d.ts +14 -0
- package/package-dist/scripts/lib/foundry-runtime-selection.js +123 -0
- package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +178 -0
- package/package-dist/scripts/lib/foundry-runtime-utils.js +603 -0
- package/package-dist/scripts/lib/foundry-semantic-input.d.ts +30 -0
- package/package-dist/scripts/lib/foundry-semantic-input.js +132 -0
- package/package-dist/scripts/lib/foundry-task-authorization.d.ts +68 -0
- package/package-dist/scripts/lib/foundry-task-authorization.js +350 -0
- package/package-dist/scripts/lib/foundry-task-io.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-task-io.js +92 -0
- package/package-dist/scripts/lib/foundry-task-registration.d.ts +6 -0
- package/package-dist/scripts/lib/foundry-task-registration.js +384 -0
- package/package-dist/scripts/lib/foundry-task-start-spec.d.ts +34 -0
- package/package-dist/scripts/lib/foundry-task-start-spec.js +161 -0
- package/package-dist/scripts/lib/foundry-task-store.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-task-store.js +466 -0
- package/package-dist/scripts/lib/foundry-task-types.d.ts +99 -0
- package/package-dist/scripts/lib/foundry-task-types.js +1 -0
- package/package-dist/scripts/lib/foundry-workflow-approval-continuation.d.ts +6 -0
- package/package-dist/scripts/lib/foundry-workflow-approval-continuation.js +136 -0
- package/package-dist/scripts/lib/foundry-workflow-assessment.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-workflow-assessment.js +231 -0
- package/package-dist/scripts/lib/foundry-workflow-authorization.d.ts +22 -0
- package/package-dist/scripts/lib/foundry-workflow-authorization.js +174 -0
- package/package-dist/scripts/lib/foundry-workflow-context.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-workflow-context.js +99 -0
- package/package-dist/scripts/lib/foundry-workflow-decisions.d.ts +18 -0
- package/package-dist/scripts/lib/foundry-workflow-decisions.js +123 -0
- package/package-dist/scripts/lib/foundry-workflow-execution.d.ts +8 -0
- package/package-dist/scripts/lib/foundry-workflow-execution.js +248 -0
- package/package-dist/scripts/lib/foundry-workflow-finalize.d.ts +13 -0
- package/package-dist/scripts/lib/foundry-workflow-finalize.js +264 -0
- package/package-dist/scripts/lib/foundry-workflow-identity-apply.d.ts +14 -0
- package/package-dist/scripts/lib/foundry-workflow-identity-apply.js +159 -0
- package/package-dist/scripts/lib/foundry-workflow-identity.d.ts +6 -0
- package/package-dist/scripts/lib/foundry-workflow-identity.js +153 -0
- package/package-dist/scripts/lib/foundry-workflow-import.d.ts +4 -0
- package/package-dist/scripts/lib/foundry-workflow-import.js +70 -0
- package/package-dist/scripts/lib/foundry-workflow-io.d.ts +11 -0
- package/package-dist/scripts/lib/foundry-workflow-io.js +77 -0
- package/package-dist/scripts/lib/foundry-workflow-reference-verify.d.ts +41 -0
- package/package-dist/scripts/lib/foundry-workflow-reference-verify.js +266 -0
- package/package-dist/scripts/lib/foundry-workflow-rows.d.ts +2 -0
- package/package-dist/scripts/lib/foundry-workflow-rows.js +47 -0
- package/package-dist/scripts/lib/foundry-workflow-semantic.d.ts +5 -0
- package/package-dist/scripts/lib/foundry-workflow-semantic.js +367 -0
- package/package-dist/scripts/lib/foundry-workflow-state.d.ts +37 -0
- package/package-dist/scripts/lib/foundry-workflow-state.js +158 -0
- package/package-dist/scripts/lib/full-context-proof.d.ts +51 -0
- package/package-dist/scripts/lib/full-context-proof.js +932 -0
- package/package-dist/scripts/lib/identity-preflight-artifacts.d.ts +184 -0
- package/package-dist/scripts/lib/identity-preflight-artifacts.js +573 -0
- package/package-dist/scripts/lib/identity-preflight-proof.d.ts +117 -0
- package/package-dist/scripts/lib/identity-preflight-proof.js +341 -0
- package/package-dist/scripts/lib/identity-reference-rewrite-utils.d.ts +147 -0
- package/package-dist/scripts/lib/identity-reference-rewrite-utils.js +817 -0
- package/package-dist/scripts/lib/import-curation/authoring-packages.d.ts +28 -0
- package/package-dist/scripts/lib/import-curation/authoring-packages.js +92 -0
- package/package-dist/scripts/lib/import-curation/curation-cleanup.d.ts +32 -0
- package/package-dist/scripts/lib/import-curation/curation-cleanup.js +203 -0
- package/package-dist/scripts/lib/import-curation/curation-gate.d.ts +47 -0
- package/package-dist/scripts/lib/import-curation/curation-gate.js +528 -0
- package/package-dist/scripts/lib/import-curation/internal/artifact-inputs.d.ts +24 -0
- package/package-dist/scripts/lib/import-curation/internal/artifact-inputs.js +152 -0
- package/package-dist/scripts/lib/import-curation/internal/authoring-patch-workflow.d.ts +3 -0
- package/package-dist/scripts/lib/import-curation/internal/authoring-patch-workflow.js +3 -0
- package/package-dist/scripts/lib/import-curation/internal/authoring-task-workflow.d.ts +1 -0
- package/package-dist/scripts/lib/import-curation/internal/authoring-task-workflow.js +1 -0
- package/package-dist/scripts/lib/import-curation/internal/context-inputs.d.ts +56 -0
- package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +206 -0
- package/package-dist/scripts/lib/import-curation/internal/curation-gate-workflow.d.ts +14 -0
- package/package-dist/scripts/lib/import-curation/internal/curation-gate-workflow.js +14 -0
- package/package-dist/scripts/lib/import-curation/internal/dataset-payload.d.ts +70 -0
- package/package-dist/scripts/lib/import-curation/internal/dataset-payload.js +141 -0
- package/package-dist/scripts/lib/import-curation/internal/dataset-types.d.ts +25 -0
- package/package-dist/scripts/lib/import-curation/internal/dataset-types.js +45 -0
- package/package-dist/scripts/lib/import-curation/internal/full-context-proof.d.ts +129 -0
- package/package-dist/scripts/lib/import-curation/internal/full-context-proof.js +552 -0
- package/package-dist/scripts/lib/import-curation/internal/hash-utils.d.ts +2 -0
- package/package-dist/scripts/lib/import-curation/internal/hash-utils.js +10 -0
- package/package-dist/scripts/lib/import-curation/internal/mutation-manifest-workflow.d.ts +15 -0
- package/package-dist/scripts/lib/import-curation/internal/mutation-manifest-workflow.js +15 -0
- package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.d.ts +31 -0
- package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.js +467 -0
- package/package-dist/scripts/lib/import-curation/internal/profiles-config.d.ts +47 -0
- package/package-dist/scripts/lib/import-curation/internal/profiles-config.js +88 -0
- package/package-dist/scripts/lib/import-curation/internal/runtime-io.d.ts +23 -0
- package/package-dist/scripts/lib/import-curation/internal/runtime-io.js +132 -0
- package/package-dist/scripts/lib/import-curation/internal/trace-summary.d.ts +53 -0
- package/package-dist/scripts/lib/import-curation/internal/trace-summary.js +114 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.d.ts +141 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.js +854 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-decision-apply-context.d.ts +20 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-decision-apply-context.js +46 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-decision-full-context.d.ts +110 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-decision-full-context.js +782 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-dry-run-context.d.ts +24 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-dry-run-context.js +191 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-evidence-scope.d.ts +80 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-evidence-scope.js +359 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-identity-decision-context.d.ts +146 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-identity-decision-context.js +381 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.d.ts +223 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.js +1079 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.d.ts +41 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.js +412 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence-context.d.ts +117 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence-context.js +278 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence.d.ts +59 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-evidence.js +593 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.d.ts +58 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.js +263 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.d.ts +177 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.js +812 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-row-transform-context.d.ts +159 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-row-transform-context.js +466 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.d.ts +152 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.js +1377 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-source-reference-context.d.ts +38 -0
- package/package-dist/scripts/lib/import-curation/internal/workflow-source-reference-context.js +116 -0
- package/package-dist/scripts/lib/import-curation/mutation-manifest.d.ts +51 -0
- package/package-dist/scripts/lib/import-curation/mutation-manifest.js +542 -0
- package/package-dist/scripts/lib/import-curation/patch-collect.d.ts +18 -0
- package/package-dist/scripts/lib/import-curation/patch-collect.js +172 -0
- package/package-dist/scripts/lib/import-curation/profiles.d.ts +1 -0
- package/package-dist/scripts/lib/import-curation/profiles.js +1 -0
- package/package-dist/scripts/lib/import-curation/trace-summary.d.ts +1 -0
- package/package-dist/scripts/lib/import-curation/trace-summary.js +1 -0
- package/package-dist/scripts/lib/oauth-session-reference.d.ts +1 -0
- package/package-dist/scripts/lib/oauth-session-reference.js +20 -0
- package/package-dist/scripts/lib/post-authoring-finalize-utils.d.ts +95 -0
- package/package-dist/scripts/lib/post-authoring-finalize-utils.js +548 -0
- package/package-dist/scripts/lib/post-write-root-proof.d.ts +44 -0
- package/package-dist/scripts/lib/post-write-root-proof.js +169 -0
- package/package-dist/scripts/lib/reference-description-text.d.ts +2 -0
- package/package-dist/scripts/lib/reference-description-text.js +12 -0
- package/package-dist/scripts/lib/remote-verification-accepted-diff.d.ts +42 -0
- package/package-dist/scripts/lib/remote-verification-accepted-diff.js +424 -0
- package/package-dist/scripts/lib/same-identity-commit-recovery.d.ts +8 -0
- package/package-dist/scripts/lib/same-identity-commit-recovery.js +52 -0
- package/package-dist/scripts/lib/source-semantics.d.ts +255 -0
- package/package-dist/scripts/lib/source-semantics.js +888 -0
- package/package-dist/scripts/lib/stage-contract.d.ts +36 -0
- package/package-dist/scripts/lib/stage-contract.js +25 -0
- package/package-dist/scripts/lib/task-authorization.d.ts +84 -0
- package/package-dist/scripts/lib/task-authorization.js +210 -0
- package/package-dist/scripts/lib/tidas-adapter.d.ts +113 -0
- package/package-dist/scripts/lib/tidas-adapter.js +525 -0
- package/package-dist/scripts/lib/tidas-language-utils.d.ts +8 -0
- package/package-dist/scripts/lib/tidas-language-utils.js +206 -0
- package/package-dist/scripts/lib/tidas-row-utils.d.ts +70 -0
- package/package-dist/scripts/lib/tidas-row-utils.js +225 -0
- package/package-dist/scripts/lib/trace-coverage.d.ts +53 -0
- package/package-dist/scripts/lib/trace-coverage.js +178 -0
- package/package-dist/scripts/package-entry.d.ts +2 -0
- package/package-dist/scripts/package-entry.js +4 -0
- package/package-dist/scripts/public-api.d.ts +80 -0
- package/package-dist/scripts/public-api.js +28 -0
- package/package-dist/scripts/runtime-entry.d.ts +23 -0
- package/package-dist/scripts/runtime-entry.js +424 -0
- package/package.json +93 -0
- package/specs/canonical-support/flow-properties-unit-groups.json +2692 -0
- package/specs/import-profiles.json +118 -0
- package/specs/prewrite-content-policy.json +105 -0
- package/specs/schemas/authorization-derivation.schema.json +34 -0
- package/specs/schemas/execution-context.schema.json +68 -0
- package/specs/schemas/foundry-authorization-input.schema.json +120 -0
- package/specs/schemas/foundry-facade-request-index.schema.json +78 -0
- package/specs/schemas/foundry-managed-runtime.schema.json +122 -0
- package/specs/schemas/foundry-migration-activation.schema.json +213 -0
- package/specs/schemas/foundry-migration-adoption-plan.schema.json +548 -0
- package/specs/schemas/foundry-migration-transfer-receipt.schema.json +93 -0
- package/specs/schemas/foundry-operation-result.schema.json +147 -0
- package/specs/schemas/foundry-package-descriptor.schema.json +134 -0
- package/specs/schemas/foundry-runtime-selection.schema.json +59 -0
- package/specs/schemas/foundry-semantic-input.schema.json +36 -0
- package/specs/schemas/foundry-task-start.schema.json +123 -0
- package/specs/schemas/foundry-workspace-migration-pending.schema.json +17 -0
- package/specs/schemas/foundry-workspace-migration-plan.schema.json +59 -0
- package/specs/schemas/foundry-workspace-migration-transfer-plan.schema.json +357 -0
- package/specs/schemas/foundry-workspace-v2.schema.json +70 -0
- package/specs/schemas/runtime-qualification.schema.json +63 -0
- package/specs/schemas/task-authorization.schema.json +154 -0
- package/specs/schemas/tidas-runtime-expectation.schema.json +54 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Data Foundry Architecture
|
|
3
|
+
docType: guide
|
|
4
|
+
scope: repo
|
|
5
|
+
status: active
|
|
6
|
+
authoritative: true
|
|
7
|
+
owner: tiangong-lca-data-foundry
|
|
8
|
+
language: en
|
|
9
|
+
whenToUse:
|
|
10
|
+
- when deciding what belongs in Foundry versus CLI, skills, tools, SDK, database, or Edge projects
|
|
11
|
+
- when reviewing public Foundry command surface or retired daemon/runtime assumptions
|
|
12
|
+
whenToUpdate:
|
|
13
|
+
- when Foundry ownership, lane architecture, runtime model, or cross-project routing changes
|
|
14
|
+
checkPaths:
|
|
15
|
+
- docs/architecture.md
|
|
16
|
+
- docs/foundry-ai-navigation.md
|
|
17
|
+
- docs/foundry-command-surface.md
|
|
18
|
+
- AGENTS.md
|
|
19
|
+
- README.md
|
|
20
|
+
- WORKFLOW.md
|
|
21
|
+
- test/README.md
|
|
22
|
+
- docs/capability-ownership-policy.md
|
|
23
|
+
- docs/workspace-project-map.md
|
|
24
|
+
- docs/package-distribution-contract.md
|
|
25
|
+
- specs/capability-ownership-rules.json
|
|
26
|
+
- specs/automated-lca-capability-registry.json
|
|
27
|
+
- test/unit/zero-javascript-ratchet.test.mts
|
|
28
|
+
- test/unit/source-row-explicit-any-contract.test.mts
|
|
29
|
+
- test/unit/identity-rewrite-explicit-any-contract.test.mts
|
|
30
|
+
- scripts/foundry-golden-diff.ts
|
|
31
|
+
- scripts/check-tidas-cutover.ts
|
|
32
|
+
- scripts/check-lint-suppressions.ts
|
|
33
|
+
- scripts/clean-build-output.ts
|
|
34
|
+
- scripts/build-foundry-package.ts
|
|
35
|
+
- scripts/package-entry.ts
|
|
36
|
+
- scripts/public-api.ts
|
|
37
|
+
- scripts/lib/foundry-package-contract.ts
|
|
38
|
+
- scripts/lib/tidas-adapter.ts
|
|
39
|
+
- scripts/lib/post-authoring-finalize-utils.ts
|
|
40
|
+
- scripts/commands/tasks.ts
|
|
41
|
+
- scripts/commands/import-completion.ts
|
|
42
|
+
- scripts/commands/commit-handoff.ts
|
|
43
|
+
- scripts/commands/identity-decision-task.ts
|
|
44
|
+
- scripts/commands/support-cache.ts
|
|
45
|
+
- scripts/commands/cli-wrappers.ts
|
|
46
|
+
- scripts/commands/execution-capsule.ts
|
|
47
|
+
- scripts/commands/post-write-closeout.ts
|
|
48
|
+
- scripts/commands/authoring-plan.ts
|
|
49
|
+
- scripts/commands/bundle-sample-rows.ts
|
|
50
|
+
- scripts/commands/incremental-change-set.ts
|
|
51
|
+
- scripts/commands/topology-convergence.ts
|
|
52
|
+
- scripts/commands/core.ts
|
|
53
|
+
- scripts/commands/identity-preflight-run.ts
|
|
54
|
+
- scripts/commands/post-authoring-finalize.ts
|
|
55
|
+
- scripts/lib/foundry-args.ts
|
|
56
|
+
- scripts/commands/identity-decisions.ts
|
|
57
|
+
- scripts/commands/classification-decisions.ts
|
|
58
|
+
- scripts/commands/location-decisions.ts
|
|
59
|
+
- scripts/commands/library-scope-workflow.ts
|
|
60
|
+
- scripts/commands/bafu-leaf-classification-tasks.ts
|
|
61
|
+
- scripts/commands/bafu-auto-authoring.ts
|
|
62
|
+
- scripts/commands/bafu-process-scope-e2e.ts
|
|
63
|
+
- scripts/commands/bafu-batch-import-run.ts
|
|
64
|
+
- scripts/lib/foundry-command-registry.ts
|
|
65
|
+
- scripts/lib/foundry-command-metadata.ts
|
|
66
|
+
- scripts/lib/surface-audit.ts
|
|
67
|
+
- scripts/lib/foundry-runtime-environment.ts
|
|
68
|
+
- scripts/lib/foundry-runtime-paths.ts
|
|
69
|
+
- scripts/lib/foundry-runtime-utils.ts
|
|
70
|
+
- scripts/lib/location-quality-utils.ts
|
|
71
|
+
- scripts/lib/bundle-row-types.ts
|
|
72
|
+
- scripts/lib/tidas-language-utils.ts
|
|
73
|
+
- scripts/lib/import-curation/internal/hash-utils.ts
|
|
74
|
+
- scripts/lib/import-curation.ts
|
|
75
|
+
- scripts/lib/import-curation/index.ts
|
|
76
|
+
- scripts/lib/import-curation/profiles.ts
|
|
77
|
+
- scripts/lib/import-curation/trace-summary.ts
|
|
78
|
+
- scripts/lib/import-curation/internal/dataset-types.ts
|
|
79
|
+
- scripts/lib/import-curation/internal/runtime-io.ts
|
|
80
|
+
- scripts/lib/import-curation/internal/prewrite-cleanup.ts
|
|
81
|
+
- scripts/lib/import-curation/internal/workflow-queue-context.ts
|
|
82
|
+
- scripts/lib/import-curation/internal/full-context-proof.ts
|
|
83
|
+
- scripts/lib/import-curation/internal/workflow-decision-apply-context.ts
|
|
84
|
+
- scripts/lib/import-curation/internal/profiles-config.ts
|
|
85
|
+
- scripts/lib/import-curation/internal/workflow-patch-collect.ts
|
|
86
|
+
- scripts/lib/import-curation/internal/workflow-identity-decision-context.ts
|
|
87
|
+
- scripts/lib/import-curation/internal/workflow-patch-evidence-context.ts
|
|
88
|
+
- scripts/lib/import-curation/internal/workflow-row-transform-context.ts
|
|
89
|
+
- scripts/lib/import-curation/internal/workflow-dry-run-context.ts
|
|
90
|
+
- scripts/lib/import-curation/internal/workflow-evidence-scope.ts
|
|
91
|
+
- scripts/lib/import-curation/internal/workflow-decision-full-context.ts
|
|
92
|
+
- scripts/lib/import-curation/internal/workflow-authoring-tasks.ts
|
|
93
|
+
- scripts/lib/import-curation/internal/workflow-semantic-actions.ts
|
|
94
|
+
- scripts/lib/import-curation/internal/workflow-patch-evidence.ts
|
|
95
|
+
- scripts/lib/import-curation/internal/workflow-identity-preflight.ts
|
|
96
|
+
- scripts/lib/import-curation/internal/authoring-task-workflow.ts
|
|
97
|
+
- scripts/lib/import-curation/internal/authoring-patch-workflow.ts
|
|
98
|
+
- scripts/lib/import-curation/internal/curation-gate-workflow.ts
|
|
99
|
+
- scripts/lib/import-curation/authoring-packages.ts
|
|
100
|
+
- scripts/lib/import-curation/patch-collect.ts
|
|
101
|
+
- scripts/lib/import-curation/curation-gate.ts
|
|
102
|
+
- scripts/lib/import-curation/curation-cleanup.ts
|
|
103
|
+
- scripts/lib/import-curation/internal/workflow-reference-closure.ts
|
|
104
|
+
- scripts/lib/import-curation/internal/workflow-source-reference-context.ts
|
|
105
|
+
- scripts/lib/import-curation/internal/mutation-manifest-workflow.ts
|
|
106
|
+
- scripts/lib/import-curation/mutation-manifest.ts
|
|
107
|
+
- scripts/lib/import-curation/internal/artifact-inputs.ts
|
|
108
|
+
- scripts/lib/import-curation/internal/context-inputs.ts
|
|
109
|
+
- scripts/lib/import-curation/internal/dataset-payload.ts
|
|
110
|
+
- scripts/lib/import-curation/internal/trace-summary.ts
|
|
111
|
+
- scripts/lib/canonical-support-mappings.ts
|
|
112
|
+
- scripts/lib/source-semantics.ts
|
|
113
|
+
- scripts/lib/trace-coverage.ts
|
|
114
|
+
- scripts/lib/tidas-row-utils.ts
|
|
115
|
+
- scripts/lib/decision-task-utils.ts
|
|
116
|
+
- scripts/lib/identity-reference-rewrite-utils.ts
|
|
117
|
+
- scripts/lib/full-context-proof.ts
|
|
118
|
+
- scripts/lib/identity-preflight-artifacts.ts
|
|
119
|
+
- scripts/lib/bafu-family-signatures.ts
|
|
120
|
+
- scripts/lib/import-ledger.ts
|
|
121
|
+
- scripts/lib/canonical-support-rewrites.ts
|
|
122
|
+
- scripts/lib/bundle-sample-utils.ts
|
|
123
|
+
- specs/prewrite-content-policy.json
|
|
124
|
+
- test/fixtures/fixture-roots.ts
|
|
125
|
+
- test/fixtures/finalize-fixtures.ts
|
|
126
|
+
- test/commands/*.test.mts
|
|
127
|
+
- test/fixtures/fake-tidas.ts
|
|
128
|
+
- test/fixtures/foundry-core.ts
|
|
129
|
+
- test/fixtures/full-context-fixtures.ts
|
|
130
|
+
- test/fixtures/identity-fixtures.ts
|
|
131
|
+
- test/fixtures/incremental-change-set-fixtures.ts
|
|
132
|
+
- test/fixtures/mutation-fixtures.ts
|
|
133
|
+
- test/fixtures/row-builders.ts
|
|
134
|
+
- test/fixtures/topology-convergence-fixtures.ts
|
|
135
|
+
- test/unit/unit-source-ledger-test-migration.test.mts
|
|
136
|
+
- test/unit/unit-execution-library-test-migration.test.mts
|
|
137
|
+
- test/unit/unit-algorithm-adapter-test-migration.test.mts
|
|
138
|
+
- test/unit/unit-runtime-policy-test-migration.test.mts
|
|
139
|
+
- test/scenarios/scenario-authoring-curation-test-migration.test.mts
|
|
140
|
+
- test/scenarios/scenario-identity-reference-test-migration.test.mts
|
|
141
|
+
- test/scenarios/scenario-mutation-finalize-test-migration.test.mts
|
|
142
|
+
- test/scenarios/scenario-library-algorithm-test-migration.test.mts
|
|
143
|
+
- .prettierignore
|
|
144
|
+
- package.json
|
|
145
|
+
- pnpm-lock.yaml
|
|
146
|
+
- pnpm-workspace.yaml
|
|
147
|
+
- prettier.config.ts
|
|
148
|
+
- tsconfig*.json
|
|
149
|
+
- scripts/with-lca-account.ts
|
|
150
|
+
- test/unit/foundry-entry-closure-migration.test.mts
|
|
151
|
+
- test/unit/foundry-runtime-environment.test.mts
|
|
152
|
+
- test/unit/lint-suppression-audit.test.mts
|
|
153
|
+
- docs/incremental-change-set-contract.md
|
|
154
|
+
lastReviewedAt: 2026-09-09
|
|
155
|
+
lastReviewedCommit: 21f10ac1643798aade3bd930c99785a0e6eaf0d9
|
|
156
|
+
lastReviewedNote: "Reviewed for Foundry #128: exact version-only 0.1.2 follows qualified main21f10ac via a fresh release event after the prior GitHub run could not restart. Only package identity and review metadata change; CLI0.1.12, TIDAS0.3.0, full source/public qualification, signing, first-identity handoff and final F1 acceptance remain unchanged and required."
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
# Architecture
|
|
160
|
+
|
|
161
|
+
Managed process admission is a Foundry adapter over the public CLI host context. CLI owns IPC, component verification and leases; Foundry binds its installed package, CLI/TIDAS expectations, workspace access and target manifest before public operations. The shared runtime-cache path guard excludes workspace and migration roots from the manager cache. This adds no authentication, installer or business-write owner.
|
|
162
|
+
|
|
163
|
+
Migration transfer planning is governed by [the workspace migration contract](workspace-migration-contract.md). W10 provides explicit source/queue/input staging, current-owner task adoption, audited v2 activation and separate runtime read/write selection. Preserved history blocks replay across requests and migrations; none of these records grants business permission. Operational qualification and release integration remain tracked in #108/#980.
|
|
164
|
+
|
|
165
|
+
The v2 task store persists registered job/source/profile identity, account intent, producer receipts and artifact lineage; deterministic local retries reuse verified results. Exact C1/TIDAS qualification, all-command disposition, derived authorization and child admission form the W04 authority boundary. The W05 hierarchical facade adds strict result/task schemas, deterministic request revisions, actor-bound status/resume, local preparation and read-only migration inventory. W06 compiles that facade into the descriptor-bound `@tiangong-lca/foundry` candidate; W08 still owns F1 publication and platform components. See `docs/public-runtime-contract.md`, `docs/runtime-context-contract.md`, `docs/package-distribution-contract.md`, `docs/task-authorization-contract.md` and `docs/foundry-task-contracts.md`.
|
|
166
|
+
|
|
167
|
+
The explicit workspace runtime is defined by `docs/runtime-context-contract.md`: package layout comes from `package.json.foundryRuntime`, emitted execution needs no source TypeScript or Git, and selected inputs/task outputs are bound to an immutable runtime context. `scripts/runtime-entry.ts` now implements workspace init/migration, consumer doctor and task start/status/resume as the separate hierarchical facade. All 63 flat owner commands retain explicit public/internal/excluded, path, child, qualification and authorization dispositions; the facade reaches them only through registered task state and never falls back to the developer runner.
|
|
168
|
+
|
|
169
|
+
`createFoundryApplication` constructs the existing command factories for one explicit root and optional injected runtime utilities. Its `execute` method uses the same `createFoundryCommandDispatcher` registry as the CLI and returns a promise without the dispatcher printing or exiting the host. Construction does not load `.env` or discover operator state; independent applications retain independent root bindings. The developer `main(argv)` alone loads its environment and chooses the process adapter under `import.meta.main`. Consumer commands still require individual task/I/O admission through `runtime-entry.ts`; this internal composition API does not make every legacy owner safe for an installed consumer or authorize a write.
|
|
170
|
+
|
|
171
|
+
Import profiles distribute source rules only. Historical BAFU/USLCI/Worldsteel account overrides, QA waivers and the Worldsteel full-context relaxation grant no permission to a new task. `docs/task-authorization-contract.md` owns the separate workspace/task/actor/account/profile/input binding and exact action evidence. Local candidate preparation and checked public-reference proofs remain available; current final-row hashes, task permissions and all content/closure/no-replay gates are required before a restricted write handoff.
|
|
172
|
+
|
|
173
|
+
The public task facade delegates sealed owner execution to `foundry-workflow-execution.ts`, request/attempt state to `foundry-owner-execution-store.ts`, and independent owner verification to `foundry-owner-readback.ts`. The existing closeout factory lives under `lib/finalize-owners` with its developer-command re-export preserved. Local operation receipts capture evidence only; the CLI batch boundary owns one-shot mutation and readback recovery. `foundry-workflow-reference-verify.ts` selects canonical targets from identity rewrite evidence and verifies them through the published CLI; it never turns retained original reference rows into mutation or payload-equality requirements. See [public execution and recovery](public-runtime-contract.md#owner-execution-and-recovery).
|
|
174
|
+
|
|
175
|
+
## OAuth identity boundary
|
|
176
|
+
|
|
177
|
+
Foundry selects a private session reference and exact project/user intent, then calls the published CLI for a fresh server-verified identity receipt. It validates TTL, canonical hash, expected identity and current OAuth session metadata without owning login, password decoding, token exchange or refresh. Candidate Golden execution uses an isolated Git-visible source snapshot so ignored operator state cannot change qualification. Support-cache transport is owned by the public CLI export. Foundry validates the fresh identity, project, public-state scope, completion marker, artifact paths and hashes, then summarizes rows and atomically replaces only the requested local cache. The CLI runs in a private temporary cwd with an allowlisted OAuth environment; the operator checkout .env and unrelated secrets cannot enter that child. Exact public CLI 0.1.12 and reviewed TIDAS 0.2.x/0.3.x expectations are independently selected and re-observed through the W04 qualification boundary. F1 component provenance and package qualification remain W06/W08 gates.
|
|
178
|
+
|
|
179
|
+
## Qualified execution boundary
|
|
180
|
+
|
|
181
|
+
`foundry-runtime-command-policy.ts` explicitly classifies all 63 existing commands. Package assets, workspace selections, task-lineage inputs, state/artifact outputs, native/CLI child ownership and restricted authorization are separate fields. Adding a command without a disposition fails module initialization. Repository maintenance is excluded from the consumer surface; local preparation does not acquire task permission merely because it is a task stage.
|
|
182
|
+
|
|
183
|
+
`foundry-runtime-qualification.ts` binds current Foundry package identity to exact public CLI and independently selected native TIDAS bytes/protocols. `foundry-execution-admission.ts` then binds the current source lineage, derived final rows, active grant/actions/QA evidence and owner CLI CommandSpec. Rehydration in a new process reconstructs every process-local proof and checks the exact owner-draft argv shape before returning the spec. Mutation dispatch, attempt transitions and readback remain with the existing CLI/orchestration owners.
|
|
184
|
+
|
|
185
|
+
## Public facade composition
|
|
186
|
+
|
|
187
|
+
`foundry-facade.ts` is the public orchestration boundary. `foundry-operation-result.ts` owns the strict single-result envelope and exits; `foundry-task-start-spec.ts` owns bounded user intent; `foundry-facade-store.ts` owns deterministic request/revision indexes and task pointers; `foundry-migration-inventory.ts` owns the read-only W10 input plan. The facade calls `createFoundryRuntime` for task creation, inspection, deterministic cleanup, qualified native conversion and CLI contract-context preparation. Each local stage uses the existing task transaction. It does not instantiate the legacy command graph for public requests.
|
|
188
|
+
|
|
189
|
+
`foundry-workflow-decisions.ts` prepares classification/location work through the reusable factories in `lib/decision-owners/`; the original flat command modules remain thin adapters. `foundry-decision-owners.ts` composes these factories with installed CLI schemas, canonical row helpers and isolated local CLI execution. Semantic submission dispatches the selected owner against its exact current task context, publishes successful rows and requires reassessment before another owner consumes them.
|
|
190
|
+
|
|
191
|
+
`foundry-workflow-identity.ts` performs fresh account verification and read-only CLI preflight before locally registering captured evidence. `foundry-identity-owners.ts` composes the existing query/request/runner owners with explicit executable/environment facts; `bundle-source-context.ts` shares unchanged source-trace and name extraction. `foundry-authentication-environment.ts` supplies the narrow authentication environment used by verification and preflight. A current preflight report invalidates the earlier assessment so manual-review findings become identity tasks.
|
|
192
|
+
|
|
193
|
+
`foundry-workflow-identity-apply.ts` admits exact task/snapshot/context-bound decisions, delegates identity partitioning and dependent process-reference rewrites to existing owners, and verifies that partition contents preserve current scope. The semantic transaction activates only successful resolved output, retaining identity/rewrite report lineage. Unresolved partitions remain diagnostic with unchanged current rows.
|
|
194
|
+
|
|
195
|
+
`foundry-finalize-owners.ts` composes the existing finalize, handoff and queue factories under `lib/finalize-owners/` with explicit environments and the qualified installed CLI. Original command modules remain thin compatible adapters. `foundry-workflow-finalize.ts` follows current row-manifest ancestry, supplies current evidence and per-type contract context, isolates fresh preflight outputs, and captures owner reports after read-only work. It never dispatches a mutation. Current finalization is bound to both rows and assessment; success requests task authorization, while blockers retain concrete diagnostic reports. Owner write and readback integration remain pending.
|
|
196
|
+
|
|
197
|
+
Request and task records form a two-level index: one request retains monotonic revisions, while each revision points to one immutable v2 task. The latest identical fingerprint is reused; a changed canonical path or byte hash produces a new task with a predecessor. This preserves old attempts and avoids using user-visible filenames or current directories as identity. Status resolves through the task pointer and requires actor intent before loading task content.
|
|
198
|
+
|
|
199
|
+
Runtime selection is an injected host capability. Direct/unqualified use can initialize, diagnose, create, inspect and locally prepare tasks; child-required stages need a CLI-manager selection that W06/W08 will derive from an immutable product manifest. No environment variable or task document can choose the CLI/TIDAS trust anchor.
|
|
200
|
+
|
|
201
|
+
`foundry-authorization-input.ts` captures explicit grant/evidence selections. `foundry-workflow-authorization.ts` binds them to a current finalization scope, calls the existing fresh-identity registration/loader, rebuilds the owner handoff and seals exact final-row intent through the existing execution-admission API. It records approval metadata without executing the command. `foundry-workflow-approval-continuation.ts` re-finalizes prepared-row approval, activates the original owner’s exact derived grant or reuses a proven equal-byte descendant, and recovers interrupted sealing against the active pointer. Mutation/readback dispatch remains separate work.
|
|
202
|
+
|
|
203
|
+
## Package boundary
|
|
204
|
+
|
|
205
|
+
The repository and public package have separate composition roots. `scripts/foundry.ts` retains all developer owners. The public bin calls only `runFoundryPublicCommand`, and `scripts/public-api.ts` binds its own module identity before exposing the typed host facade. `tsconfig.package.json` follows those two roots to the descriptor-bound JavaScript closure plus declarations; internal command/case implementations and source maps never enter the package tree.
|
|
206
|
+
|
|
207
|
+
`build-foundry-package.ts` creates a sanitized publish stage without scripts, dev dependencies or package-manager metadata, copies only the reviewed allowlist and writes a strict file descriptor. Installed v2 package resolution checks that descriptor and the complete semantic manifest before returning a context. Exact file hashes protect code/assets; W08 provenance and component signatures protect distribution origin.
|
|
208
|
+
|
|
209
|
+
## Current Shape
|
|
210
|
+
|
|
211
|
+
Foundry is a thin local control plane. It owns task intake, profile locks, workspace ledgers, owner routing, and gate aggregation. It does not own reusable dataset execution logic.
|
|
212
|
+
|
|
213
|
+
For command ownership and navigation, use `docs/foundry-ai-navigation.md`, `docs/foundry-command-surface.md`, and the checked `scripts/lib/foundry-command-metadata.ts` map. Those files classify every Foundry command and link each command to its owner module, artifacts, and tests without changing the runtime `help` output.
|
|
214
|
+
|
|
215
|
+
The minimum runtime shape is:
|
|
216
|
+
|
|
217
|
+
```text
|
|
218
|
+
Foundry
|
|
219
|
+
= task + workspace + profile + checkpoint + gate aggregator
|
|
220
|
+
|
|
221
|
+
tiangong-lca-cli
|
|
222
|
+
= conversion + validation + QA + curation queue state + remote write/verify
|
|
223
|
+
|
|
224
|
+
tiangong-lca-skills
|
|
225
|
+
= top-level workflows + child semantic authoring skills
|
|
226
|
+
|
|
227
|
+
tiangong-ai/skills
|
|
228
|
+
= floating source-evidence and document-extraction runtime skills resolved with pnpm dlx skills
|
|
229
|
+
|
|
230
|
+
profiles
|
|
231
|
+
= generic / bafu / uslci constraints
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Toolchain And Typed-Spine Boundary
|
|
235
|
+
|
|
236
|
+
Foundry's non-JSX Node runtime is standardized on Node.js 24, `pnpm@11.24.0`, TypeScript `7.0.2`, Oxlint, and Prettier. pnpm is the sole dependency manager and owns the only root workspace and lockfile. The compiler graph must contain TypeScript 7.0.2 only and enforce erasable-only runtime syntax; tracked `.jsx`/`.tsx`, TypeScript 5/6 aliases, `@typescript-eslint`, and formatting plugins that load the TypeScript compiler API are not compatibility paths. Git inventory is reconciled against intentional first-party Oxlint and typecheck file lists; root lint disables nested configs, bans TypeScript suppression comments, and runs a comment-aware tracked-TypeScript native-disable audit before Oxlint. Repository-local Git environment is stripped before that audit or its fixture commands target another root, keeping hook state out of the parent index. The build removes the exact stale `dist` tree before compilation, and `noEmitOnError` prevents TypeScript diagnostics from emitting replacement JavaScript; arbitrary I/O failures are outside that guarantee. Emitted and source runtimes use one trusted-root/active-entry resolver rather than deriving repository state from an output directory or CWD.
|
|
237
|
+
|
|
238
|
+
Issue #82 moves only the package-manager compatibility edge from 11.23.0 to 11.24.0. The root workspace, byte-identical lock, resolved graph, Node 24.19.0 / TypeScript 7.0.2 single tracks, CI topology, command runtime, and remote-write ownership remain unchanged.
|
|
239
|
+
|
|
240
|
+
The historical Issue #63 baseline contained 160 tracked JavaScript artifacts: 95 runtime files, 64 tests, and one Prettier config. The migration is complete. A permanent zero-JavaScript ratchet and TS-only compiler/test/lint graph now replace the retired migration ledger. The typed spine was introduced in dependency order:
|
|
241
|
+
|
|
242
|
+
```text
|
|
243
|
+
entrypoint + args
|
|
244
|
+
-> command registry + metadata
|
|
245
|
+
-> runtime I/O + artifact/receipt contracts
|
|
246
|
+
-> semantic command families
|
|
247
|
+
-> scenario and real-case fixtures
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
This boundary avoids a misleading bulk rename. Each module remains in the inventory until a TypeScript replacement preserves its command, artifact, stdout, exit, and safety behavior under focused tests. Completion means no untyped business-runtime modules remain and the full case-driven suite is green.
|
|
251
|
+
|
|
252
|
+
The native TypeScript leaf set now also covers decision context, identity reference rewrite, full-context proof, and preflight artifact factories. Focused characterization preserves queue/context SHA scopes, exact reference rows/reports, fail-closed missing evidence, transform relevance, request/report artifact facts, CommandSpec argv, first-bound source indexes, positive-only execution reuse, and every static consumer. `decision-task-utils.ts` and `identity-preflight-artifacts.ts` now model their dependency injection, queue/context/proof, dataset request and source-index shapes directly; external JSON stays `unknown` until its local boundary, and an Oxlint AST contract keeps this family free of explicit `any` without moving search or execution authority.
|
|
253
|
+
|
|
254
|
+
The source-semantics, reusable TIDAS-row, and identity-reference-rewrite leaves now expose concrete local dependency and evidence shapes with `unknown` narrowed at dynamic JSON boundaries instead of explicit `any`. Worktree-local Oxlint AST contracts guard those exact production/test targets without introducing a compiler-API dependency; the change remains type-only and does not move source policy, reference decisions, filesystem errors, CLI dispatch, or remote-write authority.
|
|
255
|
+
|
|
256
|
+
After the decision, source and proof families converge, `.oxlintrc.json` promotes `typescript/no-explicit-any` to one global error and removes every family-specific override. `zero-javascript-ratchet.test.mts` validates both raw and printed rule graphs and a controlled failing fixture, so all first-party TypeScript remains covered without a TS6 compatibility compiler.
|
|
257
|
+
|
|
258
|
+
The typed BAFU family and import-ledger leaves preserve two local control-plane boundaries: deterministic family grouping/ranking over ordered signature hashes, and append-only resume evidence over verified, blocked, dependency, retry, and skipped JSONL rows. `cli-bounded-batch-runner.ts` projects those family group keys into the public CLI scheduler's exclusive-resource queue and wraps the entire run in its cross-process lock; only independent families/scopes claim in parallel. Foundry callbacks still own database-command delegation and every ledger/report byte, so command ownership, public help, profile defaults, and remote authority do not move.
|
|
259
|
+
|
|
260
|
+
The public `bafu-batch-import-run.ts` file contains only re-exports. `bafu-batch-command-runtime.ts` is a composition root, not a semantic owner: it installs the runtime/profile adapters and combines selection, semantic callbacks, CLI scheduling, and final reports. Its explicit 1,700-line ceiling makes remaining composition density visible; the ordinary semantic-stage target remains 800 lines and applies to the focused modules reached from it.
|
|
261
|
+
|
|
262
|
+
The typed canonical-support and bundle-sampling leaves own local reference rewriting and source-package materialization, not amount conversion or remote execution. Canonical scale evidence is collected before the package-local FP reference is replaced: the explicit blocking flag distinguishes a known positive non-1 factor from an unresolved missing/non-finite/non-positive factor, and projects either blocker into the report and process-scope ledger. Without that flag, existing profile behavior remains compatible.
|
|
263
|
+
|
|
264
|
+
The typed import-ledger boundary now models its JSON graph, external dependencies, report state unions, every emitted row family, manifest and write results directly. Unknown external values are narrowed at the boundary and no explicit `any` remains; the emitted append-only schema and byte/order/hash behavior are unchanged. Typed fixture roots/finalize builders remain test-only delivery infrastructure and do not enter the runtime dependency graph.
|
|
265
|
+
|
|
266
|
+
The high-fan-in runtime utility boundary is native TypeScript and owns only Foundry-local file/path/frontmatter/env-file/stage mechanics plus exact installed-package discovery. The focused runtime-path leaf resolves a trusted package root and the active source/emitted entry; the runtime-environment leaf creates allowlisted child environments with isolated local state. Runtime tests execute only local Node subprocesses and explicit temporary env files or the internal filesystem-env-disabled policy; production credentials and repository `.env` remain outside the test boundary.
|
|
267
|
+
|
|
268
|
+
The typed location-quality boundary reads the installed CLI location vocabulary and discovers only schema/fallback-declared location fields. It creates local authoring commands, queue context and blockers; the CLI owns classification lookup/apply and the schema package owns valid codes. Missing schema evidence yields an empty valid-code map rather than approving unknown values, and invalid targets remain blocking before finalize.
|
|
269
|
+
|
|
270
|
+
The typed prewrite-cleanup boundary performs deterministic transformations only after authoring evidence exists. It first plans datetime handling across the complete batch: full timezone-qualified syntax, Gregorian calendar, clock, and offset components must validate before any update is applied. A single invalid value returns ordered blockers, no cleaned rows, and zero sentinel/proof/trace/namespace/redaction counts. Only a blocker-free plan may proceed to required-field sentinel completion, UTC normalization, source/final exchange proof, import-only trace externalization, namespace repair and local locator redaction; four-digit year-boundary offset values remain byte-preserved when a UTC projection would require an extended year. Source and final exchange signatures exclude only permitted flow-reference rewrites; their array and object order remains content-addressed. It cannot invent source evidence or grant write authority.
|
|
271
|
+
|
|
272
|
+
The typed workflow-queue-context boundary reads local queue manifests, task rows, closure dependencies and optional authoring JSONL indexes without changing their encounter order or evidence bytes. It attaches that evidence to curation packages using exact-version then id-only lookup and retains native missing, malformed and invalid-dependency failures; it does not execute queue work or expand remote-write authority.
|
|
273
|
+
|
|
274
|
+
The typed internal full-context-proof boundary reads content-addressed authoring packages, decision tasks, shared context bundles and row artifacts. It verifies exact bytes, required non-empty kinds/files, task kind/status and payload identity hashes while preserving evidence encounter order and existing parse envelopes. It constructs blockers only; schema ownership, AI decisions and remote execution remain outside this module.
|
|
275
|
+
|
|
276
|
+
The typed decision-apply-context boundary projects an existing classification apply report into local evidence: normalized decisions, bound decision-task proof, resolved input/output row paths, content hashes and applied count. It preserves report order and aliases and performs no decision application, schema mutation or remote operation.
|
|
277
|
+
|
|
278
|
+
The typed profiles-config boundary reads and normalizes the repository's declarative import profiles, then projects profile lookup and listing views. It preserves configuration order, fallbacks, waiver scopes and account-local override evidence; it does not own schema rules or permit a profile to bypass downstream gates beyond its already-declared policy.
|
|
279
|
+
|
|
280
|
+
The typed workflow-patch-collect boundary validates AI patch-set structure, targets, action closure, resolution/evidence contracts and specialized trace/classification/location decisions, then exposes local artifact readers used by downstream context modules. It neither applies patches nor writes remotely; deterministic blocker order and native malformed-artifact failures remain part of admission evidence.
|
|
281
|
+
|
|
282
|
+
The typed workflow-identity-decision-context boundary reads identity apply/rewrite artifacts, normalizes their aliases, binds authoring-package and row-payload proof, indexes decisions for later gates and merges multiple reports without reordering first-seen evidence. It does not search, decide identity, rewrite rows or execute remote operations.
|
|
283
|
+
|
|
284
|
+
The typed workflow-patch-evidence-context boundary indexes deterministic patch-apply evidence, binds input/output row hashes, checks trace evidence alternatives and snapshots active safety/profile policy. It supplies proof to mutation/reference-closure gates without applying patches, performing cleanup or granting remote-write authority.
|
|
285
|
+
|
|
286
|
+
The typed workflow-row-transform-context boundary projects existing transform reports into content-bound edges and answers whether an expected rows artifact is reachable from decision outputs. It may compare exact bytes for deterministic no-op copies, but it never rewrites rows, invents an edge or grants mutation authority.
|
|
287
|
+
|
|
288
|
+
The typed dry-run context projects owner-command result files into local identity maps; the typed evidence-scope context compares every required report to the exact final rows and emits ordered blockers. Neither performs validation, curation, patching, dry-run execution, verification or remote writes.
|
|
289
|
+
|
|
290
|
+
The typed decision-full-context boundary evaluates existing classification, location, identity and deterministic transform proof without applying decisions. Authoring task, semantic action and patch evidence helpers form one existing, characterized SCC; they are compiled as a single native-TypeScript closure so no `.mjs`/`.ts` dual track can split their runtime identity. The typed identity-preflight boundary resolves local request/report artifacts, validates execution receipts and payload freshness, and projects read-only candidate evidence into curation blockers. These modules preserve hashes, encounter order and fail-closed errors; Edge/database search and CLI execution remain outside Foundry.
|
|
291
|
+
|
|
292
|
+
The typed authoring facades expose that SCC without wrapping or duplicating it. The package runner copies immutable content-addressed authoring snapshots and writes ordered local task manifests; the patch runner classifies local task outputs and writes an ordered batch only after every blocker check passes. Both are filesystem-only Foundry adapters and neither applies patches, invokes the CLI, or grants mutation authority.
|
|
293
|
+
|
|
294
|
+
The typed curation planning boundary follows those authoring layers. `curation-gate-workflow.ts` is a live-reference aggregate; `curation-gate.ts` reads local rows and evidence into ordered blockers, authoring packages and reports; `curation-cleanup.ts` deep-clones rows, runs the batch-wide strict datetime plan, and only then performs deterministic sentinel, trace, proof and redaction transforms. Its blocked report carries a null cleaned path and never deletes pre-existing bytes; retained default output becomes an explicit blocker, while explicit output remains untouched and unreferenced. Their byte/order contracts are local Foundry evidence only and do not execute or authorize a database mutation.
|
|
295
|
+
|
|
296
|
+
The typed command-owner layer now includes filesystem task/completion aggregation, commit handoff and identity task preparation, and canonical support-cache refresh/autofill. These factories keep their injected/local orchestration boundaries: task/report bytes and order remain content-stable, handoff only emits artifact-bound CommandSpecs, identity tasks only snapshot and package local evidence, and support refresh performs authenticated read-only queries. No factory implements CLI mutation, database semantics, review, or publication.
|
|
297
|
+
|
|
298
|
+
The typed mutation reference stack remains an offline planning boundary. Reference closure classifies local roots and externally proven dependencies without querying or mutating the database; source context admits only ordered, in-scope public-canonical proofs; mutation manifest aggregates exact evidence and writes JSON/JSONL partitions. If any item is blocked, no write-candidate payload is emitted for execution.
|
|
299
|
+
|
|
300
|
+
The typed dataset-orchestration layer composes those owners without absorbing them. The generic library workflow prepares deduplicated library and scope artifacts; BAFU classification, auto-authoring and process-scope owners retain dataset-specific policy; the shared batch engine adds exact-authority resume ledgers, compact consumed-attempt state, bounded parallelism, interruption/preflight modes and explicit handoff delegation. It owns local ordering and checkpoints, not CLI mutation, profile meaning, remote state or publication.
|
|
301
|
+
|
|
302
|
+
The generic ready-scope execution path is split into three bounded owners. `ready-process-scope-runner.ts` retains ready/block/report semantics and input ordering; `ready-scope-command.ts` delegates artifact-bound specs to `@tiangong-lca/cli/command-spec`; `ready-scope-scheduler.ts` projects full scope/spec/policy and exact CLI package identity into the locked public batch engine. This replaces the former synchronous raw-argv loop with real independent concurrency, exclusive process keys, pause/stop closure and mutation no-retry. `foundry-command-spec.ts` contains no implementation—only the public re-export.
|
|
303
|
+
|
|
304
|
+
The shared BAFU/USLCI/Worldsteel batch path splits resume by evidence. `cli-bounded-batch-runner.ts` owns only the generic run contract/lock; `foundry-scope-batch-runner.ts` owns item projections and CLI event/recovery adaptation. `scope-resume-contract.ts` plus `scope-source-content.ts` bind source/shared bytes, options, stage/CommandSpec and CLI identity. `scope-resume-ledger.ts` plus `scope-resume-projection.ts` admit only exact verified/blocked rows and re-admit repaired contracts. `scope-attempt-ledger.ts` compacts consumed incomplete attempts, while `scope-mutation-recovery.ts` accepts only exact process closeout readback. `process-scope-resume.ts` binds finalize checkpoint and current report bytes; `flow-resume-ledger.ts` plus `verified-flow-write.ts` bind canonical Flow payload SHA. These local contracts can prevent replay or require reprocessing, but they cannot authorize a new remote mutation.
|
|
305
|
+
|
|
306
|
+
Verified-scope retention is split again by evidence meaning. `control-artifact-store.ts` owns immutable SHA-256 blobs and hardlink/copy/reuse verification; `control-receipt-contract.ts` owns the self-hashed receipt shape; `control-reference-projection.ts` separates required control locators from disposable payload locators; `control-receipt-verification.ts` rechecks every required blob after pruning; `scope-safe-prune.ts` owns symlink-free scope deletion; `scope-control-retention.ts` orders receipt → report binding → prune → verification; and `shared-context-cache-prune.ts` owns explicit recomputable-cache eviction. The store is run-level, while each scope report retains its own artifact identities, original/store locators, receipt SHA, and prune outcome. This is filesystem evidence/retention only and grants no mutation authority.
|
|
307
|
+
|
|
308
|
+
Canonical description transport is a small shared JSON boundary under that orchestration. `scripts/lib/canonical-description.ts` accepts scalar strings or losslessly cloneable JSON objects/arrays, preserves insertion/language/value order, and rejects unsupported values or cycles before any reference mutation. Library decision apply uses that one value for authoritative multilingual process-reference and rewrite-ledger evidence; batch identity resolution, identity apply/reference rewrite, and BAFU carry-forward preserve it without display coercion. This changes evidence fidelity only—canonical selection, payload preservation hashes outside the selected description, paths, and mutation authority stay fixed.
|
|
309
|
+
|
|
310
|
+
Post-finalize recovery command evidence has one construction boundary in `scripts/lib/bafu-orchestration/post-finalize-recovery.ts`. The helper derives `{ executable, argv, display }`, dispatches a fresh copy of the same executable/argv, passes that authority to the reader projection, and verifies the projected object exactly before returning. Thus success, failure, exception, and missing-report branches cannot diverge or hide options. This is local execution/report fidelity; it adds no CommandSpec mutation authority and does not change recovery semantics or stage ordering.
|
|
311
|
+
|
|
312
|
+
Location decision queue identity is a bounded artifact boundary in `scripts/lib/batch-orchestration/location-task-queue.ts`. Scope preparation discovers the generated queue once, stores relative path/bytes/SHA, drives suggestion from that fact, and verifies the same resolved file and relative path before apply. The drift path emits exact expected/observed facts; the stable path adds no report stage or byte change. Taxonomy choice stays with location decision tooling, while this leaf owns only local artifact continuity.
|
|
313
|
+
|
|
314
|
+
BAFU flow identity equivalence is a narrow semantic boundary inside that layer. Candidate search remains Edge/database-owned, while `scripts/lib/bafu-authoring/identity-equivalence.ts` deterministically reviews returned candidates. Exact normalized names can rank a candidate but cannot suppress an ordered non-equivalence reason; only a zero-conflict exact candidate can be reused. Physically conflicting exact-name candidates flow through local `create_new` evidence and deterministic identity apply without changing the source flow UUID.
|
|
315
|
+
|
|
316
|
+
BAFU category-map handling is split into two bounded leaves. `category-map-projection.ts` retains every supplied decision and manual-review artifact independent of task reachability; `category-map-report.ts` derives reader status/counts/blockers from that complete closure. Manual rows add compact source/reason/artifact blockers, produce `completed_with_manual_review`, and force a nonzero command exit; fully resolved inputs preserve the historical report bytes/status. This is local evidence control and does not move taxonomy choice or remote authority.
|
|
317
|
+
|
|
318
|
+
Process and batch commit handoffs share `scripts/lib/same-identity-commit-recovery.ts` as the sole same-id/version lost-success classifier. It admits only structured `23505` evidence with exact same-id/version semantics; text-only, mixed, malformed, and incomplete failures reject. `process-handoff-plan.ts` and `process-handoff-closeout.ts` keep process verification and closeout argv construction bounded, while the main process handoff preserves one mutation dispatch and carries recovery as pending until exact readback succeeds.
|
|
319
|
+
|
|
320
|
+
The batch engine delegates its asynchronous post-write closure to `scripts/lib/batch-orchestration/post-write-handoff.ts`. That stage discovers the exact commit and verification reports, uses the shared strict recovery classifier without replaying a mutation, retries only classified read-only verification failures, delegates ordinary trace-hash normalization policy, and invokes Foundry closeout only after exact owner/state/id/version/payload/root readback. The command owner continues to supply process isolation, timeouts, paths, and profile context.
|
|
321
|
+
|
|
322
|
+
`scripts/lib/batch-orchestration/scope-finalize-commit.ts` composes finalize and handoff without absorbing their owners. It holds the support-commit serialization queue and verified identity set adapter, invalidates stale support reuse, reruns finalize after support or evidence recovery, and preserves the exact three-attempt post-finalize recovery ceiling before delegating the content-bound main handoff.
|
|
323
|
+
|
|
324
|
+
The typed runtime-command layer also includes CLI wrappers, offline capsule admission and post-write closeout. Wrappers delegate to the installed CLI with an executable and argv array; capsule admission writes immutable local evidence with zero dispatch; closeout aggregates already-produced commit/readback proof without issuing a remote operation. Unique-root, owner/state/payload, accepted-diff and production-test rules remain in their typed proof owners rather than moving into transport code.
|
|
325
|
+
|
|
326
|
+
The typed command-owner layer now also includes `core.ts`, `identity-preflight-run.ts`, and `post-authoring-finalize.ts`. Core owns local runtime/bootstrap and diagnostic projection. Identity preflight invokes only the published read-only CLI through receipt-bound executable/argv arrays and content-bound request evidence. Finalize orders existing rewrite, parent cleanup, nested source/contact support finalize, validation, curation, dry-run, mutation-manifest and handoff adapters; cleanup must return `completed` plus a concrete cleaned artifact before nested support or any later stage is constructed. A blocked attempt preserves every pre-existing downstream artifact, reports the stale paths as blockers, and emits only current blocker/import-ledger evidence. None of these owners implement schema/search semantics, direct database mutation, review, or publication.
|
|
327
|
+
|
|
328
|
+
The typed decision command boundary now includes `identity-decisions.ts`, `classification-decisions.ts`, and `location-decisions.ts`. Identity validation partitions local rows into write candidates, reference reuse, and unresolved evidence without executing a remote mutation. Classification and location validate task-bound decisions, preserve queue grouping and schema/path order, and delegate deterministic apply through the existing CLI argv boundary only after blockers are empty. Their reports and artifacts remain Foundry-local evidence; schema vocabularies, search, mutation, and readback authority remain with their existing owners.
|
|
329
|
+
|
|
330
|
+
The import-curation entry topology is typed end to end. `profiles.ts` and `trace-summary.ts` are identity-preserving leaf barrels; `import-curation/index.ts` aggregates the eight semantic owner exports; `import-curation.ts` is the public entry consumed by `foundry.ts`. These modules contain no runtime wrapper or initialization logic. The CLI dispatcher still receives the same injected functions, and command metadata still names the semantic owner modules rather than assigning behavior to a barrel.
|
|
331
|
+
|
|
332
|
+
The typed adapter/tooling layer keeps external ownership explicit. `tidas-adapter.ts` only selects and validates the Rust machine contract; finalize utilities coordinate existing CLI/identity stages; cutover audit reads the TypeScript-aware Git inventory; Golden comparison creates isolated worktrees and compares normalized local outputs under one identical credential-free environment. None owns converter rules, database behavior or production mutation.
|
|
333
|
+
|
|
334
|
+
The shared fixture topology is typed end to end but remains outside the production build. `foundry-core.ts` provides worktree-local filesystem and command helpers; `row-builders.ts` feeds full-context, identity and mutation evidence fixtures; incremental and topology packages remain separate algorithm fixtures. The fake tidas process is a published-report/exit harness only and is launched through Node executable-plus-argv even without an executable bit. This layer cannot acquire credentials, network access, schema ownership, or mutation authority.
|
|
335
|
+
|
|
336
|
+
The unit-test topology is now TypeScript-only. Four migration contracts retain the established behavior families and verify that governed paths no longer name `.test.mjs`; test-local types narrow fixture/report values while the production runtime dependency graph and owner module specifiers remain unchanged.
|
|
337
|
+
|
|
338
|
+
The scenario topology is also TypeScript-only. Four migration contracts retain authoring/curation, identity/reference, mutation/finalize and library/algorithm workflow evidence; the broad fixture-report vocabulary exists only to type already-produced test JSON and grants no runtime or remote authority.
|
|
339
|
+
|
|
340
|
+
Build and test resolution must be worktree-local. A clean arbitrary Git worktree must be able to run `pnpm install --frozen-lockfile`, lint, typecheck, build, toolchain tests, and the full test suite without a superproject-relative dependency, another checkout's `node_modules`, ignored `.foundry` state, or credentials.
|
|
341
|
+
|
|
342
|
+
Cross-platform characterization is also explicit: the Golden harness compares normalized outputs to a non-`HEAD` merge-base, performs recursive comparison in Node rather than calling an external Unix utility, and uses full Git history in CI. Script-backed executable overrides are represented as an executable plus argv prefix and run through Node on macOS, Linux, and Windows. The root `.gitattributes` fixes text files to LF while allowing Windows launcher exceptions, preventing checkout policy from masquerading as format drift.
|
|
343
|
+
|
|
344
|
+
The first credential-bearing entrypoint on that spine is `scripts/with-lca-account.ts`. It does not authenticate against Supabase itself. It resolves the exact installed CLI 0.1.12, requests `auth identity-receipt` with both expected project and user assertions, accepts only a fresh intent-bound forced signin, and then launches the requested executable plus argv with `shell:false` and a restricted environment. The CLI owns session and live identity behavior; Foundry owns the profile/thread intent checks and safe process boundary.
|
|
345
|
+
|
|
346
|
+
`scripts/lib/identity-preflight-proof.ts` imports the strict parser from the public `@tiangong-lca/cli/auth-identity-receipt` subpath. `test/fixtures/auth-identity-receipt.ts` is the sole test-only wire-fixture owner and produces bytes that must pass that public parser. No production module or fixture may load CLI `dist/src/**`; the installed-package contract also exercises public batch scheduling/run-lock behavior and proves the private path remains closed.
|
|
347
|
+
|
|
348
|
+
The artifact layer treats JSON paths as portable identifiers: scope extraction normalizes separators, transitional command parsers retain native backslashes, and durable writers flush a writable descriptor before close. POSIX file-mode assertions are evidence on POSIX platforms rather than a fabricated Windows contract.
|
|
349
|
+
|
|
350
|
+
The handoff execution boundary is typed and content-addressed. `scripts/lib/foundry-command-spec.ts` strictly parses `tiangong-foundry.command-spec.v1`, rejects duplicate safety-critical flags, and hashes `executable`, `argv`, and artifact bindings. `display` is derived but non-authoritative. Commit and verify bind the same `final_rows_artifact`; BAFU runners re-read its byte count and SHA-256 before spawning the published CLI without a shell.
|
|
351
|
+
|
|
352
|
+
## Foundry-Owned Layers
|
|
353
|
+
|
|
354
|
+
1. Task intake
|
|
355
|
+
- create or classify a task
|
|
356
|
+
- choose `external-dataset-curated-import` or `source-evidence-dataset-development`
|
|
357
|
+
- freeze `source-manifest.json` or `seed-manifest.json`
|
|
358
|
+
|
|
359
|
+
2. Profile lock
|
|
360
|
+
- resolve profile id
|
|
361
|
+
- freeze constraints hash
|
|
362
|
+
- record account/write policy guard
|
|
363
|
+
|
|
364
|
+
3. Workspace ledger
|
|
365
|
+
- manage `.foundry/workspaces/<task-id>/`
|
|
366
|
+
- maintain `foundry-job.json`, checkpoints, and `artifact-index.jsonl`
|
|
367
|
+
- record runtime skill resolution when external evidence skills are used
|
|
368
|
+
|
|
369
|
+
4. Route to owner
|
|
370
|
+
- call published CLI commands or top-level skills
|
|
371
|
+
- do not duplicate owner behavior locally
|
|
372
|
+
|
|
373
|
+
5. Gate aggregate
|
|
374
|
+
- check that schema, QA, curation, queue verify, dry-run, closeout, and readback artifacts exist
|
|
375
|
+
- verify artifacts point to the same rows scope
|
|
376
|
+
- accept identity/classification/location evidence across deterministic row transforms such as source/contact rewrites, canonical support rewrites, identity reference rewrites, unresolved-exchange externalization, and cleanup
|
|
377
|
+
- reconcile deterministic source-only-output exchange proofs from cleanup against final-row `sourceExchangeCompleteness` traces
|
|
378
|
+
- generate completion reports
|
|
379
|
+
|
|
380
|
+
6. Whole-library scope orchestration
|
|
381
|
+
- build root TIDAS unique-entity indexes for packaged imports
|
|
382
|
+
- project library-level identity/classification/support decisions back to process scopes
|
|
383
|
+
- resolve bundle manifest and `tidas_dir` paths relative to `process-bundles/index.json`
|
|
384
|
+
- record ready scope checkpoints, blocked-scope ledgers, and reader-facing blocked-scope reports without turning blocked scopes into write candidates
|
|
385
|
+
|
|
386
|
+
7. Incremental release planning
|
|
387
|
+
- compare old source semantics, new candidate semantics, and a current owner-draft snapshot under one SHA-bound request
|
|
388
|
+
- enforce strict Draft 2020-12 inputs/outputs and entity/path/value/evidence-bound three-way rules, then emit minimal INSERT/UPDATE candidates, complete NOOP/HOLD evidence, stable dependency order, and one hash-chained terminal log event per schema-valid conversion
|
|
389
|
+
- stop at an offline `production_authority=false` CLI candidate contract; fresh reconciliation, owner session, capsule admission, mutation, and readback remain outside Foundry
|
|
390
|
+
|
|
391
|
+
8. Topology convergence planning
|
|
392
|
+
- bind a complete candidate flow/process closure to one package digest and one fresh owner/public/foreign SELECT-only census
|
|
393
|
+
- classify target flows without overwriting public or foreign rows, reconstruct ordered process exchanges by process-local source number plus occurrence, and preserve only explicitly audited multilingual overlays
|
|
394
|
+
- emit separate F flow-create and P process-save contracts while keeping D as zero-inbound delete candidates; protected transactions, attempt state, post-P inbound proof, and delete execution remain CLI/database responsibilities
|
|
395
|
+
|
|
396
|
+
9. Local behavior test structure
|
|
397
|
+
- keep unit tests, command contract tests, multi-command scenarios, and shared fixtures in the `test/README.md` layout
|
|
398
|
+
- protect Foundry orchestration and artifact contracts locally without absorbing reusable CLI, skill, SDK, database, or Edge behavior
|
|
399
|
+
|
|
400
|
+
10. Surface cleanup
|
|
401
|
+
|
|
402
|
+
- remove compatibility aliases, empty command categories, and draft orchestration references once current commands, metadata, tests, docs, and docpact show no remaining consumer
|
|
403
|
+
- keep historical or dataset-specific guidance only when it has an active route, profile, task, or retained reference role
|
|
404
|
+
|
|
405
|
+
## v0 Runtime
|
|
406
|
+
|
|
407
|
+
The v0 runtime is intentionally small:
|
|
408
|
+
|
|
409
|
+
- filesystem task queue
|
|
410
|
+
- queue/checkpoint-aware batch execution contracts, including task-scoped `max_parallelism`
|
|
411
|
+
- workflow/task validation script
|
|
412
|
+
- read-only workspace map diagnostic
|
|
413
|
+
- no persistent database
|
|
414
|
+
- no direct database commit from Foundry code; remote commit is allowed only through official CLI/platform commands when profile gates, write policy, commit handoff, and post-write verification are satisfied
|
|
415
|
+
- profile-authorized owner-draft support maintenance remains a CLI/database responsibility: Foundry freezes the candidate registry and complete-plan evidence, while the CLI submits one database-atomic plan and records its audit/readback proof; Foundry must not split that plan into independently committed dimension batches
|
|
416
|
+
- remote verification never treats a foreign or RLS-hidden `state_code=0` row as reusable evidence: `missing_dataset` remains blocking until the importing account can read an allowed public or same-owner reference. The retained normalization is limited to exact root payloads differing only in import-trace `traceHash`, and production-test accounts disable even that acceptance.
|
|
417
|
+
- generated support rows may get Foundry-prepared finalize and commit-handoff artifacts. They are contact/source by default; a frozen adapter/profile pair may add canonical-cache-miss Unit Group/Flow Property candidates through the explicitly enabled generic support path. Canonical rows remain public-cache reuse, candidates remain same-owner drafts, and dependent process/flow/lifecyclemodel scopes must wait for support commit and readback while independent ready scopes may continue
|
|
418
|
+
- the exact installed CLI dependency is the default command path: `pnpm exec tiangong-lca ...`
|
|
419
|
+
- test execution is local and layered: `pnpm test` runs all behavior layers, while `pnpm test:unit`, `pnpm test:commands`, and `pnpm test:scenarios` target specific Foundry-owned surfaces; `pnpm test:toolchain` protects the pnpm/TS7 graph and migration inventory
|
|
420
|
+
|
|
421
|
+
## Retired v1 Daemon Direction
|
|
422
|
+
|
|
423
|
+
Poll loops, persistent daemons, app-server integration, unbounded concurrency orchestration, retry schedulers, and reconciliation workers are not part of the current Foundry architecture. Bounded parallel batch execution is represented as task workspace policy plus CLI queue locks/checkpoints, not as a resident Foundry daemon. Broader runtime workers may be reconsidered only after the two lane workflows are stable and the owner command surfaces are complete.
|
|
424
|
+
|
|
425
|
+
Retired direction:
|
|
426
|
+
|
|
427
|
+
```text
|
|
428
|
+
poll tasks -> claim -> create workspace -> launch agent -> collect outputs -> update task state -> verify -> repeat
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## Workspace-Aware Direction
|
|
432
|
+
|
|
433
|
+
The foundry should call the owning workspace surface instead of absorbing implementation:
|
|
434
|
+
|
|
435
|
+
- `tidas-tools`: unified Rust `tidas` owner for deterministic format detection, package import/conversion, schema validation, stable machine reports/exits, cancellation, and atomic publication
|
|
436
|
+
- `tiangong-lca-cli`: default command surface for contract context, source authoring, QA/curation, remote data operations, and handoff
|
|
437
|
+
- `tiangong-lca-skills`: agent-facing wrappers over CLI commands
|
|
438
|
+
- `tiangong-ai/skills`: runtime-only source-evidence and document extraction skills such as `document-granular-decompose` and `tiangong-kb-sci-search`, resolved through `pnpm dlx skills@latest`
|
|
439
|
+
- `tiangong-lca-edge-functions`: Edge Function runtime, including Hybrid Search request orchestration and `embedding_ft` jobs; Foundry forwards one `lexical_weight` and one `semantic_weight`
|
|
440
|
+
- `database-engine`: database RPCs, triggers, vector indexes, and schema governance
|
|
441
|
+
- `tidas`: TIDAS specification
|
|
442
|
+
- `tidas-sdk`: compatibility SDK and context APIs
|
|
443
|
+
|
|
444
|
+
See `docs/workspace-project-map.md` and `specs/workspace-capability-adapters.md` for the routing contract.
|
|
445
|
+
|
|
446
|
+
The public traceHash adapter delegates normalization to `remote-verification-accepted-diff.ts`. It supplies qualified CLI reads, retains original/accepted reports, and binds the fresh domain payload to the original remote hash. Canonical row envelopes are unwrapped only for comparison. Explicit account verification mode survives task registration and migration templates; production-test mode cannot enter the accepted-difference path.
|
|
447
|
+
|
|
448
|
+
The prepared-approval adapter can bridge cleanup byte changes for an otherwise valid support scope by using the existing registered grant derivation, then re-running the finalize owner on the bound descendant. Eligibility is limited to the support-permission blocker with complete scoped write/mint actions. It preserves completed dependency generations and stops on unchanged blocked authorization state. No profile hash check or write admission guard is relaxed.
|
|
449
|
+
|
|
450
|
+
Source CI execution is separate from the consumer runtime: complete isolated test partitions and exact version-only PR classification are owned by CI tooling. One verified package snapshot may be reused across native qualification and signing through independently supplied artifact digests and exact source/toolchain/run binding. Downloaded manifests and serialized receipts cannot issue snapshot authority. The final release always performs full four-platform qualification; consumer credentials, task state, authorization and no-replay behavior are unchanged.
|