@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,13 @@
|
|
|
1
|
+
import { createIdentityPreflightRunCommands } from "./decision-owners/identity-preflight.ts";
|
|
2
|
+
import type { FoundryRuntimeContext } from "./foundry-runtime-context.ts";
|
|
3
|
+
import { type QualifiedFoundryRuntime } from "./foundry-runtime-qualification.ts";
|
|
4
|
+
interface FoundryIdentityOwners {
|
|
5
|
+
preflight: ReturnType<typeof createIdentityPreflightRunCommands>;
|
|
6
|
+
invoke<T>(action: () => T): T;
|
|
7
|
+
}
|
|
8
|
+
/** Current row payloads and explicit child execution facts, without the developer dispatcher. */
|
|
9
|
+
export declare function createFoundryIdentityOwners(context: FoundryRuntimeContext, qualified: QualifiedFoundryRuntime, type: "flow" | "process", execution: {
|
|
10
|
+
environment: NodeJS.ProcessEnv;
|
|
11
|
+
cwd: string;
|
|
12
|
+
}): FoundryIdentityOwners;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { parseScalar } from "./foundry-args.js";
|
|
2
|
+
import { createFoundryRuntimeUtils, resolveTiangongLcaCliRuntimeCommand, } from "./foundry-runtime-utils.js";
|
|
3
|
+
import { createTidasRowUtils } from "./tidas-row-utils.js";
|
|
4
|
+
import { bundleRowTypes } from "./bundle-row-types.js";
|
|
5
|
+
import { createBundleSourceContextUtils } from "./bundle-source-context.js";
|
|
6
|
+
import { createDecisionTaskUtils } from "./decision-task-utils.js";
|
|
7
|
+
import { createIdentityPreflightArtifactUtils } from "./identity-preflight-artifacts.js";
|
|
8
|
+
import { createIdentityPreflightRunCommands } from "./decision-owners/identity-preflight.js";
|
|
9
|
+
import { datasetIdentity, unwrapDatasetPayload, } from "./import-curation/internal/dataset-payload.js";
|
|
10
|
+
import { ensureArray } from "./import-curation/internal/runtime-io.js";
|
|
11
|
+
import { workflowObject } from "./foundry-workflow-state.js";
|
|
12
|
+
import { assertQualifiedFoundryRuntime, } from "./foundry-runtime-qualification.js";
|
|
13
|
+
/** Current row payloads and explicit child execution facts, without the developer dispatcher. */
|
|
14
|
+
export function createFoundryIdentityOwners(context, qualified, type, execution) {
|
|
15
|
+
assertQualifiedFoundryRuntime(context, qualified);
|
|
16
|
+
const runtime = createFoundryRuntimeUtils({ parseScalar, repoRoot: context.assetRoot });
|
|
17
|
+
const cli = resolveTiangongLcaCliRuntimeCommand({});
|
|
18
|
+
const rows = createTidasRowUtils({ ...runtime, bundleRowTypes });
|
|
19
|
+
const sources = createBundleSourceContextUtils({ asText: runtime.asText });
|
|
20
|
+
const decisions = createDecisionTaskUtils({
|
|
21
|
+
...runtime,
|
|
22
|
+
ensureArray,
|
|
23
|
+
readJson: (file) => workflowObject(runtime.readJson(file)),
|
|
24
|
+
readJsonLines: (file) => runtime.readJsonLines(file).map(workflowObject),
|
|
25
|
+
});
|
|
26
|
+
const dependencies = {
|
|
27
|
+
...runtime,
|
|
28
|
+
...rows,
|
|
29
|
+
...sources,
|
|
30
|
+
safeFileToken: decisions.safeFileToken,
|
|
31
|
+
resolveTiangongLcaCliCommand: () => cli,
|
|
32
|
+
resolveTiangongLcaCliCommandPrefix: () => [cli.command, ...cli.args],
|
|
33
|
+
resolveTiangongLcaCliBin: () => cli.display,
|
|
34
|
+
ensureArray,
|
|
35
|
+
readRowsFile: (file) => runtime.readRowsFile(file).map((row) => workflowObject(unwrapDatasetPayload(row, type))),
|
|
36
|
+
datasetIdentity: (row, datasetType) => datasetIdentity(row, 0, datasetType),
|
|
37
|
+
};
|
|
38
|
+
const artifacts = createIdentityPreflightArtifactUtils(dependencies);
|
|
39
|
+
const preflight = createIdentityPreflightRunCommands({
|
|
40
|
+
...dependencies,
|
|
41
|
+
...artifacts,
|
|
42
|
+
executionEnvironment: execution.environment,
|
|
43
|
+
executionCwd: execution.cwd,
|
|
44
|
+
repoRoot: context.assetRoot,
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
preflight,
|
|
48
|
+
invoke(action) {
|
|
49
|
+
const exitCode = process.exitCode;
|
|
50
|
+
try {
|
|
51
|
+
return action();
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
process.exitCode = exitCode;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FoundryRuntimeCommandHost } from "../runtime-entry.ts";
|
|
2
|
+
export declare const FOUNDRY_MANAGED_RUNTIME_SCHEMA: "tiangong-foundry.managed-runtime.v1";
|
|
3
|
+
export declare const FOUNDRY_MANAGED_RUNTIME_PATH: "metadata/foundry-runtime.json";
|
|
4
|
+
type PreparedHost = Omit<FoundryRuntimeCommandHost, "signal" | "writeStdout" | "setExitCode">;
|
|
5
|
+
/** Package-owned initializer; it accepts no task, environment or argv trust anchors. */
|
|
6
|
+
export declare function receiveFoundryManagedHost(signal: AbortSignal): Promise<PreparedHost>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { RUNTIME_HOST_CONTEXT_PROTOCOL, assertCliRuntimeMatches, inspectRuntimeComponents, receiveRuntimeHostContext, trustRuntimeManifest, } from "@tiangong-lca/cli/runtime";
|
|
4
|
+
import { FoundryContextError } from "./foundry-runtime-error.js";
|
|
5
|
+
import { describeFoundryRuntime } from "./foundry-runtime-paths.js";
|
|
6
|
+
import { assertFoundryPackage } from "./foundry-package-contract.js";
|
|
7
|
+
import { parseFoundryTidasRuntimeExpectation } from "./foundry-runtime-qualification.js";
|
|
8
|
+
import { transferHash, transferRead } from "./foundry-migration-transfer-io.js";
|
|
9
|
+
export const FOUNDRY_MANAGED_RUNTIME_SCHEMA = "tiangong-foundry.managed-runtime.v1";
|
|
10
|
+
export const FOUNDRY_MANAGED_RUNTIME_PATH = "metadata/foundry-runtime.json";
|
|
11
|
+
const identifier = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/u;
|
|
12
|
+
function fail(message) {
|
|
13
|
+
throw new FoundryContextError("managed_runtime_invalid", message);
|
|
14
|
+
}
|
|
15
|
+
function object(value, keys, label) {
|
|
16
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
17
|
+
fail(`${label} must be an object.`);
|
|
18
|
+
const item = value;
|
|
19
|
+
if (Object.keys(item).length !== keys.length || keys.some((key) => !Object.hasOwn(item, key)))
|
|
20
|
+
fail(`${label} has missing or unsupported fields.`);
|
|
21
|
+
return item;
|
|
22
|
+
}
|
|
23
|
+
function reference(value) {
|
|
24
|
+
const item = object(value, ["component", "path"], "Managed component reference");
|
|
25
|
+
if (typeof item.component !== "string" ||
|
|
26
|
+
!identifier.test(item.component) ||
|
|
27
|
+
typeof item.path !== "string")
|
|
28
|
+
fail("Managed component references require a declared component and file.");
|
|
29
|
+
return { component: item.component, path: item.path };
|
|
30
|
+
}
|
|
31
|
+
function decode(bytes) {
|
|
32
|
+
return JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
33
|
+
}
|
|
34
|
+
function prepare(context) {
|
|
35
|
+
const runtime = describeFoundryRuntime(import.meta.url);
|
|
36
|
+
const descriptor = assertFoundryPackage(runtime.runtimeRoot);
|
|
37
|
+
if (runtime.mode !== "emitted" ||
|
|
38
|
+
context.manifest.manifest.product.id !== "tiangong-foundry" ||
|
|
39
|
+
context.manifest.manifest.product.version !== descriptor.package.version)
|
|
40
|
+
fail("The managed manifest must select this installed Foundry package.");
|
|
41
|
+
const inspected = inspectRuntimeComponents(context.manifest, {
|
|
42
|
+
cacheDir: context.cacheDir,
|
|
43
|
+
host: context.host,
|
|
44
|
+
});
|
|
45
|
+
if (inspected.status !== "ready")
|
|
46
|
+
fail("Managed components changed before Foundry admission.");
|
|
47
|
+
const selected = context.manifest.manifest.launches.find((item) => item.platform === context.host.platform && item.id === context.entry);
|
|
48
|
+
if (!selected ||
|
|
49
|
+
selected.context_protocol !== RUNTIME_HOST_CONTEXT_PROTOCOL ||
|
|
50
|
+
selected.argv.length !== 1)
|
|
51
|
+
fail("The managed launch must select the Foundry package entry directly.");
|
|
52
|
+
const application = reference(selected.argv[0]);
|
|
53
|
+
const file = (ref) => {
|
|
54
|
+
const component = context.manifest.manifest.components.find((item) => item.platform === context.host.platform && item.id === ref.component);
|
|
55
|
+
const fact = component?.files.find((item) => item.path === ref.path);
|
|
56
|
+
const installed = inspected.components.find((item) => item.id === ref.component && item.status === "ready");
|
|
57
|
+
if (!component || !fact || !installed)
|
|
58
|
+
fail("Managed runtime bindings must name verified component files.");
|
|
59
|
+
return { component, fact, absolute: path.join(installed.root, fact.path) };
|
|
60
|
+
};
|
|
61
|
+
const bytes = (ref, limit) => {
|
|
62
|
+
const bound = file(ref);
|
|
63
|
+
if (bound.fact.bytes > limit)
|
|
64
|
+
fail("Managed runtime metadata exceeds its admission limit.");
|
|
65
|
+
const value = transferRead(bound.absolute, limit);
|
|
66
|
+
if (value.length !== bound.fact.bytes || transferHash(value) !== bound.fact.sha256)
|
|
67
|
+
fail("Managed runtime metadata changed after component verification.");
|
|
68
|
+
return value;
|
|
69
|
+
};
|
|
70
|
+
const applicationFile = file(application);
|
|
71
|
+
if (!applicationFile.component.protocols.includes(FOUNDRY_MANAGED_RUNTIME_SCHEMA) ||
|
|
72
|
+
fs.realpathSync(applicationFile.absolute) !== runtime.entryPath ||
|
|
73
|
+
!process.argv[1] ||
|
|
74
|
+
fs.realpathSync(process.argv[1]) !== runtime.entryPath ||
|
|
75
|
+
runtime.entryRepoRelativePath !== descriptor.package.bin)
|
|
76
|
+
fail("The managed launch and executing package entry do not match.");
|
|
77
|
+
const decoded = decode(bytes({ component: application.component, path: FOUNDRY_MANAGED_RUNTIME_PATH }, 256 * 1024));
|
|
78
|
+
if (decoded &&
|
|
79
|
+
typeof decoded === "object" &&
|
|
80
|
+
!Array.isArray(decoded) &&
|
|
81
|
+
"schema" in decoded &&
|
|
82
|
+
typeof decoded.schema === "string" &&
|
|
83
|
+
decoded.schema !== FOUNDRY_MANAGED_RUNTIME_SCHEMA)
|
|
84
|
+
throw new FoundryContextError("managed_runtime_unsupported", "This Foundry package cannot read the selected managed runtime protocol.");
|
|
85
|
+
const input = object(decoded, ["schema", "platform", "cli", "tidas", "launches"], "Foundry managed runtime");
|
|
86
|
+
if (input.schema !== FOUNDRY_MANAGED_RUNTIME_SCHEMA)
|
|
87
|
+
fail("Managed runtime metadata requires its supported schema identifier.");
|
|
88
|
+
if (input.platform !== context.host.platform)
|
|
89
|
+
fail("Managed runtime metadata must match the current platform.");
|
|
90
|
+
const cli = object(input.cli, ["schema", "package_version", "platform", "content_sha256", "node_version", "node_sha256"], "Managed CLI expectation");
|
|
91
|
+
const observedCli = assertCliRuntimeMatches(cli);
|
|
92
|
+
if (observedCli.package.version !== descriptor.package.cli_dependency.version ||
|
|
93
|
+
file(selected.executable).fact.sha256 !== cli.node_sha256)
|
|
94
|
+
fail("The managed CLI and Node must match this package's independently selected runtime.");
|
|
95
|
+
const tidas = object(input.tidas, ["executable", "expectation"], "Managed TIDAS binding");
|
|
96
|
+
const tidasFile = file(reference(tidas.executable));
|
|
97
|
+
const tidasExpectation = parseFoundryTidasRuntimeExpectation(tidas.expectation, context.host.platform);
|
|
98
|
+
if (tidasFile.fact.mode !== 0o755 ||
|
|
99
|
+
tidasFile.fact.bytes !== tidasExpectation.executable.bytes ||
|
|
100
|
+
tidasFile.fact.sha256 !== tidasExpectation.executable.sha256)
|
|
101
|
+
fail("The managed TIDAS expectation must bind its selected executable bytes.");
|
|
102
|
+
if (!Array.isArray(input.launches) || input.launches.length < 1 || input.launches.length > 16)
|
|
103
|
+
fail("Managed runtime metadata requires a bounded launch policy.");
|
|
104
|
+
const seen = new Set();
|
|
105
|
+
const policies = input.launches.map((value) => {
|
|
106
|
+
const item = object(value, ["id", "access", "target"], "Managed launch policy");
|
|
107
|
+
if (typeof item.id !== "string" ||
|
|
108
|
+
!identifier.test(item.id) ||
|
|
109
|
+
seen.has(item.id) ||
|
|
110
|
+
(item.access !== "read" && item.access !== "write"))
|
|
111
|
+
fail("Managed launch policy requires unique ids and explicit read/write access.");
|
|
112
|
+
seen.add(item.id);
|
|
113
|
+
const launch = context.manifest.manifest.launches.find((candidate) => candidate.platform === context.host.platform && candidate.id === item.id);
|
|
114
|
+
if (!launch ||
|
|
115
|
+
launch.context_protocol !== RUNTIME_HOST_CONTEXT_PROTOCOL ||
|
|
116
|
+
launch.argv.length !== 1 ||
|
|
117
|
+
launch.executable.component !== selected.executable.component ||
|
|
118
|
+
launch.executable.path !== selected.executable.path)
|
|
119
|
+
fail("Every managed policy must select the declared Node and Foundry entry.");
|
|
120
|
+
const entry = reference(launch.argv[0]);
|
|
121
|
+
if (entry.component !== application.component || entry.path !== application.path)
|
|
122
|
+
fail("Managed launch policies cannot redirect the package entry.");
|
|
123
|
+
const target = item.target === null ? null : reference(item.target);
|
|
124
|
+
if (target)
|
|
125
|
+
file(target);
|
|
126
|
+
return { id: item.id, access: item.access, target };
|
|
127
|
+
});
|
|
128
|
+
const policy = policies.find((item) => item.id === context.entry);
|
|
129
|
+
if (!policy)
|
|
130
|
+
fail("The selected launch has no Foundry access policy.");
|
|
131
|
+
const target = policy.target
|
|
132
|
+
? trustRuntimeManifest(bytes(policy.target, 32 * 1024 * 1024), file(policy.target).fact.sha256)
|
|
133
|
+
: context.manifest;
|
|
134
|
+
if (target.manifest.product.id !== "tiangong-foundry")
|
|
135
|
+
fail("Runtime selection targets must be Foundry manifests.");
|
|
136
|
+
return Object.freeze({
|
|
137
|
+
workspaceAccess: Object.freeze({ manifest: context.manifest, access: policy.access }),
|
|
138
|
+
runtimeSelection: Object.freeze({
|
|
139
|
+
cliExpectation: Object.freeze(cli),
|
|
140
|
+
tidasExpectation,
|
|
141
|
+
tidasExecutable: tidasFile.absolute,
|
|
142
|
+
}),
|
|
143
|
+
runtimeTarget: target,
|
|
144
|
+
runtimeManager: Object.freeze({ cacheDir: context.cacheDir, host: context.host }),
|
|
145
|
+
cacheBase: path.join(context.cacheDir, "foundry-workspaces"),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/** Package-owned initializer; it accepts no task, environment or argv trust anchors. */
|
|
149
|
+
export async function receiveFoundryManagedHost(signal) {
|
|
150
|
+
if (typeof process.send !== "function")
|
|
151
|
+
return {};
|
|
152
|
+
const abort = () => {
|
|
153
|
+
if (process.connected)
|
|
154
|
+
process.disconnect?.();
|
|
155
|
+
};
|
|
156
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
157
|
+
try {
|
|
158
|
+
if (signal.aborted)
|
|
159
|
+
abort();
|
|
160
|
+
const context = await receiveRuntimeHostContext();
|
|
161
|
+
if (signal.aborted)
|
|
162
|
+
throw new FoundryContextError("operation_interrupted", "Managed startup was interrupted.");
|
|
163
|
+
return prepare(context);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
if (error instanceof FoundryContextError)
|
|
167
|
+
throw error;
|
|
168
|
+
throw new FoundryContextError("managed_runtime_invalid", "Foundry could not verify the managed host context and component bindings.");
|
|
169
|
+
}
|
|
170
|
+
finally {
|
|
171
|
+
signal.removeEventListener("abort", abort);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { TrustedRuntimeManifest } from "@tiangong-lca/cli/runtime";
|
|
2
|
+
import { type FoundryInputFact, type FoundryRuntimeContext } from "./foundry-runtime-context.ts";
|
|
3
|
+
import { type FoundryTaskStartSpec } from "./foundry-task-start-spec.ts";
|
|
4
|
+
import { type FoundryMigrationPlanningOptions } from "./foundry-migration-plan.ts";
|
|
5
|
+
import { type MigrationTaskAuthority } from "./foundry-migration-authority.ts";
|
|
6
|
+
export declare const FOUNDRY_MIGRATION_ADOPTION_PLAN_SCHEMA: "tiangong-foundry.migration-adoption-plan.v1";
|
|
7
|
+
export interface MigrationAdoptionSelection {
|
|
8
|
+
readonly sourceTask: string;
|
|
9
|
+
readonly specFile: string;
|
|
10
|
+
}
|
|
11
|
+
export type MigrationTaskTemplate = Omit<FoundryTaskStartSpec, "schema" | "account_intent"> & {
|
|
12
|
+
readonly account_intent: Omit<NonNullable<FoundryTaskStartSpec["account_intent"]>, "session_reference"> | null;
|
|
13
|
+
};
|
|
14
|
+
export declare function materializeMigrationTaskSpec(template: MigrationTaskTemplate): FoundryTaskStartSpec;
|
|
15
|
+
export declare function migrationTaskTemplate(spec: FoundryTaskStartSpec): MigrationTaskTemplate;
|
|
16
|
+
export interface MigrationAdoptionRow {
|
|
17
|
+
readonly authority: MigrationTaskAuthority;
|
|
18
|
+
readonly source_spec: FoundryInputFact | null;
|
|
19
|
+
readonly target_spec: MigrationTaskTemplate | null;
|
|
20
|
+
readonly inputs: readonly FoundryInputFact[];
|
|
21
|
+
readonly evidence_paths: readonly string[];
|
|
22
|
+
readonly reasons: readonly string[];
|
|
23
|
+
readonly scope_inputs: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
export interface FoundryMigrationAdoptionPlan {
|
|
26
|
+
readonly schema: typeof FOUNDRY_MIGRATION_ADOPTION_PLAN_SCHEMA;
|
|
27
|
+
readonly workspace_id: string;
|
|
28
|
+
readonly plan_sha256: string;
|
|
29
|
+
readonly actor_id: string;
|
|
30
|
+
readonly runtime_manifest_sha256: string;
|
|
31
|
+
readonly selections: readonly {
|
|
32
|
+
readonly source_task: string;
|
|
33
|
+
readonly spec_file: string;
|
|
34
|
+
}[];
|
|
35
|
+
readonly tasks: readonly MigrationAdoptionRow[];
|
|
36
|
+
readonly remote_write_allowed: false;
|
|
37
|
+
readonly adoption_sha256: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function planFoundryMigrationAdoption(context: FoundryRuntimeContext, planning: FoundryMigrationPlanningOptions, transfer: unknown, selections: readonly MigrationAdoptionSelection[], manifest: TrustedRuntimeManifest): Promise<FoundryMigrationAdoptionPlan>;
|