@tiangong-lca/foundry 0.1.7 → 0.1.9

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 (59) hide show
  1. package/README.md +7 -5
  2. package/docs/architecture.md +7 -5
  3. package/docs/foundry-task-contracts.md +4 -4
  4. package/docs/import-profiles/worldsteel/constraints.md +3 -3
  5. package/docs/import-profiles/worldsteel/import-coverage.md +3 -3
  6. package/docs/import-profiles/worldsteel/import-plan.md +1 -1
  7. package/docs/import-profiles/worldsteel/profile.md +3 -3
  8. package/docs/package-distribution-contract.md +21 -13
  9. package/docs/public-runtime-contract.md +22 -6
  10. package/docs/runtime-context-contract.md +9 -5
  11. package/docs/task-authorization-contract.md +8 -4
  12. package/package-dist/assets/foundry-package-descriptor.json +150 -84
  13. package/package-dist/scripts/foundry-facade.d.ts +1 -0
  14. package/package-dist/scripts/foundry-facade.js +35 -4
  15. package/package-dist/scripts/lib/finalize-owners/commit-handoff.js +65 -10
  16. package/package-dist/scripts/lib/finalize-owners/finalize-reference-inputs.d.ts +12 -0
  17. package/package-dist/scripts/lib/finalize-owners/finalize-reference-inputs.js +57 -0
  18. package/package-dist/scripts/lib/finalize-owners/handoff-reference-intent.d.ts +28 -0
  19. package/package-dist/scripts/lib/finalize-owners/handoff-reference-intent.js +115 -0
  20. package/package-dist/scripts/lib/finalize-owners/native-insert-closeout.d.ts +13 -0
  21. package/package-dist/scripts/lib/finalize-owners/native-insert-closeout.js +99 -0
  22. package/package-dist/scripts/lib/finalize-owners/native-insert-handoff.d.ts +47 -0
  23. package/package-dist/scripts/lib/finalize-owners/native-insert-handoff.js +146 -0
  24. package/package-dist/scripts/lib/finalize-owners/post-authoring.js +13 -0
  25. package/package-dist/scripts/lib/finalize-owners/post-write-closeout.d.ts +8 -2
  26. package/package-dist/scripts/lib/finalize-owners/post-write-closeout.js +48 -2
  27. package/package-dist/scripts/lib/finalize-owners/reference-intent-closeout.d.ts +12 -0
  28. package/package-dist/scripts/lib/finalize-owners/reference-intent-closeout.js +77 -0
  29. package/package-dist/scripts/lib/foundry-authorization-input.d.ts +8 -0
  30. package/package-dist/scripts/lib/foundry-authorization-input.js +68 -1
  31. package/package-dist/scripts/lib/foundry-command-metadata.js +15 -1
  32. package/package-dist/scripts/lib/foundry-execution-admission.js +82 -5
  33. package/package-dist/scripts/lib/foundry-owner-execution-store.js +25 -2
  34. package/package-dist/scripts/lib/foundry-owner-readback.d.ts +2 -0
  35. package/package-dist/scripts/lib/foundry-owner-readback.js +65 -14
  36. package/package-dist/scripts/lib/foundry-package-contract.d.ts +4 -4
  37. package/package-dist/scripts/lib/foundry-package-contract.js +7 -5
  38. package/package-dist/scripts/lib/foundry-reference-input.d.ts +28 -0
  39. package/package-dist/scripts/lib/foundry-reference-input.js +235 -0
  40. package/package-dist/scripts/lib/foundry-runtime-qualification.js +2 -2
  41. package/package-dist/scripts/lib/foundry-runtime-utils.js +1 -1
  42. package/package-dist/scripts/lib/foundry-task-store.d.ts +1 -1
  43. package/package-dist/scripts/lib/foundry-workflow-authorization.d.ts +2 -1
  44. package/package-dist/scripts/lib/foundry-workflow-authorization.js +38 -2
  45. package/package-dist/scripts/lib/foundry-workflow-execution.js +7 -1
  46. package/package-dist/scripts/lib/foundry-workflow-finalize.js +43 -1
  47. package/package-dist/scripts/lib/foundry-workflow-state.d.ts +2 -0
  48. package/package-dist/scripts/lib/foundry-workflow-state.js +31 -2
  49. package/package-dist/scripts/lib/import-curation/internal/context-inputs.js +1 -1
  50. package/package-dist/scripts/public-api.d.ts +1 -0
  51. package/package-dist/scripts/runtime-entry.js +2 -1
  52. package/package.json +6 -5
  53. package/specs/import-profiles.json +1 -1
  54. package/specs/prewrite-content-policy.json +1 -1
  55. package/specs/schemas/foundry-authorization-input.schema.json +38 -1
  56. package/specs/schemas/foundry-managed-runtime.schema.json +1 -1
  57. package/specs/schemas/foundry-package-descriptor.schema.json +3 -2
  58. package/specs/schemas/foundry-reference-input.schema.json +137 -0
  59. package/specs/schemas/runtime-qualification.schema.json +1 -1
package/README.md CHANGED
@@ -157,13 +157,15 @@ checkPaths:
157
157
  - test/unit/lint-suppression-audit.test.mts
158
158
  - test/unit/zero-javascript-ratchet.test.mts
159
159
  - test/scenarios/foundry-package-consumer.test.mts
160
- lastReviewedAt: 2026-09-10
161
- lastReviewedCommit: 063016979fec5d4879f562c417b42b73b158aafe
162
- lastReviewedNote: "Reviewed for Foundry #153: strict0.1.7 version projection from qualified managed-action source0630169 and unchanged verified CLI0.1.13/toolchain/dependency inputs. All source/native action gates passed before preparation; complete owning release and independent public successor verification remain required."
160
+ lastReviewedAt: "2026-09-14"
161
+ lastReviewedCommit: "2b80865083d1ca4dd095624090ddd1c741b5d2cd"
162
+ lastReviewedNote: "Reviewed for Foundry #167: exact helper-generated version projection advances0.1.8 to0.1.9 for canonical publish.yml provenance. Runtime, ownership, environment, authorization, CLI0.1.14 dependency and all qualification gates remain unchanged. Registry/component publication and independent install proof are still pending."
163
163
  ---
164
164
 
165
165
  # TianGong LCA Data Foundry
166
166
 
167
+ The ordinary user entry is the independently installed [TianGong Foundry skill](https://github.com/tiangong-lca/agent-skills/tree/main/foundry-tidas-import). Its qualified release lock selects the managed runtime for a separate user workspace. The internal authoring role is maintained in the same Skills repository and loads for current semantic work items. This source checkout retains the developer commands and runtime owners described below; it carries no second maintained copy of either skill.
168
+
167
169
  The package candidate now supports CLI-managed execution with verified runtime components and separate read/write workspace access. F1 publication and complete production qualification remain in progress; see `docs/package-distribution-contract.md` for the current release boundary.
168
170
 
169
171
  Migration transfer planning is governed by [the workspace migration contract](docs/workspace-migration-contract.md). W10 provides explicit source/queue/input staging, current-owner task adoption, audited v2 activation and separate runtime read/write selection. Preserved history blocks replay across requests and migrations; none of these records grants business permission. Operational qualification and release integration remain tracked in #108/#980.
@@ -339,9 +341,9 @@ pnpm case:production:contact-draft -- \
339
341
 
340
342
  The runner accepts no API key or alternate CLI path on argv. It reads only `TIANGONG_LCA_API_BASE_URL`, `TIANGONG_LCA_SUPABASE_PUBLISHABLE_KEY`, and `TIANGONG_LCA_TEST_API_KEY`; the test key exists only in the child environment. The env file must be a regular non-symlink file with POSIX mode `0600` or stricter and, when it is inside this repository, must be git-ignored. The new output directory must also be inside this repository, git-ignored, and reached without a symlinked parent.
341
343
 
342
- This production lane is POSIX-only. Windows execution fails closed until the runner can verify a user-exclusive ACL; Windows CI covers that refusal rather than a live case. On POSIX, the runner snapshots the exact installed CLI 0.1.13 package inside its pnpm dependency island, hashes and rechecks the full pnpm installation plus Foundry source/build/lock facts before every child boundary, executes from a clean directory with `shell=false`, fsyncs create-only private evidence, and publishes a content-addressed case manifest only after the runtime snapshot is removed. Any detected secret in stdout, a report, or a sidecar artifact fails the case and leaves only redacted failure evidence. The created contact remains isolated, unreviewed, and unpublished under the authenticated test account for later case evidence; the lane never performs review/publish transitions or mutates foreign/public/shared rows.
344
+ This production lane is POSIX-only. Windows execution fails closed until the runner can verify a user-exclusive ACL; Windows CI covers that refusal rather than a live case. On POSIX, the runner snapshots the exact installed CLI 0.1.14 package inside its pnpm dependency island, hashes and rechecks the full pnpm installation plus Foundry source/build/lock facts before every child boundary, executes from a clean directory with `shell=false`, fsyncs create-only private evidence, and publishes a content-addressed case manifest only after the runtime snapshot is removed. Any detected secret in stdout, a report, or a sidecar artifact fails the case and leaves only redacted failure evidence. The created contact remains isolated, unreviewed, and unpublished under the authenticated test account for later case evidence; the lane never performs review/publish transitions or mutates foreign/public/shared rows.
343
345
 
344
- Credential-scoped commands use `pnpm account:run -- <profile> -- <executable> [args...]`. The ignored profile supplies both the expected Supabase project ref and canonical user UUID. The wrapper resolves the installed CLI 0.1.13, obtains a fresh intent-bound `auth identity-receipt`, and then executes the requested argv without a shell and without inheriting unrelated parent environment variables. Authentication bypass flags are unsupported.
346
+ Credential-scoped commands use `pnpm account:run -- <profile> -- <executable> [args...]`. The ignored profile supplies both the expected Supabase project ref and canonical user UUID. The wrapper resolves the installed CLI 0.1.14, obtains a fresh intent-bound `auth identity-receipt`, and then executes the requested argv without a shell and without inheriting unrelated parent environment variables. Authentication bypass flags are unsupported.
345
347
 
346
348
  Issue #70 consumes CLI 0.1.3 through its supported `./batch` and `./auth-identity-receipt` subpaths. The production identity-preflight path uses the public strict parser; deterministic receipt construction exists only in a local test fixture, and the toolchain ratchet rejects every `@tiangong-lca/cli/dist/src/**` import. pnpm's 1,440-minute maturity gate remains enabled; the exact 0.1.3 exception is bound to the release already verified by tag, Sigstore/Rekor provenance, registry integrity, and clean public consumers.
347
349
 
@@ -151,13 +151,15 @@ checkPaths:
151
151
  - test/unit/foundry-runtime-environment.test.mts
152
152
  - test/unit/lint-suppression-audit.test.mts
153
153
  - docs/incremental-change-set-contract.md
154
- lastReviewedAt: 2026-09-10
155
- lastReviewedCommit: 063016979fec5d4879f562c417b42b73b158aafe
156
- lastReviewedNote: "Reviewed for Foundry #153: strict0.1.7 version projection from qualified managed-action source0630169 and unchanged verified CLI0.1.13/toolchain/dependency inputs. All source/native action gates passed before preparation; complete owning release and independent public successor verification remain required."
154
+ lastReviewedAt: "2026-09-14"
155
+ lastReviewedCommit: "2b80865083d1ca4dd095624090ddd1c741b5d2cd"
156
+ lastReviewedNote: "Reviewed for Foundry #167: exact helper-generated version projection advances0.1.8 to0.1.9 for canonical publish.yml provenance. Runtime, ownership, environment, authorization, CLI0.1.14 dependency and all qualification gates remain unchanged. Registry/component publication and independent install proof are still pending."
157
157
  ---
158
158
 
159
159
  # Architecture
160
160
 
161
+ The ordinary Foundry entry and its on-demand semantic authoring package are maintained in `tiangong-lca-skills`. This repository owns the runtime task protocol and deterministic stages; its skill inventory resolves canonical installed packages and keeps local copies untracked. The import-orchestration capability identifies Skills as the entry owner while completion/runtime capabilities retain Foundry ownership.
162
+
161
163
  Managed process admission is a Foundry adapter over the public CLI host context. CLI owns IPC, component verification and leases; Foundry binds its installed package, CLI/TIDAS expectations, workspace access and target manifest before public operations. The shared runtime-cache path guard excludes workspace and migration roots from the manager cache. This adds no authentication, installer or business-write owner.
162
164
 
163
165
  Migration transfer planning is governed by [the workspace migration contract](workspace-migration-contract.md). W10 provides explicit source/queue/input staging, current-owner task adoption, audited v2 activation and separate runtime read/write selection. Preserved history blocks replay across requests and migrations; none of these records grants business permission. Operational qualification and release integration remain tracked in #108/#980.
@@ -174,7 +176,7 @@ The public task facade delegates sealed owner execution to `foundry-workflow-exe
174
176
 
175
177
  ## OAuth identity boundary
176
178
 
177
- Foundry selects a private session reference and exact project/user intent, then calls the published CLI for a fresh server-verified identity receipt. It validates TTL, canonical hash, expected identity and current OAuth session metadata without owning login, password decoding, token exchange or refresh. Candidate Golden execution uses an isolated Git-visible source snapshot so ignored operator state cannot change qualification. Support-cache transport is owned by the public CLI export. Foundry validates the fresh identity, project, public-state scope, completion marker, artifact paths and hashes, then summarizes rows and atomically replaces only the requested local cache. The CLI runs in a private temporary cwd with an allowlisted OAuth environment; the operator checkout .env and unrelated secrets cannot enter that child. Exact public CLI 0.1.13 and reviewed TIDAS 0.2.x/0.3.x expectations are independently selected and re-observed through the W04 qualification boundary. F1 component provenance and package qualification remain W06/W08 gates.
179
+ Foundry selects a private session reference and exact project/user intent, then calls the published CLI for a fresh server-verified identity receipt. It validates TTL, canonical hash, expected identity and current OAuth session metadata without owning login, password decoding, token exchange or refresh. Candidate Golden execution uses an isolated Git-visible source snapshot so ignored operator state cannot change qualification. Support-cache transport is owned by the public CLI export. Foundry validates the fresh identity, project, public-state scope, completion marker, artifact paths and hashes, then summarizes rows and atomically replaces only the requested local cache. The CLI runs in a private temporary cwd with an allowlisted OAuth environment; the operator checkout .env and unrelated secrets cannot enter that child. Exact public CLI 0.1.14 and reviewed TIDAS 0.2.x/0.3.x expectations are independently selected and re-observed through the W04 qualification boundary. F1 component provenance and package qualification remain W06/W08 gates.
178
180
 
179
181
  ## Qualified execution boundary
180
182
 
@@ -341,7 +343,7 @@ Build and test resolution must be worktree-local. A clean arbitrary Git worktree
341
343
 
342
344
  Cross-platform characterization is also explicit: the Golden harness compares normalized outputs to a non-`HEAD` merge-base, performs recursive comparison in Node rather than calling an external Unix utility, and uses full Git history in CI. Script-backed executable overrides are represented as an executable plus argv prefix and run through Node on macOS, Linux, and Windows. The root `.gitattributes` fixes text files to LF while allowing Windows launcher exceptions, preventing checkout policy from masquerading as format drift.
343
345
 
344
- The first credential-bearing entrypoint on that spine is `scripts/with-lca-account.ts`. It does not authenticate against Supabase itself. It resolves the exact installed CLI 0.1.13, requests `auth identity-receipt` with both expected project and user assertions, accepts only a fresh intent-bound forced signin, and then launches the requested executable plus argv with `shell:false` and a restricted environment. The CLI owns session and live identity behavior; Foundry owns the profile/thread intent checks and safe process boundary.
346
+ The first credential-bearing entrypoint on that spine is `scripts/with-lca-account.ts`. It does not authenticate against Supabase itself. It resolves the exact installed CLI 0.1.14, requests `auth identity-receipt` with both expected project and user assertions, accepts only a fresh intent-bound forced signin, and then launches the requested executable plus argv with `shell:false` and a restricted environment. The CLI owns session and live identity behavior; Foundry owns the profile/thread intent checks and safe process boundary.
345
347
 
346
348
  `scripts/lib/identity-preflight-proof.ts` imports the strict parser from the public `@tiangong-lca/cli/auth-identity-receipt` subpath. `test/fixtures/auth-identity-receipt.ts` is the sole test-only wire-fixture owner and produces bytes that must pass that public parser. No production module or fixture may load CLI `dist/src/**`; the installed-package contract also exercises public batch scheduling/run-lock behavior and proves the private path remains closed.
347
349
 
@@ -28,9 +28,9 @@ checkPaths:
28
28
  - specs/schemas/execution-context.schema.json
29
29
  - specs/import-profiles.json
30
30
  - tasks/**
31
- lastReviewedAt: 2026-09-09
32
- lastReviewedCommit: fa219ecc833c0aad9bb6a3661265a57f8f24a814
33
- lastReviewedNote: "Reviewed for Foundry #147: adopt independently verified CLI 0.1.13 at b5e2092 with original permission-preserving bootstrap scripts. Exact runtime/schema/package/release expectations advance together; other dependencies, TIDAS, profile rules, task authorization and private no-replay evidence remain unchanged."
31
+ lastReviewedAt: 2026-09-11
32
+ lastReviewedCommit: fd348f2c0d4391974f2fd894e2939f677cae618d
33
+ lastReviewedNote: "Reviewed for Foundry #119: explicit native insert selection, indexed control snapshot, exact command/report bindings and no-replay recovery. CLI retains native execution ownership; existing authorization and environment boundaries remain mandatory."
34
34
  related:
35
35
  - AGENTS.md
36
36
  - WORKFLOW.md
@@ -132,7 +132,7 @@ Account registration optionally stores `account_mode` from explicit task/host in
132
132
 
133
133
  An expected account may be selected after local preparation. The first selection is registered as project/user intent; subsequent disagreement is rejected. A missing task-local account file may only be restored from its existing workspace registration. This is intent, not proof of authentication.
134
134
 
135
- `verifyFoundryRuntimeIdentity` invokes the exact installed CLI through executable/argv in a fresh private CWD with a restricted environment. The CLI owns OAuth/session refresh and server identity verification. Returned proof is immutable, process-local and bound to workspace/task/actor/runtime, with a 60-second freshness check at permission admission. Serialized proof is not reusable authority. Headless mode uses the CLI's existing explicit target and process-only access token, with cache disabled and no token persistence. CLI 0.1.13 reports no token-expiry timestamp for that mode; Foundry does not invent one or claim a separately verified token lifetime.
135
+ `verifyFoundryRuntimeIdentity` invokes the exact installed CLI through executable/argv in a fresh private CWD with a restricted environment. The CLI owns OAuth/session refresh and server identity verification. Returned proof is immutable, process-local and bound to workspace/task/actor/runtime, with a 60-second freshness check at permission admission. Serialized proof is not reusable authority. Headless mode uses the CLI's existing explicit target and process-only access token, with cache disabled and no token persistence. CLI 0.1.14 reports no token-expiry timestamp for that mode; Foundry does not invent one or claim a separately verified token lifetime.
136
136
 
137
137
  `registerFoundryTaskAuthorization` is an explicit host approval operation. It requires fresh identity, current task/input lineage, a valid W03 grant, and independently selected evidence facts supplied by the trusted caller. The grant cannot select its own evidence paths. Each original evidence file is rechecked and copied into an immutable task snapshot; the grant and selection are registered in workspace state. Updating `authorization.json` uses compare-and-swap against its prior digest and preserves historical grants. Unknown legacy authorization files are not overwritten.
138
138
 
@@ -1,7 +1,7 @@
1
1
  ---
2
- lastReviewedAt: 2026-09-09
3
- lastReviewedCommit: fa219ecc833c0aad9bb6a3661265a57f8f24a814
4
- lastReviewedNote: "Reviewed for Foundry #147: adopt independently verified CLI 0.1.13 at b5e2092 with original permission-preserving bootstrap scripts. Exact runtime/schema/package/release expectations advance together; other dependencies, TIDAS, profile rules, task authorization and private no-replay evidence remain unchanged."
2
+ lastReviewedAt: 2026-09-11
3
+ lastReviewedCommit: abc7672f3b3a806caa4219ab5b797f1d92421926
4
+ lastReviewedNote: "Reviewed for #122: explicit task reference snapshots, CLI 0.1.14 QA/intent transport, sealed admission/readback evidence and no-replay recovery. Existing profile, permission, environment and historical delivery boundaries remain enforced."
5
5
  title: worldsteel Import Constraints
6
6
  docType: constraints
7
7
  scope: import-profile
@@ -1,7 +1,7 @@
1
1
  ---
2
- lastReviewedAt: 2026-09-09
3
- lastReviewedCommit: fa219ecc833c0aad9bb6a3661265a57f8f24a814
4
- lastReviewedNote: "Reviewed for Foundry #147: adopt independently verified CLI 0.1.13 at b5e2092 with original permission-preserving bootstrap scripts. Exact runtime/schema/package/release expectations advance together; other dependencies, TIDAS, profile rules, task authorization and private no-replay evidence remain unchanged."
2
+ lastReviewedAt: 2026-09-11
3
+ lastReviewedCommit: abc7672f3b3a806caa4219ab5b797f1d92421926
4
+ lastReviewedNote: "Reviewed for #122: explicit task reference snapshots, CLI 0.1.14 QA/intent transport, sealed admission/readback evidence and no-replay recovery. Existing profile, permission, environment and historical delivery boundaries remain enforced."
5
5
  title: worldsteel EF3.1 Import Coverage Evidence
6
6
  docType: report
7
7
  scope: import-profile/worldsteel
@@ -331,7 +331,7 @@ The vast majority of those exchanges point at EF3.1 reference flows that will re
331
331
 
332
332
  ## 9. Risk register (consolidated gotchas)
333
333
 
334
- - **Use the project-installed CLI** — leave `TIANGONG_LCA_CLI_BIN` blank so Foundry resolves exact `@tiangong-lca/cli@0.1.13`; an override is only for an explicit local test binary. Credential-scoped execution still goes through the receipt-gated `pnpm account:run` wrapper.
334
+ - **Use the project-installed CLI** — leave `TIANGONG_LCA_CLI_BIN` blank so Foundry resolves exact `@tiangong-lca/cli@0.1.14`; an override is only for an explicit local test binary. Credential-scoped execution still goes through the receipt-gated `pnpm account:run` wrapper.
335
335
  - **Don't copy BAFU/USLCI profile wholesale** — Worldsteel reuses every canonical row by UUID, caps the R3 elementary tail, and enables R5 only for materialized FP/UG canonical-cache misses behind the full account-local support gates.
336
336
  - **`databaseFallbackSourceConfig` silently inherits BAFU** for any unknown profile → ✅ worldsteel branch added.
337
337
  - **`source_contact_rewrites` gated to bafu/uslci** → ✅ widened to include `worldsteel`.
@@ -1,7 +1,7 @@
1
1
  ---
2
- lastReviewedAt: 2026-09-09
3
- lastReviewedCommit: fa219ecc833c0aad9bb6a3661265a57f8f24a814
4
- lastReviewedNote: "Reviewed for Foundry #147: adopt independently verified CLI 0.1.13 at b5e2092 with original permission-preserving bootstrap scripts. Exact runtime/schema/package/release expectations advance together; other dependencies, TIDAS, profile rules, task authorization and private no-replay evidence remain unchanged."
2
+ lastReviewedAt: 2026-09-11
3
+ lastReviewedCommit: abc7672f3b3a806caa4219ab5b797f1d92421926
4
+ lastReviewedNote: "Reviewed for #122: explicit task reference snapshots, CLI 0.1.14 QA/intent transport, sealed admission/readback evidence and no-replay recovery. Existing profile, permission, environment and historical delivery boundaries remain enforced."
5
5
  title: worldsteel Import Profile
6
6
  docType: profile
7
7
  scope: import-profile
@@ -23,7 +23,7 @@ checkPaths:
23
23
  - scripts/verify-foundry-package.ts
24
24
  - scripts/release-*.ts
25
25
  - scripts/lib/foundry-release-*.ts
26
- - .github/workflows/publish-foundry.yml
26
+ - .github/workflows/publish.yml
27
27
  - .github/workflows/quality-gate.yml
28
28
  - scripts/lib/foundry-package-contract.ts
29
29
  - scripts/lib/foundry-runtime-paths.ts
@@ -34,9 +34,9 @@ checkPaths:
34
34
  - test/commands/foundry-release-*.test.mts
35
35
  - test/unit/runtime-layout.test.mts
36
36
  - test/scenarios/foundry-package-consumer.test.mts
37
- lastReviewedAt: 2026-09-10
38
- lastReviewedCommit: 063016979fec5d4879f562c417b42b73b158aafe
39
- lastReviewedNote: "Reviewed for Foundry #153: strict0.1.7 version projection from qualified managed-action source0630169 and unchanged verified CLI0.1.13/toolchain/dependency inputs. All source/native action gates passed before preparation; complete owning release and independent public successor verification remain required."
37
+ lastReviewedAt: "2026-09-14"
38
+ lastReviewedCommit: "2b80865083d1ca4dd095624090ddd1c741b5d2cd"
39
+ lastReviewedNote: "Reviewed for Foundry #167: exact helper-generated version projection advances0.1.8 to0.1.9 for canonical publish.yml provenance. Runtime, ownership, environment, authorization, CLI0.1.14 dependency and all qualification gates remain unchanged. Registry/component publication and independent install proof are still pending."
40
40
  related:
41
41
  - docs/public-runtime-contract.md
42
42
  - docs/runtime-context-contract.md
@@ -48,9 +48,9 @@ related:
48
48
 
49
49
  The npm identity is `@tiangong-lca/foundry`; the public bin is `tiangong-foundry`. W06 establishes the installable `0.1.0` candidate and its production dependency closure. It does not publish a registry version or call this candidate F1. W08 owns the release-only workflow, Trusted Publishing/provenance, immutable tag, platform components, SBOM/license bundle and product compatibility manifest.
50
50
 
51
- CLI 0.1.13 is independently verified at source/tag `b5e209259d3bb06205b9af131b1c0edc3fba6da2`. Its original POSIX bootstrap preserves verified archive modes under the private umask; its PowerShell bytes are unchanged. The exact source/script digests in `specs/release/runtime-inputs.json` and runtime descriptor/schema expectations advance with the single CLI lock entry. All other 134 locked packages and the sixteen-package production closure remain unchanged.
51
+ CLI 0.1.14 is independently verified at source/tag `b5e209259d3bb06205b9af131b1c0edc3fba6da2`. Its original POSIX bootstrap preserves verified archive modes under the private umask; its PowerShell bytes are unchanged. The exact source/script digests in `specs/release/runtime-inputs.json` and runtime descriptor/schema expectations advance with the single CLI lock entry. All other 134 locked packages and the sixteen-package production closure remain unchanged.
52
52
 
53
- The package depends exactly on public `@tiangong-lca/cli@0.1.13`. Ajv remains a development dependency for internal commands and release-side SPDX validation. Sigstore 5.0.0, YAML 2.9.0, tar 7.5.22 and fflate 0.8.3 are also development-only release tools for signing/verification, lock parsing and bounded upstream archive selection. None enters the public compiler/dependency closure. TIDAS is an independently verified native component selected later by the CLI manager, not an npm dependency or bundled binary.
53
+ The package depends exactly on public `@tiangong-lca/cli@0.1.14`. Ajv remains a development dependency for internal commands and release-side SPDX validation. Sigstore 5.0.0, YAML 2.9.0, tar 7.5.22 and fflate 0.8.3 are also development-only release tools for signing/verification, lock parsing and bounded upstream archive selection. None enters the public compiler/dependency closure. TIDAS is an independently verified native component selected later by the CLI manager, not an npm dependency or bundled binary.
54
54
 
55
55
  ## Public surface
56
56
 
@@ -124,6 +124,14 @@ The public protocol set advertises each shipped external task input: task-start,
124
124
 
125
125
  Verification uses regular-file, `O_NOFOLLOW`, fd size/inode/mtime and SHA checks. Missing, extra, linked, renamed, traversing, oversized or changed payloads fail before a package-backed facade context is created. Every package-entry resolution performs this check even if an extra source-like file appears; such a file is itself an unexpected payload and cannot switch the resolver into developer mode. A nested `node_modules` may be dependency storage only when it is a real directory, never a symlink. Source and ordinary developer-emitted layouts remain readable as legacy layout v1 or repository layout v2 without treating a copied name-only manifest as a package.
126
126
 
127
+ ## Repository migration identity
128
+
129
+ Current release producers and CI capsules bind `tiangong-lca/foundry`, repository ID `1260957221`, and organization ID `327771381`. CI capsule identity is independent of the candidate package version, so ordinary source validation still works while the package remains `0.1.8`.
130
+
131
+ npm verification chooses exactly one historical identity from the expected package version: Foundry through `0.1.8` uses `tiangong-lca/data-foundry`, and CLI through `0.1.14` uses `tiangong-lca/tiangong-cli`, both with owner ID `199785309`. Later versions use `foundry` or `cli` under organization ID `327771381`; the CLI repository ID remains `1194220834`. The verifier binds issuer, SAN, certificate repository/owner/source/ref/event extensions, signed provenance and package integrity to the same profile. Repository redirects do not establish signing authority.
132
+
133
+ New Foundry publication and tag creation require a version above `0.1.8`. Existing tags and released bytes stay immutable. Unchanged-version source commits remain non-release events. Current runtime assembly emits canonical source/download URLs; pinned input manifests and archived signed metadata are not rewritten. npm Trusted Publisher configuration and any later versioned publication require separate live qualification.
134
+
127
135
  ## Version preparation
128
136
 
129
137
  `pnpm release:version --version <major.minor.patch>` is a read-only maintainer plan. It validates the repository package identity and coherent manifest, compiled-verifier and descriptor-schema versions, then reports the three bounded content changes. Stable versions cannot decrease. The CLI has no alternate-root or serialized-plan input.
@@ -168,7 +176,7 @@ Native source qualification, published-input assembly and npm signing may consum
168
176
 
169
177
  ### Signed completed stages and recovery
170
178
 
171
- `pnpm ci:stage restore|seal` is a source-only workflow utility. A `tiangong-foundry.ci-capsule.v1` receipt binds stage, platform, CI/release purpose, repository numeric identities, exact source commit/tree, package, Node/pnpm/TypeScript and lock hash, native-input and complete test-plan hashes, upstream input digest, and every regular payload file's size/SHA256. The trusted owning job seals only after successful semantic validation. GitHub attests the receipt, thereby binding its entire inventory. Source qualification uses the reusable `quality-gate.yml` signer; release stages use `publish-foundry.yml`. Verification checks the hosted-runner certificate's source, caller and signer digests/refs, repository identities and original run/attempt, rather than trusting provenance-shaped JSON.
179
+ `pnpm ci:stage restore|seal` is a source-only workflow utility. A `tiangong-foundry.ci-capsule.v1` receipt binds stage, platform, CI/release purpose, repository numeric identities, exact source commit/tree, package, Node/pnpm/TypeScript and lock hash, native-input and complete test-plan hashes, upstream input digest, and every regular payload file's size/SHA256. The trusted owning job seals only after successful semantic validation. GitHub attests the receipt, thereby binding its entire inventory. Source qualification uses the reusable `quality-gate.yml` signer; release stages use `publish.yml`. Verification checks the hosted-runner certificate's source, caller and signer digests/refs, repository identities and original run/attempt, rather than trusting provenance-shaped JSON.
172
180
 
173
181
  `resume_run_id` is an optional numeric locator for one exact same-source prior run. The current run is searched first, including earlier attempts. Discovery is bounded to 500 artifacts per selected run; names locate candidates but grant no authority. Missing or legitimately expired proofs cause the owning stage to execute again. Invalid signatures, mismatched content or incomplete evidence fail closed. Required downstream inputs cannot silently fall back. Verified signing time must be within 24 hours; missing or future signing timestamps are invalid. Relay artifacts keep the original receipt and payload unchanged and do not extend that lifetime. Changed source, dependencies, toolchain, platform or input requires qualification again. Legacy unsigned results are never promoted into this protocol.
174
182
 
@@ -188,7 +196,7 @@ Benchmark targets are at most 18 minutes for full qualification and 5 minutes fo
188
196
 
189
197
  `pnpm release:verify-npm --package <cli|foundry> --version <x.y.z> --expected-git-head <40-hex-sha>` independently downloads the exact public npm metadata, tarball and attestation. Downloads reject redirects, credentials, alternate registry origins/paths and unbounded responses. Verification binds canonical SHA-512 to the downloaded tarball, then verifies the Sigstore certificate, issuer and transparency logs before interpreting the signed in-toto/SLSA payload. The verified certificate identity must match the signed workflow/ref, package subject, source commit and exact GitHub-hosted run attempt. Optional registry `gitHead` must match when present; its absence never substitutes for signed provenance.
190
198
 
191
- CLI provenance is restricted to `tiangong-lca/tiangong-cli` and `.github/workflows/publish.yml` at the exact `cli-v<version>` tag. The Foundry policy binds `tiangong-lca/data-foundry` and `.github/workflows/publish-foundry.yml`; a normal publication must originate from a main push, and recovery must originate from `workflow_dispatch` on the exact `foundry-v<version>` tag. Both paths require the expected source digest.
199
+ Published CLI versions through 0.1.14 retain `tiangong-lca/tiangong-cli` and `.github/workflows/publish.yml`; later versions bind `tiangong-lca/cli` at the exact `cli-v<version>` tag. The current Foundry verifier accepts only `.github/workflows/publish.yml` for every requested version. The previously used `.github/workflows/publish-foundry.yml` signer is intentionally retired by the owner decision on 2026-09-13, including for legacy package versions; it is not an accepted rollback or verification exception. Existing published files and signatures remain immutable, but historical artifacts signed by that workflow are outside this verifier's admission policy. Repository/owner identity remains independently version-bound; later Foundry versions use `tiangong-lca/foundry`. Normal publication originates from a main push, and recovery from `workflow_dispatch` on the exact `foundry-v<version>` tag. Every case requires its expected source digest and numeric repository/owner identity.
192
200
 
193
201
  `--output <new-absolute-directory>` preserves the verified tarball, raw registry metadata/attestations and the digest-bound verification report only after verification succeeds. It never replaces an existing directory. Reports are verification evidence, not independent trust anchors: component consumers still require the separately trusted product manifest/Skills lock. The tool cannot publish, tag, configure a publisher, read `.env` or supply a registry token. Sigstore uses an owned temporary trust cache that is removed after verification.
194
202
 
@@ -202,7 +210,7 @@ Exact-tag recovery permits empty/default inputs plus an optional canonical numer
202
210
 
203
211
  The immutable `foundry-v0.1.4` workflow predates this default-input correction. To continue that release, completely rerun its original qualified main-push run `34314765464`; that preserved event has no dispatch inputs. Every required source and publication stage runs again with fresh attempt-bound artifacts, and the existing public npm release is independently verified without another upload. Do not move the old tag or mix artifacts from different attempts. A successful package upload whose immediate public readback failed must first be independently verified before choosing this recovery.
204
212
 
205
- `.github/workflows/publish-foundry.yml` connects that context gate to the existing four-native-host canonical gate through `workflow_call`. The reusable quality workflow checks out the admitted SHA, retains its ordinary PR/manual triggers, and does not persist checkout credentials. The source checks have read-only permissions; only their completed-stage sealer receives OIDC and attestation-write permissions.
213
+ `.github/workflows/publish.yml` connects that context gate to the existing four-native-host canonical gate through `workflow_call`. The reusable quality workflow checks out the admitted SHA, retains its ordinary PR/manual triggers, and does not persist checkout credentials. The source checks have read-only permissions; only their completed-stage sealer receives OIDC and attestation-write permissions.
206
214
 
207
215
  After every host passes, the separate `release-tag` job revalidates the event, clean source/main relationship, release-only diff and merged PR. `pnpm release:tag` accepts no source/tag arguments or serialized context and requires that exact job identity. This tag job receives contents-write permission only for its create-or-verify operation; it installs no project dependencies and does not persist checkout credentials. The later component publisher has separate contents-write permission gated on all published-input native jobs; final-manifest publication has its own contents-write job after all public bootstrap checks.
208
216
 
@@ -226,7 +234,7 @@ For a package identity's first publication, after the reviewed pipeline has prod
226
234
  2. An authorized maintainer signs in to npm using their own account and completes the required 2FA. Keep the artifact files unchanged and change into their downloaded directory outside a Git checkout.
227
235
  3. With pinned pnpm 11.24.0, execute the generated command: `pnpm publish ./tiangong-lca-foundry-<version>.tgz --access public --no-git-checks --config.provenance-file=./foundry-<version>.sigstore`. The generic `--config.provenance-file` spelling is required by this pinned client. The provided CI signature accompanies the unchanged package; the account authorizes its upload.
228
236
  4. Independently run `release:verify-npm` for that exact version/source, compare its tarball digests with the prepared verification, and preserve the result. After a failed or uncertain upload, inspect the exact public version before deciding the next action; do not blindly replay a publish or overwrite an existing version.
229
- 5. Review the new package's npm Trusted Publisher settings for organization `tiangong-lca`, repository `data-foundry`, workflow `publish-foundry.yml`, permission to publish and the actual job environment binding. The current job declares no GitHub environment. Routine publication must use that reviewed workflow's OIDC path and receive separate public readback verification.
237
+ 5. Review the new package's npm Trusted Publisher settings for organization `tiangong-lca`, repository `foundry`, workflow `publish.yml`, permission to publish and the actual job environment binding. The current job declares no GitHub environment. Routine publication must use that reviewed workflow's OIDC path and receive separate public readback verification.
230
238
 
231
239
  The npm package identity and publisher configuration are account-controlled prerequisites, separate from CI signing. A prepared artifact, a successful mock-registry transport test or source-only native qualification is not a published F1 release. The actual versioned workflow execution, complete native components and immutable product-manifest publication remain W08 release gates.
232
240
 
@@ -244,11 +252,11 @@ There is one publisher invocation. Regardless of its reported success or an unce
244
252
 
245
253
  `package-artifacts/npm-publication/` contains the publication result and readable report; a successful result also preserves public metadata, attestations and verification. The workflow exports this evidence even when publication fails. `npm_published=true` is emitted only after public verification succeeds; later component/manifest stages must require it. It proves package publication only, not complete F1 runtime qualification.
246
254
 
247
- An explicit `workflow_dispatch` with `diagnose_npm_oidc=true` selects the separate diagnostic job in the same Trusted Publisher workflow and skips the release context and every publication continuation. `pnpm release:diagnose-npm-oidc` accepts no arguments and requires that exact GitHub-hosted diagnostic job, canonical repository/workflow, branch dispatch, matching workflow/source SHA, clean physical checkout and explicit event input. It requests one package-specific ephemeral credential through the existing bounded OIDC exchange, discards it, and reports only fixed validation reasons, field kinds, boolean token checks and numeric timing differences. No token, raw response value, credential fingerprint or account configuration is emitted or persisted. The diagnostic cannot upload packages, create tags/releases/assets or satisfy release qualification. Its shared response inspection uses the ordinary publisher's timestamp parser and unchanged freshness/lifetime limits; a diagnostic rejection is evidence to investigate, never permission to weaken them.
255
+ An explicit `workflow_dispatch` with `diagnose_npm_oidc=true` selects the separate diagnostic job in the same Trusted Publisher workflow and skips the release context and every publication continuation. `pnpm release:diagnose-npm-oidc` accepts no arguments and requires that exact GitHub-hosted diagnostic job, canonical repository/workflow, branch dispatch, matching workflow/source SHA, clean physical checkout and explicit event input. It requests one package-specific ephemeral credential through the existing bounded OIDC exchange, discards it, and reports only fixed validation reasons, field kinds, boolean token checks and numeric timing differences. Failures identify admission, source, input, GitHub OIDC, npm exchange or npm response parsing using fixed stage identifiers; a response status is reported only as a bounded HTTP number. Raw dependency errors and response contents remain hidden. Rejected credentials and failed requests exit nonzero. No token, raw response value, credential fingerprint or account configuration is emitted or persisted. The diagnostic cannot upload packages, create tags/releases/assets or satisfy release qualification. Its shared response inspection uses the ordinary publisher's timestamp parser and unchanged freshness/lifetime limits; a diagnostic rejection is evidence to investigate, never permission to weaken them.
248
256
 
249
257
  Before expensive release qualification, `release:preflight` revalidates the exact release event/merged source and registry state. An existing version undergoes public verification; a new version performs the real package-specific OIDC exchange and discards the credential after reporting fixed validation facts. First-package identity creation retains the prepared-artifact maintainer handoff. The preflight job cannot sign or publish a package.
250
258
 
251
- For standalone native diagnosis, dispatch `publish-foundry.yml` on a reviewed branch with `diagnose_platform` set to one supported tuple and `diagnose_tag` set to an exact existing stable tag; leave the other modes disabled. `release:diagnose-platform` validates that immutable tag's main ancestry, release-only source and merged PR, then executes that source's published-native preparation in an isolated worktree. Its token is read-only and it has no OIDC permission. Bounded reports preserve controller/source/platform, failing phase, exit and fixed failure facts without raw child output or credentials. Current-source native qualification also preserves `runtime-diagnostic.json` before cleaning its temporary cache; failed diagnostics are never qualification evidence.
259
+ For standalone native diagnosis, dispatch `publish.yml` on a reviewed branch with `diagnose_platform` set to one supported tuple and `diagnose_tag` set to an exact existing stable tag; leave the other modes disabled. `release:diagnose-platform` validates that immutable tag's main ancestry, release-only source and merged PR, then executes that source's published-native preparation in an isolated worktree. Its token is read-only and it has no OIDC permission. Bounded reports preserve controller/source/platform, failing phase, exit and fixed failure facts without raw child output or credentials. Current-source native qualification also preserves `runtime-diagnostic.json` before cleaning its temporary cache; failed diagnostics are never qualification evidence.
252
260
 
253
261
  ## Runtime component publication
254
262
 
@@ -304,7 +312,7 @@ Native handshake success is not minimum-host or clean-machine qualification. Cur
304
312
 
305
313
  `pnpm package:build` rebuilds both output roots from scratch and verifies the staged package. `pnpm package:check` compares the stage with the descriptor, runs a pack dry-run, and verifies the installed C1 descriptor. `pnpm package:pack` packs only `package-stage/` into an owned temporary directory, derives the versioned archive name from the verified staged descriptor, then installs it with an exclusive hardlink. The repository manifest, compiled verifier version and descriptor JSON Schema version remain coherent release projections; the verifier never takes its expected identity from the installed manifest it is checking. An identical existing archive is reused; a link, invalid file or different existing bytes are preserved and rejected rather than overwritten.
306
314
 
307
- The package scenario rebuilds twice, packs twice byte-identically, and installs the same tarball into two clean consumers; the second install is offline from the first consumer's isolated public cache. The scenario first verifies the source-pinned pnpm version. Corepack, when used, stores that tool in a fresh scenario-local cache shared across the isolated tool homes; later packing runs with Corepack networking disabled and latest-version lookup disabled. Tool bootstrap and the first public-registry install have bounded five-minute deadlines for cold network downloads; the offline install and local commands retain their two-minute deadlines. It verifies the exact import surface and declarations, public CLI 0.1.13 runtime identity, shebang/bin, source/installed operation equivalence, arbitrary Unicode CWD, read-only package bytes, isolated workspace writes and all six facade operations. It also proves that internal commands, modified/extra/linked files, a lifecycle-bearing manifest, a `darwin-x64` descriptor and a package copied without C1 fail closed.
315
+ The package scenario rebuilds twice, packs twice byte-identically, and installs the same tarball into two clean consumers; the second install is offline from the first consumer's isolated public cache. The scenario first verifies the source-pinned pnpm version. Corepack, when used, stores that tool in a fresh scenario-local cache shared across the isolated tool homes; later packing runs with Corepack networking disabled and latest-version lookup disabled. Tool bootstrap and the first public-registry install have bounded five-minute deadlines for cold network downloads; the offline install and local commands retain their two-minute deadlines. It verifies the exact import surface and declarations, public CLI 0.1.14 runtime identity, shebang/bin, source/installed operation equivalence, arbitrary Unicode CWD, read-only package bytes, isolated workspace writes and all six facade operations. It also proves that internal commands, modified/extra/linked files, a lifecycle-bearing manifest, a `darwin-x64` descriptor and a package copied without C1 fail closed.
308
316
 
309
317
  These checks qualify a local candidate tarball. They do not prove registry provenance, public component download, native TIDAS availability on every host or a complete Node+CLI+Foundry+TIDAS component. Those are W08 release gates.
310
318
 
@@ -32,9 +32,9 @@ checkPaths:
32
32
  - test/scenarios/foundry-facade-request-store.test.mts
33
33
  - test/scenarios/foundry-package-consumer.test.mts
34
34
  - docs/public-runtime-contract.md
35
- lastReviewedAt: 2026-09-10
36
- lastReviewedCommit: 063016979fec5d4879f562c417b42b73b158aafe
37
- lastReviewedNote: "Reviewed for Foundry #153: strict0.1.7 version projection from qualified managed-action source0630169 and unchanged verified CLI0.1.13/toolchain/dependency inputs. All source/native action gates passed before preparation; complete owning release and independent public successor verification remain required."
35
+ lastReviewedAt: "2026-09-14"
36
+ lastReviewedCommit: "2b80865083d1ca4dd095624090ddd1c741b5d2cd"
37
+ lastReviewedNote: "Reviewed for Foundry #167: exact helper-generated version projection advances0.1.8 to0.1.9 for canonical publish.yml provenance. Runtime, ownership, environment, authorization, CLI0.1.14 dependency and all qualification gates remain unchanged. Registry/component publication and independent install proof are still pending."
38
38
  related:
39
39
  - docs/runtime-context-contract.md
40
40
  - docs/task-authorization-contract.md
@@ -53,7 +53,7 @@ This is the implemented v1 facade protocol for `@tiangong-lca/foundry` and its `
53
53
  | `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. |
54
54
  | `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. |
55
55
  | `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. |
56
- | `tiangong-foundry task resume --workspace <path> --task <id> --actor <id> [--semantic-input <file> | --authorization-input <file>] --json` | Continue registered preparation, accept bound semantic input/approval, or execute and verify a sealed owner scope through the qualified CLI. Consumed/ambiguous mutation state is readback-only and never replayed. |
56
+ | `tiangong-foundry task resume --workspace <path> --task <id> --actor <id> [--semantic-input <file> | --authorization-input <file> | --reference-input <file>] --json` | Continue registered preparation, accept bound semantic input/approval, or execute and verify a sealed owner scope through the qualified CLI. Consumed/ambiguous mutation state is readback-only and never replayed. |
57
57
  | `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. |
58
58
 
59
59
  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.
@@ -100,7 +100,9 @@ Before the first dispatch, the batch attempt-start event durably registers an im
100
100
 
101
101
  Each owner command is dispatched once as executable plus argv with explicit authentication and `shell=false`. Commit stdout must match its contained report. A confirmed success requires the existing closeout checks and fresh independent root, owner, state, payload and reference verification. Lost or unknown responses and narrowly recognized same-identity conflicts use independent readback; known business failures remain unresolved. Recovery does not require the old write grant to remain unexpired and cannot change the original request. The CLI batch item's verified/recovered result determines success; aggregate batch completion alone is insufficient.
102
102
 
103
- Every readback gets a fresh output directory. A verified result binds the exact input, report and JSONL check hashes. Completed scopes preserve their final rows while dependent scopes are finalized again after new verified progress. Reference-only partitions use the separate canonical verification stage below; semantic changes cannot replace consumed scope rows.
103
+ Explicit native insert handoffs additionally require a matching CLI v2 execution report: exact contract canonical digest, execution id, ordered action/row identities and desired payload digests, consumed insert attempts, and successful exact readback for every action. Failed, unknown, blocked, replayed or incomplete rows cannot close the scope. After a lost response, recovery may read the original bound output's `outputs/dataset-save-draft/summary.json`; absent or invalid native evidence remains unresolved even when roots match. Recovery never dispatches another mutation or retrofits a legacy report into native consumption.
104
+
105
+ Every readback gets a fresh output directory. A verified result binds the exact input, report and JSONL check hashes, plus the native execution report when selected; later status checks rehash each fact. Completed scopes preserve their final rows while dependent scopes are finalized again after new verified progress. Reference-only partitions use the separate canonical verification stage below; semantic changes cannot replace consumed scope rows.
104
106
 
105
107
  ## Canonical reference verification
106
108
 
@@ -112,10 +114,24 @@ Success requires matching fresh stdout/report bytes and exactly one successful J
112
114
 
113
115
  Status performs local evidence verification only. Failed verification exposes `reference_verification_required` and a bound resume action for another read. A successful current result is reused without another remote query. Completion also requires every remaining write scope to have its independent owner readback. Changing an indexed report, query or check invalidates the proof and cannot preserve completed status.
114
116
 
117
+ ## Reference input
118
+
119
+ `task resume --reference-input <file>` selects `tiangong-foundry.reference-input.v1` separately from semantic input or approval. The CLI and direct JavaScript facade both reject an explicitly supplied empty reference path before task preparation or execution; only an omitted/undefined option means no new selection. The strict descriptor contains `task_id`, `actor_id`, current `rows_manifest_sha256`, `dataset_type`, `qa_reference_rows` (file/SHA-256 pairs), `intent` (one file/SHA-256 pair or null), and `review_files` (file/SHA-256 pairs). At least QA input or an intent is required. QA references apply only to Process; an intent requires its complete independently selected review-file set. Each list is bounded to 128 files, each file to 8 MiB, and the entire selection to 64 MiB. Credential paths, linked files, wrong task/actor, stale manifests, changed bytes and unused/missing review selections fail before snapshot publication.
120
+
121
+ The existing task artifact transaction records a fresh immutable generation. QA and review bytes are copied exactly; the original descriptor/intent bytes are retained. The derived intent rewrites only review file locators to the independently checked task snapshots. That derived file has its own raw SHA-256 and is the file the qualified CLI verifies. It grants no permission. Identical submissions reuse the current selection. Concurrent replacement is checked under the task lock; prepared, consumed and completed owner scopes cannot replace their reference evidence. Removing the original selected files does not remove the snapshots needed for execution/recovery.
122
+
123
+ Selection invalidates prior finalization/approval projection through the recorded reference-selection digest. Finalization uses only current indexed snapshots and requires the selected dataset's current row bytes to match its original control binding; changed rows require fresh selection. Process QA receives explicit repeated `--reference-rows-file` arguments. Precommit verification receives exactly the derived `--reference-intent-file`; default canonical-reference and root policies remain owned by the CLI. Its [exact-reference protocol](https://github.com/tiangong-lca/tiangong-cli/blob/main/docs/agents/exact-reference-intent-contract.md) owns consumer/actor/content/review eligibility. Foundry does not infer units, discover sibling files or create a reference exception itself.
124
+
125
+ Sealing obtains a fresh qualified CLI identity after local handoff preparation and performs complete capsule admission against the current grant and evidence. Before an unconsumed write, the workflow obtains a new current identity between initial rehydration and the final complete admission pass, so prior local work does not age that receipt. Both passes and the existing 60-second identity bound remain enforced before the attempt is consumed.
126
+
127
+ 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.
128
+
115
129
  ## Authorization input
116
130
 
117
131
  `--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.
118
132
 
133
+ For `input_kind=final_rows` with Flow, Process or Source, the descriptor may also select `execution_contract: { "file": "<path>", "sha256": "<64 lowercase hex>" }`. This is the CLI's `dataset-save-draft-execution-contract.v1` insert-only contract, with owner draft state 0, the current project/account, and exactly the ordered final rows and desired payload digests. It grants no permission. The runtime captures a content-addressed task-owned snapshot through the existing artifact transaction before admission; later execution uses that indexed snapshot even if the original selected file is removed. The contract shares the descriptor's file/privacy/size checks. Both command bindings retain final rows and contract bytes; the CLI's canonical parsed-contract digest is recorded separately from the raw file hash. Invalid explicit selection never falls back to a legacy writer. Other dataset types and prepared-row selection cannot use this field.
134
+
119
135
  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.
120
136
 
121
137
  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.
@@ -177,7 +193,7 @@ Every facade revision also rechecks all retained predecessors in its request cha
177
193
 
178
194
  ## Runtime selection and migration seam
179
195
 
180
- 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.13 constraint remains explicit rather than silently accepting a future version.
196
+ 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.14 constraint remains explicit rather than silently accepting a future version.
181
197
 
182
198
  `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.
183
199
 
@@ -40,9 +40,9 @@ 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-09-10
44
- lastReviewedCommit: 063016979fec5d4879f562c417b42b73b158aafe
45
- lastReviewedNote: "Reviewed for Foundry #153: strict0.1.7 version projection from qualified managed-action source0630169 and unchanged verified CLI0.1.13/toolchain/dependency inputs. All source/native action gates passed before preparation; complete owning release and independent public successor verification remain required."
43
+ lastReviewedAt: "2026-09-14"
44
+ lastReviewedCommit: "2b80865083d1ca4dd095624090ddd1c741b5d2cd"
45
+ lastReviewedNote: "Reviewed for Foundry #167: exact helper-generated version projection advances0.1.8 to0.1.9 for canonical publish.yml provenance. Runtime, ownership, environment, authorization, CLI0.1.14 dependency and all qualification gates remain unchanged. Registry/component publication and independent install proof are still pending."
46
46
  related:
47
47
  - docs/architecture.md
48
48
  - docs/task-authorization-contract.md
@@ -64,11 +64,11 @@ The public task facade delegates sealed owner execution to `foundry-workflow-exe
64
64
 
65
65
  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
66
 
67
- `qualifyFoundryRuntime` compares an independently selected CLI expectation with the exact installed `@tiangong-lca/cli@0.1.13` 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.
67
+ `qualifyFoundryRuntime` compares an independently selected CLI expectation with the exact installed `@tiangong-lca/cli@0.1.14` 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.
68
68
 
69
69
  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.
70
70
 
71
- `execution-context.schema.json` describes the content-addressed child handoff stored under `evidence/executions/`. It is distinct from the older offline `foundry-execution-capsule-stage.v1` admission ledger: the older contract proves immutable staged evidence and attempt state, while `tiangong-foundry.execution-context.v1` binds a current task invocation. Rehydration requires a fresh process-local context, qualification and identity; exact workspace/task/actor, approved source ancestry, current final-row bytes, active authorization and QA waivers, installed owner CLI, owner-draft argv semantics, task-contained output root and CommandSpec digest are rechecked. The action list must match the CLI operation. Serialized admissions, unrelated CLI commands and changed capsule/spec/input bytes fail closed.
71
+ `execution-context.schema.json` describes the content-addressed child handoff stored under `evidence/executions/`. It is distinct from the older offline `foundry-execution-capsule-stage.v1` admission ledger: the older contract proves immutable staged evidence and attempt state, while `tiangong-foundry.execution-context.v1` binds a current task invocation. Rehydration requires a fresh process-local context, qualification and identity; exact workspace/task/actor, approved source ancestry, current final-row bytes, active authorization and QA waivers, installed owner CLI, owner-draft argv semantics, task-contained output root and CommandSpec digest are rechecked. The action list must match the CLI operation. A native insert selection admits exactly the final-row and execution-contract artifacts, with the contract independently selected from the current task index. The internal `dataset-workflow-native-contract` operation records the control snapshot without changing source-row ancestry. Native Flow/Process/Source admission revalidates the contract against the current owner, project, state 0 and ordered rows before invoking the public CLI `dataset save-draft --execution-contract`; arbitrary extra artifacts remain invalid. An explicit reference selection additionally binds exactly one intent, its passing precommit report and the complete review artifact set. Each must be independently selected by the current host and retain its indexed bytes; admission rechecks current consumer content, actor/project and evidence correspondence through the existing handoff adapter. This transport adds no eligibility policy or write authority. Serialized admissions, unrelated CLI commands and changed capsule/spec/input bytes fail closed.
72
72
 
73
73
  ## Root ownership
74
74
 
@@ -138,3 +138,7 @@ Workflow generation and scratch directories use task-confined cryptographic name
138
138
  The native validation adapter also allocates a cryptographically named exclusive staging directory beside its selected output. This keeps atomic same-filesystem replacement and cancellation cleanup available at deep Windows task paths. Failed or cancelled validation preserves the previous output; successful validation publishes the complete new report set.
139
139
 
140
140
  Managed command continuations retain the original verified launch id through the CLI manager, preserving its workspace access and runtime-target policy in the next process. The content-addressed public manifest snapshot is recomputable cache data outside runtime/workspace roots; its path grants no trust or task permission. The existing digest, inventory, qualification, current identity, authorization and no-replay checks run again before qualified owner execution.
141
+
142
+ 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.
143
+
144
+ 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.
@@ -29,9 +29,9 @@ 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-09-09
33
- lastReviewedCommit: fa219ecc833c0aad9bb6a3661265a57f8f24a814
34
- lastReviewedNote: "Reviewed for Foundry #147: adopt independently verified CLI 0.1.13 at b5e2092 with original permission-preserving bootstrap scripts. Exact runtime/schema/package/release expectations advance together; other dependencies, TIDAS, profile rules, task authorization and private no-replay evidence remain unchanged."
32
+ lastReviewedAt: 2026-09-11
33
+ lastReviewedCommit: abc7672f3b3a806caa4219ab5b797f1d92421926
34
+ lastReviewedNote: "Reviewed for #122: explicit task reference snapshots, CLI 0.1.14 QA/intent transport, sealed admission/readback evidence and no-replay recovery. Existing profile, permission, environment and historical delivery boundaries remain enforced."
35
35
  related:
36
36
  - docs/architecture.md
37
37
  - docs/safety-policy.md
@@ -56,7 +56,7 @@ The extended public workflow may authenticate for read-only identity preflight a
56
56
 
57
57
  The public facade accepts explicit approval selection through `--authorization-input`, whose descriptor/schema is owned by `public-runtime-contract.md`. Finalization supplies reviewable bindings and current input digests, never an issued grant. Registration uses an internal current-state check under its metadata lock before activation, so an approval for an older finalization cannot replace current state. The existing expected-previous-pointer compare-and-swap remains mandatory.
58
58
 
59
- Ready final-row approval rebuilds the existing commit handoff and seals a capsule without dispatching it. Host evidence selections remain independent of grant text, and evidence paths are canonical. Prepared-row approval is continued through current-grant re-finalization and the existing derived-grant helper. Activation uses its returned pointer guard; sealing retains the original approved ancestor. Interrupted post-activation capture verifies the active grant against that original approval before recovering. A registered or sealed report does not relax fresh identity/admission checks or clear consumed attempts.
59
+ Ready final-row approval rebuilds the existing commit handoff and seals a capsule without dispatching it. Host evidence selections remain independent of grant text, and evidence paths are canonical. Prepared-row approval is continued through current-grant re-finalization and the existing derived-grant helper. Activation uses its returned pointer guard; sealing retains the original approved ancestor. Interrupted post-activation capture verifies the active grant against that original approval before recovering. A registered or sealed report does not relax fresh identity/admission checks or clear consumed attempts. An optional native execution contract selected for final Flow, Process or Source rows is an independently hashed control input, not a grant. Handoff and admission bind its immutable task snapshot alongside final rows and recheck insert-only owner/project/state/action intent. The qualified CLI retains native attempt and transaction ownership; completion requires its matching execution receipt plus independent root verification.
60
60
 
61
61
  The exact v1 binding contains `workspace_id`, `task_id`, `actor_id`, `project_ref`, `user_id`, `profile_id`, `profile_sha256`, and `input_scope_sha256`. The profile digest is the stable, key-sorted JSON digest of the selected raw rule profile. Input scope is independently frozen by the task host; it must prove current source bytes and downstream lineage, rather than copying the digest from the grant. At a row-consuming permission boundary it is the SHA-256 of that exact input file; commit handoff checks the final-row artifact bytes again. A transformed row file needs a newly bound grant supported by the retained task approval and verified lineage, never silent reuse of the old digest. A binding mismatch invalidates every exception in that grant.
62
62
 
@@ -129,3 +129,7 @@ This contract does not edit old locks, task inputs, checkpoints, sealed attempts
129
129
  Read-only or pending workspace contexts cannot register/derive authorization or admit a business command. After activation, preserved migration scope is checked at execution-capsule creation and before/after admission revalidation. A fresh grant does not reset retained attempt authority. Original profile/account/approval files remain archived evidence, while new permission still needs the independently selected current identity, exact input lineage and reviewed scope.
130
130
 
131
131
  For public prepared FP/UG input, a captured finalization blocked solely by the support permission gate may derive the existing complete support approval through registered input lineage, then rerun local finalization on those exact approved bytes. Missing write/mint actions and unrelated blockers remain pending. This adds no permission, extends no expiry and cannot replay a consumed scope.
132
+
133
+ 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.
134
+
135
+ 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.