cachibot 0.2.0__tar.gz
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.
- cachibot-0.2.0/.dockerignore +52 -0
- cachibot-0.2.0/.github/workflows/ci.yml +71 -0
- cachibot-0.2.0/.github/workflows/publish.yml +74 -0
- cachibot-0.2.0/.gitignore +90 -0
- cachibot-0.2.0/CLAUDE.md +73 -0
- cachibot-0.2.0/CONTRIBUTING.md +155 -0
- cachibot-0.2.0/Dockerfile +24 -0
- cachibot-0.2.0/LICENSE +21 -0
- cachibot-0.2.0/PKG-INFO +254 -0
- cachibot-0.2.0/README.md +206 -0
- cachibot-0.2.0/assets/cachibot-logo.svg +56 -0
- cachibot-0.2.0/cachibot.example.toml +57 -0
- cachibot-0.2.0/docker-compose.yml +36 -0
- cachibot-0.2.0/frontend/.dockerignore +25 -0
- cachibot-0.2.0/frontend/.gitignore +34 -0
- cachibot-0.2.0/frontend/Dockerfile +52 -0
- cachibot-0.2.0/frontend/eslint.config.js +28 -0
- cachibot-0.2.0/frontend/index.html +16 -0
- cachibot-0.2.0/frontend/package-lock.json +5696 -0
- cachibot-0.2.0/frontend/package.json +40 -0
- cachibot-0.2.0/frontend/postcss.config.js +6 -0
- cachibot-0.2.0/frontend/public/favicon.svg +6 -0
- cachibot-0.2.0/frontend/src/App.tsx +169 -0
- cachibot-0.2.0/frontend/src/api/auth.ts +192 -0
- cachibot-0.2.0/frontend/src/api/client.ts +886 -0
- cachibot-0.2.0/frontend/src/api/connections.ts +171 -0
- cachibot-0.2.0/frontend/src/api/contacts.ts +83 -0
- cachibot-0.2.0/frontend/src/api/index.ts +3 -0
- cachibot-0.2.0/frontend/src/api/knowledge.ts +152 -0
- cachibot-0.2.0/frontend/src/api/models.ts +62 -0
- cachibot-0.2.0/frontend/src/api/skills.ts +170 -0
- cachibot-0.2.0/frontend/src/api/websocket.ts +183 -0
- cachibot-0.2.0/frontend/src/components/auth/LoginPage.tsx +148 -0
- cachibot-0.2.0/frontend/src/components/auth/ProtectedRoute.tsx +87 -0
- cachibot-0.2.0/frontend/src/components/auth/SetupPage.tsx +211 -0
- cachibot-0.2.0/frontend/src/components/chat/ChatPanel.tsx +93 -0
- cachibot-0.2.0/frontend/src/components/chat/InputArea.tsx +94 -0
- cachibot-0.2.0/frontend/src/components/chat/MessageList.tsx +119 -0
- cachibot-0.2.0/frontend/src/components/chat/ThinkingIndicator.tsx +24 -0
- cachibot-0.2.0/frontend/src/components/chat/ToolCallList.tsx +96 -0
- cachibot-0.2.0/frontend/src/components/chat/UsageDisplay.tsx +28 -0
- cachibot-0.2.0/frontend/src/components/common/BotIconRenderer.tsx +80 -0
- cachibot-0.2.0/frontend/src/components/common/Button.tsx +45 -0
- cachibot-0.2.0/frontend/src/components/common/Dialog/Dialog.tsx +88 -0
- cachibot-0.2.0/frontend/src/components/common/Dialog/DialogContent.tsx +28 -0
- cachibot-0.2.0/frontend/src/components/common/Dialog/DialogFooter.tsx +67 -0
- cachibot-0.2.0/frontend/src/components/common/Dialog/DialogHeader.tsx +61 -0
- cachibot-0.2.0/frontend/src/components/common/Dialog/DialogStepper.tsx +171 -0
- cachibot-0.2.0/frontend/src/components/common/Dialog/index.ts +14 -0
- cachibot-0.2.0/frontend/src/components/common/MarkdownRenderer.tsx +142 -0
- cachibot-0.2.0/frontend/src/components/common/ModelSelect.tsx +333 -0
- cachibot-0.2.0/frontend/src/components/common/Spinner.tsx +24 -0
- cachibot-0.2.0/frontend/src/components/common/ToolIconRenderer.tsx +38 -0
- cachibot-0.2.0/frontend/src/components/dialogs/ApprovalDialog.tsx +141 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotDialog.tsx +37 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/index.tsx +241 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/AppearanceStep.tsx +144 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/CapabilitiesStep.tsx +137 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/ConfirmStep.tsx +116 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/DetailsStep.tsx +107 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/ImportStep.tsx +301 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/MethodSelectStep.tsx +116 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/NamePickerStep.tsx +153 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/PersonalityStep.tsx +96 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/PreviewStep.tsx +160 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/PromptReviewStep.tsx +175 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/PurposeStep.tsx +69 -0
- cachibot-0.2.0/frontend/src/components/dialogs/CreateBotWizard/steps/TemplateSelectStep.tsx +111 -0
- cachibot-0.2.0/frontend/src/components/dialogs/SettingsDialog.tsx +144 -0
- cachibot-0.2.0/frontend/src/components/dialogs/ToolConfigDialog.tsx +318 -0
- cachibot-0.2.0/frontend/src/components/knowledge/DocumentList.tsx +120 -0
- cachibot-0.2.0/frontend/src/components/knowledge/DocumentUploader.tsx +124 -0
- cachibot-0.2.0/frontend/src/components/knowledge/InstructionsEditor.tsx +115 -0
- cachibot-0.2.0/frontend/src/components/knowledge/index.ts +3 -0
- cachibot-0.2.0/frontend/src/components/layout/BotRail.tsx +186 -0
- cachibot-0.2.0/frontend/src/components/layout/BotSidebar.tsx +761 -0
- cachibot-0.2.0/frontend/src/components/layout/Header.tsx +160 -0
- cachibot-0.2.0/frontend/src/components/layout/MainLayout.tsx +284 -0
- cachibot-0.2.0/frontend/src/components/layout/Sidebar.tsx +85 -0
- cachibot-0.2.0/frontend/src/components/marketplace/BotCard.tsx +73 -0
- cachibot-0.2.0/frontend/src/components/marketplace/BotDetailDialog.tsx +188 -0
- cachibot-0.2.0/frontend/src/components/marketplace/MarketplaceBrowser.tsx +202 -0
- cachibot-0.2.0/frontend/src/components/marketplace/index.ts +3 -0
- cachibot-0.2.0/frontend/src/components/settings/BotConnectionsPanel.tsx +584 -0
- cachibot-0.2.0/frontend/src/components/settings/ContactsPanel.tsx +251 -0
- cachibot-0.2.0/frontend/src/components/views/AppSettingsView.tsx +1764 -0
- cachibot-0.2.0/frontend/src/components/views/ChatView.tsx +1303 -0
- cachibot-0.2.0/frontend/src/components/views/ConnectionsView.tsx +756 -0
- cachibot-0.2.0/frontend/src/components/views/DashboardView.tsx +426 -0
- cachibot-0.2.0/frontend/src/components/views/JobsView.tsx +449 -0
- cachibot-0.2.0/frontend/src/components/views/ModelsView.tsx +312 -0
- cachibot-0.2.0/frontend/src/components/views/SchedulesView.tsx +541 -0
- cachibot-0.2.0/frontend/src/components/views/SettingsView.tsx +890 -0
- cachibot-0.2.0/frontend/src/components/views/TasksView.tsx +519 -0
- cachibot-0.2.0/frontend/src/components/views/ToolsView.tsx +501 -0
- cachibot-0.2.0/frontend/src/components/views/UsersView.tsx +456 -0
- cachibot-0.2.0/frontend/src/components/views/WorkView.tsx +420 -0
- cachibot-0.2.0/frontend/src/components/views/index.ts +9 -0
- cachibot-0.2.0/frontend/src/hooks/useCommands.ts +115 -0
- cachibot-0.2.0/frontend/src/hooks/useWebSocket.ts +278 -0
- cachibot-0.2.0/frontend/src/index.css +64 -0
- cachibot-0.2.0/frontend/src/lib/language-detector.ts +95 -0
- cachibot-0.2.0/frontend/src/lib/prompt-generator.ts +101 -0
- cachibot-0.2.0/frontend/src/lib/utils.ts +28 -0
- cachibot-0.2.0/frontend/src/main.tsx +27 -0
- cachibot-0.2.0/frontend/src/stores/auth.ts +96 -0
- cachibot-0.2.0/frontend/src/stores/bots.ts +1109 -0
- cachibot-0.2.0/frontend/src/stores/config.ts +39 -0
- cachibot-0.2.0/frontend/src/stores/connections.ts +276 -0
- cachibot-0.2.0/frontend/src/stores/contacts.ts +70 -0
- cachibot-0.2.0/frontend/src/stores/creation-flow.ts +176 -0
- cachibot-0.2.0/frontend/src/stores/creation.ts +341 -0
- cachibot-0.2.0/frontend/src/stores/index.ts +5 -0
- cachibot-0.2.0/frontend/src/stores/knowledge.ts +225 -0
- cachibot-0.2.0/frontend/src/stores/models.ts +58 -0
- cachibot-0.2.0/frontend/src/stores/ui.ts +154 -0
- cachibot-0.2.0/frontend/src/types/index.ts +826 -0
- cachibot-0.2.0/frontend/src/vite-env.d.ts +6 -0
- cachibot-0.2.0/frontend/tailwind.config.js +83 -0
- cachibot-0.2.0/frontend/tsconfig.json +25 -0
- cachibot-0.2.0/frontend/tsconfig.tsbuildinfo +1 -0
- cachibot-0.2.0/frontend/vite.config.ts +20 -0
- cachibot-0.2.0/pyproject.toml +96 -0
- cachibot-0.2.0/src/cachibot/__init__.py +20 -0
- cachibot-0.2.0/src/cachibot/agent.py +876 -0
- cachibot-0.2.0/src/cachibot/api/__init__.py +9 -0
- cachibot-0.2.0/src/cachibot/api/auth.py +198 -0
- cachibot-0.2.0/src/cachibot/api/routes/__init__.py +5 -0
- cachibot-0.2.0/src/cachibot/api/routes/auth.py +421 -0
- cachibot-0.2.0/src/cachibot/api/routes/bots.py +279 -0
- cachibot-0.2.0/src/cachibot/api/routes/chat.py +72 -0
- cachibot-0.2.0/src/cachibot/api/routes/chats.py +177 -0
- cachibot-0.2.0/src/cachibot/api/routes/config.py +83 -0
- cachibot-0.2.0/src/cachibot/api/routes/connections.py +221 -0
- cachibot-0.2.0/src/cachibot/api/routes/contacts.py +141 -0
- cachibot-0.2.0/src/cachibot/api/routes/creation.py +360 -0
- cachibot-0.2.0/src/cachibot/api/routes/documents.py +212 -0
- cachibot-0.2.0/src/cachibot/api/routes/health.py +19 -0
- cachibot-0.2.0/src/cachibot/api/routes/instructions.py +76 -0
- cachibot-0.2.0/src/cachibot/api/routes/marketplace.py +193 -0
- cachibot-0.2.0/src/cachibot/api/routes/models.py +228 -0
- cachibot-0.2.0/src/cachibot/api/routes/skills.py +161 -0
- cachibot-0.2.0/src/cachibot/api/routes/work.py +1621 -0
- cachibot-0.2.0/src/cachibot/api/server.py +185 -0
- cachibot-0.2.0/src/cachibot/api/websocket.py +415 -0
- cachibot-0.2.0/src/cachibot/cli.py +366 -0
- cachibot-0.2.0/src/cachibot/config.py +335 -0
- cachibot-0.2.0/src/cachibot/data/marketplace_templates.py +679 -0
- cachibot-0.2.0/src/cachibot/models/__init__.py +117 -0
- cachibot-0.2.0/src/cachibot/models/auth.py +116 -0
- cachibot-0.2.0/src/cachibot/models/bot.py +75 -0
- cachibot-0.2.0/src/cachibot/models/capabilities.py +39 -0
- cachibot-0.2.0/src/cachibot/models/chat.py +46 -0
- cachibot-0.2.0/src/cachibot/models/chat_model.py +59 -0
- cachibot-0.2.0/src/cachibot/models/command.py +165 -0
- cachibot-0.2.0/src/cachibot/models/config.py +48 -0
- cachibot-0.2.0/src/cachibot/models/connection.py +42 -0
- cachibot-0.2.0/src/cachibot/models/job.py +38 -0
- cachibot-0.2.0/src/cachibot/models/knowledge.py +81 -0
- cachibot-0.2.0/src/cachibot/models/skill.py +95 -0
- cachibot-0.2.0/src/cachibot/models/websocket.py +185 -0
- cachibot-0.2.0/src/cachibot/models/work.py +409 -0
- cachibot-0.2.0/src/cachibot/services/__init__.py +5 -0
- cachibot-0.2.0/src/cachibot/services/adapters/__init__.py +7 -0
- cachibot-0.2.0/src/cachibot/services/adapters/base.py +106 -0
- cachibot-0.2.0/src/cachibot/services/adapters/discord.py +182 -0
- cachibot-0.2.0/src/cachibot/services/adapters/telegram.py +168 -0
- cachibot-0.2.0/src/cachibot/services/auth_service.py +167 -0
- cachibot-0.2.0/src/cachibot/services/bot_creation_service.py +672 -0
- cachibot-0.2.0/src/cachibot/services/command_processor.py +464 -0
- cachibot-0.2.0/src/cachibot/services/context_builder.py +313 -0
- cachibot-0.2.0/src/cachibot/services/document_processor.py +226 -0
- cachibot-0.2.0/src/cachibot/services/message_processor.py +218 -0
- cachibot-0.2.0/src/cachibot/services/name_generator.py +301 -0
- cachibot-0.2.0/src/cachibot/services/platform_manager.py +265 -0
- cachibot-0.2.0/src/cachibot/services/skills.py +348 -0
- cachibot-0.2.0/src/cachibot/services/vector_store.py +184 -0
- cachibot-0.2.0/src/cachibot/storage/__init__.py +33 -0
- cachibot-0.2.0/src/cachibot/storage/database.py +415 -0
- cachibot-0.2.0/src/cachibot/storage/repository.py +1383 -0
- cachibot-0.2.0/src/cachibot/storage/user_repository.py +322 -0
- cachibot-0.2.0/src/cachibot/storage/work_repository.py +1328 -0
- cachibot-0.2.0/src/cachibot/utils/__init__.py +7 -0
- cachibot-0.2.0/src/cachibot/utils/markdown.py +69 -0
- cachibot-0.2.0/tests/__init__.py +1 -0
- cachibot-0.2.0/tests/test_cachibot.py +203 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Git
|
|
2
|
+
.git
|
|
3
|
+
.gitignore
|
|
4
|
+
|
|
5
|
+
# Python
|
|
6
|
+
__pycache__
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
*.so
|
|
10
|
+
.Python
|
|
11
|
+
.venv
|
|
12
|
+
venv
|
|
13
|
+
ENV
|
|
14
|
+
env
|
|
15
|
+
*.egg-info
|
|
16
|
+
.eggs
|
|
17
|
+
dist
|
|
18
|
+
build
|
|
19
|
+
|
|
20
|
+
# IDE
|
|
21
|
+
.idea
|
|
22
|
+
.vscode
|
|
23
|
+
*.swp
|
|
24
|
+
*.swo
|
|
25
|
+
|
|
26
|
+
# Testing
|
|
27
|
+
.pytest_cache
|
|
28
|
+
.coverage
|
|
29
|
+
htmlcov
|
|
30
|
+
.tox
|
|
31
|
+
.nox
|
|
32
|
+
|
|
33
|
+
# Documentation
|
|
34
|
+
docs/_build
|
|
35
|
+
*.md
|
|
36
|
+
|
|
37
|
+
# Frontend (built separately)
|
|
38
|
+
frontend/node_modules
|
|
39
|
+
frontend/dist
|
|
40
|
+
frontend/.git
|
|
41
|
+
|
|
42
|
+
# Local config
|
|
43
|
+
*.local
|
|
44
|
+
.env
|
|
45
|
+
.env.*
|
|
46
|
+
|
|
47
|
+
# OS
|
|
48
|
+
.DS_Store
|
|
49
|
+
Thumbs.db
|
|
50
|
+
|
|
51
|
+
# Website (static, not needed in backend)
|
|
52
|
+
website/
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, dev]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, dev]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: |
|
|
22
|
+
python -m pip install --upgrade pip
|
|
23
|
+
pip install ruff mypy
|
|
24
|
+
|
|
25
|
+
- name: Run Ruff linter
|
|
26
|
+
run: ruff check .
|
|
27
|
+
|
|
28
|
+
- name: Run Ruff formatter check
|
|
29
|
+
run: ruff format --check .
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
runs-on: ${{ matrix.os }}
|
|
33
|
+
strategy:
|
|
34
|
+
fail-fast: false
|
|
35
|
+
matrix:
|
|
36
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
37
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
|
|
42
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
43
|
+
uses: actions/setup-python@v5
|
|
44
|
+
with:
|
|
45
|
+
python-version: ${{ matrix.python-version }}
|
|
46
|
+
|
|
47
|
+
- name: Install dependencies
|
|
48
|
+
run: |
|
|
49
|
+
python -m pip install --upgrade pip
|
|
50
|
+
pip install -e ".[dev]"
|
|
51
|
+
|
|
52
|
+
- name: Run tests
|
|
53
|
+
run: pytest -v
|
|
54
|
+
|
|
55
|
+
typecheck:
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
|
|
60
|
+
- name: Set up Python
|
|
61
|
+
uses: actions/setup-python@v5
|
|
62
|
+
with:
|
|
63
|
+
python-version: "3.12"
|
|
64
|
+
|
|
65
|
+
- name: Install dependencies
|
|
66
|
+
run: |
|
|
67
|
+
python -m pip install --upgrade pip
|
|
68
|
+
pip install -e ".[dev]"
|
|
69
|
+
|
|
70
|
+
- name: Run mypy
|
|
71
|
+
run: mypy src/cachibot
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [dev]
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
|
|
20
|
+
- name: Install build dependencies
|
|
21
|
+
run: |
|
|
22
|
+
python -m pip install --upgrade pip
|
|
23
|
+
pip install build
|
|
24
|
+
|
|
25
|
+
- name: Build package
|
|
26
|
+
run: python -m build
|
|
27
|
+
|
|
28
|
+
- name: Upload artifacts
|
|
29
|
+
uses: actions/upload-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: dist
|
|
32
|
+
path: dist/
|
|
33
|
+
|
|
34
|
+
publish-testpypi:
|
|
35
|
+
needs: build
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
|
|
38
|
+
environment:
|
|
39
|
+
name: testpypi
|
|
40
|
+
url: https://test.pypi.org/project/cachibot/
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download artifacts
|
|
46
|
+
uses: actions/download-artifact@v4
|
|
47
|
+
with:
|
|
48
|
+
name: dist
|
|
49
|
+
path: dist/
|
|
50
|
+
|
|
51
|
+
- name: Publish to TestPyPI
|
|
52
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
53
|
+
with:
|
|
54
|
+
repository-url: https://test.pypi.org/legacy/
|
|
55
|
+
|
|
56
|
+
publish-pypi:
|
|
57
|
+
needs: build
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
60
|
+
environment:
|
|
61
|
+
name: pypi
|
|
62
|
+
url: https://pypi.org/project/cachibot/
|
|
63
|
+
permissions:
|
|
64
|
+
id-token: write
|
|
65
|
+
|
|
66
|
+
steps:
|
|
67
|
+
- name: Download artifacts
|
|
68
|
+
uses: actions/download-artifact@v4
|
|
69
|
+
with:
|
|
70
|
+
name: dist
|
|
71
|
+
path: dist/
|
|
72
|
+
|
|
73
|
+
- name: Publish to PyPI
|
|
74
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
/lib/
|
|
18
|
+
lib64/
|
|
19
|
+
!frontend/src/lib/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
*.manifest
|
|
30
|
+
*.spec
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
|
|
36
|
+
# Unit test / coverage reports
|
|
37
|
+
htmlcov/
|
|
38
|
+
.tox/
|
|
39
|
+
.nox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*.cover
|
|
46
|
+
*.py,cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
.pytest_cache/
|
|
49
|
+
|
|
50
|
+
# Translations
|
|
51
|
+
*.mo
|
|
52
|
+
*.pot
|
|
53
|
+
|
|
54
|
+
# Environments
|
|
55
|
+
.env
|
|
56
|
+
.venv
|
|
57
|
+
env/
|
|
58
|
+
venv/
|
|
59
|
+
ENV/
|
|
60
|
+
env.bak/
|
|
61
|
+
venv.bak/
|
|
62
|
+
|
|
63
|
+
# IDE
|
|
64
|
+
.idea/
|
|
65
|
+
.vscode/
|
|
66
|
+
*.swp
|
|
67
|
+
*.swo
|
|
68
|
+
*~
|
|
69
|
+
|
|
70
|
+
# macOS
|
|
71
|
+
.DS_Store
|
|
72
|
+
|
|
73
|
+
# Windows
|
|
74
|
+
Thumbs.db
|
|
75
|
+
ehthumbs.db
|
|
76
|
+
Desktop.ini
|
|
77
|
+
|
|
78
|
+
# Project specific
|
|
79
|
+
cachibot.toml
|
|
80
|
+
.cachibot/
|
|
81
|
+
|
|
82
|
+
# Secrets
|
|
83
|
+
*.pem
|
|
84
|
+
*.key
|
|
85
|
+
.env*
|
|
86
|
+
|
|
87
|
+
nul
|
|
88
|
+
error.log
|
|
89
|
+
website/*
|
|
90
|
+
settings.local.json
|
cachibot-0.2.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
CachiBot is a security-focused AI agent that uses the Prompture library for structured LLM interactions. It features a Python backend (FastAPI) with WebSocket streaming and a React+TypeScript frontend.
|
|
8
|
+
|
|
9
|
+
## Common Commands
|
|
10
|
+
|
|
11
|
+
### Backend Development
|
|
12
|
+
```bash
|
|
13
|
+
pip install -e ".[dev]" # Install with dev dependencies
|
|
14
|
+
cachibot-server # Start API server (port 6392)
|
|
15
|
+
cachibot "your prompt" # Run single prompt via CLI
|
|
16
|
+
cachibot -i # Interactive mode
|
|
17
|
+
pytest # Run all tests
|
|
18
|
+
pytest -v # Verbose test output
|
|
19
|
+
ruff check . # Lint Python code
|
|
20
|
+
ruff format . # Format Python code
|
|
21
|
+
mypy src/cachibot # Type check
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Frontend Development
|
|
25
|
+
```bash
|
|
26
|
+
cd frontend
|
|
27
|
+
npm install # Install dependencies
|
|
28
|
+
npm run dev # Start Vite dev server (port 5173)
|
|
29
|
+
npm run build # Production build
|
|
30
|
+
npm run lint # ESLint
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The frontend dev server proxies `/api` and `/ws` to `http://127.0.0.1:6392`.
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
### Backend (`src/cachibot/`)
|
|
38
|
+
- **agent.py**: Core `CachibotAgent` dataclass wrapping Prompture's Agent with callbacks, tool registration, and Python sandbox
|
|
39
|
+
- **cli.py**: Typer-based CLI with `cachibot` and `cachi` entry points
|
|
40
|
+
- **api/server.py**: FastAPI app with lifespan management
|
|
41
|
+
- **api/websocket.py**: WebSocket streaming for real-time agent responses
|
|
42
|
+
- **api/routes/**: REST endpoints (chat, config, health, models)
|
|
43
|
+
- **models/**: Pydantic schemas for chat, config, jobs, websocket messages
|
|
44
|
+
- **storage/**: SQLite async database layer with repository pattern
|
|
45
|
+
|
|
46
|
+
### Frontend (`frontend/src/`)
|
|
47
|
+
- **stores/**: Zustand state management with localStorage persistence
|
|
48
|
+
- `bots.ts`: Bot/Chat/Jobs/Tasks stores
|
|
49
|
+
- `ui.ts`: UI state (sidebar, themes)
|
|
50
|
+
- `connections.ts`: API connection state
|
|
51
|
+
- **api/**: REST client and WebSocket management
|
|
52
|
+
- **components/**: React components organized by feature (chat/, common/, dialogs/, layout/, views/)
|
|
53
|
+
|
|
54
|
+
### Agent Tool System
|
|
55
|
+
Built-in tools registered in `agent.py`:
|
|
56
|
+
- `python_execute`: Sandboxed Python execution with AST risk analysis
|
|
57
|
+
- `file_read`, `file_write`, `file_list`, `file_edit`: Workspace file operations
|
|
58
|
+
- `task_complete`: Signal task completion
|
|
59
|
+
|
|
60
|
+
### Configuration
|
|
61
|
+
Supports TOML config files (`~/.cachibot.toml` or `./cachibot.toml`) with environment variable overrides. See `cachibot.example.toml` for all options.
|
|
62
|
+
|
|
63
|
+
## Code Style
|
|
64
|
+
|
|
65
|
+
### Python
|
|
66
|
+
- Google-style docstrings
|
|
67
|
+
- Type hints required (mypy strict)
|
|
68
|
+
- Ruff formatter with line length 100
|
|
69
|
+
|
|
70
|
+
### TypeScript
|
|
71
|
+
- Strict mode enabled
|
|
72
|
+
- Path alias: `@/*` maps to `src/*`
|
|
73
|
+
- ESLint with React Hooks and React Refresh plugins
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Contributing to Cachibot
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Cachibot! 🛡️
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Python 3.10 or higher
|
|
10
|
+
- An Anthropic API key
|
|
11
|
+
|
|
12
|
+
### Development Setup
|
|
13
|
+
|
|
14
|
+
1. **Clone the repository**
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone https://github.com/jhd3197/cachibot.git
|
|
18
|
+
cd cachibot
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. **Create a virtual environment**
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python -m venv venv
|
|
25
|
+
|
|
26
|
+
# Windows
|
|
27
|
+
.\venv\Scripts\activate
|
|
28
|
+
|
|
29
|
+
# Unix/macOS
|
|
30
|
+
source venv/bin/activate
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
3. **Install in development mode**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install -e ".[dev]"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
4. **Set up your API key**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Windows PowerShell
|
|
43
|
+
$env:ANTHROPIC_API_KEY = "your-api-key"
|
|
44
|
+
|
|
45
|
+
# Unix/macOS
|
|
46
|
+
export ANTHROPIC_API_KEY="your-api-key"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Development Workflow
|
|
50
|
+
|
|
51
|
+
### Running Tests
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pytest
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Linting
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
ruff check src/
|
|
61
|
+
ruff format src/
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Type Checking
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
mypy src/cachibot
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Code Style
|
|
71
|
+
|
|
72
|
+
- We use [Ruff](https://github.com/astral-sh/ruff) for linting and formatting
|
|
73
|
+
- Type hints are required for all public functions
|
|
74
|
+
- Docstrings follow Google style
|
|
75
|
+
|
|
76
|
+
### Example
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
def process_file(path: str, encoding: str = "utf-8") -> str:
|
|
80
|
+
"""
|
|
81
|
+
Process a file and return its contents.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
path: Path to the file to process
|
|
85
|
+
encoding: File encoding (default: utf-8)
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
The processed file contents
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
FileNotFoundError: If the file doesn't exist
|
|
92
|
+
"""
|
|
93
|
+
...
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Adding New Tools
|
|
97
|
+
|
|
98
|
+
Tools are the actions Cachibot can take. To add a new tool:
|
|
99
|
+
|
|
100
|
+
1. Create a new file in `src/cachibot/tools/`
|
|
101
|
+
2. Inherit from `BaseTool`
|
|
102
|
+
3. Implement the `execute` method
|
|
103
|
+
4. Register in `agent.py`
|
|
104
|
+
|
|
105
|
+
### Example Tool
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from cachibot.tools import BaseTool, ToolResult
|
|
109
|
+
|
|
110
|
+
class MyTool(BaseTool):
|
|
111
|
+
name = "my_tool"
|
|
112
|
+
description = "Does something useful"
|
|
113
|
+
|
|
114
|
+
def execute(self, param1: str, **kwargs) -> ToolResult:
|
|
115
|
+
try:
|
|
116
|
+
# Do something
|
|
117
|
+
return ToolResult.ok("Success!")
|
|
118
|
+
except Exception as e:
|
|
119
|
+
return ToolResult.fail(str(e))
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Pull Request Process
|
|
123
|
+
|
|
124
|
+
1. Fork the repository
|
|
125
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
126
|
+
3. Make your changes
|
|
127
|
+
4. Run tests and linting
|
|
128
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
129
|
+
6. Push to your fork (`git push origin feature/amazing-feature`)
|
|
130
|
+
7. Open a Pull Request
|
|
131
|
+
|
|
132
|
+
### PR Guidelines
|
|
133
|
+
|
|
134
|
+
- Keep PRs focused on a single feature or fix
|
|
135
|
+
- Update documentation if needed
|
|
136
|
+
- Add tests for new functionality
|
|
137
|
+
- Follow existing code style
|
|
138
|
+
|
|
139
|
+
## Reporting Issues
|
|
140
|
+
|
|
141
|
+
When reporting issues, please include:
|
|
142
|
+
|
|
143
|
+
- Python version
|
|
144
|
+
- Operating system
|
|
145
|
+
- Steps to reproduce
|
|
146
|
+
- Expected vs actual behavior
|
|
147
|
+
- Any error messages
|
|
148
|
+
|
|
149
|
+
## Questions?
|
|
150
|
+
|
|
151
|
+
Feel free to open an issue for questions or join discussions.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
Made with 🛡️ by [jhd3197](https://jhd3197.com)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# CachiBot - The Armored AI Agent
|
|
2
|
+
# Multi-stage build for Python backend
|
|
3
|
+
|
|
4
|
+
FROM python:3.11-slim AS backend
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
# Install system dependencies
|
|
9
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
10
|
+
build-essential \
|
|
11
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
12
|
+
|
|
13
|
+
# Copy project files
|
|
14
|
+
COPY pyproject.toml README.md ./
|
|
15
|
+
COPY src/ ./src/
|
|
16
|
+
|
|
17
|
+
# Install the package
|
|
18
|
+
RUN pip install --no-cache-dir -e .
|
|
19
|
+
|
|
20
|
+
# Expose backend port
|
|
21
|
+
EXPOSE 6392
|
|
22
|
+
|
|
23
|
+
# Run the server
|
|
24
|
+
CMD ["cachibot-server"]
|
cachibot-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 jhd3197
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|