feat: use builtin profile by default
This commit is contained in:
@@ -61,7 +61,7 @@ path = "profiles/coder.nix"
|
||||
description = "Project coding assistant"
|
||||
```
|
||||
|
||||
Relative registry paths are resolved against the `profiles.toml` file that declares them. Discovery checks bundled builtin profiles, then the user registry at `<config_dir>/profiles.toml`, then the nearest project registry at `.insomnia/profiles.toml`. Later defaults override earlier defaults, so a project default wins over a user default. Unqualified defaults resolve within the declaring source by default. Unqualified ambiguous names fail closed:
|
||||
Relative registry paths are resolved against the `profiles.toml` file that declares them. Discovery checks bundled builtin profiles, then the user registry at `<config_dir>/profiles.toml`, then the nearest project registry at `.insomnia/profiles.toml`. The bundled `builtin:default` profile is the fallback default when no user/project registry declares another default. Later defaults override earlier defaults, so a project default wins over a user default, and either wins over the builtin default. Unqualified defaults resolve within the declaring source by default. Unqualified ambiguous names fail closed:
|
||||
|
||||
```sh
|
||||
insomnia --profile coder # fails if both user:coder and project:coder exist
|
||||
@@ -69,7 +69,13 @@ insomnia --profile project:coder # source-qualified selection
|
||||
insomnia --profile default # selected registry default
|
||||
```
|
||||
|
||||
The fresh-spawn TUI also uses discovery. If a default profile is configured, the new Pod dialog shows a selectable source-qualified profile row such as `profile: project:coder (default)`. `Tab`/`Down` cycles forward through discovered profiles, `Shift-Tab`/`Up` cycles backward, and the `manifest cascade` choice opts out of a default profile for that spawn. Passing `insomnia --profile <selector>` opens the same new Pod dialog with that selector selected and leaves Pod-name editing unchanged.
|
||||
The fresh-spawn TUI also uses discovery. The new Pod dialog defaults to the selected registry default, normally `builtin:default` unless a user/project registry overrides it. `Tab`/`Down` cycles forward through discovered profiles and `Shift-Tab`/`Up` cycles backward; there is no ambient manifest-cascade opt-out. Passing `insomnia --profile <selector>` opens the same new Pod dialog with that selector selected and leaves Pod-name editing unchanged.
|
||||
|
||||
## One-file manifests
|
||||
|
||||
`insomnia-pod --manifest <PATH>` remains as an explicit compatibility/debug path. It reads exactly that TOML file, resolves relative paths against the file's parent directory, merges builtin defaults, and validates through the same `PodManifestConfig -> PodManifest` boundary as profile artifacts. It does not load user or project `manifest.toml` files and conflicts with `--profile`.
|
||||
|
||||
Ambient user/project `manifest.toml` cascade startup has been removed. Normal fresh spawns use profile discovery/default selection, with `profiles.toml` acting only as a profile registry/default selector.
|
||||
|
||||
## Artifact contract
|
||||
|
||||
@@ -79,7 +85,7 @@ A profile should evaluate to one of:
|
||||
- `{ profile = { format = "insomnia.nix-profile.v1"; ... }; config = { ... }; }`
|
||||
- a raw manifest/config object for debug/test paths.
|
||||
|
||||
The `manifest`/`config` object uses the same field names as the existing manifest config. Relative paths are resolved against the directory containing the profile file, then builtin defaults are merged and validation produces the runtime `PodManifest`.
|
||||
The resolved artifact is deserialized into the same `PodManifestConfig -> PodManifest` boundary used by direct one-file manifests, so builtin defaults and required-field validation stay shared. Explicit profile paths and user/project registry profile artifacts resolve relative manifest paths against the profile file's directory. Builtin profile artifacts resolve manifest-relative paths against the launch workspace/current directory so the bundled default can grant `scope.allow target = "."` for the workspace rather than for `resources/nix/profiles`.
|
||||
|
||||
Secret values must stay as typed references. `resources/nix/profile-lib.nix` emits secret references as JSON like:
|
||||
|
||||
|
||||
+10
-10
@@ -3,17 +3,17 @@
|
||||
# ============================================================================
|
||||
# Pod の宣言的設定 (`PodManifest` / `PodManifestConfig`)。
|
||||
#
|
||||
# カスケード層は下から順に
|
||||
# 1. builtin defaults (`manifest::defaults`)
|
||||
# 2. user manifest (`<config_dir>/manifest.toml`)
|
||||
# 3. project manifest (cwd から上方向に探す `.insomnia/manifest.toml`)
|
||||
# 4. programmatic overlay (呼び出し側が差し込む)
|
||||
# 上の層が同名フィールドを上書き、scope rule と skills.directories は
|
||||
# 累積マージ、tool_output.per_tool は key 単位でマージ。
|
||||
# このファイル形式は低レベル runtime manifest。通常起動は profile discovery/default
|
||||
# (`profiles.toml` と bundled builtin profile) から manifest を生成する。
|
||||
# `insomnia-pod --manifest <path>` の one-file compatibility/debug mode では、
|
||||
# 指定した TOML 1 枚に builtin defaults を merge し、required validation を行う。
|
||||
# user/project `manifest.toml` を暗黙に merge する通常起動 cascade は使わない。
|
||||
#
|
||||
# パス解決: 相対パスは「その層の manifest ファイルが置かれているディレクトリ」
|
||||
# を base に絶対パスへ解決される (overlay 層は cwd)。マージは絶対化済みの
|
||||
# 値同士で行われる。
|
||||
# `PodManifestConfig` の merge 規則: 上の層が同名フィールドを上書き、scope rule と
|
||||
# skills.directories は累積マージ、tool_output.per_tool は key 単位でマージ。
|
||||
#
|
||||
# パス解決: `--manifest <path>` では相対パスはその manifest ファイルの親ディレクトリ
|
||||
# を base に絶対パスへ解決される。profile artifact でも同じ validation 境界を通る。
|
||||
#
|
||||
# 凡例:
|
||||
# - 必須 … 値が無いと resolve エラー
|
||||
|
||||
+2
-2
@@ -43,11 +43,11 @@ The Nix package does not put user configuration, sessions, sockets, or other mut
|
||||
|
||||
| Purpose | Override | `INSOMNIA_HOME` fallback | XDG / default fallback |
|
||||
| --- | --- | --- | --- |
|
||||
| User config (`manifest.toml`, prompt overrides, model/provider overrides) | `INSOMNIA_CONFIG_DIR` | `$INSOMNIA_HOME/config` | `$XDG_CONFIG_HOME/insomnia`, then `$HOME/.config/insomnia` |
|
||||
| User config (`profiles.toml`, prompt overrides, model/provider overrides) | `INSOMNIA_CONFIG_DIR` | `$INSOMNIA_HOME/config` | `$XDG_CONFIG_HOME/insomnia`, then `$HOME/.config/insomnia` |
|
||||
| Persistent data (`sessions/`, Pod metadata) | `INSOMNIA_DATA_DIR` | `$INSOMNIA_HOME` | `$HOME/.insomnia` |
|
||||
| Runtime state (sockets, lock files, live registry) | `INSOMNIA_RUNTIME_DIR` | `$INSOMNIA_HOME/run` | `$XDG_RUNTIME_DIR/insomnia`, then `$HOME/.insomnia/run` |
|
||||
|
||||
`INSOMNIA_USER_MANIFEST=<path>` can still be used to select an explicit user manifest for the Pod CLI cascade path. Project manifests are still discovered from `.insomnia/manifest.toml` under the current workspace unless a CLI mode documents otherwise.
|
||||
Normal fresh startup is profile-based. The package ships a builtin default profile, user/project `profiles.toml` files may select or define profiles, and `insomnia-pod --manifest <PATH>` remains a one-file compatibility/debug input. `INSOMNIA_USER_MANIFEST` and ambient `.insomnia/manifest.toml` discovery are not part of normal Pod/TUI startup.
|
||||
|
||||
## Validation
|
||||
|
||||
|
||||
+8
-16
@@ -337,42 +337,34 @@ import-map 形式のプレフィックスで指定する:
|
||||
|
||||
## `insomnia-pod` CLI
|
||||
|
||||
`insomnia-pod` は通常、builtin default → user manifest → project manifest → overlay の cascade で manifest を解決して起動する。
|
||||
`insomnia-pod` の通常起動は profile discovery/default から runtime manifest を作る。user/project `manifest.toml` の ambient cascade は通常起動では使わない。
|
||||
|
||||
```
|
||||
insomnia-pod [--project <path>] [--overlay <toml>] [-s/--store <path>] [--session <uuid>]
|
||||
insomnia-pod [--profile <selector>] [--profile-pod-name <name>] [-s/--store <path>] [--session <uuid>]
|
||||
```
|
||||
|
||||
| フラグ | 説明 |
|
||||
|---|---|
|
||||
| `--project <path>` | プロジェクト manifest 探索の起点。省略時は cwd から上方向に `.insomnia/manifest.toml` を探索 |
|
||||
| `--overlay <toml>` | 最上層の overlay を inline TOML 文字列で渡す(例: `--overlay 'worker.instruction = "$user/foo"'`) |
|
||||
| `--profile <selector>` | builtin/user/project profile registry から Nix profile を選択。省略時は registry default(通常は `builtin:default`) |
|
||||
| `--profile-pod-name <name>` | profile 由来 manifest の `pod.name` を fresh spawn 用に上書き |
|
||||
| `--overlay <toml>` | TUI/launcher compatibility 用の inline override。user/project manifest discovery は行わない |
|
||||
| `-s, --store <path>` | セッション永続化ディレクトリ(デフォルト: `<data_dir>/sessions/`、`manifest::paths` で解決) |
|
||||
| `--session <uuid>` | 既存 session id から Pod を復元し、同じ jsonl に後続 turn を追記する |
|
||||
|
||||
user manifest は CLI フラグではなく、以下の規則で解決する。
|
||||
|
||||
| 入力 | 挙動 |
|
||||
|---|---|
|
||||
| `INSOMNIA_USER_MANIFEST=<path>` | 指定 path を user manifest として読む。ファイル不在や parse error は起動エラー |
|
||||
| `INSOMNIA_USER_MANIFEST=` | 空文字列は未指定扱い |
|
||||
| env 未指定 | `manifest::paths::user_manifest_path()` で自動探索し、存在すれば読む |
|
||||
|
||||
単一ファイルだけで起動したい場合は cascade を使わず、`--manifest` を指定する。
|
||||
単一ファイルだけで起動したい場合は `--manifest` を指定する。
|
||||
|
||||
```
|
||||
insomnia-pod --manifest <path> [-s/--store <path>] [--session <uuid>]
|
||||
```
|
||||
|
||||
`--manifest` は指定 TOML 1 枚だけを `PodManifest::from_toml` で読み、user / project / overlay layer は一切読まない。したがって `--project`、`--overlay`、非空の `INSOMNIA_USER_MANIFEST` とは併用不可。
|
||||
`--manifest` は指定 TOML 1 枚だけを読み、builtin defaults を merge したうえで `PodManifestConfig -> PodManifest` の required validation を通す。user / project manifest layer は読まない。`--profile`、`--project`、`--overlay` とは併用不可。
|
||||
|
||||
spawn 子 Pod 用の内部フラグとして `--adopt` と `--callback <path>` がある。これらは `SpawnPod` が scope allocation と親 callback socket を引き継がせるために使うもので、通常の手動起動では使わない。
|
||||
|
||||
Pod の作業ディレクトリは `insomnia-pod` 起動時の cwd が直接使われる。別ディレクトリで
|
||||
動かしたい場合は `cd <path> && insomnia-pod ...` のように外側で `cd` してから起動する。
|
||||
|
||||
引数無しで起動すると、cwd + `manifest::paths` の自動解決だけで動く最小構成になる
|
||||
(overlay 無し、プロジェクトに `.insomnia/manifest.toml` があればそれを使う)。
|
||||
引数無しで起動すると、profile registry default(通常は bundled `builtin:default`)で起動する。
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user