@tiangong-lca/foundry 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/docs/architecture.md +9 -7
- package/docs/foundry-task-contracts.md +10 -4
- package/docs/import-profiles/bafu/constraints.md +1 -1
- package/docs/import-profiles/bafu/profile.md +1 -1
- package/docs/import-profiles/worldsteel/constraints.md +3 -3
- package/docs/import-profiles/worldsteel/import-coverage.md +3 -3
- package/docs/import-profiles/worldsteel/import-plan.md +4 -4
- package/docs/import-profiles/worldsteel/profile.md +3 -3
- package/docs/package-distribution-contract.md +24 -16
- package/docs/public-runtime-contract.md +17 -7
- package/docs/runtime-context-contract.md +5 -5
- package/docs/task-authorization-contract.md +3 -3
- package/package-dist/assets/foundry-package-descriptor.json +218 -128
- package/package-dist/scripts/foundry-facade.js +71 -0
- package/package-dist/scripts/foundry-runtime.d.ts +12 -2
- package/package-dist/scripts/lib/finalize-owners/commit-handoff.js +3 -3
- package/package-dist/scripts/lib/finalize-owners/{native-insert-closeout.d.ts → native-draft-closeout.d.ts} +1 -1
- package/package-dist/scripts/lib/finalize-owners/{native-insert-closeout.js → native-draft-closeout.js} +10 -6
- package/package-dist/scripts/lib/finalize-owners/{native-insert-handoff.d.ts → native-draft-handoff.d.ts} +7 -5
- package/package-dist/scripts/lib/finalize-owners/{native-insert-handoff.js → native-draft-handoff.js} +30 -11
- package/package-dist/scripts/lib/finalize-owners/post-write-closeout.js +2 -2
- package/package-dist/scripts/lib/foundry-authorization-input.d.ts +10 -1
- package/package-dist/scripts/lib/foundry-authorization-input.js +27 -3
- package/package-dist/scripts/lib/foundry-command-metadata.js +25 -2
- package/package-dist/scripts/lib/foundry-command-registry.d.ts +4 -4
- package/package-dist/scripts/lib/foundry-command-registry.js +3 -0
- package/package-dist/scripts/lib/foundry-execution-admission.js +3 -3
- package/package-dist/scripts/lib/foundry-facade-store.js +56 -6
- package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +33 -16
- package/package-dist/scripts/lib/foundry-owner-execution-store.js +32 -3
- package/package-dist/scripts/lib/foundry-owner-readback.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-owner-readback.js +101 -27
- package/package-dist/scripts/lib/foundry-package-contract.d.ts +2 -2
- package/package-dist/scripts/lib/foundry-package-contract.js +5 -5
- package/package-dist/scripts/lib/foundry-repair-execution.d.ts +11 -0
- package/package-dist/scripts/lib/foundry-repair-execution.js +70 -0
- package/package-dist/scripts/lib/foundry-repair-handoff.d.ts +16 -0
- package/package-dist/scripts/lib/foundry-repair-handoff.js +108 -0
- package/package-dist/scripts/lib/foundry-repair-preflight.d.ts +96 -0
- package/package-dist/scripts/lib/foundry-repair-preflight.js +313 -0
- package/package-dist/scripts/lib/foundry-repair-reference-binding.d.ts +26 -0
- package/package-dist/scripts/lib/foundry-repair-reference-binding.js +120 -0
- package/package-dist/scripts/lib/foundry-repair-reference-proof.d.ts +63 -0
- package/package-dist/scripts/lib/foundry-repair-reference-proof.js +329 -0
- package/package-dist/scripts/lib/foundry-repair-scope.d.ts +76 -0
- package/package-dist/scripts/lib/foundry-repair-scope.js +304 -0
- package/package-dist/scripts/lib/foundry-runtime-command-policy.js +1 -0
- package/package-dist/scripts/lib/foundry-runtime-qualification.js +2 -2
- package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-runtime-utils.js +6 -1
- package/package-dist/scripts/lib/foundry-successor-predecessor.d.ts +36 -0
- package/package-dist/scripts/lib/foundry-successor-predecessor.js +399 -0
- package/package-dist/scripts/lib/foundry-task-registration.js +64 -3
- package/package-dist/scripts/lib/foundry-task-start-spec.d.ts +3 -0
- package/package-dist/scripts/lib/foundry-task-start-spec.js +24 -1
- package/package-dist/scripts/lib/foundry-task-store.d.ts +13 -1
- package/package-dist/scripts/lib/foundry-task-store.js +23 -12
- package/package-dist/scripts/lib/foundry-task-types.d.ts +22 -1
- package/package-dist/scripts/lib/foundry-tidas-source.d.ts +15 -0
- package/package-dist/scripts/lib/foundry-tidas-source.js +90 -0
- package/package-dist/scripts/lib/foundry-workflow-authorization.d.ts +2 -1
- package/package-dist/scripts/lib/foundry-workflow-authorization.js +194 -26
- package/package-dist/scripts/lib/foundry-workflow-context.js +4 -0
- package/package-dist/scripts/lib/foundry-workflow-execution.js +6 -1
- package/package-dist/scripts/lib/foundry-workflow-repair.d.ts +36 -0
- package/package-dist/scripts/lib/foundry-workflow-repair.js +580 -0
- package/package-dist/scripts/lib/foundry-workflow-state.js +66 -18
- package/package-dist/scripts/lib/import-curation/curation-cleanup.js +39 -8
- package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +1 -1
- package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.d.ts +13 -2
- package/package-dist/scripts/lib/import-curation/internal/prewrite-cleanup.js +100 -29
- package/package-dist/scripts/lib/import-curation/internal/workflow-authoring-tasks.js +1 -2
- package/package-dist/scripts/lib/import-curation/internal/workflow-patch-collect.js +2 -3
- package/package-dist/scripts/lib/import-curation/internal/workflow-queue-context.js +8 -8
- package/package-dist/scripts/lib/import-curation/internal/workflow-semantic-actions.js +12 -2
- package/package.json +5 -5
- package/specs/import-profiles.json +1 -1
- package/specs/schemas/foundry-authorization-input.schema.json +45 -2
- package/specs/schemas/foundry-managed-runtime.schema.json +1 -1
- package/specs/schemas/foundry-package-descriptor.schema.json +2 -2
- package/specs/schemas/foundry-task-start.schema.json +200 -19
- package/specs/schemas/runtime-qualification.schema.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const publicCommands: readonly ["init", "doctor", "env-check", "workflow-check", "storage-check", "surface-audit", "acceptance-check", "workspace-map", "capabilities-list", "profiles-list", "route-task", "tasks-list", "tasks-check", "task-complete", "tidas-handshake"];
|
|
2
|
-
export declare const datasetPolicyCommands: readonly ["dataset-tidas-import", "dataset-tidas-validate", "execution-capsule-admit", "dataset-incremental-change-set-compose", "dataset-topology-convergence-compose", "dataset-curation-queue-build", "dataset-curation-gate", "dataset-authoring-plan", "dataset-authoring-task-build", "dataset-authoring-patch-collect", "dataset-identity-decision-task-build", "dataset-classification-decision-task-build", "dataset-library-classification-decisions-project", "dataset-bafu-leaf-classification-tasks-prepare", "dataset-bafu-leaf-classification-category-map-project", "dataset-bafu-identity-decisions-autofill", "dataset-bafu-authoring-patches-autofill", "dataset-classification-decisions-apply", "dataset-location-decision-task-build", "dataset-location-decisions-suggest", "dataset-location-decisions-apply", "dataset-curation-cleanup", "dataset-patch-apply", "dataset-support-cache-refresh", "dataset-canonical-support-mappings-autofill", "dataset-bundle-sample-rows", "dataset-identity-preflight-requests-build", "dataset-identity-preflight-query-audit", "dataset-identity-preflight-run", "dataset-identity-preflight-index-merge", "dataset-library-index-build", "dataset-library-authoring-plan", "dataset-library-identity-decisions-from-preflight", "dataset-library-decisions-apply", "dataset-process-scope-run", "dataset-bafu-process-scope-e2e", "dataset-bafu-batch-import-run", "dataset-uslci-batch-import-run", "dataset-worldsteel-batch-import-run", "dataset-bafu-universe-coverage-report", "dataset-identity-reference-rewrites-apply", "dataset-identity-decisions-apply", "dataset-post-authoring-finalize", "dataset-commit-handoff-plan", "dataset-post-write-closeout", "dataset-import-completion-report", "dataset-import-ledger-report", "dataset-mutation-manifest"];
|
|
3
|
-
export declare const knownCommands: ("acceptance-check" | "capabilities-list" | "dataset-authoring-patch-collect" | "dataset-authoring-plan" | "dataset-authoring-task-build" | "dataset-bafu-authoring-patches-autofill" | "dataset-bafu-batch-import-run" | "dataset-bafu-identity-decisions-autofill" | "dataset-bafu-leaf-classification-category-map-project" | "dataset-bafu-leaf-classification-tasks-prepare" | "dataset-bafu-process-scope-e2e" | "dataset-bafu-universe-coverage-report" | "dataset-bundle-sample-rows" | "dataset-canonical-support-mappings-autofill" | "dataset-classification-decision-task-build" | "dataset-classification-decisions-apply" | "dataset-commit-handoff-plan" | "dataset-curation-cleanup" | "dataset-curation-gate" | "dataset-curation-queue-build" | "dataset-identity-decision-task-build" | "dataset-identity-decisions-apply" | "dataset-identity-preflight-index-merge" | "dataset-identity-preflight-query-audit" | "dataset-identity-preflight-requests-build" | "dataset-identity-preflight-run" | "dataset-identity-reference-rewrites-apply" | "dataset-import-completion-report" | "dataset-import-ledger-report" | "dataset-incremental-change-set-compose" | "dataset-library-authoring-plan" | "dataset-library-classification-decisions-project" | "dataset-library-decisions-apply" | "dataset-library-identity-decisions-from-preflight" | "dataset-library-index-build" | "dataset-location-decision-task-build" | "dataset-location-decisions-apply" | "dataset-location-decisions-suggest" | "dataset-mutation-manifest" | "dataset-patch-apply" | "dataset-post-authoring-finalize" | "dataset-post-write-closeout" | "dataset-process-scope-run" | "dataset-support-cache-refresh" | "dataset-tidas-import" | "dataset-tidas-validate" | "dataset-topology-convergence-compose" | "dataset-uslci-batch-import-run" | "dataset-worldsteel-batch-import-run" | "doctor" | "env-check" | "execution-capsule-admit" | "init" | "profiles-list" | "route-task" | "storage-check" | "surface-audit" | "task-complete" | "tasks-check" | "tasks-list" | "tidas-handshake" | "workflow-check" | "workspace-map")[];
|
|
2
|
+
export declare const datasetPolicyCommands: readonly ["dataset-tidas-import", "dataset-tidas-validate", "execution-capsule-admit", "dataset-incremental-change-set-compose", "dataset-topology-convergence-compose", "final-delivery-promote", "dataset-curation-queue-build", "dataset-curation-gate", "dataset-authoring-plan", "dataset-authoring-task-build", "dataset-authoring-patch-collect", "dataset-identity-decision-task-build", "dataset-classification-decision-task-build", "dataset-library-classification-decisions-project", "dataset-bafu-leaf-classification-tasks-prepare", "dataset-bafu-leaf-classification-category-map-project", "dataset-bafu-identity-decisions-autofill", "dataset-bafu-authoring-patches-autofill", "dataset-classification-decisions-apply", "dataset-location-decision-task-build", "dataset-location-decisions-suggest", "dataset-location-decisions-apply", "dataset-curation-cleanup", "dataset-patch-apply", "dataset-support-cache-refresh", "dataset-canonical-support-mappings-autofill", "dataset-bundle-sample-rows", "dataset-identity-preflight-requests-build", "dataset-identity-preflight-query-audit", "dataset-identity-preflight-run", "dataset-identity-preflight-index-merge", "dataset-library-index-build", "dataset-library-authoring-plan", "dataset-library-identity-decisions-from-preflight", "dataset-library-decisions-apply", "dataset-process-scope-run", "dataset-bafu-process-scope-e2e", "dataset-bafu-batch-import-run", "dataset-uslci-batch-import-run", "dataset-worldsteel-batch-import-run", "dataset-bafu-universe-coverage-report", "dataset-identity-reference-rewrites-apply", "dataset-identity-decisions-apply", "dataset-post-authoring-finalize", "dataset-commit-handoff-plan", "dataset-post-write-closeout", "dataset-import-completion-report", "dataset-import-ledger-report", "dataset-mutation-manifest"];
|
|
3
|
+
export declare const knownCommands: ("acceptance-check" | "capabilities-list" | "dataset-authoring-patch-collect" | "dataset-authoring-plan" | "dataset-authoring-task-build" | "dataset-bafu-authoring-patches-autofill" | "dataset-bafu-batch-import-run" | "dataset-bafu-identity-decisions-autofill" | "dataset-bafu-leaf-classification-category-map-project" | "dataset-bafu-leaf-classification-tasks-prepare" | "dataset-bafu-process-scope-e2e" | "dataset-bafu-universe-coverage-report" | "dataset-bundle-sample-rows" | "dataset-canonical-support-mappings-autofill" | "dataset-classification-decision-task-build" | "dataset-classification-decisions-apply" | "dataset-commit-handoff-plan" | "dataset-curation-cleanup" | "dataset-curation-gate" | "dataset-curation-queue-build" | "dataset-identity-decision-task-build" | "dataset-identity-decisions-apply" | "dataset-identity-preflight-index-merge" | "dataset-identity-preflight-query-audit" | "dataset-identity-preflight-requests-build" | "dataset-identity-preflight-run" | "dataset-identity-reference-rewrites-apply" | "dataset-import-completion-report" | "dataset-import-ledger-report" | "dataset-incremental-change-set-compose" | "dataset-library-authoring-plan" | "dataset-library-classification-decisions-project" | "dataset-library-decisions-apply" | "dataset-library-identity-decisions-from-preflight" | "dataset-library-index-build" | "dataset-location-decision-task-build" | "dataset-location-decisions-apply" | "dataset-location-decisions-suggest" | "dataset-mutation-manifest" | "dataset-patch-apply" | "dataset-post-authoring-finalize" | "dataset-post-write-closeout" | "dataset-process-scope-run" | "dataset-support-cache-refresh" | "dataset-tidas-import" | "dataset-tidas-validate" | "dataset-topology-convergence-compose" | "dataset-uslci-batch-import-run" | "dataset-worldsteel-batch-import-run" | "doctor" | "env-check" | "execution-capsule-admit" | "final-delivery-promote" | "init" | "profiles-list" | "route-task" | "storage-check" | "surface-audit" | "task-complete" | "tasks-check" | "tasks-list" | "tidas-handshake" | "workflow-check" | "workspace-map")[];
|
|
4
4
|
export type FoundryCommand = (typeof knownCommands)[number];
|
|
5
5
|
type CommandResult = {
|
|
6
6
|
status?: string;
|
|
@@ -26,8 +26,8 @@ type CommandResult = {
|
|
|
26
26
|
};
|
|
27
27
|
export declare function usage(): {
|
|
28
28
|
public_commands: readonly ["init", "doctor", "env-check", "workflow-check", "storage-check", "surface-audit", "acceptance-check", "workspace-map", "capabilities-list", "profiles-list", "route-task", "tasks-list", "tasks-check", "task-complete", "tidas-handshake"];
|
|
29
|
-
dataset_policy_commands: readonly ["dataset-tidas-import", "dataset-tidas-validate", "execution-capsule-admit", "dataset-incremental-change-set-compose", "dataset-topology-convergence-compose", "dataset-curation-queue-build", "dataset-curation-gate", "dataset-authoring-plan", "dataset-authoring-task-build", "dataset-authoring-patch-collect", "dataset-identity-decision-task-build", "dataset-classification-decision-task-build", "dataset-library-classification-decisions-project", "dataset-bafu-leaf-classification-tasks-prepare", "dataset-bafu-leaf-classification-category-map-project", "dataset-bafu-identity-decisions-autofill", "dataset-bafu-authoring-patches-autofill", "dataset-classification-decisions-apply", "dataset-location-decision-task-build", "dataset-location-decisions-suggest", "dataset-location-decisions-apply", "dataset-curation-cleanup", "dataset-patch-apply", "dataset-support-cache-refresh", "dataset-canonical-support-mappings-autofill", "dataset-bundle-sample-rows", "dataset-identity-preflight-requests-build", "dataset-identity-preflight-query-audit", "dataset-identity-preflight-run", "dataset-identity-preflight-index-merge", "dataset-library-index-build", "dataset-library-authoring-plan", "dataset-library-identity-decisions-from-preflight", "dataset-library-decisions-apply", "dataset-process-scope-run", "dataset-bafu-process-scope-e2e", "dataset-bafu-batch-import-run", "dataset-uslci-batch-import-run", "dataset-worldsteel-batch-import-run", "dataset-bafu-universe-coverage-report", "dataset-identity-reference-rewrites-apply", "dataset-identity-decisions-apply", "dataset-post-authoring-finalize", "dataset-commit-handoff-plan", "dataset-post-write-closeout", "dataset-import-completion-report", "dataset-import-ledger-report", "dataset-mutation-manifest"];
|
|
30
|
-
commands: ("acceptance-check" | "capabilities-list" | "dataset-authoring-patch-collect" | "dataset-authoring-plan" | "dataset-authoring-task-build" | "dataset-bafu-authoring-patches-autofill" | "dataset-bafu-batch-import-run" | "dataset-bafu-identity-decisions-autofill" | "dataset-bafu-leaf-classification-category-map-project" | "dataset-bafu-leaf-classification-tasks-prepare" | "dataset-bafu-process-scope-e2e" | "dataset-bafu-universe-coverage-report" | "dataset-bundle-sample-rows" | "dataset-canonical-support-mappings-autofill" | "dataset-classification-decision-task-build" | "dataset-classification-decisions-apply" | "dataset-commit-handoff-plan" | "dataset-curation-cleanup" | "dataset-curation-gate" | "dataset-curation-queue-build" | "dataset-identity-decision-task-build" | "dataset-identity-decisions-apply" | "dataset-identity-preflight-index-merge" | "dataset-identity-preflight-query-audit" | "dataset-identity-preflight-requests-build" | "dataset-identity-preflight-run" | "dataset-identity-reference-rewrites-apply" | "dataset-import-completion-report" | "dataset-import-ledger-report" | "dataset-incremental-change-set-compose" | "dataset-library-authoring-plan" | "dataset-library-classification-decisions-project" | "dataset-library-decisions-apply" | "dataset-library-identity-decisions-from-preflight" | "dataset-library-index-build" | "dataset-location-decision-task-build" | "dataset-location-decisions-apply" | "dataset-location-decisions-suggest" | "dataset-mutation-manifest" | "dataset-patch-apply" | "dataset-post-authoring-finalize" | "dataset-post-write-closeout" | "dataset-process-scope-run" | "dataset-support-cache-refresh" | "dataset-tidas-import" | "dataset-tidas-validate" | "dataset-topology-convergence-compose" | "dataset-uslci-batch-import-run" | "dataset-worldsteel-batch-import-run" | "doctor" | "env-check" | "execution-capsule-admit" | "init" | "profiles-list" | "route-task" | "storage-check" | "surface-audit" | "task-complete" | "tasks-check" | "tasks-list" | "tidas-handshake" | "workflow-check" | "workspace-map")[];
|
|
29
|
+
dataset_policy_commands: readonly ["dataset-tidas-import", "dataset-tidas-validate", "execution-capsule-admit", "dataset-incremental-change-set-compose", "dataset-topology-convergence-compose", "final-delivery-promote", "dataset-curation-queue-build", "dataset-curation-gate", "dataset-authoring-plan", "dataset-authoring-task-build", "dataset-authoring-patch-collect", "dataset-identity-decision-task-build", "dataset-classification-decision-task-build", "dataset-library-classification-decisions-project", "dataset-bafu-leaf-classification-tasks-prepare", "dataset-bafu-leaf-classification-category-map-project", "dataset-bafu-identity-decisions-autofill", "dataset-bafu-authoring-patches-autofill", "dataset-classification-decisions-apply", "dataset-location-decision-task-build", "dataset-location-decisions-suggest", "dataset-location-decisions-apply", "dataset-curation-cleanup", "dataset-patch-apply", "dataset-support-cache-refresh", "dataset-canonical-support-mappings-autofill", "dataset-bundle-sample-rows", "dataset-identity-preflight-requests-build", "dataset-identity-preflight-query-audit", "dataset-identity-preflight-run", "dataset-identity-preflight-index-merge", "dataset-library-index-build", "dataset-library-authoring-plan", "dataset-library-identity-decisions-from-preflight", "dataset-library-decisions-apply", "dataset-process-scope-run", "dataset-bafu-process-scope-e2e", "dataset-bafu-batch-import-run", "dataset-uslci-batch-import-run", "dataset-worldsteel-batch-import-run", "dataset-bafu-universe-coverage-report", "dataset-identity-reference-rewrites-apply", "dataset-identity-decisions-apply", "dataset-post-authoring-finalize", "dataset-commit-handoff-plan", "dataset-post-write-closeout", "dataset-import-completion-report", "dataset-import-ledger-report", "dataset-mutation-manifest"];
|
|
30
|
+
commands: ("acceptance-check" | "capabilities-list" | "dataset-authoring-patch-collect" | "dataset-authoring-plan" | "dataset-authoring-task-build" | "dataset-bafu-authoring-patches-autofill" | "dataset-bafu-batch-import-run" | "dataset-bafu-identity-decisions-autofill" | "dataset-bafu-leaf-classification-category-map-project" | "dataset-bafu-leaf-classification-tasks-prepare" | "dataset-bafu-process-scope-e2e" | "dataset-bafu-universe-coverage-report" | "dataset-bundle-sample-rows" | "dataset-canonical-support-mappings-autofill" | "dataset-classification-decision-task-build" | "dataset-classification-decisions-apply" | "dataset-commit-handoff-plan" | "dataset-curation-cleanup" | "dataset-curation-gate" | "dataset-curation-queue-build" | "dataset-identity-decision-task-build" | "dataset-identity-decisions-apply" | "dataset-identity-preflight-index-merge" | "dataset-identity-preflight-query-audit" | "dataset-identity-preflight-requests-build" | "dataset-identity-preflight-run" | "dataset-identity-reference-rewrites-apply" | "dataset-import-completion-report" | "dataset-import-ledger-report" | "dataset-incremental-change-set-compose" | "dataset-library-authoring-plan" | "dataset-library-classification-decisions-project" | "dataset-library-decisions-apply" | "dataset-library-identity-decisions-from-preflight" | "dataset-library-index-build" | "dataset-location-decision-task-build" | "dataset-location-decisions-apply" | "dataset-location-decisions-suggest" | "dataset-mutation-manifest" | "dataset-patch-apply" | "dataset-post-authoring-finalize" | "dataset-post-write-closeout" | "dataset-process-scope-run" | "dataset-support-cache-refresh" | "dataset-tidas-import" | "dataset-tidas-validate" | "dataset-topology-convergence-compose" | "dataset-uslci-batch-import-run" | "dataset-worldsteel-batch-import-run" | "doctor" | "env-check" | "execution-capsule-admit" | "final-delivery-promote" | "init" | "profiles-list" | "route-task" | "storage-check" | "surface-audit" | "task-complete" | "tasks-check" | "tasks-list" | "tidas-handshake" | "workflow-check" | "workspace-map")[];
|
|
31
31
|
ownership_note: string;
|
|
32
32
|
};
|
|
33
33
|
export declare function exitCodeForCommand(command: string, result: CommandResult | null | undefined): number;
|
|
@@ -21,6 +21,7 @@ export const datasetPolicyCommands = [
|
|
|
21
21
|
"execution-capsule-admit",
|
|
22
22
|
"dataset-incremental-change-set-compose",
|
|
23
23
|
"dataset-topology-convergence-compose",
|
|
24
|
+
"final-delivery-promote",
|
|
24
25
|
"dataset-curation-queue-build",
|
|
25
26
|
"dataset-curation-gate",
|
|
26
27
|
"dataset-authoring-plan",
|
|
@@ -109,6 +110,8 @@ export function exitCodeForCommand(command, result) {
|
|
|
109
110
|
return result?.foundry_wrapper?.exit_code ?? 1;
|
|
110
111
|
case "execution-capsule-admit":
|
|
111
112
|
return statusIs(result, ["help", "sealed"]) ? 0 : 1;
|
|
113
|
+
case "final-delivery-promote":
|
|
114
|
+
return statusIs(result, ["help", "promoted"]) ? 0 : 1;
|
|
112
115
|
case "dataset-incremental-change-set-compose":
|
|
113
116
|
return statusIs(result, ["help", "completed", "completed_with_holds", "completed_no_actions"])
|
|
114
117
|
? 0
|
|
@@ -2,7 +2,7 @@ import { parseCapsule, FOUNDRY_EXECUTION_CAPSULE_SCHEMA, } from "./foundry-execu
|
|
|
2
2
|
export { FOUNDRY_EXECUTION_CAPSULE_SCHEMA, } from "./foundry-execution-context-format.js";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { readNativeDraftHandoff } from "./finalize-owners/native-draft-handoff.js";
|
|
6
6
|
import { readHandoffReferenceEvidence } from "./finalize-owners/handoff-reference-intent.js";
|
|
7
7
|
import { assertFoundryCommandSpecArtifactsCurrent, commandSpecOptionValue, parseFoundryCommandSpec, } from "@tiangong-lca/cli/command-spec";
|
|
8
8
|
import { assertFoundryRuntimeContext, assertFoundryWorkspaceActive, captureFoundryInput, FoundryContextError, readFoundryInput, resolveFoundryInputPath, resolveFoundryOutput, writeFoundryArtifact, } from "./foundry-runtime-context.js";
|
|
@@ -84,7 +84,7 @@ function commandSpec(context, value, finalRows, actions) {
|
|
|
84
84
|
["flow", "process", "source"].includes(datasetType));
|
|
85
85
|
if (nativeFile) {
|
|
86
86
|
if (!nativeSave)
|
|
87
|
-
fail("execution_command_unadmitted", "Native
|
|
87
|
+
fail("execution_command_unadmitted", "Native draft contracts require the reviewed dataset save-draft operation.");
|
|
88
88
|
const fact = selected(context, nativeFile);
|
|
89
89
|
const bound = contractArtifacts[0];
|
|
90
90
|
if (resolveSpecArtifact(context, bound.path) !== fact.path ||
|
|
@@ -93,7 +93,7 @@ function commandSpec(context, value, finalRows, actions) {
|
|
|
93
93
|
fail("execution_native_contract_unbound", "Native contract must bind the independently selected current bytes.");
|
|
94
94
|
readFoundryInput(context, fact.path, 8 * 1024 * 1024);
|
|
95
95
|
readFoundryInput(context, finalRows.path);
|
|
96
|
-
const native =
|
|
96
|
+
const native = readNativeDraftHandoff({
|
|
97
97
|
contractFile: fact.path,
|
|
98
98
|
rowsFile: finalRows.path,
|
|
99
99
|
datasetType: datasetType,
|
|
@@ -5,6 +5,20 @@ import { withBatchRunLock } from "@tiangong-lca/cli/batch";
|
|
|
5
5
|
import { assertFoundryRuntimeContext, assertFoundryWorkspaceWrite, assertPendingFoundryTaskIntent, FoundryContextError, resolveFoundryOutput, } from "./foundry-runtime-context.js";
|
|
6
6
|
import { parseFoundryTaskStartSpec, taskStartSpecFingerprint, } from "./foundry-task-start-spec.js";
|
|
7
7
|
import { sha256Json } from "./identity-preflight-proof.js";
|
|
8
|
+
import { assertFoundryNoDispatchSuccessor } from "./foundry-successor-predecessor.js";
|
|
9
|
+
function successorLinks(chain) {
|
|
10
|
+
return new Map(chain.slice(0, -1).map((link, index) => [link.task_id, chain[index + 1]]));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An explicitly declared predecessor must be a retained revision of this same request. A declaration
|
|
14
|
+
* naming a foreign task grants nothing and is refused, so a cross-request or dangling binding can
|
|
15
|
+
* never be mistaken for a verified successor link.
|
|
16
|
+
*/
|
|
17
|
+
function requireDeclaredPredecessor(spec, retained) {
|
|
18
|
+
const declared = spec.repair?.predecessor ?? null;
|
|
19
|
+
if (declared && !retained.some((revision) => revision.task_id === declared.task_id))
|
|
20
|
+
fail("facade_predecessor_readback_required", `Declared predecessor ${declared.task_id} is not a retained revision of this request; use its original owner for status/readback before any revision can continue.`);
|
|
21
|
+
}
|
|
8
22
|
export const FOUNDRY_FACADE_REQUEST_INDEX_SCHEMA = "tiangong-foundry.facade-request-index.v1";
|
|
9
23
|
export const FOUNDRY_FACADE_TASK_POINTER_SCHEMA = "tiangong-foundry.facade-task-pointer.v1";
|
|
10
24
|
const shaPattern = /^[0-9a-f]{64}$/u;
|
|
@@ -258,7 +272,14 @@ function pointer(value, context) {
|
|
|
258
272
|
fail("facade_task_pointer_invalid", "Facade task pointer is malformed.");
|
|
259
273
|
return item;
|
|
260
274
|
}
|
|
261
|
-
|
|
275
|
+
/**
|
|
276
|
+
* Every retained predecessor must be unattempted, or carry its own explicitly declared successor
|
|
277
|
+
* whose evidence proves the predecessor's only terminal outcome was a CLI failure that dispatched
|
|
278
|
+
* nothing. The exception is additive: the failure code and message for every other case are
|
|
279
|
+
* unchanged, and it is re-derived from the predecessor's own index on every call, so start, status
|
|
280
|
+
* and resume always agree.
|
|
281
|
+
*/
|
|
282
|
+
function requireUnattemptedPredecessors(context, predecessors, successors) {
|
|
262
283
|
for (const predecessor of predecessors) {
|
|
263
284
|
const workspaces = path.join(context.controlRoot, "workspaces"), taskRoot = path.join(workspaces, predecessor.task_id), jobFile = path.join(taskRoot, "foundry-job.json");
|
|
264
285
|
try {
|
|
@@ -297,8 +318,21 @@ function requireUnattemptedPredecessors(context, predecessors) {
|
|
|
297
318
|
fail("facade_predecessor_history_invalid", "Predecessor attempts must remain a contained directory.");
|
|
298
319
|
const directory = fs.opendirSync(attempts);
|
|
299
320
|
try {
|
|
300
|
-
if (directory.readSync())
|
|
301
|
-
|
|
321
|
+
if (directory.readSync()) {
|
|
322
|
+
const successor = successors.get(predecessor.task_id);
|
|
323
|
+
if (!successor)
|
|
324
|
+
fail("facade_predecessor_readback_required", `Retained predecessor ${predecessor.task_id} has attempt evidence; use its original owner for status/readback before any revision can continue.`);
|
|
325
|
+
assertFoundryNoDispatchSuccessor({
|
|
326
|
+
context,
|
|
327
|
+
predecessorTaskId: predecessor.task_id,
|
|
328
|
+
predecessorInputs: predecessor.inputs,
|
|
329
|
+
successor: {
|
|
330
|
+
task_id: successor.task_id,
|
|
331
|
+
spec: successor.spec,
|
|
332
|
+
inputs: successor.inputs,
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
}
|
|
302
336
|
}
|
|
303
337
|
finally {
|
|
304
338
|
directory.closeSync();
|
|
@@ -341,7 +375,18 @@ export async function registerFoundryFacadeTask(context, options) {
|
|
|
341
375
|
const taskId = `task-${requestSha256}-r${String(revisionNumber).padStart(4, "0")}`;
|
|
342
376
|
assertPendingFoundryTaskIntent(context, taskId, spec.request_id, spec.actor_id, fingerprint);
|
|
343
377
|
const predecessors = stored.index?.revisions.filter((entry) => entry.task_id !== taskId) ?? [];
|
|
344
|
-
|
|
378
|
+
// The incoming revision is the chain's last link: an earlier predecessor's recorded exception
|
|
379
|
+
// is only current while this spec still declares it with the same terminal report digest.
|
|
380
|
+
const successors = successorLinks([
|
|
381
|
+
...(stored.index?.revisions ?? []).map((entry) => ({
|
|
382
|
+
task_id: entry.task_id,
|
|
383
|
+
spec: entry.spec,
|
|
384
|
+
inputs: entry.inputs,
|
|
385
|
+
})),
|
|
386
|
+
{ task_id: taskId, spec, inputs: options.inputs },
|
|
387
|
+
]);
|
|
388
|
+
requireDeclaredPredecessor(spec, [...predecessors, { task_id: taskId }]);
|
|
389
|
+
requireUnattemptedPredecessors(context, predecessors, successors);
|
|
345
390
|
let task;
|
|
346
391
|
try {
|
|
347
392
|
task = options.createOrLoad(taskId);
|
|
@@ -359,7 +404,7 @@ export async function registerFoundryFacadeTask(context, options) {
|
|
|
359
404
|
throw error;
|
|
360
405
|
}
|
|
361
406
|
let selected = latest;
|
|
362
|
-
requireUnattemptedPredecessors(context, predecessors);
|
|
407
|
+
requireUnattemptedPredecessors(context, predecessors, successors);
|
|
363
408
|
if (!latest || latest.fingerprint_sha256 !== fingerprint) {
|
|
364
409
|
const unsigned = {
|
|
365
410
|
revision: revisionNumber,
|
|
@@ -434,7 +479,12 @@ export function loadFoundryFacadeTaskRecord(context, taskId, actorId) {
|
|
|
434
479
|
fail("facade_task_pointer_invalid", "Facade task pointer has no current request revision.");
|
|
435
480
|
if (selected.spec.actor_id !== actorId)
|
|
436
481
|
fail("task_actor_mismatch", "Current actor does not match the registered task intent.");
|
|
437
|
-
|
|
482
|
+
requireDeclaredPredecessor(selected.spec, request.revisions.slice(0, taskPointer.revision - 1));
|
|
483
|
+
requireUnattemptedPredecessors(context, request.revisions.slice(0, taskPointer.revision - 1), successorLinks(request.revisions.map((entry) => ({
|
|
484
|
+
task_id: entry.task_id,
|
|
485
|
+
spec: entry.spec,
|
|
486
|
+
inputs: entry.inputs,
|
|
487
|
+
}))));
|
|
438
488
|
return Object.freeze({
|
|
439
489
|
request_sha256: taskPointer.request_sha256,
|
|
440
490
|
revision: selected.revision,
|
|
@@ -3,7 +3,18 @@ import { type FoundryRuntimeContext } from "./foundry-runtime-context.ts";
|
|
|
3
3
|
import { readWorkflowArtifact } from "./foundry-workflow-state.ts";
|
|
4
4
|
import type { ArtifactEntry } from "./foundry-task-types.ts";
|
|
5
5
|
export type OwnerExecutionRequest = ReturnType<typeof buildRequest>;
|
|
6
|
+
/**
|
|
7
|
+
* The finalization and mutation evidence a sealed owner scope must retain. Only the registered repair
|
|
8
|
+
* scope — the repair kind whose handoff declares `repair_scope: true` — has neither; any other sealed
|
|
9
|
+
* scope that lost one is refused rather than prepared.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ownerExecutionScopeFiles(assetRoot: string, authorizationValue: Record<string, unknown>, handoff: Record<string, unknown>): Readonly<{
|
|
12
|
+
finalize_file: string | null;
|
|
13
|
+
mutation_file: string | null;
|
|
14
|
+
}>;
|
|
6
15
|
declare function buildRequest(context: FoundryRuntimeContext, authorization: ReturnType<typeof readWorkflowArtifact>): {
|
|
16
|
+
finalize_file: string | null;
|
|
17
|
+
mutation_file: string | null;
|
|
7
18
|
schema: "tiangong-foundry.owner-execution-request.v1";
|
|
8
19
|
scope_id: string;
|
|
9
20
|
content: {
|
|
@@ -21,6 +32,7 @@ declare function buildRequest(context: FoundryRuntimeContext, authorization: Ret
|
|
|
21
32
|
state_code: number;
|
|
22
33
|
dataset_type: string;
|
|
23
34
|
account_mode: string;
|
|
35
|
+
repair_scope?: true | undefined;
|
|
24
36
|
};
|
|
25
37
|
contract: import("@tiangong-lca/cli/batch").BatchContract<{
|
|
26
38
|
task: string;
|
|
@@ -32,8 +44,6 @@ declare function buildRequest(context: FoundryRuntimeContext, authorization: Ret
|
|
|
32
44
|
policy_sha256: string;
|
|
33
45
|
}>;
|
|
34
46
|
handoff_file: string;
|
|
35
|
-
finalize_file: string;
|
|
36
|
-
mutation_file: string;
|
|
37
47
|
};
|
|
38
48
|
export declare function prepareFoundryOwnerExecution(context: FoundryRuntimeContext, entries: readonly ArtifactEntry[]): Promise<import("./foundry-task-types.ts").JsonRecord>;
|
|
39
49
|
export declare function readOwnerExecutionRequests(context: FoundryRuntimeContext, entries: readonly ArtifactEntry[]): {
|
|
@@ -41,6 +51,8 @@ export declare function readOwnerExecutionRequests(context: FoundryRuntimeContex
|
|
|
41
51
|
file: string;
|
|
42
52
|
value: Record<string, unknown>;
|
|
43
53
|
request: {
|
|
54
|
+
finalize_file: string | null;
|
|
55
|
+
mutation_file: string | null;
|
|
44
56
|
schema: "tiangong-foundry.owner-execution-request.v1";
|
|
45
57
|
scope_id: string;
|
|
46
58
|
content: {
|
|
@@ -58,6 +70,7 @@ export declare function readOwnerExecutionRequests(context: FoundryRuntimeContex
|
|
|
58
70
|
state_code: number;
|
|
59
71
|
dataset_type: string;
|
|
60
72
|
account_mode: string;
|
|
73
|
+
repair_scope?: true | undefined;
|
|
61
74
|
};
|
|
62
75
|
contract: import("@tiangong-lca/cli/batch").BatchContract<{
|
|
63
76
|
task: string;
|
|
@@ -69,8 +82,6 @@ export declare function readOwnerExecutionRequests(context: FoundryRuntimeContex
|
|
|
69
82
|
policy_sha256: string;
|
|
70
83
|
}>;
|
|
71
84
|
handoff_file: string;
|
|
72
|
-
finalize_file: string;
|
|
73
|
-
mutation_file: string;
|
|
74
85
|
};
|
|
75
86
|
}[];
|
|
76
87
|
export declare function ownerAttemptStore(context: FoundryRuntimeContext, scopeId: string, request: {
|
|
@@ -92,6 +103,8 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
92
103
|
file: string;
|
|
93
104
|
value: Record<string, unknown>;
|
|
94
105
|
request: {
|
|
106
|
+
finalize_file: string | null;
|
|
107
|
+
mutation_file: string | null;
|
|
95
108
|
schema: "tiangong-foundry.owner-execution-request.v1";
|
|
96
109
|
scope_id: string;
|
|
97
110
|
content: {
|
|
@@ -109,6 +122,7 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
109
122
|
state_code: number;
|
|
110
123
|
dataset_type: string;
|
|
111
124
|
account_mode: string;
|
|
125
|
+
repair_scope?: true | undefined;
|
|
112
126
|
};
|
|
113
127
|
contract: import("@tiangong-lca/cli/batch").BatchContract<{
|
|
114
128
|
task: string;
|
|
@@ -120,8 +134,6 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
120
134
|
policy_sha256: string;
|
|
121
135
|
}>;
|
|
122
136
|
handoff_file: string;
|
|
123
|
-
finalize_file: string;
|
|
124
|
-
mutation_file: string;
|
|
125
137
|
};
|
|
126
138
|
}[];
|
|
127
139
|
consumed: Map<string, {
|
|
@@ -129,6 +141,8 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
129
141
|
file: string;
|
|
130
142
|
value: Record<string, unknown>;
|
|
131
143
|
request: {
|
|
144
|
+
finalize_file: string | null;
|
|
145
|
+
mutation_file: string | null;
|
|
132
146
|
schema: "tiangong-foundry.owner-execution-request.v1";
|
|
133
147
|
scope_id: string;
|
|
134
148
|
content: {
|
|
@@ -146,6 +160,7 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
146
160
|
state_code: number;
|
|
147
161
|
dataset_type: string;
|
|
148
162
|
account_mode: string;
|
|
163
|
+
repair_scope?: true | undefined;
|
|
149
164
|
};
|
|
150
165
|
contract: import("@tiangong-lca/cli/batch").BatchContract<{
|
|
151
166
|
task: string;
|
|
@@ -157,8 +172,6 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
157
172
|
policy_sha256: string;
|
|
158
173
|
}>;
|
|
159
174
|
handoff_file: string;
|
|
160
|
-
finalize_file: string;
|
|
161
|
-
mutation_file: string;
|
|
162
175
|
};
|
|
163
176
|
}>;
|
|
164
177
|
verified: Map<string, import("./foundry-workflow-state.ts").WorkflowArtifact<Record<string, unknown>>>;
|
|
@@ -167,6 +180,8 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
167
180
|
file: string;
|
|
168
181
|
value: Record<string, unknown>;
|
|
169
182
|
request: {
|
|
183
|
+
finalize_file: string | null;
|
|
184
|
+
mutation_file: string | null;
|
|
170
185
|
schema: "tiangong-foundry.owner-execution-request.v1";
|
|
171
186
|
scope_id: string;
|
|
172
187
|
content: {
|
|
@@ -184,6 +199,7 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
184
199
|
state_code: number;
|
|
185
200
|
dataset_type: string;
|
|
186
201
|
account_mode: string;
|
|
202
|
+
repair_scope?: true | undefined;
|
|
187
203
|
};
|
|
188
204
|
contract: import("@tiangong-lca/cli/batch").BatchContract<{
|
|
189
205
|
task: string;
|
|
@@ -195,8 +211,6 @@ export declare function inspectOwnerExecutions(context: FoundryRuntimeContext, e
|
|
|
195
211
|
policy_sha256: string;
|
|
196
212
|
}>;
|
|
197
213
|
handoff_file: string;
|
|
198
|
-
finalize_file: string;
|
|
199
|
-
mutation_file: string;
|
|
200
214
|
};
|
|
201
215
|
}[];
|
|
202
216
|
};
|
|
@@ -206,6 +220,8 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
206
220
|
file: string;
|
|
207
221
|
value: Record<string, unknown>;
|
|
208
222
|
request: {
|
|
223
|
+
finalize_file: string | null;
|
|
224
|
+
mutation_file: string | null;
|
|
209
225
|
schema: "tiangong-foundry.owner-execution-request.v1";
|
|
210
226
|
scope_id: string;
|
|
211
227
|
content: {
|
|
@@ -223,6 +239,7 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
223
239
|
state_code: number;
|
|
224
240
|
dataset_type: string;
|
|
225
241
|
account_mode: string;
|
|
242
|
+
repair_scope?: true | undefined;
|
|
226
243
|
};
|
|
227
244
|
contract: import("@tiangong-lca/cli/batch").BatchContract<{
|
|
228
245
|
task: string;
|
|
@@ -234,8 +251,6 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
234
251
|
policy_sha256: string;
|
|
235
252
|
}>;
|
|
236
253
|
handoff_file: string;
|
|
237
|
-
finalize_file: string;
|
|
238
|
-
mutation_file: string;
|
|
239
254
|
};
|
|
240
255
|
}[];
|
|
241
256
|
consumed: Map<string, {
|
|
@@ -243,6 +258,8 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
243
258
|
file: string;
|
|
244
259
|
value: Record<string, unknown>;
|
|
245
260
|
request: {
|
|
261
|
+
finalize_file: string | null;
|
|
262
|
+
mutation_file: string | null;
|
|
246
263
|
schema: "tiangong-foundry.owner-execution-request.v1";
|
|
247
264
|
scope_id: string;
|
|
248
265
|
content: {
|
|
@@ -260,6 +277,7 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
260
277
|
state_code: number;
|
|
261
278
|
dataset_type: string;
|
|
262
279
|
account_mode: string;
|
|
280
|
+
repair_scope?: true | undefined;
|
|
263
281
|
};
|
|
264
282
|
contract: import("@tiangong-lca/cli/batch").BatchContract<{
|
|
265
283
|
task: string;
|
|
@@ -271,8 +289,6 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
271
289
|
policy_sha256: string;
|
|
272
290
|
}>;
|
|
273
291
|
handoff_file: string;
|
|
274
|
-
finalize_file: string;
|
|
275
|
-
mutation_file: string;
|
|
276
292
|
};
|
|
277
293
|
}>;
|
|
278
294
|
verified: Map<string, import("./foundry-workflow-state.ts").WorkflowArtifact<Record<string, unknown>>>;
|
|
@@ -281,6 +297,8 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
281
297
|
file: string;
|
|
282
298
|
value: Record<string, unknown>;
|
|
283
299
|
request: {
|
|
300
|
+
finalize_file: string | null;
|
|
301
|
+
mutation_file: string | null;
|
|
284
302
|
schema: "tiangong-foundry.owner-execution-request.v1";
|
|
285
303
|
scope_id: string;
|
|
286
304
|
content: {
|
|
@@ -298,6 +316,7 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
298
316
|
state_code: number;
|
|
299
317
|
dataset_type: string;
|
|
300
318
|
account_mode: string;
|
|
319
|
+
repair_scope?: true | undefined;
|
|
301
320
|
};
|
|
302
321
|
contract: import("@tiangong-lca/cli/batch").BatchContract<{
|
|
303
322
|
task: string;
|
|
@@ -309,8 +328,6 @@ export declare function completedOwnerScopes(context: FoundryRuntimeContext, ent
|
|
|
309
328
|
policy_sha256: string;
|
|
310
329
|
}>;
|
|
311
330
|
handoff_file: string;
|
|
312
|
-
finalize_file: string;
|
|
313
|
-
mutation_file: string;
|
|
314
331
|
};
|
|
315
332
|
}[];
|
|
316
333
|
completed: Map<string, Record<string, unknown>>;
|
|
@@ -8,6 +8,25 @@ import { captureFoundryInput, FoundryContextError, readFoundryInput, resolveFoun
|
|
|
8
8
|
import { currentWorkflowState, readWorkflowArtifact, workflowObject, } from "./foundry-workflow-state.js";
|
|
9
9
|
import { runFoundryTaskOperation } from "./foundry-task-store.js";
|
|
10
10
|
import { sha256Json } from "./identity-preflight-proof.js";
|
|
11
|
+
/**
|
|
12
|
+
* The finalization and mutation evidence a sealed owner scope must retain. Only the registered repair
|
|
13
|
+
* scope — the repair kind whose handoff declares `repair_scope: true` — has neither; any other sealed
|
|
14
|
+
* scope that lost one is refused rather than prepared.
|
|
15
|
+
*/
|
|
16
|
+
export function ownerExecutionScopeFiles(assetRoot, authorizationValue, handoff) {
|
|
17
|
+
const repairScope = authorizationValue.input_kind === "repair_rows" && handoff.repair_scope === true;
|
|
18
|
+
const file = (value, label) => {
|
|
19
|
+
if (typeof value === "string" && value)
|
|
20
|
+
return path.resolve(assetRoot, value);
|
|
21
|
+
if (repairScope)
|
|
22
|
+
return null;
|
|
23
|
+
throw new FoundryContextError("execution_request_invalid", `A sealed owner scope must retain its ${label}.`);
|
|
24
|
+
};
|
|
25
|
+
return Object.freeze({
|
|
26
|
+
finalize_file: file(handoff.finalize_report, "finalization report"),
|
|
27
|
+
mutation_file: file(handoff.mutation_manifest, "mutation manifest"),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
11
30
|
function buildRequest(context, authorization) {
|
|
12
31
|
const value = authorization.value, input = workflowObject(value.input), capsule = workflowObject(value.capsule), handoff = workflowObject(value.handoff);
|
|
13
32
|
if (value.status !== "sealed" ||
|
|
@@ -39,6 +58,9 @@ function buildRequest(context, authorization) {
|
|
|
39
58
|
state_code: 0,
|
|
40
59
|
dataset_type: value.dataset_type,
|
|
41
60
|
account_mode: String(handoff.account_mode ?? "ordinary"),
|
|
61
|
+
...(value.input_kind === "repair_rows" && handoff.repair_scope === true
|
|
62
|
+
? { repair_scope: true }
|
|
63
|
+
: {}),
|
|
42
64
|
};
|
|
43
65
|
const projection = JSON.parse(JSON.stringify(content));
|
|
44
66
|
const contract = createBatchContract({
|
|
@@ -55,8 +77,7 @@ function buildRequest(context, authorization) {
|
|
|
55
77
|
contract,
|
|
56
78
|
item_contract: itemContract,
|
|
57
79
|
handoff_file: path.resolve(context.assetRoot, String(workflowObject(handoff.files).report)),
|
|
58
|
-
|
|
59
|
-
mutation_file: path.resolve(context.assetRoot, String(handoff.mutation_manifest)),
|
|
80
|
+
...ownerExecutionScopeFiles(context.assetRoot, value, handoff),
|
|
60
81
|
};
|
|
61
82
|
}
|
|
62
83
|
export async function prepareFoundryOwnerExecution(context, entries) {
|
|
@@ -281,7 +302,15 @@ export function inspectOwnerExecutions(context, entries) {
|
|
|
281
302
|
const fact = workflowObject(raw);
|
|
282
303
|
if (typeof fact.path !== "string")
|
|
283
304
|
throw new FoundryContextError("execution_result_invalid", "Readback content fact is missing.");
|
|
284
|
-
|
|
305
|
+
if (item.request.policy.repair_scope === true && raw === proof.input) {
|
|
306
|
+
if (fact.path !== item.request.content.input.path ||
|
|
307
|
+
fact.sha256 !== item.request.content.input.sha256 ||
|
|
308
|
+
fact.bytes !== item.request.content.input.bytes)
|
|
309
|
+
throw new FoundryContextError("execution_result_invalid", "Repair readback input must equal the registered source candidate.");
|
|
310
|
+
readFoundryInput(context, fact.path);
|
|
311
|
+
}
|
|
312
|
+
else
|
|
313
|
+
resolveFoundryOutput(context, fact.path);
|
|
285
314
|
const current = captureFoundryInput(fact.path);
|
|
286
315
|
if (current.sha256 !== fact.sha256 || current.bytes !== fact.bytes)
|
|
287
316
|
throw new FoundryContextError("execution_result_changed", "Recorded execution readback evidence changed.");
|
|
@@ -19,6 +19,9 @@ export declare function readbackFoundryOwner(context: FoundryRuntimeContext, qua
|
|
|
19
19
|
checks: import("./foundry-runtime-context-types.ts").FoundryInputFact | null;
|
|
20
20
|
};
|
|
21
21
|
acceptance: import("./foundry-runtime-context-types.ts").FoundryInputFact | null;
|
|
22
|
+
repair_preparation?: import("./foundry-runtime-context-types.ts").FoundryInputFact | undefined;
|
|
23
|
+
publication_ready?: boolean | undefined;
|
|
24
|
+
retained_reference_integrity?: import("./foundry-repair-reference-proof.ts").FoundryRepairReferenceProof | null | undefined;
|
|
22
25
|
blockers: Record<string, unknown>[];
|
|
23
26
|
};
|
|
24
27
|
}>;
|