@sns-myagent/cli 0.3.7 → 0.3.9

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +63 -24
  3. package/bin/snsagent.js +3 -41
  4. package/dist/cli.js +3267 -3288
  5. package/package.json +3 -3
  6. package/src/adapters/telegram/handler.ts +1 -1
  7. package/src/agents/ensemble.ts +3 -4
  8. package/src/agents/executor.ts +129 -0
  9. package/src/async/notifier.ts +1 -1
  10. package/src/cli/config-cli.ts +1 -1
  11. package/src/cli/entry.ts +2 -2
  12. package/src/cli/gallery-fixtures/misc.ts +3 -3
  13. package/src/cli/grep-cli.ts +3 -3
  14. package/src/cli/grievances-cli.ts +2 -2
  15. package/src/cli/index.ts +243 -24
  16. package/src/cli/plugin-cli.ts +5 -5
  17. package/src/cli/setup-cli.ts +3 -3
  18. package/src/cli/setup-model-picker.ts +1 -1
  19. package/src/cli/shell-cli.ts +1 -1
  20. package/src/cli/ssh-cli.ts +1 -1
  21. package/src/cli/stats-cli.ts +1 -1
  22. package/src/cli/tiny-models-cli.ts +3 -3
  23. package/src/cli/ttsr-cli.ts +2 -2
  24. package/src/cli/update-cli.ts +3 -3
  25. package/src/cli/usage-cli.ts +1 -1
  26. package/src/cli-commands.ts +6 -6
  27. package/src/commands/acp.ts +2 -2
  28. package/src/commands/chat.ts +3 -3
  29. package/src/commands/install.ts +5 -5
  30. package/src/commands/say.ts +4 -4
  31. package/src/commands/setup.ts +1 -1
  32. package/src/config/defaults.ts +5 -3
  33. package/src/config/schema.ts +8 -0
  34. package/src/config/settings-schema.ts +1 -1
  35. package/src/config/sns-config.ts +1 -1
  36. package/src/extensibility/plugins/loader.ts +1 -1
  37. package/src/extensibility/plugins/manager.ts +2 -2
  38. package/src/hindsight/client.ts +1 -1
  39. package/src/internal-urls/docs-index.generated.txt +2 -0
  40. package/src/main.ts +4 -0
  41. package/src/modes/acp/acp-agent.ts +3 -3
  42. package/src/modes/components/plugin-settings.ts +2 -2
  43. package/src/modes/components/welcome.ts +66 -160
  44. package/src/modes/interactive-mode.ts +2 -2
  45. package/src/modes/print-mode.ts +2 -2
  46. package/src/modes/setup-version.ts +1 -1
  47. package/src/modes/setup-wizard/scenes/byok-setup.ts +354 -0
  48. package/src/modes/setup-wizard/scenes/outro.ts +2 -2
  49. package/src/modes/setup-wizard/scenes/providers.ts +6 -5
  50. package/src/modes/setup-wizard/scenes/splash.ts +3 -3
  51. package/src/modes/setup-wizard/wizard-overlay.ts +2 -2
  52. package/src/modes/theme/dark.json +21 -20
  53. package/src/modes/theme/light.json +30 -29
  54. package/src/modes/utils/ui-helpers.ts +1 -1
  55. package/src/slash-commands/builtin-registry.ts +6 -3
  56. package/src/stt/recorder.ts +3 -3
  57. package/src/tts/player.ts +1 -1
  58. package/src/tts/tts-client.ts +1 -1
  59. package/src/tui/chat-blocks.ts +4 -4
  60. package/src/tui/chat-ui.ts +3 -3
  61. package/src/tui/code-cell.ts +3 -3
  62. package/src/tui/command-palette.ts +3 -3
  63. package/src/tui/splash.ts +12 -18
  64. package/src/ui/banner.ts +51 -66
  65. package/src/ui/chat-prompt.ts +2 -2
  66. package/src/ui/colors.ts +17 -14
  67. package/src/ui/error-display.ts +2 -2
  68. package/src/ui/gradient.ts +3 -3
  69. package/src/ui/memory-toast.ts +5 -5
  70. package/src/ui/status-bar.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,14 @@ Versioning: [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
10
10
  ## [Unreleased]
11
11
 
12
12
  ### Added
13
+ - **BYOK Quick Setup tab** in setup wizard (`src/modes/setup-wizard/scenes/byok-setup.ts`):
14
+ - New "BYOK" tab alongside "Sign in" and "Web search" in the providers scene
15
+ - Enter Base URL + API Key + select API type (openai-completions, anthropic-messages, google-generative-ai, etc.)
16
+ - Auto-detects available models from the provider's `/models` endpoint
17
+ - Saves provider config to `~/.sns-myagent/models.yml`
18
+ - Shows confirmation with detected model count
19
+ - Setup version bumped to 2
20
+ - **Interactive memory backend selection** (v0.3.8) — choose mnemopi/hindsight/mnemopi/local/off at first run
13
21
  - **TBM (Token Budget Manager) fully implemented** — 7 core modules:
14
22
  - Context Delta Cache: static/dynamic message splitting, ~40% token savings
15
23
  - Context Pyramid: 5 compression levels (L0–L4), auto-demotion based on budget pressure
package/README.md CHANGED
@@ -18,19 +18,19 @@
18
18
  </p>
19
19
 
20
20
  <p align="center">
21
- <strong>BYOK coding agent CLI — 30 built-in tools, 61 slash commands, multi-provider LLM, memory, MCP, Telegram.</strong>
21
+ <strong>BYOK coding agent CLI — 30 built-in tools, 68 slash commands, multi-provider LLM, memory, MCP, Telegram.</strong>
22
22
  </p>
23
23
 
24
24
  <p align="center">
25
25
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="License: MIT"></a>
26
- <img src="https://img.shields.io/badge/version-0.2.0-yellow?style=flat-square" alt="Version 0.2.0">
26
+ <img src="https://img.shields.io/badge/version-0.3.8-yellow?style=flat-square" alt="Version 0.3.8">
27
27
  <img src="https://img.shields.io/badge/bun-%3E%3D1.3.14-efbbf4?style=flat-square&logo=bun&logoColor=black" alt="Bun >= 1.3.14">
28
28
  <img src="https://img.shields.io/badge/typescript-5.x-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript 5.x">
29
29
  </p>
30
30
 
31
31
  ---
32
32
 
33
- **snscoder** is a personal, single-user AI coding agent CLI. Bring your own API key, talk to the agent, and it configures itself — MCP servers, memory backends, model switching, all through conversation. Forked from [Pi Agent / oh-my-pi](https://github.com/can1357/oh-my-pi) and stripped to a focused, local-first, terminal-first agent.
33
+ **snsagent** is a personal, single-user AI coding agent CLI. Bring your own API key, talk to the agent, and it configures itself — MCP servers, memory backends, model switching, all through conversation. Purpose-built for single-user terminal use with conversational configuration.
34
34
 
35
35
  ---
36
36
 
@@ -41,6 +41,7 @@
41
41
  - [Slash Commands](#slash-commands)
42
42
  - [Memory Backends](#memory-backends)
43
43
  - [Installation](#installation)
44
+ - [Termux (Android)](#termux-android)
44
45
  - [Quick Start](#quick-start)
45
46
  - [Configuration](#configuration)
46
47
  - [CLI Reference](#cli-reference)
@@ -59,9 +60,10 @@
59
60
 
60
61
  | Feature | Source |
61
62
  |---------|--------|
62
- | **30 built-in tools** | `src/tools/builtin-names.ts` |
63
- | **157 built-in slash commands** | `src/slash-commands/builtin-registry.ts` |
64
- | **Multi-provider LLM** | OpenAI, Anthropic, Ollama, custom endpoints via `@oh-my-pi/pi-ai` |
63
+ **30 built-in tools** | `src/tools/builtin-names.ts` |
64
+ | **68 built-in slash commands** | `src/slash-commands/builtin-registry.ts` |
65
+ | **Multi-provider LLM** | OpenAI, Anthropic, Ollama, custom endpoints via built-in provider system |
66
+ | **BYOK Quick Setup** | Setup wizard tab — enter Base URL + API Key, auto-detect models, zero config editing |
65
67
  | **7 memory backends** | mnemopi (default), hindsight, mnemosyne, mem0, lcm, local, off — `src/memory-backend/resolve.ts` |
66
68
  | **MCP integration** | 22 source files in `src/mcp/` |
67
69
  | **Plan mode** | `src/plan-mode/` — agent plans before executing |
@@ -116,7 +118,6 @@ All tool names come from `src/tools/builtin-names.ts`.
116
118
  | `lsp` | Language Server Protocol operations |
117
119
  | `debug` | Debugging assistance |
118
120
 
119
- ### Web & Browser
120
121
  ### Web & Browser
121
122
  | Tool | Description |
122
123
  |------|-------------|
@@ -158,7 +159,7 @@ All tool names come from `src/tools/builtin-names.ts`.
158
159
 
159
160
  ## Slash Commands
160
161
 
161
- 61 built-in commands from `src/slash-commands/builtin-registry.ts`. Most useful:
162
+ 68 built-in commands from `src/slash-commands/builtin-registry.ts`. Most useful:
162
163
 
163
164
  ### Session & Navigation
164
165
 
@@ -181,7 +182,7 @@ All tool names come from `src/tools/builtin-names.ts`.
181
182
  | `/switch` | Quick model switch (same as alt+p) |
182
183
  | `/fast [on\|off\|status]` | Toggle priority service tier |
183
184
  | `/settings` | Open settings menu |
184
- | `/setup` | Open provider setup wizard |
185
+ | `/setup` | Open provider setup wizard (OAuth + BYOK + Web search) |
185
186
 
186
187
  ### Goals & Planning
187
188
 
@@ -295,7 +296,7 @@ Works on Linux, macOS, Windows, WSL. Requires Node.js 18+. Prebuilt binary downl
295
296
  git clone https://github.com/Reihantt6/sns-myagent.git
296
297
  cd sns-myagent
297
298
  bun install # requires Bun >= 1.3.14
298
- bun run build # produces bin/snscoder-linux-x64
299
+ bun run build # produces bin/snsagent-linux-x64
299
300
  ```
300
301
 
301
302
  ### Option 4: Windows PowerShell
@@ -327,20 +328,56 @@ Prebuilt binaries: [GitHub Releases](https://github.com/Reihantt6/sns-myagent/re
327
328
 
328
329
  ---
329
330
 
331
+ ## Termux (Android)
332
+
333
+ Full guide: [`docs/termux.md`](./docs/termux.md)
334
+
335
+ Quick setup on Android:
336
+
337
+ ```bash
338
+ # 1. Install Termux from F-Droid (NOT Play Store)
339
+ # 2. Update + install deps
340
+ pkg update && pkg upgrade -y
341
+ pkg install -y git nodejs-lts
342
+ # 3. Install Bun
343
+ curl -fsSL https://bun.sh/install | bash
344
+ source ~/.bashrc
345
+ # 4. Install SNS-MyAgent
346
+ npm install -g @sns-myagent/cli
347
+ # 5. Setup (BYOK wizard)
348
+ snsagent init
349
+ # 6. Run
350
+ snsagent
351
+ ```
352
+
353
+ ---
354
+
330
355
  ## Quick Start
331
356
 
332
357
  ### 1. Set an API key
333
358
 
359
+ **Option A — Environment variable (fastest)**
360
+
334
361
  ```bash
335
362
  export OPENAI_API_KEY="sk-..."
336
363
  # or
337
364
  export ANTHROPIC_API_KEY="sk-ant-..."
338
365
  ```
339
366
 
367
+ **Option B — BYOK Setup Wizard (recommended)**
368
+
369
+ Run `snsagent` and the setup wizard appears on first launch. Pick the **BYOK** tab, enter:
370
+
371
+ 1. **Base URL** — e.g. `https://api.openai.com/v1`, `https://openrouter.ai/api/v1`, `http://localhost:11434/v1` (Ollama)
372
+ 2. **API Key** — your provider key
373
+ 3. **API type** — `openai-completions` (default), `anthropic-messages`, `google-generative-ai`
374
+
375
+ The wizard auto-detects available models from the provider and saves the config to the agent config directory.
376
+
340
377
  ### 2. Run
341
378
 
342
379
  ```bash
343
- snscoder
380
+ snsagent
344
381
  ```
345
382
 
346
383
  Or from source:
@@ -370,7 +407,7 @@ bun run src/cli/entry.ts
370
407
 
371
408
  ## Configuration
372
409
 
373
- Config lives at `.sns-myagent/config.json` (JSON, not YAML). Source: `src/config/loader.ts`.
410
+ Config lives at `.sns-myagent/config.yaml` (YAML, auto-migrated from old `config.json`). Source: `src/config/config-file.ts`.
374
411
 
375
412
  ### Key Config Categories
376
413
 
@@ -440,11 +477,13 @@ Access in TUI via `/settings` or through conversation.
440
477
  ## CLI Reference
441
478
 
442
479
  ```
443
- snscoder # Interactive TUI mode
444
- snscoder "prompt" # Single-prompt mode
445
- snscoder telegram # Start Telegram adapter
446
- snscoder --help # Show help
447
- snscoder --version # Show version
480
+ snsagent # Interactive TUI mode
481
+ snsagent "prompt" # Single-prompt mode
482
+ snsagent init # First-run setup: memory + BYOK provider
483
+ snsagent setup # Alias for init
484
+ snsagent telegram # Start Telegram adapter
485
+ snsagent --help # Show help
486
+ snsagent --version # Show version
448
487
  ```
449
488
 
450
489
  ---
@@ -487,10 +526,10 @@ Telegram bot adapter in `src/adapters/telegram/` (4 files). Built on [grammY](ht
487
526
  export SNS_TELEGRAM_BOT_TOKEN="your-bot-token-here"
488
527
  ```
489
528
 
490
- 3. Run snscoder — the bot auto-starts polling:
529
+ 3. Run snsagent — the bot auto-starts polling:
491
530
 
492
531
  ```bash
493
- snscoder
532
+ snsagent
494
533
  ```
495
534
 
496
535
  The adapter starts automatically when `SNS_TELEGRAM_BOT_TOKEN` is set. Disable auto-start with:
@@ -502,7 +541,7 @@ export SNS_TELEGRAM_AUTOSTART=0
502
541
  Or start the Telegram adapter explicitly:
503
542
 
504
543
  ```bash
505
- snscoder telegram
544
+ snsagent telegram
506
545
  ```
507
546
 
508
547
  ---
@@ -605,9 +644,9 @@ What is actually wired and working in the source tree, verified 2026-06-30:
605
644
 
606
645
  All 30 tools are real implementations, not stubs.
607
646
 
608
- ### Slash Commands (157) — `src/slash-commands/builtin-registry.ts`
647
+ ### Slash Commands (68) — `src/slash-commands/builtin-registry.ts`
609
648
 
610
- 157 commands registered. All callable via `/<name>` in interactive mode.
649
+ 68 unique top-level commands registered. All callable via `/<name>` in interactive mode.
611
650
 
612
651
  ### Memory Backends (7 / 7) — `src/memory-backend/resolve.ts`
613
652
 
@@ -629,7 +668,7 @@ Set via `memory.backend` in `~/.sns-myagent/config.yaml`. Default is `mnemopi`.
629
668
 
630
669
  ### Multi-Agent Orchestration — `src/agents/`
631
670
 
632
- 7 files. `agents.yaml` config, 3 ensemble strategies (consensus / critic / best-of-N), resilience (retry + circuit-breaker + timeout), 21 tests pass. CLI `orchestrate <prompt>` is wired but executor is stubbed (returns clear "not wired yet" message).
671
+ 7 files. `agents.yaml` config, 3 ensemble strategies (consensus / critic / best-of-N), resilience (retry + circuit-breaker + timeout), 21 tests pass. CLI `orchestrate <prompt>` wired to executor via `src/agents/executor.ts`.
633
672
 
634
673
  ### Terminal UI — `src/tui/` + `src/ui/`
635
674
 
@@ -649,4 +688,4 @@ GitHub Actions runs 7-stage pipeline: typecheck, lint, build, test, diagnose, sm
649
688
 
650
689
  ## Credits
651
690
 
652
- Forked from [Pi Agent / oh-my-pi](https://github.com/can1357/oh-my-pi) by can1357. Stripped to a focused, single-user terminal agent with conversational configuration.
691
+ Built with dedication for single-user terminal coding workflows.
package/bin/snsagent.js CHANGED
@@ -1,47 +1,9 @@
1
1
  #!/usr/bin/env node
2
- // Auto-generated placeholder. fetch-binary.mjs will overwrite this with
3
- // the real shim (bin/snsagent.js) that execs the platform binary.
4
- // This placeholder exists so the npm package tarball always ships a
5
- // valid shim at this path — npm install -g requires it (bin field).
6
- // Without it, npm refuses to symlink `snsagent` to PATH.
2
+ // Auto-generated by fetch-binary.mjs execs the platform binary.
7
3
  import { spawn } from "node:child_process";
8
4
  import { fileURLToPath } from "node:url";
9
5
  import { dirname, join } from "node:path";
10
-
11
6
  const here = dirname(fileURLToPath(import.meta.url));
12
-
13
- // Try common platform binary names (in order).
14
- const candidates = [
15
- "snsagent-linux-x64",
16
- "snsagent-linux-arm64",
17
- "snsagent-darwin-x64",
18
- "snsagent-darwin-arm64",
19
- "snsagent-windows-x64.exe",
20
- ];
21
-
22
- let binary = null;
23
- for (const c of candidates) {
24
- try {
25
- const { statSync } = await import("node:fs");
26
- statSync(join(here, c));
27
- binary = join(here, c);
28
- break;
29
- } catch {
30
- continue;
31
- }
32
- }
33
-
34
- if (!binary) {
35
- process.stderr.write(
36
- `✗ snsagent: platform binary not found.\n` +
37
- ` Expected one of: ${candidates.join(", ")}\n` +
38
- ` in ${here}\n` +
39
- `\n` +
40
- ` Fix: re-run 'npm rebuild @sns-myagent/cli' to retry postinstall,\n` +
41
- ` or run 'curl -fsSL https://raw.githubusercontent.com/Reihantt6/sns-myagent/main/install.sh | bash'.\n`,
42
- );
43
- process.exit(1);
44
- }
45
-
46
- const r = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
7
+ const bin = join(here, "snsagent-linux-x64");
8
+ const r = spawn(bin, process.argv.slice(2), { stdio: "inherit" });
47
9
  r.on("exit", (c) => process.exit(c ?? 0));