@hybridaione/hybridclaw 0.1.5
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/.env.example +14 -0
- package/.github/workflows/pages.yml +41 -0
- package/AGENTS.md +24 -0
- package/CHANGELOG.md +113 -0
- package/LICENSE +21 -0
- package/README.md +226 -0
- package/SECURITY.md +67 -0
- package/config.example.json +62 -0
- package/container/Dockerfile +23 -0
- package/container/package-lock.json +246 -0
- package/container/package.json +17 -0
- package/container/src/hybridai-client.ts +38 -0
- package/container/src/index.ts +198 -0
- package/container/src/ipc.ts +37 -0
- package/container/src/tools.ts +1008 -0
- package/container/src/types.ts +74 -0
- package/container/src/web-fetch.ts +389 -0
- package/container/tsconfig.json +16 -0
- package/dist/agent.d.ts +3 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +21 -0
- package/dist/agent.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +32 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +107 -0
- package/dist/config.js.map +1 -0
- package/dist/container-runner.d.ts +11 -0
- package/dist/container-runner.d.ts.map +1 -0
- package/dist/container-runner.js +246 -0
- package/dist/container-runner.js.map +1 -0
- package/dist/conversation.d.ts +18 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +29 -0
- package/dist/conversation.js.map +1 -0
- package/dist/db.d.ts +29 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +205 -0
- package/dist/db.js.map +1 -0
- package/dist/discord.d.ts +17 -0
- package/dist/discord.d.ts.map +1 -0
- package/dist/discord.js +115 -0
- package/dist/discord.js.map +1 -0
- package/dist/env.d.ts +6 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +36 -0
- package/dist/env.js.map +1 -0
- package/dist/gateway-client.d.ts +8 -0
- package/dist/gateway-client.d.ts.map +1 -0
- package/dist/gateway-client.js +57 -0
- package/dist/gateway-client.js.map +1 -0
- package/dist/gateway-service.d.ts +23 -0
- package/dist/gateway-service.d.ts.map +1 -0
- package/dist/gateway-service.js +360 -0
- package/dist/gateway-service.js.map +1 -0
- package/dist/gateway-types.d.ts +40 -0
- package/dist/gateway-types.d.ts.map +1 -0
- package/dist/gateway-types.js +6 -0
- package/dist/gateway-types.js.map +1 -0
- package/dist/gateway.d.ts +2 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +138 -0
- package/dist/gateway.js.map +1 -0
- package/dist/hatch.d.ts +7 -0
- package/dist/hatch.d.ts.map +1 -0
- package/dist/hatch.js +99 -0
- package/dist/hatch.js.map +1 -0
- package/dist/health.d.ts +2 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +169 -0
- package/dist/health.js.map +1 -0
- package/dist/heartbeat.d.ts +3 -0
- package/dist/heartbeat.d.ts.map +1 -0
- package/dist/heartbeat.js +103 -0
- package/dist/heartbeat.js.map +1 -0
- package/dist/hybridai-bots.d.ts +5 -0
- package/dist/hybridai-bots.d.ts.map +1 -0
- package/dist/hybridai-bots.js +34 -0
- package/dist/hybridai-bots.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc.d.ts +33 -0
- package/dist/ipc.d.ts.map +1 -0
- package/dist/ipc.js +142 -0
- package/dist/ipc.js.map +1 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +21 -0
- package/dist/logger.js.map +1 -0
- package/dist/mount-security.d.ts +28 -0
- package/dist/mount-security.d.ts.map +1 -0
- package/dist/mount-security.js +187 -0
- package/dist/mount-security.js.map +1 -0
- package/dist/onboarding.d.ts +7 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +445 -0
- package/dist/onboarding.js.map +1 -0
- package/dist/prompt-hooks.d.ts +17 -0
- package/dist/prompt-hooks.d.ts.map +1 -0
- package/dist/prompt-hooks.js +83 -0
- package/dist/prompt-hooks.js.map +1 -0
- package/dist/runtime-config.d.ts +78 -0
- package/dist/runtime-config.d.ts.map +1 -0
- package/dist/runtime-config.js +471 -0
- package/dist/runtime-config.js.map +1 -0
- package/dist/scheduled-task-runner.d.ts +11 -0
- package/dist/scheduled-task-runner.d.ts.map +1 -0
- package/dist/scheduled-task-runner.js +16 -0
- package/dist/scheduled-task-runner.js.map +1 -0
- package/dist/scheduler.d.ts +11 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +165 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/session-maintenance.d.ts +9 -0
- package/dist/session-maintenance.d.ts.map +1 -0
- package/dist/session-maintenance.js +168 -0
- package/dist/session-maintenance.js.map +1 -0
- package/dist/session-transcripts.d.ts +11 -0
- package/dist/session-transcripts.d.ts.map +1 -0
- package/dist/session-transcripts.js +32 -0
- package/dist/session-transcripts.js.map +1 -0
- package/dist/side-effects.d.ts +3 -0
- package/dist/side-effects.d.ts.map +1 -0
- package/dist/side-effects.js +30 -0
- package/dist/side-effects.js.map +1 -0
- package/dist/skills.d.ts +32 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +376 -0
- package/dist/skills.js.map +1 -0
- package/dist/tui.d.ts +2 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +305 -0
- package/dist/tui.js.map +1 -0
- package/dist/types.d.ts +132 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/workspace.d.ts +25 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +154 -0
- package/dist/workspace.js.map +1 -0
- package/docs/chat.html +929 -0
- package/docs/hai_logo_free.png +0 -0
- package/docs/hero.png +0 -0
- package/docs/index.html +1213 -0
- package/package.json +34 -0
- package/skills/current-time/SKILL.md +26 -0
- package/skills/iss-position/SKILL.md +46 -0
- package/skills/iss-position/agents/openai.yaml +3 -0
- package/skills/iss-position/scripts/get_iss_position.py +107 -0
- package/skills/repo-orientation/SKILL.md +74 -0
- package/src/agent.ts +35 -0
- package/src/cli.ts +35 -0
- package/src/config.ts +137 -0
- package/src/container-runner.ts +305 -0
- package/src/conversation.ts +49 -0
- package/src/db.ts +290 -0
- package/src/discord.ts +156 -0
- package/src/env.ts +36 -0
- package/src/gateway-client.ts +73 -0
- package/src/gateway-service.ts +456 -0
- package/src/gateway-types.ts +47 -0
- package/src/gateway.ts +199 -0
- package/src/health.ts +189 -0
- package/src/heartbeat.ts +121 -0
- package/src/hybridai-bots.ts +48 -0
- package/src/ipc.ts +163 -0
- package/src/logger.ts +26 -0
- package/src/mount-security.ts +216 -0
- package/src/onboarding.ts +569 -0
- package/src/prompt-hooks.ts +113 -0
- package/src/runtime-config.ts +588 -0
- package/src/scheduled-task-runner.ts +26 -0
- package/src/scheduler.ts +196 -0
- package/src/session-maintenance.ts +263 -0
- package/src/session-transcripts.ts +45 -0
- package/src/side-effects.ts +41 -0
- package/src/skills.ts +429 -0
- package/src/tui.ts +327 -0
- package/src/types.ts +135 -0
- package/src/workspace.ts +171 -0
- package/templates/AGENTS.md +104 -0
- package/templates/BOOT.md +3 -0
- package/templates/BOOTSTRAP.md +54 -0
- package/templates/HEARTBEAT.md +5 -0
- package/templates/IDENTITY.md +18 -0
- package/templates/MEMORY.md +19 -0
- package/templates/SOUL.md +36 -0
- package/templates/TOOLS.md +22 -0
- package/templates/USER.md +17 -0
- package/tsconfig.json +18 -0
package/.env.example
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Required secret
|
|
2
|
+
HYBRIDAI_API_KEY=
|
|
3
|
+
|
|
4
|
+
# Optional secrets
|
|
5
|
+
DISCORD_TOKEN= # Enable Discord integration when set
|
|
6
|
+
WEB_API_TOKEN= # Protect /api/* endpoints (Bearer token)
|
|
7
|
+
GATEWAY_API_TOKEN= # Client token override (defaults to WEB_API_TOKEN)
|
|
8
|
+
|
|
9
|
+
# Optional legacy compatibility (prefer config.json instead)
|
|
10
|
+
# HYBRIDAI_BASE_URL=https://hybridai.one
|
|
11
|
+
# HYBRIDAI_MODEL=gpt-5-nano
|
|
12
|
+
# HYBRIDAI_CHATBOT_ID=
|
|
13
|
+
# HYBRIDAI_ENABLE_RAG=true
|
|
14
|
+
# DISCORD_PREFIX=!claw
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Deploy GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths:
|
|
8
|
+
- "docs/**"
|
|
9
|
+
- ".github/workflows/pages.yml"
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
pages: write
|
|
15
|
+
id-token: write
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: "pages"
|
|
19
|
+
cancel-in-progress: true
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
deploy:
|
|
23
|
+
environment:
|
|
24
|
+
name: github-pages
|
|
25
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- name: Setup Pages
|
|
32
|
+
uses: actions/configure-pages@v5
|
|
33
|
+
|
|
34
|
+
- name: Upload docs artifact
|
|
35
|
+
uses: actions/upload-pages-artifact@v3
|
|
36
|
+
with:
|
|
37
|
+
path: docs
|
|
38
|
+
|
|
39
|
+
- name: Deploy to GitHub Pages
|
|
40
|
+
id: deployment
|
|
41
|
+
uses: actions/deploy-pages@v4
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Bump Release
|
|
4
|
+
|
|
5
|
+
When the user says "bump release":
|
|
6
|
+
|
|
7
|
+
1. Bump the requested semantic version (if unspecified, default to patch).
|
|
8
|
+
2. Update version strings in:
|
|
9
|
+
- `package.json`
|
|
10
|
+
- `package-lock.json` (root `version` and `packages[""]`)
|
|
11
|
+
- `container/package.json`
|
|
12
|
+
- `container/package-lock.json` (root `version` and `packages[""]`)
|
|
13
|
+
- any user-facing version text (for example `src/tui.ts` banner).
|
|
14
|
+
3. Move `CHANGELOG.md` release notes from `Unreleased` to the new version heading (or create one).
|
|
15
|
+
4. Update `README.md` "latest tag" link/text if present.
|
|
16
|
+
5. Commit with a release chore message (for example `chore: release vX.Y.Z`).
|
|
17
|
+
6. Create annotated git tag `vX.Y.Z`.
|
|
18
|
+
7. Push commit and tag.
|
|
19
|
+
8. Always create/publish a GitHub Release entry for the tag (tags alone do not update the Releases list).
|
|
20
|
+
|
|
21
|
+
## Related Repositories
|
|
22
|
+
|
|
23
|
+
- **Reference approach**: Learn patterns from strong external and internal implementations, then adapt them to HybridClaw’s architecture and standards. Avoid copy-paste integration.
|
|
24
|
+
- **Platform repo**: The main platform codebase is expected at `../src/chat`; in this local workspace it is available at `../chat`.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- _None yet._
|
|
8
|
+
|
|
9
|
+
## [0.1.5](https://github.com/HybridAIOne/hybridclaw/tree/v0.1.5)
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Explicit trust-model acceptance in onboarding**: Added a required security acceptance gate in onboarding before credentials are used, with operator confirmation token flow and policy metadata persistence.
|
|
14
|
+
- **Typed runtime config system**: Added `config.json` runtime configuration with schema-style normalization, safe defaults, validation, and first-run auto-generation (`config.example.json` as reference).
|
|
15
|
+
- **Runtime config hot reload**: Added file-watch based hot reload for runtime settings (including heartbeat/model/prompt-hook toggles) without full process restart for most knobs.
|
|
16
|
+
- **Security policy document**: Added `SECURITY.md` defining trust model boundaries, operator responsibilities, data handling expectations, and incident guidance.
|
|
17
|
+
- **Prompt hook pipeline**: Added formal prompt orchestration hooks (`bootstrap`, `memory`, `safety`) via `src/prompt-hooks.ts`.
|
|
18
|
+
- **MIT license**: Added a root `LICENSE` file with MIT license text.
|
|
19
|
+
- **HybridAI branding assets**: Added local HybridAI logo assets for landing page branding and navigation.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **Configuration model**: Shifted behavior/configuration defaults from env-only to typed `config.json`; `.env` now primarily carries secrets.
|
|
24
|
+
- **Prompt assembly architecture**: Replaced inline system-prompt composition in conversation/session-maintenance paths with the reusable hook pipeline.
|
|
25
|
+
- **Gateway heartbeat lifecycle**: Gateway now reacts to hot-reloaded config changes for heartbeat-relevant settings and restarts heartbeat accordingly.
|
|
26
|
+
- **Landing page positioning**: Refined site messaging toward enterprise value, security posture, digital coworker framing, and clearer USP comparison.
|
|
27
|
+
- **npm package scope**: Renamed the publish target from `hybridclaw` to `@hybridaione/hybridclaw` and set scoped publish access to public for npm organization publishing.
|
|
28
|
+
|
|
29
|
+
## [0.1.4](https://github.com/HybridAIOne/hybridclaw/tree/v0.1.4)
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **Shared gateway protocol types**: Added `src/gateway-types.ts` to centralize gateway request/response types and command rendering helpers used by service/client layers.
|
|
34
|
+
- **Lint scripts**: Added `lint` scripts in both root and `container/` packages using strict TypeScript checks (`--noUnusedLocals --noUnusedParameters`).
|
|
35
|
+
- **HybridAI onboarding flow**: Added interactive `hybridclaw onboarding` and automatic startup onboarding when `HYBRIDAI_API_KEY` is missing, with browser-driven account creation/login guidance, API key validation, and `.env` persistence.
|
|
36
|
+
- **First-run env bootstrap**: Onboarding now auto-creates `.env` from `.env.example` when `.env` is missing.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- **Gateway-only Discord runtime**: `gateway` now starts Discord integration automatically when `DISCORD_TOKEN` is set.
|
|
41
|
+
- **CLI simplification**: Removed standalone `serve` command; Discord is managed by `gateway`.
|
|
42
|
+
- **Gateway API contract simplification**: Removed compatibility aliases/fallbacks for command and chat payloads; APIs now use the current request schema only.
|
|
43
|
+
- **Onboarding endpoint configuration**: Onboarding now always uses fixed HybridAI paths under `HYBRIDAI_BASE_URL` (`/register`, `/verify_code`, `/admin_api_keys`) without separate endpoint env overrides.
|
|
44
|
+
- **Onboarding prompt UX polish**: Registration/login prompts are now single-line and non-indented, with clearer icon mapping by step (`⚙️` setup/meta, `👤` registration/account choice, `🔒` authentication, `🔑` API key input, `⌨️` bot selection, `🪼` bot list title).
|
|
45
|
+
- **Onboarding login flow cleanup**: Removed the redundant standalone API key page info line and kept the browser-driven auth/key retrieval flow focused on one prompt per action.
|
|
46
|
+
|
|
47
|
+
### Removed
|
|
48
|
+
|
|
49
|
+
- **Legacy workspace migration shim**: Removed old session-workspace migration path handling from IPC bootstrap code.
|
|
50
|
+
- **Unused health helper**: Removed unused `getUptime()` export from `src/health.ts`.
|
|
51
|
+
|
|
52
|
+
## [0.1.3](https://github.com/HybridAIOne/hybridclaw/tree/v0.1.3)
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- **Gateway-first runtime**: Added dedicated gateway entrypoint (`src/gateway.ts`) and shared gateway service layer (`src/gateway-service.ts`) to centralize chat handling, commands, persistence, scheduler, and heartbeat.
|
|
57
|
+
- **Gateway client module**: Added reusable HTTP client (`src/gateway-client.ts`) for thin adapters to call gateway APIs.
|
|
58
|
+
- **Web chat interface**: Added `/chat` UI (`site/chat.html`) with session history, new conversation flow, empty-state CTA, and in-chat thinking indicator.
|
|
59
|
+
- **Gateway HTTP API surface**: Added `/api/status`, `/api/history`, `/api/chat`, and `/api/command` endpoints with optional bearer auth and localhost-only fallback.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- **Adapters simplified**: Discord (`serve`) and TUI now operate as thin gateway clients instead of hosting core runtime logic locally.
|
|
64
|
+
- **CLI and scripts**: Updated command descriptions and npm scripts so `gateway` is the primary runtime (`dev`/`start` now launch gateway).
|
|
65
|
+
- **Gateway HTTP server role**: `src/health.ts` now serves health, API routes, and static web assets.
|
|
66
|
+
- **Configuration and docs**: Added gateway-related env vars (`HEALTH_HOST`, `WEB_API_TOKEN`, `GATEWAY_BASE_URL`, `GATEWAY_API_TOKEN`) and updated `.env.example`/`README.md`.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **TUI startup branding**: Restored the ASCII art startup logo in the TUI banner.
|
|
71
|
+
|
|
72
|
+
## [0.1.2](https://github.com/HybridAIOne/hybridclaw/tree/v0.1.2)
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
|
|
76
|
+
- **Memory tool**: Added a new `memory` container tool with actions (`read`, `append`, `write`, `replace`, `remove`, `list`, `search`) for durable workspace memory files: `MEMORY.md`, `USER.md`, and `memory/YYYY-MM-DD.md`
|
|
77
|
+
- **Session search summaries**: Added a `session_search` tool that searches historical transcript archives and returns ranked per-session summaries with key matching snippets
|
|
78
|
+
- **Automatic transcript archiving**: Host now mirrors conversation turns into `<agent workspace>/.session-transcripts/*.jsonl` for long-term search and summarization
|
|
79
|
+
- **Session compaction module**: Added automatic conversation compaction with persisted session summaries and DB metadata (`session_summary`, `summary_updated_at`, `compaction_count`, `memory_flush_at`)
|
|
80
|
+
- **Pre-compaction memory flush**: Added a pre-compaction flush turn that runs with `memory`-only tool access to persist durable notes before old turns are summarized/pruned
|
|
81
|
+
|
|
82
|
+
### Changed
|
|
83
|
+
|
|
84
|
+
- **Prompt context assembly**: Discord, TUI, and heartbeat sessions now inject persisted `session_summary` context into the system prompt alongside bootstrap files and skills
|
|
85
|
+
- **Compaction execution model**: Discord and TUI now run compaction in the background after sending the assistant reply, preserving responsive UX
|
|
86
|
+
- **Configuration surface**: Added new `.env` knobs for compaction and pre-compaction flush thresholds/limits (`SESSION_COMPACTION_*`, `PRE_COMPACTION_MEMORY_FLUSH_*`)
|
|
87
|
+
- **Container runtime toolchain**: Agent container image now includes `python3`, `pip`, and `uv` in addition to existing `git`, `node`, and `npm` tooling
|
|
88
|
+
|
|
89
|
+
## [0.1.1](https://github.com/HybridAIOne/hybridclaw/tree/v0.1.1)
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
|
|
93
|
+
- **Skills system**: `SKILL.md`-compatible discovery with multi-source loading (managed `~/.codex/skills`, `~/.claude/skills`, project `skills/`, agent workspace `skills/`) and precedence-based resolution
|
|
94
|
+
- **Skill invocation**: Explicit `/skill <name>`, `/skill:<name>`, and `/<name>` slash-command support with automatic SKILL.md body expansion
|
|
95
|
+
- **Skill syncing**: Non-workspace skills are mirrored into the agent workspace so the container can read them via `/workspace/...` paths
|
|
96
|
+
- **Read tool pagination**: `offset` and `limit` parameters for reading large files, with line/byte truncation limits (2000 lines / 50KB) and continuation hints
|
|
97
|
+
- **TUI `/skill` command**: Help text and pass-through for skill invocations in the terminal UI
|
|
98
|
+
- **Example skills**: `repo-orientation` and `current-time` skills in `skills/`
|
|
99
|
+
- **Tool progress events**: Live tool execution updates streamed to Discord and TUI via stderr parsing, with a typed `ToolProgressEvent` pipeline from container runner to UI layers
|
|
100
|
+
|
|
101
|
+
### Changed
|
|
102
|
+
|
|
103
|
+
- **Container iteration limit**: Increased `MAX_ITERATIONS` from 12 to 20
|
|
104
|
+
- **Skills prompt format**: Switched from inline skill content to compact XML metadata; model now reads SKILL.md on demand via `read` tool
|
|
105
|
+
- **TUI unknown slash commands**: Unrecognized `/` commands now fall through to the message processor instead of printing an error, enabling direct `/<skill-name>` invocation
|
|
106
|
+
- **Read tool**: Replaced simple `abbreviate()` output with structured truncation including byte-size awareness and user-friendly continuation messages
|
|
107
|
+
- **Path safety**: `safeJoin` now throws on workspace-escape attempts instead of silently resolving
|
|
108
|
+
- **Tool progress UX**: Progress behavior is now built-in (no env toggles), Discord uses `🦞 running ...`, and TUI shows one transient line per tool invocation that is cleared after completion so only the final `🦞 tools: ...` summary remains
|
|
109
|
+
- **TUI interrupt UX**: `ESC`, `/stop`, and `/abort` now interrupt the active run and return control to the prompt; abort propagates through the host/container pipeline and stops the active container request promptly
|
|
110
|
+
|
|
111
|
+
### Fixed
|
|
112
|
+
|
|
113
|
+
- **Skill invocation in history**: Last user message in conversation history is now expanded for skill invocations, ensuring replayed context includes skill instructions
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HybridAIOne
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# HybridClaw
|
|
2
|
+
|
|
3
|
+
<img width="656" height="621" alt="image" src="https://github.com/user-attachments/assets/59507ace-bd27-40ff-a8e8-0fd6b9af2aa1" />
|
|
4
|
+
|
|
5
|
+
Personal AI assistant bot for Discord, powered by [HybridAI](https://hybridai.one).
|
|
6
|
+
|
|
7
|
+
Release notes: [CHANGELOG.md](./CHANGELOG.md) (latest tag: [`v0.1.5`](https://github.com/HybridAIOne/hybridclaw/tree/v0.1.5))
|
|
8
|
+
|
|
9
|
+
## Install from npm
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g @hybridaione/hybridclaw
|
|
13
|
+
hybridclaw onboarding
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## HybridAI Advantage
|
|
17
|
+
|
|
18
|
+
- Security-focused foundation
|
|
19
|
+
- Enterprise-ready stack
|
|
20
|
+
- EU-stack compatibility
|
|
21
|
+
- GDPR-aligned posture
|
|
22
|
+
- RAG-powered retrieval
|
|
23
|
+
- Document-grounded responses
|
|
24
|
+
|
|
25
|
+
## Architecture
|
|
26
|
+
|
|
27
|
+
- **Gateway service** (Node.js) — shared message/command handlers, SQLite persistence, scheduler, heartbeat, web/API, and optional Discord integration
|
|
28
|
+
- **TUI client** — thin client over HTTP (`/api/chat`, `/api/command`)
|
|
29
|
+
- **Container** (Docker, ephemeral) — HybridAI API client, sandboxed tool executor
|
|
30
|
+
- Communication via file-based IPC (input.json / output.json)
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Install dependencies
|
|
36
|
+
npm install
|
|
37
|
+
cd container && npm install && cd ..
|
|
38
|
+
|
|
39
|
+
# Link the CLI globally
|
|
40
|
+
npm link
|
|
41
|
+
|
|
42
|
+
# Run onboarding (also auto-runs on first `gateway`/`tui` start if API key is missing)
|
|
43
|
+
# On first run, it creates `.env` from `.env.example` automatically if needed.
|
|
44
|
+
hybridclaw onboarding
|
|
45
|
+
|
|
46
|
+
# Onboarding flow:
|
|
47
|
+
# 1) explicitly accept SECURITY.md trust model (required)
|
|
48
|
+
# 2) choose whether to create a new account
|
|
49
|
+
# 3) open /register in browser (optional) and confirm in terminal
|
|
50
|
+
# 4) open /login?next=/admin_api_keys in browser and get an API key
|
|
51
|
+
# 5) paste API key (or URL containing it) back into the CLI
|
|
52
|
+
# 6) choose the default bot and save credentials to `.env`
|
|
53
|
+
|
|
54
|
+
# Start the gateway core runtime first
|
|
55
|
+
hybridclaw gateway
|
|
56
|
+
|
|
57
|
+
# If DISCORD_TOKEN is set, gateway auto-connects to Discord.
|
|
58
|
+
|
|
59
|
+
# Start terminal adapter (optional, in a second terminal)
|
|
60
|
+
hybridclaw tui
|
|
61
|
+
|
|
62
|
+
# Web chat UI (built into gateway)
|
|
63
|
+
# open http://127.0.0.1:9090/chat
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Runtime model:
|
|
67
|
+
|
|
68
|
+
- `hybridclaw gateway` is the core process and should run first.
|
|
69
|
+
- If `DISCORD_TOKEN` is set, Discord runs inside gateway automatically.
|
|
70
|
+
- `hybridclaw tui` is a thin client that connects to the gateway.
|
|
71
|
+
- If you only use web chat, gateway alone is enough.
|
|
72
|
+
|
|
73
|
+
Maintainers can publish the package to npm using:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm publish --access public
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Best-in-class harness upgrades now in runtime:
|
|
80
|
+
|
|
81
|
+
- explicit trust-model acceptance during onboarding (recorded in `config.json`)
|
|
82
|
+
- typed `config.json` runtime settings with defaults, validation, and hot reload
|
|
83
|
+
- formal prompt hook orchestration (`bootstrap`, `memory`, `safety`)
|
|
84
|
+
|
|
85
|
+
## Configuration
|
|
86
|
+
|
|
87
|
+
HybridClaw now uses typed runtime config in `config.json` (auto-created on first run).
|
|
88
|
+
|
|
89
|
+
- Start from `config.example.json` (reference)
|
|
90
|
+
- Runtime watches `config.json` and hot-reloads most settings (model defaults, heartbeat, prompt hooks, limits, etc.)
|
|
91
|
+
- Some settings still require restart to fully apply (for example HTTP bind host/port)
|
|
92
|
+
|
|
93
|
+
Secrets remain in `.env`:
|
|
94
|
+
|
|
95
|
+
- `HYBRIDAI_API_KEY` (required)
|
|
96
|
+
- `DISCORD_TOKEN` (optional)
|
|
97
|
+
- `WEB_API_TOKEN` and `GATEWAY_API_TOKEN` (optional API auth hardening)
|
|
98
|
+
|
|
99
|
+
Trust-model acceptance is stored in `config.json` under `security.*` and is required before runtime starts.
|
|
100
|
+
|
|
101
|
+
See [SECURITY.md](./SECURITY.md) for policy and acceptance details.
|
|
102
|
+
|
|
103
|
+
## Agent workspace
|
|
104
|
+
|
|
105
|
+
Each agent gets a persistent workspace with markdown files that shape its personality and memory:
|
|
106
|
+
|
|
107
|
+
| File | Purpose |
|
|
108
|
+
|------|---------|
|
|
109
|
+
| `SOUL.md` | Personality, tone, identity |
|
|
110
|
+
| `IDENTITY.md` | Name, avatar, emoji |
|
|
111
|
+
| `USER.md` | Info about the human |
|
|
112
|
+
| `MEMORY.md` | Persistent memory across sessions |
|
|
113
|
+
| `AGENTS.md` | Workspace conventions and rules |
|
|
114
|
+
| `TOOLS.md` | Environment-specific notes |
|
|
115
|
+
| `HEARTBEAT.md` | Periodic tasks |
|
|
116
|
+
| `BOOT.md` | Startup instructions |
|
|
117
|
+
|
|
118
|
+
Templates in `templates/` are copied to new agent workspaces on first run.
|
|
119
|
+
Historical turn logs are mirrored into `<workspace>/.session-transcripts/*.jsonl` for `session_search`.
|
|
120
|
+
|
|
121
|
+
## Skills
|
|
122
|
+
|
|
123
|
+
HybridClaw supports `SKILL.md`-based skills (`<skill-name>/SKILL.md`).
|
|
124
|
+
|
|
125
|
+
### Where to put skills
|
|
126
|
+
|
|
127
|
+
You can place skills in:
|
|
128
|
+
|
|
129
|
+
- `./skills/<skill-name>/SKILL.md` (project-level)
|
|
130
|
+
- `<agent workspace>/skills/<skill-name>/SKILL.md` (agent-specific)
|
|
131
|
+
- `$CODEX_HOME/skills/<skill-name>/SKILL.md`, `~/.codex/skills/<skill-name>/SKILL.md`, or `~/.claude/skills/<skill-name>/SKILL.md` (managed/shared)
|
|
132
|
+
|
|
133
|
+
Load precedence is:
|
|
134
|
+
|
|
135
|
+
- managed/shared < project < agent workspace
|
|
136
|
+
|
|
137
|
+
### Required format
|
|
138
|
+
|
|
139
|
+
Each skill must be a folder with a `SKILL.md` file and frontmatter:
|
|
140
|
+
|
|
141
|
+
```markdown
|
|
142
|
+
---
|
|
143
|
+
name: repo-orientation
|
|
144
|
+
description: Quickly map an unfamiliar repository and identify where a requested feature should be implemented.
|
|
145
|
+
user-invocable: true
|
|
146
|
+
disable-model-invocation: false
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
# Repo Orientation
|
|
150
|
+
...instructions...
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Supported frontmatter keys:
|
|
154
|
+
|
|
155
|
+
- `name` (required)
|
|
156
|
+
- `description` (required)
|
|
157
|
+
- `user-invocable` (optional, default `true`)
|
|
158
|
+
- `disable-model-invocation` (optional, default `false`)
|
|
159
|
+
|
|
160
|
+
### Using skills
|
|
161
|
+
|
|
162
|
+
Skills are listed to the model as metadata (`name`, `description`, `location`), and the model reads `SKILL.md` on demand with the `read` tool.
|
|
163
|
+
|
|
164
|
+
Explicit invocation is supported via:
|
|
165
|
+
|
|
166
|
+
- `/skill <name> [input]`
|
|
167
|
+
- `/skill:<name> [input]`
|
|
168
|
+
- `/<name> [input]` (when `user-invocable: true`)
|
|
169
|
+
|
|
170
|
+
Example skill in this repo:
|
|
171
|
+
|
|
172
|
+
- `skills/repo-orientation/SKILL.md`
|
|
173
|
+
|
|
174
|
+
## Agent tools
|
|
175
|
+
|
|
176
|
+
The agent has access to these sandboxed tools inside the container:
|
|
177
|
+
|
|
178
|
+
- `read` / `write` / `edit` / `delete` — file operations
|
|
179
|
+
- `glob` / `grep` — file search
|
|
180
|
+
- `bash` — shell command execution
|
|
181
|
+
- `memory` — durable memory files (`MEMORY.md`, `USER.md`, `memory/YYYY-MM-DD.md`)
|
|
182
|
+
- `session_search` — search/summarize historical sessions from transcript archives
|
|
183
|
+
- `web_fetch` — fetch a URL and extract readable content (HTML → markdown/text)
|
|
184
|
+
|
|
185
|
+
HybridClaw also supports automatic session compaction with pre-compaction memory flush:
|
|
186
|
+
|
|
187
|
+
- when a session gets long, old turns are summarized into `session_summary`
|
|
188
|
+
- before compaction, the agent gets a `memory`-only flush turn to persist durable notes
|
|
189
|
+
|
|
190
|
+
System prompt assembly is handled by a formal hook pipeline:
|
|
191
|
+
|
|
192
|
+
- `bootstrap` hook (workspace bootstrap + skills metadata)
|
|
193
|
+
- `memory` hook (session summary)
|
|
194
|
+
- `safety` hook (runtime guardrails / trust-model constraints)
|
|
195
|
+
|
|
196
|
+
Hook toggles live in `config.json` under `promptHooks`.
|
|
197
|
+
|
|
198
|
+
## Commands
|
|
199
|
+
|
|
200
|
+
CLI runtime commands:
|
|
201
|
+
|
|
202
|
+
- `hybridclaw gateway` — Start core runtime (web/API/scheduler/heartbeat and optional Discord)
|
|
203
|
+
- `hybridclaw tui` — Start terminal client connected to gateway
|
|
204
|
+
- `hybridclaw onboarding` — Run HybridAI account/API key onboarding
|
|
205
|
+
|
|
206
|
+
In Discord, use `!claw help` to see all commands. Key ones:
|
|
207
|
+
|
|
208
|
+
- `!claw <message>` — Talk to the agent
|
|
209
|
+
- `!claw bot set <id>` — Set chatbot for this channel
|
|
210
|
+
- `!claw model set <name>` — Set model for this channel
|
|
211
|
+
- `!claw rag on/off` — Toggle RAG
|
|
212
|
+
- `!claw clear` — Clear conversation history
|
|
213
|
+
- `!claw schedule add "<cron>" <prompt>` — Add scheduled task
|
|
214
|
+
|
|
215
|
+
## Project structure
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
src/gateway.ts Core runtime entrypoint (DB, scheduler, heartbeat, HTTP API)
|
|
219
|
+
src/tui.ts Terminal adapter (thin client to gateway)
|
|
220
|
+
src/discord.ts Discord integration and message transport
|
|
221
|
+
src/gateway-service.ts Core shared agent/session logic used by gateway API
|
|
222
|
+
src/gateway-client.ts HTTP client used by thin clients (e.g. TUI)
|
|
223
|
+
container/src/ Agent code (tools, HybridAI client, IPC)
|
|
224
|
+
templates/ Workspace bootstrap files
|
|
225
|
+
data/ Runtime data (gitignored): SQLite DB, sessions, agent workspaces
|
|
226
|
+
```
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# SECURITY
|
|
2
|
+
|
|
3
|
+
## Policy Version
|
|
4
|
+
|
|
5
|
+
- Version: `2026-02-28`
|
|
6
|
+
- Applies to: all `hybridclaw` runtime modes (`gateway`, `tui`, onboarding, scheduled tasks, heartbeat)
|
|
7
|
+
|
|
8
|
+
## Trust Model
|
|
9
|
+
|
|
10
|
+
HybridClaw runs an LLM-driven agent that can execute tools in a container and read/write files in mounted workspaces.
|
|
11
|
+
|
|
12
|
+
Core assumptions:
|
|
13
|
+
|
|
14
|
+
- LLM output is **untrusted by default** and can be incorrect, over-confident, or unsafe.
|
|
15
|
+
- Tool output and file contents are **untrusted input** and must be validated before high-impact actions.
|
|
16
|
+
- Secrets and credentials (`.env`, API keys, cloud credentials, SSH keys, auth tokens) are **sensitive** and must never be exposed unless explicitly required and approved by policy.
|
|
17
|
+
|
|
18
|
+
## Security Boundaries
|
|
19
|
+
|
|
20
|
+
- Runtime code executes on the host; agent tool execution is isolated in Docker containers.
|
|
21
|
+
- Mount access is restricted by allowlist policy (`~/.config/hybridclaw/mount-allowlist.json`).
|
|
22
|
+
- Additional mounts are denied when allowlist validation fails.
|
|
23
|
+
- Network/API access is governed by configured endpoints and bearer tokens.
|
|
24
|
+
|
|
25
|
+
## Operator Responsibilities
|
|
26
|
+
|
|
27
|
+
By accepting this policy, operators agree to:
|
|
28
|
+
|
|
29
|
+
- Use least privilege for API keys, tokens, and mounts.
|
|
30
|
+
- Review prompts, outputs, and tool plans before high-impact operations.
|
|
31
|
+
- Keep production secrets out of general workspaces whenever possible.
|
|
32
|
+
- Require explicit human approval for destructive operations.
|
|
33
|
+
- Monitor and rotate compromised credentials immediately.
|
|
34
|
+
|
|
35
|
+
## Data Handling
|
|
36
|
+
|
|
37
|
+
HybridClaw may persist:
|
|
38
|
+
|
|
39
|
+
- Conversation history in SQLite (`data/hybridclaw.db`)
|
|
40
|
+
- Session transcripts in workspace logs (`.session-transcripts`)
|
|
41
|
+
- Agent memory files (`MEMORY.md`, `memory/*.md`)
|
|
42
|
+
|
|
43
|
+
Operators are responsible for data retention, backup, and deletion requirements.
|
|
44
|
+
|
|
45
|
+
## Explicit Acceptance Requirement
|
|
46
|
+
|
|
47
|
+
On first run (or when policy version changes), onboarding requires explicit acceptance:
|
|
48
|
+
|
|
49
|
+
- User must confirm review of this document.
|
|
50
|
+
- User must type the acceptance token (`ACCEPT`).
|
|
51
|
+
- Acceptance metadata is saved in `config.json`:
|
|
52
|
+
- `security.trustModelAccepted`
|
|
53
|
+
- `security.trustModelAcceptedAt`
|
|
54
|
+
- `security.trustModelVersion`
|
|
55
|
+
- `security.trustModelAcceptedBy`
|
|
56
|
+
|
|
57
|
+
Runtime startup is blocked until acceptance is present.
|
|
58
|
+
|
|
59
|
+
## Incident Guidance
|
|
60
|
+
|
|
61
|
+
If compromise is suspected:
|
|
62
|
+
|
|
63
|
+
1. Stop gateway and active containers.
|
|
64
|
+
2. Rotate API keys/tokens.
|
|
65
|
+
3. Review mount allowlist and workspace files.
|
|
66
|
+
4. Audit recent session transcripts and task runs.
|
|
67
|
+
5. Re-onboard and re-accept policy after remediation.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"security": {
|
|
4
|
+
"trustModelAccepted": false,
|
|
5
|
+
"trustModelAcceptedAt": "",
|
|
6
|
+
"trustModelVersion": "",
|
|
7
|
+
"trustModelAcceptedBy": ""
|
|
8
|
+
},
|
|
9
|
+
"discord": {
|
|
10
|
+
"prefix": "!claw"
|
|
11
|
+
},
|
|
12
|
+
"hybridai": {
|
|
13
|
+
"baseUrl": "https://hybridai.one",
|
|
14
|
+
"defaultModel": "gpt-5-nano",
|
|
15
|
+
"defaultChatbotId": "",
|
|
16
|
+
"enableRag": true,
|
|
17
|
+
"models": [
|
|
18
|
+
"gpt-5-nano",
|
|
19
|
+
"gpt-5-mini",
|
|
20
|
+
"gpt-5"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"container": {
|
|
24
|
+
"image": "hybridclaw-agent",
|
|
25
|
+
"memory": "512m",
|
|
26
|
+
"cpus": "1",
|
|
27
|
+
"timeoutMs": 60000,
|
|
28
|
+
"additionalMounts": "",
|
|
29
|
+
"maxOutputBytes": 10485760,
|
|
30
|
+
"maxConcurrent": 5
|
|
31
|
+
},
|
|
32
|
+
"heartbeat": {
|
|
33
|
+
"enabled": true,
|
|
34
|
+
"intervalMs": 1800000,
|
|
35
|
+
"channel": ""
|
|
36
|
+
},
|
|
37
|
+
"ops": {
|
|
38
|
+
"healthHost": "127.0.0.1",
|
|
39
|
+
"healthPort": 9090,
|
|
40
|
+
"webApiToken": "",
|
|
41
|
+
"gatewayBaseUrl": "http://127.0.0.1:9090",
|
|
42
|
+
"gatewayApiToken": "",
|
|
43
|
+
"dbPath": "data/hybridclaw.db",
|
|
44
|
+
"logLevel": "info"
|
|
45
|
+
},
|
|
46
|
+
"sessionCompaction": {
|
|
47
|
+
"enabled": true,
|
|
48
|
+
"threshold": 120,
|
|
49
|
+
"keepRecent": 40,
|
|
50
|
+
"summaryMaxChars": 8000,
|
|
51
|
+
"preCompactionMemoryFlush": {
|
|
52
|
+
"enabled": true,
|
|
53
|
+
"maxMessages": 80,
|
|
54
|
+
"maxChars": 24000
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"promptHooks": {
|
|
58
|
+
"bootstrapEnabled": true,
|
|
59
|
+
"memoryEnabled": true,
|
|
60
|
+
"safetyEnabled": true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
FROM node:20-slim
|
|
2
|
+
|
|
3
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
4
|
+
ripgrep git curl python3 python3-pip \
|
|
5
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
6
|
+
|
|
7
|
+
RUN python3 -m pip install --no-cache-dir --break-system-packages uv
|
|
8
|
+
|
|
9
|
+
WORKDIR /app
|
|
10
|
+
|
|
11
|
+
COPY package.json tsconfig.json ./
|
|
12
|
+
RUN npm install
|
|
13
|
+
|
|
14
|
+
COPY src/ src/
|
|
15
|
+
RUN npx tsc
|
|
16
|
+
|
|
17
|
+
RUN chown -R node:node /app
|
|
18
|
+
|
|
19
|
+
USER node
|
|
20
|
+
|
|
21
|
+
WORKDIR /workspace
|
|
22
|
+
|
|
23
|
+
ENTRYPOINT ["node", "/app/dist/index.js"]
|