fluxflow-cli 1.0.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/ARCHITECTURE.md +46 -0
- package/README.md +68 -0
- package/dist/index.js +2781 -0
- package/fluxflow.png +0 -0
- package/package.json +51 -0
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 🏛️ Architecture & Design
|
|
2
|
+
|
|
3
|
+
Flux Flow is built on a modern, reactive stack that brings web-like development paradigms to the terminal. It utilizes a custom agentic loop for reasoning and a unique dual-model system for background processing.
|
|
4
|
+
|
|
5
|
+
## UI Layer: React & Ink
|
|
6
|
+
|
|
7
|
+
The entire terminal interface is built using **React** via the [Ink](https://github.com/vadimdemedes/ink) renderer.
|
|
8
|
+
- **Component-Based**: The UI is composed of isolated, reusable React components (`ChatLayout`, `StatusBar`, `CommandMenu`, `TerminalBox`, `ProfileForm`).
|
|
9
|
+
- **Reactive State**: The application uses React hooks (`useState`, `useEffect`) to manage user input, application mode, model selection, and the terminal's resizing events.
|
|
10
|
+
- **Zero-Render Overheads**: Critical performance trackers, like the session start time, are kept outside the React render cycle to maintain terminal responsiveness during high-speed AI text streaming.
|
|
11
|
+
|
|
12
|
+
## The Agentic Loop
|
|
13
|
+
|
|
14
|
+
The core intelligence of Flux Flow resides in `src/utils/ai.js`. It does not rely on opaque third-party agent frameworks; instead, it uses a custom, highly transparent string-based protocol powered by an asynchronous generator (`async function*`). This approach allows for real-time UI updates while managing complex multi-step reasoning.
|
|
15
|
+
|
|
16
|
+
The execution flow of a single user prompt follows this loop:
|
|
17
|
+
|
|
18
|
+
1. **Context Assembly**: The user's prompt is combined with the system instructions, temporary session context, persistent user memories, and the current chat history. If the history gets too large (e.g., >128k tokens) and compression is disabled, it is gracefully truncated.
|
|
19
|
+
2. **Stream Processing**: The main loop initiates a streaming request to the Gemini API (`client.models.generateContentStream`). It yields chunks of text and status updates directly back to the React UI as they arrive.
|
|
20
|
+
3. **Detection & Tool Execution**: Once the stream completes for a given turn, the entire response is scanned for tool calls using a custom regex and bracket-balancing parser (looking for `tool:functions.tool_name(args...)`).
|
|
21
|
+
- If tools are found, the loop pauses.
|
|
22
|
+
- Each tool is dispatched to its respective handler in `src/tools/`.
|
|
23
|
+
- Tool outputs are collected and appended to the context as `[TOOL_RESULT]: ...`.
|
|
24
|
+
4. **Security Governance**: During tool execution, the loop enforces security checks (e.g., blocking `exec_command` from accessing system root drives if "External Workspace Access" is off) and pauses for Human-in-the-Loop (HITL) approval if necessary.
|
|
25
|
+
5. **Turn Management & Continuation**: The model is instructed to append `[turn: finish]` if its goal is complete, or `[turn: continue]` if it expects tool results.
|
|
26
|
+
- If tools were called or `[turn: continue]` is present, the loop increments and re-prompts the model with the newly gathered `[TOOL_RESULT]` data.
|
|
27
|
+
- If `[turn: finish]` is detected and no further tools were called, the main loop terminates, passing the final synthesized context to the background Janitor process.
|
|
28
|
+
6. **Loop Limits & Resilience**: To prevent infinite loops or excessive API usage, **Flux mode** is capped at 50 iterations per user prompt, while **Flow mode** is capped at 5. The loop also features built-in retry logic (with exponential backoff) for handling transient API errors like 429s or 503s.
|
|
29
|
+
|
|
30
|
+
## The Dual-Model System
|
|
31
|
+
|
|
32
|
+
To maintain a fast, snappy UI while still performing complex data management, Flux Flow employs two separate AI models for every interaction:
|
|
33
|
+
|
|
34
|
+
### 1. The Main Agent
|
|
35
|
+
- **Responsibility**: Direct user interaction, reasoning, and tool execution.
|
|
36
|
+
- **Behavior**: Streams text directly to the UI. It focuses entirely on solving the user's immediate problem or answering their question.
|
|
37
|
+
|
|
38
|
+
### 2. The Janitor (Background Process)
|
|
39
|
+
- **Responsibility**: System maintenance, long-term memory extraction, and chat summarization.
|
|
40
|
+
- **Behavior**: After the Main Agent finishes its loop, the entire context (User Prompt + Agent Raws) is sent to the Janitor model.
|
|
41
|
+
- **Headless Operation**: The Janitor is explicitly instructed to be a "silent background system process" with "no mouth." It *only* outputs valid tool calls (e.g., updating the chat title or saving a new user preference to the persistent memory vault).
|
|
42
|
+
|
|
43
|
+
## Data Persistence & Safety
|
|
44
|
+
|
|
45
|
+
- **High-Fidelity Lock**: Because both the UI and the Janitor model may attempt to write to the `history.json` file simultaneously, a Promise-based `WRITE_LOCK` (`src/utils/history.js`) is utilized. This prevents race conditions and ensures data integrity.
|
|
46
|
+
- **Encryption**: User secrets and persistent memories (`secret/memories.json`) are handled by `src/utils/crypto.js` to ensure local privacy.
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# 🌌 Flux Flow (`fluxflow-cli`)
|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
### *The High-Fidelity Agentic Terminal for the Flux Era.*
|
|
5
|
+
|
|
6
|
+
**Flux Flow** is not just another CLI—it's a high-speed, sassy, and goal-oriented Terminal AI Agent powered by the latest Gemini frontier models. Designed for developers who demand a premium UI/UX while managing complex file-system tasks, web research, and autonomous workflows.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🚀 Instant Ignition (No Setup Required)
|
|
11
|
+
You don't even need to install it. Just fire up your terminal and run:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Run instantly (Zero Setup)
|
|
15
|
+
npx fluxflow-cli
|
|
16
|
+
|
|
17
|
+
# OR Install Globally
|
|
18
|
+
npm install -g fluxflow-cli
|
|
19
|
+
fluxflow-cli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
*The agent will prompt you for your Gemini API Key on the first run and store it securely in an XOR-encrypted vault.*
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## ✨ Why Flux Flow?
|
|
27
|
+
|
|
28
|
+
### 🎨 **Premium Visual Sovereignty**
|
|
29
|
+
Experience a terminal UI that feels alive. Built with **Ink** and **React**, Flux Flow features:
|
|
30
|
+
- **Dynamic Status Bar**: Real-time telemetry showing your "Neural Headroom" (token usage), Thinking Level, and Session ID.
|
|
31
|
+
- **Archived Terminal Flow**: See execution outputs transform from live elements into permanent conversation records.
|
|
32
|
+
- **Rich Aesthetics**: High-contrast, sleek design with smooth transitions and micro-animations.
|
|
33
|
+
|
|
34
|
+
### 🧠 **The Dual-Intelligence System**
|
|
35
|
+
- **Flux Mode (Dev)**: High-speed, agentic problem solving with a 50-turn persistent loop for massive coding tasks.
|
|
36
|
+
- **Flow Mode (Chat)**: Optimized for deep research, high-quality conversation, and web-assisted reasoning.
|
|
37
|
+
|
|
38
|
+
### 🛡️ **Digital Fortress Governance**
|
|
39
|
+
Security isn't an afterthought; it's a boundary.
|
|
40
|
+
- **External Path Hardlock**: Restricts the agent to your Current Working Directory (CWD) unless you explicitly unlock it.
|
|
41
|
+
- **Human-in-the-Loop (HITL)**: Every file write and terminal command requires your high-fidelity approval.
|
|
42
|
+
- **XOR Vaulting**: All local session histories, memories, and API keys are obfuscated and encrypted at rest.
|
|
43
|
+
|
|
44
|
+
### 🧹 **The Background Janitor**
|
|
45
|
+
While you move at high speed, the Janitor follows behind—refining session titles, compressing data, and ensuring your context window remains at absolute peak performance.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🛠️ Key Capabilities
|
|
50
|
+
- **Deep File-System Interaction**: Edit, move, and refactor code across multiple files with atomic precision.
|
|
51
|
+
- **Real-Time Web Intelligence**: Autonomous web-searching via DuckDuckGo for live news and technical research.
|
|
52
|
+
- **Persistent Memory**: The agent learns from your preferences and project requirements across sessions.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## ⚙️ Configuration
|
|
57
|
+
Type `/settings` in-app to live-configure:
|
|
58
|
+
- **Thinking Level**: Low, Medium, or High (Deep-Reasoning).
|
|
59
|
+
- **Auto-Execution**: For ultimate high-speed flow (Advanced users only).
|
|
60
|
+
- **Security Perimeter**: Toggle External Workspace access.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🏁 License
|
|
65
|
+
MIT © 2026 Flux Flow Team.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
*Forged with ⚡ and 🧬. Welcome to the Flow.*
|