@tokenring-ai/coder 0.1.5 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +814 -151
  2. package/dist/tr-coder +0 -0
  3. package/package.json +29 -17
package/README.md CHANGED
@@ -1,151 +1,814 @@
1
- # Token Ring AI Monorepo
2
-
3
- ## Overview
4
-
5
- The Token Ring AI monorepo hosts the development of the Token Ring Coder Application, an interactive AI-powered developer assistant. This framework enables conversational interaction with codebases, supporting tasks like code editing, refactoring, testing, git operations, and integrations with external services (e.g., AWS, Docker, web search). Built as a TypeScript monorepo using Bun, it provides pluggable packages under the `@tokenring-ai/*` scope for modular AI agent functionality. Key features include persistent chat sessions in SQLite, command-based workflows, plugin extensibility, and sandboxed execution. The ecosystem targets developers seeking AI-assisted coding in a secure, local environment (version 0.1.0, early-stage).
6
-
7
- ## Monorepo Structure
8
-
9
- - **src/**: Core application source, including the main entry point `tr-coder.js` for the CLI REPL.
10
- - **pkg/**: Workspace packages for modular components (e.g., `@tokenring-ai/agent`, `@tokenring-ai/ai-client`). Each package has its own `package.json`, source in `index.ts`, and optional tests/docs.
11
- - **docker/**: Dockerfile and configs for containerized deployment (base: oven/bun:debian).
12
- - **.github/**: CI/CD workflows (e.g., for building/testing).
13
- - **Root configs**: `package.json` (workspaces, scripts), `tsconfig.json` (ES2022, strict mode), `biome.json` (linting/formatting), `.gitmodules` (submodules for external deps like inquirer packages).
14
- - **docs**: `AGENTS.md` (project overview), existing `README.md` (Coder app details).
15
- - Other: `.tokenring/` (per-project config/DB), `node_modules/` (hoisted via workspaces).
16
-
17
- Packages integrate via scoped imports (e.g., `import { Agent } from '@tokenring-ai/agent';`), with the root app wiring them into the Coder CLI.
18
-
19
- ## Installation/Setup
20
-
21
- ### Prerequisites
22
- - Bun (package manager/runtime)
23
- - Git (with submodules support)
24
- - Node.js-compatible env for deps (e.g., for testing)
25
-
26
- ### Cloning and Setup
27
- 1. Clone the repo:
28
- ```
29
- git clone <repo-url>
30
- cd tokenring-ai-monorepo
31
- ```
32
- 2. Initialize submodules (required for external packages like inquirer variants):
33
- ```
34
- git submodule update --init --recursive
35
- ```
36
- 3. Install dependencies (uses Bun workspaces for hoisting):
37
- ```
38
- bun install
39
- ```
40
- 4. (Optional) Initialize a project with Token Ring config:
41
- ```
42
- bun src/tr-coder.js --source ./your-codebase --initialize
43
- ```
44
- This creates `.tokenring/coder-config.js` and SQLite DB for chat history.
45
-
46
- ### Environment Setup
47
- Set API keys for integrations (e.g., AI providers, AWS):
48
- - Export vars like `OPENAI_API_KEY`, `AWS_ACCESS_KEY_ID` (passed to Docker via `-e`).
49
- - For AI clients: Configure via `@tokenring-ai/ai-client` (supports OpenAI, Anthropic, Groq, etc.).
50
-
51
- ### Docker Setup
52
- 1. Build image:
53
- ```
54
- docker build -t tokenring-ai/coder:latest -f docker/Dockerfile .
55
- ```
56
- 2. Run (mounts codebase, passes env):
57
- ```
58
- docker run -ti --net host -v ./:/repo:rw $(env | grep '_KEY' | sed 's/^/-e /') tokenring-ai/coder:latest
59
- ```
60
-
61
- ## Core Packages and Integration
62
-
63
- The monorepo uses workspaces for loosely coupled packages. Core packages form the agent framework; integrations extend tools/resources. Agents compose tools from multiple packages (e.g., an agent using `filesystem` for reads, `git` for commits, `ai-client` for LLM calls).
64
-
65
- ### Core Packages
66
- | Package | Description | Key Exports/Usage |
67
- |---------|--------------------------------------------------------------------------------------------------|-------------------|
68
- | `@tokenring-ai/agent` | Central agent orchestration with event emitters, UUIDs, glob-gitignore. | `Agent` class; integrates tools via registries. Used in CLI for chat sessions. |
69
- | `@tokenring-ai/ai-client` | Multi-provider AI SDK wrapper (OpenAI, Anthropic, Groq, etc., via `@ai-sdk/*`). | LLM calls, streaming; e.g., `generateText({ model: 'gpt-4o' })`. Ties to agent for reasoning. |
70
- | `@tokenring-ai/filesystem` | Abstract FS ops (read/write/search) with ignore patterns. | `FileSystem` interface; extended by `local-filesystem` for local ops. |
71
- | `@tokenring-ai/cli` | Agent CLI for interactive agent selection, chat commands, and human interface handling. | `REPLService` class; provides agent lifecycle management, event streaming, and extensible slash commands. |
72
- | `@tokenring-ai/memory` | In-memory storage for agent state/context. | Session persistence; integrates with `queue` for batched prompts. |
73
- | `@tokenring-ai/queue` | Task queuing for sequential AI operations. | `Queue` class; used for multi-step workflows like code gen + test. |
74
-
75
- ### Integration Packages
76
- These provide domain-specific tools/resources, registered to agents:
77
- - **Cloud/Infra**: `@tokenring-ai/aws` (S3/STF clients), `@tokenring-ai/docker` (container exec), `@tokenring-ai/kubernetes` (K8s client), `@tokenring-ai/s3` (S3 FS impl).
78
- - **CLI/Interface**: `@tokenring-ai/cli` (REPL service with REPLService class, agent selection/creation, chat commands like /help, /exit, /multi, /edit, human interface handlers for confirmations/selections).
79
- - **Dev Tools**: `@tokenring-ai/git` (commit/rollback via execa), `@tokenring-ai/javascript` (ESLint, jscodeshift for JS ops), `@tokenring-ai/testing` (Vitest integration), `@tokenring-ai/code-watch` (chokidar for change detection).
80
- - **Data/DB**: `@tokenring-ai/database` (abstract DB), `@tokenring-ai/mysql` (MySQL2 connector), `@tokenring-ai/sqlite-storage` (local DB for history).
81
- - **Web/Search**: `@tokenring-ai/chrome` (Puppeteer automation), `@tokenring-ai/websearch` (abstract), `@tokenring-ai/serper` (Google search), `@tokenring-ai/scraperapi` (web scraping), `@tokenring-ai/wikipedia` (wiki queries).
82
- - **Other**: `@tokenring-ai/codebase` (repo scanning), `@tokenring-ai/file-index` (vector search with tree-sitter), `@tokenring-ai/feedback` (UI for sessions with React/Express), `@tokenring-ai/sandbox` (isolated exec via Zod validation).
83
-
84
- Cross-package example: The CLI's `REPLService` uses `agent` for team management, provides chat commands via modular command system (/help, /exit, /multi, /edit), handles human interface requests (confirmations, selections, tree navigation), and streams agent events (chat output, reasoning, system messages, busy/idle states). See pkg/ READMEs for details (e.g., pkg/agent/README.md, pkg/cli/README.md).
85
-
86
- ## Usage Examples
87
-
88
- 1. **Running the Coder CLI** (full agent workflow):
89
- ```
90
- bun src/tr-coder.js --source ./my-project
91
- ```
92
- - Chat: "Refactor this function in src/main.ts" → AI edits via `filesystem` + `javascript`.
93
- - Command: `/commit` → Uses `git` to commit with AI message.
94
- - Queue: `/queue add "Run tests"` → Batches via `queue` + `testing`.
95
-
96
- 2. **Building the Monorepo**:
97
- ```
98
- bun run build # Compiles root + workspaces
99
- bun run test # Runs Vitest across pkgs
100
- ```
101
-
102
- 3. **Custom REPL Integration** (in a script):
103
- ```typescript
104
- import { REPLService } from '@tokenring-ai/cli';
105
- import AgentTeam from '@tokenring-ai/agent/AgentTeam';
106
-
107
- const team = new AgentTeam(/* config */);
108
- const repl = new REPLService(team);
109
- await repl.run(); // Starts interactive CLI with agent selection
110
- ```
111
-
112
- ## Configuration Options
113
-
114
- - **Root `package.json`**: Workspaces (`pkg/*`), scripts (e.g., `build:ts` for TSC, `biome` for linting), deps hoisted.
115
- - **tsconfig.json**: ES2022 target, NodeNext resolution, strict TS, includes `src/**/*` + `types/`, excludes tests/dist/pkg tests.
116
- - **biome.json**: Linting/formatting (tabs, double quotes), applies to `src/**/*.js` + `pkg/**/*.js` (excl. some inquirer pkgs).
117
- - **Env Vars**: AI keys (e.g., `ANTHROPIC_API_KEY`), AWS creds, Serper API for search. Per-project: `.tokenring/coder-config.js` for plugins/tests.
118
- - **Yarn/Bun Workspaces**: Hoists root deps; submodules for non-npm pkgs (e.g., inquirer forks).
119
-
120
- ## Build/Development Workflow
121
-
122
- 1. **Build**: `bun run build` (TSC on root + workspaces via `tsc -p tsconfig.tson` in pkgs).
123
- 2. **Test**: `bun run test` (Vitest; per-pkg configs, coverage via `@vitest/coverage-v8`).
124
- 3. **Lint/Format**: `bun run biome` (fixes via Biome); ESLint in some pkgs.
125
- 4. **Typecheck**: `bun run typecheck` (TSC no-emit).
126
- 5. **Contribute**:
127
- - Add pkg: Create `pkg/new-pkg/` with `package.json` (name `@tokenring-ai/new-pkg`, exports `./index.ts`), add to root deps if needed.
128
- - PR: Fork, update submodules, run `bun install`, build/test, submit to main.
129
- - Hooks: Husky for pre-commit (Biome lint).
130
-
131
- Known limitations: Early v0.1.0; submodules may need manual sync; binary deps (e.g., tree-sitter) require build tools.
132
-
133
- ## API/Exports Overview
134
-
135
- Root exports via bin `tr-coder` (CLI). Packages use `exports: { ".": "./index.ts", "./*": "./*.ts" }` for tree-shaking. Import scoped: `import { Tool } from '@tokenring-ai/agent/tools';`. Main root entry: `dist/tr-coder.js`. No direct root API; use packages or CLI.
136
-
137
- ## Dependencies
138
-
139
- - **Root Runtime**: `@inquirer/prompts` (CLI UI), all `@tokenring-ai/*` (internal, version 0.1.0).
140
- - **Dev**: `@biomejs/biome` (lint), `vitest` (test), `husky` (hooks), `typescript` (in pkgs).
141
- - **Hoisting**: Workspaces hoist common deps (e.g., `zod`, `execa`); submodules for custom (e.g., `@tokenring-ai/inquirer-command-prompt`).
142
- - Update: `bun run update-all-dependencies-latest` (via submodules).
143
-
144
- ## Contributing/Notes
145
-
146
- - **Guidelines**: Follow TS strict, Biome rules. Add tests for new pkgs/tools. Document in pkg/ README.md. Reference `AGENTS.md` for architecture.
147
- - **License**: MIT (see LICENSE).
148
- - **Future Plans**: Full CI/CD, more integrations (e.g., GitHub), stable v1.0 with plugin marketplace.
149
- - **Known Issues**: Submodule sync required pre-install; Docker needs env passthrough for keys. For pkg-specific docs, see individual READMEs (e.g., pkg/ai-client/README.md).
150
-
151
- This monorepo powers AI-driven development; extend via packages for custom agents.
1
+ # TokenRing Coder
2
+
3
+ **An AI-powered coding assistant with a comprehensive 45-package ecosystem for local development**
4
+
5
+ TokenRing Coder is an interactive AI assistant designed to help developers with coding tasks like editing, refactoring, testing, and git operations. It runs locally on your machine and supports multiple AI providers while keeping your code secure. The modular ecosystem includes 45 specialized packages covering everything from audio processing to cloud services, communication platforms, and advanced development tools.
6
+
7
+ ## Features
8
+
9
+ ### 🤖 AI & Language Model Support
10
+ - **Multiple AI Providers**: OpenAI, Anthropic, Google, Groq, Cerebras, DeepSeek, and more
11
+ - **Unified AI Client**: Chat, embeddings, and images via Vercel AI SDK
12
+ - **Model Registry**: Dynamic model selection and configuration
13
+ - **Agent Orchestration**: Multi-agent workflows with specialized roles
14
+
15
+ ### 💬 Communication & Collaboration
16
+ - **Slack Integration**: Bot functionality and workspace management
17
+ - **Telegram Integration**: Chat management and message handling
18
+ - **Human Feedback Tools**: File reviews, React component previews, and interactive Q&A
19
+ - **Real-time Communication**: WebSocket API for browser clients
20
+
21
+ ### 🎵 Audio & Media Capabilities
22
+ - **Audio Framework**: Recording, playback, transcription, and text-to-speech
23
+ - **Linux Audio**: Platform-specific implementation using naudiodon2
24
+ - **Native Audio I/O**: PortAudio bindings for high-performance audio operations
25
+
26
+ ### 🌐 Web & External Services
27
+ - **Web Search**: Multiple providers (Serper.dev, ScraperAPI, Chrome automation)
28
+ - **Wikipedia Integration**: Article search and content retrieval
29
+ - **Browser Automation**: Puppeteer scripts for web interaction
30
+ - **Web Scraping**: SERP results and page content fetching
31
+
32
+ ### 🗄️ Database & Storage
33
+ - **Multi-Database Support**: MySQL, SQLite, PostgreSQL via Drizzle ORM
34
+ - **Database Abstraction**: SQL execution, schema inspection, and resource management
35
+ - **AWS S3 Integration**: Cloud storage and content delivery network
36
+ - **Checkpoint Persistence**: Agent state storage across sessions
37
+ - **Task Queuing**: Sequential processing with checkpoint preservation
38
+
39
+ ### ☁️ Cloud & Infrastructure
40
+ - **AWS Integration**: STS/S3 clients with authentication
41
+ - **Docker Support**: Container management and sandbox execution
42
+ - **Kubernetes**: Resource discovery and management across namespaces
43
+ - **Sandbox Environment**: Isolated execution for security
44
+
45
+ ### 🔧 Advanced Development Tools
46
+ - **Code Intelligence**: Semantic file indexing with Tree-sitter integration
47
+ - **Code Watch**: AI comment-triggered modification detection
48
+ - **JavaScript Tooling**: ESLint auto-fix, package management, script execution
49
+ - **Git Integration**: Commits, rollbacks, branch management with auto-commit
50
+ - **Testing Framework**: Agent testing with auto-repair hooks
51
+ - **File System**: Abstract filesystem with ignore patterns and dirty tracking
52
+
53
+ ### 🚀 Workflow Automation
54
+ - **Scripting Language**: Variables, functions, LLM integration, and command sequences
55
+ - **Task Orchestration**: Multi-step workflows with user approval
56
+ - **Batch Processing**: Named iterables system with /foreach command
57
+ - **Memory Management**: Short-term memory and attention storage
58
+
59
+ ### 🌍 Protocol Extensions
60
+ - **MCP Integration**: Model Context Protocol client for external server connectivity
61
+ - **Web Hosting**: Fastify-based service with pluggable resources
62
+ - **Frontend Interface**: Complete React frontend with CLI-style interaction
63
+
64
+ ### 🎯 Specialized Agents
65
+ - **Interactive Agent**: Direct development assistance
66
+ - **Team Leadership**: Full-stack project orchestration
67
+ - **Development Specialists**: Frontend, backend, API, database design
68
+ - **Quality Assurance**: Testing, code review, security assessment
69
+ - **Infrastructure**: DevOps, performance, architecture design
70
+
71
+ ## 🚀 Quick Start
72
+
73
+ ### Option 1: Run with npx (Easiest)
74
+
75
+ ```bash
76
+ # Initialize your project
77
+ npx @tokenring-ai/coder --source ./your-project --initialize
78
+
79
+ # Set up API keys
80
+ export OPENAI_API_KEY="your-key-here"
81
+ export ANTHROPIC_API_KEY="your-key-here"
82
+
83
+ # Start coding with AI
84
+ npx @tokenring-ai/coder --source ./your-project
85
+ ```
86
+
87
+ ### Option 2: Run with Docker
88
+
89
+ ```bash
90
+ # Pull from GitHub Container Registry
91
+ docker pull ghcr.io/tokenring-ai/tokenring-coder:latest
92
+
93
+ # Initialize your project
94
+ docker run -ti --rm \
95
+ -v ./your-project:/repo:rw \
96
+ ghcr.io/tokenring-ai/tokenring-coder:latest \
97
+ --source /repo --initialize
98
+
99
+ # Start coding with AI
100
+ docker run -ti --rm \
101
+ -v ./your-project:/repo:rw \
102
+ -e OPENAI_API_KEY \
103
+ -e ANTHROPIC_API_KEY \
104
+ ghcr.io/tokenring-ai/tokenring-coder:latest \
105
+ --source /repo
106
+ ```
107
+
108
+ ### Option 3: Clone and Build from Source
109
+
110
+ ```bash
111
+ # Clone and setup
112
+ git clone https://github.com/tokenring-ai/coder.git tokenring-coder
113
+ cd tokenring-coder
114
+ git submodule update --init --recursive
115
+ bun install
116
+
117
+ # Initialize your project
118
+ bun src/tr-coder.ts --source ./your-project --initialize
119
+
120
+ # Set up API keys
121
+ export OPENAI_API_KEY="your-key-here"
122
+ export ANTHROPIC_API_KEY="your-key-here"
123
+
124
+ # Start coding with AI
125
+ bun src/tr-coder.ts --source ./your-project
126
+ ```
127
+
128
+ ### Option 4: Web Interface
129
+
130
+ ```bash
131
+ # Start with web frontend
132
+ bun run web
133
+
134
+ # Access at http://localhost:3000
135
+ # Features real-time agent communication via WebSocket
136
+ ```
137
+
138
+ ## 💡 Usage Examples
139
+
140
+ ### Basic Chat
141
+
142
+ ```
143
+ > Help me refactor this function to be more readable
144
+ > Add error handling to the user authentication code
145
+ > Write unit tests for the payment processing module
146
+ ```
147
+
148
+ ### Advanced Multi-Agent Workflows
149
+
150
+ ```
151
+ > @teamLeader Create a new user dashboard feature with React frontend and Node.js backend
152
+ > @frontendDesign Implement responsive components with state management
153
+ > @backendDesign Create REST API endpoints with authentication
154
+ > @testEngineer Add comprehensive tests for the new feature
155
+ > @devopsEngineer Set up CI/CD pipeline and deployment configuration
156
+ ```
157
+
158
+ ### Communication Platform Integration
159
+
160
+ ```
161
+ > Post this update to our Slack channel #development
162
+ > Send a notification to Telegram group about the deployment
163
+ > Ask for human feedback on the new UI design
164
+ ```
165
+
166
+ ### Advanced Scripting and Automation
167
+
168
+ ```
169
+ > script
170
+ var = projectVersion = "1.2.0"
171
+ func = updateVersion() {
172
+ replaceInFile("package.json", /"version": "[^"]+"/, `"version": "${var}"`)
173
+ commit("Update version to ${var}")
174
+ }
175
+ call updateVersion()
176
+ > end
177
+
178
+ > foreach file in "src/**/*.ts" do
179
+ eslint --fix ${file}
180
+ test ${file}
181
+ > end
182
+ ```
183
+
184
+ ### Database and Cloud Operations
185
+
186
+ ```
187
+ > Connect to MySQL database and create users table
188
+ > Upload static assets to S3 CDN
189
+ > Deploy container to Kubernetes cluster
190
+ > Run backup script and store checkpoint in database
191
+ ```
192
+
193
+ ### Audio and Media Processing
194
+
195
+ ```
196
+ > Record audio meeting notes and transcribe to text
197
+ > Convert documentation to speech for accessibility
198
+ > Process audio files for podcast production
199
+ ```
200
+
201
+ ## 🤖 Available Agents
202
+
203
+ TokenRing Coder includes specialized AI agents for different development tasks:
204
+
205
+ ### Interactive Agent
206
+ - **interactiveCodeAgent** - Interactive code assistant for direct development tasks
207
+
208
+ ### Planning & Management
209
+ - **teamLeader** - Orchestrates full-stack projects, coordinates specialists, manages workflow
210
+ - **productManager** - Creates PRDs, defines user stories, plans feature roadmaps
211
+ - **productDesignEngineer** - Product enhancement and comprehensive PRD creation
212
+ - **systemArchitect** - Designs system architectures and selects technology stacks
213
+
214
+ ### Development Specialists
215
+ - **fullStackDeveloper** - Implements complete features across frontend and backend
216
+ - **frontendDesign** - Creates React/Vue components, responsive layouts, state management
217
+ - **backendDesign** - Implements server-side logic, business rules, data processing
218
+ - **apiDesigner** - Designs REST/GraphQL APIs, creates OpenAPI specifications
219
+ - **databaseDesign** - Designs schemas, implements migrations, optimizes queries
220
+
221
+ ### Engineering Specialists
222
+ - **businessLogicEngineer** - Implements workflows, rules engines, automation systems
223
+ - **dataEngineer** - Creates ETL pipelines, data migrations, processing workflows
224
+ - **integrationEngineer** - Implements third-party integrations, APIs, webhooks
225
+ - **authDesign** - Designs authentication/authorization systems, OAuth/OIDC
226
+
227
+ ### Quality & Operations
228
+ - **testEngineer** - Creates unit/integration/E2E tests, test automation
229
+ - **codeQualityEngineer** - Code reviews, refactoring, standards enforcement
230
+ - **securityReview** - Security assessments, vulnerability remediation, OWASP compliance
231
+ - **performanceEngineer** - Performance optimization, caching, monitoring, scalability
232
+ - **devopsEngineer** - CI/CD pipelines, Docker configs, infrastructure setup
233
+
234
+ ### Design & Documentation
235
+ - **uiUxDesigner** - Creates wireframes, design systems, user flows
236
+ - **documentationEngineer** - Technical documentation, API docs, user guides
237
+
238
+ ## 🏗️ Architecture
239
+
240
+ TokenRing Coder is built as a modular TypeScript monorepo with 45 specialized packages:
241
+
242
+ ### Core Foundation
243
+ - **@tokenring-ai/app**: Base application framework with service management and plugin architecture
244
+ - **@tokenring-ai/agent**: Central orchestrator for AI agents with tools, commands, and state persistence
245
+ - **@tokenring-ai/utility**: Shared utilities (cache, logging, shell escape) used across packages
246
+
247
+ ### AI & Language Models
248
+ - **@tokenring-ai/ai-client**: Unified AI client for chat/embeddings/images via Vercel AI SDK
249
+ - **@tokenring-ai/chat**: AI chat client with model configuration, tool management, and message history
250
+
251
+ ### Storage & Database
252
+ - **@tokenring-ai/database**: Abstract database layer with resource management and SQL execution
253
+ - **@tokenring-ai/mysql**: MySQL integration with connection pooling and schema inspection
254
+ - **@tokenring-ai/drizzle-storage**: Multi-database storage using Drizzle ORM (SQLite, MySQL, PostgreSQL)
255
+ - **@tokenring-ai/checkpoint**: Checkpoint service for agent state persistence
256
+ - **@tokenring-ai/queue**: Task queuing with checkpoint preservation for sequential processing
257
+ - **@tokenring-ai/s3**: AWS S3 filesystem and CDN implementation
258
+ - **@tokenring-ai/cdn**: Abstract CDN service for content delivery networks
259
+
260
+ ### Development Tools
261
+ - **@tokenring-ai/testing**: Agent testing framework with auto-repair hooks and shell command resources
262
+ - **@tokenring-ai/git**: Git operations with auto-commit functionality after tests
263
+ - **@tokenring-ai/javascript**: JavaScript development tools including ESLint, package management, and script execution
264
+ - **@tokenring-ai/codebase**: Codebase injection into agent context via memories and resources
265
+ - **@tokenring-ai/code-watch**: AI comment-triggered file modification detection and agent spawning
266
+ - **@tokenring-ai/file-index**: Semantic file search and indexing with Tree-sitter integration
267
+ - **@tokenring-ai/iterables**: Named iterables system for batch processing with /foreach command
268
+ - **@tokenring-ai/scripting**: Scripting language with variables, functions, and LLM integration
269
+ - **@tokenring-ai/tasks**: Task planning and multi-agent workflow orchestration
270
+
271
+ ### Web & External Services
272
+ - **@tokenring-ai/websearch**: Abstract web search interface with pluggable providers
273
+ - **@tokenring-ai/serper**: Google search via Serper.dev API
274
+ - **@tokenring-ai/scraperapi**: Web scraping and SERP results via ScraperAPI
275
+ - **@tokenring-ai/chrome**: Puppeteer browser automation for web scraping and interaction
276
+ - **@tokenring-ai/wikipedia**: Wikipedia API integration for article search and content retrieval
277
+ - **@tokenring-ai/aws**: AWS integration with STS/S3 clients and authentication
278
+ - **@tokenring-ai/docker**: Docker container management with sandbox provider
279
+ - **@tokenring-ai/kubernetes**: Kubernetes resource discovery and management
280
+ - **@tokenring-ai/sandbox**: Abstract sandbox interface for isolated execution
281
+ - **@tokenring-ai/mcp**: Model Context Protocol client for external server integration
282
+
283
+ ### Communication & Collaboration
284
+ - **@tokenring-ai/slack**: Slack bot integration for workspace communication
285
+ - **@tokenring-ai/telegram**: Telegram bot integration for chat and message handling
286
+ - **@tokenring-ai/feedback**: Human feedback tools for file reviews and React component previews
287
+
288
+ ### Audio & Media
289
+ - **@tokenring-ai/audio**: Abstract audio framework for recording, playback, and speech processing
290
+ - **@tokenring-ai/linux-audio**: Linux-specific audio implementation using naudiodon2
291
+ - **@tokenring-ai/naudiodon3**: Native PortAudio bindings for audio I/O operations
292
+
293
+ ### UI & Frontend
294
+ - **@tokenring-ai/cli**: REPL service with interactive prompts and command processing
295
+ - **@tokenring-ai/inquirer-command-prompt**: Command prompt with history and auto-completion
296
+ - **@tokenring-ai/inquirer-tree-selector**: Tree-based selection interface for hierarchical navigation
297
+ - **@tokenring-ai/web-host**: Fastify-based web hosting service for static files and APIs
298
+ - **@tokenring-ai/web-frontend**: Complete React frontend with CLI-style interface and agent management
299
+ - **@tokenring-ai/agent-api**: WebSocket API for real-time agent communication and browser client integration
300
+
301
+ ### Filesystem & Storage
302
+ - **@tokenring-ai/filesystem**: Abstract filesystem with read/write/search operations and ignore filters
303
+ - **@tokenring-ai/local-filesystem**: Local disk filesystem implementation with file watching
304
+
305
+ ## 🔄 Advanced Workflows
306
+
307
+ ### Multi-Agent Task Orchestration
308
+
309
+ The `@tokenring-ai/tasks` package enables complex multi-agent workflows:
310
+
311
+ ```typescript
312
+ const taskService = new TaskService(app);
313
+ await taskService.executeTask({
314
+ description: "Implement e-commerce checkout system",
315
+ steps: [
316
+ { agent: "systemArchitect", action: "design architecture" },
317
+ { agent: "backendDesign", action: "create API endpoints" },
318
+ { agent: "frontendDesign", action: "build checkout UI" },
319
+ { agent: "testEngineer", action: "write integration tests" },
320
+ { agent: "devopsEngineer", action: "setup deployment pipeline" }
321
+ ]
322
+ });
323
+ ```
324
+
325
+ ### Advanced Scripting and Automation
326
+
327
+ The `@tokenring-ai/scripting` package provides a powerful scripting language:
328
+
329
+ ```typescript
330
+ // Variables and functions
331
+ > script
332
+ var = apiUrl = "https://api.example.com"
333
+ var = timeout = 5000
334
+ func = fetchData(endpoint) {
335
+ return fetch(${apiUrl}/${endpoint}, { timeout: ${timeout} })
336
+ }
337
+
338
+ // Conditional logic
339
+ if (user.role === "admin") {
340
+ grantAccess()
341
+ }
342
+
343
+ // Loops
344
+ for (let i = 0; i < 10; i++) {
345
+ log("Processing item ${i}")
346
+ }
347
+ > end
348
+ ```
349
+
350
+ ### Database Integration and Migrations
351
+
352
+ Multi-database support with Drizzle ORM:
353
+
354
+ ```typescript
355
+ // SQLite for development
356
+ const sqliteStorage = createSQLiteStorage('./dev.db')
357
+
358
+ // MySQL for production
359
+ const mysqlStorage = createMySQLStorage({
360
+ host: 'localhost',
361
+ user: 'admin',
362
+ password: 'password',
363
+ database: 'tokenring'
364
+ })
365
+
366
+ // PostgreSQL for cloud
367
+ const postgresStorage = createPostgresStorage({
368
+ connectionString: 'postgresql://user:pass@host:port/db'
369
+ })
370
+ ```
371
+
372
+ ### Cloud and Infrastructure Management
373
+
374
+ Comprehensive cloud integration:
375
+
376
+ ```typescript
377
+ // AWS S3 operations
378
+ await s3.uploadFile('build/', 'dist/', 'my-app-v1.0.0.zip')
379
+ await s3.createCDNDistribution('cdn.example.com')
380
+
381
+ // Docker container management
382
+ await docker.buildImage('Dockerfile', 'my-app:latest')
383
+ await docker.runContainer('my-app:latest', { port: 3000 })
384
+
385
+ // Kubernetes deployment
386
+ await k8s.deploy('deployment.yaml', 'production')
387
+ await k8s.scale('my-app', 3)
388
+ ```
389
+
390
+ ### Communication Platform Integration
391
+
392
+ Seamless team communication:
393
+
394
+ ```typescript
395
+ // Slack notifications
396
+ await slack.postMessage('#dev-team', 'Deployment completed successfully')
397
+
398
+ // Telegram alerts
399
+ await telegram.sendGroup('dev-alerts', 'Critical issue detected in production')
400
+
401
+ // Human feedback collection
402
+ const feedback = await feedback.getFileReview('design-spec.pdf')
403
+ await feedback.previewReactComponent(<Dashboard />)
404
+ ```
405
+
406
+ ## ⚙️ Configuration
407
+
408
+ Configuration is stored in `.tokenring/coder-config.mjs` in your project:
409
+
410
+ ```javascript
411
+ export default {
412
+ // Default settings
413
+ defaults: {
414
+ agent: "teamLeader",
415
+ model: "gpt-4o",
416
+ webHost: {
417
+ port: 3000,
418
+ enableWebSocket: true
419
+ }
420
+ },
421
+
422
+ // AI model configurations
423
+ models: {
424
+ openai: {
425
+ displayName: "OpenAI",
426
+ apiKey: process.env.OPENAI_API_KEY,
427
+ baseURL: "https://api.openai.com/v1"
428
+ },
429
+ anthropic: {
430
+ displayName: "Anthropic",
431
+ apiKey: process.env.ANTHROPIC_API_KEY,
432
+ baseURL: "https://api.anthropic.com"
433
+ },
434
+ groq: {
435
+ displayName: "Groq",
436
+ apiKey: process.env.GROQ_API_KEY,
437
+ baseURL: "https://api.groq.com/openai/v1"
438
+ }
439
+ },
440
+
441
+ // Database connections
442
+ storage: {
443
+ type: "drizzle",
444
+ providers: {
445
+ sqlite: {
446
+ file: "./data/tokenring.db"
447
+ },
448
+ mysql: {
449
+ host: process.env.DB_HOST,
450
+ user: process.env.DB_USER,
451
+ password: process.env.DB_PASSWORD,
452
+ database: process.env.DB_NAME
453
+ }
454
+ }
455
+ },
456
+
457
+ // Cloud services
458
+ cloud: {
459
+ aws: {
460
+ region: "us-east-1",
461
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
462
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
463
+ },
464
+ s3: {
465
+ bucket: "my-app-assets",
466
+ cdnDomain: "cdn.myapp.com"
467
+ }
468
+ },
469
+
470
+ // Communication platforms
471
+ communication: {
472
+ slack: {
473
+ botToken: process.env.SLACK_BOT_TOKEN,
474
+ signingSecret: process.env.SLACK_SIGNING_SECRET
475
+ },
476
+ telegram: {
477
+ botToken: process.env.TELEGRAM_BOT_TOKEN
478
+ }
479
+ },
480
+
481
+ // Audio settings
482
+ audio: {
483
+ provider: "linux-audio",
484
+ sampleRate: 44100,
485
+ channels: 2
486
+ },
487
+
488
+ // Development tools
489
+ tools: {
490
+ eslint: {
491
+ config: ".eslintrc.js",
492
+ autoFix: true
493
+ },
494
+ testing: {
495
+ framework: "vitest",
496
+ coverage: true
497
+ }
498
+ }
499
+ };
500
+ ```
501
+
502
+ ## 🐳 Docker Usage
503
+
504
+ ### Using Pre-built Image from GHCR
505
+
506
+ ```bash
507
+ # Pull latest image
508
+ docker pull ghcr.io/tokenring-ai/tokenring-coder:latest
509
+
510
+ # Run with your project mounted
511
+ docker run -ti --rm \
512
+ -v ./your-project:/repo:rw \
513
+ -v ~/.tokenring:/root/.tokenring:ro \
514
+ -e OPENAI_API_KEY \
515
+ -e ANTHROPIC_API_KEY \
516
+ -e AWS_ACCESS_KEY_ID \
517
+ -e AWS_SECRET_ACCESS_KEY \
518
+ -e SLACK_BOT_TOKEN \
519
+ -e TELEGRAM_BOT_TOKEN \
520
+ ghcr.io/tokenring-ai/tokenring-coder:latest \
521
+ --source /repo
522
+
523
+ # Run with web interface
524
+ docker run -ti --rm \
525
+ -p 3000:3000 \
526
+ -v ./your-project:/repo:rw \
527
+ ghcr.io/tokenring-ai/tokenring-coder:latest \
528
+ --web
529
+ ```
530
+
531
+ ### Building Custom Image
532
+
533
+ ```dockerfile
534
+ FROM ghcr.io/tokenring-ai/tokenring-coder:latest
535
+
536
+ # Install additional dependencies
537
+ RUN apt-get update && apt-get install -y \
538
+ portaudio19-dev \
539
+ libpq-dev \
540
+ mysql-client \
541
+ && rm -rf /var/lib/apt/lists/*
542
+
543
+ # Add custom configuration
544
+ COPY .tokenring/coder-config.mjs /root/.tokenring/coder-config.mjs
545
+
546
+ # Expose web interface
547
+ EXPOSE 3000
548
+ ```
549
+
550
+ ### Docker Compose Setup
551
+
552
+ ```yaml
553
+ version: '3.8'
554
+ services:
555
+ tokenring-coder:
556
+ image: ghcr.io/tokenring-ai/tokenring-coder:latest
557
+ container_name: tokenring-coder
558
+ ports:
559
+ - "3000:3000"
560
+ volumes:
561
+ - ./your-project:/repo:rw
562
+ - ~/.tokenring:/root/.tokenring:ro
563
+ environment:
564
+ - OPENAI_API_KEY=${OPENAI_API_KEY}
565
+ - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
566
+ - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
567
+ - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
568
+ - SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN}
569
+ - TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
570
+ networks:
571
+ - tokenring-network
572
+
573
+ # Optional: MySQL database
574
+ mysql:
575
+ image: mysql:8.0
576
+ container_name: tokenring-mysql
577
+ environment:
578
+ - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
579
+ - MYSQL_DATABASE=tokenring
580
+ volumes:
581
+ - mysql-data:/var/lib/mysql
582
+ networks:
583
+ - tokenring-network
584
+
585
+ # Optional: Redis for caching
586
+ redis:
587
+ image: redis:7-alpine
588
+ container_name: tokenring-redis
589
+ volumes:
590
+ - redis-data:/data
591
+ networks:
592
+ - tokenring-network
593
+
594
+ volumes:
595
+ mysql-data:
596
+ redis-data:
597
+
598
+ networks:
599
+ tokenring-network:
600
+ driver: bridge
601
+ ```
602
+
603
+ ## 🛠️ Development
604
+
605
+ ### Building the Project
606
+
607
+ ```bash
608
+ # Install dependencies
609
+ bun install
610
+
611
+ # Build all packages
612
+ bun run build
613
+
614
+ # Run tests
615
+ bun run test
616
+
617
+ # Format code
618
+ bun run biome
619
+
620
+ # Lint code
621
+ bun run lint
622
+
623
+ # Type check
624
+ bun run type-check
625
+
626
+ # Start development server
627
+ bun run coder
628
+
629
+ # Start web interface
630
+ bun run web
631
+
632
+ # Run specific package tests
633
+ cd pkg/database && bun test
634
+ cd pkg/ai-client && bun test
635
+ ```
636
+
637
+ ### Adding New Packages
638
+
639
+ ```bash
640
+ # Create new package directory
641
+ mkdir -p pkg/my-new-package
642
+
643
+ # Initialize package structure
644
+ cd pkg/my-new-package
645
+ cat > package.json << EOF
646
+ {
647
+ "name": "@tokenring-ai/my-new-package",
648
+ "version": "0.1.0",
649
+ "type": "module",
650
+ "exports": {
651
+ "./*": "./*.ts"
652
+ },
653
+ "dependencies": {
654
+ "@tokenring-ai/agent": "^0.1.0",
655
+ "@tokenring-ai/utility": "^0.1.0"
656
+ }
657
+ }
658
+ EOF
659
+
660
+ # Create main module
661
+ cat > index.ts << EOF
662
+ import { TokenRingPackage } from '@tokenring-ai/agent';
663
+
664
+ export const myNewPackage = new TokenRingPackage({
665
+ name: 'my-new-package',
666
+ version: '0.1.0',
667
+ description: 'My new TokenRing package',
668
+ tools: [],
669
+ commands: [],
670
+ services: []
671
+ });
672
+
673
+ export default myNewPackage;
674
+ EOF
675
+
676
+ # Create README
677
+ cat > README.md << EOF
678
+ # @tokenring-ai/my-new-package
679
+
680
+ Description of my new package.
681
+
682
+ ## Installation
683
+
684
+ \`\`\`bash
685
+ bun add @tokenring-ai/my-new-package
686
+ \`\`\`
687
+
688
+ ## Usage
689
+
690
+ \`\`\`typescript
691
+ import { myNewPackage } from '@tokenring-ai/my-new-package';
692
+ \`\`\`
693
+ EOF
694
+ ```
695
+
696
+ ### Development Workflow
697
+
698
+ 1. **Setup Environment**: Install dependencies and configure environment variables
699
+ 2. **Choose Development Mode**: CLI, web interface, or custom application
700
+ 3. **Configure Agents**: Select appropriate agents for your workflow
701
+ 4. **Use Development Tools**: Leverage code intelligence, testing, and debugging
702
+ 5. **Integrate Services**: Connect databases, cloud services, and communication platforms
703
+ 6. **Deploy and Monitor**: Use DevOps tools for deployment and monitoring
704
+
705
+ ## 📦 Package Ecosystem Overview
706
+
707
+ The TokenRing Coder ecosystem consists of 45 specialized packages organized into functional categories:
708
+
709
+ ### Core Foundation (3 packages)
710
+ - **app**: Application framework and service management
711
+ - **agent**: Central orchestrator for AI agents
712
+ - **utility**: Shared utilities and helper functions
713
+
714
+ ### AI & Language Models (2 packages)
715
+ - **ai-client**: Unified AI client interface
716
+ - **chat**: AI chat configuration and tool management
717
+
718
+ ### Storage & Database (7 packages)
719
+ - **database**: Abstract database layer
720
+ - **mysql**: MySQL integration
721
+ - **drizzle-storage**: Multi-database ORM support
722
+ - **checkpoint**: Agent state persistence
723
+ - **queue**: Task queuing system
724
+ - **s3**: AWS S3 integration
725
+ - **cdn**: Content delivery network abstraction
726
+
727
+ ### Development Tools (9 packages)
728
+ - **testing**: Agent testing framework
729
+ - **git**: Version control integration
730
+ - **javascript**: JavaScript tooling
731
+ - **codebase**: Codebase context injection
732
+ - **code-watch**: File modification detection
733
+ - **file-index**: Semantic file search
734
+ - **iterables**: Batch processing system
735
+ - **scripting**: Scripting language
736
+ - **tasks**: Workflow orchestration
737
+
738
+ ### Web & External Services (10 packages)
739
+ - **websearch**: Web search abstraction
740
+ - **serper**: Google search provider
741
+ - **scraperapi**: Web scraping service
742
+ - **chrome**: Browser automation
743
+ - **wikipedia**: Wikipedia integration
744
+ - **aws**: AWS cloud services
745
+ - **docker**: Container management
746
+ - **kubernetes**: K8s integration
747
+ - **sandbox**: Execution environment
748
+ - **mcp**: Protocol extensions
749
+
750
+ ### Communication & Collaboration (3 packages)
751
+ - **slack**: Slack bot integration
752
+ - **telegram**: Telegram bot integration
753
+ - **feedback**: Human feedback tools
754
+
755
+ ### Audio & Media (3 packages)
756
+ - **audio**: Audio processing framework
757
+ - **linux-audio**: Linux audio implementation
758
+ - **naudiodon3**: Native audio bindings
759
+
760
+ ### UI & Frontend (6 packages)
761
+ - **cli**: Command line interface
762
+ - **inquirer-command-prompt**: Interactive prompts
763
+ - **inquirer-tree-selector**: Tree selection interface
764
+ - **web-host**: Web server foundation
765
+ - **web-frontend**: React frontend
766
+ - **agent-api**: WebSocket API
767
+
768
+ ### Filesystem & Storage (2 packages)
769
+ - **filesystem**: Abstract filesystem interface
770
+ - **local-filesystem**: Local filesystem implementation
771
+
772
+ ## 🤝 Contributing
773
+
774
+ 1. Fork the repository
775
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
776
+ 3. Make your changes following the coding standards
777
+ 4. Add tests for new functionality
778
+ 5. Run `bun run biome` to format code
779
+ 6. Update documentation as needed
780
+ 7. Submit a pull request
781
+
782
+ ### Development Guidelines
783
+
784
+ - Follow TypeScript best practices
785
+ - Use consistent naming conventions
786
+ - Write comprehensive tests
787
+ - Document all public APIs
788
+ - Respect semantic versioning
789
+ - Keep packages focused and modular
790
+
791
+ ## 📄 License
792
+
793
+ MIT License - see [LICENSE](LICENSE) for details.
794
+
795
+ ## 🆘 Support
796
+
797
+ - **Documentation**: Comprehensive guides in the `docs/` directory
798
+ - **Package READMEs**: Detailed documentation for each package in `pkg/*/README.md`
799
+ - **Issues**: Report bugs and request features on GitHub
800
+ - **Community**: Join discussions in the repository discussions section
801
+ - **Examples**: Sample implementations in the `examples/` directory
802
+
803
+ ## 🔗 Related Resources
804
+
805
+ - [PACKAGES.md](PACKAGES.md) - Complete package index and architecture documentation
806
+ - [docs/](docs/) - Detailed guides and tutorials
807
+ - [examples/](examples/) - Sample implementations and use cases
808
+ - [pkg/](pkg/) - Individual package documentation
809
+
810
+ ---
811
+
812
+ **Ready to supercharge your coding workflow with AI? Explore the complete 45-package ecosystem and transform your development experience!** 🚀
813
+
814
+ *Built with ❤️ by the TokenRing AI team*
package/dist/tr-coder CHANGED
Binary file
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "@tokenring-ai/coder",
3
3
  "description": "TokenRing Coder Application",
4
- "version": "0.1.5",
5
- "dependencies": {
6
- "@inquirer/prompts": "^7.8.3",
7
- "@tokenring-ai/audio": "workspace:*",
4
+ "version": "0.2.0",
5
+ "devDependencies": {
6
+ "@inquirer/prompts": "^8.0.1",
8
7
  "@tokenring-ai/agent": "workspace:*",
9
8
  "@tokenring-ai/ai-client": "workspace:*",
9
+ "@tokenring-ai/audio": "workspace:*",
10
10
  "@tokenring-ai/aws": "workspace:*",
11
- "@tokenring-ai/chrome": "workspace:*",
11
+ "@tokenring-ai/chat": "workspace:*",
12
12
  "@tokenring-ai/checkpoint": "workspace:*",
13
+ "@tokenring-ai/chrome": "workspace:*",
13
14
  "@tokenring-ai/cli": "workspace:*",
15
+ "@tokenring-ai/cli-ink": "workspace:*",
14
16
  "@tokenring-ai/code-watch": "workspace:*",
15
17
  "@tokenring-ai/codebase": "workspace:*",
16
18
  "@tokenring-ai/database": "workspace:*",
17
19
  "@tokenring-ai/docker": "workspace:*",
20
+ "@tokenring-ai/drizzle-storage": "workspace:*",
18
21
  "@tokenring-ai/feedback": "workspace:*",
19
22
  "@tokenring-ai/file-index": "workspace:*",
20
23
  "@tokenring-ai/filesystem": "workspace:*",
@@ -26,27 +29,41 @@
26
29
  "@tokenring-ai/mcp": "workspace:*",
27
30
  "@tokenring-ai/memory": "workspace:*",
28
31
  "@tokenring-ai/mysql": "workspace:*",
32
+ "@tokenring-ai/app": "workspace:*",
29
33
  "@tokenring-ai/queue": "workspace:*",
30
34
  "@tokenring-ai/s3": "workspace:*",
31
35
  "@tokenring-ai/sandbox": "workspace:*",
32
36
  "@tokenring-ai/scraperapi": "workspace:*",
33
37
  "@tokenring-ai/scripting": "workspace:*",
34
38
  "@tokenring-ai/serper": "workspace:*",
35
- "@tokenring-ai/sqlite-storage": "workspace:*",
39
+ "@tokenring-ai/slack": "workspace:*",
36
40
  "@tokenring-ai/tasks": "workspace:*",
41
+ "@tokenring-ai/telegram": "workspace:*",
37
42
  "@tokenring-ai/testing": "workspace:*",
43
+ "@tokenring-ai/utility": "workspace:*",
44
+ "@tokenring-ai/web-host": "workspace:*",
38
45
  "@tokenring-ai/websearch": "workspace:*",
39
- "@biomejs/biome": "^2.2.0",
46
+ "@types/bun": "^1.3.2",
47
+ "bun-types": "^1.3.2",
48
+ "chalk": "^5.6.2",
49
+ "commander": "^14.0.2",
40
50
  "husky": "^9.1.7",
41
- "jsdom": "^26.1.0",
42
- "node-gyp": "^11.3.0",
51
+ "jsdom": "^27.2.0",
52
+ "node-gyp": "^12.1.0",
43
53
  "trufflehog": "^0.0.5",
44
54
  "ts": "^0.2.2",
45
- "vitest": "^3.2.4"
55
+ "typescript": "^5.9.3",
56
+ "vitest": "^4.0.14",
57
+ "zod": "^4.1.13"
58
+ },
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "https://github.com/tokenring-ai/monorepo",
62
+ "directory": "app/coder"
46
63
  },
47
64
  "license": "MIT",
48
65
  "bin": {
49
- "tr-coder": "./dist/tr-coder"
66
+ "tr-coder": "dist/tr-coder"
50
67
  },
51
68
  "files": [
52
69
  "dist",
@@ -59,12 +76,7 @@
59
76
  "coder": "bun src/tr-coder.js --source ./",
60
77
  "test": "vitest run",
61
78
  "prepare": "husky",
62
- "biome": "biome format --fix",
63
- "update-all-dependencies-latest": "git submodule foreach npx npm-check-updates -u",
64
79
  "release:patch": "NEWVERSION=`bun pm version patch` && git add package.json && git commit -m \"Bump version to ${NEWVERSION}\" && git tag ${NEWVERSION} && git submodule foreach git push && git push && git push --tags"
65
80
  },
66
- "type": "module",
67
- "workspaces": [
68
- "pkg/*"
69
- ]
81
+ "type": "module"
70
82
  }