<!-- event: create author: "yoi ticket" at: 2026-06-10T07:19:31Z -->

## 作成

LocalTicketBackend によって作成されました。

---

<!-- event: plan author: intake at: 2026-06-10T07:41:20Z -->

## Plan

## Intake refinement

Readiness: `implementation_ready`。

重複確認: `.yoi/tickets` 内で `profile.import` / `import/extend` / global `yoi` に関する未完了の重複 Ticket は見つからなかった。

Open questions: blocking な未決定点はない。`require("yoi")` / `require("yoi.*")` を互換 alias として残すか非推奨にするかは、Ticket 本文どおり実装時に整理し、テストで固定する implementation latitude として扱う。

Risk flags / reviewer focus: `profile-api`, `authority-boundary`, `sandbox-module-loading`, `backward-compat`, `packaging-resource`。

Orchestrator routing: queued 後は implementation に進めてよい。実装では Lua Profile sandbox の global 注入、builtin/raw Profile artifact import、extend merge semantics、validation boundary、bundled `resources/profiles/default.lua` 更新、manifest crate テストを一体で確認すること。

---

<!-- event: intake_summary author: intake at: 2026-06-10T07:41:26Z -->

## Intake summary

既存 Ticket 00001KTR6D3C5 を確認し、Lua Profile の global `yoi` API 注入、`yoi.profile.import/extend`、deep merge semantics、Profile validation boundary、default.lua 移行、local require 維持、manifest crate tests まで受け入れ条件が揃っていると判断した。blocking open question はない。`require("yoi")` / `require("yoi.*")` の扱いは実装時に固定する implementation latitude。主な risk flags は profile-api / authority-boundary / sandbox-module-loading / backward-compat / packaging-resource。

---

<!-- event: state_changed author: intake at: 2026-06-10T07:41:26Z from: planning to: ready reason: planning_ready field: state -->

## State changed

Intake により implementation_ready と判断したため、state を ready にする。実装開始は panel による ready -> queued と Orchestrator routing に委ねる。

---

<!-- event: state_changed author: workspace-panel at: 2026-06-10T08:04:05Z from: ready to: queued reason: queued field: state -->

## State changed

Ticket を `workspace-panel` が queued にしました。


---

<!-- event: state_changed author: orchestrator at: 2026-06-10T09:32:26Z from: queued to: inprogress reason: orchestrator_queue_acceptance field: state -->

## State changed

Queue acceptance: relation query has no blockers, existing orchestration plan only has the prior human-gate waiting note, workspace is clean, and user explicitly requested continuing inprogress/queued consumption. Implementation side effects will proceed in a dedicated worktree/branch with review before merge-completion.

---

<!-- event: plan author: orchestrator at: 2026-06-10T09:32:26Z -->

## Plan

Routing decision: implementation_ready

Reason:
- Ticket is `queued`, relation query has no blockers, and existing orchestration plan only contains a prior human-gate waiting note.
- User explicitly requested continuing inprogress/queued work; this satisfies the prior human gate.
- The Ticket contains clear binding requirements, acceptance criteria, non-goals, and reviewer focus.

Evidence checked:
- Ticket body/thread/artifacts.
- `TicketRelationQuery`: no relations/blockers.
- `TicketOrchestrationPlanQuery`: one waiting note from prior target-unspecified routing pass.
- Current workspace state is clean; existing inprogress worktrees use separate branches/scopes.
- Code map target: `crates/manifest/src/profile.rs`, Lua Profile helper/builtin loading paths, `resources/profiles/default.lua`, and manifest crate profile tests.

IntentPacket:
- Intent: make reusable Lua Profiles feel like a small DSL by injecting global `yoi` helpers and adding raw Profile artifact import/extend composition.
- Binding decisions / invariants: Profiles remain Lua-first reusable recipes only; import/extend must not import resolved runtime Manifest or allow runtime-bound/concrete authority fields; final artifact still goes through existing Profile validation; project-local `require("_base")` keeps working; no tombstone/nil deletion semantics in this Ticket; bundled default Profile moves to global `yoi` style.
- Requirements / acceptance criteria: filesystem and embedded Profiles can access global `yoi`; `yoi.profile.import("builtin:default")` returns a raw Profile artifact; `yoi.profile.extend("builtin:default", overrides)` deep-merges nested tables while replacing scalars/lists; validation rejects runtime-bound or concrete authority contamination; require alias handling is fixed by tests; manifest targeted tests pass.
- Implementation latitude: decide whether legacy `require("yoi")` / `require("yoi.*")` aliases remain supported or are deprecated, but fix the behavior in tests; local organization and helper names may vary if the public `yoi.profile.import/extend` surface is preserved.
- Escalate if implementation requires changing Profile authority boundaries, permitting resolved Manifest import, changing runtime startup semantics, or adding deletion/tombstone semantics.
- Validation: `cargo fmt`, `cargo test -p manifest profile --lib` or narrower named tests plus broader manifest tests, `target/debug/yoi ticket doctor`, and `nix build .#yoi` before merge because runtime resources/Profile evaluation/package resources are touched.

---

<!-- event: implementation_report author: orchestrator at: 2026-06-10T09:36:53Z -->

## Implementation report

Implementation report

Branch/worktree: `lua-profile-yoi-api` / `.worktree/lua-profile-yoi-api`
Commit:
- `4e1a08c2 feat: add yoi profile lua api`

Summary:
- Injected global `yoi` into Lua Profile evaluation so filesystem and embedded Profiles can use `yoi.profile`, `yoi.models`, `yoi.compact`, and `yoi.scope` without local `require` boilerplate.
- Changed `yoi.profile`/`require("yoi.profile")` into a callable table, preserving legacy `local profile = require("yoi.profile"); return profile { ... }` behavior while adding `yoi.profile.import` and `yoi.profile.extend`.
- Added `yoi.profile.import("builtin:default")` for raw builtin Profile artifact import and `yoi.profile.extend("builtin:default", overrides)` with recursive object merge and scalar/list replacement semantics.
- Kept final resolved artifact behind existing reusable Profile validation; an extend override containing runtime-bound `pod` is rejected.
- Updated bundled `resources/profiles/default.lua` to global `yoi` style.
- Added tests for import/extend, validation boundary, host modules/local require, and builtin default evaluation.

Validation run in branch:
- `cargo fmt`
- `cargo test -p manifest global_yoi_import_and_extend_builtin_profile --lib` passed.
- `cargo test -p manifest global_yoi_extend_keeps_profile_validation_boundary --lib` passed.
- `cargo test -p manifest host_modules_and_local_require_work --lib` passed.
- `cargo test -p manifest builtin_default_resolves_without_external_evaluator --lib` passed.
- `cargo check -p manifest` passed.
- `git diff --check` passed.

Notes:
- `nix build .#yoi` not yet run on this branch; Orchestrator should run it before merge because runtime resources/Profile evaluation/package resources are touched.
- Import support is currently explicit for `builtin:default`; broad user/project selector import can be added as a follow-up if desired, but this covers the requested builtin composition surface and preserves authority boundaries.

---

<!-- event: review author: reviewer-lua-profile-yoi-api at: 2026-06-10T09:53:05Z status: approve -->

## Review: approve

Branch-local review verdict: approve

Blockers: none.

Evidence:
- Diff from `develop` merge-base touches only `crates/manifest/src/profile.rs` and `resources/profiles/default.lua`.
- Global `yoi` is available for filesystem and embedded builtin Profiles.
- `require("yoi")`, `require("yoi.profile")`, `require("yoi.models")`, and local `require("shared")` behavior are covered by tests and preserved.
- `yoi.profile.import("builtin:default")` evaluates the builtin default Lua as a raw Profile artifact, not a resolved Manifest.
- `yoi.profile.extend("builtin:default", overrides)` recursively merges objects and replaces non-object values; final artifacts still pass through existing Profile validation.
- Runtime-bound field contamination is rejected by a `pod` override test; existing validation tests continue covering `scope.allow` / `scope.deny` and absolute path boundaries.
- Bundled `resources/profiles/default.lua` uses global `yoi` style.

Validation run by reviewer:
- `cargo test -p manifest profile --lib` passed (22 passed).
- `cargo check -p manifest` passed.
- `git diff --check $(git merge-base HEAD develop)..HEAD` passed.
- `nix build .#yoi` passed.

Non-blocking notes:
- Import/extend currently supports `builtin:default` and alias `default`; this matches the recorded known scope note.
- List replacement does not have a dedicated assertion, but implementation treats JSON arrays as non-object values and therefore replaces them.

This is branch-local review evidence; final main-branch approval/close belongs to merge-completion.

---

<!-- event: review author: orchestrator at: 2026-06-10T09:55:10Z status: approve -->

## Review: approve

Main-branch review/merge-completion approval.

Verified before merge:
- Branch-local reviewer approved with no blockers.
- Merge target matched branch `lua-profile-yoi-api` / worktree `.worktree/lua-profile-yoi-api` and implementation commit `4e1a08c2`.
- Diff touches `crates/manifest/src/profile.rs` and `resources/profiles/default.lua` as expected.

Merged:
- `git merge --no-ff lua-profile-yoi-api -m "merge: lua profile yoi api"`
- Merge commit: `15dc176e merge: lua profile yoi api`

Post-merge validation:
- `cargo fmt --check` passed.
- `git diff --check` passed.
- `cargo test -p manifest profile --lib` passed (22 passed).
- `cargo check -p manifest` passed.
- `target/debug/yoi ticket doctor` passed.
- typed `TicketDoctor` reported 0 errors and 3 pre-existing diagnostics.
- `nix build .#yoi` passed.

Result: approve.

---

<!-- event: state_changed author: orchestrator at: 2026-06-10T09:55:10Z from: inprogress to: done reason: merged_and_validated field: state -->

## State changed

Merged branch `lua-profile-yoi-api` with merge commit `15dc176e`; branch-local review approved and post-merge validation passed (`cargo fmt --check`, `git diff --check`, `cargo test -p manifest profile --lib`, `cargo check -p manifest`, `target/debug/yoi ticket doctor`, `nix build .#yoi`).

---

<!-- event: state_changed author: hare at: 2026-06-10T09:55:23Z from: done to: closed reason: closed field: state -->

## State changed

Ticket を closed にしました。


---

<!-- event: close author: hare at: 2026-06-10T09:55:23Z status: closed -->

## 完了

完了しました。

実施内容:
- Lua Profile evaluator に global `yoi` を注入しました。
- `yoi.profile` / `require("yoi.profile")` は callable table になり、既存の `local profile = require("yoi.profile"); return profile { ... }` 互換を保ちながら `import` / `extend` を提供します。
- `yoi.profile.import("builtin:default")` は resolved Manifest ではなく raw builtin Profile artifact を返します。
- `yoi.profile.extend("builtin:default", overrides)` は object を再帰 merge し、scalar/list など non-object は置換します。
- 最終 artifact は既存 Profile validation に通され、runtime-bound field（例: `pod`）の混入は reject されます。
- `resources/profiles/default.lua` を global `yoi` style に更新しました。

Merge:
- Branch: `lua-profile-yoi-api`
- Merge commit: `15dc176e merge: lua profile yoi api`

確認:
- Branch-local reviewer `reviewer-lua-profile-yoi-api` が approve。
- `cargo fmt --check` passed。
- `git diff --check` passed。
- `cargo test -p manifest profile --lib` passed（22 passed）。
- `cargo check -p manifest` passed。
- `target/debug/yoi ticket doctor` passed。
- typed `TicketDoctor` は 0 errors / 3 pre-existing diagnostics。
- `nix build .#yoi` passed。

残作業:
- なし。import/extend は現時点では `builtin:default` / `default` に限定しています。より広い user/project selector import が必要なら follow-up Ticket として扱えます。

---
