@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,668 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
5
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
|
+
import { assertWorkspaceCompatibility, } from "@tiangong-lca/cli/runtime";
|
|
7
|
+
import { describeFoundryRuntime } from "./foundry-runtime-paths.js";
|
|
8
|
+
import { FoundryContextError } from "./foundry-runtime-error.js";
|
|
9
|
+
export { FoundryContextError } from "./foundry-runtime-error.js";
|
|
10
|
+
import { FOUNDRY_MIGRATED_WORKSPACE_SCHEMA, FOUNDRY_MIGRATED_WORKSPACE_FEATURES, readFoundryMigrationAuthority, } from "./foundry-migration-authority.js";
|
|
11
|
+
import { transferRead, transferHash } from "./foundry-migration-transfer-io.js";
|
|
12
|
+
import { sha256Json } from "./identity-preflight-proof.js";
|
|
13
|
+
import { assertNotFoundrySessionFile } from "./foundry-private-path.js";
|
|
14
|
+
import { readFoundryRuntimeSelection } from "./foundry-runtime-selection-record.js";
|
|
15
|
+
import { canonicalFoundryCachePath, assertFoundryCacheRootSeparated, } from "./foundry-runtime-cache.js";
|
|
16
|
+
const contexts = new WeakSet();
|
|
17
|
+
const workspaceSelections = new WeakMap();
|
|
18
|
+
const managedCacheRoots = new WeakMap();
|
|
19
|
+
const migratedMarkerHashes = new WeakMap();
|
|
20
|
+
const adoptionScopes = new AsyncLocalStorage();
|
|
21
|
+
const pendingContexts = new WeakMap();
|
|
22
|
+
const workspaceSchema = "tiangong-foundry.workspace.v1";
|
|
23
|
+
const hashPattern = /^[0-9a-f]{64}$/u;
|
|
24
|
+
const idPattern = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$/u;
|
|
25
|
+
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
26
|
+
function verifyWorkspaceAccess(selection, version, schema, features) {
|
|
27
|
+
if (selection.access !== "read" && selection.access !== "write")
|
|
28
|
+
fail("workspace_access_invalid", "Workspace access must be read or write.");
|
|
29
|
+
try {
|
|
30
|
+
assertWorkspaceCompatibility(selection.manifest, { schema, features }, selection.access);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
fail("workspace_runtime_incompatible", "Supply an independently trusted runtime manifest that supports the requested workspace access.");
|
|
34
|
+
}
|
|
35
|
+
if (selection.manifest.manifest.product.id !== "tiangong-foundry" ||
|
|
36
|
+
(selection.access === "write" && selection.manifest.manifest.product.version !== version))
|
|
37
|
+
fail("workspace_runtime_incompatible", "Write compatibility must qualify the executing Foundry version.");
|
|
38
|
+
if (selection.access === "write" &&
|
|
39
|
+
features.some((feature) => !FOUNDRY_MIGRATED_WORKSPACE_FEATURES.includes(feature)))
|
|
40
|
+
fail("workspace_feature_unsupported", "This writer cannot preserve an unknown required workspace feature.");
|
|
41
|
+
}
|
|
42
|
+
function migratedMarker(value) {
|
|
43
|
+
const migration = value.migration;
|
|
44
|
+
const features = value.required_features;
|
|
45
|
+
if (value.layout_version !== 2 ||
|
|
46
|
+
Object.keys(value).length !== 7 ||
|
|
47
|
+
typeof value.workspace_id !== "string" ||
|
|
48
|
+
!uuidPattern.test(value.workspace_id) ||
|
|
49
|
+
typeof value.created_at_utc !== "string" ||
|
|
50
|
+
!Number.isFinite(Date.parse(value.created_at_utc)) ||
|
|
51
|
+
new Date(value.created_at_utc).toISOString() !== value.created_at_utc ||
|
|
52
|
+
!Array.isArray(features) ||
|
|
53
|
+
features.length > 64 ||
|
|
54
|
+
features.some((feature) => typeof feature !== "string" || !/^[a-z][a-z0-9-]{0,63}$/u.test(feature)) ||
|
|
55
|
+
new Set(features).size !== features.length ||
|
|
56
|
+
FOUNDRY_MIGRATED_WORKSPACE_FEATURES.some((feature) => !features.includes(feature)) ||
|
|
57
|
+
!migration ||
|
|
58
|
+
typeof migration !== "object" ||
|
|
59
|
+
Array.isArray(migration) ||
|
|
60
|
+
Object.keys(migration).length !== 2 ||
|
|
61
|
+
typeof migration.plan_sha256 !== "string" ||
|
|
62
|
+
!hashPattern.test(migration.plan_sha256) ||
|
|
63
|
+
typeof migration.activation_sha256 !== "string" ||
|
|
64
|
+
!hashPattern.test(migration.activation_sha256) ||
|
|
65
|
+
!value.extensions ||
|
|
66
|
+
typeof value.extensions !== "object" ||
|
|
67
|
+
Array.isArray(value.extensions))
|
|
68
|
+
fail("workspace_version_unsupported", "Migrated workspace marker is incomplete or unsupported.");
|
|
69
|
+
return {
|
|
70
|
+
features: Object.freeze([...features]),
|
|
71
|
+
migration: Object.freeze({
|
|
72
|
+
plan_sha256: migration.plan_sha256,
|
|
73
|
+
activation_sha256: migration.activation_sha256,
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function fail(code, message) {
|
|
78
|
+
throw new FoundryContextError(code, message);
|
|
79
|
+
}
|
|
80
|
+
function inside(root, target) {
|
|
81
|
+
const relative = path.relative(root, target);
|
|
82
|
+
return (relative === "" ||
|
|
83
|
+
(!path.isAbsolute(relative) && relative !== ".." && !relative.startsWith(`..${path.sep}`)));
|
|
84
|
+
}
|
|
85
|
+
function canonicalFuturePath(value) {
|
|
86
|
+
const missing = [];
|
|
87
|
+
let current = path.resolve(value);
|
|
88
|
+
while (!fs.existsSync(current)) {
|
|
89
|
+
const parent = path.dirname(current);
|
|
90
|
+
if (parent === current)
|
|
91
|
+
fail("path_missing", "No existing parent directory for the requested root.");
|
|
92
|
+
missing.unshift(path.basename(current));
|
|
93
|
+
current = parent;
|
|
94
|
+
}
|
|
95
|
+
const real = fs.realpathSync(current);
|
|
96
|
+
if (!fs.statSync(real).isDirectory() && missing.length > 0)
|
|
97
|
+
fail("root_not_directory", "A runtime root parent must be a directory.");
|
|
98
|
+
return path.join(real, ...missing);
|
|
99
|
+
}
|
|
100
|
+
function regularFile(filePath) {
|
|
101
|
+
const stat = fs.lstatSync(filePath);
|
|
102
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
103
|
+
fail("regular_file_required", "Runtime input must be a regular, non-symlink file.");
|
|
104
|
+
return stat;
|
|
105
|
+
}
|
|
106
|
+
/** Check every existing descendant before any mutation; never follow an output symlink. */
|
|
107
|
+
function confined(root, requested) {
|
|
108
|
+
const target = path.resolve(requested);
|
|
109
|
+
if (!inside(root, target))
|
|
110
|
+
fail("path_outside_root", "The requested path is outside its declared runtime root.");
|
|
111
|
+
let current = root;
|
|
112
|
+
for (const segment of ["", ...path.relative(root, target).split(path.sep).filter(Boolean)]) {
|
|
113
|
+
if (segment)
|
|
114
|
+
current = path.join(current, segment);
|
|
115
|
+
try {
|
|
116
|
+
const stat = fs.lstatSync(current);
|
|
117
|
+
if (stat.isSymbolicLink())
|
|
118
|
+
fail("symlink_not_allowed", "Runtime state and output paths cannot traverse symlinks.");
|
|
119
|
+
if (current !== target && !stat.isDirectory())
|
|
120
|
+
fail("root_not_directory", "Runtime path parent is not a directory.");
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
if (error.code !== "ENOENT")
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return target;
|
|
128
|
+
}
|
|
129
|
+
function readWorkspaceId(workspaceRoot, sessionReference) {
|
|
130
|
+
const file = confined(workspaceRoot, path.join(workspaceRoot, ".foundry", "workspace.json"));
|
|
131
|
+
if (!fs.existsSync(file))
|
|
132
|
+
return null;
|
|
133
|
+
assertNotFoundrySessionFile(file, sessionReference);
|
|
134
|
+
if (regularFile(file).size > 64 * 1024)
|
|
135
|
+
fail("workspace_invalid", "Workspace marker exceeds its size limit.");
|
|
136
|
+
let value;
|
|
137
|
+
try {
|
|
138
|
+
value = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
fail("workspace_invalid", "Workspace marker is not valid JSON.");
|
|
142
|
+
}
|
|
143
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
144
|
+
fail("workspace_invalid", "Workspace marker must be an object.");
|
|
145
|
+
const marker = value;
|
|
146
|
+
if (marker.schema === FOUNDRY_MIGRATED_WORKSPACE_SCHEMA) {
|
|
147
|
+
migratedMarker(marker);
|
|
148
|
+
return marker.workspace_id;
|
|
149
|
+
}
|
|
150
|
+
if (marker.schema === "tiangong-foundry.workspace-migration-pending.v1" &&
|
|
151
|
+
Object.keys(marker).length === 2 &&
|
|
152
|
+
typeof marker.plan_sha256 === "string" &&
|
|
153
|
+
hashPattern.test(marker.plan_sha256))
|
|
154
|
+
return null;
|
|
155
|
+
if (marker.schema !== workspaceSchema ||
|
|
156
|
+
marker.layout_version !== 1 ||
|
|
157
|
+
typeof marker.workspace_id !== "string" ||
|
|
158
|
+
!uuidPattern.test(marker.workspace_id) ||
|
|
159
|
+
typeof marker.created_at_utc !== "string" ||
|
|
160
|
+
!Number.isFinite(Date.parse(marker.created_at_utc)) ||
|
|
161
|
+
Object.keys(marker).length !== 4)
|
|
162
|
+
fail("workspace_version_unsupported", "Workspace marker is unknown or invalid; migration must be explicit.");
|
|
163
|
+
return marker.workspace_id;
|
|
164
|
+
}
|
|
165
|
+
function supportedPlatform(platform, arch) {
|
|
166
|
+
const key = `${platform}-${arch}`;
|
|
167
|
+
if (!["darwin-arm64", "linux-x64", "linux-arm64", "win32-x64"].includes(key)) {
|
|
168
|
+
fail("platform_unsupported", "Foundry supports macOS arm64, Linux x64/arm64 and Windows x64.");
|
|
169
|
+
}
|
|
170
|
+
return key;
|
|
171
|
+
}
|
|
172
|
+
function defaultCacheBase(platform, env) {
|
|
173
|
+
const home = env.HOME || env.USERPROFILE || os.homedir();
|
|
174
|
+
if (platform === "win32")
|
|
175
|
+
return env.LOCALAPPDATA || path.join(home, "AppData", "Local");
|
|
176
|
+
if (platform === "darwin")
|
|
177
|
+
return path.join(home, "Library", "Caches");
|
|
178
|
+
return env.XDG_CACHE_HOME || path.join(home, ".cache");
|
|
179
|
+
}
|
|
180
|
+
function discoverWorkspace(cwd, runtimeRoot, sessionReference) {
|
|
181
|
+
let current = canonicalFuturePath(cwd);
|
|
182
|
+
while (true) {
|
|
183
|
+
if (!inside(runtimeRoot, current) && readWorkspaceId(current, sessionReference))
|
|
184
|
+
return current;
|
|
185
|
+
const parent = path.dirname(current);
|
|
186
|
+
if (parent === current)
|
|
187
|
+
fail("workspace_required", "Select a workspace with --workspace or run from an initialized project.");
|
|
188
|
+
current = parent;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
export function assertFoundryRuntimeHost(platform = process.platform, arch = process.arch) {
|
|
192
|
+
const [nodeMajor, nodeMinor] = process.versions.node.split(".").map(Number);
|
|
193
|
+
if (nodeMajor !== 24 || nodeMinor < 19)
|
|
194
|
+
fail("node_runtime_unsupported", "Foundry requires Node 24.19 or later in the Node 24 release line.");
|
|
195
|
+
return supportedPlatform(platform, arch);
|
|
196
|
+
}
|
|
197
|
+
export function createFoundryRuntimeContext(options) {
|
|
198
|
+
const platform = options.platform ?? process.platform;
|
|
199
|
+
const platformKey = assertFoundryRuntimeHost(platform, options.arch ?? process.arch);
|
|
200
|
+
const runtime = describeFoundryRuntime(options.moduleUrl);
|
|
201
|
+
const cwd = options.cwd ?? process.cwd();
|
|
202
|
+
const workspaceRoot = options.workspace
|
|
203
|
+
? canonicalFuturePath(path.resolve(cwd, options.workspace))
|
|
204
|
+
: discoverWorkspace(cwd, runtime.runtimeRoot, options.accountIntent?.sessionReference);
|
|
205
|
+
const slashRoot = workspaceRoot.split(path.sep).join("/");
|
|
206
|
+
if (workspaceRoot === path.parse(workspaceRoot).root ||
|
|
207
|
+
inside(runtime.runtimeRoot, workspaceRoot) ||
|
|
208
|
+
/\/(?:\.agents|\.codex)\/skills(?:\/|$)/u.test(slashRoot) ||
|
|
209
|
+
/\/_npx(?:\/|$)/u.test(slashRoot)) {
|
|
210
|
+
fail("workspace_root_forbidden", "An installation, skill directory or filesystem root cannot be used as the project workspace.");
|
|
211
|
+
}
|
|
212
|
+
if (fs.existsSync(workspaceRoot) && !fs.statSync(workspaceRoot).isDirectory())
|
|
213
|
+
fail("root_not_directory", "Workspace root must be a directory.");
|
|
214
|
+
const managedCacheRoot = options.managedCacheRoot === undefined
|
|
215
|
+
? null
|
|
216
|
+
: canonicalFoundryCachePath(options.managedCacheRoot);
|
|
217
|
+
if (managedCacheRoot)
|
|
218
|
+
assertFoundryCacheRootSeparated(managedCacheRoot, workspaceRoot);
|
|
219
|
+
let workspaceId = readWorkspaceId(workspaceRoot, options.accountIntent?.sessionReference);
|
|
220
|
+
const activeAdoption = adoptionScopes.getStore();
|
|
221
|
+
const pending = !workspaceId && activeAdoption?.active && activeAdoption.workspaceRoot === workspaceRoot
|
|
222
|
+
? activeAdoption
|
|
223
|
+
: undefined;
|
|
224
|
+
if (pending)
|
|
225
|
+
workspaceId = pending.workspaceId;
|
|
226
|
+
const markerBytes = workspaceId
|
|
227
|
+
? transferRead(confined(workspaceRoot, path.join(workspaceRoot, ".foundry/workspace.json")), 64 * 1024)
|
|
228
|
+
: null;
|
|
229
|
+
const marker = markerBytes
|
|
230
|
+
? JSON.parse(markerBytes.toString("utf8"))
|
|
231
|
+
: null;
|
|
232
|
+
const migrated = marker?.schema === FOUNDRY_MIGRATED_WORKSPACE_SCHEMA ? migratedMarker(marker) : null;
|
|
233
|
+
const selectedSchema = migrated || pending ? FOUNDRY_MIGRATED_WORKSPACE_SCHEMA : workspaceSchema;
|
|
234
|
+
const selectedFeatures = migrated?.features ??
|
|
235
|
+
(pending ? FOUNDRY_MIGRATED_WORKSPACE_FEATURES : Object.freeze(["registered-tasks-v2"]));
|
|
236
|
+
const selection = options.workspaceAccess;
|
|
237
|
+
if ((migrated || pending) && !selection)
|
|
238
|
+
fail("workspace_runtime_selection_required", "Migrated workspaces require an independently trusted read/write runtime selection.");
|
|
239
|
+
if (selection)
|
|
240
|
+
verifyWorkspaceAccess(selection, runtime.packageVersion, selectedSchema, selectedFeatures);
|
|
241
|
+
if (migrated)
|
|
242
|
+
readFoundryMigrationAuthority(path.join(workspaceRoot, ".foundry"), workspaceId, migrated.migration, false, options.accountIntent?.sessionReference);
|
|
243
|
+
const taskId = options.taskId ?? null;
|
|
244
|
+
const actorId = options.actorId ?? null;
|
|
245
|
+
if (taskId !== null &&
|
|
246
|
+
(typeof taskId !== "string" || !idPattern.test(taskId) || taskId === "." || taskId === ".."))
|
|
247
|
+
fail("task_id_invalid", "Task id must be a single safe path segment.");
|
|
248
|
+
if (taskId &&
|
|
249
|
+
(typeof actorId !== "string" || !/^[a-zA-Z0-9][a-zA-Z0-9._:/-]{0,255}$/u.test(actorId)))
|
|
250
|
+
fail("actor_required", "Task execution requires explicit actor intent.");
|
|
251
|
+
if (taskId && !workspaceId)
|
|
252
|
+
fail("workspace_not_initialized", "Initialize the workspace before opening a task context.");
|
|
253
|
+
const controlRoot = confined(workspaceRoot, path.join(workspaceRoot, ".foundry"));
|
|
254
|
+
const stateRoot = confined(workspaceRoot, path.join(controlRoot, "state"));
|
|
255
|
+
const taskRoot = taskId
|
|
256
|
+
? confined(workspaceRoot, path.join(controlRoot, "workspaces", taskId))
|
|
257
|
+
: null;
|
|
258
|
+
const requestedAccount = options.accountIntent;
|
|
259
|
+
if (requestedAccount &&
|
|
260
|
+
(typeof requestedAccount.projectRef !== "string" ||
|
|
261
|
+
!/^[a-z0-9]{20}$/u.test(requestedAccount.projectRef) ||
|
|
262
|
+
typeof requestedAccount.userId !== "string" ||
|
|
263
|
+
!uuidPattern.test(requestedAccount.userId) ||
|
|
264
|
+
(requestedAccount.accountMode !== undefined &&
|
|
265
|
+
requestedAccount.accountMode !== "ordinary" &&
|
|
266
|
+
requestedAccount.accountMode !== "production-test") ||
|
|
267
|
+
(requestedAccount.sessionReference !== undefined &&
|
|
268
|
+
(typeof requestedAccount.sessionReference !== "string" ||
|
|
269
|
+
!path.isAbsolute(requestedAccount.sessionReference))))) {
|
|
270
|
+
fail("account_intent_invalid", "Account intent requires an exact project/user and an optional absolute CLI session reference.");
|
|
271
|
+
}
|
|
272
|
+
const accountIntent = requestedAccount ? Object.freeze({ ...requestedAccount }) : null;
|
|
273
|
+
const scope = createHash("sha256")
|
|
274
|
+
.update(JSON.stringify([
|
|
275
|
+
runtime.packageManifestSha256,
|
|
276
|
+
runtime.entrySha256,
|
|
277
|
+
workspaceId ?? workspaceRoot,
|
|
278
|
+
accountIntent?.projectRef ?? null,
|
|
279
|
+
accountIntent?.userId ?? null,
|
|
280
|
+
]))
|
|
281
|
+
.digest("hex");
|
|
282
|
+
const cacheBase = canonicalFuturePath(path.resolve(cwd, options.cacheBase ?? defaultCacheBase(platform, options.environment ?? process.env)));
|
|
283
|
+
const cacheRoot = path.join(cacheBase, "tiangong-lca", "foundry-content", runtime.packageVersion, platformKey, scope);
|
|
284
|
+
if (inside(runtime.runtimeRoot, cacheRoot) ||
|
|
285
|
+
inside(cacheRoot, runtime.runtimeRoot) ||
|
|
286
|
+
inside(cacheRoot, workspaceRoot))
|
|
287
|
+
fail("cache_root_forbidden", "Content cache must be separate from the runtime and workspace roots.");
|
|
288
|
+
const inputs = (options.inputs ?? []).map((input) => {
|
|
289
|
+
if (!path.isAbsolute(input.path) ||
|
|
290
|
+
!hashPattern.test(input.sha256) ||
|
|
291
|
+
!Number.isSafeInteger(input.bytes) ||
|
|
292
|
+
input.bytes < 0)
|
|
293
|
+
fail("input_fact_invalid", "Input facts require an absolute file, size and SHA-256.");
|
|
294
|
+
if (/^\.env(?:\.|$)/iu.test(path.basename(input.path)) ||
|
|
295
|
+
input.path === accountIntent?.sessionReference)
|
|
296
|
+
fail("credential_input_forbidden", "Credential storage is not a dataset input.");
|
|
297
|
+
return Object.freeze({ ...input });
|
|
298
|
+
});
|
|
299
|
+
if (new Set(inputs.map((input) => input.path)).size !== inputs.length)
|
|
300
|
+
fail("input_fact_duplicate", "Input facts must be unique.");
|
|
301
|
+
const context = Object.freeze({
|
|
302
|
+
runtime,
|
|
303
|
+
runtimeRoot: runtime.runtimeRoot,
|
|
304
|
+
assetRoot: runtime.assetRoot,
|
|
305
|
+
workspaceRoot,
|
|
306
|
+
workspaceId,
|
|
307
|
+
workspaceAccess: selection?.access ?? "write",
|
|
308
|
+
workspaceManifestSha256: selection?.manifest.sha256 ?? null,
|
|
309
|
+
workspaceSchema: selectedSchema,
|
|
310
|
+
workspaceFeatures: selectedFeatures,
|
|
311
|
+
migration: migrated?.migration ?? null,
|
|
312
|
+
pendingMigration: pending?.planSha256 ?? null,
|
|
313
|
+
controlRoot,
|
|
314
|
+
stateRoot,
|
|
315
|
+
taskRoot,
|
|
316
|
+
taskId,
|
|
317
|
+
actorId,
|
|
318
|
+
tempRoot: path.join(taskRoot ?? controlRoot, "tmp"),
|
|
319
|
+
cacheRoot,
|
|
320
|
+
cacheBase,
|
|
321
|
+
platform: platformKey,
|
|
322
|
+
accountIntent,
|
|
323
|
+
inputs: Object.freeze(inputs),
|
|
324
|
+
});
|
|
325
|
+
contexts.add(context);
|
|
326
|
+
if (managedCacheRoot)
|
|
327
|
+
managedCacheRoots.set(context, managedCacheRoot);
|
|
328
|
+
if (selection)
|
|
329
|
+
workspaceSelections.set(context, Object.freeze({ ...selection }));
|
|
330
|
+
if (migrated && markerBytes)
|
|
331
|
+
migratedMarkerHashes.set(context, transferHash(markerBytes));
|
|
332
|
+
if (pending)
|
|
333
|
+
pendingContexts.set(context, pending);
|
|
334
|
+
return context;
|
|
335
|
+
}
|
|
336
|
+
export function assertFoundryRuntimeContext(context) {
|
|
337
|
+
if (!contexts.has(context))
|
|
338
|
+
fail("runtime_context_unverified", "Use the runtime context constructor; serialized context is not authority.");
|
|
339
|
+
const managedCacheRoot = managedCacheRoots.get(context);
|
|
340
|
+
if (managedCacheRoot)
|
|
341
|
+
assertFoundryCacheRootSeparated(managedCacheRoot, context.workspaceRoot);
|
|
342
|
+
const pending = pendingContexts.get(context);
|
|
343
|
+
if (pending) {
|
|
344
|
+
if (!pending.active ||
|
|
345
|
+
adoptionScopes.getStore() !== pending ||
|
|
346
|
+
transferHash(transferRead(confined(context.workspaceRoot, path.join(context.controlRoot, "workspace.json")), 64 * 1024)) !== pending.markerSha256 ||
|
|
347
|
+
transferHash(transferRead(confined(context.workspaceRoot, path.join(context.controlRoot, "migrations", pending.planSha256, "adoption.json")))) !== pending.adoptionFileSha256)
|
|
348
|
+
fail("migration_session_closed", "Pending adoption context is stale or outside its scoped local operation.");
|
|
349
|
+
}
|
|
350
|
+
else if (context.workspaceId &&
|
|
351
|
+
readWorkspaceId(context.workspaceRoot, context.accountIntent?.sessionReference) !==
|
|
352
|
+
context.workspaceId)
|
|
353
|
+
fail("workspace_changed", "Workspace identity changed after context construction.");
|
|
354
|
+
const selection = workspaceSelections.get(context);
|
|
355
|
+
if (selection)
|
|
356
|
+
verifyWorkspaceAccess(selection, context.runtime.packageVersion, context.workspaceSchema, context.workspaceFeatures);
|
|
357
|
+
const markerHash = migratedMarkerHashes.get(context);
|
|
358
|
+
if (markerHash &&
|
|
359
|
+
transferHash(transferRead(confined(context.workspaceRoot, path.join(context.controlRoot, "workspace.json")), 64 * 1024)) !== markerHash)
|
|
360
|
+
fail("workspace_changed", "Migrated workspace marker changed after runtime selection.");
|
|
361
|
+
if (context.migration)
|
|
362
|
+
readFoundryMigrationAuthority(context.controlRoot, context.workspaceId, context.migration, false, context.accountIntent?.sessionReference);
|
|
363
|
+
}
|
|
364
|
+
/** Current host authority, never the persisted workspace pointer or a rollback target. */
|
|
365
|
+
export function currentFoundryRuntimeManifest(context) {
|
|
366
|
+
assertFoundryRuntimeContext(context);
|
|
367
|
+
return workspaceSelections.get(context)?.manifest ?? null;
|
|
368
|
+
}
|
|
369
|
+
export function assertFoundryWorkspaceWrite(context) {
|
|
370
|
+
assertFoundryRuntimeContext(context);
|
|
371
|
+
if (context.workspaceAccess !== "write")
|
|
372
|
+
fail("workspace_read_only", "The selected runtime has read-only workspace access; use a write-qualified runtime before changing task state.");
|
|
373
|
+
const selected = context.workspaceId
|
|
374
|
+
? readFoundryRuntimeSelection(context.controlRoot, context.workspaceId, context.accountIntent?.sessionReference)
|
|
375
|
+
: null;
|
|
376
|
+
if (selected &&
|
|
377
|
+
(selected.value.access !== "write" ||
|
|
378
|
+
selected.value.selected_manifest_sha256 !== context.workspaceManifestSha256))
|
|
379
|
+
fail("workspace_runtime_selection_mismatch", "The project is pinned to another runtime or read-only mode; explicitly select a qualified writer before changing task state.");
|
|
380
|
+
const pending = pendingContexts.get(context);
|
|
381
|
+
if (pending &&
|
|
382
|
+
context.taskId &&
|
|
383
|
+
!pending.tasks.some((task) => task.task_id === context.taskId && task.actor_id === context.actorId))
|
|
384
|
+
fail("migration_task_adoption_required", "Pending preparation is limited to the independently reviewed task mapping.");
|
|
385
|
+
}
|
|
386
|
+
/** Control-plane selection can restore a qualified writer without granting task mutation. */
|
|
387
|
+
export function assertFoundryRuntimeSelector(context) {
|
|
388
|
+
assertFoundryRuntimeContext(context);
|
|
389
|
+
if (!context.workspaceId ||
|
|
390
|
+
context.pendingMigration ||
|
|
391
|
+
context.workspaceAccess !== "write" ||
|
|
392
|
+
!context.workspaceManifestSha256)
|
|
393
|
+
fail("workspace_runtime_selection_required", "Runtime selection requires an active workspace and an independently qualified current writer.");
|
|
394
|
+
}
|
|
395
|
+
export function assertFoundryWorkspaceActive(context) {
|
|
396
|
+
assertFoundryWorkspaceWrite(context);
|
|
397
|
+
if (context.pendingMigration)
|
|
398
|
+
fail("workspace_migration_pending", "Pending adoption cannot create business authorization or execution admission.");
|
|
399
|
+
}
|
|
400
|
+
export function assertPendingFoundryTaskIntent(context, id, request, actor, fingerprint) {
|
|
401
|
+
assertFoundryRuntimeContext(context);
|
|
402
|
+
const pending = pendingContexts.get(context);
|
|
403
|
+
if (pending &&
|
|
404
|
+
!pending.tasks.some((task) => task.task_id === id &&
|
|
405
|
+
task.request_id === request &&
|
|
406
|
+
task.actor_id === actor &&
|
|
407
|
+
(fingerprint === undefined || task.spec_fingerprint_sha256 === fingerprint)))
|
|
408
|
+
fail("migration_task_adoption_required", "Pending task intent differs from the reviewed migration mapping.");
|
|
409
|
+
}
|
|
410
|
+
/** Internal migration owner scope. Never exported by the package's public API. */
|
|
411
|
+
export async function withFoundryPendingAdoption(context, callback) {
|
|
412
|
+
assertFoundryWorkspaceWrite(context);
|
|
413
|
+
const plan = pendingFoundryMigration(context);
|
|
414
|
+
const selection = workspaceSelections.get(context);
|
|
415
|
+
if (!plan || !selection)
|
|
416
|
+
fail("migration_adoption_required", "Pending adoption requires a staged plan and trusted writer selection.");
|
|
417
|
+
verifyWorkspaceAccess(selection, context.runtime.packageVersion, FOUNDRY_MIGRATED_WORKSPACE_SCHEMA, FOUNDRY_MIGRATED_WORKSPACE_FEATURES);
|
|
418
|
+
const markerBytes = transferRead(confined(context.workspaceRoot, path.join(context.controlRoot, "workspace.json")), 64 * 1024);
|
|
419
|
+
const claim = JSON.parse(transferRead(confined(context.workspaceRoot, path.join(context.controlRoot, "migration-claim.json"))).toString("utf8"));
|
|
420
|
+
const adoptionBytes = transferRead(confined(context.workspaceRoot, path.join(context.controlRoot, "migrations", plan, "adoption.json")));
|
|
421
|
+
const adoption = JSON.parse(adoptionBytes.toString("utf8"));
|
|
422
|
+
const { adoption_sha256: digest, ...unsigned } = adoption;
|
|
423
|
+
if (adoption.schema !== "tiangong-foundry.migration-adoption-plan.v1" ||
|
|
424
|
+
adoption.plan_sha256 !== plan ||
|
|
425
|
+
typeof adoption.workspace_id !== "string" ||
|
|
426
|
+
!uuidPattern.test(adoption.workspace_id) ||
|
|
427
|
+
adoption.workspace_id !== claim.workspace_id ||
|
|
428
|
+
claim.plan_sha256 !== plan ||
|
|
429
|
+
adoption.actor_id !== claim.actor_id ||
|
|
430
|
+
adoption.runtime_manifest_sha256 !== selection.manifest.sha256 ||
|
|
431
|
+
digest !== sha256Json(unsigned) ||
|
|
432
|
+
!Array.isArray(adoption.tasks))
|
|
433
|
+
fail("migration_adoption_invalid", "Pending adoption differs from its source transfer, actor or trusted runtime.");
|
|
434
|
+
const tasks = [];
|
|
435
|
+
for (const row of adoption.tasks) {
|
|
436
|
+
const task = row.authority;
|
|
437
|
+
if (task.disposition !== "local-unattempted")
|
|
438
|
+
continue;
|
|
439
|
+
if (typeof task.task_id !== "string" ||
|
|
440
|
+
!/^task-[0-9a-f]{64}-r0001$/u.test(task.task_id) ||
|
|
441
|
+
typeof task.request_id !== "string" ||
|
|
442
|
+
typeof task.actor_id !== "string" ||
|
|
443
|
+
typeof task.spec_fingerprint_sha256 !== "string" ||
|
|
444
|
+
!hashPattern.test(task.spec_fingerprint_sha256))
|
|
445
|
+
fail("migration_adoption_invalid", "Pending preparation task identity is invalid.");
|
|
446
|
+
tasks.push({
|
|
447
|
+
task_id: task.task_id,
|
|
448
|
+
request_id: task.request_id,
|
|
449
|
+
actor_id: task.actor_id,
|
|
450
|
+
spec_fingerprint_sha256: task.spec_fingerprint_sha256,
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
const scope = {
|
|
454
|
+
workspaceRoot: context.workspaceRoot,
|
|
455
|
+
workspaceId: adoption.workspace_id,
|
|
456
|
+
planSha256: plan,
|
|
457
|
+
markerSha256: transferHash(markerBytes),
|
|
458
|
+
adoptionFileSha256: transferHash(adoptionBytes),
|
|
459
|
+
tasks: Object.freeze(tasks),
|
|
460
|
+
active: true,
|
|
461
|
+
};
|
|
462
|
+
try {
|
|
463
|
+
return await adoptionScopes.run(scope, callback);
|
|
464
|
+
}
|
|
465
|
+
finally {
|
|
466
|
+
scope.active = false;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
export function pendingFoundryMigration(context) {
|
|
470
|
+
assertFoundryRuntimeContext(context);
|
|
471
|
+
const marker = confined(context.workspaceRoot, path.join(context.controlRoot, "workspace.json"));
|
|
472
|
+
if (!fs.existsSync(marker))
|
|
473
|
+
return null;
|
|
474
|
+
assertNotFoundrySessionFile(marker, context.accountIntent?.sessionReference);
|
|
475
|
+
if (regularFile(marker).size > 64 * 1024)
|
|
476
|
+
fail("workspace_invalid", "Workspace marker exceeds its limit.");
|
|
477
|
+
const value = JSON.parse(fs.readFileSync(marker, "utf8"));
|
|
478
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
479
|
+
const record = value;
|
|
480
|
+
if (record.schema === "tiangong-foundry.workspace-migration-pending.v1" &&
|
|
481
|
+
typeof record.plan_sha256 === "string" &&
|
|
482
|
+
hashPattern.test(record.plan_sha256) &&
|
|
483
|
+
Object.keys(record).length === 2)
|
|
484
|
+
return record.plan_sha256;
|
|
485
|
+
}
|
|
486
|
+
return null;
|
|
487
|
+
}
|
|
488
|
+
export function resolveFoundryOutput(context, value, area = "task") {
|
|
489
|
+
assertFoundryRuntimeContext(context);
|
|
490
|
+
const root = area === "cache" ? context.cacheRoot : area === "state" ? context.stateRoot : context.taskRoot;
|
|
491
|
+
if (!root)
|
|
492
|
+
fail("task_context_required", "Task output requires an explicit initialized task context.");
|
|
493
|
+
const target = confined(root, path.resolve(root, value));
|
|
494
|
+
confined(area === "cache" ? context.cacheBase : context.workspaceRoot, target);
|
|
495
|
+
const physical = canonicalFuturePath(target);
|
|
496
|
+
if (inside(context.runtimeRoot, physical) || !inside(root, physical))
|
|
497
|
+
fail("runtime_is_read_only", "Runtime code/assets are read-only and output must remain in its declared root.");
|
|
498
|
+
return target;
|
|
499
|
+
}
|
|
500
|
+
export function resolveFoundryAsset(context, relative) {
|
|
501
|
+
assertFoundryRuntimeContext(context);
|
|
502
|
+
if (relative.split(/[\\/]/u).some((part) => part === ".." || part === ".") ||
|
|
503
|
+
!/^(?:specs\/|docs\/|README(?:\.md)?$|LICENSE(?:\.[A-Za-z]+)?$|NOTICE(?:\.[A-Za-z]+)?$)/u.test(relative)) {
|
|
504
|
+
fail("asset_not_registered", "Only reviewed runtime resource families can be read as package assets.");
|
|
505
|
+
}
|
|
506
|
+
const target = confined(context.assetRoot, path.resolve(context.assetRoot, relative));
|
|
507
|
+
regularFile(target);
|
|
508
|
+
if (!inside(context.assetRoot, fs.realpathSync(target)))
|
|
509
|
+
fail("asset_outside_runtime", "Package asset escapes the runtime root.");
|
|
510
|
+
return target;
|
|
511
|
+
}
|
|
512
|
+
export function captureFoundryInput(filePath) {
|
|
513
|
+
const absolute = path.resolve(filePath);
|
|
514
|
+
if (/^\.env(?:\.|$)/iu.test(path.basename(absolute)))
|
|
515
|
+
fail("credential_input_forbidden", "Credential storage is not a dataset input.");
|
|
516
|
+
const before = regularFile(absolute);
|
|
517
|
+
const fd = fs.openSync(absolute, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
|
|
518
|
+
try {
|
|
519
|
+
const opened = fs.fstatSync(fd);
|
|
520
|
+
if (!opened.isFile() || opened.ino !== before.ino || opened.dev !== before.dev)
|
|
521
|
+
fail("input_changed", "Input changed while it was opened.");
|
|
522
|
+
const hash = createHash("sha256");
|
|
523
|
+
const chunk = Buffer.alloc(1024 * 1024);
|
|
524
|
+
let length = 0;
|
|
525
|
+
while (true) {
|
|
526
|
+
const read = fs.readSync(fd, chunk, 0, chunk.length, null);
|
|
527
|
+
if (!read)
|
|
528
|
+
break;
|
|
529
|
+
hash.update(chunk.subarray(0, read));
|
|
530
|
+
length += read;
|
|
531
|
+
}
|
|
532
|
+
const after = fs.fstatSync(fd);
|
|
533
|
+
if (length !== before.size ||
|
|
534
|
+
after.size !== before.size ||
|
|
535
|
+
after.mtimeMs !== before.mtimeMs ||
|
|
536
|
+
after.ctimeMs !== before.ctimeMs)
|
|
537
|
+
fail("input_changed", "Input changed while its scope was captured.");
|
|
538
|
+
return Object.freeze({
|
|
539
|
+
path: fs.realpathSync(absolute),
|
|
540
|
+
bytes: length,
|
|
541
|
+
sha256: hash.digest("hex"),
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
finally {
|
|
545
|
+
fs.closeSync(fd);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
export function resolveFoundryInputPath(context, filePath) {
|
|
549
|
+
assertFoundryRuntimeContext(context);
|
|
550
|
+
const absolute = path.resolve(context.workspaceRoot, filePath);
|
|
551
|
+
if (!fs.existsSync(absolute))
|
|
552
|
+
fail("input_not_selected", "The requested file is missing or not selected for this task.");
|
|
553
|
+
regularFile(absolute);
|
|
554
|
+
const canonical = fs.realpathSync(absolute);
|
|
555
|
+
const fact = context.inputs.find((input) => input.path === canonical);
|
|
556
|
+
if (!fact)
|
|
557
|
+
fail("input_not_selected", "The requested file is not bound to this task's selected inputs.");
|
|
558
|
+
return fact.path;
|
|
559
|
+
}
|
|
560
|
+
export function readFoundryInput(context, filePath, maxBytes = 64 * 1024 * 1024) {
|
|
561
|
+
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0)
|
|
562
|
+
fail("input_limit_invalid", "Input memory limit must be a nonnegative safe integer.");
|
|
563
|
+
const absolute = resolveFoundryInputPath(context, filePath);
|
|
564
|
+
const fact = context.inputs.find((input) => input.path === absolute);
|
|
565
|
+
if (fact.bytes > maxBytes)
|
|
566
|
+
fail("input_too_large", "Input exceeds the operation's declared memory limit.");
|
|
567
|
+
const before = regularFile(absolute);
|
|
568
|
+
if (fs.realpathSync(absolute) !== fact.path || before.size !== fact.bytes)
|
|
569
|
+
fail("input_changed", "Selected input identity or size changed.");
|
|
570
|
+
const fd = fs.openSync(absolute, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
|
|
571
|
+
try {
|
|
572
|
+
const opened = fs.fstatSync(fd);
|
|
573
|
+
if (opened.ino !== before.ino || opened.dev !== before.dev || !opened.isFile())
|
|
574
|
+
fail("input_changed", "Selected input changed while it was opened.");
|
|
575
|
+
const bytes = fs.readFileSync(fd);
|
|
576
|
+
if (bytes.length !== fact.bytes ||
|
|
577
|
+
createHash("sha256").update(bytes).digest("hex") !== fact.sha256)
|
|
578
|
+
fail("input_changed", "Selected input bytes no longer match the task scope.");
|
|
579
|
+
return bytes;
|
|
580
|
+
}
|
|
581
|
+
finally {
|
|
582
|
+
fs.closeSync(fd);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
export function writeFoundryArtifact(context, filePath, content) {
|
|
586
|
+
assertFoundryWorkspaceWrite(context);
|
|
587
|
+
const target = resolveFoundryOutput(context, filePath);
|
|
588
|
+
if (target === context.taskRoot)
|
|
589
|
+
fail("output_file_required", "An artifact must be a file below the task root.");
|
|
590
|
+
const bytes = Buffer.isBuffer(content) ? content : Buffer.from(content);
|
|
591
|
+
fs.mkdirSync(path.dirname(target), { recursive: true, mode: 0o700 });
|
|
592
|
+
resolveFoundryOutput(context, target);
|
|
593
|
+
if (fs.existsSync(target)) {
|
|
594
|
+
regularFile(target);
|
|
595
|
+
if (fs.readFileSync(target).equals(bytes))
|
|
596
|
+
return;
|
|
597
|
+
fail("artifact_exists", "Existing task artifacts are immutable; select a new output revision.");
|
|
598
|
+
}
|
|
599
|
+
const temp = path.join(path.dirname(target), `.artifact-${randomUUID()}.tmp`);
|
|
600
|
+
try {
|
|
601
|
+
fs.writeFileSync(temp, bytes, { flag: "wx", mode: 0o600 });
|
|
602
|
+
try {
|
|
603
|
+
fs.linkSync(temp, target);
|
|
604
|
+
}
|
|
605
|
+
catch (error) {
|
|
606
|
+
if (error.code !== "EEXIST")
|
|
607
|
+
throw error;
|
|
608
|
+
resolveFoundryOutput(context, target);
|
|
609
|
+
regularFile(target);
|
|
610
|
+
if (!fs.readFileSync(target).equals(bytes))
|
|
611
|
+
fail("artifact_exists", "A concurrent writer installed different artifact bytes.");
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
finally {
|
|
615
|
+
if (fs.existsSync(temp))
|
|
616
|
+
fs.unlinkSync(temp);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
export function initializeFoundryWorkspace(context) {
|
|
620
|
+
assertFoundryWorkspaceWrite(context);
|
|
621
|
+
if (pendingFoundryMigration(context))
|
|
622
|
+
fail("workspace_migration_pending", "Migration is staged and must pass task adoption and activation audit before workspace use.");
|
|
623
|
+
if (canonicalFuturePath(context.workspaceRoot) !== context.workspaceRoot)
|
|
624
|
+
fail("workspace_changed", "Workspace root changed after context construction.");
|
|
625
|
+
let existing = readWorkspaceId(context.workspaceRoot, context.accountIntent?.sessionReference);
|
|
626
|
+
if (!existing && fs.existsSync(context.controlRoot)) {
|
|
627
|
+
const names = fs
|
|
628
|
+
.readdirSync(context.controlRoot)
|
|
629
|
+
.filter((name) => !/^\.workspace-[0-9a-f-]+\.tmp$/u.test(name));
|
|
630
|
+
existing = readWorkspaceId(context.workspaceRoot, context.accountIntent?.sessionReference);
|
|
631
|
+
if (names.length && !existing)
|
|
632
|
+
fail("legacy_workspace_requires_migration", "Existing unversioned Foundry state must be inventoried and migrated explicitly.");
|
|
633
|
+
}
|
|
634
|
+
fs.mkdirSync(context.controlRoot, { recursive: true, mode: 0o700 });
|
|
635
|
+
confined(context.workspaceRoot, context.controlRoot);
|
|
636
|
+
const marker = path.join(context.controlRoot, "workspace.json");
|
|
637
|
+
let created = false;
|
|
638
|
+
if (!existing) {
|
|
639
|
+
const temp = path.join(context.controlRoot, `.workspace-${randomUUID()}.tmp`);
|
|
640
|
+
try {
|
|
641
|
+
fs.writeFileSync(temp, JSON.stringify({
|
|
642
|
+
schema: workspaceSchema,
|
|
643
|
+
layout_version: 1,
|
|
644
|
+
workspace_id: randomUUID(),
|
|
645
|
+
created_at_utc: new Date().toISOString(),
|
|
646
|
+
}) + "\n", { flag: "wx", mode: 0o600 });
|
|
647
|
+
try {
|
|
648
|
+
fs.linkSync(temp, marker);
|
|
649
|
+
created = true;
|
|
650
|
+
}
|
|
651
|
+
catch (error) {
|
|
652
|
+
if (error.code !== "EEXIST")
|
|
653
|
+
throw error;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
finally {
|
|
657
|
+
if (fs.existsSync(temp))
|
|
658
|
+
fs.unlinkSync(temp);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
const workspaceId = readWorkspaceId(context.workspaceRoot, context.accountIntent?.sessionReference);
|
|
662
|
+
for (const relative of ["state", "tasks/inbox", "tasks/active", "tasks/done", "workspaces"]) {
|
|
663
|
+
const target = confined(context.workspaceRoot, path.join(context.controlRoot, relative));
|
|
664
|
+
fs.mkdirSync(target, { recursive: true, mode: 0o700 });
|
|
665
|
+
confined(context.workspaceRoot, target);
|
|
666
|
+
}
|
|
667
|
+
return { workspace_id: workspaceId, status: created ? "created" : "existing" };
|
|
668
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const runtimeEnvFilePolicyKey = "FOUNDRY_RUNTIME_ENV_FILE_POLICY";
|
|
2
|
+
export declare const runtimeEnvFilePolicyDisabled = "disabled";
|
|
3
|
+
export interface FoundryIsolatedChildEnvironmentOptions {
|
|
4
|
+
tempRoot: string;
|
|
5
|
+
sourceEnv?: NodeJS.ProcessEnv;
|
|
6
|
+
overrides?: NodeJS.ProcessEnv;
|
|
7
|
+
}
|
|
8
|
+
export declare function copyFoundryIsolatedExecutable(sourcePath: string, targetPath: string): void;
|
|
9
|
+
export declare function createFoundryIsolatedChildEnvironment({ tempRoot, sourceEnv, overrides, }: FoundryIsolatedChildEnvironmentOptions): NodeJS.ProcessEnv;
|