4.3 KiB
4.3 KiB
| title | state | created_at | updated_at | assignee | queued_by | queued_at |
|---|---|---|---|---|---|---|
| Lua Profileに組み込みyoi APIとimport/extendを追加する | closed | 2026-06-10T07:19:31Z | 2026-06-10T09:55:23Z | null | workspace-panel | 2026-06-10T08:04:05Z |
背景
Lua Profile では現在、標準 API を使うたびに require("yoi.profile") / require("yoi.scope") / require("yoi.compact") などを明示している。標準 API は sandbox 内で host が与える組み込み surface なので、Profile 実行時に最初から yoi object を global として注入し、すべて yoi.* 経由でアクセスできる形に整理したい。
また、builtin Profile は registry selector としては builtin:default を選べるが、Lua Profile 内から import して上書き・再 export する標準経路がない。project-local の .yoi/profiles/_base.lua に function を置いて各 Profile から require("_base") する運用はできるが、builtin base Profile を再利用する API ではない。
要件
- Lua Profile 実行環境に global
yoiobject を注入する。 - 標準 API は
yoi.profile/yoi.scope/yoi.compact/yoi.modelsのように、単一のyoiobject 配下から利用できる。 yoi.profileはyoi.profile { ... }と呼べる callable な表現にしつつ、Profile 操作用 helper を持てる形にする。- builtin / registry Profile を Lua Profile 内から reusable Profile artifact として import できる API を追加する。
- 例:
yoi.profile.import("builtin:default") - import 対象は resolved Manifest ではなく、workspace/runtime 解決前の raw Profile artifact とする。
- 例:
- import した Profile artifact に対して override を適用し、Profile として再 export できる API を追加する。
- 例:
return yoi.profile.extend("builtin:default", { slug = "coder", worker = { language = "Japanese" } }) - 例:
local base = yoi.profile.import("builtin:default"); return yoi.profile.extend(base, { ... })
- 例:
- merge semantics を明示して実装する。
- object/table は再帰的に merge する。
- scalar は override する。
- array/list は replace する。
nilによる削除 semantics はこのチケットでは導入しない。
- import/extend 後の最終 artifact に対して、既存の Profile validation を維持する。
pod、complete Manifest 形状、concretescope.allow/scope.deny、resolved absolute path などは禁止のまま。
- bundled
resources/profiles/default.luaはrequire("yoi.*")ではなく globalyoistyle に更新する。 - project-local module composition のための local
require("...")は維持する。 require("yoi")/require("yoi.*")の扱いを整理する。- 互換 alias として当面残すか、明示的に非推奨化するかを実装時に判断し、テストで固定する。
受け入れ条件
resources/profiles/default.luaがlocal profile = require("yoi.profile")などを使わず、globalyoiだけで評価できる。- filesystem Profile でも embedded builtin Profile でも、global
yoiAPI が利用できる。 - Lua Profile で
yoi.profile.import("builtin:default")または同等の API により builtin default の raw Profile artifact を取得できる。 - Lua Profile で
yoi.profile.extend("builtin:default", overrides)または同等の API により builtin default を上書きした Profile を返せる。 - override は nested table を意図通り deep merge し、scalar と list は置換される。
- import/extend で runtime-bound field や concrete authority を混入させた場合、既存 Profile 境界に沿って reject される。
- project-local
require("_base")などは引き続き動作する。 - 新 API と既存 default Profile の評価に対する manifest crate のテストが追加・更新されている。
cargo test -p manifest profileまたは該当する targeted test が通る。target/debug/yoi ticket doctorが通る。
非目標
- resolved Manifest を Lua Profile へ import 可能にすること。
- runtime-bound な
pod.nameや concretescope.allow/scope.denyを Profile に許可すること。 - local filesystem require を builtin embedded profile の module search path と混ぜること。
nil/ tombstone による field deletion API の導入。