@tiangong-lca/foundry 0.1.17 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +23 -7
  2. package/docs/architecture.md +15 -3
  3. package/docs/foundry-task-contracts.md +27 -3
  4. package/docs/package-distribution-contract.md +45 -13
  5. package/docs/public-runtime-contract.md +85 -5
  6. package/docs/runtime-context-contract.md +22 -4
  7. package/docs/task-authorization-contract.md +15 -3
  8. package/docs/workspace-migration-contract.md +5 -3
  9. package/package-dist/assets/foundry-package-descriptor.json +541 -177
  10. package/package-dist/scripts/foundry-facade.d.ts +5 -0
  11. package/package-dist/scripts/foundry-facade.js +261 -16
  12. package/package-dist/scripts/foundry-runtime.d.ts +2 -2
  13. package/package-dist/scripts/lib/bundle-sample-utils.d.ts +4 -4
  14. package/package-dist/scripts/lib/bundle-source-context.d.ts +6 -4
  15. package/package-dist/scripts/lib/bundle-source-context.js +10 -8
  16. package/package-dist/scripts/lib/decision-owners/identity-preflight.js +18 -6
  17. package/package-dist/scripts/lib/finalize-owners/cli-wrappers.d.ts +72 -1
  18. package/package-dist/scripts/lib/finalize-owners/cli-wrappers.js +123 -3
  19. package/package-dist/scripts/lib/finalize-owners/post-authoring.d.ts +11 -1
  20. package/package-dist/scripts/lib/finalize-owners/post-authoring.js +65 -9
  21. package/package-dist/scripts/lib/foundry-assessment-producer.d.ts +6 -0
  22. package/package-dist/scripts/lib/foundry-assessment-producer.js +167 -0
  23. package/package-dist/scripts/lib/foundry-authentication-environment.js +1 -1
  24. package/package-dist/scripts/lib/foundry-command-metadata.js +6 -1
  25. package/package-dist/scripts/lib/foundry-curation-queue.d.ts +73 -0
  26. package/package-dist/scripts/lib/foundry-curation-queue.js +261 -0
  27. package/package-dist/scripts/lib/foundry-decision-owners.d.ts +1 -1
  28. package/package-dist/scripts/lib/foundry-decision-owners.js +15 -7
  29. package/package-dist/scripts/lib/foundry-edge-draft-admission.d.ts +17 -0
  30. package/package-dist/scripts/lib/foundry-edge-draft-admission.js +94 -0
  31. package/package-dist/scripts/lib/foundry-edge-identity-preflight.d.ts +47 -0
  32. package/package-dist/scripts/lib/foundry-edge-identity-preflight.js +268 -0
  33. package/package-dist/scripts/lib/foundry-edge-oauth.d.ts +4 -0
  34. package/package-dist/scripts/lib/foundry-edge-oauth.js +154 -0
  35. package/package-dist/scripts/lib/foundry-edge-reference-intent.d.ts +51 -0
  36. package/package-dist/scripts/lib/foundry-edge-reference-intent.js +184 -0
  37. package/package-dist/scripts/lib/foundry-edge-repair-preparation.d.ts +21 -0
  38. package/package-dist/scripts/lib/foundry-edge-repair-preparation.js +120 -0
  39. package/package-dist/scripts/lib/foundry-edge-session.d.ts +15 -0
  40. package/package-dist/scripts/lib/foundry-edge-session.js +69 -0
  41. package/package-dist/scripts/lib/foundry-edge-support-plan.d.ts +69 -0
  42. package/package-dist/scripts/lib/foundry-edge-support-plan.js +245 -0
  43. package/package-dist/scripts/lib/foundry-edge-support-planning.d.ts +115 -0
  44. package/package-dist/scripts/lib/foundry-edge-support-planning.js +259 -0
  45. package/package-dist/scripts/lib/foundry-edge-support.d.ts +19 -0
  46. package/package-dist/scripts/lib/foundry-edge-support.js +188 -0
  47. package/package-dist/scripts/lib/foundry-execution-admission.d.ts +4 -2
  48. package/package-dist/scripts/lib/foundry-execution-admission.js +28 -3
  49. package/package-dist/scripts/lib/foundry-finalize-edge-identity.d.ts +30 -0
  50. package/package-dist/scripts/lib/foundry-finalize-edge-identity.js +102 -0
  51. package/package-dist/scripts/lib/foundry-finalize-owners.d.ts +1 -0
  52. package/package-dist/scripts/lib/foundry-finalize-owners.js +126 -13
  53. package/package-dist/scripts/lib/foundry-identity-stage-input.d.ts +24 -0
  54. package/package-dist/scripts/lib/foundry-identity-stage-input.js +122 -0
  55. package/package-dist/scripts/lib/foundry-identity-stage-state.d.ts +17 -0
  56. package/package-dist/scripts/lib/foundry-identity-stage-state.js +48 -0
  57. package/package-dist/scripts/lib/foundry-installed-entry.d.ts +2 -0
  58. package/package-dist/scripts/lib/foundry-installed-entry.js +173 -0
  59. package/package-dist/scripts/lib/foundry-managed-adoption.d.ts +12 -0
  60. package/package-dist/scripts/lib/foundry-managed-adoption.js +108 -0
  61. package/package-dist/scripts/lib/foundry-managed-authentication.d.ts +4 -0
  62. package/package-dist/scripts/lib/foundry-managed-authentication.js +28 -0
  63. package/package-dist/scripts/lib/foundry-managed-host.js +14 -2
  64. package/package-dist/scripts/lib/foundry-migration-transfer-io.d.ts +2 -0
  65. package/package-dist/scripts/lib/foundry-migration-transfer-io.js +27 -3
  66. package/package-dist/scripts/lib/foundry-operation-result.d.ts +1 -1
  67. package/package-dist/scripts/lib/foundry-operation-result.js +1 -0
  68. package/package-dist/scripts/lib/foundry-owner-execution-store.d.ts +16 -16
  69. package/package-dist/scripts/lib/foundry-owner-execution-store.js +34 -7
  70. package/package-dist/scripts/lib/foundry-owner-readback.d.ts +20 -0
  71. package/package-dist/scripts/lib/foundry-owner-readback.js +42 -0
  72. package/package-dist/scripts/lib/foundry-package-contract.d.ts +4 -4
  73. package/package-dist/scripts/lib/foundry-package-contract.js +10 -2
  74. package/package-dist/scripts/lib/foundry-preparation-cli-validation.d.ts +2 -0
  75. package/package-dist/scripts/lib/foundry-preparation-cli-validation.js +96 -3
  76. package/package-dist/scripts/lib/foundry-process-mass-balance.d.ts +64 -0
  77. package/package-dist/scripts/lib/foundry-process-mass-balance.js +224 -0
  78. package/package-dist/scripts/lib/foundry-process-qa.d.ts +19 -0
  79. package/package-dist/scripts/lib/foundry-process-qa.js +423 -0
  80. package/package-dist/scripts/lib/foundry-quality-review-context.d.ts +3 -0
  81. package/package-dist/scripts/lib/foundry-quality-review-context.js +18 -0
  82. package/package-dist/scripts/lib/foundry-quality-review-input.d.ts +48 -0
  83. package/package-dist/scripts/lib/foundry-quality-review-input.js +284 -0
  84. package/package-dist/scripts/lib/foundry-quality-review-lineage.d.ts +13 -0
  85. package/package-dist/scripts/lib/foundry-quality-review-lineage.js +123 -0
  86. package/package-dist/scripts/lib/foundry-quality-review.d.ts +112 -0
  87. package/package-dist/scripts/lib/foundry-quality-review.js +487 -0
  88. package/package-dist/scripts/lib/foundry-repair-execution.js +13 -2
  89. package/package-dist/scripts/lib/foundry-runtime-environment.d.ts +2 -0
  90. package/package-dist/scripts/lib/foundry-runtime-environment.js +18 -0
  91. package/package-dist/scripts/lib/foundry-runtime-identity.d.ts +1 -0
  92. package/package-dist/scripts/lib/foundry-runtime-identity.js +22 -2
  93. package/package-dist/scripts/lib/foundry-runtime-qualification.js +2 -2
  94. package/package-dist/scripts/lib/foundry-runtime-utils.d.ts +1 -0
  95. package/package-dist/scripts/lib/foundry-runtime-utils.js +1 -1
  96. package/package-dist/scripts/lib/foundry-task-authorization.d.ts +2 -1
  97. package/package-dist/scripts/lib/foundry-task-authorization.js +32 -11
  98. package/package-dist/scripts/lib/foundry-task-registration.js +4 -5
  99. package/package-dist/scripts/lib/foundry-task-runtime-adoption-write.d.ts +28 -0
  100. package/package-dist/scripts/lib/foundry-task-runtime-adoption-write.js +250 -0
  101. package/package-dist/scripts/lib/foundry-task-runtime-adoption.d.ts +60 -0
  102. package/package-dist/scripts/lib/foundry-task-runtime-adoption.js +549 -0
  103. package/package-dist/scripts/lib/foundry-task-store.d.ts +4 -1
  104. package/package-dist/scripts/lib/foundry-task-store.js +113 -4
  105. package/package-dist/scripts/lib/foundry-task-types.d.ts +2 -1
  106. package/package-dist/scripts/lib/foundry-typed-authoring-patch.d.ts +76 -0
  107. package/package-dist/scripts/lib/foundry-typed-authoring-patch.js +237 -0
  108. package/package-dist/scripts/lib/foundry-typed-context.d.ts +11 -0
  109. package/package-dist/scripts/lib/foundry-typed-context.js +79 -0
  110. package/package-dist/scripts/lib/foundry-typed-flow-qa.d.ts +166 -0
  111. package/package-dist/scripts/lib/foundry-typed-flow-qa.js +226 -0
  112. package/package-dist/scripts/lib/foundry-typed-model-write.d.ts +6 -0
  113. package/package-dist/scripts/lib/foundry-typed-model-write.js +59 -0
  114. package/package-dist/scripts/lib/foundry-validation-reference-context.d.ts +8 -0
  115. package/package-dist/scripts/lib/foundry-validation-reference-context.js +115 -0
  116. package/package-dist/scripts/lib/foundry-workflow-assessment.d.ts +1 -0
  117. package/package-dist/scripts/lib/foundry-workflow-assessment.js +165 -34
  118. package/package-dist/scripts/lib/foundry-workflow-authorization.js +99 -5
  119. package/package-dist/scripts/lib/foundry-workflow-child-failure.d.ts +44 -0
  120. package/package-dist/scripts/lib/foundry-workflow-child-failure.js +439 -0
  121. package/package-dist/scripts/lib/foundry-workflow-context.js +92 -22
  122. package/package-dist/scripts/lib/foundry-workflow-execution.js +54 -5
  123. package/package-dist/scripts/lib/foundry-workflow-finalize.js +64 -3
  124. package/package-dist/scripts/lib/foundry-workflow-identity-recovery.d.ts +6 -0
  125. package/package-dist/scripts/lib/foundry-workflow-identity-recovery.js +450 -0
  126. package/package-dist/scripts/lib/foundry-workflow-identity-stage.d.ts +9 -0
  127. package/package-dist/scripts/lib/foundry-workflow-identity-stage.js +717 -0
  128. package/package-dist/scripts/lib/foundry-workflow-identity.js +26 -11
  129. package/package-dist/scripts/lib/foundry-workflow-io.d.ts +7 -1
  130. package/package-dist/scripts/lib/foundry-workflow-io.js +102 -16
  131. package/package-dist/scripts/lib/foundry-workflow-reference-verify.js +102 -29
  132. package/package-dist/scripts/lib/foundry-workflow-repair.js +53 -2
  133. package/package-dist/scripts/lib/foundry-workflow-semantic.js +65 -31
  134. package/package-dist/scripts/lib/foundry-workflow-state.d.ts +4 -0
  135. package/package-dist/scripts/lib/foundry-workflow-state.js +165 -22
  136. package/package-dist/scripts/lib/identity-preflight-artifacts.d.ts +4 -7
  137. package/package-dist/scripts/lib/identity-preflight-artifacts.js +18 -5
  138. package/package-dist/scripts/lib/identity-preflight-proof.d.ts +6 -0
  139. package/package-dist/scripts/lib/identity-preflight-proof.js +92 -13
  140. package/package-dist/scripts/lib/identity-preflight-recovery-proof.d.ts +78 -0
  141. package/package-dist/scripts/lib/identity-preflight-recovery-proof.js +415 -0
  142. package/package-dist/scripts/lib/import-curation/curation-cleanup.d.ts +9 -1
  143. package/package-dist/scripts/lib/import-curation/curation-cleanup.js +39 -2
  144. package/package-dist/scripts/lib/import-curation/curation-gate.d.ts +1 -0
  145. package/package-dist/scripts/lib/import-curation/curation-gate.js +19 -1
  146. package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +1 -1
  147. package/package-dist/scripts/lib/import-curation/internal/workflow-identity-preflight.js +11 -2
  148. package/package-dist/scripts/lib/import-curation/internal/workflow-reference-closure.js +4 -1
  149. package/package-dist/scripts/package-entry.js +2 -3
  150. package/package-dist/scripts/public-api.d.ts +5 -0
  151. package/package-dist/scripts/public-api.js +2 -0
  152. package/package-dist/scripts/runtime-entry.d.ts +2 -0
  153. package/package-dist/scripts/runtime-entry.js +42 -15
  154. package/package.json +6 -2
  155. package/specs/schemas/foundry-identity-stage-input.schema.json +47 -0
  156. package/specs/schemas/foundry-managed-adoption.schema.json +40 -0
  157. package/specs/schemas/foundry-managed-runtime.schema.json +1 -1
  158. package/specs/schemas/foundry-operation-result.schema.json +1 -0
  159. package/specs/schemas/foundry-package-descriptor.schema.json +6 -2
  160. package/specs/schemas/foundry-quality-review-draft.schema.json +271 -0
  161. package/specs/schemas/foundry-quality-review-input.schema.json +271 -0
  162. package/specs/schemas/runtime-qualification.schema.json +1 -1
@@ -34,13 +34,13 @@ checkPaths:
34
34
  - test/scenarios/foundry-package-consumer.test.mts
35
35
  - test/scenarios/foundry-interaction-workflow.test.mts
36
36
  - docs/public-runtime-contract.md
37
- lastReviewedAt: 2026-10-08
38
- lastReviewedCommit: d07ac492a3a5891502039a6cc83ef30b9fbba50b
39
- lastReviewedNote: "Reviewed Foundry #237 exact three-field 0.1.16 to 0.1.17 release projection from eligible PR236 Main d07ac492; CLI/native pins, lock closure, authorization and all business source remain unchanged. Official publication and final managed qualification remain pending."
40
37
  related:
41
38
  - docs/runtime-context-contract.md
42
39
  - docs/task-authorization-contract.md
43
40
  - docs/package-distribution-contract.md
41
+ lastReviewedAt: 2026-11-15
42
+ lastReviewedCommit: c30a1f516553282f7c82c82c5733689557078b5c
43
+ lastReviewedNote: "Foundry #278: reviewed the 0.1.18 package, verifier and descriptor version projections over main containing the installed-entry change; runtime inputs, workflow, ownership and task contracts are unchanged."
44
44
  ---
45
45
 
46
46
  # Public runtime protocol
@@ -55,7 +55,7 @@ This is the implemented v1 facade protocol for `@tiangong-lca/foundry` and its `
55
55
  | `tiangong-foundry doctor --workspace <path> [--expected-project-ref <ref> --expected-user-id <uuid> [--session-reference <path>]] --json` | Read-only runtime, asset, workspace and account-readiness diagnostics. It checks only bounded reference metadata, never session contents, repository maintenance, Git, login or download. |
56
56
  | `tiangong-foundry task start --workspace <path> --spec <file> --json` | Validate the strict `task-start.v1` spec and independently capture its selected sources/optional seed. A relative spec path resolves from the selected workspace root. Request ID, actor, lane, profile, account intent and preparation live in the reviewed spec. |
57
57
  | `tiangong-foundry task status --workspace <path> --task <id> --actor <id> --json` | Reconstruct the exact registered request revision and inspect its current task/index/attempt state. Actor intent is supplied independently on every call. |
58
- | `tiangong-foundry task resume --workspace <path> --task <id> --actor <id> [--semantic-input <file> | --interaction-input <file> | --authorization-input <file> | --reference-input <file>] --json` | Continue registered preparation, capture one bound interaction/semantic/reference/approval input, or execute and verify a sealed owner scope. Input kinds are mutually exclusive. Consumed/ambiguous mutation state is readback-only and never replayed. |
58
+ | `tiangong-foundry task resume --workspace <path> --task <id> --actor <id> [--semantic-input <file> | --interaction-input <file> | --authorization-input <file> | --reference-input <file> | --identity-stage-input <file> | --quality-review-input <file>] --json` | Continue registered preparation, capture one bound interaction/semantic/reference/quality-review/approval input, explicitly admit a new read-only identity stage, or execute and verify a sealed owner scope. Input kinds are mutually exclusive. Consumed/ambiguous mutation state is readback-only and never replayed. |
59
59
  | `tiangong-foundry workspace migrate --workspace <path> --dry-run --json` | Inventory old state and produce a content-bound migration plan. Applying that plan is a separately explicit operation defined by W10. |
60
60
 
61
61
  The CLI-owned `tiangong-lca runtime ensure/status` manages qualified components only; it does not initialize a Foundry job or grant data permissions. Skills invoke the Foundry facade and its next actions rather than rebuilding its task state machine.
@@ -78,6 +78,10 @@ Status and resume resolve a task only through its immutable task pointer and req
78
78
 
79
79
  Native conversion uses the selected qualified TIDAS executable with an isolated environment. Automatic format detection omits the native `--from-format` option. Output files, the import report and the adapter result enter the existing content-bound task transaction. A converter-reported failure blocks later stages; successful conversion alone is not task completion. CLI context packs preserve their actual task-contained file references and enter the same index. A new invocation never adopts an interrupted, unindexed context generation.
80
80
 
81
+ For CLI 0.4 candidate qualification, the context stage calls the typed Dataset contract of each task entity. Foundry retains the original result and projects schema, methodology and ruleset files from its manifest. Each available component must match the recorded byte count and SHA-256 before the stage can register it. Flow and Process require all three components. Other dataset types can omit components the owner explicitly reports as unavailable. The Model command keeps the Foundry lifecyclemodel artifact type.
82
+
83
+ The CLI 0.4 candidate uses typed Flow validation in managed assessment and post-authoring. Each invocation checks schema and business rules against one exact Flow payload. Foundry retains the complete report and checks its result receipt, payload digest, UUID and version before projecting findings for curation. The stdout issue preview can omit findings. Remote references and candidate identity retain their separate verification stages.
84
+
81
85
  After context preparation, the facade materializes typed row arrays from the selected seed or the primary native dataset tree. Process-bundle copies remain evidence and are not counted as additional source rows. Derived inputs must have a verified producer in the same task index. Context preparation includes the converted dependency types as well as the requested types.
82
86
 
83
87
  The public facade assesses one current dataset type per resume. It registers a cumulative report with explicit `in_progress` or `completed` coverage, so the first actionable blocker can be returned before the remaining types finish; an independent type retains its continuation command. Every generation binds the previous indexed assessment, current rows, relevant context and task-interaction digest. Existing current set reports may be reused only when their row, context, queue closure, applicable interaction digest and registered artifact facts still match. A process/flow assessment builds its complete CLI-owned closure queue inside its own generation. A partial assessment is usable for current semantic work but cannot enter identity preflight, finalization, approval or completion. Direct internal callers that omit the bounded-set options retain their original full-batch operation.
@@ -88,6 +92,8 @@ Process assessment also invokes the qualified published CLI's local `dataset val
88
92
 
89
93
  Native Process batches preserve the original row's explicit `semantic_context.flow_documents` as supplemental documents. One exact Flow identity cannot have conflicting canonical content across primary or supplemental documents. Supplemental native failures invalidate their owning Process rows and retain context pointers; primary row counts remain unchanged while augmented manifest hashes, document counts, fingerprints and semantic coverage remain visible. Incomplete or mismatched Process coverage cannot become a valid preparation report.
90
94
 
95
+ Mutation-manifest and owner-readback reference closure use the same unwrapped business payload as the write candidate. References nested only in row-envelope validation documents do not add write dependency requirements or writable support rows. The complete row and supplemental documents remain bound to their original artifact facts; missing or wrong-version references inside the business payload still block closure.
96
+
91
97
  The compatibility report retains native diagnostic fields and supplies curation's `code` and JSON-pointer `path` from the native issue code/location. Row normalization uses the canonical `json` payload slot for typed API wrappers so native validation, curation and CLI patch application address the same domain payload while preserving row metadata and source lineage.
92
98
 
93
99
  When qualified native row validation exits outside success/data-issues, the assessment retains its authentic bounded TIDAS operation report in `native-validation-failure.json`, including exit code/class, all native diagnostics, bounded stderr, the exact selected row file/hash/count and current row-manifest binding. A separate registered assessment-failure result points to that evidence; no schema/QA/curation set is marked complete. Fresh status and unchanged resume expose a plain-language blocker with the affected dataset type, native diagnostic code, I/O or other failure, what remains unassessed and the indexed evidence path. They do not silently rerun the failed local operation or advance toward identity, approval or write. The full task-local report remains available when the default message is shortened. Malformed, oversized or changed failure evidence is refused rather than relabeled as a data issue or success. A replacement qualified runtime requires an explicitly reviewed task revision; this evidence does not authorize one.
@@ -100,6 +106,10 @@ After local semantic work is ready, a further resume performs process/flow ident
100
106
 
101
107
  Preflight reuses the existing request builder, query audit, receipt-bound runner and index merger. Requests target current unwrapped payloads and retain source trace context. Remote reads finish before a local transaction registers their immutable evidence; that transaction cannot replay a remote operation. Registration rechecks current rows under the task lock. Failed reads remain visible as `needs_input` and a later resume may retry the read-only stage. Status never performs a search. Successful preflight invalidates the earlier assessment, and the next resume re-runs curation against its exact identity index. Manual review becomes dedicated identity work even for the generic profile. This read evidence supplies decision context; submitting a bound identity decision remains separate from write authorization.
102
108
 
109
+ The CLI 0.4 identity candidate sends Foundry's audited search request to the existing Flow or Process hybrid-search Edge endpoint using the authenticated operator. The verified project, current target bytes, query, returned candidate versions and observation are retained for the identity review. Search results enter review because a bounded candidate query does not establish identity equivalence. Retained legacy attempts follow their original recovery contract.
110
+
111
+ Source-context files accept JSON objects/arrays and JSONL, including current multi-row JSONL emitted by semantic identity apply. Format selection preserves the existing trace collector and exact per-row target/version/hash bindings. Malformed source content returns `source_trace_invalid` without parser excerpts or source contents; retained evidence is unchanged and request preparation dispatches no identity query.
112
+
103
113
  An executable next action preserves `cwd=workspaceRoot`, the application arguments and purpose. An unmanaged source/emitted host retains its direct Node/package entry. A verified managed host instead selects its exact CLI `runtime exec` command with the original trusted manifest digest, component cache and launch id before the unchanged Foundry arguments. Its verified binding digest covers every executable field; workspace, task and actor are explicit argv values, while task lookup revalidates the immutable revision fingerprint and current runtime/input facts before work. It has no `display` authority. A final restricted data CommandSpec still requires the W04 execution-context/identity/authorization gate; Owner execution validates it immediately before the first dispatch.
104
114
 
105
115
  After ready assessment and required identity preflight, resume invokes the existing finalize owner. It preserves reference/source/contact/canonical repair, cleanup, native schema, deterministic QA, location audit, curation, dry-run, remote reference verification and mutation/handoff report ordering. Each dataset type uses its own contract pack; Unit Group and Flow Property rows use the owner's support mode separately. Finalization dispatch accepts only local checks, explicit `--dry-run` operations and read-only remote verification, never `--commit`.
@@ -150,6 +160,18 @@ Sealing obtains a fresh qualified CLI identity after local handoff preparation a
150
160
 
151
161
  A passing precommit selection is carried automatically into both handoff CommandSpecs as final-row, intent, precommit and review artifact facts (plus the native contract when selected). The write command receives no unsupported reference flag. Admission rechecks the complete independently selected evidence set. Every readback, including unknown-response recovery with no commit report, requires the same current intent/consumer/review binding and still passes independent root/owner/state/payload checks. Completed-scope checks rehash retained reference facts. Missing or changed evidence never permits a mutation replay or a root-only completion shortcut.
152
162
 
163
+ ## Preparation quality review
164
+
165
+ `task resume --quality-review-input <file>` selects a strict `tiangong-foundry.quality-review-input.v1` descriptor or a completed generated `tiangong-foundry.quality-review-draft.v1` independently of semantic, interaction, reference and write-authorization inputs. It can record an explicit reviewed interpretation of the current `process_material_balance_deviation` warning before finalization. It does not edit the inventory or the CLI's mass calculation. Ordinary unreviewed inventories, other QA findings, validation failures and incomplete or contradictory evidence stay blocking.
166
+
167
+ The read-only `quality_review_scope` artifact exposes the current bindings and candidate observations; it is not approval. The accompanying `quality_review_input_template` already contains the exact bindings, finding identities and a one-hour UTC validity interval. Save that generated draft, retain only the observations actually reviewed, set their explicit `disposition: accept-interpretation`, and fill the actual rationale, evidence IDs and `{id, kind, file}` selections. Submit through the same `--quality-review-input` entry. The owner captures evidence hashes and stores the derived strict input with the original selected draft and evidence snapshots; callers do not copy binding fields or compute evidence hashes. An untouched template, null disposition, blank rationale or absent evidence is rejected. The existing maximum 24-hour interval still applies; template generation creates no decision, task operation or approval. The [input schema](../specs/schemas/foundry-quality-review-input.schema.json) binds workspace/task/actor, project/user intent, profile and rule hash, the complete current Process rows file, row manifest, assessment, qualified runtime, contract context, reference selection and QA report/findings. `interaction_context_sha256` also binds broad and object-scoped questions, decisions and assumptions for the complete Process roster; a changed applicable interpretation invalidates prior acceptance even when row bytes and numerical QA are unchanged. Each selected warning additionally binds its row index, UUID/version, canonical TIDAS payload and complete finding digest. Ambiguous duplicate Process IDs are not eligible. The input names the expected previous receipt digest (null initially), a current UTC issuance/expiry interval of at most 24 hours, a rationale, and explicitly selected content-bound evidence. Every object must reference both applicable `user-decision` and `source-model` evidence. The trusted caller must establish that the actual user authority covers this particular interpretation; a task brief, standing draft-write permission, arbitrary methodological prose, a source-model file or a scientific-review label does not automatically authorize it. v1 evidence is strict UTF-8, with 8 MiB per file and 64 MiB for the selection, including the descriptor. Missing, linked, private/session, changed or unreferenced evidence is refused.
168
+
169
+ The task transaction snapshots the descriptor and evidence and appends `foundry-quality-review.json`, `reviewed-findings.jsonl` and `quality-review-report.md`. The receipt has `grants_permission: false`. Reassessment preserves raw QA and emits separate `reviewed_findings`; only the exact accepted observation stops generating an authoring action. It does not populate profile waivers or accept the same code on another Process. Receipt replacement uses the task metadata lock and an explicit predecessor; indexed authorization, native contracts, prepared/executed scopes or attempt history freeze review changes. Identical current submissions reuse the indexed result only when both the descriptor bytes and the fully materialized input, including selected evidence hashes, match the accepted receipt. Resubmitting unchanged draft bytes after a selected evidence file changes is rejected; the original receipt is retained. The latest stale or expired receipt cannot fall back to an older decision.
170
+
171
+ Reassessment and finalization recheck the complete observation, rows, context, references and evidence. Reviewed finalization reuses the original registered QA reference-file sequence, including local Flow/property/unit rows, and verifies each file hash. The cleanup projection and final QA consume that same sequence. Known QA run timestamps/output locations may change; numerical results, units, reference content, findings and all other report fields remain bound. Raw row-file identity and canonical scientific payload identity are separate. Changed scientific JSON or arbitrary wrapper metadata invalidates acceptance. A finalizer's derived `semantic_context.flow_documents` can be accepted only with the existing cleanup producer's exact `process_validation_references` proof: unchanged ordered payloads and pre-existing metadata/context, matching input/output files and payload hashes, and the complete ordered projection of unchanged selected exact-version Flow bodies. Unknown, missing, conflicting or extra projections fail closed. This verifier neither constructs validation context nor changes reference-closure ownership.
172
+
173
+ The review digest participates in assessment and finalization freshness. Final write authorization and execution admission remain independent and recheck any quality review required by the final rows. A review creates no grant, capsule, owner request, dispatch or attempt, changes no `allowed_actions`, and cannot recover or replay an existing attempt.
174
+
153
175
  ## Authorization input
154
176
 
155
177
  `--authorization-input` selects a strict `tiangong-foundry.authorization-input.v1` descriptor separately from semantic input. It binds task, actor, current finalization SHA-256, dataset type, `input_kind` (`current_rows` or `final_rows`), input SHA-256 and expected previous authorization-pointer SHA-256 (null for initial registration). It separately selects a grant file and unique user-decision/source-model evidence files with hashes. At least one user-decision item is required; each file is bounded to 8 MiB and the selection to 64 MiB. Credential and linked-file inputs are rejected. The grant's evidence references must use the selected canonical absolute paths, as required by the existing registration contract.
@@ -158,6 +180,8 @@ For `input_kind=final_rows` with Flow, Process or Source, the descriptor may als
158
180
 
159
181
  Finalization exposes per-scope `authorization_inputs` with independently computed bindings and input digests. These are review metadata, not grants. The trusted caller must select approval evidence from actual current user authorization; task output or grant text alone cannot supply approval. The existing validator checks the grant, current CLI identity and scope; registration rechecks current finalization while holding the task lock and uses the existing compare-and-swap pointer. Concurrent distinct initial grants cannot both activate.
160
182
 
183
+ The CLI 0.4 candidate seals the Foundry draft plan and records an attempt before dispatch. The existing Edge create interface receives the exact approved UUID, version and payload. For an existing Flow identity, the plan also binds the visible predecessor and repeats the exact head check immediately before creating the next approved version. The typed `dataset model create` command uses the existing Model bundle transaction so Model content and its derived graph are saved together. Guarded Process repair passes the complete approved before document to the existing Edge save interface for comparison inside the transaction. An explicit insert contract remains bound to the plan and its ordered final rows. Recovery uses the original Foundry attempt and independent exact readback. A retained CLI-native attempt still requires its original CLI receipt and readback under its original runtime.
184
+
161
185
  For a ready `final_rows` scope, the runtime rebuilds the original owner handoff under the validated grant, binds CommandSpec artifacts to absolute final-row paths, and creates the existing execution capsule. It registers a `foundry-authorization.json` result; identical current submissions reuse it without re-authentication or another capsule. Projection requires the matching current finalization, active pointer digest and unexpired record. A sealed result is explicitly pending execution and never dispatches a mutation. `current_rows` registration records preparation approval. Subsequent resume re-finalizes the selected type under that current grant, then proves final-row lineage and derives/activates the exact successor before sealing. Actions, evidence, account/profile binding and expiry are unchanged. Equal-byte derived files reuse the original grant only after lineage proof. A capture interruption after activation resumes from the retained preparation approval and verifies the active grant is its exact derivation; it does not request another approval. Blocked re-finalization retains its reports without repeating remote reads. Existing authorization, capsule and no-replay rules remain authoritative for subsequent execution.
162
186
 
163
187
  ## Task interaction input
@@ -225,7 +249,7 @@ Every facade revision also rechecks all retained predecessors in its request cha
225
249
 
226
250
  ## Runtime selection and migration seam
227
251
 
228
- The public facade accepts CLI/TIDAS expectations only through its process-local host interface. Ordinary argv, task specs, `.env` and ambient `TIDAS_BIN`/expectation variables cannot select trust anchors. Without a host selection, doctor, start, status and local resume work and report `qualification.required`; child-required work must return the runtime qualification action. The managed bin now obtains this selection from the CLI IPC context and its verified component metadata. The final immutable production product manifest remains a W08 deliverable. The current exact CLI 0.1.27 constraint remains explicit rather than silently accepting a future version.
252
+ The public facade accepts CLI/TIDAS expectations only through its process-local host interface. Ordinary argv, task specs, `.env` and ambient `TIDAS_BIN`/expectation variables cannot select trust anchors. Without a host selection, doctor, start, status and local resume work and report `qualification.required`; child-required work must return the runtime qualification action. The managed bin now obtains this selection from the CLI IPC context and its verified component metadata. The final immutable production product manifest remains a W08 deliverable. The current exact CLI 0.1.28 constraint remains explicit rather than silently accepting a future version.
229
253
 
230
254
  `workspace migrate --dry-run` recursively inventories only regular files/directories, rejects links and returns `tiangong-foundry.workspace-migration-plan.v1` as an inline content-bound artifact. It classifies control, local-preparation, terminal-success, attempted/unknown, authorization/account and unclassified paths. The public envelope is bounded to 10,000 entries and 64 directory levels. The total hashed inventory is bounded to 256 MiB. Files larger than 64 MiB and recognized credential/session files retain path/size/classification facts with `sha256=null`; their contents are not read by this inventory. The tree digest binds this observational inventory, not an atomic filesystem snapshot, so W10 must re-read and verify every selected source immediately before apply. It writes nothing. W10 owns application, rollback and detailed old-schema mapping.
231
255
 
@@ -233,6 +257,8 @@ The public facade accepts CLI/TIDAS expectations only through its process-local
233
257
 
234
258
  Cleanup may change the byte representation of a Unit Group or Flow Property before its input-bound permission is reapplied. When the selected scope is blocked only by `reference_only_support_type_write_blocked` and the retained approval includes both its exact write action and `canonical_support_local_mint`, resume may derive the grant against the already indexed final-row lineage. It then re-finalizes that scope using the newly bound input and original approval origin. Actions, evidence, account/profile and expiry remain unchanged. Schema, content, reference and other blockers cannot enter this path.
235
259
 
260
+ For the CLI 0.4 candidate, support finalization validates the exact create intent and reads each dependency version through the typed CLI. The owner execution capsule seals a distinct Edge create plan over the approved final-row bytes, project, account and exact dependency payloads. The existing owner attempt record is written before dispatch. A consumed plan is recovered using the original request and a fresh exact Edge readback of the roots and dependencies. A dependent FlowProperty scope waits for the original UnitGroup scope to complete before it can dispatch.
261
+
236
262
  Finalization records which authorization hash it used; a still-blocked result under that same grant is retained instead of repeatedly running the stage. Completed scopes preserve their original reports and final-row generations during both ordinary dependency finalization and later prepared-approval continuation. A ready scope with an already activated derived grant returns a bound continuation command to finish sealing, without requesting another approval.
237
263
 
238
264
  ## Account verification mode
@@ -247,6 +273,8 @@ Production-test mode never invokes traceHash acceptance: owner/state/identity/ve
247
273
 
248
274
  CLI session ownership, fresh identity receipts and the existing explicit process-only headless contract remain authoritative. Workspace/task/actor intent applies on every host; a Codex thread id is supplemental. Doctor reports `not_requested`, `needs_auth` or `configured_unverified` from explicit intent and bounded session-reference metadata without reading it or claiming authentication. Actual restricted resume obtains a fresh CLI identity. Login never grants publish/delete/mint permission. Existing approval for an unchanged batch is reused after evidence validation; no per-row confirmation is introduced. When a new approval is necessary, preparation and reviewable mutation evidence come first.
249
275
 
276
+ Direct Edge requests in the CLI 0.4 candidate support the existing process-only token input and the default operator OAuth mode. For OAuth, Foundry uses the existing public client registration and loopback PKCE, verifies the subject online and checks it against the current CLI-verified task project and operator. The Edge bearer is reused within the current process and is held in memory. The existing CLI login and its private cache continue to belong to the CLI.
277
+
250
278
  The facade cannot authorize actions from source text or infer permission from a historical profile. Missing grants block only affected operations; independent preparation and ready scopes continue. User-facing summaries show stages, counts and concrete remedies, with versions/argv/hashes in diagnostic artifacts when needed.
251
279
 
252
280
  Transfer planning adds `--to <destination> --actor <actor> --request <request>` and optional repeated `--stage-manifest <source-state-relative-path>` to the same dry-run operation. It produces `workspace-migration-transfer-plan.v2`, independently binds runtime and intent, observes source bytes again, and interprets selected historical attempt evidence without granting execution authority. Explicit adoption/apply/audit and runtime selection are defined by the migration contract. See [workspace migration](workspace-migration-contract.md). Both inventory and transfer paths reject unsupported hosts before legacy-state reads.
@@ -261,6 +289,58 @@ A managed launch policy can supply a target manifest as a file already bound by
261
289
 
262
290
  `createFoundryWorkspaceAccess({ manifestBytes, expectedSha256, access })` is the public host bridge when bootstrap and Foundry load separate CLI SDK instances. It verifies the independently selected digest again with Foundry's own CLI instance. The host must obtain that expected digest from its trusted release/skill configuration; it must not derive it from workspace data or the bytes being checked. The bridge is not exposed through ordinary argv or task specifications.
263
291
 
292
+ Local CLI context-pack, workflow and qualified read-only finalization child failures retain a task-bound `workflow-child-failure.json` artifact under the original operation plan. It records dispatch identity, executable and CLI hashes captured before dispatch, argv digest and sanitized bounded argv, real exit/signal/error class, and UTF-8 bounded sanitized stdout/stderr previews with captured byte counts and digests. The writer and reader share a 64 KiB whole-artifact bound, including JSON escaping and task metadata. Full argv count/digest remain available when its display preview is truncated; additional cropped fields retain original byte counts/digests and explicit truncation markers. Normal executable/CWD/short argv values are preserved. Spawn, nonadmitted exit, signal, empty output, malformed JSON and invalid stage reports cannot become successful producers. A failed operation receipt and `dataset-workflow-failure` index entry retain only the diagnostic, excluding partial stage outputs. The failing response and subsequent status expose that evidence; unchanged resume does not dispatch the child again. These failures require an explicitly reviewed input/runtime revision through existing supported rules; no new recovery permission or historical receipt is inferred. Finalization records its current captured failure using the original nonce, inputs and execution identity; the metadata callback cannot dispatch a child. Its plan timestamp is the actual registration time, and it does not reconstruct an earlier missing producer. Mutation attempts and UNKNOWN remain under their original no-replay owners. Missing or altered retained evidence fails closed.
293
+
264
294
  Unexpected runtime failures retain the generic failure code and safe message; recognized filesystem/Node error codes may be included without raw exception text, paths or user data. This helps identify host failures while preserving the non-leaking error envelope.
265
295
 
266
296
  Context, assessment and semantic stages allocate new task-contained directories with exclusive creation, including long Windows task paths. A prior generation is retained rather than reused after interruption.
297
+
298
+ ## Same-task compatibility and retained identity diagnostics
299
+
300
+ The optional public `task adopt-runtime` operation supplements start/status/resume without creating another Task. Its modes are `--dry-run --selection <file>`, `--apply --plan <file>`, and `--audit`. All retain `--workspace`, `--task`, `--actor` and `--json`. The typed host uses `createFoundryRuntimeAdoptionQualification` with independently reviewed bytes and digest, then passes that branded qualification to `createFoundryFacade` or `runFoundryPublicCommand`. An ordinary selection file cannot grant compatibility.
301
+
302
+ Plan/apply verify the exact old/new installed descriptors, all CLI inventory files, Node/platform equality, identical selected Toolkit bytes, original source snapshots and registered producer lineage. The stopped-writer handoff names the original registration and, for a subsequent transition, the preceding plan digest. Under owner and task locks, apply compares the complete witness and publishes an immutable receipt. The first anchor and original registration/job remain unchanged. Further v2 receipts are linked once from the preceding digest in the same native adoption store; all old receipts/context facts remain checked. Descriptor/CLI inventory differences matter even when the four historical package-summary fields and version numbers are equal. Current continuation verifies the full tip. An unpatched earlier reader cannot interpret successor links: stopping its writer and selecting the qualified host remain required.
303
+
304
+ Adoption is not authentication, a grant, a new attempt, or authorization to retry a write. Finalization, active approval, consumed or UNKNOWN owner history retains the original recovery boundary. The protocol permits a local preparation continuation only where that boundary is absent. Prior assessment reports remain inspectable with their verified producer locator bases; new runtime context and machine gates are assessed afresh. Any indexed finalization, including a blocked read-only finalization, selects the inspection-only `original_owner_recovery` continuation. Applying that transition makes the successor the current tip without enabling ordinary write-access resume; the earlier tip cannot continue through this protocol, and later transitions retain the restriction. There is no public preparation reset or rollback exception. Keep the current owner selected when it still needs preparation after finalization; any broader recovery capability needs separate owner scope and qualification.
305
+
306
+ A fully bound current CLI 0.1.28 or retained 0.1.27 `needs_review/manual_review` report may legitimately exit 1. Foundry validates report/status/action, request and raw target hash, object/version, exact CLI/receipt identity, invocation arguments, output paths, timestamp, stdout/disk canonical equality and separate original bytes, before registering execution evidence. A reported path must equal its selected path or the native absolute form resolved from that same selected path; report paths and bytes are never normalized or case-folded to invent a match. This accommodates the CLI's native Windows path output while preserving POSIX backslash filenames and rejection of foreign files. Signals, stderr, errors, malformed/stale/mismatched reports or unsupported exits remain failures. Scientific identity is still unresolved; the registered authoring work belongs to the Agent's normal semantic decision stage.
307
+
308
+ For an older stopped diagnostic, resume first verifies retained report/request/results, native producer plan/receipt/index, executable and full independent current/predecessor CLI inventory. It requires the original raw authenticated receipt to be registered in that same producer's outputs; a receipt digest or account summary alone cannot supply its preimage. Recovery emits a separate `identity-preflight-recovery.v1` proof and bound index, never an absent original execution manifest. The reader pins the CLI inventory to the independent index field `recovery_cli_content_sha256`; it cannot infer that expectation from the proof it checks. Historical receipt validation preserves the original read-only owner's 300-second policy and original timestamp. New permission admission retains its independent 60-second rule.
309
+
310
+ A successful recovery performs no new identity query and does not alter original files, scientific rows, Task/revision or attempt. Missing original authentication, results, decisions, producer facts, executable bytes or inventory leaves `identity_preflight_recovery_unproven`/needs_input with `verify_original_identity_recovery`. This UNKNOWN concerns incomplete retained read-only proof; it does not imply an unknown remote write. Such a Task is not recovered merely because a stronger synthetic fixture passed. A new read-only query, if needed, is a separately reviewed scope extension and is not enabled by recovery.
311
+
312
+ ## Explicit new read-only identity stage
313
+
314
+ An original source-evidence Task may submit `task resume --identity-stage-input <file> --json` with the same Task/actor. The strict `foundry-identity-stage-input.schema.json` selects one stable intent, the registered current row-report digest, blocked predecessor identity digest, and all current Flow/Process identities with `sha256Json` hashes of their complete row envelopes. Source rows are excluded. This is a visibly NEW authenticated read-only stage, not historical recovery or a write grant; engineering assignment generations are not runtime inputs. Ordinary status/resume without the descriptor cannot use this path.
315
+
316
+ The existing owner-scope locks exclude native dispatch and adoption. Short native Task operations durably index preparation and one claim per exact target before the published identity owner runs. The source snapshot, non-secret account receipt, request/audit/roster and exact qualified runtime/CLI facts are retained. Output roots are stable by Task/actor/intent and target/version. Duplicate or reformatted/relocated equivalent intent reads its original admission; changed intent content or another pending stage cannot create another dispatch. The original artifact-index prefix and old reports remain, with compliant append-only registration.
317
+
318
+ A claimed target cannot invoke the owner again through retries or cache shortcuts. Complete retained execution evidence may be validated and captured; absent stdout/outcome, orphaned admission, real errors or drift remains visibly UNKNOWN without automatic requery. Selected request, output and report paths are resolved to native absolute paths before owner dispatch, so retained argv and CommandSpec are exactly the command executed on that host. Exact target/path/argv/account/runtime/time/stdout/disk/exit checks apply to every accepted result. Native finalization, authorization, consumed or UNKNOWN write history blocks this entry. Existing evidence is checked before dispatch and result acceptance.
319
+
320
+ Each newly claimed query starts the existing owner in a fresh private OS temporary directory, removed after success or failure. This keeps digest-based evidence paths out of the child working directory and prevents the published CLI from loading the user workspace's `.env`. Request, authentication receipt, output and retained execution evidence remain at their absolute task-bound paths. The working directory changes no command, account, attempt, timeout or acceptance rule.
321
+
322
+ Indexed preparation and dispatch remain visible to status and ordinary resume even if result capture was interrupted. They block replacement queries, finalization and write admission. Current questions/investigations must be resolved before dispatch and acceptance; an interaction answer can still be recorded on the same Task, after which an explicit duplicate may accept its retained execution without another query. The admitted OAuth/headless mode is retained and cannot change on a duplicate. `new_cli_execution` is true only for proven execution and stays null for an unproven claim; underlying retrieval counts remain unknown.
323
+
324
+ The explicit call returns immediately after its identity stage, without entering finalization, authorization or owner execution. A complete manual-review report feeds the existing later assessment and Agent semantic work, not scientific acceptance. Stage totals and `this_invocation.cli_invocations` distinguish historical and current-call dispatches; underlying retrieval count stays null when the CLI does not report it. No Task/UUID replacement, scientific rewrite, Source dependency replay or default-runtime switch is implied.
325
+
326
+ ## Qualification through the original managed entry
327
+
328
+ The package-owned host also recognizes a non-executable control component advertising `tiangong-foundry.managed-adoption.v1`. Its fixed `metadata/foundry-adoption.json` contains an inventory-bound complete successor manifest and per-launch qualification references. It is selected only by the existing CLI-managed, independently reviewed launch manifest; ordinary application arguments, environment variables, task JSON and standalone cached files cannot select this authority. The original application managed metadata v1 remains unchanged.
329
+
330
+ The carrier L is exactly the complete successor runtime S plus that control component K. All non-component manifest fields and all complete S component records are identical, including workspace schema/features, launch Node/entry/arguments/isolation, product and minimum hosts. K contains no executable files, is never referenced by a launch, and is absent from S. The host verifies L and its executing package first, then the inventory-bound S/Q files and S's full installed component inventory. It creates the existing qualification brand within this package using Q's raw digest from independently reviewed L inventory; Q must still bind the exact complete S digest. It uses S as the explicitly verified executing runtime identity for workspace access and the existing native checks; the original application's read/write policy remains the upper bound. No native manifest, history, stop/CAS, account or scientific guard is relaxed.
331
+
332
+ This separates launch authority from runtime identity without a digest cycle: S is sealed before Q, then K and L are sealed. Stable external original/successor manifest and review evidence files referenced by Q remain retained; rewriting those paths into K's own content-key directory can create another cycle and is unsupported. Current-host rollback targets cannot be mixed with this carrier. Returned actions retain L through public CLI `runtime exec`, preserving admission on every process. Immutable K archive availability or an existing explicit carrier lease must cover later cache pruning; the workspace's S lease alone does not retain K.
333
+
334
+ A legacy or `isolated` managed launch keeps its existing OAuth/cache behavior and consumes no ambient authentication. An admitted carrier may explicitly use the existing CLI `cli-auth` launch channel. Only then does the package map the CLI-whitelisted explicit authentication mode/public configuration/process-only token into the existing typed host seam. It never replaces registered task account/session intent, copies credentials to metadata or treats authentication as compatibility/write authority. Headless mode requires an explicit public target and token and remains cache-disabled; every managed child must obtain its own fresh intent-bound CLI receipt. The parent role receipt is separate evidence.
335
+
336
+ Source qualification now selects published compatible CLI 0.1.28, whose owner-token/access-token save-path correction is relevant to the eventual Process endpoint. The sixteen transitive production packages and selected Node/Toolkit remain separate exact inputs. A local CLI418 QA candidate at that version is selected and inventoried independently for combination testing; equal version labels do not make it the published package or the retained 0.1.27 candidate. Old candidate/manifest/task evidence remains immutable, and actual original DATA managed-entry acceptance still precedes PR delivery.
337
+
338
+ ## Environment-selected installed entry
339
+
340
+ The public `tiangong-foundry` bin supports `--help` and `runtime describe --json [--require-protocol <schema>]` before workspace operations. Deployment configures an absolute `TIANGONG_FOUNDRY_MANIFEST` and independently verified `TIANGONG_FOUNDRY_MANIFEST_SHA256` together. Optional `TIANGONG_FOUNDRY_CACHE_DIR` selects an absolute component cache; `TIANGONG_FOUNDRY_ENTRY` selects a declared managed launch and defaults to `foundry`. These values are process configuration supplied by the installation owner.
341
+
342
+ Description uses the public CLI manifest verification and component inspection APIs without authentication, downloads or workspace creation. The `tiangong-foundry.runtime-description.v1` result exposes selected product/version, bundled CLI version, manifest digest, platform, entry, component readiness and inventory-bound package protocol schemas. `ready` exits 0; missing/blocked installation or unsupported required protocols exit 4. Missing components retain `protocol_assessment=not_checked`. Protocol availability describes the published schemas; callers inspect the current schema/work item for optional field support. Errors include a code and recovery guidance; a descriptor/hash failure cannot produce readiness.
343
+
344
+ Configured business commands retain their original argument array and use CLI `executeRuntimeLaunch`, which supplies genuine IPC and the selected installed Node/package entry. The launcher checks installed readiness before execution. Install missing components explicitly with the existing `tiangong-lca runtime ensure` interface. Native stdout, stderr and exit status are forwarded with one dispatch. Direct calls without configured selection retain the existing local facade.
345
+
346
+ Managed IPC entry has precedence over environment default selection. It continues the original admission path and returned-action binding. Changing a deployment default affects subsequent new entry calls; existing task recovery uses its returned executable, argv and cwd. Deployment retains earlier manifests/components required by live tasks. Explicit native adoption remains the task-upgrade mechanism.
@@ -40,14 +40,14 @@ checkPaths:
40
40
  - test/scenarios/runtime-workspace.test.mts
41
41
  - test/scenarios/foundry-execution-admission.test.mts
42
42
  - test/scenarios/foundry-package-consumer.test.mts
43
- lastReviewedAt: 2026-10-08
44
- lastReviewedCommit: d07ac492a3a5891502039a6cc83ef30b9fbba50b
45
- lastReviewedNote: "Reviewed Foundry #237 exact three-field 0.1.16 to 0.1.17 release projection from eligible PR236 Main d07ac492; CLI/native pins, lock closure, authorization and all business source remain unchanged. Official publication and final managed qualification remain pending."
46
43
  related:
47
44
  - docs/architecture.md
48
45
  - docs/task-authorization-contract.md
49
46
  - docs/public-runtime-contract.md
50
47
  - docs/package-distribution-contract.md
48
+ lastReviewedAt: 2026-11-15
49
+ lastReviewedCommit: c30a1f516553282f7c82c82c5733689557078b5c
50
+ lastReviewedNote: "Foundry #278: reviewed the 0.1.18 package, verifier and descriptor version projections over main containing the installed-entry change; runtime inputs, workflow, ownership and task contracts are unchanged."
51
51
  ---
52
52
 
53
53
  # Runtime context
@@ -62,11 +62,13 @@ The public task facade delegates sealed owner execution to `foundry-workflow-exe
62
62
 
63
63
  ## Runtime qualification and child admission
64
64
 
65
+ The installed CLI contract test exercises the package's actual executable without credentials. It checks command and option availability for authoring context, identity preflight, exact reference/readback verification, and execution-contract draft writes. A dependency candidate can retain the public TypeScript exports while removing these executable routes. When migrating the Foundry callers, update the test alongside those callers and qualify behavior with the candidate's real package.
66
+
65
67
  The public workflow selects derived row/context facts from the current verified task index before assessment. `runFoundryTaskOperation` rechecks their producer ancestry and original sources. Native validation and the exact CLI's local QA/queue commands use the qualified runtime and isolated environment; curation and authoring write only to a fresh task-owned generation. Runtime assets and source-owner reference bases remain separate from user workspace paths.
66
68
 
67
69
  For queue build, the exact CLI's exit 1 can carry a valid `blocked` data report. Foundry verifies its schema/status pair, current selected row paths and SHA-256 values, and the complete regular-file queue output tree before indexing those artifacts. Process `dataset validate` likewise admits exit 0/1 only when the complete report matches the current row candidate, four validation layers, allocation/reference coverage, supplied exact Flow documents and output artifacts. The exact SDK 0.5.1 `core/validation/process-semantics` and native 0.3.4 `tidas-validation/src/process_semantics.rs` emit checks by applicability; `contracts.rs` accumulates those emitted checks. Undeclared/scalar-empty and targetless compatibility modes do not require explicit-target fraction/direction coverage. Missing profile evidence or unresolved coverage presented as passed is rejected without introducing scientific rules. Its data findings become existing bounded authoring action items; absence or inconsistency of evidence fails closed. Other CLI exits retain their existing fail-closed treatment. A blocked closure is a local evidence gap; it cannot grant authorization, finalization or a replay of any owner attempt.
68
70
 
69
- `qualifyFoundryRuntime` compares an independently selected CLI expectation with the exact installed `@tiangong-lca/cli@0.1.27` runtime descriptor. It also compares a strict TIDAS expectation with the selected platform, executable bytes, compatible 0.2.x or 0.3.x version, validation protocols, event schemas and asset fingerprint. The selected TIDAS executable is copied into a private temporary directory, rehashed there and invoked with the credential-free child environment; both handshake calls must be silent. Qualification uses a process-local brand. The portable identity described by `runtime-qualification.schema.json` is diagnostic evidence and cannot be deserialized into authority.
71
+ `qualifyFoundryRuntime` compares an independently selected CLI expectation with the exact installed `@tiangong-lca/cli@0.1.28` runtime descriptor. It also compares a strict TIDAS expectation with the selected platform, executable bytes, compatible 0.2.x or 0.3.x version, validation protocols, event schemas and asset fingerprint. The selected TIDAS executable is copied into a private temporary directory, rehashed there and invoked with the credential-free child environment; both handshake calls must be silent. Qualification uses a process-local brand. The portable identity described by `runtime-qualification.schema.json` is diagnostic evidence and cannot be deserialized into authority.
70
72
 
71
73
  The TIDAS expectation admits only `linux-x64`, `linux-arm64`, `darwin-arm64` and `win32-x64`; `darwin-x64` cannot enter the schema or runtime context. `tidas-runtime-expectation.schema.json` is the reviewed machine shape. Qualification creation performs the isolated version/protocol/assets handshake once. Every later assertion reopens and hashes the selected executable and rejects any byte drift before child admission; identical immutable bytes do not replay the handshake. This keeps the original observed behavior bound to exact content while avoiding repeated child-process creation inside one admission call.
72
74
 
@@ -111,6 +113,8 @@ User-selected external inputs are regular files captured as canonical path, byte
111
113
 
112
114
  Task artifacts are written only under the selected `taskRoot`; state and cache have distinct resolver areas. Existing path components and physical containment are checked, including after directories are created. Symlink/junction escapes and a changed workspace marker are rejected. A complete new artifact is installed exclusively from an owned temporary file. Existing identical bytes may be reused; different existing bytes require a new output revision. A failed operation never deletes a prior artifact.
113
115
 
116
+ The Task store can capture already generated stage outputs without rewriting their bytes. Its private transaction capability verifies current writer/runtime/source/input bindings before, between and after the fresh output reads, then records the complete matching batch. Completed-receipt publication rechecks these bindings after the callback returns. Content writers retain their per-write checks. This adds no public entry, environment trust, business permission or cross-operation proof cache; the sampling boundary is documented in [the Task contract](foundry-task-contracts.md#local-operation-plans-and-receipts).
117
+
114
118
  The default in-memory data-read bound is 64 MiB; native/streaming stages must declare and enforce their own larger-input protocol instead of silently loading unbounded payloads. Cache contents and layout records are not write or replay authority.
115
119
 
116
120
  ## Facade state and downstream integration
@@ -146,3 +150,17 @@ Managed command continuations retain the original verified launch id through the
146
150
  Public reference selection uses the internal `dataset-workflow-reference-input` task operation. It preserves selected source evidence, publishes indexed QA/review snapshots and a derived intent with only file locators changed. Current row and reference-selection digests fence finalization; snapshot files remain selected inputs for authorization, execution and readback. The selected package/CLI/TIDAS trust anchors and account authority are unchanged.
147
151
 
148
152
  The public execution owner verifies current identity separately for initial rehydration and the final complete pre-dispatch admission pass. Local work between them cannot reuse the earlier receipt as fresh authority. Both passes retain current runtime, account, grant, input and CommandSpec verification before the existing attempt-consumption boundary; no replay or additional grant is introduced.
153
+
154
+ ## Exact compatibility and diagnostic interpretation
155
+
156
+ The public same-task adoption host is described in [the public runtime contract](public-runtime-contract.md#same-task-compatibility-and-retained-identity-diagnostics). Its immutable receipt chain qualifies complete old/new package and CLI inventories, retains identical Node/Toolkit bytes, and enforces the selected tip during current continuation. Native successor links use contained slash-separated relative locators on every platform; the immutable writer still rejects traversal, absolute paths and links. Four legacy identity fields or equal package versions cannot establish compatible code. Prior producer/context facts remain history and do not stand in for fresh current machine gates.
157
+
158
+ Identity report interpretation supports the current CLI 0.1.28 and retained 0.1.27 manual-review exit-1 pair after complete bound validation. Retained 0.1.22 reports require their own original account/CLI/producer facts and an independently qualified predecessor inventory. A recovery proof is a new interpretation, not a historical CLI execution manifest, and cannot replace a missing original raw authenticated receipt. Present retained executable/inventory readback is explicitly current observation.
159
+
160
+ Explicit Process reference selection reaches initial queue/QA and the current CLI validation wrapper. Native input and scientific Process bytes remain unchanged. Missing/wrong exact bodies and projection/report/reference drift remain blocking evidence.
161
+
162
+ The managed adoption carrier explicitly proves L and S use the same complete execution components/cache keys and identical launch/workspace constraints before setting workspace access to S. The original L remains the launch authority for returned actions; `runtimeTarget` alone cannot establish executing-runtime ownership. Inventory-bound control files issue no credential or write permission. See the public runtime contract for the no-cycle construction and child authentication boundary.
163
+
164
+ Quality-review descriptors bind the current qualified runtime, complete row artifact, canonical per-object payload, QA/context/reference facts and actual account intent. Their task-indexed snapshots expire and are rechecked by reassessment, finalization and write admission. A successor runtime requires a new review of its current observations; arbitrary serialized decisions and environment values never restore a review capability. See the [public preparation contract](public-runtime-contract.md#preparation-quality-review).
165
+
166
+ The installed entry may select a deployment-owned manifest/digest/cache before managed IPC admission. This chooses a new invocation, not a replacement runtime context. Existing returned actions enter the original managed launch directly and ignore installation defaults; exact qualification and task/attempt bindings remain unchanged. See the installation selection contract in `public-runtime-contract.md`.
@@ -29,13 +29,13 @@ checkPaths:
29
29
  - test/unit/task-authorization.test.mts
30
30
  - test/unit/task-profile-authority.test.mts
31
31
  - test/scenarios/foundry-execution-admission.test.mts
32
- lastReviewedAt: 2026-10-07
33
- lastReviewedCommit: caa95a4808eda51dc5c7c78f3c39e4e079bdb802
34
- lastReviewedNote: "Reviewed Foundry #223 preparation consuming complete owning CLI 0.1.27 validation, exact candidate/Flow bindings and published Toolkit 0.3.4 applicable coverage; authorization and no-replay boundaries remain unchanged. Foundry source version stays 0.1.16 pending a separate release."
32
+ lastReviewedAt: 2026-10-11
33
+ lastReviewedCommit: 2d5cbf38f4e44b4b4d30bba52abd38ef8947bed3
35
34
  related:
36
35
  - docs/architecture.md
37
36
  - docs/safety-policy.md
38
37
  - docs/foundry-task-contracts.md
38
+ lastReviewedNote: "Reviewed current-main integration of explicit preparation review, payload-bound context and diagnostic-only failures, plus native candidate generation and independently reviewed managed adoption; original Task eligibility and data acceptance remain separate."
39
39
  ---
40
40
 
41
41
  # Task authorization
@@ -100,6 +100,10 @@ USLCI's `preserve_referenced_review_sources` domain rule retains a source refere
100
100
 
101
101
  Worldsteel's naming rule classifies only the single trailing `Global` or `EU` plus data-year match, optionally followed by `v<number>`, in a process `baseName`. It applies only to the `latin-author-year` marker. Any additional author/year match, table/figure marker, other name field or other dataset type remains subject to the content policy. Adding another geography requires reviewed source evidence and tests. No whole content-policy rule is waived by a profile.
102
102
 
103
+ ## Preparation review and write authority
104
+
105
+ The public preparation-quality input described in [the runtime contract](public-runtime-contract.md#preparation-quality-review) records a separately scoped disposition for a current Process mass observation before finalization. It requires applicable user-decision and source-model evidence, exact object/content/QA/context bindings and an unexpired receipt. It does not activate `authorization.json`, add `qa_waivers` or grant an action. Finalization and pre-dispatch admission independently recheck the receipt and its exact scientific payload; final ordinary write approval remains required. The existing authorization-based code waiver below is unchanged and must not be used to broaden an object-specific preparation review to an entire Process batch.
106
+
103
107
  ## QA exceptions
104
108
 
105
109
  The only v1 QA exception is `process_material_balance_deviation` for `process`. The task must provide both user approval and referenced, content-bound `source-model` evidence demonstrating why this exact source scope is an aggregation/formula observation. The source format name or presence of `LCI_RESULT` alone is insufficient. Other QA codes, schema errors, unit-scale errors, missing references and full-context requirements cannot be waived by this contract.
@@ -135,3 +139,11 @@ For public prepared FP/UG input, a captured finalization blocked solely by the s
135
139
  Explicit reference inputs and their review files are control evidence, not authorization or QA waivers. A new selection invalidates the finalization projection; prepared/consumed scopes cannot replace it. Admission requires the same independently selected intent, passing precommit report and review-file facts in both CommandSpecs, alongside final rows and any native contract. Readback rechecks this evidence even when the mutation response is unavailable.
136
140
 
137
141
  After local handoff preparation, the public workflow validates the earlier identity context and obtains a fresh identity from the same qualified CLI and explicit authentication context before capsule creation. Age expiry of the earlier receipt is tolerated at this boundary; context or runtime mismatches propagate. An unconsumed execution also obtains a fresh identity after initial rehydration and before its second complete pre-dispatch admission. Both full admission passes remain required, and the attempt is not consumed until they pass. Capsule/admission checks independently revalidate the active grant, task/account binding, lineage and evidence. New identity receipts do not extend grant lifetime or reset attempts; the 60-second freshness bound is unchanged.
142
+
143
+ ## Freshness after locked metadata verification
144
+
145
+ The explicit public authorization workflow supplies an internal trusted `refreshIdentity` callback to registration/loading. The helpers first verify the current locked snapshot and original task/runtime/account/mode binding. They invoke the callback only for an aged bound proof, using the same qualified CLI and explicit authentication context. Other mismatches propagate. Direct callers without a callback remain strict.
146
+
147
+ Current state, selected rows/evidence and active pointer are rechecked under the lock. Registration checks grant expiry after its final current-state check; loading verifies pointer equality again before returning. Fresh identity does not extend grant lifetime, alter the 60-second rule, clear attempts, change native insert-only contracts, or retain credentials in another store. Same-task runtime adoption supplies no authorization and preserves original owner-recovery barriers.
148
+
149
+ The L=S+K carrier binds compatibility through independently reviewed component inventory and full executing-runtime equality. Its same-package Q brand supplies no account or write grant; all original source/profile/registration/CAS/stop/consumed/UNKNOWN checks remain. An explicit cli-auth policy projects process-only credentials into current identity verification while task account/session intent remains authoritative; a parent receipt cannot replace the fresh child receipt.
@@ -35,9 +35,9 @@ checkPaths:
35
35
  - test/scenarios/workspace-migration-planning.test.mts
36
36
  - test/unit/foundry-migration-transfer.test.mts
37
37
  - test/scenarios/workspace-migration-transfer.test.mts
38
- lastReviewedAt: 2026-09-08
39
- lastReviewedCommit: 3da2201c023a02053fd7325422b5e53fe9c84826
40
- lastReviewedNote: "Reviewed for Foundry #118 explicit ordinary/production-test intent through fingerprints, immutable account records, migration templates and sealed execution; qualified traceHash-only acceptance binds original/fresh raw hashes and preserves all verification evidence. Production-test rejects differences. Full release/live acceptance remains open."
38
+ lastReviewedAt: 2026-10-10
39
+ lastReviewedCommit: baaa384e1db47fb53eb29f7b3764e448510aeff1
40
+ lastReviewedNote: "Reviewed final existing-output capture verification on the working delta based on baaa384e. Current writer/runtime/job/profile and source/input checks run before, between and after two fresh output reads; an independent P2 report-before-capture late-drift repro is fixed, including a caught error returning previously written JSON. New receipt publication reloads current writer/Task/runtime and preserves final input verification; ordinary bytewriters, cached replay, sorted depth-first roster, index CAS and authority/science remain unchanged. Focused59/59 and wholeadoption23/23 pass; latejob2RED->2GREEN and retainedCLI first/second/caught negatives are recorded. No cross-operation hash cache or filesystem-wide atomicity claim. baaa preparation remained unused,87bd Native19/20 failed history remains preserved; new full Source/emitted/installed/native qualification is pending. No originalDATA requery/default034/science/release change."
41
41
  related:
42
42
  - docs/public-runtime-contract.md
43
43
  - docs/runtime-context-contract.md
@@ -73,6 +73,8 @@ Plans bind current runtime/package/entry/platform facts. Installed mode also bin
73
73
 
74
74
  A shared CLI-owned migration lock is keyed by canonical destination and independent of runtime version. Its complete cache path is checked before acquisition, including symlinked cache ancestors, and it cannot be placed in the preserved source. Copies are streamed, hashed and flushed before exclusive publication. Different existing files are preserved and rejected. A completed archive is audited rather than reconstructed after lost or corrupt evidence. Recognized temporary copy/metadata files are confined to owned scratch; unknown state remains a blocker.
75
75
 
76
+ Retained file verification freshly reads and hashes every byte. Its zeroed scratch buffer is bounded by the observed file size and a 1 MiB ceiling, with a positive one-byte buffer for empty-file EOF and growth checks. The regular-file, no-follow, inode/device, size, timestamp, linked-path and growth checks remain required; smaller scratch allocation does not permit cached or partial hashes. Full path facts also produce a canonical locator: already-canonical retained paths use native resolution; different native spelling or a native resolution error falls back to the existing generic resolver. Retained package and CLI inventory loops consume byte/hash content facts without constructing a discarded canonical locator. They still validate every selected relative path and freshly execute all regular-file, no-follow, inode/device, size, timestamp, linked-path and growth checks; no prior file observation or hash is reused. Entry and descriptor path facts retain their resolver and fallback, including resolution errors before the file closes. Every task writer and transaction retains complete runtime revalidation.
77
+
76
78
  ## Historical task classes
77
79
 
78
80
  | Evidence | Adoption behavior |