zoe-agent 0.3.1
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/CHANGELOG.md +154 -0
- package/LICENSE +96 -0
- package/README.md +568 -0
- package/dist/adapters/cli/agent.d.ts +59 -0
- package/dist/adapters/cli/agent.js +232 -0
- package/dist/adapters/cli/bootstrap.d.ts +25 -0
- package/dist/adapters/cli/bootstrap.js +204 -0
- package/dist/adapters/cli/commands/build-registry.d.ts +14 -0
- package/dist/adapters/cli/commands/build-registry.js +88 -0
- package/dist/adapters/cli/commands/clear.d.ts +7 -0
- package/dist/adapters/cli/commands/clear.js +10 -0
- package/dist/adapters/cli/commands/compact.d.ts +13 -0
- package/dist/adapters/cli/commands/compact.js +96 -0
- package/dist/adapters/cli/commands/exit.d.ts +7 -0
- package/dist/adapters/cli/commands/exit.js +9 -0
- package/dist/adapters/cli/commands/gateway.d.ts +7 -0
- package/dist/adapters/cli/commands/gateway.js +152 -0
- package/dist/adapters/cli/commands/help.d.ts +9 -0
- package/dist/adapters/cli/commands/help.js +12 -0
- package/dist/adapters/cli/commands/models.d.ts +10 -0
- package/dist/adapters/cli/commands/models.js +32 -0
- package/dist/adapters/cli/commands/registry.d.ts +70 -0
- package/dist/adapters/cli/commands/registry.js +111 -0
- package/dist/adapters/cli/commands/settings-utils.d.ts +38 -0
- package/dist/adapters/cli/commands/settings-utils.js +182 -0
- package/dist/adapters/cli/commands/settings.d.ts +9 -0
- package/dist/adapters/cli/commands/settings.js +395 -0
- package/dist/adapters/cli/commands/skills.d.ts +7 -0
- package/dist/adapters/cli/commands/skills.js +21 -0
- package/dist/adapters/cli/config-loader.d.ts +27 -0
- package/dist/adapters/cli/config-loader.js +48 -0
- package/dist/adapters/cli/docker-utils.d.ts +37 -0
- package/dist/adapters/cli/docker-utils.js +90 -0
- package/dist/adapters/cli/index.d.ts +2 -0
- package/dist/adapters/cli/index.js +88 -0
- package/dist/adapters/cli/repl.d.ts +22 -0
- package/dist/adapters/cli/repl.js +256 -0
- package/dist/adapters/cli/setup.d.ts +19 -0
- package/dist/adapters/cli/setup.js +613 -0
- package/dist/adapters/cli/system-prompts.d.ts +56 -0
- package/dist/adapters/cli/system-prompts.js +131 -0
- package/dist/adapters/cli/tui/app.d.ts +58 -0
- package/dist/adapters/cli/tui/app.js +314 -0
- package/dist/adapters/cli/tui/components/assistant-message.d.ts +5 -0
- package/dist/adapters/cli/tui/components/assistant-message.js +9 -0
- package/dist/adapters/cli/tui/components/autocomplete.d.ts +19 -0
- package/dist/adapters/cli/tui/components/autocomplete.js +75 -0
- package/dist/adapters/cli/tui/components/command-palette.d.ts +15 -0
- package/dist/adapters/cli/tui/components/command-palette.js +50 -0
- package/dist/adapters/cli/tui/components/diff-viewer.d.ts +5 -0
- package/dist/adapters/cli/tui/components/diff-viewer.js +109 -0
- package/dist/adapters/cli/tui/components/error-message.d.ts +5 -0
- package/dist/adapters/cli/tui/components/error-message.js +8 -0
- package/dist/adapters/cli/tui/components/footer.d.ts +20 -0
- package/dist/adapters/cli/tui/components/footer.js +19 -0
- package/dist/adapters/cli/tui/components/goal-status.d.ts +12 -0
- package/dist/adapters/cli/tui/components/goal-status.js +22 -0
- package/dist/adapters/cli/tui/components/info-message.d.ts +5 -0
- package/dist/adapters/cli/tui/components/info-message.js +8 -0
- package/dist/adapters/cli/tui/components/logo-banner.d.ts +7 -0
- package/dist/adapters/cli/tui/components/logo-banner.js +33 -0
- package/dist/adapters/cli/tui/components/markdown.d.ts +9 -0
- package/dist/adapters/cli/tui/components/markdown.js +92 -0
- package/dist/adapters/cli/tui/components/message-area.d.ts +19 -0
- package/dist/adapters/cli/tui/components/message-area.js +55 -0
- package/dist/adapters/cli/tui/components/permission-prompt.d.ts +13 -0
- package/dist/adapters/cli/tui/components/permission-prompt.js +32 -0
- package/dist/adapters/cli/tui/components/prompt-area.d.ts +22 -0
- package/dist/adapters/cli/tui/components/prompt-area.js +68 -0
- package/dist/adapters/cli/tui/components/text-input.d.ts +27 -0
- package/dist/adapters/cli/tui/components/text-input.js +142 -0
- package/dist/adapters/cli/tui/components/tool-call-block.d.ts +11 -0
- package/dist/adapters/cli/tui/components/tool-call-block.js +68 -0
- package/dist/adapters/cli/tui/components/user-message.d.ts +5 -0
- package/dist/adapters/cli/tui/components/user-message.js +8 -0
- package/dist/adapters/cli/tui/diff/file-write-meta.d.ts +11 -0
- package/dist/adapters/cli/tui/diff/file-write-meta.js +11 -0
- package/dist/adapters/cli/tui/diff/line-diff.d.ts +17 -0
- package/dist/adapters/cli/tui/diff/line-diff.js +44 -0
- package/dist/adapters/cli/tui/feed-serializer.d.ts +29 -0
- package/dist/adapters/cli/tui/feed-serializer.js +70 -0
- package/dist/adapters/cli/tui/file-index.d.ts +8 -0
- package/dist/adapters/cli/tui/file-index.js +41 -0
- package/dist/adapters/cli/tui/hooks/use-agent.d.ts +54 -0
- package/dist/adapters/cli/tui/hooks/use-agent.js +177 -0
- package/dist/adapters/cli/tui/hooks/use-feed.d.ts +16 -0
- package/dist/adapters/cli/tui/hooks/use-feed.js +25 -0
- package/dist/adapters/cli/tui/hooks/use-file-watcher.d.ts +10 -0
- package/dist/adapters/cli/tui/hooks/use-file-watcher.js +43 -0
- package/dist/adapters/cli/tui/hooks/use-keybindings.d.ts +16 -0
- package/dist/adapters/cli/tui/hooks/use-keybindings.js +25 -0
- package/dist/adapters/cli/tui/hooks/use-theme.d.ts +8 -0
- package/dist/adapters/cli/tui/hooks/use-theme.js +12 -0
- package/dist/adapters/cli/tui/index.d.ts +19 -0
- package/dist/adapters/cli/tui/index.js +206 -0
- package/dist/adapters/cli/tui/ink-reset.d.ts +29 -0
- package/dist/adapters/cli/tui/ink-reset.js +57 -0
- package/dist/adapters/cli/tui/layout.d.ts +15 -0
- package/dist/adapters/cli/tui/layout.js +15 -0
- package/dist/adapters/cli/tui/logo/gradient.d.ts +11 -0
- package/dist/adapters/cli/tui/logo/gradient.js +31 -0
- package/dist/adapters/cli/tui/overlays/help-dialog.d.ts +4 -0
- package/dist/adapters/cli/tui/overlays/help-dialog.js +26 -0
- package/dist/adapters/cli/tui/overlays/model-selector.d.ts +14 -0
- package/dist/adapters/cli/tui/overlays/model-selector.js +43 -0
- package/dist/adapters/cli/tui/overlays/session-selector.d.ts +35 -0
- package/dist/adapters/cli/tui/overlays/session-selector.js +162 -0
- package/dist/adapters/cli/tui/overlays/settings-overlay.d.ts +24 -0
- package/dist/adapters/cli/tui/overlays/settings-overlay.js +126 -0
- package/dist/adapters/cli/tui/session-export.d.ts +21 -0
- package/dist/adapters/cli/tui/session-export.js +63 -0
- package/dist/adapters/cli/tui/theme.d.ts +23 -0
- package/dist/adapters/cli/tui/theme.js +22 -0
- package/dist/adapters/cli/tui/types.d.ts +52 -0
- package/dist/adapters/cli/tui/types.js +12 -0
- package/dist/adapters/sdk/agent.d.ts +20 -0
- package/dist/adapters/sdk/agent.js +356 -0
- package/dist/adapters/sdk/http.d.ts +43 -0
- package/dist/adapters/sdk/http.js +61 -0
- package/dist/adapters/sdk/index.d.ts +58 -0
- package/dist/adapters/sdk/index.js +209 -0
- package/dist/adapters/sdk/settings.d.ts +18 -0
- package/dist/adapters/sdk/settings.js +57 -0
- package/dist/adapters/sdk/tools.d.ts +7 -0
- package/dist/adapters/sdk/tools.js +13 -0
- package/dist/adapters/server/auth.d.ts +53 -0
- package/dist/adapters/server/auth.js +168 -0
- package/dist/adapters/server/index.d.ts +40 -0
- package/dist/adapters/server/index.js +255 -0
- package/dist/adapters/server/rest-gateway.d.ts +13 -0
- package/dist/adapters/server/rest-gateway.js +218 -0
- package/dist/adapters/server/rest.d.ts +37 -0
- package/dist/adapters/server/rest.js +341 -0
- package/dist/adapters/server/server-core.d.ts +55 -0
- package/dist/adapters/server/server-core.js +121 -0
- package/dist/adapters/server/session-store.d.ts +81 -0
- package/dist/adapters/server/session-store.js +272 -0
- package/dist/adapters/server/settings-handlers.d.ts +24 -0
- package/dist/adapters/server/settings-handlers.js +360 -0
- package/dist/adapters/server/standalone.d.ts +19 -0
- package/dist/adapters/server/standalone.js +113 -0
- package/dist/adapters/server/websocket.d.ts +26 -0
- package/dist/adapters/server/websocket.js +68 -0
- package/dist/adapters/server/ws-handlers.d.ts +32 -0
- package/dist/adapters/server/ws-handlers.js +523 -0
- package/dist/adapters/server/ws-types.d.ts +304 -0
- package/dist/adapters/server/ws-types.js +7 -0
- package/dist/core/agent-loop.d.ts +68 -0
- package/dist/core/agent-loop.js +423 -0
- package/dist/core/config.d.ts +115 -0
- package/dist/core/config.js +189 -0
- package/dist/core/errors.d.ts +58 -0
- package/dist/core/errors.js +88 -0
- package/dist/core/hooks.d.ts +35 -0
- package/dist/core/hooks.js +49 -0
- package/dist/core/index.d.ts +23 -0
- package/dist/core/index.js +29 -0
- package/dist/core/message-convert.d.ts +41 -0
- package/dist/core/message-convert.js +94 -0
- package/dist/core/middleware/auth.d.ts +24 -0
- package/dist/core/middleware/auth.js +28 -0
- package/dist/core/middleware/logging.d.ts +23 -0
- package/dist/core/middleware/logging.js +28 -0
- package/dist/core/middleware/rate-limit.d.ts +27 -0
- package/dist/core/middleware/rate-limit.js +38 -0
- package/dist/core/middleware/semantic-tools.d.ts +10 -0
- package/dist/core/middleware/semantic-tools.js +43 -0
- package/dist/core/middleware.d.ts +48 -0
- package/dist/core/middleware.js +38 -0
- package/dist/core/permission.d.ts +25 -0
- package/dist/core/permission.js +50 -0
- package/dist/core/provider-config.d.ts +129 -0
- package/dist/core/provider-config.js +273 -0
- package/dist/core/provider-env.d.ts +39 -0
- package/dist/core/provider-env.js +142 -0
- package/dist/core/provider-resolver.d.ts +12 -0
- package/dist/core/provider-resolver.js +12 -0
- package/dist/core/session-store.d.ts +75 -0
- package/dist/core/session-store.js +245 -0
- package/dist/core/settings-manager.d.ts +57 -0
- package/dist/core/settings-manager.js +359 -0
- package/dist/core/settings-schema.d.ts +38 -0
- package/dist/core/settings-schema.js +171 -0
- package/dist/core/skill-catalog.d.ts +6 -0
- package/dist/core/skill-catalog.js +17 -0
- package/dist/core/skill-invoker.d.ts +127 -0
- package/dist/core/skill-invoker.js +182 -0
- package/dist/core/stream-accumulator.d.ts +21 -0
- package/dist/core/stream-accumulator.js +51 -0
- package/dist/core/stream-manager.d.ts +58 -0
- package/dist/core/stream-manager.js +212 -0
- package/dist/core/tool-executor.d.ts +84 -0
- package/dist/core/tool-executor.js +256 -0
- package/dist/core/types.d.ts +259 -0
- package/dist/core/types.js +11 -0
- package/dist/gateway/gateway.d.ts +52 -0
- package/dist/gateway/gateway.js +537 -0
- package/dist/gateway/index.d.ts +21 -0
- package/dist/gateway/index.js +31 -0
- package/dist/gateway/openapi-importer.d.ts +15 -0
- package/dist/gateway/openapi-importer.js +66 -0
- package/dist/gateway/semantic-scorer.d.ts +7 -0
- package/dist/gateway/semantic-scorer.js +24 -0
- package/dist/gateway/settings-adapter.d.ts +49 -0
- package/dist/gateway/settings-adapter.js +137 -0
- package/dist/gateway/tool-factory.d.ts +9 -0
- package/dist/gateway/tool-factory.js +414 -0
- package/dist/gateway/types.d.ts +68 -0
- package/dist/gateway/types.js +7 -0
- package/dist/models-catalog.js +46 -0
- package/dist/providers/anthropic.d.ts +22 -0
- package/dist/providers/anthropic.js +148 -0
- package/dist/providers/factory.d.ts +10 -0
- package/dist/providers/factory.js +25 -0
- package/dist/providers/openai.d.ts +15 -0
- package/dist/providers/openai.js +71 -0
- package/dist/providers/types.d.ts +48 -0
- package/dist/providers/types.js +1 -0
- package/dist/skills/args.d.ts +37 -0
- package/dist/skills/args.js +99 -0
- package/dist/skills/index.d.ts +11 -0
- package/dist/skills/index.js +23 -0
- package/dist/skills/loader.d.ts +3 -0
- package/dist/skills/loader.js +59 -0
- package/dist/skills/parser.d.ts +7 -0
- package/dist/skills/parser.js +152 -0
- package/dist/skills/registry.d.ts +13 -0
- package/dist/skills/registry.js +74 -0
- package/dist/skills/resolver.d.ts +19 -0
- package/dist/skills/resolver.js +116 -0
- package/dist/skills/types.d.ts +74 -0
- package/dist/skills/types.js +50 -0
- package/dist/tools/browser.d.ts +2 -0
- package/dist/tools/browser.js +68 -0
- package/dist/tools/core.d.ts +20 -0
- package/dist/tools/core.js +244 -0
- package/dist/tools/email.d.ts +2 -0
- package/dist/tools/email.js +61 -0
- package/dist/tools/image.d.ts +2 -0
- package/dist/tools/image.js +257 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +88 -0
- package/dist/tools/interface.d.ts +22 -0
- package/dist/tools/interface.js +1 -0
- package/dist/tools/notify.d.ts +2 -0
- package/dist/tools/notify.js +100 -0
- package/dist/tools/prompt-optimizer.d.ts +2 -0
- package/dist/tools/prompt-optimizer.js +65 -0
- package/dist/tools/screenshot.d.ts +2 -0
- package/dist/tools/screenshot.js +184 -0
- package/dist/tools/search.d.ts +2 -0
- package/dist/tools/search.js +78 -0
- package/dist/tools/todos.d.ts +10 -0
- package/dist/tools/todos.js +50 -0
- package/package.json +119 -0
- package/skills/docker-ops/SKILL.md +329 -0
- package/skills/k8s-deploy/SKILL.md +397 -0
- package/skills/log-analyzer/SKILL.md +331 -0
- package/skills/speckit-analyze/SKILL.md +260 -0
- package/skills/speckit-checklist/SKILL.md +374 -0
- package/skills/speckit-clarify/SKILL.md +286 -0
- package/skills/speckit-constitution/SKILL.md +157 -0
- package/skills/speckit-implement/SKILL.md +224 -0
- package/skills/speckit-plan/SKILL.md +171 -0
- package/skills/speckit-specify/SKILL.md +346 -0
- package/skills/speckit-tasks/SKILL.md +215 -0
- package/skills/speckit-taskstoissues/SKILL.md +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
# Zoe Agent 🦞
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/zoe-agent)
|
|
4
|
+
[](https://www.npmjs.com/package/zoe-agent)
|
|
5
|
+
[](https://github.com/hashangit/zoe/releases)
|
|
6
|
+
[](https://github.com/hashangit/zoe/blob/main/LICENSE)
|
|
7
|
+
[](http://makeapullrequest.com)
|
|
8
|
+
|
|
9
|
+
**The Engineering-First Headless Agent Framework: CLI, SDK, and Server. Stable, Scalable Automation for the Post-Vision Era.**
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
🔗 **GitHub Repository**: [https://github.com/hashangit/zoe](https://github.com/hashangit/zoe)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
Zoe Agent is a high-stability, open-source automation framework specifically engineered for **headless systems**.
|
|
18
|
+
|
|
19
|
+
Unlike "screen-seeing" agents (such as OpenClaw) that rely on visual interpretation, Zoe Agent is built on a foundation of precise command-driven execution. This makes it significantly more **stable**, **robust from an engineering perspective**, and **easier to scale** across complex environments—whether it's a local server, a CI/CD pipeline, or thousands of containerized nodes.
|
|
20
|
+
|
|
21
|
+
## Why Zoe Agent?
|
|
22
|
+
- 🐳 **Docker Native**: Built to run safely inside containers. Minimal footprint (Node.js/Alpine friendly).
|
|
23
|
+
- 🚀 **Better Engineering**: Operates via precise system APIs and shell commands rather than unstable visual recognition, ensuring deterministic outcomes.
|
|
24
|
+
- 🛡️ **Superior Stability**: Immune to issues like UI rendering, screen resolution, or network lag that plague vision-based agents.
|
|
25
|
+
- 📈 **Massive Scalability**: Low resource consumption allows orchestrating thousands of instances (e.g., in K8s) for true automation swarms.
|
|
26
|
+
- 🔌 **Swarm Ready**: Stateless design allows for easy orchestration via K8s, Docker Swarm, or simple shell loops.
|
|
27
|
+
- 🧩 **Extensible Integrations**: Built-in support for Web Search (Tavily), Email (SMTP), and Notification Webhooks (Feishu, DingTalk, WeCom).
|
|
28
|
+
- 📦 **SDK & Server**: TypeScript SDK for programmatic use, standalone HTTP/WebSocket server for remote access.
|
|
29
|
+
- 🛠 **Skills System**: Loadable skill packs with file references, custom tool registration, and extensible workflows.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- 🤖 **Multi-Provider Support**: Switch between OpenAI, Anthropic Claude, GLM, or any OpenAI-compatible endpoint
|
|
34
|
+
- 🔄 **Runtime Provider Switching**: Change AI providers mid-conversation with `/models` command
|
|
35
|
+
- 📜 **Headless Execution**: No browsers, no GUIs. Pure terminal efficiency.
|
|
36
|
+
- 🚀 **Non-Interactive Mode**: Intelligent flag handling (`-y`, `--no-interactive`) for zero-touch automation.
|
|
37
|
+
- 📂 **Universal Control**: From simple file I/O to complex system administration.
|
|
38
|
+
- 🧠 **Context Aware**: Detects container environments and provides accurate system time for relative date queries.
|
|
39
|
+
- 🌐 **Web Search**: Integrated with Tavily for real-time information retrieval.
|
|
40
|
+
- 🕒 **Time Accuracy**: Built-in tool to get precise system date and time for correct temporal context.
|
|
41
|
+
- 📧 **Communication**: Send emails and push notifications to chat groups automatically.
|
|
42
|
+
- 📦 **TypeScript SDK**: Programmatic access via `createAgent`, `streamText`, `generateText`.
|
|
43
|
+
- 🖥 **Server Mode**: Standalone HTTP/WebSocket server with API key auth and session management.
|
|
44
|
+
- 🛠 **Skills System**: Loadable skill packs from directories with `@path` file references and custom tool creation.
|
|
45
|
+
- 🐚 **Shell Approval**: Interactive prompts or non-interactive modes via `ZOE_SHELL_APPROVE` env var.
|
|
46
|
+
- 🖥️ **Interactive TUI**: In a TTY, a full-screen Ink/React UI — bordered always-on input, streaming feed, session manager, message queue/`/steer`, and inline `write_file` diffs (atomic, crash-safe writes).
|
|
47
|
+
|
|
48
|
+
## Tech Stack
|
|
49
|
+
- **Runtime**: Node.js
|
|
50
|
+
- **Language**: TypeScript
|
|
51
|
+
- **Architecture**: Modular multi-adapter (core, CLI, SDK, server)
|
|
52
|
+
- **Framework**: Commander.js
|
|
53
|
+
- **UI**: Inquirer (interactivity), Chalk (styling), Ora (spinners)
|
|
54
|
+
- **AI**: Multi-Provider (OpenAI, Anthropic Claude, GLM, OpenAI-Compatible)
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
### npm
|
|
59
|
+
```bash
|
|
60
|
+
npm install -g zoe-agent
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### pnpm
|
|
64
|
+
```bash
|
|
65
|
+
pnpm add -g zoe-agent
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Homebrew (macOS & Linux)
|
|
69
|
+
```bash
|
|
70
|
+
brew tap hashangit/zoe
|
|
71
|
+
brew install zoe-agent
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> **Note:** Requires [Node.js](https://nodejs.org/) 20 or later.
|
|
75
|
+
|
|
76
|
+
### Server Binary
|
|
77
|
+
The `zoe-server` binary is included for running the standalone HTTP/WebSocket server:
|
|
78
|
+
```bash
|
|
79
|
+
zoe-server --port 7337 --generate-api-key
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### SDK Usage
|
|
83
|
+
Import the SDK in your TypeScript/JavaScript project:
|
|
84
|
+
```bash
|
|
85
|
+
npm install zoe-agent
|
|
86
|
+
```
|
|
87
|
+
```ts
|
|
88
|
+
// Main exports
|
|
89
|
+
import { createAgent, streamText, generateText } from 'zoe-agent';
|
|
90
|
+
// Server utilities
|
|
91
|
+
import { createServer } from 'zoe-agent/server';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Development Installation
|
|
95
|
+
1. Clone the repository:
|
|
96
|
+
```bash
|
|
97
|
+
git clone https://github.com/hashangit/zoe.git
|
|
98
|
+
cd zoe
|
|
99
|
+
```
|
|
100
|
+
2. Install dependencies:
|
|
101
|
+
```bash
|
|
102
|
+
pnpm install
|
|
103
|
+
```
|
|
104
|
+
3. Build the project:
|
|
105
|
+
```bash
|
|
106
|
+
pnpm run build
|
|
107
|
+
```
|
|
108
|
+
4. Link globally (optional):
|
|
109
|
+
```bash
|
|
110
|
+
pnpm link
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Quick Start
|
|
114
|
+
|
|
115
|
+
1. **Setup**: Run the interactive setup wizard to configure your API keys and integrations.
|
|
116
|
+
```bash
|
|
117
|
+
zoe setup
|
|
118
|
+
```
|
|
119
|
+
The wizard now supports configuring multiple providers (OpenAI, Anthropic, GLM) in a single session.
|
|
120
|
+
|
|
121
|
+
2. **Run**: Start the agent in interactive mode.
|
|
122
|
+
```bash
|
|
123
|
+
zoe
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Usage
|
|
127
|
+
|
|
128
|
+
### Interactive Mode
|
|
129
|
+
Simply run `zoe` to enter the chat loop.
|
|
130
|
+
```bash
|
|
131
|
+
zoe
|
|
132
|
+
> List all TypeScript files in the src folder.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Interactive TUI
|
|
136
|
+
|
|
137
|
+
In a terminal (TTY), `zoe` launches a full-screen Ink/React TUI instead of the readline loop: a bordered always-visible input, a streaming message feed, a persistent task panel (`manage_todos`), session list/resume/export, and inline diffs for `write_file`. File writes are atomic (same-dir temp + `fs.rename`, so a crash never corrupts the file) and render as a green/red unified diff in the tool block; Ctrl+O expands collapsed blocks, and `/clear` starts a fresh session. It falls back to the readline REPL when piped or run with `--no-interactive`.
|
|
138
|
+
|
|
139
|
+
### Headless Mode (One-Shot)
|
|
140
|
+
Run a single command and exit.
|
|
141
|
+
```bash
|
|
142
|
+
zoe "Check disk usage and save the report to usage.txt" --no-interactive
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Auto-Confirm (CI/CD)
|
|
146
|
+
Automatically approve all tool executions (dangerous, use with caution or in sandboxes).
|
|
147
|
+
```bash
|
|
148
|
+
zoe "Refactor src/index.ts to use ES modules" -y
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Provider Selection
|
|
152
|
+
Use a specific provider for a single command:
|
|
153
|
+
```bash
|
|
154
|
+
zoe -p anthropic "Analyze this code for security issues"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Switch Providers Mid-Conversation
|
|
158
|
+
In interactive mode, type `/models` to switch between configured providers:
|
|
159
|
+
```bash
|
|
160
|
+
zoe
|
|
161
|
+
> /models # Select Anthropic from the list
|
|
162
|
+
> Now analyze this with Claude...
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### CLI Options
|
|
166
|
+
- `-m, --model <model>`: Specify the LLM model (default: `gpt-4o`).
|
|
167
|
+
- `-p, --provider <provider>`: Specify the LLM provider (`openai-compatible`, `openai`, `anthropic`, `glm`).
|
|
168
|
+
- `-n, --no-interactive`: Exit after processing the initial query (Headless mode).
|
|
169
|
+
- `-y, --yes`: Auto-confirm all tool executions (e.g., shell commands).
|
|
170
|
+
- `--docker`: Run in Docker-optimized non-interactive mode (auto-detected in containers).
|
|
171
|
+
- `--generate-api-key`: Generate an API key for server mode (use with `zoe-server`).
|
|
172
|
+
|
|
173
|
+
### Interactive Commands
|
|
174
|
+
- `/models`: Switch between configured providers during a conversation.
|
|
175
|
+
- `/exit` or `/quit`: End the session.
|
|
176
|
+
|
|
177
|
+
## Configuration
|
|
178
|
+
|
|
179
|
+
Zoe Agent uses a hierarchical configuration system.
|
|
180
|
+
|
|
181
|
+
**Priority Order (Highest to Lowest):**
|
|
182
|
+
1. **CLI Arguments**: (e.g., `-m gpt-4o`)
|
|
183
|
+
2. **Environment Variables**: (`OPENAI_API_KEY`, `.env` file)
|
|
184
|
+
3. **Project Config**: (`./.zoe/setting.json` in current directory)
|
|
185
|
+
4. **Global Config**: (`~/.zoe/setting.json`)
|
|
186
|
+
|
|
187
|
+
### Supported Configuration Keys (JSON)
|
|
188
|
+
|
|
189
|
+
**Environment Variables:**
|
|
190
|
+
- `ZOE_SHELL_APPROVE`: Shell command approval mode (`auto`, `deny`, or unset for interactive)
|
|
191
|
+
- `ZOE_SKILLS_PATH`: Colon-separated list of additional skill directories
|
|
192
|
+
- `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GLM_API_KEY`: Provider API keys
|
|
193
|
+
- `OPENAI_COMPAT_API_KEY`, `OPENAI_COMPAT_BASE_URL`, `OPENAI_COMPAT_MODEL`: OpenAI-compatible provider settings
|
|
194
|
+
|
|
195
|
+
**Multi-Provider Configuration:**
|
|
196
|
+
- `provider`: Active provider type (`openai-compatible`, `openai`, `anthropic`, `glm`)
|
|
197
|
+
- `models`: Object containing per-provider configurations:
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"models": {
|
|
201
|
+
"openai-compatible": { "apiKey": "...", "baseUrl": "...", "model": "gpt-4o" },
|
|
202
|
+
"openai": { "apiKey": "...", "model": "gpt-4o" },
|
|
203
|
+
"anthropic": { "apiKey": "...", "model": "claude-sonnet-4-5-20250929" },
|
|
204
|
+
"glm": { "apiKey": "...", "model": "sonnet" }
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Legacy Keys (Backward Compatible):**
|
|
210
|
+
- `apiKey`: Your OpenAI API Key (legacy, treated as `openai-compatible`).
|
|
211
|
+
- `baseUrl`: Custom Base URL (e.g., for DeepSeek or LocalLLM).
|
|
212
|
+
- `model`: Default model to use.
|
|
213
|
+
- `tavilyApiKey`: API Key for Tavily Web Search.
|
|
214
|
+
- `smtpHost`, `smtpPort`, `smtpUser`, `smtpPass`, `smtpFrom`: SMTP Email settings.
|
|
215
|
+
- `feishuWebhook`, `dingtalkWebhook`, `wecomWebhook`: Notification webhooks.
|
|
216
|
+
|
|
217
|
+
### Project-Level Config Example
|
|
218
|
+
|
|
219
|
+
**Multi-Provider Configuration:**
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"provider": "anthropic",
|
|
223
|
+
"models": {
|
|
224
|
+
"openai": { "apiKey": "sk-...", "model": "gpt-4o" },
|
|
225
|
+
"anthropic": { "apiKey": "sk-ant-...", "model": "claude-sonnet-4-5-20250929" }
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Legacy Configuration (Still Supported):**
|
|
231
|
+
Create a file at `.zoe/setting.json`:
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"model": "gpt-3.5-turbo",
|
|
235
|
+
"baseUrl": "https://api.deepseek.com/v1"
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
> **⚠️ Security Warning**: If you store your `apiKey` or secrets in `.zoe/setting.json`, make sure to add `.zoe/` to your `.gitignore` file to prevent leaking secrets!
|
|
240
|
+
|
|
241
|
+
## Integrations
|
|
242
|
+
|
|
243
|
+
### Gateway (MCP Client + REST Proxy + OpenAPI Adapter)
|
|
244
|
+
|
|
245
|
+
Zoe Agent v0.3.0 introduces a universal API gateway that connects to downstream MCP servers and REST APIs:
|
|
246
|
+
|
|
247
|
+
- **Semantic Injection**: Middleware scores your message against all discovered tools and injects the top-K most relevant directly into the agent's tool context. Zero context pollution.
|
|
248
|
+
- **Proxy Pattern**: Generic tools (`gateway_route`, `gateway_call_tool`, etc.) let the agent navigate targets when semantic injection finds no match.
|
|
249
|
+
- **OpenAPI Import**: Import any OpenAPI spec (JSON/YAML) and auto-register all operations as a REST target.
|
|
250
|
+
- **Credential Trust Guard**: Admin-registered targets can resolve stored credentials; agent-registered targets cannot — preventing credential exfiltration.
|
|
251
|
+
- **Audit Logging**: Ring-buffer audit logs with per-target usage summaries for debugging and self-healing.
|
|
252
|
+
|
|
253
|
+
**Configuration** (`~/.zoe/setting.json` or env vars):
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"gatewayEnabled": true,
|
|
257
|
+
"gatewaySemanticTopK": 3,
|
|
258
|
+
"gatewayRateLimit": 60,
|
|
259
|
+
"gatewayMaxAuditLogs": 1000
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**CLI Commands**: `/gateway list|add|remove|toggle|routes|credentials|audit|usage`
|
|
264
|
+
|
|
265
|
+
**REST API**: `GET/POST/PATCH/DELETE /v1/gateway/*` (admin scope required for mutations)
|
|
266
|
+
|
|
267
|
+
**SDK**:
|
|
268
|
+
```ts
|
|
269
|
+
import { gateway } from 'zoe-agent';
|
|
270
|
+
const gw = await gateway.createGateway({ enabled: true, semanticTopK: 3, defaultRateLimitPerMin: 60, maxAuditLogsInMemory: 1000 });
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Multi-Provider LLM Support
|
|
274
|
+
Zoe Agent supports multiple AI providers with seamless switching:
|
|
275
|
+
- **OpenAI**: GPT-4, GPT-3.5-turbo, and latest models
|
|
276
|
+
- **Anthropic**: Claude Sonnet, Haiku, Opus models
|
|
277
|
+
- **GLM**: Z.ai GLM-4.5, GLM-4.7, GLM-5.1 models
|
|
278
|
+
- **OpenAI-Compatible**: DeepSeek, LocalLLM, Ollama, LM Studio, and any OpenAI-compatible endpoint
|
|
279
|
+
|
|
280
|
+
Configure multiple providers during setup and switch between them using `/models` command or `-p` flag.
|
|
281
|
+
|
|
282
|
+
### Web Search (Tavily)
|
|
283
|
+
Zoe Agent can search the web if you provide a Tavily API Key during setup or in config.
|
|
284
|
+
- **Usage**: "Search for the latest Node.js release notes."
|
|
285
|
+
|
|
286
|
+
### Email (SMTP)
|
|
287
|
+
Configure SMTP settings to let the agent send emails.
|
|
288
|
+
- **Usage**: "Send an email to user@example.com with the summary of the log file."
|
|
289
|
+
|
|
290
|
+
### Notifications (Feishu/DingTalk/WeCom)
|
|
291
|
+
Configure webhooks to receive alerts or reports in your team chat apps.
|
|
292
|
+
- **Usage**: "Notify the team on Feishu that the build has finished."
|
|
293
|
+
|
|
294
|
+
### Date & Time
|
|
295
|
+
Built-in utility to provide the agent with the current system time, ensuring accurate handling of relative time requests.
|
|
296
|
+
- **Usage**: "What's the date today?" or "Remind me to check the logs next Monday."
|
|
297
|
+
|
|
298
|
+
## SDK & Programmatic Usage
|
|
299
|
+
|
|
300
|
+
Zoe Agent provides a TypeScript SDK for building agent-powered applications.
|
|
301
|
+
|
|
302
|
+
### Basic Agent
|
|
303
|
+
```ts
|
|
304
|
+
import { createAgent } from 'zoe-agent';
|
|
305
|
+
|
|
306
|
+
const agent = await createAgent({
|
|
307
|
+
provider: 'anthropic',
|
|
308
|
+
model: 'claude-sonnet-4-5-20250929',
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
const result = await agent.chat('List all running Docker containers');
|
|
312
|
+
console.log(result.text);
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Streaming
|
|
316
|
+
```ts
|
|
317
|
+
import { streamText } from 'zoe-agent';
|
|
318
|
+
|
|
319
|
+
const stream = await streamText('Analyze the logs for errors', {
|
|
320
|
+
provider: 'openai',
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
for await (const chunk of stream.textStream) {
|
|
324
|
+
process.stdout.write(chunk);
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Structured Output
|
|
329
|
+
```ts
|
|
330
|
+
import { generateText } from 'zoe-agent';
|
|
331
|
+
|
|
332
|
+
const result = await generateText('Extract the top 3 issues from these logs', {
|
|
333
|
+
provider: 'anthropic',
|
|
334
|
+
});
|
|
335
|
+
console.log(result.text);
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Getting Started (SDK)
|
|
339
|
+
|
|
340
|
+
Before first use, configure providers from your CLI config (or env vars):
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
import { configureProviders, loadProviderConfig } from 'zoe-agent';
|
|
344
|
+
|
|
345
|
+
const config = loadProviderConfig(); // reads ~/.zoe/setting.json + .zoe/setting.json + env
|
|
346
|
+
if (config) {
|
|
347
|
+
configureProviders(config);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Now safe to call
|
|
351
|
+
import { generateText } from 'zoe-agent';
|
|
352
|
+
const result = await generateText('Hello, world!');
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Without this step, `generateText` defaults to OpenAI using `OPENAI_API_KEY` if present, or throws a "no provider configured" error otherwise.
|
|
356
|
+
|
|
357
|
+
### Custom Tools
|
|
358
|
+
```ts
|
|
359
|
+
import { createAgent, tool } from 'zoe-agent';
|
|
360
|
+
|
|
361
|
+
const agent = await createAgent({
|
|
362
|
+
provider: 'openai',
|
|
363
|
+
tools: [
|
|
364
|
+
tool({
|
|
365
|
+
name: 'check_disk',
|
|
366
|
+
description: 'Check disk usage',
|
|
367
|
+
parameters: {},
|
|
368
|
+
execute: async () => {
|
|
369
|
+
const usage = await getDiskUsage();
|
|
370
|
+
return JSON.stringify(usage);
|
|
371
|
+
},
|
|
372
|
+
}),
|
|
373
|
+
],
|
|
374
|
+
});
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Session Persistence
|
|
378
|
+
```ts
|
|
379
|
+
const agent = await createAgent({
|
|
380
|
+
provider: 'anthropic',
|
|
381
|
+
persist: 'my-session', // Resume a previous session
|
|
382
|
+
});
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Server Mode
|
|
386
|
+
|
|
387
|
+
Run Zoe Agent as a standalone HTTP/WebSocket server for remote agent access.
|
|
388
|
+
|
|
389
|
+
### Starting the Server
|
|
390
|
+
```bash
|
|
391
|
+
# Start with default settings
|
|
392
|
+
zoe-server
|
|
393
|
+
|
|
394
|
+
# Generate an API key
|
|
395
|
+
zoe-server --generate-api-key
|
|
396
|
+
|
|
397
|
+
# Custom port
|
|
398
|
+
zoe-server --port 8080
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### REST API
|
|
402
|
+
```bash
|
|
403
|
+
# Send a prompt
|
|
404
|
+
curl -X POST http://localhost:7337/api/chat \
|
|
405
|
+
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
406
|
+
-H "Content-Type: application/json" \
|
|
407
|
+
-d '{"message": "Check disk usage", "provider": "openai"}'
|
|
408
|
+
|
|
409
|
+
# List sessions
|
|
410
|
+
curl http://localhost:7337/api/sessions \
|
|
411
|
+
-H "Authorization: Bearer YOUR_API_KEY"
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### WebSocket Streaming
|
|
415
|
+
```ts
|
|
416
|
+
const ws = new WebSocket('ws://localhost:7337/ws?token=YOUR_API_KEY');
|
|
417
|
+
|
|
418
|
+
ws.onopen = () => {
|
|
419
|
+
ws.send(JSON.stringify({
|
|
420
|
+
type: 'chat',
|
|
421
|
+
message: 'Analyze the error logs',
|
|
422
|
+
provider: 'anthropic',
|
|
423
|
+
}));
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
ws.onmessage = (event) => {
|
|
427
|
+
const chunk = JSON.parse(event.data);
|
|
428
|
+
process.stdout.write(chunk.text);
|
|
429
|
+
};
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Skills System
|
|
433
|
+
|
|
434
|
+
Skills are single `SKILL.md` files with YAML frontmatter that extend the agent with domain-specific prompts and tool restrictions. See [docs/sdk/skills.md](docs/sdk/skills.md) for full documentation.
|
|
435
|
+
|
|
436
|
+
### Skill Format
|
|
437
|
+
```yaml
|
|
438
|
+
---
|
|
439
|
+
name: docker-ops
|
|
440
|
+
description: Docker operations assistant
|
|
441
|
+
tags: [docker, devops]
|
|
442
|
+
allowedTools: [execute_shell_command, read_file]
|
|
443
|
+
args: [environment, service]
|
|
444
|
+
model:
|
|
445
|
+
provider: anthropic
|
|
446
|
+
model: claude-sonnet-4-20250514
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
Skill instructions and templates here.
|
|
450
|
+
Use {{environment}} and {{service}} for argument substitution.
|
|
451
|
+
Reference files with @k8s/deployment.yaml.
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Key Features
|
|
455
|
+
- **Argument substitution**: `{{argName}}`, `$1`/`$2`/`$ALL` for positional args
|
|
456
|
+
- **File references**: `@path/to/file.yaml` injects file contents into the prompt
|
|
457
|
+
- **Tool restrictions**: `allowedTools` limits which tools the skill can use
|
|
458
|
+
- **Model selection**: `model` overrides provider/model per skill
|
|
459
|
+
- **Lazy loading**: skill body is only read when invoked, keeping startup fast
|
|
460
|
+
- **Body limits**: bodies over 8k chars warn, over 32k chars truncate (~8k tokens)
|
|
461
|
+
|
|
462
|
+
### Discovery Locations
|
|
463
|
+
Skills are discovered in priority order (last wins):
|
|
464
|
+
1. Built-in bundled skills
|
|
465
|
+
2. `~/.zoe/skills/`
|
|
466
|
+
3. `.zoe/skills/` (project-level)
|
|
467
|
+
4. `ZOE_SKILLS_PATH` directories
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
# Add custom skill directories
|
|
471
|
+
export ZOE_SKILLS_PATH=/path/to/skills:/another/path
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
## Docker Support
|
|
475
|
+
|
|
476
|
+
Zoe Agent includes a production-ready [`Dockerfile`](./Dockerfile) (Node 20 Alpine) and [`docker-compose.yml`](./docker-compose.yml) for containerized deployment.
|
|
477
|
+
|
|
478
|
+
### Quick Start with Docker
|
|
479
|
+
|
|
480
|
+
```bash
|
|
481
|
+
# Clone and build
|
|
482
|
+
git clone https://github.com/hashangit/zoe.git
|
|
483
|
+
cd zoe
|
|
484
|
+
docker build -t zoe-server .
|
|
485
|
+
|
|
486
|
+
# Run the server
|
|
487
|
+
docker run -d -p 7337:7337 \
|
|
488
|
+
-e OPENAI_API_KEY=sk-... \
|
|
489
|
+
zoe-server
|
|
490
|
+
|
|
491
|
+
# Or use Docker Compose
|
|
492
|
+
docker compose up -d
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Docker-Optimized CLI Mode
|
|
496
|
+
Use `--docker` for non-interactive execution inside containers:
|
|
497
|
+
```bash
|
|
498
|
+
docker run --rm \
|
|
499
|
+
-e OPENAI_API_KEY=sk-... \
|
|
500
|
+
-e ZOE_SHELL_APPROVE=auto \
|
|
501
|
+
zoe-server zoe "Check disk usage" --docker
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Zoe Agent auto-detects Docker and non-interactive environments. When running in a container, it adjusts behavior accordingly (no interactive prompts, streamlined output).
|
|
505
|
+
|
|
506
|
+
### Shell Approval in Containers
|
|
507
|
+
Set `ZOE_SHELL_APPROVE` to control how shell commands are approved without interactive prompts:
|
|
508
|
+
- `auto`: Automatically approve all commands (use in trusted/sandboxed environments)
|
|
509
|
+
- `deny`: Deny all shell command execution
|
|
510
|
+
- _(unset)_: Interactive prompt (default, requires a TTY)
|
|
511
|
+
|
|
512
|
+
```yaml
|
|
513
|
+
# docker-compose.yml example
|
|
514
|
+
services:
|
|
515
|
+
zoe:
|
|
516
|
+
build: .
|
|
517
|
+
ports:
|
|
518
|
+
- "7337:7337"
|
|
519
|
+
environment:
|
|
520
|
+
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
|
521
|
+
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
|
522
|
+
- ZOE_SHELL_APPROVE=auto
|
|
523
|
+
- ZOE_SKILLS_PATH=/app/skills
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### Non-Latin Font Issues in Screenshots
|
|
527
|
+
When running Zoe Agent inside a Docker container (especially Alpine or Debian Slim), screenshots of websites with non-Latin text (e.g., CJK characters) may display text as square boxes ("tofu") due to missing fonts. Emojis (e.g., 🔥) may also appear as squares.
|
|
528
|
+
|
|
529
|
+
**Solution:** Install CJK (Chinese/Japanese/Korean) and Emoji fonts in your container.
|
|
530
|
+
|
|
531
|
+
**For Debian/Ubuntu:**
|
|
532
|
+
```bash
|
|
533
|
+
apt-get update && apt-get install -y fonts-noto-cjk fonts-wqy-zenhei fonts-noto-color-emoji
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**For Alpine Linux:**
|
|
537
|
+
```apk add font-noto-cjk font-noto-emoji```
|
|
538
|
+
|
|
539
|
+
## License
|
|
540
|
+
|
|
541
|
+
Zoe is distributed under the **Business Source License 1.1 (BSL)** — a
|
|
542
|
+
source-available license.
|
|
543
|
+
|
|
544
|
+
- **Free for personal, non-commercial use** (including students, educators,
|
|
545
|
+
and research), and for short evaluation/internal trial use.
|
|
546
|
+
- **Commercial / production use** (including offering Zoe as a managed
|
|
547
|
+
service) requires a commercial license from the Licensor.
|
|
548
|
+
- On the **Change Date (2028-01-01)** the Licensed Work automatically becomes
|
|
549
|
+
available under the Apache License 2.0.
|
|
550
|
+
|
|
551
|
+
See the full terms in [LICENSE](./LICENSE). To obtain a commercial license,
|
|
552
|
+
contact the maintainer.
|
|
553
|
+
|
|
554
|
+
## Contributing
|
|
555
|
+
|
|
556
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
557
|
+
|
|
558
|
+
1. Fork the Project
|
|
559
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
|
560
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
|
561
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
562
|
+
5. Open a Pull Request
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
GitHub: [https://github.com/hashangit/zoe](https://github.com/hashangit/zoe)
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LLMProvider } from '../../providers/types.js';
|
|
2
|
+
import type { SkillRegistry } from '../../skills/types.js';
|
|
3
|
+
import type { Message, StepResult, Usage, ApproveToolFn, PermissionLevel, ProviderType, PersistenceBackend } from '../../core/types.js';
|
|
4
|
+
import type { Middleware } from '../../core/middleware.js';
|
|
5
|
+
/**
|
|
6
|
+
* Outcome of a single `Agent.chat()` turn. Returned so non-readline callers
|
|
7
|
+
* (the TUI) can render terminal states (aborted / max-steps / error) instead
|
|
8
|
+
* of relying on chalk stdout. The readline path ignores it and prints the
|
|
9
|
+
* same chalk messages as before.
|
|
10
|
+
*/
|
|
11
|
+
export interface ChatResult {
|
|
12
|
+
finishReason: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
usage?: Usage;
|
|
15
|
+
}
|
|
16
|
+
export declare class Agent {
|
|
17
|
+
private provider;
|
|
18
|
+
private messages;
|
|
19
|
+
private model;
|
|
20
|
+
private config;
|
|
21
|
+
private autoConfirm;
|
|
22
|
+
private skillRegistry;
|
|
23
|
+
private skillCatalog;
|
|
24
|
+
private abortController;
|
|
25
|
+
private _middleware;
|
|
26
|
+
private readonly systemPrompt;
|
|
27
|
+
private readonly providerType;
|
|
28
|
+
private readonly persistence;
|
|
29
|
+
private sessionId;
|
|
30
|
+
constructor(provider: LLMProvider, model?: string, config?: any, systemPrompt?: string, persistence?: PersistenceBackend | null, providerType?: ProviderType);
|
|
31
|
+
initializeSkills(): Promise<void>;
|
|
32
|
+
getSkillRegistry(): SkillRegistry | null;
|
|
33
|
+
/** Set middleware pipeline (e.g., gateway semantic injection). */
|
|
34
|
+
setMiddleware(middleware: Middleware[]): void;
|
|
35
|
+
chat(userInput: string, signal?: AbortSignal, approveTool?: ApproveToolFn, permissionLevel?: PermissionLevel, onStep?: (step: StepResult) => void): Promise<ChatResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Load a previously persisted session by id, replacing the in-memory history.
|
|
38
|
+
* Re-seeds the system message if the loaded set has none. No-op when no
|
|
39
|
+
* backend is configured.
|
|
40
|
+
*/
|
|
41
|
+
loadSession(sessionId: string): Promise<boolean>;
|
|
42
|
+
/** Active session id (rotated by `clearConversation` when persistence is on). */
|
|
43
|
+
getSessionId(): string;
|
|
44
|
+
/** Configured persistence backend, or null when persistence is disabled. */
|
|
45
|
+
getPersistence(): PersistenceBackend | null;
|
|
46
|
+
clearConversation(): void;
|
|
47
|
+
/** Public accessor for the current message history. */
|
|
48
|
+
getMessages(): Message[];
|
|
49
|
+
/** Replace the message history (e.g., after compaction). */
|
|
50
|
+
setMessages(messages: Message[]): void;
|
|
51
|
+
/** Public accessor for the active LLM provider. */
|
|
52
|
+
getProvider(): LLMProvider;
|
|
53
|
+
/** Public accessor for the active model name. */
|
|
54
|
+
getModel(): string;
|
|
55
|
+
switchProvider(provider: LLMProvider, model: string): void;
|
|
56
|
+
abort(): void;
|
|
57
|
+
createAbortSignal(): AbortSignal;
|
|
58
|
+
clearAbortController(): void;
|
|
59
|
+
}
|