valkyria-cli 0.1.0__tar.gz
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.
- valkyria_cli-0.1.0/.gitignore +21 -0
- valkyria_cli-0.1.0/.python-version +1 -0
- valkyria_cli-0.1.0/COMMANDS.md +148 -0
- valkyria_cli-0.1.0/PKG-INFO +117 -0
- valkyria_cli-0.1.0/pyproject.toml +74 -0
- valkyria_cli-0.1.0/readme.md +96 -0
- valkyria_cli-0.1.0/src/valkyrie/__init__.py +5 -0
- valkyria_cli-0.1.0/src/valkyrie/auth/__init__.py +21 -0
- valkyria_cli-0.1.0/src/valkyrie/auth/account.py +245 -0
- valkyria_cli-0.1.0/src/valkyrie/auth/firebase_config.py +28 -0
- valkyria_cli-0.1.0/src/valkyrie/auth/login_page.py +177 -0
- valkyria_cli-0.1.0/src/valkyrie/auth/server.py +145 -0
- valkyria_cli-0.1.0/src/valkyrie/auth/tokens.py +196 -0
- valkyria_cli-0.1.0/src/valkyrie/chat/__init__.py +37 -0
- valkyria_cli-0.1.0/src/valkyrie/chat/clients.py +431 -0
- valkyria_cli-0.1.0/src/valkyrie/chat/commands.py +229 -0
- valkyria_cli-0.1.0/src/valkyrie/chat/engine.py +1458 -0
- valkyria_cli-0.1.0/src/valkyrie/chat/messages.py +108 -0
- valkyria_cli-0.1.0/src/valkyrie/chat/renderer.py +122 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/__init__.py +2 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/auth_commands.py +61 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/chat_commands.py +139 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/keys_commands.py +275 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/main.py +179 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/model_commands.py +334 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/rag_commands.py +191 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/session_commands.py +247 -0
- valkyria_cli-0.1.0/src/valkyrie/cli/setup_wizard.py +510 -0
- valkyria_cli-0.1.0/src/valkyrie/core/__init__.py +2 -0
- valkyria_cli-0.1.0/src/valkyrie/core/cards.py +55 -0
- valkyria_cli-0.1.0/src/valkyrie/core/config.py +84 -0
- valkyria_cli-0.1.0/src/valkyrie/core/console.py +122 -0
- valkyria_cli-0.1.0/src/valkyrie/core/paths.py +68 -0
- valkyria_cli-0.1.0/src/valkyrie/core/workspace.py +87 -0
- valkyria_cli-0.1.0/src/valkyrie/providers/__init__.py +23 -0
- valkyria_cli-0.1.0/src/valkyrie/providers/base.py +78 -0
- valkyria_cli-0.1.0/src/valkyrie/providers/gemini.py +141 -0
- valkyria_cli-0.1.0/src/valkyrie/providers/groq.py +102 -0
- valkyria_cli-0.1.0/src/valkyrie/providers/nvidia.py +95 -0
- valkyria_cli-0.1.0/src/valkyrie/providers/registry.py +233 -0
- valkyria_cli-0.1.0/src/valkyrie/rag/__init__.py +32 -0
- valkyria_cli-0.1.0/src/valkyrie/rag/chunker.py +75 -0
- valkyria_cli-0.1.0/src/valkyrie/rag/embeddings.py +227 -0
- valkyria_cli-0.1.0/src/valkyrie/rag/files.py +163 -0
- valkyria_cli-0.1.0/src/valkyrie/rag/pinecone_store.py +191 -0
- valkyria_cli-0.1.0/src/valkyrie/rag/pipeline.py +170 -0
- valkyria_cli-0.1.0/src/valkyrie/sessions/__init__.py +9 -0
- valkyria_cli-0.1.0/src/valkyrie/sessions/store.py +544 -0
- valkyria_cli-0.1.0/src/valkyrie/tools/__init__.py +6 -0
- valkyria_cli-0.1.0/src/valkyrie/tools/local_fs.py +423 -0
- valkyria_cli-0.1.0/src/valkyrie/tools/registry.py +100 -0
- valkyria_cli-0.1.0/src/valkyrie/tools/web_search.py +73 -0
- valkyria_cli-0.1.0/src/valkyrie/vault/__init__.py +26 -0
- valkyria_cli-0.1.0/src/valkyrie/vault/crypto.py +119 -0
- valkyria_cli-0.1.0/src/valkyrie/vault/prompt.py +77 -0
- valkyria_cli-0.1.0/src/valkyrie/vault/store.py +207 -0
- valkyria_cli-0.1.0/src/valkyrie/vault/sync.py +140 -0
- valkyria_cli-0.1.0/tests/__init__.py +2 -0
- valkyria_cli-0.1.0/tests/conftest.py +22 -0
- valkyria_cli-0.1.0/tests/test_account.py +243 -0
- valkyria_cli-0.1.0/tests/test_chat.py +306 -0
- valkyria_cli-0.1.0/tests/test_cli.py +69 -0
- valkyria_cli-0.1.0/tests/test_providers.py +320 -0
- valkyria_cli-0.1.0/tests/test_rag.py +285 -0
- valkyria_cli-0.1.0/tests/test_sessions.py +274 -0
- valkyria_cli-0.1.0/tests/test_setup.py +163 -0
- valkyria_cli-0.1.0/tests/test_tools.py +276 -0
- valkyria_cli-0.1.0/tests/test_vault.py +122 -0
- valkyria_cli-0.1.0/tests/test_workspace_commands.py +160 -0
- valkyria_cli-0.1.0/ui.md +525 -0
- valkyria_cli-0.1.0/uv.lock +2888 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Valkyrie CLI
|
|
2
|
+
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.venv/
|
|
9
|
+
*.egg
|
|
10
|
+
.mypy_cache/
|
|
11
|
+
.ruff_cache/
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
*.so
|
|
14
|
+
*.dylib
|
|
15
|
+
.env
|
|
16
|
+
.env.*
|
|
17
|
+
!.env.example
|
|
18
|
+
|
|
19
|
+
# Vault and auth (never commit secrets)
|
|
20
|
+
vault.enc
|
|
21
|
+
auth.json
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Valkyrie CLI — Command Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for all terminal CLI commands (`valkyrie` / `vk`) and in-chat slash commands (`/...`) available in Valkyrie.
|
|
4
|
+
|
|
5
|
+
> **Short CLI binary:** You can use `vk` anywhere instead of `valkyrie` (e.g. `vk c` for `valkyrie chat`), plus short group aliases: `c` (`chat`), `m` (`model`), `k` (`keys`), `a` (`auth`), `r` (`rag`), `s` (`status`), `ss` (`session`), `in` (`login`), `out` (`logout`). Unambiguous prefixes also work automatically.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. General & Onboarding Commands
|
|
10
|
+
|
|
11
|
+
| Command | Description |
|
|
12
|
+
| :--- | :--- |
|
|
13
|
+
| `valkyrie` | Shows the Valkyrie banner and auth/setup summary. Launches the first-run setup wizard automatically in an interactive terminal if setup is incomplete. |
|
|
14
|
+
| `valkyrie --version` | Prints the installed Valkyrie CLI version. |
|
|
15
|
+
| `valkyrie --help` | Lists all top-level CLI commands. |
|
|
16
|
+
| `valkyrie status` | Displays config directory, Firebase auth status, configured providers, assigned model roles, first-run status, workspace root, Pinecone RAG index, and latest workspace session. |
|
|
17
|
+
| `valkyrie setup` | Runs the interactive onboarding wizard (optional Google sign-in, encrypted vault + API keys, live model discovery, optional profile, and role assignments). |
|
|
18
|
+
| `valkyrie login` | Top-level alias for `valkyrie auth login`. |
|
|
19
|
+
| `valkyrie logout` | Top-level alias for `valkyrie auth logout`. |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2. Authentication & Account Lifecycle (`valkyrie auth`)
|
|
24
|
+
|
|
25
|
+
| Command | Options | Description |
|
|
26
|
+
| :--- | :--- | :--- |
|
|
27
|
+
| `valkyrie auth login` | — | Opens your browser for Firebase Google sign-in and stores tokens in `~/.valkyrie/auth.json`. |
|
|
28
|
+
| `valkyrie auth switch` | — | Opens Google's account chooser (`select_account`) in the browser to switch to another Google account. Preserves your existing session if cancelled, and offers to pull a synced vault if the new account has one. |
|
|
29
|
+
| `valkyrie auth delete` | `--yes`, `--purge-local` | Permanently deletes your Firebase Auth user and remote Firestore vault (`users/{uid}/vault/keys`), clears local `auth.json`, and disables cloud sync. Use `--yes` to skip confirmation and `--purge-local` to also delete local `vault.enc`. |
|
|
30
|
+
| `valkyrie auth logout` | — | Signs out locally by clearing `~/.valkyrie/auth.json` (does not delete your Firebase account or remote vault). |
|
|
31
|
+
| `valkyrie auth status` | — | Shows current sign-in status, email, display name, UID, cloud sync state, and token expiry. |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 3. Encrypted Key Vault (`valkyrie keys`)
|
|
36
|
+
|
|
37
|
+
Keys are encrypted locally with Argon2id + AES-256-GCM in `~/.valkyrie/vault.enc`. Supported providers: `groq`, `gemini`, `nvidia`.
|
|
38
|
+
|
|
39
|
+
| Command | Arguments | Description |
|
|
40
|
+
| :--- | :--- | :--- |
|
|
41
|
+
| `valkyrie keys add [PROVIDER]` | `PROVIDER` (optional) | Prompts for master password and adds/updates an API key (`groq`, `gemini`, or `nvidia`), then offers to sync to Firebase if signed in. |
|
|
42
|
+
| `valkyrie keys list` | — | Unlocks the vault and displays masked API keys and timestamps. |
|
|
43
|
+
| `valkyrie keys remove PROVIDER` | `PROVIDER` | Prompts for confirmation and master password, removes the provider key from the vault, and offers to sync. |
|
|
44
|
+
| `valkyrie keys sync` | — | Pushes your encrypted vault to Firebase Firestore (`users/{uid}/vault/keys`), or pulls it from Firestore if no local vault exists. |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 4. Model Catalog & Role Assignments (`valkyrie model`)
|
|
49
|
+
|
|
50
|
+
| Command | Options / Arguments | Description |
|
|
51
|
+
| :--- | :--- | :--- |
|
|
52
|
+
| `valkyrie model` | — | Shows current model assignments for all roles (`chat`, `code`, `planner`, `vision`, `summarization`, `embeddings`) and cached catalog counts. |
|
|
53
|
+
| `valkyrie model list` | `-p/--provider`, `-r/--role`, `-c/--capability`, `-s/--search` | Lists cached models grouped by provider, with provider filter pills and capability/context-window/state columns. |
|
|
54
|
+
| `valkyrie model refresh` | `-p/--provider` | Unlocks your vault, validates keys, and fetches live model catalogs from configured providers (or a single provider with `-p`). |
|
|
55
|
+
| `valkyrie model set ROLE MODEL_ID` | `ROLE`, `MODEL_ID` | Assigns a `<provider>/<model_id>` (or unique bare model ID) to a role, or pass `unassigned` to clear a role. |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 5. Interactive Chat (`valkyrie chat`)
|
|
60
|
+
|
|
61
|
+
| Command | Options | Description |
|
|
62
|
+
| :--- | :--- | :--- |
|
|
63
|
+
| `valkyrie chat` | — | Unlocks your vault and resumes the latest session in the current workspace (or creates one if none exists). |
|
|
64
|
+
| `valkyrie chat --new` | `--new` | Starts a brand new session instead of resuming the latest one. |
|
|
65
|
+
| `valkyrie chat --model <id>` | `--model` | Overrides the active chat model (`<provider>/<model_id>`) for the session. |
|
|
66
|
+
| `valkyrie chat --session <id>` | `--session` | Resumes a specific saved session by exact ID or unique prefix. |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 6. Durable Session Management (`valkyrie session`)
|
|
71
|
+
|
|
72
|
+
Sessions are stored in SQLite at `~/.valkyrie/data/sessions.db`.
|
|
73
|
+
|
|
74
|
+
| Command | Options / Arguments | Description |
|
|
75
|
+
| :--- | :--- | :--- |
|
|
76
|
+
| `valkyrie session list` | `--all` | Lists saved sessions for the current workspace (or across all workspaces with `--all`). |
|
|
77
|
+
| `valkyrie session new` | `--title`, `--model` | Creates a new persistent session and prints its ID for resuming later. |
|
|
78
|
+
| `valkyrie session show SESSION_ID` | `SESSION_ID` | Displays session metadata, token usage, checkpoint ID, and the last 10 messages. |
|
|
79
|
+
| `valkyrie session rename SESSION_ID TITLE` | `SESSION_ID`, `TITLE` | Renames a saved session. |
|
|
80
|
+
| `valkyrie session fork SESSION_ID` | `--title` | Clones an existing session and its message history into a new branched session. |
|
|
81
|
+
| `valkyrie session search QUERY` | `QUERY` | Searches sessions by title or message content. |
|
|
82
|
+
| `valkyrie session compact SESSION_ID` | `--keep` (default: `4`) | Summarizes older turns in a session while keeping the system prompt and the most recent `--keep` messages. |
|
|
83
|
+
| `valkyrie session delete SESSION_ID` | `--yes` | Deletes a saved session and its messages/checkpoints (`--yes` skips confirmation). |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 7. Pinecone RAG (`valkyrie rag`)
|
|
88
|
+
|
|
89
|
+
Vector retrieval uses Pinecone DB exclusively (configured via `PINECONE_API_KEY` and `PINECONE_INDEX` in `.env`, with zero local vector storage).
|
|
90
|
+
|
|
91
|
+
| Command | Options / Arguments | Description |
|
|
92
|
+
| :--- | :--- | :--- |
|
|
93
|
+
| `valkyrie rag index [TARGET]` | `TARGET` (default: `.`) | Chunks and embeds workspace files and upserts them into the workspace's Pinecone namespace. |
|
|
94
|
+
| `valkyrie rag search QUERY` | `--top-k` (default: `5`) | Searches the workspace's Pinecone namespace and prints matching chunks with line citations and similarity scores. |
|
|
95
|
+
| `valkyrie rag status` | — | Displays workspace root, embedding mode, Pinecone index/region/namespace, connection status, and vector count. |
|
|
96
|
+
| `valkyrie rag clear` | `--yes` | Deletes all indexed vectors in the current workspace's Pinecone namespace (`--yes` skips confirmation). |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 8. In-Chat Slash Commands (`/...`) & `@` Attachments
|
|
101
|
+
|
|
102
|
+
Inside `valkyrie chat`, type `/` for live command autocomplete or `@` to attach workspace files.
|
|
103
|
+
|
|
104
|
+
| Command | Short Alias | Description |
|
|
105
|
+
| :--- | :--- | :--- |
|
|
106
|
+
| `/help` | `/h`, `/?` | Lists all active in-chat slash commands and their usage. |
|
|
107
|
+
| `/new [title]` | `/n` | Starts a brand new chat session with a fresh context window and zeroed token counters (preserves previous sessions in SQLite). |
|
|
108
|
+
| `/clear` | `/c`, `/cls` | Clears the screen and resets conversation turns while keeping the current session ID. |
|
|
109
|
+
| `/compact [keep]` | `/cmp` | Summarizes older turns into a concise summary message, keeping the last `keep` turns (default: `4`). |
|
|
110
|
+
| `/model` | `/m` | Shows the active model, context budget, role assignments, and provider filter pills. |
|
|
111
|
+
| `/model <provider> [search]` | `/m <provider>` | Filters the model catalog by provider (`groq`, `gemini`, `nvidia`) and optional search text. |
|
|
112
|
+
| `/model list [provider] [query]` | `/m ls` | Lists models in the catalog, optionally filtered by provider and search query. |
|
|
113
|
+
| `/model pick [provider]` | `/m p` | Opens an interactive numbered model selector with live provider filtering. |
|
|
114
|
+
| `/model refresh [provider]` | `/m rf` | Fetches live model catalogs from unlocked providers. |
|
|
115
|
+
| `/model [use] <id>` | `/m <id>`, `/m u <id>` | Switches the active session model immediately (accepts `<provider>/<model_id>` or a unique bare model ID). |
|
|
116
|
+
| `/budget` | `/b` | Displays current context window usage and total prompt/completion tokens for the session. |
|
|
117
|
+
| `/session` | `/ss` | Shows the active session ID, title, message count, checkpoint ID, and model. |
|
|
118
|
+
| `/account` | `/acc`, `/auth`, `/acc st` | Shows current signed-in account, UID, token expiry, and cloud sync status. |
|
|
119
|
+
| `/account switch` | `/acc sw` | Opens Google's account picker in your browser to switch accounts (offers to pull synced vault if available). |
|
|
120
|
+
| `/account delete [--yes] [--purge-local]` | `/acc del` | Permanently deletes your signed-in Firebase account and remote Firestore vault, clears local auth, and optionally removes local `vault.enc`. |
|
|
121
|
+
| `/account login` | `/acc in` | Signs in with Google via browser handoff if not already signed in. |
|
|
122
|
+
| `/account logout` | `/acc out` | Signs out locally without deleting your cloud account. |
|
|
123
|
+
| `/workspace` | `/ws` | Displays the detected workspace root and count of `@`-attachable files. |
|
|
124
|
+
| `/read <path> [start] [end]` | `/r` | Reads a workspace file (or line slice) and displays a preview card. |
|
|
125
|
+
| `/index [path]` | `/i` | Indexes workspace files into Pinecone DB. |
|
|
126
|
+
| `/search <query>` | `/s` | Searches Pinecone DB for matching workspace chunks with citations. |
|
|
127
|
+
| `/rag [on\|off\|status]` | — | Toggles automatic Pinecone RAG context injection per turn or displays Pinecone status. |
|
|
128
|
+
| `/web <query>` | `/w` | Runs a live DuckDuckGo web search via LangChain and displays top results. |
|
|
129
|
+
| `/auto [on\|off]` | `/a` | Toggles automatic approval for local file write/edit/delete tool calls (or flips state when called with no argument). |
|
|
130
|
+
| `/exit` | `/q`, `/quit` | Exits the interactive chat REPL. |
|
|
131
|
+
| `@<path>` | — | Inline token in any prompt (with autocomplete) that attaches a workspace file's contents to that turn. |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 9. Autonomous Agent Tools (During Chat)
|
|
136
|
+
|
|
137
|
+
When chatting in `valkyrie chat`, the model can invoke these LangChain-backed tools automatically (prompting `[Y/n/a]` for mutating file operations unless `/auto on` is active):
|
|
138
|
+
|
|
139
|
+
| Tool | Purpose |
|
|
140
|
+
| :--- | :--- |
|
|
141
|
+
| `read_file` | Reads files (with optional line ranges) from the workspace or local user directories (e.g. `~/Downloads`). |
|
|
142
|
+
| `write_file` | Creates or overwrites files on your local machine (blocked on protected paths like `/etc`, `.git`, `.env`, `vault.enc`, `auth.json`). |
|
|
143
|
+
| `edit_file` | Performs targeted text replacements inside existing local files. |
|
|
144
|
+
| `delete_file` | Deletes a local file after confirmation. |
|
|
145
|
+
| `list_directory` | Lists files and subdirectories at a given path. |
|
|
146
|
+
| `search_files` | Searches for files by glob pattern or text content across a directory. |
|
|
147
|
+
| `web_search` | Performs live DuckDuckGo web searches via LangChain. |
|
|
148
|
+
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: valkyria-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Terminal-first, multi-model AI agent with local retrieval, controlled system access, and durable sessions
|
|
5
|
+
Author: Anupam
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Requires-Dist: argon2-cffi>=25.1.0
|
|
9
|
+
Requires-Dist: click>=8.1
|
|
10
|
+
Requires-Dist: cryptography>=50.0.2
|
|
11
|
+
Requires-Dist: ddgs>=9.16.1
|
|
12
|
+
Requires-Dist: httpx>=0.27
|
|
13
|
+
Requires-Dist: langchain-community>=0.4.2
|
|
14
|
+
Requires-Dist: langchain-core>=1.8.4
|
|
15
|
+
Requires-Dist: pinecone>=10.3.0
|
|
16
|
+
Requires-Dist: prompt-toolkit>=3.0
|
|
17
|
+
Requires-Dist: pydantic>=2.0
|
|
18
|
+
Requires-Dist: python-dotenv>=1.2.4
|
|
19
|
+
Requires-Dist: rich>=13.0
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Valkyrie CLI — Product and Engineering Specification
|
|
23
|
+
|
|
24
|
+
**Status:** Design specification
|
|
25
|
+
**Version:** 1.0 draft
|
|
26
|
+
**Date:** 25 November 2026
|
|
27
|
+
**Product:** Terminal-first, multi-model AI agent with local retrieval, controlled system access, and durable sessions
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 1. Product intent
|
|
32
|
+
|
|
33
|
+
Valkyrie CLI is an AI workspace that runs in a terminal. It answers questions, helps write and edit code, searches local material, creates plans, and carries out approved tasks. Users bring API keys for Groq, Gemini, and NVIDIA. They choose the exact model used for each kind of work. The product keeps its retrieval index and execution history on the user's machine, while making every transfer to a hosted provider visible.
|
|
34
|
+
|
|
35
|
+
The defining experience is **a precise, fast terminal tool with an editorial voice**: concise, confident, occasionally sassy, and always useful. Its interface should feel designed by people who build developer tools, not like a generic AI chat screen. The personality belongs in microcopy and rhythm, never in permission prompts, errors that need diagnosis, or safety decisions.
|
|
36
|
+
|
|
37
|
+
### 1.1 Product promises
|
|
38
|
+
|
|
39
|
+
1. A user can enter one or more provider keys, see the models available to those keys, and assign models to tasks.
|
|
40
|
+
2. A user can understand what the agent is doing, what data leaves the machine, and what action requires approval.
|
|
41
|
+
3. A session survives process restarts and can be resumed, forked, searched, renamed, compacted, or deleted.
|
|
42
|
+
4. Local documents can be indexed and searched without a cloud vector database.
|
|
43
|
+
5. Files and commands are controlled by scoped permissions, previews, snapshots, limits, and an audit trail.
|
|
44
|
+
6. The CLI remains useful in narrow terminals, over SSH, and without full TUI support.
|
|
45
|
+
|
|
46
|
+
### 1.2 Primary users
|
|
47
|
+
|
|
48
|
+
| User | Main job | Need |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| Developer | Understand and change a codebase | Fast context, diffs, command transparency, undo |
|
|
51
|
+
| Technical researcher | Search documents and compare evidence | Source citations, local indexing, clear provenance |
|
|
52
|
+
| Power user | Inspect and automate a workstation | Explicit scopes, dry runs, reliable approvals |
|
|
53
|
+
| Multi-model user | Assign the right model to each task | Live catalog, capabilities, cost visibility where available |
|
|
54
|
+
|
|
55
|
+
### 1.3 Non-goals for initial release
|
|
56
|
+
|
|
57
|
+
- A desktop GUI or web chat product.
|
|
58
|
+
- Autonomous operation without a user-visible approval boundary.
|
|
59
|
+
- Cloud hosting of document indexes or raw local files.
|
|
60
|
+
- Team administration, shared workspaces, or billing aggregation.
|
|
61
|
+
- Running hosted provider models offline.
|
|
62
|
+
- Guaranteeing an undo of arbitrary shell commands or external side effects.
|
|
63
|
+
|
|
64
|
+
## 2. Scope and release definitions
|
|
65
|
+
|
|
66
|
+
**MVP:** Login, local key vault, provider model discovery, model assignments, chat, sessions, context accounting, read-only local file access, basic local RAG, and a polished terminal interface.
|
|
67
|
+
|
|
68
|
+
**Beta:** Plan/build, previewed file edits, scoped approvals, snapshots and undo, safe command execution, package management in isolated environments, hybrid search, session sync, and audit export.
|
|
69
|
+
|
|
70
|
+
**V1:** Vision, web search, robust offline behavior, advanced ingestion, security hardening, accessibility and cross-platform certification.
|
|
71
|
+
|
|
72
|
+
Feature flags must prevent unfinished tools from appearing as executable commands. Help may show a clearly marked upcoming feature only in development builds.
|
|
73
|
+
|
|
74
|
+
## 3. Experience principles
|
|
75
|
+
|
|
76
|
+
1. **The prompt stays the center.** One active input line; information appears only when relevant.
|
|
77
|
+
2. **Show the receipt.** Before a consequential action, show target, scope, exact operation, expected effect, and recovery option.
|
|
78
|
+
3. **Disclose model and data path.** The active model is always visible; any hosted request involving local content is clear.
|
|
79
|
+
4. **Never make confidence decorative.** Unknown capability, token limit, or cost is shown as unknown.
|
|
80
|
+
5. **Speed is visual.** Immediate input response, streamed output, stable layout, and no theatrical loading animation.
|
|
81
|
+
6. **Voice is earned.** Personality can sharpen a success message; critical prompts remain neutral and exact.
|
|
82
|
+
|
|
83
|
+
## 4. User journeys
|
|
84
|
+
|
|
85
|
+
### 4.1 First run
|
|
86
|
+
|
|
87
|
+
1. `valkyrie` starts and checks local configuration.
|
|
88
|
+
2. If signed out, show `valkyrie login` with a short explanation of the browser handoff.
|
|
89
|
+
3. After login, ask which providers to connect. At least one hosted model provider is required for chat; the user may return later to add more.
|
|
90
|
+
4. Read each API key with masked, no-echo input. Never put a key in a command-line argument or shell history.
|
|
91
|
+
5. Validate credentials and fetch the provider catalog. Show accessible models, grouped by capability. A list result alone does not guarantee invocation rights; a low-cost probe validates the selected model when feasible.
|
|
92
|
+
6. Ask for the user's preferred name, profession, and expertise level. All are optional; **do not ask for known languages or tone**.
|
|
93
|
+
7. Assign models to chat, code, planner, vision, and summarization. Embeddings are configured separately because they have a different data-transfer implication. Only show models that support the role; allow `unassigned` for optional roles.
|
|
94
|
+
8. Display a review screen: providers, role assignments, local/hosted embedding mode, sync setting, and a plain-language privacy summary. Save only after confirmation.
|
|
95
|
+
9. Open a new session and show one sample action, not a long tutorial.
|
|
96
|
+
|
|
97
|
+
### 4.2 Daily use
|
|
98
|
+
|
|
99
|
+
1. Launch in the current directory; that directory is the suggested workspace root.
|
|
100
|
+
2. Resume the last session unless the user requests `--new` or a specific session.
|
|
101
|
+
3. Type a question or use a slash command. `/` lists commands; a partial command filters them. `@` suggests accessible workspace paths.
|
|
102
|
+
4. The assistant streams output. Tool actions appear as compact cards with status and expandable details.
|
|
103
|
+
5. Approvals pause the agent and accept an explicit choice. The agent resumes from a durable checkpoint.
|
|
104
|
+
|
|
105
|
+
### 4.3 Model change
|
|
106
|
+
|
|
107
|
+
1. `/model` shows current session model and role assignments.
|
|
108
|
+
2. `/model list` shows the models available under configured keys, with provider, capability, status, and known limits.
|
|
109
|
+
3. `/model refresh` refetches catalogs. `/model set code <provider>/<model>` changes an assignment. `/model use <provider>/<model>` overrides the current session's chat model.
|
|
110
|
+
4. Before switching, recalculate context budget. If the existing context will not fit, offer compaction or a new session.
|
|
111
|
+
5. If a selected model is retired, inaccessible, or incompatible, explain the exact failure and offer compatible choices. Never silently substitute a model for a paid or privacy-sensitive request.
|
|
112
|
+
|
|
113
|
+
## 5. Interface design specification
|
|
114
|
+
|
|
115
|
+
### 5.1 Visual direction
|
|
116
|
+
|
|
117
|
+
The visual language is **editorial terminal**: a restrained grid, strong type hierarchy, sharp rules, meaningful whitespace, and one vivid functional accent. It should feel like an excellent developer instrument rather than a dashboard rendered in monospace. No gradients, glass effects, decorative stars, robot imagery, fake code rain, or generic glowing chat bubbles. Do not add emojis or decorative icons. Use text, rules, spacing, and color to convey structure. ASCII or Unicode box characters are allowed when they improve clarity, with a plain-text fallback.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "valkyria-cli"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Terminal-first, multi-model AI agent with local retrieval, controlled system access, and durable sessions"
|
|
5
|
+
readme = "readme.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Anupam" },
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
dependencies = [
|
|
13
|
+
"click>=8.1",
|
|
14
|
+
"rich>=13.0",
|
|
15
|
+
"prompt-toolkit>=3.0",
|
|
16
|
+
"pydantic>=2.0",
|
|
17
|
+
"httpx>=0.27",
|
|
18
|
+
"cryptography>=50.0.2",
|
|
19
|
+
"argon2-cffi>=25.1.0",
|
|
20
|
+
"pinecone>=10.3.0",
|
|
21
|
+
"python-dotenv>=1.2.4",
|
|
22
|
+
"langchain-community>=0.4.2",
|
|
23
|
+
"ddgs>=9.16.1",
|
|
24
|
+
"langchain-core>=1.8.4",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
valkyrie = "valkyrie.cli.main:cli"
|
|
29
|
+
vk = "valkyrie.cli.main:cli"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["hatchling"]
|
|
33
|
+
build-backend = "hatchling.build"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/valkyrie"]
|
|
37
|
+
|
|
38
|
+
[tool.ruff]
|
|
39
|
+
target-version = "py312"
|
|
40
|
+
line-length = 100
|
|
41
|
+
src = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.ruff.lint]
|
|
44
|
+
select = ["E", "F", "W", "I", "N", "UP", "B", "A", "SIM", "TCH"]
|
|
45
|
+
|
|
46
|
+
[tool.ruff.lint.isort]
|
|
47
|
+
known-first-party = ["valkyrie"]
|
|
48
|
+
|
|
49
|
+
[tool.mypy]
|
|
50
|
+
python_version = "3.12"
|
|
51
|
+
strict = true
|
|
52
|
+
warn_return_any = true
|
|
53
|
+
warn_unused_configs = true
|
|
54
|
+
mypy_path = "src"
|
|
55
|
+
|
|
56
|
+
[tool.hatch.build.targets.sdist]
|
|
57
|
+
exclude = [
|
|
58
|
+
"client",
|
|
59
|
+
"dist",
|
|
60
|
+
".venv",
|
|
61
|
+
"assets",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
testpaths = ["tests"]
|
|
66
|
+
pythonpath = ["src"]
|
|
67
|
+
addopts = "-v --tb=short"
|
|
68
|
+
|
|
69
|
+
[dependency-groups]
|
|
70
|
+
dev = [
|
|
71
|
+
"mypy>=2.4.1",
|
|
72
|
+
"pytest>=9.2.0",
|
|
73
|
+
"ruff>=0.17.6",
|
|
74
|
+
]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Valkyrie CLI — Product and Engineering Specification
|
|
2
|
+
|
|
3
|
+
**Status:** Design specification
|
|
4
|
+
**Version:** 1.0 draft
|
|
5
|
+
**Date:** 25 November 2026
|
|
6
|
+
**Product:** Terminal-first, multi-model AI agent with local retrieval, controlled system access, and durable sessions
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. Product intent
|
|
11
|
+
|
|
12
|
+
Valkyrie CLI is an AI workspace that runs in a terminal. It answers questions, helps write and edit code, searches local material, creates plans, and carries out approved tasks. Users bring API keys for Groq, Gemini, and NVIDIA. They choose the exact model used for each kind of work. The product keeps its retrieval index and execution history on the user's machine, while making every transfer to a hosted provider visible.
|
|
13
|
+
|
|
14
|
+
The defining experience is **a precise, fast terminal tool with an editorial voice**: concise, confident, occasionally sassy, and always useful. Its interface should feel designed by people who build developer tools, not like a generic AI chat screen. The personality belongs in microcopy and rhythm, never in permission prompts, errors that need diagnosis, or safety decisions.
|
|
15
|
+
|
|
16
|
+
### 1.1 Product promises
|
|
17
|
+
|
|
18
|
+
1. A user can enter one or more provider keys, see the models available to those keys, and assign models to tasks.
|
|
19
|
+
2. A user can understand what the agent is doing, what data leaves the machine, and what action requires approval.
|
|
20
|
+
3. A session survives process restarts and can be resumed, forked, searched, renamed, compacted, or deleted.
|
|
21
|
+
4. Local documents can be indexed and searched without a cloud vector database.
|
|
22
|
+
5. Files and commands are controlled by scoped permissions, previews, snapshots, limits, and an audit trail.
|
|
23
|
+
6. The CLI remains useful in narrow terminals, over SSH, and without full TUI support.
|
|
24
|
+
|
|
25
|
+
### 1.2 Primary users
|
|
26
|
+
|
|
27
|
+
| User | Main job | Need |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| Developer | Understand and change a codebase | Fast context, diffs, command transparency, undo |
|
|
30
|
+
| Technical researcher | Search documents and compare evidence | Source citations, local indexing, clear provenance |
|
|
31
|
+
| Power user | Inspect and automate a workstation | Explicit scopes, dry runs, reliable approvals |
|
|
32
|
+
| Multi-model user | Assign the right model to each task | Live catalog, capabilities, cost visibility where available |
|
|
33
|
+
|
|
34
|
+
### 1.3 Non-goals for initial release
|
|
35
|
+
|
|
36
|
+
- A desktop GUI or web chat product.
|
|
37
|
+
- Autonomous operation without a user-visible approval boundary.
|
|
38
|
+
- Cloud hosting of document indexes or raw local files.
|
|
39
|
+
- Team administration, shared workspaces, or billing aggregation.
|
|
40
|
+
- Running hosted provider models offline.
|
|
41
|
+
- Guaranteeing an undo of arbitrary shell commands or external side effects.
|
|
42
|
+
|
|
43
|
+
## 2. Scope and release definitions
|
|
44
|
+
|
|
45
|
+
**MVP:** Login, local key vault, provider model discovery, model assignments, chat, sessions, context accounting, read-only local file access, basic local RAG, and a polished terminal interface.
|
|
46
|
+
|
|
47
|
+
**Beta:** Plan/build, previewed file edits, scoped approvals, snapshots and undo, safe command execution, package management in isolated environments, hybrid search, session sync, and audit export.
|
|
48
|
+
|
|
49
|
+
**V1:** Vision, web search, robust offline behavior, advanced ingestion, security hardening, accessibility and cross-platform certification.
|
|
50
|
+
|
|
51
|
+
Feature flags must prevent unfinished tools from appearing as executable commands. Help may show a clearly marked upcoming feature only in development builds.
|
|
52
|
+
|
|
53
|
+
## 3. Experience principles
|
|
54
|
+
|
|
55
|
+
1. **The prompt stays the center.** One active input line; information appears only when relevant.
|
|
56
|
+
2. **Show the receipt.** Before a consequential action, show target, scope, exact operation, expected effect, and recovery option.
|
|
57
|
+
3. **Disclose model and data path.** The active model is always visible; any hosted request involving local content is clear.
|
|
58
|
+
4. **Never make confidence decorative.** Unknown capability, token limit, or cost is shown as unknown.
|
|
59
|
+
5. **Speed is visual.** Immediate input response, streamed output, stable layout, and no theatrical loading animation.
|
|
60
|
+
6. **Voice is earned.** Personality can sharpen a success message; critical prompts remain neutral and exact.
|
|
61
|
+
|
|
62
|
+
## 4. User journeys
|
|
63
|
+
|
|
64
|
+
### 4.1 First run
|
|
65
|
+
|
|
66
|
+
1. `valkyrie` starts and checks local configuration.
|
|
67
|
+
2. If signed out, show `valkyrie login` with a short explanation of the browser handoff.
|
|
68
|
+
3. After login, ask which providers to connect. At least one hosted model provider is required for chat; the user may return later to add more.
|
|
69
|
+
4. Read each API key with masked, no-echo input. Never put a key in a command-line argument or shell history.
|
|
70
|
+
5. Validate credentials and fetch the provider catalog. Show accessible models, grouped by capability. A list result alone does not guarantee invocation rights; a low-cost probe validates the selected model when feasible.
|
|
71
|
+
6. Ask for the user's preferred name, profession, and expertise level. All are optional; **do not ask for known languages or tone**.
|
|
72
|
+
7. Assign models to chat, code, planner, vision, and summarization. Embeddings are configured separately because they have a different data-transfer implication. Only show models that support the role; allow `unassigned` for optional roles.
|
|
73
|
+
8. Display a review screen: providers, role assignments, local/hosted embedding mode, sync setting, and a plain-language privacy summary. Save only after confirmation.
|
|
74
|
+
9. Open a new session and show one sample action, not a long tutorial.
|
|
75
|
+
|
|
76
|
+
### 4.2 Daily use
|
|
77
|
+
|
|
78
|
+
1. Launch in the current directory; that directory is the suggested workspace root.
|
|
79
|
+
2. Resume the last session unless the user requests `--new` or a specific session.
|
|
80
|
+
3. Type a question or use a slash command. `/` lists commands; a partial command filters them. `@` suggests accessible workspace paths.
|
|
81
|
+
4. The assistant streams output. Tool actions appear as compact cards with status and expandable details.
|
|
82
|
+
5. Approvals pause the agent and accept an explicit choice. The agent resumes from a durable checkpoint.
|
|
83
|
+
|
|
84
|
+
### 4.3 Model change
|
|
85
|
+
|
|
86
|
+
1. `/model` shows current session model and role assignments.
|
|
87
|
+
2. `/model list` shows the models available under configured keys, with provider, capability, status, and known limits.
|
|
88
|
+
3. `/model refresh` refetches catalogs. `/model set code <provider>/<model>` changes an assignment. `/model use <provider>/<model>` overrides the current session's chat model.
|
|
89
|
+
4. Before switching, recalculate context budget. If the existing context will not fit, offer compaction or a new session.
|
|
90
|
+
5. If a selected model is retired, inaccessible, or incompatible, explain the exact failure and offer compatible choices. Never silently substitute a model for a paid or privacy-sensitive request.
|
|
91
|
+
|
|
92
|
+
## 5. Interface design specification
|
|
93
|
+
|
|
94
|
+
### 5.1 Visual direction
|
|
95
|
+
|
|
96
|
+
The visual language is **editorial terminal**: a restrained grid, strong type hierarchy, sharp rules, meaningful whitespace, and one vivid functional accent. It should feel like an excellent developer instrument rather than a dashboard rendered in monospace. No gradients, glass effects, decorative stars, robot imagery, fake code rain, or generic glowing chat bubbles. Do not add emojis or decorative icons. Use text, rules, spacing, and color to convey structure. ASCII or Unicode box characters are allowed when they improve clarity, with a plain-text fallback.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Auth module — Firebase Google OAuth for Valkyrie CLI.
|
|
3
|
+
|
|
4
|
+
Provides login (browser handoff), logout, token storage, and refresh.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from valkyrie.auth.tokens import (
|
|
8
|
+
AuthUser,
|
|
9
|
+
clear_auth,
|
|
10
|
+
get_valid_user,
|
|
11
|
+
load_auth,
|
|
12
|
+
save_auth,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"AuthUser",
|
|
17
|
+
"clear_auth",
|
|
18
|
+
"get_valid_user",
|
|
19
|
+
"load_auth",
|
|
20
|
+
"save_auth",
|
|
21
|
+
]
|