voyageai-cli 1.30.9 → 1.33.0
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.
- package/README.md +125 -4
- package/package.json +11 -2
- package/src/brand/ROBOT_EXAMPLES.md +142 -0
- package/src/brand/VaiRobotDesignSystem.jsx +1035 -0
- package/src/brand/robot.js +635 -0
- package/src/cli.js +51 -6
- package/src/commands/about.js +2 -2
- package/src/commands/bug.js +95 -12
- package/src/commands/chat.js +305 -88
- package/src/commands/completions.js +5 -2
- package/src/commands/config.js +2 -0
- package/src/commands/content.js +90 -0
- package/src/commands/demo.js +843 -61
- package/src/commands/doctor.js +149 -7
- package/src/commands/embed.js +89 -43
- package/src/commands/explain.js +16 -7
- package/src/commands/ingest.js +49 -10
- package/src/commands/init.js +51 -1
- package/src/commands/models.js +6 -2
- package/src/commands/nano.js +52 -0
- package/src/commands/optimize.js +1 -1
- package/src/commands/pipeline.js +44 -8
- package/src/commands/playground.js +330 -59
- package/src/commands/purge.js +1 -1
- package/src/commands/quickstart.js +11 -12
- package/src/commands/refresh.js +1 -1
- package/src/commands/reset.js +225 -0
- package/src/commands/search.js +22 -5
- package/src/commands/telemetry.js +238 -0
- package/src/demo/sample-code/handlers/auth.js +100 -0
- package/src/demo/sample-code/handlers/health.js +71 -0
- package/src/demo/sample-code/handlers/tasks.js +129 -0
- package/src/demo/sample-code/middleware/auth.js +123 -0
- package/src/demo/sample-code/middleware/errors.js +107 -0
- package/src/demo/sample-code/middleware/logger.js +50 -0
- package/src/demo/sample-code/middleware/rate-limit.js +73 -0
- package/src/demo/sample-code/middleware/validate.js +180 -0
- package/src/demo/sample-code/models/database.js +72 -0
- package/src/demo/sample-code/models/task.js +182 -0
- package/src/demo/sample-code/models/user.js +118 -0
- package/src/demo/sample-code/server.js +75 -0
- package/src/demo/sample-code/utils/cache.js +130 -0
- package/src/demo/sample-code/utils/pagination.js +82 -0
- package/src/demo/sample-data/README.md +1 -1
- package/src/demo/sample-data/database/backup-recovery.md +217 -176
- package/src/demo/sample-data/database/constraints.md +242 -195
- package/src/demo/sample-data/database/data-types.md +221 -200
- package/src/demo/sample-data/database/indexes.md +232 -109
- package/src/demo/sample-data/database/migration-guide.md +245 -268
- package/src/demo/sample-data/database/relationships.md +259 -221
- package/src/demo/sample-data/database/replication.md +207 -198
- package/src/demo/sample-data/database/schema-overview.md +242 -164
- package/src/demo/sample-data/database/sharding.md +217 -182
- package/src/demo/sample-data/database/transactions.md +198 -185
- package/src/demo/sample-data/deployment/caching.md +2 -2
- package/src/demo/sample-data/deployment/ci-cd.md +1 -1
- package/src/demo/sample-data/deployment/performance-tuning.md +11 -12
- package/src/demo/sample-data/errors/alerts.md +2 -2
- package/src/demo/sample-data/errors/error-handling.md +2 -2
- package/src/demo/sample-data/errors/troubleshooting.md +2 -2
- package/src/demos/nano.js +461 -0
- package/src/lib/api.js +67 -2
- package/src/lib/banner.js +24 -17
- package/src/lib/chat-session-stats.js +89 -0
- package/src/lib/chat-ui.js +946 -0
- package/src/lib/chat.js +75 -6
- package/src/lib/config.js +42 -2
- package/src/lib/content-generation.js +123 -0
- package/src/lib/content-prompts.js +235 -0
- package/src/lib/demo-ingest.js +307 -73
- package/src/lib/explanations.js +112 -50
- package/src/lib/npm-utils.js +4 -3
- package/src/lib/optimizer.js +10 -2
- package/src/lib/playground-nano-api.js +375 -0
- package/src/lib/playground-optimize-api.js +10 -0
- package/src/lib/playground-rag-api.js +882 -0
- package/src/lib/preflight.js +17 -1
- package/src/lib/prompt.js +73 -11
- package/src/lib/robot-moments.js +277 -0
- package/src/lib/robot.js +597 -0
- package/src/lib/telemetry-catalog.js +293 -0
- package/src/lib/telemetry.js +263 -28
- package/src/lib/ui.js +78 -29
- package/src/lib/welcome.js +114 -0
- package/src/lib/wizard-cli.js +1 -1
- package/src/lib/wizard-steps-chat.js +1 -1
- package/src/lib/wizard-steps-global.js +154 -0
- package/src/lib/wizard-steps-welcome.js +51 -0
- package/src/lib/wizard.js +23 -24
- package/src/mcp/tools/ingest.js +4 -1
- package/src/mcp/tools/utility.js +1 -1
- package/src/nano/nano-bridge.py +243 -0
- package/src/nano/nano-errors.js +108 -0
- package/src/nano/nano-health.js +263 -0
- package/src/nano/nano-local.js +42 -0
- package/src/nano/nano-manager.js +283 -0
- package/src/nano/nano-protocol.js +61 -0
- package/src/nano/nano-setup.js +366 -0
- package/src/nano/requirements.txt +2 -0
- package/src/playground/index.html +3640 -763
- package/src/playground/js/kb-manager.js +388 -0
- package/src/playground/js/kb-ui.js +759 -0
- package/src/playground/js/optimize-charts.js +18 -1
- package/src/playground/js/robot-game-assets.js +423 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://github.com/mrlynn/voyageai-cli/actions/workflows/ci.yml) [](https://www.npmjs.com/package/voyageai-cli) [](https://opensource.org/licenses/MIT) [](https://nodejs.org) [](https://github.com/mrlynn/voyageai-cli/releases)
|
|
8
8
|
|
|
9
|
-
The fastest path from documents to semantic search. Chunk files, generate [Voyage AI](https://
|
|
9
|
+
The fastest path from documents to semantic search. Chunk files, generate [Voyage AI](https://docs.vaicli.com/) embeddings, store in [MongoDB Atlas](https://www.mongodb.com/docs/atlas/atlas-vector-search/), and query with two-stage retrieval — from the terminal, your browser, or a desktop app.
|
|
10
10
|
|
|
11
11
|
> **⚠️ Disclaimer:** This is an independent, community-built tool — **not** an official product of MongoDB, Inc. or Voyage AI. See [Disclaimer](#disclaimer) for details.
|
|
12
12
|
|
|
@@ -83,6 +83,7 @@ RAG workflows from npm<br/><br/>
|
|
|
83
83
|
- [Core Workflow](#core-workflow)
|
|
84
84
|
- [Individual Commands](#individual-commands)
|
|
85
85
|
- [Models & Benchmarks](#models--benchmarks)
|
|
86
|
+
- [Local Inference](#local-inference)
|
|
86
87
|
- [Benchmarking Your Data](#benchmarking-your-data)
|
|
87
88
|
- [Learn](#learn)
|
|
88
89
|
- [Environment & Auth](#environment--auth)
|
|
@@ -428,6 +429,59 @@ vai models --benchmarks
|
|
|
428
429
|
|
|
429
430
|
Also available: `voyage-code-3` (code), `voyage-finance-2` (finance), `voyage-law-2` (legal), `rerank-2.5` / `rerank-2.5-lite`.
|
|
430
431
|
|
|
432
|
+
### Local Inference
|
|
433
|
+
|
|
434
|
+
Run embeddings locally with `voyage-4-nano` -- no API key, no network, no cost.
|
|
435
|
+
Nano shares the same embedding space as the Voyage 4 API models, so you can
|
|
436
|
+
prototype locally and upgrade to the API when ready.
|
|
437
|
+
|
|
438
|
+
**Prerequisites:** Python 3.10+ and ~700MB disk space for the model.
|
|
439
|
+
|
|
440
|
+
#### Setup (one-time)
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
vai nano setup # Creates venv, installs deps, downloads model
|
|
444
|
+
vai nano status # Verify everything is ready
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
#### Usage
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
# Embed text locally
|
|
451
|
+
vai embed "What is MongoDB?" --local
|
|
452
|
+
|
|
453
|
+
# Run the full pipeline locally
|
|
454
|
+
vai pipeline ./docs/ --local --db myapp --collection knowledge
|
|
455
|
+
|
|
456
|
+
# Bulk ingest with local embeddings
|
|
457
|
+
vai ingest --file corpus.jsonl --local --db myapp --collection docs
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### Interactive Demo
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
vai demo nano # Zero-dependency guided walkthrough
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Covers similarity matrices, MRL dimension comparison, and interactive REPL --
|
|
467
|
+
all without an API key or MongoDB connection.
|
|
468
|
+
|
|
469
|
+
#### Nano Commands
|
|
470
|
+
|
|
471
|
+
| Command | Description |
|
|
472
|
+
|---------|-------------|
|
|
473
|
+
| `vai nano setup` | Set up Python venv, install deps, download model |
|
|
474
|
+
| `vai nano status` | Check local inference readiness |
|
|
475
|
+
| `vai nano test` | Smoke-test local inference |
|
|
476
|
+
| `vai nano info` | Show model details and cache location |
|
|
477
|
+
| `vai nano clear-cache` | Remove cached model files |
|
|
478
|
+
|
|
479
|
+
#### Upgrade Path
|
|
480
|
+
|
|
481
|
+
Since nano shares the Voyage 4 embedding space, your local embeddings are
|
|
482
|
+
compatible with `voyage-4`, `voyage-4-lite`, and `voyage-4-large`. No
|
|
483
|
+
re-vectorization needed when you add an API key.
|
|
484
|
+
|
|
431
485
|
### Benchmarking Your Data
|
|
432
486
|
|
|
433
487
|
Published benchmarks measure average quality across standardized datasets. `vai benchmark` measures what matters for **your** use case:
|
|
@@ -501,7 +555,7 @@ vai explain models # How to choose the right model
|
|
|
501
555
|
|
|
502
556
|
| Variable | Required For | Description |
|
|
503
557
|
|----------|-------------|-------------|
|
|
504
|
-
| `VOYAGE_API_KEY` | All embedding/reranking | [Model API key](https://
|
|
558
|
+
| `VOYAGE_API_KEY` | All embedding/reranking | [Model API key](https://docs.vaicli.com/management/api-keys/) from MongoDB Atlas |
|
|
505
559
|
| `MONGODB_URI` | store, search, query, pipeline, index | MongoDB Atlas connection string |
|
|
506
560
|
|
|
507
561
|
Credentials resolve in order: environment variables → `.env` file → `~/.vai/config.json`.
|
|
@@ -532,6 +586,35 @@ vai config set mongodb-uri "mongodb+srv://..."
|
|
|
532
586
|
|
|
533
587
|
Config is stored in `~/.vai/config.json`. Use `vai config get` to see all values (secrets are masked) or `vai config get <key>` for a specific value. The desktop app's Settings → Database page also reads and writes this file.
|
|
534
588
|
|
|
589
|
+
#### Telemetry
|
|
590
|
+
|
|
591
|
+
vai collects anonymous usage telemetry for the CLI and desktop app. On first launch, vai shows a one-time notice before any telemetry is sent. The CLI and desktop app share the same telemetry preference and notice state via `~/.vai/config.json`.
|
|
592
|
+
|
|
593
|
+
Use the built-in telemetry controls:
|
|
594
|
+
|
|
595
|
+
```bash
|
|
596
|
+
vai telemetry
|
|
597
|
+
vai telemetry off
|
|
598
|
+
vai telemetry on
|
|
599
|
+
vai telemetry status
|
|
600
|
+
vai telemetry reset
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
You can also disable telemetry with environment variables:
|
|
604
|
+
|
|
605
|
+
```bash
|
|
606
|
+
export VAI_TELEMETRY=0
|
|
607
|
+
export DO_NOT_TRACK=1
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
For local auditing, set:
|
|
611
|
+
|
|
612
|
+
```bash
|
|
613
|
+
export VAI_TELEMETRY_DEBUG=1
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
This prints telemetry payloads to `stderr` instead of sending them.
|
|
617
|
+
|
|
535
618
|
### Shell Completions
|
|
536
619
|
|
|
537
620
|
```bash
|
|
@@ -724,11 +807,49 @@ vai mcp --transport http --port 3100 # HTTP (remote, multi-client)
|
|
|
724
807
|
|
|
725
808
|
---
|
|
726
809
|
|
|
810
|
+
## Project Structure
|
|
811
|
+
|
|
812
|
+
This is a **monorepo-lite** that separates the CLI from the desktop app:
|
|
813
|
+
|
|
814
|
+
```
|
|
815
|
+
voyageai-cli/
|
|
816
|
+
├── src/ ← Core library + CLI + web playground (npm package)
|
|
817
|
+
├── electron/ ← Desktop app (distributed via GitHub Releases)
|
|
818
|
+
├── docs/ ← Shared documentation
|
|
819
|
+
├── test/ ← Test suites
|
|
820
|
+
└── .github/
|
|
821
|
+
└── workflows/
|
|
822
|
+
├── ci.yml ← Tests + npm publish for CLI
|
|
823
|
+
└── release-app.yml ← Electron builds + GitHub Releases
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
### Distribution Channels
|
|
827
|
+
|
|
828
|
+
| Product | Channel | What users get |
|
|
829
|
+
|---------|---------|----------------|
|
|
830
|
+
| **CLI** (`vai`) | `npm install -g voyageai-cli` | Terminal tool, 22 commands, RAG pipeline |
|
|
831
|
+
| **Web Playground** | `vai playground` | Runs locally, no install beyond the CLI |
|
|
832
|
+
| **Desktop App** | [GitHub Releases](https://github.com/mrlynn/voyageai-cli/releases) | Standalone app, no Node required |
|
|
833
|
+
|
|
834
|
+
### Development Scripts
|
|
835
|
+
|
|
836
|
+
```bash
|
|
837
|
+
# CLI development
|
|
838
|
+
npm test # Run test suite
|
|
839
|
+
npm run test:watch # Watch mode
|
|
840
|
+
|
|
841
|
+
# Electron app development
|
|
842
|
+
npm run app:install # Install electron dependencies
|
|
843
|
+
npm run app:start # Launch electron app
|
|
844
|
+
npm run app:dev # Launch with DevTools
|
|
845
|
+
npm run app:build # Build for all platforms
|
|
846
|
+
```
|
|
847
|
+
|
|
727
848
|
## Requirements
|
|
728
849
|
|
|
729
850
|
- Node.js 18+
|
|
730
851
|
- [MongoDB Atlas](https://www.mongodb.com/atlas) account (free tier works)
|
|
731
|
-
- [Voyage AI model API key](https://
|
|
852
|
+
- [Voyage AI model API key](https://docs.vaicli.com/management/api-keys/) (created in Atlas)
|
|
732
853
|
|
|
733
854
|
## Author
|
|
734
855
|
|
|
@@ -740,7 +861,7 @@ This is a community tool and is not affiliated with, endorsed by, or supported b
|
|
|
740
861
|
|
|
741
862
|
For official documentation and support:
|
|
742
863
|
- **MongoDB:** [mongodb.com](https://www.mongodb.com) | [Atlas](https://www.mongodb.com/atlas) | [Support](https://support.mongodb.com)
|
|
743
|
-
- **Voyage AI:** [MongoDB Voyage AI Docs](https://
|
|
864
|
+
- **Voyage AI:** [MongoDB Voyage AI Docs](https://docs.vaicli.com/)
|
|
744
865
|
|
|
745
866
|
## License
|
|
746
867
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "voyageai-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.33.0",
|
|
4
4
|
"description": "CLI for Voyage AI embeddings, reranking, and MongoDB Atlas Vector Search",
|
|
5
|
+
"_comment": "This package contains the CLI + web playground. The electron/ directory is excluded via .npmignore and distributed via GitHub Releases.",
|
|
5
6
|
"bin": {
|
|
6
7
|
"vai": "./src/cli.js"
|
|
7
8
|
},
|
|
@@ -35,7 +36,14 @@
|
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
38
|
"test": "node --test test/**/*.test.js",
|
|
38
|
-
"
|
|
39
|
+
"reset": "node scripts/reset.js",
|
|
40
|
+
"version": "node scripts/sync-nano-version.js && git add src/nano/nano-bridge.py",
|
|
41
|
+
"release": "./scripts/release.sh",
|
|
42
|
+
"app:install": "cd electron && npm install",
|
|
43
|
+
"app:start": "cd electron && npm start",
|
|
44
|
+
"app:dev": "cd electron && npm run dev",
|
|
45
|
+
"app:build": "cd electron && npm run build",
|
|
46
|
+
"app:package": "cd electron && npm run package"
|
|
39
47
|
},
|
|
40
48
|
"engines": {
|
|
41
49
|
"node": ">=20.0.0"
|
|
@@ -48,6 +56,7 @@
|
|
|
48
56
|
"dotenv": "^17.2.3",
|
|
49
57
|
"mongodb": "^6.0.0",
|
|
50
58
|
"ora": "^9.1.0",
|
|
59
|
+
"pdf-parse": "^2.4.5",
|
|
51
60
|
"picocolors": "^1.1.1",
|
|
52
61
|
"update-notifier": "^7.3.1",
|
|
53
62
|
"zod": "^4.3.6"
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ROBOT_INTEGRATION_EXAMPLES.md
|
|
3
|
+
*
|
|
4
|
+
* How to wire robot moments into existing vai commands.
|
|
5
|
+
* Copy the relevant snippets into each command file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
9
|
+
// 1. vai --help (src/cli.js or wherever your root yargs setup lives)
|
|
10
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
import { moments } from '../lib/robot-moments.js';
|
|
13
|
+
import { readFileSync } from 'fs';
|
|
14
|
+
|
|
15
|
+
const { version } = JSON.parse(readFileSync('package.json', 'utf8'));
|
|
16
|
+
|
|
17
|
+
// Add before yargs .usage() / .epilog():
|
|
18
|
+
moments.greet({ version, name: config.get('user-name') });
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
22
|
+
// 2. vai ingest (src/commands/ingest.js)
|
|
23
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
export async function handler(argv) {
|
|
26
|
+
// Show thinking animation while scanning files
|
|
27
|
+
const anim = moments.startThinking(`Scanning ${argv.path}…`);
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const files = await scanFiles(argv.path);
|
|
31
|
+
// Update label mid-animation isn't built-in, so just stop and restart:
|
|
32
|
+
anim.stop();
|
|
33
|
+
|
|
34
|
+
const anim2 = moments.startThinking(`Embedding ${files.length} files…`);
|
|
35
|
+
const { chunks } = await embedAndIngest(files, argv);
|
|
36
|
+
anim2.stop('success');
|
|
37
|
+
|
|
38
|
+
moments.success(
|
|
39
|
+
`Indexed ${chunks} chunks from ${files.length} files`,
|
|
40
|
+
[
|
|
41
|
+
`Collection: ${argv.collection}`,
|
|
42
|
+
`Model: ${argv.model ?? 'voyage-4-large'}`,
|
|
43
|
+
`Run 'vai search' to test retrieval`,
|
|
44
|
+
]
|
|
45
|
+
);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
anim.stop('error');
|
|
48
|
+
moments.error(err.message, 'Check your MongoDB URI and Voyage AI key');
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
55
|
+
// 3. vai search (src/commands/search.js)
|
|
56
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
57
|
+
|
|
58
|
+
export async function handler(argv) {
|
|
59
|
+
const anim = moments.startSearching(
|
|
60
|
+
`Searching ${argv.collection} · top-${argv.k ?? 5}…`
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
const start = Date.now();
|
|
65
|
+
const hits = await vectorSearch(argv.query, argv);
|
|
66
|
+
anim.stop(hits.length > 0 ? 'success' : 'idle');
|
|
67
|
+
|
|
68
|
+
if (hits.length === 0) {
|
|
69
|
+
moments.noResults(
|
|
70
|
+
argv.collection,
|
|
71
|
+
'Try a broader query or check that documents are ingested'
|
|
72
|
+
);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
moments.results(hits.length, argv.collection, Date.now() - start);
|
|
77
|
+
// ... render hits table as normal
|
|
78
|
+
} catch (err) {
|
|
79
|
+
anim.stop('error');
|
|
80
|
+
moments.error(err.message);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
87
|
+
// 4. vai explain (src/commands/explain.js)
|
|
88
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
export async function handler(argv) {
|
|
91
|
+
moments.explain(argv.topic);
|
|
92
|
+
// ... existing explain output continues below
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
97
|
+
// 5. vai init / vai config (first-run setup)
|
|
98
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
99
|
+
|
|
100
|
+
export async function handler(argv) {
|
|
101
|
+
moments.setup('Let\'s configure vai for your project…');
|
|
102
|
+
|
|
103
|
+
// ... prompts, config writing, etc.
|
|
104
|
+
|
|
105
|
+
moments.success(
|
|
106
|
+
'vai is configured and ready!',
|
|
107
|
+
['Run \'vai ingest\' to embed your first documents']
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
113
|
+
// 6. vai chat (src/commands/chat.js) — during RAG retrieval step
|
|
114
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
115
|
+
|
|
116
|
+
async function handleTurn(userMessage, session) {
|
|
117
|
+
// Show searching animation during retrieval
|
|
118
|
+
const anim = moments.startSearching(`Searching ${session.collection}…`);
|
|
119
|
+
const docs = await retrieveAndRerank(userMessage, session);
|
|
120
|
+
anim.stop();
|
|
121
|
+
|
|
122
|
+
// Show thinking animation during LLM generation
|
|
123
|
+
const anim2 = moments.startThinking(`Generating with ${session.llmModel}…`);
|
|
124
|
+
const response = await streamGenerate(docs, userMessage, session);
|
|
125
|
+
anim2.stop();
|
|
126
|
+
|
|
127
|
+
// ... stream response to terminal
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
132
|
+
// 7. Plain/pipe mode guard (add to any command)
|
|
133
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
134
|
+
|
|
135
|
+
// Check if output is being piped — skip robot in that case
|
|
136
|
+
const isInteractive = process.stdout.isTTY && !argv.plain && !argv.json;
|
|
137
|
+
|
|
138
|
+
if (isInteractive) {
|
|
139
|
+
moments.greet({ version });
|
|
140
|
+
} else {
|
|
141
|
+
// plain text output only, no robot
|
|
142
|
+
}
|