ticket: add plugin tool followups

This commit is contained in:
Keisuke Hirata 2026-06-16 00:00:14 +09:00
parent 425a6c66a8
commit f223bf44ce
No known key found for this signature in database
12 changed files with 357 additions and 0 deletions

View File

@ -0,0 +1,21 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KV5W3PHA",
"kind": "depends_on",
"target": "00001KV5R5V2S",
"note": "Tool surface registration consumes resolved Plugin package metadata.",
"author": "yoi ticket",
"at": "2026-06-15T14:50:28Z"
},
{
"ticket_id": "00001KV5W3PHA",
"kind": "related",
"target": "00001KSXRQ4G8",
"note": "Plugin runtime/surface/host API design record.",
"author": "yoi ticket",
"at": "2026-06-15T14:50:28Z"
}
]
}

View File

@ -0,0 +1,85 @@
---
title: 'Plugin: register enabled Tool surface from packages'
state: 'ready'
created_at: '2026-06-15T14:48:59Z'
updated_at: '2026-06-15T14:50:28Z'
assignee: null
readiness: 'implementation_ready'
risk_flags: ['plugin', 'tool-registry', 'model-visible-schema', 'capability-boundary', 'profile-config']
---
## Background
Plugin package discovery / explicit enablement resolver の次に、enabled Plugin package から Tool surface を読み取り、通常の `ToolRegistry` に登録できるようにする。
この Ticket の目的は、Plugin package 由来の Tool 定義が Yoi の既存 Tool 経路に安全に乗る境界を作ること。Plugin code execution / WASM runtime はまだ行わない。Tool が model-visible schema として見えるか、enablement なしでは出ないか、invalid / duplicate な Tool 定義が fail closed になるかを先に固める。
## Requirements
- `00001KV5R5V2S` の resolved Plugin metadata を入力として扱う。
- Enabled Plugin package の manifest から Tool surface 定義を読み取る。
- tool name
- description
- input schema
- effect / side-effect metadata
- plugin origin metadata
- Plugin Tool definition を既存 `ToolRegistry` 登録経路に載せる。
- model-visible schema は通常 Tool と同じ原則に従う。
- feature/profile config で disabled なら schema surface から消える。
- Tool metadata に Plugin origin を保持する。
- plugin id / ref
- package source: user / project / builtin
- package digest
- package version / api version
- surface: tool
- Duplicate Tool name は fail closed にする。
- builtin Tool / other Plugin Tool との衝突を検出する。
- どちらが勝つかを曖昧にしない。
- Invalid input schema / unsupported schema shape は fail closed にする。
- Package が discovered されただけでは Tool を登録しない。
- explicit enablement が必要。
- Tool call / result は後続 runtime Ticket で実装する。
- この Ticket では未実行 Tool として registration boundary を作る。
- 実行できない状態を user-visible diagnostic として安全に扱う。
- Diagnostics は bounded にする。
- registered
- skipped: not enabled
- rejected: duplicate name
- rejected: invalid schema
- rejected: unsupported surface/api
- rejected: missing runtime executor
## Acceptance criteria
- Enabled Plugin package の Tool definition が `ToolRegistry` に登録され、model-visible tools に現れる。
- Enablement がない Plugin package の Tool は model-visible tools に現れない。
- Duplicate Tool name は登録されず、diagnostic で理由が分かる。
- Invalid input schema は登録されず、diagnostic で理由が分かる。
- Registered Plugin Tool の metadata から plugin origin / digest / source が追跡できる。
- Feature/profile flag により Plugin Tool surface を非表示にできる。
- Tool call がまだ実行できない場合も panic せず、安全な unavailable/runtime-missing error になる。
- Tests cover:
- enabled package Tool registration
- package without enablement does not register
- duplicate Plugin Tool name rejected
- builtin Tool name collision rejected
- invalid schema rejected
- plugin origin metadata retained
- disabled feature/profile removes schema surface
- Validation: focused plugin/tool-registry tests, `cargo fmt --check`, relevant `cargo check` / `cargo test`, `git diff --check`.
## Non-goals
- Plugin code execution.
- WASM runtime.
- `https` / `fs` host API.
- Service / Ingress surface.
- External side effects.
- Permission grant enforcement beyond registration-time shape checks.
## Related work
- `00001KV5R5V2S` — Plugin package discovery and explicit enablement resolver.
- `00001KV5W3PHW` — Plugin Tool execution with minimal WASM runtime.
- `00001KV5W3PJ3` — Plugin permission grant enforcement.
- `00001KSXRQ4G8` — Plugin runtime / surface / host API model design.

View File

@ -0,0 +1,7 @@
<!-- event: create author: "yoi ticket" at: 2026-06-15T14:48:59Z -->
## 作成
LocalTicketBackend によって作成されました。
---

View File

@ -0,0 +1,21 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KV5W3PHW",
"kind": "depends_on",
"target": "00001KV5W3PHA",
"note": "WASM Tool runtime requires Plugin Tool surface registration.",
"author": "yoi ticket",
"at": "2026-06-15T14:50:28Z"
},
{
"ticket_id": "00001KV5W3PHW",
"kind": "related",
"target": "00001KSXRQ4G8",
"note": "Plugin runtime/surface/host API design record.",
"author": "yoi ticket",
"at": "2026-06-15T14:50:28Z"
}
]
}

View File

@ -0,0 +1,90 @@
---
title: 'Plugin: execute Plugin Tool with minimal WASM runtime'
state: 'ready'
created_at: '2026-06-15T14:48:59Z'
updated_at: '2026-06-15T14:50:28Z'
assignee: null
readiness: 'implementation_ready'
risk_flags: ['plugin', 'wasm', 'tool-runtime', 'sandbox', 'capability-boundary', 'cancellation']
---
## Background
Plugin Tool surface registration の後続として、enabled Plugin Tool を最小 WASM runtime で実行できるようにする。
この Ticket のゴールは、Plugin package を enable し、manifest 由来の Tool を model-visible に登録し、その Tool call を sandboxed WASM module に渡して bounded な Tool result として返す最小体験を作ること。`https` / `fs` host API、Service / Ingress、長時間 background process は扱わない。
## Requirements
- Registered Plugin Tool の invocation を Plugin runtime に route する。
- Minimal WASM runtime を追加する。
- module load
- tool input JSON の受け渡し
- tool output JSON の受け取り
- structured error handling
- Runtime は ambient authority を持たない。
- ambient filesystem なし
- ambient network なし
- ambient environment variables なし
- host API imports は明示的に許可されたものだけ
- この Ticket では host API import は最小にする。
- tool input / output のための必要最小限のみ。
- `https` / `fs` は実装しない。
- Bounded execution を実装する。
- timeout
- cancellation
- input size bound
- output size bound
- error/diagnostic size bound
- Invalid Plugin output は fail closed にする。
- malformed JSON
- schema mismatch
- oversize output
- non-terminating execution
- Tool call / result は通常 Tool history 経路に乗る。
- hidden context injection をしない。
- Plugin stdout/stderr 相当を無制限に history に入れない。
- Runtime error は safe structured Tool error として返す。
- panic しない。
- secret-like host path / env / raw memory dump を出さない。
- Runtime lifecycle は Pod startup / restore と整合させる。
- package digest / runtime config に基づいて deterministic に module を選ぶ。
- runtime-only mutable state に依存して Tool availability を決めない。
## Acceptance criteria
- Sample Plugin package の Tool を WASM runtime 経由で実行できる。
- Tool input JSON が WASM module に渡り、Tool output JSON が通常 Tool result として返る。
- Tool result は通常の history / permission / trace 経路に残る。
- Plugin Tool が ambient filesystem / network / env にアクセスできない。
- Timeout する Plugin execution は中断され、安全な Tool error になる。
- Oversize output / malformed output / schema mismatch は fail closed する。
- Cancellation が Worker / Tool execution の cancellation と整合する。
- Runtime diagnostics は bounded で、selected secret/path/env を漏らさない。
- Tests cover:
- successful WASM Plugin Tool execution
- malformed output rejected
- oversize output rejected
- timeout / cancellation
- missing runtime module diagnostic
- no ambient fs/network/env by default
- tool result history path remains ordinary tool result
- Validation: focused plugin runtime tests, `cargo fmt --check`, relevant `cargo check` / `cargo test`, `git diff --check`, and `nix build .#yoi` if dependencies / packaging change.
## Non-goals
- `https` host API.
- `fs` host API.
- Service surface.
- Ingress surface.
- Long-running Plugin daemon/process lifecycle.
- Plugin package manager / registry.
- Signature/trust-chain verification.
- Broad WASI surface beyond the explicitly needed imports.
## Related work
- `00001KV5R5V2S` — Plugin package discovery and explicit enablement resolver.
- `00001KV5W3PHA` — Plugin Tool surface registration.
- `00001KV5W3PJ3` — Plugin permission grant enforcement.
- `00001KSXRQ4G8` — Plugin runtime / surface / host API model design.

View File

@ -0,0 +1,7 @@
<!-- event: create author: "yoi ticket" at: 2026-06-15T14:48:59Z -->
## 作成
LocalTicketBackend によって作成されました。
---

View File

@ -0,0 +1,21 @@
{
"version": 1,
"relations": [
{
"ticket_id": "00001KV5W3PJ3",
"kind": "depends_on",
"target": "00001KV5W3PHW",
"note": "Grant enforcement must cover runtime execution path.",
"author": "yoi ticket",
"at": "2026-06-15T14:50:28Z"
},
{
"ticket_id": "00001KV5W3PJ3",
"kind": "related",
"target": "00001KSXRQ4G8",
"note": "Plugin runtime/surface/host API design record.",
"author": "yoi ticket",
"at": "2026-06-15T14:50:28Z"
}
]
}

View File

@ -0,0 +1,98 @@
---
title: 'Plugin: enforce Plugin permission grants'
state: 'ready'
created_at: '2026-06-15T14:48:59Z'
updated_at: '2026-06-15T14:50:28Z'
assignee: null
readiness: 'implementation_ready'
risk_flags: ['plugin', 'permission', 'grant-enforcement', 'capability-boundary', 'tool-execution']
---
## Background
Plugin package discovery / Tool registration / Tool runtime が揃った後、Plugin manifest の requested permissions と Profile/config 側の granted permissions を照合し、登録・実行・host API 利用の境界で fail closed にする。
この Ticket では `https` / `fs` host API の実装自体は行わない。ただし後続の host API 実装が同じ grant model を使えるよう、grant の型と enforcement point を明確にする。
## Requirements
- Plugin manifest の requested permissions を typed data として読む。
- enabled surfaces
- tool names / namespaces
- Tool effect / external_write metadata
- future host APIs: `https`, `fs`
- Profile/config 側の granted permissions を typed data として読む。
- package ref / digest / version と結びつける。
- source-qualified identity に対応する。
- Requested permissions と granted permissions を照合する。
- requested but not granted は fail closed。
- unsupported grant / unknown permission kind は fail closed。
- overly broad ambiguous grant は fail closed または明示 diagnostic。
- Enforcement points を実装する。
- Plugin package enablement resolution
- Tool surface registration
- Plugin Tool execution
- future host API call dispatch
- Tool metadata の effect を existing permission / PreToolCall path と整合させる。
- external side effect がある Tool は metadata と permission gate に反映する。
- external write は `Outbound` surface ではなく Tool metadata として扱う。
- Denied reason を diagnostic / trace で確認できるようにする。
- grant missing
- grant digest mismatch
- requested surface not granted
- requested tool not granted
- host API not granted
- external_write not granted
- Grant enforcement は model-visible context に隠し情報を差し込まない。
- Package が存在するだけ、または Tool registration だけで execution authority を得ない。
## Initial grant model guidance
最初の grant model は狭く始める。
```text
surfaces.tool
tool names / namespaces
external_write flag
host_api.https
host_api.fs
```
この Ticket では `https` / `fs` の API 実行は non-goal。ただし requested/granted の型と denied diagnostic は先に扱えるようにする。
## Acceptance criteria
- Grant なしの Plugin Tool は実行されず、safe diagnostic になる。
- Granted Tool だけが登録または実行可能になる。
- Requested surface が grant に含まれない場合は fail closed する。
- Requested external_write が grant に含まれない場合は fail closed する。
- Digest/version/source mismatch の grant は使われない。
- Unknown permission kind / unsupported grant は fail closed する。
- Denied reason が diagnostic / trace で確認できる。
- Existing PreToolCall / Tool permission path と矛盾しない。
- Tests cover:
- no grant denies Plugin Tool execution
- grant allows specific Plugin Tool
- unrelated package grant does not apply
- digest mismatch denies
- requested surface missing denies
- external_write missing denies
- unknown permission kind fails closed
- denial reason is bounded and safe
- Validation: focused plugin permission tests, `cargo fmt --check`, relevant `cargo check` / `cargo test`, `git diff --check`.
## Non-goals
- Implementing `https` host API.
- Implementing `fs` host API.
- Service / Ingress surface.
- Plugin package manager / install/update.
- Signature/trust-chain enforcement.
- Broad policy UI.
## Related work
- `00001KV5R5V2S` — Plugin package discovery and explicit enablement resolver.
- `00001KV5W3PHA` — Plugin Tool surface registration.
- `00001KV5W3PHW` — Plugin Tool execution with minimal WASM runtime.
- `00001KSXRQ4G8` — Plugin runtime / surface / host API model design.

View File

@ -0,0 +1,7 @@
<!-- event: create author: "yoi ticket" at: 2026-06-15T14:48:59Z -->
## 作成
LocalTicketBackend によって作成されました。
---