zerg-ztc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +361 -0
- package/dist/App.d.ts +4 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +499 -0
- package/dist/App.js.map +1 -0
- package/dist/agent/agent.d.ts +54 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +347 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/backends/anthropic.d.ts +13 -0
- package/dist/agent/backends/anthropic.d.ts.map +1 -0
- package/dist/agent/backends/anthropic.js +54 -0
- package/dist/agent/backends/anthropic.js.map +1 -0
- package/dist/agent/backends/gemini.d.ts +13 -0
- package/dist/agent/backends/gemini.d.ts.map +1 -0
- package/dist/agent/backends/gemini.js +71 -0
- package/dist/agent/backends/gemini.js.map +1 -0
- package/dist/agent/backends/inception.d.ts +12 -0
- package/dist/agent/backends/inception.d.ts.map +1 -0
- package/dist/agent/backends/inception.js +15 -0
- package/dist/agent/backends/inception.js.map +1 -0
- package/dist/agent/backends/index.d.ts +7 -0
- package/dist/agent/backends/index.d.ts.map +1 -0
- package/dist/agent/backends/index.js +6 -0
- package/dist/agent/backends/index.js.map +1 -0
- package/dist/agent/backends/openai.d.ts +12 -0
- package/dist/agent/backends/openai.d.ts.map +1 -0
- package/dist/agent/backends/openai.js +15 -0
- package/dist/agent/backends/openai.js.map +1 -0
- package/dist/agent/backends/openai_compatible.d.ts +17 -0
- package/dist/agent/backends/openai_compatible.d.ts.map +1 -0
- package/dist/agent/backends/openai_compatible.js +95 -0
- package/dist/agent/backends/openai_compatible.js.map +1 -0
- package/dist/agent/backends/types.d.ts +49 -0
- package/dist/agent/backends/types.d.ts.map +1 -0
- package/dist/agent/backends/types.js +2 -0
- package/dist/agent/backends/types.js.map +1 -0
- package/dist/agent/commands/clipboard.d.ts +3 -0
- package/dist/agent/commands/clipboard.d.ts.map +1 -0
- package/dist/agent/commands/clipboard.js +72 -0
- package/dist/agent/commands/clipboard.js.map +1 -0
- package/dist/agent/commands/config.d.ts +3 -0
- package/dist/agent/commands/config.d.ts.map +1 -0
- package/dist/agent/commands/config.js +120 -0
- package/dist/agent/commands/config.js.map +1 -0
- package/dist/agent/commands/debug.d.ts +3 -0
- package/dist/agent/commands/debug.d.ts.map +1 -0
- package/dist/agent/commands/debug.js +23 -0
- package/dist/agent/commands/debug.js.map +1 -0
- package/dist/agent/commands/emulation.d.ts +3 -0
- package/dist/agent/commands/emulation.d.ts.map +1 -0
- package/dist/agent/commands/emulation.js +78 -0
- package/dist/agent/commands/emulation.js.map +1 -0
- package/dist/agent/commands/execution.d.ts +3 -0
- package/dist/agent/commands/execution.d.ts.map +1 -0
- package/dist/agent/commands/execution.js +8 -0
- package/dist/agent/commands/execution.js.map +1 -0
- package/dist/agent/commands/help.d.ts +3 -0
- package/dist/agent/commands/help.d.ts.map +1 -0
- package/dist/agent/commands/help.js +19 -0
- package/dist/agent/commands/help.js.map +1 -0
- package/dist/agent/commands/history.d.ts +3 -0
- package/dist/agent/commands/history.d.ts.map +1 -0
- package/dist/agent/commands/history.js +12 -0
- package/dist/agent/commands/history.js.map +1 -0
- package/dist/agent/commands/index.d.ts +4 -0
- package/dist/agent/commands/index.d.ts.map +1 -0
- package/dist/agent/commands/index.js +19 -0
- package/dist/agent/commands/index.js.map +1 -0
- package/dist/agent/commands/model.d.ts +3 -0
- package/dist/agent/commands/model.d.ts.map +1 -0
- package/dist/agent/commands/model.js +10 -0
- package/dist/agent/commands/model.js.map +1 -0
- package/dist/agent/commands/models.d.ts +3 -0
- package/dist/agent/commands/models.d.ts.map +1 -0
- package/dist/agent/commands/models.js +110 -0
- package/dist/agent/commands/models.js.map +1 -0
- package/dist/agent/commands/permissions.d.ts +3 -0
- package/dist/agent/commands/permissions.d.ts.map +1 -0
- package/dist/agent/commands/permissions.js +58 -0
- package/dist/agent/commands/permissions.js.map +1 -0
- package/dist/agent/commands/retry.d.ts +3 -0
- package/dist/agent/commands/retry.d.ts.map +1 -0
- package/dist/agent/commands/retry.js +8 -0
- package/dist/agent/commands/retry.js.map +1 -0
- package/dist/agent/commands/shell.d.ts +4 -0
- package/dist/agent/commands/shell.d.ts.map +1 -0
- package/dist/agent/commands/shell.js +66 -0
- package/dist/agent/commands/shell.js.map +1 -0
- package/dist/agent/commands/skills.d.ts +3 -0
- package/dist/agent/commands/skills.d.ts.map +1 -0
- package/dist/agent/commands/skills.js +50 -0
- package/dist/agent/commands/skills.js.map +1 -0
- package/dist/agent/commands/status.d.ts +3 -0
- package/dist/agent/commands/status.d.ts.map +1 -0
- package/dist/agent/commands/status.js +18 -0
- package/dist/agent/commands/status.js.map +1 -0
- package/dist/agent/commands/types.d.ts +70 -0
- package/dist/agent/commands/types.d.ts.map +1 -0
- package/dist/agent/commands/types.js +2 -0
- package/dist/agent/commands/types.js.map +1 -0
- package/dist/agent/factory.d.ts +13 -0
- package/dist/agent/factory.d.ts.map +1 -0
- package/dist/agent/factory.js +46 -0
- package/dist/agent/factory.js.map +1 -0
- package/dist/agent/index.d.ts +14 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +10 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/runtime/capabilities.d.ts +7 -0
- package/dist/agent/runtime/capabilities.d.ts.map +1 -0
- package/dist/agent/runtime/capabilities.js +8 -0
- package/dist/agent/runtime/capabilities.js.map +1 -0
- package/dist/agent/runtime/memory.d.ts +13 -0
- package/dist/agent/runtime/memory.d.ts.map +1 -0
- package/dist/agent/runtime/memory.js +13 -0
- package/dist/agent/runtime/memory.js.map +1 -0
- package/dist/agent/runtime/policy.d.ts +22 -0
- package/dist/agent/runtime/policy.d.ts.map +1 -0
- package/dist/agent/runtime/policy.js +29 -0
- package/dist/agent/runtime/policy.js.map +1 -0
- package/dist/agent/runtime/session.d.ts +11 -0
- package/dist/agent/runtime/session.d.ts.map +1 -0
- package/dist/agent/runtime/session.js +10 -0
- package/dist/agent/runtime/session.js.map +1 -0
- package/dist/agent/runtime/tracing.d.ts +13 -0
- package/dist/agent/runtime/tracing.d.ts.map +1 -0
- package/dist/agent/runtime/tracing.js +6 -0
- package/dist/agent/runtime/tracing.js.map +1 -0
- package/dist/agent/tools/file.d.ts +5 -0
- package/dist/agent/tools/file.d.ts.map +1 -0
- package/dist/agent/tools/file.js +162 -0
- package/dist/agent/tools/file.js.map +1 -0
- package/dist/agent/tools/index.d.ts +13 -0
- package/dist/agent/tools/index.d.ts.map +1 -0
- package/dist/agent/tools/index.js +34 -0
- package/dist/agent/tools/index.js.map +1 -0
- package/dist/agent/tools/search.d.ts +3 -0
- package/dist/agent/tools/search.d.ts.map +1 -0
- package/dist/agent/tools/search.js +124 -0
- package/dist/agent/tools/search.js.map +1 -0
- package/dist/agent/tools/shell.d.ts +3 -0
- package/dist/agent/tools/shell.d.ts.map +1 -0
- package/dist/agent/tools/shell.js +60 -0
- package/dist/agent/tools/shell.js.map +1 -0
- package/dist/agent/tools/skills.d.ts +3 -0
- package/dist/agent/tools/skills.d.ts.map +1 -0
- package/dist/agent/tools/skills.js +27 -0
- package/dist/agent/tools/skills.js.map +1 -0
- package/dist/agent/tools/types.d.ts +8 -0
- package/dist/agent/tools/types.d.ts.map +1 -0
- package/dist/agent/tools/types.js +2 -0
- package/dist/agent/tools/types.js.map +1 -0
- package/dist/agent/tools/zerg.d.ts +3 -0
- package/dist/agent/tools/zerg.d.ts.map +1 -0
- package/dist/agent/tools/zerg.js +47 -0
- package/dist/agent/tools/zerg.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +75 -0
- package/dist/cli.js.map +1 -0
- package/dist/components/FullScreen.d.ts +28 -0
- package/dist/components/FullScreen.d.ts.map +1 -0
- package/dist/components/FullScreen.js +40 -0
- package/dist/components/FullScreen.js.map +1 -0
- package/dist/components/Header.d.ts +10 -0
- package/dist/components/Header.d.ts.map +1 -0
- package/dist/components/Header.js +14 -0
- package/dist/components/Header.js.map +1 -0
- package/dist/components/InputArea.d.ts +24 -0
- package/dist/components/InputArea.d.ts.map +1 -0
- package/dist/components/InputArea.js +476 -0
- package/dist/components/InputArea.js.map +1 -0
- package/dist/components/MessageList.d.ts +12 -0
- package/dist/components/MessageList.d.ts.map +1 -0
- package/dist/components/MessageList.js +9 -0
- package/dist/components/MessageList.js.map +1 -0
- package/dist/components/StatusBar.d.ts +18 -0
- package/dist/components/StatusBar.d.ts.map +1 -0
- package/dist/components/StatusBar.js +21 -0
- package/dist/components/StatusBar.js.map +1 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +7 -0
- package/dist/components/index.js.map +1 -0
- package/dist/config/types.d.ts +12 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +155 -0
- package/dist/config.js.map +1 -0
- package/dist/debug/logger.d.ts +2 -0
- package/dist/debug/logger.d.ts.map +1 -0
- package/dist/debug/logger.js +15 -0
- package/dist/debug/logger.js.map +1 -0
- package/dist/emulation/catalog.d.ts +4 -0
- package/dist/emulation/catalog.d.ts.map +1 -0
- package/dist/emulation/catalog.js +68 -0
- package/dist/emulation/catalog.js.map +1 -0
- package/dist/emulation/trace_style.d.ts +3 -0
- package/dist/emulation/trace_style.d.ts.map +1 -0
- package/dist/emulation/trace_style.js +10 -0
- package/dist/emulation/trace_style.js.map +1 -0
- package/dist/emulation/types.d.ts +8 -0
- package/dist/emulation/types.d.ts.map +1 -0
- package/dist/emulation/types.js +2 -0
- package/dist/emulation/types.js.map +1 -0
- package/dist/skills/index.d.ts +5 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +36 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +3 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +137 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/registry.d.ts +3 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +5 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/types.d.ts +11 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +2 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/types.d.ts +93 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/core/factory.d.ts +4 -0
- package/dist/ui/core/factory.d.ts.map +1 -0
- package/dist/ui/core/factory.js +7 -0
- package/dist/ui/core/factory.js.map +1 -0
- package/dist/ui/core/index.d.ts +5 -0
- package/dist/ui/core/index.d.ts.map +1 -0
- package/dist/ui/core/index.js +4 -0
- package/dist/ui/core/index.js.map +1 -0
- package/dist/ui/core/input.d.ts +22 -0
- package/dist/ui/core/input.d.ts.map +1 -0
- package/dist/ui/core/input.js +15 -0
- package/dist/ui/core/input.js.map +1 -0
- package/dist/ui/core/input_segments.d.ts +19 -0
- package/dist/ui/core/input_segments.d.ts.map +1 -0
- package/dist/ui/core/input_segments.js +367 -0
- package/dist/ui/core/input_segments.js.map +1 -0
- package/dist/ui/core/input_state.d.ts +24 -0
- package/dist/ui/core/input_state.d.ts.map +1 -0
- package/dist/ui/core/input_state.js +2 -0
- package/dist/ui/core/input_state.js.map +1 -0
- package/dist/ui/core/layout_yoga.d.ts +11 -0
- package/dist/ui/core/layout_yoga.d.ts.map +1 -0
- package/dist/ui/core/layout_yoga.js +102 -0
- package/dist/ui/core/layout_yoga.js.map +1 -0
- package/dist/ui/core/style.d.ts +3 -0
- package/dist/ui/core/style.d.ts.map +1 -0
- package/dist/ui/core/style.js +37 -0
- package/dist/ui/core/style.js.map +1 -0
- package/dist/ui/core/types.d.ts +50 -0
- package/dist/ui/core/types.d.ts.map +1 -0
- package/dist/ui/core/types.js +2 -0
- package/dist/ui/core/types.js.map +1 -0
- package/dist/ui/ink/index.d.ts +2 -0
- package/dist/ui/ink/index.d.ts.map +1 -0
- package/dist/ui/ink/index.js +2 -0
- package/dist/ui/ink/index.js.map +1 -0
- package/dist/ui/ink/render.d.ts +6 -0
- package/dist/ui/ink/render.d.ts.map +1 -0
- package/dist/ui/ink/render.js +14 -0
- package/dist/ui/ink/render.js.map +1 -0
- package/dist/ui/views/app.d.ts +28 -0
- package/dist/ui/views/app.d.ts.map +1 -0
- package/dist/ui/views/app.js +59 -0
- package/dist/ui/views/app.js.map +1 -0
- package/dist/ui/views/header.d.ts +11 -0
- package/dist/ui/views/header.d.ts.map +1 -0
- package/dist/ui/views/header.js +28 -0
- package/dist/ui/views/header.js.map +1 -0
- package/dist/ui/views/input_area.d.ts +45 -0
- package/dist/ui/views/input_area.d.ts.map +1 -0
- package/dist/ui/views/input_area.js +183 -0
- package/dist/ui/views/input_area.js.map +1 -0
- package/dist/ui/views/message_list.d.ts +12 -0
- package/dist/ui/views/message_list.d.ts.map +1 -0
- package/dist/ui/views/message_list.js +381 -0
- package/dist/ui/views/message_list.js.map +1 -0
- package/dist/ui/views/status_bar.d.ts +18 -0
- package/dist/ui/views/status_bar.d.ts.map +1 -0
- package/dist/ui/views/status_bar.js +72 -0
- package/dist/ui/views/status_bar.js.map +1 -0
- package/dist/ui/vue/index.d.ts +5 -0
- package/dist/ui/vue/index.d.ts.map +1 -0
- package/dist/ui/vue/index.js +50 -0
- package/dist/ui/vue/index.js.map +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +39 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/clipboard_image.d.ts +2 -0
- package/dist/utils/clipboard_image.d.ts.map +1 -0
- package/dist/utils/clipboard_image.js +37 -0
- package/dist/utils/clipboard_image.js.map +1 -0
- package/dist/utils/diff.d.ts +2 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +49 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/image_preview.d.ts +2 -0
- package/dist/utils/image_preview.d.ts.map +1 -0
- package/dist/utils/image_preview.js +37 -0
- package/dist/utils/image_preview.js.map +1 -0
- package/dist/utils/models.d.ts +8 -0
- package/dist/utils/models.d.ts.map +1 -0
- package/dist/utils/models.js +85 -0
- package/dist/utils/models.js.map +1 -0
- package/dist/utils/shell.d.ts +4 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +57 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/tool_summary.d.ts +3 -0
- package/dist/utils/tool_summary.d.ts.map +1 -0
- package/dist/utils/tool_summary.js +54 -0
- package/dist/utils/tool_summary.js.map +1 -0
- package/dist/utils/tool_trace.d.ts +9 -0
- package/dist/utils/tool_trace.d.ts.map +1 -0
- package/dist/utils/tool_trace.js +183 -0
- package/dist/utils/tool_trace.js.map +1 -0
- package/package.json +41 -0
- package/src/App.tsx +576 -0
- package/src/agent/agent.ts +407 -0
- package/src/agent/backends/anthropic.ts +76 -0
- package/src/agent/backends/gemini.ts +107 -0
- package/src/agent/backends/inception.ts +23 -0
- package/src/agent/backends/index.ts +16 -0
- package/src/agent/backends/openai.ts +23 -0
- package/src/agent/backends/openai_compatible.ts +131 -0
- package/src/agent/backends/types.ts +59 -0
- package/src/agent/commands/clipboard.ts +77 -0
- package/src/agent/commands/config.ts +130 -0
- package/src/agent/commands/debug.ts +23 -0
- package/src/agent/commands/emulation.ts +80 -0
- package/src/agent/commands/execution.ts +9 -0
- package/src/agent/commands/help.ts +20 -0
- package/src/agent/commands/history.ts +13 -0
- package/src/agent/commands/index.ts +40 -0
- package/src/agent/commands/model.ts +11 -0
- package/src/agent/commands/models.ts +116 -0
- package/src/agent/commands/permissions.ts +64 -0
- package/src/agent/commands/retry.ts +9 -0
- package/src/agent/commands/shell.ts +68 -0
- package/src/agent/commands/skills.ts +54 -0
- package/src/agent/commands/status.ts +19 -0
- package/src/agent/commands/types.ts +78 -0
- package/src/agent/factory.ts +60 -0
- package/src/agent/index.ts +20 -0
- package/src/agent/runtime/capabilities.ts +6 -0
- package/src/agent/runtime/memory.ts +23 -0
- package/src/agent/runtime/policy.ts +48 -0
- package/src/agent/runtime/session.ts +18 -0
- package/src/agent/runtime/tracing.ts +23 -0
- package/src/agent/tools/file.ts +173 -0
- package/src/agent/tools/index.ts +46 -0
- package/src/agent/tools/search.ts +137 -0
- package/src/agent/tools/shell.ts +65 -0
- package/src/agent/tools/skills.ts +28 -0
- package/src/agent/tools/types.ts +10 -0
- package/src/agent/tools/zerg.ts +50 -0
- package/src/cli.tsx +80 -0
- package/src/components/FullScreen.tsx +73 -0
- package/src/components/Header.tsx +27 -0
- package/src/components/InputArea.tsx +551 -0
- package/src/components/MessageList.tsx +25 -0
- package/src/components/StatusBar.tsx +49 -0
- package/src/components/index.tsx +6 -0
- package/src/config/types.ts +11 -0
- package/src/config.ts +178 -0
- package/src/debug/logger.ts +14 -0
- package/src/emulation/README.md +24 -0
- package/src/emulation/catalog.ts +82 -0
- package/src/emulation/trace_style.ts +8 -0
- package/src/emulation/types.ts +7 -0
- package/src/skills/index.ts +36 -0
- package/src/skills/loader.ts +135 -0
- package/src/skills/registry.ts +6 -0
- package/src/skills/types.ts +10 -0
- package/src/types.ts +83 -0
- package/src/ui/README.md +44 -0
- package/src/ui/core/factory.ts +9 -0
- package/src/ui/core/index.ts +4 -0
- package/src/ui/core/input.ts +38 -0
- package/src/ui/core/input_segments.ts +375 -0
- package/src/ui/core/input_state.ts +17 -0
- package/src/ui/core/layout_yoga.ts +122 -0
- package/src/ui/core/style.ts +38 -0
- package/src/ui/core/types.ts +53 -0
- package/src/ui/ink/index.tsx +1 -0
- package/src/ui/ink/render.tsx +49 -0
- package/src/ui/views/app.ts +99 -0
- package/src/ui/views/header.ts +42 -0
- package/src/ui/views/input_area.ts +244 -0
- package/src/ui/views/message_list.ts +427 -0
- package/src/ui/views/status_bar.ts +104 -0
- package/src/ui/vue/index.ts +53 -0
- package/src/utils/clipboard.ts +39 -0
- package/src/utils/clipboard_image.ts +40 -0
- package/src/utils/diff.ts +52 -0
- package/src/utils/image_preview.ts +36 -0
- package/src/utils/models.ts +98 -0
- package/src/utils/shell.ts +63 -0
- package/src/utils/tool_summary.ts +56 -0
- package/src/utils/tool_trace.ts +206 -0
- package/tsconfig.json +22 -0
- package/vite.config.ts +363 -0
package/README.md
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
# ZTC - Zerg Terminal Client
|
|
2
|
+
|
|
3
|
+
A full-screen terminal-based AI agent interface for interacting with the Zerg continual AI system and managing local development tasks.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
◆ Zerg Terminal Client ◆ v0.1.0 Ctrl+C exit • /help
|
|
7
|
+
────────────────────────────────────────────────────────────────────────
|
|
8
|
+
● System • 14:23
|
|
9
|
+
Welcome to ZTC - Zerg Terminal Client.
|
|
10
|
+
Type a message to begin, or /help for commands.
|
|
11
|
+
|
|
12
|
+
❯ You • 14:24
|
|
13
|
+
Can you read the package.json and summarize it?
|
|
14
|
+
|
|
15
|
+
◆ Zerg • 14:24
|
|
16
|
+
I'll read that file for you.
|
|
17
|
+
⚙ read_file (a3f8b2c1) [0.2s]
|
|
18
|
+
path: package.json
|
|
19
|
+
→ {"name":"ztc","version":"0.1.0"...
|
|
20
|
+
|
|
21
|
+
This is ZTC v0.1.0, a Node.js CLI application using Ink for the
|
|
22
|
+
terminal UI and React 18. It has 5 tools available for file
|
|
23
|
+
operations, shell commands, and Zerg queries.
|
|
24
|
+
|
|
25
|
+
❯ _
|
|
26
|
+
|
|
27
|
+
● Ready ◉ ZTC v0.1.0 • a3f8b2c1
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
- **Full-screen terminal UI** - Built with [Ink](https://github.com/vadimdemedes/ink) (React for CLIs)
|
|
33
|
+
- **Agentic tool use** - File I/O, shell commands, directory listing, Zerg integration
|
|
34
|
+
- **Streaming responses** - Real-time output with status indicators
|
|
35
|
+
- **Session management** - Unique session IDs, message history
|
|
36
|
+
- **In-app configuration** - Set API keys and model preferences without restarting
|
|
37
|
+
- **Persistent config** - Settings saved to `~/.ztc/config.json`
|
|
38
|
+
- **Debug mode** - Toggle layout borders for development
|
|
39
|
+
- **Web UI** - Browser-based interface for easier debugging
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Clone or create the project
|
|
45
|
+
mkdir ztc && cd ztc
|
|
46
|
+
|
|
47
|
+
# Copy all source files to their respective locations (see Project Structure)
|
|
48
|
+
|
|
49
|
+
# Install dependencies
|
|
50
|
+
npm install
|
|
51
|
+
|
|
52
|
+
# Run in development mode
|
|
53
|
+
npm run dev
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Requirements
|
|
57
|
+
|
|
58
|
+
- Node.js >= 18
|
|
59
|
+
- npm or yarn
|
|
60
|
+
- Anthropic API key (can be configured in-app)
|
|
61
|
+
|
|
62
|
+
## Usage
|
|
63
|
+
|
|
64
|
+
### Terminal UI
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Development (with hot reload via tsx)
|
|
68
|
+
npm run dev
|
|
69
|
+
|
|
70
|
+
# Production
|
|
71
|
+
npm run build
|
|
72
|
+
npm start
|
|
73
|
+
|
|
74
|
+
# Or install globally
|
|
75
|
+
npm link
|
|
76
|
+
ztc
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Web UI (for debugging)
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm run web
|
|
83
|
+
# Opens at http://localhost:3000
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The web UI provides the same interface in a browser, making it easier to debug layouts and inspect state.
|
|
87
|
+
|
|
88
|
+
## Configuration
|
|
89
|
+
|
|
90
|
+
ZTC stores configuration in `~/.ztc/config.json`. You can manage it via commands:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
/config show # View current configuration
|
|
94
|
+
/config key sk-ant-... # Set Anthropic API key
|
|
95
|
+
/config model claude-opus-4-20250514 # Change model
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Or set via environment variable:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
export ANTHROPIC_API_KEY=sk-ant-your-key-here
|
|
102
|
+
npm run dev
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Config Options
|
|
106
|
+
|
|
107
|
+
| Option | Description | Default |
|
|
108
|
+
|--------|-------------|---------|
|
|
109
|
+
| `apiKey` | Anthropic API key | `$ANTHROPIC_API_KEY` |
|
|
110
|
+
| `model` | Claude model to use | `claude-sonnet-4-20250514` |
|
|
111
|
+
| `maxTokens` | Max response tokens | `4096` |
|
|
112
|
+
| `zergEndpoint` | Zerg API endpoint | `undefined` |
|
|
113
|
+
|
|
114
|
+
## Commands
|
|
115
|
+
|
|
116
|
+
| Command | Description |
|
|
117
|
+
|---------|-------------|
|
|
118
|
+
| `/help` | Show available commands |
|
|
119
|
+
| `/config <show\|key\|model> [value]` | Manage configuration |
|
|
120
|
+
| `/status` | Show current status |
|
|
121
|
+
| `/clear` | Clear message history |
|
|
122
|
+
| `/debug <on\|off>` | Toggle layout debug borders |
|
|
123
|
+
| `/exit` | Exit ZTC |
|
|
124
|
+
|
|
125
|
+
## Keyboard Shortcuts
|
|
126
|
+
|
|
127
|
+
| Shortcut | Action |
|
|
128
|
+
|----------|--------|
|
|
129
|
+
| `Enter` | Submit message |
|
|
130
|
+
| `Ctrl+C` | Exit |
|
|
131
|
+
| `Ctrl+L` | Clear screen |
|
|
132
|
+
| `↑ / ↓` | Navigate command history |
|
|
133
|
+
| `← / →` | Move cursor |
|
|
134
|
+
| `Ctrl+← / Ctrl+→` | Move by word |
|
|
135
|
+
| `Ctrl+A` | Move to start of line |
|
|
136
|
+
| `Ctrl+E` | Move to end of line |
|
|
137
|
+
| `Ctrl+U` | Clear input line |
|
|
138
|
+
| `Ctrl+W` | Delete word before cursor |
|
|
139
|
+
|
|
140
|
+
## Available Tools
|
|
141
|
+
|
|
142
|
+
The agent has access to these tools:
|
|
143
|
+
|
|
144
|
+
### `read_file`
|
|
145
|
+
Read contents of a file.
|
|
146
|
+
```
|
|
147
|
+
Arguments:
|
|
148
|
+
path: string (required) - File path to read
|
|
149
|
+
encoding: string - File encoding (default: utf-8)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `write_file`
|
|
153
|
+
Write content to a file, creating directories if needed.
|
|
154
|
+
```
|
|
155
|
+
Arguments:
|
|
156
|
+
path: string (required) - File path to write
|
|
157
|
+
content: string (required) - Content to write
|
|
158
|
+
append: "true" | "false" - Append instead of overwrite
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### `list_directory`
|
|
162
|
+
List contents of a directory.
|
|
163
|
+
```
|
|
164
|
+
Arguments:
|
|
165
|
+
path: string (required) - Directory path
|
|
166
|
+
recursive: "true" | "false" - List recursively (max 3 levels)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### `run_command`
|
|
170
|
+
Execute a shell command.
|
|
171
|
+
```
|
|
172
|
+
Arguments:
|
|
173
|
+
command: string (required) - Shell command to execute
|
|
174
|
+
cwd: string - Working directory
|
|
175
|
+
timeout: string - Timeout in ms (default: 30000)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### `zerg_query`
|
|
179
|
+
Query the Zerg continual AI system.
|
|
180
|
+
```
|
|
181
|
+
Arguments:
|
|
182
|
+
query: string (required) - Query for Zerg
|
|
183
|
+
context: string - Additional context
|
|
184
|
+
project: string - Project identifier
|
|
185
|
+
wait: "true" | "false" - Wait for completion
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Project Structure
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
ztc/
|
|
192
|
+
├── package.json # Dependencies and scripts
|
|
193
|
+
├── tsconfig.json # TypeScript configuration
|
|
194
|
+
├── README.md
|
|
195
|
+
└── src/
|
|
196
|
+
├── cli.tsx # CLI entry point
|
|
197
|
+
├── App.tsx # Main application component
|
|
198
|
+
├── types.ts # TypeScript type definitions
|
|
199
|
+
├── config.ts # Configuration store (sync file I/O)
|
|
200
|
+
│
|
|
201
|
+
├── components/
|
|
202
|
+
│ ├── index.ts # Barrel export
|
|
203
|
+
│ ├── Header.tsx # Top header bar
|
|
204
|
+
│ ├── MessageList.tsx # Scrolling message area
|
|
205
|
+
│ ├── InputArea.tsx # Text input with cursor handling
|
|
206
|
+
│ └── StatusBar.tsx # Bottom status bar with spinner
|
|
207
|
+
│
|
|
208
|
+
├── agent/
|
|
209
|
+
│ ├── index.ts # Barrel export
|
|
210
|
+
│ ├── agent.ts # Agent loop, API calls, event emitter
|
|
211
|
+
│ └── tools.ts # Tool definitions and executors
|
|
212
|
+
│
|
|
213
|
+
└── web/
|
|
214
|
+
└── index.html # Standalone browser UI for debugging
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Architecture
|
|
218
|
+
|
|
219
|
+
### Terminal Rendering
|
|
220
|
+
|
|
221
|
+
ZTC uses **Ink** which leverages **Yoga** (the same Flexbox layout engine used by React Native) to render React components to the terminal. This provides:
|
|
222
|
+
|
|
223
|
+
- Familiar React component model
|
|
224
|
+
- Flexbox-based layouts
|
|
225
|
+
- Hooks for input handling
|
|
226
|
+
- Efficient differential updates
|
|
227
|
+
|
|
228
|
+
### Agent Loop
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
User Input → Agent.run() → API Call → Tool Use? → Execute Tools → Continue
|
|
232
|
+
↑ │ │
|
|
233
|
+
└─────────────────────────┴──────────────┘
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
The agent implements a standard ReAct-style loop:
|
|
237
|
+
1. Send conversation to Claude API
|
|
238
|
+
2. If response contains tool calls, execute them
|
|
239
|
+
3. Append results and continue until no more tools
|
|
240
|
+
4. Return final response to UI
|
|
241
|
+
|
|
242
|
+
### Event System
|
|
243
|
+
|
|
244
|
+
The agent emits events for UI updates:
|
|
245
|
+
- `thinking_start` / `thinking_end`
|
|
246
|
+
- `tool_start` / `tool_end` / `tool_error`
|
|
247
|
+
- `stream_start` / `stream_delta` / `stream_end`
|
|
248
|
+
- `error`
|
|
249
|
+
|
|
250
|
+
### Avoiding Flicker
|
|
251
|
+
|
|
252
|
+
Terminal UIs can flicker during re-renders. ZTC prevents this by:
|
|
253
|
+
1. Loading config **synchronously** at startup
|
|
254
|
+
2. Capturing terminal dimensions **once** at module load
|
|
255
|
+
3. Avoiding hooks that cause re-renders (`useStdout`)
|
|
256
|
+
4. Using `useMemo` for computed values
|
|
257
|
+
|
|
258
|
+
## Development
|
|
259
|
+
|
|
260
|
+
### Adding a New Tool
|
|
261
|
+
|
|
262
|
+
1. Define the tool in `src/agent/tools.ts`:
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
export const myTool: Tool = {
|
|
266
|
+
definition: {
|
|
267
|
+
name: 'my_tool',
|
|
268
|
+
description: 'Does something useful',
|
|
269
|
+
parameters: {
|
|
270
|
+
type: 'object',
|
|
271
|
+
properties: {
|
|
272
|
+
arg1: { type: 'string', description: 'First argument' }
|
|
273
|
+
},
|
|
274
|
+
required: ['arg1']
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
execute: async (args) => {
|
|
278
|
+
// Implementation
|
|
279
|
+
return JSON.stringify({ result: 'done' });
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
2. Add to `defaultTools` array in the same file.
|
|
285
|
+
|
|
286
|
+
### Adding a New Command
|
|
287
|
+
|
|
288
|
+
Add to the `commands` array in `src/App.tsx`:
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
{
|
|
292
|
+
name: 'mycommand',
|
|
293
|
+
description: 'Does something',
|
|
294
|
+
usage: '<arg>',
|
|
295
|
+
handler: (args, ctx) => {
|
|
296
|
+
ctx.addMessage({
|
|
297
|
+
role: 'system',
|
|
298
|
+
content: `You said: ${args.join(' ')}`
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Building
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
npm run build # Compile TypeScript to dist/
|
|
308
|
+
npm run clean # Remove dist/
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Roadmap
|
|
312
|
+
|
|
313
|
+
- [ ] **Streaming responses** - Token-by-token output
|
|
314
|
+
- [ ] **Session persistence** - Save/load conversation history
|
|
315
|
+
- [ ] **Multi-line input** - Support for longer prompts
|
|
316
|
+
- [ ] **Zerg integration** - Connect to actual Zerg backend
|
|
317
|
+
- [ ] **Git tools** - Commit, diff, branch operations
|
|
318
|
+
- [ ] **Search tools** - Web search, codebase search
|
|
319
|
+
- [ ] **Shared state module** - Extract core logic for terminal + web UIs
|
|
320
|
+
- [ ] **Plugin system** - Dynamic tool loading
|
|
321
|
+
|
|
322
|
+
## Troubleshooting
|
|
323
|
+
|
|
324
|
+
### "No API key configured"
|
|
325
|
+
|
|
326
|
+
Set your key with:
|
|
327
|
+
```
|
|
328
|
+
/config key sk-ant-your-key-here
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Or via environment:
|
|
332
|
+
```bash
|
|
333
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### "Authentication failed"
|
|
337
|
+
|
|
338
|
+
Your API key may be invalid or expired. Update it with `/config key <new-key>`.
|
|
339
|
+
|
|
340
|
+
### Flickering display
|
|
341
|
+
|
|
342
|
+
This shouldn't happen with current code. If it does:
|
|
343
|
+
1. Ensure you're using the latest source
|
|
344
|
+
2. Check terminal compatibility (works best with modern terminals)
|
|
345
|
+
3. Try the web UI for debugging: `npm run web`
|
|
346
|
+
|
|
347
|
+
### TypeScript errors
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
npm run build
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
If you see type errors, ensure all files match the artifacts exactly.
|
|
354
|
+
|
|
355
|
+
## License
|
|
356
|
+
|
|
357
|
+
MIT
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
Built for the Zerg continual AI system.
|
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AA0DtE,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,EAmgBvB,CAAC;AAEF,eAAe,GAAG,CAAC"}
|